@useinsider/guido 3.6.0-beta.590990f → 3.6.0-beta.596b70e

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