@useinsider/guido 3.7.2-beta.13c9a35 → 3.7.2-beta.1489585
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 +78 -92
- package/dist/config/migrator/recommendation/htmlBuilder.js +58 -59
- package/dist/config/migrator/recommendation/settingsMapper.js +33 -38
- package/dist/extensions/Blocks/Recommendation/block.js +41 -60
- package/dist/extensions/Blocks/Recommendation/constants/defaultConfig.js +32 -41
- package/dist/extensions/Blocks/Recommendation/constants/selectors.js +11 -10
- package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +288 -369
- package/dist/extensions/Blocks/Recommendation/controls/main/index.js +82 -96
- package/dist/extensions/Blocks/Recommendation/controls/main/layoutOrientation.js +30 -39
- package/dist/extensions/Blocks/Recommendation/controls/main/productLayout.js +28 -34
- package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +288 -338
- package/dist/extensions/Blocks/Recommendation/extension.js +6 -5
- package/dist/extensions/Blocks/Recommendation/iconsRegistry.js +7 -21
- package/dist/extensions/Blocks/Recommendation/recommendation.css.js +4 -64
- package/dist/extensions/Blocks/Recommendation/settingsPanel.js +3 -2
- package/dist/extensions/Blocks/Recommendation/store/recommendation.js +5 -7
- package/dist/extensions/Blocks/Recommendation/templates/grid/elementRenderer.js +155 -215
- package/dist/extensions/Blocks/Recommendation/templates/grid/template.js +56 -31
- package/dist/extensions/Blocks/Recommendation/templates/index.js +29 -10
- package/dist/extensions/Blocks/Recommendation/templates/list/elementRenderer.js +145 -133
- package/dist/extensions/Blocks/Recommendation/templates/list/template.js +43 -22
- package/dist/extensions/Blocks/Recommendation/templates/utils.js +109 -92
- package/dist/extensions/Blocks/Recommendation/utils/captureStyleTemplates.js +216 -0
- package/dist/extensions/Blocks/Recommendation/utils/preserveTextStyles.js +24 -19
- package/dist/extensions/Blocks/Recommendation/utils/tagName.js +30 -22
- package/dist/extensions/Blocks/controlFactories.js +159 -133
- 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/controls/index.d.ts +1 -1
- package/dist/src/extensions/Blocks/Recommendation/block.d.ts +0 -10
- package/dist/src/extensions/Blocks/Recommendation/constants/index.d.ts +1 -1
- package/dist/src/extensions/Blocks/Recommendation/constants/selectors.d.ts +2 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/button/index.d.ts +1 -1
- 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/controls/main/layoutOrientation.d.ts +2 -1
- package/dist/src/extensions/Blocks/Recommendation/controls/main/utils.d.ts +20 -47
- 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/index.d.ts +1 -1
- package/dist/src/extensions/Blocks/Recommendation/templates/list/elementRenderer.d.ts +0 -13
- package/dist/src/extensions/Blocks/Recommendation/templates/list/template.d.ts +3 -3
- package/dist/src/extensions/Blocks/Recommendation/templates/utils.d.ts +163 -41
- package/dist/src/extensions/Blocks/Recommendation/types/nodeConfig.d.ts +0 -15
- package/dist/src/extensions/Blocks/Recommendation/utils/captureStyleTemplates.d.ts +78 -0
- package/dist/src/extensions/Blocks/Recommendation/utils/preserveTextStyles.d.ts +15 -0
- package/dist/src/extensions/Blocks/Recommendation/utils/tagName.d.ts +29 -9
- package/dist/src/extensions/Blocks/controlFactories.d.ts +11 -1
- 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
- package/dist/src/extensions/Blocks/Recommendation/utils/stylePreserver.d.ts +0 -113
|
@@ -1,213 +1,173 @@
|
|
|
1
|
-
import { RecommendationBlockId as
|
|
2
|
-
import { ATTR_PRODUCT_ATTR as
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
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>`;
|
|
7
9
|
}
|
|
8
|
-
function
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
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 u(r, e = "") {
|
|
11
|
+
const l = Y(e, r);
|
|
12
|
+
return `<table class="product-card-segment" width="100%" height="100%" cellpadding="0" cellspacing="0" border="0"${l ? ` style="${l}"` : ""}>`;
|
|
13
|
+
}
|
|
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
|
+
};
|
|
52
24
|
}
|
|
53
|
-
function
|
|
54
|
-
const
|
|
55
|
-
return
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
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
|
+
});
|
|
31
|
+
}
|
|
32
|
+
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;
|
|
36
|
+
return `
|
|
37
|
+
<td class="${t}" style="padding: ${l}; height: 100%;" valign="top">
|
|
38
|
+
${u(e == null ? void 0 : e.cardBackgroundColor)}
|
|
64
39
|
<tbody>
|
|
65
40
|
<tr valign="top">
|
|
66
41
|
<td
|
|
67
|
-
class="esd-block-
|
|
42
|
+
class="esd-block-image product-image"
|
|
68
43
|
align="center"
|
|
69
|
-
esd-extension-block-id="${
|
|
70
|
-
<
|
|
71
|
-
|
|
72
|
-
|
|
44
|
+
esd-extension-block-id="${b.IMAGE}">
|
|
45
|
+
<a target="_blank" href="${r.url}" class="${f}">
|
|
46
|
+
<img
|
|
47
|
+
src="${w(r.image_url)}"
|
|
48
|
+
alt="${r.name}"
|
|
49
|
+
style="${a}"
|
|
50
|
+
class="adapt-img">
|
|
51
|
+
</a>
|
|
73
52
|
</td>
|
|
74
53
|
</tr>
|
|
75
54
|
</tbody>
|
|
76
55
|
</table>
|
|
77
56
|
</td>
|
|
78
57
|
`;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
border="0">
|
|
58
|
+
},
|
|
59
|
+
[E]: (r, e) => {
|
|
60
|
+
const l = (e == null ? void 0 : e.cellPadding) ?? d, a = T(
|
|
61
|
+
r.name,
|
|
62
|
+
{ pStyle: "font-size: 16px; color: #333333;", openTags: "<strong>", closeTags: "</strong>" },
|
|
63
|
+
e == null ? void 0 : e.styleTemplate
|
|
64
|
+
);
|
|
65
|
+
return `
|
|
66
|
+
<td class="${t}" style="padding: ${l}; height: 100%;" valign="middle">
|
|
67
|
+
${u(e == null ? void 0 : e.cardBackgroundColor, "table-layout: fixed;")}
|
|
90
68
|
<tbody>
|
|
91
69
|
<tr valign="top">
|
|
92
70
|
<td
|
|
93
|
-
class="esd-block-
|
|
94
|
-
align="center"
|
|
95
|
-
esd-extension-block-id="${
|
|
96
|
-
|
|
97
|
-
<img
|
|
98
|
-
src="${C(t.image_url)}"
|
|
99
|
-
alt="${t.name}"
|
|
100
|
-
style="display: block; max-width: 100%; height: auto;"
|
|
101
|
-
class="adapt-img">
|
|
102
|
-
</a>
|
|
71
|
+
class="esd-block-text product-name ${(e == null ? void 0 : e.cellClasses) ?? "es-p10t es-p10b es-p15l es-p15r"}"
|
|
72
|
+
align="${(e == null ? void 0 : e.cellAlignment) ?? "center"}"
|
|
73
|
+
esd-extension-block-id="${b.NAME}"${$(e == null ? void 0 : e.cellBackgroundColor)}>
|
|
74
|
+
${a}
|
|
103
75
|
</td>
|
|
104
76
|
</tr>
|
|
105
77
|
</tbody>
|
|
106
78
|
</table>
|
|
107
79
|
</td>
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
80
|
+
`;
|
|
81
|
+
},
|
|
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>" },
|
|
86
|
+
e == null ? void 0 : e.styleTemplate
|
|
87
|
+
);
|
|
88
|
+
return `
|
|
89
|
+
<td class="${t}" style="padding: ${l}; height: 100%;" valign="top">
|
|
90
|
+
${u(e == null ? void 0 : e.cardBackgroundColor)}
|
|
119
91
|
<tbody>
|
|
120
92
|
<tr valign="top">
|
|
121
93
|
<td
|
|
122
|
-
class="esd-block-text product-
|
|
123
|
-
align="center"
|
|
124
|
-
esd-extension-block-id="${
|
|
125
|
-
|
|
126
|
-
<strong>${t.name}</strong>
|
|
127
|
-
</p>
|
|
94
|
+
class="esd-block-text product-price ${(e == null ? void 0 : e.cellClasses) ?? "es-p15l es-p15r"}"
|
|
95
|
+
align="${(e == null ? void 0 : e.cellAlignment) ?? "center"}"
|
|
96
|
+
esd-extension-block-id="${b.PRICE}"${$(e == null ? void 0 : e.cellBackgroundColor)}>
|
|
97
|
+
${a}
|
|
128
98
|
</td>
|
|
129
99
|
</tr>
|
|
130
100
|
</tbody>
|
|
131
101
|
</table>
|
|
132
102
|
</td>
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
103
|
+
`;
|
|
104
|
+
},
|
|
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>" },
|
|
109
|
+
e == null ? void 0 : e.styleTemplate
|
|
110
|
+
);
|
|
111
|
+
return `
|
|
112
|
+
<td class="${t}" style="padding: ${l}; height: 100%;" valign="top">
|
|
113
|
+
${u(e == null ? void 0 : e.cardBackgroundColor)}
|
|
143
114
|
<tbody>
|
|
144
115
|
<tr valign="top">
|
|
145
116
|
<td
|
|
146
|
-
class="esd-block-text product-price es-p15l es-p15r"
|
|
147
|
-
align="center"
|
|
148
|
-
esd-extension-block-id="${
|
|
149
|
-
|
|
150
|
-
<strong>${i(t, "price")}</strong>
|
|
151
|
-
</p>
|
|
117
|
+
class="esd-block-text product-old-price ${(e == null ? void 0 : e.cellClasses) ?? "es-p15l es-p15r"}"
|
|
118
|
+
align="${(e == null ? void 0 : e.cellAlignment) ?? "center"}"
|
|
119
|
+
esd-extension-block-id="${b.OLD_PRICE}"${$(e == null ? void 0 : e.cellBackgroundColor)}>
|
|
120
|
+
${a}
|
|
152
121
|
</td>
|
|
153
122
|
</tr>
|
|
154
123
|
</tbody>
|
|
155
124
|
</table>
|
|
156
125
|
</td>
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
[
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
height="100%"
|
|
165
|
-
cellpadding="0"
|
|
166
|
-
cellspacing="0"
|
|
167
|
-
border="0">
|
|
126
|
+
`;
|
|
127
|
+
},
|
|
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: ");
|
|
130
|
+
return `
|
|
131
|
+
<td class="${t}" style="padding: ${l}; height: 100%;" valign="top">
|
|
132
|
+
${u(e == null ? void 0 : e.cardBackgroundColor)}
|
|
168
133
|
<tbody>
|
|
169
134
|
<tr valign="top">
|
|
170
135
|
<td
|
|
171
|
-
class="esd-block-text product-omnibus-price es-p15l es-p15r"
|
|
172
|
-
align="center"
|
|
173
|
-
data-text-before="
|
|
174
|
-
data-text-after=""
|
|
175
|
-
esd-extension-block-id="${
|
|
176
|
-
<p contenteditable="false" style="
|
|
177
|
-
<span class="omnibus-text-before"
|
|
178
|
-
<span class="omnibus-price-value">${
|
|
179
|
-
<span class="omnibus-text-after"
|
|
136
|
+
class="esd-block-text product-omnibus-price ${(e == null ? void 0 : e.cellClasses) ?? "es-p15l es-p15r"}"
|
|
137
|
+
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)}>
|
|
141
|
+
<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>
|
|
180
145
|
</p>
|
|
181
146
|
</td>
|
|
182
147
|
</tr>
|
|
183
148
|
</tbody>
|
|
184
149
|
</table>
|
|
185
150
|
</td>
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
151
|
+
`;
|
|
152
|
+
},
|
|
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);
|
|
190
156
|
return `
|
|
191
|
-
<td class="${
|
|
192
|
-
|
|
193
|
-
class="product-card-segment"
|
|
194
|
-
width="100%"
|
|
195
|
-
height="100%"
|
|
196
|
-
cellpadding="0"
|
|
197
|
-
cellspacing="0"
|
|
198
|
-
border="0">
|
|
157
|
+
<td class="${t}" style="padding: ${l}; height: 100%;" valign="top">
|
|
158
|
+
${u(e == null ? void 0 : e.cardBackgroundColor)}
|
|
199
159
|
<tbody>
|
|
200
160
|
<tr valign="top">
|
|
201
161
|
<td
|
|
202
|
-
class="esd-block-text product-omnibus-discount es-p15l es-p15r"
|
|
203
|
-
align="center"
|
|
204
|
-
data-text-before=""
|
|
205
|
-
data-text-after=""
|
|
206
|
-
esd-extension-block-id="${
|
|
207
|
-
<p contenteditable="false" style="
|
|
208
|
-
<span class="omnibus-text-before"
|
|
209
|
-
<span class="omnibus-discount-value">${
|
|
210
|
-
<span class="omnibus-text-after"
|
|
162
|
+
class="esd-block-text product-omnibus-discount ${(e == null ? void 0 : e.cellClasses) ?? "es-p15l es-p15r"}"
|
|
163
|
+
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)}>
|
|
167
|
+
<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>
|
|
211
171
|
</p>
|
|
212
172
|
</td>
|
|
213
173
|
</tr>
|
|
@@ -216,43 +176,24 @@ const I = {
|
|
|
216
176
|
</td>
|
|
217
177
|
`;
|
|
218
178
|
},
|
|
219
|
-
[
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
height="100%"
|
|
225
|
-
cellpadding="0"
|
|
226
|
-
cellspacing="0"
|
|
227
|
-
border="0">
|
|
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);
|
|
181
|
+
return `
|
|
182
|
+
<td class="${t}" style="padding: ${l}; height: 100%;" valign="top">
|
|
183
|
+
${u(e == null ? void 0 : e.cardBackgroundColor)}
|
|
228
184
|
<tbody>
|
|
229
185
|
<tr valign="top">
|
|
230
186
|
<td
|
|
231
|
-
class="esd-block-button product-button es-p10t es-p10b"
|
|
232
|
-
align="center"
|
|
233
|
-
esd-extension-block-id="${
|
|
234
|
-
<span
|
|
235
|
-
class="es-button-border"
|
|
236
|
-
style="
|
|
237
|
-
border-width: 1px;
|
|
238
|
-
background: rgb(217, 234, 211);
|
|
239
|
-
border-color: rgb(106, 168, 79);
|
|
240
|
-
">
|
|
187
|
+
class="esd-block-button product-button ${(e == null ? void 0 : e.cellClasses) ?? "es-p10t es-p10b"}"
|
|
188
|
+
align="${(e == null ? void 0 : e.cellAlignment) ?? "center"}"
|
|
189
|
+
esd-extension-block-id="${b.BUTTON}">
|
|
190
|
+
<span class="${G(a)}" style="${c}">
|
|
241
191
|
<a
|
|
242
192
|
href="#"
|
|
243
|
-
class="es-button ${
|
|
193
|
+
class="es-button ${f}"
|
|
244
194
|
target="_blank"
|
|
245
|
-
style="
|
|
246
|
-
|
|
247
|
-
background: rgb(217, 234, 211);
|
|
248
|
-
font-family: arial, 'helvetica neue', helvetica, sans-serif;
|
|
249
|
-
font-size: 16px;
|
|
250
|
-
font-weight: normal;
|
|
251
|
-
line-height: 120%;
|
|
252
|
-
mso-border-alt: 10px solid rgb(217, 234, 211);
|
|
253
|
-
mso-padding-alt: 0;
|
|
254
|
-
">
|
|
255
|
-
Buy
|
|
195
|
+
style="${g}">
|
|
196
|
+
${y}
|
|
256
197
|
</a>
|
|
257
198
|
</span>
|
|
258
199
|
</td>
|
|
@@ -260,7 +201,8 @@ const I = {
|
|
|
260
201
|
</tbody>
|
|
261
202
|
</table>
|
|
262
203
|
</td>
|
|
263
|
-
|
|
204
|
+
`;
|
|
205
|
+
},
|
|
264
206
|
/**
|
|
265
207
|
* Custom attribute cell template — same structure as built-in entries
|
|
266
208
|
* (outer td → inner product-card-segment table).
|
|
@@ -268,36 +210,34 @@ const I = {
|
|
|
268
210
|
* @param productAttrValue - Resolved product-attr value (e.g., "brand" for default, "product_attribute.rating_star" for custom)
|
|
269
211
|
* @param content - Display content for the cell
|
|
270
212
|
*/
|
|
271
|
-
[
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
style="table-layout: fixed;">
|
|
213
|
+
[N]: (r, e, l) => {
|
|
214
|
+
const a = (l == null ? void 0 : l.cellPadding) ?? d, c = T(
|
|
215
|
+
e,
|
|
216
|
+
{ pStyle: "font-size: 12px; color: #666666;", openTags: "", closeTags: "" },
|
|
217
|
+
l == null ? void 0 : l.styleTemplate
|
|
218
|
+
);
|
|
219
|
+
return `
|
|
220
|
+
<td class="${t}" style="padding: ${a}; height: 100%;" valign="middle">
|
|
221
|
+
${u(l == null ? void 0 : l.cardBackgroundColor, "table-layout: fixed;")}
|
|
281
222
|
<tbody>
|
|
282
223
|
<tr valign="top">
|
|
283
224
|
<td
|
|
284
|
-
${
|
|
285
|
-
class="esd-block-text product-custom-attribute es-p0t es-p0b es-p15l es-p15r"
|
|
286
|
-
align="center"
|
|
287
|
-
esd-extension-block-id="${
|
|
288
|
-
|
|
225
|
+
${k}="${r}"
|
|
226
|
+
class="esd-block-text product-custom-attribute ${(l == null ? void 0 : l.cellClasses) ?? "es-p0t es-p0b es-p15l es-p15r"}"
|
|
227
|
+
align="${(l == null ? void 0 : l.cellAlignment) ?? "center"}"
|
|
228
|
+
esd-extension-block-id="${b.CUSTOM_ATTRIBUTE}"${$(l == null ? void 0 : l.cellBackgroundColor)}>
|
|
229
|
+
${c}
|
|
289
230
|
</td>
|
|
290
231
|
</tr>
|
|
291
232
|
</tbody>
|
|
292
233
|
</table>
|
|
293
234
|
</td>
|
|
294
|
-
|
|
235
|
+
`;
|
|
236
|
+
}
|
|
295
237
|
};
|
|
296
238
|
export {
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
R as renderGridOldPriceCell,
|
|
302
|
-
U as renderInlineGridPriceCell
|
|
239
|
+
t as ATTRIBUTE_CELL_CLASS,
|
|
240
|
+
d as DEFAULT_CELL_PADDING,
|
|
241
|
+
Q as buildFillerCell,
|
|
242
|
+
W as gridElementRenderer
|
|
303
243
|
};
|
|
@@ -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 f } from "../../constants/layout.js";
|
|
2
|
+
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";
|
|
3
|
+
import { DEFAULT_CELL_PADDING as h, buildFillerCell as B, gridElementRenderer as F } from "./elementRenderer.js";
|
|
4
|
+
const W = `
|
|
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
|
+
`, k = `
|
|
22
22
|
<tr
|
|
23
23
|
class="recommendation-attribute-row"
|
|
24
24
|
data-attribute-type="{-{-ATTR_TYPE-}-}"
|
|
@@ -27,39 +27,64 @@ const U = `
|
|
|
27
27
|
{-{-CELLS-}-}
|
|
28
28
|
</tr>
|
|
29
29
|
`;
|
|
30
|
-
function
|
|
31
|
-
const {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
30
|
+
function H(e, r, c, o = O, n = {}, p = {}) {
|
|
31
|
+
const {
|
|
32
|
+
cellPadding: i = h,
|
|
33
|
+
styleTemplates: s,
|
|
34
|
+
cardBackgroundColor: T,
|
|
35
|
+
cellBackgroundColors: l,
|
|
36
|
+
cellAlignments: d,
|
|
37
|
+
cellClasses: u,
|
|
38
|
+
omnibusTexts: a,
|
|
39
|
+
visibility: R
|
|
40
|
+
} = p, m = (100 / r).toFixed(2), I = r - e.length, S = I > 0 ? B(m, i).repeat(I) : "", L = U(c, o, n);
|
|
41
|
+
return o.filter((t) => L[t]).map((t) => {
|
|
42
|
+
const E = (R == null ? void 0 : R[t]) ?? Y[t] ?? !0, b = E ? "" : 'style="display: none;"', _ = {
|
|
43
|
+
cellPadding: i,
|
|
44
|
+
cardBackgroundColor: T,
|
|
45
|
+
cellBackgroundColor: l == null ? void 0 : l[t],
|
|
46
|
+
cellAlignment: d == null ? void 0 : d[t],
|
|
47
|
+
cellClasses: u == null ? void 0 : u[t],
|
|
48
|
+
omnibusText: a == null ? void 0 : a[t],
|
|
49
|
+
styleTemplate: s == null ? void 0 : s[t]
|
|
50
|
+
}, w = e.map((D) => L[t](D, _).replace("<td", `<td width="${m}%"`)).join("");
|
|
51
|
+
return k.replace("{-{-ATTR_TYPE-}-}", t).replace("{-{-VISIBILITY-}-}", E ? "1" : "0").replace("{-{-DISPLAY_STYLE-}-}", b).replace("{-{-CELLS-}-}", w + S);
|
|
35
52
|
}).join("");
|
|
36
53
|
}
|
|
37
|
-
function
|
|
38
|
-
const
|
|
39
|
-
for (let
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
o,
|
|
54
|
+
function x(e, r, c, o, n = {}, p = {}) {
|
|
55
|
+
const i = [];
|
|
56
|
+
for (let l = 0; l < e.length; l += r)
|
|
57
|
+
i.push(e.slice(l, l + r));
|
|
58
|
+
const s = P(p.rowSpacingPx);
|
|
59
|
+
return i.map((l, d) => {
|
|
60
|
+
const u = H(
|
|
61
|
+
l,
|
|
46
62
|
r,
|
|
47
|
-
|
|
63
|
+
c,
|
|
64
|
+
o,
|
|
65
|
+
n,
|
|
48
66
|
p
|
|
49
|
-
),
|
|
50
|
-
return
|
|
67
|
+
), a = W.replace("{-{-ATTRIBUTE_ROWS-}-}", u);
|
|
68
|
+
return d > 0 ? s + a : a;
|
|
51
69
|
}).join("");
|
|
52
70
|
}
|
|
53
|
-
function
|
|
54
|
-
return
|
|
71
|
+
function V(e, r, c, o = {}, n = {}) {
|
|
72
|
+
return x(
|
|
73
|
+
e,
|
|
74
|
+
r,
|
|
75
|
+
F,
|
|
76
|
+
c,
|
|
77
|
+
o,
|
|
78
|
+
n
|
|
79
|
+
);
|
|
55
80
|
}
|
|
56
|
-
function
|
|
57
|
-
const
|
|
58
|
-
return
|
|
81
|
+
function $(e) {
|
|
82
|
+
const r = e ? `ins-recommendation-v3-block-${e}` : void 0, c = g("grid", r), o = A(), n = V(o, f);
|
|
83
|
+
return c.replace("{-{-TITLE-}-}", C.TITLE).replace("{-{-PRODUCT_ROWS-}-}", n).replace("{-{-MOBILE_PRODUCT_ROWS-}-}", "");
|
|
59
84
|
}
|
|
60
85
|
export {
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
86
|
+
$ as getDefaultTemplate,
|
|
87
|
+
H as prepareGridAttributeRows,
|
|
88
|
+
x as prepareGridProductRows,
|
|
89
|
+
V as prepareProductRows
|
|
65
90
|
};
|
|
@@ -1,14 +1,33 @@
|
|
|
1
|
-
import { DEFAULT_PRODUCTS_PER_ROW as
|
|
2
|
-
import { prepareProductRows as
|
|
3
|
-
import { prepareProductRows as
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import { DEFAULT_PRODUCTS_PER_ROW as f } from "../constants/layout.js";
|
|
2
|
+
import { prepareProductRows as w } from "./grid/template.js";
|
|
3
|
+
import { prepareProductRows as g } from "./list/template.js";
|
|
4
|
+
function L(o, t, r = {}) {
|
|
5
|
+
const {
|
|
6
|
+
cellPadding: s,
|
|
7
|
+
rowSpacingPx: i,
|
|
8
|
+
styleTemplates: c,
|
|
9
|
+
cardBackgroundColor: l,
|
|
10
|
+
cellBackgroundColors: p,
|
|
11
|
+
cellAlignments: n,
|
|
12
|
+
cellClasses: a,
|
|
13
|
+
omnibusTexts: d,
|
|
14
|
+
visibility: m
|
|
15
|
+
} = r, e = {
|
|
16
|
+
cellPadding: s,
|
|
17
|
+
rowSpacingPx: i,
|
|
18
|
+
styleTemplates: c,
|
|
19
|
+
cardBackgroundColor: l,
|
|
20
|
+
cellBackgroundColors: p,
|
|
21
|
+
cellAlignments: n,
|
|
22
|
+
cellClasses: a,
|
|
23
|
+
omnibusTexts: d,
|
|
24
|
+
visibility: m
|
|
25
|
+
};
|
|
7
26
|
if (t === "list")
|
|
8
|
-
return
|
|
9
|
-
const { productsPerRow:
|
|
10
|
-
return
|
|
27
|
+
return g(o, r.composition, r.filterList, e);
|
|
28
|
+
const { productsPerRow: u = f, composition: P, filterList: R } = r;
|
|
29
|
+
return w(o, u, P, R, e);
|
|
11
30
|
}
|
|
12
31
|
export {
|
|
13
|
-
|
|
32
|
+
L as prepareProductRows
|
|
14
33
|
};
|