@useinsider/guido 3.2.0-beta.a14c305 → 3.2.0-beta.a961c72

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