@edx/frontend-plugin-learner-dashboard 3.3.4 → 3.4.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/dynamic-experience-slot/DynamicExperienceSlot.js +7 -2
- package/dist/dynamic-experience-slot/DynamicExperienceSlot.js.map +1 -1
- package/dist/index.js +7 -0
- package/dist/index.js.map +1 -1
- package/dist/package.json +6 -3
- package/dist/progressive-profiling-dashboard/api/service.js +32 -0
- package/dist/progressive-profiling-dashboard/api/service.js.map +1 -0
- package/dist/progressive-profiling-dashboard/data/progressiveProfilingFields.js +60 -0
- package/dist/progressive-profiling-dashboard/data/progressiveProfilingFields.js.map +1 -0
- package/dist/progressive-profiling-dashboard/field-renderer/FieldRenderer.js +86 -0
- package/dist/progressive-profiling-dashboard/field-renderer/FieldRenderer.js.map +1 -0
- package/dist/progressive-profiling-dashboard/field-renderer/index.js +14 -0
- package/dist/progressive-profiling-dashboard/field-renderer/index.js.map +1 -0
- package/dist/progressive-profiling-dashboard/hooks/useProgressiveProfilingForm.js +58 -0
- package/dist/progressive-profiling-dashboard/hooks/useProgressiveProfilingForm.js.map +1 -0
- package/dist/progressive-profiling-dashboard/progressive-profiling-authn-replica/ProgressiveProfiling.js +157 -0
- package/dist/progressive-profiling-dashboard/progressive-profiling-authn-replica/ProgressiveProfiling.js.map +1 -0
- package/dist/progressive-profiling-dashboard/progressive-profiling-authn-replica/ProgressiveProfilingPageModal.js +62 -0
- package/dist/progressive-profiling-dashboard/progressive-profiling-authn-replica/ProgressiveProfilingPageModal.js.map +1 -0
- package/dist/progressive-profiling-dashboard/progressive-profiling-authn-replica/base-container/components/welcome-page-layout/LargeLayout.js +101 -0
- package/dist/progressive-profiling-dashboard/progressive-profiling-authn-replica/base-container/components/welcome-page-layout/LargeLayout.js.map +1 -0
- package/dist/progressive-profiling-dashboard/progressive-profiling-authn-replica/base-container/components/welcome-page-layout/MediumLayout.js +125 -0
- package/dist/progressive-profiling-dashboard/progressive-profiling-authn-replica/base-container/components/welcome-page-layout/MediumLayout.js.map +1 -0
- package/dist/progressive-profiling-dashboard/progressive-profiling-authn-replica/base-container/components/welcome-page-layout/SmallLayout.js +106 -0
- package/dist/progressive-profiling-dashboard/progressive-profiling-authn-replica/base-container/components/welcome-page-layout/SmallLayout.js.map +1 -0
- package/dist/progressive-profiling-dashboard/progressive-profiling-authn-replica/base-container/components/welcome-page-layout/index.js +28 -0
- package/dist/progressive-profiling-dashboard/progressive-profiling-authn-replica/base-container/components/welcome-page-layout/index.js.map +1 -0
- package/dist/progressive-profiling-dashboard/progressive-profiling-authn-replica/base-container/components/welcome-page-layout/messages.js +40 -0
- package/dist/progressive-profiling-dashboard/progressive-profiling-authn-replica/base-container/components/welcome-page-layout/messages.js.map +1 -0
- package/dist/progressive-profiling-dashboard/progressive-profiling-authn-replica/base-container/index.js +59 -0
- package/dist/progressive-profiling-dashboard/progressive-profiling-authn-replica/base-container/index.js.map +1 -0
- package/dist/progressive-profiling-dashboard/progressive-profiling-authn-replica/index.js +14 -0
- package/dist/progressive-profiling-dashboard/progressive-profiling-authn-replica/index.js.map +1 -0
- package/dist/progressive-profiling-dashboard/progressive-profiling-authn-replica/index.scss +269 -0
- package/dist/progressive-profiling-dashboard/progressive-profiling-authn-replica/messages.js +68 -0
- package/dist/progressive-profiling-dashboard/progressive-profiling-authn-replica/messages.js.map +1 -0
- package/dist/progressive-profiling-dashboard/progressive-profiling-authn-replica/service/getThirdPartyAuthContext.js +28 -0
- package/dist/progressive-profiling-dashboard/progressive-profiling-authn-replica/service/getThirdPartyAuthContext.js.map +1 -0
- package/dist/progressive-profiling-dashboard/utils/constants.js +12 -0
- package/dist/progressive-profiling-dashboard/utils/constants.js.map +1 -0
- package/dist/tracking/constants.js +2 -1
- package/dist/tracking/constants.js.map +1 -1
- package/dist/tracking/trackers/progressiveProfiling.js +42 -0
- package/dist/tracking/trackers/progressiveProfiling.js.map +1 -0
- package/dist/tracking/utils.js +15 -2
- package/dist/tracking/utils.js.map +1 -1
- package/package.json +7 -4
- package/src/dynamic-experience-slot/DynamicExperienceSlot.jsx +9 -2
- package/src/index.jsx +2 -0
- package/src/progressive-profiling-dashboard/api/service.js +24 -0
- package/src/progressive-profiling-dashboard/data/progressiveProfilingFields.js +85 -0
- package/src/progressive-profiling-dashboard/field-renderer/FieldRenderer.jsx +87 -0
- package/src/progressive-profiling-dashboard/field-renderer/index.jsx +1 -0
- package/src/progressive-profiling-dashboard/hooks/useProgressiveProfilingForm.jsx +55 -0
- package/src/progressive-profiling-dashboard/progressive-profiling-authn-replica/ProgressiveProfiling.jsx +156 -0
- package/src/progressive-profiling-dashboard/progressive-profiling-authn-replica/ProgressiveProfilingPageModal.jsx +59 -0
- package/src/progressive-profiling-dashboard/progressive-profiling-authn-replica/base-container/components/welcome-page-layout/LargeLayout.jsx +105 -0
- package/src/progressive-profiling-dashboard/progressive-profiling-authn-replica/base-container/components/welcome-page-layout/MediumLayout.jsx +95 -0
- package/src/progressive-profiling-dashboard/progressive-profiling-authn-replica/base-container/components/welcome-page-layout/SmallLayout.jsx +85 -0
- package/src/progressive-profiling-dashboard/progressive-profiling-authn-replica/base-container/components/welcome-page-layout/index.jsx +3 -0
- package/src/progressive-profiling-dashboard/progressive-profiling-authn-replica/base-container/components/welcome-page-layout/messages.js +35 -0
- package/src/progressive-profiling-dashboard/progressive-profiling-authn-replica/base-container/index.jsx +46 -0
- package/src/progressive-profiling-dashboard/progressive-profiling-authn-replica/base-container/tests/BaseContainer.test.jsx +76 -0
- package/src/progressive-profiling-dashboard/progressive-profiling-authn-replica/index.jsx +1 -0
- package/src/progressive-profiling-dashboard/progressive-profiling-authn-replica/index.scss +269 -0
- package/src/progressive-profiling-dashboard/progressive-profiling-authn-replica/messages.jsx +62 -0
- package/src/progressive-profiling-dashboard/progressive-profiling-authn-replica/service/getThirdPartyAuthContext.js +24 -0
- package/src/progressive-profiling-dashboard/progressive-profiling-authn-replica/tests/ProgressiveProfiling.test.jsx +165 -0
- package/src/progressive-profiling-dashboard/utils/constants.jsx +5 -0
- package/src/tracking/constants.js +2 -0
- package/src/tracking/trackers/progressiveProfiling.js +38 -0
- package/src/tracking/utils.js +16 -2
|
@@ -50,20 +50,25 @@ const DynamicExperienceSlot = _ref => {
|
|
|
50
50
|
const UCL = useUCL();
|
|
51
51
|
const [shouldThrow, setShouldThrow] = (0, _react.useState)(false);
|
|
52
52
|
const [error, setError] = (0, _react.useState)(null);
|
|
53
|
+
|
|
54
|
+
// Lock props to prevent unnecessary re-renders
|
|
55
|
+
const restPropsRef = (0, _react.useRef)(rest);
|
|
56
|
+
// Update ref on each render to prevent stale props
|
|
57
|
+
restPropsRef.current = rest;
|
|
53
58
|
(0, _react.useEffect)(() => {
|
|
54
59
|
const refCurrent = ref.current;
|
|
55
60
|
if (!refCurrent || !UCL) {
|
|
56
61
|
return undefined;
|
|
57
62
|
}
|
|
58
63
|
try {
|
|
59
|
-
UCL.mount(widgetName, refCurrent, _objectSpread(_objectSpread({},
|
|
64
|
+
UCL.mount(widgetName, refCurrent, _objectSpread(_objectSpread({}, restPropsRef.current), {}, {
|
|
60
65
|
onFallbackShouldRender: setShouldThrow
|
|
61
66
|
}));
|
|
62
67
|
} catch (e) {
|
|
63
68
|
setError(e);
|
|
64
69
|
}
|
|
65
70
|
return () => UCL.unmount(refCurrent);
|
|
66
|
-
}, [widgetName, UCL
|
|
71
|
+
}, [widgetName, UCL]);
|
|
67
72
|
if (error) {
|
|
68
73
|
throw error;
|
|
69
74
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DynamicExperienceSlot.js","names":["_react","require","_propTypes","_interopRequireDefault","_jsxRuntime","_excluded","e","__esModule","default","ownKeys","r","t","Object","keys","getOwnPropertySymbols","o","filter","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty","getOwnPropertyDescriptors","defineProperties","defineProperty","_toPropertyKey","value","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","_objectWithoutProperties","_objectWithoutPropertiesLoose","n","indexOf","propertyIsEnumerable","hasOwnProperty","useUCL","timeout","ucl","setUcl","useState","window","UCL","useEffect","undefined","start","Date","now","id","setInterval","clearInterval","RenderFallbackSignal","Error","constructor","name","DynamicExperienceSlot","_ref","widgetName","rest","ref","useRef","shouldThrow","setShouldThrow","error","setError","
|
|
1
|
+
{"version":3,"file":"DynamicExperienceSlot.js","names":["_react","require","_propTypes","_interopRequireDefault","_jsxRuntime","_excluded","e","__esModule","default","ownKeys","r","t","Object","keys","getOwnPropertySymbols","o","filter","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty","getOwnPropertyDescriptors","defineProperties","defineProperty","_toPropertyKey","value","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","_objectWithoutProperties","_objectWithoutPropertiesLoose","n","indexOf","propertyIsEnumerable","hasOwnProperty","useUCL","timeout","ucl","setUcl","useState","window","UCL","useEffect","undefined","start","Date","now","id","setInterval","clearInterval","RenderFallbackSignal","Error","constructor","name","DynamicExperienceSlot","_ref","widgetName","rest","ref","useRef","shouldThrow","setShouldThrow","error","setError","restPropsRef","current","refCurrent","mount","onFallbackShouldRender","unmount","jsx","propTypes","PropTypes","string","isRequired","_default","exports"],"sources":["../../src/dynamic-experience-slot/DynamicExperienceSlot.jsx"],"sourcesContent":["import { useState, useEffect, useRef } from 'react';\nimport PropTypes from 'prop-types';\n\nfunction useUCL(timeout = 5000) {\n const [ucl, setUcl] = useState(() => window.UCL);\n useEffect(() => {\n if (ucl) { return undefined; }\n const start = Date.now();\n const id = setInterval(() => {\n if (window.UCL) {\n setUcl(window.UCL);\n clearInterval(id);\n } else if (Date.now() - start > timeout) {\n clearInterval(id);\n }\n }, 100);\n return () => clearInterval(id);\n }, [ucl, timeout]);\n return ucl;\n}\nclass RenderFallbackSignal extends Error {\n constructor() {\n super('Render fallback requested by widget');\n this.name = 'RenderFallbackSignal';\n }\n}\n\nconst DynamicExperienceSlot = ({ widgetName, ...rest }) => {\n const ref = useRef(null);\n const UCL = useUCL();\n const [shouldThrow, setShouldThrow] = useState(false);\n const [error, setError] = useState(null);\n\n // Lock props to prevent unnecessary re-renders\n const restPropsRef = useRef(rest);\n // Update ref on each render to prevent stale props\n restPropsRef.current = rest;\n\n useEffect(() => {\n const refCurrent = ref.current;\n if (!refCurrent || !UCL) { return undefined; }\n try {\n UCL.mount(widgetName, refCurrent, {\n ...restPropsRef.current,\n onFallbackShouldRender: setShouldThrow,\n });\n } catch (e) {\n setError(e);\n }\n return () => UCL.unmount(refCurrent);\n }, [widgetName, UCL]);\n if (error) { throw error; }\n if (shouldThrow) { throw new RenderFallbackSignal(); }\n return <div ref={ref} />;\n};\n\nDynamicExperienceSlot.propTypes = {\n widgetName: PropTypes.string.isRequired,\n};\n\nexport default DynamicExperienceSlot;\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,UAAA,GAAAC,sBAAA,CAAAF,OAAA;AAAmC,IAAAG,WAAA,GAAAH,OAAA;AAAA,MAAAI,SAAA;AAAA,SAAAF,uBAAAG,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,SAAAG,QAAAH,CAAA,EAAAI,CAAA,QAAAC,CAAA,GAAAC,MAAA,CAAAC,IAAA,CAAAP,CAAA,OAAAM,MAAA,CAAAE,qBAAA,QAAAC,CAAA,GAAAH,MAAA,CAAAE,qBAAA,CAAAR,CAAA,GAAAI,CAAA,KAAAK,CAAA,GAAAA,CAAA,CAAAC,MAAA,WAAAN,CAAA,WAAAE,MAAA,CAAAK,wBAAA,CAAAX,CAAA,EAAAI,CAAA,EAAAQ,UAAA,OAAAP,CAAA,CAAAQ,IAAA,CAAAC,KAAA,CAAAT,CAAA,EAAAI,CAAA,YAAAJ,CAAA;AAAA,SAAAU,cAAAf,CAAA,aAAA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U,EAAAzD,aAAA,CAAAA,aAAA,KAC3BuD,YAAY,CAACC,OAAO;QACvBG,sBAAsB,EAAEP;MAAc,EACvC,CAAC;IACJ,CAAC,CAAC,OAAOnE,CAAC,EAAE;MACVqE,QAAQ,CAACrE,CAAC,CAAC;IACb;IACA,OAAO,MAAM+C,GAAG,CAAC4B,OAAO,CAACH,UAAU,CAAC;EACtC,CAAC,EAAE,CAACV,UAAU,EAAEf,GAAG,CAAC,CAAC;EACrB,IAAIqB,KAAK,EAAE;IAAE,MAAMA,KAAK;EAAE;EAC1B,IAAIF,WAAW,EAAE;IAAE,MAAM,IAAIV,oBAAoB,CAAC,CAAC;EAAE;EACrD,oBAAO,IAAA1D,WAAA,CAAA8E,GAAA;IAAKZ,GAAG,EAAEA;EAAI,CAAE,CAAC;AAC1B,CAAC;AAEDJ,qBAAqB,CAACiB,SAAS,GAAG;EAChCf,UAAU,EAAEgB,kBAAS,CAACC,MAAM,CAACC;AAC/B,CAAC;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAhF,OAAA,GAEa0D,qBAAqB","ignoreList":[]}
|
package/dist/index.js
CHANGED
|
@@ -45,6 +45,12 @@ Object.defineProperty(exports, "NoticesRedirect", {
|
|
|
45
45
|
return _index4.default;
|
|
46
46
|
}
|
|
47
47
|
});
|
|
48
|
+
Object.defineProperty(exports, "ProgressiveProfiling", {
|
|
49
|
+
enumerable: true,
|
|
50
|
+
get: function () {
|
|
51
|
+
return _progressiveProfilingAuthnReplica.ProgressiveProfiling;
|
|
52
|
+
}
|
|
53
|
+
});
|
|
48
54
|
Object.defineProperty(exports, "UclWrapper", {
|
|
49
55
|
enumerable: true,
|
|
50
56
|
get: function () {
|
|
@@ -80,5 +86,6 @@ var _index4 = _interopRequireDefault(require("./notices-redirect/index"));
|
|
|
80
86
|
var _upgradeButton = _interopRequireDefault(require("./upgrade-button"));
|
|
81
87
|
var _index5 = _interopRequireDefault(require("./career-menu/index"));
|
|
82
88
|
var _index6 = _interopRequireDefault(require("./dashboard-menu/index"));
|
|
89
|
+
var _progressiveProfilingAuthnReplica = require("./progressive-profiling-dashboard/progressive-profiling-authn-replica");
|
|
83
90
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
84
91
|
//# 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","e","__esModule","default"],"sources":["../src/index.jsx"],"sourcesContent":["import CohesionWrapper from './cohesion-wrapper/index';\nimport CourseBanner from './course-banner';\nimport DynamicExperienceSlot from './dynamic-experience-slot';\nimport EnterpriseDashboardModal from './dashboard-modal/index';\nimport HelpChatbot from './chatbot/index';\nimport UclWrapper from './ucl-wrapper';\nimport NoCoursesView from './no-courses-view';\nimport NoticesRedirect from './notices-redirect/index';\nimport UpgradeButton from './upgrade-button';\nimport UserCareerMenu from './career-menu/index';\nimport UserDashboardMenu from './dashboard-menu/index';\n\nexport {\n CohesionWrapper,\n CourseBanner,\n DynamicExperienceSlot,\n EnterpriseDashboardModal,\n HelpChatbot,\n NoCoursesView,\n NoticesRedirect,\n UclWrapper,\n UpgradeButton,\n UserCareerMenu,\n UserDashboardMenu,\n};\n"],"mappings":"
|
|
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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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,iCAAA,GAAAX,OAAA;AAA6G,SAAAD,uBAAAa,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA","ignoreList":[]}
|
package/dist/package.json
CHANGED
|
@@ -45,10 +45,10 @@
|
|
|
45
45
|
"@edx/browserslist-config": "^1.1.1",
|
|
46
46
|
"@edx/react-unit-test-utils": "^4.0.0",
|
|
47
47
|
"@edx/reactifex": "^2.1.1",
|
|
48
|
-
"@openedx/frontend-build": "14.6.
|
|
48
|
+
"@openedx/frontend-build": "14.6.6",
|
|
49
49
|
"@testing-library/jest-dom": "^6.6.3",
|
|
50
50
|
"@testing-library/react": "^16.2.0",
|
|
51
|
-
"jest": "30.
|
|
51
|
+
"jest": "30.4.2",
|
|
52
52
|
"react-error-boundary": "^6.1.0",
|
|
53
53
|
"rosie": "2.1.1",
|
|
54
54
|
"semantic-release": "^25.0.0",
|
|
@@ -57,9 +57,12 @@
|
|
|
57
57
|
"peerDependencies": {
|
|
58
58
|
"@edx/frontend-platform": "^8.3.1",
|
|
59
59
|
"@openedx/paragon": "^23.0.0",
|
|
60
|
+
"classnames": "^2.5.1",
|
|
60
61
|
"moment": "^2.30.1",
|
|
61
62
|
"prop-types": "15.8.1",
|
|
62
63
|
"react": "^18.3.1",
|
|
63
|
-
"react-dom": "^18.3.1"
|
|
64
|
+
"react-dom": "^18.3.1",
|
|
65
|
+
"react-helmet": "^6.1.0",
|
|
66
|
+
"react-router-dom": "^6.30.2"
|
|
64
67
|
}
|
|
65
68
|
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.saveProgressiveProfiling = saveProgressiveProfiling;
|
|
7
|
+
var _frontendPlatform = require("@edx/frontend-platform");
|
|
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
|
+
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
|
+
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
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
12
|
+
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(username, client, values, extendedProfileFieldNames = []) {
|
|
14
|
+
const payload = _objectSpread(_objectSpread({}, values), {}, {
|
|
15
|
+
extendedProfile: []
|
|
16
|
+
});
|
|
17
|
+
extendedProfileFieldNames.forEach(fieldName => {
|
|
18
|
+
if (payload[fieldName] !== undefined && payload[fieldName] !== '') {
|
|
19
|
+
payload.extendedProfile.push({
|
|
20
|
+
fieldName,
|
|
21
|
+
fieldValue: payload[fieldName]
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
delete payload[fieldName];
|
|
25
|
+
});
|
|
26
|
+
await client.patch(`${(0, _frontendPlatform.getConfig)().LMS_BASE_URL}/api/user/v1/accounts/${username}`, (0, _frontendPlatform.snakeCaseObject)(payload), {
|
|
27
|
+
headers: {
|
|
28
|
+
'Content-Type': 'application/merge-patch+json'
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=service.js.map
|
|
@@ -0,0 +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","username","client","values","extendedProfileFieldNames","payload","extendedProfile","fieldName","undefined","fieldValue","patch","getConfig","LMS_BASE_URL","snakeCaseObject","headers"],"sources":["../../../src/progressive-profiling-dashboard/api/service.js"],"sourcesContent":["import { getConfig, snakeCaseObject } from '@edx/frontend-platform';\n\nexport async function saveProgressiveProfiling(username, client, values, extendedProfileFieldNames = []) {\n const payload = { ...values, extendedProfile: [] };\n\n extendedProfileFieldNames.forEach((fieldName) => {\n if (payload[fieldName] !== undefined && payload[fieldName] !== '') {\n payload.extendedProfile.push({\n fieldName,\n fieldValue: payload[fieldName],\n });\n }\n\n delete payload[fieldName];\n });\n\n await client.patch(\n `${getConfig().LMS_BASE_URL}/api/user/v1/accounts/${username}`,\n snakeCaseObject(payload),\n {\n headers: { 'Content-Type': 'application/merge-patch+json' },\n },\n );\n}\n"],"mappings":";;;;;;AAAA,IAAAA,iBAAA,GAAAC,OAAA;AAAoE,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,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,MAAM,EAAEC,MAAM,EAAEC,yBAAyB,GAAG,EAAE,EAAE;EACvG,MAAMC,OAAO,GAAAzB,aAAA,CAAAA,aAAA,KAAQuB,MAAM;IAAEG,eAAe,EAAE;EAAE,EAAE;EAElDF,yBAAyB,CAACrB,OAAO,CAAEwB,SAAS,IAAK;IAC/C,IAAIF,OAAO,CAACE,SAAS,CAAC,KAAKC,SAAS,IAAIH,OAAO,CAACE,SAAS,CAAC,KAAK,EAAE,EAAE;MACjEF,OAAO,CAACC,eAAe,CAAC5B,IAAI,CAAC;QAC3B6B,SAAS;QACTE,UAAU,EAAEJ,OAAO,CAACE,SAAS;MAC/B,CAAC,CAAC;IACJ;IAEA,OAAOF,OAAO,CAACE,SAAS,CAAC;EAC3B,CAAC,CAAC;EAEF,MAAML,MAAM,CAACQ,KAAK,CAChB,GAAG,IAAAC,2BAAS,EAAC,CAAC,CAACC,YAAY,yBAAyBX,QAAQ,EAAE,EAC9D,IAAAY,iCAAe,EAACR,OAAO,CAAC,EACxB;IACES,OAAO,EAAE;MAAE,cAAc,EAAE;IAA+B;EAC5D,CACF,CAAC;AACH","ignoreList":[]}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.progressiveProfilingFieldsReplica = exports.progressiveProfilingFields = void 0;
|
|
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
|
+
fields: {
|
|
44
|
+
gender: {
|
|
45
|
+
name: 'gender',
|
|
46
|
+
type: 'select',
|
|
47
|
+
label: 'Gender',
|
|
48
|
+
options: [['f', 'Female'], ['m', 'Male'], ['o', 'Other']]
|
|
49
|
+
},
|
|
50
|
+
level_of_education: {
|
|
51
|
+
name: 'level_of_education',
|
|
52
|
+
type: 'select',
|
|
53
|
+
label: 'Level of Education',
|
|
54
|
+
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
|
+
}
|
|
56
|
+
},
|
|
57
|
+
extendedProfile: ['work_experience'],
|
|
58
|
+
redirectUrl: ''
|
|
59
|
+
};
|
|
60
|
+
//# sourceMappingURL=progressiveProfilingFields.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"progressiveProfilingFields.js","names":["progressiveProfilingFields","exports","fields","gender","name","type","label","options","year_of_birth","Array","from","length","_","i","year","Date","getFullYear","toString","level_of_education","work_experience","extendedProfile","redirectUrl","progressiveProfilingFieldsReplica"],"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 year_of_birth: {\n name: 'year_of_birth',\n type: 'select',\n label: 'Year of Birth',\n options: Array.from({ length: 100 }, (_, i) => {\n const year = new Date().getFullYear() - i;\n return [year.toString(), year.toString()];\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 work_experience: {\n name: 'work_experience',\n type: 'checkbox',\n label: 'Work Experience',\n options: [\n ['0', 'No Experience'],\n ['1', '1-2 Years'],\n ['3', '3-5 Years'],\n ['5', '5+ Years'],\n ],\n },\n },\n extendedProfile: ['work_experience'],\n redirectUrl: '',\n};\n\nexport const progressiveProfilingFieldsReplica = {\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: ['work_experience'],\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,aAAa,EAAE;MACbJ,IAAI,EAAE,eAAe;MACrBC,IAAI,EAAE,QAAQ;MACdC,KAAK,EAAE,eAAe;MACtBC,OAAO,EAAEE,KAAK,CAACC,IAAI,CAAC;QAAEC,MAAM,EAAE;MAAI,CAAC,EAAE,CAACC,CAAC,EAAEC,CAAC,KAAK;QAC7C,MAAMC,IAAI,GAAG,IAAIC,IAAI,CAAC,CAAC,CAACC,WAAW,CAAC,CAAC,GAAGH,CAAC;QACzC,OAAO,CAACC,IAAI,CAACG,QAAQ,CAAC,CAAC,EAAEH,IAAI,CAACG,QAAQ,CAAC,CAAC,CAAC;MAC3C,CAAC;IACH,CAAC;IACDC,kBAAkB,EAAE;MAClBd,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,EAA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rD,CAAC,IAAI,EAAE,2BAA2B,CAAC,EACnC,CAAC,MAAM,EAAE,qBAAqB,CAAC,EAC/B,CAAC,OAAO,EAAE,iBAAiB,CAAC;IAEhC;EACF,CAAC;EACDa,eAAe,EAAE,CAAC,iBAAiB,CAAC;EACpCC,WAAW,EAAE;AACf,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,86 @@
|
|
|
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 _paragon = require("@openedx/paragon");
|
|
10
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
11
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
12
|
+
const FormFieldRenderer = ({
|
|
13
|
+
fieldData,
|
|
14
|
+
value,
|
|
15
|
+
onChangeHandler,
|
|
16
|
+
className
|
|
17
|
+
}) => {
|
|
18
|
+
switch (fieldData.type) {
|
|
19
|
+
case 'select':
|
|
20
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_paragon.Form.Group, {
|
|
21
|
+
controlId: fieldData.name,
|
|
22
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_paragon.Form.Control, {
|
|
23
|
+
as: "select",
|
|
24
|
+
className: className,
|
|
25
|
+
name: fieldData.name,
|
|
26
|
+
value: value ?? '',
|
|
27
|
+
onChange: onChangeHandler,
|
|
28
|
+
floatingLabel: fieldData.label,
|
|
29
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("option", {
|
|
30
|
+
value: "",
|
|
31
|
+
children: fieldData.label
|
|
32
|
+
}), fieldData.options.map(option => /*#__PURE__*/(0, _jsxRuntime.jsx)("option", {
|
|
33
|
+
value: option[0],
|
|
34
|
+
children: option[1]
|
|
35
|
+
}, option[0]))]
|
|
36
|
+
})
|
|
37
|
+
});
|
|
38
|
+
case 'textarea':
|
|
39
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_paragon.Form.Group, {
|
|
40
|
+
controlId: fieldData.name,
|
|
41
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_paragon.Form.Control, {
|
|
42
|
+
as: "textarea",
|
|
43
|
+
className: className,
|
|
44
|
+
name: fieldData.name,
|
|
45
|
+
value: value ?? '',
|
|
46
|
+
onChange: onChangeHandler,
|
|
47
|
+
floatingLabel: fieldData.label
|
|
48
|
+
})
|
|
49
|
+
});
|
|
50
|
+
case 'checkbox':
|
|
51
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_paragon.Form.Group, {
|
|
52
|
+
controlId: fieldData.name,
|
|
53
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_paragon.Form.Checkbox, {
|
|
54
|
+
id: fieldData.name,
|
|
55
|
+
name: fieldData.name,
|
|
56
|
+
checked: !!value,
|
|
57
|
+
onChange: onChangeHandler,
|
|
58
|
+
children: fieldData.label
|
|
59
|
+
})
|
|
60
|
+
});
|
|
61
|
+
default:
|
|
62
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_paragon.Form.Group, {
|
|
63
|
+
controlId: fieldData.name,
|
|
64
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_paragon.Form.Control, {
|
|
65
|
+
className: className,
|
|
66
|
+
name: fieldData.name,
|
|
67
|
+
value: value ?? '',
|
|
68
|
+
onChange: onChangeHandler,
|
|
69
|
+
floatingLabel: fieldData.label
|
|
70
|
+
})
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
FormFieldRenderer.propTypes = {
|
|
75
|
+
fieldData: _propTypes.default.shape({
|
|
76
|
+
name: _propTypes.default.string.isRequired,
|
|
77
|
+
type: _propTypes.default.string.isRequired,
|
|
78
|
+
label: _propTypes.default.string,
|
|
79
|
+
options: _propTypes.default.arrayOf(_propTypes.default.arrayOf(_propTypes.default.string))
|
|
80
|
+
}).isRequired,
|
|
81
|
+
value: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.bool]),
|
|
82
|
+
onChangeHandler: _propTypes.default.func.isRequired,
|
|
83
|
+
className: _propTypes.default.string
|
|
84
|
+
};
|
|
85
|
+
var _default = exports.default = FormFieldRenderer;
|
|
86
|
+
//# sourceMappingURL=FieldRenderer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FieldRenderer.js","names":["_react","_interopRequireDefault","require","_propTypes","_paragon","_jsxRuntime","e","__esModule","default","FormFieldRenderer","fieldData","value","onChangeHandler","className","type","jsx","Form","Group","controlId","name","children","jsxs","Control","as","onChange","floatingLabel","label","options","map","option","Checkbox","id","checked","propTypes","PropTypes","shape","string","isRequired","arrayOf","oneOfType","bool","func","_default","exports"],"sources":["../../../src/progressive-profiling-dashboard/field-renderer/FieldRenderer.jsx"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport { Form } from '@openedx/paragon';\n\nconst FormFieldRenderer = ({\n fieldData, value, onChangeHandler, className,\n}) => {\n switch (fieldData.type) {\n case 'select':\n return (\n <Form.Group controlId={fieldData.name}>\n <Form.Control\n as=\"select\"\n className={className}\n name={fieldData.name}\n value={value ?? ''}\n onChange={onChangeHandler}\n floatingLabel={fieldData.label}\n >\n <option value=\"\">{fieldData.label}</option>\n {fieldData.options.map(option => (\n <option key={option[0]} value={option[0]}>\n {option[1]}\n </option>\n ))}\n </Form.Control>\n </Form.Group>\n );\n\n case 'textarea':\n return (\n <Form.Group controlId={fieldData.name}>\n <Form.Control\n as=\"textarea\"\n className={className}\n name={fieldData.name}\n value={value ?? ''}\n onChange={onChangeHandler}\n floatingLabel={fieldData.label}\n />\n </Form.Group>\n );\n\n case 'checkbox':\n return (\n <Form.Group controlId={fieldData.name}>\n <Form.Checkbox\n id={fieldData.name}\n name={fieldData.name}\n checked={!!value}\n onChange={onChangeHandler}\n >\n {fieldData.label}\n </Form.Checkbox>\n </Form.Group>\n );\n\n default:\n return (\n <Form.Group controlId={fieldData.name}>\n <Form.Control\n className={className}\n name={fieldData.name}\n value={value ?? ''}\n onChange={onChangeHandler}\n floatingLabel={fieldData.label}\n />\n </Form.Group>\n );\n }\n};\n\nFormFieldRenderer.propTypes = {\n fieldData: PropTypes.shape({\n name: PropTypes.string.isRequired,\n type: PropTypes.string.isRequired,\n label: PropTypes.string,\n options: PropTypes.arrayOf(\n PropTypes.arrayOf(PropTypes.string),\n ),\n }).isRequired,\n value: PropTypes.oneOfType([PropTypes.string, PropTypes.bool]),\n onChangeHandler: PropTypes.func.isRequired,\n className: PropTypes.string,\n};\n\nexport default FormFieldRenderer;\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,UAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AAAwC,IAAAG,WAAA,GAAAH,OAAA;AAAA,SAAAD,uBAAAK,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAExC,MAAMG,iBAAiB,GAAGA,CAAC;EACzBC,SAAS;EAAEC,KAAK;EAAEC,eAAe;EAAEC;AACrC,CAAC,KAAK;EACJ,QAAQH,SAAS,CAACI,IAAI;IACpB,KAAK,QAAQ;MACX,oBACE,IAAAT,WAAA,CAAAU,GAAA,EAACX,QAAA,CAAAY,IAAI,CAACC,KAAK;QAACC,SAAS,EAAER,SAAS,CAACS,IAAK;QAAAC,QAAA,eACpC,IAAAf,WAAA,CAAAgB,IAAA,EAACjB,QAAA,CAAAY,IAAI,CAACM,OAAO;UACXC,EAAE,EAAC,QAAQ;UACXV,SAAS,EAAEA,SAAU;UACrBM,IAAI,EAAET,SAAS,CAACS,IAAK;UACrBR,KAAK,EAAEA,KAAK,IAAI,EAAG;UAC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{
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "FormFieldRenderer", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _FieldRenderer.default;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
var _FieldRenderer = _interopRequireDefault(require("./FieldRenderer"));
|
|
13
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
14
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":["_FieldRenderer","_interopRequireDefault","require","e","__esModule","default"],"sources":["../../../src/progressive-profiling-dashboard/field-renderer/index.jsx"],"sourcesContent":["export { default as FormFieldRenderer } from './FieldRenderer';\n"],"mappings":";;;;;;;;;;;AAAA,IAAAA,cAAA,GAAAC,sBAAA,CAAAC,OAAA;AAA+D,SAAAD,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA","ignoreList":[]}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = useProgressiveProfilingForm;
|
|
7
|
+
var _react = require("react");
|
|
8
|
+
var _constants = require("../utils/constants");
|
|
9
|
+
var _service = require("../api/service");
|
|
10
|
+
var _progressiveProfilingFields = require("../data/progressiveProfilingFields");
|
|
11
|
+
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; }
|
|
12
|
+
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; }
|
|
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
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
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(username, client) {
|
|
17
|
+
const [submitState, setSubmitState] = (0, _react.useState)(_constants.DEFAULT_STATE);
|
|
18
|
+
const [error, setError] = (0, _react.useState)(null);
|
|
19
|
+
const [values, setValues] = (0, _react.useState)({});
|
|
20
|
+
const fieldData = _progressiveProfilingFields.progressiveProfilingFieldsReplica;
|
|
21
|
+
const fieldList = (0, _react.useMemo)(() => Object.keys(fieldData.fields).map(key => fieldData.fields[key]), [fieldData]);
|
|
22
|
+
const onChangeHandler = event => {
|
|
23
|
+
const {
|
|
24
|
+
name,
|
|
25
|
+
type,
|
|
26
|
+
value,
|
|
27
|
+
checked
|
|
28
|
+
} = event.target;
|
|
29
|
+
setValues(prev => _objectSpread(_objectSpread({}, prev), {}, {
|
|
30
|
+
[name]: type === 'checkbox' ? checked : value
|
|
31
|
+
}));
|
|
32
|
+
};
|
|
33
|
+
const submit = async () => {
|
|
34
|
+
try {
|
|
35
|
+
setSubmitState(_constants.PENDING_STATE);
|
|
36
|
+
setError(null);
|
|
37
|
+
await (0, _service.saveProgressiveProfiling)(username, client, values, fieldData.extendedProfile || []);
|
|
38
|
+
setSubmitState(_constants.COMPLETE_STATE);
|
|
39
|
+
return true;
|
|
40
|
+
} catch (err) {
|
|
41
|
+
setSubmitState(_constants.DEFAULT_STATE);
|
|
42
|
+
setError(err);
|
|
43
|
+
return false;
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
return {
|
|
47
|
+
loadState: _constants.COMPLETE_STATE,
|
|
48
|
+
submitState,
|
|
49
|
+
error,
|
|
50
|
+
values,
|
|
51
|
+
fieldList,
|
|
52
|
+
onChangeHandler,
|
|
53
|
+
submit,
|
|
54
|
+
redirectUrl: fieldData.redirectUrl || '',
|
|
55
|
+
extendedProfileFieldNames: fieldData.extendedProfile || []
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
//# sourceMappingURL=useProgressiveProfilingForm.js.map
|
|
@@ -0,0 +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","username","client","submitState","setSubmitState","useState","DEFAULT_STATE","error","setError","values","setValues","fieldData","progressiveProfilingFieldsReplica","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 { progressiveProfilingFieldsReplica } from '../data/progressiveProfilingFields';\n\nexport default function useProgressiveProfilingForm(username, client) {\n const [submitState, setSubmitState] = useState(DEFAULT_STATE);\n const [error, setError] = useState(null);\n const [values, setValues] = useState({});\n\n const fieldData = progressiveProfilingFieldsReplica;\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(username, client, 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;AAAuF,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;AAAA,SAAAU,cAAAZ,CAAA,aAAAC,CAAA,MAAAA,CAAA,GAAAY,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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,157 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
+
var _reactRouterDom = require("react-router-dom");
|
|
9
|
+
var _reactHelmet = require("react-helmet");
|
|
10
|
+
var _i18n = require("@edx/frontend-platform/i18n");
|
|
11
|
+
var _frontendPlatform = require("@edx/frontend-platform");
|
|
12
|
+
var _auth = require("@edx/frontend-platform/auth");
|
|
13
|
+
var _analytics = require("@edx/frontend-platform/analytics");
|
|
14
|
+
var _paragon = require("@openedx/paragon");
|
|
15
|
+
var _messages = _interopRequireDefault(require("./messages"));
|
|
16
|
+
var _useProgressiveProfilingForm = _interopRequireDefault(require("../hooks/useProgressiveProfilingForm"));
|
|
17
|
+
var _baseContainer = _interopRequireDefault(require("./base-container"));
|
|
18
|
+
var _fieldRenderer = require("../field-renderer");
|
|
19
|
+
var _ProgressiveProfilingPageModal = _interopRequireDefault(require("./ProgressiveProfilingPageModal"));
|
|
20
|
+
var _getThirdPartyAuthContext = _interopRequireDefault(require("./service/getThirdPartyAuthContext"));
|
|
21
|
+
var _progressiveProfiling = require("../../tracking/trackers/progressiveProfiling");
|
|
22
|
+
var _constants = require("../utils/constants");
|
|
23
|
+
require("./index.scss");
|
|
24
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
25
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
26
|
+
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); }
|
|
27
|
+
const ProgressiveProfilingPage = () => {
|
|
28
|
+
const navigate = (0, _reactRouterDom.useNavigate)();
|
|
29
|
+
const {
|
|
30
|
+
formatMessage
|
|
31
|
+
} = (0, _i18n.useIntl)();
|
|
32
|
+
const authenticatedUser = (0, _auth.getAuthenticatedUser)();
|
|
33
|
+
const client = (0, _auth.getAuthenticatedHttpClient)();
|
|
34
|
+
const {
|
|
35
|
+
loadState,
|
|
36
|
+
submitState,
|
|
37
|
+
error,
|
|
38
|
+
values,
|
|
39
|
+
fieldList,
|
|
40
|
+
onChangeHandler,
|
|
41
|
+
submit
|
|
42
|
+
} = (0, _useProgressiveProfilingForm.default)(authenticatedUser.username, client);
|
|
43
|
+
const [showModal, setShowModal] = (0, _react.useState)(false);
|
|
44
|
+
const handleSubmit = async e => {
|
|
45
|
+
e.preventDefault();
|
|
46
|
+
const success = await submit();
|
|
47
|
+
if (!success) {
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
(0, _progressiveProfiling.trackProgressiveProfilingSubmitClick)({
|
|
51
|
+
isGenderSelected: !!values.gender,
|
|
52
|
+
isYearOfBirthSelected: !!values.year_of_birth,
|
|
53
|
+
isLevelOfEducationSelected: !!values.level_of_education,
|
|
54
|
+
isWorkExperienceSelected: !!values.work_experience
|
|
55
|
+
});
|
|
56
|
+
navigate('/', {
|
|
57
|
+
replace: true
|
|
58
|
+
});
|
|
59
|
+
};
|
|
60
|
+
const handleSkip = () => {
|
|
61
|
+
(0, _progressiveProfiling.trackProgressiveProfilingSkipLinkClick)();
|
|
62
|
+
setShowModal(true);
|
|
63
|
+
};
|
|
64
|
+
const [mfeContext, setMfeContext] = (0, _react.useState)(null);
|
|
65
|
+
(0, _react.useEffect)(() => {
|
|
66
|
+
const fetchContext = async () => {
|
|
67
|
+
try {
|
|
68
|
+
const data = await (0, _getThirdPartyAuthContext.default)();
|
|
69
|
+
setMfeContext(data);
|
|
70
|
+
} catch (err) {
|
|
71
|
+
// Allow the page to render even if enterprise context cannot be fetched.
|
|
72
|
+
setMfeContext(null);
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
fetchContext();
|
|
76
|
+
}, []);
|
|
77
|
+
(0, _react.useEffect)(() => {
|
|
78
|
+
const userId = authenticatedUser?.userId;
|
|
79
|
+
if (userId) {
|
|
80
|
+
(0, _analytics.identifyAuthenticatedUser)(userId);
|
|
81
|
+
(0, _progressiveProfiling.trackProgressiveProfilingPageViewed)();
|
|
82
|
+
}
|
|
83
|
+
}, [authenticatedUser?.userId]);
|
|
84
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_baseContainer.default, {
|
|
85
|
+
enterpriseBranding: mfeContext,
|
|
86
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactHelmet.Helmet, {
|
|
87
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("title", {
|
|
88
|
+
children: formatMessage(_messages.default['progressive.profiling.page.title'], {
|
|
89
|
+
siteName: (0, _frontendPlatform.getConfig)().SITE_NAME
|
|
90
|
+
})
|
|
91
|
+
})
|
|
92
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ProgressiveProfilingPageModal.default, {
|
|
93
|
+
isOpen: showModal,
|
|
94
|
+
redirectUrl: "/"
|
|
95
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
96
|
+
className: "mw-xs m-4 pp-page-content",
|
|
97
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
98
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("h2", {
|
|
99
|
+
className: "pp-page__heading text-primary",
|
|
100
|
+
children: formatMessage(_messages.default['progressive.profiling.page.heading'])
|
|
101
|
+
})
|
|
102
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("hr", {
|
|
103
|
+
className: "border-light-700 mb-4"
|
|
104
|
+
}), error && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_paragon.Alert, {
|
|
105
|
+
variant: "danger",
|
|
106
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_paragon.Alert.Heading, {
|
|
107
|
+
children: formatMessage(_messages.default['welcome.page.error.heading'])
|
|
108
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
|
|
109
|
+
children: formatMessage(_messages.default['welcome.page.error.message'])
|
|
110
|
+
})]
|
|
111
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_paragon.Form, {
|
|
112
|
+
children: [fieldList.map(fieldData => /*#__PURE__*/(0, _jsxRuntime.jsx)(_fieldRenderer.FormFieldRenderer, {
|
|
113
|
+
fieldData: fieldData,
|
|
114
|
+
value: values[fieldData.name],
|
|
115
|
+
onChangeHandler: onChangeHandler
|
|
116
|
+
}, fieldData.name)), (0, _frontendPlatform.getConfig)().AUTHN_PROGRESSIVE_PROFILING_SUPPORT_LINK && /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
117
|
+
className: "pp-page__support-link",
|
|
118
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_paragon.Hyperlink, {
|
|
119
|
+
isInline: true,
|
|
120
|
+
variant: "muted",
|
|
121
|
+
destination: (0, _frontendPlatform.getConfig)().AUTHN_PROGRESSIVE_PROFILING_SUPPORT_LINK,
|
|
122
|
+
target: "_blank",
|
|
123
|
+
showLaunchIcon: false,
|
|
124
|
+
onClick: () => (0, _progressiveProfiling.trackProgressiveProfilingSupportLinkClick)(),
|
|
125
|
+
children: formatMessage(_messages.default['optional.fields.information.link'])
|
|
126
|
+
})
|
|
127
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
128
|
+
className: "d-flex mt-4 mb-3",
|
|
129
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_paragon.StatefulButton, {
|
|
130
|
+
type: "submit",
|
|
131
|
+
variant: "brand",
|
|
132
|
+
className: "pp-page__button-width",
|
|
133
|
+
state: submitState,
|
|
134
|
+
labels: {
|
|
135
|
+
default: formatMessage(_messages.default['optional.fields.submit.button']),
|
|
136
|
+
pending: ''
|
|
137
|
+
},
|
|
138
|
+
onClick: handleSubmit,
|
|
139
|
+
onMouseDown: e => e.preventDefault(),
|
|
140
|
+
disabled: loadState !== _constants.COMPLETE_STATE || submitState === _constants.PENDING_STATE
|
|
141
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_paragon.StatefulButton, {
|
|
142
|
+
className: "text-gray-700 font-weight-500",
|
|
143
|
+
type: "button",
|
|
144
|
+
variant: "link",
|
|
145
|
+
labels: {
|
|
146
|
+
default: formatMessage(_messages.default['optional.fields.skip.button'])
|
|
147
|
+
},
|
|
148
|
+
onClick: handleSkip,
|
|
149
|
+
onMouseDown: e => e.preventDefault()
|
|
150
|
+
})]
|
|
151
|
+
})]
|
|
152
|
+
})]
|
|
153
|
+
})]
|
|
154
|
+
});
|
|
155
|
+
};
|
|
156
|
+
var _default = exports.default = ProgressiveProfilingPage;
|
|
157
|
+
//# sourceMappingURL=ProgressiveProfiling.js.map
|