PageSourceSearch

https://cddp.ai/_next/static/chunks/pages/invite/accept-6f84121e1138dfc4.js

js cddp.ai collected 2026-10-05 14:27:55 UTC 5,204 bytes, 1 lines download raw bytes

1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9026],{89071:function(e,t,i){(window.__NEXT_P=window.__NEXT_P||[]).push(["/invite/accept",function(){return i(91656)}])},91656:function(e,t,i){"use strict";i.r(t),i.d(t,{default:function(){return o}});var s=i(52676),a=i(75271),n=i(93726),r=i(30656),l=i(92592),d=i.n(l);let c="https://prod-api.cddp.ai";function o(){let e=(0,n.useRouter)(),{token:t}=e.query,[i,l]=(0,a.useState)({kind:"loading"}),[o,x]=(0,a.useState)(""),[m,u]=(0,a.useState)("");(0,a.useEffect)(()=>{t&&"string"==typeof t&&r.default.get("".concat(c,"/v1/invitations/validate"),{params:{token:t}}).then(e=>l({kind:"ready",invite:e.data})).catch(e=>{var t,i,s;l({kind:"invalid",message:null!==(s=null===(i=e.response)||void 0===i?void 0:null===(t=i.data)||void 0===t?void 0:t.detail)&&void 0!==s?s:"This invitation link is invalid or has expired."})})},[t]);let g=async()=>{if("ready"!==i.kind)return;let{invite:e}=i;if(e.user_exists||o.trim()&&m.trim()){l({kind:"submitting"});try{let i=await r.default.post("".concat(c,"/v1/invitations/accept"),{token:t,first_name:e.user_exists?void 0:o.trim(),last_name:e.user_exists?void 0:m.trim()});l({kind:"success",user_exists:i.data.user_exists})}catch(e){var s,a,n;l({kind:"error",message:null!==(n=null===(a=e.response)||void 0===a?void 0:null===(s=a.data)||void 0===s?void 0:s.detail)&&void 0!==n?n:"Something went wrong. Please try again."})}}};return(0,s.jsx)("div",{className:"min-h-screen bg-gray-950 flex items-center justify-center p-4",children:(0,s.jsxs)("div",{className:"bg-gray-900 border border-gray-800 rounded-2xl shadow-xl max-w-md w-full p-8",children:[(0,s.jsx)("div",{className:"mb-8 text-center",children:(0,s.jsx)("p",{className:"text-xs uppercase tracking-widest text-gray-500 mt-1",children:"CDDP Platform"})}),"loading"===i.kind&&(0,s.jsx)("div",{className:"text-center text-gray-400 py-8",children:"Validating invitation…"}),"invalid"===i.kind&&(0,s.jsxs)("div",{className:"text-center",children:[(0,s.jsx)("p",{className:"text-red-400 font-medium mb-2",children:"Invitation unavailable"}),(0,s.jsx)("p",{className:"text-gray-400 text-sm",children:i.message})]}),("ready"===i.kind||"submitting"===i.kind)&&"submitting"!==i.kind&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("h1",{className:"text-white text-xl font-semibold mb-1",children:"You've been invited"}),(0,s.jsxs)("p",{className:"text-gray-400 text-sm mb-6",children:[i.invite.invited_by," has invited you to join"," ",(0,s.jsx)("span",{className:"text-white font-medium",children:i.invite.org_name})," ","as"," ",(0,s.jsx)("span",{className:"text-white font-medium",children:i.invite.role.replace(/_/g," ")}),"."]}),!i.invite.user_exists&&(0,s.jsxs)("div",{className:"space-y-3 mb-6",children:[(0,s.jsxs)("p",{className:"text-gray-400 text-sm",children:["We couldn't find an existing account for"," ",(0,s.jsx)("span",{className:"text-white",children:i.invite.email}),". Please enter your name to create one."]}),(0,s.jsx)("input",{type:"text",placeholder:"First name",value:o,onChange:e=>x(e.target.value),className:"w-full bg-gray-800 border border-gray-700 rounded-lg px-4 py-2.5 text-white placeholder-gray-500 text-sm focus:outline-none focus:border-gray-500"}),(0,s.jsx)("input",{type:"text",placeholder:"Last name",value:m,onChange:e=>u(e.target.value),className:"w-full bg-gray-800 border border-gray-700 rounded-lg px-4 py-2.5 text-white placeholder-gray-500 text-sm focus:outline-none focus:border-gray-500"})]}),i.invite.user_exists&&(0,s.jsxs)("div",{className:"bg-gray-800 rounded-lg px-4 py-3 mb-6",children:[(0,s.jsx)("p",{className:"text-gray-400 text-xs mb-0.5",children:"Accepting as"}),(0,s.jsx)("p",{className:"text-white text-sm font-medium",children:i.invite.email})]}),(0,s.jsx)("button",{onClick:g,disabled:!i.invite.user_exists&&(!o.trim()||!m.trim()),className:"w-full bg-white text-gray-950 font-semibold rounded-lg py-2.5 text-sm hover:bg-gray-100 transition disabled:opacity-40 disabled:cursor-not-allowed",children:"Accept Invitation"})]}),"submitting"===i.kind&&(0,s.jsx)("div",{className:"text-center text-gray-400 py-8",children:"Setting up your account…"}),"success"===i.kind&&(0,s.jsxs)("div",{className:"text-center",children:[(0,s.jsx)("div",{className:"text-3xl mb-4",children:"✓"}),(0,s.jsx)("h2",{className:"text-white text-lg font-semibold mb-2",children:"You're in!"}),(0,s.jsx)("p",{className:"text-gray-400 text-sm mb-6",children:i.user_exists?"Your account has been updated. You can log in now.":"Your account is ready. Check your email for a login link."}),(0,s.jsx)(d(),{href:"/auth/login",className:"inline-block bg-white text-gray-950 font-semibold rounded-lg px-6 py-2.5 text-sm hover:bg-gray-100 transition",children:"Go to login"})]}),"error"===i.kind&&(0,s.jsxs)("div",{className:"text-center",children:[(0,s.jsx)("p",{className:"text-red-400 font-medium mb-2",children:"Something went wrong"}),(0,s.jsx)("p",{className:"text-gray-400 text-sm mb-4",children:i.message}),(0,s.jsx)("button",{onClick:()=>e.reload(),className:"text-sm text-gray-400 underline hover:text-white",children:"Try again"})]})]})})}}},function(e){e.O(0,[2592,2888,9774,179],function(){return e(e.s=89071)}),_N_E=e.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.