@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.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,12 @@
1
+ ## 0.80.2
2
+
3
+ The mode switcher goes to each mode's landing page. Spec cited: Specs/Left-Navigation §7 and §11.1.
4
+
5
+ - **Cause.** The Relationship and Campaign buttons still pointed at the retired VRM core (`app.politogyvrm.com/relationship/dashboard`, `/campaign/dashboard`). Its redirect lands on the Dashboard app without a mode, and that app then chooses by the `politogy_active_mode` cookie. From a Campaign page the cookie says campaign, so clicking Relationship landed back on Battleground (measured 2026-10-12 on an organization that holds Campaign Mode).
6
+ - **Fix.** Relationship goes to `https://dashboard.politogyvrm.com/dashboard?mode=relationship`; Campaign goes to `https://battleground.politogyvrm.com/battleground?mode=campaign`. Both carry the active organization, and move to their `-staging` twins from a staging host. New export `modeLandingHref`.
7
+ - **The `dashboard` registry row is pinned to `mode: 'relationship'`.** It was unscoped, so its frame followed the user's last mode selection: after a visit to Campaign Mode the Relationship Dashboard drew the red Campaign rail and the "Campaign mode" label over the Relationship rows (reported by Ben, reproduced 2026-10-12; Left-Navigation §11.1). Pinned, the Dashboard always draws the Relationship frame and writes `relationship` to the active-mode cookie, like `email`.
8
+ - Tests: `__tests__/modeLandingHref.test.ts`.
9
+
1
10
  ## 0.80.1
2
11
 
3
12
  The Dashboard row shows its active marker on the Dashboard. Spec cited: Specs/Left-Navigation §8.1 and §11.3 ("Exactly one row is active").
@@ -4552,7 +4552,11 @@ var POLITOGY_APPS = {
4552
4552
  // Relationship Dashboard, the Relationship Mode landing page, and nothing
4553
4553
  // else (Specs/Relationship-Dashboard §1A "Relationship Mode only"); Settings
4554
4554
  // hosts org settings & billing (Specs/Organization-Settings).
4555
- dashboard: { title: "Dashboard", origin: "https://dashboard.politogyvrm.com", storagePrefix: "dashboard" },
4555
+ // PINNED to Relationship: left unscoped, its frame took the user's last
4556
+ // mode selection, so after a visit to Campaign Mode the Dashboard drew the
4557
+ // red Campaign rail and "Campaign mode" label over the Relationship rows
4558
+ // (Left-Navigation §11.1 "the rail never shows a mix of two modes").
4559
+ dashboard: { title: "Dashboard", origin: "https://dashboard.politogyvrm.com", storagePrefix: "dashboard", mode: "relationship" },
4556
4560
  // Battleground (the Campaign Mode landing page) and District Data are
4557
4561
  // Campaign Mode features, each its own app on its own host (Specs/Left-
4558
4562
  // Navigation §9.2, §13, §14; Reference/UI-Platform, decided 2026-10-12).
@@ -5444,14 +5448,19 @@ var MODE_DEFS = [
5444
5448
  id: "relationship",
5445
5449
  label: "Relationship Mode",
5446
5450
  icon: lu.LuContactRound,
5447
- href: `${CORE_BASE_URL}/relationship/dashboard`,
5451
+ // The mode's landing page (Left-Navigation §11.1), with the mode stated in
5452
+ // the URL. These used to point at the retired VRM core
5453
+ // (`app.politogyvrm.com/relationship/dashboard`), whose redirect dropped
5454
+ // the mode: the Dashboard app then chose by the active-mode cookie, so
5455
+ // "Relationship" from a Campaign page landed back on Battleground.
5456
+ href: "https://dashboard.politogyvrm.com/dashboard?mode=relationship",
5448
5457
  orgQuery: true
5449
5458
  },
5450
5459
  {
5451
5460
  id: "campaign",
5452
5461
  label: "Campaign Mode",
5453
5462
  icon: lu.LuMegaphone,
5454
- href: `${CORE_BASE_URL}/campaign/dashboard`,
5463
+ href: "https://battleground.politogyvrm.com/battleground?mode=campaign",
5455
5464
  orgQuery: true
5456
5465
  },
5457
5466
  {
@@ -5464,6 +5473,14 @@ var MODE_DEFS = [
5464
5473
  orgQuery: true
5465
5474
  }
5466
5475
  ];
5476
+ function modeLandingHref(id, opts = {}) {
5477
+ const def = MODE_DEFS.find((m) => m.id === id);
5478
+ if (!def) return null;
5479
+ const staging = (opts.hostname ?? "").toLowerCase().includes("staging");
5480
+ const href = staging ? def.href.replace(/^https:\/\/(dashboard|battleground)\.politogyvrm\.com/, "https://$1-staging.politogyvrm.com") : def.href;
5481
+ if (!opts.orgId) return href;
5482
+ return `${href}${href.includes("?") ? "&" : "?"}org=${opts.orgId}`;
5483
+ }
5467
5484
  function useChromeMode(arg = {}) {
5468
5485
  const { fallbackModeId = "relationship", pinnedModeId } = typeof arg === "string" ? { fallbackModeId: arg, pinnedModeId: void 0 } : arg;
5469
5486
  const ctx = react.useContext(ChromeStateContext);
@@ -5501,7 +5518,6 @@ function useChromeMode(arg = {}) {
5501
5518
  const pinned = pinnedModeId ? MODE_DEFS.find((m) => m.id === pinnedModeId) ?? null : null;
5502
5519
  const selected = selectedModeId ? options.find((m) => m.id === selectedModeId) ?? null : null;
5503
5520
  const current = pinned ?? selected ?? options[0] ?? MODE_DEFS.find((m) => m.id === fallbackModeId) ?? MODE_DEFS[0];
5504
- const suffix = orgId ? `?org=${orgId}` : "";
5505
5521
  return {
5506
5522
  label: current.label,
5507
5523
  icon: current.icon,
@@ -5523,10 +5539,11 @@ function useChromeMode(arg = {}) {
5523
5539
  localStorage.setItem(MODE_STORAGE_KEY, id);
5524
5540
  } catch {
5525
5541
  }
5526
- const href = def.href.replace(CORE_BASE_URL, getCoreBaseUrl());
5527
- const sep = href.includes("?") ? "&" : "?";
5528
5542
  window.location.assign(
5529
- def.orgQuery && suffix ? `${href}${sep}${suffix.slice(1)}` : href
5543
+ modeLandingHref(id, {
5544
+ orgId: def.orgQuery ? orgId : null,
5545
+ hostname: window.location.hostname
5546
+ }) ?? def.href
5530
5547
  );
5531
5548
  } : void 0
5532
5549
  };
@@ -5539,6 +5556,7 @@ exports.PolitogyAppChrome = PolitogyAppChrome;
5539
5556
  exports.PolitogyAppFrame = PolitogyAppFrame;
5540
5557
  exports.deriveBreadcrumbs = deriveBreadcrumbs;
5541
5558
  exports.looksLikeEmail = looksLikeEmail;
5559
+ exports.modeLandingHref = modeLandingHref;
5542
5560
  exports.resolveIdentity = resolveIdentity;
5543
5561
  exports.standardNavIcons = standardNavIcons;
5544
5562
  exports.useChromeFooter = useChromeFooter;