@useinsider/guido 3.7.0-beta.24bdfa3 → 3.7.0-beta.4311638

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 (44) hide show
  1. package/dist/@types/config/schemas.js +66 -70
  2. package/dist/composables/usePreviewMode.js +14 -15
  3. package/dist/config/compiler/utils/recommendationCompilerUtils.js +82 -90
  4. package/dist/config/migrator/recommendation/htmlBuilder.js +58 -59
  5. package/dist/config/migrator/recommendation/settingsMapper.js +33 -38
  6. package/dist/extensions/Blocks/Items/block.js +48 -29
  7. package/dist/extensions/Blocks/Items/utils/nodeConfigUtils.js +62 -45
  8. package/dist/extensions/Blocks/Recommendation/block.js +39 -58
  9. package/dist/extensions/Blocks/Recommendation/constants/defaultConfig.js +32 -41
  10. package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +288 -369
  11. package/dist/extensions/Blocks/Recommendation/controls/main/index.js +72 -84
  12. package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +66 -68
  13. package/dist/extensions/Blocks/Recommendation/iconsRegistry.js +7 -21
  14. package/dist/extensions/Blocks/Recommendation/recommendation.css.js +4 -64
  15. package/dist/extensions/Blocks/Recommendation/store/recommendation.js +5 -7
  16. package/dist/extensions/Blocks/Recommendation/templates/grid/elementRenderer.js +72 -101
  17. package/dist/extensions/Blocks/Recommendation/templates/grid/template.js +30 -31
  18. package/dist/extensions/Blocks/Recommendation/templates/index.js +7 -9
  19. package/dist/extensions/Blocks/Recommendation/templates/list/elementRenderer.js +59 -74
  20. package/dist/extensions/Blocks/Recommendation/templates/list/template.js +21 -21
  21. package/dist/extensions/Blocks/Recommendation/templates/utils.js +57 -88
  22. package/dist/src/@types/config/schemas.d.ts +0 -16
  23. package/dist/src/composables/useConfig.d.ts +0 -4
  24. package/dist/src/config/migrator/recommendation/settingsMapper.d.ts +1 -1
  25. package/dist/src/extensions/Blocks/Items/block.d.ts +8 -0
  26. package/dist/src/extensions/Blocks/Items/utils/nodeConfigUtils.d.ts +1 -1
  27. package/dist/src/extensions/Blocks/Recommendation/block.d.ts +0 -10
  28. package/dist/src/extensions/Blocks/Recommendation/controls/cardComposition/index.d.ts +3 -29
  29. package/dist/src/extensions/Blocks/Recommendation/controls/index.d.ts +1 -1
  30. package/dist/src/extensions/Blocks/Recommendation/controls/main/index.d.ts +1 -3
  31. package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +0 -2
  32. package/dist/src/extensions/Blocks/Recommendation/templates/grid/elementRenderer.d.ts +0 -16
  33. package/dist/src/extensions/Blocks/Recommendation/templates/grid/template.d.ts +4 -4
  34. package/dist/src/extensions/Blocks/Recommendation/templates/list/elementRenderer.d.ts +0 -13
  35. package/dist/src/extensions/Blocks/Recommendation/templates/list/template.d.ts +2 -3
  36. package/dist/src/extensions/Blocks/Recommendation/templates/utils.d.ts +1 -33
  37. package/dist/src/extensions/Blocks/Recommendation/types/nodeConfig.d.ts +0 -15
  38. package/dist/src/stores/config.d.ts +0 -36
  39. package/package.json +1 -1
  40. package/dist/composables/useRecommendationPreview.js +0 -100
  41. package/dist/extensions/Blocks/Recommendation/controls/main/pricePlacement.js +0 -133
  42. package/dist/src/composables/useRecommendationPreview.d.ts +0 -10
  43. package/dist/src/composables/useRecommendationPreview.test.d.ts +0 -1
  44. package/dist/src/extensions/Blocks/Recommendation/controls/main/pricePlacement.d.ts +0 -59
@@ -35,11 +35,11 @@ function O(t, o) {
35
35
  function lt(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 r = i.join("; "), a = e ? ` style="background-color: ${c(e)}"` : "";
38
+ const a = i.join("; "), r = e ? ` style="background-color: ${c(e)}"` : "";
39
39
  return `
40
40
  ${O(l, 'valign="top" style="padding: 0 5px; height: 100%"')}>
41
41
  <table width="100%" height="100%" cellpadding="0" cellspacing="0" border="0"
42
- class="product-card-segment"${a}>
42
+ class="product-card-segment"${r}>
43
43
  <tbody>
44
44
  <tr valign="top">
45
45
  <td align="center"
@@ -48,7 +48,7 @@ function lt(t, o, e, l) {
48
48
  <a target="_blank" href="https://example.com/product/${o + 1}">
49
49
  <img src="${Y}" alt="Product Name"
50
50
  class="adapt-img"${s}${n}
51
- style="${r}">
51
+ style="${a}">
52
52
  </a>
53
53
  </td>
54
54
  </tr>
@@ -57,12 +57,12 @@ function lt(t, o, e, l) {
57
57
  </td>
58
58
  `;
59
59
  }
60
- function D(t, o, e, l, s, n, i) {
61
- const a = `table-layout: fixed${n ? `; background-color: ${c(n)}` : ""}`, d = b(s.tdStyle), p = y(s.align), u = `esd-block-text ${o}`.trim(), m = $(l, s.pStyle);
60
+ function L(t, o, e, l, s, n, i) {
61
+ const r = `table-layout: fixed${n ? `; background-color: ${c(n)}` : ""}`, d = b(s.tdStyle), p = y(s.align), u = `esd-block-text ${o}`.trim(), m = $(l, s.pStyle);
62
62
  return `
63
63
  ${O(i, 'valign="top" style="padding: 0 5px; height: 100%"')}>
64
64
  <table width="100%" height="100%" cellpadding="0" cellspacing="0" border="0"
65
- class="product-card-segment" style="${a}">
65
+ class="product-card-segment" style="${r}">
66
66
  <tbody>
67
67
  <tr valign="top">
68
68
  <td${p}
@@ -77,7 +77,7 @@ function D(t, o, e, l, s, n, i) {
77
77
  `;
78
78
  }
79
79
  function st(t, o, e, l) {
80
- const s = o ? ` style="background-color: ${c(o)}"` : "", n = b(t.tdStyle), i = y(t.align), a = $("font-size: 14px; color: #999999", t.pStyle);
80
+ const s = o ? ` style="background-color: ${c(o)}"` : "", n = b(t.tdStyle), i = y(t.align), r = $("font-size: 14px; color: #999999", t.pStyle);
81
81
  return `
82
82
  ${O(e, 'valign="top" style="padding: 0 5px; height: 100%"')}>
83
83
  <table width="100%" height="100%" cellpadding="0" cellspacing="0" border="0"
@@ -87,7 +87,7 @@ function st(t, o, e, l) {
87
87
  <td${i}
88
88
  class="esd-block-text product-old-price es-p15l es-p15r"
89
89
  esd-extension-block-id="${g.OLD_PRICE}"${n}>
90
- <p contenteditable="false"${b(a)}>
90
+ <p contenteditable="false"${b(r)}>
91
91
  <s>${k(l, t)}</s>
92
92
  </p>
93
93
  </td>
@@ -97,18 +97,18 @@ function st(t, o, e, l) {
97
97
  </td>
98
98
  `;
99
99
  }
100
- function L(t, o, e, l, s, n, i) {
101
- const r = s ? `; background-color: ${c(s)}` : "", a = b(l.tdStyle), d = y(l.align), u = $("font-size: 12px; color: #666666", l.pStyle);
100
+ function D(t, o, e, l, s, n, i) {
101
+ const a = s ? `; background-color: ${c(s)}` : "", r = b(l.tdStyle), d = y(l.align), u = $("font-size: 12px; color: #666666", l.pStyle);
102
102
  return `
103
103
  ${O(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${r}">
105
+ class="product-card-segment" style="table-layout: fixed${a}">
106
106
  <tbody>
107
107
  <tr valign="top">
108
108
  <td${d}
109
109
  data-text-before="" data-text-after=""
110
110
  class="esd-block-text ${n} es-p15l es-p15r"
111
- esd-extension-block-id="${t}"${a}>
111
+ esd-extension-block-id="${t}"${r}>
112
112
  <p contenteditable="false"${b(u)}>
113
113
  <span class="omnibus-text-before"></span>
114
114
  <span class="${o}">${c(e)}</span>
@@ -122,7 +122,7 @@ function L(t, o, e, l, s, n, i) {
122
122
  `;
123
123
  }
124
124
  function it(t, o, e, l) {
125
- const s = e ? ` style="background-color: ${c(e)}"` : "", n = $("padding: 0 5px; height: 100%", o.tdStyle), i = y(o.align), r = o.text || J, a = $(X, o.spanStyle), d = $(K, o.aStyle);
125
+ const s = e ? ` style="background-color: ${c(e)}"` : "", n = $("padding: 0 5px; height: 100%", o.tdStyle), i = y(o.align), a = o.text || J, r = $(X, o.spanStyle), d = $(K, o.aStyle);
126
126
  return `
127
127
  ${O(l, `valign="top" style="${c(n)}"`)}>
128
128
  <table width="100%" height="100%" cellpadding="0" cellspacing="0" border="0"
@@ -132,10 +132,10 @@ function it(t, o, e, l) {
132
132
  <td${i}
133
133
  class="esd-block-button product-button es-p10t es-p10b es-p5l es-p5r"
134
134
  esd-extension-block-id="${g.BUTTON}">
135
- <span class="es-button-border" style="${c(a)}">
135
+ <span class="es-button-border" style="${c(r)}">
136
136
  <a href="https://example.com/product/${t + 1}" target="_blank"
137
137
  class="es-button ${z}"
138
- style="${c(d)}">${c(r)}</a>
138
+ style="${c(d)}">${c(a)}</a>
139
139
  </span>
140
140
  </td>
141
141
  </tr>
@@ -145,14 +145,14 @@ function it(t, o, e, l) {
145
145
  `;
146
146
  }
147
147
  function ct(t, o, e, l, s) {
148
- const n = l ? `; background-color: ${c(l)}` : "", i = b(e.tdStyle), r = y(e.align), d = $("font-size: 12px; color: #666666; margin: 0", e.pStyle), p = o.replace(/_/g, " ").replace(/\b\w/g, (u) => u.toUpperCase());
148
+ const n = l ? `; background-color: ${c(l)}` : "", i = b(e.tdStyle), a = y(e.align), d = $("font-size: 12px; color: #666666; margin: 0", e.pStyle), p = o.replace(/_/g, " ").replace(/\b\w/g, (u) => u.toUpperCase());
149
149
  return `
150
150
  ${O(s, 'valign="middle" style="padding: 0 5px; height: 100%"')}>
151
151
  <table width="100%" height="100%" cellpadding="0" cellspacing="0" border="0"
152
152
  class="product-card-segment" style="table-layout: fixed${n}">
153
153
  <tbody>
154
154
  <tr valign="top">
155
- <td product-attr="${c(t)}"${r}
155
+ <td product-attr="${c(t)}"${a}
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
158
  <p contenteditable="false"${b(d)}>${c(p)}</p>
@@ -163,54 +163,54 @@ function ct(t, o, e, l, s) {
163
163
  </td>
164
164
  `;
165
165
  }
166
- function rt(t, o, e, l, s, n, i) {
167
- const r = o[t], a = r ?? _();
166
+ function at(t, o, e, l, s, n, i) {
167
+ const a = o[t], r = a ?? _();
168
168
  switch (t) {
169
169
  case I:
170
170
  return lt(
171
- r ?? {},
171
+ a ?? {},
172
172
  s,
173
173
  l,
174
174
  n
175
175
  );
176
176
  case G:
177
- return D(
177
+ return L(
178
178
  g.NAME,
179
179
  "product-name es-p10t es-p10b es-p15l es-p15r",
180
180
  "Product Name",
181
181
  "font-size: 16px; color: #333333",
182
- a,
182
+ r,
183
183
  l,
184
184
  n
185
185
  );
186
186
  case H:
187
- return D(
187
+ return L(
188
188
  g.PRICE,
189
189
  "product-price es-p15l es-p15r",
190
190
  i.pricePlaceholder,
191
191
  "font-size: 16px; color: #333333",
192
- q(r),
192
+ q(a),
193
193
  l,
194
194
  n
195
195
  );
196
196
  case j:
197
- return st(a, l, n, i.oldPricePlaceholder);
197
+ return st(r, l, n, i.oldPricePlaceholder);
198
198
  case U:
199
- return L(
199
+ return D(
200
200
  g.OMNIBUS_PRICE,
201
201
  "omnibus-price-value",
202
202
  i.omnibusPricePlaceholder,
203
- a,
203
+ r,
204
204
  l,
205
205
  "product-omnibus-price",
206
206
  n
207
207
  );
208
208
  case V:
209
- return L(
209
+ return D(
210
210
  g.OMNIBUS_DISCOUNT,
211
211
  "omnibus-discount-value",
212
212
  "-10%",
213
- a,
213
+ r,
214
214
  l,
215
215
  "product-omnibus-discount",
216
216
  n
@@ -218,14 +218,14 @@ function rt(t, o, e, l, s, n, i) {
218
218
  case N:
219
219
  return it(
220
220
  s,
221
- r ?? {},
221
+ a ?? {},
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 ct(d, p, r, l, n);
229
229
  }
230
230
  return null;
231
231
  }
@@ -235,7 +235,7 @@ const Q = `
235
235
  <td class="spacer" style="height: 10px"></td>
236
236
  </tr>
237
237
  `;
238
- function at(t) {
238
+ function rt(t) {
239
239
  return {
240
240
  pricePlaceholder: v({ price: 18, currency: t }),
241
241
  oldPricePlaceholder: v({ price: 20, currency: t }),
@@ -243,7 +243,7 @@ function at(t) {
243
243
  };
244
244
  }
245
245
  function dt(t, o, e, l) {
246
- const { composition: s, visibility: n, perElement: i, customAttrValues: r, cardBg: a } = l, d = (100 / e).toFixed(2), p = e - o, u = `<td class="${F}" style="padding: 0 5px;" width="${d}%"></td>`, m = p > 0 ? u.repeat(p) : "";
246
+ const { composition: s, visibility: n, perElement: i, customAttrValues: a, cardBg: r } = l, d = (100 / e).toFixed(2), p = e - o, u = `<td class="${F}" style="padding: 0 5px;" width="${d}%"></td>`, m = p > 0 ? u.repeat(p) : "";
247
247
  return `
248
248
  <tr class="recommendation-product-row">
249
249
  <td>
@@ -252,11 +252,11 @@ function dt(t, o, e, l) {
252
252
  <tbody>${s.map((T) => {
253
253
  const w = n[T] !== !1, f = w ? "" : ' style="display: none"', C = w ? "1" : "0", S = [];
254
254
  for (let x = 0; x < o; x += 1) {
255
- const A = rt(
255
+ const A = at(
256
256
  T,
257
257
  i,
258
- r,
259
258
  a,
259
+ r,
260
260
  t + x,
261
261
  d,
262
262
  l
@@ -287,60 +287,60 @@ function pt(t, o, e) {
287
287
  function ut(t, o, e, l) {
288
288
  const s = o[t];
289
289
  if (t === G) {
290
- const n = s ?? _(), i = $("font-size: 16px; color: #333333; margin: 0", n.pStyle), r = y(n.align ?? "left");
290
+ const n = s ?? _(), i = $("font-size: 16px; color: #333333; margin: 0", n.pStyle), a = y(n.align ?? "left");
291
291
  return `
292
292
  <td class="esd-block-text product-name"
293
- esd-extension-block-id="${g.NAME}"${r}${b(n.tdStyle)}>
293
+ esd-extension-block-id="${g.NAME}"${a}${b(n.tdStyle)}>
294
294
  <p contenteditable="false"${b(i)}>${k("Product Name", n)}</p>
295
295
  </td>
296
296
  `;
297
297
  }
298
298
  if (t === H) {
299
- const n = q(s), i = $("font-size: 16px; color: #333333; margin: 0", n.pStyle), r = y(n.align ?? "left");
299
+ const n = q(s), i = $("font-size: 16px; color: #333333; margin: 0", n.pStyle), a = y(n.align ?? "left");
300
300
  return `
301
301
  <td class="esd-block-text product-price"
302
- esd-extension-block-id="${g.PRICE}"${r}${b(n.tdStyle)}>
302
+ esd-extension-block-id="${g.PRICE}"${a}${b(n.tdStyle)}>
303
303
  <p contenteditable="false"${b(i)}>${k(l.pricePlaceholder, n)}</p>
304
304
  </td>
305
305
  `;
306
306
  }
307
307
  if (t === j) {
308
- const n = s ?? _(), r = $("font-size: 14px; color: #999999; text-decoration: line-through; margin: 0", n.pStyle), a = y(n.align ?? "left");
308
+ const n = s ?? _(), a = $("font-size: 14px; color: #999999; text-decoration: line-through; margin: 0", n.pStyle), r = y(n.align ?? "left");
309
309
  return `
310
310
  <td class="esd-block-text product-old-price"
311
- esd-extension-block-id="${g.OLD_PRICE}"${a}${b(n.tdStyle)}>
312
- <p contenteditable="false"${b(r)}><s>${k(l.oldPricePlaceholder, n)}</s></p>
311
+ esd-extension-block-id="${g.OLD_PRICE}"${r}${b(n.tdStyle)}>
312
+ <p contenteditable="false"${b(a)}><s>${k(l.oldPricePlaceholder, n)}</s></p>
313
313
  </td>
314
314
  `;
315
315
  }
316
316
  if (t === U || t === V) {
317
- const n = t === U, 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 ?? _(), u = $("font-size: 12px; color: #666666; margin: 0", p.pStyle), m = y(p.align ?? "left");
317
+ const n = t === U, i = n ? g.OMNIBUS_PRICE : g.OMNIBUS_DISCOUNT, a = n ? "omnibus-price-value" : "omnibus-discount-value", r = n ? l.omnibusPricePlaceholder : "-10%", d = n ? "product-omnibus-price" : "product-omnibus-discount", p = s ?? _(), u = $("font-size: 12px; color: #666666; margin: 0", p.pStyle), m = y(p.align ?? "left");
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}${b(p.tdStyle)}>
322
322
  <p contenteditable="false"${b(u)}>
323
323
  <span class="omnibus-text-before"></span>
324
- <span class="${r}">${c(a)}</span>
324
+ <span class="${a}">${c(r)}</span>
325
325
  <span class="omnibus-text-after"></span>
326
326
  </p>
327
327
  </td>
328
328
  `;
329
329
  }
330
330
  if (t.startsWith(E)) {
331
- const n = s ?? _(), i = e[t] ?? t.slice(E.length), 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"), u = g.CUSTOM_ATTRIBUTE;
331
+ const n = s ?? _(), i = e[t] ?? t.slice(E.length), r = t.slice(E.length).replace(/_/g, " ").replace(/\b\w/g, (m) => m.toUpperCase()), d = $("font-size: 12px; color: #666666; margin: 0", n.pStyle), p = y(n.align ?? "left"), u = g.CUSTOM_ATTRIBUTE;
332
332
  return `
333
333
  <td product-attr="${c(i)}"
334
334
  class="esd-block-text product-custom-attribute"
335
335
  esd-extension-block-id="${u}"${p}${b(n.tdStyle)}>
336
- <p contenteditable="false"${b(d)}>${c(a)}</p>
336
+ <p contenteditable="false"${b(d)}>${c(r)}</p>
337
337
  </td>
338
338
  `;
339
339
  }
340
340
  return null;
341
341
  }
342
342
  function bt(t, o) {
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[I] ?? {}, p = l[I] !== !1, u = d.width ? ` width="${d.width}"` : "", m = p ? "" : ' style="display: none"', h = `
343
+ const { composition: e, visibility: l, perElement: s, customAttrValues: n, cardBg: i } = o, a = i ? `background-color: ${c(i)}` : "", r = a ? `style="table-layout: fixed; ${a}"` : 'style="table-layout: fixed"', d = s[I] ?? {}, p = l[I] !== !1, u = d.width ? ` width="${d.width}"` : "", m = p ? "" : ' style="display: none"', h = `
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}"
@@ -384,7 +384,7 @@ function bt(t, o) {
384
384
  <tr class="recommendation-product-row">
385
385
  <td style="padding: 0 5px">
386
386
  <table width="100%" cellpadding="0" cellspacing="0" border="0"
387
- class="product-card-wrapper" ${a}>
387
+ class="product-card-wrapper" ${r}>
388
388
  <tbody>
389
389
  <tr>${h}${w}${W}</tr>
390
390
  </tbody>
@@ -400,13 +400,13 @@ function gt(t, o) {
400
400
  return e.join("");
401
401
  }
402
402
  function mt(t, o) {
403
- var a, d, p, u, m, h;
403
+ var r, d, p, u, m, h;
404
404
  const e = t == null ? void 0 : t.theme, l = [];
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"}`), (u = e == null ? void 0 : e.textStyle) != null && u["font-weight"] && l.push(`font-weight: ${e.textStyle["font-weight"]}`), (m = e == null ? void 0 : e.textStyle) != null && m["font-style"] && l.push(`font-style: ${e.textStyle["font-style"]}`);
406
- const s = l.join("; "), n = ((h = e == null ? void 0 : e.textStyle) == null ? void 0 : h["font-weight"]) !== "normal", i = c(o), r = n ? `<strong>${i}</strong>` : i;
405
+ (r = e == null ? void 0 : e.textStyle) != null && r["font-family"] && l.push(`font-family: ${e.textStyle["font-family"]}`), l.push(`font-size: ${((d = e == null ? void 0 : e.textStyle) == null ? void 0 : d["font-size"]) ?? "28px"}`), l.push(`color: ${((p = e == null ? void 0 : e.textColor) == null ? void 0 : p.color) ?? "#333333"}`), (u = e == null ? void 0 : e.textStyle) != null && u["font-weight"] && l.push(`font-weight: ${e.textStyle["font-weight"]}`), (m = e == null ? void 0 : e.textStyle) != null && m["font-style"] && l.push(`font-style: ${e.textStyle["font-style"]}`);
406
+ const s = l.join("; "), n = ((h = e == null ? void 0 : e.textStyle) == null ? void 0 : h["font-weight"]) !== "normal", i = c(o), a = n ? `<strong>${i}</strong>` : i;
407
407
  return `
408
408
  <td class="esd-block-text es-p10t es-p10b es-p20l es-p20r" align="center">
409
- <p${b(s)}>${r}</p>
409
+ <p${b(s)}>${a}</p>
410
410
  </td>
411
411
  `;
412
412
  }
@@ -422,15 +422,15 @@ function Tt(t) {
422
422
  titleText: s,
423
423
  extraClasses: n = "",
424
424
  legacyId: i,
425
- legacyBgColor: r
426
- } = t, a = parseInt(o.size) || 6, d = o.layout === "list" ? ' data-layout="list"' : "", p = o.layout === "list" ? " es-m-p0 ins-recommendation-list-layout" : "", u = {
425
+ legacyBgColor: a
426
+ } = t, r = parseInt(o.size) || 6, d = o.layout === "list" ? ' data-layout="list"' : "", p = o.layout === "list" ? " es-m-p0 ins-recommendation-list-layout" : "", u = {
427
427
  composition: e.composition,
428
428
  visibility: e.visibility,
429
429
  perElement: e.perElementStyles,
430
430
  customAttrValues: e.customAttrValues,
431
431
  cardBg: l,
432
- ...at(o.currency)
433
- }, m = o.layout === "list" ? gt(a, u) : pt(a, o.cardsInRow, u), h = mt(e.titleVariable, s), T = e.composition.join(","), w = JSON.stringify(e.customAttributes), f = [
432
+ ...rt(o.currency)
433
+ }, m = o.layout === "list" ? gt(r, u) : pt(r, o.cardsInRow, u), h = mt(e.titleVariable, s), T = e.composition.join(","), w = JSON.stringify(e.customAttributes), f = [
434
434
  "recommendation-block-v2",
435
435
  "esd-block-recommendation-v3-block",
436
436
  `es-p20${p}`,
@@ -443,7 +443,7 @@ function Tt(t) {
443
443
  "esd-container-frame",
444
444
  "ins-recommendation-no-mobile-layout",
445
445
  n
446
- ].filter(Boolean).join(" "), C = $t(o.currency), S = ` esd-ext-config="${c(JSON.stringify(o))}"`, x = i ? ` id="${c(i)}"` : "", A = r ? ` bgcolor="${c(r)}"` : "";
446
+ ].filter(Boolean).join(" "), C = $t(o.currency), S = ` esd-ext-config="${c(JSON.stringify(o))}"`, x = i ? ` id="${c(i)}"` : "", A = a ? ` bgcolor="${c(a)}"` : "";
447
447
  return nt(`
448
448
  <td align="left"
449
449
  esd-extension-block-id="recommendation-block"
@@ -455,8 +455,7 @@ function Tt(t) {
455
455
  data-column-spacing="${o.columnSpacing}"
456
456
  data-row-spacing="${o.rowSpacing}"
457
457
  data-mobile-column-spacing="${o.mobileColumnSpacing}"
458
- data-mobile-row-spacing="${o.mobileRowSpacing}"
459
- hide-price="${o.priceHideIfSameAsDiscounted}"${d}${S}>
458
+ data-mobile-row-spacing="${o.mobileRowSpacing}"${d}${S}>
460
459
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
461
460
  <tbody>
462
461
  <tr>
@@ -1,75 +1,70 @@
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 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) {
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) {
5
5
  return t === "0" || t === 0 ? "before" : "after";
6
6
  }
7
- function I(t) {
7
+ function _(t) {
8
8
  if (typeof t == "number" && Number.isFinite(t))
9
9
  return t;
10
10
  if (typeof t == "string") {
11
- const o = parseInt(t);
12
- if (!Number.isNaN(o))
13
- return o;
11
+ const n = parseInt(t);
12
+ if (!Number.isNaN(n))
13
+ return n;
14
14
  }
15
15
  return i.decimalCount;
16
16
  }
17
- function _(t) {
17
+ function I(t) {
18
18
  return t === "." || t === "," || t === " " || t === "" ? t : ",";
19
19
  }
20
- function N(t) {
20
+ function A(t) {
21
21
  return t === "." || t === "," || t === " " ? t : ".";
22
22
  }
23
- function A(t) {
23
+ function N(t) {
24
24
  if (!t || typeof t != "object")
25
25
  return { ...i };
26
- const o = t, n = o.value ?? o.name ?? i.code, r = o.symbol ?? n;
26
+ const n = t, o = n.value ?? n.name ?? i.code, r = n.symbol ?? o;
27
27
  return {
28
- code: n,
28
+ code: o,
29
29
  symbol: r,
30
- alignment: c(o.alignment),
31
- decimalCount: I(o.decimalCount),
32
- decimalSeparator: N(o.decimalSeparator),
33
- thousandSeparator: _(o.thousandSeparator)
30
+ alignment: l(n.alignment),
31
+ decimalCount: _(n.decimalCount),
32
+ decimalSeparator: A(n.decimalSeparator),
33
+ thousandSeparator: I(n.thousandSeparator)
34
34
  };
35
35
  }
36
- function L(t) {
36
+ function R(t) {
37
37
  return t === "horizontal" || t === "list" ? "list" : "grid";
38
38
  }
39
- function R(t) {
40
- return l(t) || "mostPopular";
39
+ function b(t) {
40
+ return c(t) || "mostPopular";
41
41
  }
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;
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;
44
44
  return {
45
- recommendationId: n,
46
- strategy: R(t.strategy),
45
+ recommendationId: o,
46
+ strategy: b(t.strategy),
47
47
  productIds: (t.productIds ?? []).map((e) => String(e)),
48
- size: String(u),
48
+ size: String(a),
49
49
  shuffleProducts: !!t.shuffleProducts,
50
50
  language: t.language ?? "en_US",
51
- currency: A(t.currencySettings),
51
+ currency: N(t.currencySettings),
52
52
  filters: (t.filters ?? []).map((e) => ({ ...e })),
53
- layout: L(t.orientation ?? o.orientation),
53
+ layout: R(t.orientation ?? n.orientation),
54
54
  cardsInRow: r,
55
- mobileCardsInRow: a,
55
+ mobileCardsInRow: u,
56
56
  mobileLayoutEnabled: !1,
57
- previousMobileCardsInRow: a,
58
- columnSpacing: S,
59
- rowSpacing: f,
60
- mobileColumnSpacing: d,
57
+ previousMobileCardsInRow: u,
58
+ columnSpacing: d,
59
+ rowSpacing: S,
60
+ mobileColumnSpacing: f,
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,
69
64
  configVersion: s
70
65
  };
71
66
  }
72
67
  export {
73
- A as mapCurrency,
74
- U as mapSettings
68
+ N as mapCurrency,
69
+ D as mapSettings
75
70
  };
@@ -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
  };