@nibssplc/cams-sdk-react 1.0.0-rc.76 → 1.0.0-rc.78
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.cjs.js +11 -3
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +11 -3
- package/dist/index.esm.js.map +1 -1
- package/package.json +2 -2
package/dist/index.esm.js
CHANGED
|
@@ -4,6 +4,7 @@ import { CAMSSessionManager, isPopupWindow, Logger, CAMSError, CAMSErrorType, CA
|
|
|
4
4
|
export * from '@nibssplc/cams-sdk';
|
|
5
5
|
import { useMsal, useAccount, MsalProvider } from '@azure/msal-react';
|
|
6
6
|
import { InteractionStatus, PublicClientApplication } from '@azure/msal-browser';
|
|
7
|
+
import { toast } from 'sonner';
|
|
7
8
|
import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
|
|
8
9
|
import z$1, { z } from 'zod';
|
|
9
10
|
import { OTPInput, OTPInputContext, REGEXP_ONLY_DIGITS } from 'input-otp';
|
|
@@ -16,7 +17,6 @@ import { Slot } from '@radix-ui/react-slot';
|
|
|
16
17
|
import * as LabelPrimitive from '@radix-ui/react-label';
|
|
17
18
|
import { cva } from 'class-variance-authority';
|
|
18
19
|
import * as DialogPrimitive from '@radix-ui/react-dialog';
|
|
19
|
-
import { toast } from 'sonner';
|
|
20
20
|
import { motion } from 'framer-motion';
|
|
21
21
|
|
|
22
22
|
/******************************************************************************
|
|
@@ -466,7 +466,7 @@ function useCAMSMSALAuth(options) {
|
|
|
466
466
|
}
|
|
467
467
|
}, [accessToken, account, instance, options.storageKey]);
|
|
468
468
|
var login = useCallback(function () { return __awaiter$1(_this, void 0, void 0, function () {
|
|
469
|
-
var response, mfaConfig, authenticator, userConfig, err_1, camsError_1, camsError;
|
|
469
|
+
var response, mfaConfig, authenticator, userConfig, camsError, err_1, camsError_1, camsError;
|
|
470
470
|
var _a;
|
|
471
471
|
return __generator$1(this, function (_b) {
|
|
472
472
|
switch (_b.label) {
|
|
@@ -495,7 +495,10 @@ function useCAMSMSALAuth(options) {
|
|
|
495
495
|
return [4 /*yield*/, authenticator.GetUserMFAConfig(mfaConfig)];
|
|
496
496
|
case 3:
|
|
497
497
|
userConfig = _b.sent();
|
|
498
|
-
|
|
498
|
+
console.log("CAMS MFA Authenticator initialized:", {
|
|
499
|
+
mfaConfig: mfaConfig,
|
|
500
|
+
userConfig: userConfig,
|
|
501
|
+
});
|
|
499
502
|
// Don't persist as authenticated until MFA is complete
|
|
500
503
|
if (typeof window !== "undefined" && userConfig.isValid) {
|
|
501
504
|
setAccessToken(response.accessToken);
|
|
@@ -509,6 +512,11 @@ function useCAMSMSALAuth(options) {
|
|
|
509
512
|
setEmail(userConfig.userInfo.email);
|
|
510
513
|
setRequiresMFA(userConfig.userInfo.isMFAEnabled);
|
|
511
514
|
}
|
|
515
|
+
else {
|
|
516
|
+
camsError = new CAMSError(CAMSErrorType.API_VALIDATION_ERROR, "Login failed: " + userConfig.message);
|
|
517
|
+
toast.error("Login failed: " + userConfig.message);
|
|
518
|
+
setError(camsError);
|
|
519
|
+
}
|
|
512
520
|
return [3 /*break*/, 5];
|
|
513
521
|
case 4:
|
|
514
522
|
err_1 = _b.sent();
|