@useinsider/guido 3.7.0-beta.bd7cb8f → 3.7.0-beta.d579d2a

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 (31) hide show
  1. package/dist/composables/useStripo.js +54 -68
  2. package/dist/config/i18n/en/toasters.json.js +0 -1
  3. package/dist/extensions/Blocks/Recommendation/controls/main/index.js +10 -12
  4. package/dist/extensions/Blocks/Recommendation/controls/main/layoutOrientation.js +24 -33
  5. package/dist/extensions/Blocks/Recommendation/controls/main/productLayout.js +34 -40
  6. package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +287 -330
  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 +96 -53
  15. package/dist/extensions/Blocks/Recommendation/utils/captureStyleTemplates.js +207 -0
  16. package/dist/extensions/Blocks/Recommendation/utils/preserveTextStyles.js +24 -19
  17. package/dist/extensions/Blocks/Recommendation/utils/tagName.js +20 -16
  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/controls/button/index.d.ts +1 -1
  21. package/dist/src/extensions/Blocks/Recommendation/controls/main/utils.d.ts +20 -47
  22. package/dist/src/extensions/Blocks/Recommendation/templates/grid/template.d.ts +4 -4
  23. package/dist/src/extensions/Blocks/Recommendation/templates/index.d.ts +1 -1
  24. package/dist/src/extensions/Blocks/Recommendation/templates/list/template.d.ts +3 -2
  25. package/dist/src/extensions/Blocks/Recommendation/templates/utils.d.ts +158 -11
  26. package/dist/src/extensions/Blocks/Recommendation/utils/captureStyleTemplates.d.ts +85 -0
  27. package/dist/src/extensions/Blocks/Recommendation/utils/preserveTextStyles.d.ts +15 -0
  28. package/dist/src/extensions/Blocks/Recommendation/utils/tagName.d.ts +20 -9
  29. package/dist/src/extensions/Blocks/controlFactories.d.ts +11 -1
  30. package/package.json +1 -1
  31. 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,97 @@
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_CUSTOM_PREFIX as d, ATTR_PRODUCT_IMAGE as u, ATTR_PRODUCT_NAME as b, ATTR_PRODUCT_OLD_PRICE as T, ATTR_PRODUCT_PRICE as g, ATTR_PRODUCT_OMNIBUS_PRICE as p, ATTR_PRODUCT_OMNIBUS_DISCOUNT as _, ATTR_PRODUCT_BUTTON as f } from "../constants/selectors.js";
2
+ function O(t) {
3
3
  return t.replace(/_/g, " ").replace(/\b\w/g, (e) => e.toUpperCase());
4
4
  }
5
- function U(t) {
5
+ function S(t) {
6
6
  const e = Array.isArray(t) ? t[t.length - 1] : t;
7
7
  if (typeof e == "string")
8
8
  return e;
9
9
  if (typeof e == "number")
10
10
  return String(e);
11
11
  }
12
- function C(t, e) {
13
- const n = Object.values(e).find((r) => r.attributeName === t);
12
+ function m(t, e) {
13
+ const n = Object.values(e).find((o) => o.attributeName === t);
14
14
  return (n == null ? void 0 : n.type) === "defaultAttribute";
15
15
  }
16
- function h(t, e) {
17
- return C(t, e) ? t : `product_attribute.${t}`;
16
+ function U(t, e) {
17
+ return m(t, e) ? t : `product_attribute.${t}`;
18
18
  }
19
- const P = Symbol("customCellHtml");
20
- function L(t, e, n = {}) {
21
- const r = t[P];
22
- if (!r)
19
+ const E = Symbol("customCellHtml");
20
+ function B(t, e, n = {}) {
21
+ const o = t[E];
22
+ if (!o)
23
23
  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) => {
24
+ const s = { ...t };
25
+ return e.filter((r) => r.startsWith(d) && !s[r]).forEach((r) => {
26
+ const i = r.substring(d.length), c = O(i), C = U(i, n), y = m(i, n);
27
+ s[r] = (l, h) => {
28
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);
29
+ const R = y ? l[i] : (a = l.product_attributes) == null ? void 0 : a[i], D = S(R) ?? c;
30
+ return o(C, D, h);
31
31
  };
32
- }), i;
32
+ }), s;
33
33
  }
34
34
  const M = {
35
35
  TITLE: "You May Also Like!"
36
- }, $ = [
36
+ }, k = [
37
37
  u,
38
- p,
39
- m,
40
38
  b,
41
39
  T,
40
+ g,
41
+ p,
42
42
  _,
43
- g
44
- ], w = {
43
+ f
44
+ ], x = {
45
45
  [u]: !0,
46
- [p]: !0,
47
46
  [b]: !0,
48
- [m]: !0,
49
- [T]: !1,
47
+ [g]: !0,
48
+ [T]: !0,
49
+ [p]: !1,
50
50
  [_]: !1,
51
- [g]: !0
52
- }, I = `
51
+ [f]: !0
52
+ }, P = 10;
53
+ function I(t = P) {
54
+ return `
53
55
  <tr>
54
- <td class="spacer" style="height: 10px;"></td>
56
+ <td class="spacer" style="height: ${t}px;"></td>
55
57
  </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;
58
+ `;
59
+ }
60
+ const L = I();
61
+ function $(t, e) {
62
+ return e ? e.pStyle ?? "" : t;
63
+ }
64
+ function v(t, e, n) {
65
+ const o = $(e.pStyle, n), s = n ? n.openTags ?? "" : e.openTags, r = n ? n.closeTags ?? "" : e.closeTags;
66
+ return `<p contenteditable="false" style="${o}">${s}${t}${r}</p>`;
67
+ }
68
+ function F(t, e) {
69
+ const n = [];
70
+ return t && n.push(t), e && n.push(`background-color: ${e};`), n.join(" ");
71
+ }
72
+ function H(t) {
73
+ return t ? ` style="background-color: ${t};"` : "";
74
+ }
75
+ function W(t, e = "") {
76
+ return {
77
+ before: (t == null ? void 0 : t.before) ?? e,
78
+ after: (t == null ? void 0 : t.after) ?? ""
79
+ };
80
+ }
81
+ function Y(t, e) {
82
+ return `${(e == null ? void 0 : e.openTags) ?? ""}${t}${(e == null ? void 0 : e.closeTags) ?? ""}`;
83
+ }
84
+ function G(t) {
85
+ return t != null && t.buttonFitToContainer ? "es-button-border es-fw" : "es-button-border";
86
+ }
87
+ const V = "display: block; max-width: 100%; height: auto;", z = "border-width: 1px; background: rgb(217, 234, 211); border-color: rgb(106, 168, 79);", j = "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;", A = "https://email-static.useinsider.com/stripo/modules/email-recommendation-v3/assets/images/image-placeholder.png";
88
+ function X(t) {
89
+ return !t || typeof t != "string" || t.trim() === "" ? A : t.startsWith("http://") ? t.replace("http://", "https://") : t;
59
90
  }
60
- function E(t) {
91
+ function w(t) {
61
92
  return {
62
93
  name: "Product Name",
63
- image_url: f,
94
+ image_url: A,
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 q(t = 6) {
76
107
  return Array.from(
77
108
  { length: t },
78
- (e, n) => E(String(n + 1))
109
+ (e, n) => w(String(n + 1))
79
110
  );
80
111
  }
81
- function x(t = "grid", e) {
112
+ function J(t = "grid", e) {
82
113
  const n = t === "list" ? `
83
- data-layout="list"` : "", r = e ? ` ${e}` : "";
114
+ data-layout="list"` : "", o = 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" : ""}${o}`}"${n}>
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
+ ${L}
120
151
  <tr>
121
152
  <td>
122
153
  <table
@@ -155,18 +186,30 @@ function x(t = "grid", e) {
155
186
  `;
156
187
  }
157
188
  export {
158
- P as CUSTOM_CELL_HTML,
189
+ E as CUSTOM_CELL_HTML,
159
190
  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,
166
- C as isDefaultAttribute,
167
- h as resolveProductAttrValue,
168
- N as sanitizeImageUrl,
169
- I as spacer,
170
- y as toDisplayName,
171
- U as toDisplayableAttributeValue
191
+ j as DEFAULT_BUTTON_ANCHOR_STYLE,
192
+ z as DEFAULT_BUTTON_BORDER_STYLE,
193
+ k as DEFAULT_CARD_COMPOSITION,
194
+ x as DEFAULT_CARD_VISIBILITY,
195
+ V as DEFAULT_IMG_STYLE,
196
+ P as DEFAULT_ROW_SPACING_PX,
197
+ A as PLACEHOLDER_IMAGE,
198
+ B as buildElementRenderer,
199
+ I as buildSpacer,
200
+ H as cellBgStyleAttr,
201
+ J as createBlockTemplate,
202
+ q as getDefaultProducts,
203
+ m as isDefaultAttribute,
204
+ Y as renderButtonLabel,
205
+ v as renderStyledParagraph,
206
+ G as resolveButtonBorderClass,
207
+ W as resolveOmnibusText,
208
+ $ as resolvePStyle,
209
+ U as resolveProductAttrValue,
210
+ F as resolveSegmentBgStyle,
211
+ X as sanitizeImageUrl,
212
+ L as spacer,
213
+ O as toDisplayName,
214
+ S as toDisplayableAttributeValue
172
215
  };