@the-portland-company/shell 0.102.3 → 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
  }
@@ -1378,7 +1419,7 @@ function NavTopBar({
1378
1419
  const hasRealName = rawName.length > 0 && !rawName.includes("@");
1379
1420
  const displayName = hasRealName ? formatFirstLast(rawName) : user?.email ?? "Signed in";
1380
1421
  const initials = (hasRealName ? rawName : user?.email ?? "P").slice(0, 2).toUpperCase();
1381
- const secondary = hasRealName ? user?.email || [user?.tier, user?.role].filter(Boolean).join(" \xB7 ") || "member" : [user?.tier, user?.role].filter(Boolean).join(" \xB7 ") || "member";
1422
+ const secondary = hasRealName ? user?.email || user?.role || "member" : user?.role || "member";
1382
1423
  return /* @__PURE__ */ jsxs("div", { className: "sticky top-0 z-20", children: [
1383
1424
  /* @__PURE__ */ jsxs("header", { className: "flex min-w-0 h-[var(--topbar-height,60px)] items-center justify-between gap-[8px] md:gap-[14px] border-b border-[color:var(--line)] bg-[color:var(--panel)] px-[var(--topbar-padding-x,20px)]", children: [
1384
1425
  onOpenNav ? /* @__PURE__ */ jsx(
@@ -1639,7 +1680,7 @@ function NavSidebarUserCard({
1639
1680
  const hasRealName = rawName.length > 0 && !rawName.includes("@");
1640
1681
  const displayName = hasRealName ? shortUserName(rawName) : user.email ?? "Signed in";
1641
1682
  const initials = hasRealName ? rawName.split(/\s+/).filter(Boolean).slice(0, 2).map((w) => w[0]).join("").toUpperCase() : (user.email ?? "P").slice(0, 2).toUpperCase();
1642
- const secondary = hasRealName ? user.email || [user.tier, user.role].filter(Boolean).join(" \xB7 ") || "member" : [user.tier, user.role].filter(Boolean).join(" \xB7 ") || "member";
1683
+ const secondary = hasRealName ? user.email || user.role || "member" : user.role || "member";
1643
1684
  const rc = useRailCollapse();
1644
1685
  return /* @__PURE__ */ jsxs("details", { "data-nav-details": true, className: "group/acct relative", children: [
1645
1686
  /* @__PURE__ */ jsxs(
@@ -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-PR5QBA7S.js.map
2128
- //# sourceMappingURL=chunk-PR5QBA7S.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