@nibssplc/cams-sdk-react 1.0.0-rc.10 → 1.0.0-rc.12
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/components/CAMSMSALProvider.d.ts +1 -0
- package/dist/components/DefaultLoginPage.d.ts +1 -0
- package/dist/components/UnifiedCAMSProvider.d.ts +1 -0
- package/dist/hooks/useCAMSMSALAuth.d.ts +1 -0
- package/dist/index.cjs.js +95 -44
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.esm.js +95 -44
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
package/dist/index.esm.js
CHANGED
|
@@ -20,6 +20,53 @@ import { motion } from 'framer-motion';
|
|
|
20
20
|
import axios from 'axios';
|
|
21
21
|
import https from 'https';
|
|
22
22
|
|
|
23
|
+
// Crypto polyfill for MSAL browser compatibility
|
|
24
|
+
if (typeof window !== 'undefined') {
|
|
25
|
+
// Ensure crypto object exists
|
|
26
|
+
if (!window.crypto) {
|
|
27
|
+
window.crypto = {};
|
|
28
|
+
}
|
|
29
|
+
// Polyfill getRandomValues with better entropy
|
|
30
|
+
if (!window.crypto.getRandomValues) {
|
|
31
|
+
window.crypto.getRandomValues = function (array) {
|
|
32
|
+
var bytes = new Uint8Array(array.buffer, array.byteOffset, array.byteLength);
|
|
33
|
+
for (var i = 0; i < bytes.length; i++) {
|
|
34
|
+
bytes[i] = Math.floor((Math.random() * 256 +
|
|
35
|
+
(performance.now() % 256) +
|
|
36
|
+
(Date.now() % 256)) / 3) & 0xFF;
|
|
37
|
+
}
|
|
38
|
+
return array;
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
// Polyfill crypto.subtle
|
|
42
|
+
if (!window.crypto.subtle) {
|
|
43
|
+
window.crypto.subtle = {
|
|
44
|
+
digest: function (algorithm, data) { return __awaiter(void 0, void 0, void 0, function () {
|
|
45
|
+
var bytes, hash, i;
|
|
46
|
+
return __generator(this, function (_a) {
|
|
47
|
+
bytes = new Uint8Array(data);
|
|
48
|
+
hash = 0;
|
|
49
|
+
for (i = 0; i < bytes.length; i++) {
|
|
50
|
+
hash = ((hash << 5) - hash) + bytes[i];
|
|
51
|
+
hash = hash & hash;
|
|
52
|
+
}
|
|
53
|
+
return [2 /*return*/, new Uint8Array([hash]).buffer];
|
|
54
|
+
});
|
|
55
|
+
}); }
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
// Polyfill randomUUID
|
|
59
|
+
if (!window.crypto.randomUUID) {
|
|
60
|
+
window.crypto.randomUUID = function () {
|
|
61
|
+
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
|
|
62
|
+
var r = (Math.random() * 16) | 0;
|
|
63
|
+
var v = c === 'x' ? r : (r & 0x3) | 0x8;
|
|
64
|
+
return v.toString(16);
|
|
65
|
+
});
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
23
70
|
/******************************************************************************
|
|
24
71
|
Copyright (c) Microsoft Corporation.
|
|
25
72
|
|
|
@@ -60,7 +107,7 @@ function __rest(s, e) {
|
|
|
60
107
|
return t;
|
|
61
108
|
}
|
|
62
109
|
|
|
63
|
-
function __awaiter(thisArg, _arguments, P, generator) {
|
|
110
|
+
function __awaiter$1(thisArg, _arguments, P, generator) {
|
|
64
111
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
65
112
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
66
113
|
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
@@ -70,7 +117,7 @@ function __awaiter(thisArg, _arguments, P, generator) {
|
|
|
70
117
|
});
|
|
71
118
|
}
|
|
72
119
|
|
|
73
|
-
function __generator(thisArg, body) {
|
|
120
|
+
function __generator$1(thisArg, body) {
|
|
74
121
|
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
75
122
|
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
76
123
|
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
@@ -167,10 +214,10 @@ function useCAMSAuth(options) {
|
|
|
167
214
|
}
|
|
168
215
|
}
|
|
169
216
|
}, [options.storageKey]);
|
|
170
|
-
var login = useCallback(function (config) { return __awaiter(_this, void 0, void 0, function () {
|
|
217
|
+
var login = useCallback(function (config) { return __awaiter$1(_this, void 0, void 0, function () {
|
|
171
218
|
var loginConfig, userProfile, err_1, e, isPopupClosedError, restoredToken, userProfile;
|
|
172
219
|
var _a, _b, _c;
|
|
173
|
-
return __generator(this, function (_d) {
|
|
220
|
+
return __generator$1(this, function (_d) {
|
|
174
221
|
switch (_d.label) {
|
|
175
222
|
case 0:
|
|
176
223
|
if (!sessionManagerRef.current)
|
|
@@ -218,8 +265,8 @@ function useCAMSAuth(options) {
|
|
|
218
265
|
}
|
|
219
266
|
});
|
|
220
267
|
}); }, [options.idleTimeout]);
|
|
221
|
-
var logout = useCallback(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
222
|
-
return __generator(this, function (_a) {
|
|
268
|
+
var logout = useCallback(function () { return __awaiter$1(_this, void 0, void 0, function () {
|
|
269
|
+
return __generator$1(this, function (_a) {
|
|
223
270
|
switch (_a.label) {
|
|
224
271
|
case 0:
|
|
225
272
|
if (!sessionManagerRef.current)
|
|
@@ -353,10 +400,10 @@ function useCAMSMSALAuth(options) {
|
|
|
353
400
|
// };
|
|
354
401
|
// handleRedirect();
|
|
355
402
|
// }, []);
|
|
356
|
-
var login = useCallback(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
403
|
+
var login = useCallback(function () { return __awaiter$1(_this, void 0, void 0, function () {
|
|
357
404
|
var response, mfaConfig, authenticator, err_1, camsError_1, camsError;
|
|
358
405
|
var _a, _b, _c, _d;
|
|
359
|
-
return __generator(this, function (_e) {
|
|
406
|
+
return __generator$1(this, function (_e) {
|
|
360
407
|
switch (_e.label) {
|
|
361
408
|
case 0:
|
|
362
409
|
setError(null);
|
|
@@ -420,8 +467,8 @@ function useCAMSMSALAuth(options) {
|
|
|
420
467
|
}
|
|
421
468
|
});
|
|
422
469
|
}); }, [instance, scopes, options]);
|
|
423
|
-
var completeMFA = useCallback(function (data) { return __awaiter(_this, void 0, void 0, function () {
|
|
424
|
-
return __generator(this, function (_a) {
|
|
470
|
+
var completeMFA = useCallback(function (data) { return __awaiter$1(_this, void 0, void 0, function () {
|
|
471
|
+
return __generator$1(this, function (_a) {
|
|
425
472
|
if (!mfaAuthenticator) {
|
|
426
473
|
throw new CAMSError(CAMSErrorType.API_VALIDATION_ERROR, "MFA Authenticator not initialized");
|
|
427
474
|
}
|
|
@@ -455,8 +502,8 @@ function useCAMSMSALAuth(options) {
|
|
|
455
502
|
return [2 /*return*/];
|
|
456
503
|
});
|
|
457
504
|
}); }, [mfaAuthenticator, accessToken, idToken, storageKey]);
|
|
458
|
-
var sendEmailOTP = useCallback(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
459
|
-
return __generator(this, function (_a) {
|
|
505
|
+
var sendEmailOTP = useCallback(function () { return __awaiter$1(_this, void 0, void 0, function () {
|
|
506
|
+
return __generator$1(this, function (_a) {
|
|
460
507
|
switch (_a.label) {
|
|
461
508
|
case 0:
|
|
462
509
|
if (!mfaAuthenticator) {
|
|
@@ -467,9 +514,9 @@ function useCAMSMSALAuth(options) {
|
|
|
467
514
|
}
|
|
468
515
|
});
|
|
469
516
|
}); }, [mfaAuthenticator]);
|
|
470
|
-
var logout = useCallback(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
517
|
+
var logout = useCallback(function () { return __awaiter$1(_this, void 0, void 0, function () {
|
|
471
518
|
var err_2, camsError;
|
|
472
|
-
return __generator(this, function (_a) {
|
|
519
|
+
return __generator$1(this, function (_a) {
|
|
473
520
|
switch (_a.label) {
|
|
474
521
|
case 0:
|
|
475
522
|
_a.trys.push([0, 2, , 3]);
|
|
@@ -553,10 +600,10 @@ function arrayBufferToBase64url(buffer) {
|
|
|
553
600
|
* @returns A promise that resolves to a JSON-serializable representation of the PublicKeyCredential.
|
|
554
601
|
*/
|
|
555
602
|
function register(options) {
|
|
556
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
603
|
+
return __awaiter$1(this, void 0, void 0, function () {
|
|
557
604
|
var createOptions, credential, publicKeyCredential, attestationResponse, transports, err_1;
|
|
558
605
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
559
|
-
return __generator(this, function (_k) {
|
|
606
|
+
return __generator$1(this, function (_k) {
|
|
560
607
|
switch (_k.label) {
|
|
561
608
|
case 0:
|
|
562
609
|
_k.trys.push([0, 2, , 3]);
|
|
@@ -614,10 +661,10 @@ function register(options) {
|
|
|
614
661
|
* @returns A promise that resolves to a JSON-serializable representation of the PublicKeyCredential.
|
|
615
662
|
*/
|
|
616
663
|
function authenticate(options) {
|
|
617
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
664
|
+
return __awaiter$1(this, void 0, void 0, function () {
|
|
618
665
|
var getOptions, credential, publicKeyCredential, assertionResponse;
|
|
619
666
|
var _a;
|
|
620
|
-
return __generator(this, function (_b) {
|
|
667
|
+
return __generator$1(this, function (_b) {
|
|
621
668
|
switch (_b.label) {
|
|
622
669
|
case 0:
|
|
623
670
|
getOptions = __assign(__assign({}, options), { challenge: base64urlToArrayBuffer(options.challenge), allowCredentials: (_a = options.allowCredentials) === null || _a === void 0 ? void 0 : _a.map(function (cred) { return (__assign(__assign({}, cred), { id: base64urlToArrayBuffer(cred.id) })); }) });
|
|
@@ -1185,8 +1232,8 @@ function CAMSMSALProviderInner(_a) {
|
|
|
1185
1232
|
}
|
|
1186
1233
|
}, [userProfile, profileStorageKey]);
|
|
1187
1234
|
// Enhanced logout that also clears profile
|
|
1188
|
-
var enhancedLogout = function () { return __awaiter(_this, void 0, void 0, function () {
|
|
1189
|
-
return __generator(this, function (_a) {
|
|
1235
|
+
var enhancedLogout = function () { return __awaiter$1(_this, void 0, void 0, function () {
|
|
1236
|
+
return __generator$1(this, function (_a) {
|
|
1190
1237
|
switch (_a.label) {
|
|
1191
1238
|
case 0: return [4 /*yield*/, auth.logout()];
|
|
1192
1239
|
case 1:
|
|
@@ -1282,8 +1329,8 @@ function CAMSProviderCore(props) {
|
|
|
1282
1329
|
}
|
|
1283
1330
|
}
|
|
1284
1331
|
}, [userProfile, profileStorageKey]);
|
|
1285
|
-
var enhancedLogout = function () { return __awaiter(_this, void 0, void 0, function () {
|
|
1286
|
-
return __generator(this, function (_a) {
|
|
1332
|
+
var enhancedLogout = function () { return __awaiter$1(_this, void 0, void 0, function () {
|
|
1333
|
+
return __generator$1(this, function (_a) {
|
|
1287
1334
|
switch (_a.label) {
|
|
1288
1335
|
case 0: return [4 /*yield*/, auth.logout()];
|
|
1289
1336
|
case 1:
|
|
@@ -1781,9 +1828,9 @@ var useOTPHandler = function (_a) {
|
|
|
1781
1828
|
var _b = useState(false), loading = _b[0], setLoading = _b[1];
|
|
1782
1829
|
var _c = useState(0), attemptCount = _c[0], setAttemptCount = _c[1];
|
|
1783
1830
|
var _d = useState(false), isMaxAttemptsReached = _d[0], setIsMaxAttemptsReached = _d[1];
|
|
1784
|
-
var handleSubmitOTP = useMemo(function () { return function (authenticationValue) { return __awaiter(void 0, void 0, void 0, function () {
|
|
1831
|
+
var handleSubmitOTP = useMemo(function () { return function (authenticationValue) { return __awaiter$1(void 0, void 0, void 0, function () {
|
|
1785
1832
|
var currentAttempt, response, error_1, currentAttempt;
|
|
1786
|
-
return __generator(this, function (_a) {
|
|
1833
|
+
return __generator$1(this, function (_a) {
|
|
1787
1834
|
switch (_a.label) {
|
|
1788
1835
|
case 0:
|
|
1789
1836
|
if (isMaxAttemptsReached) {
|
|
@@ -1873,9 +1920,9 @@ var useCredentialsHandler = function (onAuthComplete) {
|
|
|
1873
1920
|
var _b = useState(0), attemptCount = _b[0], setAttemptCount = _b[1];
|
|
1874
1921
|
var _c = useState(false), isMaxAttemptsReached = _c[0], setIsMaxAttemptsReached = _c[1];
|
|
1875
1922
|
var handleSubmitCredentials = useMemo(function () {
|
|
1876
|
-
return function (CredAuthEndpoint, credentials, appCode) { return __awaiter(void 0, void 0, void 0, function () {
|
|
1923
|
+
return function (CredAuthEndpoint, credentials, appCode) { return __awaiter$1(void 0, void 0, void 0, function () {
|
|
1877
1924
|
var currentAttempt, response, error_2, currentAttempt;
|
|
1878
|
-
return __generator(this, function (_a) {
|
|
1925
|
+
return __generator$1(this, function (_a) {
|
|
1879
1926
|
switch (_a.label) {
|
|
1880
1927
|
case 0:
|
|
1881
1928
|
_a.trys.push([0, 2, 3, 4]);
|
|
@@ -1947,15 +1994,15 @@ var MFAOptions = function (_a) {
|
|
|
1947
1994
|
var context = useCAMSContext();
|
|
1948
1995
|
var _f = context.authMode === "MSAL" && "sendEmailOTP" in context
|
|
1949
1996
|
? context
|
|
1950
|
-
: { sendEmailOTP: null, completeMFA: null, logout: function () { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) {
|
|
1997
|
+
: { sendEmailOTP: null, completeMFA: null, logout: function () { return __awaiter$1(void 0, void 0, void 0, function () { return __generator$1(this, function (_a) {
|
|
1951
1998
|
return [2 /*return*/];
|
|
1952
1999
|
}); }); } }, sendEmailOTP = _f.sendEmailOTP, completeMFA = _f.completeMFA, logout = _f.logout;
|
|
1953
2000
|
var accessToken = context.authMode === "MSAL" ? context.accessToken : "";
|
|
1954
2001
|
var idToken = context.authMode === "MSAL" ? context.idToken : "";
|
|
1955
2002
|
var authenticate = useWebAuthn().authenticate;
|
|
1956
|
-
var handleFIDOLogin = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
2003
|
+
var handleFIDOLogin = function () { return __awaiter$1(void 0, void 0, void 0, function () {
|
|
1957
2004
|
var options, assertionResponse, error_1;
|
|
1958
|
-
return __generator(this, function (_a) {
|
|
2005
|
+
return __generator$1(this, function (_a) {
|
|
1959
2006
|
switch (_a.label) {
|
|
1960
2007
|
case 0:
|
|
1961
2008
|
_a.trys.push([0, 4, , 5]);
|
|
@@ -2035,9 +2082,9 @@ var MFAOptions = function (_a) {
|
|
|
2035
2082
|
}
|
|
2036
2083
|
var content = jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, {});
|
|
2037
2084
|
if (!authType) {
|
|
2038
|
-
content = (jsxRuntimeExports.jsxs("div", { className: "space-y-4", children: [jsxRuntimeExports.jsx("p", { className: "text-sm text-gray-600 text-center mb-6", children: "Choose your preferred authentication method:" }), jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-3", children: [jsxRuntimeExports.jsxs(Button, { variant: "outline", className: "w-full flex items-center justify-start gap-3 p-4 h-auto border-2 hover:border-[#506f4a] hover:bg-[#506f4a]/5 transition-all", onClick: function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
2085
|
+
content = (jsxRuntimeExports.jsxs("div", { className: "space-y-4", children: [jsxRuntimeExports.jsx("p", { className: "text-sm text-gray-600 text-center mb-6", children: "Choose your preferred authentication method:" }), jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-3", children: [jsxRuntimeExports.jsxs(Button, { variant: "outline", className: "w-full flex items-center justify-start gap-3 p-4 h-auto border-2 hover:border-[#506f4a] hover:bg-[#506f4a]/5 transition-all", onClick: function () { return __awaiter$1(void 0, void 0, void 0, function () {
|
|
2039
2086
|
var success;
|
|
2040
|
-
return __generator(this, function (_a) {
|
|
2087
|
+
return __generator$1(this, function (_a) {
|
|
2041
2088
|
switch (_a.label) {
|
|
2042
2089
|
case 0:
|
|
2043
2090
|
// resetAttempts();
|
|
@@ -2108,16 +2155,16 @@ var ADLoginModal = function (_a) {
|
|
|
2108
2155
|
resolver: a$1(credentialsSchema),
|
|
2109
2156
|
defaultValues: { username: "", password: "" },
|
|
2110
2157
|
});
|
|
2111
|
-
var handleCredentialsSubmit = function (values) { return __awaiter(void 0, void 0, void 0, function () {
|
|
2112
|
-
return __generator(this, function (_a) {
|
|
2158
|
+
var handleCredentialsSubmit = function (values) { return __awaiter$1(void 0, void 0, void 0, function () {
|
|
2159
|
+
return __generator$1(this, function (_a) {
|
|
2113
2160
|
setCredentials(values);
|
|
2114
2161
|
setStep("mfa");
|
|
2115
2162
|
return [2 /*return*/];
|
|
2116
2163
|
});
|
|
2117
2164
|
}); };
|
|
2118
|
-
var handleMFASubmit = function (code) { return __awaiter(void 0, void 0, void 0, function () {
|
|
2165
|
+
var handleMFASubmit = function (code) { return __awaiter$1(void 0, void 0, void 0, function () {
|
|
2119
2166
|
var error_1;
|
|
2120
|
-
return __generator(this, function (_a) {
|
|
2167
|
+
return __generator$1(this, function (_a) {
|
|
2121
2168
|
switch (_a.label) {
|
|
2122
2169
|
case 0:
|
|
2123
2170
|
setIsLoading(true);
|
|
@@ -2178,8 +2225,8 @@ var DefaultLoginPage = function (_a) {
|
|
|
2178
2225
|
var login = context.login, isLoading = context.isLoading, authMode = context.authMode;
|
|
2179
2226
|
var _b = useState(false), showADModal = _b[0], setShowADModal = _b[1];
|
|
2180
2227
|
var register = useWebAuthn().register;
|
|
2181
|
-
var _c = useCredentialsHandler(function (state, data) { return __awaiter(void 0, void 0, void 0, function () {
|
|
2182
|
-
return __generator(this, function (_a) {
|
|
2228
|
+
var _c = useCredentialsHandler(function (state, data) { return __awaiter$1(void 0, void 0, void 0, function () {
|
|
2229
|
+
return __generator$1(this, function (_a) {
|
|
2183
2230
|
console.log(data);
|
|
2184
2231
|
if (state && data) {
|
|
2185
2232
|
context.isAuthenticated = true;
|
|
@@ -2193,6 +2240,10 @@ var DefaultLoginPage = function (_a) {
|
|
|
2193
2240
|
});
|
|
2194
2241
|
}); }), handleSubmitCredentials = _c.handleSubmitCredentials, isCredAuthLoading = _c.loading, setIsCredAuthLoading = _c.setLoading;
|
|
2195
2242
|
var handleMSALLogin = function () {
|
|
2243
|
+
if (typeof window !== "undefined" && !window.crypto) {
|
|
2244
|
+
toast.error("Crypto API not available. Please use a modern browser.");
|
|
2245
|
+
return;
|
|
2246
|
+
}
|
|
2196
2247
|
if (authMode === "MSAL") {
|
|
2197
2248
|
login();
|
|
2198
2249
|
}
|
|
@@ -2201,9 +2252,9 @@ var DefaultLoginPage = function (_a) {
|
|
|
2201
2252
|
console.warn("Regular CAMS login requires configuration");
|
|
2202
2253
|
}
|
|
2203
2254
|
};
|
|
2204
|
-
var handleRegister = function (data) { return __awaiter(void 0, void 0, void 0, function () {
|
|
2255
|
+
var handleRegister = function (data) { return __awaiter$1(void 0, void 0, void 0, function () {
|
|
2205
2256
|
var options, attestationResponse, error_1;
|
|
2206
|
-
return __generator(this, function (_a) {
|
|
2257
|
+
return __generator$1(this, function (_a) {
|
|
2207
2258
|
switch (_a.label) {
|
|
2208
2259
|
case 0:
|
|
2209
2260
|
_a.trys.push([0, 4, , 5]);
|
|
@@ -2235,15 +2286,15 @@ var DefaultLoginPage = function (_a) {
|
|
|
2235
2286
|
}
|
|
2236
2287
|
});
|
|
2237
2288
|
}); };
|
|
2238
|
-
return (jsxRuntimeExports.jsxs("main", { className: "min-h-screen bg-gray-50", children: [jsxRuntimeExports.jsx(motion.div, { initial: { opacity: 0 }, animate: { opacity: 1 }, exit: { opacity: 0 }, transition: { duration: 0.5 }, children: jsxRuntimeExports.jsx("div", { className: "flex h-screen items-center justify-center", children: jsxRuntimeExports.jsxs(motion.div, { variants: cardVariants, initial: "hidden", animate: "visible", exit: "exit", className: "w-full max-w-md p-6 space-y-4 bg-gray-50 rounded-2xl shadow-2xl --dark:bg-gray-800", children: [jsxRuntimeExports.jsxs(CardHeader, { className: "text-center space-y-3", children: [jsxRuntimeExports.jsx("div", { className: "w-full flex items-center justify-center", children: jsxRuntimeExports.jsx("img", { src: NIBSSLogo, alt: "NIBSS Logo", width: 265, height: 265 }) }), jsxRuntimeExports.jsx(CardTitle, { className: "text-3xl font-bold --text-gray-900 --dark:text-white", children: "NIBSS CAMS" }), jsxRuntimeExports.jsx(CardTitle, { className: "text-gray-500 dark:text-gray-400 font-bold text-lg", children: "Centralized Authentication" })] }), jsxRuntimeExports.jsxs(CardAction, { className: "w-full flex flex-col items-center justify-center text-center text-gray-500 dark:text-gray-400 mb-
|
|
2289
|
+
return (jsxRuntimeExports.jsxs("main", { className: "min-h-screen bg-gray-50", children: [jsxRuntimeExports.jsx(motion.div, { initial: { opacity: 0 }, animate: { opacity: 1 }, exit: { opacity: 0 }, transition: { duration: 0.5 }, children: jsxRuntimeExports.jsx("div", { className: "flex h-screen items-center justify-center", children: jsxRuntimeExports.jsxs(motion.div, { variants: cardVariants, initial: "hidden", animate: "visible", exit: "exit", className: "w-full max-w-md p-6 space-y-4 bg-gray-50 rounded-2xl shadow-2xl --dark:bg-gray-800", children: [jsxRuntimeExports.jsxs(CardHeader, { className: "text-center space-y-3", children: [jsxRuntimeExports.jsx("div", { className: "w-full flex items-center justify-center", children: jsxRuntimeExports.jsx("img", { src: NIBSSLogo, alt: "NIBSS Logo", width: 265, height: 265 }) }), jsxRuntimeExports.jsx(CardTitle, { className: "text-3xl font-bold --text-gray-900 --dark:text-white", children: "NIBSS CAMS" }), jsxRuntimeExports.jsx(CardTitle, { className: "text-gray-500 dark:text-gray-400 font-bold text-lg", children: "Centralized Authentication" })] }), jsxRuntimeExports.jsxs(CardAction, { className: "w-full flex flex-col items-center justify-center text-center text-gray-500 dark:text-gray-400 mb-8", children: [jsxRuntimeExports.jsx("img", { src: AuthLogo, alt: "Auth Logo", width: 365, height: 365 }), "Use Below Identity Providers To Authenticate"] }), jsxRuntimeExports.jsxs("div", { className: "space-y-4", children: [jsxRuntimeExports.jsxs(Button
|
|
2239
2290
|
// variant="outline"
|
|
2240
2291
|
, {
|
|
2241
2292
|
// variant="outline"
|
|
2242
2293
|
className: "w-full flex items-center justify-center cursor-pointer bg-[#506f4a] hover:bg-[#506f4a] rounded-lg border border-transparent px-5 py-8 text-base font-medium transition-colors duration-250", onClick: handleMSALLogin, disabled: isLoading, children: [jsxRuntimeExports.jsx("img", { src: MicrosoftLogo, alt: "Microsoft Logo", width: 35, height: 35 }), jsxRuntimeExports.jsx("span", { className: "ml-2", children: isLoading ? "Logging in..." : "Sign in with Microsoft" })] }), useADLogin && (jsxRuntimeExports.jsxs(Button, { className: "w-full flex items-center justify-center cursor-pointer bg-[#506f4a] hover:bg-[#506f4a] rounded-lg border border-transparent px-5 py-8 text-base font-medium transition-colors duration-250", onClick: function () { return setShowADModal(true); }, disabled: isLoading, children: [jsxRuntimeExports.jsx(KeyIcon, { className: "text-[#506f4a]", size: 64 }), jsxRuntimeExports.jsx("span", { children: isLoading
|
|
2243
2294
|
? "Logging in..."
|
|
2244
|
-
: "Sign in with ActiveDirectory" })] })), usePassKey && (jsxRuntimeExports.jsxs(Button, { className: "w-full flex items-center justify-center cursor-pointer bg-[#506f4a] hover:bg-[#506f4a] rounded-lg border border-transparent px-5 py-8 text-base font-medium transition-colors duration-250", onClick: function () { return handleRegister(PassKeysRegisterProps); }, disabled: isLoading, children: [jsxRuntimeExports.jsx(KeyIcon, { className: "text-[#506f4a]", size: 64 }), jsxRuntimeExports.jsx("span", { children: "Create a Passkey" })] }))] }), jsxRuntimeExports.jsxs(CardFooter, { className: "flex items-center justify-center mt-6 space-x-2 text-gray-400 text-sm", children: [jsxRuntimeExports.jsx(ShieldCheck, { className: "w-4 h-4 text-[#506f4a] pulse-glow" }), jsxRuntimeExports.jsx("span", { children: "Powered By NIBSS" })] })] }) }) }, "landing"), jsxRuntimeExports.jsx(ADLoginModal, { open: showADModal, onOpenChange: setShowADModal, isLoading: isCredAuthLoading, setIsLoading: setIsCredAuthLoading, onLogin: function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
|
|
2295
|
+
: "Sign in with ActiveDirectory" })] })), usePassKey && (jsxRuntimeExports.jsxs(Button, { className: "w-full flex items-center justify-center cursor-pointer bg-[#506f4a] hover:bg-[#506f4a] rounded-lg border border-transparent px-5 py-8 text-base font-medium transition-colors duration-250", onClick: function () { return handleRegister(PassKeysRegisterProps); }, disabled: isLoading, children: [jsxRuntimeExports.jsx(KeyIcon, { className: "text-[#506f4a]", size: 64 }), jsxRuntimeExports.jsx("span", { children: "Create a Passkey" })] }))] }), jsxRuntimeExports.jsxs(CardFooter, { className: "flex items-center justify-center mt-6 space-x-2 text-gray-400 text-sm", children: [jsxRuntimeExports.jsx(ShieldCheck, { className: "w-4 h-4 text-[#506f4a] pulse-glow" }), jsxRuntimeExports.jsx("span", { children: "Powered By NIBSS" })] })] }) }) }, "landing"), jsxRuntimeExports.jsx(ADLoginModal, { open: showADModal, onOpenChange: setShowADModal, isLoading: isCredAuthLoading, setIsLoading: setIsCredAuthLoading, onLogin: function (_a) { return __awaiter$1(void 0, [_a], void 0, function (_b) {
|
|
2245
2296
|
var username = _b.username, password = _b.password, MFACode = _b.MFACode;
|
|
2246
|
-
return __generator(this, function (_c) {
|
|
2297
|
+
return __generator$1(this, function (_c) {
|
|
2247
2298
|
// Implement your AD login logic here
|
|
2248
2299
|
console.log("AD Login:", { username: username, password: password, MFACode: MFACode });
|
|
2249
2300
|
// Example: await adLoginService(username, password, mfaCode);
|
|
@@ -2284,8 +2335,8 @@ var MFAGate = function (_a) {
|
|
|
2284
2335
|
if (!success)
|
|
2285
2336
|
Logger.error("MFA authentication failed");
|
|
2286
2337
|
}, []);
|
|
2287
|
-
var handleAuthFailed = useCallback(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
2288
|
-
return __generator(this, function (_a) {
|
|
2338
|
+
var handleAuthFailed = useCallback(function () { return __awaiter$1(void 0, void 0, void 0, function () {
|
|
2339
|
+
return __generator$1(this, function (_a) {
|
|
2289
2340
|
switch (_a.label) {
|
|
2290
2341
|
case 0: return [4 /*yield*/, context.logout()];
|
|
2291
2342
|
case 1:
|