1import{_ as j}from"./BvWtaWD2.js";import{_ as z}from"./D0GswM4i.js";import{g as Y,R as O}from"./COO75Zc6.js";import{u as Z}from"./Cl3oHEPy.js";import{d as A,u as P,E as G,z as H,y as J,k as m,v as K,B as Q,x as W,j as w,o as y,c as _,a as n,t as s,h as e,b as c,w as f,L as D,n as k,m as C,e as U,i as M,Z as X}from"./CYMs3uwY.js";import"./CFprKcbD.js";const ee={class:"auto-renew-container"},te={class:"top-bar"},oe={class:"section-description"},ne={class:"form-section"},ae={class:"form-item"},se={key:0,class:"error-message"},le={class:"section-description"},re={class:"form-section"},ie={class:"form-item"},ce={class:"form-item"},ue={key:0,class:"error-message"},de={class:"form-item"},pe={key:0,class:"error-message"},me={class:"form-note"},ye={key:0,class:"form-item"},_e={key:0,class:"error-message"},fe={class:"form-actions"},ve=A({__name:"index",setup(q){const{t}=P(),v=Z(),S=G(),{currencyList:B}=H(J()),o=m({}),g=Y(t),h=m("credit_card"),N=m([{title:t("Credit Card"),value:"credit_card"}]),T=K(()=>B.value.map(l=>({title:l.code,value:l.code}))),V=m([]),p=m(!1),i=m({}),R=m(!1),b=async()=>{try{const{data:l}=await v.getAutoPaySupportPayments(o.value.currency||"USD");if(l){const a=l.flatMap(r=>r.payments.map(d=>({title:d.brand+"..."+d.details.lastFour+" Expires "+d.details.expiryMonth+"/"+d.details.expiryYear,value:d.id})));V.value=a}}catch(l){console.error("fetchAutoPaySupportPayments error",l)}},x=async()=>{var l,a;try{const{data:r}=await v.getUserDomainRenewSetting();r&&(o.value.renewOption=r.renewOption,o.value.currency=r.currency,o.value.payment=(l=r.payment)==null?void 0:l.id,o.value.paymentBackup=(a=r.paymentBackup)==null?void 0:a.id,p.value=!!r.paymentBackup)}catch(r){console.error("Failed to fetch user renew setting:",r)}};Q(()=>o.value.currency,(l,a)=>{a!==void 0&&(o.value.payment=void 0,o.value.paymentBackup=void 0),b()});const $=async()=>{if(i.value={},o.value.renewOption===void 0&&(i.value.renewOption=[t("this-field-is-required")]),o.value.renewOption===O.AutoRenew&&(o.value.currency||(i.value.currency=[t("this-field-is-required")]),o.value.payment||(i.value.payment=[t("this-field-is-required")]),p.value&&!o.value.paymentBackup&&(i.value.paymentBackup=[t("this-field-is-required")])),!(Object.keys(i.value).length>0)){R.value=!0;try{const l={renewOption:o.value.renewOption??O.ManualRenewal,currency:o.value.currency,payment:o.value.payment,paymentBackup:p.value?o.value.paymentBackup:void 0},a=await v.updateUserDomainRenewSetting(l);S.handleResult(a),a.code===200&&await x()}catch(l){console.error("Failed to save settings:",l)}finally{R.value=!1}}};return W(async()=>{await x(),await b()}),(l,a)=>{const r=w("DynaSelect"),d=z,E=w("DynaDivider"),I=w("DynaCheckbox"),F=w("DynaButton"),L=w("DynaPanel");return y(),_("div",ee,[n("div",te,[n("h1",null,s(e(t)("Domain Auto-Renew")),1)]),c(L,{"top-visible":!1,class:"auto-renew-content"},{default:f(()=>[c(d,{title:e(t)("Auto-Renew Option"),description:"description"},{description:f(()=>[n("div",oe,[n("p",null,s(e(t)("The default domain auto-renew option determines a domain's default renew option. The default auto-renew option is used for future domains that you register. Domains already in your account are not affected.")),1),n("p",null,s(e(t)("Auto-Renew will allow our system to automatically renew your domains before it expires.")),1),n("p",null,s(e(t)("Do Not Renew means our system will not send you expiration reminders.")),1)])]),default:f(()=>[n("div",ne,[n("div",ae,[n("label",null,s(e(t)("Select default domain renew option")),1),c(r,{modelValue:e(o).renewOption,"onUpdate:modelValue":a[0]||(a[0]=u=>e(o).renewOption=u),options:e(g),placeholder:e(t)("Select renew option"),class:D([{error:e(i).renewOption},"form-select"])},null,8,["modelValue","options","placeholder","class"]),e(i).renewOption?(y(),_("div",se,s(e(t)("this-field-is-required")),1)):k("",!0)])])]),_:1},8,["title"]),c(E),c(d,{title:e(t)("Auto Renew Payment Method"),description:"description"},{description:f(()=>[n("div",le,[n("p",null,s(e(t)("The auto-renew setting indicates the default payment method you want to use when you set your domains to auto renew.")),1)])]),default:f(()=>[n("div",re,[n("div",ie,[n("label",null,s(e(t)("Select your default auto-renew payment method")),1),c(r,{modelValue:e(h),"onUpdate:modelValue":a[1]||(a[1]=u=>C(h)?h.value=u:null),options:e(N),placeholder:e(t)("Select payment method"),class:"form-select"},null,8,["modelValue","options","placeholder"])]),n("div",ce,[n("label",null,s(e(t)("Currency")),1),c(r,{modelValue:e(o).currency,"onUpdate:modelValue":a[2]||(a[2]=u=>e(o).currency=u),options:e(T),placeholder:e(t)("Select currency"),class:D([{error:e(i).currency},"form-select"])},null,8,["modelValue","options","placeholder","class"]),e(i).currency?(y(),_("div",ue,s(e(t)("this-field-is-required")),1)):k("",!0)]),n("div",de,[
1n("label",null,s(e(t)("Select Card")),1),c(r,{modelValue:e(o).payment,"onUpdate:modelValue":a[3]||(a[3]=u=>e(o).payment=u),options:e(V),placeholder:e(t)("Select card"),class:D([{error:e(i).payment},"form-select card-select"])},null,8,["modelValue","options","placeholder","class"]),e(i).payment?(y(),_("div",pe,s(e(t)("this-field-is-required")),1)):k("",!0),n("div",me,s(e(t)("Note: Credit card auto-renew does not supports CNY,IDR.")),1)]),c(I,{modelValue:e(p),"onUpdate:modelValue":a[4]||(a[4]=u=>C(p)?p.value=u:null),label:e(t)("Add a backup payment method")},null,8,["modelValue","label"]),e(p)?(y(),_("div",ye,[n("label",null,s(e(t)("Backup Payment")),1),c(r,{modelValue:e(o).paymentBackup,"onUpdate:modelValue":a[5]||(a[5]=u=>e(o).paymentBackup=u),placeholder:e(t)("Select card"),options:e(V),class:D([{error:e(i).paymentBackup},"form-select"])},null,8,["modelValue","placeholder","options","class"]),e(i).paymentBackup?(y(),_("div",_e,s(e(t)("this-field-is-required")),1)):k("",!0)])):k("",!0)])]),_:1},8,["title"]),n("div",fe,[c(F,{type:"dark",loading:e(R),onClick:$},{default:f(()=>[U(s(e(t)("Save")),1)]),_:1},8,["loading"])])]),_:1})])}}}),he=M(ve,[["__scopeId","data-v-6bc2588a"]]),we={class:"auto-renew-page"},ke={class:"summary-top-container"},De={class:"content-container"},Se=A({__name:"index",setup(q){const{t}=P(),v=X(),S=()=>{v.push("/account/payment-methods")};return(B,o)=>{const g=j,h=he;return y(),_("div",we,[c(g,{title:e(t)("Domain Auto-Renew")},null,8,["title"]),n("div",ke,[n("div",{class:"to-payment-methods",onClick:S},[o[0]||(o[0]=n("i",{class:"fa-regular fa-chevron-left"},null,-1)),U(" "+s(e(t)("payment-methods")),1)])]),n("div",De,[c(h)])])}}}),Oe=M(Se,[["__scopeId","data-v-0e92b27b"]]);export{Oe 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.