PageSourceSearch

https://repsshield.com/assets/RulesManagementSimplified-Y5US3rNH.js

js repsshield.com collected 2026-10-02 02:02:10 UTC 15,754 bytes, 8 lines download raw bytes

1import{aM as Z,a as ee,r as F,aE as K,j as e,ae as se,B as i,a$ as k,_ as y,R as j,aB as O,V as g,C as N,b as ae,c as te,aS as ne,d as w,l as re,m as I,n as D,au as T,e as c,o as B,L as l,w as M,aF as C,b0 as q,Q as ie,q as S,b1 as L,b2 as R,b3 as Q,b4 as U,b5 as H,b6 as le,b7 as oe}from"./index-DGo-vssZ.js";import{r as d}from"./vendor-Qgthw7N1.js";import{C as b}from"./checkbox-i5ygXx_L.js";import{a as m}from"./automationService-OVbtW0oB.js";import{T as ce}from"./test-tube-diagonal-CXQTMvzO.js";const de={enabled:!0,trustedContacts:["[email protected]","@abcrealty.com"],keywords:["property","listing","contract"],autoApprove:!0,matchCount:47},me={enabled:!0,trustedKeywords:["inspection","walkthrough","showing","site visit"],trustedOrganizers:["[email protected]"],autoApprove:!1,matchCount:12},P=[{id:"template-1",name:"Client Email Tracking",description:"Auto-approve emails from trusted clients",icon:"📧",type:"email",template:{trustedContacts:[],keywords:[],autoApprove:!0}},{id:"template-2",name:"Tenant Communications",description:"Boost confidence for tenant-related emails",icon:"👥",type:"email",template:{keywords:["tenant","lease","rent","maintenance"],autoApprove:!0}},{id:"template-3",name:"Document Review",description:"Require review for contract emails",icon:"📄",type:"email",template:{keywords:["contract","agreement","review","document"],autoApprove:!1}},{id:"template-4",name:"Property Showings",description:"Require review for viewing appointments",icon:"🏠",type:"calendar",template:{trustedKeywords:["showing","viewing","tour","open house"],autoApprove:!1}},{id:"template-5",name:"Maintenance Coordination",description:"Track maintenance activities",icon:"🔧",type:"calendar",template:{trustedKeywords:["maintenance","repair","contractor"],autoApprove:!1}},{id:"template-6",name:"Investor Meetings",description:"Auto-approve investor communications",icon:"💼",type:"calendar",template:{trustedKeywords:["investor","partnership","funding"],autoApprove:!0}}],pe=[{id:"suggestion-1",name:"ABC Realty Client Emails",pattern:"23 emails from *@abcrealty.com in the past month",confidence:95,type:"email",suggestion:{trustedContacts:["@abcrealty.com"],autoApprove:!0}}
1,{id:"suggestion-2",name:"Weekly Property Inspections",pattern:'Recurring calendar events every Tuesday with "inspection"',confidence:89,type:"calendar",suggestion:{trustedKeywords:["inspection","walkthrough"],autoApprove:!1}}];function ve(){const[V,A]=d.useState(!1),[W,p]=d.useState(!1),z=Z(),{toast:u}=ee(),{data:n,isLoading:_}=F({queryKey:["automation","email"],queryFn:async()=>(await m.getAutomations("email"))[0]||null}),{data:r,isLoading:$}=F({queryKey:["automation","calendar"],queryFn:async()=>(await m.getAutomations("calendar"))[0]||null}),[a,x]=d.useState(de),[t,h]=d.useState(me),v=K({mutationFn:async s=>n!=null&&n.id?await m.updateAutomation(n.id,s):await m.createAutomation({type:"email",enabled:s.enabled??!0,trustedContacts:s.trustedContacts||[],keywords:s.keywords||[],autoApprove:s.autoApprove??!1}),onSuccess:()=>{z.invalidateQueries({queryKey:["automation","email"]}),u({title:"Success",description:"Email automation saved successfully"})},onError:s=>{u({title:"Error",description:s.message||"Failed to save email automation",variant:"destructive"})}}),f=K({mutationFn:async s=>r!=null&&r.id?await m.updateAutomation(r.id,s):await m.createAutomation({type:"calendar",enabled:s.enabled??!0,trustedKeywords:s.trustedKeywords||[],trustedOrganizers:s.trustedOrganizers||[],autoApprove:s.autoApprove??!1}),onSuccess:()=>{z.invalidateQueries({queryKey:["automation","calendar"]}),u({title:"Success",description:"Calendar automation saved successfully"})},onError:s=>{u({title:"Error",description:s.message||"Failed to save calendar automation",variant:"destructive"})}});d.useEffect(()=>{n&&x({enabled:n.enabled,trustedContacts:n.trustedContacts,keywords:n.keywords,autoApprove:n.autoApprove,matchCount:n.matchCount})},[n]),d.useEffect(()=>{r&&h({enabled:r.enabled,trustedKeywords:r.trustedKeywords,trustedOrganizers:r.trustedOrganizers,autoApprove:r.autoApprove,matchCount:r.matchCount})},[r]);const E=s=>{s.type==="email"?v.mutate({...a,...s.template,type:"email"}):f.mutate({...t,...s.template,type:"calendar"}),A(!1)},G=s=>{s.type==="email"?v.mutate({...a,...s.suggestion,type:"email"}):f.mutate({...t,...s.suggestion,type:"calendar"}),p(!1)},J=s=>{s.type==="email"?v.mutate({...a,...s.suggestion,type:"email"}):f.mutate({...t,...s.suggestion,type:"calendar"}),p(!1)},X=()=>{v.mutate({...a,type:"email"}),f.mutate({...t,type:"calendar"})},Y=()=>{u({title:"Test Started",description:"Testing automation against recent activity..."})};return _||$?e.jsx("div",{className:"container max-w-4xl mx-auto py-12 px-4",children:e.jsx("div",{className:"flex items-center justify-center h-64",children:e.jsx(se,{className:"h-8 w-8 animate-spin text-muted-foreground"})})}):e.jsxs("div",{className:"container max-w-4xl mx-auto py-12 px-4 space-y-6",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("h1",{className:"text-3xl font-bold tracking-tight",children:"Activity Automation"}),e.jsx("p",{className:"text-muted-foreground",children:"Configure trusted patterns to boost AI confidence and enable auto-approval"})]}),e.jsxs("div",{className:"flex flex-wrap gap-3",children:[e.jsxs(i,{variant:"outline",onClick:()=>A(!0),className:"gap-2",children:[e.jsx(k,{className:"h-4 w-4"}),"Templates"]}),e.jsxs(i,{variant:"outline",onClick:()=>p(!0),className:"gap-2",children:[e.jsx(y,{className:"h-4 w-4"}),"AI Assistant"]})]}),e.jsxs(j,{children:[e.jsx(O,{className:"h-4 w-4"}),e.jsxs(g,{className:"text-sm",children:[e.jsx("strong",{children:"How it works:"})," Automation boosts AI confidence for trusted patterns. The AI determines activity details based on actual content. High confidence items can be auto-approved."]})]}),e.jsxs(N,{children:[e.jsxs(ae,{children:[e.jsx(te,{children:"Automation Settings"}),e.jsx(ne,{children:"Configure trust patterns for emails and calendar events"})]}),e.jsxs(w,{children:[e.jsxs(re,{type:"single",collapsible:!0,className:"w-full",children:[e.jsxs(I,{value:"email",children:[e.jsx(D,{className:"hover:no-underline",children:e.jsxs("div",{className:"flex items-center gap-3 flex-1",children:[e.jsx(T,{className:"h-5 w-5 text-blue-500"}),e.jsxs("div",{className:"flex items-center gap-2 flex-1",children:[e.jsx("span",{className:"font-semibold",children:"Email Automation"}),a.enabled&&e.jsx(c,{className:"bg-green-500 text-xs",children:"Active"}),!a.enabled&&e.jsx(c,{variant:"secondary",className:"text-xs",children:"Disabled"})]}),a.matchCount&&a.matchCount>0&&e.jsxs(c,{variant:"outline",className:"text-xs",children:[a.matchCount," matches"]})]})}),e.jsxs(B,{className:"space-y-4 pt-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(l,{htmlFor:"email-enabled",className:"text-sm font-medium",children:"Enable email automation"}),e.jsx(b,{id:"email-enabled",checked:a.enabled,onCheckedChange:s=>x({...a,enabled:s})})]}),a.enabled&&e.jsxs(e.Fragment,{children:[a.matchCount&&a.matchCount>0&&e.jsxs(j,{className:"bg-green-50 dark:bg-green-950 border-green-200 dark:border-green-800",children:[e.jsx(M,{className:"h-4 w-4 text-green-600"}),e.jsxs(g,{className:"text-sm text-green-800 dark:text-green-200",children:["Matched ",a.matchCount," emails this month"]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(l,{htmlFor:"email-contacts",className:"text-sm",children:["Trusted Contacts"," ",e.jsx("span",{className:"text-muted-foreground",children:"(optional)"})]}),e.jsx(C,{id:"email-contacts",placeholder:`One per line, e.g.:
2[email protected]
3@realestate.com`,value:a.trustedContacts.join(`
4`),onChange:s=>x({...a,trustedContacts:s.target.value.split(`
5`).map(o=>
5o.trim()).filter(Boolean)}),rows:3,className:"font-mono text-sm"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Use @domain.com to match entire domains"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(l,{htmlFor:"email-keywords",className:"text-sm",children:["Keywords"," ",e.jsx("span",{className:"text-muted-foreground",children:"(optional)"})]}),e.jsx(C,{id:"email-keywords",placeholder:"Comma-separated, e.g.: property, listing, contract",value:a.keywords.join(", "),onChange:s=>x({...a,keywords:s.target.value.split(",").map(o=>o.trim()).filter(Boolean)}),rows:2,className:"font-mono text-sm"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(b,{id:"email-auto-approve",checked:a.autoApprove,onCheckedChange:s=>x({...a,autoApprove:s})}),e.jsxs(l,{htmlFor:"email-auto-approve",className:"text-sm cursor-pointer flex items-center gap-2",children:["Auto-approve high confidence matches",a.autoApprove&&e.jsx(q,{className:"h-4 w-4 text-green-500"})]})]}),e.jsxs(j,{children:[e.jsx(ie,{className:"h-4 w-4"}),e.jsx(g,{className:"text-xs",children:"Enable for fully trusted sources. Disable to manually review all matches."})]})]})]})]})]}),e.jsxs(I,{value:"calendar",children:[e.jsx(D,{className:"hover:no-underline",children:e.jsxs("div",{className:"flex items-center gap-3 flex-1",children:[e.jsx(S,{className:"h-5 w-5 text-purple-500"}),e.jsxs("div",{className:"flex items-center gap-2 flex-1",children:[e.jsx("span",{className:"font-semibold",children:"Calendar Automation"}),t.enabled&&e.jsx(c,{className:"bg-purple-500 text-xs",children:"Active"}),!t.enabled&&e.jsx(c,{variant:"secondary",className:"text-xs",children:"Disabled"})]}),t.matchCount&&t.matchCount>0&&e.jsxs(c,{variant:"outline",className:"text-xs",children:[t.matchCount," matches"]})]})}),e.jsxs(B,{className:"space-y-4 pt-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(l,{htmlFor:"calendar-enabled",className:"text-sm font-medium",children:"Enable calendar automation"}),e.jsx(b,{id:"calendar-enabled",checked:t.enabled,onCheckedChange:s=>h({...t,enabled:s})})]}),t.enabled&&e.jsxs(e.Fragment,{children:[t.matchCount&&t.matchCount>0&&e.jsxs(j,{className:"bg-purple-50 dark:bg-purple-950 border-purple-200 dark:border-purple-800",children:[e.jsx(M,{className:"h-4 w-4 text-purple-600"}),e.jsxs(g,{className:"text-sm text-purple-800 dark:text-purple-200",children:["Matched ",t.matchCount," events this month"]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(l,{htmlFor:"calendar-keywords",className:"text-sm",children:"Trusted Keywords"}),e.jsx(C,{id:"calendar-keywords",placeholder:"Comma-separated, e.g.: inspection, showing, walkthrough",value:t.trustedKeywords.join(", "),onChange:s=>h({...t,trustedKeywords:s.target.value.split(",").map(o=>o.trim()).filter(Boolean)}),rows:2,className:"font-mono text-sm"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(l,{htmlFor:"calendar-organizers",className:"text-sm",children:["Trusted Organizers"," ",e.jsx("span",{className:"text-muted-foreground",children:"(optional)"})]}),e.jsx(C,{id:"calendar-organizers",placeholder:`One per line, e.g.:
6[email protected]`,value:t.trustedOrganizers.join(`
7`),onChange:s=>h({...t,trustedOrganizers:s.target.value.split(`
8`).map(o=>o.trim()).filter(Boolean)}),rows:3,className:"font-mono text-sm"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(b,{id:"calendar-auto-approve",checked:t.autoApprove,onCheckedChange:s=>h({...t,autoApprove:s})}),e.jsxs(l,{htmlFor:"calendar-auto-approve",className:"text-sm cursor-pointer flex items-center gap-2",children:["Auto-approve high confidence matches",t.autoApprove&&e.jsx(q,{className:"h-4 w-4 text-green-500"})]})]}),e.jsxs(j,{children:[e.jsx(O,{className:"h-4 w-4"}),e.jsx(g,{className:"text-xs",children:"Most users disable auto-approve for calendar events to review duration and details."})]})]})]})]})]})]}),e.jsxs("div",{className:"flex gap-2 pt-4",children:[e.jsxs(i,{variant:"outline",size:"sm",onClick:Y,className:"gap-2",children:[e.jsx(ce,{className:"h-3 w-3"}),"Test"]}),e.jsx(i,{size:"sm",onClick:X,children:"Save Configuration"})]})]})]}),e.jsx(L,{open:V,onOpenChange:A,children:e.jsxs(R,{className:"max-w-2xl max-h-[80vh]",children:[e.jsxs(Q,{children:[e.jsx(U,{children:"Automation Templates"}
8),e.jsx(H,{children:"Quick-start configurations for common patterns"})]}),e.jsx(le,{className:"h-[450px] pr-4",children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsxs("h3",{className:"font-semibold text-sm flex items-center gap-2",children:[e.jsx(T,{className:"h-4 w-4"}),"Email Templates"]}),e.jsx("div",{className:"space-y-2",children:P.filter(s=>s.type==="email").map(s=>e.jsx(N,{className:"cursor-pointer hover:bg-accent transition-colors",children:e.jsx(w,{className:"p-3",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"text-2xl",children:s.icon}),e.jsxs("div",{className:"flex-1 space-y-1",children:[e.jsx("h4",{className:"font-semibold text-sm",children:s.name}),e.jsx("p",{className:"text-xs text-muted-foreground",children:s.description}),e.jsxs(i,{size:"sm",variant:"outline",onClick:()=>E(s),className:"gap-2 h-7 text-xs",children:[e.jsx(k,{className:"h-3 w-3"}),"Use Template"]})]})]})})},s.id))})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("h3",{className:"font-semibold text-sm flex items-center gap-2",children:[e.jsx(S,{className:"h-4 w-4"}),"Calendar Templates"]}),e.jsx("div",{className:"space-y-2",children:P.filter(s=>s.type==="calendar").map(s=>e.jsx(N,{className:"cursor-pointer hover:bg-accent transition-colors",children:e.jsx(w,{className:"p-3",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"text-2xl",children:s.icon}),e.jsxs("div",{className:"flex-1 space-y-1",children:[e.jsx("h4",{className:"font-semibold text-sm",children:s.name}),e.jsx("p",{className:"text-xs text-muted-foreground",children:s.description}),e.jsxs(i,{size:"sm",variant:"outline",onClick:()=>E(s),className:"gap-2 h-7 text-xs",children:[e.jsx(k,{className:"h-3 w-3"}),"Use Template"]})]})]})})},s.id))})]})]})})]})}),e.jsx(L,{open:W,onOpenChange:p,children:e.jsxs(R,{className:"max-w-xl",children:[e.jsxs(Q,{children:[e.jsxs(U,{className:"flex items-center gap-2",children:[e.jsx(y,{className:"h-5 w-5 text-purple-500"}),"AI Setup Assistant"]}),e.jsx(H,{children:"Detected patterns in your recent activity"})]}),e.jsx("div",{className:"space-y-3",children:pe.map(s=>e.jsx(N,{className:"border-purple-200 dark:border-purple-800",children:e.jsxs(w,{className:"p-3 space-y-2",children:[e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsxs("div",{className:"space-y-1 flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[s.type==="email"?e.jsx(T,{className:"h-4 w-4 text-blue-500"}):e.jsx(S,{className:"h-4 w-4 text-purple-500"}),e.jsx("h3",{className:"font-semibold text-sm",children:s.name})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:s.pattern})]}),e.jsxs(c,{variant:"outline",className:"text-purple-600 border-purple-600 text-xs",children:[s.confidence,"%"]})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(i,{variant:"outline",size:"sm",className:"h-7 text-xs",children:"Ignore"}),e.jsx(i,{variant:"outline",size:"sm",onClick:()=>J(s),className:"h-7 text-xs",children:"Customize"}),e.jsxs(i,{size:"sm",onClick:()=>G(s),className:"gap-2 h-7 text-xs",children:[e.jsx(y,{className:"h-3 w-3"}),"Apply"]})]})]})},s.id))}),e.jsxs(oe,{children:[e.jsx(i,{variant:"outline",onClick:()=>p(!1),size:"sm",children:"Close"}),e.jsxs(i,{variant:"outline",className:"gap-2",size:"sm",children:[e.jsx(y,{className:"h-4 w-4"}),"Analyze Again"]})]})]})})]})}export{ve as RulesManagementSimplified,ve 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.