@useinsider/guido 3.20.1-beta.2c8da49 → 3.20.1-beta.2d09f29

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 (72) hide show
  1. package/dist/composables/useActionsApi.js +64 -80
  2. package/dist/composables/useFullStoryBridge.js +10 -9
  3. package/dist/composables/useGuidoStateBridge.js +3 -3
  4. package/dist/composables/useLegacyStrategyConversion.js +16 -16
  5. package/dist/composables/useStripo.js +10 -11
  6. package/dist/config/migrator/fullStoryScriptMigrator.js +5 -0
  7. package/dist/config/migrator/index.js +11 -10
  8. package/dist/extensions/Blocks/Items/block.js +42 -43
  9. package/dist/extensions/Blocks/Recommendation/block.js +29 -33
  10. package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +83 -78
  11. package/dist/extensions/Blocks/Recommendation/controls/customAttribute/textTrim.js +2 -1
  12. package/dist/extensions/Blocks/Recommendation/controls/main/algorithm.js +12 -2
  13. package/dist/extensions/Blocks/Recommendation/controls/main/currency.js +86 -104
  14. package/dist/extensions/Blocks/Recommendation/controls/main/index.js +263 -348
  15. package/dist/extensions/Blocks/Recommendation/controls/main/layoutOrientation.js +50 -48
  16. package/dist/extensions/Blocks/Recommendation/controls/main/locale.js +21 -16
  17. package/dist/extensions/Blocks/Recommendation/controls/main/pricePlacement.js +40 -44
  18. package/dist/extensions/Blocks/Recommendation/controls/main/productCount.js +19 -14
  19. package/dist/extensions/Blocks/Recommendation/controls/main/productLayout.js +102 -104
  20. package/dist/extensions/Blocks/Recommendation/controls/main/shuffle.js +23 -18
  21. package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +286 -312
  22. package/dist/extensions/Blocks/Recommendation/controls/mobileLayout/cssRules.js +20 -24
  23. package/dist/extensions/Blocks/Recommendation/controls/name/textTrim.js +7 -6
  24. package/dist/extensions/Blocks/Recommendation/controls/shared/textTrimCssRules.js +8 -8
  25. package/dist/extensions/Blocks/Recommendation/controls/spacing/index.js +151 -113
  26. package/dist/extensions/Blocks/Recommendation/store/recommendation.js +205 -219
  27. package/dist/extensions/Blocks/Recommendation/utils/captureStyleTemplates.js +1 -1
  28. package/dist/extensions/Blocks/Recommendation/utils/nodeConfigWriter.js +40 -111
  29. package/dist/extensions/Blocks/Recommendation/utils/strategyCommit.js +35 -31
  30. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js +192 -271
  31. package/dist/package.json.js +1 -1
  32. package/dist/src/composables/useActionsApi.d.ts +1 -5
  33. package/dist/src/config/migrator/fullStoryScriptMigrator.d.ts +1 -0
  34. package/dist/src/extensions/Blocks/Checkbox/controls/blockBackground/index.d.ts +0 -1
  35. package/dist/src/extensions/Blocks/CouponBlock/controls/index.d.ts +0 -8
  36. package/dist/src/extensions/Blocks/Items/controls/index.d.ts +0 -40
  37. package/dist/src/extensions/Blocks/RadioButton/controls/blockBackground/index.d.ts +0 -1
  38. package/dist/src/extensions/Blocks/Recommendation/block.d.ts +0 -1
  39. package/dist/src/extensions/Blocks/Recommendation/controls/blockBackground/index.d.ts +0 -1
  40. package/dist/src/extensions/Blocks/Recommendation/controls/button/index.d.ts +0 -11
  41. package/dist/src/extensions/Blocks/Recommendation/controls/cardComposition/index.d.ts +6 -3
  42. package/dist/src/extensions/Blocks/Recommendation/controls/customAttribute/index.d.ts +0 -7
  43. package/dist/src/extensions/Blocks/Recommendation/controls/image/index.d.ts +0 -2
  44. package/dist/src/extensions/Blocks/Recommendation/controls/main/currency.d.ts +5 -5
  45. package/dist/src/extensions/Blocks/Recommendation/controls/main/index.d.ts +12 -21
  46. package/dist/src/extensions/Blocks/Recommendation/controls/main/layoutOrientation.d.ts +3 -6
  47. package/dist/src/extensions/Blocks/Recommendation/controls/main/pricePlacement.d.ts +5 -6
  48. package/dist/src/extensions/Blocks/Recommendation/controls/main/productLayout.d.ts +3 -6
  49. package/dist/src/extensions/Blocks/Recommendation/controls/main/utils.d.ts +9 -21
  50. package/dist/src/extensions/Blocks/Recommendation/controls/mobileLayout/cssRules.d.ts +13 -19
  51. package/dist/src/extensions/Blocks/Recommendation/controls/name/index.d.ts +0 -7
  52. package/dist/src/extensions/Blocks/Recommendation/controls/oldPrice/index.d.ts +0 -7
  53. package/dist/src/extensions/Blocks/Recommendation/controls/omnibusDiscount/index.d.ts +0 -7
  54. package/dist/src/extensions/Blocks/Recommendation/controls/omnibusPrice/index.d.ts +0 -7
  55. package/dist/src/extensions/Blocks/Recommendation/controls/price/index.d.ts +0 -7
  56. package/dist/src/extensions/Blocks/Recommendation/controls/shared/textTrimCssRules.d.ts +8 -10
  57. package/dist/src/extensions/Blocks/Recommendation/controls/spacing/index.d.ts +5 -9
  58. package/dist/src/extensions/Blocks/Recommendation/controls/title/index.d.ts +0 -7
  59. package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +1 -8
  60. package/dist/src/extensions/Blocks/Recommendation/utils/nodeConfigWriter.d.ts +11 -18
  61. package/dist/src/extensions/Blocks/_Boilerplate/controls/blockBackground/index.d.ts +0 -1
  62. package/dist/src/extensions/Blocks/controlFactories.d.ts +0 -22
  63. package/dist/src/stores/editor.d.ts +1 -3
  64. package/dist/src/utils/fullStoryScripts.d.ts +6 -0
  65. package/dist/static/styles/components/button.css.js +0 -5
  66. package/dist/stores/editor.js +0 -5
  67. package/dist/utils/fullStoryScripts.js +8 -0
  68. package/package.json +3 -3
  69. package/dist/extensions/Blocks/Recommendation/utils/blockRefresh.js +0 -28
  70. package/dist/extensions/Blocks/Recommendation/utils/currencySettings.js +0 -25
  71. package/dist/src/extensions/Blocks/Recommendation/utils/blockRefresh.d.ts +0 -17
  72. package/dist/src/extensions/Blocks/Recommendation/utils/currencySettings.d.ts +0 -6
@@ -1,481 +1,455 @@
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";
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
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";
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) {
13
- if (!e)
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)
14
14
  return null;
15
- if ("getAttribute" in e) {
16
- const t = e.getAttribute("class");
17
- if (t && t.includes(N))
18
- return e;
15
+ if ("getAttribute" in t) {
16
+ const e = t.getAttribute("class");
17
+ if (e && e.includes(O))
18
+ return t;
19
19
  }
20
- return "querySelector" in e ? e.querySelector(`.${N}`) ?? null : null;
20
+ return "querySelector" in t ? t.querySelector(`.${O}`) ?? 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 te(t) {
23
+ const e = P(t);
24
+ return !e || !("getAttribute" in e) ? !1 : (e.getAttribute("class") ?? "").split(/\s+/).includes(W);
25
25
  }
26
- function T(e) {
27
- const t = y(e);
28
- if (!t || !("getAttribute" in t))
26
+ function T(t) {
27
+ const e = P(t);
28
+ if (!e || !("getAttribute" in e))
29
29
  return "grid";
30
- const n = t.getAttribute("data-layout");
30
+ const n = e.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 B(t, e = {}) {
34
+ const n = P(t);
35
35
  if (!n || !("getAttribute" in n))
36
36
  return I;
37
- const o = n.getAttribute(O);
37
+ const o = n.getAttribute(q);
38
38
  return o ? H(
39
39
  o.split(",").filter(Boolean),
40
40
  n,
41
- t
41
+ e
42
42
  ) : I;
43
43
  }
44
- function P(e, t) {
45
- const n = h.getConfig(e);
46
- return t ? { ...n, ...t } : n;
47
- }
48
- function $(e) {
49
- if (!e || !("childNodes" in e))
44
+ function $(t) {
45
+ if (!t || !("childNodes" in t))
50
46
  return null;
51
- const t = e.childNodes(), n = t.find(
47
+ const e = t.childNodes(), n = e.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 || e.reduce((o, r) => o || !("getType" in r) || r.getType() === "text" ? o : $(r), null);
55
51
  }
56
- function b(e, t, n) {
57
- const o = $(t);
58
- return !o || "getTextContent" in o && o.getTextContent() === n ? !1 : (e.modifyHtml(o).setText(n), !0);
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);
59
55
  }
60
- function S(e, t, n, o) {
61
- return "getAttribute" in t && t.getAttribute(n) === o ? !1 : (e.modifyHtml(t).setAttribute(n, o), !0);
56
+ function A(t, e, n, o) {
57
+ return "getAttribute" in e && e.getAttribute(n) === o ? !1 : (t.modifyHtml(e).setAttribute(n, o), !0);
62
58
  }
63
- function j(e, t) {
64
- return e && e.length > 0 ? e : t.length > 0 ? t : B();
59
+ function v(t, e) {
60
+ return t && t.length > 0 ? t : e.length > 0 ? e : U();
65
61
  }
66
- function F(e) {
67
- if (typeof e == "number")
68
- return `0 ${e / 2}px`;
62
+ function j(t) {
63
+ if (typeof t == "number")
64
+ return `0 ${t / 2}px`;
69
65
  }
70
- function ot(e) {
71
- const { currentNode: t, documentModifier: n } = e;
72
- if (!t || !("querySelector" in t))
66
+ function ne(t) {
67
+ const { currentNode: e, documentModifier: n } = t;
68
+ if (!e || !("querySelector" in e))
73
69
  return !1;
74
- const o = t.querySelector(D);
70
+ const o = e.querySelector(k);
75
71
  return o ? (n.modifyHtml(o).setInnerHtml(""), !0) : !1;
76
72
  }
77
- function rt(e) {
78
- return "getOuterHTML" in e && typeof e.getOuterHTML == "function" ? e.getOuterHTML() : "";
73
+ function oe(t) {
74
+ return "getOuterHTML" in t && typeof t.getOuterHTML == "function" ? t.getOuterHTML() : "";
79
75
  }
80
- function it(e) {
81
- const t = e.querySelector(".container");
82
- return !t || !("childNodes" in t) ? null : t.childNodes().find((o) => "getTagName" in o && o.getTagName() === "tbody") ?? t.querySelector("tbody") ?? null;
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;
83
79
  }
84
- function lt(e, t, n) {
85
- const o = it(e);
80
+ function ie(t, e, n) {
81
+ const o = re(t);
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(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"));
90
86
  }
91
- function Y(e, t = {}) {
87
+ function F(t, e = {}) {
92
88
  const {
93
89
  currentNode: n,
94
90
  documentModifier: o,
95
91
  products: r,
96
- layout: u,
97
- composition: s
98
- } = e;
92
+ layout: s,
93
+ composition: l
94
+ } = t;
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,
97
+ const u = s ?? T(n), i = g.getConfig(n);
98
+ 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, {
101
+ productsPerRow: i.mobileCardsInRow,
106
102
  composition: f,
107
- filterList: l.filterList,
108
- priceInline: !c.priceMovedToNextLine,
103
+ filterList: c.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,
112
- ...t
113
- })}</table></td>`, E = n.querySelector(D);
114
- return E ? (o.modifyHtml(E).setInnerHtml(g), !0) : (lt(n, o, g), !1);
106
+ cellPadding: j(i.mobileColumnSpacing),
107
+ 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);
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 Te(t) {
113
+ F(t, D(t.currentNode)) && t.documentModifier.apply(new C("Updated mobile product rows"));
119
114
  }
120
- function ct(e, t = {}) {
115
+ function le(t, e = {}) {
121
116
  const {
122
117
  currentNode: n,
123
118
  documentModifier: o,
124
119
  products: r,
125
- layout: u,
126
- composition: s
127
- } = e;
120
+ layout: s,
121
+ composition: l
122
+ } = t;
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(w) ?? n.querySelector(Y);
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 = 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, {
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,
141
- ...t
134
+ cellPadding: j(p.columnSpacing),
135
+ rowSpacingPx: p.rowSpacing,
136
+ ...e
142
137
  });
143
- return o.modifyHtml(i).setInnerHtml(g), !0;
138
+ return o.modifyHtml(u).setInnerHtml(y), !0;
144
139
  }
145
- function ut(e) {
146
- if (!e)
140
+ function ce(t) {
141
+ if (!t)
147
142
  return null;
148
143
  try {
149
- const t = JSON.parse(e);
150
- return Array.isArray(t) ? t.map((n) => String(n)) : null;
144
+ const e = JSON.parse(t);
145
+ return Array.isArray(e) ? e.map((n) => String(n)) : null;
151
146
  } catch {
152
147
  return null;
153
148
  }
154
149
  }
155
- function st(e, t, n) {
156
- const o = y(e);
150
+ function ue(t, e, n) {
151
+ const o = P(t);
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 = 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)
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
+ e.modifyHtml(o).setAttribute(d, p);
166
+ }), c && g.hasConfig(t)) {
167
+ const d = {
168
+ ...g.getConfig(t),
169
+ composition: u
175
170
  };
176
- t.modifyHtml(e).setNodeConfig(a);
171
+ e.modifyHtml(t).setNodeConfig(d);
177
172
  }
178
173
  return !0;
179
174
  }
180
- function Ot(e) {
175
+ function Re(t) {
181
176
  const {
182
- currentNode: t,
177
+ currentNode: e,
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
191
- } = e;
192
- if (!t)
181
+ layout: s,
182
+ composition: l,
183
+ skipStylePreservation: u
184
+ } = t;
185
+ if (!e)
193
186
  return !1;
194
- const d = i ? {} : U(t), f = {
195
- currentNode: t,
187
+ const i = u ? {} : D(e), c = {
188
+ currentNode: e,
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 = 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;
204
196
  }
205
- function ht(e, t) {
206
- return e.length === t ? e : e.length > t ? e.slice(0, t) : [...e, ...B(t - e.length)];
197
+ function qe(t, e) {
198
+ return t.length === e ? t : t.length > e ? t.slice(0, e) : [...t, ...U(e - t.length)];
207
199
  }
208
- function G() {
209
- const e = C(), { currencySettings: t } = e.recommendationConfigs, n = parseInt(t.decimalCount);
200
+ function K() {
201
+ const t = E(), { currencySettings: e } = t.recommendationConfigs, n = parseInt(e.decimalCount);
210
202
  return {
211
- code: t.value,
212
- symbol: t.symbol,
213
- alignment: t.alignment === "0" ? "before" : "after",
203
+ code: e.value,
204
+ symbol: e.symbol,
205
+ alignment: e.alignment === "0" ? "before" : "after",
214
206
  decimalCount: Number.isNaN(n) ? 2 : n,
215
- decimalSeparator: t.decimalSeparator,
216
- thousandSeparator: t.thousandSeparator
207
+ decimalSeparator: e.decimalSeparator,
208
+ thousandSeparator: e.thousandSeparator
217
209
  };
218
210
  }
219
- 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;
221
- return Q({
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({
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 se(t) {
219
+ 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;
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 V(t) {
224
+ const { documentModifier: e, product: n, priceEl: o, oldPriceEl: r, omnibusPriceEl: s, omnibusDiscountEl: l } = t;
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(e, 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(e, i ?? null, c) && (u = !0), A(e, r, "data-same-price", String(Z(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(e, 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 = se(n);
240
+ S(e, i, c) && (u = !0);
241
+ }
242
+ return u;
251
243
  }
252
- function ft(e) {
244
+ function ae(t) {
253
245
  const {
254
- documentModifier: t,
246
+ documentModifier: e,
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
263
- } = e;
264
- let d = !1;
250
+ priceEl: s,
251
+ oldPriceEl: l,
252
+ omnibusPriceEl: u,
253
+ omnibusDiscountEl: i,
254
+ buttonEl: c
255
+ } = t;
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(e, f, "src", Q(n.image_url)), y = A(e, 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(e, 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(e, f ?? null, n.name) && (a = !0);
277
269
  }
278
- if (K({
279
- documentModifier: t,
270
+ if (V({
271
+ documentModifier: e,
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(e, 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 G(t) {
284
+ return "querySelector" in t ? t.querySelector(w) ?? t : t;
293
285
  }
294
- function dt(e, t) {
286
+ function fe(t, e) {
295
287
  var o;
296
288
  let n;
297
- if (e.startsWith(M)) {
298
- const r = e.slice(M.length);
299
- n = (o = t.product_attributes) == null ? void 0 : o[r];
289
+ if (t.startsWith(M)) {
290
+ const r = t.slice(M.length);
291
+ n = (o = e.product_attributes) == null ? void 0 : o[r];
300
292
  } else
301
- n = t[e];
302
- return et(n) || null;
293
+ n = e[t];
294
+ return ee(n) || null;
303
295
  }
304
- function mt(e, t, n) {
305
- if (!("querySelectorAll" in e))
296
+ function de(t, e, n) {
297
+ if (!("querySelectorAll" in t))
306
298
  return !1;
307
- const o = e.querySelectorAll(
299
+ const o = t.querySelectorAll(
308
300
  `[esd-extension-block-id="${m.CUSTOM_ATTRIBUTE}"]`
309
301
  );
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(z);
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 = fe(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(e, d, f) && (s = !0);
333
325
  });
334
- }), u;
326
+ }), s;
335
327
  }
336
- function _(e, t, n) {
337
- if (!("querySelectorAll" in e))
328
+ function _(t, e, n) {
329
+ if (!("querySelectorAll" in t))
338
330
  return !1;
339
- const o = e.querySelectorAll(
331
+ const o = t.querySelectorAll(
340
332
  `[esd-extension-block-id="${m.IMAGE}"]`
341
- ), r = e.querySelectorAll(
333
+ ), r = t.querySelectorAll(
342
334
  `[esd-extension-block-id="${m.NAME}"]`
343
- ), u = e.querySelectorAll(
335
+ ), s = t.querySelectorAll(
344
336
  `[esd-extension-block-id="${m.PRICE}"]`
345
- ), s = e.querySelectorAll(
337
+ ), l = t.querySelectorAll(
346
338
  `[esd-extension-block-id="${m.OLD_PRICE}"]`
347
- ), i = e.querySelectorAll(
339
+ ), u = t.querySelectorAll(
348
340
  `[esd-extension-block-id="${m.OMNIBUS_PRICE}"]`
349
- ), c = e.querySelectorAll(
341
+ ), i = t.querySelectorAll(
350
342
  `[esd-extension-block-id="${m.OMNIBUS_DISCOUNT}"]`
351
- ), l = e.querySelectorAll(
343
+ ), c = t.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({
357
- 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
347
+ for (let d = 0; d < a; d++) {
348
+ const p = ae({
349
+ documentModifier: e,
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 de(t, e, 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;
373
- if (!t || !("querySelectorAll" in t))
363
+ function he(t) {
364
+ const { currentNode: e, documentModifier: n, products: o, onApplied: r } = t;
365
+ if (!e || !("querySelectorAll" in e))
374
366
  return !1;
375
- const i = V(t);
376
- if (!("querySelectorAll" in i) || i.querySelectorAll(
367
+ const s = G(e);
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(e), c = g.getConfig(e);
374
+ if (i !== "list" && c.mobileLayoutEnabled && "querySelector" in e) {
375
+ const a = e.querySelector(L);
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) {
396
- if (!("querySelectorAll" in e))
387
+ function N(t, e, n) {
388
+ if (!("querySelectorAll" in t))
397
389
  return !1;
398
- const o = e.querySelectorAll(
390
+ const o = t.querySelectorAll(
399
391
  `[esd-extension-block-id="${m.PRICE}"]`
400
- ), r = e.querySelectorAll(
392
+ ), r = t.querySelectorAll(
401
393
  `[esd-extension-block-id="${m.OLD_PRICE}"]`
402
- ), u = e.querySelectorAll(
394
+ ), s = t.querySelectorAll(
403
395
  `[esd-extension-block-id="${m.OMNIBUS_PRICE}"]`
404
- ), s = e.querySelectorAll(
396
+ ), l = t.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({
410
- 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;
421
- if (!t || !("querySelectorAll" in t))
398
+ ), u = Math.min(o.length, n.length);
399
+ let i = !1;
400
+ for (let c = 0; c < u; c++)
401
+ V({
402
+ documentModifier: 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 Me(t) {
412
+ const { currentNode: e, documentModifier: n } = t;
413
+ if (!e || !("querySelectorAll" in e))
422
414
  return !1;
423
- if (nt(t))
415
+ if (te(e))
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 = 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);
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 Ie(t) {
433
+ const { currentNode: e, documentModifier: n, currency: o } = t, r = P(e);
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
+ qe as adjustProductsToSize,
468
443
  R as formatProductPrice,
469
- y as getBlockElement,
470
- v as getCardComposition,
471
- Nt as getCurrencyAttributesFromBlock,
444
+ P as getBlockElement,
445
+ B 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
+ re as getMainContainerTbody,
448
+ te as isPartnerManagedBlock,
449
+ Te as regenerateMobileProductRows,
450
+ Re as regenerateProductRowsWithStyles,
451
+ Ie as setCurrencyAttributes,
452
+ Me as updatePricesInPlace,
453
+ he as updateProductContentInPlace,
454
+ ae as updateSingleProductContent
481
455
  };