@levo-so/core 0.1.4 → 0.1.8

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.
@@ -0,0 +1,38 @@
1
+ import { WretchError } from 'wretch/resolver';
2
+
3
+ // src/utils/LevoError.ts
4
+ var LevoError = class extends Error {
5
+ code;
6
+ title;
7
+ message;
8
+ constructor(data) {
9
+ super(data.message || data.description);
10
+ this.name = "LevoMembershipError";
11
+ this.code = data.code;
12
+ this.message = data.message || data.description;
13
+ this.title = data.title;
14
+ }
15
+ };
16
+ var getLevoError = (error) => {
17
+ if (error instanceof WretchError) {
18
+ const errorResponse = error?.json;
19
+ if (typeof errorResponse === "object" && errorResponse?.content) {
20
+ const errorMessage = errorResponse?.content;
21
+ return new LevoError(errorMessage);
22
+ }
23
+ }
24
+ let displayMessage = error?.message || "Something unexpected happened.";
25
+ switch (error?.message) {
26
+ case "Network Error":
27
+ displayMessage = "Couldn't connect to our servers.";
28
+ break;
29
+ }
30
+ return new LevoError({
31
+ status: 500,
32
+ title: "Network Error",
33
+ description: displayMessage,
34
+ code: "UNKNOWN_ERROR"
35
+ });
36
+ };
37
+
38
+ export { LevoError, getLevoError };
package/dist/index.d.ts CHANGED
@@ -4,4 +4,6 @@ export * from "./types";
4
4
  export * from "./constants";
5
5
  export * from "./utils/createSrcSet";
6
6
  export * from "./utils/formatImagePath";
7
+ export * from "./utils/getLevoError";
8
+ export * from "./utils/LevoError";
7
9
  //# sourceMappingURL=index.d.ts.map
package/dist/index.js CHANGED
@@ -1,3 +1,4 @@
1
+ export { LevoError, getLevoError } from './chunk-WOD3VIYR.js';
1
2
  export { LevoOAuthProviderList } from './chunk-ZLLCLSGE.js';
2
3
  export { LevoPlugin } from './chunk-QJSKNLTV.js';
3
4
  import wretch from 'wretch';
@@ -1 +1 @@
1
- {"version":3,"file":"LevoAudience.d.ts","sourceRoot":"","sources":["../../src/plugins/LevoAudience.ts"],"names":[],"mappings":"AAEA,OAAO,EAA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H"}
@@ -1,3 +1,4 @@
1
+ import { getLevoError } from '../chunk-WOD3VIYR.js';
1
2
  import { LevoPlugin } from '../chunk-QJSKNLTV.js';
2
3
  import { onUserActivity } from '@analytics/activity-utils';
3
4
  import { getVisitorSource } from '@analytics/visitor-source';
@@ -242,7 +243,7 @@ var LevoAudience = class extends LevoPlugin {
242
243
  identifier: payload.properties.identifier || properties.id,
243
244
  workspace_id: this.client.workspace
244
245
  }).catch((e) => {
245
- console.error(e);
246
+ return getLevoError(e);
246
247
  });
247
248
  },
248
249
  page: ({ payload }) => {
@@ -265,7 +266,7 @@ var LevoAudience = class extends LevoPlugin {
265
266
  identifier: payload.properties.identifier,
266
267
  workspace_id: this.client.workspace
267
268
  }).catch((e) => {
268
- console.error(e);
269
+ return getLevoError(e);
269
270
  });
270
271
  },
271
272
  identify: ({ payload }) => {
@@ -283,7 +284,7 @@ var LevoAudience = class extends LevoPlugin {
283
284
  workspace_id: this.client.workspace
284
285
  }
285
286
  ).catch((e) => {
286
- console.error(e);
287
+ return getLevoError(e);
287
288
  });
288
289
  }
289
290
  };
@@ -2,11 +2,6 @@ import type { WretchOptions } from "wretch";
2
2
  import type { ILevoMembership } from "../types/membership";
3
3
  import { LevoPlugin } from "./LevoPlugin";
4
4
  export declare class LevoMembership<T = ILevoMembership.Account> extends LevoPlugin {
5
- #private;
6
- /**
7
- * The Account of the Currently Logged in Member
8
- */
9
- account: T | null;
10
5
  /**
11
6
  * Get the list of URL for OAuth providers to redirect to
12
7
  * This can be used in the OAuth Buttons like "Continue with Google" etc.
@@ -23,14 +18,14 @@ export declare class LevoMembership<T = ILevoMembership.Account> extends LevoPlu
23
18
  * Sign out the current user's account
24
19
  * @returns T | null
25
20
  */
26
- signOut(options?: WretchOptions): Promise<T | null>;
21
+ signOut(options?: WretchOptions): Promise<T>;
27
22
  /**
28
23
  * Get the current user's account
29
24
  * @returns T | null
30
25
  */
31
- getMe(options?: WretchOptions): Promise<T | null>;
32
- updateMe(data: ILevoMembership.Request.UpdateMe, options?: WretchOptions): Promise<T | null>;
33
- isLoggedIn(options?: WretchOptions): Promise<boolean>;
26
+ getMe(options?: WretchOptions): Promise<T>;
27
+ updateMe<D = ILevoMembership.Request.UpdateMe>(data: D, options?: WretchOptions): Promise<T>;
28
+ isLoggedIn(options?: WretchOptions): Promise<T | null>;
34
29
  requestMagicLink(data: ILevoMembership.Request.RequestMagicLink, options?: WretchOptions): Promise<Pick<ILevoMembership.Otp, "_id" | "content">>;
35
30
  requestOtp(data: ILevoMembership.Request.RequestOtp, options?: WretchOptions): Promise<Pick<ILevoMembership.Otp, "_id" | "content">>;
36
31
  signInWithOtp(data: ILevoMembership.Request.SignInWithOtp, options?: WretchOptions): Promise<T | null>;
@@ -1 +1 @@
1
- {"version":3,"file":"LevoMembership.d.ts","sourceRoot":"","sources":["../../src/plugins/LevoMembership.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AAM5C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAE3D,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAG1C,qBAAa,cAAc,CAAC,CAAC,GAAG,eAAe,CAAC,OAAO,CAAE,SAAQ,UAAU;;IACzE;;OAEG;IACH,OAAO,EAAE,CAAC,GAAG,IAAI,CAAQ;IAMzB;;;;;;;;;;OAUG;IACG,WAAW,CACf,OAAO,GAAE,aAAkB,GAC1B,OAAO,CAAC,eAAe,CAAC,YAAY,CAAC;IAmDxC;;;OAGG;IACG,OAAO,CAAC,OAAO,GAAE,aAAkB,GAAG,OAAO,CAAC,CAAC,GAAG,IAAI,CAAC;IAwB7D;;;OAGG;IACG,KAAK,CAAC,OAAO,GAAE,aAAkB,GAAG,OAAO,CAAC,CAAC,GAAG,IAAI,CAAC;IAyBrD,QAAQ,CACZ,IAAI,EAAE,eAAe,CAAC,OAAO,CAAC,QAAQ,EACtC,OAAO,GAAE,aAAkB,GAC1B,O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'../chunk-ZLLCLSGE.js';
2
2
  import { LevoPlugin } from '../chunk-QJSKNLTV.js';
3
3
 
4
- // src/utils/LevoError.ts
5
- var LevoError = class extends Error {
6
- code;
7
- title;
8
- message;
9
- constructor(data) {
10
- super(data.message || data.description);
11
- this.name = "LevoMembershipError";
12
- this.code = data.code;
13
- this.message = data.message || data.description;
14
- this.title = data.title;
15
- }
16
- };
17
-
18
4
  // src/plugins/LevoMembership.ts
19
5
  var LevoMembership = class extends LevoPlugin {
20
- /**
21
- * The Account of the Currently Logged in Member
22
- */
23
- account = null;
24
- #stall = (body) => {
25
- throw new LevoError(body.content);
26
- };
27
6
  /**
28
7
  * Get the list of URL for OAuth providers to redirect to
29
8
  * This can be used in the OAuth Buttons like "Continue with Google" etc.
@@ -37,12 +16,12 @@ var LevoMembership = class extends LevoPlugin {
37
16
  */
38
17
  async getOAuthURL(options = {}) {
39
18
  try {
40
- const response = await this.client.fetch.url("/v1/membership/auth/oauth/get-redirect-url").options(options).get().json().catch((err) => this.#stall(err.json));
19
+ const response = await this.client.fetch.url("/v1/membership/auth/oauth/get-redirect-url").options(options).get().json();
41
20
  const {
42
21
  content: { data: result }
43
22
  } = response;
44
23
  const providers = Object.keys(result);
45
- if (window) {
24
+ if (typeof window !== "undefined") {
46
25
  for (const provider of providers) {
47
26
  const raw_url = result[provider];
48
27
  if (raw_url) {
@@ -57,104 +36,83 @@ var LevoMembership = class extends LevoPlugin {
57
36
  }
58
37
  }
59
38
  return result;
60
- } catch (error) {
61
- console.error(error);
39
+ } catch (_) {
40
+ return LevoOAuthProviderList.reduce((acc, provider) => {
41
+ acc[provider] = null;
42
+ return acc;
43
+ }, {});
62
44
  }
63
- return LevoOAuthProviderList.reduce((acc, provider) => {
64
- acc[provider] = null;
65
- return acc;
66
- }, {});
67
45
  }
68
46
  /**
69
47
  * Sign out the current user's account
70
48
  * @returns T | null
71
49
  */
72
50
  async signOut(options = {}) {
73
- try {
74
- const response = await this.client.fetch.url("/v1/membership/auth/sign-out").options(options).post("").json().catch((err) => this.#stall(err.json));
75
- const {
76
- content: { data: result }
77
- } = response;
78
- if (result) {
79
- this.account = null;
80
- }
81
- return result;
82
- } catch (error) {
83
- console.error(error);
84
- }
85
- return null;
51
+ const response = await this.client.fetch.url("/v1/membership/auth/sign-out").options(options).post("").json();
52
+ const {
53
+ content: { data: result }
54
+ } = response;
55
+ return result;
86
56
  }
87
57
  /**
88
58
  * Get the current user's account
89
59
  * @returns T | null
90
60
  */
91
61
  async getMe(options = {}) {
92
- try {
93
- const response = await this.client.fetch.url("/v1/membership/auth/get-me").options(options).get().json().catch((err) => this.#stall(err.json));
94
- const {
95
- content: { data: result }
96
- } = response;
97
- if (result) {
98
- this.account = result;
99
- }
100
- return result;
101
- } catch (error) {
102
- console.error(error);
103
- }
104
- return null;
62
+ const response = await this.client.fetch.url("/v1/membership/auth/get-me").options(options).get().json();
63
+ const {
64
+ content: { data: result }
65
+ } = response;
66
+ return result;
105
67
  }
106
68
  async updateMe(data, options = {}) {
107
- try {
108
- const response = await this.client.fetch.url("/v1/membership/auth/update-me").options(options).put(data).json().catch((err) => this.#stall(err.json));
109
- const {
110
- content: { data: result }
111
- } = response;
112
- if (result) {
113
- this.account = result;
114
- }
115
- return result;
116
- } catch (error) {
117
- console.error(error);
118
- }
119
- return null;
69
+ const response = await this.client.fetch.url("/v1/membership/auth/update-me").options(options).put(data).json();
70
+ const {
71
+ content: { data: result }
72
+ } = response;
73
+ return result;
120
74
  }
121
75
  async isLoggedIn(options = {}) {
122
- const account = await this.getMe(options);
123
- return !!account;
76
+ try {
77
+ const account = await this.getMe(options);
78
+ return account;
79
+ } catch (_) {
80
+ return null;
81
+ }
124
82
  }
125
83
  async requestMagicLink(data, options = {}) {
126
84
  if (typeof window !== "undefined" && !data.redirect_uri) {
127
85
  data.redirect_uri = window.location.href;
128
86
  }
129
- const response = await this.client.fetch.url("/v1/membership/auth/request-magic-link").options(options).post(data).json().catch((err) => this.#stall(err.json));
87
+ const response = await this.client.fetch.url("/v1/membership/auth/request-magic-link").options(options).post(data).json();
130
88
  const {
131
89
  content: { data: result }
132
90
  } = response;
133
91
  return result;
134
92
  }
135
93
  async requestOtp(data, options = {}) {
136
- const response = await this.client.fetch.url("/v1/membership/auth/request-otp").options(options).post(data).json().catch((err) => this.#stall(err.json));
94
+ const response = await this.client.fetch.url("/v1/membership/auth/request-otp").options(options).post(data).json();
137
95
  const {
138
96
  content: { data: result }
139
97
  } = response;
140
98
  return result;
141
99
  }
142
100
  async signInWithOtp(data, options = {}) {
143
- const response = await this.client.fetch.url("/v1/membership/auth/signin-with-otp").options(options).post(data).json().catch((err) => this.#stall(err.json));
101
+ const response = await this.client.fetch.url("/v1/membership/auth/signin-with-otp").options(options).post(data).json();
144
102
  const {
145
103
  content: { data: result }
146
104
  } = response;
147
105
  return result;
148
106
  }
149
107
  async signInWithPassword(data, options = {}) {
150
- const response = await this.client.fetch.url("/v1/membership/auth/signin-with-password").options(options).post(data).json().catch((err) => this.#stall(err.json));
108
+ const response = await this.client.fetch.url("/v1/membership/auth/signin-with-password").options(options).post(data).json();
151
109
  const {
152
110
  content: { data: result }
153
111
  } = response;
154
112
  return result;
155
113
  }
156
114
  async signUpWithPassword(data, options = {}) {
157
- const response = await this.client.fetch.url("/v1/membership/auth/signup-with-password").options(options).post(data).json().catch((err) => this.#stall(err.json));
115
+ const response = await this.client.fetch.url("/v1/membership/auth/signup-with-password").options(options).post(data).json();
158
116
  const {
159
117
  content: { data: result }
160
118
  } = response;
@@ -39,16 +39,4 @@ export type IErrorParams = {
39
39
  message: string;
40
40
  param: string;
41
41
  };
42
- export interface IErrorMessage {
43
- status: boolean;
44
- content: {
45
- status: number;
46
- code: string;
47
- title: string;
48
- description: string;
49
- type: string;
50
- "request-id"?: string;
51
- errors?: IErrorParams[];
52
- };
53
- }
54
42
  //# sourceMappingURL=query.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"query.d.ts","sourceRoot":"","sources":["../../src/types/query.ts"],"names":[],"mapp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IACd,MAAM,CAAC,EAAE,CAAC,EAAE,CAAC;IACb,OAAO,CAAC,EAAE;QACR,MAAM,EAAE,MAAM,CAAC;QACf,IAAI,EAAE,MAAM,CAAC;QACb,KAAK,EAAE,MAAM,CAAC;QACd,WAAW,EAAE,MAAM,CAAC;QACpB,IAAI,EAAE,MAAM,CAAC;QACb,YAAY,EAAE,MAAM,CAAC;KACtB,GAAG,CAAC,CAAC;CACP,CAAC;AAEF,MAAM,MAAM,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAE9C,MAAM,MAAM,YAAY,GAAG;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC"}
@@ -1,10 +1,10 @@
1
1
  export type ILevoError = {
2
- message: string;
3
2
  description: string;
4
3
  code: string;
5
- status: string;
4
+ status: number;
6
5
  title: string;
7
- type: string;
6
+ message?: string;
7
+ type?: string;
8
8
  };
9
9
  export declare class LevoError extends Error {
10
10
  code: string;
@@ -1 +1 @@
1
- {"version":3,"file":"LevoError.d.ts","sourceRoot":"","sources":["../../src/utils/LevoError.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,UAAU,GAAG;IACvB,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,qBAAa,SAAU,SAAQ,KAAK;IAClC,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;gBAEJ,IAAI,EAAE,UAAU;CAQ7B"}
1
+ {"version":3,"file":"LevoError.d.ts","sourceRoot":"","sources":["../../src/utils/LevoError.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,UAAU,GAAG;IACvB,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,qBAAa,SAAU,SAAQ,KAAK;IAClC,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;gBAEJ,IAAI,EAAE,UAAU;CAQ7B"}
@@ -0,0 +1,3 @@
1
+ import { LevoError } from "./LevoError";
2
+ export declare const getLevoError: (error: any) => LevoError;
3
+ //# sourceMappingURL=getLevoError.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getLevoError.d.ts","sourceRoot":"","sources":["../../src/utils/getLevoError.ts"],"names":[],"mappings":"AACA,OAAO,EAAmB,SAAS,EAAE,MAAM,aAAa,CAAC;AAEzD,eAAO,MAAM,YAAY,UAAW,GAAG,KAAG,SA4BzC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@levo-so/core",
3
- "version": "0.1.4",
3
+ "version": "0.1.8",
4
4
  "author": "Levo Engineering <devs@theinternetfolks.com>",
5
5
  "description": "Levo common utilities",
6
6
  "type": "module",