PageSourceSearch

https://www.butterworthsmenswear.com/assets/LoveTheSales-Dv0snVtf.js

js butterworthsmenswear.com collected 2026-10-09 23:14:43 UTC 24,035 bytes, 1 lines download raw bytes

1import{r as c,w as Ce,i as Le,a as j,c as r,b as l,j as t,x as se,K as ae,g as M,l as ie,y as R,I as h,B as n,aj as _e,a7 as Te,o as Ae,n as $e,T as Oe,Y as le,Z as ne,_ as re,$ as de,a0 as q,ah as Ee,h as y}from"./index-DQRZPzqR.js";import{S as oe}from"./switch-Cn5Eqn5D.js";import{A as ze}from"./AdminHelp-DF3w7Cim.js";import{R as w}from"./refresh-cw-BeeM0BPT.js";import"./circle-help-fA1Od6Ct.js";const Fe={1:{label:"Pending",color:"bg-yellow-500/20 text-yellow-400"},2:{label:"Released for Shipment",color:"bg-blue-500/20 text-blue-400"},3:{label:"Acknowledged",color:"bg-purple-500/20 text-purple-400"},4:{label:"Partially Shipped",color:"bg-orange-500/20 text-orange-400"},5:{label:"Shipped",color:"bg-green-500/20 text-green-400"},6:{label:"Cancelled",color:"bg-red-500/20 text-red-400"}},Ie=["ItemNotAvailable","CouldNotShip","AlternateItemProvided","BuyerCanceled","ShippingAddressUndeliverable","GeneralAdjustment","Other"];function De(){const[S,ce]=c.useState("products"),[k,xe]=c.useState(""),[P,me]=c.useState(""),[ue,he]=c.useState(null),[pe,K]=c.useState({}),[U,ge]=c.useState({}),[be,p]=c.useState(null),[C,ve]=c.useState(""),{toast:s}=Ce(),f=Le(),{data:g}=j({queryKey:["/api/admin/lts/stats"],refetchInterval:6e4}),{data:D=[],isLoading:je}=j({queryKey:["/api/admin/lts/products"]}),{data:fe=[],isLoading:Ne}=j({queryKey:["/api/admin/lts/orders"]}),{data:L}=j({queryKey:["/api/admin/lts/settings"]}),{data:_}=j({queryKey:["/api/admin/products"]}),ye=Array.isArray(_)?_:_?.products??[],[we,Se]=c.useState(!1);L&&!we&&(p(L),Se(!0));const d=()=>{f.invalidateQueries({queryKey:["/api/admin/lts/products"]}),f.invalidateQueries({queryKey:["/api/admin/lts/orders"]}),f.invalidateQueries({queryKey:["/api/admin/lts/stats"]})},x=r({mutationFn:e=>l("POST","/api/admin/lts/products/push",e?{ids:e}:{}).then(a=>a.json()),onSuccess:e=>{const a=e.pendingValidation?`, ${e.pendingValidation} awaiting confirmation from Love The Sales`:"";s({title:"Products pushed",description:`${e.pushed} product(s) confirmed live${a}`}),d(),f.invalidateQueries({queryKey:["/api/admin/lts/products/push-progress"]})},onError:e=>s({title:"Push failed",description:e.message,variant:"destructive"})}),T=r({mutationFn:()=>l("POST","/api/admin/lts/products/verify-pending",{}).then(e=>e.json()),onSuccess:e=>{e.checked===0?s({title:"Nothing to check",description:"No products are currently awaiting confirmation"}):s({title:"Checked pending products",description:`${e.confirmed} confirmed live, ${e.failed} failed, ${e.stillPending} still processing`}),d()},onError:e=>s({title:"Check failed",description:e.message,variant:"destructive"})}),{data:o}=j({queryKey:["/api/admin/lts/products/push-progress"],refetchInterval:x.isPending?1e3:!1,enabled:x.isPending}),A=r({mutationFn:()=>l("POST","/api/admin/lts/products/sync-stock",{}).then(e=>e.json()),onSuccess:e=>{e?.complete===!1?s({title:"Stock sync incomplete",description:`Only ${e.reachedProductCount}/${e.totalProducts} products reached LTS before the run stopped. Click Sync Stock again to cover the rest.`,variant:"destructive"}):s({title:"Stock synced",description:e?.totalProducts?`${e.reachedProductCount}/${e.totalProducts} products up to date`:void 0}),d()},onError:e=>s({title:"Sync failed",description:e.message,variant:"destructive"})}),$=r({mutationFn:()=>l("POST","/api/admin/lts/orders/poll",{}).then(e=>e.json()),onSuccess:e=>{s({title:"Orders polled",description:`${e.imported} new order(s) imported`}),d()},onError:e=>s({title:"Poll failed",description:e.message,variant:"destructive"})}),O=c.useRef(()=>{});O.current=()=>{l("POST","/api/admin/lts/orders/poll",{}).then(e=>e.json()).then(()=>d()).catch(()=>{})},c.useEffect(()=>{O.current();const e=setInterval(()=>O.current(),300*1e3);return()=>clearInterval(e)},[]);const B=r({mutationFn:e=>l("POST",`/api/admin/lts/orders/${e}/acknowledge`,{}),onSuccess:()=>{s({title:"Order acknowledged"}),d()},onError:e=>s({title:"Failed",description:e.message,variant:"destructive"})}),Q=r({mutationFn:({id:e,carrier:a,tracking:b})=>l("POST",`/api/admin/lts/orders/${e}/fulfil`,{carrier:a,tracking_number:b}),onSuccess:()=>{s({title:"Order marked as shipped"}),d()},onError:e=>s({title:"Failed",description:e.message,variant:"destructive"})}),V=r({mutationFn:({id:e,reason:a})=>l("POST",`/api/admin/lts/orders/${e}/cancel`,{reason:a}),onSuccess:()=>{s({title:"Order cancelled"}),d()},onError:e=>s({title:"Failed",description:e.message,variant:"destructive"})}),G=r({mutationFn:({id:e,reason:a})=>l("POST",`/api/admin/lts/orders/${e}/refund`,{reason:a}),onSuccess:()=>{s({title:"Refund submitted"}),d()},onError:e=>s({title:"Failed",description:e.message,variant:"destructive"})}),J=r({mutationFn:()=>l("POST","/api/admin/lts/test-connection",{}),onSuccess:()=>s({title:"Connected",description:"Love The Sales API is reachable"}),onError:e=>s({title:"Connection failed",description:e.message,variant:"destructive"})}),H=r({mutationFn:e=>l("POST","/api/admin/lts/settings",e),onSuccess:()=>{s({title:"Settings saved"}),f.invalidateQueries({queryKey:["/api/admin/lts/settings"]})},onError:e=>s({title:"Failed",description:e.message,variant:"destructive"})}),Y=r({mutationFn:e=>l("POST","/api/admin/lts/products/enroll",{butterworths_product_id:e}),onSuccess:()=>{s({title:"Product enrolled"}),d()},onError:e=>s({title:"Failed",description:e.message,variant:"destructive"})}),E=r({mutationFn:()=>l("POST","/api/admin/lts/products/enroll-all-in-stock",{}).then(e=>e.json()),onSuccess:e=>{s({title:`Enrolled ${e.enrolled} in-stock products`,description:`${e.skippedAlreadyEnrolled} already enrolled, ${e.skippedNoStock} skipped (no stock)`}),d()},onError:e=>s({title:"Failed",description:e.message,variant:"destructive"})}),ke=r({mutationFn:e=>l("POST","/api/admin/lts/products/unenroll",{id:e}),onSuccess:()=>{s({title:"Product unenrolled"}),d()},onError:e=>s({title:"Failed",description:e.message,variant:"destructive"})}),Pe=new Set(D.map(e=>e.butterworths_product_id)),X=D.filter(e=>!k||(e.title||"").toLowerCase().includes(k.toLowerCase())||(e.seller_sku||"").toLowerCase().includes(k.toLowerCase())),Z=fe.filter(e=>!P||(e.lts_order_id||"").toLowerCase().includes(P.toLowerCase())||(e.customer_name||"").toLowerCase().includes(P.toLowerCase())),W=ye.filter(e=>Pe.has(e.id)?!1:C?(e.name||e.title||"").toLowerCase().includes(C.toLowerCase())||(e.brand||"").toLowerCase().includes(C.toLowerCase()):!0).slice(0,20),m=be||L||{};return t.jsxs("div",{className:"p-6",children:[t.jsx(ze,{page:"lovethesales"}),t.jsxs("div",{className:"flex items-center justify-between mb-6",children:[t.jsxs("div",{children:[t.jsx("h1",{className:"text-xl font-bold text-white",children:"Love The Sales"}),t.jsx("p",{className:"text-sm text-gray-400 mt-0.5",children:"Push products to Love The Sales and manage incoming orders"})]}),t.jsx("div",{className:"flex items-center gap-2",children:t.jsx("a",{href:"https://lovethesales.com",target:"_blank",rel:"noopener noreferrer",className:"text-xs text-blue-400 hover:underline",children:"lovethesales.com"})})]}),t.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-6 gap-3 mb-6",children:[{label:"Enrolled",value:g?.enrolled??0,icon:se,color:"text-blue-400"},{label:"Pending Push",value:g?.pending??0,icon:ae,color:"text-yellow-400"},{label:"Live on LTS",value:g?.pushed??0,icon:M,color:"text-green-400"},{label:"Total Orders",value:g?.orders??0,icon:ie,color:"text-purple-400"},{label:"Awaiting Action",value:g?.newOrders??0,icon:ae,color:"text-orange-400"},{label:"Acknowledged",value:g?.acknowledged??0,icon:M,color:"text-teal-400"}].map(({label:e,value:a,icon:b,color:z})=>t.jsxs("div",{className:"bg-[#1a1f2e] rounded-lg p-3 border border-white/5",children:[t.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[t.jsx(b,{size:14,className:z}),t.jsx("span",{className:"text-xs text-gray-400",children:e})]}),t.jsx("div",{className:"text-xl font-bold text-white",children:a})]},e))}),t.jsx("div",{className:"flex gap-1 mb-6 bg-[#1a1f2e] rounded-lg p-1 
1w-fit border border-white/5",children:["products","orders","settings"].map(e=>t.jsx("button",{"data-testid":`tab-lts-${e}`,onClick:()=>ce(e),className:`px-4 py-1.5 rounded text-sm font-medium transition-colors capitalize ${S===e?"bg-[#d4a847] text-black":"text-gray-400 hover:text-white"}`,children:e},e))}),S==="products"&&t.jsxs("div",{children:[t.jsxs("div",{className:"flex items-center gap-3 mb-4 flex-wrap",children:[t.jsxs("div",{className:"relative flex-1 min-w-[200px]",children:[t.jsx(R,{size:14,className:"absolute left-3 top-1/2 -translate-y-1/2 text-gray-500"}),t.jsx(h,{placeholder:"Search enrolled products...",value:k,onChange:e=>xe(e.target.value),className:"pl-9 bg-[#1a1f2e] border-white/10 text-white text-sm"})]}),t.jsxs(n,{size:"sm",variant:"outline",onClick:()=>E.mutate(),disabled:E.isPending,className:"border-white/10 text-white hover:bg-white/10","data-testid":"button-enroll-all-in-stock",children:[t.jsx(w,{size:14,className:`mr-2 ${E.isPending?"animate-spin":""}`})," Enroll All In-Stock"]}),t.jsxs(n,{size:"sm",variant:"outline",onClick:()=>x.mutate(void 0),disabled:x.isPending,className:"border-white/10 text-white hover:bg-white/10","data-testid":"button-push-all",children:[t.jsx(w,{size:14,className:`mr-2 ${x.isPending?"animate-spin":""}`})," Push All"]}),t.jsxs(n,{size:"sm",variant:"outline",onClick:()=>A.mutate(),disabled:A.isPending,className:"border-white/10 text-white hover:bg-white/10","data-testid":"button-sync-stock",children:[t.jsx(w,{size:14,className:`mr-2 ${A.isPending?"animate-spin":""}`})," Sync Stock"]}),t.jsxs(n,{size:"sm",variant:"outline",onClick:()=>T.mutate(),disabled:T.isPending,className:"border-white/10 text-white hover:bg-white/10","data-testid":"button-check-pending",title:"Confirm which pushes Love The Sales actually accepted -- a push can look successful here but still be pending on their side",children:[t.jsx(w,{size:14,className:`mr-2 ${T.isPending?"animate-spin":""}`})," Check Pending"]})]}),x.isPending&&t.jsxs("div",{className:"bg-[#1a1f2e] rounded-lg border border-white/5 p-4 mb-4","data-testid":"status-push-progress",children:[t.jsxs("div",{className:"flex items-center justify-between mb-2",children:[t.jsx("span",{className:"text-sm text-white font-medium",children:"Pushing to Love The Sales…"}),t.jsx("span",{className:"text-xs text-gray-400","data-testid":"text-push-progress-count",children:o?.total?`${Math.min(o.processed,o.total)} / ${o.total}`:"Starting…"})]}),t.jsx("div",{className:"w-full h-2 rounded-full bg-white/10 overflow-hidden",children:t.jsx("div",{className:"h-full bg-blue-500 transition-all duration-300",style:{width:o?.total?`${Math.min(100,o.processed/o.total*100)}%`:"5%"}})}),o?.total>0&&t.jsxs("div",{className:"flex gap-4 mt-2 text-xs text-gray-500",children:[t.jsxs("span",{children:[o.pushed," pushed"]}),t.jsxs("span",{children:[o.skippedNoStock," skipped (no stock)"]}),o.failed>0&&t.jsxs("span",{className:"text-red-400",children:[o.failed," failed"]})]})]}),je?t.jsx("div",{className:"text-gray-400 text-sm",children:"Loading..."}):X.length===0?t.jsxs("div",{className:"bg-[#1a1f2e] rounded-lg p-8 text-center border border-white/5 mb-6",children:[t.jsx(se,{size:32,className:"mx-auto mb-3 text-gray-600"}),t.jsx("p",{className:"text-gray-400 text-sm",children:"No products enrolled yet."}),t.jsx("p",{className:"text-gray-500 text-xs mt-1",children:"Enrol products below to push them to Love The Sales."})]}):t.jsx("div",{className:"bg-[#1a1f2e] rounded-lg border border-white/5 overflow-hidden mb-6",children:t.jsxs("table",{className:"w-full text-sm",children:[t.jsx("thead",{children:t.jsxs("tr",{className:"border-b border-white/5",children:[t.jsx("th",{className:"text-left px-4 py-3 text-gray-400 font-medium",children:"Product"}),t.jsx("th",{className:"text-left px-4 py-3 text-gray-400 font-medium",children:"SKU"}),t.jsx("th",{className:"text-left px-4 py-3 text-gray-400 font-medium",children:"Status"}),t.jsx("th",{className:"text-left px-4 py-3 text-gray-400 font-medium",children:"Last Pushed"}),t.jsx("th",{className:"text-right px-4 py-3 text-gray-400 font-medium",children:"Actions"})]})}),t.jsx("tbody",{children:X.map(e=>t.jsxs("tr",{className:`border-b border-white/5 last:border-0 hover:bg-white/2 ${e.enabled?"":"opacity-50"}`,children:[t.jsxs("td",{className:"px-4 py-3",children:[t.jsx("div",{className:"font-medium text-white truncate max-w-[200px]",children:e.title||"Untitled"}),t.jsx("div",{className:"text-xs text-gray-500",children:e.brand})]}),t.jsx("td",{className:"px-4 py-3 text-gray-300 font-mono text-xs",children:e.seller_sku}),t.jsx("td",{className:"px-4 py-3",children:e.enabled?e.push_status==="pushed"?t.jsx("span",{className:"px-2 py-0.5 rounded text-xs font-medium bg-green-500/20 text-green-400",children:"Live"}):e.push_status==="pending_validation"?t.jsx("span",{className:"px-2 py-0.5 rounded text-xs font-medium bg-yellow-500/20 text-yellow-400",title:"Love The Sales accepted this push but hasn't confirmed it's live yet -- use Check Pending to resolve",children:"Awaiting confirmation"}):e.push_status==="error"?t.jsx("span",{className:"px-2 py-0.5 rounded text-xs font-medium bg-red-500/20 text-red-400",title:e.last_error?String(e.last_error).slice(0,300):"Love The Sales rejected this push",children:"Failed"}):t.jsx("span",{className:"px-2 py-0.5 rounded text-xs font-medium bg-gray-500/20 text-gray-400",children:"Not yet pushed"}):t.jsx("span",{className:"px-2 py-0.5 rounded text-xs font-medium bg-gray-500/20 text-gray-400",title:"Unenrolled -- excluded from Push All, Enroll All In-Stock and Sync Stock",children:"Disabled"})}),t.jsx("td",{className:"px-4 py-3 text-gray-500 text-xs",children:e.last_pushed_at?new Date(e.last_pushed_at).toLocaleDateString("en-GB"):"Never"}),t.jsx("td",{className:"px-4 py-3 text-right",children:t.jsxs("div",{className:"flex gap-2 justify-end",children:[t.jsx(n,{size:"sm",variant:"ghost",onClick:()=>x.mutate([e.id]),disabled:x.isPending,className:"h-7 text-xs text-blue-400 hover:text-blue-300",children:"Push"}),t.jsx(n,{size:"sm",variant:"ghost",onClick:()=>ke.mutate(e.id),className:"h-7 text-xs text-red-400 hover:text-red-300",children:"Remove"})]})})]},e.id))})]})}),t.jsxs("div",{className:"bg-[#1a1f2e] rounded-lg border border-white/5 p-4",children:[t.jsx("h3",{className:"text-sm font-semibold text-white mb-3",children:"Enrol Products"}),t.jsxs("div",{className:"relative mb-3",children:[t.jsx(R,{size:14,className:"absolute left-3 top-1/2 -translate-y-1/2 text-gray-500"}),t.jsx(h,{placeholder:"Search your products...",value:C,onChange:e=>ve(e.target.value),className:"pl-9 bg-[#12151e] border-white/10 text-white text-sm"})]}),W.length===0?t.jsx("p",{className:"text-gray-500 text-xs text-center py-4",children:"All matching products are already enrolled"}):t.jsx("div",{className:"space-y-2 max-h-64 overflow-y-auto",children:W.map(e=>t.jsxs("div",{className:"flex items-center justify-between bg-[#12151e] rounded px-3 py-2",children:[t.jsxs("div",{children:[t.jsx("div",{className:"text-sm text-white",children:e.name||e.title}),t.jsxs("div",{className:"text-xs text-gray-500",children:[e.brand," · ID ",e.id]})]}),t.jsx(n,{size:"sm",onClick:()=>Y.mutate(e.id),disabled:Y.isPending,className:"h-7 text-xs bg-[#d4a847] hover:bg-[#c49a3c] text-black","data-testid":`button-enroll-${e.id}`,children:"Enrol"})]},e.id))})]})]}),S==="orders"&&t.jsxs("div",{children:[t.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[t.jsxs("div",{className:"relative flex-1",children:[t.jsx(R,{size:14,className:"absolute left-3 top-1/2 -translate-y-1/2 text-gray-500"}),t.jsx(h,{placeholder:"Search by order ID or customer...",value:P,onChange:e=>me(e.target.value),className:"pl-9 bg-[#1a1f2e] border-white/10 text-white text-sm"})]}),t.jsxs(n,{size:"sm",variant:"outline",onClick:()=>$.mutate(),disabled:$.isPending,className:"border-white/10 text-white hover:bg-white/10 shrink-0","data-testid":"button-poll-orders",children:[t.jsx(w,{size:14,className:`mr-2 ${$.isPending?"animate-spin":""}`}),"Poll New Orders"]})]}),Ne?t.jsx("div",{className:"text-gray-400 text-sm",children:"Loading..."}):Z.length===0?t.jsxs("div",{className:"bg-[#1a1f2e] rounded-lg p-8 text-center border border-white/5",children:[t.jsx(ie,{size:32,className:"mx-auto mb-3 text-gray-600"}),t.jsx("p",{className:"text-gray-400 text-sm",children:"No orders yet."}),t.jsx("p",{className:"text-gray-500 text-xs mt-1",children:'Click "Poll New Orders" to check for incoming orders from Love The Sales.'})]}):t.jsx("div",{className:"space-y-2",children:Z.map(e=>{const a=Fe[e.lts_status]||{label:"Unknown",color:"bg-gray-500/20 text-gray-400"},b=JSON.parse(e.items_json||"[]"),z=Array.isArray(e.resolved_items)?e.resolved_items:[],N=JSON.parse(e.address_json||"{}"),F=ue===e.id,v=pe[e.id]||{carrier:"",tracking:""};return t.jsxs("div",{className:"bg-[#1a1f2e] rounded-lg border border-white/5 overflow-hidden",children:[t.jsxs("div",{className:"flex items-center justify-between px-4 py-3 cursor-pointer hover:bg-white/2",onClick:()=>he(F?null:e.id),children:[t.jsxs("div",{className:"flex items-center gap-3",children:[F?t.jsx(_e,{size:14,className:"text-gray-500"}):t.jsx(Te,{size:14,className:"text-gray-500"}),t.jsxs("div",{children:[t.jsxs("span",{className:"text-white font-mono text-sm font-medium",children:["#",e.lts_order_id]}),e.customer_name&&t.jsx("span",{className:"text-gray-400 text-xs ml-2",children:e.customer_name})]}),t.jsx("span",{className:`px-2 py-0.5 rounded text-xs font-medium ${a.color}`,children:a.label})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[e.total_amount&&t.jsxs("span",{className:"text-white text-sm",children:["£",Number(e.total_amount).toFixed(2)]}),t.jsx("span",{className:"text-gray-500 text-xs",children:new Date(e.created_at).toLocaleDateString("en-GB")})]})]}),F&&t.jsxs("div",{className:"border-t border-white/5 px-4 py-4 space-y-4",children:[b.length>0&&t.jsxs("div",{children:[t.jsx("h4",{className:"text-xs font-semibold text-gray-400 mb-2",children:"Items"}),t.jsx("div",{className:"space-y-2",children:b.map((i,u)=>{const I=z[u];(()=>{try{return JSON.parse(I?.product?.images||"[]")}catch{return[]}})();const ee=Ae(I),te=I?.name||i.Title||i.SellerSku||i.SellerSKU||i.sku;return t.jsxs("div",{className:"flex justify-between items-center text-sm gap-2",children:[t.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[ee?t.jsx("img",{src:$e(ee,150),alt:te,className:"w-8 h-8 object-cover rounded bg-white/5 flex-shrink-0"}):t.jsx("div",{className:"w-8 h-8 rounded bg-white/5 flex-shrink-0"}),t.jsxs("span",{className:"text-white truncate",children:[te," x",i.Quantity||i.quantity||1]})]}),i.UnitPrice&&t.jsxs("span",{className:"text-gray-400 flex-shrink-0",children:["£",Number(i.UnitPrice).toFixed(2)]})]},u)})})]}),N.Line1&&t.jsxs("div",{children:[t.jsx("h4",{className:"text-xs font-semibold text-gray-400 mb-1",children:"Ship to"}),t.jsx("p",{className:"text-sm text-gray-300",children:[N.Line1,N.Line2,N.City,N.PostCo
1de].filter(Boolean).join(", ")})]}),t.jsxs("div",{className:"flex flex-wrap gap-2 pt-2 border-t border-white/5",children:[e.lts_status===2&&t.jsxs(n,{size:"sm",onClick:()=>B.mutate(e.id),disabled:B.isPending,className:"h-7 text-xs bg-purple-600 hover:bg-purple-700 text-white","data-testid":`button-ack-${e.id}`,children:[t.jsx(M,{size:12,className:"mr-1"})," Acknowledge"]}),(e.lts_status===2||e.lts_status===3)&&t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(h,{placeholder:"Carrier (e.g. ROYALMAIL)",value:v.carrier,onChange:i=>K(u=>({...u,[e.id]:{...v,carrier:i.target.value}})),className:"h-7 text-xs w-36 bg-[#12151e] border-white/10 text-white"}),t.jsx(h,{placeholder:"Tracking number",value:v.tracking,onChange:i=>K(u=>({...u,[e.id]:{...v,tracking:i.target.value}})),className:"h-7 text-xs w-40 bg-[#12151e] border-white/10 text-white"}),t.jsxs(n,{size:"sm",onClick:()=>Q.mutate({id:e.id,carrier:v.carrier,tracking:v.tracking}),disabled:Q.isPending,className:"h-7 text-xs bg-green-600 hover:bg-green-700 text-white","data-testid":`button-fulfil-${e.id}`,children:[t.jsx(Oe,{size:12,className:"mr-1"})," Mark Shipped"]})]}),e.lts_status<5&&t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsxs(le,{value:U[e.id]||"ItemNotAvailable",onValueChange:i=>ge(u=>({...u,[e.id]:i})),children:[t.jsx(ne,{className:"h-7 text-xs w-40 bg-[#12151e] border-white/10 text-white",children:t.jsx(re,{})}),t.jsx(de,{children:Ie.map(i=>t.jsx(q,{value:i,children:i},i))})]}),t.jsxs(n,{size:"sm",variant:"destructive",onClick:()=>V.mutate({id:e.id,reason:U[e.id]||"ItemNotAvailable"}),disabled:V.isPending,className:"h-7 text-xs","data-testid":`button-cancel-${e.id}`,children:[t.jsx(Ee,{size:12,className:"mr-1"})," Cancel"]})]}),e.lts_status===5&&t.jsx(n,{size:"sm",variant:"destructive",onClick:()=>G.mutate({id:e.id,reason:"CustomerReturnedItem"}),disabled:G.isPending,className:"h-7 text-xs","data-testid":`button-refund-${e.id}`,children:"Refund"})]})]})]},e.id)})})]}),S==="settings"&&t.jsxs("div",{className:"max-w-lg space-y-4",children:[t.jsxs("div",{className:"bg-[#1a1f2e] rounded-lg border border-white/5 p-5 space-y-4",children:[t.jsxs("div",{children:[t.jsx(y,{className:"text-xs text-gray-400 mb-1 block",children:"Environment"}),t.jsxs(le,{value:m.environment||"sandbox",onValueChange:e=>p(a=>({...a,environment:e})),children:[t.jsx(ne,{className:"bg-[#12151e] border-white/10 text-white text-sm",children:t.jsx(re,{})}),t.jsxs(de,{children:[t.jsx(q,{value:"sandbox",children:"Sandbox (Testing)"}),t.jsx(q,{value:"production",children:"Production (Live)"})]})]})]}),t.jsxs("div",{children:[t.jsx(y,{className:"text-xs text-gray-400 mb-1 block",children:"Seller ID"}),t.jsx(h,{value:m.seller_id||"",onChange:e=>p(a=>({...a,seller_id:e.target.value})),className:"bg-[#12151e] border-white/10 text-white text-sm",placeholder:"Provided by Love The Sales"})]}),t.jsxs("div",{children:[t.jsx(y,{className:"text-xs text-gray-400 mb-1 block",children:"Seller Token"}),t.jsx(h,{type:"password",value:m.seller_token||"",onChange:e=>p(a=>({...a,seller_token:e.target.value})),className:"bg-[#12151e] border-white/10 text-white text-sm font-mono",placeholder:"API token from Love The Sales"})]}),t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx(y,{className:"text-sm text-gray-300",children:"Enable integration"}),t.jsx(oe,{checked:m.enabled==="true"||m.enabled===!0,onCheckedChange:e=>p(a=>({...a,enabled:String(e)}))})]}),t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsxs("div",{children:[t.jsx(y,{className:"text-sm text-gray-300",children:"Auto-acknowledge orders"}),t.jsx("p",{className:"text-xs text-gray-500 mt-0.5",children:"Automatically acknowledge new orders when polled"})]}),t.jsx(oe,{checked:m.auto_acknowledge==="true"||m.auto_acknowledge===!0,onCheckedChange:e=>p(a=>({...a,auto_acknowledge:String(e)}))})]})]}),t.jsxs("div",{className:"flex gap-3",children:[t.jsx(n,{onClick:()=>H.mutate(m),disabled:H.isPending,className:"bg-[#d4a847] hover:bg-[#c49a3c] text-black","data-testid":"button-save-lts-settings",children:"Save Settings"}),t.jsx(n,{variant:"outline",onClick:()=>J.mutate(),disabled:J.isPending,className:"border-white/10 text-white hover:bg-white/10","data-testid":"button-test-lts-connection",children:"Test Connection"})]}),t.jsxs("div",{className:"bg-[#1a1f2e] rounded-lg border border-white/5 p-4",children:[t.jsx("h4",{className:"text-sm font-semibold text-white mb-2",children:"How it works"}),t.jsxs("ol",{className:"text-xs text-gray-400 space-y-1 list-decimal list-inside",children:[t.jsx("li",{children:"Set your Seller ID and Token from Love The Sales"}),t.jsx("li",{children:"Enrol products from the Products tab and push them to LTS"}),t.jsx("li",{children:"LTS lists your products on their site"}),t.jsx("li",{children:"Poll for new orders regularly (auto-polling runs every 15 mins)"}),t.jsx("li",{children:"Acknowledge, fulfil, or cancel orders from the Orders tab"})]})]})]})]})}export{De 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.