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