obs-admin-dashboard 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1 @@
1
+ import{a as d,u as c,r as m,f as u,j as s,D as x,b as g,A as p,c as f}from"./index-au6lwlT0.js";import{B as h}from"./badge-Cs6Fs9eg.js";const j="/user-logs",A=async t=>(await d.get(j,{params:{...t,userType:"ADMIN"}})).data,y=t=>c({queryKey:["admin-logs",t],queryFn:()=>A(t)});function N({data:t,isLoading:r,offset:i=0}){const n=m.useMemo(()=>[{id:"no",header:"No.",cell:({row:e})=>i+e.index+1},{id:"createdAt",header:"Date",cell:({row:e})=>{const a=e.original.createdAt;return a?u(a,"dd-MM-yyyy HH:mm"):"-"}},{id:"admin",header:"Admin",cell:({row:e})=>{const a=e.original.admin;return a?s.jsxs("div",{className:"flex flex-col",children:[s.jsx("span",{className:"font-medium",children:a.fullName}),s.jsx("span",{className:"text-xs text-muted-foreground",children:a.email})]}):"-"}},{accessorKey:"action",header:"Action",cell:({row:e})=>s.jsx(h,{variant:"outline",children:e.original.action})},{accessorKey:"description",header:"Description"},{id:"device",header:"Device / Browser",cell:({row:e})=>{const{device:a,browser:o,os:l}=e.original;return!a&&!o?"-":s.jsxs("div",{className:"flex flex-col",children:[s.jsx("span",{className:"text-sm",children:o||"-"}),s.jsx("span",{className:"text-xs text-muted-foreground",children:[a,l].filter(Boolean).join(" · ")})]})}},{accessorKey:"ipAddress",header:"IP Address",cell:({row:e})=>e.original.ipAddress||"-"}],[i]);return s.jsx(x,{data:t,columns:n,isLoading:r,emptyMessage:"No admin logs found."})}const D=()=>{const[t]=g(),r=t.get("page")??"1",i=t.get("limit")??"10",{data:n,isLoading:e}=y({page:r,limit:i}),a=n?.meta?.total??0,o=(Number(r)-1)*Number(i);return s.jsxs("div",{className:"flex flex-col",children:[s.jsx(p,{title:"Admin Logs",total:a,action:{type:"none"}}),s.jsxs("div",{className:"m-4 flex flex-col gap-0 rounded-lg bg-white",children:[s.jsx(N,{data:n?.data??[],isLoading:e,offset:o}),n?.meta&&s.jsx(f,{meta:n.meta})]})]})};export{D as default};
@@ -0,0 +1 @@
1
+ import{a as d,u,r as m,f as x,j as s,D as p,b as h,A as f,c as g}from"./index-au6lwlT0.js";import{B as l}from"./badge-Cs6Fs9eg.js";const j="/audit-logs?userType=ADMIN",y=async t=>(await d.get(j,{params:{...t}})).data,N=t=>u({queryKey:["audit-logs",t],queryFn:()=>y(t)});function A({data:t,isLoading:r,offset:i=0}){const n=m.useMemo(()=>[{id:"no",header:"No.",cell:({row:a})=>i+a.index+1},{id:"createdAt",header:"Date",cell:({row:a})=>{const e=a.original.createdAt;return e?x(new Date(e),"dd-MM-yyyy HH:mm"):"-"}},{id:"admin",header:"Admin",cell:({row:a})=>{const e=a.original.admin;return e?s.jsxs("div",{className:"flex flex-col",children:[s.jsx("span",{className:"font-medium",children:e.fullName}),s.jsx("span",{className:"text-xs text-muted-foreground",children:e.email})]}):"-"}},{accessorKey:"resourceType",header:"Resource",cell:({row:a})=>{const e=a.original.resourceType;return e?s.jsx("span",{className:"capitalize",children:e}):"-"}},{accessorKey:"action",header:"Action",cell:({row:a})=>s.jsx(l,{variant:"outline",className:"capitalize",children:a.original.action})},{id:"requestInfo",header:"Request Info",cell:({row:a})=>{const e=a.original.metadata;return!e?.method&&!e?.url?"-":s.jsxs("div",{className:"flex flex-col gap-1 max-w-[200px]",children:[e.method&&s.jsx(l,{variant:"secondary",className:"w-fit text-[10px] px-1 py-0 uppercase",children:e.method}),e.url&&s.jsx("span",{className:"text-xs text-muted-foreground truncate",title:e.url,children:e.url})]})}},{accessorKey:"description",header:"Description"},{id:"device",header:"Device / Browser",cell:({row:a})=>{const{device:e,browser:c,os:o}=a.original;return!e&&!c?"-":s.jsxs("div",{className:"flex flex-col",children:[s.jsx("span",{className:"text-sm",children:c||"-"}),s.jsx("span",{className:"text-xs text-muted-foreground",children:[e,o].filter(Boolean).join(" · ")})]})}},{accessorKey:"ipAddress",header:"IP Address",cell:({row:a})=>{const e=a.original.ipAddress;return e?s.jsx("span",{className:"text-xs",children:e.split(",")[0].trim()}):"-"}}],[i]);return s.jsx(p,{data:t,columns:n,isLoading:r,emptyMessage:"No audit logs found."})}const D=()=>{const[t]=h(),r=t.get("page")??"1",i=t.get("limit")??"10",{data:n,isLoading:a}=N({page:r,limit:i}),e=(parseInt(r,10)-1)*parseInt(i,10);return s.jsxs("div",{className:"flex h-full flex-col",children:[s.jsx(f,{title:"Audit Logs",action:{type:"none"}}),s.jsx("div",{className:"m-4 flex-1 space-y-4",children:s.jsxs("div",{className:"rounded-md bg-white p-4 shadow-sm",children:[s.jsx(A,{data:n?.data??[],isLoading:a,offset:e}),n?.meta&&s.jsx("div",{className:"mt-4",children:s.jsx(g,{meta:n.meta})})]})})]})};export{D as default};
@@ -0,0 +1 @@
1
+ import{r as l,j as a,A as d,B as o}from"./index-au6lwlT0.js";import{R as y}from"./RichTextEditor-CAtXb3v9.js";import{b as m,c as v}from"./useSettings-DO84-Dur.js";function u(){const{data:e,isLoading:c}=m(),{mutate:n,isPending:i}=v(),[t,s]=l.useState("");l.useEffect(()=>{e?.data?.privacyPolicy&&s(e.data.privacyPolicy)},[e]);const r=()=>{n({privacyPolicy:t})};return a.jsxs("div",{className:"flex flex-col",children:[a.jsx(d,{title:"Privacy Policy"}),a.jsxs("div",{className:"m-4 rounded-lg bg-white p-6",children:[a.jsx("label",{className:"mb-2 block text-sm font-medium",children:"Privacy Policy"}),a.jsx(y,{value:t,onChange:s,placeholder:"Define Privacy Policy",disabled:c}),a.jsxs("div",{className:"mt-4 flex justify-end gap-2",children:[a.jsx(o,{variant:"outline",onClick:()=>s(e?.data?.privacyPolicy??""),disabled:i,children:"Cancel"}),a.jsx(o,{onClick:r,disabled:i||c,children:i?"Saving...":"Save Changes"})]})]})]})}export{u as default};