From 916c9628a309ee4efe52300662f7bc490935b843 Mon Sep 17 00:00:00 2001
From: mashal-m
Date: Thu, 30 Nov 2023 13:37:39 +0500
Subject: [PATCH 1/4] feat: add accounnt and profile urls in env files
---
.env | 2 ++
.env.development | 2 ++
.env.test | 2 ++
3 files changed, 6 insertions(+)
diff --git a/.env b/.env
index 6bc494f80..2c6ed7fcc 100644
--- a/.env
+++ b/.env
@@ -7,6 +7,8 @@ DISCOVERY_API_BASE_URL=''
ECOMMERCE_BASE_URL=''
ENABLE_DEMOGRAPHICS_COLLECTION=''
FAVICON_URL=''
+ACCOUNT_SETTINGS_URL=''
+ACCOUNT_PROFILE_URL=''
LANGUAGE_PREFERENCE_COOKIE_NAME=''
LMS_BASE_URL=''
LOGIN_URL=''
diff --git a/.env.development b/.env.development
index b9ef17d51..3f6ded955 100644
--- a/.env.development
+++ b/.env.development
@@ -6,6 +6,8 @@ DEMOGRAPHICS_BASE_URL='http://localhost:18360'
DISCOVERY_API_BASE_URL=''
ECOMMERCE_BASE_URL='http://localhost:18130'
ENABLE_DEMOGRAPHICS_COLLECTION=''
+ACCOUNT_SETTINGS_URL=http://localhost:1997
+ACCOUNT_PROFILE_URL=http://localhost:1995
FAVICON_URL=https://edx-cdn.org/v3/default/favicon.ico
LANGUAGE_PREFERENCE_COOKIE_NAME='openedx-language-preference'
LMS_BASE_URL='http://localhost:18000'
diff --git a/.env.test b/.env.test
index ea283c0b5..a94e82432 100644
--- a/.env.test
+++ b/.env.test
@@ -4,6 +4,8 @@ CREDENTIALS_BASE_URL='http://localhost:18150'
CSRF_TOKEN_API_PATH='/csrf/api/v1/token'
DEMOGRAPHICS_BASE_URL='http://localhost:18360'
DISCOVERY_API_BASE_URL=''
+ACCOUNT_SETTINGS_URL='http://localhost:1997'
+ACCOUNT_PROFILE_URL='http://localhost:1995'
ECOMMERCE_BASE_URL='http://localhost:18130'
ENABLE_DEMOGRAPHICS_COLLECTION=''
FAVICON_URL=https://edx-cdn.org/v3/default/favicon.ico
From 66bbe9148927cf4f2d3eeb77fa93b3df70652876 Mon Sep 17 00:00:00 2001
From: mashal-m
Date: Wed, 10 Jan 2024 17:03:12 +0500
Subject: [PATCH 2/4] feat: replace legacy url with account mfe url
---
src/account-settings/name-change/NameChange.jsx | 2 +-
src/hooks.js | 2 ++
src/id-verification/panels/SubmittedPanel.jsx | 5 +++--
3 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/src/account-settings/name-change/NameChange.jsx b/src/account-settings/name-change/NameChange.jsx
index 35bbda484..1235c2a5c 100644
--- a/src/account-settings/name-change/NameChange.jsx
+++ b/src/account-settings/name-change/NameChange.jsx
@@ -69,7 +69,7 @@ const NameChangeModal = ({
useEffect(() => {
if (saveState === 'complete') {
handleClose();
- navigate(`/id-verification?next=${encodeURIComponent('account/settings')}`);
+ navigate(`/id-verification?next=${encodeURIComponent('/')}`);
}
}, [handleClose, navigate, saveState]);
diff --git a/src/hooks.js b/src/hooks.js
index 6d3feca3e..dbc14936a 100644
--- a/src/hooks.js
+++ b/src/hooks.js
@@ -42,11 +42,13 @@ export function useRedirect() {
useEffect(() => {
if (sessionStorage.getItem('courseId')) {
setRedirect({
+ isAccountMFERedirect: false,
location: `courses/${sessionStorage.getItem('courseId')}`,
text: 'id.verification.return.course',
});
} else if (sessionStorage.getItem('next')) {
setRedirect({
+ isAccountMFERedirect: true,
location: sessionStorage.getItem('next'),
text: 'id.verification.return.generic',
});
diff --git a/src/id-verification/panels/SubmittedPanel.jsx b/src/id-verification/panels/SubmittedPanel.jsx
index 6397e07d3..a6aa786b6 100644
--- a/src/id-verification/panels/SubmittedPanel.jsx
+++ b/src/id-verification/panels/SubmittedPanel.jsx
@@ -12,8 +12,9 @@ import BasePanel from './BasePanel';
const SubmittedPanel = (props) => {
const { userId } = useContext(IdVerificationContext);
- const { location: returnUrl, text: returnText } = useRedirect();
+ const { location: returnUrl, text: returnText, isAccountMFERedirect } = useRedirect();
const panelSlug = 'submitted';
+ const URL = isAccountMFERedirect ? returnUrl : `${getConfig().LMS_BASE_URL}/${returnUrl}`;
useEffect(() => {
sendTrackEvent('edx.id_verification.submitted', {
@@ -32,7 +33,7 @@ const SubmittedPanel = (props) => {
{props.intl.formatMessage(messages[returnText])}
From 06030f07b1176e29507de66d12b7261e9e85455d Mon Sep 17 00:00:00 2001
From: mashal-m
Date: Thu, 11 Jan 2024 18:10:13 +0500
Subject: [PATCH 3/4] feat: replace legacy url with account mfe url
---
src/hooks.js | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/hooks.js b/src/hooks.js
index dbc14936a..9eabe4344 100644
--- a/src/hooks.js
+++ b/src/hooks.js
@@ -36,6 +36,7 @@ export function useAsyncCall(asyncFunc) {
export function useRedirect() {
const [redirect, setRedirect] = useState({
location: 'dashboard',
+ isAccountMFERedirect: false,
text: 'id.verification.return.dashboard',
});
From 270cbb5d2c059319d200d2233c77cd291c54cd6a Mon Sep 17 00:00:00 2001
From: mashal-m
Date: Fri, 12 Jan 2024 11:16:03 +0500
Subject: [PATCH 4/4] fix: fix failing error
---
src/id-verification/tests/panels/SubmittedPanel.test.jsx | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/id-verification/tests/panels/SubmittedPanel.test.jsx b/src/id-verification/tests/panels/SubmittedPanel.test.jsx
index 215e312f3..21ace0045 100644
--- a/src/id-verification/tests/panels/SubmittedPanel.test.jsx
+++ b/src/id-verification/tests/panels/SubmittedPanel.test.jsx
@@ -82,6 +82,6 @@ describe('SubmittedPanel', () => {
)));
const button = await screen.findByTestId('return-button');
expect(button).toHaveTextContent(/Return/);
- expect(button).toHaveAttribute('href', `${process.env.LMS_BASE_URL}/some_page`);
+ expect(button).toHaveAttribute('href', 'some_page');
});
});