@useinsider/guido 3.1.1-beta.6165f1e → 3.1.1-beta.6b60896
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 +19 -15
- package/dist/composables/useHtmlValidator.js +40 -38
- package/dist/config/compiler/unsubscribeCompilerRules.js +37 -37
- package/dist/config/compiler/utils/recommendationCompilerUtils.js +55 -53
- package/dist/enums/recommendation.js +2 -2
- package/dist/extensions/Blocks/Recommendation/block.js +1 -1
- package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +1 -1
- package/dist/extensions/Blocks/Recommendation/controls/spacing/index.js +79 -81
- package/dist/extensions/Blocks/Recommendation/utils/tagName.js +6 -6
- package/dist/extensions/Blocks/Unsubscribe/settingsPanel.js +17 -16
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js +218 -324
- package/dist/package.json.js +1 -1
- package/dist/src/@types/config/schemas.d.ts +8 -0
- package/dist/src/composables/useConfig.d.ts +4 -0
- package/dist/src/config/compiler/utils/recommendationCompilerUtils.d.ts +1 -1
- package/dist/src/extensions/Blocks/Recommendation/utils/tagName.d.ts +3 -3
- package/dist/src/stores/config.d.ts +36 -0
- package/dist/static/styles/components/button.css.js +7 -13
- package/dist/static/styles/components/narrow-panel.css.js +0 -52
- package/dist/utils/templatePreparation.js +16 -14
- package/package.json +3 -3
|
@@ -61,7 +61,7 @@ const m = {
|
|
|
61
61
|
value: t()
|
|
62
62
|
})
|
|
63
63
|
)
|
|
64
|
-
}),
|
|
64
|
+
}), A = o({
|
|
65
65
|
/** Initial HTML content */
|
|
66
66
|
html: e(t(), ""),
|
|
67
67
|
/** Initial CSS content */
|
|
@@ -71,11 +71,13 @@ const m = {
|
|
|
71
71
|
c(f),
|
|
72
72
|
[]
|
|
73
73
|
),
|
|
74
|
+
/** Valid custom field attribute names from the partner's categorized fields */
|
|
75
|
+
customFieldAttributes: e(c(t()), []),
|
|
74
76
|
/** Selected unsubscribe page IDs */
|
|
75
77
|
selectedUnsubscribePages: e(c(p()), []),
|
|
76
78
|
/** Force recreate template in Stripo storage (use true when updating externally modified templates) */
|
|
77
79
|
forceRecreate: e(a(), !1)
|
|
78
|
-
}),
|
|
80
|
+
}), R = o({
|
|
79
81
|
/** Sender display name */
|
|
80
82
|
senderName: e(t(), ""),
|
|
81
83
|
/** Email subject line */
|
|
@@ -88,7 +90,7 @@ const m = {
|
|
|
88
90
|
/** Migration date for template compatibility */
|
|
89
91
|
migrationDate: e(p(), 1759696858),
|
|
90
92
|
/** Email header settings */
|
|
91
|
-
emailHeader: e(
|
|
93
|
+
emailHeader: e(R, { senderName: "", subject: "" }),
|
|
92
94
|
/** Folder name for user-saved modules (used by Stripo plugin panel for path construction) */
|
|
93
95
|
savedModulesFolderName: e(t(), b.SAVED_MODULES),
|
|
94
96
|
/** Folder name for default/prebuilt modules (used by Stripo plugin panel for path construction) */
|
|
@@ -112,7 +114,9 @@ const m = {
|
|
|
112
114
|
/** Enable unsubscribe block */
|
|
113
115
|
unsubscribe: e(a(), !0),
|
|
114
116
|
/** Disable modules panel in the editor */
|
|
115
|
-
modulesDisabled: e(a(), !1)
|
|
117
|
+
modulesDisabled: e(a(), !1),
|
|
118
|
+
/** Enable Liquid template syntax */
|
|
119
|
+
liquidSyntax: e(a(), !1)
|
|
116
120
|
}), E = n([
|
|
117
121
|
"amp-accordion",
|
|
118
122
|
"amp-carousel",
|
|
@@ -189,12 +193,12 @@ const m = {
|
|
|
189
193
|
M,
|
|
190
194
|
N,
|
|
191
195
|
D
|
|
192
|
-
]),
|
|
196
|
+
]), x = o({
|
|
193
197
|
/** Custom compiler rules to apply */
|
|
194
198
|
customRules: e(c(v), []),
|
|
195
199
|
/** Skip default compiler rules */
|
|
196
200
|
ignoreDefaultRules: e(a(), !1)
|
|
197
|
-
}),
|
|
201
|
+
}), U = o({
|
|
198
202
|
/**
|
|
199
203
|
* External validation handler called before save completes.
|
|
200
204
|
* Return false to cancel the save operation.
|
|
@@ -205,7 +209,7 @@ const m = {
|
|
|
205
209
|
"externalValidation must be a function"
|
|
206
210
|
)
|
|
207
211
|
)
|
|
208
|
-
}),
|
|
212
|
+
}), F = o({
|
|
209
213
|
// Required sections
|
|
210
214
|
/** Identity configuration (required) */
|
|
211
215
|
identity: h,
|
|
@@ -213,7 +217,7 @@ const m = {
|
|
|
213
217
|
partner: y,
|
|
214
218
|
// Optional sections (with defaults)
|
|
215
219
|
/** Template content and presets */
|
|
216
|
-
template: e(
|
|
220
|
+
template: e(A, {}),
|
|
217
221
|
/** Editor settings */
|
|
218
222
|
editor: e(C, {}),
|
|
219
223
|
/** UI configuration */
|
|
@@ -223,23 +227,23 @@ const m = {
|
|
|
223
227
|
/** Block configuration */
|
|
224
228
|
blocks: e(O, {}),
|
|
225
229
|
/** Compiler configuration */
|
|
226
|
-
compiler: e(
|
|
230
|
+
compiler: e(x, {}),
|
|
227
231
|
/** Callbacks and event handlers */
|
|
228
|
-
callbacks: e(
|
|
232
|
+
callbacks: e(U, {})
|
|
229
233
|
});
|
|
230
234
|
export {
|
|
231
235
|
O as BlocksSchema,
|
|
232
|
-
|
|
236
|
+
U as CallbacksSchema,
|
|
233
237
|
v as CompilerRuleSchema,
|
|
234
|
-
|
|
238
|
+
x as CompilerSchema,
|
|
235
239
|
g as CustomBlockTypeSchema,
|
|
236
240
|
D as CustomRuleSchema,
|
|
237
241
|
E as DefaultBlockTypeSchema,
|
|
238
242
|
f as DynamicContentSchema,
|
|
239
243
|
C as EditorSchema,
|
|
240
|
-
|
|
244
|
+
R as EmailHeaderSchema,
|
|
241
245
|
I as FeaturesSchema,
|
|
242
|
-
|
|
246
|
+
F as GuidoConfigSchema,
|
|
243
247
|
h as IdentitySchema,
|
|
244
248
|
m as MessageType,
|
|
245
249
|
y as PartnerSchema,
|
|
@@ -247,6 +251,6 @@ export {
|
|
|
247
251
|
M as RegexRuleSchema,
|
|
248
252
|
N as RemoveRuleSchema,
|
|
249
253
|
L as ReplaceRuleSchema,
|
|
250
|
-
|
|
254
|
+
A as TemplateSchema,
|
|
251
255
|
T as UISchema
|
|
252
256
|
};
|
|
@@ -9,76 +9,76 @@ import { useHttp as j } from "./useHttp.js";
|
|
|
9
9
|
import { useToaster as q } from "./useToaster.js";
|
|
10
10
|
import { useTranslations as z } from "./useTranslations.js";
|
|
11
11
|
const K = /recommendation-id="(\d+)"/g;
|
|
12
|
-
function U(
|
|
13
|
-
return [...
|
|
12
|
+
function U(a) {
|
|
13
|
+
return [...a.matchAll(K)].map((u) => u[1]);
|
|
14
14
|
}
|
|
15
|
-
function Y(
|
|
16
|
-
return u.some((d) =>
|
|
15
|
+
function Y(a, u) {
|
|
16
|
+
return u.some((d) => a.startsWith(`${d}_`));
|
|
17
17
|
}
|
|
18
18
|
const ce = () => {
|
|
19
19
|
var y, h;
|
|
20
|
-
const { showToaster:
|
|
20
|
+
const { showToaster: a } = q(), { post: u } = j(), { config: d } = L(), r = z(), g = $(), p = ((h = (y = d.value) == null ? void 0 : y.partner) == null ? void 0 : h.messageType) === V.transactional, b = async (e) => {
|
|
21
21
|
const t = await u(
|
|
22
22
|
"/newsletter/template-library/check-template-html-body",
|
|
23
23
|
{ html: X(e) }
|
|
24
24
|
), { status: n, message: l } = t.data;
|
|
25
|
-
return n ||
|
|
25
|
+
return n || a({
|
|
26
26
|
type: c.Alert,
|
|
27
27
|
message: n === void 0 ? l : r("newsletter.invalid-url-link-for-toaster")
|
|
28
|
-
}), r(P), l === r(G) &&
|
|
28
|
+
}), r(P), l === r(G) && a({
|
|
29
29
|
type: c.Alert,
|
|
30
30
|
message: r("newsletter.already-in-progress")
|
|
31
31
|
}), n;
|
|
32
|
-
},
|
|
32
|
+
}, w = (e) => !["if", "endif", "else", "elif", "now"].includes(e.toLowerCase()), S = (e) => ["if", "endif"].includes(e.toLowerCase()), E = (e, s) => {
|
|
33
33
|
const t = e.match(/({%(.*?)%})/g);
|
|
34
34
|
let n = !0;
|
|
35
35
|
return t !== null && !p && t.forEach((l) => {
|
|
36
36
|
const o = l.slice(2, -2).trim().match(/(".*?"|[^"\s]+)(?=\s*|\s*$)/g);
|
|
37
37
|
if (o && o.length > 0) {
|
|
38
|
-
const [
|
|
39
|
-
|
|
38
|
+
const [i] = o;
|
|
39
|
+
w(i) && !s.includes(i) && (a({
|
|
40
40
|
type: c.Warning,
|
|
41
41
|
message: r("custom-fields.invalid-custom-fields")
|
|
42
42
|
}), n = !1);
|
|
43
43
|
}
|
|
44
44
|
}), n;
|
|
45
45
|
}, A = async (e, s, t) => {
|
|
46
|
-
const n = t ? await
|
|
46
|
+
const n = t ? await b(e) : !0;
|
|
47
47
|
return E(e, s) && n;
|
|
48
|
-
}, I = (e) => e.length > 0 ? !0 : (
|
|
48
|
+
}, I = (e) => e.length > 0 ? !0 : (a({
|
|
49
49
|
type: c.Warning,
|
|
50
50
|
message: r("newsletter.html-content-is-empty")
|
|
51
51
|
}), !1), k = (e) => {
|
|
52
52
|
const s = (e.match(/{/gm) || []).length, t = (e.match(/}/gm) || []).length;
|
|
53
|
-
return s > t &&
|
|
53
|
+
return s > t && a({
|
|
54
54
|
type: c.Warning,
|
|
55
55
|
message: r("custom-fields.missing-closing-braces")
|
|
56
|
-
}), s < t &&
|
|
56
|
+
}), s < t && a({
|
|
57
57
|
type: c.Warning,
|
|
58
58
|
message: r("custom-fields.missing-opening-braces")
|
|
59
59
|
}), s === t;
|
|
60
60
|
}, x = (e) => {
|
|
61
61
|
const s = e.match(/{{\s*(\w+\s+((\w+\|\w+)|(\w+)))\s*}}/gm) === null;
|
|
62
|
-
return s ||
|
|
62
|
+
return s || a({
|
|
63
63
|
type: c.Warning,
|
|
64
64
|
message: r("custom-fields.invalid-custom-fields")
|
|
65
65
|
}), s;
|
|
66
66
|
}, T = (e, s) => {
|
|
67
67
|
const t = e.match(/{{([a-zA-Z0-9_\s]*)}}/gm);
|
|
68
68
|
if (t && !p) {
|
|
69
|
-
const n = new Set(s.map((
|
|
70
|
-
if (t.forEach((
|
|
71
|
-
const m =
|
|
69
|
+
const n = new Set(s.map((i) => i.toLowerCase())), l = U(e), o = [];
|
|
70
|
+
if (t.forEach((i) => {
|
|
71
|
+
const m = i.slice(2, -2).trim().toLowerCase();
|
|
72
72
|
(!n.has(m) || m === "") && !Y(m, l) && o.push(m);
|
|
73
73
|
}), o.length > 0) {
|
|
74
|
-
const
|
|
74
|
+
const i = `
|
|
75
75
|
<ul>
|
|
76
76
|
${o.map((m) => `<li>${m}</li>`).join("")}
|
|
77
77
|
</ul>
|
|
78
78
|
`;
|
|
79
|
-
return
|
|
79
|
+
return a({
|
|
80
80
|
type: c.Alert,
|
|
81
|
-
message: r("custom-fields.invalid-custom-fields") +
|
|
81
|
+
message: r("custom-fields.invalid-custom-fields") + i
|
|
82
82
|
}), !1;
|
|
83
83
|
}
|
|
84
84
|
}
|
|
@@ -87,12 +87,12 @@ const ce = () => {
|
|
|
87
87
|
const s = e.match(/{%(.*?)%}/g), t = [];
|
|
88
88
|
let n = !0;
|
|
89
89
|
if (s && s.forEach((l) => {
|
|
90
|
-
const o = l.match(_),
|
|
91
|
-
(!o || l !== m) && !
|
|
90
|
+
const o = l.match(_), i = l.match(H), m = (o == null ? void 0 : o.join("")) || "";
|
|
91
|
+
(!o || l !== m) && !i && (a({
|
|
92
92
|
type: c.Alert,
|
|
93
93
|
message: r("newsletter.display-conditions-invalid-syntax")
|
|
94
94
|
}), n = !1), o && o.forEach((f) => {
|
|
95
|
-
f.trim() === "=" && (
|
|
95
|
+
f.trim() === "=" && (a({
|
|
96
96
|
type: c.Alert,
|
|
97
97
|
message: r("custom-conditions.wrong-equality-operators")
|
|
98
98
|
}), n = !1);
|
|
@@ -102,8 +102,8 @@ const ce = () => {
|
|
|
102
102
|
});
|
|
103
103
|
});
|
|
104
104
|
}), t.length) {
|
|
105
|
-
const l = t.filter((
|
|
106
|
-
l.length !== o.length && (
|
|
105
|
+
const l = t.filter((i) => i === "if"), o = t.filter((i) => i === "endif");
|
|
106
|
+
l.length !== o.length && (a({
|
|
107
107
|
type: c.Alert,
|
|
108
108
|
message: r("custom-conditions.missing-if-endif-tag")
|
|
109
109
|
}), n = !1);
|
|
@@ -111,45 +111,47 @@ const ce = () => {
|
|
|
111
111
|
return n;
|
|
112
112
|
}, W = (e) => {
|
|
113
113
|
const s = (e.match(/{% /gm) || []).length, t = (e.match(/ %}/gm) || []).length, n = s === t;
|
|
114
|
-
return n ||
|
|
114
|
+
return n || a({
|
|
115
115
|
type: c.Warning,
|
|
116
116
|
message: r("custom-conditions.no-space-after-braces")
|
|
117
117
|
}), n;
|
|
118
|
-
}, N = (e) => (e.match(/({%(.*?)%})/g) || []).filter((t) => t.includes("if")).map((t) => (t.match(/{{.*}}/gm) || []).length).reduce((t, n) => t + n, 0) > 0 ? (
|
|
118
|
+
}, N = (e) => (e.match(/({%(.*?)%})/g) || []).filter((t) => t.includes("if")).map((t) => (t.match(/{{.*}}/gm) || []).length).reduce((t, n) => t + n, 0) > 0 ? (a({
|
|
119
119
|
type: c.Warning,
|
|
120
120
|
message: r("custom-conditions.no-braces-inside-if-tag")
|
|
121
|
-
}), !1) : !0, O = () => g.recommendationConfigs && Object.values(g.recommendationConfigs).find((s) => s.filters.find((t) => t.value === "")) !== void 0 ? (
|
|
121
|
+
}), !1) : !0, O = () => g.recommendationConfigs && Object.values(g.recommendationConfigs).find((s) => s.filters.find((t) => t.value === "")) !== void 0 ? (a({
|
|
122
122
|
type: c.Alert,
|
|
123
123
|
message: r("newsletter.fill-all-necessary-fields")
|
|
124
124
|
}), !1) : !0, B = (e) => {
|
|
125
125
|
const s = /src="[^"]*\.(svg|pst)"/gm;
|
|
126
|
-
return e.match(s) === null ? !0 : (
|
|
126
|
+
return e.match(s) === null ? !0 : (a({
|
|
127
127
|
type: c.Alert,
|
|
128
128
|
message: r("newsletter.invalid-image-type")
|
|
129
129
|
}), !1);
|
|
130
130
|
}, R = (e) => {
|
|
131
131
|
const n = new DOMParser().parseFromString(e, "text/html").querySelectorAll(".checkbox-block-v2");
|
|
132
132
|
return Array.from(n).find((o) => {
|
|
133
|
-
var
|
|
134
|
-
return !((
|
|
135
|
-
}) ? (
|
|
133
|
+
var i;
|
|
134
|
+
return !((i = o.id) != null && i.trim());
|
|
135
|
+
}) ? (a({
|
|
136
136
|
type: c.Alert,
|
|
137
137
|
message: r("unsubscribe-templates.select-checkbox-groups")
|
|
138
138
|
}), !1) : !0;
|
|
139
139
|
}, D = (e) => {
|
|
140
140
|
const n = new DOMParser().parseFromString(e, "text/html").querySelectorAll(".radio-button-v2");
|
|
141
141
|
return Array.from(n).find((o) => {
|
|
142
|
-
var
|
|
143
|
-
return !((
|
|
144
|
-
}) ? (
|
|
142
|
+
var i;
|
|
143
|
+
return !((i = o.id) != null && i.trim());
|
|
144
|
+
}) ? (a({
|
|
145
145
|
type: c.Alert,
|
|
146
146
|
message: r("unsubscribe-templates.select-radio-button-groups")
|
|
147
147
|
}), !1) : !0;
|
|
148
148
|
};
|
|
149
149
|
return { validateHtml: async (e, s, t = !1) => {
|
|
150
|
+
var o, i;
|
|
150
151
|
const n = [
|
|
151
|
-
...s.map((
|
|
152
|
-
...M
|
|
152
|
+
...s.map((m) => m.value),
|
|
153
|
+
...M,
|
|
154
|
+
...((i = (o = d.value) == null ? void 0 : o.template) == null ? void 0 : i.customFieldAttributes) ?? []
|
|
153
155
|
];
|
|
154
156
|
return await A(e, n, t) && I(e) && k(e) && x(e) && T(e, n) && F(e) && W(e) && N(e) && O() && B(e) && R(e) && D(e);
|
|
155
157
|
} };
|
|
@@ -1,41 +1,41 @@
|
|
|
1
|
-
import { usePartner as
|
|
2
|
-
import { LINK_REGEXES as
|
|
3
|
-
import { parsePageList as
|
|
4
|
-
import { useConfigStore as
|
|
5
|
-
import { useDynamicContentStore as
|
|
6
|
-
import { useUnsubscribeStore as
|
|
7
|
-
const
|
|
1
|
+
import { usePartner as y } from "../../composables/usePartner.js";
|
|
2
|
+
import { LINK_REGEXES as p, LINK_TYPES as S, INSIDER_ID as m, URLS as R } from "../../enums/unsubscribe.js";
|
|
3
|
+
import { parsePageList as I } from "../../extensions/Blocks/Unsubscribe/utils/utils.js";
|
|
4
|
+
import { useConfigStore as N } from "../../stores/config.js";
|
|
5
|
+
import { useDynamicContentStore as U } from "../../stores/dynamic-content.js";
|
|
6
|
+
import { useUnsubscribeStore as C } from "../../stores/unsubscribe.js";
|
|
7
|
+
const G = [
|
|
8
8
|
{
|
|
9
9
|
id: "add-unsubscribe-link-values",
|
|
10
10
|
description: "Adding unsubscribe link values",
|
|
11
11
|
type: "custom",
|
|
12
12
|
processor: (t) => {
|
|
13
|
-
const { getPartnerName: i } =
|
|
13
|
+
const { getPartnerName: i } = y(), o = N(), s = U(), d = C(), a = o.variationId;
|
|
14
14
|
if (!a)
|
|
15
15
|
return t;
|
|
16
16
|
let e = t;
|
|
17
|
-
const r = `/${i()}/email/${a}?user={{iid}}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
17
|
+
const r = `/${i()}/email/${a}?user={{iid}}`, E = new DOMParser().parseFromString(e, "text/html").querySelectorAll(".unsubscribe-block-v2[data-unsubscribe-page-list]");
|
|
18
|
+
let c = !1, l = !1;
|
|
19
|
+
return E.forEach((f) => {
|
|
20
|
+
var b;
|
|
21
|
+
const u = f.getAttribute("data-unsubscribe-page-list");
|
|
22
|
+
if (!u)
|
|
22
23
|
return;
|
|
23
|
-
const
|
|
24
|
-
(
|
|
25
|
-
)) ?? []
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
}), e;
|
|
24
|
+
const _ = I(u), g = ((b = d.templates) == null ? void 0 : b.filter(
|
|
25
|
+
(n) => _.includes(n.id)
|
|
26
|
+
)) ?? [];
|
|
27
|
+
c = c || g.some((n) => n.type === S.UNSUBSCRIBE_LINK_TYPE), l = l || g.some((n) => n.type === S.PREFERENCES_LINK_TYPE);
|
|
28
|
+
}), (c || l) && (s.selectedDynamicContentList.some((u) => u.value === m) || s.selectedDynamicContentList.push({
|
|
29
|
+
text: m,
|
|
30
|
+
value: m,
|
|
31
|
+
fallback: ""
|
|
32
|
+
})), c && (e = e.replace(
|
|
33
|
+
p.GLOBAL_UNSUBSCRIBE_LINK_REGEX,
|
|
34
|
+
R.UNSUBSCRIBE_URL + r
|
|
35
|
+
)), l && (e = e.replace(
|
|
36
|
+
p.PREFERENCES_UNSUBSCRIBE_LINK_REGEX,
|
|
37
|
+
R.PREFERENCES_URL + r
|
|
38
|
+
)), E.length && (e = e.replace(p.UNSUBSCRIBE_LINK_REGEX, "")), e;
|
|
39
39
|
},
|
|
40
40
|
priority: 60
|
|
41
41
|
},
|
|
@@ -43,7 +43,7 @@ const D = [
|
|
|
43
43
|
id: "remove-data-ogsb-button-styles",
|
|
44
44
|
description: "Removing styles like [data-ogsb] .es-button.es-button-123 { background: red; }",
|
|
45
45
|
type: "regex",
|
|
46
|
-
pattern:
|
|
46
|
+
pattern: p.DATA_OGSB_BUTTON_CSS_REGEX,
|
|
47
47
|
replacement: "",
|
|
48
48
|
flags: "g",
|
|
49
49
|
priority: 61
|
|
@@ -61,16 +61,16 @@ const D = [
|
|
|
61
61
|
type: "custom",
|
|
62
62
|
processor: (t) => {
|
|
63
63
|
let i = t;
|
|
64
|
-
const
|
|
65
|
-
return
|
|
66
|
-
if (
|
|
64
|
+
const o = i.match(/<a[^>]+>(.*?)<\/a>/gm);
|
|
65
|
+
return o && o.forEach((s) => {
|
|
66
|
+
if (s.includes("insEmail=1"))
|
|
67
67
|
return;
|
|
68
|
-
if (
|
|
69
|
-
const a =
|
|
68
|
+
if (s.match(/<a\s+(?:[^>]*?\s+)?href=(["'`”])(.*?)\1\s+(?:[^>]*?\s+)?universal=(["'`”])true\3/gm)) {
|
|
69
|
+
const a = s.replace(/href=(["'`”])(.*?)\1/gm, (e) => {
|
|
70
70
|
const r = e.slice(6, e.length - 1).trim();
|
|
71
71
|
return e.includes("?") || e.includes("#") ? r.slice(-1) === "&" ? e.replace(r, `${r}insEmail=1`) : e.replace(r, `${r}&insEmail=1`) : e.replace(r, `${r}?insEmail=1`);
|
|
72
72
|
});
|
|
73
|
-
i = i.replace(
|
|
73
|
+
i = i.replace(s, a);
|
|
74
74
|
}
|
|
75
75
|
}), i;
|
|
76
76
|
},
|
|
@@ -78,5 +78,5 @@ const D = [
|
|
|
78
78
|
}
|
|
79
79
|
];
|
|
80
80
|
export {
|
|
81
|
-
|
|
81
|
+
G as unsubscribeCompilerRules
|
|
82
82
|
};
|
|
@@ -1,22 +1,23 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { useConfig as S } from "../../../composables/useConfig.js";
|
|
2
|
+
import { useRecommendation as _ } from "../../../composables/useRecommendation.js";
|
|
3
|
+
function y(e, n, r, o, s = "") {
|
|
4
|
+
const u = `{{${s}${e}_${n}_${r}}}`, t = `{{${s}${e}_${n}_currency}}`;
|
|
5
|
+
return o === "before" ? `${t} ${u}` : `${u} ${t}`;
|
|
5
6
|
}
|
|
6
|
-
function p(e,
|
|
7
|
-
switch (
|
|
7
|
+
function p(e, n, r, o, s, u) {
|
|
8
|
+
switch (n) {
|
|
8
9
|
case "productImage": {
|
|
9
10
|
const t = e.querySelector("img");
|
|
10
|
-
t && (t.setAttribute("src", `{{${r}_${o}_image_url}}`), t.setAttribute("alt", `{{${r}_${o}_name}}`));
|
|
11
|
+
t && (t.setAttribute("src", `{{${u}${r}_${o}_image_url}}`), t.setAttribute("alt", `{{${u}${r}_${o}_name}}`));
|
|
11
12
|
const c = e.querySelector("a");
|
|
12
|
-
c && c.setAttribute("href", `{{${r}_${o}_url}}`);
|
|
13
|
+
c && c.setAttribute("href", `{{${u}${r}_${o}_url}}`);
|
|
13
14
|
break;
|
|
14
15
|
}
|
|
15
16
|
case "productName": {
|
|
16
17
|
const t = e.querySelector("p");
|
|
17
18
|
if (t) {
|
|
18
19
|
const c = t.querySelector("strong") || t;
|
|
19
|
-
c.textContent = `{{${r}_${o}_name}}`;
|
|
20
|
+
c.textContent = `{{${u}${r}_${o}_name}}`;
|
|
20
21
|
}
|
|
21
22
|
break;
|
|
22
23
|
}
|
|
@@ -24,7 +25,7 @@ function p(e, u, r, o, n) {
|
|
|
24
25
|
const t = e.querySelector("p");
|
|
25
26
|
if (t) {
|
|
26
27
|
const c = t.querySelector("strong") || t;
|
|
27
|
-
c.textContent =
|
|
28
|
+
c.textContent = y(r, o, "price", s, u);
|
|
28
29
|
}
|
|
29
30
|
break;
|
|
30
31
|
}
|
|
@@ -32,24 +33,25 @@ function p(e, u, r, o, n) {
|
|
|
32
33
|
const t = e.querySelector("p");
|
|
33
34
|
if (t) {
|
|
34
35
|
const c = t.querySelector("strong") || t;
|
|
35
|
-
c.textContent =
|
|
36
|
+
c.textContent = y(
|
|
36
37
|
r,
|
|
37
38
|
o,
|
|
38
39
|
"original_price",
|
|
39
|
-
|
|
40
|
+
s,
|
|
41
|
+
u
|
|
40
42
|
), t.setAttribute("product-attr", "discount");
|
|
41
43
|
}
|
|
42
44
|
break;
|
|
43
45
|
}
|
|
44
46
|
case "productButton": {
|
|
45
47
|
const t = e.querySelector("a");
|
|
46
|
-
t && t.setAttribute("href", `{{${r}_${o}_url}}`);
|
|
48
|
+
t && t.setAttribute("href", `{{${u}${r}_${o}_url}}`);
|
|
47
49
|
break;
|
|
48
50
|
}
|
|
49
51
|
case "productOmnibusPrice": {
|
|
50
52
|
const t = e.querySelector(".omnibus-price-value");
|
|
51
53
|
if (t) {
|
|
52
|
-
t.textContent = `{{${r}_${o}_omnibus_price}}`;
|
|
54
|
+
t.textContent = `{{${u}${r}_${o}_omnibus_price}}`;
|
|
53
55
|
const c = t.closest("p");
|
|
54
56
|
c && (c.setAttribute("product-attr", "omnibus_price"), c.setAttribute("composition", "true"));
|
|
55
57
|
}
|
|
@@ -58,7 +60,7 @@ function p(e, u, r, o, n) {
|
|
|
58
60
|
case "productOmnibusDiscount": {
|
|
59
61
|
const t = e.querySelector(".omnibus-discount-value");
|
|
60
62
|
if (t) {
|
|
61
|
-
t.textContent = `{{${r}_${o}_omnibus_discount}}`;
|
|
63
|
+
t.textContent = `{{${u}${r}_${o}_omnibus_discount}}`;
|
|
62
64
|
const c = t.closest("p");
|
|
63
65
|
c && (c.setAttribute("product-attr", "omnibus_discount"), c.setAttribute("composition", "true"));
|
|
64
66
|
}
|
|
@@ -67,66 +69,66 @@ function p(e, u, r, o, n) {
|
|
|
67
69
|
default: {
|
|
68
70
|
const t = e.getAttribute("product-attr") ? e : e.querySelector("[product-attr]");
|
|
69
71
|
if (t) {
|
|
70
|
-
const c = t.getAttribute("product-attr"),
|
|
71
|
-
if (
|
|
72
|
-
const
|
|
73
|
-
|
|
72
|
+
const c = t.getAttribute("product-attr"), i = t.querySelector("p");
|
|
73
|
+
if (i) {
|
|
74
|
+
const a = i.querySelector("strong") || i;
|
|
75
|
+
a.textContent = `{{${u}${r}_${o}_${c}}}`;
|
|
74
76
|
}
|
|
75
77
|
}
|
|
76
78
|
break;
|
|
77
79
|
}
|
|
78
80
|
}
|
|
79
81
|
}
|
|
80
|
-
function
|
|
81
|
-
e.querySelectorAll(".recommendation-product-row").forEach((
|
|
82
|
-
|
|
83
|
-
const
|
|
84
|
-
|
|
85
|
-
p(
|
|
86
|
-
}) : p(
|
|
82
|
+
function q(e, n, r, o) {
|
|
83
|
+
e.querySelectorAll(".recommendation-product-row").forEach((u, t) => {
|
|
84
|
+
u.querySelectorAll("[data-attribute-type]").forEach((i) => {
|
|
85
|
+
const a = i.getAttribute("data-attribute-type") || "", b = i.querySelectorAll(".attribute-cell");
|
|
86
|
+
b.length > 0 ? b.forEach((l) => {
|
|
87
|
+
p(l, a, n, t, r, o);
|
|
88
|
+
}) : p(i, a, n, t, r, o);
|
|
87
89
|
});
|
|
88
90
|
});
|
|
89
91
|
}
|
|
90
|
-
function
|
|
91
|
-
const
|
|
92
|
-
if (!
|
|
92
|
+
function d(e, n, r, o) {
|
|
93
|
+
const s = e.querySelectorAll(".recommendation-product-row");
|
|
94
|
+
if (!s.length)
|
|
93
95
|
return;
|
|
94
|
-
const [
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
const
|
|
98
|
-
|
|
99
|
-
const m =
|
|
100
|
-
p(
|
|
96
|
+
const [u] = s, t = u.querySelector("[data-attribute-type]"), c = t ? t.querySelectorAll(".attribute-cell").length : 1;
|
|
97
|
+
s.forEach((i, a) => {
|
|
98
|
+
i.querySelectorAll("[data-attribute-type]").forEach((l) => {
|
|
99
|
+
const $ = l.getAttribute("data-attribute-type") || "";
|
|
100
|
+
l.querySelectorAll(".attribute-cell").forEach((A, f) => {
|
|
101
|
+
const m = a * c + f;
|
|
102
|
+
p(A, $, n, m, r, o);
|
|
101
103
|
});
|
|
102
104
|
});
|
|
103
105
|
});
|
|
104
106
|
}
|
|
105
|
-
function
|
|
106
|
-
e.querySelectorAll(".ins-recommendation-product-container").forEach((
|
|
107
|
-
|
|
107
|
+
function g(e, n, r, o) {
|
|
108
|
+
e.querySelectorAll(".ins-recommendation-product-container").forEach((u) => {
|
|
109
|
+
d(u, n, r, o);
|
|
108
110
|
});
|
|
109
111
|
}
|
|
110
|
-
function
|
|
111
|
-
const
|
|
112
|
-
|
|
112
|
+
function h(e, n, r) {
|
|
113
|
+
const o = e.getAttribute("data-layout") || "grid", s = e.getAttribute("currency-alignment") || "after";
|
|
114
|
+
o === "list" ? q(e, n, s, r) : g(e, n, s, r);
|
|
113
115
|
}
|
|
114
|
-
function
|
|
116
|
+
function C(e, n) {
|
|
115
117
|
const r = e.match(/<!DOCTYPE[^>]*>/i);
|
|
116
118
|
return (r ? `${r[0]}
|
|
117
|
-
` : "") +
|
|
119
|
+
` : "") + n.documentElement.outerHTML;
|
|
118
120
|
}
|
|
119
|
-
function
|
|
120
|
-
const
|
|
121
|
+
function P(e) {
|
|
122
|
+
const n = e.replaceAll("{%", "<!--{%").replaceAll("%}", "%}-->"), r = new DOMParser().parseFromString(n, "text/html"), o = r.querySelectorAll(".recommendation-block-v2");
|
|
121
123
|
if (!o.length)
|
|
122
124
|
return e;
|
|
123
|
-
const { buildCampaignUrl:
|
|
124
|
-
return o.forEach((
|
|
125
|
-
const
|
|
126
|
-
|
|
127
|
-
}),
|
|
125
|
+
const { buildCampaignUrl: s } = _(), { isFeatureEnabled: u } = S(), t = u("liquidSyntax") ? "reco_" : "";
|
|
126
|
+
return o.forEach((i) => {
|
|
127
|
+
const a = i.getAttribute("recommendation-id");
|
|
128
|
+
a && (s(a), h(i, a, t));
|
|
129
|
+
}), C(n, r).replaceAll("<!--{%", "{%").replaceAll("%}-->", "%}").replaceAll("<!--{%", "{%").replaceAll("%}-->", "%}");
|
|
128
130
|
}
|
|
129
131
|
export {
|
|
130
|
-
|
|
131
|
-
|
|
132
|
+
y as formatPriceVariable,
|
|
133
|
+
P as prepareRecommendationBlocks
|
|
132
134
|
};
|
|
@@ -28,8 +28,8 @@ const e = 20, s = 320, t = "vertical", m = {
|
|
|
28
28
|
ATTRIBUTE_PARAGRAPH: /<p[^>]*?product-attr="(discount|omnibus_discount|omnibus_price)"[^>]*>[\S\s]*?<\/p>/gm,
|
|
29
29
|
ATTRIBUTE_PARAGRAPH_START_TAG: /<p[^>]*?product-attr="(discount|omnibus_discount|omnibus_price)"[^>]*>/gm,
|
|
30
30
|
COMPOSITION: /composition="true"/gm,
|
|
31
|
-
CUSTOM_FIELD: /{{[0-9]+_[0-8]_(discount|omnibus_discount|omnibus_price)}}/gm,
|
|
32
|
-
CUSTOM_FIELD_INDEXES_PART: /{{[0-9]+_[0-8]_/gm,
|
|
31
|
+
CUSTOM_FIELD: /{{(?:reco_)?[0-9]+_[0-8]_(discount|omnibus_discount|omnibus_price)}}/gm,
|
|
32
|
+
CUSTOM_FIELD_INDEXES_PART: /{{(?:reco_)?[0-9]+_[0-8]_/gm,
|
|
33
33
|
CUSTOM_FIELD_NAME_PART: /_(discount|omnibus_discount|omnibus_price)}}/gm
|
|
34
34
|
}, n = {
|
|
35
35
|
PARAGRAPH_END_TAG: "</p>"
|
|
@@ -169,7 +169,7 @@ class q extends b {
|
|
|
169
169
|
if (e && e.includes(a))
|
|
170
170
|
return t;
|
|
171
171
|
}
|
|
172
|
-
return "querySelector" in t ? t.querySelector(`.${a}`)
|
|
172
|
+
return "querySelector" in t ? t.querySelector(`.${a}`) : null;
|
|
173
173
|
}
|
|
174
174
|
/**
|
|
175
175
|
* Migrate configuration from legacy format
|