@useinsider/guido 3.19.0-beta.3abc7c5 → 3.19.0-beta.3d545d6
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 +0 -1
- package/dist/@types/config/schemas.js +31 -33
- package/dist/components/Guido.vue.js +9 -9
- package/dist/components/Guido.vue2.js +57 -58
- package/dist/components/organisms/AutoSaveController.vue2.js +8 -9
- package/dist/components/organisms/base/AuthErrorModal.vue.js +18 -0
- package/dist/components/organisms/base/AuthErrorModal.vue2.js +29 -0
- package/dist/components/organisms/header/EditorActions.vue.js +5 -5
- package/dist/components/organisms/header/EditorActions.vue2.js +55 -85
- package/dist/components/organisms/header/LeftSlot.vue.js +5 -5
- package/dist/components/organisms/header/LeftSlot.vue2.js +12 -16
- package/dist/components/wrappers/WpDrawer.vue.js +7 -9
- package/dist/components/wrappers/WpDrawer.vue2.js +1 -1
- package/dist/components/wrappers/WpModal.vue.js +1 -1
- package/dist/components/wrappers/WpModal.vue2.js +4 -3
- package/dist/composables/useAuthError.js +51 -0
- package/dist/composables/useHtmlCompiler.js +26 -37
- package/dist/composables/useHtmlValidator.js +0 -2
- package/dist/composables/useHttp.js +58 -51
- package/dist/composables/useSave.js +45 -90
- package/dist/composables/useToaster.js +17 -15
- package/dist/composables/validators/useCouponBlockValidator.js +21 -24
- package/dist/composables/validators/useLiquidValidator.js +15 -15
- package/dist/composables/validators/useUnsubscribeBlockValidator.js +27 -34
- package/dist/extensions/Blocks/Recommendation/store/recommendation.js +47 -54
- package/dist/guido.css +1 -1
- package/dist/src/@types/config/schemas.d.ts +0 -4
- package/dist/src/components/Guido.vue.d.ts +1 -17
- package/dist/src/components/organisms/header/EditorActions.vue.d.ts +1 -17
- package/dist/src/components/organisms/header/HeaderWrapper.vue.d.ts +1 -17
- package/dist/src/components/organisms/header/RightSlot.vue.d.ts +1 -17
- package/dist/src/components/wrappers/WpDrawer.vue.d.ts +3 -4
- package/dist/src/components/wrappers/WpModal.vue.d.ts +5 -1
- package/dist/src/composables/useAuthError.d.ts +11 -0
- package/dist/src/composables/useConfig.d.ts +0 -2
- package/dist/src/composables/useHtmlValidator.d.ts +0 -21
- package/dist/src/composables/useHttp.d.ts +2 -0
- package/dist/src/composables/useSave.d.ts +1 -6
- package/dist/src/composables/validators/useCouponBlockValidator.d.ts +0 -3
- package/dist/src/composables/validators/useUnsubscribeBlockValidator.d.ts +0 -10
- package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +0 -5
- package/dist/src/stores/config.d.ts +0 -32
- package/dist/src/utils/templatePreparation.d.ts +0 -30
- package/dist/stores/config.js +67 -84
- package/dist/utils/templatePreparation.js +36 -39
- package/package.json +1 -1
- package/dist/components/organisms/validation/ValidationErrorDrawer.vue.js +0 -20
- package/dist/components/organisms/validation/ValidationErrorDrawer.vue2.js +0 -48
- package/dist/composables/useSaveValidation.js +0 -279
- package/dist/composables/useSaveValidationRollout.js +0 -9
- package/dist/enums/save-validation.js +0 -4
- package/dist/src/@types/save-validation.d.ts +0 -19
- package/dist/src/composables/useSaveValidation.d.ts +0 -6
- package/dist/src/composables/useSaveValidationRollout.d.ts +0 -3
- package/dist/src/enums/save-validation.d.ts +0 -27
- package/dist/src/stores/save-validation.d.ts +0 -22
- package/dist/stores/save-validation.js +0 -30
- /package/dist/src/components/organisms/{validation/ValidationErrorDrawer.vue.d.ts → base/AuthErrorModal.vue.d.ts} +0 -0
|
@@ -1,107 +1,77 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { useActionsApi as
|
|
3
|
-
import { useConfig as
|
|
4
|
-
import { useExport as
|
|
5
|
-
import { useTestEmailClick as
|
|
6
|
-
import { useHtmlCompiler as
|
|
7
|
-
import { useSave as
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import
|
|
18
|
-
|
|
19
|
-
import { getTooltipOptions as ot } from "../../../utils/tooltipUtils.js";
|
|
20
|
-
import { InButtonV2 as rt } from "@useinsider/design-system-vue";
|
|
21
|
-
import { storeToRefs as it } from "pinia";
|
|
22
|
-
import at from "./MigrationConfirmModal.vue.js";
|
|
23
|
-
const Ot = /* @__PURE__ */ D({
|
|
1
|
+
import { defineComponent as q, ref as n, computed as x } from "vue";
|
|
2
|
+
import { useActionsApi as b } from "../../../composables/useActionsApi.js";
|
|
3
|
+
import { useConfig as k } from "../../../composables/useConfig.js";
|
|
4
|
+
import { useExport as B } from "../../../composables/useExport.js";
|
|
5
|
+
import { useTestEmailClick as D } from "../../../composables/useGuidoActions.js";
|
|
6
|
+
import { useHtmlCompiler as L } from "../../../composables/useHtmlCompiler.js";
|
|
7
|
+
import { useSave as R } from "../../../composables/useSave.js";
|
|
8
|
+
import { useToaster as z } from "../../../composables/useToaster.js";
|
|
9
|
+
import { useTranslations as I } from "../../../composables/useTranslations.js";
|
|
10
|
+
import { useVersionHistoryApi as P } from "../../../composables/useVersionHistoryApi.js";
|
|
11
|
+
import { useLiquidValidator as j } from "../../../composables/validators/useLiquidValidator.js";
|
|
12
|
+
import { useEditorStore as G } from "../../../stores/editor.js";
|
|
13
|
+
import { useTemplateStore as J } from "../../../stores/template.js";
|
|
14
|
+
import { getTooltipOptions as K } from "../../../utils/tooltipUtils.js";
|
|
15
|
+
import { InButtonV2 as N } from "@useinsider/design-system-vue";
|
|
16
|
+
import { storeToRefs as Q } from "pinia";
|
|
17
|
+
import U from "./MigrationConfirmModal.vue.js";
|
|
18
|
+
const ft = /* @__PURE__ */ q({
|
|
24
19
|
__name: "EditorActions",
|
|
25
|
-
setup(
|
|
26
|
-
const { config:
|
|
27
|
-
if (
|
|
28
|
-
|
|
20
|
+
setup(W, { expose: w }) {
|
|
21
|
+
const { config: l, isFeatureEnabled: m } = k(), { exportHtml: c } = B(), { save: p } = R(), { openVersionHistory: u, closeVersionHistory: f } = P(), { getCompiledEmail: d } = b(), { compileHtml: v } = L(), { validateLiquidSyntax: y } = j(), { handleError: r } = z(), e = G(), g = J(), { hasMigrations: S } = Q(g), s = I(), i = n(!1), a = n(!1), H = n(), h = D(), _ = () => {
|
|
22
|
+
if (e.isVersionHistoryOpen) {
|
|
23
|
+
f();
|
|
29
24
|
return;
|
|
30
25
|
}
|
|
31
|
-
|
|
32
|
-
},
|
|
33
|
-
|
|
34
|
-
},
|
|
35
|
-
|
|
36
|
-
},
|
|
26
|
+
u();
|
|
27
|
+
}, C = async () => {
|
|
28
|
+
i.value = !0, await c(), i.value = !1;
|
|
29
|
+
}, A = () => {
|
|
30
|
+
e.isSaveAsTemplateDrawerOpen = !0;
|
|
31
|
+
}, M = x(() => e.isVersionHistoryOpen ? s("newsletter.close-version-history") : s("newsletter.version-history")), O = x(
|
|
37
32
|
() => {
|
|
38
|
-
var t,
|
|
39
|
-
return ((
|
|
33
|
+
var t, o;
|
|
34
|
+
return ((o = (t = l.value) == null ? void 0 : t.features) == null ? void 0 : o.versionHistory) && !e.isPreviewModeOpen;
|
|
40
35
|
}
|
|
41
|
-
),
|
|
42
|
-
|
|
43
|
-
let
|
|
36
|
+
), V = async (t) => {
|
|
37
|
+
a.value = !0, t || (e.loadingStatus = !0);
|
|
38
|
+
let o;
|
|
44
39
|
try {
|
|
45
|
-
|
|
46
|
-
} catch (
|
|
47
|
-
|
|
40
|
+
o = await p(t);
|
|
41
|
+
} catch (T) {
|
|
42
|
+
r(T, "Failed to save template");
|
|
48
43
|
} finally {
|
|
49
|
-
|
|
44
|
+
a.value = !1, !t && !o && (e.loadingStatus = !1);
|
|
50
45
|
}
|
|
51
|
-
return
|
|
52
|
-
},
|
|
53
|
-
var
|
|
54
|
-
if (!t &&
|
|
55
|
-
(
|
|
46
|
+
return o;
|
|
47
|
+
}, E = (t) => {
|
|
48
|
+
var o;
|
|
49
|
+
if (!t && S.value) {
|
|
50
|
+
(o = H.value) == null || o.open();
|
|
56
51
|
return;
|
|
57
52
|
}
|
|
58
|
-
return
|
|
59
|
-
},
|
|
60
|
-
if (
|
|
61
|
-
|
|
62
|
-
let t = [];
|
|
63
|
-
try {
|
|
64
|
-
t = await v();
|
|
65
|
-
} catch (e) {
|
|
66
|
-
console.warn("Test-path validation failed; sending without the drawer.", e);
|
|
67
|
-
} finally {
|
|
68
|
-
o.loadingStatus = !1;
|
|
69
|
-
}
|
|
70
|
-
if (t.length) {
|
|
71
|
-
S({
|
|
72
|
-
type: Y.Error,
|
|
73
|
-
message: r("email-editor.validation-errors-found"),
|
|
74
|
-
actionButton: {
|
|
75
|
-
text: r("email-editor.check-errors"),
|
|
76
|
-
onClick: () => E.open(t, "test")
|
|
77
|
-
},
|
|
78
|
-
autoHide: !1
|
|
79
|
-
});
|
|
80
|
-
return;
|
|
81
|
-
}
|
|
82
|
-
l();
|
|
83
|
-
return;
|
|
84
|
-
}
|
|
85
|
-
if (p("liquidSyntax")) {
|
|
86
|
-
o.loadingStatus = !0;
|
|
53
|
+
return V(t);
|
|
54
|
+
}, F = async () => {
|
|
55
|
+
if (m("liquidSyntax")) {
|
|
56
|
+
e.loadingStatus = !0;
|
|
87
57
|
try {
|
|
88
|
-
const { html: t } = await
|
|
89
|
-
if (!await
|
|
58
|
+
const { html: t } = await d({ minimize: !0, resetDataSavedFlag: !1 }), { compiledHtml: o } = v(t);
|
|
59
|
+
if (!await y(o))
|
|
90
60
|
return;
|
|
91
61
|
} catch (t) {
|
|
92
|
-
|
|
62
|
+
r(t, "Failed to prepare test email");
|
|
93
63
|
return;
|
|
94
64
|
} finally {
|
|
95
|
-
|
|
65
|
+
e.loadingStatus = !1;
|
|
96
66
|
}
|
|
97
67
|
}
|
|
98
|
-
|
|
68
|
+
h();
|
|
99
69
|
};
|
|
100
|
-
return
|
|
101
|
-
handleSave:
|
|
102
|
-
}), { __sfc: !0, config:
|
|
70
|
+
return w({
|
|
71
|
+
handleSave: E
|
|
72
|
+
}), { __sfc: !0, config: l, isFeatureEnabled: m, exportHtml: c, save: p, openVersionHistory: u, closeVersionHistory: f, getCompiledEmail: d, compileHtml: v, validateLiquidSyntax: y, handleError: r, editorStore: e, templateStore: g, hasMigrations: S, trans: s, isExporting: i, isSaving: a, migrationModalRef: H, testEmailClick: h, handleVersionHistory: _, handleExport: C, handleSaveAs: A, versionHistoryTooltipText: M, isVersionHistoryButtonVisible: O, executeSave: V, handleSave: E, handleTestEmail: F, getTooltipOptions: K, InButtonV2: N, MigrationConfirmModal: U };
|
|
103
73
|
}
|
|
104
74
|
});
|
|
105
75
|
export {
|
|
106
|
-
|
|
76
|
+
ft as default
|
|
107
77
|
};
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import o from "./LeftSlot.vue2.js";
|
|
2
2
|
/* empty css */
|
|
3
|
-
import
|
|
4
|
-
var
|
|
3
|
+
import a from "../../../_virtual/_plugin-vue2_normalizer.js";
|
|
4
|
+
var n = 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__ */ a(
|
|
8
8
|
o,
|
|
9
|
-
|
|
9
|
+
n,
|
|
10
10
|
i,
|
|
11
11
|
!1,
|
|
12
12
|
null,
|
|
13
|
-
"
|
|
13
|
+
"73199fa4"
|
|
14
14
|
);
|
|
15
15
|
const f = r.exports;
|
|
16
16
|
export {
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import { defineComponent as
|
|
1
|
+
import { defineComponent as l, 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 V } 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 y } from "../../../node_modules/@vueuse/shared/index.js";
|
|
10
|
+
const D = /* @__PURE__ */ l({
|
|
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 = V(), i = B(), { closeVersionHistory: n } = _(), { closePreviewMode: s } = b(), o = v(), { config: t } = k(), f = p(() => {
|
|
14
|
+
var u, m;
|
|
15
|
+
return e.isVersionHistoryOpen || e.isPreviewModeOpen ? o("email-editor.back-to-editor") : (m = (u = t.value) == null ? void 0 : u.ui) != null && m.backButtonLabel ? t.value.ui.backButtonLabel : o("email-editor.back-to-design");
|
|
16
|
+
}), r = d(!1), c = () => {
|
|
17
17
|
if (e.isVersionHistoryOpen) {
|
|
18
18
|
n();
|
|
19
19
|
return;
|
|
@@ -23,15 +23,11 @@ const D = /* @__PURE__ */ m({
|
|
|
23
23
|
return;
|
|
24
24
|
}
|
|
25
25
|
i();
|
|
26
|
-
},
|
|
27
|
-
|
|
28
|
-
await a();
|
|
29
|
-
} finally {
|
|
30
|
-
r.value = !1;
|
|
31
|
-
}
|
|
26
|
+
}, a = y(() => {
|
|
27
|
+
c(), r.value = !1;
|
|
32
28
|
}, 500);
|
|
33
|
-
return { __sfc: !0, editorStore: e, handleBack: i, closeVersionHistory: n, closePreviewMode: s, trans: o, config: t, backButtonLabel:
|
|
34
|
-
r.value = !0,
|
|
29
|
+
return { __sfc: !0, editorStore: e, handleBack: i, closeVersionHistory: n, closePreviewMode: s, trans: o, config: t, backButtonLabel: f, isBackButtonDisabled: r, executeBackAction: c, debouncedBackAction: a, handleBackClick: () => {
|
|
30
|
+
r.value = !0, a();
|
|
35
31
|
}, InButtonV2: w };
|
|
36
32
|
}
|
|
37
33
|
});
|
|
@@ -1,19 +1,17 @@
|
|
|
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, n = t._self._c, e = t._self._setupProxy;
|
|
5
|
+
return n(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(o) {
|
|
6
6
|
return e.emit("cancelOrBackButtonEvent");
|
|
7
|
-
}, onCloseEvent: function(
|
|
7
|
+
}, onCloseEvent: function(o) {
|
|
8
8
|
return e.emit("onCloseEvent");
|
|
9
|
-
}, primaryButtonEvent: function(
|
|
9
|
+
}, primaryButtonEvent: function(o) {
|
|
10
10
|
return e.emit("primaryButtonEvent");
|
|
11
|
-
}, secondaryButtonEvent: function(n) {
|
|
12
|
-
return e.emit("secondaryButtonEvent");
|
|
13
11
|
} }, scopedSlots: t._u([t.$slots.headerBottomSlot ? { key: "headerBottomSlot", fn: function() {
|
|
14
12
|
return [t._t("headerBottomSlot")];
|
|
15
13
|
}, proxy: !0 } : null, { key: "contentSlot", fn: function() {
|
|
16
|
-
return [
|
|
14
|
+
return [n("div", [t._t("default")], 2)];
|
|
17
15
|
}, proxy: !0 }], null, !0) });
|
|
18
16
|
}, i = [], c = /* @__PURE__ */ s(
|
|
19
17
|
r,
|
|
@@ -23,7 +21,7 @@ var u = function() {
|
|
|
23
21
|
null,
|
|
24
22
|
null
|
|
25
23
|
);
|
|
26
|
-
const
|
|
24
|
+
const f = c.exports;
|
|
27
25
|
export {
|
|
28
|
-
|
|
26
|
+
f as default
|
|
29
27
|
};
|
|
@@ -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"],
|
|
17
17
|
setup(n, { emit: t }) {
|
|
18
18
|
return { __sfc: !0, emit: t, InDrawer: o };
|
|
19
19
|
}
|
|
@@ -2,7 +2,7 @@ import r from "./WpModal.vue2.js";
|
|
|
2
2
|
import s from "../../_virtual/_plugin-vue2_normalizer.js";
|
|
3
3
|
var i = function() {
|
|
4
4
|
var t = this, o = t._self._c, e = t._self._setupProxy;
|
|
5
|
-
return o(e.InModalV2, { attrs: { id: t.id, "description-status": "", status: "", "close-button-status": t.closeButtonStatus, "close-on-outside-click": t.closeOnOutsideClick, "description-text": t.description, "footer-button-group-options": t.footerButtonOptions, "footer-status": t.footerStatus, size: t.size, "title-text": t.title }, on: { cancelOrBackButtonEvent: function(n) {
|
|
5
|
+
return o(e.InModalV2, { attrs: { id: t.id, "description-status": "", status: "", "close-button-status": t.closeButtonStatus, "close-on-outside-click": t.closeOnOutsideClick, "description-text": t.description, "footer-button-group-options": t.footerButtonOptions, "footer-status": t.footerStatus, size: t.size, state: t.state, "title-text": t.title }, on: { cancelOrBackButtonEvent: function(n) {
|
|
6
6
|
return e.emit("close");
|
|
7
7
|
}, onCloseEvent: function(n) {
|
|
8
8
|
return e.emit("close");
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { defineComponent as e } from "vue";
|
|
2
2
|
import { InModalV2 as o } from "@useinsider/design-system-vue";
|
|
3
|
-
const
|
|
3
|
+
const n = /* @__PURE__ */ e({
|
|
4
4
|
__name: "WpModal",
|
|
5
5
|
props: {
|
|
6
6
|
id: null,
|
|
7
7
|
title: null,
|
|
8
8
|
description: { default: "" },
|
|
9
|
+
state: { default: "default" },
|
|
9
10
|
size: { default: "small" },
|
|
10
11
|
footerButtonOptions: { default: void 0 },
|
|
11
12
|
closeButtonStatus: { type: Boolean, default: !0 },
|
|
@@ -13,10 +14,10 @@ const u = /* @__PURE__ */ e({
|
|
|
13
14
|
footerStatus: { type: Boolean, default: !0 }
|
|
14
15
|
},
|
|
15
16
|
emits: ["close", "primary-action", "secondary-action"],
|
|
16
|
-
setup(
|
|
17
|
+
setup(a, { emit: t }) {
|
|
17
18
|
return { __sfc: !0, emit: t, InModalV2: o };
|
|
18
19
|
}
|
|
19
20
|
});
|
|
20
21
|
export {
|
|
21
|
-
|
|
22
|
+
n as default
|
|
22
23
|
};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { ToasterTypeOptions as l } from "../enums/toaster.js";
|
|
2
|
+
import { ref as p } from "vue";
|
|
3
|
+
import { useToaster as u } from "./useToaster.js";
|
|
4
|
+
import { useTranslations as f } from "./useTranslations.js";
|
|
5
|
+
const d = ["accessExpired", "domainRestricted", "ipRestricted", "insiderAccessRestricted"], n = p(null), a = (e) => {
|
|
6
|
+
try {
|
|
7
|
+
return new URL(e, window.location.href).origin === window.location.origin;
|
|
8
|
+
} catch {
|
|
9
|
+
return !0;
|
|
10
|
+
}
|
|
11
|
+
}, g = (e) => {
|
|
12
|
+
try {
|
|
13
|
+
const o = new URL(e, window.location.href);
|
|
14
|
+
return o.origin === window.location.origin ? o.href : "";
|
|
15
|
+
} catch {
|
|
16
|
+
return "";
|
|
17
|
+
}
|
|
18
|
+
}, w = (e) => {
|
|
19
|
+
try {
|
|
20
|
+
const o = JSON.parse(e);
|
|
21
|
+
return o && typeof o == "object" && Object.keys(o).length ? o : null;
|
|
22
|
+
} catch {
|
|
23
|
+
return null;
|
|
24
|
+
}
|
|
25
|
+
}, y = (e) => typeof (e == null ? void 0 : e.message) == "string" ? e.message : "", s = (e) => y(e) || f()("user-management.collaborate-forbidden-action"), c = (e) => {
|
|
26
|
+
u().showToaster({ type: l.Error, message: e });
|
|
27
|
+
}, R = (e, o, t) => {
|
|
28
|
+
if (t && !a(t))
|
|
29
|
+
return;
|
|
30
|
+
const r = w(o);
|
|
31
|
+
if (e === 403) {
|
|
32
|
+
c(s(r));
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
if (e === 401 && (r == null ? void 0 : r.type) === "groupLevelAccess") {
|
|
36
|
+
c(s(r));
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
if (e === 401 && typeof (r == null ? void 0 : r.type) == "string" && d.includes(r.type)) {
|
|
40
|
+
const i = typeof r.redirect == "string" ? g(r.redirect) : "";
|
|
41
|
+
if (i) {
|
|
42
|
+
window.location.replace(i);
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
e !== 401 && e !== 419 || n.value || (window.isSessionExpired = !0, n.value = { status: e, data: r });
|
|
47
|
+
}, T = () => ({ authError: n });
|
|
48
|
+
export {
|
|
49
|
+
R as reportAuthError,
|
|
50
|
+
T as useAuthError
|
|
51
|
+
};
|
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
import { defaultHtmlCompilerRules as
|
|
2
|
-
import { itemsCompilerRules as
|
|
3
|
-
import { liquidCompilerRules as
|
|
4
|
-
import { outlookCompilerRules as
|
|
1
|
+
import { defaultHtmlCompilerRules as R } from "../config/compiler/htmlCompilerRules.js";
|
|
2
|
+
import { itemsCompilerRules as g } from "../config/compiler/itemsCompilerRules.js";
|
|
3
|
+
import { liquidCompilerRules as C } from "../config/compiler/liquidCompilerRules.js";
|
|
4
|
+
import { outlookCompilerRules as b } 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
|
-
|
|
11
|
-
const x = /* @__PURE__ */ new Set([
|
|
7
|
+
import { unsubscribeCompilerRules as x } from "../config/compiler/unsubscribeCompilerRules.js";
|
|
8
|
+
import { createHtmlCompiler as s } from "../utils/htmlCompiler.js";
|
|
9
|
+
import { useConfig as k } from "./useConfig.js";
|
|
10
|
+
const y = /* @__PURE__ */ new Set([
|
|
12
11
|
// URL/tag encoding fixes — keep merge-tag and placeholder integrity intact.
|
|
13
12
|
"fix-url-encoding-start",
|
|
14
13
|
"fix-url-encoding-end",
|
|
@@ -31,34 +30,24 @@ const x = /* @__PURE__ */ new Set([
|
|
|
31
30
|
// Editor-only attribute strip — AMP4EMAIL has no `contenteditable`, so leaving
|
|
32
31
|
// it in narrows/breaks rendering. Pure attribute removal, emits nothing.
|
|
33
32
|
"remove-contenteditable"
|
|
34
|
-
]),
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
...
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
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) };
|
|
33
|
+
]), M = () => {
|
|
34
|
+
var i, m, r;
|
|
35
|
+
const { compiler: o, isFeatureEnabled: n, partner: a } = k(), p = ((i = o.value) == null ? void 0 : i.customRules) || [], l = [
|
|
36
|
+
...!!((m = o.value) != null && m.ignoreDefaultRules) ? [] : R,
|
|
37
|
+
...v,
|
|
38
|
+
...x,
|
|
39
|
+
...g,
|
|
40
|
+
...b,
|
|
41
|
+
...H,
|
|
42
|
+
...n("liquidSyntax") ? C : [],
|
|
43
|
+
...p.map((e, f) => ({
|
|
44
|
+
...e,
|
|
45
|
+
priority: e.priority + 1e3 + f
|
|
46
|
+
// Ensure additional rules run after default rules
|
|
47
|
+
}))
|
|
48
|
+
], u = s(l), c = l.filter((e) => y.has(e.id)), d = s(c), t = (r = a.value) == null ? void 0 : r.fallbackFont;
|
|
49
|
+
return { compileHtml: (e) => u.compile(e, void 0, t), compileAmpHtml: (e) => d.compile(e, void 0, t) };
|
|
61
50
|
};
|
|
62
51
|
export {
|
|
63
|
-
|
|
52
|
+
M as useHtmlCompiler
|
|
64
53
|
};
|
|
@@ -226,8 +226,6 @@ const ke = () => {
|
|
|
226
226
|
export {
|
|
227
227
|
ge as buildPartnerAttributeNameSet,
|
|
228
228
|
pe as findInvalidCustomFields,
|
|
229
|
-
Ee as getInvalidDynamicContentTags,
|
|
230
|
-
me as getRecommendationBlockIds,
|
|
231
229
|
fe as parseRecommendationVariable,
|
|
232
230
|
ke as useHtmlValidator
|
|
233
231
|
};
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { getCsrfToken as O } from "../utils/genericUtil.js";
|
|
2
2
|
import { ref as m, computed as T } from "vue";
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
import { reportAuthError as j } from "./useAuthError.js";
|
|
4
|
+
const X = [401, 403, 419], N = (g = {}) => {
|
|
5
|
+
const h = m(!1), n = m(null), c = m(null), b = T(() => h.value), y = T(() => n.value !== null), w = {
|
|
5
6
|
baseURL: "",
|
|
6
7
|
timeout: 1e4,
|
|
7
8
|
retry: 0,
|
|
@@ -10,79 +11,85 @@ const X = (b = {}) => {
|
|
|
10
11
|
"Content-Type": "application/json",
|
|
11
12
|
"X-CSRF-TOKEN": O(),
|
|
12
13
|
Accept: "application/json",
|
|
14
|
+
// Without this a guest fetch gets a 302 to the login page, never an auth status.
|
|
13
15
|
"X-Requested-With": "XMLHttpRequest"
|
|
14
16
|
},
|
|
15
|
-
...
|
|
16
|
-
},
|
|
17
|
+
...g
|
|
18
|
+
}, x = (e, r) => {
|
|
17
19
|
if (e.startsWith("http://") || e.startsWith("https://"))
|
|
18
20
|
return e;
|
|
19
|
-
const t =
|
|
21
|
+
const t = r || w.baseURL || "";
|
|
20
22
|
return t.endsWith("/") && e.startsWith("/") ? `${t}${e.slice(1)}` : t.endsWith("/") || e.startsWith("/") ? `${t}${e}` : `${t}/${e}`;
|
|
21
|
-
}, P = (e) => new Promise((
|
|
23
|
+
}, P = (e) => new Promise((r, t) => {
|
|
22
24
|
setTimeout(() => {
|
|
23
25
|
t(new Error("Request timeout"));
|
|
24
26
|
}, e);
|
|
25
|
-
}),
|
|
26
|
-
setTimeout(
|
|
27
|
-
}), i = async (e,
|
|
28
|
-
|
|
29
|
-
const
|
|
27
|
+
}), R = (e) => new Promise((r) => {
|
|
28
|
+
setTimeout(r, e);
|
|
29
|
+
}), i = async (e, r, t, W = {}) => {
|
|
30
|
+
n.value = null, h.value = !0, c.value = new AbortController();
|
|
31
|
+
const a = { ...w, ...W }, E = x(r, a.baseURL), f = {
|
|
30
32
|
method: e,
|
|
31
|
-
headers: { ...
|
|
32
|
-
signal:
|
|
33
|
-
...
|
|
33
|
+
headers: { ...a.headers },
|
|
34
|
+
signal: c.value.signal,
|
|
35
|
+
...a
|
|
34
36
|
};
|
|
35
|
-
t && ["POST", "PUT", "PATCH"].includes(e) && (t instanceof FormData ? (delete
|
|
36
|
-
const
|
|
37
|
+
t && ["POST", "PUT", "PATCH"].includes(e) && (t instanceof FormData ? (delete f.headers["Content-Type"], f.body = t) : f.body = JSON.stringify(t));
|
|
38
|
+
const v = async (p = 0) => {
|
|
39
|
+
if (window.isSessionExpired)
|
|
40
|
+
throw n.value = { message: "Session expired" }, new Error("Session expired");
|
|
37
41
|
try {
|
|
38
|
-
const o = [fetch(
|
|
39
|
-
|
|
40
|
-
const
|
|
41
|
-
if (!
|
|
42
|
-
const H = `HTTP Error: ${
|
|
43
|
-
throw
|
|
42
|
+
const o = [fetch(E, f)];
|
|
43
|
+
a.timeout && o.push(P(a.timeout));
|
|
44
|
+
const s = await Promise.race(o);
|
|
45
|
+
if (!s.ok) {
|
|
46
|
+
const H = `HTTP Error: ${s.status} ${s.statusText}`, u = new Error(H);
|
|
47
|
+
throw u.status = s.status, u.statusText = s.statusText, u.response = s, u.authReported = X.includes(s.status), u.authReported && Promise.resolve().then(() => s.clone().text().catch(() => "")).then((D) => j(
|
|
48
|
+
s.status,
|
|
49
|
+
D,
|
|
50
|
+
new URL(E, window.location.href).href
|
|
51
|
+
)).catch(() => {
|
|
52
|
+
}), u;
|
|
44
53
|
}
|
|
45
|
-
let
|
|
46
|
-
const l =
|
|
47
|
-
return l != null && l.includes("application/json") ?
|
|
48
|
-
data:
|
|
49
|
-
status:
|
|
50
|
-
statusText:
|
|
51
|
-
headers:
|
|
54
|
+
let d;
|
|
55
|
+
const l = s.headers.get("content-type");
|
|
56
|
+
return l != null && l.includes("application/json") ? d = await s.json() : l != null && l.includes("text/") ? d = await s.text() : d = await s.blob(), {
|
|
57
|
+
data: d,
|
|
58
|
+
status: s.status,
|
|
59
|
+
statusText: s.statusText,
|
|
60
|
+
headers: s.headers
|
|
52
61
|
};
|
|
53
62
|
} catch (o) {
|
|
54
|
-
const
|
|
55
|
-
if (
|
|
56
|
-
return await
|
|
57
|
-
throw o instanceof Error ? o.name === "AbortError" ?
|
|
63
|
+
const s = o instanceof Error && o.name === "AbortError";
|
|
64
|
+
if (p < (a.retry || 0) && !s)
|
|
65
|
+
return await R(a.retryDelay || 1e3), v(p + 1);
|
|
66
|
+
throw o instanceof Error ? o.name === "AbortError" ? n.value = { message: "Request was cancelled" } : n.value = { message: o.message } : n.value = o, o;
|
|
58
67
|
}
|
|
59
68
|
};
|
|
60
69
|
try {
|
|
61
|
-
return await
|
|
70
|
+
return await v();
|
|
62
71
|
} finally {
|
|
63
|
-
|
|
72
|
+
h.value = !1, c.value = null;
|
|
64
73
|
}
|
|
65
|
-
},
|
|
66
|
-
|
|
67
|
-
},
|
|
68
|
-
|
|
74
|
+
}, A = (e, r) => i("GET", e, void 0, r), S = (e, r, t) => i("POST", e, r, t), U = (e, r, t) => i("PUT", e, r, t), C = (e, r, t) => i("PATCH", e, r, t), $ = (e, r) => i("DELETE", e, void 0, r), q = (e) => {
|
|
75
|
+
c.value && c.value.abort(e);
|
|
76
|
+
}, L = () => {
|
|
77
|
+
n.value = null;
|
|
69
78
|
};
|
|
70
79
|
return {
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
error: T(() => a.value),
|
|
80
|
+
loading: b,
|
|
81
|
+
error: T(() => n.value),
|
|
74
82
|
hasError: y,
|
|
75
|
-
// Methods
|
|
76
83
|
request: i,
|
|
77
|
-
get:
|
|
78
|
-
post:
|
|
79
|
-
put:
|
|
80
|
-
patch:
|
|
81
|
-
delete:
|
|
82
|
-
cancel:
|
|
83
|
-
clearError:
|
|
84
|
+
get: A,
|
|
85
|
+
post: S,
|
|
86
|
+
put: U,
|
|
87
|
+
patch: C,
|
|
88
|
+
delete: $,
|
|
89
|
+
cancel: q,
|
|
90
|
+
clearError: L
|
|
84
91
|
};
|
|
85
92
|
};
|
|
86
93
|
export {
|
|
87
|
-
|
|
94
|
+
N as useHttp
|
|
88
95
|
};
|