New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@azure/msal-react

Package Overview
Dependencies
Maintainers
3
Versions
84
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@azure/msal-react - npm Package Compare versions

Comparing version 1.1.1 to 1.1.2

29

CHANGELOG.json

@@ -5,2 +5,31 @@ {

{
"date": "Tue, 07 Dec 2021 00:17:01 GMT",
"tag": "@azure/msal-react_v1.1.2",
"version": "1.1.2",
"comments": {
"none": [
{
"author": "thomas.norling@microsoft.com",
"package": "@azure/msal-react",
"commit": "02dbd9172368bfc69e4a47f01a3ada0b96345c81",
"comment": "Package.json updates"
}
],
"patch": [
{
"author": "thomas.norling@microsoft.com",
"package": "@azure/msal-react",
"commit": "54d0d9457e39691222c40b106b8c674dc3e4d761",
"comment": "Fix inProgress stuck in startup state #4302"
},
{
"author": "beachball",
"package": "@azure/msal-react",
"comment": "Bump @azure/msal-browser to v2.20.0",
"commit": "d7c209f7aa3ae4380a77a31ff1319fbf7201ae45"
}
]
}
},
{
"date": "Mon, 01 Nov 2021 23:53:22 GMT",

@@ -7,0 +36,0 @@ "tag": "@azure/msal-react_v1.1.1",

11

CHANGELOG.md
# Change Log - @azure/msal-react
This log was last generated on Mon, 01 Nov 2021 23:53:22 GMT and should not be manually modified.
This log was last generated on Tue, 07 Dec 2021 00:17:01 GMT and should not be manually modified.
<!-- Start content -->
## 1.1.2
Tue, 07 Dec 2021 00:17:01 GMT
### Patches
- Fix inProgress stuck in startup state #4302 (thomas.norling@microsoft.com)
- Bump @azure/msal-browser to v2.20.0
## 1.1.1

@@ -8,0 +17,0 @@

@@ -66,3 +66,3 @@ 'use strict';

const name = "@azure/msal-react";
const version = "1.1.1";
const version = "1.1.2";

@@ -138,2 +138,11 @@ /*

return;
}).finally(() => {
/*
* If handleRedirectPromise returns a cached promise the necessary events may not be fired
* This is a fallback to prevent inProgress from getting stuck in 'startup'
*/
if (inProgressRef.current === msalBrowser.InteractionStatus.Startup) {
inProgressRef.current = msalBrowser.InteractionStatus.None;
setInProgress(msalBrowser.InteractionStatus.None);
}
});

@@ -140,0 +149,0 @@ return () => {

2

dist/msal-react.cjs.production.min.js

@@ -1,2 +0,2 @@

"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t=require("react"),n=(e=t)&&"object"==typeof e&&"default"in e?e.default:e,o=require("@azure/msal-browser");const c=t.createContext({instance:o.stubbedPublicClientApplication,inProgress:o.InteractionStatus.None,accounts:[],logger:new o.Logger({})}),r=c.Consumer;function a(e,t){return"function"==typeof e?e(t):e}const s=()=>t.useContext(c);function u(e,t){const n=e.getAllAccounts();return n.length>0&&(t.homeAccountId||t.localAccountId||t.username)&&n.filter(e=>!(t.username&&t.username.toLowerCase()!==e.username.toLowerCase()||t.homeAccountId&&t.homeAccountId.toLowerCase()!==e.homeAccountId.toLowerCase()||t.localAccountId&&t.localAccountId.toLowerCase()!==e.localAccountId.toLowerCase()))[0]||null}function l(e){const{instance:n,inProgress:c}=s(),r=c===o.InteractionStatus.Startup?null:u(n,e),[a,l]=t.useState(r);return t.useEffect(()=>{const t=u(n,e);o.AccountEntity.accountInfoIsEqual(a,t,!0)||l(t)},[c,e,n,a]),a}function i(e,t,n){return n&&(n.username||n.homeAccountId||n.localAccountId)?!!t:e.length>0}function d(e){const{accounts:n,inProgress:c}=s(),r=l(e||{}),a=c!==o.InteractionStatus.Startup&&i(n,r,e),[u,d]=t.useState(a);return t.useEffect(()=>{d(i(n,r,e))},[n,r,e]),u}function p(e,n,c){const{instance:r,inProgress:a,logger:u}=s(),l=d(c),[[i,p],m]=t.useState([null,null]),[E,v]=t.useState(!1),I=t.useCallback(async(t,c)=>{const a=c||n;switch(t||e){case o.InteractionType.Popup:return u.verbose("useMsalAuthentication - Calling loginPopup"),r.loginPopup(a);case o.InteractionType.Redirect:return u.verbose("useMsalAuthentication - Calling loginRedirect"),r.loginRedirect(a).then(null);case o.InteractionType.Silent:return u.verbose("useMsalAuthentication - Calling ssoSilent"),r.ssoSilent(a);default:throw"Invalid interaction type provided."}},[r,e,n,u]);return t.useEffect(()=>{const e=r.addEventCallback(e=>{switch(e.eventType){case o.EventType.LOGIN_SUCCESS:case o.EventType.SSO_SILENT_SUCCESS:e.payload&&m([e.payload,null]);break;case o.EventType.LOGIN_FAILURE:case o.EventType.SSO_SILENT_FAILURE:e.error&&m([null,e.error])}});return u.verbose("useMsalAuthentication - Registered event callback with id: "+e),()=>{e&&(u.verbose("useMsalAuthentication - Removing event callback "+e),r.removeEventCallback(e))}},[r,u]),t.useEffect(()=>{E||p||l||a!==o.InteractionStatus.None||(u.info("useMsalAuthentication - No user is authenticated, attempting to login"),v(!0),I().catch(()=>{}))},[l,a,p,E,I,u]),{login:I,result:i,error:p}}exports.AuthenticatedTemplate=function({username:e,homeAccountId:c,localAccountId:r,children:u}){const l=s();return d(t.useMemo(()=>({username:e,homeAccountId:c,localAccountId:r}),[e,c,r]))&&l.inProgress!==o.InteractionStatus.Startup?n.createElement(n.Fragment,null,a(u,l)):null},exports.MsalAuthenticationTemplate=function({interactionType:e,username:c,homeAccountId:r,localAccountId:u,authenticationRequest:l,loadingComponent:i,errorComponent:m,children:E}){const v=t.useMemo(()=>({username:c,homeAccountId:r,localAccountId:u}),[c,r,u]),I=s(),g=p(e,l,v),A=d(v);if(g.error&&I.inProgress===o.InteractionStatus.None){if(m)return n.createElement(m,Object.assign({},g));throw g.error}return A?n.createElement(n.Fragment,null,a(E,g)):i&&I.inProgress!==o.InteractionStatus.None?n.createElement(i,Object.assign({},I)):null},exports.MsalConsumer=r,exports.MsalContext=c,exports.MsalProvider=function({instance:e,children:r}){t.useEffect(()=>{e.initializeWrapperLibrary(o.WrapperSKU.React,"1.1.1")},[e]);const a=t.useMemo(()=>e.getLogger().clone("@azure/msal-react","1.1.1"),[e]),[s,u]=t.useState([]),[l,i]=t.useState(o.InteractionStatus.Startup),d=t.useRef(l);return t.useEffect(()=>{const t=e.addEventCallback(t=>{switch(t.eventType){case o.EventType.ACCOUNT_ADDED:case o.EventType.ACCOUNT_REMOVED:case o.EventType.LOGIN_SUCCESS:case o.EventType.SSO_SILENT_SUCCESS:case o.EventType.HANDLE_REDIRECT_END:case o.EventType.LOGIN_FAILURE:case o.EventType.SSO_SILENT_FAILURE:case o.EventType.LOGOUT_END:case o.EventType.ACQUIRE_TOKEN_SUCCESS:case o.EventType.ACQUIRE_TOKEN_FAILURE:const t=e.getAllAccounts();!function(e,t){if(e.length!==t.length)return!1;const n=[...t];return e.every(e=>{const t=n.shift();return!(!e||!t)&&e.homeAccountId===t.homeAccountId&&e.localAccountId===t.localAccountId&&e.username===t.username})}(t,s)?(a.info("MsalProvider - updating account state"),u(t)):a.info("MsalProvider - no account changes")}});return a.verbose("MsalProvider - Registered event callback with id: "+t),()=>{t&&(a.verbose("MsalProvider - Removing event callback "+t),e.removeEventCallback(t))}},[e,s,a]),t.useEffect(()=>{const t=e.addEventCallback(e=>{const t=o.EventMessageUtils.getInteractionStatusFromEvent(e,d.current);null!==t&&(a.info(`MsalProvider - ${e.eventType} results in setting inProgress from ${d.current} to ${t}`),d.current=t,i(t))});return a.verbose("MsalProvider - Registered event callback with id: "+t),e.handleRedirectPromise().catch(()=>{}),()=>{t&&(a.verbose("MsalProvider - Removing event callback "+t),e.removeEventCallback(t))}},[e,a]),n.createElement(c.Provider,{value:{instance:e,inProgress:l,accounts:s,logger:a}},r)},exports.UnauthenticatedTemplate=function({username:e,homeAccountId:c,localAccountId:r,children:u}){const l=s();return d(t.useMemo(()=>({username:e,homeAccountId:c,localAccountId:r}),[e,c,r]))||l.inProgress===o.InteractionStatus.Startup||l.inProgress===o.InteractionStatus.HandleRedirect?null:n.createElement(n.Fragment,null,a(u,l))},exports.useAccount=l,exports.useIsAuthenticated=d,exports.useMsal=s,exports.useMsalAuthentication=p,exports.version="1.1.1",exports.withMsal=e=>{const t=t=>{const o=s();return n.createElement(e,Object.assign({},t,{msalContext:o}))};return t.displayName=`withMsal(${e.displayName||e.name||"Component"})`,t};
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t=require("react"),n=(e=t)&&"object"==typeof e&&"default"in e?e.default:e,o=require("@azure/msal-browser");const r=t.createContext({instance:o.stubbedPublicClientApplication,inProgress:o.InteractionStatus.None,accounts:[],logger:new o.Logger({})}),c=r.Consumer;function a(e,t){return"function"==typeof e?e(t):e}const s=()=>t.useContext(r);function u(e,t){const n=e.getAllAccounts();return n.length>0&&(t.homeAccountId||t.localAccountId||t.username)&&n.filter(e=>!(t.username&&t.username.toLowerCase()!==e.username.toLowerCase()||t.homeAccountId&&t.homeAccountId.toLowerCase()!==e.homeAccountId.toLowerCase()||t.localAccountId&&t.localAccountId.toLowerCase()!==e.localAccountId.toLowerCase()))[0]||null}function l(e){const{instance:n,inProgress:r}=s(),c=r===o.InteractionStatus.Startup?null:u(n,e),[a,l]=t.useState(c);return t.useEffect(()=>{const t=u(n,e);o.AccountEntity.accountInfoIsEqual(a,t,!0)||l(t)},[r,e,n,a]),a}function i(e,t,n){return n&&(n.username||n.homeAccountId||n.localAccountId)?!!t:e.length>0}function d(e){const{accounts:n,inProgress:r}=s(),c=l(e||{}),a=r!==o.InteractionStatus.Startup&&i(n,c,e),[u,d]=t.useState(a);return t.useEffect(()=>{d(i(n,c,e))},[n,c,e]),u}function p(e,n,r){const{instance:c,inProgress:a,logger:u}=s(),l=d(r),[[i,p],m]=t.useState([null,null]),[E,I]=t.useState(!1),v=t.useCallback(async(t,r)=>{const a=r||n;switch(t||e){case o.InteractionType.Popup:return u.verbose("useMsalAuthentication - Calling loginPopup"),c.loginPopup(a);case o.InteractionType.Redirect:return u.verbose("useMsalAuthentication - Calling loginRedirect"),c.loginRedirect(a).then(null);case o.InteractionType.Silent:return u.verbose("useMsalAuthentication - Calling ssoSilent"),c.ssoSilent(a);default:throw"Invalid interaction type provided."}},[c,e,n,u]);return t.useEffect(()=>{const e=c.addEventCallback(e=>{switch(e.eventType){case o.EventType.LOGIN_SUCCESS:case o.EventType.SSO_SILENT_SUCCESS:e.payload&&m([e.payload,null]);break;case o.EventType.LOGIN_FAILURE:case o.EventType.SSO_SILENT_FAILURE:e.error&&m([null,e.error])}});return u.verbose("useMsalAuthentication - Registered event callback with id: "+e),()=>{e&&(u.verbose("useMsalAuthentication - Removing event callback "+e),c.removeEventCallback(e))}},[c,u]),t.useEffect(()=>{E||p||l||a!==o.InteractionStatus.None||(u.info("useMsalAuthentication - No user is authenticated, attempting to login"),I(!0),v().catch(()=>{}))},[l,a,p,E,v,u]),{login:v,result:i,error:p}}exports.AuthenticatedTemplate=function({username:e,homeAccountId:r,localAccountId:c,children:u}){const l=s();return d(t.useMemo(()=>({username:e,homeAccountId:r,localAccountId:c}),[e,r,c]))&&l.inProgress!==o.InteractionStatus.Startup?n.createElement(n.Fragment,null,a(u,l)):null},exports.MsalAuthenticationTemplate=function({interactionType:e,username:r,homeAccountId:c,localAccountId:u,authenticationRequest:l,loadingComponent:i,errorComponent:m,children:E}){const I=t.useMemo(()=>({username:r,homeAccountId:c,localAccountId:u}),[r,c,u]),v=s(),S=p(e,l,I),g=d(I);if(S.error&&v.inProgress===o.InteractionStatus.None){if(m)return n.createElement(m,Object.assign({},S));throw S.error}return g?n.createElement(n.Fragment,null,a(E,S)):i&&v.inProgress!==o.InteractionStatus.None?n.createElement(i,Object.assign({},v)):null},exports.MsalConsumer=c,exports.MsalContext=r,exports.MsalProvider=function({instance:e,children:c}){t.useEffect(()=>{e.initializeWrapperLibrary(o.WrapperSKU.React,"1.1.2")},[e]);const a=t.useMemo(()=>e.getLogger().clone("@azure/msal-react","1.1.2"),[e]),[s,u]=t.useState([]),[l,i]=t.useState(o.InteractionStatus.Startup),d=t.useRef(l);return t.useEffect(()=>{const t=e.addEventCallback(t=>{switch(t.eventType){case o.EventType.ACCOUNT_ADDED:case o.EventType.ACCOUNT_REMOVED:case o.EventType.LOGIN_SUCCESS:case o.EventType.SSO_SILENT_SUCCESS:case o.EventType.HANDLE_REDIRECT_END:case o.EventType.LOGIN_FAILURE:case o.EventType.SSO_SILENT_FAILURE:case o.EventType.LOGOUT_END:case o.EventType.ACQUIRE_TOKEN_SUCCESS:case o.EventType.ACQUIRE_TOKEN_FAILURE:const t=e.getAllAccounts();!function(e,t){if(e.length!==t.length)return!1;const n=[...t];return e.every(e=>{const t=n.shift();return!(!e||!t)&&e.homeAccountId===t.homeAccountId&&e.localAccountId===t.localAccountId&&e.username===t.username})}(t,s)?(a.info("MsalProvider - updating account state"),u(t)):a.info("MsalProvider - no account changes")}});return a.verbose("MsalProvider - Registered event callback with id: "+t),()=>{t&&(a.verbose("MsalProvider - Removing event callback "+t),e.removeEventCallback(t))}},[e,s,a]),t.useEffect(()=>{const t=e.addEventCallback(e=>{const t=o.EventMessageUtils.getInteractionStatusFromEvent(e,d.current);null!==t&&(a.info(`MsalProvider - ${e.eventType} results in setting inProgress from ${d.current} to ${t}`),d.current=t,i(t))});return a.verbose("MsalProvider - Registered event callback with id: "+t),e.handleRedirectPromise().catch(()=>{}).finally(()=>{d.current===o.InteractionStatus.Startup&&(d.current=o.InteractionStatus.None,i(o.InteractionStatus.None))}),()=>{t&&(a.verbose("MsalProvider - Removing event callback "+t),e.removeEventCallback(t))}},[e,a]),n.createElement(r.Provider,{value:{instance:e,inProgress:l,accounts:s,logger:a}},c)},exports.UnauthenticatedTemplate=function({username:e,homeAccountId:r,localAccountId:c,children:u}){const l=s();return d(t.useMemo(()=>({username:e,homeAccountId:r,localAccountId:c}),[e,r,c]))||l.inProgress===o.InteractionStatus.Startup||l.inProgress===o.InteractionStatus.HandleRedirect?null:n.createElement(n.Fragment,null,a(u,l))},exports.useAccount=l,exports.useIsAuthenticated=d,exports.useMsal=s,exports.useMsalAuthentication=p,exports.version="1.1.2",exports.withMsal=e=>{const t=t=>{const o=s();return n.createElement(e,Object.assign({},t,{msalContext:o}))};return t.displayName=`withMsal(${e.displayName||e.name||"Component"})`,t};
//# sourceMappingURL=msal-react.cjs.production.min.js.map

@@ -59,3 +59,3 @@ import React__default, { createContext, useEffect, useMemo, useState, useRef, useContext, useCallback } from 'react';

const name = "@azure/msal-react";
const version = "1.1.1";
const version = "1.1.2";

@@ -131,2 +131,11 @@ /*

return;
}).finally(() => {
/*
* If handleRedirectPromise returns a cached promise the necessary events may not be fired
* This is a fallback to prevent inProgress from getting stuck in 'startup'
*/
if (inProgressRef.current === InteractionStatus.Startup) {
inProgressRef.current = InteractionStatus.None;
setInProgress(InteractionStatus.None);
}
});

@@ -133,0 +142,0 @@ return () => {

export declare const name = "@azure/msal-react";
export declare const version = "1.1.1";
export declare const version = "1.1.2";
{
"name": "@azure/msal-react",
"version": "1.1.1",
"version": "1.1.2",
"author": {

@@ -40,6 +40,7 @@ "name": "Microsoft",

"build:common": "cd ../msal-common && npm run build",
"link:localDeps": "npx lerna bootstrap --scope @azure/msal-common --scope @azure/msal-browser --scope @azure/msal-react",
"prepack": "npm run build:all"
},
"peerDependencies": {
"@azure/msal-browser": "^2.19.0",
"@azure/msal-browser": "^2.20.0",
"react": "^16.8.0 || ^17"

@@ -49,3 +50,3 @@ },

"devDependencies": {
"@azure/msal-browser": "^2.19.0",
"@azure/msal-browser": "^2.20.0",
"@testing-library/jest-dom": "^5.11.5",

@@ -52,0 +53,0 @@ "@testing-library/react": "^11.2.3",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc