@useinsider/guido 1.0.3-beta.c600a63 → 1.0.3-beta.c633520
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/services/stripoApi.js +18 -24
- package/package.json +1 -1
|
@@ -1,50 +1,44 @@
|
|
|
1
1
|
import { useHttp as l } from "../composables/useHttp.js";
|
|
2
|
-
import { useToaster as
|
|
3
|
-
import { MAX_DEFAULT_TEMPLATE_ID as
|
|
2
|
+
import { useToaster as m } from "../composables/useToaster.js";
|
|
3
|
+
import { MAX_DEFAULT_TEMPLATE_ID as u } from "../enums/defaults.js";
|
|
4
4
|
const T = () => {
|
|
5
|
-
const { get:
|
|
5
|
+
const { get: a } = l(), { handleError: o } = m();
|
|
6
6
|
return {
|
|
7
7
|
getToken: async () => {
|
|
8
8
|
try {
|
|
9
|
-
const
|
|
10
|
-
return
|
|
11
|
-
} catch (
|
|
12
|
-
return
|
|
9
|
+
const t = Number(localStorage.getItem("ins-guido-test-instance")), { data: e } = await a(`/stripo/get-user-token?test=${t}`);
|
|
10
|
+
return e.body.token;
|
|
11
|
+
} catch (t) {
|
|
12
|
+
return o(t, "Failed to fetch token"), "";
|
|
13
13
|
}
|
|
14
14
|
},
|
|
15
15
|
getCustomFonts: async () => {
|
|
16
16
|
try {
|
|
17
|
-
const { data:
|
|
18
|
-
return
|
|
19
|
-
...
|
|
17
|
+
const { data: t = [] } = await a("/stripo/get-partner-custom-fonts");
|
|
18
|
+
return t.map((e) => ({
|
|
19
|
+
...e,
|
|
20
20
|
active: !0
|
|
21
21
|
}));
|
|
22
|
-
} catch (
|
|
23
|
-
return
|
|
22
|
+
} catch (t) {
|
|
23
|
+
return o(t, "Failed to fetch custom fonts"), [];
|
|
24
24
|
}
|
|
25
25
|
},
|
|
26
26
|
getDefaultTemplate: async () => {
|
|
27
|
-
const
|
|
27
|
+
const t = {
|
|
28
28
|
html: "",
|
|
29
29
|
css: "",
|
|
30
30
|
forceRecreate: !0
|
|
31
31
|
};
|
|
32
32
|
try {
|
|
33
|
-
const n = new URLSearchParams(window.location.search).get("default-template"), s = n ? parseInt(n) : 0, c = s >= 1 && s <=
|
|
33
|
+
const n = new URLSearchParams(window.location.search).get("default-template"), s = n ? parseInt(n) : 0, c = s >= 1 && s <= u ? s : 0, { data: r } = await a(
|
|
34
34
|
`/stripo/default-template/${c}`
|
|
35
35
|
);
|
|
36
|
-
return
|
|
37
|
-
|
|
38
|
-
isObject: typeof t == "object",
|
|
39
|
-
hasHtml: t && "html" in t,
|
|
40
|
-
hasCss: t && "css" in t,
|
|
41
|
-
validTemplateId: c
|
|
42
|
-
}), !t || typeof t != "object" || !("html" in t) || !("css" in t) ? (console.debug("[getDefaultTemplate] Validation failed, returning fallback"), e) : {
|
|
43
|
-
...t,
|
|
36
|
+
return !r || typeof r != "object" || !("html" in r) || !("css" in r) ? t : {
|
|
37
|
+
...r,
|
|
44
38
|
forceRecreate: !0
|
|
45
39
|
};
|
|
46
|
-
} catch (
|
|
47
|
-
return
|
|
40
|
+
} catch (e) {
|
|
41
|
+
return o(e, "Failed to fetch default template"), t;
|
|
48
42
|
}
|
|
49
43
|
}
|
|
50
44
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@useinsider/guido",
|
|
3
|
-
"version": "1.0.3-beta.
|
|
3
|
+
"version": "1.0.3-beta.c633520",
|
|
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",
|