@useinsider/guido 3.21.0-beta.0df5409 → 3.21.0-beta.23f347e

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 (44) hide show
  1. package/dist/composables/useActionsApi.js +63 -80
  2. package/dist/composables/useGuidoStateBridge.js +3 -3
  3. package/dist/composables/useStripo.js +8 -8
  4. package/dist/config/compiler/htmlCompilerRules.js +1 -1
  5. package/dist/extensions/Blocks/Recommendation/block.js +29 -33
  6. package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +83 -78
  7. package/dist/extensions/Blocks/Recommendation/controls/customAttribute/textTrim.js +2 -1
  8. package/dist/extensions/Blocks/Recommendation/controls/main/algorithm.js +12 -2
  9. package/dist/extensions/Blocks/Recommendation/controls/main/currency.js +86 -104
  10. package/dist/extensions/Blocks/Recommendation/controls/main/index.js +210 -222
  11. package/dist/extensions/Blocks/Recommendation/controls/main/layoutOrientation.js +50 -48
  12. package/dist/extensions/Blocks/Recommendation/controls/main/locale.js +21 -16
  13. package/dist/extensions/Blocks/Recommendation/controls/main/pricePlacement.js +40 -44
  14. package/dist/extensions/Blocks/Recommendation/controls/main/productCount.js +19 -14
  15. package/dist/extensions/Blocks/Recommendation/controls/main/productLayout.js +119 -112
  16. package/dist/extensions/Blocks/Recommendation/controls/main/shuffle.js +23 -18
  17. package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +231 -257
  18. package/dist/extensions/Blocks/Recommendation/controls/mobileLayout/cssRules.js +20 -24
  19. package/dist/extensions/Blocks/Recommendation/controls/name/textTrim.js +7 -6
  20. package/dist/extensions/Blocks/Recommendation/controls/shared/textTrimCssRules.js +8 -8
  21. package/dist/extensions/Blocks/Recommendation/controls/spacing/index.js +151 -113
  22. package/dist/extensions/Blocks/Recommendation/utils/blockRefresh.js +11 -20
  23. package/dist/extensions/Blocks/Recommendation/utils/captureStyleTemplates.js +1 -1
  24. package/dist/extensions/Blocks/Recommendation/utils/nodeConfigWriter.js +50 -106
  25. package/dist/package.json.js +1 -1
  26. package/dist/src/composables/useActionsApi.d.ts +1 -5
  27. package/dist/src/extensions/Blocks/Recommendation/block.d.ts +0 -1
  28. package/dist/src/extensions/Blocks/Recommendation/controls/cardComposition/index.d.ts +6 -3
  29. package/dist/src/extensions/Blocks/Recommendation/controls/main/currency.d.ts +5 -5
  30. package/dist/src/extensions/Blocks/Recommendation/controls/main/index.d.ts +11 -5
  31. package/dist/src/extensions/Blocks/Recommendation/controls/main/layoutOrientation.d.ts +3 -6
  32. package/dist/src/extensions/Blocks/Recommendation/controls/main/pricePlacement.d.ts +5 -6
  33. package/dist/src/extensions/Blocks/Recommendation/controls/main/productLayout.d.ts +8 -8
  34. package/dist/src/extensions/Blocks/Recommendation/controls/main/utils.d.ts +11 -21
  35. package/dist/src/extensions/Blocks/Recommendation/controls/mobileLayout/cssRules.d.ts +13 -19
  36. package/dist/src/extensions/Blocks/Recommendation/controls/shared/textTrimCssRules.d.ts +8 -10
  37. package/dist/src/extensions/Blocks/Recommendation/controls/spacing/index.d.ts +5 -9
  38. package/dist/src/extensions/Blocks/Recommendation/utils/nodeConfigWriter.d.ts +13 -13
  39. package/dist/src/stores/editor.d.ts +1 -3
  40. package/dist/static/styles/components/tabs.css.js +5 -0
  41. package/dist/stores/editor.js +0 -5
  42. package/package.json +2 -2
  43. package/dist/extensions/Blocks/Recommendation/utils/currencySettings.js +0 -25
  44. package/dist/src/extensions/Blocks/Recommendation/utils/currencySettings.d.ts +0 -6
@@ -1,63 +1,59 @@
1
- import { ModificationDescription as A } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
1
+ import { ModificationDescription as C } 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 p, CSS_CLASS_SKIP_COMPILE as W, MOBILE_CONTAINER_SELECTOR as k, ATTR_DATA_CARD_COMPOSITION as O, DESKTOP_CONTAINER_SELECTOR as w, CONTAINER_SELECTOR as z, MOBILE_ROW_SELECTOR as D, ATTR_DATA_CUSTOM_ATTRIBUTES as q, ATTR_PRODUCT_ATTR as J, PRODUCT_ATTRIBUTE_PREFIX as M } from "../../constants/selectors.js";
4
- import { RecommendationConfigService as h } from "../../services/configService.js";
5
- import { useRecommendationExtensionStore as C } from "../../store/recommendation.js";
6
- import { prepareProductRows as x } from "../../templates/index.js";
7
- import { captureStyles as U } from "../../utils/captureStyleTemplates.js";
8
- import { normalizeCompositionKeys as H, normalizeCustomAttrValues as X } from "../../utils/compositionKeys.js";
3
+ import { CURRENCY_ATTR as b, CSS_CLASS_SKIP_COMPILE as Y, MOBILE_CONTAINER_SELECTOR as w, ATTR_DATA_CARD_COMPOSITION as q, DESKTOP_CONTAINER_SELECTOR as k, CONTAINER_SELECTOR as z, MOBILE_ROW_SELECTOR as x, ATTR_DATA_CUSTOM_ATTRIBUTES as M, ATTR_PRODUCT_ATTR as J, PRODUCT_ATTRIBUTE_PREFIX as I } from "../../constants/selectors.js";
4
+ import { RecommendationConfigService as g } from "../../services/configService.js";
5
+ import { useRecommendationExtensionStore as E } from "../../store/recommendation.js";
6
+ import { prepareProductRows as D } from "../../templates/index.js";
7
+ import { captureStyles as H } from "../../utils/captureStyleTemplates.js";
8
+ import { normalizeCompositionKeys as U, normalizeCustomAttrValues as X } from "../../utils/compositionKeys.js";
9
9
  import { formatPrice as Q } from "../../utils/priceFormatter.js";
10
- import { getDefaultProducts as B, DEFAULT_CARD_COMPOSITION as I, sanitizeImageUrl as Z, isSamePrice as tt, toDisplayableAttributeValue as et } from "../../templates/utils.js";
11
- const N = "recommendation-block-v2";
12
- function y(e) {
10
+ import { getDefaultProducts as B, DEFAULT_CARD_COMPOSITION as O, sanitizeImageUrl as Z, isSamePrice as ee, toDisplayableAttributeValue as te } from "../../templates/utils.js";
11
+ const L = "recommendation-block-v2";
12
+ function P(e) {
13
13
  if (!e)
14
14
  return null;
15
15
  if ("getAttribute" in e) {
16
16
  const t = e.getAttribute("class");
17
- if (t && t.includes(N))
17
+ if (t && t.includes(L))
18
18
  return e;
19
19
  }
20
- return "querySelector" in e ? e.querySelector(`.${N}`) ?? null : null;
20
+ return "querySelector" in e ? e.querySelector(`.${L}`) ?? null : null;
21
21
  }
22
- function nt(e) {
23
- const t = y(e);
24
- return !t || !("getAttribute" in t) ? !1 : (t.getAttribute("class") ?? "").split(/\s+/).includes(W);
22
+ function ne(e) {
23
+ const t = P(e);
24
+ return !t || !("getAttribute" in t) ? !1 : (t.getAttribute("class") ?? "").split(/\s+/).includes(Y);
25
25
  }
26
26
  function T(e) {
27
- const t = y(e);
27
+ const t = P(e);
28
28
  if (!t || !("getAttribute" in t))
29
29
  return "grid";
30
30
  const n = t.getAttribute("data-layout");
31
31
  return n === "list" || n === "horizontal" ? "list" : "grid";
32
32
  }
33
- function v(e, t = {}) {
34
- const n = y(e);
33
+ function $(e, t = {}) {
34
+ const n = P(e);
35
35
  if (!n || !("getAttribute" in n))
36
- return I;
37
- const o = n.getAttribute(O);
38
- return o ? H(
36
+ return O;
37
+ const o = n.getAttribute(q);
38
+ return o ? U(
39
39
  o.split(",").filter(Boolean),
40
40
  n,
41
41
  t
42
- ) : I;
42
+ ) : O;
43
43
  }
44
- function P(e, t) {
45
- const n = h.getConfig(e);
46
- return t ? { ...n, ...t } : n;
47
- }
48
- function $(e) {
44
+ function v(e) {
49
45
  if (!e || !("childNodes" in e))
50
46
  return null;
51
47
  const t = e.childNodes(), n = t.find(
52
48
  (o) => "getType" in o && o.getType() === "text"
53
49
  );
54
- return n || t.reduce((o, r) => o || !("getType" in r) || r.getType() === "text" ? o : $(r), null);
50
+ return n || t.reduce((o, r) => o || !("getType" in r) || r.getType() === "text" ? o : v(r), null);
55
51
  }
56
- function b(e, t, n) {
57
- const o = $(t);
52
+ function S(e, t, n) {
53
+ const o = v(t);
58
54
  return !o || "getTextContent" in o && o.getTextContent() === n ? !1 : (e.modifyHtml(o).setText(n), !0);
59
55
  }
60
- function S(e, t, n, o) {
56
+ function A(e, t, n, o) {
61
57
  return "getAttribute" in t && t.getAttribute(n) === o ? !1 : (e.modifyHtml(t).setAttribute(n, o), !0);
62
58
  }
63
59
  function j(e, t) {
@@ -67,82 +63,81 @@ function F(e) {
67
63
  if (typeof e == "number")
68
64
  return `0 ${e / 2}px`;
69
65
  }
70
- function ot(e) {
66
+ function oe(e) {
71
67
  const { currentNode: t, documentModifier: n } = e;
72
68
  if (!t || !("querySelector" in t))
73
69
  return !1;
74
- const o = t.querySelector(D);
70
+ const o = t.querySelector(x);
75
71
  return o ? (n.modifyHtml(o).setInnerHtml(""), !0) : !1;
76
72
  }
77
- function rt(e) {
73
+ function re(e) {
78
74
  return "getOuterHTML" in e && typeof e.getOuterHTML == "function" ? e.getOuterHTML() : "";
79
75
  }
80
- function it(e) {
76
+ function ie(e) {
81
77
  const t = e.querySelector(".container");
82
78
  return !t || !("childNodes" in t) ? null : t.childNodes().find((o) => "getTagName" in o && o.getTagName() === "tbody") ?? t.querySelector("tbody") ?? null;
83
79
  }
84
- function lt(e, t, n) {
85
- const o = it(e);
80
+ function le(e, t, n) {
81
+ const o = ie(e);
86
82
  if (!o || !("childNodes" in o))
87
83
  return;
88
- const r = o.childNodes().map(rt).join(""), u = `<tr class="ins-recommendation-mobile-row">${n}</tr>`;
89
- t.modifyHtml(o).setInnerHtml(r + u), t.apply(new A("Added mobile product row"));
84
+ const r = o.childNodes().map(re).join(""), s = `<tr class="ins-recommendation-mobile-row">${n}</tr>`;
85
+ t.modifyHtml(o).setInnerHtml(r + s), t.apply(new C("Added mobile product row"));
90
86
  }
91
- function Y(e, t = {}) {
87
+ function K(e, t = {}) {
92
88
  const {
93
89
  currentNode: n,
94
90
  documentModifier: o,
95
91
  products: r,
96
- layout: u,
97
- composition: s
92
+ layout: s,
93
+ composition: l
98
94
  } = e;
99
95
  if (!n || !("querySelector" in n))
100
96
  return !1;
101
- const i = u ?? T(n), c = P(n, e.configOverrides);
102
- if (i === "list" || !c.mobileLayoutEnabled)
103
- return ot({ currentNode: n, documentModifier: o });
104
- const l = C(), d = j(r, l.recommendationProducts), f = s ?? v(n, l.filterList), g = `<td><table class="ins-recommendation-product-container ins-recommendation-mobile-container" width="100%" cellpadding="0" cellspacing="0" border="0">${x(d, i, {
105
- productsPerRow: c.mobileCardsInRow,
106
- composition: f,
107
- filterList: l.filterList,
108
- priceInline: !c.priceMovedToNextLine,
97
+ const u = s ?? T(n), i = g.getConfig(n), c = e.mobileLayoutEnabled ?? i.mobileLayoutEnabled;
98
+ if (u === "list" || !c)
99
+ return oe({ currentNode: n, documentModifier: o });
100
+ const a = E(), f = j(r, a.recommendationProducts), d = l ?? $(n, a.filterList), y = `<td><table class="ins-recommendation-product-container ins-recommendation-mobile-container" width="100%" cellpadding="0" cellspacing="0" border="0">${D(f, u, {
101
+ productsPerRow: i.mobileCardsInRow,
102
+ composition: d,
103
+ filterList: a.filterList,
104
+ priceInline: !i.priceMovedToNextLine,
109
105
  // Match the initial render's gutter so a regeneration never changes block height (SD-143023, #386).
110
- cellPadding: F(c.mobileColumnSpacing),
111
- rowSpacingPx: c.mobileRowSpacing,
106
+ cellPadding: F(i.mobileColumnSpacing),
107
+ rowSpacingPx: i.mobileRowSpacing,
112
108
  ...t
113
- })}</table></td>`, E = n.querySelector(D);
114
- return E ? (o.modifyHtml(E).setInnerHtml(g), !0) : (lt(n, o, g), !1);
109
+ })}</table></td>`, h = n.querySelector(x);
110
+ return h ? (o.modifyHtml(h).setInnerHtml(y), !0) : (le(n, o, y), !1);
115
111
  }
116
- function Rt(e) {
117
- const t = Y(e, U(e.currentNode));
118
- return t && !e.stageOnly && e.documentModifier.apply(new A("Updated mobile product rows")), t;
112
+ function Re(e) {
113
+ K(e, H(e.currentNode)) && e.documentModifier.apply(new C("Updated mobile product rows"));
119
114
  }
120
- function ct(e, t = {}) {
115
+ function ce(e, t = {}) {
121
116
  const {
122
117
  currentNode: n,
123
118
  documentModifier: o,
124
119
  products: r,
125
- layout: u,
126
- composition: s
120
+ layout: s,
121
+ composition: l
127
122
  } = e;
128
123
  if (!n || !("querySelector" in n))
129
124
  return !1;
130
- const i = n.querySelector(w) ?? n.querySelector(z);
131
- if (!i)
125
+ const u = n.querySelector(k) ?? n.querySelector(z);
126
+ if (!u)
132
127
  return !1;
133
- const c = C(), l = j(r, c.recommendationProducts), d = s ?? v(n, c.filterList), f = u ?? T(n), a = P(n, e.configOverrides), g = x(l, f, {
134
- productsPerRow: a.cardsInRow,
135
- composition: d,
136
- filterList: c.filterList,
137
- priceInline: !a.priceMovedToNextLine,
128
+ const i = E(), c = j(r, i.recommendationProducts), { cardsInRow: a } = g.getConfig(n), f = l ?? $(n, i.filterList), d = s ?? T(n), p = g.getConfig(n), y = D(c, d, {
129
+ productsPerRow: a,
130
+ composition: f,
131
+ filterList: i.filterList,
132
+ priceInline: !p.priceMovedToNextLine,
138
133
  // Match the initial render's gutter so a regeneration never changes block height (SD-143023, #386).
139
- cellPadding: F(a.columnSpacing),
140
- rowSpacingPx: a.rowSpacing,
134
+ cellPadding: F(p.columnSpacing),
135
+ rowSpacingPx: p.rowSpacing,
141
136
  ...t
142
137
  });
143
- return o.modifyHtml(i).setInnerHtml(g), !0;
138
+ return o.modifyHtml(u).setInnerHtml(y), !0;
144
139
  }
145
- function ut(e) {
140
+ function ue(e) {
146
141
  if (!e)
147
142
  return null;
148
143
  try {
@@ -152,61 +147,58 @@ function ut(e) {
152
147
  return null;
153
148
  }
154
149
  }
155
- function st(e, t, n) {
156
- const o = y(e);
150
+ function se(e, t, n) {
151
+ const o = P(e);
157
152
  if (n || !o || !("getAttribute" in o))
158
153
  return !1;
159
- const r = o.getAttribute(O);
154
+ const r = o.getAttribute(q);
160
155
  if (!r)
161
156
  return !1;
162
- const u = C(), s = r.split(",").filter(Boolean), i = H(s, o, u.filterList), c = [], l = i.join(",") !== s.join(",");
163
- l && c.push([O, i.join(",")]);
164
- const d = ut(
165
- o.getAttribute(q)
166
- ), f = d && X(d, o, u.filterList);
167
- if (d && f && f.join(",") !== d.join(",") && c.push([q, JSON.stringify(f)]), c.length === 0)
157
+ const s = E(), l = r.split(",").filter(Boolean), u = U(l, o, s.filterList), i = [], c = u.join(",") !== l.join(",");
158
+ c && i.push([q, u.join(",")]);
159
+ const a = ue(
160
+ o.getAttribute(M)
161
+ ), f = a && X(a, o, s.filterList);
162
+ if (a && f && f.join(",") !== a.join(",") && i.push([M, JSON.stringify(f)]), i.length === 0)
168
163
  return !1;
169
- if (c.forEach(([a, g]) => {
170
- t.modifyHtml(o).setAttribute(a, g);
171
- }), l && h.hasConfig(e)) {
172
- const a = {
173
- ...h.getConfig(e),
174
- composition: i
164
+ if (i.forEach(([d, p]) => {
165
+ t.modifyHtml(o).setAttribute(d, p);
166
+ }), c && g.hasConfig(e)) {
167
+ const d = {
168
+ ...g.getConfig(e),
169
+ composition: u
175
170
  };
176
- t.modifyHtml(e).setNodeConfig(a);
171
+ t.modifyHtml(e).setNodeConfig(d);
177
172
  }
178
173
  return !0;
179
174
  }
180
- function Ot(e) {
175
+ function qe(e) {
181
176
  const {
182
177
  currentNode: t,
183
178
  documentModifier: n,
184
179
  afterRegenerate: o,
185
180
  products: r,
186
- layout: u,
187
- composition: s,
188
- skipStylePreservation: i,
189
- stageOnly: c,
190
- configOverrides: l
181
+ layout: s,
182
+ composition: l,
183
+ skipStylePreservation: u
191
184
  } = e;
192
185
  if (!t)
193
186
  return !1;
194
- const d = i ? {} : U(t), f = {
187
+ const i = u ? {} : H(t), c = {
195
188
  currentNode: t,
196
189
  documentModifier: n,
197
190
  products: r,
198
- layout: u,
199
- composition: s,
200
- configOverrides: l
191
+ layout: s,
192
+ composition: l
201
193
  };
202
- let a = ct(f, d);
203
- return a = Y(f, d) || a, a && (st(t, n, s), c || n.apply(new A("Regenerate products with styles"))), o == null || o(), a;
194
+ let a = ce(c, i);
195
+ return a = K(c, i) || a, a && (se(t, n, l), n.apply(new C("Regenerate products with styles"))), o == null || o(), a;
204
196
  }
205
- function ht(e, t) {
197
+ function he(e, t) {
206
198
  return e.length === t ? e : e.length > t ? e.slice(0, t) : [...e, ...B(t - e.length)];
207
199
  }
208
- function G() {
209
- const e = C(), { currencySettings: t } = e.recommendationConfigs, n = parseInt(t.decimalCount);
200
+ function V() {
201
+ const e = E(), { currencySettings: t } = e.recommendationConfigs, n = parseInt(t.decimalCount);
210
202
  return {
211
203
  code: t.value,
212
204
  symbol: t.symbol,
@@ -217,91 +209,91 @@ function G() {
217
209
  };
218
210
  }
219
211
  function R(e, t = "price") {
220
- const n = G(), o = e[t], r = (o == null ? void 0 : o[n.code]) ?? Object.values(o ?? {})[0] ?? 0;
212
+ const n = V(), o = e[t], r = (o == null ? void 0 : o[n.code]) ?? Object.values(o ?? {})[0] ?? 0;
221
213
  return Q({
222
214
  price: r,
223
215
  currency: n
224
216
  });
225
217
  }
226
- function at(e) {
227
- var u, s;
228
- const t = G(), n = ((u = e.original_price) == null ? void 0 : u[t.code]) ?? Object.values(e.original_price ?? {})[0] ?? 0, o = ((s = e.price) == null ? void 0 : s[t.code]) ?? Object.values(e.price ?? {})[0] ?? 0, r = n > 0 ? Math.round((n - o) / n * 100) : 0;
218
+ function ae(e) {
219
+ var s, l;
220
+ const t = V(), n = ((s = e.original_price) == null ? void 0 : s[t.code]) ?? Object.values(e.original_price ?? {})[0] ?? 0, o = ((l = e.price) == null ? void 0 : l[t.code]) ?? Object.values(e.price ?? {})[0] ?? 0, r = n > 0 ? Math.round((n - o) / n * 100) : 0;
229
221
  return r > 0 ? `-${r}%` : "0%";
230
222
  }
231
- function K(e) {
232
- const { documentModifier: t, product: n, priceEl: o, oldPriceEl: r, omnibusPriceEl: u, omnibusDiscountEl: s } = e;
233
- let i = !1;
223
+ function G(e) {
224
+ const { documentModifier: t, product: n, priceEl: o, oldPriceEl: r, omnibusPriceEl: s, omnibusDiscountEl: l } = e;
225
+ let u = !1;
234
226
  if (o && "querySelector" in o) {
235
- const c = o.querySelector("strong") ?? o.querySelector("p"), l = R(n, "price");
236
- b(t, c ?? null, l) && (i = !0);
227
+ const i = o.querySelector("strong") ?? o.querySelector("p"), c = R(n, "price");
228
+ S(t, i ?? null, c) && (u = !0);
237
229
  }
238
230
  if (r && "querySelector" in r) {
239
- const c = r.querySelector("strong") ?? r.querySelector("p"), l = R(n, "original_price");
240
- b(t, c ?? null, l) && (i = !0), S(t, r, "data-same-price", String(tt(n))) && (i = !0);
241
- }
242
- if (u && "querySelector" in u) {
243
- const c = u.querySelector(".omnibus-price-value") ?? null, l = R(n, "original_price");
244
- b(t, c, l) && (i = !0);
231
+ const i = r.querySelector("strong") ?? r.querySelector("p"), c = R(n, "original_price");
232
+ S(t, i ?? null, c) && (u = !0), A(t, r, "data-same-price", String(ee(n))) && (u = !0);
245
233
  }
246
234
  if (s && "querySelector" in s) {
247
- const c = s.querySelector(".omnibus-discount-value") ?? null, l = at(n);
248
- b(t, c, l) && (i = !0);
235
+ const i = s.querySelector(".omnibus-price-value") ?? null, c = R(n, "original_price");
236
+ S(t, i, c) && (u = !0);
249
237
  }
250
- return i;
238
+ if (l && "querySelector" in l) {
239
+ const i = l.querySelector(".omnibus-discount-value") ?? null, c = ae(n);
240
+ S(t, i, c) && (u = !0);
241
+ }
242
+ return u;
251
243
  }
252
- function ft(e) {
244
+ function fe(e) {
253
245
  const {
254
246
  documentModifier: t,
255
247
  product: n,
256
248
  imageEl: o,
257
249
  nameEl: r,
258
- priceEl: u,
259
- oldPriceEl: s,
260
- omnibusPriceEl: i,
261
- omnibusDiscountEl: c,
262
- buttonEl: l
250
+ priceEl: s,
251
+ oldPriceEl: l,
252
+ omnibusPriceEl: u,
253
+ omnibusDiscountEl: i,
254
+ buttonEl: c
263
255
  } = e;
264
- let d = !1;
256
+ let a = !1;
265
257
  if (o && "querySelector" in o) {
266
258
  const f = o.querySelector("img");
267
259
  if (f) {
268
- const g = S(t, f, "src", Z(n.image_url)), E = S(t, f, "alt", n.name);
269
- d = d || g || E;
260
+ const p = A(t, f, "src", Z(n.image_url)), y = A(t, f, "alt", n.name);
261
+ a = a || p || y;
270
262
  }
271
- const a = o.querySelector("a");
272
- a && S(t, a, "href", n.url) && (d = !0);
263
+ const d = o.querySelector("a");
264
+ d && A(t, d, "href", n.url) && (a = !0);
273
265
  }
274
266
  if (r && "querySelector" in r) {
275
267
  const f = r.querySelector("strong") ?? r.querySelector("p");
276
- b(t, f ?? null, n.name) && (d = !0);
268
+ S(t, f ?? null, n.name) && (a = !0);
277
269
  }
278
- if (K({
270
+ if (G({
279
271
  documentModifier: t,
280
272
  product: n,
281
- priceEl: u,
282
- oldPriceEl: s,
283
- omnibusPriceEl: i,
284
- omnibusDiscountEl: c
285
- }) && (d = !0), l && "querySelector" in l) {
286
- const f = l.querySelector("a.es-button") || l.querySelector("a");
287
- f && S(t, f, "href", n.url) && (d = !0);
273
+ priceEl: s,
274
+ oldPriceEl: l,
275
+ omnibusPriceEl: u,
276
+ omnibusDiscountEl: i
277
+ }) && (a = !0), c && "querySelector" in c) {
278
+ const f = c.querySelector("a.es-button") || c.querySelector("a");
279
+ f && A(t, f, "href", n.url) && (a = !0);
288
280
  }
289
- return d;
281
+ return a;
290
282
  }
291
- function V(e) {
292
- return "querySelector" in e ? e.querySelector(w) ?? e : e;
283
+ function W(e) {
284
+ return "querySelector" in e ? e.querySelector(k) ?? e : e;
293
285
  }
294
- function dt(e, t) {
286
+ function de(e, t) {
295
287
  var o;
296
288
  let n;
297
- if (e.startsWith(M)) {
298
- const r = e.slice(M.length);
289
+ if (e.startsWith(I)) {
290
+ const r = e.slice(I.length);
299
291
  n = (o = t.product_attributes) == null ? void 0 : o[r];
300
292
  } else
301
293
  n = t[e];
302
- return et(n) || null;
294
+ return te(n) || null;
303
295
  }
304
- function mt(e, t, n) {
296
+ function me(e, t, n) {
305
297
  if (!("querySelectorAll" in e))
306
298
  return !1;
307
299
  const o = e.querySelectorAll(
@@ -310,28 +302,28 @@ function mt(e, t, n) {
310
302
  if (o.length === 0)
311
303
  return !1;
312
304
  const r = /* @__PURE__ */ new Map();
313
- o.forEach((s) => {
314
- if (!("getAttribute" in s))
305
+ o.forEach((l) => {
306
+ if (!("getAttribute" in l))
315
307
  return;
316
- const i = s.getAttribute(J);
317
- if (!i)
308
+ const u = l.getAttribute(J);
309
+ if (!u)
318
310
  return;
319
- const c = r.get(i) ?? [];
320
- c.push(s), r.set(i, c);
311
+ const i = r.get(u) ?? [];
312
+ i.push(l), r.set(u, i);
321
313
  });
322
- let u = !1;
323
- return r.forEach((s, i) => {
324
- const c = Math.min(s.length, n.length);
325
- s.slice(0, c).forEach((l, d) => {
326
- if (!("querySelector" in l))
314
+ let s = !1;
315
+ return r.forEach((l, u) => {
316
+ const i = Math.min(l.length, n.length);
317
+ l.slice(0, i).forEach((c, a) => {
318
+ if (!("querySelector" in c))
327
319
  return;
328
- const f = dt(i, n[d]);
320
+ const f = de(u, n[a]);
329
321
  if (f === null)
330
322
  return;
331
- const a = l.querySelector("p") ?? null;
332
- b(t, a, f) && (u = !0);
323
+ const d = c.querySelector("p") ?? null;
324
+ S(t, d, f) && (s = !0);
333
325
  });
334
- }), u;
326
+ }), s;
335
327
  }
336
328
  function _(e, t, n) {
337
329
  if (!("querySelectorAll" in e))
@@ -340,142 +332,124 @@ function _(e, t, n) {
340
332
  `[esd-extension-block-id="${m.IMAGE}"]`
341
333
  ), r = e.querySelectorAll(
342
334
  `[esd-extension-block-id="${m.NAME}"]`
343
- ), u = e.querySelectorAll(
344
- `[esd-extension-block-id="${m.PRICE}"]`
345
335
  ), s = e.querySelectorAll(
336
+ `[esd-extension-block-id="${m.PRICE}"]`
337
+ ), l = e.querySelectorAll(
346
338
  `[esd-extension-block-id="${m.OLD_PRICE}"]`
347
- ), i = e.querySelectorAll(
339
+ ), u = e.querySelectorAll(
348
340
  `[esd-extension-block-id="${m.OMNIBUS_PRICE}"]`
349
- ), c = e.querySelectorAll(
341
+ ), i = e.querySelectorAll(
350
342
  `[esd-extension-block-id="${m.OMNIBUS_DISCOUNT}"]`
351
- ), l = e.querySelectorAll(
343
+ ), c = e.querySelectorAll(
352
344
  `[esd-extension-block-id="${m.BUTTON}"]`
353
- ), d = Math.min(o.length, n.length);
345
+ ), a = Math.min(o.length, n.length);
354
346
  let f = !1;
355
- for (let a = 0; a < d; a++) {
356
- const g = ft({
347
+ for (let d = 0; d < a; d++) {
348
+ const p = fe({
357
349
  documentModifier: t,
358
- product: n[a],
359
- imageEl: o[a] ?? null,
360
- nameEl: r[a] ?? null,
361
- priceEl: u[a] ?? null,
362
- oldPriceEl: s[a] ?? null,
363
- omnibusPriceEl: i[a] ?? null,
364
- omnibusDiscountEl: c[a] ?? null,
365
- buttonEl: l[a] ?? null
350
+ product: n[d],
351
+ imageEl: o[d] ?? null,
352
+ nameEl: r[d] ?? null,
353
+ priceEl: s[d] ?? null,
354
+ oldPriceEl: l[d] ?? null,
355
+ omnibusPriceEl: u[d] ?? null,
356
+ omnibusDiscountEl: i[d] ?? null,
357
+ buttonEl: c[d] ?? null
366
358
  });
367
- f = f || g;
359
+ f = f || p;
368
360
  }
369
- return mt(e, t, n) && (f = !0), f;
361
+ return me(e, t, n) && (f = !0), f;
370
362
  }
371
- function qt(e) {
372
- const { currentNode: t, documentModifier: n, products: o, onChanged: r, stageOnly: u, configOverrides: s } = e;
363
+ function Me(e) {
364
+ const { currentNode: t, documentModifier: n, products: o, onApplied: r } = e;
373
365
  if (!t || !("querySelectorAll" in t))
374
366
  return !1;
375
- const i = V(t);
376
- if (!("querySelectorAll" in i) || i.querySelectorAll(
367
+ const s = W(t);
368
+ if (!("querySelectorAll" in s) || s.querySelectorAll(
377
369
  `[esd-extension-block-id="${m.IMAGE}"]`
378
370
  ).length !== o.length)
379
371
  return !1;
380
- let l = _(i, n, o);
381
- const d = T(t), f = P(t, s);
382
- if (d !== "list" && f.mobileLayoutEnabled && "querySelector" in t) {
383
- const a = t.querySelector(k);
372
+ let u = _(s, n, o);
373
+ const i = T(t), c = g.getConfig(t);
374
+ if (i !== "list" && c.mobileLayoutEnabled && "querySelector" in t) {
375
+ const a = t.querySelector(w);
384
376
  if (a) {
385
- const g = _(
377
+ const f = _(
386
378
  a,
387
379
  n,
388
380
  o
389
381
  );
390
- l = l || g;
382
+ u = u || f;
391
383
  }
392
384
  }
393
- return l && (u || n.apply(new A("Updated product content in-place")), r == null || r()), !0;
385
+ return u && (n.apply(new C("Updated product content in-place")), r == null || r()), !0;
394
386
  }
395
- function L(e, t, n) {
387
+ function N(e, t, n) {
396
388
  if (!("querySelectorAll" in e))
397
389
  return !1;
398
390
  const o = e.querySelectorAll(
399
391
  `[esd-extension-block-id="${m.PRICE}"]`
400
392
  ), r = e.querySelectorAll(
401
393
  `[esd-extension-block-id="${m.OLD_PRICE}"]`
402
- ), u = e.querySelectorAll(
403
- `[esd-extension-block-id="${m.OMNIBUS_PRICE}"]`
404
394
  ), s = e.querySelectorAll(
395
+ `[esd-extension-block-id="${m.OMNIBUS_PRICE}"]`
396
+ ), l = e.querySelectorAll(
405
397
  `[esd-extension-block-id="${m.OMNIBUS_DISCOUNT}"]`
406
- ), i = Math.min(o.length, n.length);
407
- let c = !1;
408
- for (let l = 0; l < i; l++)
409
- K({
398
+ ), u = Math.min(o.length, n.length);
399
+ let i = !1;
400
+ for (let c = 0; c < u; c++)
401
+ G({
410
402
  documentModifier: t,
411
- product: n[l],
412
- priceEl: o[l] ?? null,
413
- oldPriceEl: r[l] ?? null,
414
- omnibusPriceEl: u[l] ?? null,
415
- omnibusDiscountEl: s[l] ?? null
416
- }) && (c = !0);
417
- return c;
418
- }
419
- function Mt(e) {
420
- const { currentNode: t, documentModifier: n, configOverrides: o } = e;
403
+ product: n[c],
404
+ priceEl: o[c] ?? null,
405
+ oldPriceEl: r[c] ?? null,
406
+ omnibusPriceEl: s[c] ?? null,
407
+ omnibusDiscountEl: l[c] ?? null
408
+ }) && (i = !0);
409
+ return i;
410
+ }
411
+ function Ie(e) {
412
+ const { currentNode: t, documentModifier: n } = e;
421
413
  if (!t || !("querySelectorAll" in t))
422
414
  return !1;
423
- if (nt(t))
415
+ if (ne(t))
424
416
  return !0;
425
- const u = C().recommendationProducts;
426
- if (u.length === 0)
417
+ const r = E().recommendationProducts;
418
+ if (r.length === 0)
427
419
  return !1;
428
- const s = V(t);
429
- let i = L(s, n, u);
430
- const c = T(t), l = P(t, o);
431
- if (c !== "list" && l.mobileLayoutEnabled && "querySelector" in t) {
432
- const d = t.querySelector(k);
433
- if (d) {
434
- const f = L(d, n, u);
435
- i = i || f;
420
+ const s = W(t);
421
+ let l = N(s, n, r);
422
+ const u = T(t), i = g.getConfig(t);
423
+ if (u !== "list" && i.mobileLayoutEnabled && "querySelector" in t) {
424
+ const c = t.querySelector(w);
425
+ if (c) {
426
+ const a = N(c, n, r);
427
+ l = l || a;
436
428
  }
437
429
  }
438
- return i;
430
+ return l && n.apply(new C("Updated price formatting in-place")), l;
439
431
  }
440
- function It(e) {
441
- const { currentNode: t, documentModifier: n, currency: o, stageOnly: r } = e, u = y(t);
442
- if (!u)
443
- return !1;
444
- const s = o.alignment === "before" ? "0" : "1", i = (c, l) => {
445
- n.modifyHtml(u).setAttribute(c, l);
446
- };
447
- return 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()), r || n.apply(new A("Update currency attributes")), !0;
448
- }
449
- function Nt(e) {
450
- const t = y(e);
451
- if (!t || !("getAttribute" in t))
452
- return null;
453
- const n = t.getAttribute(p.CURRENCY);
454
- if (!n)
455
- return null;
456
- const r = t.getAttribute(p.ALIGNMENT) === "1" ? "after" : "before", u = t.getAttribute(p.DECIMAL_COUNT), s = u ? parseInt(u) : 2, i = t.getAttribute(p.THOUSAND_SEPARATOR) ?? ",", c = t.getAttribute(p.DECIMAL_SEPARATOR) ?? ".";
457
- return {
458
- code: n,
459
- symbol: t.getAttribute(p.SYMBOL) ?? n,
460
- alignment: r,
461
- thousandSeparator: i,
462
- decimalSeparator: c,
463
- decimalCount: Number.isNaN(s) ? 2 : s
432
+ function Oe(e) {
433
+ const { currentNode: t, documentModifier: n, currency: o } = e, r = P(t);
434
+ if (!r)
435
+ return;
436
+ const s = o.alignment === "before" ? "0" : "1", l = (u, i) => {
437
+ n.modifyHtml(r).setAttribute(u, i);
464
438
  };
439
+ l(b.CURRENCY, o.code), l(b.SYMBOL, o.symbol), l(b.ALIGNMENT, s), l(b.THOUSAND_SEPARATOR, o.thousandSeparator), l(b.DECIMAL_SEPARATOR, o.decimalSeparator), l(b.DECIMAL_COUNT, o.decimalCount.toString()), n.apply(new C("Update currency attributes"));
465
440
  }
466
441
  export {
467
- ht as adjustProductsToSize,
442
+ he as adjustProductsToSize,
468
443
  R as formatProductPrice,
469
- y as getBlockElement,
470
- v as getCardComposition,
471
- Nt as getCurrencyAttributesFromBlock,
444
+ P as getBlockElement,
445
+ $ as getCardComposition,
472
446
  T as getCurrentLayout,
473
- it as getMainContainerTbody,
474
- nt as isPartnerManagedBlock,
475
- Rt as regenerateMobileProductRows,
476
- Ot as regenerateProductRowsWithStyles,
477
- It as setCurrencyAttributes,
478
- Mt as updatePricesInPlace,
479
- qt as updateProductContentInPlace,
480
- ft as updateSingleProductContent
447
+ ie as getMainContainerTbody,
448
+ ne as isPartnerManagedBlock,
449
+ Re as regenerateMobileProductRows,
450
+ qe as regenerateProductRowsWithStyles,
451
+ Oe as setCurrencyAttributes,
452
+ Ie as updatePricesInPlace,
453
+ Me as updateProductContentInPlace,
454
+ fe as updateSingleProductContent
481
455
  };