@useinsider/guido 3.18.2-beta.83b62a8 → 3.18.2-beta.c3e75f6
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 -20
- package/dist/components/organisms/header/EditorActions.vue.js +4 -4
- package/dist/components/organisms/header/EditorActions.vue2.js +23 -25
- package/dist/components/organisms/save-as-template/SaveAsTemplateDrawer.vue2.js +34 -34
- package/dist/composables/useActionsApi.js +52 -47
- package/dist/composables/useCodeEditorApi.js +23 -9
- package/dist/composables/useGuidoStateBridge.js +24 -29
- package/dist/composables/useHttp.js +24 -22
- package/dist/composables/useStripo.js +7 -7
- package/dist/composables/useTranslations.js +3 -2
- package/dist/composables/useVersionHistoryApi.js +33 -24
- package/dist/guido.css +1 -1
- package/dist/library.js +13 -15
- package/dist/services/templateLibraryApi.js +17 -14
- package/dist/src/composables/useGuidoStateBridge.d.ts +7 -11
- package/dist/src/library.d.ts +0 -2
- package/dist/src/public/trackingIds.d.ts +2 -6
- package/dist/src/stores/editor.d.ts +0 -25
- package/dist/src/stores/guido-email-editor.d.ts +27 -27
- package/dist/src/utils/genericUtil.d.ts +6 -0
- package/dist/src/utils/liquidDynamicContent.d.ts +20 -0
- package/dist/src/utils/stripoEditorApi.d.ts +4 -0
- package/dist/stores/editor.js +0 -4
- package/dist/stores/guido-email-editor.js +4 -0
- package/dist/stores/unsubscribe.js +3 -3
- package/dist/utils/genericUtil.js +63 -54
- package/dist/utils/liquidDynamicContent.js +15 -0
- package/dist/utils/stripoEditorApi.js +11 -0
- package/dist/utils/templatePreparation.js +37 -36
- package/package.json +1 -5
- package/dist/public/editorState.js +0 -4
- package/dist/src/public/editorState.d.ts +0 -14
package/README.md
CHANGED
|
@@ -561,26 +561,6 @@ import {
|
|
|
561
561
|
import '@useinsider/guido/style';
|
|
562
562
|
```
|
|
563
563
|
|
|
564
|
-
### Subpath entries
|
|
565
|
-
|
|
566
|
-
Two surfaces also ship as their own entry points. Importing one pulls in only its
|
|
567
|
-
own dependencies, so a consumer that needs the store or the tracking-id helpers
|
|
568
|
-
never loads the editor:
|
|
569
|
-
|
|
570
|
-
```typescript
|
|
571
|
-
// Live editor state, published by the editor into the host's shared Pinia instance.
|
|
572
|
-
// Store id `guidoEmailEditor` is the cross-app contract — read it, do not redeclare it.
|
|
573
|
-
import { useGuidoEmailEditorStore } from '@useinsider/guido/editor-state';
|
|
574
|
-
import type { GuidoEmailEditorState } from '@useinsider/guido/editor-state';
|
|
575
|
-
|
|
576
|
-
// Persistent link ids for the click heatmap.
|
|
577
|
-
import { assignTrackingIds, TRACK_ID_ATTRIBUTE } from '@useinsider/guido/tracking-ids';
|
|
578
|
-
import type { TrackingIdResult } from '@useinsider/guido/tracking-ids';
|
|
579
|
-
```
|
|
580
|
-
|
|
581
|
-
Both are re-exported from the root barrel as well; the subpath is what keeps the
|
|
582
|
-
editor out of the consumer's module graph.
|
|
583
|
-
|
|
584
564
|
---
|
|
585
565
|
|
|
586
566
|
## Constants
|
|
@@ -9,15 +9,15 @@ var u = function() {
|
|
|
9
9
|
} } }), e(t.MigrationConfirmModal, { ref: "migrationModalRef", on: { confirm: function(r) {
|
|
10
10
|
return t.executeSave(!1);
|
|
11
11
|
} } })], 1);
|
|
12
|
-
},
|
|
12
|
+
}, c = [], p = /* @__PURE__ */ d(
|
|
13
13
|
l,
|
|
14
14
|
u,
|
|
15
|
-
|
|
15
|
+
c,
|
|
16
16
|
!1,
|
|
17
17
|
null,
|
|
18
|
-
"
|
|
18
|
+
"c61cc8ea"
|
|
19
19
|
);
|
|
20
|
-
const v =
|
|
20
|
+
const v = p.exports;
|
|
21
21
|
export {
|
|
22
22
|
v as default
|
|
23
23
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent as q, ref as
|
|
1
|
+
import { defineComponent as q, ref as n, computed as x } from "vue";
|
|
2
2
|
import { useActionsApi as b } from "../../../composables/useActionsApi.js";
|
|
3
3
|
import { useConfig as k } from "../../../composables/useConfig.js";
|
|
4
4
|
import { useExport as B } from "../../../composables/useExport.js";
|
|
@@ -17,48 +17,46 @@ import { storeToRefs as Q } from "pinia";
|
|
|
17
17
|
import U from "./MigrationConfirmModal.vue.js";
|
|
18
18
|
const ft = /* @__PURE__ */ q({
|
|
19
19
|
__name: "EditorActions",
|
|
20
|
-
setup(W, { expose:
|
|
21
|
-
const { config:
|
|
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
22
|
if (e.isVersionHistoryOpen) {
|
|
23
|
-
|
|
23
|
+
f();
|
|
24
24
|
return;
|
|
25
25
|
}
|
|
26
|
-
|
|
26
|
+
u();
|
|
27
27
|
}, C = async () => {
|
|
28
|
-
i.value = !0, await
|
|
28
|
+
i.value = !0, await c(), i.value = !1;
|
|
29
29
|
}, A = () => {
|
|
30
30
|
e.isSaveAsTemplateDrawerOpen = !0;
|
|
31
|
-
}, M =
|
|
31
|
+
}, M = x(() => e.isVersionHistoryOpen ? s("newsletter.close-version-history") : s("newsletter.version-history")), O = x(
|
|
32
32
|
() => {
|
|
33
33
|
var t, o;
|
|
34
|
-
return ((o = (t =
|
|
34
|
+
return ((o = (t = l.value) == null ? void 0 : t.features) == null ? void 0 : o.versionHistory) && !e.isPreviewModeOpen;
|
|
35
35
|
}
|
|
36
|
-
),
|
|
36
|
+
), V = async (t) => {
|
|
37
37
|
a.value = !0, t || (e.loadingStatus = !0);
|
|
38
38
|
let o;
|
|
39
39
|
try {
|
|
40
|
-
o = await
|
|
41
|
-
} catch (
|
|
42
|
-
|
|
43
|
-
throw n;
|
|
44
|
-
r(n, "Failed to save template");
|
|
40
|
+
o = await p(t);
|
|
41
|
+
} catch (T) {
|
|
42
|
+
r(T, "Failed to save template");
|
|
45
43
|
} finally {
|
|
46
44
|
a.value = !1, !t && !o && (e.loadingStatus = !1);
|
|
47
45
|
}
|
|
48
46
|
return o;
|
|
49
|
-
},
|
|
47
|
+
}, E = (t) => {
|
|
50
48
|
var o;
|
|
51
|
-
if (!t &&
|
|
52
|
-
(o =
|
|
49
|
+
if (!t && S.value) {
|
|
50
|
+
(o = H.value) == null || o.open();
|
|
53
51
|
return;
|
|
54
52
|
}
|
|
55
|
-
return
|
|
53
|
+
return V(t);
|
|
56
54
|
}, F = async () => {
|
|
57
|
-
if (
|
|
55
|
+
if (m("liquidSyntax")) {
|
|
58
56
|
e.loadingStatus = !0;
|
|
59
57
|
try {
|
|
60
|
-
const { html: t } = await
|
|
61
|
-
if (!await
|
|
58
|
+
const { html: t } = await d({ minimize: !0, resetDataSavedFlag: !1 }), { compiledHtml: o } = v(t);
|
|
59
|
+
if (!await y(o))
|
|
62
60
|
return;
|
|
63
61
|
} catch (t) {
|
|
64
62
|
r(t, "Failed to prepare test email");
|
|
@@ -67,11 +65,11 @@ const ft = /* @__PURE__ */ q({
|
|
|
67
65
|
e.loadingStatus = !1;
|
|
68
66
|
}
|
|
69
67
|
}
|
|
70
|
-
|
|
68
|
+
h();
|
|
71
69
|
};
|
|
72
|
-
return
|
|
73
|
-
handleSave:
|
|
74
|
-
}), { __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 };
|
|
75
73
|
}
|
|
76
74
|
});
|
|
77
75
|
export {
|
|
@@ -1,64 +1,64 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import
|
|
3
|
-
import { useTranslations as
|
|
1
|
+
import { defineComponent as _, ref as c, computed as h, watch as C, toRef as N, nextTick as O } from "vue";
|
|
2
|
+
import b from "../../wrappers/WpDrawer.vue.js";
|
|
3
|
+
import { useTranslations as D } from "../../../composables/useTranslations.js";
|
|
4
4
|
import { useTemplateNameValidator as x } from "../../../composables/validators/saveAsTemplate.js";
|
|
5
5
|
import { useTemplateLibraryApi as B } from "../../../services/templateLibraryApi.js";
|
|
6
|
-
import { useEditorStore as
|
|
7
|
-
import { useSaveAsTemplateStore as
|
|
8
|
-
import { InMultiSelect as
|
|
9
|
-
import { useDebounceFn as
|
|
10
|
-
const
|
|
6
|
+
import { useEditorStore as k } from "../../../stores/editor.js";
|
|
7
|
+
import { useSaveAsTemplateStore as I } from "../../../stores/save-as-template.js";
|
|
8
|
+
import { InMultiSelect as M, InBasicTextInput as V } from "@useinsider/design-system-vue";
|
|
9
|
+
import { useDebounceFn as E } from "../../../node_modules/@vueuse/shared/index.js";
|
|
10
|
+
const J = /* @__PURE__ */ _({
|
|
11
11
|
__name: "SaveAsTemplateDrawer",
|
|
12
|
-
setup(
|
|
13
|
-
const
|
|
12
|
+
setup(R) {
|
|
13
|
+
const s = D(), o = k(), t = I(), { createTemplate: m } = B(), a = c(!1), n = c(!1), r = c(""), f = h(() => ({
|
|
14
14
|
primaryButton: {
|
|
15
15
|
styling: "solid",
|
|
16
16
|
type: "primary",
|
|
17
|
-
labelText:
|
|
17
|
+
labelText: s(a.value ? "newsletter.saving" : "products.save"),
|
|
18
18
|
loadingStatus: a.value,
|
|
19
19
|
disabledStatus: t.skeletonStatus
|
|
20
20
|
},
|
|
21
21
|
cancelOrBackButton: {
|
|
22
22
|
styling: "ghost",
|
|
23
23
|
type: "secondary",
|
|
24
|
-
labelText:
|
|
24
|
+
labelText: s("products.cancel"),
|
|
25
25
|
disabledStatus: a.value
|
|
26
26
|
}
|
|
27
|
-
})),
|
|
28
|
-
|
|
29
|
-
},
|
|
30
|
-
const e =
|
|
31
|
-
return
|
|
32
|
-
}, v =
|
|
33
|
-
t.templateName = e, await
|
|
34
|
-
}, 500),
|
|
35
|
-
|
|
36
|
-
},
|
|
27
|
+
})), p = () => {
|
|
28
|
+
r.value = "", o.isSaveAsTemplateDrawerOpen = !1;
|
|
29
|
+
}, l = async () => {
|
|
30
|
+
const e = N(t, "templateName"), { success: i, errorMessage: A } = await x(e).validate();
|
|
31
|
+
return r.value = A, i;
|
|
32
|
+
}, v = E(async (e) => {
|
|
33
|
+
t.templateName = e, await l();
|
|
34
|
+
}, 500), S = async (e) => {
|
|
35
|
+
n.value = !0, await t.addCategory(e), n.value = !1;
|
|
36
|
+
}, T = (e) => {
|
|
37
37
|
t.selectedCategories = e;
|
|
38
|
-
},
|
|
38
|
+
}, g = (e) => {
|
|
39
39
|
e && (t.selectedCategories = e);
|
|
40
|
-
},
|
|
40
|
+
}, y = () => {
|
|
41
41
|
t.selectedCategories = [];
|
|
42
42
|
}, w = async () => {
|
|
43
|
-
if (a.value = !0, !await
|
|
43
|
+
if (a.value = !0, !await l()) {
|
|
44
44
|
a.value = !1;
|
|
45
45
|
return;
|
|
46
46
|
}
|
|
47
|
-
const
|
|
48
|
-
a.value = !1,
|
|
49
|
-
},
|
|
50
|
-
|
|
47
|
+
const i = await m();
|
|
48
|
+
a.value = !1, i && p();
|
|
49
|
+
}, u = () => {
|
|
50
|
+
O(() => {
|
|
51
51
|
const e = document.querySelector("input#guido__template-name-input");
|
|
52
52
|
e == null || e.focus();
|
|
53
53
|
});
|
|
54
54
|
}, d = async () => {
|
|
55
|
-
t.$reset(), await t.fetchCategories(), t.skeletonStatus = !1,
|
|
55
|
+
t.$reset(), await t.fetchCategories(), t.skeletonStatus = !1, u();
|
|
56
56
|
};
|
|
57
|
-
return
|
|
58
|
-
|
|
59
|
-
}), { __sfc: !0, trans:
|
|
57
|
+
return C(() => o.isSaveAsTemplateDrawerOpen, (e) => {
|
|
58
|
+
e && d();
|
|
59
|
+
}), { __sfc: !0, trans: s, editorStore: o, saveAsTemplateStore: t, createTemplate: m, isSaving: a, isAddingOption: n, templateNameError: r, footerButtonGroupOptions: f, closeModal: p, validateTemplateName: l, handleTemplateName: v, handleAddOption: S, handleCategoryChange: T, handleSelectAllOptions: g, handleResetAllOptions: y, saveTemplate: w, focusToInput: u, initializeDrawer: d, WpDrawer: b, InBasicTextInput: V, InMultiSelect: M };
|
|
60
60
|
}
|
|
61
61
|
});
|
|
62
62
|
export {
|
|
63
|
-
|
|
63
|
+
J as default
|
|
64
64
|
};
|
|
@@ -1,18 +1,23 @@
|
|
|
1
|
-
import { filterAmpErrors as
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { filterAmpErrors as y } from "../utils/ampErrorFilter.js";
|
|
2
|
+
import { getEditorApi as s } from "../utils/stripoEditorApi.js";
|
|
3
|
+
import { useToaster as D } from "./useToaster.js";
|
|
4
|
+
const h = 1e4, T = 3e4, r = (n, l, A) => new Promise((C, p) => {
|
|
5
|
+
const f = setTimeout(
|
|
6
|
+
() => p(new Error(`${n} did not report completion within ${l}ms`)),
|
|
6
7
|
l
|
|
7
|
-
),
|
|
8
|
-
clearTimeout(
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
8
|
+
), c = (t) => (e) => {
|
|
9
|
+
clearTimeout(f), t(e);
|
|
10
|
+
}, d = c(p);
|
|
11
|
+
try {
|
|
12
|
+
A(c(C), d);
|
|
13
|
+
} catch (t) {
|
|
14
|
+
d(t);
|
|
15
|
+
}
|
|
16
|
+
}), P = () => {
|
|
17
|
+
const { handleError: n } = D(), l = (t = {}) => r(
|
|
13
18
|
"compileEmail",
|
|
14
|
-
|
|
15
|
-
(e,
|
|
19
|
+
T,
|
|
20
|
+
(e, i) => {
|
|
16
21
|
const o = { ...{
|
|
17
22
|
minimize: !0,
|
|
18
23
|
utmEntity: {
|
|
@@ -32,53 +37,53 @@ const D = 1e4, d = 3e4, s = (n, l, u) => new Promise((T, m) => {
|
|
|
32
37
|
forceAmp: !1,
|
|
33
38
|
resetDataSavedFlag: !1,
|
|
34
39
|
disableLineHeightsReplace: !0
|
|
35
|
-
}, ...t },
|
|
36
|
-
callback: (
|
|
37
|
-
|
|
38
|
-
html:
|
|
39
|
-
ampHtml:
|
|
40
|
-
ampErrors:
|
|
41
|
-
displayConditions:
|
|
40
|
+
}, ...t }, u = {
|
|
41
|
+
callback: (m, g, w, S, v) => {
|
|
42
|
+
m ? i(m) : e({
|
|
43
|
+
html: g,
|
|
44
|
+
ampHtml: w,
|
|
45
|
+
ampErrors: y(S ?? []),
|
|
46
|
+
displayConditions: v
|
|
42
47
|
});
|
|
43
48
|
},
|
|
44
49
|
...o
|
|
45
50
|
};
|
|
46
|
-
|
|
51
|
+
s().actionsApi.compileEmail(u);
|
|
47
52
|
}
|
|
48
53
|
);
|
|
49
54
|
return {
|
|
50
55
|
getCompiledEmail: l,
|
|
51
|
-
getTemplateData: () =>
|
|
56
|
+
getTemplateData: () => r(
|
|
52
57
|
"getTemplateData",
|
|
53
|
-
|
|
58
|
+
T,
|
|
54
59
|
(t) => {
|
|
55
|
-
const e = ({ html:
|
|
56
|
-
html:
|
|
57
|
-
css:
|
|
60
|
+
const e = ({ html: i, css: a, width: o, height: E, utmParams: u, syncModulesIds: m }) => t({
|
|
61
|
+
html: i,
|
|
62
|
+
css: a,
|
|
58
63
|
width: o,
|
|
59
64
|
height: E,
|
|
60
|
-
utmParams:
|
|
61
|
-
syncModulesIds:
|
|
65
|
+
utmParams: u,
|
|
66
|
+
syncModulesIds: m
|
|
62
67
|
});
|
|
63
|
-
|
|
68
|
+
s().actionsApi.getTemplateData(e);
|
|
64
69
|
}
|
|
65
70
|
),
|
|
66
71
|
activateCustomViewStyles: (t = !0) => {
|
|
67
|
-
|
|
72
|
+
s().actionsApi.activateCustomViewStyles(t);
|
|
68
73
|
},
|
|
69
74
|
getPreviewData: async (t) => {
|
|
70
75
|
try {
|
|
71
76
|
const {
|
|
72
77
|
html: e,
|
|
73
|
-
displayConditions:
|
|
74
|
-
ampHtml:
|
|
78
|
+
displayConditions: i,
|
|
79
|
+
ampHtml: a = "",
|
|
75
80
|
ampErrors: o = []
|
|
76
81
|
} = await l({ minimize: !1, resetDataSavedFlag: !1, ...t });
|
|
77
82
|
return {
|
|
78
83
|
html: e,
|
|
79
|
-
ampHtml:
|
|
84
|
+
ampHtml: a,
|
|
80
85
|
ampErrors: o,
|
|
81
|
-
displayConditions:
|
|
86
|
+
displayConditions: i
|
|
82
87
|
};
|
|
83
88
|
} catch (e) {
|
|
84
89
|
return n(e, "Error loading preview"), {
|
|
@@ -90,30 +95,30 @@ const D = 1e4, d = 3e4, s = (n, l, u) => new Promise((T, m) => {
|
|
|
90
95
|
}
|
|
91
96
|
},
|
|
92
97
|
updateTimerInClonedTemplate: () => new Promise((t) => {
|
|
93
|
-
var e,
|
|
94
|
-
if (typeof ((
|
|
98
|
+
var e, i;
|
|
99
|
+
if (typeof ((i = (e = window.StripoEditorApi) == null ? void 0 : e.actionsApi) == null ? void 0 : i.updateTimerInClonedTemplate) != "function") {
|
|
95
100
|
t(null);
|
|
96
101
|
return;
|
|
97
102
|
}
|
|
98
103
|
try {
|
|
99
|
-
window.StripoEditorApi.actionsApi.updateTimerInClonedTemplate((
|
|
100
|
-
|
|
104
|
+
window.StripoEditorApi.actionsApi.updateTimerInClonedTemplate((a, o) => {
|
|
105
|
+
a ? (n(a, "Failed to update timer in cloned template"), t(null)) : t(o || null);
|
|
101
106
|
});
|
|
102
|
-
} catch (
|
|
103
|
-
n(
|
|
107
|
+
} catch (a) {
|
|
108
|
+
n(a, "Failed to call updateTimerInClonedTemplate"), t(null);
|
|
104
109
|
}
|
|
105
110
|
}),
|
|
106
111
|
updateHtmlAndCss: (t, e) => {
|
|
107
|
-
const { actionsApi:
|
|
108
|
-
return
|
|
109
|
-
|
|
112
|
+
const { actionsApi: i } = s();
|
|
113
|
+
return r("updateHtmlAndCss", h, (a) => {
|
|
114
|
+
i.updateHtmlAndCss(t, e, () => a());
|
|
110
115
|
});
|
|
111
116
|
},
|
|
112
|
-
editorSave: () =>
|
|
117
|
+
editorSave: () => r(
|
|
113
118
|
"save",
|
|
114
|
-
|
|
119
|
+
T,
|
|
115
120
|
(t) => {
|
|
116
|
-
|
|
121
|
+
s().actionsApi.save((e) => {
|
|
117
122
|
if (e) {
|
|
118
123
|
n(e, "Failed to save template"), t(!1);
|
|
119
124
|
return;
|
|
@@ -125,5 +130,5 @@ const D = 1e4, d = 3e4, s = (n, l, u) => new Promise((T, m) => {
|
|
|
125
130
|
};
|
|
126
131
|
};
|
|
127
132
|
export {
|
|
128
|
-
|
|
133
|
+
P as useActionsApi
|
|
129
134
|
};
|
|
@@ -1,11 +1,25 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
import { ToasterTypeOptions as d } from "../enums/toaster.js";
|
|
2
|
+
import { findEditorApi as s, EDITOR_NOT_READY_MESSAGE as p } from "../utils/stripoEditorApi.js";
|
|
3
|
+
import { useToaster as E } from "./useToaster.js";
|
|
4
|
+
const T = () => {
|
|
5
|
+
const { showToaster: i } = E(), t = (o) => {
|
|
6
|
+
var r;
|
|
7
|
+
const e = (r = s()) == null ? void 0 : r.codeEditorApi;
|
|
8
|
+
if (!e) {
|
|
9
|
+
i({ type: d.Error, message: p });
|
|
10
|
+
return;
|
|
11
|
+
}
|
|
12
|
+
o(e);
|
|
13
|
+
};
|
|
14
|
+
return {
|
|
15
|
+
openCodeEditor: () => {
|
|
16
|
+
t((o) => o.openCodeEditor());
|
|
17
|
+
},
|
|
18
|
+
closeCodeEditor: () => {
|
|
19
|
+
t((o) => o.closeCodeEditor());
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
};
|
|
9
23
|
export {
|
|
10
|
-
|
|
24
|
+
T as useCodeEditorApi
|
|
11
25
|
};
|
|
@@ -1,59 +1,54 @@
|
|
|
1
|
-
import { useActionsApi as
|
|
2
|
-
import { useEditorLock as
|
|
1
|
+
import { useActionsApi as b } from "./useActionsApi.js";
|
|
2
|
+
import { useEditorLock as v } from "./useEditorLock.js";
|
|
3
3
|
import { useConfigStore as T } from "../stores/config.js";
|
|
4
4
|
import { useEditorStore as w } from "../stores/editor.js";
|
|
5
5
|
import { useGuidoEmailEditorStore as y } from "../stores/guido-email-editor.js";
|
|
6
|
-
import { watch as
|
|
7
|
-
const
|
|
8
|
-
const i = w(), u = y(),
|
|
9
|
-
let o = null,
|
|
10
|
-
const
|
|
6
|
+
import { watch as a, onUnmounted as B } from "vue";
|
|
7
|
+
const C = 500, L = () => {
|
|
8
|
+
const i = w(), u = y(), l = T(), { getTemplateData: d } = b(), { runExclusive: m, isEditorBusy: p } = v();
|
|
9
|
+
let o = null, s = !1;
|
|
10
|
+
const n = () => {
|
|
11
11
|
o && (clearTimeout(o), o = null);
|
|
12
|
-
},
|
|
13
|
-
|
|
12
|
+
}, c = (t) => {
|
|
13
|
+
n(), o = setTimeout(() => {
|
|
14
14
|
o = null, t();
|
|
15
|
-
},
|
|
15
|
+
}, C);
|
|
16
16
|
}, e = async () => {
|
|
17
|
-
var t,
|
|
18
|
-
if (!(
|
|
17
|
+
var t, r;
|
|
18
|
+
if (!(s || !i.isStripoInitialized)) {
|
|
19
19
|
if (p()) {
|
|
20
|
-
|
|
20
|
+
c(() => void e());
|
|
21
21
|
return;
|
|
22
22
|
}
|
|
23
23
|
try {
|
|
24
|
-
const { html: E, css:
|
|
25
|
-
if (
|
|
24
|
+
const { html: E, css: g } = await m(d), I = ((r = (t = l.config) == null ? void 0 : t.identity) == null ? void 0 : r.templateId) ?? "";
|
|
25
|
+
if (s)
|
|
26
26
|
return;
|
|
27
27
|
u.$patch({
|
|
28
28
|
html: E ?? "",
|
|
29
|
-
css:
|
|
30
|
-
templateId:
|
|
29
|
+
css: g ?? "",
|
|
30
|
+
templateId: I,
|
|
31
31
|
lastUpdatedAt: Date.now()
|
|
32
32
|
});
|
|
33
33
|
} catch {
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
|
-
}, f = () =>
|
|
36
|
+
}, f = () => c(() => void e()), h = a(
|
|
37
37
|
() => i.isStripoInitialized,
|
|
38
38
|
(t) => {
|
|
39
39
|
t && e();
|
|
40
40
|
},
|
|
41
41
|
{ immediate: !0 }
|
|
42
|
-
), S =
|
|
43
|
-
() => i.changeSeq,
|
|
44
|
-
() => {
|
|
45
|
-
i.isStripoInitialized && f();
|
|
46
|
-
}
|
|
47
|
-
), g = c(
|
|
42
|
+
), S = a(
|
|
48
43
|
() => i.hasChanges,
|
|
49
|
-
(t,
|
|
50
|
-
|
|
44
|
+
(t, r) => {
|
|
45
|
+
i.isStripoInitialized && (t ? f() : r && (n(), e()));
|
|
51
46
|
}
|
|
52
47
|
);
|
|
53
|
-
|
|
54
|
-
|
|
48
|
+
B(() => {
|
|
49
|
+
s = !0, n(), h(), S();
|
|
55
50
|
});
|
|
56
51
|
};
|
|
57
52
|
export {
|
|
58
|
-
|
|
53
|
+
L as useGuidoStateBridge
|
|
59
54
|
};
|
|
@@ -1,14 +1,16 @@
|
|
|
1
|
-
import { getCsrfToken as
|
|
2
|
-
import { ref as
|
|
3
|
-
const
|
|
4
|
-
const
|
|
1
|
+
import { getCsrfToken as O } from "../utils/genericUtil.js";
|
|
2
|
+
import { ref as m, computed as T } from "vue";
|
|
3
|
+
const X = (b = {}) => {
|
|
4
|
+
const p = m(!1), a = m(null), u = m(null), g = T(() => p.value), y = T(() => a.value !== null), v = {
|
|
5
5
|
baseURL: "",
|
|
6
6
|
timeout: 1e4,
|
|
7
7
|
retry: 0,
|
|
8
8
|
retryDelay: 1e3,
|
|
9
9
|
headers: {
|
|
10
10
|
"Content-Type": "application/json",
|
|
11
|
-
"X-CSRF-TOKEN":
|
|
11
|
+
"X-CSRF-TOKEN": O(),
|
|
12
|
+
Accept: "application/json",
|
|
13
|
+
"X-Requested-With": "XMLHttpRequest"
|
|
12
14
|
},
|
|
13
15
|
...b
|
|
14
16
|
}, w = (e, s) => {
|
|
@@ -22,22 +24,22 @@ const k = (b = {}) => {
|
|
|
22
24
|
}, e);
|
|
23
25
|
}), x = (e) => new Promise((s) => {
|
|
24
26
|
setTimeout(s, e);
|
|
25
|
-
}), i = async (e, s, t,
|
|
26
|
-
a.value = null,
|
|
27
|
-
const n = { ...v, ...
|
|
27
|
+
}), i = async (e, s, t, L = {}) => {
|
|
28
|
+
a.value = null, p.value = !0, u.value = new AbortController();
|
|
29
|
+
const n = { ...v, ...L }, D = w(s, n.baseURL), c = {
|
|
28
30
|
method: e,
|
|
29
31
|
headers: { ...n.headers },
|
|
30
32
|
signal: u.value.signal,
|
|
31
33
|
...n
|
|
32
34
|
};
|
|
33
35
|
t && ["POST", "PUT", "PATCH"].includes(e) && (t instanceof FormData ? (delete c.headers["Content-Type"], c.body = t) : c.body = JSON.stringify(t));
|
|
34
|
-
const E = async (
|
|
36
|
+
const E = async (h = 0) => {
|
|
35
37
|
try {
|
|
36
|
-
const o = [fetch(
|
|
38
|
+
const o = [fetch(D, c)];
|
|
37
39
|
n.timeout && o.push(P(n.timeout));
|
|
38
40
|
const r = await Promise.race(o);
|
|
39
41
|
if (!r.ok) {
|
|
40
|
-
const
|
|
42
|
+
const H = `HTTP Error: ${r.status} ${r.statusText}`, d = new Error(H);
|
|
41
43
|
throw d.status = r.status, d.statusText = r.statusText, d.response = r, d;
|
|
42
44
|
}
|
|
43
45
|
let f;
|
|
@@ -50,19 +52,19 @@ const k = (b = {}) => {
|
|
|
50
52
|
};
|
|
51
53
|
} catch (o) {
|
|
52
54
|
const r = o instanceof Error && o.name === "AbortError";
|
|
53
|
-
if (
|
|
54
|
-
return await x(n.retryDelay || 1e3), E(
|
|
55
|
+
if (h < (n.retry || 0) && !r)
|
|
56
|
+
return await x(n.retryDelay || 1e3), E(h + 1);
|
|
55
57
|
throw o instanceof Error ? o.name === "AbortError" ? a.value = { message: "Request was cancelled" } : a.value = { message: o.message } : a.value = o, o;
|
|
56
58
|
}
|
|
57
59
|
};
|
|
58
60
|
try {
|
|
59
61
|
return await E();
|
|
60
62
|
} finally {
|
|
61
|
-
|
|
63
|
+
p.value = !1, u.value = null;
|
|
62
64
|
}
|
|
63
|
-
}, C = (e, s) => i("GET", e, void 0, s),
|
|
65
|
+
}, C = (e, s) => i("GET", e, void 0, s), R = (e, s, t) => i("POST", e, s, t), $ = (e, s, t) => i("PUT", e, s, t), q = (e, s, t) => i("PATCH", e, s, t), A = (e, s) => i("DELETE", e, void 0, s), U = (e) => {
|
|
64
66
|
u.value && u.value.abort(e);
|
|
65
|
-
},
|
|
67
|
+
}, W = () => {
|
|
66
68
|
a.value = null;
|
|
67
69
|
};
|
|
68
70
|
return {
|
|
@@ -73,14 +75,14 @@ const k = (b = {}) => {
|
|
|
73
75
|
// Methods
|
|
74
76
|
request: i,
|
|
75
77
|
get: C,
|
|
76
|
-
post:
|
|
77
|
-
put:
|
|
78
|
-
patch:
|
|
78
|
+
post: R,
|
|
79
|
+
put: $,
|
|
80
|
+
patch: q,
|
|
79
81
|
delete: A,
|
|
80
|
-
cancel:
|
|
81
|
-
clearError:
|
|
82
|
+
cancel: U,
|
|
83
|
+
clearError: W
|
|
82
84
|
};
|
|
83
85
|
};
|
|
84
86
|
export {
|
|
85
|
-
|
|
87
|
+
X as useHttp
|
|
86
88
|
};
|