@azure/msal-react 2.0.22 → 2.1.1
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/MsalContext.d.ts +10 -10
- package/dist/MsalContext.js +16 -16
- package/dist/MsalProvider.d.ts +9 -9
- package/dist/MsalProvider.js +136 -136
- package/dist/components/AuthenticatedTemplate.d.ts +8 -8
- package/dist/components/AuthenticatedTemplate.js +23 -23
- package/dist/components/MsalAuthenticationTemplate.d.ts +16 -16
- package/dist/components/MsalAuthenticationTemplate.js +33 -33
- package/dist/components/UnauthenticatedTemplate.d.ts +8 -8
- package/dist/components/UnauthenticatedTemplate.js +25 -25
- package/dist/components/withMsal.d.ts +11 -11
- package/dist/components/withMsal.js +17 -17
- package/dist/error/ReactAuthError.d.ts +16 -16
- package/dist/error/ReactAuthError.js +27 -27
- package/dist/hooks/useAccount.d.ts +7 -7
- package/dist/hooks/useAccount.js +33 -33
- package/dist/hooks/useIsAuthenticated.d.ts +6 -6
- package/dist/hooks/useIsAuthenticated.js +27 -27
- package/dist/hooks/useMsal.d.ts +5 -5
- package/dist/hooks/useMsal.js +8 -8
- package/dist/hooks/useMsalAuthentication.d.ts +18 -18
- package/dist/hooks/useMsalAuthentication.js +184 -184
- package/dist/index.d.ts +24 -24
- package/dist/index.js +1 -1
- package/dist/packageMetadata.d.ts +2 -2
- package/dist/packageMetadata.js +4 -4
- package/dist/types/AccountIdentifiers.d.ts +2 -2
- package/dist/utils/utilities.d.ts +17 -17
- package/dist/utils/utilities.js +60 -60
- package/lib/msal-react.cjs +644 -0
- package/lib/msal-react.cjs.map +1 -0
- package/lib/package.json +1 -0
- package/lib/types/MsalContext.d.ts +10 -0
- package/lib/types/MsalProvider.d.ts +9 -0
- package/lib/types/components/AuthenticatedTemplate.d.ts +8 -0
- package/lib/types/components/MsalAuthenticationTemplate.d.ts +16 -0
- package/lib/types/components/UnauthenticatedTemplate.d.ts +8 -0
- package/lib/types/components/withMsal.d.ts +11 -0
- package/lib/types/error/ReactAuthError.d.ts +16 -0
- package/lib/types/hooks/useAccount.d.ts +7 -0
- package/lib/types/hooks/useIsAuthenticated.d.ts +6 -0
- package/lib/types/hooks/useMsal.d.ts +5 -0
- package/lib/types/hooks/useMsalAuthentication.d.ts +18 -0
- package/lib/types/index.d.ts +24 -0
- package/lib/types/packageMetadata.d.ts +2 -0
- package/lib/types/types/AccountIdentifiers.d.ts +2 -0
- package/lib/types/utils/utilities.d.ts +17 -0
- package/package.json +14 -5
- package/src/MsalProvider.tsx +3 -3
- package/src/components/AuthenticatedTemplate.tsx +4 -4
- package/src/components/MsalAuthenticationTemplate.tsx +6 -6
- package/src/components/UnauthenticatedTemplate.tsx +4 -4
- package/src/components/withMsal.tsx +3 -3
- package/src/hooks/useAccount.ts +3 -3
- package/src/hooks/useIsAuthenticated.ts +3 -3
- package/src/hooks/useMsal.ts +1 -1
- package/src/hooks/useMsalAuthentication.ts +5 -5
- package/src/index.ts +20 -20
- package/src/packageMetadata.ts +1 -1
- package/src/utils/utilities.ts +1 -1
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React, { PropsWithChildren } from "react";
|
|
2
|
+
import { IPublicClientApplication } from "@azure/msal-browser";
|
|
3
|
+
export type MsalProviderProps = PropsWithChildren<{
|
|
4
|
+
instance: IPublicClientApplication;
|
|
5
|
+
}>;
|
|
6
|
+
/**
|
|
7
|
+
* MSAL context provider component. This must be rendered above any other components that use MSAL.
|
|
8
|
+
*/
|
|
9
|
+
export declare function MsalProvider({ instance, children, }: MsalProviderProps): React.ReactElement;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React, { PropsWithChildren } from "react";
|
|
2
|
+
import { AccountIdentifiers } from "../types/AccountIdentifiers.js";
|
|
3
|
+
export type AuthenticatedTemplateProps = PropsWithChildren<AccountIdentifiers>;
|
|
4
|
+
/**
|
|
5
|
+
* Renders child components if user is authenticated
|
|
6
|
+
* @param props
|
|
7
|
+
*/
|
|
8
|
+
export declare function AuthenticatedTemplate({ username, homeAccountId, localAccountId, children, }: AuthenticatedTemplateProps): React.ReactElement | null;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React, { PropsWithChildren } from "react";
|
|
2
|
+
import { AccountIdentifiers } from "../types/AccountIdentifiers.js";
|
|
3
|
+
import { MsalAuthenticationResult } from "../hooks/useMsalAuthentication.js";
|
|
4
|
+
import { InteractionType, PopupRequest, RedirectRequest, SsoSilentRequest } from "@azure/msal-browser";
|
|
5
|
+
import { IMsalContext } from "../MsalContext.js";
|
|
6
|
+
export type MsalAuthenticationProps = PropsWithChildren<AccountIdentifiers & {
|
|
7
|
+
interactionType: InteractionType;
|
|
8
|
+
authenticationRequest?: PopupRequest | RedirectRequest | SsoSilentRequest;
|
|
9
|
+
loadingComponent?: React.ElementType<IMsalContext>;
|
|
10
|
+
errorComponent?: React.ElementType<MsalAuthenticationResult>;
|
|
11
|
+
}>;
|
|
12
|
+
/**
|
|
13
|
+
* Attempts to authenticate user if not already authenticated, then renders child components
|
|
14
|
+
* @param props
|
|
15
|
+
*/
|
|
16
|
+
export declare function MsalAuthenticationTemplate({ interactionType, username, homeAccountId, localAccountId, authenticationRequest, loadingComponent: LoadingComponent, errorComponent: ErrorComponent, children, }: MsalAuthenticationProps): React.ReactElement | null;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React, { PropsWithChildren } from "react";
|
|
2
|
+
import { AccountIdentifiers } from "../types/AccountIdentifiers.js";
|
|
3
|
+
export type UnauthenticatedTemplateProps = PropsWithChildren<AccountIdentifiers>;
|
|
4
|
+
/**
|
|
5
|
+
* Renders child components if user is unauthenticated
|
|
6
|
+
* @param props
|
|
7
|
+
*/
|
|
8
|
+
export declare function UnauthenticatedTemplate({ username, homeAccountId, localAccountId, children, }: UnauthenticatedTemplateProps): React.ReactElement | null;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { IMsalContext } from "../MsalContext.js";
|
|
3
|
+
import { Subtract } from "../utils/utilities.js";
|
|
4
|
+
export type WithMsalProps = {
|
|
5
|
+
msalContext: IMsalContext;
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* Higher order component wraps provided component with msal by injecting msal context values into the component's props
|
|
9
|
+
* @param Component
|
|
10
|
+
*/
|
|
11
|
+
export declare const withMsal: <P extends WithMsalProps>(Component: React.ComponentType<P>) => React.FunctionComponent<Subtract<P, WithMsalProps>>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { AuthError } from "@azure/msal-browser";
|
|
2
|
+
export declare const ReactAuthErrorMessage: {
|
|
3
|
+
invalidInteractionType: {
|
|
4
|
+
code: string;
|
|
5
|
+
desc: string;
|
|
6
|
+
};
|
|
7
|
+
unableToFallbackToInteraction: {
|
|
8
|
+
code: string;
|
|
9
|
+
desc: string;
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
export declare class ReactAuthError extends AuthError {
|
|
13
|
+
constructor(errorCode: string, errorMessage?: string);
|
|
14
|
+
static createInvalidInteractionTypeError(): ReactAuthError;
|
|
15
|
+
static createUnableToFallbackToInteractionError(): ReactAuthError;
|
|
16
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { AccountInfo } from "@azure/msal-browser";
|
|
2
|
+
import { AccountIdentifiers } from "../types/AccountIdentifiers.js";
|
|
3
|
+
/**
|
|
4
|
+
* Given 1 or more accountIdentifiers, returns the Account object if the user is signed-in
|
|
5
|
+
* @param accountIdentifiers
|
|
6
|
+
*/
|
|
7
|
+
export declare function useAccount(accountIdentifiers?: AccountIdentifiers): AccountInfo | null;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { AccountIdentifiers } from "../types/AccountIdentifiers.js";
|
|
2
|
+
/**
|
|
3
|
+
* Returns whether or not a user is currently signed-in. Optionally provide 1 or more accountIdentifiers to determine if a specific user is signed-in
|
|
4
|
+
* @param matchAccount
|
|
5
|
+
*/
|
|
6
|
+
export declare function useIsAuthenticated(matchAccount?: AccountIdentifiers): boolean;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { PopupRequest, RedirectRequest, SsoSilentRequest, InteractionType, AuthenticationResult, AuthError, SilentRequest } from "@azure/msal-browser";
|
|
2
|
+
import { AccountIdentifiers } from "../types/AccountIdentifiers.js";
|
|
3
|
+
export type MsalAuthenticationResult = {
|
|
4
|
+
login: (callbackInteractionType?: InteractionType | undefined, callbackRequest?: PopupRequest | RedirectRequest | SilentRequest) => Promise<AuthenticationResult | null>;
|
|
5
|
+
acquireToken: (callbackInteractionType?: InteractionType | undefined, callbackRequest?: SilentRequest | undefined) => Promise<AuthenticationResult | null>;
|
|
6
|
+
result: AuthenticationResult | null;
|
|
7
|
+
error: AuthError | null;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* If a user is not currently signed in this hook invokes a login. Failed logins can be retried using the login callback returned.
|
|
11
|
+
* If a user is currently signed in this hook attempts to acquire a token. Subsequent token requests can use the acquireToken callback returned.
|
|
12
|
+
* Optionally provide a request object to be used in the login/acquireToken call.
|
|
13
|
+
* Optionally provide a specific user that should be logged in.
|
|
14
|
+
* @param interactionType
|
|
15
|
+
* @param authenticationRequest
|
|
16
|
+
* @param accountIdentifiers
|
|
17
|
+
*/
|
|
18
|
+
export declare function useMsalAuthentication(interactionType: InteractionType, authenticationRequest?: PopupRequest | RedirectRequest | SsoSilentRequest, accountIdentifiers?: AccountIdentifiers): MsalAuthenticationResult;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @packageDocumentation
|
|
3
|
+
* @module @azure/msal-react
|
|
4
|
+
*/
|
|
5
|
+
export type { IMsalContext } from "./MsalContext.js";
|
|
6
|
+
export type { MsalProviderProps } from "./MsalProvider.js";
|
|
7
|
+
export type { MsalAuthenticationResult } from "./hooks/useMsalAuthentication.js";
|
|
8
|
+
export type { MsalAuthenticationProps } from "./components/MsalAuthenticationTemplate.js";
|
|
9
|
+
export type { AuthenticatedTemplateProps } from "./components/AuthenticatedTemplate.js";
|
|
10
|
+
export type { UnauthenticatedTemplateProps } from "./components/UnauthenticatedTemplate.js";
|
|
11
|
+
export type { WithMsalProps } from "./components/withMsal.js";
|
|
12
|
+
export type { AccountIdentifiers } from "./types/AccountIdentifiers.js";
|
|
13
|
+
export { MsalContext, MsalConsumer } from "./MsalContext.js";
|
|
14
|
+
export { MsalProvider } from "./MsalProvider.js";
|
|
15
|
+
export { AuthenticatedTemplate } from "./components/AuthenticatedTemplate.js";
|
|
16
|
+
export { UnauthenticatedTemplate } from "./components/UnauthenticatedTemplate.js";
|
|
17
|
+
export { MsalAuthenticationTemplate } from "./components/MsalAuthenticationTemplate.js";
|
|
18
|
+
export { withMsal } from "./components/withMsal.js";
|
|
19
|
+
export { Subtract, SetComplement, SetDifference } from "./utils/utilities.js";
|
|
20
|
+
export { useMsal } from "./hooks/useMsal.js";
|
|
21
|
+
export { useAccount } from "./hooks/useAccount.js";
|
|
22
|
+
export { useIsAuthenticated } from "./hooks/useIsAuthenticated.js";
|
|
23
|
+
export { useMsalAuthentication } from "./hooks/useMsalAuthentication.js";
|
|
24
|
+
export { version } from "./packageMetadata.js";
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { AccountIdentifiers } from "../types/AccountIdentifiers.js";
|
|
3
|
+
import { AccountInfo } from "@azure/msal-browser";
|
|
4
|
+
type FaaCFunction = <T>(args: T) => React.ReactNode;
|
|
5
|
+
export declare function getChildrenOrFunction<T>(children: React.ReactNode | FaaCFunction, args: T): React.ReactNode;
|
|
6
|
+
export type SetDifference<A, B> = A extends B ? never : A;
|
|
7
|
+
export type SetComplement<A, A1 extends A> = SetDifference<A, A1>;
|
|
8
|
+
export type Subtract<T extends T1, T1 extends object> = Pick<T, SetComplement<keyof T, keyof T1>>;
|
|
9
|
+
/**
|
|
10
|
+
* Helper function to determine whether 2 arrays are equal
|
|
11
|
+
* Used to avoid unnecessary state updates
|
|
12
|
+
* @param arrayA
|
|
13
|
+
* @param arrayB
|
|
14
|
+
*/
|
|
15
|
+
export declare function accountArraysAreEqual(arrayA: Array<AccountIdentifiers>, arrayB: Array<AccountIdentifiers>): boolean;
|
|
16
|
+
export declare function getAccountByIdentifiers(allAccounts: AccountInfo[], accountIdentifiers: AccountIdentifiers): AccountInfo | null;
|
|
17
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@azure/msal-react",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.1.1",
|
|
4
4
|
"author": {
|
|
5
5
|
"name": "Microsoft",
|
|
6
6
|
"email": "nugetaad@microsoft.com",
|
|
@@ -15,15 +15,23 @@
|
|
|
15
15
|
"type": "module",
|
|
16
16
|
"module": "dist/index.js",
|
|
17
17
|
"types": "dist/index.d.ts",
|
|
18
|
+
"main": "lib/msal-react.cjs",
|
|
18
19
|
"exports": {
|
|
19
20
|
".": {
|
|
20
|
-
"
|
|
21
|
-
|
|
21
|
+
"import": {
|
|
22
|
+
"types": "./dist/index.d.ts",
|
|
23
|
+
"default": "./dist/index.js"
|
|
24
|
+
},
|
|
25
|
+
"require": {
|
|
26
|
+
"types": "./lib/types/index.d.ts",
|
|
27
|
+
"default": "./lib/msal-react.cjs"
|
|
28
|
+
}
|
|
22
29
|
},
|
|
23
30
|
"./package.json": "./package.json"
|
|
24
31
|
},
|
|
25
32
|
"files": [
|
|
26
33
|
"dist",
|
|
34
|
+
"lib",
|
|
27
35
|
"src"
|
|
28
36
|
],
|
|
29
37
|
"engines": {
|
|
@@ -48,11 +56,11 @@
|
|
|
48
56
|
"apiExtractor": "api-extractor run"
|
|
49
57
|
},
|
|
50
58
|
"peerDependencies": {
|
|
51
|
-
"@azure/msal-browser": "^3.
|
|
59
|
+
"@azure/msal-browser": "^3.25.0",
|
|
52
60
|
"react": "^16.8.0 || ^17 || ^18"
|
|
53
61
|
},
|
|
54
62
|
"devDependencies": {
|
|
55
|
-
"@azure/msal-browser": "^3.
|
|
63
|
+
"@azure/msal-browser": "^3.25.0",
|
|
56
64
|
"@microsoft/api-extractor": "^7.43.4",
|
|
57
65
|
"@rollup/plugin-typescript": "^11.1.5",
|
|
58
66
|
"@testing-library/jest-dom": "^5.11.5",
|
|
@@ -69,6 +77,7 @@
|
|
|
69
77
|
"react-dom": "^18.2.0",
|
|
70
78
|
"rollup": "^4.9.6",
|
|
71
79
|
"ts-jest": "^29.1.0",
|
|
80
|
+
"ts-jest-resolver": "^2.0.1",
|
|
72
81
|
"tslib": "^2.0.0",
|
|
73
82
|
"typescript": "^4.9.5"
|
|
74
83
|
}
|
package/src/MsalProvider.tsx
CHANGED
|
@@ -18,9 +18,9 @@ import {
|
|
|
18
18
|
WrapperSKU,
|
|
19
19
|
AccountInfo,
|
|
20
20
|
} from "@azure/msal-browser";
|
|
21
|
-
import { MsalContext, IMsalContext } from "./MsalContext";
|
|
22
|
-
import { accountArraysAreEqual } from "./utils/utilities";
|
|
23
|
-
import { name as SKU, version } from "./packageMetadata";
|
|
21
|
+
import { MsalContext, IMsalContext } from "./MsalContext.js";
|
|
22
|
+
import { accountArraysAreEqual } from "./utils/utilities.js";
|
|
23
|
+
import { name as SKU, version } from "./packageMetadata.js";
|
|
24
24
|
|
|
25
25
|
export type MsalProviderProps = PropsWithChildren<{
|
|
26
26
|
instance: IPublicClientApplication;
|
|
@@ -4,10 +4,10 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import React, { PropsWithChildren, useMemo } from "react";
|
|
7
|
-
import { AccountIdentifiers } from "../types/AccountIdentifiers";
|
|
8
|
-
import { getChildrenOrFunction } from "../utils/utilities";
|
|
9
|
-
import { useMsal } from "../hooks/useMsal";
|
|
10
|
-
import { useIsAuthenticated } from "../hooks/useIsAuthenticated";
|
|
7
|
+
import { AccountIdentifiers } from "../types/AccountIdentifiers.js";
|
|
8
|
+
import { getChildrenOrFunction } from "../utils/utilities.js";
|
|
9
|
+
import { useMsal } from "../hooks/useMsal.js";
|
|
10
|
+
import { useIsAuthenticated } from "../hooks/useIsAuthenticated.js";
|
|
11
11
|
import { InteractionStatus } from "@azure/msal-browser";
|
|
12
12
|
|
|
13
13
|
export type AuthenticatedTemplateProps = PropsWithChildren<AccountIdentifiers>;
|
|
@@ -4,14 +4,14 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import React, { PropsWithChildren, useMemo } from "react";
|
|
7
|
-
import { AccountIdentifiers } from "../types/AccountIdentifiers";
|
|
8
|
-
import { getChildrenOrFunction } from "../utils/utilities";
|
|
9
|
-
import { useMsal } from "../hooks/useMsal";
|
|
7
|
+
import { AccountIdentifiers } from "../types/AccountIdentifiers.js";
|
|
8
|
+
import { getChildrenOrFunction } from "../utils/utilities.js";
|
|
9
|
+
import { useMsal } from "../hooks/useMsal.js";
|
|
10
10
|
import {
|
|
11
11
|
MsalAuthenticationResult,
|
|
12
12
|
useMsalAuthentication,
|
|
13
|
-
} from "../hooks/useMsalAuthentication";
|
|
14
|
-
import { useIsAuthenticated } from "../hooks/useIsAuthenticated";
|
|
13
|
+
} from "../hooks/useMsalAuthentication.js";
|
|
14
|
+
import { useIsAuthenticated } from "../hooks/useIsAuthenticated.js";
|
|
15
15
|
import {
|
|
16
16
|
InteractionType,
|
|
17
17
|
PopupRequest,
|
|
@@ -19,7 +19,7 @@ import {
|
|
|
19
19
|
SsoSilentRequest,
|
|
20
20
|
InteractionStatus,
|
|
21
21
|
} from "@azure/msal-browser";
|
|
22
|
-
import { IMsalContext } from "../MsalContext";
|
|
22
|
+
import { IMsalContext } from "../MsalContext.js";
|
|
23
23
|
|
|
24
24
|
export type MsalAuthenticationProps = PropsWithChildren<
|
|
25
25
|
AccountIdentifiers & {
|
|
@@ -4,10 +4,10 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import React, { PropsWithChildren, useMemo } from "react";
|
|
7
|
-
import { useMsal } from "../hooks/useMsal";
|
|
8
|
-
import { useIsAuthenticated } from "../hooks/useIsAuthenticated";
|
|
9
|
-
import { getChildrenOrFunction } from "../utils/utilities";
|
|
10
|
-
import { AccountIdentifiers } from "../types/AccountIdentifiers";
|
|
7
|
+
import { useMsal } from "../hooks/useMsal.js";
|
|
8
|
+
import { useIsAuthenticated } from "../hooks/useIsAuthenticated.js";
|
|
9
|
+
import { getChildrenOrFunction } from "../utils/utilities.js";
|
|
10
|
+
import { AccountIdentifiers } from "../types/AccountIdentifiers.js";
|
|
11
11
|
import { InteractionStatus } from "@azure/msal-browser";
|
|
12
12
|
|
|
13
13
|
export type UnauthenticatedTemplateProps =
|
|
@@ -4,9 +4,9 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import React from "react";
|
|
7
|
-
import { IMsalContext } from "../MsalContext";
|
|
8
|
-
import { useMsal } from "../hooks/useMsal";
|
|
9
|
-
import { Subtract } from "../utils/utilities";
|
|
7
|
+
import { IMsalContext } from "../MsalContext.js";
|
|
8
|
+
import { useMsal } from "../hooks/useMsal.js";
|
|
9
|
+
import { Subtract } from "../utils/utilities.js";
|
|
10
10
|
|
|
11
11
|
export type WithMsalProps = {
|
|
12
12
|
msalContext: IMsalContext;
|
package/src/hooks/useAccount.ts
CHANGED
|
@@ -9,9 +9,9 @@ import {
|
|
|
9
9
|
IPublicClientApplication,
|
|
10
10
|
AccountEntity,
|
|
11
11
|
} from "@azure/msal-browser";
|
|
12
|
-
import { useMsal } from "./useMsal";
|
|
13
|
-
import { AccountIdentifiers } from "../types/AccountIdentifiers";
|
|
14
|
-
import { getAccountByIdentifiers } from "../utils/utilities";
|
|
12
|
+
import { useMsal } from "./useMsal.js";
|
|
13
|
+
import { AccountIdentifiers } from "../types/AccountIdentifiers.js";
|
|
14
|
+
import { getAccountByIdentifiers } from "../utils/utilities.js";
|
|
15
15
|
|
|
16
16
|
function getAccount(
|
|
17
17
|
instance: IPublicClientApplication,
|
|
@@ -4,10 +4,10 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import { useMemo } from "react";
|
|
7
|
-
import { useMsal } from "./useMsal";
|
|
8
|
-
import { AccountIdentifiers } from "../types/AccountIdentifiers";
|
|
7
|
+
import { useMsal } from "./useMsal.js";
|
|
8
|
+
import { AccountIdentifiers } from "../types/AccountIdentifiers.js";
|
|
9
9
|
import { AccountInfo, InteractionStatus } from "@azure/msal-browser";
|
|
10
|
-
import { getAccountByIdentifiers } from "../utils/utilities";
|
|
10
|
+
import { getAccountByIdentifiers } from "../utils/utilities.js";
|
|
11
11
|
|
|
12
12
|
function isAuthenticated(
|
|
13
13
|
allAccounts: AccountInfo[],
|
package/src/hooks/useMsal.ts
CHANGED
|
@@ -18,11 +18,11 @@ import {
|
|
|
18
18
|
InteractionRequiredAuthError,
|
|
19
19
|
OIDC_DEFAULT_SCOPES,
|
|
20
20
|
} from "@azure/msal-browser";
|
|
21
|
-
import { useIsAuthenticated } from "./useIsAuthenticated";
|
|
22
|
-
import { AccountIdentifiers } from "../types/AccountIdentifiers";
|
|
23
|
-
import { useMsal } from "./useMsal";
|
|
24
|
-
import { useAccount } from "./useAccount";
|
|
25
|
-
import { ReactAuthError } from "../error/ReactAuthError";
|
|
21
|
+
import { useIsAuthenticated } from "./useIsAuthenticated.js";
|
|
22
|
+
import { AccountIdentifiers } from "../types/AccountIdentifiers.js";
|
|
23
|
+
import { useMsal } from "./useMsal.js";
|
|
24
|
+
import { useAccount } from "./useAccount.js";
|
|
25
|
+
import { ReactAuthError } from "../error/ReactAuthError.js";
|
|
26
26
|
|
|
27
27
|
export type MsalAuthenticationResult = {
|
|
28
28
|
login: (
|
package/src/index.ts
CHANGED
|
@@ -8,28 +8,28 @@
|
|
|
8
8
|
* @module @azure/msal-react
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
-
export type { IMsalContext } from "./MsalContext";
|
|
12
|
-
export type { MsalProviderProps } from "./MsalProvider";
|
|
13
|
-
export type { MsalAuthenticationResult } from "./hooks/useMsalAuthentication";
|
|
14
|
-
export type { MsalAuthenticationProps } from "./components/MsalAuthenticationTemplate";
|
|
15
|
-
export type { AuthenticatedTemplateProps } from "./components/AuthenticatedTemplate";
|
|
16
|
-
export type { UnauthenticatedTemplateProps } from "./components/UnauthenticatedTemplate";
|
|
17
|
-
export type { WithMsalProps } from "./components/withMsal";
|
|
18
|
-
export type { AccountIdentifiers } from "./types/AccountIdentifiers";
|
|
11
|
+
export type { IMsalContext } from "./MsalContext.js";
|
|
12
|
+
export type { MsalProviderProps } from "./MsalProvider.js";
|
|
13
|
+
export type { MsalAuthenticationResult } from "./hooks/useMsalAuthentication.js";
|
|
14
|
+
export type { MsalAuthenticationProps } from "./components/MsalAuthenticationTemplate.js";
|
|
15
|
+
export type { AuthenticatedTemplateProps } from "./components/AuthenticatedTemplate.js";
|
|
16
|
+
export type { UnauthenticatedTemplateProps } from "./components/UnauthenticatedTemplate.js";
|
|
17
|
+
export type { WithMsalProps } from "./components/withMsal.js";
|
|
18
|
+
export type { AccountIdentifiers } from "./types/AccountIdentifiers.js";
|
|
19
19
|
|
|
20
|
-
export { MsalContext, MsalConsumer } from "./MsalContext";
|
|
21
|
-
export { MsalProvider } from "./MsalProvider";
|
|
20
|
+
export { MsalContext, MsalConsumer } from "./MsalContext.js";
|
|
21
|
+
export { MsalProvider } from "./MsalProvider.js";
|
|
22
22
|
|
|
23
|
-
export { AuthenticatedTemplate } from "./components/AuthenticatedTemplate";
|
|
24
|
-
export { UnauthenticatedTemplate } from "./components/UnauthenticatedTemplate";
|
|
25
|
-
export { MsalAuthenticationTemplate } from "./components/MsalAuthenticationTemplate";
|
|
23
|
+
export { AuthenticatedTemplate } from "./components/AuthenticatedTemplate.js";
|
|
24
|
+
export { UnauthenticatedTemplate } from "./components/UnauthenticatedTemplate.js";
|
|
25
|
+
export { MsalAuthenticationTemplate } from "./components/MsalAuthenticationTemplate.js";
|
|
26
26
|
|
|
27
|
-
export { withMsal } from "./components/withMsal";
|
|
28
|
-
export { Subtract, SetComplement, SetDifference } from "./utils/utilities";
|
|
27
|
+
export { withMsal } from "./components/withMsal.js";
|
|
28
|
+
export { Subtract, SetComplement, SetDifference } from "./utils/utilities.js";
|
|
29
29
|
|
|
30
|
-
export { useMsal } from "./hooks/useMsal";
|
|
31
|
-
export { useAccount } from "./hooks/useAccount";
|
|
32
|
-
export { useIsAuthenticated } from "./hooks/useIsAuthenticated";
|
|
33
|
-
export { useMsalAuthentication } from "./hooks/useMsalAuthentication";
|
|
30
|
+
export { useMsal } from "./hooks/useMsal.js";
|
|
31
|
+
export { useAccount } from "./hooks/useAccount.js";
|
|
32
|
+
export { useIsAuthenticated } from "./hooks/useIsAuthenticated.js";
|
|
33
|
+
export { useMsalAuthentication } from "./hooks/useMsalAuthentication.js";
|
|
34
34
|
|
|
35
|
-
export { version } from "./packageMetadata";
|
|
35
|
+
export { version } from "./packageMetadata.js";
|
package/src/packageMetadata.ts
CHANGED
package/src/utils/utilities.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import { AccountIdentifiers } from "../types/AccountIdentifiers";
|
|
6
|
+
import { AccountIdentifiers } from "../types/AccountIdentifiers.js";
|
|
7
7
|
import { AccountInfo } from "@azure/msal-browser";
|
|
8
8
|
|
|
9
9
|
type FaaCFunction = <T>(args: T) => React.ReactNode;
|