import{u as r}from"./Note.DalStCGz.js";import{b as l,_ as s}from"./main.2.8.10.js";const p=(e,a,i)=>{a(!0),l(null,"wishlist_authorization").then(t=>{t!=null&&t.success?(e(!0),i({show:!0,msg:s("Authorized Successfully","bit-integrations")})):(e(!1),i({show:!0,msg:(t==null?void 0:t.data)||s("Authorization Failed, Please try again","bit-integrations")})),a(!1)})},m=e=>{const a=e.filter(i=>(i==null?void 0:i.required)===!0);return a.length>0?a.map(i=>({formField:"",wishlistMemberField:i.key})):[{formField:"",wishlistMemberField:""}]},g=(e,a)=>{a(i=>r(i,t=>{t.field_map.splice(e,0,{})}))},f=(e,a)=>{a(i=>r(i,t=>{t.field_map.length>1&&t.field_map.splice(e,1)}))},d=e=>!(e.field_map.filter(i=>i.formField&&i.wishlistMemberField).length>0),F=(e,a)=>{a(i=>r(i,t=>{t[e.target.name]=e.target.value}))},u=e=>{let a=!1;return(e==null?void 0:e.action)===""&&(a=!0),d(e)||a},_=(e,a,i)=>{a(!0),l({},"get_wishlist_levels").then(t=>{if(t&&t.success){a(!1),e(c=>r(c,n=>{n.levels=(t==null?void 0:t.data)||[]})),i({show:!0,msg:s("Membership levels refreshed","bit-integrations")});return}i({show:!0,msg:s("Membership levels refresh failed. please try again","bit-integrations")})}).catch(()=>a(!1))};export{g as a,u as c,f as d,m as g,p as h,_ as r,F as s};
