@nibssplc/cams-sdk-react 1.0.0-rc.65 → 1.0.0-rc.67

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.esm.js CHANGED
@@ -493,7 +493,6 @@ function useCAMSMSALAuth(options) {
493
493
  mfaConfig = {
494
494
  accessToken: response.accessToken,
495
495
  idToken: response.idToken,
496
- // appCode,
497
496
  provider: "MSAL",
498
497
  APIAuthEndpoint: MFAEndpoint,
499
498
  };
@@ -501,7 +500,8 @@ function useCAMSMSALAuth(options) {
501
500
  return [4 /*yield*/, authenticator.GetUserMFAConfig(mfaConfig)];
502
501
  case 3:
503
502
  userConfig = _b.sent();
504
- Logger.info("MFA Authenticator initialized:", userConfig);
503
+ Logger.debug("MFA Authenticator initialized:", userConfig);
504
+ console.log("MFA Authenticator initialized:", userConfig);
505
505
  setRequiresMFA(userConfig.userInfo.isMFAEnabled);
506
506
  // Don't persist as authenticated until MFA is complete
507
507
  if (typeof window !== "undefined") {
@@ -1464,7 +1464,6 @@ var useCredentialsHandler = function (onAuthComplete) {
1464
1464
  return [4 /*yield*/, authenticator.LoginADCredentials(credentials, CredentialsAuthEndpoint)];
1465
1465
  case 1:
1466
1466
  response = _a.sent();
1467
- console.log(response);
1468
1467
  if (response) {
1469
1468
  onAuthComplete(true, response);
1470
1469
  return [2 /*return*/, true];
@@ -1487,10 +1486,6 @@ var useCredentialsHandler = function (onAuthComplete) {
1487
1486
  currentAttempt = attemptCount + 1;
1488
1487
  if (currentAttempt >= MAX_ATTEMPTS) {
1489
1488
  setIsMaxAttemptsReached(true);
1490
- onAuthComplete(false, error_2.response.data);
1491
- }
1492
- else {
1493
- onAuthComplete(false, error_2.response.data);
1494
1489
  }
1495
1490
  onAuthComplete(false, error_2.response.data);
1496
1491
  return [2 /*return*/, false];
@@ -1716,7 +1711,7 @@ var ADLoginModal = function (_a) {
1716
1711
  };
1717
1712
 
1718
1713
  var DefaultLoginPage = function (_a) {
1719
- var _b = _a.username, username = _b === void 0 ? "" : _b, usePassKey = _a.usePassKey, useADLogin = _a.useADLogin, MFAEndpoints = _a.MFAEndpoints, CredentialsAuthEndpoint = _a.CredentialsAuthEndpoint, PassKeysRegisterProps = _a.PassKeysRegisterProps;
1714
+ var usePassKey = _a.usePassKey, useADLogin = _a.useADLogin, MFAEndpoints = _a.MFAEndpoints, CredentialsAuthEndpoint = _a.CredentialsAuthEndpoint, PassKeysRegisterProps = _a.PassKeysRegisterProps;
1720
1715
  var cardVariants = {
1721
1716
  hidden: { opacity: 0, scale: 0.8, y: 50 },
1722
1717
  visible: {
@@ -1729,10 +1724,10 @@ var DefaultLoginPage = function (_a) {
1729
1724
  };
1730
1725
  var context = useCAMSContext();
1731
1726
  var login = context.login, isLoading = context.isLoading, authMode = context.authMode;
1732
- var _c = useState(false), showADModal = _c[0], setShowADModal = _c[1];
1727
+ var _b = useState(false), showADModal = _b[0], setShowADModal = _b[1];
1733
1728
  var register = useWebAuthn().register;
1734
1729
  var authentication = new CAMSMFAAuthenticator();
1735
- var _d = useCredentialsHandler(function (state, data) { return __awaiter$1(void 0, void 0, void 0, function () {
1730
+ var _c = useCredentialsHandler(function (state, data) { return __awaiter$1(void 0, void 0, void 0, function () {
1736
1731
  return __generator$1(this, function (_a) {
1737
1732
  console.log(data);
1738
1733
  if (state && data && data.isValid) {
@@ -1756,7 +1751,7 @@ var DefaultLoginPage = function (_a) {
1756
1751
  }
1757
1752
  return [2 /*return*/];
1758
1753
  });
1759
- }); }), handleSubmitCredentials = _d.handleSubmitCredentials, isCredAuthLoading = _d.loading, setIsCredAuthLoading = _d.setLoading;
1754
+ }); }), handleSubmitCredentials = _c.handleSubmitCredentials, isCredAuthLoading = _c.loading, setIsCredAuthLoading = _c.setLoading;
1760
1755
  var handleMSALLogin = function () {
1761
1756
  if (typeof window !== "undefined" && !window.crypto) {
1762
1757
  toast.error("Crypto API not available. Please use a modern browser.");
@@ -1778,7 +1773,7 @@ var DefaultLoginPage = function (_a) {
1778
1773
  ? "Logging in..."
1779
1774
  : "Sign in with ActiveDirectory" })] })), usePassKey && (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 () {
1780
1775
  return authentication.HandleRegister(MFAEndpoints.RegisterNewChallenge, MFAEndpoints.RegisterVerify +
1781
- "?username=".concat(username), register, PassKeysRegisterProps);
1776
+ "?username=".concat(PassKeysRegisterProps.username), register, PassKeysRegisterProps);
1782
1777
  }, disabled: isLoading, children: [jsx(KeyIcon, { className: "text-[#506f4a]", size: 64 }), jsx("span", { children: "Create a Passkey" })] }))] }), jsxs(CardFooter, { className: "flex items-center justify-center mt-6 space-x-2 text-gray-400 text-sm", children: [jsx(ShieldCheck, { className: "w-4 h-4 text-[#506f4a] pulse-glow" }), jsx("span", { children: "Powered By NIBSS" })] })] }) }) }, "landing"), jsx(ADLoginModal, { open: showADModal, onOpenChange: setShowADModal, isLoading: isCredAuthLoading, setIsLoading: setIsCredAuthLoading, onLogin: function (_a) { return __awaiter$1(void 0, [_a], void 0, function (_b) {
1783
1778
  var username = _b.username, password = _b.password, MFACode = _b.MFACode;
1784
1779
  return __generator$1(this, function (_c) {