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