PageSourceSearch

https://www.bergesinstitutespanish.com/build/assets/Billing-BqMcs4_D.js

js bergesinstitutespanish.com collected 2026-10-02 03:02:01 UTC 8,403 bytes, 1 lines download raw bytes

1import{L as C}from"./Loader-Baqe17Om.js";import{M as S}from"./Modal-TGyeVepA.js";import{r as b,o as n,c as r,a as i,t as e,f as h,g as f,d as u,F as g,e as y,h as p,w as D,v as $,b as d}from"./vue-router-CSEP06dd.js";import{_ as M}from"./_plugin-vue_export-helper-DlAUqK2U.js";const R={components:{Modal:S,Loader:C},data(){return{discountFieldShown:!1,discountCode:null,card:this.$root.auth_user.billing_info,purchases:[],subscriptions:[],billingReady:!1,purchasesReady:!1,hasNonZeroPurchases:!1,subscriptionsReady:!1,confirmModalShown:!1,selectedSubscription:null,status:"",timezone:""}},mounted(){this.addTitleAndDescription(this.$t("billing"),""),this.timezone=this.guessTimezone(),this.$route.query.status==="card_updated"?Snackbar.show(this.$t("success")):this.$route.query.status==="success"?Snackbar.show(this.$t("success")):this.$route.query.status==="failed"&&Snackbar.show(this.$t("errorMessage")),this.getCard(),this.getPurchases(),this.getSubscriptions()},methods:{getCard(){this.getBillingInfo(()=>{this.card=this.$root.auth_user.billing_info,this.billingReady=!0})},getPurchases(){axios.get("/purchases").then(s=>{let o=s.data.data;o.forEach(c=>{c.datetimeLocal=this.formatDateTimeLong(c.created_at,{timezone:this.timezone,year:!0}),c.amount_paid>0&&(this.hasNonZeroPurchases=!0)}),this.purchases=_.orderBy(o,["created_at"],["desc"]),this.purchasesReady=!0})},getSubscriptions(){axios.get("/subscriptions?currency="+this.getCurrency()).then(s=>{this.subscriptions=s.data.data.filter(o=>o.status!=="canceled"),this.subscriptions.forEach(o=>o.nextChargeDatetimeLocal=moment(o.current_period_end).tz(this.timezone).format(this.$t("dateFormatLong"))),this.subscriptionsReady=!0})},refresh(){location.reload()},updateCard(){this.status="processing",Snackbar.show(this.$t("processing")),axios.post("/checkout-session",{type:"update_card",return_url:window.location.href.split("?")[0]}).then(s=>{window.location.href=s.data.checkout_url}).catch(s=>{Snackbar.show(this.getErrorMessage(s)),this.status=""})},showConfirmModal(s){this.confirmModalShown=!0,this.selectedSubscription=s},hideConfirmModal(){this.confirmModalShown=!1,this.selectedSubscription=null},toggleAutoRenew(s){if(this.status)return;const o=s.cancel_at_period_end?"/revert-cancel-subscription-at-period-end":"/cancel-subscription-at-period-end";this.status="updating",Snackbar.show(this.$t("processing")),axios.post(o,{subscription_id:s.id}).then(()=>{Snackbar.show(this.$t("success")),setTimeout(()=>this.refresh(),1e3)}).catch(c=>Snackbar.show(this.getErrorMessage(c))).finally(()=>this.status="")},cancelSubscription(){this.status||(this.status="processing",Snackbar.show(this.$t("processing")),axios.post("/cancel-subscription-right-away",{subscription_id:this.selectedSubscription.id}).then(()=>{Snackbar.show(this.$t("success")),setTimeout(()=>this.refresh(),1e3)}).catch(s=>Snackbar.show(this.getErrorMessage(s))).finally(()=>this.status=""))},showDiscountField(){this.discountFieldShown=!0,this.$nextTick(()=>{this.$refs.discountInput&&this.$refs.discountInput.focus()})},applyDiscount(){if(this.discountCode=this.normalizeDiscountCode(this.discountCode),!this.isValidDiscountCode(this.discountCode)){Snackbar.show(this.$t("invalidDiscountCode"));return}axios.post("/apply-discount-to-subscription",{subscription_id:this.subscriptions[0].id}).then(()=>{Snackbar.show(this.$t("success")),setTimeout(()=>this.refresh(),1e3)}).catch(s=>Snackbar.show(this.getErrorMessage(s))).finally(()=>this.status="")}}},F={class:"p-4 border-bottom"},L={class:"h3 mb-0"},N={class:"p-4 border-bottom"},z={type:"button",class:"btn btn-sm btn-dark","data-bs-dismiss":"modal"},T={key:0},I={key:0},B={class:"mb-3"},E={class:"mb-3 d-flex align-items-center"},P={key:1},V={class:"mb-3"},q={key:0,class:"mt-4"},A={class:"fw-bold"},Z={key:0,class:"small"},O={key:1,class:"small"},U={class:"mt-2 rounded bg-danger text-white px-3 py-2 fw-bold"},j={key:2,class:"mt-3 form-check form-switch"},x=["checked","onChange"],G={class:"form-check-label",for:"switch"},H={key:3,class:"mt-3 small"},J=["onClick"],K={class:"mt-3 small"},Q={key:0},W={key:0},X={key:1,class:"w-100 d-flex"},Y={class:"flex-grow-1 pe-1"},ss=["placeholder"],ts={class:"ps-1"},es={key:1,class:"text-success"},is={key:1,class:"mt-4"},os={class:"mb-3"},ns={key:0},rs={key:0,class:"small text-muted"},as=["href"],ls={key:0},cs=["href"];function ds(s,o,c,hs,a,l){const k=b("modal"),m=b("loader"),w=b("vue-feather");return n(),r("div",null,[i("div",F,[i("h1",L,e(s.$t("billing")),1)]),i("div",N,[h(k,{title:s.$t("pleaseConfirm"),shown:a.confirmModalShown,onClosed:l.hideConfirmModal},{body:f(()=>[i("div",null,e(s.$t("cancelSubscriptionConfirm")),1)]),footer:f(()=>[i("button",z,e(s.$t("dontDoIt")),1),i("button",{type:"button",class:"ms-2 btn btn-sm btn-danger",onClick:o[0]||(o[0]=(...t)=>l.cancelSubscription&&l.cancelSubscription(...t))},e(s.$t("cancelSubscription")),1)]),_:1},8,["title","shown","onClosed"]),h(m,{show:!a.billingReady},null,8,["show"]),a.billingReady?(n(),r("div",T,[i("div",null,[a.card?(n(),r("div",I,[i("h5",B,e(s.$t("cardOnFile")),1),i("div",E,[h(w,{class:"me-2",type:"credit-card",size:"1.3rem"}),i("div",null,e(this.ucFirst(a.card.brand))+" "+e(s.$t("endingIn"))+" "+e(a.card.last4),1)]),i("div",null,[i("button",{class:"btn btn-sm btn-dark",onClick:o[1]||(o[1]=u((...t)=>l.updateCard&&l.updateCard(...t),["prevent"]))},e(s.$t("change")),1)])])):(n(),r("div",P,[i("h5",V,e(s.$t("noBillingInfo")),1),i("button",{class:"btn btn-sm btn-dark",onClick:o[2]||(o[2]=u((...t)=>l.updateCard&&l.updateCard(...t),["prevent"]))},e(s.$t("addNewCard")),1)]))]),h(m,{show:!a.subscriptionsReady,class:"mt-3"},null,8,["show"]),a.subscriptionsReady&&a.subscriptions.length>
10?(n(),r("div",q,[i("h5",null,e(s.$t("subscriptions")),1),(n(!0),r(g,null,y(a.subscriptions,t=>(n(),r("div",{key:t.id,class:"mt-3 p-3 border rounded"},[i("div",A,e(s.$t("unlimitedClassesLabel"))+" | "+e(s.formatNumber(t.price))+" "+e(t.price_label),1),t.cancel_at_period_end?(n(),r("div",O,[i("div",null,[p(e(s.$t("cancels"))+" ",1),i("b",null,e(t.nextChargeDatetimeLocal),1)]),i("div",U,e(s.$t("cancelSubscriptionInfo")),1)])):(n(),r("div",Z,[p(e(t.status==="trialing"?s.$t("startsOn"):s.$t("nextCharge"))+" ",1),i("b",null,e(s.ucFirst(t.nextChargeDatetimeLocal)),1)])),t.status!=="trialing"?(n(),r("div",j,[i("input",{class:"form-check-input",checked:!t.cancel_at_period_end,type:"checkbox",role:"switch",id:"switch",onChange:v=>l.toggleAutoRenew(t)},null,40,x),i("label",G,e(s.$t("autoRenew")),1)])):(n(),r("div",H,[i("a",{href:"",class:"text-danger",onClick:u(v=>l.showConfirmModal(t),["prevent"])},e(s.$t("cancelSubscription")),9,J)]))]))),128)),i("div",K,[a.subscriptions[0].price_for_next_cycle==null?(n(),r("div",Q,[a.discountFieldShown?(n(),r("div",X,[i("div",Y,[D(i("input",{ref:"discountInput",class:"form-control","onUpdate:modelValue":o[4]||(o[4]=t=>a.discountCode=t),onChange:o[5]||(o[5]=(...t)=>l.applyDiscount&&l.applyDiscount(...t)),placeholder:s.$t("discountCode")},null,40,ss),[[$,a.discountCode]])]),i("div",ts,[i("button",{class:"btn btn-outline-primary",onClick:o[6]||(o[6]=(...t)=>l.applyDiscount&&l.applyDiscount(...t))},e(s.$t("apply")),1)])])):(n(),r("div",W,[i("a",{href:"",class:"text-black",onClick:o[3]||(o[3]=u((...t)=>l.showDiscountField&&l.showDiscountField(...t),["prevent"]))},e(s.$t("haveDiscountCode")),1)]))])):(n(),r("div",es,e(s.$t("discountedNextCharge",{price:a.subscriptions[0].price_for_next_cycle_string})),1))])])):d("",!0),h(m,{show:!a.purchasesReady,class:"mt-3"},null,8,["show"]),a.purchasesReady&&a.hasNonZeroPurchases?(n(),r("div",is,[i("h5",os,e(s.$t("activity")),1),(n(!0),r(g,null,y(a.purchases,t=>(n(),r("div",{key:t.created_at,class:"mb-2"},[i("div",null,[p(e(s.ucFirst(t.datetimeLocal))+" | "+e(t.purchasable.name)+" | "+e(t.amount_paid)+" "+e(t.currency)+" ",1),t.referrer?(n(),r("span",ns,"(referrer: "+e(t.referrer)+")",1)):d("",!0)]),t.credits?(n(),r("div",rs,e(s.$t("creditsUsed"))+": "+e(t.credits.used)+" | "+e(s.$t("creditsRemaining"))+": "+e(t.credits.remaining),1)):d("",!0),i("div",null,[i("a",{href:t.receipt_url,target:"_blank"},e(s.$t("receipt")),9,as),t.gift_card_url?(n(),r("span",ls,[o[7]||(o[7]=p(" | ",-1)),i("a",{href:t.gift_card_url,target:"_blank"},e(s.$t("giftCardPdf")),9,cs)])):d("",!0)])]))),128))])):d("",!0)])):d("",!0)]),o[8]||(o[8]=i("div",{class:"pb-5"},null,-1))])}const fs=M(R,[["render",ds]]);export{fs as default};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.