@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.
@@ -1,3 +1,4 @@
1
+ import "../utils/crypto-polyfill";
1
2
  import React from "react";
2
3
  import { PublicClientApplication, Configuration } from "@azure/msal-browser";
3
4
  import { Profile } from "@nibssplc/cams-sdk";
@@ -1,3 +1,4 @@
1
+ import "../utils/crypto-polyfill";
1
2
  import { MFAEndpoints } from "./MFAGate";
2
3
  interface LoginPageProps {
3
4
  usePassKey?: boolean;
@@ -1,3 +1,4 @@
1
+ import "../utils/crypto-polyfill";
1
2
  import React from "react";
2
3
  import { PublicClientApplication, Configuration } from "@azure/msal-browser";
3
4
  import { UseCAMSAuthOptions } from "../hooks/useCAMSAuth";
@@ -1,3 +1,4 @@
1
+ import "../utils/crypto-polyfill";
1
2
  import { CAMSError, CAMSMFAAuthenticator, MFAResponse } from "@nibssplc/cams-sdk";
2
3
  export interface UseCAMSMSALAuthOptions {
3
4
  onAuthSuccess?: (token: string) => void;
package/dist/index.cjs.js CHANGED
@@ -41,6 +41,53 @@ 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
+ // Crypto polyfill for MSAL browser compatibility
45
+ if (typeof window !== 'undefined') {
46
+ // Ensure crypto object exists
47
+ if (!window.crypto) {
48
+ window.crypto = {};
49
+ }
50
+ // Polyfill getRandomValues with better entropy
51
+ if (!window.crypto.getRandomValues) {
52
+ window.crypto.getRandomValues = function (array) {
53
+ var bytes = new Uint8Array(array.buffer, array.byteOffset, array.byteLength);
54
+ for (var i = 0; i < bytes.length; i++) {
55
+ bytes[i] = Math.floor((Math.random() * 256 +
56
+ (performance.now() % 256) +
57
+ (Date.now() % 256)) / 3) & 0xFF;
58
+ }
59
+ return array;
60
+ };
61
+ }
62
+ // Polyfill crypto.subtle
63
+ if (!window.crypto.subtle) {
64
+ window.crypto.subtle = {
65
+ digest: function (algorithm, data) { return __awaiter(void 0, void 0, void 0, function () {
66
+ var bytes, hash, i;
67
+ return __generator(this, function (_a) {
68
+ bytes = new Uint8Array(data);
69
+ hash = 0;
70
+ for (i = 0; i < bytes.length; i++) {
71
+ hash = ((hash << 5) - hash) + bytes[i];
72
+ hash = hash & hash;
73
+ }
74
+ return [2 /*return*/, new Uint8Array([hash]).buffer];
75
+ });
76
+ }); }
77
+ };
78
+ }
79
+ // Polyfill randomUUID
80
+ if (!window.crypto.randomUUID) {
81
+ window.crypto.randomUUID = function () {
82
+ return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
83
+ var r = (Math.random() * 16) | 0;
84
+ var v = c === 'x' ? r : (r & 0x3) | 0x8;
85
+ return v.toString(16);
86
+ });
87
+ };
88
+ }
89
+ }
90
+
44
91
  /******************************************************************************
45
92
  Copyright (c) Microsoft Corporation.
46
93
 
@@ -81,7 +128,7 @@ function __rest(s, e) {
81
128
  return t;
82
129
  }
83
130
 
84
- function __awaiter(thisArg, _arguments, P, generator) {
131
+ function __awaiter$1(thisArg, _arguments, P, generator) {
85
132
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
86
133
  return new (P || (P = Promise))(function (resolve, reject) {
87
134
  function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
@@ -91,7 +138,7 @@ function __awaiter(thisArg, _arguments, P, generator) {
91
138
  });
92
139
  }
93
140
 
94
- function __generator(thisArg, body) {
141
+ function __generator$1(thisArg, body) {
95
142
  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
143
  return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
97
144
  function verb(n) { return function (v) { return step([n, v]); }; }
@@ -188,10 +235,10 @@ function useCAMSAuth(options) {
188
235
  }
189
236
  }
190
237
  }, [options.storageKey]);
191
- var login = React.useCallback(function (config) { return __awaiter(_this, void 0, void 0, function () {
238
+ var login = React.useCallback(function (config) { return __awaiter$1(_this, void 0, void 0, function () {
192
239
  var loginConfig, userProfile, err_1, e, isPopupClosedError, restoredToken, userProfile;
193
240
  var _a, _b, _c;
194
- return __generator(this, function (_d) {
241
+ return __generator$1(this, function (_d) {
195
242
  switch (_d.label) {
196
243
  case 0:
197
244
  if (!sessionManagerRef.current)
@@ -239,8 +286,8 @@ function useCAMSAuth(options) {
239
286
  }
240
287
  });
241
288
  }); }, [options.idleTimeout]);
242
- var logout = React.useCallback(function () { return __awaiter(_this, void 0, void 0, function () {
243
- return __generator(this, function (_a) {
289
+ var logout = React.useCallback(function () { return __awaiter$1(_this, void 0, void 0, function () {
290
+ return __generator$1(this, function (_a) {
244
291
  switch (_a.label) {
245
292
  case 0:
246
293
  if (!sessionManagerRef.current)
@@ -374,10 +421,10 @@ function useCAMSMSALAuth(options) {
374
421
  // };
375
422
  // handleRedirect();
376
423
  // }, []);
377
- var login = React.useCallback(function () { return __awaiter(_this, void 0, void 0, function () {
424
+ var login = React.useCallback(function () { return __awaiter$1(_this, void 0, void 0, function () {
378
425
  var response, mfaConfig, authenticator, err_1, camsError_1, camsError;
379
426
  var _a, _b, _c, _d;
380
- return __generator(this, function (_e) {
427
+ return __generator$1(this, function (_e) {
381
428
  switch (_e.label) {
382
429
  case 0:
383
430
  setError(null);
@@ -441,8 +488,8 @@ function useCAMSMSALAuth(options) {
441
488
  }
442
489
  });
443
490
  }); }, [instance, scopes, options]);
444
- var completeMFA = React.useCallback(function (data) { return __awaiter(_this, void 0, void 0, function () {
445
- return __generator(this, function (_a) {
491
+ var completeMFA = React.useCallback(function (data) { return __awaiter$1(_this, void 0, void 0, function () {
492
+ return __generator$1(this, function (_a) {
446
493
  if (!mfaAuthenticator) {
447
494
  throw new camsSdk.CAMSError(camsSdk.CAMSErrorType.API_VALIDATION_ERROR, "MFA Authenticator not initialized");
448
495
  }
@@ -476,8 +523,8 @@ function useCAMSMSALAuth(options) {
476
523
  return [2 /*return*/];
477
524
  });
478
525
  }); }, [mfaAuthenticator, accessToken, idToken, storageKey]);
479
- var sendEmailOTP = React.useCallback(function () { return __awaiter(_this, void 0, void 0, function () {
480
- return __generator(this, function (_a) {
526
+ var sendEmailOTP = React.useCallback(function () { return __awaiter$1(_this, void 0, void 0, function () {
527
+ return __generator$1(this, function (_a) {
481
528
  switch (_a.label) {
482
529
  case 0:
483
530
  if (!mfaAuthenticator) {
@@ -488,9 +535,9 @@ function useCAMSMSALAuth(options) {
488
535
  }
489
536
  });
490
537
  }); }, [mfaAuthenticator]);
491
- var logout = React.useCallback(function () { return __awaiter(_this, void 0, void 0, function () {
538
+ var logout = React.useCallback(function () { return __awaiter$1(_this, void 0, void 0, function () {
492
539
  var err_2, camsError;
493
- return __generator(this, function (_a) {
540
+ return __generator$1(this, function (_a) {
494
541
  switch (_a.label) {
495
542
  case 0:
496
543
  _a.trys.push([0, 2, , 3]);
@@ -574,10 +621,10 @@ function arrayBufferToBase64url(buffer) {
574
621
  * @returns A promise that resolves to a JSON-serializable representation of the PublicKeyCredential.
575
622
  */
576
623
  function register(options) {
577
- return __awaiter(this, void 0, void 0, function () {
624
+ return __awaiter$1(this, void 0, void 0, function () {
578
625
  var createOptions, credential, publicKeyCredential, attestationResponse, transports, err_1;
579
626
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
580
- return __generator(this, function (_k) {
627
+ return __generator$1(this, function (_k) {
581
628
  switch (_k.label) {
582
629
  case 0:
583
630
  _k.trys.push([0, 2, , 3]);
@@ -635,10 +682,10 @@ function register(options) {
635
682
  * @returns A promise that resolves to a JSON-serializable representation of the PublicKeyCredential.
636
683
  */
637
684
  function authenticate(options) {
638
- return __awaiter(this, void 0, void 0, function () {
685
+ return __awaiter$1(this, void 0, void 0, function () {
639
686
  var getOptions, credential, publicKeyCredential, assertionResponse;
640
687
  var _a;
641
- return __generator(this, function (_b) {
688
+ return __generator$1(this, function (_b) {
642
689
  switch (_b.label) {
643
690
  case 0:
644
691
  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 +1253,8 @@ function CAMSMSALProviderInner(_a) {
1206
1253
  }
1207
1254
  }, [userProfile, profileStorageKey]);
1208
1255
  // Enhanced logout that also clears profile
1209
- var enhancedLogout = function () { return __awaiter(_this, void 0, void 0, function () {
1210
- return __generator(this, function (_a) {
1256
+ var enhancedLogout = function () { return __awaiter$1(_this, void 0, void 0, function () {
1257
+ return __generator$1(this, function (_a) {
1211
1258
  switch (_a.label) {
1212
1259
  case 0: return [4 /*yield*/, auth.logout()];
1213
1260
  case 1:
@@ -1303,8 +1350,8 @@ function CAMSProviderCore(props) {
1303
1350
  }
1304
1351
  }
1305
1352
  }, [userProfile, profileStorageKey]);
1306
- var enhancedLogout = function () { return __awaiter(_this, void 0, void 0, function () {
1307
- return __generator(this, function (_a) {
1353
+ var enhancedLogout = function () { return __awaiter$1(_this, void 0, void 0, function () {
1354
+ return __generator$1(this, function (_a) {
1308
1355
  switch (_a.label) {
1309
1356
  case 0: return [4 /*yield*/, auth.logout()];
1310
1357
  case 1:
@@ -1802,9 +1849,9 @@ var useOTPHandler = function (_a) {
1802
1849
  var _b = React.useState(false), loading = _b[0], setLoading = _b[1];
1803
1850
  var _c = React.useState(0), attemptCount = _c[0], setAttemptCount = _c[1];
1804
1851
  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 () {
1852
+ var handleSubmitOTP = React.useMemo(function () { return function (authenticationValue) { return __awaiter$1(void 0, void 0, void 0, function () {
1806
1853
  var currentAttempt, response, error_1, currentAttempt;
1807
- return __generator(this, function (_a) {
1854
+ return __generator$1(this, function (_a) {
1808
1855
  switch (_a.label) {
1809
1856
  case 0:
1810
1857
  if (isMaxAttemptsReached) {
@@ -1894,9 +1941,9 @@ var useCredentialsHandler = function (onAuthComplete) {
1894
1941
  var _b = React.useState(0), attemptCount = _b[0], setAttemptCount = _b[1];
1895
1942
  var _c = React.useState(false), isMaxAttemptsReached = _c[0], setIsMaxAttemptsReached = _c[1];
1896
1943
  var handleSubmitCredentials = React.useMemo(function () {
1897
- return function (CredAuthEndpoint, credentials, appCode) { return __awaiter(void 0, void 0, void 0, function () {
1944
+ return function (CredAuthEndpoint, credentials, appCode) { return __awaiter$1(void 0, void 0, void 0, function () {
1898
1945
  var currentAttempt, response, error_2, currentAttempt;
1899
- return __generator(this, function (_a) {
1946
+ return __generator$1(this, function (_a) {
1900
1947
  switch (_a.label) {
1901
1948
  case 0:
1902
1949
  _a.trys.push([0, 2, 3, 4]);
@@ -1968,15 +2015,15 @@ var MFAOptions = function (_a) {
1968
2015
  var context = useCAMSContext();
1969
2016
  var _f = context.authMode === "MSAL" && "sendEmailOTP" in context
1970
2017
  ? context
1971
- : { sendEmailOTP: null, completeMFA: null, logout: function () { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) {
2018
+ : { sendEmailOTP: null, completeMFA: null, logout: function () { return __awaiter$1(void 0, void 0, void 0, function () { return __generator$1(this, function (_a) {
1972
2019
  return [2 /*return*/];
1973
2020
  }); }); } }, sendEmailOTP = _f.sendEmailOTP, completeMFA = _f.completeMFA, logout = _f.logout;
1974
2021
  var accessToken = context.authMode === "MSAL" ? context.accessToken : "";
1975
2022
  var idToken = context.authMode === "MSAL" ? context.idToken : "";
1976
2023
  var authenticate = useWebAuthn().authenticate;
1977
- var handleFIDOLogin = function () { return __awaiter(void 0, void 0, void 0, function () {
2024
+ var handleFIDOLogin = function () { return __awaiter$1(void 0, void 0, void 0, function () {
1978
2025
  var options, assertionResponse, error_1;
1979
- return __generator(this, function (_a) {
2026
+ return __generator$1(this, function (_a) {
1980
2027
  switch (_a.label) {
1981
2028
  case 0:
1982
2029
  _a.trys.push([0, 4, , 5]);
@@ -2056,9 +2103,9 @@ var MFAOptions = function (_a) {
2056
2103
  }
2057
2104
  var content = jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, {});
2058
2105
  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 () {
2106
+ 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
2107
  var success;
2061
- return __generator(this, function (_a) {
2108
+ return __generator$1(this, function (_a) {
2062
2109
  switch (_a.label) {
2063
2110
  case 0:
2064
2111
  // resetAttempts();
@@ -2129,16 +2176,16 @@ var ADLoginModal = function (_a) {
2129
2176
  resolver: a$1(credentialsSchema),
2130
2177
  defaultValues: { username: "", password: "" },
2131
2178
  });
2132
- var handleCredentialsSubmit = function (values) { return __awaiter(void 0, void 0, void 0, function () {
2133
- return __generator(this, function (_a) {
2179
+ var handleCredentialsSubmit = function (values) { return __awaiter$1(void 0, void 0, void 0, function () {
2180
+ return __generator$1(this, function (_a) {
2134
2181
  setCredentials(values);
2135
2182
  setStep("mfa");
2136
2183
  return [2 /*return*/];
2137
2184
  });
2138
2185
  }); };
2139
- var handleMFASubmit = function (code) { return __awaiter(void 0, void 0, void 0, function () {
2186
+ var handleMFASubmit = function (code) { return __awaiter$1(void 0, void 0, void 0, function () {
2140
2187
  var error_1;
2141
- return __generator(this, function (_a) {
2188
+ return __generator$1(this, function (_a) {
2142
2189
  switch (_a.label) {
2143
2190
  case 0:
2144
2191
  setIsLoading(true);
@@ -2199,8 +2246,8 @@ var DefaultLoginPage = function (_a) {
2199
2246
  var login = context.login, isLoading = context.isLoading, authMode = context.authMode;
2200
2247
  var _b = React.useState(false), showADModal = _b[0], setShowADModal = _b[1];
2201
2248
  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) {
2249
+ var _c = useCredentialsHandler(function (state, data) { return __awaiter$1(void 0, void 0, void 0, function () {
2250
+ return __generator$1(this, function (_a) {
2204
2251
  console.log(data);
2205
2252
  if (state && data) {
2206
2253
  context.isAuthenticated = true;
@@ -2214,6 +2261,10 @@ var DefaultLoginPage = function (_a) {
2214
2261
  });
2215
2262
  }); }), handleSubmitCredentials = _c.handleSubmitCredentials, isCredAuthLoading = _c.loading, setIsCredAuthLoading = _c.setLoading;
2216
2263
  var handleMSALLogin = function () {
2264
+ if (typeof window !== "undefined" && !window.crypto) {
2265
+ sonner.toast.error("Crypto API not available. Please use a modern browser.");
2266
+ return;
2267
+ }
2217
2268
  if (authMode === "MSAL") {
2218
2269
  login();
2219
2270
  }
@@ -2222,9 +2273,9 @@ var DefaultLoginPage = function (_a) {
2222
2273
  console.warn("Regular CAMS login requires configuration");
2223
2274
  }
2224
2275
  };
2225
- var handleRegister = function (data) { return __awaiter(void 0, void 0, void 0, function () {
2276
+ var handleRegister = function (data) { return __awaiter$1(void 0, void 0, void 0, function () {
2226
2277
  var options, attestationResponse, error_1;
2227
- return __generator(this, function (_a) {
2278
+ return __generator$1(this, function (_a) {
2228
2279
  switch (_a.label) {
2229
2280
  case 0:
2230
2281
  _a.trys.push([0, 4, , 5]);
@@ -2256,15 +2307,15 @@ var DefaultLoginPage = function (_a) {
2256
2307
  }
2257
2308
  });
2258
2309
  }); };
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-6", children: [jsxRuntimeExports.jsx("img", { src: AuthLogo, alt: "Auth Logo", width: 365, height: 365 }), "Kindly use the below identity providers to authenticate"] }), jsxRuntimeExports.jsxs("div", { className: "space-y-4", children: [jsxRuntimeExports.jsxs(Button
2310
+ 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
2311
  // variant="outline"
2261
2312
  , {
2262
2313
  // variant="outline"
2263
2314
  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
2315
  ? "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) {
2316
+ : "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
2317
  var username = _b.username, password = _b.password, MFACode = _b.MFACode;
2267
- return __generator(this, function (_c) {
2318
+ return __generator$1(this, function (_c) {
2268
2319
  // Implement your AD login logic here
2269
2320
  console.log("AD Login:", { username: username, password: password, MFACode: MFACode });
2270
2321
  // Example: await adLoginService(username, password, mfaCode);
@@ -2305,8 +2356,8 @@ var MFAGate = function (_a) {
2305
2356
  if (!success)
2306
2357
  camsSdk.Logger.error("MFA authentication failed");
2307
2358
  }, []);
2308
- var handleAuthFailed = React.useCallback(function () { return __awaiter(void 0, void 0, void 0, function () {
2309
- return __generator(this, function (_a) {
2359
+ var handleAuthFailed = React.useCallback(function () { return __awaiter$1(void 0, void 0, void 0, function () {
2360
+ return __generator$1(this, function (_a) {
2310
2361
  switch (_a.label) {
2311
2362
  case 0: return [4 /*yield*/, context.logout()];
2312
2363
  case 1: