{"version":3,"file":"after_push_through_to_match_flow-SNpWDplm.js","sources":["../../app/javascript/components/sign_up/after_push_through_to_match_flow.jsx","../../app/javascript/entrypoints/react_rails/sign_up/after_push_through_to_match_flow.tsx"],"sourcesContent":["// Third-party imports.\nimport React from \"react\";\nimport jQuery from \"jquery\";\nimport PropTypes from \"prop-types\";\nimport \"react-phone-number-input/style.css\";\nimport PhoneInput from \"react-phone-number-input\";\n// Our imports.\nimport LegalTermsAgreement from \"../legal_terms_agreement\";\nimport EuCitizenCheckbox from \"./eu_citizen_checkbox\";\nimport ButtonWithSpinner from \"../button_with_spinner\";\nimport { Provider as StyletronProvider } from \"styletron-react\";\nimport { Client as Styletron } from \"styletron-engine-atomic\";\nimport { BaseProvider } from \"baseui\";\nimport { ThemeProvider } from \"styled-components\";\nimport { ThemeProvider as MaterialThemeProvider, THEME_ID } from \"@mui/material/styles\";\nimport { LocalizationProvider } from \"@mui/x-date-pickers/LocalizationProvider\";\nimport { AdapterDateFns } from \"@mui/x-date-pickers/AdapterDateFnsV3\";\nimport materialTheme from \"../styling/material_theme\";\nimport deprecatedTheme from \"../styling/deprecated_theme\";\nimport baseuiTheme from \"../styling/baseui_theme\";\nimport \"./after_push_through_to_match_flow.css\";\nimport ProgramSchoolLogoBlock from \"../shared/login_and_sign_up/program_school_logo_block\";\n\nconst engine = new Styletron();\nclass AfterPushThroughToMatchFlow extends React.Component {\n static propTypes = {\n // The jwt token containing the user's email address.\n token: PropTypes.string.isRequired,\n programData: PropTypes.object.isRequired,\n\n createZendeskTicketPath: PropTypes.string.isRequired,\n signUpAndRegisterPath: PropTypes.string.isRequired,\n csrfToken: PropTypes.string.isRequired,\n };\n\n constructor(props) {\n super(props);\n this.state = {\n // The user's phone number in E164 format.\n phone: \"\",\n\n isEUCitizen: false,\n acceptedLegalTerms: false,\n\n // We may display errors to the user if information they provided is invalid.\n errors: [],\n\n // Whether a request to the backend is in-flight.\n processingSubmission: false,\n };\n }\n\n render() {\n return (\n \n \n \n \n \n
\n \n
\n
\n {this.renderFormElement()}\n {this.renderFormErrorsElement()}\n\n
\n What's the point of this?\n {this.renderWhatIsThePointOfThisText()}\n
\n
\n
\n
\n
\n
\n
\n );\n }\n\n renderFormElement() {\n // Default to US as that's where most of our users are based.\n const defaultCountryCode = \"US\";\n\n // We aren't using the submit capabilities of the
element -- that is handled by Ajax.\n return (\n \n \n \n
\n \n this.setState({ acceptedLegalTerms: agreementStatus })\n }\n />\n this.onFormDataChanged(\"isEUCitizen\", event.target.checked)}\n />\n
\n
\n
\n \n
\n
\n );\n }\n\n allowSubmit() {\n return this.state.acceptedLegalTerms;\n }\n\n onFormDataChanged(key, newValue) {\n // Copied from SignUpFlow.\n\n // Whenever form data changes, we want to reset the errors attribute as they may no longer be\n // relevant. (There might still be errors, of course, but we want to be optimistic. We'll\n // discover them again when the user presses submit.)\n const update = { errors: [] };\n update[key] = newValue;\n\n this.setState(update);\n }\n\n renderFormErrorsElement() {\n if (this.state.errors.length === 0) {\n return null;\n }\n\n const errorItems = this.state.errors.map((error, i) => (\n
\n {error}\n
\n ));\n\n return
{errorItems}
;\n }\n\n onSubmitForm = async (event) => {\n event.preventDefault();\n\n this.setState({ processingSubmission: true });\n try {\n await jQuery.post({\n url: this.props.signUpAndRegisterPath,\n headers: { \"X-CSRF-Token\": this.props.csrfToken },\n data: {\n program_id: this.props.programData.id,\n token: this.props.token,\n phone: this.state.phone,\n is_eu_citizen: this.state.isEUCitizen,\n has_accepted_privacy_policy: this.state.acceptedLegalTerms,\n },\n });\n\n // Move the user along to the rest of the webapp.\n window.location.reload();\n } catch (response) {\n // Display the error in the form.\n if (response.responseJSON) {\n this.setState({ errors: response.responseJSON.errors });\n } else {\n this.setState({\n errors: [`Error: HTTP ${response.status}. Please try again or refresh the page.`],\n });\n }\n return;\n } finally {\n this.setState({ processingSubmission: false });\n }\n };\n\n renderWhatIsThePointOfThisText() {\n return (\n

\n Your phone number will be shared with your mentor when you are matched (and in exchange, you\n will receive theirs). We will also use it to check in with you and make sure everything is\n going ok in the program.\n

\n );\n }\n}\n\nexport default AfterPushThroughToMatchFlow;\n","import React from \"react\";\nimport { createRoot } from \"react-dom/client\";\nimport AfterPushThroughToMatchFlow from \"../../../components/sign_up/after_push_through_to_match_flow\";\n\nfunction init() {\n const componentElements = document.querySelectorAll(\n '[data-react-class=\"sign_up/after_push_through_to_match_flow\"]',\n );\n componentElements.forEach((rootElement) => {\n const classString = rootElement.getAttribute(\"data-react-class\");\n const propsJson = rootElement.getAttribute(\"data-react-props\");\n const props = rootElement && JSON.parse(propsJson ?? \"\");\n if (classString) {\n const root = createRoot(rootElement);\n root.render();\n }\n });\n}\n\nif (document.readyState === \"complete\" || document.readyState === \"interactive\") {\n // document has at least been parsed\n init();\n} else {\n document.addEventListener(\"DOMContentLoaded\", () => {\n init();\n });\n}\n"],"names":["engine","Styletron","AfterPushThroughToMatchFlow","React","props","__publicField","event","jQuery","response","jsx","StyletronProvider","BaseProvider","baseuiTheme","ThemeProvider","deprecatedTheme","MaterialThemeProvider","THEME_ID","materialTheme","jsxs","LocalizationProvider","AdapterDateFns","ProgramSchoolLogoBlock","PhoneInput","value","LegalTermsAgreement","agreementStatus","EuCitizenCheckbox","ButtonWithSpinner","key","newValue","update","errorItems","error","i","PropTypes","init","rootElement","classString","propsJson","createRoot"],"mappings":"ooCAuBA,MAAMA,EAAS,IAAIC,EACnB,MAAMC,UAAoCC,EAAM,SAAU,CAWxD,YAAYC,EAAO,CACjB,MAAMA,CAAK,EA8HbC,EAAA,oBAAe,MAAOC,GAAU,CAC9BA,EAAM,eAAe,EAErB,KAAK,SAAS,CAAE,qBAAsB,EAAA,CAAM,EACxC,GAAA,CACF,MAAMC,EAAO,KAAK,CAChB,IAAK,KAAK,MAAM,sBAChB,QAAS,CAAE,eAAgB,KAAK,MAAM,SAAU,EAChD,KAAM,CACJ,WAAY,KAAK,MAAM,YAAY,GACnC,MAAO,KAAK,MAAM,MAClB,MAAO,KAAK,MAAM,MAClB,cAAe,KAAK,M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