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

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