@useinsider/guido 3.4.0-beta.0ec3bc7 → 3.4.0-beta.14fc097
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/composables/useHtmlValidator.js +25 -24
- package/dist/config/compiler/recommendationCompilerRules.js +10 -10
- package/dist/config/migrator/recommendation/htmlBuilder.js +65 -65
- package/dist/extensions/Blocks/Recommendation/templates/grid/elementRenderer.js +7 -7
- package/dist/extensions/Blocks/Recommendation/templates/list/elementRenderer.js +7 -7
- package/dist/extensions/Blocks/Recommendation/utils/filterUtil.js +3 -3
- package/package.json +1 -1
- /package/dist/src/extensions/Blocks/Recommendation/{utils/filterUtil.test.d.ts → validation/requiredFields.test.d.ts} +0 -0
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { useConfig as
|
|
1
|
+
import { useConfig as V } from "./useConfig.js";
|
|
2
2
|
import { TemplateTypes as H } from "../enums/defaults.js";
|
|
3
3
|
import { DISPLAY_CONDITIONS_REGEX as P, DISPLAY_CONDITIONS_EXCEPTIONS_REGEX as G, CampaignCouldNotBeSavedKey as M, CanNotMakeAnyChangesForRunningKey as $ } from "../enums/html-validator.js";
|
|
4
4
|
import { ToasterTypeOptions as c } from "../enums/toaster.js";
|
|
5
|
-
import { itemsBlockDynamicVariables as
|
|
6
|
-
import { useRecommendationExtensionStore as
|
|
7
|
-
import { RecommendationRequiredFieldsKey as
|
|
5
|
+
import { itemsBlockDynamicVariables as j } from "../extensions/Blocks/Items/enums/productEnums.js";
|
|
6
|
+
import { useRecommendationExtensionStore as q } from "../extensions/Blocks/Recommendation/store/recommendation.js";
|
|
7
|
+
import { RecommendationRequiredFieldsKey as X } from "../extensions/Blocks/Recommendation/validation/requiredFields.js";
|
|
8
8
|
import { useRecommendationStore as K } from "../stores/recommendation.js";
|
|
9
9
|
import { base64EncodeWithSpecialChars as z } from "../utils/base64.js";
|
|
10
10
|
import { useHttp as U } from "./useHttp.js";
|
|
@@ -18,8 +18,8 @@ function ee(a, u) {
|
|
|
18
18
|
return u.some((d) => a.startsWith(`${d}_`));
|
|
19
19
|
}
|
|
20
20
|
const ge = () => {
|
|
21
|
-
var
|
|
22
|
-
const { showToaster: a } = Y(), { post: u } = U(), { config: d } =
|
|
21
|
+
var h, v;
|
|
22
|
+
const { showToaster: a } = Y(), { post: u } = U(), { config: d } = V(), r = Z(), p = K(), f = q(), y = ((v = (h = d.value) == null ? void 0 : h.partner) == null ? void 0 : v.messageType) === H.transactional, w = async (e) => {
|
|
23
23
|
const t = await u(
|
|
24
24
|
"/newsletter/template-library/check-template-html-body",
|
|
25
25
|
{ html: z(e) }
|
|
@@ -31,21 +31,21 @@ const ge = () => {
|
|
|
31
31
|
type: c.Alert,
|
|
32
32
|
message: r("newsletter.already-in-progress")
|
|
33
33
|
}), n;
|
|
34
|
-
},
|
|
34
|
+
}, S = (e) => !["if", "endif", "else", "elif", "now"].includes(e.toLowerCase()), E = (e) => ["if", "endif"].includes(e.toLowerCase()), A = (e, s) => {
|
|
35
35
|
const t = e.match(/({%(.*?)%})/g);
|
|
36
36
|
let n = !0;
|
|
37
|
-
return t !== null && !
|
|
37
|
+
return t !== null && !y && t.forEach((l) => {
|
|
38
38
|
const o = l.slice(2, -2).trim().match(/(".*?"|[^"\s]+)(?=\s*|\s*$)/g);
|
|
39
39
|
if (o && o.length > 0) {
|
|
40
40
|
const [i] = o;
|
|
41
|
-
|
|
41
|
+
S(i) && !s.includes(i) && (a({
|
|
42
42
|
type: c.Warning,
|
|
43
43
|
message: r("custom-fields.invalid-custom-fields")
|
|
44
44
|
}), n = !1);
|
|
45
45
|
}
|
|
46
46
|
}), n;
|
|
47
47
|
}, k = async (e, s, t) => {
|
|
48
|
-
const n = t ? await
|
|
48
|
+
const n = t ? await w(e) : !0;
|
|
49
49
|
return A(e, s) && n;
|
|
50
50
|
}, x = (e) => e.length > 0 ? !0 : (a({
|
|
51
51
|
type: c.Warning,
|
|
@@ -65,9 +65,9 @@ const ge = () => {
|
|
|
65
65
|
type: c.Warning,
|
|
66
66
|
message: r("custom-fields.invalid-custom-fields")
|
|
67
67
|
}), s;
|
|
68
|
-
},
|
|
68
|
+
}, R = (e, s) => {
|
|
69
69
|
const t = e.match(/{{([a-zA-Z0-9_\s]*)}}/gm);
|
|
70
|
-
if (t && !
|
|
70
|
+
if (t && !y) {
|
|
71
71
|
const n = new Set(s.map((i) => i.toLowerCase())), l = Q(e), o = [];
|
|
72
72
|
if (t.forEach((i) => {
|
|
73
73
|
const m = i.slice(2, -2).trim().toLowerCase();
|
|
@@ -85,7 +85,7 @@ const ge = () => {
|
|
|
85
85
|
}
|
|
86
86
|
}
|
|
87
87
|
return !0;
|
|
88
|
-
},
|
|
88
|
+
}, T = (e) => {
|
|
89
89
|
const s = e.match(/{%(.*?)%}/g), t = [];
|
|
90
90
|
let n = !0;
|
|
91
91
|
if (s && s.forEach((l) => {
|
|
@@ -93,14 +93,14 @@ const ge = () => {
|
|
|
93
93
|
(!o || l !== m) && !i && (a({
|
|
94
94
|
type: c.Alert,
|
|
95
95
|
message: r("newsletter.display-conditions-invalid-syntax")
|
|
96
|
-
}), n = !1), o && o.forEach((
|
|
97
|
-
|
|
96
|
+
}), n = !1), o && o.forEach((g) => {
|
|
97
|
+
g.trim() === "=" && (a({
|
|
98
98
|
type: c.Alert,
|
|
99
99
|
message: r("custom-conditions.wrong-equality-operators")
|
|
100
100
|
}), n = !1);
|
|
101
|
-
const
|
|
102
|
-
|
|
103
|
-
E(
|
|
101
|
+
const C = g.match(/^[a-zA-Z]*$/g);
|
|
102
|
+
C && C.forEach((b) => {
|
|
103
|
+
E(b) && t.push(b);
|
|
104
104
|
});
|
|
105
105
|
});
|
|
106
106
|
}), t.length) {
|
|
@@ -120,10 +120,10 @@ const ge = () => {
|
|
|
120
120
|
}, W = (e) => (e.match(/({%(.*?)%})/g) || []).filter((t) => t.includes("if")).map((t) => (t.match(/{{.*}}/gm) || []).length).reduce((t, n) => t + n, 0) > 0 ? (a({
|
|
121
121
|
type: c.Warning,
|
|
122
122
|
message: r("custom-conditions.no-braces-inside-if-tag")
|
|
123
|
-
}), !1) : !0, N = () =>
|
|
123
|
+
}), !1) : !0, N = () => f.hasInvalidBlock() ? (a({
|
|
124
124
|
type: c.Alert,
|
|
125
|
-
message: r(
|
|
126
|
-
}), !1) : !0, O = () =>
|
|
125
|
+
message: r(X)
|
|
126
|
+
}), !1) : !0, O = () => p.recommendationConfigs && Object.values(p.recommendationConfigs).find((s) => s.filters.find((t) => t.value === "")) !== void 0 ? (a({
|
|
127
127
|
type: c.Alert,
|
|
128
128
|
message: r("newsletter.fill-all-necessary-fields")
|
|
129
129
|
}), !1) : !0, D = (e) => {
|
|
@@ -141,7 +141,7 @@ const ge = () => {
|
|
|
141
141
|
type: c.Alert,
|
|
142
142
|
message: r("unsubscribe-templates.select-checkbox-groups")
|
|
143
143
|
}), !1) : !0;
|
|
144
|
-
},
|
|
144
|
+
}, _ = (e) => {
|
|
145
145
|
const n = new DOMParser().parseFromString(e, "text/html").querySelectorAll(".radio-button-v2");
|
|
146
146
|
return Array.from(n).find((o) => {
|
|
147
147
|
var i;
|
|
@@ -153,12 +153,13 @@ const ge = () => {
|
|
|
153
153
|
};
|
|
154
154
|
return { validateHtml: async (e, s, t = !1) => {
|
|
155
155
|
var o, i;
|
|
156
|
+
t && Object.keys(f.blockStates).length > 0 && await f.fetchRecommendationCreateData();
|
|
156
157
|
const n = [
|
|
157
158
|
...s.map((m) => m.value),
|
|
158
|
-
...
|
|
159
|
+
...j,
|
|
159
160
|
...((i = (o = d.value) == null ? void 0 : o.template) == null ? void 0 : i.customFieldAttributes) ?? []
|
|
160
161
|
];
|
|
161
|
-
return await k(e, n, t) && x(e) && I(e) && F(e) &&
|
|
162
|
+
return await k(e, n, t) && x(e) && I(e) && F(e) && R(e, n) && T(e) && B(e) && W(e) && N() && O() && D(e) && L(e) && _(e);
|
|
162
163
|
} };
|
|
163
164
|
};
|
|
164
165
|
export {
|
|
@@ -68,16 +68,16 @@ const w = [
|
|
|
68
68
|
const [i] = a, u = i.match(T.CUSTOM_FIELD_INDEXES_PART), _ = i.match(T.CUSTOM_FIELD_NAME_PART), R = s.match(T.ATTRIBUTE_PARAGRAPH_START_TAG);
|
|
69
69
|
if (!u || !_ || !R)
|
|
70
70
|
return;
|
|
71
|
-
const [S] = u, [
|
|
71
|
+
const [S] = u, [b] = _, [d] = R, o = b.substring(1, b.length - 2), r = d.match(T.COMPOSITION) !== null;
|
|
72
72
|
let t = i;
|
|
73
73
|
if (r) {
|
|
74
74
|
const I = S.substring(2, S.length - 3), m = n(I);
|
|
75
75
|
o === A.OMNIBUS_PRICE && (m.priceBeforeTextValue && (t = `${m.priceBeforeTextValue}${t}`), m.priceAfterTextValue && (t = `${t}${m.priceAfterTextValue}`)), o === A.OMNIBUS_DISCOUNT && (m.discountBeforeTextValue && (t = `${m.discountBeforeTextValue}${t}`), m.discountAfterTextValue && (t = `${t}${m.discountAfterTextValue}`));
|
|
76
76
|
}
|
|
77
77
|
const p = S.substring(2);
|
|
78
|
-
let
|
|
79
|
-
o in g.IF && (
|
|
80
|
-
const $ = `${d}${t}${N.PARAGRAPH_END_TAG}`, h = `${
|
|
78
|
+
let f = "";
|
|
79
|
+
o in g.IF && (f = g.IF[o].replaceAll(`{${A.DISCOUNT}}`, `${p}${A.DISCOUNT}`).replaceAll(`{${A.OMNIBUS_DISCOUNT}}`, `${p}${A.OMNIBUS_DISCOUNT}`).replaceAll(`{${A.OMNIBUS_PRICE}}`, `${p}${A.OMNIBUS_PRICE}`));
|
|
80
|
+
const $ = `${d}${t}${N.PARAGRAPH_END_TAG}`, h = `${f}${r ? $ : s}${g.ELSE}${d}${N.PARAGRAPH_END_TAG}${g.END_IF}`;
|
|
81
81
|
e = e.replace(s, h);
|
|
82
82
|
}), e;
|
|
83
83
|
},
|
|
@@ -116,7 +116,7 @@ const w = [
|
|
|
116
116
|
/ class="(?:product-card-segment|attribute-cell|recommendation-attribute-row|product-image|product-name|product-price|product-old-price|product-omnibus-price|product-omnibus-discount|product-button|recommendation-product-row|product-card-wrapper)"/g,
|
|
117
117
|
""
|
|
118
118
|
);
|
|
119
|
-
return e = e.replaceAll("ins-recommendation-product-container ", ""), e;
|
|
119
|
+
return e = e.replaceAll("es-button buy-button", "es-button"), e = e.replaceAll("ins-recommendation-product-container ", ""), e;
|
|
120
120
|
},
|
|
121
121
|
priority: 56
|
|
122
122
|
},
|
|
@@ -174,10 +174,10 @@ const w = [
|
|
|
174
174
|
let o = e;
|
|
175
175
|
return o = o.replaceAll("<!--REC_START-->", ""), o = o.replaceAll("<!--REC_END-->", ""), o;
|
|
176
176
|
}
|
|
177
|
-
const R = (o) => o.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), S = (o, r) => `${o.slice(0, -1)} ${r}"`,
|
|
177
|
+
const R = (o) => o.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), S = (o, r) => `${o.slice(0, -1)} ${r}"`, b = /* @__PURE__ */ new Map();
|
|
178
178
|
i.forEach((o, r) => {
|
|
179
179
|
const t = R(r);
|
|
180
|
-
|
|
180
|
+
b.set(r, {
|
|
181
181
|
caseA: new RegExp(`(class="[^"]*")((?:[^>]*?)) style="${t}"`, "g"),
|
|
182
182
|
caseB: new RegExp(` style="${t}"((?:[^>]*?))(class="[^"]*")`, "g")
|
|
183
183
|
});
|
|
@@ -187,15 +187,15 @@ const w = [
|
|
|
187
187
|
/<!--REC_START-->([\s\S]*?)<!--REC_END-->/g,
|
|
188
188
|
(o, r) => {
|
|
189
189
|
let t = r;
|
|
190
|
-
return i.forEach((p,
|
|
191
|
-
const $ =
|
|
190
|
+
return i.forEach((p, f) => {
|
|
191
|
+
const $ = b.get(f);
|
|
192
192
|
t = t.replace(
|
|
193
193
|
$.caseA,
|
|
194
194
|
(h, I, m) => S(I, p) + m
|
|
195
195
|
), t = t.replace(
|
|
196
196
|
$.caseB,
|
|
197
197
|
(h, I, m) => I + S(m, p)
|
|
198
|
-
), t = t.replaceAll(` style="${
|
|
198
|
+
), t = t.replaceAll(` style="${f}"`, ` class="${p}"`);
|
|
199
199
|
}), t;
|
|
200
200
|
}
|
|
201
201
|
), d = d.replaceAll("<!--REC_START-->", ""), d = d.replaceAll("<!--REC_END-->", ""), d;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { RecommendationBlockId as g } from "../../../extensions/Blocks/Recommendation/constants/blockIds.js";
|
|
2
|
-
import { CURRENCY_ATTR as R, ATTR_PRODUCT_IMAGE as
|
|
2
|
+
import { CURRENCY_ATTR as R, ATTR_PRODUCT_IMAGE as I, ATTR_PRODUCT_BUTTON as k, ATTR_PRODUCT_NAME as z, ATTR_PRODUCT_PRICE as G, 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
3
|
import { formatPrice as N } from "../../../extensions/Blocks/Recommendation/utils/priceFormatter.js";
|
|
4
4
|
import { escapeHtml as c } from "../../../utils/htmlEscape.js";
|
|
5
5
|
import { appendStyle as $ } from "./themeMapper.js";
|
|
@@ -22,7 +22,7 @@ function _() {
|
|
|
22
22
|
function K(t) {
|
|
23
23
|
return t ? { ...t, wrapBold: !0 } : { ..._(), wrapBold: !0 };
|
|
24
24
|
}
|
|
25
|
-
function
|
|
25
|
+
function v(t, o) {
|
|
26
26
|
let e = c(t);
|
|
27
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
28
|
}
|
|
@@ -35,11 +35,11 @@ function O(t, o) {
|
|
|
35
35
|
function nt(t, o, e, l) {
|
|
36
36
|
const s = t.width ? ` width="${t.width}"` : "", n = t.height ? ` height="${t.height}"` : "", i = ["display: block", "max-width: 100%", "height: auto"];
|
|
37
37
|
t.width && i.push(`width: ${t.width}px`), t.height && i.push(`height: ${t.height}px`);
|
|
38
|
-
const
|
|
38
|
+
const a = i.join("; "), r = e ? ` style="background-color: ${c(e)}"` : "";
|
|
39
39
|
return `
|
|
40
40
|
${O(l, 'valign="top" style="padding: 0 5px; height: 100%"')}>
|
|
41
41
|
<table width="100%" height="100%" cellpadding="0" cellspacing="0" border="0"
|
|
42
|
-
class="product-card-segment"${
|
|
42
|
+
class="product-card-segment"${r}>
|
|
43
43
|
<tbody>
|
|
44
44
|
<tr valign="top">
|
|
45
45
|
<td align="center"
|
|
@@ -48,7 +48,7 @@ function nt(t, o, e, l) {
|
|
|
48
48
|
<a target="_blank" href="https://example.com/product/${o + 1}">
|
|
49
49
|
<img src="${V}" alt="Product Name"
|
|
50
50
|
class="adapt-img"${s}${n}
|
|
51
|
-
style="${
|
|
51
|
+
style="${a}">
|
|
52
52
|
</a>
|
|
53
53
|
</td>
|
|
54
54
|
</tr>
|
|
@@ -58,17 +58,17 @@ function nt(t, o, e, l) {
|
|
|
58
58
|
`;
|
|
59
59
|
}
|
|
60
60
|
function D(t, o, e, l, s, n, i) {
|
|
61
|
-
const
|
|
61
|
+
const r = `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
62
|
return `
|
|
63
63
|
${O(i, 'valign="top" style="padding: 0 5px; height: 100%"')}>
|
|
64
64
|
<table width="100%" height="100%" cellpadding="0" cellspacing="0" border="0"
|
|
65
|
-
class="product-card-segment" style="${
|
|
65
|
+
class="product-card-segment" style="${r}">
|
|
66
66
|
<tbody>
|
|
67
67
|
<tr valign="top">
|
|
68
68
|
<td${p}
|
|
69
69
|
class="${u}"
|
|
70
70
|
esd-extension-block-id="${t}"${d}>
|
|
71
|
-
<p contenteditable="false"${b(m)}>${
|
|
71
|
+
<p contenteditable="false"${b(m)}>${v(e, s)}</p>
|
|
72
72
|
</td>
|
|
73
73
|
</tr>
|
|
74
74
|
</tbody>
|
|
@@ -77,7 +77,7 @@ function D(t, o, e, l, s, n, i) {
|
|
|
77
77
|
`;
|
|
78
78
|
}
|
|
79
79
|
function lt(t, o, e, l) {
|
|
80
|
-
const s = o ? ` style="background-color: ${c(o)}"` : "", n = b(t.tdStyle), i = y(t.align),
|
|
80
|
+
const s = o ? ` style="background-color: ${c(o)}"` : "", n = b(t.tdStyle), i = y(t.align), r = $("font-size: 14px; color: #999999", t.pStyle);
|
|
81
81
|
return `
|
|
82
82
|
${O(e, 'valign="top" style="padding: 0 5px; height: 100%"')}>
|
|
83
83
|
<table width="100%" height="100%" cellpadding="0" cellspacing="0" border="0"
|
|
@@ -87,8 +87,8 @@ function lt(t, o, e, l) {
|
|
|
87
87
|
<td${i}
|
|
88
88
|
class="esd-block-text product-old-price es-p15l es-p15r"
|
|
89
89
|
esd-extension-block-id="${g.OLD_PRICE}"${n}>
|
|
90
|
-
<p contenteditable="false"${b(
|
|
91
|
-
<s>${
|
|
90
|
+
<p contenteditable="false"${b(r)}>
|
|
91
|
+
<s>${v(l, t)}</s>
|
|
92
92
|
</p>
|
|
93
93
|
</td>
|
|
94
94
|
</tr>
|
|
@@ -98,17 +98,17 @@ function lt(t, o, e, l) {
|
|
|
98
98
|
`;
|
|
99
99
|
}
|
|
100
100
|
function L(t, o, e, l, s, n, i) {
|
|
101
|
-
const
|
|
101
|
+
const a = s ? `; background-color: ${c(s)}` : "", r = b(l.tdStyle), d = y(l.align), u = $("font-size: 12px; color: #666666", l.pStyle);
|
|
102
102
|
return `
|
|
103
103
|
${O(i, 'valign="top" style="padding: 0 5px; height: 100%"')}>
|
|
104
104
|
<table width="100%" height="100%" cellpadding="0" cellspacing="0" border="0"
|
|
105
|
-
class="product-card-segment" style="table-layout: fixed${
|
|
105
|
+
class="product-card-segment" style="table-layout: fixed${a}">
|
|
106
106
|
<tbody>
|
|
107
107
|
<tr valign="top">
|
|
108
108
|
<td${d}
|
|
109
109
|
data-text-before="" data-text-after=""
|
|
110
110
|
class="esd-block-text ${n} es-p15l es-p15r"
|
|
111
|
-
esd-extension-block-id="${t}"${
|
|
111
|
+
esd-extension-block-id="${t}"${r}>
|
|
112
112
|
<p contenteditable="false"${b(u)}>
|
|
113
113
|
<span class="omnibus-text-before"></span>
|
|
114
114
|
<span class="${o}">${c(e)}</span>
|
|
@@ -122,7 +122,7 @@ function L(t, o, e, l, s, n, i) {
|
|
|
122
122
|
`;
|
|
123
123
|
}
|
|
124
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),
|
|
125
|
+
const s = e ? ` style="background-color: ${c(e)}"` : "", n = $("padding: 0 5px; height: 100%", o.tdStyle), i = y(o.align), a = o.text || F, r = $(J, o.spanStyle), d = $(X, o.aStyle);
|
|
126
126
|
return `
|
|
127
127
|
${O(l, `valign="top" style="${c(n)}"`)}>
|
|
128
128
|
<table width="100%" height="100%" cellpadding="0" cellspacing="0" border="0"
|
|
@@ -132,10 +132,10 @@ function st(t, o, e, l) {
|
|
|
132
132
|
<td${i}
|
|
133
133
|
class="esd-block-button product-button es-p10t es-p10b es-p5l es-p5r"
|
|
134
134
|
esd-extension-block-id="${g.BUTTON}">
|
|
135
|
-
<span class="es-button-border" style="${c(
|
|
135
|
+
<span class="es-button-border" style="${c(r)}">
|
|
136
136
|
<a href="https://example.com/product/${t + 1}" target="_blank"
|
|
137
|
-
class="es-button
|
|
138
|
-
style="${c(d)}">${c(
|
|
137
|
+
class="es-button buy-button"
|
|
138
|
+
style="${c(d)}">${c(a)}</a>
|
|
139
139
|
</span>
|
|
140
140
|
</td>
|
|
141
141
|
</tr>
|
|
@@ -145,14 +145,14 @@ function st(t, o, e, l) {
|
|
|
145
145
|
`;
|
|
146
146
|
}
|
|
147
147
|
function it(t, o, e, l, s) {
|
|
148
|
-
const n = l ? `; background-color: ${c(l)}` : "", i = b(e.tdStyle),
|
|
148
|
+
const n = l ? `; background-color: ${c(l)}` : "", i = b(e.tdStyle), a = 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
149
|
return `
|
|
150
150
|
${O(s, 'valign="middle" style="padding: 0 5px; height: 100%"')}>
|
|
151
151
|
<table width="100%" height="100%" cellpadding="0" cellspacing="0" border="0"
|
|
152
152
|
class="product-card-segment" style="table-layout: fixed${n}">
|
|
153
153
|
<tbody>
|
|
154
154
|
<tr valign="top">
|
|
155
|
-
<td product-attr="${c(t)}"${
|
|
155
|
+
<td product-attr="${c(t)}"${a}
|
|
156
156
|
class="esd-block-text product-custom-attribute es-p0t es-p0b es-p15l es-p15r"
|
|
157
157
|
esd-extension-block-id="${g.CUSTOM_ATTRIBUTE}"${i}>
|
|
158
158
|
<p contenteditable="false"${b(d)}>${c(p)}</p>
|
|
@@ -164,11 +164,11 @@ function it(t, o, e, l, s) {
|
|
|
164
164
|
`;
|
|
165
165
|
}
|
|
166
166
|
function ct(t, o, e, l, s, n, i) {
|
|
167
|
-
const
|
|
167
|
+
const a = o[t], r = a ?? _();
|
|
168
168
|
switch (t) {
|
|
169
|
-
case
|
|
169
|
+
case I:
|
|
170
170
|
return nt(
|
|
171
|
-
|
|
171
|
+
a ?? {},
|
|
172
172
|
s,
|
|
173
173
|
l,
|
|
174
174
|
n
|
|
@@ -179,7 +179,7 @@ function ct(t, o, e, l, s, n, i) {
|
|
|
179
179
|
"product-name es-p10t es-p10b es-p15l es-p15r",
|
|
180
180
|
"Product Name",
|
|
181
181
|
"font-size: 16px; color: #333333",
|
|
182
|
-
|
|
182
|
+
r,
|
|
183
183
|
l,
|
|
184
184
|
n
|
|
185
185
|
);
|
|
@@ -189,18 +189,18 @@ function ct(t, o, e, l, s, n, i) {
|
|
|
189
189
|
"product-price es-p15l es-p15r",
|
|
190
190
|
i.pricePlaceholder,
|
|
191
191
|
"font-size: 16px; color: #333333",
|
|
192
|
-
K(
|
|
192
|
+
K(a),
|
|
193
193
|
l,
|
|
194
194
|
n
|
|
195
195
|
);
|
|
196
196
|
case H:
|
|
197
|
-
return lt(
|
|
197
|
+
return lt(r, l, n, i.oldPricePlaceholder);
|
|
198
198
|
case U:
|
|
199
199
|
return L(
|
|
200
200
|
g.OMNIBUS_PRICE,
|
|
201
201
|
"omnibus-price-value",
|
|
202
202
|
i.omnibusPricePlaceholder,
|
|
203
|
-
|
|
203
|
+
r,
|
|
204
204
|
l,
|
|
205
205
|
"product-omnibus-price",
|
|
206
206
|
n
|
|
@@ -210,22 +210,22 @@ function ct(t, o, e, l, s, n, i) {
|
|
|
210
210
|
g.OMNIBUS_DISCOUNT,
|
|
211
211
|
"omnibus-discount-value",
|
|
212
212
|
"-10%",
|
|
213
|
-
|
|
213
|
+
r,
|
|
214
214
|
l,
|
|
215
215
|
"product-omnibus-discount",
|
|
216
216
|
n
|
|
217
217
|
);
|
|
218
|
-
case
|
|
218
|
+
case k:
|
|
219
219
|
return st(
|
|
220
220
|
s,
|
|
221
|
-
|
|
221
|
+
a ?? {},
|
|
222
222
|
l,
|
|
223
223
|
n
|
|
224
224
|
);
|
|
225
225
|
default:
|
|
226
226
|
if (t.startsWith(E)) {
|
|
227
227
|
const d = e[t] ?? t.slice(E.length), p = t.slice(E.length);
|
|
228
|
-
return it(d, p,
|
|
228
|
+
return it(d, p, r, l, n);
|
|
229
229
|
}
|
|
230
230
|
return null;
|
|
231
231
|
}
|
|
@@ -235,15 +235,15 @@ const q = `
|
|
|
235
235
|
<td class="spacer" style="height: 10px"></td>
|
|
236
236
|
</tr>
|
|
237
237
|
`;
|
|
238
|
-
function
|
|
238
|
+
function at(t) {
|
|
239
239
|
return {
|
|
240
240
|
pricePlaceholder: N({ price: 18, currency: t }),
|
|
241
241
|
oldPricePlaceholder: N({ price: 20, currency: t }),
|
|
242
242
|
omnibusPricePlaceholder: N({ price: 20, currency: t })
|
|
243
243
|
};
|
|
244
244
|
}
|
|
245
|
-
function
|
|
246
|
-
const { composition: s, visibility: n, perElement: i, customAttrValues:
|
|
245
|
+
function rt(t, o, e, l) {
|
|
246
|
+
const { composition: s, visibility: n, perElement: i, customAttrValues: a, cardBg: r } = 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
247
|
return `
|
|
248
248
|
<tr class="recommendation-product-row">
|
|
249
249
|
<td>
|
|
@@ -255,8 +255,8 @@ function at(t, o, e, l) {
|
|
|
255
255
|
const A = ct(
|
|
256
256
|
T,
|
|
257
257
|
i,
|
|
258
|
-
r,
|
|
259
258
|
a,
|
|
259
|
+
r,
|
|
260
260
|
t + x,
|
|
261
261
|
d,
|
|
262
262
|
l
|
|
@@ -280,71 +280,71 @@ function dt(t, o, e) {
|
|
|
280
280
|
const l = [];
|
|
281
281
|
for (let s = 0; s < t; s += o) {
|
|
282
282
|
const n = Math.min(o, t - s);
|
|
283
|
-
s > 0 && l.push(q), l.push(
|
|
283
|
+
s > 0 && l.push(q), l.push(rt(s, n, o, e));
|
|
284
284
|
}
|
|
285
285
|
return l.join("");
|
|
286
286
|
}
|
|
287
287
|
function pt(t, o, e, l) {
|
|
288
288
|
const s = o[t];
|
|
289
289
|
if (t === z) {
|
|
290
|
-
const n = s ?? _(), i = $("font-size: 16px; color: #333333; margin: 0", n.pStyle),
|
|
290
|
+
const n = s ?? _(), i = $("font-size: 16px; color: #333333; margin: 0", n.pStyle), a = y(n.align ?? "left");
|
|
291
291
|
return `
|
|
292
292
|
<td class="esd-block-text product-name"
|
|
293
|
-
esd-extension-block-id="${g.NAME}"${
|
|
294
|
-
<p contenteditable="false"${b(i)}>${
|
|
293
|
+
esd-extension-block-id="${g.NAME}"${a}${b(n.tdStyle)}>
|
|
294
|
+
<p contenteditable="false"${b(i)}>${v("Product Name", n)}</p>
|
|
295
295
|
</td>
|
|
296
296
|
`;
|
|
297
297
|
}
|
|
298
298
|
if (t === G) {
|
|
299
|
-
const n = K(s), i = $("font-size: 16px; color: #333333; margin: 0", n.pStyle),
|
|
299
|
+
const n = K(s), i = $("font-size: 16px; color: #333333; margin: 0", n.pStyle), a = y(n.align ?? "left");
|
|
300
300
|
return `
|
|
301
301
|
<td class="esd-block-text product-price"
|
|
302
|
-
esd-extension-block-id="${g.PRICE}"${
|
|
303
|
-
<p contenteditable="false"${b(i)}>${
|
|
302
|
+
esd-extension-block-id="${g.PRICE}"${a}${b(n.tdStyle)}>
|
|
303
|
+
<p contenteditable="false"${b(i)}>${v(l.pricePlaceholder, n)}</p>
|
|
304
304
|
</td>
|
|
305
305
|
`;
|
|
306
306
|
}
|
|
307
307
|
if (t === H) {
|
|
308
|
-
const n = s ?? _(),
|
|
308
|
+
const n = s ?? _(), a = $("font-size: 14px; color: #999999; text-decoration: line-through; margin: 0", n.pStyle), r = y(n.align ?? "left");
|
|
309
309
|
return `
|
|
310
310
|
<td class="esd-block-text product-old-price"
|
|
311
|
-
esd-extension-block-id="${g.OLD_PRICE}"${
|
|
312
|
-
<p contenteditable="false"${b(
|
|
311
|
+
esd-extension-block-id="${g.OLD_PRICE}"${r}${b(n.tdStyle)}>
|
|
312
|
+
<p contenteditable="false"${b(a)}><s>${v(l.oldPricePlaceholder, n)}</s></p>
|
|
313
313
|
</td>
|
|
314
314
|
`;
|
|
315
315
|
}
|
|
316
316
|
if (t === U || t === j) {
|
|
317
|
-
const n = t === U, i = n ? g.OMNIBUS_PRICE : g.OMNIBUS_DISCOUNT,
|
|
317
|
+
const n = t === U, i = n ? g.OMNIBUS_PRICE : g.OMNIBUS_DISCOUNT, a = n ? "omnibus-price-value" : "omnibus-discount-value", r = 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
318
|
return `
|
|
319
319
|
<td class="esd-block-text ${d}"
|
|
320
320
|
data-text-before="" data-text-after=""
|
|
321
321
|
esd-extension-block-id="${i}"${m}${b(p.tdStyle)}>
|
|
322
322
|
<p contenteditable="false"${b(u)}>
|
|
323
323
|
<span class="omnibus-text-before"></span>
|
|
324
|
-
<span class="${
|
|
324
|
+
<span class="${a}">${c(r)}</span>
|
|
325
325
|
<span class="omnibus-text-after"></span>
|
|
326
326
|
</p>
|
|
327
327
|
</td>
|
|
328
328
|
`;
|
|
329
329
|
}
|
|
330
330
|
if (t.startsWith(E)) {
|
|
331
|
-
const n = s ?? _(), i = e[t] ?? t.slice(E.length),
|
|
331
|
+
const n = s ?? _(), i = e[t] ?? t.slice(E.length), r = 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
332
|
return `
|
|
333
333
|
<td product-attr="${c(i)}"
|
|
334
334
|
class="esd-block-text product-custom-attribute"
|
|
335
335
|
esd-extension-block-id="${u}"${p}${b(n.tdStyle)}>
|
|
336
|
-
<p contenteditable="false"${b(d)}>${c(
|
|
336
|
+
<p contenteditable="false"${b(d)}>${c(r)}</p>
|
|
337
337
|
</td>
|
|
338
338
|
`;
|
|
339
339
|
}
|
|
340
340
|
return null;
|
|
341
341
|
}
|
|
342
342
|
function ut(t, o) {
|
|
343
|
-
const { composition: e, visibility: l, perElement: s, customAttrValues: n, cardBg: i } = o,
|
|
343
|
+
const { composition: e, visibility: l, perElement: s, customAttrValues: n, cardBg: i } = o, a = i ? `background-color: ${c(i)}` : "", r = a ? `style="table-layout: fixed; ${a}"` : 'style="table-layout: fixed"', d = s[I] ?? {}, p = l[I] !== !1, u = d.width ? ` width="${d.width}"` : "", m = p ? "" : ' style="display: none"', h = `
|
|
344
344
|
<td width="120"
|
|
345
345
|
class="esd-block-image product-image-cell recommendation-attribute-row es-p5"
|
|
346
346
|
esd-extension-block-id="${g.IMAGE}"
|
|
347
|
-
data-attribute-type="${
|
|
347
|
+
data-attribute-type="${I}"
|
|
348
348
|
data-visibility="${p ? "1" : "0"}"
|
|
349
349
|
align="center" valign="middle"${m}>
|
|
350
350
|
<a target="_blank" href="https://example.com/product/${t + 1}">
|
|
@@ -357,7 +357,7 @@ function ut(t, o) {
|
|
|
357
357
|
<td class="product-info-cell" valign="middle" style="padding: 15px">
|
|
358
358
|
<table cellpadding="0" cellspacing="0" role="presentation" width="100%"
|
|
359
359
|
style="table-layout: fixed">
|
|
360
|
-
<tbody>${e.filter((P) => P !==
|
|
360
|
+
<tbody>${e.filter((P) => P !== I && P !== k).map((P) => {
|
|
361
361
|
const B = l[P] !== !1, W = B ? "" : ' style="display: none"', tt = B ? "1" : "0", M = pt(P, s, n, o);
|
|
362
362
|
return M ? `<tr class="recommendation-attribute-row"
|
|
363
363
|
data-attribute-type="${c(P)}"
|
|
@@ -366,16 +366,16 @@ function ut(t, o) {
|
|
|
366
366
|
`)}</tbody>
|
|
367
367
|
</table>
|
|
368
368
|
</td>
|
|
369
|
-
`, f = s[
|
|
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
370
|
<td width="100"
|
|
371
371
|
class="esd-block-button button-cell recommendation-attribute-row product-button es-p5l es-p5r"
|
|
372
372
|
esd-extension-block-id="${g.BUTTON}"
|
|
373
|
-
data-attribute-type="${
|
|
373
|
+
data-attribute-type="${k}"
|
|
374
374
|
data-visibility="${C ? "1" : "0"}"
|
|
375
375
|
align="${c(f.align ?? "center")}" valign="middle"${Q}>
|
|
376
376
|
<span class="es-button-border" style="${c(x)}">
|
|
377
377
|
<a href="https://example.com/product/${t + 1}" target="_blank"
|
|
378
|
-
class="es-button
|
|
378
|
+
class="es-button buy-button"
|
|
379
379
|
style="${c(A)}">${c(S)}</a>
|
|
380
380
|
</span>
|
|
381
381
|
</td>
|
|
@@ -384,7 +384,7 @@ function ut(t, o) {
|
|
|
384
384
|
<tr class="recommendation-product-row">
|
|
385
385
|
<td style="padding: 0 5px">
|
|
386
386
|
<table width="100%" cellpadding="0" cellspacing="0" border="0"
|
|
387
|
-
class="product-card-wrapper" ${
|
|
387
|
+
class="product-card-wrapper" ${r}>
|
|
388
388
|
<tbody>
|
|
389
389
|
<tr>${h}${w}${Z}</tr>
|
|
390
390
|
</tbody>
|
|
@@ -400,13 +400,13 @@ function bt(t, o) {
|
|
|
400
400
|
return e.join("");
|
|
401
401
|
}
|
|
402
402
|
function gt(t, o) {
|
|
403
|
-
var
|
|
403
|
+
var r, d, p, u, m, h;
|
|
404
404
|
const e = t == null ? void 0 : t.theme, l = [];
|
|
405
|
-
(
|
|
406
|
-
const s = l.join("; "), n = ((h = e == null ? void 0 : e.textStyle) == null ? void 0 : h["font-weight"]) !== "normal", i = c(o),
|
|
405
|
+
(r = e == null ? void 0 : e.textStyle) != null && r["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), a = n ? `<strong>${i}</strong>` : i;
|
|
407
407
|
return `
|
|
408
408
|
<td class="esd-block-text es-p10t es-p10b es-p20l es-p20r" align="center">
|
|
409
|
-
<p${b(s)}>${
|
|
409
|
+
<p${b(s)}>${a}</p>
|
|
410
410
|
</td>
|
|
411
411
|
`;
|
|
412
412
|
}
|
|
@@ -422,15 +422,15 @@ function xt(t) {
|
|
|
422
422
|
titleText: s,
|
|
423
423
|
extraClasses: n = "",
|
|
424
424
|
legacyId: i,
|
|
425
|
-
legacyBgColor:
|
|
426
|
-
} = t,
|
|
425
|
+
legacyBgColor: a
|
|
426
|
+
} = t, r = parseInt(o.size) || 6, d = o.layout === "list" ? ' data-layout="list"' : "", p = o.layout === "list" ? " es-m-p0 ins-recommendation-list-layout" : "", u = {
|
|
427
427
|
composition: e.composition,
|
|
428
428
|
visibility: e.visibility,
|
|
429
429
|
perElement: e.perElementStyles,
|
|
430
430
|
customAttrValues: e.customAttrValues,
|
|
431
431
|
cardBg: l,
|
|
432
|
-
...
|
|
433
|
-
}, m = o.layout === "list" ? bt(
|
|
432
|
+
...at(o.currency)
|
|
433
|
+
}, m = o.layout === "list" ? bt(r, u) : dt(r, o.cardsInRow, u), h = gt(e.titleVariable, s), T = e.composition.join(","), w = JSON.stringify(e.customAttributes), f = [
|
|
434
434
|
"recommendation-block-v2",
|
|
435
435
|
"esd-block-recommendation-v3-block",
|
|
436
436
|
`es-p20${p}`,
|
|
@@ -443,7 +443,7 @@ function xt(t) {
|
|
|
443
443
|
"esd-container-frame",
|
|
444
444
|
"ins-recommendation-no-mobile-layout",
|
|
445
445
|
n
|
|
446
|
-
].filter(Boolean).join(" "), C = mt(o.currency), S = ` esd-ext-config="${c(JSON.stringify(o))}"`, x = i ? ` id="${c(i)}"` : "", A =
|
|
446
|
+
].filter(Boolean).join(" "), C = mt(o.currency), S = ` esd-ext-config="${c(JSON.stringify(o))}"`, x = i ? ` id="${c(i)}"` : "", A = a ? ` bgcolor="${c(a)}"` : "";
|
|
447
447
|
return ot(`
|
|
448
448
|
<td align="left"
|
|
449
449
|
esd-extension-block-id="recommendation-block"
|
|
@@ -15,7 +15,7 @@ function p() {
|
|
|
15
15
|
thousandSeparator: e.thousandSeparator
|
|
16
16
|
};
|
|
17
17
|
}
|
|
18
|
-
function
|
|
18
|
+
function i(t, e = "price") {
|
|
19
19
|
const o = p(), n = t[e], d = (n == null ? void 0 : n[o.code]) ?? Object.values(n ?? {})[0] ?? 0;
|
|
20
20
|
return $({
|
|
21
21
|
price: d,
|
|
@@ -92,7 +92,7 @@ const I = {
|
|
|
92
92
|
align="center"
|
|
93
93
|
esd-extension-block-id="${s.PRICE}">
|
|
94
94
|
<p contenteditable="false" style="font-size: 16px; color: #333333;">
|
|
95
|
-
<strong>${
|
|
95
|
+
<strong>${i(t, "price")}</strong>
|
|
96
96
|
</p>
|
|
97
97
|
</td>
|
|
98
98
|
</tr>
|
|
@@ -116,7 +116,7 @@ const I = {
|
|
|
116
116
|
align="center"
|
|
117
117
|
esd-extension-block-id="${s.OLD_PRICE}">
|
|
118
118
|
<p contenteditable="false" style="font-size: 14px; color: #999999;">
|
|
119
|
-
<strong>${
|
|
119
|
+
<strong>${i(t, "original_price")}</strong>
|
|
120
120
|
</p>
|
|
121
121
|
</td>
|
|
122
122
|
</tr>
|
|
@@ -143,7 +143,7 @@ const I = {
|
|
|
143
143
|
esd-extension-block-id="${s.OMNIBUS_PRICE}">
|
|
144
144
|
<p contenteditable="false" style="font-size: 12px; color: #666666;">
|
|
145
145
|
<span class="omnibus-text-before">Lowest 30-day price: </span>
|
|
146
|
-
<span class="omnibus-price-value">${
|
|
146
|
+
<span class="omnibus-price-value">${i(t, "original_price")}</span>
|
|
147
147
|
<span class="omnibus-text-after"></span>
|
|
148
148
|
</p>
|
|
149
149
|
</td>
|
|
@@ -153,8 +153,8 @@ const I = {
|
|
|
153
153
|
</td>
|
|
154
154
|
`,
|
|
155
155
|
[m]: (t) => {
|
|
156
|
-
var
|
|
157
|
-
const e = p(), o = ((
|
|
156
|
+
var r, c;
|
|
157
|
+
const e = p(), o = ((r = t.original_price) == null ? void 0 : r[e.code]) ?? Object.values(t.original_price ?? {})[0] ?? 0, n = ((c = t.price) == null ? void 0 : c[e.code]) ?? Object.values(t.price ?? {})[0] ?? 0, d = o > 0 ? Math.round((o - n) / o * 100) : 0, g = d > 0 ? `-${d}%` : "0%";
|
|
158
158
|
return `
|
|
159
159
|
<td class="${l}" style="padding: ${a}; height: 100%;" valign="top">
|
|
160
160
|
<table
|
|
@@ -208,7 +208,7 @@ const I = {
|
|
|
208
208
|
">
|
|
209
209
|
<a
|
|
210
210
|
href="#"
|
|
211
|
-
class="es-button
|
|
211
|
+
class="es-button buy-button"
|
|
212
212
|
target="_blank"
|
|
213
213
|
style="
|
|
214
214
|
color: rgb(56, 118, 29);
|
|
@@ -2,7 +2,7 @@ import { RecommendationBlockId as o } from "../../constants/blockIds.js";
|
|
|
2
2
|
import { ATTR_PRODUCT_ATTR as m, ATTR_PRODUCT_BUTTON as c, ATTR_PRODUCT_IMAGE as d, ATTR_PRODUCT_OMNIBUS_DISCOUNT as u, ATTR_PRODUCT_OMNIBUS_PRICE as g, ATTR_PRODUCT_OLD_PRICE as f, ATTR_PRODUCT_PRICE as T, ATTR_PRODUCT_NAME as x } from "../../constants/selectors.js";
|
|
3
3
|
import { useRecommendationExtensionStore as _ } from "../../store/recommendation.js";
|
|
4
4
|
import { formatPrice as R } from "../../utils/priceFormatter.js";
|
|
5
|
-
import { CUSTOM_CELL_HTML as
|
|
5
|
+
import { CUSTOM_CELL_HTML as y, sanitizeImageUrl as C } from "../utils.js";
|
|
6
6
|
function p() {
|
|
7
7
|
const t = _(), { currencySettings: e } = t.recommendationConfigs;
|
|
8
8
|
return {
|
|
@@ -15,9 +15,9 @@ function p() {
|
|
|
15
15
|
};
|
|
16
16
|
}
|
|
17
17
|
function s(t, e = "price") {
|
|
18
|
-
const n = p(),
|
|
18
|
+
const n = p(), a = t[e], r = (a == null ? void 0 : a[n.code]) ?? Object.values(a ?? {})[0] ?? 0;
|
|
19
19
|
return R({
|
|
20
|
-
price:
|
|
20
|
+
price: r,
|
|
21
21
|
currency: n
|
|
22
22
|
});
|
|
23
23
|
}
|
|
@@ -37,7 +37,7 @@ const U = {
|
|
|
37
37
|
valign="middle">
|
|
38
38
|
<a target="_blank" href="${t.url}">
|
|
39
39
|
<img
|
|
40
|
-
src="${
|
|
40
|
+
src="${C(t.image_url)}"
|
|
41
41
|
alt="${t.name}"
|
|
42
42
|
style="display: block; max-width: 100%; height: auto;"
|
|
43
43
|
class="adapt-img product-image">
|
|
@@ -115,7 +115,7 @@ const U = {
|
|
|
115
115
|
*/
|
|
116
116
|
[u]: (t) => {
|
|
117
117
|
var i, l;
|
|
118
|
-
const e = p(), n = ((i = t.original_price) == null ? void 0 : i[e.code]) ?? Object.values(t.original_price ?? {})[0] ?? 0,
|
|
118
|
+
const e = p(), n = ((i = t.original_price) == null ? void 0 : i[e.code]) ?? Object.values(t.original_price ?? {})[0] ?? 0, a = ((l = t.price) == null ? void 0 : l[e.code]) ?? Object.values(t.price ?? {})[0] ?? 0, r = n > 0 ? Math.round((n - a) / n * 100) : 0, b = r > 0 ? `-${r}%` : "0%";
|
|
119
119
|
return `
|
|
120
120
|
<tr>
|
|
121
121
|
<td
|
|
@@ -156,7 +156,7 @@ const U = {
|
|
|
156
156
|
<a
|
|
157
157
|
href="${t.url}"
|
|
158
158
|
target="_blank"
|
|
159
|
-
class="es-button
|
|
159
|
+
class="es-button buy-button"
|
|
160
160
|
style="
|
|
161
161
|
color: rgb(56, 118, 29);
|
|
162
162
|
background: rgb(217, 234, 211);
|
|
@@ -179,7 +179,7 @@ const U = {
|
|
|
179
179
|
* @param productAttrValue - Resolved product-attr value (e.g., "brand" for default, "product_attribute.rating_star" for custom)
|
|
180
180
|
* @param content - Display content for the cell
|
|
181
181
|
*/
|
|
182
|
-
[
|
|
182
|
+
[y]: (t, e) => `
|
|
183
183
|
<tr>
|
|
184
184
|
<td
|
|
185
185
|
${m}="${t}"
|
|
@@ -14,7 +14,7 @@ function y(t) {
|
|
|
14
14
|
return "";
|
|
15
15
|
const o = t.sort((r, e) => r.filterNumber - e.filterNumber), u = o.map((r) => {
|
|
16
16
|
const e = r.operator === l, a = e ? "=" : r.operator, c = e ? f(r.value).join(l) : r.value;
|
|
17
|
-
return `[${r.attribute}][${
|
|
17
|
+
return `[${r.attribute}][${a}][${c}]`;
|
|
18
18
|
}), [i, ...p] = u;
|
|
19
19
|
let n = i;
|
|
20
20
|
for (let r = 0; r < p.length; r++) {
|
|
@@ -23,7 +23,7 @@ function y(t) {
|
|
|
23
23
|
}
|
|
24
24
|
return `(${n})`;
|
|
25
25
|
}
|
|
26
|
-
function
|
|
26
|
+
function Q(t) {
|
|
27
27
|
if (!t || t.length === 0)
|
|
28
28
|
return "";
|
|
29
29
|
const o = t.reduce((r, e) => (r[e.filterGroup] || (r[e.filterGroup] = []), r[e.filterGroup].push(e), r), {}), u = Object.keys(o).map(Number).sort((r, e) => r - e), i = u.map((r) => {
|
|
@@ -38,7 +38,7 @@ function g(t) {
|
|
|
38
38
|
return s.trim();
|
|
39
39
|
}
|
|
40
40
|
export {
|
|
41
|
-
|
|
41
|
+
Q as generateCompleteFilterQuery,
|
|
42
42
|
f as parseTagList,
|
|
43
43
|
m as safeDecodeURIComponent
|
|
44
44
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@useinsider/guido",
|
|
3
|
-
"version": "3.4.0-beta.
|
|
3
|
+
"version": "3.4.0-beta.14fc097",
|
|
4
4
|
"description": "Guido is a Vue + TypeScript wrapper for Email Plugin. Easily embed the email editor in your Vue applications.",
|
|
5
5
|
"main": "./dist/guido.umd.cjs",
|
|
6
6
|
"module": "./dist/library.js",
|