@useinsider/guido 3.7.2-beta.0ef1511 → 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/config/compiler/utils/recommendationCompilerUtils.js +19 -25
- package/dist/extensions/Blocks/Recommendation/constants/selectors.js +11 -10
- package/dist/extensions/Blocks/Recommendation/controls/main/index.js +24 -26
- 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 +285 -333
- package/dist/extensions/Blocks/Recommendation/extension.js +6 -5
- package/dist/extensions/Blocks/Recommendation/settingsPanel.js +3 -2
- package/dist/extensions/Blocks/Recommendation/templates/grid/elementRenderer.js +142 -173
- package/dist/extensions/Blocks/Recommendation/templates/grid/template.js +56 -30
- package/dist/extensions/Blocks/Recommendation/templates/index.js +29 -8
- package/dist/extensions/Blocks/Recommendation/templates/list/elementRenderer.js +132 -105
- package/dist/extensions/Blocks/Recommendation/templates/list/template.js +44 -23
- package/dist/extensions/Blocks/Recommendation/templates/utils.js +112 -64
- 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/extensions/Blocks/Items/controls/index.d.ts +1 -1
- 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/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/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/template.d.ts +3 -2
- package/dist/src/extensions/Blocks/Recommendation/templates/utils.d.ts +165 -11
- 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/package.json +10 -1
- package/dist/src/composables/validators/useUnsubscribeBlockValidator.test.d.ts +0 -1
- package/dist/src/extensions/Blocks/Recommendation/block.test.d.ts +0 -1
- package/dist/src/extensions/Blocks/Recommendation/utils/recommendationBlockCount.test.d.ts +0 -1
- package/dist/src/extensions/Blocks/Recommendation/utils/stylePreserver.d.ts +0 -113
|
@@ -2,12 +2,13 @@ import { ExtensionBuilder as r } from "../../../node_modules/@stripoinc/ui-edito
|
|
|
2
2
|
import { RecommendationBlock as m } from "./block.js";
|
|
3
3
|
import { RecommendationBlockControl as n } from "./controls/main/index.js";
|
|
4
4
|
import "./store/recommendation.js";
|
|
5
|
+
import "./utils/captureStyleTemplates.js";
|
|
5
6
|
import { NameControls as i } from "./controls/name/index.js";
|
|
6
7
|
import { PriceControls as e } from "./controls/price/index.js";
|
|
7
8
|
import { OldPriceControls as s } from "./controls/oldPrice/index.js";
|
|
8
9
|
import { OmnibusPriceControls as l } from "./controls/omnibusPrice/index.js";
|
|
9
|
-
import { OmnibusDiscountControls as
|
|
10
|
-
import { ButtonControls as
|
|
10
|
+
import { OmnibusDiscountControls as p } from "./controls/omnibusDiscount/index.js";
|
|
11
|
+
import { ButtonControls as a } from "./controls/button/index.js";
|
|
11
12
|
import { ImageControls as c } from "./controls/image/index.js";
|
|
12
13
|
import { CustomAttributeControls as C } from "./controls/customAttribute/index.js";
|
|
13
14
|
import { SpacingControl as f } from "./controls/spacing/index.js";
|
|
@@ -22,8 +23,8 @@ const b = [
|
|
|
22
23
|
e,
|
|
23
24
|
s,
|
|
24
25
|
l,
|
|
25
|
-
a,
|
|
26
26
|
p,
|
|
27
|
+
a,
|
|
27
28
|
c,
|
|
28
29
|
C
|
|
29
30
|
], P = [
|
|
@@ -35,10 +36,10 @@ const b = [
|
|
|
35
36
|
], S = [
|
|
36
37
|
...P,
|
|
37
38
|
...b.flatMap((o) => Object.values(o))
|
|
38
|
-
],
|
|
39
|
+
], L = S.reduce(
|
|
39
40
|
(o, t) => o.addControl(t),
|
|
40
41
|
new r().addBlock(m).withSettingsPanelRegistry(B)
|
|
41
42
|
).addStyles(y).withIconsRegistry(R).build();
|
|
42
43
|
export {
|
|
43
|
-
|
|
44
|
+
L as default
|
|
44
45
|
};
|
|
@@ -4,6 +4,7 @@ import { RecommendationBlockId as S } from "./constants/blockIds.js";
|
|
|
4
4
|
import { RecommendationControlId as T } from "./constants/controlIds.js";
|
|
5
5
|
import { CONTROL_BLOCK_ID as A } from "./controls/main/index.js";
|
|
6
6
|
import "./store/recommendation.js";
|
|
7
|
+
import "./utils/captureStyleTemplates.js";
|
|
7
8
|
import "./controls/name/index.js";
|
|
8
9
|
import "./controls/price/index.js";
|
|
9
10
|
import "./controls/oldPrice/index.js";
|
|
@@ -15,7 +16,7 @@ import { SPACING_CONTROL_ID as L } from "./controls/spacing/index.js";
|
|
|
15
16
|
import { CARD_BACKGROUND_COLOR_CONTROL_ID as D } from "./controls/cardBackground/index.js";
|
|
16
17
|
import { COMPOSITION_CONTROL_BLOCK_ID as B } from "./controls/cardComposition/index.js";
|
|
17
18
|
import { SYNC_INFO_MESSAGE_CONTROL_ID as N } from "./controls/syncInfoMessage.js";
|
|
18
|
-
class
|
|
19
|
+
class a extends E {
|
|
19
20
|
registerBlockControls(I) {
|
|
20
21
|
I[U] = [
|
|
21
22
|
new _(
|
|
@@ -194,5 +195,5 @@ class Z extends E {
|
|
|
194
195
|
}
|
|
195
196
|
}
|
|
196
197
|
export {
|
|
197
|
-
|
|
198
|
+
a as SettingsPanel
|
|
198
199
|
};
|
|
@@ -1,14 +1,18 @@
|
|
|
1
|
-
import { RecommendationBlockId as
|
|
2
|
-
import { ATTR_PRODUCT_ATTR as
|
|
3
|
-
import { useRecommendationExtensionStore as
|
|
4
|
-
import { formatPrice as
|
|
5
|
-
import { CUSTOM_CELL_HTML as
|
|
6
|
-
const
|
|
7
|
-
function
|
|
8
|
-
return `<td class="${
|
|
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>`;
|
|
9
9
|
}
|
|
10
|
-
function
|
|
11
|
-
const
|
|
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;
|
|
12
16
|
return {
|
|
13
17
|
code: e.value,
|
|
14
18
|
symbol: e.symbol,
|
|
@@ -18,34 +22,31 @@ function g() {
|
|
|
18
22
|
thousandSeparator: e.thousandSeparator
|
|
19
23
|
};
|
|
20
24
|
}
|
|
21
|
-
function
|
|
22
|
-
const
|
|
23
|
-
return
|
|
24
|
-
price:
|
|
25
|
-
currency:
|
|
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
|
|
26
30
|
});
|
|
27
31
|
}
|
|
28
|
-
const
|
|
29
|
-
[
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
cellpadding="0"
|
|
36
|
-
cellspacing="0"
|
|
37
|
-
border="0">
|
|
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)}
|
|
38
39
|
<tbody>
|
|
39
40
|
<tr valign="top">
|
|
40
41
|
<td
|
|
41
42
|
class="esd-block-image product-image"
|
|
42
43
|
align="center"
|
|
43
|
-
esd-extension-block-id="${
|
|
44
|
-
<a target="_blank" href="${
|
|
44
|
+
esd-extension-block-id="${b.IMAGE}">
|
|
45
|
+
<a target="_blank" href="${r.url}" class="${f}">
|
|
45
46
|
<img
|
|
46
|
-
src="${
|
|
47
|
-
alt="${
|
|
48
|
-
style="
|
|
47
|
+
src="${w(r.image_url)}"
|
|
48
|
+
alt="${r.name}"
|
|
49
|
+
style="${a}"
|
|
49
50
|
class="adapt-img">
|
|
50
51
|
</a>
|
|
51
52
|
</td>
|
|
@@ -53,134 +54,120 @@ const A = {
|
|
|
53
54
|
</tbody>
|
|
54
55
|
</table>
|
|
55
56
|
</td>
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
57
|
+
`;
|
|
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;")}
|
|
67
68
|
<tbody>
|
|
68
69
|
<tr valign="top">
|
|
69
70
|
<td
|
|
70
|
-
class="esd-block-text product-name es-p10t es-p10b es-p15l es-p15r"
|
|
71
|
-
align="center"
|
|
72
|
-
esd-extension-block-id="${
|
|
73
|
-
|
|
74
|
-
<strong>${t.name}</strong>
|
|
75
|
-
</p>
|
|
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}
|
|
76
75
|
</td>
|
|
77
76
|
</tr>
|
|
78
77
|
</tbody>
|
|
79
78
|
</table>
|
|
80
79
|
</td>
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
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)}
|
|
91
91
|
<tbody>
|
|
92
92
|
<tr valign="top">
|
|
93
93
|
<td
|
|
94
|
-
class="esd-block-text product-price es-p15l es-p15r"
|
|
95
|
-
align="center"
|
|
96
|
-
esd-extension-block-id="${
|
|
97
|
-
|
|
98
|
-
<strong>${i(t, "price")}</strong>
|
|
99
|
-
</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}
|
|
100
98
|
</td>
|
|
101
99
|
</tr>
|
|
102
100
|
</tbody>
|
|
103
101
|
</table>
|
|
104
102
|
</td>
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
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)}
|
|
115
114
|
<tbody>
|
|
116
115
|
<tr valign="top">
|
|
117
116
|
<td
|
|
118
|
-
class="esd-block-text product-old-price es-p15l es-p15r"
|
|
119
|
-
align="center"
|
|
120
|
-
esd-extension-block-id="${
|
|
121
|
-
|
|
122
|
-
contenteditable="false"
|
|
123
|
-
style="font-size: 14px; color: #999999;">
|
|
124
|
-
<s><strong>${i(t, "original_price")}</strong></s>
|
|
125
|
-
</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}
|
|
126
121
|
</td>
|
|
127
122
|
</tr>
|
|
128
123
|
</tbody>
|
|
129
124
|
</table>
|
|
130
125
|
</td>
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
cellpadding="0"
|
|
139
|
-
cellspacing="0"
|
|
140
|
-
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)}
|
|
141
133
|
<tbody>
|
|
142
134
|
<tr valign="top">
|
|
143
135
|
<td
|
|
144
|
-
class="esd-block-text product-omnibus-price es-p15l es-p15r"
|
|
145
|
-
align="center"
|
|
146
|
-
data-text-before="
|
|
147
|
-
data-text-after=""
|
|
148
|
-
esd-extension-block-id="${
|
|
149
|
-
<p contenteditable="false" style="
|
|
150
|
-
<span class="omnibus-text-before"
|
|
151
|
-
<span class="omnibus-price-value">${
|
|
152
|
-
<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>
|
|
153
145
|
</p>
|
|
154
146
|
</td>
|
|
155
147
|
</tr>
|
|
156
148
|
</tbody>
|
|
157
149
|
</table>
|
|
158
150
|
</td>
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
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);
|
|
163
156
|
return `
|
|
164
|
-
<td class="${
|
|
165
|
-
|
|
166
|
-
class="product-card-segment"
|
|
167
|
-
width="100%"
|
|
168
|
-
height="100%"
|
|
169
|
-
cellpadding="0"
|
|
170
|
-
cellspacing="0"
|
|
171
|
-
border="0">
|
|
157
|
+
<td class="${t}" style="padding: ${l}; height: 100%;" valign="top">
|
|
158
|
+
${u(e == null ? void 0 : e.cardBackgroundColor)}
|
|
172
159
|
<tbody>
|
|
173
160
|
<tr valign="top">
|
|
174
161
|
<td
|
|
175
|
-
class="esd-block-text product-omnibus-discount es-p15l es-p15r"
|
|
176
|
-
align="center"
|
|
177
|
-
data-text-before=""
|
|
178
|
-
data-text-after=""
|
|
179
|
-
esd-extension-block-id="${
|
|
180
|
-
<p contenteditable="false" style="
|
|
181
|
-
<span class="omnibus-text-before"
|
|
182
|
-
<span class="omnibus-discount-value">${
|
|
183
|
-
<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>
|
|
184
171
|
</p>
|
|
185
172
|
</td>
|
|
186
173
|
</tr>
|
|
@@ -189,43 +176,24 @@ const A = {
|
|
|
189
176
|
</td>
|
|
190
177
|
`;
|
|
191
178
|
},
|
|
192
|
-
[
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
height="100%"
|
|
198
|
-
cellpadding="0"
|
|
199
|
-
cellspacing="0"
|
|
200
|
-
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)}
|
|
201
184
|
<tbody>
|
|
202
185
|
<tr valign="top">
|
|
203
186
|
<td
|
|
204
|
-
class="esd-block-button product-button es-p10t es-p10b"
|
|
205
|
-
align="center"
|
|
206
|
-
esd-extension-block-id="${
|
|
207
|
-
<span
|
|
208
|
-
class="es-button-border"
|
|
209
|
-
style="
|
|
210
|
-
border-width: 1px;
|
|
211
|
-
background: rgb(217, 234, 211);
|
|
212
|
-
border-color: rgb(106, 168, 79);
|
|
213
|
-
">
|
|
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}">
|
|
214
191
|
<a
|
|
215
192
|
href="#"
|
|
216
|
-
class="es-button ${
|
|
193
|
+
class="es-button ${f}"
|
|
217
194
|
target="_blank"
|
|
218
|
-
style="
|
|
219
|
-
|
|
220
|
-
background: rgb(217, 234, 211);
|
|
221
|
-
font-family: arial, 'helvetica neue', helvetica, sans-serif;
|
|
222
|
-
font-size: 16px;
|
|
223
|
-
font-weight: normal;
|
|
224
|
-
line-height: 120%;
|
|
225
|
-
mso-border-alt: 10px solid rgb(217, 234, 211);
|
|
226
|
-
mso-padding-alt: 0;
|
|
227
|
-
">
|
|
228
|
-
Buy
|
|
195
|
+
style="${g}">
|
|
196
|
+
${y}
|
|
229
197
|
</a>
|
|
230
198
|
</span>
|
|
231
199
|
</td>
|
|
@@ -233,7 +201,8 @@ const A = {
|
|
|
233
201
|
</tbody>
|
|
234
202
|
</table>
|
|
235
203
|
</td>
|
|
236
|
-
|
|
204
|
+
`;
|
|
205
|
+
},
|
|
237
206
|
/**
|
|
238
207
|
* Custom attribute cell template — same structure as built-in entries
|
|
239
208
|
* (outer td → inner product-card-segment table).
|
|
@@ -241,34 +210,34 @@ const A = {
|
|
|
241
210
|
* @param productAttrValue - Resolved product-attr value (e.g., "brand" for default, "product_attribute.rating_star" for custom)
|
|
242
211
|
* @param content - Display content for the cell
|
|
243
212
|
*/
|
|
244
|
-
[
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
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;")}
|
|
254
222
|
<tbody>
|
|
255
223
|
<tr valign="top">
|
|
256
224
|
<td
|
|
257
|
-
${
|
|
258
|
-
class="esd-block-text product-custom-attribute es-p0t es-p0b es-p15l es-p15r"
|
|
259
|
-
align="center"
|
|
260
|
-
esd-extension-block-id="${
|
|
261
|
-
|
|
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}
|
|
262
230
|
</td>
|
|
263
231
|
</tr>
|
|
264
232
|
</tbody>
|
|
265
233
|
</table>
|
|
266
234
|
</td>
|
|
267
|
-
|
|
235
|
+
`;
|
|
236
|
+
}
|
|
268
237
|
};
|
|
269
238
|
export {
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
239
|
+
t as ATTRIBUTE_CELL_CLASS,
|
|
240
|
+
d as DEFAULT_CELL_PADDING,
|
|
241
|
+
Q as buildFillerCell,
|
|
242
|
+
W as gridElementRenderer
|
|
274
243
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { DEFAULT_PRODUCTS_PER_ROW as
|
|
2
|
-
import { getDefaultProducts as
|
|
3
|
-
import { buildFillerCell as
|
|
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 D = `
|
|
|
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,38 +27,64 @@ const D = `
|
|
|
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 l = 0; l <
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
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(
|
|
43
61
|
l,
|
|
44
|
-
e,
|
|
45
|
-
n,
|
|
46
62
|
r,
|
|
47
|
-
c
|
|
48
|
-
|
|
49
|
-
|
|
63
|
+
c,
|
|
64
|
+
o,
|
|
65
|
+
n,
|
|
66
|
+
p
|
|
67
|
+
), a = W.replace("{-{-ATTRIBUTE_ROWS-}-}", u);
|
|
68
|
+
return d > 0 ? s + a : a;
|
|
50
69
|
}).join("");
|
|
51
70
|
}
|
|
52
|
-
function
|
|
53
|
-
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
|
+
);
|
|
54
80
|
}
|
|
55
|
-
function
|
|
56
|
-
const
|
|
57
|
-
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-}-}", "");
|
|
58
84
|
}
|
|
59
85
|
export {
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
86
|
+
$ as getDefaultTemplate,
|
|
87
|
+
H as prepareGridAttributeRows,
|
|
88
|
+
x as prepareGridProductRows,
|
|
89
|
+
V as prepareProductRows
|
|
64
90
|
};
|
|
@@ -1,12 +1,33 @@
|
|
|
1
|
-
import { DEFAULT_PRODUCTS_PER_ROW as
|
|
2
|
-
import { prepareProductRows as
|
|
3
|
-
import { prepareProductRows as
|
|
4
|
-
function
|
|
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
|
+
};
|
|
5
26
|
if (t === "list")
|
|
6
|
-
return
|
|
7
|
-
const { productsPerRow:
|
|
8
|
-
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);
|
|
9
30
|
}
|
|
10
31
|
export {
|
|
11
|
-
|
|
32
|
+
L as prepareProductRows
|
|
12
33
|
};
|