spaark-payapi-sdk 1.6.0 → 1.7.1

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.
package/dist/react.mjs CHANGED
@@ -1,7 +1,7 @@
1
- import {forwardRef,useState,useMemo,useCallback}from'react';import*as z from'@radix-ui/react-tabs';import*as w from'@radix-ui/react-select';import {useReactTable,getFilteredRowModel,getPaginationRowModel,getCoreRowModel,flexRender}from'@tanstack/react-table';import {ChevronDown,Check,Copy,ArrowDownCircle,ArrowUpCircle,RefreshCw,Settings,LayoutDashboard,BarChart3,TrendingUp,Hourglass,CheckCircle2,XCircle,Ban,Search,Inbox,Plus,ChevronLeft,ChevronRight,AlertCircle,Clock}from'lucide-react';import {ResponsiveContainer,AreaChart,CartesianGrid,XAxis,YAxis,Tooltip,Legend,Area,BarChart,Bar,Cell,PieChart,Pie}from'recharts';import {clsx}from'clsx';import {twMerge}from'tailwind-merge';import {jsx,jsxs,Fragment}from'react/jsx-runtime';var ne=()=>"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,s=>{let n=Math.random()*16|0;return (s==="x"?n:n&3|8).toString(16)});function Jt(s,n={}){let{transactionId:d=ne(),amount:x="5000",currency:g="XAF",correspondent:F="MTN_MOMO_CMR",phoneNumber:_="237670000000",status:v=s==="deposit.failed"?"FAILED":"COMPLETED",failureCode:m="INSUFFICIENT_FUNDS",failureMessage:K="The payer has insufficient funds"}=n,u=new Date().toISOString(),E={depositId:d,status:v,amount:x,currency:g,correspondent:F,payer:{type:"MSISDN",address:{value:_}},customerTimestamp:u,created:u};return v==="COMPLETED"&&(E.receivedByPayer=u),v==="FAILED"&&(E.failureReason={failureCode:m,failureMessage:K}),{eventId:ne(),eventType:s,timestamp:u,data:E}}function $t(s,n={}){let{transactionId:d=ne(),amount:x="5000",currency:g="XAF",correspondent:F="MTN_MOMO_CMR",phoneNumber:_="237670000000",status:v=s==="payout.failed"?"FAILED":"COMPLETED",failureCode:m="RECIPIENT_NOT_FOUND",failureMessage:K="The recipient account was not found"}=n,u=new Date().toISOString(),E={payoutId:d,status:v,amount:x,currency:g,correspondent:F,recipient:{type:"MSISDN",address:{value:_}},customerTimestamp:u,created:u};return v==="COMPLETED"&&(E.receivedByRecipient=u),v==="FAILED"&&(E.failureReason={failureCode:m,failureMessage:K}),{eventId:ne(),eventType:s,timestamp:u,data:E}}function Xt(s,n={}){let{transactionId:d=ne(),depositId:x=ne(),amount:g="5000",currency:F="XAF",correspondent:_="MTN_MOMO_CMR",phoneNumber:v="237670000000",status:m=s==="refund.failed"?"FAILED":"COMPLETED",failureCode:K="REFUND_LIMIT_EXCEEDED",failureMessage:u="The refund limit has been exceeded"}=n,E=new Date().toISOString(),l={refundId:d,depositId:x,status:m,amount:g,currency:F,correspondent:_,recipient:{type:"MSISDN",address:{value:v}},created:E};return m==="FAILED"&&(l.failureReason={failureCode:K,failureMessage:u}),{eventId:ne(),eventType:s,timestamp:E,data:l}}function Xe(s,n={}){return s.startsWith("deposit.")?Jt(s,n):s.startsWith("payout.")?$t(s,n):Xt(s,n)}var Qe=["deposit.accepted","deposit.completed","deposit.failed","payout.accepted","payout.completed","payout.failed","refund.completed","refund.failed"];function k(...s){return twMerge(clsx(s))}var ha={fr:{title:"Tableau de bord financier",subtitle:"Vue d'ensemble de vos transactions",totalVolume:"Volume Total",deposits:"D\xE9p\xF4ts",payouts:"Retraits",failed:"\xC9checs",refunds:"Remboursements",pending:"En attente",completed:"Compl\xE9t\xE9es",cancelled:"Annul\xE9es",search:"Rechercher par ID ou t\xE9l\xE9phone...",allTypes:"Tous les types",allStatuses:"Tous les statuts",deposit:"D\xE9p\xF4t",payout:"Retrait",refund:"Remboursement",expertMode:"Mode Expert",refresh:"Actualiser",settings:"Param\xE8tres",noTransactions:"Aucune transaction",noTransactionsDesc:"Les transactions appara\xEEtront ici une fois effectu\xE9es.",addTransaction:"Nouvelle transaction",id:"ID",type:"Type",amount:"Montant",status:"Statut",provider:"Op\xE9rateur",phone:"T\xE9l\xE9phone",date:"Date",page:"Page",of:"sur",transactions:"transactions",copied:"Copi\xE9 !",dashboard:"Tableau de bord",charts:"Graphiques",volumeOverTime:"Volume dans le temps",transactionsByType:"Par type",statusDistribution:"Par statut",noDataForCharts:"Pas de donn\xE9es pour les graphiques",loading:"Chargement...",previous:"Pr\xE9c\xE9dent",next:"Suivant"},en:{title:"Finance Dashboard",subtitle:"Overview of your transactions",totalVolume:"Total Volume",deposits:"Deposits",payouts:"Payouts",failed:"Failed",refunds:"Refunds",pending:"Pending",completed:"Completed",cancelled:"Cancelled",search:"Search by ID or phone...",allTypes:"All types",allStatuses:"All statuses",deposit:"Deposit",payout:"Payout",refund:"Refund",expertMode:"Expert Mode",refresh:"Refresh",settings:"Settings",noTransactions:"No transactions",noTransactionsDesc:"Transactions will appear here once made.",addTransaction:"New transaction",id:"ID",type:"Type",amount:"Amount",status:"Status",provider:"Provider",phone:"Phone",date:"Date",page:"Page",of:"of",transactions:"transactions",copied:"Copied!",dashboard:"Dashboard",charts:"Charts",volumeOverTime:"Volume over time",transactionsByType:"By type",statusDistribution:"By status",noDataForCharts:"No data for charts",loading:"Loading...",previous:"Previous",next:"Next"}},Na={COMPLETED:"bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200",ACCEPTED:"bg-blue-100 text-blue-800 dark:bg-blue-900 dark:text-blue-200",PENDING:"bg-yellow-100 text-yellow-800 dark:bg-yellow-900 dark:text-yellow-200",ENQUEUED:"bg-yellow-100 text-yellow-800 dark:bg-yellow-900 dark:text-yellow-200",PROCESSING:"bg-blue-100 text-blue-800 dark:bg-blue-900 dark:text-blue-200",FAILED:"bg-red-100 text-red-800 dark:bg-red-900 dark:text-red-200",CANCELLED:"bg-gray-100 text-gray-800 dark:bg-gray-900 dark:text-gray-200",REJECTED:"bg-red-100 text-red-800 dark:bg-red-900 dark:text-red-200"},R={deposit:"#22c55e",payout:"#3b82f6",refund:"#f97316",COMPLETED:"#22c55e",PENDING:"#eab308",FAILED:"#ef4444",CANCELLED:"#6b7280"},oe=forwardRef(({className:s,variant:n="default",size:d="default",...x},g)=>jsx("button",{ref:g,className:k("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",{"bg-primary text-primary-foreground hover:bg-primary/90":n==="default","border border-input bg-background hover:bg-accent hover:text-accent-foreground":n==="outline","hover:bg-accent hover:text-accent-foreground":n==="ghost","bg-secondary text-secondary-foreground hover:bg-secondary/80":n==="secondary"},{"h-10 px-4 py-2":d==="default","h-9 rounded-md px-3":d==="sm","h-11 rounded-md px-8":d==="lg","h-10 w-10":d==="icon"},s),...x}));oe.displayName="Button";var Ca=z.Root,bt=forwardRef(({className:s,...n},d)=>jsx(z.List,{ref:d,className:k("inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",s),...n}));bt.displayName=z.List.displayName;var Le=forwardRef(({className:s,...n},d)=>jsx(z.Trigger,{ref:d,className:k("inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm",s),...n}));Le.displayName=z.Trigger.displayName;var Oe=forwardRef(({className:s,...n},d)=>jsx(z.Content,{ref:d,className:k("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",s),...n}));Oe.displayName=z.Content.displayName;var it=w.Root,lt=w.Value,Fe=forwardRef(({className:s,children:n,...d},x)=>jsxs(w.Trigger,{ref:x,className:k("flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",s),...d,children:[n,jsx(w.Icon,{asChild:true,children:jsx(ChevronDown,{className:"h-4 w-4 opacity-50"})})]}));Fe.displayName=w.Trigger.displayName;var He=forwardRef(({className:s,children:n,position:d="popper",...x},g)=>jsx(w.Portal,{children:jsx(w.Content,{ref:g,className:k("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",d==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",s),position:d,...x,children:jsx(w.Viewport,{className:k("p-1",d==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:n})})}));He.displayName=w.Content.displayName;var A=forwardRef(({className:s,children:n,...d},x)=>jsxs(w.Item,{ref:x,className:k("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",s),...d,children:[jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:jsx(w.ItemIndicator,{children:jsx(Check,{className:"h-4 w-4"})})}),jsx(w.ItemText,{children:n})]}));A.displayName=w.Item.displayName;var D=forwardRef(({className:s,...n},d)=>jsx("div",{ref:d,className:k("rounded-lg border bg-card text-card-foreground shadow-sm",s),...n}));D.displayName="Card";var L=forwardRef(({className:s,...n},d)=>jsx("div",{ref:d,className:k("flex flex-col space-y-1.5 p-6",s),...n}));L.displayName="CardHeader";var Ce=forwardRef(({className:s,...n},d)=>jsx("h3",{ref:d,className:k("text-lg font-semibold leading-none tracking-tight",s),...n}));Ce.displayName="CardTitle";var O=forwardRef(({className:s,...n},d)=>jsx("div",{ref:d,className:k("p-6 pt-0",s),...n}));O.displayName="CardContent";var ft=forwardRef(({className:s,type:n,...d},x)=>jsx("input",{type:n,className:k("flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",s),ref:x,...d}));ft.displayName="Input";var xt=forwardRef(({className:s,...n},d)=>jsx("div",{className:"relative w-full overflow-auto",children:jsx("table",{ref:d,className:k("w-full caption-bottom text-sm",s),...n})}));xt.displayName="Table";var vt=forwardRef(({className:s,...n},d)=>jsx("thead",{ref:d,className:k("[&_tr]:border-b",s),...n}));vt.displayName="TableHeader";var yt=forwardRef(({className:s,...n},d)=>jsx("tbody",{ref:d,className:k("[&_tr:last-child]:border-0",s),...n}));yt.displayName="TableBody";var We=forwardRef(({className:s,...n},d)=>jsx("tr",{ref:d,className:k("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",s),...n}));We.displayName="TableRow";var ht=forwardRef(({className:s,...n},d)=>jsx("th",{ref:d,className:k("h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0",s),...n}));ht.displayName="TableHead";var Nt=forwardRef(({className:s,...n},d)=>jsx("td",{ref:d,className:k("p-4 align-middle [&:has([role=checkbox])]:pr-0",s),...n}));Nt.displayName="TableCell";var V=({className:s,...n})=>jsx("div",{className:k("animate-pulse rounded-md bg-muted",s),...n}),ka=({className:s})=>jsxs("svg",{className:k("animate-spin",s),xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),dt=({icon:s=Inbox,title:n,description:d,action:x})=>jsxs("div",{className:"flex flex-col items-center justify-center py-12 px-4 text-center",children:[jsx("div",{className:"flex h-20 w-20 items-center justify-center rounded-full bg-muted",children:jsx(s,{className:"h-10 w-10 text-muted-foreground"})}),jsx("h3",{className:"mt-4 text-lg font-semibold",children:n}),d&&jsx("p",{className:"mt-2 text-sm text-muted-foreground max-w-sm",children:d}),x&&jsx("div",{className:"mt-6",children:x})]}),Ta=({status:s})=>{switch(s){case "COMPLETED":return jsx(CheckCircle2,{className:"w-3.5 h-3.5"});case "FAILED":case "REJECTED":return jsx(XCircle,{className:"w-3.5 h-3.5"});case "CANCELLED":return jsx(Ban,{className:"w-3.5 h-3.5"});case "PENDING":case "ENQUEUED":return jsx(Clock,{className:"w-3.5 h-3.5"});case "PROCESSING":case "ACCEPTED":return jsx(ka,{className:"w-3.5 h-3.5"});default:return jsx(AlertCircle,{className:"w-3.5 h-3.5"})}},ce=(s,n)=>new Intl.NumberFormat("fr-FR",{style:"decimal",minimumFractionDigits:0,maximumFractionDigits:0}).format(s)+" "+n,wa=(s,n)=>{let d=new Date(s);return new Intl.DateTimeFormat(n==="fr"?"fr-FR":"en-US",{day:"2-digit",month:"short",year:"numeric",hour:"2-digit",minute:"2-digit"}).format(d)};function Ea({transactions:s,title:n,subtitle:d,locale:x="fr",className:g="",showExpertMode:F=true,onExpertModeClick:_,onTransactionClick:v,onRefresh:m,onAddTransaction:K,onSettings:u,isLoading:E=false}){let l=ha[x],[$,N]=useState(""),[re,M]=useState("all"),[j,H]=useState("all"),[ie,X]=useState(null),[be,Z]=useState("dashboard"),[fe,ee]=useState([]),T=useMemo(()=>{let i=s.filter(b=>b.type==="deposit"),y=s.filter(b=>b.type==="payout"),J=s.filter(b=>b.type==="refund"),te=s.filter(b=>b.status==="FAILED"||b.status==="REJECTED"),I=s.filter(b=>["PENDING","ENQUEUED","PROCESSING","ACCEPTED"].includes(b.status)),ae=s.filter(b=>b.status==="COMPLETED"),xe=s.filter(b=>b.status==="CANCELLED"),we=s.filter(b=>b.status==="COMPLETED").reduce((b,B)=>b+B.amount,0),ve=i.filter(b=>b.status==="COMPLETED").reduce((b,B)=>b+B.amount,0),Ee=y.filter(b=>b.status==="COMPLETED").reduce((b,B)=>b+B.amount,0),ye=J.filter(b=>b.status==="COMPLETED").reduce((b,B)=>b+B.amount,0);return {totalVolume:we,depositsCount:i.length,depositsTotal:ve,payoutsCount:y.length,payoutsTotal:Ee,failedCount:te.length,refundsCount:J.length,refundsTotal:ye,pendingCount:I.length,completedCount:ae.length,cancelledCount:xe.length}},[s]),Q=useMemo(()=>{let i={};s.forEach(I=>{let ae=new Date(I.createdAt).toLocaleDateString(x==="fr"?"fr-FR":"en-US",{day:"2-digit",month:"short"});i[ae]||(i[ae]={date:ae,deposits:0,payouts:0,refunds:0}),I.status==="COMPLETED"&&(i[ae][I.type==="deposit"?"deposits":I.type==="payout"?"payouts":"refunds"]+=I.amount);});let y=Object.values(i).slice(-7),J=[{name:l.deposit,value:T.depositsTotal,count:T.depositsCount,fill:R.deposit},{name:l.payout,value:T.payoutsTotal,count:T.payoutsCount,fill:R.payout},{name:l.refund,value:T.refundsTotal,count:T.refundsCount,fill:R.refund}],te=[{name:"Completed",value:T.completedCount,fill:R.COMPLETED},{name:"Pending",value:T.pendingCount,fill:R.PENDING},{name:"Failed",value:T.failedCount,fill:R.FAILED},{name:"Cancelled",value:T.cancelledCount,fill:R.CANCELLED}].filter(I=>I.value>0);return {volumeData:y,typeData:J,statusData:te}},[s,T,x,l]),ue=useMemo(()=>s.filter(i=>{let y=$===""||i.id.toLowerCase().includes($.toLowerCase())||i.phoneNumber.includes($),J=re==="all"||i.type===re,te=j==="all"||i.status===j;return y&&J&&te}),[s,$,re,j]),G=useCallback(i=>{navigator.clipboard.writeText(i),X(i),setTimeout(()=>X(null),2e3);},[]),Y=s[0]?.currency||"XAF",me=useMemo(()=>[{accessorKey:"id",header:l.id,cell:({row:i})=>jsxs("div",{className:"flex items-center gap-2",children:[jsxs("span",{className:"font-mono text-xs truncate max-w-[100px]",title:i.original.id,children:[i.original.id.slice(0,8),"..."]}),jsx(oe,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:y=>{y.stopPropagation(),G(i.original.id);},children:ie===i.original.id?jsx(Check,{className:"w-3.5 h-3.5 text-green-600"}):jsx(Copy,{className:"w-3.5 h-3.5 text-muted-foreground"})})]})},{accessorKey:"type",header:l.type,cell:({row:i})=>jsxs("span",{className:k("inline-flex items-center gap-1.5 px-2.5 py-1 text-xs font-medium rounded-full",i.original.type==="deposit"&&"bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200",i.original.type==="payout"&&"bg-blue-100 text-blue-800 dark:bg-blue-900 dark:text-blue-200",i.original.type==="refund"&&"bg-orange-100 text-orange-800 dark:bg-orange-900 dark:text-orange-200"),children:[i.original.type==="deposit"&&jsx(ArrowDownCircle,{className:"w-3 h-3"}),i.original.type==="payout"&&jsx(ArrowUpCircle,{className:"w-3 h-3"}),i.original.type==="refund"&&jsx(RefreshCw,{className:"w-3 h-3"}),l[i.original.type]]})},{accessorKey:"amount",header:l.amount,cell:({row:i})=>jsx("span",{className:"font-semibold",children:ce(i.original.amount,i.original.currency)})},{accessorKey:"status",header:l.status,cell:({row:i})=>jsxs("span",{className:k("inline-flex items-center gap-1.5 px-2.5 py-1 text-xs font-medium rounded-full",Na[i.original.status]),children:[jsx(Ta,{status:i.original.status}),i.original.status]})},{accessorKey:"provider",header:l.provider,cell:({row:i})=>jsx("span",{className:"text-muted-foreground",children:i.original.provider.replace(/_/g," ")})},{accessorKey:"phoneNumber",header:l.phone,cell:({row:i})=>jsx("span",{className:"font-mono text-muted-foreground",children:i.original.phoneNumber})},{accessorKey:"createdAt",header:l.date,cell:({row:i})=>jsx("span",{className:"text-muted-foreground",children:wa(i.original.createdAt,x)})}],[l,x,ie,G]),U=useReactTable({data:ue,columns:me,getCoreRowModel:getCoreRowModel(),getPaginationRowModel:getPaginationRowModel(),getFilteredRowModel:getFilteredRowModel(),onColumnFiltersChange:ee,state:{columnFilters:fe},initialState:{pagination:{pageSize:10}}}),P=()=>jsx("div",{className:"space-y-3 p-4",children:Array.from({length:5}).map((i,y)=>jsxs("div",{className:"flex items-center gap-4",children:[jsx(V,{className:"h-4 w-24"}),jsx(V,{className:"h-6 w-16 rounded-full"}),jsx(V,{className:"h-4 w-20"}),jsx(V,{className:"h-6 w-20 rounded-full"}),jsx(V,{className:"h-4 w-24"}),jsx(V,{className:"h-4 w-28"}),jsx(V,{className:"h-4 w-32"})]},y))}),C=()=>jsxs(D,{children:[jsx(L,{className:"pb-2",children:jsxs("div",{className:"flex items-center gap-2",children:[jsx(V,{className:"h-8 w-8 rounded-md"}),jsx(V,{className:"h-4 w-24"})]})}),jsxs(O,{children:[jsx(V,{className:"h-8 w-32 mb-2"}),jsx(V,{className:"h-3 w-20"})]})]});return jsxs("div",{className:k("space-y-6",g),children:[jsxs("div",{className:"flex items-center justify-between flex-wrap gap-4",children:[jsxs("div",{children:[jsx("h1",{className:"text-2xl font-bold tracking-tight",children:n||l.title}),jsx("p",{className:"text-muted-foreground mt-1",children:d||l.subtitle})]}),jsxs("div",{className:"flex items-center gap-2",children:[m&&jsxs(oe,{variant:"outline",size:"sm",onClick:m,disabled:E,children:[jsx(RefreshCw,{className:k("w-4 h-4",E&&"animate-spin")}),l.refresh]}),u&&jsx(oe,{variant:"outline",size:"icon",onClick:u,title:l.settings,children:jsx(Settings,{className:"w-4 h-4"})}),F&&_&&jsx(oe,{onClick:_,children:l.expertMode})]})]}),jsxs(Ca,{value:be,onValueChange:Z,children:[jsxs(bt,{children:[jsxs(Le,{value:"dashboard",className:"gap-2",children:[jsx(LayoutDashboard,{className:"w-4 h-4"}),l.dashboard]}),jsxs(Le,{value:"charts",className:"gap-2",children:[jsx(BarChart3,{className:"w-4 h-4"}),l.charts]})]}),jsxs(Oe,{value:"dashboard",className:"space-y-6",children:[jsx("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:E?jsx(Fragment,{children:Array.from({length:8}).map((i,y)=>jsx(C,{},y))}):jsxs(Fragment,{children:[jsxs(D,{children:[jsx(L,{className:"pb-2",children:jsxs("div",{className:"flex items-center gap-2",children:[jsx("div",{className:"p-2 rounded-md bg-primary/10",children:jsx(TrendingUp,{className:"w-4 h-4 text-primary"})}),jsx("span",{className:"text-sm font-medium text-muted-foreground",children:l.totalVolume})]})}),jsxs(O,{children:[jsx("p",{className:"text-2xl font-bold",children:ce(T.totalVolume,Y)}),jsxs("p",{className:"text-xs text-muted-foreground",children:[s.length," ",l.transactions]})]})]}),jsxs(D,{children:[jsx(L,{className:"pb-2",children:jsxs("div",{className:"flex items-center gap-2",children:[jsx("div",{className:"p-2 rounded-md bg-green-500/10",children:jsx(ArrowDownCircle,{className:"w-4 h-4 text-green-600 dark:text-green-400"})}),jsx("span",{className:"text-sm font-medium text-muted-foreground",children:l.deposits})]})}),jsxs(O,{children:[jsx("p",{className:"text-2xl font-bold",children:ce(T.depositsTotal,Y)}),jsxs("p",{className:"text-xs text-muted-foreground",children:[T.depositsCount," ",l.transactions]})]})]}),jsxs(D,{children:[jsx(L,{className:"pb-2",children:jsxs("div",{className:"flex items-center gap-2",children:[jsx("div",{className:"p-2 rounded-md bg-blue-500/10",children:jsx(ArrowUpCircle,{className:"w-4 h-4 text-blue-600 dark:text-blue-400"})}),jsx("span",{className:"text-sm font-medium text-muted-foreground",children:l.payouts})]})}),jsxs(O,{children:[jsx("p",{className:"text-2xl font-bold",children:ce(T.payoutsTotal,Y)}),jsxs("p",{className:"text-xs text-muted-foreground",children:[T.payoutsCount," ",l.transactions]})]})]}),jsxs(D,{children:[jsx(L,{className:"pb-2",children:jsxs("div",{className:"flex items-center gap-2",children:[jsx("div",{className:"p-2 rounded-md bg-orange-500/10",children:jsx(RefreshCw,{className:"w-4 h-4 text-orange-600 dark:text-orange-400"})}),jsx("span",{className:"text-sm font-medium text-muted-foreground",children:l.refunds})]})}),jsxs(O,{children:[jsx("p",{className:"text-2xl font-bold",children:ce(T.refundsTotal,Y)}),jsxs("p",{className:"text-xs text-muted-foreground",children:[T.refundsCount," ",l.transactions]})]})]}),jsxs(D,{children:[jsx(L,{className:"pb-2",children:jsxs("div",{className:"flex items-center gap-2",children:[jsx("div",{className:"p-2 rounded-md bg-yellow-500/10",children:jsx(Hourglass,{className:"w-4 h-4 text-yellow-600 dark:text-yellow-400"})}),jsx("span",{className:"text-sm font-medium text-muted-foreground",children:l.pending})]})}),jsxs(O,{children:[jsx("p",{className:"text-2xl font-bold",children:T.pendingCount}),jsx("p",{className:"text-xs text-muted-foreground",children:l.transactions})]})]}),jsxs(D,{children:[jsx(L,{className:"pb-2",children:jsxs("div",{className:"flex items-center gap-2",children:[jsx("div",{className:"p-2 rounded-md bg-green-500/10",children:jsx(CheckCircle2,{className:"w-4 h-4 text-green-600 dark:text-green-400"})}),jsx("span",{className:"text-sm font-medium text-muted-foreground",children:l.completed})]})}),jsxs(O,{children:[jsx("p",{className:"text-2xl font-bold",children:T.completedCount}),jsx("p",{className:"text-xs text-muted-foreground",children:l.transactions})]})]}),jsxs(D,{children:[jsx(L,{className:"pb-2",children:jsxs("div",{className:"flex items-center gap-2",children:[jsx("div",{className:"p-2 rounded-md bg-red-500/10",children:jsx(XCircle,{className:"w-4 h-4 text-red-600 dark:text-red-400"})}),jsx("span",{className:"text-sm font-medium text-muted-foreground",children:l.failed})]})}),jsxs(O,{children:[jsx("p",{className:"text-2xl font-bold",children:T.failedCount}),jsx("p",{className:"text-xs text-muted-foreground",children:l.transactions})]})]}),jsxs(D,{children:[jsx(L,{className:"pb-2",children:jsxs("div",{className:"flex items-center gap-2",children:[jsx("div",{className:"p-2 rounded-md bg-gray-500/10",children:jsx(Ban,{className:"w-4 h-4 text-gray-600 dark:text-gray-400"})}),jsx("span",{className:"text-sm font-medium text-muted-foreground",children:l.cancelled})]})}),jsxs(O,{children:[jsx("p",{className:"text-2xl font-bold",children:T.cancelledCount}),jsx("p",{className:"text-xs text-muted-foreground",children:l.transactions})]})]})]})}),jsxs("div",{className:"flex flex-wrap gap-3",children:[jsxs("div",{className:"relative flex-1 min-w-[200px]",children:[jsx(Search,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground pointer-events-none"}),jsx(ft,{type:"text",placeholder:l.search,value:$,onChange:i=>N(i.target.value),className:"pl-9"})]}),jsxs(it,{value:re,onValueChange:i=>M(i),children:[jsx(Fe,{className:"w-[160px]",children:jsx(lt,{placeholder:l.allTypes})}),jsxs(He,{children:[jsx(A,{value:"all",children:l.allTypes}),jsx(A,{value:"deposit",children:l.deposit}),jsx(A,{value:"payout",children:l.payout}),jsx(A,{value:"refund",children:l.refund})]})]}),jsxs(it,{value:j,onValueChange:i=>H(i),children:[jsx(Fe,{className:"w-[160px]",children:jsx(lt,{placeholder:l.allStatuses})}),jsxs(He,{children:[jsx(A,{value:"all",children:l.allStatuses}),jsx(A,{value:"COMPLETED",children:"COMPLETED"}),jsx(A,{value:"PENDING",children:"PENDING"}),jsx(A,{value:"PROCESSING",children:"PROCESSING"}),jsx(A,{value:"ACCEPTED",children:"ACCEPTED"}),jsx(A,{value:"FAILED",children:"FAILED"}),jsx(A,{value:"CANCELLED",children:"CANCELLED"}),jsx(A,{value:"REJECTED",children:"REJECTED"})]})]})]}),jsx(D,{children:E?jsx(P,{}):ue.length===0?jsx(dt,{icon:Inbox,title:l.noTransactions,description:l.noTransactionsDesc,action:K&&jsxs(oe,{onClick:K,children:[jsx(Plus,{className:"w-4 h-4"}),l.addTransaction]})}):jsxs(Fragment,{children:[jsxs(xt,{children:[jsx(vt,{children:U.getHeaderGroups().map(i=>jsx(We,{children:i.headers.map(y=>jsx(ht,{children:y.isPlaceholder?null:flexRender(y.column.columnDef.header,y.getContext())},y.id))},i.id))}),jsx(yt,{children:U.getRowModel().rows.map(i=>jsx(We,{onClick:()=>v?.(i.original),className:v?"cursor-pointer":"",children:i.getVisibleCells().map(y=>jsx(Nt,{children:flexRender(y.column.columnDef.cell,y.getContext())},y.id))},i.id))})]}),jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-t",children:[jsxs("p",{className:"text-sm text-muted-foreground",children:[ue.length," ",l.transactions]}),jsxs("div",{className:"flex items-center gap-2",children:[jsxs(oe,{variant:"outline",size:"sm",onClick:()=>U.previousPage(),disabled:!U.getCanPreviousPage(),children:[jsx(ChevronLeft,{className:"w-4 h-4"}),l.previous]}),jsxs("span",{className:"text-sm px-2",children:[l.page," ",U.getState().pagination.pageIndex+1," ",l.of," ",U.getPageCount()]}),jsxs(oe,{variant:"outline",size:"sm",onClick:()=>U.nextPage(),disabled:!U.getCanNextPage(),children:[l.next,jsx(ChevronRight,{className:"w-4 h-4"})]})]})]})]})})]}),jsx(Oe,{value:"charts",className:"space-y-6",children:s.length===0?jsx(D,{children:jsx(dt,{icon:BarChart3,title:l.noDataForCharts,description:l.noTransactionsDesc})}):jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[jsxs(D,{className:"col-span-1 lg:col-span-2",children:[jsx(L,{children:jsx(Ce,{children:l.volumeOverTime})}),jsx(O,{children:jsx("div",{className:"h-[300px]",children:jsx(ResponsiveContainer,{width:"100%",height:"100%",children:jsxs(AreaChart,{data:Q.volumeData,children:[jsxs("defs",{children:[jsxs("linearGradient",{id:"colorDeposits",x1:"0",y1:"0",x2:"0",y2:"1",children:[jsx("stop",{offset:"5%",stopColor:R.deposit,stopOpacity:.3}),jsx("stop",{offset:"95%",stopColor:R.deposit,stopOpacity:0})]}),jsxs("linearGradient",{id:"colorPayouts",x1:"0",y1:"0",x2:"0",y2:"1",children:[jsx("stop",{offset:"5%",stopColor:R.payout,stopOpacity:.3}),jsx("stop",{offset:"95%",stopColor:R.payout,stopOpacity:0})]})]}),jsx(CartesianGrid,{strokeDasharray:"3 3",className:"stroke-muted"}),jsx(XAxis,{dataKey:"date",className:"text-xs"}),jsx(YAxis,{className:"text-xs"}),jsx(Tooltip,{contentStyle:{backgroundColor:"hsl(var(--popover))",border:"1px solid hsl(var(--border))",borderRadius:"8px"}}),jsx(Legend,{}),jsx(Area,{type:"monotone",dataKey:"deposits",name:l.deposits,stroke:R.deposit,fillOpacity:1,fill:"url(#colorDeposits)"}),jsx(Area,{type:"monotone",dataKey:"payouts",name:l.payouts,stroke:R.payout,fillOpacity:1,fill:"url(#colorPayouts)"})]})})})})]}),jsxs(D,{children:[jsx(L,{children:jsx(Ce,{children:l.transactionsByType})}),jsx(O,{children:jsx("div",{className:"h-[300px]",children:jsx(ResponsiveContainer,{width:"100%",height:"100%",children:jsxs(BarChart,{data:Q.typeData,children:[jsx(CartesianGrid,{strokeDasharray:"3 3",className:"stroke-muted"}),jsx(XAxis,{dataKey:"name",className:"text-xs"}),jsx(YAxis,{className:"text-xs"}),jsx(Tooltip,{contentStyle:{backgroundColor:"hsl(var(--popover))",border:"1px solid hsl(var(--border))",borderRadius:"8px"},formatter:i=>ce(i,Y)}),jsx(Bar,{dataKey:"value",name:l.amount,radius:[4,4,0,0],children:Q.typeData.map((i,y)=>jsx(Cell,{fill:i.fill},`cell-${y}`))})]})})})})]}),jsxs(D,{children:[jsx(L,{children:jsx(Ce,{children:l.statusDistribution})}),jsx(O,{children:jsx("div",{className:"h-[300px]",children:jsx(ResponsiveContainer,{width:"100%",height:"100%",children:jsxs(PieChart,{children:[jsx(Pie,{data:Q.statusData,cx:"50%",cy:"50%",innerRadius:60,outerRadius:100,paddingAngle:2,dataKey:"value",label:({name:i,percent:y})=>`${i} ${(y*100).toFixed(0)}%`,labelLine:false,children:Q.statusData.map((i,y)=>jsx(Cell,{fill:i.fill},`cell-${y}`))}),jsx(Tooltip,{contentStyle:{backgroundColor:"hsl(var(--popover))",border:"1px solid hsl(var(--border))",borderRadius:"8px"}}),jsx(Legend,{})]})})})})]})]})})]})]})}var Sa=s=>({depositId:s,status:"ACCEPTED",created:new Date().toISOString(),nextStep:"FINAL_STATUS"}),Pa=s=>({payoutId:s,status:"ACCEPTED",created:new Date().toISOString()}),Da=s=>({depositId:s,status:["COMPLETED","ACCEPTED","PROCESSING","ENQUEUED"][Math.floor(Math.random()*4)],created:new Date(Date.now()-6e4).toISOString(),amount:"5000",currency:"XAF",country:"CMR",payer:{type:"MMO",accountDetails:{phoneNumber:"237670000000",provider:"MTN_MOMO_CMR"}}}),Ma=()=>[{country:"CMR",providers:[{provider:"MTN_MOMO_CMR",operationTypes:[{operationType:"DEPOSIT",status:"OPERATIONAL"},{operationType:"PAYOUT",status:"OPERATIONAL"}]},{provider:"ORANGE_CMR",operationTypes:[{operationType:"DEPOSIT",status:"OPERATIONAL"},{operationType:"PAYOUT",status:"DELAYED"}]}]}],Ia=s=>({country:"CMR",provider:s.startsWith("23767")?"MTN_MOMO_CMR":"ORANGE_CMR",phoneNumber:s.replace(/\D/g,"")}),Ra=()=>({companyName:"Demo Company",signatureConfiguration:{signedRequestsOnly:false,signedCallbacks:true},countries:[{country:"CMR",displayName:{en:"Cameroon",fr:"Cameroun"},prefix:"237",flag:"https://cdn.pawapay.io/flags/cmr.svg",providers:[{provider:"MTN_MOMO_CMR",displayName:"MTN Mobile Money",nameDisplayedToCustomer:"MTN MoMo",currencies:[{currency:"XAF",displayName:"CFA Franc",operationTypes:{DEPOSIT:{minAmount:"100",maxAmount:"1000000",status:"OPERATIONAL"},PAYOUT:{minAmount:"100",maxAmount:"500000",status:"OPERATIONAL"}}}]}]}]}),Aa=()=>({balances:[{country:"CMR",currency:"XAF",balance:"1250000.00"},{country:"COG",currency:"XAF",balance:"450000.00"},{country:"GAB",currency:"XAF",balance:"780000.00"}]}),La=()=>[{id:"key-001",key:"MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA..."}],se=(s=800)=>new Promise(n=>setTimeout(n,s+Math.random()*400));async function Ct(s,n){let d=new TextEncoder,x=await crypto.subtle.importKey("raw",d.encode(n),{name:"HMAC",hash:"SHA-256"},false,["sign"]),g=await crypto.subtle.sign("HMAC",x,d.encode(s));return Array.from(new Uint8Array(g)).map(F=>F.toString(16).padStart(2,"0")).join("")}var ke=()=>"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,s=>{let n=Math.random()*16|0;return (s==="x"?n:n&3|8).toString(16)}),_e=[{value:"MTN_MOMO_CMR",label:"MTN Mobile Money",country:"Cameroun"},{value:"ORANGE_CMR",label:"Orange Money",country:"Cameroun"},{value:"MTN_MOMO_COG",label:"MTN Mobile Money",country:"Congo"},{value:"AIRTEL_COG",label:"Airtel Money",country:"Congo"},{value:"MTN_MOMO_GAB",label:"MTN Mobile Money",country:"Gabon"},{value:"AIRTEL_GAB",label:"Airtel Money",country:"Gabon"}],kt=[{value:"XAF",label:"XAF (CFA Franc BEAC)"},{value:"XOF",label:"XOF (CFA Franc BCEAO)"},{value:"GHS",label:"GHS (Ghana Cedi)"},{value:"KES",label:"KES (Kenyan Shilling)"},{value:"RWF",label:"RWF (Rwandan Franc)"},{value:"TZS",label:"TZS (Tanzanian Shilling)"},{value:"UGX",label:"UGX (Ugandan Shilling)"},{value:"ZMW",label:"ZMW (Zambian Kwacha)"}];function Oa({apiKey:s="",environment:n="sandbox",className:d="",demoMode:x=false,apiBasePath:g="/api/pawapay",onDepositComplete:F,onPayoutComplete:_,onError:v}){let[m,K]=useState(s),[u,E]=useState(n),[l,$]=useState(!!s||x),[N,re]=useState(x),[M,j]=useState("deposit"),[H,ie]=useState("237670000000"),[X,be]=useState("5000"),[Z,fe]=useState("XAF"),[ee,T]=useState("MTN_MOMO_CMR"),[Q,ue]=useState("Test Payment"),[G,Y]=useState(""),[me,U]=useState([]),[P,C]=useState("idle"),[i,y]=useState("whsec_test_secret_key"),[J,te]=useState([]),[I,ae]=useState("deposit.completed"),[xe,we]=useState("5000"),[ve,Ee]=useState("237670000000"),[ye,b]=useState("MTN_MOMO_CMR"),[B,Dt]=useState(""),[Ge,Mt]=useState(""),[Ue,It]=useState(""),[Se,Rt]=useState(""),[Be,At]=useState(""),[he,Ve]=useState(null),[ze,Lt]=useState(""),[le,Ke]=useState(null),[Je,$e]=useState(""),[pe,Ot]=useState("all"),p=useCallback((a,c,f,q)=>{let De={id:ke(),operation:a,status:c,response:f,error:q,timestamp:new Date().toLocaleTimeString()};U(Kt=>[De,...Kt].slice(0,20));},[]),Ft=useCallback(()=>{if(!m.trim()){p("Configuration","error",void 0,"API Key is required");return}$(true),re(false),p("Configuration","success",{environment:u,configured:true,apiBasePath:g});},[m,u,g,p]),Ht=useCallback(()=>{re(true),$(true),p("Configuration","success",{mode:"demo",message:"Demo mode activated - responses are simulated"});},[p]),Wt=useCallback(async()=>{if(!(!m&&!N)){C("loading");try{let a=ke();Y(a);let c;if(N)await se(),c=Sa(a);else {let f=await fetch(`${g}/deposit`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({apiKey:m,environment:u,amount:parseFloat(X),currency:Z,provider:ee,phoneNumber:H,customerMessage:Q.slice(0,22),transactionId:a})}),q=await f.json();if(!f.ok)throw new Error(q.error||"Deposit failed");c=q;}C("success"),p("Deposit","success",c),F?.(c);}catch(a){C("error");let c=a instanceof Error?a.message:"Deposit failed";p("Deposit","error",void 0,c),v?.(a instanceof Error?a:new Error(c));}}},[m,g,u,N,X,Z,ee,H,Q,p,F,v]),_t=useCallback(async()=>{if(!(!m&&!N)){C("loading");try{let a=ke();Y(a);let c;if(N)await se(),c=Pa(a);else {let f=await fetch(`${g}/payout`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({apiKey:m,environment:u,amount:parseFloat(X),currency:Z,provider:ee,phoneNumber:H,transactionId:a})}),q=await f.json();if(!f.ok)throw new Error(q.error||"Payout failed");c=q;}C("success"),p("Payout","success",c),_?.(c);}catch(a){C("error");let c=a instanceof Error?a.message:"Payout failed";p("Payout","error",void 0,c),v?.(a instanceof Error?a:new Error(c));}}},[m,g,u,N,X,Z,ee,H,p,_,v]),jt=useCallback(async()=>{if(!m&&!N||!G){p("Check Status","error",void 0,"No transaction ID");return}C("loading");try{let a;if(N)await se(),a=Da(G);else {let c=await fetch(`${g}/status`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({apiKey:m,environment:u,transactionId:G})}),f=await c.json();if(!c.ok)throw new Error(f.error||"Status check failed");a=f;}C("success"),p("Check Status","success",a);}catch(a){C("error");let c=a instanceof Error?a.message:"Status check failed";p("Check Status","error",void 0,c),v?.(a instanceof Error?a:new Error(c));}},[m,g,u,N,G,p,v]),Gt=useCallback(async()=>{if(!(!m&&!N)){C("loading");try{let a;if(N)await se(),a=Ma();else {let c=await fetch(`${g}/availability`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({apiKey:m,environment:u})}),f=await c.json();if(!c.ok)throw new Error(f.error||"Availability check failed");a=f;}C("success"),p("Provider Availability","success",a);}catch(a){C("error");let c=a instanceof Error?a.message:"Availability check failed";p("Provider Availability","error",void 0,c),v?.(a instanceof Error?a:new Error(c));}}},[m,g,u,N,p,v]),Ut=useCallback(async()=>{if(!(!m&&!N)){C("loading");try{let a;if(N)await se(),a=Ia(H);else {let c=await fetch(`${g}/predict-provider`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({apiKey:m,environment:u,phoneNumber:H})}),f=await c.json();if(!c.ok)throw new Error(f.error||"Prediction failed");a=f;}C("success"),p("Predict Provider","success",a);}catch(a){C("error");let c=a instanceof Error?a.message:"Prediction failed";p("Predict Provider","error",void 0,c),v?.(a instanceof Error?a:new Error(c));}}},[m,g,u,N,H,p,v]),Bt=useCallback(async()=>{if(!(!m&&!N)){C("loading");try{let a;if(N)await se(),a=Ra();else {let c=await fetch(`${g}/active-config`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({apiKey:m,environment:u})}),f=await c.json();if(!c.ok)throw new Error(f.error||"Failed to get config");a=f;}C("success"),p("Active Configuration","success",a);}catch(a){C("error");let c=a instanceof Error?a.message:"Failed to get config";p("Active Configuration","error",void 0,c),v?.(a instanceof Error?a:new Error(c));}}},[m,g,u,N,p,v]),Vt=useCallback(async()=>{if(!(!m&&!N)){C("loading");try{let a;if(N)await se(),a=La();else {let c=await fetch(`${g}/public-keys`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({apiKey:m,environment:u})}),f=await c.json();if(!c.ok)throw new Error(f.error||"Failed to get public keys");a=f;}C("success"),p("Public Keys","success",a);}catch(a){C("error");let c=a instanceof Error?a.message:"Failed to get public keys";p("Public Keys","error",void 0,c),v?.(a instanceof Error?a:new Error(c));}}},[m,g,u,N,p,v]),zt=useCallback(async()=>{if(!(!m&&!N)){C("loading");try{let a;if(N)await se(),a=Aa();else {let c=await fetch(`${g}/wallet-balances`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({apiKey:m,environment:u})}),f=await c.json();if(!c.ok)throw new Error(f.error||"Failed to get balances");a=f;}C("success"),p("Wallet Balances","success",a);}catch(a){C("error");let c=a instanceof Error?a.message:"Failed to get balances";p("Wallet Balances","error",void 0,c),v?.(a instanceof Error?a:new Error(c));}}},[m,g,u,N,p,v]),Pe=useCallback(a=>{navigator.clipboard.writeText(a);},[]);return l?jsxs("div",{className:`space-y-6 ${d}`,children:[jsxs("div",{className:"flex items-center justify-between flex-wrap gap-4",children:[jsxs("div",{children:[jsxs("div",{className:"flex items-center gap-2",children:[jsx("h1",{className:"text-2xl font-bold tracking-tight",children:"Spaark Pay Console"}),N?jsx("span",{className:"px-2 py-0.5 text-xs font-medium bg-amber-100 text-amber-800 dark:bg-amber-900 dark:text-amber-200",children:"DEMO"}):u==="production"?jsx("span",{className:"px-2 py-0.5 text-xs font-medium bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200",children:"PRODUCTION"}):jsx("span",{className:"px-2 py-0.5 text-xs font-medium bg-blue-100 text-blue-800 dark:bg-blue-900 dark:text-blue-200",children:"SANDBOX"})]}),jsx("p",{className:"text-muted-foreground mt-1",children:N?"Mode d\xE9mo - Les r\xE9ponses sont simul\xE9es":u==="production"?"Mode production - Transactions r\xE9elles":"Mode sandbox - Environnement de test"})]}),jsxs("button",{onClick:()=>$(false),className:"h-8 px-3 text-xs font-medium border border-border bg-background hover:bg-muted transition-colors flex items-center gap-2",children:[jsx(je,{}),"Reconfigure"]})]}),jsxs("div",{className:"grid lg:grid-cols-3 gap-6",children:[jsxs("div",{className:"lg:col-span-2 space-y-6",children:[jsxs("div",{className:"flex flex-wrap gap-1 bg-muted p-1",children:[jsxs("button",{onClick:()=>j("deposit"),className:`flex-1 min-w-[80px] h-8 px-3 text-xs font-medium transition-colors flex items-center justify-center gap-1.5 ${M==="deposit"?"bg-background text-foreground":"text-muted-foreground hover:text-foreground"}`,children:[jsx(Tt,{}),"Deposit"]}),jsxs("button",{onClick:()=>j("payout"),className:`flex-1 min-w-[80px] h-8 px-3 text-xs font-medium transition-colors flex items-center justify-center gap-1.5 ${M==="payout"?"bg-background text-foreground":"text-muted-foreground hover:text-foreground"}`,children:[jsx(Fa,{}),"Payout"]}),jsxs("button",{onClick:()=>j("status"),className:`flex-1 min-w-[80px] h-8 px-3 text-xs font-medium transition-colors flex items-center justify-center gap-1.5 ${M==="status"?"bg-background text-foreground":"text-muted-foreground hover:text-foreground"}`,children:[jsx(wt,{}),"Status"]}),jsxs("button",{onClick:()=>j("toolkit"),className:`flex-1 min-w-[80px] h-8 px-3 text-xs font-medium transition-colors flex items-center justify-center gap-1.5 ${M==="toolkit"?"bg-background text-foreground":"text-muted-foreground hover:text-foreground"}`,children:[jsx(Wa,{}),"Toolkit"]}),jsxs("button",{onClick:()=>j("finances"),className:`flex-1 min-w-[80px] h-8 px-3 text-xs font-medium transition-colors flex items-center justify-center gap-1.5 ${M==="finances"?"bg-background text-foreground":"text-muted-foreground hover:text-foreground"}`,children:[jsx(_a,{}),"Finances"]}),jsxs("button",{onClick:()=>j("webhooks"),className:`flex-1 min-w-[80px] h-8 px-3 text-xs font-medium transition-colors flex items-center justify-center gap-1.5 ${M==="webhooks"?"bg-background text-foreground":"text-muted-foreground hover:text-foreground"}`,children:[jsx(Ba,{}),"Webhooks"]})]}),M==="deposit"&&jsxs("div",{className:"border border-border bg-background p-6 space-y-4",children:[jsxs("div",{children:[jsx("h3",{className:"font-semibold",children:"Initiate Deposit"}),jsx("p",{className:"text-xs text-muted-foreground",children:"Collect payment from a Mobile Money user"})]}),jsxs("div",{className:"grid sm:grid-cols-2 gap-4",children:[jsxs("div",{className:"space-y-2",children:[jsx("label",{className:"text-xs font-medium",children:"Phone Number"}),jsx("input",{placeholder:"237670000000",value:H,onChange:a=>ie(a.target.value),className:"w-full h-8 px-2.5 text-xs border border-input bg-transparent rounded-none outline-none focus:border-ring"})]}),jsxs("div",{className:"space-y-2",children:[jsx("label",{className:"text-xs font-medium",children:"Amount"}),jsx("input",{type:"number",placeholder:"5000",value:X,onChange:a=>be(a.target.value),className:"w-full h-8 px-2.5 text-xs border border-input bg-transparent rounded-none outline-none focus:border-ring"})]}),jsxs("div",{className:"space-y-2",children:[jsx("label",{className:"text-xs font-medium",children:"Currency"}),jsx("select",{value:Z,onChange:a=>fe(a.target.value),className:"w-full h-8 px-2.5 text-xs border border-input bg-transparent rounded-none outline-none focus:border-ring",children:kt.map(a=>jsx("option",{value:a.value,children:a.label},a.value))})]}),jsxs("div",{className:"space-y-2",children:[jsx("label",{className:"text-xs font-medium",children:"Provider"}),jsx("select",{value:ee,onChange:a=>T(a.target.value),className:"w-full h-8 px-2.5 text-xs border border-input bg-transparent rounded-none outline-none focus:border-ring",children:_e.map(a=>jsxs("option",{value:a.value,children:[a.label," (",a.country,")"]},a.value))})]}),jsxs("div",{className:"space-y-2 sm:col-span-2",children:[jsx("label",{className:"text-xs font-medium",children:"Customer Message (4-22 chars)"}),jsx("input",{placeholder:"Payment description",value:Q,onChange:a=>ue(a.target.value),maxLength:22,className:"w-full h-8 px-2.5 text-xs border border-input bg-transparent rounded-none outline-none focus:border-ring"})]})]}),jsxs("button",{onClick:Wt,disabled:P==="loading",className:"w-full h-8 px-3 text-xs font-medium bg-primary text-primary-foreground hover:bg-primary/90 disabled:opacity-50 transition-colors flex items-center justify-center gap-2",children:[P==="loading"?jsx(ge,{}):jsx(Te,{}),"Execute Deposit"]})]}),M==="payout"&&jsxs("div",{className:"border border-border bg-background p-6 space-y-4",children:[jsxs("div",{children:[jsx("h3",{className:"font-semibold",children:"Initiate Payout"}),jsx("p",{className:"text-xs text-muted-foreground",children:"Send money to a Mobile Money account"})]}),jsxs("div",{className:"grid sm:grid-cols-2 gap-4",children:[jsxs("div",{className:"space-y-2",children:[jsx("label",{className:"text-xs font-medium",children:"Recipient Phone"}),jsx("input",{placeholder:"237670000000",value:H,onChange:a=>ie(a.target.value),className:"w-full h-8 px-2.5 text-xs border border-input bg-transparent rounded-none outline-none focus:border-ring"})]}),jsxs("div",{className:"space-y-2",children:[jsx("label",{className:"text-xs font-medium",children:"Amount"}),jsx("input",{type:"number",placeholder:"5000",value:X,onChange:a=>be(a.target.value),className:"w-full h-8 px-2.5 text-xs border border-input bg-transparent rounded-none outline-none focus:border-ring"})]}),jsxs("div",{className:"space-y-2",children:[jsx("label",{className:"text-xs font-medium",children:"Currency"}),jsx("select",{value:Z,onChange:a=>fe(a.target.value),className:"w-full h-8 px-2.5 text-xs border border-input bg-transparent rounded-none outline-none focus:border-ring",children:kt.map(a=>jsx("option",{value:a.value,children:a.label},a.value))})]}),jsxs("div",{className:"space-y-2",children:[jsx("label",{className:"text-xs font-medium",children:"Provider"}),jsx("select",{value:ee,onChange:a=>T(a.target.value),className:"w-full h-8 px-2.5 text-xs border border-input bg-transparent rounded-none outline-none focus:border-ring",children:_e.map(a=>jsxs("option",{value:a.value,children:[a.label," (",a.country,")"]},a.value))})]})]}),jsxs("button",{onClick:_t,disabled:P==="loading",className:"w-full h-8 px-3 text-xs font-medium bg-primary text-primary-foreground hover:bg-primary/90 disabled:opacity-50 transition-colors flex items-center justify-center gap-2",children:[P==="loading"?jsx(ge,{}):jsx(Te,{}),"Execute Payout"]})]}),M==="status"&&jsxs("div",{className:"border border-border bg-background p-6 space-y-4",children:[jsxs("div",{children:[jsx("h3",{className:"font-semibold",children:"Check Transaction Status"}),jsx("p",{className:"text-xs text-muted-foreground",children:"Query the status of a transaction"})]}),jsxs("div",{className:"space-y-4",children:[jsxs("div",{className:"space-y-2",children:[jsx("label",{className:"text-xs font-medium",children:"Transaction ID"}),jsxs("div",{className:"flex gap-2",children:[jsx("input",{placeholder:"Enter transaction ID (UUID)",value:G,onChange:a=>Y(a.target.value),className:"flex-1 h-8 px-2.5 text-xs border border-input bg-transparent rounded-none outline-none focus:border-ring font-mono"}),G&&jsx("button",{onClick:()=>Pe(G),className:"w-8 h-8 border border-border bg-background hover:bg-muted transition-colors flex items-center justify-center",title:"Copy to clipboard",children:jsx(Et,{})})]})]}),jsxs("button",{onClick:jt,disabled:P==="loading"||!G,className:"w-full h-8 px-3 text-xs font-medium bg-primary text-primary-foreground hover:bg-primary/90 disabled:opacity-50 transition-colors flex items-center justify-center gap-2",children:[P==="loading"?jsx(ge,{}):jsx(wt,{}),"Check Status"]})]})]}),M==="toolkit"&&jsxs("div",{className:"space-y-4",children:[jsxs("div",{className:"border border-border bg-background p-6 space-y-4",children:[jsxs("div",{children:[jsx("h3",{className:"font-semibold",children:"Predict Provider"}),jsx("p",{className:"text-xs text-muted-foreground",children:"Predict the provider from a phone number"})]}),jsxs("div",{className:"space-y-2",children:[jsx("label",{className:"text-xs font-medium",children:"Phone Number"}),jsx("input",{placeholder:"+237 670 000 000",value:H,onChange:a=>ie(a.target.value),className:"w-full h-8 px-2.5 text-xs border border-input bg-transparent rounded-none outline-none focus:border-ring"})]}),jsxs("button",{onClick:Ut,disabled:P==="loading",className:"w-full h-8 px-3 text-xs font-medium bg-primary text-primary-foreground hover:bg-primary/90 disabled:opacity-50 transition-colors flex items-center justify-center gap-2",children:[P==="loading"?jsx(ge,{}):jsx(ja,{}),"Predict Provider"]})]}),jsxs("div",{className:"grid sm:grid-cols-3 gap-3",children:[jsxs("button",{onClick:Gt,disabled:P==="loading",className:"h-10 px-3 text-xs font-medium border border-border bg-background hover:bg-muted disabled:opacity-50 transition-colors flex items-center justify-center gap-2",children:[jsx(Ga,{}),"Provider Availability"]}),jsxs("button",{onClick:Bt,disabled:P==="loading",className:"h-10 px-3 text-xs font-medium border border-border bg-background hover:bg-muted disabled:opacity-50 transition-colors flex items-center justify-center gap-2",children:[jsx(je,{}),"Active Config"]}),jsxs("button",{onClick:Vt,disabled:P==="loading",className:"h-10 px-3 text-xs font-medium border border-border bg-background hover:bg-muted disabled:opacity-50 transition-colors flex items-center justify-center gap-2",children:[jsx(Ua,{}),"Public Keys"]})]})]}),M==="finances"&&jsxs("div",{className:"space-y-4",children:[jsxs("div",{className:"border border-border bg-background p-6 space-y-4",children:[jsxs("div",{children:[jsx("h3",{className:"font-semibold",children:"Wallet Balances"}),jsx("p",{className:"text-xs text-muted-foreground",children:"View balances for all your wallets"})]}),jsxs("button",{onClick:zt,disabled:P==="loading",className:"w-full h-8 px-3 text-xs font-medium bg-primary text-primary-foreground hover:bg-primary/90 disabled:opacity-50 transition-colors flex items-center justify-center gap-2",children:[P==="loading"?jsx(ge,{}):jsx(Tt,{}),"Get Wallet Balances"]})]}),jsxs("div",{className:"border border-border bg-background p-6 space-y-4",children:[jsxs("div",{children:[jsx("h3",{className:"font-semibold",children:"Statements"}),jsx("p",{className:"text-xs text-muted-foreground",children:"Generate financial statements for your wallets"})]}),jsxs("div",{className:"p-4 bg-muted/50 text-xs text-muted-foreground",children:["Statement generation requires callback URL configuration. Use the SDK directly:",jsx("pre",{className:"mt-2 p-2 bg-background overflow-x-auto",children:`await sdk.finances.generateStatement({
1
+ import {forwardRef,useState,useMemo,useCallback,useEffect,useRef}from'react';import {ChevronDown,Check,Copy,ArrowDownCircle,ArrowUpCircle,RefreshCw,LayoutDashboard,BarChart3,Settings,FlaskConical,MoreVertical,TrendingUp,Hourglass,CheckCircle2,XCircle,Ban,Search,Inbox,Plus,ChevronLeft,ChevronRight,Wallet,Smartphone,Wrench,Zap,Loader2,PlayCircle,Wifi,Key,Shield,Code,Beaker,Globe,Lock,AlertCircle,Clock}from'lucide-react';import*as K from'@radix-ui/react-tabs';import*as E from'@radix-ui/react-select';import {useReactTable,getFilteredRowModel,getPaginationRowModel,getCoreRowModel,flexRender}from'@tanstack/react-table';import {ResponsiveContainer,AreaChart,CartesianGrid,XAxis,YAxis,Tooltip,Legend,Area,BarChart,Bar,Cell,PieChart,Pie}from'recharts';import {clsx}from'clsx';import {twMerge}from'tailwind-merge';import {jsx,jsxs,Fragment}from'react/jsx-runtime';var ne=()=>"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,o=>{let i=Math.random()*16|0;return (o==="x"?i:i&3|8).toString(16)});function Zt(o,i={}){let{transactionId:d=ne(),amount:g="5000",currency:p="XAF",correspondent:w="MTN_MOMO_CMR",phoneNumber:D="237670000000",status:x=o==="deposit.failed"?"FAILED":"COMPLETED",failureCode:b="INSUFFICIENT_FUNDS",failureMessage:G="The payer has insufficient funds"}=i,r=new Date().toISOString(),k={depositId:d,status:x,amount:g,currency:p,correspondent:w,payer:{type:"MSISDN",address:{value:D}},customerTimestamp:r,created:r};return x==="COMPLETED"&&(k.receivedByPayer=r),x==="FAILED"&&(k.failureReason={failureCode:b,failureMessage:G}),{eventId:ne(),eventType:o,timestamp:r,data:k}}function qt(o,i={}){let{transactionId:d=ne(),amount:g="5000",currency:p="XAF",correspondent:w="MTN_MOMO_CMR",phoneNumber:D="237670000000",status:x=o==="payout.failed"?"FAILED":"COMPLETED",failureCode:b="RECIPIENT_NOT_FOUND",failureMessage:G="The recipient account was not found"}=i,r=new Date().toISOString(),k={payoutId:d,status:x,amount:g,currency:p,correspondent:w,recipient:{type:"MSISDN",address:{value:D}},customerTimestamp:r,created:r};return x==="COMPLETED"&&(k.receivedByRecipient=r),x==="FAILED"&&(k.failureReason={failureCode:b,failureMessage:G}),{eventId:ne(),eventType:o,timestamp:r,data:k}}function ea(o,i={}){let{transactionId:d=ne(),depositId:g=ne(),amount:p="5000",currency:w="XAF",correspondent:D="MTN_MOMO_CMR",phoneNumber:x="237670000000",status:b=o==="refund.failed"?"FAILED":"COMPLETED",failureCode:G="REFUND_LIMIT_EXCEEDED",failureMessage:r="The refund limit has been exceeded"}=i,k=new Date().toISOString(),c={refundId:d,depositId:g,status:b,amount:p,currency:w,correspondent:D,recipient:{type:"MSISDN",address:{value:x}},created:k};return b==="FAILED"&&(c.failureReason={failureCode:G,failureMessage:r}),{eventId:ne(),eventType:o,timestamp:k,data:c}}function et(o,i={}){return o.startsWith("deposit.")?Zt(o,i):o.startsWith("payout.")?qt(o,i):ea(o,i)}var tt=["deposit.accepted","deposit.completed","deposit.failed","payout.accepted","payout.completed","payout.failed","refund.completed","refund.failed"];function N(...o){return twMerge(clsx(o))}var Da={fr:{title:"Tableau de bord financier",subtitle:"Vue d'ensemble de vos transactions",totalVolume:"Volume Total",deposits:"D\xE9p\xF4ts",payouts:"Retraits",failed:"\xC9checs",refunds:"Remboursements",pending:"En attente",completed:"Compl\xE9t\xE9es",cancelled:"Annul\xE9es",search:"Rechercher par ID ou t\xE9l\xE9phone...",allTypes:"Tous les types",allStatuses:"Tous les statuts",deposit:"D\xE9p\xF4t",payout:"Retrait",refund:"Remboursement",expertMode:"Mode Expert",refresh:"Actualiser",settings:"Param\xE8tres",actions:"Actions",noTransactions:"Aucune transaction",noTransactionsDesc:"Les transactions appara\xEEtront ici une fois effectu\xE9es.",addTransaction:"Nouvelle transaction",id:"ID",type:"Type",amount:"Montant",status:"Statut",provider:"Op\xE9rateur",phone:"T\xE9l\xE9phone",date:"Date",page:"Page",of:"sur",transactions:"transactions",copied:"Copi\xE9 !",dashboard:"Tableau de bord",charts:"Graphiques",volumeOverTime:"Volume dans le temps",transactionsByType:"Par type",statusDistribution:"Par statut",noDataForCharts:"Pas de donn\xE9es pour les graphiques",loading:"Chargement...",previous:"Pr\xE9c\xE9dent",next:"Suivant"},en:{title:"Finance Dashboard",subtitle:"Overview of your transactions",totalVolume:"Total Volume",deposits:"Deposits",payouts:"Payouts",failed:"Failed",refunds:"Refunds",pending:"Pending",completed:"Completed",cancelled:"Cancelled",search:"Search by ID or phone...",allTypes:"All types",allStatuses:"All statuses",deposit:"Deposit",payout:"Payout",refund:"Refund",expertMode:"Expert Mode",refresh:"Refresh",settings:"Settings",actions:"Actions",noTransactions:"No transactions",noTransactionsDesc:"Transactions will appear here once made.",addTransaction:"New transaction",id:"ID",type:"Type",amount:"Amount",status:"Status",provider:"Provider",phone:"Phone",date:"Date",page:"Page",of:"of",transactions:"transactions",copied:"Copied!",dashboard:"Dashboard",charts:"Charts",volumeOverTime:"Volume over time",transactionsByType:"By type",statusDistribution:"By status",noDataForCharts:"No data for charts",loading:"Loading...",previous:"Previous",next:"Next"}},Pa={COMPLETED:"bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200",ACCEPTED:"bg-blue-100 text-blue-800 dark:bg-blue-900 dark:text-blue-200",PENDING:"bg-yellow-100 text-yellow-800 dark:bg-yellow-900 dark:text-yellow-200",ENQUEUED:"bg-yellow-100 text-yellow-800 dark:bg-yellow-900 dark:text-yellow-200",PROCESSING:"bg-blue-100 text-blue-800 dark:bg-blue-900 dark:text-blue-200",FAILED:"bg-red-100 text-red-800 dark:bg-red-900 dark:text-red-200",CANCELLED:"bg-gray-100 text-gray-800 dark:bg-gray-900 dark:text-gray-200",REJECTED:"bg-red-100 text-red-800 dark:bg-red-900 dark:text-red-200"},L={deposit:"#22c55e",payout:"#3b82f6",refund:"#f97316",COMPLETED:"#22c55e",PENDING:"#eab308",FAILED:"#ef4444",CANCELLED:"#6b7280"},de=forwardRef(({className:o,variant:i="default",size:d="default",...g},p)=>jsx("button",{ref:p,className:N("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",{"bg-primary text-primary-foreground hover:bg-primary/90":i==="default","border border-input bg-background hover:bg-accent hover:text-accent-foreground":i==="outline","hover:bg-accent hover:text-accent-foreground":i==="ghost","bg-secondary text-secondary-foreground hover:bg-secondary/80":i==="secondary"},{"h-10 px-4 py-2":d==="default","h-9 rounded-md px-3":d==="sm","h-11 rounded-md px-8":d==="lg","h-10 w-10":d==="icon"},o),...g}));de.displayName="Button";var Ma=K.Root,Ct=forwardRef(({className:o,...i},d)=>jsx(K.List,{ref:d,className:N("inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",o),...i}));Ct.displayName=K.List.displayName;var We=forwardRef(({className:o,...i},d)=>jsx(K.Trigger,{ref:d,className:N("inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1.5 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=inactive]:text-muted-foreground data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow",o),...i}));We.displayName=K.Trigger.displayName;var je=forwardRef(({className:o,...i},d)=>jsx(K.Content,{ref:d,className:N("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",o),...i}));je.displayName=K.Content.displayName;var mt=E.Root,pt=E.Value,Ue=forwardRef(({className:o,children:i,...d},g)=>jsxs(E.Trigger,{ref:g,className:N("flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",o),...d,children:[i,jsx(E.Icon,{asChild:true,children:jsx(ChevronDown,{className:"h-4 w-4 opacity-50"})})]}));Ue.displayName=E.Trigger.displayName;var $e=forwardRef(({className:o,children:i,position:d="popper",...g},p)=>jsx(E.Portal,{children:jsx(E.Content,{ref:p,className:N("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",d==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",o),position:d,...g,children:jsx(E.Viewport,{className:N("p-1",d==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:i})})}));$e.displayName=E.Content.displayName;var F=forwardRef(({className:o,children:i,...d},g)=>jsxs(E.Item,{ref:g,className:N("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",o),...d,children:[jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:jsx(E.ItemIndicator,{children:jsx(Check,{className:"h-3 w-3"})})}),jsx(E.ItemText,{children:i})]}));F.displayName=E.Item.displayName;function Ra({trigger:o,children:i,align:d="end"}){let[g,p]=useState(false),w=useRef(null);return useEffect(()=>{if(!g)return;function D(x){w.current&&!w.current.contains(x.target)&&p(false);}return document.addEventListener("mousedown",D),()=>document.removeEventListener("mousedown",D)},[g]),jsxs("div",{ref:w,className:"relative",children:[jsx("div",{onClick:()=>p(!g),children:o}),g&&jsx("div",{className:N("absolute z-50 mt-1 min-w-[160px] rounded-md border bg-popover p-1 shadow-md",d==="end"?"right-0":"left-0"),children:i})]})}function gt({children:o,onClick:i,icon:d}){return jsxs("button",{onClick:i,className:"flex w-full items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none hover:bg-accent hover:text-accent-foreground",children:[d,o]})}var A=forwardRef(({className:o,...i},d)=>jsx("div",{ref:d,className:N("rounded-lg border bg-card text-card-foreground shadow-sm",o),...i}));A.displayName="Card";var _=forwardRef(({className:o,...i},d)=>jsx("div",{ref:d,className:N("flex flex-col space-y-1.5 p-6",o),...i}));_.displayName="CardHeader";var ke=forwardRef(({className:o,...i},d)=>jsx("h3",{ref:d,className:N("text-lg font-semibold leading-none tracking-tight",o),...i}));ke.displayName="CardTitle";var H=forwardRef(({className:o,...i},d)=>jsx("div",{ref:d,className:N("p-6 pt-0",o),...i}));H.displayName="CardContent";var Tt=forwardRef(({className:o,type:i,...d},g)=>jsx("input",{type:i,className:N("flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",o),ref:g,...d}));Tt.displayName="Input";var wt=forwardRef(({className:o,...i},d)=>jsx("div",{className:"relative w-full overflow-auto",children:jsx("table",{ref:d,className:N("w-full caption-bottom text-sm",o),...i})}));wt.displayName="Table";var Et=forwardRef(({className:o,...i},d)=>jsx("thead",{ref:d,className:N("[&_tr]:border-b",o),...i}));Et.displayName="TableHeader";var kt=forwardRef(({className:o,...i},d)=>jsx("tbody",{ref:d,className:N("[&_tr:last-child]:border-0",o),...i}));kt.displayName="TableBody";var Ve=forwardRef(({className:o,...i},d)=>jsx("tr",{ref:d,className:N("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",o),...i}));Ve.displayName="TableRow";var St=forwardRef(({className:o,...i},d)=>jsx("th",{ref:d,className:N("h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0",o),...i}));St.displayName="TableHead";var Dt=forwardRef(({className:o,...i},d)=>jsx("td",{ref:d,className:N("p-4 align-middle [&:has([role=checkbox])]:pr-0",o),...i}));Dt.displayName="TableCell";var B=({className:o,...i})=>jsx("div",{className:N("animate-pulse rounded-md bg-muted",o),...i}),Ia=({className:o})=>jsxs("svg",{className:N("animate-spin",o),xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),bt=({icon:o=Inbox,title:i,description:d,action:g})=>jsxs("div",{className:"flex flex-col items-center justify-center py-12 px-4 text-center",children:[jsx("div",{className:"flex h-20 w-20 items-center justify-center rounded-full bg-muted",children:jsx(o,{className:"h-10 w-10 text-muted-foreground"})}),jsx("h3",{className:"mt-4 text-lg font-semibold",children:i}),d&&jsx("p",{className:"mt-2 text-sm text-muted-foreground max-w-sm",children:d}),g&&jsx("div",{className:"mt-6",children:g})]}),Aa=({status:o})=>{switch(o){case "COMPLETED":return jsx(CheckCircle2,{className:"w-3.5 h-3.5"});case "FAILED":case "REJECTED":return jsx(XCircle,{className:"w-3.5 h-3.5"});case "CANCELLED":return jsx(Ban,{className:"w-3.5 h-3.5"});case "PENDING":case "ENQUEUED":return jsx(Clock,{className:"w-3.5 h-3.5"});case "PROCESSING":case "ACCEPTED":return jsx(Ia,{className:"w-3.5 h-3.5"});default:return jsx(AlertCircle,{className:"w-3.5 h-3.5"})}},ue=(o,i)=>new Intl.NumberFormat("fr-FR",{style:"decimal",minimumFractionDigits:0,maximumFractionDigits:0}).format(o)+" "+i,Oa=(o,i)=>{let d=new Date(o);return new Intl.DateTimeFormat(i==="fr"?"fr-FR":"en-US",{day:"2-digit",month:"short",year:"numeric",hour:"2-digit",minute:"2-digit"}).format(d)};function Se({transactions:o,title:i,subtitle:d,locale:g="fr",className:p="",showExpertMode:w=true,onExpertModeClick:D,onTransactionClick:x,onRefresh:b,onAddTransaction:G,onSettings:r,isLoading:k=false}){let c=Da[g],[te,ve]=useState(""),[z,O]=useState("all"),[j,W]=useState("all"),[le,Q]=useState(null),[ye,ae]=useState("dashboard"),[he,se]=useState([]),T=useMemo(()=>{let l=o.filter(m=>m.type==="deposit"),y=o.filter(m=>m.type==="payout"),V=o.filter(m=>m.type==="refund"),oe=o.filter(m=>m.status==="FAILED"||m.status==="REJECTED"),M=o.filter(m=>["PENDING","ENQUEUED","PROCESSING","ACCEPTED"].includes(m.status)),X=o.filter(m=>m.status==="COMPLETED"),q=o.filter(m=>m.status==="CANCELLED"),ge=o.filter(m=>m.status==="COMPLETED").reduce((m,I)=>m+I.amount,0),Ne=l.filter(m=>m.status==="COMPLETED").reduce((m,I)=>m+I.amount,0),Me=y.filter(m=>m.status==="COMPLETED").reduce((m,I)=>m+I.amount,0),Ce=V.filter(m=>m.status==="COMPLETED").reduce((m,I)=>m+I.amount,0),Re=l.reduce((m,I)=>m+I.amount,0),be=y.reduce((m,I)=>m+I.amount,0),Ie=V.reduce((m,I)=>m+I.amount,0);return {totalVolume:ge,depositsCount:l.length,depositsTotal:Ne,depositsAllTotal:Re,payoutsCount:y.length,payoutsTotal:Me,payoutsAllTotal:be,failedCount:oe.length,refundsCount:V.length,refundsTotal:Ce,refundsAllTotal:Ie,pendingCount:M.length,completedCount:X.length,cancelledCount:q.length}},[o]),Y=useMemo(()=>{let l={};o.forEach(M=>{let X=new Date(M.createdAt),q=X.toLocaleDateString(g==="fr"?"fr-FR":"en-US",{day:"2-digit",month:"short"});l[q]||(l[q]={date:q,dateSort:X.getTime(),deposits:0,payouts:0,refunds:0});let ge=M.type==="deposit"?"deposits":M.type==="payout"?"payouts":"refunds";l[q][ge]+=M.amount;});let y=Object.values(l).sort((M,X)=>M.dateSort-X.dateSort).slice(-7).map(({dateSort:M,...X})=>X),V=[{name:c.deposit,value:T.depositsAllTotal,count:T.depositsCount,fill:L.deposit},{name:c.payout,value:T.payoutsAllTotal,count:T.payoutsCount,fill:L.payout},{name:c.refund,value:T.refundsAllTotal,count:T.refundsCount,fill:L.refund}],oe=[{name:"Completed",value:T.completedCount,fill:L.COMPLETED},{name:"Pending",value:T.pendingCount,fill:L.PENDING},{name:"Failed",value:T.failedCount,fill:L.FAILED},{name:"Cancelled",value:T.cancelledCount,fill:L.CANCELLED}].filter(M=>M.value>0);return {volumeData:y,typeData:V,statusData:oe}},[o,T,g,c]),me=useMemo(()=>o.filter(l=>{let y=te===""||l.id.toLowerCase().includes(te.toLowerCase())||l.phoneNumber.includes(te),V=z==="all"||l.type===z,oe=j==="all"||l.status===j;return y&&V&&oe}),[o,te,z,j]),U=useCallback(l=>{navigator.clipboard.writeText(l),Q(l),setTimeout(()=>Q(null),2e3);},[]),Z=o[0]?.currency||"XAF",pe=useMemo(()=>[{accessorKey:"id",header:c.id,cell:({row:l})=>jsxs("div",{className:"flex items-center gap-2",children:[jsxs("span",{className:"font-mono text-xs truncate max-w-[100px]",title:l.original.id,children:[l.original.id.slice(0,8),"..."]}),jsx(de,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:y=>{y.stopPropagation(),U(l.original.id);},children:le===l.original.id?jsx(Check,{className:"w-3.5 h-3.5 text-green-600"}):jsx(Copy,{className:"w-3.5 h-3.5 text-muted-foreground"})})]})},{accessorKey:"type",header:c.type,cell:({row:l})=>jsxs("span",{className:N("inline-flex items-center gap-1.5 px-2.5 py-1 text-xs font-medium rounded-full",l.original.type==="deposit"&&"bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200",l.original.type==="payout"&&"bg-blue-100 text-blue-800 dark:bg-blue-900 dark:text-blue-200",l.original.type==="refund"&&"bg-orange-100 text-orange-800 dark:bg-orange-900 dark:text-orange-200"),children:[l.original.type==="deposit"&&jsx(ArrowDownCircle,{className:"w-3 h-3"}),l.original.type==="payout"&&jsx(ArrowUpCircle,{className:"w-3 h-3"}),l.original.type==="refund"&&jsx(RefreshCw,{className:"w-3 h-3"}),c[l.original.type]]})},{accessorKey:"amount",header:c.amount,cell:({row:l})=>jsx("span",{className:"font-semibold",children:ue(l.original.amount,l.original.currency)})},{accessorKey:"status",header:c.status,cell:({row:l})=>jsxs("span",{className:N("inline-flex items-center gap-1.5 px-2.5 py-1 text-xs font-medium rounded-full",Pa[l.original.status]),children:[jsx(Aa,{status:l.original.status}),l.original.status]})},{accessorKey:"provider",header:c.provider,cell:({row:l})=>jsx("span",{className:"text-muted-foreground",children:l.original.provider.replace(/_/g," ")})},{accessorKey:"phoneNumber",header:c.phone,cell:({row:l})=>jsx("span",{className:"font-mono text-muted-foreground",children:l.original.phoneNumber})},{accessorKey:"createdAt",header:c.date,cell:({row:l})=>jsx("span",{className:"text-muted-foreground",children:Oa(l.original.createdAt,g)})}],[c,g,le,U]),$=useReactTable({data:me,columns:pe,getCoreRowModel:getCoreRowModel(),getPaginationRowModel:getPaginationRowModel(),getFilteredRowModel:getFilteredRowModel(),onColumnFiltersChange:se,state:{columnFilters:he},initialState:{pagination:{pageSize:10}}}),R=()=>jsx("div",{className:"space-y-3 p-4",children:Array.from({length:5}).map((l,y)=>jsxs("div",{className:"flex items-center gap-4",children:[jsx(B,{className:"h-4 w-24"}),jsx(B,{className:"h-6 w-16 rounded-full"}),jsx(B,{className:"h-4 w-20"}),jsx(B,{className:"h-6 w-20 rounded-full"}),jsx(B,{className:"h-4 w-24"}),jsx(B,{className:"h-4 w-28"}),jsx(B,{className:"h-4 w-32"})]},y))}),C=()=>jsxs(A,{children:[jsx(_,{className:"pb-2",children:jsxs("div",{className:"flex items-center gap-2",children:[jsx(B,{className:"h-8 w-8 rounded-md"}),jsx(B,{className:"h-4 w-24"})]})}),jsxs(H,{children:[jsx(B,{className:"h-8 w-32 mb-2"}),jsx(B,{className:"h-3 w-20"})]})]});return jsxs(Ma,{value:ye,onValueChange:ae,className:N("space-y-6",p),children:[jsxs("div",{className:"flex items-center justify-between flex-wrap gap-4",children:[jsxs("div",{children:[jsx("h1",{className:"text-2xl font-bold tracking-tight",children:i||c.title}),jsx("p",{className:"text-muted-foreground mt-1",children:d||c.subtitle})]}),jsxs("div",{className:"flex items-center gap-2",children:[jsxs(Ct,{className:"h-9",children:[jsxs(We,{value:"dashboard",className:"gap-2 h-7",children:[jsx(LayoutDashboard,{className:"w-4 h-4"}),c.dashboard]}),jsxs(We,{value:"charts",className:"gap-2 h-7",children:[jsx(BarChart3,{className:"w-4 h-4"}),c.charts]})]}),b&&jsxs(de,{variant:"outline",size:"sm",className:"h-9",onClick:b,disabled:k,children:[jsx(RefreshCw,{className:N("w-4 h-4",k&&"animate-spin")}),c.refresh]}),(r||w&&D)&&jsxs(Ra,{trigger:jsxs(de,{variant:"outline",size:"sm",className:"h-9 gap-1",children:[jsx(MoreVertical,{className:"w-4 h-4"}),c.actions,jsx(ChevronDown,{className:"w-3 h-3 opacity-50"})]}),children:[r&&jsx(gt,{onClick:r,icon:jsx(Settings,{className:"w-4 h-4"}),children:c.settings}),w&&D&&jsx(gt,{onClick:D,icon:jsx(FlaskConical,{className:"w-4 h-4"}),children:c.expertMode})]})]})]}),jsxs(je,{value:"dashboard",className:"space-y-6",children:[jsx("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:k?jsx(Fragment,{children:Array.from({length:8}).map((l,y)=>jsx(C,{},y))}):jsxs(Fragment,{children:[jsxs(A,{children:[jsx(_,{className:"pb-2",children:jsxs("div",{className:"flex items-center gap-2",children:[jsx("div",{className:"p-2 rounded-md bg-primary/10",children:jsx(TrendingUp,{className:"w-4 h-4 text-primary"})}),jsx("span",{className:"text-sm font-medium text-muted-foreground",children:c.totalVolume})]})}),jsxs(H,{children:[jsx("p",{className:"text-2xl font-bold",children:ue(T.totalVolume,Z)}),jsxs("p",{className:"text-xs text-muted-foreground",children:[o.length," ",c.transactions]})]})]}),jsxs(A,{children:[jsx(_,{className:"pb-2",children:jsxs("div",{className:"flex items-center gap-2",children:[jsx("div",{className:"p-2 rounded-md bg-green-500/10",children:jsx(ArrowDownCircle,{className:"w-4 h-4 text-green-600 dark:text-green-400"})}),jsx("span",{className:"text-sm font-medium text-muted-foreground",children:c.deposits})]})}),jsxs(H,{children:[jsx("p",{className:"text-2xl font-bold",children:ue(T.depositsTotal,Z)}),jsxs("p",{className:"text-xs text-muted-foreground",children:[T.depositsCount," ",c.transactions]})]})]}),jsxs(A,{children:[jsx(_,{className:"pb-2",children:jsxs("div",{className:"flex items-center gap-2",children:[jsx("div",{className:"p-2 rounded-md bg-blue-500/10",children:jsx(ArrowUpCircle,{className:"w-4 h-4 text-blue-600 dark:text-blue-400"})}),jsx("span",{className:"text-sm font-medium text-muted-foreground",children:c.payouts})]})}),jsxs(H,{children:[jsx("p",{className:"text-2xl font-bold",children:ue(T.payoutsTotal,Z)}),jsxs("p",{className:"text-xs text-muted-foreground",children:[T.payoutsCount," ",c.transactions]})]})]}),jsxs(A,{children:[jsx(_,{className:"pb-2",children:jsxs("div",{className:"flex items-center gap-2",children:[jsx("div",{className:"p-2 rounded-md bg-orange-500/10",children:jsx(RefreshCw,{className:"w-4 h-4 text-orange-600 dark:text-orange-400"})}),jsx("span",{className:"text-sm font-medium text-muted-foreground",children:c.refunds})]})}),jsxs(H,{children:[jsx("p",{className:"text-2xl font-bold",children:ue(T.refundsTotal,Z)}),jsxs("p",{className:"text-xs text-muted-foreground",children:[T.refundsCount," ",c.transactions]})]})]}),jsxs(A,{children:[jsx(_,{className:"pb-2",children:jsxs("div",{className:"flex items-center gap-2",children:[jsx("div",{className:"p-2 rounded-md bg-yellow-500/10",children:jsx(Hourglass,{className:"w-4 h-4 text-yellow-600 dark:text-yellow-400"})}),jsx("span",{className:"text-sm font-medium text-muted-foreground",children:c.pending})]})}),jsxs(H,{children:[jsx("p",{className:"text-2xl font-bold",children:T.pendingCount}),jsx("p",{className:"text-xs text-muted-foreground",children:c.transactions})]})]}),jsxs(A,{children:[jsx(_,{className:"pb-2",children:jsxs("div",{className:"flex items-center gap-2",children:[jsx("div",{className:"p-2 rounded-md bg-green-500/10",children:jsx(CheckCircle2,{className:"w-4 h-4 text-green-600 dark:text-green-400"})}),jsx("span",{className:"text-sm font-medium text-muted-foreground",children:c.completed})]})}),jsxs(H,{children:[jsx("p",{className:"text-2xl font-bold",children:T.completedCount}),jsx("p",{className:"text-xs text-muted-foreground",children:c.transactions})]})]}),jsxs(A,{children:[jsx(_,{className:"pb-2",children:jsxs("div",{className:"flex items-center gap-2",children:[jsx("div",{className:"p-2 rounded-md bg-red-500/10",children:jsx(XCircle,{className:"w-4 h-4 text-red-600 dark:text-red-400"})}),jsx("span",{className:"text-sm font-medium text-muted-foreground",children:c.failed})]})}),jsxs(H,{children:[jsx("p",{className:"text-2xl font-bold",children:T.failedCount}),jsx("p",{className:"text-xs text-muted-foreground",children:c.transactions})]})]}),jsxs(A,{children:[jsx(_,{className:"pb-2",children:jsxs("div",{className:"flex items-center gap-2",children:[jsx("div",{className:"p-2 rounded-md bg-gray-500/10",children:jsx(Ban,{className:"w-4 h-4 text-gray-600 dark:text-gray-400"})}),jsx("span",{className:"text-sm font-medium text-muted-foreground",children:c.cancelled})]})}),jsxs(H,{children:[jsx("p",{className:"text-2xl font-bold",children:T.cancelledCount}),jsx("p",{className:"text-xs text-muted-foreground",children:c.transactions})]})]})]})}),jsxs("div",{className:"flex flex-wrap gap-3",children:[jsxs("div",{className:"relative flex-1 min-w-[200px]",children:[jsx(Search,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground pointer-events-none"}),jsx(Tt,{type:"text",placeholder:c.search,value:te,onChange:l=>ve(l.target.value),className:"pl-9"})]}),jsxs(mt,{value:z,onValueChange:l=>O(l),children:[jsx(Ue,{className:"w-[160px]",children:jsx(pt,{placeholder:c.allTypes})}),jsxs($e,{children:[jsx(F,{value:"all",children:c.allTypes}),jsx(F,{value:"deposit",children:c.deposit}),jsx(F,{value:"payout",children:c.payout}),jsx(F,{value:"refund",children:c.refund})]})]}),jsxs(mt,{value:j,onValueChange:l=>W(l),children:[jsx(Ue,{className:"w-[160px]",children:jsx(pt,{placeholder:c.allStatuses})}),jsxs($e,{children:[jsx(F,{value:"all",children:c.allStatuses}),jsx(F,{value:"COMPLETED",children:"COMPLETED"}),jsx(F,{value:"PENDING",children:"PENDING"}),jsx(F,{value:"PROCESSING",children:"PROCESSING"}),jsx(F,{value:"ACCEPTED",children:"ACCEPTED"}),jsx(F,{value:"FAILED",children:"FAILED"}),jsx(F,{value:"CANCELLED",children:"CANCELLED"}),jsx(F,{value:"REJECTED",children:"REJECTED"})]})]})]}),jsx(A,{children:k?jsx(R,{}):me.length===0?jsx(bt,{icon:Inbox,title:c.noTransactions,description:c.noTransactionsDesc,action:G&&jsxs(de,{onClick:G,children:[jsx(Plus,{className:"w-4 h-4"}),c.addTransaction]})}):jsxs(Fragment,{children:[jsxs(wt,{children:[jsx(Et,{children:$.getHeaderGroups().map(l=>jsx(Ve,{children:l.headers.map(y=>jsx(St,{children:y.isPlaceholder?null:flexRender(y.column.columnDef.header,y.getContext())},y.id))},l.id))}),jsx(kt,{children:$.getRowModel().rows.map(l=>jsx(Ve,{onClick:()=>x?.(l.original),className:x?"cursor-pointer":"",children:l.getVisibleCells().map(y=>jsx(Dt,{children:flexRender(y.column.columnDef.cell,y.getContext())},y.id))},l.id))})]}),jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-t",children:[jsxs("p",{className:"text-sm text-muted-foreground",children:[me.length," ",c.transactions]}),jsxs("div",{className:"flex items-center gap-2",children:[jsxs(de,{variant:"outline",size:"sm",onClick:()=>$.previousPage(),disabled:!$.getCanPreviousPage(),children:[jsx(ChevronLeft,{className:"w-4 h-4"}),c.previous]}),jsxs("span",{className:"text-sm px-2",children:[c.page," ",$.getState().pagination.pageIndex+1," ",c.of," ",$.getPageCount()]}),jsxs(de,{variant:"outline",size:"sm",onClick:()=>$.nextPage(),disabled:!$.getCanNextPage(),children:[c.next,jsx(ChevronRight,{className:"w-4 h-4"})]})]})]})]})})]}),jsx(je,{value:"charts",className:"space-y-6",children:o.length===0?jsx(A,{children:jsx(bt,{icon:BarChart3,title:c.noDataForCharts,description:c.noTransactionsDesc})}):jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[jsxs(A,{className:"col-span-1 lg:col-span-2",children:[jsx(_,{children:jsx(ke,{children:c.volumeOverTime})}),jsx(H,{children:jsx("div",{className:"h-[300px]",children:jsx(ResponsiveContainer,{width:"100%",height:"100%",children:jsxs(AreaChart,{data:Y.volumeData,children:[jsxs("defs",{children:[jsxs("linearGradient",{id:"colorDeposits",x1:"0",y1:"0",x2:"0",y2:"1",children:[jsx("stop",{offset:"5%",stopColor:L.deposit,stopOpacity:.3}),jsx("stop",{offset:"95%",stopColor:L.deposit,stopOpacity:0})]}),jsxs("linearGradient",{id:"colorPayouts",x1:"0",y1:"0",x2:"0",y2:"1",children:[jsx("stop",{offset:"5%",stopColor:L.payout,stopOpacity:.3}),jsx("stop",{offset:"95%",stopColor:L.payout,stopOpacity:0})]})]}),jsx(CartesianGrid,{strokeDasharray:"3 3",className:"stroke-muted"}),jsx(XAxis,{dataKey:"date",className:"text-xs"}),jsx(YAxis,{className:"text-xs"}),jsx(Tooltip,{contentStyle:{backgroundColor:"hsl(var(--popover))",border:"1px solid hsl(var(--border))",borderRadius:"8px"}}),jsx(Legend,{}),jsx(Area,{type:"monotone",dataKey:"deposits",name:c.deposits,stroke:L.deposit,fillOpacity:1,fill:"url(#colorDeposits)"}),jsx(Area,{type:"monotone",dataKey:"payouts",name:c.payouts,stroke:L.payout,fillOpacity:1,fill:"url(#colorPayouts)"})]})})})})]}),jsxs(A,{children:[jsx(_,{children:jsx(ke,{children:c.transactionsByType})}),jsx(H,{children:jsx("div",{className:"h-[300px]",children:jsx(ResponsiveContainer,{width:"100%",height:"100%",children:jsxs(BarChart,{data:Y.typeData,children:[jsx(CartesianGrid,{strokeDasharray:"3 3",className:"stroke-muted"}),jsx(XAxis,{dataKey:"name",className:"text-xs"}),jsx(YAxis,{className:"text-xs"}),jsx(Tooltip,{contentStyle:{backgroundColor:"hsl(var(--popover))",border:"1px solid hsl(var(--border))",borderRadius:"8px"},formatter:l=>ue(l,Z)}),jsx(Bar,{dataKey:"value",name:c.amount,radius:[4,4,0,0],children:Y.typeData.map((l,y)=>jsx(Cell,{fill:l.fill},`cell-${y}`))})]})})})})]}),jsxs(A,{children:[jsx(_,{children:jsx(ke,{children:c.statusDistribution})}),jsx(H,{children:jsx("div",{className:"h-[300px]",children:jsx(ResponsiveContainer,{width:"100%",height:"100%",children:jsxs(PieChart,{children:[jsx(Pie,{data:Y.statusData,cx:"50%",cy:"50%",innerRadius:60,outerRadius:100,paddingAngle:2,dataKey:"value",label:({name:l,percent:y})=>`${l} ${(y*100).toFixed(0)}%`,labelLine:false,children:Y.statusData.map((l,y)=>jsx(Cell,{fill:l.fill},`cell-${y}`))}),jsx(Tooltip,{contentStyle:{backgroundColor:"hsl(var(--popover))",border:"1px solid hsl(var(--border))",borderRadius:"8px"}}),jsx(Legend,{})]})})})})]})]})})]})}var Lt=()=>{let o=["deposit","payout","refund"],i=["COMPLETED","COMPLETED","COMPLETED","PENDING","FAILED","PROCESSING"],d=["MTN_MOMO_CMR","ORANGE_CMR","MTN_MOMO_COG","AIRTEL_COG"],g=[],p=Date.now();for(let w=0;w<25;w++){let D=o[Math.floor(Math.random()*o.length)],x=i[Math.floor(Math.random()*i.length)],b=d[Math.floor(Math.random()*d.length)],G=Math.floor(Math.random()*5e4)+1e3,r=Math.floor(Math.random()*30);g.push({id:`tx-${String(w+1).padStart(3,"0")}-${Math.random().toString(36).slice(2,8)}`,type:D,amount:G,currency:"XAF",status:x,provider:b,phoneNumber:`237${6+Math.floor(Math.random()*3)}${Math.floor(Math.random()*1e8).toString().padStart(8,"0")}`,createdAt:new Date(p-r*24*60*60*1e3-Math.random()*24*60*60*1e3).toISOString(),...x==="FAILED"&&{failureReason:"INSUFFICIENT_FUNDS"}});}return g.sort((w,D)=>new Date(D.createdAt).getTime()-new Date(w.createdAt).getTime())},za=o=>({depositId:o,status:"ACCEPTED",created:new Date().toISOString(),nextStep:"FINAL_STATUS"}),Qa=o=>({payoutId:o,status:"ACCEPTED",created:new Date().toISOString()}),Ya=o=>({depositId:o,status:["COMPLETED","ACCEPTED","PROCESSING","ENQUEUED"][Math.floor(Math.random()*4)],created:new Date(Date.now()-6e4).toISOString(),amount:"5000",currency:"XAF",country:"CMR",payer:{type:"MMO",accountDetails:{phoneNumber:"237670000000",provider:"MTN_MOMO_CMR"}}}),Za=()=>[{country:"CMR",providers:[{provider:"MTN_MOMO_CMR",operationTypes:[{operationType:"DEPOSIT",status:"OPERATIONAL"},{operationType:"PAYOUT",status:"OPERATIONAL"}]},{provider:"ORANGE_CMR",operationTypes:[{operationType:"DEPOSIT",status:"OPERATIONAL"},{operationType:"PAYOUT",status:"DELAYED"}]}]}],qa=o=>({country:"CMR",provider:o.startsWith("23767")?"MTN_MOMO_CMR":"ORANGE_CMR",phoneNumber:o.replace(/\D/g,"")}),es=()=>({companyName:"Demo Company",signatureConfiguration:{signedRequestsOnly:false,signedCallbacks:true},countries:[{country:"CMR",displayName:{en:"Cameroon",fr:"Cameroun"},prefix:"237",flag:"https://cdn.pawapay.io/flags/cmr.svg",providers:[{provider:"MTN_MOMO_CMR",displayName:"MTN Mobile Money",nameDisplayedToCustomer:"MTN MoMo",currencies:[{currency:"XAF",displayName:"CFA Franc",operationTypes:{DEPOSIT:{minAmount:"100",maxAmount:"1000000",status:"OPERATIONAL"},PAYOUT:{minAmount:"100",maxAmount:"500000",status:"OPERATIONAL"}}}]}]}]}),ts=()=>({balances:[{country:"CMR",currency:"XAF",balance:"1250000.00"},{country:"COG",currency:"XAF",balance:"450000.00"},{country:"GAB",currency:"XAF",balance:"780000.00"}]}),as=()=>[{id:"key-001",key:"MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA..."}],re=(o=800)=>new Promise(i=>setTimeout(i,o+Math.random()*400));async function Ft(o,i){let d=new TextEncoder,g=await crypto.subtle.importKey("raw",d.encode(i),{name:"HMAC",hash:"SHA-256"},false,["sign"]),p=await crypto.subtle.sign("HMAC",g,d.encode(o));return Array.from(new Uint8Array(p)).map(w=>w.toString(16).padStart(2,"0")).join("")}var Pe=()=>"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,o=>{let i=Math.random()*16|0;return (o==="x"?i:i&3|8).toString(16)}),Ke=[{value:"MTN_MOMO_CMR",label:"MTN Mobile Money",country:"Cameroun"},{value:"ORANGE_CMR",label:"Orange Money",country:"Cameroun"},{value:"MTN_MOMO_COG",label:"MTN Mobile Money",country:"Congo"},{value:"AIRTEL_COG",label:"Airtel Money",country:"Congo"},{value:"MTN_MOMO_GAB",label:"MTN Mobile Money",country:"Gabon"},{value:"AIRTEL_GAB",label:"Airtel Money",country:"Gabon"}],_t=[{value:"XAF",label:"XAF (CFA Franc BEAC)"},{value:"XOF",label:"XOF (CFA Franc BCEAO)"},{value:"GHS",label:"GHS (Ghana Cedi)"},{value:"KES",label:"KES (Kenyan Shilling)"},{value:"RWF",label:"RWF (Rwandan Franc)"},{value:"TZS",label:"TZS (Tanzanian Shilling)"},{value:"UGX",label:"UGX (Ugandan Shilling)"},{value:"ZMW",label:"ZMW (Zambian Kwacha)"}],S={demo:{label:"DEMO",description:"Donn\xE9es fictives - Visualisez le dashboard",color:"text-purple-800 dark:text-purple-200",bgColor:"bg-purple-100 dark:bg-purple-900"},"demo-expert":{label:"EXPERT",description:"Console de test API - R\xE9ponses simul\xE9es",color:"text-amber-800 dark:text-amber-200",bgColor:"bg-amber-100 dark:bg-amber-900"},sandbox:{label:"SANDBOX",description:"Environnement de test Pawapay",color:"text-blue-800 dark:text-blue-200",bgColor:"bg-blue-100 dark:bg-blue-900"},production:{label:"PRODUCTION",description:"Environnement de production - Transactions r\xE9elles",color:"text-green-800 dark:text-green-200",bgColor:"bg-green-100 dark:bg-green-900"}};function ss({apiKey:o="",environment:i="sandbox",className:d="",demoMode:g=false,apiBasePath:p="/api/pawapay",onDepositComplete:w,onPayoutComplete:D,onError:x}){let[b,G]=useState(o),[r,k]=useState(g?"demo":o?i:null),[c,te]=useState([]),[ve,z]=useState(false),[O,j]=useState("deposit"),[W,le]=useState("237670000000"),[Q,ye]=useState("5000"),[ae,he]=useState("XAF"),[se,T]=useState("MTN_MOMO_CMR"),[Y,me]=useState("Test Payment"),[U,Z]=useState(""),[pe,$]=useState([]),[R,C]=useState("idle"),[l,y]=useState("whsec_test_secret_key"),[V,oe]=useState([]),[M,X]=useState("deposit.completed"),[q,ge]=useState("5000"),[Ne,Me]=useState("237670000000"),[Ce,Re]=useState("MTN_MOMO_CMR"),[be,Ie]=useState(""),[m,I]=useState(""),[Je,Ht]=useState(""),[Ae,Gt]=useState(""),[Xe,Wt]=useState(""),[Te,ze]=useState(null),[Qe,jt]=useState(""),[ce,Ye]=useState(null),[Ze,qe]=useState(""),[fe,Ut]=useState("all");useEffect(()=>{r==="demo"&&(z(true),setTimeout(()=>{te(Lt()),z(false);},800));},[r]);let f=useCallback((t,u,v,ee)=>{let Le={id:Pe(),operation:t,status:u,response:v,error:ee,timestamp:new Date().toLocaleTimeString()};$(Yt=>[Le,...Yt].slice(0,20));},[]),we=useCallback(t=>{(t==="sandbox"||t==="production")&&!b.trim()||(k(t),t==="demo"?f("Configuration","success",{mode:"demo",message:"Mode d\xE9mo activ\xE9 - donn\xE9es fictives"}):t==="demo-expert"?f("Configuration","success",{mode:"demo-expert",message:"Mode expert activ\xE9 - r\xE9ponses simul\xE9es"}):f("Configuration","success",{mode:t,apiBasePath:p}));},[b,p,f]),$t=useCallback(async()=>{if(!(r!=="demo-expert"&&r!=="sandbox"&&r!=="production")){C("loading");try{let t=Pe();Z(t);let u;if(r==="demo-expert")await re(),u=za(t);else {let v=await fetch(`${p}/deposit`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({apiKey:b,environment:r,amount:parseFloat(Q),currency:ae,provider:se,phoneNumber:W,customerMessage:Y.slice(0,22),transactionId:t})}),ee=await v.json();if(!v.ok)throw new Error(ee.error||"Deposit failed");u=ee;}C("success"),f("Deposit","success",u),w?.(u);}catch(t){C("error");let u=t instanceof Error?t.message:"Deposit failed";f("Deposit","error",void 0,u),x?.(t instanceof Error?t:new Error(u));}}},[b,p,r,Q,ae,se,W,Y,f,w,x]),Vt=useCallback(async()=>{if(!(r!=="demo-expert"&&r!=="sandbox"&&r!=="production")){C("loading");try{let t=Pe();Z(t);let u;if(r==="demo-expert")await re(),u=Qa(t);else {let v=await fetch(`${p}/payout`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({apiKey:b,environment:r,amount:parseFloat(Q),currency:ae,provider:se,phoneNumber:W,transactionId:t})}),ee=await v.json();if(!v.ok)throw new Error(ee.error||"Payout failed");u=ee;}C("success"),f("Payout","success",u),D?.(u);}catch(t){C("error");let u=t instanceof Error?t.message:"Payout failed";f("Payout","error",void 0,u),x?.(t instanceof Error?t:new Error(u));}}},[b,p,r,Q,ae,se,W,f,D,x]),Bt=useCallback(async()=>{if(r!=="demo-expert"&&r!=="sandbox"&&r!=="production"||!U){f("Check Status","error",void 0,"No transaction ID");return}C("loading");try{let t;if(r==="demo-expert")await re(),t=Ya(U);else {let u=await fetch(`${p}/status`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({apiKey:b,environment:r,transactionId:U})}),v=await u.json();if(!u.ok)throw new Error(v.error||"Status check failed");t=v;}C("success"),f("Check Status","success",t);}catch(t){C("error");let u=t instanceof Error?t.message:"Status check failed";f("Check Status","error",void 0,u),x?.(t instanceof Error?t:new Error(u));}},[b,p,r,U,f,x]),Kt=useCallback(async()=>{if(!(r!=="demo-expert"&&r!=="sandbox"&&r!=="production")){C("loading");try{let t;if(r==="demo-expert")await re(),t=Za();else {let u=await fetch(`${p}/availability`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({apiKey:b,environment:r})}),v=await u.json();if(!u.ok)throw new Error(v.error||"Availability check failed");t=v;}C("success"),f("Provider Availability","success",t);}catch(t){C("error");let u=t instanceof Error?t.message:"Availability check failed";f("Provider Availability","error",void 0,u),x?.(t instanceof Error?t:new Error(u));}}},[b,p,r,f,x]),Jt=useCallback(async()=>{if(!(r!=="demo-expert"&&r!=="sandbox"&&r!=="production")){C("loading");try{let t;if(r==="demo-expert")await re(),t=qa(W);else {let u=await fetch(`${p}/predict-provider`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({apiKey:b,environment:r,phoneNumber:W})}),v=await u.json();if(!u.ok)throw new Error(v.error||"Prediction failed");t=v;}C("success"),f("Predict Provider","success",t);}catch(t){C("error");let u=t instanceof Error?t.message:"Prediction failed";f("Predict Provider","error",void 0,u),x?.(t instanceof Error?t:new Error(u));}}},[b,p,r,W,f,x]),Xt=useCallback(async()=>{if(!(r!=="demo-expert"&&r!=="sandbox"&&r!=="production")){C("loading");try{let t;if(r==="demo-expert")await re(),t=es();else {let u=await fetch(`${p}/active-config`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({apiKey:b,environment:r})}),v=await u.json();if(!u.ok)throw new Error(v.error||"Failed to get config");t=v;}C("success"),f("Active Configuration","success",t);}catch(t){C("error");let u=t instanceof Error?t.message:"Failed to get config";f("Active Configuration","error",void 0,u),x?.(t instanceof Error?t:new Error(u));}}},[b,p,r,f,x]),zt=useCallback(async()=>{if(!(r!=="demo-expert"&&r!=="sandbox"&&r!=="production")){C("loading");try{let t;if(r==="demo-expert")await re(),t=as();else {let u=await fetch(`${p}/public-keys`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({apiKey:b,environment:r})}),v=await u.json();if(!u.ok)throw new Error(v.error||"Failed to get public keys");t=v;}C("success"),f("Public Keys","success",t);}catch(t){C("error");let u=t instanceof Error?t.message:"Failed to get public keys";f("Public Keys","error",void 0,u),x?.(t instanceof Error?t:new Error(u));}}},[b,p,r,f,x]),Qt=useCallback(async()=>{if(!(r!=="demo-expert"&&r!=="sandbox"&&r!=="production")){C("loading");try{let t;if(r==="demo-expert")await re(),t=ts();else {let u=await fetch(`${p}/wallet-balances`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({apiKey:b,environment:r})}),v=await u.json();if(!u.ok)throw new Error(v.error||"Failed to get balances");t=v;}C("success"),f("Wallet Balances","success",t);}catch(t){C("error");let u=t instanceof Error?t.message:"Failed to get balances";f("Wallet Balances","error",void 0,u),x?.(t instanceof Error?t:new Error(u));}}},[b,p,r,f,x]),Oe=useCallback(t=>{navigator.clipboard.writeText(t);},[]);return r?r==="demo"?jsxs("div",{className:`space-y-6 ${d}`,children:[jsxs("div",{className:"flex items-center justify-between flex-wrap gap-4",children:[jsxs("div",{className:"flex items-center gap-3",children:[jsx("span",{className:`px-2 py-0.5 text-xs font-medium rounded ${S[r].bgColor} ${S[r].color}`,children:S[r].label}),jsx("span",{className:"text-sm text-muted-foreground",children:S[r].description})]}),jsxs("button",{onClick:()=>k(null),className:"h-8 px-3 text-xs font-medium border border-border bg-background hover:bg-muted transition-colors flex items-center gap-2 rounded-md",children:[jsx(Settings,{className:"w-4 h-4"}),"Changer de mode"]})]}),jsx(Se,{transactions:c,locale:"fr",isLoading:ve,onRefresh:()=>{z(true),setTimeout(()=>{te(Lt()),z(false);},800);},showExpertMode:true,onExpertModeClick:()=>k("demo-expert")})]}):r==="sandbox"||r==="production"?jsxs("div",{className:`space-y-6 ${d}`,children:[jsxs("div",{className:"flex items-center justify-between flex-wrap gap-4",children:[jsxs("div",{className:"flex items-center gap-3",children:[jsx("span",{className:`px-2 py-0.5 text-xs font-medium rounded ${S[r].bgColor} ${S[r].color}`,children:S[r].label}),jsx("span",{className:"text-sm text-muted-foreground",children:S[r].description})]}),jsxs("button",{onClick:()=>k(null),className:"h-8 px-3 text-xs font-medium border border-border bg-background hover:bg-muted transition-colors flex items-center gap-2 rounded-md",children:[jsx(Settings,{className:"w-4 h-4"}),"Changer de mode"]})]}),jsx(Se,{transactions:c,locale:"fr",isLoading:ve,onRefresh:()=>{f("Refresh","success",{message:"Transactions refreshed"});},showExpertMode:true,onExpertModeClick:()=>k("demo-expert")})]}):jsxs("div",{className:`space-y-6 ${d}`,children:[jsxs("div",{className:"flex items-center justify-between flex-wrap gap-4",children:[jsxs("div",{children:[jsxs("div",{className:"flex items-center gap-2",children:[jsx("h1",{className:"text-2xl font-bold tracking-tight",children:"Spaark Pay Console"}),jsx("span",{className:`px-2 py-0.5 text-xs font-medium rounded ${S[r].bgColor} ${S[r].color}`,children:S[r].label})]}),jsx("p",{className:"text-muted-foreground mt-1",children:S[r].description})]}),jsxs("button",{onClick:()=>k(null),className:"h-8 px-3 text-xs font-medium border border-border bg-background hover:bg-muted transition-colors flex items-center gap-2 rounded-md",children:[jsx(Settings,{className:"w-4 h-4"}),"Changer de mode"]})]}),jsxs("div",{className:"grid lg:grid-cols-3 gap-6",children:[jsxs("div",{className:"lg:col-span-2 space-y-6",children:[jsxs("div",{className:"flex flex-wrap gap-1 bg-muted p-1 rounded-md",children:[jsxs("button",{onClick:()=>j("deposit"),className:`flex-1 min-w-[80px] h-8 px-3 text-xs font-medium transition-colors flex items-center justify-center gap-1.5 rounded-sm ${O==="deposit"?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:[jsx(Wallet,{className:"w-4 h-4"}),"Deposit"]}),jsxs("button",{onClick:()=>j("payout"),className:`flex-1 min-w-[80px] h-8 px-3 text-xs font-medium transition-colors flex items-center justify-center gap-1.5 rounded-sm ${O==="payout"?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:[jsx(Smartphone,{className:"w-4 h-4"}),"Payout"]}),jsxs("button",{onClick:()=>j("status"),className:`flex-1 min-w-[80px] h-8 px-3 text-xs font-medium transition-colors flex items-center justify-center gap-1.5 rounded-sm ${O==="status"?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:[jsx(RefreshCw,{className:"w-4 h-4"}),"Status"]}),jsxs("button",{onClick:()=>j("toolkit"),className:`flex-1 min-w-[80px] h-8 px-3 text-xs font-medium transition-colors flex items-center justify-center gap-1.5 rounded-sm ${O==="toolkit"?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:[jsx(Wrench,{className:"w-4 h-4"}),"Toolkit"]}),jsxs("button",{onClick:()=>j("finances"),className:`flex-1 min-w-[80px] h-8 px-3 text-xs font-medium transition-colors flex items-center justify-center gap-1.5 rounded-sm ${O==="finances"?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:[jsx(BarChart3,{className:"w-4 h-4"}),"Finances"]}),jsxs("button",{onClick:()=>j("webhooks"),className:`flex-1 min-w-[80px] h-8 px-3 text-xs font-medium transition-colors flex items-center justify-center gap-1.5 rounded-sm ${O==="webhooks"?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:[jsx(Zap,{className:"w-4 h-4"}),"Webhooks"]})]}),O==="deposit"&&jsxs("div",{className:"border border-border bg-background p-6 space-y-4 rounded-lg",children:[jsxs("div",{children:[jsx("h3",{className:"font-semibold",children:"Initiate Deposit"}),jsx("p",{className:"text-xs text-muted-foreground",children:"Collect payment from a Mobile Money user"})]}),jsxs("div",{className:"grid sm:grid-cols-2 gap-4",children:[jsxs("div",{className:"space-y-2",children:[jsx("label",{className:"text-xs font-medium",children:"Phone Number"}),jsx("input",{placeholder:"237670000000",value:W,onChange:t=>le(t.target.value),className:"w-full h-8 px-2.5 text-xs border border-input bg-transparent rounded-md outline-none focus:border-ring"})]}),jsxs("div",{className:"space-y-2",children:[jsx("label",{className:"text-xs font-medium",children:"Amount"}),jsx("input",{type:"number",placeholder:"5000",value:Q,onChange:t=>ye(t.target.value),className:"w-full h-8 px-2.5 text-xs border border-input bg-transparent rounded-md outline-none focus:border-ring"})]}),jsxs("div",{className:"space-y-2",children:[jsx("label",{className:"text-xs font-medium",children:"Currency"}),jsx("select",{value:ae,onChange:t=>he(t.target.value),className:"w-full h-8 px-2.5 text-xs border border-input bg-transparent rounded-md outline-none focus:border-ring",children:_t.map(t=>jsx("option",{value:t.value,children:t.label},t.value))})]}),jsxs("div",{className:"space-y-2",children:[jsx("label",{className:"text-xs font-medium",children:"Provider"}),jsx("select",{value:se,onChange:t=>T(t.target.value),className:"w-full h-8 px-2.5 text-xs border border-input bg-transparent rounded-md outline-none focus:border-ring",children:Ke.map(t=>jsxs("option",{value:t.value,children:[t.label," (",t.country,")"]},t.value))})]}),jsxs("div",{className:"space-y-2 sm:col-span-2",children:[jsx("label",{className:"text-xs font-medium",children:"Customer Message (4-22 chars)"}),jsx("input",{placeholder:"Payment description",value:Y,onChange:t=>me(t.target.value),maxLength:22,className:"w-full h-8 px-2.5 text-xs border border-input bg-transparent rounded-md outline-none focus:border-ring"})]})]}),jsxs("button",{onClick:$t,disabled:R==="loading",className:"w-full h-8 px-3 text-xs font-medium bg-primary text-primary-foreground hover:bg-primary/90 disabled:opacity-50 transition-colors flex items-center justify-center gap-2 rounded-md",children:[R==="loading"?jsx(Loader2,{className:"w-4 h-4 animate-spin"}):jsx(PlayCircle,{className:"w-4 h-4"}),"Execute Deposit"]})]}),O==="payout"&&jsxs("div",{className:"border border-border bg-background p-6 space-y-4 rounded-lg",children:[jsxs("div",{children:[jsx("h3",{className:"font-semibold",children:"Initiate Payout"}),jsx("p",{className:"text-xs text-muted-foreground",children:"Send money to a Mobile Money account"})]}),jsxs("div",{className:"grid sm:grid-cols-2 gap-4",children:[jsxs("div",{className:"space-y-2",children:[jsx("label",{className:"text-xs font-medium",children:"Recipient Phone"}),jsx("input",{placeholder:"237670000000",value:W,onChange:t=>le(t.target.value),className:"w-full h-8 px-2.5 text-xs border border-input bg-transparent rounded-md outline-none focus:border-ring"})]}),jsxs("div",{className:"space-y-2",children:[jsx("label",{className:"text-xs font-medium",children:"Amount"}),jsx("input",{type:"number",placeholder:"5000",value:Q,onChange:t=>ye(t.target.value),className:"w-full h-8 px-2.5 text-xs border border-input bg-transparent rounded-md outline-none focus:border-ring"})]}),jsxs("div",{className:"space-y-2",children:[jsx("label",{className:"text-xs font-medium",children:"Currency"}),jsx("select",{value:ae,onChange:t=>he(t.target.value),className:"w-full h-8 px-2.5 text-xs border border-input bg-transparent rounded-md outline-none focus:border-ring",children:_t.map(t=>jsx("option",{value:t.value,children:t.label},t.value))})]}),jsxs("div",{className:"space-y-2",children:[jsx("label",{className:"text-xs font-medium",children:"Provider"}),jsx("select",{value:se,onChange:t=>T(t.target.value),className:"w-full h-8 px-2.5 text-xs border border-input bg-transparent rounded-md outline-none focus:border-ring",children:Ke.map(t=>jsxs("option",{value:t.value,children:[t.label," (",t.country,")"]},t.value))})]})]}),jsxs("button",{onClick:Vt,disabled:R==="loading",className:"w-full h-8 px-3 text-xs font-medium bg-primary text-primary-foreground hover:bg-primary/90 disabled:opacity-50 transition-colors flex items-center justify-center gap-2 rounded-md",children:[R==="loading"?jsx(Loader2,{className:"w-4 h-4 animate-spin"}):jsx(PlayCircle,{className:"w-4 h-4"}),"Execute Payout"]})]}),O==="status"&&jsxs("div",{className:"border border-border bg-background p-6 space-y-4 rounded-lg",children:[jsxs("div",{children:[jsx("h3",{className:"font-semibold",children:"Check Transaction Status"}),jsx("p",{className:"text-xs text-muted-foreground",children:"Query the status of a transaction"})]}),jsxs("div",{className:"space-y-4",children:[jsxs("div",{className:"space-y-2",children:[jsx("label",{className:"text-xs font-medium",children:"Transaction ID"}),jsxs("div",{className:"flex gap-2",children:[jsx("input",{placeholder:"Enter transaction ID (UUID)",value:U,onChange:t=>Z(t.target.value),className:"flex-1 h-8 px-2.5 text-xs border border-input bg-transparent rounded-md outline-none focus:border-ring font-mono"}),U&&jsx("button",{onClick:()=>Oe(U),className:"w-8 h-8 border border-border bg-background hover:bg-muted transition-colors flex items-center justify-center rounded-md",title:"Copy to clipboard",children:jsx(Copy,{className:"w-4 h-4"})})]})]}),jsxs("button",{onClick:Bt,disabled:R==="loading"||!U,className:"w-full h-8 px-3 text-xs font-medium bg-primary text-primary-foreground hover:bg-primary/90 disabled:opacity-50 transition-colors flex items-center justify-center gap-2 rounded-md",children:[R==="loading"?jsx(Loader2,{className:"w-4 h-4 animate-spin"}):jsx(RefreshCw,{className:"w-4 h-4"}),"Check Status"]})]})]}),O==="toolkit"&&jsxs("div",{className:"space-y-4",children:[jsxs("div",{className:"border border-border bg-background p-6 space-y-4 rounded-lg",children:[jsxs("div",{children:[jsx("h3",{className:"font-semibold",children:"Predict Provider"}),jsx("p",{className:"text-xs text-muted-foreground",children:"Predict the provider from a phone number"})]}),jsxs("div",{className:"space-y-2",children:[jsx("label",{className:"text-xs font-medium",children:"Phone Number"}),jsx("input",{placeholder:"+237 670 000 000",value:W,onChange:t=>le(t.target.value),className:"w-full h-8 px-2.5 text-xs border border-input bg-transparent rounded-md outline-none focus:border-ring"})]}),jsxs("button",{onClick:Jt,disabled:R==="loading",className:"w-full h-8 px-3 text-xs font-medium bg-primary text-primary-foreground hover:bg-primary/90 disabled:opacity-50 transition-colors flex items-center justify-center gap-2 rounded-md",children:[R==="loading"?jsx(Loader2,{className:"w-4 h-4 animate-spin"}):jsx(Search,{className:"w-4 h-4"}),"Predict Provider"]})]}),jsxs("div",{className:"grid sm:grid-cols-3 gap-3",children:[jsxs("button",{onClick:Kt,disabled:R==="loading",className:"h-10 px-3 text-xs font-medium border border-border bg-background hover:bg-muted disabled:opacity-50 transition-colors flex items-center justify-center gap-2 rounded-md",children:[jsx(Wifi,{className:"w-4 h-4"}),"Provider Availability"]}),jsxs("button",{onClick:Xt,disabled:R==="loading",className:"h-10 px-3 text-xs font-medium border border-border bg-background hover:bg-muted disabled:opacity-50 transition-colors flex items-center justify-center gap-2 rounded-md",children:[jsx(Settings,{className:"w-4 h-4"}),"Active Config"]}),jsxs("button",{onClick:zt,disabled:R==="loading",className:"h-10 px-3 text-xs font-medium border border-border bg-background hover:bg-muted disabled:opacity-50 transition-colors flex items-center justify-center gap-2 rounded-md",children:[jsx(Key,{className:"w-4 h-4"}),"Public Keys"]})]})]}),O==="finances"&&jsxs("div",{className:"space-y-4",children:[jsxs("div",{className:"border border-border bg-background p-6 space-y-4 rounded-lg",children:[jsxs("div",{children:[jsx("h3",{className:"font-semibold",children:"Wallet Balances"}),jsx("p",{className:"text-xs text-muted-foreground",children:"View balances for all your wallets"})]}),jsxs("button",{onClick:Qt,disabled:R==="loading",className:"w-full h-8 px-3 text-xs font-medium bg-primary text-primary-foreground hover:bg-primary/90 disabled:opacity-50 transition-colors flex items-center justify-center gap-2 rounded-md",children:[R==="loading"?jsx(Loader2,{className:"w-4 h-4 animate-spin"}):jsx(Wallet,{className:"w-4 h-4"}),"Get Wallet Balances"]})]}),jsxs("div",{className:"border border-border bg-background p-6 space-y-4 rounded-lg",children:[jsxs("div",{children:[jsx("h3",{className:"font-semibold",children:"Statements"}),jsx("p",{className:"text-xs text-muted-foreground",children:"Generate financial statements for your wallets"})]}),jsxs("div",{className:"p-4 bg-muted/50 text-xs text-muted-foreground rounded-md",children:["Statement generation requires callback URL configuration. Use the SDK directly:",jsx("pre",{className:"mt-2 p-2 bg-background overflow-x-auto rounded",children:`await sdk.finances.generateStatement({
2
2
  wallet: { country: 'CMR', currency: 'XAF' },
3
3
  callbackUrl: 'https://your-site.com/callback',
4
4
  startDate: '2025-01-01T00:00:00Z',
5
5
  endDate: '2025-01-31T23:59:59Z',
6
- });`})]})]})]}),M==="webhooks"&&jsxs("div",{className:"space-y-4",children:[jsxs("div",{className:"border border-border bg-background p-6 space-y-4",children:[jsxs("div",{children:[jsx("h3",{className:"font-semibold",children:"Webhook Secret"}),jsx("p",{className:"text-xs text-muted-foreground",children:"Configure the secret used for signing webhooks"})]}),jsxs("div",{className:"space-y-2",children:[jsx("label",{className:"text-xs font-medium",children:"Secret Key"}),jsx("input",{type:"text",placeholder:"whsec_...",value:i,onChange:a=>y(a.target.value),className:"w-full h-8 px-2.5 text-xs font-mono border border-input bg-transparent rounded-none outline-none focus:border-ring"})]})]}),jsxs("div",{className:"border border-border bg-background p-6 space-y-4",children:[jsxs("div",{children:[jsx("h3",{className:"font-semibold",children:"Webhook Simulator"}),jsx("p",{className:"text-xs text-muted-foreground",children:"Generate mock webhook events for testing"})]}),jsxs("div",{className:"grid sm:grid-cols-2 gap-4",children:[jsxs("div",{className:"space-y-2",children:[jsx("label",{className:"text-xs font-medium",children:"Event Type"}),jsx("select",{value:I,onChange:a=>ae(a.target.value),className:"w-full h-8 px-2.5 text-xs border border-input bg-transparent rounded-none outline-none focus:border-ring",children:Qe.map(a=>jsx("option",{value:a,children:a},a))})]}),jsxs("div",{className:"space-y-2",children:[jsx("label",{className:"text-xs font-medium",children:"Amount"}),jsx("input",{type:"number",placeholder:"5000",value:xe,onChange:a=>we(a.target.value),className:"w-full h-8 px-2.5 text-xs border border-input bg-transparent rounded-none outline-none focus:border-ring"})]}),jsxs("div",{className:"space-y-2",children:[jsx("label",{className:"text-xs font-medium",children:"Phone Number"}),jsx("input",{placeholder:"237670000000",value:ve,onChange:a=>Ee(a.target.value),className:"w-full h-8 px-2.5 text-xs border border-input bg-transparent rounded-none outline-none focus:border-ring"})]}),jsxs("div",{className:"space-y-2",children:[jsx("label",{className:"text-xs font-medium",children:"Provider"}),jsx("select",{value:ye,onChange:a=>b(a.target.value),className:"w-full h-8 px-2.5 text-xs border border-input bg-transparent rounded-none outline-none focus:border-ring",children:_e.map(a=>jsxs("option",{value:a.value,children:[a.label," (",a.country,")"]},a.value))})]})]}),jsxs("button",{onClick:async()=>{let a=Xe(I,{amount:xe,phoneNumber:ve,correspondent:ye}),c=JSON.stringify(a,null,2),f=await Ct(JSON.stringify(a),i);Dt(c),Mt(f);let q={id:ke(),eventType:I,payload:a,signature:f,receivedAt:new Date().toLocaleTimeString(),isVerified:null};te(De=>[q,...De].slice(0,50)),p("Generate Webhook","success",{eventType:I,eventId:a.eventId});},className:"w-full h-8 px-3 text-xs font-medium bg-primary text-primary-foreground hover:bg-primary/90 transition-colors flex items-center justify-center gap-2",children:[jsx(Te,{}),"Generate Event"]}),B&&jsxs("div",{className:"space-y-2",children:[jsxs("div",{className:"flex items-center justify-between",children:[jsx("label",{className:"text-xs font-medium",children:"Generated Payload"}),jsx("button",{onClick:()=>Pe(B),className:"text-xs text-muted-foreground hover:text-foreground",children:"Copy"})]}),jsx("pre",{className:"text-xs bg-muted p-3 overflow-x-auto max-h-48",children:B}),jsxs("div",{className:"flex items-center gap-2",children:[jsx("label",{className:"text-xs font-medium",children:"Signature:"}),jsx("code",{className:"text-xs bg-muted px-2 py-1 font-mono flex-1 overflow-x-auto",children:Ge}),jsx("button",{onClick:()=>Pe(Ge),className:"w-8 h-8 border border-border bg-background hover:bg-muted transition-colors flex items-center justify-center",children:jsx(Et,{})})]})]})]}),jsxs("div",{className:"border border-border bg-background p-6 space-y-4",children:[jsxs("div",{children:[jsx("h3",{className:"font-semibold",children:"Signature Verifier"}),jsx("p",{className:"text-xs text-muted-foreground",children:"Test webhook signature verification"})]}),jsxs("div",{className:"space-y-4",children:[jsxs("div",{className:"space-y-2",children:[jsx("label",{className:"text-xs font-medium",children:"Payload (JSON)"}),jsx("textarea",{placeholder:'{"eventId": "...", "eventType": "deposit.completed", ...}',value:Ue,onChange:a=>It(a.target.value),rows:4,className:"w-full px-2.5 py-2 text-xs font-mono border border-input bg-transparent rounded-none outline-none focus:border-ring resize-none"})]}),jsxs("div",{className:"grid sm:grid-cols-2 gap-4",children:[jsxs("div",{className:"space-y-2",children:[jsx("label",{className:"text-xs font-medium",children:"Signature"}),jsx("input",{placeholder:"HMAC-SHA256 signature",value:Se,onChange:a=>Rt(a.target.value),className:"w-full h-8 px-2.5 text-xs font-mono border border-input bg-transparent rounded-none outline-none focus:border-ring"})]}),jsxs("div",{className:"space-y-2",children:[jsx("label",{className:"text-xs font-medium",children:"Secret"}),jsx("input",{type:"password",placeholder:"whsec_...",value:Be,onChange:a=>At(a.target.value),className:"w-full h-8 px-2.5 text-xs font-mono border border-input bg-transparent rounded-none outline-none focus:border-ring"})]})]}),jsxs("button",{onClick:async()=>{try{let a=JSON.parse(Ue),c=await Ct(JSON.stringify(a),Be),f=c===Se;Ve(f),p("Verify Signature",f?"success":"error",{isValid:f,expected:c,received:Se});}catch{Ve(false),p("Verify Signature","error",void 0,"Invalid JSON payload");}},className:"w-full h-8 px-3 text-xs font-medium bg-primary text-primary-foreground hover:bg-primary/90 transition-colors flex items-center justify-center gap-2",children:[jsx(Va,{}),"Verify Signature"]}),he!==null&&jsxs("div",{className:`p-3 text-xs flex items-center gap-2 ${he?"bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200":"bg-red-100 text-red-800 dark:bg-red-900 dark:text-red-200"}`,children:[he?jsx(St,{className:"text-green-600"}):jsx(Pt,{className:"text-red-600"}),he?"Signature is valid":"Signature is invalid"]})]})]}),jsxs("div",{className:"border border-border bg-background p-6 space-y-4",children:[jsxs("div",{children:[jsx("h3",{className:"font-semibold",children:"Event Parser"}),jsx("p",{className:"text-xs text-muted-foreground",children:"Parse and analyze raw webhook JSON"})]}),jsxs("div",{className:"space-y-4",children:[jsxs("div",{className:"space-y-2",children:[jsx("label",{className:"text-xs font-medium",children:"Raw JSON"}),jsx("textarea",{placeholder:"Paste webhook JSON here...",value:ze,onChange:a=>Lt(a.target.value),rows:4,className:"w-full px-2.5 py-2 text-xs font-mono border border-input bg-transparent rounded-none outline-none focus:border-ring resize-none"})]}),jsxs("button",{onClick:()=>{try{let a=JSON.parse(ze);Ke(a),$e(""),p("Parse Event","success",{eventType:a.eventType,eventId:a.eventId});}catch(a){Ke(null),$e(a instanceof Error?a.message:"Invalid JSON"),p("Parse Event","error",void 0,"Invalid JSON");}},className:"w-full h-8 px-3 text-xs font-medium bg-primary text-primary-foreground hover:bg-primary/90 transition-colors flex items-center justify-center gap-2",children:[jsx(za,{}),"Parse Event"]}),Je&&jsx("div",{className:"p-3 text-xs bg-red-100 text-red-800 dark:bg-red-900 dark:text-red-200",children:Je}),le&&jsxs("div",{className:"space-y-3",children:[jsxs("div",{className:"grid grid-cols-2 gap-2 text-xs",children:[jsxs("div",{className:"p-2 bg-muted",children:[jsx("span",{className:"text-muted-foreground",children:"Event ID:"}),jsx("p",{className:"font-mono truncate",children:String(le.eventId??"N/A")})]}),jsxs("div",{className:"p-2 bg-muted",children:[jsx("span",{className:"text-muted-foreground",children:"Event Type:"}),jsx("p",{className:"font-medium",children:String(le.eventType??"N/A")})]}),jsxs("div",{className:"p-2 bg-muted",children:[jsx("span",{className:"text-muted-foreground",children:"Timestamp:"}),jsx("p",{className:"font-mono truncate",children:String(le.timestamp??"N/A")})]}),jsxs("div",{className:"p-2 bg-muted",children:[jsx("span",{className:"text-muted-foreground",children:"Status:"}),jsx("p",{className:"font-medium",children:String(le.data?.status??"N/A")})]})]}),jsxs("div",{className:"space-y-2",children:[jsx("label",{className:"text-xs font-medium",children:"Full Data"}),jsx("pre",{className:"text-xs bg-muted p-3 overflow-x-auto max-h-48",children:JSON.stringify(le,null,2)})]})]})]})]}),jsxs("div",{className:"border border-border bg-background p-6 space-y-4",children:[jsxs("div",{className:"flex items-center justify-between",children:[jsxs("div",{children:[jsx("h3",{className:"font-semibold",children:"Event Log"}),jsx("p",{className:"text-xs text-muted-foreground",children:"History of generated webhook events"})]}),jsxs("div",{className:"flex items-center gap-2",children:[jsxs("select",{value:pe,onChange:a=>Ot(a.target.value),className:"h-8 px-2 text-xs border border-input bg-transparent rounded-none outline-none focus:border-ring",children:[jsx("option",{value:"all",children:"All"}),jsx("option",{value:"deposit",children:"Deposits"}),jsx("option",{value:"payout",children:"Payouts"}),jsx("option",{value:"refund",children:"Refunds"})]}),J.length>0&&jsx("button",{onClick:()=>te([]),className:"text-xs text-muted-foreground hover:text-foreground",children:"Clear"})]})]}),jsx("div",{className:"divide-y divide-border max-h-64 overflow-y-auto",children:J.filter(a=>pe==="all"||a.eventType.startsWith(pe)).length===0?jsx("div",{className:"p-4 text-center text-muted-foreground text-xs",children:"No events yet. Generate a webhook event to see it here."}):J.filter(a=>pe==="all"||a.eventType.startsWith(pe)).map(a=>jsxs("div",{className:"py-3 space-y-1",children:[jsxs("div",{className:"flex items-center justify-between",children:[jsx("div",{className:"flex items-center gap-2",children:jsx("span",{className:`px-1.5 py-0.5 text-xs font-medium ${a.eventType.includes("completed")?"bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200":a.eventType.includes("failed")?"bg-red-100 text-red-800 dark:bg-red-900 dark:text-red-200":"bg-blue-100 text-blue-800 dark:bg-blue-900 dark:text-blue-200"}`,children:a.eventType})}),jsx("span",{className:"text-xs text-muted-foreground",children:a.receivedAt})]}),jsxs("div",{className:"text-xs text-muted-foreground font-mono truncate",children:["sig: ",a.signature.slice(0,32),"..."]})]},a.id))})]})]})]}),jsxs("div",{className:"space-y-4",children:[jsxs("div",{className:"flex items-center justify-between",children:[jsx("h3",{className:"font-semibold",children:"Results"}),me.length>0&&jsx("button",{onClick:()=>U([]),className:"text-xs text-muted-foreground hover:text-foreground",children:"Clear"})]}),jsx("div",{className:"border border-border bg-background divide-y divide-border max-h-[600px] overflow-y-auto",children:me.length===0?jsx("div",{className:"p-6 text-center text-muted-foreground text-xs",children:"No results yet. Execute an operation to see results here."}):me.map(a=>jsxs("div",{className:"p-4 space-y-2",children:[jsxs("div",{className:"flex items-center justify-between",children:[jsxs("div",{className:"flex items-center gap-2",children:[a.status==="success"?jsx(St,{className:"text-green-600"}):jsx(Pt,{className:"text-red-600"}),jsx("span",{className:"font-medium text-sm",children:a.operation})]}),jsx("span",{className:"text-xs text-muted-foreground",children:a.timestamp})]}),a.error?jsx("p",{className:"text-xs text-red-600",children:a.error}):jsx("pre",{className:"text-xs bg-muted p-2 overflow-x-auto max-h-48",children:JSON.stringify(a.response,null,2)})]},a.id))})]})]})]}):jsxs("div",{className:`space-y-8 ${d}`,children:[jsxs("div",{children:[jsx("h1",{className:"text-2xl font-bold tracking-tight",children:"Spaark Pay Console"}),jsx("p",{className:"text-muted-foreground mt-1",children:"Configurez vos identifiants PawaPay pour commencer"})]}),jsxs("div",{className:"border border-border bg-background p-6 max-w-md space-y-6",children:[jsxs("div",{className:"flex items-center gap-3",children:[jsx("div",{className:"w-10 h-10 bg-muted flex items-center justify-center",children:jsx(je,{})}),jsxs("div",{children:[jsx("h2",{className:"font-semibold",children:"SDK Configuration"}),jsx("p",{className:"text-xs text-muted-foreground",children:"Enter your API credentials"})]})]}),jsxs("div",{className:"space-y-4",children:[jsxs("div",{className:"space-y-2",children:[jsx("label",{className:"text-xs font-medium",children:"API Key"}),jsx("input",{type:"password",placeholder:"pk_sandbox_...",value:m,onChange:a=>K(a.target.value),className:"w-full h-8 px-2.5 text-xs border border-input bg-transparent rounded-none outline-none focus:border-ring"})]}),jsxs("div",{className:"space-y-2",children:[jsx("label",{className:"text-xs font-medium",children:"Environnement"}),jsxs("div",{className:"flex gap-2",children:[jsxs("button",{onClick:()=>E("sandbox"),className:`h-8 px-3 text-xs font-medium border transition-colors flex items-center gap-1.5 ${u==="sandbox"?"bg-blue-600 text-white border-blue-600":"bg-background border-border hover:bg-muted"}`,children:[jsx("span",{className:`w-2 h-2 rounded-full ${u==="sandbox"?"bg-blue-200":"bg-blue-500"}`}),"Sandbox"]}),jsxs("button",{onClick:()=>E("production"),className:`h-8 px-3 text-xs font-medium border transition-colors flex items-center gap-1.5 ${u==="production"?"bg-green-600 text-white border-green-600":"bg-background border-border hover:bg-muted"}`,children:[jsx("span",{className:`w-2 h-2 rounded-full ${u==="production"?"bg-green-200":"bg-green-500"}`}),"Production"]})]}),jsx("p",{className:"text-xs text-muted-foreground",children:u==="sandbox"?"Utilisez le sandbox pour tester sans frais r\xE9els":"Attention : les transactions en production sont r\xE9elles"})]}),jsxs("button",{onClick:Ft,className:"w-full h-8 px-3 text-xs font-medium bg-primary text-primary-foreground hover:bg-primary/90 transition-colors flex items-center justify-center gap-2",children:[jsx(Te,{}),"Initialize SDK"]}),jsxs("div",{className:"relative flex items-center py-2",children:[jsx("div",{className:"flex-grow border-t border-border"}),jsx("span",{className:"flex-shrink mx-3 text-xs text-muted-foreground",children:"ou"}),jsx("div",{className:"flex-grow border-t border-border"})]}),jsxs("button",{onClick:Ht,className:"w-full h-8 px-3 text-xs font-medium border border-border bg-background hover:bg-muted transition-colors flex items-center justify-center gap-2",children:[jsx(Ha,{}),"Mode D\xE9mo (sans API key)"]})]})]})]})}var je=()=>jsxs("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.065 2.572c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.572 1.065c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.065-2.572c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z"}),jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"})]}),Te=()=>jsxs("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M14.752 11.168l-3.197-2.132A1 1 0 0010 9.87v4.263a1 1 0 001.555.832l3.197-2.132a1 1 0 000-1.664z"}),jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})]}),Tt=()=>jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M3 10h18M7 15h1m4 0h1m-7 4h12a3 3 0 003-3V8a3 3 0 00-3-3H6a3 3 0 00-3 3v8a3 3 0 003 3z"})}),Fa=()=>jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 18h.01M8 21h8a2 2 0 002-2V5a2 2 0 00-2-2H8a2 2 0 00-2 2v14a2 2 0 002 2z"})}),wt=()=>jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})}),ge=()=>jsx("svg",{className:"w-4 h-4 animate-spin",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})}),Et=()=>jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"})}),St=({className:s=""})=>jsx("svg",{className:`w-4 h-4 ${s}`,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"})}),Pt=({className:s=""})=>jsx("svg",{className:`w-4 h-4 ${s}`,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10 14l2-2m0 0l2-2m-2 2l-2-2m2 2l2 2m7-2a9 9 0 11-18 0 9 9 0 0118 0z"})}),Ha=()=>jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19.428 15.428a2 2 0 00-1.022-.547l-2.387-.477a6 6 0 00-3.86.517l-.318.158a6 6 0 01-3.86.517L6.05 15.21a2 2 0 00-1.806.547M8 4h8l-1 1v5.172a2 2 0 00.586 1.414l5 5c1.26 1.26.367 3.414-1.415 3.414H4.828c-1.782 0-2.674-2.154-1.414-3.414l5-5A2 2 0 009 10.172V5L8 4z"})}),Wa=()=>jsxs("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.065 2.572c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.572 1.065c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.065-2.572c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z"}),jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"})]}),_a=()=>jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 19v-6a2 2 0 00-2-2H5a2 2 0 00-2 2v6a2 2 0 002 2h2a2 2 0 002-2zm0 0V9a2 2 0 012-2h2a2 2 0 012 2v10m-6 0a2 2 0 002 2h2a2 2 0 002-2m0 0V5a2 2 0 012-2h2a2 2 0 012 2v14a2 2 0 01-2 2h-2a2 2 0 01-2-2z"})}),ja=()=>jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})}),Ga=()=>jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8.111 16.404a5.5 5.5 0 017.778 0M12 20h.01m-7.08-7.071c3.904-3.905 10.236-3.905 14.141 0M1.394 9.393c5.857-5.857 15.355-5.857 21.213 0"})}),Ua=()=>jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 7a2 2 0 012 2m4 0a6 6 0 01-7.743 5.743L11 17H9v2H7v2H4a1 1 0 01-1-1v-2.586a1 1 0 01.293-.707l5.964-5.964A6 6 0 1121 9z"})}),Ba=()=>jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 10V3L4 14h7v7l9-11h-7z"})}),Va=()=>jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 12l2 2 4-4m5.618-4.016A11.955 11.955 0 0112 2.944a11.955 11.955 0 01-8.618 3.04A12.02 12.02 0 003 9c0 5.591 3.824 10.29 9 11.622 5.176-1.332 9-6.03 9-11.622 0-1.042-.133-2.052-.382-3.016z"})}),za=()=>jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10 20l4-16m4 4l4 4-4 4M6 16l-4-4 4-4"})}),ro=Oa;export{Ea as SpaarkPaySdkFinanceDashboard,Oa as SpaarkPaySdkTestDashboard,ro as default};//# sourceMappingURL=react.mjs.map
6
+ });`})]})]})]}),O==="webhooks"&&jsxs("div",{className:"space-y-4",children:[jsxs("div",{className:"border border-border bg-background p-6 space-y-4 rounded-lg",children:[jsxs("div",{children:[jsx("h3",{className:"font-semibold",children:"Webhook Secret"}),jsx("p",{className:"text-xs text-muted-foreground",children:"Configure the secret used for signing webhooks"})]}),jsxs("div",{className:"space-y-2",children:[jsx("label",{className:"text-xs font-medium",children:"Secret Key"}),jsx("input",{type:"text",placeholder:"whsec_...",value:l,onChange:t=>y(t.target.value),className:"w-full h-8 px-2.5 text-xs font-mono border border-input bg-transparent rounded-md outline-none focus:border-ring"})]})]}),jsxs("div",{className:"border border-border bg-background p-6 space-y-4 rounded-lg",children:[jsxs("div",{children:[jsx("h3",{className:"font-semibold",children:"Webhook Simulator"}),jsx("p",{className:"text-xs text-muted-foreground",children:"Generate mock webhook events for testing"})]}),jsxs("div",{className:"grid sm:grid-cols-2 gap-4",children:[jsxs("div",{className:"space-y-2",children:[jsx("label",{className:"text-xs font-medium",children:"Event Type"}),jsx("select",{value:M,onChange:t=>X(t.target.value),className:"w-full h-8 px-2.5 text-xs border border-input bg-transparent rounded-md outline-none focus:border-ring",children:tt.map(t=>jsx("option",{value:t,children:t},t))})]}),jsxs("div",{className:"space-y-2",children:[jsx("label",{className:"text-xs font-medium",children:"Amount"}),jsx("input",{type:"number",placeholder:"5000",value:q,onChange:t=>ge(t.target.value),className:"w-full h-8 px-2.5 text-xs border border-input bg-transparent rounded-md outline-none focus:border-ring"})]}),jsxs("div",{className:"space-y-2",children:[jsx("label",{className:"text-xs font-medium",children:"Phone Number"}),jsx("input",{placeholder:"237670000000",value:Ne,onChange:t=>Me(t.target.value),className:"w-full h-8 px-2.5 text-xs border border-input bg-transparent rounded-md outline-none focus:border-ring"})]}),jsxs("div",{className:"space-y-2",children:[jsx("label",{className:"text-xs font-medium",children:"Provider"}),jsx("select",{value:Ce,onChange:t=>Re(t.target.value),className:"w-full h-8 px-2.5 text-xs border border-input bg-transparent rounded-md outline-none focus:border-ring",children:Ke.map(t=>jsxs("option",{value:t.value,children:[t.label," (",t.country,")"]},t.value))})]})]}),jsxs("button",{onClick:async()=>{let t=et(M,{amount:q,phoneNumber:Ne,correspondent:Ce}),u=JSON.stringify(t,null,2),v=await Ft(JSON.stringify(t),l);Ie(u),I(v);let ee={id:Pe(),eventType:M,payload:t,signature:v,receivedAt:new Date().toLocaleTimeString(),isVerified:null};oe(Le=>[ee,...Le].slice(0,50)),f("Generate Webhook","success",{eventType:M,eventId:t.eventId});},className:"w-full h-8 px-3 text-xs font-medium bg-primary text-primary-foreground hover:bg-primary/90 transition-colors flex items-center justify-center gap-2 rounded-md",children:[jsx(PlayCircle,{className:"w-4 h-4"}),"Generate Event"]}),be&&jsxs("div",{className:"space-y-2",children:[jsxs("div",{className:"flex items-center justify-between",children:[jsx("label",{className:"text-xs font-medium",children:"Generated Payload"}),jsx("button",{onClick:()=>Oe(be),className:"text-xs text-muted-foreground hover:text-foreground",children:"Copy"})]}),jsx("pre",{className:"text-xs bg-muted p-3 overflow-x-auto max-h-48 rounded-md",children:be}),jsxs("div",{className:"flex items-center gap-2",children:[jsx("label",{className:"text-xs font-medium",children:"Signature:"}),jsx("code",{className:"text-xs bg-muted px-2 py-1 font-mono flex-1 overflow-x-auto rounded",children:m}),jsx("button",{onClick:()=>Oe(m),className:"w-8 h-8 border border-border bg-background hover:bg-muted transition-colors flex items-center justify-center rounded-md",children:jsx(Copy,{className:"w-4 h-4"})})]})]})]}),jsxs("div",{className:"border border-border bg-background p-6 space-y-4 rounded-lg",children:[jsxs("div",{children:[jsx("h3",{className:"font-semibold",children:"Signature Verifier"}),jsx("p",{className:"text-xs text-muted-foreground",children:"Test webhook signature verification"})]}),jsxs("div",{className:"space-y-4",children:[jsxs("div",{className:"space-y-2",children:[jsx("label",{className:"text-xs font-medium",children:"Payload (JSON)"}),jsx("textarea",{placeholder:'{"eventId": "...", "eventType": "deposit.completed", ...}',value:Je,onChange:t=>Ht(t.target.value),rows:4,className:"w-full px-2.5 py-2 text-xs font-mono border border-input bg-transparent rounded-md outline-none focus:border-ring resize-none"})]}),jsxs("div",{className:"grid sm:grid-cols-2 gap-4",children:[jsxs("div",{className:"space-y-2",children:[jsx("label",{className:"text-xs font-medium",children:"Signature"}),jsx("input",{placeholder:"HMAC-SHA256 signature",value:Ae,onChange:t=>Gt(t.target.value),className:"w-full h-8 px-2.5 text-xs font-mono border border-input bg-transparent rounded-md outline-none focus:border-ring"})]}),jsxs("div",{className:"space-y-2",children:[jsx("label",{className:"text-xs font-medium",children:"Secret"}),jsx("input",{type:"password",placeholder:"whsec_...",value:Xe,onChange:t=>Wt(t.target.value),className:"w-full h-8 px-2.5 text-xs font-mono border border-input bg-transparent rounded-md outline-none focus:border-ring"})]})]}),jsxs("button",{onClick:async()=>{try{let t=JSON.parse(Je),u=await Ft(JSON.stringify(t),Xe),v=u===Ae;ze(v),f("Verify Signature",v?"success":"error",{isValid:v,expected:u,received:Ae});}catch{ze(false),f("Verify Signature","error",void 0,"Invalid JSON payload");}},className:"w-full h-8 px-3 text-xs font-medium bg-primary text-primary-foreground hover:bg-primary/90 transition-colors flex items-center justify-center gap-2 rounded-md",children:[jsx(Shield,{className:"w-4 h-4"}),"Verify Signature"]}),Te!==null&&jsxs("div",{className:`p-3 text-xs flex items-center gap-2 rounded-md ${Te?"bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200":"bg-red-100 text-red-800 dark:bg-red-900 dark:text-red-200"}`,children:[Te?jsx(CheckCircle2,{className:"w-4 h-4 text-green-600"}):jsx(XCircle,{className:"w-4 h-4 text-red-600"}),Te?"Signature is valid":"Signature is invalid"]})]})]}),jsxs("div",{className:"border border-border bg-background p-6 space-y-4 rounded-lg",children:[jsxs("div",{children:[jsx("h3",{className:"font-semibold",children:"Event Parser"}),jsx("p",{className:"text-xs text-muted-foreground",children:"Parse and analyze raw webhook JSON"})]}),jsxs("div",{className:"space-y-4",children:[jsxs("div",{className:"space-y-2",children:[jsx("label",{className:"text-xs font-medium",children:"Raw JSON"}),jsx("textarea",{placeholder:"Paste webhook JSON here...",value:Qe,onChange:t=>jt(t.target.value),rows:4,className:"w-full px-2.5 py-2 text-xs font-mono border border-input bg-transparent rounded-md outline-none focus:border-ring resize-none"})]}),jsxs("button",{onClick:()=>{try{let t=JSON.parse(Qe);Ye(t),qe(""),f("Parse Event","success",{eventType:t.eventType,eventId:t.eventId});}catch(t){Ye(null),qe(t instanceof Error?t.message:"Invalid JSON"),f("Parse Event","error",void 0,"Invalid JSON");}},className:"w-full h-8 px-3 text-xs font-medium bg-primary text-primary-foreground hover:bg-primary/90 transition-colors flex items-center justify-center gap-2 rounded-md",children:[jsx(Code,{className:"w-4 h-4"}),"Parse Event"]}),Ze&&jsx("div",{className:"p-3 text-xs bg-red-100 text-red-800 dark:bg-red-900 dark:text-red-200 rounded-md",children:Ze}),ce&&jsxs("div",{className:"space-y-3",children:[jsxs("div",{className:"grid grid-cols-2 gap-2 text-xs",children:[jsxs("div",{className:"p-2 bg-muted rounded",children:[jsx("span",{className:"text-muted-foreground",children:"Event ID:"}),jsx("p",{className:"font-mono truncate",children:String(ce.eventId??"N/A")})]}),jsxs("div",{className:"p-2 bg-muted rounded",children:[jsx("span",{className:"text-muted-foreground",children:"Event Type:"}),jsx("p",{className:"font-medium",children:String(ce.eventType??"N/A")})]}),jsxs("div",{className:"p-2 bg-muted rounded",children:[jsx("span",{className:"text-muted-foreground",children:"Timestamp:"}),jsx("p",{className:"font-mono truncate",children:String(ce.timestamp??"N/A")})]}),jsxs("div",{className:"p-2 bg-muted rounded",children:[jsx("span",{className:"text-muted-foreground",children:"Status:"}),jsx("p",{className:"font-medium",children:String(ce.data?.status??"N/A")})]})]}),jsxs("div",{className:"space-y-2",children:[jsx("label",{className:"text-xs font-medium",children:"Full Data"}),jsx("pre",{className:"text-xs bg-muted p-3 overflow-x-auto max-h-48 rounded-md",children:JSON.stringify(ce,null,2)})]})]})]})]}),jsxs("div",{className:"border border-border bg-background p-6 space-y-4 rounded-lg",children:[jsxs("div",{className:"flex items-center justify-between",children:[jsxs("div",{children:[jsx("h3",{className:"font-semibold",children:"Event Log"}),jsx("p",{className:"text-xs text-muted-foreground",children:"History of generated webhook events"})]}),jsxs("div",{className:"flex items-center gap-2",children:[jsxs("select",{value:fe,onChange:t=>Ut(t.target.value),className:"h-8 px-2 text-xs border border-input bg-transparent rounded-md outline-none focus:border-ring",children:[jsx("option",{value:"all",children:"All"}),jsx("option",{value:"deposit",children:"Deposits"}),jsx("option",{value:"payout",children:"Payouts"}),jsx("option",{value:"refund",children:"Refunds"})]}),V.length>0&&jsx("button",{onClick:()=>oe([]),className:"text-xs text-muted-foreground hover:text-foreground",children:"Clear"})]})]}),jsx("div",{className:"divide-y divide-border max-h-64 overflow-y-auto",children:V.filter(t=>fe==="all"||t.eventType.startsWith(fe)).length===0?jsx("div",{className:"p-4 text-center text-muted-foreground text-xs",children:"No events yet. Generate a webhook event to see it here."}):V.filter(t=>fe==="all"||t.eventType.startsWith(fe)).map(t=>jsxs("div",{className:"py-3 space-y-1",children:[jsxs("div",{className:"flex items-center justify-between",children:[jsx("div",{className:"flex items-center gap-2",children:jsx("span",{className:`px-1.5 py-0.5 text-xs font-medium rounded ${t.eventType.includes("completed")?"bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200":t.eventType.includes("failed")?"bg-red-100 text-red-800 dark:bg-red-900 dark:text-red-200":"bg-blue-100 text-blue-800 dark:bg-blue-900 dark:text-blue-200"}`,children:t.eventType})}),jsx("span",{className:"text-xs text-muted-foreground",children:t.receivedAt})]}),jsxs("div",{className:"text-xs text-muted-foreground font-mono truncate",children:["sig: ",t.signature.slice(0,32),"..."]})]},t.id))})]})]})]}),jsxs("div",{className:"space-y-4",children:[jsxs("div",{className:"flex items-center justify-between",children:[jsx("h3",{className:"font-semibold",children:"Results"}),pe.length>0&&jsx("button",{onClick:()=>$([]),className:"text-xs text-muted-foreground hover:text-foreground",children:"Clear"})]}),jsx("div",{className:"border border-border bg-background divide-y divide-border max-h-[600px] overflow-y-auto rounded-lg",children:pe.length===0?jsx("div",{className:"p-6 text-center text-muted-foreground text-xs",children:"No results yet. Execute an operation to see results here."}):pe.map(t=>jsxs("div",{className:"p-4 space-y-2",children:[jsxs("div",{className:"flex items-center justify-between",children:[jsxs("div",{className:"flex items-center gap-2",children:[t.status==="success"?jsx(CheckCircle2,{className:"w-4 h-4 text-green-600"}):jsx(XCircle,{className:"w-4 h-4 text-red-600"}),jsx("span",{className:"font-medium text-sm",children:t.operation})]}),jsx("span",{className:"text-xs text-muted-foreground",children:t.timestamp})]}),t.error?jsx("p",{className:"text-xs text-red-600",children:t.error}):jsx("pre",{className:"text-xs bg-muted p-2 overflow-x-auto max-h-48 rounded",children:JSON.stringify(t.response,null,2)})]},t.id))})]})]})]}):jsxs("div",{className:`space-y-8 ${d}`,children:[jsxs("div",{children:[jsx("h1",{className:"text-2xl font-bold tracking-tight",children:"Spaark Pay Console"}),jsx("p",{className:"text-muted-foreground mt-1",children:"Choisissez un mode pour commencer"})]}),jsxs("div",{className:"border border-border bg-background p-6 max-w-2xl space-y-4",children:[jsxs("div",{className:"flex items-center gap-3",children:[jsx("div",{className:"w-10 h-10 bg-muted flex items-center justify-center rounded-md",children:jsx(Key,{className:"w-5 h-5"})}),jsxs("div",{children:[jsx("h2",{className:"font-semibold",children:"Configuration API"}),jsx("p",{className:"text-xs text-muted-foreground",children:"Requis pour les modes Sandbox et Production"})]})]}),jsxs("div",{className:"space-y-2",children:[jsx("label",{className:"text-xs font-medium",children:"API Key"}),jsx("input",{type:"password",placeholder:"pk_sandbox_...",value:b,onChange:t=>G(t.target.value),className:"w-full h-10 px-3 text-sm border border-input bg-transparent rounded-md outline-none focus:border-ring"})]})]}),jsxs("div",{className:"grid sm:grid-cols-2 gap-4 max-w-2xl",children:[jsxs("button",{onClick:()=>we("demo"),className:"p-6 border border-border bg-background hover:bg-muted/50 transition-colors text-left space-y-3 rounded-lg",children:[jsxs("div",{className:"flex items-center gap-3",children:[jsx("div",{className:"w-10 h-10 bg-purple-100 dark:bg-purple-900 flex items-center justify-center rounded-md",children:jsx(LayoutDashboard,{className:"w-5 h-5 text-purple-600 dark:text-purple-400"})}),jsx("div",{children:jsx("span",{className:`px-2 py-0.5 text-xs font-medium rounded ${S.demo.bgColor} ${S.demo.color}`,children:"DEMO"})})]}),jsxs("div",{children:[jsx("h3",{className:"font-semibold",children:"Mode D\xE9monstration"}),jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Visualisez le dashboard financier avec des donn\xE9es fictives. Id\xE9al pour d\xE9couvrir l'interface."})]})]}),jsxs("button",{onClick:()=>we("demo-expert"),className:"p-6 border border-border bg-background hover:bg-muted/50 transition-colors text-left space-y-3 rounded-lg",children:[jsxs("div",{className:"flex items-center gap-3",children:[jsx("div",{className:"w-10 h-10 bg-amber-100 dark:bg-amber-900 flex items-center justify-center rounded-md",children:jsx(FlaskConical,{className:"w-5 h-5 text-amber-600 dark:text-amber-400"})}),jsx("div",{children:jsx("span",{className:`px-2 py-0.5 text-xs font-medium rounded ${S["demo-expert"].bgColor} ${S["demo-expert"].color}`,children:"EXPERT"})})]}),jsxs("div",{children:[jsx("h3",{className:"font-semibold",children:"Mode Expert (Test API)"}),jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Console de test avec r\xE9ponses simul\xE9es. Testez les endpoints sans cl\xE9 API."})]})]}),jsxs("button",{onClick:()=>we("sandbox"),disabled:!b.trim(),className:"p-6 border border-border bg-background hover:bg-muted/50 transition-colors text-left space-y-3 rounded-lg disabled:opacity-50 disabled:cursor-not-allowed",children:[jsxs("div",{className:"flex items-center gap-3",children:[jsx("div",{className:"w-10 h-10 bg-blue-100 dark:bg-blue-900 flex items-center justify-center rounded-md",children:jsx(Beaker,{className:"w-5 h-5 text-blue-600 dark:text-blue-400"})}),jsx("div",{children:jsx("span",{className:`px-2 py-0.5 text-xs font-medium rounded ${S.sandbox.bgColor} ${S.sandbox.color}`,children:"SANDBOX"})})]}),jsxs("div",{children:[jsx("h3",{className:"font-semibold",children:"Mode Sandbox"}),jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:["Connect\xE9 \xE0 l'API Pawapay Sandbox. Transactions de test r\xE9elles.",!b.trim()&&jsx("span",{className:"block text-amber-600 mt-1",children:"Entrez une cl\xE9 API ci-dessus"})]})]})]}),jsxs("button",{onClick:()=>we("production"),disabled:!b.trim(),className:"p-6 border border-border bg-background hover:bg-muted/50 transition-colors text-left space-y-3 rounded-lg disabled:opacity-50 disabled:cursor-not-allowed",children:[jsxs("div",{className:"flex items-center gap-3",children:[jsx("div",{className:"w-10 h-10 bg-green-100 dark:bg-green-900 flex items-center justify-center rounded-md",children:jsx(Globe,{className:"w-5 h-5 text-green-600 dark:text-green-400"})}),jsxs("div",{className:"flex items-center gap-2",children:[jsx("span",{className:`px-2 py-0.5 text-xs font-medium rounded ${S.production.bgColor} ${S.production.color}`,children:"PRODUCTION"}),jsx(Lock,{className:"w-3 h-3 text-muted-foreground"})]})]}),jsxs("div",{children:[jsx("h3",{className:"font-semibold",children:"Mode Production"}),jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:["Environnement de production. Transactions r\xE9elles avec argent r\xE9el.",!b.trim()&&jsx("span",{className:"block text-amber-600 mt-1",children:"Entrez une cl\xE9 API ci-dessus"})]})]})]})]})]})}var ys=ss;export{Se as SpaarkPaySdkFinanceDashboard,ss as SpaarkPaySdkTestDashboard,ys as default};//# sourceMappingURL=react.mjs.map
7
7
  //# sourceMappingURL=react.mjs.map