@the-portland-company/shell 0.76.0 → 0.76.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,7 +1,7 @@
1
1
  "use client";
2
2
  import { broadcastLogout, watchLogout } from './chunk-LL6LSJAH.js';
3
- import { clearBetaBannerDismissal, standardPolitogyNav, standardNavIcons, isNavItemActive, NavAppShell, NavChromeProvider, TopBarWidgetSlot, FuelAction, SpecOverlayAction, NotificationsAction, SupportAction, useChromeMe, useThemePreference, useNavChromeFetcher, useChromeOrgs } from './chunk-WHF6YW27.js';
4
- export { standardNavIcons } from './chunk-WHF6YW27.js';
3
+ import { clearBetaBannerDismissal, standardPolitogyNav, standardNavIcons, isNavItemActive, NavAppShell, NavChromeProvider, TopBarWidgetSlot, FuelAction, SpecOverlayAction, NotificationsAction, SupportAction, useChromeMe, useThemePreference, useNavChromeDedupedFetch, useChromeOrgs, useNavChromeFetcher } from './chunk-6KX3DWBC.js';
4
+ export { standardNavIcons } from './chunk-6KX3DWBC.js';
5
5
  import { warnDeprecated } from './chunk-MY6G3LMN.js';
6
6
  import './chunk-BHRVZPZ7.js';
7
7
  import { NAV_DISPLAY_DEFAULT, resolveNavDisplay, writeNavDisplayLocal, writeNavDisplayCookie, isNavDisplayPreference, NAV_DISPLAY_STORAGE_KEY, readNavDisplayCookie } from './chunk-7YVJ7HQG.js';
@@ -1324,6 +1324,7 @@ function PolitogyAppChrome({
1324
1324
  function ChromeTopBarActions() {
1325
1325
  const state = useChromeState();
1326
1326
  if (!state) return null;
1327
+ const settledOrgId = state.orgsLoading ? null : state.orgId;
1327
1328
  return /* @__PURE__ */ jsxs(Fragment, { children: [
1328
1329
  /* @__PURE__ */ jsx(
1329
1330
  TopBarWidgetSlot,
@@ -1333,9 +1334,9 @@ function ChromeTopBarActions() {
1333
1334
  children: /* @__PURE__ */ jsx(ChromeDevNotesMenu, {})
1334
1335
  }
1335
1336
  ),
1336
- /* @__PURE__ */ jsx(FuelAction, { orgId: state.orgId }),
1337
+ /* @__PURE__ */ jsx(FuelAction, { orgId: settledOrgId }),
1337
1338
  /* @__PURE__ */ jsx(SpecOverlayAction, { orgId: state.orgId, orgName: state.orgs.find((o) => o.id === state.orgId)?.name ?? null }),
1338
- /* @__PURE__ */ jsx(NotificationsAction, { orgId: state.orgId }),
1339
+ /* @__PURE__ */ jsx(NotificationsAction, { orgId: settledOrgId }),
1339
1340
  /* @__PURE__ */ jsx(SupportAction, { orgId: state.orgId, orgs: state.orgs.length ? state.orgs : void 0 })
1340
1341
  ] });
1341
1342
  }
@@ -1422,7 +1423,8 @@ var MODE_DEFS = [
1422
1423
  function useChromeMode(arg = {}) {
1423
1424
  const { fallbackModeId = "relationship", pinnedModeId } = typeof arg === "string" ? { fallbackModeId: arg, pinnedModeId: void 0 } : arg;
1424
1425
  const ctx = useContext(ChromeStateContext);
1425
- const nav = useNavChromeFetcher();
1426
+ const dedupedFetch = useNavChromeDedupedFetch();
1427
+ const { me, loaded: meLoaded } = useChromeMe();
1426
1428
  const orgId = ctx?.orgId ?? null;
1427
1429
  const [entitled, setEntitled] = useState(null);
1428
1430
  const [selectedModeId, setSelectedModeId] = useState(null);
@@ -1434,9 +1436,14 @@ function useChromeMode(arg = {}) {
1434
1436
  }
1435
1437
  }, []);
1436
1438
  useEffect(() => {
1437
- if (!nav || !orgId) return;
1439
+ if (!dedupedFetch || !orgId || !meLoaded) return;
1440
+ const bootMe = me;
1441
+ if (bootMe && bootMe.account === orgId && bootMe.modes !== void 0) {
1442
+ setEntitled(bootMe.modes ?? null);
1443
+ return;
1444
+ }
1438
1445
  let cancelled = false;
1439
- nav("me", { headers: { "x-contacts-org": orgId } }).then((data) => {
1446
+ dedupedFetch("me", { headers: { "x-contacts-org": orgId } }, { orgId }).then((data) => {
1440
1447
  if (cancelled) return;
1441
1448
  const modes = data?.modes ?? null;
1442
1449
  setEntitled(modes);
@@ -1445,7 +1452,7 @@ function useChromeMode(arg = {}) {
1445
1452
  return () => {
1446
1453
  cancelled = true;
1447
1454
  };
1448
- }, [nav, orgId]);
1455
+ }, [dedupedFetch, me, meLoaded, orgId]);
1449
1456
  const options = MODE_DEFS.filter((m) => entitled?.[m.id]);
1450
1457
  const pinned = pinnedModeId ? MODE_DEFS.find((m) => m.id === pinnedModeId) ?? null : null;
1451
1458
  const selected = selectedModeId ? options.find((m) => m.id === selectedModeId) ?? null : null;