1import{j as e,r as y,B as he}from"./index-DP61GySm.js";import{b as ue,L as re}from"./index-MuG4xkEZ.js";import{u as Q,jQ as pe,jR as xe,a2 as G,jS as ge,z as oe,jT as ve,jU as ye,jV as fe,jW as be,cH as je,jX as we,jY as Ne,jZ as Ce,aw as ke,E as x,j_ as Se,j$ as Ge,id as ce,b7 as de,k0 as Ae,b8 as De,k1 as Pe,b9 as Ve,ba as Ie,C as Ee,k2 as Te,bc as le,bb as se,k3 as Re}from"./loader-circle-eo-mph3g.js";import{u as _,C as T,a as R,b as L,d as M,c as W}from"./use-toast-C6aFH3Eg.js";import{L as v,cF as Le,B as K,ap as Me,aq as ne,b4 as We,b5 as _e,b6 as Oe,cG as Ue,O as Z,cH as qe,cI as ze,aS as Ke,cJ as me}from"./App-0t6TVAR4.js";import{T as X,I as J}from"./triangle-alert-CaKCF_Nq.js";import{S as N,b as F}from"./section-chips-C68mRSIN.js";import{P as Fe,C as Be}from"./provider-setup-panel-LtsTIxHF.js";import{B as Je,T as Qe}from"./trademark-screen-DYufZ-CB.js";import{B as ie,K as $e}from"./toaster-BDyw2x6L.js";import{A as He}from"./sparkles-B4yqwNG6.js";import{S as Ye}from"./shield-check-BQHCFnRX.js";import"./vendor-shared-C5tCw9rW.js";import"./utils-hQAQiId-.js";import"./x-D235ZOFZ.js";import"./waypoints-C6gFN1cM.js";import"./dialog-B9xd4dRw.js";import"./privacy-I8Fotoxq.js";import"./chevron-right-qcpptIv2.js";import"./chevron-down-C8mjF8sg.js";import"./image-off-CpRV4JaY.js";import"./trial-copy-BQN_0jwW.js";import"./unicorniq-logo-B9mOeuD0.js";import"./provider-credential-row-9lgqOKql.js";import"./redirect-uri-health-B6WZk7XQ.js";function Xe({phoneReachEnabled:a}){const{toast:o}=_(),n=Q(),{data:s,isLoading:d}=pe(),c=xe(),u=r=>c.mutate({data:r},{onSuccess:C=>{n.setQueryData(ge(),C)},onError:C=>o({title:"Couldn't update Call Vera",description:String(C?.message??C),variant:"destructive"})});if(d||!s)return e.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground","data-testid":"call-vera-loading",children:[e.jsx(G,{className:"w-3 h-3 animate-spin"})," Loading Call Veraâ¦"]});const m=s.readiness,f=m.carrierConfigured&&m.bridgeAccepting&&m.speechReady,g=[{label:"Carrier voice configured",ok:m.carrierConfigured,detail:m.carrierMissing.length?`Missing: ${m.carrierMissing.join(", ")}`:void 0},{label:"Media bridge reachable",ok:m.bridgeAccepting,detail:m.mediaUrl},{label:"Speech-capable provider key for this workspace",ok:m.speechReady,detail:m.answerPath==="realtime"?"Answer path: realtime (lower latency, natural interruption)":m.answerPath==="chunking"?"Answer path: turn-based (transcribe, answer, speak)":"No live-dialog key and no transcription + synthesis pair"}];return e.jsxs("div",{className:"space-y-3 rounded-md border p-3","data-feature-anchor":"call-vera-panel","data-testid":"call-vera-panel",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsxs(v,{htmlFor:"call-vera-switch",className:"text-sm font-normal flex items-center gap-1.5",children:[e.jsx(Le,{className:"w-3.5 h-3.5","aria-hidden":!0})," Call Vera"]}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["Members phone ",m.number?e.jsx("span",{className:"font-mono",children:m.number}):"the platform number"," from their verified mobile, ask a question and hear a verified answer. Each call becomes a conversation in their history with the sources Vera used. Anything that needs confirming is queued for the app, never done by voice. The phone carrier carries the audio only â the listening, thinking and speaking happen on Veraâs own providers."]})]}),e.jsx(N,{id:"call-vera-switch",checked:s.voiceEnabled,onCheckedChange:r=>u({voiceEnabled:r}),disabled:c.isPending||!a,"data-testid":"call-vera-switch"})]}),!a&&e.jsx("p",{className:"text-xs text-muted-foreground",children:"Turn on âMembers may reach Vera by phone numberâ first."}),e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(v,{htmlFor:"call-vera-pin",className:"text-sm font-normal",children:"Require a spoken PIN before answering"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Step-up against caller-id spoofing. Members set their PIN under Settings â Phone; five wrong guesses lock the PIN for fifteen minutes."})]}),e.jsx(N,{id:"call-vera-pin",checked:s.pinRequired,onCheckedChange:r=>u({pinRequired:r}),disabled:c.isPending,"data-testid":"call-vera-pin-switch"})]}),e.jsxs("div",{className:"space-y-1","data-testid":"call-vera-readiness",children:[e.jsxs("div",{className:"flex items-center gap-2 text-xs font-medium",children:["Readiness",e.jsx(K,{variant:f?"secondary":"outline",children:f?"Ready":"Not ready"})]}),e.jsx("ul",{className:"space-y-0.5",children:g.map(r=>e.jsxs("li",{className:"flex items-start gap-2 text-xs",children:[r.ok?e.jsx(F,{className:"w-3.5 h-3.5 mt-0.5 text-emerald-600 dark:text-emerald-400","aria-label":"ok"}
1):e.jsx(X,{className:"w-3.5 h-3.5 mt-0.5 text-amber-600 dark:text-amber-400","aria-label":"not ready"}),e.jsxs("span",{children:[r.label,r.detail&&e.jsx("span",{className:"block text-muted-foreground break-all",children:r.detail})]})]},r.label))}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["Limits: ",s.limits.memberConcurrent===1?"one live call":`${s.limits.memberConcurrent} live calls`," per member, ",s.limits.tenantConcurrent," per workspace,"," ",s.limits.memberDayMinutes," min per member and ",s.limits.tenantDayMinutes," min per workspace a day,"," ",Math.round(s.limits.maxCallSeconds/60)," min per call.",s.limits.source==="workspace"?" These caps were set for this workspace by the platform operator.":s.limits.source==="platform"?" Platform-wide caps set by the operator.":""]})]}),e.jsxs("div",{className:"space-y-1","data-testid":"call-vera-recent",children:[e.jsx("div",{className:"text-xs font-medium",children:"Recent calls"}),s.recentCalls.length===0?e.jsx("p",{className:"text-xs text-muted-foreground",children:"No calls yet."}):e.jsx("ul",{className:"divide-y rounded border text-xs",children:s.recentCalls.map(r=>e.jsxs("li",{className:"flex flex-wrap items-center justify-between gap-2 px-2 py-1.5",children:[e.jsxs("span",{children:[e.jsx("span",{className:"font-medium",children:r.memberName??"Unknown caller"}),r.fromNumber&&e.jsx("span",{className:"ml-1 font-mono text-muted-foreground",children:r.fromNumber})]}),e.jsxs("span",{className:"text-muted-foreground",children:[new Date(r.startedAt).toLocaleString()," · ",r.outcome.replace(/_/g," "),r.endReason?` · ${r.endReason.replace(/_/g," ")}`:""," · ",r.turns," turn",r.turns===1?"":"s"," ·"," ",r.billableMinutes," min"]})]},r.id))})]})]})}const E=a=>a?.data?.error??"Try again.",Ze=[{title:"Create a Google account for Vera",body:"In the Google Admin console, add a normal Workspace user such as vera@yourdomain (Google bills it as a regular seat). Set a strong password and 2-step verification like any other account â Vera never needs to know them."},{title:"Create Vera's identity in this workspace",body:"One flagged service user, created below. It cannot sign in, holds no roles, never appears in learner or reporting surfaces, and is not billed as a Vera seat."},{title:"Connect its Google account",body:"Click Connect below and sign in AS the new Google user (not as yourself â the connected address is shown afterwards so a mix-up is obvious). One consent screen covers every enabled Google app."},{title:"Share org content with it",body:"Share folders or shared drives to Vera's Google address like you would to a colleague. They appear under Knowledge â sources as âGoogle Drive (Vera's account)â for browsing, imports, and watched folders."}];function ea(){const{toast:a}=_(),o=Q(),{data:n}=oe(),{data:s,isLoading:d}=ve(),c=ye({query:{queryKey:Ge(),enabled:!!s?.lanes?.inboundPhoneEnabled,staleTime:3e4}}),u=fe(),m=be(),f=je(),g=we(),r=Ne(),C=Ce(),O=ke(),[A,$]=y.useState(""),[H,D]=y.useState(!1),[b,P]=y.useState(!1),U=y.useRef(null),[S,B]=y.useState(null),w=()=>o.invalidateQueries({queryKey:Se()});y.useEffect(()=>{new URLSearchParams(window.location.search).get("connector")&&w()},[]);const Y=()=>{u.mutate({data:A.trim()?{lastName:A.trim()}:{}},{onSuccess:()=>{a({title:"Vera identity created",description:"Now connect its Google account."}),w()},onError:t=>a({title:"Could not create the identity",description:E(t),variant:"destructive"})})},q=()=>{if(S!=="read_write"){a({title:"Choose access before connecting",description:"This shared Google service grant cannot offer a separate read-only level.",variant:"destructive"});return}f.mutate({provider:"google",data:{redirectTo:"/google-setup",forServiceIdentity:!0,accessLevel:S}},{onSuccess:t=>{window.location.href=t.authorizeUrl},onError:t=>a({title:"Could not start connecting",description:E(t),variant:"destructive"})})},k=(t,h)=>{g.mutate({data:t==="chat"?{chatEnabled:h}:t==="email"?{emailEnabled:h}:t==="inbound-chat"?{inboundChatEnabled:h}:t==="inbound-email"?{inboundEmailEnabled:h}:t==="inbound-phone"?{inboundPhoneEnabled:h}:t==="inbound-whatsapp"?{inboundWhatsappEnabled:h}:{inboundSmsEnabled:h}},{onSuccess:()=>{w(),(t==="inbound-phone"||t==="inbound-sms")&&c.refetch()},onError:I=>a({title:"Could not update the setting",description:E(I),variant:"destructive"})})},l=async t=>{const h=t.target.files?.[0];if(t.target.value="",!!h){if(!["image/png","image/jpeg","image/webp","image/gif"].includes(h.type)){a({title:"Unsupported image",description:"Use a PNG, JPEG, WebP, or GIF.",variant:"destructive"});return}if(h.size>8*1024*1024){a({title:"Image too large",description:"Choose an image under 8 MB.",variant:"destructive"});return}P(!0);try{const I=await O.mutateAsync({data:{name:h.name,size:h.size,contentType:h.type}}),te=await fetch(I.uploadURL,{method:"PUT",headers:{"Content-Type":h.type},body:h});if(!te.ok)throw new Error(`upload failed (${te.status})`);await r.mutateAsync({data:{objectPath:I.objectPath,contentType:h.type,sizeBytes:h.size,originalName:h.name}}),await w(),a({title:"Photo updated",description:"Vera's in-app avatar was saved."})}catch(I){a({title:"Upload failed",description:E(I),variant:"destructive"})}finally{P(!1)}}},p=async()=>{P(!0);try{await C.mutateAsync(),await w(),a({title:"Photo removed"})}catch(t){a({title:"Could not remove the photo",description:E(t),variant:"destructive"})}finally{P(!1)}},V=()=>{m.mutate(void 0,{onSuccess:()=>{D(!1),a({title:"Vera identity removed",description:"Anything that used its Drive access will ask for a new setup."}),w()},onError:t=>a({title:"Could not remove the identity",description:E(t),variant:"destructive"})})},z=!!s?.exists,i=s?.lanes,j=s?.googleAddress??null,ee=!!s?.driveConnected,ae=!!j&&!!n?.email&&j.toLowerCase()===n.email.toLowerCase();return e.jsxs(T,{"data-testid":"vera-account-card",children:[e.jsx(R,{children:e.jsx("div",{className:"flex items-start justify-between gap-4",children:e.jsxs("div",{className:"space-y-1.5",children:[e.jsxs(L,{className:"flex items-center gap-2 text-lg",children:[e.jsx(ie,{className:"w-5 h-5 text-primary"})," Veraâs own account",e.jsx(K,{children:"Recommended"})]}
1),e.jsx(M,{children:"Give Vera a real Google Workspace user (like vera@yourdomain) and connect it here. Vera gets its own mailbox, Chat identity, calendar, and a Drive your team can share org content to â with exactly the access you grant it, and no domain-wide delegation."})]})})}),e.jsxs(W,{className:"space-y-4",children:[e.jsx("ol",{className:"space-y-3",children:Ze.map((t,h)=>e.jsxs("li",{className:"flex gap-3",children:[e.jsx("span",{className:"flex-none w-6 h-6 rounded-full bg-muted text-xs font-medium flex items-center justify-center mt-0.5",children:h+1}),e.jsxs("div",{className:"space-y-0.5",children:[e.jsx("div",{className:"text-sm font-medium",children:t.title}),e.jsx("p",{className:"text-xs text-muted-foreground",children:t.body})]})]},t.title))}),d?null:z?e.jsxs("div",{className:"rounded-lg border p-4 space-y-3","data-testid":"vera-identity-status",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsxs("div",{className:"text-sm font-medium flex items-center gap-2",children:[s?.user?.displayName??"Vera",e.jsx(K,{variant:"outline",children:"Service identity"})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:j?e.jsxs(e.Fragment,{children:["Connected Google account:"," ",e.jsx("span",{className:"font-mono text-foreground","data-testid":"vera-google-address",children:j}),ee?" (Drive connected)":" (Drive not connected yet)"]}):"No Google account connected yet."})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-xs text-muted-foreground",children:"Shared Google access:"}),e.jsx(x,{type:"button",size:"sm",variant:S==="none"?"default":"outline",onClick:()=>B("none"),children:"No access"}),e.jsx(x,{type:"button",size:"sm",variant:S==="read_write"?"default":"outline",onClick:()=>B("read_write"),children:"Read and write"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(x,{variant:j?"outline":"default",size:"sm",onClick:q,disabled:f.isPending||S!=="read_write","data-testid":"vera-connect-button",children:[f.isPending?e.jsx(G,{className:"w-4 h-4 mr-1.5 animate-spin"}):j?e.jsx(Me,{className:"w-4 h-4 mr-1.5"}):e.jsx(F,{className:"w-4 h-4 mr-1.5"}),j?"Reconnect":"Connect Google account"]}),H?e.jsxs(e.Fragment,{children:[e.jsxs(x,{variant:"destructive",size:"sm",onClick:V,disabled:m.isPending,"data-testid":"vera-remove-confirm",children:[m.isPending?e.jsx(G,{className:"w-4 h-4 mr-1.5 animate-spin"}):e.jsx(ne,{className:"w-4 h-4 mr-1.5"}),"Remove"]}),e.jsx(x,{variant:"ghost",size:"sm",onClick:()=>D(!1),children:"Keep"})]}):e.jsx(x,{variant:"ghost",size:"sm",onClick:()=>D(!0),"aria-label":"Remove Vera's identity","data-testid":"vera-remove-button",children:e.jsx(ne,{className:"w-4 h-4"})})]})]}),ae&&e.jsxs("div",{className:"flex items-start gap-2 rounded-md border border-amber-500/40 bg-amber-500/10 p-3 text-xs","data-testid":"vera-own-account-warning",children:[e.jsx(X,{className:"w-4 h-4 flex-none text-amber-600 dark:text-amber-400"}),e.jsxs("p",{children:["Thatâs ",e.jsx("span",{className:"font-medium",children:"your own"})," Google account, not Veraâs. Click Reconnect and sign in as Veraâs Google user instead â otherwise everything shared âto Veraâ would ride your personal access."]})]}),j&&!ae&&ee&&e.jsxs("p",{className:"text-xs text-muted-foreground",children:["Share folders or shared drives to ",j," and they become available under Knowledge sources as âGoogle Drive (Veraâs account)â."]})]}):e.jsxs("div",{className:"rounded-lg border p-4 space-y-3","data-testid":"vera-identity-create",children:[e.jsx("div",{className:"text-sm font-medium",children:"Step 2 â create Veraâs identity"}),e.jsxs("div",{className:"flex flex-wrap items-end gap-3",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(v,{htmlFor:"vera-first-name",className:"text-xs",children:"First name"}),e.jsx(J,{id:"vera-first-name",value:"Vera",disabled:!0,className:"w-36"})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsxs(v,{htmlFor:"vera-last-name",className:"text-xs",children:["Last name ",e.jsx("span",{className:"text-muted-foreground",children:"(optional)"})]}),e.jsx(J,{id:"vera-last-name",value:A,onChange:t=>$(t.target.value),placeholder:"e.g. your company name",maxLength:100,className:"w-52","data-testid":"vera-last-name-input"})]}),e.jsxs(x,{onClick:Y,disabled:u.isPending,"data-testid":"vera-identity-create-button",children:[u.isPending?e.jsx(G,{className:"w-4 h-4 mr-1.5 animate-spin"}):null,"Create Veraâs identity"]})]})]}),z&&e.jsxs("div",{className:"rounded-lg border p-4 space-y-4","data-testid":"vera-sender-lanes",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx("div",{className:"text-sm font-medium",children:"Deliver as Vera"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Let notifications you already send â assignment notices, coaching updates, review requests, scheduled briefs â arrive from Veraâs own account. Only these registered notifications can use it, sends are rate-limited and audited, and in-app delivery always remains as the fallback."})]}),e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(v,{htmlFor:"vera-chat-lane",className:"text-sm font-normal",children:"Chat messages from Vera"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:i?.chatNeedsReconnect?"Google Chat connection needs a reconnect â deliveries are falling back to in-app.":i?.chatConnected?"Google Chat DMs are sent by Vera's account when the Chat app isn't set up.":"Connect Vera's Google account (with Chat) to turn this on."})]}),e.jsx(N,{id:"vera-chat-lane",checked:!!i?.chatEnabled,onCheckedChange:t=>k("chat",t),disabled:g.isPending||!i?.chatConnected&&!i?.chatEnabled,"data-testid":"vera-chat-lane-switch"})]}),e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(v,{htmlFor:"vera-email-lane",className:"text-sm font-normal",children:"Notification emails from Vera"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:i?.mailNeedsReconnect?"Gmail connection needs a reconnect â deliveries are falling back to in-app.":i?.mailConnected?`Notification emails are sent from ${j??"Vera's Gmail"}
1. Emails people send themselves keep their own identity.`:"Connect Vera's Google account (with Gmail) to turn this on."})]}),e.jsx(N,{id:"vera-email-lane",checked:!!i?.emailEnabled,onCheckedChange:t=>k("email",t),disabled:g.isPending||!i?.mailConnected&&!i?.emailEnabled,"data-testid":"vera-email-lane-switch"})]}),e.jsxs("div",{className:"space-y-4 border-t pt-4","data-testid":"vera-inbound-lanes",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx("div",{className:"text-sm font-medium",children:"Ask Vera directly"}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["Let people message Veraâs account and get a ",e.jsx(Je,{priority:Qe.prose,children:he.backed})," answer back â workspace members only. Anyone else gets no answer: unknown email is filed silently, an unknown Chat DM gets one generic decline. Vera checks for new messages every few minutes, so replies arenât instant. Everything is rate-limited and audited, and Vera only ever replies â it never starts a conversation."]})]}),e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(v,{htmlFor:"vera-inbound-chat-lane",className:"text-sm font-normal",children:"Answer Google Chat DMs"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:i?.chatNeedsReconnect?"Google Chat connection needs a reconnect â inbound DMs are paused.":i?.chatConnected?"Members can DM Vera’s account in Google Chat and get an answer in that DM.":"Connect Vera's Google account (with Chat) to turn this on."})]}),e.jsx(N,{id:"vera-inbound-chat-lane",checked:!!i?.inboundChatEnabled,onCheckedChange:t=>k("inbound-chat",t),disabled:g.isPending||!i?.chatConnected&&!i?.inboundChatEnabled,"data-testid":"vera-inbound-chat-switch"})]}),e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(v,{htmlFor:"vera-inbound-email-lane",className:"text-sm font-normal",children:"Answer emails"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:i?.mailNeedsReconnect?"Gmail connection needs a reconnect â inbound email is paused.":i?.mailConnected?`Members can email ${j??"Vera's address"} and get the answer as a reply in the same thread.`:"Connect Vera's Google account (with Gmail) to turn this on."})]}),e.jsx(N,{id:"vera-inbound-email-lane",checked:!!i?.inboundEmailEnabled,onCheckedChange:t=>k("inbound-email",t),disabled:g.isPending||!i?.mailConnected&&!i?.inboundEmailEnabled,"data-testid":"vera-inbound-email-switch"})]}),e.jsxs("div",{className:"flex items-center justify-between gap-3","data-feature-anchor":"vera-phone-reach-switch",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(v,{htmlFor:"vera-inbound-phone-lane",className:"text-sm font-normal",children:"Members may reach Vera by phone number"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Lets text-message, WhatsApp and phone-call lanes answer a member once their mobile number is verified in their Settings. Off by default; the answering lanes themselves arrive separately and all read this one switch."})]}),e.jsx(N,{id:"vera-inbound-phone-lane",checked:!!i?.inboundPhoneEnabled,onCheckedChange:t=>k("inbound-phone",t),disabled:g.isPending,"data-testid":"vera-inbound-phone-switch"})]}),i?.inboundPhoneEnabled&&e.jsxs("div",{className:"space-y-2 rounded-md border p-3","data-feature-anchor":"text-vera-switch",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(v,{htmlFor:"vera-inbound-sms-lane",className:"text-sm font-normal",children:"Text Vera"}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:[c.data?.number?`Members with a verified number can text ${c.data.number} and get Vera's answer back as themselves; the turn appears in their web history.`:"Members with a verified number can text the platform number and get an answer back as themselves."," ","The mobile carrier handles message bodies in transit."]})]}),e.jsx(N,{id:"vera-inbound-sms-lane",checked:!!i?.inboundSmsEnabled,onCheckedChange:t=>k("inbound-sms",t),disabled:g.isPending,"data-testid":"vera-inbound-sms-switch"})]}),c.data&&e.jsxs("ul",{className:"space-y-1 text-xs","data-testid":"text-vera-readiness",children:[c.data.checks.map(t=>e.jsxs("li",{className:"flex items-start gap-2",children:[e.jsx("span",{className:t.ok===!0?"text-emerald-600 dark:text-emerald-400":t.ok===!1?"text-destructive":"text-muted-foreground","aria-hidden":"true",children:t.ok===!0?"â":t.ok===!1?"â":"?"}),e.jsxs("span",{className:"text-muted-foreground",children:[e.jsx("span",{className:"sr-only",children:t.ok===!0?"Ready: ":t.ok===!1?"Not ready: ":"Unconfirmed: "}),t.detail]})]},t.key)),e.jsxs("li",{className:"text-muted-foreground",children:["Last ",c.data.recent.days," days: ",c.data.recent.total," texts received,"," ",c.data.recent.answered," answered, ",c.data.recent.failed," failed."]})]})]}),e.jsx(Xe,{phoneReachEnabled:!!i?.inboundPhoneEnabled}),e.jsxs("div",{className:"flex items-center justify-between gap-3","data-feature-anchor":"vera-whatsapp-switch",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(v,{htmlFor:"vera-inbound-whatsapp-lane",className:"text-sm font-normal",children:"WhatsApp Vera"}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:[i?.whatsappNumber?`Members with a verified number can message Vera on WhatsApp at ${i.whatsappNumber} and get answers as themselves. Messages travel through Meta's WhatsApp Business platform.`:"Members with a verified number can message Vera on WhatsApp. The platform WhatsApp number is not configured yet, so nothing can answer until it is."," ","Needs the phone-number switch above."]})]}),e.jsx(N,{id:"vera-inbound-whatsapp-lane",checked:!!i?.inboundWhatsappEnabled,onCheckedChange:t=>k("inbound-whatsapp",t),disabled:g.isPending||!i?.inboundPhoneEnabled,"data-testid":"vera-inbound-whatsapp-switch"})]})]}),(i?.chatNeedsReconnect||i?.mailNeedsReconnect)&&e.jsxs("div",{className:"flex items-start gap-2 rounded-md border border-amber-500/40 bg-amber-500/10 p-3 text-xs","data-testid":"vera-lane-reconnect-warning",children:[e.jsx(X,{className:"w-4 h-4 flex-none text-amber-600 dar
1k:text-amber-400"}),e.jsx("div",{className:"flex-1",children:"Veraâs Google access has gone stale. Reconnect its account to resume sending as Vera â nothing is lost, deliveries arrive in-app meanwhile."}),e.jsx(x,{size:"sm",variant:"outline",onClick:q,disabled:f.isPending,children:"Reconnect"})]}),e.jsxs("div",{className:"flex items-center gap-3 border-t pt-4",children:[e.jsxs(We,{className:"w-10 h-10",children:[s?.photoUrl?e.jsx(_e,{src:s.photoUrl,alt:"Vera"}):null,e.jsx(Oe,{children:e.jsx(ie,{className:"w-5 h-5"})})]}),e.jsxs("div",{className:"flex-1 space-y-0.5",children:[e.jsx("div",{className:"text-sm font-medium",children:"In-app avatar"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Shown wherever Vera appears inside this workspace. The photo recipients see in Gmail and Google Chat comes from the Google account itself â set it by signing in as Veraâs Google user and adding a profile photo there."})]}),e.jsx("input",{ref:U,type:"file",accept:"image/png,image/jpeg,image/webp,image/gif",className:"hidden",onChange:l,"data-testid":"vera-photo-input"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(x,{size:"sm",variant:"outline",onClick:()=>U.current?.click(),disabled:b,"data-testid":"vera-photo-upload-button",children:[b?e.jsx(G,{className:"w-4 h-4 mr-1.5 animate-spin"}):e.jsx(Ue,{className:"w-4 h-4 mr-1.5"}),s?.photoUrl?"Change":"Upload"]}),s?.photoUrl?e.jsx(x,{size:"sm",variant:"ghost",onClick:p,disabled:b,"data-testid":"vera-photo-remove-button",children:"Remove"}):null]})]})]})]})]})}const aa=[{id:"drive_export",title:"Drive â deck & document export",description:"Lets Vera create native Google Slides / Docs from generated decks and outputs in the impersonated user's Drive.",target:"domain_wide_delegation",targetLabel:"Domain-wide delegation (Admin console â Security â API controls)",scopes:["https://www.googleapis.com/auth/drive.file"]},{id:"drive_import",title:"Drive â knowledge import",description:"Lets Vera read existing Docs, Sheets, Slides, and files from Drive to answer from your own content.",target:"domain_wide_delegation",targetLabel:"Domain-wide delegation (Admin console â Security â API controls)",scopes:["https://www.googleapis.com/auth/drive.readonly"]},{id:"chat_app",title:"Google Chat app",description:"Lets Vera post coaching invites and read-aloud cards as a Chat app. Granted to the service account when you configure the Chat API.",target:"chat_app",targetLabel:"Google Cloud console â Chat API configuration",scopes:["https://www.googleapis.com/auth/chat.bot"]},{id:"meet",title:"Meet & Calendar â live coaching",description:"Lets a member create a real Google Meet space, read the spaces and conference records Vera created, end a running conference in one of them, and put sessions on their calendar. Google limits the Meet scope to spaces Vera created, and Meet has no pause/hold (Teams does) â ending the conference is the only remote control. These are authorized per-user when each member connects Google, not via delegation.",target:"oauth_consent",targetLabel:"Per-user OAuth consent (each coach connects their own Google)",scopes:["https://www.googleapis.com/auth/meetings.space.created","https://www.googleapis.com/auth/calendar.events"]},{id:"directory_sync",title:"Directory sync â mirror members and Google Groups",description:"Lets Vera create members, mirror selected Google Groups (with nesting) and deactivate suspended or archived users from your platform-bound Google Workspace domain(s). Read-only; a Google Workspace administrator connects once from the Directory sync page â nothing to paste into the Admin console.",target:"directory_sync",targetLabel:"Granted by a Google Workspace admin on Members â Directory sync (platform app; Admin SDK API enabled by Vera's team)",scopes:["https://www.googleapis.com/auth/admin.directory.user.readonly","https://www.googleapis.com/auth/admin.directory.group.readonly","https://www.googleapis.com/auth/admin.directory.group.member.readonly"]}];function ta(a){const o=new Set,n=[];for(const s of a){const d=(s??"").trim();!d||o.has(d)||(o.add(d),n.push(d))}return n.join(", ")}function sa(a){const o=a.serviceAccountConfigured,n=a.driveConfigured,s=o&&!n;return[{id:"drive_export",label:"Drive â export",state:n?"connected":"not_connected",detail
1:n?"The service account is verified; decks and documents can be exported to Drive.":s?"The service account is Chat-only. Add an impersonated Workspace user (and its delegation grant) to enable Drive export.":"Upload a service-account key below to enable Drive export."},{id:"drive_import",label:"Drive â import",state:n?"manual":"not_connected",detail:n?"The service account is set. Grant the drive.readonly scope in delegation to allow importing existing Drive content.":s?"The service account is Chat-only. Add an impersonated Workspace user, then grant the drive.readonly scope.":"Upload a service-account key below, then grant the drive.readonly scope."},{id:"chat_app",label:"Google Chat app",state:a.chatAvailable?"connected":"not_connected",detail:a.chatAvailable?"The Chat app can be reached. Confirm the Chat API is configured with the chat.bot scope.":"Upload a service-account key and configure the Chat API to enable Chat delivery."},{id:"meet",label:"Meet & Calendar",state:"manual",detail:"Live coaching Meet links are authorized per-coach when each coach connects their own Google account."},{id:"directory_sync",label:"Directory sync",state:a.directorySyncBound?"connected":"manual",detail:a.directorySyncBound?"Your Google Workspace directory is bound â Vera mirrors users and selected Google Groups on the schedule set on the Directory sync page.":"Rides the platform app Vera provides (no service account). Have a Google Workspace administrator connect once from the Directory sync page, after Vera's team has bound your domain."}]}const na=[{title:"Create a Google Cloud service account",body:"In the Google Cloud console, create a project (or pick one), then create a service account. Note its client email â it ends in .iam.gserviceaccount.com."},{title:"Enable the required APIs",body:"Enable the Google Drive API and the Google Chat API for the project. Meet and Calendar are authorized per-coach later, so no project-level toggle is needed for them."},{title:"Configure domain-wide delegation (Drive features only)",body:"In the Admin console (Security â API controls â Domain-wide Delegation), add the service account's client ID and paste the delegation scopes below into the OAuth scopes field. Upload your JSON key below first and Vera extracts that client ID for you. Skip this step entirely for Chat-only mode â the Chat app authenticates as itself, never as a user."},{title:"Set up the Chat app",body:"In the Google Chat API configuration, register Vera as a Chat app and grant it the chat.bot scope so it can post coaching invites and read-aloud cards."},{title:"Upload the service-account JSON key",body:"Create a JSON key for the service account, then upload or paste it below along with the Workspace user Vera should act as. Vera verifies the key immediately and shows live status for each capability."}];function ia({label:a,hint:o,text:n}){const{toast:s}=_(),[d,c]=y.useState(!1),u=async()=>{try{await navigator.clipboard.writeText(n),c(!0),setTimeout(()=>c(!1),1500),s({title:"Copied to clipboard"})}catch{s({title:"Copy failed â select and copy manually",variant:"destructive"})}};return e.jsxs("div",{className:"space-y-1.5",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsx("div",{className:"text-sm font-medium",children:a}),e.jsxs(x,{variant:"outline",size:"sm",className:"h-7",onClick:u,children:[d?e.jsx(F,{className:"w-3.5 h-3.5"}):e.jsx(me,{className:"w-3.5 h-3.5"}),e.jsx("span",{className:"ml-1.5",children:d?"Copied":"Copy"})]})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:o}),e.jsx("pre",{className:"p-3 rounded-lg bg-muted/50 border text-xs font-mono whitespace-pre-wrap break-all select-all",children:n})]})}function ra({text:a,label:o}){const{toast:n}=_(),[s,d]=y.useState(!1),c=async()=>{try{await navigator.clipboard.writeText(a),d(!0),setTimeout(()=>d(!1),1500),n({title:`Copied ${o}`})}catch{n({title:"Copy failed â select and copy manually",variant:"destructive"})}};return e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("code",{className:"flex-1 text-xs bg-muted rounded-md px-2 py-1.5 font-mono truncate",children:a}),e.jsx(x,{type:"button",variant:"outline",size:"sm",onClick:c,"aria-label":`Copy ${o}`,children:s?e.jsx(F,{className:"w-3.5 h-3.5"}):e.jsx(me,{className:"w-3.5 h-3.5"})})]})}function oa({group:a}){return e.jsxs("div",{className:"space-y-2 p-4 rounded-lg border bg-card",children:[e.jsxs("div",{children:[e.jsx("div",{className:"font-medium text-sm",children:a.title}),e.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:a.description})]}),e.jsx(ia,{label:"Scopes",hint:a.target==="directory_sync"?a.targetLabel:`Paste into: ${a.targetLabel}`,text:ta(a.scopes)})]})}function ca({steps:a}){return e.jsx("ol",{className:"space-y-4",children:a.map((o,n)=>e.jsxs("li",{className:"flex gap-3",children:[e.jsx("div",{className:"flex-none w-7 h-7 rounded-full bg-primary/10 text-primary font-semibold text-sm flex items-center justify-center",children:n+1}),e.jsxs("div",{className:"space-y-0.5",children:[e.jsx("div",{className:"font-medium text-sm",children:o.title}),e.jsx("p",{className:"text-sm text-muted-foreground",children:o.body})]})]},n))})}function da(){const{toast:a}=_(),o=Q(),{data:n,isLoading:s}=De({query:{retry:!1,queryKey:se()}}),{data:d}=ce(),{data:c}=Pe(),u=Ve(),m=Ie(),[f,g]=y.useState(""),[r,C]=y.useState(""),[O,A]=y.useState(""),[$,H]=y.useState(!1),D=y.useRef(null);!$&&n&&(n.configured&&(C(n.impersonateSubject??""),A(n.sharedDriveId??"")),H(!0));const b=y.useMemo(()=>{const l=f.trim();if(!l)return null;try{const p=JSON.parse(l),V=typeof p.client_email=="string"?p.client_email:null,z=typeof p.client_id=="string"?p.client_id:null;return!V&&!z?{invalid:!0}:{invalid:!1,clientEmail:V,clientId:z,isServiceAccount:p.type==="service_account"}}
1catch{return{invalid:!0}}},[f]),P=async l=>{if(l)try{const p=await l.text();g(p)}catch{a({title:"Could not read that file",description:"Try pasting the JSON key instead.",variant:"destructive"})}},U=()=>{o.invalidateQueries({queryKey:se()}),o.invalidateQueries({queryKey:le()}),o.invalidateQueries({queryKey:Re()})},S=()=>{const l=f.trim(),p=r.trim();if(!l){a({title:"Upload or paste your service account JSON key",variant:"destructive"});return}if(p&&!p.includes("@")){a({title:"That impersonated user doesnât look like an email",description:"Enter a Google Workspace email address, or leave it blank for Chat-only mode.",variant:"destructive"});return}if(!p&&O.trim()){a({title:"A Shared Drive needs an impersonated user",description:"Exports write as that Workspace identity. Add an impersonated user, or clear the Shared Drive field.",variant:"destructive"});return}u.mutate({data:{saJsonKey:l,impersonateSubject:p||null,sharedDriveId:O.trim()||null}},{onSuccess:()=>{U(),g(""),a({title:p?"Google Workspace connected":"Google Workspace connected (Chat-only)",description:p?"Vera verified the key and updated capability status.":"The Chat app can deliver messages. Add an impersonated user later to unlock Drive features."})},onError:V=>a({title:"Could not connect Google Workspace",description:V?.data?.error??"Check the key, the impersonated user, and domain-wide delegation, then try again.",variant:"destructive"})})},B=()=>{m.mutate(void 0,{onSuccess:()=>{U(),g(""),a({title:"Google Workspace disconnected"})},onError:()=>a({title:"Could not disconnect",variant:"destructive"})})},w=!!n?.configured,{data:Y}=Ee(),q=!!(Y??[]).find(l=>l.slug==="google-directory-sync")?.workspaceBound,k=sa({serviceAccountConfigured:!!d?.available,driveConfigured:!!d?.driveConfigured,sharedDriveConfigured:!!d?.sharedDriveConfigured,chatAvailable:!!c?.available,directorySyncBound:q});return e.jsxs("div",{id:"google-step-3",className:"space-y-6 scroll-mt-4",children:[e.jsxs(T,{children:[e.jsxs(R,{children:[e.jsxs(L,{className:"flex items-center gap-2 text-lg",children:[e.jsx(Z,{className:"w-5 h-5 text-primary"})," Org-wide service account ",e.jsx(K,{variant:"outline",children:"Optional"})]}),e.jsxs(M,{children:["Powers org-level features â exporting decks to Google Slides, Drive import, and Google Chat delivery â via a service account with domain-wide delegation. Itâs a"," ",e.jsx("span",{className:"font-medium text-foreground",children:"different identity"})," from the per-user OAuth app above: a numeric ID and a JSON key, never a client ID & secret. Skip it if you donât need those features yet."]})]}),e.jsx(W,{children:e.jsx(Be,{statuses:k})})]}),e.jsxs(T,{children:[e.jsxs(R,{children:[e.jsx(L,{className:"text-lg",children:"Step by step"}),e.jsx(M,{children:"Do these in order in the Google Cloud + Admin consoles."})]}),e.jsx(W,{children:e.jsx(ca,{steps:na})})]}),e.jsxs(T,{children:[e.jsxs(R,{children:[e.jsx(L,{className:"text-lg",children:"Required OAuth scopes"}),e.jsx(M,{children:"Copy each block into the place noted. Drive scopes go into domain-wide delegation; the Chat scope is granted to the Chat app; Meet & Calendar are authorized per-coach."})]}),e.jsxs(W,{className:"space-y-3",children:[aa.map(l=>e.jsx(oa,{group:l},l.id)),e.jsx(x,{asChild:!0,variant:"outline",size:"sm","data-testid":"google-setup-directory-sync-link","data-feature-anchor":"google-setup-directory-sync",children:e.jsx(re,{href:"/directory-sync",children:q?"Manage directory sync":"Set up directory sync"})})]})]}),e.jsxs(T,{children:[e.jsxs(R,{children:[e.jsxs(L,{className:"flex items-center gap-2 text-lg",children:[e.jsx($e,{className:"w-5 h-5 text-primary"}),"Service-account key"]}),e.jsx(M,{children:"Upload the JSON key file (or paste it) to connect or replace it. The key is encrypted at rest and never shown again â updating always requires a fresh key."})]}),e.jsx(W,{className:"space-y-4",children:s?e.jsx("div",{className:"text-sm text-muted-foreground animate-pulse",children:"Loadingâ¦"}):e.jsxs(e.Fragment,{children:[w&&e.jsxs("div",{className:"p-3 rounded-lg bg-emerald-500/10 border border-emerald-500/20 text-emerald-800 dark:text-emerald-200 text-xs space-y-0.5",children:[e.jsxs("div",{className:"flex items-center gap-2 font-semibold text-sm",children:[e.jsx(Ye,{className:"w-4 h-4"})," Connected"]}),e.jsxs("div",{children:["Service account: ",e.jsx("span",{className:"font-mono",children:n?.saClientEmail})]}),e.jsxs("div",{children:["Acting as:"," ",n?.impersonateSubject?e.jsx("span",{className:"font-medium",children:n.impersonateSubject}):e.jsx("span",{className:"font-medium",children:"Chat-only â no impersonated user (Drive features off)"})]}),!!n?.impersonateSubject&&e.jsxs("div",{children:["Destination: ",n?.sharedDriveId?e.jsxs(e.Fragment,{children:["Shared Drive ",e.jsx("span",{className:"font-mono",children:n.sharedDriveId})," + My Drive"]}):"My Drive"]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(v,{htmlFor:"gw-key",children:"Service account JSON key"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("input",{ref:D,type:"file",accept:".json,application/json",className:"hidden",onChange:l=>{P(l.target.files?.[0]),l.target.value=""},"data-testid":"google-sa-key-file"}),e.jsxs(x,{type:"button",variant:"outline",size:"sm",onClick:()=>D.current?.click(),children:[e.jsx(ze,{className:"w-3.5 h-3.5 mr-1.5"})," Upload key file"]}),e.jsx("span",{className:"text-xs text-muted-foreground",children:"or paste it below"})]}),e.jsx(Ke,{id:"gw-key",value:f,onChange:l=>g(l.target.value),placeholder:'{ "type": "service_account", "client_email": "â¦", "private_key": "â¦" }',className:"font-mono text-xs h-32"}
1),b?.invalid&&e.jsx("p",{className:"text-xs text-amber-600",children:"That doesnât parse as a service-account JSON key yet â it should be the JSON file downloaded when you created the key."}),b&&!b.invalid&&e.jsxs("div",{className:"p-3 rounded-lg border bg-muted/30 space-y-2",children:[e.jsxs("div",{className:"text-xs font-medium flex items-center gap-1.5",children:[e.jsx(F,{className:"w-3.5 h-3.5 text-emerald-600"})," Key file recognized",!b.isServiceAccount&&e.jsx("span",{className:"text-amber-600 font-normal",children:"â but its type isnât âservice_accountâ, double-check the file"})]}),b.clientEmail&&e.jsxs("div",{className:"text-xs text-muted-foreground",children:["Service account: ",e.jsx("span",{className:"font-mono",children:b.clientEmail})]}),b.clientId&&e.jsxs("div",{className:"space-y-1",children:[e.jsx("div",{className:"text-xs text-muted-foreground",children:"Client ID â paste this into Domain-wide Delegation (setup step 3):"}),e.jsx(ra,{text:b.clientId,label:"client ID"})]})]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(v,{htmlFor:"gw-subject",children:"Impersonated Workspace user (email, optional)"}),e.jsx(J,{id:"gw-subject",type:"email",value:r,onChange:l=>C(l.target.value),placeholder:"[email protected] â leave blank for Chat-only"}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["Files are created in this userâs Drive; domain-wide delegation must grant the ",e.jsx("span",{className:"font-mono",children:"drive.file"})," scope for this user. Leave it"," ",e.jsx("span",{className:"font-medium",children:"blank for Chat-only mode"}),": the Chat app works with no delegation at all, and Drive export/import simply stay off."]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(v,{htmlFor:"gw-drive",children:"Shared Drive ID (optional)"}),e.jsx(J,{id:"gw-drive",value:O,onChange:l=>A(l.target.value),placeholder:"0AB⦠(leave blank to use My Drive)"})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(x,{size:"sm",onClick:S,disabled:u.isPending,children:[u.isPending&&e.jsx(G,{className:"w-3.5 h-3.5 mr-1.5 animate-spin"}),w?"Replace key":"Connect"]}),w&&e.jsxs(x,{variant:"ghost",size:"sm",className:"text-destructive hover:bg-destructive/10 hover:text-destructive",onClick:B,disabled:m.isPending,children:[m.isPending&&e.jsx(G,{className:"w-3.5 h-3.5 mr-1.5 animate-spin"}),"Disconnect"]})]})]})})]})]})}function la(){const{toast:a}=_(),o=Q(),{data:n}=de(),s=Ae();if(!n?.applicable)return null;const d=n.enabled&&n.connectionConfigured,c=u=>{s.mutate({data:{enabled:u}},{onSuccess:()=>{o.invalidateQueries({queryKey:Te()}),o.invalidateQueries({queryKey:le()}),a({title:u?"Advanced Google Workspace integration enabled":"Advanced Google Workspace integration hidden",description:u?"The service-account setup is now available below.":"The service-account surfaces are hidden again. Per-user Google connections are unaffected."})},onError:m=>a({title:"Could not update the switch",description:m?.data?.error??"Try again.",variant:"destructive"})})};return e.jsxs(T,{children:[e.jsx(R,{children:e.jsxs("div",{className:"flex items-start justify-between gap-4",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsxs(L,{className:"flex items-center gap-2 text-lg",children:[e.jsx(Z,{className:"w-5 h-5 text-primary"})," Advanced Google Workspace integration",e.jsx(K,{variant:"outline",children:"Optional"})]}),e.jsx(M,{children:"An org-wide service account your Google admin sets up once. Most workspaces donât need it â per-user Google connections above cover Meet, Calendar, Gmail, and each memberâs own Drive."})]}),e.jsx(N,{checked:n.enabled,onCheckedChange:c,disabled:s.isPending||d,"aria-label":"Advanced Google Workspace integration","data-testid":"google-advanced-switch"})]})}),e.jsxs(W,{className:"space-y-3 text-sm text-muted-foreground",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsxs("p",{children:[e.jsx("span",{className:"font-medium text-foreground",children:"What it unlocks:"})," ","two-way Google Chat app messaging (Chat-only mode â no impersonation), and optionally org-level Drive features â exporting decks and documents to Google Slides/Docs, importing existing Drive content into the knowledge base, and a Shared Drive export destination (full mode with domain-wide delegation)."]}),e.jsxs("p",{children:[e.jsx("span",{className:"font-medium text-foreground",children:"The security trade-off:"})," ","per-user OAuth acts only as the person who connected, with exactly the access they granted. A service account with domain-wide delegation is a single org-wide key that can act ",e.jsx("em",{children:"as"})," a chosen Workspace user without asking them â powerful for automation, but a bigger blast radius if the key leaks. Chat-only mode avoids impersonation entirely; delegation is only needed for the Drive features."]})]}),d&&e.jsx("p",{className:"text-xs",children:"The switch is locked ON while a Google Worksp
1ace connection exists â disconnect the service account below first if you want to hide these surfaces."})]})]})}function La(){const{data:a}=oe(),{data:o}=ce(),{data:n}=de();if(a&&!a.roles.includes("tenant_admin"))return e.jsx(ue,{to:"/"});const s=a?.workspaceMode==="personal",d=!s&&!!n?.applicable&&!!n.enabled,c=!!o?.available,u={title:"Org-wide service account",detail:c?"Connected â deck export, Drive import, and Chat delivery are available.":"Only for org-level features like Slides export and Chat delivery â needs domain-wide delegation.",done:c,optional:!0,targetId:"google-step-3"};return e.jsx("div",{className:"flex-1 overflow-y-auto bg-muted/20",children:e.jsxs("div",{className:"max-w-4xl mx-auto p-6 space-y-6",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(re,{href:"/account",children:e.jsxs("a",{className:"inline-flex items-center gap-1.5 text-sm text-muted-foreground hover:text-foreground",children:[e.jsx(He,{className:"w-4 h-4"})," Back to Account"]})}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Z,{className:"w-6 h-6 text-primary"}),e.jsx("h1",{className:"text-2xl font-semibold",children:"Set up Google"})]}),e.jsx("p",{className:"text-sm text-muted-foreground max-w-2xl",children:s?"Vera provides the OAuth app (nothing to register) â connect your Google apps with a single click.":"Everything Google in one guided flow: Vera provides the OAuth app (nothing to register), you choose which Google apps members can use, and â only if you opt into the advanced integration â add the org-wide service account. Members then connect all their Google apps with a single click."})]}),e.jsx("div",{"data-feature-anchor":"google-one-click-connect-offer",children:e.jsx(Fe,{provider:"google",label:"Google",appsDescription:"Saving credentials turns all Google apps on automatically â switch off any you don't want. Members connect every enabled app in one click with a single Google consent screen.",extraChecklist:d?[u]:[],extraSections:s?void 0:e.jsxs(e.Fragment,{children:[e.jsx(ea,{}),e.jsx(la,{}),d&&e.jsx(da,{})]})})}),e.jsx("div",{"data-feature-anchor":"google-one-click-connect-permissions",children:e.jsx(qe,{provider:"google"})})]})})}export{La as default};
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.