1import{u as pe,a as fe,i as ge,z as xe,l as ve,e as ye,O as be,f as we,j as _e,k as Se,au as he,n as ke,o as Ee,p as Ce,q as Ae,r as Pe,s as Ie,t as Te,v as De}from"./Dyq1Iiea.js";import{_ as Me}from"./BoEfp704.js";import{_ as $e}from"./QjbSkfVF.js";import{r as p,a as o,b as a,e as t,u as s,F as C,t as l,z as N,i as j,x as U,k as Be,y as c,f as F,B as z,C as O,D as K,v as h,q as u}from"./CH0gXh7j.js";const je={class:"w-full max-w-[60rem] px-3 sm:px-5 md:px-10 lg:px-14 xl:px-16 2xl:px-20 flex flex-wrap items-start gap-6"},Ue={class:"w-full max-w-[30rem] p-5 bg-bgSecondary flex flex-col items-start gap-5 rounded-lg border border-border shadow-md"},Fe={class:"w-full flex flex-col gap-3"},Le={class:"flex flex-col gap-3"},We={class:"flex justify-between items-center text-sm"},Ve={class:"font-medium"},Ne={class:"flex justify-between items-center text-sm"},Re={class:"flex justify-between items-center text-sm"},Ye={class:"font-mono"},ze={class:"flex justify-between items-center text-sm"},Oe={class:"flex items-center gap-2.5"},Ke={class:"relative w-4 h-4"},qe={class:"w-4 h-4 transform -rotate-90"},Ge=["stroke","stroke-dasharray"],He={class:"flex justify-between items-center text-sm"},Ze={class:"flex items-center gap-2.5"},Je={class:"relative w-4 h-4"},Qe={class:"w-4 h-4 transform -rotate-90"},Xe=["stroke","stroke-dasharray"],et={key:0,class:"w-full flex flex-col"},tt={class:"flex justify-between items-center text-sm"},st={class:"flex justify-between items-center text-sm"},nt={key:0,class:"flex justify-between items-center text-sm"},rt={class:"text-green-600"},ot={key:1,class:"flex justify-between items-center text-sm"},it={class:"text-green-600"},at={class:"flex justify-between items-center text-sm"},lt={class:"flex justify-between items-center text-sm"},ut={class:"flex justify-between items-center text-sm"},ct={class:"flex justify-between items-center text-sm"},dt={class:"flex items-center gap-2.5"},mt={class:"relative w-4 h-4"},pt={class:"w-4 h-4 transform -rotate-90"},ft=["stroke","stroke-dasharray"],gt={class:"flex justify-between items-center text-sm"},xt={class:"flex items-center gap-2.5"},vt={class:"relative w-4 h-4"},yt={class:"w-4 h-4 transform -rotate-90"},bt=["stroke","stroke-dasharray"],wt={class:"w-full flex flex-col"},_t={key:0,class:"text-red-500 text-xs mt-1.5"},St=["disabled"],ht={key:1,class:"w-full h-px bg-border"},kt={key:2,class:"w-full flex flex-col gap-3"},Et=["disabled"],Ct={key:3,class:"w-full h-px bg-border"},At={key:4,class:"w-full flex flex-col gap-2"},Pt={class:"w-full flex items-center justify-between gap-6"},It={key:0,class:"w-full mt-1 flex flex-col items-start gap-2"},Tt=["placeholder"],Dt={key:0,class:"text-red-500 text-xs"},Mt=["disabled"],Lt={__name:"billing",setup($t){const v=pe();fe({title:"Settings: Billing · Waitlister",ogTitle:"Manage Your Subscriptions · Waitlister",description:"View and Manage Your Waitlister Subscriptions.",ogDescription:"View and Manage Your Waitlister Subscriptions.",ogType:v.ogType,ogImage:v.ogImage,ogUrl:`${v.baseUrl}/settings/billing`,keywords:"Waitlister, account, billing",author:v.author,robots:"noindex, nofollow",twitterCard:v.twitterCard,twitterTitle:"Manage Your Subscriptions · Waitlister",twitterDescription:"View and Manage Your Waitlister Subscriptions.",twitterImage:v.ogImage});const r=ge(),q=xe(),A=p(!1),d=p(""),f=p(""),P=p(!1),L=n=>new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",minimumFractionDigits:0,maximumFractionDigits:0}).format(n/100),I=n=>n?new Date(n*1e3).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}):"",m=u(()=>r.user.billing?.subscription),k=u(()=>{const n=r.user.billing?.productId;return!["starter","free"].includes(n)&&r.user.billing?.subscriptionStatus==="active"}),R=u(()=>{const n=m.value?.trial_end;return n&&n>Date.now()/1e3}),G=u(()=>{const n=m.value?.discount;return n?.coupon?n.end>Date.now()/1e3:!1}),T=u(()=>m.value?.pause_collection?"Paused":m.value?.cancel_at_period_end?"Canceled":"Active"),H=u(()=>R.value?`Ends ${I(m.value.trial_end)}`:""),Z=u(()=>{const n=m.value?.discount;if(!n?.coupon)return"";const e=n.coupon;let i="";switch(e.percent_off?i=`${e.percent_off}% off`:e.amount_off&&(i=`${L(e.amount_off)} off`),e.duration){case"forever":return`${i} forever`;case"once":return`${i} until ${I(n.end)}`;case"repeating":return`${i} for ${e.duration_in_months} months`;default:return i}}),J=u(()=>{const n=m.value?.items.data[0].price;if(!n)return"";let e=n.unit_amount;const i=m.value?.discount?.coupon;i&&(i.percent_off?e=e*(1-i.percent_off/100):i.amount_off&&(e=Math.max(0,e-i.amount_off)));const g=(n.lookup_key||"").includes("yearly")?"/year":"/month";return L(e)+g}),Q=u(()=>{const n=r.user.billing;if(!n)return"";const i=m.value?.discount?.end||n.currentPeriodEnd,E=(m.value?.items?.data?.[0]?.price?.lookup_key||"").includes("yearly")?"/year":"/month";return n.cancelAtPeriodEnd?`Plan ends ${I(i)}`:`${L(n.regularPrice)}${E} on ${I(i)}`}),W=u(()=>r.user.emailsSentThisMonth||0),y=u(()=>r.user.product?.maxMonthlyEmails?Math.min(W.value/r.user.product.maxMonthlyEmails*100,100):0),b=u(()=>r.user.billing?.isAppSumo===!0),X=u(()=>r.user.billing?.appSumo?.tier||1),ee=u(()=>X.value<4),D=p(!1),te=n=>{d.value=n.target.value.toUpperCase().replace(/[^A-Z0-9]/g,"").substring(0,12),f.value=""},se=async()=>
1{if(!d.value||d.value.length<12){f.value="Please enter a valid 12-character code";return}f.value="",P.value=!0;try{const n=await r.redeemCode(d.value.trim());n.success?(d.value="",await ne()):f.value=n.message||"Failed to redeem code"}catch(n){console.error("Code stacking error:",n),f.value=n.message||"Failed to redeem code"}finally{P.value=!1}},ne=async()=>{const n=[ke(),Ee(),Ce(),Ae(),Pe(),Ie(),Te(),De()];await Promise.all(n.map(async e=>{try{await e.clear()}catch(i){console.error(`Error clearing ${e.$id}:`,i)}}))},re=n=>r.updateInvoiceEmailsSetting(n),w=p(r.user.invoiceEmailAddress||""),M=p(""),$=p(!1),oe=u(()=>w.value.trim()===(r.user.invoiceEmailAddress||"")||$.value),ie=async()=>{const n=w.value.trim();if(n&&!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(n)){M.value="Please enter a valid email address";return}M.value="",$.value=!0;try{await r.updateInvoiceEmailAddress(n),w.value=n}catch{}finally{$.value=!1}},ae=async()=>{A.value=!0,await q.redirectToBillingPortal()instanceof Error&&(A.value=!1)},le=n=>{if(!n)return[];const e=[];return Object.entries(n).forEach(([i,S])=>{if(S.allowed){let g=ue(i,S);g&&e.push(g)}}),e},ue=(n,e)=>{switch(n){case"analyticsAdvanced":return"Advanced analytics";case"conversionTracking":return"Conversion tracking";case"customDomains":return"Custom domains";case"customEmailDomains":return"Custom email domains";case"customizeThankYoupage":return"Customize thank-you page";case"emailBroadcasts":return"Email broadcasts";case"exportSignUps":return"Export sign ups";case"multiUserAccess":return"Multi user access";case"referralProgram":return"Referral program";case"removeWaitlisterBranding":return"Remove Waitlister branding";case"spamPrevention":return"Spam prevention";case"unlimitedSignUps":return"Unlimited sign ups";case"welcomeEmails":return"Welcome emails";case"surveys":return"Surveys";case"phoneCollection":return"Phone number collection";case"newSubscriberNotifications":return"New subscriber notifications";case"newFeaturesEarlyAccess":return"Early access to new features";case"api":return e.access?`API (${e.access})`:"API";case"aiLandingPageBuilder":return"AI landing page builder";case"webhooks":return"Webhooks";case"integrations":return"Integrations";case"bulkImport":return"Bulk import";case"emailValidation":return"Email validation";case"turnstile":return"Cloudflare Turnstile protection";case"translations":return"Translations";case"doubleOptIn":return"Double opt-in";case"subscriberDetails":return"Subscriber details";case"positionInflation":return"Position inflation";case"customSignUpRedirect":return"Custom sign-up redirect";default:return""}},V=u(()=>r.user.aiCreditsUsedThisMonth||0),B=u(()=>r.user.aiCredits||0),_=u(()=>B.value?Math.min(V.value/B.value*100,100):0);return(n,e)=>{const i=ye,S=Me,g=we,E=_e,Y=Se,ce=$e,de=he;return o(),a("div",je,[t("div",Ue,[t("div",Fe,[e[26]||(e[26]=t("h3",{class:"text-base"}," Current plan ",-1)),t("div",Le,[s(b)?(o(),a(C,{key:0},[t("div",We,[e[4]||(e[4]=t("span",{class:"text-textSecondary"},"Plan",-1)),t("span",Ve,l(s(r).user.billing.appSumo.name),1)]),e[12]||(e[12]=t("div",{class:"flex justify-between items-center text-sm"},[t("span",{class:"text-textSecondary"},"Status"),t("span",{class:"px-3 py-0.5 rounded-md text-sm bg-green-300 text-green-950"}," Active (lifetime) ")],-1)),t("div",Ne,[e[5]||(e[5]=t("span",{class:"text-textSecondary"},"Activated on",-1)),t("span",null,l(("useFormatDate"in n?n.useFormatDate:s(ve))(s(r).user.billing.appSumo.activatedAt)),1)]),t("div",Re,[e[6]||(e[6]=t("span",{class:"text-textSecondary"},"Redemption code",-1)),t("span",Ye,l(s(r).user.billing.appSumo.code),1)]),t("div",ze,[e[8]||(e[8]=t("span",{class:"text-textSecondary"},"Monthly email limit",-1)),t("div",Oe,[t("div",Ke,[(o(),a("svg",qe,[e[7]||(e[7]=t("circle",{cx:"8",cy:"8",r:"7",class:"stroke-border","stroke-width":"2",fill:"none"},null,-1)),t("circle",{cx:"8",cy:"8",r:"7",stroke:s(y)>90?"#E54C65":s(y)>75?"#5B6DEE":"#4ECE97","stroke-width":"2",fill:"none","stroke-dasharray":`${44*s(y)/100} 44`},null,8,Ge)]))]),t("span",null,l(s(W).toLocaleString())+" / "+l(s(r).user.product.maxMonthlyEmails.toLocaleStr
1ing()),1)])]),t("div",He,[e[10]||(e[10]=t("span",{class:"text-textSecondary"},"AI credits this month",-1)),t("div",Ze,[t("div",Je,[(o(),a("svg",Qe,[e[9]||(e[9]=t("circle",{cx:"8",cy:"8",r:"7",class:"stroke-border","stroke-width":"2",fill:"none"},null,-1)),t("circle",{cx:"8",cy:"8",r:"7",stroke:s(_)>90?"#E54C65":s(_)>75?"#5B6DEE":"#4ECE97","stroke-width":"2",fill:"none","stroke-dasharray":`${44*s(_)/100} 44`},null,8,Xe)]))]),t("span",null,l(s(V).toLocaleString())+" / "+l(s(B).toLocaleString()),1)])]),s(r).user.product&&s(r).user.product.features?(o(),a("div",et,[t("button",{class:"w-full flex items-center justify-between gap-5 underline-offset-2 hover:underline transition-all duration-200",onClick:e[0]||(e[0]=N(x=>D.value=!s(D),["prevent"]))},[e[11]||(e[11]=t("span",{class:"text-textSecondary"},"Features",-1)),j(i,{class:U(["w-4 h-4 flex shrink-0 text-textLight transition ease-in-out duration-200",s(D)?"rotate-[270deg]":"rotate-90"])},null,8,["class"])]),t("div",{class:U(["w-full px-4 text-left overflow-clip flex flex-col gap-3 transition-all ease-in-out duration-300 bg-bgThird rounded-md",s(D)?"max-h-[60rem] mt-3 py-4":"max-h-0 mt-0 py-0"])},[(o(!0),a(C,null,Be(le(s(r).user.product.features),(x,me)=>(o(),a("div",{key:`feature-${me}`,class:"text-sm text-textPrimary"}," ⢠"+l(x),1))),128))],2)])):c("",!0)],64)):s(k)?(o(),a(C,{key:1},[t("div",tt,[e[13]||(e[13]=t("span",null,"Plan",-1)),j(S,{product:s(r).user.product},null,8,["product"])]),t("div",st,[e[14]||(e[14]=t("span",{class:""},"Status",-1)),t("span",{class:U(["px-3 py-0.5 rounded-md text-sm border",{"border-green-300 bg-green-100 text-green-800":s(T)==="Active","border-warning-300 bg-warning-100 text-warning-800":s(T)==="Paused","border-warning-300 bg-warning-100 text-warning-800":s(T)==="Canceled"}])},l(s(T)),3)]),s(R)?(o(),a("div",nt,[e[15]||(e[15]=t("span",{class:""},"Trial period",-1)),t("span",rt,l(s(H)),1)])):c("",!0),s(G)?(o(),a("div",ot,[e[16]||(e[16]=t("span",{class:""},"Promotional discount",-1)),t("span",it,l(s(Z)),1)])):c("",!0),t("div",at,[e[17]||(e[17]=t("span",{class:""},"Next billing",-1)),t("span",null,l(s(Q)),1)]),t("div",lt,[e[18]||(e[18]=t("span",{class:""},"Current price",-1)),t("span",null,l(s(J)),1)]),t("div",ut,[e[19]||(e[19]=t("span",{class:""},"Auto-renewal",-1)),t("span",{class:U(["px-3 py-0.5 rounded-md border text-sm font-medium",s(r).user.billing.cancelAtPeriodEnd?"border-red-300 bg-red-100 text-red-800":"border-green-300 bg-green-100 text-green-800"])},l(s(r).user.billing.cancelAtPeriodEnd?"Off":"On"),3)]),t("div",ct,[e[21]||(e[21]=t("span",{class:""},"Monthly email limit",-1)),t("div",dt,[t("div",mt,[(o(),a("svg",pt,[e[20]||(e[20]=t("circle",{cx:"8",cy:"8",r:"7",class:"stroke-border","stroke-width":"2",fill:"none"},null,-1)),t("circle",{cx:"8",cy:"8",r:"7",stroke:s(y)>90?"#E54C65":s(y)>75?"#5B6DEE":"#4ECE97","stroke-width":"2",fill:"none","stroke-dasharray":`${44*s(y)/100} 44`},null,8,ft)]))]),t("span",null,l(s(W).toLocaleString())+" / "+l(s(r).user.product.maxMonthlyEmails.toLocaleString()),1)])]),t("div",gt,[e[23]||(e[23]=t("span",{class:"text-textSecondary"},"AI credits this month",-1)),t("div",xt,[t("div",vt,[(o(),a("svg",yt,[e[22]||(e[22]=t("circle",{cx:"8",cy:"8",r:"7",class:"stroke-border","stroke-width":"2",fill:"none"},null,-1)),t("circle",{cx:"8",cy:"8",r:"7",stroke:s(_)>90?"#E54C65":s(_)>75?"#5B6DEE":"#4ECE97","stroke-width":"2",fill:"none","stroke-dasharray":`${44*s(_)/100} 44`},null,8,bt)]))]),t("span",null,l(s(V).toLocaleString())+" / "+l(s(B).toLocaleString()),1)])])],64)):(o(),a(C,{key:2},[e[25]||(e[25]=t("p",{class:"text-sm text-textSecondary"}," You're currently on our free plan. Upgrade to access premium features. ",-1)),t("button",{onClick:e[1]||(e[1]=x=>("navigateTo"in n?n.navigateTo:s(be))("/upgrade")),class:"mt-2 w-fit button-main"},[e[24]||(e[24]=F(" Upgrade ",-1)),j(g)])],64))])]),s(b)&&s(ee)?(o(),a(C,{key:0},[e[30]||(e[30]=t("div",{class:"w-full h-px bg-border"},null,-1)),t("div",wt,[e[28]||(e[28]=t("h3",{class:"text-base mb-2"}," Upgrade ",-1)),e[29]||(e[29]=t("p",{class:"text-sm text-textSecondary mb-4"}," Have more AppSumo codes? You can stack them here and upgrade to higher tiers. ",-1)),t("form",{onSubmit:N(se,["prevent"]),class:"flex flex-col gap-3"},[t("div",null,[z(t("input",{"onUpdate:modelValue":e[2]||(e[2]=x=>K(d)?d.value=x:null),type:"text",placeholder:"Enter additional Ap
1pSumo code",maxlength:"12",onInput:te,class:"w-full"},null,544),[[O,s(d)]]),s(f)?(o(),a("p",_t,l(s(f)),1)):c("",!0)]),t("button",{type:"submit",disabled:s(P)||!s(d)||s(d).length<12,class:"w-fit button-main"},[e[27]||(e[27]=F(" Apply code ",-1)),s(P)?(o(),h(E,{key:0})):(o(),h(Y,{key:1}))],8,St)],32)])],64)):c("",!0),s(k)&&!s(b)?(o(),a("div",ht)):c("",!0),s(k)&&!s(b)?(o(),a("div",kt,[t("button",{class:"w-fit button-secondary",onClick:ae,disabled:s(A)},[e[31]||(e[31]=F(" Manage billing ",-1)),s(A)?(o(),h(E,{key:1})):(o(),h(ce,{key:0}))],8,Et)])):c("",!0),s(k)&&!s(b)?(o(),a("div",Ct)):c("",!0),s(k)&&!s(b)?(o(),a("div",At,[t("div",Pt,[e[32]||(e[32]=t("h3",{class:"text-base"}," Invoice emails ",-1)),j(de,{"model-value":s(r).user.invoiceEmails===!0,"aria-label":"Toggle invoice emails",onChange:re},null,8,["model-value"])]),e[36]||(e[36]=t("p",{class:"text-sm text-textSecondary"}," Get a copy of each new invoice sent to your email inbox. ",-1)),s(r).user.invoiceEmails===!0?(o(),a("div",It,[e[34]||(e[34]=t("label",{for:"invoiceEmailAddress",class:"text-sm"}," Send invoices to ",-1)),z(t("input",{class:"w-full max-w-[20rem] bg-bgBase",type:"email",id:"invoiceEmailAddress",placeholder:s(r).user.email,"onUpdate:modelValue":e[3]||(e[3]=x=>K(w)?w.value=x:null)},null,8,Tt),[[O,s(w)]]),s(M)?(o(),a("p",Dt,l(s(M)),1)):c("",!0),e[35]||(e[35]=t("p",{class:"text-xs text-textSecondary"}," Leave empty to use your account email. ",-1)),t("button",{class:"button-main mt-1",disabled:s(oe),onClick:N(ie,["prevent"])},[e[33]||(e[33]=F(" Save ",-1)),s($)?(o(),h(E,{key:1})):(o(),h(Y,{key:0}))],8,Mt)])):c("",!0)])):c("",!0)])])}}};export{Lt 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.