@the-portland-company/shell 0.80.1 → 0.80.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.
@@ -510,6 +510,17 @@ declare function useChromeUserMenu({ userId, userName, email, }: {
510
510
  email: string | null;
511
511
  }): NavUserMenu;
512
512
  type ModeId = 'relationship' | 'campaign' | 'petition';
513
+ /**
514
+ * Where a mode button goes: the mode's landing page (Left-Navigation §11.1 —
515
+ * Relationship: the Relationship Dashboard; Campaign: Battleground; Petition:
516
+ * the Petition app), carrying `mode` and the active organization. On a
517
+ * staging host the Dashboard and Battleground targets move to their
518
+ * `-staging` twins so a mode switch stays in staging. Null for an unknown id.
519
+ */
520
+ declare function modeLandingHref(id: string, opts?: {
521
+ orgId?: string | null;
522
+ hostname?: string | null;
523
+ }): string | null;
513
524
  type UseChromeModeArg = ModeId | {
514
525
  /** Pre-entitlement fallback for first paint (default 'relationship'). */
515
526
  fallbackModeId?: ModeId;
@@ -539,4 +550,4 @@ type UseChromeModeArg = ModeId | {
539
550
  */
540
551
  declare function useChromeMode(arg?: UseChromeModeArg): NavMode;
541
552
 
542
- export { type BootPhase, type BootProgress, type BootStageId, type ChromeDevNotesConfig, type ChromeIdentity, ChromeTopBarActions, type ControlledOrgState, LoadingScreen, POLITOGY_APPS, PolitogyAppChrome, PolitogyAppFrame, type PolitogyAppKey, type PolitogyAppMode, type PolitogyAppSession, type PolitogyBuildMeta, type PolitogyFrameData, type PolitogyFrameGrant, type PolitogyGrantedFrame, type ResolvedIdentity, type TokenOrgState, deriveBreadcrumbs, looksLikeEmail, resolveIdentity, standardNavIcons, useChromeFooter, useChromeIdentity, useChromeMode, useChromeState, useChromeUserMenu, useIsSuperAdmin };
553
+ export { type BootPhase, type BootProgress, type BootStageId, type ChromeDevNotesConfig, type ChromeIdentity, ChromeTopBarActions, type ControlledOrgState, LoadingScreen, POLITOGY_APPS, PolitogyAppChrome, PolitogyAppFrame, type PolitogyAppKey, type PolitogyAppMode, type PolitogyAppSession, type PolitogyBuildMeta, type PolitogyFrameData, type PolitogyFrameGrant, type PolitogyGrantedFrame, type ResolvedIdentity, type TokenOrgState, deriveBreadcrumbs, looksLikeEmail, modeLandingHref, resolveIdentity, standardNavIcons, useChromeFooter, useChromeIdentity, useChromeMode, useChromeState, useChromeUserMenu, useIsSuperAdmin };
@@ -510,6 +510,17 @@ declare function useChromeUserMenu({ userId, userName, email, }: {
510
510
  email: string | null;
511
511
  }): NavUserMenu;
512
512
  type ModeId = 'relationship' | 'campaign' | 'petition';
513
+ /**
514
+ * Where a mode button goes: the mode's landing page (Left-Navigation §11.1 —
515
+ * Relationship: the Relationship Dashboard; Campaign: Battleground; Petition:
516
+ * the Petition app), carrying `mode` and the active organization. On a
517
+ * staging host the Dashboard and Battleground targets move to their
518
+ * `-staging` twins so a mode switch stays in staging. Null for an unknown id.
519
+ */
520
+ declare function modeLandingHref(id: string, opts?: {
521
+ orgId?: string | null;
522
+ hostname?: string | null;
523
+ }): string | null;
513
524
  type UseChromeModeArg = ModeId | {
514
525
  /** Pre-entitlement fallback for first paint (default 'relationship'). */
515
526
  fallbackModeId?: ModeId;
@@ -539,4 +550,4 @@ type UseChromeModeArg = ModeId | {
539
550
  */
540
551
  declare function useChromeMode(arg?: UseChromeModeArg): NavMode;
541
552
 
542
- export { type BootPhase, type BootProgress, type BootStageId, type ChromeDevNotesConfig, type ChromeIdentity, ChromeTopBarActions, type ControlledOrgState, LoadingScreen, POLITOGY_APPS, PolitogyAppChrome, PolitogyAppFrame, type PolitogyAppKey, type PolitogyAppMode, type PolitogyAppSession, type PolitogyBuildMeta, type PolitogyFrameData, type PolitogyFrameGrant, type PolitogyGrantedFrame, type ResolvedIdentity, type TokenOrgState, deriveBreadcrumbs, looksLikeEmail, resolveIdentity, standardNavIcons, useChromeFooter, useChromeIdentity, useChromeMode, useChromeState, useChromeUserMenu, useIsSuperAdmin };
553
+ export { type BootPhase, type BootProgress, type BootStageId, type ChromeDevNotesConfig, type ChromeIdentity, ChromeTopBarActions, type ControlledOrgState, LoadingScreen, POLITOGY_APPS, PolitogyAppChrome, PolitogyAppFrame, type PolitogyAppKey, type PolitogyAppMode, type PolitogyAppSession, type PolitogyBuildMeta, type PolitogyFrameData, type PolitogyFrameGrant, type PolitogyGrantedFrame, type ResolvedIdentity, type TokenOrgState, deriveBreadcrumbs, looksLikeEmail, modeLandingHref, resolveIdentity, standardNavIcons, useChromeFooter, useChromeIdentity, useChromeMode, useChromeState, useChromeUserMenu, useIsSuperAdmin };
@@ -542,7 +542,11 @@ var POLITOGY_APPS = {
542
542
  // Relationship Dashboard, the Relationship Mode landing page, and nothing
543
543
  // else (Specs/Relationship-Dashboard §1A "Relationship Mode only"); Settings
544
544
  // hosts org settings & billing (Specs/Organization-Settings).
545
- dashboard: { title: "Dashboard", origin: "https://dashboard.politogyvrm.com", storagePrefix: "dashboard" },
545
+ // PINNED to Relationship: left unscoped, its frame took the user's last
546
+ // mode selection, so after a visit to Campaign Mode the Dashboard drew the
547
+ // red Campaign rail and "Campaign mode" label over the Relationship rows
548
+ // (Left-Navigation §11.1 "the rail never shows a mix of two modes").
549
+ dashboard: { title: "Dashboard", origin: "https://dashboard.politogyvrm.com", storagePrefix: "dashboard", mode: "relationship" },
546
550
  // Battleground (the Campaign Mode landing page) and District Data are
547
551
  // Campaign Mode features, each its own app on its own host (Specs/Left-
548
552
  // Navigation §9.2, §13, §14; Reference/UI-Platform, decided 2026-10-12).
@@ -1434,14 +1438,19 @@ var MODE_DEFS = [
1434
1438
  id: "relationship",
1435
1439
  label: "Relationship Mode",
1436
1440
  icon: LuContactRound,
1437
- href: `${CORE_BASE_URL}/relationship/dashboard`,
1441
+ // The mode's landing page (Left-Navigation §11.1), with the mode stated in
1442
+ // the URL. These used to point at the retired VRM core
1443
+ // (`app.politogyvrm.com/relationship/dashboard`), whose redirect dropped
1444
+ // the mode: the Dashboard app then chose by the active-mode cookie, so
1445
+ // "Relationship" from a Campaign page landed back on Battleground.
1446
+ href: "https://dashboard.politogyvrm.com/dashboard?mode=relationship",
1438
1447
  orgQuery: true
1439
1448
  },
1440
1449
  {
1441
1450
  id: "campaign",
1442
1451
  label: "Campaign Mode",
1443
1452
  icon: LuMegaphone,
1444
- href: `${CORE_BASE_URL}/campaign/dashboard`,
1453
+ href: "https://battleground.politogyvrm.com/battleground?mode=campaign",
1445
1454
  orgQuery: true
1446
1455
  },
1447
1456
  {
@@ -1454,6 +1463,14 @@ var MODE_DEFS = [
1454
1463
  orgQuery: true
1455
1464
  }
1456
1465
  ];
1466
+ function modeLandingHref(id, opts = {}) {
1467
+ const def = MODE_DEFS.find((m) => m.id === id);
1468
+ if (!def) return null;
1469
+ const staging = (opts.hostname ?? "").toLowerCase().includes("staging");
1470
+ const href = staging ? def.href.replace(/^https:\/\/(dashboard|battleground)\.politogyvrm\.com/, "https://$1-staging.politogyvrm.com") : def.href;
1471
+ if (!opts.orgId) return href;
1472
+ return `${href}${href.includes("?") ? "&" : "?"}org=${opts.orgId}`;
1473
+ }
1457
1474
  function useChromeMode(arg = {}) {
1458
1475
  const { fallbackModeId = "relationship", pinnedModeId } = typeof arg === "string" ? { fallbackModeId: arg, pinnedModeId: void 0 } : arg;
1459
1476
  const ctx = useContext(ChromeStateContext);
@@ -1491,7 +1508,6 @@ function useChromeMode(arg = {}) {
1491
1508
  const pinned = pinnedModeId ? MODE_DEFS.find((m) => m.id === pinnedModeId) ?? null : null;
1492
1509
  const selected = selectedModeId ? options.find((m) => m.id === selectedModeId) ?? null : null;
1493
1510
  const current = pinned ?? selected ?? options[0] ?? MODE_DEFS.find((m) => m.id === fallbackModeId) ?? MODE_DEFS[0];
1494
- const suffix = orgId ? `?org=${orgId}` : "";
1495
1511
  return {
1496
1512
  label: current.label,
1497
1513
  icon: current.icon,
@@ -1513,15 +1529,16 @@ function useChromeMode(arg = {}) {
1513
1529
  localStorage.setItem(MODE_STORAGE_KEY, id);
1514
1530
  } catch {
1515
1531
  }
1516
- const href = def.href.replace(CORE_BASE_URL, getCoreBaseUrl());
1517
- const sep = href.includes("?") ? "&" : "?";
1518
1532
  window.location.assign(
1519
- def.orgQuery && suffix ? `${href}${sep}${suffix.slice(1)}` : href
1533
+ modeLandingHref(id, {
1534
+ orgId: def.orgQuery ? orgId : null,
1535
+ hostname: window.location.hostname
1536
+ }) ?? def.href
1520
1537
  );
1521
1538
  } : void 0
1522
1539
  };
1523
1540
  }
1524
1541
 
1525
- export { ChromeTopBarActions, LoadingScreen, POLITOGY_APPS, PolitogyAppChrome, PolitogyAppFrame, deriveBreadcrumbs, looksLikeEmail, resolveIdentity, useChromeFooter, useChromeIdentity, useChromeMode, useChromeState, useChromeUserMenu, useIsSuperAdmin };
1542
+ export { ChromeTopBarActions, LoadingScreen, POLITOGY_APPS, PolitogyAppChrome, PolitogyAppFrame, deriveBreadcrumbs, looksLikeEmail, modeLandingHref, resolveIdentity, useChromeFooter, useChromeIdentity, useChromeMode, useChromeState, useChromeUserMenu, useIsSuperAdmin };
1526
1543
  //# sourceMappingURL=app-chrome.js.map
1527
1544
  //# sourceMappingURL=app-chrome.js.map