@useinsider/guido 3.2.0-beta.8b4780a → 3.2.0-beta.8f147c3

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