PageSourceSearch

https://supapm.com/_nuxt/5hbQPj_4.js

js supapm.com collected 2026-09-24 14:54:01 UTC 17,297 bytes, 2 lines download raw bytes

1import{M as j,C as z,a8 as O,s as V,c as a,a as t,b as F,w as G,y as e,t as c,F as P,A as J,B as m,d as b,z as q,e as $,am as E,an as K,r as g,_ as W,a7 as Q,o as i,P as X,f as R}from"./D1bxrZK0.js";import{_ as Y}from"./CNBKbaJG.js";const Z={class:"px-6"},tt={class:"text-sm breadcrumbs mb-4"},st={class:"max-w-4xl"},et={class:"card bg-base-100 shadow-sm border border-base-300 mb-6"},ot={class:"card-body"},nt={class:"flex items-center gap-4 mb-4"},at={class:"flex items-center gap-2"},it={key:0,class:"badge badge-success"},lt={key:1,class:"badge badge-neutral"},dt={key:0,class:"space-y-4"},ct={class:"grid grid-cols-1 md:grid-cols-3 gap-4 p-4 bg-base-200 rounded-lg"},rt={class:"stat"},ut={class:"stat-value text-sm"},mt={class:"stat"},bt={class:"stat-value text-sm"},gt={class:"stat"},pt={class:"stat-value text-sm"},vt={key:0,class:"text-success"},_t={key:1,class:"text-warning"},ht={key:0},yt={class:"space-y-2"},ft={class:"flex items-center gap-2"},xt={class:"flex gap-2"},wt={class:"dropdown dropdown-top"},kt=["disabled"],St={key:0,class:"loading loading-spinner loading-xs"},Ct={tabindex:"0",class:"dropdown-content z-[1] menu p-2 shadow bg-base-100 rounded-box w-60"},$t={key:1,class:"alert alert-error"},It={class:"text-xs"},Dt={class:"text-xs text-base-content/60"},Et={key:1},Ut=["disabled"],Nt={key:0,class:"loading loading-spinner loading-xs"},Ht={class:"mb-8"},Lt={class:"grid grid-cols-1 md:grid-cols-2 gap-6"},Rt={class:"card bg-base-100 shadow-sm border border-base-300"},Bt={class:"card-body"},Mt={class:"flex items-center gap-4 mb-4"},At={class:"flex items-center gap-2"},Tt={key:0,class:"badge badge-success"},jt={key:1,class:"badge badge-neutral"},zt={key:0,class:"space-y-3"},Ot={class:"p-3 bg-base-200 rounded-lg"},Vt={class:"text-sm"},Ft={class:"text-base-content/70"},Gt={class:"text-sm mt-2"},Pt={class:"text-base-content/70"},Jt={key:1},qt=["disabled"],Kt={key:0,class:"loading loading-spinner loading-xs"},Wt={class:"card bg-base-100 shadow-sm border border-base-300"},Qt={class:"card-body"},Xt={class:"flex items-center gap-4 mb-4"},Yt={class:"flex items-center gap-2"},Zt={key:0,class:"badge badge-success"},ts={key:1,class:"badge badge-neutral"},ss={key:0,class:"space-y-3"},es={class:"p-3 bg-base-200 rounded-lg"},os={class:"text-sm"},ns={class:"text-base-content/70"},as={class:"text-sm mt-2"},is={class:"text-base-content/70"},ls={key:1},ds=["disabled"],cs={key:0,class:"loading loading-spinner loading-xs"},rs={key:0,class:"modal modal-open"},us={class:"modal-box"},ms={class:"space-y-4"},bs={class:"form-control"},gs={class:"label cursor-pointer"},ps={class:"form-control"},vs={class:"label cursor-pointer"},_s={class:"form-control"},hs={class:"label cursor-pointer"},ys={class:"form-control"},fs={class:"modal-action"},xs=["disabled"],ws={key:0,class:"loading loading-spinner loading-xs"},$s=j({__name:"integrations",setup(ks){const{$supabase:B}=z(),v=B,r=O(),y=Q(),l=g({connected:!1,integration:null,recent_syncs:[]}),k=g(!1),f=g(!1),S=g(!1),x=g(!1),p=g(!1),I=g([]),_=R(()=>I.value.find(o=>o.provider==="gmail"&&o.enabled&&o.status==="connected")),h=R(()=>I.value.find(o=>o.provider==="outlook"&&o.enabled&&o.status==="connected")),u=g({sync_deals:!0,sync_meetings:!0,auto_create_insights:!0,insight_importance_threshold:1}),C=async()=>{try{const o=await v.auth.getSession(),s=await $fetch(`/api/v1/${r.value.public_id}/integrations/hubspot/status`,{headers:{authorization:`Bearer ${o.data.session?.access_token}`}});if(s.data.connected?l.value={connected:!0,integration:s.data.integration,recent_syncs:s.data.recent_syncs||[]}:l.value={connected:!1,integration:null,recent_syncs:[]},l.value.connected&&l.value.integration?.sync_settings){const d=l.value.integration.sync_settings;u.value={sync_deals:d.sync_deals??!0,sync_meetings:d.sync_meetings??!0,auto_create_insights:d.auto_create_insights??!0,insight_importance_threshold:d.insight_importance_threshold??1}}}catch(o){console.error("Error loading HubSpot status:",o)}},M=()=>{k.value=!0;const o=`${y.public.siteUrl}/integrations/hubspot/callback`,s=y.public.HUBSPOT_CLIENT_ID,d="crm.objects.deals.read crm.objects.contacts.read tickets business-intelligence",n=encodeURIComponent(JSON.stringify({company_id:r.value.public_id,timestamp:Date.now()})),w=`https://app.hubspot.com/oauth/authorize?client_id=${s}&scope=${encodeURIComponent(d)}&redirect_uri=${encodeURIComponent(o)}&state=${n}`;window.location.href=w},U=async(o=!1)=>{f.value=!0;try{const s=await v.auth.getSession();await $fetch(`/api/v1/${r.value.public_id}/integrations/hubspot/sync`,{method:"POST",headers:{authorization:`Bearer ${s.data.session?.access_token}`},body:{force_full_resync:o}}),setTimeout(()=>{C()},2e3)}catch(s){console.error("Error triggering sync:",s)}finally{f.value=!1}},A=async()=>{x.value=!0;try{const o=await v.auth.getSession();await $fetch(`/api/v1/${r.value.public_id}/integrations/hubspot/settings`,{method:"PATCH",headers:{authorization:`Bearer ${o.data.session?.access_token}`},body:{sync_settings:u.value}}),S.value=!1,await C()}catch(o){console.error("Error saving settings:",o)}finally{x.value=!1}},T=async()=>
1{if(confirm("Are you sure you want to disconnect HubSpot? This will stop all data syncing."))try{const o=await v.auth.getSession();await $fetch(`/api/v1/${r.value.public_id}/integrations/hubspot`,{method:"DELETE",headers:{authorization:`Bearer ${o.data.session?.access_token}`}}),await C()}catch(o){console.error("Error disconnecting HubSpot:",o)}},N=async()=>{try{const o=await v.auth.getSession(),s=await $fetch(`/api/v1/${r.value.public_id}/integrations/email/status`,{headers:{authorization:`Bearer ${o.data.session?.access_token}`}});s.status==="success"&&(I.value=s.integrations||[])}catch(o){console.error("Error loading email integrations:",o)}},H=o=>{p.value=!0;const s=`${y.public.siteUrl}/integrations/email/callback`;let d="";if(o==="gmail"){const n=y.public.GMAIL_CLIENT_ID,w="https://www.googleapis.com/auth/gmail.readonly https://www.googleapis.com/auth/userinfo.email",D=encodeURIComponent(JSON.stringify({company_id:r.value.public_id,provider:"gmail",timestamp:Date.now()}));d=`https://accounts.google.com/o/oauth2/v2/auth?client_id=${n}&redirect_uri=${encodeURIComponent(s)}&response_type=code&scope=${encodeURIComponent(w)}&access_type=offline&prompt=consent&state=${D}`}else if(o==="outlook"){const n=y.public.OUTLOOK_CLIENT_ID,w="https://graph.microsoft.com/Mail.Read https://graph.microsoft.com/User.Read offline_access",D=encodeURIComponent(JSON.stringify({company_id:r.value.public_id,provider:"outlook",timestamp:Date.now()}));d=`https://login.microsoftonline.com/common/oauth2/v2.0/authorize?client_id=${n}&response_type=code&redirect_uri=${encodeURIComponent(s)}&response_mode=query&scope=${encodeURIComponent(w)}&state=${D}`}d&&(window.location.href=d)},L=async(o,s)=>{if(confirm(`Are you sure you want to disconnect ${o}? This will stop monitoring email threads.`))try{const d=await v.auth.getSession();await $fetch(`/api/v1/${r.value.public_id}/integrations/email`,{method:"DELETE",headers:{authorization:`Bearer ${d.data.session?.access_token}`},body:{integration_id:s}}),await N()}catch(d){console.error(`Error disconnecting ${o}:`,d)}};return V(()=>{C(),N()}),(o,s)=>{const d=W;return i(),a("div",Z,[t("div",tt,[t("ul",null,[t("li",null,[F(d,{to:`/company/${e(r)?.public_id}`},{default:G(()=>[...s[12]||(s[12]=[b("Overview",-1)])]),_:1},8,["to"])]),s[13]||(s[13]=t("li",null,"Integrations",-1))])]),t("div",st,[s[36]||(s[36]=t("h1",{class:"text-3xl font-bold mb-6"},"Integrations",-1)),s[37]||(s[37]=t("p",{class:"text-base-content/60 mb-8"}," Connect your tools to automatically gather insights and track customer feedback. ",-1)),t("div",et,[t("div",ot,[t("div",nt,[s[14]||(s[14]=t("img",{src:Y,class:"w-8 h-8",alt:"HubSpot"},null,-1)),s[15]||(s[15]=t("div",{class:"flex-1"},[t("h3",{class:"text-lg font-semibold"},"HubSpot"),t("p",{class:"text-base-content/60 text-sm"}," Sync deals, meetings, and contacts to automatically extract product insights ")],-1)),t("div",at,[e(l).connected?(i(),a("div",it,"Connected")):(i(),a("div",lt,"Not Connected"))])]),e(l).connected?(i(),a("div",dt,[t("div",ct,[t("div",rt,[s[16]||(s[16]=t("div",{class:"stat-title text-xs"},"Hub ID",-1)),t("div",ut,c(e(l).integration?.hubspot_account_info?.portalId),1)]),t("div",mt,[s[17]||(s[17]=t("div",{class:"stat-title text-xs"},"Last Sync",-1)),t("div",bt,c(e(l).integration?.last_sync?new Date(e(l).integration.last_sync).toLocaleDateString():"Never"),1)]),t("div",gt,[s[18]||(s[18]=t("div",{class:"stat-title text-xs"},"Status",-1)),t("div",pt,[e(l).integration?.enabled?(i(),a("span",vt,"Active")):(i(),a("span",_t,"Disabled"))])])]),e(l).connected&&e(l).recent_syncs&&e(l).recent_syncs.length>0?(i(),a("div",ht,[s[19]||(s[19]=t("h4",{class:"font-medium mb-2"},"Recent Syncs",-1)),t("div",yt,[(i(!0),a(P,null,J(e(l).recent_syncs.slice(0,3),n=>(i(),a("div",{key:n.id,class:"flex items-center justify-between p-2 bg-base-200 rounded text-sm"},[t("span",null,c(new Date(n.started_at).toLocaleString()),1),t("div",ft,[t("span",{class:X([{"badge-success":n.status==="completed","badge-error":n.status==="failed","badge-warning":n.status==="in_progress","badge-neutral":n.status==="pending"},"badge badge-sm"])},c(n.status),3)])]))),128))])])):m("",!0),t("div",xt,[t("div",wt,[t("button",{tabindex:"0",class:"btn btn-primary btn-sm",disabled:e(f)},[e(f)?(i(),a("span",St)):m("",!0),b(" "+c(e(f)?"Syncing...":"Sync Now")+" ",1),s[20]||(s[20]=t("svg",{class:"w-4 h-4 ml-1",fill:"currentColor",viewBox:"0 0 20 20"},[t("path",{"fill-rule":"evenodd",d:"M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z","clip-rule":"evenodd"})],-1))],8,kt),t("ul",Ct,[t("li",null,[t("a",{onClick:s[0]||(s[0]=n=>U(!1))},[...s[21]||(s[21]=[t("svg",{class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[t("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})],-1),b(" Incremental Sync ",-1),t("div",{class:"text-xs opacity-70"},"Only new/changed data",-1)])])]),t("li",null,[t("a",{onClick:s[1]||(s[1]=n=>U(!0))},[...s[22]||(s[22]=[t("svg",{class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[t("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})],-1),b(" Full Resync ",-1),t("div",{class:"text-xs opacity-70"},"Reprocess all data",-1)])])])])]),t("button",{class:"btn btn-outline btn-sm",onClick:s[2]||(s[2]=n=>S.value=!0)}
1," Settings "),t("button",{class:"btn btn-error btn-outline btn-sm",onClick:T}," Disconnect ")]),e(l).integration?.error_message?(i(),a("div",$t,[s[24]||(s[24]=t("svg",{xmlns:"http://www.w3.org/2000/svg",class:"stroke-current shrink-0 h-6 w-6",fill:"none",viewBox:"0 0 24 24"},[t("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M10 14l2-2m0 0l2-2m-2 2l-2-2m2 2l2 2m7-2a9 9 0 11-18 0 9 9 0 0118 0z"})],-1)),t("div",null,[s[23]||(s[23]=t("h3",{class:"font-bold"},"Sync Error",-1)),t("div",It,c(e(l).integration.error_message),1),t("div",Dt," Last error: "+c(new Date(e(l).integration.last_error_at).toLocaleString()),1)])])):m("",!0)])):(i(),a("div",Et,[s[25]||(s[25]=t("div",{class:"mb-4"},[t("h4",{class:"font-medium mb-2"},"What you'll get with HubSpot:"),t("ul",{class:"text-sm space-y-1 text-base-content/70"},[t("li",null,"• Automatic insight extraction from deal notes and meeting records"),t("li",null,"• Customer feedback analysis from sales conversations"),t("li",null,"• Deal pattern analysis to identify product-market fit indicators"),t("li",null,"• Feature request tracking from customer interactions")])],-1)),t("button",{class:"btn btn-primary",onClick:M,disabled:e(k)},[e(k)?(i(),a("span",Nt)):m("",!0),b(" "+c(e(k)?"Connecting...":"Connect HubSpot"),1)],8,Ut)]))])]),t("div",Ht,[s[34]||(s[34]=t("h2",{class:"text-2xl font-bold mb-4"},"Email Integrations",-1)),s[35]||(s[35]=t("p",{class:"text-base-content/60 mb-6 text-sm"}," Connect your email accounts to automatically extract status updates from email threads for your projects. ",-1)),t("div",Lt,[t("div",Rt,[t("div",Bt,[t("div",Mt,[s[26]||(s[26]=t("div",{class:"w-10 h-10 bg-red-500 rounded-lg flex items-center justify-center text-white font-bold"}," G ",-1)),s[27]||(s[27]=t("div",{class:"flex-1"},[t("h3",{class:"text-lg font-semibold"},"Gmail"),t("p",{class:"text-base-content/60 text-sm"}," Monitor email threads for project status updates ")],-1)),t("div",At,[e(_)?(i(),a("div",Tt,"Connected")):(i(),a("div",jt,"Not Connected"))])]),e(_)?(i(),a("div",zt,[t("div",Ot,[t("div",Vt,[s[28]||(s[28]=t("div",{class:"font-medium mb-1"},"Account",-1)),t("div",Ft,c(e(_).email_account_info?.email),1)]),t("div",Gt,[s[29]||(s[29]=t("div",{class:"font-medium mb-1"},"Last Sync",-1)),t("div",Pt,c(e(_).last_sync?new Date(e(_).last_sync).toLocaleDateString():"Never"),1)])]),t("button",{class:"btn btn-error bt
1n-outline btn-sm w-full",onClick:s[3]||(s[3]=n=>L("gmail",e(_).id))}," Disconnect ")])):(i(),a("div",Jt,[t("button",{class:"btn btn-primary btn-sm w-full",onClick:s[4]||(s[4]=n=>H("gmail")),disabled:e(p)},[e(p)?(i(),a("span",Kt)):m("",!0),b(" "+c(e(p)?"Connecting...":"Connect Gmail"),1)],8,qt)]))])]),t("div",Wt,[t("div",Qt,[t("div",Xt,[s[30]||(s[30]=t("div",{class:"w-10 h-10 bg-blue-500 rounded-lg flex items-center justify-center text-white font-bold"}," O ",-1)),s[31]||(s[31]=t("div",{class:"flex-1"},[t("h3",{class:"text-lg font-semibold"},"Outlook"),t("p",{class:"text-base-content/60 text-sm"}," Monitor email threads for project status updates ")],-1)),t("div",Yt,[e(h)?(i(),a("div",Zt,"Connected")):(i(),a("div",ts,"Not Connected"))])]),e(h)?(i(),a("div",ss,[t("div",es,[t("div",os,[s[32]||(s[32]=t("div",{class:"font-medium mb-1"},"Account",-1)),t("div",ns,c(e(h).email_account_info?.email),1)]),t("div",as,[s[33]||(s[33]=t("div",{class:"font-medium mb-1"},"Last Sync",-1)),t("div",is,c(e(h).last_sync?new Date(e(h).last_sync).toLocaleDateString():"Never"),1)])]),t("button",{class:"btn btn-error bt
1n-outline btn-sm w-full",onClick:s[5]||(s[5]=n=>L("outlook",e(h).id))}," Disconnect ")])):(i(),a("div",ls,[t("button",{class:"btn btn-primary btn-sm w-full",onClick:s[6]||(s[6]=n=>H("outlook")),disabled:e(p)},[e(p)?(i(),a("span",cs)):m("",!0),b(" "+c(e(p)?"Connecting...":"Connect Outlook"),1)],8,ds)]))])])])]),s[38]||(s[38]=q('<div class="space-y-4 hidden"><h3 class="text-xl font-semibold">Coming Soon</h3><div class="grid grid-cols-1 md:grid-cols-2 gap-4"><div class="card bg-base-100 shadow-sm border border-base-300 opacity-60"><div class="card-body"><div class="flex items-center gap-4"><div class="w-8 h-8 bg-blue-500 rounded flex items-center justify-center text-white text-sm font-bold"> SF </div><div class="flex-1"><h4 class="font-semibold">Salesforce</h4><p class="text-xs text-base-content/60">CRM data sync and analysis</p></div><div class="badge badge-neutral">Coming Soon</div></div></div></div><div class="card bg-base-100 shadow-sm border border-base-300 opacity-60"><div class="card-body"><div class="flex items-center gap-4"><div class="w-8 h-8 bg-purple-500 rounded flex items-center justify-center text-white text-sm font-bold"> S </div><div class="flex-1"><h4 class="font-semibold">Slack</h4><p class="text-xs text-base-content/60">Customer feedback from support channels</p></div><div class="badge badge-neutral">Coming Soon</div></div></div></div></div></div>',1))]),e(S)?(i(),a("div",rs,[t("div",us,[s[44]||(s[44]=t("h3",{class:"font-bold text-lg mb-4"},"HubSpot Integration Settings",-1)),t("div",ms,[t("div",bs,[t("label",gs,[s[39]||(s[39]=t("span",{class:"label-text"},"Sync Deals",-1)),$(t("input",{type:"checkbox","onUpdate:modelValue":s[7]||(s[7]=n=>e(u).sync_deals=n),class:"checkbox"},null,512),[[E,e(u).sync_deals]])])]),t("div",ps,[t("label",vs,[s[40]||(s[40]=t("span",{class:"label-text"},"Sync Meetings",-1)),$(t("input",{type:"checkbox","onUpdate:modelValue":s[8]||(s[8]=n=>e(u).sync_meetings=n),class:"checkbox"},null,512),[[E,e(u).sync_meetings]])])]),t("div",_s,[t("label",hs,[s[41]||(s[41]=t("span",{class:"label-text"},"Auto-create Insights",-1)),$(t("input",{type:"checkbox","onUpdate:modelValue":s[9]||(s[9]=n=>e(u).auto_create_insights=n),class:"checkbox"},null,512),[[E,e(u).auto_create_insights]])])]),t("div",ys,[s[43]||(s[43]=t("label",{class:"label"},[t("span",{class:"label-text"},"Insight Importance Threshold")],-1)),$(t("select",{"onUpdate:modelValue":s[10]||(s[10]=n=>e(u).insight_importance_threshold=n),class:"select select-bordered"},[...s[42]||(s[42]=[t("option",{value:"0"},"All insights (0-3)",-1),t("option",{value:"1"},"Medium and above (1-3)",-1),t("option",{value:"2"},"High and above (2-3)",-1),t("option",{value:"3"},"Critical only (3)",-1)])],512),[[K,e(u).insight_importance_threshold]])])]),t("div",fs,[t("button",{class:"btn btn-primary",onClick:A,disabled:e(x)},[e(x)?(i(),a("span",ws)):m("",!0),b(" "+c(e(x)?"Saving...":"Save Settings"),1)],8,xs),t("button",{class:"btn",onClick:s[11]||(s[11]=n=>S.value=!1)},"Cancel")])])])):m("",!0)])}}});export{$s as default};
2//# sourceMappingURL=5hbQPj_4.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.