From f8fe704c42c2b2bfd8c2433626b29a1e74f12644 Mon Sep 17 00:00:00 2001 From: Attiya Ishaque Date: Fri, 30 Dec 2022 14:00:24 +0500 Subject: [PATCH] fix: rename welcome pages and flag to progressive profiling (#720) --- .env | 4 ++-- .env.development | 2 +- .env.test | 2 +- README.rst | 6 +++--- src/MainApp.jsx | 6 +++--- src/common-components/RedirectLogistration.jsx | 4 ++-- src/data/constants.js | 2 +- src/data/reducers.js | 10 +++++----- src/data/sagas.js | 4 ++-- src/index.jsx | 4 ++-- .../ProgressiveProfiling.jsx | 6 +++--- .../ProgressiveProfilingPageModal.jsx} | 8 ++++---- src/{welcome => progressive-profiling}/data/actions.js | 0 .../data/reducers.js | 0 src/{welcome => progressive-profiling}/data/sagas.js | 0 .../data/selectors.js | 0 src/{welcome => progressive-profiling}/data/service.js | 0 src/{welcome => progressive-profiling}/index.js | 0 src/{welcome => progressive-profiling}/messages.jsx | 0 .../tests/ProgressiveProfiling.test.jsx | 2 +- src/register/RegistrationPage.jsx | 2 +- src/register/tests/RegistrationPage.test.jsx | 8 ++++---- 22 files changed, 35 insertions(+), 35 deletions(-) rename src/{welcome => progressive-profiling}/ProgressiveProfiling.jsx (96%) rename src/{welcome/WelcomePageModal.jsx => progressive-profiling/ProgressiveProfilingPageModal.jsx} (87%) rename src/{welcome => progressive-profiling}/data/actions.js (100%) rename src/{welcome => progressive-profiling}/data/reducers.js (100%) rename src/{welcome => progressive-profiling}/data/sagas.js (100%) rename src/{welcome => progressive-profiling}/data/selectors.js (100%) rename src/{welcome => progressive-profiling}/data/service.js (100%) rename src/{welcome => progressive-profiling}/index.js (100%) rename src/{welcome => progressive-profiling}/messages.jsx (100%) rename src/{welcome => progressive-profiling}/tests/ProgressiveProfiling.test.jsx (98%) diff --git a/.env b/.env index 2afdfb06..1f496f1d 100644 --- a/.env +++ b/.env @@ -18,11 +18,11 @@ AUTHN_MINIMAL_HEADER=true LOGIN_ISSUE_SUPPORT_LINK='' USER_SURVEY_COOKIE_NAME=null COOKIE_DOMAIN=null -WELCOME_PAGE_SUPPORT_LINK=null +AUTHN_PROGRESSIVE_PROFILING_SUPPORT_LINK=null INFO_EMAIL='' DISABLE_ENTERPRISE_LOGIN='' REGISTER_CONVERSION_COOKIE_NAME=null -ENABLE_PROGRESSIVE_PROFILING='' +ENABLE_PROGRESSIVE_PROFILING_ON_AUTHN='' MARKETING_EMAILS_OPT_IN='' ENABLE_COPPA_COMPLIANCE='' SHOW_CONFIGURABLE_EDX_FIELDS='' diff --git a/.env.development b/.env.development index bf47dde9..4b39b294 100644 --- a/.env.development +++ b/.env.development @@ -26,7 +26,7 @@ TOS_LINK='http://localhost:18000/tos' PRIVACY_POLICY='http://localhost:18000/privacy' USER_SURVEY_COOKIE_NAME='openedx-user-survey-type' COOKIE_DOMAIN='localhost' -WELCOME_PAGE_SUPPORT_LINK='http://localhost:1999/welcome' +AUTHN_PROGRESSIVE_PROFILING_SUPPORT_LINK='http://localhost:1999/welcome' INFO_EMAIL='info@edx.org' DISABLE_ENTERPRISE_LOGIN='' REGISTER_CONVERSION_COOKIE_NAME='openedx-user-register-conversion' diff --git a/.env.test b/.env.test index 82aa38eb..5ae4f2cc 100644 --- a/.env.test +++ b/.env.test @@ -19,7 +19,7 @@ SITE_NAME='Your Platform Name Here' USER_INFO_COOKIE_NAME='edx-user-info' LOGIN_ISSUE_SUPPORT_LINK='https://login-issue-support-url.com' USER_SURVEY_COOKIE_NAME='openedx-user-survey-type' -WELCOME_PAGE_SUPPORT_LINK='http://localhost:1999/welcome' +AUTHN_PROGRESSIVE_PROFILING_SUPPORT_LINK='http://localhost:1999/welcome' DISABLE_ENTERPRISE_LOGIN='' REGISTER_CONVERSION_COOKIE_NAME='openedx-user-register-conversion' MARKETING_EMAILS_OPT_IN='' diff --git a/README.rst b/README.rst index 14244804..3f0cf3e5 100644 --- a/README.rst +++ b/README.rst @@ -72,8 +72,8 @@ The authentication micro-frontend also requires the following additional variabl - The fully-qualified URL to the password reset support page in the target environment. - ``https://support.example.com`` - * - ``WELCOME_PAGE_SUPPORT_LINK`` - - The fully-qualified URL to the welcome support page in the target environment. + * - ``AUTHN_PROGRESSIVE_PROFILING_SUPPORT_LINK`` + - The fully-qualified URL to the progressive profiling support page in the target environment. - ``https://support.example.com`` * - ``TOS_AND_HONOR_CODE`` @@ -96,7 +96,7 @@ The authentication micro-frontend also requires the following additional variabl - Enables support for configurable registration fields on the MFE. This flag must be enabled to show any required registration field besides the default fields (name, email, username, password). - ``true`` | ``''`` (empty strings are falsy) - * - ``ENABLE_PROGRESSIVE_PROFILING`` + * - ``ENABLE_PROGRESSIVE_PROFILING_ON_AUTHN`` - Enables support for progressive profiling. If enabled, users are redirected to a second page where data for optional registration fields can be collected. - ``true`` | ``''`` (empty strings are falsy) diff --git a/src/MainApp.jsx b/src/MainApp.jsx index e7a96d3d..658440fd 100755 --- a/src/MainApp.jsx +++ b/src/MainApp.jsx @@ -10,12 +10,12 @@ import { } from './common-components'; import configureStore from './data/configureStore'; import { - LOGIN_PAGE, PAGE_NOT_FOUND, PASSWORD_RESET_CONFIRM, REGISTER_PAGE, RESET_PAGE, WELCOME_PAGE, + AUTHN_PROGRESSIVE_PROFILING, LOGIN_PAGE, PAGE_NOT_FOUND, PASSWORD_RESET_CONFIRM, REGISTER_PAGE, RESET_PAGE, } from './data/constants'; import { updatePathWithQueryParams } from './data/utils'; import ForgotPasswordPage from './forgot-password'; +import { ProgressiveProfiling } from './progressive-profiling'; import ResetPasswordPage from './reset-password'; -import { ProgressiveProfiling } from './welcome'; import './index.scss'; registerIcons(); @@ -33,7 +33,7 @@ const MainApp = () => ( - + diff --git a/src/common-components/RedirectLogistration.jsx b/src/common-components/RedirectLogistration.jsx index ece5f778..7845277f 100644 --- a/src/common-components/RedirectLogistration.jsx +++ b/src/common-components/RedirectLogistration.jsx @@ -4,7 +4,7 @@ import { getConfig } from '@edx/frontend-platform'; import PropTypes from 'prop-types'; import { Redirect } from 'react-router-dom'; -import { WELCOME_PAGE } from '../data/constants'; +import { AUTHN_PROGRESSIVE_PROFILING } from '../data/constants'; import { setCookie } from '../data/utils'; function RedirectLogistration(props) { @@ -30,7 +30,7 @@ function RedirectLogistration(props) { const registrationResult = { redirectUrl: finalRedirectUrl, success }; return ( combineReducers({ [loginStoreName]: loginReducer, @@ -31,6 +31,6 @@ const createRootReducer = () => combineReducers({ [commonComponentsStoreName]: commonComponentsReducer, [forgotPasswordStoreName]: forgotPasswordReducer, [resetPasswordStoreName]: resetPasswordReducer, - [welcomePageStoreName]: welcomePageReducers, + [authnProgressiveProfilingStoreName]: authnProgressiveProfilingReducers, }); export default createRootReducer; diff --git a/src/data/sagas.js b/src/data/sagas.js index f437865d..07c9259c 100644 --- a/src/data/sagas.js +++ b/src/data/sagas.js @@ -3,9 +3,9 @@ import { all } from 'redux-saga/effects'; import { saga as commonComponentsSaga } from '../common-components'; import { saga as forgotPasswordSaga } from '../forgot-password'; import { saga as loginSaga } from '../login'; +import { saga as authnProgressiveProfilingSaga } from '../progressive-profiling'; import { saga as registrationSaga } from '../register'; import { saga as resetPasswordSaga } from '../reset-password'; -import { saga as welcomePageSaga } from '../welcome'; export default function* rootSaga() { yield all([ @@ -14,6 +14,6 @@ export default function* rootSaga() { commonComponentsSaga(), forgotPasswordSaga(), resetPasswordSaga(), - welcomePageSaga(), + authnProgressiveProfilingSaga(), ]); } diff --git a/src/index.jsx b/src/index.jsx index 252a8c80..2e220bc3 100755 --- a/src/index.jsx +++ b/src/index.jsx @@ -36,11 +36,11 @@ initialize({ PRIVACY_POLICY: process.env.PRIVACY_POLICY || null, USER_SURVEY_COOKIE_NAME: process.env.USER_SURVEY_COOKIE_NAME || null, COOKIE_DOMAIN: process.env.COOKIE_DOMAIN, - WELCOME_PAGE_SUPPORT_LINK: process.env.WELCOME_PAGE_SUPPORT_LINK || null, + AUTHN_PROGRESSIVE_PROFILING_SUPPORT_LINK: process.env.AUTHN_PROGRESSIVE_PROFILING_SUPPORT_LINK || null, DISABLE_ENTERPRISE_LOGIN: process.env.DISABLE_ENTERPRISE_LOGIN || '', INFO_EMAIL: process.env.INFO_EMAIL || '', REGISTER_CONVERSION_COOKIE_NAME: process.env.REGISTER_CONVERSION_COOKIE_NAME || null, - ENABLE_PROGRESSIVE_PROFILING: process.env.ENABLE_PROGRESSIVE_PROFILING || false, + ENABLE_PROGRESSIVE_PROFILING_ON_AUTHN: process.env.ENABLE_PROGRESSIVE_PROFILING_ON_AUTHN || false, MARKETING_EMAILS_OPT_IN: process.env.MARKETING_EMAILS_OPT_IN || '', ENABLE_COPPA_COMPLIANCE: process.env.ENABLE_COPPA_COMPLIANCE || '', ENABLE_DYNAMIC_REGISTRATION_FIELDS: process.env.ENABLE_DYNAMIC_REGISTRATION_FIELDS || false, diff --git a/src/welcome/ProgressiveProfiling.jsx b/src/progressive-profiling/ProgressiveProfiling.jsx similarity index 96% rename from src/welcome/ProgressiveProfiling.jsx rename to src/progressive-profiling/ProgressiveProfiling.jsx index 3e2a91d9..cd92f9f2 100644 --- a/src/welcome/ProgressiveProfiling.jsx +++ b/src/progressive-profiling/ProgressiveProfiling.jsx @@ -31,7 +31,7 @@ import FormFieldRenderer from '../field-renderer'; import { saveUserProfile } from './data/actions'; import { welcomePageSelector } from './data/selectors'; import messages from './messages'; -import WelcomePageModal from './WelcomePageModal'; +import ProgressiveProfilingPageModal from './ProgressiveProfilingPageModal'; const ProgressiveProfiling = (props) => { const { @@ -130,7 +130,7 @@ const ProgressiveProfiling = (props) => { { siteName: getConfig().SITE_NAME })} - + {props.shouldRedirect ? ( { (sendTrackEvent('edx.bi.welcome.page.support.link.clicked'))} diff --git a/src/welcome/WelcomePageModal.jsx b/src/progressive-profiling/ProgressiveProfilingPageModal.jsx similarity index 87% rename from src/welcome/WelcomePageModal.jsx rename to src/progressive-profiling/ProgressiveProfilingPageModal.jsx index 08e1f302..4d4b4a1b 100644 --- a/src/welcome/WelcomePageModal.jsx +++ b/src/progressive-profiling/ProgressiveProfilingPageModal.jsx @@ -7,7 +7,7 @@ import PropTypes from 'prop-types'; import messages from './messages'; -const WelcomePageModal = (props) => { +const ProgressiveProfilingPageModal = (props) => { const { intl, isOpen, redirectUrl } = props; const platformName = getConfig().SITE_NAME; @@ -46,14 +46,14 @@ const WelcomePageModal = (props) => { ); }; -WelcomePageModal.propTypes = { +ProgressiveProfilingPageModal.propTypes = { intl: intlShape.isRequired, isOpen: PropTypes.bool, redirectUrl: PropTypes.string.isRequired, }; -WelcomePageModal.defaultProps = { +ProgressiveProfilingPageModal.defaultProps = { isOpen: false, }; -export default injectIntl(WelcomePageModal); +export default injectIntl(ProgressiveProfilingPageModal); diff --git a/src/welcome/data/actions.js b/src/progressive-profiling/data/actions.js similarity index 100% rename from src/welcome/data/actions.js rename to src/progressive-profiling/data/actions.js diff --git a/src/welcome/data/reducers.js b/src/progressive-profiling/data/reducers.js similarity index 100% rename from src/welcome/data/reducers.js rename to src/progressive-profiling/data/reducers.js diff --git a/src/welcome/data/sagas.js b/src/progressive-profiling/data/sagas.js similarity index 100% rename from src/welcome/data/sagas.js rename to src/progressive-profiling/data/sagas.js diff --git a/src/welcome/data/selectors.js b/src/progressive-profiling/data/selectors.js similarity index 100% rename from src/welcome/data/selectors.js rename to src/progressive-profiling/data/selectors.js diff --git a/src/welcome/data/service.js b/src/progressive-profiling/data/service.js similarity index 100% rename from src/welcome/data/service.js rename to src/progressive-profiling/data/service.js diff --git a/src/welcome/index.js b/src/progressive-profiling/index.js similarity index 100% rename from src/welcome/index.js rename to src/progressive-profiling/index.js diff --git a/src/welcome/messages.jsx b/src/progressive-profiling/messages.jsx similarity index 100% rename from src/welcome/messages.jsx rename to src/progressive-profiling/messages.jsx diff --git a/src/welcome/tests/ProgressiveProfiling.test.jsx b/src/progressive-profiling/tests/ProgressiveProfiling.test.jsx similarity index 98% rename from src/welcome/tests/ProgressiveProfiling.test.jsx rename to src/progressive-profiling/tests/ProgressiveProfiling.test.jsx index 4113ee22..c1e749e7 100644 --- a/src/welcome/tests/ProgressiveProfiling.test.jsx +++ b/src/progressive-profiling/tests/ProgressiveProfiling.test.jsx @@ -33,7 +33,7 @@ auth.hydrateAuthenticatedUser = jest.fn().mockImplementation(() => Promise.resol describe('ProgressiveProfilingTests', () => { mergeConfig({ - WELCOME_PAGE_SUPPORT_LINK: 'http://localhost:1999/welcome', + AUTHN_PROGRESSIVE_PROFILING_SUPPORT_LINK: 'http://localhost:1999/welcome', }); const registrationResult = { redirectUrl: getConfig().LMS_BASE_URL + DEFAULT_REDIRECT_URL, success: true }; const fields = { diff --git a/src/register/RegistrationPage.jsx b/src/register/RegistrationPage.jsx index 1cdb23f7..1377ba5c 100644 --- a/src/register/RegistrationPage.jsx +++ b/src/register/RegistrationPage.jsx @@ -462,7 +462,7 @@ const RegistrationPage = (props) => { finishAuthUrl={finishAuthUrl} optionalFields={optionalFields} redirectToWelcomePage={ - getConfig().ENABLE_PROGRESSIVE_PROFILING && Object.keys(optionalFields).length !== 0 + getConfig().ENABLE_PROGRESSIVE_PROFILING_ON_AUTHN && Object.keys(optionalFields).length !== 0 } />
diff --git a/src/register/tests/RegistrationPage.test.jsx b/src/register/tests/RegistrationPage.test.jsx index f9df96b4..2b755f5a 100644 --- a/src/register/tests/RegistrationPage.test.jsx +++ b/src/register/tests/RegistrationPage.test.jsx @@ -13,7 +13,7 @@ import { Router } from 'react-router-dom'; import renderer from 'react-test-renderer'; import configureStore from 'redux-mock-store'; -import { COMPLETE_STATE, PENDING_STATE, WELCOME_PAGE } from '../../data/constants'; +import { AUTHN_PROGRESSIVE_PROFILING, COMPLETE_STATE, PENDING_STATE } from '../../data/constants'; import { backupRegistrationFormBegin, clearUsernameSuggestions, @@ -719,7 +719,7 @@ describe('RegistrationPage', () => { it('should redirect to dashboard if features flags are configured but no optional fields are configured', () => { mergeConfig({ - ENABLE_PROGRESSIVE_PROFILING: true, + ENABLE_PROGRESSIVE_PROFILING_ON_AUTHN: true, }); const dashboardUrl = 'https://test.com/testing-dashboard/'; store = mockStore({ @@ -740,7 +740,7 @@ describe('RegistrationPage', () => { it('should redirect to progressive profiling page if optional fields are configured', () => { mergeConfig({ - ENABLE_PROGRESSIVE_PROFILING: true, + ENABLE_PROGRESSIVE_PROFILING_ON_AUTHN: true, }); store = mockStore({ @@ -764,7 +764,7 @@ describe('RegistrationPage', () => { , )); progressiveProfilingPage.update(); - expect(history.location.pathname).toEqual(WELCOME_PAGE); + expect(history.location.pathname).toEqual(AUTHN_PROGRESSIVE_PROFILING); }); // ******** test hinted third party auth ********