PageSourceSearch

https://app.kapa.ai/assets/signin-DUNd0dwE.js

js kapa.ai collected 2026-09-24 19:18:49 UTC 6,039 bytes, 2 lines download raw bytes

1import{r as l,j as e,af as S}from"./vendor-mantine-BR5daWbi.js";import{u as N}from"./zod-CM90858-.js";import{a as x,b as L}from"./auth-control-surface-HuliTjeF.js";import{A as $}from"./auth-terms-footer-B86jhGXT.js";import{O as q}from"./oauth-provider-buttons-DEXgTWdQ.js";import{A as W}from"./auth-layout-C19DYvVU.js";import{u as H,f as J,h as K,B as g,c as y,i as Y,z as O,j as X,R as G,H as Q}from"./index-Bo80QBJz.js";import{F as A,a as C}from"./field-DtPrt-OU.js";import{I as _}from"./input-CD4K4QyY.js";import{u as k,a as Z}from"./index.esm-1c9aDGCh.js";import{b as ee,L as te}from"./vendor-react-CvsrXiTQ.js";import"./mesh-gradient-DZMU_v0X.js";import"./use-is-mobile-HBahKhNX.js";import"./vendor-data-BEEH8umM.js";import"./vendor-baseui-uAQgzSok.js";import"./vendor-icons-ywK6O-a8.js";import"./vendor-syntax-BxWJNGeb.js";import"./vendor-markdown-KnfJHi8i.js";import"./vendor-charts-BzGwKu8R.js";import"./separator-C4VYaa21.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{};t.SENTRY_RELEASE={id:"30ecadcb485edf38c71e62214c8874da90fe716f"}}catch{}})();try{(function(){var t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},s=new t.Error().stack;s&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[s]="797d3500-43d8-4993-a7f7-21cd330d5ea4",t._sentryDebugIdIdentifier="sentry-dbid-797d3500-43d8-4993-a7f7-21cd330d5ea4")})()}catch{}const F=O.object({email:O.string().trim().min(1,"Email is required")}),ae=t=>{if(t instanceof G)return"We could not load the security check needed to sign you in. Disable any ad or script blocker, or ask your network administrator to allow captchas, then try again.";const s=t instanceof Q?t:null;if(s){if(s.status===429)return"Too many sign-in codes have been requested for this email. Please wait a few minutes and try again.";try{const r=JSON.parse(s.responseBody),n=r.message??r.error??r.detail;if(n)return n}catch{}}return"Could not send a sign-in code. Please try again."},T=async(t,s)=>{const r=await fetch(`${X.VITE_KAPA_SERVICE_URL}/org/v1/auth/sso/discover/`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:t,next:s})}),n=await r.json();if(!r.ok)throw new Error(n.error??"SSO discovery failed");return n},je=()=>{const t=H(),[s]=ee(),[r,n]=l.useState(!1),[w,c]=l.useState(null),d=l.useRef(0),[P,h]=l.useState(!1),[z,b]=l.useState(!1),u=k({defaultValues:{email:""},resolver:N(F)}),m=k({defaultValues:{email:""},resolver:N(F)}),f=J(s.get("next")||K),v=f.startsWith("/")?`${window.location.origin}${f}`:f,R=async a=>{try{h(!0);const o=await T(a,v);o.auth_method==="saml"&&o.login_url?window.location.assign(o.login_url):(h(!1),S.show({title:"SSO Not Configured",message:o.message??"SSO is not configured for your organization. Please use another sign-in method.",color:"yellow"}))}catch(o){console.error("SAML discovery failed:",o),h(!1),Y(o),S.show({title:"Error",message:"Failed to discover SSO configuration. Please try another sign-in method.",color:"red"})}},j=(a,o)=>{c(null),t.generateOTP.mutate(a,{onError:i=>{o===d.current&&c({email:a,message:ae(i)})},onSettled:()=>{n(!1)}})},I=async(a,o)=>{try{const i=await T(a,v);if(i.auth_method==="saml"&&i.login_url){S.show({title:"SSO Required",message:i.message||"Your organization uses Single Sign-On. Redirecting to SSO login...",color:"blue"});const V=i.login_url;setTimeout(()=>{window.location.assign(V)},1500);return}j(a,o)}catch(i){console.error("SSO discovery check failed, proceeding with OTP:",i),j(a,o)}},U=a=>{u.handleSubmit(o=>{n(!0),c(null),d.current+=1,I(o.email.toLowerCase(),d.current)})(a)},D=m.handleSubmit(a=>{R(a.email.toLowerCase())}),E=u.register("email"),M=Z({control:u.control,name:"email"}),p=u.formState.errors.email?.message??(w?.email===M.trim().toLowerCase()?w.message:null),B=`/auth/signup${s.size?`?${s.toString()}`:""}`;return e.jsx(W,{slots:{content:e.jsxs("div",{className:"flex flex-col gap-10",children:[e.jsxs("div",{className:"flex flex-col gap-7",children:[e.jsxs("h1",{className:"text-large-title text-foreground tracking-tight",children:["Sign In",e.jsx("br",{}),"to Kapa."]}),e.jsxs("p",{className:"text-headline text-foreground-secondary font-normal",children:["Don't have an account?"," ",e.jsx(te,{to:B,className:"text-foreground hover:underline",children:"Sign up"})]})]}),z?e.jsxs("form",{onSubmit:D,className:"flex flex-col gap-2",children:[e.jsxs(A,{children:[e.jsx(_,{size:"lg",type:"email",placeholder:"Enter your work email...","aria-label":"Work email",className:L,autoCorrect:"off",autoCapitalize:"off",autoFocus:!0,"aria-invalid":m.formState.errors.email?!0:void 0,...m.register("email")}),e.jsx(C,{errors:[m.formState.errors.email]})]}),e.jsx(g,{type:"submit",variant:"secondary",size:"lg",className:y("w-full",x),loading:P,children:"Continue with SSO"}),e.jsx(g,{variant:"ghost",size:"lg",className:"w-full",onClick:()=>b(!1),children:"Back to other sign-in options"})]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx(q,{verb:"Sign in",nextUrl:f}),e.jsx(g,{variant:"secondary",size:"lg",className:y("w-full",x),onClick:()=>b(!0),children:"Sign in with SSO"})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"bg-line h-px flex-1"}),e.jsx("span",{className:"text-headline text-foreground-secondary font-normal",children:"or"}),e.jsx("div",{className:"bg-line h-px flex-1"})]}),e.jsxs("form",{onSubmit:U,className:"flex flex-col gap-2",children:[e.jsxs(A,{children:[e.jsx(_,{size:"lg",type:"email",placeholder:"Email","aria-label":"Email",className:L,autoCorrect:"off",autoCapitalize:"off","aria-invalid":p?!0:void 0,...E,onChange:a=>{d.current+=1,c(null),E.onChange(a)}}),p&&e.jsx(C,{children:p})]}),e.jsx(g,{type:"submit",variant:"secondary",size:"lg",className:y("w-full",x),loading:r,children:"Sign in with email"})]})]})]}),footer:e.jsx($,{})}})};export{je as default};
2//# sourceMappingURL=signin-DUNd0dwE.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.