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 E,$ as S,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,cO as F,g as O,cE as Q,a$ as R}from"./index-B7qwhRTg.js";import{u as T}from"./useSkyflowCards-CpPlUqy0.js";const z={class:"credit-card__number"},X={key:0,class:"credit-card__expire"},G={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",z,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)}}}),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]=[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 Y=A(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}=S(),{openModal:o}=D(),{loading:m,skyflowCards:c,fetchSkyflowCards:p}=T(),{mutate:b}=M(F,{refetchQueries:[R.Query.GetSkyflowCards]}),{storeId:h}=O;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(Q)(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-DNbh1RWK.js.map
