@useinsider/guido 3.20.1 → 3.21.0-beta.0df5409

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 (90) hide show
  1. package/dist/components/Guido.vue.js +1 -1
  2. package/dist/components/Guido.vue2.js +65 -64
  3. package/dist/components/organisms/AutoSaveController.vue2.js +10 -9
  4. package/dist/components/organisms/header/EditorActions.vue.js +4 -4
  5. package/dist/components/organisms/header/EditorActions.vue2.js +53 -51
  6. package/dist/components/organisms/validation/ValidationErrorDrawer.vue.js +3 -3
  7. package/dist/components/organisms/validation/ValidationErrorDrawer.vue2.js +23 -22
  8. package/dist/composables/useActionsApi.js +80 -63
  9. package/dist/composables/useAutoSave.js +46 -44
  10. package/dist/composables/useGuidoStateBridge.js +3 -3
  11. package/dist/composables/useLegacyStrategyConversion.js +16 -16
  12. package/dist/composables/useSave.js +26 -23
  13. package/dist/composables/useSaveValidation.js +113 -114
  14. package/dist/composables/useSaveValidationRollout.js +17 -6
  15. package/dist/composables/useStripo.js +11 -10
  16. package/dist/extensions/Blocks/Items/block.js +43 -42
  17. package/dist/extensions/Blocks/Recommendation/block.js +33 -29
  18. package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +78 -83
  19. package/dist/extensions/Blocks/Recommendation/controls/customAttribute/textTrim.js +1 -2
  20. package/dist/extensions/Blocks/Recommendation/controls/main/algorithm.js +2 -12
  21. package/dist/extensions/Blocks/Recommendation/controls/main/currency.js +104 -86
  22. package/dist/extensions/Blocks/Recommendation/controls/main/index.js +348 -263
  23. package/dist/extensions/Blocks/Recommendation/controls/main/layoutOrientation.js +48 -50
  24. package/dist/extensions/Blocks/Recommendation/controls/main/locale.js +16 -21
  25. package/dist/extensions/Blocks/Recommendation/controls/main/pricePlacement.js +44 -40
  26. package/dist/extensions/Blocks/Recommendation/controls/main/productCount.js +14 -19
  27. package/dist/extensions/Blocks/Recommendation/controls/main/productLayout.js +104 -102
  28. package/dist/extensions/Blocks/Recommendation/controls/main/shuffle.js +18 -23
  29. package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +312 -286
  30. package/dist/extensions/Blocks/Recommendation/controls/mobileLayout/cssRules.js +24 -20
  31. package/dist/extensions/Blocks/Recommendation/controls/name/textTrim.js +6 -7
  32. package/dist/extensions/Blocks/Recommendation/controls/shared/textTrimCssRules.js +8 -8
  33. package/dist/extensions/Blocks/Recommendation/controls/spacing/index.js +113 -151
  34. package/dist/extensions/Blocks/Recommendation/store/recommendation.js +221 -203
  35. package/dist/extensions/Blocks/Recommendation/utils/blockRefresh.js +28 -0
  36. package/dist/extensions/Blocks/Recommendation/utils/captureStyleTemplates.js +1 -1
  37. package/dist/extensions/Blocks/Recommendation/utils/currencySettings.js +25 -0
  38. package/dist/extensions/Blocks/Recommendation/utils/nodeConfigWriter.js +111 -40
  39. package/dist/extensions/Blocks/Recommendation/utils/strategyCommit.js +31 -35
  40. package/dist/extensions/Blocks/Unsubscribe/block.js +70 -75
  41. package/dist/guido.css +1 -1
  42. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js +271 -192
  43. package/dist/package.json.js +1 -1
  44. package/dist/services/settingsApi.js +11 -0
  45. package/dist/src/components/Guido.vue.d.ts +1 -1
  46. package/dist/src/components/organisms/header/EditorActions.vue.d.ts +1 -1
  47. package/dist/src/components/organisms/header/HeaderWrapper.vue.d.ts +1 -1
  48. package/dist/src/components/organisms/header/RightSlot.vue.d.ts +1 -1
  49. package/dist/src/composables/useActionsApi.d.ts +5 -1
  50. package/dist/src/composables/useAutoSave.d.ts +4 -1
  51. package/dist/src/composables/useSaveValidationRollout.d.ts +1 -0
  52. package/dist/src/extensions/Blocks/Checkbox/controls/blockBackground/index.d.ts +1 -0
  53. package/dist/src/extensions/Blocks/CouponBlock/controls/index.d.ts +8 -0
  54. package/dist/src/extensions/Blocks/Items/controls/index.d.ts +40 -0
  55. package/dist/src/extensions/Blocks/RadioButton/controls/blockBackground/index.d.ts +1 -0
  56. package/dist/src/extensions/Blocks/Recommendation/block.d.ts +1 -0
  57. package/dist/src/extensions/Blocks/Recommendation/controls/blockBackground/index.d.ts +1 -0
  58. package/dist/src/extensions/Blocks/Recommendation/controls/button/index.d.ts +11 -0
  59. package/dist/src/extensions/Blocks/Recommendation/controls/cardComposition/index.d.ts +3 -6
  60. package/dist/src/extensions/Blocks/Recommendation/controls/customAttribute/index.d.ts +7 -0
  61. package/dist/src/extensions/Blocks/Recommendation/controls/image/index.d.ts +2 -0
  62. package/dist/src/extensions/Blocks/Recommendation/controls/main/currency.d.ts +5 -5
  63. package/dist/src/extensions/Blocks/Recommendation/controls/main/index.d.ts +21 -12
  64. package/dist/src/extensions/Blocks/Recommendation/controls/main/layoutOrientation.d.ts +6 -3
  65. package/dist/src/extensions/Blocks/Recommendation/controls/main/pricePlacement.d.ts +6 -5
  66. package/dist/src/extensions/Blocks/Recommendation/controls/main/productLayout.d.ts +6 -3
  67. package/dist/src/extensions/Blocks/Recommendation/controls/main/utils.d.ts +21 -9
  68. package/dist/src/extensions/Blocks/Recommendation/controls/mobileLayout/cssRules.d.ts +19 -13
  69. package/dist/src/extensions/Blocks/Recommendation/controls/name/index.d.ts +7 -0
  70. package/dist/src/extensions/Blocks/Recommendation/controls/oldPrice/index.d.ts +7 -0
  71. package/dist/src/extensions/Blocks/Recommendation/controls/omnibusDiscount/index.d.ts +7 -0
  72. package/dist/src/extensions/Blocks/Recommendation/controls/omnibusPrice/index.d.ts +7 -0
  73. package/dist/src/extensions/Blocks/Recommendation/controls/price/index.d.ts +7 -0
  74. package/dist/src/extensions/Blocks/Recommendation/controls/shared/textTrimCssRules.d.ts +10 -8
  75. package/dist/src/extensions/Blocks/Recommendation/controls/spacing/index.d.ts +9 -5
  76. package/dist/src/extensions/Blocks/Recommendation/controls/title/index.d.ts +7 -0
  77. package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +9 -1
  78. package/dist/src/extensions/Blocks/Recommendation/utils/blockRefresh.d.ts +17 -0
  79. package/dist/src/extensions/Blocks/Recommendation/utils/currencySettings.d.ts +6 -0
  80. package/dist/src/extensions/Blocks/Recommendation/utils/nodeConfigWriter.d.ts +18 -11
  81. package/dist/src/extensions/Blocks/Unsubscribe/block.d.ts +1 -6
  82. package/dist/src/extensions/Blocks/_Boilerplate/controls/blockBackground/index.d.ts +1 -0
  83. package/dist/src/extensions/Blocks/controlFactories.d.ts +22 -0
  84. package/dist/src/services/settingsApi.d.ts +6 -0
  85. package/dist/src/stores/editor.d.ts +3 -1
  86. package/dist/src/stores/setup-settings.d.ts +4 -0
  87. package/dist/static/styles/components/button.css.js +5 -0
  88. package/dist/stores/editor.js +5 -0
  89. package/dist/stores/setup-settings.js +10 -0
  90. package/package.json +4 -4
@@ -1,455 +1,481 @@
1
- import { ModificationDescription as C } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
1
+ import { ModificationDescription as A } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
2
2
  import { RecommendationBlockId as m } from "../../constants/blockIds.js";
3
- import { CURRENCY_ATTR as b, CSS_CLASS_SKIP_COMPILE as W, MOBILE_CONTAINER_SELECTOR as L, ATTR_DATA_CARD_COMPOSITION as q, DESKTOP_CONTAINER_SELECTOR as w, CONTAINER_SELECTOR as Y, MOBILE_ROW_SELECTOR as k, ATTR_DATA_CUSTOM_ATTRIBUTES as h, ATTR_PRODUCT_ATTR as z, PRODUCT_ATTRIBUTE_PREFIX as M } from "../../constants/selectors.js";
4
- import { RecommendationConfigService as g } from "../../services/configService.js";
5
- import { useRecommendationExtensionStore as E } from "../../store/recommendation.js";
3
+ import { CURRENCY_ATTR as p, CSS_CLASS_SKIP_COMPILE as W, MOBILE_CONTAINER_SELECTOR as k, ATTR_DATA_CARD_COMPOSITION as O, DESKTOP_CONTAINER_SELECTOR as w, CONTAINER_SELECTOR as z, MOBILE_ROW_SELECTOR as D, ATTR_DATA_CUSTOM_ATTRIBUTES as q, ATTR_PRODUCT_ATTR as J, PRODUCT_ATTRIBUTE_PREFIX as M } from "../../constants/selectors.js";
4
+ import { RecommendationConfigService as h } from "../../services/configService.js";
5
+ import { useRecommendationExtensionStore as C } from "../../store/recommendation.js";
6
6
  import { prepareProductRows as x } from "../../templates/index.js";
7
- import { captureStyles as D } from "../../utils/captureStyleTemplates.js";
8
- import { normalizeCompositionKeys as H, normalizeCustomAttrValues as J } from "../../utils/compositionKeys.js";
9
- import { formatPrice as X } from "../../utils/priceFormatter.js";
10
- import { getDefaultProducts as U, DEFAULT_CARD_COMPOSITION as I, sanitizeImageUrl as Q, isSamePrice as Z, toDisplayableAttributeValue as ee } from "../../templates/utils.js";
11
- const O = "recommendation-block-v2";
12
- function P(t) {
13
- if (!t)
7
+ import { captureStyles as U } from "../../utils/captureStyleTemplates.js";
8
+ import { normalizeCompositionKeys as H, normalizeCustomAttrValues as X } from "../../utils/compositionKeys.js";
9
+ import { formatPrice as Q } from "../../utils/priceFormatter.js";
10
+ import { getDefaultProducts as B, DEFAULT_CARD_COMPOSITION as I, sanitizeImageUrl as Z, isSamePrice as tt, toDisplayableAttributeValue as et } from "../../templates/utils.js";
11
+ const N = "recommendation-block-v2";
12
+ function y(e) {
13
+ if (!e)
14
14
  return null;
15
- if ("getAttribute" in t) {
16
- const e = t.getAttribute("class");
17
- if (e && e.includes(O))
18
- return t;
15
+ if ("getAttribute" in e) {
16
+ const t = e.getAttribute("class");
17
+ if (t && t.includes(N))
18
+ return e;
19
19
  }
20
- return "querySelector" in t ? t.querySelector(`.${O}`) ?? null : null;
20
+ return "querySelector" in e ? e.querySelector(`.${N}`) ?? null : null;
21
21
  }
22
- function te(t) {
23
- const e = P(t);
24
- return !e || !("getAttribute" in e) ? !1 : (e.getAttribute("class") ?? "").split(/\s+/).includes(W);
22
+ function nt(e) {
23
+ const t = y(e);
24
+ return !t || !("getAttribute" in t) ? !1 : (t.getAttribute("class") ?? "").split(/\s+/).includes(W);
25
25
  }
26
- function T(t) {
27
- const e = P(t);
28
- if (!e || !("getAttribute" in e))
26
+ function T(e) {
27
+ const t = y(e);
28
+ if (!t || !("getAttribute" in t))
29
29
  return "grid";
30
- const n = e.getAttribute("data-layout");
30
+ const n = t.getAttribute("data-layout");
31
31
  return n === "list" || n === "horizontal" ? "list" : "grid";
32
32
  }
33
- function B(t, e = {}) {
34
- const n = P(t);
33
+ function v(e, t = {}) {
34
+ const n = y(e);
35
35
  if (!n || !("getAttribute" in n))
36
36
  return I;
37
- const o = n.getAttribute(q);
37
+ const o = n.getAttribute(O);
38
38
  return o ? H(
39
39
  o.split(",").filter(Boolean),
40
40
  n,
41
- e
41
+ t
42
42
  ) : I;
43
43
  }
44
- function $(t) {
45
- if (!t || !("childNodes" in t))
44
+ function P(e, t) {
45
+ const n = h.getConfig(e);
46
+ return t ? { ...n, ...t } : n;
47
+ }
48
+ function $(e) {
49
+ if (!e || !("childNodes" in e))
46
50
  return null;
47
- const e = t.childNodes(), n = e.find(
51
+ const t = e.childNodes(), n = t.find(
48
52
  (o) => "getType" in o && o.getType() === "text"
49
53
  );
50
- return n || e.reduce((o, r) => o || !("getType" in r) || r.getType() === "text" ? o : $(r), null);
54
+ return n || t.reduce((o, r) => o || !("getType" in r) || r.getType() === "text" ? o : $(r), null);
51
55
  }
52
- function S(t, e, n) {
53
- const o = $(e);
54
- return !o || "getTextContent" in o && o.getTextContent() === n ? !1 : (t.modifyHtml(o).setText(n), !0);
56
+ function b(e, t, n) {
57
+ const o = $(t);
58
+ return !o || "getTextContent" in o && o.getTextContent() === n ? !1 : (e.modifyHtml(o).setText(n), !0);
55
59
  }
56
- function A(t, e, n, o) {
57
- return "getAttribute" in e && e.getAttribute(n) === o ? !1 : (t.modifyHtml(e).setAttribute(n, o), !0);
60
+ function S(e, t, n, o) {
61
+ return "getAttribute" in t && t.getAttribute(n) === o ? !1 : (e.modifyHtml(t).setAttribute(n, o), !0);
58
62
  }
59
- function v(t, e) {
60
- return t && t.length > 0 ? t : e.length > 0 ? e : U();
63
+ function j(e, t) {
64
+ return e && e.length > 0 ? e : t.length > 0 ? t : B();
61
65
  }
62
- function j(t) {
63
- if (typeof t == "number")
64
- return `0 ${t / 2}px`;
66
+ function F(e) {
67
+ if (typeof e == "number")
68
+ return `0 ${e / 2}px`;
65
69
  }
66
- function ne(t) {
67
- const { currentNode: e, documentModifier: n } = t;
68
- if (!e || !("querySelector" in e))
70
+ function ot(e) {
71
+ const { currentNode: t, documentModifier: n } = e;
72
+ if (!t || !("querySelector" in t))
69
73
  return !1;
70
- const o = e.querySelector(k);
74
+ const o = t.querySelector(D);
71
75
  return o ? (n.modifyHtml(o).setInnerHtml(""), !0) : !1;
72
76
  }
73
- function oe(t) {
74
- return "getOuterHTML" in t && typeof t.getOuterHTML == "function" ? t.getOuterHTML() : "";
77
+ function rt(e) {
78
+ return "getOuterHTML" in e && typeof e.getOuterHTML == "function" ? e.getOuterHTML() : "";
75
79
  }
76
- function re(t) {
77
- const e = t.querySelector(".container");
78
- return !e || !("childNodes" in e) ? null : e.childNodes().find((o) => "getTagName" in o && o.getTagName() === "tbody") ?? e.querySelector("tbody") ?? null;
80
+ function it(e) {
81
+ const t = e.querySelector(".container");
82
+ return !t || !("childNodes" in t) ? null : t.childNodes().find((o) => "getTagName" in o && o.getTagName() === "tbody") ?? t.querySelector("tbody") ?? null;
79
83
  }
80
- function ie(t, e, n) {
81
- const o = re(t);
84
+ function lt(e, t, n) {
85
+ const o = it(e);
82
86
  if (!o || !("childNodes" in o))
83
87
  return;
84
- const r = o.childNodes().map(oe).join(""), s = `<tr class="ins-recommendation-mobile-row">${n}</tr>`;
85
- e.modifyHtml(o).setInnerHtml(r + s), e.apply(new C("Added mobile product row"));
88
+ const r = o.childNodes().map(rt).join(""), u = `<tr class="ins-recommendation-mobile-row">${n}</tr>`;
89
+ t.modifyHtml(o).setInnerHtml(r + u), t.apply(new A("Added mobile product row"));
86
90
  }
87
- function F(t, e = {}) {
91
+ function Y(e, t = {}) {
88
92
  const {
89
93
  currentNode: n,
90
94
  documentModifier: o,
91
95
  products: r,
92
- layout: s,
93
- composition: l
94
- } = t;
96
+ layout: u,
97
+ composition: s
98
+ } = e;
95
99
  if (!n || !("querySelector" in n))
96
100
  return !1;
97
- const u = s ?? T(n), i = g.getConfig(n);
98
- if (u === "list" || !i.mobileLayoutEnabled)
99
- return ne({ currentNode: n, documentModifier: o });
100
- const c = E(), a = v(r, c.recommendationProducts), f = l ?? B(n, c.filterList), p = `<td><table class="ins-recommendation-product-container ins-recommendation-mobile-container" width="100%" cellpadding="0" cellspacing="0" border="0">${x(a, u, {
101
- productsPerRow: i.mobileCardsInRow,
101
+ const i = u ?? T(n), c = P(n, e.configOverrides);
102
+ if (i === "list" || !c.mobileLayoutEnabled)
103
+ return ot({ currentNode: n, documentModifier: o });
104
+ const l = C(), d = j(r, l.recommendationProducts), f = s ?? v(n, l.filterList), g = `<td><table class="ins-recommendation-product-container ins-recommendation-mobile-container" width="100%" cellpadding="0" cellspacing="0" border="0">${x(d, i, {
105
+ productsPerRow: c.mobileCardsInRow,
102
106
  composition: f,
103
- filterList: c.filterList,
104
- priceInline: !i.priceMovedToNextLine,
107
+ filterList: l.filterList,
108
+ priceInline: !c.priceMovedToNextLine,
105
109
  // Match the initial render's gutter so a regeneration never changes block height (SD-143023, #386).
106
- cellPadding: j(i.mobileColumnSpacing),
107
- rowSpacingPx: i.mobileRowSpacing,
108
- ...e
109
- })}</table></td>`, y = n.querySelector(k);
110
- return y ? (o.modifyHtml(y).setInnerHtml(p), !0) : (ie(n, o, p), !1);
110
+ cellPadding: F(c.mobileColumnSpacing),
111
+ rowSpacingPx: c.mobileRowSpacing,
112
+ ...t
113
+ })}</table></td>`, E = n.querySelector(D);
114
+ return E ? (o.modifyHtml(E).setInnerHtml(g), !0) : (lt(n, o, g), !1);
111
115
  }
112
- function Te(t) {
113
- F(t, D(t.currentNode)) && t.documentModifier.apply(new C("Updated mobile product rows"));
116
+ function Rt(e) {
117
+ const t = Y(e, U(e.currentNode));
118
+ return t && !e.stageOnly && e.documentModifier.apply(new A("Updated mobile product rows")), t;
114
119
  }
115
- function le(t, e = {}) {
120
+ function ct(e, t = {}) {
116
121
  const {
117
122
  currentNode: n,
118
123
  documentModifier: o,
119
124
  products: r,
120
- layout: s,
121
- composition: l
122
- } = t;
125
+ layout: u,
126
+ composition: s
127
+ } = e;
123
128
  if (!n || !("querySelector" in n))
124
129
  return !1;
125
- const u = n.querySelector(w) ?? n.querySelector(Y);
126
- if (!u)
130
+ const i = n.querySelector(w) ?? n.querySelector(z);
131
+ if (!i)
127
132
  return !1;
128
- const i = E(), c = v(r, i.recommendationProducts), { cardsInRow: a } = g.getConfig(n), f = l ?? B(n, i.filterList), d = s ?? T(n), p = g.getConfig(n), y = x(c, d, {
129
- productsPerRow: a,
130
- composition: f,
131
- filterList: i.filterList,
132
- priceInline: !p.priceMovedToNextLine,
133
+ const c = C(), l = j(r, c.recommendationProducts), d = s ?? v(n, c.filterList), f = u ?? T(n), a = P(n, e.configOverrides), g = x(l, f, {
134
+ productsPerRow: a.cardsInRow,
135
+ composition: d,
136
+ filterList: c.filterList,
137
+ priceInline: !a.priceMovedToNextLine,
133
138
  // Match the initial render's gutter so a regeneration never changes block height (SD-143023, #386).
134
- cellPadding: j(p.columnSpacing),
135
- rowSpacingPx: p.rowSpacing,
136
- ...e
139
+ cellPadding: F(a.columnSpacing),
140
+ rowSpacingPx: a.rowSpacing,
141
+ ...t
137
142
  });
138
- return o.modifyHtml(u).setInnerHtml(y), !0;
143
+ return o.modifyHtml(i).setInnerHtml(g), !0;
139
144
  }
140
- function ce(t) {
141
- if (!t)
145
+ function ut(e) {
146
+ if (!e)
142
147
  return null;
143
148
  try {
144
- const e = JSON.parse(t);
145
- return Array.isArray(e) ? e.map((n) => String(n)) : null;
149
+ const t = JSON.parse(e);
150
+ return Array.isArray(t) ? t.map((n) => String(n)) : null;
146
151
  } catch {
147
152
  return null;
148
153
  }
149
154
  }
150
- function ue(t, e, n) {
151
- const o = P(t);
155
+ function st(e, t, n) {
156
+ const o = y(e);
152
157
  if (n || !o || !("getAttribute" in o))
153
158
  return !1;
154
- const r = o.getAttribute(q);
159
+ const r = o.getAttribute(O);
155
160
  if (!r)
156
161
  return !1;
157
- const s = E(), l = r.split(",").filter(Boolean), u = H(l, o, s.filterList), i = [], c = u.join(",") !== l.join(",");
158
- c && i.push([q, u.join(",")]);
159
- const a = ce(
160
- o.getAttribute(h)
161
- ), f = a && J(a, o, s.filterList);
162
- if (a && f && f.join(",") !== a.join(",") && i.push([h, JSON.stringify(f)]), i.length === 0)
162
+ const u = C(), s = r.split(",").filter(Boolean), i = H(s, o, u.filterList), c = [], l = i.join(",") !== s.join(",");
163
+ l && c.push([O, i.join(",")]);
164
+ const d = ut(
165
+ o.getAttribute(q)
166
+ ), f = d && X(d, o, u.filterList);
167
+ if (d && f && f.join(",") !== d.join(",") && c.push([q, JSON.stringify(f)]), c.length === 0)
163
168
  return !1;
164
- if (i.forEach(([d, p]) => {
165
- e.modifyHtml(o).setAttribute(d, p);
166
- }), c && g.hasConfig(t)) {
167
- const d = {
168
- ...g.getConfig(t),
169
- composition: u
169
+ if (c.forEach(([a, g]) => {
170
+ t.modifyHtml(o).setAttribute(a, g);
171
+ }), l && h.hasConfig(e)) {
172
+ const a = {
173
+ ...h.getConfig(e),
174
+ composition: i
170
175
  };
171
- e.modifyHtml(t).setNodeConfig(d);
176
+ t.modifyHtml(e).setNodeConfig(a);
172
177
  }
173
178
  return !0;
174
179
  }
175
- function Re(t) {
180
+ function Ot(e) {
176
181
  const {
177
- currentNode: e,
182
+ currentNode: t,
178
183
  documentModifier: n,
179
184
  afterRegenerate: o,
180
185
  products: r,
181
- layout: s,
182
- composition: l,
183
- skipStylePreservation: u
184
- } = t;
185
- if (!e)
186
+ layout: u,
187
+ composition: s,
188
+ skipStylePreservation: i,
189
+ stageOnly: c,
190
+ configOverrides: l
191
+ } = e;
192
+ if (!t)
186
193
  return !1;
187
- const i = u ? {} : D(e), c = {
188
- currentNode: e,
194
+ const d = i ? {} : U(t), f = {
195
+ currentNode: t,
189
196
  documentModifier: n,
190
197
  products: r,
191
- layout: s,
192
- composition: l
198
+ layout: u,
199
+ composition: s,
200
+ configOverrides: l
193
201
  };
194
- let a = le(c, i);
195
- return a = F(c, i) || a, a && (ue(e, n, l), n.apply(new C("Regenerate products with styles"))), o == null || o(), a;
202
+ let a = ct(f, d);
203
+ return a = Y(f, d) || a, a && (st(t, n, s), c || n.apply(new A("Regenerate products with styles"))), o == null || o(), a;
196
204
  }
197
- function qe(t, e) {
198
- return t.length === e ? t : t.length > e ? t.slice(0, e) : [...t, ...U(e - t.length)];
205
+ function ht(e, t) {
206
+ return e.length === t ? e : e.length > t ? e.slice(0, t) : [...e, ...B(t - e.length)];
199
207
  }
200
- function K() {
201
- const t = E(), { currencySettings: e } = t.recommendationConfigs, n = parseInt(e.decimalCount);
208
+ function G() {
209
+ const e = C(), { currencySettings: t } = e.recommendationConfigs, n = parseInt(t.decimalCount);
202
210
  return {
203
- code: e.value,
204
- symbol: e.symbol,
205
- alignment: e.alignment === "0" ? "before" : "after",
211
+ code: t.value,
212
+ symbol: t.symbol,
213
+ alignment: t.alignment === "0" ? "before" : "after",
206
214
  decimalCount: Number.isNaN(n) ? 2 : n,
207
- decimalSeparator: e.decimalSeparator,
208
- thousandSeparator: e.thousandSeparator
215
+ decimalSeparator: t.decimalSeparator,
216
+ thousandSeparator: t.thousandSeparator
209
217
  };
210
218
  }
211
- function R(t, e = "price") {
212
- const n = K(), o = t[e], r = (o == null ? void 0 : o[n.code]) ?? Object.values(o ?? {})[0] ?? 0;
213
- return X({
219
+ function R(e, t = "price") {
220
+ const n = G(), o = e[t], r = (o == null ? void 0 : o[n.code]) ?? Object.values(o ?? {})[0] ?? 0;
221
+ return Q({
214
222
  price: r,
215
223
  currency: n
216
224
  });
217
225
  }
218
- function se(t) {
219
- var s, l;
220
- const e = K(), n = ((s = t.original_price) == null ? void 0 : s[e.code]) ?? Object.values(t.original_price ?? {})[0] ?? 0, o = ((l = t.price) == null ? void 0 : l[e.code]) ?? Object.values(t.price ?? {})[0] ?? 0, r = n > 0 ? Math.round((n - o) / n * 100) : 0;
226
+ function at(e) {
227
+ var u, s;
228
+ const t = G(), n = ((u = e.original_price) == null ? void 0 : u[t.code]) ?? Object.values(e.original_price ?? {})[0] ?? 0, o = ((s = e.price) == null ? void 0 : s[t.code]) ?? Object.values(e.price ?? {})[0] ?? 0, r = n > 0 ? Math.round((n - o) / n * 100) : 0;
221
229
  return r > 0 ? `-${r}%` : "0%";
222
230
  }
223
- function V(t) {
224
- const { documentModifier: e, product: n, priceEl: o, oldPriceEl: r, omnibusPriceEl: s, omnibusDiscountEl: l } = t;
225
- let u = !1;
231
+ function K(e) {
232
+ const { documentModifier: t, product: n, priceEl: o, oldPriceEl: r, omnibusPriceEl: u, omnibusDiscountEl: s } = e;
233
+ let i = !1;
226
234
  if (o && "querySelector" in o) {
227
- const i = o.querySelector("strong") ?? o.querySelector("p"), c = R(n, "price");
228
- S(e, i ?? null, c) && (u = !0);
235
+ const c = o.querySelector("strong") ?? o.querySelector("p"), l = R(n, "price");
236
+ b(t, c ?? null, l) && (i = !0);
229
237
  }
230
238
  if (r && "querySelector" in r) {
231
- const i = r.querySelector("strong") ?? r.querySelector("p"), c = R(n, "original_price");
232
- S(e, i ?? null, c) && (u = !0), A(e, r, "data-same-price", String(Z(n))) && (u = !0);
239
+ const c = r.querySelector("strong") ?? r.querySelector("p"), l = R(n, "original_price");
240
+ b(t, c ?? null, l) && (i = !0), S(t, r, "data-same-price", String(tt(n))) && (i = !0);
233
241
  }
234
- if (s && "querySelector" in s) {
235
- const i = s.querySelector(".omnibus-price-value") ?? null, c = R(n, "original_price");
236
- S(e, i, c) && (u = !0);
242
+ if (u && "querySelector" in u) {
243
+ const c = u.querySelector(".omnibus-price-value") ?? null, l = R(n, "original_price");
244
+ b(t, c, l) && (i = !0);
237
245
  }
238
- if (l && "querySelector" in l) {
239
- const i = l.querySelector(".omnibus-discount-value") ?? null, c = se(n);
240
- S(e, i, c) && (u = !0);
246
+ if (s && "querySelector" in s) {
247
+ const c = s.querySelector(".omnibus-discount-value") ?? null, l = at(n);
248
+ b(t, c, l) && (i = !0);
241
249
  }
242
- return u;
250
+ return i;
243
251
  }
244
- function ae(t) {
252
+ function ft(e) {
245
253
  const {
246
- documentModifier: e,
254
+ documentModifier: t,
247
255
  product: n,
248
256
  imageEl: o,
249
257
  nameEl: r,
250
- priceEl: s,
251
- oldPriceEl: l,
252
- omnibusPriceEl: u,
253
- omnibusDiscountEl: i,
254
- buttonEl: c
255
- } = t;
256
- let a = !1;
258
+ priceEl: u,
259
+ oldPriceEl: s,
260
+ omnibusPriceEl: i,
261
+ omnibusDiscountEl: c,
262
+ buttonEl: l
263
+ } = e;
264
+ let d = !1;
257
265
  if (o && "querySelector" in o) {
258
266
  const f = o.querySelector("img");
259
267
  if (f) {
260
- const p = A(e, f, "src", Q(n.image_url)), y = A(e, f, "alt", n.name);
261
- a = a || p || y;
268
+ const g = S(t, f, "src", Z(n.image_url)), E = S(t, f, "alt", n.name);
269
+ d = d || g || E;
262
270
  }
263
- const d = o.querySelector("a");
264
- d && A(e, d, "href", n.url) && (a = !0);
271
+ const a = o.querySelector("a");
272
+ a && S(t, a, "href", n.url) && (d = !0);
265
273
  }
266
274
  if (r && "querySelector" in r) {
267
275
  const f = r.querySelector("strong") ?? r.querySelector("p");
268
- S(e, f ?? null, n.name) && (a = !0);
276
+ b(t, f ?? null, n.name) && (d = !0);
269
277
  }
270
- if (V({
271
- documentModifier: e,
278
+ if (K({
279
+ documentModifier: t,
272
280
  product: n,
273
- priceEl: s,
274
- oldPriceEl: l,
275
- omnibusPriceEl: u,
276
- omnibusDiscountEl: i
277
- }) && (a = !0), c && "querySelector" in c) {
278
- const f = c.querySelector("a.es-button") || c.querySelector("a");
279
- f && A(e, f, "href", n.url) && (a = !0);
281
+ priceEl: u,
282
+ oldPriceEl: s,
283
+ omnibusPriceEl: i,
284
+ omnibusDiscountEl: c
285
+ }) && (d = !0), l && "querySelector" in l) {
286
+ const f = l.querySelector("a.es-button") || l.querySelector("a");
287
+ f && S(t, f, "href", n.url) && (d = !0);
280
288
  }
281
- return a;
289
+ return d;
282
290
  }
283
- function G(t) {
284
- return "querySelector" in t ? t.querySelector(w) ?? t : t;
291
+ function V(e) {
292
+ return "querySelector" in e ? e.querySelector(w) ?? e : e;
285
293
  }
286
- function fe(t, e) {
294
+ function dt(e, t) {
287
295
  var o;
288
296
  let n;
289
- if (t.startsWith(M)) {
290
- const r = t.slice(M.length);
291
- n = (o = e.product_attributes) == null ? void 0 : o[r];
297
+ if (e.startsWith(M)) {
298
+ const r = e.slice(M.length);
299
+ n = (o = t.product_attributes) == null ? void 0 : o[r];
292
300
  } else
293
- n = e[t];
294
- return ee(n) || null;
301
+ n = t[e];
302
+ return et(n) || null;
295
303
  }
296
- function de(t, e, n) {
297
- if (!("querySelectorAll" in t))
304
+ function mt(e, t, n) {
305
+ if (!("querySelectorAll" in e))
298
306
  return !1;
299
- const o = t.querySelectorAll(
307
+ const o = e.querySelectorAll(
300
308
  `[esd-extension-block-id="${m.CUSTOM_ATTRIBUTE}"]`
301
309
  );
302
310
  if (o.length === 0)
303
311
  return !1;
304
312
  const r = /* @__PURE__ */ new Map();
305
- o.forEach((l) => {
306
- if (!("getAttribute" in l))
313
+ o.forEach((s) => {
314
+ if (!("getAttribute" in s))
307
315
  return;
308
- const u = l.getAttribute(z);
309
- if (!u)
316
+ const i = s.getAttribute(J);
317
+ if (!i)
310
318
  return;
311
- const i = r.get(u) ?? [];
312
- i.push(l), r.set(u, i);
319
+ const c = r.get(i) ?? [];
320
+ c.push(s), r.set(i, c);
313
321
  });
314
- let s = !1;
315
- return r.forEach((l, u) => {
316
- const i = Math.min(l.length, n.length);
317
- l.slice(0, i).forEach((c, a) => {
318
- if (!("querySelector" in c))
322
+ let u = !1;
323
+ return r.forEach((s, i) => {
324
+ const c = Math.min(s.length, n.length);
325
+ s.slice(0, c).forEach((l, d) => {
326
+ if (!("querySelector" in l))
319
327
  return;
320
- const f = fe(u, n[a]);
328
+ const f = dt(i, n[d]);
321
329
  if (f === null)
322
330
  return;
323
- const d = c.querySelector("p") ?? null;
324
- S(e, d, f) && (s = !0);
331
+ const a = l.querySelector("p") ?? null;
332
+ b(t, a, f) && (u = !0);
325
333
  });
326
- }), s;
334
+ }), u;
327
335
  }
328
- function _(t, e, n) {
329
- if (!("querySelectorAll" in t))
336
+ function _(e, t, n) {
337
+ if (!("querySelectorAll" in e))
330
338
  return !1;
331
- const o = t.querySelectorAll(
339
+ const o = e.querySelectorAll(
332
340
  `[esd-extension-block-id="${m.IMAGE}"]`
333
- ), r = t.querySelectorAll(
341
+ ), r = e.querySelectorAll(
334
342
  `[esd-extension-block-id="${m.NAME}"]`
335
- ), s = t.querySelectorAll(
343
+ ), u = e.querySelectorAll(
336
344
  `[esd-extension-block-id="${m.PRICE}"]`
337
- ), l = t.querySelectorAll(
345
+ ), s = e.querySelectorAll(
338
346
  `[esd-extension-block-id="${m.OLD_PRICE}"]`
339
- ), u = t.querySelectorAll(
347
+ ), i = e.querySelectorAll(
340
348
  `[esd-extension-block-id="${m.OMNIBUS_PRICE}"]`
341
- ), i = t.querySelectorAll(
349
+ ), c = e.querySelectorAll(
342
350
  `[esd-extension-block-id="${m.OMNIBUS_DISCOUNT}"]`
343
- ), c = t.querySelectorAll(
351
+ ), l = e.querySelectorAll(
344
352
  `[esd-extension-block-id="${m.BUTTON}"]`
345
- ), a = Math.min(o.length, n.length);
353
+ ), d = Math.min(o.length, n.length);
346
354
  let f = !1;
347
- for (let d = 0; d < a; d++) {
348
- const p = ae({
349
- documentModifier: e,
350
- product: n[d],
351
- imageEl: o[d] ?? null,
352
- nameEl: r[d] ?? null,
353
- priceEl: s[d] ?? null,
354
- oldPriceEl: l[d] ?? null,
355
- omnibusPriceEl: u[d] ?? null,
356
- omnibusDiscountEl: i[d] ?? null,
357
- buttonEl: c[d] ?? null
355
+ for (let a = 0; a < d; a++) {
356
+ const g = ft({
357
+ documentModifier: t,
358
+ product: n[a],
359
+ imageEl: o[a] ?? null,
360
+ nameEl: r[a] ?? null,
361
+ priceEl: u[a] ?? null,
362
+ oldPriceEl: s[a] ?? null,
363
+ omnibusPriceEl: i[a] ?? null,
364
+ omnibusDiscountEl: c[a] ?? null,
365
+ buttonEl: l[a] ?? null
358
366
  });
359
- f = f || p;
367
+ f = f || g;
360
368
  }
361
- return de(t, e, n) && (f = !0), f;
369
+ return mt(e, t, n) && (f = !0), f;
362
370
  }
363
- function he(t) {
364
- const { currentNode: e, documentModifier: n, products: o, onApplied: r } = t;
365
- if (!e || !("querySelectorAll" in e))
371
+ function qt(e) {
372
+ const { currentNode: t, documentModifier: n, products: o, onChanged: r, stageOnly: u, configOverrides: s } = e;
373
+ if (!t || !("querySelectorAll" in t))
366
374
  return !1;
367
- const s = G(e);
368
- if (!("querySelectorAll" in s) || s.querySelectorAll(
375
+ const i = V(t);
376
+ if (!("querySelectorAll" in i) || i.querySelectorAll(
369
377
  `[esd-extension-block-id="${m.IMAGE}"]`
370
378
  ).length !== o.length)
371
379
  return !1;
372
- let u = _(s, n, o);
373
- const i = T(e), c = g.getConfig(e);
374
- if (i !== "list" && c.mobileLayoutEnabled && "querySelector" in e) {
375
- const a = e.querySelector(L);
380
+ let l = _(i, n, o);
381
+ const d = T(t), f = P(t, s);
382
+ if (d !== "list" && f.mobileLayoutEnabled && "querySelector" in t) {
383
+ const a = t.querySelector(k);
376
384
  if (a) {
377
- const f = _(
385
+ const g = _(
378
386
  a,
379
387
  n,
380
388
  o
381
389
  );
382
- u = u || f;
390
+ l = l || g;
383
391
  }
384
392
  }
385
- return u && (n.apply(new C("Updated product content in-place")), r == null || r()), !0;
393
+ return l && (u || n.apply(new A("Updated product content in-place")), r == null || r()), !0;
386
394
  }
387
- function N(t, e, n) {
388
- if (!("querySelectorAll" in t))
395
+ function L(e, t, n) {
396
+ if (!("querySelectorAll" in e))
389
397
  return !1;
390
- const o = t.querySelectorAll(
398
+ const o = e.querySelectorAll(
391
399
  `[esd-extension-block-id="${m.PRICE}"]`
392
- ), r = t.querySelectorAll(
400
+ ), r = e.querySelectorAll(
393
401
  `[esd-extension-block-id="${m.OLD_PRICE}"]`
394
- ), s = t.querySelectorAll(
402
+ ), u = e.querySelectorAll(
395
403
  `[esd-extension-block-id="${m.OMNIBUS_PRICE}"]`
396
- ), l = t.querySelectorAll(
404
+ ), s = e.querySelectorAll(
397
405
  `[esd-extension-block-id="${m.OMNIBUS_DISCOUNT}"]`
398
- ), u = Math.min(o.length, n.length);
399
- let i = !1;
400
- for (let c = 0; c < u; c++)
401
- V({
402
- documentModifier: e,
403
- product: n[c],
404
- priceEl: o[c] ?? null,
405
- oldPriceEl: r[c] ?? null,
406
- omnibusPriceEl: s[c] ?? null,
407
- omnibusDiscountEl: l[c] ?? null
408
- }) && (i = !0);
409
- return i;
410
- }
411
- function Me(t) {
412
- const { currentNode: e, documentModifier: n } = t;
413
- if (!e || !("querySelectorAll" in e))
406
+ ), i = Math.min(o.length, n.length);
407
+ let c = !1;
408
+ for (let l = 0; l < i; l++)
409
+ K({
410
+ documentModifier: t,
411
+ product: n[l],
412
+ priceEl: o[l] ?? null,
413
+ oldPriceEl: r[l] ?? null,
414
+ omnibusPriceEl: u[l] ?? null,
415
+ omnibusDiscountEl: s[l] ?? null
416
+ }) && (c = !0);
417
+ return c;
418
+ }
419
+ function Mt(e) {
420
+ const { currentNode: t, documentModifier: n, configOverrides: o } = e;
421
+ if (!t || !("querySelectorAll" in t))
414
422
  return !1;
415
- if (te(e))
423
+ if (nt(t))
416
424
  return !0;
417
- const r = E().recommendationProducts;
418
- if (r.length === 0)
425
+ const u = C().recommendationProducts;
426
+ if (u.length === 0)
419
427
  return !1;
420
- const s = G(e);
421
- let l = N(s, n, r);
422
- const u = T(e), i = g.getConfig(e);
423
- if (u !== "list" && i.mobileLayoutEnabled && "querySelector" in e) {
424
- const c = e.querySelector(L);
425
- if (c) {
426
- const a = N(c, n, r);
427
- l = l || a;
428
+ const s = V(t);
429
+ let i = L(s, n, u);
430
+ const c = T(t), l = P(t, o);
431
+ if (c !== "list" && l.mobileLayoutEnabled && "querySelector" in t) {
432
+ const d = t.querySelector(k);
433
+ if (d) {
434
+ const f = L(d, n, u);
435
+ i = i || f;
428
436
  }
429
437
  }
430
- return l && n.apply(new C("Updated price formatting in-place")), l;
438
+ return i;
431
439
  }
432
- function Ie(t) {
433
- const { currentNode: e, documentModifier: n, currency: o } = t, r = P(e);
434
- if (!r)
435
- return;
436
- const s = o.alignment === "before" ? "0" : "1", l = (u, i) => {
437
- n.modifyHtml(r).setAttribute(u, i);
440
+ function It(e) {
441
+ const { currentNode: t, documentModifier: n, currency: o, stageOnly: r } = e, u = y(t);
442
+ if (!u)
443
+ return !1;
444
+ const s = o.alignment === "before" ? "0" : "1", i = (c, l) => {
445
+ n.modifyHtml(u).setAttribute(c, l);
446
+ };
447
+ return i(p.CURRENCY, o.code), i(p.SYMBOL, o.symbol), i(p.ALIGNMENT, s), i(p.THOUSAND_SEPARATOR, o.thousandSeparator), i(p.DECIMAL_SEPARATOR, o.decimalSeparator), i(p.DECIMAL_COUNT, o.decimalCount.toString()), r || n.apply(new A("Update currency attributes")), !0;
448
+ }
449
+ function Nt(e) {
450
+ const t = y(e);
451
+ if (!t || !("getAttribute" in t))
452
+ return null;
453
+ const n = t.getAttribute(p.CURRENCY);
454
+ if (!n)
455
+ return null;
456
+ const r = t.getAttribute(p.ALIGNMENT) === "1" ? "after" : "before", u = t.getAttribute(p.DECIMAL_COUNT), s = u ? parseInt(u) : 2, i = t.getAttribute(p.THOUSAND_SEPARATOR) ?? ",", c = t.getAttribute(p.DECIMAL_SEPARATOR) ?? ".";
457
+ return {
458
+ code: n,
459
+ symbol: t.getAttribute(p.SYMBOL) ?? n,
460
+ alignment: r,
461
+ thousandSeparator: i,
462
+ decimalSeparator: c,
463
+ decimalCount: Number.isNaN(s) ? 2 : s
438
464
  };
439
- l(b.CURRENCY, o.code), l(b.SYMBOL, o.symbol), l(b.ALIGNMENT, s), l(b.THOUSAND_SEPARATOR, o.thousandSeparator), l(b.DECIMAL_SEPARATOR, o.decimalSeparator), l(b.DECIMAL_COUNT, o.decimalCount.toString()), n.apply(new C("Update currency attributes"));
440
465
  }
441
466
  export {
442
- qe as adjustProductsToSize,
467
+ ht as adjustProductsToSize,
443
468
  R as formatProductPrice,
444
- P as getBlockElement,
445
- B as getCardComposition,
469
+ y as getBlockElement,
470
+ v as getCardComposition,
471
+ Nt as getCurrencyAttributesFromBlock,
446
472
  T as getCurrentLayout,
447
- re as getMainContainerTbody,
448
- te as isPartnerManagedBlock,
449
- Te as regenerateMobileProductRows,
450
- Re as regenerateProductRowsWithStyles,
451
- Ie as setCurrencyAttributes,
452
- Me as updatePricesInPlace,
453
- he as updateProductContentInPlace,
454
- ae as updateSingleProductContent
473
+ it as getMainContainerTbody,
474
+ nt as isPartnerManagedBlock,
475
+ Rt as regenerateMobileProductRows,
476
+ Ot as regenerateProductRowsWithStyles,
477
+ It as setCurrencyAttributes,
478
+ Mt as updatePricesInPlace,
479
+ qt as updateProductContentInPlace,
480
+ ft as updateSingleProductContent
455
481
  };