PageSourceSearch

https://dashboard.orderlyne.app/assets/NucleusDashboard.ClvoNRQL.js

js orderlyne.app collected 2026-09-28 06:15:11 UTC 18,139 bytes, 1 lines download raw bytes

1import{j as e,P as u,af as D,k as f,g as j,r as h,aO as L,q as A,aN as $,aj as O,aP as I,av as P,aQ as R,aR as y,E,aS as N,u as U,aT as F,aU as H,aV as M,aW as Q,aX as V,aY as q,aZ as k,o as B,a_ as K,a$ as X,b0 as J,b1 as W,w as Y}from"./index.BZs0H5f9.js";import{T as v}from"./trending-up.B75DxNRP.js";import{T as Z}from"./trending-down.8UvHIUck.js";import{f as w}from"./formatDistanceToNow.C4hHCIHF.js";const z=s=>{switch(s){case"success":return"bg-green-500";case"warning":return"bg-yellow-500";case"error":return"bg-red-500";default:return"bg-blue-500"}},G=s=>{switch(s){case"success":return"text-green-600 dark:text-green-400";case"warning":return"text-yellow-600 dark:text-yellow-400";case"error":return"text-red-600 dark:text-red-400";default:return"text-blue-600 dark:text-blue-400"}},ee=({title:s,value:r,icon:i,trend:t,trendValue:a,status:n})=>e.jsxs("div",{className:"bg-white dark:bg-gray-900 rounded-lg border border-gray-200/80 dark:border-gray-800 p-3.5 sm:p-4",children:[e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:`h-1.5 w-1.5 rounded-full ${z(n)}`}),e.jsx("span",{className:"text-[11px] font-semibold text-gray-400 uppercase tracking-wider",children:s})]}),e.jsx("div",{className:"bg-gray-50 dark:bg-gray-800 rounded-md p-1.5",children:e.jsx(i,{className:`h-3.5 w-3.5 ${G(n)}`})})]}),e.jsx("div",{className:"text-lg sm:text-xl font-bold text-gray-900 dark:text-gray-100",children:r}),t&&e.jsxs("div",{className:"flex items-center mt-1.5 gap-1 text-xs",children:[t==="up"?e.jsx(v,{className:"h-3 w-3 text-green-600 dark:text-green-400"}):e.jsx(Z,{className:"h-3 w-3 text-red-600 dark:text-red-400"}),e.jsx("span",{className:t==="up"?"text-green-600 dark:text-green-400":"text-red-600 dark:text-red-400",children:a}),e.jsx("span",{className:"text-gray-500 hidden sm:inline",children:"vs yesterday"})]})]});function se({stats:s,isLoading:r}){if(r)return e.jsx("div",{className:"grid grid-cols-2 lg:grid-cols-4 gap-3 sm:gap-4",children:[...Array(4)].map((t,a)=>e.jsxs("div",{className:"bg-white dark:bg-gray-900 rounded-lg border border-gray-200/80 dark:border-gray-800 p-3.5 sm:p-4",children:[e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[e.jsx("div",{className:"h-3 w-20 sm:w-24 bg-gray-100 dark:bg-gray-800 rounded animate-pulse"}),e.jsx("div",{className:"h-7 w-7 bg-gray-100 dark:bg-gray-800 rounded-md animate-pulse"})]}),e.jsx("div",{className:"h-6 sm:h-7 w-12 sm:w-16 bg-gray-100 dark:bg-gray-800 rounded animate-pulse"}),e.jsx("div",{className:"h-3 w-24 sm:w-32 bg-gray-100 dark:bg-gray-800 rounded animate-pulse mt-2"})]},a))});const i=[{title:"Active Shipments",value:s?.active_shipments||0,icon:u,status:"default",trend:s?.active_shipments_trend>0?"up":"down",trendValue:`${Math.abs(s?.active_shipments_trend||0)}%`},{title:"Delivered Today",value:s?.delivered_today||0,icon:D,status:"success",trend:s?.delivered_today_trend>0?"up":"down",trendValue:`${Math.abs(s?.delivered_today_trend||0)}%`},{title:"Pending Pickups",value:s?.pending_pickups||0,icon:f,status:s?.pending_pickups>0?"warning":"default",trend:s?.pending_pickups_trend>0?"up":"down",trendValue:`${Math.abs(s?.pending_pickups_trend||0)}%`},{title:"Failed Deliveries",value:s?.failed_deliveries||0,icon:j,status:s?.failed_deliveries>0?"error":"default",trend:s?.failed_deliveries_trend>0?"up":"down",trendValue:`${Math.abs(s?.failed_deliveries_trend||0)}%`}];return e.jsx("div",{className:"grid grid-cols-2 lg:grid-cols-4 gap-3 sm:gap-4",children:i.map((t,a)=>e.jsx(ee,{...t},a))})}const ae=({courierSlug:s,health:r})=>{const[i,t]=h.useState(!1),a=r.issues&&r.issues.length>0,n=()=>r.healthy?e.jsx(I,{className:"h-4 w-4 text-emerald-600"}):a?e.jsx(P,{className:"h-4 w-4 text-red-500"}):e.jsx(f,{className:"h-4 w-4 text-gray-400"}),o=()=>r.healthy?e.jsxs("span",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-500"}),e.jsx("span",{className:"text-xs font-medium text-gray-600 dark:text-gray-400",children:"Online"})]}):a?e.jsxs("span",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-red-400"}),e.jsx("span",{className:"text-xs font-medium text-gray-600 dark:text-gray-400",children:"Issues"})]}):e.jsxs("span",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-gray-400"}),e.jsx("span",{className:"text-xs font-medium text-gray-600 dark:text-gray-400",children:"Unknown"})]}),d=l=>l.charAt(0).toUpperCase()+l.slice(1);return e.jsxs("div",{className:"rounded-md border border-gray-100 dark:border-gray-800 overflow-hidden",children:[e.jsxs("div",{className:`flex items-center justify-between gap-2 px-3 py-2.5 transition-colors ${a?"hover:bg-[#f8f8f9] dark:hover:bg-gray-800/50 cursor-pointer":""}`,onClick:()=>a&&t(!i),children:[e.jsxs("div",{className:"flex items-center gap-2.5 min-w-0",children:[n(),e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"text-sm font-medium text-gray-900 dark:text-gray-100 truncate",children:d(s)}),e.jsx("div",{className:"text-xs text-gray-500 hidden sm:block",children:r.last_checked?e.jsxs(e.Fragment,{children:["Last checked ",w(new Date(r.last_checked),{addSuffix:!0})]}):"Never checked"})]})]}),e.jsxs("div",{className:"flex items-center gap-2.5 flex-shrink-0",children:[a&&e.jsxs("span",{className:"text-xs text-red-500 hidden sm:inline",children:[r.issues.length," issue",r.issues.length>
11?"s":""]}),o(),a&&e.jsx("button",{className:"h-7 w-7 rounded-md flex items-center justify-center text-gray-400 hover:text-gray-600 hover:bg-gray-100 dark:hover:bg-gray-800 transition-colors",onClick:l=>{l.stopPropagation(),t(!i)},children:i?e.jsx($,{className:"h-3.5 w-3.5"}):e.jsx(O,{className:"h-3.5 w-3.5"})})]})]}),a&&i&&e.jsx("div",{className:"px-3 pb-3 pt-0 bg-red-50/60 dark:bg-red-950/20 border-t border-gray-100 dark:border-gray-800",children:e.jsx("div",{className:"space-y-2 mt-2",children:r.issues.map((l,x)=>e.jsxs("div",{className:"flex items-start gap-2 text-xs",children:[e.jsx(j,{className:"h-3 w-3 text-red-500 mt-0.5 flex-shrink-0"}),e.jsx("span",{className:"text-red-700 dark:text-red-400",children:l})]},x))})})]})};function re({healthData:s,isLoading:r,onRefresh:i}){const[t,a]=h.useState(!1),n=async()=>{if(i&&typeof i=="function"){a(!0);try{await i()}catch(c){console.error("Failed to refresh courier health:",c)}finally{a(!1)}}};if(r)return e.jsxs("div",{className:"bg-white dark:bg-gray-900 rounded-lg border border-gray-200/80 dark:border-gray-800",children:[e.jsx("div",{className:"px-4 sm:px-5 py-4 border-b border-gray-100 dark:border-gray-800",children:e.jsx("div",{className:"h-4 w-32 bg-gray-100 dark:bg-gray-800 rounded animate-pulse"})}),e.jsx("div",{className:"px-4 sm:px-5 py-4 space-y-3",children:[...Array(3)].map((c,g)=>e.jsxs("div",{className:"flex items-center justify-between px-3 py-2.5 rounded-md border border-gray-100 dark:border-gray-800",children:[e.jsxs("div",{className:"flex items-center gap-2.5",children:[e.jsx("div",{className:"h-4 w-4 bg-gray-100 dark:bg-gray-800 rounded-full animate-pulse"}),e.jsxs("div",{children:[e.jsx("div",{className:"h-4 w-20 sm:w-24 bg-gray-100 dark:bg-gray-800 rounded animate-pulse"}),e.jsx("div",{className:"h-3 w-24 sm:w-32 bg-gray-100 dark:bg-gray-800 rounded animate-pulse mt-1 hidden sm:block"})]})]}),e.jsx("div",{className:"h-4 w-14 sm:w-16 bg-gray-100 dark:bg-gray-800 rounded animate-pulse"})]},g))})]});const o=s?.couriers||s||{},d=Object.entries(o),l=d.filter(([c,g])=>g?.healthy).length,x=d.length;return e.jsxs("div",{className:"bg-white dark:bg-gray-900 rounded-lg border border-gray-200/80 dark:border-gray-800",children:[e.jsx("div",{className:"px-4 sm:px-5 py-4 border-b border-gray-100 dark:border-gray-800",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("span",{className:"text-[11px] font-semibold text-gray-400 uppercase tracking-wider flex items-center gap-1.5",children:[e.jsx(L,{className:"h-3.5 w-3.5"}),"Courier Health"]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-500"}),e.jsxs("span",{className:"text-xs font-medium text-gray-600 dark:text-gray-400",children:[l,"/",x," Online"]})]}),e.jsx("button",{onClick:n,disabled:t,className:"h-7 w-7 rounded-md flex items-center justify-center text-gray-400 hover:text-gray-600 hover:bg-gray-100 dark:hover:bg-gray-800 transition-colors disabled:opacity-50",children:e.jsx(A,{className:`h-3.5 w-3.5 ${t?"animate-spin":""}`})})]})]})}),e.jsx("div",{className:"px-4 sm:px-5 py-4 space-y-3",children:d.length>0?d.map(([c,g])=>e.jsx(ae,{courierSlug:c,health:g},c)):e.jsx("div",{className:"text-center py-8 text-gray-500",children:"No courier health data available"})})]})}const te={pending_pickup:"bg-amber-400",picked_up:"bg-blue-400",in_transit:"bg-violet-500",out_for_delivery:"bg-emerald-400",delivered:"bg-green-600",failed:"bg-red-400",rto:"bg-orange-500",cancelled:"bg-gray-400"},ie=({shipment:s,onClick:r})=>{const i=()=>{switch(s.status){case"picked_up":return e.jsx(u,{className:"h-4 w-4 text-gray-500"});case"in_transit":return e.jsx(N,{className:"h-4 w-4 text-gray-500"});case"out_for_delivery":return e.jsx(y,{className:"h-4 w-4 text-gray-500"});default:return e.jsx(u,{className:"h-4 w-4 text-gray-500"})}},t=a=>a?typeof a=="string"?a:a.hub?`${a.city||a.hub}${a.state?", "+a.state:""}`:a.origin?a.origin:JSON.stringify(a):null;return e.jsxs("div",{className:"group cursor-pointer hover:bg-[#f8f8f9] dark:hover:bg-gray-800/50 transition-colors duration-100 flex items-center gap-3 px-4 sm:px-5 py-3",onClick:()=>r(s),children:[e.jsx("div",{className:"flex-shrink-0",children:e.jsx("div",{className:"h-8 w-8 rounded-full bg-gray-50 dark:bg-gray-800 flex items-center justify-center",children:i()})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-0.5",children:[e.jsxs("span",{className:"text-sm font-medium text-gray-900 dark:text-gray-100",children:["#",s.awb]}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:`h-1.5 w-1.5 rounded-full ${te[s.status]||"bg-gray-400"}`}),e.jsx("span",{className:"text-xs font-medium text-gray-600 dark:text-gray-400",children:R[s.status]})]})]}),e.jsxs("div",{className:"flex items-center text-xs text-gray-700 dark:text-gray-300 mb-0.5",children:[e.jsx("span",{className:"font-medium",children:s.courier_name}),e.jsx("span",{className:"mx-1.5 text-gray-300 dark:text-gray-600",children:"·"}),e.jsx("span",{className:"truncate",children:s.destination_city})]}),s.current_location&&e.jsxs("div",{className:"flex items-center text-xs text-gray-500",children:[e.jsx(y,{className:"h-3 w-3 mr-1 flex-shrink-0"}),e.jsx("span",{className:"truncate",children:t(s.current_location)})]})]}),e.jsx("span",{className:"text-[11px] text-gray-300 dark:text-gray-600 flex-shrink-0 hidden sm:block",children:w(new Date(s.updated_at),{addSuffix:!0})}),e.jsx("button",{className:"flex-shrink-0 h-7 w-7 flex items-center justify-center rounded-md text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 opacity-0 group-hover:opacity-100 transition-opacity",onClick:a=>{a.stopPropagation(),r(s)},children:e.jsx(E,{className:"h-3.5 w-3.5"})})]})};function ne({shipments:s,isLoading:r,onShipmentClick:i,title:t="Out for Delivery Today"}){return r?e.jsxs("div",{className:"bg-white dark:bg-gray-900 rounded-lg border border-gray-200/80 dark:border-gray-800",children:[e.jsx("div",{className:"px-4 sm:px-5 py-4 border-b border-gray-100 dark:border-gray-800",children:e.jsx("span",{className:"text-[11px] font-semibold text-gray-400 uppercase tracking-wider",children:t})}),e.jsx("div",{className:"px-4 sm:px-5 py-4",children:e.jsx("div",{className:"space-y-4",children:[...Array(4)].map((a,n)=>e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"h-8 w-8 bg-gray-100 dark:bg-gray-800 rounded-full animate-pulse flex-shrink-0"}),e.jsxs("div",{className:"flex-1",children:[e.jsx("div",{className:"h-3.5 w-28 sm:w-32 bg-gray-100 dark:bg-gray-800 rounded animate-pulse mb-2"}),e.jsx("div",{className:"h-3 w-36 sm:w-48 bg-gray-100 dark:bg-gray-800 rounded animate-pulse mb-1.5"}),e.jsx("div",{className:"h-3 w-20 sm:w-24 bg-gray-100 dark:bg-gray-800 rounded animate-pulse"})]})]},n))})})]}):e.jsxs("div",{className:"bg-white dark:bg-gray-900 rounded-lg border border-gray-200/80 dark:border-gray-800",children:[e.jsxs("div",{className:"px-4 sm:px-5 py-4 border-b border-gray-100 dark:border-gray-800 flex items-center justify-between",children:[e.jsx("span",{className:"text-[11px] font-semibold text-gray-400 uppercase tracking-wider flex items-center gap-1.5",children:t}),e.jsxs("span",{className:"text-xs font-medium text-gray-500",children:[s?.length||0," shipments"]})]}),s&&s.length>0?e.jsx("div",{className:"divide-y divide-gray-100/70 dark:divide-gray-800/50",children:s.map(a=>e.jsx(ie,{shipment:a,onClick:i},a.id))}):e.jsxs("div",{className:"px-4 sm:px-5 py-12 flex flex-col items-center justify-center",children:[e.jsx("div",{className:"w-12 h-12 rounded-full bg-gray-100 dark:bg-gray-800 flex items-center justify-center mb-4",children:e.jsx(u,{className:"h-5 w-5 text-gray-400"})}),e.jsx("span",{className:"text-sm text-gray-500",children:"No shipments found"})]})]})}const de=[{key:"shipment",label:"New Shipment",sub:"Create without order",icon:u,color:"text-blue-600",path:null},{key:"shipments",label:"Shipments",sub:"Track and manage",icon:N,color:"text-emerald-600",path:"/nucleus/shipments"},{key:"couriers",label:"Couriers",sub:"Configure partners",icon:J,color:"text-violet-500",path:"/nucleus/couriers"},{key:"stats",label:"Statistics",sub:"Performance metrics",icon:W,color:"text-amber-500",path:"/nucleus/couriers/stats"},{key:"pickup",label:"Pickup",sub:"Manage addresses",icon:y,color:"text-red-500",path:"/nucleus/pickup-addresses"}];function b({navigate:s,className:r="",onCreateShipment:i,hasRestrictions:t}){return e.jsx("div",{className:`grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-5 ga
1p-3 sm:gap-4 ${r}`,children:de.map(({key:a,label:n,sub:o,icon:d,color:l,path:x})=>e.jsxs("button",{onClick:()=>a==="shipment"?i():s(x),className:"group bg-white dark:bg-gray-900 rounded-lg border border-gray-200/80 dark:border-gray-800 p-3.5 sm:p-4 text-left transition-colors hover:bg-[#f8f8f9] dark:hover:bg-gray-800/50",children:[e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"h-9 w-9 rounded-lg bg-gray-50 dark:bg-gray-800 flex items-center justify-center flex-shrink-0",children:a==="shipment"&&t?e.jsx(k,{className:"h-4 w-4 text-amber-500"}):e.jsx(d,{className:`h-4 w-4 ${l}`})}),e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"text-sm font-semibold text-gray-900 dark:text-gray-100 flex items-center gap-1",children:[n,a==="shipment"&&t&&e.jsx("span",{className:"text-[10px] text-amber-500 font-medium",children:"(Locked)"})]}),e.jsx("div",{className:"text-xs text-gray-500 mt-0.5 hidden sm:block",children:o})]})]}),e.jsx(Y,{className:"h-3.5 w-3.5 text-gray-300 dark:text-gray-600 mt-2 ml-auto opacity-0 group-hover:opacity-100 transition-opacity"})]},a))})}function ge(){const s=U(),r=F(),[i,t]=h.useState("today"),[a,n]=h.useState(!1),{canUseFulfillment:o,hasRestrictions:d}=H(),{data:l,isLoading:x}=M({range:i}),{data:c,isLoading:g}=Q(),{data:_,isLoading:C}=V({status:"out_for_delivery",limit:10}),S=async()=>{try{const m=await K.getCourierHealth(!0);return r.setQueryData(X.courierHealth(),m),m}catch(m){throw console.error("Failed to refresh courier health:",m),m}},T=m=>{s(`/nucleus/shipments/${m.id}`)},p=()=>{if(!o){n(!0);return}s("/nucleus/shipments/new")};return e.jsxs("div",{className:"min-h-screen bg-[#f6f6f7] dark:bg-gray-950 p-3 sm:p-6",children:[e.jsx(q,{open:a,onOpenChange:n,feature:"shipping"}),e.jsxs("div",{className:"max-w-[1400px] mx-auto space-y-5",children:[e.jsxs("div",{className:"flex items-end justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"font-heading text-2xl sm:text-3xl tracking-tight text-gray-900 dark:text-gray-100",children:"Nucleus"}),e.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400 mt-0.5 hidden sm:block",children:"Manage all your shipping operations from one place"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("button",{onClick:()=>s("/nucleus/analytics"),className:"h-8 rounded-md text-xs font-medium border border-gray-200 dark:border-gray-700 text-gray-600 dark:text-gray-400 hover:bg-gray-50 dark:hover:bg-gray-800 transition-colors inline-flex items-center justify-center gap-1.5 px-3",children:[e.jsx(v,{className:"h-3.5 w-3.5"}),e.jsx("span",{className:"hidden sm:inline",children:"Analytics"})]}),e.jsxs("button",{onClick:p,className:d?"h-8 rounded-md text-xs font-medium border border-gray-200 dark:border-gray-700 text-gray-600 dark:text-gray-400 hover:bg-gray-50 dark:hover:bg-gray-800 transition-colors inline-flex items-center justify-center gap-1.5 px-3":"h-8 rounded-md text-xs font-medium bg-gray-900 hover:bg-gray-800 text-white dark:bg-gray-100 dark:text-gray-900 dark:hover:bg-gray-200 transition-colors inline-flex items-center justify-center gap-1.5 px-3",children:[d?e.jsx(k,{className:"h-3.5 w-3.5 text-amber-500"}):e.jsx(B,{className:"h-3.5 w-3.5"}),e.jsx("span",{className:"hidden sm:inline",children:"New Shipment"})]})]})]}),e.jsx(b,{navigate:s,className:"sm:hidden",onCreateShipment:p,hasRestrictions:d}),e.jsx(se,{stats:l,isLoading:x}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-4 sm:gap-5",children:[e.jsx("div",{className:"lg:col-span-2",children:e.jsx(ne,{shipments:_?.shipments,isLoading:C,onShipmentClick:T,title:"Out for Delivery Today"})}),e.jsx("div",{className:"lg:col-span-1",children:e.jsx(re,{healthData:c,isLoading:g,onRefresh:S})})]}),e.jsx(b,{navigate:s,className:"hidden sm:grid",onCreateShipment:p,hasRestrictions:d})]})]})}export{ge 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.