@openedx/frontend-app-authn 1.0.0-alpha.0 → 1.0.0-alpha.11
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/dist/app.scss +2 -0
- 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 +1 -0
- package/dist/i18n/index.js +2 -0
- package/dist/i18n/index.js.map +1 -0
- package/{src/index.ts → dist/index.d.ts} +0 -1
- package/dist/index.js +3 -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/provides.d.ts +4 -0
- package/dist/provides.js +7 -0
- package/dist/provides.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/_base_component.scss +57 -54
- package/{src → dist}/sass/_progressive_profiling_page.scss +1 -3
- package/{src → dist}/sass/_registration.scss +15 -18
- package/{src → dist}/sass/_style.scss +40 -43
- 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 +38 -16
- package/src/Main.tsx +0 -23
- package/src/__mocks__/file.js +0 -1
- package/src/__mocks__/svg.js +0 -1
- package/src/app.scss +0 -6
- 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 -24
- 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 -153
- 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 → dist}/sass/_forgot_password.scss +0 -0
- /package/{src → dist}/sass/_login_page.scss +0 -0
- /package/{src → dist}/sass/_reset_password.scss +0 -0
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import { camelCaseObject, logError, logInfo } from '@openedx/frontend-base';
|
|
2
|
-
import { call, put, takeEvery } from 'redux-saga/effects';
|
|
3
|
-
|
|
4
|
-
import {
|
|
5
|
-
fetchRealtimeValidationsBegin,
|
|
6
|
-
fetchRealtimeValidationsFailure,
|
|
7
|
-
fetchRealtimeValidationsSuccess,
|
|
8
|
-
REGISTER_FORM_VALIDATIONS,
|
|
9
|
-
REGISTER_NEW_USER,
|
|
10
|
-
registerNewUserBegin,
|
|
11
|
-
registerNewUserFailure,
|
|
12
|
-
registerNewUserSuccess,
|
|
13
|
-
} from './actions';
|
|
14
|
-
import { INTERNAL_SERVER_ERROR } from './constants';
|
|
15
|
-
import { getFieldsValidations, registerRequest } from './service';
|
|
16
|
-
|
|
17
|
-
export function* handleNewUserRegistration(action) {
|
|
18
|
-
try {
|
|
19
|
-
yield put(registerNewUserBegin());
|
|
20
|
-
|
|
21
|
-
const { authenticatedUser, redirectUrl, success } = yield call(registerRequest, action.payload.registrationInfo);
|
|
22
|
-
|
|
23
|
-
yield put(registerNewUserSuccess(
|
|
24
|
-
camelCaseObject(authenticatedUser),
|
|
25
|
-
redirectUrl,
|
|
26
|
-
success,
|
|
27
|
-
));
|
|
28
|
-
} catch (e) {
|
|
29
|
-
const statusCodes = [400, 403, 409];
|
|
30
|
-
if (e.response && statusCodes.includes(e.response.status)) {
|
|
31
|
-
yield put(registerNewUserFailure(camelCaseObject(e.response.data)));
|
|
32
|
-
logInfo(e);
|
|
33
|
-
} else {
|
|
34
|
-
yield put(registerNewUserFailure({ errorCode: INTERNAL_SERVER_ERROR }));
|
|
35
|
-
logError(e);
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
export function* fetchRealtimeValidations(action) {
|
|
41
|
-
try {
|
|
42
|
-
yield put(fetchRealtimeValidationsBegin());
|
|
43
|
-
const { fieldValidations } = yield call(getFieldsValidations, action.payload.formPayload);
|
|
44
|
-
|
|
45
|
-
yield put(fetchRealtimeValidationsSuccess(camelCaseObject(fieldValidations)));
|
|
46
|
-
} catch (e) {
|
|
47
|
-
if (e.response && e.response.status === 403) {
|
|
48
|
-
yield put(fetchRealtimeValidationsFailure());
|
|
49
|
-
logInfo(e);
|
|
50
|
-
} else {
|
|
51
|
-
logError(e);
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
export default function* saga() {
|
|
56
|
-
yield takeEvery(REGISTER_NEW_USER.BASE, handleNewUserRegistration);
|
|
57
|
-
yield takeEvery(REGISTER_FORM_VALIDATIONS.BASE, fetchRealtimeValidations);
|
|
58
|
-
}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { createSelector } from 'reselect';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Selector for backend validations which processes the api output and generates a
|
|
5
|
-
* key value dict for field errors.
|
|
6
|
-
* @returns {{username: string}|{name: string}|*|{}|null}
|
|
7
|
-
*/
|
|
8
|
-
const getRegistrationError = state => state.register.registrationError;
|
|
9
|
-
const getValidations = state => state.register.validations;
|
|
10
|
-
|
|
11
|
-
const getBackendValidations = createSelector(
|
|
12
|
-
[getRegistrationError, getValidations],
|
|
13
|
-
(registrationError, validations) => {
|
|
14
|
-
if (validations) {
|
|
15
|
-
return validations.validationDecisions;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
if (Object.keys(registrationError).length > 0) {
|
|
19
|
-
const fields = Object.keys(registrationError).filter(
|
|
20
|
-
(fieldName) => !(fieldName in ['errorCode', 'usernameSuggestions']),
|
|
21
|
-
);
|
|
22
|
-
|
|
23
|
-
const validationDecisions = {};
|
|
24
|
-
fields.forEach(field => {
|
|
25
|
-
validationDecisions[field] = registrationError[field][0].userMessage || '';
|
|
26
|
-
});
|
|
27
|
-
return validationDecisions;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
return null;
|
|
31
|
-
}
|
|
32
|
-
);
|
|
33
|
-
|
|
34
|
-
export default getBackendValidations;
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { getAuthenticatedHttpClient, getSiteConfig, getHttpClient } from '@openedx/frontend-base';
|
|
2
|
-
import * as QueryString from 'query-string';
|
|
3
|
-
|
|
4
|
-
export async function registerRequest(registrationInformation) {
|
|
5
|
-
const requestConfig = {
|
|
6
|
-
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
|
|
7
|
-
isPublic: true,
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
const { data } = await getAuthenticatedHttpClient()
|
|
11
|
-
.post(
|
|
12
|
-
`${getSiteConfig().lmsBaseUrl}/api/user/v2/account/registration/`,
|
|
13
|
-
QueryString.stringify(registrationInformation),
|
|
14
|
-
requestConfig,
|
|
15
|
-
)
|
|
16
|
-
.catch((e) => {
|
|
17
|
-
throw (e);
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
return {
|
|
21
|
-
redirectUrl: data.redirect_url || `${getSiteConfig().lmsBaseUrl}/dashboard`,
|
|
22
|
-
success: data.success || false,
|
|
23
|
-
authenticatedUser: data.authenticated_user,
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export async function getFieldsValidations(formPayload) {
|
|
28
|
-
const requestConfig = {
|
|
29
|
-
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
const { data } = await getHttpClient()
|
|
33
|
-
.post(
|
|
34
|
-
`${getSiteConfig().lmsBaseUrl}/api/user/v1/validation/registration`,
|
|
35
|
-
QueryString.stringify(formPayload),
|
|
36
|
-
requestConfig,
|
|
37
|
-
)
|
|
38
|
-
.catch((e) => {
|
|
39
|
-
throw (e);
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
return {
|
|
43
|
-
fieldValidations: data,
|
|
44
|
-
};
|
|
45
|
-
}
|
|
@@ -1,277 +0,0 @@
|
|
|
1
|
-
import { getSiteConfig } from '@openedx/frontend-base';
|
|
2
|
-
|
|
3
|
-
import { DEFAULT_REDIRECT_URL, DEFAULT_STATE, PENDING_STATE } from '../../../data/constants';
|
|
4
|
-
import {
|
|
5
|
-
BACKUP_REGISTRATION_DATA,
|
|
6
|
-
REGISTER_CLEAR_USERNAME_SUGGESTIONS,
|
|
7
|
-
REGISTER_FORM_VALIDATIONS,
|
|
8
|
-
REGISTER_NEW_USER,
|
|
9
|
-
REGISTER_SET_COUNTRY_CODE,
|
|
10
|
-
REGISTER_SET_EMAIL_SUGGESTIONS,
|
|
11
|
-
REGISTER_SET_USER_PIPELINE_DATA_LOADED,
|
|
12
|
-
REGISTRATION_CLEAR_BACKEND_ERROR,
|
|
13
|
-
} from '../actions';
|
|
14
|
-
import reducer from '../reducers';
|
|
15
|
-
|
|
16
|
-
describe('Registration Reducer Tests', () => {
|
|
17
|
-
const defaultState = {
|
|
18
|
-
backendCountryCode: '',
|
|
19
|
-
registrationError: {},
|
|
20
|
-
registrationResult: {},
|
|
21
|
-
registrationFormData: {
|
|
22
|
-
configurableFormFields: {
|
|
23
|
-
marketingEmailsOptIn: true,
|
|
24
|
-
},
|
|
25
|
-
formFields: {
|
|
26
|
-
name: '', email: '', username: '', password: '',
|
|
27
|
-
},
|
|
28
|
-
emailSuggestion: {
|
|
29
|
-
suggestion: '', type: '',
|
|
30
|
-
},
|
|
31
|
-
errors: {
|
|
32
|
-
name: '', email: '', username: '', password: '',
|
|
33
|
-
},
|
|
34
|
-
},
|
|
35
|
-
validations: null,
|
|
36
|
-
submitState: DEFAULT_STATE,
|
|
37
|
-
userPipelineDataLoaded: false,
|
|
38
|
-
usernameSuggestions: [],
|
|
39
|
-
validationApiRateLimited: false,
|
|
40
|
-
shouldBackupState: false,
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
it('should return the initial state', () => {
|
|
44
|
-
expect(reducer(undefined, {})).toEqual(defaultState);
|
|
45
|
-
});
|
|
46
|
-
|
|
47
|
-
it('should set username suggestions returned by the backend validations', () => {
|
|
48
|
-
const validations = {
|
|
49
|
-
usernameSuggestions: ['test12'],
|
|
50
|
-
validationDecisions: {
|
|
51
|
-
name: '',
|
|
52
|
-
},
|
|
53
|
-
};
|
|
54
|
-
const { usernameSuggestions, ...validationWithoutUsernameSuggestions } = validations;
|
|
55
|
-
const action = {
|
|
56
|
-
type: REGISTER_FORM_VALIDATIONS.SUCCESS,
|
|
57
|
-
payload: { validations },
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
expect(reducer(defaultState, action)).toEqual(
|
|
61
|
-
{
|
|
62
|
-
...defaultState,
|
|
63
|
-
usernameSuggestions,
|
|
64
|
-
validations: validationWithoutUsernameSuggestions,
|
|
65
|
-
},
|
|
66
|
-
);
|
|
67
|
-
});
|
|
68
|
-
|
|
69
|
-
it('should set email suggestions', () => {
|
|
70
|
-
const emailSuggestion = {
|
|
71
|
-
type: 'test type',
|
|
72
|
-
suggestion: 'test suggestion',
|
|
73
|
-
};
|
|
74
|
-
const action = {
|
|
75
|
-
type: REGISTER_SET_EMAIL_SUGGESTIONS,
|
|
76
|
-
payload: { emailSuggestion },
|
|
77
|
-
};
|
|
78
|
-
|
|
79
|
-
expect(reducer(defaultState, action)).toEqual(
|
|
80
|
-
{
|
|
81
|
-
...defaultState,
|
|
82
|
-
registrationFormData: {
|
|
83
|
-
...defaultState.registrationFormData,
|
|
84
|
-
emailSuggestion: {
|
|
85
|
-
type: 'test type', suggestion: 'test suggestion',
|
|
86
|
-
},
|
|
87
|
-
},
|
|
88
|
-
}
|
|
89
|
-
);
|
|
90
|
-
});
|
|
91
|
-
|
|
92
|
-
it('should set redirect url dashboard on registration success action', () => {
|
|
93
|
-
const payload = {
|
|
94
|
-
redirectUrl: `${getSiteConfig().baseUrl}${DEFAULT_REDIRECT_URL}`,
|
|
95
|
-
success: true,
|
|
96
|
-
};
|
|
97
|
-
const action = {
|
|
98
|
-
type: REGISTER_NEW_USER.SUCCESS,
|
|
99
|
-
payload,
|
|
100
|
-
};
|
|
101
|
-
|
|
102
|
-
expect(reducer(defaultState, action)).toEqual(
|
|
103
|
-
{
|
|
104
|
-
...defaultState,
|
|
105
|
-
registrationResult: payload,
|
|
106
|
-
},
|
|
107
|
-
);
|
|
108
|
-
});
|
|
109
|
-
|
|
110
|
-
it('should set the registration call and set the registration error object empty', () => {
|
|
111
|
-
const action = {
|
|
112
|
-
type: REGISTER_NEW_USER.BEGIN,
|
|
113
|
-
};
|
|
114
|
-
|
|
115
|
-
expect(reducer({
|
|
116
|
-
...defaultState,
|
|
117
|
-
registrationError: {
|
|
118
|
-
email: 'This email already exist.',
|
|
119
|
-
},
|
|
120
|
-
}, action)).toEqual(
|
|
121
|
-
{
|
|
122
|
-
...defaultState,
|
|
123
|
-
submitState: PENDING_STATE,
|
|
124
|
-
registrationError: {},
|
|
125
|
-
},
|
|
126
|
-
);
|
|
127
|
-
});
|
|
128
|
-
|
|
129
|
-
it('should show username suggestions returned by registration error', () => {
|
|
130
|
-
const payload = { usernameSuggestions: ['test12'] };
|
|
131
|
-
const action = {
|
|
132
|
-
type: REGISTER_NEW_USER.FAILURE,
|
|
133
|
-
payload,
|
|
134
|
-
};
|
|
135
|
-
|
|
136
|
-
expect(reducer(defaultState, action)).toEqual(
|
|
137
|
-
{
|
|
138
|
-
...defaultState,
|
|
139
|
-
registrationError: payload,
|
|
140
|
-
usernameSuggestions: payload.usernameSuggestions,
|
|
141
|
-
},
|
|
142
|
-
);
|
|
143
|
-
});
|
|
144
|
-
it('should set the register user when SSO pipeline data is loaded', () => {
|
|
145
|
-
const payload = { value: true };
|
|
146
|
-
const action = {
|
|
147
|
-
type: REGISTER_SET_USER_PIPELINE_DATA_LOADED,
|
|
148
|
-
payload,
|
|
149
|
-
};
|
|
150
|
-
|
|
151
|
-
expect(reducer(defaultState, action)).toEqual(
|
|
152
|
-
{
|
|
153
|
-
...defaultState,
|
|
154
|
-
userPipelineDataLoaded: true,
|
|
155
|
-
},
|
|
156
|
-
);
|
|
157
|
-
});
|
|
158
|
-
|
|
159
|
-
it('should set country code on blur', () => {
|
|
160
|
-
const action = {
|
|
161
|
-
type: REGISTER_SET_COUNTRY_CODE,
|
|
162
|
-
payload: { countryCode: 'PK' },
|
|
163
|
-
};
|
|
164
|
-
|
|
165
|
-
expect(reducer({
|
|
166
|
-
...defaultState,
|
|
167
|
-
registrationFormData: {
|
|
168
|
-
...defaultState.registrationFormData,
|
|
169
|
-
configurableFormFields: {
|
|
170
|
-
...defaultState.registrationFormData.configurableFormFields,
|
|
171
|
-
country: {
|
|
172
|
-
name: 'Pakistan',
|
|
173
|
-
code: 'PK',
|
|
174
|
-
},
|
|
175
|
-
},
|
|
176
|
-
},
|
|
177
|
-
}, action)).toEqual(
|
|
178
|
-
{
|
|
179
|
-
...defaultState,
|
|
180
|
-
registrationFormData: {
|
|
181
|
-
...defaultState.registrationFormData,
|
|
182
|
-
configurableFormFields: {
|
|
183
|
-
...defaultState.registrationFormData.configurableFormFields,
|
|
184
|
-
country: {
|
|
185
|
-
name: 'Pakistan',
|
|
186
|
-
code: 'PK',
|
|
187
|
-
},
|
|
188
|
-
},
|
|
189
|
-
},
|
|
190
|
-
},
|
|
191
|
-
);
|
|
192
|
-
});
|
|
193
|
-
it(' registration api failure when api rate limit hits', () => {
|
|
194
|
-
const action = {
|
|
195
|
-
type: REGISTER_FORM_VALIDATIONS.FAILURE,
|
|
196
|
-
};
|
|
197
|
-
|
|
198
|
-
expect(reducer(defaultState, action)).toEqual(
|
|
199
|
-
{
|
|
200
|
-
...defaultState,
|
|
201
|
-
validationApiRateLimited: true,
|
|
202
|
-
validations: null,
|
|
203
|
-
},
|
|
204
|
-
);
|
|
205
|
-
});
|
|
206
|
-
it('should clear username suggestions', () => {
|
|
207
|
-
const state = {
|
|
208
|
-
...defaultState,
|
|
209
|
-
usernameSuggestions: ['test_1'],
|
|
210
|
-
};
|
|
211
|
-
const action = {
|
|
212
|
-
type: REGISTER_CLEAR_USERNAME_SUGGESTIONS,
|
|
213
|
-
};
|
|
214
|
-
|
|
215
|
-
expect(reducer(state, action)).toEqual({ ...defaultState });
|
|
216
|
-
});
|
|
217
|
-
|
|
218
|
-
it('should take back data during form reset', () => {
|
|
219
|
-
const state = {
|
|
220
|
-
...defaultState,
|
|
221
|
-
shouldBackupState: true,
|
|
222
|
-
};
|
|
223
|
-
const action = {
|
|
224
|
-
type: BACKUP_REGISTRATION_DATA.BASE,
|
|
225
|
-
};
|
|
226
|
-
|
|
227
|
-
expect(reducer(state, action)).toEqual({
|
|
228
|
-
...defaultState,
|
|
229
|
-
shouldBackupState: true,
|
|
230
|
-
});
|
|
231
|
-
});
|
|
232
|
-
|
|
233
|
-
it('should not reset username suggestions and fields data during form reset', () => {
|
|
234
|
-
const state = {
|
|
235
|
-
...defaultState,
|
|
236
|
-
usernameSuggestions: ['test1', 'test2'],
|
|
237
|
-
};
|
|
238
|
-
const action = {
|
|
239
|
-
type: BACKUP_REGISTRATION_DATA.BEGIN,
|
|
240
|
-
payload: { ...state.registrationFormData },
|
|
241
|
-
};
|
|
242
|
-
|
|
243
|
-
expect(reducer(state, action)).toEqual(state);
|
|
244
|
-
});
|
|
245
|
-
|
|
246
|
-
it('should reset email error field data on focus of email field', () => {
|
|
247
|
-
const state = {
|
|
248
|
-
...defaultState,
|
|
249
|
-
registrationError: { email: `This email is already associated with an existing or previous ${getSiteConfig().siteName} account` },
|
|
250
|
-
};
|
|
251
|
-
const action = {
|
|
252
|
-
type: REGISTRATION_CLEAR_BACKEND_ERROR,
|
|
253
|
-
payload: 'email',
|
|
254
|
-
};
|
|
255
|
-
|
|
256
|
-
expect(reducer(state, action)).toEqual({
|
|
257
|
-
...state,
|
|
258
|
-
registrationError: {},
|
|
259
|
-
});
|
|
260
|
-
});
|
|
261
|
-
|
|
262
|
-
it('should set country code', () => {
|
|
263
|
-
const countryCode = 'PK';
|
|
264
|
-
|
|
265
|
-
const action = {
|
|
266
|
-
type: REGISTER_SET_COUNTRY_CODE,
|
|
267
|
-
payload: { countryCode },
|
|
268
|
-
};
|
|
269
|
-
|
|
270
|
-
expect(reducer(defaultState, action)).toEqual(
|
|
271
|
-
{
|
|
272
|
-
...defaultState,
|
|
273
|
-
backendCountryCode: countryCode,
|
|
274
|
-
},
|
|
275
|
-
);
|
|
276
|
-
});
|
|
277
|
-
});
|
|
@@ -1,239 +0,0 @@
|
|
|
1
|
-
import { camelCaseObject } from '@openedx/frontend-base';
|
|
2
|
-
import { runSaga } from 'redux-saga';
|
|
3
|
-
|
|
4
|
-
import { initializeMockServices } from '../../../setupTest';
|
|
5
|
-
import * as actions from '../actions';
|
|
6
|
-
import { FORBIDDEN_REQUEST, INTERNAL_SERVER_ERROR } from '../constants';
|
|
7
|
-
import {
|
|
8
|
-
fetchRealtimeValidations,
|
|
9
|
-
handleNewUserRegistration,
|
|
10
|
-
} from '../sagas';
|
|
11
|
-
import * as api from '../service';
|
|
12
|
-
|
|
13
|
-
const { loggingService } = initializeMockServices();
|
|
14
|
-
|
|
15
|
-
describe('fetchRealtimeValidations', () => {
|
|
16
|
-
const params = {
|
|
17
|
-
payload: {
|
|
18
|
-
registrationFormData: {
|
|
19
|
-
email: 'test@test.com',
|
|
20
|
-
username: '',
|
|
21
|
-
password: 'test-password',
|
|
22
|
-
name: 'test-name',
|
|
23
|
-
honor_code: true,
|
|
24
|
-
country: 'test-country',
|
|
25
|
-
},
|
|
26
|
-
},
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
beforeEach(() => {
|
|
30
|
-
loggingService.logInfo.mockReset();
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
const data = {
|
|
34
|
-
validationDecisions: {
|
|
35
|
-
username: 'Username must be between 2 and 30 characters long.',
|
|
36
|
-
},
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
it('should call service and dispatch success action', async () => {
|
|
40
|
-
const getFieldsValidations = jest.spyOn(api, 'getFieldsValidations')
|
|
41
|
-
.mockImplementation(() => Promise.resolve({ fieldValidations: data }));
|
|
42
|
-
|
|
43
|
-
const dispatched = [];
|
|
44
|
-
await runSaga(
|
|
45
|
-
{ dispatch: (action) => dispatched.push(action) },
|
|
46
|
-
fetchRealtimeValidations,
|
|
47
|
-
params,
|
|
48
|
-
);
|
|
49
|
-
|
|
50
|
-
expect(getFieldsValidations).toHaveBeenCalledTimes(1);
|
|
51
|
-
expect(dispatched).toEqual([
|
|
52
|
-
actions.fetchRealtimeValidationsBegin(),
|
|
53
|
-
actions.fetchRealtimeValidationsSuccess(data),
|
|
54
|
-
]);
|
|
55
|
-
getFieldsValidations.mockClear();
|
|
56
|
-
});
|
|
57
|
-
|
|
58
|
-
it('should call service and dispatch error action', async () => {
|
|
59
|
-
const validationRatelimitResponse = {
|
|
60
|
-
response: {
|
|
61
|
-
status: 403,
|
|
62
|
-
data: {
|
|
63
|
-
detail: 'You do not have permission to perform this action.',
|
|
64
|
-
},
|
|
65
|
-
},
|
|
66
|
-
};
|
|
67
|
-
const getFieldsValidations = jest.spyOn(api, 'getFieldsValidations')
|
|
68
|
-
.mockImplementation(() => Promise.reject(validationRatelimitResponse));
|
|
69
|
-
|
|
70
|
-
const dispatched = [];
|
|
71
|
-
await runSaga(
|
|
72
|
-
{ dispatch: (action) => dispatched.push(action) },
|
|
73
|
-
fetchRealtimeValidations,
|
|
74
|
-
params,
|
|
75
|
-
);
|
|
76
|
-
|
|
77
|
-
expect(getFieldsValidations).toHaveBeenCalledTimes(1);
|
|
78
|
-
expect(loggingService.logInfo).toHaveBeenCalled();
|
|
79
|
-
expect(dispatched).toEqual([
|
|
80
|
-
actions.fetchRealtimeValidationsBegin(),
|
|
81
|
-
actions.fetchRealtimeValidationsFailure(
|
|
82
|
-
validationRatelimitResponse.response.data,
|
|
83
|
-
validationRatelimitResponse.response.status,
|
|
84
|
-
),
|
|
85
|
-
]);
|
|
86
|
-
getFieldsValidations.mockClear();
|
|
87
|
-
});
|
|
88
|
-
|
|
89
|
-
it('should call logError on 500 server error', async () => {
|
|
90
|
-
const validationRatelimitResponse = {
|
|
91
|
-
response: {
|
|
92
|
-
status: 500,
|
|
93
|
-
data: {},
|
|
94
|
-
},
|
|
95
|
-
};
|
|
96
|
-
const getFieldsValidations = jest.spyOn(api, 'getFieldsValidations')
|
|
97
|
-
.mockImplementation(() => Promise.reject(validationRatelimitResponse));
|
|
98
|
-
|
|
99
|
-
const dispatched = [];
|
|
100
|
-
await runSaga(
|
|
101
|
-
{ dispatch: (action) => dispatched.push(action) },
|
|
102
|
-
fetchRealtimeValidations,
|
|
103
|
-
params,
|
|
104
|
-
);
|
|
105
|
-
|
|
106
|
-
expect(getFieldsValidations).toHaveBeenCalledTimes(1);
|
|
107
|
-
expect(loggingService.logError).toHaveBeenCalled();
|
|
108
|
-
getFieldsValidations.mockClear();
|
|
109
|
-
});
|
|
110
|
-
});
|
|
111
|
-
|
|
112
|
-
describe('handleNewUserRegistration', () => {
|
|
113
|
-
const params = {
|
|
114
|
-
payload: {
|
|
115
|
-
registrationFormData: {
|
|
116
|
-
email: 'test@test.com',
|
|
117
|
-
username: 'test-username',
|
|
118
|
-
password: 'test-password',
|
|
119
|
-
name: 'test-name',
|
|
120
|
-
honor_code: true,
|
|
121
|
-
country: 'test-country',
|
|
122
|
-
},
|
|
123
|
-
},
|
|
124
|
-
};
|
|
125
|
-
|
|
126
|
-
beforeEach(() => {
|
|
127
|
-
loggingService.logError.mockReset();
|
|
128
|
-
loggingService.logInfo.mockReset();
|
|
129
|
-
});
|
|
130
|
-
|
|
131
|
-
it('should call service and dispatch success action', async () => {
|
|
132
|
-
const authenticatedUser = { username: 'test', user_id: 123 };
|
|
133
|
-
const data = {
|
|
134
|
-
redirectUrl: '/dashboard',
|
|
135
|
-
success: true,
|
|
136
|
-
authenticatedUser,
|
|
137
|
-
};
|
|
138
|
-
const registerRequest = jest.spyOn(api, 'registerRequest')
|
|
139
|
-
.mockImplementation(() => Promise.resolve(data));
|
|
140
|
-
|
|
141
|
-
const dispatched = [];
|
|
142
|
-
await runSaga(
|
|
143
|
-
{ dispatch: (action) => dispatched.push(action) },
|
|
144
|
-
handleNewUserRegistration,
|
|
145
|
-
params,
|
|
146
|
-
);
|
|
147
|
-
|
|
148
|
-
expect(registerRequest).toHaveBeenCalledTimes(1);
|
|
149
|
-
expect(dispatched).toEqual([
|
|
150
|
-
actions.registerNewUserBegin(),
|
|
151
|
-
actions.registerNewUserSuccess(camelCaseObject(authenticatedUser), data.redirectUrl, data.success),
|
|
152
|
-
]);
|
|
153
|
-
registerRequest.mockClear();
|
|
154
|
-
});
|
|
155
|
-
|
|
156
|
-
it('should handle 500 error code', async () => {
|
|
157
|
-
const registerErrorResponse = {
|
|
158
|
-
response: {
|
|
159
|
-
status: 500,
|
|
160
|
-
data: {
|
|
161
|
-
errorCode: INTERNAL_SERVER_ERROR,
|
|
162
|
-
},
|
|
163
|
-
},
|
|
164
|
-
};
|
|
165
|
-
|
|
166
|
-
const registerRequest = jest.spyOn(api, 'registerRequest').mockImplementation(() => Promise.reject(registerErrorResponse));
|
|
167
|
-
|
|
168
|
-
const dispatched = [];
|
|
169
|
-
await runSaga(
|
|
170
|
-
{ dispatch: (action) => dispatched.push(action) },
|
|
171
|
-
handleNewUserRegistration,
|
|
172
|
-
params,
|
|
173
|
-
);
|
|
174
|
-
|
|
175
|
-
expect(loggingService.logError).toHaveBeenCalled();
|
|
176
|
-
expect(dispatched).toEqual([
|
|
177
|
-
actions.registerNewUserBegin(),
|
|
178
|
-
actions.registerNewUserFailure(camelCaseObject(registerErrorResponse.response.data)),
|
|
179
|
-
]);
|
|
180
|
-
registerRequest.mockClear();
|
|
181
|
-
});
|
|
182
|
-
|
|
183
|
-
it('should call service and dispatch error action', async () => {
|
|
184
|
-
const registerErrorResponse = {
|
|
185
|
-
response: {
|
|
186
|
-
status: 400,
|
|
187
|
-
data: {
|
|
188
|
-
error: 'something went wrong',
|
|
189
|
-
},
|
|
190
|
-
},
|
|
191
|
-
};
|
|
192
|
-
const registerRequest = jest.spyOn(api, 'registerRequest')
|
|
193
|
-
.mockImplementation(() => Promise.reject(registerErrorResponse));
|
|
194
|
-
|
|
195
|
-
const dispatched = [];
|
|
196
|
-
await runSaga(
|
|
197
|
-
{ dispatch: (action) => dispatched.push(action) },
|
|
198
|
-
handleNewUserRegistration,
|
|
199
|
-
params,
|
|
200
|
-
);
|
|
201
|
-
|
|
202
|
-
expect(registerRequest).toHaveBeenCalledTimes(1);
|
|
203
|
-
expect(loggingService.logInfo).toHaveBeenCalled();
|
|
204
|
-
expect(dispatched).toEqual([
|
|
205
|
-
actions.registerNewUserBegin(),
|
|
206
|
-
actions.registerNewUserFailure(registerErrorResponse.response.data),
|
|
207
|
-
]);
|
|
208
|
-
registerRequest.mockClear();
|
|
209
|
-
});
|
|
210
|
-
|
|
211
|
-
it('should handle rate limit error code', async () => {
|
|
212
|
-
const registerErrorResponse = {
|
|
213
|
-
response: {
|
|
214
|
-
status: 403,
|
|
215
|
-
data: {
|
|
216
|
-
errorCode: FORBIDDEN_REQUEST,
|
|
217
|
-
},
|
|
218
|
-
},
|
|
219
|
-
};
|
|
220
|
-
|
|
221
|
-
const registerRequest = jest.spyOn(api, 'registerRequest')
|
|
222
|
-
.mockImplementation(() => Promise.reject(registerErrorResponse));
|
|
223
|
-
|
|
224
|
-
const dispatched = [];
|
|
225
|
-
await runSaga(
|
|
226
|
-
{ dispatch: (action) => dispatched.push(action) },
|
|
227
|
-
handleNewUserRegistration,
|
|
228
|
-
params,
|
|
229
|
-
);
|
|
230
|
-
|
|
231
|
-
expect(registerRequest).toHaveBeenCalledTimes(1);
|
|
232
|
-
expect(loggingService.logInfo).toHaveBeenCalled();
|
|
233
|
-
expect(dispatched).toEqual([
|
|
234
|
-
actions.registerNewUserBegin(),
|
|
235
|
-
actions.registerNewUserFailure(registerErrorResponse.response.data),
|
|
236
|
-
]);
|
|
237
|
-
registerRequest.mockClear();
|
|
238
|
-
});
|
|
239
|
-
});
|