@useinsider/guido 3.15.0 → 3.16.0-beta.0faee0c

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