spaark-payapi-sdk 1.3.0 → 1.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { AxiosRequestConfig } from 'axios';
2
- import { D as DepositRequest, a as DepositResponse, P as PayoutRequest, b as PayoutResponse, c as PaymentPageRequest, d as PaymentPageResponse, R as RefundRequest, e as RefundResponse, T as TransactionStatusResponse, f as PollOptions, g as TransactionFilters, A as ActionResponse, C as Currency, h as Correspondent, i as TransactionLimits, j as CorrespondentInfo, F as FailureReason } from './react-C9ThSRq3.mjs';
3
- export { k as CORRESPONDENTS, l as CORRESPONDENT_INFO, m as CorrespondentFeature, n as DEFAULT_LIMITS, o as DepositFailureCode, p as FinancialAddress, M as MMOAccount, q as PayoutFailureCode, S as SpaarkPaySdkTestDashboard, r as SpaarkPaySdkTestDashboardProps, s as TransactionStatus } from './react-C9ThSRq3.mjs';
2
+ import { D as DepositRequest, a as DepositResponse, P as PayoutRequest, b as PayoutResponse, c as PaymentPageRequest, d as PaymentPageResponse, R as RefundRequest, e as RefundResponse, T as TransactionStatusResponse, f as PollOptions, g as TransactionFilters, A as ActionResponse, C as Currency, h as Correspondent, i as TransactionLimits, j as CorrespondentInfo, F as FailureReason } from './react-lB9wOLUj.mjs';
3
+ export { k as CORRESPONDENTS, l as CORRESPONDENT_INFO, m as CorrespondentFeature, n as DEFAULT_LIMITS, o as DepositFailureCode, p as FinancialAddress, M as MMOAccount, q as PayoutFailureCode, S as SpaarkPaySdkTestDashboard, r as SpaarkPaySdkTestDashboardProps, s as TransactionStatus } from './react-lB9wOLUj.mjs';
4
4
  import 'react/jsx-runtime';
5
5
 
6
6
  type Environment = 'sandbox' | 'production';
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { AxiosRequestConfig } from 'axios';
2
- import { D as DepositRequest, a as DepositResponse, P as PayoutRequest, b as PayoutResponse, c as PaymentPageRequest, d as PaymentPageResponse, R as RefundRequest, e as RefundResponse, T as TransactionStatusResponse, f as PollOptions, g as TransactionFilters, A as ActionResponse, C as Currency, h as Correspondent, i as TransactionLimits, j as CorrespondentInfo, F as FailureReason } from './react-C9ThSRq3.js';
3
- export { k as CORRESPONDENTS, l as CORRESPONDENT_INFO, m as CorrespondentFeature, n as DEFAULT_LIMITS, o as DepositFailureCode, p as FinancialAddress, M as MMOAccount, q as PayoutFailureCode, S as SpaarkPaySdkTestDashboard, r as SpaarkPaySdkTestDashboardProps, s as TransactionStatus } from './react-C9ThSRq3.js';
2
+ import { D as DepositRequest, a as DepositResponse, P as PayoutRequest, b as PayoutResponse, c as PaymentPageRequest, d as PaymentPageResponse, R as RefundRequest, e as RefundResponse, T as TransactionStatusResponse, f as PollOptions, g as TransactionFilters, A as ActionResponse, C as Currency, h as Correspondent, i as TransactionLimits, j as CorrespondentInfo, F as FailureReason } from './react-lB9wOLUj.js';
3
+ export { k as CORRESPONDENTS, l as CORRESPONDENT_INFO, m as CorrespondentFeature, n as DEFAULT_LIMITS, o as DepositFailureCode, p as FinancialAddress, M as MMOAccount, q as PayoutFailureCode, S as SpaarkPaySdkTestDashboard, r as SpaarkPaySdkTestDashboardProps, s as TransactionStatus } from './react-lB9wOLUj.js';
4
4
  import 'react/jsx-runtime';
5
5
 
6
6
  type Environment = 'sandbox' | 'production';
@@ -173,9 +173,11 @@ interface SpaarkPaySdkFinanceDashboardProps {
173
173
  onExpertModeClick?: () => void;
174
174
  onTransactionClick?: (transaction: Transaction) => void;
175
175
  onRefresh?: () => void;
176
+ onAddTransaction?: () => void;
177
+ onSettings?: () => void;
176
178
  isLoading?: boolean;
177
179
  }
178
- declare function SpaarkPaySdkFinanceDashboard({ transactions, title, subtitle, locale, className, showExpertMode, onExpertModeClick, onTransactionClick, onRefresh, isLoading, }: SpaarkPaySdkFinanceDashboardProps): react_jsx_runtime.JSX.Element;
180
+ declare function SpaarkPaySdkFinanceDashboard({ transactions, title, subtitle, locale, className, showExpertMode, onExpertModeClick, onTransactionClick, onRefresh, onAddTransaction, onSettings, isLoading, }: SpaarkPaySdkFinanceDashboardProps): react_jsx_runtime.JSX.Element;
179
181
 
180
182
  interface SpaarkPaySdkTestDashboardProps {
181
183
  apiKey?: string;
@@ -173,9 +173,11 @@ interface SpaarkPaySdkFinanceDashboardProps {
173
173
  onExpertModeClick?: () => void;
174
174
  onTransactionClick?: (transaction: Transaction) => void;
175
175
  onRefresh?: () => void;
176
+ onAddTransaction?: () => void;
177
+ onSettings?: () => void;
176
178
  isLoading?: boolean;
177
179
  }
178
- declare function SpaarkPaySdkFinanceDashboard({ transactions, title, subtitle, locale, className, showExpertMode, onExpertModeClick, onTransactionClick, onRefresh, isLoading, }: SpaarkPaySdkFinanceDashboardProps): react_jsx_runtime.JSX.Element;
180
+ declare function SpaarkPaySdkFinanceDashboard({ transactions, title, subtitle, locale, className, showExpertMode, onExpertModeClick, onTransactionClick, onRefresh, onAddTransaction, onSettings, isLoading, }: SpaarkPaySdkFinanceDashboardProps): react_jsx_runtime.JSX.Element;
179
181
 
180
182
  interface SpaarkPaySdkTestDashboardProps {
181
183
  apiKey?: string;
package/dist/react.d.mts CHANGED
@@ -1,2 +1,2 @@
1
1
  import 'react/jsx-runtime';
2
- export { t as SpaarkPaySdkFinanceDashboard, u as SpaarkPaySdkFinanceDashboardProps, S as SpaarkPaySdkTestDashboard, r as SpaarkPaySdkTestDashboardProps, v as Transaction, w as TransactionStatus, x as TransactionType, S as default } from './react-C9ThSRq3.mjs';
2
+ export { t as SpaarkPaySdkFinanceDashboard, u as SpaarkPaySdkFinanceDashboardProps, S as SpaarkPaySdkTestDashboard, r as SpaarkPaySdkTestDashboardProps, v as Transaction, w as TransactionStatus, x as TransactionType, S as default } from './react-lB9wOLUj.mjs';
package/dist/react.d.ts CHANGED
@@ -1,2 +1,2 @@
1
1
  import 'react/jsx-runtime';
2
- export { t as SpaarkPaySdkFinanceDashboard, u as SpaarkPaySdkFinanceDashboardProps, S as SpaarkPaySdkTestDashboard, r as SpaarkPaySdkTestDashboardProps, v as Transaction, w as TransactionStatus, x as TransactionType, S as default } from './react-C9ThSRq3.js';
2
+ export { t as SpaarkPaySdkFinanceDashboard, u as SpaarkPaySdkFinanceDashboardProps, S as SpaarkPaySdkTestDashboard, r as SpaarkPaySdkTestDashboardProps, v as Transaction, w as TransactionStatus, x as TransactionType, S as default } from './react-lB9wOLUj.js';
package/dist/react.js CHANGED
@@ -1,7 +1,7 @@
1
- 'use strict';Object.defineProperty(exports,'__esModule',{value:true});var react=require('react'),lucideReact=require('lucide-react'),jsxRuntime=require('react/jsx-runtime');var $=()=>"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,n=>{let f=Math.random()*16|0;return (n==="x"?f:f&3|8).toString(16)});function dt(n,f={}){let{transactionId:y=$(),amount:E="5000",currency:b="XAF",correspondent:T="MTN_MOMO_CMR",phoneNumber:P="237670000000",status:p=n==="deposit.failed"?"FAILED":"COMPLETED",failureCode:l="INSUFFICIENT_FUNDS",failureMessage:I="The payer has insufficient funds"}=f,s=new Date().toISOString(),h={depositId:y,status:p,amount:E,currency:b,correspondent:T,payer:{type:"MSISDN",address:{value:P}},customerTimestamp:s,created:s};return p==="COMPLETED"&&(h.receivedByPayer=s),p==="FAILED"&&(h.failureReason={failureCode:l,failureMessage:I}),{eventId:$(),eventType:n,timestamp:s,data:h}}function lt(n,f={}){let{transactionId:y=$(),amount:E="5000",currency:b="XAF",correspondent:T="MTN_MOMO_CMR",phoneNumber:P="237670000000",status:p=n==="payout.failed"?"FAILED":"COMPLETED",failureCode:l="RECIPIENT_NOT_FOUND",failureMessage:I="The recipient account was not found"}=f,s=new Date().toISOString(),h={payoutId:y,status:p,amount:E,currency:b,correspondent:T,recipient:{type:"MSISDN",address:{value:P}},customerTimestamp:s,created:s};return p==="COMPLETED"&&(h.receivedByRecipient=s),p==="FAILED"&&(h.failureReason={failureCode:l,failureMessage:I}),{eventId:$(),eventType:n,timestamp:s,data:h}}function ct(n,f={}){let{transactionId:y=$(),depositId:E=$(),amount:b="5000",currency:T="XAF",correspondent:P="MTN_MOMO_CMR",phoneNumber:p="237670000000",status:l=n==="refund.failed"?"FAILED":"COMPLETED",failureCode:I="REFUND_LIMIT_EXCEEDED",failureMessage:s="The refund limit has been exceeded"}=f,h=new Date().toISOString(),J={refundId:y,depositId:E,status:l,amount:b,currency:T,correspondent:P,recipient:{type:"MSISDN",address:{value:p}},created:h};return l==="FAILED"&&(J.failureReason={failureCode:I,failureMessage:s}),{eventId:$(),eventType:n,timestamp:h,data:J}}function Te(n,f={}){return n.startsWith("deposit.")?dt(n,f):n.startsWith("payout.")?lt(n,f):ct(n,f)}var Se=["deposit.accepted","deposit.completed","deposit.failed","payout.accepted","payout.completed","payout.failed","refund.completed","refund.failed"];var kt={fr:{title:"Tableau de bord Finance",subtitle:"Vue d'ensemble de vos transactions",totalVolume:"Volume Total",deposits:"D\xE9p\xF4ts",payouts:"Retraits",failed:"\xC9checs",refunds:"Remboursements",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",noTransactions:"Aucune transaction",noTransactionsDesc:"Les transactions appara\xEEtront ici une fois effectu\xE9es.",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 !"},en:{title:"Finance Dashboard",subtitle:"Overview of your transactions",totalVolume:"Total Volume",deposits:"Deposits",payouts:"Payouts",failed:"Failed",refunds:"Refunds",search:"Search by ID or phone...",allTypes:"All types",allStatuses:"All statuses",deposit:"Deposit",payout:"Payout",refund:"Refund",expertMode:"Expert Mode",refresh:"Refresh",noTransactions:"No transactions",noTransactionsDesc:"Transactions will appear here once made.",id:"ID",type:"Type",amount:"Amount",status:"Status",provider:"Provider",phone:"Phone",date:"Date",page:"Page",of:"of",transactions:"transactions",copied:"Copied!"}},Ct={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"},wt=({status:n})=>{switch(n){case "COMPLETED":return jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-3.5 h-3.5"});case "FAILED":case "REJECTED":case "CANCELLED":return jsxRuntime.jsx(lucideReact.XCircle,{className:"w-3.5 h-3.5"});case "PENDING":case "ENQUEUED":return jsxRuntime.jsx(lucideReact.Clock,{className:"w-3.5 h-3.5"});case "PROCESSING":case "ACCEPTED":return jsxRuntime.jsx(lucideReact.Loader2,{className:"w-3.5 h-3.5 animate-spin"});default:return jsxRuntime.jsx(lucideReact.AlertCircle,{className:"w-3.5 h-3.5"})}},X=(n,f)=>new Intl.NumberFormat("fr-FR",{style:"decimal",minimumFractionDigits:0,maximumFractionDigits:0}).format(n)+" "+f,Et=(n,f)=>{let y=new Date(n);return new Intl.DateTimeFormat(f==="fr"?"fr-FR":"en-US",{day:"2-digit",month:"short",year:"numeric",hour:"2-digit",minute:"2-digit"}).format(y)},ue=10;function Tt({transactions:n,title:f,subtitle:y,locale:E="fr",className:b="",showExpertMode:T=true,onExpertModeClick:P,onTransactionClick:p,onRefresh:l,isLoading:I=false}){let s=kt[E],[h,J]=react.useState(""),[W,g]=react.useState("all"),[U,w]=react.useState("all"),[S,N]=react.useState(1),[B,L]=react.useState(null),O=react.useMemo(()=>{let i=n.filter(v=>v.type==="deposit"),k=n.filter(v=>v.type==="payout"),j=n.filter(v=>v.type==="refund"),V=n.filter(v=>v.status==="FAILED"||v.status==="REJECTED"),q=n.filter(v=>v.status==="COMPLETED").reduce((v,R)=>v+R.amount,0),C=i.filter(v=>v.status==="COMPLETED").reduce((v,R)=>v+R.amount,0),x=k.filter(v=>v.status==="COMPLETED").reduce((v,R)=>v+R.amount,0),ee=j.filter(v=>v.status==="COMPLETED").reduce((v,R)=>v+R.amount,0);return {totalVolume:q,depositsCount:i.length,depositsTotal:C,payoutsCount:k.length,payoutsTotal:x,failedCount:V.length,refundsCount:j.length,refundsTotal:ee}},[n]),D=react.useMemo(()=>n.filter(i=>{let k=h===""||i.id.toLowerCase().includes(h.toLowerCase())||i.phoneNumber.includes(h),j=W==="all"||i.type===W,V=U==="all"||i.status===U;return k&&j&&V}),[n,h,W,U]),Y=react.useMemo(()=>{let i=(S-1)*ue;return D.slice(i,i+ue)},[D,S]),A=Math.ceil(D.length/ue),Z=react.useCallback(i=>{navigator.clipboard.writeText(i),L(i),setTimeout(()=>L(null),2e3);},[]),_=n[0]?.currency||"XAF";return jsxRuntime.jsxs("div",{className:`space-y-6 ${b}`,children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between flex-wrap gap-4",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h1",{className:"text-2xl font-bold tracking-tight",children:f||s.title}),jsxRuntime.jsx("p",{className:"text-muted-foreground mt-1",children:y||s.subtitle})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[l&&jsxRuntime.jsxs("button",{onClick:l,disabled:I,className:"h-8 px-3 text-xs font-medium border border-border bg-background hover:bg-muted disabled:opacity-50 transition-colors flex items-center gap-2",children:[jsxRuntime.jsx(lucideReact.RefreshCw,{className:`w-4 h-4 ${I?"animate-spin":""}`}),s.refresh]}),T&&P&&jsxRuntime.jsxs("button",{onClick:P,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:[jsxRuntime.jsx(lucideReact.Settings,{className:"w-4 h-4"}),s.expertMode]})]})]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-5 gap-4",children:[jsxRuntime.jsxs("div",{className:"border border-border bg-background p-4 space-y-2",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground",children:[jsxRuntime.jsx(lucideReact.TrendingUp,{className:"w-4 h-4"}),jsxRuntime.jsx("span",{className:"text-xs font-medium",children:s.totalVolume})]}),jsxRuntime.jsx("p",{className:"text-xl font-bold",children:X(O.totalVolume,_)}),jsxRuntime.jsxs("p",{className:"text-xs text-muted-foreground",children:[n.length," ",s.transactions]})]}),jsxRuntime.jsxs("div",{className:"border border-border bg-background p-4 space-y-2",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-green-600 dark:text-green-400",children:[jsxRuntime.jsx(lucideReact.ArrowDownCircle,{className:"w-4 h-4"}),jsxRuntime.jsx("span",{className:"text-xs font-medium",children:s.deposits})]}),jsxRuntime.jsx("p",{className:"text-xl font-bold",children:X(O.depositsTotal,_)}),jsxRuntime.jsxs("p",{className:"text-xs text-muted-foreground",children:[O.depositsCount," ",s.transactions]})]}),jsxRuntime.jsxs("div",{className:"border border-border bg-background p-4 space-y-2",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-blue-600 dark:text-blue-400",children:[jsxRuntime.jsx(lucideReact.ArrowUpCircle,{className:"w-4 h-4"}),jsxRuntime.jsx("span",{className:"text-xs font-medium",children:s.payouts})]}),jsxRuntime.jsx("p",{className:"text-xl font-bold",children:X(O.payoutsTotal,_)}),jsxRuntime.jsxs("p",{className:"text-xs text-muted-foreground",children:[O.payoutsCount," ",s.transactions]})]}),jsxRuntime.jsxs("div",{className:"border border-border bg-background p-4 space-y-2",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-red-600 dark:text-red-400",children:[jsxRuntime.jsx(lucideReact.XCircle,{className:"w-4 h-4"}),jsxRuntime.jsx("span",{className:"text-xs font-medium",children:s.failed})]}),jsxRuntime.jsx("p",{className:"text-xl font-bold",children:O.failedCount}),jsxRuntime.jsx("p",{className:"text-xs text-muted-foreground",children:s.transactions})]}),jsxRuntime.jsxs("div",{className:"border border-border bg-background p-4 space-y-2",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-orange-600 dark:text-orange-400",children:[jsxRuntime.jsx(lucideReact.RefreshCw,{className:"w-4 h-4"}),jsxRuntime.jsx("span",{className:"text-xs font-medium",children:s.refunds})]}),jsxRuntime.jsx("p",{className:"text-xl font-bold",children:X(O.refundsTotal,_)}),jsxRuntime.jsxs("p",{className:"text-xs text-muted-foreground",children:[O.refundsCount," ",s.transactions]})]})]}),jsxRuntime.jsxs("div",{className:"flex flex-wrap gap-3",children:[jsxRuntime.jsxs("div",{className:"relative flex-1 min-w-[200px]",children:[jsxRuntime.jsx(lucideReact.Search,{className:"absolute left-2.5 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground"}),jsxRuntime.jsx("input",{type:"text",placeholder:s.search,value:h,onChange:i=>{J(i.target.value),N(1);},className:"w-full h-8 pl-8 pr-3 text-xs border border-input bg-transparent outline-none focus:border-ring"})]}),jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx(lucideReact.Filter,{className:"absolute left-2.5 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground"}),jsxRuntime.jsxs("select",{value:W,onChange:i=>{g(i.target.value),N(1);},className:"h-8 pl-8 pr-8 text-xs border border-input bg-transparent outline-none focus:border-ring appearance-none cursor-pointer",children:[jsxRuntime.jsx("option",{value:"all",children:s.allTypes}),jsxRuntime.jsx("option",{value:"deposit",children:s.deposit}),jsxRuntime.jsx("option",{value:"payout",children:s.payout}),jsxRuntime.jsx("option",{value:"refund",children:s.refund})]})]}),jsxRuntime.jsxs("select",{value:U,onChange:i=>{w(i.target.value),N(1);},className:"h-8 px-3 text-xs border border-input bg-transparent outline-none focus:border-ring appearance-none cursor-pointer",children:[jsxRuntime.jsx("option",{value:"all",children:s.allStatuses}),jsxRuntime.jsx("option",{value:"COMPLETED",children:"COMPLETED"}),jsxRuntime.jsx("option",{value:"PENDING",children:"PENDING"}),jsxRuntime.jsx("option",{value:"PROCESSING",children:"PROCESSING"}),jsxRuntime.jsx("option",{value:"ACCEPTED",children:"ACCEPTED"}),jsxRuntime.jsx("option",{value:"FAILED",children:"FAILED"}),jsxRuntime.jsx("option",{value:"CANCELLED",children:"CANCELLED"}),jsxRuntime.jsx("option",{value:"REJECTED",children:"REJECTED"})]})]}),jsxRuntime.jsx("div",{className:"border border-border bg-background overflow-hidden",children:I?jsxRuntime.jsx("div",{className:"p-12 text-center",children:jsxRuntime.jsx(lucideReact.Loader2,{className:"w-8 h-8 animate-spin mx-auto text-muted-foreground"})}):D.length===0?jsxRuntime.jsxs("div",{className:"p-12 text-center",children:[jsxRuntime.jsx(lucideReact.AlertCircle,{className:"w-12 h-12 mx-auto text-muted-foreground mb-4"}),jsxRuntime.jsx("p",{className:"font-medium",children:s.noTransactions}),jsxRuntime.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:s.noTransactionsDesc})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"overflow-x-auto",children:jsxRuntime.jsxs("table",{className:"w-full text-xs",children:[jsxRuntime.jsx("thead",{className:"bg-muted/50",children:jsxRuntime.jsxs("tr",{children:[jsxRuntime.jsx("th",{className:"text-left p-3 font-medium",children:s.id}),jsxRuntime.jsx("th",{className:"text-left p-3 font-medium",children:s.type}),jsxRuntime.jsx("th",{className:"text-left p-3 font-medium",children:s.amount}),jsxRuntime.jsx("th",{className:"text-left p-3 font-medium",children:s.status}),jsxRuntime.jsx("th",{className:"text-left p-3 font-medium",children:s.provider}),jsxRuntime.jsx("th",{className:"text-left p-3 font-medium",children:s.phone}),jsxRuntime.jsx("th",{className:"text-left p-3 font-medium",children:s.date})]})}),jsxRuntime.jsx("tbody",{className:"divide-y divide-border",children:Y.map(i=>jsxRuntime.jsxs("tr",{className:`hover:bg-muted/30 transition-colors ${p?"cursor-pointer":""}`,onClick:()=>p?.(i),children:[jsxRuntime.jsx("td",{className:"p-3",children:jsxRuntime.jsxs("div",{className:"flex items-center gap-1.5",children:[jsxRuntime.jsxs("span",{className:"font-mono truncate max-w-[100px]",title:i.id,children:[i.id.slice(0,8),"..."]}),jsxRuntime.jsx("button",{onClick:k=>{k.stopPropagation(),Z(i.id);},className:"p-1 hover:bg-muted rounded",title:"Copy ID",children:B===i.id?jsxRuntime.jsx(lucideReact.Check,{className:"w-3 h-3 text-green-600"}):jsxRuntime.jsx(lucideReact.Copy,{className:"w-3 h-3 text-muted-foreground"})})]})}),jsxRuntime.jsx("td",{className:"p-3",children:jsxRuntime.jsxs("span",{className:`inline-flex items-center gap-1 px-2 py-0.5 text-xs font-medium ${i.type==="deposit"?"bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200":i.type==="payout"?"bg-blue-100 text-blue-800 dark:bg-blue-900 dark:text-blue-200":"bg-orange-100 text-orange-800 dark:bg-orange-900 dark:text-orange-200"}`,children:[i.type==="deposit"&&jsxRuntime.jsx(lucideReact.ArrowDownCircle,{className:"w-3 h-3"}),i.type==="payout"&&jsxRuntime.jsx(lucideReact.ArrowUpCircle,{className:"w-3 h-3"}),i.type==="refund"&&jsxRuntime.jsx(lucideReact.RefreshCw,{className:"w-3 h-3"}),s[i.type]]})}),jsxRuntime.jsx("td",{className:"p-3 font-medium",children:X(i.amount,i.currency)}),jsxRuntime.jsx("td",{className:"p-3",children:jsxRuntime.jsxs("span",{className:`inline-flex items-center gap-1 px-2 py-0.5 text-xs font-medium ${Ct[i.status]}`,children:[jsxRuntime.jsx(wt,{status:i.status}),i.status]})}),jsxRuntime.jsx("td",{className:"p-3 text-muted-foreground",children:i.provider.replace(/_/g," ")}),jsxRuntime.jsx("td",{className:"p-3 font-mono text-muted-foreground",children:i.phoneNumber}),jsxRuntime.jsx("td",{className:"p-3 text-muted-foreground",children:Et(i.createdAt,E)})]},i.id))})]})}),A>1&&jsxRuntime.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-t border-border",children:[jsxRuntime.jsxs("p",{className:"text-xs text-muted-foreground",children:[D.length," ",s.transactions]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("button",{onClick:()=>N(i=>Math.max(1,i-1)),disabled:S===1,className:"w-8 h-8 flex items-center justify-center border border-border hover:bg-muted disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:"w-4 h-4"})}),jsxRuntime.jsxs("span",{className:"text-xs",children:[s.page," ",S," ",s.of," ",A]}),jsxRuntime.jsx("button",{onClick:()=>N(i=>Math.min(A,i+1)),disabled:S===A,className:"w-8 h-8 flex items-center justify-center border border-border hover:bg-muted disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-4 h-4"})})]})]})]})})]})}var Dt=n=>({depositId:n,status:"ACCEPTED",created:new Date().toISOString(),nextStep:"FINAL_STATUS"}),Mt=n=>({payoutId:n,status:"ACCEPTED",created:new Date().toISOString()}),Pt=n=>({depositId:n,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"}}}),It=()=>[{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"}]}]}],Ot=n=>({country:"CMR",provider:n.startsWith("23767")?"MTN_MOMO_CMR":"ORANGE_CMR",phoneNumber:n.replace(/\D/g,"")}),At=()=>({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"}}}]}]}]}),Rt=()=>({balances:[{country:"CMR",currency:"XAF",balance:"1250000.00"},{country:"COG",currency:"XAF",balance:"450000.00"},{country:"GAB",currency:"XAF",balance:"780000.00"}]}),Lt=()=>[{id:"key-001",key:"MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA..."}],G=(n=800)=>new Promise(f=>setTimeout(f,n+Math.random()*400));async function Ae(n,f){let y=new TextEncoder,E=await crypto.subtle.importKey("raw",y.encode(f),{name:"HMAC",hash:"SHA-256"},false,["sign"]),b=await crypto.subtle.sign("HMAC",E,y.encode(n));return Array.from(new Uint8Array(b)).map(T=>T.toString(16).padStart(2,"0")).join("")}var oe=()=>"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,n=>{let f=Math.random()*16|0;return (n==="x"?f:f&3|8).toString(16)}),pe=[{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"}],Re=[{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 Ft({apiKey:n="",environment:f="sandbox",className:y="",demoMode:E=false,apiBasePath:b="/api/pawapay",onDepositComplete:T,onPayoutComplete:P,onError:p}){let[l,I]=react.useState(n),[s,h]=react.useState(f),[J,W]=react.useState(!!n||E),[g,U]=react.useState(E),[w,S]=react.useState("deposit"),[N,B]=react.useState("237670000000"),[L,O]=react.useState("5000"),[D,Y]=react.useState("XAF"),[A,Z]=react.useState("MTN_MOMO_CMR"),[_,i]=react.useState("Test Payment"),[k,j]=react.useState(""),[V,q]=react.useState([]),[C,x]=react.useState("idle"),[ee,v]=react.useState("whsec_test_secret_key"),[R,be]=react.useState([]),[te,Ge]=react.useState("deposit.completed"),[ge,Ue]=react.useState("5000"),[fe,Ve]=react.useState("237670000000"),[xe,$e]=react.useState("MTN_MOMO_CMR"),[re,Je]=react.useState(""),[ve,ze]=react.useState(""),[he,Be]=react.useState(""),[ne,He]=react.useState(""),[ye,Ke]=react.useState(""),[ae,Ne]=react.useState(null),[ke,Xe]=react.useState(""),[z,Ce]=react.useState(null),[we,Ee]=react.useState(""),[H,Qe]=react.useState("all"),c=react.useCallback((t,r,u,F)=>{let de={id:oe(),operation:t,status:r,response:u,error:F,timestamp:new Date().toLocaleTimeString()};q(it=>[de,...it].slice(0,20));},[]),Ye=react.useCallback(()=>{if(!l.trim()){c("Configuration","error",void 0,"API Key is required");return}W(true),U(false),c("Configuration","success",{environment:s,configured:true,apiBasePath:b});},[l,s,b,c]),Ze=react.useCallback(()=>{U(true),W(true),c("Configuration","success",{mode:"demo",message:"Demo mode activated - responses are simulated"});},[c]),qe=react.useCallback(async()=>{if(!(!l&&!g)){x("loading");try{let t=oe();j(t);let r;if(g)await G(),r=Dt(t);else {let u=await fetch(`${b}/deposit`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({apiKey:l,environment:s,amount:parseFloat(L),currency:D,provider:A,phoneNumber:N,customerMessage:_.slice(0,22),transactionId:t})}),F=await u.json();if(!u.ok)throw new Error(F.error||"Deposit failed");r=F;}x("success"),c("Deposit","success",r),T?.(r);}catch(t){x("error");let r=t instanceof Error?t.message:"Deposit failed";c("Deposit","error",void 0,r),p?.(t instanceof Error?t:new Error(r));}}},[l,b,s,g,L,D,A,N,_,c,T,p]),et=react.useCallback(async()=>{if(!(!l&&!g)){x("loading");try{let t=oe();j(t);let r;if(g)await G(),r=Mt(t);else {let u=await fetch(`${b}/payout`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({apiKey:l,environment:s,amount:parseFloat(L),currency:D,provider:A,phoneNumber:N,transactionId:t})}),F=await u.json();if(!u.ok)throw new Error(F.error||"Payout failed");r=F;}x("success"),c("Payout","success",r),P?.(r);}catch(t){x("error");let r=t instanceof Error?t.message:"Payout failed";c("Payout","error",void 0,r),p?.(t instanceof Error?t:new Error(r));}}},[l,b,s,g,L,D,A,N,c,P,p]),tt=react.useCallback(async()=>{if(!l&&!g||!k){c("Check Status","error",void 0,"No transaction ID");return}x("loading");try{let t;if(g)await G(),t=Pt(k);else {let r=await fetch(`${b}/status`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({apiKey:l,environment:s,transactionId:k})}),u=await r.json();if(!r.ok)throw new Error(u.error||"Status check failed");t=u;}x("success"),c("Check Status","success",t);}catch(t){x("error");let r=t instanceof Error?t.message:"Status check failed";c("Check Status","error",void 0,r),p?.(t instanceof Error?t:new Error(r));}},[l,b,s,g,k,c,p]),at=react.useCallback(async()=>{if(!(!l&&!g)){x("loading");try{let t;if(g)await G(),t=It();else {let r=await fetch(`${b}/availability`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({apiKey:l,environment:s})}),u=await r.json();if(!r.ok)throw new Error(u.error||"Availability check failed");t=u;}x("success"),c("Provider Availability","success",t);}catch(t){x("error");let r=t instanceof Error?t.message:"Availability check failed";c("Provider Availability","error",void 0,r),p?.(t instanceof Error?t:new Error(r));}}},[l,b,s,g,c,p]),ot=react.useCallback(async()=>{if(!(!l&&!g)){x("loading");try{let t;if(g)await G(),t=Ot(N);else {let r=await fetch(`${b}/predict-provider`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({apiKey:l,environment:s,phoneNumber:N})}),u=await r.json();if(!r.ok)throw new Error(u.error||"Prediction failed");t=u;}x("success"),c("Predict Provider","success",t);}catch(t){x("error");let r=t instanceof Error?t.message:"Prediction failed";c("Predict Provider","error",void 0,r),p?.(t instanceof Error?t:new Error(r));}}},[l,b,s,g,N,c,p]),st=react.useCallback(async()=>{if(!(!l&&!g)){x("loading");try{let t;if(g)await G(),t=At();else {let r=await fetch(`${b}/active-config`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({apiKey:l,environment:s})}),u=await r.json();if(!r.ok)throw new Error(u.error||"Failed to get config");t=u;}x("success"),c("Active Configuration","success",t);}catch(t){x("error");let r=t instanceof Error?t.message:"Failed to get config";c("Active Configuration","error",void 0,r),p?.(t instanceof Error?t:new Error(r));}}},[l,b,s,g,c,p]),rt=react.useCallback(async()=>{if(!(!l&&!g)){x("loading");try{let t;if(g)await G(),t=Lt();else {let r=await fetch(`${b}/public-keys`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({apiKey:l,environment:s})}),u=await r.json();if(!r.ok)throw new Error(u.error||"Failed to get public keys");t=u;}x("success"),c("Public Keys","success",t);}catch(t){x("error");let r=t instanceof Error?t.message:"Failed to get public keys";c("Public Keys","error",void 0,r),p?.(t instanceof Error?t:new Error(r));}}},[l,b,s,g,c,p]),nt=react.useCallback(async()=>{if(!(!l&&!g)){x("loading");try{let t;if(g)await G(),t=Rt();else {let r=await fetch(`${b}/wallet-balances`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({apiKey:l,environment:s})}),u=await r.json();if(!r.ok)throw new Error(u.error||"Failed to get balances");t=u;}x("success"),c("Wallet Balances","success",t);}catch(t){x("error");let r=t instanceof Error?t.message:"Failed to get balances";c("Wallet Balances","error",void 0,r),p?.(t instanceof Error?t:new Error(r));}}},[l,b,s,g,c,p]),ie=react.useCallback(t=>{navigator.clipboard.writeText(t);},[]);return J?jsxRuntime.jsxs("div",{className:`space-y-6 ${y}`,children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between flex-wrap gap-4",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("h1",{className:"text-2xl font-bold tracking-tight",children:"Spaark Pay Console"}),g?jsxRuntime.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"}):s==="production"?jsxRuntime.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"}):jsxRuntime.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"})]}),jsxRuntime.jsx("p",{className:"text-muted-foreground mt-1",children:g?"Mode d\xE9mo - Les r\xE9ponses sont simul\xE9es":s==="production"?"Mode production - Transactions r\xE9elles":"Mode sandbox - Environnement de test"})]}),jsxRuntime.jsxs("button",{onClick:()=>W(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:[jsxRuntime.jsx(me,{}),"Reconfigure"]})]}),jsxRuntime.jsxs("div",{className:"grid lg:grid-cols-3 gap-6",children:[jsxRuntime.jsxs("div",{className:"lg:col-span-2 space-y-6",children:[jsxRuntime.jsxs("div",{className:"flex flex-wrap gap-1 bg-muted p-1",children:[jsxRuntime.jsxs("button",{onClick:()=>S("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 ${w==="deposit"?"bg-background text-foreground":"text-muted-foreground hover:text-foreground"}`,children:[jsxRuntime.jsx(Le,{}),"Deposit"]}),jsxRuntime.jsxs("button",{onClick:()=>S("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 ${w==="payout"?"bg-background text-foreground":"text-muted-foreground hover:text-foreground"}`,children:[jsxRuntime.jsx(Wt,{}),"Payout"]}),jsxRuntime.jsxs("button",{onClick:()=>S("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 ${w==="status"?"bg-background text-foreground":"text-muted-foreground hover:text-foreground"}`,children:[jsxRuntime.jsx(Fe,{}),"Status"]}),jsxRuntime.jsxs("button",{onClick:()=>S("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 ${w==="toolkit"?"bg-background text-foreground":"text-muted-foreground hover:text-foreground"}`,children:[jsxRuntime.jsx(jt,{}),"Toolkit"]}),jsxRuntime.jsxs("button",{onClick:()=>S("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 ${w==="finances"?"bg-background text-foreground":"text-muted-foreground hover:text-foreground"}`,children:[jsxRuntime.jsx(Gt,{}),"Finances"]}),jsxRuntime.jsxs("button",{onClick:()=>S("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 ${w==="webhooks"?"bg-background text-foreground":"text-muted-foreground hover:text-foreground"}`,children:[jsxRuntime.jsx(Jt,{}),"Webhooks"]})]}),w==="deposit"&&jsxRuntime.jsxs("div",{className:"border border-border bg-background p-6 space-y-4",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:"font-semibold",children:"Initiate Deposit"}),jsxRuntime.jsx("p",{className:"text-xs text-muted-foreground",children:"Collect payment from a Mobile Money user"})]}),jsxRuntime.jsxs("div",{className:"grid sm:grid-cols-2 gap-4",children:[jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx("label",{className:"text-xs font-medium",children:"Phone Number"}),jsxRuntime.jsx("input",{placeholder:"237670000000",value:N,onChange:t=>B(t.target.value),className:"w-full h-8 px-2.5 text-xs border border-input bg-transparent rounded-none outline-none focus:border-ring"})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx("label",{className:"text-xs font-medium",children:"Amount"}),jsxRuntime.jsx("input",{type:"number",placeholder:"5000",value:L,onChange:t=>O(t.target.value),className:"w-full h-8 px-2.5 text-xs border border-input bg-transparent rounded-none outline-none focus:border-ring"})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx("label",{className:"text-xs font-medium",children:"Currency"}),jsxRuntime.jsx("select",{value:D,onChange:t=>Y(t.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:Re.map(t=>jsxRuntime.jsx("option",{value:t.value,children:t.label},t.value))})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx("label",{className:"text-xs font-medium",children:"Provider"}),jsxRuntime.jsx("select",{value:A,onChange:t=>Z(t.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:pe.map(t=>jsxRuntime.jsxs("option",{value:t.value,children:[t.label," (",t.country,")"]},t.value))})]}),jsxRuntime.jsxs("div",{className:"space-y-2 sm:col-span-2",children:[jsxRuntime.jsx("label",{className:"text-xs font-medium",children:"Customer Message (4-22 chars)"}),jsxRuntime.jsx("input",{placeholder:"Payment description",value:_,onChange:t=>i(t.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"})]})]}),jsxRuntime.jsxs("button",{onClick:qe,disabled:C==="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:[C==="loading"?jsxRuntime.jsx(Q,{}):jsxRuntime.jsx(se,{}),"Execute Deposit"]})]}),w==="payout"&&jsxRuntime.jsxs("div",{className:"border border-border bg-background p-6 space-y-4",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:"font-semibold",children:"Initiate Payout"}),jsxRuntime.jsx("p",{className:"text-xs text-muted-foreground",children:"Send money to a Mobile Money account"})]}),jsxRuntime.jsxs("div",{className:"grid sm:grid-cols-2 gap-4",children:[jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx("label",{className:"text-xs font-medium",children:"Recipient Phone"}),jsxRuntime.jsx("input",{placeholder:"237670000000",value:N,onChange:t=>B(t.target.value),className:"w-full h-8 px-2.5 text-xs border border-input bg-transparent rounded-none outline-none focus:border-ring"})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx("label",{className:"text-xs font-medium",children:"Amount"}),jsxRuntime.jsx("input",{type:"number",placeholder:"5000",value:L,onChange:t=>O(t.target.value),className:"w-full h-8 px-2.5 text-xs border border-input bg-transparent rounded-none outline-none focus:border-ring"})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx("label",{className:"text-xs font-medium",children:"Currency"}),jsxRuntime.jsx("select",{value:D,onChange:t=>Y(t.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:Re.map(t=>jsxRuntime.jsx("option",{value:t.value,children:t.label},t.value))})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx("label",{className:"text-xs font-medium",children:"Provider"}),jsxRuntime.jsx("select",{value:A,onChange:t=>Z(t.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:pe.map(t=>jsxRuntime.jsxs("option",{value:t.value,children:[t.label," (",t.country,")"]},t.value))})]})]}),jsxRuntime.jsxs("button",{onClick:et,disabled:C==="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:[C==="loading"?jsxRuntime.jsx(Q,{}):jsxRuntime.jsx(se,{}),"Execute Payout"]})]}),w==="status"&&jsxRuntime.jsxs("div",{className:"border border-border bg-background p-6 space-y-4",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:"font-semibold",children:"Check Transaction Status"}),jsxRuntime.jsx("p",{className:"text-xs text-muted-foreground",children:"Query the status of a transaction"})]}),jsxRuntime.jsxs("div",{className:"space-y-4",children:[jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx("label",{className:"text-xs font-medium",children:"Transaction ID"}),jsxRuntime.jsxs("div",{className:"flex gap-2",children:[jsxRuntime.jsx("input",{placeholder:"Enter transaction ID (UUID)",value:k,onChange:t=>j(t.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"}),k&&jsxRuntime.jsx("button",{onClick:()=>ie(k),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:jsxRuntime.jsx(We,{})})]})]}),jsxRuntime.jsxs("button",{onClick:tt,disabled:C==="loading"||!k,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:[C==="loading"?jsxRuntime.jsx(Q,{}):jsxRuntime.jsx(Fe,{}),"Check Status"]})]})]}),w==="toolkit"&&jsxRuntime.jsxs("div",{className:"space-y-4",children:[jsxRuntime.jsxs("div",{className:"border border-border bg-background p-6 space-y-4",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:"font-semibold",children:"Predict Provider"}),jsxRuntime.jsx("p",{className:"text-xs text-muted-foreground",children:"Predict the provider from a phone number"})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx("label",{className:"text-xs font-medium",children:"Phone Number"}),jsxRuntime.jsx("input",{placeholder:"+237 670 000 000",value:N,onChange:t=>B(t.target.value),className:"w-full h-8 px-2.5 text-xs border border-input bg-transparent rounded-none outline-none focus:border-ring"})]}),jsxRuntime.jsxs("button",{onClick:ot,disabled:C==="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:[C==="loading"?jsxRuntime.jsx(Q,{}):jsxRuntime.jsx(Ut,{}),"Predict Provider"]})]}),jsxRuntime.jsxs("div",{className:"grid sm:grid-cols-3 gap-3",children:[jsxRuntime.jsxs("button",{onClick:at,disabled:C==="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:[jsxRuntime.jsx(Vt,{}),"Provider Availability"]}),jsxRuntime.jsxs("button",{onClick:st,disabled:C==="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:[jsxRuntime.jsx(me,{}),"Active Config"]}),jsxRuntime.jsxs("button",{onClick:rt,disabled:C==="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:[jsxRuntime.jsx($t,{}),"Public Keys"]})]})]}),w==="finances"&&jsxRuntime.jsxs("div",{className:"space-y-4",children:[jsxRuntime.jsxs("div",{className:"border border-border bg-background p-6 space-y-4",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:"font-semibold",children:"Wallet Balances"}),jsxRuntime.jsx("p",{className:"text-xs text-muted-foreground",children:"View balances for all your wallets"})]}),jsxRuntime.jsxs("button",{onClick:nt,disabled:C==="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:[C==="loading"?jsxRuntime.jsx(Q,{}):jsxRuntime.jsx(Le,{}),"Get Wallet Balances"]})]}),jsxRuntime.jsxs("div",{className:"border border-border bg-background p-6 space-y-4",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:"font-semibold",children:"Statements"}),jsxRuntime.jsx("p",{className:"text-xs text-muted-foreground",children:"Generate financial statements for your wallets"})]}),jsxRuntime.jsxs("div",{className:"p-4 bg-muted/50 text-xs text-muted-foreground",children:["Statement generation requires callback URL configuration. Use the SDK directly:",jsxRuntime.jsx("pre",{className:"mt-2 p-2 bg-background overflow-x-auto",children:`await sdk.finances.generateStatement({
1
+ 'use strict';Object.defineProperty(exports,'__esModule',{value:true});var react=require('react'),lucideReact=require('lucide-react'),jsxRuntime=require('react/jsx-runtime');var z=()=>"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,s=>{let v=Math.random()*16|0;return (s==="x"?v:v&3|8).toString(16)});function ct(s,v={}){let{transactionId:y=z(),amount:E="5000",currency:f="XAF",correspondent:S="MTN_MOMO_CMR",phoneNumber:O="237670000000",status:g=s==="deposit.failed"?"FAILED":"COMPLETED",failureCode:c="INSUFFICIENT_FUNDS",failureMessage:R="The payer has insufficient funds"}=v,l=new Date().toISOString(),N={depositId:y,status:g,amount:E,currency:f,correspondent:S,payer:{type:"MSISDN",address:{value:O}},customerTimestamp:l,created:l};return g==="COMPLETED"&&(N.receivedByPayer=l),g==="FAILED"&&(N.failureReason={failureCode:c,failureMessage:R}),{eventId:z(),eventType:s,timestamp:l,data:N}}function ut(s,v={}){let{transactionId:y=z(),amount:E="5000",currency:f="XAF",correspondent:S="MTN_MOMO_CMR",phoneNumber:O="237670000000",status:g=s==="payout.failed"?"FAILED":"COMPLETED",failureCode:c="RECIPIENT_NOT_FOUND",failureMessage:R="The recipient account was not found"}=v,l=new Date().toISOString(),N={payoutId:y,status:g,amount:E,currency:f,correspondent:S,recipient:{type:"MSISDN",address:{value:O}},customerTimestamp:l,created:l};return g==="COMPLETED"&&(N.receivedByRecipient=l),g==="FAILED"&&(N.failureReason={failureCode:c,failureMessage:R}),{eventId:z(),eventType:s,timestamp:l,data:N}}function pt(s,v={}){let{transactionId:y=z(),depositId:E=z(),amount:f="5000",currency:S="XAF",correspondent:O="MTN_MOMO_CMR",phoneNumber:g="237670000000",status:c=s==="refund.failed"?"FAILED":"COMPLETED",failureCode:R="REFUND_LIMIT_EXCEEDED",failureMessage:l="The refund limit has been exceeded"}=v,N=new Date().toISOString(),i={refundId:y,depositId:E,status:c,amount:f,currency:S,correspondent:O,recipient:{type:"MSISDN",address:{value:g}},created:N};return c==="FAILED"&&(i.failureReason={failureCode:R,failureMessage:l}),{eventId:z(),eventType:s,timestamp:N,data:i}}function De(s,v={}){return s.startsWith("deposit.")?ct(s,v):s.startsWith("payout.")?ut(s,v):pt(s,v)}var Me=["deposit.accepted","deposit.completed","deposit.failed","payout.accepted","payout.completed","payout.failed","refund.completed","refund.failed"];var Tt={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 !"},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!"}},St={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"},Dt=({status:s})=>{switch(s){case "COMPLETED":return jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-3.5 h-3.5"});case "FAILED":case "REJECTED":return jsxRuntime.jsx(lucideReact.XCircle,{className:"w-3.5 h-3.5"});case "CANCELLED":return jsxRuntime.jsx(lucideReact.Ban,{className:"w-3.5 h-3.5"});case "PENDING":case "ENQUEUED":return jsxRuntime.jsx(lucideReact.Clock,{className:"w-3.5 h-3.5"});case "PROCESSING":case "ACCEPTED":return jsxRuntime.jsx(lucideReact.Loader2,{className:"w-3.5 h-3.5 animate-spin"});default:return jsxRuntime.jsx(lucideReact.AlertCircle,{className:"w-3.5 h-3.5"})}},Y=(s,v)=>new Intl.NumberFormat("fr-FR",{style:"decimal",minimumFractionDigits:0,maximumFractionDigits:0}).format(s)+" "+v,Mt=(s,v)=>{let y=new Date(s);return new Intl.DateTimeFormat(v==="fr"?"fr-FR":"en-US",{day:"2-digit",month:"short",year:"numeric",hour:"2-digit",minute:"2-digit"}).format(y)},be=10;function Pt({transactions:s,title:v,subtitle:y,locale:E="fr",className:f="",showExpertMode:S=true,onExpertModeClick:O,onTransactionClick:g,onRefresh:c,onAddTransaction:R,onSettings:l,isLoading:N=false}){let i=Tt[E],[F,x]=react.useState(""),[$,C]=react.useState("all"),[A,D]=react.useState("all"),[W,M]=react.useState(1),[q,_]=react.useState(null),w=react.useMemo(()=>{let n=s.filter(p=>p.type==="deposit"),L=s.filter(p=>p.type==="payout"),J=s.filter(p=>p.type==="refund"),k=s.filter(p=>p.status==="FAILED"||p.status==="REJECTED"),h=s.filter(p=>["PENDING","ENQUEUED","PROCESSING","ACCEPTED"].includes(p.status)),te=s.filter(p=>p.status==="COMPLETED"),ie=s.filter(p=>p.status==="CANCELLED"),K=s.filter(p=>p.status==="COMPLETED").reduce((p,j)=>p+j.amount,0),ae=n.filter(p=>p.status==="COMPLETED").reduce((p,j)=>p+j.amount,0),B=L.filter(p=>p.status==="COMPLETED").reduce((p,j)=>p+j.amount,0),de=J.filter(p=>p.status==="COMPLETED").reduce((p,j)=>p+j.amount,0);return {totalVolume:K,depositsCount:n.length,depositsTotal:ae,payoutsCount:L.length,payoutsTotal:B,failedCount:k.length,refundsCount:J.length,refundsTotal:de,pendingCount:h.length,completedCount:te.length,cancelledCount:ie.length}},[s]),P=react.useMemo(()=>s.filter(n=>{let L=F===""||n.id.toLowerCase().includes(F.toLowerCase())||n.phoneNumber.includes(F),J=$==="all"||n.type===$,k=A==="all"||n.status===A;return L&&J&&k}),[s,F,$,A]),ee=react.useMemo(()=>{let n=(W-1)*be;return P.slice(n,n+be)},[P,W]),U=Math.ceil(P.length/be),ne=react.useCallback(n=>{navigator.clipboard.writeText(n),_(n),setTimeout(()=>_(null),2e3);},[]),T=s[0]?.currency||"XAF";return jsxRuntime.jsxs("div",{className:`space-y-6 ${f}`,children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between flex-wrap gap-4",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h1",{className:"text-2xl font-bold tracking-tight",children:v||i.title}),jsxRuntime.jsx("p",{className:"text-muted-foreground mt-1",children:y||i.subtitle})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[c&&jsxRuntime.jsxs("button",{onClick:c,disabled:N,className:"h-9 px-4 text-sm font-medium rounded-md border border-input bg-background hover:bg-accent hover:text-accent-foreground disabled:opacity-50 transition-colors inline-flex items-center gap-2",children:[jsxRuntime.jsx(lucideReact.RefreshCw,{className:`w-4 h-4 ${N?"animate-spin":""}`}),i.refresh]}),l&&jsxRuntime.jsx("button",{onClick:l,className:"h-9 w-9 rounded-md border border-input bg-background hover:bg-accent hover:text-accent-foreground transition-colors inline-flex items-center justify-center",title:i.settings,children:jsxRuntime.jsx(lucideReact.Settings,{className:"w-4 h-4"})}),S&&O&&jsxRuntime.jsx("button",{onClick:O,className:"h-9 px-4 text-sm font-medium rounded-md bg-primary text-primary-foreground hover:bg-primary/90 transition-colors inline-flex items-center gap-2",children:i.expertMode})]})]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:[jsxRuntime.jsxs("div",{className:"rounded-lg border border-border bg-card p-4 space-y-3",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("div",{className:"p-2 rounded-md bg-primary/10",children:jsxRuntime.jsx(lucideReact.TrendingUp,{className:"w-4 h-4 text-primary"})}),jsxRuntime.jsx("span",{className:"text-sm font-medium text-muted-foreground",children:i.totalVolume})]}),jsxRuntime.jsx("p",{className:"text-2xl font-bold",children:Y(w.totalVolume,T)}),jsxRuntime.jsxs("p",{className:"text-xs text-muted-foreground",children:[s.length," ",i.transactions]})]}),jsxRuntime.jsxs("div",{className:"rounded-lg border border-border bg-card p-4 space-y-3",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("div",{className:"p-2 rounded-md bg-green-500/10",children:jsxRuntime.jsx(lucideReact.ArrowDownCircle,{className:"w-4 h-4 text-green-600 dark:text-green-400"})}),jsxRuntime.jsx("span",{className:"text-sm font-medium text-muted-foreground",children:i.deposits})]}),jsxRuntime.jsx("p",{className:"text-2xl font-bold",children:Y(w.depositsTotal,T)}),jsxRuntime.jsxs("p",{className:"text-xs text-muted-foreground",children:[w.depositsCount," ",i.transactions]})]}),jsxRuntime.jsxs("div",{className:"rounded-lg border border-border bg-card p-4 space-y-3",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("div",{className:"p-2 rounded-md bg-blue-500/10",children:jsxRuntime.jsx(lucideReact.ArrowUpCircle,{className:"w-4 h-4 text-blue-600 dark:text-blue-400"})}),jsxRuntime.jsx("span",{className:"text-sm font-medium text-muted-foreground",children:i.payouts})]}),jsxRuntime.jsx("p",{className:"text-2xl font-bold",children:Y(w.payoutsTotal,T)}),jsxRuntime.jsxs("p",{className:"text-xs text-muted-foreground",children:[w.payoutsCount," ",i.transactions]})]}),jsxRuntime.jsxs("div",{className:"rounded-lg border border-border bg-card p-4 space-y-3",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("div",{className:"p-2 rounded-md bg-orange-500/10",children:jsxRuntime.jsx(lucideReact.RefreshCw,{className:"w-4 h-4 text-orange-600 dark:text-orange-400"})}),jsxRuntime.jsx("span",{className:"text-sm font-medium text-muted-foreground",children:i.refunds})]}),jsxRuntime.jsx("p",{className:"text-2xl font-bold",children:Y(w.refundsTotal,T)}),jsxRuntime.jsxs("p",{className:"text-xs text-muted-foreground",children:[w.refundsCount," ",i.transactions]})]}),jsxRuntime.jsxs("div",{className:"rounded-lg border border-border bg-card p-4 space-y-3",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("div",{className:"p-2 rounded-md bg-yellow-500/10",children:jsxRuntime.jsx(lucideReact.Hourglass,{className:"w-4 h-4 text-yellow-600 dark:text-yellow-400"})}),jsxRuntime.jsx("span",{className:"text-sm font-medium text-muted-foreground",children:i.pending})]}),jsxRuntime.jsx("p",{className:"text-2xl font-bold",children:w.pendingCount}),jsxRuntime.jsx("p",{className:"text-xs text-muted-foreground",children:i.transactions})]}),jsxRuntime.jsxs("div",{className:"rounded-lg border border-border bg-card p-4 space-y-3",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("div",{className:"p-2 rounded-md bg-green-500/10",children:jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-4 h-4 text-green-600 dark:text-green-400"})}),jsxRuntime.jsx("span",{className:"text-sm font-medium text-muted-foreground",children:i.completed})]}),jsxRuntime.jsx("p",{className:"text-2xl font-bold",children:w.completedCount}),jsxRuntime.jsx("p",{className:"text-xs text-muted-foreground",children:i.transactions})]}),jsxRuntime.jsxs("div",{className:"rounded-lg border border-border bg-card p-4 space-y-3",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("div",{className:"p-2 rounded-md bg-red-500/10",children:jsxRuntime.jsx(lucideReact.XCircle,{className:"w-4 h-4 text-red-600 dark:text-red-400"})}),jsxRuntime.jsx("span",{className:"text-sm font-medium text-muted-foreground",children:i.failed})]}),jsxRuntime.jsx("p",{className:"text-2xl font-bold",children:w.failedCount}),jsxRuntime.jsx("p",{className:"text-xs text-muted-foreground",children:i.transactions})]}),jsxRuntime.jsxs("div",{className:"rounded-lg border border-border bg-card p-4 space-y-3",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("div",{className:"p-2 rounded-md bg-gray-500/10",children:jsxRuntime.jsx(lucideReact.Ban,{className:"w-4 h-4 text-gray-600 dark:text-gray-400"})}),jsxRuntime.jsx("span",{className:"text-sm font-medium text-muted-foreground",children:i.cancelled})]}),jsxRuntime.jsx("p",{className:"text-2xl font-bold",children:w.cancelledCount}),jsxRuntime.jsx("p",{className:"text-xs text-muted-foreground",children:i.transactions})]})]}),jsxRuntime.jsxs("div",{className:"flex flex-wrap gap-3",children:[jsxRuntime.jsxs("div",{className:"relative flex-1 min-w-[200px]",children:[jsxRuntime.jsx(lucideReact.Search,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground pointer-events-none"}),jsxRuntime.jsx("input",{type:"text",placeholder:i.search,value:F,onChange:n=>{x(n.target.value),M(1);},className:"w-full h-9 pl-9 pr-3 text-sm rounded-md border border-input bg-background outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2"})]}),jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsxs("select",{value:$,onChange:n=>{C(n.target.value),M(1);},className:"h-9 pl-3 pr-9 text-sm rounded-md border border-input bg-background outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 appearance-none cursor-pointer",children:[jsxRuntime.jsx("option",{value:"all",children:i.allTypes}),jsxRuntime.jsx("option",{value:"deposit",children:i.deposit}),jsxRuntime.jsx("option",{value:"payout",children:i.payout}),jsxRuntime.jsx("option",{value:"refund",children:i.refund})]}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"absolute right-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground pointer-events-none"})]}),jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsxs("select",{value:A,onChange:n=>{D(n.target.value),M(1);},className:"h-9 pl-3 pr-9 text-sm rounded-md border border-input bg-background outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 appearance-none cursor-pointer",children:[jsxRuntime.jsx("option",{value:"all",children:i.allStatuses}),jsxRuntime.jsx("option",{value:"COMPLETED",children:"COMPLETED"}),jsxRuntime.jsx("option",{value:"PENDING",children:"PENDING"}),jsxRuntime.jsx("option",{value:"PROCESSING",children:"PROCESSING"}),jsxRuntime.jsx("option",{value:"ACCEPTED",children:"ACCEPTED"}),jsxRuntime.jsx("option",{value:"FAILED",children:"FAILED"}),jsxRuntime.jsx("option",{value:"CANCELLED",children:"CANCELLED"}),jsxRuntime.jsx("option",{value:"REJECTED",children:"REJECTED"})]}),jsxRuntime.jsx(lucideReact.ChevronDown,{className:"absolute right-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground pointer-events-none"})]})]}),jsxRuntime.jsx("div",{className:"rounded-lg border border-border bg-card overflow-hidden",children:N?jsxRuntime.jsx("div",{className:"p-12 text-center",children:jsxRuntime.jsx(lucideReact.Loader2,{className:"w-8 h-8 animate-spin mx-auto text-muted-foreground"})}):P.length===0?jsxRuntime.jsxs("div",{className:"p-12 text-center",children:[jsxRuntime.jsx("div",{className:"w-16 h-16 rounded-full bg-muted mx-auto mb-4 flex items-center justify-center",children:jsxRuntime.jsx(lucideReact.CircleDot,{className:"w-8 h-8 text-muted-foreground"})}),jsxRuntime.jsx("p",{className:"font-semibold text-lg",children:i.noTransactions}),jsxRuntime.jsx("p",{className:"text-sm text-muted-foreground mt-1 mb-6",children:i.noTransactionsDesc}),R&&jsxRuntime.jsxs("button",{onClick:R,className:"h-10 px-6 text-sm font-medium rounded-md bg-primary text-primary-foreground hover:bg-primary/90 transition-colors inline-flex items-center gap-2",children:[jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),i.addTransaction]})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"overflow-x-auto",children:jsxRuntime.jsxs("table",{className:"w-full text-sm",children:[jsxRuntime.jsx("thead",{className:"bg-muted/50 border-b border-border",children:jsxRuntime.jsxs("tr",{children:[jsxRuntime.jsx("th",{className:"text-left p-3 font-medium text-muted-foreground",children:i.id}),jsxRuntime.jsx("th",{className:"text-left p-3 font-medium text-muted-foreground",children:i.type}),jsxRuntime.jsx("th",{className:"text-left p-3 font-medium text-muted-foreground",children:i.amount}),jsxRuntime.jsx("th",{className:"text-left p-3 font-medium text-muted-foreground",children:i.status}),jsxRuntime.jsx("th",{className:"text-left p-3 font-medium text-muted-foreground",children:i.provider}),jsxRuntime.jsx("th",{className:"text-left p-3 font-medium text-muted-foreground",children:i.phone}),jsxRuntime.jsx("th",{className:"text-left p-3 font-medium text-muted-foreground",children:i.date})]})}),jsxRuntime.jsx("tbody",{className:"divide-y divide-border",children:ee.map(n=>jsxRuntime.jsxs("tr",{className:`hover:bg-muted/50 transition-colors ${g?"cursor-pointer":""}`,onClick:()=>g?.(n),children:[jsxRuntime.jsx("td",{className:"p-3",children:jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsxs("span",{className:"font-mono text-xs truncate max-w-[100px]",title:n.id,children:[n.id.slice(0,8),"..."]}),jsxRuntime.jsx("button",{onClick:L=>{L.stopPropagation(),ne(n.id);},className:"p-1 hover:bg-muted rounded transition-colors",title:"Copy ID",children:q===n.id?jsxRuntime.jsx(lucideReact.Check,{className:"w-3.5 h-3.5 text-green-600"}):jsxRuntime.jsx(lucideReact.Copy,{className:"w-3.5 h-3.5 text-muted-foreground"})})]})}),jsxRuntime.jsx("td",{className:"p-3",children:jsxRuntime.jsxs("span",{className:`inline-flex items-center gap-1.5 px-2.5 py-1 text-xs font-medium rounded-full ${n.type==="deposit"?"bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200":n.type==="payout"?"bg-blue-100 text-blue-800 dark:bg-blue-900 dark:text-blue-200":"bg-orange-100 text-orange-800 dark:bg-orange-900 dark:text-orange-200"}`,children:[n.type==="deposit"&&jsxRuntime.jsx(lucideReact.ArrowDownCircle,{className:"w-3 h-3"}),n.type==="payout"&&jsxRuntime.jsx(lucideReact.ArrowUpCircle,{className:"w-3 h-3"}),n.type==="refund"&&jsxRuntime.jsx(lucideReact.RefreshCw,{className:"w-3 h-3"}),i[n.type]]})}),jsxRuntime.jsx("td",{className:"p-3 font-semibold",children:Y(n.amount,n.currency)}),jsxRuntime.jsx("td",{className:"p-3",children:jsxRuntime.jsxs("span",{className:`inline-flex items-center gap-1.5 px-2.5 py-1 text-xs font-medium rounded-full ${St[n.status]}`,children:[jsxRuntime.jsx(Dt,{status:n.status}),n.status]})}),jsxRuntime.jsx("td",{className:"p-3 text-muted-foreground",children:n.provider.replace(/_/g," ")}),jsxRuntime.jsx("td",{className:"p-3 font-mono text-muted-foreground",children:n.phoneNumber}),jsxRuntime.jsx("td",{className:"p-3 text-muted-foreground",children:Mt(n.createdAt,E)})]},n.id))})]})}),U>1&&jsxRuntime.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-t border-border",children:[jsxRuntime.jsxs("p",{className:"text-sm text-muted-foreground",children:[P.length," ",i.transactions]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("button",{onClick:()=>M(n=>Math.max(1,n-1)),disabled:W===1,className:"w-9 h-9 flex items-center justify-center rounded-md border border-input hover:bg-accent disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:jsxRuntime.jsx(lucideReact.ChevronLeft,{className:"w-4 h-4"})}),jsxRuntime.jsxs("span",{className:"text-sm px-2",children:[i.page," ",W," ",i.of," ",U]}),jsxRuntime.jsx("button",{onClick:()=>M(n=>Math.min(U,n+1)),disabled:W===U,className:"w-9 h-9 flex items-center justify-center rounded-md border border-input hover:bg-accent disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-4 h-4"})})]})]})]})})]})}var Ot=s=>({depositId:s,status:"ACCEPTED",created:new Date().toISOString(),nextStep:"FINAL_STATUS"}),At=s=>({payoutId:s,status:"ACCEPTED",created:new Date().toISOString()}),Rt=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"}}}),Lt=()=>[{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"}]}]}],Ft=s=>({country:"CMR",provider:s.startsWith("23767")?"MTN_MOMO_CMR":"ORANGE_CMR",phoneNumber:s.replace(/\D/g,"")}),Wt=()=>({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"}}}]}]}]}),_t=()=>({balances:[{country:"CMR",currency:"XAF",balance:"1250000.00"},{country:"COG",currency:"XAF",balance:"450000.00"},{country:"GAB",currency:"XAF",balance:"780000.00"}]}),jt=()=>[{id:"key-001",key:"MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA..."}],V=(s=800)=>new Promise(v=>setTimeout(v,s+Math.random()*400));async function We(s,v){let y=new TextEncoder,E=await crypto.subtle.importKey("raw",y.encode(v),{name:"HMAC",hash:"SHA-256"},false,["sign"]),f=await crypto.subtle.sign("HMAC",E,y.encode(s));return Array.from(new Uint8Array(f)).map(S=>S.toString(16).padStart(2,"0")).join("")}var se=()=>"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,s=>{let v=Math.random()*16|0;return (s==="x"?v:v&3|8).toString(16)}),fe=[{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"}],_e=[{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 Gt({apiKey:s="",environment:v="sandbox",className:y="",demoMode:E=false,apiBasePath:f="/api/pawapay",onDepositComplete:S,onPayoutComplete:O,onError:g}){let[c,R]=react.useState(s),[l,N]=react.useState(v),[i,F]=react.useState(!!s||E),[x,$]=react.useState(E),[C,A]=react.useState("deposit"),[D,W]=react.useState("237670000000"),[M,q]=react.useState("5000"),[_,w]=react.useState("XAF"),[P,ee]=react.useState("MTN_MOMO_CMR"),[U,ne]=react.useState("Test Payment"),[T,n]=react.useState(""),[L,J]=react.useState([]),[k,h]=react.useState("idle"),[te,ie]=react.useState("whsec_test_secret_key"),[K,ae]=react.useState([]),[B,de]=react.useState("deposit.completed"),[p,j]=react.useState("5000"),[ve,Je]=react.useState("237670000000"),[he,ze]=react.useState("MTN_MOMO_CMR"),[le,Be]=react.useState(""),[ye,He]=react.useState(""),[Ne,Ke]=react.useState(""),[ce,Xe]=react.useState(""),[ke,Qe]=react.useState(""),[oe,Ce]=react.useState(null),[we,Ye]=react.useState(""),[H,Ee]=react.useState(null),[Te,Se]=react.useState(""),[X,Ze]=react.useState("all"),u=react.useCallback((t,r,m,G)=>{let pe={id:se(),operation:t,status:r,response:m,error:G,timestamp:new Date().toLocaleTimeString()};J(lt=>[pe,...lt].slice(0,20));},[]),qe=react.useCallback(()=>{if(!c.trim()){u("Configuration","error",void 0,"API Key is required");return}F(true),$(false),u("Configuration","success",{environment:l,configured:true,apiBasePath:f});},[c,l,f,u]),et=react.useCallback(()=>{$(true),F(true),u("Configuration","success",{mode:"demo",message:"Demo mode activated - responses are simulated"});},[u]),tt=react.useCallback(async()=>{if(!(!c&&!x)){h("loading");try{let t=se();n(t);let r;if(x)await V(),r=Ot(t);else {let m=await fetch(`${f}/deposit`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({apiKey:c,environment:l,amount:parseFloat(M),currency:_,provider:P,phoneNumber:D,customerMessage:U.slice(0,22),transactionId:t})}),G=await m.json();if(!m.ok)throw new Error(G.error||"Deposit failed");r=G;}h("success"),u("Deposit","success",r),S?.(r);}catch(t){h("error");let r=t instanceof Error?t.message:"Deposit failed";u("Deposit","error",void 0,r),g?.(t instanceof Error?t:new Error(r));}}},[c,f,l,x,M,_,P,D,U,u,S,g]),at=react.useCallback(async()=>{if(!(!c&&!x)){h("loading");try{let t=se();n(t);let r;if(x)await V(),r=At(t);else {let m=await fetch(`${f}/payout`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({apiKey:c,environment:l,amount:parseFloat(M),currency:_,provider:P,phoneNumber:D,transactionId:t})}),G=await m.json();if(!m.ok)throw new Error(G.error||"Payout failed");r=G;}h("success"),u("Payout","success",r),O?.(r);}catch(t){h("error");let r=t instanceof Error?t.message:"Payout failed";u("Payout","error",void 0,r),g?.(t instanceof Error?t:new Error(r));}}},[c,f,l,x,M,_,P,D,u,O,g]),ot=react.useCallback(async()=>{if(!c&&!x||!T){u("Check Status","error",void 0,"No transaction ID");return}h("loading");try{let t;if(x)await V(),t=Rt(T);else {let r=await fetch(`${f}/status`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({apiKey:c,environment:l,transactionId:T})}),m=await r.json();if(!r.ok)throw new Error(m.error||"Status check failed");t=m;}h("success"),u("Check Status","success",t);}catch(t){h("error");let r=t instanceof Error?t.message:"Status check failed";u("Check Status","error",void 0,r),g?.(t instanceof Error?t:new Error(r));}},[c,f,l,x,T,u,g]),st=react.useCallback(async()=>{if(!(!c&&!x)){h("loading");try{let t;if(x)await V(),t=Lt();else {let r=await fetch(`${f}/availability`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({apiKey:c,environment:l})}),m=await r.json();if(!r.ok)throw new Error(m.error||"Availability check failed");t=m;}h("success"),u("Provider Availability","success",t);}catch(t){h("error");let r=t instanceof Error?t.message:"Availability check failed";u("Provider Availability","error",void 0,r),g?.(t instanceof Error?t:new Error(r));}}},[c,f,l,x,u,g]),rt=react.useCallback(async()=>{if(!(!c&&!x)){h("loading");try{let t;if(x)await V(),t=Ft(D);else {let r=await fetch(`${f}/predict-provider`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({apiKey:c,environment:l,phoneNumber:D})}),m=await r.json();if(!r.ok)throw new Error(m.error||"Prediction failed");t=m;}h("success"),u("Predict Provider","success",t);}catch(t){h("error");let r=t instanceof Error?t.message:"Prediction failed";u("Predict Provider","error",void 0,r),g?.(t instanceof Error?t:new Error(r));}}},[c,f,l,x,D,u,g]),nt=react.useCallback(async()=>{if(!(!c&&!x)){h("loading");try{let t;if(x)await V(),t=Wt();else {let r=await fetch(`${f}/active-config`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({apiKey:c,environment:l})}),m=await r.json();if(!r.ok)throw new Error(m.error||"Failed to get config");t=m;}h("success"),u("Active Configuration","success",t);}catch(t){h("error");let r=t instanceof Error?t.message:"Failed to get config";u("Active Configuration","error",void 0,r),g?.(t instanceof Error?t:new Error(r));}}},[c,f,l,x,u,g]),it=react.useCallback(async()=>{if(!(!c&&!x)){h("loading");try{let t;if(x)await V(),t=jt();else {let r=await fetch(`${f}/public-keys`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({apiKey:c,environment:l})}),m=await r.json();if(!r.ok)throw new Error(m.error||"Failed to get public keys");t=m;}h("success"),u("Public Keys","success",t);}catch(t){h("error");let r=t instanceof Error?t.message:"Failed to get public keys";u("Public Keys","error",void 0,r),g?.(t instanceof Error?t:new Error(r));}}},[c,f,l,x,u,g]),dt=react.useCallback(async()=>{if(!(!c&&!x)){h("loading");try{let t;if(x)await V(),t=_t();else {let r=await fetch(`${f}/wallet-balances`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({apiKey:c,environment:l})}),m=await r.json();if(!r.ok)throw new Error(m.error||"Failed to get balances");t=m;}h("success"),u("Wallet Balances","success",t);}catch(t){h("error");let r=t instanceof Error?t.message:"Failed to get balances";u("Wallet Balances","error",void 0,r),g?.(t instanceof Error?t:new Error(r));}}},[c,f,l,x,u,g]),ue=react.useCallback(t=>{navigator.clipboard.writeText(t);},[]);return i?jsxRuntime.jsxs("div",{className:`space-y-6 ${y}`,children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between flex-wrap gap-4",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("h1",{className:"text-2xl font-bold tracking-tight",children:"Spaark Pay Console"}),x?jsxRuntime.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"}):l==="production"?jsxRuntime.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"}):jsxRuntime.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"})]}),jsxRuntime.jsx("p",{className:"text-muted-foreground mt-1",children:x?"Mode d\xE9mo - Les r\xE9ponses sont simul\xE9es":l==="production"?"Mode production - Transactions r\xE9elles":"Mode sandbox - Environnement de test"})]}),jsxRuntime.jsxs("button",{onClick:()=>F(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:[jsxRuntime.jsx(xe,{}),"Reconfigure"]})]}),jsxRuntime.jsxs("div",{className:"grid lg:grid-cols-3 gap-6",children:[jsxRuntime.jsxs("div",{className:"lg:col-span-2 space-y-6",children:[jsxRuntime.jsxs("div",{className:"flex flex-wrap gap-1 bg-muted p-1",children:[jsxRuntime.jsxs("button",{onClick:()=>A("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 ${C==="deposit"?"bg-background text-foreground":"text-muted-foreground hover:text-foreground"}`,children:[jsxRuntime.jsx(je,{}),"Deposit"]}),jsxRuntime.jsxs("button",{onClick:()=>A("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 ${C==="payout"?"bg-background text-foreground":"text-muted-foreground hover:text-foreground"}`,children:[jsxRuntime.jsx(Ut,{}),"Payout"]}),jsxRuntime.jsxs("button",{onClick:()=>A("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 ${C==="status"?"bg-background text-foreground":"text-muted-foreground hover:text-foreground"}`,children:[jsxRuntime.jsx(Ge,{}),"Status"]}),jsxRuntime.jsxs("button",{onClick:()=>A("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 ${C==="toolkit"?"bg-background text-foreground":"text-muted-foreground hover:text-foreground"}`,children:[jsxRuntime.jsx($t,{}),"Toolkit"]}),jsxRuntime.jsxs("button",{onClick:()=>A("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 ${C==="finances"?"bg-background text-foreground":"text-muted-foreground hover:text-foreground"}`,children:[jsxRuntime.jsx(Jt,{}),"Finances"]}),jsxRuntime.jsxs("button",{onClick:()=>A("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 ${C==="webhooks"?"bg-background text-foreground":"text-muted-foreground hover:text-foreground"}`,children:[jsxRuntime.jsx(Kt,{}),"Webhooks"]})]}),C==="deposit"&&jsxRuntime.jsxs("div",{className:"border border-border bg-background p-6 space-y-4",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:"font-semibold",children:"Initiate Deposit"}),jsxRuntime.jsx("p",{className:"text-xs text-muted-foreground",children:"Collect payment from a Mobile Money user"})]}),jsxRuntime.jsxs("div",{className:"grid sm:grid-cols-2 gap-4",children:[jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx("label",{className:"text-xs font-medium",children:"Phone Number"}),jsxRuntime.jsx("input",{placeholder:"237670000000",value:D,onChange:t=>W(t.target.value),className:"w-full h-8 px-2.5 text-xs border border-input bg-transparent rounded-none outline-none focus:border-ring"})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx("label",{className:"text-xs font-medium",children:"Amount"}),jsxRuntime.jsx("input",{type:"number",placeholder:"5000",value:M,onChange:t=>q(t.target.value),className:"w-full h-8 px-2.5 text-xs border border-input bg-transparent rounded-none outline-none focus:border-ring"})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx("label",{className:"text-xs font-medium",children:"Currency"}),jsxRuntime.jsx("select",{value:_,onChange:t=>w(t.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(t=>jsxRuntime.jsx("option",{value:t.value,children:t.label},t.value))})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx("label",{className:"text-xs font-medium",children:"Provider"}),jsxRuntime.jsx("select",{value:P,onChange:t=>ee(t.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:fe.map(t=>jsxRuntime.jsxs("option",{value:t.value,children:[t.label," (",t.country,")"]},t.value))})]}),jsxRuntime.jsxs("div",{className:"space-y-2 sm:col-span-2",children:[jsxRuntime.jsx("label",{className:"text-xs font-medium",children:"Customer Message (4-22 chars)"}),jsxRuntime.jsx("input",{placeholder:"Payment description",value:U,onChange:t=>ne(t.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"})]})]}),jsxRuntime.jsxs("button",{onClick:tt,disabled:k==="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:[k==="loading"?jsxRuntime.jsx(Z,{}):jsxRuntime.jsx(re,{}),"Execute Deposit"]})]}),C==="payout"&&jsxRuntime.jsxs("div",{className:"border border-border bg-background p-6 space-y-4",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:"font-semibold",children:"Initiate Payout"}),jsxRuntime.jsx("p",{className:"text-xs text-muted-foreground",children:"Send money to a Mobile Money account"})]}),jsxRuntime.jsxs("div",{className:"grid sm:grid-cols-2 gap-4",children:[jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx("label",{className:"text-xs font-medium",children:"Recipient Phone"}),jsxRuntime.jsx("input",{placeholder:"237670000000",value:D,onChange:t=>W(t.target.value),className:"w-full h-8 px-2.5 text-xs border border-input bg-transparent rounded-none outline-none focus:border-ring"})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx("label",{className:"text-xs font-medium",children:"Amount"}),jsxRuntime.jsx("input",{type:"number",placeholder:"5000",value:M,onChange:t=>q(t.target.value),className:"w-full h-8 px-2.5 text-xs border border-input bg-transparent rounded-none outline-none focus:border-ring"})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx("label",{className:"text-xs font-medium",children:"Currency"}),jsxRuntime.jsx("select",{value:_,onChange:t=>w(t.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(t=>jsxRuntime.jsx("option",{value:t.value,children:t.label},t.value))})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx("label",{className:"text-xs font-medium",children:"Provider"}),jsxRuntime.jsx("select",{value:P,onChange:t=>ee(t.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:fe.map(t=>jsxRuntime.jsxs("option",{value:t.value,children:[t.label," (",t.country,")"]},t.value))})]})]}),jsxRuntime.jsxs("button",{onClick:at,disabled:k==="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:[k==="loading"?jsxRuntime.jsx(Z,{}):jsxRuntime.jsx(re,{}),"Execute Payout"]})]}),C==="status"&&jsxRuntime.jsxs("div",{className:"border border-border bg-background p-6 space-y-4",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:"font-semibold",children:"Check Transaction Status"}),jsxRuntime.jsx("p",{className:"text-xs text-muted-foreground",children:"Query the status of a transaction"})]}),jsxRuntime.jsxs("div",{className:"space-y-4",children:[jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx("label",{className:"text-xs font-medium",children:"Transaction ID"}),jsxRuntime.jsxs("div",{className:"flex gap-2",children:[jsxRuntime.jsx("input",{placeholder:"Enter transaction ID (UUID)",value:T,onChange:t=>n(t.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"}),T&&jsxRuntime.jsx("button",{onClick:()=>ue(T),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:jsxRuntime.jsx(Ue,{})})]})]}),jsxRuntime.jsxs("button",{onClick:ot,disabled:k==="loading"||!T,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:[k==="loading"?jsxRuntime.jsx(Z,{}):jsxRuntime.jsx(Ge,{}),"Check Status"]})]})]}),C==="toolkit"&&jsxRuntime.jsxs("div",{className:"space-y-4",children:[jsxRuntime.jsxs("div",{className:"border border-border bg-background p-6 space-y-4",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:"font-semibold",children:"Predict Provider"}),jsxRuntime.jsx("p",{className:"text-xs text-muted-foreground",children:"Predict the provider from a phone number"})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx("label",{className:"text-xs font-medium",children:"Phone Number"}),jsxRuntime.jsx("input",{placeholder:"+237 670 000 000",value:D,onChange:t=>W(t.target.value),className:"w-full h-8 px-2.5 text-xs border border-input bg-transparent rounded-none outline-none focus:border-ring"})]}),jsxRuntime.jsxs("button",{onClick:rt,disabled:k==="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:[k==="loading"?jsxRuntime.jsx(Z,{}):jsxRuntime.jsx(zt,{}),"Predict Provider"]})]}),jsxRuntime.jsxs("div",{className:"grid sm:grid-cols-3 gap-3",children:[jsxRuntime.jsxs("button",{onClick:st,disabled:k==="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:[jsxRuntime.jsx(Bt,{}),"Provider Availability"]}),jsxRuntime.jsxs("button",{onClick:nt,disabled:k==="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:[jsxRuntime.jsx(xe,{}),"Active Config"]}),jsxRuntime.jsxs("button",{onClick:it,disabled:k==="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:[jsxRuntime.jsx(Ht,{}),"Public Keys"]})]})]}),C==="finances"&&jsxRuntime.jsxs("div",{className:"space-y-4",children:[jsxRuntime.jsxs("div",{className:"border border-border bg-background p-6 space-y-4",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:"font-semibold",children:"Wallet Balances"}),jsxRuntime.jsx("p",{className:"text-xs text-muted-foreground",children:"View balances for all your wallets"})]}),jsxRuntime.jsxs("button",{onClick:dt,disabled:k==="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:[k==="loading"?jsxRuntime.jsx(Z,{}):jsxRuntime.jsx(je,{}),"Get Wallet Balances"]})]}),jsxRuntime.jsxs("div",{className:"border border-border bg-background p-6 space-y-4",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:"font-semibold",children:"Statements"}),jsxRuntime.jsx("p",{className:"text-xs text-muted-foreground",children:"Generate financial statements for your wallets"})]}),jsxRuntime.jsxs("div",{className:"p-4 bg-muted/50 text-xs text-muted-foreground",children:["Statement generation requires callback URL configuration. Use the SDK directly:",jsxRuntime.jsx("pre",{className:"mt-2 p-2 bg-background overflow-x-auto",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
- });`})]})]})]}),w==="webhooks"&&jsxRuntime.jsxs("div",{className:"space-y-4",children:[jsxRuntime.jsxs("div",{className:"border border-border bg-background p-6 space-y-4",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:"font-semibold",children:"Webhook Secret"}),jsxRuntime.jsx("p",{className:"text-xs text-muted-foreground",children:"Configure the secret used for signing webhooks"})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx("label",{className:"text-xs font-medium",children:"Secret Key"}),jsxRuntime.jsx("input",{type:"text",placeholder:"whsec_...",value:ee,onChange:t=>v(t.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"})]})]}),jsxRuntime.jsxs("div",{className:"border border-border bg-background p-6 space-y-4",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:"font-semibold",children:"Webhook Simulator"}),jsxRuntime.jsx("p",{className:"text-xs text-muted-foreground",children:"Generate mock webhook events for testing"})]}),jsxRuntime.jsxs("div",{className:"grid sm:grid-cols-2 gap-4",children:[jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx("label",{className:"text-xs font-medium",children:"Event Type"}),jsxRuntime.jsx("select",{value:te,onChange:t=>Ge(t.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:Se.map(t=>jsxRuntime.jsx("option",{value:t,children:t},t))})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx("label",{className:"text-xs font-medium",children:"Amount"}),jsxRuntime.jsx("input",{type:"number",placeholder:"5000",value:ge,onChange:t=>Ue(t.target.value),className:"w-full h-8 px-2.5 text-xs border border-input bg-transparent rounded-none outline-none focus:border-ring"})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx("label",{className:"text-xs font-medium",children:"Phone Number"}),jsxRuntime.jsx("input",{placeholder:"237670000000",value:fe,onChange:t=>Ve(t.target.value),className:"w-full h-8 px-2.5 text-xs border border-input bg-transparent rounded-none outline-none focus:border-ring"})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx("label",{className:"text-xs font-medium",children:"Provider"}),jsxRuntime.jsx("select",{value:xe,onChange:t=>$e(t.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:pe.map(t=>jsxRuntime.jsxs("option",{value:t.value,children:[t.label," (",t.country,")"]},t.value))})]})]}),jsxRuntime.jsxs("button",{onClick:async()=>{let t=Te(te,{amount:ge,phoneNumber:fe,correspondent:xe}),r=JSON.stringify(t,null,2),u=await Ae(JSON.stringify(t),ee);Je(r),ze(u);let F={id:oe(),eventType:te,payload:t,signature:u,receivedAt:new Date().toLocaleTimeString(),isVerified:null};be(de=>[F,...de].slice(0,50)),c("Generate Webhook","success",{eventType:te,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",children:[jsxRuntime.jsx(se,{}),"Generate Event"]}),re&&jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("label",{className:"text-xs font-medium",children:"Generated Payload"}),jsxRuntime.jsx("button",{onClick:()=>ie(re),className:"text-xs text-muted-foreground hover:text-foreground",children:"Copy"})]}),jsxRuntime.jsx("pre",{className:"text-xs bg-muted p-3 overflow-x-auto max-h-48",children:re}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("label",{className:"text-xs font-medium",children:"Signature:"}),jsxRuntime.jsx("code",{className:"text-xs bg-muted px-2 py-1 font-mono flex-1 overflow-x-auto",children:ve}),jsxRuntime.jsx("button",{onClick:()=>ie(ve),className:"w-8 h-8 border border-border bg-background hover:bg-muted transition-colors flex items-center justify-center",children:jsxRuntime.jsx(We,{})})]})]})]}),jsxRuntime.jsxs("div",{className:"border border-border bg-background p-6 space-y-4",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:"font-semibold",children:"Signature Verifier"}),jsxRuntime.jsx("p",{className:"text-xs text-muted-foreground",children:"Test webhook signature verification"})]}),jsxRuntime.jsxs("div",{className:"space-y-4",children:[jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx("label",{className:"text-xs font-medium",children:"Payload (JSON)"}),jsxRuntime.jsx("textarea",{placeholder:'{"eventId": "...", "eventType": "deposit.completed", ...}',value:he,onChange:t=>Be(t.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"})]}),jsxRuntime.jsxs("div",{className:"grid sm:grid-cols-2 gap-4",children:[jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx("label",{className:"text-xs font-medium",children:"Signature"}),jsxRuntime.jsx("input",{placeholder:"HMAC-SHA256 signature",value:ne,onChange:t=>He(t.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"})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx("label",{className:"text-xs font-medium",children:"Secret"}),jsxRuntime.jsx("input",{type:"password",placeholder:"whsec_...",value:ye,onChange:t=>Ke(t.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"})]})]}),jsxRuntime.jsxs("button",{onClick:async()=>{try{let t=JSON.parse(he),r=await Ae(JSON.stringify(t),ye),u=r===ne;Ne(u),c("Verify Signature",u?"success":"error",{isValid:u,expected:r,received:ne});}catch{Ne(false),c("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:[jsxRuntime.jsx(zt,{}),"Verify Signature"]}),ae!==null&&jsxRuntime.jsxs("div",{className:`p-3 text-xs flex items-center gap-2 ${ae?"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:[ae?jsxRuntime.jsx(_e,{className:"text-green-600"}):jsxRuntime.jsx(je,{className:"text-red-600"}),ae?"Signature is valid":"Signature is invalid"]})]})]}),jsxRuntime.jsxs("div",{className:"border border-border bg-background p-6 space-y-4",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:"font-semibold",children:"Event Parser"}),jsxRuntime.jsx("p",{className:"text-xs text-muted-foreground",children:"Parse and analyze raw webhook JSON"})]}),jsxRuntime.jsxs("div",{className:"space-y-4",children:[jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx("label",{className:"text-xs font-medium",children:"Raw JSON"}),jsxRuntime.jsx("textarea",{placeholder:"Paste webhook JSON here...",value:ke,onChange:t=>Xe(t.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"})]}),jsxRuntime.jsxs("button",{onClick:()=>{try{let t=JSON.parse(ke);Ce(t),Ee(""),c("Parse Event","success",{eventType:t.eventType,eventId:t.eventId});}catch(t){Ce(null),Ee(t instanceof Error?t.message:"Invalid JSON"),c("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:[jsxRuntime.jsx(Bt,{}),"Parse Event"]}),we&&jsxRuntime.jsx("div",{className:"p-3 text-xs bg-red-100 text-red-800 dark:bg-red-900 dark:text-red-200",children:we}),z&&jsxRuntime.jsxs("div",{className:"space-y-3",children:[jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-2 text-xs",children:[jsxRuntime.jsxs("div",{className:"p-2 bg-muted",children:[jsxRuntime.jsx("span",{className:"text-muted-foreground",children:"Event ID:"}),jsxRuntime.jsx("p",{className:"font-mono truncate",children:String(z.eventId??"N/A")})]}),jsxRuntime.jsxs("div",{className:"p-2 bg-muted",children:[jsxRuntime.jsx("span",{className:"text-muted-foreground",children:"Event Type:"}),jsxRuntime.jsx("p",{className:"font-medium",children:String(z.eventType??"N/A")})]}),jsxRuntime.jsxs("div",{className:"p-2 bg-muted",children:[jsxRuntime.jsx("span",{className:"text-muted-foreground",children:"Timestamp:"}),jsxRuntime.jsx("p",{className:"font-mono truncate",children:String(z.timestamp??"N/A")})]}),jsxRuntime.jsxs("div",{className:"p-2 bg-muted",children:[jsxRuntime.jsx("span",{className:"text-muted-foreground",children:"Status:"}),jsxRuntime.jsx("p",{className:"font-medium",children:String(z.data?.status??"N/A")})]})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx("label",{className:"text-xs font-medium",children:"Full Data"}),jsxRuntime.jsx("pre",{className:"text-xs bg-muted p-3 overflow-x-auto max-h-48",children:JSON.stringify(z,null,2)})]})]})]})]}),jsxRuntime.jsxs("div",{className:"border border-border bg-background p-6 space-y-4",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:"font-semibold",children:"Event Log"}),jsxRuntime.jsx("p",{className:"text-xs text-muted-foreground",children:"History of generated webhook events"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsxs("select",{value:H,onChange:t=>Qe(t.target.value),className:"h-8 px-2 text-xs border border-input bg-transparent rounded-none outline-none focus:border-ring",children:[jsxRuntime.jsx("option",{value:"all",children:"All"}),jsxRuntime.jsx("option",{value:"deposit",children:"Deposits"}),jsxRuntime.jsx("option",{value:"payout",children:"Payouts"}),jsxRuntime.jsx("option",{value:"refund",children:"Refunds"})]}),R.length>0&&jsxRuntime.jsx("button",{onClick:()=>be([]),className:"text-xs text-muted-foreground hover:text-foreground",children:"Clear"})]})]}),jsxRuntime.jsx("div",{className:"divide-y divide-border max-h-64 overflow-y-auto",children:R.filter(t=>H==="all"||t.eventType.startsWith(H)).length===0?jsxRuntime.jsx("div",{className:"p-4 text-center text-muted-foreground text-xs",children:"No events yet. Generate a webhook event to see it here."}):R.filter(t=>H==="all"||t.eventType.startsWith(H)).map(t=>jsxRuntime.jsxs("div",{className:"py-3 space-y-1",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("div",{className:"flex items-center gap-2",children:jsxRuntime.jsx("span",{className:`px-1.5 py-0.5 text-xs font-medium ${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})}),jsxRuntime.jsx("span",{className:"text-xs text-muted-foreground",children:t.receivedAt})]}),jsxRuntime.jsxs("div",{className:"text-xs text-muted-foreground font-mono truncate",children:["sig: ",t.signature.slice(0,32),"..."]})]},t.id))})]})]})]}),jsxRuntime.jsxs("div",{className:"space-y-4",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("h3",{className:"font-semibold",children:"Results"}),V.length>0&&jsxRuntime.jsx("button",{onClick:()=>q([]),className:"text-xs text-muted-foreground hover:text-foreground",children:"Clear"})]}),jsxRuntime.jsx("div",{className:"border border-border bg-background divide-y divide-border max-h-[600px] overflow-y-auto",children:V.length===0?jsxRuntime.jsx("div",{className:"p-6 text-center text-muted-foreground text-xs",children:"No results yet. Execute an operation to see results here."}):V.map(t=>jsxRuntime.jsxs("div",{className:"p-4 space-y-2",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[t.status==="success"?jsxRuntime.jsx(_e,{className:"text-green-600"}):jsxRuntime.jsx(je,{className:"text-red-600"}),jsxRuntime.jsx("span",{className:"font-medium text-sm",children:t.operation})]}),jsxRuntime.jsx("span",{className:"text-xs text-muted-foreground",children:t.timestamp})]}),t.error?jsxRuntime.jsx("p",{className:"text-xs text-red-600",children:t.error}):jsxRuntime.jsx("pre",{className:"text-xs bg-muted p-2 overflow-x-auto max-h-48",children:JSON.stringify(t.response,null,2)})]},t.id))})]})]})]}):jsxRuntime.jsxs("div",{className:`space-y-8 ${y}`,children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h1",{className:"text-2xl font-bold tracking-tight",children:"Spaark Pay Console"}),jsxRuntime.jsx("p",{className:"text-muted-foreground mt-1",children:"Configurez vos identifiants PawaPay pour commencer"})]}),jsxRuntime.jsxs("div",{className:"border border-border bg-background p-6 max-w-md space-y-6",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("div",{className:"w-10 h-10 bg-muted flex items-center justify-center",children:jsxRuntime.jsx(me,{})}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h2",{className:"font-semibold",children:"SDK Configuration"}),jsxRuntime.jsx("p",{className:"text-xs text-muted-foreground",children:"Enter your API credentials"})]})]}),jsxRuntime.jsxs("div",{className:"space-y-4",children:[jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx("label",{className:"text-xs font-medium",children:"API Key"}),jsxRuntime.jsx("input",{type:"password",placeholder:"pk_sandbox_...",value:l,onChange:t=>I(t.target.value),className:"w-full h-8 px-2.5 text-xs border border-input bg-transparent rounded-none outline-none focus:border-ring"})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx("label",{className:"text-xs font-medium",children:"Environnement"}),jsxRuntime.jsxs("div",{className:"flex gap-2",children:[jsxRuntime.jsxs("button",{onClick:()=>h("sandbox"),className:`h-8 px-3 text-xs font-medium border transition-colors flex items-center gap-1.5 ${s==="sandbox"?"bg-blue-600 text-white border-blue-600":"bg-background border-border hover:bg-muted"}`,children:[jsxRuntime.jsx("span",{className:`w-2 h-2 rounded-full ${s==="sandbox"?"bg-blue-200":"bg-blue-500"}`}),"Sandbox"]}),jsxRuntime.jsxs("button",{onClick:()=>h("production"),className:`h-8 px-3 text-xs font-medium border transition-colors flex items-center gap-1.5 ${s==="production"?"bg-green-600 text-white border-green-600":"bg-background border-border hover:bg-muted"}`,children:[jsxRuntime.jsx("span",{className:`w-2 h-2 rounded-full ${s==="production"?"bg-green-200":"bg-green-500"}`}),"Production"]})]}),jsxRuntime.jsx("p",{className:"text-xs text-muted-foreground",children:s==="sandbox"?"Utilisez le sandbox pour tester sans frais r\xE9els":"Attention : les transactions en production sont r\xE9elles"})]}),jsxRuntime.jsxs("button",{onClick:Ye,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:[jsxRuntime.jsx(se,{}),"Initialize SDK"]}),jsxRuntime.jsxs("div",{className:"relative flex items-center py-2",children:[jsxRuntime.jsx("div",{className:"flex-grow border-t border-border"}),jsxRuntime.jsx("span",{className:"flex-shrink mx-3 text-xs text-muted-foreground",children:"ou"}),jsxRuntime.jsx("div",{className:"flex-grow border-t border-border"})]}),jsxRuntime.jsxs("button",{onClick:Ze,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:[jsxRuntime.jsx(_t,{}),"Mode D\xE9mo (sans API key)"]})]})]})]})}var me=()=>jsxRuntime.jsxs("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[jsxRuntime.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"}),jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"})]}),se=()=>jsxRuntime.jsxs("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[jsxRuntime.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"}),jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})]}),Le=()=>jsxRuntime.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.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"})}),Wt=()=>jsxRuntime.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.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"})}),Fe=()=>jsxRuntime.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.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"})}),Q=()=>jsxRuntime.jsx("svg",{className:"w-4 h-4 animate-spin",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.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"})}),We=()=>jsxRuntime.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.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"})}),_e=({className:n=""})=>jsxRuntime.jsx("svg",{className:`w-4 h-4 ${n}`,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.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"})}),je=({className:n=""})=>jsxRuntime.jsx("svg",{className:`w-4 h-4 ${n}`,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.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"})}),_t=()=>jsxRuntime.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.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"})}),jt=()=>jsxRuntime.jsxs("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[jsxRuntime.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"}),jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"})]}),Gt=()=>jsxRuntime.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.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"})}),Ut=()=>jsxRuntime.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})}),Vt=()=>jsxRuntime.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.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"})}),$t=()=>jsxRuntime.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.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"})}),Jt=()=>jsxRuntime.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 10V3L4 14h7v7l9-11h-7z"})}),zt=()=>jsxRuntime.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.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"})}),Bt=()=>jsxRuntime.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10 20l4-16m4 4l4 4-4 4M6 16l-4-4 4-4"})}),ea=Ft;exports.SpaarkPaySdkFinanceDashboard=Tt;exports.SpaarkPaySdkTestDashboard=Ft;exports.default=ea;//# sourceMappingURL=react.js.map
6
+ });`})]})]})]}),C==="webhooks"&&jsxRuntime.jsxs("div",{className:"space-y-4",children:[jsxRuntime.jsxs("div",{className:"border border-border bg-background p-6 space-y-4",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:"font-semibold",children:"Webhook Secret"}),jsxRuntime.jsx("p",{className:"text-xs text-muted-foreground",children:"Configure the secret used for signing webhooks"})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx("label",{className:"text-xs font-medium",children:"Secret Key"}),jsxRuntime.jsx("input",{type:"text",placeholder:"whsec_...",value:te,onChange:t=>ie(t.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"})]})]}),jsxRuntime.jsxs("div",{className:"border border-border bg-background p-6 space-y-4",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:"font-semibold",children:"Webhook Simulator"}),jsxRuntime.jsx("p",{className:"text-xs text-muted-foreground",children:"Generate mock webhook events for testing"})]}),jsxRuntime.jsxs("div",{className:"grid sm:grid-cols-2 gap-4",children:[jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx("label",{className:"text-xs font-medium",children:"Event Type"}),jsxRuntime.jsx("select",{value:B,onChange:t=>de(t.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:Me.map(t=>jsxRuntime.jsx("option",{value:t,children:t},t))})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx("label",{className:"text-xs font-medium",children:"Amount"}),jsxRuntime.jsx("input",{type:"number",placeholder:"5000",value:p,onChange:t=>j(t.target.value),className:"w-full h-8 px-2.5 text-xs border border-input bg-transparent rounded-none outline-none focus:border-ring"})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx("label",{className:"text-xs font-medium",children:"Phone Number"}),jsxRuntime.jsx("input",{placeholder:"237670000000",value:ve,onChange:t=>Je(t.target.value),className:"w-full h-8 px-2.5 text-xs border border-input bg-transparent rounded-none outline-none focus:border-ring"})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx("label",{className:"text-xs font-medium",children:"Provider"}),jsxRuntime.jsx("select",{value:he,onChange:t=>ze(t.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:fe.map(t=>jsxRuntime.jsxs("option",{value:t.value,children:[t.label," (",t.country,")"]},t.value))})]})]}),jsxRuntime.jsxs("button",{onClick:async()=>{let t=De(B,{amount:p,phoneNumber:ve,correspondent:he}),r=JSON.stringify(t,null,2),m=await We(JSON.stringify(t),te);Be(r),He(m);let G={id:se(),eventType:B,payload:t,signature:m,receivedAt:new Date().toLocaleTimeString(),isVerified:null};ae(pe=>[G,...pe].slice(0,50)),u("Generate Webhook","success",{eventType:B,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",children:[jsxRuntime.jsx(re,{}),"Generate Event"]}),le&&jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("label",{className:"text-xs font-medium",children:"Generated Payload"}),jsxRuntime.jsx("button",{onClick:()=>ue(le),className:"text-xs text-muted-foreground hover:text-foreground",children:"Copy"})]}),jsxRuntime.jsx("pre",{className:"text-xs bg-muted p-3 overflow-x-auto max-h-48",children:le}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("label",{className:"text-xs font-medium",children:"Signature:"}),jsxRuntime.jsx("code",{className:"text-xs bg-muted px-2 py-1 font-mono flex-1 overflow-x-auto",children:ye}),jsxRuntime.jsx("button",{onClick:()=>ue(ye),className:"w-8 h-8 border border-border bg-background hover:bg-muted transition-colors flex items-center justify-center",children:jsxRuntime.jsx(Ue,{})})]})]})]}),jsxRuntime.jsxs("div",{className:"border border-border bg-background p-6 space-y-4",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:"font-semibold",children:"Signature Verifier"}),jsxRuntime.jsx("p",{className:"text-xs text-muted-foreground",children:"Test webhook signature verification"})]}),jsxRuntime.jsxs("div",{className:"space-y-4",children:[jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx("label",{className:"text-xs font-medium",children:"Payload (JSON)"}),jsxRuntime.jsx("textarea",{placeholder:'{"eventId": "...", "eventType": "deposit.completed", ...}',value:Ne,onChange:t=>Ke(t.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"})]}),jsxRuntime.jsxs("div",{className:"grid sm:grid-cols-2 gap-4",children:[jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx("label",{className:"text-xs font-medium",children:"Signature"}),jsxRuntime.jsx("input",{placeholder:"HMAC-SHA256 signature",value:ce,onChange:t=>Xe(t.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"})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx("label",{className:"text-xs font-medium",children:"Secret"}),jsxRuntime.jsx("input",{type:"password",placeholder:"whsec_...",value:ke,onChange:t=>Qe(t.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"})]})]}),jsxRuntime.jsxs("button",{onClick:async()=>{try{let t=JSON.parse(Ne),r=await We(JSON.stringify(t),ke),m=r===ce;Ce(m),u("Verify Signature",m?"success":"error",{isValid:m,expected:r,received:ce});}catch{Ce(false),u("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:[jsxRuntime.jsx(Xt,{}),"Verify Signature"]}),oe!==null&&jsxRuntime.jsxs("div",{className:`p-3 text-xs flex items-center gap-2 ${oe?"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:[oe?jsxRuntime.jsx(Ve,{className:"text-green-600"}):jsxRuntime.jsx($e,{className:"text-red-600"}),oe?"Signature is valid":"Signature is invalid"]})]})]}),jsxRuntime.jsxs("div",{className:"border border-border bg-background p-6 space-y-4",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:"font-semibold",children:"Event Parser"}),jsxRuntime.jsx("p",{className:"text-xs text-muted-foreground",children:"Parse and analyze raw webhook JSON"})]}),jsxRuntime.jsxs("div",{className:"space-y-4",children:[jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx("label",{className:"text-xs font-medium",children:"Raw JSON"}),jsxRuntime.jsx("textarea",{placeholder:"Paste webhook JSON here...",value:we,onChange:t=>Ye(t.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"})]}),jsxRuntime.jsxs("button",{onClick:()=>{try{let t=JSON.parse(we);Ee(t),Se(""),u("Parse Event","success",{eventType:t.eventType,eventId:t.eventId});}catch(t){Ee(null),Se(t instanceof Error?t.message:"Invalid JSON"),u("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:[jsxRuntime.jsx(Qt,{}),"Parse Event"]}),Te&&jsxRuntime.jsx("div",{className:"p-3 text-xs bg-red-100 text-red-800 dark:bg-red-900 dark:text-red-200",children:Te}),H&&jsxRuntime.jsxs("div",{className:"space-y-3",children:[jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-2 text-xs",children:[jsxRuntime.jsxs("div",{className:"p-2 bg-muted",children:[jsxRuntime.jsx("span",{className:"text-muted-foreground",children:"Event ID:"}),jsxRuntime.jsx("p",{className:"font-mono truncate",children:String(H.eventId??"N/A")})]}),jsxRuntime.jsxs("div",{className:"p-2 bg-muted",children:[jsxRuntime.jsx("span",{className:"text-muted-foreground",children:"Event Type:"}),jsxRuntime.jsx("p",{className:"font-medium",children:String(H.eventType??"N/A")})]}),jsxRuntime.jsxs("div",{className:"p-2 bg-muted",children:[jsxRuntime.jsx("span",{className:"text-muted-foreground",children:"Timestamp:"}),jsxRuntime.jsx("p",{className:"font-mono truncate",children:String(H.timestamp??"N/A")})]}),jsxRuntime.jsxs("div",{className:"p-2 bg-muted",children:[jsxRuntime.jsx("span",{className:"text-muted-foreground",children:"Status:"}),jsxRuntime.jsx("p",{className:"font-medium",children:String(H.data?.status??"N/A")})]})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx("label",{className:"text-xs font-medium",children:"Full Data"}),jsxRuntime.jsx("pre",{className:"text-xs bg-muted p-3 overflow-x-auto max-h-48",children:JSON.stringify(H,null,2)})]})]})]})]}),jsxRuntime.jsxs("div",{className:"border border-border bg-background p-6 space-y-4",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:"font-semibold",children:"Event Log"}),jsxRuntime.jsx("p",{className:"text-xs text-muted-foreground",children:"History of generated webhook events"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsxs("select",{value:X,onChange:t=>Ze(t.target.value),className:"h-8 px-2 text-xs border border-input bg-transparent rounded-none outline-none focus:border-ring",children:[jsxRuntime.jsx("option",{value:"all",children:"All"}),jsxRuntime.jsx("option",{value:"deposit",children:"Deposits"}),jsxRuntime.jsx("option",{value:"payout",children:"Payouts"}),jsxRuntime.jsx("option",{value:"refund",children:"Refunds"})]}),K.length>0&&jsxRuntime.jsx("button",{onClick:()=>ae([]),className:"text-xs text-muted-foreground hover:text-foreground",children:"Clear"})]})]}),jsxRuntime.jsx("div",{className:"divide-y divide-border max-h-64 overflow-y-auto",children:K.filter(t=>X==="all"||t.eventType.startsWith(X)).length===0?jsxRuntime.jsx("div",{className:"p-4 text-center text-muted-foreground text-xs",children:"No events yet. Generate a webhook event to see it here."}):K.filter(t=>X==="all"||t.eventType.startsWith(X)).map(t=>jsxRuntime.jsxs("div",{className:"py-3 space-y-1",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("div",{className:"flex items-center gap-2",children:jsxRuntime.jsx("span",{className:`px-1.5 py-0.5 text-xs font-medium ${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})}),jsxRuntime.jsx("span",{className:"text-xs text-muted-foreground",children:t.receivedAt})]}),jsxRuntime.jsxs("div",{className:"text-xs text-muted-foreground font-mono truncate",children:["sig: ",t.signature.slice(0,32),"..."]})]},t.id))})]})]})]}),jsxRuntime.jsxs("div",{className:"space-y-4",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("h3",{className:"font-semibold",children:"Results"}),L.length>0&&jsxRuntime.jsx("button",{onClick:()=>J([]),className:"text-xs text-muted-foreground hover:text-foreground",children:"Clear"})]}),jsxRuntime.jsx("div",{className:"border border-border bg-background divide-y divide-border max-h-[600px] overflow-y-auto",children:L.length===0?jsxRuntime.jsx("div",{className:"p-6 text-center text-muted-foreground text-xs",children:"No results yet. Execute an operation to see results here."}):L.map(t=>jsxRuntime.jsxs("div",{className:"p-4 space-y-2",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[t.status==="success"?jsxRuntime.jsx(Ve,{className:"text-green-600"}):jsxRuntime.jsx($e,{className:"text-red-600"}),jsxRuntime.jsx("span",{className:"font-medium text-sm",children:t.operation})]}),jsxRuntime.jsx("span",{className:"text-xs text-muted-foreground",children:t.timestamp})]}),t.error?jsxRuntime.jsx("p",{className:"text-xs text-red-600",children:t.error}):jsxRuntime.jsx("pre",{className:"text-xs bg-muted p-2 overflow-x-auto max-h-48",children:JSON.stringify(t.response,null,2)})]},t.id))})]})]})]}):jsxRuntime.jsxs("div",{className:`space-y-8 ${y}`,children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h1",{className:"text-2xl font-bold tracking-tight",children:"Spaark Pay Console"}),jsxRuntime.jsx("p",{className:"text-muted-foreground mt-1",children:"Configurez vos identifiants PawaPay pour commencer"})]}),jsxRuntime.jsxs("div",{className:"border border-border bg-background p-6 max-w-md space-y-6",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("div",{className:"w-10 h-10 bg-muted flex items-center justify-center",children:jsxRuntime.jsx(xe,{})}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h2",{className:"font-semibold",children:"SDK Configuration"}),jsxRuntime.jsx("p",{className:"text-xs text-muted-foreground",children:"Enter your API credentials"})]})]}),jsxRuntime.jsxs("div",{className:"space-y-4",children:[jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx("label",{className:"text-xs font-medium",children:"API Key"}),jsxRuntime.jsx("input",{type:"password",placeholder:"pk_sandbox_...",value:c,onChange:t=>R(t.target.value),className:"w-full h-8 px-2.5 text-xs border border-input bg-transparent rounded-none outline-none focus:border-ring"})]}),jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx("label",{className:"text-xs font-medium",children:"Environnement"}),jsxRuntime.jsxs("div",{className:"flex gap-2",children:[jsxRuntime.jsxs("button",{onClick:()=>N("sandbox"),className:`h-8 px-3 text-xs font-medium border transition-colors flex items-center gap-1.5 ${l==="sandbox"?"bg-blue-600 text-white border-blue-600":"bg-background border-border hover:bg-muted"}`,children:[jsxRuntime.jsx("span",{className:`w-2 h-2 rounded-full ${l==="sandbox"?"bg-blue-200":"bg-blue-500"}`}),"Sandbox"]}),jsxRuntime.jsxs("button",{onClick:()=>N("production"),className:`h-8 px-3 text-xs font-medium border transition-colors flex items-center gap-1.5 ${l==="production"?"bg-green-600 text-white border-green-600":"bg-background border-border hover:bg-muted"}`,children:[jsxRuntime.jsx("span",{className:`w-2 h-2 rounded-full ${l==="production"?"bg-green-200":"bg-green-500"}`}),"Production"]})]}),jsxRuntime.jsx("p",{className:"text-xs text-muted-foreground",children:l==="sandbox"?"Utilisez le sandbox pour tester sans frais r\xE9els":"Attention : les transactions en production sont r\xE9elles"})]}),jsxRuntime.jsxs("button",{onClick:qe,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:[jsxRuntime.jsx(re,{}),"Initialize SDK"]}),jsxRuntime.jsxs("div",{className:"relative flex items-center py-2",children:[jsxRuntime.jsx("div",{className:"flex-grow border-t border-border"}),jsxRuntime.jsx("span",{className:"flex-shrink mx-3 text-xs text-muted-foreground",children:"ou"}),jsxRuntime.jsx("div",{className:"flex-grow border-t border-border"})]}),jsxRuntime.jsxs("button",{onClick:et,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:[jsxRuntime.jsx(Vt,{}),"Mode D\xE9mo (sans API key)"]})]})]})]})}var xe=()=>jsxRuntime.jsxs("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[jsxRuntime.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"}),jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"})]}),re=()=>jsxRuntime.jsxs("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[jsxRuntime.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"}),jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})]}),je=()=>jsxRuntime.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.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"})}),Ut=()=>jsxRuntime.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.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"})}),Ge=()=>jsxRuntime.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.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"})}),Z=()=>jsxRuntime.jsx("svg",{className:"w-4 h-4 animate-spin",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.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"})}),Ue=()=>jsxRuntime.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.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"})}),Ve=({className:s=""})=>jsxRuntime.jsx("svg",{className:`w-4 h-4 ${s}`,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.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"})}),$e=({className:s=""})=>jsxRuntime.jsx("svg",{className:`w-4 h-4 ${s}`,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.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"})}),Vt=()=>jsxRuntime.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.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"})}),$t=()=>jsxRuntime.jsxs("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[jsxRuntime.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"}),jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"})]}),Jt=()=>jsxRuntime.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.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"})}),zt=()=>jsxRuntime.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})}),Bt=()=>jsxRuntime.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.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"})}),Ht=()=>jsxRuntime.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.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"})}),Kt=()=>jsxRuntime.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 10V3L4 14h7v7l9-11h-7z"})}),Xt=()=>jsxRuntime.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.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"})}),Qt=()=>jsxRuntime.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10 20l4-16m4 4l4 4-4 4M6 16l-4-4 4-4"})}),sa=Gt;exports.SpaarkPaySdkFinanceDashboard=Pt;exports.SpaarkPaySdkTestDashboard=Gt;exports.default=sa;//# sourceMappingURL=react.js.map
7
7
  //# sourceMappingURL=react.js.map