@edx/frontend-plugin-learner-dashboard 3.4.0 → 3.5.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/index.js +7 -0
- package/dist/index.js.map +1 -1
- 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/tracking/trackers/progressiveProfiling.js +7 -2
- package/dist/tracking/trackers/progressiveProfiling.js.map +1 -1
- package/package.json +1 -1
- package/src/index.jsx +2 -0
- 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/tracking/trackers/progressiveProfiling.js +7 -0
package/dist/index.js
CHANGED
|
@@ -51,6 +51,12 @@ Object.defineProperty(exports, "ProgressiveProfiling", {
|
|
|
51
51
|
return _progressiveProfilingAuthnReplica.ProgressiveProfiling;
|
|
52
52
|
}
|
|
53
53
|
});
|
|
54
|
+
Object.defineProperty(exports, "ProgressiveProfilingEntry", {
|
|
55
|
+
enumerable: true,
|
|
56
|
+
get: function () {
|
|
57
|
+
return _progressiveProfilingDashboard.default;
|
|
58
|
+
}
|
|
59
|
+
});
|
|
54
60
|
Object.defineProperty(exports, "UclWrapper", {
|
|
55
61
|
enumerable: true,
|
|
56
62
|
get: function () {
|
|
@@ -86,6 +92,7 @@ var _index4 = _interopRequireDefault(require("./notices-redirect/index"));
|
|
|
86
92
|
var _upgradeButton = _interopRequireDefault(require("./upgrade-button"));
|
|
87
93
|
var _index5 = _interopRequireDefault(require("./career-menu/index"));
|
|
88
94
|
var _index6 = _interopRequireDefault(require("./dashboard-menu/index"));
|
|
95
|
+
var _progressiveProfilingDashboard = _interopRequireDefault(require("./progressive-profiling-dashboard"));
|
|
89
96
|
var _progressiveProfilingAuthnReplica = require("./progressive-profiling-dashboard/progressive-profiling-authn-replica");
|
|
90
97
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
91
98
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["_index","_interopRequireDefault","require","_courseBanner","_dynamicExperienceSlot","_index2","_index3","_uclWrapper","_noCoursesView","_index4","_upgradeButton","_index5","_index6","_progressiveProfilingAuthnReplica","e","__esModule","default"],"sources":["../src/index.jsx"],"sourcesContent":["import CohesionWrapper from './cohesion-wrapper/index';\nimport CourseBanner from './course-banner';\nimport DynamicExperienceSlot from './dynamic-experience-slot';\nimport EnterpriseDashboardModal from './dashboard-modal/index';\nimport HelpChatbot from './chatbot/index';\nimport UclWrapper from './ucl-wrapper';\nimport NoCoursesView from './no-courses-view';\nimport NoticesRedirect from './notices-redirect/index';\nimport UpgradeButton from './upgrade-button';\nimport UserCareerMenu from './career-menu/index';\nimport UserDashboardMenu from './dashboard-menu/index';\nimport { ProgressiveProfiling } from './progressive-profiling-dashboard/progressive-profiling-authn-replica';\n\nexport {\n CohesionWrapper,\n CourseBanner,\n DynamicExperienceSlot,\n EnterpriseDashboardModal,\n HelpChatbot,\n NoCoursesView,\n NoticesRedirect,\n UclWrapper,\n UpgradeButton,\n UserCareerMenu,\n UserDashboardMenu,\n ProgressiveProfiling,\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","names":["_index","_interopRequireDefault","require","_courseBanner","_dynamicExperienceSlot","_index2","_index3","_uclWrapper","_noCoursesView","_index4","_upgradeButton","_index5","_index6","_progressiveProfilingDashboard","_progressiveProfilingAuthnReplica","e","__esModule","default"],"sources":["../src/index.jsx"],"sourcesContent":["import CohesionWrapper from './cohesion-wrapper/index';\nimport CourseBanner from './course-banner';\nimport DynamicExperienceSlot from './dynamic-experience-slot';\nimport EnterpriseDashboardModal from './dashboard-modal/index';\nimport HelpChatbot from './chatbot/index';\nimport UclWrapper from './ucl-wrapper';\nimport NoCoursesView from './no-courses-view';\nimport NoticesRedirect from './notices-redirect/index';\nimport UpgradeButton from './upgrade-button';\nimport UserCareerMenu from './career-menu/index';\nimport UserDashboardMenu from './dashboard-menu/index';\nimport ProgressiveProfilingEntry from './progressive-profiling-dashboard';\nimport { ProgressiveProfiling } from './progressive-profiling-dashboard/progressive-profiling-authn-replica';\n\nexport {\n CohesionWrapper,\n CourseBanner,\n DynamicExperienceSlot,\n EnterpriseDashboardModal,\n HelpChatbot,\n NoCoursesView,\n NoticesRedirect,\n UclWrapper,\n UpgradeButton,\n UserCareerMenu,\n UserDashboardMenu,\n ProgressiveProfilingEntry,\n ProgressiveProfiling,\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,aAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,sBAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,OAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,OAAA,GAAAL,sBAAA,CAAAC,OAAA;AACA,IAAAK,WAAA,GAAAN,sBAAA,CAAAC,OAAA;AACA,IAAAM,cAAA,GAAAP,sBAAA,CAAAC,OAAA;AACA,IAAAO,OAAA,GAAAR,sBAAA,CAAAC,OAAA;AACA,IAAAQ,cAAA,GAAAT,sBAAA,CAAAC,OAAA;AACA,IAAAS,OAAA,GAAAV,sBAAA,CAAAC,OAAA;AACA,IAAAU,OAAA,GAAAX,sBAAA,CAAAC,OAAA;AACA,IAAAW,8BAAA,GAAAZ,sBAAA,CAAAC,OAAA;AACA,IAAAY,iCAAA,GAAAZ,OAAA;AAA6G,SAAAD,uBAAAc,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA","ignoreList":[]}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.ProgressiveProfilingEntry = void 0;
|
|
7
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
+
var _auth = require("@edx/frontend-platform/auth");
|
|
9
|
+
var _ProgressiveProfilingModal = _interopRequireDefault(require("./ProgressiveProfilingModal"));
|
|
10
|
+
var _useProgressiveProfilingTrigger = _interopRequireDefault(require("./hooks/useProgressiveProfilingTrigger"));
|
|
11
|
+
var _useClearProgressiveProfilingQueryParams = _interopRequireDefault(require("./hooks/useClearProgressiveProfilingQueryParams"));
|
|
12
|
+
var _progressiveProfiling = require("../tracking/trackers/progressiveProfiling");
|
|
13
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
14
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
15
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
16
|
+
const ProgressiveProfilingEntry = () => {
|
|
17
|
+
const [isOpen, setIsOpen] = (0, _react.useState)(false);
|
|
18
|
+
const username = (0, _auth.getAuthenticatedUser)()?.username;
|
|
19
|
+
const {
|
|
20
|
+
shouldOpen
|
|
21
|
+
} = (0, _useProgressiveProfilingTrigger.default)();
|
|
22
|
+
const clearTrigger = (0, _useClearProgressiveProfilingQueryParams.default)();
|
|
23
|
+
(0, _react.useEffect)(() => {
|
|
24
|
+
if (shouldOpen && username) {
|
|
25
|
+
setIsOpen(true);
|
|
26
|
+
(0, _progressiveProfiling.trackProgressiveProfilingQuestionaireModalFormOpened)({
|
|
27
|
+
host: window.location.origin
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
}, [shouldOpen, username]);
|
|
31
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_ProgressiveProfilingModal.default, {
|
|
32
|
+
isOpen: isOpen,
|
|
33
|
+
onClose: () => setIsOpen(false),
|
|
34
|
+
clearTrigger: clearTrigger
|
|
35
|
+
});
|
|
36
|
+
};
|
|
37
|
+
exports.ProgressiveProfilingEntry = ProgressiveProfilingEntry;
|
|
38
|
+
//# sourceMappingURL=ProgressiveProfilingEntry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ProgressiveProfilingEntry.js","names":["_react","_interopRequireWildcard","require","_auth","_ProgressiveProfilingModal","_interopRequireDefault","_useProgressiveProfilingTrigger","_useClearProgressiveProfilingQueryParams","_progressiveProfiling","_jsxRuntime","e","__esModule","default","t","WeakMap","r","n","o","i","f","__proto__","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","ProgressiveProfilingEntry","isOpen","setIsOpen","useState","username","getAuthenticatedUser","shouldOpen","useProgressiveProfilingTrigger","clearTrigger","useClearProgressiveProfilingQueryParams","useEffect","trackProgressiveProfilingQuestionaireModalFormOpened","host","window","location","origin","jsx","onClose","exports"],"sources":["../../src/progressive-profiling-dashboard/ProgressiveProfilingEntry.jsx"],"sourcesContent":["import React, { useEffect, useState } from 'react';\nimport { getAuthenticatedUser } from '@edx/frontend-platform/auth';\n\nimport ProgressiveProfilingModal from './ProgressiveProfilingModal';\nimport useProgressiveProfilingTrigger from './hooks/useProgressiveProfilingTrigger';\nimport useClearProgressiveProfilingQueryParams from './hooks/useClearProgressiveProfilingQueryParams';\nimport { trackProgressiveProfilingQuestionaireModalFormOpened } from '../tracking/trackers/progressiveProfiling';\n\nconst ProgressiveProfilingEntry = () => {\n const [isOpen, setIsOpen] = useState(false);\n\n const username = getAuthenticatedUser()?.username;\n\n const { shouldOpen } = useProgressiveProfilingTrigger();\n const clearTrigger = useClearProgressiveProfilingQueryParams();\n\n useEffect(() => {\n if (shouldOpen && username) {\n setIsOpen(true);\n trackProgressiveProfilingQuestionaireModalFormOpened({ host: window.location.origin });\n }\n }, [shouldOpen, username]);\n\n return (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
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;EACnC,MAAM;IACJC,SAAS;IAAEC,WAAW;IAAEC,KAAK;IAAEC,MAAM;IAAEC,SAAS;IAAEC,eAAe;IAAEC;EACrE,CAAC,GAAG,IAAAC,oCAA2B,EAAC,CAAC;EAEjC,MAAMC,YAAY,GAAG,MAAOjB,CAAC,IAAK;IAChCA,CAAC,CAACkB,cAAc,CAAC,CAAC;IAClB,MAAMC,OA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AAA,CACG,CAAC;IAAA,CACS,CAAC,eACnB,IAAArC,WAAA,CAAAgC,IAAA,EAACtC,QAAA,CAAAuC,WAAW,CAAC8B,MAAM;MAAAzB,QAAA,gBACjB,IAAAtC,WAAA,CAAAuC,GAAA,EAAC7C,QAAA,CAAAsE,MAAM;QAACpB,OAAO,EAAC,MAAM;QAACiB,OAAO,EAAE/B,UAAW;QAACmC,QAAQ,EAAEtD,WAAW,KAAKuD,wBAAc;QAAA5B,QAAA,EACjF9B,aAAa,CAAC6B,iBAAQ,CAAC,6BAA6B,CAAC;MAAC,CACjD,CAAC,eACT,IAAArC,WAAA,CAAAuC,GAAA,EAAC7C,QAAA,CAAAsE,MAAM;QAACpB,OAAO,EAAC,OAAO;QAACuB,IAAI,EAAC,QAAQ;QAACC,IAAI,EAAC,aAAa;QAACH,QAAQ,EAAEvD,SAAS,KAAK2D,yBAAc,IAAI1D,WAAW,KAAKuD,wBAAc;QAAA5B,QAAA,EAC9H9B,aAAa,CAAC6B,iBAAQ,CAAC,+BAA+B,CAAC;MAAC,CACnD,CAAC;IAAA,CACS,CAAC;EAAA,CACV,CAAC;AAElB,CAAC;AAEDjC,yBAAyB,CAACkE,SAAS,GAAG;EACpCjE,MAAM,EAAEkE,kBAAS,CAACC,IAAI,CAACC,UAAU;EACjCnE,OAAO,EAAEiE,kBAAS,CAACG,IAAI,CAACD,UAAU;EAClClE,YAAY,EAAEgE,kBAAS,CAACG,IAAI,CAACD;AAC/B,CAAC;AAAC,IAAAE,QAAA,GAAAC,OAAA,CAAAzE,OAAA,GAEaC,yBAAyB","ignoreList":[]}
|
|
@@ -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,MAAA,CAAAD,CAAA,OAAAa,OAAA,WAAAd,CAAA,IAAAe,eAAA,CAAAhB,CAAA,EAAAC,CAAA,EAAAC,CAAA,CAAAD,CAAA,SAAAE,MAAA,CAAAc,yBAAA,GAAAd,MAAA,CAAAe,gBAAA,CAAAlB,CAAA,EAAAG,MAAA,CAAAc,yBAAA,CAAAf,CAAA,KAAAH,OAAA,CAAAI,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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,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;AA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;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":[]}
|
|
@@ -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,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,MAAA,CAAAD,CAAA,OAAAa,OAAA,WAAAd,CAAA,IAAAe,eAAA,CAAAhB,CAAA,EAAAC,CAAA,EAAAC,CAAA,CAAAD,CAAA,SAAAE,MAAA,CAAAc,yBAAA,GAAAd,MAAA,CA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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,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,MAAA,CAAAD,CAAA,OAAAa,OAAA,WAAAd,CAAA,IAAAe,eAAA,CAAAhB,CAAA,EAAAC,CAAA,EAAAC,CAAA,CAAAD,CAAA,SAAAE,MAAA,CAAAc,yBAAA,GAAAd,MAAA,CAAAe,gBAAA,CAAAlB,CAAA,EAAAG,MAAA,CAAAc,yBAAA,CAAAf,CAAA,KAAAH,OAAA,CAAAI,MAAA,CAAA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,KAAO6B,cAAc,CACnE,CAAC,CAAC,CAAC;;AAEH;AAAAR,OAAA,CAAAO,sCAAA,GAAAA,sCAAA;AACO,MAAMG,oCAAoC,GAAIF,cAAc,IAAK,IAAAC,yBAAkB,EACxFV,UAAU,CAACE,+BAA+B,EAAAtB,aAAA,KACrC6B,cAAc,CACrB,CAAC,CAAC,CAAC;;AAEH;AAAAR,OAAA,CAAAU,oCAAA,GAAAA,oCAAA;AACO,MAAMC,2CAA2C,GAAIH,cAAc,IAAK,IAAAC,yBAAkB,EAC/FV,UAAU,CAACI,sCAAsC,EAAAxB,aAAA,KAC5C6B,cAAc,CACrB,CAAC,CAAC,CAAC;;AAEH;AAAAR,OAAA,CAAAW,2CAAA,GAAAA,2CAAA;AACO,MAAMC,mCAAmC,GAAGA,CAAA,KAAM;EACvD,IAAAC,6BAAsB,EAACd,UAAU,CAACM,oBAAoB,EAAE,SAAS,CAAC,CAAC,CAAC;AACtE,CAAC;;AAED;AAAAL,OAAA,CAAAY,mCAAA,GAAAA,mCAAA;AACO,MAAME,yCAAyC,GAAGA,CAAA,KAAM,IAAAL,yBAAkB,EAC/EV,UAAU,CAACK,oCAAoC,EAC/C,CAAC,CACH,CAAC,CAAC,CAAC;;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":[]}
|
package/package.json
CHANGED
package/src/index.jsx
CHANGED
|
@@ -9,6 +9,7 @@ import NoticesRedirect from './notices-redirect/index';
|
|
|
9
9
|
import UpgradeButton from './upgrade-button';
|
|
10
10
|
import UserCareerMenu from './career-menu/index';
|
|
11
11
|
import UserDashboardMenu from './dashboard-menu/index';
|
|
12
|
+
import ProgressiveProfilingEntry from './progressive-profiling-dashboard';
|
|
12
13
|
import { ProgressiveProfiling } from './progressive-profiling-dashboard/progressive-profiling-authn-replica';
|
|
13
14
|
|
|
14
15
|
export {
|
|
@@ -23,5 +24,6 @@ export {
|
|
|
23
24
|
UpgradeButton,
|
|
24
25
|
UserCareerMenu,
|
|
25
26
|
UserDashboardMenu,
|
|
27
|
+
ProgressiveProfilingEntry,
|
|
26
28
|
ProgressiveProfiling,
|
|
27
29
|
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import React, { useEffect, useState } from 'react';
|
|
2
|
+
import { getAuthenticatedUser } from '@edx/frontend-platform/auth';
|
|
3
|
+
|
|
4
|
+
import ProgressiveProfilingModal from './ProgressiveProfilingModal';
|
|
5
|
+
import useProgressiveProfilingTrigger from './hooks/useProgressiveProfilingTrigger';
|
|
6
|
+
import useClearProgressiveProfilingQueryParams from './hooks/useClearProgressiveProfilingQueryParams';
|
|
7
|
+
import { trackProgressiveProfilingQuestionaireModalFormOpened } from '../tracking/trackers/progressiveProfiling';
|
|
8
|
+
|
|
9
|
+
const ProgressiveProfilingEntry = () => {
|
|
10
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
11
|
+
|
|
12
|
+
const username = getAuthenticatedUser()?.username;
|
|
13
|
+
|
|
14
|
+
const { shouldOpen } = useProgressiveProfilingTrigger();
|
|
15
|
+
const clearTrigger = useClearProgressiveProfilingQueryParams();
|
|
16
|
+
|
|
17
|
+
useEffect(() => {
|
|
18
|
+
if (shouldOpen && username) {
|
|
19
|
+
setIsOpen(true);
|
|
20
|
+
trackProgressiveProfilingQuestionaireModalFormOpened({ host: window.location.origin });
|
|
21
|
+
}
|
|
22
|
+
}, [shouldOpen, username]);
|
|
23
|
+
|
|
24
|
+
return (
|
|
25
|
+
<ProgressiveProfilingModal
|
|
26
|
+
isOpen={isOpen}
|
|
27
|
+
onClose={() => setIsOpen(false)}
|
|
28
|
+
clearTrigger={clearTrigger}
|
|
29
|
+
/>
|
|
30
|
+
);
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export { ProgressiveProfilingEntry };
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import { getConfig } from '@edx/frontend-platform';
|
|
4
|
+
import { useIntl } from '@edx/frontend-platform/i18n';
|
|
5
|
+
import {
|
|
6
|
+
Alert, Button, Form, Hyperlink, ModalDialog,
|
|
7
|
+
} from '@openedx/paragon';
|
|
8
|
+
|
|
9
|
+
import { FormFieldRenderer } from './field-renderer';
|
|
10
|
+
import useProgressiveProfilingForm from './hooks/useProgressiveProfilingForm';
|
|
11
|
+
import { COMPLETE_STATE, PENDING_STATE } from './utils/constants';
|
|
12
|
+
import messages from './progressive-profiling-authn-replica/messages';
|
|
13
|
+
import {
|
|
14
|
+
trackProgressiveProfilingSkipLinkClick, trackProgressiveProfilingSubmitClick,
|
|
15
|
+
trackProgressiveProfilingSupportLinkClick,
|
|
16
|
+
} from '../tracking/trackers/progressiveProfiling';
|
|
17
|
+
|
|
18
|
+
const ProgressiveProfilingModal = ({
|
|
19
|
+
isOpen, onClose, clearTrigger,
|
|
20
|
+
}) => {
|
|
21
|
+
const { formatMessage } = useIntl();
|
|
22
|
+
const {
|
|
23
|
+
loadState, submitState, error, values, fieldList, onChangeHandler, submit,
|
|
24
|
+
} = useProgressiveProfilingForm();
|
|
25
|
+
|
|
26
|
+
const handleSubmit = async (e) => {
|
|
27
|
+
e.preventDefault();
|
|
28
|
+
const success = await submit();
|
|
29
|
+
if (!success) { return; }
|
|
30
|
+
|
|
31
|
+
trackProgressiveProfilingSubmitClick({
|
|
32
|
+
isGenderSelected: !!values.gender,
|
|
33
|
+
isLevelOfEducationSelected: !!values.level_of_education,
|
|
34
|
+
host: window.location.origin,
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
clearTrigger();
|
|
38
|
+
onClose();
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
const handleSkip = () => {
|
|
42
|
+
trackProgressiveProfilingSkipLinkClick({ host: window.location.origin });
|
|
43
|
+
clearTrigger();
|
|
44
|
+
onClose();
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
return (
|
|
48
|
+
<ModalDialog
|
|
49
|
+
isOpen={isOpen}
|
|
50
|
+
onClose={() => {}}
|
|
51
|
+
hasCloseButton={false}
|
|
52
|
+
size="md"
|
|
53
|
+
title={formatMessage(messages['progressive.profiling.page.heading'])}
|
|
54
|
+
>
|
|
55
|
+
<ModalDialog.Header>
|
|
56
|
+
<ModalDialog.Title>
|
|
57
|
+
{formatMessage(messages['progressive.profiling.page.heading'])}
|
|
58
|
+
</ModalDialog.Title>
|
|
59
|
+
</ModalDialog.Header>
|
|
60
|
+
|
|
61
|
+
<ModalDialog.Body>
|
|
62
|
+
{error && (
|
|
63
|
+
<Alert variant="danger">
|
|
64
|
+
<Alert.Heading>{formatMessage(messages['welcome.page.error.heading'])}</Alert.Heading>
|
|
65
|
+
<p>{formatMessage(messages['welcome.page.error.message'])}</p>
|
|
66
|
+
</Alert>
|
|
67
|
+
)}
|
|
68
|
+
<Form id="profileForm" onSubmit={handleSubmit}>
|
|
69
|
+
{fieldList.map((fieldData) => (
|
|
70
|
+
<FormFieldRenderer
|
|
71
|
+
key={fieldData.name}
|
|
72
|
+
fieldData={fieldData}
|
|
73
|
+
value={values[fieldData.name]}
|
|
74
|
+
onChangeHandler={onChangeHandler}
|
|
75
|
+
/>
|
|
76
|
+
))}
|
|
77
|
+
|
|
78
|
+
{(getConfig().AUTHN_PROGRESSIVE_PROFILING_SUPPORT_LINK) && (
|
|
79
|
+
<div className="mt-2">
|
|
80
|
+
<Hyperlink
|
|
81
|
+
destination={getConfig().AUTHN_PROGRESSIVE_PROFILING_SUPPORT_LINK}
|
|
82
|
+
target="_blank"
|
|
83
|
+
showLaunchIcon={false}
|
|
84
|
+
onClick={() => trackProgressiveProfilingSupportLinkClick({ host: window.location.origin })}
|
|
85
|
+
>
|
|
86
|
+
{formatMessage(messages['optional.fields.information.link'])}
|
|
87
|
+
</Hyperlink>
|
|
88
|
+
</div>
|
|
89
|
+
)}
|
|
90
|
+
</Form>
|
|
91
|
+
</ModalDialog.Body>
|
|
92
|
+
<ModalDialog.Footer>
|
|
93
|
+
<Button variant="link" onClick={handleSkip} disabled={submitState === PENDING_STATE}>
|
|
94
|
+
{formatMessage(messages['optional.fields.skip.button'])}
|
|
95
|
+
</Button>
|
|
96
|
+
<Button variant="brand" type="submit" form="profileForm" disabled={loadState !== COMPLETE_STATE || submitState === PENDING_STATE}>
|
|
97
|
+
{formatMessage(messages['optional.fields.submit.button'])}
|
|
98
|
+
</Button>
|
|
99
|
+
</ModalDialog.Footer>
|
|
100
|
+
</ModalDialog>
|
|
101
|
+
);
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
ProgressiveProfilingModal.propTypes = {
|
|
105
|
+
isOpen: PropTypes.bool.isRequired,
|
|
106
|
+
onClose: PropTypes.func.isRequired,
|
|
107
|
+
clearTrigger: PropTypes.func.isRequired,
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
export default ProgressiveProfilingModal;
|
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
import { getConfig, snakeCaseObject } from '@edx/frontend-platform';
|
|
2
|
+
import { getAuthenticatedUser, getAuthenticatedHttpClient } from '@edx/frontend-platform/auth';
|
|
2
3
|
|
|
3
|
-
export async function saveProgressiveProfiling(
|
|
4
|
-
const payload = { ...values
|
|
4
|
+
export async function saveProgressiveProfiling(values, extendedProfileFieldNames = []) {
|
|
5
|
+
const payload = { ...values };
|
|
6
|
+
const extendedProfile = [];
|
|
7
|
+
const authenticatedUser = getAuthenticatedUser();
|
|
8
|
+
const client = getAuthenticatedHttpClient();
|
|
5
9
|
|
|
6
10
|
extendedProfileFieldNames.forEach((fieldName) => {
|
|
7
11
|
if (payload[fieldName] !== undefined && payload[fieldName] !== '') {
|
|
8
|
-
|
|
12
|
+
extendedProfile.push({
|
|
9
13
|
fieldName,
|
|
10
14
|
fieldValue: payload[fieldName],
|
|
11
15
|
});
|
|
@@ -14,8 +18,12 @@ export async function saveProgressiveProfiling(username, client, values, extende
|
|
|
14
18
|
delete payload[fieldName];
|
|
15
19
|
});
|
|
16
20
|
|
|
21
|
+
if (extendedProfile.length) {
|
|
22
|
+
payload.extendedProfile = extendedProfile;
|
|
23
|
+
}
|
|
24
|
+
|
|
17
25
|
await client.patch(
|
|
18
|
-
`${getConfig().LMS_BASE_URL}/api/user/v1/accounts/${username}`,
|
|
26
|
+
`${getConfig().LMS_BASE_URL}/api/user/v1/accounts/${authenticatedUser.username}`,
|
|
19
27
|
snakeCaseObject(payload),
|
|
20
28
|
{
|
|
21
29
|
headers: { 'Content-Type': 'application/merge-patch+json' },
|
|
@@ -1,57 +1,4 @@
|
|
|
1
1
|
export const progressiveProfilingFields = {
|
|
2
|
-
fields: {
|
|
3
|
-
gender: {
|
|
4
|
-
name: 'gender',
|
|
5
|
-
type: 'select',
|
|
6
|
-
label: 'Gender',
|
|
7
|
-
options: [
|
|
8
|
-
['f', 'Female'],
|
|
9
|
-
['m', 'Male'],
|
|
10
|
-
['o', 'Other'],
|
|
11
|
-
],
|
|
12
|
-
},
|
|
13
|
-
year_of_birth: {
|
|
14
|
-
name: 'year_of_birth',
|
|
15
|
-
type: 'select',
|
|
16
|
-
label: 'Year of Birth',
|
|
17
|
-
options: Array.from({ length: 100 }, (_, i) => {
|
|
18
|
-
const year = new Date().getFullYear() - i;
|
|
19
|
-
return [year.toString(), year.toString()];
|
|
20
|
-
}),
|
|
21
|
-
},
|
|
22
|
-
level_of_education: {
|
|
23
|
-
name: 'level_of_education',
|
|
24
|
-
type: 'select',
|
|
25
|
-
label: 'Level of Education',
|
|
26
|
-
options: [
|
|
27
|
-
['p', 'Doctorate'],
|
|
28
|
-
['m', 'Master\'s or professional degree'],
|
|
29
|
-
['b', 'Bachelor\'s Degree'],
|
|
30
|
-
['a', 'Associate Degree'],
|
|
31
|
-
['hs', 'Secondary/High School'],
|
|
32
|
-
['jhs', 'Junior secondary/junior high/middle school'],
|
|
33
|
-
['el', 'Elementary/primary school'],
|
|
34
|
-
['none', 'No formal education'],
|
|
35
|
-
['other', 'Other education'],
|
|
36
|
-
],
|
|
37
|
-
},
|
|
38
|
-
work_experience: {
|
|
39
|
-
name: 'work_experience',
|
|
40
|
-
type: 'checkbox',
|
|
41
|
-
label: 'Work Experience',
|
|
42
|
-
options: [
|
|
43
|
-
['0', 'No Experience'],
|
|
44
|
-
['1', '1-2 Years'],
|
|
45
|
-
['3', '3-5 Years'],
|
|
46
|
-
['5', '5+ Years'],
|
|
47
|
-
],
|
|
48
|
-
},
|
|
49
|
-
},
|
|
50
|
-
extendedProfile: ['work_experience'],
|
|
51
|
-
redirectUrl: '',
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
export const progressiveProfilingFieldsReplica = {
|
|
55
2
|
fields: {
|
|
56
3
|
gender: {
|
|
57
4
|
name: 'gender',
|
|
@@ -80,6 +27,6 @@ export const progressiveProfilingFieldsReplica = {
|
|
|
80
27
|
],
|
|
81
28
|
},
|
|
82
29
|
},
|
|
83
|
-
extendedProfile: [
|
|
30
|
+
extendedProfile: [],
|
|
84
31
|
redirectUrl: '',
|
|
85
32
|
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { useCallback } from 'react';
|
|
2
|
+
import { PROGRESSIVE_PROFILING_QUERY_PARAM } from '../utils/constants';
|
|
3
|
+
|
|
4
|
+
export default function useClearProgressiveProfilingQueryParams() {
|
|
5
|
+
return useCallback(() => {
|
|
6
|
+
const currentUrl = new URL(window.location.href);
|
|
7
|
+
|
|
8
|
+
currentUrl.searchParams.delete(PROGRESSIVE_PROFILING_QUERY_PARAM);
|
|
9
|
+
|
|
10
|
+
window.history.replaceState({}, '', currentUrl.toString());
|
|
11
|
+
}, []);
|
|
12
|
+
}
|
|
@@ -3,14 +3,14 @@ import {
|
|
|
3
3
|
COMPLETE_STATE, DEFAULT_STATE, PENDING_STATE,
|
|
4
4
|
} from '../utils/constants';
|
|
5
5
|
import { saveProgressiveProfiling } from '../api/service';
|
|
6
|
-
import {
|
|
6
|
+
import { progressiveProfilingFields } from '../data/progressiveProfilingFields';
|
|
7
7
|
|
|
8
|
-
export default function useProgressiveProfilingForm(
|
|
8
|
+
export default function useProgressiveProfilingForm() {
|
|
9
9
|
const [submitState, setSubmitState] = useState(DEFAULT_STATE);
|
|
10
10
|
const [error, setError] = useState(null);
|
|
11
11
|
const [values, setValues] = useState({});
|
|
12
12
|
|
|
13
|
-
const fieldData =
|
|
13
|
+
const fieldData = progressiveProfilingFields;
|
|
14
14
|
|
|
15
15
|
const fieldList = useMemo(
|
|
16
16
|
() => Object.keys(fieldData.fields).map((key) => fieldData.fields[key]),
|
|
@@ -31,7 +31,7 @@ export default function useProgressiveProfilingForm(username, client) {
|
|
|
31
31
|
try {
|
|
32
32
|
setSubmitState(PENDING_STATE);
|
|
33
33
|
setError(null);
|
|
34
|
-
await saveProgressiveProfiling(
|
|
34
|
+
await saveProgressiveProfiling(values, fieldData.extendedProfile || []);
|
|
35
35
|
setSubmitState(COMPLETE_STATE);
|
|
36
36
|
return true;
|
|
37
37
|
} catch (err) {
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { PROGRESSIVE_PROFILING_QUERY_PARAM } from '../utils/constants';
|
|
2
|
+
|
|
3
|
+
export default function useProgressiveProfilingTrigger() {
|
|
4
|
+
const params = new URLSearchParams(window.location.search);
|
|
5
|
+
|
|
6
|
+
return {
|
|
7
|
+
shouldOpen: params.get(PROGRESSIVE_PROFILING_QUERY_PARAM) === 'true',
|
|
8
|
+
};
|
|
9
|
+
}
|
|
@@ -7,6 +7,7 @@ export const eventNames = {
|
|
|
7
7
|
disablePostRegistrationRecommendations: 'edx.bi.user.recommendations.not.enabled',
|
|
8
8
|
progressiveProfilingSupportLinkClick: 'edx.bi.welcome.page.support.link.clicked',
|
|
9
9
|
loginAndRegistration: 'login_and_registration',
|
|
10
|
+
progressiveProfilingQuestionaireModalFormOpened: 'edx.bi.welcome.page.questionaire.modal.opened',
|
|
10
11
|
};
|
|
11
12
|
|
|
12
13
|
// Event link tracker for Progressive profiling skip button click
|
|
@@ -36,3 +37,9 @@ export const trackProgressiveProfilingSupportLinkClick = () => createEventTracke
|
|
|
36
37
|
eventNames.progressiveProfilingSupportLinkClick,
|
|
37
38
|
{},
|
|
38
39
|
)();
|
|
40
|
+
|
|
41
|
+
// Tracks the progressive profiling modal opened with the questionaire form.
|
|
42
|
+
export const trackProgressiveProfilingQuestionaireModalFormOpened = (evenProperties) => createEventTracker(
|
|
43
|
+
eventNames.progressiveProfilingQuestionaireModalFormOpened,
|
|
44
|
+
{ ...evenProperties },
|
|
45
|
+
)();
|