@useinsider/guido 3.19.0-beta.e110e88 → 3.19.0-beta.ed8a999

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