@the-portland-company/shell 0.103.0 → 0.104.0

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.
@@ -257,9 +257,17 @@ var APP_POLLS_CHILDREN = [
257
257
  { label: "Command Center", icon: "grid", href: "https://polls.politogyvrm.com/" },
258
258
  { label: "New Poll", icon: "edit", href: "https://polls.politogyvrm.com/polls/new" }
259
259
  ];
260
+ var CTAS_ORIGIN = "https://ctas.politogyvrm.com";
261
+ var ctaRecordTabs = (...tabs) => tabs.map((t) => `${CTAS_ORIGIN}/cta?tab=${t}`);
260
262
  var APP_CTAS_CHILDREN = [
261
- { label: "CTAs", icon: "list", href: "https://ctas.politogyvrm.com/" },
262
- { label: "Canvas", icon: "edit", href: "https://ctas.politogyvrm.com/?tab=canvas" }
263
+ {
264
+ label: "Calls to action",
265
+ icon: "list",
266
+ href: `${CTAS_ORIGIN}/?tab=ctas`,
267
+ activeOn: ctaRecordTabs("builder", "placement", "audience", "experiments")
268
+ },
269
+ { label: "Performance", icon: "barChart", href: `${CTAS_ORIGIN}/?tab=analytics`, activeOn: ctaRecordTabs("performance") },
270
+ { label: "Settings", icon: "settings", href: `${CTAS_ORIGIN}/?tab=site-keys`, activeOn: ctaRecordTabs("settings") }
263
271
  ];
264
272
  var APP_A2P_CHILDREN = [
265
273
  { label: "Dashboard", icon: "grid", path: "dashboard" },
@@ -375,7 +383,10 @@ function standardPolitogyNav(opts) {
375
383
  label: "Calls to action",
376
384
  icon: icon("mousePointerClick"),
377
385
  href: withOrg("https://ctas.politogyvrm.com/"),
378
- children: APP_CTAS_CHILDREN.map((c) => ({ label: c.label, icon: icon(c.icon), href: withOrg(c.href) }))
386
+ // Every page on the CTAs host belongs to this row (§11.3), including
387
+ // an open CTA at /cta/<id>.
388
+ activeOn: [`${CTAS_ORIGIN}/`],
389
+ children: APP_CTAS_CHILDREN.map((c) => ({ label: c.label, icon: icon(c.icon), href: withOrg(c.href), activeOn: c.activeOn }))
379
390
  },
380
391
  {
381
392
  label: "Forms",
@@ -518,6 +529,36 @@ function isNavItemActive(pathname, href) {
518
529
  if (targetPath === "/") return pathname === "/";
519
530
  return pathname === targetPath || pathname.startsWith(`${targetPath}/`);
520
531
  }
532
+ function isUnderNavPattern(pathname, pattern) {
533
+ let targetPath = pattern;
534
+ let targetSearch = "";
535
+ if (/^https?:\/\//i.test(pattern)) {
536
+ if (typeof window === "undefined") return false;
537
+ try {
538
+ const u = new URL(pattern);
539
+ if (u.host !== window.location.host) return false;
540
+ targetPath = u.pathname;
541
+ targetSearch = u.search;
542
+ } catch {
543
+ return false;
544
+ }
545
+ } else {
546
+ const qi = pattern.indexOf("?");
547
+ if (qi >= 0) {
548
+ targetPath = pattern.slice(0, qi) || "/";
549
+ targetSearch = pattern.slice(qi);
550
+ }
551
+ }
552
+ const underPath = targetPath === "/" || pathname === targetPath || pathname.startsWith(`${targetPath.replace(/\/$/, "")}/`);
553
+ if (!underPath) return false;
554
+ const want = new URLSearchParams(targetSearch);
555
+ for (const k of ACTIVE_IGNORED_PARAMS) want.delete(k);
556
+ if (Array.from(want).length === 0) return true;
557
+ if (typeof window === "undefined") return false;
558
+ const have = new URLSearchParams(window.location.search);
559
+ for (const [k, v] of want) if (have.get(k) !== v) return false;
560
+ return true;
561
+ }
521
562
  function groupKeyOf(item, index) {
522
563
  return item.href ?? `nav-group-${index}-${item.label}`;
523
564
  }
@@ -2123,6 +2164,6 @@ function NavAppShell({
2123
2164
  );
2124
2165
  }
2125
2166
 
2126
- export { BETA_BANNER_DISMISS_KEY, BreadcrumbBar, CAMPAIGN_FEATURE_AVAILABILITY, NavAppShell, NavBetaBanner, NavSidebar, NavTabStrip, NavTopBar, PageHeader, buildLineParts, clearBetaBannerDismissal, envChipClasses, isNavItemActive, isNewPage, modeIdFromLabel, orgViaLabel, pageIdentityOf, shortEnvLabel, shortUserName, standardNavIcons, standardPolitogyNav, useScrollToTopOnNewPage };
2127
- //# sourceMappingURL=chunk-KI5P6QKQ.js.map
2128
- //# sourceMappingURL=chunk-KI5P6QKQ.js.map
2167
+ export { BETA_BANNER_DISMISS_KEY, BreadcrumbBar, CAMPAIGN_FEATURE_AVAILABILITY, NavAppShell, NavBetaBanner, NavSidebar, NavTabStrip, NavTopBar, PageHeader, buildLineParts, clearBetaBannerDismissal, envChipClasses, isNavItemActive, isNewPage, isUnderNavPattern, modeIdFromLabel, orgViaLabel, pageIdentityOf, shortEnvLabel, shortUserName, standardNavIcons, standardPolitogyNav, useScrollToTopOnNewPage };
2168
+ //# sourceMappingURL=chunk-7XWRF7Y2.js.map
2169
+ //# sourceMappingURL=chunk-7XWRF7Y2.js.map