@nibssplc/cams-sdk-react 1.0.0-rc.43 → 1.0.0-rc.44

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/index.d.ts CHANGED
@@ -1,4 +1,3 @@
1
- import './utils/crypto-polyfill';
2
1
  export * from './hooks/useCAMSAuth';
3
2
  export * from './hooks/useCAMSMSALAuth';
4
3
  export { useWebAuthn } from './hooks/useFIDOAuth';
package/dist/index.esm.js CHANGED
@@ -20,162 +20,6 @@ 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
- // Run immediately and synchronously
26
- // Ensure crypto object exists
27
- if (!window.crypto) {
28
- window.crypto = {};
29
- }
30
- // Polyfill getRandomValues
31
- if (!window.crypto.getRandomValues) {
32
- window.crypto.getRandomValues = function (array) {
33
- var bytes = new Uint8Array(array.buffer, array.byteOffset, array.byteLength);
34
- for (var i = 0; i < bytes.length; i++) {
35
- bytes[i] = Math.floor(Math.random() * 256);
36
- }
37
- return array;
38
- };
39
- }
40
- var sha256_1 = function (data) { return __awaiter(void 0, void 0, void 0, function () {
41
- var toUint8, bytes, hash, k, ml, msg, dv, high, low, i, w, j, j, s0, s1, a, b, c, d, e, f, g, h, j, S1, ch, temp1, S0, maj, temp2, result, i;
42
- return __generator(this, function (_a) {
43
- toUint8 = function (src) {
44
- if (src instanceof ArrayBuffer)
45
- return new Uint8Array(src);
46
- if (ArrayBuffer.isView(src)) {
47
- var view = src;
48
- return new Uint8Array(view.buffer, view.byteOffset || 0, view.byteLength);
49
- }
50
- throw new TypeError("Unsupported BufferSource");
51
- };
52
- bytes = toUint8(data);
53
- hash = new Uint32Array(8);
54
- k = new Uint32Array([
55
- 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1,
56
- 0x923f82a4, 0xab1c5ed5, 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3,
57
- 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174, 0xe49b69c1, 0xefbe4786,
58
- 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da,
59
- 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147,
60
- 0x06ca6351, 0x14292967, 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13,
61
- 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85, 0xa2bfe8a1, 0xa81a664b,
62
- 0xc24b8b70, 0xc76c51a3, 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070,
63
- 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a,
64
- 0x5b9cca4f, 0x682e6ff3, 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208,
65
- 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2,
66
- ]);
67
- hash[0] = 0x6a09e667;
68
- hash[1] = 0xbb67ae85;
69
- hash[2] = 0x3c6ef372;
70
- hash[3] = 0xa54ff53a;
71
- hash[4] = 0x510e527f;
72
- hash[5] = 0x9b05688c;
73
- hash[6] = 0x1f83d9ab;
74
- hash[7] = 0x5be0cd19;
75
- ml = bytes.length * 8;
76
- msg = new Uint8Array(bytes.length + 64 + ((64 - ((bytes.length + 9) % 64)) % 64));
77
- msg.set(bytes);
78
- msg[bytes.length] = 0x80;
79
- dv = new DataView(msg.buffer);
80
- high = Math.floor(ml / 0x100000000);
81
- low = ml >>> 0;
82
- dv.setUint32(msg.length - 8, high, false);
83
- dv.setUint32(msg.length - 4, low, false);
84
- for (i = 0; i < msg.length; i += 64) {
85
- w = new Uint32Array(64);
86
- for (j = 0; j < 16; j++)
87
- w[j] = new DataView(msg.buffer).getUint32(i + j * 4, false);
88
- for (j = 16; j < 64; j++) {
89
- s0 = ((w[j - 15] >>> 7) | (w[j - 15] << 25)) ^
90
- ((w[j - 15] >>> 18) | (w[j - 15] << 14)) ^
91
- (w[j - 15] >>> 3);
92
- s1 = ((w[j - 2] >>> 17) | (w[j - 2] << 15)) ^
93
- ((w[j - 2] >>> 19) | (w[j - 2] << 13)) ^
94
- (w[j - 2] >>> 10);
95
- w[j] = (w[j - 16] + s0 + w[j - 7] + s1) >>> 0;
96
- }
97
- a = hash[0], b = hash[1], c = hash[2], d = hash[3], e = hash[4], f = hash[5], g = hash[6], h = hash[7];
98
- for (j = 0; j < 64; j++) {
99
- S1 = ((e >>> 6) | (e << 26)) ^
100
- ((e >>> 11) | (e << 21)) ^
101
- ((e >>> 25) | (e << 7));
102
- ch = (e & f) ^ (~e & g);
103
- temp1 = (h + S1 + ch + k[j] + w[j]) >>> 0;
104
- S0 = ((a >>> 2) | (a << 30)) ^
105
- ((a >>> 13) | (a << 19)) ^
106
- ((a >>> 22) | (a << 10));
107
- maj = (a & b) ^ (a & c) ^ (b & c);
108
- temp2 = (S0 + maj) >>> 0;
109
- h = g;
110
- g = f;
111
- f = e;
112
- e = (d + temp1) >>> 0;
113
- d = c;
114
- c = b;
115
- b = a;
116
- a = (temp1 + temp2) >>> 0;
117
- }
118
- hash[0] = (hash[0] + a) >>> 0;
119
- hash[1] = (hash[1] + b) >>> 0;
120
- hash[2] = (hash[2] + c) >>> 0;
121
- hash[3] = (hash[3] + d) >>> 0;
122
- hash[4] = (hash[4] + e) >>> 0;
123
- hash[5] = (hash[5] + f) >>> 0;
124
- hash[6] = (hash[6] + g) >>> 0;
125
- hash[7] = (hash[7] + h) >>> 0;
126
- }
127
- result = new Uint8Array(32);
128
- for (i = 0; i < 8; i++)
129
- new DataView(result.buffer).setUint32(i * 4, hash[i], false);
130
- return [2 /*return*/, result.buffer];
131
- });
132
- }); };
133
- // Store reference to original subtle if it exists
134
- var originalSubtle_1 = window.crypto.subtle;
135
- // Create the polyfilled subtle object
136
- var polyfillSubtle = {
137
- digest: function (algorithm, data) { return __awaiter(void 0, void 0, void 0, function () {
138
- var alg;
139
- return __generator(this, function (_a) {
140
- alg = typeof algorithm === "string"
141
- ? algorithm
142
- : algorithm.name;
143
- if (alg === "SHA-256")
144
- return [2 /*return*/, sha256_1(data)];
145
- if (originalSubtle_1 === null || originalSubtle_1 === void 0 ? void 0 : originalSubtle_1.digest)
146
- return [2 /*return*/, originalSubtle_1.digest(algorithm, data)];
147
- throw new Error("Unsupported algorithm: ".concat(alg));
148
- });
149
- }); },
150
- };
151
- // Try to define the property, fallback to assignment if needed
152
- try {
153
- Object.defineProperty(window.crypto, "subtle", {
154
- configurable: true,
155
- enumerable: true,
156
- writable: true,
157
- value: polyfillSubtle,
158
- });
159
- }
160
- catch (_a) {
161
- // Some environments prevent redefining built-ins
162
- window.crypto.subtle = polyfillSubtle;
163
- }
164
- // Polyfill randomUUID
165
- if (!window.crypto.randomUUID) {
166
- window.crypto.randomUUID =
167
- function () {
168
- return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function (c) {
169
- var r = (Math.random() * 16) | 0;
170
- var v = c === "x" ? r : (r & 0x3) | 0x8;
171
- return v.toString(16);
172
- });
173
- };
174
- }
175
- // Log success for debugging
176
- console.log("Crypto polyfill loaded successfully");
177
- }
178
-
179
23
  /******************************************************************************
180
24
  Copyright (c) Microsoft Corporation.
181
25
 
@@ -216,7 +60,7 @@ function __rest(s, e) {
216
60
  return t;
217
61
  }
218
62
 
219
- function __awaiter$1(thisArg, _arguments, P, generator) {
63
+ function __awaiter(thisArg, _arguments, P, generator) {
220
64
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
221
65
  return new (P || (P = Promise))(function (resolve, reject) {
222
66
  function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
@@ -226,7 +70,7 @@ function __awaiter$1(thisArg, _arguments, P, generator) {
226
70
  });
227
71
  }
228
72
 
229
- function __generator$1(thisArg, body) {
73
+ function __generator(thisArg, body) {
230
74
  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);
231
75
  return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
232
76
  function verb(n) { return function (v) { return step([n, v]); }; }
@@ -323,10 +167,10 @@ function useCAMSAuth(options) {
323
167
  }
324
168
  }
325
169
  }, [options.storageKey]);
326
- var login = useCallback(function (config) { return __awaiter$1(_this, void 0, void 0, function () {
170
+ var login = useCallback(function (config) { return __awaiter(_this, void 0, void 0, function () {
327
171
  var loginConfig, userProfile, err_1, e, isPopupClosedError, restoredToken, userProfile;
328
172
  var _a, _b, _c;
329
- return __generator$1(this, function (_d) {
173
+ return __generator(this, function (_d) {
330
174
  switch (_d.label) {
331
175
  case 0:
332
176
  if (!sessionManagerRef.current)
@@ -374,8 +218,8 @@ function useCAMSAuth(options) {
374
218
  }
375
219
  });
376
220
  }); }, [options.idleTimeout]);
377
- var logout = useCallback(function () { return __awaiter$1(_this, void 0, void 0, function () {
378
- return __generator$1(this, function (_a) {
221
+ var logout = useCallback(function () { return __awaiter(_this, void 0, void 0, function () {
222
+ return __generator(this, function (_a) {
379
223
  switch (_a.label) {
380
224
  case 0:
381
225
  if (!sessionManagerRef.current)
@@ -512,10 +356,10 @@ function useCAMSMSALAuth(options) {
512
356
  // };
513
357
  // handleRedirect();
514
358
  // }, []);
515
- var login = useCallback(function () { return __awaiter$1(_this, void 0, void 0, function () {
359
+ var login = useCallback(function () { return __awaiter(_this, void 0, void 0, function () {
516
360
  var response, mfaConfig, authenticator, err_1, camsError_1, camsError;
517
361
  var _a;
518
- return __generator$1(this, function (_b) {
362
+ return __generator(this, function (_b) {
519
363
  switch (_b.label) {
520
364
  case 0:
521
365
  if (inProgress !== InteractionStatus.None) {
@@ -588,8 +432,8 @@ function useCAMSMSALAuth(options) {
588
432
  }
589
433
  });
590
434
  }); }, [instance, scopes, prompt, appCode, MFAEndpoint, onAuthSuccess, onAuthError, storageKey, inProgress]);
591
- var completeMFA = useCallback(function (data) { return __awaiter$1(_this, void 0, void 0, function () {
592
- return __generator$1(this, function (_a) {
435
+ var completeMFA = useCallback(function (data) { return __awaiter(_this, void 0, void 0, function () {
436
+ return __generator(this, function (_a) {
593
437
  if (!mfaAuthenticator) {
594
438
  throw new CAMSError(CAMSErrorType.API_VALIDATION_ERROR, "MFA Authenticator not initialized");
595
439
  }
@@ -623,8 +467,8 @@ function useCAMSMSALAuth(options) {
623
467
  return [2 /*return*/];
624
468
  });
625
469
  }); }, [mfaAuthenticator, accessToken, idToken, storageKey, activeCookiePeriod]);
626
- var sendEmailOTP = useCallback(function () { return __awaiter$1(_this, void 0, void 0, function () {
627
- return __generator$1(this, function (_a) {
470
+ var sendEmailOTP = useCallback(function () { return __awaiter(_this, void 0, void 0, function () {
471
+ return __generator(this, function (_a) {
628
472
  switch (_a.label) {
629
473
  case 0:
630
474
  if (!mfaAuthenticator) {
@@ -635,9 +479,9 @@ function useCAMSMSALAuth(options) {
635
479
  }
636
480
  });
637
481
  }); }, [mfaAuthenticator]);
638
- var logout = useCallback(function () { return __awaiter$1(_this, void 0, void 0, function () {
482
+ var logout = useCallback(function () { return __awaiter(_this, void 0, void 0, function () {
639
483
  var err_2, camsError;
640
- return __generator$1(this, function (_a) {
484
+ return __generator(this, function (_a) {
641
485
  switch (_a.label) {
642
486
  case 0:
643
487
  _a.trys.push([0, 2, , 3]);
@@ -722,10 +566,10 @@ function arrayBufferToBase64url(buffer) {
722
566
  * @returns A promise that resolves to a JSON-serializable representation of the PublicKeyCredential.
723
567
  */
724
568
  function register(options) {
725
- return __awaiter$1(this, void 0, void 0, function () {
569
+ return __awaiter(this, void 0, void 0, function () {
726
570
  var createOptions, credential, publicKeyCredential, attestationResponse, transports, err_1;
727
571
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
728
- return __generator$1(this, function (_k) {
572
+ return __generator(this, function (_k) {
729
573
  switch (_k.label) {
730
574
  case 0:
731
575
  _k.trys.push([0, 2, , 3]);
@@ -783,10 +627,10 @@ function register(options) {
783
627
  * @returns A promise that resolves to a JSON-serializable representation of the PublicKeyCredential.
784
628
  */
785
629
  function authenticate(options) {
786
- return __awaiter$1(this, void 0, void 0, function () {
630
+ return __awaiter(this, void 0, void 0, function () {
787
631
  var getOptions, credential, publicKeyCredential, assertionResponse;
788
632
  var _a;
789
- return __generator$1(this, function (_b) {
633
+ return __generator(this, function (_b) {
790
634
  switch (_b.label) {
791
635
  case 0:
792
636
  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) })); }) });
@@ -1336,8 +1180,8 @@ function CAMSMSALProviderInner(_a) {
1336
1180
  }
1337
1181
  }, [userProfile, profileStorageKey]);
1338
1182
  // Enhanced logout that also clears profile
1339
- var enhancedLogout = function () { return __awaiter$1(_this, void 0, void 0, function () {
1340
- return __generator$1(this, function (_a) {
1183
+ var enhancedLogout = function () { return __awaiter(_this, void 0, void 0, function () {
1184
+ return __generator(this, function (_a) {
1341
1185
  switch (_a.label) {
1342
1186
  case 0: return [4 /*yield*/, auth.logout()];
1343
1187
  case 1:
@@ -1438,8 +1282,8 @@ function CAMSProviderCore(props) {
1438
1282
  }
1439
1283
  }
1440
1284
  }, [userProfile, profileStorageKey]);
1441
- var enhancedLogout = function () { return __awaiter$1(_this, void 0, void 0, function () {
1442
- return __generator$1(this, function (_a) {
1285
+ var enhancedLogout = function () { return __awaiter(_this, void 0, void 0, function () {
1286
+ return __generator(this, function (_a) {
1443
1287
  switch (_a.label) {
1444
1288
  case 0: return [4 /*yield*/, auth.logout()];
1445
1289
  case 1:
@@ -1936,9 +1780,9 @@ var useOTPHandler = function (_a) {
1936
1780
  var _b = useState(false), loading = _b[0], setLoading = _b[1];
1937
1781
  var _c = useState(0), attemptCount = _c[0], setAttemptCount = _c[1];
1938
1782
  var _d = useState(false), isMaxAttemptsReached = _d[0], setIsMaxAttemptsReached = _d[1];
1939
- var handleSubmitOTP = useMemo(function () { return function (authenticationValue) { return __awaiter$1(void 0, void 0, void 0, function () {
1783
+ var handleSubmitOTP = useMemo(function () { return function (authenticationValue) { return __awaiter(void 0, void 0, void 0, function () {
1940
1784
  var currentAttempt, response, error_1, currentAttempt;
1941
- return __generator$1(this, function (_a) {
1785
+ return __generator(this, function (_a) {
1942
1786
  switch (_a.label) {
1943
1787
  case 0:
1944
1788
  if (isMaxAttemptsReached) {
@@ -2028,9 +1872,9 @@ var useCredentialsHandler = function (onAuthComplete) {
2028
1872
  var _b = useState(0), attemptCount = _b[0], setAttemptCount = _b[1];
2029
1873
  var _c = useState(false), isMaxAttemptsReached = _c[0], setIsMaxAttemptsReached = _c[1];
2030
1874
  var handleSubmitCredentials = useMemo(function () {
2031
- return function (CredAuthEndpoint, credentials, appCode) { return __awaiter$1(void 0, void 0, void 0, function () {
1875
+ return function (CredAuthEndpoint, credentials, appCode) { return __awaiter(void 0, void 0, void 0, function () {
2032
1876
  var currentAttempt, response, error_2, currentAttempt;
2033
- return __generator$1(this, function (_a) {
1877
+ return __generator(this, function (_a) {
2034
1878
  switch (_a.label) {
2035
1879
  case 0:
2036
1880
  _a.trys.push([0, 2, 3, 4]);
@@ -2102,15 +1946,15 @@ var MFAOptions = function (_a) {
2102
1946
  var context = useCAMSContext();
2103
1947
  var _f = context.authMode === "MSAL" && "sendEmailOTP" in context
2104
1948
  ? context
2105
- : { sendEmailOTP: null, completeMFA: null, logout: function () { return __awaiter$1(void 0, void 0, void 0, function () { return __generator$1(this, function (_a) {
1949
+ : { sendEmailOTP: null, completeMFA: null, logout: function () { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) {
2106
1950
  return [2 /*return*/];
2107
1951
  }); }); } }, sendEmailOTP = _f.sendEmailOTP, completeMFA = _f.completeMFA, logout = _f.logout;
2108
1952
  var accessToken = context.authMode === "MSAL" ? context.accessToken : "";
2109
1953
  var idToken = context.authMode === "MSAL" ? context.idToken : "";
2110
1954
  var authenticate = useWebAuthn().authenticate;
2111
- var handleFIDOLogin = function () { return __awaiter$1(void 0, void 0, void 0, function () {
1955
+ var handleFIDOLogin = function () { return __awaiter(void 0, void 0, void 0, function () {
2112
1956
  var options, assertionResponse, error_1;
2113
- return __generator$1(this, function (_a) {
1957
+ return __generator(this, function (_a) {
2114
1958
  switch (_a.label) {
2115
1959
  case 0:
2116
1960
  _a.trys.push([0, 4, , 5]);
@@ -2190,9 +2034,9 @@ var MFAOptions = function (_a) {
2190
2034
  }
2191
2035
  var content = jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, {});
2192
2036
  if (!authType) {
2193
- 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 () {
2037
+ 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 () {
2194
2038
  var success;
2195
- return __generator$1(this, function (_a) {
2039
+ return __generator(this, function (_a) {
2196
2040
  switch (_a.label) {
2197
2041
  case 0:
2198
2042
  // resetAttempts();
@@ -2263,16 +2107,16 @@ var ADLoginModal = function (_a) {
2263
2107
  resolver: a$1(credentialsSchema),
2264
2108
  defaultValues: { username: "", password: "" },
2265
2109
  });
2266
- var handleCredentialsSubmit = function (values) { return __awaiter$1(void 0, void 0, void 0, function () {
2267
- return __generator$1(this, function (_a) {
2110
+ var handleCredentialsSubmit = function (values) { return __awaiter(void 0, void 0, void 0, function () {
2111
+ return __generator(this, function (_a) {
2268
2112
  setCredentials(values);
2269
2113
  setStep("mfa");
2270
2114
  return [2 /*return*/];
2271
2115
  });
2272
2116
  }); };
2273
- var handleMFASubmit = function (code) { return __awaiter$1(void 0, void 0, void 0, function () {
2117
+ var handleMFASubmit = function (code) { return __awaiter(void 0, void 0, void 0, function () {
2274
2118
  var error_1;
2275
- return __generator$1(this, function (_a) {
2119
+ return __generator(this, function (_a) {
2276
2120
  switch (_a.label) {
2277
2121
  case 0:
2278
2122
  setIsLoading(true);
@@ -2333,8 +2177,8 @@ var DefaultLoginPage = function (_a) {
2333
2177
  var login = context.login, isLoading = context.isLoading, authMode = context.authMode;
2334
2178
  var _b = useState(false), showADModal = _b[0], setShowADModal = _b[1];
2335
2179
  var register = useWebAuthn().register;
2336
- var _c = useCredentialsHandler(function (state, data) { return __awaiter$1(void 0, void 0, void 0, function () {
2337
- return __generator$1(this, function (_a) {
2180
+ var _c = useCredentialsHandler(function (state, data) { return __awaiter(void 0, void 0, void 0, function () {
2181
+ return __generator(this, function (_a) {
2338
2182
  console.log(data);
2339
2183
  if (state && data) {
2340
2184
  context.isAuthenticated = true;
@@ -2360,9 +2204,9 @@ var DefaultLoginPage = function (_a) {
2360
2204
  console.warn("Regular CAMS login requires configuration");
2361
2205
  }
2362
2206
  };
2363
- var handleRegister = function (data) { return __awaiter$1(void 0, void 0, void 0, function () {
2207
+ var handleRegister = function (data) { return __awaiter(void 0, void 0, void 0, function () {
2364
2208
  var options, attestationResponse, error_1;
2365
- return __generator$1(this, function (_a) {
2209
+ return __generator(this, function (_a) {
2366
2210
  switch (_a.label) {
2367
2211
  case 0:
2368
2212
  _a.trys.push([0, 4, , 5]);
@@ -2400,9 +2244,9 @@ var DefaultLoginPage = function (_a) {
2400
2244
  // variant="outline"
2401
2245
  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
2402
2246
  ? "Logging in..."
2403
- : "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) {
2247
+ : "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) {
2404
2248
  var username = _b.username, password = _b.password, MFACode = _b.MFACode;
2405
- return __generator$1(this, function (_c) {
2249
+ return __generator(this, function (_c) {
2406
2250
  // Implement your AD login logic here
2407
2251
  console.log("AD Login:", { username: username, password: password, MFACode: MFACode });
2408
2252
  // Example: await adLoginService(username, password, mfaCode);
@@ -2443,8 +2287,8 @@ var MFAGate = function (_a) {
2443
2287
  if (!success)
2444
2288
  Logger.error("MFA authentication failed");
2445
2289
  }, []);
2446
- var handleAuthFailed = useCallback(function () { return __awaiter$1(void 0, void 0, void 0, function () {
2447
- return __generator$1(this, function (_a) {
2290
+ var handleAuthFailed = useCallback(function () { return __awaiter(void 0, void 0, void 0, function () {
2291
+ return __generator(this, function (_a) {
2448
2292
  switch (_a.label) {
2449
2293
  case 0: return [4 /*yield*/, context.logout()];
2450
2294
  case 1: