PageSourceSearch

https://pika.style/_next/static/chunks/pages/team/join-244e143b848c7229.js

js pika.style collected 2026-09-25 18:42:34 UTC 6,631 bytes, 1 lines download raw bytes

1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5802],{75242:(e,t,a)=>{"use strict";a.d(t,{F:()=>n});let s=async(e,t="GET",a)=>{let s=await fetch(e,{method:t,headers:a?{"Content-Type":"application/json"}:void 0,body:a?JSON.stringify(a):void 0}),i=await s.json().catch(()=>null);if(!s.ok)throw Error(i?.error||"Something went wrong with your team");return i},i=(e,t="")=>`/api/teams/${e}${t}`,n={checkout:({name:e,seats:t,interval:a,clientReferenceId:i})=>s("/api/teams/checkout","POST",{name:e,seats:t,interval:a,clientReferenceId:i}),join:e=>s("/api/teams/join","POST",{token:e}),previewInvite:e=>s(`/api/teams/join?token=${encodeURIComponent(e)}`),byCheckout:e=>s(`/api/teams/checkout?key=${encodeURIComponent(e)}`),get:e=>s(i(e)),rename:(e,t)=>s(i(e),"PATCH",{name:t}),invite:(e,{email:t,role:a,projectId:n})=>s(i(e,"/invites"),"POST",{email:t,role:a,projectId:n}),revokeInvite:(e,t)=>s(i(e,"/invites"),"DELETE",{inviteId:t}),removeMember:(e,t)=>s(i(e,"/members"),"DELETE",{memberId:t}),createProject:(e,t)=>s(i(e,"/projects"),"POST",{name:t}),updateProject:(e,t,a)=>s(i(e,"/projects"),"PATCH",{projectId:t,...a}),setProjectRole:(e,t,a,n)=>s(i(e,"/projects"),"PUT",{projectId:t,memberId:a,role:n}),removeFromProject:(e,t,a)=>s(i(e,"/projects"),"DELETE",{projectId:t,memberId:a}),changeSeats:(e,t)=>s(i(e,"/billing"),"PATCH",{seats:t}),billingPortal:e=>s(i(e,"/billing"),"POST")}},75729:(e,t,a)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/team/join",function(){return a(85003)}])},85003:(e,t,a)=>{"use strict";a.r(t),a.d(t,{default:()=>g});var s=a(75038),i=a(76430),n=a(92376),r=a(58742),o=a(71623),l=a(56725),c=a(58454),d=a(21625),u=a(83390),m=a(19977),h=a(72651),p=a(75242);let j=({email:e})=>{let[t,a]=(0,i.useState)("signup"),[n,l]=(0,i.useState)(""),[c,d]=(0,i.useState)(""),[p,j]=(0,i.useState)(!1),x="signup"===t,g=async t=>{if(t.preventDefault(),x&&!n.trim())return r.oR.error("Please enter your name");if(!c)return r.oR.error("Please enter a password");j(!0);let a=(0,m.U)();try{if(x){let{data:t,error:s}=await a.auth.signUp({email:e,password:c,options:{data:{name:n.trim()}}});if(s)throw s;(0,h.vq)("signed_up",{key:e}),fetch("https://pika.style/api/loops/addUpdateContact",{method:"POST",body:JSON.stringify({name:n.trim(),email:e,operation:"add",userId:t.user?.id,paid:!1})}).catch(()=>{}),t.session||r.oR.success("Check your inbox to confirm your email, then open the invite link again",{duration:8e3})}else{let{error:t}=await a.auth.signInWithPassword({email:e,password:c});if(t)throw t;(0,h.vq)("logged_in",{key:e})}}catch(e){r.oR.error(e?.message||"Something went wrong, please try again"),j(!1)}};return(0,s.jsxs)("form",{onSubmit:g,className:"text-left flex flex-col gap-3 mt-8 p-6 rounded-2xl border dark:border-gray-800 bg-white dark:bg-black",children:[(0,s.jsx)("div",{className:"grid grid-cols-2 p-1 rounded-xl bg-gray-100 dark:bg-gray-900 text-sm mb-1",children:[["signup","I'm new to Pika"],["login","I have an account"]].map(([e,i])=>(0,s.jsx)("button",{type:"button",onClick:()=>a(e),className:(0,o.A)("py-2 rounded-lg",t===e?"bg-white dark:bg-gray-800 shadow-sm font-medium dark:text-white":"opacity-60 hover:opacity-100"),children:i},e))}),(0,s.jsx)(u.pd,{label:"Email",type:"email",value:e,readOnly:!0,disabled:!0}),x?(0,s.jsx)(u.pd,{label:"Name",value:n,autoFocus:!0,placeholder:"Your name",onChange:e=>l(e.target.value)}):null,(0,s.jsx)(u.pd,{label:"Password",type:"password",value:c,autoFocus:!x,placeholder:x?"Choose a password":"Your password",onChange:e=>d(e.target.value)}),(0,s.jsx)(u.$n,{variant:"primary",type:"submit",className:"mt-2 justify-center",disabled:p,children:p?x?"Creating your account...":"Signing in...":x?"Create free account and join →":"Sign in and join →"}),(0,s.jsx)("p",{className:"text-xs opacity-60 text-center",children:x?"Your team covers your Pro seat, so there's nothing to pay.":null})]})},x=({note:e})=>(0,s.jsxs)("div",{"aria-busy":"true",className:"flex flex-col items-center gap-3",children:[(0,s.jsx)(u.EA,{className:"h-4 w-72 max-w-full"}),(0,s.jsx)(u.EA,{className:"h-4 w-56 max-w-full"}),(0,s.jsxs)("div",{className:"w-full mt-6 p-6 rounded-2xl border dark:border-gray-800 flex flex-col gap-3",children:[(0,s.jsx)(u.EA,{className:"h-9 w-full rounded-xl"}),(0,s.jsx)(u.EA,{className:"h-9 w-full"}),(0,s.jsx)(u.EA,{className:"h-9 w-full"}),(0,s.jsx)(u.EA,{className:"h-10 w-full"})]}),e?(0,s.jsx)("p",{className:"text-sm opacity-60",children:e}):null]});function g(){let e,t=(0,n.useRouter)(),{c_Session:a,c_SwitchWorkspace:r}=(0,i.useContext)(c.A),[o,h]=(0,i.useState)(void 0),[g,y]=(0,i.useState)(null),w=t.query.token;(0,i.useEffect)(()=>{w&&p.F.previewInvite(w).then(h).catch(e=>{h(null),y(e.message)})},[w]),(0,i.useEffect)(()=>
1{if(!w||!a?.id||void 0===o)return;let e=!1;return p.F.join(w).then(async({teamId:a})=>{if(e)return;let s=o?.projectId;if(!s){let e=await fetch("/api/entitlements").then(e=>e.json()).then(e=>e?.teams||[]).catch(()=>[]);s=e.find(e=>String(e.id)===String(a))?.projects?.[0]?.id}await r(s||null),t.replace(`/user/settings/team/projects?team=${a}`)}).catch(t=>!e&&y(t.message)),()=>{e=!0}},[w,a?.id,void 0===o]);let f=async()=>{await (0,m.U)().auth.signOut(),y(null)},b=a?.email&&o?.email&&a.email.toLowerCase()!==o.email.toLowerCase();return e=!t.isReady||w&&void 0===o?(0,s.jsx)(x,{}):w&&o?b?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("p",{children:["This invite is for ",(0,s.jsx)("b",{children:o.email}),", but you're signed in as ",a.email,"."]}),(0,s.jsxs)(u.$n,{className:"mt-6",variant:"secondary",onClick:f,children:["Sign out and continue as ",o.email]})]}):g?(0,s.jsx)("p",{children:g}):o.usable||a?.id?!1===a?(0,s.jsx)(j,{email:o.email}):(0,s.jsx)(x,{note:"Joining the team..."}):(0,s.jsx)("p",{children:"This invite has expired or was already used. Ask for a new one, or sign in if you already joined."}):(0,s.jsx)("p",{children:g||"This invite link isn't valid."}),(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(l.bV,{title:"Join a team – Pika",noindex:!0}),(0,s.jsx)(d.Y9,{}),(0,s.jsxs)(u.mc,{width:"480px",className:"py-20 text-center",children:[(0,s.jsx)("h1",{className:"text-3xl font-bold mb-3 dark:text-white",children:o?.projectName?`Join ${o.projectName} on Pika`:"Join a team on Pika"}),o?.teamName?(0,s.jsxs)("p",{className:"opacity-70 mb-6",children:["You're invited to the ",o.projectName?`${o.projectName} project in `:"",(0,s.jsx)("b",{children:o.teamName})," team, to design screenshots and share presets together."]}):null,(0,s.jsx)("div",{className:"opacity-90",children:e})]}),(0,s.jsx)(d.wi,{})]})}}},e=>{e.O(0,[4558,1178,1958,6394,636,6593,8792],()=>e(e.s=75729)),_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.