import{M as x,U as i,N as t,O as a,aA as N,X as l,W as v,a8 as B,Y as n,Z as k,c2 as S,$ as E,aa as M,R as f,V as I,e as s,P as y,Q as g}from"./vendor-CsGITfgk.js";import{d as Q,e as A,cQ as D,g as F,cG as R,a$ as T}from"./index-CsCqMgta.js";import{u as z}from"./useSkyflowCards-Z-31kXMS.js";const G={class:"credit-card__number"},O={key:0,class:"credit-card__expire"},X={class:"credit-card__expiration-date"},L=x({__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:N(["credit-card",{"credit-card--disabled":!e.cardActive}])},[l(m,{class:"credit-card__icon",name:"credit-card"}),v("div",G,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",O,[k(n(e.$t("common.prefixes.expires"))+" ",1),v("span",X,n(e.cardExpiration),1)])):B("",!0)],2)}}}),P={},U={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 W(_,e){return a(),t("div",U,[...e[0]||(e[0]=[S('<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 Y=Q(P,[["render",W]]),Z={key:0,class:"flex flex-col divide-y lg:space-y-3 lg:divide-none"},j={key:1,class:"space-y-3 md:space-y-2.5"},ee=x({__name:"saved-credit-cards",setup(_){const{t:e}=E(),{openModal:o}=A(),{loading:m,skyflowCards:c,fetchSkyflowCards:p}=z(),{mutate:b}=M(D,{refetchQueries:[T.Query.GetSkyflowCards]}),{storeId:h}=F;function w(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 b({command:{skyflowId:d,storeId:h}})}}})}return p(),(d,u)=>{const V=i("VcTypography"),C=i("VcEmptyView");return a(),t("div",null,[l(V,{tag:"h1"},{default:I(()=>[k(n(d.$t("shared.account.navigation.links.saved_credit_cards")),1)]),_:1}),s(m)?(a(),t("div",Z,[(a(),t(y,null,g(3,r=>l(s(Y),{key:r})),64))])):s(c)?.length?(a(),t("div",j,[(a(!0),t(y,null,g(s(c),(r,$)=>(a(),f(s(L),{key:$,"card-number":s(R)(r.cardNumber),"card-expiration":r.cardExpiration,"card-active":r.active,onRemove:q=>w(r.skyflowId)},null,8,["card-number","card-expiration","card-active","onRemove"]))),128))])):(a(),f(C,{key:2,text:d.$t("pages.account.saved_credit_cards.no_cards"),icon:"credit-card"},null,8,["text"]))])}}});export{ee as default};
//# sourceMappingURL=saved-credit-cards-DGqtFSV-.js.map
