@useinsider/guido 3.7.0-beta.bd7cb8f → 3.7.0-beta.d579d2a

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