@useinsider/guido 3.8.2-beta.189e91c → 3.8.2
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/recommendationCompilerRules.js +1 -1
- package/dist/config/compiler/utils/recommendationCompilerUtils.js +80 -88
- package/dist/config/migrator/recommendation/htmlBuilder.js +52 -53
- 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/controls/cardComposition/index.js +264 -345
- package/dist/extensions/Blocks/Recommendation/controls/main/index.js +87 -99
- package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +160 -162
- package/dist/extensions/Blocks/Recommendation/extension.js +29 -30
- 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 +1 -3
- package/dist/extensions/Blocks/Recommendation/templates/grid/elementRenderer.js +96 -130
- package/dist/extensions/Blocks/Recommendation/templates/grid/template.js +54 -43
- package/dist/extensions/Blocks/Recommendation/templates/index.js +14 -17
- package/dist/extensions/Blocks/Recommendation/templates/list/elementRenderer.js +80 -86
- package/dist/extensions/Blocks/Recommendation/templates/list/template.js +40 -31
- package/dist/extensions/Blocks/Recommendation/templates/utils.js +102 -155
- 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/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 +1 -13
- 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 +1 -10
- package/dist/src/extensions/Blocks/Recommendation/templates/list/template.d.ts +3 -3
- package/dist/src/extensions/Blocks/Recommendation/templates/utils.d.ts +1 -51
- 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 -111
- package/dist/extensions/Blocks/Recommendation/canvasPreview.css.js +0 -16
- 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,8 +1,8 @@
|
|
|
1
1
|
import r from "../../../static/assets/info.svg.js";
|
|
2
|
-
import { IconsRegistry as
|
|
3
|
-
class h extends
|
|
4
|
-
registerIconsSvg(
|
|
5
|
-
|
|
2
|
+
import { IconsRegistry as t } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
3
|
+
class h extends t {
|
|
4
|
+
registerIconsSvg(C) {
|
|
5
|
+
C["recommendation-icon"] = `
|
|
6
6
|
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20" fill="none">
|
|
7
7
|
<path d="M10 4.4C10 4.73137 9.73012 4.99622 9.40108 5.0355C6.92202 5.33143 5 7.44126 5 10C5 12.5587
|
|
8
8
|
6.92202 14.6686 9.40108 14.9645C9.73012 15.0038 10 15.2686 10 15.6V18.4C10 18.7314 9.73137 19 9.4
|
|
@@ -44,14 +44,14 @@ class h extends C {
|
|
|
44
44
|
3.40029 12.0082 3.25285 11.7656 3.15234C11.365 2.98638 11.0001 2.64849 11 2.21484V2Z"
|
|
45
45
|
fill="currentColor"/>
|
|
46
46
|
</svg>
|
|
47
|
-
`,
|
|
47
|
+
`, C["grid-orientation"] = `
|
|
48
48
|
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20" fill="currentColor">
|
|
49
49
|
<rect x="1" y="1" width="7" height="7" rx="1" stroke="currentColor" stroke-width="2" fill="none"/>
|
|
50
50
|
<rect x="12" y="1" width="7" height="7" rx="1" stroke="currentColor" stroke-width="2" fill="none"/>
|
|
51
51
|
<rect x="1" y="12" width="7" height="7" rx="1" stroke="currentColor" stroke-width="2" fill="none"/>
|
|
52
52
|
<rect x="12" y="12" width="7" height="7" rx="1" stroke="currentColor" stroke-width="2" fill="none"/>
|
|
53
53
|
</svg>
|
|
54
|
-
`,
|
|
54
|
+
`, C["list-orientation"] = `
|
|
55
55
|
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20" fill="currentColor">
|
|
56
56
|
<circle cx="3" cy="4" r="1" stroke="currentColor" stroke-width="1"/>
|
|
57
57
|
<rect x="7" y="3" width="11" height="2" rx="1"/>
|
|
@@ -60,21 +60,7 @@ class h extends C {
|
|
|
60
60
|
<circle cx="3" cy="16" r="1" stroke="currentColor" stroke-width="1"/>
|
|
61
61
|
<rect x="7" y="15" width="11" height="2" rx="1"/>
|
|
62
62
|
</svg>
|
|
63
|
-
`,
|
|
64
|
-
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20" fill="currentColor">
|
|
65
|
-
<path d="M19 10V16C19 16.5523 18.5523 17 18 17H2C1.44772 17 1 16.5523 1 16V10H19Z"
|
|
66
|
-
stroke="currentColor" stroke-width="2" fill="none"/>
|
|
67
|
-
<path d="M2 3H18C18.5523 3 19 3.44772 19 4V10H1V4C1 3.44772 1.44772 3 2 3Z" stroke="currentColor"
|
|
68
|
-
stroke-width="2" fill="none"/>
|
|
69
|
-
</svg>
|
|
70
|
-
`, t["horizontal-orientation"] = `
|
|
71
|
-
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20">
|
|
72
|
-
<path d="M10 19H4C3.44772 19 3 18.5523 3 18V2C3 1.44772 3.44772 1 4 1H10V19Z" stroke="currentColor"
|
|
73
|
-
stroke-width="2" fill="none"/>
|
|
74
|
-
<path d="M17 2V18C17 18.5523 16.5523 19 16 19H10V1H16C16.5523 1 17 1.44772 17 2Z" stroke="currentColor"
|
|
75
|
-
stroke-width="2" fill="none"/>
|
|
76
|
-
</svg>
|
|
77
|
-
`, t["migration-info-icon"] = r;
|
|
63
|
+
`, C["migration-info-icon"] = r;
|
|
78
64
|
}
|
|
79
65
|
}
|
|
80
66
|
export {
|
|
@@ -18,13 +18,6 @@ const n = `/* Utils */
|
|
|
18
18
|
padding: 0
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
/* Group the two price-placement rows (orientation + hide-if-same) into one
|
|
22
|
-
container — drop the divider the editor adds between stacked setting rows.
|
|
23
|
-
Ancestor added so this out-specifies the editor's \`.two-columns:not(:first-child)\`. */
|
|
24
|
-
.recommendation-controls-container .price-placement-control-container .container.two-columns {
|
|
25
|
-
border-top: none;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
21
|
/* Right-align the mobile layout toggle within the two-column grid */
|
|
29
22
|
.product-layout-control-container ue-switcher {
|
|
30
23
|
justify-self: end;
|
|
@@ -150,68 +143,15 @@ ue-orderable.orderable-disabled .droppable-icon {
|
|
|
150
143
|
color: var(--guido-color-danger-500);
|
|
151
144
|
}
|
|
152
145
|
|
|
153
|
-
/*
|
|
154
|
-
.orderable-
|
|
155
|
-
|
|
156
|
-
align-items: stretch;
|
|
157
|
-
gap: 8px;
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
.price-group-header {
|
|
161
|
-
display: flex;
|
|
162
|
-
align-items: center;
|
|
163
|
-
gap: 4px;
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
.price-suborderable-list {
|
|
167
|
-
display: flex;
|
|
168
|
-
flex-direction: column;
|
|
169
|
-
margin-left: 4px;
|
|
170
|
-
padding-left: 8px;
|
|
171
|
-
border-left: 2px solid #eee;
|
|
146
|
+
/* Disable drag for list layout */
|
|
147
|
+
.orderable-list.orderable-disabled .drag-handle {
|
|
148
|
+
display: none;
|
|
172
149
|
}
|
|
173
150
|
|
|
174
|
-
.
|
|
175
|
-
display: flex;
|
|
176
|
-
align-items: center;
|
|
177
|
-
gap: 4px;
|
|
178
|
-
padding: 8px 0;
|
|
179
|
-
background: var(--guido-color-white);
|
|
151
|
+
.orderable-list.orderable-disabled .orderable-item {
|
|
180
152
|
cursor: default;
|
|
181
|
-
transition: background 0.15s;
|
|
182
|
-
box-sizing: border-box;
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
.price-suborderable-item:hover {
|
|
186
|
-
background: #fafafa;
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
.price-suborderable-item.dragging {
|
|
190
|
-
opacity: 0.5;
|
|
191
|
-
background: var(--guido-color-gray-1);
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
.price-suborderable-item.drag-over {
|
|
195
|
-
border-top: 2px solid var(--guido-color-primary-500, #0A2ECC);
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
.price-suborderable-item .item-label {
|
|
199
|
-
font-size: 13px;
|
|
200
153
|
}
|
|
201
154
|
|
|
202
|
-
.sub-drag-handle {
|
|
203
|
-
display: flex;
|
|
204
|
-
align-items: center;
|
|
205
|
-
justify-content: center;
|
|
206
|
-
flex-shrink: 0;
|
|
207
|
-
width: 24px;
|
|
208
|
-
height: 24px;
|
|
209
|
-
cursor: move;
|
|
210
|
-
user-select: none;
|
|
211
|
-
color: var(--guido-color-gray-600);
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
|
|
215
155
|
/* ─── Migration Info Box ─────────────────────────────────────────────── */
|
|
216
156
|
/* Shown in the settings panel title when a block was migrated from legacy */
|
|
217
157
|
|
|
@@ -1,83 +1,51 @@
|
|
|
1
|
-
import { RecommendationBlockId as
|
|
2
|
-
import { ATTR_PRODUCT_ATTR as
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
pStyle: "font-size: 14px; color: #999999;",
|
|
10
|
-
openTags: "<s><strong>",
|
|
11
|
-
closeTags: "</strong></s>"
|
|
12
|
-
};
|
|
13
|
-
function Q(c, e = g) {
|
|
14
|
-
return `<td class="${$}" style="padding: ${e};" width="${c}%"></td>`;
|
|
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>`;
|
|
15
9
|
}
|
|
16
|
-
function
|
|
17
|
-
const l =
|
|
10
|
+
function u(r, e = "") {
|
|
11
|
+
const l = Y(e, r);
|
|
18
12
|
return `<table class="product-card-segment" width="100%" height="100%" cellpadding="0" cellspacing="0" border="0"${l ? ` style="${l}"` : ""}>`;
|
|
19
13
|
}
|
|
20
|
-
function
|
|
21
|
-
const r =
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
${C(
|
|
38
|
-
u,
|
|
39
|
-
f,
|
|
40
|
-
a == null ? void 0 : a.styleTemplate
|
|
41
|
-
)}
|
|
42
|
-
</td>`, k = e ? m("es-p15l es-p5r") : x("es-p15l es-p5r"), R = e ? x("es-p5l es-p15r") : m("es-p5l es-p15r");
|
|
43
|
-
return `
|
|
44
|
-
<td class="${$}" style="padding: ${g}; height: 100%;" valign="top">
|
|
45
|
-
${b(d)}
|
|
46
|
-
<tbody>
|
|
47
|
-
<tr valign="top">
|
|
48
|
-
<td align="center">
|
|
49
|
-
<table cellpadding="0" cellspacing="0" border="0" align="center" style="margin: 0 auto;">
|
|
50
|
-
<tbody>
|
|
51
|
-
<tr valign="middle">
|
|
52
|
-
${k}
|
|
53
|
-
${R}
|
|
54
|
-
</tr>
|
|
55
|
-
</tbody>
|
|
56
|
-
</table>
|
|
57
|
-
</td>
|
|
58
|
-
</tr>
|
|
59
|
-
</tbody>
|
|
60
|
-
</table>
|
|
61
|
-
</td>
|
|
62
|
-
`;
|
|
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
|
+
};
|
|
24
|
+
}
|
|
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
|
+
});
|
|
63
31
|
}
|
|
64
32
|
const W = {
|
|
65
|
-
[
|
|
66
|
-
var
|
|
67
|
-
const l = (e == null ? void 0 : e.cellPadding) ??
|
|
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;
|
|
68
36
|
return `
|
|
69
|
-
<td class="${
|
|
70
|
-
${
|
|
37
|
+
<td class="${t}" style="padding: ${l}; height: 100%;" valign="top">
|
|
38
|
+
${u(e == null ? void 0 : e.cardBackgroundColor)}
|
|
71
39
|
<tbody>
|
|
72
40
|
<tr valign="top">
|
|
73
41
|
<td
|
|
74
42
|
class="esd-block-image product-image"
|
|
75
43
|
align="center"
|
|
76
|
-
esd-extension-block-id="${
|
|
77
|
-
<a target="_blank" href="${
|
|
44
|
+
esd-extension-block-id="${b.IMAGE}">
|
|
45
|
+
<a target="_blank" href="${r.url}" class="${f}">
|
|
78
46
|
<img
|
|
79
|
-
src="${
|
|
80
|
-
alt="${
|
|
47
|
+
src="${w(r.image_url)}"
|
|
48
|
+
alt="${r.name}"
|
|
81
49
|
style="${a}"
|
|
82
50
|
class="adapt-img">
|
|
83
51
|
</a>
|
|
@@ -88,21 +56,21 @@ const W = {
|
|
|
88
56
|
</td>
|
|
89
57
|
`;
|
|
90
58
|
},
|
|
91
|
-
[
|
|
92
|
-
const l = (e == null ? void 0 : e.cellPadding) ??
|
|
93
|
-
|
|
59
|
+
[E]: (r, e) => {
|
|
60
|
+
const l = (e == null ? void 0 : e.cellPadding) ?? d, a = T(
|
|
61
|
+
r.name,
|
|
94
62
|
{ pStyle: "font-size: 16px; color: #333333;", openTags: "<strong>", closeTags: "</strong>" },
|
|
95
63
|
e == null ? void 0 : e.styleTemplate
|
|
96
64
|
);
|
|
97
65
|
return `
|
|
98
|
-
<td class="${
|
|
99
|
-
${
|
|
66
|
+
<td class="${t}" style="padding: ${l}; height: 100%;" valign="middle">
|
|
67
|
+
${u(e == null ? void 0 : e.cardBackgroundColor, "table-layout: fixed;")}
|
|
100
68
|
<tbody>
|
|
101
69
|
<tr valign="top">
|
|
102
70
|
<td
|
|
103
71
|
class="esd-block-text product-name ${(e == null ? void 0 : e.cellClasses) ?? "es-p10t es-p10b es-p15l es-p15r"}"
|
|
104
72
|
align="${(e == null ? void 0 : e.cellAlignment) ?? "center"}"
|
|
105
|
-
esd-extension-block-id="${
|
|
73
|
+
esd-extension-block-id="${b.NAME}"${$(e == null ? void 0 : e.cellBackgroundColor)}>
|
|
106
74
|
${a}
|
|
107
75
|
</td>
|
|
108
76
|
</tr>
|
|
@@ -111,21 +79,21 @@ const W = {
|
|
|
111
79
|
</td>
|
|
112
80
|
`;
|
|
113
81
|
},
|
|
114
|
-
[
|
|
115
|
-
const l = (e == null ? void 0 : e.cellPadding) ??
|
|
116
|
-
|
|
117
|
-
|
|
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>" },
|
|
118
86
|
e == null ? void 0 : e.styleTemplate
|
|
119
87
|
);
|
|
120
88
|
return `
|
|
121
|
-
<td class="${
|
|
122
|
-
${
|
|
89
|
+
<td class="${t}" style="padding: ${l}; height: 100%;" valign="top">
|
|
90
|
+
${u(e == null ? void 0 : e.cardBackgroundColor)}
|
|
123
91
|
<tbody>
|
|
124
92
|
<tr valign="top">
|
|
125
93
|
<td
|
|
126
94
|
class="esd-block-text product-price ${(e == null ? void 0 : e.cellClasses) ?? "es-p15l es-p15r"}"
|
|
127
95
|
align="${(e == null ? void 0 : e.cellAlignment) ?? "center"}"
|
|
128
|
-
esd-extension-block-id="${
|
|
96
|
+
esd-extension-block-id="${b.PRICE}"${$(e == null ? void 0 : e.cellBackgroundColor)}>
|
|
129
97
|
${a}
|
|
130
98
|
</td>
|
|
131
99
|
</tr>
|
|
@@ -134,22 +102,21 @@ const W = {
|
|
|
134
102
|
</td>
|
|
135
103
|
`;
|
|
136
104
|
},
|
|
137
|
-
[
|
|
138
|
-
const l = (e == null ? void 0 : e.cellPadding) ??
|
|
139
|
-
|
|
140
|
-
|
|
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>" },
|
|
141
109
|
e == null ? void 0 : e.styleTemplate
|
|
142
110
|
);
|
|
143
111
|
return `
|
|
144
|
-
<td class="${
|
|
145
|
-
${
|
|
112
|
+
<td class="${t}" style="padding: ${l}; height: 100%;" valign="top">
|
|
113
|
+
${u(e == null ? void 0 : e.cardBackgroundColor)}
|
|
146
114
|
<tbody>
|
|
147
115
|
<tr valign="top">
|
|
148
116
|
<td
|
|
149
117
|
class="esd-block-text product-old-price ${(e == null ? void 0 : e.cellClasses) ?? "es-p15l es-p15r"}"
|
|
150
118
|
align="${(e == null ? void 0 : e.cellAlignment) ?? "center"}"
|
|
151
|
-
|
|
152
|
-
esd-extension-block-id="${t.OLD_PRICE}"${T(e == null ? void 0 : e.cellBackgroundColor)}>
|
|
119
|
+
esd-extension-block-id="${b.OLD_PRICE}"${$(e == null ? void 0 : e.cellBackgroundColor)}>
|
|
153
120
|
${a}
|
|
154
121
|
</td>
|
|
155
122
|
</tr>
|
|
@@ -158,23 +125,23 @@ const W = {
|
|
|
158
125
|
</td>
|
|
159
126
|
`;
|
|
160
127
|
},
|
|
161
|
-
[
|
|
162
|
-
const l = (e == null ? void 0 : e.cellPadding) ??
|
|
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: ");
|
|
163
130
|
return `
|
|
164
|
-
<td class="${
|
|
165
|
-
${
|
|
131
|
+
<td class="${t}" style="padding: ${l}; height: 100%;" valign="top">
|
|
132
|
+
${u(e == null ? void 0 : e.cardBackgroundColor)}
|
|
166
133
|
<tbody>
|
|
167
134
|
<tr valign="top">
|
|
168
135
|
<td
|
|
169
136
|
class="esd-block-text product-omnibus-price ${(e == null ? void 0 : e.cellClasses) ?? "es-p15l es-p15r"}"
|
|
170
137
|
align="${(e == null ? void 0 : e.cellAlignment) ?? "center"}"
|
|
171
|
-
data-text-before="${
|
|
172
|
-
data-text-after="${
|
|
173
|
-
esd-extension-block-id="${
|
|
138
|
+
data-text-before="${c}"
|
|
139
|
+
data-text-after="${g}"
|
|
140
|
+
esd-extension-block-id="${b.OMNIBUS_PRICE}"${$(e == null ? void 0 : e.cellBackgroundColor)}>
|
|
174
141
|
<p contenteditable="false" style="${a}">
|
|
175
|
-
<span class="omnibus-text-before">${
|
|
176
|
-
<span class="omnibus-price-value">${
|
|
177
|
-
<span class="omnibus-text-after">${
|
|
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>
|
|
178
145
|
</p>
|
|
179
146
|
</td>
|
|
180
147
|
</tr>
|
|
@@ -183,24 +150,24 @@ const W = {
|
|
|
183
150
|
</td>
|
|
184
151
|
`;
|
|
185
152
|
},
|
|
186
|
-
[
|
|
187
|
-
var
|
|
188
|
-
const l = (e == null ? void 0 : e.cellPadding) ??
|
|
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);
|
|
189
156
|
return `
|
|
190
|
-
<td class="${
|
|
191
|
-
${
|
|
157
|
+
<td class="${t}" style="padding: ${l}; height: 100%;" valign="top">
|
|
158
|
+
${u(e == null ? void 0 : e.cardBackgroundColor)}
|
|
192
159
|
<tbody>
|
|
193
160
|
<tr valign="top">
|
|
194
161
|
<td
|
|
195
162
|
class="esd-block-text product-omnibus-discount ${(e == null ? void 0 : e.cellClasses) ?? "es-p15l es-p15r"}"
|
|
196
163
|
align="${(e == null ? void 0 : e.cellAlignment) ?? "center"}"
|
|
197
|
-
data-text-before="${
|
|
198
|
-
data-text-after="${
|
|
199
|
-
esd-extension-block-id="${
|
|
164
|
+
data-text-before="${_}"
|
|
165
|
+
data-text-after="${n}"
|
|
166
|
+
esd-extension-block-id="${b.OMNIBUS_DISCOUNT}"${$(e == null ? void 0 : e.cellBackgroundColor)}>
|
|
200
167
|
<p contenteditable="false" style="${a}">
|
|
201
|
-
<span class="omnibus-text-before">${
|
|
202
|
-
<span class="omnibus-discount-value">${
|
|
203
|
-
<span class="omnibus-text-after">${
|
|
168
|
+
<span class="omnibus-text-before">${_}</span>
|
|
169
|
+
<span class="omnibus-discount-value">${B}</span>
|
|
170
|
+
<span class="omnibus-text-after">${n}</span>
|
|
204
171
|
</p>
|
|
205
172
|
</td>
|
|
206
173
|
</tr>
|
|
@@ -209,24 +176,24 @@ const W = {
|
|
|
209
176
|
</td>
|
|
210
177
|
`;
|
|
211
178
|
},
|
|
212
|
-
[
|
|
213
|
-
const l = (e == null ? void 0 : e.cellPadding) ??
|
|
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);
|
|
214
181
|
return `
|
|
215
|
-
<td class="${
|
|
216
|
-
${
|
|
182
|
+
<td class="${t}" style="padding: ${l}; height: 100%;" valign="top">
|
|
183
|
+
${u(e == null ? void 0 : e.cardBackgroundColor)}
|
|
217
184
|
<tbody>
|
|
218
185
|
<tr valign="top">
|
|
219
186
|
<td
|
|
220
187
|
class="esd-block-button product-button ${(e == null ? void 0 : e.cellClasses) ?? "es-p10t es-p10b"}"
|
|
221
188
|
align="${(e == null ? void 0 : e.cellAlignment) ?? "center"}"
|
|
222
|
-
esd-extension-block-id="${
|
|
223
|
-
<span class="${
|
|
189
|
+
esd-extension-block-id="${b.BUTTON}">
|
|
190
|
+
<span class="${G(a)}" style="${c}">
|
|
224
191
|
<a
|
|
225
192
|
href="#"
|
|
226
|
-
class="es-button ${
|
|
193
|
+
class="es-button ${f}"
|
|
227
194
|
target="_blank"
|
|
228
|
-
style="${
|
|
229
|
-
${
|
|
195
|
+
style="${g}">
|
|
196
|
+
${y}
|
|
230
197
|
</a>
|
|
231
198
|
</span>
|
|
232
199
|
</td>
|
|
@@ -243,23 +210,23 @@ const W = {
|
|
|
243
210
|
* @param productAttrValue - Resolved product-attr value (e.g., "brand" for default, "product_attribute.rating_star" for custom)
|
|
244
211
|
* @param content - Display content for the cell
|
|
245
212
|
*/
|
|
246
|
-
[
|
|
247
|
-
const a = (l == null ? void 0 : l.cellPadding) ??
|
|
213
|
+
[N]: (r, e, l) => {
|
|
214
|
+
const a = (l == null ? void 0 : l.cellPadding) ?? d, c = T(
|
|
248
215
|
e,
|
|
249
216
|
{ pStyle: "font-size: 12px; color: #666666;", openTags: "", closeTags: "" },
|
|
250
217
|
l == null ? void 0 : l.styleTemplate
|
|
251
218
|
);
|
|
252
219
|
return `
|
|
253
|
-
<td class="${
|
|
254
|
-
${
|
|
220
|
+
<td class="${t}" style="padding: ${a}; height: 100%;" valign="middle">
|
|
221
|
+
${u(l == null ? void 0 : l.cardBackgroundColor, "table-layout: fixed;")}
|
|
255
222
|
<tbody>
|
|
256
223
|
<tr valign="top">
|
|
257
224
|
<td
|
|
258
|
-
${
|
|
225
|
+
${k}="${r}"
|
|
259
226
|
class="esd-block-text product-custom-attribute ${(l == null ? void 0 : l.cellClasses) ?? "es-p0t es-p0b es-p15l es-p15r"}"
|
|
260
227
|
align="${(l == null ? void 0 : l.cellAlignment) ?? "center"}"
|
|
261
|
-
esd-extension-block-id="${
|
|
262
|
-
${
|
|
228
|
+
esd-extension-block-id="${b.CUSTOM_ATTRIBUTE}"${$(l == null ? void 0 : l.cellBackgroundColor)}>
|
|
229
|
+
${c}
|
|
263
230
|
</td>
|
|
264
231
|
</tr>
|
|
265
232
|
</tbody>
|
|
@@ -269,9 +236,8 @@ const W = {
|
|
|
269
236
|
}
|
|
270
237
|
};
|
|
271
238
|
export {
|
|
272
|
-
|
|
273
|
-
|
|
239
|
+
t as ATTRIBUTE_CELL_CLASS,
|
|
240
|
+
d as DEFAULT_CELL_PADDING,
|
|
274
241
|
Q as buildFillerCell,
|
|
275
|
-
W as gridElementRenderer
|
|
276
|
-
V as renderInlineGridPriceCell
|
|
242
|
+
W as gridElementRenderer
|
|
277
243
|
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { DEFAULT_PRODUCTS_PER_ROW as
|
|
3
|
-
import { getDefaultProducts as A, DEFAULTS as
|
|
4
|
-
import { DEFAULT_CELL_PADDING as
|
|
5
|
-
const
|
|
1
|
+
import "../../constants/selectors.js";
|
|
2
|
+
import { DEFAULT_PRODUCTS_PER_ROW as f } from "../../constants/layout.js";
|
|
3
|
+
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";
|
|
4
|
+
import { DEFAULT_CELL_PADDING as h, buildFillerCell as B, gridElementRenderer as F } from "./elementRenderer.js";
|
|
5
|
+
const W = `
|
|
6
6
|
<tr class="recommendation-product-row">
|
|
7
7
|
<td>
|
|
8
8
|
<table
|
|
@@ -19,7 +19,7 @@ const G = `
|
|
|
19
19
|
</table>
|
|
20
20
|
</td>
|
|
21
21
|
</tr>
|
|
22
|
-
`,
|
|
22
|
+
`, k = `
|
|
23
23
|
<tr
|
|
24
24
|
class="recommendation-attribute-row"
|
|
25
25
|
data-attribute-type="{-{-ATTR_TYPE-}-}"
|
|
@@ -28,53 +28,64 @@ const G = `
|
|
|
28
28
|
{-{-CELLS-}-}
|
|
29
29
|
</tr>
|
|
30
30
|
`;
|
|
31
|
-
function
|
|
32
|
-
const {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
31
|
+
function H(e, r, c, o = O, n = {}, p = {}) {
|
|
32
|
+
const {
|
|
33
|
+
cellPadding: a = h,
|
|
34
|
+
styleTemplates: s,
|
|
35
|
+
cardBackgroundColor: T,
|
|
36
|
+
cellBackgroundColors: l,
|
|
37
|
+
cellAlignments: d,
|
|
38
|
+
cellClasses: u,
|
|
39
|
+
omnibusTexts: i,
|
|
40
|
+
visibility: R
|
|
41
|
+
} = p, m = (100 / r).toFixed(2), I = r - e.length, S = I > 0 ? B(m, a).repeat(I) : "", L = U(c, o, n);
|
|
42
|
+
return o.filter((t) => L[t]).map((t) => {
|
|
43
|
+
const E = (R == null ? void 0 : R[t]) ?? Y[t] ?? !0, b = E ? "" : 'style="display: none;"', _ = {
|
|
44
|
+
cellPadding: a,
|
|
45
|
+
cardBackgroundColor: T,
|
|
46
|
+
cellBackgroundColor: l == null ? void 0 : l[t],
|
|
47
|
+
cellAlignment: d == null ? void 0 : d[t],
|
|
48
|
+
cellClasses: u == null ? void 0 : u[t],
|
|
49
|
+
omnibusText: i == null ? void 0 : i[t],
|
|
50
|
+
styleTemplate: s == null ? void 0 : s[t]
|
|
51
|
+
}, w = e.map((D) => L[t](D, _).replace("<td", `<td width="${m}%"`)).join("");
|
|
52
|
+
return k.replace("{-{-ATTR_TYPE-}-}", t).replace("{-{-VISIBILITY-}-}", E ? "1" : "0").replace("{-{-DISPLAY_STYLE-}-}", b).replace("{-{-CELLS-}-}", w + S);
|
|
42
53
|
}).join("");
|
|
43
54
|
}
|
|
44
|
-
function
|
|
45
|
-
const
|
|
46
|
-
for (let
|
|
47
|
-
|
|
48
|
-
const
|
|
49
|
-
return
|
|
50
|
-
const
|
|
51
|
-
|
|
52
|
-
t,
|
|
53
|
-
n,
|
|
55
|
+
function x(e, r, c, o, n = {}, p = {}) {
|
|
56
|
+
const a = [];
|
|
57
|
+
for (let l = 0; l < e.length; l += r)
|
|
58
|
+
a.push(e.slice(l, l + r));
|
|
59
|
+
const s = P(p.rowSpacingPx);
|
|
60
|
+
return a.map((l, d) => {
|
|
61
|
+
const u = H(
|
|
62
|
+
l,
|
|
54
63
|
r,
|
|
55
64
|
c,
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
65
|
+
o,
|
|
66
|
+
n,
|
|
67
|
+
p
|
|
68
|
+
), i = W.replace("{-{-ATTRIBUTE_ROWS-}-}", u);
|
|
69
|
+
return d > 0 ? s + i : i;
|
|
59
70
|
}).join("");
|
|
60
71
|
}
|
|
61
|
-
function
|
|
62
|
-
return
|
|
72
|
+
function V(e, r, c, o = {}, n = {}) {
|
|
73
|
+
return x(
|
|
63
74
|
e,
|
|
64
|
-
t,
|
|
65
|
-
y,
|
|
66
|
-
n,
|
|
67
75
|
r,
|
|
68
|
-
|
|
76
|
+
F,
|
|
77
|
+
c,
|
|
78
|
+
o,
|
|
79
|
+
n
|
|
69
80
|
);
|
|
70
81
|
}
|
|
71
|
-
function
|
|
72
|
-
const
|
|
73
|
-
return
|
|
82
|
+
function y(e) {
|
|
83
|
+
const r = e ? `ins-recommendation-v3-block-${e}` : void 0, c = g("grid", r), o = A(), n = V(o, f);
|
|
84
|
+
return c.replace("{-{-TITLE-}-}", C.TITLE).replace("{-{-PRODUCT_ROWS-}-}", n).replace("{-{-MOBILE_PRODUCT_ROWS-}-}", "");
|
|
74
85
|
}
|
|
75
86
|
export {
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
87
|
+
y as getDefaultTemplate,
|
|
88
|
+
H as prepareGridAttributeRows,
|
|
89
|
+
x as prepareGridProductRows,
|
|
90
|
+
V as prepareProductRows
|
|
80
91
|
};
|