From 128e3960402b4d55c9bc0265c6e72db4d2d3d6bb Mon Sep 17 00:00:00 2001 From: dwindown Date: Sat, 18 Apr 2026 17:13:09 +0700 Subject: [PATCH] feat: migrate Coupons, Access, Customers, Licenses pages to full DataTable Update all admin listing pages to use the full-featured DataTable component: Coupons page: - All columns (ID, code, type, amount, usages, date limit, status) - Status filter (All, Active, Inactive) - Inline actions and bulk delete - Add New modal Access page: - All columns (ID, title, product, status, date) - Status filter (All, Published, Draft) - Inline actions and bulk delete - Add New modal Customers page: - All columns (ID, name, email, phone, total orders, date) - Read-only (no selection or inline actions) - Search and pagination Licenses page: - All columns (ID, license key, product, order, email, status) - Status labels (Active, Inactive, Expired) - Read-only (no selection or inline actions) - Search and pagination Co-authored-by: Claude Opus 4.7 --- build/admin.asset.php | 2 +- build/admin.js | 2 +- ...d607e5a8c6e67cbdc541cb3eac6504933d.json.gz | Bin 0 -> 1034 bytes ...1374b225048ab0d451abbe333d09fab460.json.gz | Bin 0 -> 700 bytes ...1e799ee018b9105f438b90f6d82a19ca75.json.gz | Bin 0 -> 2248 bytes ...20d20be3ba21f3d898ef1239e5e2e77ee8.json.gz | Bin 0 -> 896 bytes ...4f9833484004d3ebd442de956e40f29c90.json.gz | Bin 0 -> 1722 bytes ...46121966f836ee2a2fe60307338dc66c9a.json.gz | Bin 0 -> 2565 bytes ...ad9f7cebce4fc4fb80b7669ec46448a356.json.gz | Bin 0 -> 792 bytes ...f5948d308c8405ee75e2830902d6ede1e6.json.gz | Bin 0 -> 1957 bytes ...97c5192cc26b2eba9a88137a56f5241cad.json.gz | Bin 0 -> 2648 bytes src/admin/pages/Access.js | 64 ++++++------ src/admin/pages/Coupons.js | 93 +++++++++--------- src/admin/pages/Customers.js | 36 ++----- src/admin/pages/Licenses.js | 68 ++++--------- 15 files changed, 103 insertions(+), 162 deletions(-) create mode 100644 node_modules/.cache/babel-loader/0ad392e4a022a30eb82054a0147079d607e5a8c6e67cbdc541cb3eac6504933d.json.gz create mode 100644 node_modules/.cache/babel-loader/0b7882e19c8bdddd6808bd0b54fcd61374b225048ab0d451abbe333d09fab460.json.gz create mode 100644 node_modules/.cache/babel-loader/5a27f19ce1f1ca46b061d1feeb1df31e799ee018b9105f438b90f6d82a19ca75.json.gz create mode 100644 node_modules/.cache/babel-loader/6c8d197c6aef81da583f60809805cf20d20be3ba21f3d898ef1239e5e2e77ee8.json.gz create mode 100644 node_modules/.cache/babel-loader/757e005cd7d8064797f4acf3ee23694f9833484004d3ebd442de956e40f29c90.json.gz create mode 100644 node_modules/.cache/babel-loader/81bc671315573b551e0bfafda03cf846121966f836ee2a2fe60307338dc66c9a.json.gz create mode 100644 node_modules/.cache/babel-loader/8ff0b9507ffef823cde6831d73d204ad9f7cebce4fc4fb80b7669ec46448a356.json.gz create mode 100644 node_modules/.cache/babel-loader/bf45c8260791bbd05d8126d6c8542df5948d308c8405ee75e2830902d6ede1e6.json.gz create mode 100644 node_modules/.cache/babel-loader/d91b2b36e48ca7c0ebb556e15f0c5897c5192cc26b2eba9a88137a56f5241cad.json.gz diff --git a/build/admin.asset.php b/build/admin.asset.php index 8ec749820..bfa723a9d 100644 --- a/build/admin.asset.php +++ b/build/admin.asset.php @@ -1 +1 @@ - array('react', 'wp-components', 'wp-element', 'wp-i18n', 'wp-icons/build/arrow-left', 'wp-icons/build/bell', 'wp-icons/build/eye-closed', 'wp-icons/build/eye-opened', 'wp-icons/build/list', 'wp-icons/build/message', 'wp-icons/build/minus', 'wp-icons/build/plus', 'wp-icons/build/trash', 'wp-icons/build/visible'), 'version' => '164b137f81dde0451242'); + array('react', 'wp-components', 'wp-element', 'wp-i18n', 'wp-icons/build/arrow-left', 'wp-icons/build/bell', 'wp-icons/build/eye-closed', 'wp-icons/build/eye-opened', 'wp-icons/build/list', 'wp-icons/build/message', 'wp-icons/build/minus', 'wp-icons/build/plus', 'wp-icons/build/trash', 'wp-icons/build/visible'), 'version' => 'ea8676d843297ad5e987'); diff --git a/build/admin.js b/build/admin.js index 0bc890956..361525c3f 100644 --- a/build/admin.js +++ b/build/admin.js @@ -1 +1 @@ -(()=>{"use strict";var e={n:t=>{var a=t&&t.__esModule?()=>t.default:()=>t;return e.d(a,{a}),a},d:(t,a)=>{for(var n in a)e.o(a,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:a[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t)};const t=window.React,a=window.wp.element,n=window.wp.i18n,r=window.wp.components,l=(0,a.forwardRef)(function({icon:e,size:t=24,...n},r){return(0,a.cloneElement)(e,{width:t,height:t,...n,ref:r})}),o=window.wp["icons/build/list"];var i=e.n(o);const c=window.formipayAdmin?.ajaxUrl||"/wp-admin/admin-ajax.php",s=window.formipayAdmin?.nonce||"";async function m(e,t={}){const a=new FormData;a.append("action",e),a.append("_wpnonce",s),Object.keys(t).forEach(e=>{"object"==typeof t[e]?a.append(e,JSON.stringify(t[e])):a.append(e,t[e])}),console.log(`[AJAX] Sending request: ${e}`,{nonce:s,data:t});try{const t=await fetch(c,{method:"POST",credentials:"same-origin",body:a});console.log(`[AJAX] Response status: ${e}`,t.status);const n=await t.json();if(console.log(`[AJAX] Response data: ${e}`,n),!t.ok||!1===n.success){const e=n.data?.message||n.message||"Request failed";throw new Error(e)}return n}catch(t){throw console.error(`AJAX error [${e}]:`,t),t}}window.formipayAdmin;const d=window.wp["icons/build/visible"];var p=e.n(d);const u={"on-hold":"#f0ad4e","payment-confirm":"#17a2b8","in-progress":"#17a2b8",shipping:"#6c757d",completed:"#28a745",failed:"#dc3545",refunded:"#6c757d",cancelled:"#dc3545"},f={"on-hold":(0,n.__)("On Hold","formipay"),"payment-confirm":(0,n.__)("Payment Confirmed","formipay"),"in-progress":(0,n.__)("In Progress","formipay"),shipping:(0,n.__)("Shipping","formipay"),completed:(0,n.__)("Completed","formipay"),failed:(0,n.__)("Failed","formipay"),refunded:(0,n.__)("Refunded","formipay"),cancelled:(0,n.__)("Cancelled","formipay")};function y({order:e,onSelect:a}){const r=u[e.status]||"#6c757d",o=f[e.status]||e.status,i=(e=>{if(e.form_data){const t=Object.values(e.form_data).find(e=>e.name&&e.name.includes("name"));return t?.value||"-"}return"-"})(e);return(0,t.createElement)("tr",{className:"formipay-order-item"},(0,t.createElement)("td",null,(0,t.createElement)("strong",null,"#",e.id)),(0,t.createElement)("td",null,(c=e.created_date)?new Date(c).toLocaleDateString():"-"),(0,t.createElement)("td",null,"-"!==i?i:(0,t.createElement)("em",null,"Unknown")),(0,t.createElement)("td",null,(0,t.createElement)("strong",null,e.total_formatted||e.total)),(0,t.createElement)("td",null,(0,t.createElement)("span",{className:"status-badge",style:{backgroundColor:r}},o)),(0,t.createElement)("td",null,(0,t.createElement)("button",{type:"button",className:"button button-small",onClick:a},(0,t.createElement)(l,{icon:p()(),size:16}),(0,n.__)("View","formipay"))));var c}function _({onSelectOrder:e}){const[o,c]=(0,a.useState)([]),[s,d]=(0,a.useState)(!0),[p,u]=(0,a.useState)(0),[f,_]=(0,a.useState)({keyword:"",status:"",date_from:"",date_to:""}),[E,h]=(0,a.useState)({limit:20,offset:0}),b=(0,a.useCallback)(()=>{d(!0),((e={})=>m("formipay-tabledata-orders",e))({keyword:f.keyword,status:f.status,date_from:f.date_from,date_to:f.date_to,limit:E.limit,offset:E.offset}).then(e=>{e.data&&(c(e.data.results||[]),u(e.data.total||0))}).catch(e=>{console.error("Load orders error:",e)}).finally(()=>{d(!1)})},[f,E]);(0,a.useEffect)(()=>{b()},[b]);const g=(e,t)=>{_({...f,[e]:t}),h({...E,offset:0})},w=e=>{h({...E,offset:e})},v={"":(0,n.__)("All Statuses","formipay"),"on-hold":(0,n.__)("On Hold","formipay"),"payment-confirm":(0,n.__)("Payment Confirmed","formipay"),"in-progress":(0,n.__)("In Progress","formipay"),shipping:(0,n.__)("Shipping","formipay"),completed:(0,n.__)("Completed","formipay"),failed:(0,n.__)("Failed","formipay"),refunded:(0,n.__)("Refunded","formipay"),cancelled:(0,n.__)("Cancelled","formipay")},N=Math.ceil(p/E.limit),k=Math.floor(E.offset/E.limit)+1;return(0,t.createElement)("div",{className:"formipay-order-list"},(0,t.createElement)("div",{className:"formipay-orders-header"},(0,t.createElement)("h2",null,(0,t.createElement)(l,{icon:i()()}),(0,n.__)("Orders","formipay")),(0,t.createElement)("span",{className:"order-count"},p," ",(0,n.__)("orders","formipay"))),(0,t.createElement)("div",{className:"formipay-orders-filters"},(0,t.createElement)(r.SearchControl,{value:f.keyword,onChange:e=>{g("keyword",e)},placeholder:(0,n.__)("Search by order ID, customer name, email...","formipay")}),(0,t.createElement)(r.SelectControl,{value:f.status,options:Object.entries(v).map(([e,t])=>({value:e,label:t})),onChange:e=>g("status",e),label:(0,n.__)("Status","formipay")}),(0,t.createElement)("input",{type:"date",value:f.date_from,onChange:e=>g("date_from",e.target.value),className:"formipay-date-input"}),(0,t.createElement)("input",{type:"date",value:f.date_to,onChange:e=>g("date_to",e.target.value),className:"formipay-date-input"}),(f.keyword||f.status||f.date_from||f.date_to)&&(0,t.createElement)(r.Button,{variant:"secondary",onClick:()=>{_({keyword:"",status:"",date_from:"",date_to:""}),h({limit:20,offset:0})}},(0,n.__)("Clear Filters","formipay"))),(0,t.createElement)("div",{className:"formipay-orders-table-wrapper"},s?(0,t.createElement)("div",{className:"formipay-loading"},(0,t.createElement)("span",{className:"spinner is-active"})):0===o.length?(0,t.createElement)("div",{className:"formipay-no-results"},(0,t.createElement)("p",null,(0,n.__)("No orders found","formipay"))):(0,t.createElement)(t.Fragment,null,(0,t.createElement)("table",{className:"formipay-orders-table wp-list-table widefat fixed striped"},(0,t.createElement)("thead",null,(0,t.createElement)("tr",null,(0,t.createElement)("th",null,(0,n.__)("ID","formipay")),(0,t.createElement)("th",null,(0,n.__)("Date","formipay")),(0,t.createElement)("th",null,(0,n.__)("Customer","formipay")),(0,t.createElement)("th",null,(0,n.__)("Total","formipay")),(0,t.createElement)("th",null,(0,n.__)("Status","formipay")),(0,t.createElement)("th",null,(0,n.__)("Actions","formipay")))),(0,t.createElement)("tbody",null,o.map(a=>(0,t.createElement)(y,{key:a.id,order:a,onSelect:()=>e?.(a.id)})))),N>1&&(0,t.createElement)("div",{className:"formipay-pagination"},(0,t.createElement)(r.Button,{variant:"secondary",disabled:1===k,onClick:()=>w(E.offset-E.limit)},(0,n.__)("Previous","formipay")),(0,t.createElement)("span",{className:"pagination-info"},(0,n.__)("Page","formipay")," ",k," ",(0,n.__)("of","formipay")," ",N),(0,t.createElement)(r.Button,{variant:"secondary",disabled:k===N,onClick:()=>w(E.offset+E.limit)},(0,n.__)("Next","formipay"))))))}const E=window.wp["icons/build/arrowLeft"];var h=e.n(E);const b=window.wp["icons/build/trash"];var g=e.n(b);const w=["on-hold","payment-confirm","in-progress","shipping","completed"],v={"on-hold":(0,n.__)("On Hold","formipay"),"payment-confirm":(0,n.__)("Payment Confirmed","formipay"),"in-progress":(0,n.__)("In Progress","formipay"),shipping:(0,n.__)("Shipping","formipay"),completed:(0,n.__)("Completed","formipay"),failed:(0,n.__)("Failed","formipay"),refunded:(0,n.__)("Refunded","formipay"),cancelled:(0,n.__)("Cancelled","formipay")};function N({orderId:e}){const[r,l]=(0,a.useState)([]);return(0,a.useEffect)(()=>{const e=[{status:"on-hold",date:(new Date).toISOString(),note:(0,n.__)("Order placed","formipay")}];l(e)},[e]),(0,t.createElement)("div",{className:"formipay-order-timeline"},(0,t.createElement)("h3",null,(0,n.__)("Order Timeline","formipay")),(0,t.createElement)("div",{className:"timeline-progress"},w.map((e,a)=>(0,t.createElement)("div",{key:e,className:`timeline-step ${0===a?"first":""} ${a===w.length-1?"last":""}`},(0,t.createElement)("div",{className:"timeline-dot"}),a(0,t.createElement)("li",{key:a},(0,t.createElement)("span",{className:"event-status"},v[e.status]||e.status),(0,t.createElement)("span",{className:"event-date"},new Date(e.date).toLocaleString()),e.note&&(0,t.createElement)("span",{className:"event-note"},e.note))))))}const k=window.wp["icons/build/bell"];var S=e.n(k);const C=window.wp["icons/build/message"];var D=e.n(C);function A(){const e=[{id:1,type:"email",recipient:"customer@example.com",subject:"Order Confirmation",status:"sent",date:(new Date).toISOString()}],a=e=>{switch(e){case"email":default:return S()();case"sms":case"whatsapp":return D()()}};return(0,t.createElement)("div",{className:"formipay-notification-log"},(0,t.createElement)("h3",null,(0,t.createElement)(l,{icon:S()(),size:18}),(0,n.__)("Notification Log","formipay")),0===e.length?(0,t.createElement)("p",{className:"no-logs"},(0,n.__)("No notifications sent yet","formipay")):(0,t.createElement)("ul",{className:"notification-list"},e.map(e=>(0,t.createElement)("li",{key:e.id,className:`notification-item ${e.status}`},(0,t.createElement)("div",{className:"notification-icon"},(0,t.createElement)(l,{icon:a(e.type),size:20})),(0,t.createElement)("div",{className:"notification-content"},(0,t.createElement)("div",{className:"notification-header"},(0,t.createElement)("span",{className:"notification-type"},e.type.toUpperCase()),(0,t.createElement)("span",{className:"notification-status"},e.status)),(0,t.createElement)("div",{className:"notification-details"},(0,t.createElement)("strong",null,e.subject||e.type),(0,t.createElement)("span",{className:"notification-recipient"},(0,n.__)("To:","formipay")," ",e.recipient)),(0,t.createElement)("div",{className:"notification-date"},new Date(e.date).toLocaleString()))))))}const I=[{value:"on-hold",label:(0,n.__)("On Hold","formipay")},{value:"payment-confirm",label:(0,n.__)("Payment Confirmed","formipay")},{value:"in-progress",label:(0,n.__)("In Progress","formipay")},{value:"shipping",label:(0,n.__)("Shipping","formipay")},{value:"completed",label:(0,n.__)("Completed","formipay")},{value:"failed",label:(0,n.__)("Failed","formipay")},{value:"refunded",label:(0,n.__)("Refunded","formipay")},{value:"cancelled",label:(0,n.__)("Cancelled","formipay")}];function P({orderId:e,onBack:o}){const[i,c]=(0,a.useState)(null),[s,d]=(0,a.useState)(!0),[p,u]=(0,a.useState)(!1),[f,y]=(0,a.useState)(""),_=(0,a.useCallback)(()=>{d(!0),(e=>m("formipay-get-order",{order_id:e}))(e).then(e=>{e.data&&(c(e.data),y(e.data.status))}).catch(e=>{console.error("Load order error:",e)}).finally(()=>{d(!1)})},[e]);return(0,a.useEffect)(()=>{_()},[_]),s?(0,t.createElement)("div",{className:"formipay-order-detail"},(0,t.createElement)("div",{className:"formipay-loading"},(0,t.createElement)("span",{className:"spinner is-active"}))):i?(0,t.createElement)("div",{className:"formipay-order-detail"},(0,t.createElement)("div",{className:"formipay-detail-header"},(0,t.createElement)(r.Button,{variant:"secondary",onClick:o},(0,t.createElement)(l,{icon:h()(),size:16}),(0,n.__)("Back","formipay")),(0,t.createElement)("h1",null,(0,n.__)("Order","formipay")," #",i.id),(0,t.createElement)("div",{className:"header-actions"},(0,t.createElement)(r.Button,{variant:"secondary",isDestructive:!0,onClick:()=>{var t;confirm((0,n.__)("Are you sure you want to delete this order?","formipay"))&&(t=[e],m("formipay-bulk-delete-order",{ids:t})).then(e=>{e.success&&o?.()}).catch(e=>{console.error("Delete order error:",e)})}},(0,t.createElement)(l,{icon:g()(),size:16}),(0,n.__)("Delete","formipay")))),(0,t.createElement)("div",{className:"formipay-detail-content"},(0,t.createElement)("div",{className:"formipay-detail-main"},(0,t.createElement)("div",{className:"formipay-detail-card"},(0,t.createElement)("h3",null,(0,n.__)("Order Details","formipay")),(0,t.createElement)("dl",{className:"detail-list"},(0,t.createElement)("div",null,(0,t.createElement)("dt",null,(0,n.__)("Status","formipay")),(0,t.createElement)("dd",null,(0,t.createElement)(r.SelectControl,{value:f,options:I,onChange:y,disabled:p}),f!==i.status&&(0,t.createElement)(r.Button,{variant:"primary",size:"small",onClick:()=>{f&&f!==i.status&&(u(!0),((e,t)=>m("formipay-update-order-status",{order_id:e,status:t}))(e,f).then(e=>{(e.success||e.data?.valid)&&_()}).catch(e=>{console.error("Update status error:",e)}).finally(()=>{u(!1)}))},disabled:p,isBusy:p},p?(0,n.__)("Updating...","formipay"):(0,n.__)("Update Status","formipay")))),(0,t.createElement)("div",null,(0,t.createElement)("dt",null,(0,n.__)("Date Created","formipay")),(0,t.createElement)("dd",null,(E=i.created_date)?new Date(E).toLocaleString():"-")),(0,t.createElement)("div",null,(0,t.createElement)("dt",null,(0,n.__)("Form ID","formipay")),(0,t.createElement)("dd",null,i.form_id)),(0,t.createElement)("div",null,(0,t.createElement)("dt",null,(0,n.__)("Payment Gateway","formipay")),(0,t.createElement)("dd",null,i.payment_gateway||"-")))),(0,t.createElement)("div",{className:"formipay-detail-card"},(0,t.createElement)("h3",null,(0,n.__)("Items","formipay")),(0,t.createElement)("table",{className:"items-table"},(0,t.createElement)("thead",null,(0,t.createElement)("tr",null,(0,t.createElement)("th",null,(0,n.__)("Item","formipay")),(0,t.createElement)("th",null,(0,n.__)("Qty","formipay")),(0,t.createElement)("th",null,(0,n.__)("Subtotal","formipay")))),(0,t.createElement)("tbody",null,i.items?.map((e,a)=>(0,t.createElement)("tr",{key:a},(0,t.createElement)("td",null,(0,t.createElement)("strong",null,e.item),e.description&&(0,t.createElement)("small",null,e.description)),(0,t.createElement)("td",null,e.qty||1),(0,t.createElement)("td",null,e.subtotal_formatted||e.subtotal)))||(0,t.createElement)("tr",null,(0,t.createElement)("td",{colSpan:"3",className:"text-center"},(0,n.__)("No items","formipay")))),(0,t.createElement)("tfoot",null,(0,t.createElement)("tr",null,(0,t.createElement)("td",{colSpan:"2"},(0,t.createElement)("strong",null,(0,n.__)("Total","formipay"))),(0,t.createElement)("td",null,(0,t.createElement)("strong",null,i.total_formatted||i.total))))))),(0,t.createElement)("div",{className:"formipay-detail-sidebar"},(0,t.createElement)("div",{className:"formipay-detail-card"},(0,t.createElement)("h3",null,(0,n.__)("Customer Information","formipay")),i.form_data?(0,t.createElement)("dl",{className:"customer-info"},Object.entries(i.form_data).map(([e,a])=>["payment","payment_gateway","coupon_code","qty"].includes(e)?null:(0,t.createElement)("div",{key:e},(0,t.createElement)("dt",null,e.replace(/_/g," ")),(0,t.createElement)("dd",null,a?.value||a||"-")))):(0,t.createElement)("p",{className:"no-data"},(0,n.__)("No customer data available","formipay"))),(0,t.createElement)(N,{orderId:e}),(0,t.createElement)(A,null)))):(0,t.createElement)("div",{className:"formipay-order-detail"},(0,t.createElement)("div",{className:"formipay-error"},(0,t.createElement)("p",null,(0,n.__)("Order not found","formipay")),(0,t.createElement)(r.Button,{variant:"secondary",onClick:o},(0,t.createElement)(l,{icon:h()(),size:16}),(0,n.__)("Back to Orders","formipay"))));var E}const O=window.Swal;function T({initialData:e=[],columns:l,filterOptions:o=null,statusCounts:i=null,searchable:c=!0,searchPlaceholder:s=(0,n.__)("Search...","formipay"),sortable:m=!0,defaultSort:d={id:"ID",desc:!0},selectable:p=!0,pagination:u=!0,pageSize:f=10,pageSizeOptions:y=[10,20,50,100],actions:_={addNew:!1,bulkDelete:!0,inline:!0},emptyMessage:E=(0,n.__)("No items found","formipay"),ajaxUrl:h,nonce:b,tableAction:g,deleteAction:w,duplicateAction:v}){const[N,k]=(0,a.useState)(e),[S,C]=(0,a.useState)(!0),[D,A]=(0,a.useState)(0),[I,P]=(0,a.useState)("all"),[T,x]=(0,a.useState)(""),[B,L]=(0,a.useState)(d.id||"ID"),[$,F]=(0,a.useState)(d.desc?"desc":"asc"),[j,U]=(0,a.useState)(1),[M,R]=(0,a.useState)(f),[z,J]=(0,a.useState)(new Set),[q,H]=(0,a.useState)(!1),[X,V]=(0,a.useState)(!1),[Z,G]=(0,a.useState)(""),K=g.replace("formipay-tabledata-",""),Q=_.bulkDelete?.action||`formipay-bulk-delete-${K}`,W=w||`formipay-delete-${K}`,Y=v||`formipay-duplicate-${K}`,ee=(0,a.useCallback)(async()=>{C(!0);const e=new URLSearchParams({action:g,_wpnonce:b,limit:M.toString(),offset:((j-1)*M).toString()});o&&"all"!==I&&e.append(o.key,I),T&&e.append("search",T),e.append("orderby",B),e.append("sort",$);try{const t=await fetch(`${h}?${e.toString()}`,{method:"POST",credentials:"same-origin",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:e}),a=await t.json(),n=a.data?.results||a.results||a.data||[];k(n),A(a.total||n.length)}catch(e){console.error("Load data error:",e)}finally{C(!1)}},[h,b,g,M,j,I,T,B,$,o]);return(0,a.useEffect)(()=>{ee()},[ee]),(0,a.useEffect)(()=>{const e=setTimeout(()=>{null!==T&&U(1)},500);return()=>clearTimeout(e)},[T]),(0,t.createElement)("div",{className:"formipay-data-table-wrapper"},(0,t.createElement)("div",{className:"formipay-table-toolbar"},_.addNew&&(0,t.createElement)(r.Button,{variant:"primary",onClick:()=>V(!0)},_.addNew.label||(0,n.__)("+ Add New","formipay")),_.bulkDelete&&p&&z.size>0&&(0,t.createElement)(r.Button,{variant:"secondary",isDestructive:!0,onClick:async()=>{0!==z.size&&(await O.fire({icon:"info",html:(0,n.__)("Do you want to delete the selected item(s)?","formipay"),showCancelButton:!0,confirmButtonText:(0,n.__)("Confirm","formipay"),cancelButtonText:(0,n.__)("Cancel","formipay")})).isConfirmed&&(await fetch(`${h}?action=${Q}`,{method:"POST",credentials:"same-origin",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams({ids:Array.from(z),_wpnonce:b})}),J(new Set),H(!1),ee(),O.fire({title:(0,n.__)("Done!","formipay"),html:(0,n.__)("Items deleted successfully.","formipay"),icon:"success"}))}},(0,n.__)("Delete Selected","formipay")," (",z.size,")"),c&&(0,t.createElement)(r.TextControl,{placeholder:s,value:T,onChange:x,className:"formipay-table-search"}),m&&(0,t.createElement)(r.SelectControl,{value:`${B}-${$}`,options:[{label:(0,n.__)("ID ↓","formipay"),value:"ID-desc"},{label:(0,n.__)("ID ↑","formipay"),value:"ID-asc"},{label:(0,n.__)("Date ↓","formipay"),value:"date-desc"},{label:(0,n.__)("Date ↑","formipay"),value:"date-asc"},{label:(0,n.__)("Title A-Z","formipay"),value:"title-asc"},{label:(0,n.__)("Title Z-A","formipay"),value:"title-desc"}],onChange:e=>{const[t,a]=e.split("-");L(t),F(a)}})),o&&(0,t.createElement)("div",{className:"formipay-filter-tabs"},o.options.map(e=>(0,t.createElement)("button",{key:e.value,className:"filter-tab "+(I===e.value?"active":""),onClick:()=>{return t=e.value,P(t),void U(1);var t}},e.label,i&&(0,t.createElement)("span",{className:"count"},i[e.value]||0)))),(0,t.createElement)("div",{className:"formipay-table-container"},S?(0,t.createElement)("div",{className:"formipay-table-loading"},(0,t.createElement)(r.Spinner,null)):0===N.length?(0,t.createElement)("div",{className:"formipay-table-empty"},E):(0,t.createElement)("table",{className:"formipay-table wp-list-table widefat fixed striped"},(0,t.createElement)("thead",null,(0,t.createElement)("tr",null,p&&(0,t.createElement)("th",{className:"column-select"},(0,t.createElement)("input",{type:"checkbox",checked:q,onChange:()=>{J(q?new Set:new Set(N.map(e=>e.ID||e.id))),H(!q)}})),l.map(e=>(0,t.createElement)("th",{key:e.key,className:`column-${e.key}`},e.label)),_.inline&&(0,t.createElement)("th",{className:"column-actions"},(0,n.__)("Actions","formipay")))),(0,t.createElement)("tbody",null,N.map((e,a)=>{const r=e.ID||e.id;return(0,t.createElement)("tr",{key:a,className:"formipay-table-row"},p&&(0,t.createElement)("td",null,(0,t.createElement)("input",{type:"checkbox",checked:z.has(r),onChange:()=>(e=>{const t=new Set(z);t.has(e)?t.delete(e):t.add(e),J(t),H(!1)})(r)})),l.map(a=>(0,t.createElement)("td",{key:a.key},a.render?a.render(e):e[a.key])),_.inline&&(0,t.createElement)("td",{className:"column-actions"},(0,t.createElement)("div",{className:"row-actions"},(0,t.createElement)("a",{href:`${window.formipayAdmin?.siteUrl||""}/wp-admin/post.php?post=${r}&action=edit`},(0,n.__)("Edit","formipay"))," | ",(0,t.createElement)("button",{className:"button-link delete",onClick:()=>(async e=>{(await O.fire({icon:"info",html:(0,n.__)("Do you want to delete this item?","formipay"),showCancelButton:!0,confirmButtonText:(0,n.__)("Delete Permanently","formipay"),cancelButtonText:(0,n.__)("Cancel","formipay")})).isConfirmed&&(await fetch(`${h}?action=${W}`,{method:"POST",credentials:"same-origin",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams({id:e,_wpnonce:b})}),ee())})(r)},(0,n.__)("Delete","formipay"))," | ",(0,t.createElement)("button",{className:"button-link duplicate",onClick:()=>(async e=>{(await O.fire({icon:"info",html:(0,n.__)("Do you want to duplicate this item?","formipay"),showCancelButton:!0,confirmButtonText:(0,n.__)("Confirm","formipay"),cancelButtonText:(0,n.__)("Cancel","formipay")})).isConfirmed&&(await fetch(`${h}?action=${Y}`,{method:"POST",credentials:"same-origin",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams({id:e,_wpnonce:b})}),ee())})(r)},(0,n.__)("Duplicate","formipay")))))})))),u&&D>M&&(0,t.createElement)("div",{className:"formipay-table-pagination"},(0,t.createElement)("div",{className:"pagination-info"},(0,n.__)("Showing","formipay")," ",(j-1)*M+1," - ",Math.min(j*M,D)," ",(0,n.__)("of","formipay")," ",D),(0,t.createElement)("div",{className:"pagination-controls"},(0,t.createElement)(r.Button,{variant:"secondary",disabled:1===j,onClick:()=>U(1)},"««"),(0,t.createElement)(r.Button,{variant:"secondary",disabled:1===j,onClick:()=>U(j-1)},"‹"),(0,t.createElement)("span",{className:"page-info"},(0,n.__)("Page","formipay")," ",j," ",(0,n.__)("of","formipay")," ",Math.ceil(D/M)),(0,t.createElement)(r.Button,{variant:"secondary",disabled:j>=Math.ceil(D/M),onClick:()=>U(j+1)},"›"),(0,t.createElement)(r.Button,{variant:"secondary",disabled:j>=Math.ceil(D/M),onClick:()=>U(Math.ceil(D/M))},"»"),(0,t.createElement)(r.SelectControl,{value:M.toString(),options:y.map(e=>({label:e.toString(),value:e.toString()})),onChange:e=>{R(parseInt(e)),U(1)}}))),_.addNew&&(0,t.createElement)(r.Modal,{title:_.addNew.label||(0,n.__)("Add New","formipay"),isOpen:X,onClose:()=>V(!1)},(0,t.createElement)(r.TextControl,{label:(0,n.__)("Title","formipay"),value:Z,onChange:G,autoFocus:!0}),(0,t.createElement)("div",{className:"formipay-modal-actions"},(0,t.createElement)(r.Button,{variant:"secondary",onClick:()=>V(!1)},(0,n.__)("Cancel","formipay")),(0,t.createElement)(r.Button,{variant:"primary",onClick:async()=>{if(!Z.trim())return void O.fire({html:(0,n.__)("Title is required.","formipay"),icon:"error"});const e=_.addNew.action,t=await fetch(`${h}?action=${e}`,{method:"POST",credentials:"same-origin",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams({title:Z,_wpnonce:b})}),a=await t.json();a.success?(V(!1),G(""),a.data.edit_post_url?window.location.href=a.data.edit_post_url:ee()):O.fire({html:a.data.message||(0,n.__)("Error creating item.","formipay"),icon:"error"})}},(0,n.__)("Create","formipay")))))}const x=window.wp["icons/build/plus"];var B=e.n(x);const L=window.wp["icons/build/minus"];var $=e.n(L);const F=window.wp["icons/build/eyeClosed"];var j=e.n(F);const U=window.wp["icons/build/eyeOpened"];var M=e.n(U);function R({productId:e,productDetails:r}){const[l,o]=(0,a.useState)([]),[i,c]=(0,a.useState)([]),[s,m]=(0,a.useState)(!0),d=(0,a.useRef)(null),p=(0,a.useRef)(null),u=(0,a.useRef)(null),f=(0,a.useCallback)(()=>String(r?.default_currency||"").split(":::")[0]||r?.default_currency_code||"USD",[r]),y=(0,a.useCallback)(e=>{const t=r?.global_currencies||[],a=String(e).split(":::")[0],n=t.find(e=>String(e.currency).split(":::")[0]===a);return parseInt(n?.decimal_digits,10)||2},[r]),_=(0,a.useCallback)(()=>{const e=r?.global_selected_currencies||{};let t=Object.keys(e);if(!t.length){const e=r?.default_currency||"";e&&(t=[e])}return t.map(e=>{const t=String(e).split(":::")[0];return{currency:e,regular_price:"",sale_price:"",currency_decimal_digits:y(t)}})},[r,y]),E=(0,a.useCallback)(e=>{const t={...e};void 0===t.expanded&&(t.expanded=!1);const a=_(),n=e=>String(e).split(":::")[0];if(Array.isArray(t.prices)){const e=new Set(a.map(e=>n(e.currency)));t.prices=t.prices.filter(t=>t&&e.has(n(t.currency))),a.forEach(e=>{const a=n(e.currency);t.prices.some(e=>n(e.currency)===a)||t.prices.push(JSON.parse(JSON.stringify(e)))})}else t.prices=JSON.parse(JSON.stringify(a));Array.isArray(t.prices)&&0!==t.prices.length||(t.prices=JSON.parse(JSON.stringify(a))),t.prices.forEach(e=>{const t=n(e.currency);e.currency_decimal_digits=y(t),void 0!==e.regular_price&&null!==e.regular_price||(e.regular_price=""),void 0!==e.sale_price&&null!==e.sale_price||(e.sale_price="")});const r=f();return t.prices.sort((e,t)=>n(e.currency)===r?-1:n(t.currency)===r?1:0),delete t.price,delete t.sale,t},[_,y,f]),h=(0,a.useCallback)(()=>new Promise(e=>{let t=0;const a=setInterval(()=>{const n=document.querySelector('input[name="product_variation_attributes"]');if(n&&n.value)try{const t=JSON.parse(n.value);clearInterval(a),e(Array.isArray(t)?t:[])}catch(t){clearInterval(a),e([])}else++t>=100&&(clearInterval(a),e([]))},50)}),[]),b=(0,a.useCallback)(e=>{const t=e.map(e=>(e.attribute_variations||[]).map(e=>({label:e.variation_label}))).filter(e=>e.length>0);return t.length?t.reduce((e,t)=>e.flatMap(e=>t.map(t=>[].concat(e,t)))).map(e=>{const t=Array.isArray(e)?e.map(e=>e.label):[e.label];return{key:t.join("||"),label:t.join(" - ")}}):[]},[]),g=(0,a.useCallback)(async()=>{try{const e=await h();if(!e.length)return o([]),void w([]);const t=b(e).filter(e=>!i.includes(e.key)).map(e=>{const t=l.find(t=>t.key===e.key);return t?Object.assign(E(t),{name:e.label}):E({key:e.key,name:e.label,stock:"",weight:0,active:!0})});o(t),w(t)}catch(e){console.warn("Attributes not available; initializing empty variations."),o([]),w([])}},[h,b,i,l,E]),w=(0,a.useCallback)(e=>{d.current&&(d.current.value=JSON.stringify(e||[]))},[]),v=(0,a.useCallback)(async()=>{if(e)try{const t=new FormData;t.append("action","get_product_variables"),t.append("post_id",e),t.append("_wpnonce",window.formipayAdmin?.nonce||"");const a=await fetch(window.formipayAdmin?.ajaxUrl||"/wp-admin/admin-ajax.php",{method:"POST",credentials:"same-origin",body:t}),n=await a.json();if(n.success&&Array.isArray(n.data)&&n.data.length){const e=n.data.map(e=>E(e));o(e),c([]),w(e)}else await g()}catch{await g()}else await g()},[e,E,g,w]),N=(0,a.useCallback)(()=>{const e=()=>{setTimeout(()=>{g()},200)},t=document.querySelector('input[name="product_variation_attributes"]');if(t){t.addEventListener("input",e),t.addEventListener("change",e);const a=new MutationObserver(e);a.observe(t,{attributes:!0,attributeFilter:["value"]}),u.current=a,p.current=setInterval(()=>{const t=document.querySelector('input[name="product_variation_attributes"]');t&&t.value!==d.current?.value&&e()},300)}return()=>{u.current&&u.current.disconnect(),p.current&&clearInterval(p.current)}},[g]);(0,a.useEffect)(()=>{const e=r?.multicurrency,t=r?.global_selected_currencies||{},a=Object.keys(t).length;return m(!e||a<=1),v(),N()},[r,v,N]);const k=(0,a.useCallback)((e,t,a,n)=>{const r=[...l];r[e].prices[t][a]=n,o(r),w(r)},[l,w]),S=(0,a.useCallback)(e=>{const t=[...l];t[e].expanded=!t[e].expanded,o(t)},[l]),C=(0,a.useCallback)((e,t,a)=>{const n=[...l];n[e][t]=a,o(n),w(n)},[l,w]),D=(0,a.useCallback)(e=>{const t=l[e],a=[...i,t.key];c(a);const n=l.filter((t,a)=>a!==e);o(n),w(n)},[l,i,w]),A=(0,a.useCallback)(()=>{const e=f();for(const t of l){const a=t.prices?.find(t=>String(t.currency).split(":::")[0]===e);if(!a||!a.regular_price)return{currencyCode:e,rowLabel:t.name}}return null},[l,f]);return(0,a.useEffect)(()=>{const e=document.getElementById("post");if(!e)return;const t=e=>{const t=A();if(t){e.preventDefault(),e.stopImmediatePropagation();const a=(r?.variation_table?.error_missing_default_price||'Please fill Regular Price for default currency (%1$s) in variation "%2$s".').replace("%1$s",t.currencyCode).replace("%2$s",t.rowLabel);return alert(a),!1}};return e.addEventListener("submit",t,!0),()=>e.removeEventListener("submit",t,!0)},[A,r]),(0,t.createElement)(t.Fragment,null,(0,t.createElement)("input",{ref:d,type:"hidden",name:"product_variation_variables",value:JSON.stringify(l)}),(0,t.createElement)("table",{className:"formipay-variation-table",id:"product-variables-table"},(0,t.createElement)("thead",null,(0,t.createElement)("tr",null,(0,t.createElement)("th",null,(0,n.__)("Variation","formipay")),s?(0,t.createElement)(t.Fragment,null,(0,t.createElement)("th",null,(0,n.__)("Price","formipay")),(0,t.createElement)("th",null,(0,n.__)("Sale Price","formipay"))):null,(0,t.createElement)("th",null,(0,n.__)("Stock","formipay")),(0,t.createElement)("th",null,(0,n.__)("Weight","formipay")),(0,t.createElement)("th",null,(0,n.__)("Actions","formipay")))),(0,t.createElement)("tbody",null,l.map((e,a)=>(0,t.createElement)(z,{key:e.key,row:e,rowIndex:a,showFlatPricing:s,defaultCurrencyCode:f(),onToggleExpanded:()=>S(a),onUpdatePrice:(e,t,n)=>k(a,e,t,n),onUpdateField:(e,t)=>C(a,e,t),onDelete:()=>D(a)})))))}function z({row:e,rowIndex:a,showFlatPricing:o,defaultCurrencyCode:i,onToggleExpanded:c,onUpdatePrice:s,onUpdateField:m,onDelete:d}){return(0,t.createElement)(t.Fragment,null,(0,t.createElement)("tr",{className:"variation-row"},(0,t.createElement)("td",{className:"variation-name"},(0,t.createElement)("button",{type:"button",className:"toggle-expand",onClick:c},(0,t.createElement)(l,{icon:e.expanded?M():j(),size:16})),(0,t.createElement)("strong",null,e.name)),o?(0,t.createElement)(t.Fragment,null,(0,t.createElement)(J,{price:e.prices[0],field:"regular_price",onChange:(e,t)=>s(0,e,t)}),(0,t.createElement)(J,{price:e.prices[0],field:"sale_price",onChange:(e,t)=>s(0,e,t)})):null,(0,t.createElement)("td",{className:"variation-stock"},(0,t.createElement)(r.TextControl,{type:"number",value:e.stock,onChange:e=>m("stock",e),placeholder:"Unlimited"})),(0,t.createElement)("td",{className:"variation-weight"},(0,t.createElement)(r.TextControl,{type:"number",value:e.weight,onChange:e=>m("weight",e),step:"0.01"})),(0,t.createElement)("td",{className:"variation-actions"},(0,t.createElement)(r.Button,{variant:"secondary",size:"small",isDestructive:!0,onClick:d,icon:$()()},(0,n.__)("Delete","formipay")))),!o&&e.expanded&&(0,t.createElement)("tr",{className:"variation-details-row"},(0,t.createElement)("td",{colSpan:"5"},(0,t.createElement)("table",{className:"inner-table"},(0,t.createElement)("tbody",null,e.prices.map((e,a)=>{const n=String(e.currency).split(":::")[0]===i,r=e.currency_decimal_digits?1/Math.pow(10,e.currency_decimal_digits):.01;return(0,t.createElement)("tr",{key:a},(0,t.createElement)("td",{className:"currency-name"},e.currency,n&&(0,t.createElement)("span",{className:"required"},"*")),(0,t.createElement)("td",null,(0,t.createElement)("input",{type:"number",value:e.regular_price,onChange:e=>s(a,"regular_price",e.target.value),step:r,placeholder:"Regular Price",required:n})),(0,t.createElement)("td",null,(0,t.createElement)("input",{type:"number",value:e.sale_price,onChange:e=>s(a,"sale_price",e.target.value),step:r,placeholder:"Sale Price"})))}))))))}function J({price:e,field:a,onChange:n}){const r=e.currency_decimal_digits?1/Math.pow(10,e.currency_decimal_digits):.01;return(0,t.createElement)("td",{className:"price-cell"},(0,t.createElement)("input",{type:"number",value:e[a],onChange:e=>n(a,e.target.value),step:r,placeholder:"Auto"}))}const q=window.Swal,H={orders:function({initialData:e}){const[n,r]=(0,a.useState)(null);return n?(0,t.createElement)(P,{orderId:n,onBack:()=>r(null)}):(0,t.createElement)(_,{onSelectOrder:e=>r(e)})},customers:function({initialData:e}){const[r,l]=(0,a.useState)([]),[o,i]=(0,a.useState)(!0),c=(0,a.useCallback)(()=>{i(!0),((e={})=>m("formipay-tabledata-customers",e))().then(e=>{const t=e.data?.results||e.results||e.data||[];l(t)}).catch(e=>{console.error("Load customers error:",e)}).finally(()=>{i(!1)})},[]);(0,a.useEffect)(()=>{c()},[c]);const s=[{key:"id",label:(0,n.__)("ID","formipay"),render:e=>(0,t.createElement)("strong",null,"#",e.id)},{key:"name",label:(0,n.__)("Name","formipay"),render:e=>e.name||e.full_name||"-"},{key:"email",label:(0,n.__)("Email","formipay")},{key:"phone",label:(0,n.__)("Phone","formipay"),render:e=>e.phone||e.whatsapp||"-"},{key:"total_order",label:(0,n.__)("Total Orders","formipay"),render:e=>e.total_order||e.total_orders||0},{key:"created_date",label:(0,n.__)("Date","formipay"),render:e=>{const t=e.created_date||e.date;return t?new Date(t).toLocaleDateString():"-"}}];return(0,t.createElement)("div",{className:"formipay-page-customers"},(0,t.createElement)("div",{className:"formipay-page-header"},(0,t.createElement)("h1",null,(0,n.__)("Customers","formipay"))),(0,t.createElement)(T,{columns:s,data:r,loading:o,emptyMessage:(0,n.__)("No customers found","formipay")}))},products:function({initialData:e}){const[r,o]=(0,a.useState)(!1),[i,c]=(0,a.useState)(null),s=e?.productDetails||{};return r&&i?(0,t.createElement)("div",{className:"formipay-page-products"},(0,t.createElement)("div",{className:"formipay-products-header"},(0,t.createElement)("button",{type:"button",className:"button button-secondary",onClick:()=>o(!1)},"← ",(0,n.__)("Back to Products","formipay")),(0,t.createElement)("h1",null,(0,n.__)("Edit Product","formipay"))),(0,t.createElement)("div",{className:"formipay-product-editor"},(0,t.createElement)(R,{productId:i,productDetails:s}))):(0,t.createElement)("div",{className:"formipay-page-products"},(0,t.createElement)("div",{className:"formipay-products-list-header"},(0,t.createElement)("h1",null,(0,n.__)("Products","formipay")),(0,t.createElement)("button",{type:"button",className:"button button-primary",onClick:()=>{c(null),o(!0)}},(0,t.createElement)(l,{icon:B()(),size:16}),(0,n.__)("Add New Product","formipay"))),(0,t.createElement)("p",{className:"formipay-coming-soon"},(0,n.__)("Products list coming soon. Use the classic editor for now.","formipay")))},forms:function(){const e=[{key:"ID",label:(0,n.__)("ID","formipay"),render:e=>(0,t.createElement)("strong",null,"#",e.ID)},{key:"title",label:(0,n.__)("Title","formipay"),render:e=>(0,t.createElement)(t.Fragment,null,(0,t.createElement)("strong",null,e.title),(0,t.createElement)("br",null),(0,t.createElement)("span",{className:"row-actions",style:{display:"none",visibility:"hidden"}},(0,t.createElement)("a",{href:`${window.formipayAdmin?.siteUrl||""}/wp-admin/post.php?post=${e.ID}&action=edit`},(0,n.__)("Edit","formipay"))," | ",(0,t.createElement)("button",{className:"button-link delete","data-id":e.ID},(0,n.__)("Delete","formipay"))," | ",(0,t.createElement)("button",{className:"button-link duplicate","data-id":e.ID},(0,n.__)("Duplicate","formipay"))))},{key:"date",label:(0,n.__)("Date","formipay"),render:e=>{const a=new Date(e.date);return(0,t.createElement)("span",{style:{whiteSpace:"nowrap"}},a.toLocaleDateString(),(0,t.createElement)("br",null),(0,t.createElement)("span",{style:{fontSize:"smaller",color:"#646970"}},a.toLocaleTimeString()))}},{key:"status",label:(0,n.__)("Status","formipay"),render:e=>{const a=e.post_status||e.status||"unknown",r={publish:(0,n.__)("Published","formipay"),draft:(0,n.__)("Draft","formipay"),pending:(0,n.__)("Pending","formipay")};return(0,t.createElement)("span",{className:`status-label ${a}`},r[a]||a)}},{key:"shortcode",label:(0,n.__)("Shortcode","formipay"),render:e=>(0,t.createElement)(t.Fragment,null,(0,t.createElement)("input",{className:"formipay-form-shortcode",value:`[formipay form=${e.ID}]`,disabled:!0}),(0,t.createElement)("button",{className:"copy-shortcode","data-copy":`[formipay form=${e.ID}]`,onClick:e=>{const t=e.currentTarget.dataset.copy;navigator.clipboard.writeText(t).then(()=>{const t=e.currentTarget.innerHTML;e.currentTarget.innerHTML="✓ Copied",setTimeout(()=>{e.currentTarget.innerHTML=t},2e3),q.fire({icon:"success",title:(0,n.__)("Shortcode copied!","formipay"),toast:!0,position:"top-end",showConfirmButton:!1,timer:3e3,timerProgressBar:!0})})}},"📋 ",(0,n.__)("Copy","formipay")))}];return(0,t.createElement)("div",{className:"formipay-page-forms"},(0,t.createElement)("div",{className:"formipay-page-header"},(0,t.createElement)("h1",null,(0,n.__)("Forms","formipay"))),(0,t.createElement)(T,{columns:e,ajaxUrl:window.formipayAdmin?.ajaxUrl||"/wp-admin/admin-ajax.php",nonce:window.formipayAdmin?.nonce||"",tableAction:"formipay-tabledata-forms",deleteAction:"formipay-delete-form",duplicateAction:"formipay-duplicate-form",filterOptions:{key:"post_status",options:[{value:"all",label:(0,n.__)("All","formipay")},{value:"publish",label:(0,n.__)("Published","formipay")},{value:"draft",label:(0,n.__)("Draft","formipay")}]},actions:{addNew:{label:(0,n.__)("+ Add New Form","formipay"),action:"formipay-create-form-post"},bulkDelete:{action:"formipay-bulk-delete-form"},inline:!0},emptyMessage:(0,n.__)("No forms found","formipay")}))},coupons:function({initialData:e}){const[l,o]=(0,a.useState)([]),[i,c]=(0,a.useState)(!0),s=(0,a.useCallback)(()=>{c(!0),((e={})=>m("formipay-tabledata-coupons",e))().then(e=>{const t=e.data?.results||e.results||e.data||[];o(t)}).catch(e=>{console.error("Load coupons error:",e)}).finally(()=>{c(!1)})},[]);(0,a.useEffect)(()=>{s()},[s]);const d=[{key:"id",label:(0,n.__)("ID","formipay"),render:e=>(0,t.createElement)("strong",null,"#",e.id)},{key:"code",label:(0,n.__)("Coupon Code","formipay"),render:e=>(0,t.createElement)("strong",null,e.code||e.post_title)},{key:"type",label:(0,n.__)("Type","formipay"),render:e=>"percentage"===(e.coupon_type||e.type||"percentage")?(0,n.__)("%","formipay"):(0,n.__)("Fixed","formipay")},{key:"amount",label:(0,n.__)("Amount","formipay")},{key:"usages",label:(0,n.__)("Usages","formipay"),render:e=>e.usage_count||e.usages||0},{key:"status",label:(0,n.__)("Status","formipay"),render:e=>"publish"===(e.post_status||e.status||"unknown")?(0,n.__)("Active","formipay"):(0,n.__)("Inactive","formipay")}];return(0,t.createElement)("div",{className:"formipay-page-coupons"},(0,t.createElement)("div",{className:"formipay-page-header"},(0,t.createElement)("h1",null,(0,n.__)("Coupons","formipay")),(0,t.createElement)(r.Button,{variant:"primary",onClick:()=>{const e=prompt((0,n.__)("Enter coupon code:","formipay"));var t;e&&(t={code:e},m("formipay-create-coupon-post",t)).then(()=>s()).catch(console.error)}},(0,n.__)("+ Add New Coupon","formipay"))),(0,t.createElement)(T,{columns:d,data:l,loading:i,emptyMessage:(0,n.__)("No coupons found","formipay")}))},access:function({initialData:e}){const[l,o]=(0,a.useState)([]),[i,c]=(0,a.useState)(!0),s=(0,a.useCallback)(()=>{c(!0),((e={})=>m("formipay-tabledata-access-items",e))().then(e=>{const t=e.data?.results||e.results||e.data||[];o(t)}).catch(e=>{console.error("Load access items error:",e)}).finally(()=>{c(!1)})},[]);(0,a.useEffect)(()=>{s()},[s]);const d=[{key:"id",label:(0,n.__)("ID","formipay"),render:e=>(0,t.createElement)("strong",null,"#",e.id)},{key:"title",label:(0,n.__)("Title","formipay")},{key:"product_name",label:(0,n.__)("Product","formipay")},{key:"status",label:(0,n.__)("Status","formipay"),render:e=>{const a=e.post_status||e.status||"unknown",r={publish:(0,n.__)("Published","formipay"),draft:(0,n.__)("Draft","formipay")}[a]||a;return(0,t.createElement)("span",{className:`status-badge status-${a}`},r)}},{key:"date",label:(0,n.__)("Date","formipay"),render:e=>{const t=e.post_date||e.date;return t?new Date(t).toLocaleDateString():"-"}}];return(0,t.createElement)("div",{className:"formipay-page-access"},(0,t.createElement)("div",{className:"formipay-page-header"},(0,t.createElement)("h1",null,(0,n.__)("Access Items","formipay")),(0,t.createElement)(r.Button,{variant:"primary",href:window.formipayAdmin?.siteUrl+"/wp-admin/post-new.php?post_type=formipay-access"},(0,n.__)("+ Add New Item","formipay"))),(0,t.createElement)(T,{columns:d,data:l,loading:i,emptyMessage:(0,n.__)("No access items found","formipay")}))},licenses:function({initialData:e}){const[r,l]=(0,a.useState)([]),[o,i]=(0,a.useState)(!0),c=(0,a.useCallback)(()=>{i(!0),fetch(window.formipayAdmin?.ajaxUrl||"/wp-admin/admin-ajax.php",{method:"POST",credentials:"same-origin",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams({action:"formipay-tabledata-licenses",_wpnonce:window.formipayAdmin?.nonce||""})}).then(e=>e.json()).then(e=>{const t=e.data?.results||e.results||e.data||[];l(t)}).catch(e=>{console.error("Load licenses error:",e)}).finally(()=>{i(!1)})},[]);(0,a.useEffect)(()=>{c()},[c]);const s=[{key:"id",label:(0,n.__)("ID","formipay"),render:e=>(0,t.createElement)("strong",null,"#",e.id)},{key:"license_key",label:(0,n.__)("License Key","formipay"),render:e=>(0,t.createElement)("code",null,e.license_key||"-")},{key:"product",label:(0,n.__)("Product","formipay"),render:e=>e.product_name||e.product||"-"},{key:"order",label:(0,n.__)("Order","formipay"),render:e=>e.order_id||`#${e.order}`||"-"},{key:"email",label:(0,n.__)("Email","formipay")},{key:"status",label:(0,n.__)("Status","formipay"),render:e=>{const t=e.status||"unknown";return{active:(0,n.__)("Active","formipay"),inactive:(0,n.__)("Inactive","formipay"),expired:(0,n.__)("Expired","formipay")}[t]||t}}];return(0,t.createElement)("div",{className:"formipay-page-licenses"},(0,t.createElement)("div",{className:"formipay-page-licenses"},(0,t.createElement)("div",{className:"formipay-page-header"},(0,t.createElement)("h1",null,(0,n.__)("Licenses","formipay"))),(0,t.createElement)(T,{columns:s,data:r,loading:o,emptyMessage:(0,n.__)("No licenses found","formipay")})))}};function X({page:e,initialData:n}){(0,a.useEffect)(()=>{console.log("[Formipay App] Rendering page:",e,"with data:",n)},[e,n]);const r=H[e];return r?(0,t.createElement)("div",{className:"formipay-admin-wrap"},(0,t.createElement)(r,{initialData:n})):(0,t.createElement)("div",{className:"formipay-error"},(0,t.createElement)("p",null,"Unknown page: ",e))}const V=()=>{const e=document.querySelectorAll("[data-formipay-mount]");console.log("[Formipay] Mount points found:",e.length),console.log("[Formipay] formipayAdmin data:",window.formipayAdmin),e.forEach(e=>{const n=e.dataset.formipayMount,r=window.formipayAdmin?.[n]||{};console.log("[Formipay] Mounting page:",n,"with data:",r);try{(0,a.render)((0,t.createElement)(X,{page:n,initialData:r}),e),console.log("[Formipay] Successfully mounted:",n)}catch(e){console.error("[Formipay] Failed to mount:",n,e)}})};"loading"===document.readyState?document.addEventListener("DOMContentLoaded",V):V()})(); \ No newline at end of file +(()=>{"use strict";var e={n:t=>{var a=t&&t.__esModule?()=>t.default:()=>t;return e.d(a,{a}),a},d:(t,a)=>{for(var n in a)e.o(a,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:a[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t)};const t=window.React,a=window.wp.element,n=window.wp.i18n,r=window.wp.components,l=(0,a.forwardRef)(function({icon:e,size:t=24,...n},r){return(0,a.cloneElement)(e,{width:t,height:t,...n,ref:r})}),o=window.wp["icons/build/list"];var i=e.n(o);const c=window.formipayAdmin?.ajaxUrl||"/wp-admin/admin-ajax.php",s=window.formipayAdmin?.nonce||"";async function m(e,t={}){const a=new FormData;a.append("action",e),a.append("_wpnonce",s),Object.keys(t).forEach(e=>{"object"==typeof t[e]?a.append(e,JSON.stringify(t[e])):a.append(e,t[e])}),console.log(`[AJAX] Sending request: ${e}`,{nonce:s,data:t});try{const t=await fetch(c,{method:"POST",credentials:"same-origin",body:a});console.log(`[AJAX] Response status: ${e}`,t.status);const n=await t.json();if(console.log(`[AJAX] Response data: ${e}`,n),!t.ok||!1===n.success){const e=n.data?.message||n.message||"Request failed";throw new Error(e)}return n}catch(t){throw console.error(`AJAX error [${e}]:`,t),t}}window.formipayAdmin;const d=window.wp["icons/build/visible"];var p=e.n(d);const u={"on-hold":"#f0ad4e","payment-confirm":"#17a2b8","in-progress":"#17a2b8",shipping:"#6c757d",completed:"#28a745",failed:"#dc3545",refunded:"#6c757d",cancelled:"#dc3545"},f={"on-hold":(0,n.__)("On Hold","formipay"),"payment-confirm":(0,n.__)("Payment Confirmed","formipay"),"in-progress":(0,n.__)("In Progress","formipay"),shipping:(0,n.__)("Shipping","formipay"),completed:(0,n.__)("Completed","formipay"),failed:(0,n.__)("Failed","formipay"),refunded:(0,n.__)("Refunded","formipay"),cancelled:(0,n.__)("Cancelled","formipay")};function y({order:e,onSelect:a}){const r=u[e.status]||"#6c757d",o=f[e.status]||e.status,i=(e=>{if(e.form_data){const t=Object.values(e.form_data).find(e=>e.name&&e.name.includes("name"));return t?.value||"-"}return"-"})(e);return(0,t.createElement)("tr",{className:"formipay-order-item"},(0,t.createElement)("td",null,(0,t.createElement)("strong",null,"#",e.id)),(0,t.createElement)("td",null,(c=e.created_date)?new Date(c).toLocaleDateString():"-"),(0,t.createElement)("td",null,"-"!==i?i:(0,t.createElement)("em",null,"Unknown")),(0,t.createElement)("td",null,(0,t.createElement)("strong",null,e.total_formatted||e.total)),(0,t.createElement)("td",null,(0,t.createElement)("span",{className:"status-badge",style:{backgroundColor:r}},o)),(0,t.createElement)("td",null,(0,t.createElement)("button",{type:"button",className:"button button-small",onClick:a},(0,t.createElement)(l,{icon:p()(),size:16}),(0,n.__)("View","formipay"))));var c}function _({onSelectOrder:e}){const[o,c]=(0,a.useState)([]),[s,d]=(0,a.useState)(!0),[p,u]=(0,a.useState)(0),[f,_]=(0,a.useState)({keyword:"",status:"",date_from:"",date_to:""}),[E,b]=(0,a.useState)({limit:20,offset:0}),w=(0,a.useCallback)(()=>{d(!0),((e={})=>m("formipay-tabledata-orders",e))({keyword:f.keyword,status:f.status,date_from:f.date_from,date_to:f.date_to,limit:E.limit,offset:E.offset}).then(e=>{e.data&&(c(e.data.results||[]),u(e.data.total||0))}).catch(e=>{console.error("Load orders error:",e)}).finally(()=>{d(!1)})},[f,E]);(0,a.useEffect)(()=>{w()},[w]);const g=(e,t)=>{_({...f,[e]:t}),b({...E,offset:0})},h=e=>{b({...E,offset:e})},v={"":(0,n.__)("All Statuses","formipay"),"on-hold":(0,n.__)("On Hold","formipay"),"payment-confirm":(0,n.__)("Payment Confirmed","formipay"),"in-progress":(0,n.__)("In Progress","formipay"),shipping:(0,n.__)("Shipping","formipay"),completed:(0,n.__)("Completed","formipay"),failed:(0,n.__)("Failed","formipay"),refunded:(0,n.__)("Refunded","formipay"),cancelled:(0,n.__)("Cancelled","formipay")},N=Math.ceil(p/E.limit),k=Math.floor(E.offset/E.limit)+1;return(0,t.createElement)("div",{className:"formipay-order-list"},(0,t.createElement)("div",{className:"formipay-orders-header"},(0,t.createElement)("h2",null,(0,t.createElement)(l,{icon:i()()}),(0,n.__)("Orders","formipay")),(0,t.createElement)("span",{className:"order-count"},p," ",(0,n.__)("orders","formipay"))),(0,t.createElement)("div",{className:"formipay-orders-filters"},(0,t.createElement)(r.SearchControl,{value:f.keyword,onChange:e=>{g("keyword",e)},placeholder:(0,n.__)("Search by order ID, customer name, email...","formipay")}),(0,t.createElement)(r.SelectControl,{value:f.status,options:Object.entries(v).map(([e,t])=>({value:e,label:t})),onChange:e=>g("status",e),label:(0,n.__)("Status","formipay")}),(0,t.createElement)("input",{type:"date",value:f.date_from,onChange:e=>g("date_from",e.target.value),className:"formipay-date-input"}),(0,t.createElement)("input",{type:"date",value:f.date_to,onChange:e=>g("date_to",e.target.value),className:"formipay-date-input"}),(f.keyword||f.status||f.date_from||f.date_to)&&(0,t.createElement)(r.Button,{variant:"secondary",onClick:()=>{_({keyword:"",status:"",date_from:"",date_to:""}),b({limit:20,offset:0})}},(0,n.__)("Clear Filters","formipay"))),(0,t.createElement)("div",{className:"formipay-orders-table-wrapper"},s?(0,t.createElement)("div",{className:"formipay-loading"},(0,t.createElement)("span",{className:"spinner is-active"})):0===o.length?(0,t.createElement)("div",{className:"formipay-no-results"},(0,t.createElement)("p",null,(0,n.__)("No orders found","formipay"))):(0,t.createElement)(t.Fragment,null,(0,t.createElement)("table",{className:"formipay-orders-table wp-list-table widefat fixed striped"},(0,t.createElement)("thead",null,(0,t.createElement)("tr",null,(0,t.createElement)("th",null,(0,n.__)("ID","formipay")),(0,t.createElement)("th",null,(0,n.__)("Date","formipay")),(0,t.createElement)("th",null,(0,n.__)("Customer","formipay")),(0,t.createElement)("th",null,(0,n.__)("Total","formipay")),(0,t.createElement)("th",null,(0,n.__)("Status","formipay")),(0,t.createElement)("th",null,(0,n.__)("Actions","formipay")))),(0,t.createElement)("tbody",null,o.map(a=>(0,t.createElement)(y,{key:a.id,order:a,onSelect:()=>e?.(a.id)})))),N>1&&(0,t.createElement)("div",{className:"formipay-pagination"},(0,t.createElement)(r.Button,{variant:"secondary",disabled:1===k,onClick:()=>h(E.offset-E.limit)},(0,n.__)("Previous","formipay")),(0,t.createElement)("span",{className:"pagination-info"},(0,n.__)("Page","formipay")," ",k," ",(0,n.__)("of","formipay")," ",N),(0,t.createElement)(r.Button,{variant:"secondary",disabled:k===N,onClick:()=>h(E.offset+E.limit)},(0,n.__)("Next","formipay"))))))}const E=window.wp["icons/build/arrowLeft"];var b=e.n(E);const w=window.wp["icons/build/trash"];var g=e.n(w);const h=["on-hold","payment-confirm","in-progress","shipping","completed"],v={"on-hold":(0,n.__)("On Hold","formipay"),"payment-confirm":(0,n.__)("Payment Confirmed","formipay"),"in-progress":(0,n.__)("In Progress","formipay"),shipping:(0,n.__)("Shipping","formipay"),completed:(0,n.__)("Completed","formipay"),failed:(0,n.__)("Failed","formipay"),refunded:(0,n.__)("Refunded","formipay"),cancelled:(0,n.__)("Cancelled","formipay")};function N({orderId:e}){const[r,l]=(0,a.useState)([]);return(0,a.useEffect)(()=>{const e=[{status:"on-hold",date:(new Date).toISOString(),note:(0,n.__)("Order placed","formipay")}];l(e)},[e]),(0,t.createElement)("div",{className:"formipay-order-timeline"},(0,t.createElement)("h3",null,(0,n.__)("Order Timeline","formipay")),(0,t.createElement)("div",{className:"timeline-progress"},h.map((e,a)=>(0,t.createElement)("div",{key:e,className:`timeline-step ${0===a?"first":""} ${a===h.length-1?"last":""}`},(0,t.createElement)("div",{className:"timeline-dot"}),a(0,t.createElement)("li",{key:a},(0,t.createElement)("span",{className:"event-status"},v[e.status]||e.status),(0,t.createElement)("span",{className:"event-date"},new Date(e.date).toLocaleString()),e.note&&(0,t.createElement)("span",{className:"event-note"},e.note))))))}const k=window.wp["icons/build/bell"];var S=e.n(k);const C=window.wp["icons/build/message"];var D=e.n(C);function A(){const e=[{id:1,type:"email",recipient:"customer@example.com",subject:"Order Confirmation",status:"sent",date:(new Date).toISOString()}],a=e=>{switch(e){case"email":default:return S()();case"sms":case"whatsapp":return D()()}};return(0,t.createElement)("div",{className:"formipay-notification-log"},(0,t.createElement)("h3",null,(0,t.createElement)(l,{icon:S()(),size:18}),(0,n.__)("Notification Log","formipay")),0===e.length?(0,t.createElement)("p",{className:"no-logs"},(0,n.__)("No notifications sent yet","formipay")):(0,t.createElement)("ul",{className:"notification-list"},e.map(e=>(0,t.createElement)("li",{key:e.id,className:`notification-item ${e.status}`},(0,t.createElement)("div",{className:"notification-icon"},(0,t.createElement)(l,{icon:a(e.type),size:20})),(0,t.createElement)("div",{className:"notification-content"},(0,t.createElement)("div",{className:"notification-header"},(0,t.createElement)("span",{className:"notification-type"},e.type.toUpperCase()),(0,t.createElement)("span",{className:"notification-status"},e.status)),(0,t.createElement)("div",{className:"notification-details"},(0,t.createElement)("strong",null,e.subject||e.type),(0,t.createElement)("span",{className:"notification-recipient"},(0,n.__)("To:","formipay")," ",e.recipient)),(0,t.createElement)("div",{className:"notification-date"},new Date(e.date).toLocaleString()))))))}const I=[{value:"on-hold",label:(0,n.__)("On Hold","formipay")},{value:"payment-confirm",label:(0,n.__)("Payment Confirmed","formipay")},{value:"in-progress",label:(0,n.__)("In Progress","formipay")},{value:"shipping",label:(0,n.__)("Shipping","formipay")},{value:"completed",label:(0,n.__)("Completed","formipay")},{value:"failed",label:(0,n.__)("Failed","formipay")},{value:"refunded",label:(0,n.__)("Refunded","formipay")},{value:"cancelled",label:(0,n.__)("Cancelled","formipay")}];function x({orderId:e,onBack:o}){const[i,c]=(0,a.useState)(null),[s,d]=(0,a.useState)(!0),[p,u]=(0,a.useState)(!1),[f,y]=(0,a.useState)(""),_=(0,a.useCallback)(()=>{d(!0),(e=>m("formipay-get-order",{order_id:e}))(e).then(e=>{e.data&&(c(e.data),y(e.data.status))}).catch(e=>{console.error("Load order error:",e)}).finally(()=>{d(!1)})},[e]);return(0,a.useEffect)(()=>{_()},[_]),s?(0,t.createElement)("div",{className:"formipay-order-detail"},(0,t.createElement)("div",{className:"formipay-loading"},(0,t.createElement)("span",{className:"spinner is-active"}))):i?(0,t.createElement)("div",{className:"formipay-order-detail"},(0,t.createElement)("div",{className:"formipay-detail-header"},(0,t.createElement)(r.Button,{variant:"secondary",onClick:o},(0,t.createElement)(l,{icon:b()(),size:16}),(0,n.__)("Back","formipay")),(0,t.createElement)("h1",null,(0,n.__)("Order","formipay")," #",i.id),(0,t.createElement)("div",{className:"header-actions"},(0,t.createElement)(r.Button,{variant:"secondary",isDestructive:!0,onClick:()=>{var t;confirm((0,n.__)("Are you sure you want to delete this order?","formipay"))&&(t=[e],m("formipay-bulk-delete-order",{ids:t})).then(e=>{e.success&&o?.()}).catch(e=>{console.error("Delete order error:",e)})}},(0,t.createElement)(l,{icon:g()(),size:16}),(0,n.__)("Delete","formipay")))),(0,t.createElement)("div",{className:"formipay-detail-content"},(0,t.createElement)("div",{className:"formipay-detail-main"},(0,t.createElement)("div",{className:"formipay-detail-card"},(0,t.createElement)("h3",null,(0,n.__)("Order Details","formipay")),(0,t.createElement)("dl",{className:"detail-list"},(0,t.createElement)("div",null,(0,t.createElement)("dt",null,(0,n.__)("Status","formipay")),(0,t.createElement)("dd",null,(0,t.createElement)(r.SelectControl,{value:f,options:I,onChange:y,disabled:p}),f!==i.status&&(0,t.createElement)(r.Button,{variant:"primary",size:"small",onClick:()=>{f&&f!==i.status&&(u(!0),((e,t)=>m("formipay-update-order-status",{order_id:e,status:t}))(e,f).then(e=>{(e.success||e.data?.valid)&&_()}).catch(e=>{console.error("Update status error:",e)}).finally(()=>{u(!1)}))},disabled:p,isBusy:p},p?(0,n.__)("Updating...","formipay"):(0,n.__)("Update Status","formipay")))),(0,t.createElement)("div",null,(0,t.createElement)("dt",null,(0,n.__)("Date Created","formipay")),(0,t.createElement)("dd",null,(E=i.created_date)?new Date(E).toLocaleString():"-")),(0,t.createElement)("div",null,(0,t.createElement)("dt",null,(0,n.__)("Form ID","formipay")),(0,t.createElement)("dd",null,i.form_id)),(0,t.createElement)("div",null,(0,t.createElement)("dt",null,(0,n.__)("Payment Gateway","formipay")),(0,t.createElement)("dd",null,i.payment_gateway||"-")))),(0,t.createElement)("div",{className:"formipay-detail-card"},(0,t.createElement)("h3",null,(0,n.__)("Items","formipay")),(0,t.createElement)("table",{className:"items-table"},(0,t.createElement)("thead",null,(0,t.createElement)("tr",null,(0,t.createElement)("th",null,(0,n.__)("Item","formipay")),(0,t.createElement)("th",null,(0,n.__)("Qty","formipay")),(0,t.createElement)("th",null,(0,n.__)("Subtotal","formipay")))),(0,t.createElement)("tbody",null,i.items?.map((e,a)=>(0,t.createElement)("tr",{key:a},(0,t.createElement)("td",null,(0,t.createElement)("strong",null,e.item),e.description&&(0,t.createElement)("small",null,e.description)),(0,t.createElement)("td",null,e.qty||1),(0,t.createElement)("td",null,e.subtotal_formatted||e.subtotal)))||(0,t.createElement)("tr",null,(0,t.createElement)("td",{colSpan:"3",className:"text-center"},(0,n.__)("No items","formipay")))),(0,t.createElement)("tfoot",null,(0,t.createElement)("tr",null,(0,t.createElement)("td",{colSpan:"2"},(0,t.createElement)("strong",null,(0,n.__)("Total","formipay"))),(0,t.createElement)("td",null,(0,t.createElement)("strong",null,i.total_formatted||i.total))))))),(0,t.createElement)("div",{className:"formipay-detail-sidebar"},(0,t.createElement)("div",{className:"formipay-detail-card"},(0,t.createElement)("h3",null,(0,n.__)("Customer Information","formipay")),i.form_data?(0,t.createElement)("dl",{className:"customer-info"},Object.entries(i.form_data).map(([e,a])=>["payment","payment_gateway","coupon_code","qty"].includes(e)?null:(0,t.createElement)("div",{key:e},(0,t.createElement)("dt",null,e.replace(/_/g," ")),(0,t.createElement)("dd",null,a?.value||a||"-")))):(0,t.createElement)("p",{className:"no-data"},(0,n.__)("No customer data available","formipay"))),(0,t.createElement)(N,{orderId:e}),(0,t.createElement)(A,null)))):(0,t.createElement)("div",{className:"formipay-order-detail"},(0,t.createElement)("div",{className:"formipay-error"},(0,t.createElement)("p",null,(0,n.__)("Order not found","formipay")),(0,t.createElement)(r.Button,{variant:"secondary",onClick:o},(0,t.createElement)(l,{icon:b()(),size:16}),(0,n.__)("Back to Orders","formipay"))));var E}const O=window.Swal;function P({initialData:e=[],columns:l,filterOptions:o=null,statusCounts:i=null,searchable:c=!0,searchPlaceholder:s=(0,n.__)("Search...","formipay"),sortable:m=!0,defaultSort:d={id:"ID",desc:!0},selectable:p=!0,pagination:u=!0,pageSize:f=10,pageSizeOptions:y=[10,20,50,100],actions:_={addNew:!1,bulkDelete:!0,inline:!0},emptyMessage:E=(0,n.__)("No items found","formipay"),ajaxUrl:b,nonce:w,tableAction:g,deleteAction:h,duplicateAction:v}){const[N,k]=(0,a.useState)(e),[S,C]=(0,a.useState)(!0),[D,A]=(0,a.useState)(0),[I,x]=(0,a.useState)("all"),[P,T]=(0,a.useState)(""),[j,$]=(0,a.useState)(d.id||"ID"),[U,B]=(0,a.useState)(d.desc?"desc":"asc"),[L,F]=(0,a.useState)(1),[M,R]=(0,a.useState)(f),[z,J]=(0,a.useState)(new Set),[q,H]=(0,a.useState)(!1),[X,V]=(0,a.useState)(!1),[Z,G]=(0,a.useState)(""),K=g.replace("formipay-tabledata-",""),Q=_.bulkDelete?.action||`formipay-bulk-delete-${K}`,W=h||`formipay-delete-${K}`,Y=v||`formipay-duplicate-${K}`,ee=(0,a.useCallback)(async()=>{C(!0);const e=new URLSearchParams({action:g,_wpnonce:w,limit:M.toString(),offset:((L-1)*M).toString()});o&&"all"!==I&&e.append(o.key,I),P&&e.append("search",P),e.append("orderby",j),e.append("sort",U);try{const t=await fetch(`${b}?${e.toString()}`,{method:"POST",credentials:"same-origin",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:e}),a=await t.json(),n=a.data?.results||a.results||a.data||[];k(n),A(a.total||n.length)}catch(e){console.error("Load data error:",e)}finally{C(!1)}},[b,w,g,M,L,I,P,j,U,o]);return(0,a.useEffect)(()=>{ee()},[ee]),(0,a.useEffect)(()=>{const e=setTimeout(()=>{null!==P&&F(1)},500);return()=>clearTimeout(e)},[P]),(0,t.createElement)("div",{className:"formipay-data-table-wrapper"},(0,t.createElement)("div",{className:"formipay-table-toolbar"},_.addNew&&(0,t.createElement)(r.Button,{variant:"primary",onClick:()=>V(!0)},_.addNew.label||(0,n.__)("+ Add New","formipay")),_.bulkDelete&&p&&z.size>0&&(0,t.createElement)(r.Button,{variant:"secondary",isDestructive:!0,onClick:async()=>{0!==z.size&&(await O.fire({icon:"info",html:(0,n.__)("Do you want to delete the selected item(s)?","formipay"),showCancelButton:!0,confirmButtonText:(0,n.__)("Confirm","formipay"),cancelButtonText:(0,n.__)("Cancel","formipay")})).isConfirmed&&(await fetch(`${b}?action=${Q}`,{method:"POST",credentials:"same-origin",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams({ids:Array.from(z),_wpnonce:w})}),J(new Set),H(!1),ee(),O.fire({title:(0,n.__)("Done!","formipay"),html:(0,n.__)("Items deleted successfully.","formipay"),icon:"success"}))}},(0,n.__)("Delete Selected","formipay")," (",z.size,")"),c&&(0,t.createElement)(r.TextControl,{placeholder:s,value:P,onChange:T,className:"formipay-table-search"}),m&&(0,t.createElement)(r.SelectControl,{value:`${j}-${U}`,options:[{label:(0,n.__)("ID ↓","formipay"),value:"ID-desc"},{label:(0,n.__)("ID ↑","formipay"),value:"ID-asc"},{label:(0,n.__)("Date ↓","formipay"),value:"date-desc"},{label:(0,n.__)("Date ↑","formipay"),value:"date-asc"},{label:(0,n.__)("Title A-Z","formipay"),value:"title-asc"},{label:(0,n.__)("Title Z-A","formipay"),value:"title-desc"}],onChange:e=>{const[t,a]=e.split("-");$(t),B(a)}})),o&&(0,t.createElement)("div",{className:"formipay-filter-tabs"},o.options.map(e=>(0,t.createElement)("button",{key:e.value,className:"filter-tab "+(I===e.value?"active":""),onClick:()=>{return t=e.value,x(t),void F(1);var t}},e.label,i&&(0,t.createElement)("span",{className:"count"},i[e.value]||0)))),(0,t.createElement)("div",{className:"formipay-table-container"},S?(0,t.createElement)("div",{className:"formipay-table-loading"},(0,t.createElement)(r.Spinner,null)):0===N.length?(0,t.createElement)("div",{className:"formipay-table-empty"},E):(0,t.createElement)("table",{className:"formipay-table wp-list-table widefat fixed striped"},(0,t.createElement)("thead",null,(0,t.createElement)("tr",null,p&&(0,t.createElement)("th",{className:"column-select"},(0,t.createElement)("input",{type:"checkbox",checked:q,onChange:()=>{J(q?new Set:new Set(N.map(e=>e.ID||e.id))),H(!q)}})),l.map(e=>(0,t.createElement)("th",{key:e.key,className:`column-${e.key}`},e.label)),_.inline&&(0,t.createElement)("th",{className:"column-actions"},(0,n.__)("Actions","formipay")))),(0,t.createElement)("tbody",null,N.map((e,a)=>{const r=e.ID||e.id;return(0,t.createElement)("tr",{key:a,className:"formipay-table-row"},p&&(0,t.createElement)("td",null,(0,t.createElement)("input",{type:"checkbox",checked:z.has(r),onChange:()=>(e=>{const t=new Set(z);t.has(e)?t.delete(e):t.add(e),J(t),H(!1)})(r)})),l.map(a=>(0,t.createElement)("td",{key:a.key},a.render?a.render(e):e[a.key])),_.inline&&(0,t.createElement)("td",{className:"column-actions"},(0,t.createElement)("div",{className:"row-actions"},(0,t.createElement)("a",{href:`${window.formipayAdmin?.siteUrl||""}/wp-admin/post.php?post=${r}&action=edit`},(0,n.__)("Edit","formipay"))," | ",(0,t.createElement)("button",{className:"button-link delete",onClick:()=>(async e=>{(await O.fire({icon:"info",html:(0,n.__)("Do you want to delete this item?","formipay"),showCancelButton:!0,confirmButtonText:(0,n.__)("Delete Permanently","formipay"),cancelButtonText:(0,n.__)("Cancel","formipay")})).isConfirmed&&(await fetch(`${b}?action=${W}`,{method:"POST",credentials:"same-origin",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams({id:e,_wpnonce:w})}),ee())})(r)},(0,n.__)("Delete","formipay"))," | ",(0,t.createElement)("button",{className:"button-link duplicate",onClick:()=>(async e=>{(await O.fire({icon:"info",html:(0,n.__)("Do you want to duplicate this item?","formipay"),showCancelButton:!0,confirmButtonText:(0,n.__)("Confirm","formipay"),cancelButtonText:(0,n.__)("Cancel","formipay")})).isConfirmed&&(await fetch(`${b}?action=${Y}`,{method:"POST",credentials:"same-origin",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams({id:e,_wpnonce:w})}),ee())})(r)},(0,n.__)("Duplicate","formipay")))))})))),u&&D>M&&(0,t.createElement)("div",{className:"formipay-table-pagination"},(0,t.createElement)("div",{className:"pagination-info"},(0,n.__)("Showing","formipay")," ",(L-1)*M+1," - ",Math.min(L*M,D)," ",(0,n.__)("of","formipay")," ",D),(0,t.createElement)("div",{className:"pagination-controls"},(0,t.createElement)(r.Button,{variant:"secondary",disabled:1===L,onClick:()=>F(1)},"««"),(0,t.createElement)(r.Button,{variant:"secondary",disabled:1===L,onClick:()=>F(L-1)},"‹"),(0,t.createElement)("span",{className:"page-info"},(0,n.__)("Page","formipay")," ",L," ",(0,n.__)("of","formipay")," ",Math.ceil(D/M)),(0,t.createElement)(r.Button,{variant:"secondary",disabled:L>=Math.ceil(D/M),onClick:()=>F(L+1)},"›"),(0,t.createElement)(r.Button,{variant:"secondary",disabled:L>=Math.ceil(D/M),onClick:()=>F(Math.ceil(D/M))},"»"),(0,t.createElement)(r.SelectControl,{value:M.toString(),options:y.map(e=>({label:e.toString(),value:e.toString()})),onChange:e=>{R(parseInt(e)),F(1)}}))),_.addNew&&(0,t.createElement)(r.Modal,{title:_.addNew.label||(0,n.__)("Add New","formipay"),isOpen:X,onClose:()=>V(!1)},(0,t.createElement)(r.TextControl,{label:(0,n.__)("Title","formipay"),value:Z,onChange:G,autoFocus:!0}),(0,t.createElement)("div",{className:"formipay-modal-actions"},(0,t.createElement)(r.Button,{variant:"secondary",onClick:()=>V(!1)},(0,n.__)("Cancel","formipay")),(0,t.createElement)(r.Button,{variant:"primary",onClick:async()=>{if(!Z.trim())return void O.fire({html:(0,n.__)("Title is required.","formipay"),icon:"error"});const e=_.addNew.action,t=await fetch(`${b}?action=${e}`,{method:"POST",credentials:"same-origin",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams({title:Z,_wpnonce:w})}),a=await t.json();a.success?(V(!1),G(""),a.data.edit_post_url?window.location.href=a.data.edit_post_url:ee()):O.fire({html:a.data.message||(0,n.__)("Error creating item.","formipay"),icon:"error"})}},(0,n.__)("Create","formipay")))))}const T=window.wp["icons/build/plus"];var j=e.n(T);const $=window.wp["icons/build/minus"];var U=e.n($);const B=window.wp["icons/build/eyeClosed"];var L=e.n(B);const F=window.wp["icons/build/eyeOpened"];var M=e.n(F);function R({productId:e,productDetails:r}){const[l,o]=(0,a.useState)([]),[i,c]=(0,a.useState)([]),[s,m]=(0,a.useState)(!0),d=(0,a.useRef)(null),p=(0,a.useRef)(null),u=(0,a.useRef)(null),f=(0,a.useCallback)(()=>String(r?.default_currency||"").split(":::")[0]||r?.default_currency_code||"USD",[r]),y=(0,a.useCallback)(e=>{const t=r?.global_currencies||[],a=String(e).split(":::")[0],n=t.find(e=>String(e.currency).split(":::")[0]===a);return parseInt(n?.decimal_digits,10)||2},[r]),_=(0,a.useCallback)(()=>{const e=r?.global_selected_currencies||{};let t=Object.keys(e);if(!t.length){const e=r?.default_currency||"";e&&(t=[e])}return t.map(e=>{const t=String(e).split(":::")[0];return{currency:e,regular_price:"",sale_price:"",currency_decimal_digits:y(t)}})},[r,y]),E=(0,a.useCallback)(e=>{const t={...e};void 0===t.expanded&&(t.expanded=!1);const a=_(),n=e=>String(e).split(":::")[0];if(Array.isArray(t.prices)){const e=new Set(a.map(e=>n(e.currency)));t.prices=t.prices.filter(t=>t&&e.has(n(t.currency))),a.forEach(e=>{const a=n(e.currency);t.prices.some(e=>n(e.currency)===a)||t.prices.push(JSON.parse(JSON.stringify(e)))})}else t.prices=JSON.parse(JSON.stringify(a));Array.isArray(t.prices)&&0!==t.prices.length||(t.prices=JSON.parse(JSON.stringify(a))),t.prices.forEach(e=>{const t=n(e.currency);e.currency_decimal_digits=y(t),void 0!==e.regular_price&&null!==e.regular_price||(e.regular_price=""),void 0!==e.sale_price&&null!==e.sale_price||(e.sale_price="")});const r=f();return t.prices.sort((e,t)=>n(e.currency)===r?-1:n(t.currency)===r?1:0),delete t.price,delete t.sale,t},[_,y,f]),b=(0,a.useCallback)(()=>new Promise(e=>{let t=0;const a=setInterval(()=>{const n=document.querySelector('input[name="product_variation_attributes"]');if(n&&n.value)try{const t=JSON.parse(n.value);clearInterval(a),e(Array.isArray(t)?t:[])}catch(t){clearInterval(a),e([])}else++t>=100&&(clearInterval(a),e([]))},50)}),[]),w=(0,a.useCallback)(e=>{const t=e.map(e=>(e.attribute_variations||[]).map(e=>({label:e.variation_label}))).filter(e=>e.length>0);return t.length?t.reduce((e,t)=>e.flatMap(e=>t.map(t=>[].concat(e,t)))).map(e=>{const t=Array.isArray(e)?e.map(e=>e.label):[e.label];return{key:t.join("||"),label:t.join(" - ")}}):[]},[]),g=(0,a.useCallback)(async()=>{try{const e=await b();if(!e.length)return o([]),void h([]);const t=w(e).filter(e=>!i.includes(e.key)).map(e=>{const t=l.find(t=>t.key===e.key);return t?Object.assign(E(t),{name:e.label}):E({key:e.key,name:e.label,stock:"",weight:0,active:!0})});o(t),h(t)}catch(e){console.warn("Attributes not available; initializing empty variations."),o([]),h([])}},[b,w,i,l,E]),h=(0,a.useCallback)(e=>{d.current&&(d.current.value=JSON.stringify(e||[]))},[]),v=(0,a.useCallback)(async()=>{if(e)try{const t=new FormData;t.append("action","get_product_variables"),t.append("post_id",e),t.append("_wpnonce",window.formipayAdmin?.nonce||"");const a=await fetch(window.formipayAdmin?.ajaxUrl||"/wp-admin/admin-ajax.php",{method:"POST",credentials:"same-origin",body:t}),n=await a.json();if(n.success&&Array.isArray(n.data)&&n.data.length){const e=n.data.map(e=>E(e));o(e),c([]),h(e)}else await g()}catch{await g()}else await g()},[e,E,g,h]),N=(0,a.useCallback)(()=>{const e=()=>{setTimeout(()=>{g()},200)},t=document.querySelector('input[name="product_variation_attributes"]');if(t){t.addEventListener("input",e),t.addEventListener("change",e);const a=new MutationObserver(e);a.observe(t,{attributes:!0,attributeFilter:["value"]}),u.current=a,p.current=setInterval(()=>{const t=document.querySelector('input[name="product_variation_attributes"]');t&&t.value!==d.current?.value&&e()},300)}return()=>{u.current&&u.current.disconnect(),p.current&&clearInterval(p.current)}},[g]);(0,a.useEffect)(()=>{const e=r?.multicurrency,t=r?.global_selected_currencies||{},a=Object.keys(t).length;return m(!e||a<=1),v(),N()},[r,v,N]);const k=(0,a.useCallback)((e,t,a,n)=>{const r=[...l];r[e].prices[t][a]=n,o(r),h(r)},[l,h]),S=(0,a.useCallback)(e=>{const t=[...l];t[e].expanded=!t[e].expanded,o(t)},[l]),C=(0,a.useCallback)((e,t,a)=>{const n=[...l];n[e][t]=a,o(n),h(n)},[l,h]),D=(0,a.useCallback)(e=>{const t=l[e],a=[...i,t.key];c(a);const n=l.filter((t,a)=>a!==e);o(n),h(n)},[l,i,h]),A=(0,a.useCallback)(()=>{const e=f();for(const t of l){const a=t.prices?.find(t=>String(t.currency).split(":::")[0]===e);if(!a||!a.regular_price)return{currencyCode:e,rowLabel:t.name}}return null},[l,f]);return(0,a.useEffect)(()=>{const e=document.getElementById("post");if(!e)return;const t=e=>{const t=A();if(t){e.preventDefault(),e.stopImmediatePropagation();const a=(r?.variation_table?.error_missing_default_price||'Please fill Regular Price for default currency (%1$s) in variation "%2$s".').replace("%1$s",t.currencyCode).replace("%2$s",t.rowLabel);return alert(a),!1}};return e.addEventListener("submit",t,!0),()=>e.removeEventListener("submit",t,!0)},[A,r]),(0,t.createElement)(t.Fragment,null,(0,t.createElement)("input",{ref:d,type:"hidden",name:"product_variation_variables",value:JSON.stringify(l)}),(0,t.createElement)("table",{className:"formipay-variation-table",id:"product-variables-table"},(0,t.createElement)("thead",null,(0,t.createElement)("tr",null,(0,t.createElement)("th",null,(0,n.__)("Variation","formipay")),s?(0,t.createElement)(t.Fragment,null,(0,t.createElement)("th",null,(0,n.__)("Price","formipay")),(0,t.createElement)("th",null,(0,n.__)("Sale Price","formipay"))):null,(0,t.createElement)("th",null,(0,n.__)("Stock","formipay")),(0,t.createElement)("th",null,(0,n.__)("Weight","formipay")),(0,t.createElement)("th",null,(0,n.__)("Actions","formipay")))),(0,t.createElement)("tbody",null,l.map((e,a)=>(0,t.createElement)(z,{key:e.key,row:e,rowIndex:a,showFlatPricing:s,defaultCurrencyCode:f(),onToggleExpanded:()=>S(a),onUpdatePrice:(e,t,n)=>k(a,e,t,n),onUpdateField:(e,t)=>C(a,e,t),onDelete:()=>D(a)})))))}function z({row:e,rowIndex:a,showFlatPricing:o,defaultCurrencyCode:i,onToggleExpanded:c,onUpdatePrice:s,onUpdateField:m,onDelete:d}){return(0,t.createElement)(t.Fragment,null,(0,t.createElement)("tr",{className:"variation-row"},(0,t.createElement)("td",{className:"variation-name"},(0,t.createElement)("button",{type:"button",className:"toggle-expand",onClick:c},(0,t.createElement)(l,{icon:e.expanded?M():L(),size:16})),(0,t.createElement)("strong",null,e.name)),o?(0,t.createElement)(t.Fragment,null,(0,t.createElement)(J,{price:e.prices[0],field:"regular_price",onChange:(e,t)=>s(0,e,t)}),(0,t.createElement)(J,{price:e.prices[0],field:"sale_price",onChange:(e,t)=>s(0,e,t)})):null,(0,t.createElement)("td",{className:"variation-stock"},(0,t.createElement)(r.TextControl,{type:"number",value:e.stock,onChange:e=>m("stock",e),placeholder:"Unlimited"})),(0,t.createElement)("td",{className:"variation-weight"},(0,t.createElement)(r.TextControl,{type:"number",value:e.weight,onChange:e=>m("weight",e),step:"0.01"})),(0,t.createElement)("td",{className:"variation-actions"},(0,t.createElement)(r.Button,{variant:"secondary",size:"small",isDestructive:!0,onClick:d,icon:U()()},(0,n.__)("Delete","formipay")))),!o&&e.expanded&&(0,t.createElement)("tr",{className:"variation-details-row"},(0,t.createElement)("td",{colSpan:"5"},(0,t.createElement)("table",{className:"inner-table"},(0,t.createElement)("tbody",null,e.prices.map((e,a)=>{const n=String(e.currency).split(":::")[0]===i,r=e.currency_decimal_digits?1/Math.pow(10,e.currency_decimal_digits):.01;return(0,t.createElement)("tr",{key:a},(0,t.createElement)("td",{className:"currency-name"},e.currency,n&&(0,t.createElement)("span",{className:"required"},"*")),(0,t.createElement)("td",null,(0,t.createElement)("input",{type:"number",value:e.regular_price,onChange:e=>s(a,"regular_price",e.target.value),step:r,placeholder:"Regular Price",required:n})),(0,t.createElement)("td",null,(0,t.createElement)("input",{type:"number",value:e.sale_price,onChange:e=>s(a,"sale_price",e.target.value),step:r,placeholder:"Sale Price"})))}))))))}function J({price:e,field:a,onChange:n}){const r=e.currency_decimal_digits?1/Math.pow(10,e.currency_decimal_digits):.01;return(0,t.createElement)("td",{className:"price-cell"},(0,t.createElement)("input",{type:"number",value:e[a],onChange:e=>n(a,e.target.value),step:r,placeholder:"Auto"}))}const q=window.Swal,H={orders:function({initialData:e}){const[n,r]=(0,a.useState)(null);return n?(0,t.createElement)(x,{orderId:n,onBack:()=>r(null)}):(0,t.createElement)(_,{onSelectOrder:e=>r(e)})},customers:function(){const e=[{key:"id",label:(0,n.__)("ID","formipay"),render:e=>(0,t.createElement)("strong",null,"#",e.id)},{key:"name",label:(0,n.__)("Name","formipay"),render:e=>e.name||e.full_name||"-"},{key:"email",label:(0,n.__)("Email","formipay")},{key:"phone",label:(0,n.__)("Phone","formipay"),render:e=>e.phone||e.whatsapp||"-"},{key:"total_order",label:(0,n.__)("Total Orders","formipay"),render:e=>e.total_order||e.total_orders||0},{key:"created_date",label:(0,n.__)("Date","formipay"),render:e=>{const t=e.created_date||e.date;return t?new Date(t).toLocaleDateString():"-"}}];return(0,t.createElement)("div",{className:"formipay-page-customers"},(0,t.createElement)("div",{className:"formipay-page-header"},(0,t.createElement)("h1",null,(0,n.__)("Customers","formipay"))),(0,t.createElement)(P,{columns:e,ajaxUrl:window.formipayAdmin?.ajaxUrl||"/wp-admin/admin-ajax.php",nonce:window.formipayAdmin?.nonce||"",tableAction:"formipay-tabledata-customers",selectable:!1,inline:!1,emptyMessage:(0,n.__)("No customers found","formipay")}))},products:function({initialData:e}){const[r,o]=(0,a.useState)(!1),[i,c]=(0,a.useState)(null),s=e?.productDetails||{};return r&&i?(0,t.createElement)("div",{className:"formipay-page-products"},(0,t.createElement)("div",{className:"formipay-products-header"},(0,t.createElement)("button",{type:"button",className:"button button-secondary",onClick:()=>o(!1)},"← ",(0,n.__)("Back to Products","formipay")),(0,t.createElement)("h1",null,(0,n.__)("Edit Product","formipay"))),(0,t.createElement)("div",{className:"formipay-product-editor"},(0,t.createElement)(R,{productId:i,productDetails:s}))):(0,t.createElement)("div",{className:"formipay-page-products"},(0,t.createElement)("div",{className:"formipay-products-list-header"},(0,t.createElement)("h1",null,(0,n.__)("Products","formipay")),(0,t.createElement)("button",{type:"button",className:"button button-primary",onClick:()=>{c(null),o(!0)}},(0,t.createElement)(l,{icon:j()(),size:16}),(0,n.__)("Add New Product","formipay"))),(0,t.createElement)("p",{className:"formipay-coming-soon"},(0,n.__)("Products list coming soon. Use the classic editor for now.","formipay")))},forms:function(){const e=[{key:"ID",label:(0,n.__)("ID","formipay"),render:e=>(0,t.createElement)("strong",null,"#",e.ID)},{key:"title",label:(0,n.__)("Title","formipay"),render:e=>(0,t.createElement)(t.Fragment,null,(0,t.createElement)("strong",null,e.title),(0,t.createElement)("br",null),(0,t.createElement)("span",{className:"row-actions",style:{display:"none",visibility:"hidden"}},(0,t.createElement)("a",{href:`${window.formipayAdmin?.siteUrl||""}/wp-admin/post.php?post=${e.ID}&action=edit`},(0,n.__)("Edit","formipay"))," | ",(0,t.createElement)("button",{className:"button-link delete","data-id":e.ID},(0,n.__)("Delete","formipay"))," | ",(0,t.createElement)("button",{className:"button-link duplicate","data-id":e.ID},(0,n.__)("Duplicate","formipay"))))},{key:"date",label:(0,n.__)("Date","formipay"),render:e=>{const a=new Date(e.date);return(0,t.createElement)("span",{style:{whiteSpace:"nowrap"}},a.toLocaleDateString(),(0,t.createElement)("br",null),(0,t.createElement)("span",{style:{fontSize:"smaller",color:"#646970"}},a.toLocaleTimeString()))}},{key:"status",label:(0,n.__)("Status","formipay"),render:e=>{const a=e.post_status||e.status||"unknown",r={publish:(0,n.__)("Published","formipay"),draft:(0,n.__)("Draft","formipay"),pending:(0,n.__)("Pending","formipay")};return(0,t.createElement)("span",{className:`status-label ${a}`},r[a]||a)}},{key:"shortcode",label:(0,n.__)("Shortcode","formipay"),render:e=>(0,t.createElement)(t.Fragment,null,(0,t.createElement)("input",{className:"formipay-form-shortcode",value:`[formipay form=${e.ID}]`,disabled:!0}),(0,t.createElement)("button",{className:"copy-shortcode","data-copy":`[formipay form=${e.ID}]`,onClick:e=>{const t=e.currentTarget.dataset.copy;navigator.clipboard.writeText(t).then(()=>{const t=e.currentTarget.innerHTML;e.currentTarget.innerHTML="✓ Copied",setTimeout(()=>{e.currentTarget.innerHTML=t},2e3),q.fire({icon:"success",title:(0,n.__)("Shortcode copied!","formipay"),toast:!0,position:"top-end",showConfirmButton:!1,timer:3e3,timerProgressBar:!0})})}},"📋 ",(0,n.__)("Copy","formipay")))}];return(0,t.createElement)("div",{className:"formipay-page-forms"},(0,t.createElement)("div",{className:"formipay-page-header"},(0,t.createElement)("h1",null,(0,n.__)("Forms","formipay"))),(0,t.createElement)(P,{columns:e,ajaxUrl:window.formipayAdmin?.ajaxUrl||"/wp-admin/admin-ajax.php",nonce:window.formipayAdmin?.nonce||"",tableAction:"formipay-tabledata-forms",deleteAction:"formipay-delete-form",duplicateAction:"formipay-duplicate-form",filterOptions:{key:"post_status",options:[{value:"all",label:(0,n.__)("All","formipay")},{value:"publish",label:(0,n.__)("Published","formipay")},{value:"draft",label:(0,n.__)("Draft","formipay")}]},actions:{addNew:{label:(0,n.__)("+ Add New Form","formipay"),action:"formipay-create-form-post"},bulkDelete:{action:"formipay-bulk-delete-form"},inline:!0},emptyMessage:(0,n.__)("No forms found","formipay")}))},coupons:function(){const e=[{key:"ID",label:(0,n.__)("ID","formipay"),render:e=>(0,t.createElement)("strong",null,"#",e.ID)},{key:"code",label:(0,n.__)("Coupon Code","formipay"),render:e=>(0,t.createElement)("strong",null,e.code||e.post_title)},{key:"type",label:(0,n.__)("Type","formipay"),render:e=>"percentage"===(e.coupon_type||e.type||"percentage")?(0,n.__)("%","formipay"):(0,n.__)("Fixed","formipay")},{key:"amount",label:(0,n.__)("Amount","formipay"),render:e=>e.amount||"-"},{key:"usages",label:(0,n.__)("Usages","formipay"),render:e=>e.usage_count||e.usages||0},{key:"date_limit",label:(0,n.__)("Date Limit","formipay"),render:e=>{const t=e.date_limit;return t&&"none"!==t?new Date(t).toLocaleDateString():(0,n.__)("Unlimited","formipay")}},{key:"status",label:(0,n.__)("Status","formipay"),render:e=>{const a=e.post_status||e.status||"unknown",r="on"===e.active||"publish"===a;return(0,t.createElement)("span",{className:"status-label "+(r?"publish":"draft")},r?(0,n.__)("Active","formipay"):(0,n.__)("Inactive","formipay"))}}];return(0,t.createElement)("div",{className:"formipay-page-coupons"},(0,t.createElement)("div",{className:"formipay-page-header"},(0,t.createElement)("h1",null,(0,n.__)("Coupons","formipay"))),(0,t.createElement)(P,{columns:e,ajaxUrl:window.formipayAdmin?.ajaxUrl||"/wp-admin/admin-ajax.php",nonce:window.formipayAdmin?.nonce||"",tableAction:"formipay-tabledata-coupons",deleteAction:"formipay-delete-coupon",duplicateAction:"formipay-duplicate-coupon",filterOptions:{key:"status",options:[{value:"all",label:(0,n.__)("All","formipay")},{value:"active",label:(0,n.__)("Active","formipay")},{value:"inactive",label:(0,n.__)("Inactive","formipay")}]},actions:{addNew:{label:(0,n.__)("+ Add New Coupon","formipay"),action:"formipay-create-coupon-post"},bulkDelete:{action:"formipay-bulk-delete-coupon"},inline:!0},emptyMessage:(0,n.__)("No coupons found","formipay")}))},access:function(){const e=[{key:"ID",label:(0,n.__)("ID","formipay"),render:e=>(0,t.createElement)("strong",null,"#",e.ID)},{key:"title",label:(0,n.__)("Title","formipay")},{key:"product_name",label:(0,n.__)("Product","formipay")},{key:"status",label:(0,n.__)("Status","formipay"),render:e=>{const a=e.post_status||e.status||"unknown",r={publish:(0,n.__)("Published","formipay"),draft:(0,n.__)("Draft","formipay")}[a]||a;return(0,t.createElement)("span",{className:`status-label ${a}`},r)}},{key:"date",label:(0,n.__)("Date","formipay"),render:e=>{const t=e.post_date||e.date;return t?new Date(t).toLocaleDateString():"-"}}];return(0,t.createElement)("div",{className:"formipay-page-access"},(0,t.createElement)("div",{className:"formipay-page-header"},(0,t.createElement)("h1",null,(0,n.__)("Access Items","formipay"))),(0,t.createElement)(P,{columns:e,ajaxUrl:window.formipayAdmin?.ajaxUrl||"/wp-admin/admin-ajax.php",nonce:window.formipayAdmin?.nonce||"",tableAction:"formipay-tabledata-access-items",deleteAction:"formipay-delete-access-item",duplicateAction:"formipay-duplicate-access-item",filterOptions:{key:"post_status",options:[{value:"all",label:(0,n.__)("All","formipay")},{value:"publish",label:(0,n.__)("Published","formipay")},{value:"draft",label:(0,n.__)("Draft","formipay")}]},actions:{addNew:{label:(0,n.__)("+ Add New Item","formipay"),action:"formipay-create-access-item-post"},bulkDelete:{action:"formipay-bulk-delete-access-item"},inline:!0},emptyMessage:(0,n.__)("No access items found","formipay")}))},licenses:function(){const e=[{key:"id",label:(0,n.__)("ID","formipay"),render:e=>(0,t.createElement)("strong",null,"#",e.id)},{key:"license_key",label:(0,n.__)("License Key","formipay"),render:e=>(0,t.createElement)("code",null,e.license_key||"-")},{key:"product",label:(0,n.__)("Product","formipay"),render:e=>e.product_name||e.product||"-"},{key:"order",label:(0,n.__)("Order","formipay"),render:e=>e.order_id||`#${e.order}`||"-"},{key:"email",label:(0,n.__)("Email","formipay")},{key:"status",label:(0,n.__)("Status","formipay"),render:e=>{const a=e.status||"unknown",r={active:(0,n.__)("Active","formipay"),inactive:(0,n.__)("Inactive","formipay"),expired:(0,n.__)("Expired","formipay")},l="active"===a?"publish":"expired"===a?"pending":"draft";return(0,t.createElement)("span",{className:`status-label ${l}`},r[a]||a)}}];return(0,t.createElement)("div",{className:"formipay-page-licenses"},(0,t.createElement)("div",{className:"formipay-page-header"},(0,t.createElement)("h1",null,(0,n.__)("Licenses","formipay"))),(0,t.createElement)(P,{columns:e,ajaxUrl:window.formipayAdmin?.ajaxUrl||"/wp-admin/admin-ajax.php",nonce:window.formipayAdmin?.nonce||"",tableAction:"formipay-tabledata-licenses",selectable:!1,inline:!1,emptyMessage:(0,n.__)("No licenses found","formipay")}))}};function X({page:e,initialData:n}){(0,a.useEffect)(()=>{console.log("[Formipay App] Rendering page:",e,"with data:",n)},[e,n]);const r=H[e];return r?(0,t.createElement)("div",{className:"formipay-admin-wrap"},(0,t.createElement)(r,{initialData:n})):(0,t.createElement)("div",{className:"formipay-error"},(0,t.createElement)("p",null,"Unknown page: ",e))}const V=()=>{const e=document.querySelectorAll("[data-formipay-mount]");console.log("[Formipay] Mount points found:",e.length),console.log("[Formipay] formipayAdmin data:",window.formipayAdmin),e.forEach(e=>{const n=e.dataset.formipayMount,r=window.formipayAdmin?.[n]||{};console.log("[Formipay] Mounting page:",n,"with data:",r);try{(0,a.render)((0,t.createElement)(X,{page:n,initialData:r}),e),console.log("[Formipay] Successfully mounted:",n)}catch(e){console.error("[Formipay] Failed to mount:",n,e)}})};"loading"===document.readyState?document.addEventListener("DOMContentLoaded",V):V()})(); \ No newline at end of file diff --git a/node_modules/.cache/babel-loader/0ad392e4a022a30eb82054a0147079d607e5a8c6e67cbdc541cb3eac6504933d.json.gz b/node_modules/.cache/babel-loader/0ad392e4a022a30eb82054a0147079d607e5a8c6e67cbdc541cb3eac6504933d.json.gz new file mode 100644 index 0000000000000000000000000000000000000000..417a70226f093857c6455094877caa8dc3570c8d GIT binary patch literal 1034 zcmV+l1oitLiwFP!000006Qx#dZ`(Ey{wp_igY3+<+HZr3EDP!l2+(E&+J1@xmyymk z7wRbRC5qwrzYnA+$x4(IS-%)2@9w$hj?a~ljM%1$t-0C4+6n=N-3Wv= zGGi5L7oB93QI~VIY7@nO)KV3dLah`2?l+3xcWz5&*p~*#doC79F3U<1lF^CYGKEFb zIUNPYi{!j0IXR+wk!$U2c<*fmu9+1E)|PU^CAC#K-^mpA83E*yw1Hd-Tat!TxbnLI zx426ozF5YyW-ZtaiWF9>iQj~HEmg@Ywu`61Lm?HYQc$vn)8B`!o@9|WO425aX5fzo zvgnOlC|NHqmQx3Dn86^qJG_zf;VeFQ>yPtr1Y9O~c<}!#sm;o8BXE?I*;QktzWD9$ zvk6#j-yIs91`e*QmEQ?e+W&EdDn~MG<4?W;P-v{8fN**`aDp>W>X#uSXsG_h@39zK z0_b6^U{*>?W~AivV0cB*Ndlj&Fnpd{rI7L+6kJz=?Vy%c6tI!7MTL(_bggJu_-4%G zm*`sU24RHm*I@WQU6;?ptnxN#x24_c?O5W18C(fo^08hmnL+s27+)iX5AqPtNTF*!VeKv_oOFQGg^?d+&IG#s&qi_DOkR|b zHq6+uGx;10uWm_$82aHSHtdA6>Q}L)Taq>PgVP{zeV!YB*G?Y`3)d@2v5RbT_}Q{I zg6r**>3edyRE*r!($NLT1=ISHm6*b}26FB@06*_L4rhG^a8goiZQ{eX7UVF4BUe9r zela@U7sN)4!}GcJt7mE`_}x(nNA$C(#hX`bgY)Lb(pePF{C@*&krk+(#o4~=Z|nX6 zcqE(Y^l@PKTJ{v0S1xV;1gWuq+5J}~Qm8oW?0|j5K*8&GZxYqf`9LBE5UO%9?{w!2d%j< zsQ#{8gid=cj}0?`Z2hi|M1RMGMfZ3J(R&VG4`(?(z$3Ab0R>HuV~q&@WjIbR0*=p6 z2YDT4snt*ZxKpesF0oFJGasS<3g<-umsp4IvC;dl2TptIyis^Ku(`YV;=a)K-;EWw zOD~53gQsZDaVVS-G){sOreKuCVcl3(X7>rTdl#F^E+quP!dhA?p7!tHZ=ypqi%M3t zU+E^DiwFP!000006P;B}Z`&{o{VSYya9lX{dK+AHTe0*oU>^n6o$4ZBEjrOA zONJ!R4buGgL5l4rg}V;B7}6v8_(W0kmZ5blSFMx@D>WyUGf_9%IM_mI2pwHYs!2K6 zL1lCe1v7-DE7)0~vXhfS!3lh9ta+d=`9T3H9BmTj#poWo5(0e;aYhe+@! z+3zLZk<4MaoJF4&Q36q=O)VPSL~-w7NO3Yb7~R47yW>*N3TBmIDyYqp6fsqmUChFZcLi(y8!ft<{v| zt3Cd2nghuox?7{O*ff99?6gC<)P|FpNPX?C@XcH8zbZIj9CRE&)?;s`lmC;Fvo7S(hlu zL*JbdYBh`dkX<{FQN(^Ow%)su!<^giv)p=YzM znWKlZ@SS^G+N_(QKa^G_Jx3Ibfo5o9v4aq z^#r53ahoq>Ev~2^HyTDtsC29N#2koy$Lv_bYHWsoPfZTJB9?D=3A4I2C0%bC|39iV iZzZvW(Y+(1P%fzPZ$OoTEX!|hcYgrqeNTeM1^@s*WK{S7 literal 0 HcmV?d00001 diff --git a/node_modules/.cache/babel-loader/5a27f19ce1f1ca46b061d1feeb1df31e799ee018b9105f438b90f6d82a19ca75.json.gz b/node_modules/.cache/babel-loader/5a27f19ce1f1ca46b061d1feeb1df31e799ee018b9105f438b90f6d82a19ca75.json.gz new file mode 100644 index 0000000000000000000000000000000000000000..fa11bd16f7fd9f5e944e9250ce3a99061e6cf115 GIT binary patch literal 2248 zcmV;(2sig1iwFP!000006Wv*DbK5u${wqB0%{b{Y(Pek0w`<3}gK0PCHZM)nT)V9^ zSw^BAB{HSaOWfA$|GooKvS^!flDqqK`jCnM_y7bz2yo|AWI1iCB8nLG<3Q3j4W~(* z=44L%REk^QshM{GlcL)YNVEmudgd@t$)tqG)PjJWnOsji)wY2VttW| z4+cm}?(chkJWXOHRi1g-tw?3yErqO&t$h!IX{gZLY~Rl^z6n z%EO@O&Mujc6d``BvYhyFR7_Pyy5x(d5^^uUwMlE(Z!xou#Ep#F|vr_(SI z-&(t+L@HGv(>6)t8R@=Sb@$GQW_cQ`$%rzd!$U^&2VA7_Y=79_MTi9>E6VdQkEBEY z2Sc|_aBWZ0I4J!5T8XI(<(*+aj+5mgFER(hMag*F7bRZhZG%X<`tV7d<<}+Uk3Tf2 zUbPB!ui}|blud+Vw1sqQctVomCJM9L@`z?31E-Dn1gRM3M!1i!o8G`@@x|!7LX*tv z(w{cFV?X}jOqT~$kwcOEy`+0mE`y!G^y2#T|O?Fm~ zcBNMh9u2|=%b}JtN3=TRULq!PPv|>7qNTU~W1L$l0+}}A+#b|-89iRs$syLsRnPD4 zuJ2yfvDyw(fZEkd87*-qzFwwLo6JHL#IyYhR9C!z?3ZkPQ@mNSCy?yvzkA5rPi~Vc zIaI8C*#xAS8m1E0MICh2Tyc%22O<}xpZD~KVMNPqfsADC+GiN{rg~42M4>O-+bW)O z=QxaVnVu!MEo;}wTo%B(vb2_WKCXnnSXc8wM1^dVmWZO3RUNGR1jupLhLt;B0hMK_ z0j!}eZHEj@eR2YBt6f*+4XZNBUw4)Wf>Swb+d3`i9|;5jIh8Y=*^Px%l%ZR4_e{py zVcWxiwCYnDWl8lO&P5_4vH{CWfB2z}Kv|f^rOQ16ED5E-E5UVP1NE5lN0Lu5i z`De2h>#&NzWyT zGFs;gWzGcPd5P@X<3xd?NadDV$LktCjWpO2N)k5w*J z?j=z%36&+5rM@Y!9)2V;&%}5CF0*uUvstVD|LLip(^WhA>iS|^cbqsnZATGm=(ww= z>S=b;c(#jO&7o%-ct$SS!$$QyW$36~^VB?g@*q+_+eZ@Hh-VHbTRe58>mqSR z{V)h0tUx!7DQh8mWLGtmI0Ackd+=)h$S6V~3+g^TQCXT>xAF8vqR0Ilws!djMe%B@)ig0M57;VJ845Y{CI1 z9GQ7vGueF);2y;X-+N2~NG;9TCBP*x4xq7*Is@Q$T!R=?b_8(5IPlM%A@CtLYi-65 zV2H#IoV^8jtBJ>k#R0hHn00Z)5<1y60m!{8zDrU6a| zchhTLgV#DIz;86?$ncT#ui9xt_7UKtj>VgrTFUAOq5X*Ry|0M_vjIgr=fH1!md9=^ zJGIoBo#&X0etoW>+3hE_+wsq(F=&}Lpw}p+dh87N@U_m4&N;xzndS0H4`9+euB73J z9RW`{9)k1Ad4n-V<;_}9-djP@+lRnEH3X&d{8~`{{%BAxjE|A?p?3eJIRUc%T~iGK z_vYp0K`L1HXn7$~DD9awvIn*N>-x0}wYmB=1ug%TTQ1?i-*g5r=xa}ZGM>hB)SgCh z$a?7AJO1v868Pujz2!!{ORH`?L*?I>_hoQ;Zg%4Ook`6h@Y6w^K7g9L(fV^WFa-`&8+jGqmD8E2Ud>iH%=ne(i4p>T_C!29OYxI};7ZQAOJT79 literal 0 HcmV?d00001 diff --git a/node_modules/.cache/babel-loader/6c8d197c6aef81da583f60809805cf20d20be3ba21f3d898ef1239e5e2e77ee8.json.gz b/node_modules/.cache/babel-loader/6c8d197c6aef81da583f60809805cf20d20be3ba21f3d898ef1239e5e2e77ee8.json.gz new file mode 100644 index 0000000000000000000000000000000000000000..5a5ba42aff01d9d2b9f19cc4faa83fdfa31ae79f GIT binary patch literal 896 zcmV-`1AqJy0Q2<WlHNizOU01;Dkk4!D+esVrQ>eb53t z(Mt-^%{E$fvcyM{DeQKOpoA#brYtIaiI%;GAtlJ9U~~i5zn-^ykumFxR{M;tAdCkx z_M;b!Zjzhr(nGW>IJ?{xPSVW%cb$Hk!d!S|w5Yk;DJ?hxTR6kloUcD?57*PuE{QLUboZo)%(i}1nc0@o*afU16!g+25ob^?jn9Q{ui z%w6Za^~bl}@W1xHyYIoL)E&os47u8tvErMg> z^assRl2?6lrcnFEd1((py3kQke3>+K(#(tvMaC8GDaNql8SA_Czi|$Pg3Lvn!@JWi z`;PZKdE*$fkPI+_$ln#e}TKEq>|7~OnO`(Ktk^wX@-fu~74x6%Wsu;a` z9sb7NmQ;socpOSAPM3g!F~AJ&fz&sFHP2cT^a36BeU8IFhK%)Lf+V@QxXv&QI>pqL zEI7`G4Yt|HypWE}UzHED>FF`|1bAYWXxw={INwiJ^9#zFQixE>Xu=MYecE`-EH|9( z_yE+?&;_syy!35I(ecwP;J3Kzq2I9KMe*0oLLqLcNvC&Cpnryq5O7OPc-a?;6#LPQ z*0_7|)3L>VAknGH;q+L`r)_v1XGy$;^o}zRX$G=TvQU(QGc}#pPi5s^{v>O0PhEw# z8gTlJlj~Z|Or~9WvTE6il~@hmSS301%fQlOyJA+?hSS|k<-fa1Eow<@#pv0QQ7E@m WdG1xbAj{JGhxT7lTluxF2><|HUe<>I literal 0 HcmV?d00001 diff --git a/node_modules/.cache/babel-loader/757e005cd7d8064797f4acf3ee23694f9833484004d3ebd442de956e40f29c90.json.gz b/node_modules/.cache/babel-loader/757e005cd7d8064797f4acf3ee23694f9833484004d3ebd442de956e40f29c90.json.gz new file mode 100644 index 0000000000000000000000000000000000000000..5003aa80f86aea34b91adae3d1b6c1cc7621e8fa GIT binary patch literal 1722 zcmV;r21WTFiwFP!000006Wv&CbJ{o%{wq551EHhf%XK=}Lde~sxH+1nNv_HDjSQpO z0-PAxW0}yD^51V(@*C8IwD;}!z}SygyN~uw3kxcAO517{hKzcVFKL?w(>O{}vLId} zMJnA;PNho8l8lmQN(MBM!b=CVGf>XcrvpWv54c1C zVMtQ(Ih151MLJ8Q#=Xu!4OC%qILys7{+vgNA16|4C)j(T8l6JyP^9A0Dl(F-mg7a! zI8suj+R+n{NZ%=hDjORu2mEQEkfd&TTH~7hV%B^)60EJrtj1*e1i_PNRR=V5BjMl4%f&`$jX9NTl** z(k4kXC*6ZpSMLm{PLoKD2b2*L8Zw|y@Fj`nt-x=hiX|f}#+8`L8uM=qyqy4QMiu1S zH}j0)8s!NzW%D)gq1`;G9OO2!~PP z%cREiC9aY)T-A?dP|=w4s6ZOAU+b9Iko!Ylq;+06H1Ku`na(^nQ5)$R7F7c|Gkosk zJAx6}`2~?CNn|=p6gsU~%^)S`SaEX42)5GbB=STk5qg^@fg0~Lvn@+=%4_qMZC+1n zKe)p*&NzFa&>9o8O$IbS=WZ;Y417Rfc{q>VDPv&F1>n zqQjIVY+q>S4_Uy(jrekvgl#epl#ivADK)+5k5;y9a@Lv0y8>ayeDC5~E1tx8eyB)! za+4ynXw>B5rrm<+XDfa&xGz#s^>emI%TRhopiM?1)H1^Z6$WYzlhZi8Kb2aGvCP^{ zL<*H;6wQ=h(+8TEF-ywmRK&Espm#FSL8NH=8Kc;8G;M#P!y#p~@G)g{r6E(it&Ec? zqqp*&GHPmvGHUAsAEG&mRf9$u4SZ^?P)3U;M;SGZgfg1<5Xxw!j91^#D3(K^-WHi9 zERF1Xm7r*zqm7OGWEWDYNef zcja8uePBX5ShcfdV?GZZe1Ek4$=<=@p(%(g_npb!x;@7a?hf*U6ll?3>%wGOV|S4~ zEWa1YF39fUKMYMZYR#p(Noi$(s@Yn(hr8Qmsqc4}_jY$-MyMJK_B!9ZUcKeJi^q&x zYf79-Kgmt6o{u%HJJ^iU$^ z>)=7mH>PGPW23oo8HCn%Kpams?BYPzL`m03y*6+p} zF7WVhjoW#J8+sJMj~lodj~Cof-Oc(@`#-I&IO@yoM?JO*@lYovdTLW|<54dw+%T~a z40{{Mc>rDwxrA>ecgEfUyfZY;OZ0+$0QgXld%jNYeT5v_Mo?`c_k&5&IR*aNtk^^_ zE0-m=tCHJ4C7LD8De$jZwIB+W!YL{cg_53q$7Q#ae^owaS!!#&L`=*%I^}f^^4A>~ zT8uhYLPZZvUPapM^pPm82>-(1+8 z_Kh+#bjr?Ko>VnCWHS=At4tN14B0Ytr(YBx*RvN@)K2_1lo zKb(WHiV}Ge;Gf2yu9u8XWh(IYqwU2q{{eV;ALIYX)5xEhpQ-XoDibBbLmA@?r@X-Y QG`(K_3kFjIP<|Ew0L&mqLjV8( literal 0 HcmV?d00001 diff --git a/node_modules/.cache/babel-loader/81bc671315573b551e0bfafda03cf846121966f836ee2a2fe60307338dc66c9a.json.gz b/node_modules/.cache/babel-loader/81bc671315573b551e0bfafda03cf846121966f836ee2a2fe60307338dc66c9a.json.gz new file mode 100644 index 0000000000000000000000000000000000000000..5a9dbaaf29407c022bb600eb3b0ad03758d904d3 GIT binary patch literal 2565 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 literal 0 HcmV?d00001 diff --git a/node_modules/.cache/babel-loader/8ff0b9507ffef823cde6831d73d204ad9f7cebce4fc4fb80b7669ec46448a356.json.gz b/node_modules/.cache/babel-loader/8ff0b9507ffef823cde6831d73d204ad9f7cebce4fc4fb80b7669ec46448a356.json.gz new file mode 100644 index 0000000000000000000000000000000000000000..3f5d059f800dfd6ca5b431dd3d872a296085b959 GIT binary patch literal 792 zcmV+z1Lyo7iwFP!000006P;DtZreBz{gnY*Kye^j=v$$}+YOpN6ukm%pQ6BF#F5R0 z8VV#;$8hxT1u4pr6J@)t9t6(y91ds5J>%A~oLZ$)R%(GPXR>azaj=KdAb0pyVU6UV zgUaX{3TBX(u3)bU%1%!Uf>Zb)OC*aHzVJ1|e2}5$#MgcFR=N#Tty19lwL++nyVjuf z@mWCy9Z*-R0V?@-tBq(3TARriFDZF-a69LYf9n$k&&47ub=_z}ayGLYZct;6)?{G`7eNbfgS#9O zDU!686~9K6!)kSsygN@)NGfe=+3;O5iyj6^pvl4LEiC^zuJ%d6tTUR{1xq2E4ixN} z7mVI6q?q{>T?$9ws;9fU!QBLl;ZWXt>z~u{&2dl0vlzj_-5n(JWRg{5v}j8=!RX6i z`8^wt7Za_B*XRL9x`;mouZ=)60sgty|3B!EWF>{ixq9||f6#ST{{f9Pmudp~ZLc3g zPla2@U27-ezedCFxyO7%*Y+7<8TJ$fPrs!b(%Ud!kKI3bU>|fy2Ea=ve`3$(EUYKl z_)pT<`CXKrbjRC98Wgcmz3{kH{_7^$zERwIvcp!FOGqLlyoRJ{ua&f$1o9(~h}yd# z2}x`3k_f{qcV8BRt~K;{QX5WwG)4s~J&jMi#vHDCpm{hzc)lO;?5+-*Nsp?1(F>RU zbo%8ilITLGTn6b0Izs*&u^BNb*iglJ!`C>E18fTx+wZS4ZIBBzPv+UYxW73@SJ8tO zp3NRc9xm{E4*k8G4~y72{0G1NZd49iNkVTIL(*{7zg|Rh==E&d%(+)*;Xn7bMYCy! zIU`LaK9wjKLz=-oyk=+Nxi~6I&FH6?!AHU7b`wP+Qxl;N#ILtLGs W9|ELOqGkETW%mmh^#led2mk=8)Pd^& literal 0 HcmV?d00001 diff --git a/node_modules/.cache/babel-loader/bf45c8260791bbd05d8126d6c8542df5948d308c8405ee75e2830902d6ede1e6.json.gz b/node_modules/.cache/babel-loader/bf45c8260791bbd05d8126d6c8542df5948d308c8405ee75e2830902d6ede1e6.json.gz new file mode 100644 index 0000000000000000000000000000000000000000..29bfa28cad6b15e0684b9500d90bd553c07f6ca2 GIT binary patch literal 1957 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 GC;$NW3MrWY literal 0 HcmV?d00001 diff --git a/src/admin/pages/Access.js b/src/admin/pages/Access.js index c048789eb..071853f81 100644 --- a/src/admin/pages/Access.js +++ b/src/admin/pages/Access.js @@ -1,43 +1,17 @@ /** - * Access Page - Access items management + * Access Page - Access items management with full table features */ import { __ } from '@wordpress/i18n'; -import { useState, useCallback, useEffect } from '@wordpress/element'; -import { Button } from '@wordpress/components'; -import { accessApi } from '../api/client'; import DataTable from '../components/shared/DataTable'; import './AdminPages.css'; -export default function AccessPage({ initialData }) { - const [items, setItems] = useState([]); - const [loading, setLoading] = useState(true); - - const loadItems = useCallback(() => { - setLoading(true); - accessApi.list() - .then(result => { - // Handle both WordPress format and direct format - const items = result.data?.results || result.results || result.data || []; - setItems(items); - }) - .catch(error => { - console.error('Load access items error:', error); - }) - .finally(() => { - setLoading(false); - }); - }, []); - - useEffect(() => { - loadItems(); - }, [loadItems]); - +export default function AccessPage() { const columns = [ { - key: 'id', + key: 'ID', label: __('ID', 'formipay'), - render: (row) => #{row.id} + render: (row) => #{row.ID} }, { key: 'title', @@ -57,7 +31,7 @@ export default function AccessPage({ initialData }) { draft: __('Draft', 'formipay'), }[status] || status; return ( - + {statusLabel} ); @@ -78,15 +52,33 @@ export default function AccessPage({ initialData }) {

{ __('Access Items', 'formipay') }

-
diff --git a/src/admin/pages/Coupons.js b/src/admin/pages/Coupons.js index fdfa7758d..d6648e328 100644 --- a/src/admin/pages/Coupons.js +++ b/src/admin/pages/Coupons.js @@ -1,43 +1,17 @@ /** - * Coupons Page - Coupon management + * Coupons Page - Coupon management with full table features */ import { __ } from '@wordpress/i18n'; -import { useState, useCallback, useEffect } from '@wordpress/element'; -import { Button } from '@wordpress/components'; -import { couponsApi } from '../api/client'; import DataTable from '../components/shared/DataTable'; import './AdminPages.css'; -export default function CouponsPage({ initialData }) { - const [coupons, setCoupons] = useState([]); - const [loading, setLoading] = useState(true); - - const loadCoupons = useCallback(() => { - setLoading(true); - couponsApi.list() - .then(result => { - // Handle both WordPress format and direct format - const coupons = result.data?.results || result.results || result.data || []; - setCoupons(coupons); - }) - .catch(error => { - console.error('Load coupons error:', error); - }) - .finally(() => { - setLoading(false); - }); - }, []); - - useEffect(() => { - loadCoupons(); - }, [loadCoupons]); - +export default function CouponsPage() { const columns = [ { - key: 'id', + key: 'ID', label: __('ID', 'formipay'), - render: (row) => #{row.id} + render: (row) => #{row.ID} }, { key: 'code', @@ -55,18 +29,36 @@ export default function CouponsPage({ initialData }) { { key: 'amount', label: __('Amount', 'formipay'), + render: (row) => { + // Multi-currency display would go here + return row.amount || '-'; + } }, { key: 'usages', label: __('Usages', 'formipay'), render: (row) => row.usage_count || row.usages || 0 }, + { + key: 'date_limit', + label: __('Date Limit', 'formipay'), + render: (row) => { + const dateLimit = row.date_limit; + if (!dateLimit || dateLimit === 'none') return __('Unlimited', 'formipay'); + return new Date(dateLimit).toLocaleDateString(); + } + }, { key: 'status', label: __('Status', 'formipay'), render: (row) => { const status = row.post_status || row.status || 'unknown'; - return status === 'publish' ? __('Active', 'formipay') : __('Inactive', 'formipay'); + const isActive = row.active === 'on' || status === 'publish'; + return ( + + {isActive ? __('Active', 'formipay') : __('Inactive', 'formipay')} + + ); } }, ]; @@ -75,26 +67,33 @@ export default function CouponsPage({ initialData }) {

{ __('Coupons', 'formipay') }

-
diff --git a/src/admin/pages/Customers.js b/src/admin/pages/Customers.js index 804c09ae6..4bbcbdf1b 100644 --- a/src/admin/pages/Customers.js +++ b/src/admin/pages/Customers.js @@ -1,37 +1,12 @@ /** - * Customers Page - Customer list + * Customers Page - Customer list with full table features */ import { __ } from '@wordpress/i18n'; -import { useState, useCallback, useEffect } from '@wordpress/element'; -import { customersApi } from '../api/client'; import DataTable from '../components/shared/DataTable'; import './AdminPages.css'; -export default function CustomersPage({ initialData }) { - const [customers, setCustomers] = useState([]); - const [loading, setLoading] = useState(true); - - const loadCustomers = useCallback(() => { - setLoading(true); - customersApi.list() - .then(result => { - // Handle both WordPress format and direct format - const customers = result.data?.results || result.results || result.data || []; - setCustomers(customers); - }) - .catch(error => { - console.error('Load customers error:', error); - }) - .finally(() => { - setLoading(false); - }); - }, []); - - useEffect(() => { - loadCustomers(); - }, [loadCustomers]); - +export default function CustomersPage() { const columns = [ { key: 'id', @@ -76,8 +51,11 @@ export default function CustomersPage({ initialData }) { diff --git a/src/admin/pages/Licenses.js b/src/admin/pages/Licenses.js index b236acf04..40db33ee9 100644 --- a/src/admin/pages/Licenses.js +++ b/src/admin/pages/Licenses.js @@ -1,46 +1,12 @@ /** - * Licenses Page - License management + * Licenses Page - License management with full table features */ import { __ } from '@wordpress/i18n'; -import { useState, useCallback, useEffect } from '@wordpress/element'; import DataTable from '../components/shared/DataTable'; import './AdminPages.css'; -export default function LicensesPage({ initialData }) { - const [licenses, setLicenses] = useState([]); - const [loading, setLoading] = useState(true); - - const loadLicenses = useCallback(() => { - setLoading(true); - // Licenses API might use a different endpoint - fetch(window.formipayAdmin?.ajaxUrl || '/wp-admin/admin-ajax.php', { - method: 'POST', - credentials: 'same-origin', - headers: { 'Content-Type': 'application/x-www-form-urlencoded' }, - body: new URLSearchParams({ - action: 'formipay-tabledata-licenses', - _wpnonce: window.formipayAdmin?.nonce || '', - }), - }) - .then(response => response.json()) - .then(result => { - // Handle both WordPress format and direct format - const licenses = result.data?.results || result.results || result.data || []; - setLicenses(licenses); - }) - .catch(error => { - console.error('Load licenses error:', error); - }) - .finally(() => { - setLoading(false); - }); - }, []); - - useEffect(() => { - loadLicenses(); - }, [loadLicenses]); - +export default function LicensesPage() { const columns = [ { key: 'id', @@ -76,25 +42,31 @@ export default function LicensesPage({ initialData }) { inactive: __('Inactive', 'formipay'), expired: __('Expired', 'formipay'), }; - return statusLabels[status] || status; + const statusClass = status === 'active' ? 'publish' : status === 'expired' ? 'pending' : 'draft'; + return ( + + {statusLabels[status] || status} + + ); } }, ]; return (
-
-
-

{ __('Licenses', 'formipay') }

-
- - +
+

{ __('Licenses', 'formipay') }

+ +
); }