@hanzo/ui

BusinessHeader

import { buildSeamlessAppUrl, BusinessHeader, BUSINESS_APPS } from '@hanzo/ui/product'

No examples yet.

Types

export type BusinessAppId =
  | 'crm'
  | 'team'
  | 'work'
  | 'cms'
  | 'email'
  | 'marketing'
  | 'ads'
  | 'cal'
  | 'bots'
  | 'social'
  | 'chat'
  | 'dev'
  | 'commerce'
  | 'analytics'
  | 'dataroom'
  | 'sign'
  | 'billing'
  | 'console'
  | 'platform'
export type BusinessAppItem = {
  id: BusinessAppId
  /** Short name in the app switcher grid/list, e.g. 'CRM', 'CMS', 'Email', 'Work'. */
  label: string
  /** Full product title when active at top-left, e.g. 'Hanzo CRM', 'Hanzo Team'. */
  productTitle: string
  /** Subtitle explaining what the app does. */
  description: string
  /** Canonical destination URL. */
  href: string
  /** Whether the surface supports `/auth/fresh?next=/&who=<sub>` session handoff. */
export type BusinessHeaderAccount = {
  sub: string
  owner: string
  name: string
  email?: string
  avatar?: string
}
export type BusinessHeaderOrg = {
  name: string
  displayName?: string
  logo?: string
}
export type BusinessHeaderProps = {
  /** Current application ID (`'crm'`, `'team'`, `'cms'`, `'email'`, `'ads'`, `'console'`, etc.). */
  appId?: BusinessAppId
  /** Explicit product title override, e.g. `'Hanzo CRM'`. */
  appTitle?: string
  /** Whether to show the product title text next to the brand mark when in the app (default: `false`). */
  showAppTitle?: boolean
  /** Available business apps in the app switcher. Defaults to `BUSINESS_APPS`. */
  apps?: readonly BusinessAppItem[]
  /** Custom handler when an app is selected from the switcher. */
  onSelectApp?: (app: BusinessAppItem) => void
  /** Custom brand mark icon at the far left. */
  brandMark?: ReactNode
  /** Current organization shown beneath the product title and in Switch organization. */
  currentOrg?: BusinessHeaderOrg
  /** All organizations the user can switch between. */
  orgs?: readonly BusinessHeaderOrg[]
  /** Called when the user selects an organization. */
  onSelectOrg?: (orgName: string) => void
  /** Called when the user clicks "All organizations" / "Switch organization" modal. */
  onAllOrgs?: () => void
  /** Called when the user clicks "Create organization". */
  onCreateOrg?: () => void
  /** Optional left-side slot before the app identity (e.g. mobile drawer hamburger). */
  leftSlot?: ReactNode
  /** Center slot (e.g. breadcrumbs, global search `⌘K`). */
  children?: ReactNode
  /** Optional right-side slot before the user account menu. */
  rightSlot?: ReactNode
  /** Currently signed-in user identity. */
  user?: {
    sub?: string
    name?: string
    email?: string
    avatar?: string
    owner?: string
  } | null
  /** Authenticated identities available in this browser session (`Switch account`). */
  accounts?: readonly BusinessHeaderAccount[]
  /** Switch to another authenticated identity (`login_hint: account.sub`). */
  onSwitchAccount?: (account: BusinessHeaderAccount) => void
  /** Authenticate an additional identity (`prompt=login`). */
  onAddAccount?: () => void
  /** Open user/account settings. */
  onSettings?: () => void
  /** Open organization settings. */
  onOrgSettings?: () => void
  /** Open billing. */
  onBilling?: () => void
  /** Theme toggle control rendered inside the account menu. */
  theme?: ReactNode
  /** Sign out of the session. */
  onSignOut?: () => void
}

Exports

buildSeamlessAppUrlBusinessHeaderBUSINESS_APPStype BusinessAppIdtype BusinessAppItemtype BusinessHeaderAccounttype BusinessHeaderOrgtype BusinessHeaderProps