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