@levo-so/core 0.1.64 → 0.1.71
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 +1976 -1784
- package/dist/index.js +461 -635
- package/package.json +5 -4
package/dist/index.js
CHANGED
|
@@ -1,272 +1,219 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
import { WretchError } from 'wretch/resolver';
|
|
4
|
-
|
|
5
|
-
// src/control/index.ts
|
|
6
|
-
var workspaceIdRegex = /^W[A-Z0-9]{7}$/;
|
|
7
|
-
var createLevoControl = (options) => {
|
|
1
|
+
import _ from "wretch";
|
|
2
|
+
const T = /^W[A-Z0-9]{7}$/, U = (e) => {
|
|
8
3
|
const {
|
|
9
|
-
appName,
|
|
10
|
-
workspace = null,
|
|
11
|
-
apiUrl = "https://public-api.levo.so",
|
|
12
|
-
NODE_ENV = "",
|
|
13
|
-
APP_MODE = "production"
|
|
14
|
-
} =
|
|
15
|
-
if (
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
let _workspace = workspace;
|
|
4
|
+
appName: t,
|
|
5
|
+
workspace: s = null,
|
|
6
|
+
apiUrl: u = "https://public-api.levo.so",
|
|
7
|
+
NODE_ENV: d = "",
|
|
8
|
+
APP_MODE: i = "production"
|
|
9
|
+
} = e;
|
|
10
|
+
if (s && !T.test(s))
|
|
11
|
+
throw new Error(
|
|
12
|
+
`Invalid workspace ID: ${s}. Workspace ID must be a string of the format "W[A-Z0-9]{7}".`
|
|
13
|
+
);
|
|
14
|
+
let a = s;
|
|
23
15
|
return {
|
|
24
16
|
get workspace() {
|
|
25
|
-
return
|
|
17
|
+
return a;
|
|
26
18
|
},
|
|
27
|
-
set workspace(
|
|
28
|
-
if (
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
_workspace = value;
|
|
19
|
+
set workspace(g) {
|
|
20
|
+
if (g && !T.test(g))
|
|
21
|
+
throw new Error(
|
|
22
|
+
`Invalid workspace ID: ${g}. Workspace ID must be a string of the format "W[A-Z0-9]{7}".`
|
|
23
|
+
);
|
|
24
|
+
a = g;
|
|
36
25
|
},
|
|
37
26
|
get appName() {
|
|
38
|
-
return
|
|
27
|
+
return t;
|
|
39
28
|
},
|
|
40
29
|
get apiUrl() {
|
|
41
|
-
return
|
|
30
|
+
return u;
|
|
42
31
|
},
|
|
43
32
|
get NODE_ENV() {
|
|
44
|
-
return
|
|
33
|
+
return d;
|
|
45
34
|
},
|
|
46
35
|
get APP_MODE() {
|
|
47
|
-
return
|
|
36
|
+
return i;
|
|
48
37
|
}
|
|
49
38
|
};
|
|
50
39
|
};
|
|
51
|
-
|
|
52
|
-
|
|
40
|
+
function O(e) {
|
|
41
|
+
return typeof e < "u" ? e : "";
|
|
42
|
+
}
|
|
43
|
+
const M = (e, t, s, u, d) => {
|
|
44
|
+
let i;
|
|
45
|
+
if (typeof t == "string")
|
|
46
|
+
i = t;
|
|
47
|
+
else {
|
|
48
|
+
const g = d.polyfill("URLSearchParams", !0, !0);
|
|
49
|
+
for (const f in t) {
|
|
50
|
+
const w = t[f];
|
|
51
|
+
if (!(u && w == null))
|
|
52
|
+
if (t[f] instanceof Array)
|
|
53
|
+
for (const E of w)
|
|
54
|
+
g.append(f, O(E));
|
|
55
|
+
else
|
|
56
|
+
g.append(f, O(w));
|
|
57
|
+
}
|
|
58
|
+
i = g.toString();
|
|
59
|
+
}
|
|
60
|
+
const a = e.split("?");
|
|
61
|
+
return i ? s || a.length < 2 ? a[0] + "?" + i : e + "&" + i : s ? a[0] : e;
|
|
62
|
+
}, j = {
|
|
63
|
+
wretch: {
|
|
64
|
+
query(e, t = !1, s = !1) {
|
|
65
|
+
return { ...this, _url: M(this._url, e, t, s, this._config) };
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}, x = (e, t) => {
|
|
69
|
+
const s = _(e.apiUrl).addon(j);
|
|
53
70
|
return {
|
|
54
71
|
get instance() {
|
|
55
|
-
const
|
|
72
|
+
const u = {
|
|
56
73
|
credentials: "include",
|
|
57
74
|
signal: AbortSignal.timeout(3e4),
|
|
58
75
|
// 30 seconds timeout,
|
|
59
76
|
headers: {}
|
|
60
77
|
};
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
if (pageContext && typeof pageContext === "object" && Object.keys(pageContext).length > 0) {
|
|
69
|
-
options.headers = {
|
|
70
|
-
...options?.headers || {},
|
|
71
|
-
"Levo-Page-Context": encodeURIComponent(JSON.stringify(pageContext))
|
|
72
|
-
};
|
|
73
|
-
}
|
|
74
|
-
return wr.options(options);
|
|
78
|
+
return e.workspace && (u.headers = {
|
|
79
|
+
...u?.headers || {},
|
|
80
|
+
"Levo-Workspace": e.workspace
|
|
81
|
+
}), t && typeof t == "object" && Object.keys(t).length > 0 && (u.headers = {
|
|
82
|
+
...u?.headers || {},
|
|
83
|
+
"Levo-Page-Context": encodeURIComponent(JSON.stringify(t))
|
|
84
|
+
}), s.options(u);
|
|
75
85
|
},
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
};
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
const
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
}, 0);
|
|
88
|
-
let lastFlush = /* @__PURE__ */ new Date();
|
|
89
|
-
const addUniqueLog = (newLog) => {
|
|
90
|
-
const contentKey = JSON.stringify(newLog?.content ?? "{}");
|
|
91
|
-
const messageKey = newLog?.message ?? "";
|
|
92
|
-
_logs.set(`${messageKey}${contentKey}`, newLog);
|
|
93
|
-
};
|
|
94
|
-
const sendLogs = async (logs) => {
|
|
95
|
-
const url = `${_logApiUrl}/v1/apm/logs/json`;
|
|
96
|
-
const sendFallback = () => {
|
|
97
|
-
return wretch().url(url).post(logs).res().catch((e) => console.error(e));
|
|
98
|
-
};
|
|
86
|
+
pageContext: t
|
|
87
|
+
};
|
|
88
|
+
}, L = (e = {}) => {
|
|
89
|
+
const { logApiUrl: t = "https://public-api.levo.so" } = e, s = t, u = /* @__PURE__ */ new Map();
|
|
90
|
+
let d = Promise.resolve(), i = setTimeout(() => {
|
|
91
|
+
}, 0), a = /* @__PURE__ */ new Date();
|
|
92
|
+
const g = (h) => {
|
|
93
|
+
const c = JSON.stringify(h?.content ?? "{}"), o = h?.message ?? "";
|
|
94
|
+
u.set(`${o}${c}`, h);
|
|
95
|
+
}, f = async (h) => {
|
|
96
|
+
const c = `${s}/v1/apm/logs/json`, o = () => _().url(c).post(h).res().catch((n) => console.error(n));
|
|
99
97
|
try {
|
|
100
|
-
if (typeof fetch
|
|
98
|
+
if (typeof fetch > "u")
|
|
101
99
|
throw new Error("fetch is not defined");
|
|
102
|
-
|
|
100
|
+
if (typeof window < "u" && navigator.sendBeacon)
|
|
103
101
|
try {
|
|
104
|
-
if (!navigator.sendBeacon.bind(navigator)(
|
|
105
|
-
return
|
|
106
|
-
}
|
|
102
|
+
if (!navigator.sendBeacon.bind(navigator)(c, JSON.stringify(h)))
|
|
103
|
+
return o();
|
|
107
104
|
} catch {
|
|
108
|
-
return
|
|
105
|
+
return o();
|
|
109
106
|
}
|
|
110
|
-
|
|
111
|
-
return
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
console.warn(`Failed to send logs to server: ${e}`);
|
|
115
|
-
logs.forEach((log) => addUniqueLog(log));
|
|
107
|
+
else
|
|
108
|
+
return o();
|
|
109
|
+
} catch (n) {
|
|
110
|
+
console.warn(`Failed to send logs to server: ${n}`), h.forEach((r) => g(r));
|
|
116
111
|
}
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
clearTimeout(nextFlush);
|
|
122
|
-
await activeFlush;
|
|
123
|
-
if (tasks.length === 0) {
|
|
124
|
-
lastFlush = /* @__PURE__ */ new Date();
|
|
112
|
+
}, w = async () => {
|
|
113
|
+
const h = Array.from(u.values());
|
|
114
|
+
if (u.clear(), clearTimeout(i), await d, h.length === 0) {
|
|
115
|
+
a = /* @__PURE__ */ new Date();
|
|
125
116
|
return;
|
|
126
117
|
}
|
|
127
118
|
try {
|
|
128
|
-
await
|
|
129
|
-
} catch (
|
|
130
|
-
console.error("error sending logs",
|
|
119
|
+
await f(h);
|
|
120
|
+
} catch (c) {
|
|
121
|
+
console.error("error sending logs", c);
|
|
131
122
|
} finally {
|
|
132
|
-
|
|
133
|
-
}
|
|
134
|
-
};
|
|
135
|
-
const ingest = (log) => {
|
|
136
|
-
if (!logApiUrl) return;
|
|
137
|
-
const tasks = Array.isArray(log) ? log : [log];
|
|
138
|
-
tasks.forEach((task) => addUniqueLog(task));
|
|
139
|
-
if (_logs.size >= 50 || lastFlush.getTime() < Date.now() - 1500) {
|
|
140
|
-
clearTimeout(nextFlush);
|
|
141
|
-
activeFlush = flush();
|
|
142
|
-
} else {
|
|
143
|
-
clearTimeout(nextFlush);
|
|
144
|
-
nextFlush = setTimeout(() => {
|
|
145
|
-
activeFlush = flush();
|
|
146
|
-
}, 1500);
|
|
123
|
+
a = /* @__PURE__ */ new Date();
|
|
147
124
|
}
|
|
148
125
|
};
|
|
149
126
|
return {
|
|
150
|
-
ingest
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
127
|
+
ingest: (h) => {
|
|
128
|
+
if (!t) return;
|
|
129
|
+
(Array.isArray(h) ? h : [h]).forEach((o) => g(o)), u.size >= 50 || a.getTime() < Date.now() - 1500 ? (clearTimeout(i), d = w()) : (clearTimeout(i), i = setTimeout(() => {
|
|
130
|
+
d = w();
|
|
131
|
+
}, 1500));
|
|
132
|
+
},
|
|
133
|
+
flush: w
|
|
134
|
+
};
|
|
135
|
+
}, R = typeof window < "u", S = (e) => {
|
|
136
|
+
switch (e) {
|
|
137
|
+
case 0:
|
|
138
|
+
return "log";
|
|
139
|
+
case 1:
|
|
140
|
+
return "info";
|
|
141
|
+
case 2:
|
|
142
|
+
return "warn";
|
|
143
|
+
case 3:
|
|
144
|
+
return "error";
|
|
145
|
+
default:
|
|
146
|
+
return "log";
|
|
147
|
+
}
|
|
148
|
+
}, N = (e, t = {}) => {
|
|
158
149
|
const {
|
|
159
|
-
enableRemote =
|
|
160
|
-
level:
|
|
161
|
-
context = {},
|
|
162
|
-
logApiUrl
|
|
163
|
-
} =
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
message = arg;
|
|
174
|
-
}
|
|
175
|
-
} else if (arg instanceof Error) {
|
|
176
|
-
payload = {
|
|
177
|
-
message: arg.message,
|
|
178
|
-
name: arg.name,
|
|
179
|
-
stack: arg.stack
|
|
180
|
-
};
|
|
181
|
-
if (isMessageEmpty) {
|
|
182
|
-
message = arg.message;
|
|
183
|
-
}
|
|
184
|
-
} else if (typeof arg === "object") {
|
|
185
|
-
payload = arg;
|
|
186
|
-
} else {
|
|
187
|
-
payload = String(arg);
|
|
188
|
-
if (isMessageEmpty) {
|
|
189
|
-
message = String(arg);
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
|
-
return payload;
|
|
150
|
+
enableRemote: s = e.NODE_ENV !== "development",
|
|
151
|
+
level: u = e.NODE_ENV !== "development" ? 2 : 0,
|
|
152
|
+
context: d = {},
|
|
153
|
+
logApiUrl: i
|
|
154
|
+
} = t, a = L({ logApiUrl: i }), g = (o) => {
|
|
155
|
+
let n = "";
|
|
156
|
+
const r = o.map((m) => {
|
|
157
|
+
let y = "";
|
|
158
|
+
const b = !n;
|
|
159
|
+
return typeof m == "string" ? (y = m, b && (n = m)) : m instanceof Error ? (y = {
|
|
160
|
+
message: m.message,
|
|
161
|
+
name: m.name,
|
|
162
|
+
stack: m.stack
|
|
163
|
+
}, b && (n = m.message)) : typeof m == "object" ? y = m : (y = String(m), b && (n = String(m))), y;
|
|
193
164
|
}).filter(Boolean);
|
|
194
|
-
|
|
195
|
-
message
|
|
196
|
-
|
|
197
|
-
if (formattedMessages?.length === 1 && formattedMessages[0] === message) {
|
|
198
|
-
return { message, content: {} };
|
|
199
|
-
}
|
|
200
|
-
return {
|
|
201
|
-
message,
|
|
202
|
-
content: formattedMessages
|
|
165
|
+
return !n && r.length > 0 && (n = "Default message (Check content for details)"), r?.length === 1 && r[0] === n ? { message: n, content: {} } : {
|
|
166
|
+
message: n,
|
|
167
|
+
content: r
|
|
203
168
|
};
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
if (level < logLevel) {
|
|
169
|
+
}, f = (o, n) => {
|
|
170
|
+
const r = Array.isArray(n) ? n : [n];
|
|
171
|
+
if (o < u)
|
|
208
172
|
return;
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
const log2 = {
|
|
173
|
+
if (s && o === 3) {
|
|
174
|
+
const { content: y = {}, message: b } = g(r);
|
|
175
|
+
if (b) {
|
|
176
|
+
const W = {
|
|
214
177
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
215
178
|
level: "error",
|
|
216
|
-
workspace:
|
|
217
|
-
appName:
|
|
218
|
-
isBrowser,
|
|
219
|
-
...
|
|
220
|
-
message,
|
|
221
|
-
content
|
|
179
|
+
workspace: e.workspace,
|
|
180
|
+
appName: e?.appName,
|
|
181
|
+
isBrowser: R,
|
|
182
|
+
...d,
|
|
183
|
+
message: b,
|
|
184
|
+
content: y
|
|
222
185
|
};
|
|
223
|
-
|
|
224
|
-
log2.hostname = window.location.hostname;
|
|
225
|
-
log2.pathname = window.location.pathname;
|
|
226
|
-
log2.url = window.location.href;
|
|
227
|
-
log2.page_title = window.document.title;
|
|
228
|
-
log2.userAgent = window.navigator.userAgent;
|
|
229
|
-
}
|
|
230
|
-
batch.ingest(log2);
|
|
186
|
+
R && (W.hostname = window.location.hostname, W.pathname = window.location.pathname, W.url = window.location.href, W.page_title = window.document.title, W.userAgent = window.navigator.userAgent), a.ingest(W);
|
|
231
187
|
}
|
|
232
188
|
}
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
const debug = (...args) => {
|
|
236
|
-
log(0 /* debug */, args);
|
|
237
|
-
};
|
|
238
|
-
const info = (...args) => {
|
|
239
|
-
log(1 /* info */, args);
|
|
240
|
-
};
|
|
241
|
-
const warn = (...args) => {
|
|
242
|
-
log(2 /* warn */, args);
|
|
243
|
-
};
|
|
244
|
-
const error = (...args) => {
|
|
245
|
-
log(3 /* error */, args);
|
|
189
|
+
const m = S(o);
|
|
190
|
+
console[m](...r);
|
|
246
191
|
};
|
|
247
192
|
return {
|
|
248
|
-
debug
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
193
|
+
debug: (...o) => {
|
|
194
|
+
f(0, o);
|
|
195
|
+
},
|
|
196
|
+
info: (...o) => {
|
|
197
|
+
f(1, o);
|
|
198
|
+
},
|
|
199
|
+
warn: (...o) => {
|
|
200
|
+
f(2, o);
|
|
201
|
+
},
|
|
202
|
+
error: (...o) => {
|
|
203
|
+
f(3, o);
|
|
204
|
+
}
|
|
252
205
|
};
|
|
253
206
|
};
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
207
|
+
class A extends Error {
|
|
208
|
+
}
|
|
209
|
+
class v extends Error {
|
|
257
210
|
code;
|
|
258
211
|
title;
|
|
259
212
|
status;
|
|
260
213
|
type;
|
|
261
214
|
errors;
|
|
262
|
-
constructor(
|
|
263
|
-
super(
|
|
264
|
-
this.name = "Levo Request Error";
|
|
265
|
-
this.status = data.status;
|
|
266
|
-
this.code = data.code;
|
|
267
|
-
this.title = data.title;
|
|
268
|
-
this.type = data.type;
|
|
269
|
-
this.errors = data.errors;
|
|
215
|
+
constructor(t) {
|
|
216
|
+
super(t.description), this.name = "Levo Request Error", this.status = t.status, this.code = t.code, this.title = t.title, this.type = t.type, this.errors = t.errors;
|
|
270
217
|
}
|
|
271
218
|
/**
|
|
272
219
|
* Get validation errors for form fields
|
|
@@ -278,365 +225,241 @@ var LevoError = class extends Error {
|
|
|
278
225
|
* Check if this is a validation error with field-specific errors
|
|
279
226
|
*/
|
|
280
227
|
get hasFieldErrors() {
|
|
281
|
-
return
|
|
228
|
+
return !!this.errors?.length;
|
|
282
229
|
}
|
|
283
|
-
}
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
if (
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
230
|
+
}
|
|
231
|
+
const I = (e) => e instanceof A || e instanceof Error && "response" in e && "status" in e && "url" in e, p = (e) => {
|
|
232
|
+
if (e instanceof v)
|
|
233
|
+
return e;
|
|
234
|
+
if (I(e)) {
|
|
235
|
+
let t = e?.json;
|
|
236
|
+
if (!t && (e?.text || e?.message))
|
|
237
|
+
try {
|
|
238
|
+
t = JSON.parse(e.text || e.message);
|
|
239
|
+
} catch {
|
|
240
|
+
}
|
|
241
|
+
if (t) {
|
|
242
|
+
const s = t;
|
|
243
|
+
return new v({
|
|
244
|
+
status: s?.content?.status || e?.status || 500,
|
|
245
|
+
code: s?.content?.code || "Unknown",
|
|
246
|
+
title: s?.content?.title || `HTTP ${e?.status || 500} Error`,
|
|
247
|
+
description: s?.content?.description || s?.content?.errors?.[0]?.message || `Request failed with status ${e?.status || 500}`,
|
|
248
|
+
type: s?.content?.type,
|
|
249
|
+
errors: s?.content?.errors
|
|
250
|
+
});
|
|
251
|
+
}
|
|
252
|
+
return new v({
|
|
253
|
+
status: e?.status || 500,
|
|
254
|
+
code: "HTTP_ERROR",
|
|
255
|
+
title: `HTTP ${e?.status || 500} Error`,
|
|
256
|
+
description: `Request failed with status ${e?.status || 500}`
|
|
299
257
|
});
|
|
300
258
|
}
|
|
301
|
-
if (
|
|
302
|
-
if (
|
|
303
|
-
return new
|
|
259
|
+
if (e instanceof TypeError) {
|
|
260
|
+
if (e?.message.includes("Failed to fetch") || e?.message.includes("Network request failed") || e?.message.includes("fetch"))
|
|
261
|
+
return new v({
|
|
304
262
|
status: 0,
|
|
305
263
|
code: "NETWORK_ERROR",
|
|
306
264
|
title: "Network Error",
|
|
307
265
|
description: "Unable to connect to the server. Please check your internet connection."
|
|
308
266
|
});
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
return new LevoError({
|
|
267
|
+
if (e?.message.includes("CORS") || e?.message.includes("cross-origin"))
|
|
268
|
+
return new v({
|
|
312
269
|
status: 0,
|
|
313
270
|
code: "CORS_ERROR",
|
|
314
271
|
title: "CORS Error",
|
|
315
272
|
description: "Cross-origin request blocked. Please contact support."
|
|
316
273
|
});
|
|
317
|
-
}
|
|
318
|
-
}
|
|
319
|
-
if (error?.name === "AbortError" || error instanceof DOMException) {
|
|
320
|
-
return new LevoError({
|
|
321
|
-
status: 408,
|
|
322
|
-
code: "REQUEST_TIMEOUT",
|
|
323
|
-
title: "Request Timeout",
|
|
324
|
-
description: "The request was cancelled or timed out. Please try again."
|
|
325
|
-
});
|
|
326
274
|
}
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
275
|
+
return e?.name === "AbortError" || e instanceof DOMException ? new v({
|
|
276
|
+
status: 408,
|
|
277
|
+
code: "REQUEST_TIMEOUT",
|
|
278
|
+
title: "Request Timeout",
|
|
279
|
+
description: "The request was cancelled or timed out. Please try again."
|
|
280
|
+
}) : e?.request ? new v({
|
|
281
|
+
status: e?.response?.status || 500,
|
|
282
|
+
code: e?.code || "REQUEST_ERROR",
|
|
283
|
+
title: "Request Error",
|
|
284
|
+
description: e?.message || "An error occurred while making the request"
|
|
285
|
+
}) : new v({
|
|
336
286
|
status: 500,
|
|
337
287
|
code: "UNKNOWN_ERROR",
|
|
338
288
|
title: "Unexpected Error",
|
|
339
|
-
description:
|
|
289
|
+
description: e?.message || "Something unexpected happened"
|
|
340
290
|
});
|
|
341
|
-
}
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
}
|
|
353
|
-
}
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
}
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
}) => {
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
})
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
}
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
throw getLevoError(error);
|
|
419
|
-
});
|
|
420
|
-
};
|
|
421
|
-
const getDraftEntry = async (collection_key) => {
|
|
422
|
-
return httpsClient.instance.url(`/v1/bevy/content/${collection_key}/list-entry`).get().json().then((response) => response).catch((error) => {
|
|
423
|
-
throw getLevoError(error);
|
|
424
|
-
});
|
|
425
|
-
};
|
|
426
|
-
const getFilters = async (collectionId, options = {}) => {
|
|
427
|
-
return httpsClient.instance.url(`/v1/bevy/collection/${collectionId}/get-filters`).options(options).get().json().then((response) => response).catch((error) => {
|
|
428
|
-
throw getLevoError(error);
|
|
429
|
-
});
|
|
430
|
-
};
|
|
431
|
-
const submitDraftEntry = async (collection_key, data) => {
|
|
432
|
-
return httpsClient.instance.url(`/v1/bevy/content/${collection_key}/submit-entry`).post(data).json().then((response) => response).catch((error) => {
|
|
433
|
-
throw getLevoError(error);
|
|
434
|
-
});
|
|
435
|
-
};
|
|
436
|
-
return {
|
|
437
|
-
getAllCollections,
|
|
438
|
-
getCollectionByIDExpanded,
|
|
439
|
-
createCollection,
|
|
440
|
-
saveCollectionData,
|
|
441
|
-
getCollectionContentList,
|
|
442
|
-
saveDraftEntry,
|
|
443
|
-
editDraftEntry,
|
|
444
|
-
getDraftEntry,
|
|
445
|
-
submitDraftEntry,
|
|
446
|
-
getFilters
|
|
447
|
-
};
|
|
448
|
-
};
|
|
449
|
-
|
|
450
|
-
// src/modules/media.ts
|
|
451
|
-
var createLevoMediaModule = (core, httpsClient) => {
|
|
452
|
-
const mediaBulkUpload = async (formData, options = {}) => {
|
|
453
|
-
return httpsClient.instance.url("/v1/assets/media/bulk").options(options).post(formData).json().then((response) => response).catch((error) => {
|
|
454
|
-
throw getLevoError(error);
|
|
455
|
-
});
|
|
456
|
-
};
|
|
457
|
-
const getAllMedia = async (data = {}) => {
|
|
458
|
-
return httpsClient.instance.url("/v1/assets/media/query").post(data).json().then((response) => response).catch((error) => {
|
|
459
|
-
throw getLevoError(error);
|
|
460
|
-
});
|
|
461
|
-
};
|
|
462
|
-
return {
|
|
463
|
-
mediaBulkUpload,
|
|
464
|
-
getAllMedia
|
|
465
|
-
};
|
|
466
|
-
};
|
|
467
|
-
|
|
468
|
-
// src/constants/oauthProvider.ts
|
|
469
|
-
var LevoOAuthProviderList = ["google", "linkedin", "microsoft"];
|
|
470
|
-
|
|
471
|
-
// src/modules/membership.ts
|
|
472
|
-
var createLevoMembershipModule = (core, httpsClient) => {
|
|
473
|
-
const getOAuthURL = async (options = {}) => {
|
|
474
|
-
return httpsClient.instance.url("/v1/membership/auth/oauth/get-redirect-url").options(options).get().json().then((response) => {
|
|
475
|
-
const result = response?.content?.data;
|
|
476
|
-
const providers = Object.keys(result);
|
|
477
|
-
if (typeof window !== "undefined") {
|
|
478
|
-
for (const provider of providers) {
|
|
479
|
-
const raw_url = result[provider];
|
|
480
|
-
if (raw_url) {
|
|
481
|
-
const url = new URL(raw_url);
|
|
482
|
-
const url_params = url.searchParams;
|
|
483
|
-
url_params.set("redirect_uri", window.location.href);
|
|
484
|
-
if (core.workspace) {
|
|
485
|
-
url_params.set("workspace_id", core.workspace);
|
|
486
|
-
}
|
|
487
|
-
if (httpsClient.pageContext) {
|
|
488
|
-
url_params.set("page_context", JSON.stringify(httpsClient.pageContext));
|
|
489
|
-
}
|
|
490
|
-
result[provider] = url.toString();
|
|
491
|
-
}
|
|
291
|
+
}, P = (e, t) => ({
|
|
292
|
+
getAllBlogs: async (d, i = {}, a) => t.instance.url(`/v1/blog/${d}/post/query`).query({ ...a?.params || {} }).options({
|
|
293
|
+
headers: {
|
|
294
|
+
"Levo-Workspace": a?.workspace_id || void 0
|
|
295
|
+
}
|
|
296
|
+
}).post(i).json().then((g) => g).catch((g) => {
|
|
297
|
+
throw p(g);
|
|
298
|
+
}),
|
|
299
|
+
getSingleBlog: async (d, i, a) => t.instance.url(`/v1/blog/${d}/post/${i}`).query({ ...a?.params || {} }).options({
|
|
300
|
+
headers: {
|
|
301
|
+
"Levo-Workspace": a?.workspace_id || void 0
|
|
302
|
+
}
|
|
303
|
+
}).get().json().then((g) => g).catch((g) => {
|
|
304
|
+
throw p(g);
|
|
305
|
+
})
|
|
306
|
+
}), F = (e, t) => ({
|
|
307
|
+
getAllCollections: async (c = {}, o = {}) => t.instance.url("/v1/bevy/collection/query").options(o).post(c).json().then((n) => n).catch((n) => {
|
|
308
|
+
throw p(n);
|
|
309
|
+
}),
|
|
310
|
+
getCollectionByIDExpanded: async (c, o = {}) => t.instance.url(`/v1/bevy/collection/${c}`).options(o).get().json().then((n) => n).catch((n) => {
|
|
311
|
+
throw p(n);
|
|
312
|
+
}),
|
|
313
|
+
createCollection: async (c) => t.instance.url("/v1/bevy/collection").post(c).json().then((o) => o).catch((o) => {
|
|
314
|
+
throw p(o);
|
|
315
|
+
}),
|
|
316
|
+
saveCollectionData: async ({
|
|
317
|
+
collection_id: c,
|
|
318
|
+
data: o,
|
|
319
|
+
options: n = {}
|
|
320
|
+
}) => t.instance.url(`/v1/bevy/content/${c}`).options(n).post(o).json().then((r) => r).catch((r) => {
|
|
321
|
+
throw p(r);
|
|
322
|
+
}),
|
|
323
|
+
getCollectionContentList: async ({
|
|
324
|
+
collection_key: c,
|
|
325
|
+
page: o,
|
|
326
|
+
search: n,
|
|
327
|
+
limit: r = 10,
|
|
328
|
+
where: m
|
|
329
|
+
}) => t.instance.url(`/v1/bevy/content/${c}/query`).post({
|
|
330
|
+
page: o,
|
|
331
|
+
limit: r,
|
|
332
|
+
search: n,
|
|
333
|
+
where: m
|
|
334
|
+
}).json().then((y) => y).catch((y) => {
|
|
335
|
+
throw p(y);
|
|
336
|
+
}),
|
|
337
|
+
saveDraftEntry: async (c, o) => t.instance.url(`/v1/bevy/content/${c}/save-entry`).post(o).json().then((n) => n).catch((n) => {
|
|
338
|
+
throw p(n);
|
|
339
|
+
}),
|
|
340
|
+
editDraftEntry: async (c, o, n) => t.instance.url(`/v1/bevy/content/${c}/${o}/edit-entry`).put(n).json().then((r) => r).catch((r) => {
|
|
341
|
+
throw p(r);
|
|
342
|
+
}),
|
|
343
|
+
getDraftEntry: async (c) => t.instance.url(`/v1/bevy/content/${c}/list-entry`).get().json().then((o) => o).catch((o) => {
|
|
344
|
+
throw p(o);
|
|
345
|
+
}),
|
|
346
|
+
submitDraftEntry: async (c, o) => t.instance.url(`/v1/bevy/content/${c}/submit-entry`).post(o).json().then((n) => n).catch((n) => {
|
|
347
|
+
throw p(n);
|
|
348
|
+
}),
|
|
349
|
+
getFilters: async (c, o = {}) => t.instance.url(`/v1/bevy/collection/${c}/get-filters`).options(o).get().json().then((n) => n).catch((n) => {
|
|
350
|
+
throw p(n);
|
|
351
|
+
})
|
|
352
|
+
}), C = (e, t) => ({
|
|
353
|
+
mediaBulkUpload: async (d, i = {}) => t.instance.url("/v1/assets/media/bulk").options(i).post(d).json().then((a) => a).catch((a) => {
|
|
354
|
+
throw p(a);
|
|
355
|
+
}),
|
|
356
|
+
getAllMedia: async (d = {}) => t.instance.url("/v1/assets/media/query").post(d).json().then((i) => i).catch((i) => {
|
|
357
|
+
throw p(i);
|
|
358
|
+
})
|
|
359
|
+
}), $ = ["google", "linkedin", "microsoft"], q = (e, t) => {
|
|
360
|
+
const s = async (o = {}) => t.instance.url("/v1/membership/auth/oauth/get-redirect-url").options(o).get().json().then((n) => {
|
|
361
|
+
const r = n?.content?.data, m = Object.keys(r);
|
|
362
|
+
if (typeof window < "u")
|
|
363
|
+
for (const y of m) {
|
|
364
|
+
const b = r[y];
|
|
365
|
+
if (b) {
|
|
366
|
+
const W = new URL(b), k = W.searchParams;
|
|
367
|
+
k.set("redirect_uri", window.location.href), e.workspace && k.set("workspace_id", e.workspace), t.pageContext && k.set("page_context", JSON.stringify(t.pageContext)), r[y] = W.toString();
|
|
492
368
|
}
|
|
493
369
|
}
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
});
|
|
501
|
-
};
|
|
502
|
-
const signOut = async (options = {}) => {
|
|
503
|
-
return httpsClient.instance.url("/v1/membership/auth/sign-out").options(options).post("").json().then((response) => response?.content?.data).catch((error) => {
|
|
504
|
-
throw getLevoError(error);
|
|
505
|
-
});
|
|
506
|
-
};
|
|
507
|
-
const getMe = async (options = {}) => {
|
|
508
|
-
return httpsClient.instance.url("/v1/membership/auth/get-me").options(options).get().json().then((response) => response?.content?.data).catch((error) => {
|
|
509
|
-
throw getLevoError(error);
|
|
510
|
-
});
|
|
511
|
-
};
|
|
512
|
-
const updateMe = async (data, options = {}) => {
|
|
513
|
-
return httpsClient.instance.url("/v1/membership/auth/update-me").options(options).put(data).json().then((response) => response?.content?.data).catch((error) => {
|
|
514
|
-
throw getLevoError(error);
|
|
515
|
-
});
|
|
516
|
-
};
|
|
517
|
-
const createPassword = async (data, options = {}) => {
|
|
518
|
-
return httpsClient.instance.url("/v1/membership/auth/change-password").options(options).put(data).json().then((response) => response?.content?.data).catch((error) => {
|
|
519
|
-
throw getLevoError(error);
|
|
520
|
-
});
|
|
521
|
-
};
|
|
522
|
-
const isLoggedIn = async (options = {}) => {
|
|
523
|
-
return getMe(options).then((account) => account).catch(() => null);
|
|
524
|
-
};
|
|
525
|
-
const requestMagicLink = async (data, options = {}) => {
|
|
526
|
-
if (typeof window !== "undefined" && !data.redirect_uri) {
|
|
527
|
-
data.redirect_uri = window.location.href;
|
|
528
|
-
}
|
|
529
|
-
return httpsClient.instance.url("/v1/membership/auth/request-magic-link").options(options).post(data).json().then((response) => response?.content?.data).catch((error) => {
|
|
530
|
-
throw getLevoError(error);
|
|
531
|
-
});
|
|
532
|
-
};
|
|
533
|
-
const requestOtp = async (data, options = {}) => {
|
|
534
|
-
return httpsClient.instance.url("/v1/membership/auth/request-otp").options(options).post(data).json().then((response) => response?.content?.data).catch((error) => {
|
|
535
|
-
throw getLevoError(error);
|
|
536
|
-
});
|
|
537
|
-
};
|
|
538
|
-
const signInWithOtp = async (data, options = {}) => {
|
|
539
|
-
return httpsClient.instance.url("/v1/membership/auth/signin-with-otp").options(options).post(data).json().then((response) => response?.content?.data).catch((error) => {
|
|
540
|
-
throw getLevoError(error);
|
|
541
|
-
});
|
|
542
|
-
};
|
|
543
|
-
const signInWithPassword = async (data, options = {}) => {
|
|
544
|
-
return httpsClient.instance.url("/v1/membership/auth/signin-with-password").options(options).post(data).json().then((response) => response?.content?.data).catch((error) => {
|
|
545
|
-
throw getLevoError(error);
|
|
546
|
-
});
|
|
547
|
-
};
|
|
548
|
-
const signUpWithPassword = async (data, options = {}) => {
|
|
549
|
-
return httpsClient.instance.url("/v1/membership/auth/signup-with-password").options(options).post(data).json().then((response) => response?.content?.data).catch((error) => {
|
|
550
|
-
throw getLevoError(error);
|
|
551
|
-
});
|
|
552
|
-
};
|
|
370
|
+
return r;
|
|
371
|
+
}).catch(() => $.reduce((n, r) => (n[r] = null, n), {})), u = async (o = {}) => t.instance.url("/v1/membership/auth/sign-out").options(o).post("").json().then((n) => n?.content?.data).catch((n) => {
|
|
372
|
+
throw p(n);
|
|
373
|
+
}), d = async (o = {}) => t.instance.url("/v1/membership/auth/get-me").options(o).get().json().then((n) => n?.content?.data).catch((n) => {
|
|
374
|
+
throw p(n);
|
|
375
|
+
});
|
|
553
376
|
return {
|
|
554
|
-
getOAuthURL,
|
|
555
|
-
signOut,
|
|
556
|
-
getMe,
|
|
557
|
-
updateMe,
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
}
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
377
|
+
getOAuthURL: s,
|
|
378
|
+
signOut: u,
|
|
379
|
+
getMe: d,
|
|
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
|
+
throw p(r);
|
|
382
|
+
}),
|
|
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
|
+
throw p(r);
|
|
385
|
+
}),
|
|
386
|
+
isLoggedIn: async (o = {}) => d(o).then((n) => n).catch(() => null),
|
|
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
|
+
throw p(r);
|
|
389
|
+
})),
|
|
390
|
+
requestOtp: async (o, n = {}) => t.instance.url("/v1/membership/auth/request-otp").options(n).post(o).json().then((r) => r?.content?.data).catch((r) => {
|
|
391
|
+
throw p(r);
|
|
392
|
+
}),
|
|
393
|
+
signInWithOtp: async (o, n = {}) => t.instance.url("/v1/membership/auth/signin-with-otp").options(n).post(o).json().then((r) => r?.content?.data).catch((r) => {
|
|
394
|
+
throw p(r);
|
|
395
|
+
}),
|
|
396
|
+
signInWithPassword: async (o, n = {}) => t.instance.url("/v1/membership/auth/signin-with-password").options(n).post(o).json().then((r) => r?.content?.data).catch((r) => {
|
|
397
|
+
throw p(r);
|
|
398
|
+
}),
|
|
399
|
+
signUpWithPassword: async (o, n = {}) => t.instance.url("/v1/membership/auth/signup-with-password").options(n).post(o).json().then((r) => r?.content?.data).catch((r) => {
|
|
400
|
+
throw p(r);
|
|
401
|
+
})
|
|
402
|
+
};
|
|
403
|
+
}, z = (e) => {
|
|
570
404
|
const {
|
|
571
|
-
pageContext = {
|
|
572
|
-
url: typeof window
|
|
573
|
-
referrer: typeof document
|
|
574
|
-
title: typeof document
|
|
405
|
+
pageContext: t = {
|
|
406
|
+
url: typeof window < "u" ? window?.location?.href : "",
|
|
407
|
+
referrer: typeof document < "u" ? document?.referrer : "",
|
|
408
|
+
title: typeof document < "u" ? document?.title : ""
|
|
575
409
|
},
|
|
576
|
-
loggerOptions = {
|
|
410
|
+
loggerOptions: s = {
|
|
577
411
|
logApiUrl: "https://public-api.levo.so"
|
|
578
412
|
},
|
|
579
|
-
...
|
|
580
|
-
} =
|
|
581
|
-
let
|
|
582
|
-
const
|
|
583
|
-
const httpsClient = createHttpClient(core, () => _pageContext);
|
|
584
|
-
const blog = createLevoBlogModule(core, httpsClient);
|
|
585
|
-
const membership = createLevoMembershipModule(core, httpsClient);
|
|
586
|
-
const collection = createLevoCollectionModule(core, httpsClient);
|
|
587
|
-
const media = createLevoMediaModule(core, httpsClient);
|
|
588
|
-
const logger = createLevoLogger(core, loggerOptions);
|
|
589
|
-
const updatePageContext = (newContext) => {
|
|
590
|
-
_pageContext = Object.assign({}, _pageContext, newContext);
|
|
591
|
-
};
|
|
592
|
-
const updateWorkspace = (workspace) => {
|
|
593
|
-
core.workspace = workspace;
|
|
594
|
-
};
|
|
413
|
+
...u
|
|
414
|
+
} = e;
|
|
415
|
+
let d = t;
|
|
416
|
+
const i = U(u), a = x(i, d), g = P(i, a), f = q(i, a), w = F(i, a), E = C(i, a), h = N(i, s);
|
|
595
417
|
return {
|
|
596
418
|
get apiUrl() {
|
|
597
|
-
return
|
|
419
|
+
return i.apiUrl;
|
|
598
420
|
},
|
|
599
421
|
get workspace() {
|
|
600
|
-
return
|
|
422
|
+
return i.workspace;
|
|
601
423
|
},
|
|
602
424
|
get blog() {
|
|
603
|
-
return
|
|
425
|
+
return g;
|
|
604
426
|
},
|
|
605
427
|
get membership() {
|
|
606
|
-
return
|
|
428
|
+
return f;
|
|
607
429
|
},
|
|
608
430
|
get collection() {
|
|
609
|
-
return
|
|
431
|
+
return w;
|
|
610
432
|
},
|
|
611
433
|
get media() {
|
|
612
|
-
return
|
|
434
|
+
return E;
|
|
613
435
|
},
|
|
614
436
|
get logger() {
|
|
615
|
-
return
|
|
437
|
+
return h;
|
|
616
438
|
},
|
|
617
|
-
get
|
|
618
|
-
return
|
|
439
|
+
get fetch() {
|
|
440
|
+
return a.instance;
|
|
619
441
|
},
|
|
620
442
|
get APP_MODE() {
|
|
621
|
-
return
|
|
443
|
+
return i.APP_MODE;
|
|
622
444
|
},
|
|
623
445
|
get NODE_ENV() {
|
|
624
|
-
return
|
|
446
|
+
return i.NODE_ENV;
|
|
625
447
|
},
|
|
626
448
|
get pageContext() {
|
|
627
|
-
return
|
|
449
|
+
return d;
|
|
450
|
+
},
|
|
451
|
+
updatePageContext: (n) => {
|
|
452
|
+
d = Object.assign({}, d, n);
|
|
628
453
|
},
|
|
629
|
-
|
|
630
|
-
|
|
454
|
+
updateWorkspace: (n) => {
|
|
455
|
+
i.workspace = n;
|
|
456
|
+
}
|
|
631
457
|
};
|
|
632
|
-
}
|
|
633
|
-
|
|
634
|
-
// src/constants/collection/defaultByKind.ts
|
|
635
|
-
var defaultByKinds = {
|
|
458
|
+
}, X = {
|
|
636
459
|
"public-id": "",
|
|
637
460
|
string: "",
|
|
638
461
|
number: null,
|
|
639
|
-
boolean:
|
|
462
|
+
boolean: !1,
|
|
640
463
|
location: null,
|
|
641
464
|
file: null,
|
|
642
465
|
date: null,
|
|
@@ -661,10 +484,7 @@ var defaultByKinds = {
|
|
|
661
484
|
"array-date": [],
|
|
662
485
|
"array-boolean": [],
|
|
663
486
|
"array-location": []
|
|
664
|
-
}
|
|
665
|
-
|
|
666
|
-
// src/constants/collection/fieldInterfaceFormat.ts
|
|
667
|
-
var formatsByInterface = {
|
|
487
|
+
}, Y = {
|
|
668
488
|
ArrayWidget: [],
|
|
669
489
|
RecordWidget: [],
|
|
670
490
|
TextWidget: [],
|
|
@@ -694,10 +514,7 @@ var formatsByInterface = {
|
|
|
694
514
|
MultiGeocoderWidget: [],
|
|
695
515
|
JSONWidget: [],
|
|
696
516
|
SlugWidget: []
|
|
697
|
-
}
|
|
698
|
-
|
|
699
|
-
// src/constants/collection/fieldInterfaces.ts
|
|
700
|
-
var CommonFieldInterfacesList = [
|
|
517
|
+
}, D = [
|
|
701
518
|
"TextWidget",
|
|
702
519
|
"CurrencyWidget",
|
|
703
520
|
"TextareaWidget",
|
|
@@ -722,35 +539,22 @@ var CommonFieldInterfacesList = [
|
|
|
722
539
|
"MultiFileUploadWidget",
|
|
723
540
|
"MultiDropdownWidget",
|
|
724
541
|
"MultiTextWidget"
|
|
725
|
-
]
|
|
726
|
-
var ComplexFieldInterfacesList = [
|
|
542
|
+
], B = [
|
|
727
543
|
"CollectionWidget",
|
|
728
544
|
"ArrayWidget",
|
|
729
545
|
"RecordWidget",
|
|
730
546
|
"JSONWidget",
|
|
731
547
|
"SlugWidget"
|
|
732
|
-
]
|
|
733
|
-
|
|
734
|
-
...
|
|
735
|
-
|
|
736
|
-
]
|
|
737
|
-
var CommonFieldIntefaces = CommonFieldInterfacesList.reduce(
|
|
738
|
-
(acc, curr) => {
|
|
739
|
-
acc[curr] = curr;
|
|
740
|
-
return acc;
|
|
741
|
-
},
|
|
548
|
+
], K = [
|
|
549
|
+
...D,
|
|
550
|
+
...B
|
|
551
|
+
], ee = D.reduce(
|
|
552
|
+
(e, t) => (e[t] = t, e),
|
|
742
553
|
{}
|
|
743
|
-
)
|
|
744
|
-
|
|
745
|
-
(acc, curr) => {
|
|
746
|
-
acc[curr] = curr;
|
|
747
|
-
return acc;
|
|
748
|
-
},
|
|
554
|
+
), te = K.reduce(
|
|
555
|
+
(e, t) => (e[t] = t, e),
|
|
749
556
|
{}
|
|
750
|
-
)
|
|
751
|
-
|
|
752
|
-
// src/constants/collection/fieldKind.ts
|
|
753
|
-
var FieldKindList = [
|
|
557
|
+
), ne = [
|
|
754
558
|
"collection",
|
|
755
559
|
"record",
|
|
756
560
|
"group",
|
|
@@ -771,8 +575,7 @@ var FieldKindList = [
|
|
|
771
575
|
"array-location",
|
|
772
576
|
"richtext",
|
|
773
577
|
"identifier"
|
|
774
|
-
]
|
|
775
|
-
var FieldKind = {
|
|
578
|
+
], l = {
|
|
776
579
|
identifier: "identifier",
|
|
777
580
|
collection: "collection",
|
|
778
581
|
"public-id": "public-id",
|
|
@@ -793,41 +596,37 @@ var FieldKind = {
|
|
|
793
596
|
"array-location": "array-location",
|
|
794
597
|
richtext: "richtext",
|
|
795
598
|
"array-json": "array-json"
|
|
796
|
-
}
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
};
|
|
828
|
-
|
|
829
|
-
// src/constants/integration.ts
|
|
830
|
-
var LEVO_INTEGRATIONS = {
|
|
599
|
+
}, oe = {
|
|
600
|
+
ArrayWidget: l.group,
|
|
601
|
+
RecordWidget: l.record,
|
|
602
|
+
TextWidget: l.string,
|
|
603
|
+
TextareaWidget: l.string,
|
|
604
|
+
EmailWidget: l.string,
|
|
605
|
+
URLWidget: l.string,
|
|
606
|
+
CurrencyWidget: l.string,
|
|
607
|
+
NumberWidget: l.number,
|
|
608
|
+
PhoneWidget: l.string,
|
|
609
|
+
SlugWidget: l.string,
|
|
610
|
+
RichTextWidget: l.string,
|
|
611
|
+
DateWidget: l.date,
|
|
612
|
+
TimeWidget: l.string,
|
|
613
|
+
DateTimeWidget: l.date,
|
|
614
|
+
RadioWidget: l.string,
|
|
615
|
+
CheckboxWidget: l["array-string"],
|
|
616
|
+
ToggleCheckboxWidget: l.boolean,
|
|
617
|
+
SwitchWidget: l.boolean,
|
|
618
|
+
DropdownWidget: l.string,
|
|
619
|
+
MultiDropdownWidget: l["array-string"],
|
|
620
|
+
MultiTextWidget: l["array-string"],
|
|
621
|
+
FileUploadWidget: l.file,
|
|
622
|
+
MultiFileUploadWidget: l["array-file"],
|
|
623
|
+
MultiImageUploadWidget: l["array-file"],
|
|
624
|
+
ImageUploadWidget: l.file,
|
|
625
|
+
GeocoderWidget: l.location,
|
|
626
|
+
MultiGeocoderWidget: l["array-location"],
|
|
627
|
+
CollectionWidget: l.collection,
|
|
628
|
+
JSONWidget: l.json
|
|
629
|
+
}, J = {
|
|
831
630
|
beacon: "so.levo.beacon",
|
|
832
631
|
blog: "so.levo.blog",
|
|
833
632
|
event: "so.levo.event",
|
|
@@ -835,68 +634,95 @@ var LEVO_INTEGRATIONS = {
|
|
|
835
634
|
payment: "so.levo.payment",
|
|
836
635
|
community: "so.levo.community",
|
|
837
636
|
search_console: "com.google.search_console"
|
|
838
|
-
}
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
// src/constants/media.ts
|
|
842
|
-
var MediaKindList = ["image", "video", "audio", "document"];
|
|
843
|
-
var MediaKind = MediaKindList.reduce(
|
|
844
|
-
(acc, kind) => {
|
|
845
|
-
acc[kind] = kind;
|
|
846
|
-
return acc;
|
|
847
|
-
},
|
|
637
|
+
}, re = Object.values(J), G = ["image", "video", "audio", "document"], se = G.reduce(
|
|
638
|
+
(e, t) => (e[t] = t, e),
|
|
848
639
|
{}
|
|
849
|
-
)
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
640
|
+
), ie = (e) => e.reduce((t, s) => (t[s] = s, t), {}), V = (e) => e.reduce((t, s) => (t[s] = s, t), {}), H = [
|
|
641
|
+
// Bevy Events
|
|
642
|
+
"bevy.collection.filled",
|
|
643
|
+
"bevy.collection.submitted",
|
|
644
|
+
"bevy.collection.view",
|
|
645
|
+
// Block Events
|
|
646
|
+
"block.view",
|
|
647
|
+
// Blog Events
|
|
648
|
+
"blog.post.view",
|
|
649
|
+
// Event Events
|
|
650
|
+
"event.booking.confirmed",
|
|
651
|
+
"event.booking.initiated",
|
|
652
|
+
"event.booking.pending",
|
|
653
|
+
"event.coupon.applied",
|
|
654
|
+
"event.event.view",
|
|
655
|
+
// Form Events
|
|
656
|
+
"form.change",
|
|
657
|
+
"form.submit",
|
|
658
|
+
// Membership Events
|
|
659
|
+
"membership.account.signin",
|
|
660
|
+
"membership.account.signout",
|
|
661
|
+
"membership.account.signup",
|
|
662
|
+
// UI Events
|
|
663
|
+
"button.click",
|
|
664
|
+
"page.bounce",
|
|
665
|
+
"page.click",
|
|
666
|
+
"page.copy",
|
|
667
|
+
"page.impression",
|
|
668
|
+
"page.scroll",
|
|
669
|
+
"page.view",
|
|
670
|
+
"page.selection",
|
|
671
|
+
// User Activity Events
|
|
672
|
+
"user.active",
|
|
673
|
+
"user.idle"
|
|
674
|
+
], ae = V(H), ce = {
|
|
853
675
|
published: "published",
|
|
854
676
|
unpublished: "unpublished",
|
|
855
677
|
archived: "archived",
|
|
856
678
|
flagged: "flagged",
|
|
857
679
|
pending_moderation: "pending_moderation"
|
|
858
|
-
}
|
|
859
|
-
|
|
860
|
-
// src/types/forum/post.ts
|
|
861
|
-
var FORUM_POST_KIND = {
|
|
680
|
+
}, Q = {
|
|
862
681
|
post: "post",
|
|
863
682
|
poll: "poll",
|
|
864
683
|
gallery: "gallery",
|
|
865
684
|
link: "link"
|
|
866
|
-
}
|
|
867
|
-
var ForumPostKindExpandedList = Object.keys(FORUM_POST_KIND);
|
|
868
|
-
var FORUM_POST_STATUS = {
|
|
685
|
+
}, le = Object.keys(Q), de = {
|
|
869
686
|
draft: "draft",
|
|
870
687
|
published: "published",
|
|
871
688
|
unpublished: "unpublished",
|
|
872
689
|
archived: "archived",
|
|
873
690
|
flagged: "flagged",
|
|
874
691
|
pending_moderation: "pending_moderation"
|
|
875
|
-
}
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
const finalPart = parts[parts.length - 1];
|
|
881
|
-
if (finalPart) {
|
|
882
|
-
const encodedFinalPart = encodeURIComponent(finalPart);
|
|
883
|
-
return string.replace(finalPart, encodedFinalPart);
|
|
692
|
+
}, ue = (e) => {
|
|
693
|
+
const t = e.split("/"), s = t[t.length - 1];
|
|
694
|
+
if (s) {
|
|
695
|
+
const u = encodeURIComponent(s);
|
|
696
|
+
return e.replace(s, u);
|
|
884
697
|
}
|
|
885
698
|
return "";
|
|
886
699
|
};
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
700
|
+
export {
|
|
701
|
+
ae as AnalyticsEvents,
|
|
702
|
+
H as AnalyticsEventsList,
|
|
703
|
+
ce as COMMENT_STATUS,
|
|
704
|
+
ee as CommonFieldIntefaces,
|
|
705
|
+
D as CommonFieldInterfacesList,
|
|
706
|
+
B as ComplexFieldInterfacesList,
|
|
707
|
+
Q as FORUM_POST_KIND,
|
|
708
|
+
de as FORUM_POST_STATUS,
|
|
709
|
+
te as FieldInterfaces,
|
|
710
|
+
K as FieldInterfacesList,
|
|
711
|
+
l as FieldKind,
|
|
712
|
+
ne as FieldKindList,
|
|
713
|
+
le as ForumPostKindExpandedList,
|
|
714
|
+
J as LEVO_INTEGRATIONS,
|
|
715
|
+
re as LEVO_INTEGRATIONS_LIST,
|
|
716
|
+
v as LevoError,
|
|
717
|
+
$ as LevoOAuthProviderList,
|
|
718
|
+
se as MediaKind,
|
|
719
|
+
G as MediaKindList,
|
|
720
|
+
z as createLevoClient,
|
|
721
|
+
X as defaultByKinds,
|
|
722
|
+
ue as formatImagePath,
|
|
723
|
+
Y as formatsByInterface,
|
|
724
|
+
p as getLevoError,
|
|
725
|
+
oe as interfaceKinds,
|
|
726
|
+
ie as listToColumn,
|
|
727
|
+
V as listToRecord
|
|
900
728
|
};
|
|
901
|
-
|
|
902
|
-
export { COMMENT_STATUS, CommonFieldIntefaces, CommonFieldInterfacesList, ComplexFieldInterfacesList, FORUM_POST_KIND, FORUM_POST_STATUS, FieldInterfaces, FieldInterfacesList, FieldKind, FieldKindList, ForumPostKindExpandedList, LEVO_INTEGRATIONS, LEVO_INTEGRATIONS_LIST, LevoError, LevoOAuthProviderList, MediaKind, MediaKindList, createLevoClient, defaultByKinds, formatImagePath, formatsByInterface, getLevoError, interfaceKinds, listToColumn, listToRecord };
|