@nibssplc/cams-sdk-react 1.0.0-rc.10 → 1.0.0-rc.11
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 +69 -44
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.esm.js +69 -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,27 @@ import { motion } from 'framer-motion';
|
|
|
20
20
|
import axios from 'axios';
|
|
21
21
|
import https from 'https';
|
|
22
22
|
|
|
23
|
+
var _a;
|
|
24
|
+
// Crypto polyfill for environments where crypto is not available
|
|
25
|
+
if (typeof window !== 'undefined' && !window.crypto) {
|
|
26
|
+
var crypto_1 = require('crypto');
|
|
27
|
+
// @ts-ignore
|
|
28
|
+
window.crypto = {
|
|
29
|
+
getRandomValues: function (arr) {
|
|
30
|
+
var bytes = crypto_1.randomBytes(arr.length);
|
|
31
|
+
for (var i = 0; i < arr.length; i++) {
|
|
32
|
+
arr[i] = bytes[i];
|
|
33
|
+
}
|
|
34
|
+
return arr;
|
|
35
|
+
},
|
|
36
|
+
subtle: ((_a = crypto_1.webcrypto) === null || _a === void 0 ? void 0 : _a.subtle) || {
|
|
37
|
+
digest: function () { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) {
|
|
38
|
+
throw new Error('crypto.subtle not available');
|
|
39
|
+
}); }); }
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
|
|
23
44
|
/******************************************************************************
|
|
24
45
|
Copyright (c) Microsoft Corporation.
|
|
25
46
|
|
|
@@ -60,7 +81,7 @@ function __rest(s, e) {
|
|
|
60
81
|
return t;
|
|
61
82
|
}
|
|
62
83
|
|
|
63
|
-
function __awaiter(thisArg, _arguments, P, generator) {
|
|
84
|
+
function __awaiter$1(thisArg, _arguments, P, generator) {
|
|
64
85
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
65
86
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
66
87
|
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
@@ -70,7 +91,7 @@ function __awaiter(thisArg, _arguments, P, generator) {
|
|
|
70
91
|
});
|
|
71
92
|
}
|
|
72
93
|
|
|
73
|
-
function __generator(thisArg, body) {
|
|
94
|
+
function __generator$1(thisArg, body) {
|
|
74
95
|
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
96
|
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
76
97
|
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
@@ -167,10 +188,10 @@ function useCAMSAuth(options) {
|
|
|
167
188
|
}
|
|
168
189
|
}
|
|
169
190
|
}, [options.storageKey]);
|
|
170
|
-
var login = useCallback(function (config) { return __awaiter(_this, void 0, void 0, function () {
|
|
191
|
+
var login = useCallback(function (config) { return __awaiter$1(_this, void 0, void 0, function () {
|
|
171
192
|
var loginConfig, userProfile, err_1, e, isPopupClosedError, restoredToken, userProfile;
|
|
172
193
|
var _a, _b, _c;
|
|
173
|
-
return __generator(this, function (_d) {
|
|
194
|
+
return __generator$1(this, function (_d) {
|
|
174
195
|
switch (_d.label) {
|
|
175
196
|
case 0:
|
|
176
197
|
if (!sessionManagerRef.current)
|
|
@@ -218,8 +239,8 @@ function useCAMSAuth(options) {
|
|
|
218
239
|
}
|
|
219
240
|
});
|
|
220
241
|
}); }, [options.idleTimeout]);
|
|
221
|
-
var logout = useCallback(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
222
|
-
return __generator(this, function (_a) {
|
|
242
|
+
var logout = useCallback(function () { return __awaiter$1(_this, void 0, void 0, function () {
|
|
243
|
+
return __generator$1(this, function (_a) {
|
|
223
244
|
switch (_a.label) {
|
|
224
245
|
case 0:
|
|
225
246
|
if (!sessionManagerRef.current)
|
|
@@ -353,10 +374,10 @@ function useCAMSMSALAuth(options) {
|
|
|
353
374
|
// };
|
|
354
375
|
// handleRedirect();
|
|
355
376
|
// }, []);
|
|
356
|
-
var login = useCallback(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
377
|
+
var login = useCallback(function () { return __awaiter$1(_this, void 0, void 0, function () {
|
|
357
378
|
var response, mfaConfig, authenticator, err_1, camsError_1, camsError;
|
|
358
379
|
var _a, _b, _c, _d;
|
|
359
|
-
return __generator(this, function (_e) {
|
|
380
|
+
return __generator$1(this, function (_e) {
|
|
360
381
|
switch (_e.label) {
|
|
361
382
|
case 0:
|
|
362
383
|
setError(null);
|
|
@@ -420,8 +441,8 @@ function useCAMSMSALAuth(options) {
|
|
|
420
441
|
}
|
|
421
442
|
});
|
|
422
443
|
}); }, [instance, scopes, options]);
|
|
423
|
-
var completeMFA = useCallback(function (data) { return __awaiter(_this, void 0, void 0, function () {
|
|
424
|
-
return __generator(this, function (_a) {
|
|
444
|
+
var completeMFA = useCallback(function (data) { return __awaiter$1(_this, void 0, void 0, function () {
|
|
445
|
+
return __generator$1(this, function (_a) {
|
|
425
446
|
if (!mfaAuthenticator) {
|
|
426
447
|
throw new CAMSError(CAMSErrorType.API_VALIDATION_ERROR, "MFA Authenticator not initialized");
|
|
427
448
|
}
|
|
@@ -455,8 +476,8 @@ function useCAMSMSALAuth(options) {
|
|
|
455
476
|
return [2 /*return*/];
|
|
456
477
|
});
|
|
457
478
|
}); }, [mfaAuthenticator, accessToken, idToken, storageKey]);
|
|
458
|
-
var sendEmailOTP = useCallback(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
459
|
-
return __generator(this, function (_a) {
|
|
479
|
+
var sendEmailOTP = useCallback(function () { return __awaiter$1(_this, void 0, void 0, function () {
|
|
480
|
+
return __generator$1(this, function (_a) {
|
|
460
481
|
switch (_a.label) {
|
|
461
482
|
case 0:
|
|
462
483
|
if (!mfaAuthenticator) {
|
|
@@ -467,9 +488,9 @@ function useCAMSMSALAuth(options) {
|
|
|
467
488
|
}
|
|
468
489
|
});
|
|
469
490
|
}); }, [mfaAuthenticator]);
|
|
470
|
-
var logout = useCallback(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
491
|
+
var logout = useCallback(function () { return __awaiter$1(_this, void 0, void 0, function () {
|
|
471
492
|
var err_2, camsError;
|
|
472
|
-
return __generator(this, function (_a) {
|
|
493
|
+
return __generator$1(this, function (_a) {
|
|
473
494
|
switch (_a.label) {
|
|
474
495
|
case 0:
|
|
475
496
|
_a.trys.push([0, 2, , 3]);
|
|
@@ -553,10 +574,10 @@ function arrayBufferToBase64url(buffer) {
|
|
|
553
574
|
* @returns A promise that resolves to a JSON-serializable representation of the PublicKeyCredential.
|
|
554
575
|
*/
|
|
555
576
|
function register(options) {
|
|
556
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
577
|
+
return __awaiter$1(this, void 0, void 0, function () {
|
|
557
578
|
var createOptions, credential, publicKeyCredential, attestationResponse, transports, err_1;
|
|
558
579
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
559
|
-
return __generator(this, function (_k) {
|
|
580
|
+
return __generator$1(this, function (_k) {
|
|
560
581
|
switch (_k.label) {
|
|
561
582
|
case 0:
|
|
562
583
|
_k.trys.push([0, 2, , 3]);
|
|
@@ -614,10 +635,10 @@ function register(options) {
|
|
|
614
635
|
* @returns A promise that resolves to a JSON-serializable representation of the PublicKeyCredential.
|
|
615
636
|
*/
|
|
616
637
|
function authenticate(options) {
|
|
617
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
638
|
+
return __awaiter$1(this, void 0, void 0, function () {
|
|
618
639
|
var getOptions, credential, publicKeyCredential, assertionResponse;
|
|
619
640
|
var _a;
|
|
620
|
-
return __generator(this, function (_b) {
|
|
641
|
+
return __generator$1(this, function (_b) {
|
|
621
642
|
switch (_b.label) {
|
|
622
643
|
case 0:
|
|
623
644
|
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 +1206,8 @@ function CAMSMSALProviderInner(_a) {
|
|
|
1185
1206
|
}
|
|
1186
1207
|
}, [userProfile, profileStorageKey]);
|
|
1187
1208
|
// Enhanced logout that also clears profile
|
|
1188
|
-
var enhancedLogout = function () { return __awaiter(_this, void 0, void 0, function () {
|
|
1189
|
-
return __generator(this, function (_a) {
|
|
1209
|
+
var enhancedLogout = function () { return __awaiter$1(_this, void 0, void 0, function () {
|
|
1210
|
+
return __generator$1(this, function (_a) {
|
|
1190
1211
|
switch (_a.label) {
|
|
1191
1212
|
case 0: return [4 /*yield*/, auth.logout()];
|
|
1192
1213
|
case 1:
|
|
@@ -1282,8 +1303,8 @@ function CAMSProviderCore(props) {
|
|
|
1282
1303
|
}
|
|
1283
1304
|
}
|
|
1284
1305
|
}, [userProfile, profileStorageKey]);
|
|
1285
|
-
var enhancedLogout = function () { return __awaiter(_this, void 0, void 0, function () {
|
|
1286
|
-
return __generator(this, function (_a) {
|
|
1306
|
+
var enhancedLogout = function () { return __awaiter$1(_this, void 0, void 0, function () {
|
|
1307
|
+
return __generator$1(this, function (_a) {
|
|
1287
1308
|
switch (_a.label) {
|
|
1288
1309
|
case 0: return [4 /*yield*/, auth.logout()];
|
|
1289
1310
|
case 1:
|
|
@@ -1781,9 +1802,9 @@ var useOTPHandler = function (_a) {
|
|
|
1781
1802
|
var _b = useState(false), loading = _b[0], setLoading = _b[1];
|
|
1782
1803
|
var _c = useState(0), attemptCount = _c[0], setAttemptCount = _c[1];
|
|
1783
1804
|
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 () {
|
|
1805
|
+
var handleSubmitOTP = useMemo(function () { return function (authenticationValue) { return __awaiter$1(void 0, void 0, void 0, function () {
|
|
1785
1806
|
var currentAttempt, response, error_1, currentAttempt;
|
|
1786
|
-
return __generator(this, function (_a) {
|
|
1807
|
+
return __generator$1(this, function (_a) {
|
|
1787
1808
|
switch (_a.label) {
|
|
1788
1809
|
case 0:
|
|
1789
1810
|
if (isMaxAttemptsReached) {
|
|
@@ -1873,9 +1894,9 @@ var useCredentialsHandler = function (onAuthComplete) {
|
|
|
1873
1894
|
var _b = useState(0), attemptCount = _b[0], setAttemptCount = _b[1];
|
|
1874
1895
|
var _c = useState(false), isMaxAttemptsReached = _c[0], setIsMaxAttemptsReached = _c[1];
|
|
1875
1896
|
var handleSubmitCredentials = useMemo(function () {
|
|
1876
|
-
return function (CredAuthEndpoint, credentials, appCode) { return __awaiter(void 0, void 0, void 0, function () {
|
|
1897
|
+
return function (CredAuthEndpoint, credentials, appCode) { return __awaiter$1(void 0, void 0, void 0, function () {
|
|
1877
1898
|
var currentAttempt, response, error_2, currentAttempt;
|
|
1878
|
-
return __generator(this, function (_a) {
|
|
1899
|
+
return __generator$1(this, function (_a) {
|
|
1879
1900
|
switch (_a.label) {
|
|
1880
1901
|
case 0:
|
|
1881
1902
|
_a.trys.push([0, 2, 3, 4]);
|
|
@@ -1947,15 +1968,15 @@ var MFAOptions = function (_a) {
|
|
|
1947
1968
|
var context = useCAMSContext();
|
|
1948
1969
|
var _f = context.authMode === "MSAL" && "sendEmailOTP" in context
|
|
1949
1970
|
? context
|
|
1950
|
-
: { sendEmailOTP: null, completeMFA: null, logout: function () { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) {
|
|
1971
|
+
: { sendEmailOTP: null, completeMFA: null, logout: function () { return __awaiter$1(void 0, void 0, void 0, function () { return __generator$1(this, function (_a) {
|
|
1951
1972
|
return [2 /*return*/];
|
|
1952
1973
|
}); }); } }, sendEmailOTP = _f.sendEmailOTP, completeMFA = _f.completeMFA, logout = _f.logout;
|
|
1953
1974
|
var accessToken = context.authMode === "MSAL" ? context.accessToken : "";
|
|
1954
1975
|
var idToken = context.authMode === "MSAL" ? context.idToken : "";
|
|
1955
1976
|
var authenticate = useWebAuthn().authenticate;
|
|
1956
|
-
var handleFIDOLogin = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
1977
|
+
var handleFIDOLogin = function () { return __awaiter$1(void 0, void 0, void 0, function () {
|
|
1957
1978
|
var options, assertionResponse, error_1;
|
|
1958
|
-
return __generator(this, function (_a) {
|
|
1979
|
+
return __generator$1(this, function (_a) {
|
|
1959
1980
|
switch (_a.label) {
|
|
1960
1981
|
case 0:
|
|
1961
1982
|
_a.trys.push([0, 4, , 5]);
|
|
@@ -2035,9 +2056,9 @@ var MFAOptions = function (_a) {
|
|
|
2035
2056
|
}
|
|
2036
2057
|
var content = jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, {});
|
|
2037
2058
|
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 () {
|
|
2059
|
+
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
2060
|
var success;
|
|
2040
|
-
return __generator(this, function (_a) {
|
|
2061
|
+
return __generator$1(this, function (_a) {
|
|
2041
2062
|
switch (_a.label) {
|
|
2042
2063
|
case 0:
|
|
2043
2064
|
// resetAttempts();
|
|
@@ -2108,16 +2129,16 @@ var ADLoginModal = function (_a) {
|
|
|
2108
2129
|
resolver: a$1(credentialsSchema),
|
|
2109
2130
|
defaultValues: { username: "", password: "" },
|
|
2110
2131
|
});
|
|
2111
|
-
var handleCredentialsSubmit = function (values) { return __awaiter(void 0, void 0, void 0, function () {
|
|
2112
|
-
return __generator(this, function (_a) {
|
|
2132
|
+
var handleCredentialsSubmit = function (values) { return __awaiter$1(void 0, void 0, void 0, function () {
|
|
2133
|
+
return __generator$1(this, function (_a) {
|
|
2113
2134
|
setCredentials(values);
|
|
2114
2135
|
setStep("mfa");
|
|
2115
2136
|
return [2 /*return*/];
|
|
2116
2137
|
});
|
|
2117
2138
|
}); };
|
|
2118
|
-
var handleMFASubmit = function (code) { return __awaiter(void 0, void 0, void 0, function () {
|
|
2139
|
+
var handleMFASubmit = function (code) { return __awaiter$1(void 0, void 0, void 0, function () {
|
|
2119
2140
|
var error_1;
|
|
2120
|
-
return __generator(this, function (_a) {
|
|
2141
|
+
return __generator$1(this, function (_a) {
|
|
2121
2142
|
switch (_a.label) {
|
|
2122
2143
|
case 0:
|
|
2123
2144
|
setIsLoading(true);
|
|
@@ -2178,8 +2199,8 @@ var DefaultLoginPage = function (_a) {
|
|
|
2178
2199
|
var login = context.login, isLoading = context.isLoading, authMode = context.authMode;
|
|
2179
2200
|
var _b = useState(false), showADModal = _b[0], setShowADModal = _b[1];
|
|
2180
2201
|
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) {
|
|
2202
|
+
var _c = useCredentialsHandler(function (state, data) { return __awaiter$1(void 0, void 0, void 0, function () {
|
|
2203
|
+
return __generator$1(this, function (_a) {
|
|
2183
2204
|
console.log(data);
|
|
2184
2205
|
if (state && data) {
|
|
2185
2206
|
context.isAuthenticated = true;
|
|
@@ -2193,6 +2214,10 @@ var DefaultLoginPage = function (_a) {
|
|
|
2193
2214
|
});
|
|
2194
2215
|
}); }), handleSubmitCredentials = _c.handleSubmitCredentials, isCredAuthLoading = _c.loading, setIsCredAuthLoading = _c.setLoading;
|
|
2195
2216
|
var handleMSALLogin = function () {
|
|
2217
|
+
if (typeof window !== "undefined" && !window.crypto) {
|
|
2218
|
+
toast.error("Crypto API not available. Please use a modern browser.");
|
|
2219
|
+
return;
|
|
2220
|
+
}
|
|
2196
2221
|
if (authMode === "MSAL") {
|
|
2197
2222
|
login();
|
|
2198
2223
|
}
|
|
@@ -2201,9 +2226,9 @@ var DefaultLoginPage = function (_a) {
|
|
|
2201
2226
|
console.warn("Regular CAMS login requires configuration");
|
|
2202
2227
|
}
|
|
2203
2228
|
};
|
|
2204
|
-
var handleRegister = function (data) { return __awaiter(void 0, void 0, void 0, function () {
|
|
2229
|
+
var handleRegister = function (data) { return __awaiter$1(void 0, void 0, void 0, function () {
|
|
2205
2230
|
var options, attestationResponse, error_1;
|
|
2206
|
-
return __generator(this, function (_a) {
|
|
2231
|
+
return __generator$1(this, function (_a) {
|
|
2207
2232
|
switch (_a.label) {
|
|
2208
2233
|
case 0:
|
|
2209
2234
|
_a.trys.push([0, 4, , 5]);
|
|
@@ -2235,15 +2260,15 @@ var DefaultLoginPage = function (_a) {
|
|
|
2235
2260
|
}
|
|
2236
2261
|
});
|
|
2237
2262
|
}); };
|
|
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-
|
|
2263
|
+
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
2264
|
// variant="outline"
|
|
2240
2265
|
, {
|
|
2241
2266
|
// variant="outline"
|
|
2242
2267
|
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
2268
|
? "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) {
|
|
2269
|
+
: "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
2270
|
var username = _b.username, password = _b.password, MFACode = _b.MFACode;
|
|
2246
|
-
return __generator(this, function (_c) {
|
|
2271
|
+
return __generator$1(this, function (_c) {
|
|
2247
2272
|
// Implement your AD login logic here
|
|
2248
2273
|
console.log("AD Login:", { username: username, password: password, MFACode: MFACode });
|
|
2249
2274
|
// Example: await adLoginService(username, password, mfaCode);
|
|
@@ -2284,8 +2309,8 @@ var MFAGate = function (_a) {
|
|
|
2284
2309
|
if (!success)
|
|
2285
2310
|
Logger.error("MFA authentication failed");
|
|
2286
2311
|
}, []);
|
|
2287
|
-
var handleAuthFailed = useCallback(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
2288
|
-
return __generator(this, function (_a) {
|
|
2312
|
+
var handleAuthFailed = useCallback(function () { return __awaiter$1(void 0, void 0, void 0, function () {
|
|
2313
|
+
return __generator$1(this, function (_a) {
|
|
2289
2314
|
switch (_a.label) {
|
|
2290
2315
|
case 0: return [4 /*yield*/, context.logout()];
|
|
2291
2316
|
case 1:
|