@useinsider/guido 3.30.0 → 3.30.1

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 (29) hide show
  1. package/dist/components/organisms/email-preview/desktop-preview/DesktopPreview.vue.js +11 -16
  2. package/dist/components/organisms/email-preview/mobile-preview/ContentView.vue.js +11 -11
  3. package/dist/components/organisms/extensions/recommendation/AssignStrategyDrawer.vue2.js +51 -51
  4. package/dist/components/organisms/validation/ValidationErrorDrawer.vue.js +3 -3
  5. package/dist/composables/useExport.js +8 -7
  6. package/dist/composables/useHtmlValidator.js +102 -100
  7. package/dist/composables/useToaster.js +11 -10
  8. package/dist/composables/useVersionHistoryApi.js +22 -21
  9. package/dist/composables/validators/useLiquidValidator.js +26 -24
  10. package/dist/config/migrator/itemsBlockMigrator.js +164 -161
  11. package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +148 -141
  12. package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +53 -53
  13. package/dist/extensions/Blocks/Recommendation/templates/grid/elementRenderer.js +40 -39
  14. package/dist/extensions/Blocks/Recommendation/templates/grid/template.js +27 -26
  15. package/dist/extensions/Blocks/Recommendation/templates/list/elementRenderer.js +33 -32
  16. package/dist/extensions/Blocks/Recommendation/templates/list/template.js +23 -22
  17. package/dist/extensions/Blocks/Recommendation/templates/utils.js +79 -78
  18. package/dist/extensions/Blocks/Recommendation/utils/compositionKeys.js +50 -41
  19. package/dist/guido.css +1 -1
  20. package/dist/package.json.js +1 -1
  21. package/dist/src/extensions/Blocks/Recommendation/utils/compositionKeys.d.ts +2 -0
  22. package/dist/src/stores/preview.d.ts +3 -0
  23. package/dist/src/utils/ampPreviewSanitizer.d.ts +5 -0
  24. package/dist/src/utils/htmlEscape.d.ts +5 -0
  25. package/dist/stores/preview.js +21 -15
  26. package/dist/utils/ampPreviewSanitizer.js +46 -0
  27. package/dist/utils/htmlEscape.js +5 -1
  28. package/dist/utils/pairProductVariables.js +98 -108
  29. package/package.json +1 -1
@@ -5,9 +5,9 @@ import { RecommendationConfigService as g } from "../../services/configService.j
5
5
  import { useRecommendationExtensionStore as E } from "../../store/recommendation.js";
6
6
  import { prepareProductRows as D } from "../../templates/index.js";
7
7
  import { captureStyles as H } from "../../utils/captureStyleTemplates.js";
8
- import { normalizeCompositionKeys as U, 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 O, sanitizeImageUrl as Z, isSamePrice as ee, toDisplayableAttributeValue as te } from "../../templates/utils.js";
8
+ import { normalizeCompositionKeys as U, dropMalformedCompositionKeys as X, normalizeCustomAttrValues as Q } from "../../utils/compositionKeys.js";
9
+ import { formatPrice as Z } from "../../utils/priceFormatter.js";
10
+ import { getDefaultProducts as B, DEFAULT_CARD_COMPOSITION as O, sanitizeImageUrl as ee, isSamePrice as te, toDisplayableAttributeValue as ne } from "../../templates/utils.js";
11
11
  const L = "recommendation-block-v2";
12
12
  function P(e) {
13
13
  if (!e)
@@ -19,7 +19,7 @@ function P(e) {
19
19
  }
20
20
  return "querySelector" in e ? e.querySelector(`.${L}`) ?? null : null;
21
21
  }
22
- function ne(e) {
22
+ function oe(e) {
23
23
  const t = P(e);
24
24
  return !t || !("getAttribute" in t) ? !1 : (t.getAttribute("class") ?? "").split(/\s+/).includes(Y);
25
25
  }
@@ -36,7 +36,7 @@ function $(e, t = {}) {
36
36
  return O;
37
37
  const o = n.getAttribute(q);
38
38
  return o ? U(
39
- o.split(",").filter(Boolean),
39
+ X(o.split(",").filter(Boolean)),
40
40
  n,
41
41
  t
42
42
  ) : O;
@@ -59,32 +59,32 @@ function A(e, t, n, o) {
59
59
  function j(e, t) {
60
60
  return e && e.length > 0 ? e : t.length > 0 ? t : B();
61
61
  }
62
- function F(e) {
62
+ function K(e) {
63
63
  if (typeof e == "number")
64
64
  return `0 ${e / 2}px`;
65
65
  }
66
- function oe(e) {
66
+ function re(e) {
67
67
  const { currentNode: t, documentModifier: n } = e;
68
68
  if (!t || !("querySelector" in t))
69
69
  return !1;
70
70
  const o = t.querySelector(x);
71
71
  return o ? (n.modifyHtml(o).setInnerHtml(""), !0) : !1;
72
72
  }
73
- function re(e) {
73
+ function ie(e) {
74
74
  return "getOuterHTML" in e && typeof e.getOuterHTML == "function" ? e.getOuterHTML() : "";
75
75
  }
76
- function ie(e) {
76
+ function le(e) {
77
77
  const t = e.querySelector(".container");
78
78
  return !t || !("childNodes" in t) ? null : t.childNodes().find((o) => "getTagName" in o && o.getTagName() === "tbody") ?? t.querySelector("tbody") ?? null;
79
79
  }
80
- function le(e, t, n) {
81
- const o = ie(e);
80
+ function ce(e, t, n) {
81
+ const o = le(e);
82
82
  if (!o || !("childNodes" in o))
83
83
  return;
84
- const r = o.childNodes().map(re).join(""), s = `<tr class="ins-recommendation-mobile-row">${n}</tr>`;
84
+ const r = o.childNodes().map(ie).join(""), s = `<tr class="ins-recommendation-mobile-row">${n}</tr>`;
85
85
  t.modifyHtml(o).setInnerHtml(r + s), t.apply(new C("Added mobile product row"));
86
86
  }
87
- function K(e, t = {}) {
87
+ function F(e, t = {}) {
88
88
  const {
89
89
  currentNode: n,
90
90
  documentModifier: o,
@@ -96,23 +96,23 @@ function K(e, t = {}) {
96
96
  return !1;
97
97
  const u = s ?? T(n), l = g.getConfig(n), c = e.mobileLayoutEnabled ?? l.mobileLayoutEnabled;
98
98
  if (u === "list" || !c)
99
- return oe({ currentNode: n, documentModifier: o });
99
+ return re({ currentNode: n, documentModifier: o });
100
100
  const f = E(), a = j(r, f.recommendationProducts), d = i ?? $(n, f.filterList), y = `<td><table class="ins-recommendation-product-container ins-recommendation-mobile-container" width="100%" cellpadding="0" cellspacing="0" border="0">${D(a, u, {
101
101
  productsPerRow: l.mobileCardsInRow,
102
102
  composition: d,
103
103
  filterList: f.filterList,
104
104
  priceInline: !l.priceMovedToNextLine,
105
105
  // Match the initial render's gutter so a regeneration never changes block height (SD-143023, #386).
106
- cellPadding: F(l.mobileColumnSpacing),
106
+ cellPadding: K(l.mobileColumnSpacing),
107
107
  rowSpacingPx: l.mobileRowSpacing,
108
108
  ...t
109
109
  })}</table></td>`, h = n.querySelector(x);
110
- return h ? (o.modifyHtml(h).setInnerHtml(y), !0) : (le(n, o, y), !1);
110
+ return h ? (o.modifyHtml(h).setInnerHtml(y), !0) : (ce(n, o, y), !1);
111
111
  }
112
- function Re(e) {
113
- K(e, H(e.currentNode)) && e.documentModifier.apply(new C("Updated mobile product rows"));
112
+ function qe(e) {
113
+ F(e, H(e.currentNode)) && e.documentModifier.apply(new C("Updated mobile product rows"));
114
114
  }
115
- function ce(e, t = {}) {
115
+ function ue(e, t = {}) {
116
116
  const {
117
117
  currentNode: n,
118
118
  documentModifier: o,
@@ -131,13 +131,13 @@ function ce(e, t = {}) {
131
131
  filterList: l.filterList,
132
132
  priceInline: !p.priceMovedToNextLine,
133
133
  // Match the initial render's gutter so a regeneration never changes block height (SD-143023, #386).
134
- cellPadding: F(p.columnSpacing),
134
+ cellPadding: K(p.columnSpacing),
135
135
  rowSpacingPx: p.rowSpacing,
136
136
  ...t
137
137
  });
138
138
  return o.modifyHtml(u).setInnerHtml(y), !0;
139
139
  }
140
- function ue(e) {
140
+ function se(e) {
141
141
  if (!e)
142
142
  return null;
143
143
  try {
@@ -147,7 +147,7 @@ function ue(e) {
147
147
  return null;
148
148
  }
149
149
  }
150
- function se(e, t, n) {
150
+ function ae(e, t, n) {
151
151
  const o = P(e);
152
152
  if (n || !o || !("getAttribute" in o))
153
153
  return !1;
@@ -156,9 +156,9 @@ function se(e, t, n) {
156
156
  return !1;
157
157
  const s = E(), i = r.split(",").filter(Boolean), u = U(i, o, s.filterList), l = [], c = u.join(",") !== i.join(",");
158
158
  c && l.push([q, u.join(",")]);
159
- const f = ue(
159
+ const f = se(
160
160
  o.getAttribute(M)
161
- ), a = f && X(f, o, s.filterList);
161
+ ), a = f && Q(f, o, s.filterList);
162
162
  if (f && a && a.join(",") !== f.join(",") && l.push([M, JSON.stringify(a)]), l.length === 0)
163
163
  return !1;
164
164
  if (l.forEach(([d, p]) => {
@@ -172,7 +172,7 @@ function se(e, t, n) {
172
172
  }
173
173
  return !0;
174
174
  }
175
- function qe(e) {
175
+ function he(e) {
176
176
  const {
177
177
  currentNode: t,
178
178
  documentModifier: n,
@@ -192,10 +192,10 @@ function qe(e) {
192
192
  layout: s,
193
193
  composition: i
194
194
  };
195
- let a = ce(f, c);
196
- return a = K(f, c) || a, a && (se(t, n, i), n.apply(new C(l ?? "Regenerate products with styles"))), o == null || o(), a;
195
+ let a = ue(f, c);
196
+ return a = F(f, c) || a, a && (ae(t, n, i), n.apply(new C(l ?? "Regenerate products with styles"))), o == null || o(), a;
197
197
  }
198
- function he(e, t) {
198
+ function Me(e, t) {
199
199
  return e.length === t ? e : e.length > t ? e.slice(0, t) : [...e, ...B(t - e.length)];
200
200
  }
201
201
  function V() {
@@ -211,12 +211,12 @@ function V() {
211
211
  }
212
212
  function R(e, t = "price") {
213
213
  const n = V(), o = e[t], r = (o == null ? void 0 : o[n.code]) ?? Object.values(o ?? {})[0] ?? 0;
214
- return Q({
214
+ return Z({
215
215
  price: r,
216
216
  currency: n
217
217
  });
218
218
  }
219
- function ae(e) {
219
+ function fe(e) {
220
220
  var s, i;
221
221
  const t = V(), 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;
222
222
  return r > 0 ? `-${r}%` : "0%";
@@ -230,19 +230,19 @@ function G(e) {
230
230
  }
231
231
  if (r && "querySelector" in r) {
232
232
  const l = r.querySelector("strong") ?? r.querySelector("p"), c = R(n, "original_price");
233
- S(t, l ?? null, c) && (u = !0), A(t, r, "data-same-price", String(ee(n))) && (u = !0);
233
+ S(t, l ?? null, c) && (u = !0), A(t, r, "data-same-price", String(te(n))) && (u = !0);
234
234
  }
235
235
  if (s && "querySelector" in s) {
236
236
  const l = s.querySelector(".omnibus-price-value") ?? null, c = R(n, "original_price");
237
237
  S(t, l, c) && (u = !0);
238
238
  }
239
239
  if (i && "querySelector" in i) {
240
- const l = i.querySelector(".omnibus-discount-value") ?? null, c = ae(n);
240
+ const l = i.querySelector(".omnibus-discount-value") ?? null, c = fe(n);
241
241
  S(t, l, c) && (u = !0);
242
242
  }
243
243
  return u;
244
244
  }
245
- function fe(e) {
245
+ function de(e) {
246
246
  const {
247
247
  documentModifier: t,
248
248
  product: n,
@@ -258,7 +258,7 @@ function fe(e) {
258
258
  if (o && "querySelector" in o) {
259
259
  const a = o.querySelector("img");
260
260
  if (a) {
261
- const p = A(t, a, "src", Z(n.image_url)), y = A(t, a, "alt", n.name);
261
+ const p = A(t, a, "src", ee(n.image_url)), y = A(t, a, "alt", n.name);
262
262
  f = f || p || y;
263
263
  }
264
264
  const d = o.querySelector("a");
@@ -284,7 +284,7 @@ function fe(e) {
284
284
  function W(e) {
285
285
  return "querySelector" in e ? e.querySelector(k) ?? e : e;
286
286
  }
287
- function de(e, t) {
287
+ function me(e, t) {
288
288
  var o;
289
289
  let n;
290
290
  if (e.startsWith(I)) {
@@ -292,9 +292,9 @@ function de(e, t) {
292
292
  n = (o = t.product_attributes) == null ? void 0 : o[r];
293
293
  } else
294
294
  n = t[e];
295
- return te(n) || null;
295
+ return ne(n) || null;
296
296
  }
297
- function me(e, t, n) {
297
+ function pe(e, t, n) {
298
298
  if (!("querySelectorAll" in e))
299
299
  return !1;
300
300
  const o = e.querySelectorAll(
@@ -318,7 +318,7 @@ function me(e, t, n) {
318
318
  i.slice(0, l).forEach((c, f) => {
319
319
  if (!("querySelector" in c))
320
320
  return;
321
- const a = de(u, n[f]);
321
+ const a = me(u, n[f]);
322
322
  if (a === null)
323
323
  return;
324
324
  const d = c.querySelector("p") ?? null;
@@ -346,7 +346,7 @@ function _(e, t, n) {
346
346
  ), f = Math.min(o.length, n.length);
347
347
  let a = !1;
348
348
  for (let d = 0; d < f; d++) {
349
- const p = fe({
349
+ const p = de({
350
350
  documentModifier: t,
351
351
  product: n[d],
352
352
  imageEl: o[d] ?? null,
@@ -359,9 +359,9 @@ function _(e, t, n) {
359
359
  });
360
360
  a = a || p;
361
361
  }
362
- return me(e, t, n) && (a = !0), a;
362
+ return pe(e, t, n) && (a = !0), a;
363
363
  }
364
- function Me(e) {
364
+ function Ie(e) {
365
365
  const { currentNode: t, documentModifier: n, products: o, onApplied: r, description: s } = e;
366
366
  if (!t || !("querySelectorAll" in t))
367
367
  return !1;
@@ -409,11 +409,11 @@ function N(e, t, n) {
409
409
  }) && (l = !0);
410
410
  return l;
411
411
  }
412
- function Ie(e) {
412
+ function Oe(e) {
413
413
  const { currentNode: t, documentModifier: n } = e;
414
414
  if (!t || !("querySelectorAll" in t))
415
415
  return !1;
416
- if (ne(t))
416
+ if (oe(t))
417
417
  return !0;
418
418
  const r = E().recommendationProducts;
419
419
  if (r.length === 0)
@@ -430,7 +430,7 @@ function Ie(e) {
430
430
  }
431
431
  return i && n.apply(new C("Updated price formatting in-place")), i;
432
432
  }
433
- function Oe(e) {
433
+ function Le(e) {
434
434
  const { currentNode: t, documentModifier: n, currency: o } = e, r = P(t);
435
435
  if (!r)
436
436
  return;
@@ -440,17 +440,17 @@ function Oe(e) {
440
440
  i(b.CURRENCY, o.code), i(b.SYMBOL, o.symbol), i(b.ALIGNMENT, s), i(b.THOUSAND_SEPARATOR, o.thousandSeparator), i(b.DECIMAL_SEPARATOR, o.decimalSeparator), i(b.DECIMAL_COUNT, o.decimalCount.toString()), n.apply(new C("Update currency attributes"));
441
441
  }
442
442
  export {
443
- he as adjustProductsToSize,
443
+ Me as adjustProductsToSize,
444
444
  R as formatProductPrice,
445
445
  P as getBlockElement,
446
446
  $ as getCardComposition,
447
447
  T as getCurrentLayout,
448
- ie as getMainContainerTbody,
449
- ne as isPartnerManagedBlock,
450
- Re as regenerateMobileProductRows,
451
- qe as regenerateProductRowsWithStyles,
452
- Oe as setCurrencyAttributes,
453
- Ie as updatePricesInPlace,
454
- Me as updateProductContentInPlace,
455
- fe as updateSingleProductContent
448
+ le as getMainContainerTbody,
449
+ oe as isPartnerManagedBlock,
450
+ qe as regenerateMobileProductRows,
451
+ he as regenerateProductRowsWithStyles,
452
+ Le as setCurrencyAttributes,
453
+ Oe as updatePricesInPlace,
454
+ Ie as updateProductContentInPlace,
455
+ de as updateSingleProductContent
456
456
  };
@@ -1,6 +1,7 @@
1
+ import { escapeHtml as h } from "../../../../../utils/htmlEscape.js";
1
2
  import { RecommendationBlockId as t } from "../../constants/blockIds.js";
2
- import { ATTR_PRODUCT_ATTR as h, ATTR_PRODUCT_BUTTON as E, CSS_CLASS_RECO_BUTTON as S, ATTR_PRODUCT_OMNIBUS_DISCOUNT as U, ATTR_PRODUCT_OMNIBUS_PRICE as v, ATTR_PRODUCT_OLD_PRICE as n, ATTR_PRODUCT_PRICE as I, ATTR_PRODUCT_NAME as L, ATTR_PRODUCT_IMAGE as D } from "../../constants/selectors.js";
3
- import { formatProductPrice as _, cellBgStyleAttr as T, renderStyledParagraph as C, resolveSegmentBgStyle as N, CUSTOM_CELL_HTML as M, DEFAULT_BUTTON_BORDER_STYLE as z, DEFAULT_BUTTON_ANCHOR_STYLE as G, renderButtonLabel as F, resolveButtonBorderClass as H, resolvePStyle as s, getCurrentCurrencyConfig as O, resolveOmnibusText as P, isSamePrice as w, DEFAULT_IMG_STYLE as Y, sanitizeImageUrl as j } from "../utils.js";
3
+ import { ATTR_PRODUCT_ATTR as E, ATTR_PRODUCT_BUTTON as U, CSS_CLASS_RECO_BUTTON as R, ATTR_PRODUCT_OMNIBUS_DISCOUNT as v, ATTR_PRODUCT_OMNIBUS_PRICE as n, ATTR_PRODUCT_OLD_PRICE as I, ATTR_PRODUCT_PRICE as L, ATTR_PRODUCT_NAME as D, ATTR_PRODUCT_IMAGE as N } from "../../constants/selectors.js";
4
+ import { formatProductPrice as _, cellBgStyleAttr as T, renderStyledParagraph as m, resolveSegmentBgStyle as M, CUSTOM_CELL_HTML as z, DEFAULT_BUTTON_BORDER_STYLE as G, DEFAULT_BUTTON_ANCHOR_STYLE as F, renderButtonLabel as H, resolveButtonBorderClass as O, resolvePStyle as S, getCurrentCurrencyConfig as w, resolveOmnibusText as P, isSamePrice as Y, DEFAULT_IMG_STYLE as j, sanitizeImageUrl as q } from "../utils.js";
4
5
  const g = "0 5px", $ = "attribute-cell", B = {
5
6
  pStyle: "font-size: 16px; color: #333333;",
6
7
  openTags: "<strong>",
@@ -10,36 +11,36 @@ const g = "0 5px", $ = "attribute-cell", B = {
10
11
  openTags: "<s><strong>",
11
12
  closeTags: "</strong></s>"
12
13
  };
13
- function Q(c, e = g) {
14
+ function W(c, e = g) {
14
15
  return `<td class="${$}" style="padding: ${e};" width="${c}%"></td>`;
15
16
  }
16
17
  function b(c, e = "") {
17
- const l = N(e, c);
18
+ const l = M(e, c);
18
19
  return `<table class="product-card-segment" width="100%" height="100%" cellpadding="0" cellspacing="0" border="0"${l ? ` style="${l}"` : ""}>`;
19
20
  }
20
- function V(c, e = !0, l, a, d) {
21
+ function X(c, e = !0, l, a, d) {
21
22
  const r = _(c, "price"), u = _(c, "original_price"), A = r === u, x = (y) => `<td
22
23
  class="esd-block-text product-price ${y}"
23
24
  align="${(l == null ? void 0 : l.cellAlignment) ?? "center"}"
24
25
  valign="middle"
25
26
  esd-extension-block-id="${t.PRICE}"${T(l == null ? void 0 : l.cellBackgroundColor)}>
26
- ${C(
27
+ ${m(
27
28
  r,
28
29
  B,
29
30
  l == null ? void 0 : l.styleTemplate
30
31
  )}
31
- </td>`, m = (y) => `<td
32
+ </td>`, C = (y) => `<td
32
33
  class="esd-block-text product-old-price ${y}"
33
34
  align="${(a == null ? void 0 : a.cellAlignment) ?? "center"}"
34
35
  valign="middle"
35
36
  data-same-price="${A}"
36
37
  esd-extension-block-id="${t.OLD_PRICE}"${T(a == null ? void 0 : a.cellBackgroundColor)}>
37
- ${C(
38
+ ${m(
38
39
  u,
39
40
  f,
40
41
  a == null ? void 0 : a.styleTemplate
41
42
  )}
42
- </td>`, k = e ? m("es-p15l es-p5r") : x("es-p15l es-p5r"), R = e ? x("es-p5l es-p15r") : m("es-p5l es-p15r");
43
+ </td>`, k = e ? C("es-p15l es-p5r") : x("es-p15l es-p5r"), s = e ? x("es-p5l es-p15r") : C("es-p5l es-p15r");
43
44
  return `
44
45
  <td class="${$}" style="padding: ${g}; height: 100%;" valign="top">
45
46
  ${b(d)}
@@ -50,7 +51,7 @@ function V(c, e = !0, l, a, d) {
50
51
  <tbody>
51
52
  <tr valign="middle">
52
53
  ${k}
53
- ${R}
54
+ ${s}
54
55
  </tr>
55
56
  </tbody>
56
57
  </table>
@@ -61,10 +62,10 @@ function V(c, e = !0, l, a, d) {
61
62
  </td>
62
63
  `;
63
64
  }
64
- const W = {
65
- [D]: (c, e) => {
65
+ const Z = {
66
+ [N]: (c, e) => {
66
67
  var d;
67
- const l = (e == null ? void 0 : e.cellPadding) ?? g, a = ((d = e == null ? void 0 : e.styleTemplate) == null ? void 0 : d.imgStyle) ?? Y;
68
+ const l = (e == null ? void 0 : e.cellPadding) ?? g, a = ((d = e == null ? void 0 : e.styleTemplate) == null ? void 0 : d.imgStyle) ?? j;
68
69
  return `
69
70
  <td class="${$}" style="padding: ${l}; height: 100%;" valign="top">
70
71
  ${b(e == null ? void 0 : e.cardBackgroundColor)}
@@ -74,9 +75,9 @@ const W = {
74
75
  class="esd-block-image product-image"
75
76
  align="center"
76
77
  esd-extension-block-id="${t.IMAGE}">
77
- <a target="_blank" href="${c.url}" class="${S}">
78
+ <a target="_blank" href="${c.url}" class="${R}">
78
79
  <img
79
- src="${j(c.image_url)}"
80
+ src="${q(c.image_url)}"
80
81
  alt="${c.name}"
81
82
  style="${a}"
82
83
  class="adapt-img">
@@ -88,8 +89,8 @@ const W = {
88
89
  </td>
89
90
  `;
90
91
  },
91
- [L]: (c, e) => {
92
- const l = (e == null ? void 0 : e.cellPadding) ?? g, a = C(
92
+ [D]: (c, e) => {
93
+ const l = (e == null ? void 0 : e.cellPadding) ?? g, a = m(
93
94
  c.name,
94
95
  { pStyle: "font-size: 16px; color: #333333;", openTags: "<strong>", closeTags: "</strong>" },
95
96
  e == null ? void 0 : e.styleTemplate
@@ -111,8 +112,8 @@ const W = {
111
112
  </td>
112
113
  `;
113
114
  },
114
- [I]: (c, e) => {
115
- const l = (e == null ? void 0 : e.cellPadding) ?? g, a = C(
115
+ [L]: (c, e) => {
116
+ const l = (e == null ? void 0 : e.cellPadding) ?? g, a = m(
116
117
  _(c, "price"),
117
118
  B,
118
119
  e == null ? void 0 : e.styleTemplate
@@ -134,8 +135,8 @@ const W = {
134
135
  </td>
135
136
  `;
136
137
  },
137
- [n]: (c, e) => {
138
- const l = (e == null ? void 0 : e.cellPadding) ?? g, a = C(
138
+ [I]: (c, e) => {
139
+ const l = (e == null ? void 0 : e.cellPadding) ?? g, a = m(
139
140
  _(c, "original_price"),
140
141
  f,
141
142
  e == null ? void 0 : e.styleTemplate
@@ -148,7 +149,7 @@ const W = {
148
149
  <td
149
150
  class="esd-block-text product-old-price ${(e == null ? void 0 : e.cellClasses) ?? "es-p15l es-p15r"}"
150
151
  align="${(e == null ? void 0 : e.cellAlignment) ?? "center"}"
151
- data-same-price="${w(c)}"
152
+ data-same-price="${Y(c)}"
152
153
  esd-extension-block-id="${t.OLD_PRICE}"${T(e == null ? void 0 : e.cellBackgroundColor)}>
153
154
  ${a}
154
155
  </td>
@@ -158,8 +159,8 @@ const W = {
158
159
  </td>
159
160
  `;
160
161
  },
161
- [v]: (c, e) => {
162
- const l = (e == null ? void 0 : e.cellPadding) ?? g, a = s("font-size: 12px; color: #666666;", e == null ? void 0 : e.styleTemplate), { before: d, after: r } = P(e == null ? void 0 : e.omnibusText, "Lowest 30-day price: ");
162
+ [n]: (c, e) => {
163
+ const l = (e == null ? void 0 : e.cellPadding) ?? g, a = S("font-size: 12px; color: #666666;", e == null ? void 0 : e.styleTemplate), { before: d, after: r } = P(e == null ? void 0 : e.omnibusText, "Lowest 30-day price: ");
163
164
  return `
164
165
  <td class="${$}" style="padding: ${l}; height: 100%;" valign="top">
165
166
  ${b(e == null ? void 0 : e.cardBackgroundColor)}
@@ -183,9 +184,9 @@ const W = {
183
184
  </td>
184
185
  `;
185
186
  },
186
- [U]: (c, e) => {
187
- var R, y;
188
- const l = (e == null ? void 0 : e.cellPadding) ?? g, a = s("font-size: 12px; color: #666666;", e == null ? void 0 : e.styleTemplate), d = O(), r = ((R = c.original_price) == null ? void 0 : R[d.code]) ?? Object.values(c.original_price ?? {})[0] ?? 0, u = ((y = c.price) == null ? void 0 : y[d.code]) ?? Object.values(c.price ?? {})[0] ?? 0, A = r > 0 ? Math.round((r - u) / r * 100) : 0, x = A > 0 ? `-${A}%` : "0%", { before: m, after: k } = P(e == null ? void 0 : e.omnibusText);
187
+ [v]: (c, e) => {
188
+ var s, y;
189
+ const l = (e == null ? void 0 : e.cellPadding) ?? g, a = S("font-size: 12px; color: #666666;", e == null ? void 0 : e.styleTemplate), d = w(), r = ((s = c.original_price) == null ? void 0 : s[d.code]) ?? Object.values(c.original_price ?? {})[0] ?? 0, u = ((y = c.price) == null ? void 0 : y[d.code]) ?? Object.values(c.price ?? {})[0] ?? 0, A = r > 0 ? Math.round((r - u) / r * 100) : 0, x = A > 0 ? `-${A}%` : "0%", { before: C, after: k } = P(e == null ? void 0 : e.omnibusText);
189
190
  return `
190
191
  <td class="${$}" style="padding: ${l}; height: 100%;" valign="top">
191
192
  ${b(e == null ? void 0 : e.cardBackgroundColor)}
@@ -194,11 +195,11 @@ const W = {
194
195
  <td
195
196
  class="esd-block-text product-omnibus-discount ${(e == null ? void 0 : e.cellClasses) ?? "es-p15l es-p15r"}"
196
197
  align="${(e == null ? void 0 : e.cellAlignment) ?? "center"}"
197
- data-text-before="${m}"
198
+ data-text-before="${C}"
198
199
  data-text-after="${k}"
199
200
  esd-extension-block-id="${t.OMNIBUS_DISCOUNT}"${T(e == null ? void 0 : e.cellBackgroundColor)}>
200
201
  <p contenteditable="false" style="${a}">
201
- <span class="omnibus-text-before">${m}</span>
202
+ <span class="omnibus-text-before">${C}</span>
202
203
  <span class="omnibus-discount-value">${x}</span>
203
204
  <span class="omnibus-text-after">${k}</span>
204
205
  </p>
@@ -209,8 +210,8 @@ const W = {
209
210
  </td>
210
211
  `;
211
212
  },
212
- [E]: (c, e) => {
213
- const l = (e == null ? void 0 : e.cellPadding) ?? g, a = e == null ? void 0 : e.styleTemplate, d = (a == null ? void 0 : a.buttonBorderStyle) ?? z, r = (a == null ? void 0 : a.buttonAnchorStyle) ?? G, u = F((a == null ? void 0 : a.buttonText) ?? "Buy", a);
213
+ [U]: (c, e) => {
214
+ const l = (e == null ? void 0 : e.cellPadding) ?? g, a = e == null ? void 0 : e.styleTemplate, d = (a == null ? void 0 : a.buttonBorderStyle) ?? G, r = (a == null ? void 0 : a.buttonAnchorStyle) ?? F, u = H((a == null ? void 0 : a.buttonText) ?? "Buy", a);
214
215
  return `
215
216
  <td class="${$}" style="padding: ${l}; height: 100%;" valign="top">
216
217
  ${b(e == null ? void 0 : e.cardBackgroundColor)}
@@ -220,10 +221,10 @@ const W = {
220
221
  class="esd-block-button product-button ${(e == null ? void 0 : e.cellClasses) ?? "es-p10t es-p10b"}"
221
222
  align="${(e == null ? void 0 : e.cellAlignment) ?? "center"}"
222
223
  esd-extension-block-id="${t.BUTTON}">
223
- <span class="${H(a)}" style="${d}">
224
+ <span class="${O(a)}" style="${d}">
224
225
  <a
225
226
  href="#"
226
- class="es-button ${S}"
227
+ class="es-button ${R}"
227
228
  target="_blank"
228
229
  style="${r}">
229
230
  ${u}
@@ -243,8 +244,8 @@ const W = {
243
244
  * @param productAttrValue - Resolved product-attr value (e.g., "brand" for default, "product_attribute.rating_star" for custom)
244
245
  * @param content - Display content for the cell
245
246
  */
246
- [M]: (c, e, l) => {
247
- const a = (l == null ? void 0 : l.cellPadding) ?? g, d = C(
247
+ [z]: (c, e, l) => {
248
+ const a = (l == null ? void 0 : l.cellPadding) ?? g, d = m(
248
249
  e,
249
250
  { pStyle: "font-size: 12px; color: #666666;", openTags: "", closeTags: "" },
250
251
  l == null ? void 0 : l.styleTemplate
@@ -255,7 +256,7 @@ const W = {
255
256
  <tbody>
256
257
  <tr valign="top">
257
258
  <td
258
- ${h}="${c}"
259
+ ${E}="${h(c)}"
259
260
  class="esd-block-text product-custom-attribute ${(l == null ? void 0 : l.cellClasses) ?? "es-p0t es-p0b es-p15l es-p15r"}"
260
261
  align="${(l == null ? void 0 : l.cellAlignment) ?? "center"}"
261
262
  esd-extension-block-id="${t.CUSTOM_ATTRIBUTE}"${T(l == null ? void 0 : l.cellBackgroundColor)}>
@@ -271,7 +272,7 @@ const W = {
271
272
  export {
272
273
  $ as ATTRIBUTE_CELL_CLASS,
273
274
  g as DEFAULT_CELL_PADDING,
274
- Q as buildFillerCell,
275
- W as gridElementRenderer,
276
- V as renderInlineGridPriceCell
275
+ W as buildFillerCell,
276
+ Z as gridElementRenderer,
277
+ X as renderInlineGridPriceCell
277
278
  };
@@ -1,9 +1,10 @@
1
- import { ATTR_PRODUCT_PRICE as D, ATTR_PRODUCT_OLD_PRICE as O } from "../../constants/selectors.js";
2
- import { DEFAULT_PRODUCTS_PER_ROW as w } from "../../constants/layout.js";
3
- import { createBlockTemplate as A, getDefaultProducts as g, DEFAULTS as U, buildSpacer as h, DEFAULT_CARD_COMPOSITION as Y, buildElementRenderer as B, buildCellOptions as m, DEFAULT_CARD_VISIBILITY as F } from "../utils.js";
4
- import { DEFAULT_CELL_PADDING as W, renderInlineGridPriceCell as k, buildFillerCell as H, gridElementRenderer as x } from "./elementRenderer.js";
5
- import { resolveInlinePriceOrder as y } from "../../utils/inlinePriceOrder.js";
6
- const G = `
1
+ import { escapeHtml as D } from "../../../../../utils/htmlEscape.js";
2
+ import { ATTR_PRODUCT_PRICE as O, ATTR_PRODUCT_OLD_PRICE as w } from "../../constants/selectors.js";
3
+ import { DEFAULT_PRODUCTS_PER_ROW as A } from "../../constants/layout.js";
4
+ import { createBlockTemplate as g, getDefaultProducts as U, DEFAULTS as h, buildSpacer as Y, DEFAULT_CARD_COMPOSITION as B, buildElementRenderer as F, buildCellOptions as m, DEFAULT_CARD_VISIBILITY as W } from "../utils.js";
5
+ import { DEFAULT_CELL_PADDING as k, renderInlineGridPriceCell as H, buildFillerCell as x, gridElementRenderer as y } from "./elementRenderer.js";
6
+ import { resolveInlinePriceOrder as G } from "../../utils/inlinePriceOrder.js";
7
+ const V = `
7
8
  <tr class="recommendation-product-row">
8
9
  <td>
9
10
  <table
@@ -20,7 +21,7 @@ const G = `
20
21
  </table>
21
22
  </td>
22
23
  </tr>
23
- `, V = `
24
+ `, j = `
24
25
  <tr
25
26
  class="recommendation-attribute-row"
26
27
  data-attribute-type="{-{-ATTR_TYPE-}-}"
@@ -29,53 +30,53 @@ const G = `
29
30
  {-{-CELLS-}-}
30
31
  </tr>
31
32
  `;
32
- function j(t, r, n, e = Y, c = {}, i = {}) {
33
- const { cellPadding: s = W, cardBackgroundColor: u, visibility: a, priceInline: o = !1 } = i, d = (100 / r).toFixed(2), p = r - t.length, T = p > 0 ? H(d, s).repeat(p) : "", I = B(n, e, c), R = y(e), L = o ? e.filter((l) => l !== R.skip) : e, C = m(D, i), P = m(O, i);
33
+ function v(t, r, n, e = B, c = {}, i = {}) {
34
+ const { cellPadding: s = k, cardBackgroundColor: u, visibility: a, priceInline: o = !1 } = i, d = (100 / r).toFixed(2), p = r - t.length, T = p > 0 ? x(d, s).repeat(p) : "", I = F(n, e, c), R = G(e), L = o ? e.filter((l) => l !== R.skip) : e, C = m(O, i), P = m(w, i);
34
35
  return L.filter((l) => I[l]).map((l) => {
35
- const _ = (a == null ? void 0 : a[l]) ?? F[l] ?? !0, b = _ ? "" : 'style="display: none;"', S = m(l, i, e), f = t.map((E) => (o && l === R.anchor ? k(
36
+ const _ = (a == null ? void 0 : a[l]) ?? W[l] ?? !0, b = _ ? "" : 'style="display: none;"', f = m(l, i, e), S = t.map((E) => (o && l === R.anchor ? H(
36
37
  E,
37
38
  R.originalFirst,
38
39
  C,
39
40
  P,
40
41
  u
41
- ) : I[l](E, S)).replace("<td", `<td width="${d}%"`)).join("");
42
- return V.replace("{-{-ATTR_TYPE-}-}", l).replace("{-{-VISIBILITY-}-}", _ ? "1" : "0").replace("{-{-DISPLAY_STYLE-}-}", b).replace("{-{-CELLS-}-}", f + T);
42
+ ) : I[l](E, f)).replace("<td", `<td width="${d}%"`)).join("");
43
+ return j.replace("{-{-ATTR_TYPE-}-}", D(l)).replace("{-{-VISIBILITY-}-}", _ ? "1" : "0").replace("{-{-DISPLAY_STYLE-}-}", b).replace("{-{-CELLS-}-}", S + T);
43
44
  }).join("");
44
45
  }
45
- function v(t, r, n, e, c = {}, i = {}) {
46
+ function M(t, r, n, e, c = {}, i = {}) {
46
47
  const s = [];
47
48
  for (let o = 0; o < t.length; o += r)
48
49
  s.push(t.slice(o, o + r));
49
- const u = h(i.rowSpacingPx);
50
+ const u = Y(i.rowSpacingPx);
50
51
  return s.map((o, d) => {
51
- const p = j(
52
+ const p = v(
52
53
  o,
53
54
  r,
54
55
  n,
55
56
  e,
56
57
  c,
57
58
  i
58
- ), T = G.replace("{-{-ATTRIBUTE_ROWS-}-}", p);
59
+ ), T = V.replace("{-{-ATTRIBUTE_ROWS-}-}", p);
59
60
  return d > 0 ? u + T : T;
60
61
  }).join("");
61
62
  }
62
- function M(t, r, n, e = {}, c = {}) {
63
- return v(
63
+ function N(t, r, n, e = {}, c = {}) {
64
+ return M(
64
65
  t,
65
66
  r,
66
- x,
67
+ y,
67
68
  n,
68
69
  e,
69
70
  c
70
71
  );
71
72
  }
72
- function X(t) {
73
- const r = t ? `ins-recommendation-v3-block-${t}` : void 0, n = A("grid", r), e = g(), c = M(e, w);
74
- return n.replace("{-{-TITLE-}-}", U.TITLE).replace("{-{-PRODUCT_ROWS-}-}", c).replace("{-{-MOBILE_PRODUCT_ROWS-}-}", "");
73
+ function ee(t) {
74
+ const r = t ? `ins-recommendation-v3-block-${t}` : void 0, n = g("grid", r), e = U(), c = N(e, A);
75
+ return n.replace("{-{-TITLE-}-}", h.TITLE).replace("{-{-PRODUCT_ROWS-}-}", c).replace("{-{-MOBILE_PRODUCT_ROWS-}-}", "");
75
76
  }
76
77
  export {
77
- X as getDefaultTemplate,
78
- j as prepareGridAttributeRows,
79
- v as prepareGridProductRows,
80
- M as prepareProductRows
78
+ ee as getDefaultTemplate,
79
+ v as prepareGridAttributeRows,
80
+ M as prepareGridProductRows,
81
+ N as prepareProductRows
81
82
  };