{formatMessage(messages['progressive.profiling.page.heading'])}
diff --git a/src/progressive-profiling/tests/ProgressiveProfiling.test.jsx b/src/progressive-profiling/tests/ProgressiveProfiling.test.jsx
index adf9e61f..83040d4c 100644
--- a/src/progressive-profiling/tests/ProgressiveProfiling.test.jsx
+++ b/src/progressive-profiling/tests/ProgressiveProfiling.test.jsx
@@ -331,5 +331,28 @@ describe('ProgressiveProfilingTests', () => {
await getProgressiveProfilingPage();
expect(window.location.href).toBe(DASHBOARD_URL);
});
+
+ it('should redirect to provided redirect url', async () => {
+ const redirectUrl = 'https://redirect-test.com';
+ delete window.location;
+ window.location = {
+ assign: jest.fn().mockImplementation((value) => { window.location.href = value; }),
+ href: getConfig().BASE_URL,
+ search: `?variant=${EMBEDDED}&host=http://localhost/host-website&next=${redirectUrl}`,
+ };
+ props = {};
+ store = mockStore({
+ ...initialState,
+ commonComponents: {
+ ...initialState.commonComponents,
+ thirdPartyAuthApiStatus: COMPLETE_STATE,
+ optionalFields,
+ },
+ });
+
+ const progressiveProfilingPage = await getProgressiveProfilingPage();
+ progressiveProfilingPage.find('button.btn-brand').simulate('click');
+ expect(window.location.href).toBe(redirectUrl);
+ });
});
});
diff --git a/src/register/RegistrationPage.jsx b/src/register/RegistrationPage.jsx
index 2b6b79ef..628d46dc 100644
--- a/src/register/RegistrationPage.jsx
+++ b/src/register/RegistrationPage.jsx
@@ -88,7 +88,7 @@ const RegistrationPage = (props) => {
const countryList = useMemo(() => getCountryList(getLocale()), []);
const queryParams = useMemo(() => getAllPossibleQueryParams(), []);
const registrationEmbedded = isHostAvailableInQueryParams();
- const { host } = queryParams;
+ const { cta, host } = queryParams;
const tpaHint = useMemo(() => getTpaHint(), []);
const flags = {
showConfigurableEdxFields: getConfig().SHOW_CONFIGURABLE_EDX_FIELDS,
@@ -109,6 +109,7 @@ const RegistrationPage = (props) => {
providers, currentProvider, secondaryProviders, finishAuthUrl,
} = thirdPartyAuthContext;
const platformName = getConfig().SITE_NAME;
+ const buttonLabel = cta ? formatMessage(messages['create.account.cta.button'], { label: cta }) : formatMessage(messages['create.account.for.free.button']);
/**
* If auto submitting register form, we will check tos and honor code fields if they exist for feature parity.
@@ -635,7 +636,7 @@ const RegistrationPage = (props) => {
className="register-button mt-4 mb-4"
state={submitState}
labels={{
- default: formatMessage(messages['create.account.for.free.button']),
+ default: buttonLabel,
pending: '',
}}
onClick={handleSubmit}
diff --git a/src/register/messages.jsx b/src/register/messages.jsx
index a56c5b52..0e7c41d1 100644
--- a/src/register/messages.jsx
+++ b/src/register/messages.jsx
@@ -69,6 +69,11 @@ const messages = defineMessages({
defaultMessage: 'Or register with:',
description: 'A message that appears above third party auth providers i.e saml, google, facebook etc',
},
+ 'create.account.cta.button': {
+ id: 'create.account.cta.button',
+ defaultMessage: '{label}',
+ description: 'Label text for registration form submission button for those users who are landing through redirections',
+ },
// Institution login
'register.institution.login.button': {
id: 'register.institution.login.button',
diff --git a/src/register/tests/RegistrationPage.test.jsx b/src/register/tests/RegistrationPage.test.jsx
index b50c730a..e6a9ff5e 100644
--- a/src/register/tests/RegistrationPage.test.jsx
+++ b/src/register/tests/RegistrationPage.test.jsx
@@ -619,6 +619,14 @@ describe('RegistrationPage', () => {
});
});
+ it('should show button label based on cta query params value', () => {
+ const buttonLabel = 'Register';
+ delete window.location;
+ window.location = { href: getConfig().BASE_URL, search: `?cta=${buttonLabel}` };
+ const registrationPage = mount(reduxWrapper());
+ expect(registrationPage.find('button[type="submit"] span').first().text()).toEqual(buttonLabel);
+ });
+
it('should display no password field when current provider is present', () => {
store = mockStore({
...initialState,