@useinsider/guido 3.0.0 → 3.1.0

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 (101) hide show
  1. package/dist/components/organisms/header/EditorActions.vue.js +10 -8
  2. package/dist/components/organisms/header/EditorActions.vue2.js +41 -31
  3. package/dist/components/organisms/header/MigrationConfirmModal.vue.js +17 -0
  4. package/dist/components/organisms/header/MigrationConfirmModal.vue2.js +39 -0
  5. package/dist/components/organisms/onboarding/GenericOnboarding.vue.js +1 -1
  6. package/dist/components/organisms/onboarding/GenericOnboarding.vue2.js +1 -1
  7. package/dist/components/organisms/onboarding/TextBlockOnboarding.vue.js +1 -1
  8. package/dist/components/organisms/onboarding/TextBlockOnboarding.vue2.js +2 -2
  9. package/dist/config/compiler/unsubscribeCompilerRules.js +14 -14
  10. package/dist/config/compiler/utils/recommendationCompilerUtils.js +29 -18
  11. package/dist/config/i18n/en/labels.json.js +8 -3
  12. package/dist/config/migrator/itemsBlockMigrator.js +135 -131
  13. package/dist/config/migrator/recommendationMigrator.js +58 -54
  14. package/dist/enums/block.js +4 -0
  15. package/dist/extensions/Blocks/Items/block.js +30 -21
  16. package/dist/extensions/Blocks/Items/iconsRegistry.js +7 -6
  17. package/dist/extensions/Blocks/Items/items.css.js +48 -0
  18. package/dist/extensions/Blocks/Recommendation/block.js +64 -34
  19. package/dist/extensions/Blocks/Recommendation/constants/blockIds.js +1 -1
  20. package/dist/extensions/Blocks/Recommendation/constants/controlIds.js +1 -1
  21. package/dist/extensions/Blocks/Recommendation/constants/defaultConfig.js +36 -34
  22. package/dist/extensions/Blocks/Recommendation/constants/selectors.js +15 -12
  23. package/dist/extensions/Blocks/Recommendation/controls/cardBackground/index.js +4 -4
  24. package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +693 -144
  25. package/dist/extensions/Blocks/Recommendation/controls/customAttribute/index.js +78 -0
  26. package/dist/extensions/Blocks/Recommendation/controls/main/algorithm.js +15 -15
  27. package/dist/extensions/Blocks/Recommendation/controls/main/currency.js +24 -24
  28. package/dist/extensions/Blocks/Recommendation/controls/main/filters.js +2 -2
  29. package/dist/extensions/Blocks/Recommendation/controls/main/index.js +107 -78
  30. package/dist/extensions/Blocks/Recommendation/controls/{layout/index.js → main/layoutOrientation.js} +34 -23
  31. package/dist/extensions/Blocks/Recommendation/controls/main/locale.js +2 -2
  32. package/dist/extensions/Blocks/Recommendation/controls/main/productCount.js +58 -0
  33. package/dist/extensions/Blocks/Recommendation/controls/main/productLayout.js +150 -64
  34. package/dist/extensions/Blocks/Recommendation/controls/main/shuffle.js +2 -2
  35. package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +202 -200
  36. package/dist/extensions/Blocks/Recommendation/controls/mobileLayout/cssRules.js +25 -8
  37. package/dist/extensions/Blocks/Recommendation/controls/name/textTrim.js +6 -5
  38. package/dist/extensions/Blocks/Recommendation/controls/omnibusDiscount/textAfter.js +8 -8
  39. package/dist/extensions/Blocks/Recommendation/controls/omnibusDiscount/textBefore.js +21 -21
  40. package/dist/extensions/Blocks/Recommendation/controls/omnibusPrice/textAfter.js +13 -13
  41. package/dist/extensions/Blocks/Recommendation/controls/omnibusPrice/textBefore.js +17 -17
  42. package/dist/extensions/Blocks/Recommendation/controls/spacing/index.js +94 -100
  43. package/dist/extensions/Blocks/Recommendation/controls/syncInfoMessage.js +65 -0
  44. package/dist/extensions/Blocks/Recommendation/extension.js +20 -18
  45. package/dist/extensions/Blocks/Recommendation/iconsRegistry.js +5 -4
  46. package/dist/extensions/Blocks/Recommendation/recommendation.css.js +209 -2
  47. package/dist/extensions/Blocks/Recommendation/settingsPanel.js +135 -111
  48. package/dist/extensions/Blocks/Recommendation/store/recommendation.js +9 -7
  49. package/dist/extensions/Blocks/Recommendation/templates/grid/elementRenderer.js +63 -34
  50. package/dist/extensions/Blocks/Recommendation/templates/grid/template.js +25 -28
  51. package/dist/extensions/Blocks/Recommendation/templates/index.js +8 -8
  52. package/dist/extensions/Blocks/Recommendation/templates/list/elementRenderer.js +28 -13
  53. package/dist/extensions/Blocks/Recommendation/templates/list/template.js +25 -44
  54. package/dist/extensions/Blocks/Recommendation/templates/utils.js +62 -38
  55. package/dist/extensions/Blocks/common-control.js +96 -39
  56. package/dist/guido.css +1 -1
  57. package/dist/src/@types/extensions/block.d.ts +2 -0
  58. package/dist/src/App.vue.d.ts +3 -1
  59. package/dist/src/components/organisms/header/EditorActions.vue.d.ts +1 -1
  60. package/dist/src/components/organisms/header/MigrationConfirmModal.vue.d.ts +6 -0
  61. package/dist/src/components/wrappers/WpModal.vue.d.ts +2 -2
  62. package/dist/src/enums/block.d.ts +4 -0
  63. package/dist/src/extensions/Blocks/Items/block.d.ts +3 -1
  64. package/dist/src/extensions/Blocks/Recommendation/block.d.ts +4 -1
  65. package/dist/src/extensions/Blocks/Recommendation/constants/blockIds.d.ts +2 -1
  66. package/dist/src/extensions/Blocks/Recommendation/constants/controlIds.d.ts +9 -1
  67. package/dist/src/extensions/Blocks/Recommendation/constants/index.d.ts +1 -1
  68. package/dist/src/extensions/Blocks/Recommendation/constants/selectors.d.ts +10 -0
  69. package/dist/src/extensions/Blocks/Recommendation/controls/cardComposition/index.d.ts +134 -44
  70. package/dist/src/extensions/Blocks/Recommendation/controls/customAttribute/index.d.ts +105 -0
  71. package/dist/src/extensions/Blocks/Recommendation/controls/index.d.ts +3 -2
  72. package/dist/src/extensions/Blocks/Recommendation/controls/main/index.d.ts +5 -1
  73. package/dist/src/extensions/Blocks/Recommendation/controls/{layout/index.d.ts → main/layoutOrientation.d.ts} +3 -3
  74. package/dist/src/extensions/Blocks/Recommendation/controls/main/productCount.d.ts +28 -0
  75. package/dist/src/extensions/Blocks/Recommendation/controls/main/productLayout.d.ts +38 -20
  76. package/dist/src/extensions/Blocks/Recommendation/controls/main/utils.d.ts +6 -2
  77. package/dist/src/extensions/Blocks/Recommendation/controls/mobileLayout/cssRules.d.ts +23 -1
  78. package/dist/src/extensions/Blocks/Recommendation/controls/spacing/index.d.ts +8 -18
  79. package/dist/src/extensions/Blocks/Recommendation/controls/syncInfoMessage.d.ts +34 -0
  80. package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +2 -0
  81. package/dist/src/extensions/Blocks/Recommendation/templates/grid/elementRenderer.d.ts +1 -1
  82. package/dist/src/extensions/Blocks/Recommendation/templates/list/elementRenderer.d.ts +1 -1
  83. package/dist/src/extensions/Blocks/Recommendation/templates/list/template.d.ts +10 -4
  84. package/dist/src/extensions/Blocks/Recommendation/templates/utils.d.ts +37 -2
  85. package/dist/src/extensions/Blocks/Recommendation/types/nodeConfig.d.ts +13 -0
  86. package/dist/src/extensions/Blocks/common-control.d.ts +29 -2
  87. package/dist/src/stores/template.d.ts +29 -0
  88. package/dist/src/utils/migrationBannerHtml.d.ts +2 -0
  89. package/dist/static/assets/info.svg.js +5 -0
  90. package/dist/static/styles/components/wide-panel.css.js +1 -0
  91. package/dist/static/styles/customEditorStyle.css.js +9 -0
  92. package/dist/static/styles/variables.css.js +3 -0
  93. package/dist/stores/template.js +15 -0
  94. package/dist/utils/migrationBannerHtml.js +21 -0
  95. package/package.json +3 -2
  96. package/dist/src/extensions/Blocks/Recommendation/controls/cardBackgroundColorControl.d.ts +0 -25
  97. package/dist/src/extensions/Blocks/Recommendation/controls/omnibusDiscountTextAfterControl.d.ts +0 -15
  98. package/dist/src/extensions/Blocks/Recommendation/controls/omnibusDiscountTextBeforeControl.d.ts +0 -15
  99. package/dist/src/extensions/Blocks/Recommendation/controls/omnibusPriceTextAfterControl.d.ts +0 -15
  100. package/dist/src/extensions/Blocks/Recommendation/controls/omnibusPriceTextBeforeControl.d.ts +0 -15
  101. package/dist/src/extensions/Blocks/Recommendation/controls/spacingControl.d.ts +0 -60
@@ -1,11 +1,11 @@
1
1
  import { RecommendationBlockId as s } from "../../constants/blockIds.js";
2
- import { ATTR_PRODUCT_BUTTON as b, ATTR_PRODUCT_OMNIBUS_DISCOUNT as u, ATTR_PRODUCT_OMNIBUS_PRICE as m, ATTR_PRODUCT_OLD_PRICE as h, ATTR_PRODUCT_PRICE as y, ATTR_PRODUCT_NAME as f, ATTR_PRODUCT_IMAGE as x } from "../../constants/selectors.js";
3
- import { useRecommendationExtensionStore as T } from "../../store/recommendation.js";
4
- import { formatPrice as _ } from "../../utils/priceFormatter.js";
5
- import { sanitizeImageUrl as $ } from "../utils.js";
6
- const a = "0 5px", o = "attribute-cell";
2
+ import { ATTR_PRODUCT_ATTR as g, ATTR_PRODUCT_BUTTON as u, ATTR_PRODUCT_OMNIBUS_DISCOUNT as m, ATTR_PRODUCT_OMNIBUS_PRICE as h, ATTR_PRODUCT_OLD_PRICE as y, ATTR_PRODUCT_PRICE as T, ATTR_PRODUCT_NAME as f, ATTR_PRODUCT_IMAGE as _ } from "../../constants/selectors.js";
3
+ import { useRecommendationExtensionStore as x } from "../../store/recommendation.js";
4
+ import { formatPrice as $ } from "../../utils/priceFormatter.js";
5
+ import { sanitizeImageUrl as C, CUSTOM_CELL_HTML as R } from "../utils.js";
6
+ const a = "0 5px", l = "attribute-cell";
7
7
  function p() {
8
- const t = T(), { currencySettings: e } = t.recommendationConfigs;
8
+ const t = x(), { currencySettings: e } = t.recommendationConfigs;
9
9
  return {
10
10
  code: e.value,
11
11
  symbol: e.symbol,
@@ -15,16 +15,16 @@ function p() {
15
15
  thousandSeparator: e.thousandSeparator
16
16
  };
17
17
  }
18
- function c(t, e = "price") {
19
- const n = p(), l = t[e], r = (l == null ? void 0 : l[n.code]) ?? Object.values(l ?? {})[0] ?? 0;
20
- return _({
21
- price: r,
22
- currency: n
18
+ function r(t, e = "price") {
19
+ const o = p(), n = t[e], d = (n == null ? void 0 : n[o.code]) ?? Object.values(n ?? {})[0] ?? 0;
20
+ return $({
21
+ price: d,
22
+ currency: o
23
23
  });
24
24
  }
25
- const P = {
26
- [x]: (t) => `
27
- <td class="${o}" style="padding: ${a}; height: 100%;" valign="top">
25
+ const I = {
26
+ [_]: (t) => `
27
+ <td class="${l}" style="padding: ${a}; height: 100%;" valign="top">
28
28
  <table
29
29
  class="product-card-segment"
30
30
  width="100%"
@@ -40,7 +40,7 @@ const P = {
40
40
  esd-extension-block-id="${s.IMAGE}">
41
41
  <a target="_blank" href="${t.url}">
42
42
  <img
43
- src="${$(t.image_url)}"
43
+ src="${C(t.image_url)}"
44
44
  alt="${t.name}"
45
45
  style="display: block; max-width: 100%; height: auto;"
46
46
  class="adapt-img">
@@ -52,7 +52,7 @@ const P = {
52
52
  </td>
53
53
  `,
54
54
  [f]: (t) => `
55
- <td class="${o}" style="padding: ${a}; height: 100%;" valign="middle">
55
+ <td class="${l}" style="padding: ${a}; height: 100%;" valign="middle">
56
56
  <table
57
57
  class="product-card-segment"
58
58
  width="100%"
@@ -76,8 +76,8 @@ const P = {
76
76
  </table>
77
77
  </td>
78
78
  `,
79
- [y]: (t) => `
80
- <td class="${o}" style="padding: ${a}; height: 100%;" valign="top">
79
+ [T]: (t) => `
80
+ <td class="${l}" style="padding: ${a}; height: 100%;" valign="top">
81
81
  <table
82
82
  class="product-card-segment"
83
83
  width="100%"
@@ -92,7 +92,7 @@ const P = {
92
92
  align="center"
93
93
  esd-extension-block-id="${s.PRICE}">
94
94
  <p contenteditable="false" style="font-size: 16px; color: #333333;">
95
- <strong>${c(t, "price")}</strong>
95
+ <strong>${r(t, "price")}</strong>
96
96
  </p>
97
97
  </td>
98
98
  </tr>
@@ -100,8 +100,8 @@ const P = {
100
100
  </table>
101
101
  </td>
102
102
  `,
103
- [h]: (t) => `
104
- <td class="${o}" style="padding: ${a}; height: 100%;" valign="top">
103
+ [y]: (t) => `
104
+ <td class="${l}" style="padding: ${a}; height: 100%;" valign="top">
105
105
  <table
106
106
  class="product-card-segment"
107
107
  width="100%"
@@ -116,7 +116,7 @@ const P = {
116
116
  align="center"
117
117
  esd-extension-block-id="${s.OLD_PRICE}">
118
118
  <p contenteditable="false" style="font-size: 14px; color: #999999;">
119
- <strong>${c(t, "original_price")}</strong>
119
+ <strong>${r(t, "original_price")}</strong>
120
120
  </p>
121
121
  </td>
122
122
  </tr>
@@ -124,8 +124,8 @@ const P = {
124
124
  </table>
125
125
  </td>
126
126
  `,
127
- [m]: (t) => `
128
- <td class="${o}" style="padding: ${a}; height: 100%;" valign="top">
127
+ [h]: (t) => `
128
+ <td class="${l}" style="padding: ${a}; height: 100%;" valign="top">
129
129
  <table
130
130
  class="product-card-segment"
131
131
  width="100%"
@@ -143,7 +143,7 @@ const P = {
143
143
  esd-extension-block-id="${s.OMNIBUS_PRICE}">
144
144
  <p contenteditable="false" style="font-size: 12px; color: #666666;">
145
145
  <span class="omnibus-text-before">Lowest 30-day price: </span>
146
- <span class="omnibus-price-value">${c(t, "original_price")}</span>
146
+ <span class="omnibus-price-value">${r(t, "original_price")}</span>
147
147
  <span class="omnibus-text-after"></span>
148
148
  </p>
149
149
  </td>
@@ -152,11 +152,11 @@ const P = {
152
152
  </table>
153
153
  </td>
154
154
  `,
155
- [u]: (t) => {
156
- var d, i;
157
- const e = p(), n = ((d = t.original_price) == null ? void 0 : d[e.code]) ?? Object.values(t.original_price ?? {})[0] ?? 0, l = ((i = t.price) == null ? void 0 : i[e.code]) ?? Object.values(t.price ?? {})[0] ?? 0, r = n > 0 ? Math.round((n - l) / n * 100) : 0, g = r > 0 ? `-${r}%` : "0%";
155
+ [m]: (t) => {
156
+ var c, i;
157
+ const e = p(), o = ((c = t.original_price) == null ? void 0 : c[e.code]) ?? Object.values(t.original_price ?? {})[0] ?? 0, n = ((i = t.price) == null ? void 0 : i[e.code]) ?? Object.values(t.price ?? {})[0] ?? 0, d = o > 0 ? Math.round((o - n) / o * 100) : 0, b = d > 0 ? `-${d}%` : "0%";
158
158
  return `
159
- <td class="${o}" style="padding: ${a}; height: 100%;" valign="top">
159
+ <td class="${l}" style="padding: ${a}; height: 100%;" valign="top">
160
160
  <table
161
161
  class="product-card-segment"
162
162
  width="100%"
@@ -174,7 +174,7 @@ const P = {
174
174
  esd-extension-block-id="${s.OMNIBUS_DISCOUNT}">
175
175
  <p contenteditable="false" style="font-size: 12px; color: #666666;">
176
176
  <span class="omnibus-text-before"></span>
177
- <span class="omnibus-discount-value">${g}</span>
177
+ <span class="omnibus-discount-value">${b}</span>
178
178
  <span class="omnibus-text-after"></span>
179
179
  </p>
180
180
  </td>
@@ -184,8 +184,8 @@ const P = {
184
184
  </td>
185
185
  `;
186
186
  },
187
- [b]: () => `
188
- <td class="${o}" style="padding: ${a}; height: 100%;" valign="top">
187
+ [u]: () => `
188
+ <td class="${l}" style="padding: ${a}; height: 100%;" valign="top">
189
189
  <table
190
190
  class="product-card-segment"
191
191
  width="100%"
@@ -219,10 +219,39 @@ const P = {
219
219
  </tbody>
220
220
  </table>
221
221
  </td>
222
+ `,
223
+ /**
224
+ * Custom attribute cell template — same structure as built-in entries
225
+ * (outer td → inner product-card-segment table).
226
+ * Used by `buildElementRenderer` for `customAttr:*` composition entries.
227
+ */
228
+ [R]: (t, e) => `
229
+ <td class="${l}" style="padding: ${a}; height: 100%;" valign="middle">
230
+ <table
231
+ class="product-card-segment"
232
+ width="100%"
233
+ height="100%"
234
+ cellpadding="0"
235
+ cellspacing="0"
236
+ border="0"
237
+ style="table-layout: fixed;">
238
+ <tbody>
239
+ <tr valign="top">
240
+ <td
241
+ ${g}="product_attribute.${t}"
242
+ class="esd-block-text product-custom-attribute es-p0t es-p0b es-p15l es-p15r"
243
+ align="center"
244
+ esd-extension-block-id="${s.CUSTOM_ATTRIBUTE}">
245
+ <p contenteditable="false" style="font-size: 12px; color: #666666;">${e}</p>
246
+ </td>
247
+ </tr>
248
+ </tbody>
249
+ </table>
250
+ </td>
222
251
  `
223
252
  };
224
253
  export {
225
- o as ATTRIBUTE_CELL_CLASS,
254
+ l as ATTRIBUTE_CELL_CLASS,
226
255
  a as DEFAULT_CELL_PADDING,
227
- P as gridElementRenderer
256
+ I as gridElementRenderer
228
257
  };
@@ -1,7 +1,7 @@
1
- import { DEFAULT_PRODUCTS_PER_ROW as m, DEFAULT_MOBILE_CARDS_IN_ROW as I } from "../../constants/layout.js";
2
- import { DEFAULT_CARD_COMPOSITION as _, spacer as E, getDefaultProducts as S, createBlockTemplate as A, DEFAULTS as b, DEFAULT_CARD_VISIBILITY as D } from "../utils.js";
3
- import { gridElementRenderer as w, ATTRIBUTE_CELL_CLASS as C, DEFAULT_CELL_PADDING as f } from "./elementRenderer.js";
4
- const O = `
1
+ import { DEFAULT_PRODUCTS_PER_ROW as m } from "../../constants/layout.js";
2
+ import { DEFAULT_CARD_COMPOSITION as L, spacer as E, getDefaultProducts as I, createBlockTemplate as _, DEFAULTS as S, buildElementRenderer as b, DEFAULT_CARD_VISIBILITY as A } from "../utils.js";
3
+ import { gridElementRenderer as f, ATTRIBUTE_CELL_CLASS as w, DEFAULT_CELL_PADDING as D } from "./elementRenderer.js";
4
+ const C = `
5
5
  <tr class="recommendation-product-row">
6
6
  <td>
7
7
  <table
@@ -18,7 +18,7 @@ const O = `
18
18
  </table>
19
19
  </td>
20
20
  </tr>
21
- `, U = `
21
+ `, O = `
22
22
  <tr
23
23
  class="recommendation-attribute-row"
24
24
  data-attribute-type="{-{-ATTR_TYPE-}-}"
@@ -27,40 +27,37 @@ const O = `
27
27
  {-{-CELLS-}-}
28
28
  </tr>
29
29
  `;
30
- function g(t, e, r, n = _) {
31
- const c = (100 / e).toFixed(2), s = e - t.length, o = `<td class="${C}" style="padding: ${f};" width="${c}%"></td>`, i = s > 0 ? o.repeat(s) : "";
32
- return n.filter((l) => r[l]).map((l) => {
33
- const p = D[l] ?? !0, T = p ? "" : 'style="display: none;"', u = t.map((R) => {
34
- const L = r[l];
35
- return L(R).replace("<td", `<td width="${c}%"`);
36
- }).join("");
37
- return U.replace("{-{-ATTR_TYPE-}-}", l).replace("{-{-VISIBILITY-}-}", p ? "1" : "0").replace("{-{-DISPLAY_STYLE-}-}", T).replace("{-{-CELLS-}-}", u + i);
30
+ function g(t, e, l, n = L) {
31
+ const o = (100 / e).toFixed(2), a = e - t.length, r = `<td class="${w}" style="padding: ${D};" width="${o}%"></td>`, i = a > 0 ? r.repeat(a) : "", s = b(l, n);
32
+ return n.filter((c) => s[c]).map((c) => {
33
+ const p = A[c] ?? !0, T = p ? "" : 'style="display: none;"', u = t.map((R) => s[c](R).replace("<td", `<td width="${o}%"`)).join("");
34
+ return O.replace("{-{-ATTR_TYPE-}-}", c).replace("{-{-VISIBILITY-}-}", p ? "1" : "0").replace("{-{-DISPLAY_STYLE-}-}", T).replace("{-{-CELLS-}-}", u + i);
38
35
  }).join("");
39
36
  }
40
- function P(t, e, r, n) {
41
- const c = [];
42
- for (let o = 0; o < t.length; o += e)
43
- c.push(t.slice(o, o + e));
44
- return c.map((o, i) => {
45
- const a = g(
46
- o,
47
- e,
37
+ function P(t, e, l, n) {
38
+ const o = [];
39
+ for (let r = 0; r < t.length; r += e)
40
+ o.push(t.slice(r, r + e));
41
+ return o.map((r, i) => {
42
+ const s = g(
48
43
  r,
44
+ e,
45
+ l,
49
46
  n
50
- ), l = O.replace("{-{-ATTRIBUTE_ROWS-}-}", a);
51
- return i > 0 ? E + l : l;
47
+ ), d = C.replace("{-{-ATTRIBUTE_ROWS-}-}", s);
48
+ return i > 0 ? E + d : d;
52
49
  }).join("");
53
50
  }
54
- function d(t, e, r) {
55
- return P(t, e, w, r);
51
+ function U(t, e, l) {
52
+ return P(t, e, f, l);
56
53
  }
57
54
  function W(t) {
58
- const e = t ? `ins-recommendation-v3-block-${t}` : void 0, r = A("grid", e), n = S(), c = d(n, m), s = d(n, I);
59
- return r.replace("{-{-TITLE-}-}", b.TITLE).replace("{-{-PRODUCT_ROWS-}-}", c).replace("{-{-MOBILE_PRODUCT_ROWS-}-}", s);
55
+ const e = t ? `ins-recommendation-v3-block-${t}` : void 0, l = _("grid", e), n = I(), o = U(n, m);
56
+ return l.replace("{-{-TITLE-}-}", S.TITLE).replace("{-{-PRODUCT_ROWS-}-}", o).replace("{-{-MOBILE_PRODUCT_ROWS-}-}", "");
60
57
  }
61
58
  export {
62
59
  W as getDefaultTemplate,
63
60
  g as prepareGridAttributeRows,
64
61
  P as prepareGridProductRows,
65
- d as prepareProductRows
62
+ U as prepareProductRows
66
63
  };
@@ -1,12 +1,12 @@
1
1
  import { DEFAULT_PRODUCTS_PER_ROW as s } from "../constants/layout.js";
2
- import { prepareProductRows as R } from "./grid/template.js";
3
- import { prepareProductRows as c } from "./list/template.js";
4
- function a(r, o, p = {}) {
5
- if (o === "list")
6
- return c(r);
7
- const { productsPerRow: t = s, composition: e } = p;
8
- return R(r, t, e);
2
+ import { prepareProductRows as c } from "./grid/template.js";
3
+ import { prepareProductRows as i } from "./list/template.js";
4
+ function P(r, p, o = {}) {
5
+ if (p === "list")
6
+ return i(r, o.composition);
7
+ const { productsPerRow: t = s, composition: e } = o;
8
+ return c(r, t, e);
9
9
  }
10
10
  export {
11
- a as prepareProductRows
11
+ P as prepareProductRows
12
12
  };
@@ -1,10 +1,10 @@
1
1
  import { RecommendationBlockId as o } from "../../constants/blockIds.js";
2
- import { ATTR_PRODUCT_BUTTON as l, ATTR_PRODUCT_IMAGE as d, ATTR_PRODUCT_OMNIBUS_DISCOUNT as u, ATTR_PRODUCT_OMNIBUS_PRICE as m, ATTR_PRODUCT_OLD_PRICE as g, ATTR_PRODUCT_PRICE as f, ATTR_PRODUCT_NAME as x } from "../../constants/selectors.js";
3
- import { useRecommendationExtensionStore as T } from "../../store/recommendation.js";
4
- import { formatPrice as _ } from "../../utils/priceFormatter.js";
5
- import { sanitizeImageUrl as y } from "../utils.js";
2
+ import { ATTR_PRODUCT_ATTR as u, ATTR_PRODUCT_BUTTON as l, ATTR_PRODUCT_IMAGE as d, ATTR_PRODUCT_OMNIBUS_DISCOUNT as m, ATTR_PRODUCT_OMNIBUS_PRICE as g, ATTR_PRODUCT_OLD_PRICE as f, ATTR_PRODUCT_PRICE as T, ATTR_PRODUCT_NAME as x } from "../../constants/selectors.js";
3
+ import { useRecommendationExtensionStore as _ } from "../../store/recommendation.js";
4
+ import { formatPrice as R } from "../../utils/priceFormatter.js";
5
+ import { sanitizeImageUrl as C, CUSTOM_CELL_HTML as y } from "../utils.js";
6
6
  function p() {
7
- const t = T(), { currencySettings: e } = t.recommendationConfigs;
7
+ const t = _(), { currencySettings: e } = t.recommendationConfigs;
8
8
  return {
9
9
  code: e.value,
10
10
  symbol: e.symbol,
@@ -16,12 +16,12 @@ function p() {
16
16
  }
17
17
  function s(t, e = "price") {
18
18
  const n = p(), r = t[e], a = (r == null ? void 0 : r[n.code]) ?? Object.values(r ?? {})[0] ?? 0;
19
- return _({
19
+ return R({
20
20
  price: a,
21
21
  currency: n
22
22
  });
23
23
  }
24
- const $ = {
24
+ const I = {
25
25
  /**
26
26
  * Image cell - left column (120px fixed width)
27
27
  * Has recommendation-attribute-row class and data attributes for Card Composition control
@@ -37,7 +37,7 @@ const $ = {
37
37
  valign="middle">
38
38
  <a target="_blank" href="${t.url}">
39
39
  <img
40
- src="${y(t.image_url)}"
40
+ src="${C(t.image_url)}"
41
41
  alt="${t.name}"
42
42
  style="display: block; max-width: 100%; height: auto;"
43
43
  class="adapt-img product-image">
@@ -62,7 +62,7 @@ const $ = {
62
62
  /**
63
63
  * Price element - row for info cell table
64
64
  */
65
- [f]: (t) => `
65
+ [T]: (t) => `
66
66
  <tr>
67
67
  <td
68
68
  class="esd-block-text product-price"
@@ -77,7 +77,7 @@ const $ = {
77
77
  /**
78
78
  * Old price element - row for info cell table
79
79
  */
80
- [g]: (t) => `
80
+ [f]: (t) => `
81
81
  <tr>
82
82
  <td
83
83
  class="esd-block-text product-old-price"
@@ -94,7 +94,7 @@ const $ = {
94
94
  /**
95
95
  * Omnibus price element - row for info cell table
96
96
  */
97
- [m]: (t) => `
97
+ [g]: (t) => `
98
98
  <tr>
99
99
  <td
100
100
  class="esd-block-text product-omnibus-price"
@@ -113,7 +113,7 @@ const $ = {
113
113
  /**
114
114
  * Omnibus discount element - row for info cell table
115
115
  */
116
- [u]: (t) => {
116
+ [m]: (t) => {
117
117
  var i, c;
118
118
  const e = p(), n = ((i = t.original_price) == null ? void 0 : i[e.code]) ?? Object.values(t.original_price ?? {})[0] ?? 0, r = ((c = t.price) == null ? void 0 : c[e.code]) ?? Object.values(t.price ?? {})[0] ?? 0, a = n > 0 ? Math.round((n - r) / n * 100) : 0, b = a > 0 ? `-${a}%` : "0%";
119
119
  return `
@@ -162,8 +162,23 @@ const $ = {
162
162
  </a>
163
163
  </span>
164
164
  </td>
165
+ `,
166
+ /**
167
+ * Custom attribute row template — same tr-td structure as Name, Price, etc.
168
+ * Used by `buildElementRenderer` for `customAttr:*` composition entries.
169
+ */
170
+ [y]: (t, e) => `
171
+ <tr>
172
+ <td
173
+ ${u}="product_attribute.${t}"
174
+ class="esd-block-text product-custom-attribute"
175
+ esd-extension-block-id="${o.CUSTOM_ATTRIBUTE}"
176
+ align="left">
177
+ <p contenteditable="false" style="font-size: 12px; color: #666666; margin: 0;">${e}</p>
178
+ </td>
179
+ </tr>
165
180
  `
166
181
  };
167
182
  export {
168
- $ as listElementRenderer
183
+ I as listElementRenderer
169
184
  };
@@ -1,6 +1,13 @@
1
- import { ATTR_PRODUCT_IMAGE as E, ATTR_PRODUCT_NAME as l, ATTR_PRODUCT_OLD_PRICE as c, ATTR_PRODUCT_PRICE as a, ATTR_PRODUCT_OMNIBUS_PRICE as d, ATTR_PRODUCT_OMNIBUS_DISCOUNT as T, ATTR_PRODUCT_BUTTON as N } from "../../constants/selectors.js";
2
- import { spacer as $, DEFAULT_CARD_VISIBILITY as o } from "../utils.js";
3
- import { listElementRenderer as e } from "./elementRenderer.js";
1
+ import { ATTR_PRODUCT_IMAGE as i, ATTR_PRODUCT_BUTTON as d } from "../../constants/selectors.js";
2
+ import { DEFAULT_CARD_COMPOSITION as u, spacer as m, buildElementRenderer as C, DEFAULT_CARD_VISIBILITY as b } from "../utils.js";
3
+ import { listElementRenderer as T } from "./elementRenderer.js";
4
+ function R(r, n, t) {
5
+ const l = t ? "" : ' style="display: none;"', o = r.replace(/<tr>/, "").replace(/<\/tr>/, "");
6
+ return `<tr
7
+ class="recommendation-attribute-row"
8
+ data-attribute-type="${n}"
9
+ data-visibility="${t ? "1" : "0"}"${l}>${o}</tr>`;
10
+ }
4
11
  const f = `
5
12
  <tr class="recommendation-product-row">
6
13
  <td style="padding: 0 5px;">
@@ -19,55 +26,29 @@ const f = `
19
26
  </td>
20
27
  </tr>
21
28
  `;
22
- function V(t) {
23
- const r = e[E](t), s = o[l], i = o[c], R = o[a], C = o[d], b = o[T], n = (w, A, p) => {
24
- const I = p ? "" : ' style="display: none;"', g = w.replace(/<tr>/, "").replace(/<\/tr>/, "");
25
- return `<tr
26
- class="recommendation-attribute-row"
27
- data-attribute-type="${A}"
28
- data-visibility="${p ? "1" : "0"}"${I}>${g}</tr>`;
29
- }, m = n(
30
- e[l](t),
31
- l,
32
- s
33
- ), _ = n(
34
- e[c](t),
35
- c,
36
- i
37
- ), O = n(
38
- e[a](t),
39
- a,
40
- R
41
- ), P = n(
42
- e[d](t),
43
- d,
44
- C
45
- ), u = n(
46
- e[T](t),
47
- T,
48
- b
49
- ), D = `
29
+ function y(r, n = u) {
30
+ const t = C(T, n), l = t[i](r), a = `
50
31
  <td class="product-info-cell" valign="middle" style="padding: 15px;">
51
32
  <table cellpadding="0" cellspacing="0" role="presentation" width="100%">
52
33
  <tbody>
53
- ${m}
54
- ${_}
55
- ${O}
56
- ${P}
57
- ${u}
34
+ ${n.filter((e) => e !== i && e !== d).filter((e) => t[e]).map((e) => {
35
+ const p = b[e] ?? !0;
36
+ return R(t[e](r), e, p);
37
+ }).join(`
38
+ `)}
58
39
  </tbody>
59
40
  </table>
60
41
  </td>
61
- `, U = e[N](t), y = r + D + U;
62
- return f.replace("{-{-PRODUCT_CONTENT-}-}", y);
42
+ `, c = t[d](r), s = l + a + c;
43
+ return f.replace("{-{-PRODUCT_CONTENT-}-}", s);
63
44
  }
64
- function M(t) {
65
- return t.map((r, s) => {
66
- const i = V(r);
67
- return s > 0 ? $ + i : i;
45
+ function w(r, n) {
46
+ return r.map((t, l) => {
47
+ const o = y(t, n);
48
+ return l > 0 ? m + o : o;
68
49
  }).join("");
69
50
  }
70
51
  export {
71
- V as getListProductCard,
72
- M as prepareProductRows
52
+ y as getListProductCard,
53
+ w as prepareProductRows
73
54
  };
@@ -1,34 +1,55 @@
1
- import { ATTR_PRODUCT_IMAGE as o, ATTR_PRODUCT_NAME as s, ATTR_PRODUCT_OLD_PRICE as r, ATTR_PRODUCT_PRICE as l, ATTR_PRODUCT_OMNIBUS_PRICE as i, ATTR_PRODUCT_OMNIBUS_DISCOUNT as a, ATTR_PRODUCT_BUTTON as c } from "../constants/selectors.js";
2
- const C = {
1
+ import { ATTR_PRODUCT_IMAGE as m, ATTR_PRODUCT_NAME as p, ATTR_PRODUCT_OLD_PRICE as T, ATTR_PRODUCT_PRICE as u, ATTR_PRODUCT_OMNIBUS_PRICE as _, ATTR_PRODUCT_OMNIBUS_DISCOUNT as b, ATTR_PRODUCT_BUTTON as g, ATTR_CUSTOM_PREFIX as d } from "../constants/selectors.js";
2
+ function R(t) {
3
+ return t.replace(/_/g, " ").replace(/\b\w/g, (e) => e.toUpperCase());
4
+ }
5
+ const O = Symbol("customCellHtml");
6
+ function f(t, e) {
7
+ const n = t[O];
8
+ if (!n)
9
+ return { ...t };
10
+ const r = { ...t };
11
+ return e.filter((o) => o.startsWith(d) && !r[o]).forEach((o) => {
12
+ const s = o.substring(d.length), l = R(s);
13
+ r[o] = (i) => {
14
+ var a;
15
+ const c = (a = i.product_attributes) == null ? void 0 : a[s];
16
+ return n(
17
+ s,
18
+ c != null ? String(c) : l
19
+ );
20
+ };
21
+ }), r;
22
+ }
23
+ const h = {
3
24
  TITLE: "You May Also Like!"
4
- }, D = [
5
- o,
6
- s,
7
- r,
8
- l,
9
- i,
10
- a,
11
- c
12
- ], O = {
13
- [o]: !0,
14
- [s]: !0,
15
- [l]: !0,
16
- [r]: !0,
17
- [i]: !1,
18
- [a]: !1,
19
- [c]: !0
20
- }, m = `
25
+ }, I = [
26
+ m,
27
+ p,
28
+ T,
29
+ u,
30
+ _,
31
+ b,
32
+ g
33
+ ], P = {
34
+ [m]: !0,
35
+ [p]: !0,
36
+ [u]: !0,
37
+ [T]: !0,
38
+ [_]: !1,
39
+ [b]: !1,
40
+ [g]: !0
41
+ }, U = `
21
42
  <tr>
22
43
  <td class="spacer" style="height: 10px;"></td>
23
44
  </tr>
24
- `, d = "https://email-static.useinsider.com/stripo/modules/email-recommendation-v3/assets/images/image-placeholder.png";
25
- function U(t) {
26
- return !t || typeof t != "string" || t.trim() === "" ? d : t.startsWith("http://") ? t.replace("http://", "https://") : t;
45
+ `, C = "https://email-static.useinsider.com/stripo/modules/email-recommendation-v3/assets/images/image-placeholder.png";
46
+ function E(t) {
47
+ return !t || typeof t != "string" || t.trim() === "" ? C : t.startsWith("http://") ? t.replace("http://", "https://") : t;
27
48
  }
28
- function T(t) {
49
+ function D(t) {
29
50
  return {
30
51
  name: "Product Name",
31
- image_url: d,
52
+ image_url: C,
32
53
  price: { USD: 18 },
33
54
  original_price: { USD: 20 },
34
55
  discount: { USD: 2 },
@@ -40,19 +61,19 @@ function T(t) {
40
61
  category: []
41
62
  };
42
63
  }
43
- function A(t = 6) {
64
+ function S(t = 6) {
44
65
  return Array.from(
45
66
  { length: t },
46
- (e, n) => T(String(n + 1))
67
+ (e, n) => D(String(n + 1))
47
68
  );
48
69
  }
49
- function I(t = "grid", e) {
70
+ function y(t = "grid", e) {
50
71
  const n = t === "list" ? `
51
- data-layout="list"` : "", p = e ? ` ${e}` : "";
72
+ data-layout="list"` : "", r = e ? ` ${e}` : "";
52
73
  return `
53
74
  <td
54
75
  align="left"
55
- class="${`recommendation-block-v2 esd-block-recommendation-v3-block es-p20${t === "list" ? " es-m-p0 ins-recommendation-list-layout" : ""}${p}`}"${n}>
76
+ class="${`recommendation-block-v2 esd-block-recommendation-v3-block es-p20${t === "list" ? " es-m-p0 ins-recommendation-list-layout" : ""}${r}`}"${n}>
56
77
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
57
78
  <tr>
58
79
  <td align="center">
@@ -84,7 +105,7 @@ function I(t = "grid", e) {
84
105
  </table>
85
106
  </td>
86
107
  </tr>
87
- ${m}
108
+ ${U}
88
109
  <tr>
89
110
  <td>
90
111
  <table
@@ -123,12 +144,15 @@ function I(t = "grid", e) {
123
144
  `;
124
145
  }
125
146
  export {
126
- C as DEFAULTS,
127
- D as DEFAULT_CARD_COMPOSITION,
128
- O as DEFAULT_CARD_VISIBILITY,
129
- d as PLACEHOLDER_IMAGE,
130
- I as createBlockTemplate,
131
- A as getDefaultProducts,
132
- U as sanitizeImageUrl,
133
- m as spacer
147
+ O as CUSTOM_CELL_HTML,
148
+ h as DEFAULTS,
149
+ I as DEFAULT_CARD_COMPOSITION,
150
+ P as DEFAULT_CARD_VISIBILITY,
151
+ C as PLACEHOLDER_IMAGE,
152
+ f as buildElementRenderer,
153
+ y as createBlockTemplate,
154
+ S as getDefaultProducts,
155
+ E as sanitizeImageUrl,
156
+ U as spacer,
157
+ R as toDisplayName
134
158
  };