1import{r as m,p as t,L as p,T as x,B as h,bl as u,x as f,N as g,ag as v,v as w,aZ as j}from"./index-C9IH3k-2.js";import{P as T}from"./PageDescription-BrOUsEZE.js";import{R as C}from"./SyncOutlined-D8Vo-rc6.js";import{F as P}from"./Table-isZ0WXp4.js";import{T as S}from"./TemplateUtil-D1DzmWLm.js";import"./index-BOwvFOZJ.js";import"./Pagination-D1z-xPUv.js";import"./HolderOutlined-YOHjCGKZ.js";import"./Wrapper-ChjuDa3w.js";import"./HelperMethods-C-ewwU_x.js";const M=(n,o,c,s)=>({filterDropdown:({setSelectedKeys:i,selectedKeys:r,confirm:d,clearFilters:y,close:l})=>t.jsxs(p,{gap:"small",vertical:!0,style:{padding:8},onKeyDown:e=>e.stopPropagation(),children:[t.jsx(v,{ref:c,placeholder:`Search ${o}`,value:r[0],onChange:e=>i(e.target.value?[e.target.value]:[]),onPressEnter:()=>s(r,d,n)}),t.jsxs(w,{children:[t.jsx(h,{type:"primary",onClick:()=>s(r,d,n),icon:t.jsx(j,{}),size:"small",children:"Search"}),t.jsx(h,{type:"link",onClick:()=>l(),size:"small",children:"Close"})]})]}),onFilter:(i,r)=>r[n]?.toString().toLowerCase().includes(i.toLowerCase())}),L=()=>{const[n,o]=m.useState([]),[c,s]=m.useState(!1),i=m.useRef(),r=async()=>{s(!0);try{if((await f("/api/v1/whatsapp/metaPayment/syncConfig",!1))?.status===200)g.success("Payment methods synced successfully."),l();else throw new Error("Failed to sync payment methods.")}catch{g.error("Failed to sync payment methods. Please try again.")}finally{s(!1)}},y=[{title:"Configuration Name",dataIndex:"configuration_name",key:"configuration_name",...M("configuration_name","Configuration Name",i,(e,a,k)=>{a()})},{title:"Provider Name",dataIndex:"provider_name",key:"provider_name"},{title:"Status",dataIndex:"status",key:"status",filters:[{text:"Active",value:"Active"},{text:"Needs Connecting",value:"Needs Connecting"}],onFilter:(e,a)=>a.status===e,render:e=>t.jsx(S,{color:e==="Active"?"green":"red",children:e})},{title:"Creation Time",dataIndex:"creationTime",key:"creationTime",sorter:(e,a)=>u(e.creationTime).unix()-u(a.creationTime).unix(),render:e=>u(e).format("YYYY-MM-DD HH:mm")}],l=async()=>{try{s(!0);const e=await f("/api/v1/whatsapp/metaPayment/configs");e&&e.data?o(e.data):o([])}catch{o([])}finally{s(!1)}};return m.useEffect(()=>{l()},[]),t.jsxs(p,{vertical:!0,gap:"large",children:[t.jsxs(p,{justify:"space-between",wrap:!0,children:[t.jsx(x.Title,{level:4,style:{margin:0},children:"Meta Payment Method"}),t.jsx(p,{gap:"small",vertical:!0,children:t.jsx(h,{icon:t.jsx(C,{}),color:"primary",variant:"filled",onClick:r,loading:c,children:"Sync Payment Method"})})]}),t.jsx(T,{children:"This page displays a list of payment methods connected to your WhatsApp business account. These payment methods allow customers to make purchases directly through WhatsApp conversations. To set up payment methods, you need to configure them in your Meta Business Manager first, then sync them here. Payment configurations can be used for catalog orders, subscription renewals, and other transaction types."}),t.jsx(P,{columns:y,dataSource:n,rowKey:e=>e.id,pagination:{showQuickJumper:!0,showSizeChanger:!0,showTotal:(e,a)=>`${a[0]} - ${a[1]} of ${e} records`},loading:c,scroll:{x:"max-content"}})]})};export{L 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.