@abaxx_tech/v-integration-react 1.2.0-dev.5 → 1.2.0-dev.7
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/README.md +37 -1
- package/dist/v-integration-react.css +1 -1
- package/dist/v-integration-react.d.ts +326 -1
- package/dist/v-integration-react.js +652 -580
- package/dist/v-integration-react.umd.cjs +3 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
- **Token Management**: Provides authentication token through React Context.
|
|
9
9
|
- **Real-time Authentication**: Server-Sent Events (SSE) for real-time authentication status updates.
|
|
10
10
|
- **PKCE Flow**: Implements OAuth 2.0 PKCE (Proof Key for Code Exchange) for secure authentication.
|
|
11
|
-
- **Error Handling**: Comprehensive error handling and user feedback.
|
|
11
|
+
- **Error Handling**: Comprehensive error handling and user feedback with React Error Boundary for graceful error recovery.
|
|
12
12
|
- **Customizable Styling**: Full control over colors, sizes, and text with support for both Tailwind classes and hex colors.
|
|
13
13
|
- **Background Authentication Service**: Automatic token management and authentication flow handling.
|
|
14
14
|
- **State Reset**: Built-in functionality to reset authentication state back to initial values.
|
|
@@ -201,6 +201,7 @@ Complete authentication UI with QR code and email input. This component provides
|
|
|
201
201
|
- Real-time authentication status updates
|
|
202
202
|
- Loading states and error handling
|
|
203
203
|
- Responsive design with grid layout
|
|
204
|
+
- Automatic error boundary protection for React errors
|
|
204
205
|
|
|
205
206
|
### `VerifierAuthQr`
|
|
206
207
|
QR code authentication component only. Displays a QR code that users can scan with the Verifier+ app for authentication.
|
|
@@ -252,6 +253,41 @@ Email input authentication component only. Provides a standalone email/Abaxx ID
|
|
|
252
253
|
- Customizable styling with support for both Tailwind classes and hex colors
|
|
253
254
|
- Error handling with user feedback
|
|
254
255
|
- Success state with checkmark icon
|
|
256
|
+
- Automatic error boundary protection for React errors
|
|
257
|
+
|
|
258
|
+
## Error Handling
|
|
259
|
+
|
|
260
|
+
### React Error Boundary
|
|
261
|
+
|
|
262
|
+
All authentication components (`VerifierAuth`, `VerifierAuthQr`, and `VerifierAuthEmail`) are automatically wrapped with an `AuthErrorBoundary` component that catches React errors during rendering or in lifecycle methods.
|
|
263
|
+
|
|
264
|
+
#### Features:
|
|
265
|
+
- **Automatic Error Catching**: Catches errors that occur in the component tree during rendering
|
|
266
|
+
- **User-Friendly Error UI**: Displays a centered error message with a dark overlay background
|
|
267
|
+
- **Error Recovery**: Provides a "Try Again" button to reset the error state and retry
|
|
268
|
+
- **Error Logging**: Automatically logs errors to the console for debugging
|
|
269
|
+
|
|
270
|
+
#### Error Display:
|
|
271
|
+
When an error occurs, users will see:
|
|
272
|
+
- A centered error message: "Something went wrong"
|
|
273
|
+
- A descriptive message: "An unexpected error occurred during authentication. Please try again."
|
|
274
|
+
- A "Try Again" button to reset the error state
|
|
275
|
+
|
|
276
|
+
The error boundary uses a fixed position overlay that covers the entire viewport, ensuring the error message is always visible and centered both vertically and horizontally.
|
|
277
|
+
|
|
278
|
+
#### Example:
|
|
279
|
+
```tsx
|
|
280
|
+
// Error boundary is automatically included - no additional setup needed
|
|
281
|
+
import { VerifierAuth } from "@abaxx_tech/v-integration-react";
|
|
282
|
+
|
|
283
|
+
const LoginPage = () => {
|
|
284
|
+
// If any error occurs in VerifierAuth or its children,
|
|
285
|
+
// the error boundary will catch it and display the error UI
|
|
286
|
+
return <VerifierAuth title="Abaxx Drive" />;
|
|
287
|
+
};
|
|
288
|
+
```
|
|
289
|
+
|
|
290
|
+
**Note**: The error boundary only catches errors in React components. For network errors or API errors, use the `authError` property from `VContext` to handle them in your application logic.
|
|
255
291
|
|
|
256
292
|
## Context API
|
|
257
293
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.v-auth-container *,.v-auth-container *:before,.v-auth-container *:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}.v-auth-container{font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif;line-height:1.5}.v-grid{display:grid}.v-grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.v-grid-responsive{grid-template-columns:1fr}@media (min-width: 768px){.v-grid-responsive{grid-template-columns:1fr 1fr}}.v-h-screen{height:100vh}.v-bg-white{background-color:#fff}.v-bg-left{display:none}@media (min-width: 768px){.v-bg-left{display:block}}.v-flex{display:flex}.v-flex-col{flex-direction:column}.v-items-center{align-items:center}.v-justify-center{justify-content:center}.v-gap-2{gap:.5rem}.v-relative{position:relative}.v-absolute{position:absolute}.v-hidden{display:none}@media (min-width: 768px){.v-hidden.md\:v-block{display:block}}.v-inset-0{top:0;right:0;bottom:0;left:0}.v-h-full{height:100%}.v-w-full{width:100%}.v-w-20{width:5rem}.v-h-20{height:5rem}.v-h-10{height:2.5rem}.v-h-4{height:1rem}.v-h-130{height:130px}.v-h-16{height:4rem}.v-w-4{width:1rem}.v-min-w-300{min-width:300px}.v-w-130{width:130px}.v-w-16{width:4rem}.v-p-3{padding:.75rem}.v-p-4{padding:1rem}.v-p-6{padding:1.5rem}.v-px-2{padding-left:.5rem;padding-right:.5rem}.v-px-4{padding-left:1rem;padding-right:1rem}.v-mb-3{margin-bottom:.75rem}.v-mb-4{margin-bottom:1rem}.v-mb-5{margin-bottom:1.25rem}.v-mb-6{margin-bottom:1.5rem}.v-mb-8{margin-bottom:2rem}.v-my-4{margin-top:1rem;margin-bottom:1rem}.v-text-center{text-align:center}.v-text-sm{font-size:.875rem;line-height:1.25rem}.v-text-base{font-size:1rem;line-height:1.5rem}.v-text-xl{font-size:1.25rem;line-height:1.75rem}.v-text-2xl{font-size:1.5rem;line-height:2rem}.v-font-medium{font-weight:500}.v-font-semibold{font-weight:600}.v-tracking-wide{letter-spacing:.025em}.v-text-black{color:#000}.v-text-white{color:#fff}.v-text-gray-400{color:#9ca3af}.v-text-gray-800{color:#1f2937}.v-text-green-700{color:#15803d}.v-text-green-800{color:#166534}.v-bg-green-100{background-color:#dcfce7}.v-bg-slate-100{background-color:#f1f5f9}.v-text-slate-800{color:#1e293b}.v-bg-transparent{background-color:transparent}.v-bg-red{background-color:#cf0000}.v-text-gray-600{color:#6b7280}.v-border{border-width:1px}.v-border-gray-400{border-color:#9ca3af}.v-rounded{border-radius:.25rem}.v-rounded-lg{border-radius:.5rem}.v-input{-webkit-appearance:none;-moz-appearance:none;appearance:none;border-radius:.25rem;border:1px solid #9ca3af;background-color:transparent;padding:.5rem;text-align:center;color:#6b7280}.v-input:focus{outline:2px solid transparent;outline-offset:2px;border-color:#3b82f6}.v-input:disabled{opacity:.5;cursor:not-allowed}.v-button{display:inline-flex;align-items:center;justify-content:center;gap:.5rem;border-radius:.25rem;padding:.5rem 1rem;font-weight:600;transition:all .2s;cursor:pointer;border:none;background-color:#cf0000;color:#fff}.v-button:hover{background-color:#b91c1c}.v-button:disabled{opacity:.5;cursor:not-allowed}.v-animate-spin{animation:spin 1s linear infinite}@keyframes spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.v-fade-in{animation:fadeIn .3s ease-in-out}@keyframes fadeIn{0%{opacity:0;transform:translateY(10px)}to{opacity:1;transform:translateY(0)}}.v-bg-cover{background-size:cover}.v-bg-no-repeat{background-repeat:no-repeat}.v-object-contain{object-fit:contain}.v-mix-blend-multiply{mix-blend-mode:multiply}.v-blur-sm{filter:blur(4px)}.v-fixed{position:fixed}.v-top-4{top:1rem}.v-right-4{right:1rem}
|
|
1
|
+
.v-auth-container *,.v-auth-container *:before,.v-auth-container *:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}.v-auth-container{font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif;line-height:1.5}.v-grid{display:grid}.v-grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.v-grid-responsive{grid-template-columns:1fr}@media (min-width: 768px){.v-grid-responsive{grid-template-columns:1fr 1fr}}.v-h-screen{height:100vh}.v-min-h-screen{min-height:100vh}.v-bg-white{background-color:#fff}.v-bg-left{display:none}@media (min-width: 768px){.v-bg-left{display:block}}.v-flex{display:flex}.v-flex-col{flex-direction:column}.v-items-center{align-items:center}.v-justify-center{justify-content:center}.v-gap-2{gap:.5rem}.v-relative{position:relative}.v-absolute{position:absolute}.v-hidden{display:none}@media (min-width: 768px){.v-hidden.md\:v-block{display:block}}.v-inset-0{top:0;right:0;bottom:0;left:0}.v-h-full{height:100%}.v-w-full{width:100%}.v-w-20{width:5rem}.v-h-20{height:5rem}.v-h-10{height:2.5rem}.v-h-4{height:1rem}.v-h-130{height:130px}.v-h-16{height:4rem}.v-w-4{width:1rem}.v-min-w-300{min-width:300px}.v-w-130{width:130px}.v-w-16{width:4rem}.v-p-3{padding:.75rem}.v-p-4{padding:1rem}.v-p-6{padding:1.5rem}.v-px-2{padding-left:.5rem;padding-right:.5rem}.v-px-4{padding-left:1rem;padding-right:1rem}.v-mb-3{margin-bottom:.75rem}.v-mb-4{margin-bottom:1rem}.v-mb-5{margin-bottom:1.25rem}.v-mb-6{margin-bottom:1.5rem}.v-mb-8{margin-bottom:2rem}.v-my-4{margin-top:1rem;margin-bottom:1rem}.v-text-center{text-align:center}.v-text-sm{font-size:.875rem;line-height:1.25rem}.v-text-base{font-size:1rem;line-height:1.5rem}.v-text-xl{font-size:1.25rem;line-height:1.75rem}.v-text-2xl{font-size:1.5rem;line-height:2rem}.v-font-medium{font-weight:500}.v-font-semibold{font-weight:600}.v-tracking-wide{letter-spacing:.025em}.v-text-black{color:#000}.v-text-white{color:#fff}.v-text-gray-400{color:#9ca3af}.v-text-gray-800{color:#1f2937}.v-text-green-700{color:#15803d}.v-text-green-800{color:#166534}.v-bg-green-100{background-color:#dcfce7}.v-bg-slate-100{background-color:#f1f5f9}.v-text-slate-800{color:#1e293b}.v-bg-transparent{background-color:transparent}.v-bg-red{background-color:#cf0000}.v-text-gray-600{color:#6b7280}.v-border{border-width:1px}.v-border-gray-400{border-color:#9ca3af}.v-rounded{border-radius:.25rem}.v-rounded-lg{border-radius:.5rem}.v-input{-webkit-appearance:none;-moz-appearance:none;appearance:none;border-radius:.25rem;border:1px solid #9ca3af;background-color:transparent;padding:.5rem;text-align:center;color:#6b7280}.v-input:focus{outline:2px solid transparent;outline-offset:2px;border-color:#3b82f6}.v-input:disabled{opacity:.5;cursor:not-allowed}.v-button{display:inline-flex;align-items:center;justify-content:center;gap:.5rem;border-radius:.25rem;padding:.5rem 1rem;font-weight:600;transition:all .2s;cursor:pointer;border:none;background-color:#cf0000;color:#fff}.v-button:hover{background-color:#b91c1c}.v-button:disabled{opacity:.5;cursor:not-allowed}.v-animate-spin{animation:spin 1s linear infinite}@keyframes spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.v-fade-in{animation:fadeIn .3s ease-in-out}@keyframes fadeIn{0%{opacity:0;transform:translateY(10px)}to{opacity:1;transform:translateY(0)}}.v-bg-cover{background-size:cover}.v-bg-no-repeat{background-repeat:no-repeat}.v-object-contain{object-fit:contain}.v-mix-blend-multiply{mix-blend-mode:multiply}.v-blur-sm{filter:blur(4px)}.v-fixed{position:fixed}.v-top-4{top:1rem}.v-right-4{right:1rem}
|
|
@@ -1,33 +1,166 @@
|
|
|
1
1
|
import { default as default_2 } from 'react';
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
3
|
|
|
4
|
+
/**
|
|
5
|
+
* Options for authentication request.
|
|
6
|
+
*
|
|
7
|
+
* @interface AuthOptions
|
|
8
|
+
* @property {string} alias - User's email or Abaxx ID
|
|
9
|
+
* @property {string} code_challenge - PKCE code challenge for secure authentication
|
|
10
|
+
* @property {string} request_id - Unique authentication request identifier
|
|
11
|
+
*/
|
|
4
12
|
export declare interface AuthOptions {
|
|
5
13
|
alias: string;
|
|
6
14
|
code_challenge: string;
|
|
7
15
|
request_id: string;
|
|
8
16
|
}
|
|
9
17
|
|
|
18
|
+
/**
|
|
19
|
+
* Response from authentication request.
|
|
20
|
+
*
|
|
21
|
+
* @interface AuthResponse
|
|
22
|
+
* @property {boolean} ok - Whether the authentication request was successful
|
|
23
|
+
* @property {string} [message] - Optional message describing the result or error
|
|
24
|
+
*/
|
|
10
25
|
export declare interface AuthResponse {
|
|
11
26
|
ok: boolean;
|
|
12
27
|
message?: string;
|
|
13
28
|
}
|
|
14
29
|
|
|
30
|
+
/**
|
|
31
|
+
* Encodes a Uint8Array to a base64url string (URL-safe base64 encoding).
|
|
32
|
+
* Base64url uses '-' and '_' instead of '+' and '/', and removes padding '=' characters.
|
|
33
|
+
*
|
|
34
|
+
* @param {Uint8Array} buffer - The buffer to encode
|
|
35
|
+
* @returns {string} A base64url-encoded string
|
|
36
|
+
*
|
|
37
|
+
* @example
|
|
38
|
+
* ```ts
|
|
39
|
+
* const bytes = new Uint8Array([255, 254, 253]);
|
|
40
|
+
* const encoded = base64urlEncode(bytes); // Returns base64url string
|
|
41
|
+
* ```
|
|
42
|
+
*/
|
|
15
43
|
export declare function base64urlEncode(buffer: Uint8Array): string;
|
|
16
44
|
|
|
45
|
+
/**
|
|
46
|
+
* Generates a cryptographically secure random code verifier for PKCE (Proof Key for Code Exchange).
|
|
47
|
+
*
|
|
48
|
+
* @param {number} length - The length of the code verifier in bytes (typically 64 for PKCE)
|
|
49
|
+
* @returns {Uint8Array} A Uint8Array containing random bytes for the code verifier
|
|
50
|
+
*
|
|
51
|
+
* @example
|
|
52
|
+
* ```ts
|
|
53
|
+
* const verifier = generateCodeVerifier(64);
|
|
54
|
+
* const verifierString = base64urlEncode(verifier);
|
|
55
|
+
* ```
|
|
56
|
+
*/
|
|
17
57
|
export declare function generateCodeVerifier(length: number): Uint8Array;
|
|
18
58
|
|
|
59
|
+
/**
|
|
60
|
+
* Props for the VContextProvider component.
|
|
61
|
+
*
|
|
62
|
+
* @type {Object} Props
|
|
63
|
+
* @property {string} clientId - Client identifier for authentication
|
|
64
|
+
* @property {string} apiUrl - API URL for authentication endpoints
|
|
65
|
+
* @property {ReactNode} children - Child components to be wrapped with context
|
|
66
|
+
*/
|
|
19
67
|
declare type Props = {
|
|
20
68
|
clientId: string;
|
|
21
69
|
apiUrl: string;
|
|
22
70
|
children: ReactNode;
|
|
23
71
|
};
|
|
24
72
|
|
|
73
|
+
/**
|
|
74
|
+
* Unsafe function to reset authentication state directly from a context object.
|
|
75
|
+
*
|
|
76
|
+
* **Warning**: This function should only be used when you have direct access to the context object.
|
|
77
|
+
* Prefer using `useVerifierReset()` hook in React components.
|
|
78
|
+
*
|
|
79
|
+
* @param {React.ContextType<typeof VContext>} ctx - The authentication context object
|
|
80
|
+
*
|
|
81
|
+
* @example
|
|
82
|
+
* ```ts
|
|
83
|
+
* // Not recommended - use useVerifierReset() hook instead
|
|
84
|
+
* const context = useContext(VContext);
|
|
85
|
+
* resetVerifierStateUnsafe(context);
|
|
86
|
+
* ```
|
|
87
|
+
*/
|
|
25
88
|
export declare function resetVerifierStateUnsafe(ctx: default_2.ContextType<typeof VContext>): void;
|
|
26
89
|
|
|
90
|
+
/**
|
|
91
|
+
* Hook to reset all authentication state back to initial values.
|
|
92
|
+
*
|
|
93
|
+
* This hook provides access to the resetState function from the authentication context.
|
|
94
|
+
* When called, it resets all authentication-related state including:
|
|
95
|
+
* - identity, authRequestId, isAuthenticating
|
|
96
|
+
* - codeVerifier, codeChallenge, authCode
|
|
97
|
+
* - authRequestIdExpires, token, authError
|
|
98
|
+
*
|
|
99
|
+
* @returns {() => void} A function that resets all authentication state to initial values
|
|
100
|
+
*
|
|
101
|
+
* @example
|
|
102
|
+
* ```tsx
|
|
103
|
+
* import { useVerifierReset } from "@abaxx_tech/v-integration-react";
|
|
104
|
+
*
|
|
105
|
+
* const LogoutButton = () => {
|
|
106
|
+
* const resetState = useVerifierReset();
|
|
107
|
+
*
|
|
108
|
+
* const handleLogout = () => {
|
|
109
|
+
* resetState(); // Resets all authentication state
|
|
110
|
+
* };
|
|
111
|
+
*
|
|
112
|
+
* return <button onClick={handleLogout}>Logout</button>;
|
|
113
|
+
* };
|
|
114
|
+
* ```
|
|
115
|
+
*/
|
|
27
116
|
export declare function useVerifierReset(): () => void;
|
|
28
117
|
|
|
118
|
+
/**
|
|
119
|
+
* React context for authentication state and functions.
|
|
120
|
+
*
|
|
121
|
+
* This context provides access to all authentication-related state and functions
|
|
122
|
+
* throughout the component tree. Use `useContext(VContext)` to access the context
|
|
123
|
+
* in your components.
|
|
124
|
+
*
|
|
125
|
+
* @example
|
|
126
|
+
* ```tsx
|
|
127
|
+
* import { useContext } from 'react';
|
|
128
|
+
* import { VContext } from '@abaxx_tech/v-integration-react';
|
|
129
|
+
*
|
|
130
|
+
* const MyComponent = () => {
|
|
131
|
+
* const { token, identity, isAuthenticating } = useContext(VContext);
|
|
132
|
+
* // Use authentication state...
|
|
133
|
+
* };
|
|
134
|
+
* ```
|
|
135
|
+
*/
|
|
29
136
|
export declare const VContext: default_2.Context<VContextObj>;
|
|
30
137
|
|
|
138
|
+
/**
|
|
139
|
+
* Authentication context object providing access to all authentication-related state and functions.
|
|
140
|
+
*
|
|
141
|
+
* @typedef {Object} VContextObj@typedef {Object} VContextObj
|
|
142
|
+
* @property {string} apiUrl - API base URL for authentication endpoints
|
|
143
|
+
* @property {string} clientId - Client identifier for authentication
|
|
144
|
+
* @property {string} authRequestId - Current authentication request ID
|
|
145
|
+
* @property {React.Dispatch<React.SetStateAction<string>>} setAuthRequestId - Function to set the authentication request ID
|
|
146
|
+
* @property {string} identity - User identity after successful authentication
|
|
147
|
+
* @property {React.Dispatch<React.SetStateAction<string>>} setIdentity - Function to set the user identity
|
|
148
|
+
* @property {boolean} isAuthenticating - Whether authentication is currently in progress
|
|
149
|
+
* @property {React.Dispatch<React.SetStateAction<boolean>>} setIsAuthenticating - Function to set authentication status
|
|
150
|
+
* @property {string} codeVerifier - PKCE code verifier for secure authentication
|
|
151
|
+
* @property {React.Dispatch<React.SetStateAction<string>>} setCodeVerifier - Function to set the code verifier
|
|
152
|
+
* @property {string} codeChallenge - PKCE code challenge for secure authentication
|
|
153
|
+
* @property {React.Dispatch<React.SetStateAction<string>>} setCodeChallenge - Function to set the code challenge
|
|
154
|
+
* @property {string} authCode - Authorization code from successful authentication
|
|
155
|
+
* @property {React.Dispatch<React.SetStateAction<string>>} setAuthCode - Function to set the authorization code
|
|
156
|
+
* @property {Date} authRequestIdExpires - Expiration time for the authentication request
|
|
157
|
+
* @property {React.Dispatch<React.SetStateAction<Date>>} setAuthRequestIdExpires - Function to set the request expiration time
|
|
158
|
+
* @property {string | null} token - Authentication token, null if not authenticated
|
|
159
|
+
* @property {React.Dispatch<React.SetStateAction<string | null>>} setToken - Function to set the authentication token
|
|
160
|
+
* @property {string | null} authError - Authentication error message, null if no error
|
|
161
|
+
* @property {React.Dispatch<React.SetStateAction<string | null>>} setAuthError - Function to set authentication error
|
|
162
|
+
* @property {() => void} resetState - Resets all mutable state back to initial values
|
|
163
|
+
*/
|
|
31
164
|
export declare type VContextObj = {
|
|
32
165
|
apiUrl: string;
|
|
33
166
|
clientId: string;
|
|
@@ -52,12 +185,103 @@ export declare type VContextObj = {
|
|
|
52
185
|
resetState: () => void;
|
|
53
186
|
};
|
|
54
187
|
|
|
55
|
-
|
|
188
|
+
/* Excluded from this release type: VContextProvider */
|
|
56
189
|
|
|
190
|
+
/**
|
|
191
|
+
* Complete authentication UI component with QR code and email input.
|
|
192
|
+
*
|
|
193
|
+
* This component provides a full-screen authentication experience with:
|
|
194
|
+
* - Background image and branding
|
|
195
|
+
* - QR code generation with Abaxx branding
|
|
196
|
+
* - Email/Abaxx ID input field
|
|
197
|
+
* - Real-time authentication status updates
|
|
198
|
+
* - Loading states and error handling
|
|
199
|
+
* - Responsive design with grid layout
|
|
200
|
+
* - Automatic error boundary protection
|
|
201
|
+
*
|
|
202
|
+
* @param {VerifierAuthProps} props - The component props
|
|
203
|
+
* @param {string} props.title - Title displayed in the login UI (e.g., "Abaxx Drive")
|
|
204
|
+
* @param {string} [props.containerClass] - Additional CSS classes for the container
|
|
205
|
+
* @returns {JSX.Element} The complete authentication UI component
|
|
206
|
+
*
|
|
207
|
+
* @example
|
|
208
|
+
* ```tsx
|
|
209
|
+
* import { VerifierAuth } from "@abaxx_tech/v-integration-react";
|
|
210
|
+
* import "v-integration-react/index.css";
|
|
211
|
+
*
|
|
212
|
+
* const LoginPage = () => {
|
|
213
|
+
* return <VerifierAuth title="Abaxx Drive" />;
|
|
214
|
+
* };
|
|
215
|
+
* ```
|
|
216
|
+
*/
|
|
57
217
|
export declare const VerifierAuth: default_2.FC<VerifierAuthProps>;
|
|
58
218
|
|
|
219
|
+
/**
|
|
220
|
+
* Email input authentication component only.
|
|
221
|
+
*
|
|
222
|
+
* Provides a standalone email/Abaxx ID input field with authentication functionality.
|
|
223
|
+
* Features include:
|
|
224
|
+
* - Email/Abaxx ID input validation
|
|
225
|
+
* - Loading states with spinner animation
|
|
226
|
+
* - Real-time authentication status updates
|
|
227
|
+
* - Customizable styling with support for both Tailwind classes and hex colors
|
|
228
|
+
* - Error handling with user feedback
|
|
229
|
+
* - Success state with checkmark icon
|
|
230
|
+
* - Automatic error boundary protection
|
|
231
|
+
*
|
|
232
|
+
* @param {VerifierAuthEmailProps} props - The component props
|
|
233
|
+
* @param {string} [props.inputPlaceholder="Enter Email or Abaxx ID"] - Placeholder text for the input field
|
|
234
|
+
* @param {string} [props.buttonText="Sign In"] - Text displayed on the button
|
|
235
|
+
* @param {string} [props.inputHeight="v-h-10"] - Height class for the input field
|
|
236
|
+
* @param {string} [props.inputWidth="v-w-full"] - Width class for the input field
|
|
237
|
+
* @param {string} [props.inputTextColor="v-text-gray-600"] - Text color for the input field
|
|
238
|
+
* @param {string} [props.inputBorderColor="v-border-gray-400"] - Border color for the input field
|
|
239
|
+
* @param {string} [props.inputBackgroundColor="v-bg-transparent"] - Background color for the input field
|
|
240
|
+
* @param {string} [props.buttonHeight="v-h-10"] - Height class for the button
|
|
241
|
+
* @param {string} [props.buttonWidth="v-w-full"] - Width class for the button
|
|
242
|
+
* @param {string} [props.buttonBackgroundColor="v-bg-red"] - Background color for the button
|
|
243
|
+
* @param {string} [props.buttonTextColor="v-text-white"] - Text color for the button
|
|
244
|
+
* @param {string} [props.containerClass=""] - Additional CSS classes for the container
|
|
245
|
+
* @param {string} [props.checkmarkColor="#c40808"] - Color of the checkmark icon
|
|
246
|
+
* @returns {JSX.Element} The email authentication component
|
|
247
|
+
*
|
|
248
|
+
* @example
|
|
249
|
+
* ```tsx
|
|
250
|
+
* import { VerifierAuthEmail } from "@abaxx_tech/v-integration-react";
|
|
251
|
+
* import "v-integration-react/index.css";
|
|
252
|
+
*
|
|
253
|
+
* const EmailLoginAuth = () => {
|
|
254
|
+
* return (
|
|
255
|
+
* <VerifierAuthEmail
|
|
256
|
+
* inputPlaceholder="Enter your email"
|
|
257
|
+
* buttonText="Sign In"
|
|
258
|
+
* buttonBackgroundColor="#0b981"
|
|
259
|
+
* checkmarkColor="#0b981"
|
|
260
|
+
* />
|
|
261
|
+
* );
|
|
262
|
+
* };
|
|
263
|
+
* ```
|
|
264
|
+
*/
|
|
59
265
|
export declare const VerifierAuthEmail: default_2.FC<VerifierAuthEmailProps>;
|
|
60
266
|
|
|
267
|
+
/**
|
|
268
|
+
* Props for the VerifierAuthEmail component.
|
|
269
|
+
*
|
|
270
|
+
* @interface VerifierAuthEmailProps
|
|
271
|
+
* @property {string} [inputPlaceholder="Enter Email or Abaxx ID"] - Placeholder text for the input field
|
|
272
|
+
* @property {string} [buttonText="Sign In"] - Text displayed on the button
|
|
273
|
+
* @property {string} [inputHeight="v-h-10"] - Height class for the input field
|
|
274
|
+
* @property {string} [inputWidth="v-w-full"] - Width class for the input field
|
|
275
|
+
* @property {string} [inputTextColor="v-text-gray-600"] - Text color for the input field (Tailwind class or hex color)
|
|
276
|
+
* @property {string} [inputBorderColor="v-border-gray-400"] - Border color for the input field (Tailwind class or hex color)
|
|
277
|
+
* @property {string} [inputBackgroundColor="v-bg-transparent"] - Background color for the input field (Tailwind class or hex color)
|
|
278
|
+
* @property {string} [buttonHeight="v-h-10"] - Height class for the button
|
|
279
|
+
* @property {string} [buttonWidth="v-w-full"] - Width class for the button
|
|
280
|
+
* @property {string} [buttonBackgroundColor="v-bg-red"] - Background color for the button (Tailwind class or hex color)
|
|
281
|
+
* @property {string} [buttonTextColor="v-text-white"] - Text color for the button (Tailwind class or hex color)
|
|
282
|
+
* @property {string} [containerClass=""] - Additional CSS classes for the container
|
|
283
|
+
* @property {string} [checkmarkColor="#c40808"] - Color of the checkmark icon (hex color)
|
|
284
|
+
*/
|
|
61
285
|
export declare interface VerifierAuthEmailProps {
|
|
62
286
|
inputPlaceholder?: string;
|
|
63
287
|
buttonText?: string;
|
|
@@ -74,13 +298,75 @@ export declare interface VerifierAuthEmailProps {
|
|
|
74
298
|
checkmarkColor?: string;
|
|
75
299
|
}
|
|
76
300
|
|
|
301
|
+
/**
|
|
302
|
+
* Props for the VerifierAuth component.
|
|
303
|
+
*
|
|
304
|
+
* @interface VerifierAuthProps
|
|
305
|
+
* @property {string} title - Title displayed in the login UI
|
|
306
|
+
* @property {string} [containerClass] - Additional CSS classes for the container
|
|
307
|
+
*/
|
|
77
308
|
export declare interface VerifierAuthProps {
|
|
78
309
|
title: string;
|
|
79
310
|
containerClass?: string;
|
|
80
311
|
}
|
|
81
312
|
|
|
313
|
+
/**
|
|
314
|
+
* QR code authentication component only.
|
|
315
|
+
*
|
|
316
|
+
* Displays a QR code that users can scan with the Verifier+ app for authentication.
|
|
317
|
+
* Features include:
|
|
318
|
+
* - Dynamic QR code generation with authentication parameters
|
|
319
|
+
* - Loading spinner while QR code is being generated
|
|
320
|
+
* - Optional status display with success/pending states
|
|
321
|
+
* - Customizable styling and branding
|
|
322
|
+
* - Automatic QR code updates when authentication parameters change
|
|
323
|
+
* - Automatic error boundary protection
|
|
324
|
+
*
|
|
325
|
+
* @param {VerifierAuthQrProps} props - The component props
|
|
326
|
+
* @param {number} [props.size=130] - QR code size in pixels
|
|
327
|
+
* @param {string} [props.qrColor="#e60100"] - QR code foreground color
|
|
328
|
+
* @param {string} [props.logoImage] - Logo URL to display in QR center
|
|
329
|
+
* @param {number} [props.logoWidth=40] - Logo width in pixels
|
|
330
|
+
* @param {number} [props.logoHeight=20] - Logo height in pixels
|
|
331
|
+
* @param {number} [props.quietZone=0] - Quiet zone around QR code
|
|
332
|
+
* @param {string} [props.containerClass=""] - Additional CSS classes for container
|
|
333
|
+
* @param {boolean} [props.showStatus=true] - Whether to show authentication status
|
|
334
|
+
* @param {string} [props.checkmarkColor="#c40808"] - Color of the checkmark icon
|
|
335
|
+
* @returns {JSX.Element} The QR code authentication component
|
|
336
|
+
*
|
|
337
|
+
* @example
|
|
338
|
+
* ```tsx
|
|
339
|
+
* import { VerifierAuthQr } from "@abaxx_tech/v-integration-react";
|
|
340
|
+
* import "v-integration-react/index.css";
|
|
341
|
+
*
|
|
342
|
+
* const QRLoginAuth = () => {
|
|
343
|
+
* return (
|
|
344
|
+
* <VerifierAuthQr
|
|
345
|
+
* size={150}
|
|
346
|
+
* qrColor="#e60100"
|
|
347
|
+
* checkmarkColor="#0b981"
|
|
348
|
+
* showStatus={true}
|
|
349
|
+
* />
|
|
350
|
+
* );
|
|
351
|
+
* };
|
|
352
|
+
* ```
|
|
353
|
+
*/
|
|
82
354
|
export declare const VerifierAuthQr: default_2.FC<VerifierAuthQrProps>;
|
|
83
355
|
|
|
356
|
+
/**
|
|
357
|
+
* Props for the VerifierAuthQr component.
|
|
358
|
+
*
|
|
359
|
+
* @interface VerifierAuthQrProps
|
|
360
|
+
* @property {number} [size=130] - QR code size in pixels
|
|
361
|
+
* @property {string} [qrColor="#e60100"] - QR code foreground color (hex color)
|
|
362
|
+
* @property {string} [logoImage="https://content.abaxx.com/assets/static/qr-logo.png"] - Logo URL to display in QR center
|
|
363
|
+
* @property {number} [logoWidth=40] - Logo width in pixels
|
|
364
|
+
* @property {number} [logoHeight=20] - Logo height in pixels
|
|
365
|
+
* @property {number} [quietZone=0] - Quiet zone around QR code
|
|
366
|
+
* @property {string} [containerClass=""] - Additional CSS classes for container
|
|
367
|
+
* @property {boolean} [showStatus=true] - Whether to show authentication status (success/pending)
|
|
368
|
+
* @property {string} [checkmarkColor="#c40808"] - Color of the checkmark icon (hex color)
|
|
369
|
+
*/
|
|
84
370
|
export declare interface VerifierAuthQrProps {
|
|
85
371
|
size?: number;
|
|
86
372
|
qrColor?: string;
|
|
@@ -93,8 +379,47 @@ export declare interface VerifierAuthQrProps {
|
|
|
93
379
|
checkmarkColor?: string;
|
|
94
380
|
}
|
|
95
381
|
|
|
382
|
+
/**
|
|
383
|
+
* Main provider component that wraps your application and manages authentication context.
|
|
384
|
+
*
|
|
385
|
+
* This component automatically handles:
|
|
386
|
+
* - PKCE code verifier and challenge generation
|
|
387
|
+
* - Server-Sent Events (SSE) connection for real-time authentication updates
|
|
388
|
+
* - Authentication state and token lifecycle management
|
|
389
|
+
* - Background authentication service
|
|
390
|
+
*
|
|
391
|
+
* @param {VerifierProviderProps} props - The provider props
|
|
392
|
+
* @param {string} props.apiUrl - API URL for authentication endpoints
|
|
393
|
+
* @param {string} props.clientId - Client identifier for authentication
|
|
394
|
+
* @param {ReactNode} props.children - Child components to be wrapped
|
|
395
|
+
* @returns {JSX.Element} The provider component with authentication context
|
|
396
|
+
*
|
|
397
|
+
* @example
|
|
398
|
+
* ```tsx
|
|
399
|
+
* import { VerifierProvider } from "@abaxx_tech/v-integration-react";
|
|
400
|
+
*
|
|
401
|
+
* const App = () => {
|
|
402
|
+
* return (
|
|
403
|
+
* <VerifierProvider
|
|
404
|
+
* apiUrl="https://api.example.com"
|
|
405
|
+
* clientId="your-client-id"
|
|
406
|
+
* >
|
|
407
|
+
* <YourApp />
|
|
408
|
+
* </VerifierProvider>
|
|
409
|
+
* );
|
|
410
|
+
* };
|
|
411
|
+
* ```
|
|
412
|
+
*/
|
|
96
413
|
export declare const VerifierProvider: default_2.FC<VerifierProviderProps>;
|
|
97
414
|
|
|
415
|
+
/**
|
|
416
|
+
* Props for the VerifierProvider component.
|
|
417
|
+
*
|
|
418
|
+
* @interface VerifierProviderProps
|
|
419
|
+
* @property {string} clientId - Client identifier for authentication
|
|
420
|
+
* @property {string} apiUrl - API URL for authentication endpoints
|
|
421
|
+
* @property {ReactNode} children - Child components to be wrapped with authentication context
|
|
422
|
+
*/
|
|
98
423
|
export declare interface VerifierProviderProps {
|
|
99
424
|
clientId: string;
|
|
100
425
|
apiUrl: string;
|