@useinsider/guido 3.20.1-beta.2c8da49 → 3.20.1-beta.2d09f29

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 (72) hide show
  1. package/dist/composables/useActionsApi.js +64 -80
  2. package/dist/composables/useFullStoryBridge.js +10 -9
  3. package/dist/composables/useGuidoStateBridge.js +3 -3
  4. package/dist/composables/useLegacyStrategyConversion.js +16 -16
  5. package/dist/composables/useStripo.js +10 -11
  6. package/dist/config/migrator/fullStoryScriptMigrator.js +5 -0
  7. package/dist/config/migrator/index.js +11 -10
  8. package/dist/extensions/Blocks/Items/block.js +42 -43
  9. package/dist/extensions/Blocks/Recommendation/block.js +29 -33
  10. package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +83 -78
  11. package/dist/extensions/Blocks/Recommendation/controls/customAttribute/textTrim.js +2 -1
  12. package/dist/extensions/Blocks/Recommendation/controls/main/algorithm.js +12 -2
  13. package/dist/extensions/Blocks/Recommendation/controls/main/currency.js +86 -104
  14. package/dist/extensions/Blocks/Recommendation/controls/main/index.js +263 -348
  15. package/dist/extensions/Blocks/Recommendation/controls/main/layoutOrientation.js +50 -48
  16. package/dist/extensions/Blocks/Recommendation/controls/main/locale.js +21 -16
  17. package/dist/extensions/Blocks/Recommendation/controls/main/pricePlacement.js +40 -44
  18. package/dist/extensions/Blocks/Recommendation/controls/main/productCount.js +19 -14
  19. package/dist/extensions/Blocks/Recommendation/controls/main/productLayout.js +102 -104
  20. package/dist/extensions/Blocks/Recommendation/controls/main/shuffle.js +23 -18
  21. package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +286 -312
  22. package/dist/extensions/Blocks/Recommendation/controls/mobileLayout/cssRules.js +20 -24
  23. package/dist/extensions/Blocks/Recommendation/controls/name/textTrim.js +7 -6
  24. package/dist/extensions/Blocks/Recommendation/controls/shared/textTrimCssRules.js +8 -8
  25. package/dist/extensions/Blocks/Recommendation/controls/spacing/index.js +151 -113
  26. package/dist/extensions/Blocks/Recommendation/store/recommendation.js +205 -219
  27. package/dist/extensions/Blocks/Recommendation/utils/captureStyleTemplates.js +1 -1
  28. package/dist/extensions/Blocks/Recommendation/utils/nodeConfigWriter.js +40 -111
  29. package/dist/extensions/Blocks/Recommendation/utils/strategyCommit.js +35 -31
  30. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js +192 -271
  31. package/dist/package.json.js +1 -1
  32. package/dist/src/composables/useActionsApi.d.ts +1 -5
  33. package/dist/src/config/migrator/fullStoryScriptMigrator.d.ts +1 -0
  34. package/dist/src/extensions/Blocks/Checkbox/controls/blockBackground/index.d.ts +0 -1
  35. package/dist/src/extensions/Blocks/CouponBlock/controls/index.d.ts +0 -8
  36. package/dist/src/extensions/Blocks/Items/controls/index.d.ts +0 -40
  37. package/dist/src/extensions/Blocks/RadioButton/controls/blockBackground/index.d.ts +0 -1
  38. package/dist/src/extensions/Blocks/Recommendation/block.d.ts +0 -1
  39. package/dist/src/extensions/Blocks/Recommendation/controls/blockBackground/index.d.ts +0 -1
  40. package/dist/src/extensions/Blocks/Recommendation/controls/button/index.d.ts +0 -11
  41. package/dist/src/extensions/Blocks/Recommendation/controls/cardComposition/index.d.ts +6 -3
  42. package/dist/src/extensions/Blocks/Recommendation/controls/customAttribute/index.d.ts +0 -7
  43. package/dist/src/extensions/Blocks/Recommendation/controls/image/index.d.ts +0 -2
  44. package/dist/src/extensions/Blocks/Recommendation/controls/main/currency.d.ts +5 -5
  45. package/dist/src/extensions/Blocks/Recommendation/controls/main/index.d.ts +12 -21
  46. package/dist/src/extensions/Blocks/Recommendation/controls/main/layoutOrientation.d.ts +3 -6
  47. package/dist/src/extensions/Blocks/Recommendation/controls/main/pricePlacement.d.ts +5 -6
  48. package/dist/src/extensions/Blocks/Recommendation/controls/main/productLayout.d.ts +3 -6
  49. package/dist/src/extensions/Blocks/Recommendation/controls/main/utils.d.ts +9 -21
  50. package/dist/src/extensions/Blocks/Recommendation/controls/mobileLayout/cssRules.d.ts +13 -19
  51. package/dist/src/extensions/Blocks/Recommendation/controls/name/index.d.ts +0 -7
  52. package/dist/src/extensions/Blocks/Recommendation/controls/oldPrice/index.d.ts +0 -7
  53. package/dist/src/extensions/Blocks/Recommendation/controls/omnibusDiscount/index.d.ts +0 -7
  54. package/dist/src/extensions/Blocks/Recommendation/controls/omnibusPrice/index.d.ts +0 -7
  55. package/dist/src/extensions/Blocks/Recommendation/controls/price/index.d.ts +0 -7
  56. package/dist/src/extensions/Blocks/Recommendation/controls/shared/textTrimCssRules.d.ts +8 -10
  57. package/dist/src/extensions/Blocks/Recommendation/controls/spacing/index.d.ts +5 -9
  58. package/dist/src/extensions/Blocks/Recommendation/controls/title/index.d.ts +0 -7
  59. package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +1 -8
  60. package/dist/src/extensions/Blocks/Recommendation/utils/nodeConfigWriter.d.ts +11 -18
  61. package/dist/src/extensions/Blocks/_Boilerplate/controls/blockBackground/index.d.ts +0 -1
  62. package/dist/src/extensions/Blocks/controlFactories.d.ts +0 -22
  63. package/dist/src/stores/editor.d.ts +1 -3
  64. package/dist/src/utils/fullStoryScripts.d.ts +6 -0
  65. package/dist/static/styles/components/button.css.js +0 -5
  66. package/dist/stores/editor.js +0 -5
  67. package/dist/utils/fullStoryScripts.js +8 -0
  68. package/package.json +3 -3
  69. package/dist/extensions/Blocks/Recommendation/utils/blockRefresh.js +0 -28
  70. package/dist/extensions/Blocks/Recommendation/utils/currencySettings.js +0 -25
  71. package/dist/src/extensions/Blocks/Recommendation/utils/blockRefresh.d.ts +0 -17
  72. package/dist/src/extensions/Blocks/Recommendation/utils/currencySettings.d.ts +0 -6
@@ -1,42 +1,38 @@
1
- import { ModificationDescription as u } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
2
- const r = "ins-recommendation-desktop-container", a = "ins-recommendation-mobile-container", i = "ins-recommendation-list-layout", s = "ins-recommendation-no-mobile-layout", m = `.${a} { display: none; }`, p = `@media only screen and (max-width: 480px) { .${r} { display: none !important; } .${a} { display: table !important; } .${i} .${r} { display: table !important; } .${i} .${a}, .${i} .ins-recommendation-mobile-row { display: none !important; } .${i} .product-image-cell { width: 80px !important; } .${i} .product-image-cell img { max-width: 80px !important; } .${i} .button-cell { width: 80px !important; } .${i} .product-info-cell { padding: 5px 8px !important; } }`, d = `@media only screen and (max-width: 480px) { .${s} .${r} { display: table !important; } .${s} .${a}, .${s} .ins-recommendation-mobile-row { display: none !important; } }`, c = `.${a}`;
3
- function f(t, o) {
4
- return !!t.querySelector(o);
1
+ import { ModificationDescription as a } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
2
+ const r = "ins-recommendation-desktop-container", l = "ins-recommendation-mobile-container", i = "ins-recommendation-list-layout", s = "ins-recommendation-no-mobile-layout", u = `.${l} { display: none; }`, m = `@media only screen and (max-width: 480px) { .${r} { display: none !important; } .${l} { display: table !important; } .${i} .${r} { display: table !important; } .${i} .${l}, .${i} .ins-recommendation-mobile-row { display: none !important; } .${i} .product-image-cell { width: 80px !important; } .${i} .product-image-cell img { max-width: 80px !important; } .${i} .button-cell { width: 80px !important; } .${i} .product-info-cell { padding: 5px 8px !important; } }`, d = `@media only screen and (max-width: 480px) { .${s} .${r} { display: table !important; } .${s} .${l}, .${s} .ins-recommendation-mobile-row { display: none !important; } }`, p = `.${l}`;
3
+ function c(t, e) {
4
+ return !!t.querySelector(e);
5
5
  }
6
- function y(t) {
6
+ function f(t) {
7
7
  return t.querySelectorAll(`*${r}`).length > 0;
8
8
  }
9
- function _(t) {
9
+ function y(t) {
10
10
  return t.querySelectorAll(`*${s}`).length > 0;
11
11
  }
12
- function C(t, o) {
12
+ function S(t) {
13
13
  const e = t.getDocumentRootCssNode();
14
14
  if (!e)
15
- return !1;
16
- const n = o ?? t.getDocumentModifier();
17
- let l = !1;
18
- return f(e, c) || (n.modifyCss(e).appendRule(m), l = !0), y(e) || (n.modifyCss(e).appendRule(p), l = !0), _(e) || (n.modifyCss(e).appendRule(d), l = !0), l && !o && n.apply(new u("Add mobile layout CSS rules")), l;
15
+ return;
16
+ const o = t.getDocumentModifier();
17
+ let n = !1;
18
+ c(e, p) || (o.modifyCss(e).appendRule(u), n = !0), f(e) || (o.modifyCss(e).appendRule(m), n = !0), y(e) || (o.modifyCss(e).appendRule(d), n = !0), n && o.apply(new a("Add mobile layout CSS rules"));
19
19
  }
20
- function L(t) {
20
+ function C(t) {
21
21
  return "hasClass" in t ? t.hasClass(s) : !1;
22
22
  }
23
- function O(t, o, e) {
24
- e ? t.modifyHtml(o).setClass(s) : t.modifyHtml(o).removeClass(s);
25
- }
26
- function $(t, o, e) {
23
+ function O(t, e, o) {
27
24
  const n = t.getDocumentModifier();
28
- O(n, o, e), n.apply(
29
- new u(
30
- e ? "Opt out of mobile layout" : "Opt in to mobile layout"
25
+ o ? n.modifyHtml(e).setClass(s) : n.modifyHtml(e).removeClass(s), n.apply(
26
+ new a(
27
+ o ? "Opt out of mobile layout" : "Opt in to mobile layout"
31
28
  )
32
29
  );
33
30
  }
34
31
  export {
35
32
  r as CSS_CLASS_DESKTOP_CONTAINER,
36
- a as CSS_CLASS_MOBILE_CONTAINER,
33
+ l as CSS_CLASS_MOBILE_CONTAINER,
37
34
  s as CSS_CLASS_NO_MOBILE_LAYOUT,
38
- C as ensureMobileCssRulesExist,
39
- L as hasMobileLayoutOptOut,
40
- $ as setMobileLayoutOptOut,
41
- O as stageMobileLayoutOptOut
35
+ S as ensureMobileCssRulesExist,
36
+ C as hasMobileLayoutOptOut,
37
+ O as setMobileLayoutOptOut
42
38
  };
@@ -3,7 +3,7 @@ import { CommonControl as u } from "../../../common-control.js";
3
3
  import { RecommendationBlockId as a } from "../../constants/blockIds.js";
4
4
  import { RecommendationControlId as d } from "../../constants/controlIds.js";
5
5
  import { BLOCK_ROOT_SELECTOR as m } from "../../constants/selectors.js";
6
- import { CSS_CLASS_TEXT_TRIM as o, ensureTextTrimCssRulesExist as T } from "../shared/textTrimCssRules.js";
6
+ import { CSS_CLASS_TEXT_TRIM as r, ensureTextTrimCssRulesExist as T } from "../shared/textTrimCssRules.js";
7
7
  const s = {
8
8
  TEXT_TRIM_ENABLED: "textTrimEnabled"
9
9
  };
@@ -37,7 +37,7 @@ class N extends u {
37
37
  _getCurrentTrimState() {
38
38
  if (!this.currentNode || !("hasClass" in this.currentNode))
39
39
  return !1;
40
- if (this.currentNode.hasClass(o))
40
+ if (this.currentNode.hasClass(r))
41
41
  return !0;
42
42
  const e = this.currentNode.closest(m);
43
43
  if (!e)
@@ -45,7 +45,7 @@ class N extends u {
45
45
  const t = e.querySelector(
46
46
  `[esd-extension-block-id="${a.NAME}"]`
47
47
  );
48
- return t && "hasClass" in t ? t.hasClass(o) : !1;
48
+ return t && "hasClass" in t ? t.hasClass(r) : !1;
49
49
  }
50
50
  _onTextTrimChange(e) {
51
51
  if (!this.currentNode || !("closest" in this.currentNode))
@@ -58,10 +58,11 @@ class N extends u {
58
58
  );
59
59
  if (!i.length)
60
60
  return;
61
- const r = this.api.getDocumentModifier();
61
+ e && T(this.api);
62
+ const o = this.api.getDocumentModifier();
62
63
  i.forEach((n) => {
63
- e ? r.modifyHtml(n).setClass(o) : r.modifyHtml(n).removeClass(o);
64
- }), e && T(this.api, r), r.apply(
64
+ e ? o.modifyHtml(n).setClass(r) : o.modifyHtml(n).removeClass(r);
65
+ }), o.apply(
65
66
  new l(
66
67
  e ? "Enable product name text trimming" : "Disable product name text trimming"
67
68
  )
@@ -1,14 +1,14 @@
1
- import { ModificationDescription as l } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
2
- const t = "text-trim-enabled", c = `.${t}`, S = `.${t} p`, T = `.${t} { max-width: 0; }`, d = `.${t} p { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin: 0; display: block; }`;
3
- function R(n, r) {
1
+ import { ModificationDescription as r } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
2
+ const t = "text-trim-enabled", l = `.${t}`, c = `.${t} p`, S = `.${t} { max-width: 0; }`, T = `.${t} p { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin: 0; display: block; }`;
3
+ function f(n) {
4
4
  const e = n.getDocumentRootCssNode();
5
5
  if (!e)
6
- return !1;
7
- const s = r ?? n.getDocumentModifier();
8
- let o = !1;
9
- return e.querySelector(c) || (s.modifyCss(e).appendRule(T), o = !0), e.querySelectorAll(`*${t}`).some((i) => "getSelector" in i && typeof i.getSelector == "function" && i.getSelector() === S) || (s.modifyCss(e).appendRule(d), o = !0), o && !r && s.apply(new l("Add text trim CSS rules")), o;
6
+ return;
7
+ const o = n.getDocumentModifier();
8
+ let i = !1;
9
+ e.querySelector(l) || (o.modifyCss(e).appendRule(S), i = !0), e.querySelectorAll(`*${t}`).some((s) => "getSelector" in s && typeof s.getSelector == "function" && s.getSelector() === c) || (o.modifyCss(e).appendRule(T), i = !0), i && o.apply(new r("Add text trim CSS rules"));
10
10
  }
11
11
  export {
12
12
  t as CSS_CLASS_TEXT_TRIM,
13
- R as ensureTextTrimCssRulesExist
13
+ f as ensureTextTrimCssRulesExist
14
14
  };
@@ -1,16 +1,16 @@
1
- var M = Object.defineProperty;
2
- var P = (s, r, t) => r in s ? M(s, r, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[r] = t;
3
- var l = (s, r, t) => P(s, typeof r != "symbol" ? r + "" : r, t);
4
- import { ModificationDescription as _ } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
1
+ var y = Object.defineProperty;
2
+ var M = (u, s, t) => s in u ? y(u, s, { enumerable: !0, configurable: !0, writable: !0, value: t }) : u[s] = t;
3
+ var g = (u, s, t) => M(u, typeof s != "symbol" ? s + "" : s, t);
4
+ import { ModificationDescription as S } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
5
5
  import { CommonControl as E } from "../../../common-control.js";
6
- import { DESKTOP_CONTAINER_SELECTOR as S, MOBILE_CONTAINER_SELECTOR as I } from "../../constants/selectors.js";
7
- import { SPACING_STEP as G, MAX_SPACING as R, MIN_SPACING as y, DEFAULT_COLUMN_SPACING as p, DEFAULT_ROW_SPACING as f } from "../../constants/layout.js";
8
- import { RecommendationConfigService as u } from "../../services/configService.js";
6
+ import { DESKTOP_CONTAINER_SELECTOR as m, MOBILE_CONTAINER_SELECTOR as L } from "../../constants/selectors.js";
7
+ import { SPACING_STEP as P, MAX_SPACING as G, MIN_SPACING as R, DEFAULT_COLUMN_SPACING as C, DEFAULT_ROW_SPACING as I } from "../../constants/layout.js";
8
+ import { RecommendationConfigService as p } from "../../services/configService.js";
9
9
  import { useRecommendationExtensionStore as w } from "../../store/recommendation.js";
10
- import { safeGetStyle as O, safeGetParent as B } from "../../utils/tagName.js";
11
- import { getCurrentLayout as b, getBlockElement as U } from "../main/utils.js";
10
+ import { safeGetStyle as f, safeGetParent as B } from "../../utils/tagName.js";
11
+ import { getCurrentLayout as _, getBlockElement as U } from "../main/utils.js";
12
12
  import { useDebounceFn as N } from "../../../../../node_modules/@vueuse/shared/index.js";
13
- const V = "recommendation-spacing-control", e = {
13
+ const V = "recommendation-spacing-control", o = {
14
14
  COLUMN_SPACING: "columnSpacing",
15
15
  COLUMN_SPACING_LABEL: "columnSpacingLabel",
16
16
  ROW_SPACING: "rowSpacing",
@@ -19,46 +19,46 @@ const V = "recommendation-spacing-control", e = {
19
19
  MOBILE_COLUMN_SPACING_LABEL: "mobileColumnSpacingLabel",
20
20
  MOBILE_ROW_SPACING: "mobileRowSpacing",
21
21
  MOBILE_ROW_SPACING_LABEL: "mobileRowSpacingLabel"
22
- }, m = {
22
+ }, b = {
23
23
  COLUMN_SPACING: "data-column-spacing",
24
24
  ROW_SPACING: "data-row-spacing",
25
25
  MOBILE_COLUMN_SPACING: "data-mobile-column-spacing",
26
26
  MOBILE_ROW_SPACING: "data-mobile-row-spacing"
27
27
  };
28
- function L(s, r) {
29
- if (!s)
30
- return r;
31
- const t = parseFloat(s);
32
- return Number.isNaN(t) ? r : t;
28
+ function O(u, s) {
29
+ if (!u)
30
+ return s;
31
+ const t = parseFloat(u);
32
+ return Number.isNaN(t) ? s : t;
33
33
  }
34
- class k extends E {
34
+ class j extends E {
35
35
  constructor() {
36
36
  super(...arguments);
37
- l(this, "store", w());
38
- l(this, "unsubscribeOrientation", null);
37
+ g(this, "store", w());
38
+ g(this, "unsubscribeOrientation", null);
39
39
  /**
40
40
  * Debounced version of _onColumnSpacingChange
41
41
  * Prevents excessive DOM updates when user rapidly adjusts the counter
42
42
  */
43
- l(this, "_debouncedOnColumnSpacingChange", N((t) => {
43
+ g(this, "_debouncedOnColumnSpacingChange", N((t) => {
44
44
  this._onColumnSpacingChange(t);
45
45
  }, 300));
46
46
  /**
47
47
  * Debounced version of _onRowSpacingChange
48
48
  */
49
- l(this, "_debouncedOnRowSpacingChange", N((t) => {
49
+ g(this, "_debouncedOnRowSpacingChange", N((t) => {
50
50
  this._onRowSpacingChange(t);
51
51
  }, 300));
52
52
  /**
53
53
  * Debounced version of _onMobileColumnSpacingChange
54
54
  */
55
- l(this, "_debouncedOnMobileColumnSpacingChange", N((t) => {
55
+ g(this, "_debouncedOnMobileColumnSpacingChange", N((t) => {
56
56
  this._onMobileColumnSpacingChange(t);
57
57
  }, 300));
58
58
  /**
59
59
  * Debounced version of _onMobileRowSpacingChange
60
60
  */
61
- l(this, "_debouncedOnMobileRowSpacingChange", N((t) => {
61
+ g(this, "_debouncedOnMobileRowSpacingChange", N((t) => {
62
62
  this._onMobileRowSpacingChange(t);
63
63
  }, 300));
64
64
  }
@@ -68,17 +68,17 @@ class k extends E {
68
68
  getTemplate() {
69
69
  return `
70
70
  <div class="spacing-control-container">
71
- ${this._spacingRow("Column Spacing (px)", e.COLUMN_SPACING_LABEL, e.COLUMN_SPACING)}
72
- ${this._spacingRow("Row Spacing (px)", e.ROW_SPACING_LABEL, e.ROW_SPACING)}
71
+ ${this._spacingRow("Column Spacing (px)", o.COLUMN_SPACING_LABEL, o.COLUMN_SPACING)}
72
+ ${this._spacingRow("Row Spacing (px)", o.ROW_SPACING_LABEL, o.ROW_SPACING)}
73
73
  ${this._spacingRow(
74
74
  "Column Spacing on Mobile (px)",
75
- e.MOBILE_COLUMN_SPACING_LABEL,
76
- e.MOBILE_COLUMN_SPACING
75
+ o.MOBILE_COLUMN_SPACING_LABEL,
76
+ o.MOBILE_COLUMN_SPACING
77
77
  )}
78
78
  ${this._spacingRow(
79
79
  "Row Spacing on Mobile (px)",
80
- e.MOBILE_ROW_SPACING_LABEL,
81
- e.MOBILE_ROW_SPACING
80
+ o.MOBILE_ROW_SPACING_LABEL,
81
+ o.MOBILE_ROW_SPACING
82
82
  )}
83
83
  </div>
84
84
  `;
@@ -96,14 +96,14 @@ class k extends E {
96
96
  * One label + counter per two-column row, so every spacing field gets the same
97
97
  * 16px-padded row the color controls already render instead of sharing one grid.
98
98
  */
99
- _spacingRow(t, i, o) {
99
+ _spacingRow(t, e, n) {
100
100
  return this._GuTwoColumns([
101
- this._GuLabel({ text: this.api.translate(t), name: i }),
101
+ this._GuLabel({ text: this.api.translate(t), name: e }),
102
102
  this._GuCounter({
103
- name: o,
104
- minValue: y,
105
- maxValue: R,
106
- step: G
103
+ name: n,
104
+ minValue: R,
105
+ maxValue: G,
106
+ step: P
107
107
  })
108
108
  ]);
109
109
  }
@@ -117,14 +117,14 @@ class k extends E {
117
117
  _updateSpacingVisibility() {
118
118
  if (!this.api)
119
119
  return;
120
- const t = u.getConfig(this.currentNode), i = this.store.recommendationConfigs.orientation, n = (t.layout || i || b(this.currentNode)) === "grid", { mobileLayoutEnabled: a } = t, c = t.cardsInRow > 1, g = t.mobileCardsInRow > 1;
121
- this.api.setVisibility(e.COLUMN_SPACING, n && c), this.api.setVisibility(e.COLUMN_SPACING_LABEL, n && c), this.api.setVisibility(e.ROW_SPACING, !0), this.api.setVisibility(e.ROW_SPACING_LABEL, !0), this.api.setVisibility(
122
- e.MOBILE_COLUMN_SPACING,
123
- n && a && g
120
+ const t = p.getConfig(this.currentNode), e = this.store.recommendationConfigs.orientation, i = (t.layout || e || _(this.currentNode)) === "grid", { mobileLayoutEnabled: a } = t, r = t.cardsInRow > 1, c = t.mobileCardsInRow > 1;
121
+ this.api.setVisibility(o.COLUMN_SPACING, i && r), this.api.setVisibility(o.COLUMN_SPACING_LABEL, i && r), this.api.setVisibility(o.ROW_SPACING, !0), this.api.setVisibility(o.ROW_SPACING_LABEL, !0), this.api.setVisibility(
122
+ o.MOBILE_COLUMN_SPACING,
123
+ i && a && c
124
124
  ), this.api.setVisibility(
125
- e.MOBILE_COLUMN_SPACING_LABEL,
126
- n && a && g
127
- ), this.api.setVisibility(e.MOBILE_ROW_SPACING, n && a), this.api.setVisibility(e.MOBILE_ROW_SPACING_LABEL, n && a);
125
+ o.MOBILE_COLUMN_SPACING_LABEL,
126
+ i && a && c
127
+ ), this.api.setVisibility(o.MOBILE_ROW_SPACING, i && a), this.api.setVisibility(o.MOBILE_ROW_SPACING_LABEL, i && a);
128
128
  }
129
129
  /**
130
130
  * Reads spacing values from node config first, falls back to DOM styles.
@@ -133,12 +133,12 @@ class k extends E {
133
133
  _setFormValues() {
134
134
  if (!this.api)
135
135
  return;
136
- const t = u.hasConfig(this.currentNode), i = u.getConfig(this.currentNode), o = t ? i.columnSpacing : this._getStoredColumnSpacing(), n = t ? i.rowSpacing : this._getStoredRowSpacing();
136
+ const t = p.hasConfig(this.currentNode), e = p.getConfig(this.currentNode), n = t ? e.columnSpacing : this._getStoredColumnSpacing(), i = t ? e.rowSpacing : this._getStoredRowSpacing();
137
137
  this.api.updateValues({
138
- [e.COLUMN_SPACING]: o,
139
- [e.ROW_SPACING]: n,
140
- [e.MOBILE_COLUMN_SPACING]: i.mobileColumnSpacing,
141
- [e.MOBILE_ROW_SPACING]: i.mobileRowSpacing
138
+ [o.COLUMN_SPACING]: n,
139
+ [o.ROW_SPACING]: i,
140
+ [o.MOBILE_COLUMN_SPACING]: e.mobileColumnSpacing,
141
+ [o.MOBILE_ROW_SPACING]: e.mobileRowSpacing
142
142
  });
143
143
  }
144
144
  /**
@@ -150,20 +150,20 @@ class k extends E {
150
150
  */
151
151
  _getStoredColumnSpacing() {
152
152
  if (!this.currentNode)
153
- return p;
154
- const t = this.currentNode.querySelector(S) ?? this.currentNode;
155
- if (b(this.currentNode) === "grid") {
156
- const d = t.querySelector(".recommendation-attribute-row"), C = (d == null ? void 0 : d.querySelector("td")) ?? null, h = O(C, "padding");
157
- if (!h)
158
- return p;
159
- const A = h.trim().split(/\s+/);
160
- return A.length < 2 ? p : L(A[1], p / 2) * 2;
153
+ return C;
154
+ const t = this.currentNode.querySelector(m) ?? this.currentNode;
155
+ if (_(this.currentNode) === "grid") {
156
+ const h = t.querySelector(".recommendation-attribute-row"), l = (h == null ? void 0 : h.querySelector("td")) ?? null, d = f(l, "padding");
157
+ if (!d)
158
+ return C;
159
+ const A = d.trim().split(/\s+/);
160
+ return A.length < 2 ? C : O(A[1], C / 2) * 2;
161
161
  }
162
- const o = t.querySelector(".product-card-wrapper") ?? null, n = B(o), a = O(n, "padding");
162
+ const n = t.querySelector(".product-card-wrapper") ?? null, i = B(n), a = f(i, "padding");
163
163
  if (!a)
164
- return p;
165
- const c = a.trim().split(/\s+/);
166
- return c.length < 2 ? p : L(c[1], p / 2) * 2;
164
+ return C;
165
+ const r = a.trim().split(/\s+/);
166
+ return r.length < 2 ? C : O(r[1], C / 2) * 2;
167
167
  }
168
168
  /**
169
169
  * Gets stored row spacing from the first spacer element's height style
@@ -171,9 +171,9 @@ class k extends E {
171
171
  */
172
172
  _getStoredRowSpacing() {
173
173
  if (!this.currentNode)
174
- return f;
175
- const i = (this.currentNode.querySelector(S) ?? this.currentNode).querySelector(".spacer") ?? null, o = O(i, "height");
176
- return L(o, f);
174
+ return I;
175
+ const e = (this.currentNode.querySelector(m) ?? this.currentNode).querySelector(".spacer") ?? null, n = f(e, "height");
176
+ return O(n, I);
177
177
  }
178
178
  // ========================================================================
179
179
  // Desktop Spacing Handlers
@@ -185,8 +185,23 @@ class k extends E {
185
185
  _onColumnSpacingChange(t) {
186
186
  if (!this.currentNode)
187
187
  return;
188
- const i = this.api.getDocumentModifier();
189
- u.stageConfig(i, this.currentNode, { columnSpacing: t }), this._stageDataAttribute(i, m.COLUMN_SPACING, t), this._stageColumnPadding(i, S, t), i.apply(new _(`Changed column spacing to ${t}px`));
188
+ p.updateConfig(
189
+ this.api,
190
+ this.currentNode,
191
+ { columnSpacing: t },
192
+ `Changed column spacing to ${t}px`
193
+ ), this._storeDataAttribute(b.COLUMN_SPACING, t);
194
+ const n = p.getConfig(this.currentNode).layout || _(this.currentNode), i = this.api.getDocumentModifier(), r = `0 ${t / 2}px`, c = this.currentNode.querySelector(m);
195
+ c && (n === "grid" ? Array.from(
196
+ c.querySelectorAll(".attribute-cell")
197
+ ).forEach((l) => {
198
+ i.modifyHtml(l).setStyle("padding", r);
199
+ }) : Array.from(
200
+ c.querySelectorAll(".product-card-wrapper")
201
+ ).forEach((l) => {
202
+ const d = "parent" in l ? l.parent() : void 0;
203
+ d && i.modifyHtml(d).setStyle("padding", r);
204
+ }), i.apply(new S(`Update column spacing to ${t}px`)));
190
205
  }
191
206
  /**
192
207
  * Handles row spacing changes for desktop.
@@ -195,8 +210,24 @@ class k extends E {
195
210
  _onRowSpacingChange(t) {
196
211
  if (!this.currentNode)
197
212
  return;
198
- const i = this.api.getDocumentModifier();
199
- u.stageConfig(i, this.currentNode, { rowSpacing: t }), this._stageDataAttribute(i, m.ROW_SPACING, t), this._stageSpacerHeight(i, S, t), i.apply(new _(`Changed row spacing to ${t}px`));
213
+ p.updateConfig(
214
+ this.api,
215
+ this.currentNode,
216
+ { rowSpacing: t },
217
+ `Changed row spacing to ${t}px`
218
+ ), this._storeDataAttribute(b.ROW_SPACING, t);
219
+ const e = this.currentNode.querySelector(m);
220
+ if (!e)
221
+ return;
222
+ const n = Array.from(
223
+ e.querySelectorAll(".spacer")
224
+ );
225
+ if (!n.length)
226
+ return;
227
+ const i = this.api.getDocumentModifier(), a = `${t}px`;
228
+ n.forEach((r) => {
229
+ i.modifyHtml(r).setStyle("height", a);
230
+ }), i.apply(new S(`Update row spacing to ${t}px`));
200
231
  }
201
232
  // ========================================================================
202
233
  // Mobile Spacing Handlers
@@ -208,8 +239,23 @@ class k extends E {
208
239
  _onMobileColumnSpacingChange(t) {
209
240
  if (!this.currentNode)
210
241
  return;
211
- const i = this.api.getDocumentModifier();
212
- u.stageConfig(i, this.currentNode, { mobileColumnSpacing: t }), this._stageDataAttribute(i, m.MOBILE_COLUMN_SPACING, t), this._stageColumnPadding(i, I, t), i.apply(new _(`Changed mobile column spacing to ${t}px`));
242
+ p.updateConfig(
243
+ this.api,
244
+ this.currentNode,
245
+ { mobileColumnSpacing: t },
246
+ `Changed mobile column spacing to ${t}px`
247
+ ), this._storeDataAttribute(b.MOBILE_COLUMN_SPACING, t);
248
+ const n = p.getConfig(this.currentNode).layout || _(this.currentNode), i = this.api.getDocumentModifier(), r = `0 ${t / 2}px`, c = this.currentNode.querySelector(L);
249
+ c && (n === "grid" ? Array.from(
250
+ c.querySelectorAll(".attribute-cell")
251
+ ).forEach((l) => {
252
+ i.modifyHtml(l).setStyle("padding", r);
253
+ }) : Array.from(
254
+ c.querySelectorAll(".product-card-wrapper")
255
+ ).forEach((l) => {
256
+ const d = "parent" in l ? l.parent() : void 0;
257
+ d && i.modifyHtml(d).setStyle("padding", r);
258
+ }), i.apply(new S(`Update mobile column spacing to ${t}px`)));
213
259
  }
214
260
  /**
215
261
  * Handles row spacing changes for mobile.
@@ -218,59 +264,51 @@ class k extends E {
218
264
  _onMobileRowSpacingChange(t) {
219
265
  if (!this.currentNode)
220
266
  return;
221
- const i = this.api.getDocumentModifier();
222
- u.stageConfig(i, this.currentNode, { mobileRowSpacing: t }), this._stageDataAttribute(i, m.MOBILE_ROW_SPACING, t), this._stageSpacerHeight(i, I, t), i.apply(new _(`Changed mobile row spacing to ${t}px`));
223
- }
224
- // ========================================================================
225
- // Staging helpers (the handlers apply once)
226
- // ========================================================================
227
- /** Horizontal padding on every card cell inside the container the selector finds. */
228
- _stageColumnPadding(t, i, o) {
229
- var d;
230
- const n = (d = this.currentNode) == null ? void 0 : d.querySelector(i);
231
- if (!this.currentNode || !n)
267
+ p.updateConfig(
268
+ this.api,
269
+ this.currentNode,
270
+ { mobileRowSpacing: t },
271
+ `Changed mobile row spacing to ${t}px`
272
+ ), this._storeDataAttribute(b.MOBILE_ROW_SPACING, t);
273
+ const e = this.currentNode.querySelector(L);
274
+ if (!e)
232
275
  return;
233
- const c = u.getConfig(this.currentNode).layout || b(this.currentNode), g = `0 ${o / 2}px`;
234
- if (c === "grid") {
235
- Array.from(n.querySelectorAll(".attribute-cell")).forEach((C) => {
236
- t.modifyHtml(C).setStyle("padding", g);
237
- });
276
+ const n = Array.from(
277
+ e.querySelectorAll(".spacer")
278
+ );
279
+ if (!n.length)
238
280
  return;
239
- }
240
- Array.from(n.querySelectorAll(".product-card-wrapper")).forEach((C) => {
241
- const h = "parent" in C ? C.parent() : void 0;
242
- h && t.modifyHtml(h).setStyle("padding", g);
243
- });
281
+ const i = this.api.getDocumentModifier(), a = `${t}px`;
282
+ n.forEach((r) => {
283
+ i.modifyHtml(r).setStyle("height", a);
284
+ }), i.apply(new S(`Update mobile row spacing to ${t}px`));
244
285
  }
245
- /** Height on every spacer row inside the container the selector finds. */
246
- _stageSpacerHeight(t, i, o) {
247
- var a;
248
- const n = (a = this.currentNode) == null ? void 0 : a.querySelector(i);
249
- n && Array.from(n.querySelectorAll(".spacer")).forEach((c) => {
250
- t.modifyHtml(c).setStyle("height", `${o}px`);
251
- });
252
- }
253
- /** Mirrors a spacing value onto the block root as a data attribute (regeneration reads it back). */
254
- _stageDataAttribute(t, i, o) {
286
+ // ========================================================================
287
+ // Data Attribute Storage
288
+ // ========================================================================
289
+ /**
290
+ * Stores a spacing value as a data attribute on the block root element
291
+ */
292
+ _storeDataAttribute(t, e) {
255
293
  const n = U(this.currentNode);
256
- n && t.modifyHtml(n).setAttribute(i, o.toString());
294
+ n && this.api.getDocumentModifier().modifyHtml(n).setAttribute(t, e.toString()).apply(new S(`Store ${t}`));
257
295
  }
258
296
  // ========================================================================
259
297
  // Event Listeners
260
298
  // ========================================================================
261
299
  _listenToFormUpdates() {
262
- this.api.onValueChanged(e.COLUMN_SPACING, (t) => {
263
- const i = parseInt(t);
264
- Number.isNaN(i) || this._debouncedOnColumnSpacingChange(i);
265
- }), this.api.onValueChanged(e.ROW_SPACING, (t) => {
266
- const i = parseInt(t);
267
- Number.isNaN(i) || this._debouncedOnRowSpacingChange(i);
268
- }), this.api.onValueChanged(e.MOBILE_COLUMN_SPACING, (t) => {
269
- const i = parseInt(t);
270
- Number.isNaN(i) || this._debouncedOnMobileColumnSpacingChange(i);
271
- }), this.api.onValueChanged(e.MOBILE_ROW_SPACING, (t) => {
272
- const i = parseInt(t);
273
- Number.isNaN(i) || this._debouncedOnMobileRowSpacingChange(i);
300
+ this.api.onValueChanged(o.COLUMN_SPACING, (t) => {
301
+ const e = parseInt(t);
302
+ Number.isNaN(e) || this._debouncedOnColumnSpacingChange(e);
303
+ }), this.api.onValueChanged(o.ROW_SPACING, (t) => {
304
+ const e = parseInt(t);
305
+ Number.isNaN(e) || this._debouncedOnRowSpacingChange(e);
306
+ }), this.api.onValueChanged(o.MOBILE_COLUMN_SPACING, (t) => {
307
+ const e = parseInt(t);
308
+ Number.isNaN(e) || this._debouncedOnMobileColumnSpacingChange(e);
309
+ }), this.api.onValueChanged(o.MOBILE_ROW_SPACING, (t) => {
310
+ const e = parseInt(t);
311
+ Number.isNaN(e) || this._debouncedOnMobileRowSpacingChange(e);
274
312
  });
275
313
  }
276
314
  /**
@@ -285,5 +323,5 @@ class k extends E {
285
323
  }
286
324
  export {
287
325
  V as SPACING_CONTROL_ID,
288
- k as SpacingControl
326
+ j as SpacingControl
289
327
  };