@useinsider/guido 3.2.0-beta.caa22bf → 3.2.0-beta.ccaf9f5

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