@useinsider/guido 3.7.2-beta.6f556cb → 3.7.2-beta.b4556ad

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