1import{d as k,l as w,k as C,e as f,j as e,C as l,g as o,h as m,t as x,i as u,s as r}from"./index-CgICqce5.js";import{N as g}from"./NonniShell-BiF5dPDI.js";import{S as i}from"./switch-CaaIxW-b.js";import{L as p}from"./label-CMH8M_ey.js";import{B as _}from"./badge-DsBHh7Vd.js";import{u as N}from"./useMutation-q3X3WdDk.js";import{S}from"./SEO-H2dWTmg6.js";import{C as K}from"./circle-check-DlBTIqpZ.js";import"./supabase-B7GgIyx6.js";import"./shield-check-CpPg9YD7.js";import"./calendar-Ddms6WsD.js";import"./brain-CO5tToIZ.js";import"./phone-MrXGU-XE.js";import"./house-CtOQtnlM.js";import"./sparkles-Dpj0boyn.js";import"./index-BdQq_4o_.js";import"./Combination-j6OekRrC.js";import"./index-EPu19ijW.js";import"./chevron-down-DkLIBqP_.js";import"./check-BZuFJSJG.js";/** 2 * @license lucide-react v0.462.0 - ISC 3 * 4 * This source code is licensed under the ISC license. 5 * See the LICENSE file in the root directory of this source tree. 6 */const q=k("Link2",[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]]),X=()=>{const{push:c}=w(),j=C(),{data:t,isLoading:b}=f({queryKey:["integration-settings","kate"],queryFn:async()=>{const{data:s,error:a}=await r.from("integration_settings").select("*").eq("integration_name","kate").maybeSingle();if(a)throw a;return s}}),{data:h}=f({queryKey:["patients-kate-sync"],queryFn:async()=>{const{data:s,error:a}=await r.from("patients").select("id, first_name, last_name, kate_sync_enabled");if(a)throw a;return s}}),d=N({mutationFn:async s=>{if(t!=null&&t.id){const{error:a}=await r.from("integration_settings").update({...s,updated_at:new Date().toISOString()}).eq("id",t.id);if(a)throw a}else{const{error:a}=await r.from("integration_settings").insert([{integration_name:"kate",...s}]);if(a)throw a}},onSuccess:()=>{j.invalidateQueries({queryKey:["integration-settings"]}),c({variant:"success",body:"Integration settings updated"})},onError:()=>c({variant:"urgent",body:"Failed to update settings"})}),v=N({mutationFn:async({patientId:s,enabled:a})=>{const{error:y}=await r.from("patients").update({kate_sync_enabled:a}).eq("id",s);if(y)throw y},onSuccess:()=>{j.invalidateQueries({queryKey:["patients-kate-sync"]}),c({variant:"success",body:"Patient sync setting updated"})},onError:()=>c({variant:"urgent",body:"Failed to update patient sync"})}),n=(t==null?void 0:t.is_enabled)??!1;return b?e.jsx(g,{children:e.jsx("p",{children:"Loading..."})}):e.jsxs(g,{children:[e.jsx(S,{title:"Integration Settings | Nonni.ai",description:"Configure Kate integration for care task and alert syncing",noIndex:!0}),e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(q,{className:"h-8 w-8 text-primary"}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-3xl font-bold",children:"Integration Settings"}),e.jsx("p",{className:"text-muted-foreground",children:"Configure how Nonni syncs with Kate"})]})]}),e.jsx(l,{children:e.jsx(o,{children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsxs(m,{className:"flex items-center gap-2",children:["Kate Integration",e.jsx(_,{variant:n?"default":"secondary",children:n?"Active":"Inactive"})]}),e.jsx(x,{children:"Enable bidirectional sync between Kate and Nonni. Both apps share the same database â this controls which event types are processed."})]}),e.jsx(i,{checked:n,onCheckedChange:s=>d.mutate({is_enabled:s})})]})})}),e.jsxs(l,{className:n?"":"opacity-50 pointer-events-none",children:[e.jsxs(o,{children:[e.jsx(m,{children:"Sync Configuration"}),e.jsx(x,{children:"Choose which event types sync between the two systems"})]}),e.jsxs(u,{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(p,{className:"text-base",children:"Care Tasks & Notes"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Care tasks created in Kate appear in Nonni's dashboard"})]}),e.jsx(i,{checked:(t==null?void 0:t.sync_care_tasks)??!0,onCheckedChange:s=>d.mutate({sync_care_tasks:s})})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(p,{className:"text-base",children:"Alerts & Escalations"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Alerts from Kate (e.g. missed medication) show in Nonni's alerts panel"})]}),e.jsx(i,{checked:(t==null?void 0:t.sync_alerts)??!0,onCheckedChange:s=>d.mutate({sync_alerts:s})})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(p,{className:"text-base",children:"Call Outcomes â Kate"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"When Nonni completes a call, push the summary, sentiment, and alerts to Kate"})]}),e.jsx(i,{checked:(t==null?void 0:t.sync_call_outcomes)??!0,onCheckedChange:s=>d.mutate({sync_call_outcomes:s})})]})]})]}),e.jsxs(l,{className:n?"":"opacity-50 pointer-events-none",children:[e.jsxs(o,{children:[e.jsx(m,{children:"Per-Patient Sync"}),e.jsx(x,{children:"Enable or disable Kate sync for individual patients"})]}),e.jsx(u,{children:h&&h.length>0?e.jsx("div",{className:"space-y-4",children:h.map(s=>e.jsxs("div",{className:"flex items-center justify-between py-2 border-b last:border-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{className:"font-medium",children:[s.first_name," ",s.last_name]}),s.kate_sync_enabled&&e.jsx(K,{className:"h-4 w-4 text-primary"})]}),e.jsx(i,{checked:s.kate_sync_enabled??!1,onCheckedChange:a=>v.mutate({patientId:s.id,enabled:a})})]},s.id))}):e.jsx("p",{className:"text-sm text-muted-foreground",children:"No patients found. Add a loved one first."})})]}),e.jsxs(l,{children:[e.jsx(o,{children:e.jsx(m,{children:"How It Works"})}),e.jsx(u,{children:e.jsxs("div",{className:"grid gap-4 md:grid-cols-3",children:[e.jsxs("div",{className:"flex items-start gap-3 p-4 border rounded-lg",children:[e.jsx("div",{className:"h-8 w-8 rounded-full bg-primary/10 flex items-center justify-center shrink-0",children:e.jsx("span",{className:"text-primary font-bold",children:"1"})}),e.jsxs("div",{children:[e.jsx("h4",{className:"font-medium",children:"Shared Database"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Kate and Nonni share the same backend. Changes are reflected in real-time."})]})]}),e.jsxs("div",{className:"flex items-start gap-3 p-4 border rounded-lg",children:[e.jsx("div",{className:"h-8 w-8 rounded-full bg-primary/10 flex items-center justify-center shrink-0",children:e.jsx("span",{className:"text-primary font-bold",children:"2"})}),e.jsxs("div",{children:[e.jsx("h4",{className:"font-medium",children:"Configurable Events"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Toggle which event types sync: care tasks, alerts, or call outcomes."})]})]}),e.jsxs("div",{className:"flex items-start gap-3 p-4 border rounded-lg",children:[e.jsx("div",{className:"h-8 w-8 rounded-full bg-primary/10 flex items-center justify-center shrink-0",children:e.jsx("span",{className:"text-primary font-bold",children:"3"})}),e.jsxs("div",{children:[e.jsx("h4",{className:"font-medium",children:"Per-Patient Control"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Choose which patients participate in Kate sync individually."})]})]})]})})]})]})]})};export{X 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.