1"use strict";(self.webpackChunkfrontend=self.webpackChunkfrontend||[]).push([[8931],{8931(e,t,s){s.r(t),s.d(t,{default:()=>h});var a=s(9379),l=s(9950),r=s(6311),d=s(7737),i=s(1855),c=s(1742),n=s(770),o=s(6274),m=s(9401),x=s(4162),u=s(7224),b=s(4414);const p=["AL","AK","AZ","AR","CA","CO","CT","DE","FL","GA","HI","ID","IL","IN","IA","KS","KY","LA","ME","MD","MA","MI","MN","MS","MO","MT","NE","NV","NH","NJ","NM","NY","NC","ND","OH","OK","OR","PA","RI","SC","SD","TN","TX","UT","VT","VA","WA","WV","WI","WY","DC"];function h(){const[e,t]=(0,l.useState)(null),[s,h]=(0,l.useState)(!0),[f,g]=(0,l.useState)(!1),[k,v]=(0,l.useState)({lead_types:[],states:[],cities:"",preferred_call_time:"",ideal_client_description:""}),[j,y]=(0,l.useState)([]);(0,l.useEffect)(()=>{Promise.all([m.default.getLeadPreferences(),m.default.getProfile()]).then(e=>{let[s,a]=e;const l=a.profile||{};t(s),y(s.brokerage_regions||[]),v({lead_types:s.lead_types||[],states:s.states||[],cities:(s.cities||[]).join(", "),preferred_call_time:l.preferred_call_time||"",ideal_client_description:l.ideal_client_description||""})}).finally(()=>h(!1))},[]);if(s)return(0,b.jsx)(u.A,{});const N=j.length>0?j:p;return(0,b.jsxs)("div",{className:"flex-1","data-testid":"preferences-page",children:[(0,b.jsxs)("h1",{className:"font-heading font-bold text-2xl text-kw-dark dark:text-slate-100 mb-6 flex items-center gap-2",children:[(0,b.jsx)(n.A,{size:24,className:"text-green-600"})," Lead Preferences"]}),(0,b.jsxs)("div",{className:"bg-white dark:bg-slate-800 rounded-xl shadow-sm border border-slate-100 dark:border-slate-700 p-6 mb-5",children:[(0,b.jsxs)("h2",{className:"font-medium text-sm text-kw-dark dark:text-slate-100 mb-1 flex items-center gap-2",children:[(0,b.jsx)(o.A,{size:14,className:"text-green-500"})," Lead Types"]}),(0,b.jsx)("p",{className:"text-xs text-slate-400 mb-4",children:"Select which types of leads you want in your queue. Empty = all types."}),(0,b.jsx)("div",{className:"flex gap-3",children:["buyers","sellers","preforeclosure"].map(e=>(0,b.jsxs)("button",{onClick:()=>(e=>{v(t=>(0,a.A)((0,a.A)({},t),{},{lead_types:t.lead_types.includes(e)?t.lead_types.filter(t=>t!==e):[...t.lead_types,e]}))})(e),"data-testid":"pref-type-".concat(e),className:"flex-1 py-3 rounded-xl text-sm font-medium capitalize transition-all flex items-center justify-center gap-2 ".concat(k.lead_types.includes(e)?"bg-green-600 text-white shadow-sm":"bg-slate-100 dark:bg-slate-800 text-slate-600 dark:text-slate-300 hover:bg-slate-200"),children:[k.lead_types.includes(e)&&(0,b.jsx)(r.A,{size:14}),e]},e))}),0===k.lead_types.length&&(0,b.jsx)("p",{className:"text-xs text-amber-600 bg-amber-50 inline-block px-2 py-0.5 rounded mt-2",children:"All types (no filter)"})]}),(0,b.jsxs)("div",{className:"bg-white dark:bg-slate-800 rounded-xl shadow-sm border border-slate-100 dark:border-slate-700 p-6 mb-5",children:[(0,b.jsxs)("h2",{className:"font-medium text-sm text-kw-dark dark:text-slate-100 mb-1 flex items-center gap-2",children:[(0,b.jsx)(i.A,{size:14,className:"text-blue-500"})," Location Filter"]}),(0,b.jsx)("p",{className:"text-xs text-slate-400 mb-4",children:j.length>0?"Your brokerage covers: ".concat(j.join(", "),". Select which states you want."):"Select states to narrow your leads. Empty = all available states."}),(0,b.jsx)("div",{className:"flex flex-wrap gap-1.5 mb-4",children:N.map(e=>(0,b.jsx)("button",{onClick:()=>(e=>{v(t=>(0,a.A)((0,a.A)({},t),{},{states:t.states.includes(e)?t.states.filter(t=>t!==e):[...t.states,e]}))})(e),"data-testid":"pref-state-".concat(e),className:"px-3 py-1.5 rounded-lg text-xs font-medium transition-all ".concat(k.states.includes(e)?"bg-blue-600 text-white":"bg-slate-100 dark:bg-slate-800 text-slate-500 dark:text-slate-400 hover:bg-slate-200"),children:e},e))}),k.states.length>0&&(0,b.jsxs)("div",{className:"flex items-center gap-2 mb-4",children:[(0,b.jsxs)("span",{className:"text-xs text-blue-600 font-medium",children:["Selected: ",k.states.join(", ")]}),(0,b.jsx)("button",{onClick:()=>v(e=>(0,a.A)((0,a.A)({},e),{},{states:[]})),className:"text-xs text-red-500 hover:text-red-700",children:"Clear"})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("label",{className:"block text-xs font-medium text-slate-600 dar
1k:text-slate-300 mb-1",children:"Specific cities (optional)"}),(0,b.jsx)("input",{type:"text",value:k.cities,onChange:e=>v(t=>(0,a.A)((0,a.A)({},t),{},{cities:e.target.value})),className:"w-full px-4 py-2.5 border border-slate-200 dark:border-slate-700 rounded-lg focus:border-blue-500 outline-none text-sm",placeholder:"Portland, Vancouver, Salem..."}),(0,b.jsx)("p",{className:"text-xs text-slate-400 mt-1",children:"Comma-separated. Narrows within your selected states."})]})]}),(0,b.jsxs)("div",{className:"bg-white dark:bg-slate-800 rounded-xl shadow-sm border border-slate-100 dark:border-slate-700 p-6 mb-5",children:[(0,b.jsxs)("h2",{className:"font-medium text-sm text-kw-dark dark:text-slate-100 mb-1 flex items-center gap-2",children:[(0,b.jsx)(d.A,{size:14,className:"text-amber-500"})," Preferred Call Time"]}),(0,b.jsx)("p",{className:"text-xs text-slate-400 mb-4",children:"When do you usually make your calls?"}),(0,b.jsx)("div",{className:"grid grid-cols-2 gap-2",children:[{value:"morning",label:"Morning",desc:"8am - 12pm"},{value:"afternoon",label:"Afternoon",desc:"12pm - 5pm"},{value:"evening",label:"Evening",desc:"5pm - 8pm"},{value:"flexible",label:"Flexible",desc:"Anytime"}].map(e=>(0,b.jsxs)("button",{onClick:()=>v(t=>(0,a.A)((0,a.A)({},t),{},{preferred_call_time:e.value})),className:"p-3 rounded-lg border-2 text-left transition-all ".concat(k.preferred_call_time===e.value?"border-amber-500 bg-amber-50":"border-slate-200 dark:border-slate-700 hover:border-slate-300"),children:[(0,b.jsx)("p",{className:"font-medium text-xs text-kw-dark dark:text-slate-100",children:e.label}),(0,b.jsx)("p",{className:"text-[10px] text-slate-500 dark:text-slate-400",children:e.desc})]},e.value))})]}),(0,b.jsxs)("div",{className:"bg-white dark:bg-slate-800 rounded-xl shadow-sm border border-slate-100 dark:border-slate-700 p-6 mb-5",children:[(0,b.jsx)("h2",{className:"font-medium text-sm text-kw-dark dark:text-slate-100 mb-1",children:"Ideal Client Description"}),(0,b.jsx)("p",{className:"text-xs text-slate-400 mb-3",children:"This helps Patti personalize your scripts and coaching."}),(0,b.jsx)("textarea",{value:k.ideal_client_description,onChange:e=>v(t=>(0,a.A)((0,a.A)({},t),{},{ideal_client_description:e.target.value})),className:"w-full px-4 py-2.5 border border-slate-200 dark:border-slate-700 rounded-lg focus:border-green-500 outline-none text-sm resize-none",rows:3,placeholder:"e.g. First-time homebuyers in their 30s, families looking to move to suburbs, investors seeking multi-family..."})]}),(0,b.jsxs)("div",{className:"bg-white dark:bg-slate-800 rounded-xl shadow-sm border border-slate-100 dark:border-slate-700 p-6 mb-5",children:[(0,b.jsx)("h2",{className:"font-medium text-sm text-kw-dark dark:text-slate-100 mb-3",children:"Automation"}),(0,b.jsxs)("label",{className:"flex items-center justify-between p-3 bg-slate-50 dark:bg-slate-900/40 rounded-lg cursor-pointer",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("p",{className:"text-sm font-medium text-kw-dark dark:text-slate-100",children:"Auto-schedule voicemail callbacks"}),(0,b.jsx)("p",{className:"text-xs text-slate-400",children:"When you leave a voicemail, automatically add a 2-hour callback to your schedule"})]}),(0,b.jsxs)("div",{className:"relative",children:[(0,b.jsx)("input",{type:"checkbox",checked:!1!==k.auto_schedule_voicemail,onChange:e=>v(t=>(0,a.A)((0,a.A)({},t),{},{auto_schedule_voicemail:e.target.checked})),className:"sr-only"}),(0,b.jsx)("div",{className:"w-11 h-6 rounded-full transition-colors ".concat(!1!==k.auto_schedule_voicemail?"bg-green-500":"bg-slate-300"),children:(0,b.jsx)("div",{className:"w-5 h-5 bg-white dark:bg-slate-800 rounded-full shadow transform transition-transform mt-0.5 ".concat(!1!==k.auto_schedule_voicemail?"translate-x-5 ml-0.5":"translate-x-0.5")})})]})]})]}),(0,b.jsx)("button",{onClick:async()=>{g(!0);try{await m.default.updateLeadPreferences({lead_types:k.lead_types,states:k.states,cities:k.cities.split(",").map(e=>e.trim()).filter(Boolean)}),await m.default.updateProfile({preferred_call_time:k.preferred_call_time,ideal_client_description:k.ideal_client_description,auto_schedule_voicemail:!1!==k.auto_schedule_voicemail}),x.A.success("Preferences saved \u2014 your lead queue will reflect these filters")}catch(e){x.A.error(e.message)}g(!1)},disabled:f,"data-testid":"preferences-save-btn",className:"w-full py-3 bg-green-600 text-white text-sm font-medium rounded-xl hover:bg-green-700 disabled:opacity-50 flex items-center justify-center gap-2",children:f?"
1Saving...":(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(c.A,{size:16})," Save Preferences"]})})]})}},1742(e,t,s){s.d(t,{A:()=>a});const a=(0,s(9870).A)("save",[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]])}}]);
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.