PageSourceSearch

https://setsmart.io/_nuxt/CgHnq7mh.js

js setsmart.io collected 2026-10-04 22:02:55 UTC 11,853 bytes, 1 lines download raw bytes

1import{a1 as ee,B as te,r as h,f as p,g as se,s as ne,h as oe,L as T,w as A,a3 as re,o as d,a as t,t as o,j as e,n as ae,c as m,F as U,k as ce,b as g,q as ie,d as C,y as B,O as le}from"./BQgW2Aai.js";import{_ as de}from"./Dj3mMVFl.js";import{u as ue}from"./DCSQ76Pv.js";import{u as me}from"./D2hm3VPF.js";const pe={class:"max-w-2xl mx-auto px-4 sm:px-6 py-10"},_e={class:"text-center mb-10"},ye={class:"text-xs font-medium tracking-wider uppercase text-amber-700 mb-2"},xe={class:"text-3xl sm:text-4xl font-semibold text-zinc-900 tracking-tight"},he={class:"mt-3 text-base text-zinc-500 max-w-xl mx-auto"},fe={class:"rounded-2xl border border-zinc-200 bg-white overflow-hidden"},ge={class:"p-6 sm:p-8 border-b border-zinc-100"},be={class:"flex items-center gap-2 mb-2"},ve={class:"flex items-baseline gap-2"},ke={class:"text-5xl font-semibold text-zinc-900"},we={class:"text-sm text-zinc-500"},Be={class:"mt-2 text-sm text-zinc-500"},Ee={class:"p-6 sm:p-8 space-y-3"},ze={class:"text-sm text-zinc-700"},Te={class:"p-6 sm:p-8 border-t border-zinc-100 bg-zinc-50"},Ce={key:0,class:"rounded-lg border border-emerald-200 bg-emerald-50 p-4 mb-4"},Se={class:"text-sm text-emerald-800 font-medium"},Ne={key:0,class:"rounded-lg border border-zinc-200 bg-white p-4 mb-3"},Me={key:1,class:"rounded-lg border border-zinc-200 bg-white p-4 mb-3"},Ae={class:"text-xs font-medium text-zinc-500 uppercase tracking-wider mb-3"},De={class:"space-y-2 text-sm"},Le={class:"flex items-center justify-between text-zinc-600"},Oe={class:"font-medium text-zinc-900"},$e={class:"flex items-center justify-between text-zinc-600"},Pe={class:"font-medium text-emerald-600"},Re={class:"flex items-center justify-between pt-2 mt-2 border-t border-zinc-100 text-sm font-semibold text-zinc-900"},Ie={class:"flex items-center justify-between text-xs text-zinc-500 pt-1"},Ue={key:2,class:"rounded-lg border border-emerald-200 bg-emerald-50 p-4 mb-3"},Ye={class:"text-sm text-emerald-900 font-medium"},Fe={class:"text-xs text-emerald-800 mt-1"},He={class:"rounded-lg border border-amber-200 bg-amber-50 p-4 mb-3"},je={class:"text-sm text-amber-900 font-medium mb-1"},qe={class:"text-sm text-amber-800"},Ke=["disabled"],Ve={key:3,class:"mt-3 text-xs text-amber-700"},We={key:4,class:"mt-3 rounded-lg border border-red-200 bg-red-50 p-4"},Ge={class:"flex items-start gap-3"},Je={class:"flex-1 min-w-0"},Qe={class:"text-sm font-semibold text-red-900"},Xe={class:"text-sm text-red-800 mt-1"},Ze={class:"text-xs text-zinc-700 mt-2"},et={class:"flex flex-wrap items-center gap-2 mt-3"},tt={key:0,class:"text-xs text-zinc-500 mt-3"},st={key:1,class:"text-xs text-zinc-500 mt-3"},nt={key:5,class:"mt-3 text-sm text-red-600"},ot={class:"mt-6 text-center text-xs text-zinc-400"},dt={__name:"upgrade-byok",setup(rt){const{t:s,locale:D}=me(),Y=ue(),{fetchUserSession:L,subscription:O,lemonSqueezySubscription:$,isReady:F}=ee(),H=te(),b=h(!1),v=h(""),i=h(null),a=h(null),k=h(!0),x=p(()=>{var c;const n=String(((c=H.query)==null?void 0:c.tier)||"").toLowerCase();return n==="premium"?"premium":n==="flat299"?"flat299":"standard"}),j=p(()=>x.value==="premium"?999:x.value==="flat299"?299:499),E=h(0),P=h(Date.now());let S=null;se(async()=>{F.value||await L(),await G(),S=ne(()=>{P.value=Date.now()},1e3)}),oe(()=>{S&&clearInterval(S)});const N=p(()=>E.value?Math.max(0,Math.ceil((E.value-P.value)/1e3)):0),z=p(()=>N.value>0),q=p(()=>{var n;return((n=O.value)==null?void 0:n.variant_name)==="BYOK Pro"}),w=p(()=>{var n;return(((n=O.value)==null?void 0:n.currency)||"USD").toUpperCase()}),R=p(()=>{const n=j.value;return w.value==="EUR"?`€${n}`:w.value==="AED"?`AED ${n}`:`$${n}`}),I=p(()=>{var n,c;return!!((n=$.value)!=null&&n.stripe_customer_id)||!!((c=$.value)!=null&&c.stripe_payment_method_id)}),K=p(()=>[s("upgradeByok.features.byok"),s("upgradeByok.features.flatRate"),s("upgradeByok.features.allProFeatures"),s("upgradeByok.features.scheduleKept"),s("upgradeByok.features.support")]),V=p(()=>!a.value||a.value.settlement_cents<=0?s("upgradeByok.cta"):s("upgradeByok.ctaWithSettlement",{amount:_(a.value.settlement_cents)})),_=n=>{var y;if(n==null)return"";const c=Math.round(n/100),l=((y=a.value)==null?void 0:y.currency)||w.value;return l==="EUR"?`€${c}`:l==="AED"?`AED ${c}`:`$${c}`},W=n=>
1(Number(n)||0).toLocaleString(D.value==="fr"?"fr-FR":D.value==="es"?"es-ES":"en-US"),G=async()=>{k.value=!0;try{a.value=await $fetch("/api/byok/preview-settlement",{query:{tier:x.value}})}catch(n){console.warn("[BYOK Upgrade] preview-settlement failed:",(n==null?void 0:n.message)||n),a.value=null}finally{k.value=!1}},J={insufficient_funds:"insufficientFunds",expired_card:"expiredCard",incorrect_cvc:"incorrectCvc",invalid_cvc:"incorrectCvc",incorrect_number:"incorrectNumber",invalid_number:"incorrectNumber",card_velocity_exceeded:"velocityExceeded",do_not_honor:"doNotHonor",call_issuer:"callIssuer",transaction_not_allowed:"notAllowed",authentication_required:"authenticationRequired",card_declined:"generic",processing_error:"processingError",issuer_not_available:"processingError"},Q=p(()=>{if(!i.value)return null;const n=i.value.declineCode||i.value.stripeCode;if(!n)return s("upgradeByok.declineReasons.generic");const c=J[n];return s(`upgradeByok.declineReasons.${c||"generic"}`)}),X=()=>{var n,c,l;if(typeof window<"u"&&window.$crisp){window.$crisp.push(["do","chat:show"]),window.$crisp.push(["do","chat:open"]);const y=x.value==="premium"?"Premium":"Standard",f=(n=i.value)!=null&&n.settlementCents?_(i.value.settlementCents):"",u=((c=i.value)==null?void 0:c.declineCode)||((l=i.value)==null?void 0:l.stripeCode)||"unknown",r=`Hi, my BYOK Pro ${y} switch failed at the ${f} settlement charge (reason: ${u}). Can you help?`;window.$crisp.push(["set","message:text",[r]])}},Z=async()=>{var n,c,l,y,f;v.value="",i.value=null,b.value=!0;try{const u=await $fetch("/api/byok/activate",{method:"POST",body:{tier:x.value}}),r=((n=u==null?void 0:u.settlement)==null?void 0:n.settlement_cents)>0;Y.success(r?s("upgradeByok.switchedWithSettlement",{amount:_(u.settlement.settlement_cents)}):s("upgradeByok.switched"),{position:"bottom-center"}),await L(!0),await le("/app/byok/settings")}catch(u){const r=(u==null?void 0:u.data)||{};if((r==null?void 0:r.error)==="SETTLEMENT_FAILED"){i.value={kind:"SETTLEMENT_FAILED",stripeCode:r.stripe_code||null,declineCode:r.decline_code||null,settlementCents:r.settlement_cents||((c=a.value)==null?void 0:c.settlement_cents)||0,currency:r.currency||((l=a.value)==null?void 0:l.currency)||w.value};const M=((r==null?void 0:r.retry_after_seconds)||600)*1e3;E.value=Date.now()+M}else if((r==null?void 0:r.error)==="NO_PAYMENT_METHOD")i.value={kind:"NO_PAYMENT_METHOD",stripeCode:null,declineCode:null,settlementCents:((y=a.value)==null?void 0:y.settlement_cents)||0,currency:((f=a.value)==null?void 0:f.currency)||w.value};else if((r==null?void 0:r.error)==="TOO_MANY_ATTEMPTS"){const M=((r==null?void 0:r.retry_after_seconds)||600)*1e3;E.value=Date.now()+M,v.value=s("upgradeByok.tooManyAttempts")}else v.value=(r==null?void 0:r.message)||(r==null?void 0:r.error)||(u==null?void 0:u.message)||s("upgradeByok.error")}finally{b.value=!1}};return(n,c)=>{const l=ie,y=de,f=re;return d(),T(f,{name:"user"},{default:A(()=>[t("div",pe,[t("div",_e,[t("p",ye,o(e(s)("upgradeByok.badge")),1),t("h1",xe,o(e(s)("upgradeByok.title")),1),t("p",he,o(e(s)("upgradeByok.subtitle")),1)]),t("div",fe,[t("div",ge,[t("div",be,[t("span",{class:ae(["inline-flex items-center px-2 py-0.5 font-mono text-[10px] uppercase tracking-[0.1em] border",e(x)==="premium"?"bg-amber-50 border-amber-200 text-amber-800":"bg-zinc-50 border-zinc-200 text-zinc-700"])},o(e(x)==="premium"?e(s)("upgradeByok.tierLabel.premium"):e(s)("upgradeByok.tierLabel.standard")),3)]),t("div",ve,[t("span",ke,o(e(R)),1),t("span",we,o(e(s)("upgradeByok.perMonth")),1)]),t("p",Be,o(e(s)("upgradeByok.priceDescription")),1)]),t("ul",Ee,[(d(!0),m(U,null,ce(e(K),(u,r)=>(d(),m("li",{key:r,class:"flex items-start gap-3"},[g(l,{name:"lucide:check",class:"w-5 h-5 text-emerald-500 flex-shrink-0 mt-0.5"}),t("span",ze,o(u),1)]))),128))]),t("div",Te,[e(q)?(d(),m("div",Ce,[t("p",Se,o(e(s)("upgradeByok.alreadyByok")),1),g(y,{to:"/app/byok/settings",class:"inline-flex mt-2 text-sm font-medium text-emerald-900 underline"},{default:A(()=>[C(o(e(s)("upgradeByok.goToSettings")),1)]),_:1})])):(d(),m(U,{key:1},[e(k)?(d(),m("div",Ne,c[0]||(c[0]=[t("div",{class:"h-4 w-32 bg-zinc-100 rounded mb-3"},null,-1),t("div",{class:"h-3 w-full bg-zinc-100 rounded mb-2"},null,-1),t("div",{class:"h-3 w-3/4 bg-zinc-100 rounded"},null,-1)]))):e(a)&&e(a).settlement_cents>0?(d(),m("div",Me,[t("p",Ae,o(e(s)("upgradeByok.settlement.heading")),1),t("div",De,[t("div",Le,[t("span",null,o(e(s)("upgradeByok.settlement.accruedRow",{messages:W(e(a).messages)})),1),t("span",Oe,o(_(e(a).accrued_cents)),1)]),t("div",$e,[t("span",null,o(e(s)("upgradeByok.settlement.baseCreditRow")),1),t("span",Pe,"−"+o(_(e(a).base_fee_cents)),1)]),t("div",Re,[t("span",null,o(e(s)("upgradeByok.settlement.todayRow")),1),t("span",null,o(_(e(a).settlement_cents)),1)]),t("div",Ie,[t("span",null,o(e(s)("upgradeByok.settlement.thenRow")),1),t("span",null,o(_(e(a).byok_price_cents))+" "+o(e(s)("upgradeByok.perMonth")),1
1)])])])):e(a)&&!e(a).settlement_cents?(d(),m("div",Ue,[t("p",Ye,o(e(s)("upgradeByok.settlement.nothingToSettle")),1),t("p",Fe,o(e(s)("upgradeByok.settlement.nothingToSettleBody",{price:_(e(a).byok_price_cents)})),1)])):B("",!0),t("div",He,[t("p",je,o(e(s)("upgradeByok.noticeTitle")),1),t("p",qe,o(e(a)&&e(a).settlement_cents>0?e(s)("upgradeByok.noticeBodyWithSettlement",{settlement:_(e(a).settlement_cents),flat:_(e(a).byok_price_cents)}):e(s)("upgradeByok.noticeBody",{price:e(R)})),1)]),t("button",{type:"button",disabled:e(b)||e(k)||!e(I)||e(z),onClick:Z,class:"keep-round w-full h-11 px-5 rounded-lg bg-zinc-900 text-white text-sm font-semibold hover:bg-zinc-800 disabled:opacity-60 flex items-center justify-center gap-2"},[e(b)?(d(),T(l,{key:0,name:"eos-icons:loading",class:"w-4 h-4 animate-spin"})):e(z)?(d(),T(l,{key:1,name:"heroicons:clock",class:"w-4 h-4"})):(d(),T(l,{key:2,name:"heroicons:arrow-right",class:"w-4 h-4"})),C(" "+o(e(b)?e(s)("upgradeByok.switching"):e(z)?e(s)("upgradeByok.cooldownCta",{seconds:e(N)}):e(V)),1)],8,Ke),!e(I)&&!e(k)&&!e(i)?(d(),m("p",Ve,o(e(s)("upgradeByok.noPaymentMethod")),1)):B("",!0),e(i)?(d(),m("div",We,[t("div",Ge,[g(l,{name:"heroicons:x-circle",class:"w-5 h-5 text-red-600 flex-shrink-0 mt-0.5"}),t("div",Je,[t("p",Qe,o(e(i).kind==="NO_PAYMENT_METHOD"?e(s)("upgradeByok.failure.noPmTitle"):e(s)("upgradeByok.failure.declinedTitle")),1),t("p",Xe,o(e(i).kind==="NO_PAYMENT_METHOD"?e(s)("upgradeByok.failure.noPmBody"):e(Q)),1),t("p",Ze,o(e(s)("upgradeByok.failure.reassurance")),1),t("div",et,[g(y,{to:"/app/subscribe",class:"keep-round inline-flex items-center gap-1.5 h-8 px-3 text-xs font-medium rounded-md bg-zinc-900 text-white hover:bg-zinc-800 transition-colors"},{default:A(()=>[g(l,{name:"heroicons:credit-card",class:"w-3.5 h-3.5"}),C(" "+o(e(i).kind==="NO_PAYMENT_METHOD"?e(s)("upgradeByok.failure.addCardCta"):e(s)("upgradeByok.failure.updateCardCta")),1)]),_:1}),t("button",{type:"button",onClick:X,class:"inline-flex items-center gap-1.5 h-8 px-3 text-xs font-medium rounded-md border border-zinc-200 bg-white text-zinc-700 hover:border-zinc-400 hover:text-zinc-900 transition-colors"},[g(l,{name:"heroicons:chat-bubble-left-right",class:"w-3.5 h-3.5"}),C(" "+o(e(s)("upgradeByok.failure.contactSupport")),1)])]),e(i).kind==="SETTLEMENT_FAILED"&&e(z)?(d(),m("p",tt,o(e(s)("upgradeByok.failure.retryIn",{seconds:e(N)})),1)):e(i).kind==="SETTLEMENT_FAILED"?(d(),m("p",st,o(e(s)("upgradeByok.failure.retryReady")),1)):B("",!0)])])])):B("",!0),e(v)&&!e(i)?(d(),m("p",nt,o(e(v)),1)):B("",!0)],64))])]),t("p",ot,o(e(s)("upgradeByok.disclaimer")),1)])]),_:1})}}};export{dt 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.