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