Scope

import { orgScope, filterOrgs } from '@hanzo/ui/product'

No examples yet.

Types

export type Org = { name: string; displayName?: string; logo?: string }
export type OrgScopeConfig = {
/** The brand's own org — the default scope (e.g. `config.iamOrgName`). */
brandOrg: string
/** Storage key namespace — ONE per surface. Default `'hanzo.org'`. */
key?: string
/** Storage — defaults to `window.localStorage`, null-safe on SSR/blocked. */
storage?: Pick<Storage, 'getItem' | 'setItem' | 'removeItem'>
/** Navigate to a path (enter/leave land on home). Default `location.assign`. */
navigate?: (path: string) => void
/** Hard reload (quick-switch refetches everything). Default `location.reload`. */
reload?: () => void
}
export type OrgScope = {
/** The org the surface is currently scoped to (default: the brand org). */
currentOrg(): string
/** Switch the active scope. Passing the brand org clears the override. */
setCurrentOrg(org: string): void
/** True when scoped to a non-default (switched) org. */
isScopedAway(): boolean
/** True once an org has been explicitly ENTERED (picker → shell). */
hasSelectedOrg(): boolean
/** Enter an org from the picker: scope + select + navigate home. */
enterOrg(org: string): void
/** Leave the org (back to the picker): de-select + reset + navigate home. */
leaveOrg(): void
/** In-shell quick switch: persist + keep selection + reload. Same org: no-op. */
switchOrg(org: string): void
}

Exports

orgScopefilterOrgstype Orgtype OrgScopeConfigtype OrgScope