feat: param based cta and redirection (#984)
Register CTA label and authn redirection would be based on query params. VAN-1535
This commit is contained in:
@@ -210,7 +210,13 @@ const ProgressiveProfiling = (props) => {
|
||||
</title>
|
||||
</Helmet>
|
||||
<ProgressiveProfilingPageModal isOpen={showModal} redirectUrl={registrationResult.redirectUrl} />
|
||||
{props.shouldRedirect ? (
|
||||
{queryParams?.next && (
|
||||
<RedirectLogistration
|
||||
success
|
||||
redirectUrl={queryParams.next}
|
||||
/>
|
||||
)}
|
||||
{props.shouldRedirect && (
|
||||
<RedirectLogistration
|
||||
success
|
||||
redirectUrl={registrationResult.redirectUrl}
|
||||
@@ -218,7 +224,7 @@ const ProgressiveProfiling = (props) => {
|
||||
educationLevel={values?.level_of_education}
|
||||
userId={authenticatedUser?.userId}
|
||||
/>
|
||||
) : null}
|
||||
)}
|
||||
<div className="mw-xs m-4 pp-page-content">
|
||||
<div>
|
||||
<h2 className="pp-page__heading text-primary">{formatMessage(messages['progressive.profiling.page.heading'])}</h2>
|
||||
|
||||
@@ -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);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user