PageSourceSearch

https://sendunlimitedemail.com/sue/mod-u-vt6FcD.js

js sendunlimitedemail.com collected 2026-10-05 06:24:16 UTC 5,042 bytes, 1 lines download raw bytes

1import{k as N,e as i,r as m,t as r,j as e,n as x,B as h,o as A,T as _,P as M}from"./edge-BOITG1XR.js";import{C as p,c as g}from"./mod-DgQ0OFXm.js";import{B as S}from"./mod-D625c86a.js";import{T as R}from"./mod-BuHkwEt_.js";import{S as T}from"./mod-CnFQ395x.js";import{I as $}from"./mod-CIBNvfiF.js";import{M as B}from"./mod-CKTOf4qU.js";import{H as D}from"./mod-DMECmUvq.js";import{G as L}from"./mod-CZLdCikm.js";import{T as P}from"./mod-CFOXB00Z.js";import{S as q}from"./mod-B2Tl8dXI.js";const F=[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M17 17H4a1 1 0 0 1-.74-1.673C4.59 13.956 6 12.499 6 8a6 6 0 0 1 .258-1.742",key:"178tsu"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M8.668 3.01A6 6 0 0 1 18 8c0 2.687.77 4.653 1.707 6.05",key:"1hqiys"}]],I=N("bell-off",F);const U=[["path",{d:"M18 6 7 17l-5-5",key:"116fxf"}],["path",{d:"m22 10-7.5 7.5L13 16",key:"ke71qq"}]],E=N("check-check",U),n={getAll:(t={})=>i.get("/notifications",{params:t}),getUnread:(t={})=>i.get("/notifications",{params:{...t,unread:1}}),getUnreadCount:()=>i.get("/notifications/unread-count"),markAsRead:t=>i.put(`/notifications/${t}/read`),markAllAsRead:()=>i.post("/notifications/mark-all-read"),delete:t=>i.delete(`/notifications/${t}`),registerPushToken:(t,c)=>Promise.resolve({data:{registered:!1}})},Z=()=>{const[t,c]=m.useState([]),[j,f]=m.useState(!0),[u,d]=m.useState(0);m.useEffect(()=>{w()},[]);const w=async()=>{try{f(!0);const a=await n.getAll();c(a?.data||a||[]);const s=await n.getUnreadCount();d(s?.count||0)}catch{c([]),d(0),r.error("Failed to load notifications")}finally{f(!1)}},k=a=>({order:e.jsx(M,{className:"w-5 h-5 text-blue-500"}),cart:e.jsx(q,{className:"w-5 h-5 text-green-500"}),promo:e.jsx(P,{className:"w-5 h-5 text-purple-500"}),gift:e.jsx(L,{className:"w-5 h-5 text-pink-500"}),wishlist:e.jsx(D,{className:"w-5 h-5 text-red-500"}),message:e.jsx(B,{className:"w-5 h-5 text-cyan-500"}),warning:e.jsx(_,{className:"w-5 h-5 text-yellow-500"}),info:e.jsx($,{className:"w-5 h-5 text-gray-500"}),review:e.jsx(T,{className:"w-5 h-5 text-orange-500"}),price_alert:e.jsx(x,{className:"w-5 h-5 text-green-600"})})[a]||e.jsx(x,{className:"w-5 h-5 text-gray-400"}),y=async a=>{try{await n.markAsRead(a),c(s=>s.map(o=>o.id===a?{...o,is_read:!0}:o)),d(s=>Math.max(0,s-1)),r.success("Marked as read")}catch{r.error("Failed to mark as read")}},v=async()=>{try{await n.markAllAsRead(),c(a=>a.map(s=>({...s,is_read:!0}))),d(0),r.success("All notifications marked as read")}catch{r.error("Failed to mark all as read")}},b=async a=>{try{await n.delete(a),c(s=>s.filter(o=>o.id!==a)),r.success("Notification deleted")}catch{r.error("Failed to delete notification")}},C=a=>{const s=new Date(a),l=new Date-s;return l<6e4?"Just now":l<36e5?`${Math.floor(l/6e4)}m ago`:l<864e5?`${Math.floor(l/36e5)}h ago`:s.toLocaleDateString()};return j?e.jsx("div",{className:"container mx-auto px-4 py-8 text-center",children:"Loading notifications..."}):e.jsxs("div",{className:"container mx-auto px-4 py-8 max-w-3xl",children:[e.jsxs("div",{className:"flex items-center justify-between mb-8",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(x,{className:"w-8 h-8 text-primary"}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-3xl font-bold",children:"Notifications"}),u>0&&e.jsxs("p",{className:"text-sm text-muted-foreground",children:[u," unread"]})]})]}),t.some(a=>!a.is_read)&&e.jsxs(h,{variant:"outline",onClick:v,children:[e.jsx(E,{className:"w-4 h-4 mr-2"}),"Mark All Read"]})]}),t.length>0?e.jsx("div",{className:"space-y-3",children:t.map(a=>e.jsx(p,{className:`transition-colors ${a.is_read?"":"bg-blue-50 border-blue-200"}`,children:e.jsx(g,{className:"p-4",children:e.jsxs("div",{className:"flex items-start gap-4",children:[e.jsx("div",{className:"p-2 bg-gray-100 rounded-full flex-shrink-0",children:k(a.type)}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx("h3",{className:`font-medium ${a.is_read?"":"font-bold"}`,children:a.title}),!a.is_read&&e.jsx(S,{variant:"secondary",className:"text-xs bg-blue-500 text-white",children:"New"})]}),e.jsx("p",{className:"text-sm text-muted-foreground",children:a.message}),e.jsx("p",{className:"text-xs text-gray-400 mt-1",children:C(a.created_at)})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[!a.is_read&&e.jsx(h,{variant:"ghost",size:"sm",onClick:()=>y(a.id),title:"Mark as read",children:e.jsx(A,{className:"w-4 h-4"})}),e.jsx(h,{variant:"ghost",size:"sm",onClick:()=>b(a.id),className:"text-red-500 hover:text-red-600 hover:bg-red-50",title:"Delete",children:e.jsx(R,{className:"w-4 h-4"})})]})]})})},a.id))}):e.jsx(p,{className:"text-center py-16",children:e.jsxs(g,{children:[e.jsx(I,{className:"w-16 h-16 text-gray-300 mx-auto mb-4"}),e.jsx("h3",{className:"text-xl font-bold mb-2",children:"No Notifications"}),e.jsx("p",{className:"text-muted-foreground",children:"You're all caught up! Check back later for updates."})]})})]})};export{Z 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.