"use strict";exports.id=5700,exports.ids=[5700],exports.modules={65700:(e,t,s)=>{s.a(e,async(e,a)=>{try{s.d(t,{Kj:()=>useCards,Li:()=>useDeleteCard,VR:()=>useDefaultPaymentMethod,ie:()=>useAddCards});var u=s(61175),d=s(77649),r=s(54574),n=s(86201),l=s(45009),c=s(11377),o=s(99930),i=e([r,n,o]);function useCards(e,t){let{isAuthorized:s}=(0,o.P)(),{data:a,isLoading:n,error:l}=(0,u.useQuery)([d.P.CARDS,e],()=>r.Z.cards.all(e),{enabled:s,...t});return{cards:a??[],isLoading:n,error:l}}[r,n,o]=i.then?(await i)():i;let useDeleteCard=()=>{let e=(0,u.useQueryClient)(),{t}=(0,c.useTranslation)(),{closeModal:s}=(0,l.SO)(),{mutate:a,isLoading:o,error:i}=(0,u.useMutation)(r.Z.cards.remove,{onSuccess:()=>{s(),n.default.success(t("common:text-card-successfully-deleted"))},onSettled:()=>{e.invalidateQueries(d.P.CARDS)}});return{deleteCard:a,isLoading:o,error:i}};function useAddCards(e){let{t}=(0,c.useTranslation)(),{closeModal:s}=(0,l.SO)(),a=(0,u.useQueryClient)(),{mutate:o,isLoading:i,error:m}=(0,u.useMutation)(r.Z.cards.addPaymentMethod,{onSuccess:()=>{s(),n.default.success(t("common:text-card-successfully-add"),{id:"success"})},onError:e=>{let{response:{data:s}}=e??{};n.default.error(t(s?.message),{id:"error"})},onSettled:()=>{a.invalidateQueries(d.P.CARDS)}});return{addNewCard:o,isLoading:i,error:m}}function useDefaultPaymentMethod(){let{t:e}=(0,c.useTranslation)(),t=(0,u.useQueryClient)(),{mutate:s,isLoading:a,error:l}=(0,u.useMutation)(r.Z.cards.makeDefaultPaymentMethod,{onSuccess:()=>{n.default.success(e("common:text-set-default-card-message"))},onSettled:()=>{t.invalidateQueries(d.P.CARDS)}});return{createDefaultPaymentMethod:s,isLoading:a,error:l}}a()}catch(e){a(e)}})}};