import { P as PageHeaderProps, B as BreadcrumbBarProps, N as NavItem } from './index-BpaSOpfS.cjs'; export { A as AI_CREDITS_STATE_TITLES, a as AiCreditsState, b as AiCreditsStateKind, C as CONTACTS_ORIGIN, c as Card, d as CommsNotification, e as CommsNotificationKind, f as ContactSlideIn, g as ContactSlideInProps, F as FormColumn, H as HeaderTabBar, h as HeaderTabBarItem, K as KNOWN_TAB_GLYPHS, i as NotificationsAdapter, j as NotificationsFeed, R as RowMenu, k as RowMenuItem, l as RowMenuPlacement, T as TabGlyphComponent, V as VRM_TIER_LABELS, m as VRM_VERIFIED_TOOLTIP, n as VrmVerifiedBadge, o as VrmVerifiedBadgeProps, p as VrmVerifiedTier, q as aiCreditsWalletUrl, r as contactEmbedUrl, s as contactPageUrl, t as createCommsNotificationsAdapter, u as emptyNotificationsFeed, v as normalizeNotificationsFeed, w as resolveTabGlyph, x as rowMenuPosition, y as useContactSlideIn } from './index-BpaSOpfS.cjs'; import * as react_jsx_runtime from 'react/jsx-runtime'; import * as react from 'react'; import { ReactNode, CSSProperties } from 'react'; import { User, Session, SupabaseClient } from '@supabase/supabase-js'; export { BRAND_APPLE_ICON_LINK_ID, BRAND_FAVICON_LINK_ID, BrandFavicon, applyBrandFavicon, watchBrandFavicon } from './brand-favicon.cjs'; import './theme-preference.cjs'; declare const politogyTheme: Record; declare function PageHeader(props: PageHeaderProps): react_jsx_runtime.JSX.Element; type PageContainerProps = { children: ReactNode; maxW?: string; px?: number | string; py?: number | string; lockHeight?: boolean; }; /** * @deprecated Not for app use. The frame's `
` is fluid (Brand guideline * "Content width is fluid"): apps never emit their own page container, a * second `
`, a max-width or an `mx-auto` wrapper. Render page content * directly inside ``; for form and settings pages use * `` (960px, left-aligned). Warns in development. */ declare function PageContainer({ children, maxW, px, py, lockHeight, }: PageContainerProps): react_jsx_runtime.JSX.Element; /** * @deprecated Not for app use. See `BreadcrumbBarView`. */ declare function BreadcrumbBar(props: BreadcrumbBarProps): react_jsx_runtime.JSX.Element; declare function GlobalUiIdProvider(): null; /** * Authenticated user as exposed to consuming apps. * Mirrors the Supabase user shape with a couple of derived convenience fields. */ interface ShellUser { id: string; email: string | null; displayName: string | null; raw: User; } /** Status of the auth session lifecycle. */ type ShellAuthStatus = 'loading' | 'authenticated' | 'unauthenticated'; /** * Host-app-driven auth for apps that do not authenticate through Supabase * (e.g., OIDC apps like Contacts). When passed to ShellProvider it takes * precedence over `supabaseClient` session tracking. The host app is * responsible for building a Supabase-shaped `user.raw` (id/email/ * user_metadata.full_name) so chrome components render identically. */ interface ShellInjectedAuth { status: ShellAuthStatus; user: ShellUser | null; signOut: () => void | Promise; } /** * One entry in the shell's app-switcher sidebar. The shell uses this list to * render navigation links between sub-apps and to drive Speculation Rules * prerendering. */ interface AppRegistryEntry { /** Stable identifier, e.g., 'crm', 'messaging', 'billing'. */ id: string; /** Display label shown in the sidebar. */ label: string; /** Path prefix this app owns, e.g., '/contacts'. */ path: string; /** Optional Chakra icon name or ReactNode for the sidebar entry. */ icon?: ReactNode; /** True if the user is permitted to see this app in nav. */ visible?: boolean; } /** * Optional render slots for AppLayout. Apps that pass nothing get a clean * chrome with no app-specific widgets. The existing react/app passes its * fuel/modal/notification components into the relevant slots. */ interface ShellSlots { /** * Right side of the header — rendered in the icon row of the header (next * to user menu). Used by the legacy app to mount FuelPopover, * NewTextBellPopup, SystemAlertsMenu, NavigationToggleMenu, and * ImportProgressIndicator. Replaces the older `headerExtrasSlot`. */ headerIconsSlot?: ReactNode; /** Modal layer rendered above everything (positioned absolute). */ modalsSlot?: ReactNode; /** Notifications layer (toasts, popovers, badges). */ notificationsSlot?: ReactNode; /** Below the sidebar nav list (e.g., for org switcher). */ sidebarFooterSlot?: ReactNode; /** Overlay always-on-top components (e.g., import progress indicator). */ overlaySlot?: ReactNode; } /** ---------------- Mode ---------------- */ /** * Per-mode visual / display config supplied by the app. Mirrors the legacy * `MODE_CONFIG[mode]` shape from `react/app/src/contexts/ModeContext.tsx`. * * `icon` is an already-resolved ReactNode (e.g., ) so the shell * doesn't need to know about react-icons. `iconName` is kept around as an * informational string for tooling that wants to look up the icon component * by name. */ interface ShellModeConfig { /** Stable mode identifier, e.g., 'relationship'. */ id: string; /** Display name, e.g., 'Relationship Mode'. */ name: string; /** Mode primary color (hex). */ primaryColor: string; /** Mode accent color (hex). */ accentColor: string; /** Mode background color (hex). */ bgColor: string; /** Mode secondary color (hex) — typically muted text. */ secondaryColor: string; /** Mode white color (hex), usually '#FFFFFF'. */ white: string; /** Pre-resolved icon element for the mode pill leftIcon. */ icon?: ReactNode; /** Informational icon name (for debugging or tooling). */ iconName?: string; } interface ShellModeValue { /** Current mode id, e.g., 'relationship'. */ currentMode: string; /** All available modes for the current org/user. */ modes: ShellModeConfig[]; /** Switch to a different mode. App owns side effects. */ switchMode: (modeId: string) => void; /** * Optional convenience accessor for the current mode's config. If * omitted, shell auto-derives it via `modes.find(m => m.id === currentMode)`. * Avoid object-method syntax (`getModeConfig() { return this.modes[0] }`) — * the function is destructured by shell internals and `this` will not be * bound. Use a closure (`getModeConfig: () => modes[0]`) or just leave it * unset and let shell resolve. */ getModeConfig?: () => ShellModeConfig; } /** ---------------- Nav items ---------------- */ /** * One sidebar nav item. Apps build this list themselves (via * `getLinkItemsForMode` + `applySidebarChildAccessState` etc.) and pass it * through to . The shell renders the rows. */ interface ShellNavItem { name: string; /** A react-icons component (e.g., FiHome). Either icon or brandIcon set. */ icon?: unknown; /** Brand-icon name keyed off `/brand/icons/.svg`. */ brandIcon?: string; /** Route the row navigates to. */ href?: string; /** Nested rows. Renders an accordion when set. */ children?: ShellNavItem[]; /** Small badge shown next to the label (e.g., 'In Development'). */ badge?: string; /** Secondary label rendered below the main label. */ subLabel?: string; /** When true, the row is rendered disabled/non-interactive. */ disabled?: boolean; /** Optional click handler (overrides href). */ action?: () => void; } interface ShellNavItemsValue { items: ShellNavItem[]; } /** ---------------- Nav preference ---------------- */ /** * User preference for nav rendering — whether sub-menus (accordion children) * are shown in the sidebar. */ interface ShellNavigationPreferenceValue { showSubMenu: boolean; } /** ---------------- Role ---------------- */ /** * Active-role display info for the user-menu role badge. App supplies the * resolved values; shell renders the badge. */ interface ShellActiveRoleConfig { name: string; color: string; } interface ShellRoleValue { activeRoleConfig: ShellActiveRoleConfig | null; isSuperAdmin: boolean; } /** ---------------- Footer ---------------- */ interface ShellFooterLink { label: string; href: string; /** When true, the link opens in a new tab (target='_blank'). */ external?: boolean; } /** * Footer / sidebar-footer data shipped from the app. The legacy footer * row shows Privacy / Terms / Subscriptions links plus a CommitCopyButton * with version + commit metadata. All fields are optional so apps can * supply only what they have. */ interface ShellFooterValue { links: ShellFooterLink[]; commit?: string; commitFull?: string; commitDate?: string; commitAuthor?: string; commitLog?: string; version?: string; releaseName?: string; /** * Environment label rendered as a colored chip in the sidebar * footer (e.g., 'production' = red, 'staging' = orange, * 'local'/'development' = green). */ environmentLabel?: string; /** * Optional pre-rendered environment chip element. When supplied, * renders this instead of building a default chip * from `environmentLabel`. Use this when the app already has an * component it wants to drop in unchanged. */ envNode?: ReactNode; /** * When set, renders a diagnostics icon next to * the version that, when clicked, fires this handler. The shell * does not navigate or open anything — apps wire whatever they want * (modal, route, console dump). */ onDiagnosticsClick?: () => void; } /** Props for the top-level ShellProvider. */ interface ShellProviderProps { children: ReactNode; /** Stable ID of the current app, e.g., 'crm'. */ currentApp: string; /** Authenticated Supabase client owned by the host app. Optional since * 0.8.0 — apps that authenticate elsewhere pass `auth` instead. */ supabaseClient?: SupabaseClient; /** Host-driven auth (takes precedence over supabaseClient). Since 0.8.0. */ auth?: ShellInjectedAuth; /** App registry for the sidebar. If omitted, uses the default registry shipped with the shell. */ appRegistry?: AppRegistryEntry[]; /** Optional override for the base path if the app is mounted under a sub-path (e.g., '/contacts'). */ basename?: string; /** If provided, shell renders in the sidebar. */ organization?: ShellOrganizationValue; /** If provided, UserMenu shows account switcher + add-account button. */ linkedAccounts?: ShellLinkedAccountsValue; /** Drives the modal submission flow used by app-supplied support widgets. */ support?: ShellSupportValue; /** Optional element rendered in the header (typically from @the-portland-company/devnotes). */ devNotesMenu?: ReactNode; /** href used by the UserMenu "My Profile" link. Defaults to '/my-profile'. */ myProfileHref?: string; /** Optional avatar URL override for the header UserMenu. Useful when the * app has additional avatar sources (profile.avatar_url, memoji selection * in localStorage, branded default URL) that aren't in user_metadata. */ userAvatarUrl?: string; } /** Return value of useShellAuth(). */ interface ShellAuthValue { status: ShellAuthStatus; user: ShellUser | null; session: Session | null; signOut: () => Promise; } /** * Organization that the current user belongs to. Apps supply this via * ShellProvider so the shell can render in the sidebar. */ interface ShellOrganization { id: string; name: string; logoUrl?: string | null; /** Brand color as a hex string (e.g., '#0066cc'). Used for the org badge fallback. */ brandColor?: string | null; /** Optional user-facing role label in this organization ('owner' | 'admin' | etc.). */ role?: string | null; } interface ShellOrganizationValue { currentOrg: ShellOrganization | null; /** All orgs the user belongs to. */ organizations: ShellOrganization[]; /** Switch to the org with the given id. App owns the side effects. */ switchOrganization: (orgId: string) => Promise | void; /** Optional link rendered at the bottom of the org menu, e.g., '/organizations/new'. */ createOrgHref?: string; /** True while the app is still resolving the org list (renders a skeleton). */ loadingOrgs?: boolean; } /** * An alternate user account the current user can switch into without signing * out. App supplies the data + handlers; shell renders the UI inside UserMenu. */ interface ShellLinkedAccount { id: string; email: string; displayName?: string | null; avatarUrl?: string | null; } interface ShellLinkedAccountsValue { linkedAccounts: ShellLinkedAccount[]; switchToAccount: (accountId: string) => Promise | void; /** Called when the user clicks "Add account" in UserMenu. App opens its own modal. */ onAddAccount: () => void; /** Called when the user wants to remove a linked account. App opens its own confirm. */ onRemoveAccount: (accountId: string) => void; } /** Context emitted to the host's submitSupportRequest handler. */ interface ShellSupportContext { pathname: string; search: string; pageTitle?: string; organizationName?: string; } interface ShellSupportValue { /** * Submit a support request. Host app handles persistence/email/etc. * Shell renders the modal and calls this on submit. */ submitSupportRequest: (input: { email: string; phone: string; message: string; context: ShellSupportContext; }) => Promise; } declare const ShellOrgContext: react.Context; declare const ShellLinkedAccountsContext: react.Context; declare const ShellSupportProviderContext: react.Context; declare const ShellModeContext: react.Context; declare const ShellNavItemsContext: react.Context; declare const ShellNavigationPreferenceContext: react.Context; declare const ShellRoleContext: react.Context; declare const ShellFooterContext: react.Context; interface ShellChromeValue { devNotesMenu: ReactNode | null; myProfileHref: string; brandLogoSrc?: string; headerIconsSlot?: ReactNode; organizationSettingsHref?: string; showContinueOnboarding?: boolean; onContinueOnboarding?: () => void; pageTitle?: string; breadcrumbs?: Array<{ label: string; href?: string; }>; headerActions?: ReactNode; /** Avatar URL override for UserMenu. Apps that store the avatar in their own * profile table or localStorage should pass it here. */ userAvatarUrl?: string; } declare const ShellChromeContext: react.Context; declare function ShellProvider({ children, supabaseClient, auth, currentApp, appRegistry, basename, organization, linkedAccounts, support, devNotesMenu, myProfileHref, userAvatarUrl, }: ShellProviderProps): react_jsx_runtime.JSX.Element; declare function useShellAuth(): ShellAuthValue; declare function useAppRegistry(): AppRegistryEntry[]; declare function useCurrentApp(): string; /** * Returns the organization value supplied to ShellProvider, or null if the * host app didn't pass an `organization` prop. Returning null lets chrome * components (e.g., ) render nothing instead of erroring. */ declare function useShellOrganization(): ShellOrganizationValue | null; /** * Returns the linked-accounts value supplied to ShellProvider, or null if not * provided. UserMenu uses this to decide whether to render the * "switch account" section. */ declare function useShellLinkedAccounts(): ShellLinkedAccountsValue | null; /** * Returns the support handler supplied to ShellProvider, or null if not * provided. SupportRequestButton uses this to decide whether to render. */ declare function useShellSupport(): ShellSupportValue | null; /** * Returns chrome-level options supplied to ShellProvider/ShellChrome * (devNotesMenu slot, myProfileHref, header data, brand logo src, etc.). * Throws if used outside . */ declare function useShellChrome(): ShellChromeValue; /** * Returns the mode value supplied to ShellProvider/ShellChrome, or null if * the host app didn't pass a `mode` prop. Components like use * this to conditionally render. */ declare function useShellMode(): ShellModeValue | null; /** * Returns the nav items value supplied to ShellChrome, or null if the host * app didn't pass a `navItems` prop. The sidebar uses this to decide what * rows to render. */ declare function useShellNavItems(): ShellNavItemsValue | null; /** * Returns the user's navigation rendering preference supplied to * ShellChrome, or null if not provided. NavItem uses this to decide * whether to expand sub-menus. */ declare function useShellNavigationPreference(): ShellNavigationPreferenceValue | null; /** * Returns the active-role info supplied to ShellChrome, or null if not * provided. UserMenu uses this to render the ROLES & ORGANIZATIONS badge. */ declare function useShellRole(): ShellRoleValue | null; /** * Returns the footer data supplied to ShellChrome (links, commit/version * info), or null if not provided. The Sidebar footer reads this to render * Privacy / Terms / Subscriptions + commit copy button. */ declare function useShellFooter(): ShellFooterValue | null; interface BrandLogoProps { src?: string; alt?: string; className?: string; style?: CSSProperties; } /** * Mode-aware brand logo rendered in the sidebar header. The host app * supplies `src` (e.g., a different image per mode); the shell wraps it * in a non-draggable so it never accidentally drags on click. * * Render returns null when no src is supplied so consuming chrome can * gracefully omit the slot. */ declare function BrandLogo({ src, alt, className, style }: BrandLogoProps): react_jsx_runtime.JSX.Element | null; interface BrandIconProps { /** Brand-icon name keyed off `/brand/icons/.svg` in the app's public dir. */ name: string; /** Pixel size shorthand — sets both width and height. */ size?: number; className?: string; style?: CSSProperties; alt?: string; /** Optional prefix for the icon path. Defaults to '/brand/icons/'. */ basePath?: string; } /** * Brand-icon component used by sidebar NavItems. The actual SVG assets live * in the consuming app's `public/brand/icons/.svg` — shell never * imports them directly, only references them by URL. */ declare function BrandIcon({ name, size, className, style, alt, basePath, }: BrandIconProps): react_jsx_runtime.JSX.Element; /** Returns a normalized 7-char hex color, or null if the input isn't valid. */ declare function normalizeHexColor(value?: string | null): string | null; /** * Returns an `rgba(...)` string lightened toward white by `amount` (0–1), * or null if the input isn't a valid hex. */ declare function hexToRgba(hex: string, alpha: number): string | null; /** * Returns a hex color that is `amount` (0–1) blended from `hex` toward * white. Used for the org-menu hover background. */ declare function lightenHexColor(hex: string, amount: number): string | null; /** * Reads `settings.brand_colors[0].value` off an org-like input and returns * the first valid normalized hex. Returns null if the input doesn't have * a usable brand color. */ declare function getOrganizationBrandColor(organization?: { brandColor?: string | null; settings?: { brand_colors?: Array<{ value?: string | null; }> | null; } | null; } | null): string | null; /** * Returns the two-letter badge for an organization name (e.g., "The Portland * Company" -> "TP"). Falls back to "OR" when the input has no letters. */ declare function getOrganizationBadgeLetters(name?: string | null): string; interface UserLike { profile?: { full_name?: string | null; name?: string | null; } | null; user_metadata?: { full_name?: string | null; name?: string | null; } | null; email?: string | null; } /** * Resolves a user-facing display name from a user object. Tries profile * fields first, then user_metadata, then the email local-part, then the * raw email, finally falling back to "User". */ declare function getUserDisplayName(user: UserLike | null | undefined): string; interface RegisterShellPrecacheOptions { /** Path the host app serves the SW from. Default: '/sw-shell.js'. */ scriptUrl?: string; /** Scope the SW controls. Default: '/'. */ scope?: string; } /** * Register the shell precache service worker. Silently no-ops in browsers that * don't support service workers (e.g., old Safari) and during SSR. * * Hosts must copy `node_modules/@the-portland-company/shell/dist/shell-precache.worker.js` * to the URL specified by `scriptUrl` (default `/sw-shell.js`) in their public * directory so the browser can fetch it at registration time. */ declare function registerShellPrecache(opts?: RegisterShellPrecacheOptions): Promise; /** * Build a Speculation Rules JSON payload that prerenders other apps in the * registry on moderate eagerness. Returns null when there are no eligible * other apps to prerender (e.g., this is the only app in the registry). * * @deprecated Legacy `AppRegistryEntry[]`-based registry is unused by any * current consumer. Cross-app sidebar nav now ships real `NavItem[]` trees * (`standardPolitogyNav`) — use `buildNavSpeculationRules` instead, which this * now delegates to. * * The host app is expected to render this as * `` in at runtime. */ declare function buildSpeculationRules(currentApp: string, registry: AppRegistryEntry[]): string | null; /** * Walk a `NavItem[]` tree (as produced by `standardPolitogyNav`) and collect * every absolute, cross-origin, non-destructive, GET-safe link — the * candidate set for prerender/prefetch. Sections and action rows (`onClick`, * no `href`) are skipped; children are walked too (sub-menu rows like * "Command Center" / "New Poll" are real cross-app destinations). */ declare function collectSiblingAppUrls(items: NavItem[], currentOrigin: string): string[]; interface NavSpeculationRules { prerender: [{ source: 'list'; urls: string[]; eagerness: 'moderate'; }]; } /** * Build the Speculation Rules payload for a consumer's real sidebar nav tree: * every sibling `*.politogyvrm.com` app link, `eagerness: "moderate"` (the * browser's own heuristic — prerender starts on hover/pointerdown of a * matching ``, not on page load). Sign-out and other destructive rows are * excluded by `collectSiblingAppUrls`. Returns `null` when there is nothing * to speculate on (e.g., an empty or single-app tree). * * Each target origin must opt in by sending * `Supports-Loading-Mode: credentialed-prerender` on its responses, per the * Speculation Rules cross-origin prerender contract — without it the browser * silently falls back to a normal navigation. (Other apps are adding this * header separately.) */ declare function buildNavSpeculationRules(items: NavItem[], currentOrigin?: string): NavSpeculationRules | null; /** * Renders the cross-app Speculation Rules `