@useinsider/guido 3.18.2-beta.8ef3138 → 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 +8 -8
- package/dist/components/Guido.vue2.js +53 -51
- package/dist/components/organisms/AutoSaveController.vue2.js +9 -8
- 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/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/useHtmlCompiler.js +37 -26
- package/dist/composables/useHtmlValidator.js +2 -0
- package/dist/composables/useSave.js +90 -45
- package/dist/composables/useSaveValidation.js +279 -0
- package/dist/composables/useSaveValidationRollout.js +9 -0
- package/dist/composables/validators/useCouponBlockValidator.js +24 -21
- package/dist/composables/validators/useUnsubscribeBlockValidator.js +34 -27
- package/dist/enums/save-validation.js +4 -0
- package/dist/extensions/Blocks/Recommendation/store/recommendation.js +43 -36
- package/dist/guido.css +1 -1
- 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/organisms/validation/ValidationErrorDrawer.vue.d.ts +2 -0
- 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/save-validation.d.ts +27 -0
- package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +5 -0
- package/dist/src/stores/config.d.ts +30 -0
- package/dist/src/stores/save-validation.d.ts +22 -0
- package/dist/src/utils/liquidDynamicContent.d.ts +20 -0
- package/dist/src/utils/templatePreparation.d.ts +30 -0
- package/dist/stores/config.js +39 -22
- package/dist/stores/save-validation.js +30 -0
- package/dist/utils/genericUtil.js +64 -61
- package/dist/utils/liquidDynamicContent.js +15 -0
- package/dist/utils/templatePreparation.js +28 -25
- package/package.json +1 -1
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import o from "./LeftSlot.vue2.js";
|
|
2
2
|
/* empty css */
|
|
3
|
-
import
|
|
4
|
-
var
|
|
3
|
+
import n from "../../../_virtual/_plugin-vue2_normalizer.js";
|
|
4
|
+
var a = function() {
|
|
5
5
|
var e = this, s = e._self._c, t = e._self._setupProxy;
|
|
6
6
|
return s("div", { staticClass: "d-f a-i-c" }, [s(t.InButtonV2, { attrs: { id: "guido__back-button", "left-icon": "line-arrow-left", styling: "ghost", type: "secondary", "disabled-status": t.isBackButtonDisabled, "label-text": t.backButtonLabel, "skeleton-sizing": { width: 150, height: 26 }, "skeleton-status": t.editorStore.loadingStatus }, on: { click: t.handleBackClick } })], 1);
|
|
7
|
-
}, i = [], r = /* @__PURE__ */
|
|
7
|
+
}, i = [], r = /* @__PURE__ */ n(
|
|
8
8
|
o,
|
|
9
|
-
|
|
9
|
+
a,
|
|
10
10
|
i,
|
|
11
11
|
!1,
|
|
12
12
|
null,
|
|
13
|
-
"
|
|
13
|
+
"b8f24f34"
|
|
14
14
|
);
|
|
15
15
|
const f = r.exports;
|
|
16
16
|
export {
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import { defineComponent as
|
|
1
|
+
import { defineComponent as m, computed as p, ref as d } from "vue";
|
|
2
2
|
import { useConfig as k } from "../../../composables/useConfig.js";
|
|
3
3
|
import { useBack as B } from "../../../composables/useGuidoActions.js";
|
|
4
4
|
import { usePreviewMode as b } from "../../../composables/usePreviewMode.js";
|
|
5
5
|
import { useTranslations as v } from "../../../composables/useTranslations.js";
|
|
6
6
|
import { useVersionHistoryApi as _ } from "../../../composables/useVersionHistoryApi.js";
|
|
7
|
-
import { useEditorStore as
|
|
7
|
+
import { useEditorStore as y } from "../../../stores/editor.js";
|
|
8
8
|
import { InButtonV2 as w } from "@useinsider/design-system-vue";
|
|
9
|
-
import { useDebounceFn as
|
|
10
|
-
const D = /* @__PURE__ */
|
|
9
|
+
import { useDebounceFn as V } from "../../../node_modules/@vueuse/shared/index.js";
|
|
10
|
+
const D = /* @__PURE__ */ m({
|
|
11
11
|
__name: "LeftSlot",
|
|
12
12
|
setup(C) {
|
|
13
|
-
const e =
|
|
14
|
-
var u,
|
|
15
|
-
return e.isVersionHistoryOpen || e.isPreviewModeOpen ? o("email-editor.back-to-editor") : (
|
|
16
|
-
}), r = d(!1),
|
|
13
|
+
const e = y(), i = B(), { closeVersionHistory: n } = _(), { closePreviewMode: s } = b(), o = v(), { config: t } = k(), l = p(() => {
|
|
14
|
+
var u, f;
|
|
15
|
+
return e.isVersionHistoryOpen || e.isPreviewModeOpen ? o("email-editor.back-to-editor") : (f = (u = t.value) == null ? void 0 : u.ui) != null && f.backButtonLabel ? t.value.ui.backButtonLabel : o("email-editor.back-to-design");
|
|
16
|
+
}), r = d(!1), a = () => {
|
|
17
17
|
if (e.isVersionHistoryOpen) {
|
|
18
18
|
n();
|
|
19
19
|
return;
|
|
@@ -23,11 +23,15 @@ const D = /* @__PURE__ */ l({
|
|
|
23
23
|
return;
|
|
24
24
|
}
|
|
25
25
|
i();
|
|
26
|
-
},
|
|
27
|
-
|
|
26
|
+
}, c = V(async () => {
|
|
27
|
+
try {
|
|
28
|
+
await a();
|
|
29
|
+
} finally {
|
|
30
|
+
r.value = !1;
|
|
31
|
+
}
|
|
28
32
|
}, 500);
|
|
29
|
-
return { __sfc: !0, editorStore: e, handleBack: i, closeVersionHistory: n, closePreviewMode: s, trans: o, config: t, backButtonLabel:
|
|
30
|
-
r.value = !0,
|
|
33
|
+
return { __sfc: !0, editorStore: e, handleBack: i, closeVersionHistory: n, closePreviewMode: s, trans: o, config: t, backButtonLabel: l, isBackButtonDisabled: r, executeBackAction: a, debouncedBackAction: c, handleBackClick: () => {
|
|
34
|
+
r.value = !0, c();
|
|
31
35
|
}, InButtonV2: w };
|
|
32
36
|
}
|
|
33
37
|
});
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import a from "./ValidationErrorDrawer.vue2.js";
|
|
2
|
+
/* empty css */
|
|
3
|
+
import s from "../../../_virtual/_plugin-vue2_normalizer.js";
|
|
4
|
+
var i = function() {
|
|
5
|
+
var r = this, o = r._self._c, t = r._self._setupProxy;
|
|
6
|
+
return o(t.WpDrawer, { attrs: { id: "guido__validation-error-drawer", size: "small", "footer-button-group-options": t.footerButtonGroupOptions, status: t.store.isDrawerOpen, "title-text": t.titleText }, on: { onCloseEvent: t.handleClose, primaryButtonEvent: t.handleClose, secondaryButtonEvent: t.handleSaveAndContinue } }, [o("div", { staticClass: "d-f f-d-c validation-error-list" }, r._l(t.rows, function(e, n) {
|
|
7
|
+
return o("div", { key: n, staticClass: "d-f a-i-c validation-error-row" }, [o(t.InIcons, { staticClass: "validation-error-row__icon i-c-12", attrs: { name: "filled-caution-triangle" } }), o("span", { staticClass: "validation-error-row__text" }, [r._v(r._s(e))])], 1);
|
|
8
|
+
}), 0)]);
|
|
9
|
+
}, l = [], _ = /* @__PURE__ */ s(
|
|
10
|
+
a,
|
|
11
|
+
i,
|
|
12
|
+
l,
|
|
13
|
+
!1,
|
|
14
|
+
null,
|
|
15
|
+
"30d2e1f9"
|
|
16
|
+
);
|
|
17
|
+
const p = _.exports;
|
|
18
|
+
export {
|
|
19
|
+
p as default
|
|
20
|
+
};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { defineComponent as m, ref as p, computed as a } from "vue";
|
|
2
|
+
import f from "../../wrappers/WpDrawer.vue.js";
|
|
3
|
+
import { useSave as S } from "../../../composables/useSave.js";
|
|
4
|
+
import { useTranslations as v } from "../../../composables/useTranslations.js";
|
|
5
|
+
import { useConfigStore as g } from "../../../stores/config.js";
|
|
6
|
+
import { useEditorStore as y } from "../../../stores/editor.js";
|
|
7
|
+
import { useSaveValidationStore as h } from "../../../stores/save-validation.js";
|
|
8
|
+
import { InIcons as w } from "@useinsider/design-system-vue";
|
|
9
|
+
const I = /* @__PURE__ */ m({
|
|
10
|
+
__name: "ValidationErrorDrawer",
|
|
11
|
+
setup(_) {
|
|
12
|
+
const r = v(), e = h(), n = y(), s = g(), { saveWithErrors: i } = S(), o = p(!1), l = a(() => `${r("email-editor.validation-errors")} (${e.errorCount})`), u = a(() => {
|
|
13
|
+
const t = {
|
|
14
|
+
primaryButton: {
|
|
15
|
+
styling: "solid",
|
|
16
|
+
type: "primary",
|
|
17
|
+
labelText: r("email-editor.update-design")
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
return s.allowSaveWithErrors && e.intent !== "test" && (t.secondaryButton = {
|
|
21
|
+
styling: "solid",
|
|
22
|
+
type: "subtle-primary",
|
|
23
|
+
labelText: r("email-editor.save-and-continue"),
|
|
24
|
+
loadingStatus: o.value
|
|
25
|
+
}), t;
|
|
26
|
+
}), d = a(() => e.errors.map((t) => {
|
|
27
|
+
const c = t.detail ? ` (${t.detail})` : "";
|
|
28
|
+
return `${t.message}${c}`;
|
|
29
|
+
}));
|
|
30
|
+
return { __sfc: !0, trans: r, store: e, editorStore: n, configStore: s, saveWithErrors: i, isSaving: o, titleText: l, footerButtonGroupOptions: u, rows: d, handleClose: () => {
|
|
31
|
+
e.isDrawerOpen && e.close();
|
|
32
|
+
}, handleSaveAndContinue: async () => {
|
|
33
|
+
if (!o.value) {
|
|
34
|
+
o.value = !0, n.loadingStatus = !0;
|
|
35
|
+
try {
|
|
36
|
+
await i() ? e.close() : n.loadingStatus = !1;
|
|
37
|
+
} catch (t) {
|
|
38
|
+
console.warn("Soft-save failed; keeping the drawer open.", t), n.loadingStatus = !1;
|
|
39
|
+
} finally {
|
|
40
|
+
o.value = !1;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}, WpDrawer: f, InIcons: w };
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
export {
|
|
47
|
+
I as default
|
|
48
|
+
};
|
|
@@ -1,17 +1,19 @@
|
|
|
1
1
|
import r from "./WpDrawer.vue2.js";
|
|
2
2
|
import s from "../../_virtual/_plugin-vue2_normalizer.js";
|
|
3
3
|
var u = function() {
|
|
4
|
-
var t = this,
|
|
5
|
-
return
|
|
4
|
+
var t = this, o = t._self._c, e = t._self._setupProxy;
|
|
5
|
+
return o(e.InDrawer, { class: t.className, attrs: { id: t.id, "footer-status": "", "close-on-outside-click": t.closeOnOutsideClick, "description-status": t.descriptionStatus, "description-text": t.descriptionText, "footer-button-group-options": t.footerButtonGroupOptions, size: t.size, status: t.status, "title-text": t.titleText }, on: { cancelOrBackButtonEvent: function(n) {
|
|
6
6
|
return e.emit("cancelOrBackButtonEvent");
|
|
7
|
-
}, onCloseEvent: function(
|
|
7
|
+
}, onCloseEvent: function(n) {
|
|
8
8
|
return e.emit("onCloseEvent");
|
|
9
|
-
}, primaryButtonEvent: function(
|
|
9
|
+
}, primaryButtonEvent: function(n) {
|
|
10
10
|
return e.emit("primaryButtonEvent");
|
|
11
|
+
}, secondaryButtonEvent: function(n) {
|
|
12
|
+
return e.emit("secondaryButtonEvent");
|
|
11
13
|
} }, scopedSlots: t._u([t.$slots.headerBottomSlot ? { key: "headerBottomSlot", fn: function() {
|
|
12
14
|
return [t._t("headerBottomSlot")];
|
|
13
15
|
}, proxy: !0 } : null, { key: "contentSlot", fn: function() {
|
|
14
|
-
return [
|
|
16
|
+
return [o("div", [t._t("default")], 2)];
|
|
15
17
|
}, proxy: !0 }], null, !0) });
|
|
16
18
|
}, i = [], c = /* @__PURE__ */ s(
|
|
17
19
|
r,
|
|
@@ -21,7 +23,7 @@ var u = function() {
|
|
|
21
23
|
null,
|
|
22
24
|
null
|
|
23
25
|
);
|
|
24
|
-
const
|
|
26
|
+
const p = c.exports;
|
|
25
27
|
export {
|
|
26
|
-
|
|
28
|
+
p as default
|
|
27
29
|
};
|
|
@@ -13,7 +13,7 @@ const r = /* @__PURE__ */ e({
|
|
|
13
13
|
status: { type: Boolean },
|
|
14
14
|
titleText: null
|
|
15
15
|
},
|
|
16
|
-
emits: ["cancelOrBackButtonEvent", "onCloseEvent", "primaryButtonEvent"],
|
|
16
|
+
emits: ["cancelOrBackButtonEvent", "onCloseEvent", "primaryButtonEvent", "secondaryButtonEvent"],
|
|
17
17
|
setup(n, { emit: t }) {
|
|
18
18
|
return { __sfc: !0, emit: t, InDrawer: o };
|
|
19
19
|
}
|
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
import { defaultHtmlCompilerRules as
|
|
2
|
-
import { itemsCompilerRules as
|
|
3
|
-
import { liquidCompilerRules as
|
|
4
|
-
import { outlookCompilerRules as
|
|
1
|
+
import { defaultHtmlCompilerRules as d } from "../config/compiler/htmlCompilerRules.js";
|
|
2
|
+
import { itemsCompilerRules as f } from "../config/compiler/itemsCompilerRules.js";
|
|
3
|
+
import { liquidCompilerRules as g } from "../config/compiler/liquidCompilerRules.js";
|
|
4
|
+
import { outlookCompilerRules as R } from "../config/compiler/outlookCompilerRules.js";
|
|
5
5
|
import { recommendationCompilerRules as v } from "../config/compiler/recommendationCompilerRules.js";
|
|
6
6
|
import { socialCompilerRules as H } from "../config/compiler/socialCompilerRules.js";
|
|
7
|
-
import { unsubscribeCompilerRules as
|
|
8
|
-
import { createHtmlCompiler as
|
|
9
|
-
import {
|
|
10
|
-
|
|
7
|
+
import { unsubscribeCompilerRules as b } from "../config/compiler/unsubscribeCompilerRules.js";
|
|
8
|
+
import { createHtmlCompiler as n } from "../utils/htmlCompiler.js";
|
|
9
|
+
import { computed as p } from "vue";
|
|
10
|
+
import { useConfig as C } from "./useConfig.js";
|
|
11
|
+
const x = /* @__PURE__ */ new Set([
|
|
11
12
|
// URL/tag encoding fixes — keep merge-tag and placeholder integrity intact.
|
|
12
13
|
"fix-url-encoding-start",
|
|
13
14
|
"fix-url-encoding-end",
|
|
@@ -30,24 +31,34 @@ const y = /* @__PURE__ */ new Set([
|
|
|
30
31
|
// Editor-only attribute strip — AMP4EMAIL has no `contenteditable`, so leaving
|
|
31
32
|
// it in narrows/breaks rendering. Pure attribute removal, emits nothing.
|
|
32
33
|
"remove-contenteditable"
|
|
33
|
-
]),
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
...
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
34
|
+
]), I = () => {
|
|
35
|
+
const { compiler: i, isFeatureEnabled: u, partner: a } = C(), c = p(() => {
|
|
36
|
+
var m, l;
|
|
37
|
+
const e = ((m = i.value) == null ? void 0 : m.customRules) || [];
|
|
38
|
+
return [
|
|
39
|
+
...!!((l = i.value) != null && l.ignoreDefaultRules) ? [] : d,
|
|
40
|
+
...v,
|
|
41
|
+
...b,
|
|
42
|
+
...f,
|
|
43
|
+
...R,
|
|
44
|
+
...H,
|
|
45
|
+
...u("liquidSyntax") ? g : [],
|
|
46
|
+
...e.map((t, o) => ({
|
|
47
|
+
...t,
|
|
48
|
+
priority: t.priority + 1e3 + o
|
|
49
|
+
// Ensure additional rules run after default rules
|
|
50
|
+
}))
|
|
51
|
+
];
|
|
52
|
+
}), r = p(() => {
|
|
53
|
+
var t;
|
|
54
|
+
const e = c.value, s = n(e), m = n(e.filter((o) => x.has(o.id))), l = (t = a.value) == null ? void 0 : t.fallbackFont;
|
|
55
|
+
return {
|
|
56
|
+
compileHtml: (o) => s.compile(o, void 0, l),
|
|
57
|
+
compileAmpHtml: (o) => m.compile(o, void 0, l)
|
|
58
|
+
};
|
|
59
|
+
});
|
|
60
|
+
return { compileHtml: (e) => r.value.compileHtml(e), compileAmpHtml: (e) => r.value.compileAmpHtml(e) };
|
|
50
61
|
};
|
|
51
62
|
export {
|
|
52
|
-
|
|
63
|
+
I as useHtmlCompiler
|
|
53
64
|
};
|
|
@@ -221,6 +221,8 @@ const De = () => {
|
|
|
221
221
|
export {
|
|
222
222
|
de as buildPartnerAttributeNameSet,
|
|
223
223
|
fe as findInvalidCustomFields,
|
|
224
|
+
pe as getInvalidDynamicContentTags,
|
|
225
|
+
ce as getRecommendationBlockIds,
|
|
224
226
|
ue as parseRecommendationVariable,
|
|
225
227
|
De as useHtmlValidator
|
|
226
228
|
};
|
|
@@ -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
|
};
|