import{F as g,P as l,Q as t,R as e,Z as N,X as m,T as v,W as B,a0 as i,a2 as b,c3 as S,ai as E,as as I,_ as f,a1 as M,e as s,a5 as x,a6 as y}from"./vendor-DWvj1jit.js";import{_ as F,bb as T,ck as D,g as Q,cb as R,o as z}from"./index-8PssKxKU.js";import{u as A}from"./useSkyflowCards-DOGTzQFe.js";const X={class:"credit-card__number"},G={key:0,class:"credit-card__expire"},L={class:"credit-card__expiration-date"},O=g({__name:"credit-card",props:{cardNumber:{},cardExpiration:{},cardActive:{type:Boolean}},emits:["remove"],setup(r){return(a,o)=>{const _=l("VcIcon"),d=l("VcButton");return e(),t("div",{class:N(["credit-card",{"credit-card--disabled":!r.cardActive}])},[m(_,{class:"credit-card__icon",name:"credit-card"}),v("div",X,i(r.cardNumber),1),m(d,{class:"credit-card__remove","aria-label":a.$t("common.buttons.remove_credit_card"),color:"neutral",size:"xs",variant:"no-background",icon:"delete-thin",onClick:o[0]||(o[0]=u=>a.$emit("remove"))},null,8,["aria-label"]),r.cardExpiration?(e(),t("div",G,[b(i(a.$t("common.prefixes.expires"))+" ",1),v("span",L,i(r.cardExpiration),1)])):B("",!0)],2)}}}),P={},W={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 Z(r,a){return e(),t("div",W,[...a[0]||(a[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 j=F(P,[["render",Z]]),q={key:0,class:"flex flex-col divide-y lg:space-y-3 lg:divide-none"},H={key:1,class:"space-y-3 md:space-y-2.5"},ee=g({__name:"saved-credit-cards",setup(r){const{t:a}=E(),{openModal:o}=z(),{loading:_,skyflowCards:d,fetchSkyflowCards:u}=A(),{mutate:k}=I(D,{refetchQueries:[T.Query.GetSkyflowCards]}),{storeId:h}=Q;function w(n){const p=o({component:"VcConfirmationModal",props:{variant:"danger",title:a("pages.account.saved_credit_cards.delete_credit_card_modal.title"),text:a("pages.account.saved_credit_cards.delete_credit_card_modal.message"),async onConfirm(){p(),await k({command:{skyflowId:n,storeId:h}})}}})}return u(),(n,p)=>{const V=l("VcTypography"),C=l("VcEmptyView");return e(),t("div",null,[m(V,{tag:"h1"},{default:M(()=>[b(i(n.$t("shared.account.navigation.links.saved_credit_cards")),1)]),_:1}),s(_)?(e(),t("div",q,[(e(),t(x,null,y(3,c=>m(s(j),{key:c})),64))])):s(d)?.length?(e(),t("div",H,[(e(!0),t(x,null,y(s(d),(c,$)=>(e(),f(s(O),{key:$,"card-number":s(R)(c.cardNumber),"card-expiration":c.cardExpiration,"card-active":c.active,onRemove:J=>w(c.skyflowId)},null,8,["card-number","card-expiration","card-active","onRemove"]))),128))])):(e(),f(C,{key:2,text:n.$t("pages.account.saved_credit_cards.no_cards"),icon:"credit-card"},null,8,["text"]))])}}});export{ee as default};
//# sourceMappingURL=saved-credit-cards-B4Ba7dsw.js.map
