PageSourceSearch

https://www.parissamusic.org/assets/StudentEnrollPage-CCQqK1tu.js

js parissamusic.org collected 2026-10-02 21:19:33 UTC 17,804 bytes, 1 lines download raw bytes

1import{c9 as V,bz as t,bB as f,aO as M,aD as R,b2 as v,al as H,bJ as a,aA as pe,at as Ee,b5 as we,bv as Ae,bG as x,c7 as Me,c1 as Te,bM as ge,bt as xe,aG as fe,bD as Le,aI as Be,aq as Oe,ap as Re,bN as Fe,bs as $e}from"./index-4bCrtBdz.js";import{P as Ue}from"./PortalPageHeader-Crv0659P.js";import{B as ee}from"./BookSessionCta-BVY0Kt4W.js";import{s as De}from"./screeningMessage-Au8iDZsn.js";import{u as Ge}from"./useSessionAuth-BZfK-4jN.js";import{u as He}from"./useConsentEnrollmentStatus-BzbVH2wK.js";import{r as Ke}from"./recordActivity-Czc76Aj9.js";import{p as Ve}from"./layout-DaEe1fwH.js";import"./density-CDDqF8v-.js";function Ye({email:e,screeningStatus:n,curriculumAllowed:i,enrolledTier:s,className:m}){const{t:r}=V("site");return t.jsxs("section",{className:v(`border border-border-gold bg-bg px-5 py-5 md:px-6 md:py-6 ${f.portalPanel}`,m),"aria-labelledby":"enrolled-summary-heading",children:[t.jsx("p",{id:"enrolled-summary-heading",className:f.sectionLabel,children:r("enrollActiveSubscription")}),s?t.jsxs("p",{className:"mt-3 font-body text-[length:var(--text-body)] text-text",children:[t.jsx("strong",{children:s.title})," · ",s.priceLabel]}):null,i?t.jsxs("div",{className:"mt-5",children:[t.jsx(M,{className:"mb-4",children:r("enrollEnrolledActiveBody",{email:e})}),t.jsxs("div",{className:"flex flex-wrap gap-3",children:[t.jsx(R,{to:"/student",className:v(f.primaryButton,"no-underline"),children:r("enrollOpenStudentHome")}),t.jsx(R,{to:"/student/profile",className:v(f.outlineButton,"no-underline"),children:r("enrollViewProfile")})]}),t.jsx(ee,{className:"mt-4",variant:"outline",withHint:!0})]}):t.jsxs("div",{className:"mt-5",children:[t.jsx(M,{className:"mb-4",children:r("enrollEnrolledSubscribedBody",{email:e})}),t.jsx("p",{className:"mb-4 font-body text-[length:var(--text-body-sm)] text-text-muted",children:De(n??"not_scheduled")}),t.jsx(ee,{className:"mb-4",withHint:!0}),t.jsx(R,{to:"/student/profile",className:v(f.outlineButton,"no-underline"),children:r("enrollViewProfile")})]}),t.jsxs("p",{className:"mt-6 font-body text-[length:var(--text-body-sm)] text-text-muted",children:[r("enrollFooterEnrolled")," ",t.jsx("a",{href:`mailto:${H}`,className:f.linkSienna,children:H})]})]})}function Je({value:e,onChange:n,className:i}){const{t:s}=V("site"),m=a.useId();return t.jsxs("fieldset",{className:v("mt-5 border-0 p-0",i),children:[t.jsx("legend",{className:"mb-3 font-body text-[length:var(--text-body-sm)] text-text",children:s("enrollIrvineSessionLegend")}),t.jsx("div",{className:"grid gap-2",children:pe.map(r=>{const y=`${m}-${r.value}`;return t.jsxs("label",{htmlFor:y,className:v("flex min-h-11 cursor-pointer items-start gap-3 border border-border-gold px-4 py-3",e===r.value&&"border-sienna bg-[rgba(139,74,46,0.05)]"),children:[t.jsx("input",{id:y,type:"radio",name:m,value:r.value,checked:e===r.value,onChange:()=>n(r.value),className:"mt-1 shrink-0 accent-sienna"}),t.jsx("span",{className:"font-body text-[length:var(--text-body-sm)] text-text-muted",children:s(r.labelKey)})]},r.value)})})]})}const oe=4,te=2,ne=4;function ye(e){return((e==null?void 0:e.trim().length)??0)>0}function qe(e){return ye(e.stripeOneTimePriceId)}function ze(e){return ye(e.stripePriceId)}function We(e){const n=[];return qe(e)&&n.push("package"),ze(e)&&n.push("monthly"),n}function _e(e){const n=typeof e=="number"?e:Number(e);if(!Number.isFinite(n))return oe;const i=Math.round(n);return i<te?te:i>ne?ne:i}function Qe(e){const n=e.sessionsPerPurchase;return Number.isInteger(n)&&n>0?_e(n):oe}function Xe(){const e=[];for(let n=te;n<=ne;n+=1)e.push(n);return e}function Ze({modes:e,mode:n,onModeChange:i,sessions:s,onSessionsChange:m,pricePerSession:r,monthlyPrice:y,className:_}){const{t:g,i18n:S}=V("site"),N=a.useId(),P=a.useId(),d=h=>new Intl.NumberFormat(S.language,{maximumFractionDigits:2}).format(h),C=h=>new Intl.NumberFormat(S.language).format(h),T=r===null?null:r*s,L=h=>g("enrollPackageTotalCompact",{amount:d(h)});return t.jsx("div",{className:_,children:t.jsxs("fieldset",{className:"border-0 p-0",children:[t.jsx("legend",{className:"mb-2 font-body text-[length:var(--text-body-sm)] text-text",children:g("enrollBillingModeLegend")}),t.jsx("div",{className:"divide-y divide-border-gold border border-border-gold",children:e.map(h=>{const k=`${N}-${h}`,b=h==="package";return t.jsxs("div",{className:v("flex min-h-[4.75rem] flex-wrap items-center gap-3 px-4 py-3",n===h&&"bg-[rgba(139,74,46,0.05)]"),children:[t.jsxs("label",{htmlFor:k,className:"flex min-w-[12rem] flex-1 cursor-pointer items-center gap-3",children:[t.jsx("input",{id:k,type:"radio",name:N,value:h,checked:n===h,onChange:()=>i(h),className:"shrink-0 accent-sienna"}),t.jsxs("span",{className:"grid gap-0.5 font-body",children:[t.jsx("span",{className:v("text-[length:var(--text-body-sm)] text-text",n===h&&"text-sienna"),children:g(b?"enrollBillingModePackage":"enrollBillingModeMonthly")}),t.jsx("span",{className:"text-[length:var(--text-caption)] text-text-muted",children:b?r===null?g("enrollBillingModePackageSubtitle"):g("enrollBillingModePackageDetail",{amount:d(r)}):g("enrollBillingModeMonthlyRenewal")})]})]}),b?t.jsx(Ee,{id:P,"aria-label":g("enrollSessionsLegend"),value:s,onChange:j=>{i("package"),m(Number(j.target.value))},wrapperClassName:"w-44 shrink-0",children:Xe().map(j=>t.jsx("option",{value:j,children:g(j===1?"enrollSessionsOptionOne":"enrollSessionsOptionMany",{count:C(j)})}
1,j))}):null,t.jsx("bdi",{className:"ms-auto shrink-0 font-body text-[length:var(--text-body-sm)] text-text",children:b?T===null?null:L(T):y===null?null:g("enrollBillingModeMonthlyRate",{amount:d(y)})})]},h)})})]})})}function G(){return t.jsx("p",{className:`mt-4 ${f.statusText}`,children:x("auto.checking_account_d9e59da6")})}function et(e,n){const i=we(e.variant,n);let s=null,m=null;const r=Ae(e.tier),y=!r||!!e.irvineSessionPreference,_=e.loading||e.consentLoading;return e.variant==="terms"?(s=_?G():t.jsx(M,{className:"mt-5",children:n("site:enrollConsentBody")}),m=t.jsx(R,{to:e.consentPath,className:v(f.primaryButton,"no-underline"),children:x("auto.review_and_accept_terms_4b54a142")})):e.variant==="subscribe"?(s=_?G():t.jsxs(t.Fragment,{children:[r&&pe.length>1?t.jsx(Je,{value:e.irvineSessionPreference,onChange:e.onIrvineSessionPreferenceChange}):null,e.billingMode?t.jsx(Ze,{modes:e.billingModes,mode:e.billingMode,onModeChange:e.onBillingModeChange,sessions:e.packageSessions,onSessionsChange:e.onPackageSessionsChange,pricePerSession:e.pricePerSession,monthlyPrice:e.monthlyPrice}):null,y?null:t.jsx("p",{className:"mt-4 font-body text-[length:var(--text-body-sm)] text-sienna",children:n("site:enrollIrvineSessionRequired")}),e.checkoutError?t.jsx("p",{className:"mt-4 font-body text-[length:var(--text-body-sm)] text-sienna",children:e.checkoutError}):null]}),e.signedInEmail&&y&&!_&&(m=t.jsx("button",{type:"button",disabled:e.checkoutLoading,onClick:e.onOpenCheckout,className:v(f.primaryButton,"w-full"),children:e.checkoutLoading?x("auto.starting_checkout_2801a2b2"):n("site:enrollCheckoutCta")}))):e.variant==="confirming"&&(s=_?t.jsxs(t.Fragment,{children:[G(),t.jsx("p",{className:"mt-3 font-body text-[length:var(--text-body-sm)] text-text-muted",children:n("site:enrollPaymentNotCompleteHint")})]}):t.jsxs(M,{tone:"muted",className:"mt-5",children:[n("site:enrollAwaitingPaymentShort"),e.awaitingPaymentConfirmation?t.jsx("span",{className:"mt-2 block font-body text-[length:var(--text-body-sm)] text-text-muted",children:x("auto.checking_for_payment_confirmation_c26390c1")}):null,t.jsx("span",{className:"mt-3 block font-body text-[length:var(--text-body-sm)] text-text-muted",children:n("site:enrollPaymentNotCompleteHint")})]}),m=t.jsx("button",{type:"button",onClick:e.onRestartCheckout,className:f.primaryButton,children:n("site:enrollRestartCheckout")})),e.variant==="error"&&(s=t.jsxs(t.Fragment,{children:[s??G(),t.jsx("p",{className:"mt-4 font-body text-[length:var(--text-body-sm)] text-sienna",children:e.errorMessage??x("auto.could_not_verify_enrollment_status_a9d202bb")})]}),m=t.jsx("button",{type:"button",onClick:e.onRetryCheck,className:f.primaryButton,children:x("auto.check_again_e185048c")})),{eyebrow:i,body:s,action:m}}function tt(e,n){var r,y;const i=(n==null?void 0:n[e.id])??(e.offeringId?n==null?void 0:n[e.offeringId]:void 0),s=(r=i==null?void 0:i.title)==null?void 0:r.trim();if(!s)return e.title;const m=(y=i==null?void 0:i.subtitle)==null?void 0:y.trim();return m?`${s} — ${m}`:s}const nt=/^(?:US|CA)?\$\s*([\d,]+(?:\.\d+)?)\s*\/\s*(month|session)$/i;function st(e){const n=e.trim().match(nt);if(!n)return null;const i=Number(n[1].replace(/,/g,""));return Number.isFinite(i)?{amount:i,unit:n[2].toLowerCase()}:null}function ot(e,n){return e?e.unit==="month"?e.amount:!Number.isInteger(n)||n<1?null:e.amount*n:null}const se="/student/enroll",rt="parissa-enroll-awaiting-payment",K="parissa-enroll-pending-payment-v2",lt=30*6e4;function X(){try{sessionStorage.removeItem(rt)}catch{}}function at(){try{const e=sessionStorage.getItem(K);if(!e)return null;const n=JSON.parse(e);return typeof n.tierId!="string"||typeof n.startedAt!="number"||Date.now()-n.startedAt>lt?(sessionStorage.removeItem(K),null):{tierId:n.tierId,startedAt:n.startedAt,...typeof n.sessionId=="string"?{sessionId:n.sessionId}:{}}}catch{return null}}function be(e){try{sessionStorage.setItem(K,JSON.stringify(e))}catch{}}function Z(){try{sessionStorage.removeItem(K)}catch{}}function it(e){const n=`${se}?tier=${encodeURIComponent(e)}`;return`/student/consent?tier=${encodeURIComponent(e)}&next=${encodeURIComponent(n)}`}function yt(){var de,ue,me,he;const{t:e,i18n:n}=V(["common","site"]),{loading:i,session:s}=Ge(),[m,r]=a.useState(!1),[y,_]=a.useState(null),[g,S]=Me(),N=g.get("checkout"),P=((de=g.get("session_id"))==null?void 0:de.trim())||void 0,[d,C]=a.useState(()=>at()),{tiers:T,loading:L,error:h}=Te(),k=ge(((ue=g.get("tier"))==null?void 0:ue.trim())??""),[b,j]=a.useState(k),[F,Ne]=a.useState("saturday"),u=He(s,i,{watchForEnrollment:N==="success"||d!==null,paymentConfirmationTimeoutMessage:e("site:enrollPaymentConfirmationTimeout")}),ke=$e(N,u.enrolled,d!==null),E=a.useMemo(()=>T.filter(o=>xe(o)&&(!o.adminOnly||o.id===b)),[b,T]),$=a.useMemo(()=>e("site:classesLanding.formats.offerings",{returnObjects:!0})??{},[e]),re=a.useMemo(()=>E.map(o=>{var O;const c=st(o.priceLabel),p=$[o.id]??(o.offeringId?$[o.offeringId]:void 0),w=c?e(c.unit==="month"?"site:enrollPricePerMonth":"site:enrollPricePerSession",{amount:new Intl.NumberFormat(n.language).format(c.amount)}):o.priceLabel;return{...o,title:tt(o,$),description:((O=p==null?void 0:p.description)==null?void 0:O.trim())||o.description,priceLabel:w,parsedPrice:c}}),[E,n.language,$,e]),l=re.find(o=>o.id===b)??null,B=l?xe(l):!1,Y=a.useMemo(()=>l?We(l):[],[l]),[J,le]=a.useState(null),[U,ae]=a.useState(4),I=J&&Y.includes(J)?J:Y[0]??null,ve=((me=l==null?void 0:l.parsedPrice)==null?void 0:me.unit)==="session"?l.parsedPrice.amount:null,Se=ot((l==null?void 0:l.parsedPrice)??null,(l==null?void 0:l.sessionsPerPurchase)??oe),je=u.consentAccepted&&u.privacyAccepted,q=((he=s==null?void 0:s.user)==null?void 0:he.email)??null,ie=i||u.loading;a.useEffect(()=>{X()},[]),a.useEffect(()=>{if(N!=="success"||!k)return;const o={tierId:k,startedAt:(d==null?void 0:d.startedAt)??Date.now(),...P?{sessionId:P}:{}};be(o),C(o)},[N,P,d==null?void 0:d.startedAt,k]);const z=a.useCallback(async()=>{const o=s==null?void 0:s.access_token,c=P||(d==null?void 0:d.sessionId);if(!o||!c)return!1;try{const p=await fetch("/api/student/confirm-checkout",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${o}`},body:JSON.stringify({sessionId:c})}),w=await p.json().catch(()=>null);return!!(p.ok&&(w!=null&&w.enrolled))}catch{return!1}},[P,d==null?void 0:d.sessionId,s==null?void 0:s.access_token]),W=u.retryCheck;a.useEffect(()=>{if(!(s!=null&&s.access_token)||u.enrolled||!(P||(d==null?void 0:d.sessionId))||N!=="success"&&!d)return;let c=!1;return(async()=>{const p=await z();!c&&p&&W()})(),()=>{c=!0}},[N,P,z,u.enrolled,d,W,s==null?void 0:s.access_token]);const Pe=a.useCallback(()=>{X(),Z(),C(null),S(o=>{const c=new URLSearchParams(o);return c.delete("checkout"),c},{replace:!0})},[S]);a.useEffect(()=>{N==="cancelled"&&(X(),Z(),C(null))},[N]),a.useEffect(()=>{u.enrolled&&(Z(),C(null))}
1,[u.enrolled]),a.useEffect(()=>{var p;const o=((p=g.get("tier"))==null?void 0:p.trim())??"";if(!o)return;const c=ge(o);c!==o&&S(w=>{const O=new URLSearchParams(w);return O.set("tier",c),O},{replace:!0})},[g,S]),a.useEffect(()=>{k&&j(k)},[k]),a.useEffect(()=>{if(L||E.length!==1)return;const o=E[0];b!==o.id&&(j(o.id),S({tier:o.id},{replace:!0}))},[E,b,S,L]);const ce=(l==null?void 0:l.sessionsPerPurchase)??null;a.useEffect(()=>{b&&ae(Qe({sessionsPerPurchase:ce}))},[b,ce]);const Ie=a.useCallback(o=>{j(o),le(null),S({tier:o},{replace:!0})},[S]);a.useEffect(()=>{if(!B||u.enrolled||typeof window<"u"&&window.matchMedia("(max-width: 767px)").matches)return;const o=window.requestAnimationFrame(()=>{var c;(c=document.getElementById("enrollment-tier-action"))==null||c.scrollIntoView({behavior:"smooth",block:"nearest"})});return()=>window.cancelAnimationFrame(o)},[u.enrolled,b,B]);const Ce=a.useCallback(()=>{if(!(s!=null&&s.access_token)||!l){_(x("auto.session_expired_please_sign_in_again_5af0406a"));return}r(!0),_(null),Ke(s.access_token,"enrollment.payment_link_opened",{tierId:l.id,...I?{billingMode:I}:{},...I==="package"?{sessions:U}:{},...F?{sessionPreference:F}:{}}),(async()=>{try{const o=await fetch("/api/student/checkout-session",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${s.access_token}`},body:JSON.stringify({tierId:l.id,...I?{billingMode:I}:{},...I==="package"?{sessions:U}:{}})}),c=await o.json();if(!o.ok){c.code==="CONSENT_REQUIRED"?_(x("auto.please_complete_consent_and_privacy_agreement_be_7fe2e1bb")):_(c.error??x("auto.could_not_start_checkout_please_try_again_bd150553"));return}if(!c.url){_(x("auto.checkout_session_created_but_no_url_returned_c3291d94"));return}const p={tierId:l.id,startedAt:Date.now(),...c.sessionId?{sessionId:c.sessionId}:{}};
1be(p),C(p),window.location.href=c.url}catch(o){console.error(x("auto.checkout_session_failed_6926b99b"),o),_(x("auto.could_not_connect_to_checkout_please_try_again_fcc2cacb"))}finally{r(!1)}})()},[F,U,I,l,s]);if(!i&&!s){const o=k.length>0?`${se}?tier=${encodeURIComponent(k)}`:se;return t.jsx(fe,{to:Le({intent:"student",next:o}),replace:!0})}if(!ie&&u.enrolled&&u.curriculumAllowed)return t.jsx(fe,{to:"/student",replace:!0,state:{enrollRedirectNotice:e("site:enrollRedirectNotice")}});const A=!ie&&u.enrolled,Q=l?Fe(u.error,ke,je):null,D=l&&Q&&!A?et({variant:Q,tier:l,signedInEmail:q,loading:i,consentLoading:u.loading,awaitingPaymentConfirmation:u.awaitingPaymentConfirmation,irvineSessionPreference:F,onIrvineSessionPreferenceChange:Ne,billingModes:Y,billingMode:I,onBillingModeChange:le,packageSessions:U,onPackageSessionsChange:o=>ae(_e(o)),pricePerSession:ve,monthlyPrice:Se,onOpenCheckout:Ce,onRestartCheckout:Pe,onRetryCheck:()=>{z().finally(()=>W())},consentPath:it(l.id),checkoutLoading:m,checkoutError:y,errorMessage:u.error,accessToken:(s==null?void 0:s.access_token)??null},e):null;return t.jsx("main",{id:"main-content",tabIndex:-1,className:v(f.portalMain,B&&!A&&"max-md:pb-28"),"aria-labelledby":"student-enroll-heading",children:t.jsxs("div",{className:v(Ve("dashboard"),"mx-auto max-w-[52rem]"),children:[t.jsx(Ue,{title:A?e("site:enrollEnrolledHeading"):Be.enroll,headingId:"student-enroll-heading"}),A?t.jsx(M,{tone:"muted",className:"mt-6 max-w-[var(--measure-prose)]",children:e("site:enrollEnrolledBlurb")}):t.jsx(t.Fragment,{children:N==="success"&&!u.enrolled?t.jsxs("div",{className:"mt-6 rounded border border-gold/30 bg-ivory/50 p-4",children:[t.jsx("p",{className:"font-body text-[length:var(--text-body)] text-text",children:x("auto.payment_received_confirming_your_enrollment_21e0592d")}),t.jsx(ee,{className:"mt-4",withHint:!0})]}):N==="cancelled"?t.jsxs("div",{className:"mt-6 rounded border border-sienna/30 bg-ivory/50 p-4",children:[t.jsx("p",{className:"font-body text-[length:var(--text-body)] text-text",children:x("auto.checkout_was_cancelled_fe8195df")}),t.jsx("p",{className:"mt-2 font-body text-[length:var(--text-body-sm)] text-text-muted",children:e("site:enrollCheckoutCancelledHint")})]}):null}),A&&q?t.jsx(Ye,{className:"mt-10",email:q,screeningStatus:u.screeningStatus,curriculumAllowed:u.curriculumAllowed,enrolledTier:u.enrolledTier}):t.jsxs(t.Fragment,{children:[L?t.jsx("p",{className:`mt-6 ${f.statusText}`,children:x("auto.loading_enrollment_options_dc7ed08e")}):h?t.jsx("p",{className:"mt-6 font-body text-[length:var(--text-body-sm)] text-sienna",children:h}):E.length===0?t.jsx("p",{className:`mt-6 ${f.statusText}`,children:x("auto.no_programs_are_currently_open_for_enrollment_6044e9f6")}):null,E.length>0?t.jsx(Oe,{className:"mt-8",tiers:re,selectedTierId:b,onSelectTier:o=>Ie(o.id),selectedExtras:l&&B&&D?t.jsxs(t.Fragment,{children:[D.body,D.action?t.jsx(Re,{children:D.action}):null,Q==="subscribe"?t.jsx("p",{className:"mt-3 font-body text-[length:var(--text-body-sm)] leading-relaxed text-text-muted",children:e("site:enrollConditionPlacement")}):null]}):null}):null,l&&!B?t.jsx(M,{tone:"muted",className:"mt-8 max-w-[var(--measure-prose)]",children:e("site:signUpTierUnavailable")}):null]}),A?null:t.jsxs("div",{className:"mt-8 grid gap-2 border-t border-border-gold pt-6 font-body text-[length:var(--text-body-sm)] text-text-muted",children:[t.jsxs("p",{children:[e("site:enrollFooterQuestions")," ",t.jsx("a",{href:`mailto:${H}`,className:f.linkSienna,children:H})]}),t.jsx("p",{children:t.jsx(R,{to:"/student",className:f.linkSienna,children:e("site:enrollAlreadyEnrolledLink")})})]})]})})}export{yt 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.