@useinsider/guido 3.18.0-beta.599df29 → 3.18.0-beta.6817b07
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 +83 -85
- 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 +72 -54
- 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/useActionsApi.js +67 -82
- package/dist/composables/useAutoSave.js +26 -31
- package/dist/composables/useGuidoStateBridge.js +31 -37
- package/dist/composables/useHtmlCompiler.js +37 -26
- package/dist/composables/useHtmlValidator.js +2 -0
- package/dist/composables/useSave.js +89 -47
- 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 +41 -34
- 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/templatePreparation.d.ts +30 -0
- package/dist/stores/config.js +39 -22
- package/dist/stores/save-validation.js +30 -0
- package/dist/utils/templatePreparation.js +28 -25
- package/package.json +1 -1
- package/dist/composables/useEditorLock.js +0 -20
- package/dist/src/composables/useEditorLock.d.ts +0 -10
|
@@ -1,79 +1,97 @@
|
|
|
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 R, computed as l, ref as m } from "vue";
|
|
2
|
+
import { useActionsApi as D } from "../../../composables/useActionsApi.js";
|
|
3
|
+
import { useConfig as F } from "../../../composables/useConfig.js";
|
|
4
|
+
import { useExport as z } from "../../../composables/useExport.js";
|
|
5
|
+
import { useTestEmailClick as I } from "../../../composables/useGuidoActions.js";
|
|
6
|
+
import { useHtmlCompiler as P } from "../../../composables/useHtmlCompiler.js";
|
|
7
|
+
import { useSave as W } from "../../../composables/useSave.js";
|
|
8
|
+
import { useSaveValidation as j } from "../../../composables/useSaveValidation.js";
|
|
9
|
+
import { useSaveValidationRollout as G } from "../../../composables/useSaveValidationRollout.js";
|
|
10
|
+
import { useToaster as J } from "../../../composables/useToaster.js";
|
|
11
|
+
import { useTranslations as K } from "../../../composables/useTranslations.js";
|
|
12
|
+
import { useVersionHistoryApi as N } from "../../../composables/useVersionHistoryApi.js";
|
|
13
|
+
import { useLiquidValidator as Q } from "../../../composables/validators/useLiquidValidator.js";
|
|
14
|
+
import { ToasterTypeOptions as U } from "../../../enums/toaster.js";
|
|
15
|
+
import { useConfigStore as X } from "../../../stores/config.js";
|
|
16
|
+
import { useEditorStore as Y } from "../../../stores/editor.js";
|
|
17
|
+
import { useSaveValidationStore as Z } from "../../../stores/save-validation.js";
|
|
18
|
+
import { useTemplateStore as $ } from "../../../stores/template.js";
|
|
19
|
+
import { getTooltipOptions as tt } from "../../../utils/tooltipUtils.js";
|
|
20
|
+
import { InButtonV2 as ot } from "@useinsider/design-system-vue";
|
|
21
|
+
import { storeToRefs as et } from "pinia";
|
|
22
|
+
import rt from "./MigrationConfirmModal.vue.js";
|
|
23
|
+
const At = /* @__PURE__ */ R({
|
|
19
24
|
__name: "EditorActions",
|
|
20
|
-
setup(
|
|
21
|
-
const { config:
|
|
25
|
+
setup(it, { expose: A }) {
|
|
26
|
+
const { config: u, isFeatureEnabled: c } = F(), { exportHtml: f } = z(), { save: p } = W(), { validateCurrentTemplate: d } = j(), { isEnabled: i } = G(), { showToaster: v } = J(), { openVersionHistory: S, closeVersionHistory: y } = N(), { getCompiledEmail: g } = D(), { compileHtml: h } = P(), { validateLiquidSyntax: V } = Q(), T = X(), e = Y(), w = Z(), H = $(), { hasMigrations: E } = et(H), r = K(), O = l(() => i.value && T.allowSaveWithErrors ? r("email-editor.save-and-continue") : "Save"), s = m(!1), a = m(!1), x = m(), n = I(), M = () => {
|
|
22
27
|
if (e.isVersionHistoryOpen) {
|
|
23
|
-
|
|
28
|
+
y();
|
|
24
29
|
return;
|
|
25
30
|
}
|
|
26
|
-
|
|
27
|
-
},
|
|
28
|
-
|
|
29
|
-
},
|
|
31
|
+
S();
|
|
32
|
+
}, b = async () => {
|
|
33
|
+
s.value = !0, await f(), s.value = !1;
|
|
34
|
+
}, k = () => {
|
|
30
35
|
e.isSaveAsTemplateDrawerOpen = !0;
|
|
31
|
-
},
|
|
36
|
+
}, q = l(() => e.isVersionHistoryOpen ? r("newsletter.close-version-history") : r("newsletter.version-history")), B = l(
|
|
32
37
|
() => {
|
|
33
38
|
var t, o;
|
|
34
|
-
return ((o = (t =
|
|
39
|
+
return ((o = (t = u.value) == null ? void 0 : t.features) == null ? void 0 : o.versionHistory) && !e.isPreviewModeOpen;
|
|
35
40
|
}
|
|
36
|
-
),
|
|
41
|
+
), C = async (t) => {
|
|
37
42
|
a.value = !0, t || (e.loadingStatus = !0);
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
} catch (n) {
|
|
42
|
-
if (t)
|
|
43
|
-
throw n;
|
|
44
|
-
r(n, "Failed to save template");
|
|
45
|
-
} finally {
|
|
46
|
-
a.value = !1, !t && !o && (e.loadingStatus = !1);
|
|
47
|
-
}
|
|
48
|
-
return o;
|
|
49
|
-
}, T = (t) => {
|
|
43
|
+
const o = await p(t);
|
|
44
|
+
return a.value = !1, !t && !o && (e.loadingStatus = !1), o;
|
|
45
|
+
}, _ = (t) => {
|
|
50
46
|
var o;
|
|
51
|
-
if (!t &&
|
|
52
|
-
(o =
|
|
47
|
+
if (!t && E.value) {
|
|
48
|
+
(o = x.value) == null || o.open();
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
return C(t);
|
|
52
|
+
}, L = async () => {
|
|
53
|
+
if (i.value) {
|
|
54
|
+
e.loadingStatus = !0;
|
|
55
|
+
let t = [];
|
|
56
|
+
try {
|
|
57
|
+
t = await d();
|
|
58
|
+
} catch (o) {
|
|
59
|
+
console.warn("Test-path validation failed; sending without the drawer.", o);
|
|
60
|
+
} finally {
|
|
61
|
+
e.loadingStatus = !1;
|
|
62
|
+
}
|
|
63
|
+
if (t.length) {
|
|
64
|
+
v({
|
|
65
|
+
type: U.Error,
|
|
66
|
+
message: r("email-editor.validation-errors-found"),
|
|
67
|
+
actionButton: {
|
|
68
|
+
text: r("email-editor.check-errors"),
|
|
69
|
+
onClick: () => w.open(t, "test")
|
|
70
|
+
},
|
|
71
|
+
autoHide: !1
|
|
72
|
+
});
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
n();
|
|
53
76
|
return;
|
|
54
77
|
}
|
|
55
|
-
return E(t);
|
|
56
|
-
}, F = async () => {
|
|
57
78
|
if (c("liquidSyntax")) {
|
|
58
79
|
e.loadingStatus = !0;
|
|
59
80
|
try {
|
|
60
|
-
const { html: t } = await
|
|
61
|
-
if (!await
|
|
81
|
+
const { html: t } = await g({ minimize: !0, resetDataSavedFlag: !1 }), { compiledHtml: o } = h(t);
|
|
82
|
+
if (!await V(o))
|
|
62
83
|
return;
|
|
63
|
-
} catch (t) {
|
|
64
|
-
r(t, "Failed to prepare test email");
|
|
65
|
-
return;
|
|
66
84
|
} finally {
|
|
67
85
|
e.loadingStatus = !1;
|
|
68
86
|
}
|
|
69
87
|
}
|
|
70
|
-
|
|
88
|
+
n();
|
|
71
89
|
};
|
|
72
|
-
return
|
|
73
|
-
handleSave:
|
|
74
|
-
}), { __sfc: !0, config:
|
|
90
|
+
return A({
|
|
91
|
+
handleSave: _
|
|
92
|
+
}), { __sfc: !0, config: u, isFeatureEnabled: c, exportHtml: f, save: p, validateCurrentTemplate: d, isEnabled: i, showToaster: v, openVersionHistory: S, closeVersionHistory: y, getCompiledEmail: g, compileHtml: h, validateLiquidSyntax: V, configStore: T, editorStore: e, saveValidationStore: w, templateStore: H, hasMigrations: E, trans: r, saveLabel: O, isExporting: s, isSaving: a, migrationModalRef: x, testEmailClick: n, handleVersionHistory: M, handleExport: b, handleSaveAs: k, versionHistoryTooltipText: q, isVersionHistoryButtonVisible: B, executeSave: C, handleSave: _, handleTestEmail: L, getTooltipOptions: tt, InButtonV2: ot, MigrationConfirmModal: rt };
|
|
75
93
|
}
|
|
76
94
|
});
|
|
77
95
|
export {
|
|
78
|
-
|
|
96
|
+
At as default
|
|
79
97
|
};
|
|
@@ -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,68 +1,52 @@
|
|
|
1
|
-
import { filterAmpErrors as
|
|
2
|
-
import { useToaster as
|
|
3
|
-
const
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
]
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
r ? a(r) : e({
|
|
38
|
-
html: C,
|
|
39
|
-
ampHtml: f,
|
|
40
|
-
ampErrors: v(S ?? []),
|
|
41
|
-
displayConditions: g
|
|
42
|
-
});
|
|
43
|
-
},
|
|
44
|
-
...o
|
|
45
|
-
};
|
|
46
|
-
window.StripoEditorApi.actionsApi.compileEmail(c);
|
|
47
|
-
}
|
|
48
|
-
);
|
|
1
|
+
import { filterAmpErrors as T } from "../utils/ampErrorFilter.js";
|
|
2
|
+
import { useToaster as A } from "./useToaster.js";
|
|
3
|
+
const p = 1e4, D = () => {
|
|
4
|
+
const { handleError: r } = A(), l = (t = {}) => new Promise((e, a) => {
|
|
5
|
+
const o = { ...{
|
|
6
|
+
minimize: !0,
|
|
7
|
+
utmEntity: {
|
|
8
|
+
utmSource: "",
|
|
9
|
+
utmMedium: "",
|
|
10
|
+
utmCampaign: "",
|
|
11
|
+
utmContent: "",
|
|
12
|
+
utmTerm: "",
|
|
13
|
+
customUtms: [
|
|
14
|
+
{
|
|
15
|
+
name1: "val1",
|
|
16
|
+
name2: "val2"
|
|
17
|
+
}
|
|
18
|
+
]
|
|
19
|
+
},
|
|
20
|
+
mergeTags: ["Tag1", "Tag2"],
|
|
21
|
+
forceAmp: !1,
|
|
22
|
+
resetDataSavedFlag: !1,
|
|
23
|
+
disableLineHeightsReplace: !0
|
|
24
|
+
}, ...t }, n = {
|
|
25
|
+
callback: (m, d, c, u, w) => {
|
|
26
|
+
m ? a(m) : e({
|
|
27
|
+
html: d,
|
|
28
|
+
ampHtml: c,
|
|
29
|
+
ampErrors: T(u ?? []),
|
|
30
|
+
displayConditions: w
|
|
31
|
+
});
|
|
32
|
+
},
|
|
33
|
+
...o
|
|
34
|
+
};
|
|
35
|
+
window.StripoEditorApi.actionsApi.compileEmail(n);
|
|
36
|
+
});
|
|
49
37
|
return {
|
|
50
38
|
getCompiledEmail: l,
|
|
51
|
-
getTemplateData: () =>
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
});
|
|
63
|
-
window.StripoEditorApi.actionsApi.getTemplateData(e);
|
|
64
|
-
}
|
|
65
|
-
),
|
|
39
|
+
getTemplateData: () => new Promise((t) => {
|
|
40
|
+
const e = ({ html: a, css: i, width: o, height: s, utmParams: n, syncModulesIds: m }) => t({
|
|
41
|
+
html: a,
|
|
42
|
+
css: i,
|
|
43
|
+
width: o,
|
|
44
|
+
height: s,
|
|
45
|
+
utmParams: n,
|
|
46
|
+
syncModulesIds: m
|
|
47
|
+
});
|
|
48
|
+
window.StripoEditorApi.actionsApi.getTemplateData(e);
|
|
49
|
+
}),
|
|
66
50
|
activateCustomViewStyles: (t = !0) => {
|
|
67
51
|
window.StripoEditorApi.actionsApi.activateCustomViewStyles(t);
|
|
68
52
|
},
|
|
@@ -81,7 +65,7 @@ const D = 1e4, d = 3e4, s = (n, l, u) => new Promise((T, m) => {
|
|
|
81
65
|
displayConditions: a
|
|
82
66
|
};
|
|
83
67
|
} catch (e) {
|
|
84
|
-
return
|
|
68
|
+
return r(e, "Error loading preview"), {
|
|
85
69
|
html: "",
|
|
86
70
|
ampHtml: "",
|
|
87
71
|
ampErrors: [],
|
|
@@ -97,33 +81,34 @@ const D = 1e4, d = 3e4, s = (n, l, u) => new Promise((T, m) => {
|
|
|
97
81
|
}
|
|
98
82
|
try {
|
|
99
83
|
window.StripoEditorApi.actionsApi.updateTimerInClonedTemplate((i, o) => {
|
|
100
|
-
i ? (
|
|
84
|
+
i ? (r(i, "Failed to update timer in cloned template"), t(null)) : t(o || null);
|
|
101
85
|
});
|
|
102
86
|
} catch (i) {
|
|
103
|
-
|
|
87
|
+
r(i, "Failed to call updateTimerInClonedTemplate"), t(null);
|
|
104
88
|
}
|
|
105
89
|
}),
|
|
106
90
|
updateHtmlAndCss: (t, e) => {
|
|
107
91
|
const { actionsApi: a } = window.StripoEditorApi;
|
|
108
|
-
return
|
|
109
|
-
|
|
92
|
+
return new Promise((i, o) => {
|
|
93
|
+
const s = new Error(
|
|
94
|
+
`updateHtmlAndCss did not report completion within ${p}ms`
|
|
95
|
+
), n = setTimeout(() => o(s), p);
|
|
96
|
+
a.updateHtmlAndCss(t, e, () => {
|
|
97
|
+
clearTimeout(n), i();
|
|
98
|
+
});
|
|
110
99
|
});
|
|
111
100
|
},
|
|
112
|
-
editorSave: () =>
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
t(!0);
|
|
122
|
-
});
|
|
123
|
-
}
|
|
124
|
-
)
|
|
101
|
+
editorSave: () => new Promise((t) => {
|
|
102
|
+
window.StripoEditorApi.actionsApi.save((e) => {
|
|
103
|
+
if (e) {
|
|
104
|
+
r(e, "Failed to save template"), t(!1);
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
t(!0);
|
|
108
|
+
});
|
|
109
|
+
})
|
|
125
110
|
};
|
|
126
111
|
};
|
|
127
112
|
export {
|
|
128
|
-
|
|
113
|
+
D as useActionsApi
|
|
129
114
|
};
|
|
@@ -1,22 +1,21 @@
|
|
|
1
|
-
import { useConfig as
|
|
2
|
-
import { useEditorLock as p } from "./useEditorLock.js";
|
|
1
|
+
import { useConfig as m } from "./useConfig.js";
|
|
3
2
|
import { useAutosaveStore as A, AUTOSAVE_STATUS as s } from "../stores/autosave.js";
|
|
4
|
-
import { useEditorStore as
|
|
5
|
-
import { computed as
|
|
6
|
-
const
|
|
7
|
-
const { isFeatureEnabled: S } =
|
|
3
|
+
import { useEditorStore as E } from "../stores/editor.js";
|
|
4
|
+
import { computed as f, watch as p, onUnmounted as y } from "vue";
|
|
5
|
+
const I = 18e4, r = 6e4, T = (b) => {
|
|
6
|
+
const { isFeatureEnabled: S } = m(), a = E(), t = A();
|
|
8
7
|
let i = null, c = 0;
|
|
9
|
-
const u =
|
|
8
|
+
const u = f(
|
|
10
9
|
() => S("autosave") && t.isOn
|
|
11
|
-
),
|
|
12
|
-
hasChanges:
|
|
13
|
-
isInSaveableState:
|
|
14
|
-
}),
|
|
10
|
+
), g = () => a.hasChanges && a.isInSaveableState, h = () => ({
|
|
11
|
+
hasChanges: a.hasChanges,
|
|
12
|
+
isInSaveableState: a.isInSaveableState
|
|
13
|
+
}), l = async (e) => {
|
|
15
14
|
if (!u.value) {
|
|
16
15
|
console.debug("guido:autosave:skipped", { trigger: e, reason: "not-active" });
|
|
17
16
|
return;
|
|
18
17
|
}
|
|
19
|
-
if (!
|
|
18
|
+
if (!g()) {
|
|
20
19
|
console.debug("guido:autosave:skipped", { trigger: e, reason: "gates-blocked", gates: h() });
|
|
21
20
|
return;
|
|
22
21
|
}
|
|
@@ -24,19 +23,15 @@ const w = 18e4, v = 6e4, R = (b) => {
|
|
|
24
23
|
console.debug("guido:autosave:skipped", { trigger: e, reason: "already-saving" });
|
|
25
24
|
return;
|
|
26
25
|
}
|
|
27
|
-
if (g()) {
|
|
28
|
-
console.debug("guido:autosave:skipped", { trigger: e, reason: "editor-busy" });
|
|
29
|
-
return;
|
|
30
|
-
}
|
|
31
26
|
console.debug("guido:autosave:save-start", { trigger: e }), t.status = s.SAVING;
|
|
32
27
|
try {
|
|
33
28
|
if (await b() === void 0) {
|
|
34
29
|
console.debug("guido:autosave:blocked", { trigger: e, reason: "save-returned-undefined" }), t.status = s.ERROR;
|
|
35
30
|
return;
|
|
36
31
|
}
|
|
37
|
-
|
|
38
|
-
} catch (
|
|
39
|
-
console.debug("guido:autosave:error", { trigger: e, error:
|
|
32
|
+
a.hasChanges = !1, t.status = s.SAVED, t.lastSavedAt = /* @__PURE__ */ new Date(), console.debug("guido:autosave:save-complete", { trigger: e, at: t.lastSavedAt });
|
|
33
|
+
} catch (o) {
|
|
34
|
+
console.debug("guido:autosave:error", { trigger: e, error: o }), t.status = s.ERROR;
|
|
40
35
|
}
|
|
41
36
|
}, n = () => {
|
|
42
37
|
const { visibilityState: e } = document;
|
|
@@ -45,32 +40,32 @@ const w = 18e4, v = 6e4, R = (b) => {
|
|
|
45
40
|
isActive: u.value
|
|
46
41
|
}), e !== "hidden")
|
|
47
42
|
return;
|
|
48
|
-
const
|
|
49
|
-
if (
|
|
43
|
+
const o = Date.now() - c;
|
|
44
|
+
if (o < r) {
|
|
50
45
|
console.debug("guido:autosave:visibility-debounced", {
|
|
51
|
-
sinceLastMs:
|
|
52
|
-
debounceMs:
|
|
46
|
+
sinceLastMs: o,
|
|
47
|
+
debounceMs: r
|
|
53
48
|
});
|
|
54
49
|
return;
|
|
55
50
|
}
|
|
56
|
-
c = Date.now(),
|
|
51
|
+
c = Date.now(), l("visibility");
|
|
57
52
|
}, d = () => {
|
|
58
53
|
i && (clearInterval(i), i = null);
|
|
59
|
-
},
|
|
54
|
+
}, v = () => {
|
|
60
55
|
document.removeEventListener("visibilitychange", n), window.removeEventListener("pagehide", n);
|
|
61
56
|
};
|
|
62
|
-
|
|
57
|
+
p(
|
|
63
58
|
u,
|
|
64
59
|
(e) => {
|
|
65
60
|
console.debug("guido:autosave:active-changed", { active: e }), e ? (d(), i = setInterval(() => {
|
|
66
|
-
console.debug("guido:autosave:interval-tick"),
|
|
67
|
-
},
|
|
61
|
+
console.debug("guido:autosave:interval-tick"), l("interval");
|
|
62
|
+
}, I), document.addEventListener("visibilitychange", n), window.addEventListener("pagehide", n)) : (d(), v(), t.status = s.IDLE);
|
|
68
63
|
},
|
|
69
64
|
{ immediate: !0 }
|
|
70
|
-
),
|
|
71
|
-
d(),
|
|
65
|
+
), y(() => {
|
|
66
|
+
d(), v(), t.status = s.IDLE, t.lastSavedAt = null;
|
|
72
67
|
});
|
|
73
68
|
};
|
|
74
69
|
export {
|
|
75
|
-
|
|
70
|
+
T as useAutoSave
|
|
76
71
|
};
|