@edx/frontend-plugin-learner-dashboard 3.2.0 → 3.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/ci.yml +1 -1
- package/.github/workflows/release.yml +1 -1
- package/dist/index.js +13 -6
- package/dist/index.js.map +1 -1
- package/dist/no-courses-view/index.js +64 -0
- package/dist/no-courses-view/index.js.map +1 -0
- package/dist/no-courses-view/index.scss +13 -0
- package/dist/no-courses-view/messages.js +31 -0
- package/dist/no-courses-view/messages.js.map +1 -0
- package/dist/package.json +3 -2
- package/dist/tracking/constants.js +9 -1
- package/dist/tracking/constants.js.map +1 -1
- package/dist/tracking/trackers/exploreCourses.js +57 -0
- package/dist/tracking/trackers/exploreCourses.js.map +1 -0
- package/package.json +4 -3
- package/src/index.jsx +3 -1
- package/src/no-courses-view/index.jsx +60 -0
- package/src/no-courses-view/index.scss +13 -0
- package/src/no-courses-view/index.test.jsx +63 -0
- package/src/no-courses-view/messages.js +26 -0
- package/src/tracking/constants.js +8 -0
- package/src/tracking/trackers/exploreCourses.js +58 -0
package/.github/workflows/ci.yml
CHANGED
package/dist/index.js
CHANGED
|
@@ -33,10 +33,16 @@ Object.defineProperty(exports, "HelpChatbot", {
|
|
|
33
33
|
return _index3.default;
|
|
34
34
|
}
|
|
35
35
|
});
|
|
36
|
+
Object.defineProperty(exports, "NoCoursesView", {
|
|
37
|
+
enumerable: true,
|
|
38
|
+
get: function () {
|
|
39
|
+
return _noCoursesView.default;
|
|
40
|
+
}
|
|
41
|
+
});
|
|
36
42
|
Object.defineProperty(exports, "NoticesRedirect", {
|
|
37
43
|
enumerable: true,
|
|
38
44
|
get: function () {
|
|
39
|
-
return
|
|
45
|
+
return _index4.default;
|
|
40
46
|
}
|
|
41
47
|
});
|
|
42
48
|
Object.defineProperty(exports, "UclWrapper", {
|
|
@@ -54,13 +60,13 @@ Object.defineProperty(exports, "UpgradeButton", {
|
|
|
54
60
|
Object.defineProperty(exports, "UserCareerMenu", {
|
|
55
61
|
enumerable: true,
|
|
56
62
|
get: function () {
|
|
57
|
-
return
|
|
63
|
+
return _index5.default;
|
|
58
64
|
}
|
|
59
65
|
});
|
|
60
66
|
Object.defineProperty(exports, "UserDashboardMenu", {
|
|
61
67
|
enumerable: true,
|
|
62
68
|
get: function () {
|
|
63
|
-
return
|
|
69
|
+
return _index6.default;
|
|
64
70
|
}
|
|
65
71
|
});
|
|
66
72
|
var _index = _interopRequireDefault(require("./cohesion-wrapper/index"));
|
|
@@ -69,9 +75,10 @@ var _dynamicExperienceSlot = _interopRequireDefault(require("./dynamic-experienc
|
|
|
69
75
|
var _index2 = _interopRequireDefault(require("./dashboard-modal/index"));
|
|
70
76
|
var _index3 = _interopRequireDefault(require("./chatbot/index"));
|
|
71
77
|
var _uclWrapper = _interopRequireDefault(require("./ucl-wrapper"));
|
|
78
|
+
var _noCoursesView = _interopRequireDefault(require("./no-courses-view"));
|
|
79
|
+
var _index4 = _interopRequireDefault(require("./notices-redirect/index"));
|
|
72
80
|
var _upgradeButton = _interopRequireDefault(require("./upgrade-button"));
|
|
73
|
-
var
|
|
74
|
-
var
|
|
75
|
-
var _index6 = _interopRequireDefault(require("./notices-redirect/index"));
|
|
81
|
+
var _index5 = _interopRequireDefault(require("./career-menu/index"));
|
|
82
|
+
var _index6 = _interopRequireDefault(require("./dashboard-menu/index"));
|
|
76
83
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
77
84
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["_index","_interopRequireDefault","require","_courseBanner","_dynamicExperienceSlot","_index2","_index3","_uclWrapper","
|
|
1
|
+
{"version":3,"file":"index.js","names":["_index","_interopRequireDefault","require","_courseBanner","_dynamicExperienceSlot","_index2","_index3","_uclWrapper","_noCoursesView","_index4","_upgradeButton","_index5","_index6","e","__esModule","default"],"sources":["../src/index.jsx"],"sourcesContent":["import CohesionWrapper from './cohesion-wrapper/index';\nimport CourseBanner from './course-banner';\nimport DynamicExperienceSlot from './dynamic-experience-slot';\nimport EnterpriseDashboardModal from './dashboard-modal/index';\nimport HelpChatbot from './chatbot/index';\nimport UclWrapper from './ucl-wrapper';\nimport NoCoursesView from './no-courses-view';\nimport NoticesRedirect from './notices-redirect/index';\nimport UpgradeButton from './upgrade-button';\nimport UserCareerMenu from './career-menu/index';\nimport UserDashboardMenu from './dashboard-menu/index';\n\nexport {\n CohesionWrapper,\n CourseBanner,\n DynamicExperienceSlot,\n EnterpriseDashboardModal,\n HelpChatbot,\n NoCoursesView,\n NoticesRedirect,\n UclWrapper,\n UpgradeButton,\n UserCareerMenu,\n UserDashboardMenu,\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,aAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,sBAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,OAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,OAAA,GAAAL,sBAAA,CAAAC,OAAA;AACA,IAAAK,WAAA,GAAAN,sBAAA,CAAAC,OAAA;AACA,IAAAM,cAAA,GAAAP,sBAAA,CAAAC,OAAA;AACA,IAAAO,OAAA,GAAAR,sBAAA,CAAAC,OAAA;AACA,IAAAQ,cAAA,GAAAT,sBAAA,CAAAC,OAAA;AACA,IAAAS,OAAA,GAAAV,sBAAA,CAAAC,OAAA;AACA,IAAAU,OAAA,GAAAX,sBAAA,CAAAC,OAAA;AAAuD,SAAAD,uBAAAY,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA","ignoreList":[]}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
+
var _reactRouter = require("react-router");
|
|
9
|
+
var _i18n = require("@edx/frontend-platform/i18n");
|
|
10
|
+
var _paragon = require("@openedx/paragon");
|
|
11
|
+
var _icons = require("@openedx/paragon/icons");
|
|
12
|
+
var _urls = require("data/services/lms/urls");
|
|
13
|
+
var _emptyCourse = _interopRequireDefault(require("assets/empty-course.svg"));
|
|
14
|
+
var _hooks = require("hooks");
|
|
15
|
+
var _exploreCourses = require("../tracking/trackers/exploreCourses");
|
|
16
|
+
var _messages = _interopRequireDefault(require("./messages"));
|
|
17
|
+
require("./index.scss");
|
|
18
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
19
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
20
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
21
|
+
/* eslint-disable import/no-unresolved */
|
|
22
|
+
|
|
23
|
+
const NoCoursesView = () => {
|
|
24
|
+
const {
|
|
25
|
+
formatMessage
|
|
26
|
+
} = (0, _i18n.useIntl)();
|
|
27
|
+
const {
|
|
28
|
+
courseSearchUrl
|
|
29
|
+
} = _hooks.reduxHooks.usePlatformSettingsData();
|
|
30
|
+
const location = (0, _reactRouter.useLocation)();
|
|
31
|
+
const fullUrl = (0, _urls.baseAppUrl)(location.pathname);
|
|
32
|
+
const pageTitle = document.title;
|
|
33
|
+
const handleExploreCoursesViewed = (0, _react.useCallback)(() => {
|
|
34
|
+
(0, _exploreCourses.exploreCoursesViewedCohesion)(pageTitle, fullUrl);
|
|
35
|
+
}, [pageTitle, fullUrl]);
|
|
36
|
+
const handleExploreCoursesClick = () => {
|
|
37
|
+
(0, _exploreCourses.exploreCoursesClickedCohesion)(pageTitle, fullUrl);
|
|
38
|
+
};
|
|
39
|
+
(0, _react.useEffect)(() => {
|
|
40
|
+
handleExploreCoursesViewed();
|
|
41
|
+
}, [handleExploreCoursesViewed]);
|
|
42
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
43
|
+
id: "no-courses-content-view",
|
|
44
|
+
className: "d-flex align-items-center justify-content-center mb-4.5",
|
|
45
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_paragon.Image, {
|
|
46
|
+
src: _emptyCourse.default,
|
|
47
|
+
alt: formatMessage(_messages.default.bannerAlt)
|
|
48
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("h3", {
|
|
49
|
+
className: "h1",
|
|
50
|
+
children: formatMessage(_messages.default.lookingForChallengePrompt)
|
|
51
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
|
|
52
|
+
children: formatMessage(_messages.default.exploreCoursesPrompt)
|
|
53
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_paragon.Button, {
|
|
54
|
+
variant: "brand",
|
|
55
|
+
as: "a",
|
|
56
|
+
onClick: handleExploreCoursesClick,
|
|
57
|
+
href: (0, _urls.baseAppUrl)(courseSearchUrl),
|
|
58
|
+
iconBefore: _icons.Search,
|
|
59
|
+
children: formatMessage(_messages.default.exploreCoursesButton)
|
|
60
|
+
})]
|
|
61
|
+
});
|
|
62
|
+
};
|
|
63
|
+
var _default = exports.default = NoCoursesView;
|
|
64
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":["_react","_interopRequireWildcard","require","_reactRouter","_i18n","_paragon","_icons","_urls","_emptyCourse","_interopRequireDefault","_hooks","_exploreCourses","_messages","_jsxRuntime","e","__esModule","default","t","WeakMap","r","n","o","i","f","__proto__","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","NoCoursesView","formatMessage","useIntl","courseSearchUrl","reduxHooks","usePlatformSettingsData","location","useLocation","fullUrl","baseAppUrl","pathname","pageTitle","document","title","handleExploreCoursesViewed","useCallback","exploreCoursesViewedCohesion","handleExploreCoursesClick","exploreCoursesClickedCohesion","useEffect","jsxs","id","className","children","jsx","Image","src","emptyCourseSVG","alt","messages","bannerAlt","lookingForChallengePrompt","exploreCoursesPrompt","Button","variant","as","onClick","href","iconBefore","Search","exploreCoursesButton","_default","exports"],"sources":["../../src/no-courses-view/index.jsx"],"sourcesContent":["/* eslint-disable import/no-unresolved */\nimport React, { useCallback, useEffect } from 'react';\nimport { useLocation } from 'react-router';\nimport { useIntl } from '@edx/frontend-platform/i18n';\nimport { Button, Image } from '@openedx/paragon';\nimport { Search } from '@openedx/paragon/icons';\nimport { baseAppUrl } from 'data/services/lms/urls';\n\nimport emptyCourseSVG from 'assets/empty-course.svg';\nimport { reduxHooks } from 'hooks';\nimport { exploreCoursesViewedCohesion, exploreCoursesClickedCohesion } from '../tracking/trackers/exploreCourses';\n\nimport messages from './messages';\nimport './index.scss';\n\nconst NoCoursesView = () => {\n const { formatMessage } = useIntl();\n const { courseSearchUrl } = reduxHooks.usePlatformSettingsData();\n const location = useLocation();\n const fullUrl = baseAppUrl(location.pathname);\n const pageTitle = document.title;\n\n const handleExploreCoursesViewed = useCallback(() => {\n exploreCoursesViewedCohesion(pageTitle, fullUrl);\n }, [pageTitle, fullUrl]);\n\n const handleExploreCoursesClick = () => {\n exploreCoursesClickedCohesion(pageTitle, fullUrl);\n };\n\n useEffect(() => {\n handleExploreCoursesViewed();\n }, [handleExploreCoursesViewed]);\n\n return (\n <div\n id=\"no-courses-content-view\"\n className=\"d-flex align-items-center justify-content-center mb-4.5\"\n >\n <Image src={emptyCourseSVG} alt={formatMessage(messages.bannerAlt)} />\n <h3 className=\"h1\">\n {formatMessage(messages.lookingForChallengePrompt)}\n </h3>\n <p>\n {formatMessage(messages.exploreCoursesPrompt)}\n </p>\n <Button\n variant=\"brand\"\n as=\"a\"\n onClick={handleExploreCoursesClick}\n href={baseAppUrl(courseSearchUrl)}\n iconBefore={Search}\n >\n {formatMessage(messages.exploreCoursesButton)}\n </Button>\n </div>\n );\n};\n\nexport default NoCoursesView;\n"],"mappings":"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","ignoreList":[]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
#no-courses-content-view {
|
|
2
|
+
border: 2px solid var(--pgn-color-light-400);
|
|
3
|
+
flex-direction: column;
|
|
4
|
+
padding-bottom: var(--pgn-spacing-spacer-5);
|
|
5
|
+
padding-top: var(--pgn-spacing-spacer-5);
|
|
6
|
+
height: 100%;
|
|
7
|
+
|
|
8
|
+
& > * {
|
|
9
|
+
margin-top: var(--pgn-spacing-spacer-3);
|
|
10
|
+
margin-bottom: var(--pgn-spacing-spacer-3);
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _i18n = require("@edx/frontend-platform/i18n");
|
|
8
|
+
const messages = (0, _i18n.defineMessages)({
|
|
9
|
+
lookingForChallengePrompt: {
|
|
10
|
+
id: 'Dashboard.NoCoursesView.lookingForChallengePrompt',
|
|
11
|
+
defaultMessage: 'Looking for a new challenge?',
|
|
12
|
+
description: 'Prompt user for new challenge'
|
|
13
|
+
},
|
|
14
|
+
exploreCoursesPrompt: {
|
|
15
|
+
id: 'Dashboard.NoCoursesView.exploreCoursesPrompt',
|
|
16
|
+
defaultMessage: 'Explore our courses to add them to your dashboard.',
|
|
17
|
+
description: 'Prompt user to explore more courses'
|
|
18
|
+
},
|
|
19
|
+
exploreCoursesButton: {
|
|
20
|
+
id: 'Dashboard.NoCoursesView.exploreCoursesButton',
|
|
21
|
+
defaultMessage: 'Explore courses',
|
|
22
|
+
description: 'Button to explore more courses'
|
|
23
|
+
},
|
|
24
|
+
bannerAlt: {
|
|
25
|
+
id: 'Dashboard.NoCoursesView.bannerAlt',
|
|
26
|
+
defaultMessage: 'No Courses view banner',
|
|
27
|
+
description: 'No Courses view basnner'
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
var _default = exports.default = messages;
|
|
31
|
+
//# sourceMappingURL=messages.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"messages.js","names":["_i18n","require","messages","defineMessages","lookingForChallengePrompt","id","defaultMessage","description","exploreCoursesPrompt","exploreCoursesButton","bannerAlt","_default","exports","default"],"sources":["../../src/no-courses-view/messages.js"],"sourcesContent":["import { defineMessages } from '@edx/frontend-platform/i18n';\n\nconst messages = defineMessages({\n lookingForChallengePrompt: {\n id: 'Dashboard.NoCoursesView.lookingForChallengePrompt',\n defaultMessage: 'Looking for a new challenge?',\n description: 'Prompt user for new challenge',\n },\n exploreCoursesPrompt: {\n id: 'Dashboard.NoCoursesView.exploreCoursesPrompt',\n defaultMessage: 'Explore our courses to add them to your dashboard.',\n description: 'Prompt user to explore more courses',\n },\n exploreCoursesButton: {\n id: 'Dashboard.NoCoursesView.exploreCoursesButton',\n defaultMessage: 'Explore courses',\n description: 'Button to explore more courses',\n },\n bannerAlt: {\n id: 'Dashboard.NoCoursesView.bannerAlt',\n defaultMessage: 'No Courses view banner',\n description: 'No Courses view basnner',\n },\n});\n\nexport default messages;\n"],"mappings":";;;;;;AAAA,IAAAA,KAAA,GAAAC,OAAA;AAEA,MAAMC,QAAQ,GAAG,IAAAC,oBAAc,EAAC;EAC9BC,yBAAyB,EAAE;IACzBC,EAAE,EAAE,mDAAmD;IACvDC,cAAc,EAAE,8BAA8B;IAC9CC,WAAW,EAAE;EACf,CAAC;EACDC,oBAAoB,EAAE;IACpBH,EAAE,EAAE,8CAA8C;IAClDC,cAAc,EAAE,oDAAoD;IACpEC,WAAW,EAAE;EACf,CAAC;EACDE,oBAAoB,EAAE;IACpBJ,EAAE,EAAE,8CAA8C;IAClDC,cAAc,EAAE,iBAAiB;IACjCC,WAAW,EAAE;EACf,CAAC;EACDG,SAAS,EAAE;IACTL,EAAE,EAAE,mCAAmC;IACvCC,cAAc,EAAE,wBAAwB;IACxCC,WAAW,EAAE;EACf;AACF,CAAC,CAAC;AAAC,IAAAI,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEYX,QAAQ","ignoreList":[]}
|
package/dist/package.json
CHANGED
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
"jest": "30.2.0",
|
|
51
51
|
"react-error-boundary": "^6.1.0",
|
|
52
52
|
"rosie": "2.1.1",
|
|
53
|
-
"semantic-release": "^
|
|
53
|
+
"semantic-release": "^25.0.0",
|
|
54
54
|
"ts-jest": "^29.1.4"
|
|
55
55
|
},
|
|
56
56
|
"peerDependencies": {
|
|
@@ -59,6 +59,7 @@
|
|
|
59
59
|
"moment": "^2.30.1",
|
|
60
60
|
"prop-types": "15.8.1",
|
|
61
61
|
"react": "^18.3.1",
|
|
62
|
-
"react-dom": "^18.3.1"
|
|
62
|
+
"react-dom": "^18.3.1",
|
|
63
|
+
"react-router": "^6.30.1"
|
|
63
64
|
}
|
|
64
65
|
}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.eventNames = exports.categories = void 0;
|
|
6
|
+
exports.eventNames = exports.categories = exports.LOCATION_LEARNER_HOME = exports.LEARNER_HOME_PAGE_TYPE = exports.EXPLORE_COURSES_HTML_ID = exports.EXPLORE_COURSES_EVENT_TEXT = exports.EXPLORE_COURSES_EVENT_NAME = exports.BUTTON_ELEMENT_TYPE = void 0;
|
|
7
7
|
const learnerPortal = 'edx.ui.enterprise.lms.dashboard.learner_portal_modal';
|
|
8
8
|
const eventNames = exports.eventNames = {
|
|
9
9
|
dashboardModalOpened: `${learnerPortal}.opened`,
|
|
@@ -16,4 +16,12 @@ const eventNames = exports.eventNames = {
|
|
|
16
16
|
const categories = exports.categories = {
|
|
17
17
|
upgrade: 'upgrade'
|
|
18
18
|
};
|
|
19
|
+
|
|
20
|
+
// Cohesion event properties
|
|
21
|
+
const LEARNER_HOME_PAGE_TYPE = exports.LEARNER_HOME_PAGE_TYPE = 'Learner Home';
|
|
22
|
+
const BUTTON_ELEMENT_TYPE = exports.BUTTON_ELEMENT_TYPE = 'BUTTON';
|
|
23
|
+
const LOCATION_LEARNER_HOME = exports.LOCATION_LEARNER_HOME = 'learner-home-legacy';
|
|
24
|
+
const EXPLORE_COURSES_HTML_ID = exports.EXPLORE_COURSES_HTML_ID = 'explore-courses';
|
|
25
|
+
const EXPLORE_COURSES_EVENT_NAME = exports.EXPLORE_COURSES_EVENT_NAME = 'explore-courses-LD-cta';
|
|
26
|
+
const EXPLORE_COURSES_EVENT_TEXT = exports.EXPLORE_COURSES_EVENT_TEXT = 'Explore courses';
|
|
19
27
|
//# sourceMappingURL=constants.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","names":["learnerPortal","eventNames","exports","dashboardModalOpened","dashboardModalCTAClicked","dashboardModalClosed","upgradeButtonClicked","upgradeButtonClickedEnrollment","upgradeButtonClickedUpsell","categories","upgrade"],"sources":["../../src/tracking/constants.js"],"sourcesContent":["const learnerPortal = 'edx.ui.enterprise.lms.dashboard.learner_portal_modal';\n\nexport const eventNames = {\n dashboardModalOpened: `${learnerPortal}.opened`,\n dashboardModalCTAClicked: `${learnerPortal}.dashboard_cta.clicked`,\n dashboardModalClosed: `${learnerPortal}.closed`,\n upgradeButtonClicked: 'edx.bi.dashboard.upgrade_button.clicked',\n upgradeButtonClickedEnrollment: 'edx.course.enrollment.upgrade.clicked',\n upgradeButtonClickedUpsell: 'edx.bi.ecommerce.upsell_links_clicked',\n};\n\nexport const categories = {\n upgrade: 'upgrade',\n};\n"],"mappings":";;;;;;AAAA,MAAMA,aAAa,GAAG,sDAAsD;AAErE,MAAMC,UAAU,GAAAC,OAAA,CAAAD,UAAA,GAAG;EACxBE,oBAAoB,EAAE,GAAGH,aAAa,SAAS;EAC/CI,wBAAwB,EAAE,GAAGJ,aAAa,wBAAwB;EAClEK,oBAAoB,EAAE,GAAGL,aAAa,SAAS;EAC/CM,oBAAoB,EAAE,yCAAyC;EAC/DC,8BAA8B,EAAE,uCAAuC;EACvEC,0BAA0B,EAAE;AAC9B,CAAC;AAEM,MAAMC,UAAU,GAAAP,OAAA,CAAAO,UAAA,GAAG;EACxBC,OAAO,EAAE;AACX,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"constants.js","names":["learnerPortal","eventNames","exports","dashboardModalOpened","dashboardModalCTAClicked","dashboardModalClosed","upgradeButtonClicked","upgradeButtonClickedEnrollment","upgradeButtonClickedUpsell","categories","upgrade","LEARNER_HOME_PAGE_TYPE","BUTTON_ELEMENT_TYPE","LOCATION_LEARNER_HOME","EXPLORE_COURSES_HTML_ID","EXPLORE_COURSES_EVENT_NAME","EXPLORE_COURSES_EVENT_TEXT"],"sources":["../../src/tracking/constants.js"],"sourcesContent":["const learnerPortal = 'edx.ui.enterprise.lms.dashboard.learner_portal_modal';\n\nexport const eventNames = {\n dashboardModalOpened: `${learnerPortal}.opened`,\n dashboardModalCTAClicked: `${learnerPortal}.dashboard_cta.clicked`,\n dashboardModalClosed: `${learnerPortal}.closed`,\n upgradeButtonClicked: 'edx.bi.dashboard.upgrade_button.clicked',\n upgradeButtonClickedEnrollment: 'edx.course.enrollment.upgrade.clicked',\n upgradeButtonClickedUpsell: 'edx.bi.ecommerce.upsell_links_clicked',\n};\n\nexport const categories = {\n upgrade: 'upgrade',\n};\n\n// Cohesion event properties\nexport const LEARNER_HOME_PAGE_TYPE = 'Learner Home';\nexport const BUTTON_ELEMENT_TYPE = 'BUTTON';\nexport const LOCATION_LEARNER_HOME = 'learner-home-legacy';\nexport const EXPLORE_COURSES_HTML_ID = 'explore-courses';\nexport const EXPLORE_COURSES_EVENT_NAME = 'explore-courses-LD-cta';\nexport const EXPLORE_COURSES_EVENT_TEXT = 'Explore courses';\n"],"mappings":";;;;;;AAAA,MAAMA,aAAa,GAAG,sDAAsD;AAErE,MAAMC,UAAU,GAAAC,OAAA,CAAAD,UAAA,GAAG;EACxBE,oBAAoB,EAAE,GAAGH,aAAa,SAAS;EAC/CI,wBAAwB,EAAE,GAAGJ,aAAa,wBAAwB;EAClEK,oBAAoB,EAAE,GAAGL,aAAa,SAAS;EAC/CM,oBAAoB,EAAE,yCAAyC;EAC/DC,8BAA8B,EAAE,uCAAuC;EACvEC,0BAA0B,EAAE;AAC9B,CAAC;AAEM,MAAMC,UAAU,GAAAP,OAAA,CAAAO,UAAA,GAAG;EACxBC,OAAO,EAAE;AACX,CAAC;;AAED;AACO,MAAMC,sBAAsB,GAAAT,OAAA,CAAAS,sBAAA,GAAG,cAAc;AAC7C,MAAMC,mBAAmB,GAAAV,OAAA,CAAAU,mBAAA,GAAG,QAAQ;AACpC,MAAMC,qBAAqB,GAAAX,OAAA,CAAAW,qBAAA,GAAG,qBAAqB;AACnD,MAAMC,uBAAuB,GAAAZ,OAAA,CAAAY,uBAAA,GAAG,iBAAiB;AACjD,MAAMC,0BAA0B,GAAAb,OAAA,CAAAa,0BAAA,GAAG,wBAAwB;AAC3D,MAAMC,0BAA0B,GAAAd,OAAA,CAAAc,0BAAA,GAAG,iBAAiB","ignoreList":[]}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.exploreCoursesViewedCohesion = exports.exploreCoursesClickedCohesion = void 0;
|
|
7
|
+
var _logging = require("@edx/frontend-platform/logging");
|
|
8
|
+
var _constants = require("../constants");
|
|
9
|
+
const exploreCoursesViewedCohesion = (pageTitle, fullUrl) => {
|
|
10
|
+
if (window.tagular && typeof window.tagular === 'function') {
|
|
11
|
+
window.tagular?.('beam', {
|
|
12
|
+
'@type': 'redventures.usertracking.v3.ElementViewed',
|
|
13
|
+
metadata: {
|
|
14
|
+
page: {
|
|
15
|
+
title: pageTitle,
|
|
16
|
+
url: fullUrl,
|
|
17
|
+
pageType: _constants.LEARNER_HOME_PAGE_TYPE
|
|
18
|
+
},
|
|
19
|
+
webElement: {
|
|
20
|
+
elementType: _constants.BUTTON_ELEMENT_TYPE,
|
|
21
|
+
htmlId: _constants.EXPLORE_COURSES_HTML_ID,
|
|
22
|
+
location: _constants.LOCATION_LEARNER_HOME,
|
|
23
|
+
name: _constants.EXPLORE_COURSES_EVENT_NAME,
|
|
24
|
+
text: _constants.EXPLORE_COURSES_EVENT_TEXT
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
} else {
|
|
29
|
+
(0, _logging.logError)('Cohesion script failed to load before CTA was viewed');
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
exports.exploreCoursesViewedCohesion = exploreCoursesViewedCohesion;
|
|
33
|
+
const exploreCoursesClickedCohesion = (pageTitle, fullUrl) => {
|
|
34
|
+
if (window.tagular && typeof window.tagular === 'function') {
|
|
35
|
+
window.tagular?.('beam', {
|
|
36
|
+
'@type': 'redventures.usertracking.v3.ElementClicked',
|
|
37
|
+
metadata: {
|
|
38
|
+
page: {
|
|
39
|
+
title: pageTitle,
|
|
40
|
+
url: fullUrl,
|
|
41
|
+
pageType: _constants.LEARNER_HOME_PAGE_TYPE
|
|
42
|
+
},
|
|
43
|
+
webElement: {
|
|
44
|
+
elementType: _constants.BUTTON_ELEMENT_TYPE,
|
|
45
|
+
htmlId: _constants.EXPLORE_COURSES_HTML_ID,
|
|
46
|
+
location: _constants.LOCATION_LEARNER_HOME,
|
|
47
|
+
name: _constants.EXPLORE_COURSES_EVENT_NAME,
|
|
48
|
+
text: _constants.EXPLORE_COURSES_EVENT_TEXT
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
} else {
|
|
53
|
+
(0, _logging.logError)('Cohesion script failed to load before CTA was clicked');
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
exports.exploreCoursesClickedCohesion = exploreCoursesClickedCohesion;
|
|
57
|
+
//# sourceMappingURL=exploreCourses.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"exploreCourses.js","names":["_logging","require","_constants","exploreCoursesViewedCohesion","pageTitle","fullUrl","window","tagular","metadata","page","title","url","pageType","LEARNER_HOME_PAGE_TYPE","webElement","elementType","BUTTON_ELEMENT_TYPE","htmlId","EXPLORE_COURSES_HTML_ID","location","LOCATION_LEARNER_HOME","name","EXPLORE_COURSES_EVENT_NAME","text","EXPLORE_COURSES_EVENT_TEXT","logError","exports","exploreCoursesClickedCohesion"],"sources":["../../../src/tracking/trackers/exploreCourses.js"],"sourcesContent":["import { logError } from '@edx/frontend-platform/logging';\n\nimport {\n LEARNER_HOME_PAGE_TYPE,\n BUTTON_ELEMENT_TYPE,\n LOCATION_LEARNER_HOME,\n EXPLORE_COURSES_HTML_ID,\n EXPLORE_COURSES_EVENT_NAME,\n EXPLORE_COURSES_EVENT_TEXT,\n} from '../constants';\n\nexport const exploreCoursesViewedCohesion = (pageTitle, fullUrl) => {\n if (window.tagular && typeof window.tagular === 'function') {\n window.tagular?.('beam', {\n '@type': 'redventures.usertracking.v3.ElementViewed',\n metadata: {\n page: {\n title: pageTitle,\n url: fullUrl,\n pageType: LEARNER_HOME_PAGE_TYPE,\n },\n webElement: {\n elementType: BUTTON_ELEMENT_TYPE,\n htmlId: EXPLORE_COURSES_HTML_ID,\n location: LOCATION_LEARNER_HOME,\n name: EXPLORE_COURSES_EVENT_NAME,\n text: EXPLORE_COURSES_EVENT_TEXT,\n },\n },\n });\n } else {\n logError('Cohesion script failed to load before CTA was viewed');\n }\n};\n\nexport const exploreCoursesClickedCohesion = (pageTitle, fullUrl) => {\n if (window.tagular && typeof window.tagular === 'function') {\n window.tagular?.('beam', {\n '@type': 'redventures.usertracking.v3.ElementClicked',\n metadata: {\n page: {\n title: pageTitle,\n url: fullUrl,\n pageType: LEARNER_HOME_PAGE_TYPE,\n },\n webElement: {\n elementType: BUTTON_ELEMENT_TYPE,\n htmlId: EXPLORE_COURSES_HTML_ID,\n location: LOCATION_LEARNER_HOME,\n name: EXPLORE_COURSES_EVENT_NAME,\n text: EXPLORE_COURSES_EVENT_TEXT,\n },\n },\n });\n } else {\n logError('Cohesion script failed to load before CTA was clicked');\n }\n};\n"],"mappings":";;;;;;AAAA,IAAAA,QAAA,GAAAC,OAAA;AAEA,IAAAC,UAAA,GAAAD,OAAA;AASO,MAAME,4BAA4B,GAAGA,CAACC,SAAS,EAAEC,OAAO,KAAK;EAClE,IAAIC,MAAM,CAACC,OAAO,IAAI,OAAOD,MAAM,CAACC,OAAO,KAAK,UAAU,EAAE;IAC1DD,MAAM,CAACC,OAAO,GAAG,MAAM,EAAE;MACvB,OAAO,EAAE,2CAA2C;MACpDC,QAAQ,EAAE;QACRC,IAAI,EAAE;UACJC,KAAK,EAAEN,SAAS;UAChBO,GAAG,EAAEN,OAAO;UACZO,QAAQ,EAAEC;QACZ,CAAC;QACDC,UAAU,EAAE;UACVC,WAAW,EAAEC,8BAAmB;UAChCC,MAAM,EAAEC,kCAAuB;UAC/BC,QAAQ,EAAEC,gCAAqB;UAC/BC,IAAI,EAAEC,qCAA0B;UAChCC,IAAI,EAAEC;QACR;MACF;IACF,CAAC,CAAC;EACJ,CAAC,MAAM;IACL,IAAAC,iBAAQ,EAAC,sDAAsD,CAAC;EAClE;AACF,CAAC;AAACC,OAAA,CAAAvB,4BAAA,GAAAA,4BAAA;AAEK,MAAMwB,6BAA6B,GAAGA,CAACvB,SAAS,EAAEC,OAAO,KAAK;EACnE,IAAIC,MAAM,CAACC,OAAO,IAAI,OAAOD,MAAM,CAACC,OAAO,KAAK,UAAU,EAAE;IAC1DD,MAAM,CAACC,OAAO,GAAG,MAAM,EAAE;MACvB,OAAO,EAAE,4CAA4C;MACrDC,QAAQ,EAAE;QACRC,IAAI,EAAE;UACJC,KAAK,EAAEN,SAAS;UAChBO,GAAG,EAAEN,OAAO;UACZO,QAAQ,EAAEC;QACZ,CAAC;QACDC,UAAU,EAAE;UACVC,WAAW,EAAEC,8BAAmB;UAChCC,MAAM,EAAEC,kCAAuB;UAC/BC,QAAQ,EAAEC,gCAAqB;UAC/BC,IAAI,EAAEC,qCAA0B;UAChCC,IAAI,EAAEC;QACR;MACF;IACF,CAAC,CAAC;EACJ,CAAC,MAAM;IACL,IAAAC,iBAAQ,EAAC,uDAAuD,CAAC;EACnE;AACF,CAAC;AAACC,OAAA,CAAAC,6BAAA,GAAAA,6BAAA","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@edx/frontend-plugin-learner-dashboard",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.3.1",
|
|
4
4
|
"description": "Repository for Learner Dashboard MFE frontend plugins",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"repository": {
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
"jest": "30.2.0",
|
|
51
51
|
"react-error-boundary": "^6.1.0",
|
|
52
52
|
"rosie": "2.1.1",
|
|
53
|
-
"semantic-release": "^
|
|
53
|
+
"semantic-release": "^25.0.0",
|
|
54
54
|
"ts-jest": "^29.1.4"
|
|
55
55
|
},
|
|
56
56
|
"peerDependencies": {
|
|
@@ -59,6 +59,7 @@
|
|
|
59
59
|
"moment": "^2.30.1",
|
|
60
60
|
"prop-types": "15.8.1",
|
|
61
61
|
"react": "^18.3.1",
|
|
62
|
-
"react-dom": "^18.3.1"
|
|
62
|
+
"react-dom": "^18.3.1",
|
|
63
|
+
"react-router": "^6.30.1"
|
|
63
64
|
}
|
|
64
65
|
}
|
package/src/index.jsx
CHANGED
|
@@ -4,10 +4,11 @@ import DynamicExperienceSlot from './dynamic-experience-slot';
|
|
|
4
4
|
import EnterpriseDashboardModal from './dashboard-modal/index';
|
|
5
5
|
import HelpChatbot from './chatbot/index';
|
|
6
6
|
import UclWrapper from './ucl-wrapper';
|
|
7
|
+
import NoCoursesView from './no-courses-view';
|
|
8
|
+
import NoticesRedirect from './notices-redirect/index';
|
|
7
9
|
import UpgradeButton from './upgrade-button';
|
|
8
10
|
import UserCareerMenu from './career-menu/index';
|
|
9
11
|
import UserDashboardMenu from './dashboard-menu/index';
|
|
10
|
-
import NoticesRedirect from './notices-redirect/index';
|
|
11
12
|
|
|
12
13
|
export {
|
|
13
14
|
CohesionWrapper,
|
|
@@ -15,6 +16,7 @@ export {
|
|
|
15
16
|
DynamicExperienceSlot,
|
|
16
17
|
EnterpriseDashboardModal,
|
|
17
18
|
HelpChatbot,
|
|
19
|
+
NoCoursesView,
|
|
18
20
|
NoticesRedirect,
|
|
19
21
|
UclWrapper,
|
|
20
22
|
UpgradeButton,
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/* eslint-disable import/no-unresolved */
|
|
2
|
+
import React, { useCallback, useEffect } from 'react';
|
|
3
|
+
import { useLocation } from 'react-router';
|
|
4
|
+
import { useIntl } from '@edx/frontend-platform/i18n';
|
|
5
|
+
import { Button, Image } from '@openedx/paragon';
|
|
6
|
+
import { Search } from '@openedx/paragon/icons';
|
|
7
|
+
import { baseAppUrl } from 'data/services/lms/urls';
|
|
8
|
+
|
|
9
|
+
import emptyCourseSVG from 'assets/empty-course.svg';
|
|
10
|
+
import { reduxHooks } from 'hooks';
|
|
11
|
+
import { exploreCoursesViewedCohesion, exploreCoursesClickedCohesion } from '../tracking/trackers/exploreCourses';
|
|
12
|
+
|
|
13
|
+
import messages from './messages';
|
|
14
|
+
import './index.scss';
|
|
15
|
+
|
|
16
|
+
const NoCoursesView = () => {
|
|
17
|
+
const { formatMessage } = useIntl();
|
|
18
|
+
const { courseSearchUrl } = reduxHooks.usePlatformSettingsData();
|
|
19
|
+
const location = useLocation();
|
|
20
|
+
const fullUrl = baseAppUrl(location.pathname);
|
|
21
|
+
const pageTitle = document.title;
|
|
22
|
+
|
|
23
|
+
const handleExploreCoursesViewed = useCallback(() => {
|
|
24
|
+
exploreCoursesViewedCohesion(pageTitle, fullUrl);
|
|
25
|
+
}, [pageTitle, fullUrl]);
|
|
26
|
+
|
|
27
|
+
const handleExploreCoursesClick = () => {
|
|
28
|
+
exploreCoursesClickedCohesion(pageTitle, fullUrl);
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
useEffect(() => {
|
|
32
|
+
handleExploreCoursesViewed();
|
|
33
|
+
}, [handleExploreCoursesViewed]);
|
|
34
|
+
|
|
35
|
+
return (
|
|
36
|
+
<div
|
|
37
|
+
id="no-courses-content-view"
|
|
38
|
+
className="d-flex align-items-center justify-content-center mb-4.5"
|
|
39
|
+
>
|
|
40
|
+
<Image src={emptyCourseSVG} alt={formatMessage(messages.bannerAlt)} />
|
|
41
|
+
<h3 className="h1">
|
|
42
|
+
{formatMessage(messages.lookingForChallengePrompt)}
|
|
43
|
+
</h3>
|
|
44
|
+
<p>
|
|
45
|
+
{formatMessage(messages.exploreCoursesPrompt)}
|
|
46
|
+
</p>
|
|
47
|
+
<Button
|
|
48
|
+
variant="brand"
|
|
49
|
+
as="a"
|
|
50
|
+
onClick={handleExploreCoursesClick}
|
|
51
|
+
href={baseAppUrl(courseSearchUrl)}
|
|
52
|
+
iconBefore={Search}
|
|
53
|
+
>
|
|
54
|
+
{formatMessage(messages.exploreCoursesButton)}
|
|
55
|
+
</Button>
|
|
56
|
+
</div>
|
|
57
|
+
);
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
export default NoCoursesView;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
#no-courses-content-view {
|
|
2
|
+
border: 2px solid var(--pgn-color-light-400);
|
|
3
|
+
flex-direction: column;
|
|
4
|
+
padding-bottom: var(--pgn-spacing-spacer-5);
|
|
5
|
+
padding-top: var(--pgn-spacing-spacer-5);
|
|
6
|
+
height: 100%;
|
|
7
|
+
|
|
8
|
+
& > * {
|
|
9
|
+
margin-top: var(--pgn-spacing-spacer-3);
|
|
10
|
+
margin-bottom: var(--pgn-spacing-spacer-3);
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { fireEvent, render, screen } from '@testing-library/react';
|
|
2
|
+
import { IntlProvider } from '@edx/frontend-platform/i18n';
|
|
3
|
+
import { formatMessage } from '../testUtils';
|
|
4
|
+
|
|
5
|
+
import EmptyCourse from '.';
|
|
6
|
+
import messages from './messages';
|
|
7
|
+
import { exploreCoursesViewedCohesion, exploreCoursesClickedCohesion } from '../tracking/trackers/exploreCourses';
|
|
8
|
+
|
|
9
|
+
const courseSearchUrl = '/course-search-url';
|
|
10
|
+
|
|
11
|
+
jest.mock('react-router', () => ({
|
|
12
|
+
useLocation: jest.fn(() => ({
|
|
13
|
+
pathname: 'mock-pathname',
|
|
14
|
+
})),
|
|
15
|
+
}));
|
|
16
|
+
|
|
17
|
+
jest.mock('hooks', () => ({
|
|
18
|
+
reduxHooks: {
|
|
19
|
+
usePlatformSettingsData: jest.fn(() => ({
|
|
20
|
+
courseSearchUrl,
|
|
21
|
+
})),
|
|
22
|
+
},
|
|
23
|
+
}), { virtual: true });
|
|
24
|
+
|
|
25
|
+
jest.mock('data/services/lms/urls', () => ({
|
|
26
|
+
baseAppUrl: (path) => `mock-base-app-url${path}`,
|
|
27
|
+
}), { virtual: true });
|
|
28
|
+
|
|
29
|
+
jest.mock('../tracking/trackers/exploreCourses', () => ({
|
|
30
|
+
exploreCoursesViewedCohesion: jest.fn(),
|
|
31
|
+
exploreCoursesClickedCohesion: jest.fn(),
|
|
32
|
+
}));
|
|
33
|
+
|
|
34
|
+
describe('NoCoursesView', () => {
|
|
35
|
+
it('should display image, heading and button', () => {
|
|
36
|
+
render(<IntlProvider locale="en"><EmptyCourse /></IntlProvider>);
|
|
37
|
+
const image = screen.getByRole('img', { alt: formatMessage(messages.bannerAlt) });
|
|
38
|
+
expect(image).toBeInTheDocument();
|
|
39
|
+
});
|
|
40
|
+
it('should display heading and prompt', () => {
|
|
41
|
+
render(<IntlProvider locale="en"><EmptyCourse /></IntlProvider>);
|
|
42
|
+
const heading = screen.getByText(formatMessage(messages.lookingForChallengePrompt));
|
|
43
|
+
const prompt = screen.getByText(formatMessage(messages.exploreCoursesPrompt));
|
|
44
|
+
expect(heading).toBeInTheDocument();
|
|
45
|
+
expect(prompt).toBeInTheDocument();
|
|
46
|
+
});
|
|
47
|
+
it('should display button', () => {
|
|
48
|
+
render(<IntlProvider locale="en"><EmptyCourse /></IntlProvider>);
|
|
49
|
+
const button = screen.getByRole('link', { name: formatMessage(messages.exploreCoursesButton) });
|
|
50
|
+
expect(button).toBeInTheDocument();
|
|
51
|
+
expect(button.href).toContain(`mock-base-app-url${courseSearchUrl}`);
|
|
52
|
+
});
|
|
53
|
+
it('should fire cohesion viewed event on load', () => {
|
|
54
|
+
render(<IntlProvider locale="en"><EmptyCourse /></IntlProvider>);
|
|
55
|
+
expect(exploreCoursesViewedCohesion).toHaveBeenCalled();
|
|
56
|
+
});
|
|
57
|
+
it('should fire cohesion click event when explore courses CTA is clicked', () => {
|
|
58
|
+
render(<IntlProvider locale="en"><EmptyCourse /></IntlProvider>);
|
|
59
|
+
const button = screen.getByRole('link', { name: formatMessage(messages.exploreCoursesButton) });
|
|
60
|
+
fireEvent.click(button);
|
|
61
|
+
expect(exploreCoursesClickedCohesion).toHaveBeenCalled();
|
|
62
|
+
});
|
|
63
|
+
});
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { defineMessages } from '@edx/frontend-platform/i18n';
|
|
2
|
+
|
|
3
|
+
const messages = defineMessages({
|
|
4
|
+
lookingForChallengePrompt: {
|
|
5
|
+
id: 'Dashboard.NoCoursesView.lookingForChallengePrompt',
|
|
6
|
+
defaultMessage: 'Looking for a new challenge?',
|
|
7
|
+
description: 'Prompt user for new challenge',
|
|
8
|
+
},
|
|
9
|
+
exploreCoursesPrompt: {
|
|
10
|
+
id: 'Dashboard.NoCoursesView.exploreCoursesPrompt',
|
|
11
|
+
defaultMessage: 'Explore our courses to add them to your dashboard.',
|
|
12
|
+
description: 'Prompt user to explore more courses',
|
|
13
|
+
},
|
|
14
|
+
exploreCoursesButton: {
|
|
15
|
+
id: 'Dashboard.NoCoursesView.exploreCoursesButton',
|
|
16
|
+
defaultMessage: 'Explore courses',
|
|
17
|
+
description: 'Button to explore more courses',
|
|
18
|
+
},
|
|
19
|
+
bannerAlt: {
|
|
20
|
+
id: 'Dashboard.NoCoursesView.bannerAlt',
|
|
21
|
+
defaultMessage: 'No Courses view banner',
|
|
22
|
+
description: 'No Courses view basnner',
|
|
23
|
+
},
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
export default messages;
|
|
@@ -12,3 +12,11 @@ export const eventNames = {
|
|
|
12
12
|
export const categories = {
|
|
13
13
|
upgrade: 'upgrade',
|
|
14
14
|
};
|
|
15
|
+
|
|
16
|
+
// Cohesion event properties
|
|
17
|
+
export const LEARNER_HOME_PAGE_TYPE = 'Learner Home';
|
|
18
|
+
export const BUTTON_ELEMENT_TYPE = 'BUTTON';
|
|
19
|
+
export const LOCATION_LEARNER_HOME = 'learner-home-legacy';
|
|
20
|
+
export const EXPLORE_COURSES_HTML_ID = 'explore-courses';
|
|
21
|
+
export const EXPLORE_COURSES_EVENT_NAME = 'explore-courses-LD-cta';
|
|
22
|
+
export const EXPLORE_COURSES_EVENT_TEXT = 'Explore courses';
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { logError } from '@edx/frontend-platform/logging';
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
LEARNER_HOME_PAGE_TYPE,
|
|
5
|
+
BUTTON_ELEMENT_TYPE,
|
|
6
|
+
LOCATION_LEARNER_HOME,
|
|
7
|
+
EXPLORE_COURSES_HTML_ID,
|
|
8
|
+
EXPLORE_COURSES_EVENT_NAME,
|
|
9
|
+
EXPLORE_COURSES_EVENT_TEXT,
|
|
10
|
+
} from '../constants';
|
|
11
|
+
|
|
12
|
+
export const exploreCoursesViewedCohesion = (pageTitle, fullUrl) => {
|
|
13
|
+
if (window.tagular && typeof window.tagular === 'function') {
|
|
14
|
+
window.tagular?.('beam', {
|
|
15
|
+
'@type': 'redventures.usertracking.v3.ElementViewed',
|
|
16
|
+
metadata: {
|
|
17
|
+
page: {
|
|
18
|
+
title: pageTitle,
|
|
19
|
+
url: fullUrl,
|
|
20
|
+
pageType: LEARNER_HOME_PAGE_TYPE,
|
|
21
|
+
},
|
|
22
|
+
webElement: {
|
|
23
|
+
elementType: BUTTON_ELEMENT_TYPE,
|
|
24
|
+
htmlId: EXPLORE_COURSES_HTML_ID,
|
|
25
|
+
location: LOCATION_LEARNER_HOME,
|
|
26
|
+
name: EXPLORE_COURSES_EVENT_NAME,
|
|
27
|
+
text: EXPLORE_COURSES_EVENT_TEXT,
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
});
|
|
31
|
+
} else {
|
|
32
|
+
logError('Cohesion script failed to load before CTA was viewed');
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
export const exploreCoursesClickedCohesion = (pageTitle, fullUrl) => {
|
|
37
|
+
if (window.tagular && typeof window.tagular === 'function') {
|
|
38
|
+
window.tagular?.('beam', {
|
|
39
|
+
'@type': 'redventures.usertracking.v3.ElementClicked',
|
|
40
|
+
metadata: {
|
|
41
|
+
page: {
|
|
42
|
+
title: pageTitle,
|
|
43
|
+
url: fullUrl,
|
|
44
|
+
pageType: LEARNER_HOME_PAGE_TYPE,
|
|
45
|
+
},
|
|
46
|
+
webElement: {
|
|
47
|
+
elementType: BUTTON_ELEMENT_TYPE,
|
|
48
|
+
htmlId: EXPLORE_COURSES_HTML_ID,
|
|
49
|
+
location: LOCATION_LEARNER_HOME,
|
|
50
|
+
name: EXPLORE_COURSES_EVENT_NAME,
|
|
51
|
+
text: EXPLORE_COURSES_EVENT_TEXT,
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
});
|
|
55
|
+
} else {
|
|
56
|
+
logError('Cohesion script failed to load before CTA was clicked');
|
|
57
|
+
}
|
|
58
|
+
};
|