@wix/himalaya-cli 0.957.0 → 0.959.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/cli.mjs +97 -7
- package/guides/headless-loop.md +12 -4
- package/package.json +2 -2
package/dist/cli.mjs
CHANGED
|
@@ -39199,7 +39199,7 @@ var init_preview_token = __esm({
|
|
|
39199
39199
|
SUBTLE_ALGO = { name: "HMAC", hash: "SHA-256" };
|
|
39200
39200
|
PREVIEW_TOKEN_VERSION = 1;
|
|
39201
39201
|
DEFAULT_PREVIEW_TOKEN_TTL_SECONDS = 5 * 60;
|
|
39202
|
-
WEB_PREVIEW_TOKEN_TTL_SECONDS =
|
|
39202
|
+
WEB_PREVIEW_TOKEN_TTL_SECONDS = 45 * 60;
|
|
39203
39203
|
}
|
|
39204
39204
|
});
|
|
39205
39205
|
|
|
@@ -48469,8 +48469,11 @@ function cloneCell(template, prefix, vertical, card) {
|
|
|
48469
48469
|
cell.modifiers.accessibilityLabel = card.title;
|
|
48470
48470
|
return cell;
|
|
48471
48471
|
}
|
|
48472
|
+
function lineIndent(src, open) {
|
|
48473
|
+
return /^[ \t]*/.exec(src.slice(src.lastIndexOf("\n", open) + 1, open))[0];
|
|
48474
|
+
}
|
|
48472
48475
|
function serializeAt(node, src, open) {
|
|
48473
|
-
const indent =
|
|
48476
|
+
const indent = lineIndent(src, open);
|
|
48474
48477
|
return JSON.stringify(node, null, 2).split("\n").map((line, i) => i === 0 ? line : indent + line).join("\n");
|
|
48475
48478
|
}
|
|
48476
48479
|
function patchGrids(src, installed, patch) {
|
|
@@ -48568,14 +48571,88 @@ function patchModules(src, installed, patch) {
|
|
|
48568
48571
|
return `"homeModules": ${JSON.stringify(JSON.stringify(kept))}`;
|
|
48569
48572
|
});
|
|
48570
48573
|
}
|
|
48571
|
-
function
|
|
48574
|
+
function homeScreenSpan(src, homeActionId) {
|
|
48575
|
+
const OPEN = /"([A-Za-z_0-9]+)": \{\s*"screenId": "\1"/g;
|
|
48576
|
+
for (let m = OPEN.exec(src); m; m = OPEN.exec(src)) {
|
|
48577
|
+
const open = src.indexOf("{", m.index);
|
|
48578
|
+
const close = objectEnd(src, open);
|
|
48579
|
+
if (close < 0) continue;
|
|
48580
|
+
if (src.slice(open, close).includes(`"actionId": "${homeActionId}"`)) return { open, close };
|
|
48581
|
+
OPEN.lastIndex = close;
|
|
48582
|
+
}
|
|
48583
|
+
return void 0;
|
|
48584
|
+
}
|
|
48585
|
+
function isDeadStoreCta(node) {
|
|
48586
|
+
if (node.body?.type !== "Button") return false;
|
|
48587
|
+
const action = node.body.props?.action;
|
|
48588
|
+
const screenId = action?.params?.screenId;
|
|
48589
|
+
return typeof screenId === "string" && isStoreScreen(screenId);
|
|
48590
|
+
}
|
|
48591
|
+
function pruneNode(node, dropped) {
|
|
48592
|
+
const props = node.body?.props;
|
|
48593
|
+
if (!props) return true;
|
|
48594
|
+
const lists = props.itemsPath ? ["children"] : ["children", "items"];
|
|
48595
|
+
for (const key2 of lists) {
|
|
48596
|
+
const list = props[key2];
|
|
48597
|
+
if (!Array.isArray(list) || !list.length) continue;
|
|
48598
|
+
const kept = list.filter((child) => {
|
|
48599
|
+
if (!isNode2(child)) return true;
|
|
48600
|
+
if (isDeadStoreCta(child)) {
|
|
48601
|
+
dropped.push(typeof child.id === "string" && child.id ? child.id : "(unnamed CTA)");
|
|
48602
|
+
return false;
|
|
48603
|
+
}
|
|
48604
|
+
return pruneNode(child, dropped);
|
|
48605
|
+
});
|
|
48606
|
+
if (kept.length === list.length) continue;
|
|
48607
|
+
if (!kept.length) return false;
|
|
48608
|
+
props[key2] = kept;
|
|
48609
|
+
}
|
|
48610
|
+
for (const [key2, child] of Object.entries(props)) {
|
|
48611
|
+
if (lists.includes(key2)) continue;
|
|
48612
|
+
pruneWithin(child, dropped);
|
|
48613
|
+
}
|
|
48614
|
+
return true;
|
|
48615
|
+
}
|
|
48616
|
+
function pruneWithin(value, dropped) {
|
|
48617
|
+
if (Array.isArray(value)) {
|
|
48618
|
+
for (const child of value) pruneWithin(child, dropped);
|
|
48619
|
+
return;
|
|
48620
|
+
}
|
|
48621
|
+
if (!value || typeof value !== "object") return;
|
|
48622
|
+
if (isNode2(value)) {
|
|
48623
|
+
pruneNode(value, dropped);
|
|
48624
|
+
return;
|
|
48625
|
+
}
|
|
48626
|
+
for (const child of Object.values(value)) pruneWithin(child, dropped);
|
|
48627
|
+
}
|
|
48628
|
+
function patchStoreCtas(src, verticals, homeActionId) {
|
|
48629
|
+
if (verticals.includes("store")) return { src, dropped: [] };
|
|
48630
|
+
const span = homeScreenSpan(src, homeActionId);
|
|
48631
|
+
if (!span) return { src, dropped: [] };
|
|
48632
|
+
let screen;
|
|
48633
|
+
try {
|
|
48634
|
+
screen = JSON.parse(src.slice(span.open, span.close));
|
|
48635
|
+
} catch {
|
|
48636
|
+
return { src, dropped: [] };
|
|
48637
|
+
}
|
|
48638
|
+
if (!isNode2(screen.payload)) return { src, dropped: [] };
|
|
48639
|
+
const dropped = [];
|
|
48640
|
+
if (!pruneNode(screen.payload, dropped) || !dropped.length) return { src, dropped: [] };
|
|
48641
|
+
return {
|
|
48642
|
+
src: src.slice(0, span.open) + serializeAt(screen, src, span.open) + src.slice(span.close),
|
|
48643
|
+
dropped
|
|
48644
|
+
};
|
|
48645
|
+
}
|
|
48646
|
+
function patchHomeForVerticals(src, verticals, homeActionId) {
|
|
48572
48647
|
const installed = new Set(verticals.filter(isKnown));
|
|
48573
|
-
const patch = { src, cells: [], added: [], droppedModules: [], unreachable: [] };
|
|
48648
|
+
const patch = { src, cells: [], added: [], droppedModules: [], droppedCtas: [], unreachable: [] };
|
|
48574
48649
|
if (!installed.size) return patch;
|
|
48575
|
-
|
|
48650
|
+
const ctas = patchStoreCtas(patchModules(patchGrids(src, installed, patch), installed, patch), [...installed], homeActionId);
|
|
48651
|
+
patch.src = ctas.src;
|
|
48652
|
+
patch.droppedCtas = ctas.dropped;
|
|
48576
48653
|
return patch;
|
|
48577
48654
|
}
|
|
48578
|
-
var EXPLORE_CARDS, EXPLORE_ORDER, EXPLORE_MAX_CELLS, MODULE_SOURCE_VERTICALS, isKnown, GRID_VERTICAL_LABELS, escapeRe2, textProps;
|
|
48655
|
+
var EXPLORE_CARDS, EXPLORE_ORDER, EXPLORE_MAX_CELLS, MODULE_SOURCE_VERTICALS, isKnown, GRID_VERTICAL_LABELS, escapeRe2, textProps, STORE_SCREENS, isStoreScreen, isNode2;
|
|
48579
48656
|
var init_home_descriptor = __esm({
|
|
48580
48657
|
"src/site-analyze/home-descriptor.ts"() {
|
|
48581
48658
|
init_types2();
|
|
@@ -48649,6 +48726,16 @@ var init_home_descriptor = __esm({
|
|
|
48649
48726
|
GRID_VERTICAL_LABELS = /* @__PURE__ */ new Set([...KNOWN_VERTICALS, "faq"]);
|
|
48650
48727
|
escapeRe2 = (s) => s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
48651
48728
|
textProps = (n) => n?.body?.props;
|
|
48729
|
+
STORE_SCREENS = /* @__PURE__ */ new Set([
|
|
48730
|
+
"himi_shop",
|
|
48731
|
+
"himi_saved_products",
|
|
48732
|
+
"himi_collections",
|
|
48733
|
+
"himi_collection",
|
|
48734
|
+
"himi_cart",
|
|
48735
|
+
"himi_orders"
|
|
48736
|
+
]);
|
|
48737
|
+
isStoreScreen = (id) => STORE_SCREENS.has(id) || /^himi_(?:product|order)[_/]/.test(id);
|
|
48738
|
+
isNode2 = (v) => !!v && typeof v === "object" && !!v.body && typeof v.body === "object";
|
|
48652
48739
|
}
|
|
48653
48740
|
});
|
|
48654
48741
|
|
|
@@ -48875,8 +48962,11 @@ async function applyOverlays(input) {
|
|
|
48875
48962
|
const patched = patchBrandParams(prev, overlay, homeAction);
|
|
48876
48963
|
let next = patched.src;
|
|
48877
48964
|
if (!patched.foreign && overlay.installedVerticals?.length) {
|
|
48878
|
-
const home = patchHomeForVerticals(next, overlay.installedVerticals);
|
|
48965
|
+
const home = patchHomeForVerticals(next, overlay.installedVerticals, homeAction);
|
|
48879
48966
|
next = home.src;
|
|
48967
|
+
if (home.droppedCtas.length) {
|
|
48968
|
+
notes.push(`removed the home's store call(s) to action (${home.droppedCtas.join(", ")}) \u2014 this site has no store`);
|
|
48969
|
+
}
|
|
48880
48970
|
if (home.unreachable.length) {
|
|
48881
48971
|
const named = home.unreachable.slice(0, 6).join(", ");
|
|
48882
48972
|
const rest = home.unreachable.length > 6 ? ` (and ${home.unreachable.length - 6} more)` : "";
|
package/guides/headless-loop.md
CHANGED
|
@@ -252,10 +252,18 @@ The push JSON includes:
|
|
|
252
252
|
- `next` — suggested `himi context` / `himi screens` follow-ups
|
|
253
253
|
|
|
254
254
|
The browser-preview token embedded in `previewWeb` is scoped to this app + draft release and
|
|
255
|
-
expires after **
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
255
|
+
expires after **45 minutes**. The JSON also includes `previewTokenExpiresAt` — read that rather
|
|
256
|
+
than this number when you are talking to a plane you did not start. If review takes longer, run
|
|
257
|
+
`himi preview --app my-app --release <id> --target wix`: it renews the browser token without
|
|
258
|
+
promoting the draft. For header-only function calls against the same draft, pass the separately
|
|
259
|
+
issued short-lived function token as `--preview-token <token>`.
|
|
260
|
+
|
|
261
|
+
**When you hand `previewWeb` to a person, the expiry is theirs, not yours.** Renewing it needs
|
|
262
|
+
this CLI and your credentials, so a link handed over near the end of a session leaves the
|
|
263
|
+
recipient with a deadline and no way to extend it. Re-mint immediately before handing it over
|
|
264
|
+
rather than passing on a link minted earlier, and say the expiry in their timezone. If they sign
|
|
265
|
+
in to the Wix account that owns the app, its own owner page previews it for them
|
|
266
|
+
without this CLI and without you — that, not the link, is the durable way back in.
|
|
259
267
|
|
|
260
268
|
## 5b. Agent preview (machine-readable, no browser scrape)
|
|
261
269
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wix/himalaya-cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.959.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "himi — the Himalaya authoring CLI. Build a Tier-5 content package on your own machine, push it to the production serve as a draft, preview it on web + Himi Player, and read worker logs back — the remote dev loop. Wraps @himalaya/serve-cli for transport.",
|
|
6
6
|
"keywords": [
|
|
@@ -64,5 +64,5 @@
|
|
|
64
64
|
"artifactId": "himalaya-cli"
|
|
65
65
|
}
|
|
66
66
|
},
|
|
67
|
-
"falconPackageHash": "
|
|
67
|
+
"falconPackageHash": "28086de6e860b4001b12cb38f701893e959b034a5b7fa2099a215151"
|
|
68
68
|
}
|