@wix/himalaya-cli 0.958.0 → 0.960.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.
Files changed (2) hide show
  1. package/dist/cli.mjs +96 -9
  2. package/package.json +2 -2
package/dist/cli.mjs CHANGED
@@ -5261,7 +5261,6 @@ function resolveTranslation(value, catalog, sourceCatalog) {
5261
5261
  var BINDING_SIGILS, BINDING_SIGIL_RE, TRANSLATION_PREFIX, TRANSLATION_KEY_RE;
5262
5262
  var init_bindings = __esm({
5263
5263
  "../../core/ts/src/bindings.ts"() {
5264
- "use strict";
5265
5264
  BINDING_SIGILS = ["service", "flag", "item", "t"];
5266
5265
  BINDING_SIGIL_RE = new RegExp(
5267
5266
  `^\\$(?:${BINDING_SIGILS.filter((s) => s !== "t").join("|")})\\b|^\\$t:`
@@ -18547,7 +18546,6 @@ function shouldRevealError(args) {
18547
18546
  var EMAIL_RE, URL_HOST_RE, INTEGER_RE, NUMBER_RE;
18548
18547
  var init_validation = __esm({
18549
18548
  "../../core/ts/src/validation.ts"() {
18550
- "use strict";
18551
18549
  EMAIL_RE = /^[A-Za-z0-9._%+-]+@[A-Za-z0-9-]+(\.[A-Za-z0-9-]+)*\.[A-Za-z]{2,}$/;
18552
18550
  URL_HOST_RE = /^[A-Za-z0-9-]+(\.[A-Za-z0-9-]+)*(:[0-9]+)?$/;
18553
18551
  INTEGER_RE = /^[+-]?[0-9]+$/;
@@ -21972,7 +21970,6 @@ function validateWorkerSubtree(raw, slotId, policy, actionCatalog) {
21972
21970
  var WORKER_SUBTREE_CEILINGS, ID_PART, ACTION_ID;
21973
21971
  var init_worker_subtree = __esm({
21974
21972
  "../../core/ts/src/worker-subtree.ts"() {
21975
- "use strict";
21976
21973
  init_worker_subtree_safe_types_generated();
21977
21974
  WORKER_SUBTREE_CEILINGS = Object.freeze({
21978
21975
  maxEncodedBytes: 65536,
@@ -48471,8 +48468,11 @@ function cloneCell(template, prefix, vertical, card) {
48471
48468
  cell.modifiers.accessibilityLabel = card.title;
48472
48469
  return cell;
48473
48470
  }
48471
+ function lineIndent(src, open) {
48472
+ return /^[ \t]*/.exec(src.slice(src.lastIndexOf("\n", open) + 1, open))[0];
48473
+ }
48474
48474
  function serializeAt(node, src, open) {
48475
- const indent = src.slice(src.lastIndexOf("\n", open) + 1, open);
48475
+ const indent = lineIndent(src, open);
48476
48476
  return JSON.stringify(node, null, 2).split("\n").map((line, i) => i === 0 ? line : indent + line).join("\n");
48477
48477
  }
48478
48478
  function patchGrids(src, installed, patch) {
@@ -48570,14 +48570,88 @@ function patchModules(src, installed, patch) {
48570
48570
  return `"homeModules": ${JSON.stringify(JSON.stringify(kept))}`;
48571
48571
  });
48572
48572
  }
48573
- function patchHomeForVerticals(src, verticals) {
48573
+ function homeScreenSpan(src, homeActionId) {
48574
+ const OPEN = /"([A-Za-z_0-9]+)": \{\s*"screenId": "\1"/g;
48575
+ for (let m = OPEN.exec(src); m; m = OPEN.exec(src)) {
48576
+ const open = src.indexOf("{", m.index);
48577
+ const close = objectEnd(src, open);
48578
+ if (close < 0) continue;
48579
+ if (src.slice(open, close).includes(`"actionId": "${homeActionId}"`)) return { open, close };
48580
+ OPEN.lastIndex = close;
48581
+ }
48582
+ return void 0;
48583
+ }
48584
+ function isDeadStoreCta(node) {
48585
+ if (node.body?.type !== "Button") return false;
48586
+ const action = node.body.props?.action;
48587
+ const screenId = action?.params?.screenId;
48588
+ return typeof screenId === "string" && isStoreScreen(screenId);
48589
+ }
48590
+ function pruneNode(node, dropped) {
48591
+ const props = node.body?.props;
48592
+ if (!props) return true;
48593
+ const lists = props.itemsPath ? ["children"] : ["children", "items"];
48594
+ for (const key2 of lists) {
48595
+ const list = props[key2];
48596
+ if (!Array.isArray(list) || !list.length) continue;
48597
+ const kept = list.filter((child) => {
48598
+ if (!isNode2(child)) return true;
48599
+ if (isDeadStoreCta(child)) {
48600
+ dropped.push(typeof child.id === "string" && child.id ? child.id : "(unnamed CTA)");
48601
+ return false;
48602
+ }
48603
+ return pruneNode(child, dropped);
48604
+ });
48605
+ if (kept.length === list.length) continue;
48606
+ if (!kept.length) return false;
48607
+ props[key2] = kept;
48608
+ }
48609
+ for (const [key2, child] of Object.entries(props)) {
48610
+ if (lists.includes(key2)) continue;
48611
+ pruneWithin(child, dropped);
48612
+ }
48613
+ return true;
48614
+ }
48615
+ function pruneWithin(value, dropped) {
48616
+ if (Array.isArray(value)) {
48617
+ for (const child of value) pruneWithin(child, dropped);
48618
+ return;
48619
+ }
48620
+ if (!value || typeof value !== "object") return;
48621
+ if (isNode2(value)) {
48622
+ pruneNode(value, dropped);
48623
+ return;
48624
+ }
48625
+ for (const child of Object.values(value)) pruneWithin(child, dropped);
48626
+ }
48627
+ function patchStoreCtas(src, verticals, homeActionId) {
48628
+ if (verticals.includes("store")) return { src, dropped: [] };
48629
+ const span = homeScreenSpan(src, homeActionId);
48630
+ if (!span) return { src, dropped: [] };
48631
+ let screen;
48632
+ try {
48633
+ screen = JSON.parse(src.slice(span.open, span.close));
48634
+ } catch {
48635
+ return { src, dropped: [] };
48636
+ }
48637
+ if (!isNode2(screen.payload)) return { src, dropped: [] };
48638
+ const dropped = [];
48639
+ if (!pruneNode(screen.payload, dropped) || !dropped.length) return { src, dropped: [] };
48640
+ return {
48641
+ src: src.slice(0, span.open) + serializeAt(screen, src, span.open) + src.slice(span.close),
48642
+ dropped
48643
+ };
48644
+ }
48645
+ function patchHomeForVerticals(src, verticals, homeActionId) {
48574
48646
  const installed = new Set(verticals.filter(isKnown));
48575
- const patch = { src, cells: [], added: [], droppedModules: [], unreachable: [] };
48647
+ const patch = { src, cells: [], added: [], droppedModules: [], droppedCtas: [], unreachable: [] };
48576
48648
  if (!installed.size) return patch;
48577
- patch.src = patchModules(patchGrids(src, installed, patch), installed, patch);
48649
+ const ctas = patchStoreCtas(patchModules(patchGrids(src, installed, patch), installed, patch), [...installed], homeActionId);
48650
+ patch.src = ctas.src;
48651
+ patch.droppedCtas = ctas.dropped;
48578
48652
  return patch;
48579
48653
  }
48580
- var EXPLORE_CARDS, EXPLORE_ORDER, EXPLORE_MAX_CELLS, MODULE_SOURCE_VERTICALS, isKnown, GRID_VERTICAL_LABELS, escapeRe2, textProps;
48654
+ var EXPLORE_CARDS, EXPLORE_ORDER, EXPLORE_MAX_CELLS, MODULE_SOURCE_VERTICALS, isKnown, GRID_VERTICAL_LABELS, escapeRe2, textProps, STORE_SCREENS, isStoreScreen, isNode2;
48581
48655
  var init_home_descriptor = __esm({
48582
48656
  "src/site-analyze/home-descriptor.ts"() {
48583
48657
  init_types2();
@@ -48651,6 +48725,16 @@ var init_home_descriptor = __esm({
48651
48725
  GRID_VERTICAL_LABELS = /* @__PURE__ */ new Set([...KNOWN_VERTICALS, "faq"]);
48652
48726
  escapeRe2 = (s) => s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
48653
48727
  textProps = (n) => n?.body?.props;
48728
+ STORE_SCREENS = /* @__PURE__ */ new Set([
48729
+ "himi_shop",
48730
+ "himi_saved_products",
48731
+ "himi_collections",
48732
+ "himi_collection",
48733
+ "himi_cart",
48734
+ "himi_orders"
48735
+ ]);
48736
+ isStoreScreen = (id) => STORE_SCREENS.has(id) || /^himi_(?:product|order)[_/]/.test(id);
48737
+ isNode2 = (v) => !!v && typeof v === "object" && !!v.body && typeof v.body === "object";
48654
48738
  }
48655
48739
  });
48656
48740
 
@@ -48877,8 +48961,11 @@ async function applyOverlays(input) {
48877
48961
  const patched = patchBrandParams(prev, overlay, homeAction);
48878
48962
  let next = patched.src;
48879
48963
  if (!patched.foreign && overlay.installedVerticals?.length) {
48880
- const home = patchHomeForVerticals(next, overlay.installedVerticals);
48964
+ const home = patchHomeForVerticals(next, overlay.installedVerticals, homeAction);
48881
48965
  next = home.src;
48966
+ if (home.droppedCtas.length) {
48967
+ notes.push(`removed the home's store call(s) to action (${home.droppedCtas.join(", ")}) \u2014 this site has no store`);
48968
+ }
48882
48969
  if (home.unreachable.length) {
48883
48970
  const named = home.unreachable.slice(0, 6).join(", ");
48884
48971
  const rest = home.unreachable.length > 6 ? ` (and ${home.unreachable.length - 6} more)` : "";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wix/himalaya-cli",
3
- "version": "0.958.0",
3
+ "version": "0.960.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": "d7801908694db877e53dbcdb28836a858399f835aec0a43b73c80bec"
67
+ "falconPackageHash": "22c39962d76a89310d5e22cf1fc9aff68b665d2a795339f367d2a3ef"
68
68
  }