@the-portland-company/shell 0.35.2 → 0.35.4

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.
@@ -1288,10 +1288,10 @@ function useThemePreference() {
1288
1288
 
1289
1289
  // src/native/standardNav.ts
1290
1290
  var CAMPAIGN_FEATURE_AVAILABILITY = {
1291
- a2p: false,
1292
- phonebank: false,
1293
- canvass: false,
1294
- signs: false,
1291
+ a2p: true,
1292
+ phonebank: true,
1293
+ canvass: true,
1294
+ signs: true,
1295
1295
  tribes: true,
1296
1296
  polling: true
1297
1297
  };
@@ -1360,6 +1360,32 @@ var APP_POLLS_CHILDREN = [
1360
1360
  { label: "Command Center", icon: "grid", href: "https://polls.politogyvrm.com/" },
1361
1361
  { label: "New Poll", icon: "edit", href: "https://polls.politogyvrm.com/polls/new" }
1362
1362
  ];
1363
+ var APP_A2P_CHILDREN = [
1364
+ { label: "Dashboard", icon: "grid", path: "dashboard" },
1365
+ { label: "Compose", icon: "edit", path: "compose" },
1366
+ { label: "Recipients", icon: "user", path: "recipients" },
1367
+ { label: "Tech Check", icon: "activity", path: "tech-check" },
1368
+ { label: "Status", icon: "clock", path: "status" },
1369
+ { label: "Conversations", icon: "messageSquare", path: "conversations" }
1370
+ ];
1371
+ var APP_PHONEBANK_CHILDREN = [
1372
+ { label: "Dashboard", icon: "grid", path: "" },
1373
+ { label: "Campaigns", icon: "phone", path: "campaigns" },
1374
+ { label: "Inbound", icon: "messageSquare", path: "inbound" },
1375
+ { label: "Reports", icon: "barChart", path: "reports" }
1376
+ ];
1377
+ var APP_CANVASS_CHILDREN = [
1378
+ { label: "Dashboard", icon: "grid", path: "" },
1379
+ { label: "Campaigns", icon: "target", path: "campaigns" },
1380
+ { label: "Canvassers", icon: "users", path: "canvassers" }
1381
+ ];
1382
+ var APP_SIGNS_CHILDREN = [
1383
+ { label: "Map", icon: "map", path: "" },
1384
+ { label: "Placements", icon: "list", path: "placements" },
1385
+ { label: "Review Queue", icon: "fileText", path: "review" },
1386
+ { label: "Recovery", icon: "flag", path: "recovery" },
1387
+ { label: "Reports", icon: "barChart", path: "reports" }
1388
+ ];
1363
1389
  function standardPolitogyNav(opts) {
1364
1390
  const base = opts.coreBaseUrl.replace(/\/+$/, "");
1365
1391
  const abs = (path) => `${base}${path.startsWith("/") ? path : `/${path}`}`;
@@ -1433,13 +1459,45 @@ function standardPolitogyNav(opts) {
1433
1459
  ...CAMPAIGN_FEATURE_AVAILABILITY,
1434
1460
  ...opts.campaignAvailability
1435
1461
  };
1462
+ const appLeaves = (origin, children) => {
1463
+ const base2 = origin.replace(/\/+$/, "");
1464
+ return children.map((c) => ({
1465
+ label: c.label,
1466
+ icon: icon(c.icon),
1467
+ href: withOrg(c.path ? `${base2}/${c.path}` : `${base2}/`)
1468
+ }));
1469
+ };
1436
1470
  const rows = [
1437
1471
  { label: "Dashboard", icon: icon("home"), href: withOrg(abs("/campaign/dashboard")) },
1438
1472
  { label: "Voter Contact", icon: icon("target"), href: withOrg(abs("/campaign/campaigns")) },
1439
- { label: "A2P", icon: icon("messageSquare"), href: withOrg(A2P_ORIGIN), flag: "a2p" },
1440
- { label: "Phone Banking", icon: icon("phone"), href: withOrg(PHONEBANK_ORIGIN), flag: "phonebank" },
1441
- { label: "Field Canvassing", icon: icon("map"), href: withOrg(CANVASS_ORIGIN), flag: "canvass" },
1442
- { label: "Sign Mapping", icon: icon("mapPin"), href: withOrg(SIGNS_ORIGIN), flag: "signs" },
1473
+ {
1474
+ label: "A2P",
1475
+ icon: icon("messageSquare"),
1476
+ href: withOrg(A2P_ORIGIN),
1477
+ children: appLeaves(A2P_ORIGIN, APP_A2P_CHILDREN),
1478
+ flag: "a2p"
1479
+ },
1480
+ {
1481
+ label: "Phone Banking",
1482
+ icon: icon("phone"),
1483
+ href: withOrg(PHONEBANK_ORIGIN),
1484
+ children: appLeaves(PHONEBANK_ORIGIN, APP_PHONEBANK_CHILDREN),
1485
+ flag: "phonebank"
1486
+ },
1487
+ {
1488
+ label: "Field Canvassing",
1489
+ icon: icon("map"),
1490
+ href: withOrg(CANVASS_ORIGIN),
1491
+ children: appLeaves(CANVASS_ORIGIN, APP_CANVASS_CHILDREN),
1492
+ flag: "canvass"
1493
+ },
1494
+ {
1495
+ label: "Sign Mapping",
1496
+ icon: icon("mapPin"),
1497
+ href: withOrg(SIGNS_ORIGIN),
1498
+ children: appLeaves(SIGNS_ORIGIN, APP_SIGNS_CHILDREN),
1499
+ flag: "signs"
1500
+ },
1443
1501
  { label: "Tribes", icon: icon("users"), href: withOrg(CONTACTS_TRIBES), flag: "tribes" },
1444
1502
  { label: "Polling Engine", icon: icon("barChart"), href: withOrg(POLLS_ORIGIN), flag: "polling" }
1445
1503
  ];
@@ -1462,6 +1520,7 @@ function standardPolitogyNav(opts) {
1462
1520
  }
1463
1521
  var safeHref = (h) => h && /^(https?:|mailto:|tel:|\/|#|\.)/i.test(h.trim()) ? h : "#";
1464
1522
  var DefaultLink = ({ href, children, ...rest }) => /* @__PURE__ */ jsxRuntime.jsx("a", { href: safeHref(href), ...rest, children });
1523
+ var ACTIVE_IGNORED_PARAMS = /* @__PURE__ */ new Set(["org"]);
1465
1524
  function isNavItemActive(pathname, href) {
1466
1525
  let targetPath = href;
1467
1526
  let targetSearch = "";
@@ -1482,10 +1541,11 @@ function isNavItemActive(pathname, href) {
1482
1541
  targetSearch = href.slice(qi);
1483
1542
  }
1484
1543
  }
1485
- if (targetSearch) {
1544
+ const want = new URLSearchParams(targetSearch);
1545
+ for (const k of ACTIVE_IGNORED_PARAMS) want.delete(k);
1546
+ if (Array.from(want).length > 0) {
1486
1547
  if (typeof window === "undefined") return false;
1487
1548
  if (pathname !== targetPath) return false;
1488
- const want = new URLSearchParams(targetSearch);
1489
1549
  const have = new URLSearchParams(window.location.search);
1490
1550
  for (const [k, v] of want) if (have.get(k) !== v) return false;
1491
1551
  return true;