@useinsider/guido 3.26.0-beta.7d59071 → 3.26.0-beta.8251afd
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/email-be/html-validation.js +24 -0
- package/dist/composables/useSave.js +19 -17
- package/dist/composables/useSaveValidation.js +142 -249
- package/dist/composables/useTranslations.js +14 -9
- package/dist/enums/email-be.js +27 -0
- package/dist/enums/save-validation.js +1 -1
- package/dist/node_modules/valibot/dist/index.js +184 -122
- package/dist/package.json.js +1 -1
- package/dist/services/emailBe/errors/ApiError.js +50 -0
- package/dist/services/emailBe/errors/handleApiError.js +31 -0
- package/dist/services/emailBe/errors/toApiError.js +71 -0
- package/dist/services/emailBe/html/HtmlValidationService.js +35 -0
- package/dist/services/emailBe/html/index.js +6 -0
- package/dist/services/emailBe/http/HttpManager.js +68 -0
- package/dist/services/emailBe/http/RetryStack.js +23 -0
- package/dist/services/emailBe/http/client.js +61 -0
- package/dist/services/emailBe/http/index.js +10 -0
- package/dist/services/emailBe/http/transportErrors.js +20 -0
- package/dist/src/@types/email-be/html-validation.d.ts +35 -0
- package/dist/src/composables/useSaveValidation.d.ts +2 -2
- package/dist/src/enums/email-be.d.ts +26 -0
- package/dist/src/enums/save-validation.d.ts +3 -14
- package/dist/src/services/emailBe/errors/ApiError.d.ts +40 -0
- package/dist/src/services/emailBe/errors/handleApiError.d.ts +11 -0
- package/dist/src/services/emailBe/errors/toApiError.d.ts +2 -0
- package/dist/src/services/emailBe/html/HtmlValidationService.d.ts +8 -0
- package/dist/src/services/emailBe/html/index.d.ts +2 -0
- package/dist/src/services/emailBe/http/HttpManager.d.ts +13 -0
- package/dist/src/services/emailBe/http/RetryStack.d.ts +6 -0
- package/dist/src/services/emailBe/http/client.d.ts +3 -0
- package/dist/src/services/emailBe/http/index.d.ts +2 -0
- package/dist/src/services/emailBe/http/transportErrors.d.ts +15 -0
- package/dist/src/services/emailBe/http/types.d.ts +46 -0
- package/package.json +2 -2
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { object as r, array as o, boolean as l, string as e, nullable as n, union as a, number as t, record as i, pipe as c, transform as s, tuple as m } from "../../node_modules/valibot/dist/index.js";
|
|
2
|
+
const d = r({
|
|
3
|
+
code: e(),
|
|
4
|
+
trans: r({
|
|
5
|
+
key: e(),
|
|
6
|
+
// PHP serializes an empty associative array as `[]`, so an empty list means "no placeholders".
|
|
7
|
+
replace: a([
|
|
8
|
+
i(e(), a([e(), t()])),
|
|
9
|
+
c(m([]), s(() => ({})))
|
|
10
|
+
])
|
|
11
|
+
}),
|
|
12
|
+
anchor: n(r({
|
|
13
|
+
selector: e(),
|
|
14
|
+
indexes: o(t())
|
|
15
|
+
})),
|
|
16
|
+
details: o(e())
|
|
17
|
+
}), u = r({
|
|
18
|
+
valid: l(),
|
|
19
|
+
errors: o(d)
|
|
20
|
+
});
|
|
21
|
+
export {
|
|
22
|
+
d as HtmlValidationErrorSchema,
|
|
23
|
+
u as HtmlValidationResultSchema
|
|
24
|
+
};
|
|
@@ -16,40 +16,40 @@ import { useHtmlValidator as tt } from "./useHtmlValidator.js";
|
|
|
16
16
|
import { useToaster as et } from "./useToaster.js";
|
|
17
17
|
import { useCouponBlockValidator as ot } from "./validators/useCouponBlockValidator.js";
|
|
18
18
|
import { useHtmlDocumentCountValidator as it } from "./validators/useHtmlDocumentCountValidator.js";
|
|
19
|
-
import { useLiquidValidator as
|
|
20
|
-
import { useSyncModuleBlockValidator as
|
|
19
|
+
import { useLiquidValidator as rt } from "./validators/useLiquidValidator.js";
|
|
20
|
+
import { useSyncModuleBlockValidator as st } from "./validators/useSyncModuleBlockValidator.js";
|
|
21
21
|
import { useUnsubscribeBlockValidator as at } from "./validators/useUnsubscribeBlockValidator.js";
|
|
22
22
|
const Pt = () => {
|
|
23
|
-
const n = I(), S = N(), { validateHtml: y } = tt(), { validateLiquidSyntax: b } =
|
|
23
|
+
const n = I(), S = N(), { validateHtml: y } = tt(), { validateLiquidSyntax: b } = rt(), { validateCouponBlockTags: H } = ot(), {
|
|
24
24
|
validateUnsubscribeBlockUniqueness: E,
|
|
25
25
|
validateUnsubscribeBlockHasTemplate: g,
|
|
26
26
|
validateNoInsiderUnsubscribeCode: V
|
|
27
|
-
} = at(), { validateSyncModuleBlocks: l } =
|
|
27
|
+
} = at(), { validateSyncModuleBlocks: l } = st(), { validateSingleHtmlDocument: c } = it(), { callbacks: a, isFeatureEnabled: u } = D(), { extractSyncModuleData: x } = G(), { setSyncModuleUnsubscriptionPages: k } = K(), { editorSave: C, getTemplateData: m } = O(), { showToaster: h } = et(), { getBlockedDomains: B, resolveToast: T } = $(), { prepareTemplateDetails: p } = Z(), { collectSaveValidationErrors: L } = j(), { isEnabled: P } = z(), U = Y(), A = X(), w = Q(), { runExclusive: d } = F(), f = async (t, e, i) => {
|
|
28
28
|
if (!u("allowlistEnabled"))
|
|
29
29
|
return !1;
|
|
30
30
|
const o = await B(t, e);
|
|
31
31
|
if (!o.length)
|
|
32
32
|
return !1;
|
|
33
33
|
if (!i) {
|
|
34
|
-
const
|
|
35
|
-
|
|
34
|
+
const r = await T(o);
|
|
35
|
+
r != null && r.message && h({
|
|
36
36
|
type: J.Warning,
|
|
37
|
-
message:
|
|
38
|
-
actionButton:
|
|
37
|
+
message: r.message,
|
|
38
|
+
actionButton: r.actionButton
|
|
39
39
|
});
|
|
40
40
|
}
|
|
41
41
|
return !0;
|
|
42
42
|
}, M = async (t, e) => !H(t.compiledHtml) || u("blockUnsubscribeLinks") && !V(t.rawHtml, e) || !E(t.compiledHtml) || !g(t.compiledHtml) ? !1 : u("liquidSyntax") ? b(t.compiledHtml) : y(t.compiledHtml, t.dynamicContentList, !0), v = async (t, e) => {
|
|
43
43
|
if (!await C())
|
|
44
44
|
return;
|
|
45
|
-
const { unsubscribePayload: o, stripoModules:
|
|
46
|
-
if (await k(o), t.modules =
|
|
47
|
-
const
|
|
48
|
-
S({ ...t, ...
|
|
45
|
+
const { unsubscribePayload: o, stripoModules: r } = x(t.rawHtml);
|
|
46
|
+
if (await k(o), t.modules = r, !e.suppress) {
|
|
47
|
+
const s = e.blankCompiled ? { compiledHtml: "", ampHtml: "" } : {};
|
|
48
|
+
S({ ...t, ...s, silent: e.silent });
|
|
49
49
|
}
|
|
50
50
|
return t;
|
|
51
51
|
}, W = async (t, e) => {
|
|
52
|
-
var
|
|
52
|
+
var r;
|
|
53
53
|
n();
|
|
54
54
|
const i = await m();
|
|
55
55
|
if (!c(i.html, e))
|
|
@@ -57,18 +57,20 @@ const Pt = () => {
|
|
|
57
57
|
const o = await p(i);
|
|
58
58
|
if (l(o.rawHtml, e)) {
|
|
59
59
|
if (P.value && !e) {
|
|
60
|
-
const
|
|
60
|
+
const s = await L(
|
|
61
61
|
o.compiledHtml,
|
|
62
62
|
o.dynamicContentList,
|
|
63
63
|
o.rawHtml
|
|
64
64
|
);
|
|
65
|
-
if (
|
|
66
|
-
|
|
65
|
+
if (!s)
|
|
66
|
+
return;
|
|
67
|
+
if (s.length) {
|
|
68
|
+
U.open(s, "save");
|
|
67
69
|
return;
|
|
68
70
|
}
|
|
69
71
|
} else if (!await M(o, e))
|
|
70
72
|
return;
|
|
71
|
-
if (!((
|
|
73
|
+
if (!((r = a.value) != null && r.externalValidation && !await a.value.externalValidation(o)) && !await f(o.compiledHtml, o.css, e))
|
|
72
74
|
return v(o, { silent: e, suppress: t });
|
|
73
75
|
}
|
|
74
76
|
}, R = async () => {
|
|
@@ -1,289 +1,182 @@
|
|
|
1
|
-
import { getIgnoredRecommendationBlockIds as
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
rule: o.DuplicateUnsubBlock,
|
|
36
|
-
type: r.Error,
|
|
37
|
-
key: i.messageKey
|
|
38
|
-
}));
|
|
39
|
-
}
|
|
40
|
-
function Ke(t) {
|
|
41
|
-
return Array.from({ length: pe(t) }, () => ({
|
|
42
|
-
rule: o.UnsubBlockMissingTemplate,
|
|
43
|
-
type: r.Warning,
|
|
44
|
-
key: ge
|
|
45
|
-
}));
|
|
1
|
+
import { getIgnoredRecommendationBlockIds as B } from "../config/compiler/utils/recommendationIgnoreUtils.js";
|
|
2
|
+
import { HtmlSyntax as I } from "../enums/email-be.js";
|
|
3
|
+
import { CanNotMakeAnyChangesForRunningKey as b, DISPLAY_CONDITIONS_REGEX as K } from "../enums/html-validator.js";
|
|
4
|
+
import { SaveValidationRule as a } from "../enums/save-validation.js";
|
|
5
|
+
import { ToasterTypeOptions as c } from "../enums/toaster.js";
|
|
6
|
+
import { BLOCK_ROOT_SELECTOR as U } from "../extensions/Blocks/Checkbox/constants/selectors.js";
|
|
7
|
+
import { itemsBlockDynamicVariables as M } from "../extensions/Blocks/Items/enums/productEnums.js";
|
|
8
|
+
import { BLOCK_ROOT_SELECTOR as x } from "../extensions/Blocks/RadioButton/constants/selectors.js";
|
|
9
|
+
import { useRecommendationExtensionStore as G } from "../extensions/Blocks/Recommendation/store/recommendation.js";
|
|
10
|
+
import { getInvalidFields as H, STRATEGY_FIELD_KEY as P, RecommendationAssignStrategyKey as Y, RecommendationRequiredFieldsKey as V } from "../extensions/Blocks/Recommendation/validation/requiredFields.js";
|
|
11
|
+
import { htmlValidationService as q } from "../services/emailBe/html/index.js";
|
|
12
|
+
import { useConfigStore as W } from "../stores/config.js";
|
|
13
|
+
import { useDynamicContentStore as j } from "../stores/dynamic-content.js";
|
|
14
|
+
import { useRecommendationStore as X } from "../stores/recommendation.js";
|
|
15
|
+
import { base64EncodeWithSpecialChars as z } from "../utils/base64.js";
|
|
16
|
+
import { escapeHtml as F } from "../utils/htmlEscape.js";
|
|
17
|
+
import { useTemplatePreparation as $ } from "../utils/templatePreparation.js";
|
|
18
|
+
import { useActionsApi as Q } from "./useActionsApi.js";
|
|
19
|
+
import { useConfig as Z } from "./useConfig.js";
|
|
20
|
+
import { useHtmlCompiler as J } from "./useHtmlCompiler.js";
|
|
21
|
+
import { buildPartnerAttributeNameSet as ee, getInvalidDynamicContentTags as te, getRecommendationBlockIds as ne, findInvalidCustomFields as ie } from "./useHtmlValidator.js";
|
|
22
|
+
import { useHttp as oe } from "./useHttp.js";
|
|
23
|
+
import { useTranslations as re } from "./useTranslations.js";
|
|
24
|
+
import { hasInsiderUnsubscribeCode as se, EXTERNALLY_MANAGED_UNSUBSCRIBE_KEY as ae } from "./validators/useUnsubscribeBlockValidator.js";
|
|
25
|
+
const y = "custom-fields.invalid-custom-fields", ce = "custom-conditions.missing-if-endif-tag", le = "newsletter.fill-all-necessary-fields", me = "unsubscribe-templates.select-checkbox-groups", de = "unsubscribe-templates.select-radio-button-groups", ue = "/newsletter/template-library/check-template-html-body", pe = /({%(.*?)%})/g, fe = ["unsubscribe-page-not-selected"], ge = ["if", "endif", "else", "elif", "now"], ye = (t) => !ge.includes(t.toLowerCase()), Ee = (t) => ["if", "endif"].includes(t.toLowerCase());
|
|
26
|
+
function Se(t) {
|
|
27
|
+
const n = fe.includes(t.code) ? "" : t.details.join(", ");
|
|
28
|
+
return {
|
|
29
|
+
rule: a.EmailBeHtml,
|
|
30
|
+
type: c.Error,
|
|
31
|
+
key: t.trans.key,
|
|
32
|
+
params: t.trans.replace,
|
|
33
|
+
...n ? { detail: n } : {}
|
|
34
|
+
};
|
|
46
35
|
}
|
|
47
|
-
function
|
|
48
|
-
return
|
|
49
|
-
rule:
|
|
50
|
-
type:
|
|
51
|
-
key:
|
|
36
|
+
function Ce(t) {
|
|
37
|
+
return se(t) ? [{
|
|
38
|
+
rule: a.ExternallyManagedUnsubscribe,
|
|
39
|
+
type: c.Warning,
|
|
40
|
+
key: ae
|
|
52
41
|
}] : [];
|
|
53
42
|
}
|
|
54
|
-
function
|
|
55
|
-
const
|
|
56
|
-
if (!
|
|
43
|
+
function Ie(t, n) {
|
|
44
|
+
const s = t.match(pe);
|
|
45
|
+
if (!s)
|
|
57
46
|
return [];
|
|
58
|
-
const
|
|
59
|
-
return
|
|
60
|
-
const
|
|
61
|
-
if (
|
|
62
|
-
const [
|
|
63
|
-
|
|
64
|
-
rule:
|
|
65
|
-
type:
|
|
66
|
-
key:
|
|
67
|
-
detail:
|
|
47
|
+
const l = [];
|
|
48
|
+
return s.forEach((o) => {
|
|
49
|
+
const d = o.slice(2, -2).trim().match(/(".*?"|[^"\s]+)(?=\s*|\s*$)/g);
|
|
50
|
+
if (d && d.length > 0) {
|
|
51
|
+
const [u] = d;
|
|
52
|
+
ye(u) && !n.includes(u) && l.push({
|
|
53
|
+
rule: a.CustomFieldScript,
|
|
54
|
+
type: c.Warning,
|
|
55
|
+
key: y,
|
|
56
|
+
detail: u
|
|
68
57
|
});
|
|
69
58
|
}
|
|
70
|
-
}),
|
|
59
|
+
}), l;
|
|
71
60
|
}
|
|
72
|
-
function
|
|
73
|
-
return t.
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
rule: o.MismatchedBraces,
|
|
79
|
-
type: r.Warning,
|
|
80
|
-
key: ye
|
|
81
|
-
}] : i < n ? [{
|
|
82
|
-
rule: o.MismatchedBraces,
|
|
83
|
-
type: r.Warning,
|
|
84
|
-
key: Ee
|
|
85
|
-
}] : [];
|
|
86
|
-
}
|
|
87
|
-
function Me(t) {
|
|
88
|
-
return ie(t).map((i) => ({
|
|
89
|
-
rule: o.InvalidDynamicTag,
|
|
90
|
-
type: r.Warning,
|
|
91
|
-
key: S,
|
|
92
|
-
detail: i
|
|
61
|
+
function be(t) {
|
|
62
|
+
return te(t).map((n) => ({
|
|
63
|
+
rule: a.InvalidDynamicTag,
|
|
64
|
+
type: c.Warning,
|
|
65
|
+
key: y,
|
|
66
|
+
detail: n
|
|
93
67
|
}));
|
|
94
68
|
}
|
|
95
|
-
function
|
|
96
|
-
const
|
|
97
|
-
return
|
|
98
|
-
rule:
|
|
99
|
-
type:
|
|
100
|
-
key:
|
|
101
|
-
detail:
|
|
69
|
+
function ke(t, n, s, l) {
|
|
70
|
+
const o = ne(t);
|
|
71
|
+
return ie(t, n, o, s, l).map((d) => ({
|
|
72
|
+
rule: a.InvalidCustomField,
|
|
73
|
+
type: c.Error,
|
|
74
|
+
key: y,
|
|
75
|
+
detail: d
|
|
102
76
|
}));
|
|
103
77
|
}
|
|
104
|
-
function
|
|
105
|
-
const
|
|
106
|
-
|
|
107
|
-
const c = m.match(U), d = m.match(M), I = (c == null ? void 0 : c.join("")) || "";
|
|
108
|
-
(!c || m !== I) && !d && u.push({
|
|
109
|
-
rule: o.ConditionsSyntax,
|
|
110
|
-
type: r.Error,
|
|
111
|
-
key: Ie,
|
|
112
|
-
detail: m
|
|
113
|
-
}), c && c.forEach((g) => {
|
|
114
|
-
g.trim() === "=" && u.push({
|
|
115
|
-
rule: o.WrongEqualityOperator,
|
|
116
|
-
type: r.Error,
|
|
117
|
-
key: Se
|
|
118
|
-
}), (g.match(/^[a-zA-Z]*$/g) ?? []).forEach((f) => {
|
|
119
|
-
Ae(f) && n.push(f);
|
|
120
|
-
});
|
|
121
|
-
});
|
|
122
|
-
}), n.length) {
|
|
123
|
-
const m = n.filter((d) => d === "if").length, c = n.filter((d) => d === "endif").length;
|
|
124
|
-
m !== c && u.push({
|
|
125
|
-
rule: o.MissingIfEndif,
|
|
126
|
-
type: r.Error,
|
|
127
|
-
key: _e
|
|
128
|
-
});
|
|
129
|
-
}
|
|
130
|
-
return u;
|
|
131
|
-
}
|
|
132
|
-
function Ge(t) {
|
|
133
|
-
const i = (t.match(/{% /gm) || []).length, n = (t.match(/ %}/gm) || []).length;
|
|
134
|
-
return i === n ? [] : [{
|
|
135
|
-
rule: o.ConditionTagSpacing,
|
|
136
|
-
type: r.Warning,
|
|
137
|
-
key: Ce
|
|
138
|
-
}];
|
|
139
|
-
}
|
|
140
|
-
function Pe(t) {
|
|
141
|
-
return (t.match(L) || []).filter((n) => n.includes("if")).map((n) => (n.match(/{{.*}}/gm) || []).length).reduce((n, u) => n + u, 0) === 0 ? [] : [{
|
|
142
|
-
rule: o.BracesInsideIfTag,
|
|
143
|
-
type: r.Warning,
|
|
144
|
-
key: he
|
|
145
|
-
}];
|
|
146
|
-
}
|
|
147
|
-
function qe(t) {
|
|
148
|
-
return (t.match(Le) ?? []).map((i) => ({
|
|
149
|
-
rule: o.InvalidImageType,
|
|
150
|
-
type: r.Error,
|
|
151
|
-
key: Te,
|
|
152
|
-
detail: i
|
|
153
|
-
}));
|
|
78
|
+
function Fe(t) {
|
|
79
|
+
const n = (t.match(/{%(.*?)%}/g) ?? []).flatMap((o) => o.match(K) ?? []).flatMap((o) => o.match(/^[a-zA-Z]*$/g) ?? []).filter(Ee), s = n.filter((o) => o === "if").length, l = n.filter((o) => o === "endif").length;
|
|
80
|
+
return s === l ? [] : [{ rule: a.MissingIfEndif, type: c.Error, key: ce }];
|
|
154
81
|
}
|
|
155
|
-
function
|
|
156
|
-
const
|
|
157
|
-
return Array.from(
|
|
158
|
-
var
|
|
159
|
-
return !((
|
|
160
|
-
}).map(() => ({ rule:
|
|
82
|
+
function k(t, n, s, l) {
|
|
83
|
+
const o = new DOMParser().parseFromString(t, "text/html");
|
|
84
|
+
return Array.from(o.querySelectorAll(n)).filter((d) => {
|
|
85
|
+
var u;
|
|
86
|
+
return !((u = d.id) != null && u.trim());
|
|
87
|
+
}).map(() => ({ rule: s, type: c.Error, key: l }));
|
|
161
88
|
}
|
|
162
|
-
const
|
|
163
|
-
const { config: t, isFeatureEnabled:
|
|
89
|
+
const _e = (t) => t && Object.fromEntries(Object.entries(t).map(([n, s]) => [n, F(String(s))])), $e = () => {
|
|
90
|
+
const { config: t, isFeatureEnabled: n } = Z(), s = re(), { post: l } = oe(), { getCompiledEmail: o, getTemplateData: d } = Q(), { compileHtml: u } = J(), { hydrateRecommendationStore: _ } = $(), R = j(), O = X(), f = G(), T = W(), L = (e) => ({
|
|
164
91
|
rule: e.rule,
|
|
165
92
|
type: e.type,
|
|
166
93
|
detail: e.detail,
|
|
167
|
-
message: "key" in e ?
|
|
168
|
-
}),
|
|
94
|
+
message: "key" in e ? s(e.key, _e(e.params)) : F(e.message)
|
|
95
|
+
}), h = async (e) => {
|
|
169
96
|
if (e.size === 0)
|
|
170
97
|
return /* @__PURE__ */ new Set();
|
|
171
98
|
try {
|
|
172
|
-
await
|
|
99
|
+
await f.fetchRecommendationFilters();
|
|
173
100
|
} catch {
|
|
174
101
|
return null;
|
|
175
102
|
}
|
|
176
|
-
return
|
|
103
|
+
return ee(f.filterList);
|
|
177
104
|
}, D = async (e) => {
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
...E ? { message: l } : { key: F }
|
|
184
|
-
}), l === n(k) && p.push({
|
|
185
|
-
rule: o.LinkCheckInProgress,
|
|
186
|
-
type: r.Error,
|
|
187
|
-
key: k
|
|
188
|
-
}), p;
|
|
189
|
-
} catch (a) {
|
|
190
|
-
return console.warn("Link-check collector failed; skipping the link rule.", a), [];
|
|
191
|
-
}
|
|
105
|
+
const r = await q.validate({
|
|
106
|
+
html: e,
|
|
107
|
+
syntax: n("liquidSyntax") ? I.LIQUID : I.PONGO
|
|
108
|
+
});
|
|
109
|
+
return r.ok ? r.data.errors.map(Se) : null;
|
|
192
110
|
}, v = async (e) => {
|
|
193
111
|
try {
|
|
194
|
-
const
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
preheader: null,
|
|
200
|
-
html: T(e),
|
|
201
|
-
ampHtml: null
|
|
202
|
-
}
|
|
203
|
-
}]);
|
|
204
|
-
if (!Array.isArray(a.data)) {
|
|
205
|
-
const l = a.data;
|
|
206
|
-
return [{
|
|
207
|
-
rule: o.LiquidSyntax,
|
|
208
|
-
type: r.Warning,
|
|
209
|
-
message: l.message ?? n(b)
|
|
210
|
-
}];
|
|
211
|
-
}
|
|
212
|
-
const [s] = a.data;
|
|
213
|
-
return Object.values((s == null ? void 0 : s.errors) ?? {}).map((l) => ({
|
|
214
|
-
rule: o.LiquidSyntax,
|
|
215
|
-
type: r.Warning,
|
|
216
|
-
message: l.replace(/^line \d+:\s*/, "")
|
|
217
|
-
}));
|
|
218
|
-
} catch (a) {
|
|
219
|
-
if (a != null && a.authReported)
|
|
220
|
-
throw a;
|
|
221
|
-
return [{
|
|
222
|
-
rule: o.LiquidSyntax,
|
|
223
|
-
type: r.Error,
|
|
224
|
-
message: n(b)
|
|
112
|
+
const r = await l(ue, { html: z(e) }), { message: i } = r.data;
|
|
113
|
+
return i !== s(b) ? [] : [{
|
|
114
|
+
rule: a.LinkCheckInProgress,
|
|
115
|
+
type: c.Error,
|
|
116
|
+
key: b
|
|
225
117
|
}];
|
|
118
|
+
} catch (r) {
|
|
119
|
+
return console.warn("Link-check collector failed; skipping the running-campaign rule.", r), [];
|
|
226
120
|
}
|
|
227
|
-
},
|
|
228
|
-
const e = Object.values(
|
|
229
|
-
const
|
|
121
|
+
}, N = () => {
|
|
122
|
+
const e = Object.values(f.blockStates).map((i) => H(i.recommendationConfigs, f)).filter((i) => i.length > 0).map((i) => {
|
|
123
|
+
const m = i.every((p) => p === P);
|
|
230
124
|
return {
|
|
231
|
-
rule:
|
|
232
|
-
type:
|
|
233
|
-
key:
|
|
125
|
+
rule: a.RecommendationRequiredFields,
|
|
126
|
+
type: m ? c.Warning : c.Error,
|
|
127
|
+
key: m ? Y : V
|
|
234
128
|
};
|
|
235
|
-
}),
|
|
236
|
-
rule:
|
|
237
|
-
type:
|
|
238
|
-
key:
|
|
129
|
+
}), r = (O.recommendationConfigs ?? []).filter((i) => i.filters.some((m) => m.value === "")).map(() => ({
|
|
130
|
+
rule: a.RecommendationFilters,
|
|
131
|
+
type: c.Error,
|
|
132
|
+
key: le
|
|
239
133
|
}));
|
|
240
|
-
return [...e, ...
|
|
241
|
-
},
|
|
242
|
-
var
|
|
243
|
-
const
|
|
244
|
-
...
|
|
245
|
-
...
|
|
246
|
-
...((
|
|
247
|
-
],
|
|
134
|
+
return [...e, ...r];
|
|
135
|
+
}, A = async (e, r) => {
|
|
136
|
+
var S, C;
|
|
137
|
+
const i = [
|
|
138
|
+
...r.map((w) => w.value),
|
|
139
|
+
...M,
|
|
140
|
+
...((C = (S = t.value) == null ? void 0 : S.template) == null ? void 0 : C.customFieldAttributes) ?? []
|
|
141
|
+
], m = B(e), p = await h(m), { isTransactional: g } = T;
|
|
248
142
|
return [
|
|
249
|
-
...await
|
|
250
|
-
...
|
|
251
|
-
...
|
|
252
|
-
...
|
|
253
|
-
...
|
|
254
|
-
...
|
|
255
|
-
...
|
|
256
|
-
...Ge(e),
|
|
257
|
-
...Pe(e),
|
|
258
|
-
...K(),
|
|
259
|
-
...qe(e),
|
|
260
|
-
...R(
|
|
143
|
+
...await v(e),
|
|
144
|
+
...g ? [] : Ie(e, i),
|
|
145
|
+
...be(e),
|
|
146
|
+
...g ? [] : ke(e, i, m, p),
|
|
147
|
+
...Fe(e),
|
|
148
|
+
...N(),
|
|
149
|
+
...k(
|
|
261
150
|
e,
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
151
|
+
U,
|
|
152
|
+
a.CheckboxUnsubGroup,
|
|
153
|
+
me
|
|
265
154
|
),
|
|
266
|
-
...
|
|
155
|
+
...k(
|
|
267
156
|
e,
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
157
|
+
x,
|
|
158
|
+
a.RadioButtonUnsubGroup,
|
|
159
|
+
de
|
|
271
160
|
)
|
|
272
161
|
];
|
|
273
|
-
},
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
162
|
+
}, E = async (e, r, i) => {
|
|
163
|
+
const [m, p] = await Promise.all([
|
|
164
|
+
D(e),
|
|
165
|
+
n("liquidSyntax") ? [] : A(e, r)
|
|
166
|
+
]);
|
|
167
|
+
return m ? [
|
|
168
|
+
...m,
|
|
169
|
+
...n("blockUnsubscribeLinks") ? Ce(i) : [],
|
|
170
|
+
...p
|
|
171
|
+
].map(L) : null;
|
|
172
|
+
};
|
|
173
|
+
return { collectSaveValidationErrors: E, validateCurrentTemplate: async () => {
|
|
174
|
+
const { html: e } = await d();
|
|
175
|
+
await _(e);
|
|
176
|
+
const { html: r } = await o({ minimize: !0, resetDataSavedFlag: !1 }), { compiledHtml: i } = u(r);
|
|
177
|
+
return E(i, R.getSelectedDynamicContentList, e);
|
|
285
178
|
} };
|
|
286
179
|
};
|
|
287
180
|
export {
|
|
288
|
-
|
|
181
|
+
$e as useSaveValidation
|
|
289
182
|
};
|
|
@@ -4,15 +4,20 @@ import memoize from "../node_modules/lodash-es/memoize.js";
|
|
|
4
4
|
import { ref } from "vue";
|
|
5
5
|
import { useConfig } from "./useConfig.js";
|
|
6
6
|
const useTranslations = () => {
|
|
7
|
-
var
|
|
8
|
-
const { config } = useConfig(), translationsPath = ((
|
|
9
|
-
var
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
7
|
+
var s, i;
|
|
8
|
+
const { config } = useConfig(), translationsPath = ((i = (s = config.value) == null ? void 0 : s.editor) == null ? void 0 : i.translationsPath) || DEFAULT_EDITOR.translationsPath, translations = ref(eval(translationsPath)), trans = (t, n) => {
|
|
9
|
+
var a;
|
|
10
|
+
const o = (a = translations.value) == null ? void 0 : a[t];
|
|
11
|
+
if (!o)
|
|
12
|
+
return console.warn(`Translation key not found: ${t}`), t;
|
|
13
|
+
const r = Object.keys(n ?? {}).filter(Boolean).map((e) => e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"));
|
|
14
|
+
if (n && r.length) {
|
|
15
|
+
const e = new RegExp(`{(${r.join("|")})}|:(${r.join("|")})\\b`, "g");
|
|
16
|
+
return o.replace(e, (f, l, c) => String(
|
|
17
|
+
n[l ?? c]
|
|
18
|
+
));
|
|
19
|
+
}
|
|
20
|
+
return o;
|
|
16
21
|
};
|
|
17
22
|
return memoize(
|
|
18
23
|
trans,
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
const E = "/email-proxy", e = {
|
|
2
|
+
HTML_VALIDATE: "/v1/html/validate"
|
|
3
|
+
}, n = {
|
|
4
|
+
BAD_GATEWAY: "bad_gateway",
|
|
5
|
+
BAD_REQUEST: "bad_request",
|
|
6
|
+
CONFLICT: "conflict",
|
|
7
|
+
FORBIDDEN: "forbidden",
|
|
8
|
+
INTERNAL_ERROR: "internal_error",
|
|
9
|
+
NOT_FOUND: "not_found",
|
|
10
|
+
RATE_LIMITED: "rate_limited",
|
|
11
|
+
UNAUTHENTICATED: "unauthenticated",
|
|
12
|
+
VALIDATION_FAILED: "validation_failed",
|
|
13
|
+
SESSION_EXPIRED: "session_expired",
|
|
14
|
+
INVALID_RESPONSE: "invalid_response",
|
|
15
|
+
NETWORK: "network_error",
|
|
16
|
+
TIMEOUT: "timeout",
|
|
17
|
+
UNKNOWN: "unknown"
|
|
18
|
+
}, t = {
|
|
19
|
+
PONGO: "pongo",
|
|
20
|
+
LIQUID: "liquid"
|
|
21
|
+
};
|
|
22
|
+
export {
|
|
23
|
+
E as EMAIL_BE_BASE_URL,
|
|
24
|
+
e as EmailBeEndPoints,
|
|
25
|
+
n as EmailBeErrorCodes,
|
|
26
|
+
t as HtmlSyntax
|
|
27
|
+
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var n = /* @__PURE__ */ ((
|
|
1
|
+
var n = /* @__PURE__ */ ((r) => (r.LinkCheckInProgress = "link-check-in-progress", r.CustomFieldScript = "custom-field-script", r.InvalidDynamicTag = "invalid-dynamic-tag", r.InvalidCustomField = "invalid-custom-field", r.MissingIfEndif = "missing-if-endif", r.RecommendationRequiredFields = "recommendation-required-fields", r.RecommendationFilters = "recommendation-filters", r.CheckboxUnsubGroup = "checkbox-unsub-group", r.RadioButtonUnsubGroup = "radio-button-unsub-group", r.ExternallyManagedUnsubscribe = "externally-managed-unsubscribe", r.EmailBeHtml = "email-be-html", r))(n || {});
|
|
2
2
|
export {
|
|
3
3
|
n as SaveValidationRule
|
|
4
4
|
};
|