PageSourceSearch

https://smartmail.ai/assets/LogsPage-D29lqtzw.js

js smartmail.ai collected 2026-10-05 14:17:08 UTC 9,034 bytes, 1 lines download raw bytes

1import{u as ae,r as o,g as q,h as N,R as O,j as e,S as U,B as b,T as u,f as re}from"./index-BrT3F50e.js";import{l as le}from"./messages_history-CRZ042o3.js";import{F as d,f as ie,a as oe,b as ne,c as ce,d as ue}from"./index-aiUU9uK4.js";import{f as de,a as me,b as pe,c as ye}from"./index-CERVQ99E.js";import{M as fe}from"./MessageHistoryTable-C_TdmaxS.js";import{b as xe}from"./broadcast-DTyl9Ml3.js";import{l as he}from"./list-8nSQBgxW.js";import{T as K}from"./index-JIFlWX-e.js";import{S as P}from"./index-DDdNZ6K1.js";import{P as be}from"./index-DG69r-Xk.js";import{R as B}from"./index-BDXfpOYW.js";import{S as ge}from"./index-DF5CAhcZ.js";import{I as ve}from"./index-BI2D8MSW.js";import{T as je}from"./index-DIQCRyy8.js";import"./dayjs-CSchl2My.js";import"./timezoneNormalizer-l1yj-VtS.js";import"./TemplatePreviewDrawer-Dr10TA_N.js";import"./index-Cw5ISF4o.js";import"./index-KB2153Cz.js";import"./index-DRrMmQ2c.js";import"./index-BI849doy.js";import"./Table-6SzYbSzL.js";import"./styleChecker-CI4V7a_h.js";import"./LeftOutlined-C9qxU1fR.js";import"./Dropdown-DXdTgnhA.js";import"./index-Cl3KiXUs.js";import"./EllipsisOutlined-Cu-qV7Vg.js";import"./Overflow-BkMYm1DN.js";import"./Sider-DNV35gRJ.js";import"./useBreakpoint-FD8ghq8d.js";import"./Pagination-DBPbQz54.js";import"./getAllowClear-C4A34otO.js";import"./Input-DOcZa3u3.js";import"./columns-2-BDWavgY3.js";import"./TextArea-BpydDq59.js";import"./gapSize-U1swVQyS.js";import"./useForm-BVKnLQxW.js";import"./PlusOutlined-B06sW5qS.js";const{Title:ke,Text:_e}=K,D="message_columns_visibility",R={id:!0,external_id:!1,contact_email:!0,template_id:!0,broadcast_id:!0,list_id:!0,events:!0,error:!1,created_at:!0},z=[{key:"is_sent",label:e.jsxs(u,{title:"Sent",children:[e.jsx(d,{className:"!mr-1 opacity-70 text-blue-500",icon:ie})," Sent"]}),options:[{value:"true",label:"Yes"},{value:"false",label:"No"}]},{key:"is_delivered",label:e.jsxs(u,{title:"Delivered",children:[e.jsx(d,{className:"!mr-1 opacity-70 text-green-500",icon:oe})," ","Delivered"]}),options:[{value:"true",label:"Yes"},{value:"false",label:"No"}]},{key:"is_failed",label:e.jsxs(u,{title:"Failed",children:[e.jsx(d,{className:"!mr-1 opacity-70 text-red-500",icon:ne})," Failed"]}),options:[{value:"true",label:"Yes"},{value:"false",label:"No"}]},{key:"is_opened",label:e.jsxs(u,{title:"Opened",children:[e.jsx(d,{className:"!mr-1 opacity-70 text-purple-500",icon:ce})," Opened"]}),options:[{value:"true",label:"Yes"},{value:"false",label:"No"}]},{key:"is_clicked",label:e.jsxs(u,{title:"Clicked",children:[e.jsx(d,{className:"!mr-1 opacity-70 text-blue-500",icon:ue})," Clicked"]}),options:[{value:"true",label:"Yes"},{value:"false",label:"No"}]},{key:"is_bounced",label:e.jsxs(u,{title:"Bounced",children:[e.jsx(d,{className:"!mr-1 opacity-70 text-orange-500",icon:de})," ","Bounced"]}),options:[{value:"true",label:"Yes"},{value:"false",label:"No"}]},{key:"is_complained",label:e.jsxs(u,{title:"Complained",children:[e.jsx(d,{className:"!mr-1 opacity-70 text-red-500",icon:me})," Complained"]}),options:[{value:"true",label:"Yes"},{value:"false",label:"No"}]},{key:"is_unsubscribed",label:e.jsxs(u,{title:"Unsubscribed",children:[e.jsx(d,{className:"!mr-1 opacity-70 text-red-500",icon:pe})," ","Unsubscribed"]}),options:[{value:"true",label:"Yes"},{value:"false",label:"No"}]},{key:"is_subscribed",label:e.jsxs(u,{title:"Subscribed",children:[e.jsx(d,{className:"!mr-1 opacity-70 text-green-600",icon:ye})," ","Subscribed"]}),options:[{value:"true",label:"Yes"},{value:"false",label:"No"}]}],V=[{key:"contact_email",label:"Contact Email"},{key:"id",label:"Message ID"},{key:"external_id",label:"External ID"},{key:"template_id",label:"Template ID"},{key:"broadcast_id",label:"Broadcast ID"},{key:"has_error",label:"Has Error",options:[{value:"true",label:"With Errors"},{value:"false",label:"No Errors"}]}],Y=[...z,...V],Se=({workspaceId:i})=>{const{workspaces:H}=ae(),[y,C]=o.useState(void 0),[I,g]=o.useState([]),[Q,F]=o.useState(!1),v=q(),[m,f]=o.useState([]),[x,j]=o.useState({}),[n,p]=o.useState({}),[$,E]=o.useState(R),{data:k}=N({queryKey:["broadcasts",i],queryFn:async()=>xe.list({workspace_id:i,limit:1e3}),staleTime:300*1e3}),{data:_}=N({queryKey:["lists",i],queryFn:async()=>he.list({workspace_id:i}),staleTime:300*1e3}),G=o.useMemo(()=>k?.broadcasts?new Map(k.broadcasts.map(t=>[t.id,t])):new Map,[k]),W=o.useMemo(()=>_?.lists?new Map(_.lists.map(t=>[t.id,t])):new Map,[_]),h=o.useMemo(()=>m.reduce((t,s)=>{const{field:a,value:r}=s;return a==="has_error"||a==="is_sent"||a==="is_delivered"||a==="is_failed"||a==="is_opened"||a==="is_clicked"||a==="is_bounced"||a==="is_complained"||a==="is_unsubscribed"||a==="is_subscribed"?t[a]=r==="true":t[a]=r,t},{}),[m]),M=H.find(t=>
1t.id===i);o.useEffect(()=>{const t=localStorage.getItem(D);if(t){const s=JSON.parse(t);E({...R,...s})}},[]);const J=(t,s)=>{E(a=>{const r={...a,[t]:s};return localStorage.setItem(D,JSON.stringify(r)),r})},S=()=>{const t=new URLSearchParams(window.location.search),s=[];Y.forEach(a=>{const r=t.get(a.key);r&&s.push({field:a.key,value:r,label:""})}),f(s)};o.useEffect(()=>(S(),window.addEventListener("popstate",S),()=>{window.removeEventListener("popstate",S)}),[]);const T=t=>{const s=new URLSearchParams;t.forEach(r=>{s.set(r.field,r.value)});const a=window.location.pathname+(s.toString()?`?${s.toString()}`:"");window.history.pushState({path:a},"",a)},{data:c,isLoading:w,error:A}=N({queryKey:["messages-history",i,h,y],queryFn:async()=>le(i,{...h,limit:20,cursor:y}),staleTime:5e3,refetchOnWindowFocus:!1});O.useEffect(()=>{g([]),C(void 0),v.resetQueries({queryKey:["messages-history",i]})},[h,i,v]),O.useEffect(()=>{w||!c||(c.messages&&(y?c.messages.length>0&&g(t=>[...t,...c.messages]):g(c.messages)),F(!1))},[c,y,w]);const X=()=>{c?.next_cursor&&(F(!0),C(c.next_cursor))},Z=(t,s)=>{const a=m.filter(r=>r.field!==t);s&&Y.find(l=>l.key===t)&&a.push({field:t,value:s,label:""}),f(a),T(a),j({...x,[t]:!1})},ee=t=>{const s=m.filter(a=>a.field!==t);f(s),T(s),p({...n,[t]:""}),j({...x,[t]:!1})},se=()=>{f([]),p({}),window.history.pushState({path:window.location.pathname},"",window.location.pathname)},L=t=>t.map(s=>{const a=m.some(l=>l.field===s.key),r=m.find(l=>l.field===s.key);return e.jsx(be,{trigger:"click",open:x[s.key],onOpenChange:l=>{l&&r&&p({...n,[s.key]:r.value}),j({...x,[s.key]:l})},content:e.jsxs("div",{style:{width:200},children:[s.options?s.options.length===2&&s.options.every(l=>l.value==="true"||l.value==="false")?e.jsx(B.Group,{style:{width:"100%",marginBottom:8},value:n[s.key]||void 0,onChange:l=>p({...n,[s.key]:l.target.value}),children:e.jsx("div",{className:"flex flex-col gap-1",children:s.options.map(l=>e.jsx(B,{value:l.value,children:l.label},l.value))})}):e.jsx(ge,{style:{width:"100%",marginBottom:8},placeholder:`Select ${s.label}`,value:n[s.key]||void 0,onChange:l=>p({...n,[s.key]:l}),options:s.options,allowClear:!0}):e.jsx(ve,{placeholder:`Enter ${s.label}`,value:n[s.key]||"",onChange:l=>p({...n,[s.key]:l.target.value}),style:{marginBottom:8},onKeyDown:l=>l.stopPropagation()}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(b,{type:"primary",size:"small",style:{flex:1},onClick:()=>Z(s.key,n[s.key]||""),children:"Apply"}),a&&e.jsx(b,{danger:!0,size:"small",onClick:()=>ee(s.key),children:"Clear"})]})]}),children:e.jsx(b,{type:a?"primary":"default",size:"small",children:a?e.jsxs("span",{children:[s.label,": ",r.value]}):s.label})},s.key)}),te=()=>e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-sm font-medium text-gray-600",children:"Status:"}),e.jsx(P,{wrap:!0,children:L(z)})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-sm font-medium text-gray-600",children:"Filters:"}),e.jsxs(P,{wrap:!0,children:[L(V),m.length>0&&e.jsx(b,{size:"small",onClick:se,children:"Clear All"})]})]})]});return A?e.jsxs("div",{children:[e.jsx(ke,{level:4,children:"Error loading data"}),e.jsx(_e,{type:"danger",children:A?.message})]}):M?e.jsxs("div",{children:[e.jsx("div",{className:"my-6",children:te()}),e.jsx(fe,{messages:I,loading:w,isLoadingMore:Q,workspace:M,nextCursor:c?.next_cursor,onLoadMore:X,show_email:!0,onRefresh:()=>{v.resetQueries({queryKey:["messages-history",i,h]})},bordered:!0,size:"middle",broadcastMap:G,listMap:W,visibleColumns:$,onColumnVisibilityChange:J})]}):e.jsx("div",{style:{textAlign:"center",padding:"40px 0"},children:e.jsx(U,{size:"small"})})},{Text:we}=K;function us(){const{workspaceId:i}=re({strict:!1});return q(),i?e.jsxs("div",{className:"p-6",children:[e.jsxs("div",{className:"mb-6",children:[e.jsx("div",{className:"text-2xl font-medium",children:"Logs"}),e.jsx(we,{type:"secondary",children:"Monitor message delivery status and webhook events"})]}),e.jsx(je,{defaultActiveKey:"messages",items:[{key:"messages",label:"Message History",children:e.jsx(Se,{workspaceId:i})}]})]}):e.jsx("div",{style:{textAlign:"center",padding:"40px 0"},children:e.jsx(U,{size:"small"})})}export{us as LogsPage};

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.