1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5824],{20473:function(e,t,s){(window.__NEXT_P=window.__NEXT_P||[]).push(["/dashboard/settings",function(){return s(60059)}])},60059:function(e,t,s){"use strict";s.r(t),s.d(t,{default:function(){return K}});var r=s(85893),a=s(67294),i=s(68453),n=s(55809),o=s(28154),l=s(82770),d=s(19710),c=s(51568),m=s(91733),p=s(70627),u=s(76978),x=s(55678),h=s(90553),g=s(4670),b=s(17380),y=s(68019),f=e=>{let{notificationData:t,onSave:s}=e,{data:i,isLoading:o}=(0,y.ny)();(0,y.r4)();let l=(0,y.dc)(),[d,c]=(0,a.useState)({supportedNotifications:["dailyReport","userActivity","newMessage","chatStarted","systemAlerts","marketing","orderUpdates","crmSegments"],dailyReport:{enabled:!1,frequency:"daily"},userActivity:{enabled:!1,frequency:"daily"},crmSegments:{enabled:!0,recipients:[]}}),[m,p]=(0,a.useState)(!1),[u,h]=(0,a.useState)(!1);(0,a.useEffect)(()=>{let e=t||i;e&&c({...e,supportedNotifications:e.supportedNotifications||["dailyReport","userActivity","systemAlerts","marketing","orderUpdates","crmSegments"],crmSegments:e.crmSegments||{enabled:!0,recipients:[]}})},[t,i]);let g={dailyReport:{title:"Daily Reports",description:"Receive comprehensive daily reports about your property performance"},userActivity:{title:"User Activity",description:"Get notified about user interactions and engagement on your property"},newMessage:{title:"New Messages",description:"Get notified when you receive new messages from customers"},chatStarted:{title:"Chat Started",description:"Get notified when a customer starts a new chat conversation"},systemAlerts:{title:"System Alerts",description:"Important system notifications and updates"},marketing:{title:"Marketing Updates",description:"Promotional content and marketing campaign updates"},orderUpdates:{title:"Order Updates",description:"Real-time updates about orders and transactions"},crmSegments:{title:"CRM Segments",description:"Notifications related to CRM segment activities and updates"}},f=e=>{c(t=>{let s=t.supportedNotifications.includes(e),r=s?t.supportedNotifications.filter(t=>t!==e):[...t.supportedNotifications,e],a={...t,supportedNotifications:r};return"dailyReport"===e||"userActivity"===e?a[e]={...t[e],enabled:!s}:"crmSegments"===e&&(a[e]={...t[e],enabled:!s}),a}),p(!0)},v=(e,t)=>{c(s=>({...s,[e]:{...s[e],frequency:t}})),p(!0)},j=async()=>{h(!0);try{let e={supportedNotifications:d.supportedNotifications,dailyReport:d.dailyReport,userActivity:d.userActivity,crmSegments:d.crmSegments};await l.mutateAsync(e),x.Am.success("Notification settings saved successfully!"),p(!1),null==s||s()}catch(e){x.Am.error("Failed to save notification settings"),console.error(e)}finally{h(!1)}};return o?(0,r.jsx)("div",{className:"bg-white border border-gray-200 rounded-md shadow-sm mt-6 p-8 flex justify-center items-center h-64",children:(0,r.jsx)("div",{className:"text-gray-500",children:"Loading notification settings..."})}):(0,r.jsxs)("div",{className:"bg-white border border-gray-200 rounded-md shadow-sm mt-6",children:[(0,r.jsxs)("div",{className:"border-b border-gray-200 p-4 flex justify-between items-center",children:[(0,r.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,r.jsx)(b.Z,{size:20,className:"text-gray-600"}),(0,r.jsx)("h2",{className:"text-lg font-medium",children:"Notification Settings"})]}),m&&(0,r.jsxs)("button",{onClick:j,disabled:u,className:"flex items-center space-x-2 bg-[#101828] text-white px-4 py-2 rounded-md hover:bg-blue-700 disabled:opacity-50",children:[(0,r.jsx)(n.Z,{size:16}),(0,r.jsx)("span",{children:u?"Saving...":"Save Changes"})]})]}),(0,r.jsxs)("div",{className:"p-4",children:[(0,r.jsx)("p",{className:"text-sm text-gray-600 mb-6",children:"Manage your notification preferences and choose how often you want to receive updates."}),(0,r.jsx)("div",{className:"space-y-4",children:Object.keys(g).map(e=>{let t;let s=d.supportedNotifications.includes(e);t="dailyReport"===e||"userActivity"===e?d[e]:"crmSegments"===e?d[e]:{enabled:s,frequency:"daily"};let a=g[e];return a?(0,r.jsxs)("div",{className:"border border-gray-200 rounded-lg p-4 hover:border-gray-300 transition-colors",children:[(0,r.jsxs)("div",{className:"flex items-start justify-between mb-3",children:[(0,r.jsxs)("div",{className:"flex-1",children:[(0,r.jsx)("h3",{className:"text-sm font-medium text-gray-900",children:a.title}),(0,r.jsx)("p",{className:"text-xs text-gray-500 mt-1",children:a.description})]}),(0,r.jsx)("button",{onClick:()=>f(e),className:"relative inline-flex h-6 w-11 items-center rounded-full transition-colors focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 ".concat(s?"bg-blue-600":"bg-gray-200"),children:(0,r.jsx)("span",{className:"inline-block h-4 w-4 transform rounded-full bg-white transition-transform ".concat(s?"translate-x-6":"translate-x-1")})})]}),s&&("dailyReport"===e||"userActivity"===e)&&"frequency"in t&&(0,r.jsxs)("div",{className:"mt-3 pt-3 border-t border-gray-100",children:[(0,r.jsx)("label",{className:"text-xs font-medium text-gray-700 mb-2 block",children:"Frequency"}),(0,r.jsx)("div",{className:"flex space-x-2",children:["daily","weekly","monthly"].map(s=>(0,r.jsx)("button",{onClick:()=>v(e,s),className:"flex-1 px-3 py-1.5 text-xs rounded-md border transition-colors ".concat(t.frequency===s?"bg-blue-50 border-blue-500 text-blue-700":"bg-white border-gray-300 text-gray-700 hover:bg-gray-50"),children:s.charAt(0).toUpperCase()+s.slice(1)},s))})]})]},e):null})}),(0,r.jsxs)("button",{onClick:j,disabled:!m||u,className:"w-full mt-6 bg-[#101828] text-white rounded-md py-2 text-sm hover:bg-blue-700 disabled:opacity-50 disabled:cursor-not-allowed flex items-center justify-center space-x-2",children:[(0,r.jsx)(n.Z,{size:16}),(0,r.jsx)("span",{children:u?"Saving...":"Save Notification Settings"})]})]})]})},v=s(7963),j=s(57747),w=s(34292),N=s(36948),C=s(26101),S=s(22757),k=s(71293),A=s(41731),M=s(14225),z=s(93717),I=s(70959),E=s(44461),R=s(24124),P=s(84028),Z=s(90889),W=s(48783),O=s(26848),U=s(3785),_=s(78773),T=s(22101),L=e=>{let{propertyId:t}=e,[s,i]=(0,a.useState)("ava-basic"),[o,l]=(0,a.useState)(!1),c=(0,v.p)(),m=(0,p.CK)(),u="https://avasystems.ai",x="".concat(u,"/chats/").concat(t),h='\n<style>\n .chat-frame {\n position: fixed;\n bottom: 20px;\n right: 20px;\n height: 60px;\n width: 60px;\n border: none;\n border: none;\n border-radius: 10px;\n overflow: hidden;\n z-index: 2147483646;\n transition: all 0.3s ease;\n }\n</style>\n\n<iframe id="ava-iframe" src="'.concat(x,"\" title=\"Chat Interface\" class=\"chat-frame\"></iframe>\n\n<script>
1\n (function() {\n const iframe = document.getElementById('ava-iframe');\n \n // Function to resize iframe\n function resizeIframe(height, width) {\n if (iframe) {\n iframe.style.height = typeof height === 'number' ? height + 'px' : height;\n iframe.style.width = typeof width === 'number' ? width + 'px' : width;\n\n const isMobile = window.innerWidth <= 768;\n if (isMobile && (height === '100%' || height === '100vh')) {\n iframe.style.bottom = '0px';\n iframe.style.right = '0px';\n iframe.style.borderRadius = '0px';\n } else {\n iframe.style.bottom = '20px';\n iframe.style.right = '20px';\n iframe.style.borderRadius = '10px';\n }\n }\n }\n\n // Check storage for initial state\n const isOpen = localStorage.getItem('ava_widget_open') === 'true';\n if (isOpen) {\n // Default open size - ideally matches your widget's open dimensions\n const isMobile = window.innerWidth <= 768;\n resizeIframe(isMobile ? '100%' : 500, isMobile ? '100%' : 400);\n }\n\n window.addEventListener('message', (event) => {\n if (event.data && (event.data.type === 'AVA_RESIZE' || (event.data.height && event.data.width))) {\n resizeIframe(event.data.height, event.data.width);\n }\n\n if (event.data && event.data.type === 'AVA_HANDSHAKE_REQUEST') {\n const iframe = document.getElementById('ava-iframe');\n const isOpen = localStorage.getItem('ava_widget_open') === 'true';\n iframe.contentWindow.postMessage({ parentUrl: window.location.href, isOpen }, '*');\n }\n\n if (event.data && event.data.type === 'AVA_STATE_UPDATE') {\n if (event.data.isOpen !== undefined) {\n localStorage.setItem('ava_widget_open', event.data.isOpen);\n }\n }\n });\n\n // SPA URL Change Detection\n function notifyUrlChange() {\n if (iframe && iframe.contentWindow) {\n const parentUrl = window.location.href;\n iframe.contentWindow.postMessage({ parentUrl, type: 'AVA_URL_CHANGE' }, '*');\n }\n }\n\n (function(history) {\n const pushState = history.pushState;\n history.pushState = function(state) {\n const result = pushState.apply(history, arguments);\n notifyUrlChange();\n return result;\n };\n\n const replaceState = history.replaceState;\n history.replaceState = function(state) {\n const result = replaceState.apply(history, arguments);\n notifyUrlChange();\n return result;\n };\n })(window.history);\n\n window.addEventListener('popstate', () => {\n notifyUrlChange();\n });\n\n iframe.onload = function() {\n setTimeout(() => {\n const isOpen = localStorage.getItem('ava_widget_open') === 'true';\n iframe.contentWindow.postMessage({ parentUrl: window.location.href, isOpen }, '").concat(u,"');\n }, 500);\n };\n })();\n</script>").trim(),g=e=>{navigator.clipboard.writeText(e),l(!0),c({title:"Copied!",description:"Embed code copied to clipboard.",status:"success",duration:2e3,isClosable:!0}),setTimeout(()=>l(!1),2e3)},b=async()=>{try{let e=new FormData;e.append("cookieType",s),await m.mutateAsync({id:t,data:e}),c({title:"Configuration Saved",description:"Widget updated to use ".concat(s," mode."),status:"success",duration:3e3,isClosable:!0})}catch(e){c({title:"Error",description:"Failed to update widget configuration.",status:"error",duration:3e3,isClosable:!0})}};return(0,r.jsxs)(j.xu,{bg:"white",borderRadius:"lg",borderWidth:"1px",borderColor:"gray.200",overflow:"hidden",mt:6,children:[(0,r.jsxs)(j.xu,{borderBottomWidth:"1px",borderColor:"gray.200",p:4,children:[(0,r.jsxs)(w.U,{spacing:2,children:[(0,r.jsx)(N.J,{as:C.E,boxSize:5,color:"gray.600"}),(0,r.jsx)(S.X,{as:"h3",size:"md",fontWeight:"medium",children:"Widget Integration"})]}),(0,r.jsx)(k.x,{fontSize:"sm",color:"gray.500",mt:1,children:"Configure your widget and choose your platform."})]}),(0,r.jsxs)(j.xu,{bg:"gray.50",p:4,borderBottomWidth:"1px",borderColor:"gray.200",children:[(0,r.jsxs)(w.U,{spacing:4,align:"flex-end",flexWrap:"wrap",children:[(0,r.jsxs)(j.xu,{flex:1,minW:"200px",children:[(0,r.jsx)(k.x,{fontSize:"xs",fontWeight:"semibold",mb:1,textTransform:"uppercase",color:"gray.600",children:"Cookie Consent Configuration"}),(0,r.jsxs)(A.P,{bg:"white",size:"sm",value:s,onChange:e=>i(e.target.value),children:[(0,r.jsx)("option",{value:"no-banner",children:"No Cookie Banner (Load Immediately)"}),(0,r.jsx)("option",{value:"ava-basic",children:"Built-in Cookie Banner"}),(0,r.jsx)("option",{value:"one-trust",children:"OneTrust (External Provider)"}),(0,r.jsx)("option",{value:"cookie-bot",children:"CookieBot (External Provider)"}),(0,r.jsx)("option",{value:"generic-custom",children:"Generic/Custom (External Provider)"})]})]}),(0,r.jsx)(M.z,{size:"sm",colorScheme:"blue",leftIcon:(0,r.jsx)(N.J,{as:n.Z,size:14}),onClick:b,isLoading:m.isPending,mt:{base:2,md:0},children:"Save Configuration"})]}),(0,r.jsxs)(z.k,{mt:3,gap:2,fontSize:"xs",color:"gray.500",alignItems:"start",children:[(0,r.jsx)(O.Z,{size:14,style:{marginTop:"3px",flexShrink:0}}),(0,r.jsxs)(k.x,{children:["no-banner"===s&&"The widget will load immediately without any cookie consent banner or checks.","ava-basic"===s&&"We will show a small banner asking for permission before loading the chat.","one-trust"===s&&"The widget will listen for OneTrust consent events before loading.","cookie-bot"===s&&"The widget will listen for CookieBot consent events before loading.","generic-custom"===s&&"The widget will check for a 'cookie_consent=true' cookie before loading."]})]})]}),(0,r.jsx)(j.xu,{p:4,children:(0,r.jsxs)(I.m,{variant:"enclosed",colorScheme:"blue",children:[(0,r.jsxs)(E.t,{children:[(0,r.jsxs)(R.O,{children:[(0,r.jsx)(N.J,{as:_.gtO,mr:2,color:"orange.500"})," HTML"]}),(0,r.jsxs)(R.O,{children:[(0,r.jsx)(N.J,{as:_.k7O,mr:2,color:"blue.600"})," WordPress"]}),(0,r.jsxs)(R.O,{children:[(0,r.jsx)(N.J,{as:T.Xou,mr:2})," Next.js"]}),(0,r.jsxs)(R.O,{children:[(0,r.jsx)(N.J,{as:_.huN,mr:2,color:"cyan.400"})," React.js"]})]}),(0,r.jsxs)(P.n,{children:[(0,r.jsxs)(Z.x,{px:0,py:4,children:[(0,r.jsx)(k.x,{fontSize:"sm",mb:2,fontWeight:"bold",color:"gray.700",children:"Embed Code"}),(0,r.jsxs)(j.xu,{position:"relative",children:[(0,r.jsx)(j.xu,{as:"pre",bg:"gray.900",color:"gray.300",p:4,borderRadius:"md",fontSize:"xs",overflowX:"auto",maxH:"400px",sx:{"&::-webkit-scrollbar":{height:"8px"}},children:(0,r.jsx)("code",{children:h})}),(0,r.jsx)(M.z,{position:"absolute",top:4,right:4,size:"xs",onClick:()=>g(h),leftIcon:o?(0,r.jsx)(U.Z,{size:12}):(0,r.jsx)(d.Z,{size:12}),colorScheme:o?"green":"gray",children:o?"Copied":"Copy"})]})]}),(0,r.jsx)(Z.x,{px:0,py:4,children:(0,r.jsxs)(W.g,{align:"start",spacing:4,bg:"blue.50",p:6,borderRadius:"md",borderWidth:"1px",borderColor:"blue.200",children:[(0,r.jsx)(S.X,{as:"h4",size:"md",color:"blue.700",children:"Official WordPress Plugin"}),(0,r.jsx)(k.x,{color:"blue.800",children:"Download our plugin to easily install AVA on your site. The plugin will automatically check your configurations (selected above) and apply the correct cookie logic."}),(0,r.jsx)(M.z,{colorScheme:"blue",as:"a",href:"#",target:"_blank",children:"Download Plugin"})]})}),(0,r.jsx)(Z.x,{px:0,py:4,children:(0,r.jsxs)(W.g,{align:"start",spacing:4,children:["For Next.js, use our NPM package.",(0,r.jsxs)(j.xu,{w:"full",bg:"gray.900",color:"gray.300",p:4,borderRadius:"md",fontSize:"xs",children:[(0,r.jsx)(k.x,{color:"gray.500",mb:2,children:"// 1. Install the package"}),(0,r.jsx)(C.E,{display:"block",bg:"transparent",color:"green.300",mb:4,children:"npm install deskmayte-widget"}),(0,r.jsx)(k.x,{color:"gray.500",mb:2,children:"// 2. Use in your app"}),(0,r.jsx)("pre",{children:"import { AvaWidget } from 'deskmayte-widget';
1\n\nexport default function App() {\n return (\n <AvaWidget propertyId=\"${propertyId}\" />\n );\n}"})]})]})}),(0,r.jsx)(Z.x,{px:0,py:4,children:(0,r.jsxs)(W.g,{align:"start",spacing:4,children:["For React, use our NPM package.",(0,r.jsxs)(j.xu,{w:"full",bg:"gray.900",color:"gray.300",p:4,borderRadius:"md",fontSize:"xs",children:[(0,r.jsx)(k.x,{color:"gray.500",mb:2,children:"// 1. Install the package"}),(0,r.jsx)(C.E,{display:"block",bg:"transparent",color:"green.300",mb:4,children:"npm install deskmayte-widget"}),(0,r.jsx)(k.x,{color:"gray.500",mb:2,children:"// 2. Use in your app"}),(0,r.jsx)("pre",{children:"import { AvaWidget } from 'deskmayte-widget';\n\nexport default function App() {\n return (\n <AvaWidget propertyId=\"${propertyId}\" />\n );\n}"})]})]})})]})]})})]})},D=s(50858),q=s(67233),F=s(33980),B=s(98761),J=()=>{let e=(0,u.Z)(e=>e.selectedProperty),t=(0,B.ub)(),[s,i]=(0,a.useState)({firstName:"",lastName:"",email:"",password:""}),[n,o]=(0,a.useState)(!1),[l,d]=(0,a.useState)(!1),c=(e,t)=>{i(s=>({...s,[e]:t}))},m=async r=>{if(r.preventDefault(),!e){x.Am.error("No property selected");return}if(!s.firstName||!s.lastName||!s.email||!s.password){x.Am.error("Please fill in all fields");return}d(!0);try{await t.mutateAsync({...s,propertyChatId:e}),x.Am.success("Agent created successfully!"),i({firstName:"",lastName:"",email:"",password:""})}catch(e){x.Am.error(e.message||"Failed to create agent")}finally{d(!1)}};return(0,r.jsxs)("div",{className:"bg-white border border-gray-200 rounded-md shadow-sm mt-6",children:[(0,r.jsx)("div",{className:"border-b border-gray-200 p-4 flex justify-between items-center",children:(0,r.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,r.jsx)(D.Z,{size:20,className:"text-gray-600"}),(0,r.jsx)("h2",{className:"text-lg font-medium",children:"Create Support Agent"})]})}),(0,r.jsxs)("div",{className:"p-4",children:[(0,r.jsx)("p",{className:"text-sm text-gray-600 mb-6",children:"Add a new support agent to this property. They will be able to manage chats and tickets."}),(0,r.jsxs)("form",{onSubmit:m,className:"space-y-4 max-w-2xl",children:[(0,r.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"First Name"}),(0,r.jsx)("input",{type:"text",value:s.firstName,onChange:e=>c("firstName",e.target.value),className:"w-full border border-gray-300 rounded-md p-2 text-sm focus:ring-blue-500 focus:border-blue-500",placeholder:"John"})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Last Name"}),(0,r.jsx)("input",{type:"text",value:s.lastName,onChange:e=>c("lastName",e.target.value),className:"w-full border border-gray-300 rounded-md p-2 text-sm focus:ring-blue-500 focus:border-blue-500",placeholder:"Doe"})]})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Email Address"}),(0,r.jsx)("input",{type:"email",value:s.email,onChange:e=>c("email",e.target.value),className:"w-full border border-gray-300 rounded-md p-2 text-sm focus:ring-blue-500 focus:border-blue-500",placeholder:"[email protected]"})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Password"}),(0,r.jsxs)("div",{className:"relative",children:[(0,r.jsx)("input",{type:n?"text":"password",value:s.password,onChange:e=>c("password",e.target.value),className:"w-full border border-gray-300 rounded-md p-2 pr-10 text-sm focus:ring-blue-500 focus:border-blue-500",placeholder:"Enter password"}),(0,r.jsx)("button",{type:"button",onClick:()=>o(!n),className:"absolute right-2 top-1/2 transform -translate-y-1/2 text-gray-500 hover:text-gray-700",children:n?(0,r.jsx)(q.Z,{size:16}):(0,r.jsx)(F.Z,{size:16})})]})]}),(0,r.jsx)("div",{className:"pt-2",children:(0,r.jsxs)("button",{type:"submit",disabled:l,className:"bg-[#101828] text-white rounded-md px-4 py-2 text-sm hover:bg-blue-700 disabled:opacity-50 disabled:cursor-not-allowed flex items-center space-x-2",children:[(0,r.jsx)(D.Z,{size:16}),(0,r.jsx)("span",{children:l?"Creating Agent...":"Create Agent"})]})})]})]})]})},V=s(20518),X=s(85444),G=s(24338),H=()=>{let{visibleMenus:e,toggleMenuVisibility:t}=(0,G.Z)();return(0,r.jsxs)("div",{className:"bg-white border border-gray-200 rounded-md shadow-sm mt-6",children:[(0,r.jsx)("div",{className:"border-b border-gray-200 p-4 flex justify-between items-center",children:(0,r.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,r.jsx)(X.Z,{size:20,className:"text-gray-600"}),(0,r.jsx)("h2",{className:"text-lg font-medium",children:"Menu Visibility Settings"})]})}),(0,r.jsxs)("div",{className:"p-4",children:[(0,r.jsx)("p",{className:"text-sm text-gray-600 mb-6",children:"Customize your sidebar by toggling which modules and menus are visible. This only affects your view."}),(0,r.jsx)("div",{className:"space-y-4",children:[{path:"/dashboard",title:"Dashboard",description:"Main dashboard overview (Cannot be disabled)",required:!0},{path:"/dashboard/live-monitoring",title:"Live Monitoring",description:"Monitor active users and interactions in real-time"},{path:"/dashboard/inbox",title:"Inbox",description:"Manage customer conversations and messages"},{path:"/dashboard/crm",title:"CRM",description:"Customer relationship management and contacts"},{path:"/dashboard/knowledge-base",title:"Knowledge Base",description:"Manage AI knowledge base and articles"},{path:"/dashboard/analytics",title:"Analytics",description:"View performance and engagement metrics"},{path:"/dashboard/forms",title:"Forms",description:"Create and manage custom forms"},{path:"/dashboard/scheduling",title:"Scheduling",description:"Manage appointments and availability"},{path:"/dashboard/settings",title:"Settings",description:"System settings and configuration (Cannot be disabled)",required:!0},{path:"ping-modal",title:"Ping Website",description:"Check website status directly from sidebar"},{path:"/dashboard/sentinel",title:"Sentinel",description:"Automated website testing and auditing"},{path:"/dashboard/create-test",title:"Create Test",description:"Create new Sentinel tests"},{path:"/dashboard/sentinel-settings",title:"Sentinel Settings",description:"Configure Sentinel parameters"}].map(s=>{var a;let i=null===(a=e[s.path])||void 0===a||a;return(0,r.jsx)("div",{className:"border border-gray-200 rounded-lg p-4 transition-colors ".concat(s.required?"bg-gray-50":"hover:border-gray-300"),children:(0,r.jsxs)("div",{className:"flex items-start justify-between mb-1",children:[(0,r.jsxs)("div",{className:"flex-1",children:[(0,r.jsxs)("h3",{className:"text-sm font-medium text-gray-900",children:[s.title," ",s.required&&(0,r.jsx)("span",{className:"text-xs text-gray-500 ml-2",children:"(Required)"})]}),(0,r.jsx)("p",{className:"text-xs text-gray-500 mt-1",children:s.description})]}),(0,r.jsx)("button",{onClick:()=>{s.required||t(s.path)}
1,disabled:s.required,className:"relative inline-flex h-6 w-11 items-center rounded-full transition-colors focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 ".concat(s.required?"bg-blue-300 cursor-not-allowed opacity-70":i?"bg-blue-600":"bg-gray-200"),children:(0,r.jsx)("span",{className:"inline-block h-4 w-4 transform rounded-full bg-white transition-transform ".concat(i?"translate-x-6":"translate-x-1")})})]})},s.path)})})]})]})},K=()=>{let e=(0,u.Z)(e=>e.selectedProperty),t=(0,u.Z)(e=>e.editSelectedProperty),{data:s,isLoading:b}=(0,p.t7)(e),y=()=>({id:"",website:"",propertyName:"",propertyImage:null,propertyColor:"#475266",welcomeMessage:"",suggestedMessages:[],phoneNumber:null,chatMode:"manual",propertyOwnerId:"",createdAt:"",updatedAt:""}),[v,j]=(0,a.useState)(y()),[w,N]=(0,a.useState)(""),[C,S]=(0,a.useState)(!1),[k,A]=(0,a.useState)(!1),[M,z]=(0,a.useState)(!1),[I,E]=(0,a.useState)(null),[R,P]=(0,a.useState)(null),[Z,W]=(0,a.useState)(!e),O=(0,p.CK)(),U=(0,p.I8)();(0,a.useEffect)(()=>{e?W(!1):(W(!0),j(y()),P(null))},[e]),(0,a.useEffect)(()=>{if(s&&!Z){var e,t,r,a,i,n,o,l,d,c,m,p;let u={id:(null==s?void 0:null===(e=s.data)||void 0===e?void 0:e.id)||"",website:(null==s?void 0:null===(t=s.data)||void 0===t?void 0:t.website)||"",propertyName:(null==s?void 0:null===(r=s.data)||void 0===r?void 0:r.propertyName)||"",propertyImage:(null==s?void 0:null===(a=s.data)||void 0===a?void 0:a.propertyImage)||null,propertyColor:(null==s?void 0:null===(i=s.data)||void 0===i?void 0:i.propertyColor)||"#475266",welcomeMessage:(null==s?void 0:null===(n=s.data)||void 0===n?void 0:n.welcomeMessage)||"",suggestedMessages:(null==s?void 0:null===(o=s.data)||void 0===o?void 0:o.suggestedMessages)||[],phoneNumber:(null==s?void 0:null===(l=s.data)||void 0===l?void 0:l.phoneNumber)||null,chatMode:(null==s?void 0:null===(d=s.data)||void 0===d?void 0:d.chatMode)||"manual",propertyOwnerId:(null==s?void 0:null===(c=s.data)||void 0===c?void 0:c.propertyOwnerId)||"",createdAt:(null==s?void 0:null===(m=s.data)||void 0===m?void 0:m.createdAt)||"",updatedAt:(null==s?void 0:null===(p=s.data)||void 0===p?void 0:p.updatedAt)||""};j(u),u.propertyImage&&P(u.propertyImage)}},[s,Z]);let _=(e,t)=>{j(s=>({...s,[e]:t})),S(!0)};(0,a.useEffect)(()=>()=>{R&&R.startsWith("blob:")&&URL.revokeObjectURL(R)},[R]);let T=()=>{""!==w.trim()&&(_("suggestedMessages",[...v.suggestedMessages,w.trim()]),N(""))},D=e=>{_("suggestedMessages",v.suggestedMessages.filter((t,s)=>s!==e))},q=e=>{navigator.clipboard.writeText(e),x.Am.success("Copied to clipboard!")},F=async()=>{A(!0);try{let a=new FormData;if(a.append("website",v.website),a.append("propertyName",v.propertyName),a.append("propertyColor",v.propertyColor),a.append("welcomeMessage",v.welcomeMessage),a.append("suggestedMessages",JSON.stringify(v.suggestedMessages)),a.append("phoneNumber",v.phoneNumber||""),a.append("chatMode",v.chatMode),I&&a.append("file",I),Z||!e){var s,r;let e=await U.mutateAsync({data:a});x.Am.success("Property created successfully!");let i=(null===(s=e.data)||void 0===s?void 0:s.id)||(null===(r=e.property)||void 0===r?void 0:r.id);i&&t(i),W(!1)}else await O.mutateAsync({id:e,data:a}),x.Am.success("Property updated successfully!");E(null),S(!1)}catch(e){x.Am.error("Failed to update property")}finally{A(!1)}};return b?(0,r.jsx)(m.Z,{children:(0,r.jsx)("div",{className:"w-full mx-auto p-4 flex justify-center items-center h-64",children:(0,r.jsx)("div",{className:"text-gray-500",children:"Loading property data..."})})}):(0,r.jsx)(m.Z,{title:"Settings",children:(0,r.jsxs)("div",{className:"w-full mx-auto p-4 relative h-[80vh] overflow-y-auto",style:{scrollbarWidth:"none",msOverflowStyle:"none"},children:[(0,r.jsx)(h.Z,{showLoadingSpinner:k}),(0,r.jsxs)("div",{className:"bg-white border border-gray-200 rounded-md shadow-sm",children:[(0,r.jsxs)("div",{className:"border-b border-gray-200 p-4 flex justify-between items-center flex-wrap gap-2",children:[(0,r.jsx)("h1",{className:"text-lg font-medium",children:Z?"Create New Property":"Property Overview"}),(0,r.jsxs)("div",{className:"flex items-center space-x-2 flex-wrap gap-y-2",children:[(0,r.jsxs)("button",{onClick:()=>{j(y()),P(null),E(null),W(!0),S(!0)},className:"flex items-center space-x-2 bg-green-600 text-white px-4 py-2 rounded-md hover:bg-green-700",children:[(0,r.jsx)(i.Z,{size:16}),(0,r.jsx)("span",{children:"Create New"})]}),C&&(0,r.jsxs)("button",{onClick:F,disabled:k,className:"flex items-center space-x-2 bg-[#101828] text-white px-4 py-2 rounded-md hover:bg-blue-700 disabled:opacity-50",children:[(0,r.jsx)(n.Z,{size:16}
1),(0,r.jsx)("span",{children:k?"Saving...":Z?"Create Property":"Save Changes"})]}),(0,r.jsx)("button",{onClick:()=>z(!0),className:"px-6 py-2 bg-blue-600 text-white rounded-lg hover:bg-blue-700 transition-colors font-medium",children:"Check Website Status"})]}),(0,r.jsx)(g.Z,{isOpen:M,onClose:()=>z(!1)})]}),(0,r.jsxs)("div",{className:"p-4 grid grid-cols-1 md:grid-cols-2 gap-6",children:[(0,r.jsxs)("div",{className:"space-y-6",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("p",{className:"text-sm font-medium mb-2",children:"Property Image"}),(0,r.jsxs)("div",{className:"flex items-start space-x-4",children:[(0,r.jsxs)("div",{className:"relative",children:[(0,r.jsx)("div",{className:"h-16 w-16 flex items-center justify-center text-white text-2xl font-bold rounded overflow-hidden border-2 border-gray-200",style:{backgroundColor:v.propertyColor},children:R?(0,r.jsx)("img",{src:R,alt:"Property",className:"w-full h-full object-cover rounded"}):v.propertyName.charAt(0).toUpperCase()||"?"}),R&&(0,r.jsx)("button",{onClick:()=>{E(null),P(null),j(e=>({...e,propertyImage:null})),S(!0)},className:"absolute -top-2 -right-2 bg-red-500 text-white rounded-full w-5 h-5 flex items-center justify-center hover:bg-red-600 text-xs",title:"Remove image",children:(0,r.jsx)(o.Z,{size:12})})]}),(0,r.jsxs)("div",{className:"flex-1",children:[(0,r.jsx)("p",{className:"text-xs text-gray-500 mb-2",children:"We recommend a square image of at least 512x512 for the property. Max file size: 5MB."}),I&&(0,r.jsxs)("p",{className:"text-xs text-green-600 mb-2",children:["Selected: ",I.name,"
1(",(I.size/1024/1024).toFixed(2),"MB)"]}),(0,r.jsx)("input",{type:"file",accept:"image/*",className:"hidden",id:"property-image",onChange:e=>{var t;let s=null===(t=e.target.files)||void 0===t?void 0:t[0];if(s){if(!s.type.startsWith("image/")){x.Am.error("Please select a valid image file");return}if(s.size>5242880){x.Am.error("Image size should be less than 5MB");return}E(s),P(URL.createObjectURL(s)),S(!0)}}}),(0,r.jsxs)("label",{htmlFor:"property-image",className:"inline-flex items-center space-x-2 text-xs bg-white border border-gray-300 rounded px-3 py-2 cursor-pointer hover:bg-gray-50 transition-colors",children:[(0,r.jsx)(l.Z,{size:14}),(0,r.jsx)("span",{children:"Upload Image"})]})]})]})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("p",{className:"text-sm font-medium mb-2",children:"Property Color"}),(0,r.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,r.jsx)("input",{type:"color",value:v.propertyColor,onChange:e=>_("propertyColor",e.target.value),className:"w-12 h-8 border border-gray-300 rounded cursor-pointer"}),(0,r.jsx)("input",{type:"text",value:v.propertyColor,onChange:e=>_("propertyColor",e.target.value),className:"flex-1 border border-gray-300 rounded p-2 text-sm",placeholder:"#475266"})]})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("p",{className:"text-sm font-medium mb-2",children:"Property Name"}),(0,r.jsxs)("div",{className:"relative",children:[(0,r.jsx)("input",{type:"text",className:"w-full border border-gray-300 rounded p-2 pr-8 text-sm",value:v.propertyName,onChange:e=>_("propertyName",e.target.value),placeholder:"Enter property name"}),(0,r.jsx)("button",{className:"absolute right-2 top-1/2 transform -translate-y-1/2 text-gray-400 hover:text-gray-600",onClick:()=>q(v.propertyName),children:(0,r.jsx)(d.Z,{size:16})})]})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("p",{className:"text-sm font-medium mb-2",children:"Website URL"}),(0,r.jsxs)("div",{className:"relative",children:[(0,r.jsx)("input",{type:"url",className:"w-full border border-gray-300 rounded p-2 pr-8 text-sm",value:v.website,onChange:e=>_("website",e.target.value),placeholder:"https://example.com"}),(0,r.jsx)("button",{className:"absolute right-2 top-1/2 transform -translate-y-1/2 text-gray-400 hover:text-gray-600",onClick:()=>q(v.website),children:(0,r.jsx)(d.Z,{size:16})})]})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("p",{className:"text-sm font-medium mb-2",children:"Phone Number"}),(0,r.jsxs)("div",{className:"relative",children:[(0,r.jsx)("input",{type:"tel",className:"w-full border border-gray-300 rounded p-2 pr-8 text-sm",value:v.phoneNumber||"",onChange:e=>_("phoneNumber",e.target.value),placeholder:"+1 (555) 000-0000"}),(0,r.jsx)("button",{className:"absolute right-2 top-1/2 transform -translate-y-1/2 text-gray-400 hover:text-gray-600",onClick:()=>q(v.phoneNumber||""),children:(0,r.jsx)(d.Z,{size:16})})]})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("p",{className:"text-sm font-medium mb-2",children:"Welcome Message"}),(0,r.jsx)("textarea",{className:"w-full border border-gray-300 rounded p-2 text-sm h-24",value:v.welcomeMessage,onChange:e=>_("welcomeMessage",e.target.value),placeholder:"Enter welcome message for visitors"})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("p",{className:"text-sm font-medium mb-2",children:"Chat Mode"}),(0,r.jsxs)("div",{className:"relative",children:[(0,r.jsxs)("select",{className:"w-full appearance-none border border-gray-300 rounded p-2 pr-8 text-sm bg-white",value:v.chatMode,onChange:e=>_("chatMode",e.target.value),children:[(0,r.jsx)("option",{value:"manual",children:"Manual"}),(0,r.jsx)("option",{value:"ai",children:"AI"}),(0,r.jsx)("option",{value:"user",children:"USER"})]}),(0,r.jsx)("div",{className:"absolute inset-y-0 right-0 flex items-center px-2 pointer-events-none",children:(0,r.jsx)(c.Z,{size:16,className:"text-gray-400"})})]})]})]}),(0,r.jsxs)("div",{className:"space-y-6",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("p",{className:"text-sm font-medium mb-2",children:"Property ID"}),(0,r.jsxs)("div",{className:"relative",children:[(0,r.jsx)("input",{type:"text",className:"w-full border border-gray-300 rounded p-2 pr-8 text-sm bg-gray-50",value:v.id,readOnly:!0,placeholder:"Property ID will be generated"}),(0,r.jsx)("button",{className:"absolute right-2 top-1/2 transform -translate-y-1/2 text-gray-400 hover:text-gray-600",onClick:()=>q(v.id),children:(0,r.jsx)(d.Z,{size:16})})]})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("p",{className:"text-sm font-medium mb-2",children:"Suggested Messages"}),(0,r.jsxs)("div",{className:"flex mb-2",children:[(0,r.jsx)("input",{type:"text",className:"flex-1 border border-gray-300 rounded-l p-2 text-sm",placeholder:"Add suggested message",value:w,onChange:e=>N(e.target.value),onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),T())}}),(0,r.jsx)("button",{className:"bg-gray-50 border border-l-0 border-gray-300 rounded-r px-3 py-2 text-xs flex items-center justify-center hover:bg-gray-100",onClick:T,children:(0,r.jsx)(i.Z,{size:16})})]}),(0,r.jsxs)("div",{className:"space-y-2 h-[380px] overflow-y-auto p-2 border shadow rounded",style:{scrollbarWidth:"none",msOverflowStyle:"none"},children:[v.suggestedMessages.map((e,t)=>(0,r.jsxs)("div",{className:"flex items-center justify-between bg-gray-100 px-3 py-2 rounded text-sm",children:[(0,r.jsx)("span",{children:e}),(0,r.jsx)("button",{onClick:()=>D(t),className:"text-red-500 hover:text-red-700",children:(0,r.jsx)(o.Z,{size:16})})]},t)),0===v.suggestedMessages.length&&(0,r.jsx)("p",{className:"text-xs text-gray-500",children:"No suggested messages added yet."})]})]}),(0,r.jsxs)("button",{onClick:F,disabled:!C||k,className:"w-full bg-[#101828] text-white rounded-md py-2 text-sm hover:bg-blue-700 disabled:opacity-50 disabled:cursor-not-allowed flex items-center justify-center space-x-2",children:[(0,r.jsx)(n.Z,{size:16}
1),(0,r.jsx)("span",{children:k?"Saving...":"Save Changes"})]})]})]})]}),(0,r.jsx)(f,{notificationData:void 0,onSave:()=>{}}),(0,r.jsx)(H,{}),e&&(0,r.jsx)(V.Z,{propertyId:e,domain:v.website}),(0,r.jsx)(J,{}),(0,r.jsx)(L,{propertyId:e})]})})}}},function(e){e.O(0,[4885,3365,6660,8391,509,8151,9317,6957,4321,6130,7473,2932,9110,6343,965,2930,7831,1733,1728,2888,9774,179],function(){return e(e.s=20473)}),_N_E=e.O()}]);
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.