1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/assistantGraphic-Bih4KeAJ.js","assets/react-vendor-BKgfKFZH.js","assets/icons-BfNt_9T9.js","assets/LindyAssistantIconV2-YTDOkHfz.js","assets/entry-C8wUDEw9.js","assets/index-Bhj3N6Qb.css","assets/assistantGraphic-CY98J9fM.css"])))=>i.map(i=>d[i]); 2import{I as M,w as z,v as f,c as I,P as G,_ as V}from"./entry-C8wUDEw9.js";import{r,j as n}from"./react-vendor-BKgfKFZH.js";import{e as b,gU as Y,gV as F}from"./graphql-WBhJzdnw.js";import{a as H}from"./pathPrefix-C6KjWwRj.js";import{g as Q}from"./identity-CPeTn7lB.js";import{o as q}from"./oauthGrantWindow-DS4UFHP_.js";import{s as K}from"./subscribeAuthChanges---WcFTfz.js";import{resolveAuthenticatedRouteSession as $}from"./session-B58NCI26.js";import{g as J}from"./workspace-meWw0reJ.js";import{O as X}from"./onboardingLayout-D3QBgRXw.js";import{g as E}from"./onboardingRouting-DAbOo0fA.js";import{C as Z,A as tt,O as et,g as ot}from"./OnboardingStepProgress-BDg00Sjf.js";import{a as rt}from"./authHelpers-Dh6G29Au.js";import{L as st,a as nt}from"./lindyAssistant-BUov6hLE.js";import"./makePostHogHeaders-DBJS6Pqp.js";import"./types-BQz_GrV3.js";import"./Identity-BmVeq4PW.js";import"./billing-BoSVWj_Q.js";import"./EvalCloneMarker-DcaKrgBx.js";import"./speechToText-BwTQh1Op.js";import"./types-C1NrGZG4.js";import"./operations-Cnp__Iuy.js";import"./signup-CIH6fgv_.js";import"./authRedirects-rZ3RzqhS.js";import"./NativeButton-BR3wnBC1.js";import"./SocialProofLogoBar-S9Fpgizh.js";import"./Header-B-xwWndS.js";import"./CheckIcon-DZiGoDcG.js";import"./InformationCircleIcon-B7IeukFl.js";import"./use-reduced-motion-Bo8k5F6T.js";import"./auth-NQQy6v6I.js";import"./ExhaustiveSwitchError-Dwg2PnPx.js";const it=r.lazy(async()=>({default:(await V(()=>import("./assistantGraphic-Bih4KeAJ.js"),__vite__mapDeps([0,1,2,3,4,5,6]))).AssistantGraphic})),at=n.jsx(it,{}),ct=["googleAuth","microsoftOutlookAuth"],ut=["microsoftOutlookAuth"],O=F,pt=Y;function Yt(){const{pathname:c,workspaceUrl:P}=M(),l=c==="/migrate-to-outlook",a=l?P:null,x=l?ut:ct,C=r.useCallback(e=>x.includes(e),[x]),[o,u]=r.useState({status:"loading"}),[h,g]=r.useState(!1),[L,_]=r.useState(!1),[T,j]=r.useState(null),[B,d]=r.useState(null),[N,v]=r.useState(!1),S=r.useRef(!1),[R]=r.useState(()=>c),A=c===R,[k,W]=r.useState(null);r.useEffect(()=>{if(!A||!k)return;const e=window.setTimeout(()=>window.location.assign(k.destination),k.delay);return()=>window.clearTimeout(e)},[k,A]),r.useEffect(()=>{document.title=l?"Switch to Outlook - Lindy":"Connect your accounts - Lindy";let e=!1;const i=t=>{I(t),e||u({status:"error",message:"We could not load account connection setup."})};if(l&&!a){u({status:"error",message:"We could not find that workspace for this account."});return}if(a){const t=z("/migrate-to-outlook",a);return f($({loginPath:`/login?redirectTo=${encodeURIComponent(t)}`,returnTo:t}).then(s=>e?null:s.redirectTo?(window.location.assign(s.redirectTo),null):b(O)).then(s=>{if(e||!s)return;const m=s.me.workspaceMemberships.find(({workspace:y})=>y.url===a)?.workspace;if(!m){u({status:"error",message:"We could not find that workspace for this account."});return}u({status:"ready",identity:{id:s.me.id,workspaceId:m.id,copy:s.me.customizations?.onboardingExperiments?.copy?.connectEmailCalendar,showSkip:s.me.customizations?.onboardingExperiments?.pageConfigs?.connectEmailCalendar?.showSkipButton===!0}})}).catch(i)),()=>{e=!0}}return f(H.call(Q).then(async({data:t,error:s})=>{if(e)return;if(s||!t?.redirectionBehavior){window.location.assign("/signup");return}if(t.redirectionBehavior.nextSignupStep!=="lindy_assistant_connect"||!t.id){window.location.assign(E(t.redirectionBehavior));return}const m=t.redirectionBehavior.lindyAssistantSlackWorkspaceId??t.workspaceMemberships[0]?.workspaceId;if(!m){u({status:"error",message:"We could not find a workspace for this account."});return}const y=await b(O);e||u({status:"ready",identity:{id:t.id,workspaceId:m,copy:y.me.customizations?.onboardingExperiments?.copy?.connectEmailCalendar,showSkip:y.me.customizations?.onboardingExperiments?.pageConfigs?.connectEmailCalendar?.showSkipButton===!0,progress:typeof t.redirectionBehavior.currentStep=="number"&&typeof t.redirectionBehavior.totalSteps=="number"?{currentStep:t.redirectionBehavior.currentStep,progressStepIds:t.redirectionBehavior.progressStepIds,totalSteps:t.redirectionBehavior.totalSteps}:void 0}})}).catch(i)),()=>{e=!0}},[l,a]);const w=r.useCallback(async e=>{if(!(o.status!=="ready"||S.current)){S.current=!0,g(!0),d(null);try{const t=(await b(pt,{input:{authId:e.authId,identityId:o.identity.id,skipped:e.skipped,workspaceId:o.identity.workspaceId}})).markLindyAssistantConnectComplete.redirectionBehavior;if(t.nextStep==="lindy_assistant_connect"){S.current=!1,g(!1),v(!0);return}_(!e.skipped);const s=a?J(a):E({nextSignupStep:t.nextStep,redirectTo:t.redirectTo});W({destination:s,delay:e.skipped?0:1500})}catch(i){I(i),S.current=!1,g(!1),d("We could not finish account connection. Try again.")}}},[o,a]);r.useEffect(()=>{if(o.status!=="ready")return;let e=!1,i=null;return f(K(o.identity.id,{onError:t=>{!e&&C(t.provider)&&(g(!1),d(t.message))},onUpdate:t=>{!e&&C(t.provider)&&(j(t.provider),f(w({authId:t.id})))}}).then(t=>{e?t():i=t})),()=>{e=!0,i?.()}},[w,C,o]);const U=r.useCallback(e=>{if(o.status!=="ready"||h)return;d(null),q(rt({markLindyAssistantConnectComplete:!0,manageForAssistant:!0,provider:e,scopes:e==="microsoftOutlookAuth"?st:nt,workspaceId:o.identity.workspaceId}),{features:"popup,width=600,height=760"})?v(!1):d("Your browser blocked the connection window. Allow popups and try again.")},[h,o]),D=r.useCallback(()=>f(w({skipped:!0})),[w]);if(o.status==="loading")return n.jsx(G,{});if(o.status==="error")return n.jsx(lt,{message:o.message});const p=o.identity.progress;return n.jsx(Z,{topContent:p&&p.totalSteps>
20?n.jsx(et,{steps:ot(p.progressStepIds,p.totalSteps),currentStep:p.currentStep}):void 0,progress:p?n.jsx(tt,{className:"mb-16",children:null},"progress-bar"):void 0,title:o.identity.copy?.title,subtitle:o.identity.copy?.subtitle,providers:x,disabled:h,completed:L,connectedProvider:T,error:B,permissionsNeeded:N,showSkip:o.identity.showSkip,skipDisabled:h,onConnect:U,onSkip:D})}function lt({message:c}){return n.jsx(X,{graphic:at,children:n.jsx("div",{"data-onboarding-content":!0,className:"mx-auto flex h-full w-full max-w-2xl flex-col px-[1px] pb-6 lg:max-w-[473px] lg:justify-center",children:n.jsxs("div",{className:"flex flex-col items-center text-center",children:[n.jsx("h1",{className:"text-2xl font-semibold text-slate-12",children:"Account connection unavailable"}),n.jsx("p",{className:"mt-3 text-sm text-slate-11",children:c}),n.jsx("a",{className:"mt-6 text-sm text-blue-10 underline",href:"/signup",children:"Return to signup"})]})})})}export{Yt as View};
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.