1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4639],{1857:(e,t,a)=>{a.d(t,{f:()=>r});function r(e,t){let a,r="string"==typeof e?new Date(e):e,s=new Date,n=Math.floor((s.getTime()-r.getTime())/6e4),i=Math.floor(n/60),l=Math.floor(i/24),o=new Intl.RelativeTimeFormat(t,{numeric:"auto",style:"narrow"});if(n<1)return o.format(0,"second");if(n<60)return o.format(-n,"minute");if(i<24)return o.format(-i,"hour");if(l<7)return o.format(-l,"day");try{a=Intl.DateTimeFormat().resolvedOptions().timeZone}catch{a=void 0}return r.toLocaleDateString(t,{month:"short",day:"numeric",year:r.getFullYear()!==s.getFullYear()?"numeric":void 0,...a?{timeZone:a}:{}})}},10606:(e,t,a)=>{a.d(t,{A:()=>r});let r=(0,a(83757).A)("check-check",[["path",{d:"M18 6 7 17l-5-5",key:"116fxf"}],["path",{d:"m22 10-7.5 7.5L13 16",key:"ke71qq"}]])},13687:(e,t,a)=>{a.d(t,{A:()=>r});let r=(0,a(83757).A)("arrow-up-right",[["path",{d:"M7 7h10v10",key:"1tivn9"}],["path",{d:"M7 17 17 7",key:"1vkiza"}]])},18204:(e,t,a)=>{a.d(t,{E$:()=>x,Wd:()=>g,k7:()=>y,mw:()=>b});var r=a(18249),s=a(21620),n=a(10800),i=a(74664),l=a(7276),o=a(65304),c=a(68923),d=a(38389),u=a(43243),m=a(53698),h=a(52092),p=a(80857),f=a(31963);function x(e=!1){let t=(0,r.jE)(),a=(0,l.useMemo)(()=>d.l.notifications.list(e),[e]),n=h.r.getNotificationRepository(),i=(0,f.k)(e=>e.user),o=(0,l.useRef)(0),g=(0,l.useRef)(null),{client:y,isConnected:b}=(0,c.CH)()||{client:null,isConnected:!1},v=(0,l.useCallback)(()=>n.getAll(e),[e,n]);(0,l.useEffect)(()=>{if(!y||!b||!i?.id)return;let e=`private-user.${i.id}`,a=()=>{let r,s=((r=y.getChannel(e))||(r=y.subscribeToUserChannel(i.id)),r);if(!s)return o.current<3?(o.current++,u.logger.debug(`[useNotifications] Channel not available, retry ${o.current}/3`),g.current=setTimeout(a,1e3)):u.logger.warn("[useNotifications] Failed to subscribe to channel after max retries"),null;o.current=0;let n=e=>{t.invalidateQueries({queryKey:d.l.notifications.all});let a=e.notification,r=a.data?.status??void 0;if("string"==typeof a.type?.value&&a.type.value.endsWith("_synced")&&r){let e=`${a.title} â ${a.message}`;"failed"===r?m.l.error(e):"partial"===r?m.l.warning(e):m.l.success(e)}},l=e=>{t.invalidateQueries({queryKey:d.l.notifications.all})},c=e=>{t.invalidateQueries({queryKey:d.l.notifications.all})};return s.bind(p.s8.CREATED,n),s.bind(p.s8.READ,l),s.bind(p.s8.DELETED,c),{channel:s,handleCreated:n,handleRead:l,handleDeleted:c}},r=a();return()=>{g.current&&(clearTimeout(g.current),g.current=null),o.current=0,r?.channel&&(r.channel.unbind(p.s8.CREATED,r.handleCreated),r.channel.unbind(p.s8.READ,r.handleRead),r.channel.unbind(p.s8.DELETED,r.handleDeleted))}},[y,b,i?.id,t]);let k=!!i?.id;return(0,s.I)({queryKey:a,queryFn:v,staleTime:3e4,gcTime:12e4,refetchInterval:!b&&6e4,enabled:k})}function g(){let e=(0,r.jE)(),t=(0,i.c)("dashboard.notifications.toast"),a=h.r.getNotificationRepository(),s=(0,l.useCallback)(()=>{e.invalidateQueries({queryKey:d.l.notifications.all})},[e]),c=(0,l.useCallback)(e=>{o.Zz.handle(e,e=>t(e))},[t]);return(0,n.n)({mutationFn:e=>a.markAsRead(e),onSuccess:s,onError:c})}function y(){let e=(0,r.jE)(),t=(0,i.c)("dashboard.notifications.toast"),a=h.r.getNotificationRepository(),s=(0,l.useCallback)(a=>{e.invalidateQueries({queryKey:d.l.notifications.all}),a.count>0&&m.l.success(`${t("markAllReadSuccess")} ${t("markAllReadSuccessDescription",{count:a.count})}`)},[e,t]),c=(0,l.useCallback)(e=>{o.Zz.handle(e,e=>t(e))},[t]);return(0,n.n)({mutationFn:()=>a.markAllAsRead(),onSuccess:s,onError:c})}function b(){let e=(0,r.jE)(),t=(0,i.c)("dashboard.notifications.toast"),a=h.r.getNotificationRepository(),s=(0,l.useCallback)(()=>{e.invalidateQueries({queryKey:d.l.notifications.all}),m.l.success(t("deleteSuccess"))},[e,t]),c=(0,l.useCallback)(e=>{o.Zz.handle(e,e=>t(e))},[t]);return(0,n.n)({mutationFn:e=>a.deleteNotification(e),onSuccess:s,onError:c})}},23621:(e,t,a)=>{a.d(t,{A:()=>r});let r=(0,a(83757).A)("megaphone",[["path",{d:"M11 6a13 13 0 0 0 8.4-2.8A1 1 0 0 1 21 4v12a1 1 0 0 1-1.6.8A13 13 0 0 0 11 14H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2z",key:"q8bfy3"}],["path",{d:"M6 14a12 12 0 0 0 2.4 7.2 2 2 0 0 0 3.2-2.4A8 8 0 0 1 10 14",key:"1853fq"}],["path",{d:"M8 6v8",key:"15ugcq"}]])},35237:(e,t,a)=>{a.d(t,{A:()=>r});let r=(0,a(83757).A)("shield-check",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",ke
1y:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]])},50297:(e,t,a)=>{a.d(t,{Ow:()=>k,Om:()=>b,By:()=>v,eX:()=>A});var r=a(99692),s=a(77762),n=a(33266),i=a(23621),l=a(76320),o=a(49556),c=a(97318),d=a(77441),u=a(35237),m=a(10606),h=a(91297),p=a(76655),f=a(96721);let x={urgent:{className:"bg-red-500/10 text-red-600"},high:{className:"bg-orange-500/10 text-orange-600"},normal:{className:"bg-blue-500/10 text-blue-600"},low:{className:"bg-gray-500/10 text-gray-600"}},g={security:{icon:r.A,color:"text-red-600 dark:text-red-400",bgColor:"bg-red-500/10"},account:{icon:s.A,color:"text-blue-600 dark:text-blue-400",bgColor:"bg-blue-500/10"},store:{icon:n.A,color:"text-purple-600 dark:text-purple-400",bgColor:"bg-purple-500/10"},campaign:{icon:i.A,color:"text-amber-600 dark:text-amber-400",bgColor:"bg-amber-500/10"},research:{icon:l.A,color:"text-emerald-600 dark:text-emerald-400",bgColor:"bg-emerald-500/10"},general:{icon:o.A,color:"text-muted-foreground",bgColor:"bg-muted"}},y={login_new_device:c.A,password_reset_requested:d.A,password_changed:d.A,two_factor_enabled:u.A,two_factor_disabled:r.A,account_email_changed:s.A,email_verified:m.A,store_invitation:n.A,store_member_added:h.A,store_member_removed:p.A,store_settings_changed:n.A,campaign_created:i.A,campaign_status_changed:i.A,product_research_started:f.A,product_research_completed:l.A,product_research_failed:l.A};function b(e){return["password_reset_requested","password_changed","login_new_device","two_factor_enabled","two_factor_disabled"].includes(e)?"security":["email_verified","account_email_changed"].includes(e)?"account":["store_invitation","store_member_added","store_member_removed","store_settings_changed"].includes(e)?"store":["campaign_created","campaign_status_changed"].includes(e)?"campaign":["product_research_started","product_research_completed","product_research_failed"].includes(e)?"research":"general"}function v(e){let t=b(e),a=g[t];return{Icon:y[e]??a.icon,category:t,color:a.color,bgColor:a.bgColor}}function k(e,t=new Date){let a=[],r=new Date(t.getFullYear(),t.getMonth(),t.getDate()),s=new Date(r.getTime()-864e5),n=new Date(r.getTime()-6048e5),i=[],l=[],o=[],c=[];for(let t of e){let e=new Date(t.created_at);if(e>=r){i.push(t);continue}if(e>=s){l.push(t);continue}if(e>=n){o.push(t);continue}c.push(t)}return i.length>0&&a.push({key:"today",notifications:i}),l.length>0&&a.push({key:"yesterday",notifications:l}),o.length>0&&a.push({key:"thisWeek",notifications:o}),c.length>0&&a.push({key:"older",notifications:c}),a}function A(e){let t=e.toLowerCase();return x[t]?.className||x.low.className}},54639:(e,t,a)=>{a.r(t),a.d(t,{NotificationDropdown:()=>v});var r=a(13056),s=a(49556),n=a(19229),i=a(10606),l=a(97268),o=a(13687),c=a(74664),d=a(7276),u=a(50297),m=a(90700),h=a(29937),p=a(33661),f=a(18204),x=a(39341),g=a(1857),y=a(44603),b=a(14165);function v(){let e=(0,x.rd)(),{overview:t}=(0,b.V)(),{data:a,isLoading:v}=(0,f.E$)(),k=(0,f.k7)(),A=(0,c.c)("dashboard.notifications"),[_,w]=d.useState(!1),N=t?.notifications_summary,j=N?.unread_count??0,C=d.useMemo(()=>a?a.filter(e=>!e.read_at).length:j,[a,j]),M=d.useMemo(()=>a?a.slice(0,5):(N?.latest??[]).slice(0,5),[a,N?.latest]);return(0,r.jsxs)(h.DropdownMenu,{open:_,onOpenChange:w,children:[(0,r.jsx)(h.DropdownMenuTrigger,{asChild:!0,children:(0,r.jsxs)(m.$,{variant:"ghost",size:"icon-sm",className:"relative","aria-label":A("title"),children:[(0,r.jsx)(s.A,{className:"size-[18px]"}),C>0&&(0,r.jsx)("span",{className:"absolute -right-0.5 -top-0.5 flex size-4 items-center justify-center rounded-full bg-primary text-[10px] font-bold text-primary-foreground",children:C>9?"9+":C})]})}),(0,r.jsxs)(h.DropdownMenuContent,{align:"end",className:"w-[calc(100vw-1.5rem)] max-w-[380px] sm:w-[380px] overflow-hidden p-0",sideOffset:8,children:[(0,r.jsx)(h.DropdownMenuHeader,{className:"border-b border-border/80 bg-muted/40 px-4 py-3",children:(0,r.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)(h.DropdownMenuLabel,{className:"p-0 text-sm font-semibold text-foreground",children:A("dropdown.title")}),C>0&&(0,r.jsx)("span",{className:"flex h-5 items-center rounded-full bg-primary/10 px-2 text-xs font-medium text-primary",children:A("dropdown.newCount",{count:C})})]}),C>0&&(0,r.jsxs)("button",{type:"button",onClick:()=>k.mutate(),disabled:k.isPending,className:"inline-flex shrink-0 items-center gap-1 rounded-md px-2 py-1 text-xs font-medium text-primary transition-colors hover:bg-primary/10 disabled:opacity-50",children:[k.isPending?(0,r.jsx)(n.A,{className:"size-3.5 animate-spin"}):(0,r.jsx)(i.A,{className:"size-3.5"}),A("markAllRead")]})]})}),(0,r.jsx)("div",{className:"max-h-[min(70vh,400px)] overflow-y-auto scrollbar-thin",children:v?(0,r.jsx)("div",{className:"space-y-0 divide-y divide-border/60 p-0",children:Array.from({length:4}).map((e,t)=>(0,r.jsxs)("div",{className:"flex items-start gap-3 px-4 py-3",children:[(0,r.jsx)(p.EA,{className:"size-9 shrink-0 rounded-xl"}),(0,r.jsxs)("div",{className:"flex-1 space-y-2",children:[(0,r.jsx)(p.EA,{className:"h-4 w-3/4"}),(0,r.jsx)(p.EA,{className:"h-3 w-full"}),(0,r.jsx)(p.EA,{className:"h-2.5 w-16"})]})]},t))}):M.length>0?(0,r.jsx)("div",{className:"divide-y divide-border/60",children:M.map(t=>{let a=!!t.read_at,{Icon:s,bgColor:n,category:i,color:l}=(0,u.By)(t.type.value);return(0,r.jsxs)("div",{className:(0,y.cn)("group relative cursor-pointer px-4 py-3 transition-colors","hover:bg-accent/40",!a&&"bg-primary/[0.03]"),onClick:()=>{w(!1),e.push("/dashboard/notifications")},children:[!a&&(0,r.jsx)("span",{className:"absolute inset-y-0 left-0 w-[2px] bg-primary"}),(0,r.jsxs)("div",{className:"flex items-start gap-3",children:[(0,r.jsx)("div",{className:(0,y.cn)("flex size-9 shrink-0 items-center justify-center rounded-xl",n),children:(0,r.jsx)(s,{className:(0,y.cn)("size-4",l)})}),(0,r.jsxs)("div",{className:"min-w-0 flex-1 space-y-0.5",children:[(0,r.jsx)("p",{className:(0,y.cn)("text-sm leading-snug",a?"font-medium text-muted-foreground":"font-semibold text-foreground"),children:t.title}),(0,r.jsx)("p",{className:"line-clamp-2 text-xs leading-relaxed text-muted-foreground",children:t.message}),(0,r.jsxs)("div",{className:"flex items-center gap-2 pt-0.5",children:[(0,r.jsx)("span",{className:(0,y.cn)("rounded px-1 py-px text-[9px] font-medium",n,l),children:A(`categories.${i}`)}),(0,r.jsx)("span",{className:"text-[11px] text-muted-foreground
1/50",children:(0,g.f)(t.created_at)})]})]})]})]},t.id)})}):(0,r.jsxs)("div",{className:"flex flex-col items-center justify-center px-4 py-10",children:[(0,r.jsx)("div",{className:"flex size-10 items-center justify-center rounded-xl bg-muted",children:(0,r.jsx)(l.A,{className:"size-5 text-muted-foreground/50"})}),(0,r.jsx)("p",{className:"mt-3 text-sm font-medium",children:A("noNotifications")}),(0,r.jsx)("p",{className:"text-caption text-muted-foreground",children:A("dropdown.emptyDescription")})]})}),M.length>0&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(h.DropdownMenuSeparator,{}),(0,r.jsx)("div",{className:"p-2",children:(0,r.jsxs)(m.$,{variant:"ghost",className:"h-9 w-full justify-center text-sm font-medium",onClick:()=>{w(!1),e.push("/dashboard/notifications")},children:[A("dropdown.viewAll"),(0,r.jsx)(o.A,{className:"ml-1 size-4"})]})})]})]})]})}},76320:(e,t,a)=>{a.d(t,{A:()=>r});let r=(0,a(83757).A)("flask-conical",[["path",{d:"M14 2v6a2 2 0 0 0 .245.96l5.51 10.08A2 2 0 0 1 18 22H6a2 2 0 0 1-1.755-2.96l5.51-10.08A2 2 0 0 0 10 8V2",key:"18mbvz"}],["path",{d:"M6.453 15h11.094",key:"3shlmq"}],["path",{d:"M8.5 2h7",key:"csnxdl"}]])},76655:(e,t,a)=>{a.d(t,{A:()=>r});let r=(0,a(83757).A)("user-minus",[["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:"22",x2:"16",y1:"11",y2:"11",key:"1shjgl"}]])},77441:(e,t,a)=>{a.d(t,{A:()=>r});let r=(0,a(83757).A)("key-round",[["path",{d:"M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z",key:"1s6t7t"}],["circle",{cx:"16.5",cy:"7.5",r:".5",fill:"currentColor",key:"w0ekpg"}]])},91297:(e,t,a)=>{a.d(t,{A:()=>r});let r=(0,a(83757).A)("user-plus",[["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"}]])},97268:(e,t,a)=>{a.d(t,{A:()=>r});let r=(0,a(83757).A)("bell-off",[["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"}]])},99692:(e,t,a)=>{a.d(t,{A:()=>r});let r=(0,a(83757).A)("shield",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]])}}]);
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.