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