@edx/frontend-plugin-learner-dashboard 3.4.0 → 4.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/.eslintrc.js +10 -1
- package/.github/workflows/release.yml +7 -0
- package/dist/career-menu/index.js +5 -2
- package/dist/career-menu/index.js.map +1 -1
- package/dist/course-banner/CourseBanner.js +4 -3
- package/dist/course-banner/CourseBanner.js.map +1 -1
- package/dist/course-banner/index.js +1 -25
- package/dist/course-banner/index.js.map +1 -1
- package/dist/dashboard-menu/index.js +5 -4
- package/dist/dashboard-menu/index.js.map +1 -1
- package/dist/dashboard-modal/EnterpriseDashboardModalWrapper.js +5 -2
- package/dist/dashboard-modal/EnterpriseDashboardModalWrapper.js.map +1 -1
- package/dist/dashboard-modal/hooks/hooks.js +6 -3
- package/dist/dashboard-modal/hooks/hooks.js.map +1 -1
- package/dist/dashboard-modal/index.js +1 -21
- package/dist/dashboard-modal/index.js.map +1 -1
- package/dist/index.js +7 -0
- package/dist/index.js.map +1 -1
- package/dist/no-courses-view/index.js +4 -3
- package/dist/no-courses-view/index.js.map +1 -1
- package/dist/package.json +4 -4
- package/dist/progressive-profiling-dashboard/ProgressiveProfilingEntry.js +38 -0
- package/dist/progressive-profiling-dashboard/ProgressiveProfilingEntry.js.map +1 -0
- package/dist/progressive-profiling-dashboard/ProgressiveProfilingModal.js +117 -0
- package/dist/progressive-profiling-dashboard/ProgressiveProfilingModal.js.map +1 -0
- package/dist/progressive-profiling-dashboard/api/service.js +11 -6
- package/dist/progressive-profiling-dashboard/api/service.js.map +1 -1
- package/dist/progressive-profiling-dashboard/data/progressiveProfilingFields.js +2 -37
- package/dist/progressive-profiling-dashboard/data/progressiveProfilingFields.js.map +1 -1
- package/dist/progressive-profiling-dashboard/hooks/useClearProgressiveProfilingQueryParams.js +16 -0
- package/dist/progressive-profiling-dashboard/hooks/useClearProgressiveProfilingQueryParams.js.map +1 -0
- package/dist/progressive-profiling-dashboard/hooks/useProgressiveProfilingForm.js +3 -3
- package/dist/progressive-profiling-dashboard/hooks/useProgressiveProfilingForm.js.map +1 -1
- package/dist/progressive-profiling-dashboard/hooks/useProgressiveProfilingTrigger.js +14 -0
- package/dist/progressive-profiling-dashboard/hooks/useProgressiveProfilingTrigger.js.map +1 -0
- package/dist/progressive-profiling-dashboard/index.js +9 -0
- package/dist/progressive-profiling-dashboard/index.js.map +1 -0
- package/dist/setupTest.js +22 -10
- package/dist/setupTest.js.map +1 -1
- package/dist/tracking/trackers/progressiveProfiling.js +7 -2
- package/dist/tracking/trackers/progressiveProfiling.js.map +1 -1
- package/dist/upgrade-button/UpgradeButton.js +6 -3
- package/dist/upgrade-button/UpgradeButton.js.map +1 -1
- package/dist/upgrade-button/UpgradeButtonWrapper.js +4 -3
- package/dist/upgrade-button/UpgradeButtonWrapper.js.map +1 -1
- package/dist/upgrade-button/data/hooks.js +5 -7
- package/dist/upgrade-button/data/hooks.js.map +1 -1
- package/dist/upgrade-button/index.js +1 -25
- package/dist/upgrade-button/index.js.map +1 -1
- package/package.json +5 -5
- package/src/career-menu/index.jsx +3 -2
- package/src/career-menu/index.test.jsx +11 -6
- package/src/course-banner/CourseBanner.jsx +4 -3
- package/src/course-banner/CourseBanner.test.jsx +8 -14
- package/src/course-banner/index.jsx +1 -20
- package/src/dashboard-menu/index.jsx +3 -2
- package/src/dashboard-menu/index.test.jsx +15 -6
- package/src/dashboard-modal/EnterpriseDashboardModalWrapper.jsx +5 -2
- package/src/dashboard-modal/EnterpriseDashboardModalWrapper.test.jsx +10 -9
- package/src/dashboard-modal/hooks/hooks.js +6 -3
- package/src/dashboard-modal/hooks/hooks.test.js +8 -8
- package/src/dashboard-modal/index.jsx +1 -19
- package/src/index.jsx +2 -0
- package/src/no-courses-view/index.jsx +3 -2
- package/src/no-courses-view/index.test.jsx +8 -6
- package/src/progressive-profiling-dashboard/ProgressiveProfilingEntry.jsx +33 -0
- package/src/progressive-profiling-dashboard/ProgressiveProfilingModal.jsx +110 -0
- package/src/progressive-profiling-dashboard/api/service.js +12 -4
- package/src/progressive-profiling-dashboard/data/progressiveProfilingFields.js +1 -54
- package/src/progressive-profiling-dashboard/hooks/useClearProgressiveProfilingQueryParams.jsx +12 -0
- package/src/progressive-profiling-dashboard/hooks/useProgressiveProfilingForm.jsx +4 -4
- package/src/progressive-profiling-dashboard/hooks/useProgressiveProfilingTrigger.jsx +9 -0
- package/src/progressive-profiling-dashboard/index.jsx +3 -0
- package/src/setupTest.js +20 -8
- package/src/tracking/trackers/progressiveProfiling.js +7 -0
- package/src/upgrade-button/UpgradeButton.jsx +8 -4
- package/src/upgrade-button/UpgradeButton.test.jsx +19 -10
- package/src/upgrade-button/UpgradeButtonWrapper.jsx +5 -3
- package/src/upgrade-button/UpgradeButtonWrapper.test.jsx +9 -11
- package/src/upgrade-button/__snapshots__/UpgradeButton.test.jsx.snap +1 -9
- package/src/upgrade-button/data/hooks.js +5 -5
- package/src/upgrade-button/data/hooks.test.js +5 -0
- package/src/upgrade-button/index.jsx +1 -20
- package/dist/data/redux/app/constants.js +0 -18
- package/dist/data/redux/app/constants.js.map +0 -1
- package/dist/data/redux/app/selectors/courseCard.js +0 -54
- package/dist/data/redux/app/selectors/courseCard.js.map +0 -1
- package/dist/data/redux/app/selectors/simpleSelectors.js +0 -35
- package/dist/data/redux/app/selectors/simpleSelectors.js.map +0 -1
- package/dist/data/redux/hooks.js +0 -49
- package/dist/data/redux/hooks.js.map +0 -1
- package/dist/data/redux/requests/constants.js +0 -16
- package/dist/data/redux/requests/constants.js.map +0 -1
- package/dist/data/redux/requests/selectors.js +0 -61
- package/dist/data/redux/requests/selectors.js.map +0 -1
- package/src/data/redux/app/constants.js +0 -17
- package/src/data/redux/app/selectors/courseCard.js +0 -60
- package/src/data/redux/app/selectors/courseCard.test.js +0 -160
- package/src/data/redux/app/selectors/simpleSelectors.js +0 -26
- package/src/data/redux/app/selectors/simpleSelectors.test.js +0 -54
- package/src/data/redux/hooks.js +0 -44
- package/src/data/redux/requests/constants.js +0 -10
- package/src/data/redux/requests/selectors.js +0 -38
- package/src/data/redux/requests/selectors.test.js +0 -111
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
8
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
|
+
var _frontendPlatform = require("@edx/frontend-platform");
|
|
10
|
+
var _i18n = require("@edx/frontend-platform/i18n");
|
|
11
|
+
var _paragon = require("@openedx/paragon");
|
|
12
|
+
var _fieldRenderer = require("./field-renderer");
|
|
13
|
+
var _useProgressiveProfilingForm = _interopRequireDefault(require("./hooks/useProgressiveProfilingForm"));
|
|
14
|
+
var _constants = require("./utils/constants");
|
|
15
|
+
var _messages = _interopRequireDefault(require("./progressive-profiling-authn-replica/messages"));
|
|
16
|
+
var _progressiveProfiling = require("../tracking/trackers/progressiveProfiling");
|
|
17
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
18
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
19
|
+
const ProgressiveProfilingModal = ({
|
|
20
|
+
isOpen,
|
|
21
|
+
onClose,
|
|
22
|
+
clearTrigger
|
|
23
|
+
}) => {
|
|
24
|
+
const {
|
|
25
|
+
formatMessage
|
|
26
|
+
} = (0, _i18n.useIntl)();
|
|
27
|
+
const {
|
|
28
|
+
loadState,
|
|
29
|
+
submitState,
|
|
30
|
+
error,
|
|
31
|
+
values,
|
|
32
|
+
fieldList,
|
|
33
|
+
onChangeHandler,
|
|
34
|
+
submit
|
|
35
|
+
} = (0, _useProgressiveProfilingForm.default)();
|
|
36
|
+
const handleSubmit = async e => {
|
|
37
|
+
e.preventDefault();
|
|
38
|
+
const success = await submit();
|
|
39
|
+
if (!success) {
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
(0, _progressiveProfiling.trackProgressiveProfilingSubmitClick)({
|
|
43
|
+
isGenderSelected: !!values.gender,
|
|
44
|
+
isLevelOfEducationSelected: !!values.level_of_education,
|
|
45
|
+
host: window.location.origin
|
|
46
|
+
});
|
|
47
|
+
clearTrigger();
|
|
48
|
+
onClose();
|
|
49
|
+
};
|
|
50
|
+
const handleSkip = () => {
|
|
51
|
+
(0, _progressiveProfiling.trackProgressiveProfilingSkipLinkClick)({
|
|
52
|
+
host: window.location.origin
|
|
53
|
+
});
|
|
54
|
+
clearTrigger();
|
|
55
|
+
onClose();
|
|
56
|
+
};
|
|
57
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_paragon.ModalDialog, {
|
|
58
|
+
isOpen: isOpen,
|
|
59
|
+
onClose: () => {},
|
|
60
|
+
hasCloseButton: false,
|
|
61
|
+
size: "md",
|
|
62
|
+
title: formatMessage(_messages.default['progressive.profiling.page.heading']),
|
|
63
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_paragon.ModalDialog.Header, {
|
|
64
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_paragon.ModalDialog.Title, {
|
|
65
|
+
children: formatMessage(_messages.default['progressive.profiling.page.heading'])
|
|
66
|
+
})
|
|
67
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_paragon.ModalDialog.Body, {
|
|
68
|
+
children: [error && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_paragon.Alert, {
|
|
69
|
+
variant: "danger",
|
|
70
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_paragon.Alert.Heading, {
|
|
71
|
+
children: formatMessage(_messages.default['welcome.page.error.heading'])
|
|
72
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
|
|
73
|
+
children: formatMessage(_messages.default['welcome.page.error.message'])
|
|
74
|
+
})]
|
|
75
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_paragon.Form, {
|
|
76
|
+
id: "profileForm",
|
|
77
|
+
onSubmit: handleSubmit,
|
|
78
|
+
children: [fieldList.map(fieldData => /*#__PURE__*/(0, _jsxRuntime.jsx)(_fieldRenderer.FormFieldRenderer, {
|
|
79
|
+
fieldData: fieldData,
|
|
80
|
+
value: values[fieldData.name],
|
|
81
|
+
onChangeHandler: onChangeHandler
|
|
82
|
+
}, fieldData.name)), (0, _frontendPlatform.getConfig)().AUTHN_PROGRESSIVE_PROFILING_SUPPORT_LINK && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
83
|
+
className: "mt-2",
|
|
84
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_paragon.Hyperlink, {
|
|
85
|
+
destination: (0, _frontendPlatform.getConfig)().AUTHN_PROGRESSIVE_PROFILING_SUPPORT_LINK,
|
|
86
|
+
target: "_blank",
|
|
87
|
+
showLaunchIcon: false,
|
|
88
|
+
onClick: () => (0, _progressiveProfiling.trackProgressiveProfilingSupportLinkClick)({
|
|
89
|
+
host: window.location.origin
|
|
90
|
+
}),
|
|
91
|
+
children: formatMessage(_messages.default['optional.fields.information.link'])
|
|
92
|
+
})
|
|
93
|
+
})]
|
|
94
|
+
})]
|
|
95
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_paragon.ModalDialog.Footer, {
|
|
96
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_paragon.Button, {
|
|
97
|
+
variant: "link",
|
|
98
|
+
onClick: handleSkip,
|
|
99
|
+
disabled: submitState === _constants.PENDING_STATE,
|
|
100
|
+
children: formatMessage(_messages.default['optional.fields.skip.button'])
|
|
101
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_paragon.Button, {
|
|
102
|
+
variant: "brand",
|
|
103
|
+
type: "submit",
|
|
104
|
+
form: "profileForm",
|
|
105
|
+
disabled: loadState !== _constants.COMPLETE_STATE || submitState === _constants.PENDING_STATE,
|
|
106
|
+
children: formatMessage(_messages.default['optional.fields.submit.button'])
|
|
107
|
+
})]
|
|
108
|
+
})]
|
|
109
|
+
});
|
|
110
|
+
};
|
|
111
|
+
ProgressiveProfilingModal.propTypes = {
|
|
112
|
+
isOpen: _propTypes.default.bool.isRequired,
|
|
113
|
+
onClose: _propTypes.default.func.isRequired,
|
|
114
|
+
clearTrigger: _propTypes.default.func.isRequired
|
|
115
|
+
};
|
|
116
|
+
var _default = exports.default = ProgressiveProfilingModal;
|
|
117
|
+
//# sourceMappingURL=ProgressiveProfilingModal.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ProgressiveProfilingModal.js","names":["_react","_interopRequireDefault","require","_propTypes","_frontendPlatform","_i18n","_paragon","_fieldRenderer","_useProgressiveProfilingForm","_constants","_messages","_progressiveProfiling","_jsxRuntime","e","__esModule","default","ProgressiveProfilingModal","isOpen","onClose","clearTrigger","formatMessage","useIntl","loadState","submitState","error","values","fieldList","onChangeHandler","submit","useProgressiveProfilingForm","handleSubmit","preventDefault","success","trackProgressiveProfilingSubmitClick","isGenderSelected","gender","isLevelOfEducationSelected","level_of_education","host","window","location","origin","handleSkip","trackProgressiveProfilingSkipLinkClick","jsxs","ModalDialog","hasCloseButton","size","title","messages","children","jsx","Header","Title","Body","Alert","variant","Heading","Form","id","onSubmit","map","fieldData","FormFieldRenderer","value","name","getConfig","AUTHN_PROGRESSIVE_PROFILING_SUPPORT_LINK","className","Hyperlink","destination","target","showLaunchIcon","onClick","trackProgressiveProfilingSupportLinkClick","Footer","Button","disabled","PENDING_STATE","type","form","COMPLETE_STATE","propTypes","PropTypes","bool","isRequired","func","_default","exports"],"sources":["../../src/progressive-profiling-dashboard/ProgressiveProfilingModal.jsx"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport { getConfig } from '@edx/frontend-platform';\nimport { useIntl } from '@edx/frontend-platform/i18n';\nimport {\n Alert, Button, Form, Hyperlink, ModalDialog,\n} from '@openedx/paragon';\n\nimport { FormFieldRenderer } from './field-renderer';\nimport useProgressiveProfilingForm from './hooks/useProgressiveProfilingForm';\nimport { COMPLETE_STATE, PENDING_STATE } from './utils/constants';\nimport messages from './progressive-profiling-authn-replica/messages';\nimport {\n trackProgressiveProfilingSkipLinkClick, trackProgressiveProfilingSubmitClick,\n trackProgressiveProfilingSupportLinkClick,\n} from '../tracking/trackers/progressiveProfiling';\n\nconst ProgressiveProfilingModal = ({\n isOpen, onClose, clearTrigger,\n}) => {\n const { formatMessage } = useIntl();\n const {\n loadState, submitState, error, values, fieldList, onChangeHandler, submit,\n } = useProgressiveProfilingForm();\n\n const handleSubmit = async (e) => {\n e.preventDefault();\n const success = await submit();\n if (!success) { return; }\n\n trackProgressiveProfilingSubmitClick({\n isGenderSelected: !!values.gender,\n isLevelOfEducationSelected: !!values.level_of_education,\n host: window.location.origin,\n });\n\n clearTrigger();\n onClose();\n };\n\n const handleSkip = () => {\n trackProgressiveProfilingSkipLinkClick({ host: window.location.origin });\n clearTrigger();\n onClose();\n };\n\n return (\n <ModalDialog\n isOpen={isOpen}\n onClose={() => {}}\n hasCloseButton={false}\n size=\"md\"\n title={formatMessage(messages['progressive.profiling.page.heading'])}\n >\n <ModalDialog.Header>\n <ModalDialog.Title>\n {formatMessage(messages['progressive.profiling.page.heading'])}\n </ModalDialog.Title>\n </ModalDialog.Header>\n\n <ModalDialog.Body>\n {error && (\n <Alert variant=\"danger\">\n <Alert.Heading>{formatMessage(messages['welcome.page.error.heading'])}</Alert.Heading>\n <p>{formatMessage(messages['welcome.page.error.message'])}</p>\n </Alert>\n )}\n <Form id=\"profileForm\" onSubmit={handleSubmit}>\n {fieldList.map((fieldData) => (\n <FormFieldRenderer\n key={fieldData.name}\n fieldData={fieldData}\n value={values[fieldData.name]}\n onChangeHandler={onChangeHandler}\n />\n ))}\n\n {(getConfig().AUTHN_PROGRESSIVE_PROFILING_SUPPORT_LINK) && (\n <div className=\"mt-2\">\n <Hyperlink\n destination={getConfig().AUTHN_PROGRESSIVE_PROFILING_SUPPORT_LINK}\n target=\"_blank\"\n showLaunchIcon={false}\n onClick={() => trackProgressiveProfilingSupportLinkClick({ host: window.location.origin })}\n >\n {formatMessage(messages['optional.fields.information.link'])}\n </Hyperlink>\n </div>\n )}\n </Form>\n </ModalDialog.Body>\n <ModalDialog.Footer>\n <Button variant=\"link\" onClick={handleSkip} disabled={submitState === PENDING_STATE}>\n {formatMessage(messages['optional.fields.skip.button'])}\n </Button>\n <Button variant=\"brand\" type=\"submit\" form=\"profileForm\" disabled={loadState !== COMPLETE_STATE || submitState === PENDING_STATE}>\n {formatMessage(messages['optional.fields.submit.button'])}\n </Button>\n </ModalDialog.Footer>\n </ModalDialog>\n );\n};\n\nProgressiveProfilingModal.propTypes = {\n isOpen: PropTypes.bool.isRequired,\n onClose: PropTypes.func.isRequired,\n clearTrigger: PropTypes.func.isRequired,\n};\n\nexport default ProgressiveProfilingModal;\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,UAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,iBAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AAIA,IAAAK,cAAA,GAAAL,OAAA;AACA,IAAAM,4BAAA,GAAAP,sBAAA,CAAAC,OAAA;AACA,IAAAO,UAAA,GAAAP,OAAA;AACA,IAAAQ,SAAA,GAAAT,sBAAA,CAAAC,OAAA;AACA,IAAAS,qBAAA,GAAAT,OAAA;AAGmD,IAAAU,WAAA,GAAAV,OAAA;AAAA,SAAAD,uBAAAY,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAEnD,MAAMG,yBAAyB,GAAGA,CAAC;EACjCC,MAAM;EAAEC,OAAO;EAAEC;AACnB,CAAC,KAAK;EACJ,MAAM;IAAEC;EAAc,CAAC,GAAG,IAAAC,aAAO,EAAC,CAAC;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}
|
|
@@ -5,25 +5,30 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.saveProgressiveProfiling = saveProgressiveProfiling;
|
|
7
7
|
var _frontendPlatform = require("@edx/frontend-platform");
|
|
8
|
+
var _auth = require("@edx/frontend-platform/auth");
|
|
8
9
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
9
10
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
10
11
|
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; }
|
|
11
12
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
12
13
|
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); }
|
|
13
|
-
async function saveProgressiveProfiling(
|
|
14
|
-
const payload = _objectSpread(
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
async function saveProgressiveProfiling(values, extendedProfileFieldNames = []) {
|
|
15
|
+
const payload = _objectSpread({}, values);
|
|
16
|
+
const extendedProfile = [];
|
|
17
|
+
const authenticatedUser = (0, _auth.getAuthenticatedUser)();
|
|
18
|
+
const client = (0, _auth.getAuthenticatedHttpClient)();
|
|
17
19
|
extendedProfileFieldNames.forEach(fieldName => {
|
|
18
20
|
if (payload[fieldName] !== undefined && payload[fieldName] !== '') {
|
|
19
|
-
|
|
21
|
+
extendedProfile.push({
|
|
20
22
|
fieldName,
|
|
21
23
|
fieldValue: payload[fieldName]
|
|
22
24
|
});
|
|
23
25
|
}
|
|
24
26
|
delete payload[fieldName];
|
|
25
27
|
});
|
|
26
|
-
|
|
28
|
+
if (extendedProfile.length) {
|
|
29
|
+
payload.extendedProfile = extendedProfile;
|
|
30
|
+
}
|
|
31
|
+
await client.patch(`${(0, _frontendPlatform.getConfig)().LMS_BASE_URL}/api/user/v1/accounts/${authenticatedUser.username}`, (0, _frontendPlatform.snakeCaseObject)(payload), {
|
|
27
32
|
headers: {
|
|
28
33
|
'Content-Type': 'application/merge-patch+json'
|
|
29
34
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"service.js","names":["_frontendPlatform","require","ownKeys","e","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","saveProgressiveProfiling","
|
|
1
|
+
{"version":3,"file":"service.js","names":["_frontendPlatform","require","_auth","ownKeys","e","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","saveProgressiveProfiling","values","extendedProfileFieldNames","payload","extendedProfile","authenticatedUser","getAuthenticatedUser","client","getAuthenticatedHttpClient","fieldName","undefined","fieldValue","patch","getConfig","LMS_BASE_URL","username","snakeCaseObject","headers"],"sources":["../../../src/progressive-profiling-dashboard/api/service.js"],"sourcesContent":["import { getConfig, snakeCaseObject } from '@edx/frontend-platform';\nimport { getAuthenticatedUser, getAuthenticatedHttpClient } from '@edx/frontend-platform/auth';\n\nexport async function saveProgressiveProfiling(values, extendedProfileFieldNames = []) {\n const payload = { ...values };\n const extendedProfile = [];\n const authenticatedUser = getAuthenticatedUser();\n const client = getAuthenticatedHttpClient();\n\n extendedProfileFieldNames.forEach((fieldName) => {\n if (payload[fieldName] !== undefined && payload[fieldName] !== '') {\n extendedProfile.push({\n fieldName,\n fieldValue: payload[fieldName],\n });\n }\n\n delete payload[fieldName];\n });\n\n if (extendedProfile.length) {\n payload.extendedProfile = extendedProfile;\n }\n\n await client.patch(\n `${getConfig().LMS_BASE_URL}/api/user/v1/accounts/${authenticatedUser.username}`,\n snakeCaseObject(payload),\n {\n headers: { 'Content-Type': 'application/merge-patch+json' },\n },\n );\n}\n"],"mappings":";;;;;;AAAA,IAAAA,iBAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AAA+F,SAAAE,QAAAC,CAAA,EAAAC,CAAA,QAAAC,CAAA,GAAAC,MAAA,CAAAC,IAAA,CAAAJ,CAAA,OAAAG,MAAA,CAAAE,qBAAA,QAAAC,CAAA,GAAAH,MAAA,CAAAE,qBAAA,CAAAL,CAAA,GAAAC,CAAA,KAAAK,CAAA,GAAAA,CAAA,CAAAC,MAAA,WAAAN,CAAA,WAAAE,MAAA,CAAAK,wBAAA,CAAAR,CAAA,EAAAC,CAAA,EAAAQ,UAAA,OAAAP,CAAA,CAAAQ,IAAA,CAAAC,KAAA,CAAAT,CAAA,EAAAI,CAAA,YAAAJ,CAAA;AAAA,SAAAU,cAAAZ,CAAA,aAAAC,CAAA,MAAAA,CAAA,GAAAY,SAAA,CAAAC,MAAA,EAAAb,CAAA,UAAAC,CAAA,WAAAW,SAAA,CAAAZ,CAAA,IAAAY,SAAA,CAAAZ,CAAA,QAAAA,CAAA,OAAAF,OAAA,CAAAI,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AvB,aAAA,KAAQqB,MAAM,CAAE;EAC7B,MAAMG,eAAe,GAAG,EAAE;EAC1B,MAAMC,iBAAiB,GAAG,IAAAC,0BAAoB,EAAC,CAAC;EAChD,MAAMC,MAAM,GAAG,IAAAC,gCAA0B,EAAC,CAAC;EAE3CN,yBAAyB,CAACnB,OAAO,CAAE0B,SAAS,IAAK;IAC/C,IAAIN,OAAO,CAACM,SAAS,CAAC,KAAKC,SAAS,IAAIP,OAAO,CAACM,SAAS,CAAC,KAAK,EAAE,EAAE;MACjEL,eAAe,CAAC1B,IAAI,CAAC;QACnB+B,SAAS;QACTE,UAAU,EAAER,OAAO,CAACM,SAAS;MAC/B,CAAC,CAAC;IACJ;IAEA,OAAON,OAAO,CAACM,SAAS,CAAC;EAC3B,CAAC,CAAC;EAEF,IAAIL,eAAe,CAACtB,MAAM,EAAE;IAC1BqB,OAAO,CAACC,eAAe,GAAGA,eAAe;EAC3C;EAEA,MAAMG,MAAM,CAACK,KAAK,CAChB,GAAG,IAAAC,2BAAS,EAAC,CAAC,CAACC,YAAY,yBAAyBT,iBAAiB,CAACU,QAAQ,EAAE,EAChF,IAAAC,iCAAe,EAACb,OAAO,CAAC,EACxB;IACEc,OAAO,EAAE;MAAE,cAAc,EAAE;IAA+B;EAC5D,CACF,CAAC;AACH","ignoreList":[]}
|
|
@@ -3,43 +3,8 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
6
|
+
exports.progressiveProfilingFields = void 0;
|
|
7
7
|
const progressiveProfilingFields = exports.progressiveProfilingFields = {
|
|
8
|
-
fields: {
|
|
9
|
-
gender: {
|
|
10
|
-
name: 'gender',
|
|
11
|
-
type: 'select',
|
|
12
|
-
label: 'Gender',
|
|
13
|
-
options: [['f', 'Female'], ['m', 'Male'], ['o', 'Other']]
|
|
14
|
-
},
|
|
15
|
-
year_of_birth: {
|
|
16
|
-
name: 'year_of_birth',
|
|
17
|
-
type: 'select',
|
|
18
|
-
label: 'Year of Birth',
|
|
19
|
-
options: Array.from({
|
|
20
|
-
length: 100
|
|
21
|
-
}, (_, i) => {
|
|
22
|
-
const year = new Date().getFullYear() - i;
|
|
23
|
-
return [year.toString(), year.toString()];
|
|
24
|
-
})
|
|
25
|
-
},
|
|
26
|
-
level_of_education: {
|
|
27
|
-
name: 'level_of_education',
|
|
28
|
-
type: 'select',
|
|
29
|
-
label: 'Level of Education',
|
|
30
|
-
options: [['p', 'Doctorate'], ['m', 'Master\'s or professional degree'], ['b', 'Bachelor\'s Degree'], ['a', 'Associate Degree'], ['hs', 'Secondary/High School'], ['jhs', 'Junior secondary/junior high/middle school'], ['el', 'Elementary/primary school'], ['none', 'No formal education'], ['other', 'Other education']]
|
|
31
|
-
},
|
|
32
|
-
work_experience: {
|
|
33
|
-
name: 'work_experience',
|
|
34
|
-
type: 'checkbox',
|
|
35
|
-
label: 'Work Experience',
|
|
36
|
-
options: [['0', 'No Experience'], ['1', '1-2 Years'], ['3', '3-5 Years'], ['5', '5+ Years']]
|
|
37
|
-
}
|
|
38
|
-
},
|
|
39
|
-
extendedProfile: ['work_experience'],
|
|
40
|
-
redirectUrl: ''
|
|
41
|
-
};
|
|
42
|
-
const progressiveProfilingFieldsReplica = exports.progressiveProfilingFieldsReplica = {
|
|
43
8
|
fields: {
|
|
44
9
|
gender: {
|
|
45
10
|
name: 'gender',
|
|
@@ -54,7 +19,7 @@ const progressiveProfilingFieldsReplica = exports.progressiveProfilingFieldsRepl
|
|
|
54
19
|
options: [['p', 'Doctorate'], ['m', 'Master\'s or professional degree'], ['b', 'Bachelor\'s Degree'], ['a', 'Associate Degree'], ['hs', 'Secondary/High School'], ['jhs', 'Junior secondary/junior high/middle school'], ['el', 'Elementary/primary school'], ['none', 'No formal education'], ['other', 'Other education']]
|
|
55
20
|
}
|
|
56
21
|
},
|
|
57
|
-
extendedProfile: [
|
|
22
|
+
extendedProfile: [],
|
|
58
23
|
redirectUrl: ''
|
|
59
24
|
};
|
|
60
25
|
//# sourceMappingURL=progressiveProfilingFields.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"progressiveProfilingFields.js","names":["progressiveProfilingFields","exports","fields","gender","name","type","label","options","
|
|
1
|
+
{"version":3,"file":"progressiveProfilingFields.js","names":["progressiveProfilingFields","exports","fields","gender","name","type","label","options","level_of_education","extendedProfile","redirectUrl"],"sources":["../../../src/progressive-profiling-dashboard/data/progressiveProfilingFields.js"],"sourcesContent":["export const progressiveProfilingFields = {\n fields: {\n gender: {\n name: 'gender',\n type: 'select',\n label: 'Gender',\n options: [\n ['f', 'Female'],\n ['m', 'Male'],\n ['o', 'Other'],\n ],\n },\n level_of_education: {\n name: 'level_of_education',\n type: 'select',\n label: 'Level of Education',\n options: [\n ['p', 'Doctorate'],\n ['m', 'Master\\'s or professional degree'],\n ['b', 'Bachelor\\'s Degree'],\n ['a', 'Associate Degree'],\n ['hs', 'Secondary/High School'],\n ['jhs', 'Junior secondary/junior high/middle school'],\n ['el', 'Elementary/primary school'],\n ['none', 'No formal education'],\n ['other', 'Other education'],\n ],\n },\n },\n extendedProfile: [],\n redirectUrl: '',\n};\n"],"mappings":";;;;;;AAAO,MAAMA,0BAA0B,GAAAC,OAAA,CAAAD,0BAAA,GAAG;EACxCE,MAAM,EAAE;IACNC,MAAM,EAAE;MACNC,IAAI,EAAE,QAAQ;MACdC,IAAI,EAAE,QAAQ;MACdC,KAAK,EAAE,QAAQ;MACfC,OAAO,EAAE,CACP,CAAC,GAAG,EAAE,QAAQ,CAAC,EACf,CAAC,GAAG,EAAE,MAAM,CAAC,EACb,CAAC,GAAG,EAAE,OAAO,CAAC;IAElB,CAAC;IACDC,kBAAkB,EAAE;MAClBJ,IAAI,EAAE,oBAAoB;MAC1BC,IAAI,EAAE,QAAQ;MACdC,KAAK,EAAE,oBAAoB;MAC3BC,OAAO,EAAE,CACP,CAAC,GAAG,EAAE,WAAW,CAAC,EAClB,CAAC,GAAG,EAAE,kCAAkC,CAAC,EACzC,CAAC,GAAG,EAAE,oBAAoB,CAAC,EAC3B,CAAC,GAAG,EAAE,kBAAkB,CAAC,EACzB,CAAC,IAAI,EAAE,uBAAuB,CAAC,EAC/B,CAAC,KAAK,EAAE,4CAA4C,CAAC,EACrD,CAAC,IAAI,EAAE,2BAA2B,CAAC,EACnC,CAAC,MAAM,EAAE,qBAAqB,CAAC,EAC/B,CAAC,OAAO,EAAE,iBAAiB,CAAC;IAEhC;EACF,CAAC;EACDE,eAAe,EAAE,EAAE;EACnBC,WAAW,EAAE;AACf,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = useClearProgressiveProfilingQueryParams;
|
|
7
|
+
var _react = require("react");
|
|
8
|
+
var _constants = require("../utils/constants");
|
|
9
|
+
function useClearProgressiveProfilingQueryParams() {
|
|
10
|
+
return (0, _react.useCallback)(() => {
|
|
11
|
+
const currentUrl = new URL(window.location.href);
|
|
12
|
+
currentUrl.searchParams.delete(_constants.PROGRESSIVE_PROFILING_QUERY_PARAM);
|
|
13
|
+
window.history.replaceState({}, '', currentUrl.toString());
|
|
14
|
+
}, []);
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=useClearProgressiveProfilingQueryParams.js.map
|
package/dist/progressive-profiling-dashboard/hooks/useClearProgressiveProfilingQueryParams.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useClearProgressiveProfilingQueryParams.js","names":["_react","require","_constants","useClearProgressiveProfilingQueryParams","useCallback","currentUrl","URL","window","location","href","searchParams","delete","PROGRESSIVE_PROFILING_QUERY_PARAM","history","replaceState","toString"],"sources":["../../../src/progressive-profiling-dashboard/hooks/useClearProgressiveProfilingQueryParams.jsx"],"sourcesContent":["import { useCallback } from 'react';\nimport { PROGRESSIVE_PROFILING_QUERY_PARAM } from '../utils/constants';\n\nexport default function useClearProgressiveProfilingQueryParams() {\n return useCallback(() => {\n const currentUrl = new URL(window.location.href);\n\n currentUrl.searchParams.delete(PROGRESSIVE_PROFILING_QUERY_PARAM);\n\n window.history.replaceState({}, '', currentUrl.toString());\n }, []);\n}\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,UAAA,GAAAD,OAAA;AAEe,SAASE,uCAAuCA,CAAA,EAAG;EAChE,OAAO,IAAAC,kBAAW,EAAC,MAAM;IACvB,MAAMC,UAAU,GAAG,IAAIC,GAAG,CAACC,MAAM,CAACC,QAAQ,CAACC,IAAI,CAAC;IAEhDJ,UAAU,CAACK,YAAY,CAACC,MAAM,CAACC,4CAAiC,CAAC;IAEjEL,MAAM,CAACM,OAAO,CAACC,YAAY,CAAC,CAAC,CAAC,EAAE,EAAE,EAAET,UAAU,CAACU,QAAQ,CAAC,CAAC,CAAC;EAC5D,CAAC,EAAE,EAAE,CAAC;AACR","ignoreList":[]}
|
|
@@ -13,11 +13,11 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
13
13
|
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; }
|
|
14
14
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
15
15
|
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); }
|
|
16
|
-
function useProgressiveProfilingForm(
|
|
16
|
+
function useProgressiveProfilingForm() {
|
|
17
17
|
const [submitState, setSubmitState] = (0, _react.useState)(_constants.DEFAULT_STATE);
|
|
18
18
|
const [error, setError] = (0, _react.useState)(null);
|
|
19
19
|
const [values, setValues] = (0, _react.useState)({});
|
|
20
|
-
const fieldData = _progressiveProfilingFields.
|
|
20
|
+
const fieldData = _progressiveProfilingFields.progressiveProfilingFields;
|
|
21
21
|
const fieldList = (0, _react.useMemo)(() => Object.keys(fieldData.fields).map(key => fieldData.fields[key]), [fieldData]);
|
|
22
22
|
const onChangeHandler = event => {
|
|
23
23
|
const {
|
|
@@ -34,7 +34,7 @@ function useProgressiveProfilingForm(username, client) {
|
|
|
34
34
|
try {
|
|
35
35
|
setSubmitState(_constants.PENDING_STATE);
|
|
36
36
|
setError(null);
|
|
37
|
-
await (0, _service.saveProgressiveProfiling)(
|
|
37
|
+
await (0, _service.saveProgressiveProfiling)(values, fieldData.extendedProfile || []);
|
|
38
38
|
setSubmitState(_constants.COMPLETE_STATE);
|
|
39
39
|
return true;
|
|
40
40
|
} catch (err) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useProgressiveProfilingForm.js","names":["_react","require","_constants","_service","_progressiveProfilingFields","ownKeys","e","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","useProgressiveProfilingForm","
|
|
1
|
+
{"version":3,"file":"useProgressiveProfilingForm.js","names":["_react","require","_constants","_service","_progressiveProfilingFields","ownKeys","e","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","useProgressiveProfilingForm","submitState","setSubmitState","useState","DEFAULT_STATE","error","setError","values","setValues","fieldData","progressiveProfilingFields","fieldList","useMemo","fields","map","key","onChangeHandler","event","name","type","checked","target","prev","submit","PENDING_STATE","saveProgressiveProfiling","extendedProfile","COMPLETE_STATE","err","loadState","redirectUrl","extendedProfileFieldNames"],"sources":["../../../src/progressive-profiling-dashboard/hooks/useProgressiveProfilingForm.jsx"],"sourcesContent":["import { useMemo, useState } from 'react';\nimport {\n COMPLETE_STATE, DEFAULT_STATE, PENDING_STATE,\n} from '../utils/constants';\nimport { saveProgressiveProfiling } from '../api/service';\nimport { progressiveProfilingFields } from '../data/progressiveProfilingFields';\n\nexport default function useProgressiveProfilingForm() {\n const [submitState, setSubmitState] = useState(DEFAULT_STATE);\n const [error, setError] = useState(null);\n const [values, setValues] = useState({});\n\n const fieldData = progressiveProfilingFields;\n\n const fieldList = useMemo(\n () => Object.keys(fieldData.fields).map((key) => fieldData.fields[key]),\n [fieldData],\n );\n\n const onChangeHandler = (event) => {\n const {\n name, type, value, checked,\n } = event.target;\n setValues((prev) => ({\n ...prev,\n [name]: type === 'checkbox' ? checked : value,\n }));\n };\n\n const submit = async () => {\n try {\n setSubmitState(PENDING_STATE);\n setError(null);\n await saveProgressiveProfiling(values, fieldData.extendedProfile || []);\n setSubmitState(COMPLETE_STATE);\n return true;\n } catch (err) {\n setSubmitState(DEFAULT_STATE);\n setError(err);\n return false;\n }\n };\n\n return {\n loadState: COMPLETE_STATE,\n submitState,\n error,\n values,\n fieldList,\n onChangeHandler,\n submit,\n redirectUrl: fieldData.redirectUrl || '',\n extendedProfileFieldNames: fieldData.extendedProfile || [],\n };\n}\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,UAAA,GAAAD,OAAA;AAGA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,2BAAA,GAAAH,OAAA;AAAgF,SAAAI,QAAAC,CAAA,EAAAC,CAAA,QAAAC,CAAA,GAAAC,MAAA,CAAAC,IAAA,CAAAJ,CAAA,OAAAG,MAAA,CAAAE,qBAAA,QAAAC,CAAA,GAAAH,MAAA,CA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I;MACFrB,cAAc,CAACsB,wBAAa,CAAC;MAC7BlB,QAAQ,CAAC,IAAI,CAAC;MACd,MAAM,IAAAmB,iCAAwB,EAAClB,MAAM,EAAEE,SAAS,CAACiB,eAAe,IAAI,EAAE,CAAC;MACvExB,cAAc,CAACyB,yBAAc,CAAC;MAC9B,OAAO,IAAI;IACb,CAAC,CAAC,OAAOC,GAAG,EAAE;MACZ1B,cAAc,CAACE,wBAAa,CAAC;MAC7BE,QAAQ,CAACsB,GAAG,CAAC;MACb,OAAO,KAAK;IACd;EACF,CAAC;EAED,OAAO;IACLC,SAAS,EAAEF,yBAAc;IACzB1B,WAAW;IACXI,KAAK;IACLE,MAAM;IACNI,SAAS;IACTK,eAAe;IACfO,MAAM;IACNO,WAAW,EAAErB,SAAS,CAACqB,WAAW,IAAI,EAAE;IACxCC,yBAAyB,EAAEtB,SAAS,CAACiB,eAAe,IAAI;EAC1D,CAAC;AACH","ignoreList":[]}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = useProgressiveProfilingTrigger;
|
|
7
|
+
var _constants = require("../utils/constants");
|
|
8
|
+
function useProgressiveProfilingTrigger() {
|
|
9
|
+
const params = new URLSearchParams(window.location.search);
|
|
10
|
+
return {
|
|
11
|
+
shouldOpen: params.get(_constants.PROGRESSIVE_PROFILING_QUERY_PARAM) === 'true'
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=useProgressiveProfilingTrigger.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useProgressiveProfilingTrigger.js","names":["_constants","require","useProgressiveProfilingTrigger","params","URLSearchParams","window","location","search","shouldOpen","get","PROGRESSIVE_PROFILING_QUERY_PARAM"],"sources":["../../../src/progressive-profiling-dashboard/hooks/useProgressiveProfilingTrigger.jsx"],"sourcesContent":["import { PROGRESSIVE_PROFILING_QUERY_PARAM } from '../utils/constants';\n\nexport default function useProgressiveProfilingTrigger() {\n const params = new URLSearchParams(window.location.search);\n\n return {\n shouldOpen: params.get(PROGRESSIVE_PROFILING_QUERY_PARAM) === 'true',\n };\n}\n"],"mappings":";;;;;;AAAA,IAAAA,UAAA,GAAAC,OAAA;AAEe,SAASC,8BAA8BA,CAAA,EAAG;EACvD,MAAMC,MAAM,GAAG,IAAIC,eAAe,CAACC,MAAM,CAACC,QAAQ,CAACC,MAAM,CAAC;EAE1D,OAAO;IACLC,UAAU,EAAEL,MAAM,CAACM,GAAG,CAACC,4CAAiC,CAAC,KAAK;EAChE,CAAC;AACH","ignoreList":[]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _ProgressiveProfilingEntry = require("./ProgressiveProfilingEntry");
|
|
8
|
+
var _default = exports.default = _ProgressiveProfilingEntry.ProgressiveProfilingEntry;
|
|
9
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":["_ProgressiveProfilingEntry","require","_default","exports","default","ProgressiveProfilingEntry"],"sources":["../../src/progressive-profiling-dashboard/index.jsx"],"sourcesContent":["import { ProgressiveProfilingEntry } from './ProgressiveProfilingEntry';\n\nexport default ProgressiveProfilingEntry;\n"],"mappings":";;;;;;AAAA,IAAAA,0BAAA,GAAAC,OAAA;AAAwE,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEzDC,oDAAyB","ignoreList":[]}
|
package/dist/setupTest.js
CHANGED
|
@@ -8,6 +8,7 @@ require("@testing-library/jest-dom");
|
|
|
8
8
|
var _react = _interopRequireDefault(require("react"));
|
|
9
9
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
10
10
|
var _react2 = require("@testing-library/react");
|
|
11
|
+
var _reactQuery = require("@tanstack/react-query");
|
|
11
12
|
var _frontendPlatform = require("@edx/frontend-platform");
|
|
12
13
|
var _i18n = require("@edx/frontend-platform/i18n");
|
|
13
14
|
var _logging = require("@edx/frontend-platform/logging");
|
|
@@ -18,8 +19,7 @@ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbol
|
|
|
18
19
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
19
20
|
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; }
|
|
20
21
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
21
|
-
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); }
|
|
22
|
-
// eslint-disable-line import/no-extraneous-dependencies
|
|
22
|
+
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); }
|
|
23
23
|
(0, _frontendPlatform.mergeConfig)(_objectSpread({}, process.env));
|
|
24
24
|
jest.mock('@src/generic/messages', () => jest.fn(() => {}), {
|
|
25
25
|
virtual: true
|
|
@@ -49,14 +49,15 @@ const supressWarningBlock = callback => {
|
|
|
49
49
|
};
|
|
50
50
|
/* eslint-enable no-console */
|
|
51
51
|
|
|
52
|
+
/* eslint-disable no-console */
|
|
52
53
|
class MockLoggingService {
|
|
53
54
|
constructor() {
|
|
54
|
-
// eslint-disable-next-line no-console
|
|
55
55
|
_defineProperty(this, "logInfo", jest.fn(infoString => console.log(infoString)));
|
|
56
|
-
// eslint-disable-next-line no-console
|
|
57
56
|
_defineProperty(this, "logError", jest.fn(errorString => console.log(errorString)));
|
|
58
57
|
}
|
|
59
58
|
}
|
|
59
|
+
/* eslint-enable no-console */
|
|
60
|
+
|
|
60
61
|
const initializeIntl = () => {
|
|
61
62
|
const loggingService = (0, _logging.configure)(MockLoggingService, {
|
|
62
63
|
config: (0, _frontendPlatform.getConfig)()
|
|
@@ -74,15 +75,26 @@ const initializeIntl = () => {
|
|
|
74
75
|
exports.initializeIntl = initializeIntl;
|
|
75
76
|
function render(ui, _ref = {}) {
|
|
76
77
|
let renderOptions = Object.assign({}, (_objectDestructuringEmpty(_ref), _ref));
|
|
78
|
+
const queryClient = new _reactQuery.QueryClient({
|
|
79
|
+
defaultOptions: {
|
|
80
|
+
queries: {
|
|
81
|
+
retry: false
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
/* eslint-disable react/jsx-filename-extension */
|
|
77
87
|
const Wrapper = ({
|
|
78
88
|
children
|
|
79
|
-
}) =>
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
89
|
+
}) => /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactQuery.QueryClientProvider, {
|
|
90
|
+
client: queryClient,
|
|
91
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_i18n.IntlProvider, {
|
|
92
|
+
locale: "en",
|
|
93
|
+
children: children
|
|
94
|
+
})
|
|
85
95
|
});
|
|
96
|
+
/* eslint-enable react/jsx-filename-extension */
|
|
97
|
+
|
|
86
98
|
Wrapper.propTypes = {
|
|
87
99
|
children: _propTypes.default.node.isRequired
|
|
88
100
|
};
|
package/dist/setupTest.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setupTest.js","names":["require","_react","_interopRequireDefault","_propTypes","_react2","_frontendPlatform","_i18n","_logging","_jsxRuntime","e","__esModule","default","_objectDestructuringEmpty","t","TypeError","ownKeys","r","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","String","Number","mergeConfig","process","env","jest","mock","fn","virtual","formatMessage","requireActual","formatDate","date","Date","toLocaleDateString","mockName","useIntl","supressWarningBlock","callback","originalConsoleWarning","console","warn","MockLoggingService","constructor","infoString","log","errorString","initializeIntl","loggingService","configureLogging","config","getConfig","configureI18n","messages","exports","render","ui","_ref","renderOptions","assign","Wrapper","children","jsx","IntlProvider","locale","propTypes","PropTypes","node","isRequired","rtlRender","wrapper","_default"],"sources":["../src/setupTest.js"],"sourcesContent":["import '@testing-library/jest-dom'
|
|
1
|
+
{"version":3,"file":"setupTest.js","names":["require","_react","_interopRequireDefault","_propTypes","_react2","_reactQuery","_frontendPlatform","_i18n","_logging","_jsxRuntime","e","__esModule","default","_objectDestructuringEmpty","t","TypeError","ownKeys","r","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","String","Number","mergeConfig","process","env","jest","mock","fn","virtual","formatMessage","requireActual","formatDate","date","Date","toLocaleDateString","mockName","useIntl","supressWarningBlock","callback","originalConsoleWarning","console","warn","MockLoggingService","constructor","infoString","log","errorString","initializeIntl","loggingService","configureLogging","config","getConfig","configureI18n","messages","exports","render","ui","_ref","renderOptions","assign","queryClient","QueryClient","defaultOptions","queries","retry","Wrapper","children","jsx","QueryClientProvider","client","IntlProvider","locale","propTypes","PropTypes","node","isRequired","rtlRender","wrapper","_default"],"sources":["../src/setupTest.js"],"sourcesContent":["import '@testing-library/jest-dom';\nimport React from 'react';\nimport PropTypes from 'prop-types';\nimport { render as rtlRender } from '@testing-library/react';\nimport { QueryClient, QueryClientProvider } from '@tanstack/react-query';\nimport { getConfig, mergeConfig } from '@edx/frontend-platform';\nimport { configure as configureI18n, IntlProvider } from '@edx/frontend-platform/i18n';\nimport { configure as configureLogging } from '@edx/frontend-platform/logging';\n\nmergeConfig({\n ...process.env,\n});\n\njest.mock('@src/generic/messages', () => jest.fn(() => { }), { virtual: true });\n\n// Mock the `formatMessage` utility from i18n\n// For working with shallow renders in tests via @edx/react-unit-test-utils\njest.mock('@edx/frontend-platform/i18n', () => {\n const { formatMessage } = jest.requireActual('./testUtils');\n const formatDate = jest.fn(date => new Date(date).toLocaleDateString()).mockName('useIntl.formatDate');\n return {\n ...jest.requireActual('@edx/frontend-platform/i18n'),\n useIntl: () => ({\n formatMessage,\n formatDate,\n }),\n };\n});\n\n/* eslint-disable no-console */\nconst supressWarningBlock = (callback) => {\n const originalConsoleWarning = console.warn;\n console.warn = jest.fn();\n callback();\n console.warn = originalConsoleWarning;\n};\n/* eslint-enable no-console */\n\n/* eslint-disable no-console */\nclass MockLoggingService {\n logInfo = jest.fn(infoString => console.log(infoString));\n\n logError = jest.fn(errorString => console.log(errorString));\n}\n/* eslint-enable no-console */\n\nexport const initializeIntl = () => {\n const loggingService = configureLogging(MockLoggingService, {\n config: getConfig(),\n });\n\n // i18n doesn't have a service class to return.\n // ignore missing/unexpect locale warnings from @edx/frontend-platform/i18n\n // it is unnecessary and not relevant to the tests\n supressWarningBlock(() => configureI18n({\n config: getConfig(),\n loggingService,\n messages: [],\n }));\n};\n\nfunction render(\n ui,\n {\n ...renderOptions\n } = {},\n) {\n const queryClient = new QueryClient({\n defaultOptions: {\n queries: {\n retry: false,\n },\n },\n });\n\n /* eslint-disable react/jsx-filename-extension */\n const Wrapper = ({ children }) => (\n <QueryClientProvider client={queryClient}>\n <IntlProvider locale=\"en\">\n {children}\n </IntlProvider>\n </QueryClientProvider>\n );\n /* eslint-enable react/jsx-filename-extension */\n\n Wrapper.propTypes = {\n children: PropTypes.node.isRequired,\n };\n\n return rtlRender(ui, { wrapper: Wrapper, ...renderOptions });\n}\n\nexport default render;\n"],"mappings":";;;;;;AAAAA,OAAA;AACA,IAAAC,MAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,UAAA,GAAAD,sBAAA,CAAAF,OAAA;AACA,IAAAI,OAAA,GAAAJ,OAAA;AACA,IAAAK,WAAA,GAAAL,OAAA;AACA,IAAAM,iBAAA,GAAAN,OAAA;AACA,IAAAO,KAAA,GAAAP,OAAA;AACA,IAAAQ,QAAA,GAAAR,OAAA;AAA+E,IAAAS,WAAA,GAAAT,OAAA;AAAA,SAAAE,uBAAAQ,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,SAAAG,0BAAAC,CAAA,gBAAAA,CAAA,YAAAC,SAAA,yBAAAD,CAAA;AAAA,SAAAE,QAAAN,CAAA,EAAAO,CAAA,QAAAH,CAAA,GAAAI,MAAA,CAAAC,IAAA,CAAAT,CAAA,OAAAQ,MAAA,CAAAE,qBAAA,QAAAC,CAAA,GAAAH,MAAA,CAAAE,qBAAA,CAAAV,CAAA,GAAAO,CAAA,KAAAI,CAAA,GAAAA,CAAA,CAAAC,MAAA,WAAAL,CAAA,WAAAC,MAAA,CAAAK,wBAAA,CAAAb,CAAA,EAAAO,CAAA,EAAAO,UAAA,OAAAV,CAAA,CAAAW,IAAA,CAAAC,KAAA,CAAAZ,CAAA,EAAAO,CAAA,YAAAP,CAAA;AAAA,SAAAa,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9D;AAAC,IAAAoB,QAAA,GAAAxB,OAAA,CAAAlE,OAAA,GAEcmE,MAAM","ignoreList":[]}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.trackProgressiveProfilingSupportLinkClick = exports.trackProgressiveProfilingSubmitClick = exports.trackProgressiveProfilingSkipLinkClick = exports.trackProgressiveProfilingPageViewed = exports.trackDisablePostRegistrationRecommendations = exports.eventNames = void 0;
|
|
6
|
+
exports.trackProgressiveProfilingSupportLinkClick = exports.trackProgressiveProfilingSubmitClick = exports.trackProgressiveProfilingSkipLinkClick = exports.trackProgressiveProfilingQuestionaireModalFormOpened = exports.trackProgressiveProfilingPageViewed = exports.trackDisablePostRegistrationRecommendations = exports.eventNames = void 0;
|
|
7
7
|
var _utils = require("../utils");
|
|
8
8
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
9
9
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
@@ -15,7 +15,8 @@ const eventNames = exports.eventNames = {
|
|
|
15
15
|
progressiveProfilingSkipLinkClick: 'edx.bi.welcome.page.skip.link.clicked',
|
|
16
16
|
disablePostRegistrationRecommendations: 'edx.bi.user.recommendations.not.enabled',
|
|
17
17
|
progressiveProfilingSupportLinkClick: 'edx.bi.welcome.page.support.link.clicked',
|
|
18
|
-
loginAndRegistration: 'login_and_registration'
|
|
18
|
+
loginAndRegistration: 'login_and_registration',
|
|
19
|
+
progressiveProfilingQuestionaireModalFormOpened: 'edx.bi.welcome.page.questionaire.modal.opened'
|
|
19
20
|
};
|
|
20
21
|
|
|
21
22
|
// Event link tracker for Progressive profiling skip button click
|
|
@@ -38,5 +39,9 @@ const trackProgressiveProfilingPageViewed = () => {
|
|
|
38
39
|
// Tracks the progressive profiling support link click.
|
|
39
40
|
exports.trackProgressiveProfilingPageViewed = trackProgressiveProfilingPageViewed;
|
|
40
41
|
const trackProgressiveProfilingSupportLinkClick = () => (0, _utils.createEventTracker)(eventNames.progressiveProfilingSupportLinkClick, {})();
|
|
42
|
+
|
|
43
|
+
// Tracks the progressive profiling modal opened with the questionaire form.
|
|
41
44
|
exports.trackProgressiveProfilingSupportLinkClick = trackProgressiveProfilingSupportLinkClick;
|
|
45
|
+
const trackProgressiveProfilingQuestionaireModalFormOpened = evenProperties => (0, _utils.createEventTracker)(eventNames.progressiveProfilingQuestionaireModalFormOpened, _objectSpread({}, evenProperties))();
|
|
46
|
+
exports.trackProgressiveProfilingQuestionaireModalFormOpened = trackProgressiveProfilingQuestionaireModalFormOpened;
|
|
42
47
|
//# sourceMappingURL=progressiveProfiling.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"progressiveProfiling.js","names":["_utils","require","ownKeys","e","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","eventNames","exports","progressiveProfilingSubmitClick","progressiveProfilingSkipLinkClick","disablePostRegistrationRecommendations","progressiveProfilingSupportLinkClick","loginAndRegistration","trackProgressiveProfilingSkipLinkClick","evenProperties","createEventTracker","trackProgressiveProfilingSubmitClick","trackDisablePostRegistrationRecommendations","trackProgressiveProfilingPageViewed","createPageEventTracker","trackProgressiveProfilingSupportLinkClick"],"sources":["../../../src/tracking/trackers/progressiveProfiling.js"],"sourcesContent":["/* eslint-disable function-paren-newline */\nimport { createEventTracker, createPageEventTracker } from '../utils';\n\nexport const eventNames = {\n progressiveProfilingSubmitClick: 'edx.bi.welcome.page.submit.clicked',\n progressiveProfilingSkipLinkClick: 'edx.bi.welcome.page.skip.link.clicked',\n disablePostRegistrationRecommendations: 'edx.bi.user.recommendations.not.enabled',\n progressiveProfilingSupportLinkClick: 'edx.bi.welcome.page.support.link.clicked',\n loginAndRegistration: 'login_and_registration',\n};\n\n// Event link tracker for Progressive profiling skip button click\nexport const trackProgressiveProfilingSkipLinkClick = evenProperties => createEventTracker(\n eventNames.progressiveProfilingSkipLinkClick, { ...evenProperties },\n)();\n\n// Event tracker for progressive profiling submit button click\nexport const trackProgressiveProfilingSubmitClick = (evenProperties) => createEventTracker(\n eventNames.progressiveProfilingSubmitClick,\n { ...evenProperties },\n)();\n\n// Event tracker for progressive profiling submit button click\nexport const trackDisablePostRegistrationRecommendations = (evenProperties) => createEventTracker(\n eventNames.disablePostRegistrationRecommendations,\n { ...evenProperties },\n)();\n\n// Tracks the progressive profiling page event.\nexport const trackProgressiveProfilingPageViewed = () => {\n createPageEventTracker(eventNames.loginAndRegistration, 'welcome')();\n};\n\n// Tracks the progressive profiling support link click.\nexport const trackProgressiveProfilingSupportLinkClick = () => createEventTracker(\n eventNames.progressiveProfilingSupportLinkClick,\n {},\n)();\n"],"mappings":";;;;;;AACA,IAAAA,MAAA,GAAAC,OAAA;AAAsE,SAAAC,QAAAC,CAAA,EAAAC,CAAA,QAAAC,CAAA,GAAAC,MAAA,CAAAC,IAAA,CAAAJ,CAAA,OAAAG,MAAA,CAAAE,qBAAA,QAAAC,CAAA,GAAAH,MAAA,CAAAE,qBAAA,CAAAL,CAAA,GAAAC,CAAA,KAAAK,CAAA,GAAAA,CAAA,CAAAC,MAAA,WAAAN,CAAA,WAAAE,MAAA,CAAAK,wBAA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,GAAAE,CAAA,CAAAwB,MAAA,CAAAC,WAAA,kBAAA3B,CAAA,QAAAwB,CAAA,GAAAxB,CAAA,CAAA4B,IAAA,CAAA1B,CAAA,EAAAD,CAAA,uCAAAuB,CAAA,SAAAA,CAAA,YAAAK,SAAA,yEAAA5B,CAAA,GAAA6B,MAAA,GAAAC,MAAA,EAAA7B,CAAA,KADtE;AAGO,MAAM8B,UAAU,GAAAC,OAAA,CAAAD,UAAA,GAAG;EACxBE,+BAA+B,EAAE,oCAAoC;EACrEC,iCAAiC,EAAE,uCAAuC;EAC1EC,sCAAsC,EAAE,yCAAyC;EACjFC,oCAAoC,EAAE,0CAA0C;EAChFC,oBAAoB,EAAE;
|
|
1
|
+
{"version":3,"file":"progressiveProfiling.js","names":["_utils","require","ownKeys","e","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","eventNames","exports","progressiveProfilingSubmitClick","progressiveProfilingSkipLinkClick","disablePostRegistrationRecommendations","progressiveProfilingSupportLinkClick","loginAndRegistration","progressiveProfilingQuestionaireModalFormOpened","trackProgressiveProfilingSkipLinkClick","evenProperties","createEventTracker","trackProgressiveProfilingSubmitClick","trackDisablePostRegistrationRecommendations","trackProgressiveProfilingPageViewed","createPageEventTracker","trackProgressiveProfilingSupportLinkClick","trackProgressiveProfilingQuestionaireModalFormOpened"],"sources":["../../../src/tracking/trackers/progressiveProfiling.js"],"sourcesContent":["/* eslint-disable function-paren-newline */\nimport { createEventTracker, createPageEventTracker } from '../utils';\n\nexport const eventNames = {\n progressiveProfilingSubmitClick: 'edx.bi.welcome.page.submit.clicked',\n progressiveProfilingSkipLinkClick: 'edx.bi.welcome.page.skip.link.clicked',\n disablePostRegistrationRecommendations: 'edx.bi.user.recommendations.not.enabled',\n progressiveProfilingSupportLinkClick: 'edx.bi.welcome.page.support.link.clicked',\n loginAndRegistration: 'login_and_registration',\n progressiveProfilingQuestionaireModalFormOpened: 'edx.bi.welcome.page.questionaire.modal.opened',\n};\n\n// Event link tracker for Progressive profiling skip button click\nexport const trackProgressiveProfilingSkipLinkClick = evenProperties => createEventTracker(\n eventNames.progressiveProfilingSkipLinkClick, { ...evenProperties },\n)();\n\n// Event tracker for progressive profiling submit button click\nexport const trackProgressiveProfilingSubmitClick = (evenProperties) => createEventTracker(\n eventNames.progressiveProfilingSubmitClick,\n { ...evenProperties },\n)();\n\n// Event tracker for progressive profiling submit button click\nexport const trackDisablePostRegistrationRecommendations = (evenProperties) => createEventTracker(\n eventNames.disablePostRegistrationRecommendations,\n { ...evenProperties },\n)();\n\n// Tracks the progressive profiling page event.\nexport const trackProgressiveProfilingPageViewed = () => {\n createPageEventTracker(eventNames.loginAndRegistration, 'welcome')();\n};\n\n// Tracks the progressive profiling support link click.\nexport const trackProgressiveProfilingSupportLinkClick = () => createEventTracker(\n eventNames.progressiveProfilingSupportLinkClick,\n {},\n)();\n\n// Tracks the progressive profiling modal opened with the questionaire form.\nexport const trackProgressiveProfilingQuestionaireModalFormOpened = (evenProperties) => createEventTracker(\n eventNames.progressiveProfilingQuestionaireModalFormOpened,\n { ...evenProperties },\n)();\n"],"mappings":";;;;;;AACA,IAAAA,MAAA,GAAAC,OAAA;AAAsE,SAAAC,QAAAC,CAAA,EAAAC,CAAA,QAAAC,CAAA,GAAAC,MAAA,CAAAC,IAAA,CAAAJ,CAAA,OAAAG,MAAA,CAAAE,qBAAA,QAAAC,CAAA,GAAAH,MAAA,CAAAE,qBAAA,CAAAL,CAAA,GAAAC,CAAA,KAAAK,CAAA,GAAAA,CAAA,CAAAC,MAAA,WAAAN,CAAA,WAAAE,MAAA,CAAAK,wBAAA,CAAAR,CAAA,EAAAC,CAAA,EAAAQ,UAAA,OAAAP,CAAA,CAAAQ,IAAA,CAAAC,KAAA,CAAAT,CAAA,E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AAC;;AAEH;AAAAJ,OAAA,CAAAc,yCAAA,GAAAA,yCAAA;AACO,MAAMC,oDAAoD,GAAIP,cAAc,IAAK,IAAAC,yBAAkB,EACxGV,UAAU,CAACO,+CAA+C,EAAA3B,aAAA,KACrD6B,cAAc,CACrB,CAAC,CAAC,CAAC;AAACR,OAAA,CAAAe,oDAAA,GAAAA,oDAAA","ignoreList":[]}
|
|
@@ -9,8 +9,8 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
|
9
9
|
var _i18n = require("@edx/frontend-platform/i18n");
|
|
10
10
|
var _paragon = require("@openedx/paragon");
|
|
11
11
|
var _icons = require("@openedx/paragon/icons");
|
|
12
|
+
var _hooks = require("hooks");
|
|
12
13
|
var _upgradeButton = require("../tracking/trackers/upgradeButton");
|
|
13
|
-
var _hooks = _interopRequireDefault(require("../data/redux/hooks"));
|
|
14
14
|
var _hooks2 = require("./data/hooks");
|
|
15
15
|
var _messages = _interopRequireDefault(require("./messages"));
|
|
16
16
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
@@ -26,13 +26,16 @@ const UpgradeButton = ({
|
|
|
26
26
|
const {
|
|
27
27
|
formatMessage
|
|
28
28
|
} = (0, _i18n.useIntl)();
|
|
29
|
+
const courseRun = (0, _hooks.useCourseData)(cardId)?.courseRun || {};
|
|
29
30
|
const {
|
|
30
31
|
upgradeUrl
|
|
31
|
-
} =
|
|
32
|
+
} = courseRun;
|
|
33
|
+
const org = courseRun.org || '';
|
|
34
|
+
const courseName = courseRun.title || '';
|
|
32
35
|
const {
|
|
33
36
|
disableUpgradeCourse
|
|
34
37
|
} = (0, _hooks2.useActionDisabledState)(cardId);
|
|
35
|
-
const trackUpgradeClick = _hooks.
|
|
38
|
+
const trackUpgradeClick = (0, _hooks.useCourseTrackingEvent)(_upgradeButton.upgradeClicked, cardId, org, courseName, upgradeUrl);
|
|
36
39
|
const isSmall = (0, _hooks2.useIsCollapsed)();
|
|
37
40
|
const enabledProps = {
|
|
38
41
|
as: 'a',
|