@@ -54,7 +54,7 @@ exports[`Dashboard snapshots there are no courses, there ARE available dashboard
|
||||
test-page-title
|
||||
</h1>
|
||||
<Fragment>
|
||||
<DashboardModal />
|
||||
<EnterpriseDashboardModal />
|
||||
</Fragment>
|
||||
<div
|
||||
data-testid="dashboard-content"
|
||||
|
||||
@@ -4,7 +4,7 @@ import { reduxHooks } from 'hooks';
|
||||
import { RequestKeys } from 'data/constants/requests';
|
||||
import SelectSessionModal from 'containers/SelectSessionModal';
|
||||
import CoursesPanel from 'containers/CoursesPanel';
|
||||
import DashboardModalSlot from 'plugin-slots/DashboardModalSlot';
|
||||
import EnterpriseDashboardModalSlot from 'plugin-slots/EnterpriseDashboardModalSlot';
|
||||
|
||||
import LoadingView from './LoadingView';
|
||||
import DashboardLayout from './DashboardLayout';
|
||||
@@ -24,7 +24,7 @@ export const Dashboard = () => {
|
||||
<h1 className="sr-only">{pageTitle}</h1>
|
||||
{!initIsPending && (
|
||||
<>
|
||||
{hasAvailableDashboards && <DashboardModalSlot />}
|
||||
{hasAvailableDashboards && <EnterpriseDashboardModalSlot />}
|
||||
{(hasCourses && showSelectSessionModal) && <SelectSessionModal />}
|
||||
</>
|
||||
)}
|
||||
|
||||
@@ -4,7 +4,7 @@ import { reduxHooks } from 'hooks';
|
||||
|
||||
import SelectSessionModal from 'containers/SelectSessionModal';
|
||||
import CoursesPanel from 'containers/CoursesPanel';
|
||||
import DashboardModalSlot from 'plugin-slots/DashboardModalSlot';
|
||||
import EnterpriseDashboardModalSlot from 'plugin-slots/EnterpriseDashboardModalSlot';
|
||||
|
||||
import DashboardLayout from './DashboardLayout';
|
||||
import LoadingView from './LoadingView';
|
||||
@@ -20,7 +20,7 @@ jest.mock('hooks', () => ({
|
||||
},
|
||||
}));
|
||||
|
||||
jest.mock('plugin-slots/DashboardModalSlot', () => 'DashboardModalSlot');
|
||||
jest.mock('plugin-slots/EnterpriseDashboardModalSlot', () => 'EnterpriseDashboardModalSlot');
|
||||
jest.mock('containers/CoursesPanel', () => 'CoursesPanel');
|
||||
jest.mock('./LoadingView', () => 'LoadingView');
|
||||
jest.mock('./DashboardLayout', () => 'DashboardLayout');
|
||||
@@ -81,7 +81,7 @@ describe('Dashboard', () => {
|
||||
testContent(contentEl);
|
||||
});
|
||||
it(`${renderString(showEnterpriseModal)} dashbaord modal`, () => {
|
||||
expect(wrapper.instance.findByType(DashboardModalSlot).length)
|
||||
expect(wrapper.instance.findByType(EnterpriseDashboardModalSlot).length)
|
||||
.toEqual(showEnterpriseModal ? 1 : 0);
|
||||
});
|
||||
it(`${renderString(showSelectSessionModal)} select session modal`, () => {
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
import React from 'react';
|
||||
import { PluginSlot } from '@openedx/frontend-plugin-framework';
|
||||
|
||||
const DashboardModal = () => (
|
||||
<PluginSlot id="dashboard_modal_slot" />
|
||||
);
|
||||
|
||||
export default DashboardModal;
|
||||
@@ -1,6 +1,6 @@
|
||||
# Course Card Action Slot
|
||||
|
||||
### Slot ID: `dashboard_modal_slot`
|
||||
### Slot ID: `enterprise_dashboard_modal_slot`
|
||||
|
||||
## Description
|
||||
|
||||
@@ -9,11 +9,11 @@ The following `env.config.jsx` will render the modal.
|
||||
|
||||
```js
|
||||
import { DIRECT_PLUGIN, PLUGIN_OPERATIONS } from '@openedx/frontend-plugin-framework';
|
||||
import { DashboardModal } from '@edx/frontend-plugin-learner-dashboard';
|
||||
import { EnterpriseDashboardModal } from '@edx/frontend-plugin-learner-dashboard';
|
||||
|
||||
const config = {
|
||||
pluginSlots: {
|
||||
dashboard_modal_slot: {
|
||||
enterprise_dashboard_modal_slot: {
|
||||
plugins: [
|
||||
{
|
||||
op: PLUGIN_OPERATIONS.Insert,
|
||||
@@ -21,7 +21,7 @@ const config = {
|
||||
id: 'dashboard_modal',
|
||||
type: DIRECT_PLUGIN,
|
||||
priority: 60,
|
||||
RenderWidget: DashboardModal,
|
||||
RenderWidget: EnterpriseDashboardModal,
|
||||
},
|
||||
},
|
||||
],
|
||||
8
src/plugin-slots/EnterpriseDashboardModalSlot/index.jsx
Normal file
8
src/plugin-slots/EnterpriseDashboardModalSlot/index.jsx
Normal file
@@ -0,0 +1,8 @@
|
||||
import React from 'react';
|
||||
import { PluginSlot } from '@openedx/frontend-plugin-framework';
|
||||
|
||||
const EnterpriseDashboardModal = () => (
|
||||
<PluginSlot id="enterprise_dashboard_modal_slot" />
|
||||
);
|
||||
|
||||
export default EnterpriseDashboardModal;
|
||||
@@ -5,4 +5,4 @@
|
||||
* [`widget_sidebar_slot`](./WidgetSidebarSlot/)
|
||||
* [`course_list_slot`](./CourseListSlot/)
|
||||
* [`no_courses_view_slot`](./NoCoursesViewSlot/)
|
||||
* [`dashboard_modal_slot](./DashboardModalSlot)
|
||||
* [`enterprise_dashboard_modal_slot](./EnterpriseDashboardModalSlot)
|
||||
@@ -20,9 +20,9 @@ export const events = StrictDict({
|
||||
leaveSession: 'leaveSession',
|
||||
unenrollReason: 'unenrollReason',
|
||||
entitlementUnenrollReason: 'entitlementUnenrollReason',
|
||||
dashboardModalOpened: 'dashboardModalOpened',
|
||||
dashboardModalCTAClicked: 'dashboardModalCTAClicked',
|
||||
dashboardModalClosed: 'dashboardModalClosed',
|
||||
enterpriseDashboardModalOpened: 'enterpriseDashboardModalOpened',
|
||||
enterpriseDashboardModalCTAClicked: 'enterpriseDashboardModalCTAClicked',
|
||||
enterpriseDashboardModalClosed: 'enterpriseDashboardModalClosed',
|
||||
});
|
||||
|
||||
const learnerPortal = 'edx.ui.enterprise.lms.dashboard.learner_portal_modal';
|
||||
@@ -39,9 +39,9 @@ export const eventNames = StrictDict({
|
||||
leaveSession: 'course-dashboard.leave-session',
|
||||
unenrollReason: 'unenrollment_reason.selected',
|
||||
entitlementUnenrollReason: 'entitlement_unenrollment_reason.selected',
|
||||
dashboardModalOpened: `${learnerPortal}.opened`,
|
||||
dashboardModalCTAClicked: `${learnerPortal}.dashboard_cta.clicked`,
|
||||
dashboardModalClosed: `${learnerPortal}.closed`,
|
||||
enterpriseDashboardModalOpened: `${learnerPortal}.opened`,
|
||||
enterpriseDashboardModalCTAClicked: `${learnerPortal}.dashboard_cta.clicked`,
|
||||
enterpriseDashboardModalClosed: `${learnerPortal}.closed`,
|
||||
findCoursesClicked: 'edx.bi.dashboard.find_courses_button.clicked',
|
||||
purchaseCredit: 'edx.bi.credit.clicked_purchase_credit',
|
||||
filterClicked: 'course-dashboard.filter.clicked',
|
||||
|
||||
@@ -8,7 +8,7 @@ import { eventNames } from '../constants';
|
||||
* @return {func} - Callback that tracks the event when fired.
|
||||
*/
|
||||
export const modalOpened = (enterpriseUUID) => () => createEventTracker(
|
||||
eventNames.dashboardModalOpened,
|
||||
eventNames.enterpriseDashboardModalOpened,
|
||||
{ enterpriseUUID },
|
||||
);
|
||||
|
||||
@@ -20,7 +20,7 @@ export const modalOpened = (enterpriseUUID) => () => createEventTracker(
|
||||
*/
|
||||
export const modalCTAClicked = (enterpriseUUID, href) => createLinkTracker(
|
||||
createEventTracker(
|
||||
eventNames.dashboardModalCTAClicked,
|
||||
eventNames.enterpriseDashboardModalCTAClicked,
|
||||
{ enterpriseUUID },
|
||||
),
|
||||
href,
|
||||
@@ -33,7 +33,7 @@ export const modalCTAClicked = (enterpriseUUID, href) => createLinkTracker(
|
||||
* @return {func} - Callback that tracks the event when fired.
|
||||
*/
|
||||
export const modalClosed = (enterpriseUUID, source) => createEventTracker(
|
||||
eventNames.dashboardModalClosed,
|
||||
eventNames.enterpriseDashboardModalClosed,
|
||||
{ enterpriseUUID, source },
|
||||
);
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ describe('enterpriseDashboard trackers', () => {
|
||||
it('creates event tracker for dashboard modal opened event', () => {
|
||||
expect(trackers.modalOpened(enterpriseUUID, source)()).toEqual(
|
||||
createEventTracker(
|
||||
eventNames.dashboardModalOpened,
|
||||
eventNames.enterpriseDashboardModalOpened,
|
||||
{ enterpriseUUID, source },
|
||||
),
|
||||
);
|
||||
@@ -28,7 +28,7 @@ describe('enterpriseDashboard trackers', () => {
|
||||
expect(href).toEqual(testHref);
|
||||
expect(cb).toEqual(
|
||||
createEventTracker(
|
||||
eventNames.dashboardModalCTAClicked,
|
||||
eventNames.enterpriseDashboardModalCTAClicked,
|
||||
{ enterpriseUUID, source },
|
||||
),
|
||||
);
|
||||
@@ -38,7 +38,7 @@ describe('enterpriseDashboard trackers', () => {
|
||||
it('creates event tracker for dashboard modal closed event with close source', () => {
|
||||
expect(trackers.modalClosed(enterpriseUUID, source)).toEqual(
|
||||
createEventTracker(
|
||||
eventNames.dashboardModalClosed,
|
||||
eventNames.enterpriseDashboardModalClosed,
|
||||
{ enterpriseUUID, source },
|
||||
),
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user