@useinsider/guido 3.8.0 → 3.8.1-beta.1a5be20

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