@useinsider/guido 3.7.2-beta.1e8f93e → 3.7.2-beta.2220fb0

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 (47) hide show
  1. package/dist/@types/config/schemas.js +70 -66
  2. package/dist/composables/usePreviewMode.js +15 -14
  3. package/dist/composables/useRecommendationPreview.js +100 -0
  4. package/dist/config/compiler/recommendationCompilerRules.js +1 -1
  5. package/dist/config/compiler/utils/recommendationCompilerUtils.js +90 -82
  6. package/dist/config/migrator/recommendation/htmlBuilder.js +59 -58
  7. package/dist/config/migrator/recommendation/settingsMapper.js +38 -33
  8. package/dist/extensions/Blocks/Items/block.js +29 -48
  9. package/dist/extensions/Blocks/Items/utils/nodeConfigUtils.js +45 -62
  10. package/dist/extensions/Blocks/Recommendation/block.js +60 -41
  11. package/dist/extensions/Blocks/Recommendation/canvasPreview.css.js +16 -0
  12. package/dist/extensions/Blocks/Recommendation/constants/defaultConfig.js +41 -32
  13. package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +369 -288
  14. package/dist/extensions/Blocks/Recommendation/controls/main/index.js +96 -84
  15. package/dist/extensions/Blocks/Recommendation/controls/main/pricePlacement.js +133 -0
  16. package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +83 -81
  17. package/dist/extensions/Blocks/Recommendation/extension.js +30 -29
  18. package/dist/extensions/Blocks/Recommendation/iconsRegistry.js +21 -7
  19. package/dist/extensions/Blocks/Recommendation/recommendation.css.js +64 -4
  20. package/dist/extensions/Blocks/Recommendation/store/recommendation.js +7 -5
  21. package/dist/extensions/Blocks/Recommendation/templates/grid/elementRenderer.js +109 -78
  22. package/dist/extensions/Blocks/Recommendation/templates/grid/template.js +31 -30
  23. package/dist/extensions/Blocks/Recommendation/templates/index.js +9 -7
  24. package/dist/extensions/Blocks/Recommendation/templates/list/elementRenderer.js +78 -61
  25. package/dist/extensions/Blocks/Recommendation/templates/list/template.js +21 -21
  26. package/dist/extensions/Blocks/Recommendation/templates/utils.js +90 -55
  27. package/dist/src/@types/config/schemas.d.ts +16 -0
  28. package/dist/src/composables/useConfig.d.ts +4 -0
  29. package/dist/src/composables/useRecommendationPreview.d.ts +10 -0
  30. package/dist/src/config/migrator/recommendation/settingsMapper.d.ts +1 -1
  31. package/dist/src/extensions/Blocks/Items/block.d.ts +0 -8
  32. package/dist/src/extensions/Blocks/Items/utils/nodeConfigUtils.d.ts +1 -1
  33. package/dist/src/extensions/Blocks/Recommendation/block.d.ts +10 -0
  34. package/dist/src/extensions/Blocks/Recommendation/controls/cardComposition/index.d.ts +29 -3
  35. package/dist/src/extensions/Blocks/Recommendation/controls/index.d.ts +1 -1
  36. package/dist/src/extensions/Blocks/Recommendation/controls/main/index.d.ts +3 -1
  37. package/dist/src/extensions/Blocks/Recommendation/controls/main/pricePlacement.d.ts +59 -0
  38. package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +2 -0
  39. package/dist/src/extensions/Blocks/Recommendation/templates/grid/elementRenderer.d.ts +16 -0
  40. package/dist/src/extensions/Blocks/Recommendation/templates/grid/template.d.ts +4 -4
  41. package/dist/src/extensions/Blocks/Recommendation/templates/index.d.ts +1 -1
  42. package/dist/src/extensions/Blocks/Recommendation/templates/list/elementRenderer.d.ts +13 -0
  43. package/dist/src/extensions/Blocks/Recommendation/templates/list/template.d.ts +3 -2
  44. package/dist/src/extensions/Blocks/Recommendation/templates/utils.d.ts +39 -1
  45. package/dist/src/extensions/Blocks/Recommendation/types/nodeConfig.d.ts +15 -0
  46. package/dist/src/stores/config.d.ts +36 -0
  47. package/package.json +1 -1
@@ -1,43 +1,71 @@
1
- import { RecommendationBlockId as o } from "../../constants/blockIds.js";
2
- import { ATTR_PRODUCT_ATTR as u, ATTR_PRODUCT_BUTTON as c, CSS_CLASS_RECO_BUTTON as d, ATTR_PRODUCT_IMAGE as p, ATTR_PRODUCT_OMNIBUS_DISCOUNT as g, ATTR_PRODUCT_OMNIBUS_PRICE as f, ATTR_PRODUCT_OLD_PRICE as T, ATTR_PRODUCT_PRICE as x, ATTR_PRODUCT_NAME as _ } from "../../constants/selectors.js";
3
- import { useRecommendationExtensionStore as C } from "../../store/recommendation.js";
4
- import { formatPrice as R } from "../../utils/priceFormatter.js";
5
- import { CUSTOM_CELL_HTML as O, sanitizeImageUrl as $ } from "../utils.js";
6
- function b() {
7
- const t = C(), { currencySettings: e } = t.recommendationConfigs;
8
- return {
9
- code: e.value,
10
- symbol: e.symbol,
11
- alignment: e.alignment === "0" ? "before" : "after",
12
- decimalCount: parseInt(e.decimalCount) || 2,
13
- decimalSeparator: e.decimalSeparator,
14
- thousandSeparator: e.thousandSeparator
15
- };
1
+ import { RecommendationBlockId as e } from "../../constants/blockIds.js";
2
+ import { ATTR_PRODUCT_ATTR as m, ATTR_PRODUCT_BUTTON as d, CSS_CLASS_RECO_BUTTON as p, ATTR_PRODUCT_IMAGE as b, ATTR_PRODUCT_OMNIBUS_DISCOUNT as u, ATTR_PRODUCT_OMNIBUS_PRICE as f, ATTR_PRODUCT_OLD_PRICE as x, ATTR_PRODUCT_PRICE as T, ATTR_PRODUCT_NAME as _ } from "../../constants/selectors.js";
3
+ import { formatProductPrice as a, isSamePrice as g, CUSTOM_CELL_HTML as $, getCurrentCurrencyConfig as C, sanitizeImageUrl as R } from "../utils.js";
4
+ function k(t) {
5
+ const s = `<s><strong>${a(t, "original_price")}</strong></s>`;
6
+ return `
7
+ <tr>
8
+ <td
9
+ class="esd-block-text product-old-price"
10
+ esd-extension-block-id="${e.OLD_PRICE}"
11
+ data-same-price="${g(t)}"
12
+ align="left">
13
+ <p
14
+ contenteditable="false"
15
+ style="font-size: 14px; color: #999999; margin: 0;">
16
+ ${s}
17
+ </p>
18
+ </td>
19
+ </tr>
20
+ `;
16
21
  }
17
- function r(t, e = "price") {
18
- const n = b(), s = t[e], a = (s == null ? void 0 : s[n.code]) ?? Object.values(s ?? {})[0] ?? 0;
19
- return R({
20
- price: a,
21
- currency: n
22
- });
22
+ function h(t, s = !0) {
23
+ const n = `<s><strong>${a(t, "original_price")}</strong></s>`, r = (o) => `<td
24
+ class="esd-block-text product-price"
25
+ esd-extension-block-id="${e.PRICE}"
26
+ align="left"
27
+ valign="middle"
28
+ style="width: auto;${o}">
29
+ <p contenteditable="false" style="font-size: 16px; color: #333333; font-weight: bold; margin: 0;">
30
+ <strong>${a(t, "price")}</strong>
31
+ </p>
32
+ </td>`, i = (o) => `<td
33
+ class="esd-block-text product-old-price"
34
+ esd-extension-block-id="${e.OLD_PRICE}"
35
+ data-same-price="${g(t)}"
36
+ align="left"
37
+ valign="middle"
38
+ style="width: auto;${o}">
39
+ <p
40
+ contenteditable="false"
41
+ style="font-size: 14px; color: #999999; margin: 0;">
42
+ ${n}
43
+ </p>
44
+ </td>`, c = s ? i(" padding-right: 8px;") : r(" padding-right: 8px;"), l = s ? r("") : i("");
45
+ return `
46
+ <tr>
47
+ ${c}
48
+ ${l}
49
+ </tr>
50
+ `;
23
51
  }
24
- const I = {
52
+ const U = {
25
53
  /**
26
54
  * Image cell - left column (120px fixed width)
27
55
  * Has recommendation-attribute-row class and data attributes for Card Composition control
28
56
  */
29
- [p]: (t) => `
57
+ [b]: (t) => `
30
58
  <td
31
59
  width="120"
32
60
  class="esd-block-image product-image-cell recommendation-attribute-row es-p5"
33
- esd-extension-block-id="${o.IMAGE}"
34
- data-attribute-type="${p}"
61
+ esd-extension-block-id="${e.IMAGE}"
62
+ data-attribute-type="${b}"
35
63
  data-visibility="1"
36
64
  align="center"
37
65
  valign="middle">
38
- <a target="_blank" href="${t.url}" class="${d}">
66
+ <a target="_blank" href="${t.url}" class="${p}">
39
67
  <img
40
- src="${$(t.image_url)}"
68
+ src="${R(t.image_url)}"
41
69
  alt="${t.name}"
42
70
  style="display: block; max-width: 100%; height: auto;"
43
71
  class="adapt-img product-image">
@@ -51,7 +79,7 @@ const I = {
51
79
  <tr>
52
80
  <td
53
81
  class="esd-block-text product-name"
54
- esd-extension-block-id="${o.NAME}"
82
+ esd-extension-block-id="${e.NAME}"
55
83
  align="left">
56
84
  <p contenteditable="false" style="font-size: 16px; color: #333333; font-weight: 600; margin: 0;">
57
85
  <strong>${t.name}</strong>
@@ -62,14 +90,14 @@ const I = {
62
90
  /**
63
91
  * Price element - row for info cell table
64
92
  */
65
- [x]: (t) => `
93
+ [T]: (t) => `
66
94
  <tr>
67
95
  <td
68
96
  class="esd-block-text product-price"
69
- esd-extension-block-id="${o.PRICE}"
97
+ esd-extension-block-id="${e.PRICE}"
70
98
  align="left">
71
99
  <p contenteditable="false" style="font-size: 16px; color: #333333; font-weight: bold; margin: 0;">
72
- <strong>${r(t, "price")}</strong>
100
+ <strong>${a(t, "price")}</strong>
73
101
  </p>
74
102
  </td>
75
103
  </tr>
@@ -77,20 +105,7 @@ const I = {
77
105
  /**
78
106
  * Old price element - row for info cell table
79
107
  */
80
- [T]: (t) => `
81
- <tr>
82
- <td
83
- class="esd-block-text product-old-price"
84
- esd-extension-block-id="${o.OLD_PRICE}"
85
- align="left">
86
- <p
87
- contenteditable="false"
88
- style="font-size: 14px; color: #999999; margin: 0;">
89
- <s><strong>${r(t, "original_price")}</strong></s>
90
- </p>
91
- </td>
92
- </tr>
93
- `,
108
+ [x]: (t) => k(t),
94
109
  /**
95
110
  * Omnibus price element - row for info cell table
96
111
  */
@@ -100,11 +115,11 @@ const I = {
100
115
  class="esd-block-text product-omnibus-price"
101
116
  data-text-before="Lowest 30-day price: "
102
117
  data-text-after=""
103
- esd-extension-block-id="${o.OMNIBUS_PRICE}"
118
+ esd-extension-block-id="${e.OMNIBUS_PRICE}"
104
119
  align="left">
105
120
  <p contenteditable="false" style="font-size: 12px; color: #666666; margin: 0;">
106
121
  <span class="omnibus-text-before">Lowest 30-day price: </span>
107
- <span class="omnibus-price-value">${r(t, "original_price")}</span>
122
+ <span class="omnibus-price-value">${a(t, "original_price")}</span>
108
123
  <span class="omnibus-text-after"></span>
109
124
  </p>
110
125
  </td>
@@ -113,20 +128,20 @@ const I = {
113
128
  /**
114
129
  * Omnibus discount element - row for info cell table
115
130
  */
116
- [g]: (t) => {
117
- var i, l;
118
- const e = b(), n = ((i = t.original_price) == null ? void 0 : i[e.code]) ?? Object.values(t.original_price ?? {})[0] ?? 0, s = ((l = t.price) == null ? void 0 : l[e.code]) ?? Object.values(t.price ?? {})[0] ?? 0, a = n > 0 ? Math.round((n - s) / n * 100) : 0, m = a > 0 ? `-${a}%` : "0%";
131
+ [u]: (t) => {
132
+ var l, o;
133
+ const s = C(), n = ((l = t.original_price) == null ? void 0 : l[s.code]) ?? Object.values(t.original_price ?? {})[0] ?? 0, r = ((o = t.price) == null ? void 0 : o[s.code]) ?? Object.values(t.price ?? {})[0] ?? 0, i = n > 0 ? Math.round((n - r) / n * 100) : 0, c = i > 0 ? `-${i}%` : "0%";
119
134
  return `
120
135
  <tr>
121
136
  <td
122
137
  class="esd-block-text product-omnibus-discount"
123
138
  data-text-before=""
124
139
  data-text-after=""
125
- esd-extension-block-id="${o.OMNIBUS_DISCOUNT}"
140
+ esd-extension-block-id="${e.OMNIBUS_DISCOUNT}"
126
141
  align="left">
127
142
  <p contenteditable="false" style="font-size: 12px; color: #666666; margin: 0;">
128
143
  <span class="omnibus-text-before"></span>
129
- <span class="omnibus-discount-value">${m}</span>
144
+ <span class="omnibus-discount-value">${c}</span>
130
145
  <span class="omnibus-text-after"></span>
131
146
  </p>
132
147
  </td>
@@ -137,12 +152,12 @@ const I = {
137
152
  * Button cell - right column (100px fixed width)
138
153
  * Has recommendation-attribute-row class and data attributes for Card Composition control
139
154
  */
140
- [c]: (t) => `
155
+ [d]: (t) => `
141
156
  <td
142
157
  width="100"
143
158
  class="esd-block-button button-cell recommendation-attribute-row product-button es-p5l es-p5r"
144
- esd-extension-block-id="${o.BUTTON}"
145
- data-attribute-type="${c}"
159
+ esd-extension-block-id="${e.BUTTON}"
160
+ data-attribute-type="${d}"
146
161
  data-visibility="1"
147
162
  align="center"
148
163
  valign="middle">
@@ -156,7 +171,7 @@ const I = {
156
171
  <a
157
172
  href="${t.url}"
158
173
  target="_blank"
159
- class="es-button ${d}"
174
+ class="es-button ${p}"
160
175
  style="
161
176
  color: rgb(56, 118, 29);
162
177
  background: rgb(217, 234, 211);
@@ -179,18 +194,20 @@ const I = {
179
194
  * @param productAttrValue - Resolved product-attr value (e.g., "brand" for default, "product_attribute.rating_star" for custom)
180
195
  * @param content - Display content for the cell
181
196
  */
182
- [O]: (t, e) => `
197
+ [$]: (t, s) => `
183
198
  <tr>
184
199
  <td
185
- ${u}="${t}"
200
+ ${m}="${t}"
186
201
  class="esd-block-text product-custom-attribute"
187
- esd-extension-block-id="${o.CUSTOM_ATTRIBUTE}"
202
+ esd-extension-block-id="${e.CUSTOM_ATTRIBUTE}"
188
203
  align="left">
189
- <p contenteditable="false" style="font-size: 12px; color: #666666; margin: 0;">${e}</p>
204
+ <p contenteditable="false" style="font-size: 12px; color: #666666; margin: 0;">${s}</p>
190
205
  </td>
191
206
  </tr>
192
207
  `
193
208
  };
194
209
  export {
195
- I as listElementRenderer
210
+ U as listElementRenderer,
211
+ h as renderInlineListPriceRow,
212
+ k as renderListOldPriceRow
196
213
  };
@@ -1,14 +1,14 @@
1
- import { ATTR_PRODUCT_IMAGE as a, ATTR_PRODUCT_BUTTON as d } from "../../constants/selectors.js";
2
- import { DEFAULT_CARD_COMPOSITION as b, spacer as m, buildElementRenderer as C, DEFAULT_CARD_VISIBILITY as T } from "../utils.js";
3
- import { listElementRenderer as f } from "./elementRenderer.js";
4
- function R(r, n, l) {
5
- const t = l ? "" : ' style="display: none;"', o = r.replace(/<tr>/, "").replace(/<\/tr>/, "");
1
+ import { ATTR_PRODUCT_IMAGE as a, ATTR_PRODUCT_BUTTON as c } from "../../constants/selectors.js";
2
+ import { DEFAULT_CARD_COMPOSITION as R, spacer as m, buildElementRenderer as T, resolveInlinePriceOrder as O, DEFAULT_CARD_VISIBILITY as w } from "../utils.js";
3
+ import { listElementRenderer as y, renderInlineListPriceRow as I } from "./elementRenderer.js";
4
+ function g(t, r, n) {
5
+ const o = n ? "" : ' style="display: none;"', l = t.replace(/<tr>/, "").replace(/<\/tr>/, "");
6
6
  return `<tr
7
7
  class="recommendation-attribute-row"
8
- data-attribute-type="${n}"
9
- data-visibility="${l ? "1" : "0"}"${t}>${o}</tr>`;
8
+ data-attribute-type="${r}"
9
+ data-visibility="${n ? "1" : "0"}"${o}>${l}</tr>`;
10
10
  }
11
- const y = `
11
+ const _ = `
12
12
  <tr class="recommendation-product-row">
13
13
  <td style="padding: 0 5px;">
14
14
  <table
@@ -26,29 +26,29 @@ const y = `
26
26
  </td>
27
27
  </tr>
28
28
  `;
29
- function O(r, n = b, l = {}) {
30
- const t = C(f, n, l), o = t[a](r), c = `
29
+ function P(t, r = R, n = {}, o = {}) {
30
+ const { priceInline: l = !1 } = o, i = T(y, r, n), d = i[a](t), s = O(r), p = (e) => l && e === s.anchor ? I(t, s.originalFirst) : i[e](t), u = `
31
31
  <td class="product-info-cell" valign="middle" style="padding: 15px;">
32
32
  <table cellpadding="0" cellspacing="0" role="presentation" width="100%" style="table-layout: fixed;">
33
33
  <tbody>
34
- ${n.filter((e) => e !== a && e !== d).filter((e) => t[e]).map((e) => {
35
- const u = T[e] ?? !0;
36
- return R(t[e](r), e, u);
34
+ ${r.filter((e) => e !== a && e !== c).filter((e) => !(l && e === s.skip)).filter((e) => i[e]).map((e) => {
35
+ const C = w[e] ?? !0;
36
+ return g(p(e), e, C);
37
37
  }).join(`
38
38
  `)}
39
39
  </tbody>
40
40
  </table>
41
41
  </td>
42
- `, s = t[d](r), p = o + c + s;
43
- return y.replace("{-{-PRODUCT_CONTENT-}-}", p);
42
+ `, f = i[c](t), b = d + u + f;
43
+ return _.replace("{-{-PRODUCT_CONTENT-}-}", b);
44
44
  }
45
- function D(r, n, l = {}) {
46
- return r.map((t, o) => {
47
- const i = O(t, n, l);
48
- return o > 0 ? m + i : i;
45
+ function N(t, r, n = {}, o = {}) {
46
+ return t.map((l, i) => {
47
+ const d = P(l, r, n, o);
48
+ return i > 0 ? m + d : d;
49
49
  }).join("");
50
50
  }
51
51
  export {
52
- O as getListProductCard,
53
- D as prepareProductRows
52
+ P as getListProductCard,
53
+ N as prepareProductRows
54
54
  };
@@ -1,7 +1,38 @@
1
- import { ATTR_CUSTOM_PREFIX as d, ATTR_PRODUCT_IMAGE as u, ATTR_PRODUCT_NAME as p, ATTR_PRODUCT_OLD_PRICE as m, ATTR_PRODUCT_PRICE as b, ATTR_PRODUCT_OMNIBUS_PRICE as T, ATTR_PRODUCT_OMNIBUS_DISCOUNT as _, ATTR_PRODUCT_BUTTON as g } from "../constants/selectors.js";
2
- function y(t) {
1
+ import { ATTR_PRODUCT_PRICE as c, ATTR_PRODUCT_OLD_PRICE as a, ATTR_CUSTOM_PREFIX as m, ATTR_PRODUCT_IMAGE as b, ATTR_PRODUCT_NAME as g, ATTR_PRODUCT_OMNIBUS_PRICE as f, ATTR_PRODUCT_OMNIBUS_DISCOUNT as T, ATTR_PRODUCT_BUTTON as _ } from "../constants/selectors.js";
2
+ import { useRecommendationExtensionStore as S } from "../store/recommendation.js";
3
+ import { formatPrice as D } from "../utils/priceFormatter.js";
4
+ function h() {
5
+ const t = S(), { currencySettings: e } = t.recommendationConfigs;
6
+ return {
7
+ code: e.value,
8
+ symbol: e.symbol,
9
+ alignment: e.alignment === "0" ? "before" : "after",
10
+ decimalCount: parseInt(e.decimalCount) || 2,
11
+ decimalSeparator: e.decimalSeparator,
12
+ thousandSeparator: e.thousandSeparator
13
+ };
14
+ }
15
+ function p(t, e = "price") {
16
+ const r = h(), n = t[e], o = (n == null ? void 0 : n[r.code]) ?? Object.values(n ?? {})[0] ?? 0;
17
+ return D({
18
+ price: o,
19
+ currency: r
20
+ });
21
+ }
22
+ function N(t) {
23
+ return p(t, "price") === p(t, "original_price");
24
+ }
25
+ function I(t) {
3
26
  return t.replace(/_/g, " ").replace(/\b\w/g, (e) => e.toUpperCase());
4
27
  }
28
+ function v(t) {
29
+ const e = t.indexOf(c), r = t.indexOf(a), n = r !== -1 && (e === -1 || r < e);
30
+ return {
31
+ originalFirst: n,
32
+ anchor: n ? a : c,
33
+ skip: n ? c : a
34
+ };
35
+ }
5
36
  function U(t) {
6
37
  const e = Array.isArray(t) ? t[t.length - 1] : t;
7
38
  if (typeof e == "string")
@@ -10,57 +41,57 @@ function U(t) {
10
41
  return String(e);
11
42
  }
12
43
  function C(t, e) {
13
- const n = Object.values(e).find((r) => r.attributeName === t);
14
- return (n == null ? void 0 : n.type) === "defaultAttribute";
44
+ const r = Object.values(e).find((n) => n.attributeName === t);
45
+ return (r == null ? void 0 : r.type) === "defaultAttribute";
15
46
  }
16
- function h(t, e) {
47
+ function E(t, e) {
17
48
  return C(t, e) ? t : `product_attribute.${t}`;
18
49
  }
19
- const P = Symbol("customCellHtml");
20
- function L(t, e, n = {}) {
21
- const r = t[P];
22
- if (!r)
50
+ const L = Symbol("customCellHtml");
51
+ function B(t, e, r = {}) {
52
+ const n = t[L];
53
+ if (!n)
23
54
  return { ...t };
24
- const i = { ...t };
25
- return e.filter((o) => o.startsWith(d) && !i[o]).forEach((o) => {
26
- const s = o.substring(d.length), l = y(s), A = h(s, n), R = C(s, n);
27
- i[o] = (c) => {
28
- var a;
29
- const D = R ? c[s] : (a = c.product_attributes) == null ? void 0 : a[s], O = U(D) ?? l;
30
- return r(A, O);
55
+ const o = { ...t };
56
+ return e.filter((i) => i.startsWith(m) && !o[i]).forEach((i) => {
57
+ const s = i.substring(m.length), l = I(s), O = E(s, r), R = C(s, r);
58
+ o[i] = (d) => {
59
+ var u;
60
+ const A = R ? d[s] : (u = d.product_attributes) == null ? void 0 : u[s], P = U(A) ?? l;
61
+ return n(O, P);
31
62
  };
32
- }), i;
63
+ }), o;
33
64
  }
34
- const M = {
65
+ const F = {
35
66
  TITLE: "You May Also Like!"
36
- }, $ = [
37
- u,
38
- p,
39
- m,
67
+ }, V = [
40
68
  b,
69
+ g,
70
+ a,
71
+ c,
72
+ f,
41
73
  T,
42
- _,
43
- g
44
- ], w = {
45
- [u]: !0,
46
- [p]: !0,
74
+ _
75
+ ], H = {
47
76
  [b]: !0,
48
- [m]: !0,
77
+ [g]: !0,
78
+ [c]: !0,
79
+ [a]: !0,
80
+ [f]: !1,
49
81
  [T]: !1,
50
- [_]: !1,
51
- [g]: !0
52
- }, I = `
82
+ [_]: !0
83
+ }, x = `
53
84
  <tr>
54
85
  <td class="spacer" style="height: 10px;"></td>
55
86
  </tr>
56
- `, f = "https://email-static.useinsider.com/stripo/modules/email-recommendation-v3/assets/images/image-placeholder.png";
57
- function N(t) {
58
- return !t || typeof t != "string" || t.trim() === "" ? f : t.startsWith("http://") ? t.replace("http://", "https://") : t;
87
+ `, y = "https://email-static.useinsider.com/stripo/modules/email-recommendation-v3/assets/images/image-placeholder.png";
88
+ function W(t) {
89
+ return !t || typeof t != "string" || t.trim() === "" ? y : t.startsWith("http://") ? t.replace("http://", "https://") : t;
59
90
  }
60
- function E(t) {
91
+ function M(t) {
61
92
  return {
62
93
  name: "Product Name",
63
- image_url: f,
94
+ image_url: y,
64
95
  price: { USD: 18 },
65
96
  original_price: { USD: 20 },
66
97
  discount: { USD: 2 },
@@ -72,19 +103,19 @@ function E(t) {
72
103
  category: []
73
104
  };
74
105
  }
75
- function k(t = 6) {
106
+ function j(t = 6) {
76
107
  return Array.from(
77
108
  { length: t },
78
- (e, n) => E(String(n + 1))
109
+ (e, r) => M(String(r + 1))
79
110
  );
80
111
  }
81
- function x(t = "grid", e) {
82
- const n = t === "list" ? `
83
- data-layout="list"` : "", r = e ? ` ${e}` : "";
112
+ function z(t = "grid", e) {
113
+ const r = t === "list" ? `
114
+ data-layout="list"` : "", n = e ? ` ${e}` : "";
84
115
  return `
85
116
  <td
86
117
  align="left"
87
- class="${`recommendation-block-v2 esd-block-recommendation-v3-block es-p20${t === "list" ? " es-m-p0 ins-recommendation-list-layout" : ""}${r}`}"${n}>
118
+ class="${`recommendation-block-v2 esd-block-recommendation-v3-block es-p20${t === "list" ? " es-m-p0 ins-recommendation-list-layout" : ""}${n}`}"${r}>
88
119
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
89
120
  <tr>
90
121
  <td align="center">
@@ -116,7 +147,7 @@ function x(t = "grid", e) {
116
147
  </table>
117
148
  </td>
118
149
  </tr>
119
- ${I}
150
+ ${x}
120
151
  <tr>
121
152
  <td>
122
153
  <table
@@ -155,18 +186,22 @@ function x(t = "grid", e) {
155
186
  `;
156
187
  }
157
188
  export {
158
- P as CUSTOM_CELL_HTML,
159
- M as DEFAULTS,
160
- $ as DEFAULT_CARD_COMPOSITION,
161
- w as DEFAULT_CARD_VISIBILITY,
162
- f as PLACEHOLDER_IMAGE,
163
- L as buildElementRenderer,
164
- x as createBlockTemplate,
165
- k as getDefaultProducts,
189
+ L as CUSTOM_CELL_HTML,
190
+ F as DEFAULTS,
191
+ V as DEFAULT_CARD_COMPOSITION,
192
+ H as DEFAULT_CARD_VISIBILITY,
193
+ y as PLACEHOLDER_IMAGE,
194
+ B as buildElementRenderer,
195
+ z as createBlockTemplate,
196
+ p as formatProductPrice,
197
+ h as getCurrentCurrencyConfig,
198
+ j as getDefaultProducts,
166
199
  C as isDefaultAttribute,
167
- h as resolveProductAttrValue,
168
- N as sanitizeImageUrl,
169
- I as spacer,
170
- y as toDisplayName,
200
+ N as isSamePrice,
201
+ v as resolveInlinePriceOrder,
202
+ E as resolveProductAttrValue,
203
+ W as sanitizeImageUrl,
204
+ x as spacer,
205
+ I as toDisplayName,
171
206
  U as toDisplayableAttributeValue
172
207
  };
@@ -139,6 +139,10 @@ export declare const LegacyRecommendationConfigSchema: v.LooseObjectSchema<{
139
139
  readonly size: v.OptionalSchema<v.UnionSchema<[v.StringSchema<undefined>, v.NumberSchema<undefined>], undefined>, undefined>;
140
140
  /** Vertical responsiveness flag (legacy size=1 variants) */
141
141
  readonly verticalResponsiveness: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
142
+ /** Legacy "Move to next line" price placement toggle (cardPricePlacement.js) */
143
+ readonly isPriceMovedToNextLine: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
144
+ /** Legacy "Hide if same as discounted" / delete-price-for-zero-sale toggle */
145
+ readonly isPriceDeletedForZeroSale: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
142
146
  }, undefined>;
143
147
  /**
144
148
  * Migration-only inputs scoped to this template.
@@ -195,6 +199,10 @@ export declare const TemplateMigrationSchema: v.ObjectSchema<{
195
199
  readonly size: v.OptionalSchema<v.UnionSchema<[v.StringSchema<undefined>, v.NumberSchema<undefined>], undefined>, undefined>;
196
200
  /** Vertical responsiveness flag (legacy size=1 variants) */
197
201
  readonly verticalResponsiveness: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
202
+ /** Legacy "Move to next line" price placement toggle (cardPricePlacement.js) */
203
+ readonly isPriceMovedToNextLine: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
204
+ /** Legacy "Hide if same as discounted" / delete-price-for-zero-sale toggle */
205
+ readonly isPriceDeletedForZeroSale: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
198
206
  }, undefined>, undefined>, {}>;
199
207
  }, undefined>;
200
208
  /**
@@ -274,6 +282,10 @@ export declare const TemplateSchema: v.ObjectSchema<{
274
282
  readonly size: v.OptionalSchema<v.UnionSchema<[v.StringSchema<undefined>, v.NumberSchema<undefined>], undefined>, undefined>;
275
283
  /** Vertical responsiveness flag (legacy size=1 variants) */
276
284
  readonly verticalResponsiveness: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
285
+ /** Legacy "Move to next line" price placement toggle (cardPricePlacement.js) */
286
+ readonly isPriceMovedToNextLine: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
287
+ /** Legacy "Hide if same as discounted" / delete-price-for-zero-sale toggle */
288
+ readonly isPriceDeletedForZeroSale: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
277
289
  }, undefined>, undefined>, {}>;
278
290
  }, undefined>, {}>;
279
291
  }, undefined>;
@@ -665,6 +677,10 @@ export declare const GuidoConfigSchema: v.ObjectSchema<{
665
677
  readonly size: v.OptionalSchema<v.UnionSchema<[v.StringSchema<undefined>, v.NumberSchema<undefined>], undefined>, undefined>;
666
678
  /** Vertical responsiveness flag (legacy size=1 variants) */
667
679
  readonly verticalResponsiveness: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
680
+ /** Legacy "Move to next line" price placement toggle (cardPricePlacement.js) */
681
+ readonly isPriceMovedToNextLine: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
682
+ /** Legacy "Hide if same as discounted" / delete-price-for-zero-sale toggle */
683
+ readonly isPriceDeletedForZeroSale: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
668
684
  }, undefined>, undefined>, {}>;
669
685
  }, undefined>, {}>;
670
686
  }, undefined>, {}>;
@@ -60,6 +60,8 @@ export declare const useConfig: () => {
60
60
  blockType?: string | undefined;
61
61
  size?: string | number | undefined;
62
62
  verticalResponsiveness?: boolean | undefined;
63
+ isPriceMovedToNextLine?: boolean | undefined;
64
+ isPriceDeletedForZeroSale?: boolean | undefined;
63
65
  } & {
64
66
  [key: string]: unknown;
65
67
  };
@@ -186,6 +188,8 @@ export declare const useConfig: () => {
186
188
  blockType?: string | undefined;
187
189
  size?: string | number | undefined;
188
190
  verticalResponsiveness?: boolean | undefined;
191
+ isPriceMovedToNextLine?: boolean | undefined;
192
+ isPriceDeletedForZeroSale?: boolean | undefined;
189
193
  } & {
190
194
  [key: string]: unknown;
191
195
  };
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Substitutes recommendation product variables in compiled preview HTML with the
3
+ * blocks' fetched sample products, then simulates the email-service hide rule by
4
+ * emptying the original-price cell (DOM kept) for slots with no real discount.
5
+ * Returns the input unchanged when there are no reco blocks or no products.
6
+ */
7
+ export declare function substituteRecommendationPreview(html: string): string;
8
+ export declare const useRecommendationPreview: () => {
9
+ substituteRecommendationPreview: typeof substituteRecommendationPreview;
10
+ };
@@ -3,5 +3,5 @@ import type { CurrencyConfig, RecommendationNodeConfig } from '@@/Extensions/Blo
3
3
  import type { LegacyRecommendationConfig } from '@@/Types/config';
4
4
  /** Defensive against missing/malformed legacy `currencySettings` — defaults are per-field, not whole-object. */
5
5
  export declare function mapCurrency(legacy: unknown): CurrencyConfig;
6
- export type SettingsPartial = Pick<RecommendationNodeConfig, 'recommendationId' | 'strategy' | 'productIds' | 'size' | 'shuffleProducts' | 'language' | 'currency' | 'filters' | 'layout' | 'cardsInRow' | 'mobileCardsInRow' | 'mobileLayoutEnabled' | 'previousMobileCardsInRow' | 'columnSpacing' | 'rowSpacing' | 'mobileColumnSpacing' | 'mobileRowSpacing' | 'omnibusPrice' | 'omnibusDiscount' | 'configVersion'>;
6
+ export type SettingsPartial = Pick<RecommendationNodeConfig, 'recommendationId' | 'strategy' | 'productIds' | 'size' | 'shuffleProducts' | 'language' | 'currency' | 'filters' | 'layout' | 'cardsInRow' | 'mobileCardsInRow' | 'mobileLayoutEnabled' | 'previousMobileCardsInRow' | 'columnSpacing' | 'rowSpacing' | 'mobileColumnSpacing' | 'mobileRowSpacing' | 'omnibusPrice' | 'omnibusDiscount' | 'priceMovedToNextLine' | 'priceHideIfSameAsDiscounted' | 'configVersion'>;
7
7
  export declare function mapSettings(recCfg: LegacyRecommendationConfig, parsed: LegacyProductConfig, id: number): SettingsPartial;
@@ -24,13 +24,5 @@ export declare class ItemsBlock extends Block {
24
24
  getSettingsPanelTitleHtml(): string;
25
25
  getTemplate(): string;
26
26
  allowInnerBlocksDND(): boolean;
27
- canBeSavedAsModule(): boolean;
28
27
  onCreated(node: ImmutableHtmlNode): void;
29
- /**
30
- * Re-seeds nodeConfig from the persisted esd-ext-config when a saved module
31
- * surfaces via document load. Stripo strips esd-ext-config and never restores it
32
- * into nodeConfig, so without this a reused module would reset to defaults.
33
- * Guarded to the nodeConfig-empty case so it runs once and never loops.
34
- */
35
- onDocumentChanged(node: ImmutableHtmlNode): void;
36
28
  }
@@ -55,7 +55,7 @@ export declare function getItemsBlockContainer(currentNode: ImmutableHtmlNode |
55
55
  /**
56
56
  * Gets the node configuration from the Items block.
57
57
  * Uses Stripo V2's getNodeConfig() API.
58
- * Falls back to the persisted esd-ext-config (saved modules), then legacy config block.
58
+ * Falls back to migrating from legacy config block if nodeConfig is empty.
59
59
  * @param currentNode - The current node from the control
60
60
  * @returns The ItemsBlockConfig object or null if not found
61
61
  */
@@ -117,6 +117,16 @@ export declare class RecommendationBlock extends Block {
117
117
  * added classes via setAttribute.
118
118
  */
119
119
  private _assignRecommendationId;
120
+ /**
121
+ * Stamps the `hide-price` attribute (read by email-service at send time) on
122
+ * the block element from the config flag.
123
+ */
124
+ private _stampHidePrice;
125
+ /**
126
+ * Stamps `hide-price` from config only when the block lacks the attribute —
127
+ * heals templates saved before this feature without dirtying current ones.
128
+ */
129
+ private _healHidePriceAttr;
120
130
  /**
121
131
  * Gets the recommendation-id from a block node
122
132
  */