@useinsider/guido 3.7.2-beta.13c9a35 → 3.7.2-beta.1489585

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (60) hide show
  1. package/dist/@types/config/schemas.js +66 -70
  2. package/dist/composables/usePreviewMode.js +14 -15
  3. package/dist/config/compiler/utils/recommendationCompilerUtils.js +78 -92
  4. package/dist/config/migrator/recommendation/htmlBuilder.js +58 -59
  5. package/dist/config/migrator/recommendation/settingsMapper.js +33 -38
  6. package/dist/extensions/Blocks/Recommendation/block.js +41 -60
  7. package/dist/extensions/Blocks/Recommendation/constants/defaultConfig.js +32 -41
  8. package/dist/extensions/Blocks/Recommendation/constants/selectors.js +11 -10
  9. package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +288 -369
  10. package/dist/extensions/Blocks/Recommendation/controls/main/index.js +82 -96
  11. package/dist/extensions/Blocks/Recommendation/controls/main/layoutOrientation.js +30 -39
  12. package/dist/extensions/Blocks/Recommendation/controls/main/productLayout.js +28 -34
  13. package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +288 -338
  14. package/dist/extensions/Blocks/Recommendation/extension.js +6 -5
  15. package/dist/extensions/Blocks/Recommendation/iconsRegistry.js +7 -21
  16. package/dist/extensions/Blocks/Recommendation/recommendation.css.js +4 -64
  17. package/dist/extensions/Blocks/Recommendation/settingsPanel.js +3 -2
  18. package/dist/extensions/Blocks/Recommendation/store/recommendation.js +5 -7
  19. package/dist/extensions/Blocks/Recommendation/templates/grid/elementRenderer.js +155 -215
  20. package/dist/extensions/Blocks/Recommendation/templates/grid/template.js +56 -31
  21. package/dist/extensions/Blocks/Recommendation/templates/index.js +29 -10
  22. package/dist/extensions/Blocks/Recommendation/templates/list/elementRenderer.js +145 -133
  23. package/dist/extensions/Blocks/Recommendation/templates/list/template.js +43 -22
  24. package/dist/extensions/Blocks/Recommendation/templates/utils.js +109 -92
  25. package/dist/extensions/Blocks/Recommendation/utils/captureStyleTemplates.js +216 -0
  26. package/dist/extensions/Blocks/Recommendation/utils/preserveTextStyles.js +24 -19
  27. package/dist/extensions/Blocks/Recommendation/utils/tagName.js +30 -22
  28. package/dist/extensions/Blocks/controlFactories.js +159 -133
  29. package/dist/src/@types/config/schemas.d.ts +0 -16
  30. package/dist/src/composables/useConfig.d.ts +0 -4
  31. package/dist/src/config/migrator/recommendation/settingsMapper.d.ts +1 -1
  32. package/dist/src/extensions/Blocks/Items/controls/index.d.ts +1 -1
  33. package/dist/src/extensions/Blocks/Recommendation/block.d.ts +0 -10
  34. package/dist/src/extensions/Blocks/Recommendation/constants/index.d.ts +1 -1
  35. package/dist/src/extensions/Blocks/Recommendation/constants/selectors.d.ts +2 -0
  36. package/dist/src/extensions/Blocks/Recommendation/controls/button/index.d.ts +1 -1
  37. package/dist/src/extensions/Blocks/Recommendation/controls/cardComposition/index.d.ts +3 -29
  38. package/dist/src/extensions/Blocks/Recommendation/controls/index.d.ts +1 -1
  39. package/dist/src/extensions/Blocks/Recommendation/controls/main/index.d.ts +1 -3
  40. package/dist/src/extensions/Blocks/Recommendation/controls/main/layoutOrientation.d.ts +2 -1
  41. package/dist/src/extensions/Blocks/Recommendation/controls/main/utils.d.ts +20 -47
  42. package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +0 -2
  43. package/dist/src/extensions/Blocks/Recommendation/templates/grid/elementRenderer.d.ts +0 -16
  44. package/dist/src/extensions/Blocks/Recommendation/templates/grid/template.d.ts +4 -4
  45. package/dist/src/extensions/Blocks/Recommendation/templates/index.d.ts +1 -1
  46. package/dist/src/extensions/Blocks/Recommendation/templates/list/elementRenderer.d.ts +0 -13
  47. package/dist/src/extensions/Blocks/Recommendation/templates/list/template.d.ts +3 -3
  48. package/dist/src/extensions/Blocks/Recommendation/templates/utils.d.ts +163 -41
  49. package/dist/src/extensions/Blocks/Recommendation/types/nodeConfig.d.ts +0 -15
  50. package/dist/src/extensions/Blocks/Recommendation/utils/captureStyleTemplates.d.ts +78 -0
  51. package/dist/src/extensions/Blocks/Recommendation/utils/preserveTextStyles.d.ts +15 -0
  52. package/dist/src/extensions/Blocks/Recommendation/utils/tagName.d.ts +29 -9
  53. package/dist/src/extensions/Blocks/controlFactories.d.ts +11 -1
  54. package/dist/src/stores/config.d.ts +0 -36
  55. package/package.json +1 -1
  56. package/dist/composables/useRecommendationPreview.js +0 -100
  57. package/dist/extensions/Blocks/Recommendation/controls/main/pricePlacement.js +0 -133
  58. package/dist/src/composables/useRecommendationPreview.d.ts +0 -10
  59. package/dist/src/extensions/Blocks/Recommendation/controls/main/pricePlacement.d.ts +0 -59
  60. package/dist/src/extensions/Blocks/Recommendation/utils/stylePreserver.d.ts +0 -113
@@ -1,213 +1,173 @@
1
- import { RecommendationBlockId as l } from "../../constants/blockIds.js";
2
- import { ATTR_PRODUCT_ATTR as b, CSS_CLASS_RECO_BUTTON as g, ATTR_PRODUCT_BUTTON as u, ATTR_PRODUCT_OMNIBUS_DISCOUNT as h, ATTR_PRODUCT_OMNIBUS_PRICE as y, ATTR_PRODUCT_OLD_PRICE as $, ATTR_PRODUCT_PRICE as m, ATTR_PRODUCT_NAME as T, ATTR_PRODUCT_IMAGE as x } from "../../constants/selectors.js";
3
- import { formatProductPrice as i, CUSTOM_CELL_HTML as f, getCurrentCurrencyConfig as _, sanitizeImageUrl as C } from "../utils.js";
4
- const s = "0 5px", d = "attribute-cell";
5
- function O(t, e = s) {
6
- return `<td class="${d}" style="padding: ${e};" width="${t}%"></td>`;
1
+ import { RecommendationBlockId as b } from "../../constants/blockIds.js";
2
+ import { ATTR_PRODUCT_ATTR as k, ATTR_PRODUCT_BUTTON as h, CSS_CLASS_RECO_BUTTON as f, ATTR_PRODUCT_OMNIBUS_DISCOUNT as R, ATTR_PRODUCT_OMNIBUS_PRICE as O, ATTR_PRODUCT_OLD_PRICE as U, ATTR_PRODUCT_PRICE as v, ATTR_PRODUCT_NAME as E, ATTR_PRODUCT_IMAGE as I } from "../../constants/selectors.js";
3
+ import { useRecommendationExtensionStore as L } from "../../store/recommendation.js";
4
+ import { formatPrice as D } from "../../utils/priceFormatter.js";
5
+ import { CUSTOM_CELL_HTML as N, renderStyledParagraph as T, cellBgStyleAttr as $, DEFAULT_BUTTON_BORDER_STYLE as M, DEFAULT_BUTTON_ANCHOR_STYLE as z, renderButtonLabel as F, resolveButtonBorderClass as G, resolvePStyle as P, resolveOmnibusText as x, DEFAULT_IMG_STYLE as j, sanitizeImageUrl as w, resolveSegmentBgStyle as Y } from "../utils.js";
6
+ const d = "0 5px", t = "attribute-cell";
7
+ function Q(r, e = d) {
8
+ return `<td class="${t}" style="padding: ${e};" width="${r}%"></td>`;
7
9
  }
8
- function U(t, e = !0) {
9
- const a = `<s><strong>${i(t, "original_price")}</strong></s>`, r = (n) => `<td
10
- class="esd-block-text product-price ${n}"
11
- align="center"
12
- valign="middle"
13
- esd-extension-block-id="${l.PRICE}">
14
- <p contenteditable="false" style="font-size: 16px; color: #333333;">
15
- <strong>${i(t, "price")}</strong>
16
- </p>
17
- </td>`, o = (n) => `<td
18
- class="esd-block-text product-old-price ${n}"
19
- align="center"
20
- valign="middle"
21
- esd-extension-block-id="${l.OLD_PRICE}">
22
- <p contenteditable="false" style="font-size: 14px; color: #999999;">
23
- ${a}
24
- </p>
25
- </td>`, p = e ? o("es-p15l es-p5r") : r("es-p15l es-p5r"), c = e ? r("es-p5l es-p15r") : o("es-p5l es-p15r");
26
- return `
27
- <td class="${d}" style="padding: ${s}; 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">
35
- <tbody>
36
- <tr valign="top">
37
- <td align="center">
38
- <table cellpadding="0" cellspacing="0" border="0" align="center" style="margin: 0 auto;">
39
- <tbody>
40
- <tr valign="middle">
41
- ${p}
42
- ${c}
43
- </tr>
44
- </tbody>
45
- </table>
46
- </td>
47
- </tr>
48
- </tbody>
49
- </table>
50
- </td>
51
- `;
10
+ function u(r, e = "") {
11
+ const l = Y(e, r);
12
+ return `<table class="product-card-segment" width="100%" height="100%" cellpadding="0" cellspacing="0" border="0"${l ? ` style="${l}"` : ""}>`;
13
+ }
14
+ function A() {
15
+ const r = L(), { currencySettings: e } = r.recommendationConfigs;
16
+ return {
17
+ code: e.value,
18
+ symbol: e.symbol,
19
+ alignment: e.alignment === "0" ? "before" : "after",
20
+ decimalCount: parseInt(e.decimalCount) || 2,
21
+ decimalSeparator: e.decimalSeparator,
22
+ thousandSeparator: e.thousandSeparator
23
+ };
52
24
  }
53
- function R(t) {
54
- const e = `<s><strong>${i(t, "original_price")}</strong></s>`;
55
- return `
56
- <td class="${d}" style="padding: ${s}; height: 100%;" valign="top">
57
- <table
58
- class="product-card-segment"
59
- width="100%"
60
- height="100%"
61
- cellpadding="0"
62
- cellspacing="0"
63
- border="0">
25
+ function m(r, e = "price") {
26
+ const l = A(), a = r[e], c = (a == null ? void 0 : a[l.code]) ?? Object.values(a ?? {})[0] ?? 0;
27
+ return D({
28
+ price: c,
29
+ currency: l
30
+ });
31
+ }
32
+ const W = {
33
+ [I]: (r, e) => {
34
+ var c;
35
+ const l = (e == null ? void 0 : e.cellPadding) ?? d, a = ((c = e == null ? void 0 : e.styleTemplate) == null ? void 0 : c.imgStyle) ?? j;
36
+ return `
37
+ <td class="${t}" style="padding: ${l}; height: 100%;" valign="top">
38
+ ${u(e == null ? void 0 : e.cardBackgroundColor)}
64
39
  <tbody>
65
40
  <tr valign="top">
66
41
  <td
67
- class="esd-block-text product-old-price es-p15l es-p15r"
42
+ class="esd-block-image product-image"
68
43
  align="center"
69
- esd-extension-block-id="${l.OLD_PRICE}">
70
- <p contenteditable="false" style="font-size: 14px; color: #999999;">
71
- ${e}
72
- </p>
44
+ esd-extension-block-id="${b.IMAGE}">
45
+ <a target="_blank" href="${r.url}" class="${f}">
46
+ <img
47
+ src="${w(r.image_url)}"
48
+ alt="${r.name}"
49
+ style="${a}"
50
+ class="adapt-img">
51
+ </a>
73
52
  </td>
74
53
  </tr>
75
54
  </tbody>
76
55
  </table>
77
56
  </td>
78
57
  `;
79
- }
80
- const I = {
81
- [x]: (t) => `
82
- <td class="${d}" style="padding: ${s}; height: 100%;" valign="top">
83
- <table
84
- class="product-card-segment"
85
- width="100%"
86
- height="100%"
87
- cellpadding="0"
88
- cellspacing="0"
89
- border="0">
58
+ },
59
+ [E]: (r, e) => {
60
+ const l = (e == null ? void 0 : e.cellPadding) ?? d, a = T(
61
+ r.name,
62
+ { pStyle: "font-size: 16px; color: #333333;", openTags: "<strong>", closeTags: "</strong>" },
63
+ e == null ? void 0 : e.styleTemplate
64
+ );
65
+ return `
66
+ <td class="${t}" style="padding: ${l}; height: 100%;" valign="middle">
67
+ ${u(e == null ? void 0 : e.cardBackgroundColor, "table-layout: fixed;")}
90
68
  <tbody>
91
69
  <tr valign="top">
92
70
  <td
93
- class="esd-block-image product-image"
94
- align="center"
95
- esd-extension-block-id="${l.IMAGE}">
96
- <a target="_blank" href="${t.url}" class="${g}">
97
- <img
98
- src="${C(t.image_url)}"
99
- alt="${t.name}"
100
- style="display: block; max-width: 100%; height: auto;"
101
- class="adapt-img">
102
- </a>
71
+ class="esd-block-text product-name ${(e == null ? void 0 : e.cellClasses) ?? "es-p10t es-p10b es-p15l es-p15r"}"
72
+ align="${(e == null ? void 0 : e.cellAlignment) ?? "center"}"
73
+ esd-extension-block-id="${b.NAME}"${$(e == null ? void 0 : e.cellBackgroundColor)}>
74
+ ${a}
103
75
  </td>
104
76
  </tr>
105
77
  </tbody>
106
78
  </table>
107
79
  </td>
108
- `,
109
- [T]: (t) => `
110
- <td class="${d}" style="padding: ${s}; height: 100%;" valign="middle">
111
- <table
112
- class="product-card-segment"
113
- width="100%"
114
- height="100%"
115
- cellpadding="0"
116
- cellspacing="0"
117
- border="0"
118
- style="table-layout: fixed;">
80
+ `;
81
+ },
82
+ [v]: (r, e) => {
83
+ const l = (e == null ? void 0 : e.cellPadding) ?? d, a = T(
84
+ m(r, "price"),
85
+ { pStyle: "font-size: 16px; color: #333333;", openTags: "<strong>", closeTags: "</strong>" },
86
+ e == null ? void 0 : e.styleTemplate
87
+ );
88
+ return `
89
+ <td class="${t}" style="padding: ${l}; height: 100%;" valign="top">
90
+ ${u(e == null ? void 0 : e.cardBackgroundColor)}
119
91
  <tbody>
120
92
  <tr valign="top">
121
93
  <td
122
- class="esd-block-text product-name es-p10t es-p10b es-p15l es-p15r"
123
- align="center"
124
- esd-extension-block-id="${l.NAME}">
125
- <p contenteditable="false" style="font-size: 16px; color: #333333;">
126
- <strong>${t.name}</strong>
127
- </p>
94
+ class="esd-block-text product-price ${(e == null ? void 0 : e.cellClasses) ?? "es-p15l es-p15r"}"
95
+ align="${(e == null ? void 0 : e.cellAlignment) ?? "center"}"
96
+ esd-extension-block-id="${b.PRICE}"${$(e == null ? void 0 : e.cellBackgroundColor)}>
97
+ ${a}
128
98
  </td>
129
99
  </tr>
130
100
  </tbody>
131
101
  </table>
132
102
  </td>
133
- `,
134
- [m]: (t) => `
135
- <td class="${d}" style="padding: ${s}; height: 100%;" valign="top">
136
- <table
137
- class="product-card-segment"
138
- width="100%"
139
- height="100%"
140
- cellpadding="0"
141
- cellspacing="0"
142
- border="0">
103
+ `;
104
+ },
105
+ [U]: (r, e) => {
106
+ const l = (e == null ? void 0 : e.cellPadding) ?? d, a = T(
107
+ m(r, "original_price"),
108
+ { pStyle: "font-size: 14px; color: #999999;", openTags: "<s><strong>", closeTags: "</strong></s>" },
109
+ e == null ? void 0 : e.styleTemplate
110
+ );
111
+ return `
112
+ <td class="${t}" style="padding: ${l}; height: 100%;" valign="top">
113
+ ${u(e == null ? void 0 : e.cardBackgroundColor)}
143
114
  <tbody>
144
115
  <tr valign="top">
145
116
  <td
146
- class="esd-block-text product-price es-p15l es-p15r"
147
- align="center"
148
- esd-extension-block-id="${l.PRICE}">
149
- <p contenteditable="false" style="font-size: 16px; color: #333333;">
150
- <strong>${i(t, "price")}</strong>
151
- </p>
117
+ class="esd-block-text product-old-price ${(e == null ? void 0 : e.cellClasses) ?? "es-p15l es-p15r"}"
118
+ align="${(e == null ? void 0 : e.cellAlignment) ?? "center"}"
119
+ esd-extension-block-id="${b.OLD_PRICE}"${$(e == null ? void 0 : e.cellBackgroundColor)}>
120
+ ${a}
152
121
  </td>
153
122
  </tr>
154
123
  </tbody>
155
124
  </table>
156
125
  </td>
157
- `,
158
- [$]: (t) => R(t),
159
- [y]: (t) => `
160
- <td class="${d}" style="padding: ${s}; height: 100%;" valign="top">
161
- <table
162
- class="product-card-segment"
163
- width="100%"
164
- height="100%"
165
- cellpadding="0"
166
- cellspacing="0"
167
- border="0">
126
+ `;
127
+ },
128
+ [O]: (r, e) => {
129
+ const l = (e == null ? void 0 : e.cellPadding) ?? d, a = P("font-size: 12px; color: #666666;", e == null ? void 0 : e.styleTemplate), { before: c, after: g } = x(e == null ? void 0 : e.omnibusText, "Lowest 30-day price: ");
130
+ return `
131
+ <td class="${t}" style="padding: ${l}; height: 100%;" valign="top">
132
+ ${u(e == null ? void 0 : e.cardBackgroundColor)}
168
133
  <tbody>
169
134
  <tr valign="top">
170
135
  <td
171
- class="esd-block-text product-omnibus-price es-p15l es-p15r"
172
- align="center"
173
- data-text-before="Lowest 30-day price: "
174
- data-text-after=""
175
- esd-extension-block-id="${l.OMNIBUS_PRICE}">
176
- <p contenteditable="false" style="font-size: 12px; color: #666666;">
177
- <span class="omnibus-text-before">Lowest 30-day price: </span>
178
- <span class="omnibus-price-value">${i(t, "original_price")}</span>
179
- <span class="omnibus-text-after"></span>
136
+ class="esd-block-text product-omnibus-price ${(e == null ? void 0 : e.cellClasses) ?? "es-p15l es-p15r"}"
137
+ align="${(e == null ? void 0 : e.cellAlignment) ?? "center"}"
138
+ data-text-before="${c}"
139
+ data-text-after="${g}"
140
+ esd-extension-block-id="${b.OMNIBUS_PRICE}"${$(e == null ? void 0 : e.cellBackgroundColor)}>
141
+ <p contenteditable="false" style="${a}">
142
+ <span class="omnibus-text-before">${c}</span>
143
+ <span class="omnibus-price-value">${m(r, "original_price")}</span>
144
+ <span class="omnibus-text-after">${g}</span>
180
145
  </p>
181
146
  </td>
182
147
  </tr>
183
148
  </tbody>
184
149
  </table>
185
150
  </td>
186
- `,
187
- [h]: (t) => {
188
- var c, n;
189
- const e = _(), a = ((c = t.original_price) == null ? void 0 : c[e.code]) ?? Object.values(t.original_price ?? {})[0] ?? 0, r = ((n = t.price) == null ? void 0 : n[e.code]) ?? Object.values(t.price ?? {})[0] ?? 0, o = a > 0 ? Math.round((a - r) / a * 100) : 0, p = o > 0 ? `-${o}%` : "0%";
151
+ `;
152
+ },
153
+ [R]: (r, e) => {
154
+ var s, S;
155
+ const l = (e == null ? void 0 : e.cellPadding) ?? d, a = P("font-size: 12px; color: #666666;", e == null ? void 0 : e.styleTemplate), c = A(), g = ((s = r.original_price) == null ? void 0 : s[c.code]) ?? Object.values(r.original_price ?? {})[0] ?? 0, y = ((S = r.price) == null ? void 0 : S[c.code]) ?? Object.values(r.price ?? {})[0] ?? 0, C = g > 0 ? Math.round((g - y) / g * 100) : 0, B = C > 0 ? `-${C}%` : "0%", { before: _, after: n } = x(e == null ? void 0 : e.omnibusText);
190
156
  return `
191
- <td class="${d}" style="padding: ${s}; height: 100%;" valign="top">
192
- <table
193
- class="product-card-segment"
194
- width="100%"
195
- height="100%"
196
- cellpadding="0"
197
- cellspacing="0"
198
- border="0">
157
+ <td class="${t}" style="padding: ${l}; height: 100%;" valign="top">
158
+ ${u(e == null ? void 0 : e.cardBackgroundColor)}
199
159
  <tbody>
200
160
  <tr valign="top">
201
161
  <td
202
- class="esd-block-text product-omnibus-discount es-p15l es-p15r"
203
- align="center"
204
- data-text-before=""
205
- data-text-after=""
206
- esd-extension-block-id="${l.OMNIBUS_DISCOUNT}">
207
- <p contenteditable="false" style="font-size: 12px; color: #666666;">
208
- <span class="omnibus-text-before"></span>
209
- <span class="omnibus-discount-value">${p}</span>
210
- <span class="omnibus-text-after"></span>
162
+ class="esd-block-text product-omnibus-discount ${(e == null ? void 0 : e.cellClasses) ?? "es-p15l es-p15r"}"
163
+ align="${(e == null ? void 0 : e.cellAlignment) ?? "center"}"
164
+ data-text-before="${_}"
165
+ data-text-after="${n}"
166
+ esd-extension-block-id="${b.OMNIBUS_DISCOUNT}"${$(e == null ? void 0 : e.cellBackgroundColor)}>
167
+ <p contenteditable="false" style="${a}">
168
+ <span class="omnibus-text-before">${_}</span>
169
+ <span class="omnibus-discount-value">${B}</span>
170
+ <span class="omnibus-text-after">${n}</span>
211
171
  </p>
212
172
  </td>
213
173
  </tr>
@@ -216,43 +176,24 @@ const I = {
216
176
  </td>
217
177
  `;
218
178
  },
219
- [u]: () => `
220
- <td class="${d}" style="padding: ${s}; height: 100%;" valign="top">
221
- <table
222
- class="product-card-segment"
223
- width="100%"
224
- height="100%"
225
- cellpadding="0"
226
- cellspacing="0"
227
- border="0">
179
+ [h]: (r, e) => {
180
+ const l = (e == null ? void 0 : e.cellPadding) ?? d, a = e == null ? void 0 : e.styleTemplate, c = (a == null ? void 0 : a.buttonBorderStyle) ?? M, g = (a == null ? void 0 : a.buttonAnchorStyle) ?? z, y = F((a == null ? void 0 : a.buttonText) ?? "Buy", a);
181
+ return `
182
+ <td class="${t}" style="padding: ${l}; height: 100%;" valign="top">
183
+ ${u(e == null ? void 0 : e.cardBackgroundColor)}
228
184
  <tbody>
229
185
  <tr valign="top">
230
186
  <td
231
- class="esd-block-button product-button es-p10t es-p10b"
232
- align="center"
233
- esd-extension-block-id="${l.BUTTON}">
234
- <span
235
- class="es-button-border"
236
- style="
237
- border-width: 1px;
238
- background: rgb(217, 234, 211);
239
- border-color: rgb(106, 168, 79);
240
- ">
187
+ class="esd-block-button product-button ${(e == null ? void 0 : e.cellClasses) ?? "es-p10t es-p10b"}"
188
+ align="${(e == null ? void 0 : e.cellAlignment) ?? "center"}"
189
+ esd-extension-block-id="${b.BUTTON}">
190
+ <span class="${G(a)}" style="${c}">
241
191
  <a
242
192
  href="#"
243
- class="es-button ${g}"
193
+ class="es-button ${f}"
244
194
  target="_blank"
245
- style="
246
- color: rgb(56, 118, 29);
247
- background: rgb(217, 234, 211);
248
- font-family: arial, 'helvetica neue', helvetica, sans-serif;
249
- font-size: 16px;
250
- font-weight: normal;
251
- line-height: 120%;
252
- mso-border-alt: 10px solid rgb(217, 234, 211);
253
- mso-padding-alt: 0;
254
- ">
255
- Buy
195
+ style="${g}">
196
+ ${y}
256
197
  </a>
257
198
  </span>
258
199
  </td>
@@ -260,7 +201,8 @@ const I = {
260
201
  </tbody>
261
202
  </table>
262
203
  </td>
263
- `,
204
+ `;
205
+ },
264
206
  /**
265
207
  * Custom attribute cell template — same structure as built-in entries
266
208
  * (outer td → inner product-card-segment table).
@@ -268,36 +210,34 @@ const I = {
268
210
  * @param productAttrValue - Resolved product-attr value (e.g., "brand" for default, "product_attribute.rating_star" for custom)
269
211
  * @param content - Display content for the cell
270
212
  */
271
- [f]: (t, e) => `
272
- <td class="${d}" style="padding: ${s}; height: 100%;" valign="middle">
273
- <table
274
- class="product-card-segment"
275
- width="100%"
276
- height="100%"
277
- cellpadding="0"
278
- cellspacing="0"
279
- border="0"
280
- style="table-layout: fixed;">
213
+ [N]: (r, e, l) => {
214
+ const a = (l == null ? void 0 : l.cellPadding) ?? d, c = T(
215
+ e,
216
+ { pStyle: "font-size: 12px; color: #666666;", openTags: "", closeTags: "" },
217
+ l == null ? void 0 : l.styleTemplate
218
+ );
219
+ return `
220
+ <td class="${t}" style="padding: ${a}; height: 100%;" valign="middle">
221
+ ${u(l == null ? void 0 : l.cardBackgroundColor, "table-layout: fixed;")}
281
222
  <tbody>
282
223
  <tr valign="top">
283
224
  <td
284
- ${b}="${t}"
285
- class="esd-block-text product-custom-attribute es-p0t es-p0b es-p15l es-p15r"
286
- align="center"
287
- esd-extension-block-id="${l.CUSTOM_ATTRIBUTE}">
288
- <p contenteditable="false" style="font-size: 12px; color: #666666;">${e}</p>
225
+ ${k}="${r}"
226
+ class="esd-block-text product-custom-attribute ${(l == null ? void 0 : l.cellClasses) ?? "es-p0t es-p0b es-p15l es-p15r"}"
227
+ align="${(l == null ? void 0 : l.cellAlignment) ?? "center"}"
228
+ esd-extension-block-id="${b.CUSTOM_ATTRIBUTE}"${$(l == null ? void 0 : l.cellBackgroundColor)}>
229
+ ${c}
289
230
  </td>
290
231
  </tr>
291
232
  </tbody>
292
233
  </table>
293
234
  </td>
294
- `
235
+ `;
236
+ }
295
237
  };
296
238
  export {
297
- d as ATTRIBUTE_CELL_CLASS,
298
- s as DEFAULT_CELL_PADDING,
299
- O as buildFillerCell,
300
- I as gridElementRenderer,
301
- R as renderGridOldPriceCell,
302
- U as renderInlineGridPriceCell
239
+ t as ATTRIBUTE_CELL_CLASS,
240
+ d as DEFAULT_CELL_PADDING,
241
+ Q as buildFillerCell,
242
+ W as gridElementRenderer
303
243
  };
@@ -1,7 +1,7 @@
1
- import { DEFAULT_PRODUCTS_PER_ROW as E } from "../../constants/layout.js";
2
- import { getDefaultProducts as L, DEFAULTS as S, createBlockTemplate as _, DEFAULT_CARD_COMPOSITION as w, spacer as C, buildElementRenderer as O, resolveInlinePriceOrder as A, DEFAULT_CARD_VISIBILITY as D } from "../utils.js";
3
- import { renderInlineGridPriceCell as P, buildFillerCell as g, gridElementRenderer as h } from "./elementRenderer.js";
4
- const U = `
1
+ import { DEFAULT_PRODUCTS_PER_ROW as f } from "../../constants/layout.js";
2
+ import { getDefaultProducts as A, DEFAULTS as C, createBlockTemplate as g, buildSpacer as P, DEFAULT_CARD_COMPOSITION as O, buildElementRenderer as U, DEFAULT_CARD_VISIBILITY as Y } from "../utils.js";
3
+ import { DEFAULT_CELL_PADDING as h, buildFillerCell as B, gridElementRenderer as F } from "./elementRenderer.js";
4
+ const W = `
5
5
  <tr class="recommendation-product-row">
6
6
  <td>
7
7
  <table
@@ -18,7 +18,7 @@ const U = `
18
18
  </table>
19
19
  </td>
20
20
  </tr>
21
- `, Y = `
21
+ `, k = `
22
22
  <tr
23
23
  class="recommendation-attribute-row"
24
24
  data-attribute-type="{-{-ATTR_TYPE-}-}"
@@ -27,39 +27,64 @@ const U = `
27
27
  {-{-CELLS-}-}
28
28
  </tr>
29
29
  `;
30
- function y(e, t, o, r = w, i = {}, p = {}) {
31
- const { priceInline: s = !1 } = p, u = (100 / t).toFixed(2), n = t - e.length, T = n > 0 ? g(u).repeat(n) : "", d = O(o, r, i), c = A(r), R = s ? r.filter((l) => l !== c.skip) : r, I = (l, a) => s && l === c.anchor ? P(a, c.originalFirst) : d[l](a);
32
- return R.filter((l) => d[l]).map((l) => {
33
- const a = D[l] ?? !0, m = a ? "" : 'style="display: none;"', b = e.map((f) => I(l, f).replace("<td", `<td width="${u}%"`)).join("");
34
- return Y.replace("{-{-ATTR_TYPE-}-}", l).replace("{-{-VISIBILITY-}-}", a ? "1" : "0").replace("{-{-DISPLAY_STYLE-}-}", m).replace("{-{-CELLS-}-}", b + T);
30
+ function H(e, r, c, o = O, n = {}, p = {}) {
31
+ const {
32
+ cellPadding: i = h,
33
+ styleTemplates: s,
34
+ cardBackgroundColor: T,
35
+ cellBackgroundColors: l,
36
+ cellAlignments: d,
37
+ cellClasses: u,
38
+ omnibusTexts: a,
39
+ visibility: R
40
+ } = p, m = (100 / r).toFixed(2), I = r - e.length, S = I > 0 ? B(m, i).repeat(I) : "", L = U(c, o, n);
41
+ return o.filter((t) => L[t]).map((t) => {
42
+ const E = (R == null ? void 0 : R[t]) ?? Y[t] ?? !0, b = E ? "" : 'style="display: none;"', _ = {
43
+ cellPadding: i,
44
+ cardBackgroundColor: T,
45
+ cellBackgroundColor: l == null ? void 0 : l[t],
46
+ cellAlignment: d == null ? void 0 : d[t],
47
+ cellClasses: u == null ? void 0 : u[t],
48
+ omnibusText: a == null ? void 0 : a[t],
49
+ styleTemplate: s == null ? void 0 : s[t]
50
+ }, w = e.map((D) => L[t](D, _).replace("<td", `<td width="${m}%"`)).join("");
51
+ return k.replace("{-{-ATTR_TYPE-}-}", t).replace("{-{-VISIBILITY-}-}", E ? "1" : "0").replace("{-{-DISPLAY_STYLE-}-}", b).replace("{-{-CELLS-}-}", w + S);
35
52
  }).join("");
36
53
  }
37
- function B(e, t, o, r, i = {}, p = {}) {
38
- const s = [];
39
- for (let n = 0; n < e.length; n += t)
40
- s.push(e.slice(n, n + t));
41
- return s.map((n, T) => {
42
- const d = y(
43
- n,
44
- t,
45
- o,
54
+ function x(e, r, c, o, n = {}, p = {}) {
55
+ const i = [];
56
+ for (let l = 0; l < e.length; l += r)
57
+ i.push(e.slice(l, l + r));
58
+ const s = P(p.rowSpacingPx);
59
+ return i.map((l, d) => {
60
+ const u = H(
61
+ l,
46
62
  r,
47
- i,
63
+ c,
64
+ o,
65
+ n,
48
66
  p
49
- ), c = U.replace("{-{-ATTRIBUTE_ROWS-}-}", d);
50
- return T > 0 ? C + c : c;
67
+ ), a = W.replace("{-{-ATTRIBUTE_ROWS-}-}", u);
68
+ return d > 0 ? s + a : a;
51
69
  }).join("");
52
70
  }
53
- function F(e, t, o, r = {}, i = {}) {
54
- return B(e, t, h, o, r, i);
71
+ function V(e, r, c, o = {}, n = {}) {
72
+ return x(
73
+ e,
74
+ r,
75
+ F,
76
+ c,
77
+ o,
78
+ n
79
+ );
55
80
  }
56
- function j(e) {
57
- const t = e ? `ins-recommendation-v3-block-${e}` : void 0, o = _("grid", t), r = L(), i = F(r, E);
58
- return o.replace("{-{-TITLE-}-}", S.TITLE).replace("{-{-PRODUCT_ROWS-}-}", i).replace("{-{-MOBILE_PRODUCT_ROWS-}-}", "");
81
+ function $(e) {
82
+ const r = e ? `ins-recommendation-v3-block-${e}` : void 0, c = g("grid", r), o = A(), n = V(o, f);
83
+ return c.replace("{-{-TITLE-}-}", C.TITLE).replace("{-{-PRODUCT_ROWS-}-}", n).replace("{-{-MOBILE_PRODUCT_ROWS-}-}", "");
59
84
  }
60
85
  export {
61
- j as getDefaultTemplate,
62
- y as prepareGridAttributeRows,
63
- B as prepareGridProductRows,
64
- F as prepareProductRows
86
+ $ as getDefaultTemplate,
87
+ H as prepareGridAttributeRows,
88
+ x as prepareGridProductRows,
89
+ V as prepareProductRows
65
90
  };
@@ -1,14 +1,33 @@
1
- import { DEFAULT_PRODUCTS_PER_ROW as s } from "../constants/layout.js";
2
- import { prepareProductRows as m } from "./grid/template.js";
3
- import { prepareProductRows as n } from "./list/template.js";
4
- import "../store/recommendation.js";
5
- function P(o, t, r = {}) {
6
- const e = { priceInline: r.priceInline };
1
+ import { DEFAULT_PRODUCTS_PER_ROW as f } from "../constants/layout.js";
2
+ import { prepareProductRows as w } from "./grid/template.js";
3
+ import { prepareProductRows as g } from "./list/template.js";
4
+ function L(o, t, r = {}) {
5
+ const {
6
+ cellPadding: s,
7
+ rowSpacingPx: i,
8
+ styleTemplates: c,
9
+ cardBackgroundColor: l,
10
+ cellBackgroundColors: p,
11
+ cellAlignments: n,
12
+ cellClasses: a,
13
+ omnibusTexts: d,
14
+ visibility: m
15
+ } = r, e = {
16
+ cellPadding: s,
17
+ rowSpacingPx: i,
18
+ styleTemplates: c,
19
+ cardBackgroundColor: l,
20
+ cellBackgroundColors: p,
21
+ cellAlignments: n,
22
+ cellClasses: a,
23
+ omnibusTexts: d,
24
+ visibility: m
25
+ };
7
26
  if (t === "list")
8
- return n(o, r.composition, r.filterList, e);
9
- const { productsPerRow: i = s, composition: p, filterList: c } = r;
10
- return m(o, i, p, c, e);
27
+ return g(o, r.composition, r.filterList, e);
28
+ const { productsPerRow: u = f, composition: P, filterList: R } = r;
29
+ return w(o, u, P, R, e);
11
30
  }
12
31
  export {
13
- P as prepareProductRows
32
+ L as prepareProductRows
14
33
  };