Build 576754stable
Module 10005
1,857 characters · in 90ca6aff7146f241.jsDependencies
Source Raw
function(e,t,a){a.d(t,{A:()=>h});var l=a(64700),i=a(913122),c=a(899847),n=a(695515),s=a(191627);function h(e){let{onError:t,onSuccess:a}=e??{},[h,r]=l.useState(!1),[u,d]=l.useState(!1),[y,w]=l.useState(!1),[f,o]=l.useState(!1),[v,A]=l.useState(!1),[L,C]=l.useState(!1),[k,p]=l.useState(!1),[g,E]=l.useState(!1),I=h||u||y||f||L||g,T=l.useCallback(async e=>{if(!I){r(!0);try{await (0,c.nt)(e,s.Ef.ACTIVE),a?.()}catch(a){let e=new i.LG(a);t?.(e)}finally{r(!1)}}},[I,t,a]),b=l.useCallback(async e=>{if(!I){d(!0);try{await (0,c.nt)(e,s.Ef.DECLINED),a?.()}catch(a){let e=new i.LG(a);t?.(e)}finally{d(!1)}}},[I,t,a]),R=l.useCallback(async e=>{if(!I){w(!0);try{await (0,c.nt)(e,s.Ef.INACTIVE),a?.()}catch(a){let e=new i.LG(a);t?.(e)}finally{w(!1)}}},[I,t,a]),S=l.useCallback(async e=>{if(!I){o(!0);try{await (0,c.e$)(e),a?.()}catch(a){let e=new i.LG(a);t?.(e)}finally{o(!1)}}},[I,t,a]),m=l.useCallback(async()=>{if(!v){A(!0);try{await (0,c.HB)(),a?.()}catch(a){let e=new i.LG(a);t?.(e)}finally{A(!1)}}},[v,t,a]),M=l.useCallback(async e=>{if(!k){p(!0);try{await c.Ay.fetchTeenActivity(e),a?.()}catch(a){let e=new i.LG(a);t?.(e)}finally{p(!1)}}},[k,t,a]);return{acceptLinkRequest:T,declineLinkRequest:b,disconnectLinkRequest:R,cancelLinkRequest:S,selectTeenUser:M,getLinkCode:m,requestLink:l.useCallback(async(e,l)=>{if(!L){C(!0);try{await c.Ay.requestLink(e,l),a?.()}catch(a){let e=new i.LG(a);t?.(e)}finally{C(!1)}}},[L,t,a]),loadMore:l.useCallback(async e=>{let a=n.A.getActionsForDisplayType(e),l=a[a.length-1],s=n.A.getStartId(),h=n.A.getSelectedTeenId();if(!g&&null!=s&&null!=h){E(!0);try{await c.Ay.fetchMoreTeenActivity(h,e,s,l.event_id)}catch(a){let e=new i.LG(a);t?.(e)}finally{E(!1)}}},[g,t]),isAcceptLoading:h,isDeclineLoading:u,isDisconnectLoading:y,isCancelLoading:f,isGetLinkCodeLoading:v,isSelectTeenUserLoading:k,isRequestingLink:L,isMoreLoading:g}}}