@levo-so/core 0.1.71 → 0.1.76
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/index.d.ts +10 -0
- package/dist/index.js +43 -43
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -348,6 +348,7 @@ export declare interface IBlog {
|
|
|
348
348
|
updated_at: string;
|
|
349
349
|
created_by: string;
|
|
350
350
|
updated_by: string;
|
|
351
|
+
studio_config: IModuleStudioConfig[];
|
|
351
352
|
}
|
|
352
353
|
|
|
353
354
|
export declare interface IBlogCategory {
|
|
@@ -1340,6 +1341,14 @@ export declare type IModuleAccessControl = {
|
|
|
1340
1341
|
settings_config: IDefaultPermissionsObject;
|
|
1341
1342
|
};
|
|
1342
1343
|
|
|
1344
|
+
export declare interface IModuleStudioConfig {
|
|
1345
|
+
page_id: string;
|
|
1346
|
+
preview_url: string;
|
|
1347
|
+
block_instance_id: null | string;
|
|
1348
|
+
live_url: string;
|
|
1349
|
+
site_id: string;
|
|
1350
|
+
}
|
|
1351
|
+
|
|
1343
1352
|
export declare interface INotificationData {
|
|
1344
1353
|
id?: string;
|
|
1345
1354
|
kind: string;
|
|
@@ -1895,6 +1904,7 @@ export declare namespace LevoEvent {
|
|
|
1895
1904
|
created_at: string;
|
|
1896
1905
|
updated_at: string;
|
|
1897
1906
|
events: any[];
|
|
1907
|
+
studio_config: IModuleStudioConfig[];
|
|
1898
1908
|
}
|
|
1899
1909
|
export interface Create {
|
|
1900
1910
|
name: string;
|
package/dist/index.js
CHANGED
|
@@ -3,8 +3,8 @@ const T = /^W[A-Z0-9]{7}$/, U = (e) => {
|
|
|
3
3
|
const {
|
|
4
4
|
appName: t,
|
|
5
5
|
workspace: s = null,
|
|
6
|
-
apiUrl:
|
|
7
|
-
NODE_ENV:
|
|
6
|
+
apiUrl: d = "https://public-api.levo.so",
|
|
7
|
+
NODE_ENV: u = "",
|
|
8
8
|
APP_MODE: i = "production"
|
|
9
9
|
} = e;
|
|
10
10
|
if (s && !T.test(s))
|
|
@@ -27,10 +27,10 @@ const T = /^W[A-Z0-9]{7}$/, U = (e) => {
|
|
|
27
27
|
return t;
|
|
28
28
|
},
|
|
29
29
|
get apiUrl() {
|
|
30
|
-
return
|
|
30
|
+
return d;
|
|
31
31
|
},
|
|
32
32
|
get NODE_ENV() {
|
|
33
|
-
return
|
|
33
|
+
return u;
|
|
34
34
|
},
|
|
35
35
|
get APP_MODE() {
|
|
36
36
|
return i;
|
|
@@ -40,15 +40,15 @@ const T = /^W[A-Z0-9]{7}$/, U = (e) => {
|
|
|
40
40
|
function O(e) {
|
|
41
41
|
return typeof e < "u" ? e : "";
|
|
42
42
|
}
|
|
43
|
-
const M = (e, t, s,
|
|
43
|
+
const M = (e, t, s, d, u) => {
|
|
44
44
|
let i;
|
|
45
45
|
if (typeof t == "string")
|
|
46
46
|
i = t;
|
|
47
47
|
else {
|
|
48
|
-
const g =
|
|
48
|
+
const g = u.polyfill("URLSearchParams", !0, !0);
|
|
49
49
|
for (const f in t) {
|
|
50
50
|
const w = t[f];
|
|
51
|
-
if (!(
|
|
51
|
+
if (!(d && w == null))
|
|
52
52
|
if (t[f] instanceof Array)
|
|
53
53
|
for (const E of w)
|
|
54
54
|
g.append(f, O(E));
|
|
@@ -69,29 +69,29 @@ const M = (e, t, s, u, d) => {
|
|
|
69
69
|
const s = _(e.apiUrl).addon(j);
|
|
70
70
|
return {
|
|
71
71
|
get instance() {
|
|
72
|
-
const
|
|
72
|
+
const d = {
|
|
73
73
|
credentials: "include",
|
|
74
74
|
signal: AbortSignal.timeout(3e4),
|
|
75
75
|
// 30 seconds timeout,
|
|
76
76
|
headers: {}
|
|
77
77
|
};
|
|
78
|
-
return e.workspace && (
|
|
79
|
-
...
|
|
78
|
+
return e.workspace && (d.headers = {
|
|
79
|
+
...d?.headers || {},
|
|
80
80
|
"Levo-Workspace": e.workspace
|
|
81
|
-
}), t && typeof t == "object" && Object.keys(t).length > 0 && (
|
|
82
|
-
...
|
|
81
|
+
}), t && typeof t == "object" && Object.keys(t).length > 0 && (d.headers = {
|
|
82
|
+
...d?.headers || {},
|
|
83
83
|
"Levo-Page-Context": encodeURIComponent(JSON.stringify(t))
|
|
84
|
-
}), s.options(
|
|
84
|
+
}), e.workspace ? s.options(d).query({ workspace: e.workspace }) : s.options(d);
|
|
85
85
|
},
|
|
86
86
|
pageContext: t
|
|
87
87
|
};
|
|
88
88
|
}, L = (e = {}) => {
|
|
89
|
-
const { logApiUrl: t = "https://public-api.levo.so" } = e, s = t,
|
|
90
|
-
let
|
|
89
|
+
const { logApiUrl: t = "https://public-api.levo.so" } = e, s = t, d = /* @__PURE__ */ new Map();
|
|
90
|
+
let u = Promise.resolve(), i = setTimeout(() => {
|
|
91
91
|
}, 0), a = /* @__PURE__ */ new Date();
|
|
92
92
|
const g = (h) => {
|
|
93
93
|
const c = JSON.stringify(h?.content ?? "{}"), o = h?.message ?? "";
|
|
94
|
-
|
|
94
|
+
d.set(`${o}${c}`, h);
|
|
95
95
|
}, f = async (h) => {
|
|
96
96
|
const c = `${s}/v1/apm/logs/json`, o = () => _().url(c).post(h).res().catch((n) => console.error(n));
|
|
97
97
|
try {
|
|
@@ -110,8 +110,8 @@ const M = (e, t, s, u, d) => {
|
|
|
110
110
|
console.warn(`Failed to send logs to server: ${n}`), h.forEach((r) => g(r));
|
|
111
111
|
}
|
|
112
112
|
}, w = async () => {
|
|
113
|
-
const h = Array.from(
|
|
114
|
-
if (
|
|
113
|
+
const h = Array.from(d.values());
|
|
114
|
+
if (d.clear(), clearTimeout(i), await u, h.length === 0) {
|
|
115
115
|
a = /* @__PURE__ */ new Date();
|
|
116
116
|
return;
|
|
117
117
|
}
|
|
@@ -126,8 +126,8 @@ const M = (e, t, s, u, d) => {
|
|
|
126
126
|
return {
|
|
127
127
|
ingest: (h) => {
|
|
128
128
|
if (!t) return;
|
|
129
|
-
(Array.isArray(h) ? h : [h]).forEach((o) => g(o)),
|
|
130
|
-
|
|
129
|
+
(Array.isArray(h) ? h : [h]).forEach((o) => g(o)), d.size >= 50 || a.getTime() < Date.now() - 1500 ? (clearTimeout(i), u = w()) : (clearTimeout(i), i = setTimeout(() => {
|
|
130
|
+
u = w();
|
|
131
131
|
}, 1500));
|
|
132
132
|
},
|
|
133
133
|
flush: w
|
|
@@ -148,8 +148,8 @@ const M = (e, t, s, u, d) => {
|
|
|
148
148
|
}, N = (e, t = {}) => {
|
|
149
149
|
const {
|
|
150
150
|
enableRemote: s = e.NODE_ENV !== "development",
|
|
151
|
-
level:
|
|
152
|
-
context:
|
|
151
|
+
level: d = e.NODE_ENV !== "development" ? 2 : 0,
|
|
152
|
+
context: u = {},
|
|
153
153
|
logApiUrl: i
|
|
154
154
|
} = t, a = L({ logApiUrl: i }), g = (o) => {
|
|
155
155
|
let n = "";
|
|
@@ -168,7 +168,7 @@ const M = (e, t, s, u, d) => {
|
|
|
168
168
|
};
|
|
169
169
|
}, f = (o, n) => {
|
|
170
170
|
const r = Array.isArray(n) ? n : [n];
|
|
171
|
-
if (o <
|
|
171
|
+
if (o < d)
|
|
172
172
|
return;
|
|
173
173
|
if (s && o === 3) {
|
|
174
174
|
const { content: y = {}, message: b } = g(r);
|
|
@@ -179,7 +179,7 @@ const M = (e, t, s, u, d) => {
|
|
|
179
179
|
workspace: e.workspace,
|
|
180
180
|
appName: e?.appName,
|
|
181
181
|
isBrowser: R,
|
|
182
|
-
...
|
|
182
|
+
...u,
|
|
183
183
|
message: b,
|
|
184
184
|
content: y
|
|
185
185
|
};
|
|
@@ -289,14 +289,14 @@ const I = (e) => e instanceof A || e instanceof Error && "response" in e && "sta
|
|
|
289
289
|
description: e?.message || "Something unexpected happened"
|
|
290
290
|
});
|
|
291
291
|
}, P = (e, t) => ({
|
|
292
|
-
getAllBlogs: async (
|
|
292
|
+
getAllBlogs: async (u, i = {}, a) => t.instance.url(`/v1/blog/${u}/post/query`).query({ ...a?.params || {} }).options({
|
|
293
293
|
headers: {
|
|
294
294
|
"Levo-Workspace": a?.workspace_id || void 0
|
|
295
295
|
}
|
|
296
296
|
}).post(i).json().then((g) => g).catch((g) => {
|
|
297
297
|
throw p(g);
|
|
298
298
|
}),
|
|
299
|
-
getSingleBlog: async (
|
|
299
|
+
getSingleBlog: async (u, i, a) => t.instance.url(`/v1/blog/${u}/post/${i}`).query({ ...a?.params || {} }).options({
|
|
300
300
|
headers: {
|
|
301
301
|
"Levo-Workspace": a?.workspace_id || void 0
|
|
302
302
|
}
|
|
@@ -349,14 +349,14 @@ const I = (e) => e instanceof A || e instanceof Error && "response" in e && "sta
|
|
|
349
349
|
getFilters: async (c, o = {}) => t.instance.url(`/v1/bevy/collection/${c}/get-filters`).options(o).get().json().then((n) => n).catch((n) => {
|
|
350
350
|
throw p(n);
|
|
351
351
|
})
|
|
352
|
-
}),
|
|
353
|
-
mediaBulkUpload: async (
|
|
352
|
+
}), q = (e, t) => ({
|
|
353
|
+
mediaBulkUpload: async (u, i = {}) => t.instance.url("/v1/assets/media/bulk").options(i).post(u).json().then((a) => a).catch((a) => {
|
|
354
354
|
throw p(a);
|
|
355
355
|
}),
|
|
356
|
-
getAllMedia: async (
|
|
356
|
+
getAllMedia: async (u = {}) => t.instance.url("/v1/assets/media/query").post(u).json().then((i) => i).catch((i) => {
|
|
357
357
|
throw p(i);
|
|
358
358
|
})
|
|
359
|
-
}),
|
|
359
|
+
}), C = ["google", "linkedin", "microsoft"], $ = (e, t) => {
|
|
360
360
|
const s = async (o = {}) => t.instance.url("/v1/membership/auth/oauth/get-redirect-url").options(o).get().json().then((n) => {
|
|
361
361
|
const r = n?.content?.data, m = Object.keys(r);
|
|
362
362
|
if (typeof window < "u")
|
|
@@ -368,22 +368,22 @@ const I = (e) => e instanceof A || e instanceof Error && "response" in e && "sta
|
|
|
368
368
|
}
|
|
369
369
|
}
|
|
370
370
|
return r;
|
|
371
|
-
}).catch(() =>
|
|
371
|
+
}).catch(() => C.reduce((n, r) => (n[r] = null, n), {})), d = async (o = {}) => t.instance.url("/v1/membership/auth/sign-out").options(o).post("").json().then((n) => n?.content?.data).catch((n) => {
|
|
372
372
|
throw p(n);
|
|
373
|
-
}),
|
|
373
|
+
}), u = async (o = {}) => t.instance.url("/v1/membership/auth/get-me").options(o).get().json().then((n) => n?.content?.data).catch((n) => {
|
|
374
374
|
throw p(n);
|
|
375
375
|
});
|
|
376
376
|
return {
|
|
377
377
|
getOAuthURL: s,
|
|
378
|
-
signOut:
|
|
379
|
-
getMe:
|
|
378
|
+
signOut: d,
|
|
379
|
+
getMe: u,
|
|
380
380
|
updateMe: async (o, n = {}) => t.instance.url("/v1/membership/auth/update-me").options(n).put(o).json().then((r) => r?.content?.data).catch((r) => {
|
|
381
381
|
throw p(r);
|
|
382
382
|
}),
|
|
383
383
|
createPassword: async (o, n = {}) => t.instance.url("/v1/membership/auth/change-password").options(n).put(o).json().then((r) => r?.content?.data).catch((r) => {
|
|
384
384
|
throw p(r);
|
|
385
385
|
}),
|
|
386
|
-
isLoggedIn: async (o = {}) =>
|
|
386
|
+
isLoggedIn: async (o = {}) => u(o).then((n) => n).catch(() => null),
|
|
387
387
|
requestMagicLink: async (o, n = {}) => (typeof window < "u" && !o.redirect_uri && (o.redirect_uri = window.location.href), t.instance.url("/v1/membership/auth/request-magic-link").options(n).post(o).json().then((r) => r?.content?.data).catch((r) => {
|
|
388
388
|
throw p(r);
|
|
389
389
|
})),
|
|
@@ -410,10 +410,10 @@ const I = (e) => e instanceof A || e instanceof Error && "response" in e && "sta
|
|
|
410
410
|
loggerOptions: s = {
|
|
411
411
|
logApiUrl: "https://public-api.levo.so"
|
|
412
412
|
},
|
|
413
|
-
...
|
|
413
|
+
...d
|
|
414
414
|
} = e;
|
|
415
|
-
let
|
|
416
|
-
const i = U(
|
|
415
|
+
let u = t;
|
|
416
|
+
const i = U(d), a = x(i, u), g = P(i, a), f = $(i, a), w = F(i, a), E = q(i, a), h = N(i, s);
|
|
417
417
|
return {
|
|
418
418
|
get apiUrl() {
|
|
419
419
|
return i.apiUrl;
|
|
@@ -446,10 +446,10 @@ const I = (e) => e instanceof A || e instanceof Error && "response" in e && "sta
|
|
|
446
446
|
return i.NODE_ENV;
|
|
447
447
|
},
|
|
448
448
|
get pageContext() {
|
|
449
|
-
return
|
|
449
|
+
return u;
|
|
450
450
|
},
|
|
451
451
|
updatePageContext: (n) => {
|
|
452
|
-
|
|
452
|
+
u = Object.assign({}, u, n);
|
|
453
453
|
},
|
|
454
454
|
updateWorkspace: (n) => {
|
|
455
455
|
i.workspace = n;
|
|
@@ -692,8 +692,8 @@ const I = (e) => e instanceof A || e instanceof Error && "response" in e && "sta
|
|
|
692
692
|
}, ue = (e) => {
|
|
693
693
|
const t = e.split("/"), s = t[t.length - 1];
|
|
694
694
|
if (s) {
|
|
695
|
-
const
|
|
696
|
-
return e.replace(s,
|
|
695
|
+
const d = encodeURIComponent(s);
|
|
696
|
+
return e.replace(s, d);
|
|
697
697
|
}
|
|
698
698
|
return "";
|
|
699
699
|
};
|
|
@@ -714,7 +714,7 @@ export {
|
|
|
714
714
|
J as LEVO_INTEGRATIONS,
|
|
715
715
|
re as LEVO_INTEGRATIONS_LIST,
|
|
716
716
|
v as LevoError,
|
|
717
|
-
|
|
717
|
+
C as LevoOAuthProviderList,
|
|
718
718
|
se as MediaKind,
|
|
719
719
|
G as MediaKindList,
|
|
720
720
|
z as createLevoClient,
|