@vaultix.ai/react 0.3.2 → 0.3.3

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 CHANGED
@@ -22,6 +22,7 @@ interface VaultixUser {
22
22
  firstName: string | null;
23
23
  lastName: string | null;
24
24
  imageUrl: string | null;
25
+ publicMetadata: Record<string, unknown>;
25
26
  createdAt: number;
26
27
  updatedAt: number;
27
28
  }
@@ -58,13 +59,26 @@ interface ConnectPlatformOptions {
58
59
  /** Where to redirect after the user authorizes. Defaults to current page. */
59
60
  redirectUrl?: string;
60
61
  }
62
+ interface UpdateUserParams {
63
+ firstName?: string | null;
64
+ lastName?: string | null;
65
+ imageUrl?: string | null;
66
+ publicMetadata?: Record<string, unknown>;
67
+ /** Requires currentPassword when changing password. */
68
+ newPassword?: string;
69
+ currentPassword?: string;
70
+ }
61
71
  interface VaultixContextValue {
62
72
  user: VaultixUser | null;
63
73
  session: VaultixSession | null;
64
74
  organization: VaultixOrganization | null;
65
75
  isLoaded: boolean;
66
76
  isSignedIn: boolean;
67
- signOut: () => Promise<void>;
77
+ /** Resolved API origin derived from the publishable key. */
78
+ apiOrigin: string;
79
+ signOut: (redirectUrl?: string) => Promise<void>;
80
+ /** Update the current user's profile. Resolves with the updated user. */
81
+ updateUser: (params: UpdateUserParams) => Promise<VaultixUser>;
68
82
  /**
69
83
  * Initiate a platform OAuth connection flow (posting, reading, etc.).
70
84
  * Redirects the user to the provider's authorization page via Vaultix.
@@ -93,6 +107,8 @@ interface UseUserReturn {
93
107
  user: VaultixUser | null;
94
108
  isLoaded: boolean;
95
109
  isSignedIn: boolean;
110
+ /** Update the current user's profile fields or password. */
111
+ update: (params: UpdateUserParams) => Promise<VaultixUser>;
96
112
  }
97
113
  interface UseOrganizationReturn {
98
114
  organization: VaultixOrganization | null;
@@ -102,7 +118,7 @@ interface UseOrganizationReturn {
102
118
  declare function useVaultix(): VaultixContextValue;
103
119
  /** Returns the current session and its loading state. */
104
120
  declare function useSession(): UseSessionReturn;
105
- /** Returns the current user and their loading state. */
121
+ /** Returns the current user, their loading state, and an update function. */
106
122
  declare function useUser(): UseUserReturn;
107
123
  /** Returns the active organization for the current session. */
108
124
  declare function useOrganization(): UseOrganizationReturn;
@@ -116,7 +132,7 @@ interface UseAuthReturn {
116
132
  /** Returns the session JWT for use in API calls via Authorization: Bearer header. */
117
133
  getToken: () => Promise<string | null>;
118
134
  }
119
- /** Clerk-compatible auth hook. Returns key auth identifiers and helpers. */
135
+ /** Returns key auth identifiers and helpers. */
120
136
  declare function useAuth(): UseAuthReturn;
121
137
 
122
138
  interface SignInProps {
@@ -159,12 +175,11 @@ declare function RedirectToSignIn({ redirectUrl }: RedirectProps): null;
159
175
  declare function RedirectToSignUp({ redirectUrl }: RedirectProps): null;
160
176
 
161
177
  interface UserButtonProps {
162
- /** Show the user's name next to the avatar. Default false. */
163
178
  showName?: boolean;
164
179
  afterSignOutUrl?: string;
165
180
  className?: string;
166
181
  }
167
- declare function UserButton({ showName, afterSignOutUrl, className, }: UserButtonProps): react_jsx_runtime.JSX.Element | null;
182
+ declare function UserButton({ showName, afterSignOutUrl, className }: UserButtonProps): react_jsx_runtime.JSX.Element | null;
168
183
 
169
184
  interface OrganizationSwitcherProps {
170
185
  afterSwitchUrl?: string;
@@ -172,9 +187,9 @@ interface OrganizationSwitcherProps {
172
187
  }
173
188
  declare function OrganizationSwitcher({ afterSwitchUrl, className, }: OrganizationSwitcherProps): react_jsx_runtime.JSX.Element | null;
174
189
 
175
- /** Returns the stored session JWT, or null if not signed in. */
190
+ /** Returns the stored session JWT from the vaultix-token cookie, or null if not signed in. */
176
191
  declare function getStoredToken(): string | null;
177
192
  /** Clears the stored session JWT. Call on 401 so the user is prompted to sign in again. */
178
193
  declare function clearStoredToken(): void;
179
194
 
180
- export { type ChallengeType, type ConnectPlatformOptions, OrganizationSwitcher, RedirectToSignIn, RedirectToSignUp, type RiskLevel, type SessionClaims, SignIn, SignUp, SignedIn, SignedOut, UserButton, type VaultixContextValue, type VaultixOrganization, VaultixProvider, type VaultixProviderProps, type VaultixSession, type VaultixUser, clearStoredToken, getStoredToken, useAuth, useOrganization, useSession, useUser, useVaultix };
195
+ export { type ChallengeType, type ConnectPlatformOptions, OrganizationSwitcher, RedirectToSignIn, RedirectToSignUp, type RiskLevel, type SessionClaims, SignIn, SignUp, SignedIn, SignedOut, type UpdateUserParams, UserButton, type VaultixContextValue, type VaultixOrganization, VaultixProvider, type VaultixProviderProps, type VaultixSession, type VaultixUser, clearStoredToken, getStoredToken, useAuth, useOrganization, useSession, useUser, useVaultix };
package/dist/index.d.ts CHANGED
@@ -22,6 +22,7 @@ interface VaultixUser {
22
22
  firstName: string | null;
23
23
  lastName: string | null;
24
24
  imageUrl: string | null;
25
+ publicMetadata: Record<string, unknown>;
25
26
  createdAt: number;
26
27
  updatedAt: number;
27
28
  }
@@ -58,13 +59,26 @@ interface ConnectPlatformOptions {
58
59
  /** Where to redirect after the user authorizes. Defaults to current page. */
59
60
  redirectUrl?: string;
60
61
  }
62
+ interface UpdateUserParams {
63
+ firstName?: string | null;
64
+ lastName?: string | null;
65
+ imageUrl?: string | null;
66
+ publicMetadata?: Record<string, unknown>;
67
+ /** Requires currentPassword when changing password. */
68
+ newPassword?: string;
69
+ currentPassword?: string;
70
+ }
61
71
  interface VaultixContextValue {
62
72
  user: VaultixUser | null;
63
73
  session: VaultixSession | null;
64
74
  organization: VaultixOrganization | null;
65
75
  isLoaded: boolean;
66
76
  isSignedIn: boolean;
67
- signOut: () => Promise<void>;
77
+ /** Resolved API origin derived from the publishable key. */
78
+ apiOrigin: string;
79
+ signOut: (redirectUrl?: string) => Promise<void>;
80
+ /** Update the current user's profile. Resolves with the updated user. */
81
+ updateUser: (params: UpdateUserParams) => Promise<VaultixUser>;
68
82
  /**
69
83
  * Initiate a platform OAuth connection flow (posting, reading, etc.).
70
84
  * Redirects the user to the provider's authorization page via Vaultix.
@@ -93,6 +107,8 @@ interface UseUserReturn {
93
107
  user: VaultixUser | null;
94
108
  isLoaded: boolean;
95
109
  isSignedIn: boolean;
110
+ /** Update the current user's profile fields or password. */
111
+ update: (params: UpdateUserParams) => Promise<VaultixUser>;
96
112
  }
97
113
  interface UseOrganizationReturn {
98
114
  organization: VaultixOrganization | null;
@@ -102,7 +118,7 @@ interface UseOrganizationReturn {
102
118
  declare function useVaultix(): VaultixContextValue;
103
119
  /** Returns the current session and its loading state. */
104
120
  declare function useSession(): UseSessionReturn;
105
- /** Returns the current user and their loading state. */
121
+ /** Returns the current user, their loading state, and an update function. */
106
122
  declare function useUser(): UseUserReturn;
107
123
  /** Returns the active organization for the current session. */
108
124
  declare function useOrganization(): UseOrganizationReturn;
@@ -116,7 +132,7 @@ interface UseAuthReturn {
116
132
  /** Returns the session JWT for use in API calls via Authorization: Bearer header. */
117
133
  getToken: () => Promise<string | null>;
118
134
  }
119
- /** Clerk-compatible auth hook. Returns key auth identifiers and helpers. */
135
+ /** Returns key auth identifiers and helpers. */
120
136
  declare function useAuth(): UseAuthReturn;
121
137
 
122
138
  interface SignInProps {
@@ -159,12 +175,11 @@ declare function RedirectToSignIn({ redirectUrl }: RedirectProps): null;
159
175
  declare function RedirectToSignUp({ redirectUrl }: RedirectProps): null;
160
176
 
161
177
  interface UserButtonProps {
162
- /** Show the user's name next to the avatar. Default false. */
163
178
  showName?: boolean;
164
179
  afterSignOutUrl?: string;
165
180
  className?: string;
166
181
  }
167
- declare function UserButton({ showName, afterSignOutUrl, className, }: UserButtonProps): react_jsx_runtime.JSX.Element | null;
182
+ declare function UserButton({ showName, afterSignOutUrl, className }: UserButtonProps): react_jsx_runtime.JSX.Element | null;
168
183
 
169
184
  interface OrganizationSwitcherProps {
170
185
  afterSwitchUrl?: string;
@@ -172,9 +187,9 @@ interface OrganizationSwitcherProps {
172
187
  }
173
188
  declare function OrganizationSwitcher({ afterSwitchUrl, className, }: OrganizationSwitcherProps): react_jsx_runtime.JSX.Element | null;
174
189
 
175
- /** Returns the stored session JWT, or null if not signed in. */
190
+ /** Returns the stored session JWT from the vaultix-token cookie, or null if not signed in. */
176
191
  declare function getStoredToken(): string | null;
177
192
  /** Clears the stored session JWT. Call on 401 so the user is prompted to sign in again. */
178
193
  declare function clearStoredToken(): void;
179
194
 
180
- export { type ChallengeType, type ConnectPlatformOptions, OrganizationSwitcher, RedirectToSignIn, RedirectToSignUp, type RiskLevel, type SessionClaims, SignIn, SignUp, SignedIn, SignedOut, UserButton, type VaultixContextValue, type VaultixOrganization, VaultixProvider, type VaultixProviderProps, type VaultixSession, type VaultixUser, clearStoredToken, getStoredToken, useAuth, useOrganization, useSession, useUser, useVaultix };
195
+ export { type ChallengeType, type ConnectPlatformOptions, OrganizationSwitcher, RedirectToSignIn, RedirectToSignUp, type RiskLevel, type SessionClaims, SignIn, SignUp, SignedIn, SignedOut, type UpdateUserParams, UserButton, type VaultixContextValue, type VaultixOrganization, VaultixProvider, type VaultixProviderProps, type VaultixSession, type VaultixUser, clearStoredToken, getStoredToken, useAuth, useOrganization, useSession, useUser, useVaultix };