1import{g as u,r as i,j as e,L as f,q as y}from"./index-_aijvlUq.js";import{P as j}from"./PageHeader-DCofr6qo.js";import{u as b}from"./useNotificationStore-IfNXEQfW.js";import{E as N}from"./EmptyState-CPGKooqj.js";import"./notifications-B26coFA7.js";const v={email:"Email",sms:"SMS",in_app:"In-App"},S={sent:"bg-green-100 text-green-800",failed:"bg-red-100 text-red-800",skipped:"bg-gray-100 text-gray-600"};function C(){const d=u(),{history:x,loading:p,loadHistory:m}=b(),[a,n]=i.useState(1),[r,g]=i.useState(""),[l,h]=i.useState("");i.useEffect(()=>{m(a)},[a]);const{entries:o=[],pagination:s}=x,c=o.filter(t=>!(r&&t.channel!==r||l&&t.status!==l));return e.jsxs("div",{className:"px-4 pt-3 md:px-0 md:pt-0",children:[!d&&e.jsx(j,{title:"Notification History",subtitle:"View your past notifications",breadcrumbs:[{label:"Home",to:"/"},{label:"Account"},{label:"Notifications",to:"/account/notifications"},{label:"History"}],actions:e.jsx(f,{to:"/account/notifications",className:"text-sm text-brand-primary hover:underline",children:"Preferences"})}),e.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[e.jsxs("select",{value:r,onChange:t=>g(t.target.value),className:"text-sm border border-gray-300 rounded-lg px-3 py-1.5",children:[e.jsx("option",{value:"",children:"All Channels"}),e.jsx("option",{value:"email",children:"Email"}),e.jsx("option",{value:"sms",children:"SMS"}),e.jsx("option",{value:"in_app",children:"In-App"})]}),e.jsxs("select",{value:l,onChange:t=>h(t.target.value),className:"text-sm border border-gray-300 rounded-lg px-3 py-1.5",children:[e.jsx("option",{value:"",children:"All Statuses"}),e.jsx("option",{value:"sent",children:"Sent"}),e.jsx("option",{value:"failed",children:"Failed"}),e.jsx("option",{value:"skipped",children:"Skipped"})]})]}),p&&o.length===0?e.jsx("p",{className:"text-gray-500 text-sm",children:"Loading history..."}):c.length===0?e.jsx(N,{size:"compact",title:"No notifications found."}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"bg-white rounded-lg border border-gray-200 overflow-hidden",children:e.jsxs("table",{className:"min-w-full divide-y divide-gray-200",children:[e.jsx("thead",{className:"bg-gray-50",children:e.jsxs("tr",{children:[e.jsx("th",{className:"px-4 py-3 text-left text-xs font-semibold text-gray-500 uppercase tracking-wider",children:"Time"}),e.jsx("th",{className:"px-4 py-3 text-left text-xs font-semibold text-gray-500 uppercase tracking-wider",children:"Event"}),e.jsx("th",{className:"px-4 py-3 text-center text-xs font-semibold text-gray-500 uppercase tracking-wider w-20",children:"Channel"}),e.jsx("th",{className:"px-4 py-3 text-center text-xs font-semibold text-gray-500 uppercase tracking-wider w-20",children:"Status"})]})}),e.jsx("tbody",{className:"divide-y divide-gray-100",children:c.map(t=>e.jsxs("tr",{children:[e.jsx("td",{className:"px-4 py-3 text-sm text-gray-600 whitespace-nowrap",children:y(t.deliveredAt)}),e.jsx("td",{className:"px-4 py-3 text-sm text-gray-900",children:t.eventKey}),e.jsx("td",{className:"px-4 py-3 text-center",children:e.jsx("span",{className:"text-xs font-medium text-gray-600",children:v[t.channel]||t.channel})}),e.jsx("td",{className:"px-4 py-3 text-center",children:e.jsx("span",{className:`inline-flex px-2 py-0.5 rounded-full text-xs font-medium ${S[t.status]||"bg-gray-100 text-gray-600"}`,children:t.status})})]},t.id))})]})}),s&&s.totalPages>1&&e.jsxs("div",{className:"mt-4 flex items-center gap-2 justify-center",children:[e.jsx("button",{onClick:()=>n(t=>Math.max(1,t-1)),disabled:a<=1,className:"px-3 py-1 text-sm border rounded-lg disabled:opacity-40",children:"Previous"}),e.jsxs("span",{className:"text-sm text-gray-600",children:["Page ",s.page," of ",s.totalPages]}),e.jsx("button",{onClick:()=>n(t=>Math.min(s.totalPages,t+1)),disabled:a>=s.totalPages,className:"px-3 py-1 text-sm border rounded-lg disabled:opacity-40",children:"Next"})]})]})]})}export{C as NotificationHistoryPage};
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.