1import{j as e,L as j,r as v,N as R}from"./vendor-react-Bq0AAjM7.js";import{Y as w,l as N,V as O,G as C,H as E,eX as A,a as p,ac as k,br as m,J as h,e as I,bQ as L,eY as S,ea as T,ax as y,w as _,E as F,dI as P}from"./main-D49UUfSD.js";import{s as z,p as D}from"./selectRecoveryScreen-D7mMN-c4.js";import{A as M,R as l,a as B,O as G,E as H}from"./AlternativeConnectionPrompt-dRNmd3yL.js";import"./vendor-runtime-DG-GlVKR.js";import"./index-Dl4pFCyo.js";import"./vendor-misc-DMccS2Mw.js";import"./vendor-ui-HM9MEgw-.js";import"./vendor-icons-DePtd98t.js";import"./vendor-analytics-DaFEZfd9.js";import"./vendor-sentry-BBJkNfRx.js";try{let t=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},n=new t.Error().stack;n&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[n]="3efbbf16-623c-4d48-a32a-5e2766855fac",t._sentryDebugIdIdentifier="sentry-dbid-3efbbf16-623c-4d48-a32a-5e2766855fac")}catch{}const f=t=>t==="login"?"/auth/log-in":"/auth/sign-up",q=({flow:t,children:n})=>e.jsxs("main",{className:"flex min-h-dvh w-full flex-col items-center justify-center bg-rb-canvas px-4 py-8 sm:px-6 sm:py-10",children:[e.jsx(w,{color:"orange",variant:"full",className:"mb-6 h-8 sm:mb-8 md:h-10"}),e.jsxs("div",{className:"w-full max-w-2xl",children:[n,e.jsx("div",{className:"mt-6 flex justify-center",children:e.jsxs(j,{to:f(t),className:N(O({variant:"ghost",size:"md"})),children:["â Back to ",t==="login"?"log in":"sign up"]})})]})]}),d=({children:t})=>e.jsx(C,{className:"gap-0 sm:gap-0 sm:py-8",children:e.jsx(E,{className:"flex flex-col gap-0 sm:px-8",children:t})}),u=({children:t})=>e.jsx("h1",{className:"mb-3 text-center text-title-lg font-medium text-balance text-rb-darkbtn sm:mb-4 sm:text-display",children:t}),g=({children:t})=>e.jsx("p",{className:"mb-6 text-center text-body text-pretty text-rb-secondary-dark sm:mb-8 sm:text-title-sm",children:t}),V=t=>t===m.GOOGLE?"google":"microsoft",x=({flow:t,screen:n})=>{const r=A(),{logButtonPress:s}=p();return{retry:({provider:i,requestedIntegrations:a,action:c})=>{r.isPending||(s(k.AUTH_RECOVERY_ACTION,{screen:n,action:c,provider:i,flow:t,requestedIntegrations:a}),r.mutate({provider:V(i),mode:"redirect",entry:"click",flow:t,requestedIntegrations:a}))},isRetrying:r.isPending}},W=({integrations:t,flow:n})=>{const{retry:r,isRetrying:s}=x({flow:n,screen:"org-consent"});return e.jsxs(e.Fragment,{children:[e.jsxs(d,{children:[e.jsx(u,{children:"Approve Fyxer for your organization"}),e.jsxs(g,{children:["Approval is needed once and covers everyone in your organization. To approve, try again and tick"," ",e.jsx("strong",{className:"font-semibold text-rb-darkbtn",children:"Consent on behalf of your organization"})," on the Microsoft screen."]}),e.jsx("div",{className:"text-center",children:e.jsx(h,{onClick:()=>r({provider:m.MICROSOFT,requestedIntegrations:t,action:"retry"}),disabled:s,variant:"brand",size:"lg",className:"w-full sm:w-auto",children:s?"Redirecting...":"Approve Fyxer"})}),e.jsx("div",{className:"mt-6",children:e.jsx(M,{showAlternativeText:!0,alternativeText:"Or grant consent in the Microsoft Entra portal, read more here:",surface:"unified_signup"})})]}),e.jsx(l,{})]})},Y=({provider:t,error:n,flow:r})=>{const{retry:s,isRetrying:o}=x({flow:r,screen:"recovery"}),i="signup",a=b=>s({provider:b,requestedIntegrations:[],action:"retry"}),c=e.jsx(S,{description:"Enter your work email and we'll send you what your admin needs to approve Fyxer.",errorCode:n,intent:r==="login"?"log-in":"sign-up",className:"mt-4 rounded-2xl p-6 sm:p-8"});return t===m.MICROSOFT?e.jsxs(e.Fragment,{children:[e.jsxs(d,{children:[e.jsx(u,{children:"Let's get you in another way"}),e.jsx(g,{children:"Signing up with Microsoft needs an admin's approval at your organization. Neither option below does."}),e.jsx(B,{integrations:[I.MICROSOFT_OUTLOOK_EMAIL],surface:"unified_signup",onRestartSignup:a,isRestartingSignup:o,emailLinkFlow:i,className:"mt-0"})]}),c,e.jsx(l,{})]}):e.jsxs(e.Fragment,{children:[e.jsxs(d,{children:[e.jsx(u,{children:"Let's finish setting up"}),e.jsx(g,{children:"Google sign-in didn't complete."}),e.jsx(L,{integration:"google",label:o?"Redirecting...":"Continue with Google",onClick:()=>s({provider:t,requestedIntegrations:[],action:"retry"}),isDisabled:o,isLoading:o}),e.jsx(G,{}),e.jsx("p",{className:"mb-2 text-center text-body text-rb-secondary-dark",children:"Blocked by your admin? We'll email you a link that works without Google."}),e.jsx(H,{flow:i,layout:"inline"})]}),e.jsx(l,{})]})},U=t=>{const n=new Set(t.map(T)),r=n.has(y.EMAIL),s=n.has(y.CALENDAR);return r&&s?"your inbox and calendar":s?"your calendar":r?"your inbox":"your account"},Q=({provider:t,integrations:n,flow:r})=>{const{retry:s,isRetrying:o}=x({flow:r,screen:"retry-unbundled"}),i=U(n);return e.jsxs(e.Fragment,{children:[e.jsxs(d,{children:[e.jsxs(u,{children:["Continue without connecting ",i]}),e.jsxs(g,{children:["If your organization blocked the request, or you would rather not grant access right now, you can carry on without it. You can connect ",i," later from Fyxer."]}),e.jsx("div",{className:"text-center",children:e.jsx(h,{onClick:()=>s({provider:t,requestedIntegrations:[],action:"retry_unbundled"}),disabled:o,variant:"brand",size:"lg",className:"w-full sm:w-auto",children:o?"Redirecting...":"Continue without access"})})]}),e.jsx(l,{})]})},J=({selection:t,error:n,flow:r})=>{switch(t.screen){case"retry-unbundled":return e.jsx(Q,{provider:t.provider,integrations:t.integrations,flow:r});
1case"recovery":return e.jsx(Y,{provider:t.provider,error:n,flow:r});case"org-consent":return e.jsx(W,{integrations:t.integrations,flow:r});default:return P(t)}},ae=()=>{const t=_(),{provider:n,error:r,error_description:s}=t,o=t.flow==="login"?"login":"signup",i=z({error:r,provider:n,integrations:D(t.integrations)}),a=i==null?void 0:i.screen,{logEvent:c}=p();return v.useEffect(()=>{a&&c(F.VIEW_OAUTH_ERROR,{errorCode:r,errorDescription:s,surface:"unified_signup",screen:a,flow:o,provider:n,integrations:t.integrations})},[c,a,r,s,o,n,t.integrations]),i?e.jsx(q,{flow:o,children:e.jsx(J,{selection:i,error:r??"access_denied",flow:o})}):e.jsx(R,{to:f(o),replace:!0})};export{ae as AuthRecoveryPage};
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.