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 A,e as D,cK as F,g as Q,cA as R,a$ as T}from"./index-GCDRvGOr.js";import{u as z}from"./useSkyflowCards-C2T8col_.js";const O={class:"credit-card__number"},X={key:0,class:"credit-card__expire"},G={class:"credit-card__expiration-date"},K=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",O,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),v("span",G,n(e.cardExpiration),1)])):B("",!0)],2)}}}),L={},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]=[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 W=A(L,[["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"},ee=x({__name:"saved-credit-cards",setup(_){const{t:e}=E(),{openModal:o}=D(),{loading:m,skyflowCards:c,fetchSkyflowCards:p}=z(),{mutate:b}=M(F,{refetchQueries:[T.Query.GetSkyflowCards]}),{storeId:h}=Q;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",Y,[(a(),t(y,null,g(3,r=>l(s(W),{key:r})),64))])):s(c)?.length?(a(),t("div",Z,[(a(!0),t(y,null,g(s(c),(r,$)=>(a(),f(s(K),{key:$,"card-number":s(R)(r.cardNumber),"card-expiration":r.cardExpiration,"card-active":r.active,onRemove:j=>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-CWjILOxk.js.map
