@useinsider/guido 3.20.0 → 3.20.1-beta.04cd240

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