@useinsider/guido 3.6.0-beta.4f2bf14 → 3.6.0-beta.596b70e

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 (39) hide show
  1. package/dist/composables/useRecommendation.js +34 -33
  2. package/dist/composables/useStripoEventHandler.js +11 -13
  3. package/dist/extensions/Blocks/Recommendation/controls/main/index.js +50 -48
  4. package/dist/extensions/Blocks/Recommendation/controls/main/layoutOrientation.js +24 -32
  5. package/dist/extensions/Blocks/Recommendation/controls/main/productLayout.js +34 -40
  6. package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +310 -338
  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/store/recommendation.js +13 -9
  10. package/dist/extensions/Blocks/Recommendation/templates/grid/elementRenderer.js +117 -146
  11. package/dist/extensions/Blocks/Recommendation/templates/grid/template.js +49 -30
  12. package/dist/extensions/Blocks/Recommendation/templates/index.js +9 -8
  13. package/dist/extensions/Blocks/Recommendation/templates/list/elementRenderer.js +110 -83
  14. package/dist/extensions/Blocks/Recommendation/templates/list/template.js +31 -21
  15. package/dist/extensions/Blocks/Recommendation/templates/utils.js +90 -54
  16. package/dist/extensions/Blocks/Recommendation/utils/captureStyleTemplates.js +139 -0
  17. package/dist/extensions/Blocks/Recommendation/utils/partnerCustomizations.js +21 -0
  18. package/dist/extensions/Blocks/Recommendation/utils/preserveTextStyles.js +24 -19
  19. package/dist/extensions/Blocks/Recommendation/utils/tagName.js +20 -16
  20. package/dist/extensions/Blocks/controlFactories.js +159 -133
  21. package/dist/src/extensions/Blocks/Items/controls/index.d.ts +1 -1
  22. package/dist/src/extensions/Blocks/Recommendation/controls/button/index.d.ts +1 -1
  23. package/dist/src/extensions/Blocks/Recommendation/controls/main/utils.d.ts +20 -47
  24. package/dist/src/extensions/Blocks/Recommendation/templates/grid/template.d.ts +4 -4
  25. package/dist/src/extensions/Blocks/Recommendation/templates/index.d.ts +1 -1
  26. package/dist/src/extensions/Blocks/Recommendation/templates/list/elementRenderer.test.d.ts +1 -0
  27. package/dist/src/extensions/Blocks/Recommendation/templates/list/template.d.ts +3 -2
  28. package/dist/src/extensions/Blocks/Recommendation/templates/utils.d.ts +127 -11
  29. package/dist/src/extensions/Blocks/Recommendation/templates/utils.test.d.ts +1 -0
  30. package/dist/src/extensions/Blocks/Recommendation/utils/captureStyleTemplates.d.ts +44 -0
  31. package/dist/src/extensions/Blocks/Recommendation/utils/captureStyleTemplates.test.d.ts +1 -0
  32. package/dist/src/extensions/Blocks/Recommendation/utils/partnerCustomizations.d.ts +7 -0
  33. package/dist/src/extensions/Blocks/Recommendation/utils/preserveTextStyles.d.ts +15 -0
  34. package/dist/src/extensions/Blocks/Recommendation/utils/preserveTextStyles.test.d.ts +1 -0
  35. package/dist/src/extensions/Blocks/Recommendation/utils/tagName.d.ts +20 -9
  36. package/dist/src/extensions/Blocks/controlFactories.d.ts +11 -1
  37. package/package.json +1 -1
  38. package/dist/src/extensions/Blocks/Recommendation/utils/stylePreserver.d.ts +0 -113
  39. /package/dist/src/{composables/useStripoEventHandler.test.d.ts → extensions/Blocks/Recommendation/templates/grid/elementRenderer.test.d.ts} +0 -0
@@ -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
  };
@@ -6,8 +6,9 @@ import { DEFAULT_CARDS_IN_ROW as F } from "../constants/layout.js";
6
6
  import { EXCLUDED_ALGORITHM_IDS as D } from "../constants/defaultConfig.js";
7
7
  import { getDefaultProducts as S } from "../templates/utils.js";
8
8
  import { generateCompleteFilterQuery as b } from "../utils/filterUtil.js";
9
- import { isFilterValid as v } from "../validation/filterSchema.js";
10
- import { isConfigValid as w } from "../validation/requiredFields.js";
9
+ import { getPartnerRecommendationParams as v } from "../utils/partnerCustomizations.js";
10
+ import { isFilterValid as w } from "../validation/filterSchema.js";
11
+ import { isConfigValid as N } from "../validation/requiredFields.js";
11
12
  const h = y();
12
13
  let m = null, u = null, d = null;
13
14
  function I() {
@@ -49,7 +50,7 @@ function k() {
49
50
  filterSnapshot: null
50
51
  };
51
52
  }
52
- const N = () => ({
53
+ const x = () => ({
53
54
  recommendationCampaignUrls: {},
54
55
  activePredictiveAlgorithms: [],
55
56
  languages: {},
@@ -58,8 +59,8 @@ const N = () => ({
58
59
  blockStates: {},
59
60
  currentRecommendationId: null,
60
61
  configVersion: 0
61
- }), M = P("guidoRecommendationExtension", {
62
- state: () => N(),
62
+ }), T = P("guidoRecommendationExtension", {
63
+ state: () => x(),
63
64
  getters: {
64
65
  // ====================================================================
65
66
  // Proxy Getters — Backward Compatible Access to Current Block State
@@ -378,7 +379,7 @@ const N = () => ({
378
379
  const n = [...e.recommendationConfigs.filters];
379
380
  n[r] = {
380
381
  ...t,
381
- isValid: v(t)
382
+ isValid: w(t)
382
383
  }, e.recommendationConfigs.filters = n;
383
384
  }
384
385
  },
@@ -424,7 +425,7 @@ const N = () => ({
424
425
  * every block's recommendationConfigs across user edits.
425
426
  */
426
427
  hasInvalidBlock() {
427
- return Object.values(this.blockStates).some((t) => !w(t.recommendationConfigs, this));
428
+ return Object.values(this.blockStates).some((t) => !N(t.recommendationConfigs, this));
428
429
  },
429
430
  // ====================================================================
430
431
  // Per-Block Product Fetching
@@ -453,7 +454,10 @@ const N = () => ({
453
454
  details: !0,
454
455
  campaignId: o.variationId
455
456
  };
456
- r.strategy === "manualMerchandising" ? a.productId = r.productIds.join(",") : r.strategy === "similarViewed" && (a.productId = "{itemId}"), r.strategy === "userBased" && (a.userId = "{user_id}"), c && (a.filter = c), r.shuffleProducts && (a.shuffle = !0);
457
+ r.strategy === "manualMerchandising" ? a.productId = r.productIds.join(",") : r.strategy === "similarViewed" && (a.productId = "{itemId}"), r.strategy === "userBased" && (a.userId = "{user_id}"), c && (a.filter = c), r.shuffleProducts && (a.shuffle = !0), Object.assign(
458
+ a,
459
+ v(o.partnerName, r.strategy)
460
+ );
457
461
  let f;
458
462
  try {
459
463
  f = await h.fetchRecommendationProducts(i, a);
@@ -471,5 +475,5 @@ const N = () => ({
471
475
  }
472
476
  });
473
477
  export {
474
- M as useRecommendationExtensionStore
478
+ T as useRecommendationExtensionStore
475
479
  };
@@ -1,11 +1,15 @@
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;
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;
9
13
  return {
10
14
  code: e.value,
11
15
  symbol: e.symbol,
@@ -15,34 +19,31 @@ function g() {
15
19
  thousandSeparator: e.thousandSeparator
16
20
  };
17
21
  }
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
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
23
27
  });
24
28
  }
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">
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)}
35
36
  <tbody>
36
37
  <tr valign="top">
37
38
  <td
38
39
  class="esd-block-image product-image"
39
40
  align="center"
40
- esd-extension-block-id="${s.IMAGE}">
41
- <a target="_blank" href="${t.url}" class="${p}">
41
+ esd-extension-block-id="${c.IMAGE}">
42
+ <a target="_blank" href="${r.url}" class="${C}">
42
43
  <img
43
- src="${O(t.image_url)}"
44
- alt="${t.name}"
45
- style="display: block; max-width: 100%; height: auto;"
44
+ src="${z(r.image_url)}"
45
+ alt="${r.name}"
46
+ style="${a}"
46
47
  class="adapt-img">
47
48
  </a>
48
49
  </td>
@@ -50,89 +51,82 @@ const S = {
50
51
  </tbody>
51
52
  </table>
52
53
  </td>
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;">
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;")}
64
65
  <tbody>
65
66
  <tr valign="top">
66
67
  <td
67
68
  class="esd-block-text product-name es-p10t es-p10b es-p15l es-p15r"
68
69
  align="center"
69
- esd-extension-block-id="${s.NAME}">
70
- <p contenteditable="false" style="font-size: 16px; color: #333333;">
71
- <strong>${t.name}</strong>
72
- </p>
70
+ esd-extension-block-id="${c.NAME}"${s(e == null ? void 0 : e.cellBackgroundColor)}>
71
+ ${a}
73
72
  </td>
74
73
  </tr>
75
74
  </tbody>
76
75
  </table>
77
76
  </td>
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">
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)}
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="${s.PRICE}">
94
- <p contenteditable="false" style="font-size: 16px; color: #333333;">
95
- <strong>${i(t, "price")}</strong>
96
- </p>
93
+ esd-extension-block-id="${c.PRICE}"${s(e == null ? void 0 : e.cellBackgroundColor)}>
94
+ ${a}
97
95
  </td>
98
96
  </tr>
99
97
  </tbody>
100
98
  </table>
101
99
  </td>
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">
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)}
112
111
  <tbody>
113
112
  <tr valign="top">
114
113
  <td
115
114
  class="esd-block-text product-old-price es-p15l es-p15r"
116
115
  align="center"
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>
116
+ esd-extension-block-id="${c.OLD_PRICE}"${s(e == null ? void 0 : e.cellBackgroundColor)}>
117
+ ${a}
121
118
  </td>
122
119
  </tr>
123
120
  </tbody>
124
121
  </table>
125
122
  </td>
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">
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)}
136
130
  <tbody>
137
131
  <tr valign="top">
138
132
  <td
@@ -140,10 +134,10 @@ const S = {
140
134
  align="center"
141
135
  data-text-before="Lowest 30-day price: "
142
136
  data-text-after=""
143
- esd-extension-block-id="${s.OMNIBUS_PRICE}">
144
- <p contenteditable="false" style="font-size: 12px; color: #666666;">
137
+ esd-extension-block-id="${c.OMNIBUS_PRICE}"${s(e == null ? void 0 : e.cellBackgroundColor)}>
138
+ <p contenteditable="false" style="${a}">
145
139
  <span class="omnibus-text-before">Lowest 30-day price: </span>
146
- <span class="omnibus-price-value">${i(t, "original_price")}</span>
140
+ <span class="omnibus-price-value">${y(r, "original_price")}</span>
147
141
  <span class="omnibus-text-after"></span>
148
142
  </p>
149
143
  </td>
@@ -151,19 +145,14 @@ const S = {
151
145
  </tbody>
152
146
  </table>
153
147
  </td>
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%";
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%";
158
153
  return `
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">
154
+ <td class="${g}" style="padding: ${l}; height: 100%;" valign="top">
155
+ ${n(e == null ? void 0 : e.cardBackgroundColor)}
167
156
  <tbody>
168
157
  <tr valign="top">
169
158
  <td
@@ -171,10 +160,10 @@ const S = {
171
160
  align="center"
172
161
  data-text-before=""
173
162
  data-text-after=""
174
- esd-extension-block-id="${s.OMNIBUS_DISCOUNT}">
175
- <p contenteditable="false" style="font-size: 12px; color: #666666;">
163
+ esd-extension-block-id="${c.OMNIBUS_DISCOUNT}"${s(e == null ? void 0 : e.cellBackgroundColor)}>
164
+ <p contenteditable="false" style="${a}">
176
165
  <span class="omnibus-text-before"></span>
177
- <span class="omnibus-discount-value">${b}</span>
166
+ <span class="omnibus-discount-value">${f}</span>
178
167
  <span class="omnibus-text-after"></span>
179
168
  </p>
180
169
  </td>
@@ -184,43 +173,24 @@ const S = {
184
173
  </td>
185
174
  `;
186
175
  },
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">
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)}
196
181
  <tbody>
197
182
  <tr valign="top">
198
183
  <td
199
184
  class="esd-block-button product-button es-p10t es-p10b"
200
185
  align="center"
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
- ">
186
+ esd-extension-block-id="${c.BUTTON}">
187
+ <span class="${N(a)}" style="${t}">
209
188
  <a
210
189
  href="#"
211
- class="es-button ${p}"
190
+ class="es-button ${C}"
212
191
  target="_blank"
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
192
+ style="${b}">
193
+ ${T}
224
194
  </a>
225
195
  </span>
226
196
  </td>
@@ -228,7 +198,8 @@ const S = {
228
198
  </tbody>
229
199
  </table>
230
200
  </td>
231
- `,
201
+ `;
202
+ },
232
203
  /**
233
204
  * Custom attribute cell template — same structure as built-in entries
234
205
  * (outer td → inner product-card-segment table).
@@ -236,33 +207,33 @@ const S = {
236
207
  * @param productAttrValue - Resolved product-attr value (e.g., "brand" for default, "product_attribute.rating_star" for custom)
237
208
  * @param content - Display content for the cell
238
209
  */
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;">
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;")}
249
219
  <tbody>
250
220
  <tr valign="top">
251
221
  <td
252
- ${u}="${t}"
222
+ ${x}="${r}"
253
223
  class="esd-block-text product-custom-attribute es-p0t es-p0b es-p15l es-p15r"
254
224
  align="center"
255
- esd-extension-block-id="${s.CUSTOM_ATTRIBUTE}">
256
- <p contenteditable="false" style="font-size: 12px; color: #666666;">${e}</p>
225
+ esd-extension-block-id="${c.CUSTOM_ATTRIBUTE}"${s(l == null ? void 0 : l.cellBackgroundColor)}>
226
+ ${t}
257
227
  </td>
258
228
  </tr>
259
229
  </tbody>
260
230
  </table>
261
231
  </td>
262
- `
232
+ `;
233
+ }
263
234
  };
264
235
  export {
265
- l as ATTRIBUTE_CELL_CLASS,
266
- a as DEFAULT_CELL_PADDING,
267
- S as gridElementRenderer
236
+ g as ATTRIBUTE_CELL_CLASS,
237
+ d as DEFAULT_CELL_PADDING,
238
+ V as gridElementRenderer
268
239
  };
@@ -1,7 +1,7 @@
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 = `
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 = `
5
5
  <tr class="recommendation-product-row">
6
6
  <td>
7
7
  <table
@@ -18,7 +18,7 @@ const O = `
18
18
  </table>
19
19
  </td>
20
20
  </tr>
21
- `, g = `
21
+ `, Y = `
22
22
  <tr
23
23
  class="recommendation-attribute-row"
24
24
  data-attribute-type="{-{-ATTR_TYPE-}-}"
@@ -27,38 +27,57 @@ const O = `
27
27
  {-{-CELLS-}-}
28
28
  </tr>
29
29
  `;
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);
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);
35
45
  }).join("");
36
46
  }
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,
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,
44
55
  e,
45
56
  o,
46
- r,
47
- n
48
- ), p = O.replace("{-{-ATTRIBUTE_ROWS-}-}", a);
49
- return d > 0 ? b + p : p;
57
+ l,
58
+ c,
59
+ s
60
+ ), u = B.replace("{-{-ATTRIBUTE_ROWS-}-}", p);
61
+ return d > 0 ? i + u : u;
50
62
  }).join("");
51
63
  }
52
- function h(t, e, o, r = {}) {
53
- return U(t, e, C, o, r);
64
+ function F(t, e, o, l = {}, c = {}) {
65
+ return W(
66
+ t,
67
+ e,
68
+ h,
69
+ o,
70
+ l,
71
+ c
72
+ );
54
73
  }
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-}-}", "");
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-}-}", "");
58
77
  }
59
78
  export {
60
- F as getDefaultTemplate,
61
- P as prepareGridAttributeRows,
62
- U as prepareGridProductRows,
63
- h as prepareProductRows
79
+ j as getDefaultTemplate,
80
+ y as prepareGridAttributeRows,
81
+ W as prepareGridProductRows,
82
+ F as prepareProductRows
64
83
  };
@@ -1,12 +1,13 @@
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 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 };
5
6
  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);
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);
9
10
  }
10
11
  export {
11
- a as prepareProductRows
12
+ g as prepareProductRows
12
13
  };