@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.cjs.js
CHANGED
|
@@ -41,6 +41,27 @@ var React__namespace = /*#__PURE__*/_interopNamespaceDefault(React);
|
|
|
41
41
|
var LabelPrimitive__namespace = /*#__PURE__*/_interopNamespaceDefault(LabelPrimitive);
|
|
42
42
|
var DialogPrimitive__namespace = /*#__PURE__*/_interopNamespaceDefault(DialogPrimitive);
|
|
43
43
|
|
|
44
|
+
var _a;
|
|
45
|
+
// Crypto polyfill for environments where crypto is not available
|
|
46
|
+
if (typeof window !== 'undefined' && !window.crypto) {
|
|
47
|
+
var crypto_1 = require('crypto');
|
|
48
|
+
// @ts-ignore
|
|
49
|
+
window.crypto = {
|
|
50
|
+
getRandomValues: function (arr) {
|
|
51
|
+
var bytes = crypto_1.randomBytes(arr.length);
|
|
52
|
+
for (var i = 0; i < arr.length; i++) {
|
|
53
|
+
arr[i] = bytes[i];
|
|
54
|
+
}
|
|
55
|
+
return arr;
|
|
56
|
+
},
|
|
57
|
+
subtle: ((_a = crypto_1.webcrypto) === null || _a === void 0 ? void 0 : _a.subtle) || {
|
|
58
|
+
digest: function () { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) {
|
|
59
|
+
throw new Error('crypto.subtle not available');
|
|
60
|
+
}); }); }
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
|
|
44
65
|
/******************************************************************************
|
|
45
66
|
Copyright (c) Microsoft Corporation.
|
|
46
67
|
|
|
@@ -81,7 +102,7 @@ function __rest(s, e) {
|
|
|
81
102
|
return t;
|
|
82
103
|
}
|
|
83
104
|
|
|
84
|
-
function __awaiter(thisArg, _arguments, P, generator) {
|
|
105
|
+
function __awaiter$1(thisArg, _arguments, P, generator) {
|
|
85
106
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
86
107
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
87
108
|
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
@@ -91,7 +112,7 @@ function __awaiter(thisArg, _arguments, P, generator) {
|
|
|
91
112
|
});
|
|
92
113
|
}
|
|
93
114
|
|
|
94
|
-
function __generator(thisArg, body) {
|
|
115
|
+
function __generator$1(thisArg, body) {
|
|
95
116
|
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);
|
|
96
117
|
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
97
118
|
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
@@ -188,10 +209,10 @@ function useCAMSAuth(options) {
|
|
|
188
209
|
}
|
|
189
210
|
}
|
|
190
211
|
}, [options.storageKey]);
|
|
191
|
-
var login = React.useCallback(function (config) { return __awaiter(_this, void 0, void 0, function () {
|
|
212
|
+
var login = React.useCallback(function (config) { return __awaiter$1(_this, void 0, void 0, function () {
|
|
192
213
|
var loginConfig, userProfile, err_1, e, isPopupClosedError, restoredToken, userProfile;
|
|
193
214
|
var _a, _b, _c;
|
|
194
|
-
return __generator(this, function (_d) {
|
|
215
|
+
return __generator$1(this, function (_d) {
|
|
195
216
|
switch (_d.label) {
|
|
196
217
|
case 0:
|
|
197
218
|
if (!sessionManagerRef.current)
|
|
@@ -239,8 +260,8 @@ function useCAMSAuth(options) {
|
|
|
239
260
|
}
|
|
240
261
|
});
|
|
241
262
|
}); }, [options.idleTimeout]);
|
|
242
|
-
var logout = React.useCallback(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
243
|
-
return __generator(this, function (_a) {
|
|
263
|
+
var logout = React.useCallback(function () { return __awaiter$1(_this, void 0, void 0, function () {
|
|
264
|
+
return __generator$1(this, function (_a) {
|
|
244
265
|
switch (_a.label) {
|
|
245
266
|
case 0:
|
|
246
267
|
if (!sessionManagerRef.current)
|
|
@@ -374,10 +395,10 @@ function useCAMSMSALAuth(options) {
|
|
|
374
395
|
// };
|
|
375
396
|
// handleRedirect();
|
|
376
397
|
// }, []);
|
|
377
|
-
var login = React.useCallback(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
398
|
+
var login = React.useCallback(function () { return __awaiter$1(_this, void 0, void 0, function () {
|
|
378
399
|
var response, mfaConfig, authenticator, err_1, camsError_1, camsError;
|
|
379
400
|
var _a, _b, _c, _d;
|
|
380
|
-
return __generator(this, function (_e) {
|
|
401
|
+
return __generator$1(this, function (_e) {
|
|
381
402
|
switch (_e.label) {
|
|
382
403
|
case 0:
|
|
383
404
|
setError(null);
|
|
@@ -441,8 +462,8 @@ function useCAMSMSALAuth(options) {
|
|
|
441
462
|
}
|
|
442
463
|
});
|
|
443
464
|
}); }, [instance, scopes, options]);
|
|
444
|
-
var completeMFA = React.useCallback(function (data) { return __awaiter(_this, void 0, void 0, function () {
|
|
445
|
-
return __generator(this, function (_a) {
|
|
465
|
+
var completeMFA = React.useCallback(function (data) { return __awaiter$1(_this, void 0, void 0, function () {
|
|
466
|
+
return __generator$1(this, function (_a) {
|
|
446
467
|
if (!mfaAuthenticator) {
|
|
447
468
|
throw new camsSdk.CAMSError(camsSdk.CAMSErrorType.API_VALIDATION_ERROR, "MFA Authenticator not initialized");
|
|
448
469
|
}
|
|
@@ -476,8 +497,8 @@ function useCAMSMSALAuth(options) {
|
|
|
476
497
|
return [2 /*return*/];
|
|
477
498
|
});
|
|
478
499
|
}); }, [mfaAuthenticator, accessToken, idToken, storageKey]);
|
|
479
|
-
var sendEmailOTP = React.useCallback(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
480
|
-
return __generator(this, function (_a) {
|
|
500
|
+
var sendEmailOTP = React.useCallback(function () { return __awaiter$1(_this, void 0, void 0, function () {
|
|
501
|
+
return __generator$1(this, function (_a) {
|
|
481
502
|
switch (_a.label) {
|
|
482
503
|
case 0:
|
|
483
504
|
if (!mfaAuthenticator) {
|
|
@@ -488,9 +509,9 @@ function useCAMSMSALAuth(options) {
|
|
|
488
509
|
}
|
|
489
510
|
});
|
|
490
511
|
}); }, [mfaAuthenticator]);
|
|
491
|
-
var logout = React.useCallback(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
512
|
+
var logout = React.useCallback(function () { return __awaiter$1(_this, void 0, void 0, function () {
|
|
492
513
|
var err_2, camsError;
|
|
493
|
-
return __generator(this, function (_a) {
|
|
514
|
+
return __generator$1(this, function (_a) {
|
|
494
515
|
switch (_a.label) {
|
|
495
516
|
case 0:
|
|
496
517
|
_a.trys.push([0, 2, , 3]);
|
|
@@ -574,10 +595,10 @@ function arrayBufferToBase64url(buffer) {
|
|
|
574
595
|
* @returns A promise that resolves to a JSON-serializable representation of the PublicKeyCredential.
|
|
575
596
|
*/
|
|
576
597
|
function register(options) {
|
|
577
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
598
|
+
return __awaiter$1(this, void 0, void 0, function () {
|
|
578
599
|
var createOptions, credential, publicKeyCredential, attestationResponse, transports, err_1;
|
|
579
600
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
580
|
-
return __generator(this, function (_k) {
|
|
601
|
+
return __generator$1(this, function (_k) {
|
|
581
602
|
switch (_k.label) {
|
|
582
603
|
case 0:
|
|
583
604
|
_k.trys.push([0, 2, , 3]);
|
|
@@ -635,10 +656,10 @@ function register(options) {
|
|
|
635
656
|
* @returns A promise that resolves to a JSON-serializable representation of the PublicKeyCredential.
|
|
636
657
|
*/
|
|
637
658
|
function authenticate(options) {
|
|
638
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
659
|
+
return __awaiter$1(this, void 0, void 0, function () {
|
|
639
660
|
var getOptions, credential, publicKeyCredential, assertionResponse;
|
|
640
661
|
var _a;
|
|
641
|
-
return __generator(this, function (_b) {
|
|
662
|
+
return __generator$1(this, function (_b) {
|
|
642
663
|
switch (_b.label) {
|
|
643
664
|
case 0:
|
|
644
665
|
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) })); }) });
|
|
@@ -1206,8 +1227,8 @@ function CAMSMSALProviderInner(_a) {
|
|
|
1206
1227
|
}
|
|
1207
1228
|
}, [userProfile, profileStorageKey]);
|
|
1208
1229
|
// Enhanced logout that also clears profile
|
|
1209
|
-
var enhancedLogout = function () { return __awaiter(_this, void 0, void 0, function () {
|
|
1210
|
-
return __generator(this, function (_a) {
|
|
1230
|
+
var enhancedLogout = function () { return __awaiter$1(_this, void 0, void 0, function () {
|
|
1231
|
+
return __generator$1(this, function (_a) {
|
|
1211
1232
|
switch (_a.label) {
|
|
1212
1233
|
case 0: return [4 /*yield*/, auth.logout()];
|
|
1213
1234
|
case 1:
|
|
@@ -1303,8 +1324,8 @@ function CAMSProviderCore(props) {
|
|
|
1303
1324
|
}
|
|
1304
1325
|
}
|
|
1305
1326
|
}, [userProfile, profileStorageKey]);
|
|
1306
|
-
var enhancedLogout = function () { return __awaiter(_this, void 0, void 0, function () {
|
|
1307
|
-
return __generator(this, function (_a) {
|
|
1327
|
+
var enhancedLogout = function () { return __awaiter$1(_this, void 0, void 0, function () {
|
|
1328
|
+
return __generator$1(this, function (_a) {
|
|
1308
1329
|
switch (_a.label) {
|
|
1309
1330
|
case 0: return [4 /*yield*/, auth.logout()];
|
|
1310
1331
|
case 1:
|
|
@@ -1802,9 +1823,9 @@ var useOTPHandler = function (_a) {
|
|
|
1802
1823
|
var _b = React.useState(false), loading = _b[0], setLoading = _b[1];
|
|
1803
1824
|
var _c = React.useState(0), attemptCount = _c[0], setAttemptCount = _c[1];
|
|
1804
1825
|
var _d = React.useState(false), isMaxAttemptsReached = _d[0], setIsMaxAttemptsReached = _d[1];
|
|
1805
|
-
var handleSubmitOTP = React.useMemo(function () { return function (authenticationValue) { return __awaiter(void 0, void 0, void 0, function () {
|
|
1826
|
+
var handleSubmitOTP = React.useMemo(function () { return function (authenticationValue) { return __awaiter$1(void 0, void 0, void 0, function () {
|
|
1806
1827
|
var currentAttempt, response, error_1, currentAttempt;
|
|
1807
|
-
return __generator(this, function (_a) {
|
|
1828
|
+
return __generator$1(this, function (_a) {
|
|
1808
1829
|
switch (_a.label) {
|
|
1809
1830
|
case 0:
|
|
1810
1831
|
if (isMaxAttemptsReached) {
|
|
@@ -1894,9 +1915,9 @@ var useCredentialsHandler = function (onAuthComplete) {
|
|
|
1894
1915
|
var _b = React.useState(0), attemptCount = _b[0], setAttemptCount = _b[1];
|
|
1895
1916
|
var _c = React.useState(false), isMaxAttemptsReached = _c[0], setIsMaxAttemptsReached = _c[1];
|
|
1896
1917
|
var handleSubmitCredentials = React.useMemo(function () {
|
|
1897
|
-
return function (CredAuthEndpoint, credentials, appCode) { return __awaiter(void 0, void 0, void 0, function () {
|
|
1918
|
+
return function (CredAuthEndpoint, credentials, appCode) { return __awaiter$1(void 0, void 0, void 0, function () {
|
|
1898
1919
|
var currentAttempt, response, error_2, currentAttempt;
|
|
1899
|
-
return __generator(this, function (_a) {
|
|
1920
|
+
return __generator$1(this, function (_a) {
|
|
1900
1921
|
switch (_a.label) {
|
|
1901
1922
|
case 0:
|
|
1902
1923
|
_a.trys.push([0, 2, 3, 4]);
|
|
@@ -1968,15 +1989,15 @@ var MFAOptions = function (_a) {
|
|
|
1968
1989
|
var context = useCAMSContext();
|
|
1969
1990
|
var _f = context.authMode === "MSAL" && "sendEmailOTP" in context
|
|
1970
1991
|
? context
|
|
1971
|
-
: { sendEmailOTP: null, completeMFA: null, logout: function () { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) {
|
|
1992
|
+
: { sendEmailOTP: null, completeMFA: null, logout: function () { return __awaiter$1(void 0, void 0, void 0, function () { return __generator$1(this, function (_a) {
|
|
1972
1993
|
return [2 /*return*/];
|
|
1973
1994
|
}); }); } }, sendEmailOTP = _f.sendEmailOTP, completeMFA = _f.completeMFA, logout = _f.logout;
|
|
1974
1995
|
var accessToken = context.authMode === "MSAL" ? context.accessToken : "";
|
|
1975
1996
|
var idToken = context.authMode === "MSAL" ? context.idToken : "";
|
|
1976
1997
|
var authenticate = useWebAuthn().authenticate;
|
|
1977
|
-
var handleFIDOLogin = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
1998
|
+
var handleFIDOLogin = function () { return __awaiter$1(void 0, void 0, void 0, function () {
|
|
1978
1999
|
var options, assertionResponse, error_1;
|
|
1979
|
-
return __generator(this, function (_a) {
|
|
2000
|
+
return __generator$1(this, function (_a) {
|
|
1980
2001
|
switch (_a.label) {
|
|
1981
2002
|
case 0:
|
|
1982
2003
|
_a.trys.push([0, 4, , 5]);
|
|
@@ -2056,9 +2077,9 @@ var MFAOptions = function (_a) {
|
|
|
2056
2077
|
}
|
|
2057
2078
|
var content = jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, {});
|
|
2058
2079
|
if (!authType) {
|
|
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(void 0, void 0, void 0, function () {
|
|
2080
|
+
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 () {
|
|
2060
2081
|
var success;
|
|
2061
|
-
return __generator(this, function (_a) {
|
|
2082
|
+
return __generator$1(this, function (_a) {
|
|
2062
2083
|
switch (_a.label) {
|
|
2063
2084
|
case 0:
|
|
2064
2085
|
// resetAttempts();
|
|
@@ -2129,16 +2150,16 @@ var ADLoginModal = function (_a) {
|
|
|
2129
2150
|
resolver: a$1(credentialsSchema),
|
|
2130
2151
|
defaultValues: { username: "", password: "" },
|
|
2131
2152
|
});
|
|
2132
|
-
var handleCredentialsSubmit = function (values) { return __awaiter(void 0, void 0, void 0, function () {
|
|
2133
|
-
return __generator(this, function (_a) {
|
|
2153
|
+
var handleCredentialsSubmit = function (values) { return __awaiter$1(void 0, void 0, void 0, function () {
|
|
2154
|
+
return __generator$1(this, function (_a) {
|
|
2134
2155
|
setCredentials(values);
|
|
2135
2156
|
setStep("mfa");
|
|
2136
2157
|
return [2 /*return*/];
|
|
2137
2158
|
});
|
|
2138
2159
|
}); };
|
|
2139
|
-
var handleMFASubmit = function (code) { return __awaiter(void 0, void 0, void 0, function () {
|
|
2160
|
+
var handleMFASubmit = function (code) { return __awaiter$1(void 0, void 0, void 0, function () {
|
|
2140
2161
|
var error_1;
|
|
2141
|
-
return __generator(this, function (_a) {
|
|
2162
|
+
return __generator$1(this, function (_a) {
|
|
2142
2163
|
switch (_a.label) {
|
|
2143
2164
|
case 0:
|
|
2144
2165
|
setIsLoading(true);
|
|
@@ -2199,8 +2220,8 @@ var DefaultLoginPage = function (_a) {
|
|
|
2199
2220
|
var login = context.login, isLoading = context.isLoading, authMode = context.authMode;
|
|
2200
2221
|
var _b = React.useState(false), showADModal = _b[0], setShowADModal = _b[1];
|
|
2201
2222
|
var register = useWebAuthn().register;
|
|
2202
|
-
var _c = useCredentialsHandler(function (state, data) { return __awaiter(void 0, void 0, void 0, function () {
|
|
2203
|
-
return __generator(this, function (_a) {
|
|
2223
|
+
var _c = useCredentialsHandler(function (state, data) { return __awaiter$1(void 0, void 0, void 0, function () {
|
|
2224
|
+
return __generator$1(this, function (_a) {
|
|
2204
2225
|
console.log(data);
|
|
2205
2226
|
if (state && data) {
|
|
2206
2227
|
context.isAuthenticated = true;
|
|
@@ -2214,6 +2235,10 @@ var DefaultLoginPage = function (_a) {
|
|
|
2214
2235
|
});
|
|
2215
2236
|
}); }), handleSubmitCredentials = _c.handleSubmitCredentials, isCredAuthLoading = _c.loading, setIsCredAuthLoading = _c.setLoading;
|
|
2216
2237
|
var handleMSALLogin = function () {
|
|
2238
|
+
if (typeof window !== "undefined" && !window.crypto) {
|
|
2239
|
+
sonner.toast.error("Crypto API not available. Please use a modern browser.");
|
|
2240
|
+
return;
|
|
2241
|
+
}
|
|
2217
2242
|
if (authMode === "MSAL") {
|
|
2218
2243
|
login();
|
|
2219
2244
|
}
|
|
@@ -2222,9 +2247,9 @@ var DefaultLoginPage = function (_a) {
|
|
|
2222
2247
|
console.warn("Regular CAMS login requires configuration");
|
|
2223
2248
|
}
|
|
2224
2249
|
};
|
|
2225
|
-
var handleRegister = function (data) { return __awaiter(void 0, void 0, void 0, function () {
|
|
2250
|
+
var handleRegister = function (data) { return __awaiter$1(void 0, void 0, void 0, function () {
|
|
2226
2251
|
var options, attestationResponse, error_1;
|
|
2227
|
-
return __generator(this, function (_a) {
|
|
2252
|
+
return __generator$1(this, function (_a) {
|
|
2228
2253
|
switch (_a.label) {
|
|
2229
2254
|
case 0:
|
|
2230
2255
|
_a.trys.push([0, 4, , 5]);
|
|
@@ -2256,15 +2281,15 @@ var DefaultLoginPage = function (_a) {
|
|
|
2256
2281
|
}
|
|
2257
2282
|
});
|
|
2258
2283
|
}); };
|
|
2259
|
-
return (jsxRuntimeExports.jsxs("main", { className: "min-h-screen bg-gray-50", children: [jsxRuntimeExports.jsx(framerMotion.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(framerMotion.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-
|
|
2284
|
+
return (jsxRuntimeExports.jsxs("main", { className: "min-h-screen bg-gray-50", children: [jsxRuntimeExports.jsx(framerMotion.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(framerMotion.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
|
|
2260
2285
|
// variant="outline"
|
|
2261
2286
|
, {
|
|
2262
2287
|
// variant="outline"
|
|
2263
2288
|
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(lucideReact.KeyIcon, { className: "text-[#506f4a]", size: 64 }), jsxRuntimeExports.jsx("span", { children: isLoading
|
|
2264
2289
|
? "Logging in..."
|
|
2265
|
-
: "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(lucideReact.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(lucideReact.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) {
|
|
2290
|
+
: "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(lucideReact.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(lucideReact.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) {
|
|
2266
2291
|
var username = _b.username, password = _b.password, MFACode = _b.MFACode;
|
|
2267
|
-
return __generator(this, function (_c) {
|
|
2292
|
+
return __generator$1(this, function (_c) {
|
|
2268
2293
|
// Implement your AD login logic here
|
|
2269
2294
|
console.log("AD Login:", { username: username, password: password, MFACode: MFACode });
|
|
2270
2295
|
// Example: await adLoginService(username, password, mfaCode);
|
|
@@ -2305,8 +2330,8 @@ var MFAGate = function (_a) {
|
|
|
2305
2330
|
if (!success)
|
|
2306
2331
|
camsSdk.Logger.error("MFA authentication failed");
|
|
2307
2332
|
}, []);
|
|
2308
|
-
var handleAuthFailed = React.useCallback(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
2309
|
-
return __generator(this, function (_a) {
|
|
2333
|
+
var handleAuthFailed = React.useCallback(function () { return __awaiter$1(void 0, void 0, void 0, function () {
|
|
2334
|
+
return __generator$1(this, function (_a) {
|
|
2310
2335
|
switch (_a.label) {
|
|
2311
2336
|
case 0: return [4 /*yield*/, context.logout()];
|
|
2312
2337
|
case 1:
|