PageSourceSearch

https://cravour-b79bf.web.app/assets/NotificationCenter-CVaaND9H.js

js cravour-b79bf.web.app collected 2026-10-03 12:21:20 UTC 9,904 bytes, 2 lines download raw bytes

1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/fcmClientService-CIETrQcU.js","assets/logger-DNCEJ7cP.js","assets/export-vendor-D0rfNu4F.js","assets/firebase-tt2GNrVH.js","assets/firebase-analytics-7MpksIkS.js","assets/firebase-vendor-Cixypy3B.js","assets/firebase-auth-DiDDPGpW.js","assets/notificationService-BNvfXc9A.js","assets/api-D6UOnPC0.js"])))=>i.map(i=>d[i]);
2import{a as S}from"./rolldown-runtime-DS2seoW7.js";import{R as z,Tn as P,an as C,b as L,bn as N,hn as T,j as R,jn as D,kn as $,n as F,t as w}from"./icons-5GB4hPp2.js";import{a as u}from"./export-vendor-D0rfNu4F.js";import{n as I,r as M,t as m}from"./motion-vendor-RV0KhbdN.js";import{addNotification as q,clearAllNotifications as U,getStoredNotifications as d,markAllNotificationsRead as V}from"./notificationService-BNvfXc9A.js";var i=S(D(),1),e=M(),X=({isOpen:x,onClose:s})=>{const[p,f]=(0,i.useState)(d),[l,k]=(0,i.useState)("all"),[b,h]=(0,i.useState)(()=>typeof window<"u"&&"Notification"in window?Notification.permission:"unsupported"),[y,j]=(0,i.useState)(!1),o=()=>{f(d())};(0,i.useEffect)(()=>{const t=()=>f(d());return window.addEventListener("notifications-updated",t),()=>window.removeEventListener("notifications-updated",t)},[]),(0,i.useEffect)(()=>{let t=null;return u(async()=>{const{initializeFcmForegroundListener:r}=await import("./fcmClientService-CIETrQcU.js");return{initializeFcmForegroundListener:r}},__vite__mapDeps([0,1,2,3,4,5,6,7])).then(({initializeFcmForegroundListener:r})=>r(()=>{o()})).then(r=>{t=r}).catch(()=>{}),()=>{t&&t()}},[]),(0,i.useEffect)(()=>{if(!x)return;const t=r=>{r.key==="Escape"&&s()};return window.addEventListener("keydown",t),()=>window.removeEventListener("keydown",t)},[x,s]);const _=async()=>{j(!0);try{const{requestNotificationPermissionAndToken:t,sendTestPushNotification:r}=await u(async()=>{const{requestNotificationPermissionAndToken:c,sendTestPushNotification:a}=await import("./fcmClientService-CIETrQcU.js");return{requestNotificationPermissionAndToken:c,sendTestPushNotification:a}},__vite__mapDeps([0,1,2,3,4,5,6,7]));await t()?(h("granted"),await r(),o()):typeof window<"u"&&"Notification"in window&&h(Notification.permission)}catch{}finally{j(!1)}};(0,i.useEffect)(()=>{u(async()=>{const{getUserNotifications:t}=await import("./api-D6UOnPC0.js").then(r=>r.g);return{getUserNotifications:t}},__vite__mapDeps([8,1,2,3,4,5,6])).then(({getUserNotifications:t})=>t()).then(t=>{const r=Array.isArray(t?.notifications)?t.notifications:[];if(!r.length)return;const c=new Set(d().map(a=>`${a.title}|${a.message}`));r.forEach(a=>{const v=`${a.title}|${a.message}`;!a.title||c.has(v)||(q({title:a.title,message:a.message,type:a.type||"system",metadata:a.metadata}),c.add(v))})}).catch(()=>{})},[]);const n=p.filter(t=>!t.read).length,E=()=>{V(),o()},A=()=>{U(),o()},g=p.filter(t=>l==="debit"?t.type==="debit"||t.type==="credit"||t.type==="budget":l==="jobs"?t.type==="job"||t.type==="partner":l==="system"?t.type==="system"||t.type==="email"||t.type==="growth":!0);return(0,e.jsx)(I,{children:x&&(0,e.jsxs)("div",{className:"fixed inset-0 z-50 flex justify-end bg-background/80 backdrop-blur-md",role:"dialog","aria-modal":"true",children:[(0,e.jsx)(m.div,{initial:{opacity:0}
2,animate:{opacity:1},exit:{opacity:0},onClick:s,className:"absolute inset-0"}),(0,e.jsxs)(m.div,{initial:{x:"100%"},animate:{x:0},exit:{x:"100%"},transition:{type:"spring",damping:25,stiffness:250},className:"relative z-10 w-full max-w-md h-full bg-surface border-l border-outline-variant/15 shadow-2xl flex flex-col justify-between",children:[(0,e.jsxs)("div",{className:"p-6 border-b border-outline-variant/10 flex items-center justify-between",children:[(0,e.jsxs)("div",{className:"flex items-center gap-3",children:[(0,e.jsxs)("div",{className:"relative p-2.5 bg-primary/10 border border-primary/20 text-primary rounded-2xl",children:[(0,e.jsx)(N,{size:20}),n>0&&(0,e.jsx)("span",{className:"absolute -top-1 -right-1 w-5 h-5 rounded-full bg-emerald-500 text-on-emerald font-black text-[10px] flex items-center justify-center border-2 border-surface animate-pulse",children:n})]}),(0,e.jsxs)("div",{children:[(0,e.jsx)("h3",{className:"font-headline font-black text-lg text-on-surface",children:"Notification Center"}),(0,e.jsx)("p",{className:"text-[10px] text-on-surface-variant/70 font-bold uppercase tracking-wider",children:n>0?`${n} new alerts`:"All notifications caught up"})]})]}),(0,e.jsx)("button",{type:"button",onClick:s,className:"p-2.5 rounded-full bg-surface-container-low hover:bg-surface-container border border-outline-variant/20 text-on-surface-variant transition-all",children:(0,e.jsx)(F,{size:18})})]}),(0,e.jsxs)("div",{className:"px-6 py-3 border-b border-outline-variant/10 flex items-center justify-between gap-2 bg-surface-container-lowest/50",children:[(0,e.jsx)("div",{className:"flex items-center gap-1.5",children:[{id:"all",label:"All"},{id:"debit",label:"Money"},{id:"jobs",label:"Jobs"},{id:"system",label:"System"}].map(t=>(0,e.jsx)("button",{type:"button",onClick:()=>k(t.id),className:`px-3 py-1.5 rounded-xl text-[9px] font-black uppercase tracking-wider border transition-all ${l===t.id?"bg-primary text-on-primary border-primary":"bg-surface-container-low text-on-surface-variant border-outline-variant/15 hover:border-primary/30"}`,children:t.label},t.id))}),(0,e.jsxs)("div",{className:"flex items-center gap-1",children:[n>0&&(0,e.jsx)("button",{type:"button",onClick:E,className:"p-2 rounded-xl text-on-surface-variant hover:text-primary transition-all",title:"Mark all read",children:(0,e.jsx)(C,{size:16})}),p.length>0&&(0,e.jsx)("button",{type:"button",onClick:A,className:"p-2 rounded-xl text-on-surface-variant hover:text-error transition-all",title:"Clear all",children:(0,e.jsx)(L,{size:16})})]})]}),b!=="granted"&&b!=="unsupported"&&(0,e.jsxs)("div",{className:"mx-6 mt-3 p-3.5 rounded-2xl bg-primary/10 border border-primary/20 flex items-center justify-between gap-3",children:[(0,e.jsxs)("div",{className:"flex items-center gap-2.5 min-w-0",children:[(0,e.jsx)("div",{className:"p-2 rounded-xl bg-primary text-on-primary shrink-0",children:(0,e.jsx)(N,{size:14})}),(0,e.jsxs)("div",{className:"min-w-0",children:[(0,e.jsx)("h5",{className:"text-[11px] font-black text-on-surface truncate",children:"Instant Push Alerts"}),(0,e.jsx)("p",{className:"text-[9px] text-on-surface-variant/70",children:"Get bank alerts and finder updates"})]})]}),(0,e.jsx)("button",{type:"button",onClick:_,disabled:y,className:"px-3 py-1.5 rounded-xl bg-primary text-on-primary text-[9px] font-black uppercase tracking-wider hover:bg-primary/90 transition-all shrink-0 disabled:opacity-50",children:y?"Enabling...":"Enable"})]}),(0,e.jsx)("div",{className:"flex-1 overflow-y-auto p-6 space-y-3",children:g.length===0?(0,e.jsxs)("div",{className:"py-16 text-center space-y-3",children:[(0,e.jsx)("div",{className:"w-16 h-16 rounded-full bg-primary/5 border border-primary/10 mx-auto flex items-center justify-center text-primary/40",children:(0,e.jsx)(R,{size:28})}),(0,e.jsx)("h4",{className:"text-sm font-bold text-on-surface",children:"No alerts in this view"}),(0,e.jsx)("p",{className:"text-xs text-on-surface-variant/60 max-w-xs mx-auto",children:"Registered device alerts from bank SMS & emails will automatically appear here."})]}):g.map(t=>(0,e.jsx)(m.div,{initial:{opacity:0,y:10}
2,animate:{opacity:1,y:0},className:`p-4 rounded-2xl border transition-all ${t.read?"bg-surface-container-low/40 border-outline-variant/10":"bg-primary/5 border-primary/20 shadow-xs"}`,children:(0,e.jsxs)("div",{className:"flex items-start gap-3",children:[(0,e.jsx)("div",{className:"shrink-0 pt-0.5",children:t.type==="debit"?(0,e.jsx)("div",{className:"p-2 rounded-xl bg-error/10 border border-error/20 text-error",children:(0,e.jsx)($,{size:16})}):t.type==="credit"?(0,e.jsx)("div",{className:"p-2 rounded-xl bg-emerald-500/10 border border-emerald-500/20 text-emerald-400",children:(0,e.jsx)(P,{size:16})}):t.type==="partner"||t.type==="job"?(0,e.jsx)("div",{className:"p-2 rounded-xl bg-purple-500/10 border border-purple-500/20 text-purple-400",children:(0,e.jsx)(T,{size:16})}):t.type==="price_drop"?(0,e.jsx)("div",{className:"p-2 rounded-xl bg-amber-500/10 border border-amber-500/20 text-amber-400",children:(0,e.jsx)(w,{size:16})}):(0,e.jsx)("div",{className:"p-2 rounded-xl bg-primary/10 border border-primary/20 text-primary",children:(0,e.jsx)(z,{size:16})})}),(0,e.jsxs)("div",{className:"flex-1 min-w-0 space-y-1",children:[(0,e.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,e.jsx)("h4",{className:"text-xs font-black text-on-surface truncate",children:t.title}),(0,e.jsx)("span",{className:"text-[8px] font-bold text-on-surface-variant/50 shrink-0",children:new Date(t.timestamp).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})})]}),(0,e.jsx)("p",{className:"text-xs text-on-surface-variant/80 leading-relaxed",children:t.message}),t.metadata?.url?(0,e.jsx)("a",{href:String(t.metadata.url),target:"_blank",rel:"noopener noreferrer",className:"inline-block pt-1 text-[10px] font-black uppercase tracking-wider text-primary",children:"Open listing"}):null,t.amount!=null&&t.amount>0&&(0,e.jsxs)("span",{className:"inline-block pt-1 text-xs font-black text-on-surface",children:["₦",t.amount.toLocaleString()]})]})]})},t.id))}),(0,e.jsxs)("div",{className:"p-6 border-t border-outline-variant/10 bg-surface-container-low/40 flex items-center justify-between",children:[(0,e.jsxs)("span",{className:"text-[9px] font-bold text-on-surface-variant/60 uppercase tracking-widest flex items-center gap-1.5",children:[(0,e.jsx)(w,{size:11,className:"text-primary"})," Cravour Device Sync Active"]}),(0,e.jsx)("button",{type:"button",onClick:s,className:"px-5 py-2 rounded-xl bg-surface border border-outline-variant/20 text-xs font-bold text-on-surface",children:"Close"})]})]})]})})};export{X 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.