PageSourceSearch

https://www.ylive.ai/assets/SubscriptionReminderPopup-B_y8XtvS.js

js ylive.ai collected 2026-10-05 13:44:53 UTC 5,668 bytes, 1 lines download raw bytes

1import{r as m,j as e}from"./vendor-motion-IPZE8IrO.js";import{u as G,e as S,t as o,X as R,B as n,S as $,F as w}from"./index-AEzrcV_C.js";import{G as N}from"./gift-B6K99KaE.js";import{B as v}from"./bell-CktT6xWk.js";import{C as A}from"./clock-mjkDmSOT.js";import"./vendor-react-BN0qJr-I.js";import"./vendor-trpc-IjFHpi-5.js";function D(){const[,b]=G(),{isAuthenticated:g}=S(),[r,i]=m.useState(null),[j,x]=m.useState(!1),{data:a}=o.subscription.getNotifications.useQuery(void 0,{enabled:g,refetchInterval:g?6e4:!1}),C=o.subscription.dismissNotification.useMutation(),_=o.subscription.markNotificationRead.useMutation(),p=o.useUtils();m.useEffect(()=>{if(!a||a.length===0){i(null);return}const c=["subscription_expiry_h1","subscription_expiry_h3","subscription_expiry_h5","subscription_expired"],d=a.filter(u=>!u.isRead);if(d.length===0){i(null);return}let s=null;for(const u of c){const y=d.find(L=>L.type===u);if(y){s=y;break}}s||(s=d[0]),i(s),x(!0)},[a]);const l=async()=>{r&&(x(!1),setTimeout(async()=>{await C.mutateAsync({notificationId:r.id}),p.subscription.getNotifications.invalidate(),i(null)},300))},h=async()=>{r&&(await _.mutateAsync({notificationId:r.id}),p.subscription.getNotifications.invalidate())},B=()=>{r&&h(),b("/subscription")};if(!r)return null;const t=(c=>{switch(c){case"subscription_expiry_h5":return{icon:e.jsx(A,{className:"w-6 h-6"}),iconBg:"bg-blue-500/20",iconColor:"text-blue-400",borderColor:"border-blue-500/30",bgGlow:"shadow-blue-500/10",urgencyLabel:"5 Hari Lagi",urgencyBg:"bg-blue-500/10 text-blue-300"};case"subscription_expiry_h3":return{icon:e.jsx(v,{className:"w-6 h-6"}),iconBg:"bg-amber-500/20",iconColor:"text-amber-400",borderColor:"border-amber-500/30",bgGlow:"shadow-amber-500/10",urgencyLabel:"3 Hari Lagi",urgencyBg:"bg-amber-500/10 text-amber-300"};case"subscription_expiry_h1":return{icon:e.jsx(w,{className:"w-6 h-6"}),iconBg:"bg-red-500/20",iconColor:"text-red-400",borderColor:"border-red-500/30",bgGlow:"shadow-red-500/10",urgencyLabel:"Besok!",urgencyBg:"bg-red-500/10 text-red-300"};case"subscription_expired":return{icon:e.jsx(w,{className:"w-6 h-6"}),iconBg:"bg-red-600/20",iconColor:"text-red-500",borderColor:"border-red-600/30",bgGlow:"shadow-red-600/10",urgencyLabel:"Berakhir",urgencyBg:"bg-red-600/10 text-red-400"};case"referral_reward":return{icon:e.jsx(N,{className:"w-6 h-6"}),iconBg:"bg-primary/20",iconColor:"text-primary",borderColor:"border-primary/30",bgGlow:"shadow-emerald-500/10",urgencyLabel:"+7 Hari Gratis",urgencyBg:"bg-primary/10 text-emerald-300"};default:return{icon:e.jsx(v,{className:"w-6 h-6"}),iconBg:"bg-primary/20",iconColor:"text-primary",borderColor:"border-primary/30",bgGlow:"shadow-emerald-500/10",urgencyLabel:"Info",urgencyBg:"bg-primary/10 text-emerald-300"}}})(r.type),f=r.metadata?.daysLeft,k=r.metadata?.planName||"Premium";return e.jsx("div",{className:`fixed bottom-6 right-6 z-[100] max-w-sm w-full transition-all duration-300 ease-[cubic-bezier(0.23,1,0.32,1)] ${j?"translate-y-0 opacity-100 scale-100":"translate-y-4 opacity-0 scale-95"}`,children:e.jsxs("div",{className:`relative overflow-hidden rounded-2xl border ${t.borderColor} bg-popover/95 backdrop-blur-xl shadow-2xl ${t.bgGlow}`,children:[e.jsx("div",{className:`absolute top-0 left-0 right-0 h-1 ${r.type==="subscription_expiry_h1"?"bg-gradient-to-r from-red-500 via-orange-500 to-red-500 animate-pulse":r.type==="subscription_expiry_h3"?"bg-gradient-to-r from-amber-500 via-yellow-500 to-amber-500":r.type==="referral_reward"?"bg-gradient-to-r from-emerald-500 via-green-400 to-emerald-500":"bg-gradient-to-r from-blue-500 via-cyan-500 to-blue-500"}`}),e.jsx("button",{onClick:l,className:"absolute top-3 right-3 p-1.5 rounded-full hover:bg-white/10 text-muted-foreground hover:text-white transition-colors duration-150","aria-label":"Tutup notifikasi",children:e.jsx(R,{className:"w-4 h-4"})}),e.jsxs("div",{className:"p-5 pt-6",children:[e.jsxs("div",{className:"flex items-start gap-3 mb-3",children:[e.jsx("div",{className:`p-2.5 rounded-xl ${t.iconBg} ${t.iconColor}`,children:t.icon}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"flex items-center gap-2 mb-1",children:e.jsx("span",{className:`text-xs font-medium px-2 py-0.5 rounded-full ${t.urgencyBg}`,children:t.urgencyLabel})}),e.jsx("h4",{className:"text-sm font-semibold text-white leading-tight",children:r.title})]})]}),e.jsx("p",{className:"text-xs text-muted-foreground leading-relaxed mb-4 pl-[52px]",children:r.message}),e.jsx("div",{className:"flex items-center gap-2 pl-[52px]",children:r.type==="referral_reward"?e.jsxs(e.Fragment,{children:[e.jsxs(n,{size:"sm",className:"bg-primary hover:bg-emerald-dark text-primary-foreground font-semibold text-xs px-4 h-8 rounded-lg transition-all duration-150 hover:scale-[1.02] active:scale-[0.98]",onClick:()=>{h(),b("/referral")},children:[e.jsx(N,{className:"w-3.5 h-3.5 mr-1.5"}),"Lihat Referral"]}),e.jsx(n,{size:"sm",variant:"ghost",className:"text-xs text-muted-foreground hover:text-white h-8 px-3",onClick:l,children:"Tutup"})]}):e.jsxs(e.Fragment,{children:[e.jsxs(n,{size:"sm",className:"bg-primary hover:bg-emerald-dark text-primary-foreground font-semibold text-xs px-4 h-8 rounded-lg transition-all duration-150 hover:scale-[1.02] active:scale-[0.98]",onClick:B,children:[e.jsx($,{className:"w-3.5 h-3.5 mr-1.5"}),"Perpanjang Sekarang"]}),e.jsx(n,{size:"sm",variant:"ghost",className:"text-xs text-muted-foreground hover:text-white h-8 px-3",onClick:l,children:"Nanti Saja"})]})}),e.jsxs("p",{className:"text-[10px] text-muted-foreground mt-3 pl-[52px]",children:["Paket: ",k,f!==void 0&&` • Sisa ${f} hari`]})]})]})})}export{D 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.