@useinsider/guido 3.20.0 → 3.20.1-beta.19f951a

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