@levo-so/core 0.1.81 → 0.1.82

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 CHANGED
@@ -183,7 +183,7 @@ export declare const createLevoClient: (options: ILevoClientOptions) => {
183
183
  signUpWithPassword: <T = import("./types").ILevoMembership.Account>(data: import("./types").ILevoMembership.Request.SignUpWithPassword, options?: WretchOptions) => Promise<T>;
184
184
  };
185
185
  readonly collection: {
186
- getAllCollections: (data?: import("./types").LevoQuery.FindQuery<"name" | "workspace_id" | "created_at" | "id" | "description" | "updated_at" | "key" | "readonly" | "hidden" | "icon" | "on_submit" | "on_update" | "sections" | "views" | "title_field" | "email_field" | "mobile_field" | "settings" | "module_name" | "allow_draft">, options?: WretchOptions) => Promise<IResponseMultiple<ILemaCollection>>;
186
+ getAllCollections: (data?: import("./types").LevoQuery.FindQuery<"name" | "workspace_id" | "created_at" | "id" | "kind" | "description" | "updated_at" | "key" | "readonly" | "hidden" | "icon" | "on_submit" | "on_update" | "module_name" | "allow_public_submit" | "public_submit_set_by" | "sections" | "views" | "title_field" | "email_field" | "mobile_field" | "settings" | "allow_draft" | "allow_public_view" | "public_view_set_by" | "public_view_set_by_account" | "public_submit_set_by_account">, options?: WretchOptions) => Promise<IResponseMultiple<ILemaCollection>>;
187
187
  getCollectionByIDExpanded: <T = ILemaCollection>(id: string, options?: WretchOptions) => Promise<IResponseSingle<T>>;
188
188
  createCollection: (data: ILemaCollection) => Promise<IResponseSingle<ILemaCollection>>;
189
189
  saveCollectionData: ({ collection_id, data, options, }: {
@@ -285,6 +285,12 @@ export declare const ForumPostKindExpandedList: Array<keyof typeof FORUM_POST_KI
285
285
 
286
286
  export declare type ForumPostStatus = (typeof FORUM_POST_STATUS)[keyof typeof FORUM_POST_STATUS];
287
287
 
288
+ /**
289
+ * Derives the collection kind client-side when the API field is absent.
290
+ * Matches the server derivation exactly.
291
+ */
292
+ export declare const getCollectionKind: (collection: Pick<ILemaCollection, "module_name" | "allow_public_submit" | "public_submit_set_by">) => ICollectionKind;
293
+
288
294
  export declare const getLevoError: (error: any) => LevoError;
289
295
 
290
296
  export declare interface IAddress {
@@ -411,6 +417,9 @@ export declare interface IBooking {
411
417
  attendees?: IAttendee[];
412
418
  }
413
419
 
420
+ /** Structural kind of a collection object. Read-only, derived server-side. */
421
+ export declare type ICollectionKind = "collection" | "form" | "module";
422
+
414
423
  export declare interface ICollectionLayout {
415
424
  kind: ICollectionsView;
416
425
  options: ICollectionLayoutOptions;
@@ -431,6 +440,9 @@ export declare interface ICollectionLayoutOptions {
431
440
  infoFields?: string[];
432
441
  }
433
442
 
443
+ /** Access level for collection-level public visibility or submission. */
444
+ export declare type ICollectionPublicAccess = "public" | "members" | "own" | null;
445
+
434
446
  export declare interface ICollectionQuery {
435
447
  where: Record<string, any>;
436
448
  sort?: Record<string, any>;
@@ -678,7 +690,9 @@ export declare interface IForum {
678
690
  description: string;
679
691
  status: string;
680
692
  settings: IForumSettings;
693
+ listing_page_url?: string;
681
694
  created_at: string;
695
+ studio_config?: IModuleStudioConfig[];
682
696
  }
683
697
 
684
698
  export declare interface IForumCategory {
@@ -901,6 +915,31 @@ export declare interface ILemaCollection {
901
915
  updated_at?: Date | string;
902
916
  /** Whether the collection allows draft items. */
903
917
  allow_draft?: boolean;
918
+ /** Structural kind — read-only, derived server-side. Use getCollectionKind() if absent. */
919
+ kind?: ICollectionKind;
920
+ /** Collection-level public view access level. null = private/disabled. */
921
+ allow_public_view?: ICollectionPublicAccess;
922
+ /** Collection-level public submit access level. null = private/disabled. */
923
+ allow_public_submit?: ICollectionPublicAccess;
924
+ /** Account ID who manually set the public view flag. null = auto-set by system. */
925
+ public_view_set_by?: string | null;
926
+ /** Account ID who manually set the public submit flag. null = auto-set by system. */
927
+ public_submit_set_by?: string | null;
928
+ /** Expanded account details for who set public view. */
929
+ public_view_set_by_account?: ILemaCollectionAccount | null;
930
+ /** Expanded account details for who set public submit. */
931
+ public_submit_set_by_account?: ILemaCollectionAccount | null;
932
+ }
933
+
934
+ /** Account details embedded in collection responses for _set_by fields. */
935
+ export declare interface ILemaCollectionAccount {
936
+ id: string;
937
+ first_name: string;
938
+ last_name: string;
939
+ email: string;
940
+ profile_picture?: {
941
+ location: string;
942
+ } | null;
904
943
  }
905
944
 
906
945
  export declare type ILemaCollectionRelationship = "o2m" | "m2o" | "o2o" | "m2m";
@@ -915,6 +954,10 @@ export declare type ILemaField = Mandatory<Omit<IField, "fields" | "options">, "
915
954
  fields?: ILemaField[];
916
955
  /** Field options for configuring widget behavior. */
917
956
  options: ILemaFieldOptions;
957
+ /** Whether this field is visible publicly. */
958
+ allow_public_view?: boolean;
959
+ /** Whether this field accepts public submissions. */
960
+ allow_public_submit?: boolean;
918
961
  };
919
962
 
920
963
  /**
@@ -1364,6 +1407,7 @@ export declare interface INotificationData {
1364
1407
  cc_email?: string[];
1365
1408
  bcc_email?: string[];
1366
1409
  info: {
1410
+ title?: string;
1367
1411
  show_download_button?: boolean;
1368
1412
  hide_fields?: string[];
1369
1413
  body?: string;
@@ -1586,6 +1630,8 @@ export declare interface ISubscription {
1586
1630
  status: "active" | "cancelled" | "past_due" | "trialing" | "incomplete" | "trial_expired";
1587
1631
  plan_id?: string;
1588
1632
  price_id?: string;
1633
+ provider?: string;
1634
+ customer_id?: string;
1589
1635
  }
1590
1636
 
1591
1637
  /**
package/dist/index.js CHANGED
@@ -1,14 +1,14 @@
1
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) => {
2
+ import D from "wretch/addons/queryString";
3
+ import { WretchError as M } from "wretch/resolver";
4
+ const T = /^W[A-Z0-9]{7}$/, U = (e) => {
5
5
  const {
6
6
  appName: n,
7
7
  workspace: s = null,
8
8
  apiUrl: d = "https://public-api.levo.so",
9
9
  NODE_ENV: u = "",
10
10
  APP_MODE: i = "production"
11
- } = t;
11
+ } = e;
12
12
  if (s && !T.test(s))
13
13
  throw new Error(
14
14
  `Invalid workspace ID: ${s}. Workspace ID must be a string of the format "W[A-Z0-9]{7}".`
@@ -38,8 +38,8 @@ const T = /^W[A-Z0-9]{7}$/, _ = (t) => {
38
38
  return i;
39
39
  }
40
40
  };
41
- }, j = (t, n) => {
42
- const s = R(t.apiUrl).addon(M);
41
+ }, j = (e, n) => {
42
+ const s = R(e.apiUrl).addon(D);
43
43
  return {
44
44
  get instance() {
45
45
  const d = {
@@ -48,25 +48,25 @@ const T = /^W[A-Z0-9]{7}$/, _ = (t) => {
48
48
  // 30 seconds timeout,
49
49
  headers: {}
50
50
  };
51
- return t.workspace && (d.headers = {
51
+ return e.workspace && (d.headers = {
52
52
  ...d?.headers || {},
53
- "Levo-Workspace": t.workspace
53
+ "Levo-Workspace": e.workspace
54
54
  }), n && typeof n == "object" && Object.keys(n).length > 0 && (d.headers = {
55
55
  ...d?.headers || {},
56
56
  "Levo-Page-Context": encodeURIComponent(JSON.stringify(n))
57
- }), t.workspace ? s.options(d).query({ workspace: t.workspace }) : s.options(d);
57
+ }), e.workspace ? s.options(d).query({ workspace: e.workspace }) : s.options(d);
58
58
  },
59
59
  pageContext: n
60
60
  };
61
- }, x = (t = {}) => {
62
- const { logApiUrl: n = "https://public-api.levo.so" } = t, s = n, d = /* @__PURE__ */ new Map();
61
+ }, x = (e = {}) => {
62
+ const { logApiUrl: n = "https://public-api.levo.so" } = e, s = n, d = /* @__PURE__ */ new Map();
63
63
  let u = Promise.resolve(), i = setTimeout(() => {
64
64
  }, 0), l = /* @__PURE__ */ new Date();
65
65
  const p = (h) => {
66
66
  const a = JSON.stringify(h?.content ?? "{}"), o = h?.message ?? "";
67
67
  d.set(`${o}${a}`, h);
68
68
  }, y = async (h) => {
69
- const a = `${s}/v1/apm/logs/json`, o = () => R().url(a).post(h).res().catch((e) => console.error(e));
69
+ const a = `${s}/v1/apm/logs/json`, o = () => R().url(a).post(h).res().catch((t) => console.error(t));
70
70
  try {
71
71
  if (typeof fetch > "u")
72
72
  throw new Error("fetch is not defined");
@@ -79,8 +79,8 @@ const T = /^W[A-Z0-9]{7}$/, _ = (t) => {
79
79
  }
80
80
  else
81
81
  return o();
82
- } catch (e) {
83
- console.warn(`Failed to send logs to server: ${e}`), h.forEach((r) => p(r));
82
+ } catch (t) {
83
+ console.warn(`Failed to send logs to server: ${t}`), h.forEach((r) => p(r));
84
84
  }
85
85
  }, W = async () => {
86
86
  const h = Array.from(d.values());
@@ -105,8 +105,8 @@ const T = /^W[A-Z0-9]{7}$/, _ = (t) => {
105
105
  },
106
106
  flush: W
107
107
  };
108
- }, O = typeof window < "u", L = (t) => {
109
- switch (t) {
108
+ }, O = typeof window < "u", L = (e) => {
109
+ switch (e) {
110
110
  case 0:
111
111
  return "log";
112
112
  case 1:
@@ -118,29 +118,29 @@ const T = /^W[A-Z0-9]{7}$/, _ = (t) => {
118
118
  default:
119
119
  return "log";
120
120
  }
121
- }, N = (t, n = {}) => {
121
+ }, N = (e, n = {}) => {
122
122
  const {
123
- enableRemote: s = t.NODE_ENV !== "development",
124
- level: d = t.NODE_ENV !== "development" ? 2 : 0,
123
+ enableRemote: s = e.NODE_ENV !== "development",
124
+ level: d = e.NODE_ENV !== "development" ? 2 : 0,
125
125
  context: u = {},
126
126
  logApiUrl: i
127
127
  } = n, l = x({ logApiUrl: i }), p = (o) => {
128
- let e = "";
128
+ let t = "";
129
129
  const r = o.map((m) => {
130
130
  let f = "";
131
- const w = !e;
132
- return typeof m == "string" ? (f = m, w && (e = m)) : m instanceof Error ? (f = {
131
+ const w = !t;
132
+ return typeof m == "string" ? (f = m, w && (t = m)) : m instanceof Error ? (f = {
133
133
  message: m.message,
134
134
  name: m.name,
135
135
  stack: m.stack
136
- }, w && (e = m.message)) : typeof m == "object" ? f = m : (f = String(m), w && (e = String(m))), f;
136
+ }, w && (t = m.message)) : typeof m == "object" ? f = m : (f = String(m), w && (t = String(m))), f;
137
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,
138
+ return !t && r.length > 0 && (t = "Default message (Check content for details)"), r?.length === 1 && r[0] === t ? { message: t, content: {} } : {
139
+ message: t,
140
140
  content: r
141
141
  };
142
- }, y = (o, e) => {
143
- const r = Array.isArray(e) ? e : [e];
142
+ }, y = (o, t) => {
143
+ const r = Array.isArray(t) ? t : [t];
144
144
  if (o < d)
145
145
  return;
146
146
  if (s && o === 3) {
@@ -149,8 +149,8 @@ const T = /^W[A-Z0-9]{7}$/, _ = (t) => {
149
149
  const b = {
150
150
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
151
151
  level: "error",
152
- workspace: t.workspace,
153
- appName: t?.appName,
152
+ workspace: e.workspace,
153
+ appName: e?.appName,
154
154
  isBrowser: O,
155
155
  ...u,
156
156
  message: w,
@@ -199,43 +199,43 @@ class v extends Error {
199
199
  return !!this.errors?.length;
200
200
  }
201
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))
202
+ const A = (e) => e instanceof M || e instanceof Error && "response" in e && "status" in e && "url" in e, g = (e) => {
203
+ if (e instanceof v)
204
+ return e;
205
+ if (A(e)) {
206
+ let n = e?.json;
207
+ if (!n && (e?.text || e?.message))
208
208
  try {
209
- n = JSON.parse(t.text || t.message);
209
+ n = JSON.parse(e.text || e.message);
210
210
  } catch {
211
211
  }
212
212
  if (n) {
213
213
  const s = n;
214
214
  return new v({
215
- status: s?.content?.status || t?.status || 500,
215
+ status: s?.content?.status || e?.status || 500,
216
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}`,
217
+ title: s?.content?.title || `HTTP ${e?.status || 500} Error`,
218
+ description: s?.content?.description || s?.content?.errors?.[0]?.message || `Request failed with status ${e?.status || 500}`,
219
219
  type: s?.content?.type,
220
220
  errors: s?.content?.errors
221
221
  });
222
222
  }
223
223
  return new v({
224
- status: t?.status || 500,
224
+ status: e?.status || 500,
225
225
  code: "HTTP_ERROR",
226
- title: `HTTP ${t?.status || 500} Error`,
227
- description: `Request failed with status ${t?.status || 500}`
226
+ title: `HTTP ${e?.status || 500} Error`,
227
+ description: `Request failed with status ${e?.status || 500}`
228
228
  });
229
229
  }
230
- if (t instanceof TypeError) {
231
- if (t?.message.includes("Failed to fetch") || t?.message.includes("Network request failed") || t?.message.includes("fetch"))
230
+ if (e instanceof TypeError) {
231
+ if (e?.message.includes("Failed to fetch") || e?.message.includes("Network request failed") || e?.message.includes("fetch"))
232
232
  return new v({
233
233
  status: 0,
234
234
  code: "NETWORK_ERROR",
235
235
  title: "Network Error",
236
236
  description: "Unable to connect to the server. Please check your internet connection."
237
237
  });
238
- if (t?.message.includes("CORS") || t?.message.includes("cross-origin"))
238
+ if (e?.message.includes("CORS") || e?.message.includes("cross-origin"))
239
239
  return new v({
240
240
  status: 0,
241
241
  code: "CORS_ERROR",
@@ -243,23 +243,23 @@ const A = (t) => t instanceof U || t instanceof Error && "response" in t && "sta
243
243
  description: "Cross-origin request blocked. Please contact support."
244
244
  });
245
245
  }
246
- return t?.name === "AbortError" || t instanceof DOMException ? new v({
246
+ return e?.name === "AbortError" || e instanceof DOMException ? new v({
247
247
  status: 408,
248
248
  code: "REQUEST_TIMEOUT",
249
249
  title: "Request Timeout",
250
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",
251
+ }) : e?.request ? new v({
252
+ status: e?.response?.status || 500,
253
+ code: e?.code || "REQUEST_ERROR",
254
254
  title: "Request Error",
255
- description: t?.message || "An error occurred while making the request"
255
+ description: e?.message || "An error occurred while making the request"
256
256
  }) : new v({
257
257
  status: 500,
258
258
  code: "UNKNOWN_ERROR",
259
259
  title: "Unexpected Error",
260
- description: t?.message || "Something unexpected happened"
260
+ description: e?.message || "Something unexpected happened"
261
261
  });
262
- }, I = (t, n) => ({
262
+ }, I = (e, n) => ({
263
263
  getAllBlogs: async (u, i = {}, l) => n.instance.url(`/v1/blog/${u}/post/query`).query({ ...l?.params || {} }).options({
264
264
  headers: {
265
265
  "Levo-Workspace": l?.workspace_id || void 0
@@ -274,12 +274,12 @@ const A = (t) => t instanceof U || t instanceof Error && "response" in t && "sta
274
274
  }).get().json().then((p) => p).catch((p) => {
275
275
  throw g(p);
276
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);
277
+ }), S = (e, n) => ({
278
+ getAllCollections: async (a = {}, o = {}) => n.instance.url("/v1/bevy/collection/query").options(o).post(a).json().then((t) => t).catch((t) => {
279
+ throw g(t);
280
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);
281
+ getCollectionByIDExpanded: async (a, o = {}) => n.instance.url(`/v1/bevy/collection/${a}`).options(o).get().json().then((t) => t).catch((t) => {
282
+ throw g(t);
283
283
  }),
284
284
  createCollection: async (a) => n.instance.url("/v1/bevy/collection").post(a).json().then((o) => o).catch((o) => {
285
285
  throw g(o);
@@ -287,91 +287,91 @@ const A = (t) => t instanceof U || t instanceof Error && "response" in t && "sta
287
287
  saveCollectionData: async ({
288
288
  collection_id: a,
289
289
  data: o,
290
- options: e = {}
291
- }) => n.instance.url(`/v1/bevy/content/${a}`).options(e).post(o).json().then((r) => r).catch((r) => {
290
+ options: t = {}
291
+ }) => n.instance.url(`/v1/bevy/content/${a}`).options(t).post(o).json().then((r) => r).catch((r) => {
292
292
  throw g(r);
293
293
  }),
294
294
  getCollectionContentList: async ({
295
295
  collection_key: a,
296
296
  page: o,
297
- search: e,
297
+ search: t,
298
298
  limit: r = 10,
299
299
  where: m
300
300
  }) => n.instance.url(`/v1/bevy/content/${a}/query`).post({
301
301
  page: o,
302
302
  limit: r,
303
- search: e,
303
+ search: t,
304
304
  where: m
305
305
  }).json().then((f) => f).catch((f) => {
306
306
  throw g(f);
307
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);
308
+ saveDraftEntry: async (a, o) => n.instance.url(`/v1/bevy/content/${a}/save-entry`).post(o).json().then((t) => t).catch((t) => {
309
+ throw g(t);
310
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) => {
311
+ editDraftEntry: async (a, o, t) => n.instance.url(`/v1/bevy/content/${a}/${o}/edit-entry`).put(t).json().then((r) => r).catch((r) => {
312
312
  throw g(r);
313
313
  }),
314
314
  getDraftEntry: async (a) => n.instance.url(`/v1/bevy/content/${a}/list-entry`).get().json().then((o) => o).catch((o) => {
315
315
  throw g(o);
316
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);
317
+ submitDraftEntry: async (a, o) => n.instance.url(`/v1/bevy/content/${a}/submit-entry`).post(o).json().then((t) => t).catch((t) => {
318
+ throw g(t);
319
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);
320
+ getFilters: async (a, o = {}) => n.instance.url(`/v1/bevy/collection/${a}/get-filters`).options(o).get().json().then((t) => t).catch((t) => {
321
+ throw g(t);
322
322
  })
323
- }), P = (t, n) => ({
323
+ }), P = (e, n) => ({
324
324
  mediaBulkUpload: async (u, i = {}) => n.instance.url("/v1/assets/media/bulk").options(i).post(u).json().then((l) => l).catch((l) => {
325
325
  throw g(l);
326
326
  }),
327
327
  getAllMedia: async (u = {}) => n.instance.url("/v1/assets/media/query").post(u).json().then((i) => i).catch((i) => {
328
328
  throw g(i);
329
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);
330
+ }), F = ["google", "linkedin", "microsoft"], q = (e, n) => {
331
+ const s = async (o = {}) => n.instance.url("/v1/membership/auth/oauth/get-redirect-url").options(o).get().json().then((t) => {
332
+ const r = t?.content?.data, m = Object.keys(r);
333
333
  if (typeof window < "u")
334
334
  for (const f of m) {
335
335
  const w = r[f];
336
336
  if (w) {
337
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();
338
+ k.set("redirect_uri", window.location.href), e.workspace && k.set("workspace_id", e.workspace), n.pageContext && k.set("page_context", JSON.stringify(n.pageContext)), r[f] = b.toString();
339
339
  }
340
340
  }
341
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);
342
+ }).catch(() => F.reduce((t, r) => (t[r] = null, t), {})), d = async (o = {}) => n.instance.url("/v1/membership/auth/sign-out").options(o).post("").json().then((t) => t?.content?.data).catch((t) => {
343
+ throw g(t);
344
+ }), u = async (o = {}) => n.instance.url("/v1/membership/auth/get-me").options(o).get().json().then((t) => t?.content?.data).catch((t) => {
345
+ throw g(t);
346
346
  });
347
347
  return {
348
348
  getOAuthURL: s,
349
349
  signOut: d,
350
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) => {
351
+ updateMe: async (o, t = {}) => n.instance.url("/v1/membership/auth/update-me").options(t).put(o).json().then((r) => r?.content?.data).catch((r) => {
352
352
  throw g(r);
353
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) => {
354
+ createPassword: async (o, t = {}) => n.instance.url("/v1/membership/auth/change-password").options(t).put(o).json().then((r) => r?.content?.data).catch((r) => {
355
355
  throw g(r);
356
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) => {
357
+ isLoggedIn: async (o = {}) => u(o).then((t) => t).catch(() => null),
358
+ requestMagicLink: async (o, t = {}) => (typeof window < "u" && !o.redirect_uri && (o.redirect_uri = window.location.href), n.instance.url("/v1/membership/auth/request-magic-link").options(t).post(o).json().then((r) => r?.content?.data).catch((r) => {
359
359
  throw g(r);
360
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) => {
361
+ requestOtp: async (o, t = {}) => n.instance.url("/v1/membership/auth/request-otp").options(t).post(o).json().then((r) => r?.content?.data).catch((r) => {
362
362
  throw g(r);
363
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) => {
364
+ signInWithOtp: async (o, t = {}) => n.instance.url("/v1/membership/auth/signin-with-otp").options(t).post(o).json().then((r) => r?.content?.data).catch((r) => {
365
365
  throw g(r);
366
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) => {
367
+ signInWithPassword: async (o, t = {}) => n.instance.url("/v1/membership/auth/signin-with-password").options(t).post(o).json().then((r) => r?.content?.data).catch((r) => {
368
368
  throw g(r);
369
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) => {
370
+ signUpWithPassword: async (o, t = {}) => n.instance.url("/v1/membership/auth/signup-with-password").options(t).post(o).json().then((r) => r?.content?.data).catch((r) => {
371
371
  throw g(r);
372
372
  })
373
373
  };
374
- }, z = (t) => {
374
+ }, z = (e) => {
375
375
  const {
376
376
  pageContext: n = {
377
377
  url: typeof window < "u" ? window?.location?.href : "",
@@ -382,9 +382,9 @@ const A = (t) => t instanceof U || t instanceof Error && "response" in t && "sta
382
382
  logApiUrl: "https://public-api.levo.so"
383
383
  },
384
384
  ...d
385
- } = t;
385
+ } = e;
386
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);
387
+ const i = U(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
388
  return {
389
389
  get apiUrl() {
390
390
  return i.apiUrl;
@@ -419,11 +419,11 @@ const A = (t) => t instanceof U || t instanceof Error && "response" in t && "sta
419
419
  get pageContext() {
420
420
  return u;
421
421
  },
422
- updatePageContext: (e) => {
423
- u = Object.assign({}, u, e);
422
+ updatePageContext: (t) => {
423
+ u = Object.assign({}, u, t);
424
424
  },
425
- updateWorkspace: (e) => {
426
- i.workspace = e;
425
+ updateWorkspace: (t) => {
426
+ i.workspace = t;
427
427
  }
428
428
  };
429
429
  }, X = {
@@ -485,7 +485,7 @@ const A = (t) => t instanceof U || t instanceof Error && "response" in t && "sta
485
485
  MultiGeocoderWidget: [],
486
486
  JSONWidget: [],
487
487
  SlugWidget: []
488
- }, D = [
488
+ }, _ = [
489
489
  "TextWidget",
490
490
  "CurrencyWidget",
491
491
  "TextareaWidget",
@@ -517,13 +517,13 @@ const A = (t) => t instanceof U || t instanceof Error && "response" in t && "sta
517
517
  "JSONWidget",
518
518
  "SlugWidget"
519
519
  ], $ = [
520
- ...D,
520
+ ..._,
521
521
  ...C
522
- ], ee = D.reduce(
523
- (t, n) => (t[n] = n, t),
522
+ ], ee = _.reduce(
523
+ (e, n) => (e[n] = n, e),
524
524
  {}
525
525
  ), te = $.reduce(
526
- (t, n) => (t[n] = n, t),
526
+ (e, n) => (e[n] = n, e),
527
527
  {}
528
528
  ), ne = [
529
529
  "collection",
@@ -606,9 +606,9 @@ const A = (t) => t instanceof U || t instanceof Error && "response" in t && "sta
606
606
  community: "so.levo.community",
607
607
  search_console: "com.google.search_console"
608
608
  }, re = Object.values(B), K = ["image", "video", "audio", "document"], se = K.reduce(
609
- (t, n) => (t[n] = n, t),
609
+ (e, n) => (e[n] = n, e),
610
610
  {}
611
- ), ie = (t) => t.reduce((n, s) => (n[s] = s, n), {}), J = (t) => t.reduce((n, s) => (n[s] = s, n), {}), G = [
611
+ ), ie = (e) => e.reduce((n, s) => (n[s] = s, n), {}), J = (e) => e.reduce((n, s) => (n[s] = s, n), {}), G = [
612
612
  // Bevy Events
613
613
  "bevy.collection.filled",
614
614
  "bevy.collection.submitted",
@@ -642,7 +642,7 @@ const A = (t) => t instanceof U || t instanceof Error && "response" in t && "sta
642
642
  // User Activity Events
643
643
  "user.active",
644
644
  "user.idle"
645
- ], ae = J(G), ce = {
645
+ ], ae = J(G), ce = (e) => e.module_name ? "module" : e.allow_public_submit && !e.public_submit_set_by ? "form" : "collection", le = {
646
646
  published: "published",
647
647
  unpublished: "unpublished",
648
648
  archived: "archived",
@@ -653,35 +653,35 @@ const A = (t) => t instanceof U || t instanceof Error && "response" in t && "sta
653
653
  poll: "poll",
654
654
  gallery: "gallery",
655
655
  link: "link"
656
- }, le = Object.keys(V), de = {
656
+ }, de = Object.keys(V), ue = {
657
657
  draft: "draft",
658
658
  published: "published",
659
659
  unpublished: "unpublished",
660
660
  archived: "archived",
661
661
  flagged: "flagged",
662
662
  pending_moderation: "pending_moderation"
663
- }, ue = (t) => {
664
- const n = t.split("/"), s = n[n.length - 1];
663
+ }, ge = (e) => {
664
+ const n = e.split("/"), s = n[n.length - 1];
665
665
  if (s) {
666
666
  const d = encodeURIComponent(s);
667
- return t.replace(s, d);
667
+ return e.replace(s, d);
668
668
  }
669
669
  return "";
670
670
  };
671
671
  export {
672
672
  ae as AnalyticsEvents,
673
673
  G as AnalyticsEventsList,
674
- ce as COMMENT_STATUS,
674
+ le as COMMENT_STATUS,
675
675
  ee as CommonFieldIntefaces,
676
- D as CommonFieldInterfacesList,
676
+ _ as CommonFieldInterfacesList,
677
677
  C as ComplexFieldInterfacesList,
678
678
  V as FORUM_POST_KIND,
679
- de as FORUM_POST_STATUS,
679
+ ue as FORUM_POST_STATUS,
680
680
  te as FieldInterfaces,
681
681
  $ as FieldInterfacesList,
682
682
  c as FieldKind,
683
683
  ne as FieldKindList,
684
- le as ForumPostKindExpandedList,
684
+ de as ForumPostKindExpandedList,
685
685
  B as LEVO_INTEGRATIONS,
686
686
  re as LEVO_INTEGRATIONS_LIST,
687
687
  v as LevoError,
@@ -690,8 +690,9 @@ export {
690
690
  K as MediaKindList,
691
691
  z as createLevoClient,
692
692
  X as defaultByKinds,
693
- ue as formatImagePath,
693
+ ge as formatImagePath,
694
694
  Y as formatsByInterface,
695
+ ce as getCollectionKind,
695
696
  g as getLevoError,
696
697
  oe as interfaceKinds,
697
698
  ie as listToColumn,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@levo-so/core",
3
- "version": "0.1.81",
3
+ "version": "0.1.82",
4
4
  "author": "Levo Engineering <devs@theinternetfolks.com>",
5
5
  "description": "Levo common utilities",
6
6
  "type": "module",