@useinsider/guido 3.8.2-beta.189e91c → 3.8.2

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 (43) hide show
  1. package/dist/@types/config/schemas.js +66 -70
  2. package/dist/composables/usePreviewMode.js +14 -15
  3. package/dist/config/compiler/recommendationCompilerRules.js +1 -1
  4. package/dist/config/compiler/utils/recommendationCompilerUtils.js +80 -88
  5. package/dist/config/migrator/recommendation/htmlBuilder.js +52 -53
  6. package/dist/config/migrator/recommendation/settingsMapper.js +33 -38
  7. package/dist/extensions/Blocks/Recommendation/block.js +41 -60
  8. package/dist/extensions/Blocks/Recommendation/constants/defaultConfig.js +32 -41
  9. package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +264 -345
  10. package/dist/extensions/Blocks/Recommendation/controls/main/index.js +87 -99
  11. package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +160 -162
  12. package/dist/extensions/Blocks/Recommendation/extension.js +29 -30
  13. package/dist/extensions/Blocks/Recommendation/iconsRegistry.js +7 -21
  14. package/dist/extensions/Blocks/Recommendation/recommendation.css.js +4 -64
  15. package/dist/extensions/Blocks/Recommendation/store/recommendation.js +1 -3
  16. package/dist/extensions/Blocks/Recommendation/templates/grid/elementRenderer.js +96 -130
  17. package/dist/extensions/Blocks/Recommendation/templates/grid/template.js +54 -43
  18. package/dist/extensions/Blocks/Recommendation/templates/index.js +14 -17
  19. package/dist/extensions/Blocks/Recommendation/templates/list/elementRenderer.js +80 -86
  20. package/dist/extensions/Blocks/Recommendation/templates/list/template.js +40 -31
  21. package/dist/extensions/Blocks/Recommendation/templates/utils.js +102 -155
  22. package/dist/src/@types/config/schemas.d.ts +0 -16
  23. package/dist/src/composables/useConfig.d.ts +0 -4
  24. package/dist/src/config/migrator/recommendation/settingsMapper.d.ts +1 -1
  25. package/dist/src/extensions/Blocks/Recommendation/block.d.ts +0 -10
  26. package/dist/src/extensions/Blocks/Recommendation/controls/cardComposition/index.d.ts +3 -29
  27. package/dist/src/extensions/Blocks/Recommendation/controls/index.d.ts +1 -1
  28. package/dist/src/extensions/Blocks/Recommendation/controls/main/index.d.ts +1 -3
  29. package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +0 -2
  30. package/dist/src/extensions/Blocks/Recommendation/templates/grid/elementRenderer.d.ts +1 -13
  31. package/dist/src/extensions/Blocks/Recommendation/templates/grid/template.d.ts +4 -4
  32. package/dist/src/extensions/Blocks/Recommendation/templates/index.d.ts +1 -1
  33. package/dist/src/extensions/Blocks/Recommendation/templates/list/elementRenderer.d.ts +1 -10
  34. package/dist/src/extensions/Blocks/Recommendation/templates/list/template.d.ts +3 -3
  35. package/dist/src/extensions/Blocks/Recommendation/templates/utils.d.ts +1 -51
  36. package/dist/src/extensions/Blocks/Recommendation/types/nodeConfig.d.ts +0 -15
  37. package/dist/src/stores/config.d.ts +0 -36
  38. package/package.json +1 -1
  39. package/dist/composables/useRecommendationPreview.js +0 -111
  40. package/dist/extensions/Blocks/Recommendation/canvasPreview.css.js +0 -16
  41. package/dist/extensions/Blocks/Recommendation/controls/main/pricePlacement.js +0 -133
  42. package/dist/src/composables/useRecommendationPreview.d.ts +0 -10
  43. package/dist/src/extensions/Blocks/Recommendation/controls/main/pricePlacement.d.ts +0 -59
@@ -1,8 +1,8 @@
1
1
  import r from "../../../static/assets/info.svg.js";
2
- import { IconsRegistry as C } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
3
- class h extends C {
4
- registerIconsSvg(t) {
5
- t["recommendation-icon"] = `
2
+ import { IconsRegistry as t } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
3
+ class h extends t {
4
+ registerIconsSvg(C) {
5
+ C["recommendation-icon"] = `
6
6
  <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20" fill="none">
7
7
  <path d="M10 4.4C10 4.73137 9.73012 4.99622 9.40108 5.0355C6.92202 5.33143 5 7.44126 5 10C5 12.5587
8
8
  6.92202 14.6686 9.40108 14.9645C9.73012 15.0038 10 15.2686 10 15.6V18.4C10 18.7314 9.73137 19 9.4
@@ -44,14 +44,14 @@ class h extends C {
44
44
  3.40029 12.0082 3.25285 11.7656 3.15234C11.365 2.98638 11.0001 2.64849 11 2.21484V2Z"
45
45
  fill="currentColor"/>
46
46
  </svg>
47
- `, t["grid-orientation"] = `
47
+ `, C["grid-orientation"] = `
48
48
  <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20" fill="currentColor">
49
49
  <rect x="1" y="1" width="7" height="7" rx="1" stroke="currentColor" stroke-width="2" fill="none"/>
50
50
  <rect x="12" y="1" width="7" height="7" rx="1" stroke="currentColor" stroke-width="2" fill="none"/>
51
51
  <rect x="1" y="12" width="7" height="7" rx="1" stroke="currentColor" stroke-width="2" fill="none"/>
52
52
  <rect x="12" y="12" width="7" height="7" rx="1" stroke="currentColor" stroke-width="2" fill="none"/>
53
53
  </svg>
54
- `, t["list-orientation"] = `
54
+ `, C["list-orientation"] = `
55
55
  <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20" fill="currentColor">
56
56
  <circle cx="3" cy="4" r="1" stroke="currentColor" stroke-width="1"/>
57
57
  <rect x="7" y="3" width="11" height="2" rx="1"/>
@@ -60,21 +60,7 @@ class h extends C {
60
60
  <circle cx="3" cy="16" r="1" stroke="currentColor" stroke-width="1"/>
61
61
  <rect x="7" y="15" width="11" height="2" rx="1"/>
62
62
  </svg>
63
- `, t["vertical-orientation"] = `
64
- <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20" fill="currentColor">
65
- <path d="M19 10V16C19 16.5523 18.5523 17 18 17H2C1.44772 17 1 16.5523 1 16V10H19Z"
66
- stroke="currentColor" stroke-width="2" fill="none"/>
67
- <path d="M2 3H18C18.5523 3 19 3.44772 19 4V10H1V4C1 3.44772 1.44772 3 2 3Z" stroke="currentColor"
68
- stroke-width="2" fill="none"/>
69
- </svg>
70
- `, t["horizontal-orientation"] = `
71
- <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20">
72
- <path d="M10 19H4C3.44772 19 3 18.5523 3 18V2C3 1.44772 3.44772 1 4 1H10V19Z" stroke="currentColor"
73
- stroke-width="2" fill="none"/>
74
- <path d="M17 2V18C17 18.5523 16.5523 19 16 19H10V1H16C16.5523 1 17 1.44772 17 2Z" stroke="currentColor"
75
- stroke-width="2" fill="none"/>
76
- </svg>
77
- `, t["migration-info-icon"] = r;
63
+ `, C["migration-info-icon"] = r;
78
64
  }
79
65
  }
80
66
  export {
@@ -18,13 +18,6 @@ const n = `/* Utils */
18
18
  padding: 0
19
19
  }
20
20
 
21
- /* Group the two price-placement rows (orientation + hide-if-same) into one
22
- container — drop the divider the editor adds between stacked setting rows.
23
- Ancestor added so this out-specifies the editor's \`.two-columns:not(:first-child)\`. */
24
- .recommendation-controls-container .price-placement-control-container .container.two-columns {
25
- border-top: none;
26
- }
27
-
28
21
  /* Right-align the mobile layout toggle within the two-column grid */
29
22
  .product-layout-control-container ue-switcher {
30
23
  justify-self: end;
@@ -150,68 +143,15 @@ ue-orderable.orderable-disabled .droppable-icon {
150
143
  color: var(--guido-color-danger-500);
151
144
  }
152
145
 
153
- /* ─── Inline "Product Prices" group: nested 2-item sub-drag ───────────── */
154
- .orderable-item.price-group-item {
155
- flex-direction: column;
156
- align-items: stretch;
157
- gap: 8px;
158
- }
159
-
160
- .price-group-header {
161
- display: flex;
162
- align-items: center;
163
- gap: 4px;
164
- }
165
-
166
- .price-suborderable-list {
167
- display: flex;
168
- flex-direction: column;
169
- margin-left: 4px;
170
- padding-left: 8px;
171
- border-left: 2px solid #eee;
146
+ /* Disable drag for list layout */
147
+ .orderable-list.orderable-disabled .drag-handle {
148
+ display: none;
172
149
  }
173
150
 
174
- .price-suborderable-item {
175
- display: flex;
176
- align-items: center;
177
- gap: 4px;
178
- padding: 8px 0;
179
- background: var(--guido-color-white);
151
+ .orderable-list.orderable-disabled .orderable-item {
180
152
  cursor: default;
181
- transition: background 0.15s;
182
- box-sizing: border-box;
183
- }
184
-
185
- .price-suborderable-item:hover {
186
- background: #fafafa;
187
- }
188
-
189
- .price-suborderable-item.dragging {
190
- opacity: 0.5;
191
- background: var(--guido-color-gray-1);
192
- }
193
-
194
- .price-suborderable-item.drag-over {
195
- border-top: 2px solid var(--guido-color-primary-500, #0A2ECC);
196
- }
197
-
198
- .price-suborderable-item .item-label {
199
- font-size: 13px;
200
153
  }
201
154
 
202
- .sub-drag-handle {
203
- display: flex;
204
- align-items: center;
205
- justify-content: center;
206
- flex-shrink: 0;
207
- width: 24px;
208
- height: 24px;
209
- cursor: move;
210
- user-select: none;
211
- color: var(--guido-color-gray-600);
212
- }
213
-
214
-
215
155
  /* ─── Migration Info Box ─────────────────────────────────────────────── */
216
156
  /* Shown in the settings panel title when a block was migrated from legacy */
217
157
 
@@ -38,9 +38,7 @@ function k() {
38
38
  textTrimming: !0,
39
39
  unresponsive: !1,
40
40
  size: "6",
41
- customAttributes: [],
42
- priceMovedToNextLine: !0,
43
- priceHideIfSameAsDiscounted: !1
41
+ customAttributes: []
44
42
  };
45
43
  }
46
44
  function I() {
@@ -1,83 +1,51 @@
1
- import { RecommendationBlockId as t } from "../../constants/blockIds.js";
2
- import { ATTR_PRODUCT_ATTR as h, ATTR_PRODUCT_BUTTON as E, CSS_CLASS_RECO_BUTTON as S, ATTR_PRODUCT_OMNIBUS_DISCOUNT as U, ATTR_PRODUCT_OMNIBUS_PRICE as v, ATTR_PRODUCT_OLD_PRICE as n, ATTR_PRODUCT_PRICE as I, ATTR_PRODUCT_NAME as L, ATTR_PRODUCT_IMAGE as D } from "../../constants/selectors.js";
3
- import { formatProductPrice as _, cellBgStyleAttr as T, renderStyledParagraph as C, resolveSegmentBgStyle as N, CUSTOM_CELL_HTML as M, DEFAULT_BUTTON_BORDER_STYLE as z, DEFAULT_BUTTON_ANCHOR_STYLE as G, renderButtonLabel as F, resolveButtonBorderClass as H, resolvePStyle as s, getCurrentCurrencyConfig as O, resolveOmnibusText as P, isSamePrice as w, DEFAULT_IMG_STYLE as Y, sanitizeImageUrl as j } from "../utils.js";
4
- const g = "0 5px", $ = "attribute-cell", B = {
5
- pStyle: "font-size: 16px; color: #333333;",
6
- openTags: "<strong>",
7
- closeTags: "</strong>"
8
- }, f = {
9
- pStyle: "font-size: 14px; color: #999999;",
10
- openTags: "<s><strong>",
11
- closeTags: "</strong></s>"
12
- };
13
- function Q(c, e = g) {
14
- return `<td class="${$}" style="padding: ${e};" width="${c}%"></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>`;
15
9
  }
16
- function b(c, e = "") {
17
- const l = N(e, c);
10
+ function u(r, e = "") {
11
+ const l = Y(e, r);
18
12
  return `<table class="product-card-segment" width="100%" height="100%" cellpadding="0" cellspacing="0" border="0"${l ? ` style="${l}"` : ""}>`;
19
13
  }
20
- function V(c, e = !0, l, a, d) {
21
- const r = _(c, "price"), u = _(c, "original_price"), A = r === u, x = (y) => `<td
22
- class="esd-block-text product-price ${y}"
23
- align="${(l == null ? void 0 : l.cellAlignment) ?? "center"}"
24
- valign="middle"
25
- esd-extension-block-id="${t.PRICE}"${T(l == null ? void 0 : l.cellBackgroundColor)}>
26
- ${C(
27
- r,
28
- B,
29
- l == null ? void 0 : l.styleTemplate
30
- )}
31
- </td>`, m = (y) => `<td
32
- class="esd-block-text product-old-price ${y}"
33
- align="${(a == null ? void 0 : a.cellAlignment) ?? "center"}"
34
- valign="middle"
35
- data-same-price="${A}"
36
- esd-extension-block-id="${t.OLD_PRICE}"${T(a == null ? void 0 : a.cellBackgroundColor)}>
37
- ${C(
38
- u,
39
- f,
40
- a == null ? void 0 : a.styleTemplate
41
- )}
42
- </td>`, k = e ? m("es-p15l es-p5r") : x("es-p15l es-p5r"), R = e ? x("es-p5l es-p15r") : m("es-p5l es-p15r");
43
- return `
44
- <td class="${$}" style="padding: ${g}; height: 100%;" valign="top">
45
- ${b(d)}
46
- <tbody>
47
- <tr valign="top">
48
- <td align="center">
49
- <table cellpadding="0" cellspacing="0" border="0" align="center" style="margin: 0 auto;">
50
- <tbody>
51
- <tr valign="middle">
52
- ${k}
53
- ${R}
54
- </tr>
55
- </tbody>
56
- </table>
57
- </td>
58
- </tr>
59
- </tbody>
60
- </table>
61
- </td>
62
- `;
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
+ };
24
+ }
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
+ });
63
31
  }
64
32
  const W = {
65
- [D]: (c, e) => {
66
- var d;
67
- const l = (e == null ? void 0 : e.cellPadding) ?? g, a = ((d = e == null ? void 0 : e.styleTemplate) == null ? void 0 : d.imgStyle) ?? Y;
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;
68
36
  return `
69
- <td class="${$}" style="padding: ${l}; height: 100%;" valign="top">
70
- ${b(e == null ? void 0 : e.cardBackgroundColor)}
37
+ <td class="${t}" style="padding: ${l}; height: 100%;" valign="top">
38
+ ${u(e == null ? void 0 : e.cardBackgroundColor)}
71
39
  <tbody>
72
40
  <tr valign="top">
73
41
  <td
74
42
  class="esd-block-image product-image"
75
43
  align="center"
76
- esd-extension-block-id="${t.IMAGE}">
77
- <a target="_blank" href="${c.url}" class="${S}">
44
+ esd-extension-block-id="${b.IMAGE}">
45
+ <a target="_blank" href="${r.url}" class="${f}">
78
46
  <img
79
- src="${j(c.image_url)}"
80
- alt="${c.name}"
47
+ src="${w(r.image_url)}"
48
+ alt="${r.name}"
81
49
  style="${a}"
82
50
  class="adapt-img">
83
51
  </a>
@@ -88,21 +56,21 @@ const W = {
88
56
  </td>
89
57
  `;
90
58
  },
91
- [L]: (c, e) => {
92
- const l = (e == null ? void 0 : e.cellPadding) ?? g, a = C(
93
- c.name,
59
+ [E]: (r, e) => {
60
+ const l = (e == null ? void 0 : e.cellPadding) ?? d, a = T(
61
+ r.name,
94
62
  { pStyle: "font-size: 16px; color: #333333;", openTags: "<strong>", closeTags: "</strong>" },
95
63
  e == null ? void 0 : e.styleTemplate
96
64
  );
97
65
  return `
98
- <td class="${$}" style="padding: ${l}; height: 100%;" valign="middle">
99
- ${b(e == null ? void 0 : e.cardBackgroundColor, "table-layout: fixed;")}
66
+ <td class="${t}" style="padding: ${l}; height: 100%;" valign="middle">
67
+ ${u(e == null ? void 0 : e.cardBackgroundColor, "table-layout: fixed;")}
100
68
  <tbody>
101
69
  <tr valign="top">
102
70
  <td
103
71
  class="esd-block-text product-name ${(e == null ? void 0 : e.cellClasses) ?? "es-p10t es-p10b es-p15l es-p15r"}"
104
72
  align="${(e == null ? void 0 : e.cellAlignment) ?? "center"}"
105
- esd-extension-block-id="${t.NAME}"${T(e == null ? void 0 : e.cellBackgroundColor)}>
73
+ esd-extension-block-id="${b.NAME}"${$(e == null ? void 0 : e.cellBackgroundColor)}>
106
74
  ${a}
107
75
  </td>
108
76
  </tr>
@@ -111,21 +79,21 @@ const W = {
111
79
  </td>
112
80
  `;
113
81
  },
114
- [I]: (c, e) => {
115
- const l = (e == null ? void 0 : e.cellPadding) ?? g, a = C(
116
- _(c, "price"),
117
- B,
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>" },
118
86
  e == null ? void 0 : e.styleTemplate
119
87
  );
120
88
  return `
121
- <td class="${$}" style="padding: ${l}; height: 100%;" valign="top">
122
- ${b(e == null ? void 0 : e.cardBackgroundColor)}
89
+ <td class="${t}" style="padding: ${l}; height: 100%;" valign="top">
90
+ ${u(e == null ? void 0 : e.cardBackgroundColor)}
123
91
  <tbody>
124
92
  <tr valign="top">
125
93
  <td
126
94
  class="esd-block-text product-price ${(e == null ? void 0 : e.cellClasses) ?? "es-p15l es-p15r"}"
127
95
  align="${(e == null ? void 0 : e.cellAlignment) ?? "center"}"
128
- esd-extension-block-id="${t.PRICE}"${T(e == null ? void 0 : e.cellBackgroundColor)}>
96
+ esd-extension-block-id="${b.PRICE}"${$(e == null ? void 0 : e.cellBackgroundColor)}>
129
97
  ${a}
130
98
  </td>
131
99
  </tr>
@@ -134,22 +102,21 @@ const W = {
134
102
  </td>
135
103
  `;
136
104
  },
137
- [n]: (c, e) => {
138
- const l = (e == null ? void 0 : e.cellPadding) ?? g, a = C(
139
- _(c, "original_price"),
140
- f,
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>" },
141
109
  e == null ? void 0 : e.styleTemplate
142
110
  );
143
111
  return `
144
- <td class="${$}" style="padding: ${l}; height: 100%;" valign="top">
145
- ${b(e == null ? void 0 : e.cardBackgroundColor)}
112
+ <td class="${t}" style="padding: ${l}; height: 100%;" valign="top">
113
+ ${u(e == null ? void 0 : e.cardBackgroundColor)}
146
114
  <tbody>
147
115
  <tr valign="top">
148
116
  <td
149
117
  class="esd-block-text product-old-price ${(e == null ? void 0 : e.cellClasses) ?? "es-p15l es-p15r"}"
150
118
  align="${(e == null ? void 0 : e.cellAlignment) ?? "center"}"
151
- data-same-price="${w(c)}"
152
- esd-extension-block-id="${t.OLD_PRICE}"${T(e == null ? void 0 : e.cellBackgroundColor)}>
119
+ esd-extension-block-id="${b.OLD_PRICE}"${$(e == null ? void 0 : e.cellBackgroundColor)}>
153
120
  ${a}
154
121
  </td>
155
122
  </tr>
@@ -158,23 +125,23 @@ const W = {
158
125
  </td>
159
126
  `;
160
127
  },
161
- [v]: (c, e) => {
162
- const l = (e == null ? void 0 : e.cellPadding) ?? g, a = s("font-size: 12px; color: #666666;", e == null ? void 0 : e.styleTemplate), { before: d, after: r } = P(e == null ? void 0 : e.omnibusText, "Lowest 30-day price: ");
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: ");
163
130
  return `
164
- <td class="${$}" style="padding: ${l}; height: 100%;" valign="top">
165
- ${b(e == null ? void 0 : e.cardBackgroundColor)}
131
+ <td class="${t}" style="padding: ${l}; height: 100%;" valign="top">
132
+ ${u(e == null ? void 0 : e.cardBackgroundColor)}
166
133
  <tbody>
167
134
  <tr valign="top">
168
135
  <td
169
136
  class="esd-block-text product-omnibus-price ${(e == null ? void 0 : e.cellClasses) ?? "es-p15l es-p15r"}"
170
137
  align="${(e == null ? void 0 : e.cellAlignment) ?? "center"}"
171
- data-text-before="${d}"
172
- data-text-after="${r}"
173
- esd-extension-block-id="${t.OMNIBUS_PRICE}"${T(e == null ? void 0 : e.cellBackgroundColor)}>
138
+ data-text-before="${c}"
139
+ data-text-after="${g}"
140
+ esd-extension-block-id="${b.OMNIBUS_PRICE}"${$(e == null ? void 0 : e.cellBackgroundColor)}>
174
141
  <p contenteditable="false" style="${a}">
175
- <span class="omnibus-text-before">${d}</span>
176
- <span class="omnibus-price-value">${_(c, "original_price")}</span>
177
- <span class="omnibus-text-after">${r}</span>
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>
178
145
  </p>
179
146
  </td>
180
147
  </tr>
@@ -183,24 +150,24 @@ const W = {
183
150
  </td>
184
151
  `;
185
152
  },
186
- [U]: (c, e) => {
187
- var R, y;
188
- const l = (e == null ? void 0 : e.cellPadding) ?? g, a = s("font-size: 12px; color: #666666;", e == null ? void 0 : e.styleTemplate), d = O(), r = ((R = c.original_price) == null ? void 0 : R[d.code]) ?? Object.values(c.original_price ?? {})[0] ?? 0, u = ((y = c.price) == null ? void 0 : y[d.code]) ?? Object.values(c.price ?? {})[0] ?? 0, A = r > 0 ? Math.round((r - u) / r * 100) : 0, x = A > 0 ? `-${A}%` : "0%", { before: m, after: k } = P(e == null ? void 0 : e.omnibusText);
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);
189
156
  return `
190
- <td class="${$}" style="padding: ${l}; height: 100%;" valign="top">
191
- ${b(e == null ? void 0 : e.cardBackgroundColor)}
157
+ <td class="${t}" style="padding: ${l}; height: 100%;" valign="top">
158
+ ${u(e == null ? void 0 : e.cardBackgroundColor)}
192
159
  <tbody>
193
160
  <tr valign="top">
194
161
  <td
195
162
  class="esd-block-text product-omnibus-discount ${(e == null ? void 0 : e.cellClasses) ?? "es-p15l es-p15r"}"
196
163
  align="${(e == null ? void 0 : e.cellAlignment) ?? "center"}"
197
- data-text-before="${m}"
198
- data-text-after="${k}"
199
- esd-extension-block-id="${t.OMNIBUS_DISCOUNT}"${T(e == null ? void 0 : e.cellBackgroundColor)}>
164
+ data-text-before="${_}"
165
+ data-text-after="${n}"
166
+ esd-extension-block-id="${b.OMNIBUS_DISCOUNT}"${$(e == null ? void 0 : e.cellBackgroundColor)}>
200
167
  <p contenteditable="false" style="${a}">
201
- <span class="omnibus-text-before">${m}</span>
202
- <span class="omnibus-discount-value">${x}</span>
203
- <span class="omnibus-text-after">${k}</span>
168
+ <span class="omnibus-text-before">${_}</span>
169
+ <span class="omnibus-discount-value">${B}</span>
170
+ <span class="omnibus-text-after">${n}</span>
204
171
  </p>
205
172
  </td>
206
173
  </tr>
@@ -209,24 +176,24 @@ const W = {
209
176
  </td>
210
177
  `;
211
178
  },
212
- [E]: (c, e) => {
213
- const l = (e == null ? void 0 : e.cellPadding) ?? g, a = e == null ? void 0 : e.styleTemplate, d = (a == null ? void 0 : a.buttonBorderStyle) ?? z, r = (a == null ? void 0 : a.buttonAnchorStyle) ?? G, u = F((a == null ? void 0 : a.buttonText) ?? "Buy", a);
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);
214
181
  return `
215
- <td class="${$}" style="padding: ${l}; height: 100%;" valign="top">
216
- ${b(e == null ? void 0 : e.cardBackgroundColor)}
182
+ <td class="${t}" style="padding: ${l}; height: 100%;" valign="top">
183
+ ${u(e == null ? void 0 : e.cardBackgroundColor)}
217
184
  <tbody>
218
185
  <tr valign="top">
219
186
  <td
220
187
  class="esd-block-button product-button ${(e == null ? void 0 : e.cellClasses) ?? "es-p10t es-p10b"}"
221
188
  align="${(e == null ? void 0 : e.cellAlignment) ?? "center"}"
222
- esd-extension-block-id="${t.BUTTON}">
223
- <span class="${H(a)}" style="${d}">
189
+ esd-extension-block-id="${b.BUTTON}">
190
+ <span class="${G(a)}" style="${c}">
224
191
  <a
225
192
  href="#"
226
- class="es-button ${S}"
193
+ class="es-button ${f}"
227
194
  target="_blank"
228
- style="${r}">
229
- ${u}
195
+ style="${g}">
196
+ ${y}
230
197
  </a>
231
198
  </span>
232
199
  </td>
@@ -243,23 +210,23 @@ const W = {
243
210
  * @param productAttrValue - Resolved product-attr value (e.g., "brand" for default, "product_attribute.rating_star" for custom)
244
211
  * @param content - Display content for the cell
245
212
  */
246
- [M]: (c, e, l) => {
247
- const a = (l == null ? void 0 : l.cellPadding) ?? g, d = C(
213
+ [N]: (r, e, l) => {
214
+ const a = (l == null ? void 0 : l.cellPadding) ?? d, c = T(
248
215
  e,
249
216
  { pStyle: "font-size: 12px; color: #666666;", openTags: "", closeTags: "" },
250
217
  l == null ? void 0 : l.styleTemplate
251
218
  );
252
219
  return `
253
- <td class="${$}" style="padding: ${a}; height: 100%;" valign="middle">
254
- ${b(l == null ? void 0 : l.cardBackgroundColor, "table-layout: fixed;")}
220
+ <td class="${t}" style="padding: ${a}; height: 100%;" valign="middle">
221
+ ${u(l == null ? void 0 : l.cardBackgroundColor, "table-layout: fixed;")}
255
222
  <tbody>
256
223
  <tr valign="top">
257
224
  <td
258
- ${h}="${c}"
225
+ ${k}="${r}"
259
226
  class="esd-block-text product-custom-attribute ${(l == null ? void 0 : l.cellClasses) ?? "es-p0t es-p0b es-p15l es-p15r"}"
260
227
  align="${(l == null ? void 0 : l.cellAlignment) ?? "center"}"
261
- esd-extension-block-id="${t.CUSTOM_ATTRIBUTE}"${T(l == null ? void 0 : l.cellBackgroundColor)}>
262
- ${d}
228
+ esd-extension-block-id="${b.CUSTOM_ATTRIBUTE}"${$(l == null ? void 0 : l.cellBackgroundColor)}>
229
+ ${c}
263
230
  </td>
264
231
  </tr>
265
232
  </tbody>
@@ -269,9 +236,8 @@ const W = {
269
236
  }
270
237
  };
271
238
  export {
272
- $ as ATTRIBUTE_CELL_CLASS,
273
- g as DEFAULT_CELL_PADDING,
239
+ t as ATTRIBUTE_CELL_CLASS,
240
+ d as DEFAULT_CELL_PADDING,
274
241
  Q as buildFillerCell,
275
- W as gridElementRenderer,
276
- V as renderInlineGridPriceCell
242
+ W as gridElementRenderer
277
243
  };
@@ -1,8 +1,8 @@
1
- import { ATTR_PRODUCT_PRICE as f, ATTR_PRODUCT_OLD_PRICE as O } from "../../constants/selectors.js";
2
- import { DEFAULT_PRODUCTS_PER_ROW as w } from "../../constants/layout.js";
3
- import { getDefaultProducts as A, DEFAULTS as g, createBlockTemplate as U, buildSpacer as h, DEFAULT_CARD_COMPOSITION as Y, buildElementRenderer as B, resolveInlinePriceOrder as F, buildCellOptions as I, DEFAULT_CARD_VISIBILITY as W } from "../utils.js";
4
- import { DEFAULT_CELL_PADDING as k, renderInlineGridPriceCell as H, buildFillerCell as x, gridElementRenderer as y } from "./elementRenderer.js";
5
- const G = `
1
+ import "../../constants/selectors.js";
2
+ import { DEFAULT_PRODUCTS_PER_ROW as f } from "../../constants/layout.js";
3
+ 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";
4
+ import { DEFAULT_CELL_PADDING as h, buildFillerCell as B, gridElementRenderer as F } from "./elementRenderer.js";
5
+ const W = `
6
6
  <tr class="recommendation-product-row">
7
7
  <td>
8
8
  <table
@@ -19,7 +19,7 @@ const G = `
19
19
  </table>
20
20
  </td>
21
21
  </tr>
22
- `, V = `
22
+ `, k = `
23
23
  <tr
24
24
  class="recommendation-attribute-row"
25
25
  data-attribute-type="{-{-ATTR_TYPE-}-}"
@@ -28,53 +28,64 @@ const G = `
28
28
  {-{-CELLS-}-}
29
29
  </tr>
30
30
  `;
31
- function j(e, t, n, r = Y, c = {}, i = {}) {
32
- const { cellPadding: s = k, cardBackgroundColor: u, visibility: a, priceInline: o = !1 } = i, d = (100 / t).toFixed(2), p = t - e.length, T = p > 0 ? x(d, s).repeat(p) : "", m = B(n, r, c), R = F(r), L = o ? r.filter((l) => l !== R.skip) : r, C = I(f, i), P = I(O, i);
33
- return L.filter((l) => m[l]).map((l) => {
34
- const _ = (a == null ? void 0 : a[l]) ?? W[l] ?? !0, b = _ ? "" : 'style="display: none;"', S = I(l, i), D = e.map((E) => (o && l === R.anchor ? H(
35
- E,
36
- R.originalFirst,
37
- C,
38
- P,
39
- u
40
- ) : m[l](E, S)).replace("<td", `<td width="${d}%"`)).join("");
41
- return V.replace("{-{-ATTR_TYPE-}-}", l).replace("{-{-VISIBILITY-}-}", _ ? "1" : "0").replace("{-{-DISPLAY_STYLE-}-}", b).replace("{-{-CELLS-}-}", D + T);
31
+ function H(e, r, c, o = O, n = {}, p = {}) {
32
+ const {
33
+ cellPadding: a = h,
34
+ styleTemplates: s,
35
+ cardBackgroundColor: T,
36
+ cellBackgroundColors: l,
37
+ cellAlignments: d,
38
+ cellClasses: u,
39
+ omnibusTexts: i,
40
+ visibility: R
41
+ } = p, m = (100 / r).toFixed(2), I = r - e.length, S = I > 0 ? B(m, a).repeat(I) : "", L = U(c, o, n);
42
+ return o.filter((t) => L[t]).map((t) => {
43
+ const E = (R == null ? void 0 : R[t]) ?? Y[t] ?? !0, b = E ? "" : 'style="display: none;"', _ = {
44
+ cellPadding: a,
45
+ cardBackgroundColor: T,
46
+ cellBackgroundColor: l == null ? void 0 : l[t],
47
+ cellAlignment: d == null ? void 0 : d[t],
48
+ cellClasses: u == null ? void 0 : u[t],
49
+ omnibusText: i == null ? void 0 : i[t],
50
+ styleTemplate: s == null ? void 0 : s[t]
51
+ }, w = e.map((D) => L[t](D, _).replace("<td", `<td width="${m}%"`)).join("");
52
+ return k.replace("{-{-ATTR_TYPE-}-}", t).replace("{-{-VISIBILITY-}-}", E ? "1" : "0").replace("{-{-DISPLAY_STYLE-}-}", b).replace("{-{-CELLS-}-}", w + S);
42
53
  }).join("");
43
54
  }
44
- function v(e, t, n, r, c = {}, i = {}) {
45
- const s = [];
46
- for (let o = 0; o < e.length; o += t)
47
- s.push(e.slice(o, o + t));
48
- const u = h(i.rowSpacingPx);
49
- return s.map((o, d) => {
50
- const p = j(
51
- o,
52
- t,
53
- n,
55
+ function x(e, r, c, o, n = {}, p = {}) {
56
+ const a = [];
57
+ for (let l = 0; l < e.length; l += r)
58
+ a.push(e.slice(l, l + r));
59
+ const s = P(p.rowSpacingPx);
60
+ return a.map((l, d) => {
61
+ const u = H(
62
+ l,
54
63
  r,
55
64
  c,
56
- i
57
- ), T = G.replace("{-{-ATTRIBUTE_ROWS-}-}", p);
58
- return d > 0 ? u + T : T;
65
+ o,
66
+ n,
67
+ p
68
+ ), i = W.replace("{-{-ATTRIBUTE_ROWS-}-}", u);
69
+ return d > 0 ? s + i : i;
59
70
  }).join("");
60
71
  }
61
- function M(e, t, n, r = {}, c = {}) {
62
- return v(
72
+ function V(e, r, c, o = {}, n = {}) {
73
+ return x(
63
74
  e,
64
- t,
65
- y,
66
- n,
67
75
  r,
68
- c
76
+ F,
77
+ c,
78
+ o,
79
+ n
69
80
  );
70
81
  }
71
- function Q(e) {
72
- const t = e ? `ins-recommendation-v3-block-${e}` : void 0, n = U("grid", t), r = A(), c = M(r, w);
73
- return n.replace("{-{-TITLE-}-}", g.TITLE).replace("{-{-PRODUCT_ROWS-}-}", c).replace("{-{-MOBILE_PRODUCT_ROWS-}-}", "");
82
+ function y(e) {
83
+ const r = e ? `ins-recommendation-v3-block-${e}` : void 0, c = g("grid", r), o = A(), n = V(o, f);
84
+ return c.replace("{-{-TITLE-}-}", C.TITLE).replace("{-{-PRODUCT_ROWS-}-}", n).replace("{-{-MOBILE_PRODUCT_ROWS-}-}", "");
74
85
  }
75
86
  export {
76
- Q as getDefaultTemplate,
77
- j as prepareGridAttributeRows,
78
- v as prepareGridProductRows,
79
- M as prepareProductRows
87
+ y as getDefaultTemplate,
88
+ H as prepareGridAttributeRows,
89
+ x as prepareGridProductRows,
90
+ V as prepareProductRows
80
91
  };