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