@edx/frontend-plugin-learner-dashboard 1.4.3 → 1.4.4
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/README.rst +3 -3
- package/dist/README.rst +3 -3
- package/dist/chatbot/HelpChatbot.js +23 -16
- package/dist/chatbot/HelpChatbot.js.map +1 -1
- package/dist/chatbot/data/five9.js +1 -7
- package/dist/chatbot/data/five9.js.map +1 -1
- package/package.json +1 -1
- package/src/chatbot/HelpChatbot.jsx +32 -16
- package/src/chatbot/{ExperimentHelpChatbot.test.jsx → HelpChatbot.test.jsx} +2 -2
- package/src/chatbot/data/five9.js +0 -9
- package/dist/chatbot/ExperimentHelpChatbot.js +0 -32
- package/dist/chatbot/ExperimentHelpChatbot.js.map +0 -1
- package/src/chatbot/ExperimentHelpChatbot.jsx +0 -34
package/README.rst
CHANGED
|
@@ -35,7 +35,7 @@ Local Development
|
|
|
35
35
|
|
|
36
36
|
Clone this repository into your main workspace folder so it is a sibling of the Learner Dashboard MFE.
|
|
37
37
|
|
|
38
|
-
|
|
38
|
+
To utilize these plugins, you would need to modify the ``env.config.js`` file of Learner Dashboard MFE. If you haven't created one, create one
|
|
39
39
|
in the root that includes the following::
|
|
40
40
|
|
|
41
41
|
// Imports from frontend-plugin-framework
|
|
@@ -74,8 +74,8 @@ developing in to reference the local version of the plugin.::
|
|
|
74
74
|
// Add the below object to the localModules array
|
|
75
75
|
{
|
|
76
76
|
moduleName: '@edx/frontend-plugin-learner-dashboard',
|
|
77
|
-
dir: '../
|
|
78
|
-
dist: '
|
|
77
|
+
dir: '../frontend-plugin-learner-dashboard',
|
|
78
|
+
dist: 'src'
|
|
79
79
|
},
|
|
80
80
|
],
|
|
81
81
|
}
|
package/dist/README.rst
CHANGED
|
@@ -35,7 +35,7 @@ Local Development
|
|
|
35
35
|
|
|
36
36
|
Clone this repository into your main workspace folder so it is a sibling of the Learner Dashboard MFE.
|
|
37
37
|
|
|
38
|
-
|
|
38
|
+
To utilize these plugins, you would need to modify the ``env.config.js`` file of Learner Dashboard MFE. If you haven't created one, create one
|
|
39
39
|
in the root that includes the following::
|
|
40
40
|
|
|
41
41
|
// Imports from frontend-plugin-framework
|
|
@@ -74,8 +74,8 @@ developing in to reference the local version of the plugin.::
|
|
|
74
74
|
// Add the below object to the localModules array
|
|
75
75
|
{
|
|
76
76
|
moduleName: '@edx/frontend-plugin-learner-dashboard',
|
|
77
|
-
dir: '../
|
|
78
|
-
dist: '
|
|
77
|
+
dir: '../frontend-plugin-learner-dashboard',
|
|
78
|
+
dist: 'src'
|
|
79
79
|
},
|
|
80
80
|
],
|
|
81
81
|
}
|
|
@@ -4,22 +4,29 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
var
|
|
8
|
-
var _ExperimentHelpChatbot = _interopRequireDefault(require("./ExperimentHelpChatbot"));
|
|
9
|
-
var _optimizely = _interopRequireDefault(require("../optimizely"));
|
|
7
|
+
var _react = require("react");
|
|
10
8
|
var _five = require("./data/five9");
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
9
|
+
const HelpChatbot = () => {
|
|
10
|
+
const [isBotLoaded, setBotLoaded] = (0, _react.useState)(false);
|
|
11
|
+
(0, _react.useEffect)(() => {
|
|
12
|
+
if (isBotLoaded) {
|
|
13
|
+
return null;
|
|
14
|
+
}
|
|
15
|
+
const body = document.getElementsByTagName('body')[0];
|
|
16
|
+
window.XpertChatbotFrontend = {};
|
|
17
|
+
window.XpertChatbotFrontend.xpertKey = _five.XPERT_KEY;
|
|
18
|
+
const link = document.createElement('link');
|
|
19
|
+
link.rel = 'stylesheet';
|
|
20
|
+
link.href = _five.FIVE9_CHATBOT_CSS;
|
|
21
|
+
const script = document.createElement('script');
|
|
22
|
+
script.src = _five.FIVE9_CHATBOT_JS;
|
|
23
|
+
script.defer = true;
|
|
24
|
+
body.appendChild(link);
|
|
25
|
+
body.appendChild(script);
|
|
26
|
+
setBotLoaded(true);
|
|
27
|
+
return null;
|
|
28
|
+
}, [isBotLoaded]);
|
|
29
|
+
return null;
|
|
30
|
+
};
|
|
24
31
|
var _default = exports.default = HelpChatbot;
|
|
25
32
|
//# sourceMappingURL=HelpChatbot.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HelpChatbot.js","names":["
|
|
1
|
+
{"version":3,"file":"HelpChatbot.js","names":["_react","require","_five","HelpChatbot","isBotLoaded","setBotLoaded","useState","useEffect","body","document","getElementsByTagName","window","XpertChatbotFrontend","xpertKey","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 null;\n }\n\n const body = document.getElementsByTagName('body')[0];\n\n window.XpertChatbotFrontend = {};\n window.XpertChatbotFrontend.xpertKey = 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\n return null;\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,OAAO,IAAI;IACb;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;IAElB,OAAO,IAAI;EACb,CAAC,EAAE,CAACD,WAAW,CAAC,CAAC;EACjB,OAAO,IAAI;AACb,CAAC;AAAC,IAAAqB,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEaxB,WAAW","ignoreList":[]}
|
|
@@ -3,14 +3,8 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.XPERT_KEY = exports.
|
|
6
|
+
exports.XPERT_KEY = exports.FIVE9_CHATBOT_JS = exports.FIVE9_CHATBOT_CSS = void 0;
|
|
7
7
|
const XPERT_KEY = exports.XPERT_KEY = 'edx-global-support';
|
|
8
8
|
const FIVE9_CHATBOT_JS = exports.FIVE9_CHATBOT_JS = 'https://chatbot-frontend.prod.ai.2u.com/@latest/index.min.js';
|
|
9
9
|
const FIVE9_CHATBOT_CSS = exports.FIVE9_CHATBOT_CSS = 'https://chatbot-frontend.prod.ai.2u.com/@latest/index.min.css';
|
|
10
|
-
const OPTIMIZELY_CHATBOT_CHANGE_EXPERIMENT_KEY = exports.OPTIMIZELY_CHATBOT_CHANGE_EXPERIMENT_KEY = '_aper__learner_dashboard_chatbot_experiment';
|
|
11
|
-
const OPTIMIZELY_CHATBOT_CHANGE_EXPERIMENT_VARIATION_KEYS = exports.OPTIMIZELY_CHATBOT_CHANGE_EXPERIMENT_VARIATION_KEYS = {
|
|
12
|
-
ZENDESK_CHATBOT: 'zendesk_chatbot',
|
|
13
|
-
FIVE9_CHATBOT: 'five9_chatbot',
|
|
14
|
-
OFF: 'off'
|
|
15
|
-
};
|
|
16
10
|
//# sourceMappingURL=five9.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"five9.js","names":["XPERT_KEY","exports","FIVE9_CHATBOT_JS","FIVE9_CHATBOT_CSS"
|
|
1
|
+
{"version":3,"file":"five9.js","names":["XPERT_KEY","exports","FIVE9_CHATBOT_JS","FIVE9_CHATBOT_CSS"],"sources":["../../../src/chatbot/data/five9.js"],"sourcesContent":["const XPERT_KEY = 'edx-global-support';\nconst FIVE9_CHATBOT_JS = 'https://chatbot-frontend.prod.ai.2u.com/@latest/index.min.js';\nconst FIVE9_CHATBOT_CSS = 'https://chatbot-frontend.prod.ai.2u.com/@latest/index.min.css';\n\nexport {\n XPERT_KEY,\n FIVE9_CHATBOT_JS,\n FIVE9_CHATBOT_CSS,\n};\n"],"mappings":";;;;;;AAAA,MAAMA,SAAS,GAAAC,OAAA,CAAAD,SAAA,GAAG,oBAAoB;AACtC,MAAME,gBAAgB,GAAAD,OAAA,CAAAC,gBAAA,GAAG,8DAA8D;AACvF,MAAMC,iBAAiB,GAAAF,OAAA,CAAAE,iBAAA,GAAG,+DAA+D","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -1,18 +1,34 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
{
|
|
15
|
-
|
|
16
|
-
|
|
1
|
+
import { useState, useEffect } from 'react';
|
|
2
|
+
import { FIVE9_CHATBOT_CSS, FIVE9_CHATBOT_JS, XPERT_KEY } from './data/five9';
|
|
3
|
+
|
|
4
|
+
const HelpChatbot = () => {
|
|
5
|
+
const [isBotLoaded, setBotLoaded] = useState(false);
|
|
6
|
+
|
|
7
|
+
useEffect(() => {
|
|
8
|
+
if (isBotLoaded) {
|
|
9
|
+
return null;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const body = document.getElementsByTagName('body')[0];
|
|
13
|
+
|
|
14
|
+
window.XpertChatbotFrontend = {};
|
|
15
|
+
window.XpertChatbotFrontend.xpertKey = XPERT_KEY;
|
|
16
|
+
|
|
17
|
+
const link = document.createElement('link');
|
|
18
|
+
link.rel = 'stylesheet';
|
|
19
|
+
link.href = FIVE9_CHATBOT_CSS;
|
|
20
|
+
|
|
21
|
+
const script = document.createElement('script');
|
|
22
|
+
script.src = FIVE9_CHATBOT_JS;
|
|
23
|
+
script.defer = true;
|
|
24
|
+
|
|
25
|
+
body.appendChild(link);
|
|
26
|
+
body.appendChild(script);
|
|
27
|
+
setBotLoaded(true);
|
|
28
|
+
|
|
29
|
+
return null;
|
|
30
|
+
}, [isBotLoaded]);
|
|
31
|
+
return null;
|
|
32
|
+
};
|
|
17
33
|
|
|
18
34
|
export default HelpChatbot;
|
|
@@ -3,14 +3,14 @@ import {
|
|
|
3
3
|
render,
|
|
4
4
|
} from '@testing-library/react';
|
|
5
5
|
|
|
6
|
-
import
|
|
6
|
+
import HelpChatbot from './HelpChatbot';
|
|
7
7
|
import {
|
|
8
8
|
XPERT_KEY,
|
|
9
9
|
} from './data/five9';
|
|
10
10
|
|
|
11
11
|
describe('Five9 Chatbot loads', () => {
|
|
12
12
|
it('should render the xpert chatbot key and scripts', () => {
|
|
13
|
-
render(<
|
|
13
|
+
render(<HelpChatbot />);
|
|
14
14
|
const script = document.getElementsByTagName('script')[0];
|
|
15
15
|
const link = document.getElementsByTagName('link')[0];
|
|
16
16
|
|
|
@@ -2,17 +2,8 @@ const XPERT_KEY = 'edx-global-support';
|
|
|
2
2
|
const FIVE9_CHATBOT_JS = 'https://chatbot-frontend.prod.ai.2u.com/@latest/index.min.js';
|
|
3
3
|
const FIVE9_CHATBOT_CSS = 'https://chatbot-frontend.prod.ai.2u.com/@latest/index.min.css';
|
|
4
4
|
|
|
5
|
-
const OPTIMIZELY_CHATBOT_CHANGE_EXPERIMENT_KEY = '_aper__learner_dashboard_chatbot_experiment';
|
|
6
|
-
const OPTIMIZELY_CHATBOT_CHANGE_EXPERIMENT_VARIATION_KEYS = {
|
|
7
|
-
ZENDESK_CHATBOT: 'zendesk_chatbot',
|
|
8
|
-
FIVE9_CHATBOT: 'five9_chatbot',
|
|
9
|
-
OFF: 'off',
|
|
10
|
-
};
|
|
11
|
-
|
|
12
5
|
export {
|
|
13
6
|
XPERT_KEY,
|
|
14
7
|
FIVE9_CHATBOT_JS,
|
|
15
8
|
FIVE9_CHATBOT_CSS,
|
|
16
|
-
OPTIMIZELY_CHATBOT_CHANGE_EXPERIMENT_KEY,
|
|
17
|
-
OPTIMIZELY_CHATBOT_CHANGE_EXPERIMENT_VARIATION_KEYS,
|
|
18
9
|
};
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
var _react = require("react");
|
|
8
|
-
var _five = require("./data/five9");
|
|
9
|
-
const ExperimentHelpChatbot = () => {
|
|
10
|
-
const [isExperimentBotLoaded, setExperimentBotLoaded] = (0, _react.useState)(false);
|
|
11
|
-
(0, _react.useEffect)(() => {
|
|
12
|
-
if (isExperimentBotLoaded) {
|
|
13
|
-
return null;
|
|
14
|
-
}
|
|
15
|
-
const body = document.getElementsByTagName('body')[0];
|
|
16
|
-
window.XpertChatbotFrontend = {};
|
|
17
|
-
window.XpertChatbotFrontend.xpertKey = _five.XPERT_KEY;
|
|
18
|
-
const link = document.createElement('link');
|
|
19
|
-
link.rel = 'stylesheet';
|
|
20
|
-
link.href = _five.FIVE9_CHATBOT_CSS;
|
|
21
|
-
const script = document.createElement('script');
|
|
22
|
-
script.src = _five.FIVE9_CHATBOT_JS;
|
|
23
|
-
script.defer = true;
|
|
24
|
-
body.appendChild(link);
|
|
25
|
-
body.appendChild(script);
|
|
26
|
-
setExperimentBotLoaded(true);
|
|
27
|
-
return null;
|
|
28
|
-
}, [isExperimentBotLoaded]);
|
|
29
|
-
return null;
|
|
30
|
-
};
|
|
31
|
-
var _default = exports.default = ExperimentHelpChatbot;
|
|
32
|
-
//# sourceMappingURL=ExperimentHelpChatbot.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ExperimentHelpChatbot.js","names":["_react","require","_five","ExperimentHelpChatbot","isExperimentBotLoaded","setExperimentBotLoaded","useState","useEffect","body","document","getElementsByTagName","window","XpertChatbotFrontend","xpertKey","XPERT_KEY","link","createElement","rel","href","FIVE9_CHATBOT_CSS","script","src","FIVE9_CHATBOT_JS","defer","appendChild","_default","exports","default"],"sources":["../../src/chatbot/ExperimentHelpChatbot.jsx"],"sourcesContent":["import { useState, useEffect } from 'react';\nimport { FIVE9_CHATBOT_CSS, FIVE9_CHATBOT_JS, XPERT_KEY } from './data/five9';\n\nconst ExperimentHelpChatbot = () => {\n const [isExperimentBotLoaded, setExperimentBotLoaded] = useState(false);\n\n useEffect(() => {\n if (isExperimentBotLoaded) {\n return null;\n }\n\n const body = document.getElementsByTagName('body')[0];\n\n window.XpertChatbotFrontend = {};\n window.XpertChatbotFrontend.xpertKey = 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 setExperimentBotLoaded(true);\n\n return null;\n }, [isExperimentBotLoaded]);\n return null;\n};\n\nexport default ExperimentHelpChatbot;\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AAEA,MAAME,qBAAqB,GAAGA,CAAA,KAAM;EAClC,MAAM,CAACC,qBAAqB,EAAEC,sBAAsB,CAAC,GAAG,IAAAC,eAAQ,EAAC,KAAK,CAAC;EAEvE,IAAAC,gBAAS,EAAC,MAAM;IACd,IAAIH,qBAAqB,EAAE;MACzB,OAAO,IAAI;IACb;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,sBAAsB,CAAC,IAAI,CAAC;IAE5B,OAAO,IAAI;EACb,CAAC,EAAE,CAACD,qBAAqB,CAAC,CAAC;EAC3B,OAAO,IAAI;AACb,CAAC;AAAC,IAAAqB,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEaxB,qBAAqB","ignoreList":[]}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { useState, useEffect } from 'react';
|
|
2
|
-
import { FIVE9_CHATBOT_CSS, FIVE9_CHATBOT_JS, XPERT_KEY } from './data/five9';
|
|
3
|
-
|
|
4
|
-
const ExperimentHelpChatbot = () => {
|
|
5
|
-
const [isExperimentBotLoaded, setExperimentBotLoaded] = useState(false);
|
|
6
|
-
|
|
7
|
-
useEffect(() => {
|
|
8
|
-
if (isExperimentBotLoaded) {
|
|
9
|
-
return null;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
const body = document.getElementsByTagName('body')[0];
|
|
13
|
-
|
|
14
|
-
window.XpertChatbotFrontend = {};
|
|
15
|
-
window.XpertChatbotFrontend.xpertKey = XPERT_KEY;
|
|
16
|
-
|
|
17
|
-
const link = document.createElement('link');
|
|
18
|
-
link.rel = 'stylesheet';
|
|
19
|
-
link.href = FIVE9_CHATBOT_CSS;
|
|
20
|
-
|
|
21
|
-
const script = document.createElement('script');
|
|
22
|
-
script.src = FIVE9_CHATBOT_JS;
|
|
23
|
-
script.defer = true;
|
|
24
|
-
|
|
25
|
-
body.appendChild(link);
|
|
26
|
-
body.appendChild(script);
|
|
27
|
-
setExperimentBotLoaded(true);
|
|
28
|
-
|
|
29
|
-
return null;
|
|
30
|
-
}, [isExperimentBotLoaded]);
|
|
31
|
-
return null;
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
export default ExperimentHelpChatbot;
|