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