PageSourceSearch

https://sendunlimitedemail.com/sue/mod-ENN_U0h7.js

js sendunlimitedemail.com collected 2026-10-05 06:25:19 UTC 6,545 bytes, 1 lines download raw bytes

1import{k as A,r,j as e,B as f,U as R,ai as N}from"./edge-BOITG1XR.js";import{C as i,a as c,b as d,c as n,d as D}from"./mod-DgQ0OFXm.js";import"./mod-D625c86a.js";import{a as k}from"./mod-Zt9zCdX8.js";import{C as E}from"./mod-Dzi2dmtd.js";import{R as T}from"./mod-RPxq32x0.js";import{D as U}from"./mod-LfxHWGtW.js";import{T as v}from"./mod-Ddu2jsJM.js";import{D as P}from"./mod-ByZwUIgr.js";import{A as O}from"./mod-B1DNAhc5.js";import{A as $}from"./mod-CjTApOQE.js";const q=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"19",x2:"19",y1:"8",y2:"14",key:"1bvyxn"}],["line",{x1:"22",x2:"16",y1:"11",y2:"11",key:"1shjgl"}]],H=A("user-plus",q),W=()=>{const[t,o]=r.useState(null),[y,x]=r.useState(!0),[m,h]=r.useState(null),[u,b]=r.useState("30");r.useEffect(()=>{j()},[u]);const j=async()=>{try{x(!0),h(null);const s=await k.getCustomerSegments();o(s)}catch{o(null),h("Failed to load customer analytics. Please try again.")}finally{x(!1)}},l=({title:s,value:a,change:p,prefix:w="",suffix:C="",icon:L,color:S})=>{const g=p>=0;return e.jsx(i,{className:S,children:e.jsx(n,{className:"pt-6",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:s}),e.jsxs("p",{className:"text-3xl font-bold",children:[w,typeof a=="number"?a.toLocaleString():a,C]}),e.jsxs("div",{className:`flex items-center text-sm mt-1 ${g?"text-green-600":"text-red-600"}`,children:[g?e.jsx(O,{className:"w-4 h-4"}):e.jsx($,{className:"w-4 h-4"}),e.jsxs("span",{children:[Math.abs(p),"% vs last period"]})]})]}),e.jsx(L,{className:"w-12 h-12 text-muted-foreground/20"})]})})})};return y?e.jsx("div",{className:"p-8 text-center",children:"Loading customer analytics..."}):m||!t?e.jsxs("div",{className:"p-8 text-center",children:[e.jsx(E,{className:"w-12 h-12 text-red-400 mx-auto mb-4"}),e.jsx("p",{className:"text-lg font-semibold text-slate-700",children:m||"No analytics data available"}),e.jsxs(f,{onClick:j,className:"mt-4 bg-violet-600 hover:bg-violet-700",children:[e.jsx(T,{className:"w-4 h-4 mr-2"})," Retry"]})]}):e.jsxs("div",{className:"p-8",children:[e.jsxs("div",{className:"flex items-center justify-between mb-8",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-3xl font-bold",children:"Customer Analytics"}),e.jsx("p",{className:"text-muted-foreground",children:"Understand your customer base and behavior"})]}),e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsxs("select",{value:u,onChange:s=>b(s.target.value),className:"border rounded-md px-3 py-2",children:[e.jsx("option",{value:"7",children:"Last 7 days"}),e.jsx("option",{value:"30",children:"Last 30 days"}),e.jsx("option",{value:"90",children:"Last 90 days"}),e.jsx("option",{value:"365",children:"Last year"})]}),e.jsxs(f,{variant:"outline",children:[e.jsx(U,{className:"w-4 h-4 mr-2"}),"Export"]})]})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6 mb-8",children:[e.jsx(l,{title:"Total Customers",value:t?.totalCustomers?.current,change:t?.totalCustomers?.change,icon:R}),e.jsx(l,{title:"New Customers",value:t?.newCustomers?.current,change:t?.newCustomers?.change,icon:H}),e.jsx(l,{title:"Returning Rate",value:t?.returningRate?.current,change:t?.returningRate?.change,suffix:"%",icon:v}),e.jsx(l,{title:"Avg Lifetime Value",value:t?.avgLifetimeValue?.current?.toFixed(2),change:t?.avgLifetimeValue?.change,prefix:"AED ",icon:P})]}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-8 mb-8",children:[e.jsxs(i,{children:[e.jsx(c,{children:e.jsxs(d,{className:"flex items-center gap-2",children:[e.jsx(N,{className:"w-5 h-5"}),"Customer Segments"]})}),e.jsx(n,{children:e.jsx("div",{className:"space-y-4",children:t?.segments?.map((s,a)=>e.jsxs("div",{className:"flex items-center gap-4 p-3 bg-muted rounded-lg",children:[e.jsx("div",{className:`w-3 h-3 rounded-full ${s.color}`}),e.jsxs("div",{className:"flex-1",children:[e.jsx("p",{className:"font-medium",children:s.name}),e.jsxs("p",{className:"text-sm text-muted-foreground",children:[s.count.toLocaleStr
1ing()," customers"]})]}),e.jsxs("div",{className:"text-right",children:[e.jsxs("p",{className:"font-bold",children:["AED ",s.revenue.toLocaleString()]}),e.jsxs("p",{className:"text-sm text-muted-foreground",children:[s.avgOrders," avg orders"]})]})]},a))})})]}),e.jsxs(i,{children:[e.jsx(c,{children:e.jsxs(d,{className:"flex items-center gap-2",children:[e.jsx(v,{className:"w-5 h-5"}),"Acquisition Channels"]})}),e.jsx(n,{children:e.jsx("div",{className:"space-y-4",children:t?.acquisitionChannels?.map((s,a)=>e.jsxs("div",{children:[e.jsxs("div",{className:"flex justify-between text-sm mb-1",children:[e.jsx("span",{children:s.channel}),e.jsxs("span",{className:"font-medium",children:[s.customers.toLocaleString()," (",s.percentage,"%)"]})]}),e.jsx("div",{className:"w-full bg-gray-200 rounded-full h-2",children:e.jsx("div",{className:"bg-primary h-2 rounded-full",style:{width:`${s.percentage}%`}})})]},a))})})]})]}),e.jsxs(i,{children:[e.jsxs(c,{children:[e.jsxs(d,{className:"flex items-center gap-2",children:[e.jsx(N,{className:"w-5 h-5 text-yellow-500"}),"Top Customers"]}),e.jsx(D,{children:"Highest value customers"})]}),e.jsx(n,{children:e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b",children:[e.jsx("th",{className:"text-left py-3 px-4",children:"Customer"}),e.jsx("th",{className:"text-right py-3 px-4",children:"Orders"}),e.jsx("th",{className:"text-right py-3 px-4",children:"Total Spent"}),e.jsx("th",{className:"text-right py-3 px-4",children:"Last Order"})]})}),e.jsx("tbody",{children:t?.topCustomers?.map((s,a)=>e.jsxs("tr",{className:"border-b last:border-0",children:[e.jsx("td",{className:"py-3 px-4",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-8 h-8 bg-primary/10 rounded-full flex items-center justify-center",children:s.name.charAt(0)}),e.jsxs("div",{children:[e.jsx("p",{className:"font-medium",children:s.name}),e.jsx("p",{className:"text-sm text-muted-foreground",children:s.email})]})]})}),e.jsx("td",{className:"text-right py-3 px-4",children:s.orders}),e.jsxs("td",{className:"text-right py-3 px-4 font-bold",children:["$",s.spent.toLocaleString()]}),e.jsx("td",{className:"text-right py-3 px-4 text-muted-foreground",children:s.lastOrder})]},a))})]})})})]})]})};export{W 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.