@useinsider/guido 2.0.0-beta.087a24f → 2.0.0-beta.13ba613
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/dist/composables/useStripo.js +37 -35
- package/dist/package.json.js +7 -0
- package/package.json +1 -1
|
@@ -1,25 +1,26 @@
|
|
|
1
|
-
import { useActionsApi as
|
|
2
|
-
import { useBlocksConfig as
|
|
3
|
-
import { useConfig as
|
|
4
|
-
import { useCustomInterfaceAppearance as
|
|
5
|
-
import { useStripoEventHandler as
|
|
6
|
-
import { useToaster as
|
|
1
|
+
import { useActionsApi as T } from "./useActionsApi.js";
|
|
2
|
+
import { useBlocksConfig as V } from "./useBlocksConfig.js";
|
|
3
|
+
import { useConfig as _ } from "./useConfig.js";
|
|
4
|
+
import { useCustomInterfaceAppearance as B } from "./useCustomInterfaceAppearance.js";
|
|
5
|
+
import { useStripoEventHandler as v } from "./useStripoEventHandler.js";
|
|
6
|
+
import { useToaster as A } from "./useToaster.js";
|
|
7
7
|
import { displayConditions as F } from "../enums/displayConditions.js";
|
|
8
8
|
import { useStripoApi as D } from "../services/stripoApi.js";
|
|
9
9
|
import I from "../static/styles/customEditorStyle.css.js";
|
|
10
10
|
import { useEditorStore as M } from "../stores/editor.js";
|
|
11
11
|
import { dynamicContentToMergeTags as U } from "../utils/genericUtil.js";
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
import P from "../package.json.js";
|
|
13
|
+
const K = (c) => {
|
|
14
|
+
const { features: l } = _(), { handleError: u } = A(), { getToken: y, getCustomFonts: S } = D(), { handleEvent: C } = v(), { getStripoBlocksConfig: E } = V(), h = async (i, n = []) => {
|
|
15
|
+
var g, f;
|
|
16
|
+
const o = M(), { html: r, css: p, forceRecreate: a } = i, { baseBlocks: t, extensions: d } = await E(), m = ((g = l.value) == null ? void 0 : g.displayConditions) ?? !0, b = ((f = l.value) == null ? void 0 : f.modulesDisabled) ?? !1;
|
|
16
17
|
window.UIEditor.initEditor(
|
|
17
18
|
document.querySelector("#guido-editor"),
|
|
18
19
|
{
|
|
19
|
-
metadata:
|
|
20
|
-
html:
|
|
21
|
-
css:
|
|
22
|
-
forceRecreate:
|
|
20
|
+
metadata: c,
|
|
21
|
+
html: r,
|
|
22
|
+
css: p,
|
|
23
|
+
forceRecreate: a,
|
|
23
24
|
locale: "en",
|
|
24
25
|
undoButtonSelector: "#guido__undo-button",
|
|
25
26
|
redoButtonSelector: "#guido__redo-button",
|
|
@@ -30,8 +31,8 @@ const $ = (a) => {
|
|
|
30
31
|
customAppearanceMergetagsBorderColor: "#f1f3fe",
|
|
31
32
|
customAppearanceMergetagsBackgroundColor: "#f1f3fe",
|
|
32
33
|
customViewStyles: I,
|
|
33
|
-
conditionsEnabled:
|
|
34
|
-
customConditionsEnabled:
|
|
34
|
+
conditionsEnabled: m,
|
|
35
|
+
customConditionsEnabled: m,
|
|
35
36
|
conditionCategories: F,
|
|
36
37
|
enableXSSSecurity: !0,
|
|
37
38
|
modulesDisabled: b,
|
|
@@ -41,7 +42,7 @@ const $ = (a) => {
|
|
|
41
42
|
displayTitle: !1,
|
|
42
43
|
displayUTM: !1,
|
|
43
44
|
selectElementAfterDrop: !0,
|
|
44
|
-
...
|
|
45
|
+
...t ? { baseBlocks: t } : {},
|
|
45
46
|
editorFonts: {
|
|
46
47
|
showDefaultStandardFonts: !0,
|
|
47
48
|
showDefaultNotStandardFonts: !0,
|
|
@@ -49,25 +50,25 @@ const $ = (a) => {
|
|
|
49
50
|
},
|
|
50
51
|
mergeTags: [
|
|
51
52
|
{
|
|
52
|
-
entries: U(
|
|
53
|
+
entries: U(c.preselectedDynamicContentList)
|
|
53
54
|
}
|
|
54
55
|
],
|
|
55
56
|
async onTokenRefreshRequest(e) {
|
|
56
57
|
try {
|
|
57
|
-
const
|
|
58
|
-
e(
|
|
59
|
-
} catch (
|
|
60
|
-
|
|
58
|
+
const s = await y();
|
|
59
|
+
e(s);
|
|
60
|
+
} catch (s) {
|
|
61
|
+
u(s, "Failed to refresh token");
|
|
61
62
|
}
|
|
62
63
|
},
|
|
63
64
|
onTemplateLoaded() {
|
|
64
65
|
try {
|
|
65
|
-
const { importCss: e } =
|
|
66
|
-
e(),
|
|
66
|
+
const { importCss: e } = B(), { activateCustomViewStyles: s, updateTimerInClonedTemplate: k } = T();
|
|
67
|
+
e(), s(), k(), c.onReady(), o.isStripoInitialized = !0, o.loadingStatus = !1, setTimeout(() => {
|
|
67
68
|
o.hasChanges = !1;
|
|
68
69
|
}, 1e3);
|
|
69
70
|
} catch (e) {
|
|
70
|
-
|
|
71
|
+
u(e, "Failed to load custom interface appearance");
|
|
71
72
|
}
|
|
72
73
|
},
|
|
73
74
|
onCodeEditorVisibilityChanged(e) {
|
|
@@ -82,34 +83,35 @@ const $ = (a) => {
|
|
|
82
83
|
onDataChanged() {
|
|
83
84
|
o.hasChanges = !0;
|
|
84
85
|
},
|
|
85
|
-
onEvent:
|
|
86
|
+
onEvent: C,
|
|
86
87
|
ignoreClickOutsideSelectors: [
|
|
87
88
|
"#guido-dynamic-content-modal",
|
|
88
89
|
".in-on-board-wrapper",
|
|
89
90
|
".in-drawer__container"
|
|
90
91
|
],
|
|
91
|
-
extensions:
|
|
92
|
+
extensions: d
|
|
92
93
|
}
|
|
93
94
|
);
|
|
94
|
-
},
|
|
95
|
+
}, w = (i) => new Promise((n, o) => {
|
|
96
|
+
var d;
|
|
95
97
|
if (document.getElementById("UiEditorScript")) {
|
|
96
98
|
i(), n();
|
|
97
99
|
return;
|
|
98
100
|
}
|
|
99
|
-
const
|
|
100
|
-
t.id = "UiEditorScript", t.type = "module", t.src =
|
|
101
|
+
const r = P.guido, a = `https://email-static.useinsider.com/guido/${(d = r == null ? void 0 : r.stripo) == null ? void 0 : d.version}/UIEditor.js`, t = document.createElement("script");
|
|
102
|
+
t.id = "UiEditorScript", t.type = "module", t.src = a, t.onload = () => {
|
|
101
103
|
i(), n();
|
|
102
104
|
}, t.onerror = () => {
|
|
103
|
-
o(new Error(`Failed to load Stripo UIEditor script from S3: ${
|
|
105
|
+
o(new Error(`Failed to load Stripo UIEditor script from S3: ${a}`));
|
|
104
106
|
}, document.body.appendChild(t);
|
|
105
107
|
});
|
|
106
108
|
return { initPlugin: async (i) => {
|
|
107
|
-
await
|
|
108
|
-
const n = await
|
|
109
|
-
await
|
|
109
|
+
await w(async () => {
|
|
110
|
+
const n = await S();
|
|
111
|
+
await h(i, n);
|
|
110
112
|
});
|
|
111
113
|
} };
|
|
112
114
|
};
|
|
113
115
|
export {
|
|
114
|
-
|
|
116
|
+
K as useStripo
|
|
115
117
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@useinsider/guido",
|
|
3
|
-
"version": "2.0.0-beta.
|
|
3
|
+
"version": "2.0.0-beta.13ba613",
|
|
4
4
|
"description": "Guido is a Vue + TypeScript wrapper for Email Plugin. Easily embed the email editor in your Vue applications.",
|
|
5
5
|
"main": "./dist/guido.umd.cjs",
|
|
6
6
|
"module": "./dist/library.js",
|