import{K as b,S as i,L as t,M as a,aq as S,V as l,U as f,a7 as B,W as n,X as k,c5 as E,Z as M,aa as I,P as y,T,b as s,N as g,O as x}from"./vendor-bSWkQivH.js";import{e as D,h as F,am as z,c4 as A,g as L,bY as O}from"./index-Dqv5IkpS.js";import{u as Q}from"./useSkyflowCards-C4tN6b9M.js";const R={class:"credit-card__number"},X={key:0,class:"credit-card__expire"},q={class:"credit-card__expiration-date"},G=b({__name:"credit-card",props:{cardNumber:{},cardExpiration:{},cardActive:{type:Boolean}},emits:["remove"],setup(_){return(e,o)=>{const m=i("VcIcon"),c=i("VcButton");return a(),t("div",{class:S(["credit-card",{"credit-card--disabled":!e.cardActive}])},[l(m,{class:"credit-card__icon",name:"credit-card"}),f("div",R,n(e.cardNumber),1),l(c,{class:"credit-card__remove","aria-label":e.$t("common.buttons.remove_credit_card"),color:"neutral",size:"xs",variant:"no-background",icon:"delete-thin",onClick:o[0]||(o[0]=p=>e.$emit("remove"))},null,8,["aria-label"]),e.cardExpiration?(a(),t("div",X,[k(n(e.$t("common.prefixes.expires"))+" ",1),f("span",q,n(e.cardExpiration),1)])):B("",!0)],2)}}}),K={},P={class:"flex flex-col border-y bg-additional-50 pb-4 pt-4.5 shadow-sm md:flex-row md:items-center md:rounded md:border-x md:py-0"};function U(_,e){return a(),t("div",P,e[0]||(e[0]=[E('<div class="grow px-6 text-lg md:py-5 md:text-base"><div class="w-8/12 bg-neutral-100"> </div></div><div class="mt-1.5 shrink-0 px-6 text-sm md:mt-0 md:text-base"><div class="w-32 bg-neutral-100"> </div></div><div class="hidden shrink-0 px-6 md:flex"><div class="h-7 w-16 bg-neutral-100"> </div></div>',3)]))}const W=D(K,[["render",U]]),Y={key:0,class:"flex flex-col divide-y lg:space-y-3 lg:divide-none"},Z={key:1,class:"space-y-3 md:space-y-2.5"},ae=b({__name:"saved-credit-cards",setup(_){const{t:e}=M(),{openModal:o}=F(),{loading:m,skyflowCards:c,fetchSkyflowCards:p}=Q(),{mutate:h}=I(A,{refetchQueries:[z.Query.GetSkyflowCards]}),{storeId:w}=L;function V(d){const u=o({component:"VcConfirmationModal",props:{variant:"danger",title:e("pages.account.saved_credit_cards.delete_credit_card_modal.title"),text:e("pages.account.saved_credit_cards.delete_credit_card_modal.message"),async onConfirm(){u(),await h({command:{skyflowId:d,storeId:w}})}}})}return p(),(d,u)=>{var v;const C=i("VcTypography"),$=i("VcEmptyView");return a(),t("div",null,[l(C,{tag:"h1"},{default:T(()=>[k(n(d.$t("shared.account.navigation.links.saved_credit_cards")),1)]),_:1}),s(m)?(a(),t("div",Y,[(a(),t(g,null,x(3,r=>l(s(W),{key:r})),64))])):(v=s(c))!=null&&v.length?(a(),t("div",Z,[(a(!0),t(g,null,x(s(c),(r,N)=>(a(),y(s(G),{key:N,"card-number":s(O)(r.cardNumber),"card-expiration":r.cardExpiration,"card-active":r.active,onRemove:j=>V(r.skyflowId)},null,8,["card-number","card-expiration","card-active","onRemove"]))),128))])):(a(),y($,{key:2,text:d.$t("pages.account.saved_credit_cards.no_cards"),icon:"credit-card"},null,8,["text"]))])}}});export{ae as default};
//# sourceMappingURL=saved-credit-cards-YeA_vpAQ.js.map
