Loading
function(t,e,s){s.d(e,{At:()=>U,F6:()=>T,Mx:()=>_});var r=s(247775),u=s(636537),i=s(228366),a=s(830215),n=s(626584),c=s(495544),o=s(174459),l=s(274303),A=s(652215);let d=new n.A("MultiAccountActionCreators");function T(){let t=c.default.getId();l.A.getUsers().forEach(async e=>{let s,{id:a}=e,n=r.getToken(a);if(null==n||""===n)return void i.h.dispatch({type:"MULTI_ACCOUNT_VALIDATE_TOKEN_FAILURE",userId:a});i.h.dispatch({type:"MULTI_ACCOUNT_VALIDATE_TOKEN_REQUEST",userId:a});try{s=await u.Bo.get({url:A.Rsh.ME,headers:{authorization:n},retries:3,rejectWithError:!1})}catch(e){let t=e?.status===401||e?.status===403;i.h.dispatch({type:t?"MULTI_ACCOUNT_VALIDATE_TOKEN_FAILURE":"MULTI_ACCOUNT_VALIDATE_TOKEN_SUCCESS",userId:a});return}let c=s.body?.id??null;if(null!=c&&c!==a){let t={expected_user_id:a,actual_user_id:c};d.log("Found per-user token authentication mismatch",t),o.default.track(A.HAw.MULTI_ACCOUNT_VALIDATE_TOKEN_USER_MISMATCH,t)}t!==a&&i.h.dispatch({type:"USER_UPDATE",user:s.body}),i.h.dispatch({type:"MULTI_ACCOUNT_VALIDATE_TOKEN_SUCCESS",userId:a})})}function _(t,e,s){d.log(`Switching account to ${t}`,{switchSynchronously:e});let u=r.getToken(t);return null==u?(d.log("Switching accounts failed because there was no token"),i.h.dispatch({type:"MULTI_ACCOUNT_VALIDATE_TOKEN_FAILURE",userId:t}),Promise.resolve()):(i.h.dispatch({type:"MULTI_ACCOUNT_SWITCH_START",targetUserId:t,location:s??null}),a.A.switchAccountToken(u,e))}function U(t){i.h.dispatch({type:"MULTI_ACCOUNT_REMOVE_ACCOUNT",userId:t})}}