@useinsider/guido 3.6.0-beta.596b70e → 3.6.0-beta.5cbaa8f

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