@useinsider/guido 3.7.0-beta.b2980d8 → 3.7.0-beta.ec4dd67
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/composables/useHtmlValidator.js +165 -118
- package/dist/config/compiler/utils/recommendationCompilerUtils.js +28 -27
- package/dist/config/compiler/utils/recommendationIgnoreUtils.js +15 -0
- package/dist/config/migrator/recommendation/extractors.js +44 -22
- package/dist/config/migrator/recommendation/htmlBuilder.js +175 -169
- package/dist/config/migrator/recommendationMigrator.js +30 -31
- package/dist/extensions/Blocks/Recommendation/constants/selectors.js +21 -15
- package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +55 -41
- package/dist/extensions/Blocks/Recommendation/controls/main/index.js +39 -38
- package/dist/extensions/Blocks/Recommendation/controls/main/layoutOrientation.js +44 -33
- package/dist/extensions/Blocks/Recommendation/controls/main/productCount.js +3 -2
- package/dist/extensions/Blocks/Recommendation/controls/main/productLayout.js +62 -52
- package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +75 -68
- package/dist/extensions/Blocks/Recommendation/controls/syncInfoMessage.js +7 -6
- package/dist/extensions/Blocks/Recommendation/extension.js +6 -5
- package/dist/extensions/Blocks/Recommendation/settingsPanel.js +3 -2
- package/dist/extensions/Blocks/Recommendation/store/recommendation.js +3 -2
- package/dist/extensions/Blocks/Recommendation/templates/grid/template.js +13 -12
- package/dist/extensions/Blocks/Recommendation/templates/index.js +5 -4
- package/dist/extensions/Blocks/Unsubscribe/block.js +72 -122
- package/dist/extensions/Blocks/Unsubscribe/template.js +4 -4
- package/dist/src/composables/useHtmlValidator.d.ts +27 -0
- package/dist/src/composables/useHtmlValidator.test.d.ts +1 -0
- package/dist/src/config/compiler/utils/recommendationIgnoreUtils.d.ts +17 -0
- package/dist/src/config/compiler/utils/recommendationIgnoreUtils.test.d.ts +1 -0
- package/dist/src/config/migrator/recommendation/extractors.d.ts +15 -0
- package/dist/src/config/migrator/recommendation/htmlBuilder.d.ts +8 -0
- package/dist/src/extensions/Blocks/Recommendation/constants/index.d.ts +1 -1
- package/dist/src/extensions/Blocks/Recommendation/constants/selectors.d.ts +21 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/cardComposition/index.d.ts +7 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/main/layoutOrientation.d.ts +5 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/main/productLayout.d.ts +6 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/main/utils.d.ts +9 -0
- package/dist/src/extensions/Blocks/Unsubscribe/block.d.ts +0 -9
- package/package.json +1 -1
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { RecommendationBlockId as g } from "../../../extensions/Blocks/Recommendation/constants/blockIds.js";
|
|
2
|
-
import { CURRENCY_ATTR as
|
|
3
|
-
import { formatPrice as
|
|
4
|
-
import { escapeHtml as
|
|
2
|
+
import { CSS_CLASS_SKIP_COMPILE as ot, CURRENCY_ATTR as P, ATTR_PRODUCT_IMAGE as O, ATTR_PRODUCT_BUTTON as k, CSS_CLASS_RECO_BUTTON as H, ATTR_PRODUCT_NAME as j, ATTR_PRODUCT_PRICE as V, ATTR_PRODUCT_OLD_PRICE as Y, ATTR_PRODUCT_OMNIBUS_PRICE as M, ATTR_PRODUCT_OMNIBUS_DISCOUNT as F, ATTR_CUSTOM_PREFIX as E } from "../../../extensions/Blocks/Recommendation/constants/selectors.js";
|
|
3
|
+
import { formatPrice as L } from "../../../extensions/Blocks/Recommendation/utils/priceFormatter.js";
|
|
4
|
+
import { escapeHtml as r } from "../../../utils/htmlEscape.js";
|
|
5
5
|
import { appendStyle as $ } from "./themeMapper.js";
|
|
6
|
-
const
|
|
7
|
-
function
|
|
6
|
+
const J = "https://email-static.useinsider.com/stripo/modules/email-recommendation-v3/assets/images/image-placeholder.png", K = "attribute-cell", X = "Buy", q = "border-width: 1px; background: rgb(217, 234, 211); border-color: rgb(106, 168, 79)", Q = "color: rgb(56, 118, 29); background: rgb(217, 234, 211); font-family: arial, 'helvetica neue', helvetica, sans-serif; font-size: 16px; font-weight: normal; line-height: 120%; mso-border-alt: 10px solid rgb(217, 234, 211); mso-padding-alt: 0", nt = "ins-recommendation-product-container ins-recommendation-desktop-container";
|
|
7
|
+
function lt(t) {
|
|
8
8
|
return t.replace(/>\s+</g, "><").trim();
|
|
9
9
|
}
|
|
10
10
|
function y(t) {
|
|
11
|
-
return t ? ` align="${
|
|
11
|
+
return t ? ` align="${r(t)}"` : ' align="center"';
|
|
12
12
|
}
|
|
13
|
-
function
|
|
13
|
+
function R() {
|
|
14
14
|
return {
|
|
15
15
|
tdStyle: "",
|
|
16
16
|
pStyle: "",
|
|
@@ -19,36 +19,36 @@ function _() {
|
|
|
19
19
|
textTrimming: !1
|
|
20
20
|
};
|
|
21
21
|
}
|
|
22
|
-
function
|
|
23
|
-
return t ? { ...t, wrapBold: !0 } : { ...
|
|
22
|
+
function Z(t) {
|
|
23
|
+
return t ? { ...t, wrapBold: !0 } : { ...R(), wrapBold: !0 };
|
|
24
24
|
}
|
|
25
|
-
function
|
|
26
|
-
let e =
|
|
25
|
+
function v(t, o) {
|
|
26
|
+
let e = r(t);
|
|
27
27
|
return o.wrapBold && o.wrapItalic ? e = `<strong><em>${e}</em></strong>` : o.wrapBold ? e = `<strong>${e}</strong>` : o.wrapItalic && (e = `<em>${e}</em>`), e;
|
|
28
28
|
}
|
|
29
|
-
function
|
|
30
|
-
return t ? ` style="${
|
|
29
|
+
function u(t) {
|
|
30
|
+
return t ? ` style="${r(t)}"` : "";
|
|
31
31
|
}
|
|
32
|
-
function
|
|
33
|
-
return `<td width="${t}%" class="${
|
|
32
|
+
function I(t, o) {
|
|
33
|
+
return `<td width="${t}%" class="${K}" ${o}`;
|
|
34
34
|
}
|
|
35
|
-
function
|
|
35
|
+
function st(t, o, e, l) {
|
|
36
36
|
const s = t.width ? ` width="${t.width}"` : "", n = t.height ? ` height="${t.height}"` : "", i = ["display: block", "max-width: 100%", "height: auto"];
|
|
37
37
|
t.width && i.push(`width: ${t.width}px`), t.height && i.push(`height: ${t.height}px`);
|
|
38
|
-
const
|
|
38
|
+
const c = i.join("; "), a = e ? ` style="background-color: ${r(e)}"` : "";
|
|
39
39
|
return `
|
|
40
|
-
${
|
|
40
|
+
${I(l, 'valign="top" style="padding: 0 5px; height: 100%"')}>
|
|
41
41
|
<table width="100%" height="100%" cellpadding="0" cellspacing="0" border="0"
|
|
42
|
-
class="product-card-segment"${
|
|
42
|
+
class="product-card-segment"${a}>
|
|
43
43
|
<tbody>
|
|
44
44
|
<tr valign="top">
|
|
45
45
|
<td align="center"
|
|
46
46
|
class="esd-block-image product-image es-p5"
|
|
47
47
|
esd-extension-block-id="${g.IMAGE}">
|
|
48
48
|
<a target="_blank" href="https://example.com/product/${o + 1}">
|
|
49
|
-
<img src="${
|
|
49
|
+
<img src="${J}" alt="Product Name"
|
|
50
50
|
class="adapt-img"${s}${n}
|
|
51
|
-
style="${
|
|
51
|
+
style="${c}">
|
|
52
52
|
</a>
|
|
53
53
|
</td>
|
|
54
54
|
</tr>
|
|
@@ -57,18 +57,18 @@ function lt(t, o, e, l) {
|
|
|
57
57
|
</td>
|
|
58
58
|
`;
|
|
59
59
|
}
|
|
60
|
-
function
|
|
61
|
-
const
|
|
60
|
+
function G(t, o, e, l, s, n, i) {
|
|
61
|
+
const a = `table-layout: fixed${n ? `; background-color: ${r(n)}` : ""}`, d = u(s.tdStyle), p = y(s.align), b = `esd-block-text ${o}`.trim(), m = $(l, s.pStyle);
|
|
62
62
|
return `
|
|
63
|
-
${
|
|
63
|
+
${I(i, 'valign="top" style="padding: 0 5px; height: 100%"')}>
|
|
64
64
|
<table width="100%" height="100%" cellpadding="0" cellspacing="0" border="0"
|
|
65
|
-
class="product-card-segment" style="${
|
|
65
|
+
class="product-card-segment" style="${a}">
|
|
66
66
|
<tbody>
|
|
67
67
|
<tr valign="top">
|
|
68
68
|
<td${p}
|
|
69
|
-
class="${
|
|
69
|
+
class="${b}"
|
|
70
70
|
esd-extension-block-id="${t}"${d}>
|
|
71
|
-
<p contenteditable="false"${
|
|
71
|
+
<p contenteditable="false"${u(m)}>${v(e, s)}</p>
|
|
72
72
|
</td>
|
|
73
73
|
</tr>
|
|
74
74
|
</tbody>
|
|
@@ -76,10 +76,10 @@ function L(t, o, e, l, s, n, i) {
|
|
|
76
76
|
</td>
|
|
77
77
|
`;
|
|
78
78
|
}
|
|
79
|
-
function
|
|
80
|
-
const s = o ? ` style="background-color: ${
|
|
79
|
+
function it(t, o, e, l) {
|
|
80
|
+
const s = o ? ` style="background-color: ${r(o)}"` : "", n = u(t.tdStyle), i = y(t.align), a = $("font-size: 14px; color: #999999", t.pStyle);
|
|
81
81
|
return `
|
|
82
|
-
${
|
|
82
|
+
${I(e, 'valign="top" style="padding: 0 5px; height: 100%"')}>
|
|
83
83
|
<table width="100%" height="100%" cellpadding="0" cellspacing="0" border="0"
|
|
84
84
|
class="product-card-segment"${s}>
|
|
85
85
|
<tbody>
|
|
@@ -87,8 +87,8 @@ function st(t, o, e, l) {
|
|
|
87
87
|
<td${i}
|
|
88
88
|
class="esd-block-text product-old-price es-p15l es-p15r"
|
|
89
89
|
esd-extension-block-id="${g.OLD_PRICE}"${n}>
|
|
90
|
-
<p contenteditable="false"${
|
|
91
|
-
<s>${
|
|
90
|
+
<p contenteditable="false"${u(a)}>
|
|
91
|
+
<s>${v(l, t)}</s>
|
|
92
92
|
</p>
|
|
93
93
|
</td>
|
|
94
94
|
</tr>
|
|
@@ -97,21 +97,21 @@ function st(t, o, e, l) {
|
|
|
97
97
|
</td>
|
|
98
98
|
`;
|
|
99
99
|
}
|
|
100
|
-
function
|
|
101
|
-
const
|
|
100
|
+
function z(t, o, e, l, s, n, i) {
|
|
101
|
+
const c = s ? `; background-color: ${r(s)}` : "", a = u(l.tdStyle), d = y(l.align), b = $("font-size: 12px; color: #666666", l.pStyle);
|
|
102
102
|
return `
|
|
103
|
-
${
|
|
103
|
+
${I(i, 'valign="top" style="padding: 0 5px; height: 100%"')}>
|
|
104
104
|
<table width="100%" height="100%" cellpadding="0" cellspacing="0" border="0"
|
|
105
|
-
class="product-card-segment" style="table-layout: fixed${
|
|
105
|
+
class="product-card-segment" style="table-layout: fixed${c}">
|
|
106
106
|
<tbody>
|
|
107
107
|
<tr valign="top">
|
|
108
108
|
<td${d}
|
|
109
109
|
data-text-before="" data-text-after=""
|
|
110
110
|
class="esd-block-text ${n} es-p15l es-p15r"
|
|
111
|
-
esd-extension-block-id="${t}"${
|
|
112
|
-
<p contenteditable="false"${b
|
|
111
|
+
esd-extension-block-id="${t}"${a}>
|
|
112
|
+
<p contenteditable="false"${u(b)}>
|
|
113
113
|
<span class="omnibus-text-before"></span>
|
|
114
|
-
<span class="${o}">${
|
|
114
|
+
<span class="${o}">${r(e)}</span>
|
|
115
115
|
<span class="omnibus-text-after"></span>
|
|
116
116
|
</p>
|
|
117
117
|
</td>
|
|
@@ -121,10 +121,10 @@ function D(t, o, e, l, s, n, i) {
|
|
|
121
121
|
</td>
|
|
122
122
|
`;
|
|
123
123
|
}
|
|
124
|
-
function
|
|
125
|
-
const s = e ? ` style="background-color: ${
|
|
124
|
+
function rt(t, o, e, l) {
|
|
125
|
+
const s = e ? ` style="background-color: ${r(e)}"` : "", n = $("padding: 0 5px; height: 100%", o.tdStyle), i = y(o.align), c = o.text || X, a = $(q, o.spanStyle), d = $(Q, o.aStyle);
|
|
126
126
|
return `
|
|
127
|
-
${
|
|
127
|
+
${I(l, `valign="top" style="${r(n)}"`)}>
|
|
128
128
|
<table width="100%" height="100%" cellpadding="0" cellspacing="0" border="0"
|
|
129
129
|
class="product-card-segment"${s}>
|
|
130
130
|
<tbody>
|
|
@@ -132,10 +132,10 @@ function it(t, o, e, l) {
|
|
|
132
132
|
<td${i}
|
|
133
133
|
class="esd-block-button product-button es-p10t es-p10b es-p5l es-p5r"
|
|
134
134
|
esd-extension-block-id="${g.BUTTON}">
|
|
135
|
-
<span class="es-button-border" style="${
|
|
135
|
+
<span class="es-button-border" style="${r(a)}">
|
|
136
136
|
<a href="https://example.com/product/${t + 1}" target="_blank"
|
|
137
|
-
class="es-button ${
|
|
138
|
-
style="${
|
|
137
|
+
class="es-button ${H}"
|
|
138
|
+
style="${r(d)}">${r(c)}</a>
|
|
139
139
|
</span>
|
|
140
140
|
</td>
|
|
141
141
|
</tr>
|
|
@@ -145,17 +145,17 @@ function it(t, o, e, l) {
|
|
|
145
145
|
`;
|
|
146
146
|
}
|
|
147
147
|
function ct(t, o, e, l, s) {
|
|
148
|
-
const n = l ? `; background-color: ${
|
|
148
|
+
const n = l ? `; background-color: ${r(l)}` : "", i = u(e.tdStyle), c = y(e.align), d = $("font-size: 12px; color: #666666; margin: 0", e.pStyle), p = o.replace(/_/g, " ").replace(/\b\w/g, (b) => b.toUpperCase());
|
|
149
149
|
return `
|
|
150
|
-
${
|
|
150
|
+
${I(s, 'valign="middle" style="padding: 0 5px; height: 100%"')}>
|
|
151
151
|
<table width="100%" height="100%" cellpadding="0" cellspacing="0" border="0"
|
|
152
152
|
class="product-card-segment" style="table-layout: fixed${n}">
|
|
153
153
|
<tbody>
|
|
154
154
|
<tr valign="top">
|
|
155
|
-
<td product-attr="${
|
|
155
|
+
<td product-attr="${r(t)}"${c}
|
|
156
156
|
class="esd-block-text product-custom-attribute es-p0t es-p0b es-p15l es-p15r"
|
|
157
157
|
esd-extension-block-id="${g.CUSTOM_ATTRIBUTE}"${i}>
|
|
158
|
-
<p contenteditable="false"${
|
|
158
|
+
<p contenteditable="false"${u(d)}>${r(p)}</p>
|
|
159
159
|
</td>
|
|
160
160
|
</tr>
|
|
161
161
|
</tbody>
|
|
@@ -164,110 +164,110 @@ function ct(t, o, e, l, s) {
|
|
|
164
164
|
`;
|
|
165
165
|
}
|
|
166
166
|
function at(t, o, e, l, s, n, i) {
|
|
167
|
-
const
|
|
167
|
+
const c = o[t], a = c ?? R();
|
|
168
168
|
switch (t) {
|
|
169
|
-
case
|
|
170
|
-
return
|
|
171
|
-
|
|
169
|
+
case O:
|
|
170
|
+
return st(
|
|
171
|
+
c ?? {},
|
|
172
172
|
s,
|
|
173
173
|
l,
|
|
174
174
|
n
|
|
175
175
|
);
|
|
176
|
-
case
|
|
177
|
-
return
|
|
176
|
+
case j:
|
|
177
|
+
return G(
|
|
178
178
|
g.NAME,
|
|
179
179
|
"product-name es-p10t es-p10b es-p15l es-p15r",
|
|
180
180
|
"Product Name",
|
|
181
181
|
"font-size: 16px; color: #333333",
|
|
182
|
-
|
|
182
|
+
a,
|
|
183
183
|
l,
|
|
184
184
|
n
|
|
185
185
|
);
|
|
186
|
-
case
|
|
187
|
-
return
|
|
186
|
+
case V:
|
|
187
|
+
return G(
|
|
188
188
|
g.PRICE,
|
|
189
189
|
"product-price es-p15l es-p15r",
|
|
190
190
|
i.pricePlaceholder,
|
|
191
191
|
"font-size: 16px; color: #333333",
|
|
192
|
-
|
|
192
|
+
Z(c),
|
|
193
193
|
l,
|
|
194
194
|
n
|
|
195
195
|
);
|
|
196
|
-
case
|
|
197
|
-
return
|
|
198
|
-
case
|
|
199
|
-
return
|
|
196
|
+
case Y:
|
|
197
|
+
return it(a, l, n, i.oldPricePlaceholder);
|
|
198
|
+
case M:
|
|
199
|
+
return z(
|
|
200
200
|
g.OMNIBUS_PRICE,
|
|
201
201
|
"omnibus-price-value",
|
|
202
202
|
i.omnibusPricePlaceholder,
|
|
203
|
-
|
|
203
|
+
a,
|
|
204
204
|
l,
|
|
205
205
|
"product-omnibus-price",
|
|
206
206
|
n
|
|
207
207
|
);
|
|
208
|
-
case
|
|
209
|
-
return
|
|
208
|
+
case F:
|
|
209
|
+
return z(
|
|
210
210
|
g.OMNIBUS_DISCOUNT,
|
|
211
211
|
"omnibus-discount-value",
|
|
212
212
|
"-10%",
|
|
213
|
-
|
|
213
|
+
a,
|
|
214
214
|
l,
|
|
215
215
|
"product-omnibus-discount",
|
|
216
216
|
n
|
|
217
217
|
);
|
|
218
|
-
case
|
|
219
|
-
return
|
|
218
|
+
case k:
|
|
219
|
+
return rt(
|
|
220
220
|
s,
|
|
221
|
-
|
|
221
|
+
c ?? {},
|
|
222
222
|
l,
|
|
223
223
|
n
|
|
224
224
|
);
|
|
225
225
|
default:
|
|
226
226
|
if (t.startsWith(E)) {
|
|
227
227
|
const d = e[t] ?? t.slice(E.length), p = t.slice(E.length);
|
|
228
|
-
return ct(d, p,
|
|
228
|
+
return ct(d, p, a, l, n);
|
|
229
229
|
}
|
|
230
230
|
return null;
|
|
231
231
|
}
|
|
232
232
|
}
|
|
233
|
-
const
|
|
233
|
+
const W = `
|
|
234
234
|
<tr>
|
|
235
235
|
<td class="spacer" style="height: 10px"></td>
|
|
236
236
|
</tr>
|
|
237
237
|
`;
|
|
238
|
-
function
|
|
238
|
+
function dt(t) {
|
|
239
239
|
return {
|
|
240
|
-
pricePlaceholder:
|
|
241
|
-
oldPricePlaceholder:
|
|
242
|
-
omnibusPricePlaceholder:
|
|
240
|
+
pricePlaceholder: L({ price: 18, currency: t }),
|
|
241
|
+
oldPricePlaceholder: L({ price: 20, currency: t }),
|
|
242
|
+
omnibusPricePlaceholder: L({ price: 20, currency: t })
|
|
243
243
|
};
|
|
244
244
|
}
|
|
245
|
-
function
|
|
246
|
-
const { composition: s, visibility: n, perElement: i, customAttrValues:
|
|
245
|
+
function pt(t, o, e, l) {
|
|
246
|
+
const { composition: s, visibility: n, perElement: i, customAttrValues: c, cardBg: a } = l, d = (100 / e).toFixed(2), p = e - o, b = `<td class="${K}" style="padding: 0 5px;" width="${d}%"></td>`, m = p > 0 ? b.repeat(p) : "";
|
|
247
247
|
return `
|
|
248
248
|
<tr class="recommendation-product-row">
|
|
249
249
|
<td>
|
|
250
250
|
<table width="100%" height="100%" cellpadding="0" cellspacing="0" border="0"
|
|
251
251
|
class="product-card-wrapper" style="table-layout: fixed">
|
|
252
252
|
<tbody>${s.map((T) => {
|
|
253
|
-
const
|
|
254
|
-
for (let
|
|
255
|
-
const
|
|
253
|
+
const C = n[T] !== !1, f = C ? "" : ' style="display: none"', w = C ? "1" : "0", x = [];
|
|
254
|
+
for (let A = 0; A < o; A += 1) {
|
|
255
|
+
const _ = at(
|
|
256
256
|
T,
|
|
257
257
|
i,
|
|
258
|
+
c,
|
|
258
259
|
a,
|
|
259
|
-
|
|
260
|
-
t + x,
|
|
260
|
+
t + A,
|
|
261
261
|
d,
|
|
262
262
|
l
|
|
263
263
|
);
|
|
264
|
-
|
|
264
|
+
_ && x.push(_);
|
|
265
265
|
}
|
|
266
|
-
return
|
|
266
|
+
return x.length === 0 ? "" : `
|
|
267
267
|
<tr class="recommendation-attribute-row"
|
|
268
|
-
data-attribute-type="${
|
|
269
|
-
data-visibility="${
|
|
270
|
-
${
|
|
268
|
+
data-attribute-type="${r(T)}"
|
|
269
|
+
data-visibility="${w}"${f}>
|
|
270
|
+
${x.join("")}${m}
|
|
271
271
|
</tr>
|
|
272
272
|
`;
|
|
273
273
|
}).filter(Boolean).join("")}</tbody>
|
|
@@ -276,107 +276,107 @@ function dt(t, o, e, l) {
|
|
|
276
276
|
</tr>
|
|
277
277
|
`;
|
|
278
278
|
}
|
|
279
|
-
function
|
|
279
|
+
function ut(t, o, e) {
|
|
280
280
|
const l = [];
|
|
281
281
|
for (let s = 0; s < t; s += o) {
|
|
282
282
|
const n = Math.min(o, t - s);
|
|
283
|
-
s > 0 && l.push(
|
|
283
|
+
s > 0 && l.push(W), l.push(pt(s, n, o, e));
|
|
284
284
|
}
|
|
285
285
|
return l.join("");
|
|
286
286
|
}
|
|
287
|
-
function
|
|
287
|
+
function bt(t, o, e, l) {
|
|
288
288
|
const s = o[t];
|
|
289
|
-
if (t ===
|
|
290
|
-
const n = s ??
|
|
289
|
+
if (t === j) {
|
|
290
|
+
const n = s ?? R(), i = $("font-size: 16px; color: #333333; margin: 0", n.pStyle), c = y(n.align ?? "left");
|
|
291
291
|
return `
|
|
292
292
|
<td class="esd-block-text product-name"
|
|
293
|
-
esd-extension-block-id="${g.NAME}"${
|
|
294
|
-
<p contenteditable="false"${
|
|
293
|
+
esd-extension-block-id="${g.NAME}"${c}${u(n.tdStyle)}>
|
|
294
|
+
<p contenteditable="false"${u(i)}>${v("Product Name", n)}</p>
|
|
295
295
|
</td>
|
|
296
296
|
`;
|
|
297
297
|
}
|
|
298
|
-
if (t ===
|
|
299
|
-
const n =
|
|
298
|
+
if (t === V) {
|
|
299
|
+
const n = Z(s), i = $("font-size: 16px; color: #333333; margin: 0", n.pStyle), c = y(n.align ?? "left");
|
|
300
300
|
return `
|
|
301
301
|
<td class="esd-block-text product-price"
|
|
302
|
-
esd-extension-block-id="${g.PRICE}"${
|
|
303
|
-
<p contenteditable="false"${
|
|
302
|
+
esd-extension-block-id="${g.PRICE}"${c}${u(n.tdStyle)}>
|
|
303
|
+
<p contenteditable="false"${u(i)}>${v(l.pricePlaceholder, n)}</p>
|
|
304
304
|
</td>
|
|
305
305
|
`;
|
|
306
306
|
}
|
|
307
|
-
if (t ===
|
|
308
|
-
const n = s ??
|
|
307
|
+
if (t === Y) {
|
|
308
|
+
const n = s ?? R(), c = $("font-size: 14px; color: #999999; text-decoration: line-through; margin: 0", n.pStyle), a = y(n.align ?? "left");
|
|
309
309
|
return `
|
|
310
310
|
<td class="esd-block-text product-old-price"
|
|
311
|
-
esd-extension-block-id="${g.OLD_PRICE}"${
|
|
312
|
-
<p contenteditable="false"${
|
|
311
|
+
esd-extension-block-id="${g.OLD_PRICE}"${a}${u(n.tdStyle)}>
|
|
312
|
+
<p contenteditable="false"${u(c)}><s>${v(l.oldPricePlaceholder, n)}</s></p>
|
|
313
313
|
</td>
|
|
314
314
|
`;
|
|
315
315
|
}
|
|
316
|
-
if (t ===
|
|
317
|
-
const n = t ===
|
|
316
|
+
if (t === M || t === F) {
|
|
317
|
+
const n = t === M, i = n ? g.OMNIBUS_PRICE : g.OMNIBUS_DISCOUNT, c = n ? "omnibus-price-value" : "omnibus-discount-value", a = n ? l.omnibusPricePlaceholder : "-10%", d = n ? "product-omnibus-price" : "product-omnibus-discount", p = s ?? R(), b = $("font-size: 12px; color: #666666; margin: 0", p.pStyle), m = y(p.align ?? "left");
|
|
318
318
|
return `
|
|
319
319
|
<td class="esd-block-text ${d}"
|
|
320
320
|
data-text-before="" data-text-after=""
|
|
321
|
-
esd-extension-block-id="${i}"${m}${
|
|
322
|
-
<p contenteditable="false"${b
|
|
321
|
+
esd-extension-block-id="${i}"${m}${u(p.tdStyle)}>
|
|
322
|
+
<p contenteditable="false"${u(b)}>
|
|
323
323
|
<span class="omnibus-text-before"></span>
|
|
324
|
-
<span class="${
|
|
324
|
+
<span class="${c}">${r(a)}</span>
|
|
325
325
|
<span class="omnibus-text-after"></span>
|
|
326
326
|
</p>
|
|
327
327
|
</td>
|
|
328
328
|
`;
|
|
329
329
|
}
|
|
330
330
|
if (t.startsWith(E)) {
|
|
331
|
-
const n = s ??
|
|
331
|
+
const n = s ?? R(), i = e[t] ?? t.slice(E.length), a = t.slice(E.length).replace(/_/g, " ").replace(/\b\w/g, (m) => m.toUpperCase()), d = $("font-size: 12px; color: #666666; margin: 0", n.pStyle), p = y(n.align ?? "left"), b = g.CUSTOM_ATTRIBUTE;
|
|
332
332
|
return `
|
|
333
|
-
<td product-attr="${
|
|
333
|
+
<td product-attr="${r(i)}"
|
|
334
334
|
class="esd-block-text product-custom-attribute"
|
|
335
|
-
esd-extension-block-id="${
|
|
336
|
-
<p contenteditable="false"${
|
|
335
|
+
esd-extension-block-id="${b}"${p}${u(n.tdStyle)}>
|
|
336
|
+
<p contenteditable="false"${u(d)}>${r(a)}</p>
|
|
337
337
|
</td>
|
|
338
338
|
`;
|
|
339
339
|
}
|
|
340
340
|
return null;
|
|
341
341
|
}
|
|
342
|
-
function
|
|
343
|
-
const { composition: e, visibility: l, perElement: s, customAttrValues: n, cardBg: i } = o,
|
|
342
|
+
function gt(t, o) {
|
|
343
|
+
const { composition: e, visibility: l, perElement: s, customAttrValues: n, cardBg: i } = o, c = i ? `background-color: ${r(i)}` : "", a = c ? `style="table-layout: fixed; ${c}"` : 'style="table-layout: fixed"', d = s[O] ?? {}, p = l[O] !== !1, b = d.width ? ` width="${d.width}"` : "", m = p ? "" : ' style="display: none"', S = `
|
|
344
344
|
<td width="120"
|
|
345
345
|
class="esd-block-image product-image-cell recommendation-attribute-row es-p5"
|
|
346
346
|
esd-extension-block-id="${g.IMAGE}"
|
|
347
|
-
data-attribute-type="${
|
|
347
|
+
data-attribute-type="${O}"
|
|
348
348
|
data-visibility="${p ? "1" : "0"}"
|
|
349
349
|
align="center" valign="middle"${m}>
|
|
350
350
|
<a target="_blank" href="https://example.com/product/${t + 1}">
|
|
351
|
-
<img src="${
|
|
352
|
-
class="adapt-img product-image"${
|
|
351
|
+
<img src="${J}" alt="Product Name"
|
|
352
|
+
class="adapt-img product-image"${b}
|
|
353
353
|
style="display: block; max-width: 100%; height: auto">
|
|
354
354
|
</a>
|
|
355
355
|
</td>
|
|
356
|
-
`,
|
|
356
|
+
`, C = `
|
|
357
357
|
<td class="product-info-cell" valign="middle" style="padding: 15px">
|
|
358
358
|
<table cellpadding="0" cellspacing="0" role="presentation" width="100%"
|
|
359
359
|
style="table-layout: fixed">
|
|
360
|
-
<tbody>${e.filter((
|
|
361
|
-
const B = l[
|
|
362
|
-
return
|
|
363
|
-
data-attribute-type="${
|
|
364
|
-
data-visibility="${et}"${tt}>${
|
|
360
|
+
<tbody>${e.filter((h) => h !== O && h !== k).map((h) => {
|
|
361
|
+
const B = l[h] !== !1, tt = B ? "" : ' style="display: none"', et = B ? "1" : "0", D = bt(h, s, n, o);
|
|
362
|
+
return D ? `<tr class="recommendation-attribute-row"
|
|
363
|
+
data-attribute-type="${r(h)}"
|
|
364
|
+
data-visibility="${et}"${tt}>${D}</tr>` : "";
|
|
365
365
|
}).filter(Boolean).join(`
|
|
366
366
|
`)}</tbody>
|
|
367
367
|
</table>
|
|
368
368
|
</td>
|
|
369
|
-
`, f = s[
|
|
369
|
+
`, f = s[k] ?? {}, w = l[k] !== !1, x = f.text || X, A = $(q, f.spanStyle ?? ""), _ = $(Q, f.aStyle ?? ""), N = w ? "" : ' style="display: none"', U = `
|
|
370
370
|
<td width="100"
|
|
371
371
|
class="esd-block-button button-cell recommendation-attribute-row product-button es-p5l es-p5r"
|
|
372
372
|
esd-extension-block-id="${g.BUTTON}"
|
|
373
|
-
data-attribute-type="${
|
|
374
|
-
data-visibility="${
|
|
375
|
-
align="${
|
|
376
|
-
<span class="es-button-border" style="${
|
|
373
|
+
data-attribute-type="${k}"
|
|
374
|
+
data-visibility="${w ? "1" : "0"}"
|
|
375
|
+
align="${r(f.align ?? "center")}" valign="middle"${N}>
|
|
376
|
+
<span class="es-button-border" style="${r(A)}">
|
|
377
377
|
<a href="https://example.com/product/${t + 1}" target="_blank"
|
|
378
|
-
class="es-button ${
|
|
379
|
-
style="${
|
|
378
|
+
class="es-button ${H}"
|
|
379
|
+
style="${r(_)}">${r(x)}</a>
|
|
380
380
|
</span>
|
|
381
381
|
</td>
|
|
382
382
|
`;
|
|
@@ -384,37 +384,37 @@ function bt(t, o) {
|
|
|
384
384
|
<tr class="recommendation-product-row">
|
|
385
385
|
<td style="padding: 0 5px">
|
|
386
386
|
<table width="100%" cellpadding="0" cellspacing="0" border="0"
|
|
387
|
-
class="product-card-wrapper" ${
|
|
387
|
+
class="product-card-wrapper" ${a}>
|
|
388
388
|
<tbody>
|
|
389
|
-
<tr>${
|
|
389
|
+
<tr>${S}${C}${U}</tr>
|
|
390
390
|
</tbody>
|
|
391
391
|
</table>
|
|
392
392
|
</td>
|
|
393
393
|
</tr>
|
|
394
394
|
`;
|
|
395
395
|
}
|
|
396
|
-
function
|
|
396
|
+
function mt(t, o) {
|
|
397
397
|
const e = [];
|
|
398
398
|
for (let l = 0; l < t; l += 1)
|
|
399
|
-
l > 0 && e.push(
|
|
399
|
+
l > 0 && e.push(W), e.push(gt(l, o));
|
|
400
400
|
return e.join("");
|
|
401
401
|
}
|
|
402
|
-
function
|
|
403
|
-
var
|
|
402
|
+
function $t(t, o) {
|
|
403
|
+
var a, d, p, b, m, S;
|
|
404
404
|
const e = t == null ? void 0 : t.theme, l = [];
|
|
405
|
-
(
|
|
406
|
-
const s = l.join("; "), n = ((
|
|
405
|
+
(a = e == null ? void 0 : e.textStyle) != null && a["font-family"] && l.push(`font-family: ${e.textStyle["font-family"]}`), l.push(`font-size: ${((d = e == null ? void 0 : e.textStyle) == null ? void 0 : d["font-size"]) ?? "28px"}`), l.push(`color: ${((p = e == null ? void 0 : e.textColor) == null ? void 0 : p.color) ?? "#333333"}`), (b = e == null ? void 0 : e.textStyle) != null && b["font-weight"] && l.push(`font-weight: ${e.textStyle["font-weight"]}`), (m = e == null ? void 0 : e.textStyle) != null && m["font-style"] && l.push(`font-style: ${e.textStyle["font-style"]}`);
|
|
406
|
+
const s = l.join("; "), n = ((S = e == null ? void 0 : e.textStyle) == null ? void 0 : S["font-weight"]) !== "normal", i = r(o), c = n ? `<strong>${i}</strong>` : i;
|
|
407
407
|
return `
|
|
408
408
|
<td class="esd-block-text es-p10t es-p10b es-p20l es-p20r" align="center">
|
|
409
|
-
<p${
|
|
409
|
+
<p${u(s)}>${c}</p>
|
|
410
410
|
</td>
|
|
411
411
|
`;
|
|
412
412
|
}
|
|
413
|
-
function
|
|
413
|
+
function yt(t) {
|
|
414
414
|
const o = t.alignment === "before" ? "0" : "1";
|
|
415
|
-
return ` ${
|
|
415
|
+
return ` ${P.CURRENCY}="${r(t.code)}" ${P.SYMBOL}="${r(t.symbol)}" ${P.ALIGNMENT}="${o}" ${P.THOUSAND_SEPARATOR}="${r(t.thousandSeparator)}" ${P.DECIMAL_SEPARATOR}="${r(t.decimalSeparator)}" ${P.DECIMAL_COUNT}="${t.decimalCount}"`;
|
|
416
416
|
}
|
|
417
|
-
function
|
|
417
|
+
function Ct(t) {
|
|
418
418
|
const {
|
|
419
419
|
nodeConfig: o,
|
|
420
420
|
composition: e,
|
|
@@ -422,18 +422,13 @@ function Tt(t) {
|
|
|
422
422
|
titleText: s,
|
|
423
423
|
extraClasses: n = "",
|
|
424
424
|
legacyId: i,
|
|
425
|
-
legacyBgColor:
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
perElement: e.perElementStyles,
|
|
430
|
-
customAttrValues: e.customAttrValues,
|
|
431
|
-
cardBg: l,
|
|
432
|
-
...rt(o.currency)
|
|
433
|
-
}, m = o.layout === "list" ? gt(r, u) : pt(r, o.cardsInRow, u), h = mt(e.titleVariable, s), T = e.composition.join(","), w = JSON.stringify(e.customAttributes), f = [
|
|
425
|
+
legacyBgColor: c,
|
|
426
|
+
preserveInnerHtml: a,
|
|
427
|
+
skipCompile: d = !1
|
|
428
|
+
} = t, p = o.layout === "list" ? ' data-layout="list"' : "", b = o.layout === "list" ? " es-m-p0 ins-recommendation-list-layout" : "", m = e.composition.join(","), S = JSON.stringify(e.customAttributes), T = [
|
|
434
429
|
"recommendation-block-v2",
|
|
435
430
|
"esd-block-recommendation-v3-block",
|
|
436
|
-
`es-p20${
|
|
431
|
+
`es-p20${b}`,
|
|
437
432
|
`ins-recommendation-v3-block-${o.recommendationId}`,
|
|
438
433
|
// Marker class Stripo's block infrastructure uses to identify recommendation
|
|
439
434
|
// blocks. Without it, certain Styles-panel controls (e.g. button "Fit to
|
|
@@ -442,20 +437,18 @@ function Tt(t) {
|
|
|
442
437
|
"esd-extension-block",
|
|
443
438
|
"esd-container-frame",
|
|
444
439
|
"ins-recommendation-no-mobile-layout",
|
|
440
|
+
d ? ot : "",
|
|
445
441
|
n
|
|
446
|
-
].filter(Boolean).join(" "), C =
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
data-row-spacing="${o.rowSpacing}"
|
|
457
|
-
data-mobile-column-spacing="${o.mobileColumnSpacing}"
|
|
458
|
-
data-mobile-row-spacing="${o.mobileRowSpacing}"${d}${S}>
|
|
442
|
+
].filter(Boolean).join(" "), C = yt(o.currency), f = ` esd-ext-config="${r(JSON.stringify(o))}"`, w = i ? ` id="${r(i)}"` : "", x = c ? ` bgcolor="${r(c)}"` : "", _ = a ?? (() => {
|
|
443
|
+
const N = parseInt(o.size) || 6, U = {
|
|
444
|
+
composition: e.composition,
|
|
445
|
+
visibility: e.visibility,
|
|
446
|
+
perElement: e.perElementStyles,
|
|
447
|
+
customAttrValues: e.customAttrValues,
|
|
448
|
+
cardBg: l,
|
|
449
|
+
...dt(o.currency)
|
|
450
|
+
}, h = o.layout === "list" ? mt(N, U) : ut(N, o.cardsInRow, U);
|
|
451
|
+
return `
|
|
459
452
|
<table width="100%" cellpadding="0" cellspacing="0" border="0">
|
|
460
453
|
<tbody>
|
|
461
454
|
<tr>
|
|
@@ -466,7 +459,7 @@ function Tt(t) {
|
|
|
466
459
|
<td>
|
|
467
460
|
<table width="100%" cellpadding="0" cellspacing="0" border="0">
|
|
468
461
|
<tbody>
|
|
469
|
-
<tr>${
|
|
462
|
+
<tr>${$t(e.titleVariable, s)}</tr>
|
|
470
463
|
</tbody>
|
|
471
464
|
</table>
|
|
472
465
|
</td>
|
|
@@ -477,7 +470,7 @@ function Tt(t) {
|
|
|
477
470
|
<tr>
|
|
478
471
|
<td>
|
|
479
472
|
<table width="100%" cellpadding="0" cellspacing="0" border="0"
|
|
480
|
-
class="${
|
|
473
|
+
class="${nt}">${h}
|
|
481
474
|
</table>
|
|
482
475
|
</td>
|
|
483
476
|
</tr>
|
|
@@ -487,10 +480,23 @@ function Tt(t) {
|
|
|
487
480
|
</td>
|
|
488
481
|
</tr>
|
|
489
482
|
</tbody>
|
|
490
|
-
</table
|
|
483
|
+
</table>`;
|
|
484
|
+
})();
|
|
485
|
+
return lt(`
|
|
486
|
+
<td align="left"
|
|
487
|
+
esd-extension-block-id="recommendation-block"
|
|
488
|
+
width="520"
|
|
489
|
+
class="${T}"${w}${x}
|
|
490
|
+
recommendation-id="${o.recommendationId}"${C}
|
|
491
|
+
data-card-composition="${r(m)}"
|
|
492
|
+
data-custom-attributes="${r(S)}"
|
|
493
|
+
data-column-spacing="${o.columnSpacing}"
|
|
494
|
+
data-row-spacing="${o.rowSpacing}"
|
|
495
|
+
data-mobile-column-spacing="${o.mobileColumnSpacing}"
|
|
496
|
+
data-mobile-row-spacing="${o.mobileRowSpacing}"${p}${f}>${_}
|
|
491
497
|
</td>
|
|
492
498
|
`);
|
|
493
499
|
}
|
|
494
500
|
export {
|
|
495
|
-
|
|
501
|
+
Ct as buildBlockHtml
|
|
496
502
|
};
|