@useinsider/guido 3.6.0-beta.7ac8612 → 3.6.0-beta.dc3a2aa
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 +102 -131
- package/dist/config/compiler/utils/recommendationCompilerUtils.js +27 -28
- package/dist/config/migrator/recommendation/extractors.js +22 -44
- package/dist/config/migrator/recommendation/htmlBuilder.js +169 -175
- package/dist/config/migrator/recommendationMigrator.js +31 -30
- package/dist/extensions/Blocks/Recommendation/constants/selectors.js +15 -21
- package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +24 -38
- package/dist/extensions/Blocks/Recommendation/controls/main/index.js +38 -39
- package/dist/extensions/Blocks/Recommendation/controls/main/layoutOrientation.js +35 -45
- package/dist/extensions/Blocks/Recommendation/controls/main/productCount.js +2 -3
- package/dist/extensions/Blocks/Recommendation/controls/main/productLayout.js +52 -62
- package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +67 -74
- package/dist/extensions/Blocks/Recommendation/controls/syncInfoMessage.js +6 -7
- package/dist/extensions/Blocks/Recommendation/extension.js +5 -6
- package/dist/extensions/Blocks/Recommendation/settingsPanel.js +2 -3
- package/dist/extensions/Blocks/Recommendation/store/recommendation.js +2 -3
- package/dist/extensions/Blocks/Recommendation/templates/grid/elementRenderer.js +6 -4
- package/dist/extensions/Blocks/Recommendation/templates/grid/template.js +2 -3
- package/dist/extensions/Blocks/Recommendation/templates/index.js +4 -5
- package/dist/extensions/Blocks/Recommendation/utils/priceFormatter.js +19 -19
- package/dist/src/composables/useHtmlValidator.d.ts +0 -9
- package/dist/src/config/migrator/recommendation/extractors.d.ts +0 -15
- package/dist/src/config/migrator/recommendation/htmlBuilder.d.ts +0 -8
- package/dist/src/extensions/Blocks/Recommendation/constants/index.d.ts +1 -1
- package/dist/src/extensions/Blocks/Recommendation/constants/selectors.d.ts +0 -21
- package/dist/src/extensions/Blocks/Recommendation/controls/cardComposition/index.d.ts +0 -7
- package/dist/src/extensions/Blocks/Recommendation/controls/main/layoutOrientation.d.ts +0 -5
- package/dist/src/extensions/Blocks/Recommendation/controls/main/productLayout.d.ts +0 -6
- package/dist/src/extensions/Blocks/Recommendation/controls/main/utils.d.ts +0 -9
- package/package.json +1 -1
- package/dist/config/compiler/utils/recommendationIgnoreUtils.js +0 -15
- package/dist/src/config/compiler/utils/recommendationIgnoreUtils.d.ts +0 -17
- package/dist/src/config/compiler/utils/recommendationIgnoreUtils.test.d.ts +0 -1
- /package/dist/src/{composables/useHtmlValidator.test.d.ts → extensions/Blocks/Recommendation/utils/priceFormatter.test.d.ts} +0 -0
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { RecommendationBlockId as g } from "../../../extensions/Blocks/Recommendation/constants/blockIds.js";
|
|
2
|
-
import {
|
|
3
|
-
import { formatPrice as
|
|
4
|
-
import { escapeHtml as
|
|
2
|
+
import { CURRENCY_ATTR as R, ATTR_PRODUCT_IMAGE as I, ATTR_PRODUCT_BUTTON as N, CSS_CLASS_RECO_BUTTON as z, ATTR_PRODUCT_NAME as G, ATTR_PRODUCT_PRICE as H, ATTR_PRODUCT_OLD_PRICE as j, ATTR_PRODUCT_OMNIBUS_PRICE as U, ATTR_PRODUCT_OMNIBUS_DISCOUNT as V, ATTR_CUSTOM_PREFIX as E } from "../../../extensions/Blocks/Recommendation/constants/selectors.js";
|
|
3
|
+
import { formatPrice as v } from "../../../extensions/Blocks/Recommendation/utils/priceFormatter.js";
|
|
4
|
+
import { escapeHtml as c } from "../../../utils/htmlEscape.js";
|
|
5
5
|
import { appendStyle as $ } from "./themeMapper.js";
|
|
6
|
-
const
|
|
7
|
-
function
|
|
6
|
+
const Y = "https://email-static.useinsider.com/stripo/modules/email-recommendation-v3/assets/images/image-placeholder.png", F = "attribute-cell", J = "Buy", X = "border-width: 1px; background: rgb(217, 234, 211); border-color: rgb(106, 168, 79)", K = "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", ot = "ins-recommendation-product-container ins-recommendation-desktop-container";
|
|
7
|
+
function nt(t) {
|
|
8
8
|
return t.replace(/>\s+</g, "><").trim();
|
|
9
9
|
}
|
|
10
10
|
function y(t) {
|
|
11
|
-
return t ? ` align="${
|
|
11
|
+
return t ? ` align="${c(t)}"` : ' align="center"';
|
|
12
12
|
}
|
|
13
|
-
function
|
|
13
|
+
function _() {
|
|
14
14
|
return {
|
|
15
15
|
tdStyle: "",
|
|
16
16
|
pStyle: "",
|
|
@@ -19,36 +19,36 @@ function R() {
|
|
|
19
19
|
textTrimming: !1
|
|
20
20
|
};
|
|
21
21
|
}
|
|
22
|
-
function
|
|
23
|
-
return t ? { ...t, wrapBold: !0 } : { ...
|
|
22
|
+
function q(t) {
|
|
23
|
+
return t ? { ...t, wrapBold: !0 } : { ..._(), wrapBold: !0 };
|
|
24
24
|
}
|
|
25
|
-
function
|
|
26
|
-
let e =
|
|
25
|
+
function k(t, o) {
|
|
26
|
+
let e = c(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 b(t) {
|
|
30
|
+
return t ? ` style="${c(t)}"` : "";
|
|
31
31
|
}
|
|
32
|
-
function
|
|
33
|
-
return `<td width="${t}%" class="${
|
|
32
|
+
function O(t, o) {
|
|
33
|
+
return `<td width="${t}%" class="${F}" ${o}`;
|
|
34
34
|
}
|
|
35
|
-
function
|
|
35
|
+
function lt(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 a = i.join("; "), r = e ? ` style="background-color: ${c(e)}"` : "";
|
|
39
39
|
return `
|
|
40
|
-
${
|
|
40
|
+
${O(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"${r}>
|
|
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="${Y}" alt="Product Name"
|
|
50
50
|
class="adapt-img"${s}${n}
|
|
51
|
-
style="${
|
|
51
|
+
style="${a}">
|
|
52
52
|
</a>
|
|
53
53
|
</td>
|
|
54
54
|
</tr>
|
|
@@ -57,18 +57,18 @@ function st(t, o, e, l) {
|
|
|
57
57
|
</td>
|
|
58
58
|
`;
|
|
59
59
|
}
|
|
60
|
-
function
|
|
61
|
-
const
|
|
60
|
+
function L(t, o, e, l, s, n, i) {
|
|
61
|
+
const r = `table-layout: fixed${n ? `; background-color: ${c(n)}` : ""}`, d = b(s.tdStyle), p = y(s.align), u = `esd-block-text ${o}`.trim(), m = $(l, s.pStyle);
|
|
62
62
|
return `
|
|
63
|
-
${
|
|
63
|
+
${O(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="${r}">
|
|
66
66
|
<tbody>
|
|
67
67
|
<tr valign="top">
|
|
68
68
|
<td${p}
|
|
69
|
-
class="${
|
|
69
|
+
class="${u}"
|
|
70
70
|
esd-extension-block-id="${t}"${d}>
|
|
71
|
-
<p contenteditable="false"${
|
|
71
|
+
<p contenteditable="false"${b(m)}>${k(e, s)}</p>
|
|
72
72
|
</td>
|
|
73
73
|
</tr>
|
|
74
74
|
</tbody>
|
|
@@ -76,10 +76,10 @@ function G(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 st(t, o, e, l) {
|
|
80
|
+
const s = o ? ` style="background-color: ${c(o)}"` : "", n = b(t.tdStyle), i = y(t.align), r = $("font-size: 14px; color: #999999", t.pStyle);
|
|
81
81
|
return `
|
|
82
|
-
${
|
|
82
|
+
${O(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 it(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"${b(r)}>
|
|
91
|
+
<s>${k(l, t)}</s>
|
|
92
92
|
</p>
|
|
93
93
|
</td>
|
|
94
94
|
</tr>
|
|
@@ -97,21 +97,21 @@ function it(t, o, e, l) {
|
|
|
97
97
|
</td>
|
|
98
98
|
`;
|
|
99
99
|
}
|
|
100
|
-
function
|
|
101
|
-
const
|
|
100
|
+
function D(t, o, e, l, s, n, i) {
|
|
101
|
+
const a = s ? `; background-color: ${c(s)}` : "", r = b(l.tdStyle), d = y(l.align), u = $("font-size: 12px; color: #666666", l.pStyle);
|
|
102
102
|
return `
|
|
103
|
-
${
|
|
103
|
+
${O(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${a}">
|
|
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"${u
|
|
111
|
+
esd-extension-block-id="${t}"${r}>
|
|
112
|
+
<p contenteditable="false"${b(u)}>
|
|
113
113
|
<span class="omnibus-text-before"></span>
|
|
114
|
-
<span class="${o}">${
|
|
114
|
+
<span class="${o}">${c(e)}</span>
|
|
115
115
|
<span class="omnibus-text-after"></span>
|
|
116
116
|
</p>
|
|
117
117
|
</td>
|
|
@@ -121,10 +121,10 @@ function z(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 it(t, o, e, l) {
|
|
125
|
+
const s = e ? ` style="background-color: ${c(e)}"` : "", n = $("padding: 0 5px; height: 100%", o.tdStyle), i = y(o.align), a = o.text || J, r = $(X, o.spanStyle), d = $(K, o.aStyle);
|
|
126
126
|
return `
|
|
127
|
-
${
|
|
127
|
+
${O(l, `valign="top" style="${c(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 rt(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="${r
|
|
135
|
+
<span class="es-button-border" style="${c(r)}">
|
|
136
136
|
<a href="https://example.com/product/${t + 1}" target="_blank"
|
|
137
|
-
class="es-button ${
|
|
138
|
-
style="${
|
|
137
|
+
class="es-button ${z}"
|
|
138
|
+
style="${c(d)}">${c(a)}</a>
|
|
139
139
|
</span>
|
|
140
140
|
</td>
|
|
141
141
|
</tr>
|
|
@@ -145,17 +145,17 @@ function rt(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: ${c(l)}` : "", i = b(e.tdStyle), a = y(e.align), d = $("font-size: 12px; color: #666666; margin: 0", e.pStyle), p = o.replace(/_/g, " ").replace(/\b\w/g, (u) => u.toUpperCase());
|
|
149
149
|
return `
|
|
150
|
-
${
|
|
150
|
+
${O(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="${c(t)}"${a}
|
|
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"${b(d)}>${c(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 a = o[t], r = a ?? _();
|
|
168
168
|
switch (t) {
|
|
169
|
-
case
|
|
170
|
-
return
|
|
171
|
-
|
|
169
|
+
case I:
|
|
170
|
+
return lt(
|
|
171
|
+
a ?? {},
|
|
172
172
|
s,
|
|
173
173
|
l,
|
|
174
174
|
n
|
|
175
175
|
);
|
|
176
|
-
case
|
|
177
|
-
return
|
|
176
|
+
case G:
|
|
177
|
+
return L(
|
|
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
|
+
r,
|
|
183
183
|
l,
|
|
184
184
|
n
|
|
185
185
|
);
|
|
186
|
-
case
|
|
187
|
-
return
|
|
186
|
+
case H:
|
|
187
|
+
return L(
|
|
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
|
+
q(a),
|
|
193
193
|
l,
|
|
194
194
|
n
|
|
195
195
|
);
|
|
196
|
-
case
|
|
197
|
-
return
|
|
198
|
-
case
|
|
199
|
-
return
|
|
196
|
+
case j:
|
|
197
|
+
return st(r, l, n, i.oldPricePlaceholder);
|
|
198
|
+
case U:
|
|
199
|
+
return D(
|
|
200
200
|
g.OMNIBUS_PRICE,
|
|
201
201
|
"omnibus-price-value",
|
|
202
202
|
i.omnibusPricePlaceholder,
|
|
203
|
-
|
|
203
|
+
r,
|
|
204
204
|
l,
|
|
205
205
|
"product-omnibus-price",
|
|
206
206
|
n
|
|
207
207
|
);
|
|
208
|
-
case
|
|
209
|
-
return
|
|
208
|
+
case V:
|
|
209
|
+
return D(
|
|
210
210
|
g.OMNIBUS_DISCOUNT,
|
|
211
211
|
"omnibus-discount-value",
|
|
212
212
|
"-10%",
|
|
213
|
-
|
|
213
|
+
r,
|
|
214
214
|
l,
|
|
215
215
|
"product-omnibus-discount",
|
|
216
216
|
n
|
|
217
217
|
);
|
|
218
|
-
case
|
|
219
|
-
return
|
|
218
|
+
case N:
|
|
219
|
+
return it(
|
|
220
220
|
s,
|
|
221
|
-
|
|
221
|
+
a ?? {},
|
|
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, r, l, n);
|
|
229
229
|
}
|
|
230
230
|
return null;
|
|
231
231
|
}
|
|
232
232
|
}
|
|
233
|
-
const
|
|
233
|
+
const Q = `
|
|
234
234
|
<tr>
|
|
235
235
|
<td class="spacer" style="height: 10px"></td>
|
|
236
236
|
</tr>
|
|
237
237
|
`;
|
|
238
|
-
function
|
|
238
|
+
function rt(t) {
|
|
239
239
|
return {
|
|
240
|
-
pricePlaceholder:
|
|
241
|
-
oldPricePlaceholder:
|
|
242
|
-
omnibusPricePlaceholder:
|
|
240
|
+
pricePlaceholder: v({ price: 18, currency: t }),
|
|
241
|
+
oldPricePlaceholder: v({ price: 20, currency: t }),
|
|
242
|
+
omnibusPricePlaceholder: v({ price: 20, currency: t })
|
|
243
243
|
};
|
|
244
244
|
}
|
|
245
|
-
function
|
|
246
|
-
const { composition: s, visibility: n, perElement: i, customAttrValues:
|
|
245
|
+
function dt(t, o, e, l) {
|
|
246
|
+
const { composition: s, visibility: n, perElement: i, customAttrValues: a, cardBg: r } = l, d = (100 / e).toFixed(2), p = e - o, u = `<td class="${F}" style="padding: 0 5px;" width="${d}%"></td>`, m = p > 0 ? u.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 w = n[T] !== !1, f = w ? "" : ' style="display: none"', C = w ? "1" : "0", S = [];
|
|
254
|
+
for (let x = 0; x < o; x += 1) {
|
|
255
|
+
const A = at(
|
|
256
256
|
T,
|
|
257
257
|
i,
|
|
258
|
-
c,
|
|
259
258
|
a,
|
|
260
|
-
|
|
259
|
+
r,
|
|
260
|
+
t + x,
|
|
261
261
|
d,
|
|
262
262
|
l
|
|
263
263
|
);
|
|
264
|
-
|
|
264
|
+
A && S.push(A);
|
|
265
265
|
}
|
|
266
|
-
return
|
|
266
|
+
return S.length === 0 ? "" : `
|
|
267
267
|
<tr class="recommendation-attribute-row"
|
|
268
|
-
data-attribute-type="${
|
|
269
|
-
data-visibility="${
|
|
270
|
-
${
|
|
268
|
+
data-attribute-type="${c(T)}"
|
|
269
|
+
data-visibility="${C}"${f}>
|
|
270
|
+
${S.join("")}${m}
|
|
271
271
|
</tr>
|
|
272
272
|
`;
|
|
273
273
|
}).filter(Boolean).join("")}</tbody>
|
|
@@ -276,107 +276,107 @@ function pt(t, o, e, l) {
|
|
|
276
276
|
</tr>
|
|
277
277
|
`;
|
|
278
278
|
}
|
|
279
|
-
function
|
|
279
|
+
function pt(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(Q), l.push(dt(s, n, o, e));
|
|
284
284
|
}
|
|
285
285
|
return l.join("");
|
|
286
286
|
}
|
|
287
|
-
function
|
|
287
|
+
function ut(t, o, e, l) {
|
|
288
288
|
const s = o[t];
|
|
289
|
-
if (t ===
|
|
290
|
-
const n = s ??
|
|
289
|
+
if (t === G) {
|
|
290
|
+
const n = s ?? _(), i = $("font-size: 16px; color: #333333; margin: 0", n.pStyle), a = 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}"${a}${b(n.tdStyle)}>
|
|
294
|
+
<p contenteditable="false"${b(i)}>${k("Product Name", n)}</p>
|
|
295
295
|
</td>
|
|
296
296
|
`;
|
|
297
297
|
}
|
|
298
|
-
if (t ===
|
|
299
|
-
const n =
|
|
298
|
+
if (t === H) {
|
|
299
|
+
const n = q(s), i = $("font-size: 16px; color: #333333; margin: 0", n.pStyle), a = 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}"${a}${b(n.tdStyle)}>
|
|
303
|
+
<p contenteditable="false"${b(i)}>${k(l.pricePlaceholder, n)}</p>
|
|
304
304
|
</td>
|
|
305
305
|
`;
|
|
306
306
|
}
|
|
307
|
-
if (t ===
|
|
308
|
-
const n = s ??
|
|
307
|
+
if (t === j) {
|
|
308
|
+
const n = s ?? _(), a = $("font-size: 14px; color: #999999; text-decoration: line-through; margin: 0", n.pStyle), r = 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}"${r}${b(n.tdStyle)}>
|
|
312
|
+
<p contenteditable="false"${b(a)}><s>${k(l.oldPricePlaceholder, n)}</s></p>
|
|
313
313
|
</td>
|
|
314
314
|
`;
|
|
315
315
|
}
|
|
316
|
-
if (t ===
|
|
317
|
-
const n = t ===
|
|
316
|
+
if (t === U || t === V) {
|
|
317
|
+
const n = t === U, i = n ? g.OMNIBUS_PRICE : g.OMNIBUS_DISCOUNT, a = n ? "omnibus-price-value" : "omnibus-discount-value", r = n ? l.omnibusPricePlaceholder : "-10%", d = n ? "product-omnibus-price" : "product-omnibus-discount", p = s ?? _(), u = $("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"${u
|
|
321
|
+
esd-extension-block-id="${i}"${m}${b(p.tdStyle)}>
|
|
322
|
+
<p contenteditable="false"${b(u)}>
|
|
323
323
|
<span class="omnibus-text-before"></span>
|
|
324
|
-
<span class="${
|
|
324
|
+
<span class="${a}">${c(r)}</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 ?? _(), i = e[t] ?? t.slice(E.length), r = 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"), u = g.CUSTOM_ATTRIBUTE;
|
|
332
332
|
return `
|
|
333
|
-
<td product-attr="${
|
|
333
|
+
<td product-attr="${c(i)}"
|
|
334
334
|
class="esd-block-text product-custom-attribute"
|
|
335
|
-
esd-extension-block-id="${
|
|
336
|
-
<p contenteditable="false"${
|
|
335
|
+
esd-extension-block-id="${u}"${p}${b(n.tdStyle)}>
|
|
336
|
+
<p contenteditable="false"${b(d)}>${c(r)}</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 bt(t, o) {
|
|
343
|
+
const { composition: e, visibility: l, perElement: s, customAttrValues: n, cardBg: i } = o, a = i ? `background-color: ${c(i)}` : "", r = a ? `style="table-layout: fixed; ${a}"` : 'style="table-layout: fixed"', d = s[I] ?? {}, p = l[I] !== !1, u = d.width ? ` width="${d.width}"` : "", m = p ? "" : ' style="display: none"', h = `
|
|
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="${I}"
|
|
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="${Y}" alt="Product Name"
|
|
352
|
+
class="adapt-img product-image"${u}
|
|
353
353
|
style="display: block; max-width: 100%; height: auto">
|
|
354
354
|
</a>
|
|
355
355
|
</td>
|
|
356
|
-
`,
|
|
356
|
+
`, w = `
|
|
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((P) => P !== I && P !== N).map((P) => {
|
|
361
|
+
const B = l[P] !== !1, tt = B ? "" : ' style="display: none"', et = B ? "1" : "0", M = ut(P, s, n, o);
|
|
362
|
+
return M ? `<tr class="recommendation-attribute-row"
|
|
363
|
+
data-attribute-type="${c(P)}"
|
|
364
|
+
data-visibility="${et}"${tt}>${M}</tr>` : "";
|
|
365
365
|
}).filter(Boolean).join(`
|
|
366
366
|
`)}</tbody>
|
|
367
367
|
</table>
|
|
368
368
|
</td>
|
|
369
|
-
`, f = s[
|
|
369
|
+
`, f = s[N] ?? {}, C = l[N] !== !1, S = f.text || J, x = $(X, f.spanStyle ?? ""), A = $(K, f.aStyle ?? ""), Z = C ? "" : ' style="display: none"', W = `
|
|
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="${N}"
|
|
374
|
+
data-visibility="${C ? "1" : "0"}"
|
|
375
|
+
align="${c(f.align ?? "center")}" valign="middle"${Z}>
|
|
376
|
+
<span class="es-button-border" style="${c(x)}">
|
|
377
377
|
<a href="https://example.com/product/${t + 1}" target="_blank"
|
|
378
|
-
class="es-button ${
|
|
379
|
-
style="${
|
|
378
|
+
class="es-button ${z}"
|
|
379
|
+
style="${c(A)}">${c(S)}</a>
|
|
380
380
|
</span>
|
|
381
381
|
</td>
|
|
382
382
|
`;
|
|
@@ -384,37 +384,37 @@ function gt(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" ${r}>
|
|
388
388
|
<tbody>
|
|
389
|
-
<tr>${
|
|
389
|
+
<tr>${h}${w}${W}</tr>
|
|
390
390
|
</tbody>
|
|
391
391
|
</table>
|
|
392
392
|
</td>
|
|
393
393
|
</tr>
|
|
394
394
|
`;
|
|
395
395
|
}
|
|
396
|
-
function
|
|
396
|
+
function gt(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(Q), e.push(bt(l, o));
|
|
400
400
|
return e.join("");
|
|
401
401
|
}
|
|
402
|
-
function
|
|
403
|
-
var
|
|
402
|
+
function mt(t, o) {
|
|
403
|
+
var r, d, p, u, m, h;
|
|
404
404
|
const e = t == null ? void 0 : t.theme, l = [];
|
|
405
|
-
(
|
|
406
|
-
const s = l.join("; "), n = ((
|
|
405
|
+
(r = e == null ? void 0 : e.textStyle) != null && r["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"}`), (u = e == null ? void 0 : e.textStyle) != null && u["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 = ((h = e == null ? void 0 : e.textStyle) == null ? void 0 : h["font-weight"]) !== "normal", i = c(o), a = 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${b(s)}>${a}</p>
|
|
410
410
|
</td>
|
|
411
411
|
`;
|
|
412
412
|
}
|
|
413
|
-
function
|
|
413
|
+
function $t(t) {
|
|
414
414
|
const o = t.alignment === "before" ? "0" : "1";
|
|
415
|
-
return ` ${
|
|
415
|
+
return ` ${R.CURRENCY}="${c(t.code)}" ${R.SYMBOL}="${c(t.symbol)}" ${R.ALIGNMENT}="${o}" ${R.THOUSAND_SEPARATOR}="${c(t.thousandSeparator)}" ${R.DECIMAL_SEPARATOR}="${c(t.decimalSeparator)}" ${R.DECIMAL_COUNT}="${t.decimalCount}"`;
|
|
416
416
|
}
|
|
417
|
-
function
|
|
417
|
+
function Tt(t) {
|
|
418
418
|
const {
|
|
419
419
|
nodeConfig: o,
|
|
420
420
|
composition: e,
|
|
@@ -422,13 +422,18 @@ function Ct(t) {
|
|
|
422
422
|
titleText: s,
|
|
423
423
|
extraClasses: n = "",
|
|
424
424
|
legacyId: i,
|
|
425
|
-
legacyBgColor:
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
425
|
+
legacyBgColor: a
|
|
426
|
+
} = t, r = parseInt(o.size) || 6, d = o.layout === "list" ? ' data-layout="list"' : "", p = o.layout === "list" ? " es-m-p0 ins-recommendation-list-layout" : "", u = {
|
|
427
|
+
composition: e.composition,
|
|
428
|
+
visibility: e.visibility,
|
|
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 = [
|
|
429
434
|
"recommendation-block-v2",
|
|
430
435
|
"esd-block-recommendation-v3-block",
|
|
431
|
-
`es-p20${
|
|
436
|
+
`es-p20${p}`,
|
|
432
437
|
`ins-recommendation-v3-block-${o.recommendationId}`,
|
|
433
438
|
// Marker class Stripo's block infrastructure uses to identify recommendation
|
|
434
439
|
// blocks. Without it, certain Styles-panel controls (e.g. button "Fit to
|
|
@@ -437,18 +442,20 @@ function Ct(t) {
|
|
|
437
442
|
"esd-extension-block",
|
|
438
443
|
"esd-container-frame",
|
|
439
444
|
"ins-recommendation-no-mobile-layout",
|
|
440
|
-
d ? ot : "",
|
|
441
445
|
n
|
|
442
|
-
].filter(Boolean).join(" "), C =
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
446
|
+
].filter(Boolean).join(" "), C = $t(o.currency), S = ` esd-ext-config="${c(JSON.stringify(o))}"`, x = i ? ` id="${c(i)}"` : "", A = a ? ` bgcolor="${c(a)}"` : "";
|
|
447
|
+
return nt(`
|
|
448
|
+
<td align="left"
|
|
449
|
+
esd-extension-block-id="recommendation-block"
|
|
450
|
+
width="520"
|
|
451
|
+
class="${f}"${x}${A}
|
|
452
|
+
recommendation-id="${o.recommendationId}"${C}
|
|
453
|
+
data-card-composition="${c(T)}"
|
|
454
|
+
data-custom-attributes="${c(w)}"
|
|
455
|
+
data-column-spacing="${o.columnSpacing}"
|
|
456
|
+
data-row-spacing="${o.rowSpacing}"
|
|
457
|
+
data-mobile-column-spacing="${o.mobileColumnSpacing}"
|
|
458
|
+
data-mobile-row-spacing="${o.mobileRowSpacing}"${d}${S}>
|
|
452
459
|
<table width="100%" cellpadding="0" cellspacing="0" border="0">
|
|
453
460
|
<tbody>
|
|
454
461
|
<tr>
|
|
@@ -459,7 +466,7 @@ function Ct(t) {
|
|
|
459
466
|
<td>
|
|
460
467
|
<table width="100%" cellpadding="0" cellspacing="0" border="0">
|
|
461
468
|
<tbody>
|
|
462
|
-
<tr>${
|
|
469
|
+
<tr>${h}</tr>
|
|
463
470
|
</tbody>
|
|
464
471
|
</table>
|
|
465
472
|
</td>
|
|
@@ -470,7 +477,7 @@ function Ct(t) {
|
|
|
470
477
|
<tr>
|
|
471
478
|
<td>
|
|
472
479
|
<table width="100%" cellpadding="0" cellspacing="0" border="0"
|
|
473
|
-
class="${
|
|
480
|
+
class="${ot}">${m}
|
|
474
481
|
</table>
|
|
475
482
|
</td>
|
|
476
483
|
</tr>
|
|
@@ -480,23 +487,10 @@ function Ct(t) {
|
|
|
480
487
|
</td>
|
|
481
488
|
</tr>
|
|
482
489
|
</tbody>
|
|
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}>${_}
|
|
490
|
+
</table>
|
|
497
491
|
</td>
|
|
498
492
|
`);
|
|
499
493
|
}
|
|
500
494
|
export {
|
|
501
|
-
|
|
495
|
+
Tt as buildBlockHtml
|
|
502
496
|
};
|