@the-portland-company/shell 0.103.0 → 0.105.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.
- package/dist/app-chrome.cjs +207 -9
- package/dist/app-chrome.cjs.map +1 -1
- package/dist/app-chrome.d.cts +1 -1
- package/dist/app-chrome.d.ts +1 -1
- package/dist/app-chrome.js +165 -8
- package/dist/app-chrome.js.map +1 -1
- package/dist/{chunk-KI5P6QKQ.js → chunk-7XWRF7Y2.js} +47 -6
- package/dist/chunk-7XWRF7Y2.js.map +1 -0
- package/dist/{index-lk2Ad_Q0.d.cts → index-BKVWMe9_.d.cts} +18 -1
- package/dist/{index-ND_BS0nl.d.ts → index-DnrsvxhZ.d.ts} +18 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/native.cjs +45 -3
- package/dist/native.cjs.map +1 -1
- package/dist/native.d.cts +1 -1
- package/dist/native.d.ts +1 -1
- package/dist/native.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-KI5P6QKQ.js.map +0 -1
package/dist/app-chrome.cjs
CHANGED
|
@@ -1916,9 +1916,17 @@ var APP_POLLS_CHILDREN = [
|
|
|
1916
1916
|
{ label: "Command Center", icon: "grid", href: "https://polls.politogyvrm.com/" },
|
|
1917
1917
|
{ label: "New Poll", icon: "edit", href: "https://polls.politogyvrm.com/polls/new" }
|
|
1918
1918
|
];
|
|
1919
|
+
var CTAS_ORIGIN = "https://ctas.politogyvrm.com";
|
|
1920
|
+
var ctaRecordTabs = (...tabs) => tabs.map((t) => `${CTAS_ORIGIN}/cta?tab=${t}`);
|
|
1919
1921
|
var APP_CTAS_CHILDREN = [
|
|
1920
|
-
{
|
|
1921
|
-
|
|
1922
|
+
{
|
|
1923
|
+
label: "Calls to action",
|
|
1924
|
+
icon: "list",
|
|
1925
|
+
href: `${CTAS_ORIGIN}/?tab=ctas`,
|
|
1926
|
+
activeOn: ctaRecordTabs("builder", "placement", "audience", "experiments")
|
|
1927
|
+
},
|
|
1928
|
+
{ label: "Performance", icon: "barChart", href: `${CTAS_ORIGIN}/?tab=analytics`, activeOn: ctaRecordTabs("performance") },
|
|
1929
|
+
{ label: "Settings", icon: "settings", href: `${CTAS_ORIGIN}/?tab=site-keys`, activeOn: ctaRecordTabs("settings") }
|
|
1922
1930
|
];
|
|
1923
1931
|
var APP_A2P_CHILDREN = [
|
|
1924
1932
|
{ label: "Dashboard", icon: "grid", path: "dashboard" },
|
|
@@ -2034,7 +2042,10 @@ function standardPolitogyNav(opts) {
|
|
|
2034
2042
|
label: "Calls to action",
|
|
2035
2043
|
icon: icon("mousePointerClick"),
|
|
2036
2044
|
href: withOrg("https://ctas.politogyvrm.com/"),
|
|
2037
|
-
|
|
2045
|
+
// Every page on the CTAs host belongs to this row (§11.3), including
|
|
2046
|
+
// an open CTA at /cta/<id>.
|
|
2047
|
+
activeOn: [`${CTAS_ORIGIN}/`],
|
|
2048
|
+
children: APP_CTAS_CHILDREN.map((c) => ({ label: c.label, icon: icon(c.icon), href: withOrg(c.href), activeOn: c.activeOn }))
|
|
2038
2049
|
},
|
|
2039
2050
|
{
|
|
2040
2051
|
label: "Forms",
|
|
@@ -2177,6 +2188,36 @@ function isNavItemActive(pathname, href) {
|
|
|
2177
2188
|
if (targetPath === "/") return pathname === "/";
|
|
2178
2189
|
return pathname === targetPath || pathname.startsWith(`${targetPath}/`);
|
|
2179
2190
|
}
|
|
2191
|
+
function isUnderNavPattern(pathname, pattern) {
|
|
2192
|
+
let targetPath = pattern;
|
|
2193
|
+
let targetSearch = "";
|
|
2194
|
+
if (/^https?:\/\//i.test(pattern)) {
|
|
2195
|
+
if (typeof window === "undefined") return false;
|
|
2196
|
+
try {
|
|
2197
|
+
const u = new URL(pattern);
|
|
2198
|
+
if (u.host !== window.location.host) return false;
|
|
2199
|
+
targetPath = u.pathname;
|
|
2200
|
+
targetSearch = u.search;
|
|
2201
|
+
} catch {
|
|
2202
|
+
return false;
|
|
2203
|
+
}
|
|
2204
|
+
} else {
|
|
2205
|
+
const qi = pattern.indexOf("?");
|
|
2206
|
+
if (qi >= 0) {
|
|
2207
|
+
targetPath = pattern.slice(0, qi) || "/";
|
|
2208
|
+
targetSearch = pattern.slice(qi);
|
|
2209
|
+
}
|
|
2210
|
+
}
|
|
2211
|
+
const underPath = targetPath === "/" || pathname === targetPath || pathname.startsWith(`${targetPath.replace(/\/$/, "")}/`);
|
|
2212
|
+
if (!underPath) return false;
|
|
2213
|
+
const want = new URLSearchParams(targetSearch);
|
|
2214
|
+
for (const k of ACTIVE_IGNORED_PARAMS) want.delete(k);
|
|
2215
|
+
if (Array.from(want).length === 0) return true;
|
|
2216
|
+
if (typeof window === "undefined") return false;
|
|
2217
|
+
const have = new URLSearchParams(window.location.search);
|
|
2218
|
+
for (const [k, v] of want) if (have.get(k) !== v) return false;
|
|
2219
|
+
return true;
|
|
2220
|
+
}
|
|
2180
2221
|
function groupKeyOf(item, index) {
|
|
2181
2222
|
return item.href ?? `nav-group-${index}-${item.label}`;
|
|
2182
2223
|
}
|
|
@@ -4291,6 +4332,145 @@ function writeUrlState(current, patch) {
|
|
|
4291
4332
|
}
|
|
4292
4333
|
return buildSearch(state);
|
|
4293
4334
|
}
|
|
4335
|
+
var UPDATE_CHECK_INTERVAL_MS = 5 * 60 * 1e3;
|
|
4336
|
+
var UPDATE_FOCUS_MIN_GAP_MS = 60 * 1e3;
|
|
4337
|
+
var UPDATE_MAX_BACKOFF_MS = 30 * 60 * 1e3;
|
|
4338
|
+
var isProductionHost = (hostname) => hostname === "politogyvrm.com" || hostname.endsWith(".politogyvrm.com");
|
|
4339
|
+
function scriptSignature(html) {
|
|
4340
|
+
const srcs = /* @__PURE__ */ new Set();
|
|
4341
|
+
const re = /<script\b[^>]*\bsrc=["']([^"']+)["']/gi;
|
|
4342
|
+
let m;
|
|
4343
|
+
while (m = re.exec(html)) {
|
|
4344
|
+
const src = m[1];
|
|
4345
|
+
if (!src.startsWith("/") || src.startsWith("//")) continue;
|
|
4346
|
+
if (src.startsWith("/cdn-cgi/")) continue;
|
|
4347
|
+
srcs.add(src.split(/[?#]/)[0]);
|
|
4348
|
+
}
|
|
4349
|
+
if (srcs.size === 0) return null;
|
|
4350
|
+
return Array.from(srcs).sort().join("\n");
|
|
4351
|
+
}
|
|
4352
|
+
async function readBuild() {
|
|
4353
|
+
try {
|
|
4354
|
+
const res = await fetch("/", {
|
|
4355
|
+
cache: "no-store",
|
|
4356
|
+
credentials: "same-origin",
|
|
4357
|
+
headers: { accept: "text/html" }
|
|
4358
|
+
});
|
|
4359
|
+
if (!res.ok) return null;
|
|
4360
|
+
const sig = scriptSignature(await res.text());
|
|
4361
|
+
if (!sig) return null;
|
|
4362
|
+
return { url: res.url || "/", sig };
|
|
4363
|
+
} catch {
|
|
4364
|
+
return null;
|
|
4365
|
+
}
|
|
4366
|
+
}
|
|
4367
|
+
function useNewBuild() {
|
|
4368
|
+
const baseline = react.useRef(null);
|
|
4369
|
+
const lastCheck = react.useRef(0);
|
|
4370
|
+
const busy = react.useRef(false);
|
|
4371
|
+
const backoff = react.useRef(0);
|
|
4372
|
+
const [newSig, setNewSig] = react.useState(null);
|
|
4373
|
+
const check2 = react.useCallback(async () => {
|
|
4374
|
+
if (busy.current) return;
|
|
4375
|
+
busy.current = true;
|
|
4376
|
+
lastCheck.current = Date.now();
|
|
4377
|
+
try {
|
|
4378
|
+
const snap = await readBuild();
|
|
4379
|
+
if (!snap) {
|
|
4380
|
+
backoff.current = Math.min(backoff.current * 2 || UPDATE_CHECK_INTERVAL_MS, UPDATE_MAX_BACKOFF_MS);
|
|
4381
|
+
return;
|
|
4382
|
+
}
|
|
4383
|
+
backoff.current = 0;
|
|
4384
|
+
if (!baseline.current) {
|
|
4385
|
+
baseline.current = snap;
|
|
4386
|
+
return;
|
|
4387
|
+
}
|
|
4388
|
+
if (snap.url === baseline.current.url && snap.sig !== baseline.current.sig) setNewSig(snap.sig);
|
|
4389
|
+
} finally {
|
|
4390
|
+
busy.current = false;
|
|
4391
|
+
}
|
|
4392
|
+
}, []);
|
|
4393
|
+
react.useEffect(() => {
|
|
4394
|
+
if (typeof window === "undefined" || typeof fetch !== "function") return;
|
|
4395
|
+
if (!isProductionHost(window.location.hostname)) return;
|
|
4396
|
+
void check2();
|
|
4397
|
+
const timer = window.setInterval(() => {
|
|
4398
|
+
if (document.visibilityState === "hidden" || navigator.onLine === false) return;
|
|
4399
|
+
if (Date.now() - lastCheck.current < backoff.current) return;
|
|
4400
|
+
void check2();
|
|
4401
|
+
}, UPDATE_CHECK_INTERVAL_MS);
|
|
4402
|
+
const onFocus = () => {
|
|
4403
|
+
if (document.visibilityState === "hidden" || navigator.onLine === false) return;
|
|
4404
|
+
if (Date.now() - lastCheck.current < Math.max(UPDATE_FOCUS_MIN_GAP_MS, backoff.current)) return;
|
|
4405
|
+
void check2();
|
|
4406
|
+
};
|
|
4407
|
+
window.addEventListener("focus", onFocus);
|
|
4408
|
+
document.addEventListener("visibilitychange", onFocus);
|
|
4409
|
+
return () => {
|
|
4410
|
+
window.clearInterval(timer);
|
|
4411
|
+
window.removeEventListener("focus", onFocus);
|
|
4412
|
+
document.removeEventListener("visibilitychange", onFocus);
|
|
4413
|
+
};
|
|
4414
|
+
}, [check2]);
|
|
4415
|
+
return newSig;
|
|
4416
|
+
}
|
|
4417
|
+
function UpdateNotice() {
|
|
4418
|
+
const newSig = useNewBuild();
|
|
4419
|
+
const [dismissedSig, setDismissedSig] = react.useState(null);
|
|
4420
|
+
if (!newSig || dismissedSig === newSig) return null;
|
|
4421
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
4422
|
+
"div",
|
|
4423
|
+
{
|
|
4424
|
+
role: "status",
|
|
4425
|
+
"aria-live": "polite",
|
|
4426
|
+
"data-vrm-update-notice": "",
|
|
4427
|
+
style: {
|
|
4428
|
+
display: "flex",
|
|
4429
|
+
alignItems: "center",
|
|
4430
|
+
justifyContent: "space-between",
|
|
4431
|
+
gap: 12,
|
|
4432
|
+
marginBottom: 16,
|
|
4433
|
+
padding: "8px 16px",
|
|
4434
|
+
borderRadius: 6,
|
|
4435
|
+
border: "1px solid var(--color-border)",
|
|
4436
|
+
background: "#FFFFFF",
|
|
4437
|
+
fontSize: 14
|
|
4438
|
+
},
|
|
4439
|
+
children: [
|
|
4440
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { children: "New update available \u2014 Refresh VRM" }),
|
|
4441
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { style: { display: "flex", alignItems: "center", gap: 8 }, children: [
|
|
4442
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4443
|
+
"button",
|
|
4444
|
+
{
|
|
4445
|
+
type: "button",
|
|
4446
|
+
onClick: () => window.location.reload(),
|
|
4447
|
+
style: {
|
|
4448
|
+
padding: "4px 12px",
|
|
4449
|
+
borderRadius: 6,
|
|
4450
|
+
border: 0,
|
|
4451
|
+
background: "var(--color-accent)",
|
|
4452
|
+
color: "var(--color-accent-fg, #FFFFFF)",
|
|
4453
|
+
fontWeight: 600,
|
|
4454
|
+
cursor: "pointer"
|
|
4455
|
+
},
|
|
4456
|
+
children: "Refresh"
|
|
4457
|
+
}
|
|
4458
|
+
),
|
|
4459
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4460
|
+
"button",
|
|
4461
|
+
{
|
|
4462
|
+
type: "button",
|
|
4463
|
+
"aria-label": "Dismiss update notice",
|
|
4464
|
+
onClick: () => setDismissedSig(newSig),
|
|
4465
|
+
style: { padding: "2px 8px", border: 0, background: "transparent", fontSize: 18, lineHeight: 1, cursor: "pointer" },
|
|
4466
|
+
children: "\xD7"
|
|
4467
|
+
}
|
|
4468
|
+
)
|
|
4469
|
+
] })
|
|
4470
|
+
]
|
|
4471
|
+
}
|
|
4472
|
+
);
|
|
4473
|
+
}
|
|
4294
4474
|
var CORE_APP = "vrm";
|
|
4295
4475
|
var DEFAULT_SIGN_OUT_URL = "/auth/signout";
|
|
4296
4476
|
var POLITOGY_APPS = {
|
|
@@ -4586,18 +4766,33 @@ function FrameBody({
|
|
|
4586
4766
|
const navItems = core?.nav ?? derivedNavItems;
|
|
4587
4767
|
const navIsActive = react.useMemo(() => {
|
|
4588
4768
|
const childHrefs = /* @__PURE__ */ new Map();
|
|
4769
|
+
const extra = /* @__PURE__ */ new Map();
|
|
4770
|
+
const addExtra = (href, pats) => {
|
|
4771
|
+
if (!pats?.length) return;
|
|
4772
|
+
extra.set(href, [...extra.get(href) ?? [], ...pats]);
|
|
4773
|
+
};
|
|
4589
4774
|
for (const item of navItems) {
|
|
4590
|
-
if (!item.href
|
|
4775
|
+
if (!item.href) continue;
|
|
4776
|
+
addExtra(item.href, item.activeOn);
|
|
4777
|
+
if (!item.children?.length) continue;
|
|
4591
4778
|
const hrefs = [];
|
|
4592
4779
|
for (const child of item.children) {
|
|
4593
|
-
if (child.href)
|
|
4780
|
+
if (child.href) {
|
|
4781
|
+
hrefs.push(child.href);
|
|
4782
|
+
addExtra(child.href, child.activeOn);
|
|
4783
|
+
}
|
|
4784
|
+
addExtra(item.href, child.activeOn);
|
|
4594
4785
|
for (const leaf of child.children ?? []) {
|
|
4595
|
-
if (leaf.href)
|
|
4786
|
+
if (leaf.href) {
|
|
4787
|
+
hrefs.push(leaf.href);
|
|
4788
|
+
addExtra(leaf.href, leaf.activeOn);
|
|
4789
|
+
}
|
|
4790
|
+
addExtra(item.href, leaf.activeOn);
|
|
4596
4791
|
}
|
|
4597
4792
|
}
|
|
4598
4793
|
childHrefs.set(item.href, hrefs);
|
|
4599
4794
|
}
|
|
4600
|
-
return (pathname2, href) => isNavItemActive(pathname2, href) || (childHrefs.get(href) ?? []).some((h) => isNavItemActive(pathname2, h));
|
|
4795
|
+
return (pathname2, href) => isNavItemActive(pathname2, href) || (childHrefs.get(href) ?? []).some((h) => isNavItemActive(pathname2, h)) || (extra.get(href) ?? []).some((p) => isUnderNavPattern(pathname2, p));
|
|
4601
4796
|
}, [navItems]);
|
|
4602
4797
|
const derivedBreadcrumbs = react.useMemo(
|
|
4603
4798
|
() => deriveBreadcrumbs(navItems, pathname, { search, origin: meta.origin }),
|
|
@@ -4616,7 +4811,7 @@ function FrameBody({
|
|
|
4616
4811
|
},
|
|
4617
4812
|
bootGeneration
|
|
4618
4813
|
),
|
|
4619
|
-
/* @__PURE__ */ jsxRuntime.
|
|
4814
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
4620
4815
|
NavAppShell,
|
|
4621
4816
|
{
|
|
4622
4817
|
sidebar: {
|
|
@@ -4711,7 +4906,10 @@ function FrameBody({
|
|
|
4711
4906
|
/* @__PURE__ */ jsxRuntime.jsx(ChromeTopBarActions, {})
|
|
4712
4907
|
] })
|
|
4713
4908
|
},
|
|
4714
|
-
children
|
|
4909
|
+
children: [
|
|
4910
|
+
/* @__PURE__ */ jsxRuntime.jsx(UpdateNotice, {}),
|
|
4911
|
+
children
|
|
4912
|
+
]
|
|
4715
4913
|
}
|
|
4716
4914
|
)
|
|
4717
4915
|
] });
|