@openedx/frontend-app-authn 1.0.0-alpha.5 → 1.0.0-alpha.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Main.d.ts +3 -0
- package/dist/Main.js +10 -0
- package/dist/Main.js.map +1 -0
- package/dist/app.d.ts +3 -0
- package/dist/app.js +41 -0
- package/dist/app.js.map +1 -0
- package/{src → dist}/app.scss +1 -1
- package/dist/base-container/components/default-layout/LargeLayout.d.ts +2 -0
- package/dist/base-container/components/default-layout/LargeLayout.js +11 -0
- package/dist/base-container/components/default-layout/LargeLayout.js.map +1 -0
- package/dist/base-container/components/default-layout/MediumLayout.d.ts +2 -0
- package/dist/base-container/components/default-layout/MediumLayout.js +11 -0
- package/dist/base-container/components/default-layout/MediumLayout.js.map +1 -0
- package/dist/base-container/components/default-layout/SmallLayout.d.ts +2 -0
- package/dist/base-container/components/default-layout/SmallLayout.js +11 -0
- package/dist/base-container/components/default-layout/SmallLayout.js.map +1 -0
- package/dist/base-container/components/default-layout/index.d.ts +3 -0
- package/{src/base-container/components/default-layout/index.jsx → dist/base-container/components/default-layout/index.js} +1 -0
- package/dist/base-container/components/default-layout/index.js.map +1 -0
- package/dist/base-container/components/default-layout/messages.d.ts +13 -0
- package/dist/base-container/components/default-layout/messages.js +15 -0
- package/dist/base-container/components/default-layout/messages.js.map +1 -0
- package/dist/base-container/components/image-layout/ExtraSmallLayout.d.ts +2 -0
- package/dist/base-container/components/image-layout/ExtraSmallLayout.js +10 -0
- package/dist/base-container/components/image-layout/ExtraSmallLayout.js.map +1 -0
- package/dist/base-container/components/image-layout/LargeLayout.d.ts +2 -0
- package/dist/base-container/components/image-layout/LargeLayout.js +11 -0
- package/dist/base-container/components/image-layout/LargeLayout.js.map +1 -0
- package/dist/base-container/components/image-layout/MediumLayout.d.ts +2 -0
- package/dist/base-container/components/image-layout/MediumLayout.js +11 -0
- package/dist/base-container/components/image-layout/MediumLayout.js.map +1 -0
- package/dist/base-container/components/image-layout/SmallLayout.d.ts +2 -0
- package/dist/base-container/components/image-layout/SmallLayout.js +10 -0
- package/dist/base-container/components/image-layout/SmallLayout.js.map +1 -0
- package/dist/base-container/components/image-layout/index.d.ts +4 -0
- package/{src/base-container/components/image-layout/index.jsx → dist/base-container/components/image-layout/index.js} +1 -0
- package/dist/base-container/components/image-layout/index.js.map +1 -0
- package/dist/base-container/components/image-layout/messages.d.ts +13 -0
- package/dist/base-container/components/image-layout/messages.js +15 -0
- package/dist/base-container/components/image-layout/messages.js.map +1 -0
- package/dist/base-container/components/welcome-page-layout/LargeLayout.d.ts +10 -0
- package/dist/base-container/components/welcome-page-layout/LargeLayout.js +14 -0
- package/dist/base-container/components/welcome-page-layout/LargeLayout.js.map +1 -0
- package/dist/base-container/components/welcome-page-layout/MediumLayout.d.ts +10 -0
- package/dist/base-container/components/welcome-page-layout/MediumLayout.js +14 -0
- package/dist/base-container/components/welcome-page-layout/MediumLayout.js.map +1 -0
- package/dist/base-container/components/welcome-page-layout/SmallLayout.d.ts +10 -0
- package/dist/base-container/components/welcome-page-layout/SmallLayout.js +14 -0
- package/dist/base-container/components/welcome-page-layout/SmallLayout.js.map +1 -0
- package/dist/base-container/components/welcome-page-layout/index.d.ts +3 -0
- package/{src/base-container/components/welcome-page-layout/index.jsx → dist/base-container/components/welcome-page-layout/index.js} +1 -0
- package/dist/base-container/components/welcome-page-layout/index.js.map +1 -0
- package/dist/base-container/components/welcome-page-layout/messages.d.ts +18 -0
- package/dist/base-container/components/welcome-page-layout/messages.js +20 -0
- package/dist/base-container/components/welcome-page-layout/messages.js.map +1 -0
- package/dist/base-container/index.d.ts +20 -0
- package/dist/base-container/index.js +27 -0
- package/dist/base-container/index.js.map +1 -0
- package/dist/common-components/EmbeddedRegistrationRoute.d.ts +14 -0
- package/dist/common-components/EmbeddedRegistrationRoute.js +22 -0
- package/dist/common-components/EmbeddedRegistrationRoute.js.map +1 -0
- package/dist/common-components/EnterpriseSSO.d.ts +29 -0
- package/dist/common-components/EnterpriseSSO.js +58 -0
- package/dist/common-components/EnterpriseSSO.js.map +1 -0
- package/dist/common-components/FormGroup.d.ts +60 -0
- package/dist/common-components/FormGroup.js +66 -0
- package/dist/common-components/FormGroup.js.map +1 -0
- package/dist/common-components/InstitutionLogistration.d.ts +34 -0
- package/dist/common-components/InstitutionLogistration.js +38 -0
- package/dist/common-components/InstitutionLogistration.js.map +1 -0
- package/dist/common-components/NotFoundPage.d.ts +2 -0
- package/dist/common-components/NotFoundPage.js +5 -0
- package/dist/common-components/NotFoundPage.js.map +1 -0
- package/dist/common-components/PasswordField.d.ts +47 -0
- package/dist/common-components/PasswordField.js +98 -0
- package/dist/common-components/PasswordField.js.map +1 -0
- package/dist/common-components/RedirectLogistration.d.ts +39 -0
- package/dist/common-components/RedirectLogistration.js +72 -0
- package/dist/common-components/RedirectLogistration.js.map +1 -0
- package/dist/common-components/RegisterFaIcons.d.ts +1 -0
- package/dist/common-components/RegisterFaIcons.js +6 -0
- package/dist/common-components/RegisterFaIcons.js.map +1 -0
- package/dist/common-components/SocialAuthProviders.d.ts +23 -0
- package/dist/common-components/SocialAuthProviders.js +43 -0
- package/dist/common-components/SocialAuthProviders.js.map +1 -0
- package/dist/common-components/ThirdPartyAuth.d.ts +42 -0
- package/dist/common-components/ThirdPartyAuth.js +57 -0
- package/dist/common-components/ThirdPartyAuth.js.map +1 -0
- package/dist/common-components/ThirdPartyAuthAlert.d.ts +15 -0
- package/dist/common-components/ThirdPartyAuthAlert.js +32 -0
- package/dist/common-components/ThirdPartyAuthAlert.js.map +1 -0
- package/dist/common-components/UnAuthOnlyRoute.d.ts +14 -0
- package/dist/common-components/UnAuthOnlyRoute.js +32 -0
- package/dist/common-components/UnAuthOnlyRoute.js.map +1 -0
- package/dist/common-components/components/ThirdPartyAuthContext.d.ts +31 -0
- package/dist/common-components/components/ThirdPartyAuthContext.js +84 -0
- package/dist/common-components/components/ThirdPartyAuthContext.js.map +1 -0
- package/dist/common-components/data/api.d.ts +6 -0
- package/dist/common-components/data/api.js +26 -0
- package/dist/common-components/data/api.js.map +1 -0
- package/dist/common-components/data/apiHook.d.ts +9 -0
- package/dist/common-components/data/apiHook.js +14 -0
- package/dist/common-components/data/apiHook.js.map +1 -0
- package/dist/common-components/data/queryKeys.d.ts +4 -0
- package/dist/common-components/data/queryKeys.js +6 -0
- package/dist/common-components/data/queryKeys.js.map +1 -0
- package/dist/common-components/index.d.ts +10 -0
- package/{src/common-components/index.jsx → dist/common-components/index.js} +1 -3
- package/dist/common-components/index.js.map +1 -0
- package/dist/common-components/messages.d.ts +113 -0
- package/dist/common-components/messages.js +126 -0
- package/dist/common-components/messages.js.map +1 -0
- package/dist/constants.d.ts +14 -0
- package/dist/constants.js +17 -0
- package/dist/constants.js.map +1 -0
- package/dist/data/constants.d.ts +16 -0
- package/{src → dist}/data/constants.js +4 -17
- package/dist/data/constants.js.map +1 -0
- package/dist/data/countries.d.ts +26 -0
- package/{src/data/countries.ts → dist/data/countries.js} +6 -9
- package/dist/data/countries.js.map +1 -0
- package/dist/data/oneTrust.d.ts +2 -0
- package/dist/data/oneTrust.js +3 -0
- package/dist/data/oneTrust.js.map +1 -0
- package/dist/data/utils/cookies.d.ts +1 -0
- package/dist/data/utils/cookies.js +12 -0
- package/dist/data/utils/cookies.js.map +1 -0
- package/dist/data/utils/dataUtils.d.ts +12 -0
- package/dist/data/utils/dataUtils.js +81 -0
- package/dist/data/utils/dataUtils.js.map +1 -0
- package/dist/data/utils/index.d.ts +2 -0
- package/dist/data/utils/index.js +3 -0
- package/dist/data/utils/index.js.map +1 -0
- package/dist/data/utils/useMobileResponsive.d.ts +7 -0
- package/dist/data/utils/useMobileResponsive.js +22 -0
- package/dist/data/utils/useMobileResponsive.js.map +1 -0
- package/dist/field-renderer/FieldRenderer.d.ts +34 -0
- package/dist/field-renderer/FieldRenderer.js +70 -0
- package/dist/field-renderer/FieldRenderer.js.map +1 -0
- package/dist/field-renderer/index.d.ts +1 -0
- package/{src/field-renderer/index.jsx → dist/field-renderer/index.js} +1 -0
- package/dist/field-renderer/index.js.map +1 -0
- package/dist/forgot-password/ForgotPasswordAlert.d.ts +16 -0
- package/dist/forgot-password/ForgotPasswordAlert.js +66 -0
- package/dist/forgot-password/ForgotPasswordAlert.js.map +1 -0
- package/dist/forgot-password/ForgotPasswordPage.d.ts +2 -0
- package/dist/forgot-password/ForgotPasswordPage.js +92 -0
- package/dist/forgot-password/ForgotPasswordPage.js.map +1 -0
- package/dist/forgot-password/data/api.d.ts +2 -0
- package/dist/forgot-password/data/api.js +25 -0
- package/dist/forgot-password/data/api.js.map +1 -0
- package/dist/forgot-password/data/apiHook.d.ts +16 -0
- package/dist/forgot-password/data/apiHook.js +26 -0
- package/dist/forgot-password/data/apiHook.js.map +1 -0
- package/dist/forgot-password/index.d.ts +1 -0
- package/dist/forgot-password/index.js +2 -0
- package/dist/forgot-password/index.js.map +1 -0
- package/dist/forgot-password/messages.d.ts +123 -0
- package/dist/forgot-password/messages.js +128 -0
- package/dist/forgot-password/messages.js.map +1 -0
- package/dist/i18n/index.d.ts +25 -0
- package/dist/i18n/index.js +26 -0
- package/dist/i18n/index.js.map +1 -0
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -0
- package/dist/login/AccountActivationMessage.d.ts +14 -0
- package/dist/login/AccountActivationMessage.js +49 -0
- package/dist/login/AccountActivationMessage.js.map +1 -0
- package/dist/login/ChangePasswordPrompt.d.ts +18 -0
- package/dist/login/ChangePasswordPrompt.js +51 -0
- package/dist/login/ChangePasswordPrompt.js.map +1 -0
- package/dist/login/LoginFailure.d.ts +25 -0
- package/dist/login/LoginFailure.js +109 -0
- package/dist/login/LoginFailure.js.map +1 -0
- package/dist/login/LoginPage.d.ts +12 -0
- package/dist/login/LoginPage.js +174 -0
- package/dist/login/LoginPage.js.map +1 -0
- package/dist/login/components/LoginContext.d.ts +21 -0
- package/dist/login/components/LoginContext.js +28 -0
- package/dist/login/components/LoginContext.js.map +1 -0
- package/dist/login/data/api.d.ts +2 -0
- package/dist/login/data/api.js +27 -0
- package/dist/login/data/api.js.map +1 -0
- package/dist/login/data/apiHook.d.ts +13 -0
- package/dist/login/data/apiHook.js +57 -0
- package/dist/login/data/apiHook.js.map +1 -0
- package/dist/login/data/constants.d.ts +17 -0
- package/{src → dist}/login/data/constants.js +4 -4
- package/dist/login/data/constants.js.map +1 -0
- package/dist/login/index.d.ts +1 -0
- package/dist/login/index.js +2 -0
- package/dist/login/index.js.map +1 -0
- package/dist/login/messages.d.ts +198 -0
- package/dist/login/messages.js +210 -0
- package/dist/login/messages.js.map +1 -0
- package/dist/logistration/Logistration.d.ts +5 -0
- package/dist/logistration/Logistration.js +80 -0
- package/dist/logistration/Logistration.js.map +1 -0
- package/dist/progressive-profiling/ProgressiveProfiling.d.ts +2 -0
- package/dist/progressive-profiling/ProgressiveProfiling.js +143 -0
- package/dist/progressive-profiling/ProgressiveProfiling.js.map +1 -0
- package/dist/progressive-profiling/ProgressiveProfilingPageModal.d.ts +13 -0
- package/dist/progressive-profiling/ProgressiveProfilingPageModal.js +31 -0
- package/dist/progressive-profiling/ProgressiveProfilingPageModal.js.map +1 -0
- package/dist/progressive-profiling/components/ProgressiveProfilingContext.d.ts +18 -0
- package/dist/progressive-profiling/components/ProgressiveProfilingContext.js +52 -0
- package/dist/progressive-profiling/components/ProgressiveProfilingContext.js.map +1 -0
- package/dist/progressive-profiling/data/api.d.ts +2 -0
- package/dist/progressive-profiling/data/api.js +22 -0
- package/dist/progressive-profiling/data/api.js.map +1 -0
- package/dist/progressive-profiling/data/apiHook.d.ts +10 -0
- package/dist/progressive-profiling/data/apiHook.js +36 -0
- package/dist/progressive-profiling/data/apiHook.js.map +1 -0
- package/dist/progressive-profiling/index.d.ts +2 -0
- package/{src → dist}/progressive-profiling/index.js +1 -3
- package/dist/progressive-profiling/index.js.map +1 -0
- package/dist/progressive-profiling/messages.d.ts +53 -0
- package/dist/progressive-profiling/messages.js +57 -0
- package/dist/progressive-profiling/messages.js.map +1 -0
- package/dist/register/RegistrationFields/CountryField/CountryField.d.ts +38 -0
- package/dist/register/RegistrationFields/CountryField/CountryField.js +93 -0
- package/dist/register/RegistrationFields/CountryField/CountryField.js.map +1 -0
- package/dist/register/RegistrationFields/CountryField/validator.d.ts +8 -0
- package/dist/register/RegistrationFields/CountryField/validator.js +29 -0
- package/dist/register/RegistrationFields/CountryField/validator.js.map +1 -0
- package/dist/register/RegistrationFields/EmailField/EmailField.d.ts +30 -0
- package/dist/register/RegistrationFields/EmailField/EmailField.js +88 -0
- package/dist/register/RegistrationFields/EmailField/EmailField.js.map +1 -0
- package/dist/register/RegistrationFields/EmailField/constants.d.ts +3 -0
- package/dist/register/RegistrationFields/EmailField/constants.js +130 -0
- package/dist/register/RegistrationFields/EmailField/constants.js.map +1 -0
- package/dist/register/RegistrationFields/EmailField/validator.d.ts +17 -0
- package/dist/register/RegistrationFields/EmailField/validator.js +107 -0
- package/dist/register/RegistrationFields/EmailField/validator.js.map +1 -0
- package/dist/register/RegistrationFields/HonorCodeField/HonorCode.d.ts +21 -0
- package/dist/register/RegistrationFields/HonorCodeField/HonorCode.js +40 -0
- package/dist/register/RegistrationFields/HonorCodeField/HonorCode.js.map +1 -0
- package/dist/register/RegistrationFields/NameField/NameField.d.ts +29 -0
- package/dist/register/RegistrationFields/NameField/NameField.js +59 -0
- package/dist/register/RegistrationFields/NameField/NameField.js.map +1 -0
- package/dist/register/RegistrationFields/NameField/validator.d.ts +6 -0
- package/dist/register/RegistrationFields/NameField/validator.js +23 -0
- package/dist/register/RegistrationFields/NameField/validator.js.map +1 -0
- package/dist/register/RegistrationFields/TermsOfServiceField/TermsOfService.d.ts +16 -0
- package/dist/register/RegistrationFields/TermsOfServiceField/TermsOfService.js +24 -0
- package/dist/register/RegistrationFields/TermsOfServiceField/TermsOfService.js.map +1 -0
- package/dist/register/RegistrationFields/UsernameField/UsernameField.d.ts +31 -0
- package/dist/register/RegistrationFields/UsernameField/UsernameField.js +119 -0
- package/dist/register/RegistrationFields/UsernameField/UsernameField.js.map +1 -0
- package/dist/register/RegistrationFields/UsernameField/validator.d.ts +4 -0
- package/dist/register/RegistrationFields/UsernameField/validator.js +15 -0
- package/dist/register/RegistrationFields/UsernameField/validator.js.map +1 -0
- package/dist/register/RegistrationFields/index.d.ts +6 -0
- package/{src → dist}/register/RegistrationFields/index.js +1 -0
- package/dist/register/RegistrationFields/index.js.map +1 -0
- package/dist/register/RegistrationPage.d.ts +18 -0
- package/dist/register/RegistrationPage.js +259 -0
- package/dist/register/RegistrationPage.js.map +1 -0
- package/dist/register/components/ConfigurableRegistrationForm.d.ts +37 -0
- package/dist/register/components/ConfigurableRegistrationForm.js +145 -0
- package/dist/register/components/ConfigurableRegistrationForm.js.map +1 -0
- package/dist/register/components/RegisterContext.d.ts +8 -0
- package/dist/register/components/RegisterContext.js +167 -0
- package/dist/register/components/RegisterContext.js.map +1 -0
- package/dist/register/components/RegistrationFailure.d.ts +19 -0
- package/dist/register/components/RegistrationFailure.js +60 -0
- package/dist/register/components/RegistrationFailure.js.map +1 -0
- package/dist/register/data/api.d.ts +9 -0
- package/dist/register/data/api.js +45 -0
- package/dist/register/data/api.js.map +1 -0
- package/dist/register/data/apiHook.d.ts +33 -0
- package/dist/register/data/apiHook.js +66 -0
- package/dist/register/data/apiHook.js.map +1 -0
- package/dist/register/data/constants.d.ts +11 -0
- package/{src → dist}/register/data/constants.js +5 -4
- package/dist/register/data/constants.js.map +1 -0
- package/dist/register/data/utils.d.ts +6 -0
- package/dist/register/data/utils.js +128 -0
- package/dist/register/data/utils.js.map +1 -0
- package/dist/register/index.d.ts +1 -0
- package/dist/register/index.js +2 -0
- package/dist/register/index.js.map +1 -0
- package/dist/register/messages.d.ts +203 -0
- package/dist/register/messages.js +215 -0
- package/dist/register/messages.js.map +1 -0
- package/dist/register/types.d.ts +74 -0
- package/dist/register/types.js +2 -0
- package/dist/register/types.js.map +1 -0
- package/dist/reset-password/ResetPasswordFailure.d.ts +15 -0
- package/dist/reset-password/ResetPasswordFailure.js +44 -0
- package/dist/reset-password/ResetPasswordFailure.js.map +1 -0
- package/dist/reset-password/ResetPasswordPage.d.ts +2 -0
- package/dist/reset-password/ResetPasswordPage.js +182 -0
- package/dist/reset-password/ResetPasswordPage.js.map +1 -0
- package/dist/reset-password/ResetPasswordSuccess.d.ts +2 -0
- package/dist/reset-password/ResetPasswordSuccess.js +10 -0
- package/dist/reset-password/ResetPasswordSuccess.js.map +1 -0
- package/dist/reset-password/data/api.d.ts +4 -0
- package/dist/reset-password/data/api.js +57 -0
- package/dist/reset-password/data/api.js.map +1 -0
- package/dist/reset-password/data/apiHook.d.ts +31 -0
- package/dist/reset-password/data/apiHook.js +74 -0
- package/dist/reset-password/data/apiHook.js.map +1 -0
- package/dist/reset-password/data/constants.d.ts +13 -0
- package/{src → dist}/reset-password/data/constants.js +6 -7
- package/dist/reset-password/data/constants.js.map +1 -0
- package/dist/reset-password/index.d.ts +1 -0
- package/dist/reset-password/index.js +2 -0
- package/dist/reset-password/index.js.map +1 -0
- package/dist/reset-password/messages.d.ts +83 -0
- package/dist/reset-password/messages.js +87 -0
- package/dist/reset-password/messages.js.map +1 -0
- package/dist/routes.d.ts +19 -0
- package/dist/routes.js +76 -0
- package/dist/routes.js.map +1 -0
- package/{src → dist}/sass/_registration.scss +8 -10
- package/dist/slots/LoginComponentSlot/index.d.ts +12 -0
- package/dist/slots/LoginComponentSlot/index.js +11 -0
- package/dist/slots/LoginComponentSlot/index.js.map +1 -0
- package/package.json +26 -15
- package/src/Main.tsx +0 -23
- package/src/__mocks__/file.js +0 -1
- package/src/__mocks__/svg.js +0 -1
- package/src/app.ts +0 -43
- package/src/base-container/components/default-layout/DefaultLayout.test.jsx +0 -48
- package/src/base-container/components/default-layout/LargeLayout.jsx +0 -42
- package/src/base-container/components/default-layout/MediumLayout.jsx +0 -49
- package/src/base-container/components/default-layout/SmallLayout.jsx +0 -37
- package/src/base-container/components/default-layout/messages.js +0 -16
- package/src/base-container/components/image-layout/ExtraSmallLayout.jsx +0 -31
- package/src/base-container/components/image-layout/LargeLayout.jsx +0 -32
- package/src/base-container/components/image-layout/MediumLayout.jsx +0 -32
- package/src/base-container/components/image-layout/SmallLayout.jsx +0 -31
- package/src/base-container/components/image-layout/messages.js +0 -16
- package/src/base-container/components/welcome-page-layout/LargeLayout.jsx +0 -46
- package/src/base-container/components/welcome-page-layout/MediumLayout.jsx +0 -49
- package/src/base-container/components/welcome-page-layout/SmallLayout.jsx +0 -38
- package/src/base-container/components/welcome-page-layout/messages.js +0 -21
- package/src/base-container/index.jsx +0 -70
- package/src/base-container/tests/BaseContainer.test.jsx +0 -44
- package/src/common-components/EmbeddedRegistrationRoute.jsx +0 -26
- package/src/common-components/EnterpriseSSO.jsx +0 -110
- package/src/common-components/FormGroup.jsx +0 -106
- package/src/common-components/InstitutionLogistration.jsx +0 -102
- package/src/common-components/NotFoundPage.jsx +0 -15
- package/src/common-components/PasswordField.jsx +0 -175
- package/src/common-components/RedirectLogistration.jsx +0 -94
- package/src/common-components/RegisterFaIcons.jsx +0 -8
- package/src/common-components/SocialAuthProviders.jsx +0 -75
- package/src/common-components/ThirdPartyAuth.jsx +0 -123
- package/src/common-components/ThirdPartyAuthAlert.jsx +0 -49
- package/src/common-components/UnAuthOnlyRoute.jsx +0 -41
- package/src/common-components/data/actions.js +0 -27
- package/src/common-components/data/reducers.js +0 -63
- package/src/common-components/data/sagas.js +0 -32
- package/src/common-components/data/selectors.js +0 -28
- package/src/common-components/data/service.js +0 -23
- package/src/common-components/data/tests/reducer.test.js +0 -82
- package/src/common-components/data/tests/sagas.test.js +0 -71
- package/src/common-components/messages.jsx +0 -127
- package/src/common-components/tests/EmbeddedRegistrationRoute.test.jsx +0 -76
- package/src/common-components/tests/FormField.test.jsx +0 -289
- package/src/common-components/tests/SocialAuthProviders.test.jsx +0 -75
- package/src/common-components/tests/ThirdPartyAuthAlert.test.jsx +0 -39
- package/src/common-components/tests/UnAuthOnlyRoute.test.jsx +0 -73
- package/src/common-components/tests/__snapshots__/SocialAuthProviders.test.jsx.snap +0 -156
- package/src/common-components/tests/__snapshots__/ThirdPartyAuthAlert.test.jsx.snap +0 -53
- package/src/constants.ts +0 -1
- package/src/data/configureStore.js +0 -33
- package/src/data/oneTrust.js +0 -3
- package/src/data/reducers.js +0 -36
- package/src/data/sagas.js +0 -19
- package/src/data/tests/cookies.test.js +0 -42
- package/src/data/tests/dataUtils.test.js +0 -19
- package/src/data/tests/reduxUtils.test.js +0 -14
- package/src/data/utils/cookies.js +0 -12
- package/src/data/utils/dataUtils.js +0 -81
- package/src/data/utils/index.js +0 -11
- package/src/data/utils/reduxUtils.js +0 -34
- package/src/data/utils/useMobileResponsive.js +0 -24
- package/src/field-renderer/FieldRenderer.jsx +0 -156
- package/src/field-renderer/tests/FieldRenderer.test.jsx +0 -201
- package/src/forgot-password/ForgotPasswordAlert.jsx +0 -97
- package/src/forgot-password/ForgotPasswordPage.jsx +0 -193
- package/src/forgot-password/data/actions.js +0 -32
- package/src/forgot-password/data/reducers.js +0 -58
- package/src/forgot-password/data/sagas.js +0 -35
- package/src/forgot-password/data/selectors.js +0 -10
- package/src/forgot-password/data/service.js +0 -21
- package/src/forgot-password/data/tests/reducers.test.js +0 -34
- package/src/forgot-password/data/tests/sagas.test.js +0 -67
- package/src/forgot-password/index.js +0 -5
- package/src/forgot-password/messages.js +0 -128
- package/src/forgot-password/tests/ForgotPasswordPage.test.jsx +0 -269
- package/src/i18n/index.js +0 -25
- package/src/login/AccountActivationMessage.jsx +0 -78
- package/src/login/ChangePasswordPrompt.jsx +0 -91
- package/src/login/LoginFailure.jsx +0 -231
- package/src/login/LoginPage.jsx +0 -368
- package/src/login/data/actions.js +0 -39
- package/src/login/data/reducers.js +0 -76
- package/src/login/data/sagas.js +0 -45
- package/src/login/data/service.js +0 -27
- package/src/login/data/tests/reducers.test.js +0 -155
- package/src/login/data/tests/sagas.test.js +0 -110
- package/src/login/index.js +0 -5
- package/src/login/messages.jsx +0 -211
- package/src/login/tests/AccountActivationMessage.test.jsx +0 -122
- package/src/login/tests/ChangePasswordPrompt.test.jsx +0 -75
- package/src/login/tests/LoginFailure.test.jsx +0 -323
- package/src/login/tests/LoginPage.test.jsx +0 -839
- package/src/logistration/Logistration.jsx +0 -189
- package/src/logistration/Logistration.test.jsx +0 -275
- package/src/progressive-profiling/ProgressiveProfiling.jsx +0 -313
- package/src/progressive-profiling/ProgressiveProfilingPageModal.jsx +0 -56
- package/src/progressive-profiling/data/actions.js +0 -22
- package/src/progressive-profiling/data/reducers.js +0 -38
- package/src/progressive-profiling/data/sagas.js +0 -24
- package/src/progressive-profiling/data/selectors.js +0 -14
- package/src/progressive-profiling/data/service.js +0 -17
- package/src/progressive-profiling/messages.jsx +0 -57
- package/src/progressive-profiling/tests/ProgressiveProfiling.test.jsx +0 -322
- package/src/register/RegistrationFields/CountryField/CountryField.jsx +0 -164
- package/src/register/RegistrationFields/CountryField/CountryField.test.jsx +0 -204
- package/src/register/RegistrationFields/CountryField/validator.js +0 -32
- package/src/register/RegistrationFields/EmailField/EmailField.jsx +0 -140
- package/src/register/RegistrationFields/EmailField/EmailField.test.jsx +0 -236
- package/src/register/RegistrationFields/EmailField/constants.js +0 -131
- package/src/register/RegistrationFields/EmailField/validator.js +0 -126
- package/src/register/RegistrationFields/EmailField/validator.test.js +0 -39
- package/src/register/RegistrationFields/HonorCodeField/HonorCode.jsx +0 -104
- package/src/register/RegistrationFields/HonorCodeField/HonorCode.test.jsx +0 -70
- package/src/register/RegistrationFields/NameField/NameField.jsx +0 -68
- package/src/register/RegistrationFields/NameField/NameField.test.jsx +0 -146
- package/src/register/RegistrationFields/NameField/validator.js +0 -22
- package/src/register/RegistrationFields/TermsOfServiceField/TermsOfService.jsx +0 -58
- package/src/register/RegistrationFields/TermsOfServiceField/TermsOfService.test.jsx +0 -55
- package/src/register/RegistrationFields/UsernameField/UsernameField.jsx +0 -162
- package/src/register/RegistrationFields/UsernameField/UsernameField.test.jsx +0 -319
- package/src/register/RegistrationFields/UsernameField/validator.js +0 -16
- package/src/register/RegistrationPage.jsx +0 -428
- package/src/register/RegistrationPage.test.jsx +0 -854
- package/src/register/components/ConfigurableRegistrationForm.jsx +0 -244
- package/src/register/components/RegistrationFailure.jsx +0 -80
- package/src/register/components/tests/ConfigurableRegistrationForm.test.jsx +0 -401
- package/src/register/components/tests/RegistrationFailure.test.jsx +0 -212
- package/src/register/components/tests/ThirdPartyAuth.test.jsx +0 -439
- package/src/register/data/actions.js +0 -85
- package/src/register/data/reducers.js +0 -140
- package/src/register/data/sagas.js +0 -58
- package/src/register/data/selectors.js +0 -34
- package/src/register/data/service.js +0 -45
- package/src/register/data/tests/reducers.test.js +0 -277
- package/src/register/data/tests/sagas.test.js +0 -239
- package/src/register/data/tests/utils.test.js +0 -98
- package/src/register/data/utils.js +0 -147
- package/src/register/index.js +0 -4
- package/src/register/messages.jsx +0 -206
- package/src/reset-password/ResetPasswordFailure.jsx +0 -55
- package/src/reset-password/ResetPasswordPage.jsx +0 -224
- package/src/reset-password/ResetPasswordSuccess.jsx +0 -19
- package/src/reset-password/data/actions.js +0 -50
- package/src/reset-password/data/reducers.js +0 -44
- package/src/reset-password/data/sagas.js +0 -67
- package/src/reset-password/data/selectors.js +0 -10
- package/src/reset-password/data/service.js +0 -61
- package/src/reset-password/data/tests/sagas.test.js +0 -185
- package/src/reset-password/index.js +0 -5
- package/src/reset-password/messages.js +0 -88
- package/src/reset-password/tests/ResetPasswordPage.test.jsx +0 -241
- package/src/routes.jsx +0 -79
- package/src/setupTest.js +0 -68
- /package/{src → dist}/base-container/components/image-layout/index.scss +0 -0
- /package/{src/index.ts → dist/index.d.ts} +0 -0
- /package/{src → dist}/sass/_base_component.scss +0 -0
- /package/{src → dist}/sass/_forgot_password.scss +0 -0
- /package/{src → dist}/sass/_login_page.scss +0 -0
- /package/{src → dist}/sass/_progressive_profiling_page.scss +0 -0
- /package/{src → dist}/sass/_reset_password.scss +0 -0
- /package/{src → dist}/sass/_style.scss +0 -0
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
// Utility functions
|
|
2
|
+
import { getSiteConfig, getUrlByRouteRole } from '@openedx/frontend-base';
|
|
3
|
+
import * as QueryString from 'query-string';
|
|
4
|
+
import { dashboardRole } from '../../constants';
|
|
5
|
+
import { AUTH_PARAMS } from '../constants';
|
|
6
|
+
export const getTpaProvider = (tpaHintProvider, primaryProviders, secondaryProviders) => {
|
|
7
|
+
let tpaProvider = null;
|
|
8
|
+
let skipHintedLogin = false;
|
|
9
|
+
[...primaryProviders, ...secondaryProviders].forEach((provider) => {
|
|
10
|
+
if (provider.id === tpaHintProvider) {
|
|
11
|
+
tpaProvider = provider;
|
|
12
|
+
if (provider.skipHintedLogin) {
|
|
13
|
+
skipHintedLogin = true;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
return { provider: tpaProvider, skipHintedLogin };
|
|
18
|
+
};
|
|
19
|
+
export const getTpaHint = () => {
|
|
20
|
+
const params = QueryString.parse(window.location.search);
|
|
21
|
+
let tpaHint = null;
|
|
22
|
+
tpaHint = params.tpa_hint;
|
|
23
|
+
if (!tpaHint) {
|
|
24
|
+
const { next } = params;
|
|
25
|
+
if (next) {
|
|
26
|
+
const index = next.indexOf('tpa_hint=');
|
|
27
|
+
if (index !== -1) {
|
|
28
|
+
tpaHint = next.substring(index + 'tpa_hint='.length, next.length);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
return tpaHint;
|
|
33
|
+
};
|
|
34
|
+
export const updatePathWithQueryParams = (path) => {
|
|
35
|
+
let queryParams = window.location.search;
|
|
36
|
+
if (!queryParams) {
|
|
37
|
+
return path;
|
|
38
|
+
}
|
|
39
|
+
if (queryParams.includes('track=pwreset')) {
|
|
40
|
+
queryParams = queryParams.replace('?track=pwreset&', '?').replace('?track=pwreset', '').replace('&track=pwreset', '').replace('?&', '?');
|
|
41
|
+
}
|
|
42
|
+
return `${path}${queryParams}`;
|
|
43
|
+
};
|
|
44
|
+
export const getAllPossibleQueryParams = (locationURl = null) => {
|
|
45
|
+
const urlParams = locationURl ? QueryString.parseUrl(locationURl).query : QueryString.parse(window.location.search);
|
|
46
|
+
const params = {};
|
|
47
|
+
Object.entries(urlParams).forEach(([key, value]) => {
|
|
48
|
+
if (AUTH_PARAMS.includes(key)) {
|
|
49
|
+
params[key] = value;
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
return params;
|
|
53
|
+
};
|
|
54
|
+
export const getActivationStatus = () => {
|
|
55
|
+
const params = QueryString.parse(window.location.search);
|
|
56
|
+
return params.account_activation_status;
|
|
57
|
+
};
|
|
58
|
+
export const isScrollBehaviorSupported = () => 'scrollBehavior' in document.documentElement.style;
|
|
59
|
+
export const windowScrollTo = (options) => {
|
|
60
|
+
if (isScrollBehaviorSupported()) {
|
|
61
|
+
return window.scrollTo(options);
|
|
62
|
+
}
|
|
63
|
+
return window.scrollTo(options.top, options.left);
|
|
64
|
+
};
|
|
65
|
+
/**
|
|
66
|
+
* Normalize a backend redirect URL: if the backend returns the LMS dashboard
|
|
67
|
+
* URL (or nothing), replace it with the role-based dashboard URL so that SPA
|
|
68
|
+
* navigation can be used when the dashboard lives in the same shell.
|
|
69
|
+
*/
|
|
70
|
+
export const normalizeRedirectUrl = (backendUrl) => {
|
|
71
|
+
const dashboardUrl = getUrlByRouteRole(dashboardRole) || '/';
|
|
72
|
+
const lmsDashboardUrl = `${getSiteConfig().lmsBaseUrl}/dashboard`;
|
|
73
|
+
return (!backendUrl || backendUrl.startsWith(lmsDashboardUrl))
|
|
74
|
+
? dashboardUrl
|
|
75
|
+
: backendUrl;
|
|
76
|
+
};
|
|
77
|
+
export const isHostAvailableInQueryParams = () => {
|
|
78
|
+
const queryParams = getAllPossibleQueryParams();
|
|
79
|
+
return 'host' in queryParams;
|
|
80
|
+
};
|
|
81
|
+
//# sourceMappingURL=dataUtils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"data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ent":["// Utility functions\nimport { getSiteConfig, getUrlByRouteRole } from '@openedx/frontend-base';\nimport * as QueryString from 'query-string';\n\nimport { dashboardRole } from '../../constants';\nimport { AUTH_PARAMS } from '../constants';\n\nexport const getTpaProvider = (tpaHintProvider, primaryProviders, secondaryProviders) => {\n let tpaProvider = null;\n let skipHintedLogin = false;\n [...primaryProviders, ...secondaryProviders].forEach((provider) => {\n if (provider.id === tpaHintProvider) {\n tpaProvider = provider;\n if (provider.skipHintedLogin) {\n skipHintedLogin = true;\n }\n }\n });\n return { provider: tpaProvider, skipHintedLogin };\n};\n\nexport const getTpaHint = () => {\n const params = QueryString.parse(window.location.search);\n let tpaHint = null;\n tpaHint = params.tpa_hint;\n if (!tpaHint) {\n const { next } = params;\n if (next) {\n const index = next.indexOf('tpa_hint=');\n if (index !== -1) {\n tpaHint = next.substring(index + 'tpa_hint='.length, next.length);\n }\n }\n }\n return tpaHint;\n};\n\nexport const updatePathWithQueryParams = (path) => {\n let queryParams = window.location.search;\n\n if (!queryParams) {\n return path;\n }\n\n if (queryParams.includes('track=pwreset')) {\n queryParams = queryParams.replace('?track=pwreset&', '?',).replace('?track=pwreset', '').replace('&track=pwreset', '').replace('?&', '?');\n }\n\n return `${path}${queryParams}`;\n};\n\nexport const getAllPossibleQueryParams = (locationURl = null) => {\n const urlParams = locationURl ? QueryString.parseUrl(locationURl).query : QueryString.parse(window.location.search);\n const params = {};\n Object.entries(urlParams).forEach(([key, value]) => {\n if (AUTH_PARAMS.includes(key)) {\n params[key] = value;\n }\n });\n\n return params;\n};\n\nexport const getActivationStatus = () => {\n const params = QueryString.parse(window.location.search);\n\n return params.account_activation_status;\n};\n\nexport const isScrollBehaviorSupported = () => 'scrollBehavior' in document.documentElement.style;\n\nexport const windowScrollTo = (options) => {\n if (isScrollBehaviorSupported()) {\n return window.scrollTo(options);\n }\n\n return window.scrollTo(options.top, options.left);\n};\n\n/**\n * Normalize a backend redirect URL: if the backend returns the LMS dashboard\n * URL (or nothing), replace it with the role-based dashboard URL so that SPA\n * navigation can be used when the dashboard lives in the same shell.\n */\nexport const normalizeRedirectUrl = (backendUrl) => {\n const dashboardUrl = getUrlByRouteRole(dashboardRole) || '/';\n const lmsDashboardUrl = `${getSiteConfig().lmsBaseUrl}/dashboard`;\n return (!backendUrl || backendUrl.startsWith(lmsDashboardUrl))\n ? dashboardUrl\n : backendUrl;\n};\n\nexport const isHostAvailableInQueryParams = () => {\n const queryParams = getAllPossibleQueryParams();\n return 'host' in queryParams;\n};\n"]}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { getTpaProvider, getTpaHint, getAllPossibleQueryParams, getActivationStatus, isHostAvailableInQueryParams, updatePathWithQueryParams, normalizeRedirectUrl, windowScrollTo, } from './dataUtils';
|
|
2
|
+
export { default as setCookie } from './cookies';
|
|
3
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/data/utils/index.js"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,UAAU,EACV,yBAAyB,EACzB,mBAAmB,EACnB,4BAA4B,EAC5B,yBAAyB,EACzB,oBAAoB,EACpB,cAAc,GACf,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,WAAW,CAAC","sourcesContent":["export {\n getTpaProvider,\n getTpaHint,\n getAllPossibleQueryParams,\n getActivationStatus,\n isHostAvailableInQueryParams,\n updatePathWithQueryParams,\n normalizeRedirectUrl,\n windowScrollTo,\n} from './dataUtils';\nexport { default as setCookie } from './cookies';\n"]}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export default useMobileResponsive;
|
|
2
|
+
/**
|
|
3
|
+
* A react hook used to determine if the current window is mobile or not.
|
|
4
|
+
* returns true if the window is of mobile size.
|
|
5
|
+
* Code source: https://github.com/edx/prospectus/blob/master/src/utils/useMobileResponsive.js
|
|
6
|
+
*/
|
|
7
|
+
declare function useMobileResponsive(breakpoint: any): undefined;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { useEffect, useState } from 'react';
|
|
2
|
+
import { breakpoints } from '@openedx/paragon';
|
|
3
|
+
/**
|
|
4
|
+
* A react hook used to determine if the current window is mobile or not.
|
|
5
|
+
* returns true if the window is of mobile size.
|
|
6
|
+
* Code source: https://github.com/edx/prospectus/blob/master/src/utils/useMobileResponsive.js
|
|
7
|
+
*/
|
|
8
|
+
const useMobileResponsive = (breakpoint) => {
|
|
9
|
+
const [isMobileWindow, setIsMobileWindow] = useState();
|
|
10
|
+
const checkForMobile = () => {
|
|
11
|
+
setIsMobileWindow(window.matchMedia(`(max-width: ${breakpoint !== null && breakpoint !== void 0 ? breakpoint : breakpoints.small.maxWidth}px)`).matches);
|
|
12
|
+
};
|
|
13
|
+
useEffect(() => {
|
|
14
|
+
checkForMobile();
|
|
15
|
+
window.addEventListener('resize', checkForMobile);
|
|
16
|
+
// return this function here to clean up the event listener
|
|
17
|
+
return () => window.removeEventListener('resize', checkForMobile);
|
|
18
|
+
});
|
|
19
|
+
return isMobileWindow;
|
|
20
|
+
};
|
|
21
|
+
export default useMobileResponsive;
|
|
22
|
+
//# sourceMappingURL=useMobileResponsive.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useMobileResponsive.js","sourceRoot":"","sources":["../../../src/data/utils/useMobileResponsive.js"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAE5C,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/C;;;;GAIG;AACH,MAAM,mBAAmB,GAAG,CAAC,UAAU,EAAE,EAAE;IACzC,MAAM,CAAC,cAAc,EAAE,iBAAiB,CAAC,GAAG,QAAQ,EAAE,CAAC;IACvD,MAAM,cAAc,GAAG,GAAG,EAAE;QAC1B,iBAAiB,CAAC,MAAM,CAAC,UAAU,CAAC,eAAe,UAAU,aAAV,UAAU,cAAV,UAAU,GAAI,WAAW,CAAC,KAAK,CAAC,QAAQ,KAAK,CAAC,CAAC,OAAO,CAAC,CAAC;IAC7G,CAAC,CAAC;IACF,SAAS,CAAC,GAAG,EAAE;QACb,cAAc,EAAE,CAAC;QACjB,MAAM,CAAC,gBAAgB,CAAC,QAAQ,EAAE,cAAc,CAAC,CAAC;QAClD,2DAA2D;QAC3D,OAAO,GAAG,EAAE,CAAC,MAAM,CAAC,mBAAmB,CAAC,QAAQ,EAAE,cAAc,CAAC,CAAC;IACpE,CAAC,CAAC,CAAC;IACH,OAAO,cAAc,CAAC;AACxB,CAAC,CAAC;AAEF,eAAe,mBAAmB,CAAC","sourcesContent":["import { useEffect, useState } from 'react';\n\nimport { breakpoints } from '@openedx/paragon';\n\n/**\n * A react hook used to determine if the current window is mobile or not.\n * returns true if the window is of mobile size.\n * Code source: https://github.com/edx/prospectus/blob/master/src/utils/useMobileResponsive.js\n */\nconst useMobileResponsive = (breakpoint) => {\n const [isMobileWindow, setIsMobileWindow] = useState();\n const checkForMobile = () => {\n setIsMobileWindow(window.matchMedia(`(max-width: ${breakpoint ?? breakpoints.small.maxWidth}px)`).matches);\n };\n useEffect(() => {\n checkForMobile();\n window.addEventListener('resize', checkForMobile);\n // return this function here to clean up the event listener\n return () => window.removeEventListener('resize', checkForMobile);\n });\n return isMobileWindow;\n};\n\nexport default useMobileResponsive;\n"]}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export default FormFieldRenderer;
|
|
2
|
+
declare function FormFieldRenderer(props: any): import("react/jsx-runtime").JSX.Element | null;
|
|
3
|
+
declare namespace FormFieldRenderer {
|
|
4
|
+
namespace defaultProps {
|
|
5
|
+
let className: string;
|
|
6
|
+
let value: string;
|
|
7
|
+
let handleBlur: null;
|
|
8
|
+
let handleFocus: null;
|
|
9
|
+
let errorMessage: string;
|
|
10
|
+
let isRequired: boolean;
|
|
11
|
+
}
|
|
12
|
+
namespace propTypes {
|
|
13
|
+
let className_1: PropTypes.Requireable<string>;
|
|
14
|
+
export { className_1 as className };
|
|
15
|
+
export let fieldData: PropTypes.Validator<NonNullable<PropTypes.InferProps<{
|
|
16
|
+
type: PropTypes.Requireable<string>;
|
|
17
|
+
label: PropTypes.Requireable<string>;
|
|
18
|
+
name: PropTypes.Requireable<string>;
|
|
19
|
+
options: PropTypes.Requireable<((string | null | undefined)[] | null | undefined)[]>;
|
|
20
|
+
}>>>;
|
|
21
|
+
export let onChangeHandler: PropTypes.Validator<(...args: any[]) => any>;
|
|
22
|
+
let handleBlur_1: PropTypes.Requireable<(...args: any[]) => any>;
|
|
23
|
+
export { handleBlur_1 as handleBlur };
|
|
24
|
+
let handleFocus_1: PropTypes.Requireable<(...args: any[]) => any>;
|
|
25
|
+
export { handleFocus_1 as handleFocus };
|
|
26
|
+
let errorMessage_1: PropTypes.Requireable<string>;
|
|
27
|
+
export { errorMessage_1 as errorMessage };
|
|
28
|
+
let isRequired_1: PropTypes.Requireable<boolean>;
|
|
29
|
+
export { isRequired_1 as isRequired };
|
|
30
|
+
let value_1: PropTypes.Requireable<NonNullable<string | boolean | null | undefined>>;
|
|
31
|
+
export { value_1 as value };
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
import PropTypes from 'prop-types';
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Form, Icon } from '@openedx/paragon';
|
|
3
|
+
import { ExpandMore } from '@openedx/paragon/icons';
|
|
4
|
+
import PropTypes from 'prop-types';
|
|
5
|
+
const FormFieldRenderer = (props) => {
|
|
6
|
+
let formField = null;
|
|
7
|
+
const { className, errorMessage, fieldData, onChangeHandler, isRequired, value, } = props;
|
|
8
|
+
const handleFocus = (e) => {
|
|
9
|
+
if (props.handleFocus) {
|
|
10
|
+
props.handleFocus(e);
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
const handleOnBlur = (e) => {
|
|
14
|
+
if (props.handleBlur) {
|
|
15
|
+
props.handleBlur(e);
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
switch (fieldData.type) {
|
|
19
|
+
case 'select': {
|
|
20
|
+
if (!fieldData.options) {
|
|
21
|
+
return null;
|
|
22
|
+
}
|
|
23
|
+
formField = (_jsxs(Form.Group, { controlId: fieldData.name, isInvalid: !!(isRequired && errorMessage), children: [_jsxs(Form.Control, { className: className, as: "select", name: fieldData.name, value: value, "aria-invalid": isRequired && Boolean(errorMessage), onChange: (e) => onChangeHandler(e), trailingElement: _jsx(Icon, { src: ExpandMore }), floatingLabel: fieldData.label, onBlur: handleOnBlur, onFocus: handleFocus, children: [_jsx("option", { value: "", children: fieldData.label }, "default"), fieldData.options.map(option => (_jsx("option", { className: "data-hj-suppress", value: option[0], children: option[1] }, option[0])))] }), isRequired && errorMessage && (_jsx(Form.Control.Feedback, { id: `${fieldData.name}-error`, type: "invalid", className: "form-text-size", hasIcon: false, children: errorMessage }))] }));
|
|
24
|
+
break;
|
|
25
|
+
}
|
|
26
|
+
case 'textarea': {
|
|
27
|
+
formField = (_jsxs(Form.Group, { controlId: fieldData.name, isInvalid: !!(isRequired && errorMessage), children: [_jsx(Form.Control, { className: className, as: "textarea", name: fieldData.name, value: value, "aria-invalid": isRequired && Boolean(errorMessage), onChange: (e) => onChangeHandler(e), floatingLabel: fieldData.label, onBlur: handleOnBlur, onFocus: handleFocus }), isRequired && errorMessage && (_jsx(Form.Control.Feedback, { id: `${fieldData.name}-error`, type: "invalid", className: "form-text-size", hasIcon: false, children: errorMessage }))] }));
|
|
28
|
+
break;
|
|
29
|
+
}
|
|
30
|
+
case 'text': {
|
|
31
|
+
formField = (_jsxs(Form.Group, { controlId: fieldData.name, isInvalid: !!(isRequired && errorMessage), children: [_jsx(Form.Control, { className: className, name: fieldData.name, value: value, "aria-invalid": isRequired && Boolean(errorMessage), onChange: (e) => onChangeHandler(e), floatingLabel: fieldData.label, onBlur: handleOnBlur, onFocus: handleFocus }), isRequired && errorMessage && (_jsx(Form.Control.Feedback, { id: `${fieldData.name}-error`, type: "invalid", className: "form-text-size", hasIcon: false, children: errorMessage }))] }));
|
|
32
|
+
break;
|
|
33
|
+
}
|
|
34
|
+
case 'checkbox': {
|
|
35
|
+
formField = (_jsxs(Form.Group, { isInvalid: !!(isRequired && errorMessage), children: [_jsx(Form.Checkbox, { className: className, id: fieldData.name, checked: !!value, name: fieldData.name, value: value, "aria-invalid": isRequired && Boolean(errorMessage), onChange: (e) => onChangeHandler(e), onBlur: handleOnBlur, onFocus: handleFocus, children: fieldData.label }), isRequired && errorMessage && (_jsx(Form.Control.Feedback, { id: `${fieldData.name}-error`, type: "invalid", className: "form-text-size", hasIcon: false, children: errorMessage }))] }));
|
|
36
|
+
break;
|
|
37
|
+
}
|
|
38
|
+
default:
|
|
39
|
+
break;
|
|
40
|
+
}
|
|
41
|
+
return formField;
|
|
42
|
+
};
|
|
43
|
+
FormFieldRenderer.defaultProps = {
|
|
44
|
+
className: '',
|
|
45
|
+
value: '',
|
|
46
|
+
handleBlur: null,
|
|
47
|
+
handleFocus: null,
|
|
48
|
+
errorMessage: '',
|
|
49
|
+
isRequired: false,
|
|
50
|
+
};
|
|
51
|
+
FormFieldRenderer.propTypes = {
|
|
52
|
+
className: PropTypes.string,
|
|
53
|
+
fieldData: PropTypes.shape({
|
|
54
|
+
type: PropTypes.string,
|
|
55
|
+
label: PropTypes.string,
|
|
56
|
+
name: PropTypes.string,
|
|
57
|
+
options: PropTypes.arrayOf(PropTypes.arrayOf(PropTypes.string)),
|
|
58
|
+
}).isRequired,
|
|
59
|
+
onChangeHandler: PropTypes.func.isRequired,
|
|
60
|
+
handleBlur: PropTypes.func,
|
|
61
|
+
handleFocus: PropTypes.func,
|
|
62
|
+
errorMessage: PropTypes.string,
|
|
63
|
+
isRequired: PropTypes.bool,
|
|
64
|
+
value: PropTypes.oneOfType([
|
|
65
|
+
PropTypes.string,
|
|
66
|
+
PropTypes.bool,
|
|
67
|
+
]),
|
|
68
|
+
};
|
|
69
|
+
export default FormFieldRenderer;
|
|
70
|
+
//# sourceMappingURL=FieldRenderer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FieldRenderer.js","sourceRoot":"","sources":["../../src/field-renderer/FieldRenderer.jsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,SAAS,MAAM,YAAY,CAAC;AAEnC,MAAM,iBAAiB,GAAG,CAAC,KAAK,EAAE,EAAE;IAClC,IAAI,SAAS,GAAG,IAAI,CAAC;IACrB,MAAM,EACJ,SAAS,EAAE,YAAY,EAAE,SAAS,EAAE,eAAe,EAAE,UAAU,EAAE,KAAK,GACvE,GAAG,KAAK,CAAC;IAEV,MAAM,WAAW,GAAG,CAAC,CAAC,EAAE,EAAE;QACxB,IAAI,KAAK,CAAC,WAAW,EAAE,CAAC;YAAC,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;QAAC,CAAC;IAClD,CAAC,CAAC;IAEF,MAAM,YAAY,GAAG,CAAC,CAAC,EAAE,EAAE;QACzB,IAAI,KAAK,CAAC,UAAU,EAAE,CAAC;YAAC,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;QAAC,CAAC;IAChD,CAAC,CAAC;IAEF,QAAQ,SAAS,CAAC,IAAI,EAAE,CAAC;QACvB,KAAK,QAAQ,CAAC,CAAC,CAAC;YACd,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,CAAC;gBACvB,OAAO,IAAI,CAAC;YACd,CAAC;YACD,SAAS,GAAG,CACV,MAAC,IAAI,CAAC,KAAK,IAAC,SAAS,EAAE,SAAS,CAAC,IAAI,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC,UAAU,IAAI,YAAY,CAAC,aAC9E,MAAC,IAAI,CAAC,OAAO,IACX,SAAS,EA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,EAAE,SAAS,CAAC,MAAM;QACtB,OAAO,EAAE,SAAS,CAAC,OAAO,CAAC,SAAS,CAAC,OAAO,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;KAChE,CAAC,CAAC,UAAU;IACb,eAAe,EAAE,SAAS,CAAC,IAAI,CAAC,UAAU;IAC1C,UAAU,EAAE,SAAS,CAAC,IAAI;IAC1B,WAAW,EAAE,SAAS,CAAC,IAAI;IAC3B,YAAY,EAAE,SAAS,CAAC,MAAM;IAC9B,UAAU,EAAE,SAAS,CAAC,IAAI;IAC1B,KAAK,EAAE,SAAS,CAAC,SAAS,CAAC;QACzB,SAAS,CAAC,MAAM;QAChB,SAAS,CAAC,IAAI;KACf,CAAC;CACH,CAAC;AAEF,eAAe,iBAAiB,CAAC","sourcesContent":["import { Form, Icon } from '@openedx/paragon';\nimport { ExpandMore } from '@openedx/paragon/icons';\nimport PropTypes from 'prop-types';\n\nconst FormFieldRenderer = (props) => {\n let formField = null;\n const {\n className, errorMessage, fieldData, onChangeHandler, isRequired, value,\n } = props;\n\n const handleFocus = (e) => {\n if (props.handleFocus) { props.handleFocus(e); }\n };\n\n const handleOnBlur = (e) => {\n if (props.handleBlur) { props.handleBlur(e); }\n };\n\n switch (fieldData.type) {\n case 'select': {\n if (!fieldData.options) {\n return null;\n }\n formField = (\n <Form.Group controlId={fieldData.name} isInvalid={!!(isRequired && errorMessage)}>\n <Form.Control\n className={className}\n as=\"select\"\n name={fieldData.name}\n value={value}\n aria-invalid={isRequired && Boolean(errorMessage)}\n onChange={(e) => onChangeHandler(e)}\n trailingElement={<Icon src={ExpandMore} />}\n floatingLabel={fieldData.label}\n onBlur={handleOnBlur}\n onFocus={handleFocus}\n >\n <option key=\"default\" value=\"\">{fieldData.label}</option>\n {fieldData.options.map(option => (\n <option className=\"data-hj-suppress\" key={option[0]} value={option[0]}>{option[1]}</option>\n ))}\n </Form.Control>\n {isRequired && errorMessage && (\n <Form.Control.Feedback id={`${fieldData.name}-error`} type=\"invalid\" className=\"form-text-size\" hasIcon={false}>\n {errorMessage}\n </Form.Control.Feedback>\n )}\n </Form.Group>\n );\n break;\n }\n case 'textarea': {\n formField = (\n <Form.Group controlId={fieldData.name} isInvalid={!!(isRequired && errorMessage)}>\n <Form.Control\n className={className}\n as=\"textarea\"\n name={fieldData.name}\n value={value}\n aria-invalid={isRequired && Boolean(errorMessage)}\n onChange={(e) => onChangeHandler(e)}\n floatingLabel={fieldData.label}\n onBlur={handleOnBlur}\n onFocus={handleFocus}\n />\n {isRequired && errorMessage && (\n <Form.Control.Feedback id={`${fieldData.name}-error`} type=\"invalid\" className=\"form-text-size\" hasIcon={false}>\n {errorMessage}\n </Form.Control.Feedback>\n )}\n </Form.Group>\n );\n break;\n }\n case 'text': {\n formField = (\n <Form.Group controlId={fieldData.name} isInvalid={!!(isRequired && errorMessage)}>\n <Form.Control\n className={className}\n name={fieldData.name}\n value={value}\n aria-invalid={isRequired && Boolean(errorMessage)}\n onChange={(e) => onChangeHandler(e)}\n floatingLabel={fieldData.label}\n onBlur={handleOnBlur}\n onFocus={handleFocus}\n />\n {isRequired && errorMessage && (\n <Form.Control.Feedback id={`${fieldData.name}-error`} type=\"invalid\" className=\"form-text-size\" hasIcon={false}>\n {errorMessage}\n </Form.Control.Feedback>\n )}\n </Form.Group>\n );\n break;\n }\n case 'checkbox': {\n formField = (\n <Form.Group isInvalid={!!(isRequired && errorMessage)}>\n <Form.Checkbox\n className={className}\n id={fieldData.name}\n checked={!!value}\n name={fieldData.name}\n value={value}\n aria-invalid={isRequired && Boolean(errorMessage)}\n onChange={(e) => onChangeHandler(e)}\n onBlur={handleOnBlur}\n onFocus={handleFocus}\n >\n {fieldData.label}\n </Form.Checkbox>\n {isRequired && errorMessage && (\n <Form.Control.Feedback id={`${fieldData.name}-error`} type=\"invalid\" className=\"form-text-size\" hasIcon={false}>\n {errorMessage}\n </Form.Control.Feedback>\n )}\n </Form.Group>\n );\n break;\n }\n default:\n break;\n }\n\n return formField;\n};\nFormFieldRenderer.defaultProps = {\n className: '',\n value: '',\n handleBlur: null,\n handleFocus: null,\n errorMessage: '',\n isRequired: false,\n};\n\nFormFieldRenderer.propTypes = {\n className: PropTypes.string,\n fieldData: PropTypes.shape({\n type: PropTypes.string,\n label: PropTypes.string,\n name: PropTypes.string,\n options: PropTypes.arrayOf(PropTypes.arrayOf(PropTypes.string)),\n }).isRequired,\n onChangeHandler: PropTypes.func.isRequired,\n handleBlur: PropTypes.func,\n handleFocus: PropTypes.func,\n errorMessage: PropTypes.string,\n isRequired: PropTypes.bool,\n value: PropTypes.oneOfType([\n PropTypes.string,\n PropTypes.bool,\n ]),\n};\n\nexport default FormFieldRenderer;\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as FormFieldRenderer } from "./FieldRenderer";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/field-renderer/index.jsx"],"names":[],"mappings":"AAAA,iDAAiD;AACjD,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,iBAAiB,CAAC","sourcesContent":["/* eslint-disable import/prefer-default-export */\nexport { default as FormFieldRenderer } from './FieldRenderer';\n"]}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export default ForgotPasswordAlert;
|
|
2
|
+
declare function ForgotPasswordAlert(props: any): import("react/jsx-runtime").JSX.Element | null;
|
|
3
|
+
declare namespace ForgotPasswordAlert {
|
|
4
|
+
namespace defaultProps {
|
|
5
|
+
let email: string;
|
|
6
|
+
let emailError: string;
|
|
7
|
+
}
|
|
8
|
+
namespace propTypes {
|
|
9
|
+
export let status: PropTypes.Validator<string>;
|
|
10
|
+
let email_1: PropTypes.Requireable<string>;
|
|
11
|
+
export { email_1 as email };
|
|
12
|
+
let emailError_1: PropTypes.Requireable<string>;
|
|
13
|
+
export { emailError_1 as emailError };
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
import PropTypes from 'prop-types';
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { FormattedMessage, useAppConfig, useIntl } from '@openedx/frontend-base';
|
|
3
|
+
import { Alert } from '@openedx/paragon';
|
|
4
|
+
import { CheckCircle, Error } from '@openedx/paragon/icons';
|
|
5
|
+
import PropTypes from 'prop-types';
|
|
6
|
+
import { COMPLETE_STATE, FORBIDDEN_STATE, FORM_SUBMISSION_ERROR, INTERNAL_SERVER_ERROR, } from '../data/constants';
|
|
7
|
+
import { PASSWORD_RESET } from '../reset-password/data/constants';
|
|
8
|
+
import messages from './messages';
|
|
9
|
+
const ForgotPasswordAlert = (props) => {
|
|
10
|
+
const { formatMessage } = useIntl();
|
|
11
|
+
const { email, emailError } = props;
|
|
12
|
+
let message = '';
|
|
13
|
+
let heading = formatMessage(messages['forgot.password.error.alert.title']);
|
|
14
|
+
let { status } = props;
|
|
15
|
+
if (emailError) {
|
|
16
|
+
status = FORM_SUBMISSION_ERROR;
|
|
17
|
+
}
|
|
18
|
+
switch (status) {
|
|
19
|
+
case COMPLETE_STATE:
|
|
20
|
+
heading = formatMessage(messages['confirmation.message.title']);
|
|
21
|
+
message = (_jsx(FormattedMessage, { id: "forgot.password.confirmation.message", defaultMessage: "We sent an email to {email} with instructions to reset your password.\n If you do not receive a password reset message after 1 minute, verify that you entered\n the correct email address, or check your spam folder. If you need further assistance, {supportLink}.", description: "Forgot password confirmation message", values: {
|
|
22
|
+
email: _jsx("span", { className: "data-hj-suppress", children: email }),
|
|
23
|
+
supportLink: (_jsx(Alert.Link, { href: useAppConfig().PASSWORD_RESET_SUPPORT_LINK, target: "_blank", children: formatMessage(messages['confirmation.support.link']) })),
|
|
24
|
+
} }));
|
|
25
|
+
break;
|
|
26
|
+
case INTERNAL_SERVER_ERROR:
|
|
27
|
+
message = formatMessage(messages['internal.server.error']);
|
|
28
|
+
break;
|
|
29
|
+
case FORBIDDEN_STATE:
|
|
30
|
+
heading = formatMessage(messages['forgot.password.error.message.title']);
|
|
31
|
+
message = formatMessage(messages['forgot.password.request.in.progress.message']);
|
|
32
|
+
break;
|
|
33
|
+
case FORM_SUBMISSION_ERROR:
|
|
34
|
+
message = formatMessage(messages['extend.field.errors'], { emailError });
|
|
35
|
+
break;
|
|
36
|
+
case PASSWORD_RESET.INVALID_TOKEN:
|
|
37
|
+
heading = formatMessage(messages['invalid.token.heading']);
|
|
38
|
+
message = formatMessage(messages['invalid.token.error.message']);
|
|
39
|
+
break;
|
|
40
|
+
case PASSWORD_RESET.FORBIDDEN_REQUEST:
|
|
41
|
+
heading = formatMessage(messages['token.validation.rate.limit.error.heading']);
|
|
42
|
+
message = formatMessage(messages['token.validation.rate.limit.error']);
|
|
43
|
+
break;
|
|
44
|
+
case PASSWORD_RESET.INTERNAL_SERVER_ERROR:
|
|
45
|
+
heading = formatMessage(messages['token.validation.internal.sever.error.heading']);
|
|
46
|
+
message = formatMessage(messages['token.validation.internal.sever.error']);
|
|
47
|
+
break;
|
|
48
|
+
default:
|
|
49
|
+
break;
|
|
50
|
+
}
|
|
51
|
+
if (message) {
|
|
52
|
+
return (_jsxs(Alert, { id: "validation-errors", className: "mb-4", variant: `${status === 'complete' ? 'success' : 'danger'}`, icon: status === 'complete' ? CheckCircle : Error, children: [_jsx(Alert.Heading, { children: heading }), _jsx("p", { children: message })] }));
|
|
53
|
+
}
|
|
54
|
+
return null;
|
|
55
|
+
};
|
|
56
|
+
ForgotPasswordAlert.defaultProps = {
|
|
57
|
+
email: '',
|
|
58
|
+
emailError: '',
|
|
59
|
+
};
|
|
60
|
+
ForgotPasswordAlert.propTypes = {
|
|
61
|
+
status: PropTypes.string.isRequired,
|
|
62
|
+
email: PropTypes.string,
|
|
63
|
+
emailError: PropTypes.string,
|
|
64
|
+
};
|
|
65
|
+
export default ForgotPasswordAlert;
|
|
66
|
+
//# sourceMappingURL=ForgotPasswordAlert.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":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AC,mBAAmB,EACtB,SAAS,EAAC,MAAM,EAChB,OAAO,EAAE,GAAG,MAAM,KAAK,UAAU,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,QAAQ,EAAE,EAC1D,IAAI,EAAE,MAAM,KAAK,UAAU,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,KAAK,aAEjD,KAAC,KAAK,CAAC,OAAO,cAAE,OAAO,GAAiB,EACxC,sBAAI,OAAO,GAAK,IACV,CACT,CAAC;IACJ,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC,CAAC;AAEF,mBAAmB,CAAC,YAAY,GAAG;IACjC,KAAK,EAAE,EAAE;IACT,UAAU,EAAE,EAAE;CACf,CAAC;AAEF,mBAAmB,CAAC,SAAS,GAAG;IAC9B,MAAM,EAAE,SAAS,CAAC,MAAM,CAAC,UAAU;IACnC,KAAK,EAAE,SAAS,CAAC,MAAM;IACvB,UAAU,EAAE,SAAS,CAAC,MAAM;CAC7B,CAAC;AAEF,eAAe,mBAAmB,CAAC","sourcesContent":["import { FormattedMessage, useAppConfig, useIntl } from '@openedx/frontend-base';\nimport { Alert } from '@openedx/paragon';\nimport { CheckCircle, Error } from '@openedx/paragon/icons';\nimport PropTypes from 'prop-types';\n\nimport {\n COMPLETE_STATE, FORBIDDEN_STATE, FORM_SUBMISSION_ERROR, INTERNAL_SERVER_ERROR,\n} from '../data/constants';\nimport { PASSWORD_RESET } from '../reset-password/data/constants';\nimport messages from './messages';\n\nconst ForgotPasswordAlert = (props) => {\n const { formatMessage } = useIntl();\n const { email, emailError } = props;\n let message = '';\n let heading = formatMessage(messages['forgot.password.error.alert.title']);\n let { status } = props;\n\n if (emailError) {\n status = FORM_SUBMISSION_ERROR;\n }\n\n switch (status) {\n case COMPLETE_STATE:\n heading = formatMessage(messages['confirmation.message.title']);\n message = (\n <FormattedMessage\n id=\"forgot.password.confirmation.message\"\n defaultMessage=\"We sent an email to {email} with instructions to reset your password.\n If you do not receive a password reset message after 1 minute, verify that you entered\n the correct email address, or check your spam folder. If you need further assistance, {supportLink}.\"\n description=\"Forgot password confirmation message\"\n values={{\n email: <span className=\"data-hj-suppress\">{email}</span>,\n supportLink: (\n <Alert.Link href={useAppConfig().PASSWORD_RESET_SUPPORT_LINK} target=\"_blank\">\n {formatMessage(messages['confirmation.support.link'])}\n </Alert.Link>\n ),\n }}\n />\n );\n break;\n case INTERNAL_SERVER_ERROR:\n message = formatMessage(messages['internal.server.error']);\n break;\n case FORBIDDEN_STATE:\n heading = formatMessage(messages['forgot.password.error.message.title']);\n message = formatMessage(messages['forgot.password.request.in.progress.message']);\n break;\n case FORM_SUBMISSION_ERROR:\n message = formatMessage(messages['extend.field.errors'], { emailError });\n break;\n case PASSWORD_RESET.INVALID_TOKEN:\n heading = formatMessage(messages['invalid.token.heading']);\n message = formatMessage(messages['invalid.token.error.message']);\n break;\n case PASSWORD_RESET.FORBIDDEN_REQUEST:\n heading = formatMessage(messages['token.validation.rate.limit.error.heading']);\n message = formatMessage(messages['token.validation.rate.limit.error']);\n break;\n case PASSWORD_RESET.INTERNAL_SERVER_ERROR:\n heading = formatMessage(messages['token.validation.internal.sever.error.heading']);\n message = formatMessage(messages['token.validation.internal.sever.error']);\n break;\n default:\n break;\n }\n\n if (message) {\n return (\n <Alert\n id=\"validation-errors\"\n className=\"mb-4\"\n variant={`${status === 'complete' ? 'success' : 'danger'}`}\n icon={status === 'complete' ? CheckCircle : Error}\n >\n <Alert.Heading>{heading}</Alert.Heading>\n <p>{message}</p>\n </Alert>\n );\n }\n return null;\n};\n\nForgotPasswordAlert.defaultProps = {\n email: '',\n emailError: '',\n};\n\nForgotPasswordAlert.propTypes = {\n status: PropTypes.string.isRequired,\n email: PropTypes.string,\n emailError: PropTypes.string,\n};\n\nexport default ForgotPasswordAlert;\n"]}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useState } from 'react';
|
|
3
|
+
import { getSiteConfig, getUrlByRouteRole, sendPageEvent, sendTrackEvent, useAppConfig, useIntl, } from '@openedx/frontend-base';
|
|
4
|
+
import { Form, Hyperlink, Icon, StatefulButton, Tab, Tabs, } from '@openedx/paragon';
|
|
5
|
+
import { ChevronLeft } from '@openedx/paragon/icons';
|
|
6
|
+
import { Helmet } from 'react-helmet';
|
|
7
|
+
import { useLocation, useNavigate } from 'react-router-dom';
|
|
8
|
+
import { useForgotPassword } from './data/apiHook';
|
|
9
|
+
import ForgotPasswordAlert from './ForgotPasswordAlert';
|
|
10
|
+
import messages from './messages';
|
|
11
|
+
import BaseContainer from '../base-container';
|
|
12
|
+
import { FormGroup } from '../common-components';
|
|
13
|
+
import { loginPath, loginRole } from '../constants';
|
|
14
|
+
import { VALID_EMAIL_REGEX } from '../data/constants';
|
|
15
|
+
import { updatePathWithQueryParams, windowScrollTo } from '../data/utils';
|
|
16
|
+
const ForgotPasswordPage = () => {
|
|
17
|
+
var _a;
|
|
18
|
+
const platformName = getSiteConfig().siteName;
|
|
19
|
+
const emailRegex = new RegExp(VALID_EMAIL_REGEX, 'i');
|
|
20
|
+
const { formatMessage } = useIntl();
|
|
21
|
+
const navigate = useNavigate();
|
|
22
|
+
const location = useLocation();
|
|
23
|
+
const appConfig = useAppConfig();
|
|
24
|
+
const [email, setEmail] = useState('');
|
|
25
|
+
const [bannerEmail, setBannerEmail] = useState('');
|
|
26
|
+
const [formErrors, setFormErrors] = useState('');
|
|
27
|
+
const [validationError, setValidationError] = useState('');
|
|
28
|
+
const [status, setStatus] = useState(((_a = location.state) === null || _a === void 0 ? void 0 : _a.status) || null);
|
|
29
|
+
// React Query hook for forgot password
|
|
30
|
+
const { mutate: sendForgotPassword, isPending: isSending } = useForgotPassword();
|
|
31
|
+
const submitState = isSending ? 'pending' : 'default';
|
|
32
|
+
useEffect(() => {
|
|
33
|
+
sendPageEvent('login_and_registration', 'reset');
|
|
34
|
+
sendTrackEvent('edx.bi.password_reset_form.viewed', { category: 'user-engagement' });
|
|
35
|
+
}, []);
|
|
36
|
+
useEffect(() => {
|
|
37
|
+
if (status === 'complete') {
|
|
38
|
+
setEmail('');
|
|
39
|
+
}
|
|
40
|
+
}, [status]);
|
|
41
|
+
const getValidationMessage = (value) => {
|
|
42
|
+
let error = '';
|
|
43
|
+
if (value === '') {
|
|
44
|
+
error = formatMessage(messages['forgot.password.empty.email.field.error']);
|
|
45
|
+
}
|
|
46
|
+
else if (!emailRegex.test(value)) {
|
|
47
|
+
error = formatMessage(messages['forgot.password.page.invalid.email.message']);
|
|
48
|
+
}
|
|
49
|
+
return error;
|
|
50
|
+
};
|
|
51
|
+
const handleBlur = () => {
|
|
52
|
+
setValidationError(getValidationMessage(email));
|
|
53
|
+
};
|
|
54
|
+
const handleFocus = () => {
|
|
55
|
+
setValidationError('');
|
|
56
|
+
};
|
|
57
|
+
const handleSubmit = (e) => {
|
|
58
|
+
e.preventDefault();
|
|
59
|
+
setBannerEmail(email);
|
|
60
|
+
const validateError = getValidationMessage(email);
|
|
61
|
+
if (validateError) {
|
|
62
|
+
setFormErrors(validateError);
|
|
63
|
+
setValidationError(validateError);
|
|
64
|
+
windowScrollTo({ left: 0, top: 0, behavior: 'smooth' });
|
|
65
|
+
}
|
|
66
|
+
else {
|
|
67
|
+
setFormErrors('');
|
|
68
|
+
sendForgotPassword(email, {
|
|
69
|
+
onSuccess: (data, emailUsed) => {
|
|
70
|
+
setStatus('complete');
|
|
71
|
+
setBannerEmail(emailUsed);
|
|
72
|
+
setFormErrors('');
|
|
73
|
+
},
|
|
74
|
+
onError: (error) => {
|
|
75
|
+
if (error.response && error.response.status === 403) {
|
|
76
|
+
setStatus('forbidden');
|
|
77
|
+
}
|
|
78
|
+
else {
|
|
79
|
+
setStatus('server-error');
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
const tabTitle = (_jsxs("div", { className: "d-inline-flex flex-wrap align-items-center", children: [_jsx(Icon, { src: ChevronLeft }), _jsx("span", { className: "ml-2", children: formatMessage(messages['sign.in.text']) })] }));
|
|
86
|
+
return (_jsxs(BaseContainer, { children: [_jsx(Helmet, { children: _jsx("title", { children: formatMessage(messages['forgot.password.page.title'], { siteName: getSiteConfig().siteName }) }) }), _jsxs("div", { children: [_jsx(Tabs, { activeKey: "", id: "controlled-tab", onSelect: () => navigate(updatePathWithQueryParams(getUrlByRouteRole(loginRole))), children: _jsx(Tab, { title: tabTitle, eventKey: loginPath }) }), _jsx("div", { id: "main-content", className: "main-content", children: _jsxs(Form, { id: "forget-password-form", name: "forget-password-form", className: "mw-xs", children: [_jsx(ForgotPasswordAlert, { email: bannerEmail, emailError: formErrors, status: status }), _jsx("h2", { className: "h4", children: formatMessage(messages['forgot.password.page.heading']) }), _jsx("p", { className: "mb-4", children: formatMessage(messages['forgot.password.page.instructions']) }), _jsx(FormGroup, { floatingLabel: formatMessage(messages['forgot.password.page.email.field.label']), name: "email", value: email, autoComplete: "on", errorMessage: validationError, handleChange: (e) => setEmail(e.target.value), handleBlur: handleBlur, handleFocus: handleFocus, helpText: [formatMessage(messages['forgot.password.email.help.text'], { platformName })] }), _jsx(StatefulButton, { id: "submit-forget-password", name: "submit-forget-password", type: "submit", variant: "brand", className: "forgot-password--button", state: submitState, labels: {
|
|
87
|
+
default: formatMessage(messages['forgot.password.page.submit.button']),
|
|
88
|
+
pending: '',
|
|
89
|
+
}, onClick: handleSubmit, onMouseDown: (e) => e.preventDefault() }), (appConfig.LOGIN_ISSUE_SUPPORT_LINK) && (_jsx(Hyperlink, { id: "forgot-password", name: "forgot-password", className: "ml-4 font-weight-500 text-body", destination: appConfig.LOGIN_ISSUE_SUPPORT_LINK, target: "_blank", showLaunchIcon: false, children: formatMessage(messages['need.help.sign.in.text']) })), _jsxs("p", { className: "mt-5.5 small text-gray-700", children: [formatMessage(messages['additional.help.text'], { platformName }), _jsx("span", { className: "mx-1", children: _jsx(Hyperlink, { isInline: true, destination: `mailto:${appConfig.INFO_EMAIL}`, children: appConfig.INFO_EMAIL }) })] })] }) })] })] }));
|
|
90
|
+
};
|
|
91
|
+
export default ForgotPasswordPage;
|
|
92
|
+
//# sourceMappingURL=ForgotPasswordPage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ForgotPasswordPage.js","sourceRoot":"","sources":["../../src/forgot-password/ForgotPasswordPage.jsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAE5C,OAAO,EACL,aAAa,EAAE,iBAAiB,EAAE,aAAa,EAAE,cAAc,EAAE,YAAY,EAAE,OAAO,GACvF,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACL,IAAI,EACJ,SAAS,EACT,IAAI,EACJ,cAAc,EACd,GAAG,EACH,IAAI,GACL,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE5D,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,mBAAmB,MAAM,uBAAuB,CAAC;AACxD,OAAO,QAAQ,MAAM,YAAY,CAAC;AAClC,OAAO,aAAa,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAAE,yBAAyB,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAE1E,MAAM,kBAAkB,GAAG,GAAG,EAAE;;IAC9B,MAAM,YAAY,GAAG,aAAa,EAAE,CAAC,QAAQ,CAAC;IAC9C,MAAM,UAAU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Ac,EAAE,KAAK,YAEpB,aAAa,CAAC,QAAQ,CAAC,wBAAwB,CAAC,CAAC,GACxC,CACb,EACD,aAAG,SAAS,EAAC,4BAA4B,aACtC,aAAa,CAAC,QAAQ,CAAC,sBAAsB,CAAC,EAAE,EAAE,YAAY,EAAE,CAAC,EAClE,eAAM,SAAS,EAAC,MAAM,YACpB,KAAC,SAAS,IAAC,QAAQ,QAAC,WAAW,EAAE,UAAU,SAAS,CAAC,UAAU,EAAE,YAAG,SAAS,CAAC,UAAU,GAAa,GAChG,IACL,IACC,GACH,IACF,IACQ,CACjB,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,kBAAkB,CAAC","sourcesContent":["import { useEffect, useState } from 'react';\n\nimport {\n getSiteConfig, getUrlByRouteRole, sendPageEvent, sendTrackEvent, useAppConfig, useIntl,\n} from '@openedx/frontend-base';\nimport {\n Form,\n Hyperlink,\n Icon,\n StatefulButton,\n Tab,\n Tabs,\n} from '@openedx/paragon';\nimport { ChevronLeft } from '@openedx/paragon/icons';\nimport { Helmet } from 'react-helmet';\nimport { useLocation, useNavigate } from 'react-router-dom';\n\nimport { useForgotPassword } from './data/apiHook';\nimport ForgotPasswordAlert from './ForgotPasswordAlert';\nimport messages from './messages';\nimport BaseContainer from '../base-container';\nimport { FormGroup } from '../common-components';\nimport { loginPath, loginRole } from '../constants';\nimport { VALID_EMAIL_REGEX } from '../data/constants';\nimport { updatePathWithQueryParams, windowScrollTo } from '../data/utils';\n\nconst ForgotPasswordPage = () => {\n const platformName = getSiteConfig().siteName;\n const emailRegex = new RegExp(VALID_EMAIL_REGEX, 'i');\n const { formatMessage } = useIntl();\n const navigate = useNavigate();\n const location = useLocation();\n const appConfig = useAppConfig();\n const [email, setEmail] = useState('');\n const [bannerEmail, setBannerEmail] = useState('');\n const [formErrors, setFormErrors] = useState('');\n const [validationError, setValidationError] = useState('');\n const [status, setStatus] = useState(location.state?.status || null);\n\n // React Query hook for forgot password\n const { mutate: sendForgotPassword, isPending: isSending } = useForgotPassword();\n\n const submitState = isSending ? 'pending' : 'default';\n\n useEffect(() => {\n sendPageEvent('login_and_registration', 'reset');\n sendTrackEvent('edx.bi.password_reset_form.viewed', { category: 'user-engagement' });\n }, []);\n\n useEffect(() => {\n if (status === 'complete') {\n setEmail('');\n }\n }, [status]);\n\n const getValidationMessage = (value) => {\n let error = '';\n\n if (value === '') {\n error = formatMessage(messages['forgot.password.empty.email.field.error']);\n } else if (!emailRegex.test(value)) {\n error = formatMessage(messages['forgot.password.page.invalid.email.message']);\n }\n\n return error;\n };\n\n const handleBlur = () => {\n setValidationError(getValidationMessage(email));\n };\n\n const handleFocus = () => {\n setValidationError('');\n };\n\n const handleSubmit = (e) => {\n e.preventDefault();\n setBannerEmail(email);\n\n const validateError = getValidationMessage(email);\n if (validateError) {\n setFormErrors(validateError);\n setValidationError(validateError);\n windowScrollTo({ left: 0, top: 0, behavior: 'smooth' });\n } else {\n setFormErrors('');\n sendForgotPassword(email, {\n onSuccess: (data, emailUsed) => {\n setStatus('complete');\n setBannerEmail(emailUsed);\n setFormErrors('');\n },\n onError: (error) => {\n if (error.response && error.response.status === 403) {\n setStatus('forbidden');\n } else {\n setStatus('server-error');\n }\n },\n });\n }\n };\n\n const tabTitle = (\n <div className=\"d-inline-flex flex-wrap align-items-center\">\n <Icon src={ChevronLeft} />\n <span className=\"ml-2\">{formatMessage(messages['sign.in.text'])}</span>\n </div>\n );\n\n return (\n <BaseContainer>\n <Helmet>\n <title>{formatMessage(messages['forgot.password.page.title'],\n { siteName: getSiteConfig().siteName })}\n </title>\n </Helmet>\n <div>\n <Tabs activeKey=\"\" id=\"controlled-tab\" onSelect={() => navigate(updatePathWithQueryParams(getUrlByRouteRole(loginRole)))}>\n <Tab title={tabTitle} eventKey={loginPath} />\n </Tabs>\n <div id=\"main-content\" className=\"main-content\">\n <Form id=\"forget-password-form\" name=\"forget-password-form\" className=\"mw-xs\">\n <ForgotPasswordAlert email={bannerEmail} emailError={formErrors} status={status} />\n <h2 className=\"h4\">\n {formatMessage(messages['forgot.password.page.heading'])}\n </h2>\n <p className=\"mb-4\">\n {formatMessage(messages['forgot.password.page.instructions'])}\n </p>\n <FormGroup\n floatingLabel={formatMessage(messages['forgot.password.page.email.field.label'])}\n name=\"email\"\n value={email}\n autoComplete=\"on\"\n errorMessage={validationError}\n handleChange={(e) => setEmail(e.target.value)}\n handleBlur={handleBlur}\n handleFocus={handleFocus}\n helpText={[formatMessage(messages['forgot.password.email.help.text'], { platformName })]}\n />\n <StatefulButton\n id=\"submit-forget-password\"\n name=\"submit-forget-password\"\n type=\"submit\"\n variant=\"brand\"\n className=\"forgot-password--button\"\n state={submitState}\n labels={{\n default: formatMessage(messages['forgot.password.page.submit.button']),\n pending: '',\n }}\n onClick={handleSubmit}\n onMouseDown={(e) => e.preventDefault()}\n />\n {(appConfig.LOGIN_ISSUE_SUPPORT_LINK) && (\n <Hyperlink\n id=\"forgot-password\"\n name=\"forgot-password\"\n className=\"ml-4 font-weight-500 text-body\"\n destination={appConfig.LOGIN_ISSUE_SUPPORT_LINK}\n target=\"_blank\"\n showLaunchIcon={false}\n >\n {formatMessage(messages['need.help.sign.in.text'])}\n </Hyperlink>\n )}\n <p className=\"mt-5.5 small text-gray-700\">\n {formatMessage(messages['additional.help.text'], { platformName })}\n <span className=\"mx-1\">\n <Hyperlink isInline destination={`mailto:${appConfig.INFO_EMAIL}`}>{appConfig.INFO_EMAIL}</Hyperlink>\n </span>\n </p>\n </Form>\n </div>\n </div>\n </BaseContainer>\n );\n};\n\nexport default ForgotPasswordPage;\n"]}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import { getAuthenticatedHttpClient, getSiteConfig } from '@openedx/frontend-base';
|
|
11
|
+
import formurlencoded from 'form-urlencoded';
|
|
12
|
+
const forgotPassword = (email) => __awaiter(void 0, void 0, void 0, function* () {
|
|
13
|
+
const requestConfig = {
|
|
14
|
+
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
|
|
15
|
+
isPublic: true,
|
|
16
|
+
};
|
|
17
|
+
const { data } = yield getAuthenticatedHttpClient()
|
|
18
|
+
.post(`${getSiteConfig().lmsBaseUrl}/account/password`, formurlencoded({ email }), requestConfig)
|
|
19
|
+
.catch((e) => {
|
|
20
|
+
throw (e);
|
|
21
|
+
});
|
|
22
|
+
return data;
|
|
23
|
+
});
|
|
24
|
+
export { forgotPassword, };
|
|
25
|
+
//# sourceMappingURL=api.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api.js","sourceRoot":"","sources":["../../../src/forgot-password/data/api.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,0BAA0B,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACnF,OAAO,cAAc,MAAM,iBAAiB,CAAC;AAE7C,MAAM,cAAc,GAAG,CAAO,KAAa,EAAE,EAAE;IAC7C,MAAM,aAAa,GAAG;QACpB,OAAO,EAAE,EAAE,cAAc,EAAE,mCAAmC,EAAE;QAChE,QAAQ,EAAE,IAAI;KACf,CAAC;IAEF,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,0BAA0B,EAAE;SAChD,IAAI,CACH,GAAG,aAAa,EAAE,CAAC,UAAU,mBAAmB,EAChD,cAAc,CAAC,EAAE,KAAK,EAAE,CAAC,EACzB,aAAa,CACd;SACA,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE;QACX,MAAM,CAAC,CAAC,CAAC,CAAC;IACZ,CAAC,CAAC,CAAC;IAEL,OAAO,IAAI,CAAC;AACd,CAAC,CAAA,CAAC;AAEF,OAAO,EACL,cAAc,GACf,CAAC","sourcesContent":["import { getAuthenticatedHttpClient, getSiteConfig } from '@openedx/frontend-base';\nimport formurlencoded from 'form-urlencoded';\n\nconst forgotPassword = async (email: string) => {\n const requestConfig = {\n headers: { 'Content-Type': 'application/x-www-form-urlencoded' },\n isPublic: true,\n };\n\n const { data } = await getAuthenticatedHttpClient()\n .post(\n `${getSiteConfig().lmsBaseUrl}/account/password`,\n formurlencoded({ email }),\n requestConfig,\n )\n .catch((e) => {\n throw (e);\n });\n\n return data;\n};\n\nexport {\n forgotPassword,\n};\n"]}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
interface ForgotPasswordResult {
|
|
2
|
+
success: boolean;
|
|
3
|
+
message?: string;
|
|
4
|
+
}
|
|
5
|
+
interface UseForgotPasswordOptions {
|
|
6
|
+
onSuccess?: (data: ForgotPasswordResult, email: string) => void;
|
|
7
|
+
onError?: (error: Error) => void;
|
|
8
|
+
}
|
|
9
|
+
interface ApiError extends Error {
|
|
10
|
+
response?: {
|
|
11
|
+
status: number;
|
|
12
|
+
data: Record<string, unknown>;
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
declare const useForgotPassword: (options?: UseForgotPasswordOptions) => import("@tanstack/react-query").UseMutationResult<any, ApiError, string, unknown>;
|
|
16
|
+
export { useForgotPassword, };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { logError, logInfo } from '@openedx/frontend-base';
|
|
2
|
+
import { useMutation } from '@tanstack/react-query';
|
|
3
|
+
import { forgotPassword } from './api';
|
|
4
|
+
const useForgotPassword = (options = {}) => useMutation({
|
|
5
|
+
mutationFn: (email) => (forgotPassword(email)),
|
|
6
|
+
onSuccess: (data, email) => {
|
|
7
|
+
if (options.onSuccess) {
|
|
8
|
+
options.onSuccess(data, email);
|
|
9
|
+
}
|
|
10
|
+
},
|
|
11
|
+
onError: (error) => {
|
|
12
|
+
var _a;
|
|
13
|
+
// Handle different error types like the saga did
|
|
14
|
+
if (((_a = error.response) === null || _a === void 0 ? void 0 : _a.status) === 403) {
|
|
15
|
+
logInfo(error);
|
|
16
|
+
}
|
|
17
|
+
else {
|
|
18
|
+
logError(error);
|
|
19
|
+
}
|
|
20
|
+
if (options.onError) {
|
|
21
|
+
options.onError(error);
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
});
|
|
25
|
+
export { useForgotPassword, };
|
|
26
|
+
//# sourceMappingURL=apiHook.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"apiHook.js","sourceRoot":"","sources":["../../../src/forgot-password/data/apiHook.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAEpD,OAAO,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAmBvC,MAAM,iBAAiB,GAAG,CAAC,UAAoC,EAAE,EAAE,EAAE,CAAC,WAAW,CAAC;IAChF,UAAU,EAAE,CAAC,KAAa,EAAE,EAAE,CAAC,CAC7B,cAAc,CAAC,KAAK,CAAC,CACtB;IACD,SAAS,EAAE,CAAC,IAA0B,EAAE,KAAa,EAAE,EAAE;QACvD,IAAI,OAAO,CAAC,SAAS,EAAE,CAAC;YACtB,OAAO,CAAC,SAAS,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;QACjC,CAAC;IACH,CAAC;IACD,OAAO,EAAE,CAAC,KAAe,EAAE,EAAE;;QAC3B,iDAAiD;QACjD,IAAI,CAAA,MAAA,KAAK,CAAC,QAAQ,0CAAE,MAAM,MAAK,GAAG,EAAE,CAAC;YACnC,OAAO,CAAC,KAAK,CAAC,CAAC;QACjB,CAAC;aAAM,CAAC;YACN,QAAQ,CAAC,KAAK,CAAC,CAAC;QAClB,CAAC;QACD,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC;YACpB,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;QACzB,CAAC;IACH,CAAC;CACF,CAAC,CAAC;AAEH,OAAO,EACL,iBAAiB,GAClB,CAAC","sourcesContent":["import { logError, logInfo } from '@openedx/frontend-base';\nimport { useMutation } from '@tanstack/react-query';\n\nimport { forgotPassword } from './api';\n\ninterface ForgotPasswordResult {\n success: boolean,\n message?: string,\n}\n\ninterface UseForgotPasswordOptions {\n onSuccess?: (data: ForgotPasswordResult, email: string) => void,\n onError?: (error: Error) => void,\n}\n\ninterface ApiError extends Error {\n response?: {\n status: number,\n data: Record<string, unknown>,\n },\n}\n\nconst useForgotPassword = (options: UseForgotPasswordOptions = {}) => useMutation({\n mutationFn: (email: string) => (\n forgotPassword(email)\n ),\n onSuccess: (data: ForgotPasswordResult, email: string) => {\n if (options.onSuccess) {\n options.onSuccess(data, email);\n }\n },\n onError: (error: ApiError) => {\n // Handle different error types like the saga did\n if (error.response?.status === 403) {\n logInfo(error);\n } else {\n logError(error);\n }\n if (options.onError) {\n options.onError(error);\n }\n },\n});\n\nexport {\n useForgotPassword,\n};\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as ForgotPasswordPage } from "./ForgotPasswordPage";
|