@useinsider/guido 3.7.2-beta.13c9a35 → 3.7.2-beta.1489585

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