@useinsider/guido 3.8.3-beta.96b5eeb → 3.9.0-beta.ba394b1

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 (67) hide show
  1. package/dist/@types/config/schemas.js +70 -66
  2. package/dist/composables/useCustomInterfaceAppearance.js +16 -18
  3. package/dist/composables/usePreviewMode.js +15 -14
  4. package/dist/composables/useRecommendationPreview.js +111 -0
  5. package/dist/composables/useStripo.js +39 -37
  6. package/dist/composables/useStripoNotifications.js +26 -0
  7. package/dist/config/compiler/recommendationCompilerRules.js +1 -1
  8. package/dist/config/compiler/utils/recommendationCompilerUtils.js +88 -80
  9. package/dist/config/migrator/recommendation/htmlBuilder.js +53 -52
  10. package/dist/config/migrator/recommendation/settingsMapper.js +38 -33
  11. package/dist/enums/toaster.js +2 -2
  12. package/dist/extensions/Blocks/Items/block.js +48 -29
  13. package/dist/extensions/Blocks/Items/utils/nodeConfigUtils.js +62 -45
  14. package/dist/extensions/Blocks/Recommendation/block.js +64 -42
  15. package/dist/extensions/Blocks/Recommendation/canvasPreview.css.js +16 -0
  16. package/dist/extensions/Blocks/Recommendation/constants/defaultConfig.js +41 -32
  17. package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +461 -363
  18. package/dist/extensions/Blocks/Recommendation/controls/main/index.js +99 -87
  19. package/dist/extensions/Blocks/Recommendation/controls/main/pricePlacement.js +133 -0
  20. package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +162 -160
  21. package/dist/extensions/Blocks/Recommendation/extension.js +30 -29
  22. package/dist/extensions/Blocks/Recommendation/iconsRegistry.js +21 -7
  23. package/dist/extensions/Blocks/Recommendation/recommendation.css.js +64 -4
  24. package/dist/extensions/Blocks/Recommendation/store/recommendation.js +3 -1
  25. package/dist/extensions/Blocks/Recommendation/templates/grid/elementRenderer.js +130 -96
  26. package/dist/extensions/Blocks/Recommendation/templates/grid/template.js +43 -54
  27. package/dist/extensions/Blocks/Recommendation/templates/index.js +17 -14
  28. package/dist/extensions/Blocks/Recommendation/templates/list/elementRenderer.js +86 -80
  29. package/dist/extensions/Blocks/Recommendation/templates/list/template.js +31 -40
  30. package/dist/extensions/Blocks/Recommendation/templates/utils.js +155 -102
  31. package/dist/extensions/Blocks/Recommendation/useRecommendationBlockWarning.js +7 -7
  32. package/dist/extensions/Blocks/controlFactories.js +76 -57
  33. package/dist/services/templateLibraryApi.js +9 -8
  34. package/dist/src/@types/config/schemas.d.ts +16 -0
  35. package/dist/src/composables/useConfig.d.ts +4 -0
  36. package/dist/src/composables/useRecommendationPreview.d.ts +10 -0
  37. package/dist/src/composables/useStripoNotifications.d.ts +10 -0
  38. package/dist/src/config/migrator/recommendation/settingsMapper.d.ts +1 -1
  39. package/dist/src/enums/toaster.d.ts +2 -2
  40. package/dist/src/extensions/Blocks/CouponBlock/controls/index.d.ts +1 -1
  41. package/dist/src/extensions/Blocks/Items/block.d.ts +8 -0
  42. package/dist/src/extensions/Blocks/Items/controls/index.d.ts +3 -3
  43. package/dist/src/extensions/Blocks/Items/utils/nodeConfigUtils.d.ts +1 -1
  44. package/dist/src/extensions/Blocks/Recommendation/block.d.ts +10 -0
  45. package/dist/src/extensions/Blocks/Recommendation/controls/cardComposition/index.d.ts +29 -3
  46. package/dist/src/extensions/Blocks/Recommendation/controls/index.d.ts +1 -1
  47. package/dist/src/extensions/Blocks/Recommendation/controls/main/index.d.ts +3 -1
  48. package/dist/src/extensions/Blocks/Recommendation/controls/main/pricePlacement.d.ts +59 -0
  49. package/dist/src/extensions/Blocks/Recommendation/controls/name/index.d.ts +1 -1
  50. package/dist/src/extensions/Blocks/Recommendation/controls/oldPrice/index.d.ts +1 -1
  51. package/dist/src/extensions/Blocks/Recommendation/controls/omnibusDiscount/index.d.ts +1 -1
  52. package/dist/src/extensions/Blocks/Recommendation/controls/omnibusPrice/index.d.ts +1 -1
  53. package/dist/src/extensions/Blocks/Recommendation/controls/price/index.d.ts +1 -1
  54. package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +2 -0
  55. package/dist/src/extensions/Blocks/Recommendation/templates/grid/elementRenderer.d.ts +13 -1
  56. package/dist/src/extensions/Blocks/Recommendation/templates/grid/template.d.ts +4 -4
  57. package/dist/src/extensions/Blocks/Recommendation/templates/index.d.ts +1 -1
  58. package/dist/src/extensions/Blocks/Recommendation/templates/list/elementRenderer.d.ts +10 -1
  59. package/dist/src/extensions/Blocks/Recommendation/templates/list/template.d.ts +3 -3
  60. package/dist/src/extensions/Blocks/Recommendation/templates/utils.d.ts +51 -1
  61. package/dist/src/extensions/Blocks/Recommendation/types/nodeConfig.d.ts +15 -0
  62. package/dist/src/extensions/Blocks/controlFactories.d.ts +10 -1
  63. package/dist/src/stores/config.d.ts +36 -0
  64. package/dist/src/stores/toaster.d.ts +2 -3
  65. package/dist/stores/toaster.js +10 -10
  66. package/package.json +2 -2
  67. package/dist/static/styles/components/notification.css.js +0 -74
@@ -1,14 +1,14 @@
1
1
  import { RecommendationBlockId as g } from "../../../extensions/Blocks/Recommendation/constants/blockIds.js";
2
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
3
  import { formatPrice as L } from "../../../extensions/Blocks/Recommendation/utils/priceFormatter.js";
4
- import { escapeHtml as r } from "../../../utils/htmlEscape.js";
4
+ import { escapeHtml as c } from "../../../utils/htmlEscape.js";
5
5
  import { appendStyle as $ } from "./themeMapper.js";
6
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
7
  function lt(t) {
8
8
  return t.replace(/>\s+</g, "><").trim();
9
9
  }
10
10
  function y(t) {
11
- return t ? ` align="${r(t)}"` : ' align="center"';
11
+ return t ? ` align="${c(t)}"` : ' align="center"';
12
12
  }
13
13
  function R() {
14
14
  return {
@@ -23,11 +23,11 @@ function Z(t) {
23
23
  return t ? { ...t, wrapBold: !0 } : { ...R(), wrapBold: !0 };
24
24
  }
25
25
  function v(t, o) {
26
- let e = r(t);
26
+ let e = c(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
29
  function u(t) {
30
- return t ? ` style="${r(t)}"` : "";
30
+ return t ? ` style="${c(t)}"` : "";
31
31
  }
32
32
  function I(t, o) {
33
33
  return `<td width="${t}%" class="${K}" ${o}`;
@@ -35,7 +35,7 @@ function I(t, o) {
35
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 c = i.join("; "), a = e ? ` style="background-color: ${r(e)}"` : "";
38
+ const r = i.join("; "), a = e ? ` style="background-color: ${c(e)}"` : "";
39
39
  return `
40
40
  ${I(l, 'valign="top" style="padding: 0 5px; height: 100%"')}>
41
41
  <table width="100%" height="100%" cellpadding="0" cellspacing="0" border="0"
@@ -48,7 +48,7 @@ function st(t, o, e, l) {
48
48
  <a target="_blank" href="https://example.com/product/${o + 1}">
49
49
  <img src="${J}" alt="Product Name"
50
50
  class="adapt-img"${s}${n}
51
- style="${c}">
51
+ style="${r}">
52
52
  </a>
53
53
  </td>
54
54
  </tr>
@@ -58,7 +58,7 @@ function st(t, o, e, l) {
58
58
  `;
59
59
  }
60
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);
61
+ const a = `table-layout: fixed${n ? `; background-color: ${c(n)}` : ""}`, d = u(s.tdStyle), p = y(s.align), b = `esd-block-text ${o}`.trim(), m = $(l, s.pStyle);
62
62
  return `
63
63
  ${I(i, 'valign="top" style="padding: 0 5px; height: 100%"')}>
64
64
  <table width="100%" height="100%" cellpadding="0" cellspacing="0" border="0"
@@ -77,7 +77,7 @@ function G(t, o, e, l, s, n, i) {
77
77
  `;
78
78
  }
79
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);
80
+ const s = o ? ` style="background-color: ${c(o)}"` : "", n = u(t.tdStyle), i = y(t.align), a = $("font-size: 14px; color: #999999", t.pStyle);
81
81
  return `
82
82
  ${I(e, 'valign="top" style="padding: 0 5px; height: 100%"')}>
83
83
  <table width="100%" height="100%" cellpadding="0" cellspacing="0" border="0"
@@ -98,11 +98,11 @@ function it(t, o, e, l) {
98
98
  `;
99
99
  }
100
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);
101
+ const r = s ? `; background-color: ${c(s)}` : "", a = u(l.tdStyle), d = y(l.align), b = $("font-size: 12px; color: #666666", l.pStyle);
102
102
  return `
103
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${c}">
105
+ class="product-card-segment" style="table-layout: fixed${r}">
106
106
  <tbody>
107
107
  <tr valign="top">
108
108
  <td${d}
@@ -111,7 +111,7 @@ function z(t, o, e, l, s, n, i) {
111
111
  esd-extension-block-id="${t}"${a}>
112
112
  <p contenteditable="false"${u(b)}>
113
113
  <span class="omnibus-text-before"></span>
114
- <span class="${o}">${r(e)}</span>
114
+ <span class="${o}">${c(e)}</span>
115
115
  <span class="omnibus-text-after"></span>
116
116
  </p>
117
117
  </td>
@@ -121,10 +121,10 @@ function z(t, o, e, l, s, n, i) {
121
121
  </td>
122
122
  `;
123
123
  }
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);
124
+ function ct(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), r = o.text || X, a = $(q, o.spanStyle), d = $(Q, o.aStyle);
126
126
  return `
127
- ${I(l, `valign="top" style="${r(n)}"`)}>
127
+ ${I(l, `valign="top" style="${c(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 rt(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="${r(a)}">
135
+ <span class="es-button-border" style="${c(a)}">
136
136
  <a href="https://example.com/product/${t + 1}" target="_blank"
137
137
  class="es-button ${H}"
138
- style="${r(d)}">${r(c)}</a>
138
+ style="${c(d)}">${c(r)}</a>
139
139
  </span>
140
140
  </td>
141
141
  </tr>
@@ -144,18 +144,18 @@ function rt(t, o, e, l) {
144
144
  </td>
145
145
  `;
146
146
  }
147
- function ct(t, o, e, l, s) {
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());
147
+ function rt(t, o, e, l, s) {
148
+ const n = l ? `; background-color: ${c(l)}` : "", i = u(e.tdStyle), r = 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
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="${r(t)}"${c}
155
+ <td product-attr="${c(t)}"${r}
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"${u(d)}>${r(p)}</p>
158
+ <p contenteditable="false"${u(d)}>${c(p)}</p>
159
159
  </td>
160
160
  </tr>
161
161
  </tbody>
@@ -164,11 +164,11 @@ function ct(t, o, e, l, s) {
164
164
  `;
165
165
  }
166
166
  function at(t, o, e, l, s, n, i) {
167
- const c = o[t], a = c ?? R();
167
+ const r = o[t], a = r ?? R();
168
168
  switch (t) {
169
169
  case O:
170
170
  return st(
171
- c ?? {},
171
+ r ?? {},
172
172
  s,
173
173
  l,
174
174
  n
@@ -189,7 +189,7 @@ function at(t, o, e, l, s, n, i) {
189
189
  "product-price es-p15l es-p15r",
190
190
  i.pricePlaceholder,
191
191
  "font-size: 16px; color: #333333",
192
- Z(c),
192
+ Z(r),
193
193
  l,
194
194
  n
195
195
  );
@@ -216,16 +216,16 @@ function at(t, o, e, l, s, n, i) {
216
216
  n
217
217
  );
218
218
  case k:
219
- return rt(
219
+ return ct(
220
220
  s,
221
- c ?? {},
221
+ r ?? {},
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, a, l, n);
228
+ return rt(d, p, a, l, n);
229
229
  }
230
230
  return null;
231
231
  }
@@ -243,7 +243,7 @@ function dt(t) {
243
243
  };
244
244
  }
245
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) : "";
246
+ const { composition: s, visibility: n, perElement: i, customAttrValues: r, 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>
@@ -255,7 +255,7 @@ function pt(t, o, e, l) {
255
255
  const _ = at(
256
256
  T,
257
257
  i,
258
- c,
258
+ r,
259
259
  a,
260
260
  t + A,
261
261
  d,
@@ -265,7 +265,7 @@ function pt(t, o, e, l) {
265
265
  }
266
266
  return x.length === 0 ? "" : `
267
267
  <tr class="recommendation-attribute-row"
268
- data-attribute-type="${r(T)}"
268
+ data-attribute-type="${c(T)}"
269
269
  data-visibility="${w}"${f}>
270
270
  ${x.join("")}${m}
271
271
  </tr>
@@ -287,41 +287,41 @@ function ut(t, o, e) {
287
287
  function bt(t, o, e, l) {
288
288
  const s = o[t];
289
289
  if (t === j) {
290
- const n = s ?? R(), i = $("font-size: 16px; color: #333333; margin: 0", n.pStyle), c = y(n.align ?? "left");
290
+ const n = s ?? R(), i = $("font-size: 16px; color: #333333; margin: 0", n.pStyle), r = y(n.align ?? "left");
291
291
  return `
292
292
  <td class="esd-block-text product-name"
293
- esd-extension-block-id="${g.NAME}"${c}${u(n.tdStyle)}>
293
+ esd-extension-block-id="${g.NAME}"${r}${u(n.tdStyle)}>
294
294
  <p contenteditable="false"${u(i)}>${v("Product Name", n)}</p>
295
295
  </td>
296
296
  `;
297
297
  }
298
298
  if (t === V) {
299
- const n = Z(s), i = $("font-size: 16px; color: #333333; margin: 0", n.pStyle), c = y(n.align ?? "left");
299
+ const n = Z(s), i = $("font-size: 16px; color: #333333; margin: 0", n.pStyle), r = y(n.align ?? "left");
300
300
  return `
301
301
  <td class="esd-block-text product-price"
302
- esd-extension-block-id="${g.PRICE}"${c}${u(n.tdStyle)}>
302
+ esd-extension-block-id="${g.PRICE}"${r}${u(n.tdStyle)}>
303
303
  <p contenteditable="false"${u(i)}>${v(l.pricePlaceholder, n)}</p>
304
304
  </td>
305
305
  `;
306
306
  }
307
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");
308
+ const n = s ?? R(), r = $("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
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>
312
+ <p contenteditable="false"${u(r)}><s>${v(l.oldPricePlaceholder, n)}</s></p>
313
313
  </td>
314
314
  `;
315
315
  }
316
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");
317
+ const n = t === M, i = n ? g.OMNIBUS_PRICE : g.OMNIBUS_DISCOUNT, r = 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
321
  esd-extension-block-id="${i}"${m}${u(p.tdStyle)}>
322
322
  <p contenteditable="false"${u(b)}>
323
323
  <span class="omnibus-text-before"></span>
324
- <span class="${c}">${r(a)}</span>
324
+ <span class="${r}">${c(a)}</span>
325
325
  <span class="omnibus-text-after"></span>
326
326
  </p>
327
327
  </td>
@@ -330,17 +330,17 @@ function bt(t, o, e, l) {
330
330
  if (t.startsWith(E)) {
331
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="${r(i)}"
333
+ <td product-attr="${c(i)}"
334
334
  class="esd-block-text product-custom-attribute"
335
335
  esd-extension-block-id="${b}"${p}${u(n.tdStyle)}>
336
- <p contenteditable="false"${u(d)}>${r(a)}</p>
336
+ <p contenteditable="false"${u(d)}>${c(a)}</p>
337
337
  </td>
338
338
  `;
339
339
  }
340
340
  return null;
341
341
  }
342
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 = `
343
+ const { composition: e, visibility: l, perElement: s, customAttrValues: n, cardBg: i } = o, r = i ? `background-color: ${c(i)}` : "", a = r ? `style="table-layout: fixed; ${r}"` : '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}"
@@ -360,7 +360,7 @@ function gt(t, o) {
360
360
  <tbody>${e.filter((h) => h !== O && h !== k).map((h) => {
361
361
  const B = l[h] !== !1, tt = B ? "" : ' style="display: none"', et = B ? "1" : "0", D = bt(h, s, n, o);
362
362
  return D ? `<tr class="recommendation-attribute-row"
363
- data-attribute-type="${r(h)}"
363
+ data-attribute-type="${c(h)}"
364
364
  data-visibility="${et}"${tt}>${D}</tr>` : "";
365
365
  }).filter(Boolean).join(`
366
366
  `)}</tbody>
@@ -372,11 +372,11 @@ function gt(t, o) {
372
372
  esd-extension-block-id="${g.BUTTON}"
373
373
  data-attribute-type="${k}"
374
374
  data-visibility="${w ? "1" : "0"}"
375
- align="${r(f.align ?? "center")}" valign="middle"${N}>
376
- <span class="es-button-border" style="${r(A)}">
375
+ align="${c(f.align ?? "center")}" valign="middle"${N}>
376
+ <span class="es-button-border" style="${c(A)}">
377
377
  <a href="https://example.com/product/${t + 1}" target="_blank"
378
378
  class="es-button ${H}"
379
- style="${r(_)}">${r(x)}</a>
379
+ style="${c(_)}">${c(x)}</a>
380
380
  </span>
381
381
  </td>
382
382
  `;
@@ -403,16 +403,16 @@ function $t(t, o) {
403
403
  var a, d, p, b, m, S;
404
404
  const e = t == null ? void 0 : t.theme, l = [];
405
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;
406
+ const s = l.join("; "), n = ((S = e == null ? void 0 : e.textStyle) == null ? void 0 : S["font-weight"]) !== "normal", i = c(o), r = 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${u(s)}>${c}</p>
409
+ <p${u(s)}>${r}</p>
410
410
  </td>
411
411
  `;
412
412
  }
413
413
  function yt(t) {
414
414
  const o = t.alignment === "before" ? "0" : "1";
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}"`;
415
+ return ` ${P.CURRENCY}="${c(t.code)}" ${P.SYMBOL}="${c(t.symbol)}" ${P.ALIGNMENT}="${o}" ${P.THOUSAND_SEPARATOR}="${c(t.thousandSeparator)}" ${P.DECIMAL_SEPARATOR}="${c(t.decimalSeparator)}" ${P.DECIMAL_COUNT}="${t.decimalCount}"`;
416
416
  }
417
417
  function Ct(t) {
418
418
  const {
@@ -422,7 +422,7 @@ function Ct(t) {
422
422
  titleText: s,
423
423
  extraClasses: n = "",
424
424
  legacyId: i,
425
- legacyBgColor: c,
425
+ legacyBgColor: r,
426
426
  preserveInnerHtml: a,
427
427
  skipCompile: d = !1
428
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 = [
@@ -439,7 +439,7 @@ function Ct(t) {
439
439
  "ins-recommendation-no-mobile-layout",
440
440
  d ? ot : "",
441
441
  n
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 ?? (() => {
442
+ ].filter(Boolean).join(" "), C = yt(o.currency), f = ` esd-ext-config="${c(JSON.stringify(o))}"`, w = i ? ` id="${c(i)}"` : "", x = r ? ` bgcolor="${c(r)}"` : "", _ = a ?? (() => {
443
443
  const N = parseInt(o.size) || 6, U = {
444
444
  composition: e.composition,
445
445
  visibility: e.visibility,
@@ -488,12 +488,13 @@ function Ct(t) {
488
488
  width="520"
489
489
  class="${T}"${w}${x}
490
490
  recommendation-id="${o.recommendationId}"${C}
491
- data-card-composition="${r(m)}"
492
- data-custom-attributes="${r(S)}"
491
+ data-card-composition="${c(m)}"
492
+ data-custom-attributes="${c(S)}"
493
493
  data-column-spacing="${o.columnSpacing}"
494
494
  data-row-spacing="${o.rowSpacing}"
495
495
  data-mobile-column-spacing="${o.mobileColumnSpacing}"
496
- data-mobile-row-spacing="${o.mobileRowSpacing}"${p}${f}>${_}
496
+ data-mobile-row-spacing="${o.mobileRowSpacing}"
497
+ hide-price="${o.priceHideIfSameAsDiscounted}"${p}${f}>${_}
497
498
  </td>
498
499
  `);
499
500
  }
@@ -1,70 +1,75 @@
1
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 S, DEFAULT_COLUMN_SPACING as d, DEFAULT_MOBILE_CARDS_IN_ROW as u } from "../../../extensions/Blocks/Recommendation/constants/layout.js";
3
- import { mapLegacyStrategy as c } from "../../../extensions/Blocks/Recommendation/utils/legacyStrategyMap.js";
4
- function l(t) {
2
+ import { DEFAULT_CARDS_IN_ROW as m, DEFAULT_MOBILE_ROW_SPACING as p, DEFAULT_MOBILE_COLUMN_SPACING as d, DEFAULT_ROW_SPACING as f, DEFAULT_COLUMN_SPACING as S, DEFAULT_MOBILE_CARDS_IN_ROW as a } from "../../../extensions/Blocks/Recommendation/constants/layout.js";
3
+ import { mapLegacyStrategy as l } from "../../../extensions/Blocks/Recommendation/utils/legacyStrategyMap.js";
4
+ function c(t) {
5
5
  return t === "0" || t === 0 ? "before" : "after";
6
6
  }
7
- function _(t) {
7
+ function I(t) {
8
8
  if (typeof t == "number" && Number.isFinite(t))
9
9
  return t;
10
10
  if (typeof t == "string") {
11
- const n = parseInt(t);
12
- if (!Number.isNaN(n))
13
- return n;
11
+ const o = parseInt(t);
12
+ if (!Number.isNaN(o))
13
+ return o;
14
14
  }
15
15
  return i.decimalCount;
16
16
  }
17
- function I(t) {
17
+ function _(t) {
18
18
  return t === "." || t === "," || t === " " || t === "" ? t : ",";
19
19
  }
20
- function A(t) {
20
+ function N(t) {
21
21
  return t === "." || t === "," || t === " " ? t : ".";
22
22
  }
23
- function N(t) {
23
+ function A(t) {
24
24
  if (!t || typeof t != "object")
25
25
  return { ...i };
26
- const n = t, o = n.value ?? n.name ?? i.code, r = n.symbol ?? o;
26
+ const o = t, n = o.value ?? o.name ?? i.code, r = o.symbol ?? n;
27
27
  return {
28
- code: o,
28
+ code: n,
29
29
  symbol: r,
30
- alignment: l(n.alignment),
31
- decimalCount: _(n.decimalCount),
32
- decimalSeparator: A(n.decimalSeparator),
33
- thousandSeparator: I(n.thousandSeparator)
30
+ alignment: c(o.alignment),
31
+ decimalCount: I(o.decimalCount),
32
+ decimalSeparator: N(o.decimalSeparator),
33
+ thousandSeparator: _(o.thousandSeparator)
34
34
  };
35
35
  }
36
- function R(t) {
36
+ function L(t) {
37
37
  return t === "horizontal" || t === "list" ? "list" : "grid";
38
38
  }
39
- function b(t) {
40
- return c(t) || "mostPopular";
39
+ function R(t) {
40
+ return l(t) || "mostPopular";
41
41
  }
42
- function D(t, n, o) {
43
- const r = n.rowCount ?? t.cardsInRow ?? m, a = n.totalCount ?? (typeof t.size == "string" ? parseInt(t.size) : t.size) ?? 6;
42
+ function U(t, o, n) {
43
+ const r = o.rowCount ?? t.cardsInRow ?? m, u = o.totalCount ?? (typeof t.size == "string" ? parseInt(t.size) : t.size) ?? 6;
44
44
  return {
45
- recommendationId: o,
46
- strategy: b(t.strategy),
45
+ recommendationId: n,
46
+ strategy: R(t.strategy),
47
47
  productIds: (t.productIds ?? []).map((e) => String(e)),
48
- size: String(a),
48
+ size: String(u),
49
49
  shuffleProducts: !!t.shuffleProducts,
50
50
  language: t.language ?? "en_US",
51
- currency: N(t.currencySettings),
51
+ currency: A(t.currencySettings),
52
52
  filters: (t.filters ?? []).map((e) => ({ ...e })),
53
- layout: R(t.orientation ?? n.orientation),
53
+ layout: L(t.orientation ?? o.orientation),
54
54
  cardsInRow: r,
55
- mobileCardsInRow: u,
55
+ mobileCardsInRow: a,
56
56
  mobileLayoutEnabled: !1,
57
- previousMobileCardsInRow: u,
58
- columnSpacing: d,
59
- rowSpacing: S,
60
- mobileColumnSpacing: f,
57
+ previousMobileCardsInRow: a,
58
+ columnSpacing: S,
59
+ rowSpacing: f,
60
+ mobileColumnSpacing: d,
61
61
  mobileRowSpacing: p,
62
62
  omnibusPrice: { textBefore: "", textAfter: "" },
63
63
  omnibusDiscount: { textBefore: "", textAfter: "" },
64
+ // Preserve the legacy price-placement toggles. Absent legacy keys map to
65
+ // `false`, matching the legacy default (prices inline, original price not
66
+ // gated). New Guido blocks default differently (see DEFAULT_NODE_CONFIG).
67
+ priceMovedToNextLine: !!t.isPriceMovedToNextLine,
68
+ priceHideIfSameAsDiscounted: !!t.isPriceDeletedForZeroSale,
64
69
  configVersion: s
65
70
  };
66
71
  }
67
72
  export {
68
- N as mapCurrency,
69
- D as mapSettings
73
+ A as mapCurrency,
74
+ U as mapSettings
70
75
  };
@@ -1,4 +1,4 @@
1
- var c = /* @__PURE__ */ ((r) => (r.Success = "success", r.Warning = "warning", r.Alert = "alert", r.Dark = "dark", r))(c || {});
1
+ var n = /* @__PURE__ */ ((r) => (r.Success = "success", r.Warning = "warning", r.Alert = "error", r.Info = "information", r))(n || {});
2
2
  export {
3
- c as ToasterTypeOptions
3
+ n as ToasterTypeOptions
4
4
  };
@@ -1,20 +1,20 @@
1
- import { BlockId as g } from "../../../enums/block.js";
1
+ import { BlockId as u } from "../../../enums/block.js";
2
2
  import { useOnboardingStore as p } from "../../../stores/onboarding.js";
3
- import { getMigrationBannerHtml as f } from "../../../utils/migrationBannerHtml.js";
4
- import { Block as u, BlockCompositionType as I, ModificationDescription as o } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
5
- import { SETTINGS_ENUMS as a, DefaultConfigValues as i } from "./enums/settingsEnums.js";
6
- import { getDefaultTemplate as C } from "./template.js";
7
- import { getItemsBlockContainer as y, getItemsBlockConfig as b, getDefaultItemsBlockConfig as h } from "./utils/nodeConfigUtils.js";
8
- const c = g.Items;
9
- class E extends u {
3
+ import { getMigrationBannerHtml as C } from "../../../utils/migrationBannerHtml.js";
4
+ import { Block as I, BlockCompositionType as y, ModificationDescription as s } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
5
+ import { SETTINGS_ENUMS as c, DefaultConfigValues as a } from "./enums/settingsEnums.js";
6
+ import { getDefaultTemplate as h } from "./template.js";
7
+ import { getItemsBlockContainer as l, getItemsBlockConfig as m, getDefaultItemsBlockConfig as b } from "./utils/nodeConfigUtils.js";
8
+ const d = u.Items;
9
+ class E extends I {
10
10
  getId() {
11
- return c;
11
+ return d;
12
12
  }
13
13
  getIcon() {
14
14
  return "items-icon";
15
15
  }
16
16
  getBlockCompositionType() {
17
- return I.CONTAINER;
17
+ return y.CONTAINER;
18
18
  }
19
19
  getName() {
20
20
  return this.api.translate("Items");
@@ -23,41 +23,60 @@ class E extends u {
23
23
  return this.api.translate("Items lets you display personalized products based on user behavior.");
24
24
  }
25
25
  getSettingsPanelTitleHtml() {
26
- return f(
27
- c,
26
+ return C(
27
+ d,
28
28
  this.api.translate("Items"),
29
29
  this.api.translate("This block is switched from the Old Version to the New Version. We recommend you check the Items block and test your message to ensure it works properly.")
30
30
  );
31
31
  }
32
32
  getTemplate() {
33
- return C({
34
- orientation: a.ORIENTATION.VERTICAL,
35
- itemsType: a.ITEMS_TYPE.CART_ITEMS,
33
+ return h({
34
+ orientation: c.ORIENTATION.VERTICAL,
35
+ itemsType: c.ITEMS_TYPE.CART_ITEMS,
36
36
  itemId: "{{Abandoned Cart Item (1) Url}}",
37
- currencySymbol: i.productPriceCurrencySymbolControlValue,
38
- currencyLocation: i.productPriceCurrencyLocationControlValue,
39
- formattedPrice: i.productPriceFormattedControlValue === "1"
37
+ currencySymbol: a.productPriceCurrencySymbolControlValue,
38
+ currencyLocation: a.productPriceCurrencyLocationControlValue,
39
+ formattedPrice: a.productPriceFormattedControlValue === "1"
40
40
  });
41
41
  }
42
42
  allowInnerBlocksDND() {
43
43
  return !1;
44
44
  }
45
- onCreated(n) {
46
- const l = this.api.getDocumentModifier(), r = this.api.getDocumentRootCssNode();
47
- r.querySelector('[product-attr="imageSrc"] img') || l.modifyCss(r).appendRule('[product-attr="imageSrc"] img {object-fit: contain;}');
48
- const e = y(n);
49
- if (!e)
45
+ canBeSavedAsModule() {
46
+ return !0;
47
+ }
48
+ onCreated(i) {
49
+ const n = this.api.getDocumentModifier(), r = this.api.getDocumentRootCssNode();
50
+ r.querySelector('[product-attr="imageSrc"] img') || n.modifyCss(r).appendRule('[product-attr="imageSrc"] img {object-fit: contain;}');
51
+ const t = l(i);
52
+ if (!t)
50
53
  return;
51
- const s = e.getNodeConfig(), m = s && Object.keys(s).length > 0, t = b(n);
52
- if (t != null && t.initialized)
53
- m ? t.blockInstanceId || this.api.getDocumentModifier().modifyHtml(e).setNodeConfig({ ...t, blockInstanceId: String(Date.now()) }).apply(new o("Assign block instance ID to block")) : this.api.getDocumentModifier().modifyHtml(e).setNodeConfig(t).apply(new o("Migrate legacy config to nodeConfig"));
54
+ const e = t.getNodeConfig(), g = e && Object.keys(e).length > 0, o = m(i);
55
+ if (o != null && o.initialized)
56
+ g ? o.blockInstanceId || this.api.getDocumentModifier().modifyHtml(t).setNodeConfig({ ...o, blockInstanceId: String(Date.now()) }).apply(new s("Assign block instance ID to block")) : this.api.getDocumentModifier().modifyHtml(t).setNodeConfig(o).apply(new s("Migrate legacy config to nodeConfig"));
54
57
  else {
55
- const d = h();
56
- this.api.getDocumentModifier().modifyHtml(e).setNodeConfig(d).apply(new o("Initialize Items block with default configuration")), p().startOnboarding("itemsOnboarding");
58
+ const f = b();
59
+ this.api.getDocumentModifier().modifyHtml(t).setNodeConfig(f).apply(new s("Initialize Items block with default configuration")), p().startOnboarding("itemsOnboarding");
57
60
  }
58
61
  }
62
+ /**
63
+ * Re-seeds nodeConfig from the persisted esd-ext-config when a saved module
64
+ * surfaces via document load. Stripo strips esd-ext-config and never restores it
65
+ * into nodeConfig, so without this a reused module would reset to defaults.
66
+ * Guarded to the nodeConfig-empty case so it runs once and never loops.
67
+ */
68
+ onDocumentChanged(i) {
69
+ const n = l(i);
70
+ if (!n)
71
+ return;
72
+ const r = n.getNodeConfig();
73
+ if (r && Object.keys(r).length > 0)
74
+ return;
75
+ const e = m(i);
76
+ e != null && e.initialized && this.api.getDocumentModifier().modifyHtml(n).setNodeConfig(e).apply(new s("Recover Items block config from saved module"));
77
+ }
59
78
  }
60
79
  export {
61
- c as BLOCK_ID,
80
+ d as BLOCK_ID,
62
81
  E as ItemsBlock
63
82
  };