import{R as n,K as l,S as c,W as y,X as p,M as d}from"./index-BbBXKozi.js";import{g as A}from"./getBLASTApiError-DvTYCQ_-.js";const K=({onSuccess:i,onError:a})=>{const o=n(),{userId:r}=l(),t=c(),e=y();return p({mutationFn:s=>o.purchaseProduct(s.id,s.body),onSuccess(){r&&(e.invalidateQueries({queryKey:["userWallet",r]}),e.invalidateQueries({queryKey:["pointsProducts"]}),e.invalidateQueries({queryKey:["pointsPurchases"]}),e.invalidateQueries({queryKey:d.all})),i?.()},onError(s){const u=A(s);if(e.invalidateQueries({queryKey:["pointsProducts"]}),u){t.showFailureAlert(u.message);return}else t.showFailureAlert("Failed to purchase product, please try again later");a?.(s)}})};export{K as u};
//# sourceMappingURL=usePurchaseProduct-BBTZEUki.js.map