@azure/msal-react 1.0.2 → 1.2.0

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 +1 @@
1
- {"version":3,"file":"msal-react.cjs.production.min.js","sources":["../src/MsalContext.ts","../src/utils/utilities.ts","../src/hooks/useMsal.ts","../src/hooks/useAccount.ts","../src/hooks/useIsAuthenticated.ts","../src/hooks/useMsalAuthentication.ts","../src/components/AuthenticatedTemplate.tsx","../src/components/MsalAuthenticationTemplate.tsx","../src/MsalProvider.tsx","../src/packageMetadata.ts","../src/components/UnauthenticatedTemplate.tsx","../src/components/withMsal.tsx"],"sourcesContent":["/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n\r\nimport * as React from \"react\";\r\nimport { IPublicClientApplication, stubbedPublicClientApplication, Logger, InteractionStatus, AccountInfo } from \"@azure/msal-browser\";\r\n\r\nexport interface IMsalContext {\r\n instance: IPublicClientApplication;\r\n inProgress: InteractionStatus;\r\n accounts: AccountInfo[];\r\n logger: Logger;\r\n}\r\n\r\n/*\r\n * Stubbed context implementation\r\n * Only used when there is no provider, which is an unsupported scenario\r\n */\r\nconst defaultMsalContext: IMsalContext = {\r\n instance: stubbedPublicClientApplication,\r\n inProgress: InteractionStatus.None,\r\n accounts: [],\r\n logger: new Logger({})\r\n};\r\n\r\nexport const MsalContext = React.createContext<IMsalContext>(\r\n defaultMsalContext\r\n);\r\nexport const MsalConsumer = MsalContext.Consumer;\r\n","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n\r\nimport { AccountIdentifiers } from \"../types/AccountIdentifiers\";\r\n\r\ntype FaaCFunction = <T>(args: T) => React.ReactNode;\r\n\r\nexport function getChildrenOrFunction<T>(\r\n children: React.ReactNode | FaaCFunction,\r\n args: T\r\n): React.ReactNode {\r\n if (typeof children === \"function\") {\r\n return children(args);\r\n }\r\n return children;\r\n}\r\n\r\n/*\r\n * Utility types\r\n * Reference: https://github.com/piotrwitek/utility-types\r\n */\r\ntype SetDifference<A, B> = A extends B ? never : A;\r\ntype SetComplement<A, A1 extends A> = SetDifference<A, A1>;\r\nexport type Subtract<T extends T1, T1 extends object> = Pick<T,SetComplement<keyof T, keyof T1>>;\r\n\r\n/**\r\n * Helper function to determine whether 2 arrays are equal\r\n * Used to avoid unnecessary state updates\r\n * @param arrayA \r\n * @param arrayB \r\n */\r\nexport function accountArraysAreEqual(arrayA: Array<AccountIdentifiers>, arrayB: Array<AccountIdentifiers>): boolean {\r\n if (arrayA.length !== arrayB.length) {\r\n return false;\r\n }\r\n\r\n const comparisonArray = [...arrayB];\r\n\r\n return arrayA.every((elementA) => {\r\n const elementB = comparisonArray.shift();\r\n if (!elementA || !elementB) {\r\n return false;\r\n }\r\n\r\n return (elementA.homeAccountId === elementB.homeAccountId) && \r\n (elementA.localAccountId === elementB.localAccountId) &&\r\n (elementA.username === elementB.username);\r\n });\r\n}\r\n","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n\r\nimport { useContext } from \"react\";\r\nimport { IMsalContext, MsalContext } from \"../MsalContext\";\r\n\r\n/**\r\n * Returns Msal Context values\r\n */\r\nexport const useMsal = (): IMsalContext => useContext(MsalContext);\r\n","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n\r\nimport { useState, useEffect } from \"react\";\r\nimport { AccountInfo, IPublicClientApplication, InteractionStatus, AccountEntity } from \"@azure/msal-browser\";\r\nimport { useMsal } from \"./useMsal\";\r\nimport { AccountIdentifiers } from \"../types/AccountIdentifiers\";\r\n\r\nfunction getAccount(instance: IPublicClientApplication, accountIdentifiers: AccountIdentifiers): AccountInfo | null {\r\n const allAccounts = instance.getAllAccounts();\r\n if (allAccounts.length > 0 && (accountIdentifiers.homeAccountId || accountIdentifiers.localAccountId || accountIdentifiers.username)) {\r\n const matchedAccounts = allAccounts.filter(accountObj => {\r\n if (accountIdentifiers.username && accountIdentifiers.username.toLowerCase() !== accountObj.username.toLowerCase()) {\r\n return false;\r\n }\r\n if (accountIdentifiers.homeAccountId && accountIdentifiers.homeAccountId.toLowerCase() !== accountObj.homeAccountId.toLowerCase()) {\r\n return false;\r\n }\r\n if (accountIdentifiers.localAccountId && accountIdentifiers.localAccountId.toLowerCase() !== accountObj.localAccountId.toLowerCase()) {\r\n return false;\r\n }\r\n\r\n return true;\r\n });\r\n\r\n return matchedAccounts[0] || null;\r\n } else {\r\n return null;\r\n }\r\n}\r\n\r\n/**\r\n * Given 1 or more accountIdentifiers, returns the Account object if the user is signed-in\r\n * @param accountIdentifiers \r\n */\r\nexport function useAccount(accountIdentifiers: AccountIdentifiers): AccountInfo | null {\r\n const { instance, inProgress } = useMsal();\r\n\r\n const initialStateValue = inProgress === InteractionStatus.Startup ? null : getAccount(instance, accountIdentifiers);\r\n const [account, setAccount] = useState<AccountInfo|null>(initialStateValue);\r\n\r\n useEffect(() => {\r\n const currentAccount = getAccount(instance, accountIdentifiers);\r\n if (!AccountEntity.accountInfoIsEqual(account, currentAccount, true)) {\r\n setAccount(currentAccount);\r\n }\r\n }, [inProgress, accountIdentifiers, instance, account]);\r\n\r\n return account;\r\n}\r\n","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n\r\nimport { useState, useEffect } from \"react\";\r\nimport { useMsal } from \"./useMsal\";\r\nimport { AccountIdentifiers } from \"../types/AccountIdentifiers\";\r\nimport { useAccount } from \"./useAccount\";\r\nimport { AccountInfo, InteractionStatus } from \"@azure/msal-browser\";\r\n\r\nfunction isAuthenticated(allAccounts: AccountIdentifiers[], account: AccountInfo | null, matchAccount?: AccountIdentifiers): boolean {\r\n if(matchAccount && (matchAccount.username || matchAccount.homeAccountId || matchAccount.localAccountId)) {\r\n return !!account;\r\n } \r\n\r\n return allAccounts.length > 0;\r\n}\r\n\r\n/**\r\n * 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\r\n * @param matchAccount \r\n */\r\nexport function useIsAuthenticated(matchAccount?: AccountIdentifiers): boolean {\r\n const { accounts: allAccounts, inProgress } = useMsal();\r\n const account = useAccount(matchAccount || {});\r\n\r\n const initialStateValue = inProgress === InteractionStatus.Startup ? false : isAuthenticated(allAccounts, account, matchAccount);\r\n const [hasAuthenticated, setHasAuthenticated] = useState<boolean>(initialStateValue);\r\n\r\n useEffect(() => {\r\n setHasAuthenticated(isAuthenticated(allAccounts, account, matchAccount));\r\n }, [allAccounts, account, matchAccount]);\r\n\r\n return hasAuthenticated;\r\n}\r\n","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n\r\nimport { useCallback, useEffect, useState } from \"react\";\r\nimport { PopupRequest, RedirectRequest, SsoSilentRequest, InteractionType, AuthenticationResult, AuthError, EventMessage, EventType, InteractionStatus } from \"@azure/msal-browser\";\r\nimport { useIsAuthenticated } from \"./useIsAuthenticated\";\r\nimport { AccountIdentifiers } from \"../types/AccountIdentifiers\";\r\nimport { useMsal } from \"./useMsal\";\r\n\r\nexport type MsalAuthenticationResult = {\r\n login: Function; \r\n result: AuthenticationResult|null;\r\n error: AuthError|null;\r\n};\r\n\r\n/**\r\n * Invokes a login call if a user is not currently signed-in. Failed logins can be retried using the login callback returned.\r\n * Optionally provide a request object to be used in the login call.\r\n * Optionally provide a specific user that should be logged in.\r\n * @param interactionType \r\n * @param authenticationRequest \r\n * @param accountIdentifiers \r\n */\r\nexport function useMsalAuthentication(\r\n interactionType: InteractionType, \r\n authenticationRequest?: PopupRequest|RedirectRequest|SsoSilentRequest, \r\n accountIdentifiers?: AccountIdentifiers\r\n): MsalAuthenticationResult {\r\n const { instance, inProgress, logger } = useMsal();\r\n const isAuthenticated = useIsAuthenticated(accountIdentifiers);\r\n const [[result, error], setResponse] = useState<[AuthenticationResult|null, AuthError|null]>([null, null]);\r\n const [hasBeenCalled, setHasBeenCalled] = useState<boolean>(false);\r\n\r\n const login = useCallback(async (callbackInteractionType?: InteractionType, callbackRequest?: PopupRequest|RedirectRequest|SsoSilentRequest): Promise<AuthenticationResult|null> => {\r\n const loginType = callbackInteractionType || interactionType;\r\n const loginRequest = callbackRequest || authenticationRequest;\r\n switch (loginType) {\r\n case InteractionType.Popup:\r\n logger.verbose(\"useMsalAuthentication - Calling loginPopup\");\r\n return instance.loginPopup(loginRequest as PopupRequest);\r\n case InteractionType.Redirect:\r\n // This promise is not expected to resolve due to full frame redirect\r\n logger.verbose(\"useMsalAuthentication - Calling loginRedirect\");\r\n return instance.loginRedirect(loginRequest as RedirectRequest).then(null);\r\n case InteractionType.Silent:\r\n logger.verbose(\"useMsalAuthentication - Calling ssoSilent\");\r\n return instance.ssoSilent(loginRequest as SsoSilentRequest);\r\n default:\r\n throw \"Invalid interaction type provided.\";\r\n }\r\n }, [instance, interactionType, authenticationRequest, logger]);\r\n\r\n useEffect(() => {\r\n const callbackId = instance.addEventCallback((message: EventMessage) => {\r\n switch(message.eventType) {\r\n case EventType.LOGIN_SUCCESS:\r\n case EventType.SSO_SILENT_SUCCESS:\r\n if (message.payload) {\r\n setResponse([message.payload as AuthenticationResult, null]);\r\n }\r\n break;\r\n case EventType.LOGIN_FAILURE:\r\n case EventType.SSO_SILENT_FAILURE:\r\n if (message.error) {\r\n setResponse([null, message.error as AuthError]);\r\n }\r\n break;\r\n }\r\n });\r\n logger.verbose(`useMsalAuthentication - Registered event callback with id: ${callbackId}`);\r\n\r\n return () => {\r\n if (callbackId) {\r\n logger.verbose(`useMsalAuthentication - Removing event callback ${callbackId}`);\r\n instance.removeEventCallback(callbackId);\r\n }\r\n };\r\n }, [instance, logger]);\r\n\r\n useEffect(() => {\r\n if (!hasBeenCalled && !error && !isAuthenticated && inProgress === InteractionStatus.None) {\r\n logger.info(\"useMsalAuthentication - No user is authenticated, attempting to login\");\r\n // Ensure login is only called one time from within this hook, any subsequent login attempts should use the callback returned\r\n setHasBeenCalled(true);\r\n login().catch(() => {\r\n // Errors are handled by the event handler above\r\n return;\r\n });\r\n }\r\n }, [isAuthenticated, inProgress, error, hasBeenCalled, login, logger]);\r\n\r\n return { login, result, error };\r\n}\r\n","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n\r\nimport React, { PropsWithChildren, useMemo } from \"react\";\r\nimport { AccountIdentifiers } from \"../types/AccountIdentifiers\";\r\nimport { getChildrenOrFunction } from \"../utils/utilities\";\r\nimport { useMsal } from \"../hooks/useMsal\";\r\nimport { useIsAuthenticated } from \"../hooks/useIsAuthenticated\";\r\nimport { InteractionStatus } from \"@azure/msal-browser\";\r\n\r\nexport type AuthenticatedTemplateProps = PropsWithChildren<AccountIdentifiers>;\r\n\r\n/**\r\n * Renders child components if user is authenticated\r\n * @param props \r\n */\r\nexport function AuthenticatedTemplate({ username, homeAccountId, localAccountId, children }: AuthenticatedTemplateProps): React.ReactElement|null {\r\n const context = useMsal();\r\n const accountIdentifier: AccountIdentifiers = useMemo(() => {\r\n return {\r\n username,\r\n homeAccountId,\r\n localAccountId\r\n };\r\n }, [username, homeAccountId, localAccountId]);\r\n const isAuthenticated = useIsAuthenticated(accountIdentifier);\r\n\r\n if (isAuthenticated && context.inProgress !== InteractionStatus.Startup) {\r\n return (\r\n <React.Fragment>\r\n {getChildrenOrFunction(children, context)}\r\n </React.Fragment>\r\n );\r\n }\r\n return null;\r\n}\r\n","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n\r\nimport React, { PropsWithChildren, useMemo } from \"react\";\r\nimport { AccountIdentifiers } from \"../types/AccountIdentifiers\";\r\nimport { getChildrenOrFunction } from \"../utils/utilities\";\r\nimport { useMsal } from \"../hooks/useMsal\";\r\nimport { MsalAuthenticationResult, useMsalAuthentication } from \"../hooks/useMsalAuthentication\";\r\nimport { useIsAuthenticated } from \"../hooks/useIsAuthenticated\";\r\nimport { InteractionType, PopupRequest, RedirectRequest, SsoSilentRequest, InteractionStatus } from \"@azure/msal-browser\";\r\nimport { IMsalContext } from \"../MsalContext\";\r\n\r\nexport type MsalAuthenticationProps = PropsWithChildren<AccountIdentifiers & {\r\n interactionType: InteractionType;\r\n authenticationRequest?: PopupRequest|RedirectRequest|SsoSilentRequest;\r\n loadingComponent?: React.ElementType<IMsalContext>;\r\n errorComponent?: React.ElementType<MsalAuthenticationResult>;\r\n}>;\r\n\r\n/**\r\n * Attempts to authenticate user if not already authenticated, then renders child components\r\n * @param props\r\n */\r\nexport function MsalAuthenticationTemplate({ \r\n interactionType, \r\n username, \r\n homeAccountId, \r\n localAccountId,\r\n authenticationRequest, \r\n loadingComponent: LoadingComponent,\r\n errorComponent: ErrorComponent,\r\n children \r\n}: MsalAuthenticationProps): React.ReactElement|null {\r\n const accountIdentifier: AccountIdentifiers = useMemo(() => {\r\n return {\r\n username,\r\n homeAccountId,\r\n localAccountId\r\n };\r\n }, [username, homeAccountId, localAccountId]);\r\n const context = useMsal();\r\n const msalAuthResult = useMsalAuthentication(interactionType, authenticationRequest, accountIdentifier);\r\n const isAuthenticated = useIsAuthenticated(accountIdentifier);\r\n\r\n if (msalAuthResult.error && context.inProgress === InteractionStatus.None) {\r\n if (!!ErrorComponent) {\r\n return <ErrorComponent {...msalAuthResult} />;\r\n }\r\n\r\n throw msalAuthResult.error;\r\n }\r\n \r\n if (isAuthenticated) {\r\n return (\r\n <React.Fragment>\r\n {getChildrenOrFunction(children, msalAuthResult)}\r\n </React.Fragment>\r\n );\r\n } \r\n \r\n if (!!LoadingComponent && context.inProgress !== InteractionStatus.None) {\r\n return <LoadingComponent {...context} />;\r\n }\r\n\r\n return null;\r\n}\r\n","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n\r\nimport React, { useState, useEffect, useRef, PropsWithChildren, useMemo } from \"react\";\r\nimport {\r\n IPublicClientApplication,\r\n EventType,\r\n EventMessage,\r\n EventMessageUtils,\r\n InteractionStatus,\r\n Logger,\r\n WrapperSKU,\r\n AccountInfo\r\n} from \"@azure/msal-browser\";\r\nimport { MsalContext, IMsalContext } from \"./MsalContext\";\r\nimport { accountArraysAreEqual } from \"./utils/utilities\";\r\nimport { name as SKU, version } from \"./packageMetadata\";\r\n\r\nexport type MsalProviderProps = PropsWithChildren<{\r\n instance: IPublicClientApplication;\r\n}>;\r\n\r\nexport function MsalProvider({instance, children}: MsalProviderProps): React.ReactElement {\r\n useEffect(() => {\r\n instance.initializeWrapperLibrary(WrapperSKU.React, version);\r\n }, [instance]);\r\n // Create a logger instance for msal-react with the same options as PublicClientApplication\r\n const logger: Logger = useMemo(() => {\r\n return instance.getLogger().clone(SKU, version);\r\n }, [instance]);\r\n\r\n // State hook to store accounts\r\n const [accounts, setAccounts] = useState<AccountInfo[]>([]);\r\n // State hook to store in progress value\r\n const [inProgress, setInProgress] = useState<InteractionStatus>(InteractionStatus.Startup);\r\n // Mutable object used in the event callback\r\n const inProgressRef = useRef(inProgress);\r\n \r\n useEffect(() => {\r\n const callbackId = instance.addEventCallback((message: EventMessage) => {\r\n switch (message.eventType) {\r\n case EventType.LOGIN_SUCCESS:\r\n case EventType.SSO_SILENT_SUCCESS:\r\n case EventType.HANDLE_REDIRECT_END:\r\n case EventType.LOGIN_FAILURE:\r\n case EventType.SSO_SILENT_FAILURE:\r\n case EventType.LOGOUT_END:\r\n case EventType.ACQUIRE_TOKEN_SUCCESS:\r\n case EventType.ACQUIRE_TOKEN_FAILURE:\r\n const currentAccounts = instance.getAllAccounts();\r\n if (!accountArraysAreEqual(currentAccounts, accounts)) {\r\n logger.info(\"MsalProvider - updating account state\");\r\n setAccounts(currentAccounts);\r\n } else {\r\n logger.info(\"MsalProvider - no account changes\");\r\n }\r\n break;\r\n }\r\n });\r\n logger.verbose(`MsalProvider - Registered event callback with id: ${callbackId}`);\r\n\r\n return () => {\r\n // Remove callback when component unmounts or accounts change\r\n if (callbackId) {\r\n logger.verbose(`MsalProvider - Removing event callback ${callbackId}`);\r\n instance.removeEventCallback(callbackId);\r\n }\r\n };\r\n }, [instance, accounts, logger]);\r\n\r\n useEffect(() => {\r\n const callbackId = instance.addEventCallback((message: EventMessage) => {\r\n const status = EventMessageUtils.getInteractionStatusFromEvent(message, inProgressRef.current);\r\n if (status !== null) {\r\n logger.info(`MsalProvider - ${message.eventType} results in setting inProgress from ${inProgressRef.current} to ${status}`);\r\n inProgressRef.current = status;\r\n setInProgress(status);\r\n }\r\n });\r\n logger.verbose(`MsalProvider - Registered event callback with id: ${callbackId}`);\r\n\r\n instance.handleRedirectPromise().catch(() => {\r\n // Errors should be handled by listening to the LOGIN_FAILURE event\r\n return;\r\n });\r\n\r\n return () => {\r\n if (callbackId) {\r\n logger.verbose(`MsalProvider - Removing event callback ${callbackId}`);\r\n instance.removeEventCallback(callbackId);\r\n }\r\n };\r\n }, [instance, logger]);\r\n\r\n const contextValue: IMsalContext = {\r\n instance,\r\n inProgress,\r\n accounts,\r\n logger\r\n };\r\n\r\n return (\r\n <MsalContext.Provider value={contextValue}>\r\n {children}\r\n </MsalContext.Provider>\r\n );\r\n}\r\n\r\n","/* eslint-disable header/header */\nexport const name = \"@azure/msal-react\";\nexport const version = \"1.0.2\";\n","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n\r\nimport React, { PropsWithChildren, useMemo } from \"react\";\r\nimport { useMsal } from \"../hooks/useMsal\";\r\nimport { useIsAuthenticated } from \"../hooks/useIsAuthenticated\";\r\nimport { getChildrenOrFunction } from \"../utils/utilities\";\r\nimport { AccountIdentifiers } from \"../types/AccountIdentifiers\";\r\nimport { InteractionStatus } from \"@azure/msal-browser\";\r\n\r\nexport type UnauthenticatedTemplateProps = PropsWithChildren<AccountIdentifiers>;\r\n\r\n/**\r\n * Renders child components if user is unauthenticated\r\n * @param props \r\n */\r\nexport function UnauthenticatedTemplate({ username, homeAccountId, localAccountId, children }: UnauthenticatedTemplateProps): React.ReactElement|null {\r\n const context = useMsal();\r\n const accountIdentifier: AccountIdentifiers = useMemo(() => {\r\n return {\r\n username,\r\n homeAccountId,\r\n localAccountId\r\n };\r\n }, [username, homeAccountId, localAccountId]);\r\n const isAuthenticated = useIsAuthenticated(accountIdentifier);\r\n\r\n if (!isAuthenticated && context.inProgress !== InteractionStatus.Startup && context.inProgress !== InteractionStatus.HandleRedirect) {\r\n return (\r\n <React.Fragment>\r\n {getChildrenOrFunction(children, context)}\r\n </React.Fragment>\r\n );\r\n }\r\n return null;\r\n}\r\n","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n\r\nimport React from \"react\";\r\nimport { IMsalContext } from \"../MsalContext\";\r\nimport { useMsal } from \"../hooks/useMsal\";\r\nimport { Subtract } from \"../utils/utilities\";\r\n\r\nexport type WithMsalProps = {\r\n msalContext: IMsalContext;\r\n};\r\n\r\n/**\r\n * Higher order component wraps provided component with msal by injecting msal context values into the component's props \r\n * @param Component \r\n */\r\nexport const withMsal = <P extends WithMsalProps>(Component: React.ComponentType<P>): React.FunctionComponent<Subtract<P,WithMsalProps>> => {\r\n const ComponentWithMsal: React.FunctionComponent<Subtract<P,WithMsalProps>> = props => {\r\n const msal = useMsal();\r\n return <Component {...(props as P)} msalContext={msal} />;\r\n };\r\n\r\n const componentName =\r\n Component.displayName || Component.name || \"Component\";\r\n ComponentWithMsal.displayName = `withMsal(${componentName})`;\r\n\r\n return ComponentWithMsal;\r\n};\r\n"],"names":["MsalContext","React","instance","stubbedPublicClientApplication","inProgress","InteractionStatus","None","accounts","logger","Logger","MsalConsumer","Consumer","getChildrenOrFunction","children","args","useMsal","useContext","getAccount","accountIdentifiers","allAccounts","getAllAccounts","length","homeAccountId","localAccountId","username","filter","accountObj","toLowerCase","useAccount","initialStateValue","Startup","account","setAccount","useState","useEffect","currentAccount","AccountEntity","accountInfoIsEqual","isAuthenticated","matchAccount","useIsAuthenticated","hasAuthenticated","setHasAuthenticated","useMsalAuthentication","interactionType","authenticationRequest","result","error","setResponse","hasBeenCalled","setHasBeenCalled","login","useCallback","async","callbackInteractionType","callbackRequest","loginRequest","InteractionType","Popup","verbose","loginPopup","Redirect","loginRedirect","then","Silent","ssoSilent","callbackId","addEventCallback","message","eventType","EventType","LOGIN_SUCCESS","SSO_SILENT_SUCCESS","payload","LOGIN_FAILURE","SSO_SILENT_FAILURE","removeEventCallback","info","catch","context","useMemo","Fragment","loadingComponent","LoadingComponent","errorComponent","ErrorComponent","accountIdentifier","msalAuthResult","initializeWrapperLibrary","WrapperSKU","getLogger","clone","setAccounts","setInProgress","inProgressRef","useRef","HANDLE_REDIRECT_END","LOGOUT_END","ACQUIRE_TOKEN_SUCCESS","ACQUIRE_TOKEN_FAILURE","currentAccounts","arrayA","arrayB","comparisonArray","every","elementA","elementB","shift","accountArraysAreEqual","status","EventMessageUtils","getInteractionStatusFromEvent","current","handleRedirectPromise","Provider","value","HandleRedirect","Component","ComponentWithMsal","props","msal","msalContext","displayName","name"],"mappings":"qLAmBA,MAOaA,EAAcC,gBAPc,CACrCC,SAAUC,iCACVC,WAAYC,oBAAkBC,KAC9BC,SAAU,GACVC,OAAQ,IAAIC,SAAO,MAMVC,EAAeV,EAAYW,kBCpBxBC,EACZC,EACAC,SAEwB,mBAAbD,EACAA,EAASC,GAEbD,QCLEE,EAAU,IAAoBC,aAAWhB,GCDtD,SAASiB,EAAWf,EAAoCgB,SAC9CC,EAAcjB,EAASkB,wBACzBD,EAAYE,OAAS,IAAMH,EAAmBI,eAAiBJ,EAAmBK,gBAAkBL,EAAmBM,WAC/FL,EAAYM,OAAOC,KACnCR,EAAmBM,UAAYN,EAAmBM,SAASG,gBAAkBD,EAAWF,SAASG,eAGjGT,EAAmBI,eAAiBJ,EAAmBI,cAAcK,gBAAkBD,EAAWJ,cAAcK,eAGhHT,EAAmBK,gBAAkBL,EAAmBK,eAAeI,gBAAkBD,EAAWH,e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oBAAkBC,8BAA8B3C,EAAS0B,EAAckB,SACvE,OAAXH,IACArG,EAAOqE,uBAAuBT,EAAQC,gDAAgDyB,EAAckB,cAAcH,KAClHf,EAAckB,QAAUH,EACxBhB,EAAcgB,aAGtBrG,EAAOmD,6DAA6DO,GAEpEhE,EAAS+G,wBAAwBnC,MAAM,QAKhC,KACCZ,IACA1D,EAAOmD,kDAAkDO,GACzDhE,EAAS0E,oBAAoBV,MAGtC,CAAChE,EAAUM,IAUVP,gBAACD,EAAYkH,UAASC,MARS,CAC/BjH,SAAAA,EACAE,WAAAA,EACAG,SAAAA,EACAC,OAAAA,IAKKK,oCEvFb,UAAwCW,SAAEA,EAAFF,cAAYA,EAAZC,eAA2BA,EAA3BV,SAA2CA,UACzEkE,EAAUhE,WAQQyB,EAPsBwC,UAAQ,KAC3C,CACHxD,SAAAA,EACAF,cAAAA,EACAC,eAAAA,IAEL,CAACC,EAAUF,EAAeC,MAGLwD,EAAQ3E,aAAeC,oBAAkByB,SAAWiD,EAAQ3E,aAAeC,oBAAkB+G,eAO9G,KALCnH,gBAACA,EAAMgF,cACFrE,EAAsBC,EAAUkE,0HCdCsC,UACxCC,EAAwEC,UACpEC,EAAOzG,WACNd,gBAACoH,mBAAeE,GAAaE,YAAaD,aAKrDF,EAAkBI,wBADdL,EAAUK,aAAeL,EAAUM,MAAQ,eAGxCL"}
1
+ {"version":3,"file":"msal-react.cjs.production.min.js","sources":["../src/MsalContext.ts","../src/utils/utilities.ts","../src/hooks/useMsal.ts","../src/hooks/useAccount.ts","../src/hooks/useIsAuthenticated.ts","../src/hooks/useMsalAuthentication.ts","../src/components/AuthenticatedTemplate.tsx","../src/components/MsalAuthenticationTemplate.tsx","../src/MsalProvider.tsx","../src/packageMetadata.ts","../src/components/UnauthenticatedTemplate.tsx","../src/components/withMsal.tsx"],"sourcesContent":["/*\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport * as React from \"react\";\nimport { IPublicClientApplication, stubbedPublicClientApplication, Logger, InteractionStatus, AccountInfo } from \"@azure/msal-browser\";\n\nexport interface IMsalContext {\n instance: IPublicClientApplication;\n inProgress: InteractionStatus;\n accounts: AccountInfo[];\n logger: Logger;\n}\n\n/*\n * Stubbed context implementation\n * Only used when there is no provider, which is an unsupported scenario\n */\nconst defaultMsalContext: IMsalContext = {\n instance: stubbedPublicClientApplication,\n inProgress: InteractionStatus.None,\n accounts: [],\n logger: new Logger({})\n};\n\nexport const MsalContext = React.createContext<IMsalContext>(\n defaultMsalContext\n);\nexport const MsalConsumer = MsalContext.Consumer;\n","/*\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { AccountIdentifiers } from \"../types/AccountIdentifiers\";\n\ntype FaaCFunction = <T>(args: T) => React.ReactNode;\n\nexport function getChildrenOrFunction<T>(\n children: React.ReactNode | FaaCFunction,\n args: T\n): React.ReactNode {\n if (typeof children === \"function\") {\n return children(args);\n }\n return children;\n}\n\n/*\n * Utility types\n * Reference: https://github.com/piotrwitek/utility-types\n */\ntype SetDifference<A, B> = A extends B ? never : A;\ntype SetComplement<A, A1 extends A> = SetDifference<A, A1>;\nexport type Subtract<T extends T1, T1 extends object> = Pick<T,SetComplement<keyof T, keyof T1>>;\n\n/**\n * Helper function to determine whether 2 arrays are equal\n * Used to avoid unnecessary state updates\n * @param arrayA \n * @param arrayB \n */\nexport function accountArraysAreEqual(arrayA: Array<AccountIdentifiers>, arrayB: Array<AccountIdentifiers>): boolean {\n if (arrayA.length !== arrayB.length) {\n return false;\n }\n\n const comparisonArray = [...arrayB];\n\n return arrayA.every((elementA) => {\n const elementB = comparisonArray.shift();\n if (!elementA || !elementB) {\n return false;\n }\n\n return (elementA.homeAccountId === elementB.homeAccountId) && \n (elementA.localAccountId === elementB.localAccountId) &&\n (elementA.username === elementB.username);\n });\n}\n","/*\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { useContext } from \"react\";\nimport { IMsalContext, MsalContext } from \"../MsalContext\";\n\n/**\n * Returns Msal Context values\n */\nexport const useMsal = (): IMsalContext => useContext(MsalContext);\n","/*\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { useState, useEffect } from \"react\";\nimport { AccountInfo, IPublicClientApplication, InteractionStatus, AccountEntity } from \"@azure/msal-browser\";\nimport { useMsal } from \"./useMsal\";\nimport { AccountIdentifiers } from \"../types/AccountIdentifiers\";\n\nfunction getAccount(instance: IPublicClientApplication, accountIdentifiers: AccountIdentifiers): AccountInfo | null {\n const allAccounts = instance.getAllAccounts();\n if (allAccounts.length > 0 && (accountIdentifiers.homeAccountId || accountIdentifiers.localAccountId || accountIdentifiers.username)) {\n const matchedAccounts = allAccounts.filter(accountObj => {\n if (accountIdentifiers.username && accountIdentifiers.username.toLowerCase() !== accountObj.username.toLowerCase()) {\n return false;\n }\n if (accountIdentifiers.homeAccountId && accountIdentifiers.homeAccountId.toLowerCase() !== accountObj.homeAccountId.toLowerCase()) {\n return false;\n }\n if (accountIdentifiers.localAccountId && accountIdentifiers.localAccountId.toLowerCase() !== accountObj.localAccountId.toLowerCase()) {\n return false;\n }\n\n return true;\n });\n\n return matchedAccounts[0] || null;\n } else {\n return null;\n }\n}\n\n/**\n * Given 1 or more accountIdentifiers, returns the Account object if the user is signed-in\n * @param accountIdentifiers \n */\nexport function useAccount(accountIdentifiers: AccountIdentifiers): AccountInfo | null {\n const { instance, inProgress } = useMsal();\n\n const initialStateValue = inProgress === InteractionStatus.Startup ? null : getAccount(instance, accountIdentifiers);\n const [account, setAccount] = useState<AccountInfo|null>(initialStateValue);\n\n useEffect(() => {\n const currentAccount = getAccount(instance, accountIdentifiers);\n if (!AccountEntity.accountInfoIsEqual(account, currentAccount, true)) {\n setAccount(currentAccount);\n }\n }, [inProgress, accountIdentifiers, instance, account]);\n\n return account;\n}\n","/*\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { useState, useEffect } from \"react\";\nimport { useMsal } from \"./useMsal\";\nimport { AccountIdentifiers } from \"../types/AccountIdentifiers\";\nimport { useAccount } from \"./useAccount\";\nimport { AccountInfo, InteractionStatus } from \"@azure/msal-browser\";\n\nfunction isAuthenticated(allAccounts: AccountIdentifiers[], account: AccountInfo | null, matchAccount?: AccountIdentifiers): boolean {\n if(matchAccount && (matchAccount.username || matchAccount.homeAccountId || matchAccount.localAccountId)) {\n return !!account;\n } \n\n return allAccounts.length > 0;\n}\n\n/**\n * 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\n * @param matchAccount \n */\nexport function useIsAuthenticated(matchAccount?: AccountIdentifiers): boolean {\n const { accounts: allAccounts, inProgress } = useMsal();\n const account = useAccount(matchAccount || {});\n\n const initialStateValue = inProgress === InteractionStatus.Startup ? false : isAuthenticated(allAccounts, account, matchAccount);\n const [hasAuthenticated, setHasAuthenticated] = useState<boolean>(initialStateValue);\n\n useEffect(() => {\n setHasAuthenticated(isAuthenticated(allAccounts, account, matchAccount));\n }, [allAccounts, account, matchAccount]);\n\n return hasAuthenticated;\n}\n","/*\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { useCallback, useEffect, useState } from \"react\";\nimport { PopupRequest, RedirectRequest, SsoSilentRequest, InteractionType, AuthenticationResult, AuthError, EventMessage, EventType, InteractionStatus } from \"@azure/msal-browser\";\nimport { useIsAuthenticated } from \"./useIsAuthenticated\";\nimport { AccountIdentifiers } from \"../types/AccountIdentifiers\";\nimport { useMsal } from \"./useMsal\";\n\nexport type MsalAuthenticationResult = {\n login: Function; \n result: AuthenticationResult|null;\n error: AuthError|null;\n};\n\n/**\n * Invokes a login call if a user is not currently signed-in. Failed logins can be retried using the login callback returned.\n * Optionally provide a request object to be used in the login call.\n * Optionally provide a specific user that should be logged in.\n * @param interactionType \n * @param authenticationRequest \n * @param accountIdentifiers \n */\nexport function useMsalAuthentication(\n interactionType: InteractionType, \n authenticationRequest?: PopupRequest|RedirectRequest|SsoSilentRequest, \n accountIdentifiers?: AccountIdentifiers\n): MsalAuthenticationResult {\n const { instance, inProgress, logger } = useMsal();\n const isAuthenticated = useIsAuthenticated(accountIdentifiers);\n const [[result, error], setResponse] = useState<[AuthenticationResult|null, AuthError|null]>([null, null]);\n const [hasBeenCalled, setHasBeenCalled] = useState<boolean>(false);\n\n const login = useCallback(async (callbackInteractionType?: InteractionType, callbackRequest?: PopupRequest|RedirectRequest|SsoSilentRequest): Promise<AuthenticationResult|null> => {\n const loginType = callbackInteractionType || interactionType;\n const loginRequest = callbackRequest || authenticationRequest;\n switch (loginType) {\n case InteractionType.Popup:\n logger.verbose(\"useMsalAuthentication - Calling loginPopup\");\n return instance.loginPopup(loginRequest as PopupRequest);\n case InteractionType.Redirect:\n // This promise is not expected to resolve due to full frame redirect\n logger.verbose(\"useMsalAuthentication - Calling loginRedirect\");\n return instance.loginRedirect(loginRequest as RedirectRequest).then(null);\n case InteractionType.Silent:\n logger.verbose(\"useMsalAuthentication - Calling ssoSilent\");\n return instance.ssoSilent(loginRequest as SsoSilentRequest);\n default:\n throw \"Invalid interaction type provided.\";\n }\n }, [instance, interactionType, authenticationRequest, logger]);\n\n useEffect(() => {\n const callbackId = instance.addEventCallback((message: EventMessage) => {\n switch(message.eventType) {\n case EventType.LOGIN_SUCCESS:\n case EventType.SSO_SILENT_SUCCESS:\n if (message.payload) {\n setResponse([message.payload as AuthenticationResult, null]);\n }\n break;\n case EventType.LOGIN_FAILURE:\n case EventType.SSO_SILENT_FAILURE:\n if (message.error) {\n setResponse([null, message.error as AuthError]);\n }\n break;\n }\n });\n logger.verbose(`useMsalAuthentication - Registered event callback with id: ${callbackId}`);\n\n return () => {\n if (callbackId) {\n logger.verbose(`useMsalAuthentication - Removing event callback ${callbackId}`);\n instance.removeEventCallback(callbackId);\n }\n };\n }, [instance, logger]);\n\n useEffect(() => {\n if (!hasBeenCalled && !error && !isAuthenticated && inProgress === InteractionStatus.None) {\n logger.info(\"useMsalAuthentication - No user is authenticated, attempting to login\");\n // Ensure login is only called one time from within this hook, any subsequent login attempts should use the callback returned\n setHasBeenCalled(true);\n login().catch(() => {\n // Errors are handled by the event handler above\n return;\n });\n }\n }, [isAuthenticated, inProgress, error, hasBeenCalled, login, logger]);\n\n return { login, result, error };\n}\n","/*\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport React, { PropsWithChildren, useMemo } from \"react\";\nimport { AccountIdentifiers } from \"../types/AccountIdentifiers\";\nimport { getChildrenOrFunction } from \"../utils/utilities\";\nimport { useMsal } from \"../hooks/useMsal\";\nimport { useIsAuthenticated } from \"../hooks/useIsAuthenticated\";\nimport { InteractionStatus } from \"@azure/msal-browser\";\n\nexport type AuthenticatedTemplateProps = PropsWithChildren<AccountIdentifiers>;\n\n/**\n * Renders child components if user is authenticated\n * @param props \n */\nexport function AuthenticatedTemplate({ username, homeAccountId, localAccountId, children }: AuthenticatedTemplateProps): React.ReactElement|null {\n const context = useMsal();\n const accountIdentifier: AccountIdentifiers = useMemo(() => {\n return {\n username,\n homeAccountId,\n localAccountId\n };\n }, [username, homeAccountId, localAccountId]);\n const isAuthenticated = useIsAuthenticated(accountIdentifier);\n\n if (isAuthenticated && context.inProgress !== InteractionStatus.Startup) {\n return (\n <React.Fragment>\n {getChildrenOrFunction(children, context)}\n </React.Fragment>\n );\n }\n return null;\n}\n","/*\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport React, { PropsWithChildren, useMemo } from \"react\";\nimport { AccountIdentifiers } from \"../types/AccountIdentifiers\";\nimport { getChildrenOrFunction } from \"../utils/utilities\";\nimport { useMsal } from \"../hooks/useMsal\";\nimport { MsalAuthenticationResult, useMsalAuthentication } from \"../hooks/useMsalAuthentication\";\nimport { useIsAuthenticated } from \"../hooks/useIsAuthenticated\";\nimport { InteractionType, PopupRequest, RedirectRequest, SsoSilentRequest, InteractionStatus } from \"@azure/msal-browser\";\nimport { IMsalContext } from \"../MsalContext\";\n\nexport type MsalAuthenticationProps = PropsWithChildren<AccountIdentifiers & {\n interactionType: InteractionType;\n authenticationRequest?: PopupRequest|RedirectRequest|SsoSilentRequest;\n loadingComponent?: React.ElementType<IMsalContext>;\n errorComponent?: React.ElementType<MsalAuthenticationResult>;\n}>;\n\n/**\n * Attempts to authenticate user if not already authenticated, then renders child components\n * @param props\n */\nexport function MsalAuthenticationTemplate({ \n interactionType, \n username, \n homeAccountId, \n localAccountId,\n authenticationRequest, \n loadingComponent: LoadingComponent,\n errorComponent: ErrorComponent,\n children \n}: MsalAuthenticationProps): React.ReactElement|null {\n const accountIdentifier: AccountIdentifiers = useMemo(() => {\n return {\n username,\n homeAccountId,\n localAccountId\n };\n }, [username, homeAccountId, localAccountId]);\n const context = useMsal();\n const msalAuthResult = useMsalAuthentication(interactionType, authenticationRequest, accountIdentifier);\n const isAuthenticated = useIsAuthenticated(accountIdentifier);\n\n if (msalAuthResult.error && context.inProgress === InteractionStatus.None) {\n if (!!ErrorComponent) {\n return <ErrorComponent {...msalAuthResult} />;\n }\n\n throw msalAuthResult.error;\n }\n \n if (isAuthenticated) {\n return (\n <React.Fragment>\n {getChildrenOrFunction(children, msalAuthResult)}\n </React.Fragment>\n );\n } \n \n if (!!LoadingComponent && context.inProgress !== InteractionStatus.None) {\n return <LoadingComponent {...context} />;\n }\n\n return null;\n}\n","/*\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport React, { useState, useEffect, useRef, PropsWithChildren, useMemo } from \"react\";\nimport {\n IPublicClientApplication,\n EventType,\n EventMessage,\n EventMessageUtils,\n InteractionStatus,\n Logger,\n WrapperSKU,\n AccountInfo\n} from \"@azure/msal-browser\";\nimport { MsalContext, IMsalContext } from \"./MsalContext\";\nimport { accountArraysAreEqual } from \"./utils/utilities\";\nimport { name as SKU, version } from \"./packageMetadata\";\n\nexport type MsalProviderProps = PropsWithChildren<{\n instance: IPublicClientApplication;\n}>;\n\nexport function MsalProvider({instance, children}: MsalProviderProps): React.ReactElement {\n useEffect(() => {\n instance.initializeWrapperLibrary(WrapperSKU.React, version);\n }, [instance]);\n // Create a logger instance for msal-react with the same options as PublicClientApplication\n const logger: Logger = useMemo(() => {\n return instance.getLogger().clone(SKU, version);\n }, [instance]);\n\n // State hook to store accounts\n const [accounts, setAccounts] = useState<AccountInfo[]>([]);\n // State hook to store in progress value\n const [inProgress, setInProgress] = useState<InteractionStatus>(InteractionStatus.Startup);\n // Mutable object used in the event callback\n const inProgressRef = useRef(inProgress);\n \n useEffect(() => {\n const callbackId = instance.addEventCallback((message: EventMessage) => {\n switch (message.eventType) {\n case EventType.ACCOUNT_ADDED:\n case EventType.ACCOUNT_REMOVED:\n case EventType.LOGIN_SUCCESS:\n case EventType.SSO_SILENT_SUCCESS:\n case EventType.HANDLE_REDIRECT_END:\n case EventType.LOGIN_FAILURE:\n case EventType.SSO_SILENT_FAILURE:\n case EventType.LOGOUT_END:\n case EventType.ACQUIRE_TOKEN_SUCCESS:\n case EventType.ACQUIRE_TOKEN_FAILURE:\n const currentAccounts = instance.getAllAccounts();\n if (!accountArraysAreEqual(currentAccounts, accounts)) {\n logger.info(\"MsalProvider - updating account state\");\n setAccounts(currentAccounts);\n } else {\n logger.info(\"MsalProvider - no account changes\");\n }\n break;\n }\n });\n logger.verbose(`MsalProvider - Registered event callback with id: ${callbackId}`);\n\n return () => {\n // Remove callback when component unmounts or accounts change\n if (callbackId) {\n logger.verbose(`MsalProvider - Removing event callback ${callbackId}`);\n instance.removeEventCallback(callbackId);\n }\n };\n }, [instance, accounts, logger]);\n\n useEffect(() => {\n const callbackId = instance.addEventCallback((message: EventMessage) => {\n const status = EventMessageUtils.getInteractionStatusFromEvent(message, inProgressRef.current);\n if (status !== null) {\n logger.info(`MsalProvider - ${message.eventType} results in setting inProgress from ${inProgressRef.current} to ${status}`);\n inProgressRef.current = status;\n setInProgress(status);\n }\n });\n logger.verbose(`MsalProvider - Registered event callback with id: ${callbackId}`);\n\n instance.handleRedirectPromise().catch(() => {\n // Errors should be handled by listening to the LOGIN_FAILURE event\n return;\n }).finally(() => {\n /*\n * If handleRedirectPromise returns a cached promise the necessary events may not be fired\n * This is a fallback to prevent inProgress from getting stuck in 'startup'\n */\n if (inProgressRef.current === InteractionStatus.Startup) {\n inProgressRef.current = InteractionStatus.None;\n setInProgress(InteractionStatus.None);\n }\n });\n\n return () => {\n if (callbackId) {\n logger.verbose(`MsalProvider - Removing event callback ${callbackId}`);\n instance.removeEventCallback(callbackId);\n }\n };\n }, [instance, logger]);\n\n const contextValue: IMsalContext = {\n instance,\n inProgress,\n accounts,\n logger\n };\n\n return (\n <MsalContext.Provider value={contextValue}>\n {children}\n </MsalContext.Provider>\n );\n}\n\n","/* eslint-disable header/header */\nexport const name = \"@azure/msal-react\";\nexport const version = \"1.2.0\";\n","/*\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport React, { PropsWithChildren, useMemo } from \"react\";\nimport { useMsal } from \"../hooks/useMsal\";\nimport { useIsAuthenticated } from \"../hooks/useIsAuthenticated\";\nimport { getChildrenOrFunction } from \"../utils/utilities\";\nimport { AccountIdentifiers } from \"../types/AccountIdentifiers\";\nimport { InteractionStatus } from \"@azure/msal-browser\";\n\nexport type UnauthenticatedTemplateProps = PropsWithChildren<AccountIdentifiers>;\n\n/**\n * Renders child components if user is unauthenticated\n * @param props \n */\nexport function UnauthenticatedTemplate({ username, homeAccountId, localAccountId, children }: UnauthenticatedTemplateProps): React.ReactElement|null {\n const context = useMsal();\n const accountIdentifier: AccountIdentifiers = useMemo(() => {\n return {\n username,\n homeAccountId,\n localAccountId\n };\n }, [username, homeAccountId, localAccountId]);\n const isAuthenticated = useIsAuthenticated(accountIdentifier);\n\n if (!isAuthenticated && context.inProgress !== InteractionStatus.Startup && context.inProgress !== InteractionStatus.HandleRedirect) {\n return (\n <React.Fragment>\n {getChildrenOrFunction(children, context)}\n </React.Fragment>\n );\n }\n return null;\n}\n","/*\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport React from \"react\";\nimport { IMsalContext } from \"../MsalContext\";\nimport { useMsal } from \"../hooks/useMsal\";\nimport { Subtract } from \"../utils/utilities\";\n\nexport type WithMsalProps = {\n msalContext: IMsalContext;\n};\n\n/**\n * Higher order component wraps provided component with msal by injecting msal context values into the component's props \n * @param Component \n */\nexport const withMsal = <P extends WithMsalProps>(Component: React.ComponentType<P>): React.FunctionComponent<Subtract<P,WithMsalProps>> => {\n const ComponentWithMsal: React.FunctionComponent<Subtract<P,WithMsalProps>> = props => {\n const msal = useMsal();\n return <Component {...(props as P)} msalContext={msal} />;\n };\n\n const componentName =\n Component.displayName || Component.name || \"Component\";\n ComponentWithMsal.displayName = `withMsal(${componentName})`;\n\n return ComponentWithMsal;\n};\n"],"names":["MsalContext","React","instance","stubbedPublicClientApplication","inProgress","InteractionStatus","None","accounts","logger","Logger","MsalConsumer","Consumer","getChildrenOrFunction","children","args","useMsal","useContext","getAccount","accountIdentifiers","allAccounts","getAllAccounts","length","homeAccountId","localAccountId","username","filter","accountObj","toLowerCase","useAccount","initialStateValue","Startup","account","setAccount","useState","useEffect","currentAccount","AccountEntity","accountInfoIsEqual","isAuthenticated","matchAccount","useIsAuthenticated","hasAuthenticated","setHasAuthenticated","useMsalAuthentication","interactionType","authenticationRequest","result","error","setResponse","hasBeenCalled","setHasBeenCalled","login","useCallback","async","callbackInteractionType","callbackRequest","loginRequest","InteractionType","Popup","verbose","loginPopup","Redirect","loginRedirect","then","Silent","ssoSilent","callbackId","addEventCallback","message","eventType","EventType","LOGIN_SUCCESS","SSO_SILENT_SUCCESS","payload","LOGIN_FAILURE","SSO_SILENT_FAILURE","removeEventCallback","info","catch","context","useMemo","Fragment","loadingComponent","LoadingComponent","errorComponent","ErrorComponent","accountIdentifier","msalAuthResult","initializeWrapperLibrary","WrapperSKU","getLogger","clone","setAccounts","setInProgress","inProgressRef","useRef","ACCOUNT_ADDED","ACCOUNT_REMOVED","HANDLE_REDIRECT_END","LOGOUT_END","ACQUIRE_TOKEN_SUCCESS","ACQUIRE_TOKEN_FAILURE","currentAccounts","arrayA","arrayB","comparisonArray","every","elementA","elementB","shift","accountArraysAreEqual","status","EventMessageUtils","getInteractionStatusFromEvent","current","handleRedirectPromise","finally","Provider","value","HandleRedirect","Component","ComponentWithMsal","props","msal","msalContext","displayName","name"],"mappings":"qLAmBA,MAOaA,EAAcC,gBAPc,CACrCC,SAAUC,iCACVC,WAAYC,oBAAkBC,KAC9BC,SAAU,GACVC,OAAQ,IAAIC,SAAO,MAMVC,EAAeV,EAAYW,kBCpBxBC,EACZC,EACAC,SAEwB,mBAAbD,EACAA,EAASC,GAEbD,QCLEE,EAAU,IAAoBC,aAAWhB,GCDtD,SAASiB,EAAWf,EAAoCgB,SAC9CC,EAAcjB,EAASkB,wBACzBD,EAAYE,OAAS,IAAMH,EAAmBI,eAAiBJ,EAAmBK,gBAAkBL,EAAmBM,WAC/FL,EAAYM,OAAOC,KACnCR,EAAmBM,UAAYN,EAAmBM,SAASG,gBAAkBD,EAAWF,SAASG,eAGjGT,EAAmBI,eAAiBJ,EAAmBI,cAAcK,gBAAkBD,EAAWJ,cAAcK,eAGhHT,EAAmBK,gBAAkBL,EAAmBK,eAAeI,gBAAkBD,EAAWH,eAAeI,gBAOpG,IAEhB,cAQCC,EAAWV,SACjBhB,SAAEA,EAAFE,WAAYA,GAAeW,IAE3Bc,EAAoBzB,IAAeC,oBAAkByB,QAAU,KAAOb,EAAWf,EAAUgB,IAC1Fa,EAASC,GAAcC,WAA2BJ,UAEzDK,YAAU,WACAC,EAAiBlB,EAAWf,EAAUgB,GACvCkB,gBAAcC,mBAAmBN,EAASI,GAAgB,IAC3DH,EAAWG,IAEhB,CAAC/B,EAAYc,EAAoBhB,EAAU6B,IAEvCA,ECvCX,SAASO,EAAgBnB,EAAmCY,EAA6BQ,UACl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C,KACC4D,IACA1D,EAAOmD,kDAAkDO,GACzDhE,EAAS0E,oBAAoBV,MAGtC,CAAChE,EAAUM,IAUVP,gBAACD,EAAYqH,UAASC,MARS,CAC/BpH,SAAAA,EACAE,WAAAA,EACAG,SAAAA,EACAC,OAAAA,IAKKK,oCElGb,UAAwCW,SAAEA,EAAFF,cAAYA,EAAZC,eAA2BA,EAA3BV,SAA2CA,UACzEkE,EAAUhE,WAQQyB,EAPsBwC,UAAQ,KAC3C,CACHxD,SAAAA,EACAF,cAAAA,EACAC,eAAAA,IAEL,CAACC,EAAUF,EAAeC,MAGLwD,EAAQ3E,aAAeC,oBAAkByB,SAAWiD,EAAQ3E,aAAeC,oBAAkBkH,eAO9G,KALCtH,gBAACA,EAAMgF,cACFrE,EAAsBC,EAAUkE,yHD9B1B,yBEgB2ByC,UACxCC,EAAwEC,UACpEC,EAAO5G,WACNd,gBAACuH,mBAAeE,GAAaE,YAAaD,aAKrDF,EAAkBI,wBADdL,EAAUK,aAAeL,EAAUM,MAAQ,eAGxCL"}
@@ -56,7 +56,7 @@ function accountArraysAreEqual(arrayA, arrayB) {
56
56
 
57
57
  /* eslint-disable header/header */
58
58
  const name = "@azure/msal-react";
59
- const version = "1.0.2";
59
+ const version = "1.2.0";
60
60
 
61
61
  /*
62
62
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -82,6 +82,8 @@ function MsalProvider({
82
82
  useEffect(() => {
83
83
  const callbackId = instance.addEventCallback(message => {
84
84
  switch (message.eventType) {
85
+ case EventType.ACCOUNT_ADDED:
86
+ case EventType.ACCOUNT_REMOVED:
85
87
  case EventType.LOGIN_SUCCESS:
86
88
  case EventType.SSO_SILENT_SUCCESS:
87
89
  case EventType.HANDLE_REDIRECT_END:
@@ -125,6 +127,15 @@ function MsalProvider({
125
127
  instance.handleRedirectPromise().catch(() => {
126
128
  // Errors should be handled by listening to the LOGIN_FAILURE event
127
129
  return;
130
+ }).finally(() => {
131
+ /*
132
+ * If handleRedirectPromise returns a cached promise the necessary events may not be fired
133
+ * This is a fallback to prevent inProgress from getting stuck in 'startup'
134
+ */
135
+ if (inProgressRef.current === InteractionStatus.Startup) {
136
+ inProgressRef.current = InteractionStatus.None;
137
+ setInProgress(InteractionStatus.None);
138
+ }
128
139
  });
129
140
  return () => {
130
141
  if (callbackId) {
@@ -463,5 +474,5 @@ const withMsal = Component => {
463
474
  return ComponentWithMsal;
464
475
  };
465
476
 
466
- export { AuthenticatedTemplate, MsalAuthenticationTemplate, MsalConsumer, MsalContext, MsalProvider, UnauthenticatedTemplate, useAccount, useIsAuthenticated, useMsal, useMsalAuthentication, withMsal };
477
+ export { AuthenticatedTemplate, MsalAuthenticationTemplate, MsalConsumer, MsalContext, MsalProvider, UnauthenticatedTemplate, useAccount, useIsAuthenticated, useMsal, useMsalAuthentication, version, withMsal };
467
478
  //# sourceMappingURL=msal-react.esm.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"msal-react.esm.js","sources":["../src/MsalContext.ts","../src/utils/utilities.ts","../src/packageMetadata.ts","../src/MsalProvider.tsx","../src/hooks/useMsal.ts","../src/hooks/useAccount.ts","../src/hooks/useIsAuthenticated.ts","../src/components/AuthenticatedTemplate.tsx","../src/components/UnauthenticatedTemplate.tsx","../src/hooks/useMsalAuthentication.ts","../src/components/MsalAuthenticationTemplate.tsx","../src/components/withMsal.tsx"],"sourcesContent":["/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n\r\nimport * as React from \"react\";\r\nimport { IPublicClientApplication, stubbedPublicClientApplication, Logger, InteractionStatus, AccountInfo } from \"@azure/msal-browser\";\r\n\r\nexport interface IMsalContext {\r\n instance: IPublicClientApplication;\r\n inProgress: InteractionStatus;\r\n accounts: AccountInfo[];\r\n logger: Logger;\r\n}\r\n\r\n/*\r\n * Stubbed context implementation\r\n * Only used when there is no provider, which is an unsupported scenario\r\n */\r\nconst defaultMsalContext: IMsalContext = {\r\n instance: stubbedPublicClientApplication,\r\n inProgress: InteractionStatus.None,\r\n accounts: [],\r\n logger: new Logger({})\r\n};\r\n\r\nexport const MsalContext = React.createContext<IMsalContext>(\r\n defaultMsalContext\r\n);\r\nexport const MsalConsumer = MsalContext.Consumer;\r\n","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n\r\nimport { AccountIdentifiers } from \"../types/AccountIdentifiers\";\r\n\r\ntype FaaCFunction = <T>(args: T) => React.ReactNode;\r\n\r\nexport function getChildrenOrFunction<T>(\r\n children: React.ReactNode | FaaCFunction,\r\n args: T\r\n): React.ReactNode {\r\n if (typeof children === \"function\") {\r\n return children(args);\r\n }\r\n return children;\r\n}\r\n\r\n/*\r\n * Utility types\r\n * Reference: https://github.com/piotrwitek/utility-types\r\n */\r\ntype SetDifference<A, B> = A extends B ? never : A;\r\ntype SetComplement<A, A1 extends A> = SetDifference<A, A1>;\r\nexport type Subtract<T extends T1, T1 extends object> = Pick<T,SetComplement<keyof T, keyof T1>>;\r\n\r\n/**\r\n * Helper function to determine whether 2 arrays are equal\r\n * Used to avoid unnecessary state updates\r\n * @param arrayA \r\n * @param arrayB \r\n */\r\nexport function accountArraysAreEqual(arrayA: Array<AccountIdentifiers>, arrayB: Array<AccountIdentifiers>): boolean {\r\n if (arrayA.length !== arrayB.length) {\r\n return false;\r\n }\r\n\r\n const comparisonArray = [...arrayB];\r\n\r\n return arrayA.every((elementA) => {\r\n const elementB = comparisonArray.shift();\r\n if (!elementA || !elementB) {\r\n return false;\r\n }\r\n\r\n return (elementA.homeAccountId === elementB.homeAccountId) && \r\n (elementA.localAccountId === elementB.localAccountId) &&\r\n (elementA.username === elementB.username);\r\n });\r\n}\r\n","/* eslint-disable header/header */\nexport const name = \"@azure/msal-react\";\nexport const version = \"1.0.2\";\n","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n\r\nimport React, { useState, useEffect, useRef, PropsWithChildren, useMemo } from \"react\";\r\nimport {\r\n IPublicClientApplication,\r\n EventType,\r\n EventMessage,\r\n EventMessageUtils,\r\n InteractionStatus,\r\n Logger,\r\n WrapperSKU,\r\n AccountInfo\r\n} from \"@azure/msal-browser\";\r\nimport { MsalContext, IMsalContext } from \"./MsalContext\";\r\nimport { accountArraysAreEqual } from \"./utils/utilities\";\r\nimport { name as SKU, version } from \"./packageMetadata\";\r\n\r\nexport type MsalProviderProps = PropsWithChildren<{\r\n instance: IPublicClientApplication;\r\n}>;\r\n\r\nexport function MsalProvider({instance, children}: MsalProviderProps): React.ReactElement {\r\n useEffect(() => {\r\n instance.initializeWrapperLibrary(WrapperSKU.React, version);\r\n }, [instance]);\r\n // Create a logger instance for msal-react with the same options as PublicClientApplication\r\n const logger: Logger = useMemo(() => {\r\n return instance.getLogger().clone(SKU, version);\r\n }, [instance]);\r\n\r\n // State hook to store accounts\r\n const [accounts, setAccounts] = useState<AccountInfo[]>([]);\r\n // State hook to store in progress value\r\n const [inProgress, setInProgress] = useState<InteractionStatus>(InteractionStatus.Startup);\r\n // Mutable object used in the event callback\r\n const inProgressRef = useRef(inProgress);\r\n \r\n useEffect(() => {\r\n const callbackId = instance.addEventCallback((message: EventMessage) => {\r\n switch (message.eventType) {\r\n case EventType.LOGIN_SUCCESS:\r\n case EventType.SSO_SILENT_SUCCESS:\r\n case EventType.HANDLE_REDIRECT_END:\r\n case EventType.LOGIN_FAILURE:\r\n case EventType.SSO_SILENT_FAILURE:\r\n case EventType.LOGOUT_END:\r\n case EventType.ACQUIRE_TOKEN_SUCCESS:\r\n case EventType.ACQUIRE_TOKEN_FAILURE:\r\n const currentAccounts = instance.getAllAccounts();\r\n if (!accountArraysAreEqual(currentAccounts, accounts)) {\r\n logger.info(\"MsalProvider - updating account state\");\r\n setAccounts(currentAccounts);\r\n } else {\r\n logger.info(\"MsalProvider - no account changes\");\r\n }\r\n break;\r\n }\r\n });\r\n logger.verbose(`MsalProvider - Registered event callback with id: ${callbackId}`);\r\n\r\n return () => {\r\n // Remove callback when component unmounts or accounts change\r\n if (callbackId) {\r\n logger.verbose(`MsalProvider - Removing event callback ${callbackId}`);\r\n instance.removeEventCallback(callbackId);\r\n }\r\n };\r\n }, [instance, accounts, logger]);\r\n\r\n useEffect(() => {\r\n const callbackId = instance.addEventCallback((message: EventMessage) => {\r\n const status = EventMessageUtils.getInteractionStatusFromEvent(message, inProgressRef.current);\r\n if (status !== null) {\r\n logger.info(`MsalProvider - ${message.eventType} results in setting inProgress from ${inProgressRef.current} to ${status}`);\r\n inProgressRef.current = status;\r\n setInProgress(status);\r\n }\r\n });\r\n logger.verbose(`MsalProvider - Registered event callback with id: ${callbackId}`);\r\n\r\n instance.handleRedirectPromise().catch(() => {\r\n // Errors should be handled by listening to the LOGIN_FAILURE event\r\n return;\r\n });\r\n\r\n return () => {\r\n if (callbackId) {\r\n logger.verbose(`MsalProvider - Removing event callback ${callbackId}`);\r\n instance.removeEventCallback(callbackId);\r\n }\r\n };\r\n }, [instance, logger]);\r\n\r\n const contextValue: IMsalContext = {\r\n instance,\r\n inProgress,\r\n accounts,\r\n logger\r\n };\r\n\r\n return (\r\n <MsalContext.Provider value={contextValue}>\r\n {children}\r\n </MsalContext.Provider>\r\n );\r\n}\r\n\r\n","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n\r\nimport { useContext } from \"react\";\r\nimport { IMsalContext, MsalContext } from \"../MsalContext\";\r\n\r\n/**\r\n * Returns Msal Context values\r\n */\r\nexport const useMsal = (): IMsalContext => useContext(MsalContext);\r\n","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n\r\nimport { useState, useEffect } from \"react\";\r\nimport { AccountInfo, IPublicClientApplication, InteractionStatus, AccountEntity } from \"@azure/msal-browser\";\r\nimport { useMsal } from \"./useMsal\";\r\nimport { AccountIdentifiers } from \"../types/AccountIdentifiers\";\r\n\r\nfunction getAccount(instance: IPublicClientApplication, accountIdentifiers: AccountIdentifiers): AccountInfo | null {\r\n const allAccounts = instance.getAllAccounts();\r\n if (allAccounts.length > 0 && (accountIdentifiers.homeAccountId || accountIdentifiers.localAccountId || accountIdentifiers.username)) {\r\n const matchedAccounts = allAccounts.filter(accountObj => {\r\n if (accountIdentifiers.username && accountIdentifiers.username.toLowerCase() !== accountObj.username.toLowerCase()) {\r\n return false;\r\n }\r\n if (accountIdentifiers.homeAccountId && accountIdentifiers.homeAccountId.toLowerCase() !== accountObj.homeAccountId.toLowerCase()) {\r\n return false;\r\n }\r\n if (accountIdentifiers.localAccountId && accountIdentifiers.localAccountId.toLowerCase() !== accountObj.localAccountId.toLowerCase()) {\r\n return false;\r\n }\r\n\r\n return true;\r\n });\r\n\r\n return matchedAccounts[0] || null;\r\n } else {\r\n return null;\r\n }\r\n}\r\n\r\n/**\r\n * Given 1 or more accountIdentifiers, returns the Account object if the user is signed-in\r\n * @param accountIdentifiers \r\n */\r\nexport function useAccount(accountIdentifiers: AccountIdentifiers): AccountInfo | null {\r\n const { instance, inProgress } = useMsal();\r\n\r\n const initialStateValue = inProgress === InteractionStatus.Startup ? null : getAccount(instance, accountIdentifiers);\r\n const [account, setAccount] = useState<AccountInfo|null>(initialStateValue);\r\n\r\n useEffect(() => {\r\n const currentAccount = getAccount(instance, accountIdentifiers);\r\n if (!AccountEntity.accountInfoIsEqual(account, currentAccount, true)) {\r\n setAccount(currentAccount);\r\n }\r\n }, [inProgress, accountIdentifiers, instance, account]);\r\n\r\n return account;\r\n}\r\n","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n\r\nimport { useState, useEffect } from \"react\";\r\nimport { useMsal } from \"./useMsal\";\r\nimport { AccountIdentifiers } from \"../types/AccountIdentifiers\";\r\nimport { useAccount } from \"./useAccount\";\r\nimport { AccountInfo, InteractionStatus } from \"@azure/msal-browser\";\r\n\r\nfunction isAuthenticated(allAccounts: AccountIdentifiers[], account: AccountInfo | null, matchAccount?: AccountIdentifiers): boolean {\r\n if(matchAccount && (matchAccount.username || matchAccount.homeAccountId || matchAccount.localAccountId)) {\r\n return !!account;\r\n } \r\n\r\n return allAccounts.length > 0;\r\n}\r\n\r\n/**\r\n * 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\r\n * @param matchAccount \r\n */\r\nexport function useIsAuthenticated(matchAccount?: AccountIdentifiers): boolean {\r\n const { accounts: allAccounts, inProgress } = useMsal();\r\n const account = useAccount(matchAccount || {});\r\n\r\n const initialStateValue = inProgress === InteractionStatus.Startup ? false : isAuthenticated(allAccounts, account, matchAccount);\r\n const [hasAuthenticated, setHasAuthenticated] = useState<boolean>(initialStateValue);\r\n\r\n useEffect(() => {\r\n setHasAuthenticated(isAuthenticated(allAccounts, account, matchAccount));\r\n }, [allAccounts, account, matchAccount]);\r\n\r\n return hasAuthenticated;\r\n}\r\n","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n\r\nimport React, { PropsWithChildren, useMemo } from \"react\";\r\nimport { AccountIdentifiers } from \"../types/AccountIdentifiers\";\r\nimport { getChildrenOrFunction } from \"../utils/utilities\";\r\nimport { useMsal } from \"../hooks/useMsal\";\r\nimport { useIsAuthenticated } from \"../hooks/useIsAuthenticated\";\r\nimport { InteractionStatus } from \"@azure/msal-browser\";\r\n\r\nexport type AuthenticatedTemplateProps = PropsWithChildren<AccountIdentifiers>;\r\n\r\n/**\r\n * Renders child components if user is authenticated\r\n * @param props \r\n */\r\nexport function AuthenticatedTemplate({ username, homeAccountId, localAccountId, children }: AuthenticatedTemplateProps): React.ReactElement|null {\r\n const context = useMsal();\r\n const accountIdentifier: AccountIdentifiers = useMemo(() => {\r\n return {\r\n username,\r\n homeAccountId,\r\n localAccountId\r\n };\r\n }, [username, homeAccountId, localAccountId]);\r\n const isAuthenticated = useIsAuthenticated(accountIdentifier);\r\n\r\n if (isAuthenticated && context.inProgress !== InteractionStatus.Startup) {\r\n return (\r\n <React.Fragment>\r\n {getChildrenOrFunction(children, context)}\r\n </React.Fragment>\r\n );\r\n }\r\n return null;\r\n}\r\n","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n\r\nimport React, { PropsWithChildren, useMemo } from \"react\";\r\nimport { useMsal } from \"../hooks/useMsal\";\r\nimport { useIsAuthenticated } from \"../hooks/useIsAuthenticated\";\r\nimport { getChildrenOrFunction } from \"../utils/utilities\";\r\nimport { AccountIdentifiers } from \"../types/AccountIdentifiers\";\r\nimport { InteractionStatus } from \"@azure/msal-browser\";\r\n\r\nexport type UnauthenticatedTemplateProps = PropsWithChildren<AccountIdentifiers>;\r\n\r\n/**\r\n * Renders child components if user is unauthenticated\r\n * @param props \r\n */\r\nexport function UnauthenticatedTemplate({ username, homeAccountId, localAccountId, children }: UnauthenticatedTemplateProps): React.ReactElement|null {\r\n const context = useMsal();\r\n const accountIdentifier: AccountIdentifiers = useMemo(() => {\r\n return {\r\n username,\r\n homeAccountId,\r\n localAccountId\r\n };\r\n }, [username, homeAccountId, localAccountId]);\r\n const isAuthenticated = useIsAuthenticated(accountIdentifier);\r\n\r\n if (!isAuthenticated && context.inProgress !== InteractionStatus.Startup && context.inProgress !== InteractionStatus.HandleRedirect) {\r\n return (\r\n <React.Fragment>\r\n {getChildrenOrFunction(children, context)}\r\n </React.Fragment>\r\n );\r\n }\r\n return null;\r\n}\r\n","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n\r\nimport { useCallback, useEffect, useState } from \"react\";\r\nimport { PopupRequest, RedirectRequest, SsoSilentRequest, InteractionType, AuthenticationResult, AuthError, EventMessage, EventType, InteractionStatus } from \"@azure/msal-browser\";\r\nimport { useIsAuthenticated } from \"./useIsAuthenticated\";\r\nimport { AccountIdentifiers } from \"../types/AccountIdentifiers\";\r\nimport { useMsal } from \"./useMsal\";\r\n\r\nexport type MsalAuthenticationResult = {\r\n login: Function; \r\n result: AuthenticationResult|null;\r\n error: AuthError|null;\r\n};\r\n\r\n/**\r\n * Invokes a login call if a user is not currently signed-in. Failed logins can be retried using the login callback returned.\r\n * Optionally provide a request object to be used in the login call.\r\n * Optionally provide a specific user that should be logged in.\r\n * @param interactionType \r\n * @param authenticationRequest \r\n * @param accountIdentifiers \r\n */\r\nexport function useMsalAuthentication(\r\n interactionType: InteractionType, \r\n authenticationRequest?: PopupRequest|RedirectRequest|SsoSilentRequest, \r\n accountIdentifiers?: AccountIdentifiers\r\n): MsalAuthenticationResult {\r\n const { instance, inProgress, logger } = useMsal();\r\n const isAuthenticated = useIsAuthenticated(accountIdentifiers);\r\n const [[result, error], setResponse] = useState<[AuthenticationResult|null, AuthError|null]>([null, null]);\r\n const [hasBeenCalled, setHasBeenCalled] = useState<boolean>(false);\r\n\r\n const login = useCallback(async (callbackInteractionType?: InteractionType, callbackRequest?: PopupRequest|RedirectRequest|SsoSilentRequest): Promise<AuthenticationResult|null> => {\r\n const loginType = callbackInteractionType || interactionType;\r\n const loginRequest = callbackRequest || authenticationRequest;\r\n switch (loginType) {\r\n case InteractionType.Popup:\r\n logger.verbose(\"useMsalAuthentication - Calling loginPopup\");\r\n return instance.loginPopup(loginRequest as PopupRequest);\r\n case InteractionType.Redirect:\r\n // This promise is not expected to resolve due to full frame redirect\r\n logger.verbose(\"useMsalAuthentication - Calling loginRedirect\");\r\n return instance.loginRedirect(loginRequest as RedirectRequest).then(null);\r\n case InteractionType.Silent:\r\n logger.verbose(\"useMsalAuthentication - Calling ssoSilent\");\r\n return instance.ssoSilent(loginRequest as SsoSilentRequest);\r\n default:\r\n throw \"Invalid interaction type provided.\";\r\n }\r\n }, [instance, interactionType, authenticationRequest, logger]);\r\n\r\n useEffect(() => {\r\n const callbackId = instance.addEventCallback((message: EventMessage) => {\r\n switch(message.eventType) {\r\n case EventType.LOGIN_SUCCESS:\r\n case EventType.SSO_SILENT_SUCCESS:\r\n if (message.payload) {\r\n setResponse([message.payload as AuthenticationResult, null]);\r\n }\r\n break;\r\n case EventType.LOGIN_FAILURE:\r\n case EventType.SSO_SILENT_FAILURE:\r\n if (message.error) {\r\n setResponse([null, message.error as AuthError]);\r\n }\r\n break;\r\n }\r\n });\r\n logger.verbose(`useMsalAuthentication - Registered event callback with id: ${callbackId}`);\r\n\r\n return () => {\r\n if (callbackId) {\r\n logger.verbose(`useMsalAuthentication - Removing event callback ${callbackId}`);\r\n instance.removeEventCallback(callbackId);\r\n }\r\n };\r\n }, [instance, logger]);\r\n\r\n useEffect(() => {\r\n if (!hasBeenCalled && !error && !isAuthenticated && inProgress === InteractionStatus.None) {\r\n logger.info(\"useMsalAuthentication - No user is authenticated, attempting to login\");\r\n // Ensure login is only called one time from within this hook, any subsequent login attempts should use the callback returned\r\n setHasBeenCalled(true);\r\n login().catch(() => {\r\n // Errors are handled by the event handler above\r\n return;\r\n });\r\n }\r\n }, [isAuthenticated, inProgress, error, hasBeenCalled, login, logger]);\r\n\r\n return { login, result, error };\r\n}\r\n","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n\r\nimport React, { PropsWithChildren, useMemo } from \"react\";\r\nimport { AccountIdentifiers } from \"../types/AccountIdentifiers\";\r\nimport { getChildrenOrFunction } from \"../utils/utilities\";\r\nimport { useMsal } from \"../hooks/useMsal\";\r\nimport { MsalAuthenticationResult, useMsalAuthentication } from \"../hooks/useMsalAuthentication\";\r\nimport { useIsAuthenticated } from \"../hooks/useIsAuthenticated\";\r\nimport { InteractionType, PopupRequest, RedirectRequest, SsoSilentRequest, InteractionStatus } from \"@azure/msal-browser\";\r\nimport { IMsalContext } from \"../MsalContext\";\r\n\r\nexport type MsalAuthenticationProps = PropsWithChildren<AccountIdentifiers & {\r\n interactionType: InteractionType;\r\n authenticationRequest?: PopupRequest|RedirectRequest|SsoSilentRequest;\r\n loadingComponent?: React.ElementType<IMsalContext>;\r\n errorComponent?: React.ElementType<MsalAuthenticationResult>;\r\n}>;\r\n\r\n/**\r\n * Attempts to authenticate user if not already authenticated, then renders child components\r\n * @param props\r\n */\r\nexport function MsalAuthenticationTemplate({ \r\n interactionType, \r\n username, \r\n homeAccountId, \r\n localAccountId,\r\n authenticationRequest, \r\n loadingComponent: LoadingComponent,\r\n errorComponent: ErrorComponent,\r\n children \r\n}: MsalAuthenticationProps): React.ReactElement|null {\r\n const accountIdentifier: AccountIdentifiers = useMemo(() => {\r\n return {\r\n username,\r\n homeAccountId,\r\n localAccountId\r\n };\r\n }, [username, homeAccountId, localAccountId]);\r\n const context = useMsal();\r\n const msalAuthResult = useMsalAuthentication(interactionType, authenticationRequest, accountIdentifier);\r\n const isAuthenticated = useIsAuthenticated(accountIdentifier);\r\n\r\n if (msalAuthResult.error && context.inProgress === InteractionStatus.None) {\r\n if (!!ErrorComponent) {\r\n return <ErrorComponent {...msalAuthResult} />;\r\n }\r\n\r\n throw msalAuthResult.error;\r\n }\r\n \r\n if (isAuthenticated) {\r\n return (\r\n <React.Fragment>\r\n {getChildrenOrFunction(children, msalAuthResult)}\r\n </React.Fragment>\r\n );\r\n } \r\n \r\n if (!!LoadingComponent && context.inProgress !== InteractionStatus.None) {\r\n return <LoadingComponent {...context} />;\r\n }\r\n\r\n return null;\r\n}\r\n","/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n\r\nimport React from \"react\";\r\nimport { IMsalContext } from \"../MsalContext\";\r\nimport { useMsal } from \"../hooks/useMsal\";\r\nimport { Subtract } from \"../utils/utilities\";\r\n\r\nexport type WithMsalProps = {\r\n msalContext: IMsalContext;\r\n};\r\n\r\n/**\r\n * Higher order component wraps provided component with msal by injecting msal context values into the component's props \r\n * @param Component \r\n */\r\nexport const withMsal = <P extends WithMsalProps>(Component: React.ComponentType<P>): React.FunctionComponent<Subtract<P,WithMsalProps>> => {\r\n const ComponentWithMsal: React.FunctionComponent<Subtract<P,WithMsalProps>> = props => {\r\n const msal = useMsal();\r\n return <Component {...(props as P)} msalContext={msal} />;\r\n };\r\n\r\n const componentName =\r\n Component.displayName || Component.name || \"Component\";\r\n ComponentWithMsal.displayName = `withMsal(${componentName})`;\r\n\r\n return ComponentWithMsal;\r\n};\r\n"],"names":["defaultMsalContext","instance","stubbedPublicClientApplication","inProgress","InteractionStatus","None","accounts","logger","Logger","MsalContext","React","MsalConsumer","Consumer","getChildrenOrFunction","children","args","accountArraysAreEqual","arrayA","arrayB","length","comparisonArray","every","elementA","elementB","shift","homeAccountId","localAccountId","username","name","version","MsalProvider","useEffect","initializeWrapperLibrary","WrapperSKU","useMemo","getLogger","clone","SKU","setAccounts","useState","setInProgress","Startup","inProgressRef","useRef","callbackId","addEventCallback","message","eventType","EventType","LOGIN_SUCCESS","SSO_SILENT_SUCCESS","HANDLE_REDIRECT_END","LOGIN_FAILURE","SSO_SILENT_FAILURE","LOGOUT_END","ACQUIRE_TOKEN_SUCCESS","ACQUIRE_TOKEN_FAILURE","currentAccounts","getAllAccounts","info","verbose","removeEventCallback","status","EventMessageUtils","getInteractionStatusFromEvent","current","handleRedirectPromise","catch","contextValue","Provider","value","useMsal","useContext","getAccount","accountIdentifiers","allAccounts","matchedAccounts","filter","accountObj","toLowerCase","useAccount","initialStateValue","account","setAccount","currentAccount","AccountEntity","accountInfoIsEqual","isAuthenticated","matchAccount","useIsAuthenticated","hasAuthenticated","setHasAuthenticated","AuthenticatedTemplate","context","accountIdentifier","Fragment","UnauthenticatedTemplate","HandleRedirect","useMsalAuthentication","interactionType","authenticationRequest","result","error","setResponse","hasBeenCalled","setHasBeenCalled","login","useCallback","callbackInteractionType","callbackRequest","loginType","loginRequest","InteractionType","Popup","loginPopup","Redirect","loginRedirect","then","Silent","ssoSilent","payload","MsalAuthenticationTemplate","loadingComponent","LoadingComponent","errorComponent","ErrorComponent","msalAuthResult","withMsal","Component","ComponentWithMsal","props","msal","msalContext","componentName","displayName"],"mappings":";;;AAAA;;;;AAeA;;;;;AA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cAAN,EAAsB;AAClB,aAAOnH,4BAAA,CAACmH,cAAD,oBAAoBC,eAApB,CAAP;AACH;;AAED,UAAMA,cAAc,CAACxB,KAArB;AACH;;AAED,MAAIf,eAAJ,EAAqB;AACjB,WACI7E,4BAAA,CAACA,cAAK,CAACqF,QAAP,MAAA,EACKlF,qBAAqB,CAACC,QAAD,EAAWgH,cAAX,CAD1B,CADJ;AAKH;;AAED,MAAI,CAAC,CAACH,gBAAF,IAAsB9B,OAAO,CAAC1F,UAAR,KAAuBC,iBAAiB,CAACC,IAAnE,EAAyE;AACrE,WAAOK,4BAAA,CAACiH,gBAAD,oBAAsB9B,QAAtB,CAAP;AACH;;AAED,SAAO,IAAP;AACH;;ACnED;;;;AAKA,AASA;;;;;AAIA,MAAakC,QAAQ,GAA6BC,SAA1B;AACpB,QAAMC,iBAAiB,GAAuDC,KAAK;AAC/E,UAAMC,IAAI,GAAG5D,OAAO,EAApB;AACA,WAAO7D,4BAAA,CAACsH,SAAD,oBAAgBE;AAAaE,MAAAA,WAAW,EAAED;MAA1C,CAAP;AACH,GAHD;;AAKA,QAAME,aAAa,GACfL,SAAS,CAACM,WAAV,IAAyBN,SAAS,CAACpG,IAAnC,IAA2C,WAD/C;AAEAqG,EAAAA,iBAAiB,CAACK,WAAlB,eAA4CD,gBAA5C;AAEA,SAAOJ,iBAAP;AACH,CAXM;;;;"}
1
+ {"version":3,"file":"msal-react.esm.js","sources":["../src/MsalContext.ts","../src/utils/utilities.ts","../src/packageMetadata.ts","../src/MsalProvider.tsx","../src/hooks/useMsal.ts","../src/hooks/useAccount.ts","../src/hooks/useIsAuthenticated.ts","../src/components/AuthenticatedTemplate.tsx","../src/components/UnauthenticatedTemplate.tsx","../src/hooks/useMsalAuthentication.ts","../src/components/MsalAuthenticationTemplate.tsx","../src/components/withMsal.tsx"],"sourcesContent":["/*\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport * as React from \"react\";\nimport { IPublicClientApplication, stubbedPublicClientApplication, Logger, InteractionStatus, AccountInfo } from \"@azure/msal-browser\";\n\nexport interface IMsalContext {\n instance: IPublicClientApplication;\n inProgress: InteractionStatus;\n accounts: AccountInfo[];\n logger: Logger;\n}\n\n/*\n * Stubbed context implementation\n * Only used when there is no provider, which is an unsupported scenario\n */\nconst defaultMsalContext: IMsalContext = {\n instance: stubbedPublicClientApplication,\n inProgress: InteractionStatus.None,\n accounts: [],\n logger: new Logger({})\n};\n\nexport const MsalContext = React.createContext<IMsalContext>(\n defaultMsalContext\n);\nexport const MsalConsumer = MsalContext.Consumer;\n","/*\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { AccountIdentifiers } from \"../types/AccountIdentifiers\";\n\ntype FaaCFunction = <T>(args: T) => React.ReactNode;\n\nexport function getChildrenOrFunction<T>(\n children: React.ReactNode | FaaCFunction,\n args: T\n): React.ReactNode {\n if (typeof children === \"function\") {\n return children(args);\n }\n return children;\n}\n\n/*\n * Utility types\n * Reference: https://github.com/piotrwitek/utility-types\n */\ntype SetDifference<A, B> = A extends B ? never : A;\ntype SetComplement<A, A1 extends A> = SetDifference<A, A1>;\nexport type Subtract<T extends T1, T1 extends object> = Pick<T,SetComplement<keyof T, keyof T1>>;\n\n/**\n * Helper function to determine whether 2 arrays are equal\n * Used to avoid unnecessary state updates\n * @param arrayA \n * @param arrayB \n */\nexport function accountArraysAreEqual(arrayA: Array<AccountIdentifiers>, arrayB: Array<AccountIdentifiers>): boolean {\n if (arrayA.length !== arrayB.length) {\n return false;\n }\n\n const comparisonArray = [...arrayB];\n\n return arrayA.every((elementA) => {\n const elementB = comparisonArray.shift();\n if (!elementA || !elementB) {\n return false;\n }\n\n return (elementA.homeAccountId === elementB.homeAccountId) && \n (elementA.localAccountId === elementB.localAccountId) &&\n (elementA.username === elementB.username);\n });\n}\n","/* eslint-disable header/header */\nexport const name = \"@azure/msal-react\";\nexport const version = \"1.2.0\";\n","/*\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport React, { useState, useEffect, useRef, PropsWithChildren, useMemo } from \"react\";\nimport {\n IPublicClientApplication,\n EventType,\n EventMessage,\n EventMessageUtils,\n InteractionStatus,\n Logger,\n WrapperSKU,\n AccountInfo\n} from \"@azure/msal-browser\";\nimport { MsalContext, IMsalContext } from \"./MsalContext\";\nimport { accountArraysAreEqual } from \"./utils/utilities\";\nimport { name as SKU, version } from \"./packageMetadata\";\n\nexport type MsalProviderProps = PropsWithChildren<{\n instance: IPublicClientApplication;\n}>;\n\nexport function MsalProvider({instance, children}: MsalProviderProps): React.ReactElement {\n useEffect(() => {\n instance.initializeWrapperLibrary(WrapperSKU.React, version);\n }, [instance]);\n // Create a logger instance for msal-react with the same options as PublicClientApplication\n const logger: Logger = useMemo(() => {\n return instance.getLogger().clone(SKU, version);\n }, [instance]);\n\n // State hook to store accounts\n const [accounts, setAccounts] = useState<AccountInfo[]>([]);\n // State hook to store in progress value\n const [inProgress, setInProgress] = useState<InteractionStatus>(InteractionStatus.Startup);\n // Mutable object used in the event callback\n const inProgressRef = useRef(inProgress);\n \n useEffect(() => {\n const callbackId = instance.addEventCallback((message: EventMessage) => {\n switch (message.eventType) {\n case EventType.ACCOUNT_ADDED:\n case EventType.ACCOUNT_REMOVED:\n case EventType.LOGIN_SUCCESS:\n case EventType.SSO_SILENT_SUCCESS:\n case EventType.HANDLE_REDIRECT_END:\n case EventType.LOGIN_FAILURE:\n case EventType.SSO_SILENT_FAILURE:\n case EventType.LOGOUT_END:\n case EventType.ACQUIRE_TOKEN_SUCCESS:\n case EventType.ACQUIRE_TOKEN_FAILURE:\n const currentAccounts = instance.getAllAccounts();\n if (!accountArraysAreEqual(currentAccounts, accounts)) {\n logger.info(\"MsalProvider - updating account state\");\n setAccounts(currentAccounts);\n } else {\n logger.info(\"MsalProvider - no account changes\");\n }\n break;\n }\n });\n logger.verbose(`MsalProvider - Registered event callback with id: ${callbackId}`);\n\n return () => {\n // Remove callback when component unmounts or accounts change\n if (callbackId) {\n logger.verbose(`MsalProvider - Removing event callback ${callbackId}`);\n instance.removeEventCallback(callbackId);\n }\n };\n }, [instance, accounts, logger]);\n\n useEffect(() => {\n const callbackId = instance.addEventCallback((message: EventMessage) => {\n const status = EventMessageUtils.getInteractionStatusFromEvent(message, inProgressRef.current);\n if (status !== null) {\n logger.info(`MsalProvider - ${message.eventType} results in setting inProgress from ${inProgressRef.current} to ${status}`);\n inProgressRef.current = status;\n setInProgress(status);\n }\n });\n logger.verbose(`MsalProvider - Registered event callback with id: ${callbackId}`);\n\n instance.handleRedirectPromise().catch(() => {\n // Errors should be handled by listening to the LOGIN_FAILURE event\n return;\n }).finally(() => {\n /*\n * If handleRedirectPromise returns a cached promise the necessary events may not be fired\n * This is a fallback to prevent inProgress from getting stuck in 'startup'\n */\n if (inProgressRef.current === InteractionStatus.Startup) {\n inProgressRef.current = InteractionStatus.None;\n setInProgress(InteractionStatus.None);\n }\n });\n\n return () => {\n if (callbackId) {\n logger.verbose(`MsalProvider - Removing event callback ${callbackId}`);\n instance.removeEventCallback(callbackId);\n }\n };\n }, [instance, logger]);\n\n const contextValue: IMsalContext = {\n instance,\n inProgress,\n accounts,\n logger\n };\n\n return (\n <MsalContext.Provider value={contextValue}>\n {children}\n </MsalContext.Provider>\n );\n}\n\n","/*\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { useContext } from \"react\";\nimport { IMsalContext, MsalContext } from \"../MsalContext\";\n\n/**\n * Returns Msal Context values\n */\nexport const useMsal = (): IMsalContext => useContext(MsalContext);\n","/*\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { useState, useEffect } from \"react\";\nimport { AccountInfo, IPublicClientApplication, InteractionStatus, AccountEntity } from \"@azure/msal-browser\";\nimport { useMsal } from \"./useMsal\";\nimport { AccountIdentifiers } from \"../types/AccountIdentifiers\";\n\nfunction getAccount(instance: IPublicClientApplication, accountIdentifiers: AccountIdentifiers): AccountInfo | null {\n const allAccounts = instance.getAllAccounts();\n if (allAccounts.length > 0 && (accountIdentifiers.homeAccountId || accountIdentifiers.localAccountId || accountIdentifiers.username)) {\n const matchedAccounts = allAccounts.filter(accountObj => {\n if (accountIdentifiers.username && accountIdentifiers.username.toLowerCase() !== accountObj.username.toLowerCase()) {\n return false;\n }\n if (accountIdentifiers.homeAccountId && accountIdentifiers.homeAccountId.toLowerCase() !== accountObj.homeAccountId.toLowerCase()) {\n return false;\n }\n if (accountIdentifiers.localAccountId && accountIdentifiers.localAccountId.toLowerCase() !== accountObj.localAccountId.toLowerCase()) {\n return false;\n }\n\n return true;\n });\n\n return matchedAccounts[0] || null;\n } else {\n return null;\n }\n}\n\n/**\n * Given 1 or more accountIdentifiers, returns the Account object if the user is signed-in\n * @param accountIdentifiers \n */\nexport function useAccount(accountIdentifiers: AccountIdentifiers): AccountInfo | null {\n const { instance, inProgress } = useMsal();\n\n const initialStateValue = inProgress === InteractionStatus.Startup ? null : getAccount(instance, accountIdentifiers);\n const [account, setAccount] = useState<AccountInfo|null>(initialStateValue);\n\n useEffect(() => {\n const currentAccount = getAccount(instance, accountIdentifiers);\n if (!AccountEntity.accountInfoIsEqual(account, currentAccount, true)) {\n setAccount(currentAccount);\n }\n }, [inProgress, accountIdentifiers, instance, account]);\n\n return account;\n}\n","/*\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { useState, useEffect } from \"react\";\nimport { useMsal } from \"./useMsal\";\nimport { AccountIdentifiers } from \"../types/AccountIdentifiers\";\nimport { useAccount } from \"./useAccount\";\nimport { AccountInfo, InteractionStatus } from \"@azure/msal-browser\";\n\nfunction isAuthenticated(allAccounts: AccountIdentifiers[], account: AccountInfo | null, matchAccount?: AccountIdentifiers): boolean {\n if(matchAccount && (matchAccount.username || matchAccount.homeAccountId || matchAccount.localAccountId)) {\n return !!account;\n } \n\n return allAccounts.length > 0;\n}\n\n/**\n * 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\n * @param matchAccount \n */\nexport function useIsAuthenticated(matchAccount?: AccountIdentifiers): boolean {\n const { accounts: allAccounts, inProgress } = useMsal();\n const account = useAccount(matchAccount || {});\n\n const initialStateValue = inProgress === InteractionStatus.Startup ? false : isAuthenticated(allAccounts, account, matchAccount);\n const [hasAuthenticated, setHasAuthenticated] = useState<boolean>(initialStateValue);\n\n useEffect(() => {\n setHasAuthenticated(isAuthenticated(allAccounts, account, matchAccount));\n }, [allAccounts, account, matchAccount]);\n\n return hasAuthenticated;\n}\n","/*\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport React, { PropsWithChildren, useMemo } from \"react\";\nimport { AccountIdentifiers } from \"../types/AccountIdentifiers\";\nimport { getChildrenOrFunction } from \"../utils/utilities\";\nimport { useMsal } from \"../hooks/useMsal\";\nimport { useIsAuthenticated } from \"../hooks/useIsAuthenticated\";\nimport { InteractionStatus } from \"@azure/msal-browser\";\n\nexport type AuthenticatedTemplateProps = PropsWithChildren<AccountIdentifiers>;\n\n/**\n * Renders child components if user is authenticated\n * @param props \n */\nexport function AuthenticatedTemplate({ username, homeAccountId, localAccountId, children }: AuthenticatedTemplateProps): React.ReactElement|null {\n const context = useMsal();\n const accountIdentifier: AccountIdentifiers = useMemo(() => {\n return {\n username,\n homeAccountId,\n localAccountId\n };\n }, [username, homeAccountId, localAccountId]);\n const isAuthenticated = useIsAuthenticated(accountIdentifier);\n\n if (isAuthenticated && context.inProgress !== InteractionStatus.Startup) {\n return (\n <React.Fragment>\n {getChildrenOrFunction(children, context)}\n </React.Fragment>\n );\n }\n return null;\n}\n","/*\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport React, { PropsWithChildren, useMemo } from \"react\";\nimport { useMsal } from \"../hooks/useMsal\";\nimport { useIsAuthenticated } from \"../hooks/useIsAuthenticated\";\nimport { getChildrenOrFunction } from \"../utils/utilities\";\nimport { AccountIdentifiers } from \"../types/AccountIdentifiers\";\nimport { InteractionStatus } from \"@azure/msal-browser\";\n\nexport type UnauthenticatedTemplateProps = PropsWithChildren<AccountIdentifiers>;\n\n/**\n * Renders child components if user is unauthenticated\n * @param props \n */\nexport function UnauthenticatedTemplate({ username, homeAccountId, localAccountId, children }: UnauthenticatedTemplateProps): React.ReactElement|null {\n const context = useMsal();\n const accountIdentifier: AccountIdentifiers = useMemo(() => {\n return {\n username,\n homeAccountId,\n localAccountId\n };\n }, [username, homeAccountId, localAccountId]);\n const isAuthenticated = useIsAuthenticated(accountIdentifier);\n\n if (!isAuthenticated && context.inProgress !== InteractionStatus.Startup && context.inProgress !== InteractionStatus.HandleRedirect) {\n return (\n <React.Fragment>\n {getChildrenOrFunction(children, context)}\n </React.Fragment>\n );\n }\n return null;\n}\n","/*\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { useCallback, useEffect, useState } from \"react\";\nimport { PopupRequest, RedirectRequest, SsoSilentRequest, InteractionType, AuthenticationResult, AuthError, EventMessage, EventType, InteractionStatus } from \"@azure/msal-browser\";\nimport { useIsAuthenticated } from \"./useIsAuthenticated\";\nimport { AccountIdentifiers } from \"../types/AccountIdentifiers\";\nimport { useMsal } from \"./useMsal\";\n\nexport type MsalAuthenticationResult = {\n login: Function; \n result: AuthenticationResult|null;\n error: AuthError|null;\n};\n\n/**\n * Invokes a login call if a user is not currently signed-in. Failed logins can be retried using the login callback returned.\n * Optionally provide a request object to be used in the login call.\n * Optionally provide a specific user that should be logged in.\n * @param interactionType \n * @param authenticationRequest \n * @param accountIdentifiers \n */\nexport function useMsalAuthentication(\n interactionType: InteractionType, \n authenticationRequest?: PopupRequest|RedirectRequest|SsoSilentRequest, \n accountIdentifiers?: AccountIdentifiers\n): MsalAuthenticationResult {\n const { instance, inProgress, logger } = useMsal();\n const isAuthenticated = useIsAuthenticated(accountIdentifiers);\n const [[result, error], setResponse] = useState<[AuthenticationResult|null, AuthError|null]>([null, null]);\n const [hasBeenCalled, setHasBeenCalled] = useState<boolean>(false);\n\n const login = useCallback(async (callbackInteractionType?: InteractionType, callbackRequest?: PopupRequest|RedirectRequest|SsoSilentRequest): Promise<AuthenticationResult|null> => {\n const loginType = callbackInteractionType || interactionType;\n const loginRequest = callbackRequest || authenticationRequest;\n switch (loginType) {\n case InteractionType.Popup:\n logger.verbose(\"useMsalAuthentication - Calling loginPopup\");\n return instance.loginPopup(loginRequest as PopupRequest);\n case InteractionType.Redirect:\n // This promise is not expected to resolve due to full frame redirect\n logger.verbose(\"useMsalAuthentication - Calling loginRedirect\");\n return instance.loginRedirect(loginRequest as RedirectRequest).then(null);\n case InteractionType.Silent:\n logger.verbose(\"useMsalAuthentication - Calling ssoSilent\");\n return instance.ssoSilent(loginRequest as SsoSilentRequest);\n default:\n throw \"Invalid interaction type provided.\";\n }\n }, [instance, interactionType, authenticationRequest, logger]);\n\n useEffect(() => {\n const callbackId = instance.addEventCallback((message: EventMessage) => {\n switch(message.eventType) {\n case EventType.LOGIN_SUCCESS:\n case EventType.SSO_SILENT_SUCCESS:\n if (message.payload) {\n setResponse([message.payload as AuthenticationResult, null]);\n }\n break;\n case EventType.LOGIN_FAILURE:\n case EventType.SSO_SILENT_FAILURE:\n if (message.error) {\n setResponse([null, message.error as AuthError]);\n }\n break;\n }\n });\n logger.verbose(`useMsalAuthentication - Registered event callback with id: ${callbackId}`);\n\n return () => {\n if (callbackId) {\n logger.verbose(`useMsalAuthentication - Removing event callback ${callbackId}`);\n instance.removeEventCallback(callbackId);\n }\n };\n }, [instance, logger]);\n\n useEffect(() => {\n if (!hasBeenCalled && !error && !isAuthenticated && inProgress === InteractionStatus.None) {\n logger.info(\"useMsalAuthentication - No user is authenticated, attempting to login\");\n // Ensure login is only called one time from within this hook, any subsequent login attempts should use the callback returned\n setHasBeenCalled(true);\n login().catch(() => {\n // Errors are handled by the event handler above\n return;\n });\n }\n }, [isAuthenticated, inProgress, error, hasBeenCalled, login, logger]);\n\n return { login, result, error };\n}\n","/*\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport React, { PropsWithChildren, useMemo } from \"react\";\nimport { AccountIdentifiers } from \"../types/AccountIdentifiers\";\nimport { getChildrenOrFunction } from \"../utils/utilities\";\nimport { useMsal } from \"../hooks/useMsal\";\nimport { MsalAuthenticationResult, useMsalAuthentication } from \"../hooks/useMsalAuthentication\";\nimport { useIsAuthenticated } from \"../hooks/useIsAuthenticated\";\nimport { InteractionType, PopupRequest, RedirectRequest, SsoSilentRequest, InteractionStatus } from \"@azure/msal-browser\";\nimport { IMsalContext } from \"../MsalContext\";\n\nexport type MsalAuthenticationProps = PropsWithChildren<AccountIdentifiers & {\n interactionType: InteractionType;\n authenticationRequest?: PopupRequest|RedirectRequest|SsoSilentRequest;\n loadingComponent?: React.ElementType<IMsalContext>;\n errorComponent?: React.ElementType<MsalAuthenticationResult>;\n}>;\n\n/**\n * Attempts to authenticate user if not already authenticated, then renders child components\n * @param props\n */\nexport function MsalAuthenticationTemplate({ \n interactionType, \n username, \n homeAccountId, \n localAccountId,\n authenticationRequest, \n loadingComponent: LoadingComponent,\n errorComponent: ErrorComponent,\n children \n}: MsalAuthenticationProps): React.ReactElement|null {\n const accountIdentifier: AccountIdentifiers = useMemo(() => {\n return {\n username,\n homeAccountId,\n localAccountId\n };\n }, [username, homeAccountId, localAccountId]);\n const context = useMsal();\n const msalAuthResult = useMsalAuthentication(interactionType, authenticationRequest, accountIdentifier);\n const isAuthenticated = useIsAuthenticated(accountIdentifier);\n\n if (msalAuthResult.error && context.inProgress === InteractionStatus.None) {\n if (!!ErrorComponent) {\n return <ErrorComponent {...msalAuthResult} />;\n }\n\n throw msalAuthResult.error;\n }\n \n if (isAuthenticated) {\n return (\n <React.Fragment>\n {getChildrenOrFunction(children, msalAuthResult)}\n </React.Fragment>\n );\n } \n \n if (!!LoadingComponent && context.inProgress !== InteractionStatus.None) {\n return <LoadingComponent {...context} />;\n }\n\n return null;\n}\n","/*\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport React from \"react\";\nimport { IMsalContext } from \"../MsalContext\";\nimport { useMsal } from \"../hooks/useMsal\";\nimport { Subtract } from \"../utils/utilities\";\n\nexport type WithMsalProps = {\n msalContext: IMsalContext;\n};\n\n/**\n * Higher order component wraps provided component with msal by injecting msal context values into the component's props \n * @param Component \n */\nexport const withMsal = <P extends WithMsalProps>(Component: React.ComponentType<P>): React.FunctionComponent<Subtract<P,WithMsalProps>> => {\n const ComponentWithMsal: React.FunctionComponent<Subtract<P,WithMsalProps>> = props => {\n const msal = useMsal();\n return <Component {...(props as P)} msalContext={msal} />;\n };\n\n const componentName =\n Component.displayName || Component.name || \"Component\";\n ComponentWithMsal.displayName = `withMsal(${componentName})`;\n\n return ComponentWithMsal;\n};\n"],"names":["defaultMsalContext","instance","stubbedPublicClientApplication","inProgress","InteractionStatus","None","accounts","logger","Logger","MsalContext","React","MsalConsumer","Consumer","getChildrenOrFunction","children","args","accountArraysAreEqual","arrayA","arrayB","length","comparisonArray","every","elementA","elementB","shift","homeAccountId","localAccountId","username","name","version","MsalProvider","useEffect","initializeWrapperLibrary","WrapperSKU","useMemo","getLogger","clone","SKU","setAccounts","useState","setInProgress","Startup","inProgressRef","useRef","callbackId","addEventCallback","message","eventType","EventType","ACCOUNT_ADDED","ACCOUNT_REMOVED","LOGIN_SUCCESS","SSO_SILENT_SUCCESS","HANDLE_REDIRECT_END","LOGIN_FAILURE","SSO_SILENT_FAILURE","LOGOUT_END","ACQUIRE_TOKEN_SUCCESS","ACQUIRE_TOKEN_FAILURE","currentAccounts","getAllAccounts","info","verbose","removeEventCallback","status","EventMessageUtils","getInteractionStatusFromEvent","current","handleRedirectPromise","catch","finally","contextValue","Provider","value","useMsal","useContext","getAccount","accountIdentifiers","allAccounts","matchedAccounts","filter","accountObj","toLowerCase","useAccount","initialStateValue","account","setAccount","currentAccount","AccountEntity","accountInfoIsEqual","isAuthenticated","matchAccount","useIsAuthenticated","hasAuthenticated","setHasAuthenticated","AuthenticatedTemplate","context","accountIdentifier","Fragment","UnauthenticatedTemplate","HandleRedirect","useMsalAuthentication","interactionType","authenticationRequest","result","error","setResponse","hasBeenCalled","setHasBeenCalled","login","useCallback","callbackInteractionType","callbackRequest","loginType","loginRequest","InteractionType","Popup","loginPopup","Redirect","loginRedirect","then","Silent","ssoSilent","payload","MsalAuthenticationTemplate","loadingComponent","LoadingComponent","errorComponent","ErrorComponent","msalAuthResult","withMsal","Component","ComponentWithMsal","props","msal","msalContext","componentName","displayName"],"mappings":";;;AAAA;;;;AAeA;;;;;AAIA,MAAMA,kBAAkB,GAAiB;AACrCC,EAAAA,QAAQ,EAAEC,8BAD2B;AAErCC,EAAAA,UAAU,EAAEC,iBAAiB,CAACC,IAFO;AAGrCC,EAAAA,QAAQ,EAAE,EAH2B;AAIrCC,EAAAA,MAAM,eAAE,IAAIC,MAAJ,CAAW,EAAX;AAJ6B,CAAzC;MAOaC,WAAW,gBAAGC,aAAA,CACvBV,kBADuB;MAGdW,YAAY,GAAGF,WAAW,CAACG;;AC7BxC;;;;AASA,SAAgBC,sBACZC,UACAC;AAEA,MAAI,OAAOD,QAAP,KAAoB,UAAxB,EAAoC;AAChC,WAAOA,QAAQ,CAACC,IAAD,CAAf;AACH;;AACD,SAAOD,QAAP;AACH;AAUD;;;;;;;AAMA,SAAgBE,sBAAsBC,QAAmCC;AACrE,MAAID,MAAM,CAACE,MAAP,KAAkBD,MAAM,CAACC,MAA7B,EAAqC;AACjC,WAAO,KAAP;AACH;;AAED,QAAMC,eAAe,GAAG,CAAC,GAAGF,MAAJ,CAAxB;AAEA,SAAOD,MAAM,CAACI,KAAP,CAAcC,QAAD;AAChB,UAAMC,QAAQ,GAAGH,eAAe,CAACI,KAAhB,EAAjB;;AACA,QAAI,CAACF,QAAD,IAAa,CAACC,QAAlB,EAA4B;AACxB,aAAO,KAA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,QAAMC,iBAAiB,GAAuDC,KAAK;AAC/E,UAAMC,IAAI,GAAG5D,OAAO,EAApB;AACA,WAAOhE,4BAAA,CAACyH,SAAD,oBAAgBE;AAAaE,MAAAA,WAAW,EAAED;MAA1C,CAAP;AACH,GAHD;;AAKA,QAAME,aAAa,GACfL,SAAS,CAACM,WAAV,IAAyBN,SAAS,CAACvG,IAAnC,IAA2C,WAD/C;AAEAwG,EAAAA,iBAAiB,CAACK,WAAlB,eAA4CD,gBAA5C;AAEA,SAAOJ,iBAAP;AACH,CAXM;;;;"}
@@ -1,2 +1,2 @@
1
1
  export declare const name = "@azure/msal-react";
2
- export declare const version = "1.0.2";
2
+ export declare const version = "1.2.0";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@azure/msal-react",
3
- "version": "1.0.2",
3
+ "version": "1.2.0",
4
4
  "author": {
5
5
  "name": "Microsoft",
6
6
  "email": "nugetaad@microsoft.com",
@@ -20,6 +20,11 @@
20
20
  "engines": {
21
21
  "node": ">=10"
22
22
  },
23
+ "beachball": {
24
+ "disallowedChangeTypes": [
25
+ "major"
26
+ ]
27
+ },
23
28
  "scripts": {
24
29
  "start": "tsdx watch",
25
30
  "build": "tsdx build --tsconfig ./tsconfig.build.json",
@@ -32,15 +37,16 @@
32
37
  "build:all": "npm run build:common && npm run build:browser && npm run build",
33
38
  "build:browser": "cd ../msal-browser && npm run build",
34
39
  "build:common": "cd ../msal-common && npm run build",
40
+ "link:localDeps": "npx lerna bootstrap --scope @azure/msal-common --scope @azure/msal-browser --scope @azure/msal-react",
35
41
  "prepack": "npm run build:all"
36
42
  },
37
43
  "peerDependencies": {
38
- "@azure/msal-browser": "^2.17.0",
39
- "react": "^16.13.0 || ^17"
44
+ "@azure/msal-browser": "^2.21.0",
45
+ "react": "^16.8.0 || ^17"
40
46
  },
41
47
  "module": "dist/msal-react.esm.js",
42
48
  "devDependencies": {
43
- "@azure/msal-browser": "^2.17.0",
49
+ "@azure/msal-browser": "^2.21.0",
44
50
  "@testing-library/jest-dom": "^5.11.5",
45
51
  "@testing-library/react": "^11.2.3",
46
52
  "@types/jest": "^26.0.15",