@nibssplc/cams-sdk-react 1.0.0-rc.42 → 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.
@@ -1,4 +1,3 @@
1
- import "../utils/crypto-polyfill";
2
1
  import React from "react";
3
2
  import { PublicClientApplication, Configuration } from "@azure/msal-browser";
4
3
  import { Profile } from "@nibssplc/cams-sdk";
@@ -1,4 +1,3 @@
1
- import "../utils/crypto-polyfill";
2
1
  import { MFAEndpoints } from "./MFAGate";
3
2
  interface LoginPageProps {
4
3
  usePassKey?: boolean;
@@ -1,4 +1,3 @@
1
- import "../utils/crypto-polyfill";
2
1
  import React from "react";
3
2
  import { PublicClientApplication, Configuration } from "@azure/msal-browser";
4
3
  import { UseCAMSAuthOptions } from "../hooks/useCAMSAuth";
@@ -1,4 +1,3 @@
1
- import "../utils/crypto-polyfill";
2
1
  import { CAMSError, CAMSMFAAuthenticator, MFAResponse } from "@nibssplc/cams-sdk";
3
2
  export interface UseCAMSMSALAuthOptions {
4
3
  onAuthSuccess?: (token: string) => void;
package/dist/index.cjs.js CHANGED
@@ -41,162 +41,6 @@ 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
- // Run immediately and synchronously
47
- // Ensure crypto object exists
48
- if (!window.crypto) {
49
- window.crypto = {};
50
- }
51
- // Polyfill getRandomValues
52
- if (!window.crypto.getRandomValues) {
53
- window.crypto.getRandomValues = function (array) {
54
- var bytes = new Uint8Array(array.buffer, array.byteOffset, array.byteLength);
55
- for (var i = 0; i < bytes.length; i++) {
56
- bytes[i] = Math.floor(Math.random() * 256);
57
- }
58
- return array;
59
- };
60
- }
61
- var sha256_1 = function (data) { return __awaiter(void 0, void 0, void 0, function () {
62
- 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;
63
- return __generator(this, function (_a) {
64
- toUint8 = function (src) {
65
- if (src instanceof ArrayBuffer)
66
- return new Uint8Array(src);
67
- if (ArrayBuffer.isView(src)) {
68
- var view = src;
69
- return new Uint8Array(view.buffer, view.byteOffset || 0, view.byteLength);
70
- }
71
- throw new TypeError("Unsupported BufferSource");
72
- };
73
- bytes = toUint8(data);
74
- hash = new Uint32Array(8);
75
- k = new Uint32Array([
76
- 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1,
77
- 0x923f82a4, 0xab1c5ed5, 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3,
78
- 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174, 0xe49b69c1, 0xefbe4786,
79
- 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da,
80
- 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147,
81
- 0x06ca6351, 0x14292967, 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13,
82
- 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85, 0xa2bfe8a1, 0xa81a664b,
83
- 0xc24b8b70, 0xc76c51a3, 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070,
84
- 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a,
85
- 0x5b9cca4f, 0x682e6ff3, 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208,
86
- 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2,
87
- ]);
88
- hash[0] = 0x6a09e667;
89
- hash[1] = 0xbb67ae85;
90
- hash[2] = 0x3c6ef372;
91
- hash[3] = 0xa54ff53a;
92
- hash[4] = 0x510e527f;
93
- hash[5] = 0x9b05688c;
94
- hash[6] = 0x1f83d9ab;
95
- hash[7] = 0x5be0cd19;
96
- ml = bytes.length * 8;
97
- msg = new Uint8Array(bytes.length + 64 + ((64 - ((bytes.length + 9) % 64)) % 64));
98
- msg.set(bytes);
99
- msg[bytes.length] = 0x80;
100
- dv = new DataView(msg.buffer);
101
- high = Math.floor(ml / 0x100000000);
102
- low = ml >>> 0;
103
- dv.setUint32(msg.length - 8, high, false);
104
- dv.setUint32(msg.length - 4, low, false);
105
- for (i = 0; i < msg.length; i += 64) {
106
- w = new Uint32Array(64);
107
- for (j = 0; j < 16; j++)
108
- w[j] = new DataView(msg.buffer).getUint32(i + j * 4, false);
109
- for (j = 16; j < 64; j++) {
110
- s0 = ((w[j - 15] >>> 7) | (w[j - 15] << 25)) ^
111
- ((w[j - 15] >>> 18) | (w[j - 15] << 14)) ^
112
- (w[j - 15] >>> 3);
113
- s1 = ((w[j - 2] >>> 17) | (w[j - 2] << 15)) ^
114
- ((w[j - 2] >>> 19) | (w[j - 2] << 13)) ^
115
- (w[j - 2] >>> 10);
116
- w[j] = (w[j - 16] + s0 + w[j - 7] + s1) >>> 0;
117
- }
118
- a = hash[0], b = hash[1], c = hash[2], d = hash[3], e = hash[4], f = hash[5], g = hash[6], h = hash[7];
119
- for (j = 0; j < 64; j++) {
120
- S1 = ((e >>> 6) | (e << 26)) ^
121
- ((e >>> 11) | (e << 21)) ^
122
- ((e >>> 25) | (e << 7));
123
- ch = (e & f) ^ (~e & g);
124
- temp1 = (h + S1 + ch + k[j] + w[j]) >>> 0;
125
- S0 = ((a >>> 2) | (a << 30)) ^
126
- ((a >>> 13) | (a << 19)) ^
127
- ((a >>> 22) | (a << 10));
128
- maj = (a & b) ^ (a & c) ^ (b & c);
129
- temp2 = (S0 + maj) >>> 0;
130
- h = g;
131
- g = f;
132
- f = e;
133
- e = (d + temp1) >>> 0;
134
- d = c;
135
- c = b;
136
- b = a;
137
- a = (temp1 + temp2) >>> 0;
138
- }
139
- hash[0] = (hash[0] + a) >>> 0;
140
- hash[1] = (hash[1] + b) >>> 0;
141
- hash[2] = (hash[2] + c) >>> 0;
142
- hash[3] = (hash[3] + d) >>> 0;
143
- hash[4] = (hash[4] + e) >>> 0;
144
- hash[5] = (hash[5] + f) >>> 0;
145
- hash[6] = (hash[6] + g) >>> 0;
146
- hash[7] = (hash[7] + h) >>> 0;
147
- }
148
- result = new Uint8Array(32);
149
- for (i = 0; i < 8; i++)
150
- new DataView(result.buffer).setUint32(i * 4, hash[i], false);
151
- return [2 /*return*/, result.buffer];
152
- });
153
- }); };
154
- // Store reference to original subtle if it exists
155
- var originalSubtle_1 = window.crypto.subtle;
156
- // Create the polyfilled subtle object
157
- var polyfillSubtle = {
158
- digest: function (algorithm, data) { return __awaiter(void 0, void 0, void 0, function () {
159
- var alg;
160
- return __generator(this, function (_a) {
161
- alg = typeof algorithm === "string"
162
- ? algorithm
163
- : algorithm.name;
164
- if (alg === "SHA-256")
165
- return [2 /*return*/, sha256_1(data)];
166
- if (originalSubtle_1 === null || originalSubtle_1 === void 0 ? void 0 : originalSubtle_1.digest)
167
- return [2 /*return*/, originalSubtle_1.digest(algorithm, data)];
168
- throw new Error("Unsupported algorithm: ".concat(alg));
169
- });
170
- }); },
171
- };
172
- // Try to define the property, fallback to assignment if needed
173
- try {
174
- Object.defineProperty(window.crypto, "subtle", {
175
- configurable: true,
176
- enumerable: true,
177
- writable: true,
178
- value: polyfillSubtle,
179
- });
180
- }
181
- catch (_a) {
182
- // Some environments prevent redefining built-ins
183
- window.crypto.subtle = polyfillSubtle;
184
- }
185
- // Polyfill randomUUID
186
- if (!window.crypto.randomUUID) {
187
- window.crypto.randomUUID =
188
- function () {
189
- return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function (c) {
190
- var r = (Math.random() * 16) | 0;
191
- var v = c === "x" ? r : (r & 0x3) | 0x8;
192
- return v.toString(16);
193
- });
194
- };
195
- }
196
- // Log success for debugging
197
- console.log("Crypto polyfill loaded successfully");
198
- }
199
-
200
44
  /******************************************************************************
201
45
  Copyright (c) Microsoft Corporation.
202
46
 
@@ -237,7 +81,7 @@ function __rest(s, e) {
237
81
  return t;
238
82
  }
239
83
 
240
- function __awaiter$1(thisArg, _arguments, P, generator) {
84
+ function __awaiter(thisArg, _arguments, P, generator) {
241
85
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
242
86
  return new (P || (P = Promise))(function (resolve, reject) {
243
87
  function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
@@ -247,7 +91,7 @@ function __awaiter$1(thisArg, _arguments, P, generator) {
247
91
  });
248
92
  }
249
93
 
250
- function __generator$1(thisArg, body) {
94
+ function __generator(thisArg, body) {
251
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);
252
96
  return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
253
97
  function verb(n) { return function (v) { return step([n, v]); }; }
@@ -344,10 +188,10 @@ function useCAMSAuth(options) {
344
188
  }
345
189
  }
346
190
  }, [options.storageKey]);
347
- var login = React.useCallback(function (config) { return __awaiter$1(_this, void 0, void 0, function () {
191
+ var login = React.useCallback(function (config) { return __awaiter(_this, void 0, void 0, function () {
348
192
  var loginConfig, userProfile, err_1, e, isPopupClosedError, restoredToken, userProfile;
349
193
  var _a, _b, _c;
350
- return __generator$1(this, function (_d) {
194
+ return __generator(this, function (_d) {
351
195
  switch (_d.label) {
352
196
  case 0:
353
197
  if (!sessionManagerRef.current)
@@ -395,8 +239,8 @@ function useCAMSAuth(options) {
395
239
  }
396
240
  });
397
241
  }); }, [options.idleTimeout]);
398
- var logout = React.useCallback(function () { return __awaiter$1(_this, void 0, void 0, function () {
399
- return __generator$1(this, function (_a) {
242
+ var logout = React.useCallback(function () { return __awaiter(_this, void 0, void 0, function () {
243
+ return __generator(this, function (_a) {
400
244
  switch (_a.label) {
401
245
  case 0:
402
246
  if (!sessionManagerRef.current)
@@ -533,10 +377,10 @@ function useCAMSMSALAuth(options) {
533
377
  // };
534
378
  // handleRedirect();
535
379
  // }, []);
536
- var login = React.useCallback(function () { return __awaiter$1(_this, void 0, void 0, function () {
380
+ var login = React.useCallback(function () { return __awaiter(_this, void 0, void 0, function () {
537
381
  var response, mfaConfig, authenticator, err_1, camsError_1, camsError;
538
382
  var _a;
539
- return __generator$1(this, function (_b) {
383
+ return __generator(this, function (_b) {
540
384
  switch (_b.label) {
541
385
  case 0:
542
386
  if (inProgress !== msalBrowser.InteractionStatus.None) {
@@ -609,8 +453,8 @@ function useCAMSMSALAuth(options) {
609
453
  }
610
454
  });
611
455
  }); }, [instance, scopes, prompt, appCode, MFAEndpoint, onAuthSuccess, onAuthError, storageKey, inProgress]);
612
- var completeMFA = React.useCallback(function (data) { return __awaiter$1(_this, void 0, void 0, function () {
613
- return __generator$1(this, function (_a) {
456
+ var completeMFA = React.useCallback(function (data) { return __awaiter(_this, void 0, void 0, function () {
457
+ return __generator(this, function (_a) {
614
458
  if (!mfaAuthenticator) {
615
459
  throw new camsSdk.CAMSError(camsSdk.CAMSErrorType.API_VALIDATION_ERROR, "MFA Authenticator not initialized");
616
460
  }
@@ -644,8 +488,8 @@ function useCAMSMSALAuth(options) {
644
488
  return [2 /*return*/];
645
489
  });
646
490
  }); }, [mfaAuthenticator, accessToken, idToken, storageKey, activeCookiePeriod]);
647
- var sendEmailOTP = React.useCallback(function () { return __awaiter$1(_this, void 0, void 0, function () {
648
- return __generator$1(this, function (_a) {
491
+ var sendEmailOTP = React.useCallback(function () { return __awaiter(_this, void 0, void 0, function () {
492
+ return __generator(this, function (_a) {
649
493
  switch (_a.label) {
650
494
  case 0:
651
495
  if (!mfaAuthenticator) {
@@ -656,9 +500,9 @@ function useCAMSMSALAuth(options) {
656
500
  }
657
501
  });
658
502
  }); }, [mfaAuthenticator]);
659
- var logout = React.useCallback(function () { return __awaiter$1(_this, void 0, void 0, function () {
503
+ var logout = React.useCallback(function () { return __awaiter(_this, void 0, void 0, function () {
660
504
  var err_2, camsError;
661
- return __generator$1(this, function (_a) {
505
+ return __generator(this, function (_a) {
662
506
  switch (_a.label) {
663
507
  case 0:
664
508
  _a.trys.push([0, 2, , 3]);
@@ -743,10 +587,10 @@ function arrayBufferToBase64url(buffer) {
743
587
  * @returns A promise that resolves to a JSON-serializable representation of the PublicKeyCredential.
744
588
  */
745
589
  function register(options) {
746
- return __awaiter$1(this, void 0, void 0, function () {
590
+ return __awaiter(this, void 0, void 0, function () {
747
591
  var createOptions, credential, publicKeyCredential, attestationResponse, transports, err_1;
748
592
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
749
- return __generator$1(this, function (_k) {
593
+ return __generator(this, function (_k) {
750
594
  switch (_k.label) {
751
595
  case 0:
752
596
  _k.trys.push([0, 2, , 3]);
@@ -804,10 +648,10 @@ function register(options) {
804
648
  * @returns A promise that resolves to a JSON-serializable representation of the PublicKeyCredential.
805
649
  */
806
650
  function authenticate(options) {
807
- return __awaiter$1(this, void 0, void 0, function () {
651
+ return __awaiter(this, void 0, void 0, function () {
808
652
  var getOptions, credential, publicKeyCredential, assertionResponse;
809
653
  var _a;
810
- return __generator$1(this, function (_b) {
654
+ return __generator(this, function (_b) {
811
655
  switch (_b.label) {
812
656
  case 0:
813
657
  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) })); }) });
@@ -1280,7 +1124,7 @@ function ProtectedRoute(_a) {
1280
1124
  var children = _a.children, fallback = _a.fallback, redirectTo = _a.redirectTo;
1281
1125
  var _b = useCAMSContext$1(), isAuthenticated = _b.isAuthenticated, isLoading = _b.isLoading;
1282
1126
  if (isLoading) {
1283
- return fallback || jsxRuntimeExports.jsx("div", { children: "Loading..." });
1127
+ return fallback || jsxRuntimeExports.jsx("div", { className: 'h-screen flex items-center justify-center', children: "Loading..." });
1284
1128
  }
1285
1129
  if (!isAuthenticated) {
1286
1130
  if (redirectTo && typeof window !== 'undefined') {
@@ -1357,8 +1201,8 @@ function CAMSMSALProviderInner(_a) {
1357
1201
  }
1358
1202
  }, [userProfile, profileStorageKey]);
1359
1203
  // Enhanced logout that also clears profile
1360
- var enhancedLogout = function () { return __awaiter$1(_this, void 0, void 0, function () {
1361
- return __generator$1(this, function (_a) {
1204
+ var enhancedLogout = function () { return __awaiter(_this, void 0, void 0, function () {
1205
+ return __generator(this, function (_a) {
1362
1206
  switch (_a.label) {
1363
1207
  case 0: return [4 /*yield*/, auth.logout()];
1364
1208
  case 1:
@@ -1459,8 +1303,8 @@ function CAMSProviderCore(props) {
1459
1303
  }
1460
1304
  }
1461
1305
  }, [userProfile, profileStorageKey]);
1462
- var enhancedLogout = function () { return __awaiter$1(_this, void 0, void 0, function () {
1463
- return __generator$1(this, function (_a) {
1306
+ var enhancedLogout = function () { return __awaiter(_this, void 0, void 0, function () {
1307
+ return __generator(this, function (_a) {
1464
1308
  switch (_a.label) {
1465
1309
  case 0: return [4 /*yield*/, auth.logout()];
1466
1310
  case 1:
@@ -1517,7 +1361,7 @@ function UnifiedCAMSProvider(props) {
1517
1361
  var instance = msalInstance || new msalBrowser.PublicClientApplication(msalConfig);
1518
1362
  return (jsxRuntimeExports.jsx(msalReact.MsalProvider, { instance: instance, children: jsxRuntimeExports.jsx(CAMSProviderCore, __assign({}, props)) }));
1519
1363
  }
1520
- return (jsxRuntimeExports.jsx(ClientOnly, { fallback: jsxRuntimeExports.jsx("div", { children: "Loading..." }), children: jsxRuntimeExports.jsx(CAMSProviderCore, __assign({}, props)) }));
1364
+ return (jsxRuntimeExports.jsx(ClientOnly, { fallback: jsxRuntimeExports.jsx("div", { className: 'h-screen flex items-center justify-center', children: "Loading..." }), children: jsxRuntimeExports.jsx(CAMSProviderCore, __assign({}, props)) }));
1521
1365
  }
1522
1366
  // Backward compatibility exports
1523
1367
  var CAMSProvider = function (props) { return (jsxRuntimeExports.jsx(UnifiedCAMSProvider, __assign({}, props, { mode: "REGULAR" }))); };
@@ -1957,9 +1801,9 @@ var useOTPHandler = function (_a) {
1957
1801
  var _b = React.useState(false), loading = _b[0], setLoading = _b[1];
1958
1802
  var _c = React.useState(0), attemptCount = _c[0], setAttemptCount = _c[1];
1959
1803
  var _d = React.useState(false), isMaxAttemptsReached = _d[0], setIsMaxAttemptsReached = _d[1];
1960
- var handleSubmitOTP = React.useMemo(function () { return function (authenticationValue) { return __awaiter$1(void 0, void 0, void 0, function () {
1804
+ var handleSubmitOTP = React.useMemo(function () { return function (authenticationValue) { return __awaiter(void 0, void 0, void 0, function () {
1961
1805
  var currentAttempt, response, error_1, currentAttempt;
1962
- return __generator$1(this, function (_a) {
1806
+ return __generator(this, function (_a) {
1963
1807
  switch (_a.label) {
1964
1808
  case 0:
1965
1809
  if (isMaxAttemptsReached) {
@@ -2049,9 +1893,9 @@ var useCredentialsHandler = function (onAuthComplete) {
2049
1893
  var _b = React.useState(0), attemptCount = _b[0], setAttemptCount = _b[1];
2050
1894
  var _c = React.useState(false), isMaxAttemptsReached = _c[0], setIsMaxAttemptsReached = _c[1];
2051
1895
  var handleSubmitCredentials = React.useMemo(function () {
2052
- return function (CredAuthEndpoint, credentials, appCode) { return __awaiter$1(void 0, void 0, void 0, function () {
1896
+ return function (CredAuthEndpoint, credentials, appCode) { return __awaiter(void 0, void 0, void 0, function () {
2053
1897
  var currentAttempt, response, error_2, currentAttempt;
2054
- return __generator$1(this, function (_a) {
1898
+ return __generator(this, function (_a) {
2055
1899
  switch (_a.label) {
2056
1900
  case 0:
2057
1901
  _a.trys.push([0, 2, 3, 4]);
@@ -2123,15 +1967,15 @@ var MFAOptions = function (_a) {
2123
1967
  var context = useCAMSContext();
2124
1968
  var _f = context.authMode === "MSAL" && "sendEmailOTP" in context
2125
1969
  ? context
2126
- : { sendEmailOTP: null, completeMFA: null, logout: function () { return __awaiter$1(void 0, void 0, void 0, function () { return __generator$1(this, function (_a) {
1970
+ : { sendEmailOTP: null, completeMFA: null, logout: function () { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) {
2127
1971
  return [2 /*return*/];
2128
1972
  }); }); } }, sendEmailOTP = _f.sendEmailOTP, completeMFA = _f.completeMFA, logout = _f.logout;
2129
1973
  var accessToken = context.authMode === "MSAL" ? context.accessToken : "";
2130
1974
  var idToken = context.authMode === "MSAL" ? context.idToken : "";
2131
1975
  var authenticate = useWebAuthn().authenticate;
2132
- var handleFIDOLogin = function () { return __awaiter$1(void 0, void 0, void 0, function () {
1976
+ var handleFIDOLogin = function () { return __awaiter(void 0, void 0, void 0, function () {
2133
1977
  var options, assertionResponse, error_1;
2134
- return __generator$1(this, function (_a) {
1978
+ return __generator(this, function (_a) {
2135
1979
  switch (_a.label) {
2136
1980
  case 0:
2137
1981
  _a.trys.push([0, 4, , 5]);
@@ -2211,9 +2055,9 @@ var MFAOptions = function (_a) {
2211
2055
  }
2212
2056
  var content = jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, {});
2213
2057
  if (!authType) {
2214
- 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 () {
2058
+ 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 () {
2215
2059
  var success;
2216
- return __generator$1(this, function (_a) {
2060
+ return __generator(this, function (_a) {
2217
2061
  switch (_a.label) {
2218
2062
  case 0:
2219
2063
  // resetAttempts();
@@ -2284,16 +2128,16 @@ var ADLoginModal = function (_a) {
2284
2128
  resolver: a$1(credentialsSchema),
2285
2129
  defaultValues: { username: "", password: "" },
2286
2130
  });
2287
- var handleCredentialsSubmit = function (values) { return __awaiter$1(void 0, void 0, void 0, function () {
2288
- return __generator$1(this, function (_a) {
2131
+ var handleCredentialsSubmit = function (values) { return __awaiter(void 0, void 0, void 0, function () {
2132
+ return __generator(this, function (_a) {
2289
2133
  setCredentials(values);
2290
2134
  setStep("mfa");
2291
2135
  return [2 /*return*/];
2292
2136
  });
2293
2137
  }); };
2294
- var handleMFASubmit = function (code) { return __awaiter$1(void 0, void 0, void 0, function () {
2138
+ var handleMFASubmit = function (code) { return __awaiter(void 0, void 0, void 0, function () {
2295
2139
  var error_1;
2296
- return __generator$1(this, function (_a) {
2140
+ return __generator(this, function (_a) {
2297
2141
  switch (_a.label) {
2298
2142
  case 0:
2299
2143
  setIsLoading(true);
@@ -2354,8 +2198,8 @@ var DefaultLoginPage = function (_a) {
2354
2198
  var login = context.login, isLoading = context.isLoading, authMode = context.authMode;
2355
2199
  var _b = React.useState(false), showADModal = _b[0], setShowADModal = _b[1];
2356
2200
  var register = useWebAuthn().register;
2357
- var _c = useCredentialsHandler(function (state, data) { return __awaiter$1(void 0, void 0, void 0, function () {
2358
- return __generator$1(this, function (_a) {
2201
+ var _c = useCredentialsHandler(function (state, data) { return __awaiter(void 0, void 0, void 0, function () {
2202
+ return __generator(this, function (_a) {
2359
2203
  console.log(data);
2360
2204
  if (state && data) {
2361
2205
  context.isAuthenticated = true;
@@ -2381,9 +2225,9 @@ var DefaultLoginPage = function (_a) {
2381
2225
  console.warn("Regular CAMS login requires configuration");
2382
2226
  }
2383
2227
  };
2384
- var handleRegister = function (data) { return __awaiter$1(void 0, void 0, void 0, function () {
2228
+ var handleRegister = function (data) { return __awaiter(void 0, void 0, void 0, function () {
2385
2229
  var options, attestationResponse, error_1;
2386
- return __generator$1(this, function (_a) {
2230
+ return __generator(this, function (_a) {
2387
2231
  switch (_a.label) {
2388
2232
  case 0:
2389
2233
  _a.trys.push([0, 4, , 5]);
@@ -2421,9 +2265,9 @@ var DefaultLoginPage = function (_a) {
2421
2265
  // variant="outline"
2422
2266
  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
2423
2267
  ? "Logging in..."
2424
- : "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) {
2268
+ : "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) {
2425
2269
  var username = _b.username, password = _b.password, MFACode = _b.MFACode;
2426
- return __generator$1(this, function (_c) {
2270
+ return __generator(this, function (_c) {
2427
2271
  // Implement your AD login logic here
2428
2272
  console.log("AD Login:", { username: username, password: password, MFACode: MFACode });
2429
2273
  // Example: await adLoginService(username, password, mfaCode);
@@ -2446,7 +2290,7 @@ var MFAEndpointsSchema = z.object({
2446
2290
  AuthChallengeVerify: z.url("MFA AuthChallengeVerify must be a valid URL"),
2447
2291
  });
2448
2292
  var MFAGate = function (_a) {
2449
- var children = _a.children, _b = _a.fallback, fallback = _b === void 0 ? jsxRuntimeExports.jsx(LoadingSpinner, {}) : _b,
2293
+ var children = _a.children, _b = _a.fallback, fallback = _b === void 0 ? jsxRuntimeExports.jsx("div", { className: 'h-screen flex items-center justify-center', children: jsxRuntimeExports.jsx(LoadingSpinner, {}) }) : _b,
2450
2294
  // loginComponent: LoginComponent = DefaultLoginPage,
2451
2295
  _c = _a.usePassKey,
2452
2296
  // loginComponent: LoginComponent = DefaultLoginPage,
@@ -2464,8 +2308,8 @@ var MFAGate = function (_a) {
2464
2308
  if (!success)
2465
2309
  camsSdk.Logger.error("MFA authentication failed");
2466
2310
  }, []);
2467
- var handleAuthFailed = React.useCallback(function () { return __awaiter$1(void 0, void 0, void 0, function () {
2468
- return __generator$1(this, function (_a) {
2311
+ var handleAuthFailed = React.useCallback(function () { return __awaiter(void 0, void 0, void 0, function () {
2312
+ return __generator(this, function (_a) {
2469
2313
  switch (_a.label) {
2470
2314
  case 0: return [4 /*yield*/, context.logout()];
2471
2315
  case 1: