@levo-so/core 0.1.79 → 0.1.80

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