PageSourceSearch

https://kingsdogdaycare.replit.app/assets/WizardLeadsPage-Bi6R8WCN.js

js kingsdogdaycare.replit.app collected 2026-10-03 03:55:55 UTC 13,022 bytes, 16 lines download raw bytes

1import{y as f,c as A,j as e,$ as K,ac as R,ad as C,E as o,F as m,a1 as O,as as Q,R as _,aq as h,a8 as U,a9 as W,a2 as P,U as G,Q as $,H}from"./index-BBYsJQph.js";import{S as D,f as S,o as B}from"./wizardData-DUSx0TdS.js";/**
2 * @license lucide-react v0.453.0 - ISC
3 *
4 * This source code is licensed under the ISC license.
5 * See the LICENSE file in the root directory of this source tree.
6 */const I=f("MousePointerClick",[["path",{d:"M14 4.1 12 6",key:"ita8i4"}],["path",{d:"m5.1 8-2.9-.8",key:"1go3kf"}],["path",{d:"m6 12-1.9 2",key:"mnht97"}],["path",{d:"M7.2 2.2 8 5.1",key:"1cfko1"}],["path",{d:"M9.037 9.69a.498.498 0 0 1 .653-.653l11 4.5a.5.5 0 0 1-.074.949l-4.349 1.041a1 1 0 0 0-.74.739l-1.04 4.35a.5.5 0 0 1-.95.074z",key:"s0h3yz"}]]);/**
7 * @license lucide-react v0.453.0 - ISC
8 *
9 * This source code is licensed under the ISC license.
10 * See the LICENSE file in the root directory of this source tree.
11 */const g=f("ShoppingBag",[["path",{d:"M6 2 3 6v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V6l-3-4Z",key:"hou9p0"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M16 10a4 4 0 0 1-8 0",key:"1ltviw"}]]);/**
12 * @license lucide-react v0.453.0 - ISC
13 *
14 * This source code is licensed under the ISC license.
15 * See the LICENSE file in the root directory of this source tree.
16 */const Z=f("TrendingDown",[["polyline",{points:"22 17 13.5 8.5 8.5 13.5 2 7",key:"1r2t7k"}],["polyline",{points:"16 17 22 17 22 11",key:"11uiuu"}]]);function q(i){const n=new Date(i);return isNaN(n.getTime())?"":n.toLocaleDateString("en-GB",{day:"numeric",month:"short"})}const L={size:"Dog size",dogname:"Dog's name",service:"Service choice",lead:"Contact details",result:"Recommendation",deadend:"Not small breed",dc_choice:"Trial or callback choice",dc_callback:"Callback details form",callback_done:"Callback confirmed"};function z(i){var n;return L[i]?L[i]:((n=S(i))==null?void 0:n.question)??i}const V={daycare_callback:"Daycare callback (needs reply)",daycare_trial:"Daycare trial (start slow)",daycare_package_16:"16-Day Package",daycare_regular:"Regular days",daycare_flexible:"Flexible daycare days",boarding_book:"Boarding (King's regular)",boarding_settling:"Boarding via trial day",grooming:"Grooming",papooch_gift:"Pet-A-Pooch gift card",papooch_group:"Pet-A-Pooch group enquiry",papooch_book:"Pet-A-Pooch booking",event_enquiry:"Event request (needs reply)",deadend_enquiry:"Website enquiry (needs reply)"};function J(i,n){var a;return i==="size"?((a=D.options.find(r=>r.value===n))==null?void 0:a.label)??String(n):Array.isArray(n)?n.map(r=>B(i,r)).join(", "):B(i,n)}function ee(){const{data:i,isLoading:n}=A({queryKey:["/api/admin/wizard-leads"]}),{data:a,isLoading:r}=A({queryKey:["/api/admin/wizard-funnel"]}),p=s=>{var c;return((c=a==null?void 0:a.totals.find(d=>d.event_type===s))==null?void 0:c.sessions)??0},M=p("screen_view"),E=p("complete"),j=s=>{var c,d;return((d=(c=a==null?void 0:a.conversions)==null?void 0:c.find(x=>x.screen===s))==null?void 0:d.sessions)??0};return e.jsxs("div",{className:"container mx-auto p-4 max-w-5xl",children:[e.jsx("div",{className:"mb-6 -ml-2",children:e.jsxs(K,{href:"/admin",className:"inline-flex items-center gap-2 px-4 py-2 text-sm font-medium text-[#4A3C3A] bg-white border border-[#8B4B3A]/20 rounded-lg hover:bg-[#8B4B3A]/5 hover:border-[#8B4B3A]/40 transition-all duration-200 shadow-sm","data-testid":"link-back-admin",children:[e.jsx(R,{className:"w-4 h-4"}),"Back to Dashboard"]})}),e.jsxs("div",{className:"flex items-center gap-3 mb-6",children:[e.jsx("div",{className:"p-2.5 rounded-full bg-[#cd8161]/15",children:e.jsx(C,{className:"h-6 w-6 text-[#cd8161]"})}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-lulo-clean uppercase tracking-tight text-[#4A3C3A]",children:"Fit Finder"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Quiz leads and drop-off funnel"})]})]}),e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-6 gap-4 mb-6",children:[e.jsx(o,{children:e.jsxs(m,{className:"pt-5 pb-4",children:[e.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground text-xs uppercase tracking-wide mb-1",children:[e.jsx(I,{className:"h-3.5 w-3.5"})," Started"]}),e.jsx("p",{className:"text-2xl font-bold text-[#4A3C3A]","data-testid":"stat-started",children:r?"–":M})]})}),e.jsx(o,{children:e.jsxs(m,{className:"pt-5 pb-4",children:[e.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground text-xs uppercase tracking-wide mb-1",children:[e.jsx(O,{className:"h-3.5 w-3.5"})," Completed"]}),e.jsx("p",{className:"text-2xl font-bold text-[#4A3C3A]","data-testid":"stat-completed",children:r?"–":E})]})}),e.jsx(o,{children:e.jsxs(m,{className:"pt-5 pb-4",children:[e.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground text-xs uppercase tracking-wide mb-1",children:[e.jsx(Q,{className:"h-3.5 w-3.5"})," Opened chat"]}),e.jsx("p",{className:"text-2xl font-bold text-[#4A3C3A]","data-testid":"stat-chat",children:r?"–":p("chat_open")})]})}),e.jsx(o,{children:e.jsxs(m,{className:"pt-5 pb-4",children:[e.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground text-xs uppercase tracking-wide mb-1",children:[e.jsx(_,{className:"h-3.5 w-3.5"})," Leads"]}),e.jsx("p",{className:"text-2xl font-bold text-[#4A3C3A]","data-testid":"stat-leads",children:r?"–":(a==null?void 0:a.leads)??
160})]})}),e.jsx(o,{children:e.jsxs(m,{className:"pt-5 pb-4",children:[e.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground text-xs uppercase tracking-wide mb-1",children:[e.jsx(h,{className:"h-3.5 w-3.5"})," Trial requested"]}),e.jsx("p",{className:"text-2xl font-bold text-[#4A3C3A]","data-testid":"stat-conversion-trial",children:r?"–":j("trial_request")})]})}),e.jsx(o,{children:e.jsxs(m,{className:"pt-5 pb-4",children:[e.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground text-xs uppercase tracking-wide mb-1",children:[e.jsx(g,{className:"h-3.5 w-3.5"})," Purchased"]}),e.jsx("p",{className:"text-2xl font-bold text-[#4A3C3A]","data-testid":"stat-conversion-purchase",children:r?"–":j("purchase")})]})})]}),e.jsx("p",{className:"text-xs text-muted-foreground -mt-3 mb-6",children:"Trial requested and Purchased count quiz sessions where the same device went on to that outcome within 7 days."}),e.jsxs(o,{className:"mb-8",children:[e.jsx(U,{className:"pb-3",children:e.jsxs(W,{className:"text-base flex items-center gap-2 text-[#4A3C3A]",children:[e.jsx(Z,{className:"h-4 w-4 text-[#cd8161]"}),"Screen-by-screen funnel"]})}),e.jsx(m,{children:r?e.jsx(P,{className:"h-5 w-5 animate-spin text-[#cd8161]"}):!a||a.screens.length===0?e.jsx("p",{className:"text-sm text-muted-foreground",children:"No wizard activity yet."}):e.jsx("div",{className:"space-y-2",children:a.screens.map(s=>{const c=Math.max(...a.screens.map(d=>d.sessions),1);return e.jsxs("div",{className:"flex items-center gap-3","data-testid":`funnel-row-${s.screen}`,children:[e.jsx("div",{className:"w-28 sm:w-56 shrink-0 text-sm text-[#4A3C3A] truncate",title:z(s.screen),children:z(s.screen)}),e.jsx("div",{className:"flex-1 h-5 bg-[#4A3C3A]/5 rounded overflow-hidden",children:e.jsx("div",{className:"h-full bg-[#cd8161]/70 rounded",style:{width:`${s.sessions/c*100}%`}})}),e.jsx("div",{className:"w-10 text-right text-sm font-medium text-[#4A3C3A]",children:s.sessions})]},s.screen)})})})]}),e.jsx("h2",{className:"text-lg font-semibold text-[#4A3C3A] mb-3",children:"Leads"}),n?e.jsx("div",{className:"flex justify-center py-10",children:e.jsx(P,{className:"h-6 w-6 animate-spin text-[#cd8161]"})}):!i||i.length===0?e.jsx(o,{children:e.jsx(m,{className:"py-10 text-center text-muted-foreground",children:"No completed quizzes yet. Leads will appear here as customers finish the Fit Finder."})}):e.jsx("div",{className:"space-y-4",children:i.map(s=>{var x,N,b,y,w,v;const c=s.recommendationKey.startsWith("daycare"),d=typeof((x=s.answers)==null?void 0:x.enquiry_phone)=="string"?s.answers.enquiry_phone:null;return e.jsx(o,{"data-testid":`card-lead-${s.id}`,className:c?"border-amber-300 bg-amber-50":void 0,children:e.jsxs(m,{className:"pt-5 pb-4",children:[e.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3 mb-3",children:[e.jsxs("div",{className:"flex items-center gap-4 flex-wrap",children:[e.jsxs("span",{className:"flex items-center gap-1.5 font-medium text-[#4A3C3A]",children:[e.jsx(h,{className:"h-4 w-4 text-[#cd8161]"}),s.dogName||"Unnamed dog"]}),s.ownerName&&e.jsxs("span",{className:"flex items-center gap-1.5 text-sm text-muted-foreground",children:[e.jsx(G,{className:"h-3.5 w-3.5"})," ",s.ownerName]}),s.email&&e.jsxs("a",{href:`mailto:${s.email}`,className:"flex items-center gap-1.5 text-sm text-[#cd8161] hover:underline",children:[e.jsx(_,{className:"h-3.5 w-3.5"})," ",s.email]}),d&&e.jsxs("a",{href:`tel:${d.replace(/[^+\d]/g,"")}`,className:"flex items-center gap-1.5 text-sm text-[#cd8161] hover:underline","data-testid":`link-lead-phone-${s.id}`,children:[e.jsx($,{className:"h-3.5 w-3.5"})," ",d]}),!s.email&&!d&&e.jsx("span",{className:"text-sm text-muted-foreground italic",children:"No contact details left"})]}),e.jsx("span",{className:"text-xs text-muted-foreground",children:new Date(s.createdAt).toLocaleDateString("en-GB",{day:"numeric",month:"short",year:"numeric",hour:"2-digit",minute:"2-digit"})})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2 mb-3",children:[e.jsxs("div",{className:`inline-flex items-center gap-1.5 rounded-full text-xs font-medium px-3 py-1 ${c?"bg-amber-100 text-amber-800":"bg-[#cd8161]/10 text-[#a05a3d]"}`,"data-testid":`badge-lead-recommendation-${s.id}`,children:[e.jsx(C,{className:"h-3 w-3"}),V[s.recommendationKey]??s.recommendationKey]}),s.recommendationKey==="daycare_callback"&&e.jsxs("div",{className:"inline-flex items-center gap-1.5 rounded-full bg-amber-500 text-white text-xs font-semibold px-3 py-1","data-testid":`badge-lead-callback-${s.id}`,children:[e.jsx($,{className:"h-3 w-3"}),"Wants a callback"]}),(((N=s.answers)==null?void 0:N.dc_papooch)==="yes"||((b=s.answers)==null?void 0:b.dc_papooch)==="tell_me_more")&&e.jsxs("div",{className:"inline-flex items-center gap-1.5 rounded-full bg-[#cd8161]/15 text-[#a05a3d] text-xs font-medium px-3 py-1","data-testid":`badge-lead-papooch-${s.id}`,children:[e.jsx(H,{className:"h-3 w-3"}),s.answers.dc_papooch==="yes"?"Pet-A-Pooch: yes please":"Pet-A-Pooch: wants details"]}
16),((y=s.conversions)==null?void 0:y.some(t=>t.kind==="purchase"))&&e.jsxs("div",{className:"inline-flex items-center gap-1.5 rounded-full bg-[#8BB381]/15 text-[#5c7052] text-xs font-medium px-3 py-1","data-testid":`badge-lead-purchase-${s.id}`,title:((w=s.conversions.find(t=>t.kind==="purchase"))==null?void 0:w.detail)??void 0,children:[e.jsx(g,{className:"h-3 w-3"}),"Purchased"]}),((v=s.conversions)==null?void 0:v.some(t=>t.kind==="trial_request"))&&e.jsxs("div",{className:"inline-flex items-center gap-1.5 rounded-full bg-[#8BB381]/15 text-[#5c7052] text-xs font-medium px-3 py-1","data-testid":`badge-lead-trial-${s.id}`,children:[e.jsx(h,{className:"h-3 w-3"}),"Trial requested"]}),(!s.conversions||s.conversions.length===0)&&(s.relatedConversions??[]).map((t,l)=>e.jsxs("div",{className:t.confidence==="email"?"inline-flex items-center gap-1.5 rounded-full bg-[#8BB381]/15 text-[#5c7052] text-xs font-medium px-3 py-1":"inline-flex items-center gap-1.5 rounded-full bg-amber-500/15 text-amber-700 text-xs font-medium px-3 py-1","data-testid":`badge-lead-related-${s.id}`,title:t.detail??void 0,children:[t.kind==="purchase"?e.jsx(g,{className:"h-3 w-3"}):e.jsx(h,{className:"h-3 w-3"}),t.confidence==="email"?"":"Possibly ",t.kind==="purchase"?t.confidence==="email"?"Purchased":"purchased":t.confidence==="email"?"Trial requested":"trial requested"," via another quiz",q(t.quizAt)?` on ${q(t.quizAt)}`:"",t.confidence==="name"?" (same dog name)":""]},`${t.kind}-${l}`)),(!s.conversions||s.conversions.length===0)&&(s.relatedConversions??[]).length===0&&e.jsx("div",{className:"inline-flex items-center gap-1.5 rounded-full bg-[#4A3C3A]/5 text-muted-foreground text-xs font-medium px-3 py-1","data-testid":`badge-lead-noconversion-${s.id}`,children:"No outcome yet"})]}),e.jsx("div",{className:"grid sm:grid-cols-2 gap-x-6 gap-y-1.5",children:Object.entries(s.answers??{}).map(([t,l])=>{const k=t==="size"?D:S(t);if(!k)return null;const u=J(t,l),T=t==="enquiry_phone"&&typeof l=="string"&&l.trim()!=="",F=typeof l=="string"&&/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(l.trim());return e.jsxs("div",{className:"text-sm",children:[e.jsxs("span",{className:"text-muted-foreground",children:[k.question," "]}),T?e.jsx("a",{href:`tel:${l.replace(/[^+\d]/g,"")}`,className:"text-[#cd8161] font-medium hover:underline","data-testid":`link-answer-phone-${s.id}`,children:u}):F?e.jsx("a",{href:`mailto:${l.trim()}`,className:"text-[#cd8161] font-medium hover:underline","data-testid":`link-answer-email-${s.id}`,children:u}):e.jsx("span",{className:"text-[#4A3C3A] font-medium",children:u})]},t)})})]})},s.id)})})]})}export{ee 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.