@useinsider/guido 3.18.2-beta.ec25841 → 3.18.2-beta.eedafd2
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/README.md +1 -0
- package/dist/@types/config/schemas.js +28 -26
- package/dist/components/Guido.vue.js +6 -6
- package/dist/components/Guido.vue2.js +72 -70
- package/dist/components/organisms/AutoSaveController.vue2.js +9 -8
- package/dist/components/organisms/extensions/recommendation/AssignStrategyDrawer.vue.js +11 -13
- package/dist/components/organisms/extensions/recommendation/AssignStrategyDrawer.vue2.js +52 -70
- package/dist/components/organisms/extensions/recommendation/RemoveStrategyModal.vue2.js +37 -23
- package/dist/components/organisms/header/EditorActions.vue.js +2 -2
- package/dist/components/organisms/header/EditorActions.vue2.js +86 -56
- package/dist/components/organisms/header/LeftSlot.vue.js +5 -5
- package/dist/components/organisms/header/LeftSlot.vue2.js +16 -12
- package/dist/components/organisms/onboarding/OnboardingWrapper.vue2.js +18 -20
- package/dist/components/organisms/save-as-template/SaveAsTemplateDrawer.vue2.js +34 -34
- package/dist/components/organisms/validation/ValidationErrorDrawer.vue.js +20 -0
- package/dist/components/organisms/validation/ValidationErrorDrawer.vue2.js +48 -0
- package/dist/components/wrappers/WpDrawer.vue.js +9 -7
- package/dist/components/wrappers/WpDrawer.vue2.js +1 -1
- package/dist/composables/useCustomInterfaceAppearance.js +46 -56
- package/dist/composables/useHtmlCompiler.js +37 -26
- package/dist/composables/useHtmlValidator.js +81 -84
- package/dist/composables/useHttp.js +24 -22
- package/dist/composables/useRecommendation.js +35 -40
- package/dist/composables/useSave.js +90 -45
- package/dist/composables/useSaveValidation.js +279 -0
- package/dist/composables/useSaveValidationRollout.js +9 -0
- package/dist/composables/useStripo.js +30 -30
- package/dist/composables/validators/useCouponBlockValidator.js +24 -21
- package/dist/composables/validators/useUnsubscribeBlockValidator.js +34 -27
- package/dist/enums/extensions/recommendationBlock.js +31 -38
- package/dist/enums/save-validation.js +4 -0
- package/dist/extensions/Blocks/Recommendation/block.js +39 -43
- package/dist/extensions/Blocks/Recommendation/constants/defaultConfig.js +20 -21
- package/dist/extensions/Blocks/Recommendation/controls/main/index.js +33 -38
- package/dist/extensions/Blocks/Recommendation/controls/main/strategy.js +52 -84
- package/dist/extensions/Blocks/Recommendation/store/recommendation.js +78 -168
- package/dist/extensions/Blocks/Recommendation/validation/requiredFields.js +12 -21
- package/dist/guido.css +1 -1
- package/dist/services/templateLibraryApi.js +17 -14
- package/dist/src/@types/config/schemas.d.ts +4 -0
- package/dist/src/@types/save-validation.d.ts +19 -0
- package/dist/src/components/Guido.vue.d.ts +17 -1
- package/dist/src/components/organisms/header/EditorActions.vue.d.ts +17 -1
- package/dist/src/components/organisms/header/HeaderWrapper.vue.d.ts +17 -1
- package/dist/src/components/organisms/header/RightSlot.vue.d.ts +17 -1
- package/dist/src/components/wrappers/WpDrawer.vue.d.ts +4 -3
- package/dist/src/composables/useConfig.d.ts +2 -0
- package/dist/src/composables/useHtmlValidator.d.ts +21 -0
- package/dist/src/composables/useSave.d.ts +6 -1
- package/dist/src/composables/useSaveValidation.d.ts +6 -0
- package/dist/src/composables/useSaveValidationRollout.d.ts +3 -0
- package/dist/src/composables/validators/useCouponBlockValidator.d.ts +3 -0
- package/dist/src/composables/validators/useUnsubscribeBlockValidator.d.ts +10 -0
- package/dist/src/enums/extensions/recommendationBlock.d.ts +0 -2
- package/dist/src/enums/save-validation.d.ts +27 -0
- package/dist/src/extensions/Blocks/Recommendation/constants/defaultConfig.d.ts +0 -1
- package/dist/src/extensions/Blocks/Recommendation/constants/index.d.ts +1 -1
- package/dist/src/extensions/Blocks/Recommendation/controls/main/index.d.ts +0 -2
- package/dist/src/extensions/Blocks/Recommendation/controls/main/strategy.d.ts +0 -9
- package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +3 -73
- package/dist/src/extensions/Blocks/Recommendation/validation/requiredFields.d.ts +0 -4
- package/dist/src/stores/config.d.ts +30 -0
- package/dist/src/stores/onboarding.d.ts +0 -377
- package/dist/src/stores/save-validation.d.ts +22 -0
- package/dist/src/utils/genericUtil.d.ts +6 -0
- package/dist/src/utils/liquidDynamicContent.d.ts +20 -0
- package/dist/src/utils/templatePreparation.d.ts +30 -0
- package/dist/static/styles/components/recommendation-strategy.css.js +4 -34
- package/dist/stores/config.js +39 -22
- package/dist/stores/onboarding.js +36 -41
- package/dist/stores/save-validation.js +30 -0
- package/dist/utils/genericUtil.js +63 -54
- package/dist/utils/liquidDynamicContent.js +15 -0
- package/dist/utils/templatePreparation.js +63 -59
- package/package.json +1 -1
- package/dist/components/organisms/onboarding/RecommendationStrategyOnboarding.vue.js +0 -21
- package/dist/components/organisms/onboarding/RecommendationStrategyOnboarding.vue2.js +0 -47
- package/dist/extensions/Blocks/Recommendation/utils/strategyDetach.js +0 -19
- package/dist/src/extensions/Blocks/Recommendation/utils/strategyDetach.d.ts +0 -12
- package/dist/static/styles/components/skeleton.css.js +0 -23
- /package/dist/src/components/organisms/{onboarding/RecommendationStrategyOnboarding.vue.d.ts → validation/ValidationErrorDrawer.vue.d.ts} +0 -0
|
@@ -1,55 +1,100 @@
|
|
|
1
|
-
import { useActionsApi as
|
|
1
|
+
import { useActionsApi as W } from "./useActionsApi.js";
|
|
2
2
|
import { useConfig as q } from "./useConfig.js";
|
|
3
|
-
import { useEditorLock as
|
|
4
|
-
import { useSaveStart as
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
if (
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
return;
|
|
28
|
-
if (
|
|
3
|
+
import { useEditorLock as O } from "./useEditorLock.js";
|
|
4
|
+
import { useSaveStart as D, useSaveComplete as F } from "./useGuidoActions.js";
|
|
5
|
+
import { useSaveValidation as j } from "./useSaveValidation.js";
|
|
6
|
+
import { useSaveValidationRollout as z } from "./useSaveValidationRollout.js";
|
|
7
|
+
import { useSyncModuleExtractor as G } from "./useSyncModuleExtractor.js";
|
|
8
|
+
import { ToasterTypeOptions as I } from "../enums/toaster.js";
|
|
9
|
+
import { useStripoApi as J } from "../services/stripoApi.js";
|
|
10
|
+
import { useConfigStore as K } from "../stores/config.js";
|
|
11
|
+
import { useDynamicContentStore as N } from "../stores/dynamic-content.js";
|
|
12
|
+
import { useSaveValidationStore as Q } from "../stores/save-validation.js";
|
|
13
|
+
import { useTemplatePreparation as X, getHtmlReferencedUnsubscribePages as Y } from "../utils/templatePreparation.js";
|
|
14
|
+
import { useAllowlist as Z } from "./useAllowlist.js";
|
|
15
|
+
import { useHtmlValidator as _ } from "./useHtmlValidator.js";
|
|
16
|
+
import { useToaster as $ } from "./useToaster.js";
|
|
17
|
+
import { useCouponBlockValidator as tt } from "./validators/useCouponBlockValidator.js";
|
|
18
|
+
import { useLiquidValidator as et } from "./validators/useLiquidValidator.js";
|
|
19
|
+
import { useSyncModuleBlockValidator as ot } from "./validators/useSyncModuleBlockValidator.js";
|
|
20
|
+
import { useUnsubscribeBlockValidator as st } from "./validators/useUnsubscribeBlockValidator.js";
|
|
21
|
+
const Bt = () => {
|
|
22
|
+
const r = D(), f = F(), { validateHtml: p } = _(), { validateLiquidSyntax: v } = et(), { validateCouponBlockTags: y } = tt(), { validateUnsubscribeBlockUniqueness: S, validateUnsubscribeBlockHasTemplate: w } = st(), { validateSyncModuleBlocks: u } = ot(), { callbacks: a, isFeatureEnabled: m } = q(), { extractSyncModuleData: b } = G(), { setSyncModuleUnsubscriptionPages: g } = J(), { editorSave: E, getTemplateData: H } = W(), { showToaster: V } = $(), { getBlockedDomains: x, resolveToast: k } = Z(), { prepareTemplateDetails: d } = X(), { collectSaveValidationErrors: C } = j(), { isEnabled: B } = z(), T = Q(), h = N(), P = K(), { runExclusive: n } = O(), l = async (t, e, o) => {
|
|
23
|
+
if (!m("allowlistEnabled"))
|
|
24
|
+
return !1;
|
|
25
|
+
const i = await x(t, e);
|
|
26
|
+
if (!i.length)
|
|
27
|
+
return !1;
|
|
28
|
+
if (!o) {
|
|
29
|
+
const s = await k(i);
|
|
30
|
+
s != null && s.message && V({
|
|
31
|
+
type: I.Warning,
|
|
32
|
+
message: s.message,
|
|
33
|
+
actionButton: s.actionButton
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
return !0;
|
|
37
|
+
}, L = async (t) => !y(t.compiledHtml) || !S(t.compiledHtml) || !w(t.compiledHtml) ? !1 : m("liquidSyntax") ? v(t.compiledHtml) : p(t.compiledHtml, t.dynamicContentList, !0), c = async (t, e) => {
|
|
38
|
+
if (!await E())
|
|
29
39
|
return;
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
+
const { unsubscribePayload: i, stripoModules: s } = b(t.rawHtml);
|
|
41
|
+
if (await g(i), t.modules = s, !e.suppress) {
|
|
42
|
+
const R = e.blankCompiled ? { compiledHtml: "", ampHtml: "" } : {};
|
|
43
|
+
f({ ...t, ...R, silent: e.silent });
|
|
44
|
+
}
|
|
45
|
+
return t;
|
|
46
|
+
}, U = async (t, e) => {
|
|
47
|
+
var i;
|
|
48
|
+
r();
|
|
49
|
+
const o = await d();
|
|
50
|
+
if (u(o.rawHtml, e)) {
|
|
51
|
+
if (B.value && !e) {
|
|
52
|
+
const s = await C(
|
|
53
|
+
o.compiledHtml,
|
|
54
|
+
o.dynamicContentList
|
|
55
|
+
);
|
|
56
|
+
if (s.length) {
|
|
57
|
+
T.open(s, "save");
|
|
58
|
+
return;
|
|
40
59
|
}
|
|
60
|
+
} else if (!await L(o))
|
|
41
61
|
return;
|
|
42
|
-
|
|
62
|
+
if (!((i = a.value) != null && i.externalValidation && !await a.value.externalValidation(o)) && !await l(o.compiledHtml, o.css, e))
|
|
63
|
+
return c(o, { silent: e, suppress: t });
|
|
43
64
|
}
|
|
44
|
-
|
|
65
|
+
}, A = async () => {
|
|
66
|
+
var e;
|
|
67
|
+
if (!P.allowSaveWithErrors)
|
|
45
68
|
return;
|
|
46
|
-
|
|
47
|
-
|
|
69
|
+
r();
|
|
70
|
+
const t = await d();
|
|
71
|
+
if (!((e = a.value) != null && e.externalValidation && !await a.value.externalValidation(t)) && !await l(t.compiledHtml, t.css, !1))
|
|
72
|
+
return c(t, { silent: !1, blankCompiled: !0 });
|
|
73
|
+
}, M = async () => {
|
|
74
|
+
r();
|
|
75
|
+
const { html: t, css: e } = await H();
|
|
76
|
+
if (!u(t, !0) || await l(t, e, !0))
|
|
77
|
+
return;
|
|
78
|
+
const o = Y(t), i = {
|
|
79
|
+
dynamicContentList: h.getSelectedDynamicContentList,
|
|
80
|
+
compiledHtml: "",
|
|
81
|
+
rawHtml: t,
|
|
82
|
+
css: e,
|
|
83
|
+
ampHtml: "",
|
|
84
|
+
ampErrors: [],
|
|
85
|
+
modules: [],
|
|
86
|
+
recommendation: { campaignUrls: {}, configs: {} },
|
|
87
|
+
unsubscribe: {
|
|
88
|
+
status: o.length > 0,
|
|
89
|
+
config: o
|
|
90
|
+
}
|
|
91
|
+
};
|
|
92
|
+
return c(i, { silent: !0 });
|
|
48
93
|
};
|
|
49
|
-
return { save: (
|
|
50
|
-
() =>
|
|
51
|
-
) };
|
|
94
|
+
return { save: (t = !1, e = !1) => n(
|
|
95
|
+
() => U(t, e)
|
|
96
|
+
), saveWithErrors: () => n(A), saveRawOnly: () => n(M) };
|
|
52
97
|
};
|
|
53
98
|
export {
|
|
54
|
-
|
|
99
|
+
Bt as useSave
|
|
55
100
|
};
|
|
@@ -0,0 +1,279 @@
|
|
|
1
|
+
import { getIgnoredRecommendationBlockIds as B } from "../config/compiler/utils/recommendationIgnoreUtils.js";
|
|
2
|
+
import { CanNotMakeAnyChangesForRunningKey as k, DISPLAY_CONDITIONS_REGEX as Y, DISPLAY_CONDITIONS_EXCEPTIONS_REGEX as x } from "../enums/html-validator.js";
|
|
3
|
+
import { SaveValidationRule as o } from "../enums/save-validation.js";
|
|
4
|
+
import { ToasterTypeOptions as r } from "../enums/toaster.js";
|
|
5
|
+
import { BLOCK_ROOT_SELECTOR as U } from "../extensions/Blocks/Checkbox/constants/selectors.js";
|
|
6
|
+
import { itemsBlockDynamicVariables as M } from "../extensions/Blocks/Items/enums/productEnums.js";
|
|
7
|
+
import { BLOCK_ROOT_SELECTOR as P } from "../extensions/Blocks/RadioButton/constants/selectors.js";
|
|
8
|
+
import { useRecommendationExtensionStore as W } from "../extensions/Blocks/Recommendation/store/recommendation.js";
|
|
9
|
+
import { RecommendationRequiredFieldsKey as G } from "../extensions/Blocks/Recommendation/validation/requiredFields.js";
|
|
10
|
+
import { useConfigStore as q } from "../stores/config.js";
|
|
11
|
+
import { useDynamicContentStore as H } from "../stores/dynamic-content.js";
|
|
12
|
+
import { useRecommendationStore as V } from "../stores/recommendation.js";
|
|
13
|
+
import { base64EncodeWithSpecialChars as T } from "../utils/base64.js";
|
|
14
|
+
import { useTemplatePreparation as X } from "../utils/templatePreparation.js";
|
|
15
|
+
import { useActionsApi as j } from "./useActionsApi.js";
|
|
16
|
+
import { useConfig as z } from "./useConfig.js";
|
|
17
|
+
import { useHtmlCompiler as $ } from "./useHtmlCompiler.js";
|
|
18
|
+
import { buildPartnerAttributeNameSet as Q, getInvalidDynamicContentTags as Z, getRecommendationBlockIds as J, findInvalidCustomFields as tt } from "./useHtmlValidator.js";
|
|
19
|
+
import { useHttp as et } from "./useHttp.js";
|
|
20
|
+
import { useTranslations as nt } from "./useTranslations.js";
|
|
21
|
+
import { findInvalidCouponBlocks as it, COUPON_TAG_MODIFIED_KEY as ot } from "./validators/useCouponBlockValidator.js";
|
|
22
|
+
import { findDuplicateUnsubPageTypes as rt, countUnsubBlocksWithoutPage as st, EMPTY_BLOCK_KEY as at } from "./validators/useUnsubscribeBlockValidator.js";
|
|
23
|
+
const ct = "newsletter.html-content-is-empty", lt = "custom-fields.missing-closing-braces", ut = "custom-fields.missing-opening-braces", I = "custom-fields.invalid-custom-fields", mt = "newsletter.display-conditions-invalid-syntax", dt = "custom-conditions.wrong-equality-operators", pt = "custom-conditions.missing-if-endif-tag", gt = "custom-conditions.no-space-after-braces", ft = "custom-conditions.no-braces-inside-if-tag", yt = "newsletter.fill-all-necessary-fields", Et = "newsletter.invalid-image-type", It = "unsubscribe-templates.select-checkbox-groups", St = "unsubscribe-templates.select-radio-button-groups", Ct = "newsletter.invalid-url-link-for-toaster", F = "journey-builder.liquid-validation-failed", _t = "/newsletter/template-library/check-template-html-body", ht = /src="[^"]*\.(svg|pst)"/gm, R = /({%(.*?)%})/g, kt = ["if", "endif", "else", "elif", "now"], Tt = (e) => !kt.includes(e.toLowerCase()), Ft = (e) => ["if", "endif"].includes(e.toLowerCase());
|
|
24
|
+
function Ot(e) {
|
|
25
|
+
return it(e).map((i) => ({
|
|
26
|
+
rule: o.CouponTagModified,
|
|
27
|
+
type: r.Warning,
|
|
28
|
+
key: ot,
|
|
29
|
+
detail: i
|
|
30
|
+
}));
|
|
31
|
+
}
|
|
32
|
+
function Rt(e) {
|
|
33
|
+
return rt(e).map((i) => ({
|
|
34
|
+
rule: o.DuplicateUnsubBlock,
|
|
35
|
+
type: r.Error,
|
|
36
|
+
key: i.messageKey
|
|
37
|
+
}));
|
|
38
|
+
}
|
|
39
|
+
function Lt(e) {
|
|
40
|
+
return Array.from({ length: st(e) }, () => ({
|
|
41
|
+
rule: o.UnsubBlockMissingTemplate,
|
|
42
|
+
type: r.Warning,
|
|
43
|
+
key: at
|
|
44
|
+
}));
|
|
45
|
+
}
|
|
46
|
+
function Nt(e, i) {
|
|
47
|
+
const n = e.match(R);
|
|
48
|
+
if (!n)
|
|
49
|
+
return [];
|
|
50
|
+
const a = [];
|
|
51
|
+
return n.forEach((u) => {
|
|
52
|
+
const s = u.slice(2, -2).trim().match(/(".*?"|[^"\s]+)(?=\s*|\s*$)/g);
|
|
53
|
+
if (s && s.length > 0) {
|
|
54
|
+
const [m] = s;
|
|
55
|
+
Tt(m) && !i.includes(m) && a.push({
|
|
56
|
+
rule: o.CustomFieldScript,
|
|
57
|
+
type: r.Warning,
|
|
58
|
+
key: I,
|
|
59
|
+
detail: m
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
}), a;
|
|
63
|
+
}
|
|
64
|
+
function bt(e) {
|
|
65
|
+
return e.length > 0 ? [] : [{ rule: o.EmptyHtml, type: r.Warning, key: ct }];
|
|
66
|
+
}
|
|
67
|
+
function At(e) {
|
|
68
|
+
const i = (e.match(/{/gm) || []).length, n = (e.match(/}/gm) || []).length;
|
|
69
|
+
return i > n ? [{
|
|
70
|
+
rule: o.MismatchedBraces,
|
|
71
|
+
type: r.Warning,
|
|
72
|
+
key: lt
|
|
73
|
+
}] : i < n ? [{
|
|
74
|
+
rule: o.MismatchedBraces,
|
|
75
|
+
type: r.Warning,
|
|
76
|
+
key: ut
|
|
77
|
+
}] : [];
|
|
78
|
+
}
|
|
79
|
+
function Dt(e) {
|
|
80
|
+
return Z(e).map((i) => ({
|
|
81
|
+
rule: o.InvalidDynamicTag,
|
|
82
|
+
type: r.Warning,
|
|
83
|
+
key: I,
|
|
84
|
+
detail: i
|
|
85
|
+
}));
|
|
86
|
+
}
|
|
87
|
+
function vt(e, i, n, a) {
|
|
88
|
+
const u = J(e);
|
|
89
|
+
return tt(e, i, u, n, a).map((s) => ({
|
|
90
|
+
rule: o.InvalidCustomField,
|
|
91
|
+
type: r.Error,
|
|
92
|
+
key: I,
|
|
93
|
+
detail: s
|
|
94
|
+
}));
|
|
95
|
+
}
|
|
96
|
+
function Kt(e) {
|
|
97
|
+
const i = e.match(/{%(.*?)%}/g), n = [], a = [];
|
|
98
|
+
if (i && i.forEach((u) => {
|
|
99
|
+
const s = u.match(Y), m = u.match(x), y = (s == null ? void 0 : s.join("")) || "";
|
|
100
|
+
(!s || u !== y) && !m && a.push({
|
|
101
|
+
rule: o.ConditionsSyntax,
|
|
102
|
+
type: r.Error,
|
|
103
|
+
key: mt,
|
|
104
|
+
detail: u
|
|
105
|
+
}), s && s.forEach((g) => {
|
|
106
|
+
g.trim() === "=" && a.push({
|
|
107
|
+
rule: o.WrongEqualityOperator,
|
|
108
|
+
type: r.Error,
|
|
109
|
+
key: dt
|
|
110
|
+
}), (g.match(/^[a-zA-Z]*$/g) ?? []).forEach((f) => {
|
|
111
|
+
Ft(f) && n.push(f);
|
|
112
|
+
});
|
|
113
|
+
});
|
|
114
|
+
}), n.length) {
|
|
115
|
+
const u = n.filter((m) => m === "if").length, s = n.filter((m) => m === "endif").length;
|
|
116
|
+
u !== s && a.push({
|
|
117
|
+
rule: o.MissingIfEndif,
|
|
118
|
+
type: r.Error,
|
|
119
|
+
key: pt
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
return a;
|
|
123
|
+
}
|
|
124
|
+
function wt(e) {
|
|
125
|
+
const i = (e.match(/{% /gm) || []).length, n = (e.match(/ %}/gm) || []).length;
|
|
126
|
+
return i === n ? [] : [{
|
|
127
|
+
rule: o.ConditionTagSpacing,
|
|
128
|
+
type: r.Warning,
|
|
129
|
+
key: gt
|
|
130
|
+
}];
|
|
131
|
+
}
|
|
132
|
+
function Bt(e) {
|
|
133
|
+
return (e.match(R) || []).filter((n) => n.includes("if")).map((n) => (n.match(/{{.*}}/gm) || []).length).reduce((n, a) => n + a, 0) === 0 ? [] : [{
|
|
134
|
+
rule: o.BracesInsideIfTag,
|
|
135
|
+
type: r.Warning,
|
|
136
|
+
key: ft
|
|
137
|
+
}];
|
|
138
|
+
}
|
|
139
|
+
function Yt(e) {
|
|
140
|
+
return (e.match(ht) ?? []).map((i) => ({
|
|
141
|
+
rule: o.InvalidImageType,
|
|
142
|
+
type: r.Error,
|
|
143
|
+
key: Et,
|
|
144
|
+
detail: i
|
|
145
|
+
}));
|
|
146
|
+
}
|
|
147
|
+
function O(e, i, n, a) {
|
|
148
|
+
const u = new DOMParser().parseFromString(e, "text/html");
|
|
149
|
+
return Array.from(u.querySelectorAll(i)).filter((s) => {
|
|
150
|
+
var m;
|
|
151
|
+
return !((m = s.id) != null && m.trim());
|
|
152
|
+
}).map(() => ({ rule: n, type: r.Error, key: a }));
|
|
153
|
+
}
|
|
154
|
+
const ae = () => {
|
|
155
|
+
const { config: e, isFeatureEnabled: i } = z(), n = nt(), { post: a } = et(), { getCompiledEmail: u, getTemplateData: s } = j(), { compileHtml: m } = $(), { hydrateRecommendationStore: y } = X(), g = H(), f = V(), E = W(), L = q(), N = (t) => ({
|
|
156
|
+
rule: t.rule,
|
|
157
|
+
type: t.type,
|
|
158
|
+
detail: t.detail,
|
|
159
|
+
message: "key" in t ? n(t.key) : t.message
|
|
160
|
+
}), b = async (t) => {
|
|
161
|
+
if (t.size === 0)
|
|
162
|
+
return /* @__PURE__ */ new Set();
|
|
163
|
+
try {
|
|
164
|
+
await E.fetchRecommendationFilters();
|
|
165
|
+
} catch {
|
|
166
|
+
return null;
|
|
167
|
+
}
|
|
168
|
+
return Q(E.filterList);
|
|
169
|
+
}, A = async (t) => {
|
|
170
|
+
try {
|
|
171
|
+
const l = await a(_t, { html: T(t) }), { status: c, message: d } = l.data, p = [];
|
|
172
|
+
return c || p.push({
|
|
173
|
+
rule: o.InvalidLinks,
|
|
174
|
+
type: r.Error,
|
|
175
|
+
// status===undefined means a bare message instead of a boolean; surface it,
|
|
176
|
+
// but fall back to the canned key when it's missing so a malformed body
|
|
177
|
+
// never renders a literal 'undefined' row (SD-147430).
|
|
178
|
+
...c === void 0 && d ? { message: d } : { key: Ct }
|
|
179
|
+
}), d === n(k) && p.push({
|
|
180
|
+
rule: o.LinkCheckInProgress,
|
|
181
|
+
type: r.Error,
|
|
182
|
+
key: k
|
|
183
|
+
}), p;
|
|
184
|
+
} catch (l) {
|
|
185
|
+
return console.warn("Link-check collector failed; skipping the link rule.", l), [];
|
|
186
|
+
}
|
|
187
|
+
}, D = async (t) => {
|
|
188
|
+
try {
|
|
189
|
+
const l = await a("/newsletter/contents/validate-syntax", [{
|
|
190
|
+
identifier: "default",
|
|
191
|
+
syntax: "liquid",
|
|
192
|
+
contents: {
|
|
193
|
+
subject: null,
|
|
194
|
+
preheader: null,
|
|
195
|
+
html: T(t),
|
|
196
|
+
ampHtml: null
|
|
197
|
+
}
|
|
198
|
+
}]);
|
|
199
|
+
if (!Array.isArray(l.data)) {
|
|
200
|
+
const d = l.data;
|
|
201
|
+
return [{
|
|
202
|
+
rule: o.LiquidSyntax,
|
|
203
|
+
type: r.Warning,
|
|
204
|
+
message: d.message ?? n(F)
|
|
205
|
+
}];
|
|
206
|
+
}
|
|
207
|
+
const [c] = l.data;
|
|
208
|
+
return Object.values((c == null ? void 0 : c.errors) ?? {}).map((d) => ({
|
|
209
|
+
rule: o.LiquidSyntax,
|
|
210
|
+
type: r.Warning,
|
|
211
|
+
message: d.replace(/^line \d+:\s*/, "")
|
|
212
|
+
}));
|
|
213
|
+
} catch {
|
|
214
|
+
return [{
|
|
215
|
+
rule: o.LiquidSyntax,
|
|
216
|
+
type: r.Error,
|
|
217
|
+
message: n(F)
|
|
218
|
+
}];
|
|
219
|
+
}
|
|
220
|
+
}, v = () => {
|
|
221
|
+
const t = E.invalidBlockIds().map((c) => ({
|
|
222
|
+
rule: o.RecommendationRequiredFields,
|
|
223
|
+
type: r.Error,
|
|
224
|
+
key: G,
|
|
225
|
+
detail: c
|
|
226
|
+
})), l = (f.recommendationConfigs ?? []).filter((c) => c.filters.some((d) => d.value === "")).map(() => ({
|
|
227
|
+
rule: o.RecommendationFilters,
|
|
228
|
+
type: r.Error,
|
|
229
|
+
key: yt
|
|
230
|
+
}));
|
|
231
|
+
return [...t, ...l];
|
|
232
|
+
}, K = async (t, l) => {
|
|
233
|
+
var _, h;
|
|
234
|
+
const c = [
|
|
235
|
+
...l.map((w) => w.value),
|
|
236
|
+
...M,
|
|
237
|
+
...((h = (_ = e.value) == null ? void 0 : _.template) == null ? void 0 : h.customFieldAttributes) ?? []
|
|
238
|
+
], d = B(t), p = await b(d), { isTransactional: C } = L;
|
|
239
|
+
return [
|
|
240
|
+
...await A(t),
|
|
241
|
+
...C ? [] : Nt(t, c),
|
|
242
|
+
...bt(t),
|
|
243
|
+
...At(t),
|
|
244
|
+
...Dt(t),
|
|
245
|
+
...C ? [] : vt(t, c, d, p),
|
|
246
|
+
...Kt(t),
|
|
247
|
+
...wt(t),
|
|
248
|
+
...Bt(t),
|
|
249
|
+
...v(),
|
|
250
|
+
...Yt(t),
|
|
251
|
+
...O(
|
|
252
|
+
t,
|
|
253
|
+
U,
|
|
254
|
+
o.CheckboxUnsubGroup,
|
|
255
|
+
It
|
|
256
|
+
),
|
|
257
|
+
...O(
|
|
258
|
+
t,
|
|
259
|
+
P,
|
|
260
|
+
o.RadioButtonUnsubGroup,
|
|
261
|
+
St
|
|
262
|
+
)
|
|
263
|
+
];
|
|
264
|
+
}, S = async (t, l) => [
|
|
265
|
+
...Ot(t),
|
|
266
|
+
...Rt(t),
|
|
267
|
+
...Lt(t),
|
|
268
|
+
...i("liquidSyntax") ? await D(t) : await K(t, l)
|
|
269
|
+
].map(N);
|
|
270
|
+
return { collectSaveValidationErrors: S, validateCurrentTemplate: async () => {
|
|
271
|
+
const { html: t } = await s();
|
|
272
|
+
await y(t);
|
|
273
|
+
const { html: l } = await u({ minimize: !0, resetDataSavedFlag: !1 }), { compiledHtml: c } = m(l);
|
|
274
|
+
return S(c, g.getSelectedDynamicContentList);
|
|
275
|
+
} };
|
|
276
|
+
};
|
|
277
|
+
export {
|
|
278
|
+
ae as useSaveValidation
|
|
279
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { useConfigStore as t } from "../stores/config.js";
|
|
2
|
+
import { computed as o } from "vue";
|
|
3
|
+
const n = ["newsletteruatcamp", "newsletterqacamp"], c = () => {
|
|
4
|
+
const e = t();
|
|
5
|
+
return { isEnabled: o(() => n.includes(e.partnerName)) };
|
|
6
|
+
};
|
|
7
|
+
export {
|
|
8
|
+
c as useSaveValidationRollout
|
|
9
|
+
};
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import { useActionsApi as
|
|
2
|
-
import { useBlocksConfig as
|
|
3
|
-
import { useConfig as
|
|
4
|
-
import { useCustomInterfaceAppearance as
|
|
1
|
+
import { useActionsApi as L } from "./useActionsApi.js";
|
|
2
|
+
import { useBlocksConfig as O } from "./useBlocksConfig.js";
|
|
3
|
+
import { useConfig as q } from "./useConfig.js";
|
|
4
|
+
import { useCustomInterfaceAppearance as H } from "./useCustomInterfaceAppearance.js";
|
|
5
5
|
import { useFullStoryBridge as N } from "./useFullStoryBridge.js";
|
|
6
6
|
import { useModuleRepair as j } from "./useModuleRepair.js";
|
|
7
7
|
import { useStripoEventHandler as z } from "./useStripoEventHandler.js";
|
|
8
8
|
import { useStripoNotifications as $ } from "./useStripoNotifications.js";
|
|
9
9
|
import { useToaster as G } from "./useToaster.js";
|
|
10
10
|
import { localePatch as J } from "../config/i18n/index.js";
|
|
11
|
-
import { en as
|
|
11
|
+
import { en as w } from "../config/i18n/en/index.js";
|
|
12
12
|
import { ToasterTypeOptions as X } from "../enums/toaster.js";
|
|
13
13
|
import { useStripoApi as K } from "../services/stripoApi.js";
|
|
14
14
|
import Q from "../static/styles/customEditorStyle.css.js";
|
|
15
|
-
import { useEditorStore as
|
|
15
|
+
import { useEditorStore as b } from "../stores/editor.js";
|
|
16
16
|
import { buildMergeTagEntries as W, flattenDynamicContentList as Y } from "../utils/genericUtil.js";
|
|
17
17
|
import Z from "../package.json.js";
|
|
18
18
|
let n = null;
|
|
19
|
-
const
|
|
20
|
-
const { features: c, template: u, isFeatureEnabled: m } =
|
|
19
|
+
const Ce = () => {
|
|
20
|
+
const { features: c, template: u, isFeatureEnabled: m } = q(), { handleError: p, showToaster: k } = G(), { getToken: B, getCustomFonts: M, getSyncModulesStatus: T } = K(), { handleEvent: v } = z(), { handleModuleAdd: F } = j(), { getStripoBlocksConfig: A } = O(), { getStripoNotifications: V } = $(), f = () => n || (n = new Promise((i, s) => {
|
|
21
21
|
var d;
|
|
22
22
|
if (document.getElementById("UiEditorScript")) {
|
|
23
23
|
i();
|
|
@@ -29,16 +29,16 @@ const he = () => {
|
|
|
29
29
|
}, document.body.appendChild(e);
|
|
30
30
|
}), n.catch(() => {
|
|
31
31
|
n = null;
|
|
32
|
-
}), n),
|
|
32
|
+
}), n), _ = async (i, s, o, a = [], r = !1) => {
|
|
33
33
|
var y, E, h, C;
|
|
34
|
-
const e =
|
|
35
|
-
|
|
34
|
+
const e = b(), { html: d, css: D } = i, { baseBlocks: g, extensions: R } = await A(), S = ((y = c.value) == null ? void 0 : y.displayConditions) ?? !0, P = ((E = c.value) == null ? void 0 : E.modulesDisabled) ?? !1, U = !!d || (((h = u.value) == null ? void 0 : h.forceRecreate) ?? !1);
|
|
35
|
+
await window.UIEditor.initEditor(
|
|
36
36
|
document.querySelector("#guido-editor"),
|
|
37
37
|
{
|
|
38
38
|
metadata: s,
|
|
39
39
|
html: d,
|
|
40
|
-
css:
|
|
41
|
-
forceRecreate:
|
|
40
|
+
css: D,
|
|
41
|
+
forceRecreate: U,
|
|
42
42
|
locale: "en",
|
|
43
43
|
undoButtonSelector: "#guido__undo-button",
|
|
44
44
|
redoButtonSelector: "#guido__redo-button",
|
|
@@ -52,7 +52,7 @@ const he = () => {
|
|
|
52
52
|
conditionsEnabled: S,
|
|
53
53
|
customConditionsEnabled: S,
|
|
54
54
|
enableXSSSecurity: !0,
|
|
55
|
-
modulesDisabled:
|
|
55
|
+
modulesDisabled: P,
|
|
56
56
|
syncModulesEnabled: r,
|
|
57
57
|
messageSettingsEnabled: !0,
|
|
58
58
|
displayGmailAnnotations: !0,
|
|
@@ -62,7 +62,7 @@ const he = () => {
|
|
|
62
62
|
displayUTM: !1,
|
|
63
63
|
selectElementAfterDrop: !0,
|
|
64
64
|
sameFontSizeForOutlook: !0,
|
|
65
|
-
allowedScriptSourceDomains:
|
|
65
|
+
allowedScriptSourceDomains: "https://email-static.useinsider.com https://edge.fullstory.com https://rs.fullstory.com",
|
|
66
66
|
...g ? { baseBlocks: g } : {},
|
|
67
67
|
editorFonts: {
|
|
68
68
|
showDefaultStandardFonts: !0,
|
|
@@ -80,7 +80,7 @@ const he = () => {
|
|
|
80
80
|
],
|
|
81
81
|
async onTokenRefreshRequest(t) {
|
|
82
82
|
try {
|
|
83
|
-
const l = await
|
|
83
|
+
const l = await B();
|
|
84
84
|
t(l);
|
|
85
85
|
} catch (l) {
|
|
86
86
|
p(l, "Failed to refresh token");
|
|
@@ -88,8 +88,8 @@ const he = () => {
|
|
|
88
88
|
},
|
|
89
89
|
onTemplateLoaded() {
|
|
90
90
|
try {
|
|
91
|
-
const {
|
|
92
|
-
|
|
91
|
+
const { importCss: t } = H(), { activateCustomViewStyles: l, updateTimerInClonedTemplate: I } = L(), { injectFullStory: x } = N();
|
|
92
|
+
t(), l(), x(), I(), o.onReady(), e.isStripoInitialized = !0, e.loadingStatus = !1, setTimeout(() => {
|
|
93
93
|
e.hasChanges = !1;
|
|
94
94
|
}, 1e3);
|
|
95
95
|
} catch (t) {
|
|
@@ -108,34 +108,34 @@ const he = () => {
|
|
|
108
108
|
onDataChanged() {
|
|
109
109
|
e.hasChanges = !0;
|
|
110
110
|
},
|
|
111
|
-
onEvent:
|
|
112
|
-
onModuleAdd:
|
|
113
|
-
notifications:
|
|
111
|
+
onEvent: v,
|
|
112
|
+
onModuleAdd: F,
|
|
113
|
+
notifications: V(),
|
|
114
114
|
ignoreClickOutsideSelectors: [
|
|
115
115
|
"#guido-dynamic-content-modal",
|
|
116
116
|
".in-on-board-wrapper",
|
|
117
117
|
".in-drawer__container"
|
|
118
118
|
],
|
|
119
|
-
extensions:
|
|
119
|
+
extensions: R,
|
|
120
120
|
localePatch: J
|
|
121
121
|
}
|
|
122
122
|
);
|
|
123
123
|
};
|
|
124
124
|
return { initPlugin: async (i, s, o) => {
|
|
125
|
-
const a =
|
|
125
|
+
const a = b();
|
|
126
126
|
try {
|
|
127
127
|
await f();
|
|
128
128
|
const [r, e] = await Promise.all([
|
|
129
|
-
|
|
130
|
-
|
|
129
|
+
M(),
|
|
130
|
+
T()
|
|
131
131
|
]);
|
|
132
|
-
a.syncModulesEnabled = e, await
|
|
132
|
+
a.syncModulesEnabled = e, await _(i, s, o, r, e);
|
|
133
133
|
} catch {
|
|
134
|
-
a.loadingStatus = !1,
|
|
134
|
+
a.loadingStatus = !1, k({
|
|
135
135
|
type: X.Error,
|
|
136
|
-
message:
|
|
136
|
+
message: w["An error has occurred. Please report the error code to support."],
|
|
137
137
|
actionButton: {
|
|
138
|
-
text:
|
|
138
|
+
text: w["Reload page"],
|
|
139
139
|
onClick: () => window.location.reload()
|
|
140
140
|
}
|
|
141
141
|
});
|
|
@@ -146,5 +146,5 @@ const he = () => {
|
|
|
146
146
|
} };
|
|
147
147
|
};
|
|
148
148
|
export {
|
|
149
|
-
|
|
149
|
+
Ce as useStripo
|
|
150
150
|
};
|
|
@@ -1,24 +1,27 @@
|
|
|
1
|
-
import { ToasterTypeOptions as
|
|
2
|
-
import { COUPON_PLACEHOLDER_DEFAULT as
|
|
3
|
-
import { useToaster as
|
|
4
|
-
import { useTranslations as
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
]),
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
1
|
+
import { ToasterTypeOptions as n } from "../../enums/toaster.js";
|
|
2
|
+
import { COUPON_PLACEHOLDER_DEFAULT as s, COUPON_PLACEHOLDER_LIQUID as a } from "../../extensions/Blocks/CouponBlock/template.js";
|
|
3
|
+
import { useToaster as i } from "../useToaster.js";
|
|
4
|
+
import { useTranslations as l } from "../useTranslations.js";
|
|
5
|
+
const c = /* @__PURE__ */ new Set([
|
|
6
|
+
s,
|
|
7
|
+
a
|
|
8
|
+
]), p = "newsletter.coupon-tag-modified";
|
|
9
|
+
function u(r) {
|
|
10
|
+
const e = new DOMParser().parseFromString(r, "text/html");
|
|
11
|
+
return Array.from(e.querySelectorAll(".coupon-block")).map((o) => {
|
|
12
|
+
var t;
|
|
13
|
+
return ((t = o.textContent) == null ? void 0 : t.trim()) ?? "";
|
|
14
|
+
}).filter((o) => !c.has(o));
|
|
15
|
+
}
|
|
16
|
+
const T = () => {
|
|
17
|
+
const { showToaster: r } = i(), e = l();
|
|
18
|
+
return { validateCouponBlockTags: (t) => u(t).length > 0 ? (r({
|
|
19
|
+
type: n.Warning,
|
|
20
|
+
message: e(p)
|
|
21
|
+
}), !1) : !0 };
|
|
21
22
|
};
|
|
22
23
|
export {
|
|
23
|
-
|
|
24
|
+
p as COUPON_TAG_MODIFIED_KEY,
|
|
25
|
+
u as findInvalidCouponBlocks,
|
|
26
|
+
T as useCouponBlockValidator
|
|
24
27
|
};
|