1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[433],{53282:function(t,e,n){(window.__NEXT_P=window.__NEXT_P||[]).push(["/invitations/accept",function(){return n(80452)}])},80452:function(t,e,n){"use strict";n.r(e);var i,o,r=n(74512),s=n(46809),a=n(56719),u=n(65471),l=n(74760),c=n(7771),d=n(14438),h=n(19020),p=n(93368),f=n(35837),P=n.n(f),N=n(67526),x=n(32735);(i=o||(o={})).PENDING="PENDING",i.ACCEPTING="ACCEPTING";let y=t=>{let e=(0,f.useRouter)(),n=e.pathname+(e&&e.query?"?".concat(N.stringify(e.query)):""),{id:i,code:o}=t,u=i||"",d=(0,a.useInvitationDetailQuery)({variables:{id:u,code:o},skip:!u,fetchPolicy:"network-only"});return(0,r.jsx)(s.SharedLayout,{title:"Accept Invitation",query:d,noHandleErrors:!0,forbidWhen:s.AuthRestrict.LOGGED_OUT,children:t=>{let{currentUser:e,error:i,loading:a}=t;return e||i||a?(0,r.jsx)(l.Z,{children:(0,r.jsx)(c.Z,{flex:1,children:(0,r.jsx)(g,{currentUser:e,id:u,code:o,query:d})})}):(0,r.jsx)(s.Redirect,{href:"/login?next=".concat(encodeURIComponent(n))})}})},g=t=>{let{id:e,code:n,query:i}=t,l=(0,f.useRouter)(),{data:c,loading:N,error:y}=i,[g]=(0,a.useAcceptOrganizationInviteMutation)(),[E,I]=x.useState(o.PENDING),[v,j]=x.useState(null),C=null==c?void 0:c.organizationForInvitation,T=x.useCallback(()=>{C&&(I(o.ACCEPTING),g({variables:{id:e,code:n}}).then(()=>{P().push("/o/[slug]","/o/".concat(C.slug))},t=>{I(o.PENDING),j(t)}))},[g,n,e,C]),_=null;if(E===o.ACCEPTING)_=(0,r.jsx)(s.SpinPadded,{});else if(y||v){let t=(0,u.getCodeFromError)(y||v);_="NTFND"===t?(0,r.jsx)(d.ZP,{status:"404",title:"That invitation could not be found",subTitle:"Perhaps you have already accepted it?"}):"DNIED"===t?(0,r.jsx)(d.ZP,{status:"403",title:"That invitation is not for you",subTitle:"Perhaps you should log out and log in with a different account?"}):"LOGIN"===t?(0,r.jsx)(d.ZP,{status:"403",title:"Log in to accept invitation",extra:(0,r.jsx)(s.ButtonLink,{href:"/login?next=".concat(encodeURIComponent(l.asPath)),children:"Log in"})}):(0,r.jsx)(s.ErrorAlert,{error:y||v})}else _=C?(0,r.jsx)(d.ZP,{status:"success",title:"You were invited to ".concat(C.name),extra:(0,r.jsx)(h.ZP,{onClick:T,type:"primary",children:"Accept invitation"})}):N?(0,r.jsx)(p.Z,{}):(0,r.jsx)(d.ZP,{status:"error",title:"Something went wrong",subTitle:"We couldn't find details about this invite, please try again later"});return _};y.getInitialProps=async t=>{let{query:{id:e,code:n}}=t;return{id:"string"==typeof e?e:null,code:"string"==typeof n?n:null}},e.default=y}},function(t){t.O(0,[679,427,774,888,179],function(){return t(t.s=53282)}),_N_E=t.O()}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.