1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6288],{3721:(e,n,t)=>{"use strict";t.d(n,{O:()=>u});var i=t(89100),r=t(57688),o=t.n(r);function u(e,n){if(!n)return{};let t=(0,i.getCookies)({req:n,res:e});return o()(t)&&n.headers.cookie&&(t=Object.fromEntries(n.headers.cookie.split(";").map(e=>e.split("=")))),t}},4602:(e,n,t)=>{"use strict";function i(e){var n;return e.pendingSignup&&(null==(n=e.pendingSignup)?void 0:n.completed)===!0||e.emailVerified&&!e.pendingSignup}t.d(n,{k:()=>i})},4926:(e,n,t)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/join",function(){return t(62346)}])},14209:(e,n,t)=>{"use strict";t.d(n,{F:()=>r});var i=t(73628);function r(e,n){return(0,i.useEffect)(()=>{let n=new AbortController;return e(n.signal),()=>n.abort()},n)}},17930:(e,n,t)=>{"use strict";t.d(n,{Y:()=>a});var i=t(9554);function r(){let e=(0,i._)(["\n query getUserMinimum {\n user {\n uuid\n id\n accessToken\n emailVerified\n pendingSignup {\n completed\n }\n }\n }\n"]);return r=function(){return e},e}let o=(0,t(81222).J1)(r());var u=t(72478);let a=async(e,n)=>{let{data:t,errors:i}=await u.V.query({fetchPolicy:"no-cache",query:o,errorPolicy:"all",context:{headers:{authorization:e,...(null==n?void 0:n.origin)&&{origin:n.origin}}}});if(i)throw i;return t.user}},35588:(e,n,t)=>{"use strict";t.d(n,{r:()=>I});var i=t(27549),r=t(84074),o=t(8079),u=t(14209),a=t(68265),d=t(72478),l=t(9554),c=t(81222);function s(){let e=(0,l._)(["\n mutation acceptInvitation($invitationUuid: String!) {\n acceptInvitation(invitationUuid: $invitationUuid) {\n uuid\n teamId\n projectId\n }\n }\n"]);return s=function(){return e},e}let f=(0,c.J1)(s()),g=async e=>{let{errors:n,data:t}=await d.V.mutate({mutation:f,variables:{invitationUuid:e},errorPolicy:"all"});return n?{error:n[0].message}:(null==t?void 0:t.acceptInvitation)?null==t?void 0:t.acceptInvitation:null};function m(){let e=(0,l._)(["\n mutation addTeamMemberWithMagicLinkCode($magicLinkCode: String!) {\n addTeamMemberWithMagicLinkCode(magicLinkCode: $magicLinkCode) {\n id\n }\n }\n"]);return m=function(){return e},e}let v=(0,c.J1)(m()),h=async e=>{var n;let{errors:t,data:i}=await d.V.mutate({mutation:v,variables:{magicLinkCode:e},errorPolicy:"all"});return t?{error:t[0].message}:(null==i||null==(n=i.addTeamMemberWithMagicLinkCode)?void 0:n.id)?{teamId:i.addTeamMemberWithMagicLinkCode.id}:null};var p=t(4602),w=t(4505),k=t(64522),U=t(17930),C=t(15658);let S=a.A.child({module:"useAcceptInvitation"});function I(){let e=(0,r.useRouter)(),{query:n}=e,{invitation:t,code:a,...d}=n,l=e.pathname.includes("join-project")?(0,C.ZM)({invitation:null!=t?t:"no-invitation"}):(0,C.ZB)({invitation:t,code:a});(0,u.F)(async r=>{S.info("Performing Accept of invitation",{query:n});let u=(0,k.__)();if(!u&&(S.info("No token found. Redirecting to /signup",{query:n}),a||t)){if(r.aborted)return;await e.push((0,C.c5)({next:l,...d}));return}try{let i=await (0,U.Y)(u);if(S.info("Token found. User loaded",{query:n,userUuid:null==i?void 0:i.uuid}),!(0,p.k)(i)){let o=(0,C.c5)({next:l,...d});if(S.info("Signup not completed. Redirecting to ".concat(o),{query:n,userUuid:i.uuid}),t){if(r.aborted)return;await e.push(o);return}}if(a){S.info('Magic link code found in URL. Performing "addTeamMemberWithMagicLinkCode"',{query:n,userUuid:null==i?void 0:i.uuid});let t=await h(a);if(null==t?void 0:t.error){let n="".concat((0,C.uZ)(),"?toast-error=").concat(encodeURIComponent(t.error));if(S.warn('Error encountered while performing "addTeamMemberWithMagicLinkCode" Redirecting to '.concat(n),{query:e.query,userUuid:null==i?void 0:i.uuid,error:t.error}),r.aborted)return;(0,w.S)(n);return}let o="".concat((0,C.uZ)(),"?joinedTeamId=").concat(null==t?void 0:t.teamId);if(S.info('Team joined using magic link successfully. Redirecting to "'.concat(o,'"'),{query:n,userUuid:null==i?void 0:i.uuid}),r.aborted)return;(0,w.S)(o);return}if(t){S.info('Invitation uuid found in URL. Performing "acceptInvitation"',{query:n,userUuid:null==i?void 0:i.uuid});let e=await g(t);if(null==e?void 0:e.error){let t="".concat((0,C.uZ)(),"?toast-error=").concat(encodeURIComponent(e.error));if(S.warn('Error encountered while performing "acceptInvitation". Redirecting to '.concat(t),{query:n,userUuid:null==i?void 0:i.uuid,error:e.error}),r.aborted)return;(0,w.S)(t);return}if(null==e?void 0:e.projectId){let t="".concat((0,C.XP)(null==e?void 0:e.projectId),"?toast-success=").concat(encodeURIComponent("Successfully joined!"));if(S.info("Project invitation accepted. Redirecting to ".concat(t),{query:n,userUuid:null==i?void 0:i.uuid,res:e}),r.aborted)return;(0,w.S)(t);return}let o="".concat((0,C.uZ)(),"?joinedTeamId=").concat(null==e?void 0:e.teamId);if(S.info("Team invitation accepted. Redirecting to ".concat(o),{query:n,userUuid:null==i?void 0:i.uuid,res:e}),r.aborted)return;(0,w.S)(o);return}S.warn("No Invitation nor Code found in URL query",{query:n,userUuid:null==i?void 0:i.uuid})}catch(e){if(i.datadogRum.addError(e),S.error("Something went wrong when joining the team",{query:n,error:e}),r.aborted)return;o.toast.error("Something went wrong when joining the team"),(0,w.S)((0,C.uZ)())}},[])}},62346:(e,n,t)=>{"use strict";t.r(n),t.d(n,{default:()=>k});var i=t(1808),r=t(66513),o=t.n(r),u=t(17110),a=t(2390),d=t(35588);let l=()=>((0,d.r)(),(0,i.jsx)(a.LoadingPanel,{text:"Joining team..."}));var c=t(68265),s=t(17930),f=t(4602),g=t(15658),m=t(64522),v=t(3721),h=t(72831
1);let p=c.A.child({module:"getJoinInitialProps"});function w(){return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(o(),{children:(0,i.jsx)("title",{children:"Maze â Join teams"})}),(0,i.jsx)(u.P,{children:(0,i.jsx)(l,{})})]})}w.getInitialProps=async function(e){let{req:n,res:t,query:i}=e;if(!n)return{};let{code:r,invitation:o,...u}=i,a=(0,v.O)(t,n),d=a[m.Mo],l=!!a[m.gT],c=(0,g.ZB)({code:r,invitation:o});if(!d){let e=l?(0,g.fx)({...u,next:c}):(0,g.c5)({...u,next:c});return r||o?p.info("No token found. Code or MagicLink present. User has logged in: ".concat(l,". Sending user to ").concat(e,"."),{req:n,query:i}):p.warn("User should not be here. There is no query to process",{req:n,query:i}),(0,h.u)(t,e),{}}try{let e=await (0,s.Y)(d,n.headers);if(!(0,f.k)(e)){let r=(0,g.c5)({...u,next:c});return p.info("User hasn't finished the signup. Redirecting to ".concat(r),{userUuid:e.uuid,req:n,query:i}),(0,h.u)(t,r),{}}return p.info("User loaded. Continuing in the browser.",{userUuid:e.uuid,req:n,query:i}),{user:e}}catch(r){let e=(0,g.fx)({...u,next:c});return p.warn("User couldn't be loaded. Sending to ".concat(e),{error:r,query:i,req:n}),(0,h.u)(t,e),{}}};let k=w},64522:(e,n,t)=>{"use strict";t.d(n,{Mo:()=>a,Qu:()=>g,__:()=>c,a6:()=>s,gT:()=>d,ls:()=>f});var i=t(89100),r=t(75684),o=t(60329);let{tokenCookieName:u}=r.W,a=u,d="maze-has-logged-in",l=()=>{if((0,o.fU)())return;let{domain:e}=document,n=e.split(".").slice(1).join(".");return["localhost","127.0.0.1"].includes(e)?e:".".concat(n)},c=()=>(0,i.getCookie)(a)||(()=>{try{var e;return null==(e=localStorage)?void 0:e.getItem(a)}catch(e){return null}})(),s=(e,n,t,r)=>{(0,i.setCookie)(a,e,{domain:n||l(),expires:new Date(Date.now()+6048e5),secure:(0,o.KV)(),req:t,res:r})},f=()=>{(0,i.deleteCookie)(a,{domain:l()})},g=()=>{(0,i.setCookie)(d,1,{domain:l(),secure:!0})}},70132:(e,n,t)=>{"use strict";t.d(n,{W:()=>i});class i{static setRef(e){i.INSTANCE=e}}},72478:(e,n,t)=>{"use strict";t.d(n,{V:()=>U});var i=t(46578),r=t(98301),o=t(16137),u=t(8809),a=t(28616),d=t(59237),l=t(27549),c=t(89100),s=t(75684),f=t(68265),g=t(70132),m=t(60329),v=t(64522);let h=f.A.child({module:"maze-graph"}),p=(0,i.$)({uri:s.W.apiUrl}),w=(0,a.o)((e,n)=>{let{operationName:t}=e,{headers:i}=n,r=(0,v.__)();return(0,m.XV)(t)&&(r=null),{headers:{...i,...r?{authorization:r}:{}}}}),k=(0,d.S)(e=>{var n,t;let{graphQLErrors:i,networkError:r,operation:o,response:u}=e,a=null==(n=g.W.INSTANCE)?void 0:n.state.context.user,d=a?{...a,id:null==a||null==(t=a.id)?void 0:t.toString()}:{id:(0,c.getCookie)("ajs_anonymous_id")};r&&(h.error("[Network error]: ".concat(r.message),{userUuid:null==a?void 0:a.uuid,operationName:null==o?void 0:o.operationName}),l.datadogRum.addError(r,{user:d})),i&&0!==i.length&&i.forEach(e=>{var n,t;let{extensions:i,message:r,locations:c,path:s}=e,f=null!=(t=null==i||null==(n=i.response)?void 0:n.statusCode)?t:200,g=Math.floor(f/100);h.warn("[GraphQL error]: Message: ".concat(r,", Location: ").concat(JSON.stringify(c),", Path: ").concat(JSON.stringify(s)),{userUuid:null==a?void 0:a.uuid,operationName:null==o?void 0:o.operationName,response:u}),401===f?(0,v.ls)():(4===g||5===g)&&l.datadogRum.addError(e,{user:d,context:{operationName:null==o?void 0:o.operationName,responseCode:f}})})}
1),U=new r.R({link:o.C.from([k,w,p]),cache:new u.D})},72831:(e,n,t)=>{"use strict";t.d(n,{u:()=>r});var i=t(60329);let r=function(e,n){let t=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(!(0,i.fU)())throw Error("This is SSR only util!");null==e||e.writeHead(t?301:302,{Location:n}),null==e||e.end()}}},e=>{e.O(0,[7688,4468,2668,1573,636,6593,8792],()=>e(e.s=4926)),_N_E=e.O()}]); 2//# sourceMappingURL=join-855832675ab78610.js.map
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.