@levo-so/core 0.1.2 → 0.1.7
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/chunk-WOD3VIYR.js +38 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +1 -0
- package/dist/plugins/LevoAudience.d.ts +1 -1
- package/dist/plugins/LevoAudience.d.ts.map +1 -1
- package/dist/plugins/LevoAudience.js +4 -3
- package/dist/plugins/LevoBlog.d.ts +2 -2
- package/dist/plugins/LevoBlog.d.ts.map +1 -1
- package/dist/plugins/LevoCollection.d.ts +2 -2
- package/dist/plugins/LevoCollection.d.ts.map +1 -1
- package/dist/plugins/LevoLogger.d.ts +1 -1
- package/dist/plugins/LevoLogger.d.ts.map +1 -1
- package/dist/plugins/LevoMedia.d.ts +2 -2
- package/dist/plugins/LevoMedia.d.ts.map +1 -1
- package/dist/plugins/LevoMembership.d.ts +11 -16
- package/dist/plugins/LevoMembership.d.ts.map +1 -1
- package/dist/plugins/LevoMembership.js +35 -79
- package/dist/types/collection/lemaField.d.ts +2 -2
- package/dist/types/collection/lemaField.d.ts.map +1 -1
- package/dist/types/membership/index.d.ts +3 -9
- package/dist/types/membership/index.d.ts.map +1 -1
- package/dist/types/query.d.ts +0 -23
- package/dist/types/query.d.ts.map +1 -1
- package/dist/types/schema/field.d.ts +3 -2
- package/dist/types/schema/field.d.ts.map +1 -1
- package/dist/utils/LevoError.d.ts +15 -0
- package/dist/utils/LevoError.d.ts.map +1 -0
- package/dist/utils/getLevoError.d.ts +3 -0
- package/dist/utils/getLevoError.d.ts.map +1 -0
- package/package.json +10 -10
- package/dist/utils/LevoMembershipError.d.ts +0 -8
- package/dist/utils/LevoMembershipError.d.ts.map +0 -1
|
@@ -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
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type AnalyticsInstance } from "analytics";
|
|
2
|
-
import { LevoPlugin } from "./LevoPlugin";
|
|
3
2
|
import type { ILevoAudience } from "../types/audience";
|
|
3
|
+
import { LevoPlugin } from "./LevoPlugin";
|
|
4
4
|
export declare class LevoAudience extends LevoPlugin {
|
|
5
5
|
#private;
|
|
6
6
|
instance: AnalyticsInstance | null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LevoAudience.d.ts","sourceRoot":"","sources":["../../src/plugins/LevoAudience.ts"],"names":[],"mappings":"AAEA,OAAO,EAAa,KAAK,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAE9D,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"LevoAudience.d.ts","sourceRoot":"","sources":["../../src/plugins/LevoAudience.ts"],"names":[],"mappings":"AAEA,OAAO,EAAa,KAAK,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAE9D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAEvD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAG1C,qBAAa,YAAa,SAAQ,UAAU;;IAC1C,QAAQ,EAAE,iBAAiB,GAAG,IAAI,CAAQ;IAK1C,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG;IASxB,QAAQ,CAAC,UAAU,EAAE,aAAa,CAAC,UAAU;IA6FnD,WAAW;;;;;IAmEX,qBAAqB;IAqBf,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,aAAa,CAAC,UAAU;IAM/D,KAAK,4BAGF;QAAE,UAAU,CAAC,EAAE,aAAa,CAAC,UAAU,CAAC;QAAC,MAAM,EAAE,WAAW,CAAA;KAAE,UAO/D;CACH"}
|
|
@@ -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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
287
|
+
return getLevoError(e);
|
|
287
288
|
});
|
|
288
289
|
}
|
|
289
290
|
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type { BlogClient,
|
|
1
|
+
import type { BlogClient, IResponseMultiple, IResponseSingle } from "../types";
|
|
2
2
|
import type { LevoQuery } from "../types/levo-query";
|
|
3
3
|
import { LevoPlugin } from "./LevoPlugin";
|
|
4
4
|
export declare class LevoBlog extends LevoPlugin {
|
|
5
|
-
getAllBlogs(blog_key: string, data?: LevoQuery.FindQuery, options?: BlogClient.OptionParams): Promise<
|
|
5
|
+
getAllBlogs(blog_key: string, data?: LevoQuery.FindQuery, options?: BlogClient.OptionParams): Promise<IResponseMultiple<import("../types").IPost>>;
|
|
6
6
|
getSingleBlog(blog_key: string, slug: string, options?: BlogClient.OptionParams): Promise<IResponseSingle<import("../types").IPost, any>>;
|
|
7
7
|
}
|
|
8
8
|
//# sourceMappingURL=LevoBlog.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LevoBlog.d.ts","sourceRoot":"","sources":["../../src/plugins/LevoBlog.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"LevoBlog.d.ts","sourceRoot":"","sources":["../../src/plugins/LevoBlog.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAC/E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,qBAAa,QAAS,SAAQ,UAAU;IACtC,WAAW,CACT,QAAQ,EAAE,MAAM,EAChB,IAAI,GAAE,SAAS,CAAC,SAAc,EAC9B,OAAO,CAAC,EAAE,UAAU,CAAC,YAAY;IAcnC,aAAa,CACX,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,MAAM,EACZ,OAAO,CAAC,EAAE,UAAU,CAAC,YAAY;CAapC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { WretchOptions } from "wretch";
|
|
2
|
-
import { LevoPlugin } from "./LevoPlugin";
|
|
3
|
-
import type { LevoQuery } from "../types/levo-query";
|
|
4
2
|
import type { IDraftEntry, ILemaCollection, IResponseMultiple, IResponseSingle } from "../types";
|
|
3
|
+
import type { LevoQuery } from "../types/levo-query";
|
|
4
|
+
import { LevoPlugin } from "./LevoPlugin";
|
|
5
5
|
export declare class LevoCollection extends LevoPlugin {
|
|
6
6
|
getAllCollections(data?: LevoQuery.FindQuery, options?: WretchOptions): Promise<IResponseMultiple<ILemaCollection>>;
|
|
7
7
|
getCollectionByIDExpanded<T = ILemaCollection>(id: string, options?: WretchOptions): Promise<IResponseSingle<T, any>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LevoCollection.d.ts","sourceRoot":"","sources":["../../src/plugins/LevoCollection.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AAC5C,OAAO,
|
|
1
|
+
{"version":3,"file":"LevoCollection.d.ts","sourceRoot":"","sources":["../../src/plugins/LevoCollection.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AAC5C,OAAO,KAAK,EACV,WAAW,EACX,eAAe,EACf,iBAAiB,EACjB,eAAe,EAChB,MAAM,UAAU,CAAC;AAClB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,qBAAa,cAAe,SAAQ,UAAU;IAC5C,iBAAiB,CAAC,IAAI,GAAE,SAAS,CAAC,SAAc,EAAE,OAAO,CAAC,EAAE,aAAa;IAUzE,yBAAyB,CAAC,CAAC,GAAG,eAAe,EAC3C,EAAE,EAAE,MAAM,EACV,OAAO,GAAE,aAAkB;IAS7B,gBAAgB,CAAC,IAAI,EAAE,eAAe;IAOtC,kBAAkB,CAAC,EACjB,aAAa,EACb,IAAI,EACJ,OAAY,GACb,EAAE;QACD,aAAa,EAAE,MAAM,CAAC;QACtB,IAAI,EAAE,GAAG,CAAC;QACV,OAAO,CAAC,EAAE,aAAa,CAAC;KACzB;IAQD,wBAAwB,CAAC,EACvB,cAAc,EACd,IAAI,EACJ,MAAM,EACN,KAAU,GACX,EAAE;QACD,cAAc,EAAE,MAAM,CAAC;QACvB,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,KAAK,CAAC,EAAE,MAAM,CAAC;KAChB;IAYD,cAAc,CAAC,cAAc,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG;IAOhD,aAAa,CAAC,cAAc,EAAE,MAAM;IAOpC,gBAAgB,CAAC,cAAc,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG;CAMnD"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import logger from "loglevel";
|
|
2
|
-
import { LevoPlugin } from "./LevoPlugin";
|
|
3
2
|
import type LevoClient from "../LevoClient";
|
|
3
|
+
import { LevoPlugin } from "./LevoPlugin";
|
|
4
4
|
export declare class LevoLogger extends LevoPlugin {
|
|
5
5
|
logger: logger.RootLogger;
|
|
6
6
|
constructor(props: LevoClient);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LevoLogger.d.ts","sourceRoot":"","sources":["../../src/plugins/LevoLogger.ts"],"names":[],"mappings":"AACA,OAAO,MAAM,MAAM,UAAU,CAAC;AAE9B,OAAO,
|
|
1
|
+
{"version":3,"file":"LevoLogger.d.ts","sourceRoot":"","sources":["../../src/plugins/LevoLogger.ts"],"names":[],"mappings":"AACA,OAAO,MAAM,MAAM,UAAU,CAAC;AAE9B,OAAO,KAAK,UAAU,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,qBAAa,UAAW,SAAQ,UAAU;IACxC,MAAM,EAAE,MAAM,CAAC,UAAU,CAAU;gBAEvB,KAAK,EAAE,UAAU;CAwB9B"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { WretchOptions } from "wretch";
|
|
2
|
-
import type { IMedia, IResponseMultiple
|
|
2
|
+
import type { IMedia, IResponseMultiple } from "../types";
|
|
3
3
|
import type { LevoQuery } from "../types/levo-query";
|
|
4
4
|
import { LevoPlugin } from "./LevoPlugin";
|
|
5
5
|
export declare class LevoMedia extends LevoPlugin {
|
|
6
6
|
mediaBulkUpload: (formData: FormData, options?: WretchOptions) => Promise<IResponseMultiple<IMedia>>;
|
|
7
|
-
getAllMedia: (data?: LevoQuery.FindQuery) => Promise<
|
|
7
|
+
getAllMedia: (data?: LevoQuery.FindQuery) => Promise<IResponseMultiple<IMedia>>;
|
|
8
8
|
}
|
|
9
9
|
//# sourceMappingURL=LevoMedia.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LevoMedia.d.ts","sourceRoot":"","sources":["../../src/plugins/LevoMedia.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AAC5C,OAAO,KAAK,EAAE,MAAM,EAAE,iBAAiB,EAAE,
|
|
1
|
+
{"version":3,"file":"LevoMedia.d.ts","sourceRoot":"","sources":["../../src/plugins/LevoMedia.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AAC5C,OAAO,KAAK,EAAE,MAAM,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAC1D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,qBAAa,SAAU,SAAQ,UAAU;IACvC,eAAe,aAAc,QAAQ,YAAW,aAAa,wCAM3D;IAEF,WAAW,UAAgB,SAAS,CAAC,SAAS,wCAK5C;CACH"}
|
|
@@ -1,12 +1,7 @@
|
|
|
1
1
|
import type { WretchOptions } from "wretch";
|
|
2
|
-
import { LevoPlugin } from "./LevoPlugin";
|
|
3
2
|
import type { ILevoMembership } from "../types/membership";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* The Account of the Currently Logged in Member
|
|
8
|
-
*/
|
|
9
|
-
account: ILevoMembership.Account | null;
|
|
3
|
+
import { LevoPlugin } from "./LevoPlugin";
|
|
4
|
+
export declare class LevoMembership<T = ILevoMembership.Account> extends LevoPlugin {
|
|
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.
|
|
@@ -21,20 +16,20 @@ export declare class LevoMembership extends LevoPlugin {
|
|
|
21
16
|
getOAuthURL(options?: WretchOptions): Promise<ILevoMembership.OAuthURLList>;
|
|
22
17
|
/**
|
|
23
18
|
* Sign out the current user's account
|
|
24
|
-
* @returns
|
|
19
|
+
* @returns T | null
|
|
25
20
|
*/
|
|
26
|
-
signOut(options?: WretchOptions): Promise<
|
|
21
|
+
signOut(options?: WretchOptions): Promise<T>;
|
|
27
22
|
/**
|
|
28
23
|
* Get the current user's account
|
|
29
|
-
* @returns
|
|
24
|
+
* @returns T | null
|
|
30
25
|
*/
|
|
31
|
-
getMe(options?: WretchOptions): Promise<
|
|
32
|
-
updateMe
|
|
33
|
-
isLoggedIn(options?: WretchOptions): Promise<
|
|
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
|
-
signInWithOtp(data: ILevoMembership.Request.SignInWithOtp, options?: WretchOptions): Promise<
|
|
37
|
-
signInWithPassword(data: ILevoMembership.Request.SignInWithPassword, options?: WretchOptions): Promise<
|
|
38
|
-
signUpWithPassword(data: ILevoMembership.Request.SignUpWithPassword, options?: WretchOptions): Promise<
|
|
31
|
+
signInWithOtp(data: ILevoMembership.Request.SignInWithOtp, options?: WretchOptions): Promise<T | null>;
|
|
32
|
+
signInWithPassword(data: ILevoMembership.Request.SignInWithPassword, options?: WretchOptions): Promise<T | null>;
|
|
33
|
+
signUpWithPassword(data: ILevoMembership.Request.SignUpWithPassword, options?: WretchOptions): Promise<T | null>;
|
|
39
34
|
}
|
|
40
35
|
//# sourceMappingURL=LevoMembership.d.ts.map
|
|
@@ -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;
|
|
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;AAC3D,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAG1C,qBAAa,cAAc,CAAC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,aAAkB,GAC1B,OAAO,CAAC,CAAC,GAAG,IAAI,CAAC;CAarB"}
|
|
@@ -1,31 +1,8 @@
|
|
|
1
1
|
import { LevoOAuthProviderList } from '../chunk-ZLLCLSGE.js';
|
|
2
2
|
import { LevoPlugin } from '../chunk-QJSKNLTV.js';
|
|
3
3
|
|
|
4
|
-
// src/utils/LevoMembershipError.ts
|
|
5
|
-
var LevoMembershipError = 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 LevoMembershipError(
|
|
26
|
-
body.content
|
|
27
|
-
);
|
|
28
|
-
};
|
|
29
6
|
/**
|
|
30
7
|
* Get the list of URL for OAuth providers to redirect to
|
|
31
8
|
* This can be used in the OAuth Buttons like "Continue with Google" etc.
|
|
@@ -39,12 +16,12 @@ var LevoMembership = class extends LevoPlugin {
|
|
|
39
16
|
*/
|
|
40
17
|
async getOAuthURL(options = {}) {
|
|
41
18
|
try {
|
|
42
|
-
const response = await this.client.fetch.url("/v1/membership/auth/oauth/get-redirect-url").options(options).get().json()
|
|
19
|
+
const response = await this.client.fetch.url("/v1/membership/auth/oauth/get-redirect-url").options(options).get().json();
|
|
43
20
|
const {
|
|
44
21
|
content: { data: result }
|
|
45
22
|
} = response;
|
|
46
23
|
const providers = Object.keys(result);
|
|
47
|
-
if (window) {
|
|
24
|
+
if (typeof window !== "undefined") {
|
|
48
25
|
for (const provider of providers) {
|
|
49
26
|
const raw_url = result[provider];
|
|
50
27
|
if (raw_url) {
|
|
@@ -59,104 +36,83 @@ var LevoMembership = class extends LevoPlugin {
|
|
|
59
36
|
}
|
|
60
37
|
}
|
|
61
38
|
return result;
|
|
62
|
-
} catch (
|
|
63
|
-
|
|
39
|
+
} catch (_) {
|
|
40
|
+
return LevoOAuthProviderList.reduce((acc, provider) => {
|
|
41
|
+
acc[provider] = null;
|
|
42
|
+
return acc;
|
|
43
|
+
}, {});
|
|
64
44
|
}
|
|
65
|
-
return LevoOAuthProviderList.reduce((acc, provider) => {
|
|
66
|
-
acc[provider] = null;
|
|
67
|
-
return acc;
|
|
68
|
-
}, {});
|
|
69
45
|
}
|
|
70
46
|
/**
|
|
71
47
|
* Sign out the current user's account
|
|
72
|
-
* @returns
|
|
48
|
+
* @returns T | null
|
|
73
49
|
*/
|
|
74
50
|
async signOut(options = {}) {
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
if (result) {
|
|
81
|
-
this.account = null;
|
|
82
|
-
}
|
|
83
|
-
return result;
|
|
84
|
-
} catch (error) {
|
|
85
|
-
console.error(error);
|
|
86
|
-
}
|
|
87
|
-
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;
|
|
88
56
|
}
|
|
89
57
|
/**
|
|
90
58
|
* Get the current user's account
|
|
91
|
-
* @returns
|
|
59
|
+
* @returns T | null
|
|
92
60
|
*/
|
|
93
61
|
async getMe(options = {}) {
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
if (result) {
|
|
100
|
-
this.account = result;
|
|
101
|
-
}
|
|
102
|
-
return result;
|
|
103
|
-
} catch (error) {
|
|
104
|
-
console.error(error);
|
|
105
|
-
}
|
|
106
|
-
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;
|
|
107
67
|
}
|
|
108
68
|
async updateMe(data, options = {}) {
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
if (result) {
|
|
115
|
-
this.account = result;
|
|
116
|
-
}
|
|
117
|
-
return result;
|
|
118
|
-
} catch (error) {
|
|
119
|
-
console.error(error);
|
|
120
|
-
}
|
|
121
|
-
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;
|
|
122
74
|
}
|
|
123
75
|
async isLoggedIn(options = {}) {
|
|
124
|
-
|
|
125
|
-
|
|
76
|
+
try {
|
|
77
|
+
const account = await this.getMe(options);
|
|
78
|
+
return account;
|
|
79
|
+
} catch (_) {
|
|
80
|
+
return null;
|
|
81
|
+
}
|
|
126
82
|
}
|
|
127
83
|
async requestMagicLink(data, options = {}) {
|
|
128
84
|
if (typeof window !== "undefined" && !data.redirect_uri) {
|
|
129
85
|
data.redirect_uri = window.location.href;
|
|
130
86
|
}
|
|
131
|
-
const response = await this.client.fetch.url("/v1/membership/auth/request-magic-link").options(options).post(data).json()
|
|
87
|
+
const response = await this.client.fetch.url("/v1/membership/auth/request-magic-link").options(options).post(data).json();
|
|
132
88
|
const {
|
|
133
89
|
content: { data: result }
|
|
134
90
|
} = response;
|
|
135
91
|
return result;
|
|
136
92
|
}
|
|
137
93
|
async requestOtp(data, options = {}) {
|
|
138
|
-
const response = await this.client.fetch.url("/v1/membership/auth/request-otp").options(options).post(data).json()
|
|
94
|
+
const response = await this.client.fetch.url("/v1/membership/auth/request-otp").options(options).post(data).json();
|
|
139
95
|
const {
|
|
140
96
|
content: { data: result }
|
|
141
97
|
} = response;
|
|
142
98
|
return result;
|
|
143
99
|
}
|
|
144
100
|
async signInWithOtp(data, options = {}) {
|
|
145
|
-
const response = await this.client.fetch.url("/v1/membership/auth/signin-with-otp").options(options).post(data).json()
|
|
101
|
+
const response = await this.client.fetch.url("/v1/membership/auth/signin-with-otp").options(options).post(data).json();
|
|
146
102
|
const {
|
|
147
103
|
content: { data: result }
|
|
148
104
|
} = response;
|
|
149
105
|
return result;
|
|
150
106
|
}
|
|
151
107
|
async signInWithPassword(data, options = {}) {
|
|
152
|
-
const response = await this.client.fetch.url("/v1/membership/auth/signin-with-password").options(options).post(data).json()
|
|
108
|
+
const response = await this.client.fetch.url("/v1/membership/auth/signin-with-password").options(options).post(data).json();
|
|
153
109
|
const {
|
|
154
110
|
content: { data: result }
|
|
155
111
|
} = response;
|
|
156
112
|
return result;
|
|
157
113
|
}
|
|
158
114
|
async signUpWithPassword(data, options = {}) {
|
|
159
|
-
const response = await this.client.fetch.url("/v1/membership/auth/signup-with-password").options(options).post(data).json()
|
|
115
|
+
const response = await this.client.fetch.url("/v1/membership/auth/signup-with-password").options(options).post(data).json();
|
|
160
116
|
const {
|
|
161
117
|
content: { data: result }
|
|
162
118
|
} = response;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { FieldInterfacesList, FieldKind } from "../../constants";
|
|
2
|
-
import type { Mandatory } from "../utils";
|
|
3
2
|
import type { IMediaObject } from "../media";
|
|
4
3
|
import type { IField } from "../schema/field";
|
|
5
|
-
import type {
|
|
4
|
+
import type { Mandatory } from "../utils";
|
|
6
5
|
import type { ILemaCollection } from "./lemaCollection";
|
|
6
|
+
import type { ILemaCollectionRelationship, ILemaRelationOnDelete } from "./relation";
|
|
7
7
|
export interface ILemaFieldOptions {
|
|
8
8
|
collection_key?: string;
|
|
9
9
|
collection_id?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lemaField.d.ts","sourceRoot":"","sources":["../../../src/types/collection/lemaField.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACtE,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"lemaField.d.ts","sourceRoot":"","sources":["../../../src/types/collection/lemaField.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACtE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAC1C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACxD,OAAO,KAAK,EACV,2BAA2B,EAC3B,qBAAqB,EACtB,MAAM,YAAY,CAAC;AAEpB,MAAM,WAAW,iBAAiB;IAChC,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,eAAe,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,2BAA2B,CAAC,EAAE,OAAO,CAAC;IACtC,2BAA2B,CAAC,EAAE,OAAO,CAAC;IACtC,YAAY,CAAC,EAAE,2BAA2B,GAAG,MAAM,CAAC;IACpD,SAAS,CAAC,EAAE,qBAAqB,CAAC;IAElC;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IAGd,aAAa,CAAC,EAAE,MAAM,CAAC;IAGvB,cAAc,CAAC,EAAE,MAAM,CAAC;IAGxB,YAAY,CAAC,EAAE,OAAO,CAAC;IAGvB,UAAU,CAAC,EAAE,eAAe,GAAG,IAAI,CAAC;IAEpC,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC7B;AAED,MAAM,MAAM,UAAU,GAAG,SAAS,CAChC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oError } from "../../utils/LevoError";
|
|
1
3
|
import type { IMediaObject } from "../media";
|
|
2
4
|
import type { IResponseSingle } from "../query";
|
|
3
|
-
import type { LevoOAuthProviderList } from "../../constants/oauthProvider";
|
|
4
5
|
export declare namespace ILevoMembership {
|
|
5
6
|
interface sub_account_oauth_credentials {
|
|
6
7
|
provider: string;
|
|
@@ -169,14 +170,7 @@ export declare namespace ILevoMembership {
|
|
|
169
170
|
export namespace Response {
|
|
170
171
|
type Error = {
|
|
171
172
|
status: false;
|
|
172
|
-
content:
|
|
173
|
-
message: string;
|
|
174
|
-
description: string;
|
|
175
|
-
code: string;
|
|
176
|
-
status: string;
|
|
177
|
-
title: string;
|
|
178
|
-
type: string;
|
|
179
|
-
};
|
|
173
|
+
content: ILevoError;
|
|
180
174
|
};
|
|
181
175
|
type ListOAuthURLs = IResponseSingle<ILevoMembership.OAuthURLList>;
|
|
182
176
|
type SignOut = IResponseSingle<ILevoMembership.Account>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/types/membership/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/types/membership/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AAC3E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAEhD,yBAAiB,eAAe,CAAC;IAC/B,UAAU,6BAA6B;QACrC,QAAQ,EAAE,MAAM,CAAC;QACjB,QAAQ,EAAE,MAAM,CAAC;KAClB;IAED;;OAEG;IACH,MAAM,WAAW,OAAO;QACtB,GAAG,EAAE,MAAM,CAAC;QACZ,UAAU,EAAE,MAAM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K,GAAG,SAAS,CAAC,CAC7C,CAAC;QAEF,KAAY,gBAAgB,GAAG,eAAe,CAC5C,IAAI,CAAC,eAAe,CAAC,GAAG,EAAE,KAAK,GAAG,SAAS,CAAC,CAC7C,CAAC;QAEF,KAAY,aAAa,GAAG,eAAe,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC;QAErE,KAAY,kBAAkB,GAAG,eAAe,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC;QAE1E,KAAY,kBAAkB,GAAG,eAAe,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC;QAE1E,KAAY,QAAQ,GAAG,eAAe,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC;KACjE;;CACF"}
|
package/dist/types/query.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
export interface IMeta {
|
|
2
2
|
total: number;
|
|
3
|
-
filter_count: number;
|
|
4
3
|
pages: number;
|
|
5
4
|
}
|
|
6
5
|
export interface IResponseMultiple<T = Record<string, unknown>> {
|
|
@@ -10,16 +9,6 @@ export interface IResponseMultiple<T = Record<string, unknown>> {
|
|
|
10
9
|
data: T[];
|
|
11
10
|
};
|
|
12
11
|
}
|
|
13
|
-
export interface IResponseMultipleV2<T = Record<string, unknown>> {
|
|
14
|
-
status: true;
|
|
15
|
-
content: {
|
|
16
|
-
meta: {
|
|
17
|
-
total: number;
|
|
18
|
-
pages: number;
|
|
19
|
-
};
|
|
20
|
-
data: T[];
|
|
21
|
-
};
|
|
22
|
-
}
|
|
23
12
|
export interface IResponseSingle<T = Record<string, unknown>, Meta = any> {
|
|
24
13
|
status: boolean;
|
|
25
14
|
content: {
|
|
@@ -50,16 +39,4 @@ export type IErrorParams = {
|
|
|
50
39
|
message: string;
|
|
51
40
|
param: string;
|
|
52
41
|
};
|
|
53
|
-
export interface IErrorMessage {
|
|
54
|
-
status: boolean;
|
|
55
|
-
content: {
|
|
56
|
-
status: number;
|
|
57
|
-
code: string;
|
|
58
|
-
title: string;
|
|
59
|
-
description: string;
|
|
60
|
-
type: string;
|
|
61
|
-
"request-id"?: string;
|
|
62
|
-
errors?: IErrorParams[];
|
|
63
|
-
};
|
|
64
|
-
}
|
|
65
42
|
//# sourceMappingURL=query.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"query.d.ts","sourceRoot":"","sources":["../../src/types/query.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,KAAK;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,
|
|
1
|
+
{"version":3,"file":"query.d.ts","sourceRoot":"","sources":["../../src/types/query.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,KAAK;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,iBAAiB,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAC5D,MAAM,EAAE,OAAO,CAAC;IAChB,OAAO,EAAE;QACP,IAAI,EAAE,KAAK,CAAC;QACZ,IAAI,EAAE,CAAC,EAAE,CAAC;KACX,CAAC;CACH;AAED,MAAM,WAAW,eAAe,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,IAAI,GAAG,GAAG;IACtE,MAAM,EAAE,OAAO,CAAC;IAChB,OAAO,EAAE;QACP,IAAI,EAAE,CAAC,CAAC;QACR,IAAI,EAAE,IAAI,CAAC;KACZ,CAAC;CACH;AAED,MAAM,WAAW,mBAAmB,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAC9D,MAAM,EAAE,OAAO,CAAC;IAChB,OAAO,EAAE;QACP,IAAI,EAAE,CAAC,EAAE,CAAC;KACX,CAAC;CACH;AAED,MAAM,MAAM,cAAc,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,IAAI;IACxD,MAAM,EAAE,KAAK,CAAC;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,11 +1,12 @@
|
|
|
1
|
-
import type { FieldKindList } from "../../constants";
|
|
1
|
+
import type { FieldInterfacesList, FieldKindList } from "../../constants";
|
|
2
2
|
export interface IField {
|
|
3
3
|
id: string;
|
|
4
4
|
key: string;
|
|
5
5
|
kind: (typeof FieldKindList)[number];
|
|
6
|
-
field_interface:
|
|
6
|
+
field_interface: (typeof FieldInterfacesList)[number] | "HeadingWidget" | "ButtonWidget" | "ImageWidget" | "MultiImageWidget" | "TypographyWidget" | "LayoutWidget" | "RepeatableWidget" | "TitleWidget" | "CardWidget" | "LinkWidget";
|
|
7
7
|
label: string;
|
|
8
8
|
helper_text?: string;
|
|
9
|
+
placeholder?: string;
|
|
9
10
|
default_value?: any;
|
|
10
11
|
readonly?: boolean;
|
|
11
12
|
fields?: IField[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"field.d.ts","sourceRoot":"","sources":["../../../src/types/schema/field.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"field.d.ts","sourceRoot":"","sources":["../../../src/types/schema/field.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAE1E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|
|
2
|
+
description: string;
|
|
3
|
+
code: string;
|
|
4
|
+
status: number;
|
|
5
|
+
title: string;
|
|
6
|
+
message?: string;
|
|
7
|
+
type?: string;
|
|
8
|
+
};
|
|
9
|
+
export declare class LevoError extends Error {
|
|
10
|
+
code: string;
|
|
11
|
+
title: string;
|
|
12
|
+
message: string;
|
|
13
|
+
constructor(data: ILevoError);
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=LevoError.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
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 @@
|
|
|
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.
|
|
3
|
+
"version": "0.1.7",
|
|
4
4
|
"author": "Levo Engineering <devs@theinternetfolks.com>",
|
|
5
5
|
"description": "Levo common utilities",
|
|
6
6
|
"type": "module",
|
|
@@ -14,16 +14,16 @@
|
|
|
14
14
|
"package.json"
|
|
15
15
|
],
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"wretch": "
|
|
18
|
-
"@analytics/activity-utils": "
|
|
19
|
-
"@analytics/visitor-source": "
|
|
20
|
-
"loglevel": "
|
|
21
|
-
"analytics": "
|
|
22
|
-
"get-user-locale": "
|
|
17
|
+
"wretch": "2.9.0",
|
|
18
|
+
"@analytics/activity-utils": "0.1.16",
|
|
19
|
+
"@analytics/visitor-source": "0.0.7",
|
|
20
|
+
"loglevel": "1.9.1",
|
|
21
|
+
"analytics": "0.8.14",
|
|
22
|
+
"get-user-locale": "2.3.2"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
|
-
"tsup": "
|
|
26
|
-
"typescript": "
|
|
25
|
+
"tsup": "8.2.4",
|
|
26
|
+
"typescript": "5.5.4",
|
|
27
27
|
"@levo/ts-config": "0.0.0"
|
|
28
28
|
},
|
|
29
29
|
"main": "./dist/index.js",
|
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
"clean": "rimraf dist node_modules .turbo",
|
|
64
64
|
"check-types": "tsc --noEmit",
|
|
65
65
|
"format-and-lint": "biome check .",
|
|
66
|
-
"format-and-lint:fix": "biome check . --write",
|
|
66
|
+
"format-and-lint:fix": "biome check . --write --diagnostic-level=error",
|
|
67
67
|
"build": "tsup",
|
|
68
68
|
"dev": "tsup --watch"
|
|
69
69
|
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { ILevoMembership } from "../types/membership";
|
|
2
|
-
export declare class LevoMembershipError extends Error {
|
|
3
|
-
code: string;
|
|
4
|
-
title: string;
|
|
5
|
-
message: string;
|
|
6
|
-
constructor(data: ILevoMembership.Response.Error["content"]);
|
|
7
|
-
}
|
|
8
|
-
//# sourceMappingURL=LevoMembershipError.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"LevoMembershipError.d.ts","sourceRoot":"","sources":["../../src/utils/LevoMembershipError.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAE3D,qBAAa,mBAAoB,SAAQ,KAAK;IAC5C,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;gBAEJ,IAAI,EAAE,eAAe,CAAC,QAAQ,CAAC,KAAK,CAAC,SAAS,CAAC;CAQ5D"}
|