@openedx/frontend-app-authn 1.0.0-alpha.5 → 1.0.0-alpha.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Main.d.ts +3 -0
- package/dist/Main.js +10 -0
- package/dist/Main.js.map +1 -0
- package/dist/app.d.ts +3 -0
- package/dist/app.js +41 -0
- package/dist/app.js.map +1 -0
- package/{src → dist}/app.scss +1 -1
- package/dist/base-container/components/default-layout/LargeLayout.d.ts +2 -0
- package/dist/base-container/components/default-layout/LargeLayout.js +11 -0
- package/dist/base-container/components/default-layout/LargeLayout.js.map +1 -0
- package/dist/base-container/components/default-layout/MediumLayout.d.ts +2 -0
- package/dist/base-container/components/default-layout/MediumLayout.js +11 -0
- package/dist/base-container/components/default-layout/MediumLayout.js.map +1 -0
- package/dist/base-container/components/default-layout/SmallLayout.d.ts +2 -0
- package/dist/base-container/components/default-layout/SmallLayout.js +11 -0
- package/dist/base-container/components/default-layout/SmallLayout.js.map +1 -0
- package/dist/base-container/components/default-layout/index.d.ts +3 -0
- package/{src/base-container/components/default-layout/index.jsx → dist/base-container/components/default-layout/index.js} +1 -0
- package/dist/base-container/components/default-layout/index.js.map +1 -0
- package/dist/base-container/components/default-layout/messages.d.ts +13 -0
- package/dist/base-container/components/default-layout/messages.js +15 -0
- package/dist/base-container/components/default-layout/messages.js.map +1 -0
- package/dist/base-container/components/image-layout/ExtraSmallLayout.d.ts +2 -0
- package/dist/base-container/components/image-layout/ExtraSmallLayout.js +10 -0
- package/dist/base-container/components/image-layout/ExtraSmallLayout.js.map +1 -0
- package/dist/base-container/components/image-layout/LargeLayout.d.ts +2 -0
- package/dist/base-container/components/image-layout/LargeLayout.js +11 -0
- package/dist/base-container/components/image-layout/LargeLayout.js.map +1 -0
- package/dist/base-container/components/image-layout/MediumLayout.d.ts +2 -0
- package/dist/base-container/components/image-layout/MediumLayout.js +11 -0
- package/dist/base-container/components/image-layout/MediumLayout.js.map +1 -0
- package/dist/base-container/components/image-layout/SmallLayout.d.ts +2 -0
- package/dist/base-container/components/image-layout/SmallLayout.js +10 -0
- package/dist/base-container/components/image-layout/SmallLayout.js.map +1 -0
- package/dist/base-container/components/image-layout/index.d.ts +4 -0
- package/{src/base-container/components/image-layout/index.jsx → dist/base-container/components/image-layout/index.js} +1 -0
- package/dist/base-container/components/image-layout/index.js.map +1 -0
- package/dist/base-container/components/image-layout/messages.d.ts +13 -0
- package/dist/base-container/components/image-layout/messages.js +15 -0
- package/dist/base-container/components/image-layout/messages.js.map +1 -0
- package/dist/base-container/components/welcome-page-layout/LargeLayout.d.ts +10 -0
- package/dist/base-container/components/welcome-page-layout/LargeLayout.js +14 -0
- package/dist/base-container/components/welcome-page-layout/LargeLayout.js.map +1 -0
- package/dist/base-container/components/welcome-page-layout/MediumLayout.d.ts +10 -0
- package/dist/base-container/components/welcome-page-layout/MediumLayout.js +14 -0
- package/dist/base-container/components/welcome-page-layout/MediumLayout.js.map +1 -0
- package/dist/base-container/components/welcome-page-layout/SmallLayout.d.ts +10 -0
- package/dist/base-container/components/welcome-page-layout/SmallLayout.js +14 -0
- package/dist/base-container/components/welcome-page-layout/SmallLayout.js.map +1 -0
- package/dist/base-container/components/welcome-page-layout/index.d.ts +3 -0
- package/{src/base-container/components/welcome-page-layout/index.jsx → dist/base-container/components/welcome-page-layout/index.js} +1 -0
- package/dist/base-container/components/welcome-page-layout/index.js.map +1 -0
- package/dist/base-container/components/welcome-page-layout/messages.d.ts +18 -0
- package/dist/base-container/components/welcome-page-layout/messages.js +20 -0
- package/dist/base-container/components/welcome-page-layout/messages.js.map +1 -0
- package/dist/base-container/index.d.ts +20 -0
- package/dist/base-container/index.js +27 -0
- package/dist/base-container/index.js.map +1 -0
- package/dist/common-components/EmbeddedRegistrationRoute.d.ts +14 -0
- package/dist/common-components/EmbeddedRegistrationRoute.js +22 -0
- package/dist/common-components/EmbeddedRegistrationRoute.js.map +1 -0
- package/dist/common-components/EnterpriseSSO.d.ts +29 -0
- package/dist/common-components/EnterpriseSSO.js +58 -0
- package/dist/common-components/EnterpriseSSO.js.map +1 -0
- package/dist/common-components/FormGroup.d.ts +60 -0
- package/dist/common-components/FormGroup.js +66 -0
- package/dist/common-components/FormGroup.js.map +1 -0
- package/dist/common-components/InstitutionLogistration.d.ts +34 -0
- package/dist/common-components/InstitutionLogistration.js +38 -0
- package/dist/common-components/InstitutionLogistration.js.map +1 -0
- package/dist/common-components/NotFoundPage.d.ts +2 -0
- package/dist/common-components/NotFoundPage.js +5 -0
- package/dist/common-components/NotFoundPage.js.map +1 -0
- package/dist/common-components/PasswordField.d.ts +47 -0
- package/dist/common-components/PasswordField.js +98 -0
- package/dist/common-components/PasswordField.js.map +1 -0
- package/dist/common-components/RedirectLogistration.d.ts +39 -0
- package/dist/common-components/RedirectLogistration.js +72 -0
- package/dist/common-components/RedirectLogistration.js.map +1 -0
- package/dist/common-components/RegisterFaIcons.d.ts +1 -0
- package/dist/common-components/RegisterFaIcons.js +6 -0
- package/dist/common-components/RegisterFaIcons.js.map +1 -0
- package/dist/common-components/SocialAuthProviders.d.ts +23 -0
- package/dist/common-components/SocialAuthProviders.js +43 -0
- package/dist/common-components/SocialAuthProviders.js.map +1 -0
- package/dist/common-components/ThirdPartyAuth.d.ts +42 -0
- package/dist/common-components/ThirdPartyAuth.js +57 -0
- package/dist/common-components/ThirdPartyAuth.js.map +1 -0
- package/dist/common-components/ThirdPartyAuthAlert.d.ts +15 -0
- package/dist/common-components/ThirdPartyAuthAlert.js +32 -0
- package/dist/common-components/ThirdPartyAuthAlert.js.map +1 -0
- package/dist/common-components/UnAuthOnlyRoute.d.ts +14 -0
- package/dist/common-components/UnAuthOnlyRoute.js +32 -0
- package/dist/common-components/UnAuthOnlyRoute.js.map +1 -0
- package/dist/common-components/components/ThirdPartyAuthContext.d.ts +31 -0
- package/dist/common-components/components/ThirdPartyAuthContext.js +84 -0
- package/dist/common-components/components/ThirdPartyAuthContext.js.map +1 -0
- package/dist/common-components/data/api.d.ts +6 -0
- package/dist/common-components/data/api.js +26 -0
- package/dist/common-components/data/api.js.map +1 -0
- package/dist/common-components/data/apiHook.d.ts +9 -0
- package/dist/common-components/data/apiHook.js +14 -0
- package/dist/common-components/data/apiHook.js.map +1 -0
- package/dist/common-components/data/queryKeys.d.ts +4 -0
- package/dist/common-components/data/queryKeys.js +6 -0
- package/dist/common-components/data/queryKeys.js.map +1 -0
- package/dist/common-components/index.d.ts +10 -0
- package/{src/common-components/index.jsx → dist/common-components/index.js} +1 -3
- package/dist/common-components/index.js.map +1 -0
- package/dist/common-components/messages.d.ts +113 -0
- package/dist/common-components/messages.js +126 -0
- package/dist/common-components/messages.js.map +1 -0
- package/dist/constants.d.ts +14 -0
- package/dist/constants.js +17 -0
- package/dist/constants.js.map +1 -0
- package/dist/data/constants.d.ts +16 -0
- package/{src → dist}/data/constants.js +4 -17
- package/dist/data/constants.js.map +1 -0
- package/dist/data/countries.d.ts +26 -0
- package/{src/data/countries.ts → dist/data/countries.js} +6 -9
- package/dist/data/countries.js.map +1 -0
- package/dist/data/oneTrust.d.ts +2 -0
- package/dist/data/oneTrust.js +3 -0
- package/dist/data/oneTrust.js.map +1 -0
- package/dist/data/utils/cookies.d.ts +1 -0
- package/dist/data/utils/cookies.js +12 -0
- package/dist/data/utils/cookies.js.map +1 -0
- package/dist/data/utils/dataUtils.d.ts +12 -0
- package/dist/data/utils/dataUtils.js +81 -0
- package/dist/data/utils/dataUtils.js.map +1 -0
- package/dist/data/utils/index.d.ts +2 -0
- package/dist/data/utils/index.js +3 -0
- package/dist/data/utils/index.js.map +1 -0
- package/dist/data/utils/useMobileResponsive.d.ts +7 -0
- package/dist/data/utils/useMobileResponsive.js +22 -0
- package/dist/data/utils/useMobileResponsive.js.map +1 -0
- package/dist/field-renderer/FieldRenderer.d.ts +34 -0
- package/dist/field-renderer/FieldRenderer.js +70 -0
- package/dist/field-renderer/FieldRenderer.js.map +1 -0
- package/dist/field-renderer/index.d.ts +1 -0
- package/{src/field-renderer/index.jsx → dist/field-renderer/index.js} +1 -0
- package/dist/field-renderer/index.js.map +1 -0
- package/dist/forgot-password/ForgotPasswordAlert.d.ts +16 -0
- package/dist/forgot-password/ForgotPasswordAlert.js +66 -0
- package/dist/forgot-password/ForgotPasswordAlert.js.map +1 -0
- package/dist/forgot-password/ForgotPasswordPage.d.ts +2 -0
- package/dist/forgot-password/ForgotPasswordPage.js +92 -0
- package/dist/forgot-password/ForgotPasswordPage.js.map +1 -0
- package/dist/forgot-password/data/api.d.ts +2 -0
- package/dist/forgot-password/data/api.js +25 -0
- package/dist/forgot-password/data/api.js.map +1 -0
- package/dist/forgot-password/data/apiHook.d.ts +16 -0
- package/dist/forgot-password/data/apiHook.js +26 -0
- package/dist/forgot-password/data/apiHook.js.map +1 -0
- package/dist/forgot-password/index.d.ts +1 -0
- package/dist/forgot-password/index.js +2 -0
- package/dist/forgot-password/index.js.map +1 -0
- package/dist/forgot-password/messages.d.ts +123 -0
- package/dist/forgot-password/messages.js +128 -0
- package/dist/forgot-password/messages.js.map +1 -0
- package/dist/i18n/index.d.ts +25 -0
- package/dist/i18n/index.js +26 -0
- package/dist/i18n/index.js.map +1 -0
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -0
- package/dist/login/AccountActivationMessage.d.ts +14 -0
- package/dist/login/AccountActivationMessage.js +49 -0
- package/dist/login/AccountActivationMessage.js.map +1 -0
- package/dist/login/ChangePasswordPrompt.d.ts +18 -0
- package/dist/login/ChangePasswordPrompt.js +51 -0
- package/dist/login/ChangePasswordPrompt.js.map +1 -0
- package/dist/login/LoginFailure.d.ts +25 -0
- package/dist/login/LoginFailure.js +109 -0
- package/dist/login/LoginFailure.js.map +1 -0
- package/dist/login/LoginPage.d.ts +12 -0
- package/dist/login/LoginPage.js +174 -0
- package/dist/login/LoginPage.js.map +1 -0
- package/dist/login/components/LoginContext.d.ts +21 -0
- package/dist/login/components/LoginContext.js +28 -0
- package/dist/login/components/LoginContext.js.map +1 -0
- package/dist/login/data/api.d.ts +2 -0
- package/dist/login/data/api.js +27 -0
- package/dist/login/data/api.js.map +1 -0
- package/dist/login/data/apiHook.d.ts +13 -0
- package/dist/login/data/apiHook.js +57 -0
- package/dist/login/data/apiHook.js.map +1 -0
- package/dist/login/data/constants.d.ts +17 -0
- package/{src → dist}/login/data/constants.js +4 -4
- package/dist/login/data/constants.js.map +1 -0
- package/dist/login/index.d.ts +1 -0
- package/dist/login/index.js +2 -0
- package/dist/login/index.js.map +1 -0
- package/dist/login/messages.d.ts +198 -0
- package/dist/login/messages.js +210 -0
- package/dist/login/messages.js.map +1 -0
- package/dist/logistration/Logistration.d.ts +5 -0
- package/dist/logistration/Logistration.js +80 -0
- package/dist/logistration/Logistration.js.map +1 -0
- package/dist/progressive-profiling/ProgressiveProfiling.d.ts +2 -0
- package/dist/progressive-profiling/ProgressiveProfiling.js +143 -0
- package/dist/progressive-profiling/ProgressiveProfiling.js.map +1 -0
- package/dist/progressive-profiling/ProgressiveProfilingPageModal.d.ts +13 -0
- package/dist/progressive-profiling/ProgressiveProfilingPageModal.js +31 -0
- package/dist/progressive-profiling/ProgressiveProfilingPageModal.js.map +1 -0
- package/dist/progressive-profiling/components/ProgressiveProfilingContext.d.ts +18 -0
- package/dist/progressive-profiling/components/ProgressiveProfilingContext.js +52 -0
- package/dist/progressive-profiling/components/ProgressiveProfilingContext.js.map +1 -0
- package/dist/progressive-profiling/data/api.d.ts +2 -0
- package/dist/progressive-profiling/data/api.js +22 -0
- package/dist/progressive-profiling/data/api.js.map +1 -0
- package/dist/progressive-profiling/data/apiHook.d.ts +10 -0
- package/dist/progressive-profiling/data/apiHook.js +36 -0
- package/dist/progressive-profiling/data/apiHook.js.map +1 -0
- package/dist/progressive-profiling/index.d.ts +2 -0
- package/{src → dist}/progressive-profiling/index.js +1 -3
- package/dist/progressive-profiling/index.js.map +1 -0
- package/dist/progressive-profiling/messages.d.ts +53 -0
- package/dist/progressive-profiling/messages.js +57 -0
- package/dist/progressive-profiling/messages.js.map +1 -0
- package/dist/register/RegistrationFields/CountryField/CountryField.d.ts +38 -0
- package/dist/register/RegistrationFields/CountryField/CountryField.js +93 -0
- package/dist/register/RegistrationFields/CountryField/CountryField.js.map +1 -0
- package/dist/register/RegistrationFields/CountryField/validator.d.ts +8 -0
- package/dist/register/RegistrationFields/CountryField/validator.js +29 -0
- package/dist/register/RegistrationFields/CountryField/validator.js.map +1 -0
- package/dist/register/RegistrationFields/EmailField/EmailField.d.ts +30 -0
- package/dist/register/RegistrationFields/EmailField/EmailField.js +88 -0
- package/dist/register/RegistrationFields/EmailField/EmailField.js.map +1 -0
- package/dist/register/RegistrationFields/EmailField/constants.d.ts +3 -0
- package/dist/register/RegistrationFields/EmailField/constants.js +130 -0
- package/dist/register/RegistrationFields/EmailField/constants.js.map +1 -0
- package/dist/register/RegistrationFields/EmailField/validator.d.ts +17 -0
- package/dist/register/RegistrationFields/EmailField/validator.js +107 -0
- package/dist/register/RegistrationFields/EmailField/validator.js.map +1 -0
- package/dist/register/RegistrationFields/HonorCodeField/HonorCode.d.ts +21 -0
- package/dist/register/RegistrationFields/HonorCodeField/HonorCode.js +40 -0
- package/dist/register/RegistrationFields/HonorCodeField/HonorCode.js.map +1 -0
- package/dist/register/RegistrationFields/NameField/NameField.d.ts +29 -0
- package/dist/register/RegistrationFields/NameField/NameField.js +59 -0
- package/dist/register/RegistrationFields/NameField/NameField.js.map +1 -0
- package/dist/register/RegistrationFields/NameField/validator.d.ts +6 -0
- package/dist/register/RegistrationFields/NameField/validator.js +23 -0
- package/dist/register/RegistrationFields/NameField/validator.js.map +1 -0
- package/dist/register/RegistrationFields/TermsOfServiceField/TermsOfService.d.ts +16 -0
- package/dist/register/RegistrationFields/TermsOfServiceField/TermsOfService.js +24 -0
- package/dist/register/RegistrationFields/TermsOfServiceField/TermsOfService.js.map +1 -0
- package/dist/register/RegistrationFields/UsernameField/UsernameField.d.ts +31 -0
- package/dist/register/RegistrationFields/UsernameField/UsernameField.js +119 -0
- package/dist/register/RegistrationFields/UsernameField/UsernameField.js.map +1 -0
- package/dist/register/RegistrationFields/UsernameField/validator.d.ts +4 -0
- package/dist/register/RegistrationFields/UsernameField/validator.js +15 -0
- package/dist/register/RegistrationFields/UsernameField/validator.js.map +1 -0
- package/dist/register/RegistrationFields/index.d.ts +6 -0
- package/{src → dist}/register/RegistrationFields/index.js +1 -0
- package/dist/register/RegistrationFields/index.js.map +1 -0
- package/dist/register/RegistrationPage.d.ts +18 -0
- package/dist/register/RegistrationPage.js +259 -0
- package/dist/register/RegistrationPage.js.map +1 -0
- package/dist/register/components/ConfigurableRegistrationForm.d.ts +37 -0
- package/dist/register/components/ConfigurableRegistrationForm.js +145 -0
- package/dist/register/components/ConfigurableRegistrationForm.js.map +1 -0
- package/dist/register/components/RegisterContext.d.ts +8 -0
- package/dist/register/components/RegisterContext.js +167 -0
- package/dist/register/components/RegisterContext.js.map +1 -0
- package/dist/register/components/RegistrationFailure.d.ts +19 -0
- package/dist/register/components/RegistrationFailure.js +60 -0
- package/dist/register/components/RegistrationFailure.js.map +1 -0
- package/dist/register/data/api.d.ts +9 -0
- package/dist/register/data/api.js +45 -0
- package/dist/register/data/api.js.map +1 -0
- package/dist/register/data/apiHook.d.ts +33 -0
- package/dist/register/data/apiHook.js +66 -0
- package/dist/register/data/apiHook.js.map +1 -0
- package/dist/register/data/constants.d.ts +11 -0
- package/{src → dist}/register/data/constants.js +5 -4
- package/dist/register/data/constants.js.map +1 -0
- package/dist/register/data/utils.d.ts +6 -0
- package/dist/register/data/utils.js +128 -0
- package/dist/register/data/utils.js.map +1 -0
- package/dist/register/index.d.ts +1 -0
- package/dist/register/index.js +2 -0
- package/dist/register/index.js.map +1 -0
- package/dist/register/messages.d.ts +203 -0
- package/dist/register/messages.js +215 -0
- package/dist/register/messages.js.map +1 -0
- package/dist/register/types.d.ts +74 -0
- package/dist/register/types.js +2 -0
- package/dist/register/types.js.map +1 -0
- package/dist/reset-password/ResetPasswordFailure.d.ts +15 -0
- package/dist/reset-password/ResetPasswordFailure.js +44 -0
- package/dist/reset-password/ResetPasswordFailure.js.map +1 -0
- package/dist/reset-password/ResetPasswordPage.d.ts +2 -0
- package/dist/reset-password/ResetPasswordPage.js +182 -0
- package/dist/reset-password/ResetPasswordPage.js.map +1 -0
- package/dist/reset-password/ResetPasswordSuccess.d.ts +2 -0
- package/dist/reset-password/ResetPasswordSuccess.js +10 -0
- package/dist/reset-password/ResetPasswordSuccess.js.map +1 -0
- package/dist/reset-password/data/api.d.ts +4 -0
- package/dist/reset-password/data/api.js +57 -0
- package/dist/reset-password/data/api.js.map +1 -0
- package/dist/reset-password/data/apiHook.d.ts +31 -0
- package/dist/reset-password/data/apiHook.js +74 -0
- package/dist/reset-password/data/apiHook.js.map +1 -0
- package/dist/reset-password/data/constants.d.ts +13 -0
- package/{src → dist}/reset-password/data/constants.js +6 -7
- package/dist/reset-password/data/constants.js.map +1 -0
- package/dist/reset-password/index.d.ts +1 -0
- package/dist/reset-password/index.js +2 -0
- package/dist/reset-password/index.js.map +1 -0
- package/dist/reset-password/messages.d.ts +83 -0
- package/dist/reset-password/messages.js +87 -0
- package/dist/reset-password/messages.js.map +1 -0
- package/dist/routes.d.ts +19 -0
- package/dist/routes.js +76 -0
- package/dist/routes.js.map +1 -0
- package/{src → dist}/sass/_registration.scss +8 -10
- package/dist/slots/LoginComponentSlot/index.d.ts +12 -0
- package/dist/slots/LoginComponentSlot/index.js +11 -0
- package/dist/slots/LoginComponentSlot/index.js.map +1 -0
- package/package.json +26 -15
- package/src/Main.tsx +0 -23
- package/src/__mocks__/file.js +0 -1
- package/src/__mocks__/svg.js +0 -1
- package/src/app.ts +0 -43
- package/src/base-container/components/default-layout/DefaultLayout.test.jsx +0 -48
- package/src/base-container/components/default-layout/LargeLayout.jsx +0 -42
- package/src/base-container/components/default-layout/MediumLayout.jsx +0 -49
- package/src/base-container/components/default-layout/SmallLayout.jsx +0 -37
- package/src/base-container/components/default-layout/messages.js +0 -16
- package/src/base-container/components/image-layout/ExtraSmallLayout.jsx +0 -31
- package/src/base-container/components/image-layout/LargeLayout.jsx +0 -32
- package/src/base-container/components/image-layout/MediumLayout.jsx +0 -32
- package/src/base-container/components/image-layout/SmallLayout.jsx +0 -31
- package/src/base-container/components/image-layout/messages.js +0 -16
- package/src/base-container/components/welcome-page-layout/LargeLayout.jsx +0 -46
- package/src/base-container/components/welcome-page-layout/MediumLayout.jsx +0 -49
- package/src/base-container/components/welcome-page-layout/SmallLayout.jsx +0 -38
- package/src/base-container/components/welcome-page-layout/messages.js +0 -21
- package/src/base-container/index.jsx +0 -70
- package/src/base-container/tests/BaseContainer.test.jsx +0 -44
- package/src/common-components/EmbeddedRegistrationRoute.jsx +0 -26
- package/src/common-components/EnterpriseSSO.jsx +0 -110
- package/src/common-components/FormGroup.jsx +0 -106
- package/src/common-components/InstitutionLogistration.jsx +0 -102
- package/src/common-components/NotFoundPage.jsx +0 -15
- package/src/common-components/PasswordField.jsx +0 -175
- package/src/common-components/RedirectLogistration.jsx +0 -94
- package/src/common-components/RegisterFaIcons.jsx +0 -8
- package/src/common-components/SocialAuthProviders.jsx +0 -75
- package/src/common-components/ThirdPartyAuth.jsx +0 -123
- package/src/common-components/ThirdPartyAuthAlert.jsx +0 -49
- package/src/common-components/UnAuthOnlyRoute.jsx +0 -41
- package/src/common-components/data/actions.js +0 -27
- package/src/common-components/data/reducers.js +0 -63
- package/src/common-components/data/sagas.js +0 -32
- package/src/common-components/data/selectors.js +0 -28
- package/src/common-components/data/service.js +0 -23
- package/src/common-components/data/tests/reducer.test.js +0 -82
- package/src/common-components/data/tests/sagas.test.js +0 -71
- package/src/common-components/messages.jsx +0 -127
- package/src/common-components/tests/EmbeddedRegistrationRoute.test.jsx +0 -76
- package/src/common-components/tests/FormField.test.jsx +0 -289
- package/src/common-components/tests/SocialAuthProviders.test.jsx +0 -75
- package/src/common-components/tests/ThirdPartyAuthAlert.test.jsx +0 -39
- package/src/common-components/tests/UnAuthOnlyRoute.test.jsx +0 -73
- package/src/common-components/tests/__snapshots__/SocialAuthProviders.test.jsx.snap +0 -156
- package/src/common-components/tests/__snapshots__/ThirdPartyAuthAlert.test.jsx.snap +0 -53
- package/src/constants.ts +0 -1
- package/src/data/configureStore.js +0 -33
- package/src/data/oneTrust.js +0 -3
- package/src/data/reducers.js +0 -36
- package/src/data/sagas.js +0 -19
- package/src/data/tests/cookies.test.js +0 -42
- package/src/data/tests/dataUtils.test.js +0 -19
- package/src/data/tests/reduxUtils.test.js +0 -14
- package/src/data/utils/cookies.js +0 -12
- package/src/data/utils/dataUtils.js +0 -81
- package/src/data/utils/index.js +0 -11
- package/src/data/utils/reduxUtils.js +0 -34
- package/src/data/utils/useMobileResponsive.js +0 -24
- package/src/field-renderer/FieldRenderer.jsx +0 -156
- package/src/field-renderer/tests/FieldRenderer.test.jsx +0 -201
- package/src/forgot-password/ForgotPasswordAlert.jsx +0 -97
- package/src/forgot-password/ForgotPasswordPage.jsx +0 -193
- package/src/forgot-password/data/actions.js +0 -32
- package/src/forgot-password/data/reducers.js +0 -58
- package/src/forgot-password/data/sagas.js +0 -35
- package/src/forgot-password/data/selectors.js +0 -10
- package/src/forgot-password/data/service.js +0 -21
- package/src/forgot-password/data/tests/reducers.test.js +0 -34
- package/src/forgot-password/data/tests/sagas.test.js +0 -67
- package/src/forgot-password/index.js +0 -5
- package/src/forgot-password/messages.js +0 -128
- package/src/forgot-password/tests/ForgotPasswordPage.test.jsx +0 -269
- package/src/i18n/index.js +0 -25
- package/src/login/AccountActivationMessage.jsx +0 -78
- package/src/login/ChangePasswordPrompt.jsx +0 -91
- package/src/login/LoginFailure.jsx +0 -231
- package/src/login/LoginPage.jsx +0 -368
- package/src/login/data/actions.js +0 -39
- package/src/login/data/reducers.js +0 -76
- package/src/login/data/sagas.js +0 -45
- package/src/login/data/service.js +0 -27
- package/src/login/data/tests/reducers.test.js +0 -155
- package/src/login/data/tests/sagas.test.js +0 -110
- package/src/login/index.js +0 -5
- package/src/login/messages.jsx +0 -211
- package/src/login/tests/AccountActivationMessage.test.jsx +0 -122
- package/src/login/tests/ChangePasswordPrompt.test.jsx +0 -75
- package/src/login/tests/LoginFailure.test.jsx +0 -323
- package/src/login/tests/LoginPage.test.jsx +0 -839
- package/src/logistration/Logistration.jsx +0 -189
- package/src/logistration/Logistration.test.jsx +0 -275
- package/src/progressive-profiling/ProgressiveProfiling.jsx +0 -313
- package/src/progressive-profiling/ProgressiveProfilingPageModal.jsx +0 -56
- package/src/progressive-profiling/data/actions.js +0 -22
- package/src/progressive-profiling/data/reducers.js +0 -38
- package/src/progressive-profiling/data/sagas.js +0 -24
- package/src/progressive-profiling/data/selectors.js +0 -14
- package/src/progressive-profiling/data/service.js +0 -17
- package/src/progressive-profiling/messages.jsx +0 -57
- package/src/progressive-profiling/tests/ProgressiveProfiling.test.jsx +0 -322
- package/src/register/RegistrationFields/CountryField/CountryField.jsx +0 -164
- package/src/register/RegistrationFields/CountryField/CountryField.test.jsx +0 -204
- package/src/register/RegistrationFields/CountryField/validator.js +0 -32
- package/src/register/RegistrationFields/EmailField/EmailField.jsx +0 -140
- package/src/register/RegistrationFields/EmailField/EmailField.test.jsx +0 -236
- package/src/register/RegistrationFields/EmailField/constants.js +0 -131
- package/src/register/RegistrationFields/EmailField/validator.js +0 -126
- package/src/register/RegistrationFields/EmailField/validator.test.js +0 -39
- package/src/register/RegistrationFields/HonorCodeField/HonorCode.jsx +0 -104
- package/src/register/RegistrationFields/HonorCodeField/HonorCode.test.jsx +0 -70
- package/src/register/RegistrationFields/NameField/NameField.jsx +0 -68
- package/src/register/RegistrationFields/NameField/NameField.test.jsx +0 -146
- package/src/register/RegistrationFields/NameField/validator.js +0 -22
- package/src/register/RegistrationFields/TermsOfServiceField/TermsOfService.jsx +0 -58
- package/src/register/RegistrationFields/TermsOfServiceField/TermsOfService.test.jsx +0 -55
- package/src/register/RegistrationFields/UsernameField/UsernameField.jsx +0 -162
- package/src/register/RegistrationFields/UsernameField/UsernameField.test.jsx +0 -319
- package/src/register/RegistrationFields/UsernameField/validator.js +0 -16
- package/src/register/RegistrationPage.jsx +0 -428
- package/src/register/RegistrationPage.test.jsx +0 -854
- package/src/register/components/ConfigurableRegistrationForm.jsx +0 -244
- package/src/register/components/RegistrationFailure.jsx +0 -80
- package/src/register/components/tests/ConfigurableRegistrationForm.test.jsx +0 -401
- package/src/register/components/tests/RegistrationFailure.test.jsx +0 -212
- package/src/register/components/tests/ThirdPartyAuth.test.jsx +0 -439
- package/src/register/data/actions.js +0 -85
- package/src/register/data/reducers.js +0 -140
- package/src/register/data/sagas.js +0 -58
- package/src/register/data/selectors.js +0 -34
- package/src/register/data/service.js +0 -45
- package/src/register/data/tests/reducers.test.js +0 -277
- package/src/register/data/tests/sagas.test.js +0 -239
- package/src/register/data/tests/utils.test.js +0 -98
- package/src/register/data/utils.js +0 -147
- package/src/register/index.js +0 -4
- package/src/register/messages.jsx +0 -206
- package/src/reset-password/ResetPasswordFailure.jsx +0 -55
- package/src/reset-password/ResetPasswordPage.jsx +0 -224
- package/src/reset-password/ResetPasswordSuccess.jsx +0 -19
- package/src/reset-password/data/actions.js +0 -50
- package/src/reset-password/data/reducers.js +0 -44
- package/src/reset-password/data/sagas.js +0 -67
- package/src/reset-password/data/selectors.js +0 -10
- package/src/reset-password/data/service.js +0 -61
- package/src/reset-password/data/tests/sagas.test.js +0 -185
- package/src/reset-password/index.js +0 -5
- package/src/reset-password/messages.js +0 -88
- package/src/reset-password/tests/ResetPasswordPage.test.jsx +0 -241
- package/src/routes.jsx +0 -79
- package/src/setupTest.js +0 -68
- /package/{src → dist}/base-container/components/image-layout/index.scss +0 -0
- /package/{src/index.ts → dist/index.d.ts} +0 -0
- /package/{src → dist}/sass/_base_component.scss +0 -0
- /package/{src → dist}/sass/_forgot_password.scss +0 -0
- /package/{src → dist}/sass/_login_page.scss +0 -0
- /package/{src → dist}/sass/_progressive_profiling_page.scss +0 -0
- /package/{src → dist}/sass/_reset_password.scss +0 -0
- /package/{src → dist}/sass/_style.scss +0 -0
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C,MAAM,CAAC,UAAU;IAC1C,UAAU,EAAE,SAAS,CAAC,IAAI;IAC1B,WAAW,EAAE,SAAS,CAAC,IAAI;IAC3B,YAAY,EAAE,SAAS,CAAC,IAAI;IAC5B,iBAAiB,EAAE,SAAS,CAAC,IAAI;IACjC,IAAI,EAAE,SAAS,CAAC,MAAM,CAAC,UAAU;IACjC,gBAAgB,EAAE,SAAS,CAAC,IAAI;IAChC,KAAK,EAAE,SAAS,CAAC,MAAM,CAAC,UAAU;IAClC,YAAY,EAAE,SAAS,CAAC,MAAM;IAC9B,oBAAoB,EAAE,SAAS,CAAC,IAAI;IACpC,6BAA6B,EAAE,SAAS,CAAC,IAAI;IAC7C,aAAa,EAAE,SAAS,CAAC,IAAI;IAC7B,wBAAwB,EAAE,SAAS,CAAC,IAAI;CACzC,CAAC;AAEF,eAAe,aAAa,CAAC","sourcesContent":["import { useState } from 'react';\n\nimport { useIntl } from '@openedx/frontend-base';\nimport {\n Form, Icon, IconButton, OverlayTrigger, Tooltip, useToggle,\n} from '@openedx/paragon';\nimport {\n Check, Remove, Visibility, VisibilityOff,\n} from '@openedx/paragon/icons';\nimport PropTypes from 'prop-types';\n\nimport { LETTER_REGEX, NUMBER_REGEX } from '../data/constants';\nimport { validatePasswordField } from '../register/data/utils';\nimport messages from './messages';\n\nconst noopFn = () => {};\n\nconst PasswordField = (props) => {\n const { formatMessage } = useIntl();\n const [isPasswordHidden, setHiddenTrue, setHiddenFalse] = useToggle(true);\n const [showTooltip, setShowTooltip] = useState(false);\n\n const {\n validationApiRateLimited = false,\n clearRegistrationBackendError = noopFn,\n validateField = noopFn,\n } = props;\n\n const handleBlur = (e) => {\n const { name, value } = e.target;\n if (name === props.name && e.relatedTarget?.name === 'passwordIcon') {\n return; // Do not run validations on password icon click\n }\n\n let passwordValue = value;\n if (name === 'passwordIcon') {\n // To validate actual password value when onBlur is triggered by focusing out the password icon\n passwordValue = props.value;\n }\n\n if (props.handleBlur) {\n props.handleBlur({\n target: {\n name: props.name,\n value: passwordValue,\n },\n });\n }\n\n setShowTooltip(props.showRequirements && false);\n if (props.handleErrorChange) { // If rendering from register page\n const fieldError = validatePasswordField(passwordValue, formatMessage);\n if (fieldError) {\n props.handleErrorChange('password', fieldError);\n } else if (!validationApiRateLimited) {\n validateField({ password: passwordValue });\n }\n }\n };\n\n const handleFocus = (e) => {\n if (e.target?.name === 'passwordIcon') {\n return; // Do not clear error on password icon focus\n }\n\n if (props.handleFocus) {\n props.handleFocus(e);\n }\n if (props.handleErrorChange) {\n props.handleErrorChange('password', '');\n clearRegistrationBackendError('password');\n }\n setTimeout(() => setShowTooltip(props.showRequirements && true), 150);\n };\n\n const HideButton = (\n <IconButton\n onFocus={handleFocus}\n onBlur={handleBlur}\n name=\"passwordIcon\"\n src={VisibilityOff}\n iconAs={Icon}\n onClick={setHiddenTrue}\n size=\"sm\"\n variant=\"secondary\"\n alt={formatMessage(messages['hide.password'])}\n />\n );\n\n const ShowButton = (\n <IconButton\n onFocus={handleFocus}\n onBlur={handleBlur}\n name=\"passwordIcon\"\n src={Visibility}\n iconAs={Icon}\n onClick={setHiddenFalse}\n size=\"sm\"\n variant=\"secondary\"\n alt={formatMessage(messages['show.password'])}\n />\n );\n\n const placement = window.innerWidth < 768 ? 'top' : 'left';\n const tooltip = (\n <Tooltip id={`password-requirement-${placement}`}>\n <span id=\"letter-check\" className=\"d-flex align-items-center\">\n {LETTER_REGEX.test(props.value) ? <Icon className=\"text-success mr-1\" src={Check} /> : <Icon className=\"mr-1 text-light-700\" src={Remove} />}\n {formatMessage(messages['one.letter'])}\n </span>\n <span id=\"number-check\" className=\"d-flex align-items-center\">\n {NUMBER_REGEX.test(props.value) ? <Icon className=\"text-success mr-1\" src={Check} /> : <Icon className=\"mr-1 text-light-700\" src={Remove} />}\n {formatMessage(messages['one.number'])}\n </span>\n <span id=\"characters-check\" className=\"d-flex align-items-center\">\n {props.value.length >= 8 ? <Icon className=\"text-success mr-1\" src={Check} /> : <Icon className=\"mr-1 text-light-700\" src={Remove} />}\n {formatMessage(messages['eight.characters'])}\n </span>\n </Tooltip>\n );\n\n return (\n <Form.Group controlId={props.name} isInvalid={props.errorMessage !== ''}>\n <OverlayTrigger key=\"tooltip\" placement={placement} overlay={tooltip} show={showTooltip}>\n <Form.Control\n as=\"input\"\n className=\"form-group__form-field\"\n type={isPasswordHidden ? 'password' : 'text'}\n name={props.name}\n value={props.value}\n autoComplete={props.autoComplete}\n aria-invalid={props.errorMessage !== ''}\n onFocus={handleFocus}\n onBlur={handleBlur}\n onChange={props.handleChange}\n controlClassName={props.borderClass}\n trailingElement={isPasswordHidden ? ShowButton : HideButton}\n floatingLabel={props.floatingLabel}\n />\n </OverlayTrigger>\n {props.errorMessage !== '' && (\n <Form.Control.Feedback key=\"error\" className=\"form-text-size\" hasIcon={false} feedback-for={props.name} type=\"invalid\">\n {props.errorMessage}\n {props.showScreenReaderText && <span className=\"sr-only\">{formatMessage(messages['password.sr.only.helping.text'])}</span>}\n </Form.Control.Feedback>\n )}\n </Form.Group>\n );\n};\n\nPasswordField.defaultProps = {\n borderClass: '',\n errorMessage: '',\n handleBlur: null,\n handleFocus: null,\n handleChange: () => {},\n handleErrorChange: null,\n showRequirements: true,\n showScreenReaderText: true,\n autoComplete: null,\n clearRegistrationBackendError: noopFn,\n validateField: noopFn,\n validationApiRateLimited: false,\n};\n\nPasswordField.propTypes = {\n borderClass: PropTypes.string,\n errorMessage: PropTypes.string,\n floatingLabel: PropTypes.string.isRequired,\n handleBlur: PropTypes.func,\n handleFocus: PropTypes.func,\n handleChange: PropTypes.func,\n handleErrorChange: PropTypes.func,\n name: PropTypes.string.isRequired,\n showRequirements: PropTypes.bool,\n value: PropTypes.string.isRequired,\n autoComplete: PropTypes.string,\n showScreenReaderText: PropTypes.bool,\n clearRegistrationBackendError: PropTypes.func,\n validateField: PropTypes.func,\n validationApiRateLimited: PropTypes.bool,\n};\n\nexport default PasswordField;\n"]}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
export default RedirectLogistration;
|
|
2
|
+
declare function RedirectLogistration(props: any): import("react/jsx-runtime").JSX.Element | null;
|
|
3
|
+
declare namespace RedirectLogistration {
|
|
4
|
+
namespace defaultProps {
|
|
5
|
+
let authenticatedUser: {};
|
|
6
|
+
let educationLevel: null;
|
|
7
|
+
let finishAuthUrl: null;
|
|
8
|
+
let success: boolean;
|
|
9
|
+
let redirectUrl: string;
|
|
10
|
+
let redirectToProgressiveProfilingPage: boolean;
|
|
11
|
+
let optionalFields: {};
|
|
12
|
+
let userId: null;
|
|
13
|
+
let registrationEmbedded: boolean;
|
|
14
|
+
let host: string;
|
|
15
|
+
}
|
|
16
|
+
namespace propTypes {
|
|
17
|
+
let authenticatedUser_1: PropTypes.Requireable<PropTypes.InferProps<{}>>;
|
|
18
|
+
export { authenticatedUser_1 as authenticatedUser };
|
|
19
|
+
let educationLevel_1: PropTypes.Requireable<string>;
|
|
20
|
+
export { educationLevel_1 as educationLevel };
|
|
21
|
+
let finishAuthUrl_1: PropTypes.Requireable<string>;
|
|
22
|
+
export { finishAuthUrl_1 as finishAuthUrl };
|
|
23
|
+
let success_1: PropTypes.Requireable<boolean>;
|
|
24
|
+
export { success_1 as success };
|
|
25
|
+
let redirectUrl_1: PropTypes.Requireable<string>;
|
|
26
|
+
export { redirectUrl_1 as redirectUrl };
|
|
27
|
+
let redirectToProgressiveProfilingPage_1: PropTypes.Requireable<boolean>;
|
|
28
|
+
export { redirectToProgressiveProfilingPage_1 as redirectToProgressiveProfilingPage };
|
|
29
|
+
let optionalFields_1: PropTypes.Requireable<PropTypes.InferProps<{}>>;
|
|
30
|
+
export { optionalFields_1 as optionalFields };
|
|
31
|
+
let userId_1: PropTypes.Requireable<number>;
|
|
32
|
+
export { userId_1 as userId };
|
|
33
|
+
let registrationEmbedded_1: PropTypes.Requireable<boolean>;
|
|
34
|
+
export { registrationEmbedded_1 as registrationEmbedded };
|
|
35
|
+
let host_1: PropTypes.Requireable<string>;
|
|
36
|
+
export { host_1 as host };
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
import PropTypes from 'prop-types';
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useAppConfig, getSiteConfig, getUrlByRouteRole } from '@openedx/frontend-base';
|
|
3
|
+
import PropTypes from 'prop-types';
|
|
4
|
+
import { Navigate } from 'react-router-dom';
|
|
5
|
+
import { welcomeRole } from '../constants';
|
|
6
|
+
import { REDIRECT } from '../data/constants';
|
|
7
|
+
import { setCookie } from '../data/utils';
|
|
8
|
+
const RedirectLogistration = (props) => {
|
|
9
|
+
const { authenticatedUser, finishAuthUrl, redirectUrl, redirectToProgressiveProfilingPage, success, optionalFields, educationLevel, userId, registrationEmbedded, host, } = props;
|
|
10
|
+
let finalRedirectUrl = '';
|
|
11
|
+
if (success) {
|
|
12
|
+
// If we're in a third party auth pipeline, we must complete the pipeline
|
|
13
|
+
// once user has successfully logged in. Otherwise, redirect to the specified redirect url.
|
|
14
|
+
// Note: For multiple enterprise use case, we need to make sure that user first visits the
|
|
15
|
+
// enterprise selection page and then complete the auth workflow
|
|
16
|
+
if (finishAuthUrl && !redirectUrl.includes(finishAuthUrl)) {
|
|
17
|
+
finalRedirectUrl = getSiteConfig().lmsBaseUrl + finishAuthUrl;
|
|
18
|
+
}
|
|
19
|
+
else {
|
|
20
|
+
finalRedirectUrl = redirectUrl;
|
|
21
|
+
}
|
|
22
|
+
// Redirect to Progressive Profiling after successful registration
|
|
23
|
+
if (redirectToProgressiveProfilingPage) {
|
|
24
|
+
// TODO: Do we still need this cookie?
|
|
25
|
+
setCookie('van-504-returning-user', true, useAppConfig().SESSION_COOKIE_DOMAIN);
|
|
26
|
+
if (registrationEmbedded) {
|
|
27
|
+
window.parent.postMessage({
|
|
28
|
+
action: REDIRECT,
|
|
29
|
+
redirectUrl: useAppConfig().POST_REGISTRATION_REDIRECT_URL,
|
|
30
|
+
}, host);
|
|
31
|
+
return null;
|
|
32
|
+
}
|
|
33
|
+
const registrationResult = { redirectUrl: finalRedirectUrl, success };
|
|
34
|
+
return (_jsx(Navigate, { to: getUrlByRouteRole(welcomeRole), state: {
|
|
35
|
+
registrationResult,
|
|
36
|
+
optionalFields,
|
|
37
|
+
authenticatedUser,
|
|
38
|
+
}, replace: true }));
|
|
39
|
+
}
|
|
40
|
+
if (finalRedirectUrl.startsWith('/')) {
|
|
41
|
+
return _jsx(Navigate, { to: finalRedirectUrl, replace: true });
|
|
42
|
+
}
|
|
43
|
+
window.location.href = finalRedirectUrl;
|
|
44
|
+
}
|
|
45
|
+
return null;
|
|
46
|
+
};
|
|
47
|
+
RedirectLogistration.defaultProps = {
|
|
48
|
+
authenticatedUser: {},
|
|
49
|
+
educationLevel: null,
|
|
50
|
+
finishAuthUrl: null,
|
|
51
|
+
success: false,
|
|
52
|
+
redirectUrl: '',
|
|
53
|
+
redirectToProgressiveProfilingPage: false,
|
|
54
|
+
optionalFields: {},
|
|
55
|
+
userId: null,
|
|
56
|
+
registrationEmbedded: false,
|
|
57
|
+
host: '',
|
|
58
|
+
};
|
|
59
|
+
RedirectLogistration.propTypes = {
|
|
60
|
+
authenticatedUser: PropTypes.shape({}),
|
|
61
|
+
educationLevel: PropTypes.string,
|
|
62
|
+
finishAuthUrl: PropTypes.string,
|
|
63
|
+
success: PropTypes.bool,
|
|
64
|
+
redirectUrl: PropTypes.string,
|
|
65
|
+
redirectToProgressiveProfilingPage: PropTypes.bool,
|
|
66
|
+
optionalFields: PropTypes.shape({}),
|
|
67
|
+
userId: PropTypes.number,
|
|
68
|
+
registrationEmbedded: PropTypes.bool,
|
|
69
|
+
host: PropTypes.string,
|
|
70
|
+
};
|
|
71
|
+
export default RedirectLogistration;
|
|
72
|
+
//# sourceMappingURL=RedirectLogistration.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RedirectLogistration.js","sourceRoot":"","sources":["../../src/common-components/RedirectLogistration.jsx"],"names":[],"mappings":";AAA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ACvB,CAAC;AAEF,eAAe,oBAAoB,CAAC","sourcesContent":["import { useAppConfig, getSiteConfig, getUrlByRouteRole } from '@openedx/frontend-base';\nimport PropTypes from 'prop-types';\nimport { Navigate } from 'react-router-dom';\n\nimport { welcomeRole } from '../constants';\nimport { REDIRECT } from '../data/constants';\nimport { setCookie } from '../data/utils';\n\nconst RedirectLogistration = (props) => {\n const {\n authenticatedUser,\n finishAuthUrl,\n redirectUrl,\n redirectToProgressiveProfilingPage,\n success,\n optionalFields,\n educationLevel,\n userId,\n registrationEmbedded,\n host,\n } = props;\n let finalRedirectUrl = '';\n\n if (success) {\n // If we're in a third party auth pipeline, we must complete the pipeline\n // once user has successfully logged in. Otherwise, redirect to the specified redirect url.\n // Note: For multiple enterprise use case, we need to make sure that user first visits the\n // enterprise selection page and then complete the auth workflow\n if (finishAuthUrl && !redirectUrl.includes(finishAuthUrl)) {\n finalRedirectUrl = getSiteConfig().lmsBaseUrl + finishAuthUrl;\n } else {\n finalRedirectUrl = redirectUrl;\n }\n\n // Redirect to Progressive Profiling after successful registration\n if (redirectToProgressiveProfilingPage) {\n // TODO: Do we still need this cookie?\n setCookie('van-504-returning-user', true, useAppConfig().SESSION_COOKIE_DOMAIN);\n\n if (registrationEmbedded) {\n window.parent.postMessage({\n action: REDIRECT,\n redirectUrl: useAppConfig().POST_REGISTRATION_REDIRECT_URL,\n }, host);\n return null;\n }\n const registrationResult = { redirectUrl: finalRedirectUrl, success };\n return (\n <Navigate\n to={getUrlByRouteRole(welcomeRole)}\n state={{\n registrationResult,\n optionalFields,\n authenticatedUser,\n }}\n replace\n />\n );\n }\n\n if (finalRedirectUrl.startsWith('/')) {\n return <Navigate to={finalRedirectUrl} replace />;\n }\n window.location.href = finalRedirectUrl;\n }\n\n return null;\n};\n\nRedirectLogistration.defaultProps = {\n authenticatedUser: {},\n educationLevel: null,\n finishAuthUrl: null,\n success: false,\n redirectUrl: '',\n redirectToProgressiveProfilingPage: false,\n optionalFields: {},\n userId: null,\n registrationEmbedded: false,\n host: '',\n};\n\nRedirectLogistration.propTypes = {\n authenticatedUser: PropTypes.shape({}),\n educationLevel: PropTypes.string,\n finishAuthUrl: PropTypes.string,\n success: PropTypes.bool,\n redirectUrl: PropTypes.string,\n redirectToProgressiveProfilingPage: PropTypes.bool,\n optionalFields: PropTypes.shape({}),\n userId: PropTypes.number,\n registrationEmbedded: PropTypes.bool,\n host: PropTypes.string,\n};\n\nexport default RedirectLogistration;\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function registerIcons(): void;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { library } from '@fortawesome/fontawesome-svg-core';
|
|
2
|
+
import { faApple, faFacebook, faGoogle, faMicrosoft, } from '@fortawesome/free-brands-svg-icons';
|
|
3
|
+
export default function registerIcons() {
|
|
4
|
+
library.add(faApple, faFacebook, faGoogle, faMicrosoft);
|
|
5
|
+
}
|
|
6
|
+
//# sourceMappingURL=RegisterFaIcons.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RegisterFaIcons.js","sourceRoot":"","sources":["../../src/common-components/RegisterFaIcons.jsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,mCAAmC,CAAC;AAC5D,OAAO,EACL,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,WAAW,GAC3C,MAAM,oCAAoC,CAAC;AAE5C,MAAM,CAAC,OAAO,UAAU,aAAa;IACnC,OAAO,CAAC,GAAG,CAAC,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,WAAW,CAAC,CAAC;AAC1D,CAAC","sourcesContent":["import { library } from '@fortawesome/fontawesome-svg-core';\nimport {\n faApple, faFacebook, faGoogle, faMicrosoft,\n} from '@fortawesome/free-brands-svg-icons';\n\nexport default function registerIcons() {\n library.add(faApple, faFacebook, faGoogle, faMicrosoft);\n}\n"]}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export default SocialAuthProviders;
|
|
2
|
+
declare function SocialAuthProviders(props: any): import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
declare namespace SocialAuthProviders {
|
|
4
|
+
namespace defaultProps {
|
|
5
|
+
export { loginPath as referrer };
|
|
6
|
+
export let socialAuthProviders: never[];
|
|
7
|
+
}
|
|
8
|
+
namespace propTypes {
|
|
9
|
+
export let referrer: PropTypes.Requireable<string>;
|
|
10
|
+
let socialAuthProviders_1: PropTypes.Requireable<(PropTypes.InferProps<{
|
|
11
|
+
id: PropTypes.Requireable<string>;
|
|
12
|
+
name: PropTypes.Requireable<string>;
|
|
13
|
+
iconClass: PropTypes.Requireable<string>;
|
|
14
|
+
iconImage: PropTypes.Requireable<string>;
|
|
15
|
+
loginUrl: PropTypes.Requireable<string>;
|
|
16
|
+
registerUrl: PropTypes.Requireable<string>;
|
|
17
|
+
skipRegistrationForm: PropTypes.Requireable<boolean>;
|
|
18
|
+
}> | null | undefined)[]>;
|
|
19
|
+
export { socialAuthProviders_1 as socialAuthProviders };
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
import { loginPath } from '../constants';
|
|
23
|
+
import PropTypes from 'prop-types';
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
|
3
|
+
import { getSiteConfig, useIntl } from '@openedx/frontend-base';
|
|
4
|
+
import { Icon } from '@openedx/paragon';
|
|
5
|
+
import { Login } from '@openedx/paragon/icons';
|
|
6
|
+
import PropTypes from 'prop-types';
|
|
7
|
+
import { loginPath } from '../constants';
|
|
8
|
+
import { SUPPORTED_ICON_CLASSES } from '../data/constants';
|
|
9
|
+
import messages from './messages';
|
|
10
|
+
const SocialAuthProviders = (props) => {
|
|
11
|
+
const { formatMessage } = useIntl();
|
|
12
|
+
const { referrer, socialAuthProviders } = props;
|
|
13
|
+
function handleSubmit(e) {
|
|
14
|
+
e.preventDefault();
|
|
15
|
+
const url = e.currentTarget.dataset.providerUrl;
|
|
16
|
+
window.location.href = getSiteConfig().lmsBaseUrl + url;
|
|
17
|
+
}
|
|
18
|
+
const socialAuth = socialAuthProviders.map((provider, index) => (_jsxs("button", { id: provider.id, type: "button", className: `btn-social btn-${provider.id} ${index % 2 === 0 ? 'mr-3' : ''}`, "data-provider-url": referrer === loginPath ? provider.loginUrl : provider.registerUrl, onClick: handleSubmit, children: [provider.iconImage ? (_jsx("div", { "aria-hidden": "true", children: _jsx("img", { className: "btn-tpa__image-icon", src: provider.iconImage, alt: `icon ${provider.name}` }) }))
|
|
19
|
+
: (_jsx("div", { className: "btn-tpa__font-container", "aria-hidden": "true", children: SUPPORTED_ICON_CLASSES.includes(provider.iconClass) ? (_jsx(FontAwesomeIcon, { icon: ['fab', provider.iconClass] }))
|
|
20
|
+
: (_jsx(Icon, { className: "h-75", src: Login })) })), _jsx("span", { id: "provider-name", className: "notranslate mr-auto pl-2", "aria-hidden": "true", children: provider.name }), _jsx("span", { className: "sr-only", children: referrer === loginPath
|
|
21
|
+
? formatMessage(messages['sso.sign.in.with'], { providerName: provider.name })
|
|
22
|
+
: formatMessage(messages['sso.create.account.using'], { providerName: provider.name }) })] }, provider.id)));
|
|
23
|
+
// eslint-disable-next-line react/jsx-no-useless-fragment
|
|
24
|
+
return _jsx(_Fragment, { children: socialAuth });
|
|
25
|
+
};
|
|
26
|
+
SocialAuthProviders.defaultProps = {
|
|
27
|
+
referrer: loginPath,
|
|
28
|
+
socialAuthProviders: [],
|
|
29
|
+
};
|
|
30
|
+
SocialAuthProviders.propTypes = {
|
|
31
|
+
referrer: PropTypes.string,
|
|
32
|
+
socialAuthProviders: PropTypes.arrayOf(PropTypes.shape({
|
|
33
|
+
id: PropTypes.string,
|
|
34
|
+
name: PropTypes.string,
|
|
35
|
+
iconClass: PropTypes.string,
|
|
36
|
+
iconImage: PropTypes.string,
|
|
37
|
+
loginUrl: PropTypes.string,
|
|
38
|
+
registerUrl: PropTypes.string,
|
|
39
|
+
skipRegistrationForm: PropTypes.bool,
|
|
40
|
+
})),
|
|
41
|
+
};
|
|
42
|
+
export default SocialAuthProviders;
|
|
43
|
+
//# sourceMappingURL=SocialAuthProviders.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SocialAuthProviders.js","sourceRoot":"","sources":["../../src/common-components/SocialAuthProviders.jsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AACjE,OAAO,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAChE,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AACxC,OAAO,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAC;AAC/C,OAAO,SAAS,MAAM,YAAY,CAAC;AAEnC,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AAC3D,OAAO,QAAQ,MAAM,YAAY,CAAC;AAElC,MAAM,mBAAmB,GAAG,CAAC,KAAK,EAAE,EAAE;IACpC,MAAM,EAAE,aAAa,EAAE,GAAG,OAAO,EAAE,CAAC;IACpC,MAAM,EAAE,QAAQ,EAAE,mBAAmB,EAAE,GAAG,KAAK,CAAC;IAEhD,SAAS,YAAY,CAAC,CAAC;QACrB,CAAC,CAAC,cAAc,EAAE,CAAC;QAEnB,MAAM,GAAG,GAAG,CAAC,CAAC,aAAa,CAAC,OAAO,CAAC,WAAW,CAAC;QAChD,MAAM,CAAC,QAAQ,CAAC,IAAI,GAAG,aAAa,EAAE,CAAC,UAAU,GAAG,GAAG,CAAC;IAC1D,CAAC;IAED,MAAM,UAAU,GAAG,mBAAmB,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,KAAK,EAAE,EAAE,CAAC,CAC9D,kBACE,EAAE,EAAE,QAAQ,CAAC,EAAE,EAEf,IAAI,EAAC,QAAQ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V,CAAC,CAAC;IAEH,yDAAyD;IACzD,OAAO,4BAAG,UAAU,GAAI,CAAC;AAC3B,CAAC,CAAC;AAEF,mBAAmB,CAAC,YAAY,GAAG;IACjC,QAAQ,EAAE,SAAS;IACnB,mBAAmB,EAAE,EAAE;CACxB,CAAC;AAEF,mBAAmB,CAAC,SAAS,GAAG;IAC9B,QAAQ,EAAE,SAAS,CAAC,MAAM;IAC1B,mBAAmB,EAAE,SAAS,CAAC,OAAO,CAAC,SAAS,CAAC,KAAK,CAAC;QACrD,EAAE,EAAE,SAAS,CAAC,MAAM;QACpB,IAAI,EAAE,SAAS,CAAC,MAAM;QACtB,SAAS,EAAE,SAAS,CAAC,MAAM;QAC3B,SAAS,EAAE,SAAS,CAAC,MAAM;QAC3B,QAAQ,EAAE,SAAS,CAAC,MAAM;QAC1B,WAAW,EAAE,SAAS,CAAC,MAAM;QAC7B,oBAAoB,EAAE,SAAS,CAAC,IAAI;KACrC,CAAC,CAAC;CACJ,CAAC;AAEF,eAAe,mBAAmB,CAAC","sourcesContent":["import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';\nimport { getSiteConfig, useIntl } from '@openedx/frontend-base';\nimport { Icon } from '@openedx/paragon';\nimport { Login } from '@openedx/paragon/icons';\nimport PropTypes from 'prop-types';\n\nimport { loginPath } from '../constants';\nimport { SUPPORTED_ICON_CLASSES } from '../data/constants';\nimport messages from './messages';\n\nconst SocialAuthProviders = (props) => {\n const { formatMessage } = useIntl();\n const { referrer, socialAuthProviders } = props;\n\n function handleSubmit(e) {\n e.preventDefault();\n\n const url = e.currentTarget.dataset.providerUrl;\n window.location.href = getSiteConfig().lmsBaseUrl + url;\n }\n\n const socialAuth = socialAuthProviders.map((provider, index) => (\n <button\n id={provider.id}\n key={provider.id}\n type=\"button\"\n className={`btn-social btn-${provider.id} ${index % 2 === 0 ? 'mr-3' : ''}`}\n data-provider-url={referrer === loginPath ? provider.loginUrl : provider.registerUrl}\n onClick={handleSubmit}\n >\n {provider.iconImage ? (\n <div aria-hidden=\"true\">\n <img className=\"btn-tpa__image-icon\" src={provider.iconImage} alt={`icon ${provider.name}`} />\n </div>\n )\n : (\n <div className=\"btn-tpa__font-container\" aria-hidden=\"true\">\n {SUPPORTED_ICON_CLASSES.includes(provider.iconClass) ? (\n <FontAwesomeIcon icon={['fab', provider.iconClass]} />)\n : (\n <Icon className=\"h-75\" src={Login} />\n )}\n </div>\n )}\n <span id=\"provider-name\" className=\"notranslate mr-auto pl-2\" aria-hidden=\"true\">{provider.name}</span>\n <span className=\"sr-only\">\n {referrer === loginPath\n ? formatMessage(messages['sso.sign.in.with'], { providerName: provider.name })\n : formatMessage(messages['sso.create.account.using'], { providerName: provider.name })}\n </span>\n </button>\n ));\n\n // eslint-disable-next-line react/jsx-no-useless-fragment\n return <>{socialAuth}</>;\n};\n\nSocialAuthProviders.defaultProps = {\n referrer: loginPath,\n socialAuthProviders: [],\n};\n\nSocialAuthProviders.propTypes = {\n referrer: PropTypes.string,\n socialAuthProviders: PropTypes.arrayOf(PropTypes.shape({\n id: PropTypes.string,\n name: PropTypes.string,\n iconClass: PropTypes.string,\n iconImage: PropTypes.string,\n loginUrl: PropTypes.string,\n registerUrl: PropTypes.string,\n skipRegistrationForm: PropTypes.bool,\n })),\n};\n\nexport default SocialAuthProviders;\n"]}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
export default ThirdPartyAuth;
|
|
2
|
+
/**
|
|
3
|
+
* This component renders the Single sign-on (SSO) buttons for the providers passed.
|
|
4
|
+
* */
|
|
5
|
+
declare function ThirdPartyAuth(props: any): import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
declare namespace ThirdPartyAuth {
|
|
7
|
+
namespace defaultProps {
|
|
8
|
+
export let currentProvider: null;
|
|
9
|
+
export let providers: never[];
|
|
10
|
+
export let secondaryProviders: never[];
|
|
11
|
+
export { PENDING_STATE as thirdPartyAuthApiStatus };
|
|
12
|
+
export let isLoginPage: boolean;
|
|
13
|
+
}
|
|
14
|
+
namespace propTypes {
|
|
15
|
+
let currentProvider_1: PropTypes.Requireable<string>;
|
|
16
|
+
export { currentProvider_1 as currentProvider };
|
|
17
|
+
export let handleInstitutionLogin: PropTypes.Validator<(...args: any[]) => any>;
|
|
18
|
+
let providers_1: PropTypes.Requireable<(PropTypes.InferProps<{
|
|
19
|
+
id: PropTypes.Requireable<string>;
|
|
20
|
+
name: PropTypes.Requireable<string>;
|
|
21
|
+
iconClass: PropTypes.Requireable<string>;
|
|
22
|
+
iconImage: PropTypes.Requireable<string>;
|
|
23
|
+
loginUrl: PropTypes.Requireable<string>;
|
|
24
|
+
registerUrl: PropTypes.Requireable<string>;
|
|
25
|
+
}> | null | undefined)[]>;
|
|
26
|
+
export { providers_1 as providers };
|
|
27
|
+
let secondaryProviders_1: PropTypes.Requireable<(PropTypes.InferProps<{
|
|
28
|
+
id: PropTypes.Requireable<string>;
|
|
29
|
+
name: PropTypes.Requireable<string>;
|
|
30
|
+
iconClass: PropTypes.Requireable<string>;
|
|
31
|
+
iconImage: PropTypes.Requireable<string>;
|
|
32
|
+
loginUrl: PropTypes.Requireable<string>;
|
|
33
|
+
registerUrl: PropTypes.Requireable<string>;
|
|
34
|
+
}> | null | undefined)[]>;
|
|
35
|
+
export { secondaryProviders_1 as secondaryProviders };
|
|
36
|
+
export let thirdPartyAuthApiStatus: PropTypes.Requireable<string>;
|
|
37
|
+
let isLoginPage_1: PropTypes.Requireable<boolean>;
|
|
38
|
+
export { isLoginPage_1 as isLoginPage };
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
import { PENDING_STATE } from '../data/constants';
|
|
42
|
+
import PropTypes from 'prop-types';
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { useAppConfig, getSiteConfig, useIntl } from '@openedx/frontend-base';
|
|
3
|
+
import { Hyperlink, Icon, } from '@openedx/paragon';
|
|
4
|
+
import { Institution } from '@openedx/paragon/icons';
|
|
5
|
+
import classNames from 'classnames';
|
|
6
|
+
import PropTypes from 'prop-types';
|
|
7
|
+
import Skeleton from 'react-loading-skeleton';
|
|
8
|
+
import { loginPath, registerPath } from '../constants';
|
|
9
|
+
import { ENTERPRISE_LOGIN_URL, PENDING_STATE } from '../data/constants';
|
|
10
|
+
import messages from './messages';
|
|
11
|
+
import { RenderInstitutionButton, SocialAuthProviders, } from './index';
|
|
12
|
+
/**
|
|
13
|
+
* This component renders the Single sign-on (SSO) buttons for the providers passed.
|
|
14
|
+
* */
|
|
15
|
+
const ThirdPartyAuth = (props) => {
|
|
16
|
+
const { formatMessage } = useIntl();
|
|
17
|
+
const { providers, secondaryProviders, currentProvider, handleInstitutionLogin, thirdPartyAuthApiStatus, isLoginPage, } = props;
|
|
18
|
+
const isInstitutionAuthActive = !!secondaryProviders.length && !currentProvider;
|
|
19
|
+
const isSocialAuthActive = !!providers.length && !currentProvider;
|
|
20
|
+
const isEnterpriseLoginDisabled = useAppConfig().DISABLE_ENTERPRISE_LOGIN;
|
|
21
|
+
const enterpriseLoginURL = getSiteConfig().lmsBaseUrl + ENTERPRISE_LOGIN_URL;
|
|
22
|
+
const isThirdPartyAuthActive = isSocialAuthActive || (isEnterpriseLoginDisabled && isInstitutionAuthActive);
|
|
23
|
+
return (_jsxs(_Fragment, { children: [((isEnterpriseLoginDisabled && isInstitutionAuthActive) || isSocialAuthActive) && (_jsx("div", { className: "mt-4 mb-3 h4", children: isLoginPage
|
|
24
|
+
? formatMessage(messages['login.other.options.heading'])
|
|
25
|
+
: formatMessage(messages['registration.other.options.heading']) })), (isLoginPage && !isEnterpriseLoginDisabled && isSocialAuthActive) && (_jsxs(Hyperlink, { className: classNames('btn btn-link btn-sm text-body p-0', { 'mb-0': thirdPartyAuthApiStatus === PENDING_STATE }, { 'mb-4': thirdPartyAuthApiStatus !== PENDING_STATE }), destination: enterpriseLoginURL, children: [_jsx(Icon, { src: Institution, className: "institute-icon" }), formatMessage(messages['enterprise.login.btn.text'])] })), thirdPartyAuthApiStatus === PENDING_STATE && isThirdPartyAuthActive ? (_jsx("div", { className: "mt-4", children: _jsx(Skeleton, { className: "tpa-skeleton", height: 36, count: 2 }) })) : (_jsxs(_Fragment, { children: [(isEnterpriseLoginDisabled && isInstitutionAuthActive) && (_jsx(RenderInstitutionButton, { onSubmitHandler: handleInstitutionLogin, buttonTitle: formatMessage(messages['institution.login.button']) })), isSocialAuthActive && (_jsx("div", { className: "row m-0", children: _jsx(SocialAuthProviders, { socialAuthProviders: providers, referrer: isLoginPage ? loginPath : registerPath }) }))] }))] }));
|
|
26
|
+
};
|
|
27
|
+
ThirdPartyAuth.defaultProps = {
|
|
28
|
+
currentProvider: null,
|
|
29
|
+
providers: [],
|
|
30
|
+
secondaryProviders: [],
|
|
31
|
+
thirdPartyAuthApiStatus: PENDING_STATE,
|
|
32
|
+
isLoginPage: false,
|
|
33
|
+
};
|
|
34
|
+
ThirdPartyAuth.propTypes = {
|
|
35
|
+
currentProvider: PropTypes.string,
|
|
36
|
+
handleInstitutionLogin: PropTypes.func.isRequired,
|
|
37
|
+
providers: PropTypes.arrayOf(PropTypes.shape({
|
|
38
|
+
id: PropTypes.string,
|
|
39
|
+
name: PropTypes.string,
|
|
40
|
+
iconClass: PropTypes.string,
|
|
41
|
+
iconImage: PropTypes.string,
|
|
42
|
+
loginUrl: PropTypes.string,
|
|
43
|
+
registerUrl: PropTypes.string,
|
|
44
|
+
})),
|
|
45
|
+
secondaryProviders: PropTypes.arrayOf(PropTypes.shape({
|
|
46
|
+
id: PropTypes.string,
|
|
47
|
+
name: PropTypes.string,
|
|
48
|
+
iconClass: PropTypes.string,
|
|
49
|
+
iconImage: PropTypes.string,
|
|
50
|
+
loginUrl: PropTypes.string,
|
|
51
|
+
registerUrl: PropTypes.string,
|
|
52
|
+
})),
|
|
53
|
+
thirdPartyAuthApiStatus: PropTypes.string,
|
|
54
|
+
isLoginPage: PropTypes.bool,
|
|
55
|
+
};
|
|
56
|
+
export default ThirdPartyAuth;
|
|
57
|
+
//# sourceMappingURL=ThirdPartyAuth.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ThirdPartyAuth.js","sourceRoot":"","sources":["../../src/common-components/ThirdPartyAuth.jsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAC9E,OAAO,EACL,SAAS,EAAE,IAAI,GAChB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,SAAS,MAAM,YAAY,CAAC;AACnC,OAAO,QAAQ,MAAM,wBAAwB,CAAC;AAE9C,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AACvD,OAAO,EAAE,oBAAoB,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AACxE,OAAO,QAAQ,MAAM,YAAY,CAAC;AAElC,OAAO,EACL,uBAAuB,EACvB,mBAAmB,GACpB,MAAM,SAAS,CAAC;AAEjB;;KAEK;AACL,MAAM,cAAc,GAAG,CAAC,KAAK,EAAE,EAAE;IAC/B,MAAM,EAAE,aAAa,EAAE,GAAG,OAAO,EAAE,CAAC;IACpC,MAAM,EACJ,SAAS,EACT,kBAAkB,EAClB,eAAe,EACf,sBAAsB,EACtB,uBAAuB,EACvB,WAAW,GACZ,GAAG,KAAK,CAAC;IACV,MAAM,uBAAuB,GAAG,CAAC,CAAC,kBAAkB,CAAC,MAAM,IAAI,CAAC,eAAe,CAAC;IAChF,MAAM,kBAAkB,GAAG,CAAC,CAAC,SAAS,CAAC,MAAM,IAAI,CAAC,eAAe,CAAC;IAClE,MAAM,yBAAyB,GAAG,YAAY,EAAE,CAAC,wBAAwB,CAAC;IAC1E,MAAM,kBAAkB,GAAG,aAAa,EAAE,CAAC,UAAU,GAAG,oBAAoB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openedx/paragon';\nimport { Institution } from '@openedx/paragon/icons';\nimport classNames from 'classnames';\nimport PropTypes from 'prop-types';\nimport Skeleton from 'react-loading-skeleton';\n\nimport { loginPath, registerPath } from '../constants';\nimport { ENTERPRISE_LOGIN_URL, PENDING_STATE } from '../data/constants';\nimport messages from './messages';\n\nimport {\n RenderInstitutionButton,\n SocialAuthProviders,\n} from './index';\n\n/**\n * This component renders the Single sign-on (SSO) buttons for the providers passed.\n * */\nconst ThirdPartyAuth = (props) => {\n const { formatMessage } = useIntl();\n const {\n providers,\n secondaryProviders,\n currentProvider,\n handleInstitutionLogin,\n thirdPartyAuthApiStatus,\n isLoginPage,\n } = props;\n const isInstitutionAuthActive = !!secondaryProviders.length && !currentProvider;\n const isSocialAuthActive = !!providers.length && !currentProvider;\n const isEnterpriseLoginDisabled = useAppConfig().DISABLE_ENTERPRISE_LOGIN;\n const enterpriseLoginURL = getSiteConfig().lmsBaseUrl + ENTERPRISE_LOGIN_URL;\n const isThirdPartyAuthActive = isSocialAuthActive || (isEnterpriseLoginDisabled && isInstitutionAuthActive);\n\n return (\n <>\n {((isEnterpriseLoginDisabled && isInstitutionAuthActive) || isSocialAuthActive) && (\n <div className=\"mt-4 mb-3 h4\">\n {isLoginPage\n ? formatMessage(messages['login.other.options.heading'])\n : formatMessage(messages['registration.other.options.heading'])}\n </div>\n )}\n {(isLoginPage && !isEnterpriseLoginDisabled && isSocialAuthActive) && (\n <Hyperlink\n className={classNames(\n 'btn btn-link btn-sm text-body p-0',\n { 'mb-0': thirdPartyAuthApiStatus === PENDING_STATE },\n { 'mb-4': thirdPartyAuthApiStatus !== PENDING_STATE },\n )}\n destination={enterpriseLoginURL}\n >\n <Icon src={Institution} className=\"institute-icon\" />\n {formatMessage(messages['enterprise.login.btn.text'])}\n </Hyperlink>\n )}\n\n {thirdPartyAuthApiStatus === PENDING_STATE && isThirdPartyAuthActive ? (\n <div className=\"mt-4\">\n <Skeleton className=\"tpa-skeleton\" height={36} count={2} />\n </div>\n ) : (\n <>\n {(isEnterpriseLoginDisabled && isInstitutionAuthActive) && (\n <RenderInstitutionButton\n onSubmitHandler={handleInstitutionLogin}\n buttonTitle={formatMessage(messages['institution.login.button'])}\n />\n )}\n {isSocialAuthActive && (\n <div className=\"row m-0\">\n <SocialAuthProviders\n socialAuthProviders={providers}\n referrer={isLoginPage ? loginPath : registerPath}\n />\n </div>\n )}\n </>\n )}\n </>\n );\n};\n\nThirdPartyAuth.defaultProps = {\n currentProvider: null,\n providers: [],\n secondaryProviders: [],\n thirdPartyAuthApiStatus: PENDING_STATE,\n isLoginPage: false,\n};\n\nThirdPartyAuth.propTypes = {\n currentProvider: PropTypes.string,\n handleInstitutionLogin: PropTypes.func.isRequired,\n providers: PropTypes.arrayOf(\n PropTypes.shape({\n id: PropTypes.string,\n name: PropTypes.string,\n iconClass: PropTypes.string,\n iconImage: PropTypes.string,\n loginUrl: PropTypes.string,\n registerUrl: PropTypes.string,\n }),\n ),\n secondaryProviders: PropTypes.arrayOf(\n PropTypes.shape({\n id: PropTypes.string,\n name: PropTypes.string,\n iconClass: PropTypes.string,\n iconImage: PropTypes.string,\n loginUrl: PropTypes.string,\n registerUrl: PropTypes.string,\n }),\n ),\n thirdPartyAuthApiStatus: PropTypes.string,\n isLoginPage: PropTypes.bool,\n};\n\nexport default ThirdPartyAuth;\n"]}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export default ThirdPartyAuthAlert;
|
|
2
|
+
declare function ThirdPartyAuthAlert(props: any): import("react/jsx-runtime").JSX.Element | null;
|
|
3
|
+
declare namespace ThirdPartyAuthAlert {
|
|
4
|
+
namespace defaultProps {
|
|
5
|
+
export let currentProvider: string;
|
|
6
|
+
export { loginPath as referrer };
|
|
7
|
+
}
|
|
8
|
+
namespace propTypes {
|
|
9
|
+
let currentProvider_1: PropTypes.Requireable<string>;
|
|
10
|
+
export { currentProvider_1 as currentProvider };
|
|
11
|
+
export let referrer: PropTypes.Requireable<string>;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
import { loginPath } from '../constants';
|
|
15
|
+
import PropTypes from 'prop-types';
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { getSiteConfig, useIntl } from '@openedx/frontend-base';
|
|
3
|
+
import { Alert } from '@openedx/paragon';
|
|
4
|
+
import PropTypes from 'prop-types';
|
|
5
|
+
import { loginPath, registerPath } from '../constants';
|
|
6
|
+
import messages from './messages';
|
|
7
|
+
const ThirdPartyAuthAlert = (props) => {
|
|
8
|
+
const { formatMessage } = useIntl();
|
|
9
|
+
const { currentProvider, referrer } = props;
|
|
10
|
+
const platformName = getSiteConfig().siteName;
|
|
11
|
+
let message;
|
|
12
|
+
if (referrer === loginPath) {
|
|
13
|
+
message = formatMessage(messages['login.third.party.auth.account.not.linked'], { currentProvider, platformName });
|
|
14
|
+
}
|
|
15
|
+
else {
|
|
16
|
+
message = formatMessage(messages['register.third.party.auth.account.not.linked'], { currentProvider, platformName });
|
|
17
|
+
}
|
|
18
|
+
if (!currentProvider) {
|
|
19
|
+
return null;
|
|
20
|
+
}
|
|
21
|
+
return (_jsxs(_Fragment, { children: [_jsxs(Alert, { id: "tpa-alert", className: referrer === registerPath ? 'alert-success mt-n2 mb-5' : 'alert-warning mt-n2 mb-5', children: [referrer === registerPath ? (_jsx(Alert.Heading, { children: formatMessage(messages['tpa.alert.heading']) })) : null, _jsx("p", { children: message })] }), referrer === registerPath ? (_jsx("h4", { className: "mt-4 mb-4", children: formatMessage(messages['registration.using.tpa.form.heading']) })) : null] }));
|
|
22
|
+
};
|
|
23
|
+
ThirdPartyAuthAlert.defaultProps = {
|
|
24
|
+
currentProvider: '',
|
|
25
|
+
referrer: loginPath,
|
|
26
|
+
};
|
|
27
|
+
ThirdPartyAuthAlert.propTypes = {
|
|
28
|
+
currentProvider: PropTypes.string,
|
|
29
|
+
referrer: PropTypes.string,
|
|
30
|
+
};
|
|
31
|
+
export default ThirdPartyAuthAlert;
|
|
32
|
+
//# sourceMappingURL=ThirdPartyAuthAlert.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ThirdPartyAuthAlert.js","sourceRoot":"","sources":["../../src/common-components/ThirdPartyAuthAlert.jsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAChE,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACzC,OAAO,SAAS,MAAM,YAAY,CAAC;AAEnC,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AACvD,OAAO,QAAQ,MAAM,YAAY,CAAC;AAElC,MAAM,mBAAmB,GAAG,CAAC,KAAK,EAAE,EAAE;IACpC,MAAM,EAAE,aAAa,EAAE,GAAG,OAAO,EAAE,CAAC;IACpC,MAAM,EAAE,eAAe,EAAE,QAAQ,EAAE,GAAG,KAAK,CAAC;IAC5C,MAAM,YAAY,GAAG,aAAa,EAAE,CAAC,QAAQ,CAAC;IAC9C,IAAI,OAAO,CAAC;IAEZ,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;QAC3B,OAAO,GAAG,aAAa,CAAC,QAAQ,CAAC,2CAA2C,CAAC,EAAE,EAAE,eAAe,EAAE,YAAY,EAAE,CAAC,CAAC;IACpH,CAAC;SAAM,CAAC;QACN,OAAO,GAAG,aAAa,CAAC,QAAQ,CAAC,8CAA8C,CAAC,EAAE,EAAE,eAAe,EAAE,YAAY,EAAE,CAAC,CAAC;IACvH,CAAC;IAED,IAAI,CAAC,eAAe,EAAE,CAAC;QACrB,OAAO,IAAI,CAAC;IACd,CAAC;IAED,OAAO,CACL,8BACE,MAAC,KAAK,IAAC,EAAE,EAAC,WAAW,EAAC,SAAS,EAAE,QAAQ,KAAK,YAAY,CAAC,CAAC,CAAC,0BAA0B,CAAC,CAAC,CAAC,0BAA0B,aACjH,QAAQ,KAAK,YAAY,CAAC,CAAC,CAAC,CAC3B,KAAC,KAAK,CAAC,OAAO,cAAE,aAAa,CAAC,QAAQ,CAAC,mBAAmB,CAAC,CAAC,GAAiB,CAC9E,CAAC,CAAC,CAAC,IAAI,EACR,sBAAI,OAAO,GAAK,IACV,EACP,QAAQ,KAAK,YAAY,CAAC,CAAC,CAAC,CAC3B,aAAI,SAAS,EAAC,WAAW,YAAE,aAAa,CAAC,QAAQ,CAAC,qCAAqC,CAAC,CAAC,GAAM,CAChG,CAAC,CAAC,CAAC,IAAI,IACP,CACJ,CAAC;AACJ,CAAC,CAAC;AAEF,mBAAmB,CAAC,YAAY,GAAG;IACjC,eAAe,EAAE,EAAE;IACnB,QAAQ,EAAE,SAAS;CACpB,CAAC;AAEF,mBAAmB,CAAC,SAAS,GAAG;IAC9B,eAAe,EAAE,SAAS,CAAC,MAAM;IACjC,QAAQ,EAAE,SAAS,CAAC,MAAM;CAC3B,CAAC;AAEF,eAAe,mBAAmB,CAAC","sourcesContent":["import { getSiteConfig, useIntl } from '@openedx/frontend-base';\nimport { Alert } from '@openedx/paragon';\nimport PropTypes from 'prop-types';\n\nimport { loginPath, registerPath } from '../constants';\nimport messages from './messages';\n\nconst ThirdPartyAuthAlert = (props) => {\n const { formatMessage } = useIntl();\n const { currentProvider, referrer } = props;\n const platformName = getSiteConfig().siteName;\n let message;\n\n if (referrer === loginPath) {\n message = formatMessage(messages['login.third.party.auth.account.not.linked'], { currentProvider, platformName });\n } else {\n message = formatMessage(messages['register.third.party.auth.account.not.linked'], { currentProvider, platformName });\n }\n\n if (!currentProvider) {\n return null;\n }\n\n return (\n <>\n <Alert id=\"tpa-alert\" className={referrer === registerPath ? 'alert-success mt-n2 mb-5' : 'alert-warning mt-n2 mb-5'}>\n {referrer === registerPath ? (\n <Alert.Heading>{formatMessage(messages['tpa.alert.heading'])}</Alert.Heading>\n ) : null}\n <p>{message}</p>\n </Alert>\n {referrer === registerPath ? (\n <h4 className=\"mt-4 mb-4\">{formatMessage(messages['registration.using.tpa.form.heading'])}</h4>\n ) : null}\n </>\n );\n};\n\nThirdPartyAuthAlert.defaultProps = {\n currentProvider: '',\n referrer: loginPath,\n};\n\nThirdPartyAuthAlert.propTypes = {\n currentProvider: PropTypes.string,\n referrer: PropTypes.string,\n};\n\nexport default ThirdPartyAuthAlert;\n"]}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export default UnAuthOnlyRoute;
|
|
2
|
+
/**
|
|
3
|
+
* This wrapper redirects the requester to our default redirect url if they are
|
|
4
|
+
* already authenticated.
|
|
5
|
+
*/
|
|
6
|
+
declare function UnAuthOnlyRoute({ children }: {
|
|
7
|
+
children: any;
|
|
8
|
+
}): any;
|
|
9
|
+
declare namespace UnAuthOnlyRoute {
|
|
10
|
+
namespace propTypes {
|
|
11
|
+
let children: PropTypes.Validator<NonNullable<PropTypes.ReactNodeLike>>;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
import PropTypes from 'prop-types';
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useState } from 'react';
|
|
3
|
+
import { fetchAuthenticatedUser, getAuthenticatedUser, getUrlByRouteRole } from '@openedx/frontend-base';
|
|
4
|
+
import PropTypes from 'prop-types';
|
|
5
|
+
import { Navigate } from 'react-router-dom';
|
|
6
|
+
import { dashboardRole } from '../constants';
|
|
7
|
+
/**
|
|
8
|
+
* This wrapper redirects the requester to our default redirect url if they are
|
|
9
|
+
* already authenticated.
|
|
10
|
+
*/
|
|
11
|
+
const UnAuthOnlyRoute = ({ children }) => {
|
|
12
|
+
const [authUser, setAuthUser] = useState({});
|
|
13
|
+
const [isReady, setIsReady] = useState(false);
|
|
14
|
+
useEffect(() => {
|
|
15
|
+
fetchAuthenticatedUser({ forceRefresh: !!getAuthenticatedUser() }).then((authenticatedUser) => {
|
|
16
|
+
setAuthUser(authenticatedUser);
|
|
17
|
+
setIsReady(true);
|
|
18
|
+
});
|
|
19
|
+
}, []);
|
|
20
|
+
if (isReady) {
|
|
21
|
+
if (authUser && authUser.username) {
|
|
22
|
+
return _jsx(Navigate, { to: getUrlByRouteRole(dashboardRole) || '/', replace: true });
|
|
23
|
+
}
|
|
24
|
+
return children;
|
|
25
|
+
}
|
|
26
|
+
return null;
|
|
27
|
+
};
|
|
28
|
+
UnAuthOnlyRoute.propTypes = {
|
|
29
|
+
children: PropTypes.node.isRequired,
|
|
30
|
+
};
|
|
31
|
+
export default UnAuthOnlyRoute;
|
|
32
|
+
//# sourceMappingURL=UnAuthOnlyRoute.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UnAuthOnlyRoute.js","sourceRoot":"","sources":["../../src/common-components/UnAuthOnlyRoute.jsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAE5C,OAAO,EAAE,sBAAsB,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AACzG,OAAO,SAAS,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAE5C,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAE7C;;;GAGG;AACH,MAAM,eAAe,GAAG,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE;IACvC,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,GAAG,QAAQ,CAAC,EAAE,CAAC,CAAC;IAC7C,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAE9C,SAAS,CAAC,GAAG,EAAE;QACb,sBAAsB,CAAC,EAAE,YAAY,EAAE,CAAC,CAAC,oBAAoB,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,iBAAiB,EAAE,EAAE;YAC5F,WAAW,CAAC,iBAAiB,CAAC,CAAC;YAC/B,UAAU,CAAC,IAAI,CAAC,CAAC;QACnB,CAAC,CAAC,CAAC;IACL,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,IAAI,OAAO,EAAE,CAAC;QACZ,IAAI,QAAQ,IAAI,QAAQ,CAAC,QAAQ,EAAE,CAAC;YAClC,OAAO,KAAC,QAAQ,IAAC,EAAE,EAAE,iBAAiB,CAAC,aAAa,CAAC,IAAI,GAAG,EAAE,OAAO,SAAG,CAAC;QAC3E,CAAC;QAED,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC,CAAC;AAEF,eAAe,CAAC,SAAS,GAAG;IAC1B,QAAQ,EAAE,SAAS,CAAC,IAAI,CAAC,UAAU;CACpC,CAAC;AAEF,eAAe,eAAe,CAAC","sourcesContent":["import { useEffect, useState } from 'react';\n\nimport { fetchAuthenticatedUser, getAuthenticatedUser, getUrlByRouteRole } from '@openedx/frontend-base';\nimport PropTypes from 'prop-types';\nimport { Navigate } from 'react-router-dom';\n\nimport { dashboardRole } from '../constants';\n\n/**\n * This wrapper redirects the requester to our default redirect url if they are\n * already authenticated.\n */\nconst UnAuthOnlyRoute = ({ children }) => {\n const [authUser, setAuthUser] = useState({});\n const [isReady, setIsReady] = useState(false);\n\n useEffect(() => {\n fetchAuthenticatedUser({ forceRefresh: !!getAuthenticatedUser() }).then((authenticatedUser) => {\n setAuthUser(authenticatedUser);\n setIsReady(true);\n });\n }, []);\n\n if (isReady) {\n if (authUser && authUser.username) {\n return <Navigate to={getUrlByRouteRole(dashboardRole) || '/'} replace />;\n }\n\n return children;\n }\n\n return null;\n};\n\nUnAuthOnlyRoute.propTypes = {\n children: PropTypes.node.isRequired,\n};\n\nexport default UnAuthOnlyRoute;\n"]}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { FC, ReactNode } from 'react';
|
|
2
|
+
interface ThirdPartyAuthContextType {
|
|
3
|
+
fieldDescriptions: any;
|
|
4
|
+
optionalFields: {
|
|
5
|
+
fields: any;
|
|
6
|
+
extended_profile: any[];
|
|
7
|
+
};
|
|
8
|
+
thirdPartyAuthApiStatus: string | null;
|
|
9
|
+
thirdPartyAuthContext: {
|
|
10
|
+
platformName: string | null;
|
|
11
|
+
autoSubmitRegForm: boolean;
|
|
12
|
+
currentProvider: string | null;
|
|
13
|
+
finishAuthUrl: string | null;
|
|
14
|
+
countryCode: string | null;
|
|
15
|
+
providers: any[];
|
|
16
|
+
secondaryProviders: any[];
|
|
17
|
+
pipelineUserDetails: any | null;
|
|
18
|
+
errorMessage: string | null;
|
|
19
|
+
welcomePageRedirectUrl: string | null;
|
|
20
|
+
};
|
|
21
|
+
setThirdPartyAuthContextBegin: () => void;
|
|
22
|
+
setThirdPartyAuthContextSuccess: (fieldDescData: any, optionalFieldsData: any, contextData: any) => void;
|
|
23
|
+
setThirdPartyAuthContextFailure: () => void;
|
|
24
|
+
clearThirdPartyAuthErrorMessage: () => void;
|
|
25
|
+
}
|
|
26
|
+
interface ThirdPartyAuthProviderProps {
|
|
27
|
+
children: ReactNode;
|
|
28
|
+
}
|
|
29
|
+
export declare const ThirdPartyAuthProvider: FC<ThirdPartyAuthProviderProps>;
|
|
30
|
+
export declare const useThirdPartyAuthContext: () => ThirdPartyAuthContextType;
|
|
31
|
+
export {};
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { createContext, useCallback, useContext, useMemo, useState, } from 'react';
|
|
3
|
+
import { COMPLETE_STATE, FAILURE_STATE, PENDING_STATE } from '../../data/constants';
|
|
4
|
+
const ThirdPartyAuthContext = createContext(undefined);
|
|
5
|
+
export const ThirdPartyAuthProvider = ({ children }) => {
|
|
6
|
+
const [fieldDescriptions, setFieldDescriptions] = useState({});
|
|
7
|
+
const [optionalFields, setOptionalFields] = useState({
|
|
8
|
+
fields: {},
|
|
9
|
+
extended_profile: [],
|
|
10
|
+
});
|
|
11
|
+
const [thirdPartyAuthApiStatus, setThirdPartyAuthApiStatus] = useState(null);
|
|
12
|
+
const [thirdPartyAuthContext, setThirdPartyAuthContext] = useState({
|
|
13
|
+
platformName: null,
|
|
14
|
+
autoSubmitRegForm: false,
|
|
15
|
+
currentProvider: null,
|
|
16
|
+
finishAuthUrl: null,
|
|
17
|
+
countryCode: null,
|
|
18
|
+
providers: [],
|
|
19
|
+
secondaryProviders: [],
|
|
20
|
+
pipelineUserDetails: null,
|
|
21
|
+
errorMessage: null,
|
|
22
|
+
welcomePageRedirectUrl: null,
|
|
23
|
+
});
|
|
24
|
+
// Function to handle begin state - mirrors THIRD_PARTY_AUTH_CONTEXT.BEGIN
|
|
25
|
+
const setThirdPartyAuthContextBegin = useCallback(() => {
|
|
26
|
+
setThirdPartyAuthApiStatus(PENDING_STATE);
|
|
27
|
+
}, []);
|
|
28
|
+
// Function to handle success - mirrors THIRD_PARTY_AUTH_CONTEXT.SUCCESS
|
|
29
|
+
const setThirdPartyAuthContextSuccess = useCallback((fieldDescData, optionalFieldsData, contextData) => {
|
|
30
|
+
setFieldDescriptions((fieldDescData === null || fieldDescData === void 0 ? void 0 : fieldDescData.fields) || {});
|
|
31
|
+
setOptionalFields(optionalFieldsData || { fields: {}, extended_profile: [] });
|
|
32
|
+
setThirdPartyAuthContext(contextData || {
|
|
33
|
+
platformName: null,
|
|
34
|
+
autoSubmitRegForm: false,
|
|
35
|
+
currentProvider: null,
|
|
36
|
+
finishAuthUrl: null,
|
|
37
|
+
countryCode: null,
|
|
38
|
+
providers: [],
|
|
39
|
+
secondaryProviders: [],
|
|
40
|
+
pipelineUserDetails: null,
|
|
41
|
+
errorMessage: null,
|
|
42
|
+
welcomePageRedirectUrl: null,
|
|
43
|
+
});
|
|
44
|
+
setThirdPartyAuthApiStatus(COMPLETE_STATE);
|
|
45
|
+
}, []);
|
|
46
|
+
// Function to handle failure - mirrors THIRD_PARTY_AUTH_CONTEXT.FAILURE
|
|
47
|
+
const setThirdPartyAuthContextFailure = useCallback(() => {
|
|
48
|
+
setThirdPartyAuthApiStatus(FAILURE_STATE);
|
|
49
|
+
setThirdPartyAuthContext(prev => (Object.assign(Object.assign({}, prev), { errorMessage: null })));
|
|
50
|
+
}, []);
|
|
51
|
+
// Function to clear error message - mirrors THIRD_PARTY_AUTH_CONTEXT_CLEAR_ERROR_MSG
|
|
52
|
+
const clearThirdPartyAuthErrorMessage = useCallback(() => {
|
|
53
|
+
setThirdPartyAuthApiStatus(PENDING_STATE);
|
|
54
|
+
setThirdPartyAuthContext(prev => (Object.assign(Object.assign({}, prev), { errorMessage: null })));
|
|
55
|
+
}, []);
|
|
56
|
+
const value = useMemo(() => ({
|
|
57
|
+
fieldDescriptions,
|
|
58
|
+
optionalFields,
|
|
59
|
+
thirdPartyAuthApiStatus,
|
|
60
|
+
thirdPartyAuthContext,
|
|
61
|
+
setThirdPartyAuthContextBegin,
|
|
62
|
+
setThirdPartyAuthContextSuccess,
|
|
63
|
+
setThirdPartyAuthContextFailure,
|
|
64
|
+
clearThirdPartyAuthErrorMessage,
|
|
65
|
+
}), [
|
|
66
|
+
fieldDescriptions,
|
|
67
|
+
optionalFields,
|
|
68
|
+
thirdPartyAuthApiStatus,
|
|
69
|
+
thirdPartyAuthContext,
|
|
70
|
+
setThirdPartyAuthContextBegin,
|
|
71
|
+
setThirdPartyAuthContextSuccess,
|
|
72
|
+
setThirdPartyAuthContextFailure,
|
|
73
|
+
clearThirdPartyAuthErrorMessage,
|
|
74
|
+
]);
|
|
75
|
+
return (_jsx(ThirdPartyAuthContext.Provider, { value: value, children: children }));
|
|
76
|
+
};
|
|
77
|
+
export const useThirdPartyAuthContext = () => {
|
|
78
|
+
const context = useContext(ThirdPartyAuthContext);
|
|
79
|
+
if (context === undefined) {
|
|
80
|
+
throw new Error('useThirdPartyAuthContext must be used within a ThirdPartyAuthProvider');
|
|
81
|
+
}
|
|
82
|
+
return context;
|
|
83
|
+
};
|
|
84
|
+
//# sourceMappingURL=ThirdPartyAuthContext.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ThirdPartyAuthContext.js","sourceRoot":"","sources":["../../../src/common-components/components/ThirdPartyAuthContext.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,aAAa,EAAiB,WAAW,EAAE,UAAU,EAAE,OAAO,EAAE,QAAQ,GACzE,MAAM,OAAO,CAAC;AAEf,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AA2BpF,MAAM,qBAAqB,GAAG,aAAa,CAAwC,SAAS,CAAC,CAAC;AAM9F,MAAM,CAAC,MAAM,sBAAsB,GAAoC,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE;IACtF,MAAM,CAAC,iBAAiB,EAAE,oBAAoB,CAAC,GAAG,QAAQ,CAAC,EAAE,CAAC,CAAC;IAC/D,MAAM,CAAC,cAAc,EAAE,iBAAiB,CAAC,GAAG,QAAQ,CAAC;QACnD,MAAM,EAAE,EAAE;QACV,gBAAgB,EAAE,EAAE;KACrB,CAAC,CAAC;IACH,MAAM,CAAC,uBAAuB,EAAE,0BAA0B,CAAC,GAAG,QAAQ,CAAgB,IAAI,CAAC,CAAC;IAC5F,MAAM,CAAC,qBAAqB,EAAE,wBAAwB,CAAC,GAAG,QAAQ,CAAC;QACjE,YAAY,EAAE,IAAI;QAClB,iBAAiB,EAAE,KAAK;QACxB,eAAe,EAAE,IAAI;QACrB,aAAa,EAAE,IAAI;QACnB,WAAW,EAAE,IAAI;QACjB,SAAS,EAAE,EAAE;QACb,kBAAkB,EAAE,EAAE;QACtB,mBAAmB,EAAE,IAAI;QACzB,YAAY,EAAE,IAAI;QAClB,sBAAsB,EAAE,IAAI;KAC7B,CAAC,CAAC;IAEH,0EAA0E;IAC1E,MAAM,6BAA6B,GAAG,WAAW,CAAC,GAAG,EAAE;QACrD,0BAA0B,CAAC,aAAa,CAAC,CAAC;IAC5C,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,wEAAwE;IACxE,MAAM,+BAA+B,GAAG,WA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B,6BAA6B;QAC7B,+BAA+B;QAC/B,+BAA+B;QAC/B,+BAA+B;KAChC,CAAC,EAAE;QACF,iBAAiB;QACjB,cAAc;QACd,uBAAuB;QACvB,qBAAqB;QACrB,6BAA6B;QAC7B,+BAA+B;QAC/B,+BAA+B;QAC/B,+BAA+B;KAChC,CAAC,CAAC;IAEH,OAAO,CACL,KAAC,qBAAqB,CAAC,QAAQ,IAAC,KAAK,EAAE,KAAK,YACzC,QAAQ,GACsB,CAClC,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,wBAAwB,GAAG,GAA8B,EAAE;IACtE,MAAM,OAAO,GAAG,UAAU,CAAC,qBAAqB,CAAC,CAAC;IAClD,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;QAC1B,MAAM,IAAI,KAAK,CAAC,uEAAuE,CAAC,CAAC;IAC3F,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC","sourcesContent":["import {\n createContext, FC, ReactNode, useCallback, useContext, useMemo, useState,\n} from 'react';\n\nimport { COMPLETE_STATE, FAILURE_STATE, PENDING_STATE } from '../../data/constants';\n\ninterface ThirdPartyAuthContextType {\n fieldDescriptions: any,\n optionalFields: {\n fields: any,\n extended_profile: any[],\n },\n thirdPartyAuthApiStatus: string | null,\n thirdPartyAuthContext: {\n platformName: string | null,\n autoSubmitRegForm: boolean,\n currentProvider: string | null,\n finishAuthUrl: string | null,\n countryCode: string | null,\n providers: any[],\n secondaryProviders: any[],\n pipelineUserDetails: any | null,\n errorMessage: string | null,\n welcomePageRedirectUrl: string | null,\n },\n setThirdPartyAuthContextBegin: () => void,\n setThirdPartyAuthContextSuccess: (fieldDescData: any, optionalFieldsData: any, contextData: any) => void,\n setThirdPartyAuthContextFailure: () => void,\n clearThirdPartyAuthErrorMessage: () => void,\n}\n\nconst ThirdPartyAuthContext = createContext<ThirdPartyAuthContextType | undefined>(undefined);\n\ninterface ThirdPartyAuthProviderProps {\n children: ReactNode,\n}\n\nexport const ThirdPartyAuthProvider: FC<ThirdPartyAuthProviderProps> = ({ children }) => {\n const [fieldDescriptions, setFieldDescriptions] = useState({});\n const [optionalFields, setOptionalFields] = useState({\n fields: {},\n extended_profile: [],\n });\n const [thirdPartyAuthApiStatus, setThirdPartyAuthApiStatus] = useState<string | null>(null);\n const [thirdPartyAuthContext, setThirdPartyAuthContext] = useState({\n platformName: null,\n autoSubmitRegForm: false,\n currentProvider: null,\n finishAuthUrl: null,\n countryCode: null,\n providers: [],\n secondaryProviders: [],\n pipelineUserDetails: null,\n errorMessage: null,\n welcomePageRedirectUrl: null,\n });\n\n // Function to handle begin state - mirrors THIRD_PARTY_AUTH_CONTEXT.BEGIN\n const setThirdPartyAuthContextBegin = useCallback(() => {\n setThirdPartyAuthApiStatus(PENDING_STATE);\n }, []);\n\n // Function to handle success - mirrors THIRD_PARTY_AUTH_CONTEXT.SUCCESS\n const setThirdPartyAuthContextSuccess = useCallback((fieldDescData, optionalFieldsData, contextData) => {\n setFieldDescriptions(fieldDescData?.fields || {});\n setOptionalFields(optionalFieldsData || { fields: {}, extended_profile: [] });\n setThirdPartyAuthContext(contextData || {\n platformName: null,\n autoSubmitRegForm: false,\n currentProvider: null,\n finishAuthUrl: null,\n countryCode: null,\n providers: [],\n secondaryProviders: [],\n pipelineUserDetails: null,\n errorMessage: null,\n welcomePageRedirectUrl: null,\n });\n setThirdPartyAuthApiStatus(COMPLETE_STATE);\n }, []);\n\n // Function to handle failure - mirrors THIRD_PARTY_AUTH_CONTEXT.FAILURE\n const setThirdPartyAuthContextFailure = useCallback(() => {\n setThirdPartyAuthApiStatus(FAILURE_STATE);\n setThirdPartyAuthContext(prev => ({\n ...prev,\n errorMessage: null,\n }));\n }, []);\n\n // Function to clear error message - mirrors THIRD_PARTY_AUTH_CONTEXT_CLEAR_ERROR_MSG\n const clearThirdPartyAuthErrorMessage = useCallback(() => {\n setThirdPartyAuthApiStatus(PENDING_STATE);\n setThirdPartyAuthContext(prev => ({\n ...prev,\n errorMessage: null,\n }));\n }, []);\n\n const value = useMemo(() => ({\n fieldDescriptions,\n optionalFields,\n thirdPartyAuthApiStatus,\n thirdPartyAuthContext,\n setThirdPartyAuthContextBegin,\n setThirdPartyAuthContextSuccess,\n setThirdPartyAuthContextFailure,\n clearThirdPartyAuthErrorMessage,\n }), [\n fieldDescriptions,\n optionalFields,\n thirdPartyAuthApiStatus,\n thirdPartyAuthContext,\n setThirdPartyAuthContextBegin,\n setThirdPartyAuthContextSuccess,\n setThirdPartyAuthContextFailure,\n clearThirdPartyAuthErrorMessage,\n ]);\n\n return (\n <ThirdPartyAuthContext.Provider value={value}>\n {children}\n </ThirdPartyAuthContext.Provider>\n );\n};\n\nexport const useThirdPartyAuthContext = (): ThirdPartyAuthContextType => {\n const context = useContext(ThirdPartyAuthContext);\n if (context === undefined) {\n throw new Error('useThirdPartyAuthContext must be used within a ThirdPartyAuthProvider');\n }\n return context;\n};\n"]}
|