@vaultix.ai/react 0.3.3 → 0.3.4

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
@@ -87,6 +87,28 @@ interface VaultixContextValue {
87
87
  */
88
88
  connectPlatform: (provider: string, options?: ConnectPlatformOptions) => void;
89
89
  }
90
+ interface VaultixAppearanceVariables {
91
+ /** Primary accent color — used for buttons, focus rings, and icons. Accepts any CSS color value. */
92
+ colorPrimary?: string;
93
+ /** Card / form background. Default: dark glass (rgba(22,27,45,0.92)). */
94
+ colorBackground?: string;
95
+ /** Primary text color. Default: rgba(255,255,255,0.9). */
96
+ colorText?: string;
97
+ /** Secondary / muted text color. Default: #475569. */
98
+ colorTextMuted?: string;
99
+ }
100
+ interface VaultixAppearance {
101
+ variables?: VaultixAppearanceVariables;
102
+ }
103
+ interface PlatformConnectResult {
104
+ provider: string;
105
+ platformUserId?: string;
106
+ username?: string;
107
+ accessToken?: string;
108
+ scope?: string;
109
+ /** Full decoded JWT payload. */
110
+ raw: Record<string, unknown>;
111
+ }
90
112
  interface VaultixProviderProps {
91
113
  publishableKey: string;
92
114
  /** Required for smritix_ keys. The base URL of your auth-engine (no trailing slash). */
@@ -132,6 +154,28 @@ interface UseAuthReturn {
132
154
  /** Returns the session JWT for use in API calls via Authorization: Bearer header. */
133
155
  getToken: () => Promise<string | null>;
134
156
  }
157
+ interface UsePlatformConnectReturn {
158
+ /** Redirect the user to the provider's OAuth authorization page. */
159
+ connect: (overrides?: ConnectPlatformOptions) => void;
160
+ /**
161
+ * Non-null immediately after the OAuth callback lands on the current page.
162
+ * The token is parsed from `__vaultix_connect` in the URL and then removed
163
+ * from the address bar. Null if the user has not connected yet this page load.
164
+ */
165
+ connectedAccount: PlatformConnectResult | null;
166
+ }
167
+ /**
168
+ * Hook for connecting a social/platform account via Vaultix OAuth.
169
+ *
170
+ * @example
171
+ * const { connect, connectedAccount } = usePlatformConnect("google", {
172
+ * scopes: ["https://www.googleapis.com/auth/youtube.upload"],
173
+ * });
174
+ *
175
+ * // After connect() → user returns with __vaultix_connect in URL
176
+ * // connectedAccount.accessToken has the token; URL is cleaned automatically
177
+ */
178
+ declare function usePlatformConnect(provider: string, defaultOptions?: ConnectPlatformOptions): UsePlatformConnectReturn;
135
179
  /** Returns key auth identifiers and helpers. */
136
180
  declare function useAuth(): UseAuthReturn;
137
181
 
@@ -144,8 +188,10 @@ interface SignInProps {
144
188
  /** API origin — injected by VaultixProvider via DOM attribute, or pass directly. */
145
189
  apiOrigin?: string;
146
190
  className?: string;
191
+ /** Override colors and card background. */
192
+ appearance?: VaultixAppearance;
147
193
  }
148
- declare function SignIn({ redirectUrl, onSuccess, onError, apiOrigin: apiOriginProp, className, }: SignInProps): react_jsx_runtime.JSX.Element;
194
+ declare function SignIn({ redirectUrl, onSuccess, onError, apiOrigin: apiOriginProp, className, appearance, }: SignInProps): react_jsx_runtime.JSX.Element;
149
195
 
150
196
  interface SignUpProps {
151
197
  redirectUrl?: string;
@@ -153,8 +199,10 @@ interface SignUpProps {
153
199
  onError?: (message: string) => void;
154
200
  apiOrigin?: string;
155
201
  className?: string;
202
+ /** Override colors and card background. */
203
+ appearance?: VaultixAppearance;
156
204
  }
157
- declare function SignUp({ redirectUrl, onSuccess, onError, apiOrigin: apiOriginProp, className, }: SignUpProps): react_jsx_runtime.JSX.Element;
205
+ declare function SignUp({ redirectUrl, onSuccess, onError, apiOrigin: apiOriginProp, className, appearance, }: SignUpProps): react_jsx_runtime.JSX.Element;
158
206
 
159
207
  /** Renders children only when the user is signed in and auth is loaded. */
160
208
  declare function SignedIn({ children }: {
@@ -192,4 +240,4 @@ declare function getStoredToken(): string | null;
192
240
  /** Clears the stored session JWT. Call on 401 so the user is prompted to sign in again. */
193
241
  declare function clearStoredToken(): void;
194
242
 
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 };
243
+ export { type ChallengeType, type ConnectPlatformOptions, OrganizationSwitcher, type PlatformConnectResult, RedirectToSignIn, RedirectToSignUp, type RiskLevel, type SessionClaims, SignIn, SignUp, SignedIn, SignedOut, type UpdateUserParams, UserButton, type VaultixAppearance, type VaultixAppearanceVariables, type VaultixContextValue, type VaultixOrganization, VaultixProvider, type VaultixProviderProps, type VaultixSession, type VaultixUser, clearStoredToken, getStoredToken, useAuth, useOrganization, usePlatformConnect, useSession, useUser, useVaultix };
package/dist/index.d.ts CHANGED
@@ -87,6 +87,28 @@ interface VaultixContextValue {
87
87
  */
88
88
  connectPlatform: (provider: string, options?: ConnectPlatformOptions) => void;
89
89
  }
90
+ interface VaultixAppearanceVariables {
91
+ /** Primary accent color — used for buttons, focus rings, and icons. Accepts any CSS color value. */
92
+ colorPrimary?: string;
93
+ /** Card / form background. Default: dark glass (rgba(22,27,45,0.92)). */
94
+ colorBackground?: string;
95
+ /** Primary text color. Default: rgba(255,255,255,0.9). */
96
+ colorText?: string;
97
+ /** Secondary / muted text color. Default: #475569. */
98
+ colorTextMuted?: string;
99
+ }
100
+ interface VaultixAppearance {
101
+ variables?: VaultixAppearanceVariables;
102
+ }
103
+ interface PlatformConnectResult {
104
+ provider: string;
105
+ platformUserId?: string;
106
+ username?: string;
107
+ accessToken?: string;
108
+ scope?: string;
109
+ /** Full decoded JWT payload. */
110
+ raw: Record<string, unknown>;
111
+ }
90
112
  interface VaultixProviderProps {
91
113
  publishableKey: string;
92
114
  /** Required for smritix_ keys. The base URL of your auth-engine (no trailing slash). */
@@ -132,6 +154,28 @@ interface UseAuthReturn {
132
154
  /** Returns the session JWT for use in API calls via Authorization: Bearer header. */
133
155
  getToken: () => Promise<string | null>;
134
156
  }
157
+ interface UsePlatformConnectReturn {
158
+ /** Redirect the user to the provider's OAuth authorization page. */
159
+ connect: (overrides?: ConnectPlatformOptions) => void;
160
+ /**
161
+ * Non-null immediately after the OAuth callback lands on the current page.
162
+ * The token is parsed from `__vaultix_connect` in the URL and then removed
163
+ * from the address bar. Null if the user has not connected yet this page load.
164
+ */
165
+ connectedAccount: PlatformConnectResult | null;
166
+ }
167
+ /**
168
+ * Hook for connecting a social/platform account via Vaultix OAuth.
169
+ *
170
+ * @example
171
+ * const { connect, connectedAccount } = usePlatformConnect("google", {
172
+ * scopes: ["https://www.googleapis.com/auth/youtube.upload"],
173
+ * });
174
+ *
175
+ * // After connect() → user returns with __vaultix_connect in URL
176
+ * // connectedAccount.accessToken has the token; URL is cleaned automatically
177
+ */
178
+ declare function usePlatformConnect(provider: string, defaultOptions?: ConnectPlatformOptions): UsePlatformConnectReturn;
135
179
  /** Returns key auth identifiers and helpers. */
136
180
  declare function useAuth(): UseAuthReturn;
137
181
 
@@ -144,8 +188,10 @@ interface SignInProps {
144
188
  /** API origin — injected by VaultixProvider via DOM attribute, or pass directly. */
145
189
  apiOrigin?: string;
146
190
  className?: string;
191
+ /** Override colors and card background. */
192
+ appearance?: VaultixAppearance;
147
193
  }
148
- declare function SignIn({ redirectUrl, onSuccess, onError, apiOrigin: apiOriginProp, className, }: SignInProps): react_jsx_runtime.JSX.Element;
194
+ declare function SignIn({ redirectUrl, onSuccess, onError, apiOrigin: apiOriginProp, className, appearance, }: SignInProps): react_jsx_runtime.JSX.Element;
149
195
 
150
196
  interface SignUpProps {
151
197
  redirectUrl?: string;
@@ -153,8 +199,10 @@ interface SignUpProps {
153
199
  onError?: (message: string) => void;
154
200
  apiOrigin?: string;
155
201
  className?: string;
202
+ /** Override colors and card background. */
203
+ appearance?: VaultixAppearance;
156
204
  }
157
- declare function SignUp({ redirectUrl, onSuccess, onError, apiOrigin: apiOriginProp, className, }: SignUpProps): react_jsx_runtime.JSX.Element;
205
+ declare function SignUp({ redirectUrl, onSuccess, onError, apiOrigin: apiOriginProp, className, appearance, }: SignUpProps): react_jsx_runtime.JSX.Element;
158
206
 
159
207
  /** Renders children only when the user is signed in and auth is loaded. */
160
208
  declare function SignedIn({ children }: {
@@ -192,4 +240,4 @@ declare function getStoredToken(): string | null;
192
240
  /** Clears the stored session JWT. Call on 401 so the user is prompted to sign in again. */
193
241
  declare function clearStoredToken(): void;
194
242
 
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 };
243
+ export { type ChallengeType, type ConnectPlatformOptions, OrganizationSwitcher, type PlatformConnectResult, RedirectToSignIn, RedirectToSignUp, type RiskLevel, type SessionClaims, SignIn, SignUp, SignedIn, SignedOut, type UpdateUserParams, UserButton, type VaultixAppearance, type VaultixAppearanceVariables, type VaultixContextValue, type VaultixOrganization, VaultixProvider, type VaultixProviderProps, type VaultixSession, type VaultixUser, clearStoredToken, getStoredToken, useAuth, useOrganization, usePlatformConnect, useSession, useUser, useVaultix };