Skip to content

Commit 14c662d

Browse files
committed
feat: removes Upgrade Notification as default content
As a follow-up to #1368, remove the UpgradeNotification component from the sidebar's default content.
1 parent af432ea commit 14c662d

File tree

11 files changed

+5
-1185
lines changed

11 files changed

+5
-1185
lines changed

src/course-home/outline-tab/OutlineTab.jsx

+1-26
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ import CourseTools from './widgets/CourseTools';
1616
import { fetchOutlineTab } from '../data';
1717
import messages from './messages';
1818
import ShiftDatesAlert from '../suggested-schedule-messaging/ShiftDatesAlert';
19-
import UpgradeNotification from '../../generic/upgrade-notification/UpgradeNotification';
2019
import UpgradeToShiftDatesAlert from '../suggested-schedule-messaging/UpgradeToShiftDatesAlert';
2120
import useCertificateAvailableAlert from './alerts/certificate-status-alert';
2221
import useCourseEndAlert from './alerts/course-end-alert';
@@ -40,13 +39,11 @@ const OutlineTab = () => {
4039
isSelfPaced,
4140
org,
4241
title,
43-
userTimezone,
4442
} = useModel('courseHomeMeta', courseId);
4543

4644
const expandButtonRef = useRef();
4745

4846
const {
49-
accessExpiration,
5047
courseBlocks: {
5148
courses,
5249
sections,
@@ -55,20 +52,12 @@ const OutlineTab = () => {
5552
selectedGoal,
5653
weeklyLearningGoalEnabled,
5754
} = {},
58-
datesBannerInfo,
5955
datesWidget: {
6056
courseDateBlocks,
6157
},
6258
enableProctoredExams,
63-
offer,
64-
timeOffsetMillis,
65-
verifiedMode,
6659
} = useModel('outline', courseId);
6760

68-
const {
69-
marketingUrl,
70-
} = useModel('coursewareMeta', courseId);
71-
7261
const [expandAll, setExpandAll] = useState(false);
7362
const navigate = useNavigate();
7463

@@ -198,21 +187,7 @@ const OutlineTab = () => {
198187
courseId,
199188
model: 'outline',
200189
}}
201-
>
202-
<UpgradeNotification
203-
offer={offer}
204-
verifiedMode={verifiedMode}
205-
accessExpiration={accessExpiration}
206-
contentTypeGatingEnabled={datesBannerInfo.contentTypeGatingEnabled}
207-
marketingUrl={marketingUrl}
208-
upsellPageName="course_home"
209-
userTimezone={userTimezone}
210-
shouldDisplayBorder
211-
timeOffsetMillis={timeOffsetMillis}
212-
courseId={courseId}
213-
org={org}
214-
/>
215-
</PluginSlot>
190+
/>
216191
<CourseDates />
217192
<CourseHandouts />
218193
</div>

src/course-home/outline-tab/OutlineTab.test.jsx

+1-75
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import React from 'react';
55
import { MemoryRouter } from 'react-router-dom';
66
import { Factory } from 'rosie';
77
import { getConfig } from '@edx/frontend-platform';
8-
import { sendTrackEvent, sendTrackingLogEvent } from '@edx/frontend-platform/analytics';
8+
import { sendTrackEvent } from '@edx/frontend-platform/analytics';
99
import { getAuthenticatedHttpClient } from '@edx/frontend-platform/auth';
1010
import MockAdapter from 'axios-mock-adapter';
1111
import Cookies from 'js-cookie';
@@ -1190,80 +1190,6 @@ describe('Outline Tab', () => {
11901190
});
11911191
});
11921192

1193-
describe('Upgrade Card', () => {
1194-
it('renders title when upgrade is available', async () => {
1195-
await fetchAndRender();
1196-
expect(screen.queryByRole('heading', { name: 'Pursue a verified certificate' })).toBeInTheDocument();
1197-
});
1198-
1199-
it('displays link to upgrade', async () => {
1200-
await fetchAndRender();
1201-
expect(screen.getByRole('link', { name: 'Upgrade for $149' })).toBeInTheDocument();
1202-
});
1203-
1204-
it('viewing upgrade card sends analytics', async () => {
1205-
sendTrackEvent.mockClear();
1206-
sendTrackingLogEvent.mockClear();
1207-
await fetchAndRender();
1208-
1209-
expect(sendTrackEvent).toHaveBeenCalledTimes(1);
1210-
expect(sendTrackEvent).toHaveBeenCalledWith('Promotion Viewed', {
1211-
org_key: 'edX',
1212-
courserun_key: courseId,
1213-
creative: 'sidebarupsell',
1214-
name: 'In-Course Verification Prompt',
1215-
position: 'sidebar-message',
1216-
promotion_id: 'courseware_verified_certificate_upsell',
1217-
});
1218-
1219-
expect(sendTrackingLogEvent).toHaveBeenCalledTimes(1);
1220-
expect(sendTrackingLogEvent).toHaveBeenCalledWith('edx.bi.course.upgrade.sidebarupsell.displayed', {
1221-
org_key: 'edX',
1222-
courserun_key: courseId,
1223-
});
1224-
});
1225-
1226-
it('clicking upgrade link sends analytics', async () => {
1227-
await fetchAndRender();
1228-
1229-
// Clearing after render to remove any events sent on view (ex. 'Promotion Viewed')
1230-
sendTrackEvent.mockClear();
1231-
sendTrackingLogEvent.mockClear();
1232-
const upgradeButton = screen.getByRole('link', { name: 'Upgrade for $149' });
1233-
1234-
fireEvent.click(upgradeButton);
1235-
1236-
expect(sendTrackEvent).toHaveBeenCalledTimes(2);
1237-
expect(sendTrackEvent).toHaveBeenNthCalledWith(1, 'Promotion Clicked', {
1238-
org_key: 'edX',
1239-
courserun_key: courseId,
1240-
creative: 'sidebarupsell',
1241-
name: 'In-Course Verification Prompt',
1242-
position: 'sidebar-message',
1243-
promotion_id: 'courseware_verified_certificate_upsell',
1244-
});
1245-
expect(sendTrackEvent).toHaveBeenNthCalledWith(2, 'edx.bi.ecommerce.upsell_links_clicked', {
1246-
org_key: 'edX',
1247-
courserun_key: courseId,
1248-
linkCategory: 'green_upgrade',
1249-
linkName: 'course_home_green',
1250-
linkType: 'button',
1251-
pageName: 'course_home',
1252-
});
1253-
1254-
expect(sendTrackingLogEvent).toHaveBeenCalledTimes(2);
1255-
expect(sendTrackingLogEvent).toHaveBeenNthCalledWith(1, 'edx.bi.course.upgrade.sidebarupsell.clicked', {
1256-
org_key: 'edX',
1257-
courserun_key: courseId,
1258-
});
1259-
expect(sendTrackingLogEvent).toHaveBeenNthCalledWith(2, 'edx.course.enrollment.upgrade.clicked', {
1260-
org_key: 'edX',
1261-
courserun_key: courseId,
1262-
location: 'sidebar-message',
1263-
});
1264-
});
1265-
});
1266-
12671193
describe('Account Activation Alert', () => {
12681194
beforeEach(() => {
12691195
const intersectionObserverMock = () => ({

src/courseware/course/Course.test.jsx

-12
Original file line numberDiff line numberDiff line change
@@ -148,18 +148,6 @@ describe('Course', () => {
148148
});
149149
});
150150

151-
it('displays notification trigger and toggles active class on click', async () => {
152-
render(<Course {...mockData} />, { wrapWithRouter: true });
153-
154-
waitFor(() => {
155-
const notificationTrigger = screen.getByRole('button', { name: /Show notification tray/i });
156-
expect(notificationTrigger).toBeInTheDocument();
157-
expect(notificationTrigger.parentNode).not.toHaveClass('sidebar-active', { exact: true });
158-
fireEvent.click(notificationTrigger);
159-
expect(notificationTrigger.parentNode).toHaveClass('sidebar-active');
160-
});
161-
});
162-
163151
it('handles click to open/close discussions sidebar', async () => {
164152
await setupDiscussionSidebar();
165153

src/courseware/course/new-sidebar/sidebars/discussions-notifications/notifications/NotificationsWidget.test.tsx

+1-60
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import { getAuthenticatedHttpClient } from '@edx/frontend-platform/auth';
99
import { breakpoints } from '@openedx/paragon';
1010

1111
import {
12-
initializeMockApp, render, screen, within, act, fireEvent, waitFor,
12+
initializeMockApp, render, screen, act, fireEvent, waitFor,
1313
} from '../../../../../../setupTest';
1414
import initializeStore from '../../../../../../store';
1515
import { appendBrowserTimezoneToUrl, executeThunk } from '../../../../../../utils';
@@ -93,27 +93,6 @@ describe('NotificationsWidget', () => {
9393
expect(screen.getByTestId('notification_widget_slot')).toBeInTheDocument();
9494
});
9595

96-
it('renders upgrade card', async () => {
97-
const contextData: Partial<SidebarContextData> = {
98-
currentSidebar: ID,
99-
courseId,
100-
hideNotificationbar: false,
101-
isNotificationbarAvailable: true,
102-
};
103-
await fetchAndRender(
104-
<SidebarContext.Provider value={contextData as SidebarContextData}>
105-
<NotificationsWidget />
106-
</SidebarContext.Provider>,
107-
);
108-
109-
// The Upgrade Notification should be inside the PluginSlot.
110-
const UpgradeNotification = document.querySelector('.upgrade-notification');
111-
expect(UpgradeNotification).toBeInTheDocument();
112-
113-
expect(screen.getByRole('link', { name: 'Upgrade for $149' })).toBeInTheDocument();
114-
expect(screen.queryByText('You have no new notifications at this time.')).not.toBeInTheDocument();
115-
});
116-
11796
it('renders no notifications bar if no verified mode', async () => {
11897
setMetadata({ verified_mode: null });
11998
const contextData: Partial<SidebarContextData> = {
@@ -130,44 +109,6 @@ describe('NotificationsWidget', () => {
130109
expect(screen.queryByText('Notifications')).not.toBeInTheDocument();
131110
});
132111

133-
it.each([
134-
{
135-
description: 'close the notification widget.',
136-
enabledInContext: true,
137-
testId: 'notification-widget',
138-
},
139-
{
140-
description: 'close the sidebar when the notification widget is closed, and the discussion widget is unavailable.',
141-
enabledInContext: false,
142-
testId: 'sidebar-DISCUSSIONS_NOTIFICATIONS',
143-
},
144-
])('successfully %s', async ({ enabledInContext, testId }) => {
145-
const userVerifiedMode = Factory.build('verifiedMode');
146-
147-
await setupDiscussionSidebar({
148-
verifiedMode: userVerifiedMode,
149-
enabledInContext,
150-
isNewDiscussionSidebarViewEnabled: true,
151-
});
152-
153-
const sidebarButton = screen.getByRole('button', { name: /Show sidebar tray/i });
154-
155-
await act(async () => {
156-
fireEvent.click(sidebarButton);
157-
});
158-
159-
const notificationWidget = await waitFor(() => screen.getByTestId('notification-widget'));
160-
const closeNotificationButton = within(notificationWidget).getByRole('button', { name: /Close/i });
161-
162-
await act(async () => {
163-
fireEvent.click(closeNotificationButton);
164-
});
165-
166-
await waitFor(() => {
167-
expect(screen.queryByTestId(testId)).not.toBeInTheDocument();
168-
});
169-
});
170-
171112
it('marks notification as seen 3 seconds later', async () => {
172113
const onNotificationSeen = jest.fn();
173114
const contextData: Partial<SidebarContextData> = {

src/courseware/course/new-sidebar/sidebars/discussions-notifications/notifications/NotificationsWidget.tsx

+1-24
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import React, { useContext, useEffect, useMemo } from 'react';
33
import { sendTrackEvent } from '@edx/frontend-platform/analytics';
44
import { PluginSlot } from '@openedx/frontend-plugin-framework';
55
import { useModel } from '../../../../../../generic/model-store';
6-
import UpgradeNotification from '../../../../../../generic/upgrade-notification/UpgradeNotification';
76
import { WIDGETS } from '../../../../../../constants';
87
import SidebarContext from '../../../SidebarContext';
98

@@ -21,17 +20,11 @@ const NotificationsWidget = () => {
2120
const course = useModel('coursewareMeta', courseId);
2221

2322
const {
24-
accessExpiration,
25-
contentTypeGatingEnabled,
2623
end,
2724
enrollmentEnd,
2825
enrollmentMode,
2926
enrollmentStart,
30-
marketingUrl,
31-
offer,
3227
start,
33-
timeOffsetMillis,
34-
userTimezone,
3528
verificationStatus,
3629
} = course;
3730

@@ -83,23 +76,7 @@ const NotificationsWidget = () => {
8376
setNotificationCurrentState: setUpgradeNotificationCurrentState,
8477
toggleSidebar: onToggleSidebar,
8578
}}
86-
>
87-
<UpgradeNotification
88-
offer={offer}
89-
verifiedMode={verifiedMode}
90-
accessExpiration={accessExpiration}
91-
contentTypeGatingEnabled={contentTypeGatingEnabled}
92-
marketingUrl={marketingUrl}
93-
upsellPageName="in_course"
94-
userTimezone={userTimezone}
95-
shouldDisplayBorder={false}
96-
timeOffsetMillis={timeOffsetMillis}
97-
courseId={courseId}
98-
org={org}
99-
setupgradeNotificationCurrentState={setUpgradeNotificationCurrentState}
100-
toggleSidebar={onToggleSidebar}
101-
/>
102-
</PluginSlot>
79+
/>
10380
</div>
10481
);
10582
};

src/courseware/course/sidebar/sidebars/notifications/NotificationTray.jsx

+1-24
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import { sendTrackEvent } from '@edx/frontend-platform/analytics';
55
import { PluginSlot } from '@openedx/frontend-plugin-framework';
66
import { getAuthenticatedUser } from '@edx/frontend-platform/auth';
77
import { useModel } from '@src/generic/model-store';
8-
import UpgradeNotification from '../../../../../generic/upgrade-notification/UpgradeNotification';
98

109
import messages from '../../../messages';
1110
import SidebarBase from '../../common/SidebarBase';
@@ -23,17 +22,11 @@ const NotificationTray = ({ intl }) => {
2322
const course = useModel('coursewareMeta', courseId);
2423

2524
const {
26-
accessExpiration,
27-
contentTypeGatingEnabled,
2825
end,
2926
enrollmentEnd,
3027
enrollmentMode,
3128
enrollmentStart,
32-
marketingUrl,
33-
offer,
3429
start,
35-
timeOffsetMillis,
36-
userTimezone,
3730
verificationStatus,
3831
} = course;
3932

@@ -90,23 +83,7 @@ const NotificationTray = ({ intl }) => {
9083
notificationCurrentState: upgradeNotificationCurrentState,
9184
setNotificationCurrentState: setUpgradeNotificationCurrentState,
9285
}}
93-
>
94-
<UpgradeNotification
95-
offer={offer}
96-
verifiedMode={verifiedMode}
97-
accessExpiration={accessExpiration}
98-
contentTypeGatingEnabled={contentTypeGatingEnabled}
99-
marketingUrl={marketingUrl}
100-
upsellPageName="in_course"
101-
userTimezone={userTimezone}
102-
shouldDisplayBorder={false}
103-
timeOffsetMillis={timeOffsetMillis}
104-
courseId={courseId}
105-
org={org}
106-
upgradeNotificationCurrentState={upgradeNotificationCurrentState}
107-
setupgradeNotificationCurrentState={setUpgradeNotificationCurrentState}
108-
/>
109-
</PluginSlot>
86+
/>
11087
) : (
11188
<p className="p-3 small">{intl.formatMessage(messages.noNotificationsMessage)}</p>
11289
)}

src/courseware/course/sidebar/sidebars/notifications/NotificationTray.test.jsx

-20
Original file line numberDiff line numberDiff line change
@@ -94,26 +94,6 @@ describe('NotificationTray', () => {
9494
expect(screen.getByTestId('notification_tray_slot')).toBeInTheDocument();
9595
});
9696

97-
it('renders upgrade card', async () => {
98-
await fetchAndRender(
99-
<SidebarContext.Provider value={{
100-
currentSidebar: ID,
101-
courseId,
102-
}}
103-
>
104-
<NotificationTray />
105-
</SidebarContext.Provider>,
106-
);
107-
108-
expect(document.querySelector('.upgrade-notification')).toBeInTheDocument();
109-
110-
expect(screen.getByRole('link', { name: 'Upgrade for $149' }))
111-
.toBeInTheDocument();
112-
expect(screen.queryByText('You have no new notifications at this time.'))
113-
.not
114-
.toBeInTheDocument();
115-
});
116-
11797
it('renders no notifications message if no verified mode', async () => {
11898
setMetadata({ verified_mode: null });
11999
await fetchAndRender(

0 commit comments

Comments
 (0)