@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.
@@ -1,50 +1,44 @@
1
1
  import { useHttp as l } from "../composables/useHttp.js";
2
- import { useToaster as u } from "../composables/useToaster.js";
3
- import { MAX_DEFAULT_TEMPLATE_ID as i } from "../enums/defaults.js";
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: o } = l(), { handleError: r } = u();
5
+ const { get: a } = l(), { handleError: o } = m();
6
6
  return {
7
7
  getToken: async () => {
8
8
  try {
9
- const e = Number(localStorage.getItem("ins-guido-test-instance")), { data: a } = await o(`/stripo/get-user-token?test=${e}`);
10
- return a.body.token;
11
- } catch (e) {
12
- return r(e, "Failed to fetch token"), "";
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: e = [] } = await o("/stripo/get-partner-custom-fonts");
18
- return e.map((a) => ({
19
- ...a,
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 (e) {
23
- return r(e, "Failed to fetch custom fonts"), [];
22
+ } catch (t) {
23
+ return o(t, "Failed to fetch custom fonts"), [];
24
24
  }
25
25
  },
26
26
  getDefaultTemplate: async () => {
27
- const e = {
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 <= i ? s : 0, { data: t } = await o(
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 console.debug("[getDefaultTemplate]", {
37
- dataType: typeof t,
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 (a) {
47
- return r(a, "Failed to fetch default template"), e;
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.c600a63",
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",