@nibssplc/cams-sdk-react 0.0.1-beta.23 → 0.0.1-beta.25
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,7 +1,7 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import { PublicClientApplication, Configuration } from '@azure/msal-browser';
|
|
3
3
|
export interface CAMSMSALProviderProps {
|
|
4
|
-
children: ReactNode;
|
|
4
|
+
children: React.ReactNode;
|
|
5
5
|
msalConfig: Configuration;
|
|
6
6
|
msalInstance?: PublicClientApplication;
|
|
7
7
|
}
|
|
@@ -12,7 +12,6 @@ export interface UseCAMSMSALAuthOptions {
|
|
|
12
12
|
export interface UseCAMSMSALAuthReturn {
|
|
13
13
|
login: () => Promise<void>;
|
|
14
14
|
logout: () => Promise<void>;
|
|
15
|
-
completeMFA: (mfaToken: string) => void;
|
|
16
15
|
isAuthenticated: boolean;
|
|
17
16
|
isLoading: boolean;
|
|
18
17
|
isMFAPending: boolean;
|
package/dist/index.cjs.js
CHANGED
|
@@ -16730,6 +16730,7 @@ function useCAMSMSALAuth(options) {
|
|
|
16730
16730
|
})
|
|
16731
16731
|
.then(function (response) {
|
|
16732
16732
|
var _a, _b;
|
|
16733
|
+
setToken(response.accessToken);
|
|
16733
16734
|
if (options.mfaUrl) {
|
|
16734
16735
|
setIsMFAPending(true);
|
|
16735
16736
|
(_a = options.onMFARequired) === null || _a === void 0 ? void 0 : _a.call(options, response.accessToken, account);
|
|
@@ -16738,7 +16739,6 @@ function useCAMSMSALAuth(options) {
|
|
|
16738
16739
|
}
|
|
16739
16740
|
}
|
|
16740
16741
|
else {
|
|
16741
|
-
setToken(response.accessToken);
|
|
16742
16742
|
setProfile({
|
|
16743
16743
|
type: "AUTH_SUCCESS",
|
|
16744
16744
|
userProfile: {
|
|
@@ -16834,33 +16834,9 @@ function useCAMSMSALAuth(options) {
|
|
|
16834
16834
|
}
|
|
16835
16835
|
});
|
|
16836
16836
|
}); }, [instance]);
|
|
16837
|
-
var completeMFA = React__default.useCallback(function (mfaToken) {
|
|
16838
|
-
var _a;
|
|
16839
|
-
setToken(mfaToken);
|
|
16840
|
-
setIsMFAPending(false);
|
|
16841
|
-
if (account) {
|
|
16842
|
-
setProfile({
|
|
16843
|
-
type: "AUTH_SUCCESS",
|
|
16844
|
-
userProfile: {
|
|
16845
|
-
name: account.name || "",
|
|
16846
|
-
email: account.username || "",
|
|
16847
|
-
isAuthenticated: true,
|
|
16848
|
-
mfaIsEnabled: true,
|
|
16849
|
-
message: "Authentication successful",
|
|
16850
|
-
userType: "USER",
|
|
16851
|
-
tokens: {
|
|
16852
|
-
Nonce: "",
|
|
16853
|
-
Bearer: token !== null && token !== void 0 ? token : "",
|
|
16854
|
-
},
|
|
16855
|
-
},
|
|
16856
|
-
});
|
|
16857
|
-
}
|
|
16858
|
-
(_a = options.onAuthSuccess) === null || _a === void 0 ? void 0 : _a.call(options, mfaToken);
|
|
16859
|
-
}, [account, options]);
|
|
16860
16837
|
return {
|
|
16861
16838
|
login: login,
|
|
16862
16839
|
logout: logout,
|
|
16863
|
-
completeMFA: completeMFA,
|
|
16864
16840
|
isAuthenticated: isAuthenticated,
|
|
16865
16841
|
isLoading: isLoading,
|
|
16866
16842
|
isMFAPending: isMFAPending,
|