@useinsider/guido 3.6.0-beta.4f2bf14 → 3.6.0-beta.7ac8612

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 (33) hide show
  1. package/dist/composables/useHtmlValidator.js +131 -102
  2. package/dist/composables/useStripoEventHandler.js +11 -13
  3. package/dist/config/compiler/utils/recommendationCompilerUtils.js +28 -27
  4. package/dist/config/compiler/utils/recommendationIgnoreUtils.js +15 -0
  5. package/dist/config/migrator/recommendation/extractors.js +44 -22
  6. package/dist/config/migrator/recommendation/htmlBuilder.js +175 -169
  7. package/dist/config/migrator/recommendationMigrator.js +30 -31
  8. package/dist/extensions/Blocks/Recommendation/constants/selectors.js +21 -15
  9. package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +38 -24
  10. package/dist/extensions/Blocks/Recommendation/controls/main/index.js +57 -52
  11. package/dist/extensions/Blocks/Recommendation/controls/main/layoutOrientation.js +45 -34
  12. package/dist/extensions/Blocks/Recommendation/controls/main/productCount.js +3 -2
  13. package/dist/extensions/Blocks/Recommendation/controls/main/productLayout.js +62 -52
  14. package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +74 -67
  15. package/dist/extensions/Blocks/Recommendation/controls/syncInfoMessage.js +7 -6
  16. package/dist/extensions/Blocks/Recommendation/extension.js +6 -5
  17. package/dist/extensions/Blocks/Recommendation/settingsPanel.js +3 -2
  18. package/dist/extensions/Blocks/Recommendation/store/recommendation.js +3 -2
  19. package/dist/extensions/Blocks/Recommendation/templates/grid/template.js +3 -2
  20. package/dist/extensions/Blocks/Recommendation/templates/index.js +5 -4
  21. package/dist/src/composables/useHtmlValidator.d.ts +9 -0
  22. package/dist/src/config/compiler/utils/recommendationIgnoreUtils.d.ts +17 -0
  23. package/dist/src/config/compiler/utils/recommendationIgnoreUtils.test.d.ts +1 -0
  24. package/dist/src/config/migrator/recommendation/extractors.d.ts +15 -0
  25. package/dist/src/config/migrator/recommendation/htmlBuilder.d.ts +8 -0
  26. package/dist/src/extensions/Blocks/Recommendation/constants/index.d.ts +1 -1
  27. package/dist/src/extensions/Blocks/Recommendation/constants/selectors.d.ts +21 -0
  28. package/dist/src/extensions/Blocks/Recommendation/controls/cardComposition/index.d.ts +7 -0
  29. package/dist/src/extensions/Blocks/Recommendation/controls/main/layoutOrientation.d.ts +5 -0
  30. package/dist/src/extensions/Blocks/Recommendation/controls/main/productLayout.d.ts +6 -0
  31. package/dist/src/extensions/Blocks/Recommendation/controls/main/utils.d.ts +9 -0
  32. package/package.json +1 -1
  33. /package/dist/src/composables/{useStripoEventHandler.test.d.ts → useHtmlValidator.test.d.ts} +0 -0
@@ -1,16 +1,16 @@
1
1
  import { RecommendationBlockId as g } from "../../../extensions/Blocks/Recommendation/constants/blockIds.js";
2
- import { CURRENCY_ATTR as R, ATTR_PRODUCT_IMAGE as I, ATTR_PRODUCT_BUTTON as N, CSS_CLASS_RECO_BUTTON as z, ATTR_PRODUCT_NAME as G, ATTR_PRODUCT_PRICE as H, ATTR_PRODUCT_OLD_PRICE as j, ATTR_PRODUCT_OMNIBUS_PRICE as U, ATTR_PRODUCT_OMNIBUS_DISCOUNT as V, ATTR_CUSTOM_PREFIX as E } from "../../../extensions/Blocks/Recommendation/constants/selectors.js";
3
- import { formatPrice as v } from "../../../extensions/Blocks/Recommendation/utils/priceFormatter.js";
4
- import { escapeHtml as c } from "../../../utils/htmlEscape.js";
2
+ import { CSS_CLASS_SKIP_COMPILE as ot, CURRENCY_ATTR as P, ATTR_PRODUCT_IMAGE as O, ATTR_PRODUCT_BUTTON as k, CSS_CLASS_RECO_BUTTON as H, ATTR_PRODUCT_NAME as j, ATTR_PRODUCT_PRICE as V, ATTR_PRODUCT_OLD_PRICE as Y, ATTR_PRODUCT_OMNIBUS_PRICE as M, ATTR_PRODUCT_OMNIBUS_DISCOUNT as F, ATTR_CUSTOM_PREFIX as E } from "../../../extensions/Blocks/Recommendation/constants/selectors.js";
3
+ import { formatPrice as L } from "../../../extensions/Blocks/Recommendation/utils/priceFormatter.js";
4
+ import { escapeHtml as r } from "../../../utils/htmlEscape.js";
5
5
  import { appendStyle as $ } from "./themeMapper.js";
6
- const Y = "https://email-static.useinsider.com/stripo/modules/email-recommendation-v3/assets/images/image-placeholder.png", F = "attribute-cell", J = "Buy", X = "border-width: 1px; background: rgb(217, 234, 211); border-color: rgb(106, 168, 79)", K = "color: rgb(56, 118, 29); background: rgb(217, 234, 211); font-family: arial, 'helvetica neue', helvetica, sans-serif; font-size: 16px; font-weight: normal; line-height: 120%; mso-border-alt: 10px solid rgb(217, 234, 211); mso-padding-alt: 0", ot = "ins-recommendation-product-container ins-recommendation-desktop-container";
7
- function nt(t) {
6
+ const J = "https://email-static.useinsider.com/stripo/modules/email-recommendation-v3/assets/images/image-placeholder.png", K = "attribute-cell", X = "Buy", q = "border-width: 1px; background: rgb(217, 234, 211); border-color: rgb(106, 168, 79)", Q = "color: rgb(56, 118, 29); background: rgb(217, 234, 211); font-family: arial, 'helvetica neue', helvetica, sans-serif; font-size: 16px; font-weight: normal; line-height: 120%; mso-border-alt: 10px solid rgb(217, 234, 211); mso-padding-alt: 0", nt = "ins-recommendation-product-container ins-recommendation-desktop-container";
7
+ function lt(t) {
8
8
  return t.replace(/>\s+</g, "><").trim();
9
9
  }
10
10
  function y(t) {
11
- return t ? ` align="${c(t)}"` : ' align="center"';
11
+ return t ? ` align="${r(t)}"` : ' align="center"';
12
12
  }
13
- function _() {
13
+ function R() {
14
14
  return {
15
15
  tdStyle: "",
16
16
  pStyle: "",
@@ -19,36 +19,36 @@ function _() {
19
19
  textTrimming: !1
20
20
  };
21
21
  }
22
- function q(t) {
23
- return t ? { ...t, wrapBold: !0 } : { ..._(), wrapBold: !0 };
22
+ function Z(t) {
23
+ return t ? { ...t, wrapBold: !0 } : { ...R(), wrapBold: !0 };
24
24
  }
25
- function k(t, o) {
26
- let e = c(t);
25
+ function v(t, o) {
26
+ let e = r(t);
27
27
  return o.wrapBold && o.wrapItalic ? e = `<strong><em>${e}</em></strong>` : o.wrapBold ? e = `<strong>${e}</strong>` : o.wrapItalic && (e = `<em>${e}</em>`), e;
28
28
  }
29
- function b(t) {
30
- return t ? ` style="${c(t)}"` : "";
29
+ function u(t) {
30
+ return t ? ` style="${r(t)}"` : "";
31
31
  }
32
- function O(t, o) {
33
- return `<td width="${t}%" class="${F}" ${o}`;
32
+ function I(t, o) {
33
+ return `<td width="${t}%" class="${K}" ${o}`;
34
34
  }
35
- function lt(t, o, e, l) {
35
+ function st(t, o, e, l) {
36
36
  const s = t.width ? ` width="${t.width}"` : "", n = t.height ? ` height="${t.height}"` : "", i = ["display: block", "max-width: 100%", "height: auto"];
37
37
  t.width && i.push(`width: ${t.width}px`), t.height && i.push(`height: ${t.height}px`);
38
- const a = i.join("; "), r = e ? ` style="background-color: ${c(e)}"` : "";
38
+ const c = i.join("; "), a = e ? ` style="background-color: ${r(e)}"` : "";
39
39
  return `
40
- ${O(l, 'valign="top" style="padding: 0 5px; height: 100%"')}>
40
+ ${I(l, 'valign="top" style="padding: 0 5px; height: 100%"')}>
41
41
  <table width="100%" height="100%" cellpadding="0" cellspacing="0" border="0"
42
- class="product-card-segment"${r}>
42
+ class="product-card-segment"${a}>
43
43
  <tbody>
44
44
  <tr valign="top">
45
45
  <td align="center"
46
46
  class="esd-block-image product-image es-p5"
47
47
  esd-extension-block-id="${g.IMAGE}">
48
48
  <a target="_blank" href="https://example.com/product/${o + 1}">
49
- <img src="${Y}" alt="Product Name"
49
+ <img src="${J}" alt="Product Name"
50
50
  class="adapt-img"${s}${n}
51
- style="${a}">
51
+ style="${c}">
52
52
  </a>
53
53
  </td>
54
54
  </tr>
@@ -57,18 +57,18 @@ function lt(t, o, e, l) {
57
57
  </td>
58
58
  `;
59
59
  }
60
- function L(t, o, e, l, s, n, i) {
61
- const r = `table-layout: fixed${n ? `; background-color: ${c(n)}` : ""}`, d = b(s.tdStyle), p = y(s.align), u = `esd-block-text ${o}`.trim(), m = $(l, s.pStyle);
60
+ function G(t, o, e, l, s, n, i) {
61
+ const a = `table-layout: fixed${n ? `; background-color: ${r(n)}` : ""}`, d = u(s.tdStyle), p = y(s.align), b = `esd-block-text ${o}`.trim(), m = $(l, s.pStyle);
62
62
  return `
63
- ${O(i, 'valign="top" style="padding: 0 5px; height: 100%"')}>
63
+ ${I(i, 'valign="top" style="padding: 0 5px; height: 100%"')}>
64
64
  <table width="100%" height="100%" cellpadding="0" cellspacing="0" border="0"
65
- class="product-card-segment" style="${r}">
65
+ class="product-card-segment" style="${a}">
66
66
  <tbody>
67
67
  <tr valign="top">
68
68
  <td${p}
69
- class="${u}"
69
+ class="${b}"
70
70
  esd-extension-block-id="${t}"${d}>
71
- <p contenteditable="false"${b(m)}>${k(e, s)}</p>
71
+ <p contenteditable="false"${u(m)}>${v(e, s)}</p>
72
72
  </td>
73
73
  </tr>
74
74
  </tbody>
@@ -76,10 +76,10 @@ function L(t, o, e, l, s, n, i) {
76
76
  </td>
77
77
  `;
78
78
  }
79
- function st(t, o, e, l) {
80
- const s = o ? ` style="background-color: ${c(o)}"` : "", n = b(t.tdStyle), i = y(t.align), r = $("font-size: 14px; color: #999999", t.pStyle);
79
+ function it(t, o, e, l) {
80
+ const s = o ? ` style="background-color: ${r(o)}"` : "", n = u(t.tdStyle), i = y(t.align), a = $("font-size: 14px; color: #999999", t.pStyle);
81
81
  return `
82
- ${O(e, 'valign="top" style="padding: 0 5px; height: 100%"')}>
82
+ ${I(e, 'valign="top" style="padding: 0 5px; height: 100%"')}>
83
83
  <table width="100%" height="100%" cellpadding="0" cellspacing="0" border="0"
84
84
  class="product-card-segment"${s}>
85
85
  <tbody>
@@ -87,8 +87,8 @@ function st(t, o, e, l) {
87
87
  <td${i}
88
88
  class="esd-block-text product-old-price es-p15l es-p15r"
89
89
  esd-extension-block-id="${g.OLD_PRICE}"${n}>
90
- <p contenteditable="false"${b(r)}>
91
- <s>${k(l, t)}</s>
90
+ <p contenteditable="false"${u(a)}>
91
+ <s>${v(l, t)}</s>
92
92
  </p>
93
93
  </td>
94
94
  </tr>
@@ -97,21 +97,21 @@ function st(t, o, e, l) {
97
97
  </td>
98
98
  `;
99
99
  }
100
- function D(t, o, e, l, s, n, i) {
101
- const a = s ? `; background-color: ${c(s)}` : "", r = b(l.tdStyle), d = y(l.align), u = $("font-size: 12px; color: #666666", l.pStyle);
100
+ function z(t, o, e, l, s, n, i) {
101
+ const c = s ? `; background-color: ${r(s)}` : "", a = u(l.tdStyle), d = y(l.align), b = $("font-size: 12px; color: #666666", l.pStyle);
102
102
  return `
103
- ${O(i, 'valign="top" style="padding: 0 5px; height: 100%"')}>
103
+ ${I(i, 'valign="top" style="padding: 0 5px; height: 100%"')}>
104
104
  <table width="100%" height="100%" cellpadding="0" cellspacing="0" border="0"
105
- class="product-card-segment" style="table-layout: fixed${a}">
105
+ class="product-card-segment" style="table-layout: fixed${c}">
106
106
  <tbody>
107
107
  <tr valign="top">
108
108
  <td${d}
109
109
  data-text-before="" data-text-after=""
110
110
  class="esd-block-text ${n} es-p15l es-p15r"
111
- esd-extension-block-id="${t}"${r}>
112
- <p contenteditable="false"${b(u)}>
111
+ esd-extension-block-id="${t}"${a}>
112
+ <p contenteditable="false"${u(b)}>
113
113
  <span class="omnibus-text-before"></span>
114
- <span class="${o}">${c(e)}</span>
114
+ <span class="${o}">${r(e)}</span>
115
115
  <span class="omnibus-text-after"></span>
116
116
  </p>
117
117
  </td>
@@ -121,10 +121,10 @@ function D(t, o, e, l, s, n, i) {
121
121
  </td>
122
122
  `;
123
123
  }
124
- function it(t, o, e, l) {
125
- const s = e ? ` style="background-color: ${c(e)}"` : "", n = $("padding: 0 5px; height: 100%", o.tdStyle), i = y(o.align), a = o.text || J, r = $(X, o.spanStyle), d = $(K, o.aStyle);
124
+ function rt(t, o, e, l) {
125
+ const s = e ? ` style="background-color: ${r(e)}"` : "", n = $("padding: 0 5px; height: 100%", o.tdStyle), i = y(o.align), c = o.text || X, a = $(q, o.spanStyle), d = $(Q, o.aStyle);
126
126
  return `
127
- ${O(l, `valign="top" style="${c(n)}"`)}>
127
+ ${I(l, `valign="top" style="${r(n)}"`)}>
128
128
  <table width="100%" height="100%" cellpadding="0" cellspacing="0" border="0"
129
129
  class="product-card-segment"${s}>
130
130
  <tbody>
@@ -132,10 +132,10 @@ function it(t, o, e, l) {
132
132
  <td${i}
133
133
  class="esd-block-button product-button es-p10t es-p10b es-p5l es-p5r"
134
134
  esd-extension-block-id="${g.BUTTON}">
135
- <span class="es-button-border" style="${c(r)}">
135
+ <span class="es-button-border" style="${r(a)}">
136
136
  <a href="https://example.com/product/${t + 1}" target="_blank"
137
- class="es-button ${z}"
138
- style="${c(d)}">${c(a)}</a>
137
+ class="es-button ${H}"
138
+ style="${r(d)}">${r(c)}</a>
139
139
  </span>
140
140
  </td>
141
141
  </tr>
@@ -145,17 +145,17 @@ function it(t, o, e, l) {
145
145
  `;
146
146
  }
147
147
  function ct(t, o, e, l, s) {
148
- const n = l ? `; background-color: ${c(l)}` : "", i = b(e.tdStyle), a = y(e.align), d = $("font-size: 12px; color: #666666; margin: 0", e.pStyle), p = o.replace(/_/g, " ").replace(/\b\w/g, (u) => u.toUpperCase());
148
+ const n = l ? `; background-color: ${r(l)}` : "", i = u(e.tdStyle), c = y(e.align), d = $("font-size: 12px; color: #666666; margin: 0", e.pStyle), p = o.replace(/_/g, " ").replace(/\b\w/g, (b) => b.toUpperCase());
149
149
  return `
150
- ${O(s, 'valign="middle" style="padding: 0 5px; height: 100%"')}>
150
+ ${I(s, 'valign="middle" style="padding: 0 5px; height: 100%"')}>
151
151
  <table width="100%" height="100%" cellpadding="0" cellspacing="0" border="0"
152
152
  class="product-card-segment" style="table-layout: fixed${n}">
153
153
  <tbody>
154
154
  <tr valign="top">
155
- <td product-attr="${c(t)}"${a}
155
+ <td product-attr="${r(t)}"${c}
156
156
  class="esd-block-text product-custom-attribute es-p0t es-p0b es-p15l es-p15r"
157
157
  esd-extension-block-id="${g.CUSTOM_ATTRIBUTE}"${i}>
158
- <p contenteditable="false"${b(d)}>${c(p)}</p>
158
+ <p contenteditable="false"${u(d)}>${r(p)}</p>
159
159
  </td>
160
160
  </tr>
161
161
  </tbody>
@@ -164,110 +164,110 @@ function ct(t, o, e, l, s) {
164
164
  `;
165
165
  }
166
166
  function at(t, o, e, l, s, n, i) {
167
- const a = o[t], r = a ?? _();
167
+ const c = o[t], a = c ?? R();
168
168
  switch (t) {
169
- case I:
170
- return lt(
171
- a ?? {},
169
+ case O:
170
+ return st(
171
+ c ?? {},
172
172
  s,
173
173
  l,
174
174
  n
175
175
  );
176
- case G:
177
- return L(
176
+ case j:
177
+ return G(
178
178
  g.NAME,
179
179
  "product-name es-p10t es-p10b es-p15l es-p15r",
180
180
  "Product Name",
181
181
  "font-size: 16px; color: #333333",
182
- r,
182
+ a,
183
183
  l,
184
184
  n
185
185
  );
186
- case H:
187
- return L(
186
+ case V:
187
+ return G(
188
188
  g.PRICE,
189
189
  "product-price es-p15l es-p15r",
190
190
  i.pricePlaceholder,
191
191
  "font-size: 16px; color: #333333",
192
- q(a),
192
+ Z(c),
193
193
  l,
194
194
  n
195
195
  );
196
- case j:
197
- return st(r, l, n, i.oldPricePlaceholder);
198
- case U:
199
- return D(
196
+ case Y:
197
+ return it(a, l, n, i.oldPricePlaceholder);
198
+ case M:
199
+ return z(
200
200
  g.OMNIBUS_PRICE,
201
201
  "omnibus-price-value",
202
202
  i.omnibusPricePlaceholder,
203
- r,
203
+ a,
204
204
  l,
205
205
  "product-omnibus-price",
206
206
  n
207
207
  );
208
- case V:
209
- return D(
208
+ case F:
209
+ return z(
210
210
  g.OMNIBUS_DISCOUNT,
211
211
  "omnibus-discount-value",
212
212
  "-10%",
213
- r,
213
+ a,
214
214
  l,
215
215
  "product-omnibus-discount",
216
216
  n
217
217
  );
218
- case N:
219
- return it(
218
+ case k:
219
+ return rt(
220
220
  s,
221
- a ?? {},
221
+ c ?? {},
222
222
  l,
223
223
  n
224
224
  );
225
225
  default:
226
226
  if (t.startsWith(E)) {
227
227
  const d = e[t] ?? t.slice(E.length), p = t.slice(E.length);
228
- return ct(d, p, r, l, n);
228
+ return ct(d, p, a, l, n);
229
229
  }
230
230
  return null;
231
231
  }
232
232
  }
233
- const Q = `
233
+ const W = `
234
234
  <tr>
235
235
  <td class="spacer" style="height: 10px"></td>
236
236
  </tr>
237
237
  `;
238
- function rt(t) {
238
+ function dt(t) {
239
239
  return {
240
- pricePlaceholder: v({ price: 18, currency: t }),
241
- oldPricePlaceholder: v({ price: 20, currency: t }),
242
- omnibusPricePlaceholder: v({ price: 20, currency: t })
240
+ pricePlaceholder: L({ price: 18, currency: t }),
241
+ oldPricePlaceholder: L({ price: 20, currency: t }),
242
+ omnibusPricePlaceholder: L({ price: 20, currency: t })
243
243
  };
244
244
  }
245
- function dt(t, o, e, l) {
246
- const { composition: s, visibility: n, perElement: i, customAttrValues: a, cardBg: r } = l, d = (100 / e).toFixed(2), p = e - o, u = `<td class="${F}" style="padding: 0 5px;" width="${d}%"></td>`, m = p > 0 ? u.repeat(p) : "";
245
+ function pt(t, o, e, l) {
246
+ const { composition: s, visibility: n, perElement: i, customAttrValues: c, cardBg: a } = l, d = (100 / e).toFixed(2), p = e - o, b = `<td class="${K}" style="padding: 0 5px;" width="${d}%"></td>`, m = p > 0 ? b.repeat(p) : "";
247
247
  return `
248
248
  <tr class="recommendation-product-row">
249
249
  <td>
250
250
  <table width="100%" height="100%" cellpadding="0" cellspacing="0" border="0"
251
251
  class="product-card-wrapper" style="table-layout: fixed">
252
252
  <tbody>${s.map((T) => {
253
- const w = n[T] !== !1, f = w ? "" : ' style="display: none"', C = w ? "1" : "0", S = [];
254
- for (let x = 0; x < o; x += 1) {
255
- const A = at(
253
+ const C = n[T] !== !1, f = C ? "" : ' style="display: none"', w = C ? "1" : "0", x = [];
254
+ for (let A = 0; A < o; A += 1) {
255
+ const _ = at(
256
256
  T,
257
257
  i,
258
+ c,
258
259
  a,
259
- r,
260
- t + x,
260
+ t + A,
261
261
  d,
262
262
  l
263
263
  );
264
- A && S.push(A);
264
+ _ && x.push(_);
265
265
  }
266
- return S.length === 0 ? "" : `
266
+ return x.length === 0 ? "" : `
267
267
  <tr class="recommendation-attribute-row"
268
- data-attribute-type="${c(T)}"
269
- data-visibility="${C}"${f}>
270
- ${S.join("")}${m}
268
+ data-attribute-type="${r(T)}"
269
+ data-visibility="${w}"${f}>
270
+ ${x.join("")}${m}
271
271
  </tr>
272
272
  `;
273
273
  }).filter(Boolean).join("")}</tbody>
@@ -276,107 +276,107 @@ function dt(t, o, e, l) {
276
276
  </tr>
277
277
  `;
278
278
  }
279
- function pt(t, o, e) {
279
+ function ut(t, o, e) {
280
280
  const l = [];
281
281
  for (let s = 0; s < t; s += o) {
282
282
  const n = Math.min(o, t - s);
283
- s > 0 && l.push(Q), l.push(dt(s, n, o, e));
283
+ s > 0 && l.push(W), l.push(pt(s, n, o, e));
284
284
  }
285
285
  return l.join("");
286
286
  }
287
- function ut(t, o, e, l) {
287
+ function bt(t, o, e, l) {
288
288
  const s = o[t];
289
- if (t === G) {
290
- const n = s ?? _(), i = $("font-size: 16px; color: #333333; margin: 0", n.pStyle), a = y(n.align ?? "left");
289
+ if (t === j) {
290
+ const n = s ?? R(), i = $("font-size: 16px; color: #333333; margin: 0", n.pStyle), c = y(n.align ?? "left");
291
291
  return `
292
292
  <td class="esd-block-text product-name"
293
- esd-extension-block-id="${g.NAME}"${a}${b(n.tdStyle)}>
294
- <p contenteditable="false"${b(i)}>${k("Product Name", n)}</p>
293
+ esd-extension-block-id="${g.NAME}"${c}${u(n.tdStyle)}>
294
+ <p contenteditable="false"${u(i)}>${v("Product Name", n)}</p>
295
295
  </td>
296
296
  `;
297
297
  }
298
- if (t === H) {
299
- const n = q(s), i = $("font-size: 16px; color: #333333; margin: 0", n.pStyle), a = y(n.align ?? "left");
298
+ if (t === V) {
299
+ const n = Z(s), i = $("font-size: 16px; color: #333333; margin: 0", n.pStyle), c = y(n.align ?? "left");
300
300
  return `
301
301
  <td class="esd-block-text product-price"
302
- esd-extension-block-id="${g.PRICE}"${a}${b(n.tdStyle)}>
303
- <p contenteditable="false"${b(i)}>${k(l.pricePlaceholder, n)}</p>
302
+ esd-extension-block-id="${g.PRICE}"${c}${u(n.tdStyle)}>
303
+ <p contenteditable="false"${u(i)}>${v(l.pricePlaceholder, n)}</p>
304
304
  </td>
305
305
  `;
306
306
  }
307
- if (t === j) {
308
- const n = s ?? _(), a = $("font-size: 14px; color: #999999; text-decoration: line-through; margin: 0", n.pStyle), r = y(n.align ?? "left");
307
+ if (t === Y) {
308
+ const n = s ?? R(), c = $("font-size: 14px; color: #999999; text-decoration: line-through; margin: 0", n.pStyle), a = y(n.align ?? "left");
309
309
  return `
310
310
  <td class="esd-block-text product-old-price"
311
- esd-extension-block-id="${g.OLD_PRICE}"${r}${b(n.tdStyle)}>
312
- <p contenteditable="false"${b(a)}><s>${k(l.oldPricePlaceholder, n)}</s></p>
311
+ esd-extension-block-id="${g.OLD_PRICE}"${a}${u(n.tdStyle)}>
312
+ <p contenteditable="false"${u(c)}><s>${v(l.oldPricePlaceholder, n)}</s></p>
313
313
  </td>
314
314
  `;
315
315
  }
316
- if (t === U || t === V) {
317
- const n = t === U, i = n ? g.OMNIBUS_PRICE : g.OMNIBUS_DISCOUNT, a = n ? "omnibus-price-value" : "omnibus-discount-value", r = n ? l.omnibusPricePlaceholder : "-10%", d = n ? "product-omnibus-price" : "product-omnibus-discount", p = s ?? _(), u = $("font-size: 12px; color: #666666; margin: 0", p.pStyle), m = y(p.align ?? "left");
316
+ if (t === M || t === F) {
317
+ const n = t === M, i = n ? g.OMNIBUS_PRICE : g.OMNIBUS_DISCOUNT, c = n ? "omnibus-price-value" : "omnibus-discount-value", a = n ? l.omnibusPricePlaceholder : "-10%", d = n ? "product-omnibus-price" : "product-omnibus-discount", p = s ?? R(), b = $("font-size: 12px; color: #666666; margin: 0", p.pStyle), m = y(p.align ?? "left");
318
318
  return `
319
319
  <td class="esd-block-text ${d}"
320
320
  data-text-before="" data-text-after=""
321
- esd-extension-block-id="${i}"${m}${b(p.tdStyle)}>
322
- <p contenteditable="false"${b(u)}>
321
+ esd-extension-block-id="${i}"${m}${u(p.tdStyle)}>
322
+ <p contenteditable="false"${u(b)}>
323
323
  <span class="omnibus-text-before"></span>
324
- <span class="${a}">${c(r)}</span>
324
+ <span class="${c}">${r(a)}</span>
325
325
  <span class="omnibus-text-after"></span>
326
326
  </p>
327
327
  </td>
328
328
  `;
329
329
  }
330
330
  if (t.startsWith(E)) {
331
- const n = s ?? _(), i = e[t] ?? t.slice(E.length), r = t.slice(E.length).replace(/_/g, " ").replace(/\b\w/g, (m) => m.toUpperCase()), d = $("font-size: 12px; color: #666666; margin: 0", n.pStyle), p = y(n.align ?? "left"), u = g.CUSTOM_ATTRIBUTE;
331
+ const n = s ?? R(), i = e[t] ?? t.slice(E.length), a = t.slice(E.length).replace(/_/g, " ").replace(/\b\w/g, (m) => m.toUpperCase()), d = $("font-size: 12px; color: #666666; margin: 0", n.pStyle), p = y(n.align ?? "left"), b = g.CUSTOM_ATTRIBUTE;
332
332
  return `
333
- <td product-attr="${c(i)}"
333
+ <td product-attr="${r(i)}"
334
334
  class="esd-block-text product-custom-attribute"
335
- esd-extension-block-id="${u}"${p}${b(n.tdStyle)}>
336
- <p contenteditable="false"${b(d)}>${c(r)}</p>
335
+ esd-extension-block-id="${b}"${p}${u(n.tdStyle)}>
336
+ <p contenteditable="false"${u(d)}>${r(a)}</p>
337
337
  </td>
338
338
  `;
339
339
  }
340
340
  return null;
341
341
  }
342
- function bt(t, o) {
343
- const { composition: e, visibility: l, perElement: s, customAttrValues: n, cardBg: i } = o, a = i ? `background-color: ${c(i)}` : "", r = a ? `style="table-layout: fixed; ${a}"` : 'style="table-layout: fixed"', d = s[I] ?? {}, p = l[I] !== !1, u = d.width ? ` width="${d.width}"` : "", m = p ? "" : ' style="display: none"', h = `
342
+ function gt(t, o) {
343
+ const { composition: e, visibility: l, perElement: s, customAttrValues: n, cardBg: i } = o, c = i ? `background-color: ${r(i)}` : "", a = c ? `style="table-layout: fixed; ${c}"` : 'style="table-layout: fixed"', d = s[O] ?? {}, p = l[O] !== !1, b = d.width ? ` width="${d.width}"` : "", m = p ? "" : ' style="display: none"', S = `
344
344
  <td width="120"
345
345
  class="esd-block-image product-image-cell recommendation-attribute-row es-p5"
346
346
  esd-extension-block-id="${g.IMAGE}"
347
- data-attribute-type="${I}"
347
+ data-attribute-type="${O}"
348
348
  data-visibility="${p ? "1" : "0"}"
349
349
  align="center" valign="middle"${m}>
350
350
  <a target="_blank" href="https://example.com/product/${t + 1}">
351
- <img src="${Y}" alt="Product Name"
352
- class="adapt-img product-image"${u}
351
+ <img src="${J}" alt="Product Name"
352
+ class="adapt-img product-image"${b}
353
353
  style="display: block; max-width: 100%; height: auto">
354
354
  </a>
355
355
  </td>
356
- `, w = `
356
+ `, C = `
357
357
  <td class="product-info-cell" valign="middle" style="padding: 15px">
358
358
  <table cellpadding="0" cellspacing="0" role="presentation" width="100%"
359
359
  style="table-layout: fixed">
360
- <tbody>${e.filter((P) => P !== I && P !== N).map((P) => {
361
- const B = l[P] !== !1, tt = B ? "" : ' style="display: none"', et = B ? "1" : "0", M = ut(P, s, n, o);
362
- return M ? `<tr class="recommendation-attribute-row"
363
- data-attribute-type="${c(P)}"
364
- data-visibility="${et}"${tt}>${M}</tr>` : "";
360
+ <tbody>${e.filter((h) => h !== O && h !== k).map((h) => {
361
+ const B = l[h] !== !1, tt = B ? "" : ' style="display: none"', et = B ? "1" : "0", D = bt(h, s, n, o);
362
+ return D ? `<tr class="recommendation-attribute-row"
363
+ data-attribute-type="${r(h)}"
364
+ data-visibility="${et}"${tt}>${D}</tr>` : "";
365
365
  }).filter(Boolean).join(`
366
366
  `)}</tbody>
367
367
  </table>
368
368
  </td>
369
- `, f = s[N] ?? {}, C = l[N] !== !1, S = f.text || J, x = $(X, f.spanStyle ?? ""), A = $(K, f.aStyle ?? ""), Z = C ? "" : ' style="display: none"', W = `
369
+ `, f = s[k] ?? {}, w = l[k] !== !1, x = f.text || X, A = $(q, f.spanStyle ?? ""), _ = $(Q, f.aStyle ?? ""), N = w ? "" : ' style="display: none"', U = `
370
370
  <td width="100"
371
371
  class="esd-block-button button-cell recommendation-attribute-row product-button es-p5l es-p5r"
372
372
  esd-extension-block-id="${g.BUTTON}"
373
- data-attribute-type="${N}"
374
- data-visibility="${C ? "1" : "0"}"
375
- align="${c(f.align ?? "center")}" valign="middle"${Z}>
376
- <span class="es-button-border" style="${c(x)}">
373
+ data-attribute-type="${k}"
374
+ data-visibility="${w ? "1" : "0"}"
375
+ align="${r(f.align ?? "center")}" valign="middle"${N}>
376
+ <span class="es-button-border" style="${r(A)}">
377
377
  <a href="https://example.com/product/${t + 1}" target="_blank"
378
- class="es-button ${z}"
379
- style="${c(A)}">${c(S)}</a>
378
+ class="es-button ${H}"
379
+ style="${r(_)}">${r(x)}</a>
380
380
  </span>
381
381
  </td>
382
382
  `;
@@ -384,37 +384,37 @@ function bt(t, o) {
384
384
  <tr class="recommendation-product-row">
385
385
  <td style="padding: 0 5px">
386
386
  <table width="100%" cellpadding="0" cellspacing="0" border="0"
387
- class="product-card-wrapper" ${r}>
387
+ class="product-card-wrapper" ${a}>
388
388
  <tbody>
389
- <tr>${h}${w}${W}</tr>
389
+ <tr>${S}${C}${U}</tr>
390
390
  </tbody>
391
391
  </table>
392
392
  </td>
393
393
  </tr>
394
394
  `;
395
395
  }
396
- function gt(t, o) {
396
+ function mt(t, o) {
397
397
  const e = [];
398
398
  for (let l = 0; l < t; l += 1)
399
- l > 0 && e.push(Q), e.push(bt(l, o));
399
+ l > 0 && e.push(W), e.push(gt(l, o));
400
400
  return e.join("");
401
401
  }
402
- function mt(t, o) {
403
- var r, d, p, u, m, h;
402
+ function $t(t, o) {
403
+ var a, d, p, b, m, S;
404
404
  const e = t == null ? void 0 : t.theme, l = [];
405
- (r = e == null ? void 0 : e.textStyle) != null && r["font-family"] && l.push(`font-family: ${e.textStyle["font-family"]}`), l.push(`font-size: ${((d = e == null ? void 0 : e.textStyle) == null ? void 0 : d["font-size"]) ?? "28px"}`), l.push(`color: ${((p = e == null ? void 0 : e.textColor) == null ? void 0 : p.color) ?? "#333333"}`), (u = e == null ? void 0 : e.textStyle) != null && u["font-weight"] && l.push(`font-weight: ${e.textStyle["font-weight"]}`), (m = e == null ? void 0 : e.textStyle) != null && m["font-style"] && l.push(`font-style: ${e.textStyle["font-style"]}`);
406
- const s = l.join("; "), n = ((h = e == null ? void 0 : e.textStyle) == null ? void 0 : h["font-weight"]) !== "normal", i = c(o), a = n ? `<strong>${i}</strong>` : i;
405
+ (a = e == null ? void 0 : e.textStyle) != null && a["font-family"] && l.push(`font-family: ${e.textStyle["font-family"]}`), l.push(`font-size: ${((d = e == null ? void 0 : e.textStyle) == null ? void 0 : d["font-size"]) ?? "28px"}`), l.push(`color: ${((p = e == null ? void 0 : e.textColor) == null ? void 0 : p.color) ?? "#333333"}`), (b = e == null ? void 0 : e.textStyle) != null && b["font-weight"] && l.push(`font-weight: ${e.textStyle["font-weight"]}`), (m = e == null ? void 0 : e.textStyle) != null && m["font-style"] && l.push(`font-style: ${e.textStyle["font-style"]}`);
406
+ const s = l.join("; "), n = ((S = e == null ? void 0 : e.textStyle) == null ? void 0 : S["font-weight"]) !== "normal", i = r(o), c = n ? `<strong>${i}</strong>` : i;
407
407
  return `
408
408
  <td class="esd-block-text es-p10t es-p10b es-p20l es-p20r" align="center">
409
- <p${b(s)}>${a}</p>
409
+ <p${u(s)}>${c}</p>
410
410
  </td>
411
411
  `;
412
412
  }
413
- function $t(t) {
413
+ function yt(t) {
414
414
  const o = t.alignment === "before" ? "0" : "1";
415
- return ` ${R.CURRENCY}="${c(t.code)}" ${R.SYMBOL}="${c(t.symbol)}" ${R.ALIGNMENT}="${o}" ${R.THOUSAND_SEPARATOR}="${c(t.thousandSeparator)}" ${R.DECIMAL_SEPARATOR}="${c(t.decimalSeparator)}" ${R.DECIMAL_COUNT}="${t.decimalCount}"`;
415
+ return ` ${P.CURRENCY}="${r(t.code)}" ${P.SYMBOL}="${r(t.symbol)}" ${P.ALIGNMENT}="${o}" ${P.THOUSAND_SEPARATOR}="${r(t.thousandSeparator)}" ${P.DECIMAL_SEPARATOR}="${r(t.decimalSeparator)}" ${P.DECIMAL_COUNT}="${t.decimalCount}"`;
416
416
  }
417
- function Tt(t) {
417
+ function Ct(t) {
418
418
  const {
419
419
  nodeConfig: o,
420
420
  composition: e,
@@ -422,18 +422,13 @@ function Tt(t) {
422
422
  titleText: s,
423
423
  extraClasses: n = "",
424
424
  legacyId: i,
425
- legacyBgColor: a
426
- } = t, r = parseInt(o.size) || 6, d = o.layout === "list" ? ' data-layout="list"' : "", p = o.layout === "list" ? " es-m-p0 ins-recommendation-list-layout" : "", u = {
427
- composition: e.composition,
428
- visibility: e.visibility,
429
- perElement: e.perElementStyles,
430
- customAttrValues: e.customAttrValues,
431
- cardBg: l,
432
- ...rt(o.currency)
433
- }, m = o.layout === "list" ? gt(r, u) : pt(r, o.cardsInRow, u), h = mt(e.titleVariable, s), T = e.composition.join(","), w = JSON.stringify(e.customAttributes), f = [
425
+ legacyBgColor: c,
426
+ preserveInnerHtml: a,
427
+ skipCompile: d = !1
428
+ } = t, p = o.layout === "list" ? ' data-layout="list"' : "", b = o.layout === "list" ? " es-m-p0 ins-recommendation-list-layout" : "", m = e.composition.join(","), S = JSON.stringify(e.customAttributes), T = [
434
429
  "recommendation-block-v2",
435
430
  "esd-block-recommendation-v3-block",
436
- `es-p20${p}`,
431
+ `es-p20${b}`,
437
432
  `ins-recommendation-v3-block-${o.recommendationId}`,
438
433
  // Marker class Stripo's block infrastructure uses to identify recommendation
439
434
  // blocks. Without it, certain Styles-panel controls (e.g. button "Fit to
@@ -442,20 +437,18 @@ function Tt(t) {
442
437
  "esd-extension-block",
443
438
  "esd-container-frame",
444
439
  "ins-recommendation-no-mobile-layout",
440
+ d ? ot : "",
445
441
  n
446
- ].filter(Boolean).join(" "), C = $t(o.currency), S = ` esd-ext-config="${c(JSON.stringify(o))}"`, x = i ? ` id="${c(i)}"` : "", A = a ? ` bgcolor="${c(a)}"` : "";
447
- return nt(`
448
- <td align="left"
449
- esd-extension-block-id="recommendation-block"
450
- width="520"
451
- class="${f}"${x}${A}
452
- recommendation-id="${o.recommendationId}"${C}
453
- data-card-composition="${c(T)}"
454
- data-custom-attributes="${c(w)}"
455
- data-column-spacing="${o.columnSpacing}"
456
- data-row-spacing="${o.rowSpacing}"
457
- data-mobile-column-spacing="${o.mobileColumnSpacing}"
458
- data-mobile-row-spacing="${o.mobileRowSpacing}"${d}${S}>
442
+ ].filter(Boolean).join(" "), C = yt(o.currency), f = ` esd-ext-config="${r(JSON.stringify(o))}"`, w = i ? ` id="${r(i)}"` : "", x = c ? ` bgcolor="${r(c)}"` : "", _ = a ?? (() => {
443
+ const N = parseInt(o.size) || 6, U = {
444
+ composition: e.composition,
445
+ visibility: e.visibility,
446
+ perElement: e.perElementStyles,
447
+ customAttrValues: e.customAttrValues,
448
+ cardBg: l,
449
+ ...dt(o.currency)
450
+ }, h = o.layout === "list" ? mt(N, U) : ut(N, o.cardsInRow, U);
451
+ return `
459
452
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
460
453
  <tbody>
461
454
  <tr>
@@ -466,7 +459,7 @@ function Tt(t) {
466
459
  <td>
467
460
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
468
461
  <tbody>
469
- <tr>${h}</tr>
462
+ <tr>${$t(e.titleVariable, s)}</tr>
470
463
  </tbody>
471
464
  </table>
472
465
  </td>
@@ -477,7 +470,7 @@ function Tt(t) {
477
470
  <tr>
478
471
  <td>
479
472
  <table width="100%" cellpadding="0" cellspacing="0" border="0"
480
- class="${ot}">${m}
473
+ class="${nt}">${h}
481
474
  </table>
482
475
  </td>
483
476
  </tr>
@@ -487,10 +480,23 @@ function Tt(t) {
487
480
  </td>
488
481
  </tr>
489
482
  </tbody>
490
- </table>
483
+ </table>`;
484
+ })();
485
+ return lt(`
486
+ <td align="left"
487
+ esd-extension-block-id="recommendation-block"
488
+ width="520"
489
+ class="${T}"${w}${x}
490
+ recommendation-id="${o.recommendationId}"${C}
491
+ data-card-composition="${r(m)}"
492
+ data-custom-attributes="${r(S)}"
493
+ data-column-spacing="${o.columnSpacing}"
494
+ data-row-spacing="${o.rowSpacing}"
495
+ data-mobile-column-spacing="${o.mobileColumnSpacing}"
496
+ data-mobile-row-spacing="${o.mobileRowSpacing}"${p}${f}>${_}
491
497
  </td>
492
498
  `);
493
499
  }
494
500
  export {
495
- Tt as buildBlockHtml
501
+ Ct as buildBlockHtml
496
502
  };