Module 294323

1,646 characters · in 3510774df3495ade.js
Dependencies
Required by (2)
Lazily required by (0)none
Lazily requires (0)none
Source Raw
function(e,t,n){n.d(t,{A:()=>h});var l=n(64700),i=n(17928),s=n(587895),a=n(429913),r=n(201718),o=n(339580),u=n(207803),c=n(633075),d=n(841595),m=n(903209),p=n(385113),g=n(369374),f=n(188951);function h(e,t,n){var h,A,x,E;let v,C,{enabled:I}=g.A.useConfig({location:n??"use_user_application_widget_data"}),_=function(e){let{data:t,isLoading:n}=(0,u.FY)();return null==e?[!1,null]:[n,t?.find(t=>t.applicationId===e)??null]}(I?null:t),j=(h=I?t:null,(0,f.A)(null!=h?[h]:[]),(0,i.yK)([p.A],()=>{if(null==h)return[!1,null];let e=p.A.getConfig(h)??null,t=p.A.getFetchState(h);return[(t===p.e.NOT_FETCHED||t===p.e.FETCHING)&&null==e,e]},[h])),[S,N]=I?j:_,[b,y]=(A=null!=N?t:null,v=(0,a.h)(A),[(0,i.bG)([s.A],()=>null!=A&&s.A.isFetchingApplication(A),[A])&&null==v,v??null]),w=null!=N&&null!=y,[T,R]=(x=w?e:null,E=w?t:null,C=(0,i.bG)([o.A],()=>null!=x&&o.A.getFetchState(x)===o.e.NOT_FETCHED,[x]),l.useEffect(()=>{C&&null!=x&&r.A.fetchUserApplicationIdentitiesWithProfiles(x)},[C,x]),(0,i.yK)([o.A],()=>{if(null==x||null==E)return[!1,null];let e=o.A.getUserIdentityByApplication(x,E)??null;return[(o.A.isFetchingUser(x)||o.A.getFetchState(x)===o.e.NOT_FETCHED)&&null==e,e]},[x,E])),[k,D]=function(e){let[t,n]=(0,i.yK)([d.A],()=>null!=e?[d.A.isFetchingProfile(e),d.A.getUserProfile(e)??null]:[!1,null],[e]),s=null!=e&&!t&&null==n;return l.useEffect(()=>{s&&null!=e&&(0,m.A)(e)},[s,e]),[(t||s)&&null==n,n]}(w?e:null),O=S||b||T||k;return l.useMemo(()=>({isV2:I,isLoading:O,application:y,applicationWidgetConfig:N,userApplicationIdentity:R,profileApplicationWidget:D?.widgets?.find(e=>null!=t&&e instanceof c.R&&e.applicationId===t)??null}),[y,t,N,R,O,I,D])}}