PageSourceSearch

https://app.century.tech/assets/Registration-BMrythS3.js

js century.tech collected 2026-09-24 09:17:13 UTC 17,374 bytes, 1 lines download raw bytes

1import{j as e,c as ee,r as c,g as re,G as se,p as ae,E as te,l as ie,u as ne,a as $,m as oe,M as ce,b as de,d as W,B as J,H as le,e as i,f as D,C as U,h as ge,i as ue,q as pe,k as he,n as me,L as fe,S as xe}from"./index-D83OPrL5.js";import{u as we,T as K}from"./useLogin-gOhnuXe5.js";import{u as je,P as M,a as be,b as ye}from"./partners-BU0D2mtP.js";import{S as v,F as ve,a as I,b as Ce,L as f,I as j,c as E,C as F,d as _,w as Ee,u as ke,e as B,f as Se}from"./ErrorBoundary-DV-Wud-8.js";import{B as H,P as Y}from"./B2cPartnerLogo-XIgEGxeV.js";(function(){try{var r=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{};r.SENTRY_RELEASE={id:"[email protected]"};var s=new r.Error().stack;s&&(r._sentryDebugIds=r._sentryDebugIds||{},r._sentryDebugIds[s]="f2609b23-8972-4556-94c2-cc7446834162",r._sentryDebugIdIdentifier="sentry-dbid-f2609b23-8972-4556-94c2-cc7446834162")}catch{}})();const Me=({children:r,classNameExt:s,qa:d})=>e.jsx("div",{className:ee("cds-partner-form-header",s&&s),"data-testid":d,children:r}),O=()=>!!document.querySelector('script[src*="/recaptcha/"]:not([src*="gstatic"])'),Pe=()=>".grecaptcha-badge{display: none !important;}",Re=({host:r="google.com",isEnterprise:s=!1,render:d,hl:g,badge:h})=>{const u=new URLSearchParams({...g&&{hl:g},...h&&{badge:h},render:d});return`https://www.${r}/recaptcha/${s?"enterprise.js":"api.js"}?${u}`},qe=()=>{const r=document.createElement("style");r.innerHTML=Pe(),document.body.appendChild(r)},Ne=({onload:r,appendTo:s="head",isEnterprise:d=!1,host:g,render:h,badge:u,hl:w,...x})=>{const n=Re({host:g,isEnterprise:d,render:h,hl:w,badge:u}),a=document.createElement("script");Object.entries(x).forEach(([p,t])=>{a.setAttribute(p,t?.toString()??"")}),a.src=n,a.onload=r,document[s].appendChild(a)},Ge=()=>{const r=document.querySelector(".grecaptcha-badge");r&&r.parentNode&&document.body.removeChild(r.parentNode)},Q=r=>{const s=document.getElementById(r);if(s)for(;s.lastChild;)s.lastChild.remove()},Te="https://www.gstatic.com/recaptcha/releases",Ae=()=>{window.___grecaptcha_cfg=void 0;const r=document.querySelector('script[src*="/recaptcha/"]:not([src*="gstatic"])');r&&r.remove();const s=document.querySelector(`script[src^="${Te}"]`);s&&s.remove()},N="GoogleReCaptcha Context has not yet been implemented, if you are using useGoogleReCaptcha hook, make sure the hook is called inside component wrapped by GoogleRecaptchaProvider",X=c.createContext({instance:void 0,siteKey:"",language:"",isLoading:!0,executeV3:()=>{throw new Error(N)}
1,executeV2Invisible:()=>{throw new Error(N)},reset:()=>{throw new Error(N)},getResponse:()=>{throw new Error(N)},render:()=>{throw new Error(N)}}),Le=()=>c.useContext(X),Ie="google-recaptcha-checkbox-container",Fe=({id:r=Ie,onChange:s,action:d,onError:g,onExpired:h,size:u,theme:w,language:x,...n})=>{const a=Le(),p=c.useRef(null),t=w??a.theme,b=x??a.language;return c.useEffect(()=>{if(!a.render)return;const l=document.createElement("div"),S={sitekey:n.siteKey??a.siteKey,callback:s,...b&&{hl:b},...d&&{action:d},"expired-callback":h,"error-callback":g,size:u,theme:t};return a.render(l,S),p.current&&p.current.appendChild(l),()=>{Q(r)}},[a.siteKey,a.render,b,s,r,u,d,t]),e.jsx("div",{ref:p,id:r,...n})},_e="onGoogleReCaptchaLoad",Be="google-recaptcha-container",De=({type:r,siteKey:s,language:d,scriptProps:g,isEnterprise:h=!1,host:u,theme:w="light",children:x,explicit:n,onLoad:a,onError:p})=>{const[t,b]=c.useState(!0),[l,S]=c.useState();c.useEffect(()=>{const C=g?.id??`google-recaptcha-${r}-script`,G=O(),q=()=>{b(!0);const m=h?window.grecaptcha?.enterprise:window.grecaptcha;if(!m){p&&p();return}if(n||m.ready(async()=>{S(m),a&&await a(m),b(!1)}),n){const T={size:r==="v3"||r==="v2-invisible"?"invisible":"normal",...(r==="v3"||r==="v2-invisible")&&{badge:"bottomright"},sitekey:s,theme:w,...typeof n=="object"&&{...n,"expired-callback":n.expiredCallback,"error-callback":n.errorCallback}};G||typeof n=="object"&&(r==="v3"||r==="v2-invisible")&&n?.badge==="hidden"&&qe(),m.ready(async()=>{typeof n=="object"&&n.container&&m.render(n.container,T,!!n.inherit),S(m),a&&await a(m),b(!1)})}};return window[_e]=q,G?q():Ne({isEnterprise:h,host:u,...(r==="v3"||r==="v2-invisible")&&typeof n=="object"&&n?.badge&&{badge:n?.badge==="hidden"?"bottomright":n?.badge},...d&&{hl:d},render:n||r==="v2-checkbox"?"explicit":s,...g,onload:q,id:C}),()=>{O()&&Ae(),typeof n=="object"&&(r==="v3"||r==="v2-invisible")&&!n?.container&&n?.badge?Q(Be):Ge()}},[h,d,u,s,r]);const A=C=>{if(!l?.execute)throw new Error("Google ReCaptcha has not been loaded");return l.execute(s,{action:C})},P=C=>{if(!l?.execute)throw new Error("Google ReCaptcha has not been loaded");return l.execute(C)},R=c.useMemo(()=>({instance:l,siteKey:s,isLoading:t,theme:w,executeV2Invisible:P,executeV3:A,reset:l?.reset,getResponse:l?.getResponse,render:l?.render,...d&&{language:d}}),[l,s,t,d]);return e.jsx(X.Provider,{value:R,children:x})};async function Ue(){const r=re("/region");return await se({url:r})}async function Ke(){try{return await Ue()}catch(r){throw ae(r,new te("localised-errors-b2c-get-region-error",ie["localised-errors-b2c-get-region-error"]))}}const k={"email-format-invalid":'"{emailAddress}" is not a valid email.',"error-password-too-short":`Passwords must be at least ${D} characters long`,"general-consent-required":"You must agree to our terms and conditions, private policy, and safeguarding policy","invalid-recaptcha":"Please confirm you're not a robot.","class-code-signup-error-password-dont-match":"Passwords don't match","class-code-signup-error-email-dont-match":"Emails don't match","class-code-signup-error-first-name":"Please fill in your first name","class-code-signup-error-last-name":"Please fill in your last name","class-code-signup-error-email":"Please fill in your email","class-code-signup-error-confirm-email":"Please confirm your email","class-code-signup-error-password":"Please choose a password","class-code-signup-error-confirm-password":"Please confirm your password"},z={consentGiven:!1,gdprAccepted:!1,safeguardingAccepted:!1,marketingEmailsAllowed:!1,email:"",emailConfirm:"",firstName:"",lastName:"",password:"",passwordConfirm:"",recaptcha:""};function He(r){const s={};return r.firstName||(s.firstName="class-code-signup-error-first-name"),r.lastName||(s.lastName="class-code-signup-error-last-name"),r.email.length||(s.email="class-code-signup-error-email"),r.email.length&&!r.email.match(/^[\w-+.]+@([\w-]+\.)+[\w-]+$/)&&(s.email="email-format-invalid"),r.emailConfirm.length||(s.emailConfirm="class-code-signup-error-confirm-email"),r.emailConfirm.length&&r.email!==r.emailConfirm&&(s.emailConfirm="class-code-signup-error-email-dont-match"),r.password.length||(s.password="class-code-signup-error-password"),r.password.length&&r.password.length<D&&(s.password="error-password-too-short"),r.passwordConfirm.length||(s.passwordConfirm="class-code-signup-error-confirm-password"),r.passwordConfirm.length&&r.password!==r.passwordConfirm&&(s.passwordConfirm="class-code-signup-error-password-dont-match"),r.consentGiven||(s.consentGiven="general-consent-required"),r.recaptcha||(s.recaptcha="invalid-recaptcha"),s}const Ye=()=>{const{auth:r}=ne(),{login:s}=we(),[d,g]=c.useState(null),h=$(),[u,w]=c.useState(!1),[x,n]=c.useState(!1),[a,p]=c.useState(z),[t,b]=c.useState({}),[l,S]=c.useState(z),[A,P]=c.useState(!1),R=c.useMemo(()=>`form-register-guardian-${Date.now()}-`,[]),[C,G]=c.useState(Date.now()),q=je();c.useEffect(()=>{r?.accessTokenData&&(oe.track(ce.B2CGuardianCreated),h("/"))},[r,h]);const m=o=>{p(y=>({...y,[o.target.name.replace(R,"")]:o.target.value}))},T=c.useCallback(async o=>{P(!0);let y;try{y=await de(o)}catch(L){g(L),G(Date.now()),P(!1);return}W.push({event:J.ACCOUNT_CREATED,user_id:y._id});try{await s(o.email,o.password)}catch(L){g(L)}P(!1)},[s]),Z=c.useCallback(o=>{S(o);const y=He(o);b(y),Object.keys(y).length===0&&T(o)},[T]),V=c.useMemo(()=>e.jsx(Fe,{"data-testid":"registration-recaptcha-area",onChange:o=>{p(y=>({...y,recaptcha:o}))}},C),[C]);return e.jsxs(e.Fragment,{children:[e.jsxs(v,{qa:"registration-form",children:[q?e.jsxs(v.Header,{children:[e.jsxs(Me,{qa:"registration-form-partnerships",children:[e.jsx(H,{qa:"registration-form-partnerships--bond",type:Y.BOND}),e.jsx(H,{qa:"registration-form-partnership--iseb",type:Y.ISEB})]}),e.jsx(le.SectionTitle,{qa:"registration-form-subtitle",children:e.jsx(i,{id:"registration-form-subtitle",defaultMessage:"Set up your account to create your learner profiles and get started with your free trial."})})]}):e.jsxs(v.Header,{children:[e.jsx("h3",{"data-testid":"registration-form-title",children:e.jsx(i,{id:"registration-form-title",defaultMessage:"Create Your Parent or Guardian Account"})}),e.jsx(K.Label,{qa:"registration-form-subtitle",children:e.jsx(i,{id:"registration-form-subtitle",defaultMessage:"Set up your account to create your learner profiles and get started with your free trial."})})]}),e.jsx(v.Form,{children:e.jsxs(ve,{onSubmit:o=>o.preventDefault(),children:[e.jsxs(I,{noGap:Ce.VERTICAL,children:[e.jsx(I.Col,{xs:12,sm:6,children:e.jsxs(f,{isRequired:!0,children:[e.jsx(f.Text,{children:e.jsx(i,{id:"registration-firstName",defaultMessage:"First name"})}
1),e.jsx(j,{type:"text",onChange:m,value:a.firstName,name:"firstName",qa:"registration-firstName-input"}),"firstName"in t&&a.firstName===l.firstName&&e.jsx(E,{qa:"registration-firstName-error",children:e.jsx(i,{id:`${t.firstName}`,defaultMessage:k[t.firstName]})})]})}),e.jsx(I.Col,{xs:12,sm:6,children:e.jsxs(f,{isRequired:!0,children:[e.jsx(f.Text,{children:e.jsx(i,{id:"registration-lastName",defaultMessage:"Last name"})}),e.jsx(j,{type:"text",onChange:m,value:a.lastName,name:"lastName",qa:"registration-lastName-input"}),"lastName"in t&&a.lastName===l.lastName&&e.jsx(E,{qa:"registration-lastName-error",children:e.jsx(i,{id:`${t.lastName}`,defaultMessage:k[t.lastName]})})]})})]}),e.jsxs(f,{isRequired:!0,children:[e.jsx(f.Text,{children:e.jsx(i,{id:"registration-email",defaultMessage:"Your email address"})}),e.jsx(j,{type:"email",onChange:m,value:a.email,name:"email",qa:"registration-email-input"}),"email"in t&&a.email===l.email&&e.jsx(E,{qa:"registration-email-error",children:e.jsx(i,{id:t.email,defaultMessage:k[t.email],values:{emailAddress:a.email}})})]}),e.jsxs(f,{isRequired:!0,children:[e.jsx(f.Text,{children:e.jsx(i,{id:"class-code-signup-label-confirm-email",defaultMessage:"Confirm email"})}),e.jsx(j,{type:"email",onChange:m,value:a.emailConfirm,name:"emailConfirm",qa:"registration-email-confirm-input"}),"emailConfirm"in t&&a.emailConfirm===l.emailConfirm&&e.jsx(E,{qa:"registration-email-confirm-error",children:e.jsx(i,{id:t.emailConfirm,defaultMessage:k[t.emailConfirm]})})]}),e.jsxs(f,{isRequired:!0,children:[e.jsxs(M,{children:[e.jsx(f.Text,{children:e.jsx(i,{id:"registration-password",defaultMessage:"Password"})}),e.jsx(M.Control,{children:e.jsx(U,{qa:`registration-${u?"hide":"show"}-password-button`,onClick:()=>w(o=>!o),type:"button",children:e.jsx("span",{children:e.jsx(i,{id:`${u?"hide":"show"}-label`,defaultMessage:`${u?"Hide":"Show"}`})})})})]}),e.jsx(j,{autoComplete:"off",type:u?"text":"password",onChange:m,value:a.password,name:`${R}password`,qa:"registration-password-input"}),"password"in t&&a.password===l.password&&e.jsx(E,{qa:"registration-password-error",children:e.jsx(i,{id:`${t.password}`,defaultMessage:k[t.password],values:{eminLength:D}})}),t.password?t.password&&a.password!==l.password?e.jsx(M.Status,{isValid:a.password.length>=8,children:e.jsx(i,{id:"registration-password-length-indicator",defaultMessage:"Password contains 8 or more characters"})}):null:a.password.length>0&&e.jsx(M.Status,{isValid:a.password.length>=8,children:e.jsx(i,{id:"registration-password-length-indicator",defaultMessage:"Password contains 8 or more characters"})})]}),e.jsxs(f,{isRequired:!0,children:[e.jsxs(M,{children:[e.jsx(f.Text,{children:e.jsx(i,{id:"class-code-signup-label-confirm-password",defaultMessage:"Confirm password"})}),e.jsx(M.Control,{children:e.jsx(U,{qa:`registration-${x?"hide":"show"}-password-confirm-button`,onClick:()=>n(o=>!o),type:"button",children:e.jsx("span",{children:e.jsx(i,{id:`${x?"hide":"show"}-label`,defaultMessage:`${u?"Hide":"Show"}`})})})})]}),e.jsx(j,{autoComplete:"off",type:x?"text":"password",onChange:m,value:a.passwordConfirm,name:`${R}passwordConfirm`,qa:"registration-password-confirm-input"}),"passwordConfirm"in t&&a.passwordConfirm===l.passwordConfirm&&e.jsx(E,{qa:"registration-password-confirm-error",children:e.jsx(i,{id:t.passwordConfirm,defaultMessage:k[t.passwordConfirm]})})]}),e.jsxs(f,{isRequired:!0,children:[e.jsx(j,{qa:"registration-general-consent-checkbox",type:"checkbox",name:"consentGiven",checked:a.consentGiven,onChange:()=>p(o=>({...o,consentGiven:!a.consentGiven,gdprAccepted:!a.gdprAccepted,safeguardingAccepted:!a.safeguardingAccepted})),children:e.jsx(j.Text,{children:e.jsx("span",{children:e.jsx(i,{id:"registration-general-consent",defaultMessage:"I have read and agree to all CENTURY Tech's <a>Terms & Conditions</a>, <b>Privacy & GDPR Policy</b>, and <c>Safeguarding Policy Statement</c>.",values:{termsAndConditions:e.jsx(i,{id:"registration-terms-and-conditions",defaultMessage:"Terms & Conditions"}),a:o=>e.jsx(F,{variant:_.PRIMARY,children:e.jsx("a",{href:"https://www.century.tech/subscription-terms-parent/","data-testid":"terms-and-conditions-link",target:"_blank",rel:"noreferrer",children:o})}),gdpr:e.jsx(i,{id:"registration-gdpr-policy",defaultMessage:"Privacy & GDPR's Policy"}),b:o=>e.jsx(F,{variant:_.PRIMARY,children:e.jsx("a",{href:"https://www.century.tech/privacy-policy/","data-testid":"privacy-and-gdpr-link",target:"_blank",rel:"noreferrer",children:o})}),safeGuarding:e.jsx(i,{id:"registration-safeguarding-statement",defaultMessage:"Safeguarding Policy Statement"}),c:o=>e.jsx(F,{variant:_.PRIMARY,children:e.jsx("a",{href:"https://www.century.tech/wp-content/uploads/2023/05/CENTURY-Tech-Safeguarding-Policy-Statement-2023.pdf","data-testid":"safeguarding-link",target:"_blank",rel:"noreferrer",children:o})})}})})})}),"consentGiven"in t&&a.consentGiven===l.consentGiven&&e.jsx(E,{qa:"registration-general-consent-error",children:e.jsx(i,{id:`${t.consentGiven}`,defaultMessage:k[t.consentGiven]})})]}),e.jsx(f,{children:e.jsx(j,{qa:"registration-marketing-checkbox",type:"checkbox",name:"marketingEmailsAllowed",checked:a.marketingEmailsAllowed,onChange:()=>p(o=>({...o,marketingEmailsAllowed:!a.marketingEmailsAllowed})),children:e.jsx(j.Text,{children:e.jsx(i,{id:"registration-marketing-checkbox-label",defaultMessage:"Tick here to receive newsletters, marketing offers and other news."})})})}),e.jsx("div",{id:"recaptcha-recaptcha",style:{display:"flex",justifyContent:"center",margin:18}
1,children:V}),"recaptcha"in t&&a.recaptcha===l.recaptcha&&e.jsx(E,{qa:"registration-recaptcha-error",children:e.jsx(i,{id:`${t.recaptcha}`,defaultMessage:k[t.recaptcha]})}),d&&e.jsx("div",{className:"input-error",children:e.jsx("div",{className:"input-error-message","data-testid":"registration-form-error",children:e.jsx(i,{id:d.code,defaultMessage:d.message,values:d.values})})}),e.jsx(ge,{qa:"registration-button",disabled:A,type:"button",variant:"primary",size:"large",width:"full",onClick:()=>Z(a),children:e.jsx(i,{id:"registration-sign-up-button-label",defaultMessage:"Sign Up"})})]})})]}),e.jsx("div",{style:{display:"flex",justifyContent:"center"},children:e.jsx(K.Placeholder,{qa:"registration-return-to-login",children:e.jsx(i,{id:"registration-back-to-login-page",defaultMessage:"Already have an account? <a>Log in</a>",values:{login:e.jsx(i,{id:"registration-login",defaultMessage:"Log in"}),a:o=>e.jsx("a",{href:"/login",style:{color:"white",textDecoration:"underline"},children:o})}})})})]})},Oe=r=>{const s=$(),d=ue(),[g,h]=c.useState("loading");be(r.branding);const{plan:u}=pe.parse(d.search);ye(u),ke("b2c-create-guardian");const w=he();c.useEffect(()=>{w()},[w]);const x=c.useCallback(async()=>{try{const t=await Ke();h(t.status),t.status==="forward"&&s(t.redirect)}catch{h("error")}},[s]);c.useEffect(()=>{x()},[x]);const[n,a]=c.useState(""),p=c.useCallback(()=>{me().then(({config:t})=>a(t?.recaptchaSiteKey||"")).catch(()=>setTimeout(p,1e3))},[]);return c.useEffect(()=>{p()},[p]),c.useEffect(()=>{W.push({event:J.REGISTRATION_FORM})},[]),g==="loading"||g==="forward"?e.jsx(fe,{type:"fullpage"}):g==="block"?e.jsxs(v,{children:[e.jsx(v.Header,{children:e.jsx("h3",{children:e.jsx(i,{defaultMessage:"Currently Unavailable",id:"b2c-registration-geo-blocked-header"})})}),e.jsx(v.Body,{qa:"b2c-registration-geo-blocked",children:e.jsx("div",{children:e.jsx(i,{defaultMessage:"CENTURY is not currently available in your area. Please check back soon!",id:"b2c-registration-geo-blocked-message"})})})]}):g==="error"?e.jsx(v,{children:e.jsx(v.Body,{children:e.jsx("div",{children:e.jsx(i,{defaultMessage:"Something went wrong while setting up the registration form.",id:"b2c-registration-geo-error"})})})}):n?e.jsx(De,{type:"v2-checkbox",host:"recaptcha.net",siteKey:n,children:e.jsx(Ye,{})}):e.jsx(xe,{type:"widget"})},ze=r=>e.jsxs(B,{children:[e.jsx(B.Body,{children:e.jsx(Oe,{...r})}),e.jsx(B.Footer,{children:e.jsx(Se,{poweredByMsg:e.jsx(i,{id:"login-footer-powered-by",defaultMessage:"Powered by"})})})]}),Ze=Ee(ze);export{Oe as Registration,ze as RegistrationWrapper,Ze 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.