@useinsider/guido 3.7.2-beta.0ef1511 → 3.7.2-beta.1489585

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 (37) hide show
  1. package/dist/config/compiler/utils/recommendationCompilerUtils.js +19 -25
  2. package/dist/extensions/Blocks/Recommendation/constants/selectors.js +11 -10
  3. package/dist/extensions/Blocks/Recommendation/controls/main/index.js +24 -26
  4. package/dist/extensions/Blocks/Recommendation/controls/main/layoutOrientation.js +30 -39
  5. package/dist/extensions/Blocks/Recommendation/controls/main/productLayout.js +28 -34
  6. package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +285 -333
  7. package/dist/extensions/Blocks/Recommendation/extension.js +6 -5
  8. package/dist/extensions/Blocks/Recommendation/settingsPanel.js +3 -2
  9. package/dist/extensions/Blocks/Recommendation/templates/grid/elementRenderer.js +142 -173
  10. package/dist/extensions/Blocks/Recommendation/templates/grid/template.js +56 -30
  11. package/dist/extensions/Blocks/Recommendation/templates/index.js +29 -8
  12. package/dist/extensions/Blocks/Recommendation/templates/list/elementRenderer.js +132 -105
  13. package/dist/extensions/Blocks/Recommendation/templates/list/template.js +44 -23
  14. package/dist/extensions/Blocks/Recommendation/templates/utils.js +112 -64
  15. package/dist/extensions/Blocks/Recommendation/utils/captureStyleTemplates.js +216 -0
  16. package/dist/extensions/Blocks/Recommendation/utils/preserveTextStyles.js +24 -19
  17. package/dist/extensions/Blocks/Recommendation/utils/tagName.js +30 -22
  18. package/dist/extensions/Blocks/controlFactories.js +159 -133
  19. package/dist/src/extensions/Blocks/Items/controls/index.d.ts +1 -1
  20. package/dist/src/extensions/Blocks/Recommendation/constants/index.d.ts +1 -1
  21. package/dist/src/extensions/Blocks/Recommendation/constants/selectors.d.ts +2 -0
  22. package/dist/src/extensions/Blocks/Recommendation/controls/button/index.d.ts +1 -1
  23. package/dist/src/extensions/Blocks/Recommendation/controls/main/layoutOrientation.d.ts +2 -1
  24. package/dist/src/extensions/Blocks/Recommendation/controls/main/utils.d.ts +20 -47
  25. package/dist/src/extensions/Blocks/Recommendation/templates/grid/template.d.ts +4 -4
  26. package/dist/src/extensions/Blocks/Recommendation/templates/index.d.ts +1 -1
  27. package/dist/src/extensions/Blocks/Recommendation/templates/list/template.d.ts +3 -2
  28. package/dist/src/extensions/Blocks/Recommendation/templates/utils.d.ts +165 -11
  29. package/dist/src/extensions/Blocks/Recommendation/utils/captureStyleTemplates.d.ts +78 -0
  30. package/dist/src/extensions/Blocks/Recommendation/utils/preserveTextStyles.d.ts +15 -0
  31. package/dist/src/extensions/Blocks/Recommendation/utils/tagName.d.ts +29 -9
  32. package/dist/src/extensions/Blocks/controlFactories.d.ts +11 -1
  33. package/package.json +10 -1
  34. package/dist/src/composables/validators/useUnsubscribeBlockValidator.test.d.ts +0 -1
  35. package/dist/src/extensions/Blocks/Recommendation/block.test.d.ts +0 -1
  36. package/dist/src/extensions/Blocks/Recommendation/utils/recommendationBlockCount.test.d.ts +0 -1
  37. package/dist/src/extensions/Blocks/Recommendation/utils/stylePreserver.d.ts +0 -113
@@ -1,10 +1,11 @@
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;
1
+ import { RecommendationBlockId as t } from "../../constants/blockIds.js";
2
+ import { ATTR_PRODUCT_ATTR as R, ATTR_PRODUCT_BUTTON as C, CSS_CLASS_RECO_BUTTON as _, ATTR_PRODUCT_OMNIBUS_DISCOUNT as A, ATTR_PRODUCT_OMNIBUS_PRICE as U, ATTR_PRODUCT_OLD_PRICE as k, ATTR_PRODUCT_PRICE as B, ATTR_PRODUCT_NAME as E, ATTR_PRODUCT_IMAGE as f } from "../../constants/selectors.js";
3
+ import { useRecommendationExtensionStore as P } from "../../store/recommendation.js";
4
+ import { formatPrice as I } from "../../utils/priceFormatter.js";
5
+ import { CUSTOM_CELL_HTML as h, renderStyledParagraph as u, cellBgStyleAttr as d, DEFAULT_BUTTON_BORDER_STYLE as L, renderButtonLabel as N, DEFAULT_BUTTON_ANCHOR_STYLE as D, resolveButtonBorderClass as v, resolvePStyle as y, resolveOmnibusText as S, DEFAULT_IMG_STYLE as M, sanitizeImageUrl as w } from "../utils.js";
6
+ const z = `${D} padding: 5px 30px;`;
7
+ function x() {
8
+ const r = P(), { currencySettings: e } = r.recommendationConfigs;
8
9
  return {
9
10
  code: e.value,
10
11
  symbol: e.symbol,
@@ -14,120 +15,152 @@ function b() {
14
15
  thousandSeparator: e.thousandSeparator
15
16
  };
16
17
  }
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
18
+ function T(r, e = "price") {
19
+ const l = x(), a = r[e], c = (a == null ? void 0 : a[l.code]) ?? Object.values(a ?? {})[0] ?? 0;
20
+ return I({
21
+ price: c,
22
+ currency: l
22
23
  });
23
24
  }
24
- const I = {
25
+ const V = {
25
26
  /**
26
27
  * Image cell - left column (120px fixed width)
27
28
  * Has recommendation-attribute-row class and data attributes for Card Composition control
28
29
  */
29
- [p]: (t) => `
30
+ [f]: (r, e) => {
31
+ var a;
32
+ const l = ((a = e == null ? void 0 : e.styleTemplate) == null ? void 0 : a.imgStyle) ?? M;
33
+ return `
30
34
  <td
31
35
  width="120"
32
36
  class="esd-block-image product-image-cell recommendation-attribute-row es-p5"
33
- esd-extension-block-id="${o.IMAGE}"
34
- data-attribute-type="${p}"
37
+ esd-extension-block-id="${t.IMAGE}"
38
+ data-attribute-type="${f}"
35
39
  data-visibility="1"
36
40
  align="center"
37
41
  valign="middle">
38
- <a target="_blank" href="${t.url}" class="${d}">
42
+ <a target="_blank" href="${r.url}" class="${_}">
39
43
  <img
40
- src="${$(t.image_url)}"
41
- alt="${t.name}"
42
- style="display: block; max-width: 100%; height: auto;"
44
+ src="${w(r.image_url)}"
45
+ alt="${r.name}"
46
+ style="${l}"
43
47
  class="adapt-img product-image">
44
48
  </a>
45
49
  </td>
46
- `,
50
+ `;
51
+ },
47
52
  /**
48
53
  * Name element - row for info cell table
49
54
  */
50
- [_]: (t) => `
55
+ [E]: (r, e) => {
56
+ const l = u(
57
+ r.name,
58
+ {
59
+ pStyle: "font-size: 16px; color: #333333; font-weight: 600; margin: 0;",
60
+ openTags: "<strong>",
61
+ closeTags: "</strong>"
62
+ },
63
+ e == null ? void 0 : e.styleTemplate
64
+ );
65
+ return `
51
66
  <tr>
52
67
  <td
53
- class="esd-block-text product-name"
54
- esd-extension-block-id="${o.NAME}"
55
- align="left">
56
- <p contenteditable="false" style="font-size: 16px; color: #333333; font-weight: 600; margin: 0;">
57
- <strong>${t.name}</strong>
58
- </p>
68
+ class="esd-block-text product-name${e != null && e.cellClasses ? ` ${e.cellClasses}` : ""}"
69
+ esd-extension-block-id="${t.NAME}"${d(e == null ? void 0 : e.cellBackgroundColor)}
70
+ align="${(e == null ? void 0 : e.cellAlignment) ?? "left"}">
71
+ ${l}
59
72
  </td>
60
73
  </tr>
61
- `,
74
+ `;
75
+ },
62
76
  /**
63
77
  * Price element - row for info cell table
64
78
  */
65
- [x]: (t) => `
79
+ [B]: (r, e) => {
80
+ const l = u(
81
+ T(r, "price"),
82
+ {
83
+ pStyle: "font-size: 16px; color: #333333; font-weight: bold; margin: 0;",
84
+ openTags: "<strong>",
85
+ closeTags: "</strong>"
86
+ },
87
+ e == null ? void 0 : e.styleTemplate
88
+ );
89
+ return `
66
90
  <tr>
67
91
  <td
68
- class="esd-block-text product-price"
69
- esd-extension-block-id="${o.PRICE}"
70
- align="left">
71
- <p contenteditable="false" style="font-size: 16px; color: #333333; font-weight: bold; margin: 0;">
72
- <strong>${r(t, "price")}</strong>
73
- </p>
92
+ class="esd-block-text product-price${e != null && e.cellClasses ? ` ${e.cellClasses}` : ""}"
93
+ esd-extension-block-id="${t.PRICE}"${d(e == null ? void 0 : e.cellBackgroundColor)}
94
+ align="${(e == null ? void 0 : e.cellAlignment) ?? "left"}">
95
+ ${l}
74
96
  </td>
75
97
  </tr>
76
- `,
98
+ `;
99
+ },
77
100
  /**
78
101
  * Old price element - row for info cell table
79
102
  */
80
- [T]: (t) => `
103
+ [k]: (r, e) => {
104
+ const l = u(
105
+ T(r, "original_price"),
106
+ {
107
+ pStyle: "font-size: 14px; color: #999999; margin: 0;",
108
+ openTags: "<s><strong>",
109
+ closeTags: "</strong></s>"
110
+ },
111
+ e == null ? void 0 : e.styleTemplate
112
+ );
113
+ return `
81
114
  <tr>
82
115
  <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>
116
+ class="esd-block-text product-old-price${e != null && e.cellClasses ? ` ${e.cellClasses}` : ""}"
117
+ esd-extension-block-id="${t.OLD_PRICE}"${d(e == null ? void 0 : e.cellBackgroundColor)}
118
+ align="${(e == null ? void 0 : e.cellAlignment) ?? "left"}">
119
+ ${l}
91
120
  </td>
92
121
  </tr>
93
- `,
122
+ `;
123
+ },
94
124
  /**
95
125
  * Omnibus price element - row for info cell table
96
126
  */
97
- [f]: (t) => `
127
+ [U]: (r, e) => {
128
+ const l = y("font-size: 12px; color: #666666; margin: 0;", e == null ? void 0 : e.styleTemplate), { before: a, after: c } = S(e == null ? void 0 : e.omnibusText, "Lowest 30-day price: ");
129
+ return `
98
130
  <tr>
99
131
  <td
100
- class="esd-block-text product-omnibus-price"
101
- data-text-before="Lowest 30-day price: "
102
- data-text-after=""
103
- esd-extension-block-id="${o.OMNIBUS_PRICE}"
104
- align="left">
105
- <p contenteditable="false" style="font-size: 12px; color: #666666; margin: 0;">
106
- <span class="omnibus-text-before">Lowest 30-day price: </span>
107
- <span class="omnibus-price-value">${r(t, "original_price")}</span>
108
- <span class="omnibus-text-after"></span>
132
+ class="esd-block-text product-omnibus-price${e != null && e.cellClasses ? ` ${e.cellClasses}` : ""}"
133
+ data-text-before="${a}"
134
+ data-text-after="${c}"
135
+ esd-extension-block-id="${t.OMNIBUS_PRICE}"${d(e == null ? void 0 : e.cellBackgroundColor)}
136
+ align="${(e == null ? void 0 : e.cellAlignment) ?? "left"}">
137
+ <p contenteditable="false" style="${l}">
138
+ <span class="omnibus-text-before">${a}</span>
139
+ <span class="omnibus-price-value">${T(r, "original_price")}</span>
140
+ <span class="omnibus-text-after">${c}</span>
109
141
  </p>
110
142
  </td>
111
143
  </tr>
112
- `,
144
+ `;
145
+ },
113
146
  /**
114
147
  * Omnibus discount element - row for info cell table
115
148
  */
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%";
149
+ [A]: (r, e) => {
150
+ var b, n;
151
+ const l = y("font-size: 12px; color: #666666; margin: 0;", e == null ? void 0 : e.styleTemplate), a = x(), c = ((b = r.original_price) == null ? void 0 : b[a.code]) ?? Object.values(r.original_price ?? {})[0] ?? 0, s = ((n = r.price) == null ? void 0 : n[a.code]) ?? Object.values(r.price ?? {})[0] ?? 0, g = c > 0 ? Math.round((c - s) / c * 100) : 0, O = g > 0 ? `-${g}%` : "0%", { before: m, after: $ } = S(e == null ? void 0 : e.omnibusText);
119
152
  return `
120
153
  <tr>
121
154
  <td
122
- class="esd-block-text product-omnibus-discount"
123
- data-text-before=""
124
- data-text-after=""
125
- esd-extension-block-id="${o.OMNIBUS_DISCOUNT}"
126
- align="left">
127
- <p contenteditable="false" style="font-size: 12px; color: #666666; margin: 0;">
128
- <span class="omnibus-text-before"></span>
129
- <span class="omnibus-discount-value">${m}</span>
130
- <span class="omnibus-text-after"></span>
155
+ class="esd-block-text product-omnibus-discount${e != null && e.cellClasses ? ` ${e.cellClasses}` : ""}"
156
+ data-text-before="${m}"
157
+ data-text-after="${$}"
158
+ esd-extension-block-id="${t.OMNIBUS_DISCOUNT}"${d(e == null ? void 0 : e.cellBackgroundColor)}
159
+ align="${(e == null ? void 0 : e.cellAlignment) ?? "left"}">
160
+ <p contenteditable="false" style="${l}">
161
+ <span class="omnibus-text-before">${m}</span>
162
+ <span class="omnibus-discount-value">${O}</span>
163
+ <span class="omnibus-text-after">${$}</span>
131
164
  </p>
132
165
  </td>
133
166
  </tr>
@@ -137,60 +170,54 @@ const I = {
137
170
  * Button cell - right column (100px fixed width)
138
171
  * Has recommendation-attribute-row class and data attributes for Card Composition control
139
172
  */
140
- [c]: (t) => `
173
+ [C]: (r, e) => {
174
+ const l = e == null ? void 0 : e.styleTemplate, a = (l == null ? void 0 : l.buttonBorderStyle) ?? L, c = (l == null ? void 0 : l.buttonAnchorStyle) ?? z, s = N((l == null ? void 0 : l.buttonText) ?? "Buy", l);
175
+ return `
141
176
  <td
142
177
  width="100"
143
- 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}"
178
+ class="esd-block-button button-cell recommendation-attribute-row product-button ${(e == null ? void 0 : e.cellClasses) ?? "es-p5l es-p5r"}"
179
+ esd-extension-block-id="${t.BUTTON}"
180
+ data-attribute-type="${C}"
146
181
  data-visibility="1"
147
- align="center"
182
+ align="${(e == null ? void 0 : e.cellAlignment) ?? "center"}"
148
183
  valign="middle">
149
- <span
150
- class="es-button-border"
151
- style="
152
- border-width: 1px;
153
- background: rgb(217, 234, 211);
154
- border-color: rgb(106, 168, 79);
155
- ">
184
+ <span class="${v(l)}" style="${a}">
156
185
  <a
157
- href="${t.url}"
186
+ href="${r.url}"
158
187
  target="_blank"
159
- class="es-button ${d}"
160
- style="
161
- color: rgb(56, 118, 29);
162
- background: rgb(217, 234, 211);
163
- font-family: arial, 'helvetica neue', helvetica, sans-serif;
164
- font-size: 16px;
165
- font-weight: normal;
166
- line-height: 120%;
167
- padding: 5px 30px;
168
- mso-border-alt: 10px solid rgb(217, 234, 211);
169
- mso-padding-alt: 0;
170
- ">
171
- Buy
188
+ class="es-button ${_}"
189
+ style="${c}">
190
+ ${s}
172
191
  </a>
173
192
  </span>
174
193
  </td>
175
- `,
194
+ `;
195
+ },
176
196
  /**
177
197
  * Custom attribute row template — same tr-td structure as Name, Price, etc.
178
198
  * Used by `buildElementRenderer` for `customAttr:*` composition entries.
179
199
  * @param productAttrValue - Resolved product-attr value (e.g., "brand" for default, "product_attribute.rating_star" for custom)
180
200
  * @param content - Display content for the cell
181
201
  */
182
- [O]: (t, e) => `
202
+ [h]: (r, e, l) => {
203
+ const a = u(
204
+ e,
205
+ { pStyle: "font-size: 12px; color: #666666; margin: 0;", openTags: "", closeTags: "" },
206
+ l == null ? void 0 : l.styleTemplate
207
+ );
208
+ return `
183
209
  <tr>
184
210
  <td
185
- ${u}="${t}"
186
- class="esd-block-text product-custom-attribute"
187
- esd-extension-block-id="${o.CUSTOM_ATTRIBUTE}"
188
- align="left">
189
- <p contenteditable="false" style="font-size: 12px; color: #666666; margin: 0;">${e}</p>
211
+ ${R}="${r}"
212
+ class="esd-block-text product-custom-attribute${l != null && l.cellClasses ? ` ${l.cellClasses}` : ""}"
213
+ esd-extension-block-id="${t.CUSTOM_ATTRIBUTE}"${d(l == null ? void 0 : l.cellBackgroundColor)}
214
+ align="${(l == null ? void 0 : l.cellAlignment) ?? "left"}">
215
+ ${a}
190
216
  </td>
191
217
  </tr>
192
- `
218
+ `;
219
+ }
193
220
  };
194
221
  export {
195
- I as listElementRenderer
222
+ V as listElementRenderer
196
223
  };
@@ -1,22 +1,23 @@
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 b, ATTR_PRODUCT_BUTTON as s } from "../../constants/selectors.js";
2
+ import { buildSpacer as I, DEFAULT_CARD_COMPOSITION as O, buildElementRenderer as T, DEFAULT_CARD_VISIBILITY as S } from "../utils.js";
3
+ import { listElementRenderer as N } from "./elementRenderer.js";
4
+ const L = "0 5px";
5
+ function U(n, r, e) {
6
+ const l = e ? "" : ' style="display: none;"', a = n.replace(/<tr>/, "").replace(/<\/tr>/, "");
6
7
  return `<tr
7
8
  class="recommendation-attribute-row"
8
- data-attribute-type="${n}"
9
- data-visibility="${l ? "1" : "0"}"${t}>${o}</tr>`;
9
+ data-attribute-type="${r}"
10
+ data-visibility="${e ? "1" : "0"}"${l}>${a}</tr>`;
10
11
  }
11
- const y = `
12
+ const $ = `
12
13
  <tr class="recommendation-product-row">
13
- <td style="padding: 0 5px;">
14
+ <td style="padding: {-{-CARD_PADDING-}-};">
14
15
  <table
15
16
  width="100%"
16
17
  cellpadding="0"
17
18
  cellspacing="0"
18
19
  border="0"
19
- class="product-card-wrapper">
20
+ class="product-card-wrapper"{-{-WRAPPER_STYLE-}-}>
20
21
  <tbody>
21
22
  <tr>
22
23
  {-{-PRODUCT_CONTENT-}-}
@@ -26,29 +27,49 @@ const y = `
26
27
  </td>
27
28
  </tr>
28
29
  `;
29
- function O(r, n = b, l = {}) {
30
- const t = C(f, n, l), o = t[a](r), c = `
30
+ function x(n, r = O, e = {}, l = {}) {
31
+ const {
32
+ cellPadding: a = L,
33
+ styleTemplates: o,
34
+ cardBackgroundColor: p,
35
+ cellBackgroundColors: c,
36
+ cellAlignments: d,
37
+ cellClasses: i,
38
+ omnibusTexts: R,
39
+ visibility: C
40
+ } = l, D = p ? ` style="background-color: ${p};"` : "", u = T(N, r, e), _ = { styleTemplate: o == null ? void 0 : o[b] }, P = u[b](n, _), m = `
31
41
  <td class="product-info-cell" valign="middle" style="padding: 15px;">
32
42
  <table cellpadding="0" cellspacing="0" role="presentation" width="100%" style="table-layout: fixed;">
33
43
  <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);
44
+ ${r.filter((t) => t !== b && t !== s).filter((t) => u[t]).map((t) => {
45
+ const w = (C == null ? void 0 : C[t]) ?? S[t] ?? !0, E = u[t](n, {
46
+ styleTemplate: o == null ? void 0 : o[t],
47
+ cellBackgroundColor: c == null ? void 0 : c[t],
48
+ cellAlignment: d == null ? void 0 : d[t],
49
+ cellClasses: i == null ? void 0 : i[t],
50
+ omnibusText: R == null ? void 0 : R[t]
51
+ });
52
+ return U(E, t, w);
37
53
  }).join(`
38
54
  `)}
39
55
  </tbody>
40
56
  </table>
41
57
  </td>
42
- `, s = t[d](r), p = o + c + s;
43
- return y.replace("{-{-PRODUCT_CONTENT-}-}", p);
58
+ `, A = {
59
+ styleTemplate: o == null ? void 0 : o[s],
60
+ cellAlignment: d == null ? void 0 : d[s],
61
+ cellClasses: i == null ? void 0 : i[s]
62
+ }, f = u[s](n, A), g = P + m + f;
63
+ return $.replace("{-{-CARD_PADDING-}-}", a).replace("{-{-WRAPPER_STYLE-}-}", D).replace("{-{-PRODUCT_CONTENT-}-}", g);
44
64
  }
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;
65
+ function B(n, r, e = {}, l = {}) {
66
+ const a = I(l.rowSpacingPx);
67
+ return n.map((o, p) => {
68
+ const c = x(o, r, e, l);
69
+ return p > 0 ? a + c : c;
49
70
  }).join("");
50
71
  }
51
72
  export {
52
- O as getListProductCard,
53
- D as prepareProductRows
73
+ x as getListProductCard,
74
+ B as prepareProductRows
54
75
  };
@@ -1,66 +1,101 @@
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) {
3
- return t.replace(/_/g, " ").replace(/\b\w/g, (e) => e.toUpperCase());
4
- }
1
+ import { ATTR_CUSTOM_PREFIX as c, ATTR_PRODUCT_IMAGE as b, ATTR_PRODUCT_NAME as T, ATTR_PRODUCT_OLD_PRICE as g, ATTR_PRODUCT_PRICE as _, ATTR_PRODUCT_OMNIBUS_PRICE as f, ATTR_PRODUCT_OMNIBUS_DISCOUNT as p, ATTR_PRODUCT_BUTTON as m, PRODUCT_ATTRIBUTE_PREFIX as l } from "../constants/selectors.js";
5
2
  function U(t) {
6
- const e = Array.isArray(t) ? t[t.length - 1] : t;
7
- if (typeof e == "string")
8
- return e;
9
- if (typeof e == "number")
10
- return String(e);
3
+ return t.replace(/_/g, " ").replace(/\b\w/g, (n) => n.toUpperCase());
4
+ }
5
+ function S(t) {
6
+ const n = Array.isArray(t) ? t[t.length - 1] : t;
7
+ if (typeof n == "string")
8
+ return n;
9
+ if (typeof n == "number")
10
+ return String(n);
11
+ }
12
+ function C(t, n) {
13
+ const e = Object.values(n).find((o) => o.attributeName === t);
14
+ return (e == null ? void 0 : e.type) === "defaultAttribute";
11
15
  }
12
- function C(t, e) {
13
- const n = Object.values(e).find((r) => r.attributeName === t);
14
- return (n == null ? void 0 : n.type) === "defaultAttribute";
16
+ function E(t, n) {
17
+ return C(t, n) ? t : `${l}${t}`;
15
18
  }
16
- function h(t, e) {
17
- return C(t, e) ? t : `product_attribute.${t}`;
19
+ function M(t) {
20
+ const n = t.startsWith(l) ? t.substring(l.length) : t;
21
+ return `${c}${n}`;
18
22
  }
19
23
  const P = Symbol("customCellHtml");
20
- function L(t, e, n = {}) {
21
- const r = t[P];
22
- if (!r)
24
+ function k(t, n, e = {}) {
25
+ const o = t[P];
26
+ if (!o)
23
27
  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);
28
+ const s = { ...t };
29
+ return n.filter((r) => r.startsWith(c) && !s[r]).forEach((r) => {
30
+ const i = r.substring(c.length), a = U(i), y = E(i, e), R = C(i, e);
31
+ s[r] = (d, A) => {
32
+ var u;
33
+ const D = R ? d[i] : (u = d.product_attributes) == null ? void 0 : u[i], O = S(D) ?? a;
34
+ return o(y, O, A);
31
35
  };
32
- }), i;
36
+ }), s;
33
37
  }
34
- const M = {
38
+ const x = {
35
39
  TITLE: "You May Also Like!"
36
- }, $ = [
37
- u,
38
- p,
39
- m,
40
+ }, v = [
40
41
  b,
41
42
  T,
43
+ g,
42
44
  _,
43
- g
44
- ], w = {
45
- [u]: !0,
46
- [p]: !0,
45
+ f,
46
+ p,
47
+ m
48
+ ], F = {
47
49
  [b]: !0,
48
- [m]: !0,
49
- [T]: !1,
50
- [_]: !1,
51
- [g]: !0
52
- }, I = `
50
+ [T]: !0,
51
+ [_]: !0,
52
+ [g]: !0,
53
+ [f]: !1,
54
+ [p]: !1,
55
+ [m]: !0
56
+ }, I = 10;
57
+ function $(t = I) {
58
+ return `
53
59
  <tr>
54
- <td class="spacer" style="height: 10px;"></td>
60
+ <td class="spacer" style="height: ${t}px;"></td>
55
61
  </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;
62
+ `;
63
+ }
64
+ const L = $();
65
+ function w(t, n) {
66
+ return n ? n.pStyle ?? "" : t;
67
+ }
68
+ function W(t, n, e) {
69
+ const o = w(n.pStyle, e), s = e ? e.openTags ?? "" : n.openTags, r = e ? e.closeTags ?? "" : n.closeTags;
70
+ return `<p contenteditable="false" style="${o}">${s}${t}${r}</p>`;
71
+ }
72
+ function H(t, n) {
73
+ const e = [];
74
+ return t && e.push(t), n && e.push(`background-color: ${n};`), e.join(" ");
75
+ }
76
+ function Y(t) {
77
+ return t ? ` style="background-color: ${t};"` : "";
78
+ }
79
+ function G(t, n = "") {
80
+ return {
81
+ before: (t == null ? void 0 : t.before) ?? n,
82
+ after: (t == null ? void 0 : t.after) ?? ""
83
+ };
84
+ }
85
+ function z(t, n) {
86
+ return `${(n == null ? void 0 : n.openTags) ?? ""}${t}${(n == null ? void 0 : n.closeTags) ?? ""}`;
87
+ }
88
+ function X(t) {
89
+ return t != null && t.buttonFitToContainer ? "es-button-border es-fw" : "es-button-border";
90
+ }
91
+ const j = "display: block; max-width: 100%; height: auto;", V = "border-width: 1px; background: rgb(217, 234, 211); border-color: rgb(106, 168, 79);", K = "color: rgb(56, 118, 29); background: rgb(217, 234, 211); font-family: arial, 'helvetica neue', helvetica, sans-serif; font-size: 16px; font-weight: normal; line-height: 120%; mso-border-alt: 10px solid rgb(217, 234, 211); mso-padding-alt: 0;", h = "https://email-static.useinsider.com/stripo/modules/email-recommendation-v3/assets/images/image-placeholder.png";
92
+ function q(t) {
93
+ return !t || typeof t != "string" || t.trim() === "" ? h : t.startsWith("http://") ? t.replace("http://", "https://") : t;
59
94
  }
60
- function E(t) {
95
+ function B(t) {
61
96
  return {
62
97
  name: "Product Name",
63
- image_url: f,
98
+ image_url: h,
64
99
  price: { USD: 18 },
65
100
  original_price: { USD: 20 },
66
101
  discount: { USD: 2 },
@@ -72,19 +107,19 @@ function E(t) {
72
107
  category: []
73
108
  };
74
109
  }
75
- function k(t = 6) {
110
+ function J(t = 6) {
76
111
  return Array.from(
77
112
  { length: t },
78
- (e, n) => E(String(n + 1))
113
+ (n, e) => B(String(e + 1))
79
114
  );
80
115
  }
81
- function x(t = "grid", e) {
82
- const n = t === "list" ? `
83
- data-layout="list"` : "", r = e ? ` ${e}` : "";
116
+ function Q(t = "grid", n) {
117
+ const e = t === "list" ? `
118
+ data-layout="list"` : "", o = n ? ` ${n}` : "";
84
119
  return `
85
120
  <td
86
121
  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}>
122
+ class="${`recommendation-block-v2 esd-block-recommendation-v3-block es-p20${t === "list" ? " es-m-p0 ins-recommendation-list-layout" : ""}${o}`}"${e}>
88
123
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
89
124
  <tr>
90
125
  <td align="center">
@@ -116,7 +151,7 @@ function x(t = "grid", e) {
116
151
  </table>
117
152
  </td>
118
153
  </tr>
119
- ${I}
154
+ ${L}
120
155
  <tr>
121
156
  <td>
122
157
  <table
@@ -156,17 +191,30 @@ function x(t = "grid", e) {
156
191
  }
157
192
  export {
158
193
  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,
194
+ x as DEFAULTS,
195
+ K as DEFAULT_BUTTON_ANCHOR_STYLE,
196
+ V as DEFAULT_BUTTON_BORDER_STYLE,
197
+ v as DEFAULT_CARD_COMPOSITION,
198
+ F as DEFAULT_CARD_VISIBILITY,
199
+ j as DEFAULT_IMG_STYLE,
200
+ I as DEFAULT_ROW_SPACING_PX,
201
+ h as PLACEHOLDER_IMAGE,
202
+ k as buildElementRenderer,
203
+ $ as buildSpacer,
204
+ Y as cellBgStyleAttr,
205
+ Q as createBlockTemplate,
206
+ J as getDefaultProducts,
166
207
  C as isDefaultAttribute,
167
- h as resolveProductAttrValue,
168
- N as sanitizeImageUrl,
169
- I as spacer,
170
- y as toDisplayName,
171
- U as toDisplayableAttributeValue
208
+ z as renderButtonLabel,
209
+ W as renderStyledParagraph,
210
+ X as resolveButtonBorderClass,
211
+ G as resolveOmnibusText,
212
+ w as resolvePStyle,
213
+ E as resolveProductAttrValue,
214
+ H as resolveSegmentBgStyle,
215
+ q as sanitizeImageUrl,
216
+ L as spacer,
217
+ M as toCustomCompositionKey,
218
+ U as toDisplayName,
219
+ S as toDisplayableAttributeValue
172
220
  };