@useinsider/guido 3.27.1-beta.842075e → 3.27.1-beta.ee576ab
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/useHtmlCompiler.js +16 -13
- package/dist/composables/useHtmlValidator.js +71 -71
- package/dist/composables/useRecommendation.js +16 -8
- package/dist/composables/useSaveValidation.js +80 -80
- package/dist/config/compiler/pongoCompilerRules.js +13 -0
- package/dist/config/compiler/recommendationCompilerRules.js +41 -29
- package/dist/enums/html-validator.js +8 -7
- package/dist/enums/recommendation.js +5 -4
- package/dist/package.json.js +4 -4
- package/dist/src/composables/useRecommendation.d.ts +4 -0
- package/dist/src/config/compiler/pongoCompilerRules.d.ts +2 -0
- package/dist/src/enums/html-validator.d.ts +1 -0
- package/dist/src/enums/recommendation.d.ts +1 -0
- package/package.json +1 -1
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
import { defaultHtmlCompilerRules as
|
|
2
|
-
import { itemsCompilerRules as
|
|
1
|
+
import { defaultHtmlCompilerRules as f } from "../config/compiler/htmlCompilerRules.js";
|
|
2
|
+
import { itemsCompilerRules as d } from "../config/compiler/itemsCompilerRules.js";
|
|
3
3
|
import { liquidCompilerRules as g } from "../config/compiler/liquidCompilerRules.js";
|
|
4
4
|
import { outlookCompilerRules as R } from "../config/compiler/outlookCompilerRules.js";
|
|
5
|
-
import {
|
|
5
|
+
import { pongoCompilerRules as v } from "../config/compiler/pongoCompilerRules.js";
|
|
6
|
+
import { recommendationCompilerRules as C } from "../config/compiler/recommendationCompilerRules.js";
|
|
6
7
|
import { socialCompilerRules as H } from "../config/compiler/socialCompilerRules.js";
|
|
7
8
|
import { unsubscribeCompilerRules as b } from "../config/compiler/unsubscribeCompilerRules.js";
|
|
8
9
|
import { createHtmlCompiler as n } from "../utils/htmlCompiler.js";
|
|
9
10
|
import { computed as p } from "vue";
|
|
10
|
-
import { useConfig as
|
|
11
|
-
const
|
|
11
|
+
import { useConfig as x } from "./useConfig.js";
|
|
12
|
+
const A = /* @__PURE__ */ new Set([
|
|
12
13
|
// URL/tag encoding fixes — keep merge-tag and placeholder integrity intact.
|
|
13
14
|
"fix-url-encoding-start",
|
|
14
15
|
"fix-url-encoding-end",
|
|
@@ -30,21 +31,23 @@ const x = /* @__PURE__ */ new Set([
|
|
|
30
31
|
"add-universal-link-flags",
|
|
31
32
|
// Coupon placeholder replacement (only present when liquidSyntax is enabled).
|
|
32
33
|
"liquid-coupon-code",
|
|
34
|
+
// Pongo only: collapses line breaks inside {% %} tags, which pongo2 cannot parse in AMP either.
|
|
35
|
+
"pongo-single-line-tags",
|
|
33
36
|
// Editor-only attribute strip — AMP4EMAIL has no `contenteditable`, so leaving
|
|
34
37
|
// it in narrows/breaks rendering. Pure attribute removal, emits nothing.
|
|
35
38
|
"remove-contenteditable"
|
|
36
|
-
]),
|
|
37
|
-
const { compiler: i, isFeatureEnabled: u, partner: a } =
|
|
39
|
+
]), M = () => {
|
|
40
|
+
const { compiler: i, isFeatureEnabled: u, partner: a } = x(), c = p(() => {
|
|
38
41
|
var m, l;
|
|
39
42
|
const e = ((m = i.value) == null ? void 0 : m.customRules) || [];
|
|
40
43
|
return [
|
|
41
|
-
...!!((l = i.value) != null && l.ignoreDefaultRules) ? [] :
|
|
42
|
-
...
|
|
44
|
+
...!!((l = i.value) != null && l.ignoreDefaultRules) ? [] : f,
|
|
45
|
+
...C,
|
|
43
46
|
...b,
|
|
44
|
-
...
|
|
47
|
+
...d,
|
|
45
48
|
...R,
|
|
46
49
|
...H,
|
|
47
|
-
...u("liquidSyntax") ? g :
|
|
50
|
+
...u("liquidSyntax") ? g : v,
|
|
48
51
|
...e.map((t, o) => ({
|
|
49
52
|
...t,
|
|
50
53
|
priority: t.priority + 1e3 + o
|
|
@@ -53,7 +56,7 @@ const x = /* @__PURE__ */ new Set([
|
|
|
53
56
|
];
|
|
54
57
|
}), r = p(() => {
|
|
55
58
|
var t;
|
|
56
|
-
const e = c.value, s = n(e), m = n(e.filter((o) =>
|
|
59
|
+
const e = c.value, s = n(e), m = n(e.filter((o) => A.has(o.id))), l = (t = a.value) == null ? void 0 : t.fallbackFont;
|
|
57
60
|
return {
|
|
58
61
|
compileHtml: (o) => s.compile(o, void 0, l),
|
|
59
62
|
compileAmpHtml: (o) => m.compile(o, void 0, l)
|
|
@@ -62,5 +65,5 @@ const x = /* @__PURE__ */ new Set([
|
|
|
62
65
|
return { compileHtml: (e) => r.value.compileHtml(e), compileAmpHtml: (e) => r.value.compileAmpHtml(e) };
|
|
63
66
|
};
|
|
64
67
|
export {
|
|
65
|
-
|
|
68
|
+
M as useHtmlCompiler
|
|
66
69
|
};
|
|
@@ -1,66 +1,66 @@
|
|
|
1
1
|
import { useConfig as V } from "./useConfig.js";
|
|
2
2
|
import { getIgnoredRecommendationBlockIds as M } from "../config/compiler/utils/recommendationIgnoreUtils.js";
|
|
3
3
|
import { TemplateTypes as W } from "../enums/defaults.js";
|
|
4
|
-
import {
|
|
4
|
+
import { CONDITION_TAG_REGEX as G, DISPLAY_CONDITIONS_REGEX as H, DISPLAY_CONDITIONS_EXCEPTIONS_REGEX as K, CampaignCouldNotBeSavedKey as X, CanNotMakeAnyChangesForRunningKey as P, DATA_ATTRIBUTE_REGEX as Y, DYNAMIC_CONTENT_TAG_REGEX as $, ALLOWED_DYNAMIC_SYSTEM_TOKENS as U, VALID_DYNAMIC_VARIABLE_REGEX as j } from "../enums/html-validator.js";
|
|
5
5
|
import { ToasterTypeOptions as c } from "../enums/toaster.js";
|
|
6
|
-
import { BLOCK_ROOT_SELECTOR as
|
|
7
|
-
import { itemsBlockDynamicVariables as
|
|
8
|
-
import { BLOCK_ROOT_SELECTOR as
|
|
9
|
-
import { RECOMMENDATION_VARIABLE_BUILTIN_ATTRIBUTES as
|
|
10
|
-
import { useRecommendationExtensionStore as
|
|
11
|
-
import { filterToProductAttrValue as
|
|
12
|
-
import { STRATEGY_FIELD_KEY as
|
|
13
|
-
import { useRecommendationStore as
|
|
14
|
-
import { base64EncodeWithSpecialChars as
|
|
15
|
-
import { computed as
|
|
16
|
-
import { useHttp as
|
|
17
|
-
import { useToaster as
|
|
18
|
-
import { useTranslations as
|
|
19
|
-
const
|
|
20
|
-
function
|
|
21
|
-
return [...s.matchAll(
|
|
6
|
+
import { BLOCK_ROOT_SELECTOR as q } from "../extensions/Blocks/Checkbox/constants/selectors.js";
|
|
7
|
+
import { itemsBlockDynamicVariables as z } from "../extensions/Blocks/Items/enums/productEnums.js";
|
|
8
|
+
import { BLOCK_ROOT_SELECTOR as Z } from "../extensions/Blocks/RadioButton/constants/selectors.js";
|
|
9
|
+
import { RECOMMENDATION_VARIABLE_BUILTIN_ATTRIBUTES as J } from "../extensions/Blocks/Recommendation/constants/selectors.js";
|
|
10
|
+
import { useRecommendationExtensionStore as Q } from "../extensions/Blocks/Recommendation/store/recommendation.js";
|
|
11
|
+
import { filterToProductAttrValue as ee } from "../extensions/Blocks/Recommendation/utils/compositionKeys.js";
|
|
12
|
+
import { STRATEGY_FIELD_KEY as te, RecommendationAssignStrategyKey as ne, RecommendationRequiredFieldsKey as se } from "../extensions/Blocks/Recommendation/validation/requiredFields.js";
|
|
13
|
+
import { useRecommendationStore as re } from "../stores/recommendation.js";
|
|
14
|
+
import { base64EncodeWithSpecialChars as oe } from "../utils/base64.js";
|
|
15
|
+
import { computed as ie } from "vue";
|
|
16
|
+
import { useHttp as ae } from "./useHttp.js";
|
|
17
|
+
import { useToaster as ce } from "./useToaster.js";
|
|
18
|
+
import { useTranslations as le } from "./useTranslations.js";
|
|
19
|
+
const me = /recommendation-id="(\d+)"/g;
|
|
20
|
+
function ue(s) {
|
|
21
|
+
return [...s.matchAll(me)].map((m) => m[1]);
|
|
22
22
|
}
|
|
23
|
-
function
|
|
23
|
+
function de(s, m) {
|
|
24
24
|
return m.some((f) => s.startsWith(`${f}_`));
|
|
25
25
|
}
|
|
26
|
-
const
|
|
27
|
-
function
|
|
28
|
-
const m = s.match(
|
|
26
|
+
const fe = /^(\d+)_\d+_(.+)$/;
|
|
27
|
+
function ge(s) {
|
|
28
|
+
const m = s.match(fe);
|
|
29
29
|
return m ? { recoId: m[1], attribute: m[2] } : null;
|
|
30
30
|
}
|
|
31
|
-
function
|
|
32
|
-
const m = new Set(
|
|
31
|
+
function pe(s) {
|
|
32
|
+
const m = new Set(J);
|
|
33
33
|
return Object.values(s).forEach((f) => {
|
|
34
|
-
m.add(
|
|
34
|
+
m.add(ee(f).toLowerCase());
|
|
35
35
|
}), m;
|
|
36
36
|
}
|
|
37
|
-
function
|
|
37
|
+
function Ee(s, m, f, o, d) {
|
|
38
38
|
const u = s.match(/{{([a-zA-Z0-9_.\s]*)}}/gm);
|
|
39
39
|
if (!u)
|
|
40
40
|
return [];
|
|
41
|
-
const p = new Set(m.map((
|
|
42
|
-
return u.forEach((
|
|
43
|
-
const g =
|
|
41
|
+
const p = new Set(m.map((C) => C.toLowerCase())), E = [];
|
|
42
|
+
return u.forEach((C) => {
|
|
43
|
+
const g = C.slice(2, -2).trim().toLowerCase();
|
|
44
44
|
if (g !== "" && p.has(g))
|
|
45
45
|
return;
|
|
46
|
-
const
|
|
47
|
-
if (
|
|
48
|
-
if (!d || d.has(
|
|
46
|
+
const y = ge(g);
|
|
47
|
+
if (y && o.has(y.recoId)) {
|
|
48
|
+
if (!d || d.has(y.attribute))
|
|
49
49
|
return;
|
|
50
50
|
E.push(g);
|
|
51
51
|
return;
|
|
52
52
|
}
|
|
53
|
-
|
|
53
|
+
de(g, f) || g.includes(".") || E.push(g);
|
|
54
54
|
}), E;
|
|
55
55
|
}
|
|
56
|
-
function
|
|
57
|
-
return (s.replace(
|
|
56
|
+
function Ce(s) {
|
|
57
|
+
return (s.replace(Y, "$1").match($) ?? []).filter((o) => {
|
|
58
58
|
const d = o.slice(2, -2), u = d.indexOf("|"), p = (u === -1 ? d : d.slice(0, u)).trim();
|
|
59
|
-
return
|
|
59
|
+
return U.includes(p) ? !1 : j.test(p) ? u !== -1 && d.slice(u + 1).trim() === "" : !0;
|
|
60
60
|
});
|
|
61
61
|
}
|
|
62
|
-
const
|
|
63
|
-
const { showToaster: s } =
|
|
62
|
+
const Ve = () => {
|
|
63
|
+
const { showToaster: s } = ce(), { post: m } = ae(), { config: f } = V(), o = le(), d = re(), u = Q(), p = ie(
|
|
64
64
|
() => {
|
|
65
65
|
var e, t;
|
|
66
66
|
return ((t = (e = f.value) == null ? void 0 : e.partner) == null ? void 0 : t.messageType) === W.transactional;
|
|
@@ -73,20 +73,20 @@ const ke = () => {
|
|
|
73
73
|
} catch {
|
|
74
74
|
return null;
|
|
75
75
|
}
|
|
76
|
-
return
|
|
77
|
-
},
|
|
76
|
+
return pe(u.filterList);
|
|
77
|
+
}, C = async (e) => {
|
|
78
78
|
const n = await m(
|
|
79
79
|
"/newsletter/template-library/check-template-html-body",
|
|
80
|
-
{ html:
|
|
80
|
+
{ html: oe(e) }
|
|
81
81
|
), { status: r, message: a } = n.data;
|
|
82
82
|
return r || s({
|
|
83
83
|
type: c.Error,
|
|
84
84
|
message: r === void 0 ? a : o("newsletter.invalid-url-link-for-toaster")
|
|
85
|
-
}), o(
|
|
85
|
+
}), o(X), a === o(P) && s({
|
|
86
86
|
type: c.Error,
|
|
87
87
|
message: o("newsletter.already-in-progress")
|
|
88
88
|
}), r;
|
|
89
|
-
}, g = (e) => !["if", "endif", "else", "elif", "now"].includes(e.toLowerCase()),
|
|
89
|
+
}, g = (e) => !["if", "endif", "else", "elif", "now"].includes(e.toLowerCase()), y = (e) => ["if", "endif"].includes(e.toLowerCase()), S = (e, t) => {
|
|
90
90
|
const n = e.match(/({%(.*?)%})/g);
|
|
91
91
|
let r = !0;
|
|
92
92
|
return n !== null && !p.value && n.forEach((a) => {
|
|
@@ -100,12 +100,12 @@ const ke = () => {
|
|
|
100
100
|
}
|
|
101
101
|
}), r;
|
|
102
102
|
}, R = async (e, t, n) => {
|
|
103
|
-
const r = n ? await
|
|
104
|
-
return
|
|
105
|
-
},
|
|
103
|
+
const r = n ? await C(e) : !0;
|
|
104
|
+
return S(e, t) && r;
|
|
105
|
+
}, _ = (e) => e.length > 0 ? !0 : (s({
|
|
106
106
|
type: c.Warning,
|
|
107
107
|
message: o("newsletter.html-content-is-empty")
|
|
108
|
-
}), !1),
|
|
108
|
+
}), !1), A = (e) => {
|
|
109
109
|
const t = (e.match(/{/gm) || []).length, n = (e.match(/}/gm) || []).length;
|
|
110
110
|
return t > n && s({
|
|
111
111
|
type: c.Warning,
|
|
@@ -114,19 +114,19 @@ const ke = () => {
|
|
|
114
114
|
type: c.Warning,
|
|
115
115
|
message: o("custom-fields.missing-opening-braces")
|
|
116
116
|
}), t === n;
|
|
117
|
-
},
|
|
118
|
-
const t =
|
|
117
|
+
}, O = (e) => {
|
|
118
|
+
const t = Ce(e).length === 0;
|
|
119
119
|
return t || s({
|
|
120
120
|
type: c.Warning,
|
|
121
121
|
message: o("custom-fields.invalid-custom-fields")
|
|
122
122
|
}), t;
|
|
123
|
-
},
|
|
123
|
+
}, b = (e, t, n, r) => {
|
|
124
124
|
if (p.value)
|
|
125
125
|
return !0;
|
|
126
|
-
const a =
|
|
126
|
+
const a = Ee(
|
|
127
127
|
e,
|
|
128
128
|
t,
|
|
129
|
-
|
|
129
|
+
ue(e),
|
|
130
130
|
n,
|
|
131
131
|
r
|
|
132
132
|
);
|
|
@@ -143,10 +143,10 @@ const ke = () => {
|
|
|
143
143
|
}
|
|
144
144
|
return !0;
|
|
145
145
|
}, w = (e) => {
|
|
146
|
-
const t = e.match(
|
|
146
|
+
const t = e.match(G), n = [];
|
|
147
147
|
let r = !0;
|
|
148
148
|
if (t && t.forEach((a) => {
|
|
149
|
-
const i = a.match(
|
|
149
|
+
const i = a.match(H), l = a.match(K), v = (i == null ? void 0 : i.join("")) || "";
|
|
150
150
|
(!i || a !== v) && !l && (s({
|
|
151
151
|
type: c.Error,
|
|
152
152
|
message: o("newsletter.display-conditions-invalid-syntax")
|
|
@@ -155,9 +155,9 @@ const ke = () => {
|
|
|
155
155
|
type: c.Error,
|
|
156
156
|
message: o("custom-conditions.wrong-equality-operators")
|
|
157
157
|
}), r = !1);
|
|
158
|
-
const
|
|
159
|
-
|
|
160
|
-
|
|
158
|
+
const T = h.match(/^[a-zA-Z]*$/g);
|
|
159
|
+
T && T.forEach((I) => {
|
|
160
|
+
y(I) && n.push(I);
|
|
161
161
|
});
|
|
162
162
|
});
|
|
163
163
|
}), n.length) {
|
|
@@ -168,22 +168,22 @@ const ke = () => {
|
|
|
168
168
|
}), r = !1);
|
|
169
169
|
}
|
|
170
170
|
return r;
|
|
171
|
-
},
|
|
171
|
+
}, N = (e) => {
|
|
172
172
|
const t = (e.match(/{% /gm) || []).length, n = (e.match(/ %}/gm) || []).length, r = t === n;
|
|
173
173
|
return r || s({
|
|
174
174
|
type: c.Warning,
|
|
175
175
|
message: o("custom-conditions.no-space-after-braces")
|
|
176
176
|
}), r;
|
|
177
|
-
},
|
|
177
|
+
}, L = (e) => (e.match(/({%(.*?)%})/g) || []).filter((n) => n.includes("if")).map((n) => (n.match(/{{.*}}/gm) || []).length).reduce((n, r) => n + r, 0) > 0 ? (s({
|
|
178
178
|
type: c.Warning,
|
|
179
179
|
message: o("custom-conditions.no-braces-inside-if-tag")
|
|
180
180
|
}), !1) : !0, B = () => {
|
|
181
181
|
if (!u.hasInvalidBlock())
|
|
182
182
|
return !0;
|
|
183
|
-
const e = u.invalidBlockFields(), t = e.length > 0 && e.every((n) => n ===
|
|
183
|
+
const e = u.invalidBlockFields(), t = e.length > 0 && e.every((n) => n === te);
|
|
184
184
|
return s({
|
|
185
185
|
type: t ? c.Warning : c.Error,
|
|
186
|
-
message: o(t ?
|
|
186
|
+
message: o(t ? ne : se)
|
|
187
187
|
}), !1;
|
|
188
188
|
}, F = () => d.recommendationConfigs && Object.values(d.recommendationConfigs).find((t) => t.filters.find((n) => n.value === "")) !== void 0 ? (s({
|
|
189
189
|
type: c.Error,
|
|
@@ -195,7 +195,7 @@ const ke = () => {
|
|
|
195
195
|
message: o("newsletter.invalid-image-type")
|
|
196
196
|
}), !1);
|
|
197
197
|
}, D = (e) => {
|
|
198
|
-
const r = new DOMParser().parseFromString(e, "text/html").querySelectorAll(
|
|
198
|
+
const r = new DOMParser().parseFromString(e, "text/html").querySelectorAll(q);
|
|
199
199
|
return Array.from(r).find((i) => {
|
|
200
200
|
var l;
|
|
201
201
|
return !((l = i.id) != null && l.trim());
|
|
@@ -204,7 +204,7 @@ const ke = () => {
|
|
|
204
204
|
message: o("unsubscribe-templates.select-checkbox-groups")
|
|
205
205
|
}), !1) : !0;
|
|
206
206
|
}, k = (e) => {
|
|
207
|
-
const r = new DOMParser().parseFromString(e, "text/html").querySelectorAll(
|
|
207
|
+
const r = new DOMParser().parseFromString(e, "text/html").querySelectorAll(Z);
|
|
208
208
|
return Array.from(r).find((i) => {
|
|
209
209
|
var l;
|
|
210
210
|
return !((l = i.id) != null && l.trim());
|
|
@@ -216,18 +216,18 @@ const ke = () => {
|
|
|
216
216
|
return { validateHtml: async (e, t, n = !1) => {
|
|
217
217
|
var v, h;
|
|
218
218
|
const r = [
|
|
219
|
-
...t.map((
|
|
220
|
-
...
|
|
219
|
+
...t.map((T) => T.value),
|
|
220
|
+
...z,
|
|
221
221
|
...((h = (v = f.value) == null ? void 0 : v.template) == null ? void 0 : h.customFieldAttributes) ?? []
|
|
222
222
|
], a = M(e), i = await E(a);
|
|
223
|
-
return await R(e, r, n) &&
|
|
223
|
+
return await R(e, r, n) && _(e) && A(e) && O(e) && b(e, r, a, i) && w(e) && N(e) && L(e) && B() && F() && x(e) && D(e) && k(e);
|
|
224
224
|
} };
|
|
225
225
|
};
|
|
226
226
|
export {
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
227
|
+
pe as buildPartnerAttributeNameSet,
|
|
228
|
+
Ee as findInvalidCustomFields,
|
|
229
|
+
Ce as getInvalidDynamicContentTags,
|
|
230
|
+
ue as getRecommendationBlockIds,
|
|
231
|
+
ge as parseRecommendationVariable,
|
|
232
|
+
Ve as useHtmlValidator
|
|
233
233
|
};
|
|
@@ -3,9 +3,9 @@ import { MinDeviceViewport as C, DefaultPadding as R } from "../enums/recommenda
|
|
|
3
3
|
import { useRecommendationExtensionStore as g } from "../extensions/Blocks/Recommendation/store/recommendation.js";
|
|
4
4
|
import { generateCompleteFilterQuery as b } from "../extensions/Blocks/Recommendation/utils/filterUtil.js";
|
|
5
5
|
import { getPartnerRecommendationParams as h } from "../extensions/Blocks/Recommendation/utils/partnerCustomizations.js";
|
|
6
|
-
import { sanitizeProductIds as
|
|
7
|
-
import { useConfigStore as
|
|
8
|
-
const
|
|
6
|
+
import { sanitizeProductIds as x } from "../extensions/Blocks/Recommendation/utils/productIds.js";
|
|
7
|
+
import { useConfigStore as P } from "../stores/config.js";
|
|
8
|
+
const B = () => ({
|
|
9
9
|
calculateCardWidth: ({
|
|
10
10
|
mobileLeftPadding: s,
|
|
11
11
|
mobileRightPadding: c,
|
|
@@ -24,7 +24,11 @@ const M = () => ({
|
|
|
24
24
|
mobileLeftPadding: 0,
|
|
25
25
|
mobileRightPadding: 0,
|
|
26
26
|
cardsInRow: 2,
|
|
27
|
-
unresponsive: !1
|
|
27
|
+
unresponsive: !1,
|
|
28
|
+
priceBeforeTextValue: "",
|
|
29
|
+
priceAfterTextValue: "",
|
|
30
|
+
discountBeforeTextValue: "",
|
|
31
|
+
discountAfterTextValue: ""
|
|
28
32
|
};
|
|
29
33
|
const { recommendationConfigs: i } = a, e = i.orientation === "grid" ? "vertical" : "horizontal";
|
|
30
34
|
return {
|
|
@@ -33,12 +37,16 @@ const M = () => ({
|
|
|
33
37
|
mobileLeftPadding: 0,
|
|
34
38
|
mobileRightPadding: 0,
|
|
35
39
|
cardsInRow: i.cardsInRow,
|
|
36
|
-
unresponsive: i.unresponsive
|
|
40
|
+
unresponsive: i.unresponsive,
|
|
41
|
+
priceBeforeTextValue: "",
|
|
42
|
+
priceAfterTextValue: "",
|
|
43
|
+
discountBeforeTextValue: "",
|
|
44
|
+
discountAfterTextValue: ""
|
|
37
45
|
};
|
|
38
46
|
},
|
|
39
47
|
buildCampaignUrl: (s, c) => {
|
|
40
48
|
var l;
|
|
41
|
-
const o = g(), a =
|
|
49
|
+
const o = g(), a = P(), i = Number(s);
|
|
42
50
|
let e;
|
|
43
51
|
if (c)
|
|
44
52
|
e = c;
|
|
@@ -70,7 +78,7 @@ const M = () => ({
|
|
|
70
78
|
return delete r[s], o.recommendationCampaignUrls = r, "";
|
|
71
79
|
}
|
|
72
80
|
const t = new URLSearchParams();
|
|
73
|
-
t.set("locale", e.language), t.set("currency", e.currencyCode), t.set("partnerName", a.partnerName), t.set("size", e.size), t.set("details", "true"), t.set("campaignId", a.variationId), e.strategy === "manualMerchandising" ? t.set("productId",
|
|
81
|
+
t.set("locale", e.language), t.set("currency", e.currencyCode), t.set("partnerName", a.partnerName), t.set("size", e.size), t.set("details", "true"), t.set("campaignId", a.variationId), e.strategy === "manualMerchandising" ? t.set("productId", x(e.productIds)) : e.strategy === "similarViewed" && t.set("productId", "{itemId}"), e.strategy === "userBased" && t.set("userId", "{user_id}");
|
|
74
82
|
const f = e.filters.filter((r) => r.isValid), m = b(f);
|
|
75
83
|
m && t.set("filter", m), e.shuffleProducts && t.set("shuffle", "true"), Object.entries(h(a.partnerName, e.strategy)).forEach(([r, n]) => t.set(r, n));
|
|
76
84
|
const p = decodeURIComponent(t.toString()), u = `${I.RECOMMENDATION_API_URL}/v2/${d}?${p}`;
|
|
@@ -78,5 +86,5 @@ const M = () => ({
|
|
|
78
86
|
}
|
|
79
87
|
});
|
|
80
88
|
export {
|
|
81
|
-
|
|
89
|
+
B as useRecommendation
|
|
82
90
|
};
|
|
@@ -1,58 +1,58 @@
|
|
|
1
1
|
import { getIgnoredRecommendationBlockIds as Y } from "../config/compiler/utils/recommendationIgnoreUtils.js";
|
|
2
|
-
import { CanNotMakeAnyChangesForRunningKey as k,
|
|
2
|
+
import { CanNotMakeAnyChangesForRunningKey as k, CONDITION_TAG_REGEX as U, DISPLAY_CONDITIONS_REGEX as M, DISPLAY_CONDITIONS_EXCEPTIONS_REGEX as x } from "../enums/html-validator.js";
|
|
3
3
|
import { SaveValidationRule as o } from "../enums/save-validation.js";
|
|
4
4
|
import { ToasterTypeOptions as r } from "../enums/toaster.js";
|
|
5
|
-
import { BLOCK_ROOT_SELECTOR as
|
|
5
|
+
import { BLOCK_ROOT_SELECTOR as G } from "../extensions/Blocks/Checkbox/constants/selectors.js";
|
|
6
6
|
import { itemsBlockDynamicVariables as W } from "../extensions/Blocks/Items/enums/productEnums.js";
|
|
7
|
-
import { BLOCK_ROOT_SELECTOR as
|
|
8
|
-
import { useRecommendationExtensionStore as
|
|
9
|
-
import { getInvalidFields as
|
|
10
|
-
import { useConfigStore as
|
|
11
|
-
import { useDynamicContentStore as
|
|
12
|
-
import { useRecommendationStore as
|
|
7
|
+
import { BLOCK_ROOT_SELECTOR as P } from "../extensions/Blocks/RadioButton/constants/selectors.js";
|
|
8
|
+
import { useRecommendationExtensionStore as q } from "../extensions/Blocks/Recommendation/store/recommendation.js";
|
|
9
|
+
import { getInvalidFields as H, STRATEGY_FIELD_KEY as V, RecommendationAssignStrategyKey as X, RecommendationRequiredFieldsKey as j } from "../extensions/Blocks/Recommendation/validation/requiredFields.js";
|
|
10
|
+
import { useConfigStore as z } from "../stores/config.js";
|
|
11
|
+
import { useDynamicContentStore as $ } from "../stores/dynamic-content.js";
|
|
12
|
+
import { useRecommendationStore as Q } from "../stores/recommendation.js";
|
|
13
13
|
import { base64EncodeWithSpecialChars as T } from "../utils/base64.js";
|
|
14
|
-
import { escapeHtml as
|
|
15
|
-
import { useTemplatePreparation as
|
|
16
|
-
import { useActionsApi as
|
|
17
|
-
import { useConfig as
|
|
18
|
-
import { useHtmlCompiler as
|
|
19
|
-
import { buildPartnerAttributeNameSet as
|
|
20
|
-
import { useHttp as
|
|
21
|
-
import { useTranslations as
|
|
22
|
-
import { findInvalidCouponBlocks as
|
|
23
|
-
import { hasInsiderUnsubscribeCode as
|
|
24
|
-
const
|
|
25
|
-
function
|
|
26
|
-
return
|
|
14
|
+
import { escapeHtml as Z } from "../utils/htmlEscape.js";
|
|
15
|
+
import { useTemplatePreparation as J } from "../utils/templatePreparation.js";
|
|
16
|
+
import { useActionsApi as ee } from "./useActionsApi.js";
|
|
17
|
+
import { useConfig as te } from "./useConfig.js";
|
|
18
|
+
import { useHtmlCompiler as ne } from "./useHtmlCompiler.js";
|
|
19
|
+
import { buildPartnerAttributeNameSet as ie, getInvalidDynamicContentTags as oe, getRecommendationBlockIds as re, findInvalidCustomFields as se } from "./useHtmlValidator.js";
|
|
20
|
+
import { useHttp as ae } from "./useHttp.js";
|
|
21
|
+
import { useTranslations as ce } from "./useTranslations.js";
|
|
22
|
+
import { findInvalidCouponBlocks as le, COUPON_TAG_MODIFIED_KEY as ue } from "./validators/useCouponBlockValidator.js";
|
|
23
|
+
import { hasInsiderUnsubscribeCode as me, EXTERNALLY_MANAGED_UNSUBSCRIBE_KEY as de, findDuplicateUnsubPageTypes as pe, countUnsubBlocksWithoutPage as ge, EMPTY_BLOCK_KEY as fe } from "./validators/useUnsubscribeBlockValidator.js";
|
|
24
|
+
const ye = "newsletter.html-content-is-empty", Ee = "custom-fields.missing-closing-braces", Ie = "custom-fields.missing-opening-braces", S = "custom-fields.invalid-custom-fields", Se = "newsletter.display-conditions-invalid-syntax", _e = "custom-conditions.wrong-equality-operators", Ce = "custom-conditions.missing-if-endif-tag", he = "custom-conditions.no-space-after-braces", ke = "custom-conditions.no-braces-inside-if-tag", Te = "newsletter.fill-all-necessary-fields", Fe = "newsletter.invalid-image-type", be = "unsubscribe-templates.select-checkbox-groups", Re = "unsubscribe-templates.select-radio-button-groups", F = "newsletter.invalid-url-link-for-toaster", b = "journey-builder.liquid-validation-failed", Ne = "/newsletter/template-library/check-template-html-body", Oe = /src="[^"]*\.(svg|pst)"/gm, N = /({%(.*?)%})/g, Le = ["if", "endif", "else", "elif", "now"], Ae = (t) => !Le.includes(t.toLowerCase()), De = (t) => ["if", "endif"].includes(t.toLowerCase());
|
|
25
|
+
function ve(t) {
|
|
26
|
+
return le(t).map((i) => ({
|
|
27
27
|
rule: o.CouponTagModified,
|
|
28
28
|
type: r.Warning,
|
|
29
|
-
key:
|
|
29
|
+
key: ue,
|
|
30
30
|
detail: i
|
|
31
31
|
}));
|
|
32
32
|
}
|
|
33
|
-
function
|
|
34
|
-
return
|
|
33
|
+
function Ke(t) {
|
|
34
|
+
return pe(t).map((i) => ({
|
|
35
35
|
rule: o.DuplicateUnsubBlock,
|
|
36
36
|
type: r.Error,
|
|
37
37
|
key: i.messageKey
|
|
38
38
|
}));
|
|
39
39
|
}
|
|
40
|
-
function
|
|
41
|
-
return Array.from({ length:
|
|
40
|
+
function Be(t) {
|
|
41
|
+
return Array.from({ length: ge(t) }, () => ({
|
|
42
42
|
rule: o.UnsubBlockMissingTemplate,
|
|
43
43
|
type: r.Warning,
|
|
44
|
-
key:
|
|
44
|
+
key: fe
|
|
45
45
|
}));
|
|
46
46
|
}
|
|
47
|
-
function
|
|
48
|
-
return
|
|
47
|
+
function we(t) {
|
|
48
|
+
return me(t) ? [{
|
|
49
49
|
rule: o.ExternallyManagedUnsubscribe,
|
|
50
50
|
type: r.Warning,
|
|
51
|
-
key:
|
|
51
|
+
key: de
|
|
52
52
|
}] : [];
|
|
53
53
|
}
|
|
54
|
-
function
|
|
55
|
-
const n = t.match(
|
|
54
|
+
function Ye(t, i) {
|
|
55
|
+
const n = t.match(N);
|
|
56
56
|
if (!n)
|
|
57
57
|
return [];
|
|
58
58
|
const u = [];
|
|
@@ -60,7 +60,7 @@ function we(t, i) {
|
|
|
60
60
|
const c = m.slice(2, -2).trim().match(/(".*?"|[^"\s]+)(?=\s*|\s*$)/g);
|
|
61
61
|
if (c && c.length > 0) {
|
|
62
62
|
const [d] = c;
|
|
63
|
-
|
|
63
|
+
Ae(d) && !i.includes(d) && u.push({
|
|
64
64
|
rule: o.CustomFieldScript,
|
|
65
65
|
type: r.Warning,
|
|
66
66
|
key: S,
|
|
@@ -69,32 +69,32 @@ function we(t, i) {
|
|
|
69
69
|
}
|
|
70
70
|
}), u;
|
|
71
71
|
}
|
|
72
|
-
function Ye(t) {
|
|
73
|
-
return t.length > 0 ? [] : [{ rule: o.EmptyHtml, type: r.Warning, key: fe }];
|
|
74
|
-
}
|
|
75
72
|
function Ue(t) {
|
|
73
|
+
return t.length > 0 ? [] : [{ rule: o.EmptyHtml, type: r.Warning, key: ye }];
|
|
74
|
+
}
|
|
75
|
+
function Me(t) {
|
|
76
76
|
const i = (t.match(/{/gm) || []).length, n = (t.match(/}/gm) || []).length;
|
|
77
77
|
return i > n ? [{
|
|
78
78
|
rule: o.MismatchedBraces,
|
|
79
79
|
type: r.Warning,
|
|
80
|
-
key:
|
|
80
|
+
key: Ee
|
|
81
81
|
}] : i < n ? [{
|
|
82
82
|
rule: o.MismatchedBraces,
|
|
83
83
|
type: r.Warning,
|
|
84
|
-
key:
|
|
84
|
+
key: Ie
|
|
85
85
|
}] : [];
|
|
86
86
|
}
|
|
87
|
-
function
|
|
88
|
-
return
|
|
87
|
+
function xe(t) {
|
|
88
|
+
return oe(t).map((i) => ({
|
|
89
89
|
rule: o.InvalidDynamicTag,
|
|
90
90
|
type: r.Warning,
|
|
91
91
|
key: S,
|
|
92
92
|
detail: i
|
|
93
93
|
}));
|
|
94
94
|
}
|
|
95
|
-
function
|
|
96
|
-
const m =
|
|
97
|
-
return
|
|
95
|
+
function Ge(t, i, n, u) {
|
|
96
|
+
const m = re(t);
|
|
97
|
+
return se(t, i, m, n, u).map((c) => ({
|
|
98
98
|
rule: o.InvalidCustomField,
|
|
99
99
|
type: r.Error,
|
|
100
100
|
key: S,
|
|
@@ -102,21 +102,21 @@ function xe(t, i, n, u) {
|
|
|
102
102
|
}));
|
|
103
103
|
}
|
|
104
104
|
function We(t) {
|
|
105
|
-
const i = t.match(
|
|
105
|
+
const i = t.match(U), n = [], u = [];
|
|
106
106
|
if (i && i.forEach((m) => {
|
|
107
|
-
const c = m.match(
|
|
107
|
+
const c = m.match(M), d = m.match(x), I = (c == null ? void 0 : c.join("")) || "";
|
|
108
108
|
(!c || m !== I) && !d && u.push({
|
|
109
109
|
rule: o.ConditionsSyntax,
|
|
110
110
|
type: r.Error,
|
|
111
|
-
key:
|
|
111
|
+
key: Se,
|
|
112
112
|
detail: m
|
|
113
113
|
}), c && c.forEach((g) => {
|
|
114
114
|
g.trim() === "=" && u.push({
|
|
115
115
|
rule: o.WrongEqualityOperator,
|
|
116
116
|
type: r.Error,
|
|
117
|
-
key:
|
|
117
|
+
key: _e
|
|
118
118
|
}), (g.match(/^[a-zA-Z]*$/g) ?? []).forEach((f) => {
|
|
119
|
-
|
|
119
|
+
De(f) && n.push(f);
|
|
120
120
|
});
|
|
121
121
|
});
|
|
122
122
|
}), n.length) {
|
|
@@ -124,31 +124,31 @@ function We(t) {
|
|
|
124
124
|
m !== c && u.push({
|
|
125
125
|
rule: o.MissingIfEndif,
|
|
126
126
|
type: r.Error,
|
|
127
|
-
key:
|
|
127
|
+
key: Ce
|
|
128
128
|
});
|
|
129
129
|
}
|
|
130
130
|
return u;
|
|
131
131
|
}
|
|
132
|
-
function
|
|
132
|
+
function Pe(t) {
|
|
133
133
|
const i = (t.match(/{% /gm) || []).length, n = (t.match(/ %}/gm) || []).length;
|
|
134
134
|
return i === n ? [] : [{
|
|
135
135
|
rule: o.ConditionTagSpacing,
|
|
136
136
|
type: r.Warning,
|
|
137
|
-
key:
|
|
137
|
+
key: he
|
|
138
138
|
}];
|
|
139
139
|
}
|
|
140
|
-
function
|
|
141
|
-
return (t.match(
|
|
140
|
+
function qe(t) {
|
|
141
|
+
return (t.match(N) || []).filter((n) => n.includes("if")).map((n) => (n.match(/{{.*}}/gm) || []).length).reduce((n, u) => n + u, 0) === 0 ? [] : [{
|
|
142
142
|
rule: o.BracesInsideIfTag,
|
|
143
143
|
type: r.Warning,
|
|
144
|
-
key:
|
|
144
|
+
key: ke
|
|
145
145
|
}];
|
|
146
146
|
}
|
|
147
|
-
function
|
|
148
|
-
return (t.match(
|
|
147
|
+
function He(t) {
|
|
148
|
+
return (t.match(Oe) ?? []).map((i) => ({
|
|
149
149
|
rule: o.InvalidImageType,
|
|
150
150
|
type: r.Error,
|
|
151
|
-
key:
|
|
151
|
+
key: Fe,
|
|
152
152
|
detail: i
|
|
153
153
|
}));
|
|
154
154
|
}
|
|
@@ -159,12 +159,12 @@ function R(t, i, n, u) {
|
|
|
159
159
|
return !((d = c.id) != null && d.trim());
|
|
160
160
|
}).map(() => ({ rule: n, type: r.Error, key: u }));
|
|
161
161
|
}
|
|
162
|
-
const
|
|
163
|
-
const { config: t, isFeatureEnabled: i } =
|
|
162
|
+
const yt = () => {
|
|
163
|
+
const { config: t, isFeatureEnabled: i } = te(), n = ce(), { post: u } = ae(), { getCompiledEmail: m, getTemplateData: c } = ee(), { compileHtml: d } = ne(), { hydrateRecommendationStore: I } = J(), g = $(), f = Q(), y = q(), O = z(), L = (e) => ({
|
|
164
164
|
rule: e.rule,
|
|
165
165
|
type: e.type,
|
|
166
166
|
detail: e.detail,
|
|
167
|
-
message: "key" in e ? n(e.key) :
|
|
167
|
+
message: "key" in e ? n(e.key) : Z(e.message)
|
|
168
168
|
}), A = async (e) => {
|
|
169
169
|
if (e.size === 0)
|
|
170
170
|
return /* @__PURE__ */ new Set();
|
|
@@ -173,10 +173,10 @@ const ft = () => {
|
|
|
173
173
|
} catch {
|
|
174
174
|
return null;
|
|
175
175
|
}
|
|
176
|
-
return
|
|
176
|
+
return ie(y.filterList);
|
|
177
177
|
}, D = async (e) => {
|
|
178
178
|
try {
|
|
179
|
-
const a = await u(
|
|
179
|
+
const a = await u(Ne, { html: T(e) }), { status: s, message: l } = a.data, p = [], E = s === void 0 && !!l && l !== n(F);
|
|
180
180
|
return s || p.push({
|
|
181
181
|
rule: o.InvalidLinks,
|
|
182
182
|
type: r.Error,
|
|
@@ -225,17 +225,17 @@ const ft = () => {
|
|
|
225
225
|
}];
|
|
226
226
|
}
|
|
227
227
|
}, K = () => {
|
|
228
|
-
const e = Object.values(y.blockStates).map((s) =>
|
|
229
|
-
const l = s.every((p) => p ===
|
|
228
|
+
const e = Object.values(y.blockStates).map((s) => H(s.recommendationConfigs, y)).filter((s) => s.length > 0).map((s) => {
|
|
229
|
+
const l = s.every((p) => p === V);
|
|
230
230
|
return {
|
|
231
231
|
rule: o.RecommendationRequiredFields,
|
|
232
232
|
type: l ? r.Warning : r.Error,
|
|
233
|
-
key: l ?
|
|
233
|
+
key: l ? X : j
|
|
234
234
|
};
|
|
235
235
|
}), a = (f.recommendationConfigs ?? []).filter((s) => s.filters.some((l) => l.value === "")).map(() => ({
|
|
236
236
|
rule: o.RecommendationFilters,
|
|
237
237
|
type: r.Error,
|
|
238
|
-
key:
|
|
238
|
+
key: Te
|
|
239
239
|
}));
|
|
240
240
|
return [...e, ...a];
|
|
241
241
|
}, B = async (e, a) => {
|
|
@@ -244,39 +244,39 @@ const ft = () => {
|
|
|
244
244
|
...a.map((w) => w.value),
|
|
245
245
|
...W,
|
|
246
246
|
...((h = (C = t.value) == null ? void 0 : C.template) == null ? void 0 : h.customFieldAttributes) ?? []
|
|
247
|
-
], l = Y(e), p = await A(l), { isTransactional: E } =
|
|
247
|
+
], l = Y(e), p = await A(l), { isTransactional: E } = O;
|
|
248
248
|
return [
|
|
249
249
|
...await D(e),
|
|
250
|
-
...E ? [] :
|
|
251
|
-
...Ye(e),
|
|
250
|
+
...E ? [] : Ye(e, s),
|
|
252
251
|
...Ue(e),
|
|
253
252
|
...Me(e),
|
|
254
|
-
...
|
|
253
|
+
...xe(e),
|
|
254
|
+
...E ? [] : Ge(e, s, l, p),
|
|
255
255
|
...We(e),
|
|
256
|
-
...Ge(e),
|
|
257
256
|
...Pe(e),
|
|
258
|
-
...K(),
|
|
259
257
|
...qe(e),
|
|
258
|
+
...K(),
|
|
259
|
+
...He(e),
|
|
260
260
|
...R(
|
|
261
261
|
e,
|
|
262
|
-
|
|
262
|
+
G,
|
|
263
263
|
o.CheckboxUnsubGroup,
|
|
264
|
-
|
|
264
|
+
be
|
|
265
265
|
),
|
|
266
266
|
...R(
|
|
267
267
|
e,
|
|
268
|
-
|
|
268
|
+
P,
|
|
269
269
|
o.RadioButtonUnsubGroup,
|
|
270
|
-
|
|
270
|
+
Re
|
|
271
271
|
)
|
|
272
272
|
];
|
|
273
273
|
}, _ = async (e, a, s) => [
|
|
274
|
-
...De(e),
|
|
275
|
-
...i("blockUnsubscribeLinks") ? Be(s) : [],
|
|
276
274
|
...ve(e),
|
|
275
|
+
...i("blockUnsubscribeLinks") ? we(s) : [],
|
|
277
276
|
...Ke(e),
|
|
277
|
+
...Be(e),
|
|
278
278
|
...i("liquidSyntax") ? await v(e) : await B(e, a)
|
|
279
|
-
].map(
|
|
279
|
+
].map(L);
|
|
280
280
|
return { collectSaveValidationErrors: _, validateCurrentTemplate: async () => {
|
|
281
281
|
const { html: e } = await c();
|
|
282
282
|
await I(e);
|
|
@@ -285,5 +285,5 @@ const ft = () => {
|
|
|
285
285
|
} };
|
|
286
286
|
};
|
|
287
287
|
export {
|
|
288
|
-
|
|
288
|
+
yt as useSaveValidation
|
|
289
289
|
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { CONDITION_TAG_REGEX as s } from "../../enums/html-validator.js";
|
|
2
|
+
const r = /[^\S\r\n\u2028\u2029]*[\r\n\u2028\u2029]+\s*/g, i = [
|
|
3
|
+
{
|
|
4
|
+
id: "pongo-single-line-tags",
|
|
5
|
+
description: "Collapse line breaks inside {% %} tags to a space",
|
|
6
|
+
type: "custom",
|
|
7
|
+
processor: (e) => e.replace(s, (o) => o.replace(r, " ")),
|
|
8
|
+
priority: 50
|
|
9
|
+
}
|
|
10
|
+
];
|
|
11
|
+
export {
|
|
12
|
+
i as pongoCompilerRules
|
|
13
|
+
};
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { useRecommendation as
|
|
2
|
-
import { DUMMY_IMAGE_MAPPINGS as
|
|
3
|
-
import { prepareRecommendationBlocks as
|
|
4
|
-
const
|
|
1
|
+
import { useRecommendation as N } from "../../composables/useRecommendation.js";
|
|
2
|
+
import { DUMMY_IMAGE_MAPPINGS as h, REGEX as d, VerticalOrientation as $, CSS as n, ATTRIBUTES as p, CONDITIONS as A, HTML as g } from "../../enums/recommendation.js";
|
|
3
|
+
import { prepareRecommendationBlocks as O } from "./utils/recommendationCompilerUtils.js";
|
|
4
|
+
const H = [
|
|
5
5
|
{
|
|
6
6
|
id: "replace-images-with-variable-names",
|
|
7
7
|
description: "Replacing dummy images with variable names in recommendation module",
|
|
8
8
|
type: "custom",
|
|
9
9
|
processor: (t) => {
|
|
10
10
|
let e = t;
|
|
11
|
-
return Object.entries(
|
|
11
|
+
return Object.entries(h).forEach(([, r]) => {
|
|
12
12
|
Object.entries(r).forEach(([o, i]) => {
|
|
13
13
|
e = e.replaceAll(i, `{{${o}}}`);
|
|
14
14
|
});
|
|
@@ -42,17 +42,17 @@ const f = [
|
|
|
42
42
|
description: "Adding recommendation unresponsive css",
|
|
43
43
|
type: "custom",
|
|
44
44
|
processor: (t) => {
|
|
45
|
-
const { calculateCardWidth: e, getRecommendationCampaignData: r } =
|
|
45
|
+
const { calculateCardWidth: e, getRecommendationCampaignData: r } = N();
|
|
46
46
|
let o = t;
|
|
47
|
-
const i = o.match(
|
|
47
|
+
const i = o.match(d.ID);
|
|
48
48
|
if (i) {
|
|
49
|
-
const
|
|
50
|
-
if (i.forEach((
|
|
51
|
-
const
|
|
52
|
-
|
|
53
|
-
}),
|
|
54
|
-
const
|
|
55
|
-
o = o.replace(n.REGULAR_NAME_HEIGHT, `${n.TRIMMED_NAME_HEIGHT} ${
|
|
49
|
+
const s = [];
|
|
50
|
+
if (i.forEach((c) => {
|
|
51
|
+
const m = /recommendation-id="(.*?)"/i.exec(c), E = m ? m[1].trim() : "", u = r(E);
|
|
52
|
+
u.textTrimming && u.orientation === $ && s.push(e(u));
|
|
53
|
+
}), s.length) {
|
|
54
|
+
const c = `width:${Math.min(...s)}px!important;`;
|
|
55
|
+
o = o.replace(n.REGULAR_NAME_HEIGHT, `${n.TRIMMED_NAME_HEIGHT} ${c} ${n.ELLIPSIS}`).replace(n.REGULAR_NAME_CONTAINER_HEIGHT, n.TRIMMED_NAME_CONTAINER_CSS).replace(n.RESPONSIVE_NAME_SIZE, `${n.RESPONSIVE_NAME_HEIGHT} ${c} ${n.ELLIPSIS}`).replace(n.RESPONSIVE_NAME_CONTAINER_HEIGHT, n.TRIMMED_RESPONSIVE_NAME_CONTAINER_CSS);
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
58
|
return o;
|
|
@@ -63,24 +63,36 @@ const f = [
|
|
|
63
63
|
id: "prepare-recommendations",
|
|
64
64
|
description: "Replacing product data with template variables in recommendation blocks",
|
|
65
65
|
type: "custom",
|
|
66
|
-
processor: (t) =>
|
|
66
|
+
processor: (t) => O(t),
|
|
67
67
|
priority: 48
|
|
68
68
|
},
|
|
69
69
|
{
|
|
70
70
|
id: "add-discount-conditions",
|
|
71
71
|
description: "Adding discount conditions to the recommendation block",
|
|
72
72
|
type: "custom",
|
|
73
|
-
processor: (t) =>
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
73
|
+
processor: (t) => {
|
|
74
|
+
let e = t;
|
|
75
|
+
const r = e.match(d.ATTRIBUTE_PARAGRAPH), { getRecommendationCampaignData: o } = N();
|
|
76
|
+
return r !== null && r.forEach((i) => {
|
|
77
|
+
const s = i.match(d.CUSTOM_FIELD);
|
|
78
|
+
if (!s)
|
|
79
|
+
return;
|
|
80
|
+
const [c] = s, m = c.match(d.CUSTOM_FIELD_INDEXES_PART), E = c.match(d.CUSTOM_FIELD_NAME_PART), u = i.match(d.ATTRIBUTE_PARAGRAPH_START_TAG);
|
|
81
|
+
if (!m || !E || !u)
|
|
82
|
+
return;
|
|
83
|
+
const [T] = m, [I] = E, [_] = u, b = I.substring(1, I.length - 2), S = _.match(d.COMPOSITION) !== null;
|
|
84
|
+
let a = c;
|
|
85
|
+
if (S) {
|
|
86
|
+
const y = T.substring(2, T.length - 3), l = o(y);
|
|
87
|
+
b === p.OMNIBUS_PRICE && (l.priceBeforeTextValue && (a = `${l.priceBeforeTextValue}${a}`), l.priceAfterTextValue && (a = `${a}${l.priceAfterTextValue}`)), b === p.OMNIBUS_DISCOUNT && (l.discountBeforeTextValue && (a = `${l.discountBeforeTextValue}${a}`), l.discountAfterTextValue && (a = `${a}${l.discountAfterTextValue}`));
|
|
88
|
+
}
|
|
89
|
+
const R = T.substring(2);
|
|
90
|
+
let f = "";
|
|
91
|
+
b in A.IF && (f = A.IF[b].replaceAll(`{${p.DISCOUNT}}`, `${R}${p.DISCOUNT}`).replaceAll(`{${p.OMNIBUS_DISCOUNT}}`, `${R}${p.OMNIBUS_DISCOUNT}`).replaceAll(`{${p.OMNIBUS_PRICE}}`, `${R}${p.OMNIBUS_PRICE}`));
|
|
92
|
+
const M = `${_}${a}${g.PARAGRAPH_END_TAG}`, C = `${f}${S ? M : i}${A.ELSE}${_}${g.PARAGRAPH_END_TAG}${A.END_IF}`;
|
|
93
|
+
e = e.replace(i, C);
|
|
94
|
+
}), e;
|
|
95
|
+
},
|
|
84
96
|
priority: 53
|
|
85
97
|
},
|
|
86
98
|
{
|
|
@@ -135,8 +147,8 @@ const f = [
|
|
|
135
147
|
), e = e.replace(
|
|
136
148
|
/@media[^{]*max-width\s*:\s*480px[^{]*\{((?:[^{}]*\{[^{}]*\})*[^{}]*)\}/g,
|
|
137
149
|
(r, o) => {
|
|
138
|
-
const i = o.match(/[^{}]+\{[^{}]*\}/g) || [],
|
|
139
|
-
return i.every((
|
|
150
|
+
const i = o.match(/[^{}]+\{[^{}]*\}/g) || [], s = /ins-recommendation|product-image-cell|button-cell|product-info-cell/;
|
|
151
|
+
return i.every((m) => s.test(m)) ? "" : r;
|
|
140
152
|
}
|
|
141
153
|
)), e;
|
|
142
154
|
},
|
|
@@ -196,5 +208,5 @@ const f = [
|
|
|
196
208
|
}
|
|
197
209
|
];
|
|
198
210
|
export {
|
|
199
|
-
|
|
211
|
+
H as recommendationCompilerRules
|
|
200
212
|
};
|
|
@@ -1,16 +1,17 @@
|
|
|
1
|
-
const n = "newsletter.already-in-progress",
|
|
1
|
+
const n = "newsletter.already-in-progress", s = "newsletter.campaign-could-not-be-saved", e = / (==|<=|>=|!=|>|<|in) | (if|elif|endif|else|and|or) |("[\S ]+")|('[\S ]+')|([^”\s\n]+)|(({%)|( %}))/gm, E = /{%( )*now( )(".*")( )*%}/gm, o = /{%(?:(?!{%)[\s\S])*?%}/g, _ = /\{\{[^{}]+\}\}/g, t = /(\s)data-[\w-]+=(?:"[^"]*"|'[^']*')/g, i = /^[A-Za-z0-9_.]+$/, a = [
|
|
2
2
|
"ins-unsubscribe-link",
|
|
3
3
|
"ins-global-unsubscribe-link",
|
|
4
4
|
"ins-preferences-unsubscribe-link",
|
|
5
5
|
"@COUPON_CODE"
|
|
6
6
|
];
|
|
7
7
|
export {
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
a as ALLOWED_DYNAMIC_SYSTEM_TOKENS,
|
|
9
|
+
o as CONDITION_TAG_REGEX,
|
|
10
|
+
s as CampaignCouldNotBeSavedKey,
|
|
10
11
|
n as CanNotMakeAnyChangesForRunningKey,
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
t as DATA_ATTRIBUTE_REGEX,
|
|
13
|
+
E as DISPLAY_CONDITIONS_EXCEPTIONS_REGEX,
|
|
14
|
+
e as DISPLAY_CONDITIONS_REGEX,
|
|
15
|
+
_ as DYNAMIC_CONTENT_TAG_REGEX,
|
|
15
16
|
i as VALID_DYNAMIC_VARIABLE_REGEX
|
|
16
17
|
};
|
|
@@ -27,12 +27,13 @@ const e = 20, t = 320, s = "vertical", m = {
|
|
|
27
27
|
ID: /recommendation-id="(.*?)"/gi,
|
|
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
|
+
COMPOSITION: /composition="true"/gm,
|
|
30
31
|
CUSTOM_FIELD: /{{(?:reco_)?[0-9]+_[0-8]_(discount|omnibus_discount|omnibus_price)}}/gm,
|
|
31
32
|
CUSTOM_FIELD_INDEXES_PART: /{{(?:reco_)?[0-9]+_[0-8]_/gm,
|
|
32
33
|
CUSTOM_FIELD_NAME_PART: /_(discount|omnibus_discount|omnibus_price)}}/gm
|
|
33
|
-
}, a = {
|
|
34
|
-
PARAGRAPH_END_TAG: "</p>"
|
|
35
34
|
}, o = {
|
|
35
|
+
PARAGRAPH_END_TAG: "</p>"
|
|
36
|
+
}, a = {
|
|
36
37
|
REGULAR_NAME_HEIGHT: ".ext-product-name.ins-vertical p { height:90px!important;",
|
|
37
38
|
TRIMMED_NAME_HEIGHT: ".ext-product-name.ins-vertical p { height:18px!important;",
|
|
38
39
|
ELLIPSIS: "text-overflow:ellipsis!important; white-space:nowrap!important;",
|
|
@@ -46,10 +47,10 @@ const e = 20, t = 320, s = "vertical", m = {
|
|
|
46
47
|
export {
|
|
47
48
|
i as ATTRIBUTES,
|
|
48
49
|
_ as CONDITIONS,
|
|
49
|
-
|
|
50
|
+
a as CSS,
|
|
50
51
|
m as DUMMY_IMAGE_MAPPINGS,
|
|
51
52
|
e as DefaultPadding,
|
|
52
|
-
|
|
53
|
+
o as HTML,
|
|
53
54
|
t as MinDeviceViewport,
|
|
54
55
|
n as REGEX,
|
|
55
56
|
s as VerticalOrientation
|
package/dist/package.json.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
const o = "3.27.1-beta.
|
|
1
|
+
const o = "3.27.1-beta.ee576ab", e = { stripo: { version: "2.86.1" } }, s = {
|
|
2
2
|
version: o,
|
|
3
|
-
guido:
|
|
3
|
+
guido: e
|
|
4
4
|
};
|
|
5
5
|
export {
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
s as default,
|
|
7
|
+
e as guido,
|
|
8
8
|
o as version
|
|
9
9
|
};
|
|
@@ -8,6 +8,10 @@ type CardWidthParams = {
|
|
|
8
8
|
interface CampaignData extends CardWidthParams {
|
|
9
9
|
textTrimming: boolean;
|
|
10
10
|
orientation: string;
|
|
11
|
+
priceBeforeTextValue: string;
|
|
12
|
+
priceAfterTextValue: string;
|
|
13
|
+
discountBeforeTextValue: string;
|
|
14
|
+
discountAfterTextValue: string;
|
|
11
15
|
}
|
|
12
16
|
export declare const useRecommendation: () => {
|
|
13
17
|
calculateCardWidth: ({ mobileLeftPadding, mobileRightPadding, cardsInRow, unresponsive, }: CardWidthParams) => number;
|
|
@@ -3,6 +3,7 @@ export declare const CanNotMakeAnyChangesKey = "newsletter.can-not-make-any-chan
|
|
|
3
3
|
export declare const CampaignCouldNotBeSavedKey = "newsletter.campaign-could-not-be-saved";
|
|
4
4
|
export declare const DISPLAY_CONDITIONS_REGEX: RegExp;
|
|
5
5
|
export declare const DISPLAY_CONDITIONS_EXCEPTIONS_REGEX: RegExp;
|
|
6
|
+
export declare const CONDITION_TAG_REGEX: RegExp;
|
|
6
7
|
export declare const REMOVE_CONDITIONS_REGEX: RegExp;
|
|
7
8
|
export declare const DYNAMIC_CONTENT_TAG_REGEX: RegExp;
|
|
8
9
|
export declare const DATA_ATTRIBUTE_REGEX: RegExp;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@useinsider/guido",
|
|
3
|
-
"version": "3.27.1-beta.
|
|
3
|
+
"version": "3.27.1-beta.ee576ab",
|
|
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",
|