@nibssplc/cams-sdk-react 0.0.1-beta.9 → 0.0.1-beta.91
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 +239 -104
- package/dist/components/ADLoginModal.d.ts +7 -0
- package/dist/components/AuthFailureAnimation.d.ts +5 -0
- package/dist/components/AuthSuccessAnimation.d.ts +5 -0
- package/dist/components/CAMSMSALProvider.d.ts +13 -5
- package/dist/components/CAMSProvider.d.ts +6 -6
- package/dist/components/ClientOnly.d.ts +6 -0
- package/dist/components/CoreFIDO.d.ts +20 -0
- package/dist/components/DefaultLoginPage.d.ts +2 -0
- package/dist/components/ErrorFallback.d.ts +5 -0
- package/dist/components/GenericOTP.d.ts +13 -0
- package/dist/components/Loading.d.ts +6 -0
- package/dist/components/MFAGate.d.ts +12 -0
- package/dist/components/MFAOptions.d.ts +7 -0
- package/dist/components/ProtectedRoute.d.ts +1 -1
- package/dist/components/UnifiedCAMSProvider.d.ts +22 -0
- package/dist/components/ui/button.d.ts +10 -0
- package/dist/components/ui/card.d.ts +9 -0
- package/dist/components/ui/dialog.d.ts +15 -0
- package/dist/components/ui/form.d.ts +24 -0
- package/dist/components/ui/input-otp.d.ts +11 -0
- package/dist/components/ui/input.d.ts +5 -0
- package/dist/components/ui/label.d.ts +4 -0
- package/dist/context/CAMSContext.d.ts +19 -0
- package/dist/hooks/useCAMSAuth.d.ts +8 -1
- package/dist/hooks/useCAMSMSALAuth.d.ts +17 -10
- package/dist/hooks/useFIDOAuth.d.ts +9 -0
- package/dist/hooks/useOTPHandler.d.ts +30 -0
- package/dist/index.cjs.js +1993 -18008
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +10 -2
- package/dist/index.esm.js +1999 -18025
- package/dist/index.esm.js.map +1 -1
- package/dist/lib/utils.d.ts +2 -0
- package/dist/utils/DeviceID.d.ts +1 -0
- package/dist/utils/FIDO.d.ts +10 -0
- package/dist/utils/cookies.d.ts +3 -0
- package/package.json +32 -9
- package/dist/index.umd.js +0 -18258
- package/dist/index.umd.js.map +0 -1
package/README.md
CHANGED
|
@@ -1,160 +1,295 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @nibssplc/cams-sdk-react
|
|
2
2
|
|
|
3
|
-
React hooks and components for NIBSS CAMS SDK with support for both
|
|
3
|
+
React hooks and components for NIBSS CAMS SDK with support for both regular CAMS authentication and Azure AD MSAL integration.
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
8
|
npm install @nibssplc/cams-sdk-react
|
|
9
|
+
```
|
|
9
10
|
|
|
10
|
-
|
|
11
|
+
For MSAL mode, also install:
|
|
12
|
+
```bash
|
|
11
13
|
npm install @azure/msal-browser @azure/msal-react
|
|
12
14
|
```
|
|
13
15
|
|
|
14
|
-
##
|
|
16
|
+
## Features
|
|
17
|
+
|
|
18
|
+
- ⚛️ React hooks for authentication
|
|
19
|
+
- 🔄 Unified provider supporting both REGULAR and MSAL modes
|
|
20
|
+
- 🎨 Pre-built UI components (login page, MFA gate)
|
|
21
|
+
- 🛡️ Protected route component
|
|
22
|
+
- 🎯 TypeScript support
|
|
23
|
+
- 🪝 Context-based state management
|
|
24
|
+
- 📱 Next.js compatible
|
|
15
25
|
|
|
16
|
-
|
|
26
|
+
## Quick Start
|
|
27
|
+
|
|
28
|
+
### MSAL Mode (Azure AD + MFA)
|
|
17
29
|
|
|
18
30
|
```tsx
|
|
19
|
-
import {
|
|
31
|
+
import { UnifiedCAMSProvider, useCAMSContext } from '@nibssplc/cams-sdk-react';
|
|
32
|
+
|
|
33
|
+
const msalConfig = {
|
|
34
|
+
auth: {
|
|
35
|
+
clientId: 'your-client-id',
|
|
36
|
+
authority: 'https://login.microsoftonline.com/your-tenant-id',
|
|
37
|
+
redirectUri: window.location.origin
|
|
38
|
+
}
|
|
39
|
+
};
|
|
20
40
|
|
|
21
41
|
function App() {
|
|
22
42
|
return (
|
|
23
|
-
<
|
|
24
|
-
|
|
25
|
-
|
|
43
|
+
<UnifiedCAMSProvider
|
|
44
|
+
mode="MSAL"
|
|
45
|
+
appCode="your-app-guid"
|
|
46
|
+
msalConfig={msalConfig}
|
|
47
|
+
MFAEndpoint="https://your-mfa-endpoint.com"
|
|
48
|
+
>
|
|
49
|
+
<YourApp />
|
|
50
|
+
</UnifiedCAMSProvider>
|
|
26
51
|
);
|
|
27
52
|
}
|
|
28
53
|
|
|
29
|
-
function
|
|
30
|
-
const { login, logout, isAuthenticated,
|
|
54
|
+
function YourApp() {
|
|
55
|
+
const { login, logout, isAuthenticated, userProfile } = useCAMSContext();
|
|
31
56
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
57
|
+
return (
|
|
58
|
+
<div>
|
|
59
|
+
{isAuthenticated ? (
|
|
60
|
+
<>
|
|
61
|
+
<p>Welcome, {userProfile?.name}</p>
|
|
62
|
+
<button onClick={logout}>Logout</button>
|
|
63
|
+
</>
|
|
64
|
+
) : (
|
|
65
|
+
<button onClick={login}>Login</button>
|
|
66
|
+
)}
|
|
67
|
+
</div>
|
|
68
|
+
);
|
|
69
|
+
}
|
|
70
|
+
```
|
|
40
71
|
|
|
41
|
-
|
|
42
|
-
return <button onClick={logout}>Logout</button>;
|
|
43
|
-
}
|
|
72
|
+
### REGULAR Mode (Popup Authentication)
|
|
44
73
|
|
|
74
|
+
```tsx
|
|
75
|
+
import { UnifiedCAMSProvider, useCAMSContext } from '@nibssplc/cams-sdk-react';
|
|
76
|
+
|
|
77
|
+
function App() {
|
|
45
78
|
return (
|
|
46
|
-
<
|
|
47
|
-
|
|
48
|
-
|
|
79
|
+
<UnifiedCAMSProvider
|
|
80
|
+
mode="REGULAR"
|
|
81
|
+
appCode="your-app-guid"
|
|
82
|
+
camsUrl="https://your-cams-url.com"
|
|
83
|
+
messageOrigin="https://your-cams-url.com"
|
|
84
|
+
windowWidth={500}
|
|
85
|
+
windowHeight={600}
|
|
86
|
+
>
|
|
87
|
+
<YourApp />
|
|
88
|
+
</UnifiedCAMSProvider>
|
|
49
89
|
);
|
|
50
90
|
}
|
|
51
91
|
```
|
|
52
92
|
|
|
53
|
-
|
|
93
|
+
## Components
|
|
94
|
+
|
|
95
|
+
### UnifiedCAMSProvider
|
|
96
|
+
|
|
97
|
+
Main provider component supporting both authentication modes.
|
|
98
|
+
|
|
99
|
+
**Props (MSAL Mode):**
|
|
100
|
+
```tsx
|
|
101
|
+
interface MSALProviderProps {
|
|
102
|
+
mode: "MSAL";
|
|
103
|
+
appCode: string;
|
|
104
|
+
msalConfig: Configuration;
|
|
105
|
+
msalInstance?: PublicClientApplication;
|
|
106
|
+
MFAEndpoint: string;
|
|
107
|
+
children: React.ReactNode;
|
|
108
|
+
}
|
|
109
|
+
```
|
|
54
110
|
|
|
111
|
+
**Props (REGULAR Mode):**
|
|
55
112
|
```tsx
|
|
56
|
-
|
|
113
|
+
interface RegularProviderProps {
|
|
114
|
+
mode: "REGULAR";
|
|
115
|
+
appCode: string;
|
|
116
|
+
camsUrl: string;
|
|
117
|
+
messageOrigin: string;
|
|
118
|
+
windowWidth: number;
|
|
119
|
+
windowHeight: number;
|
|
120
|
+
authTimeout?: number;
|
|
121
|
+
debug?: boolean;
|
|
122
|
+
children: React.ReactNode;
|
|
123
|
+
}
|
|
124
|
+
```
|
|
57
125
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
};
|
|
126
|
+
### DefaultLoginPage
|
|
127
|
+
|
|
128
|
+
Pre-built login page with Microsoft and AD authentication options.
|
|
129
|
+
|
|
130
|
+
```tsx
|
|
131
|
+
import { DefaultLoginPage } from '@nibssplc/cams-sdk-react';
|
|
65
132
|
|
|
66
133
|
function App() {
|
|
67
134
|
return (
|
|
68
|
-
<
|
|
69
|
-
<
|
|
70
|
-
</
|
|
135
|
+
<UnifiedCAMSProvider mode="MSAL" {...config}>
|
|
136
|
+
<DefaultLoginPage />
|
|
137
|
+
</UnifiedCAMSProvider>
|
|
71
138
|
);
|
|
72
139
|
}
|
|
140
|
+
```
|
|
73
141
|
|
|
74
|
-
|
|
75
|
-
const {
|
|
76
|
-
login,
|
|
77
|
-
logout,
|
|
78
|
-
completeMFA,
|
|
79
|
-
isAuthenticated,
|
|
80
|
-
isLoading,
|
|
81
|
-
isMFAPending,
|
|
82
|
-
account
|
|
83
|
-
} = useCAMSMSALAuth({
|
|
84
|
-
scopes: ['openid', 'profile', 'email'],
|
|
85
|
-
mfaUrl: 'https://your-mfa-page.com/verify',
|
|
86
|
-
onAuthSuccess: (token) => console.log('Auth complete:', token),
|
|
87
|
-
onMFARequired: (msalToken, account) => console.log('MFA required for:', account.name),
|
|
88
|
-
});
|
|
89
|
-
|
|
90
|
-
// Handle MFA completion (call this after MFA verification)
|
|
91
|
-
const handleMFAComplete = (mfaToken: string) => {
|
|
92
|
-
completeMFA(mfaToken);
|
|
93
|
-
};
|
|
94
|
-
|
|
95
|
-
if (isAuthenticated) {
|
|
96
|
-
return (
|
|
97
|
-
<div>
|
|
98
|
-
<p>Welcome, {account?.name}</p>
|
|
99
|
-
<button onClick={logout}>Logout</button>
|
|
100
|
-
</div>
|
|
101
|
-
);
|
|
102
|
-
}
|
|
142
|
+
### MFAGate
|
|
103
143
|
|
|
104
|
-
|
|
105
|
-
return <div>Completing MFA verification...</div>;
|
|
106
|
-
}
|
|
144
|
+
Component that enforces MFA completion before rendering children.
|
|
107
145
|
|
|
146
|
+
```tsx
|
|
147
|
+
import { MFAGate } from '@nibssplc/cams-sdk-react';
|
|
148
|
+
|
|
149
|
+
function ProtectedContent() {
|
|
108
150
|
return (
|
|
109
|
-
<
|
|
110
|
-
|
|
111
|
-
</
|
|
151
|
+
<MFAGate>
|
|
152
|
+
<YourProtectedContent />
|
|
153
|
+
</MFAGate>
|
|
112
154
|
);
|
|
113
155
|
}
|
|
114
156
|
```
|
|
115
157
|
|
|
116
|
-
|
|
158
|
+
### ProtectedRoute
|
|
117
159
|
|
|
118
|
-
|
|
160
|
+
Route wrapper that requires authentication.
|
|
161
|
+
|
|
162
|
+
```tsx
|
|
163
|
+
import { ProtectedRoute } from '@nibssplc/cams-sdk-react';
|
|
164
|
+
|
|
165
|
+
function App() {
|
|
166
|
+
return (
|
|
167
|
+
<ProtectedRoute>
|
|
168
|
+
<YourProtectedPage />
|
|
169
|
+
</ProtectedRoute>
|
|
170
|
+
);
|
|
171
|
+
}
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
## Hooks
|
|
175
|
+
|
|
176
|
+
### useCAMSContext
|
|
177
|
+
|
|
178
|
+
Access authentication state and methods.
|
|
179
|
+
|
|
180
|
+
```tsx
|
|
181
|
+
import { useCAMSContext } from '@nibssplc/cams-sdk-react';
|
|
182
|
+
|
|
183
|
+
function MyComponent() {
|
|
184
|
+
const {
|
|
185
|
+
isAuthenticated,
|
|
186
|
+
isLoading,
|
|
187
|
+
userProfile,
|
|
188
|
+
login,
|
|
189
|
+
logout,
|
|
190
|
+
error,
|
|
191
|
+
authMode
|
|
192
|
+
} = useCAMSContext();
|
|
119
193
|
|
|
120
|
-
|
|
194
|
+
return (
|
|
195
|
+
<div>
|
|
196
|
+
{isAuthenticated && <p>Hello, {userProfile?.name}</p>}
|
|
197
|
+
</div>
|
|
198
|
+
);
|
|
199
|
+
}
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
**Return Values:**
|
|
203
|
+
|
|
204
|
+
| Property | Type | Description |
|
|
205
|
+
|----------|------|-------------|
|
|
206
|
+
| `isAuthenticated` | boolean | Authentication status |
|
|
207
|
+
| `isLoading` | boolean | Loading state |
|
|
208
|
+
| `userProfile` | Profile \| null | User profile data |
|
|
209
|
+
| `login` | function | Trigger login flow |
|
|
210
|
+
| `logout` | function | Logout user |
|
|
211
|
+
| `error` | Error \| null | Authentication error |
|
|
212
|
+
| `authMode` | 'REGULAR' \| 'MSAL' | Current auth mode |
|
|
213
|
+
| `requiresMFA` | boolean | MFA required (MSAL only) |
|
|
214
|
+
|
|
215
|
+
### useCAMSAuth
|
|
216
|
+
|
|
217
|
+
Hook for REGULAR mode authentication.
|
|
121
218
|
|
|
122
219
|
```tsx
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
} = useCAMSMSALAuth(options);
|
|
220
|
+
import { useCAMSAuth } from '@nibssplc/cams-sdk-react';
|
|
221
|
+
|
|
222
|
+
const auth = useCAMSAuth({
|
|
223
|
+
appCode: 'your-app-guid',
|
|
224
|
+
camsUrl: 'https://your-cams-url.com',
|
|
225
|
+
messageOrigin: 'https://your-cams-url.com',
|
|
226
|
+
windowWidth: 500,
|
|
227
|
+
windowHeight: 600
|
|
228
|
+
});
|
|
133
229
|
```
|
|
134
230
|
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
- `onAuthSuccess?: (token: string) => void` - Success callback (after MFA completion)
|
|
139
|
-
- `onAuthError?: (error: CAMSError) => void` - Error callback
|
|
140
|
-
- `onTokenExpired?: () => void` - Token expiration callback
|
|
141
|
-
- `onMFARequired?: (msalToken: string, account: AccountInfo) => void` - MFA required callback
|
|
231
|
+
### useCAMSMSALAuth
|
|
232
|
+
|
|
233
|
+
Hook for MSAL mode authentication.
|
|
142
234
|
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
- `isMFAPending: boolean` - Whether MFA verification is pending
|
|
235
|
+
```tsx
|
|
236
|
+
import { useCAMSMSALAuth } from '@nibssplc/cams-sdk-react';
|
|
146
237
|
|
|
147
|
-
|
|
238
|
+
const auth = useCAMSMSALAuth({
|
|
239
|
+
appCode: 'your-app-guid',
|
|
240
|
+
MFAEndpoint: 'https://your-mfa-endpoint.com'
|
|
241
|
+
});
|
|
242
|
+
```
|
|
148
243
|
|
|
149
|
-
|
|
244
|
+
## Next.js Integration
|
|
150
245
|
|
|
151
246
|
```tsx
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
247
|
+
// app/providers.tsx
|
|
248
|
+
'use client';
|
|
249
|
+
|
|
250
|
+
import { UnifiedCAMSProvider } from '@nibssplc/cams-sdk-react';
|
|
251
|
+
|
|
252
|
+
export function Providers({ children }: { children: React.ReactNode }) {
|
|
253
|
+
return (
|
|
254
|
+
<UnifiedCAMSProvider mode="MSAL" {...config}>
|
|
255
|
+
{children}
|
|
256
|
+
</UnifiedCAMSProvider>
|
|
257
|
+
);
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
// app/layout.tsx
|
|
261
|
+
import { Providers } from './providers';
|
|
262
|
+
|
|
263
|
+
export default function RootLayout({ children }) {
|
|
264
|
+
return (
|
|
265
|
+
<html>
|
|
266
|
+
<body>
|
|
267
|
+
<Providers>{children}</Providers>
|
|
268
|
+
</body>
|
|
269
|
+
</html>
|
|
270
|
+
);
|
|
271
|
+
}
|
|
272
|
+
```
|
|
273
|
+
|
|
274
|
+
## Styling
|
|
275
|
+
|
|
276
|
+
Components use Tailwind CSS. Ensure Tailwind is configured in your project:
|
|
277
|
+
|
|
278
|
+
```bash
|
|
279
|
+
npm install -D tailwindcss
|
|
280
|
+
npx tailwindcss init
|
|
155
281
|
```
|
|
156
282
|
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
- `
|
|
283
|
+
## Examples
|
|
284
|
+
|
|
285
|
+
See the [examples](../../examples) directory for complete implementations:
|
|
286
|
+
- `integrated-mfa-example.tsx` - MSAL mode with MFA
|
|
287
|
+
- `popup-auth-example.tsx` - Regular popup authentication
|
|
288
|
+
|
|
289
|
+
## License
|
|
290
|
+
|
|
291
|
+
MIT
|
|
292
|
+
|
|
293
|
+
## Author
|
|
294
|
+
|
|
295
|
+
NIBSS PLC, Caleb Boluwade
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
interface ADLoginModalProps {
|
|
2
|
+
open: boolean;
|
|
3
|
+
onOpenChange: (open: boolean) => void;
|
|
4
|
+
onLogin: (credentials: Credentials) => Promise<void>;
|
|
5
|
+
}
|
|
6
|
+
export declare const ADLoginModal: ({ open, onOpenChange, onLogin, }: ADLoginModalProps) => import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export {};
|
|
@@ -1,8 +1,16 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { PublicClientApplication, Configuration } from
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { PublicClientApplication, Configuration } from "@azure/msal-browser";
|
|
3
|
+
import { Profile } from "@nibssplc/cams-sdk";
|
|
4
|
+
import { UseCAMSMSALAuthReturn, UseCAMSMSALAuthOptions } from "../hooks/useCAMSMSALAuth";
|
|
5
|
+
interface CAMSMSALContextValue extends UseCAMSMSALAuthReturn {
|
|
6
|
+
userProfile: Profile | null;
|
|
7
|
+
setUserProfile: (profile: Profile | null) => void;
|
|
8
|
+
}
|
|
9
|
+
export interface CAMSMSALProviderProps extends UseCAMSMSALAuthOptions {
|
|
10
|
+
children: React.ReactNode;
|
|
5
11
|
msalConfig: Configuration;
|
|
6
12
|
msalInstance?: PublicClientApplication;
|
|
7
13
|
}
|
|
8
|
-
export declare function CAMSMSALProvider(
|
|
14
|
+
export declare function CAMSMSALProvider(props: Readonly<CAMSMSALProviderProps>): import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
export declare function useCAMSMSALContext(): CAMSMSALContextValue;
|
|
16
|
+
export {};
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Profile } from '@nibssplc/cams-sdk';
|
|
3
3
|
import { UseCAMSAuthReturn, UseCAMSAuthOptions } from '../hooks/useCAMSAuth';
|
|
4
4
|
interface CAMSContextValue extends UseCAMSAuthReturn {
|
|
5
|
-
|
|
5
|
+
userProfile: Profile | null;
|
|
6
|
+
setUserProfile: (profile: Profile | null) => void;
|
|
6
7
|
}
|
|
7
8
|
export interface CAMSProviderProps extends UseCAMSAuthOptions {
|
|
8
|
-
children: ReactNode;
|
|
9
|
-
defaultConfig?: Partial<CAMSConfig>;
|
|
9
|
+
children: React.ReactNode;
|
|
10
10
|
}
|
|
11
|
-
export declare function CAMSProvider({ children,
|
|
11
|
+
export declare function CAMSProvider({ children, ...authOptions }: Readonly<CAMSProviderProps>): import("react/jsx-runtime").JSX.Element;
|
|
12
12
|
export declare function useCAMSContext(): CAMSContextValue;
|
|
13
13
|
export {};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Initiates the WebAuthn registration process.
|
|
3
|
+
* It takes server-provided options, converts them for the browser API,
|
|
4
|
+
* calls navigator.credentials.create(), and then converts the result
|
|
5
|
+
* back into a JSON-friendly format.
|
|
6
|
+
*
|
|
7
|
+
* @param options - The PublicKeyCredentialCreationOptions from the server.
|
|
8
|
+
* @returns A promise that resolves to a JSON-serializable representation of the PublicKeyCredential.
|
|
9
|
+
*/
|
|
10
|
+
export declare function register(options: PublicKeyCredentialCreationOptions): Promise<PublicKeyCredential>;
|
|
11
|
+
/**
|
|
12
|
+
* Initiates the WebAuthn authentication process.
|
|
13
|
+
* It takes server-provided options, converts them for the browser API,
|
|
14
|
+
* calls navigator.credentials.get(), and then converts the result
|
|
15
|
+
* back into a JSON-friendly format.
|
|
16
|
+
*
|
|
17
|
+
* @param options - The PublicKeyCredentialRequestOptions from the server.
|
|
18
|
+
* @returns A promise that resolves to a JSON-serializable representation of the PublicKeyCredential.
|
|
19
|
+
*/
|
|
20
|
+
export declare function authenticate(options: PublicKeyCredentialRequestOptions): Promise<PublicKeyCredential>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
interface GenericOTPProps {
|
|
2
|
+
value: string;
|
|
3
|
+
setValue: (v: string) => void;
|
|
4
|
+
setLoading?: React.Dispatch<React.SetStateAction<boolean>>;
|
|
5
|
+
isDisabled: boolean;
|
|
6
|
+
onChangeOTP: (val: string) => void;
|
|
7
|
+
fieldName: "AuthenticatorCode" | "EmailOTP";
|
|
8
|
+
attemptCount?: number;
|
|
9
|
+
remainingAttempts?: number;
|
|
10
|
+
isMaxAttemptsReached?: boolean;
|
|
11
|
+
}
|
|
12
|
+
export declare const GenericOTPVerifier: ({ value, setValue, setLoading, onChangeOTP, fieldName, attemptCount, remainingAttempts, isMaxAttemptsReached, }: GenericOTPProps) => import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import z from "zod";
|
|
2
|
+
declare const MFAEndpointsSchema: z.ZodObject<{
|
|
3
|
+
ValidateMFA: z.ZodURL;
|
|
4
|
+
}, z.core.$strip>;
|
|
5
|
+
export type MFAEndpoints = z.infer<typeof MFAEndpointsSchema>;
|
|
6
|
+
interface MFAGateProps {
|
|
7
|
+
children: React.ReactNode;
|
|
8
|
+
fallback?: React.ReactNode;
|
|
9
|
+
MFAEndpoints?: MFAEndpoints;
|
|
10
|
+
}
|
|
11
|
+
declare const MFAGate: ({ children, fallback, MFAEndpoints, }: MFAGateProps) => string | number | bigint | boolean | Iterable<import("react").ReactNode> | Promise<string | number | bigint | boolean | import("react").ReactPortal | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | Iterable<import("react").ReactNode> | null | undefined> | import("react/jsx-runtime").JSX.Element | null;
|
|
12
|
+
export default MFAGate;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
interface MFAOptionsProps {
|
|
2
|
+
onComplete?: (success: boolean) => void;
|
|
3
|
+
onAuthFailed?: () => void;
|
|
4
|
+
MFAEndpoint?: string;
|
|
5
|
+
}
|
|
6
|
+
declare const MFAOptions: ({ onComplete, onAuthFailed, MFAEndpoint, }?: MFAOptionsProps) => import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export default MFAOptions;
|
|
@@ -4,4 +4,4 @@ export interface ProtectedRouteProps {
|
|
|
4
4
|
fallback?: ReactNode;
|
|
5
5
|
redirectTo?: string;
|
|
6
6
|
}
|
|
7
|
-
export declare function ProtectedRoute({ children, fallback, redirectTo }: ProtectedRouteProps): string | number | true | Iterable<React.ReactNode> | import("react/jsx-runtime").JSX.Element | null;
|
|
7
|
+
export declare function ProtectedRoute({ children, fallback, redirectTo }: ProtectedRouteProps): string | number | bigint | true | Iterable<React.ReactNode> | Promise<string | number | bigint | boolean | React.ReactPortal | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | null | undefined> | import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { PublicClientApplication, Configuration } from "@azure/msal-browser";
|
|
3
|
+
import { UseCAMSAuthOptions } from "../hooks/useCAMSAuth";
|
|
4
|
+
import { UseCAMSMSALAuthOptions } from "../hooks/useCAMSMSALAuth";
|
|
5
|
+
import { useCAMSContext } from "../context/CAMSContext";
|
|
6
|
+
interface BaseProviderProps {
|
|
7
|
+
children: React.ReactNode;
|
|
8
|
+
appCode: string;
|
|
9
|
+
}
|
|
10
|
+
interface RegularProviderProps extends BaseProviderProps, Omit<UseCAMSAuthOptions, "appCode"> {
|
|
11
|
+
mode: "REGULAR";
|
|
12
|
+
}
|
|
13
|
+
interface MSALProviderProps extends BaseProviderProps, Omit<UseCAMSMSALAuthOptions, "MFAEndpoint"> {
|
|
14
|
+
mode: "MSAL";
|
|
15
|
+
msalConfig: Configuration;
|
|
16
|
+
msalInstance?: PublicClientApplication;
|
|
17
|
+
}
|
|
18
|
+
type UnifiedCAMSProviderProps = RegularProviderProps | MSALProviderProps;
|
|
19
|
+
export declare function UnifiedCAMSProvider(props: UnifiedCAMSProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
20
|
+
export declare const CAMSProvider: (props: Omit<RegularProviderProps, "mode">) => import("react/jsx-runtime").JSX.Element;
|
|
21
|
+
export declare const CAMSMSALProvider: (props: Omit<MSALProviderProps, "mode">) => import("react/jsx-runtime").JSX.Element;
|
|
22
|
+
export { useCAMSContext };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { type VariantProps } from "class-variance-authority";
|
|
3
|
+
declare const buttonVariants: (props?: ({
|
|
4
|
+
variant?: "link" | "default" | "destructive" | "outline" | "secondary" | "ghost" | null | undefined;
|
|
5
|
+
size?: "default" | "sm" | "lg" | "icon" | null | undefined;
|
|
6
|
+
} & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
|
|
7
|
+
declare function Button({ className, variant, size, asChild, ...props }: React.ComponentProps<"button"> & VariantProps<typeof buttonVariants> & {
|
|
8
|
+
asChild?: boolean;
|
|
9
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export { Button, buttonVariants };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
declare function Card({ className, ...props }: React.ComponentProps<"div">): import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
declare function CardHeader({ className, ...props }: React.ComponentProps<"div">): import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
declare function CardTitle({ className, ...props }: React.ComponentProps<"div">): import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
declare function CardDescription({ className, ...props }: React.ComponentProps<"div">): import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
declare function CardAction({ className, ...props }: React.ComponentProps<"div">): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
declare function CardContent({ className, ...props }: React.ComponentProps<"div">): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
declare function CardFooter({ className, ...props }: React.ComponentProps<"div">): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export { Card, CardHeader, CardFooter, CardTitle, CardAction, CardDescription, CardContent, };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import * as DialogPrimitive from "@radix-ui/react-dialog";
|
|
3
|
+
declare function Dialog({ ...props }: React.ComponentProps<typeof DialogPrimitive.Root>): import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
declare function DialogTrigger({ ...props }: React.ComponentProps<typeof DialogPrimitive.Trigger>): import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
declare function DialogPortal({ ...props }: React.ComponentProps<typeof DialogPrimitive.Portal>): import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
declare function DialogClose({ ...props }: React.ComponentProps<typeof DialogPrimitive.Close>): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
declare function DialogOverlay({ className, ...props }: React.ComponentProps<typeof DialogPrimitive.Overlay>): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
declare function DialogContent({ className, children, showCloseButton, ...props }: React.ComponentProps<typeof DialogPrimitive.Content> & {
|
|
9
|
+
showCloseButton?: boolean;
|
|
10
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
declare function DialogHeader({ className, ...props }: React.ComponentProps<"div">): import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
declare function DialogFooter({ className, ...props }: React.ComponentProps<"div">): import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
declare function DialogTitle({ className, ...props }: React.ComponentProps<typeof DialogPrimitive.Title>): import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
declare function DialogDescription({ className, ...props }: React.ComponentProps<typeof DialogPrimitive.Description>): import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
export { Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import * as LabelPrimitive from "@radix-ui/react-label";
|
|
3
|
+
import { Slot } from "@radix-ui/react-slot";
|
|
4
|
+
import { type ControllerProps, type FieldPath, type FieldValues } from "react-hook-form";
|
|
5
|
+
declare const Form: <TFieldValues extends FieldValues, TContext = any, TTransformedValues = TFieldValues>(props: import("react-hook-form").FormProviderProps<TFieldValues, TContext, TTransformedValues>) => React.JSX.Element;
|
|
6
|
+
declare const FormField: <TFieldValues extends FieldValues = FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>>({ ...props }: ControllerProps<TFieldValues, TName>) => import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
declare const useFormField: () => {
|
|
8
|
+
invalid: boolean;
|
|
9
|
+
isDirty: boolean;
|
|
10
|
+
isTouched: boolean;
|
|
11
|
+
isValidating: boolean;
|
|
12
|
+
error?: import("react-hook-form").FieldError;
|
|
13
|
+
id: string;
|
|
14
|
+
name: string;
|
|
15
|
+
formItemId: string;
|
|
16
|
+
formDescriptionId: string;
|
|
17
|
+
formMessageId: string;
|
|
18
|
+
};
|
|
19
|
+
declare function FormItem({ className, ...props }: React.ComponentProps<"div">): import("react/jsx-runtime").JSX.Element;
|
|
20
|
+
declare function FormLabel({ className, ...props }: React.ComponentProps<typeof LabelPrimitive.Root>): import("react/jsx-runtime").JSX.Element;
|
|
21
|
+
declare function FormControl({ ...props }: React.ComponentProps<typeof Slot>): import("react/jsx-runtime").JSX.Element;
|
|
22
|
+
declare function FormDescription({ className, ...props }: React.ComponentProps<"p">): import("react/jsx-runtime").JSX.Element;
|
|
23
|
+
declare function FormMessage({ className, ...props }: React.ComponentProps<"p">): import("react/jsx-runtime").JSX.Element | null;
|
|
24
|
+
export { useFormField, Form, FormItem, FormLabel, FormControl, FormDescription, FormMessage, FormField, };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { OTPInput } from "input-otp";
|
|
3
|
+
declare function InputOTP({ className, containerClassName, ...props }: React.ComponentProps<typeof OTPInput> & {
|
|
4
|
+
containerClassName?: string;
|
|
5
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
declare function InputOTPGroup({ className, ...props }: React.ComponentProps<"div">): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
declare function InputOTPSlot({ index, className, ...props }: React.ComponentProps<"div"> & {
|
|
8
|
+
index: number;
|
|
9
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
declare function InputOTPSeparator({ ...props }: React.ComponentProps<"div">): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export { InputOTP, InputOTPGroup, InputOTPSlot, InputOTPSeparator };
|