PageSourceSearch

https://app.messengeros.com/horizon/assets/StoreDebugLogs-C0msi0Hx.js

js messengeros.com collected 2026-10-02 06:29:34 UTC 6,437 bytes, 1 lines download raw bytes

1import{j as e}from"./vendor-ui-DNFRBAK8.js";import{r as n,aC as W,c5 as T,a9 as D,c6 as K,c7 as $,ab as V,X as O,c8 as R}from"./vendor-misc-B-s0Eum6.js";import{a as j}from"./vendor-query-D98lSBM1.js";import{S as y,b as S,d as C,e as L,f as N,B,j as d,I as G,a as w}from"./index-SVj9NVCc.js";import"./vendor-react-3U1FxrJe.js";const H=["50","100","200","500","1000","2000","5000"];function U(){const[r,F]=n.useState(""),[m,k]=n.useState("200"),[x,u]=n.useState(0),[o,c]=n.useState(""),[a,v]=n.useState(null),{data:h}=j({queryKey:["ecommerce-stores"],queryFn:async()=>{const s=await w.get("/backend/ecommerce/stores");if(!s.ok)throw new Error("Failed to fetch stores");return s.json()}}),b=((h==null?void 0:h.data)??[]).filter(s=>s.platform==="woocommerce"),{data:l,isLoading:_,isError:E}=j({queryKey:["store-status",r],queryFn:async()=>{const s=await w.get(`/backend/ecommerce/stores/${r}/status`),t=await s.json();if(!s.ok)throw new Error((t==null?void 0:t.error)??"Failed to fetch status");return t},enabled:!!r,staleTime:6e4,retry:!1}),{data:g,error:f,isFetching:i}=j({queryKey:["store-debug-logs",r,m,x],queryFn:async()=>{const s=await w.get(`/backend/ecommerce/stores/${r}/logs?lines=${m}&_t=${Date.now()}`),t=await s.json();if(!s.ok)throw new Error((t==null?void 0:t.error)??"Failed to fetch logs");return t},enabled:x>0&&!!r,staleTime:1/0,refetchOnWindowFocus:!1,retry:!1});n.useEffect(()=>{g&&v(g)},[g]);const p=n.useMemo(()=>{if(!a)return[];const s=o.trim().toLowerCase(),t=[...a.logs].reverse();return s?t.filter(P=>P.toLowerCase().includes(s)):t},[a,o]),I=()=>{r&&(u(s=>s+1),c(""))},q=s=>{F(s),u(0),c(""),v(null)},z=s=>{k(s),u(0),c("")};return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold tracking-tight",children:"Plugin Debug Logs"}),e.jsx("p",{className:"text-muted-foreground text-sm mt-1",children:"View real-time plugin logs fetched directly from the WooCommerce store."})]}),e.jsxs("div",{className:"flex gap-2 flex-wrap items-center",children:[e.jsxs(y,{value:r,onValueChange:q,children:[e.jsx(S,{className:"w-64",children:e.jsx(C,{placeholder:"Select a WooCommerce store"})}),e.jsx(L,{children:b.length===0?e.jsx(N,{value:"__none",disabled:!0,children:"No WooCommerce stores found"}):b.map(s=>e.jsx(N,{value:String(s.id),children:s.name},s.id))})]}),e.jsxs(y,{value:m,onValueChange:z,children:[e.jsx(S,{className:"w-28",children:e.jsx(C,{})}),e.jsx(L,{children:H.map(s=>e.jsxs(N,{value:s,children:["Last ",s]},s))})]}),e.jsxs(B,{onClick:I,disabled:!r||i,children:[e.jsx(W,{className:`h-4 w-4 mr-2 ${i?"animate-spin":""}`}),i?"Fetching…":"Fetch Logs"]})]}),r&&e.jsx("div",{className:"rounded-lg border bg-muted/40 px-4 py-3",children:_?e.jsxs("div",{className:"flex gap-6",children:[e.jsx(d,{className:"h-4 w-32"}),e.jsx(d,{className:"h-4 w-24"}),e.jsx(d,{className:"h-4 w-24"}),e.jsx(d,{className:"h-4 w-20"})]}):E?e.jsx("p",{className:"text-sm text-muted-foreground",children:"Could not load plugin version info."}):l?e.jsxs("div",{className:"flex flex-wrap gap-x-6 gap-y-2 text-sm",children:[e.jsxs("span",{className:"flex items-center gap-1.5",children:[e.jsx(T,{className:"h-3.5 w-3.5 text-muted-foreground"}),e.jsx("span",{className:"text-muted-foreground",children:"Plugin"}),e.jsxs("span",{className:"font-mono font-medium",children:["v",l.plugin_version]})]}),e.jsxs("span",{className:"flex items-center gap-1.5",children:[e.jsx(D,{className:"h-3.5 w-3.5 text-muted-foreground"}),e.jsx("span",{className:"text-muted-foreground",children:"WordPress"}),e.jsx("span",{className:"font-mono font-medium",children:l.wp_version})]}),l.wc_version&&e.jsxs("span",{className:"flex items-center gap-1.5",children:[e.jsx(K,{className:"h-3.5 w-3.5 text-muted-foreground"}),e.jsx("span",{className:"text-muted-foreground",children:"WooCommerce"}),e.jsx("span",{className:"font-mono font-medium",children:l.wc_version})]}),e.jsxs("span",{className:"flex items-center gap-1.5",children:[e.jsx($,{className:"h-3.5 w-3.5 text-muted-foreground"}),e.jsx("span",{className:"text-muted-foreground",children:"PHP"}),e.jsx("span",{className:"font-mono font-medium",children:l.php_version})]})]}):null}),f&&e.jsx("div",{className:"rounded-lg border border-destructive/40 bg-destructive/10 px-4 py-3 text-sm text-destructive",children:f.message}),a&&e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between text-sm text-muted-foreground flex-wrap gap-2",children:[e.jsxs("span",{children:[e.jsx("span",{className:"font-medium text-foreground",children:a.count})," entries from"," ",e.jsx("span",{className:"font-medium text-foreground",children:a.site_url}),o&&e.jsxs("span",{className:"ml-2",children:["— ",e.jsx("span",{className:"font-medium text-foreground",children:p.length})," matching"]})]}),e.jsxs("span",{children:["Fetched at ",new Date(a.timestamp*1e3).toLocaleTimeString()]})]}),e.jsxs("div",{className:"relative",children:[e.jsx(V,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-muted-foreground"}),e.jsx(G,{className:"pl-9 pr-9 font-mono text-sm",placeholder:"Filter log lines…",value:o,onChange:s=>c(s.target.value)}),o&&e.jsx("button",{onClick:()=>c(""),className:"absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground",children:e.jsx(O,{className:"h-3.5 w-3.5"})})]}),e.jsxs("div",{className:"rounded-lg border bg-zinc-950 text-zinc-100 font-mono text-xs overflow-hidden",children:[e.jsxs("div",{className:"flex items-center gap-2 px-4 py-2 border-b border-zinc-800 bg-zinc-900",children:[e.jsx(R,{className:"h-3.5 w-3.5 text-zinc-400"}),e.jsx("span",{className:"text-zinc-400",children:"messengeros_debug.log"})]}),e.jsx("div",{className:"overflow-x-auto overflow-y-auto max-h-[600px] p-4 space-y-1",children:p.length===0?e.jsx("p",{className:"text-zinc-500 italic",children:o?"No lines match your filter.":"No log entries found."}):p.map((s,t)=>e.jsx("div",{className:"leading-relaxed whitespace-pre-wrap break-all",children:s},t))})]})]}),!a&&!f&&!i&&r&&x===0&&e.jsx("div",{className:"rounded-lg border border-dashed p-8 text-center text-muted-foreground text-sm",children:'Click "Fetch Logs" to load the latest plugin logs from this store.'}),!r&&e.jsx("div",{className:"rounded-lg border border-dashed p-8 text-center text-muted-foreground text-sm",children:"Select a WooCommerce store to view its debug logs."})]})}
1export{U 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.