1import{r as f,j as e,g as Ve}from"./vendor-BYDWwPae.js";import{bI as _e,fk as oe,fl as Ue,bp as h,aD as J,a1 as re,eR as te,bs as $e,aI as P,aJ as T,aK as D,aL as R,aM as N,bq as b,br as j,bS as We,a0 as _,aq as W,Z as Ce,fm as ke,aH as Ye,ck as ve,cm as fe,db as A,f6 as He,aX as Ge,aE as Ke,aW as Qe,F as Xe,dZ as Q,d0 as we,e6 as Ze,fn as Je,N as V,a7 as X,ao as je,ae as $,ag as ne}from"./index-DJOi_ihA.js";import{u as es,P as ss,A as as,C as rs,S as ts}from"./useProviderAiApply-DyN3SsTv.js";import{m as ls,u as is,a as ns,P as cs,b as os,o as ds}from"./ProviderAiLaunchButton-DBc9ZRMR.js";import{D as ms}from"./DatePickerModal-VMZufoFG.js";import"./query-DAfX1kxE.js";import"./ui-DI4_AqlD.js";import"./utils-CXlbsO6u.js";import"./providerRoles-BDbcldGL.js";import"./quill.snow-7hfhoN1b.js";import"./isEqual-CaG2TIl4.js";import"./_baseIsEqual-D4BXP-kW.js";import"./globe-zgFqpQ5H.js";import"./star-BCDF9ocl.js";import"./providerFlags-DLWhygUc.js";const Ne=["Gambling","Adult content","Cryptocurrency","Forex","Binary options","Money laundering","Terrorism financing","Shell banks","Ponzi schemes","Unregulated currencies"],us=["North America","Europe","Asia","South America","Africa","Oceania","Middle East"];function ae({label:r,options:m,value:p=[],onChange:v}){const[w,x]=f.useState(!1),[C,d]=f.useState(""),g=o=>{p.includes(o)?v(p.filter(u=>u!==o)):v([...p,o])},y=m.filter(o=>o.toLowerCase().includes(C.toLowerCase()));return e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-900 mb-2",children:r}),e.jsxs("div",{className:"relative",children:[e.jsx("div",{className:"min-h-[44px] px-3 py-2 bg-white border border-gray-200 rounded-lg cursor-text",onClick:()=>x(!0),children:p.length>0?e.jsx("div",{className:"flex flex-wrap gap-2",children:p.map(o=>e.jsxs("span",{className:"inline-flex items-center gap-1 text-brand-500 text-sm",children:[o,e.jsx("button",{type:"button",onClick:u=>{u.stopPropagation(),g(o)},className:"hover:text-blue-800",children:e.jsx(re,{className:"w-3 h-3"})})]},o))}):e.jsx("span",{className:"text-gray-400 text-sm",children:"Select Activity"})}),w&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"fixed inset-0 z-10",onClick:()=>x(!1)}),e.jsxs("div",{className:"absolute z-20 w-full mt-2 bg-white border border-gray-200 rounded-lg shadow-lg",children:[e.jsx("div",{className:"p-2 border-b border-gray-200",children:e.jsx(h,{value:C,onChange:o=>d(o.target.value),placeholder:"Search...",className:"h-9",autoFocus:!0})}),e.jsx("div",{className:"max-h-64 overflow-auto",children:y.map(o=>e.jsxs("button",{type:"button",onClick:()=>{g(o),d("")},className:_("w-full px-4 py-2 text-left hover:bg-gray-50 transition-colors flex items-center gap-2 text-sm",p.includes(o)&&"bg-blue-50"),children:[e.jsx("div",{className:_("w-4 h-4 rounded border flex items-center justify-center flex-shrink-0",p.includes(o)?"bg-blue-600 border-blue-600":"border-gray-300"),children:p.includes(o)&&e.jsx(J,{className:"w-3 h-3 text-white",strokeWidth:3})}),e.jsx("span",{className:"text-gray-700",children:o})]},o))})]})]})]})]})}function hs({checked:r,onChange:m}){return e.jsx("button",{type:"button",onClick:()=>m(!r),className:_("relative inline-flex h-6 w-11 items-center rounded-full transition-colors",r?"bg-success-500":"bg-gray-300"),children:e.jsx("span",{className:_("inline-block h-4 w-4 transform rounded-full bg-white transition-transform",r?"translate-x-6":"translate-x-1")})})}function Z({label:r,checked:m,onChange:p,showAttach:v,onAttach:w}){return e.jsxs("div",{className:_("rounded-lg border p-3 flex items-center justify-between transition-all",m?"bg-success-50 border-[#BBF7D0]":"bg-white border-gray-200"),children:[e.jsxs("div",{className:"flex items-center gap-3 flex-1",children:[e.jsx("span",{className:"font-medium text-gray-900 text-sm",children:r}),v&&m&&e.jsxs("button",{type:"button",onClick:w,className:"inline-flex items-center gap-1.5 px-3 py-1 bg-white border border-gray-200 rounded-md text-xs text-gray-700 hover:bg-gray-50",children:[e.jsx(te,{className:"w-3 h-3"}),"Attach"]})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:_("text-sm font-medium min-w-[28px]",m?"text-[#27D07E]":"text-gray-500"),children:m?"Yes":"No"}),e.jsx(hs,{checked:m,onChange:p})]})]})}function xs({data:r,onChange:m,onSave:p,saving:v}){const{countryNames:w,groupedCountryNames:x}=_e(),C=f.useMemo(()=>[...x.popular,...x.rest],[x]),{currencies:d}=oe(),[g,y]=f.useState(null),o=f.useMemo(()=>{const s=n=>({value:n,name:n}),t=Ue(x.popular.map(s),x.rest.map(s)),c=r.iban_country||"";return c&&!w.includes(c)&&t.unshift({value:c,name:c}),t},[w,x,r.iban_country]),u=(s,t)=>{m({...r,[s]:t})},M=async(s,t)=>{y(s);try{const c=await Ce.upload(t,"documents");u(s,c.file_url||c.url)}catch(c){console.error("Error uploading file:",c)}finally{y(null)}};return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-900 mb-2",children:"Link (If Public)"}),e.jsx(h,{value:r.public_link||"",onChange:s=>u("public_link",s.target.value),placeholder:"Paste link",className:"h-11"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-900 mb-2",children:"Upload File"}),e.jsx("input",{type:"file",onChange:s=>{var t;return((t=s.target.files)==null?void 0:t[0])&&M("risk_file",s.target.files[0])},className:"hidden",id:"risk-file-upload"}),e.jsx("label",{htmlFor:"risk-file-upload",className:"flex items-center justify-center h-11 px-4 bg-white border border-gray-300 rounded-lg cursor-pointer hover:bg-gray-50 transition-colors",children:g==="risk_file"?e.jsx("span",{className:"text-sm text-gray-600",children:"Uploading..."}):r.risk_file?e.jsxs("div",{className:"flex items-center gap-2 w-full justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(J,{className:"w-4 h-4 text-blue-600"}),e.jsx("span",{className:"text-sm text-blue-600 font-medium",children:"Attached"})]}),e.jsx("button",{type:"button",onClick:s=>{s.preventDefault(),u("risk_file",null)},className:"text-red-600 hover:text-red-700",children:e.jsx(re,{className:"w-4 h-4"})})]}):e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(te,{className:"w-4 h-4 text-gray-600"}),e.jsx("span",{className:"text-sm text-gray-600",children:"Attach"})]})})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsx(ae,{label:"Restricted List of Activities",options:Ne,value:r.restricted_activities||[],onChange:s=>u("restricted_activities",s)}),e.jsx(ae,{label:"Prohibited List of Activities",options:Ne,value:r.prohibited_activities||[],onChange:s=>u("prohibited_activities",s)})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsx(ae,{label:"Restricted Countries List",options:C,value:r.restricted_countries||[],onChange:s=>u("restricted_countries",s)}),e.jsx(ae,{label:"Prohibited Countries List",options:C,value:r.prohibited_countries||[],onChange:s=>u("prohibited_countries",s)})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-900 mb-2",children:"Chargeback Policy"}),e.jsx("input",{type:"file",onChange:s=>{var t;return((t=s.target.files)==null?void 0:t[0])&&M("chargeback_policy",s.target.files[0])},className:"hidden",id:"chargeback-upload"}),e.jsx("label",{htmlFor:"chargeback-upload",className:"flex items-center justify-center h-11 px-4 bg-white border border-gray-300 rounded-lg cursor-pointer hover:bg-gray-50",children:g==="chargeback_policy"?e.jsx("span",{className:"text-sm text-gray-600",children:"Uploading..."}):r.chargeback_policy?e.jsxs("div",{className:"flex items-center gap-2 w-full justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(J,{className:"w-4 h-4 text-blue-600"}),e.jsx("span",{className:"text-sm text-blue-600 font-medium",children:"Attached"})]}),e.jsx("button",{type:"button",onClick:s=>{s.preventDefault(),u("chargeback_policy",null)},className:"text-red-600 hover:text-red-700",children:e.jsx(re,{className:"w-4 h-4"})})]}):e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(te,{className:"w-4 h-4 text-gray-600"}),e.jsx("span",{className:"text-sm text-gray-600",children:"Upload File"})]})})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-900 mb-2",children:"Refund Policy"}),e.jsx("input",{type:"file",onChange:s=>{var t;return((t=s.target.files)==null?void 0:t[0])&&M("refund_policy",s.target.files[0])},className:"hidden",id:"refund-upload"}),e.jsx("label",{htmlFor:"refund-upload",className:"flex items-center justify-center h-11 px-4 bg-white border border-gray-300 rounded-lg cursor-pointer hover:bg-gray-50",children:g==="refund_policy"?e.jsx("span",{className:"text-sm text-gray-600",children:"Uploading..."}):r.refund_policy?e.jsxs("div",{className:"flex items-center gap-2 w-full justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(J,{className:"w-4 h-4 text-blue-600"}),e.jsx("span",{className:"text-sm text-blue-600 font-medium",children:"Attached"})]}),e.jsx("button",{type:"button",onClick:s=>{s.preventDefault(),u("refund_policy",null)},className:"text-red-600 hover:text-red-700",children:e.jsx(re,{className:"w-4 h-4"})})]}):e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(te,{className:"w-4 h-4 text-gray-600"}),e.jsx("span",{className:"text-sm text-gray-600",children:"Upload File"})]})})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-900 mb-2",children:"Webpage Analyze Policy"}),e.jsxs("div",{className:"relative",children:[e.jsx($e,{value:r.webpage_policy||"",onChange:s=>u("webpage_policy",s.target.value),placeholder:"Our Webpage Analyze Policy outlines the procedures and standards for the data-driven analysis...",className:"min-h-[100px] resize-none pr-16",maxLength:400}),e.jsxs("div",{className:"absolute bottom-3 right-3 text-xs text-gray-400",children:[(r.webpage_policy||"").length,"/400"]})]})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx("h3",{className:"font-semibold text-gray-900",children:"Transaction Settings"}),e.jsx(Z,{label:"Transaction History",checked:r.transaction_history||
1!1,onChange:s=>u("transaction_history",s),showAttach:!0,onAttach:()=>{var s;return(s=document.getElementById("transaction-history-upload"))==null?void 0:s.click()}}),e.jsx("input",{type:"file",id:"transaction-history-upload",className:"hidden",onChange:s=>{var t;return((t=s.target.files)==null?void 0:t[0])&&M("transaction_history_file",s.target.files[0])}}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(Z,{label:"Crypto Friendly",checked:r.crypto_friendly||!1,onChange:s=>u("crypto_friendly",s)}),r.crypto_friendly&&e.jsxs("div",{className:"ml-4",children:[e.jsx("label",{className:"block text-sm font-medium text-gray-900 mb-2",children:"Activity type"}),e.jsxs(P,{value:r.crypto_activity_type||"",onValueChange:s=>u("crypto_activity_type",s),children:[e.jsx(T,{className:"h-11",children:e.jsx(D,{placeholder:"Choose"})}),e.jsxs(R,{children:[e.jsx(N,{value:"Trading",children:"Trading"}),e.jsx(N,{value:"Exchange",children:"Exchange"}),e.jsx(N,{value:"Wallet",children:"Wallet"}),e.jsx(N,{value:"Mining",children:"Mining"})]})]})]})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(Z,{label:"Subscriptions Supported",checked:r.subscriptions_supported||!1,onChange:s=>u("subscriptions_supported",s)}),r.subscriptions_supported&&e.jsxs("div",{className:"ml-4 space-y-3",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-900 mb-2",children:"Allowed MCs for subscription"}),e.jsx(h,{value:r.allowed_mcs_subscription||"",onChange:s=>u("allowed_mcs_subscription",s.target.value),placeholder:"Information about MCs or attaching",className:"h-11"})]}),e.jsx(Z,{label:"Auto-Subs Payments",checked:r.auto_subs_payments||!1,onChange:s=>u("auto_subs_payments",s)})]})]})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("h3",{className:"font-semibold text-gray-900",children:"Currency & Regional Coverage"}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-900 mb-2",children:"Available Currencies"}),e.jsxs(P,{value:r.available_currencies||"",onValueChange:s=>u("available_currencies",s),children:[e.jsx(T,{className:"h-11",children:e.jsx(D,{placeholder:"Select Currency"})}),e.jsx(R,{children:d.map(s=>e.jsxs(N,{value:s.code,children:[s.code,s.symbol&&s.symbol!==s.code?` (${s.symbol})`:""]},s.code))})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-900 mb-2",children:"Currency of Settlement"}),e.jsxs(P,{value:r.settlement_currency||"",onValueChange:s=>u("settlement_currency",s),children:[e.jsx(T,{className:"h-11",children:e.jsx(D,{placeholder:"Select Currency"})}),e.jsx(R,{children:d.map(s=>e.jsxs(N,{value:s.code,children:[s.code,s.symbol&&s.symbol!==s.code?` (${s.symbol})`:""]},s.code))})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-900 mb-2",children:"Currencies for Acquiring"}),e.jsxs(P,{value:r.acquiring_currencies||"",onValueChange:s=>u("acquiring_currencies",s),children:[e.jsx(T,{className:"h-11",children:e.jsx(D,{placeholder:"Select Currency"})}),e.jsx(R,{children:d.map(s=>e.jsxs(N,{value:s.code,children:[s.code,s.symbol&&s.symbol!==s.code?` (${s.symbol})`:""]},s.code))})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-900 mb-2",children:"Regions for Acquiring"}),e.jsxs(P,{value:r.acquiring_regions||"",onValueChange:s=>u("acquiring_regions",s),children:[e.jsx(T,{className:"h-11",children:e.jsx(D,{placeholder:"Select Region"})}),e.jsx(R,{children:us.map(s=>e.jsx(N,{value:s,children:s},s))})]})]})]})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("h3",{className:"font-semibold text-gray-900",children:"Banking & Payment Infrastructure"}),e.jsxs("div",{className:"grid grid-cols-4 gap-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-900 mb-2",children:"Min Limits per Payment"}),e.jsx(h,{value:r.min_payment||"",...b({...j.money,onChange:s=>u("min_payment",s.target.value)}),placeholder:"Enter amount",className:"h-11"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-900 mb-2",children:"Currency"}),e.jsxs(P,{value:r.min_payment_currency||"",onValueChange:s=>u("min_payment_currency",s),children:[e.jsx(T,{className:"h-11",children:e.jsx(D,{placeholder:"Select Currency"})}),e.jsx(R,{children:d.map(s=>e.jsxs(N,{value:s.code,children:[s.code,s.symbol&&s.symbol!==s.co
1de?` (${s.symbol})`:""]},s.code))})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-900 mb-2",children:"Max Limits per Payment"}),e.jsx(h,{value:r.max_payment||"",...b({...j.money,onChange:s=>u("max_payment",s.target.value)}),placeholder:"Enter Amount",className:"h-11"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-900 mb-2",children:"Currency"}),e.jsxs(P,{value:r.max_payment_currency||"",onValueChange:s=>u("max_payment_currency",s),children:[e.jsx(T,{className:"h-11",children:e.jsx(D,{placeholder:"Select Currency"})}),e.jsx(R,{children:d.map(s=>e.jsxs(N,{value:s.code,children:[s.code,s.symbol&&s.symbol!==s.code?` (${s.symbol})`:""]},s.code))})]})]})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(Z,{label:"Issue IBAN to Clients",checked:r.issue_iban||!1,onChange:s=>u("issue_iban",s)}),r.issue_iban&&e.jsxs("div",{className:"ml-4 grid grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-900 mb-2",children:"Via Treezor"}),e.jsxs(P,{value:r.via_treezor||"",onValueChange:s=>u("via_treezor",s),children:[e.jsx(T,{className:"h-11",children:e.jsx(D,{placeholder:"Choose"})}),e.jsxs(R,{children:[e.jsx(N,{value:"Yes",children:"Yes"}),e.jsx(N,{value:"No",children:"No"})]})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-900 mb-2",children:"IBAN Country"}),e.jsx(We,{options:o,value:r.iban_country||"",onValueChange:s=>u("iban_country",s),placeholder:"Choose",size:"sm",className:"h-11 rounded-lg"})]})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-900 mb-3",children:"Terminal"}),e.jsx("div",{className:"flex gap-4",children:["Own","Master Terminal"].map(s=>e.jsxs("button",{type:"button",onClick:()=>u("terminal",s),className:_("flex-1 h-12 rounded-lg border-2 flex items-center justify-center gap-3 transition-colors",r.terminal===s?"bg-blue-50 border-brand-500":"bg-white border-gray-200 hover:border-gray-300"),children:[e.jsx("div",{className:_("w-5 h-5 rounded-full border-2 flex items-center justify-center",r.terminal===s?"border-brand-500":"border-gray-300"),children:r.terminal===s&&e.jsx("div",{className:"w-3 h-3 rounded-full bg-brand-500"})}),e.jsx("span",{className:_("font-medium",r.terminal===s?"text-brand-500":"text-gray-700"),children:s})]},s))})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-900 mb-3",children:"Work with"}),e.jsx("div",{className:"flex gap-4",children:["Sub-Merchant Acquiring","Secondary Acquiring"].map(s=>e.jsxs("button",{type:"button",onClick:()=>u("work_with",s),className:_("flex-1 h-12 rounded-lg border-2 flex items-center justify-center gap-3 transition-colors",r.work_with===s?"bg-blue-50 border-brand-500":"bg-white border-gray-200 hover:border-gray-300"),children:[e.jsx("div",{className:_("w-5 h-5 rounded-full border-2 flex items-center justify-center",r.work_with===s?"border-brand-500":"border-gray-300"),children:r.work_with===s&&e.jsx("div",{className:"w-3 h-3 rounded-full bg-brand-500"})}),e.jsx("span",{className:_("font-medium",r.work_with===s?"text-brand-500":"text-gray-700"),children:s})]},s))})]})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("h3",{className:"font-semibold text-gray-900",children:"Merchant Control Lists"}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-900 mb-2",children:"Favorite MCs"}),e.jsx(h,{value:r.favorite_mcs||"",onChange:s=>u("favorite_mcs",s.target.value),placeholder:"Enter MC",className:"h-11"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-900 mb-2",children:"Blacklist MCs"}),e.jsx(h,{value:r.blacklist_mcs||"",onChange:s=>u("blacklist_mcs",s.target.value),placeholder:"Enter MC",className:"h-11"})]})]})]}),e.jsxs("div",{className:"flex items-center justify-between pt-6 border-t border-gray-200",children:[e.jsx("p",{className:"text-sm text-gray-600",children:"Changes are kept in the form until you save them."}),e.jsx(W,{onClick:p,disabled:v,className:"h-12 px-8 rounded-full text-base font-semibold bg-brand-500 hover:bg-blue-700 text-white",children:v?"Saving...":"Save Changes"})]})]})}function gs({data:r,onChange:m,onSave:p,saving:v,activeRiskLevel:w,onRiskLevelChange:x}){const{currencies:C}=oe(),{groupedCountryNames:d}=_e(),[g,y]=f.useState(r.processingFees||[]);f.useEffect(()=>{y(r.processingFees||[])},[r.processingFees]);const o=(t,c)=>{m({...r,[t]:c})},u=()=>{const t={id:Date.now(),country:"",feePercent:"",currency:"",interchangeFee:"",interchangePlusFee:"",acquirerFee:"",schemeFeeVisa:"",sc
1hemeFeeMasterCard:"",schemeFeeAmex:""},c=[...g,t];y(c),o("processingFees",c)},M=t=>{const c=g.filter(n=>n.id!==t);y(c),o("processingFees",c)},s=(t,c,n)=>{const E=g.map(S=>S.id===t?{...S,[c]:n}:S);y(E),o("processingFees",E)};return e.jsxs("div",{className:"space-y-6",children:[e.jsx("div",{className:"flex gap-3 border-b border-gray-200 -mx-6 px-6 -mt-6",children:ke.map(t=>e.jsx("button",{type:"button",onClick:()=>x(t.id),className:_("px-6 py-3 font-medium text-sm transition-all border-b-2",w===t.id?"border-[#27D07E] text-[#27D07E]":"border-transparent text-gray-600 hover:text-gray-900"),children:t.label},t.id))}),e.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[e.jsxs("div",{className:"bg-success-50 border border-[#BBF7D0] rounded-xl p-5 space-y-3",children:[e.jsx("label",{className:"block text-sm font-medium text-gray-900",children:"Onboarding fee Currency"}),e.jsxs(P,{value:r.onboardingCurrency||"",onValueChange:t=>o("onboardingCurrency",t),children:[e.jsx(T,{className:"h-11 bg-white",children:e.jsx(D,{placeholder:"Select Currency"})}),e.jsx(R,{children:C.map(t=>e.jsxs(N,{value:t.code,children:[t.code,t.symbol&&t.symbol!==t.code?` (${t.symbol})`:""]},t.code))})]}),e.jsx("label",{className:"block text-sm font-medium text-gray-900 mt-3",children:"Onboarding fee"}),e.jsx(h,{value:r.onboardingFee||"",...b({...j.money,onChange:t=>o("onboardingFee",t.target.value)}),placeholder:"Enter Onboarding fee",className:"h-11 bg-white"})]}),e.jsxs("div",{className:"bg-success-50 border border-[#BBF7D0] rounded-xl p-5 space-y-3",children:[e.jsx("label",{className:"block text-sm font-medium text-gray-900",children:"Monthly fee Currency"}),e.jsxs(P,{value:r.monthlyCurrency||"",onValueChange:t=>o("monthlyCurrency",t),children:[e.jsx(T,{className:"h-11 bg-white",children:e.jsx(D,{placeholder:"Select Currency"})}),e.jsx(R,{children:C.map(t=>e.jsxs(N,{value:t.code,children:[t.code,t.symbol&&t.symbol!==t.code?` (${t.symbol})`:""]},t.code))})]}),e.jsx("label",{className:"block text-sm font-medium text-gray-900 mt-3",children:"Monthly fee"}),e.jsx(h,{value:r.monthlyFee||"",...b({...j.money,onChange:t=>o("monthlyFee",t.target.value)}),placeholder:"Enter Monthly fee",className:"h-11 bg-white"})]}),e.jsxs("div",{className:"bg-success-50 border border-[#BBF7D0] rounded-xl p-5 space-y-3",children:[e.jsx("label",{className:"block text-sm font-medium text-gray-900",children:"Integration fee Currency"}),e.jsxs(P,{value:r.integrationCurrency||"",onValueChange:t=>o("integrationCurrency",t),children:[e.jsx(T,{className:"h-11 bg-white",children:e.jsx(D,{placeholder:"Select Currency"})}),e.jsx(R,{children:C.map(t=>e.jsxs(N,{value:t.code,children:[t.code,t.symbol&&t.symbol!==t.code?` (${t.symbol})`:""]},t.code))})]}),e.jsx("label",{className:"block text-sm font-medium text-gray-900 mt-3",children:"Integration fee"}),e.jsx(h,{value:r.integrationFee||"",...b({...j.money,onChange:t=>o("integrationFee",t.target.value)}),placeholder:"Enter Integration fee",className:"h-11 bg-white"})]})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("h3",{className:"text-lg font-semibold text-gray-900",children:"Processing fee"}),e.jsxs(W,{type:"button",onClick:u,className:"bg-brand-500 hover:bg-blue-700 text-white",children:[e.jsx(Ye,{className:"w-4 h-4 mr-2"}),"Add Region"]})]}),g.map((t,c)=>e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("h4",{className:"text-sm font-medium text-gray-900",children:[c+1," Processing fee"]}),e.jsx("button",{type:"button",onClick:()=>M(t.id),className:"text-red-600 hover:text-red-700 text-sm font-medium",children:"Delete"})]}),e.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-900 mb-2",children:"Country"}),e.jsxs(P,{value:t.country,onValueChange:n=>s(t.id,"country",n),children:[e.jsx(T,{className:"h-11",children:e.jsx(D,{placeholder:"Select Country"})}),e.jsxs(R,{children:[d.popular.length>0&&e.jsxs(ve,{children:[e.jsx(fe,{children:"Popular Countries"}),d.popular.map(n=>e.jsx(N,{value:n,children:n},n))]}),e.jsxs(ve,{children:[e.jsx(fe,{children:"All Countries"}),d.rest.map(n=>e.jsx(N,{value:n,children:n},n))]})]})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-900 mb-2",children:"Fee %"}),e.jsx(h,{value:t.feePercent,...b({...j.percent,onChange:n=>
1s(t.id,"feePercent",n.target.value)}),placeholder:"1.20 %",className:"h-11"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-900 mb-2",children:"Currency"}),e.jsxs(P,{value:t.currency,onValueChange:n=>s(t.id,"currency",n),children:[e.jsx(T,{className:"h-11",children:e.jsx(D,{placeholder:"Select Currency"})}),e.jsx(R,{children:C.map(n=>e.jsxs(N,{value:n.code,children:[n.code,n.symbol&&n.symbol!==n.code?` (${n.symbol})`:""]},n.code))})]})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"bg-success-50 border border-[#BBF7D0] rounded-xl p-4 space-y-3",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-900 mb-2",children:"Interchange fee"}),e.jsx(h,{value:t.interchangeFee,...b({decimals:3,max:100,onChange:n=>s(t.id,"interchangeFee",n.target.value)}),placeholder:"-enter %",className:"h-11 bg-white"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-900 mb-2",children:"Interchange + fee"}),e.jsx(h,{value:t.interchangePlusFee,...b({decimals:3,max:100,onChange:n=>s(t.id,"interchangePlusFee",n.target.value)}),placeholder:"-enter %",className:"h-11 bg-white"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-900 mb-2",children:"Acquirer fee"}),e.jsx(h,{value:t.acquirerFee,...b({decimals:3,max:100,onChange:n=>s(t.id,"acquirerFee",n.target.value)}),placeholder:"-enter %",className:"h-11 bg-white"})]})]}),e.jsxs("div",{className:"bg-success-50 border border-[#BBF7D0] rounded-xl p-4 space-y-3",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-900 mb-2",children:"Scheme fee for Visa"}),e.jsx(h,{value:t.schemeFeeVisa,...b({decimals:3,max:100,onChange:n=>s(t.id,"schemeFeeVisa",n.target.value)}),placeholder:"-enter %",className:"h-11 bg-white"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-900 mb-2",children:"Scheme fee for MasterCard"}),e.jsx(h,{value:t.schemeFeeMasterCard,...b({decimals:3,max:100,onChange:n=>s(t.id,"schemeFeeMasterCard",n.target.value)}),placeholder:"-enter %",className:"h-11 bg-white"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-900 mb-2",children:"Scheme fee for Amex"}),e.jsx(h,{value:t.schemeFeeAmex,...b({decimals:3,max:100,onChange:n=>s(t.id,"schemeFeeAmex",n.target.value)}),placeholder:"-enter %",className:"h-11 bg-white"})]})]})]})]},t.id))]}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("h3",{className:"text-lg font-semibold text-gray-900",children:"Payout & Settlement Fees"}),e.jsxs("div",{className:"grid grid-cols-4 gap-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-900 mb-2",children:"Payout Fee"}),e.jsx(h,{value:r.payoutFee||"",...b({...j.percent,onChange:t=>o("payoutFee",t.target.value)}),placeholder:"-enter %",className:"h-11"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-900 mb-2",children:"Mass Payouts Fee"}),e.jsx(h,{value:r.massPayoutsFee||"",...b({...j.percent,onChange:t=>o("massPayoutsFee",t.target.value)}),placeholder:"Enter %",className:"h-11"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-900 mb-2",children:"Settlement Fee"}),e.jsx(h,{value:r.settlementFee||"",...b({...j.percent,onChange:t=>o("settlementFee",t.target.value)}),placeholder:"-enter %",className:"h-11"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-900 mb-2",children:"Settlement Delay (T+x)"}),e.jsx(h,{value:r.settlementDelay||"",...b({...j.integer,onChange:t=>o("settlementDelay",t.target.value)}),placeholder:"Enter Days Amount",className:"h-11"})]})]})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("h3",{className:"text-lg font-semibold text-gray-900",children:"Reserves"}),e.jsx("div",{className:"bg-success-50 border border-[#BBF7D0] rounded-xl p-5",children:e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-900 mb-2",children:"Rolling Reserves"}),e.jsx(h,{value:r.rollingReserves||"",...b({...j.percent,onChange:t=>o("rollingReserves",t.target.value)}),placeholder:"-enter %",className:"h-11 bg-white"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-900 mb-2",children:"Rolling Reserves Delay (T+x)"}),e.jsx(h,{value:r.rollingReservesDelay||"",...b({...j.integer,onChange:t=>o("rollingReservesDelay",t.target.value)}),placeholder:"-enter Days Amount",className:"h-11 bg-white"})]})]})}),e.jsx("div",{className:"bg-success-50 border border-[#BBF7D0] rounded-xl p-5",children:e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-900 mb-2",children:"Rolling Reserves for Subscription Model"}),e.jsx(h,{value:r.rollingReservesSubscription||"",...b({...j.percent,onChange:t=>o("rollingReservesSubscription",t.target.value)}),placeholder:"-enter %",className:"h-11 bg-white"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-900 mb-2",children:"Rolling Reserves Delay for Subscription (T+x)"}),e.jsx(h,{value:r.rollingReservesDelaySubscription||"",...b({...j.integer,onChange:t=>o("rollingReservesDelaySubscription",t.target.value)}),placeholder:"-enter Days Amount",className:"h-11 bg-white"})]})]})})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("h3",{className:"text-lg font-semibold text-gray-900",children:"Fees for Disputes & Refunds"}),e.jsx("div",{className:"bg-success-50 border border-[#BBF7D0] rounded-xl p-5",children:e.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-900 mb-2",children:"Chargeback fee"}),e.jsx(h,{value:r.chargebackFee||"",...b({...j.percent,onChange:t=>o("chargebackFee",t.target.value)}),placeholder:"-enter %",className:"h-11 bg-white"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-900 mb-2",children:"Refund Fee"}),e.jsx(h,{value:r.refundFee||"",...b({...j.percent,onChange:t=>o("refundFee",t.target.value)}),placeholder:"-enter %",className:"h-11 bg-white"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-900 mb-2",children:"Crypto Acquiring Fee"}),e.jsx(h,{value:r.cryptoAcquiringFee||"",...b({...j.percent,onChange:t=>o("cryptoAcquiringFee",t.target.value)}),placeholder:"-enter %",className:"h-11 bg-white"})]})]})})]}),e.jsxs("div",{className:"flex items-center justify-between pt-6 border-t border-gray-200",children:[e.jsx("p",{className:"text-sm text-gray-600",children:"Changes are kept in the form until you save them."}),e.jsx(W,{onClick:p,disabled:v,className:"h-12 px-8 rounded-full text-base font-semibold bg-brand-500 hover:bg-blue-700 text-white",children:v?"Saving...":"Save Changes"})]})]})}function bs({data:r,onChange:m,onSave:p,saving:v}){var t;const[w,x]=f.useState(!1),[C,d]=f.useState(!1),g=(c,n)=>{m({...r,[c]:n})},y=async c=>{var E;const n=(E=c.target.files)==null?void 0:E[0];if(n){x(!0);try{const S=await Ce.upload(n,"documents");g("referralAgreement",{name:n.name,url:S.file_url||S.url})}catch(S){console.error("Error uploading file:",S)}finally{x(!1)}}},o=()=>{g("referralAgreement",null)},u=()=>{var c;(c=r.referralAgreement)!=null&&c.url&&Xe(r.referralAgreement.url)},M=c=>{if(!c)return"";const n=new Date(c),E=String(n.getDate()).padStart(2,"0"),S=String(n.getMonth()+1).padStart(2,"0"),le=n.getFullYear();return`${E}.${S}.${le}`},s=(()=>{let c=0;const n=["link","referralAgreement","dateOfSigning","interestRate","clientLifecycle","payoutTerms","applied","rejected","refused","approved","totalDeclaredTurnover","avgOnboardingPerio
1d","onboardingTimeAmount"];return n.forEach(E=>{r[E]&&c++}),Math.round(c/n.length*100)})();return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"bg-white rounded-xl border-2 border-gray-200 p-6 space-y-6",children:[e.jsx("h3",{className:"text-xl font-bold text-gray-900",children:"Referral Terms"}),e.jsxs("div",{className:"grid grid-cols-2 gap-6",children:[e.jsxs("div",{children:[e.jsx(A,{className:"text-sm font-medium text-gray-900 mb-2",children:"Link"}),e.jsx(h,{value:r.link||"",onChange:c=>g("link",c.target.value),placeholder:"referral/terms.com",className:"h-11"})]}),e.jsxs("div",{children:[e.jsx(A,{className:"text-sm font-medium text-gray-900 mb-2",children:"Attach Referral Agreement"}),r.referralAgreement?e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("div",{className:"flex items-center gap-2 px-4 h-11 bg-green-50 text-[#27D07E] rounded-lg flex-1",children:[e.jsx(J,{className:"w-4 h-4"}),e.jsx("span",{className:"text-sm font-medium",children:"Attached"})]}),e.jsx("button",{type:"button",onClick:u,className:"h-11 w-11 flex items-center justify-center rounded-lg border border-gray-300 hover:bg-gray-50",children:e.jsx(Ge,{className:"w-4 h-4 text-gray-600"})}),e.jsx("button",{type:"button",onClick:o,className:"h-11 w-11 flex items-center justify-center rounded-lg border border-gray-300 hover:bg-red-50",children:e.jsx(Ke,{className:"w-4 h-4 text-red-600"})})]}):e.jsxs("div",{className:"relative",children:[e.jsx("input",{type:"file",onChange:y,className:"hidden",id:"referral-agreement-upload",accept:".pdf,.doc,.docx"}),e.jsxs("label",{htmlFor:"referral-agreement-upload",className:_("flex items-center justify-center gap-2 h-11 px-4 rounded-lg border border-gray-300 bg-white cursor-pointer hover:bg-gray-50",w&&"opacity-50 cursor-not-allowed"),children:[e.jsx(He,{className:"w-4 h-4 text-gray-600"}),e.jsx("span",{className:"text-gray-600",children:w?"Uploading...":"Attach"})]})]})]}),e.jsxs("div",{children:[e.jsx(A,{className:"text-sm font-medium text-gray-900 mb-2",children:"Date of Signing"}),e.jsxs("div",{className:"relative",children:[e.jsx(h,{value:M(r.dateOfSigning),readOnly:!0,onClick:()=>d(!0),placeholder:"Select Date of Signing",className:"h-11 cursor-pointer pr-10"}),e.jsx("button",{type:"button",onClick:()=>d(!0),className:"absolute right-3 top-1/2 transform -translate-y-1/2",children:e.jsx(Qe,{className:"w-5 h-5 text-[#27D07E]"})})]})]}),e.jsxs("div",{children:[e.jsx(A,{className:"text-sm font-medium text-gray-900 mb-2",children:"Interest Rate"}),e.jsxs("div",{className:"relative",children:[e.jsx(h,{value:((t=r.interestRate)==null?void 0:t.toString().replace("%",""))||"",...b({...j.percent,onChange:c=>{let n=c.target.value;if(n!==""){const E=parseFloat(n);E>100&&(n="100"),E<0&&(n="0")}g("interestRate",n?`${n}%`:"")}}),placeholder:"Enter Interest Rate (0-100)",className:"h-11 pr-8"}),e.jsx("span",{className:"absolute right-3 top-1/2 transform -translate-y-1/2 text-gray-500",children:"%"})]})]}),e.jsxs("div",{children:[e.jsx(A,{className:"text-sm font-medium text-gray-900 mb-2",children:"Client Lifecycle"}),e.jsx(h,{value:r.clientLifecycle||"",...b({...j.integer,onChange:c=>g("clientLifecycle",c.target.value)}),placeholder:"Enter duration",className:"h-11"})]}),e.jsxs("div",{children:[e.jsx(A,{className:"text-sm font-medium text-gray-900 mb-2",children:"Payout Terms"}),e.jsxs(P,{value:r.payoutTerms||"",onValueChange:c=>g("payoutTerms",c),children:[e.jsx(T,{className:"h-11",children:e.jsx(D,{placeholder:"Select Payout Terms"})}),e.jsxs(R,{children:[e.jsx(N,{value:"Month",children:"Month"}),e.jsx(N,{value:"Quarter",children:"Quarter"}),e.jsx(N,{value:"Year",children:"Year"})]})]})]})]})]}),e.jsxs("div",{className:"bg-white rounded-xl border-2 border-gray-200 p-6 space-y-6",children:[e.jsx("h3",{className:"text-xl font-bold text-gray-900",children:"Client Metrics"}),e.jsxs("div",{className:"bg-success-50 border border-green-200 rounded-xl p-6 space-y-6",children:[e.jsxs("div",{className:"grid grid-cols-3 gap-6",children:[e.jsxs("div",{children:[e.jsx(A,{className:"text-sm font-medium text-gray-900 mb-2",children:"Applied"}),e.jsx(h,{value:r.applied||"",...b({...j.integer,onChange:c=>g("applied",c.target.value)}),placeholder:"Enter Number",className:"h-11 bg-white border-[#27D07E] focu
1s:ring-[#27D07E]"})]}),e.jsxs("div",{children:[e.jsx(A,{className:"text-sm font-medium text-gray-900 mb-2",children:"Rejected"}),e.jsx(h,{value:r.rejected||"",...b({...j.integer,onChange:c=>g("rejected",c.target.value)}),placeholder:"Enter Number",className:"h-11 bg-white border-red-400 focus:ring-red-400"})]}),e.jsxs("div",{children:[e.jsx(A,{className:"text-sm font-medium text-gray-900 mb-2",children:"Refused"}),e.jsx(h,{value:r.refused||"",...b({...j.integer,onChange:c=>g("refused",c.target.value)}),placeholder:"Enter Number",className:"h-11 bg-white border-red-400 focus:ring-red-400"})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-6",children:[e.jsxs("div",{children:[e.jsx(A,{className:"text-sm font-medium text-gray-900 mb-2",children:"Approved"}),e.jsx(h,{value:r.approved||"",...b({...j.integer,onChange:c=>g("approved",c.target.value)}),placeholder:"Enter Number",className:"h-11 bg-white border-[#27D07E] focus:ring-[#27D07E]"})]}),e.jsxs("div",{children:[e.jsx(A,{className:"text-sm font-medium text-gray-900 mb-2",children:"Total Declared Turnover"}),e.jsx(h,{value:r.totalDeclaredTurnover||"",...b({...j.money,onChange:c=>g("totalDeclaredTurnover",c.target.value)}),placeholder:"Enter Turnover",className:"h-11 bg-white"})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-6",children:[e.jsxs("div",{children:[e.jsx(A,{className:"text-sm font-medium text-gray-900 mb-2",children:"Average Onboarding Time Period"}),e.jsxs(P,{value:r.avgOnboardingPeriod||"",onValueChange:c=>g("avgOnboardingPeriod",c),children:[e.jsx(T,{className:"h-11 bg-white",children:e.jsx(D,{placeholder:"Select Time Period"})}),e.jsxs(R,{children:[e.jsx(N,{value:"Days",children:"Days"}),e.jsx(N,{value:"Weeks",children:"Weeks"}),e.jsx(N,{value:"Months",children:"Months"})]})]})]}),e.jsxs("div",{children:[e.jsx(A,{className:"text-sm font-medium text-gray-900 mb-2",children:"Onboarding Time Amount"}),e.jsx(h,{value:r.onboardingTimeAmount||"",...b({...j.integer,onChange:c=>g("onboardingTimeAmount",c.target.value)}),placeholder:"Enter Amount",className:"h-11 bg-white"})]})]})]})]}),e.jsx("div",{className:"pt-6 border-t border-gray-200",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("p",{className:"text-sm text-gray-600",children:s>=80?`â Section completed (${s}%)`:`Section completion: ${s}%`}),e.jsx(W,{onClick:p,disabled:v,className:"px-8 rounded-full bg-blue-600 hover:bg-blue-700 text-white",children:v?"Saving...":"Save Changes"})]})}),C&&e.jsx(ms,{isOpen:C,onClose:()=>d(!1),onSelect:c=>{g("dateOfSigning",c),d(!1)},selectedDate:r.dateOfSigning})]})}const ps=["Visa","Mastercard","Amex","UnionPay"],ys=["Dedicated IBAN","Shared IBAN","Virtual IBAN"],vs=["Pull account","Push account","Both"];function U({label:r,selected:m,onSelect:p}){return e.jsxs("button",{type:"button",onClick:p,className:_("flex items-center gap-3 px-6 py-3 rounded-lg border-2 transition-all bg-white",m?"border-[#27D07E] bg-green-50":"border-gray-200 hover:border-gray-300"),children:[e.jsx("div",{className:_("w-5 h-5 rounded-full border-2 flex items-center justify-center",m?"border-[#27D07E]":"border-gray-300"),children:m&&e.jsx("div",{className:"w-3 h-3 rounded-full bg-success-500"})}),e.jsx("span",{className:"text-sm font-medium text-gray-900",children:r})]})}function ce({label:r,checked:m,onChange:p}){return e.jsxs("div",{className:"bg-success-50 border-2 border-[#27D07E] rounded-xl px-6 py-4 flex items-center justify-between",children:[e.jsx("span",{className:"text-sm font-semibold text-gray-900",children:r}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:_("text-sm font-medium",m?"text-gray-400":"text-gray-700"),children:"No"}),e.jsx(we,{checked:m,onCheckedChange:p,className:"data-[state=checked]:bg-success-500"}),e.jsx("span",{className:_("text-sm font-medium",m?"text-gray-700":"text-gray-400"),children:"Yes"})]})]})}function fs({data:r,onChange:m,onSave:p,saving:v}){const{currencyOptions:w}=oe(),x=(d,g)=>{m({...r,[d]:g})},C=(()=>{let d=0;const g=["availableCurrencies","schemeAvailable","cardIssuingEnabled","sepaAccessType","swiftAccessType","currenciesForPayments"];return g.forEach(y=>{const o=r[y];o&&(Array.isArray(o)?o.length>0:o!=="")&&d++}),Math.round(d/g.length*100)})();return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"bg-white rounded-xl border-2 border-gray-200 p-6 space-y-6",children:[e.jsx("h3",{className:"text-xl font-bold text-gray-900",children:"Offered Services"}),e.jsxs("div",{className:"grid grid-cols-2 gap-6",children:[e.jsx(Q,{label:"Available Currencies",value:r.availableCurrencies||[],onChange:d=>x("availableCurrencies",d),options:w,placeholder:"Select Available Currency"}),e.jsx(Q,{label:"Scheme Available",value:r.schemeAvailable||[],onChange:d=>x("schemeAvailable",d),options:ps,placeholder:"Select Card networks"})]})]}),e.jsxs("div",{className:"bg-white rounded-xl border-2 border-gray-200 overflow-hidden",children:[e.jsx("div",{className:"bg-success-50 border-b-2 border-green-200 px-6 py-4",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("h3",{className:"text-lg font-bold text-gray-900",children:"Enable Card Issuing"}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:_("text-sm font-medium",r.cardIssuingEnabled?"text-gray-400":"text-gray-700"),children:"No"}),e.jsx(we,{checked:r.cardIssuingEnabled||!1,onCheckedChange:d=>x("cardIssuingEnabled",d),className:"data-[state=checked]:bg-success-500"}),e.jsx("span",{className:_("text-sm font-medium",r.cardIssuingEnabled?"text-gray-700":"text-gray-400"),children:"Yes"})]})]})}),r.cardIssuingEnabled&&e.jsxs("div",{className:"bg-success-50 px-6 py-6 space-y-6",children:[e.jsxs("div",{children:[e.jsx(A,{className:"text-sm font-medium text-gray-900 mb-3",children:"Select Card Form"}),e.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[e.jsx(U,{label:"Virtual Card",selected:r.cardForm==="virtual",onSelect:()=>x("cardForm","virtual")}),e.jsx(U,{label:"Plastic Card",selected:r.cardForm==="plastic",onSelect:()=>x("cardForm","plastic")}),e.jsx(U,{label:"Both",selected:r.cardForm==="both",onSelect:()=>x("cardForm","both")})]})]}),e.jsxs("div",{children:[e.jsx(A,{className:"text-sm font-medium text-gray-900 mb-3",children:"Virtual Card Tokenization"}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsx(U,{label:"Tokenized",selected:r.virtualCardTokenization==="tokenized",onSelect:()=>x("virtualCardTokenization","tokenized")}),e.jsx(U,{label:"Non-tokenized",selected:r.virtualCardTokenization==="non-tokenized",onSelect:()=>x("virtualCardTokenization","non-tokenized")})]})]}),r.cardForm==="both"&&e.jsxs("div",{children:[e.jsx(A,{className:"text-sm font-medium text-gray-900 mb-3",children:"Plastic Card Tokenization"}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsx(U,{label:"Tokenized",selected:r.plasticCardTokenization==="tokenized",onSelect:()=>x("plasticCardTokenization","tokenized")}),e.jsx(U,{label:"Non-tokenized",selected:r.plasticCardTokenization==="non-tokenized",onSelect:()=>x("plasticCardTokenization","non-tokenized")})]})]})]})]}),e.jsxs("div",{className:"bg-white rounded-xl border-2 border-gray-200 p-6 space-y-6",children:[e.jsx("h3",{className:"text-xl font-bold text-gray-900",children:"Payments"}),e.jsxs("div",{className:"grid grid-cols-3 gap-6",children:[e.jsx(Q,{label:"SEPA Access Type",value:r.sepaAccessType||[],onChange:d=>x("sepaAccessType",d),options:ys,placeholder:"Select Type"}),e.jsx(Q,{label:"SWIFT Access Type",value:r.swiftAccessType||[],onChange:d=>x("swiftAccessType",d),options:vs,placeholder:"Select Type"}),e.jsx(Q,{label:"Currencies for Payments",value:r.currenciesForPayments||[],onChange:d=>x("currenciesForPayments",d),options:w,placeholder:"Select Currency"})]}),e.jsxs("div",{className:"grid grid-cols-3 gap-6",children:[e.jsx(ce,{label:"Crypto Acquiring",checked:r.cryptoAcquiring||!1,onChange:d=>x("cryptoAcquiring",d)}),e.jsx(ce,{label:"Mass Payout",checked:r.massPayout||!1,onChange:d=>x("massPayout",d)}),e.jsx(ce,{label:"Offline Payment",checked:r.offlinePayment||!1,onChange:d=>x("offlinePayment",d)})]})]}),e.jsx("div",{className:"pt-6 border-t border-gray-200",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("p",{className:"text-sm text-gray-600",children:C>=80?`â Section completed (${C}%)`:`Section completion: ${C}%`}),e.jsx(W,{onClick:p,disabled:v,className:"px-8 rounded-full text-white bg-blue-600 hover:bg-blue-700",children:v?"Saving...":"Save Changes"})]})})]})}const js=["onboardingCurrency","onboardingFee","monthlyCurrency","monthlyFee","integrationCurrency","integrationFee","processingFees","interchangeFee","interchangePlusFee","acquirerFee","schemeFeeVisa","schemeFeeMasterCard","schemeFeeAmex","payoutFee","massPayoutsFee","settlementFee","settlementDelay","rollingReserves","rollingReservesDelay","rollingReservesSubscription","rollingReservesDelaySubscription","chargebackFee","refundFee","cryptoAcquiringFee"];function Ns(r,m){const p={};for(const v of m)r&&r[v]!==void 0&&(p[v]=r[v]);return p}const _s=[{id:"details",label:"Provider Details"}
1,{id:"risk",label:"Risk & Compliance"},{id:"fees",label:"Fee Overview"},{id:"referral",label:"Referral Terms"},{id:"services",label:"Offered Services"},{id:"additional",label:"Additional"},{id:"countriesIndustries",label:"Countries & Industries"}];function Bs(){var he,xe;const r=Ve(),[m,p]=f.useState("details"),[v,w]=f.useState("low"),[x,C]=f.useState({logoUrl:"",servesFinancialInstitutions:!1,financialInstitutions:{MSB:{enabled:!1,services:[]},EMI:{enabled:!1,services:[]},PI:{enabled:!1,services:[]}},offersBaaS:!1}),[d,g]=f.useState({sourceStatus:"ON_PLATFORM",supportedCountries:[],supportedIndustries:[]}),[y,o]=f.useState({low:{details:{},risk:{},fees:{},referral:{},services:{}},middle:{details:{},risk:{},fees:{},referral:{},services:{}},high:{details:{},risk:{},fees:{},referral:{},services:{}},highPlus:{details:{},risk:{},fees:{},referral:{},services:{}}}),[u,M]=f.useState(!1),[s,t]=f.useState(!1),[c,n]=f.useState(!1),[E,S]=f.useState(!1),[le,de]=f.useState(!1),[ee,z]=f.useState(!1),[Se,Fe]=f.useState(0),[Ae,me]=f.useState(null),[Pe,Te]=f.useState({}),F=new URLSearchParams(window.location.search).get("id"),De=es({setProviderDataByRisk:o,setCountriesIndustriesData:g,setAiAppliedExtras:Te,onChanged:()=>z(!0)});f.useEffect(()=>{F&&Re()},[F,Se]),Ze("v1",F,()=>{ee?$.info("The assistant changed this provider. Save or discard your edits, then reload to see its changes."):Fe(a=>a+1)}),Je("v1",F,(he=y.low.details)==null?void 0:he.name);const Re=async()=>{try{const a=await V.getOne(F);if(a){me(a);const k=l=>{var H,G,K;const i=((H=a.riskData)==null?void 0:H[l])||((G=a.risk_data)==null?void 0:G[l])||{};return{public_link:i.publicLink||i.public_link||"",risk_file:((K=i.fileAttachment)==null?void 0:K.url)||i.risk_file||"",restricted_activities:i.restrictedActivities||i.restricted_activities||[],prohibited_activities:i.prohibitedActivities||i.prohibited_activities||[],restricted_countries:i.restrictedCountries||i.restricted_countries||[],prohibited_countries:i.prohibitedCountries||i.prohibited_countries||[],chargeback_policy:i.chargebackPolicy||i.chargeback_policy||"",refund_policy:i.refundPolicy||i.refund_policy||"",webpage_policy:i.webpagePolicy||i.webpage_policy||"",transaction_history:i.transactionHistory??i.transaction_history??!1,transaction_history_file:i.transactionHistoryFile||i.transaction_history_file||"",crypto_friendly:i.cryptoFriendly??i.crypto_friendly??!1,crypto_activity_type:i.cryptoActivityType||i.crypto_activity_type||"",subscriptions_supported:i.subscriptionsSupported??i.subscriptions_supported??!1,allowed_mcs_subscription:i.allowedMcsSubscription||i.allowed_mcs_subscription||"",auto_subs_payments:i.autoSubsPayments??i.auto_subs_payments??!1,available_currencies:i.availableCurrencies||i.available_currencies||"",settlement_currency:i.settlementCurrency||i.settlement_currency||"",acquiring_currencies:i.acquiringCurrencies||i.acquiring_currencies||"",acquiring_regions:i.acquiringRegions||i.acquiring_regions||"",min_payment:i.minPayment||i.min_payment||"",min_payment_currency:i.minPaymentCurrency||i.min_payment_currency||"",max_payment:i.maxPayment||i.max_payment||"",max_payment_currency:i.maxPaymentCurrency||i.max_payment_currency||"",issue_iban:i.issueIban??i.issue_iban??!1,via_treezor:i.viaTreezor||i.via_treezor||"",iban_country:i.ibanCountry||i.iban_country||"",terminal:i.terminal||"",work_with:i.workWith||i.work_with||"",favorite_mcs:i.favoriteMcs||i.favorite_mcs||"",blacklist_mcs:i.blacklistMcs||i.blacklist_mcs||""}},I=()=>{var i,H,G,K,ge,be,pe,ye;const l=a.feeData||a.fee_data||{};return{onboardingCurrency:l.onboardingCurrency||((H=(i=l.categories)==null?void 0:i["1risk"])==null?void 0:H.onboardingFeeCurrency)||"EUR",onboardingFee:l.onboardingFee||((K=(G=l.categories)==null?void 0:G["1risk"])==null?void 0:K.onboardingFeeAmount)||"",monthlyCurrency:l.monthlyCurrency||((be=(ge=l.categories)==null?void 0:ge["1risk"])==null?void 0:be.monthlyFeeCurrency)||"EUR",monthlyFee:l.monthlyFee||((ye=(pe=l.categories)==null?void 0:pe["1risk"])==null?void 0:ye.monthlyFeeAmount)||"",integrationCurrency:l.integrationCurrency||"EUR",integrationFee:l.integrationFee||"",processingFees:l.processingFees||[],payoutFee:l.payoutFee||"",massPayoutsFee:l.massPayoutsFee||"",settlementFee:l.settlementFee||"",settlementDelay:l.settlementDelay||"",rollingReserves:l.rollingReserves||"",rollingReservesDelay:l.rollingReservesDelay||"",rollingReservesSubscription:l.rollingReservesSubscription||"",rollingReservesDelaySubscription:l.rollingReservesDelaySubscription||"",interchangeFee:l.interchangeFee||"",interchangePlusFee:l.interchangePlusFee||"",acquirerFee:l.acquirerFee||"",schemeFeeVisa:l.sc
1hemeFeeVisa||"",schemeFeeMasterCard:l.schemeFeeMasterCard||"",schemeFeeAmex:l.schemeFeeAmex||"",chargebackFee:l.chargebackFee||"",refundFee:l.refundFee||"",cryptoAcquiringFee:l.cryptoAcquiringFee||"",categories:l.categories||{},individual:l.individual||{}}},O=()=>{const l=a.referralData||a.referral_data||{};return{link:l.link||a.website||"",referralAgreement:l.referralAgreement||null,dateOfSigning:l.dateOfSigning||l.date_of_signing||new Date().toISOString(),interestRate:l.interestRate||l.interest_rate||"",clientLifecycle:l.clientLifecycle||l.client_lifecycle||"",payoutTerms:l.payoutTerms||l.payout_terms||"",applied:l.applied||"",rejected:l.rejected||"",refused:l.refused||"",approved:l.approved||"",totalDeclaredTurnover:l.totalDeclaredTurnover||l.total_declared_turnover||"",avgOnboardingPeriod:l.avgOnboardingPeriod||l.avg_onboarding_period||"",onboardingTimeAmount:l.onboardingTimeAmount||l.onboarding_time_amount||""}},q=()=>{const l=a.servicesData||a.services_data||{};return{availableCurrencies:l.availableCurrencies||l.available_currencies||[],schemeAvailable:l.schemeAvailable||l.scheme_available||[],cardIssuingEnabled:l.cardIssuingEnabled??l.card_issuing_enabled??!1,cardForm:l.cardForm||l.card_form||"",virtualCardTokenization:l.virtualCardTokenization||l.virtual_card_tokenization||"",plasticCardTokenization:l.plasticCardTokenization||l.plastic_card_tokenization||"",sepaAccessType:l.sepaAccessType||l.sepa_access_type||[],swiftAccessType:l.swiftAccessType||l.swift_access_type||[],currenciesForPayments:l.currenciesForPayments||l.currencies_for_payments||[],cryptoAcquiring:l.cryptoAcquiring??l.crypto_acquiring??!1,massPayout:l.massPayout??l.mass_payout??!1,offlinePayment:l.offlinePayment??l.offline_payment??!1,link:l.link||a.website||"",payments:l.payments||[]}},se=()=>({name:a.name,country:a.country,account_type:a.accountType||a.account_type,license_type:a.licenseType||a.license_type,provider_role:a.providerRole||a.provider_role,target_client_type:a.targetClientType||a.target_client_type,income_model:a.incomeModel||a.income_model,public_media:a.publicMedia||a.public_media,rating:a.rating,website:a.website,registration_form_url:a.registrationFormUrl||a.registration_form_url||"",general_contacts:a.generalContacts||a.general_contacts,manager_contacts:a.managerContacts||a.manager_contacts,slug:a.slug||"",date_of_foundation:a.dateOfFoundation||a.date_of_foundation||"",opening_time:a.openingTime||a.opening_time||[],site_score:a.siteScore??a.site_score??null,total_score:a.totalScore??a.total_score??null,products:a.products||[],logo:a.logo||"",flag_image:a.flagImage||a.flag_image||"",description:a.description||"",about_content:a.aboutContent||a.about_content||{}}),Be={low:{details:se(),risk:k("low"),fees:I(),referral:O(),services:q()},middle:{details:se(),risk:k("middle"),fees:I(),referral:O(),services:q()},high:{details:se(),risk:k("high"),fees:I(),referral:O(),services:q()},highPlus:{details:se(),risk:k("highPlus"),fees:I(),referral:O(),services:q()}};o(Be),M(a.isFavorite||a.is_favorite||!1);const Le=a.additionalData||a.additional_data||{};C(ls(Le,a)),g({sourceStatus:a.sourceStatus||a.source_status||"ON_PLATFORM",supportedCountries:a.supportedCountries||a.supported_countries||[],supportedIndustries:a.supportedIndustries||a.supported_industries||[]})}}catch(a){console.error("Error loading provider:",a)}},ue=a=>{w(a)},Y=a=>{const k=m==="risk"?v:"low";o(I=>{var O;return{...I,[k]:{...I[k],[m]:{...(O=I[k])==null?void 0:O[m],...a}}}}),z(!0)},Ee=a=>{p(a)};f.useEffect(()=>{if(!ee)return;const a=k=>{k.preventDefault(),k.returnValue=""};return window.addEventListener("beforeunload",a),()=>window.removeEventListener("beforeunload",a)},[ee]);const ie=()=>{var k,I;const a=y.low.details||{};return{...Pe,name:a.name||"",country:a.country||"",type:"acquiring",account_type:a.account_type||"",license_type:a.license_type||"",provider_role:a.provider_role||a.providerRole||null,target_client_type:a.target_client_type||"",income_model:a.income_model||"",public_media:a.public_media||"",rating:a.rating||"",website:a.website||"",registration_form_url:a.registration_form_url||a.registrationFormUrl||"",general_contacts:a.general_contacts||[],manager_contacts:a.manager_contacts||[],is_favorite:u,risk_data:{low:y.low.risk||{},middle:y.middle.risk||{},high:y.high.risk||{},highPlus:y.highPlus.risk||{}}
1,fee_data:{...Ns(y.low.fees,js),categories:((k=y.low.fees)==null?void 0:k.categories)||{},individual:((I=y.low.fees)==null?void 0:I.individual)||{}},referral_data:y.low.referral||{},services_data:y.low.services||{},additional_data:ds(x),logo:x.logoUrl??a.logo??"",sourceStatus:d.sourceStatus||"ON_PLATFORM",supportedCountries:d.supportedCountries||[],supportedIndustries:d.supportedIndustries||[],slug:a.slug||"",date_of_foundation:a.date_of_foundation||a.dateOfFoundation||"",opening_time:a.opening_time||a.openingTime||[],site_score:a.site_score??a.siteScore??null,total_score:a.total_score??a.totalScore??null,products:a.products||[],description:a.description||"",flag_image:a.flag_image||a.flagImage||"",about_content:a.about_content||a.aboutContent||{}}},B=async()=>{t(!0);try{const a=ie();if(F)await V.update(F,a);else{const k=await V.create(a);window.history.replaceState({},"",X("CreateAcquiringProvider")+"?id="+k.id)}z(!1),S(!0),setTimeout(()=>S(!1),3e3)}catch(a){console.error("Error saving:",a),$.error(ne(a,"Error saving provider"))}finally{t(!1)}},L=((xe=y[m==="risk"?v:"low"])==null?void 0:xe[m])||{},Ie=is(F,L,y,"Add New Acquiring Provider"),{isRequestWhitelist:Me,isWhiteLabel:Oe}=ns({providerId:F,additionalData:x,setAdditionalData:C,loadedProvider:Ae,setLoadedProvider:me,setHasUnsavedChanges:z}),qe=async()=>{n(!0),S(!1);try{const a=ie();if(F)await V.update(F,a);
1else{const k=await V.create(a);window.history.replaceState({},"",X("CreateAcquiringProvider")+"?id="+k.id)}S(!0),z(!1),setTimeout(()=>S(!1),3e3)}catch(a){console.error("Error saving draft:",a),$.error(ne(a,"Error saving draft"))}finally{n(!1)}},ze=async()=>{var I,O;const a=((I=y.low.details)==null?void 0:I.name)||"",k=((O=y.low.details)==null?void 0:O.country)||"";if(!a.trim()){$.error("Please enter provider name"),p("details");return}if(!k.trim()){$.error("Please select a country"),p("details");return}t(!0);try{const q=ie();F?await V.update(F,q):await V.create(q),z(!1),de(!0)}catch(q){console.error("Error saving provider:",q),$.error(ne(q,"Error saving provider"))}finally{t(!1)}};return e.jsxs("div",{className:"min-h-full bg-page p-6",children:[e.jsxs("div",{className:"max-w-7xl mx-auto space-y-6",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm text-gray-600",children:[e.jsx("button",{onClick:()=>r(X("admin/providers")),className:"hover:text-blue-600",children:"Providers"}),e.jsx(je,{className:"w-4 h-4"}),e.jsx("button",{onClick:()=>r(X("admin/providers")),className:"hover:text-blue-600",children:"Acquiring"}),e.jsx(je,{className:"w-4 h-4"}),e.jsx("span",{className:"text-blue-600",children:F?L.name||"Edit Provider":"Add New Provider"})]}),e.jsx(cs,{title:Ie,isRequestWhitelist:Me,isWhiteLabel:Oe,draftSaved:E,savingDraft:c,onSaveDraft:qe,isFavorite:u,onFavoriteChange:a=>{M(a),z(!0)},hasUnsavedChanges:ee,leadingActions:e.jsx(os,{providerType:"acquiring",targetProviderId:F||void 0,onApplyField:De})}),e.jsxs("div",{className:"bg-white rounded-2xl shadow-sm",children:[e.jsx("div",{className:"border-b border-gray-200 px-6",children:e.jsx("div",{className:"flex items-center gap-8",children:_s.map(a=>e.jsx("button",{onClick:()=>Ee(a.id),className:_("py-4 font-medium border-b-2 transition-colors",m===a.id?"border-blue-600 text-blue-600":"border-transparent text-gray-600 hover:text-gray-900"),children:a.label},a.id))})}),m==="risk"&&e.jsx("div",{className:"px-6 pt-6",children:e.jsx("div",{className:"flex gap-3 border-b border-gray-200 -mx-6 px-6",children:ke.map(a=>e.jsx("button",{type:"button",onClick:()=>ue(a.id),className:_("px-6 py-3 font-medium text-sm transition-all border-b-2",v===a.id?"border-[#27D07E] text-[#27D07E]":"border-transparent text-gray-600 hover:text-gray-900"),children:a.label},a.id))})}),e.jsxs("div",{className:"p-6",children:[m==="details"&&e.jsx(ss,{data:L,onChange:Y,onSave:B,saving:s,hideRiskSelector:!0}),m==="risk"&&e.jsx(xs,{data:L,onChange:Y,onSave:B,saving:s}),m==="fees"&&e.jsx(gs,{data:L,onChange:Y,onSave:B,saving:s,activeRiskLevel:v,onRiskLevelChange:ue}),m==="referral"&&e.jsx(bs,{data:L,onChange:Y,onSave:B,saving:s}),m==="services"&&e.jsx(fs,{data:L,onChange:Y,onSave:B,saving:s}),m==="additional"&&e.jsx(as,{data:x,onChange:a=>{C(a),z(!0)},onSave:B,saving:s,providerType:"ACQUIRING"}),m==="countriesIndustries"&&e.jsx(rs,{data:d,onChange:a=>{g(a),z(!0)},onSave:B,saving:s})]}),e.jsx("div",{className:"px-6 pb-6 border-t border-gray-200 pt-6",children:e.jsx("div",{className:"flex items-center justify-end",children:m==="countriesIndustries"&&e.jsx(W,{onClick:ze,disabled:s,className:"bg-blue-600 hover:bg-blue-700 text-white px-8",children:s?"Creating...":F?"Update Provider":"Create Provider"})})})]})]}),e.jsx(ts,{isOpen:le,onClose:()=>{de(!1),r(X("admin/providers"))}})]})}export{Bs as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.