@vaultix.ai/react 0.1.0 → 0.2.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.
- package/dist/index.d.mts +35 -4
- package/dist/index.d.ts +35 -4
- package/dist/index.js +481 -202
- package/dist/index.mjs +435 -161
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import React$1 from 'react';
|
|
2
3
|
|
|
3
4
|
type RiskLevel = "low" | "medium" | "high" | "critical";
|
|
4
5
|
type ChallengeType = "passkey" | "magic_link" | "password" | "totp" | "sms_otp" | "email_otp";
|
|
@@ -82,12 +83,24 @@ declare function useSession(): UseSessionReturn;
|
|
|
82
83
|
declare function useUser(): UseUserReturn;
|
|
83
84
|
/** Returns the active organization for the current session. */
|
|
84
85
|
declare function useOrganization(): UseOrganizationReturn;
|
|
86
|
+
interface UseAuthReturn {
|
|
87
|
+
isLoaded: boolean;
|
|
88
|
+
isSignedIn: boolean;
|
|
89
|
+
userId: string | null;
|
|
90
|
+
sessionId: string | null;
|
|
91
|
+
orgId: string | null;
|
|
92
|
+
signOut: () => Promise<void>;
|
|
93
|
+
/** Returns the session JWT for use in API calls via Authorization: Bearer header. */
|
|
94
|
+
getToken: () => Promise<string | null>;
|
|
95
|
+
}
|
|
96
|
+
/** Clerk-compatible auth hook. Returns key auth identifiers and helpers. */
|
|
97
|
+
declare function useAuth(): UseAuthReturn;
|
|
85
98
|
|
|
86
99
|
interface SignInProps {
|
|
87
100
|
/** Redirect URL after a successful sign-in. Overrides the provider default. */
|
|
88
101
|
redirectUrl?: string;
|
|
89
|
-
/** Called with the
|
|
90
|
-
onSuccess?: (
|
|
102
|
+
/** Called with the handshake token after successful sign-in. */
|
|
103
|
+
onSuccess?: (handshakeToken: string) => void;
|
|
91
104
|
onError?: (message: string) => void;
|
|
92
105
|
/** API origin — injected by VaultixProvider via DOM attribute, or pass directly. */
|
|
93
106
|
apiOrigin?: string;
|
|
@@ -97,13 +110,31 @@ declare function SignIn({ redirectUrl, onSuccess, onError, apiOrigin: apiOriginP
|
|
|
97
110
|
|
|
98
111
|
interface SignUpProps {
|
|
99
112
|
redirectUrl?: string;
|
|
100
|
-
onSuccess?: (
|
|
113
|
+
onSuccess?: (handshakeToken: string) => void;
|
|
101
114
|
onError?: (message: string) => void;
|
|
102
115
|
apiOrigin?: string;
|
|
103
116
|
className?: string;
|
|
104
117
|
}
|
|
105
118
|
declare function SignUp({ redirectUrl, onSuccess, onError, apiOrigin: apiOriginProp, className, }: SignUpProps): react_jsx_runtime.JSX.Element;
|
|
106
119
|
|
|
120
|
+
/** Renders children only when the user is signed in and auth is loaded. */
|
|
121
|
+
declare function SignedIn({ children }: {
|
|
122
|
+
children: React$1.ReactNode;
|
|
123
|
+
}): react_jsx_runtime.JSX.Element | null;
|
|
124
|
+
/** Renders children only when the user is signed out and auth is loaded. */
|
|
125
|
+
declare function SignedOut({ children }: {
|
|
126
|
+
children: React$1.ReactNode;
|
|
127
|
+
}): react_jsx_runtime.JSX.Element | null;
|
|
128
|
+
|
|
129
|
+
interface RedirectProps {
|
|
130
|
+
/** Override the default redirect URL. */
|
|
131
|
+
redirectUrl?: string;
|
|
132
|
+
}
|
|
133
|
+
/** Redirects to /sign-in when the user is not authenticated. */
|
|
134
|
+
declare function RedirectToSignIn({ redirectUrl }: RedirectProps): null;
|
|
135
|
+
/** Redirects to /sign-up when the user is not authenticated. */
|
|
136
|
+
declare function RedirectToSignUp({ redirectUrl }: RedirectProps): null;
|
|
137
|
+
|
|
107
138
|
interface UserButtonProps {
|
|
108
139
|
/** Show the user's name next to the avatar. Default false. */
|
|
109
140
|
showName?: boolean;
|
|
@@ -118,4 +149,4 @@ interface OrganizationSwitcherProps {
|
|
|
118
149
|
}
|
|
119
150
|
declare function OrganizationSwitcher({ afterSwitchUrl, className, }: OrganizationSwitcherProps): react_jsx_runtime.JSX.Element | null;
|
|
120
151
|
|
|
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 };
|
|
152
|
+
export { type ChallengeType, OrganizationSwitcher, RedirectToSignIn, RedirectToSignUp, type RiskLevel, type SessionClaims, SignIn, SignUp, SignedIn, SignedOut, UserButton, type VaultixContextValue, type VaultixOrganization, VaultixProvider, type VaultixProviderProps, type VaultixSession, type VaultixUser, useAuth, useOrganization, useSession, useUser, useVaultix };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import React$1 from 'react';
|
|
2
3
|
|
|
3
4
|
type RiskLevel = "low" | "medium" | "high" | "critical";
|
|
4
5
|
type ChallengeType = "passkey" | "magic_link" | "password" | "totp" | "sms_otp" | "email_otp";
|
|
@@ -82,12 +83,24 @@ declare function useSession(): UseSessionReturn;
|
|
|
82
83
|
declare function useUser(): UseUserReturn;
|
|
83
84
|
/** Returns the active organization for the current session. */
|
|
84
85
|
declare function useOrganization(): UseOrganizationReturn;
|
|
86
|
+
interface UseAuthReturn {
|
|
87
|
+
isLoaded: boolean;
|
|
88
|
+
isSignedIn: boolean;
|
|
89
|
+
userId: string | null;
|
|
90
|
+
sessionId: string | null;
|
|
91
|
+
orgId: string | null;
|
|
92
|
+
signOut: () => Promise<void>;
|
|
93
|
+
/** Returns the session JWT for use in API calls via Authorization: Bearer header. */
|
|
94
|
+
getToken: () => Promise<string | null>;
|
|
95
|
+
}
|
|
96
|
+
/** Clerk-compatible auth hook. Returns key auth identifiers and helpers. */
|
|
97
|
+
declare function useAuth(): UseAuthReturn;
|
|
85
98
|
|
|
86
99
|
interface SignInProps {
|
|
87
100
|
/** Redirect URL after a successful sign-in. Overrides the provider default. */
|
|
88
101
|
redirectUrl?: string;
|
|
89
|
-
/** Called with the
|
|
90
|
-
onSuccess?: (
|
|
102
|
+
/** Called with the handshake token after successful sign-in. */
|
|
103
|
+
onSuccess?: (handshakeToken: string) => void;
|
|
91
104
|
onError?: (message: string) => void;
|
|
92
105
|
/** API origin — injected by VaultixProvider via DOM attribute, or pass directly. */
|
|
93
106
|
apiOrigin?: string;
|
|
@@ -97,13 +110,31 @@ declare function SignIn({ redirectUrl, onSuccess, onError, apiOrigin: apiOriginP
|
|
|
97
110
|
|
|
98
111
|
interface SignUpProps {
|
|
99
112
|
redirectUrl?: string;
|
|
100
|
-
onSuccess?: (
|
|
113
|
+
onSuccess?: (handshakeToken: string) => void;
|
|
101
114
|
onError?: (message: string) => void;
|
|
102
115
|
apiOrigin?: string;
|
|
103
116
|
className?: string;
|
|
104
117
|
}
|
|
105
118
|
declare function SignUp({ redirectUrl, onSuccess, onError, apiOrigin: apiOriginProp, className, }: SignUpProps): react_jsx_runtime.JSX.Element;
|
|
106
119
|
|
|
120
|
+
/** Renders children only when the user is signed in and auth is loaded. */
|
|
121
|
+
declare function SignedIn({ children }: {
|
|
122
|
+
children: React$1.ReactNode;
|
|
123
|
+
}): react_jsx_runtime.JSX.Element | null;
|
|
124
|
+
/** Renders children only when the user is signed out and auth is loaded. */
|
|
125
|
+
declare function SignedOut({ children }: {
|
|
126
|
+
children: React$1.ReactNode;
|
|
127
|
+
}): react_jsx_runtime.JSX.Element | null;
|
|
128
|
+
|
|
129
|
+
interface RedirectProps {
|
|
130
|
+
/** Override the default redirect URL. */
|
|
131
|
+
redirectUrl?: string;
|
|
132
|
+
}
|
|
133
|
+
/** Redirects to /sign-in when the user is not authenticated. */
|
|
134
|
+
declare function RedirectToSignIn({ redirectUrl }: RedirectProps): null;
|
|
135
|
+
/** Redirects to /sign-up when the user is not authenticated. */
|
|
136
|
+
declare function RedirectToSignUp({ redirectUrl }: RedirectProps): null;
|
|
137
|
+
|
|
107
138
|
interface UserButtonProps {
|
|
108
139
|
/** Show the user's name next to the avatar. Default false. */
|
|
109
140
|
showName?: boolean;
|
|
@@ -118,4 +149,4 @@ interface OrganizationSwitcherProps {
|
|
|
118
149
|
}
|
|
119
150
|
declare function OrganizationSwitcher({ afterSwitchUrl, className, }: OrganizationSwitcherProps): react_jsx_runtime.JSX.Element | null;
|
|
120
151
|
|
|
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 };
|
|
152
|
+
export { type ChallengeType, OrganizationSwitcher, RedirectToSignIn, RedirectToSignUp, type RiskLevel, type SessionClaims, SignIn, SignUp, SignedIn, SignedOut, UserButton, type VaultixContextValue, type VaultixOrganization, VaultixProvider, type VaultixProviderProps, type VaultixSession, type VaultixUser, useAuth, useOrganization, useSession, useUser, useVaultix };
|