@the-portland-company/shell 0.102.0 → 0.102.2

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.
@@ -1,6 +1,6 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import { ReactNode } from 'react';
3
- import { S as StandardNavIconKey, z as NavIcon, N as NavItem, D as NavBreadcrumb, E as StandardNavMode, G as NavLinkComponent, I as NavChromeFetcher, J as NavMode, L as NavUserMenu, M as NavOrgOption, i as NotificationsAdapter, O as NavFooterLink, Q as NavFooter, U as NavDisplayMode } from './index-BOxLJAUi.cjs';
3
+ import { S as StandardNavIconKey, z as NavIcon, N as NavItem, D as NavBreadcrumb, E as StandardNavMode, G as NavLinkComponent, I as NavChromeFetcher, J as NavMode, L as NavUserMenu, M as NavOrgOption, i as NotificationsAdapter, O as ChromeOrgSummary, Q as NavFooterLink, U as NavFooter, W as NavDisplayMode } from './index-DTFEH6Tk.cjs';
4
4
  import './theme-preference.cjs';
5
5
  import './brand-favicon.cjs';
6
6
 
@@ -482,6 +482,15 @@ type TokenOrgState = {
482
482
  /** Called when the IdP refuses a switch (403 not a member, 401 no session). */
483
483
  onSwitchError?: (err: unknown) => void;
484
484
  };
485
+ /**
486
+ * Fill each app-supplied switcher row's missing branding (Brand Kit icon,
487
+ * Primary logo, brand color) from the chrome `/api/orgs` list, matched by org
488
+ * id. The app's own non-empty values win, and rows are never added, removed
489
+ * or reordered: the app's list stays the source of membership. Without a
490
+ * chrome list (still loading, or the read failed) the app's rows are returned
491
+ * as they are.
492
+ */
493
+ declare function fillOrgBranding<T extends NavOrgOption>(rows: T[], chrome: ChromeOrgSummary[] | null | undefined): T[];
485
494
  type ChromeDevNotesConfig = {
486
495
  /** Override the DevNotes API base (default: `${proxyBasePath}/devnotes`). */
487
496
  basePath?: string;
@@ -620,4 +629,4 @@ type UseChromeModeArg = ModeId | {
620
629
  */
621
630
  declare function useChromeMode(arg?: UseChromeModeArg): NavMode;
622
631
 
623
- export { type BootPhase, type BootProgress, type BootStageId, type ChromeDevNotesConfig, type ChromeIdentity, ChromeTopBarActions, type ControlledOrgState, LoadingScreen, MODE_SEARCH_PLACEHOLDER, POLITOGY_APPS, PolitogyAppChrome, PolitogyAppFrame, type PolitogyAppKey, type PolitogyAppMode, type PolitogyAppSession, type PolitogyBuildMeta, type PolitogyFrameData, type PolitogyFrameGrant, type PolitogyGrantedFrame, type ResolvedIdentity, type TokenOrgState, deriveBreadcrumbs, footerLinks, looksLikeEmail, modeLandingHref, orgSwitchLanding, relationshipSearchHref, resolveIdentity, standardNavIcons, useChromeFooter, useChromeIdentity, useChromeMode, useChromeState, useChromeUserMenu, useIsSuperAdmin };
632
+ export { type BootPhase, type BootProgress, type BootStageId, type ChromeDevNotesConfig, type ChromeIdentity, ChromeTopBarActions, type ControlledOrgState, LoadingScreen, MODE_SEARCH_PLACEHOLDER, POLITOGY_APPS, PolitogyAppChrome, PolitogyAppFrame, type PolitogyAppKey, type PolitogyAppMode, type PolitogyAppSession, type PolitogyBuildMeta, type PolitogyFrameData, type PolitogyFrameGrant, type PolitogyGrantedFrame, type ResolvedIdentity, type TokenOrgState, deriveBreadcrumbs, fillOrgBranding, footerLinks, looksLikeEmail, modeLandingHref, orgSwitchLanding, relationshipSearchHref, resolveIdentity, standardNavIcons, useChromeFooter, useChromeIdentity, useChromeMode, useChromeState, useChromeUserMenu, useIsSuperAdmin };
@@ -1,6 +1,6 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import { ReactNode } from 'react';
3
- import { S as StandardNavIconKey, z as NavIcon, N as NavItem, D as NavBreadcrumb, E as StandardNavMode, G as NavLinkComponent, I as NavChromeFetcher, J as NavMode, L as NavUserMenu, M as NavOrgOption, i as NotificationsAdapter, O as NavFooterLink, Q as NavFooter, U as NavDisplayMode } from './index-C8yIX2wg.js';
3
+ import { S as StandardNavIconKey, z as NavIcon, N as NavItem, D as NavBreadcrumb, E as StandardNavMode, G as NavLinkComponent, I as NavChromeFetcher, J as NavMode, L as NavUserMenu, M as NavOrgOption, i as NotificationsAdapter, O as ChromeOrgSummary, Q as NavFooterLink, U as NavFooter, W as NavDisplayMode } from './index-BTYiaHqq.js';
4
4
  import './theme-preference.js';
5
5
  import './brand-favicon.js';
6
6
 
@@ -482,6 +482,15 @@ type TokenOrgState = {
482
482
  /** Called when the IdP refuses a switch (403 not a member, 401 no session). */
483
483
  onSwitchError?: (err: unknown) => void;
484
484
  };
485
+ /**
486
+ * Fill each app-supplied switcher row's missing branding (Brand Kit icon,
487
+ * Primary logo, brand color) from the chrome `/api/orgs` list, matched by org
488
+ * id. The app's own non-empty values win, and rows are never added, removed
489
+ * or reordered: the app's list stays the source of membership. Without a
490
+ * chrome list (still loading, or the read failed) the app's rows are returned
491
+ * as they are.
492
+ */
493
+ declare function fillOrgBranding<T extends NavOrgOption>(rows: T[], chrome: ChromeOrgSummary[] | null | undefined): T[];
485
494
  type ChromeDevNotesConfig = {
486
495
  /** Override the DevNotes API base (default: `${proxyBasePath}/devnotes`). */
487
496
  basePath?: string;
@@ -620,4 +629,4 @@ type UseChromeModeArg = ModeId | {
620
629
  */
621
630
  declare function useChromeMode(arg?: UseChromeModeArg): NavMode;
622
631
 
623
- export { type BootPhase, type BootProgress, type BootStageId, type ChromeDevNotesConfig, type ChromeIdentity, ChromeTopBarActions, type ControlledOrgState, LoadingScreen, MODE_SEARCH_PLACEHOLDER, POLITOGY_APPS, PolitogyAppChrome, PolitogyAppFrame, type PolitogyAppKey, type PolitogyAppMode, type PolitogyAppSession, type PolitogyBuildMeta, type PolitogyFrameData, type PolitogyFrameGrant, type PolitogyGrantedFrame, type ResolvedIdentity, type TokenOrgState, deriveBreadcrumbs, footerLinks, looksLikeEmail, modeLandingHref, orgSwitchLanding, relationshipSearchHref, resolveIdentity, standardNavIcons, useChromeFooter, useChromeIdentity, useChromeMode, useChromeState, useChromeUserMenu, useIsSuperAdmin };
632
+ export { type BootPhase, type BootProgress, type BootStageId, type ChromeDevNotesConfig, type ChromeIdentity, ChromeTopBarActions, type ControlledOrgState, LoadingScreen, MODE_SEARCH_PLACEHOLDER, POLITOGY_APPS, PolitogyAppChrome, PolitogyAppFrame, type PolitogyAppKey, type PolitogyAppMode, type PolitogyAppSession, type PolitogyBuildMeta, type PolitogyFrameData, type PolitogyFrameGrant, type PolitogyGrantedFrame, type ResolvedIdentity, type TokenOrgState, deriveBreadcrumbs, fillOrgBranding, footerLinks, looksLikeEmail, modeLandingHref, orgSwitchLanding, relationshipSearchHref, resolveIdentity, standardNavIcons, useChromeFooter, useChromeIdentity, useChromeMode, useChromeState, useChromeUserMenu, useIsSuperAdmin };
@@ -1,10 +1,10 @@
1
1
  "use client";
2
2
  import { broadcastLogout, watchLogout } from './chunk-LL6LSJAH.js';
3
3
  import { writeUrlState } from './chunk-GVQKZI5X.js';
4
- import { clearBetaBannerDismissal, standardPolitogyNav, standardNavIcons, isNavItemActive, NavAppShell } from './chunk-NL56CK4X.js';
5
- export { standardNavIcons } from './chunk-NL56CK4X.js';
4
+ import { clearBetaBannerDismissal, standardPolitogyNav, standardNavIcons, isNavItemActive, NavAppShell } from './chunk-PR5QBA7S.js';
5
+ export { standardNavIcons } from './chunk-PR5QBA7S.js';
6
6
  import { orgIdTail, ORG_ID_QUERY_PARAM, settingsBaseUrl, authBaseUrl, readOrgSelectorFromUrl, matchOrgSelector, syncOrgIdInUrl, isOrgId, switchActiveOrg, ACTIVE_ORG_QUERY_PARAM, writeActiveOrgCookie, resolveActiveOrg, readActiveOrgCookie } from './chunk-5LO5W7W5.js';
7
- import { warnDeprecated, NavChromeProvider, FuelAction, NotificationsAction, OrganizationSettingsAction, MyProfileAction, useChromeMe, useNavChromeDedupedFetch, useChromeOrgs, useNavChromeFetcher } from './chunk-XF6OL7DT.js';
7
+ import { warnDeprecated, NavChromeProvider, FuelAction, NotificationsAction, OrganizationSettingsAction, MyProfileAction, useChromeMe, useNavChromeDedupedFetch, useChromeOrgs, useNavChromeFetcher } from './chunk-HR2TBHHH.js';
8
8
  import './chunk-BHRVZPZ7.js';
9
9
  import { NAV_DISPLAY_DEFAULT, resolveNavDisplay, writeNavDisplayLocal, writeNavDisplayCookie, isNavDisplayPreference, NAV_DISPLAY_STORAGE_KEY, readNavDisplayCookie } from './chunk-7YVJ7HQG.js';
10
10
  import { useBrandAssets, BrandFavicon } from './chunk-Q5DTPY5N.js';
@@ -949,12 +949,27 @@ var ChromeStateContext = createContext(null);
949
949
  function useChromeState() {
950
950
  return useContext(ChromeStateContext);
951
951
  }
952
+ function fillOrgBranding(rows, chrome) {
953
+ if (!chrome?.length) return rows;
954
+ const byId = new Map(chrome.map((o) => [o.id, o]));
955
+ return rows.map((row) => {
956
+ const c = byId.get(row.id);
957
+ if (!c) return row;
958
+ return {
959
+ ...row,
960
+ iconUrl: row.iconUrl || c.iconUrl || null,
961
+ logoUrl: row.logoUrl || c.logoUrl || null,
962
+ brandColor: row.brandColor || c.brandColor || null
963
+ };
964
+ });
965
+ }
952
966
  function TokenChromeStateProvider({
953
967
  tokenOrg,
954
968
  children
955
969
  }) {
970
+ const needsBranding = !!tokenOrg.orgs?.some((o) => o.iconUrl === void 0);
956
971
  const { orgs: fetchedOrgs, loading: orgsFetching, error: orgsError } = useChromeOrgs({
957
- enabled: !tokenOrg.orgs
972
+ enabled: !tokenOrg.orgs || needsBranding
958
973
  });
959
974
  const [navDisplay, setNavDisplayState] = useState(NAV_DISPLAY_DEFAULT);
960
975
  const [pendingOrg, setPendingOrg] = useState(null);
@@ -965,7 +980,7 @@ function TokenChromeStateProvider({
965
980
  setNavDisplayState(resolveNavDisplay());
966
981
  }, []);
967
982
  const orgs = useMemo(
968
- () => tokenOrg.orgs ?? (fetchedOrgs ?? []).map((o) => ({
983
+ () => (tokenOrg.orgs ? fillOrgBranding(tokenOrg.orgs, fetchedOrgs) : null) ?? (fetchedOrgs ?? []).map((o) => ({
969
984
  id: o.id,
970
985
  name: o.name,
971
986
  logoUrl: o.logoUrl,
@@ -1634,6 +1649,6 @@ function useChromeMode(arg = {}) {
1634
1649
  };
1635
1650
  }
1636
1651
 
1637
- export { ChromeTopBarActions, LoadingScreen, MODE_SEARCH_PLACEHOLDER, POLITOGY_APPS, PolitogyAppChrome, PolitogyAppFrame, deriveBreadcrumbs, footerLinks, looksLikeEmail, modeLandingHref, orgSwitchLanding, relationshipSearchHref, resolveIdentity, useChromeFooter, useChromeIdentity, useChromeMode, useChromeState, useChromeUserMenu, useIsSuperAdmin };
1652
+ export { ChromeTopBarActions, LoadingScreen, MODE_SEARCH_PLACEHOLDER, POLITOGY_APPS, PolitogyAppChrome, PolitogyAppFrame, deriveBreadcrumbs, fillOrgBranding, footerLinks, looksLikeEmail, modeLandingHref, orgSwitchLanding, relationshipSearchHref, resolveIdentity, useChromeFooter, useChromeIdentity, useChromeMode, useChromeState, useChromeUserMenu, useIsSuperAdmin };
1638
1653
  //# sourceMappingURL=app-chrome.js.map
1639
1654
  //# sourceMappingURL=app-chrome.js.map