@openedx/frontend-app-authn 1.0.0-alpha.5 → 1.0.0-alpha.6
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/{src/Main.tsx → dist/Main.js} +4 -15
- 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/{src/common-components/EmbeddedRegistrationRoute.jsx → dist/common-components/EmbeddedRegistrationRoute.js} +9 -13
- package/dist/common-components/EmbeddedRegistrationRoute.js.map +1 -0
- package/dist/common-components/EnterpriseSSO.d.ts +29 -0
- package/dist/common-components/EnterpriseSSO.js +55 -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 +39 -0
- package/dist/common-components/PasswordField.js +94 -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 +68 -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 +42 -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 +56 -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 +31 -0
- package/dist/common-components/UnAuthOnlyRoute.js.map +1 -0
- package/dist/common-components/data/actions.d.ts +26 -0
- package/{src → dist}/common-components/data/actions.js +8 -13
- package/dist/common-components/data/actions.js.map +1 -0
- package/dist/common-components/data/reducers.d.ts +62 -0
- package/dist/common-components/data/reducers.js +39 -0
- package/dist/common-components/data/reducers.js.map +1 -0
- package/dist/common-components/data/sagas.d.ts +12 -0
- package/dist/common-components/data/sagas.js +21 -0
- package/dist/common-components/data/sagas.js.map +1 -0
- package/dist/common-components/data/selectors.d.ts +98 -0
- package/dist/common-components/data/selectors.js +11 -0
- package/dist/common-components/data/selectors.js.map +1 -0
- package/dist/common-components/data/service.d.ts +5 -0
- package/dist/common-components/data/service.js +31 -0
- package/dist/common-components/data/service.js.map +1 -0
- package/dist/common-components/index.d.ts +13 -0
- package/{src/common-components/index.jsx → dist/common-components/index.js} +1 -0
- 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 +1 -0
- package/{src/constants.ts → dist/constants.js} +1 -0
- package/dist/constants.js.map +1 -0
- package/dist/data/configureStore.d.ts +3 -0
- package/{src → dist}/data/configureStore.js +11 -20
- package/dist/data/configureStore.js.map +1 -0
- package/dist/data/constants.d.ts +24 -0
- package/{src → dist}/data/constants.js +4 -8
- 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/reducers.d.ts +254 -0
- package/dist/data/reducers.js +17 -0
- package/dist/data/reducers.js.map +1 -0
- package/dist/data/sagas.d.ts +1 -0
- package/{src → dist}/data/sagas.js +9 -10
- package/dist/data/sagas.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 +11 -0
- package/dist/data/utils/dataUtils.js +67 -0
- package/dist/data/utils/dataUtils.js.map +1 -0
- package/dist/data/utils/index.d.ts +3 -0
- package/dist/data/utils/index.js +4 -0
- package/dist/data/utils/index.js.map +1 -0
- package/dist/data/utils/reduxUtils.d.ts +15 -0
- package/dist/data/utils/reduxUtils.js +29 -0
- package/dist/data/utils/reduxUtils.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 +36 -0
- package/dist/forgot-password/ForgotPasswordPage.js +91 -0
- package/dist/forgot-password/ForgotPasswordPage.js.map +1 -0
- package/dist/forgot-password/data/actions.d.ts +30 -0
- package/{src → dist}/forgot-password/data/actions.js +10 -16
- package/dist/forgot-password/data/actions.js.map +1 -0
- package/dist/forgot-password/data/reducers.d.ts +13 -0
- package/dist/forgot-password/data/reducers.js +46 -0
- package/dist/forgot-password/data/reducers.js.map +1 -0
- package/dist/forgot-password/data/sagas.d.ts +4 -0
- package/dist/forgot-password/data/sagas.js +28 -0
- package/dist/forgot-password/data/sagas.js.map +1 -0
- package/dist/forgot-password/data/selectors.d.ts +23 -0
- package/dist/forgot-password/data/selectors.js +5 -0
- package/dist/forgot-password/data/selectors.js.map +1 -0
- package/dist/forgot-password/data/service.d.ts +1 -0
- package/dist/forgot-password/data/service.js +26 -0
- package/dist/forgot-password/data/service.js.map +1 -0
- package/dist/forgot-password/index.d.ts +5 -0
- package/{src → dist}/forgot-password/index.js +1 -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 +45 -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 +10 -0
- package/dist/login/LoginPage.js +216 -0
- package/dist/login/LoginPage.js.map +1 -0
- package/dist/login/data/actions.d.ts +36 -0
- package/{src → dist}/login/data/actions.js +12 -19
- package/dist/login/data/actions.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/data/reducers.d.ts +82 -0
- package/dist/login/data/reducers.js +44 -0
- package/dist/login/data/reducers.js.map +1 -0
- package/dist/login/data/sagas.d.ts +10 -0
- package/dist/login/data/sagas.js +34 -0
- package/dist/login/data/sagas.js.map +1 -0
- package/dist/login/data/service.d.ts +4 -0
- package/dist/login/data/service.js +32 -0
- package/dist/login/data/service.js.map +1 -0
- package/dist/login/index.d.ts +4 -0
- package/{src → dist}/login/index.js +1 -1
- 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 +32 -0
- package/dist/logistration/Logistration.js +106 -0
- package/dist/logistration/Logistration.js.map +1 -0
- package/dist/progressive-profiling/ProgressiveProfiling.d.ts +46 -0
- package/dist/progressive-profiling/ProgressiveProfiling.js +167 -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 +24 -0
- package/dist/progressive-profiling/ProgressiveProfilingPageModal.js.map +1 -0
- package/dist/progressive-profiling/data/actions.d.ts +19 -0
- package/{src → dist}/progressive-profiling/data/actions.js +6 -10
- package/dist/progressive-profiling/data/actions.js.map +1 -0
- package/dist/progressive-profiling/data/reducers.d.ts +22 -0
- package/dist/progressive-profiling/data/reducers.js +23 -0
- package/dist/progressive-profiling/data/reducers.js.map +1 -0
- package/dist/progressive-profiling/data/sagas.d.ts +4 -0
- package/dist/progressive-profiling/data/sagas.js +17 -0
- package/dist/progressive-profiling/data/sagas.js.map +1 -0
- package/dist/progressive-profiling/data/selectors.d.ts +39 -0
- package/{src → dist}/progressive-profiling/data/selectors.js +4 -9
- package/dist/progressive-profiling/data/selectors.js.map +1 -0
- package/dist/progressive-profiling/data/service.d.ts +1 -0
- package/dist/progressive-profiling/data/service.js +23 -0
- package/dist/progressive-profiling/data/service.js.map +1 -0
- package/dist/progressive-profiling/index.d.ts +4 -0
- package/{src → dist}/progressive-profiling/index.js +1 -1
- 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 +95 -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 +80 -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 +52 -0
- package/dist/register/RegistrationFields/NameField/NameField.js.map +1 -0
- package/dist/register/RegistrationFields/NameField/validator.d.ts +5 -0
- package/{src → dist}/register/RegistrationFields/NameField/validator.js +9 -12
- 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 +113 -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 +216 -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/RegistrationFailure.d.ts +19 -0
- package/dist/register/components/RegistrationFailure.js +57 -0
- package/dist/register/components/RegistrationFailure.js.map +1 -0
- package/dist/register/data/actions.d.ts +80 -0
- package/{src → dist}/register/data/actions.js +26 -42
- package/dist/register/data/actions.js.map +1 -0
- package/dist/register/data/constants.d.ts +10 -0
- package/{src → dist}/register/data/constants.js +4 -4
- package/dist/register/data/constants.js.map +1 -0
- package/dist/register/data/reducers.d.ts +237 -0
- package/dist/register/data/reducers.js +86 -0
- package/dist/register/data/reducers.js.map +1 -0
- package/dist/register/data/sagas.d.ts +19 -0
- package/dist/register/data/sagas.js +45 -0
- package/dist/register/data/sagas.js.map +1 -0
- package/dist/register/data/selectors.d.ts +26 -0
- package/dist/register/data/selectors.js +25 -0
- package/dist/register/data/selectors.js.map +1 -0
- package/dist/register/data/service.d.ts +8 -0
- package/dist/register/data/service.js +46 -0
- package/dist/register/data/service.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 +3 -0
- package/{src → dist}/register/index.js +1 -0
- package/dist/register/index.js.map +1 -0
- package/dist/register/messages.d.ts +193 -0
- package/dist/register/messages.js +205 -0
- package/dist/register/messages.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 +32 -0
- package/dist/reset-password/ResetPasswordPage.js +150 -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/actions.d.ts +56 -0
- package/{src → dist}/reset-password/data/actions.js +17 -26
- package/dist/reset-password/data/actions.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/data/reducers.d.ts +19 -0
- package/dist/reset-password/data/reducers.js +25 -0
- package/dist/reset-password/data/reducers.js.map +1 -0
- package/dist/reset-password/data/sagas.d.ts +7 -0
- package/dist/reset-password/data/sagas.js +63 -0
- package/dist/reset-password/data/sagas.js.map +1 -0
- package/dist/reset-password/data/selectors.d.ts +23 -0
- package/dist/reset-password/data/selectors.js +5 -0
- package/dist/reset-password/data/selectors.js.map +1 -0
- package/dist/reset-password/data/service.d.ts +3 -0
- package/dist/reset-password/data/service.js +62 -0
- package/dist/reset-password/data/service.js.map +1 -0
- package/dist/reset-password/index.d.ts +5 -0
- package/{src → dist}/reset-password/index.js +1 -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 +18 -0
- package/dist/routes.js +75 -0
- package/dist/routes.js.map +1 -0
- package/package.json +12 -5
- 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/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/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/data/oneTrust.js +0 -3
- package/src/data/reducers.js +0 -36
- 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/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/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/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/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/reducers.js +0 -38
- package/src/progressive-profiling/data/sagas.js +0 -24
- 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/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/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/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/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/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/_registration.scss +0 -0
- /package/{src → dist}/sass/_reset_password.scss +0 -0
- /package/{src → dist}/sass/_style.scss +0 -0
package/src/data/reducers.js
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { combineReducers } from 'redux';
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
reducer as commonComponentsReducer,
|
|
5
|
-
storeName as commonComponentsStoreName,
|
|
6
|
-
} from '../common-components';
|
|
7
|
-
import {
|
|
8
|
-
reducer as forgotPasswordReducer,
|
|
9
|
-
storeName as forgotPasswordStoreName,
|
|
10
|
-
} from '../forgot-password';
|
|
11
|
-
import {
|
|
12
|
-
reducer as loginReducer,
|
|
13
|
-
storeName as loginStoreName,
|
|
14
|
-
} from '../login';
|
|
15
|
-
import {
|
|
16
|
-
reducer as authnProgressiveProfilingReducers,
|
|
17
|
-
storeName as authnProgressiveProfilingStoreName,
|
|
18
|
-
} from '../progressive-profiling';
|
|
19
|
-
import {
|
|
20
|
-
reducer as registerReducer,
|
|
21
|
-
storeName as registerStoreName,
|
|
22
|
-
} from '../register';
|
|
23
|
-
import {
|
|
24
|
-
reducer as resetPasswordReducer,
|
|
25
|
-
storeName as resetPasswordStoreName,
|
|
26
|
-
} from '../reset-password';
|
|
27
|
-
|
|
28
|
-
const createRootReducer = () => combineReducers({
|
|
29
|
-
[loginStoreName]: loginReducer,
|
|
30
|
-
[registerStoreName]: registerReducer,
|
|
31
|
-
[commonComponentsStoreName]: commonComponentsReducer,
|
|
32
|
-
[forgotPasswordStoreName]: forgotPasswordReducer,
|
|
33
|
-
[resetPasswordStoreName]: resetPasswordReducer,
|
|
34
|
-
[authnProgressiveProfilingStoreName]: authnProgressiveProfilingReducers,
|
|
35
|
-
});
|
|
36
|
-
export default createRootReducer;
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import Cookies from 'universal-cookie';
|
|
2
|
-
|
|
3
|
-
import { setCookie } from '../utils';
|
|
4
|
-
|
|
5
|
-
// Mock Cookies class
|
|
6
|
-
jest.mock('universal-cookie');
|
|
7
|
-
|
|
8
|
-
describe('setCookie function', () => {
|
|
9
|
-
beforeEach(() => {
|
|
10
|
-
jest.clearAllMocks();
|
|
11
|
-
});
|
|
12
|
-
|
|
13
|
-
it('should set a cookie with default options', () => {
|
|
14
|
-
setCookie('testCookie', 'testValue', 'example.com');
|
|
15
|
-
|
|
16
|
-
expect(Cookies).toHaveBeenCalled();
|
|
17
|
-
expect(Cookies).toHaveBeenCalledWith();
|
|
18
|
-
expect(Cookies.prototype.set).toHaveBeenCalledWith('testCookie', 'testValue', {
|
|
19
|
-
domain: 'example.com',
|
|
20
|
-
path: '/',
|
|
21
|
-
});
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
it('should set a cookie with specified expiry', () => {
|
|
25
|
-
const expiry = new Date('2023-12-31');
|
|
26
|
-
setCookie('testCookie', 'testValue', 'example.com', expiry);
|
|
27
|
-
|
|
28
|
-
expect(Cookies).toHaveBeenCalled();
|
|
29
|
-
expect(Cookies).toHaveBeenCalledWith();
|
|
30
|
-
expect(Cookies.prototype.set).toHaveBeenCalledWith('testCookie', 'testValue', {
|
|
31
|
-
domain: 'example.com',
|
|
32
|
-
path: '/',
|
|
33
|
-
expires: expiry,
|
|
34
|
-
});
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
it('should not set a cookie if cookieName is undefined', () => {
|
|
38
|
-
setCookie(undefined, 'testValue', 'example.com');
|
|
39
|
-
|
|
40
|
-
expect(Cookies).not.toHaveBeenCalled();
|
|
41
|
-
});
|
|
42
|
-
});
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { LOGIN_PAGE } from '../constants';
|
|
2
|
-
import { updatePathWithQueryParams } from '../utils/dataUtils';
|
|
3
|
-
|
|
4
|
-
describe('updatePathWithQueryParams', () => {
|
|
5
|
-
it('should append query params into the path', () => {
|
|
6
|
-
const params = '?course_id=testCourseId';
|
|
7
|
-
const expectedPath = `${LOGIN_PAGE}${params}`;
|
|
8
|
-
|
|
9
|
-
Object.defineProperty(window, 'location', {
|
|
10
|
-
value: {
|
|
11
|
-
href: 'http://localhost/',
|
|
12
|
-
search: params,
|
|
13
|
-
},
|
|
14
|
-
});
|
|
15
|
-
const updatedPath = updatePathWithQueryParams(LOGIN_PAGE);
|
|
16
|
-
|
|
17
|
-
expect(updatedPath).toEqual(expectedPath);
|
|
18
|
-
});
|
|
19
|
-
});
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import AsyncActionType from '../utils/reduxUtils';
|
|
2
|
-
|
|
3
|
-
describe('AsyncActionType', () => {
|
|
4
|
-
it('should return well formatted action strings', () => {
|
|
5
|
-
const actionType = new AsyncActionType('HOUSE_CATS', 'START_THE_RACE');
|
|
6
|
-
|
|
7
|
-
expect(actionType.BASE).toBe('HOUSE_CATS__START_THE_RACE');
|
|
8
|
-
expect(actionType.BEGIN).toBe('HOUSE_CATS__START_THE_RACE__BEGIN');
|
|
9
|
-
expect(actionType.SUCCESS).toBe('HOUSE_CATS__START_THE_RACE__SUCCESS');
|
|
10
|
-
expect(actionType.FAILURE).toBe('HOUSE_CATS__START_THE_RACE__FAILURE');
|
|
11
|
-
expect(actionType.RESET).toBe('HOUSE_CATS__START_THE_RACE__RESET');
|
|
12
|
-
expect(actionType.FORBIDDEN).toBe('HOUSE_CATS__START_THE_RACE__FORBIDDEN');
|
|
13
|
-
});
|
|
14
|
-
});
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import Cookies from 'universal-cookie';
|
|
2
|
-
|
|
3
|
-
export default function setCookie(cookieName, cookieValue, cookieDomain, cookieExpiry) {
|
|
4
|
-
if (cookieName) { // To avoid setting getting exception when setting cookie with undefined names.
|
|
5
|
-
const cookies = new Cookies();
|
|
6
|
-
const options = { domain: cookieDomain, path: '/' };
|
|
7
|
-
if (cookieExpiry) {
|
|
8
|
-
options.expires = cookieExpiry;
|
|
9
|
-
}
|
|
10
|
-
cookies.set(cookieName, cookieValue, options);
|
|
11
|
-
}
|
|
12
|
-
}
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
// Utility functions
|
|
2
|
-
import * as QueryString from 'query-string';
|
|
3
|
-
|
|
4
|
-
import { AUTH_PARAMS } from '../constants';
|
|
5
|
-
|
|
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
|
-
|
|
20
|
-
export const getTpaHint = () => {
|
|
21
|
-
const params = QueryString.parse(window.location.search);
|
|
22
|
-
let tpaHint = null;
|
|
23
|
-
tpaHint = params.tpa_hint;
|
|
24
|
-
if (!tpaHint) {
|
|
25
|
-
const { next } = params;
|
|
26
|
-
if (next) {
|
|
27
|
-
const index = next.indexOf('tpa_hint=');
|
|
28
|
-
if (index !== -1) {
|
|
29
|
-
tpaHint = next.substring(index + 'tpa_hint='.length, next.length);
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
return tpaHint;
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
export const updatePathWithQueryParams = (path) => {
|
|
37
|
-
let queryParams = window.location.search;
|
|
38
|
-
|
|
39
|
-
if (!queryParams) {
|
|
40
|
-
return path;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
if (queryParams.includes('track=pwreset')) {
|
|
44
|
-
queryParams = queryParams.replace('?track=pwreset&', '?',).replace('?track=pwreset', '').replace('&track=pwreset', '').replace('?&', '?');
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
return `${path}${queryParams}`;
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
export const getAllPossibleQueryParams = (locationURl = null) => {
|
|
51
|
-
const urlParams = locationURl ? QueryString.parseUrl(locationURl).query : QueryString.parse(window.location.search);
|
|
52
|
-
const params = {};
|
|
53
|
-
Object.entries(urlParams).forEach(([key, value]) => {
|
|
54
|
-
if (AUTH_PARAMS.includes(key)) {
|
|
55
|
-
params[key] = value;
|
|
56
|
-
}
|
|
57
|
-
});
|
|
58
|
-
|
|
59
|
-
return params;
|
|
60
|
-
};
|
|
61
|
-
|
|
62
|
-
export const getActivationStatus = () => {
|
|
63
|
-
const params = QueryString.parse(window.location.search);
|
|
64
|
-
|
|
65
|
-
return params.account_activation_status;
|
|
66
|
-
};
|
|
67
|
-
|
|
68
|
-
export const isScrollBehaviorSupported = () => 'scrollBehavior' in document.documentElement.style;
|
|
69
|
-
|
|
70
|
-
export const windowScrollTo = (options) => {
|
|
71
|
-
if (isScrollBehaviorSupported()) {
|
|
72
|
-
return window.scrollTo(options);
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
return window.scrollTo(options.top, options.left);
|
|
76
|
-
};
|
|
77
|
-
|
|
78
|
-
export const isHostAvailableInQueryParams = () => {
|
|
79
|
-
const queryParams = getAllPossibleQueryParams();
|
|
80
|
-
return 'host' in queryParams;
|
|
81
|
-
};
|
package/src/data/utils/index.js
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
export {
|
|
2
|
-
getTpaProvider,
|
|
3
|
-
getTpaHint,
|
|
4
|
-
getAllPossibleQueryParams,
|
|
5
|
-
getActivationStatus,
|
|
6
|
-
isHostAvailableInQueryParams,
|
|
7
|
-
updatePathWithQueryParams,
|
|
8
|
-
windowScrollTo,
|
|
9
|
-
} from './dataUtils';
|
|
10
|
-
export { default as AsyncActionType } from './reduxUtils';
|
|
11
|
-
export { default as setCookie } from './cookies';
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Helper class to save time when writing out action types for asynchronous methods. Also helps
|
|
3
|
-
* ensure that actions are namespaced.
|
|
4
|
-
*/
|
|
5
|
-
export default class AsyncActionType {
|
|
6
|
-
constructor(topic, name) {
|
|
7
|
-
this.topic = topic;
|
|
8
|
-
this.name = name;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
get BASE() {
|
|
12
|
-
return `${this.topic}__${this.name}`;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
get BEGIN() {
|
|
16
|
-
return `${this.topic}__${this.name}__BEGIN`;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
get SUCCESS() {
|
|
20
|
-
return `${this.topic}__${this.name}__SUCCESS`;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
get FAILURE() {
|
|
24
|
-
return `${this.topic}__${this.name}__FAILURE`;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
get RESET() {
|
|
28
|
-
return `${this.topic}__${this.name}__RESET`;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
get FORBIDDEN() {
|
|
32
|
-
return `${this.topic}__${this.name}__FORBIDDEN`;
|
|
33
|
-
}
|
|
34
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { useEffect, useState } from 'react';
|
|
2
|
-
|
|
3
|
-
import { breakpoints } from '@openedx/paragon';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* A react hook used to determine if the current window is mobile or not.
|
|
7
|
-
* returns true if the window is of mobile size.
|
|
8
|
-
* Code source: https://github.com/edx/prospectus/blob/master/src/utils/useMobileResponsive.js
|
|
9
|
-
*/
|
|
10
|
-
const useMobileResponsive = (breakpoint) => {
|
|
11
|
-
const [isMobileWindow, setIsMobileWindow] = useState();
|
|
12
|
-
const checkForMobile = () => {
|
|
13
|
-
setIsMobileWindow(window.matchMedia(`(max-width: ${breakpoint ?? breakpoints.small.maxWidth}px)`).matches);
|
|
14
|
-
};
|
|
15
|
-
useEffect(() => {
|
|
16
|
-
checkForMobile();
|
|
17
|
-
window.addEventListener('resize', checkForMobile);
|
|
18
|
-
// return this function here to clean up the event listener
|
|
19
|
-
return () => window.removeEventListener('resize', checkForMobile);
|
|
20
|
-
});
|
|
21
|
-
return isMobileWindow;
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
export default useMobileResponsive;
|
|
@@ -1,156 +0,0 @@
|
|
|
1
|
-
import { Form, Icon } from '@openedx/paragon';
|
|
2
|
-
import { ExpandMore } from '@openedx/paragon/icons';
|
|
3
|
-
import PropTypes from 'prop-types';
|
|
4
|
-
|
|
5
|
-
const FormFieldRenderer = (props) => {
|
|
6
|
-
let formField = null;
|
|
7
|
-
const {
|
|
8
|
-
className, errorMessage, fieldData, onChangeHandler, isRequired, value,
|
|
9
|
-
} = props;
|
|
10
|
-
|
|
11
|
-
const handleFocus = (e) => {
|
|
12
|
-
if (props.handleFocus) { props.handleFocus(e); }
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
const handleOnBlur = (e) => {
|
|
16
|
-
if (props.handleBlur) { props.handleBlur(e); }
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
switch (fieldData.type) {
|
|
20
|
-
case 'select': {
|
|
21
|
-
if (!fieldData.options) {
|
|
22
|
-
return null;
|
|
23
|
-
}
|
|
24
|
-
formField = (
|
|
25
|
-
<Form.Group controlId={fieldData.name} isInvalid={!!(isRequired && errorMessage)}>
|
|
26
|
-
<Form.Control
|
|
27
|
-
className={className}
|
|
28
|
-
as="select"
|
|
29
|
-
name={fieldData.name}
|
|
30
|
-
value={value}
|
|
31
|
-
aria-invalid={isRequired && Boolean(errorMessage)}
|
|
32
|
-
onChange={(e) => onChangeHandler(e)}
|
|
33
|
-
trailingElement={<Icon src={ExpandMore} />}
|
|
34
|
-
floatingLabel={fieldData.label}
|
|
35
|
-
onBlur={handleOnBlur}
|
|
36
|
-
onFocus={handleFocus}
|
|
37
|
-
>
|
|
38
|
-
<option key="default" value="">{fieldData.label}</option>
|
|
39
|
-
{fieldData.options.map(option => (
|
|
40
|
-
<option className="data-hj-suppress" key={option[0]} value={option[0]}>{option[1]}</option>
|
|
41
|
-
))}
|
|
42
|
-
</Form.Control>
|
|
43
|
-
{isRequired && errorMessage && (
|
|
44
|
-
<Form.Control.Feedback id={`${fieldData.name}-error`} type="invalid" className="form-text-size" hasIcon={false}>
|
|
45
|
-
{errorMessage}
|
|
46
|
-
</Form.Control.Feedback>
|
|
47
|
-
)}
|
|
48
|
-
</Form.Group>
|
|
49
|
-
);
|
|
50
|
-
break;
|
|
51
|
-
}
|
|
52
|
-
case 'textarea': {
|
|
53
|
-
formField = (
|
|
54
|
-
<Form.Group controlId={fieldData.name} isInvalid={!!(isRequired && errorMessage)}>
|
|
55
|
-
<Form.Control
|
|
56
|
-
className={className}
|
|
57
|
-
as="textarea"
|
|
58
|
-
name={fieldData.name}
|
|
59
|
-
value={value}
|
|
60
|
-
aria-invalid={isRequired && Boolean(errorMessage)}
|
|
61
|
-
onChange={(e) => onChangeHandler(e)}
|
|
62
|
-
floatingLabel={fieldData.label}
|
|
63
|
-
onBlur={handleOnBlur}
|
|
64
|
-
onFocus={handleFocus}
|
|
65
|
-
/>
|
|
66
|
-
{isRequired && errorMessage && (
|
|
67
|
-
<Form.Control.Feedback id={`${fieldData.name}-error`} type="invalid" className="form-text-size" hasIcon={false}>
|
|
68
|
-
{errorMessage}
|
|
69
|
-
</Form.Control.Feedback>
|
|
70
|
-
)}
|
|
71
|
-
</Form.Group>
|
|
72
|
-
);
|
|
73
|
-
break;
|
|
74
|
-
}
|
|
75
|
-
case 'text': {
|
|
76
|
-
formField = (
|
|
77
|
-
<Form.Group controlId={fieldData.name} isInvalid={!!(isRequired && errorMessage)}>
|
|
78
|
-
<Form.Control
|
|
79
|
-
className={className}
|
|
80
|
-
name={fieldData.name}
|
|
81
|
-
value={value}
|
|
82
|
-
aria-invalid={isRequired && Boolean(errorMessage)}
|
|
83
|
-
onChange={(e) => onChangeHandler(e)}
|
|
84
|
-
floatingLabel={fieldData.label}
|
|
85
|
-
onBlur={handleOnBlur}
|
|
86
|
-
onFocus={handleFocus}
|
|
87
|
-
/>
|
|
88
|
-
{isRequired && errorMessage && (
|
|
89
|
-
<Form.Control.Feedback id={`${fieldData.name}-error`} type="invalid" className="form-text-size" hasIcon={false}>
|
|
90
|
-
{errorMessage}
|
|
91
|
-
</Form.Control.Feedback>
|
|
92
|
-
)}
|
|
93
|
-
</Form.Group>
|
|
94
|
-
);
|
|
95
|
-
break;
|
|
96
|
-
}
|
|
97
|
-
case 'checkbox': {
|
|
98
|
-
formField = (
|
|
99
|
-
<Form.Group isInvalid={!!(isRequired && errorMessage)}>
|
|
100
|
-
<Form.Checkbox
|
|
101
|
-
className={className}
|
|
102
|
-
id={fieldData.name}
|
|
103
|
-
checked={!!value}
|
|
104
|
-
name={fieldData.name}
|
|
105
|
-
value={value}
|
|
106
|
-
aria-invalid={isRequired && Boolean(errorMessage)}
|
|
107
|
-
onChange={(e) => onChangeHandler(e)}
|
|
108
|
-
onBlur={handleOnBlur}
|
|
109
|
-
onFocus={handleFocus}
|
|
110
|
-
>
|
|
111
|
-
{fieldData.label}
|
|
112
|
-
</Form.Checkbox>
|
|
113
|
-
{isRequired && errorMessage && (
|
|
114
|
-
<Form.Control.Feedback id={`${fieldData.name}-error`} type="invalid" className="form-text-size" hasIcon={false}>
|
|
115
|
-
{errorMessage}
|
|
116
|
-
</Form.Control.Feedback>
|
|
117
|
-
)}
|
|
118
|
-
</Form.Group>
|
|
119
|
-
);
|
|
120
|
-
break;
|
|
121
|
-
}
|
|
122
|
-
default:
|
|
123
|
-
break;
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
return formField;
|
|
127
|
-
};
|
|
128
|
-
FormFieldRenderer.defaultProps = {
|
|
129
|
-
className: '',
|
|
130
|
-
value: '',
|
|
131
|
-
handleBlur: null,
|
|
132
|
-
handleFocus: null,
|
|
133
|
-
errorMessage: '',
|
|
134
|
-
isRequired: false,
|
|
135
|
-
};
|
|
136
|
-
|
|
137
|
-
FormFieldRenderer.propTypes = {
|
|
138
|
-
className: PropTypes.string,
|
|
139
|
-
fieldData: PropTypes.shape({
|
|
140
|
-
type: PropTypes.string,
|
|
141
|
-
label: PropTypes.string,
|
|
142
|
-
name: PropTypes.string,
|
|
143
|
-
options: PropTypes.arrayOf(PropTypes.arrayOf(PropTypes.string)),
|
|
144
|
-
}).isRequired,
|
|
145
|
-
onChangeHandler: PropTypes.func.isRequired,
|
|
146
|
-
handleBlur: PropTypes.func,
|
|
147
|
-
handleFocus: PropTypes.func,
|
|
148
|
-
errorMessage: PropTypes.string,
|
|
149
|
-
isRequired: PropTypes.bool,
|
|
150
|
-
value: PropTypes.oneOfType([
|
|
151
|
-
PropTypes.string,
|
|
152
|
-
PropTypes.bool,
|
|
153
|
-
]),
|
|
154
|
-
};
|
|
155
|
-
|
|
156
|
-
export default FormFieldRenderer;
|
|
@@ -1,201 +0,0 @@
|
|
|
1
|
-
import { getSiteConfig } from '@openedx/frontend-base';
|
|
2
|
-
import { fireEvent, render } from '@testing-library/react';
|
|
3
|
-
|
|
4
|
-
import FieldRenderer from '../FieldRenderer';
|
|
5
|
-
|
|
6
|
-
describe('FieldRendererTests', () => {
|
|
7
|
-
let value = '';
|
|
8
|
-
|
|
9
|
-
const changeHandler = (e) => {
|
|
10
|
-
if (e.target.type === 'checkbox') {
|
|
11
|
-
value = e.target.checked;
|
|
12
|
-
} else {
|
|
13
|
-
value = e.target.value;
|
|
14
|
-
}
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
beforeEach(() => {
|
|
18
|
-
value = '';
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
it('should render select field type', () => {
|
|
22
|
-
const fieldData = {
|
|
23
|
-
type: 'select',
|
|
24
|
-
label: 'Year of Birth',
|
|
25
|
-
name: 'yob-field',
|
|
26
|
-
options: [['1997', '1997'], ['1998', '1998']],
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
const { container } = render(<FieldRenderer value={value} fieldData={fieldData} onChangeHandler={changeHandler} />);
|
|
30
|
-
const input = container.querySelector('select#yob-field');
|
|
31
|
-
const label = container.querySelector('label');
|
|
32
|
-
fireEvent.change(input, { target: { value: 1997 } });
|
|
33
|
-
|
|
34
|
-
expect(input.type).toEqual('select-one');
|
|
35
|
-
expect(label.textContent).toContain(fieldData.label);
|
|
36
|
-
expect(value).toEqual('1997');
|
|
37
|
-
});
|
|
38
|
-
|
|
39
|
-
it('should return null if no options are provided for select field', () => {
|
|
40
|
-
const fieldData = {
|
|
41
|
-
type: 'select',
|
|
42
|
-
label: 'Year of Birth',
|
|
43
|
-
name: 'yob-field',
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
const { container } = render(<FieldRenderer fieldData={fieldData} onChangeHandler={() => { }} />);
|
|
47
|
-
expect(container.innerHTML).toEqual('');
|
|
48
|
-
});
|
|
49
|
-
|
|
50
|
-
it('should render textarea field', () => {
|
|
51
|
-
const fieldData = {
|
|
52
|
-
type: 'textarea',
|
|
53
|
-
label: 'Why do you want to join this platform?',
|
|
54
|
-
name: 'goals-field',
|
|
55
|
-
};
|
|
56
|
-
|
|
57
|
-
const { container } = render(<FieldRenderer value={value} fieldData={fieldData} onChangeHandler={changeHandler} />);
|
|
58
|
-
const input = container.querySelector('#goals-field');
|
|
59
|
-
const label = container.querySelector('label');
|
|
60
|
-
fireEvent.change(input, { target: { value: 'These are my goals.' } });
|
|
61
|
-
|
|
62
|
-
expect(input.type).toEqual(fieldData.type);
|
|
63
|
-
expect(label.textContent).toContain('Why do you want to join this platform?');
|
|
64
|
-
expect(value).toEqual('These are my goals.');
|
|
65
|
-
});
|
|
66
|
-
|
|
67
|
-
it('should render an input field', () => {
|
|
68
|
-
const fieldData = {
|
|
69
|
-
type: 'text',
|
|
70
|
-
label: 'Company',
|
|
71
|
-
name: 'company-field',
|
|
72
|
-
};
|
|
73
|
-
|
|
74
|
-
const { container } = render(<FieldRenderer value={value} fieldData={fieldData} onChangeHandler={changeHandler} />);
|
|
75
|
-
const input = container.querySelector('input#company-field');
|
|
76
|
-
const label = container.querySelector('label');
|
|
77
|
-
fireEvent.change(input, { target: { value: 'ABC' } });
|
|
78
|
-
|
|
79
|
-
expect(input.type).toEqual(fieldData.type);
|
|
80
|
-
expect(label.textContent).toContain(fieldData.label);
|
|
81
|
-
expect(value).toEqual('ABC');
|
|
82
|
-
});
|
|
83
|
-
|
|
84
|
-
it('should render checkbox field', () => {
|
|
85
|
-
const fieldData = {
|
|
86
|
-
type: 'checkbox',
|
|
87
|
-
label: `I agree that ${getSiteConfig().siteName} may send me marketing messages.`,
|
|
88
|
-
name: 'marketing-emails-opt-in-field',
|
|
89
|
-
};
|
|
90
|
-
|
|
91
|
-
const { container } = render(<FieldRenderer value={value} fieldData={fieldData} onChangeHandler={changeHandler} />);
|
|
92
|
-
const input = container.querySelector('input#marketing-emails-opt-in-field');
|
|
93
|
-
const label = container.querySelector('label');
|
|
94
|
-
fireEvent.click(input);
|
|
95
|
-
|
|
96
|
-
expect(input.type).toEqual(fieldData.type);
|
|
97
|
-
expect(label.textContent).toContain(fieldData.label);
|
|
98
|
-
expect(value).toEqual(true);
|
|
99
|
-
});
|
|
100
|
-
|
|
101
|
-
it('should return null if field type is unknown', () => {
|
|
102
|
-
const fieldData = {
|
|
103
|
-
type: 'unknown',
|
|
104
|
-
};
|
|
105
|
-
|
|
106
|
-
const { container } = render(<FieldRenderer fieldData={fieldData} onChangeHandler={() => { }} />);
|
|
107
|
-
expect(container.innerHTML).toContain('');
|
|
108
|
-
});
|
|
109
|
-
|
|
110
|
-
it('should run onBlur and onFocus functions for a field if given', () => {
|
|
111
|
-
const fieldData = { type: 'text', label: 'Test', name: 'test-field' };
|
|
112
|
-
let functionValue = '';
|
|
113
|
-
|
|
114
|
-
const onBlur = (e) => {
|
|
115
|
-
functionValue = `${e.target.name} blurred`;
|
|
116
|
-
};
|
|
117
|
-
|
|
118
|
-
const onFocus = (e) => {
|
|
119
|
-
functionValue = `${e.target.name} focussed`;
|
|
120
|
-
};
|
|
121
|
-
|
|
122
|
-
const { container } = render(
|
|
123
|
-
<FieldRenderer
|
|
124
|
-
handleFocus={onFocus}
|
|
125
|
-
handleBlur={onBlur}
|
|
126
|
-
value={value}
|
|
127
|
-
fieldData={fieldData}
|
|
128
|
-
onChangeHandler={changeHandler}
|
|
129
|
-
/>,
|
|
130
|
-
);
|
|
131
|
-
const input = container.querySelector('#test-field');
|
|
132
|
-
|
|
133
|
-
fireEvent.focus(input);
|
|
134
|
-
expect(functionValue).toEqual('test-field focussed');
|
|
135
|
-
|
|
136
|
-
fireEvent.blur(input);
|
|
137
|
-
expect(functionValue).toEqual('test-field blurred');
|
|
138
|
-
});
|
|
139
|
-
|
|
140
|
-
it('should render error message for required text fields', () => {
|
|
141
|
-
const fieldData = { type: 'text', label: 'First Name', name: 'first-name-field' };
|
|
142
|
-
|
|
143
|
-
const { container } = render(
|
|
144
|
-
<FieldRenderer
|
|
145
|
-
isRequired
|
|
146
|
-
fieldData={fieldData}
|
|
147
|
-
onChangeHandler={changeHandler}
|
|
148
|
-
errorMessage="Enter your first name"
|
|
149
|
-
/>,
|
|
150
|
-
);
|
|
151
|
-
|
|
152
|
-
expect(container.querySelector(`#${fieldData.name}-error`).textContent).toEqual('Enter your first name');
|
|
153
|
-
});
|
|
154
|
-
|
|
155
|
-
it('should render error message for required select fields', () => {
|
|
156
|
-
const fieldData = {
|
|
157
|
-
type: 'select', label: 'Preference', name: 'preference-field', options: [['a', 'Opt 1'], ['b', 'Opt 2']],
|
|
158
|
-
};
|
|
159
|
-
|
|
160
|
-
const { container } = render(
|
|
161
|
-
<FieldRenderer
|
|
162
|
-
isRequired
|
|
163
|
-
fieldData={fieldData}
|
|
164
|
-
onChangeHandler={changeHandler}
|
|
165
|
-
errorMessage="Select your preference"
|
|
166
|
-
/>,
|
|
167
|
-
);
|
|
168
|
-
|
|
169
|
-
expect(container.querySelector(`#${fieldData.name}-error`).textContent).toEqual('Select your preference');
|
|
170
|
-
});
|
|
171
|
-
|
|
172
|
-
it('should render error message for required textarea fields', () => {
|
|
173
|
-
const fieldData = { type: 'textarea', label: 'Goals', name: 'goals-field' };
|
|
174
|
-
|
|
175
|
-
const { container } = render(
|
|
176
|
-
<FieldRenderer
|
|
177
|
-
isRequired
|
|
178
|
-
fieldData={fieldData}
|
|
179
|
-
onChangeHandler={changeHandler}
|
|
180
|
-
errorMessage="Tell us your goals"
|
|
181
|
-
/>,
|
|
182
|
-
);
|
|
183
|
-
|
|
184
|
-
expect(container.querySelector(`#${fieldData.name}-error`).textContent).toEqual('Tell us your goals');
|
|
185
|
-
});
|
|
186
|
-
|
|
187
|
-
it('should render error message for required checkbox fields', () => {
|
|
188
|
-
const fieldData = { type: 'checkbox', label: 'Honor Code', name: 'honor-code-field' };
|
|
189
|
-
|
|
190
|
-
const { container } = render(
|
|
191
|
-
<FieldRenderer
|
|
192
|
-
isRequired
|
|
193
|
-
fieldData={fieldData}
|
|
194
|
-
onChangeHandler={changeHandler}
|
|
195
|
-
errorMessage="You must agree to our Honor Code"
|
|
196
|
-
/>,
|
|
197
|
-
);
|
|
198
|
-
|
|
199
|
-
expect(container.querySelector(`#${fieldData.name}-error`).textContent).toEqual('You must agree to our Honor Code');
|
|
200
|
-
});
|
|
201
|
-
});
|