1import{j as e}from"./animation-vendor-BMfr2kU1.js";import{b as s,s as a}from"./useBillingSummary-CtDi1ddS.js";import{e as n,r}from"./react-vendor-6zQKrGfa.js";import{i as t,b as l,r as c}from"./index-Bi2I5SnG.js";/* empty css */import"./checkoutAttempts-Dcms4JAy.js";const i={rtvsotm:{id:"rtvsotm",name:"Monthly",label:"$12.99/mo"},rtvsota:{id:"rtvsota",name:"Annual",label:"$139/yr",note:"That's $11.58/mo"}};function o({children:s,onClick:a,disabled:n}){return e.jsx("button",{className:"rt-btn-primary",onClick:a,disabled:n,children:s})}function d({children:s,onClick:a}){return e.jsx("button",{className:"rt-btn-ghost",type:"button",onClick:a,children:s})}function u({current:s,currentInfo:a,renewDate:n,credit:r,onChoose:t,onCancel:l}){const c=a||i[s]||{name:"Your plan",label:""},d=!!i[s],u=i["rtvsotm"===s?"rtvsota":"rtvsotm"],m="rtvsotm"===s;return e.jsxs("div",{className:"rt-step",children:[e.jsx("h1",{className:"rt-h1",children:"Your plan"}),e.jsxs("p",{className:"rt-sub",children:["You're on ",e.jsx("strong",{children:c.name}),n?` â renews ${n}`:"","."]}),e.jsxs("div",{className:"pc-current",children:[e.jsxs("div",{className:"pc-current-top",children:[e.jsx("span",{className:"rt-plan-name",children:c.name}),e.jsx("span",{className:"pc-current-badge",children:"CURRENT PLAN"})]}),e.jsxs("div",{className:"rt-plan-price",children:[c.label.split("/")[0],e.jsxs("span",{className:"rt-plan-per",children:["/",c.label.split("/")[1]]})]}),e.jsxs("div",{className:"rt-plan-note",children:[d?"Full access":"Your current plan",n?` · Renews ${n}`:""]})]}),r>0?e.jsxs("p",{className:"rt-hint",style:{marginBottom:12},children:["You have $",r.toFixed(2)," account credit â it will be applied to your next charge automatically."]}):null,m?e.jsxs("div",{className:"pc-nudge",children:[e.jsx("div",{className:"pc-nudge-title",children:"Save on the Annual plan"}),e.jsxs("div",{className:"pc-nudge-body",children:["Switch to Annual for ",u.label," â ",u.note,", instead of ",c.label,"."]})]}):null,d?null:e.jsxs("div",{className:"pc-nudge",children:[e.jsx("div",{className:"pc-nudge-title",children:"Rise.TV streaming plans"}),e.jsxs("div",{className:"pc-nudge-body",children:["Switch to a Rise.TV plan â Monthly for ",i.rtvsotm.label," or Annual for ",i.rtvsota.label," â for full streaming access."]})]}),e.jsx(o,{onClick:t,children:m?"Switch to Annual":"Change plan"}),e.jsx("p",{className:"rt-footnote",children:e.jsx("a",{href:"#",onClick:e=>{e.preventDefault(),l()},children:"Cancel membership"})})]})}function m({current:s,selected:a,setSelected:n,onNext:r,onBack:t}){return e.jsxs("div",{className:"rt-step",children:[e.jsx("h1",{className:"rt-h1",children:"Change your plan"}),e.jsx("p",{className:"rt-sub",children:"Same full access either way â just pick how you pay."}),e.jsx("div",{className:"rt-plans",role:"radiogroup","aria-label":"Plan",children:["rtvsota","rtvsotm"].map(r=>{const t=i[r],l=r===s,c=a===r;return e.jsxs("button",{type:"button",role:"radio","aria-checked":c,disabled:l,className:"rt-plan"+(c?" selected":"")+(l?" pc-plan-current":""),onClick:()=>n(r),children:[e.jsxs("span",{className:"rt-plan-top",children:[e.jsx("span",{className:"rt-plan-name",children:t.name}),"rtvsota"!==r||l?null:e.jsx("span",{className:"rt-plan-badge",children:"SAVE $17"}),l?e.jsx("span",{className:"pc-current-badge",children:"CURRENT"}):null]}),e.jsxs("span",{className:"rt-plan-price",children:[t.label.split("/")[0],e.jsxs("span",{className:"rt-plan-per",children:["/",t.label.split("/")[1]]})]}),e.jsx("span",{className:"rt-plan-note",children:t.note||"Cancel anytime"}),e.jsx("span",{className:"rt-plan-radio","aria-hidden":"true"})]},r)})}),e.jsx(o,{onClick:r,disabled:!a||a===s,children:"Review change"}),e.jsx(d,{onClick:t,children:"â Back"})]})}function h({current:s,currentInfo:n,selected:t,renewDate:c,onConfirm:u,onBack:m}){const[h,p]=r.useState(null);r.useEffect(()=>{l("/rise/v1/payment-method").then(e=>e.json()).then(e=>p(e.card||null)).catch(()=>{})},[]);const[j,x]=r.useState(null),[v,b]=r.useState(!0),[N,f]=r.useState(!1),[y,g]=r.useState(""),w=j?!!j.is_upgrade:"rtvsotm"===s&&"rtvsota"===t,C=n||i[s]||{name:"Your plan",label:""},k=i[t];r.useEffect(()=>{let e=!0;return l("/rise/v1/subscription/preview-change",{method:"POST",body:new URLSearchParams({plan:t})}).then(e=>e.json()).then(s=>{if(e){if("success"!==s.status)throw new Error(s.message||"Could not preview this change.");x(s)}}).catch(s=>e&&g(s.message)).finally(()=>e&&b(!1)),()=>{e=!1}},[t]);const S=null!=(null==j?void 0:j.due_today)?Number(j.due_today).toFixed(2):null;return e.jsxs("div",{className:"rt-step",children:[e.jsx("h1",{className:"rt-h1",children:w?"Confirm your upgrade":"Confirm your change"}),e.jsx("p",{className:"rt-sub",children:w?"Your Annual plan starts today.":"No charge today. Your new plan starts when the current one ends."}),e.jsxs("div",{className:"pc-switch",children:[e.jsxs("div",{className:"pc-switch-plan",children:[e.jsx("span",{className:"rt-label",children:"From"}),e.jsx("strong",{children:C.name}),e.jsx("span",{className:"rt-plan-note",children:C.label})]}),e.jsx("div",{className:"pc-switch-arrow",children:"â"}),e.jsxs("div",{className:"pc-switch-plan pc-switch-to",children:[e.jsx("span",{className:"rt-label",children:"To"}),e.jsx("strong",{children:k.name}),e.jsx("span",{className:"rt-plan-note",children:k.label})]})]}),v?e.jsx("div",{className:"rt-summary",children:e.jsx("div",{className:"rt-summary-row",children:e.jsx("span",{children:"Calculatingâ¦"})})}):e.jsx("div",{className:"rt-summary",children:w?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"rt-summary-row",children:[e.jsxs("span",{children:[k.name," plan"]}),e.jsx("span",{children:k.label.split("/")[0]})]}),e.jsxs("div",{className:"rt-summary-row rt-summary-total",children:[e.jsx("span",{children:"Due today"}),e.jsxs("span",{children:["$",S??"â"]}
1)]}),e.jsxs("div",{className:"rt-summary-note",children:["Prorated for the time left on your current plan, charged to ",h?`${h.brand} ending ${h.last4}`:"your card on file","."]})]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"rt-summary-row",children:[e.jsx("span",{children:"Due today"}),e.jsx("span",{children:"$0.00"})]}),e.jsxs("div",{className:"rt-summary-row rt-summary-total",children:[e.jsxs("span",{children:["From ",c||"your renewal date"]}),e.jsx("span",{children:k.label})]}),e.jsxs("div",{className:"rt-summary-note",children:["You keep ",C.name," benefits until ",c||"then",". Nothing changes before then."]})]})}),y&&e.jsx("div",{className:"rt-error rt-error-center",children:y}),e.jsx(o,{onClick:async()=>{if(N)return;f(!0),g("");const e=a("plan_change",t);try{const s=await l("/rise/v1/subscription/change-plan",{method:"POST",headers:e.headers,body:new URLSearchParams({plan:t})}),a=await s.json();if("success"!==a.status)throw new Error(a.message||"Could not change your plan.");u(a)}catch(s){e.failed(s),g(s.message||"Could not change your plan."),f(!1)}},disabled:N||v||!!y,children:N?"Processingâ¦":w?`Upgrade · $${S??"â"}`:"Confirm change"}),e.jsx(d,{onClick:m,children:"â Back"})]})}function p({current:s,selected:a,renewDate:n,onFinish:r}){const t="rtvsotm"===s&&"rtvsota"===a,l=i[a];return e.jsxs("div",{className:"rt-step rt-step-done",children:[e.jsx("div",{className:"pc-done-mark",children:"â"}),e.jsx("h1",{className:"rt-h1",children:t?"You're on Annual!":"Change scheduled"}),e.jsx("p",{className:"rt-sub",children:t?"Your upgrade is live. Enjoy a year of Rise TV.":`You'll switch to ${l.name} on ${n||"your renewal date"}. Until then, everything stays the same.`}),e.jsx(o,{onClick:r,children:"Back to my account"})]})}function j(){const a=n(),[o,d]=r.useState(!0),[j,x]=r.useState(""),[v,b]=r.useState(!1),[N,f]=r.useState(null),[y,g]=r.useState(null),[w,C]=r.useState(null),[k,S]=r.useState("current"),[$,R]=r.useState(null),[Y,E]=r.useState(1),[T,_]=r.useState(0);r.useEffect(()=>{t()?s().then(e=>{if(e.store_url||e.scheduled_change||!["active","trial","trialing"].includes(e.billing_status))return a("/account?tab=subscription"),Promise.reject(new Error("Manage billing from your account."));if(e.provider_error)throw new Error(e.provider_error);return l("/rise/v1/subscription")}).then(async e=>{const s=await e.json();if(!e.ok)throw new Error("Could not load your subscription.");return s}).then(e=>{if("inactive"===e.status)return b(!0),void x("You don't have an active subscription to manage.");if(!e.frequency)throw new Error("Invalid subscription response.");const s=(e=>{const s=[null==e?void 0:e.plan,null==e?void 0:e.plan_key,null==e?void 0:e.name,null==e?void 0:e.slug,null==e?void 0:e.subscription_plan].filter(Boolean).map(e=>String(e).trim().toLowerCase());for(const r of s){if(i[r])return r;if(r.includes("rtvsota"))return"rtvsota";if(r.includes("rtvsotm"))return"rtvsotm"}const a=Number(null==e?void 0:e.price),n=String((null==e?void 0:e.frequency)||"").toLowerCase();return Math.abs(a-139)<.01&&/year|annual/.test(n)?"rtvsota":Math.abs(a-12.99)<.01&&/month/.test(n)?"rtvsotm":null})(e);f(s),g(s?i[s]:{name:e.alias||e.name||"Your plan",label:`$${Number(e.price||0).toFixed(2)}/${/year/i.test(e.frequency||"")?"yr":"mo"}`}),C(e.expires_at?new Date(e.expires_at).toLocaleDateString():null),l("/rise/v1/wallet").then(e=>e.json()).then(e=>{"success"===(null==e?void 0:e.status)&&Number(e.balance)>0&&_(Number(e.balance))}).catch(()=>{})}).catch(()=>x("Could not load your subscription.")).finally(()=>d(!1)):a("/member-login?returnUrl=/manage-plan")},[a]);const B=(e,s)=>{E(s),S(e)},D={current:e.jsx(u,{current:N,currentInfo:y,renewDate:w,credit:T,onChoose:()=>{R("rtvsotm"===N?"rtvsota":null),B("pick",1)},onCancel:()=>a("/account?tab=subscription")}),pick:e.jsx(m,{current:N,selected:$,setSelected:R,onNext:()=>B("review",1),onBack:()=>B("current",-1)}),review:e.jsx(h,{current:N,currentInfo:y,selected:$,renewDate:w,onConfirm:()=>B("done",1),onBack:()=>B("pick",-1)}),done:e.jsx(p,{current:N,selected:$,renewDate:w,onFinish:()=>a("/account?tab=subscription")})};return e.jsxs("div",{className:"rt-scope rt-stage pc-plan-stage",children:[e.jsxs("header",{className:"rt-topbar",children:[e.jsx("a",{className:"rt-wordmark",href:"/","aria-label":"Rise TV home",children:e.jsx("img",{src:c,alt:"Rise TV"})}),e.jsx("button",{className:"pc-back-link",onClick:()=>a("/account?tab=subscription"),children:"â Back to account"})]}),e.jsx("main",{className:"rt-main",children:o?e.jsx("div",{className:"rt-card",children:e.jsx("p",{className:"rt-sub",children:"Loadingâ¦"})}
1):j?e.jsxs("div",{className:"rt-card",children:[e.jsx("h1",{className:"rt-h1",children:v?"No subscription to manage":"Could not load your subscription"}),e.jsx("p",{className:"rt-sub",children:j}),e.jsx("button",{className:"rt-btn-primary",onClick:()=>v?a("/subscriptions"):window.location.reload(),children:v?"View plans":"Try again"})]}):e.jsx("div",{className:"rt-card "+(Y>0?"anim-fwd":"anim-back"),children:D[k]},k)}),e.jsx("footer",{className:"rt-footer",children:"© 2026 Rise TV"})]})}export{j 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.