@levo-so/core 0.1.65 → 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 +1986 -1789
- package/dist/index.js +452 -638
- package/package.json +5 -4
package/dist/index.js
CHANGED
|
@@ -1,284 +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: d = "https://public-api.levo.so",
|
|
7
|
+
NODE_ENV: u = "",
|
|
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 d;
|
|
42
31
|
},
|
|
43
32
|
get NODE_ENV() {
|
|
44
|
-
return
|
|
33
|
+
return u;
|
|
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, d, u) => {
|
|
44
|
+
let i;
|
|
45
|
+
if (typeof t == "string")
|
|
46
|
+
i = t;
|
|
47
|
+
else {
|
|
48
|
+
const g = u.polyfill("URLSearchParams", !0, !0);
|
|
49
|
+
for (const f in t) {
|
|
50
|
+
const w = t[f];
|
|
51
|
+
if (!(d && 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 d = {
|
|
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
|
-
options.headers = {
|
|
69
|
-
...options?.headers || {},
|
|
70
|
-
"Levo-Page-Context": encodeURIComponent(JSON.stringify(pageContext))
|
|
71
|
-
};
|
|
72
|
-
}
|
|
73
|
-
return wr.options(options);
|
|
78
|
+
return e.workspace && (d.headers = {
|
|
79
|
+
...d?.headers || {},
|
|
80
|
+
"Levo-Workspace": e.workspace
|
|
81
|
+
}), t && typeof t == "object" && Object.keys(t).length > 0 && (d.headers = {
|
|
82
|
+
...d?.headers || {},
|
|
83
|
+
"Levo-Page-Context": encodeURIComponent(JSON.stringify(t))
|
|
84
|
+
}), e.workspace ? s.options(d).query({ workspace: e.workspace }) : s.options(d);
|
|
74
85
|
},
|
|
75
|
-
pageContext
|
|
76
|
-
};
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
const
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
},
|
|
85
|
-
|
|
86
|
-
const addUniqueLog = (newLog) => {
|
|
87
|
-
const contentKey = JSON.stringify(newLog?.content ?? "{}");
|
|
88
|
-
const messageKey = newLog?.message ?? "";
|
|
89
|
-
_logs.set(`${messageKey}${contentKey}`, newLog);
|
|
90
|
-
};
|
|
91
|
-
const sendLogs = async (logs) => {
|
|
92
|
-
const url = `${_logApiUrl}/v1/apm/logs/json`;
|
|
93
|
-
const sendFallback = () => {
|
|
94
|
-
return wretch().url(url).post(logs).res().catch((e) => console.error(e));
|
|
95
|
-
};
|
|
86
|
+
pageContext: t
|
|
87
|
+
};
|
|
88
|
+
}, L = (e = {}) => {
|
|
89
|
+
const { logApiUrl: t = "https://public-api.levo.so" } = e, s = t, d = /* @__PURE__ */ new Map();
|
|
90
|
+
let u = 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
|
+
d.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));
|
|
96
97
|
try {
|
|
97
|
-
if (typeof fetch
|
|
98
|
+
if (typeof fetch > "u")
|
|
98
99
|
throw new Error("fetch is not defined");
|
|
99
|
-
|
|
100
|
+
if (typeof window < "u" && navigator.sendBeacon)
|
|
100
101
|
try {
|
|
101
|
-
if (!navigator.sendBeacon.bind(navigator)(
|
|
102
|
-
return
|
|
103
|
-
}
|
|
102
|
+
if (!navigator.sendBeacon.bind(navigator)(c, JSON.stringify(h)))
|
|
103
|
+
return o();
|
|
104
104
|
} catch {
|
|
105
|
-
return
|
|
105
|
+
return o();
|
|
106
106
|
}
|
|
107
|
-
|
|
108
|
-
return
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
console.warn(`Failed to send logs to server: ${e}`);
|
|
112
|
-
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));
|
|
113
111
|
}
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
clearTimeout(nextFlush);
|
|
119
|
-
await activeFlush;
|
|
120
|
-
if (tasks.length === 0) {
|
|
121
|
-
lastFlush = /* @__PURE__ */ new Date();
|
|
112
|
+
}, w = async () => {
|
|
113
|
+
const h = Array.from(d.values());
|
|
114
|
+
if (d.clear(), clearTimeout(i), await u, h.length === 0) {
|
|
115
|
+
a = /* @__PURE__ */ new Date();
|
|
122
116
|
return;
|
|
123
117
|
}
|
|
124
118
|
try {
|
|
125
|
-
await
|
|
126
|
-
} catch (
|
|
127
|
-
console.error("error sending logs",
|
|
119
|
+
await f(h);
|
|
120
|
+
} catch (c) {
|
|
121
|
+
console.error("error sending logs", c);
|
|
128
122
|
} finally {
|
|
129
|
-
|
|
130
|
-
}
|
|
131
|
-
};
|
|
132
|
-
const ingest = (log) => {
|
|
133
|
-
if (!logApiUrl) return;
|
|
134
|
-
const tasks = Array.isArray(log) ? log : [log];
|
|
135
|
-
tasks.forEach((task) => addUniqueLog(task));
|
|
136
|
-
if (_logs.size >= 50 || lastFlush.getTime() < Date.now() - 1500) {
|
|
137
|
-
clearTimeout(nextFlush);
|
|
138
|
-
activeFlush = flush();
|
|
139
|
-
} else {
|
|
140
|
-
clearTimeout(nextFlush);
|
|
141
|
-
nextFlush = setTimeout(() => {
|
|
142
|
-
activeFlush = flush();
|
|
143
|
-
}, 1500);
|
|
123
|
+
a = /* @__PURE__ */ new Date();
|
|
144
124
|
}
|
|
145
125
|
};
|
|
146
126
|
return {
|
|
147
|
-
ingest
|
|
148
|
-
|
|
127
|
+
ingest: (h) => {
|
|
128
|
+
if (!t) return;
|
|
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
|
+
}, 1500));
|
|
132
|
+
},
|
|
133
|
+
flush: w
|
|
149
134
|
};
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
var isBrowser = typeof window !== "undefined";
|
|
154
|
-
var getMethodName = (level) => {
|
|
155
|
-
switch (level) {
|
|
156
|
-
case 0 /* debug */:
|
|
135
|
+
}, R = typeof window < "u", S = (e) => {
|
|
136
|
+
switch (e) {
|
|
137
|
+
case 0:
|
|
157
138
|
return "log";
|
|
158
|
-
case 1
|
|
139
|
+
case 1:
|
|
159
140
|
return "info";
|
|
160
|
-
case 2
|
|
141
|
+
case 2:
|
|
161
142
|
return "warn";
|
|
162
|
-
case 3
|
|
143
|
+
case 3:
|
|
163
144
|
return "error";
|
|
164
145
|
default:
|
|
165
146
|
return "log";
|
|
166
147
|
}
|
|
167
|
-
}
|
|
168
|
-
var createLevoLogger = (core, options = {}) => {
|
|
148
|
+
}, N = (e, t = {}) => {
|
|
169
149
|
const {
|
|
170
|
-
enableRemote =
|
|
171
|
-
level:
|
|
172
|
-
context = {},
|
|
173
|
-
logApiUrl
|
|
174
|
-
} =
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
message = arg;
|
|
185
|
-
}
|
|
186
|
-
} else if (arg instanceof Error) {
|
|
187
|
-
payload = {
|
|
188
|
-
message: arg.message,
|
|
189
|
-
name: arg.name,
|
|
190
|
-
stack: arg.stack
|
|
191
|
-
};
|
|
192
|
-
if (isMessageEmpty) {
|
|
193
|
-
message = arg.message;
|
|
194
|
-
}
|
|
195
|
-
} else if (typeof arg === "object") {
|
|
196
|
-
payload = arg;
|
|
197
|
-
} else {
|
|
198
|
-
payload = String(arg);
|
|
199
|
-
if (isMessageEmpty) {
|
|
200
|
-
message = String(arg);
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
return payload;
|
|
150
|
+
enableRemote: s = e.NODE_ENV !== "development",
|
|
151
|
+
level: d = e.NODE_ENV !== "development" ? 2 : 0,
|
|
152
|
+
context: u = {},
|
|
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;
|
|
204
164
|
}).filter(Boolean);
|
|
205
|
-
|
|
206
|
-
message
|
|
207
|
-
|
|
208
|
-
if (formattedMessages?.length === 1 && formattedMessages[0] === message) {
|
|
209
|
-
return { message, content: {} };
|
|
210
|
-
}
|
|
211
|
-
return {
|
|
212
|
-
message,
|
|
213
|
-
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
|
|
214
168
|
};
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
if (level < logLevel) {
|
|
169
|
+
}, f = (o, n) => {
|
|
170
|
+
const r = Array.isArray(n) ? n : [n];
|
|
171
|
+
if (o < d)
|
|
219
172
|
return;
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
const log2 = {
|
|
173
|
+
if (s && o === 3) {
|
|
174
|
+
const { content: y = {}, message: b } = g(r);
|
|
175
|
+
if (b) {
|
|
176
|
+
const W = {
|
|
225
177
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
226
178
|
level: "error",
|
|
227
|
-
workspace:
|
|
228
|
-
appName:
|
|
229
|
-
isBrowser,
|
|
230
|
-
...
|
|
231
|
-
message,
|
|
232
|
-
content
|
|
179
|
+
workspace: e.workspace,
|
|
180
|
+
appName: e?.appName,
|
|
181
|
+
isBrowser: R,
|
|
182
|
+
...u,
|
|
183
|
+
message: b,
|
|
184
|
+
content: y
|
|
233
185
|
};
|
|
234
|
-
|
|
235
|
-
log2.hostname = window.location.hostname;
|
|
236
|
-
log2.pathname = window.location.pathname;
|
|
237
|
-
log2.url = window.location.href;
|
|
238
|
-
log2.page_title = window.document.title;
|
|
239
|
-
log2.userAgent = window.navigator.userAgent;
|
|
240
|
-
}
|
|
241
|
-
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);
|
|
242
187
|
}
|
|
243
188
|
}
|
|
244
|
-
const
|
|
245
|
-
console[
|
|
246
|
-
};
|
|
247
|
-
const debug = (...args) => {
|
|
248
|
-
log(0 /* debug */, args);
|
|
249
|
-
};
|
|
250
|
-
const info = (...args) => {
|
|
251
|
-
log(1 /* info */, args);
|
|
252
|
-
};
|
|
253
|
-
const warn = (...args) => {
|
|
254
|
-
log(2 /* warn */, args);
|
|
255
|
-
};
|
|
256
|
-
const error = (...args) => {
|
|
257
|
-
log(3 /* error */, args);
|
|
189
|
+
const m = S(o);
|
|
190
|
+
console[m](...r);
|
|
258
191
|
};
|
|
259
192
|
return {
|
|
260
|
-
debug
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
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
|
+
}
|
|
264
205
|
};
|
|
265
206
|
};
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
207
|
+
class A extends Error {
|
|
208
|
+
}
|
|
209
|
+
class v extends Error {
|
|
269
210
|
code;
|
|
270
211
|
title;
|
|
271
212
|
status;
|
|
272
213
|
type;
|
|
273
214
|
errors;
|
|
274
|
-
constructor(
|
|
275
|
-
super(
|
|
276
|
-
this.name = "Levo Request Error";
|
|
277
|
-
this.status = data.status;
|
|
278
|
-
this.code = data.code;
|
|
279
|
-
this.title = data.title;
|
|
280
|
-
this.type = data.type;
|
|
281
|
-
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;
|
|
282
217
|
}
|
|
283
218
|
/**
|
|
284
219
|
* Get validation errors for form fields
|
|
@@ -290,365 +225,241 @@ var LevoError = class extends Error {
|
|
|
290
225
|
* Check if this is a validation error with field-specific errors
|
|
291
226
|
*/
|
|
292
227
|
get hasFieldErrors() {
|
|
293
|
-
return
|
|
294
|
-
}
|
|
295
|
-
};
|
|
296
|
-
|
|
297
|
-
// src/utils/getLevoError.ts
|
|
298
|
-
var getLevoError = (error) => {
|
|
299
|
-
if (error instanceof LevoError) {
|
|
300
|
-
return error;
|
|
228
|
+
return !!this.errors?.length;
|
|
301
229
|
}
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
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}`
|
|
311
257
|
});
|
|
312
258
|
}
|
|
313
|
-
if (
|
|
314
|
-
if (
|
|
315
|
-
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({
|
|
316
262
|
status: 0,
|
|
317
263
|
code: "NETWORK_ERROR",
|
|
318
264
|
title: "Network Error",
|
|
319
265
|
description: "Unable to connect to the server. Please check your internet connection."
|
|
320
266
|
});
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
return new LevoError({
|
|
267
|
+
if (e?.message.includes("CORS") || e?.message.includes("cross-origin"))
|
|
268
|
+
return new v({
|
|
324
269
|
status: 0,
|
|
325
270
|
code: "CORS_ERROR",
|
|
326
271
|
title: "CORS Error",
|
|
327
272
|
description: "Cross-origin request blocked. Please contact support."
|
|
328
273
|
});
|
|
329
|
-
}
|
|
330
|
-
}
|
|
331
|
-
if (error?.name === "AbortError" || error instanceof DOMException) {
|
|
332
|
-
return new LevoError({
|
|
333
|
-
status: 408,
|
|
334
|
-
code: "REQUEST_TIMEOUT",
|
|
335
|
-
title: "Request Timeout",
|
|
336
|
-
description: "The request was cancelled or timed out. Please try again."
|
|
337
|
-
});
|
|
338
|
-
}
|
|
339
|
-
if (error?.request) {
|
|
340
|
-
return new LevoError({
|
|
341
|
-
status: error?.response?.status || 500,
|
|
342
|
-
code: error?.code || "REQUEST_ERROR",
|
|
343
|
-
title: "Request Error",
|
|
344
|
-
description: error?.message || "An error occurred while making the request"
|
|
345
|
-
});
|
|
346
274
|
}
|
|
347
|
-
return new
|
|
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({
|
|
348
286
|
status: 500,
|
|
349
287
|
code: "UNKNOWN_ERROR",
|
|
350
288
|
title: "Unexpected Error",
|
|
351
|
-
description:
|
|
289
|
+
description: e?.message || "Something unexpected happened"
|
|
352
290
|
});
|
|
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
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
}
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
throw getLevoError(error);
|
|
431
|
-
});
|
|
432
|
-
};
|
|
433
|
-
const getDraftEntry = async (collection_key) => {
|
|
434
|
-
return httpsClient.instance.url(`/v1/bevy/content/${collection_key}/list-entry`).get().json().then((response) => response).catch((error) => {
|
|
435
|
-
throw getLevoError(error);
|
|
436
|
-
});
|
|
437
|
-
};
|
|
438
|
-
const getFilters = async (collectionId, options = {}) => {
|
|
439
|
-
return httpsClient.instance.url(`/v1/bevy/collection/${collectionId}/get-filters`).options(options).get().json().then((response) => response).catch((error) => {
|
|
440
|
-
throw getLevoError(error);
|
|
441
|
-
});
|
|
442
|
-
};
|
|
443
|
-
const submitDraftEntry = async (collection_key, data) => {
|
|
444
|
-
return httpsClient.instance.url(`/v1/bevy/content/${collection_key}/submit-entry`).post(data).json().then((response) => response).catch((error) => {
|
|
445
|
-
throw getLevoError(error);
|
|
446
|
-
});
|
|
447
|
-
};
|
|
448
|
-
return {
|
|
449
|
-
getAllCollections,
|
|
450
|
-
getCollectionByIDExpanded,
|
|
451
|
-
createCollection,
|
|
452
|
-
saveCollectionData,
|
|
453
|
-
getCollectionContentList,
|
|
454
|
-
saveDraftEntry,
|
|
455
|
-
editDraftEntry,
|
|
456
|
-
getDraftEntry,
|
|
457
|
-
submitDraftEntry,
|
|
458
|
-
getFilters
|
|
459
|
-
};
|
|
460
|
-
};
|
|
461
|
-
|
|
462
|
-
// src/modules/media.ts
|
|
463
|
-
var createLevoMediaModule = (core, httpsClient) => {
|
|
464
|
-
const mediaBulkUpload = async (formData, options = {}) => {
|
|
465
|
-
return httpsClient.instance.url("/v1/assets/media/bulk").options(options).post(formData).json().then((response) => response).catch((error) => {
|
|
466
|
-
throw getLevoError(error);
|
|
467
|
-
});
|
|
468
|
-
};
|
|
469
|
-
const getAllMedia = async (data = {}) => {
|
|
470
|
-
return httpsClient.instance.url("/v1/assets/media/query").post(data).json().then((response) => response).catch((error) => {
|
|
471
|
-
throw getLevoError(error);
|
|
472
|
-
});
|
|
473
|
-
};
|
|
474
|
-
return {
|
|
475
|
-
mediaBulkUpload,
|
|
476
|
-
getAllMedia
|
|
477
|
-
};
|
|
478
|
-
};
|
|
479
|
-
|
|
480
|
-
// src/constants/oauthProvider.ts
|
|
481
|
-
var LevoOAuthProviderList = ["google", "linkedin", "microsoft"];
|
|
482
|
-
|
|
483
|
-
// src/modules/membership.ts
|
|
484
|
-
var createLevoMembershipModule = (core, httpsClient) => {
|
|
485
|
-
const getOAuthURL = async (options = {}) => {
|
|
486
|
-
return httpsClient.instance.url("/v1/membership/auth/oauth/get-redirect-url").options(options).get().json().then((response) => {
|
|
487
|
-
const result = response?.content?.data;
|
|
488
|
-
const providers = Object.keys(result);
|
|
489
|
-
if (typeof window !== "undefined") {
|
|
490
|
-
for (const provider of providers) {
|
|
491
|
-
const raw_url = result[provider];
|
|
492
|
-
if (raw_url) {
|
|
493
|
-
const url = new URL(raw_url);
|
|
494
|
-
const url_params = url.searchParams;
|
|
495
|
-
url_params.set("redirect_uri", window.location.href);
|
|
496
|
-
if (core.workspace) {
|
|
497
|
-
url_params.set("workspace_id", core.workspace);
|
|
498
|
-
}
|
|
499
|
-
if (httpsClient.pageContext) {
|
|
500
|
-
url_params.set("page_context", JSON.stringify(httpsClient.pageContext));
|
|
501
|
-
}
|
|
502
|
-
result[provider] = url.toString();
|
|
503
|
-
}
|
|
291
|
+
}, P = (e, t) => ({
|
|
292
|
+
getAllBlogs: async (u, i = {}, a) => t.instance.url(`/v1/blog/${u}/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 (u, i, a) => t.instance.url(`/v1/blog/${u}/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
|
+
}), 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
|
+
throw p(a);
|
|
355
|
+
}),
|
|
356
|
+
getAllMedia: async (u = {}) => t.instance.url("/v1/assets/media/query").post(u).json().then((i) => i).catch((i) => {
|
|
357
|
+
throw p(i);
|
|
358
|
+
})
|
|
359
|
+
}), C = ["google", "linkedin", "microsoft"], $ = (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();
|
|
504
368
|
}
|
|
505
369
|
}
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
});
|
|
513
|
-
};
|
|
514
|
-
const signOut = async (options = {}) => {
|
|
515
|
-
return httpsClient.instance.url("/v1/membership/auth/sign-out").options(options).post("").json().then((response) => response?.content?.data).catch((error) => {
|
|
516
|
-
throw getLevoError(error);
|
|
517
|
-
});
|
|
518
|
-
};
|
|
519
|
-
const getMe = async (options = {}) => {
|
|
520
|
-
return httpsClient.instance.url("/v1/membership/auth/get-me").options(options).get().json().then((response) => response?.content?.data).catch((error) => {
|
|
521
|
-
throw getLevoError(error);
|
|
522
|
-
});
|
|
523
|
-
};
|
|
524
|
-
const updateMe = async (data, options = {}) => {
|
|
525
|
-
return httpsClient.instance.url("/v1/membership/auth/update-me").options(options).put(data).json().then((response) => response?.content?.data).catch((error) => {
|
|
526
|
-
throw getLevoError(error);
|
|
527
|
-
});
|
|
528
|
-
};
|
|
529
|
-
const createPassword = async (data, options = {}) => {
|
|
530
|
-
return httpsClient.instance.url("/v1/membership/auth/change-password").options(options).put(data).json().then((response) => response?.content?.data).catch((error) => {
|
|
531
|
-
throw getLevoError(error);
|
|
532
|
-
});
|
|
533
|
-
};
|
|
534
|
-
const isLoggedIn = async (options = {}) => {
|
|
535
|
-
return getMe(options).then((account) => account).catch(() => null);
|
|
536
|
-
};
|
|
537
|
-
const requestMagicLink = async (data, options = {}) => {
|
|
538
|
-
if (typeof window !== "undefined" && !data.redirect_uri) {
|
|
539
|
-
data.redirect_uri = window.location.href;
|
|
540
|
-
}
|
|
541
|
-
return httpsClient.instance.url("/v1/membership/auth/request-magic-link").options(options).post(data).json().then((response) => response?.content?.data).catch((error) => {
|
|
542
|
-
throw getLevoError(error);
|
|
543
|
-
});
|
|
544
|
-
};
|
|
545
|
-
const requestOtp = async (data, options = {}) => {
|
|
546
|
-
return httpsClient.instance.url("/v1/membership/auth/request-otp").options(options).post(data).json().then((response) => response?.content?.data).catch((error) => {
|
|
547
|
-
throw getLevoError(error);
|
|
548
|
-
});
|
|
549
|
-
};
|
|
550
|
-
const signInWithOtp = async (data, options = {}) => {
|
|
551
|
-
return httpsClient.instance.url("/v1/membership/auth/signin-with-otp").options(options).post(data).json().then((response) => response?.content?.data).catch((error) => {
|
|
552
|
-
throw getLevoError(error);
|
|
553
|
-
});
|
|
554
|
-
};
|
|
555
|
-
const signInWithPassword = async (data, options = {}) => {
|
|
556
|
-
return httpsClient.instance.url("/v1/membership/auth/signin-with-password").options(options).post(data).json().then((response) => response?.content?.data).catch((error) => {
|
|
557
|
-
throw getLevoError(error);
|
|
558
|
-
});
|
|
559
|
-
};
|
|
560
|
-
const signUpWithPassword = async (data, options = {}) => {
|
|
561
|
-
return httpsClient.instance.url("/v1/membership/auth/signup-with-password").options(options).post(data).json().then((response) => response?.content?.data).catch((error) => {
|
|
562
|
-
throw getLevoError(error);
|
|
563
|
-
});
|
|
564
|
-
};
|
|
370
|
+
return r;
|
|
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
|
+
throw p(n);
|
|
373
|
+
}), u = 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
|
+
});
|
|
565
376
|
return {
|
|
566
|
-
getOAuthURL,
|
|
567
|
-
signOut,
|
|
568
|
-
getMe,
|
|
569
|
-
updateMe,
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
}
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
377
|
+
getOAuthURL: s,
|
|
378
|
+
signOut: d,
|
|
379
|
+
getMe: u,
|
|
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 = {}) => u(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) => {
|
|
582
404
|
const {
|
|
583
|
-
pageContext = {
|
|
584
|
-
url: typeof window
|
|
585
|
-
referrer: typeof document
|
|
586
|
-
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 : ""
|
|
587
409
|
},
|
|
588
|
-
loggerOptions = {
|
|
410
|
+
loggerOptions: s = {
|
|
589
411
|
logApiUrl: "https://public-api.levo.so"
|
|
590
412
|
},
|
|
591
|
-
...
|
|
592
|
-
} =
|
|
593
|
-
let
|
|
594
|
-
const
|
|
595
|
-
const httpsClient = createHttpClient(core, _pageContext);
|
|
596
|
-
const blog = createLevoBlogModule(core, httpsClient);
|
|
597
|
-
const membership = createLevoMembershipModule(core, httpsClient);
|
|
598
|
-
const collection = createLevoCollectionModule(core, httpsClient);
|
|
599
|
-
const media = createLevoMediaModule(core, httpsClient);
|
|
600
|
-
const logger = createLevoLogger(core, loggerOptions);
|
|
601
|
-
const updatePageContext = (newContext) => {
|
|
602
|
-
_pageContext = Object.assign({}, _pageContext, newContext);
|
|
603
|
-
};
|
|
604
|
-
const updateWorkspace = (workspace) => {
|
|
605
|
-
core.workspace = workspace;
|
|
606
|
-
};
|
|
413
|
+
...d
|
|
414
|
+
} = e;
|
|
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);
|
|
607
417
|
return {
|
|
608
418
|
get apiUrl() {
|
|
609
|
-
return
|
|
419
|
+
return i.apiUrl;
|
|
610
420
|
},
|
|
611
421
|
get workspace() {
|
|
612
|
-
return
|
|
422
|
+
return i.workspace;
|
|
613
423
|
},
|
|
614
424
|
get blog() {
|
|
615
|
-
return
|
|
425
|
+
return g;
|
|
616
426
|
},
|
|
617
427
|
get membership() {
|
|
618
|
-
return
|
|
428
|
+
return f;
|
|
619
429
|
},
|
|
620
430
|
get collection() {
|
|
621
|
-
return
|
|
431
|
+
return w;
|
|
622
432
|
},
|
|
623
433
|
get media() {
|
|
624
|
-
return
|
|
434
|
+
return E;
|
|
625
435
|
},
|
|
626
436
|
get logger() {
|
|
627
|
-
return
|
|
437
|
+
return h;
|
|
628
438
|
},
|
|
629
439
|
get fetch() {
|
|
630
|
-
return
|
|
440
|
+
return a.instance;
|
|
631
441
|
},
|
|
632
442
|
get APP_MODE() {
|
|
633
|
-
return
|
|
443
|
+
return i.APP_MODE;
|
|
634
444
|
},
|
|
635
445
|
get NODE_ENV() {
|
|
636
|
-
return
|
|
446
|
+
return i.NODE_ENV;
|
|
637
447
|
},
|
|
638
448
|
get pageContext() {
|
|
639
|
-
return
|
|
449
|
+
return u;
|
|
450
|
+
},
|
|
451
|
+
updatePageContext: (n) => {
|
|
452
|
+
u = Object.assign({}, u, n);
|
|
640
453
|
},
|
|
641
|
-
|
|
642
|
-
|
|
454
|
+
updateWorkspace: (n) => {
|
|
455
|
+
i.workspace = n;
|
|
456
|
+
}
|
|
643
457
|
};
|
|
644
|
-
}
|
|
645
|
-
|
|
646
|
-
// src/constants/collection/defaultByKind.ts
|
|
647
|
-
var defaultByKinds = {
|
|
458
|
+
}, X = {
|
|
648
459
|
"public-id": "",
|
|
649
460
|
string: "",
|
|
650
461
|
number: null,
|
|
651
|
-
boolean:
|
|
462
|
+
boolean: !1,
|
|
652
463
|
location: null,
|
|
653
464
|
file: null,
|
|
654
465
|
date: null,
|
|
@@ -673,10 +484,7 @@ var defaultByKinds = {
|
|
|
673
484
|
"array-date": [],
|
|
674
485
|
"array-boolean": [],
|
|
675
486
|
"array-location": []
|
|
676
|
-
}
|
|
677
|
-
|
|
678
|
-
// src/constants/collection/fieldInterfaceFormat.ts
|
|
679
|
-
var formatsByInterface = {
|
|
487
|
+
}, Y = {
|
|
680
488
|
ArrayWidget: [],
|
|
681
489
|
RecordWidget: [],
|
|
682
490
|
TextWidget: [],
|
|
@@ -706,10 +514,7 @@ var formatsByInterface = {
|
|
|
706
514
|
MultiGeocoderWidget: [],
|
|
707
515
|
JSONWidget: [],
|
|
708
516
|
SlugWidget: []
|
|
709
|
-
}
|
|
710
|
-
|
|
711
|
-
// src/constants/collection/fieldInterfaces.ts
|
|
712
|
-
var CommonFieldInterfacesList = [
|
|
517
|
+
}, D = [
|
|
713
518
|
"TextWidget",
|
|
714
519
|
"CurrencyWidget",
|
|
715
520
|
"TextareaWidget",
|
|
@@ -734,35 +539,22 @@ var CommonFieldInterfacesList = [
|
|
|
734
539
|
"MultiFileUploadWidget",
|
|
735
540
|
"MultiDropdownWidget",
|
|
736
541
|
"MultiTextWidget"
|
|
737
|
-
]
|
|
738
|
-
var ComplexFieldInterfacesList = [
|
|
542
|
+
], B = [
|
|
739
543
|
"CollectionWidget",
|
|
740
544
|
"ArrayWidget",
|
|
741
545
|
"RecordWidget",
|
|
742
546
|
"JSONWidget",
|
|
743
547
|
"SlugWidget"
|
|
744
|
-
]
|
|
745
|
-
|
|
746
|
-
...
|
|
747
|
-
|
|
748
|
-
]
|
|
749
|
-
var CommonFieldIntefaces = CommonFieldInterfacesList.reduce(
|
|
750
|
-
(acc, curr) => {
|
|
751
|
-
acc[curr] = curr;
|
|
752
|
-
return acc;
|
|
753
|
-
},
|
|
548
|
+
], K = [
|
|
549
|
+
...D,
|
|
550
|
+
...B
|
|
551
|
+
], ee = D.reduce(
|
|
552
|
+
(e, t) => (e[t] = t, e),
|
|
754
553
|
{}
|
|
755
|
-
)
|
|
756
|
-
|
|
757
|
-
(acc, curr) => {
|
|
758
|
-
acc[curr] = curr;
|
|
759
|
-
return acc;
|
|
760
|
-
},
|
|
554
|
+
), te = K.reduce(
|
|
555
|
+
(e, t) => (e[t] = t, e),
|
|
761
556
|
{}
|
|
762
|
-
)
|
|
763
|
-
|
|
764
|
-
// src/constants/collection/fieldKind.ts
|
|
765
|
-
var FieldKindList = [
|
|
557
|
+
), ne = [
|
|
766
558
|
"collection",
|
|
767
559
|
"record",
|
|
768
560
|
"group",
|
|
@@ -783,8 +575,7 @@ var FieldKindList = [
|
|
|
783
575
|
"array-location",
|
|
784
576
|
"richtext",
|
|
785
577
|
"identifier"
|
|
786
|
-
]
|
|
787
|
-
var FieldKind = {
|
|
578
|
+
], l = {
|
|
788
579
|
identifier: "identifier",
|
|
789
580
|
collection: "collection",
|
|
790
581
|
"public-id": "public-id",
|
|
@@ -805,41 +596,37 @@ var FieldKind = {
|
|
|
805
596
|
"array-location": "array-location",
|
|
806
597
|
richtext: "richtext",
|
|
807
598
|
"array-json": "array-json"
|
|
808
|
-
}
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
};
|
|
840
|
-
|
|
841
|
-
// src/constants/integration.ts
|
|
842
|
-
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 = {
|
|
843
630
|
beacon: "so.levo.beacon",
|
|
844
631
|
blog: "so.levo.blog",
|
|
845
632
|
event: "so.levo.event",
|
|
@@ -847,68 +634,95 @@ var LEVO_INTEGRATIONS = {
|
|
|
847
634
|
payment: "so.levo.payment",
|
|
848
635
|
community: "so.levo.community",
|
|
849
636
|
search_console: "com.google.search_console"
|
|
850
|
-
}
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
// src/constants/media.ts
|
|
854
|
-
var MediaKindList = ["image", "video", "audio", "document"];
|
|
855
|
-
var MediaKind = MediaKindList.reduce(
|
|
856
|
-
(acc, kind) => {
|
|
857
|
-
acc[kind] = kind;
|
|
858
|
-
return acc;
|
|
859
|
-
},
|
|
637
|
+
}, re = Object.values(J), G = ["image", "video", "audio", "document"], se = G.reduce(
|
|
638
|
+
(e, t) => (e[t] = t, e),
|
|
860
639
|
{}
|
|
861
|
-
)
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
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 = {
|
|
865
675
|
published: "published",
|
|
866
676
|
unpublished: "unpublished",
|
|
867
677
|
archived: "archived",
|
|
868
678
|
flagged: "flagged",
|
|
869
679
|
pending_moderation: "pending_moderation"
|
|
870
|
-
}
|
|
871
|
-
|
|
872
|
-
// src/types/forum/post.ts
|
|
873
|
-
var FORUM_POST_KIND = {
|
|
680
|
+
}, Q = {
|
|
874
681
|
post: "post",
|
|
875
682
|
poll: "poll",
|
|
876
683
|
gallery: "gallery",
|
|
877
684
|
link: "link"
|
|
878
|
-
}
|
|
879
|
-
var ForumPostKindExpandedList = Object.keys(FORUM_POST_KIND);
|
|
880
|
-
var FORUM_POST_STATUS = {
|
|
685
|
+
}, le = Object.keys(Q), de = {
|
|
881
686
|
draft: "draft",
|
|
882
687
|
published: "published",
|
|
883
688
|
unpublished: "unpublished",
|
|
884
689
|
archived: "archived",
|
|
885
690
|
flagged: "flagged",
|
|
886
691
|
pending_moderation: "pending_moderation"
|
|
887
|
-
}
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
const finalPart = parts[parts.length - 1];
|
|
893
|
-
if (finalPart) {
|
|
894
|
-
const encodedFinalPart = encodeURIComponent(finalPart);
|
|
895
|
-
return string.replace(finalPart, encodedFinalPart);
|
|
692
|
+
}, ue = (e) => {
|
|
693
|
+
const t = e.split("/"), s = t[t.length - 1];
|
|
694
|
+
if (s) {
|
|
695
|
+
const d = encodeURIComponent(s);
|
|
696
|
+
return e.replace(s, d);
|
|
896
697
|
}
|
|
897
698
|
return "";
|
|
898
699
|
};
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
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
|
+
C 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
|
|
912
728
|
};
|
|
913
|
-
|
|
914
|
-
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 };
|