@useinsider/guido 3.9.0-beta.7791f66 → 3.9.0-beta.f67c6c8

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 (79) hide show
  1. package/dist/@types/config/schemas.js +70 -66
  2. package/dist/components/organisms/email-preview/desktop-preview/DesktopPreview.vue.js +8 -8
  3. package/dist/components/organisms/email-preview/desktop-preview/DesktopPreview.vue2.js +15 -12
  4. package/dist/components/organisms/email-preview/mobile-preview/ContentView.vue.js +5 -5
  5. package/dist/components/organisms/email-preview/mobile-preview/ContentView.vue2.js +16 -15
  6. package/dist/components/organisms/unsubscribe/UnsubscribePageSelection.vue.js +5 -5
  7. package/dist/components/organisms/unsubscribe/UnsubscribePageSelection.vue2.js +42 -37
  8. package/dist/components/organisms/unsubscribe/UnsubscribeTypeSelection.vue.js +3 -3
  9. package/dist/components/organisms/unsubscribe/UnsubscribeTypeSelection.vue2.js +40 -37
  10. package/dist/composables/useHtmlCompiler.js +13 -10
  11. package/dist/composables/usePreviewInteractionGuard.js +17 -0
  12. package/dist/composables/usePreviewMode.js +15 -14
  13. package/dist/composables/useRecommendationPreview.js +111 -0
  14. package/dist/composables/useSave.js +14 -14
  15. package/dist/composables/validators/useUnsubscribeBlockValidator.js +26 -17
  16. package/dist/config/compiler/htmlCompilerRules.js +38 -10
  17. package/dist/config/compiler/recommendationCompilerRules.js +84 -109
  18. package/dist/config/compiler/utils/recommendationCompilerUtils.js +110 -98
  19. package/dist/config/migrator/recommendation/htmlBuilder.js +53 -52
  20. package/dist/config/migrator/recommendation/settingsMapper.js +38 -33
  21. package/dist/enums/html-validator.js +6 -5
  22. package/dist/extensions/Blocks/Items/block.js +48 -29
  23. package/dist/extensions/Blocks/Items/utils/nodeConfigUtils.js +62 -45
  24. package/dist/extensions/Blocks/Recommendation/block.js +64 -42
  25. package/dist/extensions/Blocks/Recommendation/canvasPreview.css.js +16 -0
  26. package/dist/extensions/Blocks/Recommendation/constants/defaultConfig.js +41 -32
  27. package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +461 -363
  28. package/dist/extensions/Blocks/Recommendation/controls/main/index.js +99 -87
  29. package/dist/extensions/Blocks/Recommendation/controls/main/pricePlacement.js +133 -0
  30. package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +160 -158
  31. package/dist/extensions/Blocks/Recommendation/extension.js +30 -29
  32. package/dist/extensions/Blocks/Recommendation/iconsRegistry.js +21 -7
  33. package/dist/extensions/Blocks/Recommendation/recommendation.css.js +64 -4
  34. package/dist/extensions/Blocks/Recommendation/store/recommendation.js +3 -1
  35. package/dist/extensions/Blocks/Recommendation/templates/grid/elementRenderer.js +130 -96
  36. package/dist/extensions/Blocks/Recommendation/templates/grid/template.js +43 -54
  37. package/dist/extensions/Blocks/Recommendation/templates/index.js +17 -14
  38. package/dist/extensions/Blocks/Recommendation/templates/list/elementRenderer.js +86 -80
  39. package/dist/extensions/Blocks/Recommendation/templates/list/template.js +31 -40
  40. package/dist/extensions/Blocks/Recommendation/templates/utils.js +155 -102
  41. package/dist/extensions/Blocks/Unsubscribe/block.js +40 -37
  42. package/dist/extensions/Blocks/Unsubscribe/control.js +19 -16
  43. package/dist/extensions/Blocks/controlFactories.js +76 -57
  44. package/dist/guido.css +1 -1
  45. package/dist/src/@types/config/schemas.d.ts +16 -0
  46. package/dist/src/composables/useConfig.d.ts +4 -0
  47. package/dist/src/composables/usePreviewInteractionGuard.d.ts +3 -0
  48. package/dist/src/composables/useRecommendationPreview.d.ts +10 -0
  49. package/dist/src/composables/validators/useUnsubscribeBlockValidator.d.ts +1 -0
  50. package/dist/src/config/migrator/recommendation/settingsMapper.d.ts +1 -1
  51. package/dist/src/extensions/Blocks/CouponBlock/controls/index.d.ts +1 -1
  52. package/dist/src/extensions/Blocks/Items/block.d.ts +8 -0
  53. package/dist/src/extensions/Blocks/Items/controls/index.d.ts +3 -3
  54. package/dist/src/extensions/Blocks/Items/utils/nodeConfigUtils.d.ts +1 -1
  55. package/dist/src/extensions/Blocks/Recommendation/block.d.ts +10 -0
  56. package/dist/src/extensions/Blocks/Recommendation/controls/cardComposition/index.d.ts +29 -3
  57. package/dist/src/extensions/Blocks/Recommendation/controls/index.d.ts +1 -1
  58. package/dist/src/extensions/Blocks/Recommendation/controls/main/index.d.ts +3 -1
  59. package/dist/src/extensions/Blocks/Recommendation/controls/main/pricePlacement.d.ts +59 -0
  60. package/dist/src/extensions/Blocks/Recommendation/controls/name/index.d.ts +1 -1
  61. package/dist/src/extensions/Blocks/Recommendation/controls/oldPrice/index.d.ts +1 -1
  62. package/dist/src/extensions/Blocks/Recommendation/controls/omnibusDiscount/index.d.ts +1 -1
  63. package/dist/src/extensions/Blocks/Recommendation/controls/omnibusPrice/index.d.ts +1 -1
  64. package/dist/src/extensions/Blocks/Recommendation/controls/price/index.d.ts +1 -1
  65. package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +2 -0
  66. package/dist/src/extensions/Blocks/Recommendation/templates/grid/elementRenderer.d.ts +13 -1
  67. package/dist/src/extensions/Blocks/Recommendation/templates/grid/template.d.ts +4 -4
  68. package/dist/src/extensions/Blocks/Recommendation/templates/index.d.ts +1 -1
  69. package/dist/src/extensions/Blocks/Recommendation/templates/list/elementRenderer.d.ts +10 -1
  70. package/dist/src/extensions/Blocks/Recommendation/templates/list/template.d.ts +3 -3
  71. package/dist/src/extensions/Blocks/Recommendation/templates/utils.d.ts +51 -1
  72. package/dist/src/extensions/Blocks/Recommendation/types/nodeConfig.d.ts +15 -0
  73. package/dist/src/extensions/Blocks/controlFactories.d.ts +10 -1
  74. package/dist/src/stores/config.d.ts +36 -0
  75. package/dist/src/stores/unsubscribe.d.ts +11 -1
  76. package/dist/src/utils/ampErrorFilter.d.ts +1 -0
  77. package/dist/stores/unsubscribe.js +8 -7
  78. package/dist/utils/ampErrorFilter.js +6 -5
  79. package/package.json +1 -1
@@ -1,8 +1,8 @@
1
1
  import r from "../../../static/assets/info.svg.js";
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"] = `
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"] = `
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 t {
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
- `, C["grid-orientation"] = `
47
+ `, t["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
- `, C["list-orientation"] = `
54
+ `, t["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,7 +60,21 @@ class h extends t {
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
- `, C["migration-info-icon"] = r;
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;
64
78
  }
65
79
  }
66
80
  export {
@@ -18,6 +18,13 @@ 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
+
21
28
  /* Right-align the mobile layout toggle within the two-column grid */
22
29
  .product-layout-control-container ue-switcher {
23
30
  justify-self: end;
@@ -143,15 +150,68 @@ ue-orderable.orderable-disabled .droppable-icon {
143
150
  color: var(--guido-color-danger-500);
144
151
  }
145
152
 
146
- /* Disable drag for list layout */
147
- .orderable-list.orderable-disabled .drag-handle {
148
- display: none;
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;
149
158
  }
150
159
 
151
- .orderable-list.orderable-disabled .orderable-item {
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;
172
+ }
173
+
174
+ .price-suborderable-item {
175
+ display: flex;
176
+ align-items: center;
177
+ gap: 4px;
178
+ padding: 8px 0;
179
+ background: var(--guido-color-white);
152
180
  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;
153
200
  }
154
201
 
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
+
155
215
  /* ─── Migration Info Box ─────────────────────────────────────────────── */
156
216
  /* Shown in the settings panel title when a block was migrated from legacy */
157
217
 
@@ -38,7 +38,9 @@ function k() {
38
38
  textTrimming: !0,
39
39
  unresponsive: !1,
40
40
  size: "6",
41
- customAttributes: []
41
+ customAttributes: [],
42
+ priceMovedToNextLine: !0,
43
+ priceHideIfSameAsDiscounted: !1
42
44
  };
43
45
  }
44
46
  function I() {
@@ -1,51 +1,83 @@
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>`;
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>`;
9
15
  }
10
- function u(r, e = "") {
11
- const l = Y(e, r);
16
+ function b(c, e = "") {
17
+ const l = N(e, c);
12
18
  return `<table class="product-card-segment" width="100%" height="100%" cellpadding="0" cellspacing="0" border="0"${l ? ` style="${l}"` : ""}>`;
13
19
  }
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
- });
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
+ `;
31
63
  }
32
64
  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;
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;
36
68
  return `
37
- <td class="${t}" style="padding: ${l}; height: 100%;" valign="top">
38
- ${u(e == null ? void 0 : e.cardBackgroundColor)}
69
+ <td class="${$}" style="padding: ${l}; height: 100%;" valign="top">
70
+ ${b(e == null ? void 0 : e.cardBackgroundColor)}
39
71
  <tbody>
40
72
  <tr valign="top">
41
73
  <td
42
74
  class="esd-block-image product-image"
43
75
  align="center"
44
- esd-extension-block-id="${b.IMAGE}">
45
- <a target="_blank" href="${r.url}" class="${f}">
76
+ esd-extension-block-id="${t.IMAGE}">
77
+ <a target="_blank" href="${c.url}" class="${S}">
46
78
  <img
47
- src="${w(r.image_url)}"
48
- alt="${r.name}"
79
+ src="${j(c.image_url)}"
80
+ alt="${c.name}"
49
81
  style="${a}"
50
82
  class="adapt-img">
51
83
  </a>
@@ -56,21 +88,21 @@ const W = {
56
88
  </td>
57
89
  `;
58
90
  },
59
- [E]: (r, e) => {
60
- const l = (e == null ? void 0 : e.cellPadding) ?? d, a = T(
61
- r.name,
91
+ [L]: (c, e) => {
92
+ const l = (e == null ? void 0 : e.cellPadding) ?? g, a = C(
93
+ c.name,
62
94
  { pStyle: "font-size: 16px; color: #333333;", openTags: "<strong>", closeTags: "</strong>" },
63
95
  e == null ? void 0 : e.styleTemplate
64
96
  );
65
97
  return `
66
- <td class="${t}" style="padding: ${l}; height: 100%;" valign="middle">
67
- ${u(e == null ? void 0 : e.cardBackgroundColor, "table-layout: fixed;")}
98
+ <td class="${$}" style="padding: ${l}; height: 100%;" valign="middle">
99
+ ${b(e == null ? void 0 : e.cardBackgroundColor, "table-layout: fixed;")}
68
100
  <tbody>
69
101
  <tr valign="top">
70
102
  <td
71
103
  class="esd-block-text product-name ${(e == null ? void 0 : e.cellClasses) ?? "es-p10t es-p10b es-p15l es-p15r"}"
72
104
  align="${(e == null ? void 0 : e.cellAlignment) ?? "center"}"
73
- esd-extension-block-id="${b.NAME}"${$(e == null ? void 0 : e.cellBackgroundColor)}>
105
+ esd-extension-block-id="${t.NAME}"${T(e == null ? void 0 : e.cellBackgroundColor)}>
74
106
  ${a}
75
107
  </td>
76
108
  </tr>
@@ -79,21 +111,21 @@ const W = {
79
111
  </td>
80
112
  `;
81
113
  },
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>" },
114
+ [I]: (c, e) => {
115
+ const l = (e == null ? void 0 : e.cellPadding) ?? g, a = C(
116
+ _(c, "price"),
117
+ B,
86
118
  e == null ? void 0 : e.styleTemplate
87
119
  );
88
120
  return `
89
- <td class="${t}" style="padding: ${l}; height: 100%;" valign="top">
90
- ${u(e == null ? void 0 : e.cardBackgroundColor)}
121
+ <td class="${$}" style="padding: ${l}; height: 100%;" valign="top">
122
+ ${b(e == null ? void 0 : e.cardBackgroundColor)}
91
123
  <tbody>
92
124
  <tr valign="top">
93
125
  <td
94
126
  class="esd-block-text product-price ${(e == null ? void 0 : e.cellClasses) ?? "es-p15l es-p15r"}"
95
127
  align="${(e == null ? void 0 : e.cellAlignment) ?? "center"}"
96
- esd-extension-block-id="${b.PRICE}"${$(e == null ? void 0 : e.cellBackgroundColor)}>
128
+ esd-extension-block-id="${t.PRICE}"${T(e == null ? void 0 : e.cellBackgroundColor)}>
97
129
  ${a}
98
130
  </td>
99
131
  </tr>
@@ -102,21 +134,22 @@ const W = {
102
134
  </td>
103
135
  `;
104
136
  },
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>" },
137
+ [n]: (c, e) => {
138
+ const l = (e == null ? void 0 : e.cellPadding) ?? g, a = C(
139
+ _(c, "original_price"),
140
+ f,
109
141
  e == null ? void 0 : e.styleTemplate
110
142
  );
111
143
  return `
112
- <td class="${t}" style="padding: ${l}; height: 100%;" valign="top">
113
- ${u(e == null ? void 0 : e.cardBackgroundColor)}
144
+ <td class="${$}" style="padding: ${l}; height: 100%;" valign="top">
145
+ ${b(e == null ? void 0 : e.cardBackgroundColor)}
114
146
  <tbody>
115
147
  <tr valign="top">
116
148
  <td
117
149
  class="esd-block-text product-old-price ${(e == null ? void 0 : e.cellClasses) ?? "es-p15l es-p15r"}"
118
150
  align="${(e == null ? void 0 : e.cellAlignment) ?? "center"}"
119
- esd-extension-block-id="${b.OLD_PRICE}"${$(e == null ? void 0 : e.cellBackgroundColor)}>
151
+ data-same-price="${w(c)}"
152
+ esd-extension-block-id="${t.OLD_PRICE}"${T(e == null ? void 0 : e.cellBackgroundColor)}>
120
153
  ${a}
121
154
  </td>
122
155
  </tr>
@@ -125,23 +158,23 @@ const W = {
125
158
  </td>
126
159
  `;
127
160
  },
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: ");
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: ");
130
163
  return `
131
- <td class="${t}" style="padding: ${l}; height: 100%;" valign="top">
132
- ${u(e == null ? void 0 : e.cardBackgroundColor)}
164
+ <td class="${$}" style="padding: ${l}; height: 100%;" valign="top">
165
+ ${b(e == null ? void 0 : e.cardBackgroundColor)}
133
166
  <tbody>
134
167
  <tr valign="top">
135
168
  <td
136
169
  class="esd-block-text product-omnibus-price ${(e == null ? void 0 : e.cellClasses) ?? "es-p15l es-p15r"}"
137
170
  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)}>
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)}>
141
174
  <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>
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>
145
178
  </p>
146
179
  </td>
147
180
  </tr>
@@ -150,24 +183,24 @@ const W = {
150
183
  </td>
151
184
  `;
152
185
  },
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);
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);
156
189
  return `
157
- <td class="${t}" style="padding: ${l}; height: 100%;" valign="top">
158
- ${u(e == null ? void 0 : e.cardBackgroundColor)}
190
+ <td class="${$}" style="padding: ${l}; height: 100%;" valign="top">
191
+ ${b(e == null ? void 0 : e.cardBackgroundColor)}
159
192
  <tbody>
160
193
  <tr valign="top">
161
194
  <td
162
195
  class="esd-block-text product-omnibus-discount ${(e == null ? void 0 : e.cellClasses) ?? "es-p15l es-p15r"}"
163
196
  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)}>
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)}>
167
200
  <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>
201
+ <span class="omnibus-text-before">${m}</span>
202
+ <span class="omnibus-discount-value">${x}</span>
203
+ <span class="omnibus-text-after">${k}</span>
171
204
  </p>
172
205
  </td>
173
206
  </tr>
@@ -176,24 +209,24 @@ const W = {
176
209
  </td>
177
210
  `;
178
211
  },
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);
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);
181
214
  return `
182
- <td class="${t}" style="padding: ${l}; height: 100%;" valign="top">
183
- ${u(e == null ? void 0 : e.cardBackgroundColor)}
215
+ <td class="${$}" style="padding: ${l}; height: 100%;" valign="top">
216
+ ${b(e == null ? void 0 : e.cardBackgroundColor)}
184
217
  <tbody>
185
218
  <tr valign="top">
186
219
  <td
187
220
  class="esd-block-button product-button ${(e == null ? void 0 : e.cellClasses) ?? "es-p10t es-p10b"}"
188
221
  align="${(e == null ? void 0 : e.cellAlignment) ?? "center"}"
189
- esd-extension-block-id="${b.BUTTON}">
190
- <span class="${G(a)}" style="${c}">
222
+ esd-extension-block-id="${t.BUTTON}">
223
+ <span class="${H(a)}" style="${d}">
191
224
  <a
192
225
  href="#"
193
- class="es-button ${f}"
226
+ class="es-button ${S}"
194
227
  target="_blank"
195
- style="${g}">
196
- ${y}
228
+ style="${r}">
229
+ ${u}
197
230
  </a>
198
231
  </span>
199
232
  </td>
@@ -210,23 +243,23 @@ const W = {
210
243
  * @param productAttrValue - Resolved product-attr value (e.g., "brand" for default, "product_attribute.rating_star" for custom)
211
244
  * @param content - Display content for the cell
212
245
  */
213
- [N]: (r, e, l) => {
214
- const a = (l == null ? void 0 : l.cellPadding) ?? d, c = T(
246
+ [M]: (c, e, l) => {
247
+ const a = (l == null ? void 0 : l.cellPadding) ?? g, d = C(
215
248
  e,
216
249
  { pStyle: "font-size: 12px; color: #666666;", openTags: "", closeTags: "" },
217
250
  l == null ? void 0 : l.styleTemplate
218
251
  );
219
252
  return `
220
- <td class="${t}" style="padding: ${a}; height: 100%;" valign="middle">
221
- ${u(l == null ? void 0 : l.cardBackgroundColor, "table-layout: fixed;")}
253
+ <td class="${$}" style="padding: ${a}; height: 100%;" valign="middle">
254
+ ${b(l == null ? void 0 : l.cardBackgroundColor, "table-layout: fixed;")}
222
255
  <tbody>
223
256
  <tr valign="top">
224
257
  <td
225
- ${k}="${r}"
258
+ ${h}="${c}"
226
259
  class="esd-block-text product-custom-attribute ${(l == null ? void 0 : l.cellClasses) ?? "es-p0t es-p0b es-p15l es-p15r"}"
227
260
  align="${(l == null ? void 0 : l.cellAlignment) ?? "center"}"
228
- esd-extension-block-id="${b.CUSTOM_ATTRIBUTE}"${$(l == null ? void 0 : l.cellBackgroundColor)}>
229
- ${c}
261
+ esd-extension-block-id="${t.CUSTOM_ATTRIBUTE}"${T(l == null ? void 0 : l.cellBackgroundColor)}>
262
+ ${d}
230
263
  </td>
231
264
  </tr>
232
265
  </tbody>
@@ -236,8 +269,9 @@ const W = {
236
269
  }
237
270
  };
238
271
  export {
239
- t as ATTRIBUTE_CELL_CLASS,
240
- d as DEFAULT_CELL_PADDING,
272
+ $ as ATTRIBUTE_CELL_CLASS,
273
+ g as DEFAULT_CELL_PADDING,
241
274
  Q as buildFillerCell,
242
- W as gridElementRenderer
275
+ W as gridElementRenderer,
276
+ V as renderInlineGridPriceCell
243
277
  };
@@ -1,8 +1,8 @@
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 = `
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 = `
6
6
  <tr class="recommendation-product-row">
7
7
  <td>
8
8
  <table
@@ -19,7 +19,7 @@ const W = `
19
19
  </table>
20
20
  </td>
21
21
  </tr>
22
- `, k = `
22
+ `, V = `
23
23
  <tr
24
24
  class="recommendation-attribute-row"
25
25
  data-attribute-type="{-{-ATTR_TYPE-}-}"
@@ -28,64 +28,53 @@ const W = `
28
28
  {-{-CELLS-}-}
29
29
  </tr>
30
30
  `;
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);
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);
53
42
  }).join("");
54
43
  }
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,
63
- r,
64
- c,
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(
65
51
  o,
52
+ t,
66
53
  n,
67
- p
68
- ), i = W.replace("{-{-ATTRIBUTE_ROWS-}-}", u);
69
- return d > 0 ? s + i : i;
54
+ r,
55
+ c,
56
+ i
57
+ ), T = G.replace("{-{-ATTRIBUTE_ROWS-}-}", p);
58
+ return d > 0 ? u + T : T;
70
59
  }).join("");
71
60
  }
72
- function V(e, r, c, o = {}, n = {}) {
73
- return x(
61
+ function M(e, t, n, r = {}, c = {}) {
62
+ return v(
74
63
  e,
64
+ t,
65
+ y,
66
+ n,
75
67
  r,
76
- F,
77
- c,
78
- o,
79
- n
68
+ c
80
69
  );
81
70
  }
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-}-}", "");
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-}-}", "");
85
74
  }
86
75
  export {
87
- y as getDefaultTemplate,
88
- H as prepareGridAttributeRows,
89
- x as prepareGridProductRows,
90
- V as prepareProductRows
76
+ Q as getDefaultTemplate,
77
+ j as prepareGridAttributeRows,
78
+ v as prepareGridProductRows,
79
+ M as prepareProductRows
91
80
  };