PageSourceSearch

https://dash.focusfin.co.il/assets/AdminMessagesAnalytics-B1epMtOr.js

js focusfin.co.il collected 2026-10-02 20:38:02 UTC 6,505 bytes, 1 lines download raw bytes

1import{d as w,e as k,j as s,P as _,i as C,C as d,a as r,E as M,f as j,g as N,h as u,b as f}from"./index-DPUrUn2B.js";import{M as A}from"./mouse-pointer-click-CuamF1mE.js";import{U as B}from"./users-DApRrnaW.js";function o(i){return`${i.toFixed(1)}%`}function R(){const{data:i}=w(),{data:l,isLoading:v}=k({queryKey:["admin-system-messages-analytics"],queryFn:async()=>{const[e,m]=await Promise.all([f.entities.SystemMessage.list("-updated_date",100),f.entities.SystemMessageEvent.list("-created_date",1e3)]),h=e.map(t=>{const a=m.filter(n=>n.message_id===t.id),c=a.filter(n=>n.event_type==="impression").length,p=a.filter(n=>n.event_type==="cta_click").length,y=c>0?p/c*100:0;return{...t,impressions:c,clicks:p,ctr:y}}),g=m.reduce((t,a)=>{const c=`${a.audience||"all_users"}__${a.content_type||"informational_content"}`;return t[c]||(t[c]={audience:a.audience||"all_users",content_type:a.content_type||"informational_content",impressions:0,clicks:0}),a.event_type==="impression"&&(t[c].impressions+=1),a.event_type==="cta_click"&&(t[c].clicks+=1),t},{}),b=Object.values(g).map(t=>({...t,ctr:t.impressions>0?t.clicks/t.impressions*100:0})),x=h.reduce((t,a)=>(t.impressions+=a.impressions,t.clicks+=a.clicks,t),{impressions:0,clicks:0});return{analyticsByMessage:h,audienceBreakdown:b,totals:{...x,ctr:x.impressions>0?x.clicks/x.impressions*100:0}}}});return i!=null&&i.isAdmin||(i==null?void 0:i.role)==="admin"?v?s.jsx("div",{className:"p-8 text-center",children:"טוען נתוני אנליטיקה..."}):s.jsxs("div",{className:"min-h-screen bg-slate-50 dark:bg-slate-950 p-4 md:p-8",dir:"rtl",children:[s.jsx(_,{pageKey:"AdminMessagesAnalytics",noindex:!0}),s.jsxs("div",{className:"mx-auto max-w-6xl space-y-6",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"rounded-2xl bg-indigo-600 p-3 text-white shadow-lg shadow-indigo-200",children:s.jsx(C,{className:"h-7 w-7"})}),s.jsxs("div",{children:[s.jsx("h1",{className:"text-3xl font-bold text-slate-900",children:"Analytics להודעות מערכת"}),s.jsx("p",{className:"text-slate-500",children:"צפיות, הקלקות ופילוחי קהל לפי סוג תוכן"})]})]}),s.jsxs("div",{className:"grid gap-4 md:grid-cols-3",children:[s.jsx(d,{className:"border-0 shadow-md",children:s.jsxs(r,{className:"flex items-center justify-between p-6",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-sm text-slate-500",children:"סך הכל חשיפות"}),s.jsx("p",{className:"mt-2 text-3xl font-bold text-slate-900",children:(l==null?void 0:l.totals.impressions)||0})]}),s.jsx(M,{className:"h-8 w-8 text-blue-600"})]})}),s.jsx(d,{className:"border-0 shadow-md",children:s.jsxs(r,{className:"flex items-center justify-between p-6",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-sm text-slate-500",children:"סך הכל קליקים"}),s.jsx("p",{className:"mt-2 text-3xl font-bold text-slate-900",children:(l==null?void 0:l.totals.clicks)||0})]}),s.jsx(A,{className:"h-8 w-8 text-emerald-600"})]})}),s.jsx(d,{className:"border-0 shadow-md",children:s.jsxs(r,{className:"flex items-center justify-between p-6",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-sm text-slate-500",children:"CTR ממוצע"}),s.jsx("p",{className:"mt-2 text-3xl font-bold text-slate-900",children:o((l==null?void 0:l.totals.ctr)||0)})]}),s.jsx(B,{className:"h-8 w-8 text-violet-600"})]})})]}),s.jsxs("div",{className:"grid gap-6 lg:grid-cols-2",children:[s.jsxs(d,{className:"border-0 shadow-md",children:[s.jsxs(j,{children:[s.jsx(N,{children:"ביצועים לפי הודעה"}),s.jsx(u,{children:"כמה משתמשים ראו ולחצו בכל הודעה"})]}),s.jsx(r,{className:"space-y-3",children:l==null?void 0:l.analyticsByMessage.map(e=>s.jsx("div",{className:"rounded-2xl border bg-white p-4",children:s.jsxs("div",{className:"flex items-start justify-between gap-4",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsx("p",{className:"font-semibold text-slate-900",children:e.title}),s.jsxs("div",{className:"flex flex-wrap gap-2 text-xs text-slate-500",children:[s.jsx("span",{className:"rounded-full bg-slate-100 px-2 py-1",children:e.channel}),s.jsx("span",{className:"rounded-full bg-slate-100 px-2 py-1",children:e.audience||"all_users"})]})]}),s.jsxs("div",{className:"grid grid-cols-3 gap-2 text-center text-sm min-w-[220px]",children:[s.jsxs("div",{className:"rounded-xl bg-slate-50 p-2",children:[s.jsx("div",{className:"text-slate-500",children:"Impressions"}),s.jsx("div",{className:"font-bold text-slate-900",children:e.impressions})]}),s.jsxs("div",{className:"rounded-xl bg-slate-50 p-2",children:[s.jsx("div",{className:"text-slate-500",children:"Clicks"}),s.jsx("div",{className:"font-bold text-slate-900",children:e.clicks})]}),s.jsxs("div",{className:"rounded-xl bg-slate-50 p-2",children:[s.jsx("div",{className:"text-slate-500",children:"CTR"}),s.jsx("div",{className:"font-bold text-slate-900",children:o(e.ctr)})]})]})]})},e.id))})]}),s.jsxs(d,{className:"border-0 shadow-md",children:[s.jsxs(j,{children:[s.jsx(N,{children:"פילוח קהל ותוכן"}),s.jsx(u,{children:"איזה קהל קיבל איזה סוג תוכן ואיך הוא הגיב"})]}),s.jsx(r,{className:"space-y-3",children:l==null?void 0:l.audienceBreakdown.map(e=>s.jsx("div",{className:"rounded-2xl border bg-white p-4",children:s.jsxs("div",{className:"flex items-start justify-between gap-4",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsx("p",{className:"font-semibold text-slate-900",children:e.audience}),s.jsx("p",{className:"text-sm text-slate-500",children:e.content_type})]}),s.jsxs("div",{className:"grid grid-cols-3 gap-2 text-center text-sm min-w-[220px]",children:[s.jsxs("div",{className:"rounded-xl bg-slate-50 p-2",children:[s.jsx("div",{className:"text-slate-500",children:"Impressions"}),s.jsx("div",{className:"font-bold text-slate-900",children:e.impressions})]}),s.jsxs("div",{className:"rounded-xl bg-slate-50 p-2",children:[s.jsx("div",{className:"text-slate-500",children:"Clicks"}),s.jsx("div",{className:"font-bold text-slate-900",children:e.clicks})]}),s.jsxs("div",{className:"rounded-xl bg-slate-50 p-2",children:[s.jsx("div",{className:"text-slate-500",children:"CTR"}),s.jsx("div",{className:"font-bold text-slate-900",children:o(e.ctr)})]})]})]})},`${e.audience}-${e.content_type}`))})]})]})]})]}):s.jsx("div",{className:"p-8 text-center",children:"אין הרשאה לצפייה בעמוד זה."})}export{R 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.