@useinsider/guido 3.7.2-beta.13c9a35 → 3.7.2-beta.6f556cb

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 (42) hide show
  1. package/dist/@types/config/schemas.js +66 -70
  2. package/dist/components/organisms/unsubscribe/UnsubscribeTypeSelection.vue.js +3 -3
  3. package/dist/components/organisms/unsubscribe/UnsubscribeTypeSelection.vue2.js +47 -45
  4. package/dist/composables/usePreviewMode.js +14 -15
  5. package/dist/config/compiler/utils/recommendationCompilerUtils.js +82 -90
  6. package/dist/config/migrator/recommendation/htmlBuilder.js +58 -59
  7. package/dist/config/migrator/recommendation/settingsMapper.js +33 -38
  8. package/dist/extensions/Blocks/Recommendation/block.js +41 -60
  9. package/dist/extensions/Blocks/Recommendation/constants/defaultConfig.js +32 -41
  10. package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +288 -369
  11. package/dist/extensions/Blocks/Recommendation/controls/main/index.js +84 -96
  12. package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +80 -82
  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 +5 -7
  16. package/dist/extensions/Blocks/Recommendation/templates/grid/elementRenderer.js +72 -101
  17. package/dist/extensions/Blocks/Recommendation/templates/grid/template.js +30 -31
  18. package/dist/extensions/Blocks/Recommendation/templates/index.js +7 -9
  19. package/dist/extensions/Blocks/Recommendation/templates/list/elementRenderer.js +59 -74
  20. package/dist/extensions/Blocks/Recommendation/templates/list/template.js +21 -21
  21. package/dist/extensions/Blocks/Recommendation/templates/utils.js +57 -88
  22. package/dist/guido.css +1 -1
  23. package/dist/src/@types/config/schemas.d.ts +0 -16
  24. package/dist/src/composables/useConfig.d.ts +0 -4
  25. package/dist/src/config/migrator/recommendation/settingsMapper.d.ts +1 -1
  26. package/dist/src/extensions/Blocks/Recommendation/block.d.ts +0 -10
  27. package/dist/src/extensions/Blocks/Recommendation/controls/cardComposition/index.d.ts +3 -29
  28. package/dist/src/extensions/Blocks/Recommendation/controls/index.d.ts +1 -1
  29. package/dist/src/extensions/Blocks/Recommendation/controls/main/index.d.ts +1 -3
  30. package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +0 -2
  31. package/dist/src/extensions/Blocks/Recommendation/templates/grid/elementRenderer.d.ts +0 -16
  32. package/dist/src/extensions/Blocks/Recommendation/templates/grid/template.d.ts +4 -4
  33. package/dist/src/extensions/Blocks/Recommendation/templates/list/elementRenderer.d.ts +0 -13
  34. package/dist/src/extensions/Blocks/Recommendation/templates/list/template.d.ts +2 -3
  35. package/dist/src/extensions/Blocks/Recommendation/templates/utils.d.ts +1 -33
  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 -100
  40. package/dist/extensions/Blocks/Recommendation/controls/main/pricePlacement.js +0 -133
  41. package/dist/src/composables/useRecommendationPreview.d.ts +0 -10
  42. package/dist/src/extensions/Blocks/Recommendation/controls/main/pricePlacement.d.ts +0 -59
@@ -1,85 +1,33 @@
1
1
  import { RecommendationBlockId as l } from "../../constants/blockIds.js";
2
- import { ATTR_PRODUCT_ATTR as b, CSS_CLASS_RECO_BUTTON as g, ATTR_PRODUCT_BUTTON as u, ATTR_PRODUCT_OMNIBUS_DISCOUNT as h, ATTR_PRODUCT_OMNIBUS_PRICE as y, ATTR_PRODUCT_OLD_PRICE as $, ATTR_PRODUCT_PRICE as m, ATTR_PRODUCT_NAME as T, ATTR_PRODUCT_IMAGE as x } from "../../constants/selectors.js";
3
- import { formatProductPrice as i, CUSTOM_CELL_HTML as f, getCurrentCurrencyConfig as _, sanitizeImageUrl as C } from "../utils.js";
4
- const s = "0 5px", d = "attribute-cell";
5
- function O(t, e = s) {
6
- return `<td class="${d}" style="padding: ${e};" width="${t}%"></td>`;
2
+ import { ATTR_PRODUCT_ATTR as u, CSS_CLASS_RECO_BUTTON as p, ATTR_PRODUCT_BUTTON as m, ATTR_PRODUCT_OMNIBUS_DISCOUNT as h, ATTR_PRODUCT_OMNIBUS_PRICE as y, ATTR_PRODUCT_OLD_PRICE as T, ATTR_PRODUCT_PRICE as f, ATTR_PRODUCT_NAME as $, ATTR_PRODUCT_IMAGE as _ } from "../../constants/selectors.js";
3
+ import { useRecommendationExtensionStore as x } from "../../store/recommendation.js";
4
+ import { formatPrice as C } from "../../utils/priceFormatter.js";
5
+ import { CUSTOM_CELL_HTML as R, sanitizeImageUrl as O } from "../utils.js";
6
+ const s = "0 5px", a = "attribute-cell";
7
+ function S(t, e = s) {
8
+ return `<td class="${a}" style="padding: ${e};" width="${t}%"></td>`;
7
9
  }
8
- function U(t, e = !0) {
9
- const a = `<s><strong>${i(t, "original_price")}</strong></s>`, r = (n) => `<td
10
- class="esd-block-text product-price ${n}"
11
- align="center"
12
- valign="middle"
13
- esd-extension-block-id="${l.PRICE}">
14
- <p contenteditable="false" style="font-size: 16px; color: #333333;">
15
- <strong>${i(t, "price")}</strong>
16
- </p>
17
- </td>`, o = (n) => `<td
18
- class="esd-block-text product-old-price ${n}"
19
- align="center"
20
- valign="middle"
21
- esd-extension-block-id="${l.OLD_PRICE}">
22
- <p contenteditable="false" style="font-size: 14px; color: #999999;">
23
- ${a}
24
- </p>
25
- </td>`, p = e ? o("es-p15l es-p5r") : r("es-p15l es-p5r"), c = e ? r("es-p5l es-p15r") : o("es-p5l es-p15r");
26
- return `
27
- <td class="${d}" style="padding: ${s}; height: 100%;" valign="top">
28
- <table
29
- class="product-card-segment"
30
- width="100%"
31
- height="100%"
32
- cellpadding="0"
33
- cellspacing="0"
34
- border="0">
35
- <tbody>
36
- <tr valign="top">
37
- <td align="center">
38
- <table cellpadding="0" cellspacing="0" border="0" align="center" style="margin: 0 auto;">
39
- <tbody>
40
- <tr valign="middle">
41
- ${p}
42
- ${c}
43
- </tr>
44
- </tbody>
45
- </table>
46
- </td>
47
- </tr>
48
- </tbody>
49
- </table>
50
- </td>
51
- `;
10
+ function g() {
11
+ const t = x(), { currencySettings: e } = t.recommendationConfigs;
12
+ return {
13
+ code: e.value,
14
+ symbol: e.symbol,
15
+ alignment: e.alignment === "0" ? "before" : "after",
16
+ decimalCount: parseInt(e.decimalCount) || 2,
17
+ decimalSeparator: e.decimalSeparator,
18
+ thousandSeparator: e.thousandSeparator
19
+ };
52
20
  }
53
- function R(t) {
54
- const e = `<s><strong>${i(t, "original_price")}</strong></s>`;
55
- return `
56
- <td class="${d}" style="padding: ${s}; height: 100%;" valign="top">
57
- <table
58
- class="product-card-segment"
59
- width="100%"
60
- height="100%"
61
- cellpadding="0"
62
- cellspacing="0"
63
- border="0">
64
- <tbody>
65
- <tr valign="top">
66
- <td
67
- class="esd-block-text product-old-price es-p15l es-p15r"
68
- align="center"
69
- esd-extension-block-id="${l.OLD_PRICE}">
70
- <p contenteditable="false" style="font-size: 14px; color: #999999;">
71
- ${e}
72
- </p>
73
- </td>
74
- </tr>
75
- </tbody>
76
- </table>
77
- </td>
78
- `;
21
+ function i(t, e = "price") {
22
+ const o = g(), n = t[e], d = (n == null ? void 0 : n[o.code]) ?? Object.values(n ?? {})[0] ?? 0;
23
+ return C({
24
+ price: d,
25
+ currency: o
26
+ });
79
27
  }
80
- const I = {
81
- [x]: (t) => `
82
- <td class="${d}" style="padding: ${s}; height: 100%;" valign="top">
28
+ const A = {
29
+ [_]: (t) => `
30
+ <td class="${a}" style="padding: ${s}; height: 100%;" valign="top">
83
31
  <table
84
32
  class="product-card-segment"
85
33
  width="100%"
@@ -93,9 +41,9 @@ const I = {
93
41
  class="esd-block-image product-image"
94
42
  align="center"
95
43
  esd-extension-block-id="${l.IMAGE}">
96
- <a target="_blank" href="${t.url}" class="${g}">
44
+ <a target="_blank" href="${t.url}" class="${p}">
97
45
  <img
98
- src="${C(t.image_url)}"
46
+ src="${O(t.image_url)}"
99
47
  alt="${t.name}"
100
48
  style="display: block; max-width: 100%; height: auto;"
101
49
  class="adapt-img">
@@ -106,8 +54,8 @@ const I = {
106
54
  </table>
107
55
  </td>
108
56
  `,
109
- [T]: (t) => `
110
- <td class="${d}" style="padding: ${s}; height: 100%;" valign="middle">
57
+ [$]: (t) => `
58
+ <td class="${a}" style="padding: ${s}; height: 100%;" valign="middle">
111
59
  <table
112
60
  class="product-card-segment"
113
61
  width="100%"
@@ -131,8 +79,8 @@ const I = {
131
79
  </table>
132
80
  </td>
133
81
  `,
134
- [m]: (t) => `
135
- <td class="${d}" style="padding: ${s}; height: 100%;" valign="top">
82
+ [f]: (t) => `
83
+ <td class="${a}" style="padding: ${s}; height: 100%;" valign="top">
136
84
  <table
137
85
  class="product-card-segment"
138
86
  width="100%"
@@ -155,9 +103,34 @@ const I = {
155
103
  </table>
156
104
  </td>
157
105
  `,
158
- [$]: (t) => R(t),
106
+ [T]: (t) => `
107
+ <td class="${a}" style="padding: ${s}; height: 100%;" valign="top">
108
+ <table
109
+ class="product-card-segment"
110
+ width="100%"
111
+ height="100%"
112
+ cellpadding="0"
113
+ cellspacing="0"
114
+ border="0">
115
+ <tbody>
116
+ <tr valign="top">
117
+ <td
118
+ class="esd-block-text product-old-price es-p15l es-p15r"
119
+ align="center"
120
+ esd-extension-block-id="${l.OLD_PRICE}">
121
+ <p
122
+ contenteditable="false"
123
+ style="font-size: 14px; color: #999999;">
124
+ <s><strong>${i(t, "original_price")}</strong></s>
125
+ </p>
126
+ </td>
127
+ </tr>
128
+ </tbody>
129
+ </table>
130
+ </td>
131
+ `,
159
132
  [y]: (t) => `
160
- <td class="${d}" style="padding: ${s}; height: 100%;" valign="top">
133
+ <td class="${a}" style="padding: ${s}; height: 100%;" valign="top">
161
134
  <table
162
135
  class="product-card-segment"
163
136
  width="100%"
@@ -185,10 +158,10 @@ const I = {
185
158
  </td>
186
159
  `,
187
160
  [h]: (t) => {
188
- var c, n;
189
- const e = _(), a = ((c = t.original_price) == null ? void 0 : c[e.code]) ?? Object.values(t.original_price ?? {})[0] ?? 0, r = ((n = t.price) == null ? void 0 : n[e.code]) ?? Object.values(t.price ?? {})[0] ?? 0, o = a > 0 ? Math.round((a - r) / a * 100) : 0, p = o > 0 ? `-${o}%` : "0%";
161
+ var r, c;
162
+ const e = g(), o = ((r = t.original_price) == null ? void 0 : r[e.code]) ?? Object.values(t.original_price ?? {})[0] ?? 0, n = ((c = t.price) == null ? void 0 : c[e.code]) ?? Object.values(t.price ?? {})[0] ?? 0, d = o > 0 ? Math.round((o - n) / o * 100) : 0, b = d > 0 ? `-${d}%` : "0%";
190
163
  return `
191
- <td class="${d}" style="padding: ${s}; height: 100%;" valign="top">
164
+ <td class="${a}" style="padding: ${s}; height: 100%;" valign="top">
192
165
  <table
193
166
  class="product-card-segment"
194
167
  width="100%"
@@ -206,7 +179,7 @@ const I = {
206
179
  esd-extension-block-id="${l.OMNIBUS_DISCOUNT}">
207
180
  <p contenteditable="false" style="font-size: 12px; color: #666666;">
208
181
  <span class="omnibus-text-before"></span>
209
- <span class="omnibus-discount-value">${p}</span>
182
+ <span class="omnibus-discount-value">${b}</span>
210
183
  <span class="omnibus-text-after"></span>
211
184
  </p>
212
185
  </td>
@@ -216,8 +189,8 @@ const I = {
216
189
  </td>
217
190
  `;
218
191
  },
219
- [u]: () => `
220
- <td class="${d}" style="padding: ${s}; height: 100%;" valign="top">
192
+ [m]: () => `
193
+ <td class="${a}" style="padding: ${s}; height: 100%;" valign="top">
221
194
  <table
222
195
  class="product-card-segment"
223
196
  width="100%"
@@ -240,7 +213,7 @@ const I = {
240
213
  ">
241
214
  <a
242
215
  href="#"
243
- class="es-button ${g}"
216
+ class="es-button ${p}"
244
217
  target="_blank"
245
218
  style="
246
219
  color: rgb(56, 118, 29);
@@ -268,8 +241,8 @@ const I = {
268
241
  * @param productAttrValue - Resolved product-attr value (e.g., "brand" for default, "product_attribute.rating_star" for custom)
269
242
  * @param content - Display content for the cell
270
243
  */
271
- [f]: (t, e) => `
272
- <td class="${d}" style="padding: ${s}; height: 100%;" valign="middle">
244
+ [R]: (t, e) => `
245
+ <td class="${a}" style="padding: ${s}; height: 100%;" valign="middle">
273
246
  <table
274
247
  class="product-card-segment"
275
248
  width="100%"
@@ -281,7 +254,7 @@ const I = {
281
254
  <tbody>
282
255
  <tr valign="top">
283
256
  <td
284
- ${b}="${t}"
257
+ ${u}="${t}"
285
258
  class="esd-block-text product-custom-attribute es-p0t es-p0b es-p15l es-p15r"
286
259
  align="center"
287
260
  esd-extension-block-id="${l.CUSTOM_ATTRIBUTE}">
@@ -294,10 +267,8 @@ const I = {
294
267
  `
295
268
  };
296
269
  export {
297
- d as ATTRIBUTE_CELL_CLASS,
270
+ a as ATTRIBUTE_CELL_CLASS,
298
271
  s as DEFAULT_CELL_PADDING,
299
- O as buildFillerCell,
300
- I as gridElementRenderer,
301
- R as renderGridOldPriceCell,
302
- U as renderInlineGridPriceCell
272
+ S as buildFillerCell,
273
+ A as gridElementRenderer
303
274
  };
@@ -1,7 +1,7 @@
1
- import { DEFAULT_PRODUCTS_PER_ROW as E } from "../../constants/layout.js";
2
- import { getDefaultProducts as L, DEFAULTS as S, createBlockTemplate as _, DEFAULT_CARD_COMPOSITION as w, spacer as C, buildElementRenderer as O, resolveInlinePriceOrder as A, DEFAULT_CARD_VISIBILITY as D } from "../utils.js";
3
- import { renderInlineGridPriceCell as P, buildFillerCell as g, gridElementRenderer as h } from "./elementRenderer.js";
4
- const U = `
1
+ import { DEFAULT_PRODUCTS_PER_ROW as m } from "../../constants/layout.js";
2
+ import { getDefaultProducts as I, DEFAULTS as b, createBlockTemplate as E, DEFAULT_CARD_COMPOSITION as L, spacer as S, buildElementRenderer as _, DEFAULT_CARD_VISIBILITY as f } from "../utils.js";
3
+ import { buildFillerCell as w, gridElementRenderer as A } from "./elementRenderer.js";
4
+ const D = `
5
5
  <tr class="recommendation-product-row">
6
6
  <td>
7
7
  <table
@@ -18,7 +18,7 @@ const U = `
18
18
  </table>
19
19
  </td>
20
20
  </tr>
21
- `, Y = `
21
+ `, C = `
22
22
  <tr
23
23
  class="recommendation-attribute-row"
24
24
  data-attribute-type="{-{-ATTR_TYPE-}-}"
@@ -27,39 +27,38 @@ const U = `
27
27
  {-{-CELLS-}-}
28
28
  </tr>
29
29
  `;
30
- function y(e, t, o, r = w, i = {}, p = {}) {
31
- const { priceInline: s = !1 } = p, u = (100 / t).toFixed(2), n = t - e.length, T = n > 0 ? g(u).repeat(n) : "", d = O(o, r, i), c = A(r), R = s ? r.filter((l) => l !== c.skip) : r, I = (l, a) => s && l === c.anchor ? P(a, c.originalFirst) : d[l](a);
32
- return R.filter((l) => d[l]).map((l) => {
33
- const a = D[l] ?? !0, m = a ? "" : 'style="display: none;"', b = e.map((f) => I(l, f).replace("<td", `<td width="${u}%"`)).join("");
34
- return Y.replace("{-{-ATTR_TYPE-}-}", l).replace("{-{-VISIBILITY-}-}", a ? "1" : "0").replace("{-{-DISPLAY_STYLE-}-}", m).replace("{-{-CELLS-}-}", b + T);
30
+ function O(t, e, n, r = L, c = {}) {
31
+ const a = (100 / e).toFixed(2), s = e - t.length, l = s > 0 ? w(a).repeat(s) : "", i = _(n, r, c);
32
+ return r.filter((o) => i[o]).map((o) => {
33
+ const p = f[o] ?? !0, u = p ? "" : 'style="display: none;"', T = t.map((R) => i[o](R).replace("<td", `<td width="${a}%"`)).join("");
34
+ return C.replace("{-{-ATTR_TYPE-}-}", o).replace("{-{-VISIBILITY-}-}", p ? "1" : "0").replace("{-{-DISPLAY_STYLE-}-}", u).replace("{-{-CELLS-}-}", T + l);
35
35
  }).join("");
36
36
  }
37
- function B(e, t, o, r, i = {}, p = {}) {
38
- const s = [];
39
- for (let n = 0; n < e.length; n += t)
40
- s.push(e.slice(n, n + t));
41
- return s.map((n, T) => {
42
- const d = y(
37
+ function g(t, e, n, r, c = {}) {
38
+ const a = [];
39
+ for (let l = 0; l < t.length; l += e)
40
+ a.push(t.slice(l, l + e));
41
+ return a.map((l, i) => {
42
+ const d = O(
43
+ l,
44
+ e,
43
45
  n,
44
- t,
45
- o,
46
46
  r,
47
- i,
48
- p
49
- ), c = U.replace("{-{-ATTRIBUTE_ROWS-}-}", d);
50
- return T > 0 ? C + c : c;
47
+ c
48
+ ), o = D.replace("{-{-ATTRIBUTE_ROWS-}-}", d);
49
+ return i > 0 ? S + o : o;
51
50
  }).join("");
52
51
  }
53
- function F(e, t, o, r = {}, i = {}) {
54
- return B(e, t, h, o, r, i);
52
+ function P(t, e, n, r = {}) {
53
+ return g(t, e, A, n, r);
55
54
  }
56
- function j(e) {
57
- const t = e ? `ins-recommendation-v3-block-${e}` : void 0, o = _("grid", t), r = L(), i = F(r, E);
58
- return o.replace("{-{-TITLE-}-}", S.TITLE).replace("{-{-PRODUCT_ROWS-}-}", i).replace("{-{-MOBILE_PRODUCT_ROWS-}-}", "");
55
+ function B(t) {
56
+ const e = t ? `ins-recommendation-v3-block-${t}` : void 0, n = E("grid", e), r = I(), c = P(r, m);
57
+ return n.replace("{-{-TITLE-}-}", b.TITLE).replace("{-{-PRODUCT_ROWS-}-}", c).replace("{-{-MOBILE_PRODUCT_ROWS-}-}", "");
59
58
  }
60
59
  export {
61
- j as getDefaultTemplate,
62
- y as prepareGridAttributeRows,
63
- B as prepareGridProductRows,
64
- F as prepareProductRows
60
+ B as getDefaultTemplate,
61
+ O as prepareGridAttributeRows,
62
+ g as prepareGridProductRows,
63
+ P as prepareProductRows
65
64
  };
@@ -1,14 +1,12 @@
1
1
  import { DEFAULT_PRODUCTS_PER_ROW as s } from "../constants/layout.js";
2
- import { prepareProductRows as m } from "./grid/template.js";
3
- import { prepareProductRows as n } from "./list/template.js";
4
- import "../store/recommendation.js";
5
- function P(o, t, r = {}) {
6
- const e = { priceInline: r.priceInline };
2
+ import { prepareProductRows as c } from "./grid/template.js";
3
+ import { prepareProductRows as R } from "./list/template.js";
4
+ function a(o, t, r = {}) {
7
5
  if (t === "list")
8
- return n(o, r.composition, r.filterList, e);
9
- const { productsPerRow: i = s, composition: p, filterList: c } = r;
10
- return m(o, i, p, c, e);
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);
11
9
  }
12
10
  export {
13
- P as prepareProductRows
11
+ a as prepareProductRows
14
12
  };
@@ -1,69 +1,43 @@
1
- import { RecommendationBlockId as e } from "../../constants/blockIds.js";
2
- import { ATTR_PRODUCT_ATTR as g, ATTR_PRODUCT_BUTTON as d, CSS_CLASS_RECO_BUTTON as p, ATTR_PRODUCT_IMAGE as b, ATTR_PRODUCT_OMNIBUS_DISCOUNT as u, ATTR_PRODUCT_OMNIBUS_PRICE as f, ATTR_PRODUCT_OLD_PRICE as m, ATTR_PRODUCT_PRICE as x, ATTR_PRODUCT_NAME as T } from "../../constants/selectors.js";
3
- import { formatProductPrice as r, CUSTOM_CELL_HTML as _, getCurrentCurrencyConfig as $, sanitizeImageUrl as C } from "../utils.js";
4
- function R(t) {
5
- const o = `<s><strong>${r(t, "original_price")}</strong></s>`;
6
- return `
7
- <tr>
8
- <td
9
- class="esd-block-text product-old-price"
10
- esd-extension-block-id="${e.OLD_PRICE}"
11
- align="left">
12
- <p
13
- contenteditable="false"
14
- style="font-size: 14px; color: #999999; margin: 0;">
15
- ${o}
16
- </p>
17
- </td>
18
- </tr>
19
- `;
1
+ import { RecommendationBlockId as o } from "../../constants/blockIds.js";
2
+ import { ATTR_PRODUCT_ATTR as u, ATTR_PRODUCT_BUTTON as c, CSS_CLASS_RECO_BUTTON as d, ATTR_PRODUCT_IMAGE as p, ATTR_PRODUCT_OMNIBUS_DISCOUNT as g, ATTR_PRODUCT_OMNIBUS_PRICE as f, ATTR_PRODUCT_OLD_PRICE as T, ATTR_PRODUCT_PRICE as x, ATTR_PRODUCT_NAME as _ } from "../../constants/selectors.js";
3
+ import { useRecommendationExtensionStore as C } from "../../store/recommendation.js";
4
+ import { formatPrice as R } from "../../utils/priceFormatter.js";
5
+ import { CUSTOM_CELL_HTML as O, sanitizeImageUrl as $ } from "../utils.js";
6
+ function b() {
7
+ const t = C(), { currencySettings: e } = t.recommendationConfigs;
8
+ return {
9
+ code: e.value,
10
+ symbol: e.symbol,
11
+ alignment: e.alignment === "0" ? "before" : "after",
12
+ decimalCount: parseInt(e.decimalCount) || 2,
13
+ decimalSeparator: e.decimalSeparator,
14
+ thousandSeparator: e.thousandSeparator
15
+ };
20
16
  }
21
- function y(t, o = !0) {
22
- const n = `<s><strong>${r(t, "original_price")}</strong></s>`, l = (s) => `<td
23
- class="esd-block-text product-price"
24
- esd-extension-block-id="${e.PRICE}"
25
- align="left"
26
- valign="middle"
27
- style="width: auto;${s}">
28
- <p contenteditable="false" style="font-size: 16px; color: #333333; font-weight: bold; margin: 0;">
29
- <strong>${r(t, "price")}</strong>
30
- </p>
31
- </td>`, i = (s) => `<td
32
- class="esd-block-text product-old-price"
33
- esd-extension-block-id="${e.OLD_PRICE}"
34
- align="left"
35
- valign="middle"
36
- style="width: auto;${s}">
37
- <p
38
- contenteditable="false"
39
- style="font-size: 14px; color: #999999; margin: 0;">
40
- ${n}
41
- </p>
42
- </td>`, c = o ? i(" padding-right: 8px;") : l(" padding-right: 8px;"), a = o ? l("") : i("");
43
- return `
44
- <tr>
45
- ${c}
46
- ${a}
47
- </tr>
48
- `;
17
+ function r(t, e = "price") {
18
+ const n = b(), s = t[e], a = (s == null ? void 0 : s[n.code]) ?? Object.values(s ?? {})[0] ?? 0;
19
+ return R({
20
+ price: a,
21
+ currency: n
22
+ });
49
23
  }
50
- const h = {
24
+ const I = {
51
25
  /**
52
26
  * Image cell - left column (120px fixed width)
53
27
  * Has recommendation-attribute-row class and data attributes for Card Composition control
54
28
  */
55
- [b]: (t) => `
29
+ [p]: (t) => `
56
30
  <td
57
31
  width="120"
58
32
  class="esd-block-image product-image-cell recommendation-attribute-row es-p5"
59
- esd-extension-block-id="${e.IMAGE}"
60
- data-attribute-type="${b}"
33
+ esd-extension-block-id="${o.IMAGE}"
34
+ data-attribute-type="${p}"
61
35
  data-visibility="1"
62
36
  align="center"
63
37
  valign="middle">
64
- <a target="_blank" href="${t.url}" class="${p}">
38
+ <a target="_blank" href="${t.url}" class="${d}">
65
39
  <img
66
- src="${C(t.image_url)}"
40
+ src="${$(t.image_url)}"
67
41
  alt="${t.name}"
68
42
  style="display: block; max-width: 100%; height: auto;"
69
43
  class="adapt-img product-image">
@@ -73,11 +47,11 @@ const h = {
73
47
  /**
74
48
  * Name element - row for info cell table
75
49
  */
76
- [T]: (t) => `
50
+ [_]: (t) => `
77
51
  <tr>
78
52
  <td
79
53
  class="esd-block-text product-name"
80
- esd-extension-block-id="${e.NAME}"
54
+ esd-extension-block-id="${o.NAME}"
81
55
  align="left">
82
56
  <p contenteditable="false" style="font-size: 16px; color: #333333; font-weight: 600; margin: 0;">
83
57
  <strong>${t.name}</strong>
@@ -92,7 +66,7 @@ const h = {
92
66
  <tr>
93
67
  <td
94
68
  class="esd-block-text product-price"
95
- esd-extension-block-id="${e.PRICE}"
69
+ esd-extension-block-id="${o.PRICE}"
96
70
  align="left">
97
71
  <p contenteditable="false" style="font-size: 16px; color: #333333; font-weight: bold; margin: 0;">
98
72
  <strong>${r(t, "price")}</strong>
@@ -103,7 +77,20 @@ const h = {
103
77
  /**
104
78
  * Old price element - row for info cell table
105
79
  */
106
- [m]: (t) => R(t),
80
+ [T]: (t) => `
81
+ <tr>
82
+ <td
83
+ class="esd-block-text product-old-price"
84
+ esd-extension-block-id="${o.OLD_PRICE}"
85
+ align="left">
86
+ <p
87
+ contenteditable="false"
88
+ style="font-size: 14px; color: #999999; margin: 0;">
89
+ <s><strong>${r(t, "original_price")}</strong></s>
90
+ </p>
91
+ </td>
92
+ </tr>
93
+ `,
107
94
  /**
108
95
  * Omnibus price element - row for info cell table
109
96
  */
@@ -113,7 +100,7 @@ const h = {
113
100
  class="esd-block-text product-omnibus-price"
114
101
  data-text-before="Lowest 30-day price: "
115
102
  data-text-after=""
116
- esd-extension-block-id="${e.OMNIBUS_PRICE}"
103
+ esd-extension-block-id="${o.OMNIBUS_PRICE}"
117
104
  align="left">
118
105
  <p contenteditable="false" style="font-size: 12px; color: #666666; margin: 0;">
119
106
  <span class="omnibus-text-before">Lowest 30-day price: </span>
@@ -126,20 +113,20 @@ const h = {
126
113
  /**
127
114
  * Omnibus discount element - row for info cell table
128
115
  */
129
- [u]: (t) => {
130
- var a, s;
131
- const o = $(), n = ((a = t.original_price) == null ? void 0 : a[o.code]) ?? Object.values(t.original_price ?? {})[0] ?? 0, l = ((s = t.price) == null ? void 0 : s[o.code]) ?? Object.values(t.price ?? {})[0] ?? 0, i = n > 0 ? Math.round((n - l) / n * 100) : 0, c = i > 0 ? `-${i}%` : "0%";
116
+ [g]: (t) => {
117
+ var i, l;
118
+ const e = b(), n = ((i = t.original_price) == null ? void 0 : i[e.code]) ?? Object.values(t.original_price ?? {})[0] ?? 0, s = ((l = t.price) == null ? void 0 : l[e.code]) ?? Object.values(t.price ?? {})[0] ?? 0, a = n > 0 ? Math.round((n - s) / n * 100) : 0, m = a > 0 ? `-${a}%` : "0%";
132
119
  return `
133
120
  <tr>
134
121
  <td
135
122
  class="esd-block-text product-omnibus-discount"
136
123
  data-text-before=""
137
124
  data-text-after=""
138
- esd-extension-block-id="${e.OMNIBUS_DISCOUNT}"
125
+ esd-extension-block-id="${o.OMNIBUS_DISCOUNT}"
139
126
  align="left">
140
127
  <p contenteditable="false" style="font-size: 12px; color: #666666; margin: 0;">
141
128
  <span class="omnibus-text-before"></span>
142
- <span class="omnibus-discount-value">${c}</span>
129
+ <span class="omnibus-discount-value">${m}</span>
143
130
  <span class="omnibus-text-after"></span>
144
131
  </p>
145
132
  </td>
@@ -150,12 +137,12 @@ const h = {
150
137
  * Button cell - right column (100px fixed width)
151
138
  * Has recommendation-attribute-row class and data attributes for Card Composition control
152
139
  */
153
- [d]: (t) => `
140
+ [c]: (t) => `
154
141
  <td
155
142
  width="100"
156
143
  class="esd-block-button button-cell recommendation-attribute-row product-button es-p5l es-p5r"
157
- esd-extension-block-id="${e.BUTTON}"
158
- data-attribute-type="${d}"
144
+ esd-extension-block-id="${o.BUTTON}"
145
+ data-attribute-type="${c}"
159
146
  data-visibility="1"
160
147
  align="center"
161
148
  valign="middle">
@@ -169,7 +156,7 @@ const h = {
169
156
  <a
170
157
  href="${t.url}"
171
158
  target="_blank"
172
- class="es-button ${p}"
159
+ class="es-button ${d}"
173
160
  style="
174
161
  color: rgb(56, 118, 29);
175
162
  background: rgb(217, 234, 211);
@@ -192,20 +179,18 @@ const h = {
192
179
  * @param productAttrValue - Resolved product-attr value (e.g., "brand" for default, "product_attribute.rating_star" for custom)
193
180
  * @param content - Display content for the cell
194
181
  */
195
- [_]: (t, o) => `
182
+ [O]: (t, e) => `
196
183
  <tr>
197
184
  <td
198
- ${g}="${t}"
185
+ ${u}="${t}"
199
186
  class="esd-block-text product-custom-attribute"
200
- esd-extension-block-id="${e.CUSTOM_ATTRIBUTE}"
187
+ esd-extension-block-id="${o.CUSTOM_ATTRIBUTE}"
201
188
  align="left">
202
- <p contenteditable="false" style="font-size: 12px; color: #666666; margin: 0;">${o}</p>
189
+ <p contenteditable="false" style="font-size: 12px; color: #666666; margin: 0;">${e}</p>
203
190
  </td>
204
191
  </tr>
205
192
  `
206
193
  };
207
194
  export {
208
- h as listElementRenderer,
209
- y as renderInlineListPriceRow,
210
- R as renderListOldPriceRow
195
+ I as listElementRenderer
211
196
  };