@levo-so/studio 0.3.20 → 0.3.22

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 (69) hide show
  1. package/BillingStep-ioR7mSo5.js +249 -0
  2. package/BookingCard-DEkBXh7O.js +646 -0
  3. package/DateTimeWidget-B-dajfHj.js +253 -0
  4. package/{EntryCard-9yv0KJTB.js → EntryCard-CZfljZAY.js} +4 -4
  5. package/{KBChatWidget-D39Z3HIl.js → KBChatWidget-BXRRgelS.js} +1 -1
  6. package/{LoginCard-D9vEC_g0.js → LoginCard-BVjeN1J0.js} +3 -3
  7. package/{LoginForm-kI_b_7Tc.js → LoginForm-DQVwLQCx.js} +19 -19
  8. package/{LoginModal-C-9BhmoO.js → LoginModal-C6TdAh-0.js} +5 -6
  9. package/{MessageCard-Nsxr98n6.js → MessageCard-B5MbVDJ8.js} +2 -2
  10. package/{MessageFooter-K4Zd_eFO.js → MessageFooter-DrlKXE9a.js} +1 -2
  11. package/{PendingApprovalCard-CzoBgYNy.js → PendingApprovalCard-5iFAeE1s.js} +3 -3
  12. package/{PhoneWidget-BtMMfGLu.js → PhoneWidget-B4KHlFjT.js} +6 -7
  13. package/{Popover-Iis-qOn1.js → Popover-y8XkbYNh.js} +7 -7
  14. package/{PopupBody-BI-MJqmd-B3ltSYMP.js → PopupBody-DWM55Zh5-DuOPsCAn.js} +53 -55
  15. package/PopupDialog-DwAAJ8JS-9xm5jrXW.js +261 -0
  16. package/PopupRenderer-BVtV4b9I-BdPryfLY.js +208 -0
  17. package/{ProfileCard-Chg20HBa.js → ProfileCard-WgFT-T4U.js} +5 -5
  18. package/{RichTextWidget-C3Y-0pNy.js → RichTextWidget-DKYm1cSW.js} +120 -123
  19. package/{Spinner-D5spB_Mv.js → Spinner-LdYfm4S7.js} +1 -1
  20. package/{VerifyButton-BwTbzSwS.js → VerifyButton-CNq78zG4.js} +5 -7
  21. package/collection.d.ts +9 -1
  22. package/collection.js +1 -1
  23. package/dialog-CU5nHKc5.js +119 -0
  24. package/dist-IMRD6dob.js +3858 -0
  25. package/index.js +3280 -2848
  26. package/{inlineRteTheme-BOAno9MG.js → inlineRteTheme-DFg69bqP.js} +50 -37
  27. package/{kbChat-zXbn56Zb.js → kbChat-eFsau7hG.js} +2 -2
  28. package/package.json +42 -43
  29. package/{pillChrome-QDjBETmP.js → pillChrome-Dy3ApFI5.js} +5 -5
  30. package/price-BUDkN5Me.js +823 -0
  31. package/script.esm-uVCZU25S.js +62 -0
  32. package/studio.css +1 -1
  33. package/themeMapping-DH_NoXK8-H-EHXbBt.js +156 -0
  34. package/useCheckout-gscmzFLD.js +179 -0
  35. package/useLogin-BYVekOp9.js +237 -0
  36. package/AuthProvider-B5NfFwbG.js +0 -118
  37. package/BillingStep-BTDOMFHV.js +0 -181
  38. package/Button-DXLWW3dp.js +0 -504
  39. package/CollectionField-BZmxRB5D.js +0 -270
  40. package/CollectionInput-DyNbxIZ8.js +0 -147
  41. package/DateTimeWidget-Bt1UcCnx.js +0 -255
  42. package/Dialog-CPE8yUqK.js +0 -130
  43. package/ModalManager-CzH36UIk.js +0 -32
  44. package/PopupRenderer-D66Gx63H-ChI4WBer.js +0 -389
  45. package/RteThemeProvider-owl5oajj.js +0 -20
  46. package/ThemeProvider-CqPHzkW9.js +0 -116
  47. package/Tooltip-DHU1QD-n.js +0 -67
  48. package/authentication-BXQbxiPP.js +0 -36
  49. package/bookingCard-g0n3ksiC.js +0 -605
  50. package/createThemeExtension-C0PSYy0J.js +0 -15
  51. package/dialog-8LH_ihs4.js +0 -92
  52. package/dist-Dijjo-5m.js +0 -3794
  53. package/generateRadiusScale-RROt8ppa.js +0 -71
  54. package/inlineCollectionTheme-uhBXoF1F.js +0 -19
  55. package/popupState-JmpeKzgM-UECLsSbL.js +0 -100
  56. package/rteTheme.cssm-W4gTOijw.js +0 -4
  57. package/theme.cssm-Czj9sF4X.js +0 -4
  58. package/themeMapping-Bi9Rcr5G-C7UXWE6o.js +0 -61
  59. package/useCheckout-DFalmfEQ.js +0 -161
  60. package/useLogin-CfnGrLdO.js +0 -127
  61. package/usePopupRedirect-CAAdcpaW-DdME0F7f.js +0 -82
  62. /package/{Beams-WJN38XSv.js → Beams-KsU_ixpY.js} +0 -0
  63. /package/{Dots-DggLz5I7.js → Dots-C_ja_PPu.js} +0 -0
  64. /package/{Gradient-BSWJAu0a.js → Gradient-CDGFLaA-.js} +0 -0
  65. /package/{Grid-BFKl0MUt.js → Grid-C22rTkrs.js} +0 -0
  66. /package/{Waves-BPEgTYoO.js → Waves-Cl5rKcFJ.js} +0 -0
  67. /package/{card-5ooLmYSr.js → card-BIebVDA0.js} +0 -0
  68. /package/{cn-B6c1DjO_.js → cn-CzJDhklM.js} +0 -0
  69. /package/{fontSize-B-ba6pvx.js → fontSize-DowUyWe-.js} +0 -0
@@ -1,71 +0,0 @@
1
- //#region ../../libraries/levocn/dist/styles/theme/themeVars.cssm.js
2
- var e = {
3
- colors: {
4
- background: "var(--_1i5egzy0)",
5
- foreground: "var(--_1i5egzy1)",
6
- text: "var(--_1i5egzy2)",
7
- heading: "var(--_1i5egzy3)",
8
- card: "var(--_1i5egzy4)",
9
- cardForeground: "var(--_1i5egzy5)",
10
- popover: "var(--_1i5egzy6)",
11
- popoverForeground: "var(--_1i5egzy7)",
12
- primary: "var(--_1i5egzy8)",
13
- primaryForeground: "var(--_1i5egzy9)",
14
- secondary: "var(--_1i5egzya)",
15
- secondaryForeground: "var(--_1i5egzyb)",
16
- muted: "var(--_1i5egzyc)",
17
- mutedForeground: "var(--_1i5egzyd)",
18
- accent: "var(--_1i5egzye)",
19
- accentForeground: "var(--_1i5egzyf)",
20
- destructive: "var(--_1i5egzyg)",
21
- border: "var(--_1i5egzyh)",
22
- input: "var(--_1i5egzyi)",
23
- inputForeground: "var(--_1i5egzyj)",
24
- ring: "var(--_1i5egzyk)"
25
- },
26
- radius: "var(--_1i5egzyl)",
27
- radiusScale: {
28
- sm: "var(--_1i5egzym)",
29
- base: "var(--_1i5egzyn)",
30
- md: "var(--_1i5egzyo)",
31
- lg: "var(--_1i5egzyp)",
32
- xl: "var(--_1i5egzyq)",
33
- "2xl": "var(--_1i5egzyr)",
34
- "3xl": "var(--_1i5egzys)",
35
- "4xl": "var(--_1i5egzyt)",
36
- "5xl": "var(--_1i5egzyu)",
37
- "6xl": "var(--_1i5egzyv)",
38
- "7xl": "var(--_1i5egzyw)",
39
- "8xl": "var(--_1i5egzyx)",
40
- full: "var(--_1i5egzyy)"
41
- },
42
- baseFontSize: "var(--_1i5egzyz)",
43
- fonts: {
44
- body: "var(--_1i5egzy10)",
45
- heading: "var(--_1i5egzy11)"
46
- },
47
- shadow: {
48
- xs: "var(--_1i5egzy12)",
49
- sm: "var(--_1i5egzy13)",
50
- md: "var(--_1i5egzy14)",
51
- lg: "var(--_1i5egzy15)",
52
- xl: "var(--_1i5egzy16)",
53
- inner: "var(--_1i5egzy17)"
54
- }
55
- }, t = (e) => ({
56
- sm: `calc(${e} * 0.5)`,
57
- base: e,
58
- md: `calc(${e} * 1.5)`,
59
- lg: `calc(${e} * 2)`,
60
- xl: `calc(${e} * 3)`,
61
- "2xl": `calc(${e} * 4)`,
62
- "3xl": `calc(${e} * 6)`,
63
- "4xl": `calc(${e} * 8)`,
64
- "5xl": `calc(${e} * 12)`,
65
- "6xl": `calc(${e} * 16)`,
66
- "7xl": `calc(${e} * 20)`,
67
- "8xl": `calc(${e} * 24)`,
68
- full: "100%"
69
- });
70
- //#endregion
71
- export { e as n, t };
@@ -1,19 +0,0 @@
1
- import { t as e } from "./createThemeExtension-C0PSYy0J.js";
2
- //#region ../../libraries/react-collection/dist/theme/collectionThemeVars.cssm.js
3
- var t = {
4
- form: {
5
- maxWidth: "var(--_1092q7b0)",
6
- gap: "var(--_1092q7b1)",
7
- borderRadius: "var(--_1092q7b2)",
8
- labelFontSize: "var(--_1092q7b3)",
9
- helpFontSize: "var(--_1092q7b4)"
10
- },
11
- input: {
12
- fontSize: "var(--_1092q7b5)",
13
- height: "var(--_1092q7b6)",
14
- borderRadius: "var(--_1092q7b7)"
15
- },
16
- checkbox: { labelFontSize: "var(--_1092q7b8)" }
17
- }, n = e(t);
18
- //#endregion
19
- export { t as n, n as t };
@@ -1,100 +0,0 @@
1
- import { persistentAtom as e } from "@nanostores/persistent";
2
- import { atom as t, computed as n } from "nanostores";
3
- //#region ../../libraries/popups/dist/popupState-JmpeKzgM.js
4
- var r = 6e4, i = "lv_popups_session", a = {
5
- active_popup_id: null,
6
- shown_popup_ids: [],
7
- last_closed_at: null
8
- }, o = e("lv_popups_state", {}, {
9
- encode: JSON.stringify,
10
- decode: JSON.parse
11
- }), s = (e) => {
12
- if (!e) return a;
13
- try {
14
- return {
15
- ...JSON.parse(e),
16
- active_popup_id: null
17
- };
18
- } catch {
19
- return a;
20
- }
21
- }, c = t((() => {
22
- if (typeof sessionStorage > "u") return a;
23
- try {
24
- return s(sessionStorage.getItem(i));
25
- } catch {
26
- return a;
27
- }
28
- })()), l = c.set;
29
- c.set = (e) => {
30
- l(e);
31
- try {
32
- sessionStorage.setItem(i, JSON.stringify(e));
33
- } catch {}
34
- };
35
- var u = n([c, o], (e, t) => ({
36
- active_popup_id: e.active_popup_id,
37
- shown_popup_ids: e.shown_popup_ids,
38
- last_closed_at: e.last_closed_at,
39
- previous_popups: t
40
- })), d = t([]), f = (e) => {
41
- d.set(e);
42
- }, p = t(!0), m = (e) => {
43
- p.set(e);
44
- }, h = () => u.get(), g = (e, t) => e.includes(t) ? e : [...e, t], _ = "manual", v = () => _, y = null, b = () => y, x = [], S = null, C = () => {
45
- if (S) return;
46
- let { last_closed_at: e } = c.get();
47
- if (!e) return;
48
- let t = r - (Date.now() - e);
49
- if (t <= 0) {
50
- w();
51
- return;
52
- }
53
- S = setTimeout(() => {
54
- S = null, w();
55
- }, t);
56
- }, w = () => {
57
- let e = c.get();
58
- if (!e.active_popup_id) {
59
- if (e.last_closed_at && Date.now() - e.last_closed_at < 6e4) {
60
- C();
61
- return;
62
- }
63
- for (; x.length > 0;) {
64
- let e = x.shift();
65
- if (D(e.popup, { trigger_type: e.trigger_type })) return;
66
- }
67
- }
68
- }, T = (e, t) => {
69
- x.some((t) => t.popup.id === e.id) || (x.push({
70
- popup: e,
71
- trigger_type: t
72
- }), C());
73
- }, E = (e, t) => {
74
- let n = h();
75
- if (t?.type === "always") return !n.shown_popup_ids.includes(e);
76
- let r = n.previous_popups[e];
77
- return r ? !t || t.type === "once" ? !1 : t.type === "interval" && t.interval_ms ? Date.now() - r.triggered_at >= t.interval_ms : !0 : !0;
78
- }, D = (e, t = {}) => {
79
- let { force: n = !1, trigger_type: r = "manual" } = t, i = e.id, a = e.settings?.display_frequency, s = c.get();
80
- return s.active_popup_id === i ? !0 : !n && (s.active_popup_id || s.last_closed_at && Date.now() - s.last_closed_at < 6e4 || !E(i, a)) ? !1 : (S &&= (clearTimeout(S), null), _ = r, y = Date.now(), c.set({
81
- active_popup_id: i,
82
- shown_popup_ids: g(s.shown_popup_ids, i),
83
- last_closed_at: s.last_closed_at
84
- }), a?.type !== "always" && o.set({
85
- ...o.get(),
86
- [i]: { triggered_at: Date.now() }
87
- }), !0);
88
- }, O = (e, t = {}) => {
89
- let { trigger_type: n = "manual" } = t;
90
- return D(e, { trigger_type: n }) ? !0 : (E(e.id, e.settings?.display_frequency) && T(e, n), !1);
91
- }, k = (e) => {
92
- let t = c.get();
93
- t.active_popup_id === e && (_ = "manual", y = null, c.set({
94
- ...t,
95
- active_popup_id: null,
96
- last_closed_at: Date.now()
97
- }), setTimeout(w, 0));
98
- };
99
- //#endregion
100
- export { d as a, k as c, u as d, v as f, c as i, m as l, O as n, f as o, b as r, h as s, D as t, p as u };
@@ -1,4 +0,0 @@
1
- //#region ../../libraries/editor-core/dist/styles/rteTheme.cssm.js
2
- var e = "u2k86a0";
3
- //#endregion
4
- export { e as t };
@@ -1,4 +0,0 @@
1
- //#region ../../libraries/levocn/dist/styles/theme/theme.cssm.js
2
- var e = "_1bi3v3x0";
3
- //#endregion
4
- export { e as t };
@@ -1,61 +0,0 @@
1
- import { n as e, t } from "./generateRadiusScale-RROt8ppa.js";
2
- import { t as n } from "./createThemeExtension-C0PSYy0J.js";
3
- //#region ../../libraries/levocn/dist/styles/inlineBaseTheme.js
4
- var r = n(e), i = (e) => e ? e.radius && !e.radiusScale ? r({
5
- ...e,
6
- radiusScale: t(e.radius)
7
- }) : r(e) : {}, a = (e) => {
8
- if (e == null) return;
9
- if (typeof e == "string") return e;
10
- if (typeof e != "object") return;
11
- let t = e;
12
- if (typeof t.l != "number" || typeof t.c != "number" || typeof t.h != "number") return;
13
- let n = (e) => Math.round(e * 1e4) / 1e4, r = n(t.l), i = n(t.c), a = n(t.h), o = typeof t.alpha == "number" ? n(t.alpha) : 1;
14
- return o < 1 ? `oklch(${r} ${i} ${a} / ${o})` : `oklch(${r} ${i} ${a})`;
15
- }, o = (e) => {
16
- let t = e.colors;
17
- return !t || typeof t != "object" ? !1 : Object.values(t).some((e) => e != null);
18
- }, s = (e) => {
19
- if (!e || !o(e)) return null;
20
- let t = e.colors, n = t?.brand ?? {}, r = e.fonts, i = e.sizes;
21
- return {
22
- colors: {
23
- brand: {
24
- main: a(n.main) ?? "",
25
- foreground: a(n.foreground) ?? ""
26
- },
27
- text1: a(t.text1) ?? "",
28
- text2: a(t.text2) ?? "",
29
- page: a(t.page) ?? "",
30
- border: a(t.border) ?? ""
31
- },
32
- fonts: {
33
- heading: r?.heading ?? "inherit",
34
- body: r?.body ?? "inherit"
35
- },
36
- sizes: { radius: i?.radius ?? "4px" }
37
- };
38
- }, c = (e) => {
39
- if (e) return {
40
- colors: {
41
- primary: e.colors?.brand?.main,
42
- primaryForeground: e.colors?.brand?.foreground,
43
- foreground: e.colors?.text1,
44
- text: e.colors?.text1,
45
- heading: e.colors?.text1,
46
- mutedForeground: e.colors?.text2,
47
- background: e.colors?.page,
48
- card: e.colors?.page,
49
- cardForeground: e.colors?.text1,
50
- popover: e.colors?.page,
51
- popoverForeground: e.colors?.text1,
52
- border: e.colors?.border,
53
- input: e.colors?.page,
54
- inputForeground: e.colors?.text1
55
- },
56
- fonts: e.fonts,
57
- radius: e.sizes?.radius
58
- };
59
- }, l = (e) => i(c(e));
60
- //#endregion
61
- export { s as n, i as r, l as t };
@@ -1,161 +0,0 @@
1
- "use client";
2
- import { t as e } from "./cn-B6c1DjO_.js";
3
- import { useCallback as t, useEffect as n, useMemo as r, useRef as i, useState as a } from "react";
4
- import { jsx as o, jsxs as s } from "react/jsx-runtime";
5
- import { XIcon as c } from "lucide-react";
6
- import { Portal as l } from "radix-ui";
7
- import { useRazorpay as u } from "react-razorpay";
8
- import { EmbeddedCheckout as d, EmbeddedCheckoutProvider as f } from "@stripe/react-stripe-js";
9
- //#region src/components/checkout/openCashfreeCheckout.ts
10
- var p = async (e) => {
11
- let { payment_session_id: t, order_id: n } = e;
12
- if (!t || !n) throw Error("Cashfree payment session missing");
13
- let { load: r } = await import("@cashfreepayments/cashfree-js"), i = await r({ mode: e.environment || "production" });
14
- if (!i) throw Error("Cashfree checkout failed to load");
15
- let a = await i.checkout({
16
- paymentSessionId: t,
17
- redirectTarget: "_modal"
18
- });
19
- return a.paymentDetails ? {
20
- status: "completed",
21
- confirmation: { order_id: n }
22
- } : a.redirect ? { status: "redirect" } : {
23
- status: "closed",
24
- message: a.error?.message
25
- };
26
- }, m = () => typeof window < "u" && "Razorpay" in window, h = ({ order: e, onSettled: t, onError: r }) => {
27
- let { Razorpay: a, isLoading: o, error: s } = u(), c = i({
28
- onSettled: t,
29
- onError: r
30
- });
31
- c.current = {
32
- onSettled: t,
33
- onError: r
34
- };
35
- let l = i(!1);
36
- return n(() => {
37
- if (l.current) return;
38
- if (s) {
39
- l.current = !0, c.current.onError(Error(s));
40
- return;
41
- }
42
- if (!a || !m()) return;
43
- l.current = !0;
44
- let t;
45
- try {
46
- let n = new a({
47
- key: e.key,
48
- amount: e.amount,
49
- currency: e.currency,
50
- order_id: e.orderId,
51
- name: e.merchantName,
52
- description: e.description,
53
- prefill: e.prefill,
54
- theme: e.themeColor ? { color: e.themeColor } : void 0,
55
- handler: (e) => c.current.onSettled({
56
- status: "completed",
57
- confirmation: {
58
- order_id: e.razorpay_order_id,
59
- payment_id: e.razorpay_payment_id,
60
- signature: e.razorpay_signature
61
- }
62
- }),
63
- modal: { ondismiss: () => c.current.onSettled({
64
- status: "closed",
65
- message: t
66
- }) }
67
- });
68
- n.on("payment.failed", (e) => {
69
- t = e?.error?.description;
70
- }), n.open();
71
- } catch (e) {
72
- c.current.onError(e instanceof Error ? e : /* @__PURE__ */ Error("Razorpay checkout failed to open"));
73
- }
74
- }, [
75
- a,
76
- o,
77
- s,
78
- e
79
- ]), null;
80
- }, g = ({ stripePromise: t, clientSecret: n, onClose: a, onComplete: u }) => {
81
- let p = i(u);
82
- p.current = u;
83
- let m = r(() => ({
84
- clientSecret: n,
85
- onComplete: () => p.current()
86
- }), [n]);
87
- return /* @__PURE__ */ o(l.Root, { children: /* @__PURE__ */ o("div", {
88
- className: "fixed inset-0 z-[2147483001] flex items-start justify-center overflow-y-auto bg-black/50 p-4 pt-8 md:p-6 md:pt-10",
89
- children: /* @__PURE__ */ s("div", {
90
- className: e("relative flex w-full flex-col overflow-hidden rounded-2xl bg-white shadow-2xl", "max-w-[98vw] md:max-w-[1000px] lg:max-w-[1100px]", "min-h-[500px]", "my-auto", "fade-in-0 zoom-in-95 animate-in duration-200"),
91
- children: [/* @__PURE__ */ o("button", {
92
- type: "button",
93
- onClick: a,
94
- "aria-label": "Close payment",
95
- className: "absolute top-4 right-4 z-10 rounded-full bg-white/90 p-2.5 text-gray-500 shadow-md backdrop-blur-sm transition-all hover:bg-white hover:text-gray-700",
96
- children: /* @__PURE__ */ o(c, { className: "size-5" })
97
- }), /* @__PURE__ */ o("div", {
98
- className: "flex-1 overflow-hidden rounded-2xl py-6",
99
- children: /* @__PURE__ */ o(f, {
100
- stripe: t,
101
- options: m,
102
- children: /* @__PURE__ */ o(d, { className: "stripe-embedded-checkout h-full" })
103
- })
104
- })]
105
- })
106
- }) });
107
- }, _ = () => {
108
- let [e, n] = a(null), r = t(async (e, t) => {
109
- if (e.provider === "cashfree") return p(e);
110
- if (e.provider === "stripe") {
111
- let { client_secret: t, session_id: r } = e;
112
- if (!t || !r) throw Error("Stripe checkout session missing");
113
- let { loadStripe: i } = await import("@stripe/stripe-js"), a = i(e.key);
114
- return new Promise((e, i) => n({
115
- provider: "stripe",
116
- stripePromise: a,
117
- clientSecret: t,
118
- sessionId: r,
119
- settle: {
120
- resolve: e,
121
- reject: i
122
- }
123
- }));
124
- }
125
- let { order_id: r } = e;
126
- if (!r) throw Error("Razorpay order missing");
127
- return new Promise((i, a) => n({
128
- provider: "razorpay",
129
- order: {
130
- ...t,
131
- key: e.key,
132
- currency: e.currency || "INR",
133
- orderId: r
134
- },
135
- settle: {
136
- resolve: i,
137
- reject: a
138
- }
139
- }));
140
- }, []), i = (e, t) => {
141
- n(null), t instanceof Error ? e.settle.reject(t) : e.settle.resolve(t);
142
- }, s = null;
143
- return e?.provider === "stripe" ? s = /* @__PURE__ */ o(g, {
144
- stripePromise: e.stripePromise,
145
- clientSecret: e.clientSecret,
146
- onComplete: () => i(e, {
147
- status: "completed",
148
- confirmation: { session_id: e.sessionId }
149
- }),
150
- onClose: () => i(e, { status: "closed" })
151
- }) : e?.provider === "razorpay" && (s = /* @__PURE__ */ o(h, {
152
- order: e.order,
153
- onSettled: (t) => i(e, t),
154
- onError: (t) => i(e, t)
155
- })), {
156
- open: r,
157
- element: s
158
- };
159
- };
160
- //#endregion
161
- export { _ as t };
@@ -1,127 +0,0 @@
1
- "use client";
2
- import { n as e } from "./AuthProvider-B5NfFwbG.js";
3
- import { useLevo as t } from "@levo-so/react";
4
- import { LevoError as n, getLevoError as r } from "@levo-so/core";
5
- //#region src/hooks/useLogin.tsx
6
- var i = () => {
7
- let { membership: i, logger: a } = t(), { isLoggedIn: o, isAuthLoading: s, setAuthState: c } = e(), l = async (e, t) => {
8
- let { email: o, phone: s, medium: c } = e, l = o || s;
9
- if (!l) throw new n({
10
- status: 400,
11
- code: "VALIDATION_ERROR",
12
- title: "Missing Content",
13
- description: "Either email or phone must be provided"
14
- });
15
- if (!i) throw new n({
16
- status: 500,
17
- code: "SDK_ERROR",
18
- title: "SDK Error",
19
- description: "Membership client not initialized"
20
- });
21
- try {
22
- await i.requestOtp({
23
- content: l,
24
- medium: c || (s ? "whatsapp" : void 0)
25
- });
26
- } catch (e) {
27
- let n = r(e), i = c === "whatsapp" || s ? "WhatsApp OTP" : "OTP";
28
- throw a?.error(`Failed to ${t} ${i}`, { exception: n }), n;
29
- }
30
- }, u = (e) => l(e, "send"), d = (e) => l(e, "resend"), f = async (e, t) => {
31
- if (!i) throw new n({
32
- status: 500,
33
- code: "SDK_ERROR",
34
- title: "SDK Error",
35
- description: "Membership client not initialized"
36
- });
37
- c({
38
- isAuthLoading: !0,
39
- isVerifying: !0
40
- });
41
- try {
42
- let n = await i.signInWithOtp({
43
- content: e,
44
- code: t
45
- });
46
- return c({
47
- account: n,
48
- isAuthLoading: !1,
49
- isVerifying: !1,
50
- isLoggedIn: !0
51
- }), n;
52
- } catch (e) {
53
- let t = r(e);
54
- throw a?.error("OTP verification failed", { exception: t }), c({
55
- account: null,
56
- isAuthLoading: !1,
57
- isVerifying: !1,
58
- isLoggedIn: !1
59
- }), t;
60
- }
61
- }, p = async (e) => {
62
- if (!i) throw new n({
63
- status: 500,
64
- code: "SDK_ERROR",
65
- title: "SDK Error",
66
- description: "Membership client not initialized"
67
- });
68
- try {
69
- await i.requestMagicLink({ content: e });
70
- } catch (e) {
71
- let t = r(e);
72
- throw a?.error("Failed to send magic link", { exception: t }), t;
73
- }
74
- }, m = (e) => {
75
- if (!i) {
76
- a?.error("Refetch login status failed", { reason: "Membership client not initialized" });
77
- return;
78
- }
79
- c({ isAuthLoading: !0 }), i.getMe().then((t) => {
80
- t ? (c({
81
- account: t,
82
- isAuthLoading: !1,
83
- isLoggedIn: !0
84
- }), e?.(t)) : c({
85
- account: null,
86
- isAuthLoading: !1,
87
- isLoggedIn: !1
88
- });
89
- }).catch((e) => {
90
- let t = r(e);
91
- a?.error("Refetch login status failed", { exception: t }), c({
92
- account: null,
93
- isAuthLoading: !1,
94
- isLoggedIn: !1
95
- });
96
- });
97
- };
98
- return {
99
- sendOTP: u,
100
- verifyOTP: f,
101
- resendOTP: d,
102
- sendMagicLink: p,
103
- refetchLoginStatus: m,
104
- signOut: (e, t) => {
105
- if (!i) {
106
- let e = new n({
107
- status: 500,
108
- code: "SDK_ERROR",
109
- title: "SDK Error",
110
- description: "Membership client not initialized"
111
- });
112
- a?.error("Sign out failed", { exception: e }), t?.(e);
113
- return;
114
- }
115
- c({ isSignOutLoading: !0 }), i.signOut().then(() => {
116
- e && e(), m(), c({ isSignOutLoading: !1 });
117
- }).catch((e) => {
118
- let n = r(e);
119
- a?.error("Sign out failed", { exception: n }), c({ isSignOutLoading: !1 }), t && t(n);
120
- });
121
- },
122
- isLoggedIn: o,
123
- isAuthLoading: s
124
- };
125
- };
126
- //#endregion
127
- export { i as t };
@@ -1,82 +0,0 @@
1
- import { c as e, f as t, r as n, s as r } from "./popupState-JmpeKzgM-UECLsSbL.js";
2
- import { c as i } from "react/compiler-runtime";
3
- import { createContext as a, useContext as o } from "react";
4
- import { jsx as s } from "react/jsx-runtime";
5
- import { createRuntimeFn as c } from "@vanilla-extract/recipes/createRuntimeFn";
6
- //#region ../../libraries/popups/dist/rolldown-runtime-CAFD8bLK.js
7
- var l = Object.defineProperty, u = (e, t) => {
8
- let n = {};
9
- for (var r in e) l(n, r, {
10
- get: e[r],
11
- enumerable: !0
12
- });
13
- return t || l(n, Symbol.toStringTag, { value: "Module" }), n;
14
- }, d = c({
15
- defaultClassName: "_1gklknd4",
16
- variantClassNames: {
17
- placement: {
18
- popup: "_1gklknd5",
19
- slide_in: "_1gklknd6"
20
- },
21
- position: {
22
- "top-left": "_1gklknd7",
23
- "top-right": "_1gklknd8",
24
- "bottom-left": "_1gklknd9",
25
- "bottom-right": "_1gklknda"
26
- }
27
- },
28
- defaultVariants: { placement: "popup" },
29
- compoundVariants: []
30
- }), f = "_1gklkndb", p = "_1gklkndc", m = c({
31
- defaultClassName: "_1gklknde",
32
- variantClassNames: { size: {
33
- small: "_1gklkndf",
34
- medium: "_1gklkndg",
35
- large: "_1gklkndh",
36
- xlarge: "_1gklkndi"
37
- } },
38
- defaultVariants: { size: "medium" },
39
- compoundVariants: []
40
- }), h = "_1gklkndn", g = a(null), _ = (e) => {
41
- let t = i(8), { popup: n, callbacks: r, client: a, preview: o, children: c } = e, l;
42
- t[0] !== r || t[1] !== a || t[2] !== n || t[3] !== o ? (l = {
43
- popup: n,
44
- callbacks: r,
45
- client: a,
46
- preview: o
47
- }, t[0] = r, t[1] = a, t[2] = n, t[3] = o, t[4] = l) : l = t[4];
48
- let u;
49
- return t[5] !== c || t[6] !== l ? (u = /* @__PURE__ */ s(g.Provider, {
50
- value: l,
51
- children: c
52
- }), t[5] = c, t[6] = l, t[7] = u) : u = t[7], u;
53
- }, v = () => {
54
- let e = o(g);
55
- if (!e) throw Error("usePopupContext must be used within a PopupProvider");
56
- return e;
57
- }, y = () => o(g), b = () => {
58
- let a = i(2), o = y(), s;
59
- return a[0] === o ? s = a[1] : (s = (i) => {
60
- let a = i === void 0 ? "programmatic" : i;
61
- if (!o || r().active_popup_id !== o.popup.id) return;
62
- let s = n();
63
- o.callbacks?.onPopupClose?.(o.popup, {
64
- trigger_type: t(),
65
- dismiss_reason: a,
66
- time_shown_ms: s ? Date.now() - s : null
67
- }), e(o.popup.id);
68
- }, a[0] = o, a[1] = s), s;
69
- }, x = "zv6sjd1", S = "zv6sjd2 zv6sjd1", C = "zv6sjd3", w = "zv6sjd8", T = "zv6sjd9", E = "zv6sjda", D = (e) => {
70
- let t = i(6), n = y(), r = n?.callbacks?.onAction, a = b(), { action: o } = e.content, s;
71
- t[0] !== o || t[1] !== a || t[2] !== n || t[3] !== r || t[4] !== e ? (s = () => {
72
- o?.type === "redirect" && (!n || n.preview || (r?.(e, {
73
- action_type: "redirect",
74
- redirect_url: o.url,
75
- open_in_new_tab: !!o.openInNewTab
76
- }), a("cta_click"), o.openInNewTab ? window.open(o.url, "_blank", "noopener,noreferrer") : window.location.href = o.url));
77
- }, t[0] = o, t[1] = a, t[2] = n, t[3] = r, t[4] = e, t[5] = s) : s = t[5];
78
- let c = s;
79
- return o?.type === "redirect" && o.url ? c : null;
80
- };
81
- //#endregion
82
- export { S as a, w as c, f as d, h as f, u as g, D as h, E as i, d as l, v as m, C as n, _ as o, x as p, T as r, p as s, b as t, m as u };
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes