@useinsider/guido 3.7.2-beta.13c9a35 → 3.7.2-beta.1e8f93e
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.
- package/dist/@types/config/schemas.js +66 -70
- package/dist/composables/usePreviewMode.js +14 -15
- package/dist/config/compiler/utils/recommendationCompilerUtils.js +82 -90
- package/dist/config/migrator/recommendation/htmlBuilder.js +58 -59
- package/dist/config/migrator/recommendation/settingsMapper.js +33 -38
- package/dist/extensions/Blocks/Items/block.js +48 -29
- package/dist/extensions/Blocks/Items/utils/nodeConfigUtils.js +62 -45
- package/dist/extensions/Blocks/Recommendation/block.js +41 -60
- package/dist/extensions/Blocks/Recommendation/constants/defaultConfig.js +32 -41
- package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +288 -369
- package/dist/extensions/Blocks/Recommendation/controls/main/index.js +84 -96
- package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +80 -82
- package/dist/extensions/Blocks/Recommendation/iconsRegistry.js +7 -21
- package/dist/extensions/Blocks/Recommendation/recommendation.css.js +4 -64
- package/dist/extensions/Blocks/Recommendation/store/recommendation.js +5 -7
- package/dist/extensions/Blocks/Recommendation/templates/grid/elementRenderer.js +72 -101
- package/dist/extensions/Blocks/Recommendation/templates/grid/template.js +30 -31
- package/dist/extensions/Blocks/Recommendation/templates/index.js +7 -9
- package/dist/extensions/Blocks/Recommendation/templates/list/elementRenderer.js +59 -74
- package/dist/extensions/Blocks/Recommendation/templates/list/template.js +21 -21
- package/dist/extensions/Blocks/Recommendation/templates/utils.js +57 -88
- package/dist/src/@types/config/schemas.d.ts +0 -16
- package/dist/src/composables/useConfig.d.ts +0 -4
- package/dist/src/config/migrator/recommendation/settingsMapper.d.ts +1 -1
- package/dist/src/extensions/Blocks/Items/block.d.ts +8 -0
- package/dist/src/extensions/Blocks/Items/utils/nodeConfigUtils.d.ts +1 -1
- package/dist/src/extensions/Blocks/Recommendation/block.d.ts +0 -10
- package/dist/src/extensions/Blocks/Recommendation/controls/cardComposition/index.d.ts +3 -29
- package/dist/src/extensions/Blocks/Recommendation/controls/index.d.ts +1 -1
- package/dist/src/extensions/Blocks/Recommendation/controls/main/index.d.ts +1 -3
- package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +0 -2
- package/dist/src/extensions/Blocks/Recommendation/templates/grid/elementRenderer.d.ts +0 -16
- package/dist/src/extensions/Blocks/Recommendation/templates/grid/template.d.ts +4 -4
- package/dist/src/extensions/Blocks/Recommendation/templates/list/elementRenderer.d.ts +0 -13
- package/dist/src/extensions/Blocks/Recommendation/templates/list/template.d.ts +2 -3
- package/dist/src/extensions/Blocks/Recommendation/templates/utils.d.ts +1 -33
- package/dist/src/extensions/Blocks/Recommendation/types/nodeConfig.d.ts +0 -15
- package/dist/src/stores/config.d.ts +0 -36
- package/package.json +1 -1
- package/dist/composables/useRecommendationPreview.js +0 -100
- package/dist/extensions/Blocks/Recommendation/controls/main/pricePlacement.js +0 -133
- package/dist/src/composables/useRecommendationPreview.d.ts +0 -10
- 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
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
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
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
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
|
|
54
|
-
const
|
|
55
|
-
return
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
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
|
|
81
|
-
[
|
|
82
|
-
<td class="${
|
|
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="${
|
|
44
|
+
<a target="_blank" href="${t.url}" class="${p}">
|
|
97
45
|
<img
|
|
98
|
-
src="${
|
|
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
|
-
[
|
|
110
|
-
<td class="${
|
|
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
|
-
[
|
|
135
|
-
<td class="${
|
|
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
|
-
[
|
|
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="${
|
|
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
|
|
189
|
-
const e =
|
|
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="${
|
|
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">${
|
|
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
|
-
[
|
|
220
|
-
<td class="${
|
|
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 ${
|
|
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
|
-
[
|
|
272
|
-
<td class="${
|
|
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
|
-
${
|
|
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
|
-
|
|
270
|
+
a as ATTRIBUTE_CELL_CLASS,
|
|
298
271
|
s as DEFAULT_CELL_PADDING,
|
|
299
|
-
|
|
300
|
-
|
|
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
|
|
2
|
-
import { getDefaultProducts as
|
|
3
|
-
import {
|
|
4
|
-
const
|
|
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
|
-
`,
|
|
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
|
|
31
|
-
const
|
|
32
|
-
return
|
|
33
|
-
const
|
|
34
|
-
return
|
|
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
|
|
38
|
-
const
|
|
39
|
-
for (let
|
|
40
|
-
|
|
41
|
-
return
|
|
42
|
-
const d =
|
|
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
|
-
|
|
48
|
-
|
|
49
|
-
|
|
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
|
|
54
|
-
return
|
|
52
|
+
function P(t, e, n, r = {}) {
|
|
53
|
+
return g(t, e, A, n, r);
|
|
55
54
|
}
|
|
56
|
-
function
|
|
57
|
-
const
|
|
58
|
-
return
|
|
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
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
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
|
|
3
|
-
import { prepareProductRows as
|
|
4
|
-
|
|
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
|
|
9
|
-
const { productsPerRow:
|
|
10
|
-
return
|
|
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
|
-
|
|
11
|
+
a as prepareProductRows
|
|
14
12
|
};
|
|
@@ -1,69 +1,43 @@
|
|
|
1
|
-
import { RecommendationBlockId as
|
|
2
|
-
import { ATTR_PRODUCT_ATTR as
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
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
|
|
22
|
-
const n =
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
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
|
|
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
|
-
[
|
|
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="${
|
|
60
|
-
data-attribute-type="${
|
|
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="${
|
|
38
|
+
<a target="_blank" href="${t.url}" class="${d}">
|
|
65
39
|
<img
|
|
66
|
-
src="${
|
|
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
|
-
[
|
|
50
|
+
[_]: (t) => `
|
|
77
51
|
<tr>
|
|
78
52
|
<td
|
|
79
53
|
class="esd-block-text product-name"
|
|
80
|
-
esd-extension-block-id="${
|
|
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="${
|
|
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
|
-
[
|
|
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="${
|
|
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
|
-
[
|
|
130
|
-
var
|
|
131
|
-
const
|
|
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="${
|
|
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">${
|
|
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
|
-
[
|
|
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="${
|
|
158
|
-
data-attribute-type="${
|
|
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 ${
|
|
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
|
-
[
|
|
182
|
+
[O]: (t, e) => `
|
|
196
183
|
<tr>
|
|
197
184
|
<td
|
|
198
|
-
${
|
|
185
|
+
${u}="${t}"
|
|
199
186
|
class="esd-block-text product-custom-attribute"
|
|
200
|
-
esd-extension-block-id="${
|
|
187
|
+
esd-extension-block-id="${o.CUSTOM_ATTRIBUTE}"
|
|
201
188
|
align="left">
|
|
202
|
-
<p contenteditable="false" style="font-size: 12px; color: #666666; margin: 0;">${
|
|
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
|
-
|
|
209
|
-
y as renderInlineListPriceRow,
|
|
210
|
-
R as renderListOldPriceRow
|
|
195
|
+
I as listElementRenderer
|
|
211
196
|
};
|