@levo-so/studio 0.1.108 → 0.1.109

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.
Files changed (43) hide show
  1. package/{BillingStep-CJqmdIz2.js → BillingStep-DZeqbtfs.js} +1 -1
  2. package/{Button-DujHjtOV.js → Button-BMUB23Y7.js} +527 -91
  3. package/CollectionField-xa-jed3_.js +232 -0
  4. package/{DateTimeWidget-CbpvxQ9s.js → DateTimeWidget-DWbn_kXp.js} +4 -3
  5. package/{EntryCard-Drnobf4s.js → EntryCard-BNZ-0_Kv.js} +7 -4
  6. package/{LoginCard-B9HKjZEk.js → LoginCard-B1XlZfEU.js} +3 -3
  7. package/{LoginForm-DpgxFh89.js → LoginForm-NmDPe72V.js} +17 -17
  8. package/{LoginModal-CaqsScly.js → LoginModal-CVd08mNx.js} +2 -2
  9. package/{MessageCard-DojQRKnf.js → MessageCard-C2fU_Bo_.js} +2 -2
  10. package/{ModalManager-CaBZKQR2.js → ModalManager-Dqq7D60M.js} +1 -1
  11. package/{PendingApprovalCard-CrdOrMRu.js → PendingApprovalCard-CXOEpAbg.js} +3 -3
  12. package/{PhoneWidget-BxW2gL28.js → PhoneWidget-CtNIit2w.js} +4 -3
  13. package/{PopupRenderer-CV5HY1dP-hICGc5AG.js → PopupRenderer-SSn97BLs-DQfvcymq.js} +256 -260
  14. package/ProfileCard-CzL5uB2z.js +102 -0
  15. package/{RichTextWidget-DCzgJ9EA.js → RichTextWidget-DkRrKQqN.js} +4 -3
  16. package/{Toolbar-B5UZer_x.js → Toolbar-C3WDkSnO.js} +4 -4
  17. package/{VerifyButton-DFAg6STD.js → VerifyButton-TNkt-SDu.js} +1 -1
  18. package/{bookingCard-BgApvrcj.js → bookingCard-61Yx6JO-.js} +2 -2
  19. package/collection.d.ts +14 -6
  20. package/collection.js +8 -7
  21. package/dist-Cfv-YjpI.js +3469 -0
  22. package/getFieldValidations-CSkSV2hW.js +90 -0
  23. package/index.d.ts +235 -16
  24. package/index.js +1743 -1405
  25. package/{nodeAlignment-DKCIjzlR.js → nodeAlignment-BC_Uferw.js} +5 -5
  26. package/package.json +4 -4
  27. package/studio.css +1 -1
  28. package/{utils-CUqS5dMC.js → utils-BJLmuC5w.js} +1 -1
  29. package/widgets-K6ECnoJJ.js +335 -0
  30. package/CollectionField-BPl8E9MW.js +0 -318
  31. package/CollectionFormBuilder-BvFtiZeH.js +0 -3668
  32. package/dist-DZbXWctg.js +0 -97
  33. /package/{Beams-DboMUgCv.js → Beams-WJN38XSv.js} +0 -0
  34. /package/{CollectionInput-DcNJT5Pg.js → CollectionInput-CpNGIXJx.js} +0 -0
  35. /package/{Dots-a8xSboDv.js → Dots-DggLz5I7.js} +0 -0
  36. /package/{Gradient-NacpoDCM.js → Gradient-BSWJAu0a.js} +0 -0
  37. /package/{Grid-BJQvxnks.js → Grid-BFKl0MUt.js} +0 -0
  38. /package/{MessageFooter-C4qC8cem.js → MessageFooter-4qIEK91O.js} +0 -0
  39. /package/{Popover-DOvRAGzc.js → Popover-O1poOHk2.js} +0 -0
  40. /package/{Tooltip-CJINDx93.js → Tooltip-NEMQqPyr.js} +0 -0
  41. /package/{Waves-DUuT_IFr.js → Waves-BPEgTYoO.js} +0 -0
  42. /package/{authentication-ClOFcry8.js → authentication-hnV1BI8s.js} +0 -0
  43. /package/{card-E2LKF9nT.js → card-5ooLmYSr.js} +0 -0
@@ -0,0 +1,102 @@
1
+ "use client";
2
+ import { c as e } from "./dist-Cfv-YjpI.js";
3
+ import { n as t } from "./AuthProvider-C6bvedwF.js";
4
+ import { t as n } from "./card-5ooLmYSr.js";
5
+ import { t as r } from "./MessageFooter-4qIEK91O.js";
6
+ import { Spinner as i, useLevo as a } from "@levo-so/react";
7
+ import { useEffect as o, useState as s } from "react";
8
+ import { jsx as c, jsxs as l } from "react/jsx-runtime";
9
+ import { getLevoError as u } from "@levo-so/core";
10
+ var d = {
11
+ header: "_header_lqah8_1",
12
+ title: "_title_lqah8_8",
13
+ subtitle: "_subtitle_lqah8_15",
14
+ formContainer: "_formContainer_lqah8_21",
15
+ loading: "_loading_lqah8_27"
16
+ }, f = "so_levo_membership_account", p = [
17
+ "profile_picture",
18
+ "first_name",
19
+ "last_name",
20
+ "email",
21
+ "username",
22
+ "socials"
23
+ ], m = ["email", "username"], h = (e) => p.includes(e.key) || e.editable === !0, g = ({ logo: p, siteName: g, options: _, onSuccess: v }) => {
24
+ let y = a(), { account: b } = t(), [x, S] = s(null), [C, w] = s(!0), [T, E] = s(!1), [D, O] = s("");
25
+ return o(() => {
26
+ w(!0), y?.collection?.getCollectionByIDExpanded(f).then((e) => {
27
+ let t = e?.content?.data;
28
+ if (!t) {
29
+ S(null);
30
+ return;
31
+ }
32
+ S({
33
+ ...t,
34
+ sections: t.sections?.map((e) => ({
35
+ ...e,
36
+ fields: e.fields?.map((e) => ({
37
+ ...e,
38
+ hidden: !h(e),
39
+ readonly: e.readonly || m.includes(e.key)
40
+ }))
41
+ }))
42
+ });
43
+ }).catch((e) => {
44
+ y?.logger?.error("Failed to load membership schema", { exception: u(e) });
45
+ }).finally(() => {
46
+ w(!1);
47
+ });
48
+ }, []), /* @__PURE__ */ l(n, {
49
+ logo: p,
50
+ siteName: g,
51
+ maxWidth: "md",
52
+ children: [
53
+ /* @__PURE__ */ l("div", {
54
+ className: d.header,
55
+ children: [/* @__PURE__ */ c("h1", {
56
+ className: d.title,
57
+ children: "Complete Your Profile"
58
+ }), /* @__PURE__ */ c("div", {
59
+ className: d.subtitle,
60
+ dangerouslySetInnerHTML: { __html: _?.content?.entryNotFound ?? `Please complete your profile to access content on <strong>${g}</strong>` }
61
+ })]
62
+ }),
63
+ /* @__PURE__ */ c(r, {}),
64
+ /* @__PURE__ */ l("div", {
65
+ className: d.formContainer,
66
+ children: [D && /* @__PURE__ */ c("p", {
67
+ className: "text-destructive text-sm",
68
+ children: D
69
+ }), C ? /* @__PURE__ */ c("div", {
70
+ className: d.loading,
71
+ children: /* @__PURE__ */ c(i, {})
72
+ }) : x ? /* @__PURE__ */ c(e, {
73
+ schema: x,
74
+ initialValues: b ?? {},
75
+ uiConfig: {
76
+ hideFormHeading: !0,
77
+ hideSectionHeadings: !0
78
+ },
79
+ submitButtonConfig: {
80
+ show: !0,
81
+ text: "Submit"
82
+ },
83
+ isLoading: T,
84
+ onSubmit: async (e) => {
85
+ O(""), E(!0);
86
+ try {
87
+ let t = x?.sections?.flatMap((e) => e?.fields ?? [])?.filter((e) => h(e) && !m.includes(e.key))?.map((e) => e?.key) ?? [], n = Object.fromEntries(Object.entries(e).filter(([e]) => t.includes(e)));
88
+ await y?.membership?.updateMe(n), v?.();
89
+ } catch (e) {
90
+ let t = u(e);
91
+ y?.logger?.error("Failed to update profile", { exception: t }), O(t?.message || "Something went wrong. Please try again.");
92
+ } finally {
93
+ E(!1);
94
+ }
95
+ }
96
+ }) : null]
97
+ })
98
+ ]
99
+ });
100
+ };
101
+ //#endregion
102
+ export { g as default };
@@ -1,9 +1,10 @@
1
1
  "use client";
2
2
  import { r as e, t } from "./inlineRteTheme-Ajq9PNpQ.js";
3
3
  import { t as ee } from "./RteThemeProvider-Cfepkyer.js";
4
- import { f as te, l as ne, t as re } from "./CollectionField-BPl8E9MW.js";
5
- import { i as n } from "./Tooltip-CJINDx93.js";
6
- import { r, t as ie } from "./Toolbar-B5UZer_x.js";
4
+ import { t as te } from "./getFieldValidations-CSkSV2hW.js";
5
+ import { l as ne, t as re } from "./CollectionField-xa-jed3_.js";
6
+ import { i as n } from "./Tooltip-NEMQqPyr.js";
7
+ import { r, t as ie } from "./Toolbar-C3WDkSnO.js";
7
8
  import { c as ae } from "react/compiler-runtime";
8
9
  import { useEffect as i, useState as oe } from "react";
9
10
  import { jsx as a, jsxs as se } from "react/jsx-runtime";
@@ -1,8 +1,8 @@
1
1
  import { t as e } from "./Button-lUfKisu8.js";
2
- import { t } from "./nodeAlignment-DKCIjzlR.js";
3
- import { l as n } from "./CollectionField-BPl8E9MW.js";
4
- import { n as r, r as i, t as a } from "./Tooltip-CJINDx93.js";
5
- import { a as o, i as s, n as c, o as l, r as u } from "./Popover-DOvRAGzc.js";
2
+ import { t } from "./nodeAlignment-BC_Uferw.js";
3
+ import { l as n } from "./CollectionField-xa-jed3_.js";
4
+ import { n as r, r as i, t as a } from "./Tooltip-NEMQqPyr.js";
5
+ import { a as o, i as s, n as c, o as l, r as u } from "./Popover-O1poOHk2.js";
6
6
  import { c as d } from "react/compiler-runtime";
7
7
  import { forwardRef as f, useEffect as p, useState as m } from "react";
8
8
  import { Fragment as h, jsx as g, jsxs as _ } from "react/jsx-runtime";
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import { i as e, n as t, o as n, t as r } from "./Dialog-IrII0ugb.js";
3
3
  import { t as i } from "./Button-lUfKisu8.js";
4
- import { t as a } from "./CollectionInput-DcNJT5Pg.js";
4
+ import { t as a } from "./CollectionInput-CpNGIXJx.js";
5
5
  import { c as o } from "react/compiler-runtime";
6
6
  import { errorToast as s, successToast as c, useLevo as l } from "@levo-so/react";
7
7
  import { useEffect as u, useState as d } from "react";
@@ -1,8 +1,8 @@
1
1
  "use client";
2
- import { t as e } from "./Button-DujHjtOV.js";
2
+ import { t as e } from "./Button-BMUB23Y7.js";
3
3
  import { n as t } from "./AuthProvider-C6bvedwF.js";
4
4
  import { n, t as r } from "./StripePaymentModal-Do1xHctU.js";
5
- import { BillingStep as i } from "./BillingStep-CJqmdIz2.js";
5
+ import { BillingStep as i } from "./BillingStep-DZeqbtfs.js";
6
6
  import { cn as a, errorHandler as o, useLevo as s } from "@levo-so/react";
7
7
  import { useEffect as c, useRef as l, useState as u } from "react";
8
8
  import { Fragment as d, jsx as f, jsxs as p } from "react/jsx-runtime";
package/collection.d.ts CHANGED
@@ -12,7 +12,6 @@ import { IFieldError } from '@levo-so/core';
12
12
  import { ILemaCollection } from '@levo-so/core';
13
13
  import { ILemaField } from '@levo-so/core';
14
14
  import { ILemaFieldOptions } from '@levo-so/core';
15
- import { ILevoMembership } from '@levo-so/core';
16
15
  import { ILogicRule } from '@levo-so/core';
17
16
  import { JSX } from 'react/jsx-runtime';
18
17
  import { Mark } from '@tiptap/core';
@@ -210,7 +209,6 @@ export declare interface ICollectionFormBuilderProps extends Omit<ILevoFormConte
210
209
  collection_id: string;
211
210
  hiddenFields?: string[];
212
211
  workspace_id?: string;
213
- account?: ILevoMembership.Account;
214
212
  }
215
213
 
216
214
  export declare interface ICollectionFormProps extends Omit<ILevoFormContext, "onSuccess" | "externalInitialValues" | "onError" | "isLoggedIn" | "toastConfig" | "onFormDirty" | "disableCaptcha" | "enableVerification"> {
@@ -317,7 +315,15 @@ export declare interface ILevoFormContext {
317
315
  cssReset?: boolean;
318
316
  };
319
317
  isLoggedIn?: boolean;
320
- account?: ILevoMembership.Account;
318
+ /**
319
+ * Logged-in member's contact details, used only to prefill the schema's designated
320
+ * email_field/mobile_field. Strictly the fields consumed — pass anything else via
321
+ * externalInitialValues.
322
+ */
323
+ account?: {
324
+ email?: string | null;
325
+ mobile?: string | null;
326
+ };
321
327
  externalInitialValues?: Record<string, any>;
322
328
  onSuccess?: (v: {
323
329
  schemaId: string;
@@ -421,7 +427,7 @@ declare type ParamError = {
421
427
 
422
428
  export declare const setFormErrors: (errors: IFieldError[], setError: UseFormSetError<any>) => void;
423
429
 
424
- export declare const submitDataParser: (data: Record<string, unknown>, schema: ILemaCollection) => any;
430
+ export declare const submitDataParser: (data: Record<string, unknown>, schema: ILemaCollection, initialValues?: Record<string, unknown>) => any;
425
431
 
426
432
  export declare const ThemeWrapper: default_2.FC<IThemeWrapperProps>;
427
433
 
@@ -462,17 +468,19 @@ export declare const updateFieldWInterface: (tempField: ILemaField, field_interf
462
468
  fieldFocused: string | null;
463
469
  };
464
470
 
465
- export declare const useLevoForm: ({ schema: schemaProp, originalSchema: originalSchemaProp, onSubmitSuccess, onSubmitError, setFormErrorAfterSubmit, }: {
471
+ export declare const useLevoForm: ({ schema: schemaProp, originalSchema: originalSchemaProp, onSubmitSuccess, onSubmitError, onInit, setFormErrorAfterSubmit, }: {
466
472
  schema: ILemaCollection | null;
467
473
  originalSchema?: ILemaCollection | null;
474
+ setFormErrorAfterSubmit?: boolean;
468
475
  onSubmitSuccess?: () => void;
469
476
  onSubmitError?: (e: IFieldError[]) => void;
470
- setFormErrorAfterSubmit?: boolean;
477
+ onInit?: (values: Record<string, unknown>) => void;
471
478
  }) => {
472
479
  methods: UseFormReturn<FieldValues, any, FieldValues>;
473
480
  isLoading: boolean;
474
481
  isError: boolean;
475
482
  contentId: string | null;
483
+ publishedId: string | null;
476
484
  allFormValues: any;
477
485
  handleContentId: (id: string) => void;
478
486
  appendFormValues: (data: any) => void;
package/collection.js CHANGED
@@ -1,9 +1,10 @@
1
- import { C as e, S as t, T as n, _ as r, a as i, b as a, c as o, d as s, f as c, g as l, h as u, i as d, l as f, m as p, o as m, p as h, r as g, s as _, t as v, u as y, v as b, w as x, x as S, y as C } from "./CollectionFormBuilder-BvFtiZeH.js";
2
- import { a as w, c as T, f as E, i as D, n as O, o as k, r as A, s as j, t as M, u as N } from "./CollectionField-BPl8E9MW.js";
3
- import { t as P } from "./utils-CUqS5dMC.js";
4
- import { t as F } from "./CollectionInput-DcNJT5Pg.js";
5
- import { n as I, r as L } from "./dist-DZbXWctg.js";
6
- import { n as R, r as z, t as B } from "./Toolbar-B5UZer_x.js";
1
+ import { a as e, c as t, d as n, f as r, h as i, i as a, l as o, m as s, n as c, o as l, p as u, r as d, s as f, u as p } from "./dist-Cfv-YjpI.js";
2
+ import { a as m, c as h, d as g, f as _, i as v, l as y, n as b, o as x, r as S, s as C, t as w, u as T } from "./widgets-K6ECnoJJ.js";
3
+ import { t as E } from "./getFieldValidations-CSkSV2hW.js";
4
+ import { t as D } from "./utils-BJLmuC5w.js";
5
+ import { a as O, c as k, i as A, n as j, o as M, r as N, s as P, t as F, u as I } from "./CollectionField-xa-jed3_.js";
6
+ import { t as L } from "./CollectionInput-CpNGIXJx.js";
7
+ import { n as R, r as z, t as B } from "./Toolbar-C3WDkSnO.js";
7
8
  //#region ../../libraries/react-collection/dist/types/formVariant.js
8
9
  var V = [
9
10
  {
@@ -28,4 +29,4 @@ var V = [
28
29
  }
29
30
  ];
30
31
  //#endregion
31
- export { h as AsyncSelectPaginate, c as CURRENCY_SYMBOLS, B as CollectionEditorToolbar, M as CollectionFieldWrapper, M as FieldWrapper, L as CollectionForm, v as CollectionFormBuilder, I as CollectionFormRenderer, F as CollectionInput, F as Input, N as CollectionLabel, y as DEFAULT_WIDGET_REGISTRY, w as Field, j as FieldContent, k as FieldDescription, O as FieldError, T as FieldGroup, A as FieldLabel, f as FieldRenderer, D as FieldSet, g as FormBuilder, V as FormVariantOptions, s as INR_CURRENCY_SYMBOL, i as LevoFormProvider, o as ThemeWrapper, R as ToolbarButton, n as areAllFieldsHidden, p as createWidget, r as errorsToParam, z as getCollectionEditorExtensions, C as getDefaultFieldValues, x as getDefaultValuesByKind, E as getFieldValidations, S as getInitialValues, P as getKindFromMimetype, e as getValueIfNotUndefined, t as isPhoneValid, u as setFormErrors, l as submitDataParser, a as updateFieldWInterface, d as useLevoForm, m as useLevoFormContext, _ as useLevoFormTheme, b as validateForm };
32
+ export { i as AsyncSelectPaginate, s as CURRENCY_SYMBOLS, B as CollectionEditorToolbar, F as CollectionFieldWrapper, F as FieldWrapper, t as CollectionForm, d as CollectionFormBuilder, c as CollectionFormRenderer, L as CollectionInput, L as Input, I as CollectionLabel, r as DEFAULT_WIDGET_REGISTRY, O as Field, P as FieldContent, M as FieldDescription, j as FieldError, k as FieldGroup, N as FieldLabel, n as FieldRenderer, A as FieldSet, a as FormBuilder, V as FormVariantOptions, u as INR_CURRENCY_SYMBOL, l as LevoFormProvider, p as ThemeWrapper, R as ToolbarButton, v as areAllFieldsHidden, w as createWidget, T as errorsToParam, z as getCollectionEditorExtensions, h as getDefaultFieldValues, C as getDefaultValuesByKind, E as getFieldValidations, S as getInitialValues, D as getKindFromMimetype, x as getValueIfNotUndefined, m as isPhoneValid, b as setFormErrors, _ as submitDataParser, g as updateFieldWInterface, e as useLevoForm, f as useLevoFormContext, o as useLevoFormTheme, y as validateForm };