PageSourceSearch

https://www.aixsurge.com/_next/static/chunks/pages/plan-42e34a75de68ee27.js

js aixsurge.com collected 2026-10-09 22:55:25 UTC 6,838 bytes, 1 lines download raw bytes

1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5209],{10589:(e,n,i)=>{"use strict";i.r(n),i.d(n,{default:()=>f});var t=i(40168),a=i(44100),l=i(17532),r=i.n(l),s=i(95079),c=i(37367),d=i.n(c),o=i(86628),h=i(85629),p=i(6090),u=i(15935),x=i(2020),y=i(63618),g=i(40263),j=i(19934),v=i(32985);let m=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"],w=["SWIMMING","CYCLING","RUNNING"],C={1:[],2:[{type:"SWIMMING",num:1}],3:[{type:"RUNNING",num:1}],4:[{type:"CYCLING",num:1}],5:[{type:"SWIMMING",num:2}],6:[{type:"RUNNING",num:2}],7:[{type:"CYCLING",num:2}]},b=e=>{let{children:n}=e;return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(r(),{children:(0,t.jsx)("title",{children:"Plan Builder - Aixsurge"})}),(0,t.jsxs)(o.s,{direction:"column",style:{minHeight:"100vh",maxWidth:640,margin:"0 auto",padding:"32px 24px"},children:[(0,t.jsx)(u.a,{spacing:{mb:6},children:(0,t.jsx)(d(),{src:"https://www-assets.aixs-cdn.net/brand/logo/light.svg",width:135,height:32,alt:"Aixsurge"})}),n]})]})},f=()=>{let e=(0,s.useRouter)(),[n,i]=(0,a.useState)("loading"),[l,r]=(0,a.useState)(""),[c,d]=(0,a.useState)([{title:"",eventDate:"",trainingPlanType:"",priorityId:""}]),[f,E]=(0,a.useState)(!1),[I,N]=(0,a.useState)(C),[k,T]=(0,a.useState)([]),[D,S]=(0,a.useState)([]);(0,a.useEffect)(()=>{!async function(){try{if(!await (0,j.qY)())return void e.replace("/join");i("event")}catch(n){e.replace("/join")}}()},[e]);let A=(0,a.useCallback)((e,n,i)=>{d(t=>{let a=[...t];return a[e]={...a[e],[n]:i},a})},[]),Y=(0,a.useCallback)(()=>{d(e=>[...e,{title:"",eventDate:"",trainingPlanType:"",priorityId:""}])},[]),z=(0,a.useCallback)(e=>{d(n=>n.filter((n,i)=>i!==e))},[]),P=(0,a.useCallback)((e,n)=>{N(i=>{let t=i[e]||[];return t.find(e=>e.type===n)?{...i,[e]:t.filter(e=>e.type!==n)}:{...i,[e]:[...t,{type:n,num:t.length+1}]}})},[]),M=(0,a.useCallback)(async()=>{i("creating"),r("");try{let e=[];
1if(!f){for(let n of c)if(n.eventDate&&n.trainingPlanType){let i=(0,g.GP)(new Date,"yyyy-MM-dd"),t=await v.fW.createEvent({title:n.title||"My Event",startDate:i,eventDate:n.eventDate,priorityId:n.priorityId,trainingPlanType:n.trainingPlanType});(null==t?void 0:t.id)&&e.push(t.id)}}let n={1:"MONDAY",2:"TUESDAY",3:"WEDNESDAY",4:"THURSDAY",5:"FRIDAY",6:"SATURDAY",7:"SUNDAY"},t=[];for(let[e,i]of Object.entries(I))for(let a of i)t.push({dayOfWeek:n[Number(e)]||"MONDAY",activityType:a.type});await v.fW.createPlan({stageEventIds:e,trainingDayPrefs:t}),i("done")}catch(e){console.error("Failed to create plan:",e),r(e.message||"Failed to create plan. Please try again."),i("error")}},[c,I,f]);return"loading"===n?(0,t.jsx)(b,{children:(0,t.jsx)(o.s,{direction:"column",alignItems:"center",justifyContent:"center",gap:4,children:(0,t.jsx)(h.a,{size:"l"})})}):"event"===n?(0,t.jsxs)(b,{children:[(0,t.jsx)(p.E,{variant:"display-1",children:"Create your training plan"}),(0,t.jsx)(u.a,{spacing:{mt:2,mb:4},children:(0,t.jsx)(p.E,{variant:"body-2",color:"secondary",children:"Set your target events and we'll build a plan around them."})}),!f&&c.map((e,n)=>(0,t.jsxs)(u.a,{spacing:{mb:4},style:{padding:16,borderRadius:12,border:"1px solid var(--g-color-line-generic)"},children:[(0,t.jsxs)(o.s,{justifyContent:"space-between",alignItems:"center",children:[(0,t.jsxs)(p.E,{variant:"subheader-2",children:["Event ",n+1]}),c.length>1&&(0,t.jsx)(x.$,{view:"flat",size:"s",onClick:()=>z(n),children:"Remove"})]}),(0,t.jsxs)(o.s,{direction:"column",gap:3,style:{marginTop:12},children:[(0,t.jsx)(y.k,{size:"l",placeholder:"Event name (e.g. Ironman 70.3)",value:e.title,onUpdate:e=>A(n,"title",e)}),(0,t.jsx)(y.k,{size:"l",placeholder:"YYYY-MM-DD",label:"Event date",value:e.eventDate,onUpdate:e=>A(n,"eventDate",e)}),(0,t.jsx)(y.k,{size:"l",placeholder:"Training Plan Type",value:e.trainingPlanType,onUpdate:e=>A(n,"trainingPlanType",e)}),(0,t.jsx)(y.k,{size:"l",placeholder:"Priority ID",value:e.priorityId,onUpdate:e=>A(n,"priorityId",e)})]})]},n)),(0,t.jsxs)(o.s,{gap:3,children:[!f&&(0,t.jsx)(x.$,{view:"outlined",size:"l",onClick:Y,children:"Add another event"}),(0,t.jsx)(x.$,{view:"flat",size:"l",onClick:()=>E(!f),children:f?"Add an event":"Skip events"})]}),(0,t.jsx)(u.a,{spacing:{mt:6},children:(0,t.jsx)(x.$,{view:"action",size:"xl",width:"max",onClick:()=>i("schedule"),children:"Next: Training schedule"})})]}):"schedule"===n?(0,t.jsxs)(b,{children:[(0,t.jsx)(p.E,{variant:"display-1",children:"Training schedule"}),(0,t.jsx)(u.a,{spacing:{mt:2,mb:4},children:(0,t.jsx)(p.E,{variant:"body-2",color:"secondary",children:"Choose which days you want to train and what activities to do."})}),(0,t.jsxs)(u.a,{spacing:{mb:4},style:{display:"grid",gridTemplateColumns:"auto repeat(".concat(w.length,", 1fr)"),gap:8},children:[(0,t.jsx)("div",{}),w.map(e=>(0,t.jsx)(p.E,{variant:"caption-2",style:{textAlign:"center"},children:e.charAt(0)+e.slice(1).toLowerCase()},e)),m.map((e,n)=>{let i=n+1,l=I[i]||[];return(0,t.jsxs)(a.Fragment,{children:[(0,t.jsx)(p.E,{variant:"body-2",children:e}),w.map(e=>{let n=l.some(n=>n.type===e);return(0,t.jsx)(x.$,{view:n?"action":"outlined",size:"m",onClick:()=>P(i,e),children:n?"✓":"\xb7"},e)})]},i)})]}),(0,t.jsxs)(o.s,{gap:3,children:[(0,t.jsx)(x.$,{view:"outlined",size:"xl",onClick:()=>i("event"),children:"Back"}),(0,t.jsx)(x.$,{view:"action",size:"xl",width:"max",onClick:M,children:"Create plan"})]})]}):"creating"===n?(0,t.jsx)(b,{children:(0,t.jsxs)(o.s,{direction:"column",alignItems:"center",gap:4,children:[(0,t.jsx)(p.E,{variant:"body-2",children:"Building your training plan…"}),(0,t.jsx)(h.a,{size:"l"})]})}):"done"===n?(0,t.jsx)(b,{children:(0,t.jsxs)(o.s,{direction:"column",alignItems:"center",gap:4,style:{textAlign:"center"},children:[(0,t.jsx)(p.E,{variant:"display-1",children:"Your plan is ready!"}),(0,t.jsx)(p.E,{variant:"body-2",color:"secondary",children:"Open the Aixsurge app to see your new training plan."}),(0,t.jsx)(u.a,{spacing:{mt:4},style:{width:"100%",maxWidth:320},children:(0,t.jsxs)(o.s,{direction:"column",gap:3,children:[(0,t.jsx)("a",{href:"aixsurge://dashboard",style:{width:"100%"},children:(0,t.jsx)(x.$,{view:"action",size:"xl",width:"max",children:"Open in a
1pp"})}),(0,t.jsx)(x.$,{view:"outlined",size:"xl",width:"max",onClick:()=>i("event"),children:"Create another plan"})]})})]})}):"error"===n?(0,t.jsx)(b,{children:(0,t.jsxs)(o.s,{direction:"column",alignItems:"center",gap:4,style:{textAlign:"center"},children:[(0,t.jsx)(p.E,{variant:"display-1",children:"Something went wrong"}),(0,t.jsx)(p.E,{variant:"body-2",color:"secondary",children:l}),(0,t.jsx)(u.a,{spacing:{mt:4},children:(0,t.jsx)(x.$,{view:"action",size:"xl",onClick:()=>i("schedule"),children:"Try again"})})]})}):null}},30126:(e,n,i)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/plan",function(){return i(10589)}])}},e=>{var n=n=>e(e.s=n);e.O(0,[6701,3525,67,263,9854,2985,636,6593,8792],()=>n(30126)),_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.