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