1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9309],{16350:(e,t,s)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/account",function(){return s(25778)}])},25778:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>x});var a=s(37876),n=s(48230),r=s.n(n),l=s(89099),i=s(14232),o=s(85392),c=s(74),d=s(93408),m=s(25620),u=s(21081),p=s(39126);let h={app_store:"Apple App Store",mac_app_store:"Apple App Store",play_store:"Google Play",stripe:"Stripe",rc_billing:"Web"};function x(){let e=(0,l.useRouter)(),{user:t,loading:s,linkProvider:n,logout:x}=(0,m.A)(),{isPremium:g,entitlementLoading:b,profile:f,refreshPremium:j}=(0,u.x)(),[y,N]=(0,i.useState)(""),[w,k]=(0,i.useState)(""),[v,S]=(0,i.useState)(""),[_,A]=(0,i.useState)([]),[P,C]=(0,i.useState)(!1);(0,i.useEffect)(()=>{s||t||e.replace("/login/?returnUrl=%2Faccount%2F"),A(t?.providerData.map(e=>e.providerId)||[]),S(""),k(""),C(!1)},[s,t,e]);let E=async e=>{N(e),k(""),S("");try{await n(e),A(t.providerData.map(e=>e.providerId)),S("Sign-in method linked. You can now use either method for this account."),C(!1)}catch(e){k((0,p.C1)(e))}finally{N("")}},M=async()=>{N("refresh"),k(""),S("");try{let e=await j();S(e.isPremium?"Pro is active on your account.":"No active Pro subscription was found for this account.")}catch{k("Unable to check your subscription. Please try again.")}finally{N("")}},U=f.premiumManagementUrl?.startsWith("https://")?f.premiumManagementUrl:null;return(0,a.jsxs)("div",{className:"min-h-screen flex flex-col bg-slate-50",children:[(0,a.jsx)(d.A,{title:"Your account â trains.fyi",description:"Manage your trains.fyi account and Pro subscription.",canonical:"/account/"}),(0,a.jsx)(c.A,{}),(0,a.jsxs)("main",{className:"flex-1 w-full max-w-3xl mx-auto px-6 py-12",children:[(0,a.jsx)("h1",{className:"text-3xl font-bold text-slate-900",children:"Your account"}),s||!t?(0,a.jsx)("p",{className:"mt-6",role:"status",children:"Loading your accountâ¦"}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("p",{className:"mt-3 text-slate-600 break-all",children:t.email||t.displayName||"Signed in"}),(0,a.jsxs)("section",{className:"mt-8 rounded-2xl border border-slate-200 bg-white p-6 sm:p-8",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between gap-4",children:[(0,a.jsx)("h2",{className:"text-xl font-semibold",children:"Your plan"}),(0,a.jsx)("span",{className:"rounded-full bg-blue-50 text-blue-800 px-3 py-1 font-semibold",children:b?"Checkingâ¦":g?"Pro":"Free"})]}),(0,a.jsx)("p",{className:"mt-4 text-slate-600",children:g?"Your Pro access works on the web, iOS and Android when you use this account.":"Upgrade for an ad-free experience and Pro features in the mobile apps."}),f.premiumStore&&(0,a.jsxs)("p",{className:"mt-3 text-sm text-slate-600",children:["Purchased through ",h[f.premiumStore]||"your original billing provider","."]}),g&&f.premiumExpiresAt&&(0,a.jsxs)("p",{className:"mt-2 text-sm text-slate-600",children:[f.premiumWillRenew?"Current period ends":"Access until"," ",new Date(f.premiumExpiresAt).toLocaleDateString(void 0,{dateStyle:"long"}),"."]}),(0,a.jsxs)("div",{className:"mt-6 flex flex-wrap gap-3",children:[!b&&!g&&(0,a.jsx)(r(),{href:"/pro/",className:"rounded-lg bg-blue-700 text-white px-5 py-3 font-semibold",children:"Explore Pro"}),U&&(0,a.jsx)("a",{href:U,target:"_blank",rel:"noopener noreferrer",className:"rounded-lg bg-blue-700 text-white px-5 py-3 font-semibold",children:"Manage subscription"}),(0,a.jsx)("button",{onClick:M,disabled:!!y,className:"rounded-lg border border-slate-300 px-5 py-3 font-medium disabled:opacity-50",children:"refresh"===y?"Checkingâ¦":"Refresh subscription status"})]}),(0,a.jsx)("p",{className:"mt-5 text-sm text-slate-500",children:"Manage renewal, cancellation and payment details with the provider you originally purchased through."}),(0,a.jsx)("p",{className:"mt-3 text-sm text-slate-500",children:"Missing an app purchase? Sign in to the same account in the app and use Restore Purchases, then refresh here."})]}),(0,a.jsxs)("section",{className:"mt-6 rounded-2xl border border-slate-200 bg-white p-6 sm:p-8",children:[(0,a.jsx)("h2",{className:"text-xl font-semibold",children:"Sign-in methods"}),(0,a.jsx)("p",{className:"mt-3 text-slate-600",children:"Link Apple and Google so either sign-in opens the same account and Pro subscription."}),["apple.com","google.com"].some(e=>!_.includes(e))&&(0,a.jsxs)("label",{className:"mt-5 flex gap-3 items-start text-sm text-slate-600",children:[(0,a.jsx)("input",{type:"checkbox",checked:P,onChange:e=>C(e.target.checked),className:"mt-1"}),(0,a.jsx)("span",{children:"I agree to connect the selected sign-in method and its account information to this trains.fyi account, including if I used Appleâs Hide My Email."})]}),(0,a.jsx)("div",{className:"mt-5 space-y-3",children:[["apple.com","Apple"],["google.com","Google"]].map(([e,t])=>(0,a.jsxs)("div",{className:"flex items-center justify-between gap-4 roun
1ded-lg border border-slate-200 p-4",children:[(0,a.jsx)("span",{className:"font-medium",children:t}),_.includes(e)?(0,a.jsx)("span",{className:"text-sm text-green-700",children:"Connected"}):(0,a.jsx)("button",{disabled:!!y||!P,onClick:()=>E(e),className:"text-blue-700 font-semibold disabled:opacity-50",children:y===e?"Connectingâ¦":`Connect ${t}`})]},e))}),(0,a.jsx)("p",{className:"mt-4 text-sm text-slate-500",children:"If a sign-in method already belongs to another account, it cannot be linked here. Sign in to that account to access its purchases."})]}),w&&(0,a.jsx)("p",{role:"alert",className:"mt-5 rounded-lg bg-red-50 p-4 text-red-800",children:w}),v&&(0,a.jsx)("p",{role:"status",className:"mt-5 rounded-lg bg-blue-50 p-4 text-blue-900",children:v}),(0,a.jsx)("button",{disabled:!!y,onClick:async()=>{try{await x()}catch{k("Unable to sign out. Please try again.")}},className:"mt-8 text-slate-600 underline",children:"Sign out"})]})]}),(0,a.jsx)(o.A,{})]})}},77808:(e,t,s)=>{"use strict";s.d(t,{A:()=>n});var a=s(14232);let n=a.forwardRef(function({title:e,titleId:t,...s},n){return a.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:n,"aria-labelledby":t},s),e?a.createElement("title",{id:t},e):null,a.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4.5 10.5 12 3m0 0 7.5 7.5M12 3v18"}))})}},e=>{e.O(0,[6701,3927,2325,3990,8447,5392,636,6593,8792],()=>e(e.s=16350)),_N_E=e.O()}]);
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.