@useinsider/guido 3.8.2-beta.189e91c → 3.8.2

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