PageSourceSearch

https://dulloofx.com/assets/PaymentOrchestratorDashboard-927378df.js

js dulloofx.com collected 2026-10-06 04:48:45 UTC 31,428 bytes, 2 lines download raw bytes

1import{e as Fe,T as t,i as Se,j as a,b4 as je,aO as Me,b5 as ve,N as Be,f as Le}from"./bootstrap-9c9793c5.js";import{r as n}from"./react-45681010.js";import{P as qe}from"./PaymentOrchestratorService-eda65159.js";import{M as Ge}from"./index-d332e240.js";import{u as $e}from"./useAdminPermission-c99a1efc.js";import{C as oe,D as ne}from"./index-2da8b463.js";import{A as le}from"./ArrowPathIcon-4ede2d07.js";import{C as Ue}from"./CheckCircleIcon-5f910ef7.js";import{X as _e}from"./XCircleIcon-a5431760.js";import{E as Ve}from"./ExclamationTriangleIcon-102d6c2f.js";import{Q as Ee}from"./QueueListIcon-c69a2fdb.js";import{S as Pe}from"./Squares2X2Icon-120f5103.js";import{P as We}from"./PauseIcon-83e7c58d.js";import{P as Ke}from"./PlayIcon-d8e5c14e.js";import{B as Qe}from"./BanknotesIcon-edbb2902.js";import{C as Xe}from"./ChartBarIcon-4de82dd8.js";import{C as Ye}from"./CreditCardIcon-fbd2e2bc.js";import"./index-bb17d6e5.js";import"./firebase-c84b4f34.js";import"./forms-2384c341.js";import"./index-5eec8a8d.js";import"./dialog-6dc8422a.js";import"./InformationCircleIcon-d8317c2b.js";import"./index-405b800c.js";import"./FunnelIcon-b96e10a9.js";import"./MagnifyingGlassIcon-a7dedb3c.js";import"./ChevronUpIcon-de7bbd3f.js";const g=new qe,ze=()=>{const[d,L]=n.useState(null),[z,q]=n.useState(null),[H,G]=n.useState(null),[J,$]=n.useState(null),[Z,i]=n.useState(null),[y,C]=n.useState([]),[N,S]=n.useState([]),[w,T]=n.useState({enabled:[],supported:[],matrix:[]}),[ee,p]=n.useState(!1),[A,c]=n.useState(null),E=n.useCallback(async()=>{try{c(null);const r=await g.getDashboardOverview();console.log("Dashboard overview: ",r),L(r)}catch(r){const o=r.message||"Failed to fetch overview";console.error("Overview fetch error:",r),c(o),L({isEnabled:!1,lastUpdated:new Date,queueStats:{},balanceStats:[],eligibleOperations:0,recentActivity:[],stageStats:{}})}},[]),k=n.useCallback(async(r=1,o=50,l,u,m)=>{try{c(null);const v=await g.getQueueItems(r,o,l,u,m);q(v)}catch(v){const re=v.message||"Failed to fetch queue items";console.error("Queue items fetch error:",v),c(re),q({items:[],pagination:{page:r,limit:o,total:0,pages:0}})}},[]),D=n.useCallback(async(r=1,o=50)=>{try{c(null);const l=await g.getEligibleOperations(r,o);G(l)}catch(l){const u=l.message||"Failed to fetch eligible operations";console.error("Eligible operations fetch error:",l),c(u),G({operations:[],pagination:{page:r,limit:o,total:0,pages:0}})}},[]),F=n.useCallback(async(r=1,o=100)=>{try{c(null);const l=await g.getProcessingLogs(r,o);$(l)}catch(l){const u=l.message||"Failed to fetch processing logs";console.error("Processing logs fetch error:",l),c(u),$({logs:[],pagination:{page:r,limit:o,total:0,pages:0}})}},[]),b=n.useCallback(async(r=1,o=50,l,u)=>{try{c(null);const m=await g.getPaymentStages(r,o,l,u);i(m)}catch(m){const v=m.message||"Failed to fetch payment stages";console.error("Payment stages fetch error:",m),c(v),i({stages:[],pagination:{page:r,limit:o,total:0,pages:0}})}},[]),O=n.useCallback(async()=>{try{c(null);const r=await g.getProviderBalances();console.log("Balances: ",r),C(r)}catch(r){const o=r.message||"Failed to fetch balances";console.error("Balances fetch error:",r),c(o),C([])}},[]),ae=n.useCallback(async(r,o)=>{const l=await g.reconcileBalance(r,o,!1);return await O(),l},[O]),j=n.useCallback(async()=>{try{p(!0),c(null);const r=await g.triggerManualProcessing();return await f(),r}catch(r){const o=r.message||"Failed to trigger manual processing";throw console.error("Manual processing error:",r),c(o),r}finally{p(!1)}},[]),M=n.useCallback(async()=>{try{const r=await g.getPayoutCountries();T({...r,matrix:r.matrix??[]})}catch(r){console.error("Payout countries fetch error:",r)}},[]),B=n.useCallback(async()=>{try{const r=await g.getPayoutRouting();S(r.routing??[])}catch(r){console.error("Payout routing fetch error:",r)}},[]),U=n.useCallback(async(r,o)=>{var l,u;try{p(!0),c(null);const m=await g.setPayoutRouting(r,o);S(m.routing??[])}catch(m){c(((u=(l=m==null?void 0:m.response)==null?void 0:l.data)==null?void 0:u.message)||m.message||"Failed to switch the payout rail")}finally{p(!1)}},[]),x=n.useCallback(async(r,o)=>{const l=w.matrix.find(u=>u.iso===r);if(l)try{p(!0),c(null),await g.setCountryFlag(r,o,!l[o]),await M()}catch(u){c(u.message||"Failed to update the country flag")}finally{p(!1)}},[w.matrix,M]),_=n.useCallback(async()=>{try{p(!0),c(null);const r=!(d!=null&&d.isEnabled);await g.toggleProcessing(r),await E()}catch(r){const o=r.message||"Failed to toggle processing";console.error("Toggle processing error:",r),c(o)}finally{p(!1)}},[d==null?void 0:d.isEnabled,E]),V=n.useCallback(async r=>{try{return c(null),await g.retryOperation(r),{success:!0}}catch(o){const l=o.message||"Failed to retry operation";throw console.error("Retry operation error:",o),c(l),o}},[]),W=n.useCallback(async(r,o,l)=>{try{return c(null),await g.reportOperationError(r,o,l),await f(),{success:!0}}catch(u){const m=u.message||"Failed to report operation error";throw console.error("Report operation error:",u),c(m),u}},[]),te=n.useCallback(async(r,o,l)=>{try{return c(null),await g.reportOperationSuccess(r,o,l),await f(),{success:!0}}catch(u){const m=u.message||"Failed to report operation success";throw console.error("Report operation success error:",u),c(m),u}},[]),K=n.useCallback(async(r,o)=>{try{p(!0),c(null);const l=await g.cleanupProvider(r,o);return await f(),l}catch(l){const u=l.message||"Failed to cleanup provider";throw console.error("Cleanup provider error:",l),c(u),l}finally{p(!1)}},[]),Q=n.useCallback(async r=>{try{p(!0),c(null);const o=await g.emergencyStopProvider(r);return await f(),o}catch(o){const l=o.message||"Failed to emergency stop provider";throw console.error("Emergency stop error:",o),c(l),o}finally{p(!1)}},[]),f=n.useCallback(async(r=!1)=>{r||p(!0),c(null);try{await E(),await new Promise(o=>setTimeout(o,100)),await Promise.allSettled([k(),D(),O()]),await new Promise(o=>setTimeout(o,100)),await Promise.allSettled([F(),b()])}catch(o){console.error("Refresh data error:",o)}finally{r||p(!1)}},[E,k,D,F,b,O]);return{overview:d,queueItems:z,eligibleOperations:H,processingLogs:J,paymentStages:Z,balances:y,isLoading:ee,error:A,triggerManualProcessing:j,payoutCountries:w,fetchPayoutCountries:M,payoutRouting:N,fetchPayoutRouting:B,setPayoutProvider:U,toggleCountryFlag:x,toggleProcessing:_,refreshData:f,fetchQueueItems:k,fetchEligibleOperations:D,fetchProcessingLogs:F,fetchPaymentStages:b,retryOperation:V,reportOperationError:W,reportOperationSuccess:te,cleanupProvider:K,emergencyStopProvider:Q,reconcileBalance:ae}};var P=(d=>(d.PENDING="PENDING",d.PROCESSING="PROCESSING",d.COMPLETED="COMPLETED",d.FAILED="FAILED",d.CANCELLED="CANCELLED",d.INSUFFICIENT_BALANCE="INSUFFICIENT_BALANCE",d))(P||{}),Y=(d=>(d.TRANSFERO="TRANSFERO",d.ARCUS="ARCUS",d.CYBRID="CYBRID",d))(Y||{}),R=(d=>(d.PENDING="PENDING",d.PROCESSING="PROCESSING",d.COMPLETED="COMPLETED",d.FAILED="FAILED",d.WAITING_NEXT_STAGE="WAITING_NEXT_STAGE",d))(R||{});const Ce={BR:{name:"Brasil",provider:"Transfero"},MX:{name:"México",provider:"Arcus"},CL:{name:"Chile",provider:"Koywe"},US:{name:"USA",provider:"Cybrid"}},ie=new Set(["CYBRID"]),He=d=>d.replace("text-","bg-").replace(/-\d00$/,"-50"),Je=[{key:"overview",label:()=>t("Overview","Visão geral","Resumen"),icon:Xe},{key:"queue",label:()=>t("Queue","Fila","Cola"),icon:Ee},{key:"operations",label:()=>t("Eligible","Elegíveis","Elegibles"),icon:Ye},{key:"stages",label:()=>t("Stages","Estágios","Etapas"),icon:Pe},{key:"logs",label:()=>t("Logs","Logs","Registros"),icon:Se}],Ze=[{key:"pending",tone:"text-amber-600",label:()=>t("Pending","Pendentes","Pendientes")},{key:"processing",tone:"text-blue-600",label:()=>t("Processing","Processando","Procesando")},{key:"completed",tone:"text-emerald-600",label:()=>t("Completed","Concluídos","Completados")},{key:"failed",tone:"text-red-600",label:()=>t("Failed","Falharam","Fallidos")}],wa=()=>{var de,ue,me,ge,pe,xe,he,be,ye,fe;const{loading:d,isDenied:L,isModalOpen:z,modalMessage:q,modalTextMessage:H,modalAlertType:G,modalButtonType:J,modalTextButton:$,onCloseModal:Z}=$e("PaymentOrchestratorDashboard"),{overview:i,queueItems:y,eligibleOperations:C,processingLogs:N,paymentStages:S,balances:w,isLoading:T,triggerManualProcessing:ee,toggleProcessing:p,payoutCountries:A,fetchPayoutCountries:c,payoutRouting:E,fetchPayoutRouting:k,setPayoutProvider:D,toggleCountryFlag:F,refreshData:b,retryOperation:O,reconcileBalance:ae}=ze(),[j,M]=n.useState("overview"),[B,U]=n.useState(new Set),[x,_]=n.useState(!1),[V,W]=n.useState(null),[te,K]=n.useState(null),[Q,f]=n.useState(null),r=async(e,s)=>{var X,Ne;const h=`${e}_${s}`;W(h),K(null),f(null);try{await ae(e,s)}catch(I){K(h),f(((Ne=(X=I==null?void 0:I.response)==null?void 0:X.data)==null?void 0:Ne.message)||(I==null?void 0:I.message)||t("Failed to reconcile","Falha ao reconciliar","Error al reconciliar"))}finally{W(null)}};n.useEffect(()=>{c(),k()},[c]),n.useEffect(()=>{b();const e=setInterval(()=>void b(!0),6e4);return()=>clearInterval(e)},[b]),Fe(()=>void b(!0),{events:Le.orchestratorQueue,admin:!0}
1),n.useEffect(()=>{i&&_(i.isEnabled)},[i]);const o=async()=>{try{await p(),_(!x)}catch(e){console.error("Failed to toggle processing:",e)}},l=async e=>{U(s=>new Set(s).add(e));try{await O(e),await b()}catch(s){console.error("Failed to retry operation:",s)}finally{U(s=>{const h=new Set(s);return h.delete(e),h})}},u=e=>{switch(e){case P.PENDING:return"bg-yellow-100 text-yellow-800 border-yellow-200";case P.PROCESSING:return"bg-blue-100 text-blue-800 border-blue-200";case P.COMPLETED:return"bg-green-100 text-green-800 border-green-200";case P.FAILED:return"bg-red-100 text-red-800 border-red-200";case P.INSUFFICIENT_BALANCE:return"bg-orange-100 text-orange-800 border-orange-200";default:return"bg-gray-100 text-gray-800 border-gray-200"}},m=e=>{switch(e){case R.PENDING:return"bg-yellow-100 text-yellow-800 border-yellow-200";case R.PROCESSING:return"bg-blue-100 text-blue-800 border-blue-200";case R.COMPLETED:return"bg-green-100 text-green-800 border-green-200";case R.FAILED:return"bg-red-100 text-red-800 border-red-200";case R.WAITING_NEXT_STAGE:return"bg-purple-100 text-purple-800 border-purple-200";default:return"bg-gray-100 text-gray-800 border-gray-200"}},v=e=>{switch(e){case Y.TRANSFERO:return"bg-purple-100 text-purple-800 border-purple-200";case Y.ARCUS:return"bg-indigo-100 text-indigo-800 border-indigo-200";case Y.CYBRID:return"bg-cyan-100 text-cyan-800 border-cyan-200";default:return"bg-gray-100 text-gray-800 border-gray-200"}},re=[{title:t("Pending Payments","Pagamentos Pendentes","Pagos Pendientes"),value:((de=i==null?void 0:i.queueStats)==null?void 0:de.pending)||0,icon:Se,color:"text-yellow-600"},{title:t("Processing","Processando","Procesando"),value:((ue=i==null?void 0:i.queueStats)==null?void 0:ue.processing)||0,icon:le,color:"text-blue-600"},{title:t("Completed Today","Concluídos Hoje","Completados Hoy"),value:((me=i==null?void 0:i.queueStats)==null?void 0:me.completed)||0,icon:Ue,color:"text-green-600"},{title:t("Failed","Falharam","Fallidos"),value:((ge=i==null?void 0:i.queueStats)==null?void 0:ge.failed)||0,icon:_e,color:"text-red-600"},{title:t("Insufficient Balance","Saldo Insuficiente","Saldo Insuficiente"),value:((pe=i==null?void 0:i.queueStats)==null?void 0:pe.insufficient_balance)||0,icon:Ve,color:"text-orange-600"},{title:t("Eligible Operations","Operações Elegíveis","Operaciones Elegibles"),value:(i==null?void 0:i.eligibleOperations)||0,icon:Ee,color:"text-purple-600"},{title:t("Multi-Stage Operations","Operações Multi-Estágio","Operaciones Multi-Etapa"),value:((xe=i==null?void 0:i.stageStats)==null?void 0:xe.totalOperationsWithStages)||0,icon:Pe,color:"text-indigo-600"}],we=n.useMemo(()=>(w??[]).filter(e=>!ie.has(String(e.provider))),[w]),se=(e,s)=>new Date((e==null?void 0:e.createdAt)??0).getTime()-new Date((s==null?void 0:s.createdAt)??0).getTime(),ce=new Set(["PENDING","PROCESSING","SUBMITTED","WAITING_WEBHOOK","INSUFFICIENT_BALANCE"]),Ae=n.useMemo(()=>((y==null?void 0:y.items)??[]).filter(e=>!ie.has(String(e.provider))).sort((e,s)=>{const h=ce.has(String(e==null?void 0:e.status)),X=ce.has(String(s==null?void 0:s.status));return h!==X?h?-1:1:h?se(e,s):-se(e,s)}),[y]),Oe=n.useMemo(()=>[...(C==null?void 0:C.operations)??[]].sort(se),[C]),Ie=n.useMemo(()=>[...(S==null?void 0:S.stages)??[]].sort((e,s)=>new Date((e==null?void 0:e.stageStartedAt)??(e==null?void 0:e.createdAt)??0).getTime()-new Date((s==null?void 0:s.stageStartedAt)??(s==null?void 0:s.createdAt)??0).getTime()),[S]),Re=n.useMemo(()=>((A==null?void 0:A.matrix)??[]).filter(e=>{var s;return!ie.has((((s=Ce[e.iso])==null?void 0:s.provider)??"").toUpperCase())}),[A]),Te=n.useMemo(()=>[{column:"operation.id",label:t("Operation","Operação","Operación"),primary:!0,render:e=>{var s;return a.jsx(oe,{value:(s=e.operation)==null?void 0:s.id,chars:8})}},{column:"provider",label:t("Provider","Provedor","Proveedor"),filterable:!0,render:e=>a.jsx("span",{className:`px-2 py-0.5 text-[10px] font-semibold uppercase rounded-full border ${v(e.provider)}`,children:e.provider})},{column:"amount",label:t("Amount","Valor","Cantidad"),sortable:!0,accessor:e=>Number(e.amount??0),render:e=>a.jsx("span",{className:"tabular-nums",children:je(Number(e.amount),e.currency)})},{column:"status",label:"Status",filterable:!0,render:e=>a.jsx("span",{className:`px-2 py-0.5 text-[10px] font-semibold uppercase rounded-full border ${u(e.status)}`,children:e.status})},{column:"currentStage",label:t("Stage","Estágio","Etapa"),align:"center",hideOnMobile:!0},{column:"createdAt",label:t("Created","Criado","Creado"),sortable:!0,accessor:e=>new Date(e.createdAt).getTime(),render:e=>a.jsx("span",{className:"text-gray-500 whitespace-nowrap",children:new Date(e.createdAt).toLocaleStr
1ing("pt-BR")})},{column:"actions",label:t("Actions","Ações","Acciones"),cardFullWidth:!0,render:e=>e.status===P.FAILED?a.jsx("button",{onClick:()=>l(e.operation.id),disabled:B.has(e.operation.id),className:"px-2.5 py-1.5 rounded-lg text-xs font-medium border border-gray-200 hover:bg-gray-50 text-[#6A1B9A] disabled:opacity-50",children:B.has(e.operation.id)?t("Retrying…","Tentando…","Reintentando…"):t("Retry","Tentar novamente","Reintentar")}):a.jsx("span",{className:"text-gray-300 text-xs",children:"—"})}],[B]),ke=n.useMemo(()=>[{column:"id",label:t("Operation","Operação","Operación"),primary:!0,render:e=>a.jsx(oe,{value:e.id,chars:8})},{column:"user.email",label:t("Customer","Cliente","Cliente"),render:e=>{var s;return a.jsx("span",{className:"text-gray-700 break-all",children:((s=e.user)==null?void 0:s.email)??"—"})}},{column:"recivedValue",label:t("Amount","Valor","Cantidad"),sortable:!0,accessor:e=>Number(e.recivedValue??0),render:e=>a.jsx("span",{className:"tabular-nums",children:Number(e.recivedValue??0).toLocaleString("pt-BR",{minimumFractionDigits:2,maximumFractionDigits:2})})},{column:"countryRecived.name",label:t("Country","País","País"),filterable:!0},{column:"createdAt",label:t("Created","Criado","Creado"),sortable:!0,accessor:e=>new Date(e.createdAt).getTime(),render:e=>a.jsx("span",{className:"text-gray-500 whitespace-nowrap",children:new Date(e.createdAt).toLocaleString("pt-BR")})}],[]),De=n.useMemo(()=>[{column:"operation.id",label:t("Operation","Operação","Operación"),primary:!0,render:e=>{var s;return a.jsx(oe,{value:(s=e.operation)==null?void 0:s.id,chars:8})}},{column:"stageStatus",label:"Status",filterable:!0,render:e=>a.jsx("span",{className:`px-2 py-0.5 text-[10px] font-semibold uppercase rounded-full border ${m(e.stageStatus)}`,children:e.stageStatus})},{column:"currentStage",label:t("Progress","Progresso","Progreso"),render:e=>a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("div",{className:"w-16 bg-gray-200 rounded-full h-1.5 shrink-0",children:a.jsx("div",{className:"bg-[#6A1B9A] h-1.5 rounded-full transition-all",style:{width:`${e.totalStages?e.currentStage/e.totalStages*100:0}%`}})}),a.jsxs("span",{className:"text-xs text-gray-600 tabular-nums",children:[e.currentStage,"/",e.totalStages]})]})},{column:"stageStartedAt",label:t("Started","Iniciado","Iniciado"),sortable:!0,accessor:e=>e.stageStartedAt?new Date(e.stageStartedAt).getTime():0,render:e=>a.jsx("span",{className:"text-gray-500 whitespace-nowrap",children:e.stageStartedAt?new Date(e.stageStartedAt).toLocaleString("pt-BR"):"—"})}],[]);return T?a.jsx("div",{className:"min-h-screen bg-gray-50 flex items-center justify-center",children:a.jsxs("div",{className:"text-center",children:[a.jsx("div",{className:"animate-spin rounded-full h-12 w-12 border-b-2 border-purple-600 mx-auto mb-4"}),a.jsx("p",{className:"text-gray-600",children:t("Loading payment orchestrator...","Carregando orquestrador de pagamentos...","Cargando orquestador de pagos...")})]})}):d?a.jsx("div",{className:"min-h-screen flex items-center justify-center bg-gray-100",children:a.jsx(Me,{})}):L?z?a.jsx(Ge,{onClose:Z,message:q,textMessage:H,alertType:G,buttonType:J,textButton:$}):null:a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-start sm:justify-between gap-3",children:[a.jsxs("div",{children:[a.jsx("h1",{className:"text-2xl font-bold text-gray-900",children:t("Payment Orchestrator","Orquestrador de Pagamentos","Orquestador de Pagos")}),a.jsx("p",{className:"text-gray-500 mt-1",children:t("Automated payout processing and monitoring","Processamento e monitoramento automatizado de payout","Procesamiento y monitoreo automatizado de payout")})]}),a.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[a.jsxs("span",{className:`inline-flex items-center gap-1.5 px-2.5 py-1 rounded-full text-xs font-medium border ${x?"bg-emerald-50 text-emerald-700 border-emerald-200":"bg-red-50 text-red-700 border-red-200"}`,children:[a.jsx("span",{className:`w-1.5 h-1.5 rounded-full ${x?"bg-emerald-500":"bg-red-500"}`}),x?t("Auto on","Automático ligado","Automático activo"):t("Auto off","Automático desligado","Automático apagado")]}),a.jsxs("button",{onClick:o,className:`flex items-center gap-1.5 px-3 py-2 rounded-lg text-sm font-medium border transition-colors ${x?"border-red-200 text-red-700 hover:bg-red-50":"border-emerald-200 text-emerald-700 hover:bg-emerald-50"}`,children:[x?a.jsx(We,{className:"w-4 h-4"}):a.jsx(Ke,{className:"w-4 h-4"}),a.jsx("span",{className:"hidden sm:inline",children:x?t("Pause","Pausar","Pausar"):t("Resume","Retomar","Reanudar")})]}),a.jsxs("button",{onClick:ee,className:"flex items-center gap-1.5 px-3 py-2 rounded-lg text-sm font-medium bg-[#6A1B9A] hover:bg-[#5E1788] text-white",children:[a.jsx(le,{className:"w-4 h-4"}),a.jsx("span",{className:"hidden sm:inline",children:t("Run now","Rodar agora","Ejecutar ahora")})]}),a.jsx("button",{onClick:()=>void b(),className:"flex items-center gap-1.5 px-3 py-2 rounded-lg text-sm border border-gray-200 hover:bg-gray-50","aria-label":t("Refresh","Atualizar","Actualizar"),children:a.jsx(le,{className:"w-4 h-4"})})]})]}),a.jsx("div",{className:"grid gap-3 grid-cols-2 lg:grid-cols-4 xl:grid-cols-7",children:re.map(e=>a.jsxs("div",{className:"bg-white rounded-xl border border-gray-200 shadow-sm p-4 flex items-center gap-3",children:[a.jsx("div",{className:`p-2 rounded-lg ${He(e.color)}`,children:a.jsx(e.icon,{className:`w-5 h-5 ${e.color}`})}),a.jsxs("div",{className:"min-w-0",children:[a.jsx("p",{className:"text-xl font-bold text-gray-900 tabular-nums",children:e.value}),a.jsx("p",{className:"text-xs text-gray-500 truncate",children:e.title})]})]},e.title))}),a.jsxs("div",{className:"bg-white rounded-xl border border-gray-200 shadow-sm",children:[a.jsxs("div",{className:"p-4 border-b border-gray-100",children:[a.jsx("h3",{className:"text-sm font-semibold text-gray-900",children:t("Payout countries","Países de payout","Países de payout")}),a.jsx("p",{className:"text-xs text-gray-500 mt-1",children:t("Whether the orchestrator may send payouts to each country. What the customer is offered in the calculator is a different switch, under Feature flags.","Se o orquestrador pode enviar payout para cada país. O que o cliente vê na calculadora é outra chave, em Feature flags.","Si el orquestador puede enviar payout a cada país. Lo que el cliente ve en la calculadora es otro interruptor, en Feature flags.")})]}),a.jsx("div",{className:"p-4 grid gap-3 grid-cols-1 sm:grid-cols-2 lg:grid-cols-4",children:Re.map(e=>{var s;return a.jsxs("button",{type:"button",onClick:()=>void F(e.iso,"orchestrator"),disabled:T,className:`flex items-center gap-3 border rounded-lg p-3 text-left transition-colors disabled:opacity-60 ${e.orchestrator?"bg-emerald-50 border-emerald-200":"bg-gray-50 border-gray-200"}`,children:[a.jsx("span",{className:`w-2.5 h-2.5 rounded-full shrink-0 ${e.orchestrator?"bg-emerald-500":"bg-gray-400"}`}),a.jsxs("span",{className:"min-w-0",children:[a.jsxs("span",{className:"block text-sm font-medium text-gray-900 truncate",children:[e.name," ",a.jsxs("span",{className:"text-xs text-gray-500",children:["(",((s=Ce[e.iso])==null?void 0:s.provider)??e.iso,")"]})]}),a.jsx("span",{className:"block text-[11px] text-gray-500",children:e.orchestrator?t("processing payouts","processa payout","procesa payout"):t("not processing","não processa","no procesa")})]})]},e.iso)})})]}),a.jsx("div",{className:"grid gap-3 grid-cols-1 sm:grid-cols-2 lg:grid-cols-3",children:we.map(e=>{const s=`${e.provider}_${e.currency}`;return a.jsxs("div",{className:"bg-white rounded-xl border border-gray-200 shadow-sm p-4 space-y-3",children:[a.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[a.jsx("div",{className:"p-2 bg-purple-50 rounded-lg",children:a.jsx(Qe,{className:"w-5 h-5 text-[#6A1B9A]"})}),a.jsxs("div",{className:"min-w-0",children:[a.jsx("p",{className:"text-sm font-semibold text-gray-900 truncate",children:e.provider}),a.jsx("p",{className:"text-xs text-gray-500",children:e.currency})]})]}),a.jsxs("dl",{className:"space-y-1.5 text-sm",children:[a.jsxs("div",{className:"flex justify-between gap-2",children:[a.jsx("dt",{className:"text-gray-500",children:t("Available","Disponível","Disponible")}),a.jsx("dd",{className:"font-medium text-emerald-600 tabular-nums",children:ve(Number(e.availableBalance),e.currency)})]}),a.jsxs("div",{className:"flex justify-between gap-2",children:[a.jsx("dt",{className:"text-gray-500",children:t("Reserved","Reservado","Reservado")}),a.jsx("dd",{className:"font-medium text-amber-600 tabular-nums",children:je(Number(e.reservedBalance),e.currency)})]}),a.jsxs("div",{className:"flex justify-between gap-2 border-t border-gray-100 pt-1.5",children:[a.jsx("dt",{className:"font-medium text-gray-900",children:"Total"}),a.jsx("dd",{className:"font-bold text-gray-900 tabular-nums",children:ve(Number(e.totalBalance),e.currency)})]})]}),a.jsx("button",{type:"button",onClick:()=>r(e.provider,e.currency),disabled:V===s,className:"w-full px-3 py-2 rounded-lg text-xs font-medium border border-gray-200 hover:bg-gray-50 text-gray-600 disabled:opacity-50",children:V===s?t("Reconciling…","Reconciliando…","Reconciliando…"):t("Fix reserved balance","Corrigir saldo reservado","Corregir saldo reservado")}),te===s&&Q&&a.jsx("p",{className:"text-xs text-red-600",children:Q})]},s)})}),a.jsxs("div",{className:"bg-white rounded-xl border border-gray-200 shadow-sm",children:[a.jsx("div",{className:"border-b border-gray-200 overflow-x-auto",children:a.jsx("nav",{className:"flex gap-1 px-3 min-w-max",children:Je.map(e=>a.jsxs("button",{onClick:()=>M(e.key),className:`flex items-center gap-1.5 py-3 px-3 border-b-2 font-medium text-sm whitespace-nowrap transition-colors ${j===e.key?"border-[#6A1B9A] text-[#6A1B9A]":"border-transparent text-gray-500 hover:text-gray-700"}`,children:[a.jsx(e.icon,{className:"w-4 h-4"}),e.label()]},e.key))})}),a.jsxs("div",{className:"p-3 sm:p-4",children:[j==="overview"&&a.jsxs("div",{className:"grid gap-3 grid-cols-1 lg:grid-cols-2",children:[a.jsxs("div",{className:"rounded-xl border border-gray-200 p-4",children:[a.jsx("h3",{className:"text-sm font-semibold text-gray-900 mb-3",children:t("Processing status","Status do processamento","Estado del procesamiento")}),a.jsxs("dl",{className:"space-y-2 text-sm",children:[a.jsxs("div",{className:"flex justify-between gap-2",children:[a.jsx("dt",{className:"text-gray-500",children:t("Auto processing","Processamento automático","Procesamiento automático")}),a.jsx("dd",{className:`font-medium ${x?"text-emerald-600":"text-red-600"}`,children:x?t("Enabled","Habilitado","Habilitado"):t("Disabled","Desabilitado","Deshabilitado")})]}),a.jsxs("div",{className:"flex justify-between gap-2",children:[a.jsx("dt",{className:"text-gray-500",children:t("Queue size","Tamanho da fila","Tamaño de la cola")}),a.jsx("dd",{className:"font-medium text-gray-900 tabular-nums",children:((he=y==null?void 0:y.pagination)==null?void 0:he.total)??0})]}),a.jsxs("div",{className:"flex justify-between gap-2",children:[a.jsx("dt",{className:"text-gray-500",children:t("Eligible operations","Operações elegíveis","Operaciones elegibles")}
1),a.jsx("dd",{className:"font-medium text-gray-900 tabular-nums",children:(i==null?void 0:i.eligibleOperations)??0})]}),a.jsxs("div",{className:"flex justify-between gap-2",children:[a.jsx("dt",{className:"text-gray-500",children:t("Multi-stage operations","Operações multi-estágio","Operaciones multi-etapa")}),a.jsx("dd",{className:"font-medium text-gray-900 tabular-nums",children:((be=i==null?void 0:i.stageStats)==null?void 0:be.totalOperationsWithStages)??0})]})]})]}),a.jsxs("div",{className:"rounded-xl border border-gray-200 p-4",children:[a.jsx("h3",{className:"text-sm font-semibold text-gray-900 mb-3",children:t("Queue by status","Fila por status","Cola por estado")}),a.jsx("div",{className:"grid grid-cols-2 gap-2",children:Ze.map(e=>{var s;return a.jsxs("div",{className:"rounded-lg bg-gray-50 px-3 py-2",children:[a.jsx("p",{className:`text-lg font-bold tabular-nums ${e.tone}`,children:((s=i==null?void 0:i.queueStats)==null?void 0:s[e.key])??0}),a.jsx("p",{className:"text-xs text-gray-500",children:e.label()})]},e.key)})})]})]}),j==="queue"&&a.jsx(ne,{rows:Ae,storageKey:"orchestrator-queue",itemLabel:t("items","itens","ítems"),searchPlaceholder:t("Search by operation, provider or status…","Buscar por operação, provedor ou status…","Buscar por operación, proveedor o estado…"),emptyMessage:t("The payment queue is empty.","A fila de pagamentos está vazia.","La cola de pagos está vacía."),columns:Te}),j==="operations"&&a.jsx(ne,{rows:Oe,storageKey:"orchestrator-eligible",itemLabel:t("operations","operações","operaciones"),searchPlaceholder:t("Search by customer or country…","Buscar por cliente ou país…","Buscar por cliente o país…"),emptyMessage:t("No operation is waiting to be picked up.","Nenhuma operação aguardando para ser processada.","Ninguna operación esperando ser procesada."),columns:ke}),j==="stages"&&a.jsx(ne,{rows:Ie,storageKey:"orchestrator-stages",itemLabel:t("stages","estágios","etapas"),emptyMessage:t("No multi-stage operation in flight.","Nenhuma operação multi-estágio em andamento.","Ninguna operación multi-etapa en curso."),columns:De}),j==="logs"&&a.jsxs("div",{className:"space-y-2",children:[!((ye=N==null?void 0:N.logs)!=null&&ye.length)&&a.jsx("p",{className:"text-sm text-gray-500 py-8 text-center",children:t("No processing log yet.","Nenhum log de processamento ainda.","Ningún registro de procesamiento aún.")}),(fe=N==null?void 0:N.logs)==null?void 0:fe.map(e=>{var s;return a.jsxs("div",{className:`border rounded-xl p-3 ${e.isError?"border-red-200 bg-red-50":"border-gray-200 bg-white"}`,children:[a.jsxs("div",{className:"flex flex-wrap items-center gap-2 mb-1.5",children:[e.isError&&a.jsx(Be,{className:"w-4 h-4 text-red-500 shrink-0"}),a.jsx("span",{className:`px-2 py-0.5 text-[10px] font-semibold uppercase rounded-full border ${e.isError?"bg-red-100 text-red-800 border-red-200":"bg-blue-50 text-blue-800 border-blue-200"}`,children:e.action}),a.jsxs("span",{className:"font-mono text-xs text-gray-500",children:[(s=e.operation)==null?void 0:s.id.slice(0,8),"…"]}),a.jsx("span",{className:"text-xs text-gray-400 sm:ml-auto",children:new Date(e.timestamp).toLocaleString("pt-BR")})]}),a.jsx("p",{className:"text-sm text-gray-700 break-words",children:e.details})]},e.id)})]}),a.jsxs("div",{className:"bg-white rounded-xl border border-gray-200 shadow-sm",children:[a.jsxs("div",{className:"p-4 border-b border-gray-100",children:[a.jsx("h3",{className:"text-sm font-semibold text-gray-900",children:t("Payout rail","Trilha de payout","Riel de payout")}),a.jsx("p",{className:"text-xs text-gray-500 mt-1",children:t("Who settles each country. Switching is manual on purpose: an automatic failover would move money through a rail nobody chose, at the exact moment the system is already misbehaving. Takes effect for everything that follows — cron, manual payment, reports and receipts.","Quem liquida cada país. A troca é manual de propósito: um failover automático moveria dinheiro por uma trilha que ninguém escolheu, justo quando o sistema já está se comportando mal. Vale para tudo daí em diante — cron, pagamento manual, relatórios e comprovantes.","Quién liquida cada país. El cambio es manual a propósito: un failover automático movería dinero por un riel que nadie eligió, justo cuando el sistema ya falla. Vale para todo lo que sigue.")})]}),a.jsxs("div",{className:"p-4 grid gap-3 grid-cols-1 sm:grid-cols-2 lg:grid-cols-4",children:[E.map(e=>a.jsxs("div",{className:`border rounded-lg p-3 ${e.isBackup?"bg-amber-50 border-amber-200":"bg-gray-50 border-gray-200"}`,children:[a.jsxs("div",{className:"flex items-center justify-between gap-2",children:[a.jsx("span",{className:"text-sm font-medium text-gray-900",children:e.iso}),e.isBackup&&a.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-amber-100 text-amber-800 font-medium",children:t("backup","backup","backup")})]}),(e.manualOptions??e.options).length>1?a.jsxs(a.Fragment,{children:[a.jsx("select",{value:e.provider,disabled:T,onChange:s=>void D(e.iso,s.target.value),className:"mt-2 w-full px-2 py-1.5 bg-white border border-gray-200 rounded-lg text-sm focus:ring-2 focus:ring-[#6A1B9A]/20 disabled:opacity-60",children:(e.manualOptions??e.options).map(s=>{const h=(e.unproven??[]).includes(s);return a.jsxs("option",{value:s,children:[s,h?" — nunca liquidou aqui":""]},s)})}),(e.unproven??[]).length>0&&a.jsx("p",{className:"mt-1.5 text-[11px] text-amber-700 leading-snug",children:t("A rail marked so has never settled a payout in this country. You can still choose it — trying one payment first from the manual report is the safer order.","Uma trilha marcada assim nunca liquidou um payout neste país. Você ainda pode escolhê-la — mandar um pagamento antes pelo relatório manual é a ordem mais segura.","Un riel marcado así nunca liquidó un payout en este país. Aún puedes elegirlo — enviar un pago antes desde el reporte manual es el orden más seguro.")}
1)]}):a.jsx("p",{className:"mt-2 text-sm text-gray-600",children:e.provider})]},e.iso)),!E.length&&a.jsx("p",{className:"text-sm text-gray-500",children:t("No rails configured.","Nenhuma trilha configurada.","Sin rieles configurados.")})]})]})]})]})]})};export{Ce as COUNTRY_LABELS,wa as default};
2//# sourceMappingURL=PaymentOrchestratorDashboard-927378df.js.map

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.