@vaultix.ai/react 0.1.0

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.
@@ -0,0 +1,121 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+
3
+ type RiskLevel = "low" | "medium" | "high" | "critical";
4
+ type ChallengeType = "passkey" | "magic_link" | "password" | "totp" | "sms_otp" | "email_otp";
5
+ interface SessionClaims {
6
+ sub: string;
7
+ org_id: string;
8
+ org_role: string;
9
+ email: string;
10
+ email_verified: boolean;
11
+ device_id: string;
12
+ risk_level: RiskLevel;
13
+ iat: number;
14
+ exp: number;
15
+ jti: string;
16
+ }
17
+ interface VaultixUser {
18
+ id: string;
19
+ email: string;
20
+ emailVerified: boolean;
21
+ firstName: string | null;
22
+ lastName: string | null;
23
+ imageUrl: string | null;
24
+ createdAt: number;
25
+ updatedAt: number;
26
+ }
27
+ interface VaultixOrganization {
28
+ id: string;
29
+ name: string;
30
+ slug: string;
31
+ role: string;
32
+ permissions: string[];
33
+ entitlements: Record<string, boolean>;
34
+ }
35
+ interface VaultixSession {
36
+ id: string;
37
+ userId: string;
38
+ orgId: string | null;
39
+ deviceId: string;
40
+ riskLevel: RiskLevel;
41
+ expiresAt: number;
42
+ claims: SessionClaims;
43
+ }
44
+ interface VaultixContextValue {
45
+ user: VaultixUser | null;
46
+ session: VaultixSession | null;
47
+ organization: VaultixOrganization | null;
48
+ isLoaded: boolean;
49
+ isSignedIn: boolean;
50
+ signOut: () => Promise<void>;
51
+ }
52
+ interface VaultixProviderProps {
53
+ publishableKey: string;
54
+ /** Required for smritix_ keys. The base URL of your auth-engine (no trailing slash). */
55
+ apiUrl?: string;
56
+ children: React.ReactNode;
57
+ afterSignInUrl?: string;
58
+ afterSignUpUrl?: string;
59
+ }
60
+
61
+ declare function VaultixProvider({ publishableKey, apiUrl, children, afterSignInUrl, afterSignUpUrl, }: VaultixProviderProps): react_jsx_runtime.JSX.Element;
62
+
63
+ interface UseSessionReturn {
64
+ session: VaultixSession | null;
65
+ isLoaded: boolean;
66
+ isSignedIn: boolean;
67
+ }
68
+ interface UseUserReturn {
69
+ user: VaultixUser | null;
70
+ isLoaded: boolean;
71
+ isSignedIn: boolean;
72
+ }
73
+ interface UseOrganizationReturn {
74
+ organization: VaultixOrganization | null;
75
+ isLoaded: boolean;
76
+ }
77
+ /** Raw access to the full Vaultix context. */
78
+ declare function useVaultix(): VaultixContextValue;
79
+ /** Returns the current session and its loading state. */
80
+ declare function useSession(): UseSessionReturn;
81
+ /** Returns the current user and their loading state. */
82
+ declare function useUser(): UseUserReturn;
83
+ /** Returns the active organization for the current session. */
84
+ declare function useOrganization(): UseOrganizationReturn;
85
+
86
+ interface SignInProps {
87
+ /** Redirect URL after a successful sign-in. Overrides the provider default. */
88
+ redirectUrl?: string;
89
+ /** Called with the raw session claims after successful sign-in. */
90
+ onSuccess?: (sessionId: string) => void;
91
+ onError?: (message: string) => void;
92
+ /** API origin — injected by VaultixProvider via DOM attribute, or pass directly. */
93
+ apiOrigin?: string;
94
+ className?: string;
95
+ }
96
+ declare function SignIn({ redirectUrl, onSuccess, onError, apiOrigin: apiOriginProp, className, }: SignInProps): react_jsx_runtime.JSX.Element;
97
+
98
+ interface SignUpProps {
99
+ redirectUrl?: string;
100
+ onSuccess?: (sessionId: string) => void;
101
+ onError?: (message: string) => void;
102
+ apiOrigin?: string;
103
+ className?: string;
104
+ }
105
+ declare function SignUp({ redirectUrl, onSuccess, onError, apiOrigin: apiOriginProp, className, }: SignUpProps): react_jsx_runtime.JSX.Element;
106
+
107
+ interface UserButtonProps {
108
+ /** Show the user's name next to the avatar. Default false. */
109
+ showName?: boolean;
110
+ afterSignOutUrl?: string;
111
+ className?: string;
112
+ }
113
+ declare function UserButton({ showName, afterSignOutUrl, className, }: UserButtonProps): react_jsx_runtime.JSX.Element | null;
114
+
115
+ interface OrganizationSwitcherProps {
116
+ afterSwitchUrl?: string;
117
+ className?: string;
118
+ }
119
+ declare function OrganizationSwitcher({ afterSwitchUrl, className, }: OrganizationSwitcherProps): react_jsx_runtime.JSX.Element | null;
120
+
121
+ export { type ChallengeType, OrganizationSwitcher, type RiskLevel, type SessionClaims, SignIn, SignUp, UserButton, type VaultixContextValue, type VaultixOrganization, VaultixProvider, type VaultixProviderProps, type VaultixSession, type VaultixUser, useOrganization, useSession, useUser, useVaultix };
@@ -0,0 +1,121 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+
3
+ type RiskLevel = "low" | "medium" | "high" | "critical";
4
+ type ChallengeType = "passkey" | "magic_link" | "password" | "totp" | "sms_otp" | "email_otp";
5
+ interface SessionClaims {
6
+ sub: string;
7
+ org_id: string;
8
+ org_role: string;
9
+ email: string;
10
+ email_verified: boolean;
11
+ device_id: string;
12
+ risk_level: RiskLevel;
13
+ iat: number;
14
+ exp: number;
15
+ jti: string;
16
+ }
17
+ interface VaultixUser {
18
+ id: string;
19
+ email: string;
20
+ emailVerified: boolean;
21
+ firstName: string | null;
22
+ lastName: string | null;
23
+ imageUrl: string | null;
24
+ createdAt: number;
25
+ updatedAt: number;
26
+ }
27
+ interface VaultixOrganization {
28
+ id: string;
29
+ name: string;
30
+ slug: string;
31
+ role: string;
32
+ permissions: string[];
33
+ entitlements: Record<string, boolean>;
34
+ }
35
+ interface VaultixSession {
36
+ id: string;
37
+ userId: string;
38
+ orgId: string | null;
39
+ deviceId: string;
40
+ riskLevel: RiskLevel;
41
+ expiresAt: number;
42
+ claims: SessionClaims;
43
+ }
44
+ interface VaultixContextValue {
45
+ user: VaultixUser | null;
46
+ session: VaultixSession | null;
47
+ organization: VaultixOrganization | null;
48
+ isLoaded: boolean;
49
+ isSignedIn: boolean;
50
+ signOut: () => Promise<void>;
51
+ }
52
+ interface VaultixProviderProps {
53
+ publishableKey: string;
54
+ /** Required for smritix_ keys. The base URL of your auth-engine (no trailing slash). */
55
+ apiUrl?: string;
56
+ children: React.ReactNode;
57
+ afterSignInUrl?: string;
58
+ afterSignUpUrl?: string;
59
+ }
60
+
61
+ declare function VaultixProvider({ publishableKey, apiUrl, children, afterSignInUrl, afterSignUpUrl, }: VaultixProviderProps): react_jsx_runtime.JSX.Element;
62
+
63
+ interface UseSessionReturn {
64
+ session: VaultixSession | null;
65
+ isLoaded: boolean;
66
+ isSignedIn: boolean;
67
+ }
68
+ interface UseUserReturn {
69
+ user: VaultixUser | null;
70
+ isLoaded: boolean;
71
+ isSignedIn: boolean;
72
+ }
73
+ interface UseOrganizationReturn {
74
+ organization: VaultixOrganization | null;
75
+ isLoaded: boolean;
76
+ }
77
+ /** Raw access to the full Vaultix context. */
78
+ declare function useVaultix(): VaultixContextValue;
79
+ /** Returns the current session and its loading state. */
80
+ declare function useSession(): UseSessionReturn;
81
+ /** Returns the current user and their loading state. */
82
+ declare function useUser(): UseUserReturn;
83
+ /** Returns the active organization for the current session. */
84
+ declare function useOrganization(): UseOrganizationReturn;
85
+
86
+ interface SignInProps {
87
+ /** Redirect URL after a successful sign-in. Overrides the provider default. */
88
+ redirectUrl?: string;
89
+ /** Called with the raw session claims after successful sign-in. */
90
+ onSuccess?: (sessionId: string) => void;
91
+ onError?: (message: string) => void;
92
+ /** API origin — injected by VaultixProvider via DOM attribute, or pass directly. */
93
+ apiOrigin?: string;
94
+ className?: string;
95
+ }
96
+ declare function SignIn({ redirectUrl, onSuccess, onError, apiOrigin: apiOriginProp, className, }: SignInProps): react_jsx_runtime.JSX.Element;
97
+
98
+ interface SignUpProps {
99
+ redirectUrl?: string;
100
+ onSuccess?: (sessionId: string) => void;
101
+ onError?: (message: string) => void;
102
+ apiOrigin?: string;
103
+ className?: string;
104
+ }
105
+ declare function SignUp({ redirectUrl, onSuccess, onError, apiOrigin: apiOriginProp, className, }: SignUpProps): react_jsx_runtime.JSX.Element;
106
+
107
+ interface UserButtonProps {
108
+ /** Show the user's name next to the avatar. Default false. */
109
+ showName?: boolean;
110
+ afterSignOutUrl?: string;
111
+ className?: string;
112
+ }
113
+ declare function UserButton({ showName, afterSignOutUrl, className, }: UserButtonProps): react_jsx_runtime.JSX.Element | null;
114
+
115
+ interface OrganizationSwitcherProps {
116
+ afterSwitchUrl?: string;
117
+ className?: string;
118
+ }
119
+ declare function OrganizationSwitcher({ afterSwitchUrl, className, }: OrganizationSwitcherProps): react_jsx_runtime.JSX.Element | null;
120
+
121
+ export { type ChallengeType, OrganizationSwitcher, type RiskLevel, type SessionClaims, SignIn, SignUp, UserButton, type VaultixContextValue, type VaultixOrganization, VaultixProvider, type VaultixProviderProps, type VaultixSession, type VaultixUser, useOrganization, useSession, useUser, useVaultix };