@nibssplc/cams-sdk-react 0.0.1-beta.27 → 0.0.1-beta.29
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,10 +1,8 @@
|
|
|
1
|
-
import { AccountInfo } from "@azure/msal-browser";
|
|
2
1
|
import { CAMSError } from "@nibssplc/cams-sdk";
|
|
3
2
|
export interface UseCAMSMSALAuthOptions {
|
|
4
3
|
onAuthSuccess?: (token: string) => void;
|
|
5
4
|
onAuthError?: (error: CAMSError) => void;
|
|
6
5
|
onTokenExpired?: () => void;
|
|
7
|
-
onMFARequired?: (msalToken: string, account: AccountInfo) => void;
|
|
8
6
|
scopes?: string[];
|
|
9
7
|
mfaUrl: string;
|
|
10
8
|
prompt?: string;
|
package/dist/index.cjs.js
CHANGED
|
@@ -16726,22 +16726,21 @@ function useCAMSMSALAuth(options) {
|
|
|
16726
16726
|
if (account && !isMFAPending) {
|
|
16727
16727
|
// Get token in foreground popup
|
|
16728
16728
|
instance
|
|
16729
|
-
.
|
|
16729
|
+
.acquireTokenPopup({
|
|
16730
16730
|
scopes: scopes,
|
|
16731
16731
|
account: account,
|
|
16732
|
-
prompt: options.prompt || "
|
|
16732
|
+
prompt: options.prompt || "login",
|
|
16733
16733
|
})
|
|
16734
16734
|
.then(function (response) {
|
|
16735
|
-
var _a
|
|
16735
|
+
var _a;
|
|
16736
16736
|
setToken(response.accessToken);
|
|
16737
16737
|
setAccessToken(response.accessToken);
|
|
16738
16738
|
setIdToken(response.idToken);
|
|
16739
16739
|
setIsMFAPending(true);
|
|
16740
|
-
(_a = options.onMFARequired) === null || _a === void 0 ? void 0 : _a.call(options, response.accessToken, account);
|
|
16741
16740
|
if (typeof window !== "undefined") {
|
|
16742
16741
|
window.location.href = options.mfaUrl;
|
|
16743
16742
|
}
|
|
16744
|
-
(
|
|
16743
|
+
(_a = options.onAuthSuccess) === null || _a === void 0 ? void 0 : _a.call(options, response.accessToken);
|
|
16745
16744
|
})
|
|
16746
16745
|
.catch(function (err) {
|
|
16747
16746
|
var _a;
|
|
@@ -16763,7 +16762,7 @@ function useCAMSMSALAuth(options) {
|
|
|
16763
16762
|
_d.trys.push([1, 3, , 8]);
|
|
16764
16763
|
return [4 /*yield*/, instance.loginPopup({
|
|
16765
16764
|
scopes: scopes,
|
|
16766
|
-
prompt: options.prompt || "
|
|
16765
|
+
prompt: options.prompt || "login",
|
|
16767
16766
|
})];
|
|
16768
16767
|
case 2:
|
|
16769
16768
|
_d.sent();
|
|
@@ -16777,7 +16776,7 @@ function useCAMSMSALAuth(options) {
|
|
|
16777
16776
|
_d.trys.push([4, 6, , 7]);
|
|
16778
16777
|
return [4 /*yield*/, instance.loginRedirect({
|
|
16779
16778
|
scopes: scopes,
|
|
16780
|
-
prompt: options.prompt || "
|
|
16779
|
+
prompt: options.prompt || "login",
|
|
16781
16780
|
})];
|
|
16782
16781
|
case 5:
|
|
16783
16782
|
_d.sent();
|