@useinsider/guido 3.19.0-beta.cac604e → 3.19.0-beta.cd75ff0
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 +39 -37
- package/dist/components/Guido.vue.js +4 -4
- package/dist/components/Guido.vue2.js +83 -75
- package/dist/components/organisms/AutoSaveController.vue2.js +10 -8
- package/dist/components/organisms/base/AuthErrorModal.vue.js +18 -0
- package/dist/components/organisms/base/AuthErrorModal.vue2.js +42 -0
- package/dist/components/organisms/header/EditorActions.vue.js +5 -5
- package/dist/components/organisms/header/EditorActions.vue2.js +83 -46
- 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 +50 -0
- package/dist/components/wrappers/WpDrawer.vue.js +9 -7
- 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 +52 -0
- package/dist/composables/useAutoSave.js +44 -42
- package/dist/composables/useHtmlCompiler.js +37 -26
- package/dist/composables/useHtmlValidator.js +2 -0
- package/dist/composables/useHttp.js +64 -54
- package/dist/composables/useLegacyStrategyConversion.js +23 -19
- package/dist/composables/useSave.js +92 -45
- package/dist/composables/useSaveValidation.js +284 -0
- package/dist/composables/useSaveValidationRollout.js +20 -0
- package/dist/composables/useStripo.js +24 -20
- package/dist/composables/useToaster.js +17 -15
- package/dist/composables/validators/useCouponBlockValidator.js +24 -21
- package/dist/composables/validators/useLiquidValidator.js +15 -15
- package/dist/composables/validators/useUnsubscribeBlockValidator.js +34 -27
- package/dist/config/migrator/index.js +14 -13
- package/dist/config/migrator/recommendationPartnerMigrator.js +50 -0
- package/dist/enums/extensions/recommendationBlock.js +30 -29
- package/dist/enums/save-validation.js +4 -0
- package/dist/extensions/Blocks/Recommendation/block.js +54 -88
- package/dist/extensions/Blocks/Recommendation/store/recommendation.js +32 -51
- package/dist/extensions/Blocks/Recommendation/utils/partnerScope.js +11 -12
- package/dist/guido.css +1 -1
- package/dist/services/settingsApi.js +11 -0
- 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/base/AuthErrorModal.vue.d.ts +2 -0
- 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/components/wrappers/WpModal.vue.d.ts +5 -1
- package/dist/src/composables/useAuthError.d.ts +12 -0
- package/dist/src/composables/useAutoSave.d.ts +4 -1
- package/dist/src/composables/useConfig.d.ts +2 -0
- package/dist/src/composables/useHtmlValidator.d.ts +21 -0
- package/dist/src/composables/useHttp.d.ts +2 -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 +4 -0
- package/dist/src/composables/validators/useCouponBlockValidator.d.ts +3 -0
- package/dist/src/composables/validators/useUnsubscribeBlockValidator.d.ts +10 -0
- package/dist/src/config/migrator/index.d.ts +2 -1
- package/dist/src/config/migrator/recommendationPartnerMigrator.d.ts +19 -0
- package/dist/src/enums/extensions/recommendationBlock.d.ts +1 -1
- package/dist/src/enums/save-validation.d.ts +27 -0
- package/dist/src/extensions/Blocks/Recommendation/block.d.ts +0 -6
- package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +0 -5
- package/dist/src/extensions/Blocks/Recommendation/utils/partnerScope.d.ts +13 -7
- package/dist/src/services/settingsApi.d.ts +6 -0
- package/dist/src/stores/config.d.ts +32 -0
- package/dist/src/stores/save-validation.d.ts +22 -0
- package/dist/src/stores/setup-settings.d.ts +4 -0
- package/dist/src/utils/templatePreparation.d.ts +30 -0
- package/dist/stores/config.js +84 -67
- package/dist/stores/save-validation.js +30 -0
- package/dist/stores/setup-settings.js +10 -0
- package/dist/utils/templatePreparation.js +39 -36
- package/package.json +1 -1
|
@@ -1,77 +1,114 @@
|
|
|
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
|
-
|
|
1
|
+
import { defineComponent as I, computed as u, ref as c } from "vue";
|
|
2
|
+
import { useActionsApi as P } from "../../../composables/useActionsApi.js";
|
|
3
|
+
import { useConfig as j } from "../../../composables/useConfig.js";
|
|
4
|
+
import { useExport as G } from "../../../composables/useExport.js";
|
|
5
|
+
import { useTestEmailClick as J } from "../../../composables/useGuidoActions.js";
|
|
6
|
+
import { useHtmlCompiler as K } from "../../../composables/useHtmlCompiler.js";
|
|
7
|
+
import { useSave as N } from "../../../composables/useSave.js";
|
|
8
|
+
import { useSaveValidation as Q } from "../../../composables/useSaveValidation.js";
|
|
9
|
+
import { useSaveValidationRollout as U } from "../../../composables/useSaveValidationRollout.js";
|
|
10
|
+
import { useToaster as W } from "../../../composables/useToaster.js";
|
|
11
|
+
import { useTranslations as X } from "../../../composables/useTranslations.js";
|
|
12
|
+
import { useVersionHistoryApi as Y } from "../../../composables/useVersionHistoryApi.js";
|
|
13
|
+
import { useLiquidValidator as Z } from "../../../composables/validators/useLiquidValidator.js";
|
|
14
|
+
import { ToasterTypeOptions as $ } from "../../../enums/toaster.js";
|
|
15
|
+
import { useEditorStore as tt } from "../../../stores/editor.js";
|
|
16
|
+
import { useSaveValidationStore as et } from "../../../stores/save-validation.js";
|
|
17
|
+
import { useTemplateStore as ot } from "../../../stores/template.js";
|
|
18
|
+
import { getTooltipOptions as rt } from "../../../utils/tooltipUtils.js";
|
|
19
|
+
import { InButtonV2 as it } from "@useinsider/design-system-vue";
|
|
20
|
+
import { storeToRefs as st } from "pinia";
|
|
21
|
+
import at from "./MigrationConfirmModal.vue.js";
|
|
22
|
+
const Ot = /* @__PURE__ */ I({
|
|
19
23
|
__name: "EditorActions",
|
|
20
|
-
setup(
|
|
21
|
-
const { config:
|
|
24
|
+
setup(nt, { expose: b }) {
|
|
25
|
+
const { config: p, isFeatureEnabled: f } = j(), { exportHtml: d } = G(), { save: v } = N(), { validateCurrentTemplate: y } = Q(), { isEnabled: s } = U(), { showToaster: S, hideToaster: g, handleError: i } = W(), { openVersionHistory: h, closeVersionHistory: T } = Y(), { getCompiledEmail: V } = P(), { compileHtml: E } = K(), { validateLiquidSyntax: H } = Z(), e = tt(), w = et(), x = ot(), { hasMigrations: C } = st(x), r = X(), k = u(() => s.value ? r("email-editor.save-and-continue") : "Save"), a = c(!1), n = c(!1), _ = c(), l = J(), q = () => {
|
|
22
26
|
if (e.isVersionHistoryOpen) {
|
|
23
|
-
|
|
27
|
+
T();
|
|
24
28
|
return;
|
|
25
29
|
}
|
|
26
|
-
|
|
27
|
-
},
|
|
28
|
-
|
|
29
|
-
},
|
|
30
|
+
h();
|
|
31
|
+
}, B = async () => {
|
|
32
|
+
a.value = !0, await d(), a.value = !1;
|
|
33
|
+
}, L = () => {
|
|
30
34
|
e.isSaveAsTemplateDrawerOpen = !0;
|
|
31
|
-
},
|
|
35
|
+
}, R = u(() => e.isVersionHistoryOpen ? r("newsletter.close-version-history") : r("newsletter.version-history")), D = u(
|
|
32
36
|
() => {
|
|
33
37
|
var t, o;
|
|
34
|
-
return ((o = (t =
|
|
38
|
+
return ((o = (t = p.value) == null ? void 0 : t.features) == null ? void 0 : o.versionHistory) && !e.isPreviewModeOpen;
|
|
35
39
|
}
|
|
36
|
-
),
|
|
37
|
-
|
|
40
|
+
), A = async (t) => {
|
|
41
|
+
n.value = !0, t || (e.loadingStatus = !0);
|
|
38
42
|
let o;
|
|
39
43
|
try {
|
|
40
|
-
o = await
|
|
41
|
-
} catch (
|
|
42
|
-
|
|
44
|
+
o = await v(t);
|
|
45
|
+
} catch (M) {
|
|
46
|
+
i(M, "Failed to save template");
|
|
43
47
|
} finally {
|
|
44
|
-
|
|
48
|
+
n.value = !1, !t && !o && (e.loadingStatus = !1);
|
|
45
49
|
}
|
|
46
50
|
return o;
|
|
47
|
-
},
|
|
51
|
+
}, O = (t) => {
|
|
48
52
|
var o;
|
|
49
|
-
if (!t &&
|
|
50
|
-
(o =
|
|
53
|
+
if (!t && C.value) {
|
|
54
|
+
(o = _.value) == null || o.open();
|
|
51
55
|
return;
|
|
52
56
|
}
|
|
53
|
-
return
|
|
57
|
+
return A(t);
|
|
58
|
+
}, m = async () => {
|
|
59
|
+
e.loadingStatus = !0;
|
|
60
|
+
try {
|
|
61
|
+
return await y();
|
|
62
|
+
} catch (t) {
|
|
63
|
+
return i(t, "Failed to prepare test email"), null;
|
|
64
|
+
} finally {
|
|
65
|
+
e.loadingStatus = !1;
|
|
66
|
+
}
|
|
54
67
|
}, F = async () => {
|
|
55
|
-
|
|
68
|
+
const t = await m();
|
|
69
|
+
t != null && t.length ? w.open(t, "test") : t && g();
|
|
70
|
+
}, z = async () => {
|
|
71
|
+
if (s.value) {
|
|
72
|
+
const t = await m();
|
|
73
|
+
if (!t)
|
|
74
|
+
return;
|
|
75
|
+
if (t.length) {
|
|
76
|
+
S({
|
|
77
|
+
type: $.Error,
|
|
78
|
+
message: r("email-editor.validation-errors-found"),
|
|
79
|
+
actionButton: {
|
|
80
|
+
text: r("email-editor.check-errors"),
|
|
81
|
+
onClick: () => {
|
|
82
|
+
F();
|
|
83
|
+
}
|
|
84
|
+
},
|
|
85
|
+
autoHide: !1
|
|
86
|
+
});
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
l();
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
if (f("liquidSyntax")) {
|
|
56
93
|
e.loadingStatus = !0;
|
|
57
94
|
try {
|
|
58
|
-
const { html: t } = await
|
|
59
|
-
if (!await
|
|
95
|
+
const { html: t } = await V({ minimize: !0, resetDataSavedFlag: !1 }), { compiledHtml: o } = E(t);
|
|
96
|
+
if (!await H(o))
|
|
60
97
|
return;
|
|
61
98
|
} catch (t) {
|
|
62
|
-
|
|
99
|
+
i(t, "Failed to prepare test email");
|
|
63
100
|
return;
|
|
64
101
|
} finally {
|
|
65
102
|
e.loadingStatus = !1;
|
|
66
103
|
}
|
|
67
104
|
}
|
|
68
|
-
|
|
105
|
+
l();
|
|
69
106
|
};
|
|
70
|
-
return
|
|
71
|
-
handleSave:
|
|
72
|
-
}), { __sfc: !0, config:
|
|
107
|
+
return b({
|
|
108
|
+
handleSave: O
|
|
109
|
+
}), { __sfc: !0, config: p, isFeatureEnabled: f, exportHtml: d, save: v, validateCurrentTemplate: y, isEnabled: s, showToaster: S, hideToaster: g, handleError: i, openVersionHistory: h, closeVersionHistory: T, getCompiledEmail: V, compileHtml: E, validateLiquidSyntax: H, editorStore: e, saveValidationStore: w, templateStore: x, hasMigrations: C, trans: r, saveLabel: k, isExporting: a, isSaving: n, migrationModalRef: _, testEmailClick: l, handleVersionHistory: q, handleExport: B, handleSaveAs: L, versionHistoryTooltipText: R, isVersionHistoryButtonVisible: D, executeSave: A, handleSave: O, collectTestErrors: m, openTestErrors: F, handleTestEmail: z, getTooltipOptions: rt, InButtonV2: it, MigrationConfirmModal: at };
|
|
73
110
|
}
|
|
74
111
|
});
|
|
75
112
|
export {
|
|
76
|
-
|
|
113
|
+
Ot as default
|
|
77
114
|
};
|
|
@@ -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 o = this, r = o._self._c, t = o._self._setupProxy;
|
|
6
|
+
return r(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 } }, [r("div", { staticClass: "d-f f-d-c validation-error-list" }, o._l(t.rows, function(e, n) {
|
|
7
|
+
return r("div", { key: n, staticClass: "d-f a-i-c validation-error-row" }, [r(t.InIcons, { staticClass: "validation-error-row__icon i-c-12", attrs: { name: "filled-caution-triangle" } }), r("span", { staticClass: "validation-error-row__text", domProps: { innerHTML: o._s(e) } })], 1);
|
|
8
|
+
}), 0)]);
|
|
9
|
+
}, l = [], d = /* @__PURE__ */ s(
|
|
10
|
+
a,
|
|
11
|
+
i,
|
|
12
|
+
l,
|
|
13
|
+
!1,
|
|
14
|
+
null,
|
|
15
|
+
"e48cebe9"
|
|
16
|
+
);
|
|
17
|
+
const f = d.exports;
|
|
18
|
+
export {
|
|
19
|
+
f as default
|
|
20
|
+
};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { defineComponent as c, ref as f, computed as s } from "vue";
|
|
2
|
+
import v from "../../wrappers/WpDrawer.vue.js";
|
|
3
|
+
import { useSave as S } from "../../../composables/useSave.js";
|
|
4
|
+
import { useToaster as g } from "../../../composables/useToaster.js";
|
|
5
|
+
import { useTranslations as y } from "../../../composables/useTranslations.js";
|
|
6
|
+
import { useConfigStore as h } from "../../../stores/config.js";
|
|
7
|
+
import { useEditorStore as _ } from "../../../stores/editor.js";
|
|
8
|
+
import { useSaveValidationStore as w } from "../../../stores/save-validation.js";
|
|
9
|
+
import { escapeHtml as C } from "../../../utils/htmlEscape.js";
|
|
10
|
+
import { InIcons as E } from "@useinsider/design-system-vue";
|
|
11
|
+
const H = /* @__PURE__ */ c({
|
|
12
|
+
__name: "ValidationErrorDrawer",
|
|
13
|
+
setup(T) {
|
|
14
|
+
const r = y(), e = w(), a = _(), n = h(), { saveWithErrors: i } = S(), { handleError: l } = g(), o = f(!1), m = s(() => {
|
|
15
|
+
const t = {
|
|
16
|
+
primaryButton: {
|
|
17
|
+
styling: "solid",
|
|
18
|
+
type: "primary",
|
|
19
|
+
labelText: r("email-editor.update-design")
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
return n.allowSaveWithErrors && e.intent !== "test" && (t.secondaryButton = {
|
|
23
|
+
styling: "solid",
|
|
24
|
+
type: "subtle-primary",
|
|
25
|
+
labelText: r("email-editor.save-and-continue"),
|
|
26
|
+
loadingStatus: o.value
|
|
27
|
+
}), t;
|
|
28
|
+
}), u = s(() => e.errors.map((t) => {
|
|
29
|
+
const p = t.detail ? ` (${C(t.detail)})` : "";
|
|
30
|
+
return `${t.message}${p}`;
|
|
31
|
+
})), d = s(() => `${r("email-editor.validation-errors")} (${u.value.length})`);
|
|
32
|
+
return { __sfc: !0, trans: r, store: e, editorStore: a, configStore: n, saveWithErrors: i, handleError: l, isSaving: o, footerButtonGroupOptions: m, rows: u, titleText: d, handleClose: () => {
|
|
33
|
+
e.isDrawerOpen && e.close();
|
|
34
|
+
}, handleSaveAndContinue: async () => {
|
|
35
|
+
if (!o.value) {
|
|
36
|
+
o.value = !0, a.loadingStatus = !0;
|
|
37
|
+
try {
|
|
38
|
+
await i() ? e.close() : a.loadingStatus = !1;
|
|
39
|
+
} catch (t) {
|
|
40
|
+
l(t, "Failed to save template"), a.loadingStatus = !1;
|
|
41
|
+
} finally {
|
|
42
|
+
o.value = !1;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}, WpDrawer: v, InIcons: E };
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
export {
|
|
49
|
+
H as default
|
|
50
|
+
};
|
|
@@ -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
|
}
|
|
@@ -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,52 @@
|
|
|
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
|
+
a as isPanelOrigin,
|
|
50
|
+
R as reportAuthError,
|
|
51
|
+
T as useAuthError
|
|
52
|
+
};
|
|
@@ -1,76 +1,78 @@
|
|
|
1
|
-
import { useConfig as
|
|
2
|
-
import { useEditorLock as
|
|
3
|
-
import { useAutosaveStore as
|
|
4
|
-
import { useEditorStore as
|
|
5
|
-
import { computed as
|
|
6
|
-
const
|
|
7
|
-
const { isFeatureEnabled:
|
|
8
|
-
let
|
|
9
|
-
const
|
|
10
|
-
() =>
|
|
11
|
-
),
|
|
12
|
-
hasChanges:
|
|
13
|
-
isInSaveableState:
|
|
1
|
+
import { useConfig as p } from "./useConfig.js";
|
|
2
|
+
import { useEditorLock as y } from "./useEditorLock.js";
|
|
3
|
+
import { useAutosaveStore as I, AUTOSAVE_STATUS as a } from "../stores/autosave.js";
|
|
4
|
+
import { useEditorStore as L } from "../stores/editor.js";
|
|
5
|
+
import { computed as w, watch as V, onUnmounted as k } from "vue";
|
|
6
|
+
const D = 18e4, b = 6e4, _ = (g, { clearsChanges: h = () => !0 } = {}) => {
|
|
7
|
+
const { isFeatureEnabled: m } = p(), s = L(), t = I(), { isEditorBusy: f } = y();
|
|
8
|
+
let o = null, l = 0, u = -1;
|
|
9
|
+
const d = w(
|
|
10
|
+
() => m("autosave") && t.isOn
|
|
11
|
+
), A = () => s.hasChanges && s.isInSaveableState && s.changeSeq !== u, E = () => ({
|
|
12
|
+
hasChanges: s.hasChanges,
|
|
13
|
+
isInSaveableState: s.isInSaveableState,
|
|
14
|
+
isUnchangedSinceLastSave: s.changeSeq === u
|
|
14
15
|
}), r = async (e) => {
|
|
15
|
-
if (!
|
|
16
|
+
if (!d.value) {
|
|
16
17
|
console.debug("guido:autosave:skipped", { trigger: e, reason: "not-active" });
|
|
17
18
|
return;
|
|
18
19
|
}
|
|
19
|
-
if (!
|
|
20
|
-
console.debug("guido:autosave:skipped", { trigger: e, reason: "gates-blocked", gates:
|
|
20
|
+
if (!A()) {
|
|
21
|
+
console.debug("guido:autosave:skipped", { trigger: e, reason: "gates-blocked", gates: E() });
|
|
21
22
|
return;
|
|
22
23
|
}
|
|
23
|
-
if (t.status ===
|
|
24
|
+
if (t.status === a.SAVING) {
|
|
24
25
|
console.debug("guido:autosave:skipped", { trigger: e, reason: "already-saving" });
|
|
25
26
|
return;
|
|
26
27
|
}
|
|
27
|
-
if (
|
|
28
|
+
if (f()) {
|
|
28
29
|
console.debug("guido:autosave:skipped", { trigger: e, reason: "editor-busy" });
|
|
29
30
|
return;
|
|
30
31
|
}
|
|
31
|
-
console.debug("guido:autosave:save-start", { trigger: e }), t.status =
|
|
32
|
+
console.debug("guido:autosave:save-start", { trigger: e }), t.status = a.SAVING, e === "visibility" && (l = Date.now());
|
|
33
|
+
const n = s.changeSeq;
|
|
32
34
|
try {
|
|
33
|
-
if (await
|
|
34
|
-
console.debug("guido:autosave:blocked", { trigger: e, reason: "save-returned-undefined" }), t.status =
|
|
35
|
+
if (await g() === void 0) {
|
|
36
|
+
console.debug("guido:autosave:blocked", { trigger: e, reason: "save-returned-undefined" }), t.status = a.ERROR;
|
|
35
37
|
return;
|
|
36
38
|
}
|
|
37
|
-
|
|
38
|
-
} catch (
|
|
39
|
-
console.debug("guido:autosave:error", { trigger: e, error:
|
|
39
|
+
u = n, h() && (s.hasChanges = !1), t.status = a.SAVED, t.lastSavedAt = /* @__PURE__ */ new Date(), console.debug("guido:autosave:save-complete", { trigger: e, at: t.lastSavedAt });
|
|
40
|
+
} catch (S) {
|
|
41
|
+
console.debug("guido:autosave:error", { trigger: e, error: S }), t.status = a.ERROR;
|
|
40
42
|
}
|
|
41
|
-
},
|
|
43
|
+
}, i = () => {
|
|
42
44
|
const { visibilityState: e } = document;
|
|
43
45
|
if (console.debug("guido:autosave:visibility-change", {
|
|
44
46
|
visibilityState: e,
|
|
45
|
-
isActive:
|
|
47
|
+
isActive: d.value
|
|
46
48
|
}), e !== "hidden")
|
|
47
49
|
return;
|
|
48
|
-
const
|
|
49
|
-
if (
|
|
50
|
+
const n = Date.now() - l;
|
|
51
|
+
if (n < b) {
|
|
50
52
|
console.debug("guido:autosave:visibility-debounced", {
|
|
51
|
-
sinceLastMs:
|
|
52
|
-
debounceMs:
|
|
53
|
+
sinceLastMs: n,
|
|
54
|
+
debounceMs: b
|
|
53
55
|
});
|
|
54
56
|
return;
|
|
55
57
|
}
|
|
56
|
-
|
|
57
|
-
},
|
|
58
|
-
|
|
59
|
-
},
|
|
60
|
-
document.removeEventListener("visibilitychange",
|
|
58
|
+
r("visibility");
|
|
59
|
+
}, c = () => {
|
|
60
|
+
o && (clearInterval(o), o = null);
|
|
61
|
+
}, v = () => {
|
|
62
|
+
document.removeEventListener("visibilitychange", i), window.removeEventListener("pagehide", i);
|
|
61
63
|
};
|
|
62
|
-
|
|
63
|
-
|
|
64
|
+
V(
|
|
65
|
+
d,
|
|
64
66
|
(e) => {
|
|
65
|
-
console.debug("guido:autosave:active-changed", { active: e }), e ? (
|
|
67
|
+
console.debug("guido:autosave:active-changed", { active: e }), e ? (c(), o = setInterval(() => {
|
|
66
68
|
console.debug("guido:autosave:interval-tick"), r("interval");
|
|
67
|
-
},
|
|
69
|
+
}, D), document.addEventListener("visibilitychange", i), window.addEventListener("pagehide", i)) : (c(), v(), t.status = a.IDLE);
|
|
68
70
|
},
|
|
69
71
|
{ immediate: !0 }
|
|
70
|
-
),
|
|
71
|
-
|
|
72
|
+
), k(() => {
|
|
73
|
+
c(), v(), t.status = a.IDLE, t.lastSavedAt = null;
|
|
72
74
|
});
|
|
73
75
|
};
|
|
74
76
|
export {
|
|
75
|
-
|
|
77
|
+
_ as useAutoSave
|
|
76
78
|
};
|