@nibssplc/cams-sdk-react 1.0.0-rc.48 → 1.0.0-rc.49

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
@@ -2389,7 +2389,7 @@ var MFAGate = function (_a) {
2389
2389
  // loginComponent: LoginComponent = DefaultLoginPage,
2390
2390
  _c = _a.usePassKey,
2391
2391
  // loginComponent: LoginComponent = DefaultLoginPage,
2392
- usePassKey = _c === void 0 ? false : _c, _d = _a.useADLogin, useADLogin = _d === void 0 ? false : _d, CredentialsAuthEndpoint = _a.CredentialsAuthEndpoint, PassKeysRegisterProps = _a.PassKeysRegisterProps, MFAEndpoints = _a.MFAEndpoints, requiresMFA = _a.requiresMFA;
2392
+ usePassKey = _c === void 0 ? false : _c, _d = _a.useADLogin, useADLogin = _d === void 0 ? false : _d, CredentialsAuthEndpoint = _a.CredentialsAuthEndpoint, PassKeysRegisterProps = _a.PassKeysRegisterProps, MFAEndpoints = _a.MFAEndpoints, requiresMFA = _a.requiresMFA, onAuthSuccess = _a.onAuthSuccess, onAuthError = _a.onAuthError;
2393
2393
  var context = useCAMSContext();
2394
2394
  var validatedMFAEndpoints = useMemo(function () {
2395
2395
  var parsed = MFAEndpointsSchema.safeParse(MFAEndpoints);
@@ -2402,21 +2402,24 @@ var MFAGate = function (_a) {
2402
2402
  var handleComplete = useCallback(function (success) {
2403
2403
  var _a;
2404
2404
  if (success && context.authMode === "MSAL") {
2405
- (_a = context.onAuthSuccess) === null || _a === void 0 ? void 0 : _a.call(context, {
2405
+ var tokens = {
2406
2406
  accessToken: context.accessToken,
2407
2407
  idToken: context.idToken,
2408
- });
2408
+ };
2409
+ onAuthSuccess === null || onAuthSuccess === void 0 ? void 0 : onAuthSuccess(tokens);
2410
+ (_a = context.onAuthSuccess) === null || _a === void 0 ? void 0 : _a.call(context, tokens);
2409
2411
  }
2410
2412
  else if (!success) {
2411
2413
  Logger.error("MFA authentication failed");
2412
2414
  }
2413
- }, [context]);
2415
+ }, [context, onAuthSuccess]);
2414
2416
  var handleAuthFailed = useCallback(function () { return __awaiter$1(void 0, void 0, void 0, function () {
2415
2417
  var _a;
2416
2418
  return __generator$1(this, function (_b) {
2417
2419
  switch (_b.label) {
2418
2420
  case 0:
2419
2421
  if (context.authMode === "MSAL" && context.error) {
2422
+ onAuthError === null || onAuthError === void 0 ? void 0 : onAuthError(context.error);
2420
2423
  (_a = context.onAuthError) === null || _a === void 0 ? void 0 : _a.call(context, context.error);
2421
2424
  }
2422
2425
  return [4 /*yield*/, context.logout()];
@@ -2425,7 +2428,7 @@ var MFAGate = function (_a) {
2425
2428
  return [2 /*return*/];
2426
2429
  }
2427
2430
  });
2428
- }); }, [context]);
2431
+ }); }, [context, onAuthError]);
2429
2432
  if (useADLogin && !CredentialsAuthEndpoint)
2430
2433
  return jsxRuntimeExports.jsx(ErrorFallback, { message: "Invalid AD Login Configuration." });
2431
2434
  if (!validatedMFAEndpoints)