import{r as i,R as r,d as p}from"../../common/reactLib.e6c3163a.js";import{aG as m,aB as g,aN as f}from"../../common/antd.4d4fd46b.js";import{F as x}from"../../common/antdIcons.ade4382e.js";import"../../common/redux.9e31c27a.js";function _(){import.meta.url,import("_").catch(()=>1);async function*t(){}}axios.CancelToken;const y=axios.create({baseURL:wpApiSettings.root,timeout:0,headers:{"X-WP-Nonce":wpApiSettings.nonce,"X-ACFW-Context":"frontend"}});function S(){const[t,o]=i.useState([]),[c,s]=i.useState(!0),[a,l]=i.useState(1),[d,u]=i.useState(0);return i.useEffect(()=>{s(!0),(async()=>{const e=await y.get("store-credits/v1/entries/current-user",{params:{page:a,currency:acfwStoreCredits.currency}});o(e.data),s(!1),u(e.headers["x-total"])})()},[a]),{entries:t,loading:c,currentPage:a,total:d,setCurrentPage:l}}function C(t){return t.type==="increase"?"+":"-"}const E=()=>{const{labels:t}=acfwStoreCredits,{entries:o,loading:c,currentPage:s,total:a,setCurrentPage:l}=S(),d=[{title:t.date,dataIndex:"date",key:"date"},{title:t.activity,dataIndex:"activity",key:"activity",render:(n,e)=>[n,e.note?r.createElement(m,{placement:"top",content:e.note,trigger:"click",overlayClassName:"entry-note-popover"},r.createElement(x,{style:{paddingLeft:"5px"}})):null]},{title:t.amount,dataIndex:"amount",key:"amount",render:(n,e)=>"".concat(C(e)).concat(n)},{title:t.related,dataIndex:"rel_label",key:"rel_label",render:(n,e)=>e.rel_link?r.createElement("a",{href:e.rel_link},n):n}],u=n=>{l(n)};return r.createElement("div",{className:"acfw-store-credit-history"},r.createElement(g,{loading:c,columns:d,dataSource:o,pagination:!1}),0<a&&r.createElement(f,{defaultCurrent:s,current:s,hideOnSinglePage:!0,disabled:!o||!o.length,total:a,pageSize:10,showSizeChanger:!1,onChange:u}))},h=()=>r.createElement(E,null);p.render(r.createElement(h,null),document.querySelector("#acfwf_store_credits_app"));export{_ as __vite_legacy_guard};
