fix: Replace course details URL with search URL in gated content
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import classNames from 'classnames';
|
||||
import { getConfig } from '@edx/frontend-platform';
|
||||
import { sendTrackEvent } from '@edx/frontend-platform/analytics';
|
||||
import { injectIntl, intlShape } from '@edx/frontend-platform/i18n';
|
||||
import {
|
||||
@@ -26,7 +27,6 @@ function LockPaywall({
|
||||
const course = useModel('coursewareMeta', courseId);
|
||||
const {
|
||||
accessExpiration,
|
||||
marketingUrl,
|
||||
offer,
|
||||
org,
|
||||
verifiedMode,
|
||||
@@ -85,7 +85,7 @@ function LockPaywall({
|
||||
{pastExpirationDeadline ? (
|
||||
<div className="mb-2 upgrade-intro">
|
||||
{intl.formatMessage(messages['learn.lockPaywall.content.pastExpiration'])}
|
||||
<Hyperlink destination={marketingUrl} onClick={logClickPastExpiration} target="_blank">{intl.formatMessage(messages['learn.lockPaywall.courseDetails'])}</Hyperlink>
|
||||
<Hyperlink destination={`${getConfig().MARKETING_SITE_BASE_URL}/search?tab=course`} onClick={logClickPastExpiration} target="_blank">{intl.formatMessage(messages['learn.lockPaywall.exploreAll'])}</Hyperlink>
|
||||
</div>
|
||||
) : (
|
||||
<div className="mb-2 upgrade-intro">
|
||||
|
||||
@@ -86,13 +86,11 @@ describe('Lock Paywall', () => {
|
||||
access_expiration: {
|
||||
expiration_date: '1995-02-22T05:00:00Z',
|
||||
},
|
||||
marketing_url: 'https://example.com/course-details',
|
||||
});
|
||||
const testStore = await initializeTestStore({ courseMetadata }, false);
|
||||
render(<LockPaywall {...mockData} courseId={courseMetadata.id} />, { store: testStore });
|
||||
expect(screen.getByText('The upgrade deadline for this course passed. To upgrade, enroll in the next available session.')).toBeInTheDocument();
|
||||
expect(screen.getByText('View Course Details'))
|
||||
.toHaveAttribute('href', 'https://example.com/course-details');
|
||||
expect(screen.getByText('Explore all courses'));
|
||||
});
|
||||
|
||||
it('sends analytics event onClick of past expiration course details link', async () => {
|
||||
@@ -101,11 +99,10 @@ describe('Lock Paywall', () => {
|
||||
access_expiration: {
|
||||
expiration_date: '1995-02-22T05:00:00Z',
|
||||
},
|
||||
marketing_url: 'https://example.com/course-details',
|
||||
});
|
||||
const testStore = await initializeTestStore({ courseMetadata }, false);
|
||||
render(<LockPaywall {...mockData} courseId={courseMetadata.id} />, { store: testStore });
|
||||
const courseDetailsLink = await screen.getByText('View Course Details');
|
||||
const courseDetailsLink = await screen.getByText('Explore all courses');
|
||||
fireEvent.click(courseDetailsLink);
|
||||
|
||||
expect(sendTrackEvent).toHaveBeenCalledTimes(1);
|
||||
|
||||
@@ -16,10 +16,10 @@ const messages = defineMessages({
|
||||
defaultMessage: 'The upgrade deadline for this course passed. To upgrade, enroll in the next available session. ',
|
||||
description: 'Message shown to indicate that a piece of content is unavailable to audit track users in a course where the expiration deadline has passed.',
|
||||
},
|
||||
'learn.lockPaywall.courseDetails': {
|
||||
id: 'learn.lockPaywall.courseDetails',
|
||||
defaultMessage: 'View Course Details',
|
||||
description: 'Link to the course details page for this course with a past expiration date.',
|
||||
'learn.lockPaywall.exploreAll': {
|
||||
id: 'learn.lockPaywall.exploreAll',
|
||||
defaultMessage: 'Explore all courses',
|
||||
description: 'Link to the search page if past access expiration date',
|
||||
},
|
||||
'learn.lockPaywall.example.alt': {
|
||||
id: 'learn.lockPaywall.example.alt',
|
||||
|
||||
Reference in New Issue
Block a user