@useinsider/guido 1.4.3 → 1.4.4-beta.42313ae

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.
@@ -23,11 +23,11 @@ const e = {
23
23
  }, t = {
24
24
  promotional: 1,
25
25
  transactional: 2
26
- }, a = "email", o = "Guido User", s = t.promotional, n = 2, i = {
26
+ }, a = "email", o = "Guido User", s = t.promotional, n = 2, i = 13, u = {
27
27
  email: 60,
28
28
  architect: 49,
29
29
  unsubscribePages: 97
30
- }, u = [
30
+ }, r = [
31
31
  "alfredtesting",
32
32
  "electio",
33
33
  "eurekatest",
@@ -65,7 +65,8 @@ export {
65
65
  a as DefaultProductType,
66
66
  o as DefaultUsername,
67
67
  n as EditorType,
68
- i as ProductIds,
69
- u as TEST_PARTNER_LIST,
68
+ i as MAX_DEFAULT_TEMPLATE_ID,
69
+ u as ProductIds,
70
+ r as TEST_PARTNER_LIST,
70
71
  t as TemplateTypes
71
72
  };
@@ -1,7 +1,8 @@
1
- import { useHttp as a } from "../composables/useHttp.js";
2
- import { useToaster as s } from "../composables/useToaster.js";
3
- const m = () => {
4
- const { get: r } = a(), { handleError: o } = s();
1
+ import { useHttp as m } 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";
4
+ const y = () => {
5
+ const { get: r } = m(), { handleError: o } = u();
5
6
  return {
6
7
  getToken: async () => {
7
8
  try {
@@ -29,15 +30,13 @@ const m = () => {
29
30
  forceRecreate: !0
30
31
  };
31
32
  try {
32
- const { data: e } = await r("/stripo/default-template/0");
33
- try {
34
- return {
35
- ...JSON.parse(e),
36
- forceRecreate: !0
37
- };
38
- } catch {
39
- return t;
40
- }
33
+ const c = new URLSearchParams(window.location.search).get("default-template"), s = c ? parseInt(c) : 0, l = s >= 1 && s <= i ? s : 0, { data: n } = await r(
34
+ `/stripo/default-template/${l}`
35
+ ), a = typeof n == "string" ? JSON.parse(n) : n;
36
+ return !a || typeof a != "object" || !("html" in a) || !("css" in a) ? t : {
37
+ ...a,
38
+ forceRecreate: !0
39
+ };
41
40
  } catch (e) {
42
41
  return o(e, "Failed to fetch default template"), t;
43
42
  }
@@ -45,5 +44,5 @@ const m = () => {
45
44
  };
46
45
  };
47
46
  export {
48
- m as useStripoApi
47
+ y as useStripoApi
49
48
  };
@@ -8,5 +8,6 @@ export declare const DefaultProductType = "email";
8
8
  export declare const DefaultUsername = "Guido User";
9
9
  export declare const DefaultMessageType: number;
10
10
  export declare const EditorType: number;
11
+ export declare const MAX_DEFAULT_TEMPLATE_ID = 13;
11
12
  export declare const ProductIds: Record<string, number>;
12
13
  export declare const TEST_PARTNER_LIST: string[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@useinsider/guido",
3
- "version": "1.4.3",
3
+ "version": "1.4.4-beta.42313ae",
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",