@edx/frontend-plugin-learner-dashboard 1.7.0 → 2.0.0
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/dist/chatbot/HelpChatbot.js +1 -2
- package/dist/chatbot/HelpChatbot.js.map +1 -1
- package/dist/cohesion-wrapper/CohesionWrapper.js +4 -2
- package/dist/cohesion-wrapper/CohesionWrapper.js.map +1 -1
- package/dist/optimizely/Optimizely.js +2 -2
- package/dist/optimizely/Optimizely.js.map +1 -1
- package/dist/package.json +7 -8
- package/dist/tracking/cookie.js +12 -35
- package/dist/tracking/cookie.js.map +1 -1
- package/package.json +8 -9
- package/src/chatbot/HelpChatbot.jsx +1 -3
- package/src/cohesion-wrapper/CohesionWrapper.jsx +4 -2
- package/src/cohesion-wrapper/CohesionWrapper.test.jsx +1 -0
- package/src/dashboard-modal/EnterpriseDashboardModalWrapper.test.jsx +3 -3
- package/src/dashboard-modal/hooks/hooks.test.js +1 -1
- package/src/tracking/cookie.js +10 -36
- package/src/tracking/cookie.test.js +2 -42
|
@@ -10,7 +10,7 @@ const HelpChatbot = () => {
|
|
|
10
10
|
const [isBotLoaded, setBotLoaded] = (0, _react.useState)(false);
|
|
11
11
|
(0, _react.useEffect)(() => {
|
|
12
12
|
if (isBotLoaded) {
|
|
13
|
-
return
|
|
13
|
+
return;
|
|
14
14
|
}
|
|
15
15
|
const body = document.getElementsByTagName('body')[0];
|
|
16
16
|
window.XpertChatbotFrontend = {};
|
|
@@ -24,7 +24,6 @@ const HelpChatbot = () => {
|
|
|
24
24
|
body.appendChild(link);
|
|
25
25
|
body.appendChild(script);
|
|
26
26
|
setBotLoaded(true);
|
|
27
|
-
return null;
|
|
28
27
|
}, [isBotLoaded]);
|
|
29
28
|
return null;
|
|
30
29
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HelpChatbot.js","names":["_react","require","_five","HelpChatbot","isBotLoaded","setBotLoaded","useState","useEffect","body","document","getElementsByTagName","window","XpertChatbotFrontend","clientId","XPERT_KEY","link","createElement","rel","href","FIVE9_CHATBOT_CSS","script","src","FIVE9_CHATBOT_JS","defer","appendChild","_default","exports","default"],"sources":["../../src/chatbot/HelpChatbot.jsx"],"sourcesContent":["import { useState, useEffect } from 'react';\nimport { FIVE9_CHATBOT_CSS, FIVE9_CHATBOT_JS, XPERT_KEY } from './data/five9';\n\nconst HelpChatbot = () => {\n const [isBotLoaded, setBotLoaded] = useState(false);\n\n useEffect(() => {\n if (isBotLoaded) {\n return
|
|
1
|
+
{"version":3,"file":"HelpChatbot.js","names":["_react","require","_five","HelpChatbot","isBotLoaded","setBotLoaded","useState","useEffect","body","document","getElementsByTagName","window","XpertChatbotFrontend","clientId","XPERT_KEY","link","createElement","rel","href","FIVE9_CHATBOT_CSS","script","src","FIVE9_CHATBOT_JS","defer","appendChild","_default","exports","default"],"sources":["../../src/chatbot/HelpChatbot.jsx"],"sourcesContent":["import { useState, useEffect } from 'react';\nimport { FIVE9_CHATBOT_CSS, FIVE9_CHATBOT_JS, XPERT_KEY } from './data/five9';\n\nconst HelpChatbot = () => {\n const [isBotLoaded, setBotLoaded] = useState(false);\n\n useEffect(() => {\n if (isBotLoaded) {\n return;\n }\n\n const body = document.getElementsByTagName('body')[0];\n\n window.XpertChatbotFrontend = {};\n window.XpertChatbotFrontend.clientId = XPERT_KEY;\n\n const link = document.createElement('link');\n link.rel = 'stylesheet';\n link.href = FIVE9_CHATBOT_CSS;\n\n const script = document.createElement('script');\n script.src = FIVE9_CHATBOT_JS;\n script.defer = true;\n\n body.appendChild(link);\n body.appendChild(script);\n setBotLoaded(true);\n }, [isBotLoaded]);\n return null;\n};\n\nexport default HelpChatbot;\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AAEA,MAAME,WAAW,GAAGA,CAAA,KAAM;EACxB,MAAM,CAACC,WAAW,EAAEC,YAAY,CAAC,GAAG,IAAAC,eAAQ,EAAC,KAAK,CAAC;EAEnD,IAAAC,gBAAS,EAAC,MAAM;IACd,IAAIH,WAAW,EAAE;MACf;IACF;IAEA,MAAMI,IAAI,GAAGC,QAAQ,CAACC,oBAAoB,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;IAErDC,MAAM,CAACC,oBAAoB,GAAG,CAAC,CAAC;IAChCD,MAAM,CAACC,oBAAoB,CAACC,QAAQ,GAAGC,eAAS;IAEhD,MAAMC,IAAI,GAAGN,QAAQ,CAACO,aAAa,CAAC,MAAM,CAAC;IAC3CD,IAAI,CAACE,GAAG,GAAG,YAAY;IACvBF,IAAI,CAACG,IAAI,GAAGC,uBAAiB;IAE7B,MAAMC,MAAM,GAAGX,QAAQ,CAACO,aAAa,CAAC,QAAQ,CAAC;IAC/CI,MAAM,CAACC,GAAG,GAAGC,sBAAgB;IAC7BF,MAAM,CAACG,KAAK,GAAG,IAAI;IAEnBf,IAAI,CAACgB,WAAW,CAACT,IAAI,CAAC;IACtBP,IAAI,CAACgB,WAAW,CAACJ,MAAM,CAAC;IACxBf,YAAY,CAAC,IAAI,CAAC;EACpB,CAAC,EAAE,CAACD,WAAW,CAAC,CAAC;EACjB,OAAO,IAAI;AACb,CAAC;AAAC,IAAAqB,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEaxB,WAAW","ignoreList":[]}
|
|
@@ -7,9 +7,12 @@ exports.default = void 0;
|
|
|
7
7
|
var _react = require("react");
|
|
8
8
|
const CohesionWrapper = () => {
|
|
9
9
|
const [isLoaded, setLoaded] = (0, _react.useState)(false);
|
|
10
|
+
|
|
11
|
+
// set pageType value
|
|
12
|
+
window.chsn_pageType = 'lms-homepage';
|
|
10
13
|
(0, _react.useEffect)(() => {
|
|
11
14
|
if (isLoaded) {
|
|
12
|
-
return
|
|
15
|
+
return;
|
|
13
16
|
}
|
|
14
17
|
const head = document.getElementsByTagName('head')[0];
|
|
15
18
|
const script = document.createElement('script');
|
|
@@ -18,7 +21,6 @@ const CohesionWrapper = () => {
|
|
|
18
21
|
script.dataset.testId = 'cohesion-test';
|
|
19
22
|
head.appendChild(script);
|
|
20
23
|
setLoaded(true);
|
|
21
|
-
return null;
|
|
22
24
|
}, [isLoaded]);
|
|
23
25
|
return null;
|
|
24
26
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CohesionWrapper.js","names":["_react","require","CohesionWrapper","isLoaded","setLoaded","useState","useEffect","head","document","getElementsByTagName","script","createElement","src","defer","dataset","testId","appendChild","_default","exports","default"],"sources":["../../src/cohesion-wrapper/CohesionWrapper.jsx"],"sourcesContent":["import { useState, useEffect } from 'react';\n\nconst CohesionWrapper = () => {\n const [isLoaded, setLoaded] = useState(false);\n\n useEffect(() => {\n if (isLoaded) {\n return
|
|
1
|
+
{"version":3,"file":"CohesionWrapper.js","names":["_react","require","CohesionWrapper","isLoaded","setLoaded","useState","window","chsn_pageType","useEffect","head","document","getElementsByTagName","script","createElement","src","defer","dataset","testId","appendChild","_default","exports","default"],"sources":["../../src/cohesion-wrapper/CohesionWrapper.jsx"],"sourcesContent":["import { useState, useEffect } from 'react';\n\nconst CohesionWrapper = () => {\n const [isLoaded, setLoaded] = useState(false);\n\n // set pageType value\n window.chsn_pageType = 'lms-homepage';\n\n useEffect(() => {\n if (isLoaded) {\n return;\n }\n\n const head = document.getElementsByTagName('head')[0];\n const script = document.createElement('script');\n script.src = 'https://www.edx.org/beam-wrapper.js';\n script.defer = true;\n script.dataset.testId = 'cohesion-test';\n head.appendChild(script);\n setLoaded(true);\n }, [isLoaded]);\n\n return null;\n};\n\nexport default CohesionWrapper;\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAEA,MAAMC,eAAe,GAAGA,CAAA,KAAM;EAC5B,MAAM,CAACC,QAAQ,EAAEC,SAAS,CAAC,GAAG,IAAAC,eAAQ,EAAC,KAAK,CAAC;;EAE7C;EACAC,MAAM,CAACC,aAAa,GAAG,cAAc;EAErC,IAAAC,gBAAS,EAAC,MAAM;IACd,IAAIL,QAAQ,EAAE;MACZ;IACF;IAEA,MAAMM,IAAI,GAAGC,QAAQ,CAACC,oBAAoB,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;IACrD,MAAMC,MAAM,GAAGF,QAAQ,CAACG,aAAa,CAAC,QAAQ,CAAC;IAC/CD,MAAM,CAACE,GAAG,GAAG,qCAAqC;IAClDF,MAAM,CAACG,KAAK,GAAG,IAAI;IACnBH,MAAM,CAACI,OAAO,CAACC,MAAM,GAAG,eAAe;IACvCR,IAAI,CAACS,WAAW,CAACN,MAAM,CAAC;IACxBR,SAAS,CAAC,IAAI,CAAC;EACjB,CAAC,EAAE,CAACD,QAAQ,CAAC,CAAC;EAEd,OAAO,IAAI;AACb,CAAC;AAAC,IAAAgB,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEanB,eAAe","ignoreList":[]}
|
|
@@ -17,8 +17,8 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
17
17
|
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
18
18
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
19
19
|
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
20
|
-
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var
|
|
21
|
-
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (e.
|
|
20
|
+
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
|
21
|
+
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
|
22
22
|
const OptimizelyExperimentController = (// Use defaultVariationKey if your experiment is set to target less than 100% of traffic
|
|
23
23
|
// and you have a variation for users not included in the experiment.
|
|
24
24
|
_ref) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Optimizely.js","names":["_propTypes","_interopRequireDefault","require","_auth","_reactSdk","_i18n","_data","_jsxRuntime","_excluded","e","__esModule","default","ownKeys","r","t","Object","keys","getOwnPropertySymbols","o","filter","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty","getOwnPropertyDescriptors","defineProperties","defineProperty","_toPropertyKey","value","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","_objectWithoutProperties","_objectWithoutPropertiesLoose","
|
|
1
|
+
{"version":3,"file":"Optimizely.js","names":["_propTypes","_interopRequireDefault","require","_auth","_reactSdk","_i18n","_data","_jsxRuntime","_excluded","e","__esModule","default","ownKeys","r","t","Object","keys","getOwnPropertySymbols","o","filter","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty","getOwnPropertyDescriptors","defineProperties","defineProperty","_toPropertyKey","value","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","_objectWithoutProperties","_objectWithoutPropertiesLoose","n","indexOf","propertyIsEnumerable","hasOwnProperty","OptimizelyExperimentController","_ref","defaultComponent","DefaultComponent","experimentalComponent","ExperimentalComponent","defaultVariationKey","experimentKey","props","decision","clientReady","useDecision","enabled","variationKey","showDefault","jsx","children","propTypes","PropTypes","elementType","isRequired","string","defaultProps","OptimizelyExperiment","userId","getAuthenticatedUser","optimizely","getOptimizely","OptimizelyProvider","user","id","toString","attributes","lms_language_preference","getLocale","_default","exports"],"sources":["../../src/optimizely/Optimizely.jsx"],"sourcesContent":["import PropTypes from 'prop-types';\nimport { getAuthenticatedUser } from '@edx/frontend-platform/auth';\nimport { OptimizelyProvider, useDecision } from '@optimizely/react-sdk';\n\nimport { getLocale } from '@edx/frontend-platform/i18n';\nimport getOptimizely from '../data';\n\nconst OptimizelyExperimentController = (\n // Use defaultVariationKey if your experiment is set to target less than 100% of traffic\n // and you have a variation for users not included in the experiment.\n {\n defaultComponent: DefaultComponent,\n experimentalComponent: ExperimentalComponent,\n defaultVariationKey,\n experimentKey,\n ...props\n },\n) => {\n const [decision, clientReady] = useDecision(experimentKey);\n const { enabled, variationKey } = decision;\n\n // The useDecision hook will still return a decision even though the ReactSDKClient might not be ready.\n // This `clientReady` will prevent the defaultComponent from appearing when the experiment variation should\n // be rendered.\n\n if (!clientReady) {\n return null;\n }\n\n const showDefault = !enabled || (defaultVariationKey && defaultVariationKey === variationKey);\n\n return (\n <div>\n {showDefault ? <DefaultComponent {...props} /> : <ExperimentalComponent {...props} />}\n </div>\n );\n};\n\nOptimizelyExperimentController.propTypes = {\n defaultComponent: PropTypes.elementType.isRequired,\n experimentalComponent: PropTypes.elementType.isRequired,\n defaultVariationKey: PropTypes.string,\n experimentKey: PropTypes.string.isRequired,\n};\n\nOptimizelyExperimentController.defaultProps = {\n defaultVariationKey: null,\n};\n\nconst OptimizelyExperiment = (props) => {\n const { userId } = getAuthenticatedUser();\n const { defaultComponent: DefaultComponent } = props;\n\n const optimizely = getOptimizely();\n\n return (\n optimizely\n ? (\n // The Optimizely SDK requires the user ID to be a string.\n <OptimizelyProvider\n optimizely={optimizely}\n user={{\n id: userId.toString(),\n attributes: { lms_language_preference: getLocale() },\n }}\n >\n <OptimizelyExperimentController {...props} />\n </OptimizelyProvider>\n )\n : (<DefaultComponent {...props} />)\n );\n};\n\nOptimizelyExperiment.propTypes = {\n defaultComponent: PropTypes.elementType.isRequired,\n};\n\nexport default OptimizelyExperiment;\n"],"mappings":";;;;;;AAAA,IAAAA,UAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAF,OAAA;AAEA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,KAAA,GAAAL,sBAAA,CAAAC,OAAA;AAAoC,IAAAK,WAAA,GAAAL,OAAA;AAAA,MAAAM,SAAA;AAAA,SAAAP,uBAAAQ,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,SAAAG,QAAAH,CAAA,EAAAI,CAAA,QAAAC,CAAA,GAAAC,MAAA,CAAAC,IAAA,CAAAP,CAAA,OAAAM,MAAA,CAAAE,qBAAA,QAAAC,CAAA,GAAAH,MAAA,CAAAE,qBAAA,CAAAR,CAAA,GAAAI,CAAA,KAAAK,CAAA,GAAAA,CAAA,CAAAC,MAAA,WAAAN,CAAA,WAAAE,MAAA,CAAAK,wBAAA,CAAAX,CAAA,EAAAI,CAAA,EAAAQ,UAAA,OAAAP,CAAA,CAAAQ,IAAA,CAAAC,KAAA,CAAAT,CAAA,EAAAI,CAAA,YAAAJ,CAAA;AAAA,SAAAU,cAAAf,CAAA,aAAAI,CAAA,MAAAA,CAAA,GAAAY,SAAA,CAAAC,MAAA,EAAAb,CAAA,UAAAC,CAAA,WAAAW,SAAA,CAAAZ,CAAA,IAAAY,SAAA,CAAAZ,CAAA,QAAAA,CAAA,OAAAD,OAAA,CAAAG,MAAA,CAAAD,CAAA,OAAAa,OAAA,WAAAd,CAAA,IAAAe,eAAA,CAAAnB,CAAA,EAAAI,CAAA,EAAAC,CAAA,CAAAD,CAAA,SAAAE,MAAA,CAAAc,yBAAA,GAAAd,MAA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;AAC1C,CAAC;AAAC,IAAAe,QAAA,GAAAC,OAAA,CAAA3E,OAAA,GAEa8D,oBAAoB","ignoreList":[]}
|
package/dist/package.json
CHANGED
|
@@ -34,33 +34,32 @@
|
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"@optimizely/react-sdk": "^3.2.2",
|
|
37
|
-
"@testing-library/react-hooks": "^8.0.1",
|
|
38
37
|
"jest-environment-jsdom": "^29.7.0",
|
|
39
38
|
"lodash": "^4.17.21",
|
|
40
|
-
"react-dom": "17.0.2",
|
|
41
39
|
"react-redux": "^7.2.4",
|
|
42
40
|
"react-responsive": "^10.0.0",
|
|
43
41
|
"reselect": "^5.1.1"
|
|
44
42
|
},
|
|
45
43
|
"devDependencies": {
|
|
46
44
|
"@edx/browserslist-config": "^1.1.1",
|
|
47
|
-
"@edx/react-unit-test-utils": "^
|
|
45
|
+
"@edx/react-unit-test-utils": "^4.0.0",
|
|
48
46
|
"@edx/reactifex": "^2.1.1",
|
|
49
|
-
"@openedx/frontend-build": "14.
|
|
50
|
-
"@testing-library/jest-dom": "^
|
|
51
|
-
"@testing-library/react": "^
|
|
47
|
+
"@openedx/frontend-build": "14.4.2",
|
|
48
|
+
"@testing-library/jest-dom": "^6.6.3",
|
|
49
|
+
"@testing-library/react": "^16.2.0",
|
|
52
50
|
"jest": "29.7.0",
|
|
53
51
|
"rosie": "2.1.1",
|
|
54
52
|
"semantic-release": "^24.0.0"
|
|
55
53
|
},
|
|
56
54
|
"peerDependencies": {
|
|
57
55
|
"@edx/brand": "npm:@edx/brand-edx.org@^2.1.2",
|
|
58
|
-
"@edx/frontend-platform": "^8.1
|
|
56
|
+
"@edx/frontend-platform": "^8.3.1",
|
|
59
57
|
"@openedx/paragon": "^22.7.0",
|
|
60
58
|
"core-js": "^3.38.1",
|
|
61
59
|
"moment": "^2.30.1",
|
|
62
60
|
"prop-types": "15.8.1",
|
|
63
|
-
"react": "
|
|
61
|
+
"react": "^18.3.1",
|
|
62
|
+
"react-dom": "^18.3.1",
|
|
64
63
|
"regenerator-runtime": "0.14.1"
|
|
65
64
|
}
|
|
66
65
|
}
|
package/dist/tracking/cookie.js
CHANGED
|
@@ -3,42 +3,19 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
return '';
|
|
18
|
-
};
|
|
19
|
-
exports.getCorrelationIDCookie = getCorrelationIDCookie;
|
|
20
|
-
const setCorrelationIDCookie = correlationId => {
|
|
21
|
-
const now = new Date();
|
|
22
|
-
const time = now.getTime();
|
|
23
|
-
|
|
24
|
-
// Cookie expires in 30 minutes, same as when set in marketing page
|
|
25
|
-
const expireTime = time + 1800;
|
|
26
|
-
now.setTime(expireTime);
|
|
27
|
-
document.cookie = `tglr_correlation_id=${correlationId}; expires=${now.toUTCString()}; path=/`;
|
|
28
|
-
};
|
|
29
|
-
exports.setCorrelationIDCookie = setCorrelationIDCookie;
|
|
6
|
+
exports.handleCorrelationIDCookie = void 0;
|
|
7
|
+
exports.setCookie = setCookie;
|
|
8
|
+
// general cookie setter, expires after 30 minutes
|
|
9
|
+
function setCookie(cookieName, cookieValue) {
|
|
10
|
+
const a = new Date();
|
|
11
|
+
// set to expire after 30 minutes, or 1.8 million milliseconds
|
|
12
|
+
a.setTime(a.getTime() + 1800000);
|
|
13
|
+
document.cookie = `${cookieName}\x3d${cookieValue}; expires\x3d${a.toGMTString()}; path\x3d/; domain\x3d.edx.org;`;
|
|
14
|
+
}
|
|
30
15
|
const handleCorrelationIDCookie = () => {
|
|
31
|
-
//
|
|
32
|
-
const
|
|
33
|
-
|
|
34
|
-
const correlationCookie = getCorrelationIDCookie();
|
|
35
|
-
const randomUUID = window.crypto.randomUUID();
|
|
36
|
-
const correlationId = urlParams.get('correlationId') || correlationCookie || randomUUID;
|
|
37
|
-
|
|
38
|
-
// Set CorrelationID cookie if one wasn't set
|
|
39
|
-
if (correlationCookie !== correlationId) {
|
|
40
|
-
setCorrelationIDCookie(correlationId);
|
|
41
|
-
}
|
|
16
|
+
// set correlation ID to a random UUID
|
|
17
|
+
const correlationId = window.crypto.randomUUID();
|
|
18
|
+
setCookie('tglr_correlation_id', correlationId);
|
|
42
19
|
return correlationId;
|
|
43
20
|
};
|
|
44
21
|
exports.handleCorrelationIDCookie = handleCorrelationIDCookie;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cookie.js","names":["
|
|
1
|
+
{"version":3,"file":"cookie.js","names":["setCookie","cookieName","cookieValue","a","Date","setTime","getTime","document","cookie","toGMTString","handleCorrelationIDCookie","correlationId","window","crypto","randomUUID","exports"],"sources":["../../src/tracking/cookie.js"],"sourcesContent":["// general cookie setter, expires after 30 minutes\nexport function setCookie(cookieName, cookieValue) {\n const a = new Date();\n // set to expire after 30 minutes, or 1.8 million milliseconds\n a.setTime(a.getTime() + 1800000);\n document.cookie = `${cookieName}\\x3d${cookieValue}; expires\\x3d${a.toGMTString()}; path\\x3d/; domain\\x3d.edx.org;`;\n}\n\nexport const handleCorrelationIDCookie = () => {\n // set correlation ID to a random UUID\n const correlationId = window.crypto.randomUUID();\n\n setCookie('tglr_correlation_id', correlationId);\n return correlationId;\n};\n"],"mappings":";;;;;;;AAAA;AACO,SAASA,SAASA,CAACC,UAAU,EAAEC,WAAW,EAAE;EACjD,MAAMC,CAAC,GAAG,IAAIC,IAAI,CAAC,CAAC;EACpB;EACAD,CAAC,CAACE,OAAO,CAACF,CAAC,CAACG,OAAO,CAAC,CAAC,GAAG,OAAO,CAAC;EAChCC,QAAQ,CAACC,MAAM,GAAG,GAAGP,UAAU,OAAOC,WAAW,gBAAgBC,CAAC,CAACM,WAAW,CAAC,CAAC,kCAAkC;AACpH;AAEO,MAAMC,yBAAyB,GAAGA,CAAA,KAAM;EAC7C;EACA,MAAMC,aAAa,GAAGC,MAAM,CAACC,MAAM,CAACC,UAAU,CAAC,CAAC;EAEhDd,SAAS,CAAC,qBAAqB,EAAEW,aAAa,CAAC;EAC/C,OAAOA,aAAa;AACtB,CAAC;AAACI,OAAA,CAAAL,yBAAA,GAAAA,yBAAA","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@edx/frontend-plugin-learner-dashboard",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"description": "Repository for Learner Dashboard MFE frontend plugins",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"repository": {
|
|
@@ -34,33 +34,32 @@
|
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"@optimizely/react-sdk": "^3.2.2",
|
|
37
|
-
"@testing-library/react-hooks": "^8.0.1",
|
|
38
37
|
"jest-environment-jsdom": "^29.7.0",
|
|
39
38
|
"lodash": "^4.17.21",
|
|
40
|
-
"react-dom": "17.0.2",
|
|
41
39
|
"react-redux": "^7.2.4",
|
|
42
40
|
"react-responsive": "^10.0.0",
|
|
43
41
|
"reselect": "^5.1.1"
|
|
44
42
|
},
|
|
45
43
|
"devDependencies": {
|
|
46
44
|
"@edx/browserslist-config": "^1.1.1",
|
|
47
|
-
"@edx/react-unit-test-utils": "^
|
|
45
|
+
"@edx/react-unit-test-utils": "^4.0.0",
|
|
48
46
|
"@edx/reactifex": "^2.1.1",
|
|
49
|
-
"@openedx/frontend-build": "14.
|
|
50
|
-
"@testing-library/jest-dom": "^
|
|
51
|
-
"@testing-library/react": "^
|
|
47
|
+
"@openedx/frontend-build": "14.4.2",
|
|
48
|
+
"@testing-library/jest-dom": "^6.6.3",
|
|
49
|
+
"@testing-library/react": "^16.2.0",
|
|
52
50
|
"jest": "29.7.0",
|
|
53
51
|
"rosie": "2.1.1",
|
|
54
52
|
"semantic-release": "^24.0.0"
|
|
55
53
|
},
|
|
56
54
|
"peerDependencies": {
|
|
57
55
|
"@edx/brand": "npm:@edx/brand-edx.org@^2.1.2",
|
|
58
|
-
"@edx/frontend-platform": "^8.1
|
|
56
|
+
"@edx/frontend-platform": "^8.3.1",
|
|
59
57
|
"@openedx/paragon": "^22.7.0",
|
|
60
58
|
"core-js": "^3.38.1",
|
|
61
59
|
"moment": "^2.30.1",
|
|
62
60
|
"prop-types": "15.8.1",
|
|
63
|
-
"react": "
|
|
61
|
+
"react": "^18.3.1",
|
|
62
|
+
"react-dom": "^18.3.1",
|
|
64
63
|
"regenerator-runtime": "0.14.1"
|
|
65
64
|
}
|
|
66
65
|
}
|
|
@@ -6,7 +6,7 @@ const HelpChatbot = () => {
|
|
|
6
6
|
|
|
7
7
|
useEffect(() => {
|
|
8
8
|
if (isBotLoaded) {
|
|
9
|
-
return
|
|
9
|
+
return;
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
const body = document.getElementsByTagName('body')[0];
|
|
@@ -25,8 +25,6 @@ const HelpChatbot = () => {
|
|
|
25
25
|
body.appendChild(link);
|
|
26
26
|
body.appendChild(script);
|
|
27
27
|
setBotLoaded(true);
|
|
28
|
-
|
|
29
|
-
return null;
|
|
30
28
|
}, [isBotLoaded]);
|
|
31
29
|
return null;
|
|
32
30
|
};
|
|
@@ -3,9 +3,12 @@ import { useState, useEffect } from 'react';
|
|
|
3
3
|
const CohesionWrapper = () => {
|
|
4
4
|
const [isLoaded, setLoaded] = useState(false);
|
|
5
5
|
|
|
6
|
+
// set pageType value
|
|
7
|
+
window.chsn_pageType = 'lms-homepage';
|
|
8
|
+
|
|
6
9
|
useEffect(() => {
|
|
7
10
|
if (isLoaded) {
|
|
8
|
-
return
|
|
11
|
+
return;
|
|
9
12
|
}
|
|
10
13
|
|
|
11
14
|
const head = document.getElementsByTagName('head')[0];
|
|
@@ -15,7 +18,6 @@ const CohesionWrapper = () => {
|
|
|
15
18
|
script.dataset.testId = 'cohesion-test';
|
|
16
19
|
head.appendChild(script);
|
|
17
20
|
setLoaded(true);
|
|
18
|
-
return null;
|
|
19
21
|
}, [isLoaded]);
|
|
20
22
|
|
|
21
23
|
return null;
|
|
@@ -10,6 +10,7 @@ describe('Cohesion Wrapper loads', () => {
|
|
|
10
10
|
render(<CohesionWrapper />);
|
|
11
11
|
const script = document.getElementsByTagName('script')[0];
|
|
12
12
|
|
|
13
|
+
expect(window.chsn_pageType).toEqual('lms-homepage');
|
|
13
14
|
expect(script.dataset.testId).toEqual('cohesion-test');
|
|
14
15
|
});
|
|
15
16
|
});
|
|
@@ -26,7 +26,7 @@ describe('EnterpriseDashboardModalWrapper', () => {
|
|
|
26
26
|
const wrapper = shallow(<EnterpriseDashboardModalWrapper />);
|
|
27
27
|
expect(wrapper.snapshot).toMatchSnapshot();
|
|
28
28
|
});
|
|
29
|
-
test('closes properly', () => {
|
|
29
|
+
test('closes properly', async () => {
|
|
30
30
|
useHasAvailableDashboards.mockReturnValue(true);
|
|
31
31
|
const enterpriseDashboardData = { label: 'edX, Inc.', url: '/edx-dashboard' };
|
|
32
32
|
useEnterpriseDashboardData.mockReturnValue(enterpriseDashboardData);
|
|
@@ -34,9 +34,9 @@ describe('EnterpriseDashboardModalWrapper', () => {
|
|
|
34
34
|
expect(screen.getByText(
|
|
35
35
|
'Start exploring the free courses available to you through the edX, Inc. dashboard.',
|
|
36
36
|
)).toBeInTheDocument();
|
|
37
|
-
const dismissButton = screen.
|
|
37
|
+
const dismissButton = await screen.findByText('Dismiss');
|
|
38
38
|
dismissButton.click();
|
|
39
|
-
expect(screen.queryByText(
|
|
39
|
+
expect(await screen.queryByText(
|
|
40
40
|
'Start exploring the free courses available to you through the edX, Inc. dashboard.',
|
|
41
41
|
)).not.toBeInTheDocument();
|
|
42
42
|
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { renderHook } from '@testing-library/react
|
|
1
|
+
import { renderHook } from '@testing-library/react';
|
|
2
2
|
import { MockUseState } from '../../testUtils';
|
|
3
3
|
import { modalCTAClicked } from '../../tracking/trackers/enterpriseDashboardModal';
|
|
4
4
|
import * as hooks from './hooks';
|
package/src/tracking/cookie.js
CHANGED
|
@@ -1,41 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
const
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
if (cookie.indexOf(name) === 0) {
|
|
9
|
-
return cookie.substring(name.length, cookie.length);
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
return '';
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
export const setCorrelationIDCookie = (correlationId) => {
|
|
17
|
-
const now = new Date();
|
|
18
|
-
const time = now.getTime();
|
|
19
|
-
|
|
20
|
-
// Cookie expires in 30 minutes, same as when set in marketing page
|
|
21
|
-
const expireTime = time + 1800;
|
|
22
|
-
now.setTime(expireTime);
|
|
23
|
-
document.cookie = `tglr_correlation_id=${correlationId}; expires=${now.toUTCString()}; path=/`;
|
|
24
|
-
};
|
|
1
|
+
// general cookie setter, expires after 30 minutes
|
|
2
|
+
export function setCookie(cookieName, cookieValue) {
|
|
3
|
+
const a = new Date();
|
|
4
|
+
// set to expire after 30 minutes, or 1.8 million milliseconds
|
|
5
|
+
a.setTime(a.getTime() + 1800000);
|
|
6
|
+
document.cookie = `${cookieName}\x3d${cookieValue}; expires\x3d${a.toGMTString()}; path\x3d/; domain\x3d.edx.org;`;
|
|
7
|
+
}
|
|
25
8
|
|
|
26
9
|
export const handleCorrelationIDCookie = () => {
|
|
27
|
-
//
|
|
28
|
-
const
|
|
29
|
-
const urlParams = new URLSearchParams(queryString);
|
|
30
|
-
const correlationCookie = getCorrelationIDCookie();
|
|
31
|
-
const randomUUID = window.crypto.randomUUID();
|
|
32
|
-
|
|
33
|
-
const correlationId = urlParams.get('correlationId') || correlationCookie || randomUUID;
|
|
34
|
-
|
|
35
|
-
// Set CorrelationID cookie if one wasn't set
|
|
36
|
-
if (correlationCookie !== correlationId) {
|
|
37
|
-
setCorrelationIDCookie(correlationId);
|
|
38
|
-
}
|
|
10
|
+
// set correlation ID to a random UUID
|
|
11
|
+
const correlationId = window.crypto.randomUUID();
|
|
39
12
|
|
|
13
|
+
setCookie('tglr_correlation_id', correlationId);
|
|
40
14
|
return correlationId;
|
|
41
15
|
};
|
|
@@ -12,63 +12,23 @@ describe('cookie functions for Correlation ID', () => {
|
|
|
12
12
|
randomUUID: jest.fn(() => 'mocked-random-uuid'),
|
|
13
13
|
},
|
|
14
14
|
});
|
|
15
|
-
|
|
16
|
-
jest.spyOn(global, 'decodeURIComponent').mockImplementation((val) => val);
|
|
17
15
|
});
|
|
18
16
|
|
|
19
17
|
afterEach(() => {
|
|
20
18
|
jest.restoreAllMocks(); // Restore the original document.cookie
|
|
21
19
|
});
|
|
22
20
|
|
|
23
|
-
describe('
|
|
24
|
-
it('returns the Correlation ID cookie if present', () => {
|
|
25
|
-
document.cookie = 'tglr_correlation_id=some_uuid_string;another_cookie=another_string';
|
|
26
|
-
decodeURIComponent.mockReturnValue(document.cookie);
|
|
27
|
-
|
|
28
|
-
expect(cookieFunctions.getCorrelationIDCookie()).toEqual('some_uuid_string');
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
it('returns an empty string when there is no CorrelationID present', () => {
|
|
32
|
-
document.cookie = 'cookie=string';
|
|
33
|
-
decodeURIComponent.mockReturnValue(document.cookie);
|
|
34
|
-
|
|
35
|
-
expect(cookieFunctions.getCorrelationIDCookie()).toEqual('');
|
|
36
|
-
});
|
|
37
|
-
});
|
|
38
|
-
|
|
39
|
-
describe('setCorrelationIDCookie', () => {
|
|
21
|
+
describe('setCookie', () => {
|
|
40
22
|
it('sets the Correlation ID cookie', () => {
|
|
41
23
|
const correlationCookie = 'some_uuid_string';
|
|
42
|
-
cookieFunctions.
|
|
24
|
+
cookieFunctions.setCookie('tglr_correlation_id', correlationCookie);
|
|
43
25
|
|
|
44
26
|
expect(document.cookie).toContain(`tglr_correlation_id=${correlationCookie}`);
|
|
45
27
|
});
|
|
46
28
|
});
|
|
47
29
|
|
|
48
30
|
describe('handleCorrelationIDCookie', () => {
|
|
49
|
-
it('returns the correlation ID from the URL parameters', () => {
|
|
50
|
-
jest.spyOn(URLSearchParams.prototype, 'get').mockReturnValueOnce('correlation_id_uuid');
|
|
51
|
-
|
|
52
|
-
expect(cookieFunctions.handleCorrelationIDCookie()).toEqual('correlation_id_uuid');
|
|
53
|
-
expect(document.cookie).toContain('tglr_correlation_id=correlation_id_uuid');
|
|
54
|
-
});
|
|
55
|
-
|
|
56
|
-
it('returns the correlation ID from the cookies', () => {
|
|
57
|
-
Object.defineProperty(document, 'cookie', {
|
|
58
|
-
writable: true,
|
|
59
|
-
value: 'tglr_correlation_id=correlation_id_cookie',
|
|
60
|
-
});
|
|
61
|
-
|
|
62
|
-
jest.spyOn(URLSearchParams.prototype, 'get').mockReturnValueOnce('');
|
|
63
|
-
jest.spyOn(cookieFunctions, 'getCorrelationIDCookie').mockImplementation(() => 'correlation_id_cookie');
|
|
64
|
-
|
|
65
|
-
expect(cookieFunctions.handleCorrelationIDCookie()).toEqual('correlation_id_cookie');
|
|
66
|
-
});
|
|
67
|
-
|
|
68
31
|
it('returns the correlation ID provided by a random UUID generator', () => {
|
|
69
|
-
jest.spyOn(URLSearchParams.prototype, 'get').mockReturnValueOnce('');
|
|
70
|
-
jest.spyOn(cookieFunctions, 'getCorrelationIDCookie').mockImplementation(() => '');
|
|
71
|
-
|
|
72
32
|
expect(cookieFunctions.handleCorrelationIDCookie()).toEqual('mocked-random-uuid');
|
|
73
33
|
});
|
|
74
34
|
});
|