@levo-so/core 0.1.35 → 0.1.37

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 (51) hide show
  1. package/dist/client.d.ts +81 -0
  2. package/dist/constants/media.d.ts +1 -1
  3. package/dist/control/audience.d.ts +22 -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 +1 -2
  9. package/dist/index.js +1196 -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/dist/types/audience.d.ts +35 -2
  23. package/dist/types/audience.d.ts.map +1 -1
  24. package/dist/utils/listToX.d.ts +3 -0
  25. package/dist/utils/listToX.d.ts.map +1 -0
  26. package/dist/utils/lock.d.ts.map +1 -1
  27. package/package.json +5 -3
  28. package/dist/LevoClient.d.ts +0 -38
  29. package/dist/chunk-OT564SO4.js +0 -69
  30. package/dist/chunk-QJSKNLTV.js +0 -9
  31. package/dist/chunk-ZLLCLSGE.js +0 -8
  32. package/dist/plugins/LevoAudience.d.ts +0 -32
  33. package/dist/plugins/LevoAudience.d.ts.map +0 -1
  34. package/dist/plugins/LevoAudience.js +0 -561
  35. package/dist/plugins/LevoBlog.d.ts +0 -8
  36. package/dist/plugins/LevoBlog.d.ts.map +0 -1
  37. package/dist/plugins/LevoBlog.js +0 -21
  38. package/dist/plugins/LevoCollection.d.ts +0 -23
  39. package/dist/plugins/LevoCollection.d.ts.map +0 -1
  40. package/dist/plugins/LevoCollection.js +0 -47
  41. package/dist/plugins/LevoLogger.d.ts +0 -32
  42. package/dist/plugins/LevoLogger.d.ts.map +0 -1
  43. package/dist/plugins/LevoLogger.js +0 -193
  44. package/dist/plugins/LevoMedia.d.ts.map +0 -1
  45. package/dist/plugins/LevoMedia.js +0 -13
  46. package/dist/plugins/LevoMembership.d.ts +0 -38
  47. package/dist/plugins/LevoMembership.d.ts.map +0 -1
  48. package/dist/plugins/LevoMembership.js +0 -104
  49. package/dist/plugins/LevoPlugin.d.ts +0 -6
  50. package/dist/plugins/LevoPlugin.d.ts.map +0 -1
  51. package/dist/plugins/LevoPlugin.js +0 -1
@@ -0,0 +1,81 @@
1
+ import { ICoreOptions } from "./control";
2
+ import { IPageContext } from "./httpClient";
3
+ import { ILoggerOptions } from "./logger";
4
+ export interface ILevoClientOptions extends ICoreOptions {
5
+ pageContext?: IPageContext | null;
6
+ loggerOptions?: ILoggerOptions;
7
+ }
8
+ export declare const createLevoClient: (options: ILevoClientOptions) => {
9
+ readonly apiUrl: string;
10
+ readonly insightsUrl: string;
11
+ readonly workspace: `W${string}` | null;
12
+ readonly audience: {
13
+ readonly instance: import("analytics").AnalyticsInstance | null;
14
+ readonly is_identified: boolean;
15
+ storage_keys: {
16
+ identify: string;
17
+ open_tabs: string;
18
+ current_tab: string;
19
+ all_tabs: string;
20
+ };
21
+ initiate: (properties: import("./types").ILevoAudience.Properties) => Promise<any>;
22
+ identify: (options?: {
23
+ withLock?: boolean;
24
+ }) => Promise<void>;
25
+ track: <T extends import("./types").ILevoAudience.Properties>(event: import("./types").AnalyticsEventType, properties: T & import("./types").ILevoAudience.Properties) => Promise<any>;
26
+ bounce: (properties: import("./types").ILevoAudience.Properties) => Promise<void>;
27
+ };
28
+ readonly blog: {
29
+ getAllBlogs: (blog_key: string, data?: import("./types").LevoQuery.FindQuery, options?: import("./types").BlogClient.OptionParams) => Promise<import("./types").IResponseMultiple<import("./types").IPost>>;
30
+ getSingleBlog: (blog_key: string, slug: string, options?: import("./types").BlogClient.OptionParams) => Promise<import("./types").IResponseSingle<import("./types").IPost, any>>;
31
+ };
32
+ readonly membership: {
33
+ getOAuthURL: (options?: import("wretch").WretchOptions) => Promise<import("./types").ILevoMembership.OAuthURLList>;
34
+ signOut: <T = {
35
+ status: boolean;
36
+ }>(options?: import("wretch").WretchOptions) => Promise<T>;
37
+ getMe: <T = import("./types").ILevoMembership.Account>(options?: import("wretch").WretchOptions) => Promise<T>;
38
+ updateMe: <T = import("./types").ILevoMembership.Account, D = Partial<Pick<import("./types").ILevoMembership.Account, "first_name" | "last_name" | "username" | "profile_picture">>>(data: D, options?: import("wretch").WretchOptions) => Promise<T>;
39
+ createPassword: <T = import("./types").ILevoMembership.Account>(data: import("./types").ILevoMembership.Request.CreatePassword, options?: import("wretch").WretchOptions) => Promise<T>;
40
+ isLoggedIn: <T = import("./types").ILevoMembership.Account>(options?: import("wretch").WretchOptions) => Promise<T | null>;
41
+ requestMagicLink: (data: import("./types").ILevoMembership.Request.RequestMagicLink, options?: import("wretch").WretchOptions) => Promise<Pick<import("./types").ILevoMembership.Otp, "_id" | "content">>;
42
+ requestOtp: (data: import("./types").ILevoMembership.Request.RequestOtp, options?: import("wretch").WretchOptions) => Promise<Pick<import("./types").ILevoMembership.Otp, "_id" | "content">>;
43
+ signInWithOtp: <T = import("./types").ILevoMembership.Account>(data: import("./types").ILevoMembership.Request.SignInWithOtp, options?: import("wretch").WretchOptions) => Promise<T | null>;
44
+ signInWithPassword: <T = import("./types").ILevoMembership.Account>(data: import("./types").ILevoMembership.Request.SignInWithPassword, options?: import("wretch").WretchOptions) => Promise<T | null>;
45
+ signUpWithPassword: <T = import("./types").ILevoMembership.Account>(data: import("./types").ILevoMembership.Request.SignUpWithPassword, options?: import("wretch").WretchOptions) => Promise<T | null>;
46
+ };
47
+ readonly collection: {
48
+ getAllCollections: (data?: import("./types").LevoQuery.FindQuery<"id" | "workspace_id" | "description" | "created_at" | "updated_at" | "key" | "readonly" | "hidden" | "icon" | "name" | "sections" | "views" | "title_field" | "settings" | "module_name" | "on_submit" | "on_update" | "allow_draft">, options?: import("wretch").WretchOptions) => Promise<import("./types").IResponseMultiple<import("./types").ILemaCollection>>;
49
+ getCollectionByIDExpanded: <T = import("./types").ILemaCollection>(id: string, options?: import("wretch").WretchOptions) => Promise<import("./types").IResponseSingle<T, any>>;
50
+ createCollection: (data: import("./types").ILemaCollection) => Promise<import("./types").IResponseSingle<import("./types").ILemaCollection, any>>;
51
+ saveCollectionData: ({ collection_id, data, options, }: {
52
+ collection_id: string;
53
+ data: any;
54
+ options?: import("wretch").WretchOptions;
55
+ }) => Promise<import("./types").IResponseSingle<any, any>>;
56
+ getCollectionContentList: ({ collection_key, page, search, limit, where, }: {
57
+ collection_key: string;
58
+ } & import("./types").LevoQuery.FindQuery) => Promise<import("./types").IResponseMultiple<Record<string, unknown>>>;
59
+ saveDraftEntry: (collection_key: string, data: any) => Promise<import("./types").IResponseSingle<import("./types").IDraftEntry, any>>;
60
+ getDraftEntry: (collection_key: string) => Promise<import("./types").IResponseSingle<import("./types").IDraftEntry, any>>;
61
+ submitDraftEntry: (collection_key: string, data: any) => Promise<import("./types").IResponseSingle<import("./types").IDraftEntry, any>>;
62
+ };
63
+ readonly media: {
64
+ mediaBulkUpload: (formData: FormData, options?: import("wretch").WretchOptions) => Promise<import("./types").IResponseMultiple<import("./types").IMedia>>;
65
+ getAllMedia: (data?: import("./types").LevoQuery.FindQuery) => Promise<import("./types").IResponseMultiple<import("./types").IMedia>>;
66
+ };
67
+ readonly logger: {
68
+ debug: (...args: any[]) => void;
69
+ info: (...args: any[]) => void;
70
+ warn: (...args: any[]) => void;
71
+ error: (...args: any[]) => void;
72
+ };
73
+ readonly fetch: import("wretch/addons/queryString").QueryStringAddon & import("wretch").Wretch<import("wretch/addons/queryString").QueryStringAddon, unknown, undefined>;
74
+ readonly APP_MODE: string;
75
+ readonly pageContext: IPageContext | null;
76
+ updatePageContext: (newContext: IPageContext | null) => void;
77
+ updateWorkspace: (workspace: string | null) => void;
78
+ };
79
+ export type ILevoClient = ReturnType<typeof createLevoClient>;
80
+ export { type WorkspaceID } from "./control";
81
+ //# sourceMappingURL=client.d.ts.map
@@ -1,3 +1,3 @@
1
1
  export declare const MediaKindList: readonly ["image", "video", "audio", "document"];
2
- export declare const MediaKind: Record<"image" | "video" | "audio" | "document", "image" | "video" | "audio" | "document">;
2
+ export declare const MediaKind: Record<"audio" | "video" | "image" | "document", "audio" | "video" | "image" | "document">;
3
3
  //# sourceMappingURL=media.d.ts.map
@@ -0,0 +1,22 @@
1
+ import { type AnalyticsInstance } from "analytics";
2
+ import type { AnalyticsEventType, ILevoAudience } from "../types/audience";
3
+ import { IHttpClient } from "../httpClient";
4
+ import { ILevoControl } from ".";
5
+ export declare const createLevoAudienceModule: (core: ILevoControl, httpClient: IHttpClient) => {
6
+ readonly instance: AnalyticsInstance | null;
7
+ readonly is_identified: boolean;
8
+ storage_keys: {
9
+ identify: string;
10
+ open_tabs: string;
11
+ current_tab: string;
12
+ all_tabs: string;
13
+ };
14
+ initiate: (properties: ILevoAudience.Properties) => Promise<any>;
15
+ identify: (options?: {
16
+ withLock?: boolean;
17
+ }) => Promise<void>;
18
+ track: <T extends ILevoAudience.Properties>(event: AnalyticsEventType, properties: T & ILevoAudience.Properties) => Promise<any>;
19
+ bounce: (properties: ILevoAudience.Properties) => Promise<void>;
20
+ };
21
+ export type ILevoAudienceModule = ReturnType<typeof createLevoAudienceModule>;
22
+ //# sourceMappingURL=audience.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"audience.d.ts","sourceRoot":"","sources":["../../src/control/audience.ts"],"names":[],"mappings":"AAEA,OAAO,EAAa,KAAK,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAM9D,OAAO,KAAK,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAC3E,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5C,OAAO,EAAE,YAAY,EAAE,MAAM,GAAG,CAAC;AAEjC,eAAO,MAAM,wBAAwB,SAC7B,YAAY,cACN,WAAW;;;;;;;;;2BAgLa,aAAa,CAAC,UAAU;yBAtC1B;QAAE,QAAQ,CAAC,EAAE,OAAO,CAAA;KAAE;YA0OnC,CAAC,SAAS,aAAa,CAAC,UAAU,SAC9C,kBAAkB,cACb,CAAC,GAAG,aAAa,CAAC,UAAU;yBAhBR,aAAa,CAAC,UAAU;CAkE3D,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG,UAAU,CAAC,OAAO,wBAAwB,CAAC,CAAC"}
@@ -0,0 +1,23 @@
1
+ export interface ICoreOptions {
2
+ appName?: string;
3
+ workspace: WorkspaceID | null;
4
+ apiUrl: string;
5
+ insightsUrl?: string;
6
+ NODE_ENV: string;
7
+ APP_MODE: string;
8
+ }
9
+ export type WorkspaceID = `W${string}`;
10
+ export declare const workspaceIdRegex: RegExp;
11
+ /**
12
+ * @description base factory that includes levo workspace details, analytics tools & fetch client
13
+ */
14
+ export declare const createLevoControl: (options: ICoreOptions) => {
15
+ workspace: `W${string}` | null;
16
+ readonly appName: string | undefined;
17
+ readonly apiUrl: string;
18
+ readonly insightsUrl: string;
19
+ readonly NODE_ENV: string;
20
+ readonly APP_MODE: string;
21
+ };
22
+ export type ILevoControl = ReturnType<typeof createLevoControl>;
23
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/control/index.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,YAAY;IAC3B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,WAAW,GAAG,IAAI,CAAC;IAC9B,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,MAAM,WAAW,GAAG,IAAI,MAAM,EAAE,CAAC;AAEvC,eAAO,MAAM,gBAAgB,QAAmB,CAAC;AAEjD;;GAEG;AACH,eAAO,MAAM,iBAAiB,YAAa,YAAY;;;;;;;CAmDtD,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG,UAAU,CAAC,OAAO,iBAAiB,CAAC,CAAC"}
@@ -0,0 +1,13 @@
1
+ import { ILevoControl } from "./control";
2
+ export interface IPageContext {
3
+ url: string;
4
+ id?: string;
5
+ referrer?: string;
6
+ title?: string;
7
+ }
8
+ export declare const createHttpClient: (core: ILevoControl, pageContext?: IPageContext | null) => {
9
+ readonly instance: import("wretch/addons/queryString").QueryStringAddon & import("wretch").Wretch<import("wretch/addons/queryString").QueryStringAddon, unknown, undefined>;
10
+ pageContext: IPageContext | null | undefined;
11
+ };
12
+ export type IHttpClient = ReturnType<typeof createHttpClient>;
13
+ //# sourceMappingURL=httpClient.d.ts.map
package/dist/index.d.ts CHANGED
@@ -1,5 +1,4 @@
1
- export * from "./LevoClient";
2
- export * from "./plugins/LevoPlugin";
1
+ export * from "./client";
3
2
  export * from "./types";
4
3
  export * from "./constants";
5
4
  export * from "./utils/formatImagePath";