@levo-so/core 0.1.34 → 0.1.36

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.
Files changed (46) hide show
  1. package/dist/client.d.ts +72 -0
  2. package/dist/constants/media.d.ts +1 -1
  3. package/dist/control/audience.d.ts +13 -0
  4. package/dist/control/audience.d.ts.map +1 -0
  5. package/dist/control/index.d.ts +23 -0
  6. package/dist/control/index.d.ts.map +1 -0
  7. package/dist/httpClient.d.ts +13 -0
  8. package/dist/index.d.ts +2 -2
  9. package/dist/index.js +1124 -70
  10. package/dist/logger/batch.d.ts +3 -10
  11. package/dist/logger/batch.d.ts.map +1 -1
  12. package/dist/logger/index.d.ts +22 -0
  13. package/dist/logger/index.d.ts.map +1 -0
  14. package/dist/modules/blog.d.ts +10 -0
  15. package/dist/modules/blog.d.ts.map +1 -0
  16. package/dist/modules/collection.d.ts +25 -0
  17. package/dist/modules/collection.d.ts.map +1 -0
  18. package/dist/{plugins/LevoMedia.d.ts → modules/media.d.ts} +6 -4
  19. package/dist/modules/media.d.ts.map +1 -0
  20. package/dist/modules/membership.d.ts +21 -0
  21. package/dist/modules/membership.d.ts.map +1 -0
  22. package/package.json +3 -1
  23. package/dist/LevoClient.d.ts +0 -38
  24. package/dist/chunk-QJSKNLTV.js +0 -9
  25. package/dist/chunk-VQMSBMEM.js +0 -40
  26. package/dist/chunk-ZLLCLSGE.js +0 -8
  27. package/dist/plugins/LevoAudience.d.ts +0 -32
  28. package/dist/plugins/LevoAudience.d.ts.map +0 -1
  29. package/dist/plugins/LevoAudience.js +0 -589
  30. package/dist/plugins/LevoBlog.d.ts +0 -8
  31. package/dist/plugins/LevoBlog.d.ts.map +0 -1
  32. package/dist/plugins/LevoBlog.js +0 -21
  33. package/dist/plugins/LevoCollection.d.ts +0 -23
  34. package/dist/plugins/LevoCollection.d.ts.map +0 -1
  35. package/dist/plugins/LevoCollection.js +0 -47
  36. package/dist/plugins/LevoLogger.d.ts +0 -32
  37. package/dist/plugins/LevoLogger.d.ts.map +0 -1
  38. package/dist/plugins/LevoLogger.js +0 -193
  39. package/dist/plugins/LevoMedia.d.ts.map +0 -1
  40. package/dist/plugins/LevoMedia.js +0 -13
  41. package/dist/plugins/LevoMembership.d.ts +0 -38
  42. package/dist/plugins/LevoMembership.d.ts.map +0 -1
  43. package/dist/plugins/LevoMembership.js +0 -104
  44. package/dist/plugins/LevoPlugin.d.ts +0 -6
  45. package/dist/plugins/LevoPlugin.d.ts.map +0 -1
  46. package/dist/plugins/LevoPlugin.js +0 -1
@@ -1,16 +1,9 @@
1
- export interface BatchOptions {
1
+ export interface IBatchOptions {
2
2
  logApiUrl?: string;
3
3
  }
4
4
  export type CallbackFunction = (log: object) => Promise<void>;
5
- export declare class LogBatch {
6
- logApiUrl: string;
7
- logs: Array<object>;
8
- activeFlush: Promise<void>;
9
- nextFlush: NodeJS.Timeout;
10
- lastFlush: Date;
11
- constructor(options?: BatchOptions);
12
- sendLogs: (logs: Array<object>) => Promise<void | import("wretch").WretchResponse>;
5
+ export declare const createLogBatch: (options?: IBatchOptions) => {
13
6
  ingest: (log: object) => void;
14
7
  flush: () => Promise<void>;
15
- }
8
+ };
16
9
  //# sourceMappingURL=batch.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"batch.d.ts","sourceRoot":"","sources":["../../src/logger/batch.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,YAAY;IAC3B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,MAAM,gBAAgB,GAAG,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;AAE9D,qBAAa,QAAQ;IACnB,SAAS,SAAgC;IAEzC,IAAI,EAAE,KAAK,CAAC,MAAM,CAAC,CAAM;IAEzB,WAAW,EAAE,OAAO,CAAC,IAAI,CAAC,CAAqB;IAC/C,SAAS,EAAE,MAAM,CAAC,OAAO,CAA2B;IACpD,SAAS,EAAE,IAAI,CAAc;gBAEjB,OAAO,GAAE,YAAiB;IAMtC,QAAQ,SAAgB,KAAK,CAAC,MAAM,CAAC,qDAqCnC;IAEF,MAAM,QAAS,MAAM,UAoBnB;IAEF,KAAK,QAAa,OAAO,CAAC,IAAI,CAAC,CAoB7B;CACH"}
1
+ {"version":3,"file":"batch.d.ts","sourceRoot":"","sources":["../../src/logger/batch.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,aAAa;IAC5B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,MAAM,gBAAgB,GAAG,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;AAE9D,eAAO,MAAM,cAAc,aAAa,aAAa;kBAiF9B,MAAM;iBAvBH,OAAO,CAAC,IAAI,CAAC;CA8CtC,CAAC"}
@@ -0,0 +1,22 @@
1
+ import { ILevoControl } from "../control";
2
+ import { IBatchOptions } from "./batch";
3
+ export declare const isBrowser: boolean;
4
+ export declare enum LogLevel {
5
+ debug = 0,
6
+ info = 1,
7
+ warn = 2,
8
+ error = 3,
9
+ off = 100
10
+ }
11
+ export interface ILoggerOptions extends IBatchOptions {
12
+ level?: LogLevel;
13
+ enableRemote?: boolean;
14
+ context?: Record<string, any>;
15
+ }
16
+ export declare const createLevoLogger: (core: ILevoControl, options?: ILoggerOptions) => {
17
+ debug: (...args: any[]) => void;
18
+ info: (...args: any[]) => void;
19
+ warn: (...args: any[]) => void;
20
+ error: (...args: any[]) => void;
21
+ };
22
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/logger/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE1C,OAAO,EAAE,aAAa,EAAkB,MAAM,SAAS,CAAC;AAExD,eAAO,MAAM,SAAS,SAAgC,CAAC;AAEvD,oBAAY,QAAQ;IAClB,KAAK,IAAI;IACT,IAAI,IAAI;IACR,IAAI,IAAI;IACR,KAAK,IAAI;IACT,GAAG,MAAM;CACV;AAiBD,MAAM,WAAW,cAAe,SAAQ,aAAa;IACnD,KAAK,CAAC,EAAE,QAAQ,CAAC;IACjB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CAC/B;AAED,eAAO,MAAM,gBAAgB,SACrB,YAAY,YACT,cAAc;qBAgHC,GAAG,EAAE;oBAIN,GAAG,EAAE;oBAIL,GAAG,EAAE;qBAIJ,GAAG,EAAE;CAU9B,CAAC"}
@@ -0,0 +1,10 @@
1
+ import type { BlogClient, IResponseMultiple, IResponseSingle } from "../types";
2
+ import type { LevoQuery } from "../types/levo-query";
3
+ import { ILevoControl } from "../control";
4
+ import { ILevoAudienceModule } from "../control/audience";
5
+ import { IHttpClient } from "../httpClient";
6
+ export declare const createLevoBlogModule: (core: ILevoControl, httpClient: IHttpClient, audience?: ILevoAudienceModule | null) => {
7
+ getAllBlogs: (blog_key: string, data?: LevoQuery.FindQuery, options?: BlogClient.OptionParams) => Promise<IResponseMultiple<import("../types").IPost>>;
8
+ getSingleBlog: (blog_key: string, slug: string, options?: BlogClient.OptionParams) => Promise<IResponseSingle<import("../types").IPost, any>>;
9
+ };
10
+ //# sourceMappingURL=blog.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"blog.d.ts","sourceRoot":"","sources":["../../src/modules/blog.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,YAAY,EAAE,MAAM,YAAY,CAAC;AAC1C,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5C,eAAO,MAAM,oBAAoB,SACzB,YAAY,cACN,WAAW,aACb,mBAAmB,GAAG,IAAI;4BAGxB,MAAM,SACV,SAAS,CAAC,SAAS,YACf,UAAU,CAAC,YAAY;8BAevB,MAAM,QACV,MAAM,YACF,UAAU,CAAC,YAAY;CAkBpC,CAAC"}
@@ -0,0 +1,25 @@
1
+ import type { WretchOptions } from "wretch";
2
+ import type { IDraftEntry, ILemaCollection, IResponseMultiple, IResponseSingle, Prettify } from "../types";
3
+ import type { LevoQuery } from "../types/levo-query";
4
+ import { ILevoControl } from "../control";
5
+ import { ILevoAudienceModule } from "../control/audience";
6
+ import { IHttpClient } from "../httpClient";
7
+ type ColumnKeys = Prettify<keyof ILemaCollection>;
8
+ export declare const createLevoCollectionModule: (core: ILevoControl, httpsClient: IHttpClient, audience?: ILevoAudienceModule | null) => {
9
+ getAllCollections: (data?: LevoQuery.FindQuery<ColumnKeys>, options?: WretchOptions) => Promise<IResponseMultiple<ILemaCollection>>;
10
+ getCollectionByIDExpanded: <T = ILemaCollection>(id: string, options?: WretchOptions) => Promise<IResponseSingle<T, any>>;
11
+ createCollection: (data: ILemaCollection) => Promise<IResponseSingle<ILemaCollection, any>>;
12
+ saveCollectionData: ({ collection_id, data, options, }: {
13
+ collection_id: string;
14
+ data: any;
15
+ options?: WretchOptions;
16
+ }) => Promise<IResponseSingle<any, any>>;
17
+ getCollectionContentList: ({ collection_key, page, search, limit, where, }: {
18
+ collection_key: string;
19
+ } & LevoQuery.FindQuery) => Promise<IResponseMultiple<Record<string, unknown>>>;
20
+ saveDraftEntry: (collection_key: string, data: any) => Promise<IResponseSingle<IDraftEntry, any>>;
21
+ getDraftEntry: (collection_key: string) => Promise<IResponseSingle<IDraftEntry, any>>;
22
+ submitDraftEntry: (collection_key: string, data: any) => Promise<IResponseSingle<IDraftEntry, any>>;
23
+ };
24
+ export {};
25
+ //# sourceMappingURL=collection.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"collection.d.ts","sourceRoot":"","sources":["../../src/modules/collection.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AAE5C,OAAO,KAAK,EACV,WAAW,EACX,eAAe,EACf,iBAAiB,EACjB,eAAe,EACf,QAAQ,EACT,MAAM,UAAU,CAAC;AAClB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC1C,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5C,KAAK,UAAU,GAAG,QAAQ,CAAC,MAAM,eAAe,CAAC,CAAC;AAElD,eAAO,MAAM,0BAA0B,SAC/B,YAAY,eACL,WAAW,aACd,mBAAmB,GAAG,IAAI;+BAG5B,SAAS,CAAC,SAAS,CAAC,UAAU,CAAC,YAC5B,aAAa;gCASiB,CAAC,wBACpC,MAAM,YACD,aAAa;6BASc,eAAe;4DAWlD;QACD,aAAa,EAAE,MAAM,CAAC;QACtB,IAAI,EAAE,GAAG,CAAC;QACV,OAAO,CAAC,EAAE,aAAa,CAAC;KACzB;gFAcE;QACD,cAAc,EAAE,MAAM,CAAC;KACxB,GAAG,SAAS,CAAC,SAAS;qCAauB,MAAM,QAAQ,GAAG;oCAOlB,MAAM;uCAOH,MAAM,QAAQ,GAAG;CAiBlE,CAAC"}
@@ -1,9 +1,11 @@
1
1
  import type { WretchOptions } from "wretch";
2
2
  import type { IMedia, IResponseMultiple } from "../types";
3
3
  import type { LevoQuery } from "../types/levo-query";
4
- import { LevoPlugin } from "./LevoPlugin";
5
- export declare class LevoMedia extends LevoPlugin {
4
+ import { ILevoControl } from "../control";
5
+ import { ILevoAudienceModule } from "../control/audience";
6
+ import { IHttpClient } from "../httpClient";
7
+ export declare const createLevoMediaModule: (core: ILevoControl, httpsClient: IHttpClient, audience?: ILevoAudienceModule | null) => {
6
8
  mediaBulkUpload: (formData: FormData, options?: WretchOptions) => Promise<IResponseMultiple<IMedia>>;
7
9
  getAllMedia: (data?: LevoQuery.FindQuery) => Promise<IResponseMultiple<IMedia>>;
8
- }
9
- //# sourceMappingURL=LevoMedia.d.ts.map
10
+ };
11
+ //# sourceMappingURL=media.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"media.d.ts","sourceRoot":"","sources":["../../src/modules/media.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AAE5C,OAAO,KAAK,EAAE,MAAM,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAC1D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC1C,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5C,eAAO,MAAM,qBAAqB,SAC1B,YAAY,eACL,WAAW,aACd,mBAAmB,GAAG,IAAI;gCAED,QAAQ,YAAW,aAAa;yBAQlC,SAAS,CAAC,SAAS;CAWrD,CAAC"}
@@ -0,0 +1,21 @@
1
+ import type { WretchOptions } from "wretch";
2
+ import type { ILevoMembership } from "../types/membership";
3
+ import { ILevoControl } from "../control";
4
+ import { ILevoAudienceModule } from "../control/audience";
5
+ import { IHttpClient } from "../httpClient";
6
+ export declare const createLevoMembershipModule: (core: ILevoControl, httpsClient: IHttpClient, audience?: ILevoAudienceModule | null) => {
7
+ getOAuthURL: (options?: WretchOptions) => Promise<ILevoMembership.OAuthURLList>;
8
+ signOut: <T = {
9
+ status: boolean;
10
+ }>(options?: WretchOptions) => Promise<T>;
11
+ getMe: <T = ILevoMembership.Account>(options?: WretchOptions) => Promise<T>;
12
+ updateMe: <T = ILevoMembership.Account, D = Partial<Pick<ILevoMembership.Account, "first_name" | "last_name" | "username" | "profile_picture">>>(data: D, options?: WretchOptions) => Promise<T>;
13
+ createPassword: <T = ILevoMembership.Account>(data: ILevoMembership.Request.CreatePassword, options?: WretchOptions) => Promise<T>;
14
+ isLoggedIn: <T = ILevoMembership.Account>(options?: WretchOptions) => Promise<T | null>;
15
+ requestMagicLink: (data: ILevoMembership.Request.RequestMagicLink, options?: WretchOptions) => Promise<Pick<ILevoMembership.Otp, "_id" | "content">>;
16
+ requestOtp: (data: ILevoMembership.Request.RequestOtp, options?: WretchOptions) => Promise<Pick<ILevoMembership.Otp, "_id" | "content">>;
17
+ signInWithOtp: <T = ILevoMembership.Account>(data: ILevoMembership.Request.SignInWithOtp, options?: WretchOptions) => Promise<T | null>;
18
+ signInWithPassword: <T = ILevoMembership.Account>(data: ILevoMembership.Request.SignInWithPassword, options?: WretchOptions) => Promise<T | null>;
19
+ signUpWithPassword: <T = ILevoMembership.Account>(data: ILevoMembership.Request.SignUpWithPassword, options?: WretchOptions) => Promise<T | null>;
20
+ };
21
+ //# sourceMappingURL=membership.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"membership.d.ts","sourceRoot":"","sources":["../../src/modules/membership.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AAM5C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAE3D,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC1C,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5C,eAAO,MAAM,0BAA0B,SAC/B,YAAY,eACL,WAAW,aACd,mBAAmB,GAAG,IAAI;4BAczB,aAAa,KACrB,OAAO,CAAC,eAAe,CAAC,YAAY,CAAC;cAyDjB,CAAC;gBAAa,OAAO;iBACjC,aAAa,KACrB,OAAO,CAAC,CAAC,CAAC;YAYQ,CAAC,sCACX,aAAa,KACrB,OAAO,CAAC,CAAC,CAAC;eAWX,CAAC,4BACD,CAAC,8GAEK,CAAC,YACE,aAAa,KACrB,OAAO,CAAC,CAAC,CAAC;qBAUiB,CAAC,kCACvB,eAAe,CAAC,OAAO,CAAC,cAAc,YACnC,aAAa,KACrB,OAAO,CAAC,CAAC,CAAC;iBAUa,CAAC,sCAChB,aAAa,KACrB,OAAO,CAAC,CAAC,GAAG,IAAI,CAAC;6BAUZ,eAAe,CAAC,OAAO,CAAC,gBAAgB,YACrC,aAAa,KACrB,OAAO,CAAC,IAAI,CAAC,eAAe,CAAC,GAAG,EAAE,KAAK,GAAG,SAAS,CAAC,CAAC;uBAkBhD,eAAe,CAAC,OAAO,CAAC,UAAU,YAC/B,aAAa,KACrB,OAAO,CAAC,IAAI,CAAC,eAAe,CAAC,GAAG,EAAE,KAAK,GAAG,SAAS,CAAC,CAAC;oBAU3B,CAAC,kCACtB,eAAe,CAAC,OAAO,CAAC,aAAa,YAClC,aAAa,KACrB,OAAO,CAAC,CAAC,GAAG,IAAI,CAAC;yBAUc,CAAC,kCAC3B,eAAe,CAAC,OAAO,CAAC,kBAAkB,YACvC,aAAa,KACrB,OAAO,CAAC,CAAC,GAAG,IAAI,CAAC;yBAUc,CAAC,kCAC3B,eAAe,CAAC,OAAO,CAAC,kBAAkB,YACvC,aAAa,KACrB,OAAO,CAAC,CAAC,GAAG,IAAI,CAAC;CAuBrB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@levo-so/core",
3
- "version": "0.1.34",
3
+ "version": "0.1.36",
4
4
  "author": "Levo Engineering <devs@theinternetfolks.com>",
5
5
  "description": "Levo common utilities",
6
6
  "type": "module",
@@ -18,9 +18,11 @@
18
18
  "@analytics/visitor-source": "0.0.7",
19
19
  "analytics": "0.8.14",
20
20
  "get-user-locale": "2.3.2",
21
+ "lodash-es": "4.17.21",
21
22
  "wretch": "2.9.0"
22
23
  },
23
24
  "devDependencies": {
25
+ "@types/lodash-es": "4.17.12",
24
26
  "tsup": "8.2.4",
25
27
  "typescript": "5.5.4",
26
28
  "@levo/eslint-config": "0.0.0",
@@ -1,38 +0,0 @@
1
- export type WorkspaceID = `W${string}`;
2
- export declare const workspaceIdRegex: RegExp;
3
- export interface IPageContext {
4
- url: string;
5
- id?: string;
6
- referrer?: string;
7
- title?: string;
8
- }
9
- export interface ILevoConfig {
10
- appName?: string;
11
- workspace: WorkspaceID | null;
12
- apiUrl: string;
13
- insightsUrl: string;
14
- NODE_ENV: string;
15
- APP_MODE?: "production" | "staging";
16
- pageContext?: IPageContext | null;
17
- }
18
- /**
19
- * @description LevoClient is class that provides a way to initialize the Levo SDK.
20
- * It is used to set the workspace and environment variables for the SDK.
21
- * It is intended to be used outside of framework boundary like Next.js, React, etc.
22
- */
23
- declare class LevoClient implements ILevoConfig {
24
- #private;
25
- appName?: string | undefined;
26
- constructor(props: Partial<ILevoConfig>);
27
- get workspace(): `W${string}` | null;
28
- get apiUrl(): string;
29
- get insightsUrl(): string;
30
- get NODE_ENV(): string;
31
- get APP_MODE(): "production" | "staging" | undefined;
32
- updateWorkspace(workspace: WorkspaceID): void;
33
- getPageContext(): IPageContext | null | undefined;
34
- updatePageContext(pageContext: IPageContext | null): void;
35
- get fetch(): import("wretch/addons/queryString").QueryStringAddon & import("wretch").Wretch<import("wretch/addons/queryString").QueryStringAddon, unknown, undefined>;
36
- }
37
- export { LevoClient, LevoClient as default };
38
- //# sourceMappingURL=LevoClient.d.ts.map
@@ -1,9 +0,0 @@
1
- // src/plugins/LevoPlugin.ts
2
- var LevoPlugin = class {
3
- client;
4
- constructor(client) {
5
- this.client = client;
6
- }
7
- };
8
-
9
- export { LevoPlugin };
@@ -1,40 +0,0 @@
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
- status;
9
- constructor(data) {
10
- super(data?.message || data?.description);
11
- this.name = "Levo Request Error";
12
- this.status = data?.status;
13
- this.code = data?.code;
14
- this.message = data?.message || data?.description;
15
- this.title = data?.title;
16
- }
17
- };
18
- var getLevoError = (error) => {
19
- if (error instanceof WretchError) {
20
- const errorResponse = error?.json;
21
- if (typeof errorResponse === "object" && errorResponse?.content) {
22
- const errorMessage = errorResponse?.content;
23
- return new LevoError(errorMessage);
24
- }
25
- }
26
- let displayMessage = error?.message || "Something unexpected happened.";
27
- switch (error?.message) {
28
- case "Network Error":
29
- displayMessage = "Couldn't connect to our servers.";
30
- break;
31
- }
32
- return new LevoError({
33
- status: "500",
34
- title: "Network Error",
35
- description: displayMessage,
36
- code: "UNKNOWN_ERROR"
37
- });
38
- };
39
-
40
- export { LevoError, getLevoError };
@@ -1,8 +0,0 @@
1
- // src/constants/oauthProvider.ts
2
- var LevoOAuthProviderList = [
3
- "google",
4
- "linkedin",
5
- "microsoft"
6
- ];
7
-
8
- export { LevoOAuthProviderList };
@@ -1,32 +0,0 @@
1
- import { type AnalyticsInstance } from "analytics";
2
- import type { ILevoAudience } from "../types/audience";
3
- import { LevoPlugin } from "./LevoPlugin";
4
- export declare class LevoAudience extends LevoPlugin {
5
- #private;
6
- instance: AnalyticsInstance | null;
7
- idle_listener: any;
8
- request<ResponseBody = unknown, RequestBody = unknown>(url: string, data: RequestBody): Promise<Awaited<ResponseBody>>;
9
- initiate(properties: ILevoAudience.Properties): Promise<any>;
10
- identify(): Promise<void>;
11
- getReferrer(): {
12
- type?: undefined;
13
- referrer?: undefined;
14
- data?: undefined;
15
- raw?: undefined;
16
- } | {
17
- type: string;
18
- referrer: Record<string, string>;
19
- data: Record<string, string>;
20
- raw: string;
21
- };
22
- startActivityListener(): null;
23
- getActivityStatus(): {
24
- status: "idle" | "active";
25
- seconds: number;
26
- } | null;
27
- bounce(properties: ILevoAudience.Properties): Promise<void>;
28
- track(event: string, properties: ILevoAudience.Properties): Promise<any>;
29
- getCurrentTabId(): string;
30
- getTabCount(): number;
31
- }
32
- //# sourceMappingURL=LevoAudience.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"LevoAudience.d.ts","sourceRoot":"","sources":["../../src/plugins/LevoAudience.ts"],"names":[],"mappings":"AAEA,OAAO,EAAa,KAAK,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAG9D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAMvD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,qBAAa,YAAa,SAAQ,UAAU;;IAC1C,QAAQ,EAAE,iBAAiB,GAAG,IAAI,CAAQ;IAC1C,aAAa,EAAE,GAAG,CAAQ;IAoB1B,OAAO,CAAC,YAAY,GAAG,OAAO,EAAE,WAAW,GAAG,OAAO,EACnD,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,WAAW;IA8Bb,QAAQ,CAAC,UAAU,EAAE,aAAa,CAAC,UAAU;IA8J7C,QAAQ;IAed,WAAW;;;;;;;;;;;IAmEX,qBAAqB;IAqBrB,iBAAiB,IAAI;QACnB,MAAM,EAAE,MAAM,GAAG,QAAQ,CAAC;QAC1B,OAAO,EAAE,MAAM,CAAC;KACjB,GAAG,IAAI;IAcF,MAAM,CAAC,UAAU,EAAE,aAAa,CAAC,UAAU;IAc3C,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,aAAa,CAAC,UAAU;IAoC/D,eAAe;IAaf,WAAW;CAYZ"}