@the-portland-company/shell 0.75.2 → 0.76.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/native.d.cts CHANGED
@@ -113,6 +113,31 @@ type ChromeMe = {
113
113
  email?: string | null;
114
114
  phone?: string | null;
115
115
  };
116
+ /**
117
+ * A shared read cache scoped to one `<NavChromeProvider>` (one fetcher, one
118
+ * page boot). Every consumer of a given (path, orgId) pair within the TTL
119
+ * window awaits the SAME promise instead of firing its own request — this is
120
+ * what collapsed `/orgs` (2-4x), `/me` (2-3x) and `/notifications` (2-3x) per
121
+ * page load, 1-3.5s each, down to one call apiece (nav-latency-report.md
122
+ * Table 2). Keying by orgId means switching the active org is itself the
123
+ * invalidation: the new org gets a fresh key, never the previous org's cached
124
+ * value. A failed request is evicted immediately so the next consumer retries
125
+ * rather than replaying the same rejection for the rest of the TTL.
126
+ */
127
+ declare function createChromeFetchCache(getFetchJson: () => NavChromeFetcher): {
128
+ dedupedFetch: (path: string, init: Parameters<NavChromeFetcher>[1] | undefined, opts?: {
129
+ orgId?: string | null;
130
+ ttlMs?: number;
131
+ }) => Promise<unknown>;
132
+ invalidate: (path: string) => void;
133
+ };
134
+ type NavChromeContextValue = {
135
+ fetchJson: NavChromeFetcher;
136
+ dedupedFetch: ReturnType<typeof createChromeFetchCache>['dedupedFetch'];
137
+ invalidateChromeCache: ReturnType<typeof createChromeFetchCache>['invalidate'];
138
+ me: ChromeMe | null;
139
+ meLoaded: boolean;
140
+ };
116
141
  declare function NavChromeProvider({ fetchJson, children, }: {
117
142
  fetchJson: NavChromeFetcher;
118
143
  children: ReactNode;
@@ -122,6 +147,8 @@ declare function useChromeMe(): {
122
147
  me: ChromeMe | null;
123
148
  loaded: boolean;
124
149
  };
150
+ /** The provider's de-duped chrome read (null outside <NavChromeProvider>). */
151
+ declare function useNavChromeDedupedFetch(): NavChromeContextValue['dedupedFetch'] | null;
125
152
  /** The injected chrome fetcher (null outside <NavChromeProvider>). */
126
153
  declare function useNavChromeFetcher(): NavChromeFetcher | null;
127
154
  type FuelChannelStatus = {
@@ -198,7 +225,9 @@ type ChromeOrgSummary = {
198
225
  * fetcher. Exposed as a hook so the org switcher in the sidebar and the
199
226
  * org-scoped widgets share one request.
200
227
  */
201
- declare function useChromeOrgs(): {
228
+ declare function useChromeOrgs({ enabled }?: {
229
+ enabled?: boolean;
230
+ }): {
202
231
  orgs: ChromeOrgSummary[] | null;
203
232
  loading: boolean;
204
233
  error: boolean;
@@ -246,8 +275,12 @@ declare function FuelAction({ orgId }: {
246
275
  declare function NotificationsAction({ orgId }: {
247
276
  orgId: string | null;
248
277
  }): react_jsx_runtime.JSX.Element;
249
- declare function SupportAction({ orgId }?: {
278
+ declare function SupportAction({ orgId, orgs: knownOrgs, }?: {
250
279
  orgId?: string | null;
280
+ orgs?: {
281
+ id: string;
282
+ name: string | null;
283
+ }[];
251
284
  }): react_jsx_runtime.JSX.Element;
252
285
  declare function SpecOverlayAction({ orgId, orgName }?: {
253
286
  orgId?: string | null;
@@ -893,4 +926,4 @@ type NavAppShellProps = {
893
926
  };
894
927
  declare function NavAppShell({ sidebar, topBar, betaBanner, contentWrapper, accountMenuPlacement, modeId, children, }: NavAppShellProps): react_jsx_runtime.JSX.Element;
895
928
 
896
- export { BETA_BANNER_DISMISS_KEY, CAMPAIGN_FEATURE_AVAILABILITY, CORE_APP_ORIGIN, CORE_BILLING_PATH, type CampaignFeatureAvailability, type ChromeMe, type ChromeNotificationAlert, type ChromeNotificationImport, type ChromeNotificationQuarantine, type ChromeNotificationReply, type ChromeNotificationsPayload, type ChromeOrgSummary, type CommunicationsFuelStatus, FormColumn, FuelAction, type FuelChannelStatus, NavAppShell, type NavAppShellProps, NavBetaBanner, type NavBetaBannerProps, type NavBrand, type NavBreadcrumb, type NavChromeFetcher, NavChromeProvider, NavDisplayAction, type NavDisplayMode, type NavFooter, type NavFooterLink, type NavIcon, type NavItem, type NavLinkComponent, type NavLinkProps, type NavLinkedAccount, type NavMode, type NavModeOption, type NavOrg, type NavOrgOption, type NavRoleBadge, NavSidebar, type NavSidebarProps, type NavTab, NavTabStrip, type NavTabStripProps, NavThemeControl, NavTopBar, type NavTopBarAction, type NavTopBarProps, type NavUser, type NavUserMenu, NotificationsAction, SPECS_ORIGIN, SpecOverlayAction, type StandardNavIconKey, type StandardNavMode, type StandardNavOptions, SupportAction, type ThemePreference, TopBarCountBadge, TopBarPanelArrow, TopBarPopover, TopBarTooltip, TopBarWidgetSlot, clearBetaBannerDismissal, envChipClasses, isNavItemActive, modeIdFromLabel, resolveOrgLogoUrl, shortEnvLabel, shortUserName, standardPolitogyNav, topBarIconButtonClass, useChromeMe, useChromeOrgs, useNavChromeFetcher, useThemePreference };
929
+ export { BETA_BANNER_DISMISS_KEY, CAMPAIGN_FEATURE_AVAILABILITY, CORE_APP_ORIGIN, CORE_BILLING_PATH, type CampaignFeatureAvailability, type ChromeMe, type ChromeNotificationAlert, type ChromeNotificationImport, type ChromeNotificationQuarantine, type ChromeNotificationReply, type ChromeNotificationsPayload, type ChromeOrgSummary, type CommunicationsFuelStatus, FormColumn, FuelAction, type FuelChannelStatus, NavAppShell, type NavAppShellProps, NavBetaBanner, type NavBetaBannerProps, type NavBrand, type NavBreadcrumb, type NavChromeFetcher, NavChromeProvider, NavDisplayAction, type NavDisplayMode, type NavFooter, type NavFooterLink, type NavIcon, type NavItem, type NavLinkComponent, type NavLinkProps, type NavLinkedAccount, type NavMode, type NavModeOption, type NavOrg, type NavOrgOption, type NavRoleBadge, NavSidebar, type NavSidebarProps, type NavTab, NavTabStrip, type NavTabStripProps, NavThemeControl, NavTopBar, type NavTopBarAction, type NavTopBarProps, type NavUser, type NavUserMenu, NotificationsAction, SPECS_ORIGIN, SpecOverlayAction, type StandardNavIconKey, type StandardNavMode, type StandardNavOptions, SupportAction, type ThemePreference, TopBarCountBadge, TopBarPanelArrow, TopBarPopover, TopBarTooltip, TopBarWidgetSlot, clearBetaBannerDismissal, envChipClasses, isNavItemActive, modeIdFromLabel, resolveOrgLogoUrl, shortEnvLabel, shortUserName, standardPolitogyNav, topBarIconButtonClass, useChromeMe, useChromeOrgs, useNavChromeDedupedFetch, useNavChromeFetcher, useThemePreference };
package/dist/native.d.ts CHANGED
@@ -113,6 +113,31 @@ type ChromeMe = {
113
113
  email?: string | null;
114
114
  phone?: string | null;
115
115
  };
116
+ /**
117
+ * A shared read cache scoped to one `<NavChromeProvider>` (one fetcher, one
118
+ * page boot). Every consumer of a given (path, orgId) pair within the TTL
119
+ * window awaits the SAME promise instead of firing its own request — this is
120
+ * what collapsed `/orgs` (2-4x), `/me` (2-3x) and `/notifications` (2-3x) per
121
+ * page load, 1-3.5s each, down to one call apiece (nav-latency-report.md
122
+ * Table 2). Keying by orgId means switching the active org is itself the
123
+ * invalidation: the new org gets a fresh key, never the previous org's cached
124
+ * value. A failed request is evicted immediately so the next consumer retries
125
+ * rather than replaying the same rejection for the rest of the TTL.
126
+ */
127
+ declare function createChromeFetchCache(getFetchJson: () => NavChromeFetcher): {
128
+ dedupedFetch: (path: string, init: Parameters<NavChromeFetcher>[1] | undefined, opts?: {
129
+ orgId?: string | null;
130
+ ttlMs?: number;
131
+ }) => Promise<unknown>;
132
+ invalidate: (path: string) => void;
133
+ };
134
+ type NavChromeContextValue = {
135
+ fetchJson: NavChromeFetcher;
136
+ dedupedFetch: ReturnType<typeof createChromeFetchCache>['dedupedFetch'];
137
+ invalidateChromeCache: ReturnType<typeof createChromeFetchCache>['invalidate'];
138
+ me: ChromeMe | null;
139
+ meLoaded: boolean;
140
+ };
116
141
  declare function NavChromeProvider({ fetchJson, children, }: {
117
142
  fetchJson: NavChromeFetcher;
118
143
  children: ReactNode;
@@ -122,6 +147,8 @@ declare function useChromeMe(): {
122
147
  me: ChromeMe | null;
123
148
  loaded: boolean;
124
149
  };
150
+ /** The provider's de-duped chrome read (null outside <NavChromeProvider>). */
151
+ declare function useNavChromeDedupedFetch(): NavChromeContextValue['dedupedFetch'] | null;
125
152
  /** The injected chrome fetcher (null outside <NavChromeProvider>). */
126
153
  declare function useNavChromeFetcher(): NavChromeFetcher | null;
127
154
  type FuelChannelStatus = {
@@ -198,7 +225,9 @@ type ChromeOrgSummary = {
198
225
  * fetcher. Exposed as a hook so the org switcher in the sidebar and the
199
226
  * org-scoped widgets share one request.
200
227
  */
201
- declare function useChromeOrgs(): {
228
+ declare function useChromeOrgs({ enabled }?: {
229
+ enabled?: boolean;
230
+ }): {
202
231
  orgs: ChromeOrgSummary[] | null;
203
232
  loading: boolean;
204
233
  error: boolean;
@@ -246,8 +275,12 @@ declare function FuelAction({ orgId }: {
246
275
  declare function NotificationsAction({ orgId }: {
247
276
  orgId: string | null;
248
277
  }): react_jsx_runtime.JSX.Element;
249
- declare function SupportAction({ orgId }?: {
278
+ declare function SupportAction({ orgId, orgs: knownOrgs, }?: {
250
279
  orgId?: string | null;
280
+ orgs?: {
281
+ id: string;
282
+ name: string | null;
283
+ }[];
251
284
  }): react_jsx_runtime.JSX.Element;
252
285
  declare function SpecOverlayAction({ orgId, orgName }?: {
253
286
  orgId?: string | null;
@@ -893,4 +926,4 @@ type NavAppShellProps = {
893
926
  };
894
927
  declare function NavAppShell({ sidebar, topBar, betaBanner, contentWrapper, accountMenuPlacement, modeId, children, }: NavAppShellProps): react_jsx_runtime.JSX.Element;
895
928
 
896
- export { BETA_BANNER_DISMISS_KEY, CAMPAIGN_FEATURE_AVAILABILITY, CORE_APP_ORIGIN, CORE_BILLING_PATH, type CampaignFeatureAvailability, type ChromeMe, type ChromeNotificationAlert, type ChromeNotificationImport, type ChromeNotificationQuarantine, type ChromeNotificationReply, type ChromeNotificationsPayload, type ChromeOrgSummary, type CommunicationsFuelStatus, FormColumn, FuelAction, type FuelChannelStatus, NavAppShell, type NavAppShellProps, NavBetaBanner, type NavBetaBannerProps, type NavBrand, type NavBreadcrumb, type NavChromeFetcher, NavChromeProvider, NavDisplayAction, type NavDisplayMode, type NavFooter, type NavFooterLink, type NavIcon, type NavItem, type NavLinkComponent, type NavLinkProps, type NavLinkedAccount, type NavMode, type NavModeOption, type NavOrg, type NavOrgOption, type NavRoleBadge, NavSidebar, type NavSidebarProps, type NavTab, NavTabStrip, type NavTabStripProps, NavThemeControl, NavTopBar, type NavTopBarAction, type NavTopBarProps, type NavUser, type NavUserMenu, NotificationsAction, SPECS_ORIGIN, SpecOverlayAction, type StandardNavIconKey, type StandardNavMode, type StandardNavOptions, SupportAction, type ThemePreference, TopBarCountBadge, TopBarPanelArrow, TopBarPopover, TopBarTooltip, TopBarWidgetSlot, clearBetaBannerDismissal, envChipClasses, isNavItemActive, modeIdFromLabel, resolveOrgLogoUrl, shortEnvLabel, shortUserName, standardPolitogyNav, topBarIconButtonClass, useChromeMe, useChromeOrgs, useNavChromeFetcher, useThemePreference };
929
+ export { BETA_BANNER_DISMISS_KEY, CAMPAIGN_FEATURE_AVAILABILITY, CORE_APP_ORIGIN, CORE_BILLING_PATH, type CampaignFeatureAvailability, type ChromeMe, type ChromeNotificationAlert, type ChromeNotificationImport, type ChromeNotificationQuarantine, type ChromeNotificationReply, type ChromeNotificationsPayload, type ChromeOrgSummary, type CommunicationsFuelStatus, FormColumn, FuelAction, type FuelChannelStatus, NavAppShell, type NavAppShellProps, NavBetaBanner, type NavBetaBannerProps, type NavBrand, type NavBreadcrumb, type NavChromeFetcher, NavChromeProvider, NavDisplayAction, type NavDisplayMode, type NavFooter, type NavFooterLink, type NavIcon, type NavItem, type NavLinkComponent, type NavLinkProps, type NavLinkedAccount, type NavMode, type NavModeOption, type NavOrg, type NavOrgOption, type NavRoleBadge, NavSidebar, type NavSidebarProps, type NavTab, NavTabStrip, type NavTabStripProps, NavThemeControl, NavTopBar, type NavTopBarAction, type NavTopBarProps, type NavUser, type NavUserMenu, NotificationsAction, SPECS_ORIGIN, SpecOverlayAction, type StandardNavIconKey, type StandardNavMode, type StandardNavOptions, SupportAction, type ThemePreference, TopBarCountBadge, TopBarPanelArrow, TopBarPopover, TopBarTooltip, TopBarWidgetSlot, clearBetaBannerDismissal, envChipClasses, isNavItemActive, modeIdFromLabel, resolveOrgLogoUrl, shortEnvLabel, shortUserName, standardPolitogyNav, topBarIconButtonClass, useChromeMe, useChromeOrgs, useNavChromeDedupedFetch, useNavChromeFetcher, useThemePreference };
package/dist/native.js CHANGED
@@ -1,5 +1,5 @@
1
1
  "use client";
2
- export { BETA_BANNER_DISMISS_KEY, CAMPAIGN_FEATURE_AVAILABILITY, CORE_APP_ORIGIN, CORE_BILLING_PATH, FuelAction, NavAppShell, NavBetaBanner, NavChromeProvider, NavDisplayAction, NavSidebar, NavTabStrip, NavThemeControl, NavTopBar, NotificationsAction, SPECS_ORIGIN, SpecOverlayAction, SupportAction, TopBarCountBadge, TopBarPanelArrow, TopBarPopover, TopBarTooltip, TopBarWidgetSlot, clearBetaBannerDismissal, envChipClasses, isNavItemActive, modeIdFromLabel, resolveOrgLogoUrl, shortEnvLabel, shortUserName, standardPolitogyNav, topBarIconButtonClass, useChromeMe, useChromeOrgs, useNavChromeFetcher, useThemePreference } from './chunk-2DXTSTII.js';
2
+ export { BETA_BANNER_DISMISS_KEY, CAMPAIGN_FEATURE_AVAILABILITY, CORE_APP_ORIGIN, CORE_BILLING_PATH, FuelAction, NavAppShell, NavBetaBanner, NavChromeProvider, NavDisplayAction, NavSidebar, NavTabStrip, NavThemeControl, NavTopBar, NotificationsAction, SPECS_ORIGIN, SpecOverlayAction, SupportAction, TopBarCountBadge, TopBarPanelArrow, TopBarPopover, TopBarTooltip, TopBarWidgetSlot, clearBetaBannerDismissal, envChipClasses, isNavItemActive, modeIdFromLabel, resolveOrgLogoUrl, shortEnvLabel, shortUserName, standardPolitogyNav, topBarIconButtonClass, useChromeMe, useChromeOrgs, useNavChromeDedupedFetch, useNavChromeFetcher, useThemePreference } from './chunk-6KX3DWBC.js';
3
3
  export { FormColumn } from './chunk-MY6G3LMN.js';
4
4
  import './chunk-BHRVZPZ7.js';
5
5
  import './chunk-7YVJ7HQG.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@the-portland-company/shell",
3
- "version": "0.75.2",
3
+ "version": "0.76.1",
4
4
  "description": "Shared chrome (header, sidebar, footer, theme, auth) for politogy apps. Drop into any Vite SPA to inherit the politogy look and signed-in user.",
5
5
  "license": "UNLICENSED",
6
6
  "private": false,