@useinsider/guido 3.8.0-beta.84f6c0a → 3.8.0-beta.bf9ea20

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 (38) hide show
  1. package/dist/config/compiler/utils/recommendationCompilerUtils.js +25 -19
  2. package/dist/extensions/Blocks/Items/block.js +48 -29
  3. package/dist/extensions/Blocks/Items/utils/nodeConfigUtils.js +62 -45
  4. package/dist/extensions/Blocks/Recommendation/constants/selectors.js +10 -11
  5. package/dist/extensions/Blocks/Recommendation/controls/main/index.js +26 -24
  6. package/dist/extensions/Blocks/Recommendation/controls/main/layoutOrientation.js +39 -30
  7. package/dist/extensions/Blocks/Recommendation/controls/main/productLayout.js +34 -28
  8. package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +333 -285
  9. package/dist/extensions/Blocks/Recommendation/extension.js +5 -6
  10. package/dist/extensions/Blocks/Recommendation/settingsPanel.js +2 -3
  11. package/dist/extensions/Blocks/Recommendation/templates/grid/elementRenderer.js +173 -142
  12. package/dist/extensions/Blocks/Recommendation/templates/grid/template.js +30 -56
  13. package/dist/extensions/Blocks/Recommendation/templates/index.js +8 -29
  14. package/dist/extensions/Blocks/Recommendation/templates/list/elementRenderer.js +105 -132
  15. package/dist/extensions/Blocks/Recommendation/templates/list/template.js +23 -44
  16. package/dist/extensions/Blocks/Recommendation/templates/utils.js +64 -112
  17. package/dist/extensions/Blocks/Recommendation/utils/preserveTextStyles.js +19 -24
  18. package/dist/extensions/Blocks/Recommendation/utils/tagName.js +22 -30
  19. package/dist/extensions/Blocks/controlFactories.js +133 -159
  20. package/dist/src/extensions/Blocks/Items/block.d.ts +8 -0
  21. package/dist/src/extensions/Blocks/Items/controls/index.d.ts +1 -1
  22. package/dist/src/extensions/Blocks/Items/utils/nodeConfigUtils.d.ts +1 -1
  23. package/dist/src/extensions/Blocks/Recommendation/constants/index.d.ts +1 -1
  24. package/dist/src/extensions/Blocks/Recommendation/constants/selectors.d.ts +0 -2
  25. package/dist/src/extensions/Blocks/Recommendation/controls/button/index.d.ts +1 -1
  26. package/dist/src/extensions/Blocks/Recommendation/controls/main/layoutOrientation.d.ts +1 -2
  27. package/dist/src/extensions/Blocks/Recommendation/controls/main/utils.d.ts +47 -20
  28. package/dist/src/extensions/Blocks/Recommendation/templates/grid/template.d.ts +4 -4
  29. package/dist/src/extensions/Blocks/Recommendation/templates/index.d.ts +1 -1
  30. package/dist/src/extensions/Blocks/Recommendation/templates/list/template.d.ts +2 -3
  31. package/dist/src/extensions/Blocks/Recommendation/templates/utils.d.ts +11 -165
  32. package/dist/src/extensions/Blocks/Recommendation/utils/preserveTextStyles.d.ts +0 -15
  33. package/dist/src/extensions/Blocks/Recommendation/utils/stylePreserver.d.ts +113 -0
  34. package/dist/src/extensions/Blocks/Recommendation/utils/tagName.d.ts +9 -29
  35. package/dist/src/extensions/Blocks/controlFactories.d.ts +1 -11
  36. package/package.json +1 -1
  37. package/dist/extensions/Blocks/Recommendation/utils/captureStyleTemplates.js +0 -219
  38. package/dist/src/extensions/Blocks/Recommendation/utils/captureStyleTemplates.d.ts +0 -78
@@ -1,11 +1,10 @@
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;
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;
9
8
  return {
10
9
  code: e.value,
11
10
  symbol: e.symbol,
@@ -15,152 +14,120 @@ function x() {
15
14
  thousandSeparator: e.thousandSeparator
16
15
  };
17
16
  }
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
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
23
22
  });
24
23
  }
25
- const V = {
24
+ const I = {
26
25
  /**
27
26
  * Image cell - left column (120px fixed width)
28
27
  * Has recommendation-attribute-row class and data attributes for Card Composition control
29
28
  */
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 `
29
+ [p]: (t) => `
34
30
  <td
35
31
  width="120"
36
32
  class="esd-block-image product-image-cell recommendation-attribute-row es-p5"
37
- esd-extension-block-id="${t.IMAGE}"
38
- data-attribute-type="${f}"
33
+ esd-extension-block-id="${o.IMAGE}"
34
+ data-attribute-type="${p}"
39
35
  data-visibility="1"
40
36
  align="center"
41
37
  valign="middle">
42
- <a target="_blank" href="${r.url}" class="${_}">
38
+ <a target="_blank" href="${t.url}" class="${d}">
43
39
  <img
44
- src="${w(r.image_url)}"
45
- alt="${r.name}"
46
- style="${l}"
40
+ src="${$(t.image_url)}"
41
+ alt="${t.name}"
42
+ style="display: block; max-width: 100%; height: auto;"
47
43
  class="adapt-img product-image">
48
44
  </a>
49
45
  </td>
50
- `;
51
- },
46
+ `,
52
47
  /**
53
48
  * Name element - row for info cell table
54
49
  */
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 `
50
+ [_]: (t) => `
66
51
  <tr>
67
52
  <td
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}
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>
72
59
  </td>
73
60
  </tr>
74
- `;
75
- },
61
+ `,
76
62
  /**
77
63
  * Price element - row for info cell table
78
64
  */
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 `
65
+ [x]: (t) => `
90
66
  <tr>
91
67
  <td
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}
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>
96
74
  </td>
97
75
  </tr>
98
- `;
99
- },
76
+ `,
100
77
  /**
101
78
  * Old price element - row for info cell table
102
79
  */
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 `
80
+ [T]: (t) => `
114
81
  <tr>
115
82
  <td
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}
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>
120
91
  </td>
121
92
  </tr>
122
- `;
123
- },
93
+ `,
124
94
  /**
125
95
  * Omnibus price element - row for info cell table
126
96
  */
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 `
97
+ [f]: (t) => `
130
98
  <tr>
131
99
  <td
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>
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>
141
109
  </p>
142
110
  </td>
143
111
  </tr>
144
- `;
145
- },
112
+ `,
146
113
  /**
147
114
  * Omnibus discount element - row for info cell table
148
115
  */
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);
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%";
152
119
  return `
153
120
  <tr>
154
121
  <td
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>
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>
164
131
  </p>
165
132
  </td>
166
133
  </tr>
@@ -170,54 +137,60 @@ const V = {
170
137
  * Button cell - right column (100px fixed width)
171
138
  * Has recommendation-attribute-row class and data attributes for Card Composition control
172
139
  */
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 `
140
+ [c]: (t) => `
176
141
  <td
177
142
  width="100"
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}"
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}"
181
146
  data-visibility="1"
182
- align="${(e == null ? void 0 : e.cellAlignment) ?? "center"}"
147
+ align="center"
183
148
  valign="middle">
184
- <span class="${v(l)}" style="${a}">
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
+ ">
185
156
  <a
186
- href="${r.url}"
157
+ href="${t.url}"
187
158
  target="_blank"
188
- class="es-button ${_}"
189
- style="${c}">
190
- ${s}
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
191
172
  </a>
192
173
  </span>
193
174
  </td>
194
- `;
195
- },
175
+ `,
196
176
  /**
197
177
  * Custom attribute row template — same tr-td structure as Name, Price, etc.
198
178
  * Used by `buildElementRenderer` for `customAttr:*` composition entries.
199
179
  * @param productAttrValue - Resolved product-attr value (e.g., "brand" for default, "product_attribute.rating_star" for custom)
200
180
  * @param content - Display content for the cell
201
181
  */
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 `
182
+ [O]: (t, e) => `
209
183
  <tr>
210
184
  <td
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}
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>
216
190
  </td>
217
191
  </tr>
218
- `;
219
- }
192
+ `
220
193
  };
221
194
  export {
222
- V as listElementRenderer
195
+ I as listElementRenderer
223
196
  };
@@ -1,23 +1,22 @@
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>/, "");
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>/, "");
7
6
  return `<tr
8
7
  class="recommendation-attribute-row"
9
- data-attribute-type="${r}"
10
- data-visibility="${e ? "1" : "0"}"${l}>${a}</tr>`;
8
+ data-attribute-type="${n}"
9
+ data-visibility="${l ? "1" : "0"}"${t}>${o}</tr>`;
11
10
  }
12
- const $ = `
11
+ const y = `
13
12
  <tr class="recommendation-product-row">
14
- <td style="padding: {-{-CARD_PADDING-}-};">
13
+ <td style="padding: 0 5px;">
15
14
  <table
16
15
  width="100%"
17
16
  cellpadding="0"
18
17
  cellspacing="0"
19
18
  border="0"
20
- class="product-card-wrapper"{-{-WRAPPER_STYLE-}-}>
19
+ class="product-card-wrapper">
21
20
  <tbody>
22
21
  <tr>
23
22
  {-{-PRODUCT_CONTENT-}-}
@@ -27,49 +26,29 @@ const $ = `
27
26
  </td>
28
27
  </tr>
29
28
  `;
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 = `
29
+ function O(r, n = b, l = {}) {
30
+ const t = C(f, n, l), o = t[a](r), c = `
41
31
  <td class="product-info-cell" valign="middle" style="padding: 15px;">
42
32
  <table cellpadding="0" cellspacing="0" role="presentation" width="100%" style="table-layout: fixed;">
43
33
  <tbody>
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);
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);
53
37
  }).join(`
54
38
  `)}
55
39
  </tbody>
56
40
  </table>
57
41
  </td>
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);
42
+ `, s = t[d](r), p = o + c + s;
43
+ return y.replace("{-{-PRODUCT_CONTENT-}-}", p);
64
44
  }
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;
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;
70
49
  }).join("");
71
50
  }
72
51
  export {
73
- x as getListProductCard,
74
- B as prepareProductRows
52
+ O as getListProductCard,
53
+ D as prepareProductRows
75
54
  };
@@ -1,101 +1,66 @@
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";
2
- function U(t) {
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);
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());
11
4
  }
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";
5
+ 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);
15
11
  }
16
- function E(t, n) {
17
- return C(t, n) ? t : `${l}${t}`;
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";
18
15
  }
19
- function M(t) {
20
- const n = t.startsWith(l) ? t.substring(l.length) : t;
21
- return `${c}${n}`;
16
+ function h(t, e) {
17
+ return C(t, e) ? t : `product_attribute.${t}`;
22
18
  }
23
19
  const P = Symbol("customCellHtml");
24
- function k(t, n, e = {}) {
25
- const o = t[P];
26
- if (!o)
20
+ function L(t, e, n = {}) {
21
+ const r = t[P];
22
+ if (!r)
27
23
  return { ...t };
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);
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);
35
31
  };
36
- }), s;
32
+ }), i;
37
33
  }
38
- const x = {
34
+ const M = {
39
35
  TITLE: "You May Also Like!"
40
- }, v = [
36
+ }, $ = [
37
+ u,
38
+ p,
39
+ m,
41
40
  b,
42
41
  T,
43
- g,
44
42
  _,
45
- f,
46
- p,
47
- m
48
- ], F = {
43
+ g
44
+ ], w = {
45
+ [u]: !0,
46
+ [p]: !0,
49
47
  [b]: !0,
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 `
48
+ [m]: !0,
49
+ [T]: !1,
50
+ [_]: !1,
51
+ [g]: !0
52
+ }, I = `
59
53
  <tr>
60
- <td class="spacer" style="height: ${t}px;"></td>
54
+ <td class="spacer" style="height: 10px;"></td>
61
55
  </tr>
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;
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;
94
59
  }
95
- function B(t) {
60
+ function E(t) {
96
61
  return {
97
62
  name: "Product Name",
98
- image_url: h,
63
+ image_url: f,
99
64
  price: { USD: 18 },
100
65
  original_price: { USD: 20 },
101
66
  discount: { USD: 2 },
@@ -107,19 +72,19 @@ function B(t) {
107
72
  category: []
108
73
  };
109
74
  }
110
- function J(t = 6) {
75
+ function k(t = 6) {
111
76
  return Array.from(
112
77
  { length: t },
113
- (n, e) => B(String(e + 1))
78
+ (e, n) => E(String(n + 1))
114
79
  );
115
80
  }
116
- function Q(t = "grid", n) {
117
- const e = t === "list" ? `
118
- data-layout="list"` : "", o = n ? ` ${n}` : "";
81
+ function x(t = "grid", e) {
82
+ const n = t === "list" ? `
83
+ data-layout="list"` : "", r = e ? ` ${e}` : "";
119
84
  return `
120
85
  <td
121
86
  align="left"
122
- class="${`recommendation-block-v2 esd-block-recommendation-v3-block es-p20${t === "list" ? " es-m-p0 ins-recommendation-list-layout" : ""}${o}`}"${e}>
87
+ class="${`recommendation-block-v2 esd-block-recommendation-v3-block es-p20${t === "list" ? " es-m-p0 ins-recommendation-list-layout" : ""}${r}`}"${n}>
123
88
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
124
89
  <tr>
125
90
  <td align="center">
@@ -151,7 +116,7 @@ function Q(t = "grid", n) {
151
116
  </table>
152
117
  </td>
153
118
  </tr>
154
- ${L}
119
+ ${I}
155
120
  <tr>
156
121
  <td>
157
122
  <table
@@ -191,30 +156,17 @@ function Q(t = "grid", n) {
191
156
  }
192
157
  export {
193
158
  P as CUSTOM_CELL_HTML,
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,
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,
207
166
  C as isDefaultAttribute,
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
167
+ h as resolveProductAttrValue,
168
+ N as sanitizeImageUrl,
169
+ I as spacer,
170
+ y as toDisplayName,
171
+ U as toDisplayableAttributeValue
220
172
  };