PageSourceSearch

https://tappin.ai/static/js/1736.f2350540.chunk.js

js tappin.ai collected 2026-10-05 12:43:41 UTC 13,448 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunkfrontend=self.webpackChunkfrontend||[]).push([[1736],{298(e,t,a){a.d(t,{A:()=>n});a(9950);var l=a(5924),s=a(6987),r=a(4414);function n(e){let{onRetry:t,title:a="Could not load this data",message:n="The server had a problem \u2014 your data is safe. This is temporary.",compact:o=!1}=e;return(0,r.jsxs)("div",{"data-testid":"fetch-error",role:"alert",className:"flex flex-col items-center justify-center text-center ".concat(o?"p-6":"p-12 min-h-[200px]"),children:[(0,r.jsx)("div",{className:"w-12 h-12 rounded-full bg-red-50 dark:bg-red-950/40 flex items-center justify-center mb-3",children:(0,r.jsx)(l.A,{size:22,className:"text-red-500"})}),(0,r.jsx)("h3",{className:"font-medium text-slate-800 dark:text-slate-100 mb-1",children:a}),(0,r.jsx)("p",{className:"text-sm text-slate-500 dark:text-slate-400 mb-4 max-w-sm",children:n}),t&&(0,r.jsxs)("button",{type:"button",onClick:t,className:"flex items-center gap-1.5 px-4 py-2 text-sm font-medium bg-kw-red text-white rounded-lg hover:bg-red-700",children:[(0,r.jsx)(s.A,{size:14})," Retry"]})]})}},1736(e,t,a){a.r(t),a.d(t,{SCHEDULE_LOAD_FAILED:()=>k,default:()=>C,formatDate:()=>S,humanizeScheduleType:()=>w,resolveTypeConfig:()=>A});var l=a(9379),s=a(7224),r=a(9950),n=a(2828),o=a(9201),d=a(6311),i=a(7737),c=a(388),u=a(1855),x=a(1878),m=a(3971),b=a(2607),h=a(6479),g=a(9401),p=a(326),f=a(298),v=a(4162),j=a(381),y=a(4414);const k="Something went wrong loading your schedule. Your items are safe \u2014 try again, and report it if it keeps happening.",N={callback:{label:"Callback",icon:m.A,iconWrap:"bg-blue-100",icon_:"text-blue-600",badge:"bg-blue-100 text-blue-700"},appointment:{label:"Appointment",icon:u.A,iconWrap:"bg-green-100",icon_:"text-green-600",badge:"bg-green-100 text-green-700"},follow_up:{label:"Follow Up",icon:i.A,iconWrap:"bg-amber-100",icon_:"text-amber-600",badge:"bg-amber-100 text-amber-700"},meeting:{label:"Meeting",icon:o.A,iconWrap:"bg-purple-100",icon_:"text-purple-600",badge:"bg-purple-100 text-purple-700"},lob_postcard:{label:"Postcard",icon:c.A,iconWrap:"bg-rose-100",icon_:"text-rose-600",badge:"bg-rose-100 text-rose-700"},email:{label:"Email",icon:c.A,iconWrap:"bg-indigo-100",icon_:"text-indigo-600",badge:"bg-indigo-100 text-indigo-700"},text:{label:"Text",icon:x.A,iconWrap:"bg-teal-100",icon_:"text-teal-600",badge:"bg-teal-100 text-teal-700"},call:{label:"Call",icon:m.A,iconWrap:"bg-blue-100",icon_:"text-blue-600",badge:"bg-blue-100 text-blue-700"}};function w(e){return(String(e||"scheduled").replace(/^lob_/,"").replace(/_/g," ").trim()||"scheduled").replace(/\b\w/g,e=>e.toUpperCase())}function A(e){return N[e]?N[e]:{label:w(e),icon:i.A,iconWrap:"bg-slate-100",icon_:"text-slate-500",badge:"bg-slate-100 text-slate-600"}}const _={all:{activeBorder:"border-slate-500",activeBg:"bg-slate-50",count:"text-slate-600"},overdue:{activeBorder:"border-red-500",activeBg:"bg-red-50",count:"text-red-600"},today:{activeBorder:"border-blue-500",activeBg:"bg-blue-50",count:"text-blue-600"},upcoming:{activeBorder:"border-green-500",activeBg:"bg-green-50",count:"text-green-600"}};function S(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!e)return"";const a=new Date(e);if(Number.isNaN(a.getTime()))return"time not readable";const l=new Date,s=e=>new Date(e.getFullYear(),e.getMonth(),e.getDate()),r=Math.round((s(a)-s(l))/864e5);return 0===r?"Today at ".concat(a.toLocaleTimeString([],{hour:"numeric",minute:"2-digit"})):1===r?"Tomorrow at ".concat(a.toLocaleTimeString([],{hour:"numeric",minute:"2-digit"})):-1===r?"Yesterday at ".concat(a.toLocaleTimeString([],{hour:"numeric",minute:"2-digit"})):r<-1&&!t?"".concat(Math.abs(r)," days overdue"):a.toLocaleDateString([],{weekday:"short",month:"short",day:"numeric"})+" at ".concat(a.toLocaleTimeString([],{hour:"numeric",minute:"2-digit"}))}function C(){var e,t;const a=(0,j.d)(),[i,c]=(0,r.useState)(null),[u,x]=(0,r.useState)(!0),[m,N]=(0,r.useState)(null),[w,C]=(0,r.useState)(()=>!("undefined"===typeof sessionStorage||!sessionStorage.getItem("schedule:autoAdd"))&&(sessionStorage.removeItem("schedule:autoAdd"),!0)),[T,D]=(0,r.useState)({title:"",type:"follow_up",scheduled_at:"",notes:""}),[z,W]=(0,r.useState)("all"),[B,I]=(0,r.useState)(null);(0,r.useEffect)(()=>{K()},[]);const K=async()=>{x(!0),N(null);try{const e=await g.default.getSchedule();c(e)}catch(e){console.error(e),N(e)}x(!1)},L=async e=>{if(B===e)try{await g.default.deleteScheduleItem(e),a.success("Event deleted"),I(null),K()}catch(t){v.A.error((0,p.f_)(t,"That didn't go through. Please try again."))}else I(e)};if(u)return(0,y.jsx)(s.A,{});const M=(null===i||void 0===i?void 0:i.items)||[],E="all"===z?M:"overdue"===z?(null===i||void 0===i?void 0:i.overdue)||[]:"today"===z?(null===i||void 0===i?void 0:i.today)||[]:(null===i||void 0===i?void 0:i.upcoming)||[];return(0,y.jsxs)("div",{className:"flex-1","data-testid":"schedule-view",children:[(0,y.jsxs)("div",{className:"flex flex-wrap items-center justify-between mb-6 gap-3",children:[(0,y.jsxs)("div",{children:[(0,y.jsxs)("h1",{className:"font-heading font-bold text-2xl text-kw-dark dark:text-slate-100 flex items-center gap-2",children:[(0,y.jsx)(o.A,{size:24,className:"text-blue-600"})," Schedule"]}),(0,y.jsx)("p",{className:"text-slate-500 dark:text-slate-400 text-sm",children:"Callbacks, appointments, and follow-ups \u2014 auto-generated from your calls"})]}),(0,y.jsxs)("button",{onClick:()=>C(!0),"data-testid":"add-schedule-btn",className:"flex items-center gap-2 px-4 py-2.5 bg-blue-600 text-white text-sm font-medium rounded-lg hover:bg-blue-700",children:[(0,y.jsx)(b.A,{size:16})," Add Item"]})]}),(0,y.jsx)("div",{className:"grid grid-cols-4 gap-3 mb-6",children:[{label:"Total",count:M.length,filterKey:"all"},{label:"Overdue",count:(null===i||void 0===i?void 0:i.overdue_count)||0,filterKey:"overdue"},{label:"Today",count:(null===i||void 0===i||null===(e=i.today)||void 0===e?void 0:e.length)||0,filterKey:"today"},{label:"Upcoming",count:(null===i||void 0===i||null===(t=i.upcoming)||void 0===t?void 0:t.length)||0,filterKey:"upcoming"}].map(e=>m?(0,l.A)((0,l.A)({},e),{},{count:"\u2014"}):e).map(e=>{const t=_[e.filterKey]||_.all,a=z===e.filterKey;return(0,y.jsxs)("button",{onClick:()=>W(e.filterKey),"aria-pressed":a,className:"p-3 rounded-xl border-2 text-center transition-all ".concat(a?"".concat(t.activeBorder," ").concat(t.activeBg):"border-slate-200 dark:border-slate-700 hover:border-slate-300"),children:[(0,y.jsx)("p",{className:"text-xl font-bold ".concat(t.count),children:e.count}),(0,y.jsx)("p",{className:"text-xs text-slate-500 dark:text-slate-400",children:e.label})]},e.filterKey)})}),(0,y.jsxs)("div",{className:"space-y-2",children:[m&&(0,y.jsx)(f.A,{onRetry:K,title:"Could not load your schedule",message:(0,p.f_)(m,k)}),!m&&0===E.length&&(0,y.jsxs)("div",{className:"text-center py-12 bg-white dark:bg-slate-800 rounded-xl border border-slate-100 dar
1k:border-slate-700",children:[(0,y.jsx)(o.A,{size:40,className:"mx-auto mb-3 text-slate-300"}),(0,y.jsxs)("p",{className:"text-slate-500 dark:text-slate-400",children:["No ","all"===z?"":z+" ","items"]}),(0,y.jsx)("p",{className:"text-xs text-slate-400 mt-1",children:"Schedule items are auto-created when you log call outcomes"})]}),!m&&E.map(e=>{const t=A(e.type),a=t.icon,l=e.scheduled_at&&new Date(e.scheduled_at)<new Date&&"completed"!==e.status;return(0,y.jsxs)("div",{"data-testid":"schedule-item-".concat(e.schedule_id),className:"bg-white dark:bg-slate-800 rounded-xl border p-4 flex items-center gap-4 transition-all hover:shadow-sm ".concat(l?"border-red-200 bg-red-50/50":"border-slate-100 dark:border-slate-700"),children:[(0,y.jsx)("div",{className:"w-10 h-10 rounded-xl ".concat(t.iconWrap," flex items-center justify-center flex-shrink-0"),children:(0,y.jsx)(a,{size:18,className:t.icon_})}),(0,y.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,y.jsxs)("div",{className:"flex items-center gap-2",children:[(0,y.jsx)("p",{className:"font-medium text-sm text-kw-dark dark:text-slate-100 truncate",children:e.title}),(0,y.jsx)("span",{className:"px-2 py-0.5 rounded text-[10px] font-medium ".concat(t.badge),children:t.label}),e.auto_generated&&(0,y.jsx)("span",{className:"px-1.5 py-0.5 rounded text-[10px] bg-slate-100 dark:bg-slate-800 text-slate-500 dark:text-slate-400",children:"Auto"})]}),(0,y.jsxs)("div",{className:"flex items-center gap-3 mt-1",children:[(0,y.jsxs)("span",{className:"text-xs ".concat(l?"text-red-600 font-medium":"text-slate-500 dark:text-slate-400"),children:[l&&(0,y.jsx)(n.A,{size:10,className:"inline mr-1"}),S(e.scheduled_at,"completed"===e.status)]}),e.lead_name&&(0,y.jsx)("span",{className:"text-xs text-slate-400",children:e.lead_name}),e.lead_phone&&(0,y.jsx)("span",{className:"text-xs text-slate-400 font-mono",children:e.lead_phone})]}),e.notes&&(0,y.jsx)("p",{className:"text-xs text-slate-400 mt-0.5 truncate",children:e.notes})]}),(0,y.jsxs)("div",{className:"flex items-center gap-1 flex-shrink-0",children:[(0,y.jsx)("button",{onClick:()=>(async e=>{try{await g.default.updateScheduleItem(e,{status:"completed"}),v.A.success("Marked as complete"),K()}catch(t){v.A.error((0,p.f_)(t,"That didn't go through. Please try again."))}})(e.schedule_id),title:"Mark complete",className:"p-2 text-green-500 hover:bg-green-50 rounded-lg transition-colors",children:(0,y.jsx)(d.A,{size:16})}),B===e.schedule_id?(0,y.jsxs)("div",{className:"flex items-center gap-1",children:[(0,y.jsx)("span",{className:"text-xs text-red-600 whitespace-nowrap",children:"Delete this event?"}),(0,y.jsx)("button",{onClick:()=>L(e.schedule_id),title:"Confirm delete",className:"px-2 py-1 text-xs text-white bg-red-500 rounded hover:bg-red-600 transition-colors",children:"Confirm"}),(0,y.jsx)("button",{onClick:()=>I(null),title:"Cancel",className:"px-2 py-1 text-xs text-slate-500 dark:text-slate-400 bg-slate-100 dark:bg-slate-800 rounded hover:bg-slate-200 transition-colors",children:"Cancel"})]}):(0,y.jsx)("button",{onClick:()=>L(e.schedule_id),title:"Remove",className:"p-2 text-slate-400 hover:bg-slate-50 rounded-lg transition-colors",children:(0,y.jsx)(h.A,{size:14})})]})]},e.schedule_id)})]}),w&&(0,y.jsx)("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:(0,y.jsxs)("div",{className:"bg-white dark:bg-slate-800 rounded-xl shadow-2xl w-full max-w-md p-6",children:[(0,y.jsx)("h3",{className:"font-semibold text-lg text-kw-dark dark:text-slate-100 mb-4",children:"Add Schedule Item"}),(0,y.jsxs)("form",{onSubmit:async e=>{if(e.preventDefault(),!T.scheduled_at)return void v.A.error("Pick a date & time first.");const t=new Date(T.scheduled_at);if(isNaN(t.getTime()))v.A.error("That date & time looks invalid \u2014 please re-enter it.");else try{await g.default.createScheduleItem((0,l.A)((0,l.A)({},T),{},{scheduled_at:t.toISOString()})),C(!1),D({title:"",type:"follow_up",scheduled_at:"",notes:""}),K(),v.A.success("Added to your schedule.")}catch(e){v.A.error((0,p.f_)(e,"That didn't go through. Please try again."))}},className:"space-y-4",children:[(0,y.jsxs)("div",{children:[(0,y.jsx)("label",{className:"block text-sm font-medium text-slate-700 dark:text-slate-200 mb-1",children:"Type"}
1),(0,y.jsxs)("select",{value:T.type,onChange:e=>D(t=>(0,l.A)((0,l.A)({},t),{},{type: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",children:[(0,y.jsx)("option",{value:"callback",children:"Callback"}),(0,y.jsx)("option",{value:"appointment",children:"Appointment"}),(0,y.jsx)("option",{value:"follow_up",children:"Follow Up"}),(0,y.jsx)("option",{value:"meeting",children:"Meeting"})]})]}),(0,y.jsxs)("div",{children:[(0,y.jsx)("label",{className:"block text-sm font-medium text-slate-700 dark:text-slate-200 mb-1",children:"Title"}),(0,y.jsx)("input",{type:"text",required:!0,value:T.title,onChange:e=>D(t=>(0,l.A)((0,l.A)({},t),{},{title: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:"Call back John about property viewing"})]}),(0,y.jsxs)("div",{children:[(0,y.jsx)("label",{className:"block text-sm font-medium text-slate-700 dark:text-slate-200 mb-1",children:"When"}),(0,y.jsx)("input",{type:"datetime-local",required:!0,value:T.scheduled_at,onChange:e=>D(t=>(0,l.A)((0,l.A)({},t),{},{scheduled_at: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"})]}),(0,y.jsxs)("div",{children:[(0,y.jsx)("label",{className:"block text-sm font-medium text-slate-700 dark:text-slate-200 mb-1",children:"Notes (optional)"}),(0,y.jsx)("textarea",{value:T.notes,onChange:e=>D(t=>(0,l.A)((0,l.A)({},t),{},{notes: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 resize-none",rows:2,placeholder:"Any details..."})]}),(0,y.jsxs)("div",{className:"flex gap-3",children:[(0,y.jsx)("button",{type:"button",onClick:()=>C(!1),className:"flex-1 py-2.5 border border-slate-200 dark:border-slate-700 rounded-lg text-sm font-medium hover:bg-slate-50",children:"Cancel"}),(0,y.jsx)("button",{type:"submit",className:"flex-1 py-2.5 bg-blue-600 text-white rounded-lg text-sm font-medium hover:bg-blue-700",children:"Add to Schedule"})]})]})]})})]})}}}]);

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.