@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
@@ -2,13 +2,12 @@ import { ExtensionBuilder as r } from "../../../node_modules/@stripoinc/ui-edito
2
2
  import { RecommendationBlock as m } from "./block.js";
3
3
  import { RecommendationBlockControl as n } from "./controls/main/index.js";
4
4
  import "./store/recommendation.js";
5
- import "./utils/captureStyleTemplates.js";
6
5
  import { NameControls as i } from "./controls/name/index.js";
7
6
  import { PriceControls as e } from "./controls/price/index.js";
8
7
  import { OldPriceControls as s } from "./controls/oldPrice/index.js";
9
8
  import { OmnibusPriceControls as l } from "./controls/omnibusPrice/index.js";
10
- import { OmnibusDiscountControls as p } from "./controls/omnibusDiscount/index.js";
11
- import { ButtonControls as a } from "./controls/button/index.js";
9
+ import { OmnibusDiscountControls as a } from "./controls/omnibusDiscount/index.js";
10
+ import { ButtonControls as p } from "./controls/button/index.js";
12
11
  import { ImageControls as c } from "./controls/image/index.js";
13
12
  import { CustomAttributeControls as C } from "./controls/customAttribute/index.js";
14
13
  import { SpacingControl as f } from "./controls/spacing/index.js";
@@ -23,8 +22,8 @@ const b = [
23
22
  e,
24
23
  s,
25
24
  l,
26
- p,
27
25
  a,
26
+ p,
28
27
  c,
29
28
  C
30
29
  ], P = [
@@ -36,10 +35,10 @@ const b = [
36
35
  ], S = [
37
36
  ...P,
38
37
  ...b.flatMap((o) => Object.values(o))
39
- ], L = S.reduce(
38
+ ], K = S.reduce(
40
39
  (o, t) => o.addControl(t),
41
40
  new r().addBlock(m).withSettingsPanelRegistry(B)
42
41
  ).addStyles(y).withIconsRegistry(R).build();
43
42
  export {
44
- L as default
43
+ K as default
45
44
  };
@@ -4,7 +4,6 @@ import { RecommendationBlockId as S } from "./constants/blockIds.js";
4
4
  import { RecommendationControlId as T } from "./constants/controlIds.js";
5
5
  import { CONTROL_BLOCK_ID as A } from "./controls/main/index.js";
6
6
  import "./store/recommendation.js";
7
- import "./utils/captureStyleTemplates.js";
8
7
  import "./controls/name/index.js";
9
8
  import "./controls/price/index.js";
10
9
  import "./controls/oldPrice/index.js";
@@ -16,7 +15,7 @@ import { SPACING_CONTROL_ID as L } from "./controls/spacing/index.js";
16
15
  import { CARD_BACKGROUND_COLOR_CONTROL_ID as D } from "./controls/cardBackground/index.js";
17
16
  import { COMPOSITION_CONTROL_BLOCK_ID as B } from "./controls/cardComposition/index.js";
18
17
  import { SYNC_INFO_MESSAGE_CONTROL_ID as N } from "./controls/syncInfoMessage.js";
19
- class a extends E {
18
+ class Z extends E {
20
19
  registerBlockControls(I) {
21
20
  I[U] = [
22
21
  new _(
@@ -195,5 +194,5 @@ class a extends E {
195
194
  }
196
195
  }
197
196
  export {
198
- a as SettingsPanel
197
+ Z as SettingsPanel
199
198
  };
@@ -1,15 +1,11 @@
1
- import { RecommendationBlockId as c } from "../../constants/blockIds.js";
2
- import { ATTR_PRODUCT_ATTR as x, ATTR_PRODUCT_BUTTON as B, CSS_CLASS_RECO_BUTTON as C, ATTR_PRODUCT_OMNIBUS_DISCOUNT as k, ATTR_PRODUCT_OMNIBUS_PRICE as R, ATTR_PRODUCT_OLD_PRICE as h, ATTR_PRODUCT_PRICE as O, ATTR_PRODUCT_NAME as U, ATTR_PRODUCT_IMAGE as A } from "../../constants/selectors.js";
3
- import { useRecommendationExtensionStore as E } from "../../store/recommendation.js";
4
- import { formatPrice as v } from "../../utils/priceFormatter.js";
5
- import { CUSTOM_CELL_HTML as I, renderStyledParagraph as u, cellBgStyleAttr as s, DEFAULT_BUTTON_BORDER_STYLE as L, DEFAULT_BUTTON_ANCHOR_STYLE as i, renderButtonLabel as D, resolveButtonBorderClass as N, resolvePStyle as S, DEFAULT_IMG_STYLE as M, sanitizeImageUrl as z, resolveSegmentBgStyle as F } from "../utils.js";
6
- const d = "0 5px", g = "attribute-cell";
7
- function n(r, e = "") {
8
- const l = F(e, r);
9
- return `<table class="product-card-segment" width="100%" height="100%" cellpadding="0" cellspacing="0" border="0"${l ? ` style="${l}"` : ""}>`;
10
- }
11
- function P() {
12
- const r = E(), { currencySettings: e } = r.recommendationConfigs;
1
+ import { RecommendationBlockId as s } from "../../constants/blockIds.js";
2
+ import { ATTR_PRODUCT_ATTR as u, CSS_CLASS_RECO_BUTTON as p, ATTR_PRODUCT_BUTTON as m, ATTR_PRODUCT_OMNIBUS_DISCOUNT as h, ATTR_PRODUCT_OMNIBUS_PRICE as y, ATTR_PRODUCT_OLD_PRICE as T, ATTR_PRODUCT_PRICE as f, ATTR_PRODUCT_NAME as _, ATTR_PRODUCT_IMAGE as x } from "../../constants/selectors.js";
3
+ import { useRecommendationExtensionStore as $ } from "../../store/recommendation.js";
4
+ import { formatPrice as C } from "../../utils/priceFormatter.js";
5
+ import { CUSTOM_CELL_HTML as R, sanitizeImageUrl as O } from "../utils.js";
6
+ const a = "0 5px", l = "attribute-cell";
7
+ function g() {
8
+ const t = $(), { currencySettings: e } = t.recommendationConfigs;
13
9
  return {
14
10
  code: e.value,
15
11
  symbol: e.symbol,
@@ -19,31 +15,34 @@ function P() {
19
15
  thousandSeparator: e.thousandSeparator
20
16
  };
21
17
  }
22
- function y(r, e = "price") {
23
- const l = P(), a = r[e], t = (a == null ? void 0 : a[l.code]) ?? Object.values(a ?? {})[0] ?? 0;
24
- return v({
25
- price: t,
26
- currency: l
18
+ function i(t, e = "price") {
19
+ const o = g(), n = t[e], d = (n == null ? void 0 : n[o.code]) ?? Object.values(n ?? {})[0] ?? 0;
20
+ return C({
21
+ price: d,
22
+ currency: o
27
23
  });
28
24
  }
29
- const V = {
30
- [A]: (r, e) => {
31
- var t;
32
- const l = (e == null ? void 0 : e.cellPadding) ?? d, a = ((t = e == null ? void 0 : e.styleTemplate) == null ? void 0 : t.imgStyle) ?? M;
33
- return `
34
- <td class="${g}" style="padding: ${l}; height: 100%;" valign="top">
35
- ${n(e == null ? void 0 : e.cardBackgroundColor)}
25
+ const S = {
26
+ [x]: (t) => `
27
+ <td class="${l}" style="padding: ${a}; height: 100%;" valign="top">
28
+ <table
29
+ class="product-card-segment"
30
+ width="100%"
31
+ height="100%"
32
+ cellpadding="0"
33
+ cellspacing="0"
34
+ border="0">
36
35
  <tbody>
37
36
  <tr valign="top">
38
37
  <td
39
38
  class="esd-block-image product-image"
40
39
  align="center"
41
- esd-extension-block-id="${c.IMAGE}">
42
- <a target="_blank" href="${r.url}" class="${C}">
40
+ esd-extension-block-id="${s.IMAGE}">
41
+ <a target="_blank" href="${t.url}" class="${p}">
43
42
  <img
44
- src="${z(r.image_url)}"
45
- alt="${r.name}"
46
- style="${a}"
43
+ src="${O(t.image_url)}"
44
+ alt="${t.name}"
45
+ style="display: block; max-width: 100%; height: auto;"
47
46
  class="adapt-img">
48
47
  </a>
49
48
  </td>
@@ -51,82 +50,89 @@ const V = {
51
50
  </tbody>
52
51
  </table>
53
52
  </td>
54
- `;
55
- },
56
- [U]: (r, e) => {
57
- const l = (e == null ? void 0 : e.cellPadding) ?? d, a = u(
58
- r.name,
59
- { pStyle: "font-size: 16px; color: #333333;", openTags: "<strong>", closeTags: "</strong>" },
60
- e == null ? void 0 : e.styleTemplate
61
- );
62
- return `
63
- <td class="${g}" style="padding: ${l}; height: 100%;" valign="middle">
64
- ${n(e == null ? void 0 : e.cardBackgroundColor, "table-layout: fixed;")}
53
+ `,
54
+ [_]: (t) => `
55
+ <td class="${l}" style="padding: ${a}; height: 100%;" valign="middle">
56
+ <table
57
+ class="product-card-segment"
58
+ width="100%"
59
+ height="100%"
60
+ cellpadding="0"
61
+ cellspacing="0"
62
+ border="0"
63
+ style="table-layout: fixed;">
65
64
  <tbody>
66
65
  <tr valign="top">
67
66
  <td
68
67
  class="esd-block-text product-name es-p10t es-p10b es-p15l es-p15r"
69
68
  align="center"
70
- esd-extension-block-id="${c.NAME}"${s(e == null ? void 0 : e.cellBackgroundColor)}>
71
- ${a}
69
+ esd-extension-block-id="${s.NAME}">
70
+ <p contenteditable="false" style="font-size: 16px; color: #333333;">
71
+ <strong>${t.name}</strong>
72
+ </p>
72
73
  </td>
73
74
  </tr>
74
75
  </tbody>
75
76
  </table>
76
77
  </td>
77
- `;
78
- },
79
- [O]: (r, e) => {
80
- const l = (e == null ? void 0 : e.cellPadding) ?? d, a = u(
81
- y(r, "price"),
82
- { pStyle: "font-size: 16px; color: #333333;", openTags: "<strong>", closeTags: "</strong>" },
83
- e == null ? void 0 : e.styleTemplate
84
- );
85
- return `
86
- <td class="${g}" style="padding: ${l}; height: 100%;" valign="top">
87
- ${n(e == null ? void 0 : e.cardBackgroundColor)}
78
+ `,
79
+ [f]: (t) => `
80
+ <td class="${l}" style="padding: ${a}; height: 100%;" valign="top">
81
+ <table
82
+ class="product-card-segment"
83
+ width="100%"
84
+ height="100%"
85
+ cellpadding="0"
86
+ cellspacing="0"
87
+ border="0">
88
88
  <tbody>
89
89
  <tr valign="top">
90
90
  <td
91
91
  class="esd-block-text product-price es-p15l es-p15r"
92
92
  align="center"
93
- esd-extension-block-id="${c.PRICE}"${s(e == null ? void 0 : e.cellBackgroundColor)}>
94
- ${a}
93
+ esd-extension-block-id="${s.PRICE}">
94
+ <p contenteditable="false" style="font-size: 16px; color: #333333;">
95
+ <strong>${i(t, "price")}</strong>
96
+ </p>
95
97
  </td>
96
98
  </tr>
97
99
  </tbody>
98
100
  </table>
99
101
  </td>
100
- `;
101
- },
102
- [h]: (r, e) => {
103
- const l = (e == null ? void 0 : e.cellPadding) ?? d, a = u(
104
- y(r, "original_price"),
105
- { pStyle: "font-size: 14px; color: #999999;", openTags: "<strong>", closeTags: "</strong>" },
106
- e == null ? void 0 : e.styleTemplate
107
- );
108
- return `
109
- <td class="${g}" style="padding: ${l}; height: 100%;" valign="top">
110
- ${n(e == null ? void 0 : e.cardBackgroundColor)}
102
+ `,
103
+ [T]: (t) => `
104
+ <td class="${l}" style="padding: ${a}; height: 100%;" valign="top">
105
+ <table
106
+ class="product-card-segment"
107
+ width="100%"
108
+ height="100%"
109
+ cellpadding="0"
110
+ cellspacing="0"
111
+ border="0">
111
112
  <tbody>
112
113
  <tr valign="top">
113
114
  <td
114
115
  class="esd-block-text product-old-price es-p15l es-p15r"
115
116
  align="center"
116
- esd-extension-block-id="${c.OLD_PRICE}"${s(e == null ? void 0 : e.cellBackgroundColor)}>
117
- ${a}
117
+ esd-extension-block-id="${s.OLD_PRICE}">
118
+ <p contenteditable="false" style="font-size: 14px; color: #999999;">
119
+ <strong>${i(t, "original_price")}</strong>
120
+ </p>
118
121
  </td>
119
122
  </tr>
120
123
  </tbody>
121
124
  </table>
122
125
  </td>
123
- `;
124
- },
125
- [R]: (r, e) => {
126
- const l = (e == null ? void 0 : e.cellPadding) ?? d, a = S("font-size: 12px; color: #666666;", e == null ? void 0 : e.styleTemplate);
127
- return `
128
- <td class="${g}" style="padding: ${l}; height: 100%;" valign="top">
129
- ${n(e == null ? void 0 : e.cardBackgroundColor)}
126
+ `,
127
+ [y]: (t) => `
128
+ <td class="${l}" style="padding: ${a}; height: 100%;" valign="top">
129
+ <table
130
+ class="product-card-segment"
131
+ width="100%"
132
+ height="100%"
133
+ cellpadding="0"
134
+ cellspacing="0"
135
+ border="0">
130
136
  <tbody>
131
137
  <tr valign="top">
132
138
  <td
@@ -134,10 +140,10 @@ const V = {
134
140
  align="center"
135
141
  data-text-before="Lowest 30-day price: "
136
142
  data-text-after=""
137
- esd-extension-block-id="${c.OMNIBUS_PRICE}"${s(e == null ? void 0 : e.cellBackgroundColor)}>
138
- <p contenteditable="false" style="${a}">
143
+ esd-extension-block-id="${s.OMNIBUS_PRICE}">
144
+ <p contenteditable="false" style="font-size: 12px; color: #666666;">
139
145
  <span class="omnibus-text-before">Lowest 30-day price: </span>
140
- <span class="omnibus-price-value">${y(r, "original_price")}</span>
146
+ <span class="omnibus-price-value">${i(t, "original_price")}</span>
141
147
  <span class="omnibus-text-after"></span>
142
148
  </p>
143
149
  </td>
@@ -145,14 +151,19 @@ const V = {
145
151
  </tbody>
146
152
  </table>
147
153
  </td>
148
- `;
149
- },
150
- [k]: (r, e) => {
151
- var m, _;
152
- const l = (e == null ? void 0 : e.cellPadding) ?? d, a = S("font-size: 12px; color: #666666;", e == null ? void 0 : e.styleTemplate), t = P(), b = ((m = r.original_price) == null ? void 0 : m[t.code]) ?? Object.values(r.original_price ?? {})[0] ?? 0, T = ((_ = r.price) == null ? void 0 : _[t.code]) ?? Object.values(r.price ?? {})[0] ?? 0, $ = b > 0 ? Math.round((b - T) / b * 100) : 0, f = $ > 0 ? `-${$}%` : "0%";
154
+ `,
155
+ [h]: (t) => {
156
+ var r, c;
157
+ const e = g(), o = ((r = t.original_price) == null ? void 0 : r[e.code]) ?? Object.values(t.original_price ?? {})[0] ?? 0, n = ((c = t.price) == null ? void 0 : c[e.code]) ?? Object.values(t.price ?? {})[0] ?? 0, d = o > 0 ? Math.round((o - n) / o * 100) : 0, b = d > 0 ? `-${d}%` : "0%";
153
158
  return `
154
- <td class="${g}" style="padding: ${l}; height: 100%;" valign="top">
155
- ${n(e == null ? void 0 : e.cardBackgroundColor)}
159
+ <td class="${l}" style="padding: ${a}; height: 100%;" valign="top">
160
+ <table
161
+ class="product-card-segment"
162
+ width="100%"
163
+ height="100%"
164
+ cellpadding="0"
165
+ cellspacing="0"
166
+ border="0">
156
167
  <tbody>
157
168
  <tr valign="top">
158
169
  <td
@@ -160,10 +171,10 @@ const V = {
160
171
  align="center"
161
172
  data-text-before=""
162
173
  data-text-after=""
163
- esd-extension-block-id="${c.OMNIBUS_DISCOUNT}"${s(e == null ? void 0 : e.cellBackgroundColor)}>
164
- <p contenteditable="false" style="${a}">
174
+ esd-extension-block-id="${s.OMNIBUS_DISCOUNT}">
175
+ <p contenteditable="false" style="font-size: 12px; color: #666666;">
165
176
  <span class="omnibus-text-before"></span>
166
- <span class="omnibus-discount-value">${f}</span>
177
+ <span class="omnibus-discount-value">${b}</span>
167
178
  <span class="omnibus-text-after"></span>
168
179
  </p>
169
180
  </td>
@@ -173,24 +184,43 @@ const V = {
173
184
  </td>
174
185
  `;
175
186
  },
176
- [B]: (r, e) => {
177
- const l = (e == null ? void 0 : e.cellPadding) ?? d, a = e == null ? void 0 : e.styleTemplate, t = (a == null ? void 0 : a.buttonBorderStyle) ?? L, b = (a == null ? void 0 : a.buttonAnchorStyle) ?? i, T = D("Buy", a);
178
- return `
179
- <td class="${g}" style="padding: ${l}; height: 100%;" valign="top">
180
- ${n(e == null ? void 0 : e.cardBackgroundColor)}
187
+ [m]: () => `
188
+ <td class="${l}" style="padding: ${a}; height: 100%;" valign="top">
189
+ <table
190
+ class="product-card-segment"
191
+ width="100%"
192
+ height="100%"
193
+ cellpadding="0"
194
+ cellspacing="0"
195
+ border="0">
181
196
  <tbody>
182
197
  <tr valign="top">
183
198
  <td
184
199
  class="esd-block-button product-button es-p10t es-p10b"
185
200
  align="center"
186
- esd-extension-block-id="${c.BUTTON}">
187
- <span class="${N(a)}" style="${t}">
201
+ esd-extension-block-id="${s.BUTTON}">
202
+ <span
203
+ class="es-button-border"
204
+ style="
205
+ border-width: 1px;
206
+ background: rgb(217, 234, 211);
207
+ border-color: rgb(106, 168, 79);
208
+ ">
188
209
  <a
189
210
  href="#"
190
- class="es-button ${C}"
211
+ class="es-button ${p}"
191
212
  target="_blank"
192
- style="${b}">
193
- ${T}
213
+ style="
214
+ color: rgb(56, 118, 29);
215
+ background: rgb(217, 234, 211);
216
+ font-family: arial, 'helvetica neue', helvetica, sans-serif;
217
+ font-size: 16px;
218
+ font-weight: normal;
219
+ line-height: 120%;
220
+ mso-border-alt: 10px solid rgb(217, 234, 211);
221
+ mso-padding-alt: 0;
222
+ ">
223
+ Buy
194
224
  </a>
195
225
  </span>
196
226
  </td>
@@ -198,8 +228,7 @@ const V = {
198
228
  </tbody>
199
229
  </table>
200
230
  </td>
201
- `;
202
- },
231
+ `,
203
232
  /**
204
233
  * Custom attribute cell template — same structure as built-in entries
205
234
  * (outer td → inner product-card-segment table).
@@ -207,33 +236,33 @@ const V = {
207
236
  * @param productAttrValue - Resolved product-attr value (e.g., "brand" for default, "product_attribute.rating_star" for custom)
208
237
  * @param content - Display content for the cell
209
238
  */
210
- [I]: (r, e, l) => {
211
- const a = (l == null ? void 0 : l.cellPadding) ?? d, t = u(
212
- e,
213
- { pStyle: "font-size: 12px; color: #666666;", openTags: "", closeTags: "" },
214
- l == null ? void 0 : l.styleTemplate
215
- );
216
- return `
217
- <td class="${g}" style="padding: ${a}; height: 100%;" valign="middle">
218
- ${n(l == null ? void 0 : l.cardBackgroundColor, "table-layout: fixed;")}
239
+ [R]: (t, e) => `
240
+ <td class="${l}" style="padding: ${a}; height: 100%;" valign="middle">
241
+ <table
242
+ class="product-card-segment"
243
+ width="100%"
244
+ height="100%"
245
+ cellpadding="0"
246
+ cellspacing="0"
247
+ border="0"
248
+ style="table-layout: fixed;">
219
249
  <tbody>
220
250
  <tr valign="top">
221
251
  <td
222
- ${x}="${r}"
252
+ ${u}="${t}"
223
253
  class="esd-block-text product-custom-attribute es-p0t es-p0b es-p15l es-p15r"
224
254
  align="center"
225
- esd-extension-block-id="${c.CUSTOM_ATTRIBUTE}"${s(l == null ? void 0 : l.cellBackgroundColor)}>
226
- ${t}
255
+ esd-extension-block-id="${s.CUSTOM_ATTRIBUTE}">
256
+ <p contenteditable="false" style="font-size: 12px; color: #666666;">${e}</p>
227
257
  </td>
228
258
  </tr>
229
259
  </tbody>
230
260
  </table>
231
261
  </td>
232
- `;
233
- }
262
+ `
234
263
  };
235
264
  export {
236
- g as ATTRIBUTE_CELL_CLASS,
237
- d as DEFAULT_CELL_PADDING,
238
- V as gridElementRenderer
265
+ l as ATTRIBUTE_CELL_CLASS,
266
+ a as DEFAULT_CELL_PADDING,
267
+ S as gridElementRenderer
239
268
  };
@@ -1,7 +1,7 @@
1
- import { DEFAULT_PRODUCTS_PER_ROW as b } from "../../constants/layout.js";
2
- import { getDefaultProducts as w, DEFAULTS as A, createBlockTemplate as f, buildSpacer as C, DEFAULT_CARD_COMPOSITION as D, buildElementRenderer as g, DEFAULT_CARD_VISIBILITY as P } from "../utils.js";
3
- import { DEFAULT_CELL_PADDING as O, ATTRIBUTE_CELL_CLASS as U, gridElementRenderer as h } from "./elementRenderer.js";
4
- const B = `
1
+ import { DEFAULT_PRODUCTS_PER_ROW as L } from "../../constants/layout.js";
2
+ import { getDefaultProducts as E, DEFAULTS as I, createBlockTemplate as _, DEFAULT_CARD_COMPOSITION as S, spacer as b, buildElementRenderer as A, DEFAULT_CARD_VISIBILITY as f } from "../utils.js";
3
+ import { ATTRIBUTE_CELL_CLASS as w, DEFAULT_CELL_PADDING as D, gridElementRenderer as C } from "./elementRenderer.js";
4
+ const O = `
5
5
  <tr class="recommendation-product-row">
6
6
  <td>
7
7
  <table
@@ -18,7 +18,7 @@ const B = `
18
18
  </table>
19
19
  </td>
20
20
  </tr>
21
- `, Y = `
21
+ `, g = `
22
22
  <tr
23
23
  class="recommendation-attribute-row"
24
24
  data-attribute-type="{-{-ATTR_TYPE-}-}"
@@ -27,57 +27,38 @@ const B = `
27
27
  {-{-CELLS-}-}
28
28
  </tr>
29
29
  `;
30
- function y(t, e, o, l = D, c = {}, s = {}) {
31
- const {
32
- cellPadding: a = O,
33
- styleTemplates: i,
34
- cardBackgroundColor: T,
35
- cellBackgroundColors: r
36
- } = s, d = (100 / e).toFixed(2), p = e - t.length, u = `<td class="${U}" style="padding: ${a};" width="${d}%"></td>`, L = p > 0 ? u.repeat(p) : "", R = g(o, l, c);
37
- return l.filter((n) => R[n]).map((n) => {
38
- const m = P[n] ?? !0, E = m ? "" : 'style="display: none;"', I = {
39
- cellPadding: a,
40
- cardBackgroundColor: T,
41
- cellBackgroundColor: r == null ? void 0 : r[n],
42
- styleTemplate: i == null ? void 0 : i[n]
43
- }, S = t.map((_) => R[n](_, I).replace("<td", `<td width="${d}%"`)).join("");
44
- return Y.replace("{-{-ATTR_TYPE-}-}", n).replace("{-{-VISIBILITY-}-}", m ? "1" : "0").replace("{-{-DISPLAY_STYLE-}-}", E).replace("{-{-CELLS-}-}", S + L);
30
+ function P(t, e, o, r = S, n = {}) {
31
+ const c = (100 / e).toFixed(2), i = e - t.length, l = `<td class="${w}" style="padding: ${D};" width="${c}%"></td>`, d = i > 0 ? l.repeat(i) : "", a = A(o, r, n);
32
+ return r.filter((s) => a[s]).map((s) => {
33
+ const T = f[s] ?? !0, u = T ? "" : 'style="display: none;"', R = t.map((m) => a[s](m).replace("<td", `<td width="${c}%"`)).join("");
34
+ return g.replace("{-{-ATTR_TYPE-}-}", s).replace("{-{-VISIBILITY-}-}", T ? "1" : "0").replace("{-{-DISPLAY_STYLE-}-}", u).replace("{-{-CELLS-}-}", R + d);
45
35
  }).join("");
46
36
  }
47
- function W(t, e, o, l, c = {}, s = {}) {
48
- const a = [];
49
- for (let r = 0; r < t.length; r += e)
50
- a.push(t.slice(r, r + e));
51
- const i = C(s.rowSpacingPx);
52
- return a.map((r, d) => {
53
- const p = y(
54
- r,
37
+ function U(t, e, o, r, n = {}) {
38
+ const c = [];
39
+ for (let l = 0; l < t.length; l += e)
40
+ c.push(t.slice(l, l + e));
41
+ return c.map((l, d) => {
42
+ const a = P(
43
+ l,
55
44
  e,
56
45
  o,
57
- l,
58
- c,
59
- s
60
- ), u = B.replace("{-{-ATTRIBUTE_ROWS-}-}", p);
61
- return d > 0 ? i + u : u;
46
+ r,
47
+ n
48
+ ), p = O.replace("{-{-ATTRIBUTE_ROWS-}-}", a);
49
+ return d > 0 ? b + p : p;
62
50
  }).join("");
63
51
  }
64
- function F(t, e, o, l = {}, c = {}) {
65
- return W(
66
- t,
67
- e,
68
- h,
69
- o,
70
- l,
71
- c
72
- );
52
+ function h(t, e, o, r = {}) {
53
+ return U(t, e, C, o, r);
73
54
  }
74
- function j(t) {
75
- const e = t ? `ins-recommendation-v3-block-${t}` : void 0, o = f("grid", e), l = w(), c = F(l, b);
76
- return o.replace("{-{-TITLE-}-}", A.TITLE).replace("{-{-PRODUCT_ROWS-}-}", c).replace("{-{-MOBILE_PRODUCT_ROWS-}-}", "");
55
+ function F(t) {
56
+ const e = t ? `ins-recommendation-v3-block-${t}` : void 0, o = _("grid", e), r = E(), n = h(r, L);
57
+ return o.replace("{-{-TITLE-}-}", I.TITLE).replace("{-{-PRODUCT_ROWS-}-}", n).replace("{-{-MOBILE_PRODUCT_ROWS-}-}", "");
77
58
  }
78
59
  export {
79
- j as getDefaultTemplate,
80
- y as prepareGridAttributeRows,
81
- W as prepareGridProductRows,
82
- F as prepareProductRows
60
+ F as getDefaultTemplate,
61
+ P as prepareGridAttributeRows,
62
+ U as prepareGridProductRows,
63
+ h as prepareProductRows
83
64
  };
@@ -1,13 +1,12 @@
1
- import { DEFAULT_PRODUCTS_PER_ROW as u } from "../constants/layout.js";
2
- import { prepareProductRows as P } from "./grid/template.js";
3
- import { prepareProductRows as m } from "./list/template.js";
4
- function g(o, t, r = {}) {
5
- const { cellPadding: c, rowSpacingPx: p, styleTemplates: s, cardBackgroundColor: i, cellBackgroundColors: a } = r, e = { cellPadding: c, rowSpacingPx: p, styleTemplates: s, cardBackgroundColor: i, cellBackgroundColors: a };
1
+ import { DEFAULT_PRODUCTS_PER_ROW as s } from "../constants/layout.js";
2
+ import { prepareProductRows as c } from "./grid/template.js";
3
+ import { prepareProductRows as R } from "./list/template.js";
4
+ function a(o, t, r = {}) {
6
5
  if (t === "list")
7
- return m(o, r.composition, r.filterList, e);
8
- const { productsPerRow: n = u, composition: d, filterList: l } = r;
9
- return P(o, n, d, l, e);
6
+ return R(o, r.composition, r.filterList);
7
+ const { productsPerRow: e = s, composition: p, filterList: i } = r;
8
+ return c(o, e, p, i);
10
9
  }
11
10
  export {
12
- g as prepareProductRows
11
+ a as prepareProductRows
13
12
  };