@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,146 +1,166 @@
|
|
|
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
|
-
|
|
17
|
-
</td>
|
|
18
|
-
</tr>
|
|
19
|
-
`;
|
|
1
|
+
import { RecommendationBlockId as t } from "../../constants/blockIds.js";
|
|
2
|
+
import { ATTR_PRODUCT_ATTR as R, ATTR_PRODUCT_BUTTON as C, CSS_CLASS_RECO_BUTTON as _, ATTR_PRODUCT_OMNIBUS_DISCOUNT as A, ATTR_PRODUCT_OMNIBUS_PRICE as U, ATTR_PRODUCT_OLD_PRICE as k, ATTR_PRODUCT_PRICE as B, ATTR_PRODUCT_NAME as E, ATTR_PRODUCT_IMAGE as f } from "../../constants/selectors.js";
|
|
3
|
+
import { useRecommendationExtensionStore as P } from "../../store/recommendation.js";
|
|
4
|
+
import { formatPrice as I } from "../../utils/priceFormatter.js";
|
|
5
|
+
import { CUSTOM_CELL_HTML as h, renderStyledParagraph as u, cellBgStyleAttr as d, DEFAULT_BUTTON_BORDER_STYLE as L, renderButtonLabel as N, DEFAULT_BUTTON_ANCHOR_STYLE as D, resolveButtonBorderClass as v, resolvePStyle as y, resolveOmnibusText as S, DEFAULT_IMG_STYLE as M, sanitizeImageUrl as w } from "../utils.js";
|
|
6
|
+
const z = `${D} padding: 5px 30px;`;
|
|
7
|
+
function x() {
|
|
8
|
+
const r = P(), { currencySettings: e } = r.recommendationConfigs;
|
|
9
|
+
return {
|
|
10
|
+
code: e.value,
|
|
11
|
+
symbol: e.symbol,
|
|
12
|
+
alignment: e.alignment === "0" ? "before" : "after",
|
|
13
|
+
decimalCount: parseInt(e.decimalCount) || 2,
|
|
14
|
+
decimalSeparator: e.decimalSeparator,
|
|
15
|
+
thousandSeparator: e.thousandSeparator
|
|
16
|
+
};
|
|
20
17
|
}
|
|
21
|
-
function
|
|
22
|
-
const
|
|
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
|
-
`;
|
|
18
|
+
function T(r, e = "price") {
|
|
19
|
+
const l = x(), a = r[e], c = (a == null ? void 0 : a[l.code]) ?? Object.values(a ?? {})[0] ?? 0;
|
|
20
|
+
return I({
|
|
21
|
+
price: c,
|
|
22
|
+
currency: l
|
|
23
|
+
});
|
|
49
24
|
}
|
|
50
|
-
const
|
|
25
|
+
const V = {
|
|
51
26
|
/**
|
|
52
27
|
* Image cell - left column (120px fixed width)
|
|
53
28
|
* Has recommendation-attribute-row class and data attributes for Card Composition control
|
|
54
29
|
*/
|
|
55
|
-
[
|
|
30
|
+
[f]: (r, e) => {
|
|
31
|
+
var a;
|
|
32
|
+
const l = ((a = e == null ? void 0 : e.styleTemplate) == null ? void 0 : a.imgStyle) ?? M;
|
|
33
|
+
return `
|
|
56
34
|
<td
|
|
57
35
|
width="120"
|
|
58
36
|
class="esd-block-image product-image-cell recommendation-attribute-row es-p5"
|
|
59
|
-
esd-extension-block-id="${
|
|
60
|
-
data-attribute-type="${
|
|
37
|
+
esd-extension-block-id="${t.IMAGE}"
|
|
38
|
+
data-attribute-type="${f}"
|
|
61
39
|
data-visibility="1"
|
|
62
40
|
align="center"
|
|
63
41
|
valign="middle">
|
|
64
|
-
<a target="_blank" href="${
|
|
42
|
+
<a target="_blank" href="${r.url}" class="${_}">
|
|
65
43
|
<img
|
|
66
|
-
src="${
|
|
67
|
-
alt="${
|
|
68
|
-
style="
|
|
44
|
+
src="${w(r.image_url)}"
|
|
45
|
+
alt="${r.name}"
|
|
46
|
+
style="${l}"
|
|
69
47
|
class="adapt-img product-image">
|
|
70
48
|
</a>
|
|
71
49
|
</td>
|
|
72
|
-
|
|
50
|
+
`;
|
|
51
|
+
},
|
|
73
52
|
/**
|
|
74
53
|
* Name element - row for info cell table
|
|
75
54
|
*/
|
|
76
|
-
[
|
|
55
|
+
[E]: (r, e) => {
|
|
56
|
+
const l = u(
|
|
57
|
+
r.name,
|
|
58
|
+
{
|
|
59
|
+
pStyle: "font-size: 16px; color: #333333; font-weight: 600; margin: 0;",
|
|
60
|
+
openTags: "<strong>",
|
|
61
|
+
closeTags: "</strong>"
|
|
62
|
+
},
|
|
63
|
+
e == null ? void 0 : e.styleTemplate
|
|
64
|
+
);
|
|
65
|
+
return `
|
|
77
66
|
<tr>
|
|
78
67
|
<td
|
|
79
|
-
class="esd-block-text product-name"
|
|
80
|
-
esd-extension-block-id="${
|
|
81
|
-
align="left">
|
|
82
|
-
|
|
83
|
-
<strong>${t.name}</strong>
|
|
84
|
-
</p>
|
|
68
|
+
class="esd-block-text product-name${e != null && e.cellClasses ? ` ${e.cellClasses}` : ""}"
|
|
69
|
+
esd-extension-block-id="${t.NAME}"${d(e == null ? void 0 : e.cellBackgroundColor)}
|
|
70
|
+
align="${(e == null ? void 0 : e.cellAlignment) ?? "left"}">
|
|
71
|
+
${l}
|
|
85
72
|
</td>
|
|
86
73
|
</tr>
|
|
87
|
-
|
|
74
|
+
`;
|
|
75
|
+
},
|
|
88
76
|
/**
|
|
89
77
|
* Price element - row for info cell table
|
|
90
78
|
*/
|
|
91
|
-
[
|
|
79
|
+
[B]: (r, e) => {
|
|
80
|
+
const l = u(
|
|
81
|
+
T(r, "price"),
|
|
82
|
+
{
|
|
83
|
+
pStyle: "font-size: 16px; color: #333333; font-weight: bold; margin: 0;",
|
|
84
|
+
openTags: "<strong>",
|
|
85
|
+
closeTags: "</strong>"
|
|
86
|
+
},
|
|
87
|
+
e == null ? void 0 : e.styleTemplate
|
|
88
|
+
);
|
|
89
|
+
return `
|
|
92
90
|
<tr>
|
|
93
91
|
<td
|
|
94
|
-
class="esd-block-text product-price"
|
|
95
|
-
esd-extension-block-id="${
|
|
96
|
-
align="left">
|
|
97
|
-
|
|
98
|
-
<strong>${r(t, "price")}</strong>
|
|
99
|
-
</p>
|
|
92
|
+
class="esd-block-text product-price${e != null && e.cellClasses ? ` ${e.cellClasses}` : ""}"
|
|
93
|
+
esd-extension-block-id="${t.PRICE}"${d(e == null ? void 0 : e.cellBackgroundColor)}
|
|
94
|
+
align="${(e == null ? void 0 : e.cellAlignment) ?? "left"}">
|
|
95
|
+
${l}
|
|
100
96
|
</td>
|
|
101
97
|
</tr>
|
|
102
|
-
|
|
98
|
+
`;
|
|
99
|
+
},
|
|
103
100
|
/**
|
|
104
101
|
* Old price element - row for info cell table
|
|
105
102
|
*/
|
|
106
|
-
[
|
|
103
|
+
[k]: (r, e) => {
|
|
104
|
+
const l = u(
|
|
105
|
+
T(r, "original_price"),
|
|
106
|
+
{
|
|
107
|
+
pStyle: "font-size: 14px; color: #999999; margin: 0;",
|
|
108
|
+
openTags: "<s><strong>",
|
|
109
|
+
closeTags: "</strong></s>"
|
|
110
|
+
},
|
|
111
|
+
e == null ? void 0 : e.styleTemplate
|
|
112
|
+
);
|
|
113
|
+
return `
|
|
114
|
+
<tr>
|
|
115
|
+
<td
|
|
116
|
+
class="esd-block-text product-old-price${e != null && e.cellClasses ? ` ${e.cellClasses}` : ""}"
|
|
117
|
+
esd-extension-block-id="${t.OLD_PRICE}"${d(e == null ? void 0 : e.cellBackgroundColor)}
|
|
118
|
+
align="${(e == null ? void 0 : e.cellAlignment) ?? "left"}">
|
|
119
|
+
${l}
|
|
120
|
+
</td>
|
|
121
|
+
</tr>
|
|
122
|
+
`;
|
|
123
|
+
},
|
|
107
124
|
/**
|
|
108
125
|
* Omnibus price element - row for info cell table
|
|
109
126
|
*/
|
|
110
|
-
[
|
|
127
|
+
[U]: (r, e) => {
|
|
128
|
+
const l = y("font-size: 12px; color: #666666; margin: 0;", e == null ? void 0 : e.styleTemplate), { before: a, after: c } = S(e == null ? void 0 : e.omnibusText, "Lowest 30-day price: ");
|
|
129
|
+
return `
|
|
111
130
|
<tr>
|
|
112
131
|
<td
|
|
113
|
-
class="esd-block-text product-omnibus-price"
|
|
114
|
-
data-text-before="
|
|
115
|
-
data-text-after=""
|
|
116
|
-
esd-extension-block-id="${
|
|
117
|
-
align="left">
|
|
118
|
-
<p contenteditable="false" style="
|
|
119
|
-
<span class="omnibus-text-before"
|
|
120
|
-
<span class="omnibus-price-value">${r
|
|
121
|
-
<span class="omnibus-text-after"
|
|
132
|
+
class="esd-block-text product-omnibus-price${e != null && e.cellClasses ? ` ${e.cellClasses}` : ""}"
|
|
133
|
+
data-text-before="${a}"
|
|
134
|
+
data-text-after="${c}"
|
|
135
|
+
esd-extension-block-id="${t.OMNIBUS_PRICE}"${d(e == null ? void 0 : e.cellBackgroundColor)}
|
|
136
|
+
align="${(e == null ? void 0 : e.cellAlignment) ?? "left"}">
|
|
137
|
+
<p contenteditable="false" style="${l}">
|
|
138
|
+
<span class="omnibus-text-before">${a}</span>
|
|
139
|
+
<span class="omnibus-price-value">${T(r, "original_price")}</span>
|
|
140
|
+
<span class="omnibus-text-after">${c}</span>
|
|
122
141
|
</p>
|
|
123
142
|
</td>
|
|
124
143
|
</tr>
|
|
125
|
-
|
|
144
|
+
`;
|
|
145
|
+
},
|
|
126
146
|
/**
|
|
127
147
|
* Omnibus discount element - row for info cell table
|
|
128
148
|
*/
|
|
129
|
-
[
|
|
130
|
-
var
|
|
131
|
-
const
|
|
149
|
+
[A]: (r, e) => {
|
|
150
|
+
var b, n;
|
|
151
|
+
const l = y("font-size: 12px; color: #666666; margin: 0;", e == null ? void 0 : e.styleTemplate), a = x(), c = ((b = r.original_price) == null ? void 0 : b[a.code]) ?? Object.values(r.original_price ?? {})[0] ?? 0, s = ((n = r.price) == null ? void 0 : n[a.code]) ?? Object.values(r.price ?? {})[0] ?? 0, g = c > 0 ? Math.round((c - s) / c * 100) : 0, O = g > 0 ? `-${g}%` : "0%", { before: m, after: $ } = S(e == null ? void 0 : e.omnibusText);
|
|
132
152
|
return `
|
|
133
153
|
<tr>
|
|
134
154
|
<td
|
|
135
|
-
class="esd-block-text product-omnibus-discount"
|
|
136
|
-
data-text-before=""
|
|
137
|
-
data-text-after=""
|
|
138
|
-
esd-extension-block-id="${
|
|
139
|
-
align="left">
|
|
140
|
-
<p contenteditable="false" style="
|
|
141
|
-
<span class="omnibus-text-before"
|
|
142
|
-
<span class="omnibus-discount-value">${
|
|
143
|
-
<span class="omnibus-text-after"
|
|
155
|
+
class="esd-block-text product-omnibus-discount${e != null && e.cellClasses ? ` ${e.cellClasses}` : ""}"
|
|
156
|
+
data-text-before="${m}"
|
|
157
|
+
data-text-after="${$}"
|
|
158
|
+
esd-extension-block-id="${t.OMNIBUS_DISCOUNT}"${d(e == null ? void 0 : e.cellBackgroundColor)}
|
|
159
|
+
align="${(e == null ? void 0 : e.cellAlignment) ?? "left"}">
|
|
160
|
+
<p contenteditable="false" style="${l}">
|
|
161
|
+
<span class="omnibus-text-before">${m}</span>
|
|
162
|
+
<span class="omnibus-discount-value">${O}</span>
|
|
163
|
+
<span class="omnibus-text-after">${$}</span>
|
|
144
164
|
</p>
|
|
145
165
|
</td>
|
|
146
166
|
</tr>
|
|
@@ -150,62 +170,54 @@ const h = {
|
|
|
150
170
|
* Button cell - right column (100px fixed width)
|
|
151
171
|
* Has recommendation-attribute-row class and data attributes for Card Composition control
|
|
152
172
|
*/
|
|
153
|
-
[
|
|
173
|
+
[C]: (r, e) => {
|
|
174
|
+
const l = e == null ? void 0 : e.styleTemplate, a = (l == null ? void 0 : l.buttonBorderStyle) ?? L, c = (l == null ? void 0 : l.buttonAnchorStyle) ?? z, s = N((l == null ? void 0 : l.buttonText) ?? "Buy", l);
|
|
175
|
+
return `
|
|
154
176
|
<td
|
|
155
177
|
width="100"
|
|
156
|
-
class="esd-block-button button-cell recommendation-attribute-row product-button es-p5l es-p5r"
|
|
157
|
-
esd-extension-block-id="${
|
|
158
|
-
data-attribute-type="${
|
|
178
|
+
class="esd-block-button button-cell recommendation-attribute-row product-button ${(e == null ? void 0 : e.cellClasses) ?? "es-p5l es-p5r"}"
|
|
179
|
+
esd-extension-block-id="${t.BUTTON}"
|
|
180
|
+
data-attribute-type="${C}"
|
|
159
181
|
data-visibility="1"
|
|
160
|
-
align="center"
|
|
182
|
+
align="${(e == null ? void 0 : e.cellAlignment) ?? "center"}"
|
|
161
183
|
valign="middle">
|
|
162
|
-
<span
|
|
163
|
-
class="es-button-border"
|
|
164
|
-
style="
|
|
165
|
-
border-width: 1px;
|
|
166
|
-
background: rgb(217, 234, 211);
|
|
167
|
-
border-color: rgb(106, 168, 79);
|
|
168
|
-
">
|
|
184
|
+
<span class="${v(l)}" style="${a}">
|
|
169
185
|
<a
|
|
170
|
-
href="${
|
|
186
|
+
href="${r.url}"
|
|
171
187
|
target="_blank"
|
|
172
|
-
class="es-button ${
|
|
173
|
-
style="
|
|
174
|
-
|
|
175
|
-
background: rgb(217, 234, 211);
|
|
176
|
-
font-family: arial, 'helvetica neue', helvetica, sans-serif;
|
|
177
|
-
font-size: 16px;
|
|
178
|
-
font-weight: normal;
|
|
179
|
-
line-height: 120%;
|
|
180
|
-
padding: 5px 30px;
|
|
181
|
-
mso-border-alt: 10px solid rgb(217, 234, 211);
|
|
182
|
-
mso-padding-alt: 0;
|
|
183
|
-
">
|
|
184
|
-
Buy
|
|
188
|
+
class="es-button ${_}"
|
|
189
|
+
style="${c}">
|
|
190
|
+
${s}
|
|
185
191
|
</a>
|
|
186
192
|
</span>
|
|
187
193
|
</td>
|
|
188
|
-
|
|
194
|
+
`;
|
|
195
|
+
},
|
|
189
196
|
/**
|
|
190
197
|
* Custom attribute row template — same tr-td structure as Name, Price, etc.
|
|
191
198
|
* Used by `buildElementRenderer` for `customAttr:*` composition entries.
|
|
192
199
|
* @param productAttrValue - Resolved product-attr value (e.g., "brand" for default, "product_attribute.rating_star" for custom)
|
|
193
200
|
* @param content - Display content for the cell
|
|
194
201
|
*/
|
|
195
|
-
[
|
|
202
|
+
[h]: (r, e, l) => {
|
|
203
|
+
const a = u(
|
|
204
|
+
e,
|
|
205
|
+
{ pStyle: "font-size: 12px; color: #666666; margin: 0;", openTags: "", closeTags: "" },
|
|
206
|
+
l == null ? void 0 : l.styleTemplate
|
|
207
|
+
);
|
|
208
|
+
return `
|
|
196
209
|
<tr>
|
|
197
210
|
<td
|
|
198
|
-
${
|
|
199
|
-
class="esd-block-text product-custom-attribute"
|
|
200
|
-
esd-extension-block-id="${
|
|
201
|
-
align="left">
|
|
202
|
-
|
|
211
|
+
${R}="${r}"
|
|
212
|
+
class="esd-block-text product-custom-attribute${l != null && l.cellClasses ? ` ${l.cellClasses}` : ""}"
|
|
213
|
+
esd-extension-block-id="${t.CUSTOM_ATTRIBUTE}"${d(l == null ? void 0 : l.cellBackgroundColor)}
|
|
214
|
+
align="${(l == null ? void 0 : l.cellAlignment) ?? "left"}">
|
|
215
|
+
${a}
|
|
203
216
|
</td>
|
|
204
217
|
</tr>
|
|
205
|
-
|
|
218
|
+
`;
|
|
219
|
+
}
|
|
206
220
|
};
|
|
207
221
|
export {
|
|
208
|
-
|
|
209
|
-
y as renderInlineListPriceRow,
|
|
210
|
-
R as renderListOldPriceRow
|
|
222
|
+
V as listElementRenderer
|
|
211
223
|
};
|
|
@@ -1,22 +1,23 @@
|
|
|
1
|
-
import { ATTR_PRODUCT_IMAGE as
|
|
2
|
-
import {
|
|
3
|
-
import { listElementRenderer as
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { ATTR_PRODUCT_IMAGE as b, ATTR_PRODUCT_BUTTON as s } from "../../constants/selectors.js";
|
|
2
|
+
import { buildSpacer as I, DEFAULT_CARD_COMPOSITION as O, buildElementRenderer as T, DEFAULT_CARD_VISIBILITY as S } from "../utils.js";
|
|
3
|
+
import { listElementRenderer as N } from "./elementRenderer.js";
|
|
4
|
+
const L = "0 5px";
|
|
5
|
+
function U(n, r, e) {
|
|
6
|
+
const l = e ? "" : ' style="display: none;"', a = n.replace(/<tr>/, "").replace(/<\/tr>/, "");
|
|
6
7
|
return `<tr
|
|
7
8
|
class="recommendation-attribute-row"
|
|
8
9
|
data-attribute-type="${r}"
|
|
9
|
-
data-visibility="${
|
|
10
|
+
data-visibility="${e ? "1" : "0"}"${l}>${a}</tr>`;
|
|
10
11
|
}
|
|
11
|
-
const
|
|
12
|
+
const $ = `
|
|
12
13
|
<tr class="recommendation-product-row">
|
|
13
|
-
<td style="padding:
|
|
14
|
+
<td style="padding: {-{-CARD_PADDING-}-};">
|
|
14
15
|
<table
|
|
15
16
|
width="100%"
|
|
16
17
|
cellpadding="0"
|
|
17
18
|
cellspacing="0"
|
|
18
19
|
border="0"
|
|
19
|
-
class="product-card-wrapper">
|
|
20
|
+
class="product-card-wrapper"{-{-WRAPPER_STYLE-}-}>
|
|
20
21
|
<tbody>
|
|
21
22
|
<tr>
|
|
22
23
|
{-{-PRODUCT_CONTENT-}-}
|
|
@@ -26,29 +27,49 @@ const _ = `
|
|
|
26
27
|
</td>
|
|
27
28
|
</tr>
|
|
28
29
|
`;
|
|
29
|
-
function
|
|
30
|
-
const {
|
|
30
|
+
function x(n, r = O, e = {}, l = {}) {
|
|
31
|
+
const {
|
|
32
|
+
cellPadding: a = L,
|
|
33
|
+
styleTemplates: o,
|
|
34
|
+
cardBackgroundColor: p,
|
|
35
|
+
cellBackgroundColors: c,
|
|
36
|
+
cellAlignments: d,
|
|
37
|
+
cellClasses: i,
|
|
38
|
+
omnibusTexts: R,
|
|
39
|
+
visibility: C
|
|
40
|
+
} = l, D = p ? ` style="background-color: ${p};"` : "", u = T(N, r, e), _ = { styleTemplate: o == null ? void 0 : o[b] }, P = u[b](n, _), m = `
|
|
31
41
|
<td class="product-info-cell" valign="middle" style="padding: 15px;">
|
|
32
42
|
<table cellpadding="0" cellspacing="0" role="presentation" width="100%" style="table-layout: fixed;">
|
|
33
43
|
<tbody>
|
|
34
|
-
${r.filter((
|
|
35
|
-
const
|
|
36
|
-
|
|
44
|
+
${r.filter((t) => t !== b && t !== s).filter((t) => u[t]).map((t) => {
|
|
45
|
+
const w = (C == null ? void 0 : C[t]) ?? S[t] ?? !0, E = u[t](n, {
|
|
46
|
+
styleTemplate: o == null ? void 0 : o[t],
|
|
47
|
+
cellBackgroundColor: c == null ? void 0 : c[t],
|
|
48
|
+
cellAlignment: d == null ? void 0 : d[t],
|
|
49
|
+
cellClasses: i == null ? void 0 : i[t],
|
|
50
|
+
omnibusText: R == null ? void 0 : R[t]
|
|
51
|
+
});
|
|
52
|
+
return U(E, t, w);
|
|
37
53
|
}).join(`
|
|
38
54
|
`)}
|
|
39
55
|
</tbody>
|
|
40
56
|
</table>
|
|
41
57
|
</td>
|
|
42
|
-
`,
|
|
43
|
-
|
|
58
|
+
`, A = {
|
|
59
|
+
styleTemplate: o == null ? void 0 : o[s],
|
|
60
|
+
cellAlignment: d == null ? void 0 : d[s],
|
|
61
|
+
cellClasses: i == null ? void 0 : i[s]
|
|
62
|
+
}, f = u[s](n, A), g = P + m + f;
|
|
63
|
+
return $.replace("{-{-CARD_PADDING-}-}", a).replace("{-{-WRAPPER_STYLE-}-}", D).replace("{-{-PRODUCT_CONTENT-}-}", g);
|
|
44
64
|
}
|
|
45
|
-
function
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
65
|
+
function B(n, r, e = {}, l = {}) {
|
|
66
|
+
const a = I(l.rowSpacingPx);
|
|
67
|
+
return n.map((o, p) => {
|
|
68
|
+
const c = x(o, r, e, l);
|
|
69
|
+
return p > 0 ? a + c : c;
|
|
49
70
|
}).join("");
|
|
50
71
|
}
|
|
51
72
|
export {
|
|
52
|
-
|
|
53
|
-
|
|
73
|
+
x as getListProductCard,
|
|
74
|
+
B as prepareProductRows
|
|
54
75
|
};
|