@edx/frontend-plugin-learner-dashboard 3.3.5 → 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.
Files changed (69) hide show
  1. package/dist/index.js +7 -0
  2. package/dist/index.js.map +1 -1
  3. package/dist/package.json +6 -3
  4. package/dist/progressive-profiling-dashboard/api/service.js +32 -0
  5. package/dist/progressive-profiling-dashboard/api/service.js.map +1 -0
  6. package/dist/progressive-profiling-dashboard/data/progressiveProfilingFields.js +60 -0
  7. package/dist/progressive-profiling-dashboard/data/progressiveProfilingFields.js.map +1 -0
  8. package/dist/progressive-profiling-dashboard/field-renderer/FieldRenderer.js +86 -0
  9. package/dist/progressive-profiling-dashboard/field-renderer/FieldRenderer.js.map +1 -0
  10. package/dist/progressive-profiling-dashboard/field-renderer/index.js +14 -0
  11. package/dist/progressive-profiling-dashboard/field-renderer/index.js.map +1 -0
  12. package/dist/progressive-profiling-dashboard/hooks/useProgressiveProfilingForm.js +58 -0
  13. package/dist/progressive-profiling-dashboard/hooks/useProgressiveProfilingForm.js.map +1 -0
  14. package/dist/progressive-profiling-dashboard/progressive-profiling-authn-replica/ProgressiveProfiling.js +157 -0
  15. package/dist/progressive-profiling-dashboard/progressive-profiling-authn-replica/ProgressiveProfiling.js.map +1 -0
  16. package/dist/progressive-profiling-dashboard/progressive-profiling-authn-replica/ProgressiveProfilingPageModal.js +62 -0
  17. package/dist/progressive-profiling-dashboard/progressive-profiling-authn-replica/ProgressiveProfilingPageModal.js.map +1 -0
  18. package/dist/progressive-profiling-dashboard/progressive-profiling-authn-replica/base-container/components/welcome-page-layout/LargeLayout.js +101 -0
  19. package/dist/progressive-profiling-dashboard/progressive-profiling-authn-replica/base-container/components/welcome-page-layout/LargeLayout.js.map +1 -0
  20. package/dist/progressive-profiling-dashboard/progressive-profiling-authn-replica/base-container/components/welcome-page-layout/MediumLayout.js +125 -0
  21. package/dist/progressive-profiling-dashboard/progressive-profiling-authn-replica/base-container/components/welcome-page-layout/MediumLayout.js.map +1 -0
  22. package/dist/progressive-profiling-dashboard/progressive-profiling-authn-replica/base-container/components/welcome-page-layout/SmallLayout.js +106 -0
  23. package/dist/progressive-profiling-dashboard/progressive-profiling-authn-replica/base-container/components/welcome-page-layout/SmallLayout.js.map +1 -0
  24. package/dist/progressive-profiling-dashboard/progressive-profiling-authn-replica/base-container/components/welcome-page-layout/index.js +28 -0
  25. package/dist/progressive-profiling-dashboard/progressive-profiling-authn-replica/base-container/components/welcome-page-layout/index.js.map +1 -0
  26. package/dist/progressive-profiling-dashboard/progressive-profiling-authn-replica/base-container/components/welcome-page-layout/messages.js +40 -0
  27. package/dist/progressive-profiling-dashboard/progressive-profiling-authn-replica/base-container/components/welcome-page-layout/messages.js.map +1 -0
  28. package/dist/progressive-profiling-dashboard/progressive-profiling-authn-replica/base-container/index.js +59 -0
  29. package/dist/progressive-profiling-dashboard/progressive-profiling-authn-replica/base-container/index.js.map +1 -0
  30. package/dist/progressive-profiling-dashboard/progressive-profiling-authn-replica/index.js +14 -0
  31. package/dist/progressive-profiling-dashboard/progressive-profiling-authn-replica/index.js.map +1 -0
  32. package/dist/progressive-profiling-dashboard/progressive-profiling-authn-replica/index.scss +269 -0
  33. package/dist/progressive-profiling-dashboard/progressive-profiling-authn-replica/messages.js +68 -0
  34. package/dist/progressive-profiling-dashboard/progressive-profiling-authn-replica/messages.js.map +1 -0
  35. package/dist/progressive-profiling-dashboard/progressive-profiling-authn-replica/service/getThirdPartyAuthContext.js +28 -0
  36. package/dist/progressive-profiling-dashboard/progressive-profiling-authn-replica/service/getThirdPartyAuthContext.js.map +1 -0
  37. package/dist/progressive-profiling-dashboard/utils/constants.js +12 -0
  38. package/dist/progressive-profiling-dashboard/utils/constants.js.map +1 -0
  39. package/dist/tracking/constants.js +2 -1
  40. package/dist/tracking/constants.js.map +1 -1
  41. package/dist/tracking/trackers/progressiveProfiling.js +42 -0
  42. package/dist/tracking/trackers/progressiveProfiling.js.map +1 -0
  43. package/dist/tracking/utils.js +15 -2
  44. package/dist/tracking/utils.js.map +1 -1
  45. package/package.json +7 -4
  46. package/src/index.jsx +2 -0
  47. package/src/progressive-profiling-dashboard/api/service.js +24 -0
  48. package/src/progressive-profiling-dashboard/data/progressiveProfilingFields.js +85 -0
  49. package/src/progressive-profiling-dashboard/field-renderer/FieldRenderer.jsx +87 -0
  50. package/src/progressive-profiling-dashboard/field-renderer/index.jsx +1 -0
  51. package/src/progressive-profiling-dashboard/hooks/useProgressiveProfilingForm.jsx +55 -0
  52. package/src/progressive-profiling-dashboard/progressive-profiling-authn-replica/ProgressiveProfiling.jsx +156 -0
  53. package/src/progressive-profiling-dashboard/progressive-profiling-authn-replica/ProgressiveProfilingPageModal.jsx +59 -0
  54. package/src/progressive-profiling-dashboard/progressive-profiling-authn-replica/base-container/components/welcome-page-layout/LargeLayout.jsx +105 -0
  55. package/src/progressive-profiling-dashboard/progressive-profiling-authn-replica/base-container/components/welcome-page-layout/MediumLayout.jsx +95 -0
  56. package/src/progressive-profiling-dashboard/progressive-profiling-authn-replica/base-container/components/welcome-page-layout/SmallLayout.jsx +85 -0
  57. package/src/progressive-profiling-dashboard/progressive-profiling-authn-replica/base-container/components/welcome-page-layout/index.jsx +3 -0
  58. package/src/progressive-profiling-dashboard/progressive-profiling-authn-replica/base-container/components/welcome-page-layout/messages.js +35 -0
  59. package/src/progressive-profiling-dashboard/progressive-profiling-authn-replica/base-container/index.jsx +46 -0
  60. package/src/progressive-profiling-dashboard/progressive-profiling-authn-replica/base-container/tests/BaseContainer.test.jsx +76 -0
  61. package/src/progressive-profiling-dashboard/progressive-profiling-authn-replica/index.jsx +1 -0
  62. package/src/progressive-profiling-dashboard/progressive-profiling-authn-replica/index.scss +269 -0
  63. package/src/progressive-profiling-dashboard/progressive-profiling-authn-replica/messages.jsx +62 -0
  64. package/src/progressive-profiling-dashboard/progressive-profiling-authn-replica/service/getThirdPartyAuthContext.js +24 -0
  65. package/src/progressive-profiling-dashboard/progressive-profiling-authn-replica/tests/ProgressiveProfiling.test.jsx +165 -0
  66. package/src/progressive-profiling-dashboard/utils/constants.jsx +5 -0
  67. package/src/tracking/constants.js +2 -0
  68. package/src/tracking/trackers/progressiveProfiling.js +38 -0
  69. package/src/tracking/utils.js +16 -2
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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;AAAuD,SAAAD,uBAAAY,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA","ignoreList":[]}
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.2",
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.3.0",
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,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,CAAAD,CAAA,GAAAa,OAAA,WAAAd,CAAA,IAAAE,MAAA,CAAAgB,cAAA,CAAAnB,CAA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,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,C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b,CAAC,GAAG,EAAE,OAAO,CAAC;IAElB,CAAC;IACDW,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,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;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;UACnBa,QAAQ,EAAEZ,eAAgB;UAC1Ba,aAAa,EAAEf,SAAS,CAACgB,KAAM;UAAAN,QAAA,gBAE/B,IAAAf,WAAA,CAAAU,GAAA;YAAQJ,KAAK,EAAC,EAAE;YAAAS,QAAA,EAAEV,SAAS,CAACgB;UAAK,CAAS,CAAC,EAC1ChB,SAAS,CAACiB,OAAO,CAACC,GAAG,CAACC,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AA,CAAAY,IAAI,CAACM,OAAO;UACXT,SAAS,EAAEA,SAAU;UACrBM,IAAI,EAAET,SAAS,CAACS,IAAK;UACrBR,KAAK,EAAEA,KAAK,IAAI,EAAG;UACnBa,QAAQ,EAAEZ,eAAgB;UAC1Ba,aAAa,EAAEf,SAAS,CAACgB;QAAM,CAChC;MAAC,CACQ,CAAC;EAEnB;AACF,CAAC;AAEDjB,iBAAiB,CAACwB,SAAS,GAAG;EAC5BvB,SAAS,EAAEwB,kBAAS,CAACC,KAAK,CAAC;IACzBhB,IAAI,EAAEe,kBAAS,CAACE,MAAM,CAACC,UAAU;IACjCvB,IAAI,EAAEoB,kBAAS,CAACE,MAAM,CAACC,UAAU;IACjCX,KAAK,EAAEQ,kBAAS,CAACE,MAAM;IACvBT,OAAO,EAAEO,kBAAS,CAACI,OAAO,CACxBJ,kBAAS,CAACI,OAAO,CAACJ,kBAAS,CAACE,MAAM,CACpC;EACF,CAAC,CAAC,CAACC,UAAU;EACb1B,KAAK,EAAEuB,kBAAS,CAACK,SAAS,CAAC,CAACL,kBAAS,CAACE,MAAM,EAAEF,kBAAS,CAACM,IAAI,CAAC,CAAC;EAC9D5B,eAAe,EAAEsB,kBAAS,CAACO,IAAI,CAACJ,UAAU;EAC1CxB,SAAS,EAAEqB,kBAAS,CAACE;AACvB,CAAC;AAAC,IAAAM,QAAA,GAAAC,OAAA,CAAAnC,OAAA,GAEaC,iBAAiB","ignoreList":[]}
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
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,E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ACJ,IAAI,GAAGC,IAAI,KAAK,UAAU,GAAGC,OAAO,GAAGjC;IAAK,EAC7C,CAAC;EACL,CAAC;EAED,MAAMoC,MAAM,GAAG,MAAAA,CAAA,KAAY;IACzB,IAAI;MACFrB,cAAc,CAACsB,wBAAa,CAAC;MAC7BlB,QAAQ,CAAC,IAAI,CAAC;MACd,MAAM,IAAAmB,iCAAwB,EAAC1B,QAAQ,EAAEC,MAAM,EAAEO,MAAM,EAAEE,SAAS,CAACiB,eAAe,IAAI,EAAE,CAAC;MACzFxB,cAAc,CAACyB,yBAAc,CAAC;MAC9B,OAAO,IAAI;IACb,CAAC,CAAC,OAAOC,GAAG,EAAE;MACZ1B,cAAc,CAACE,wBAAa,CAAC;MAC7BE,QAAQ,CAACsB,GAAG,CAAC;MACb,OAAO,KAAK;IACd;EACF,CAAC;EAED,OAAO;IACLC,SAAS,EAAEF,yBAAc;IACzB1B,WAAW;IACXI,KAAK;IACLE,MAAM;IACNI,SAAS;IACTK,eAAe;IACfO,MAAM;IACNO,WAAW,EAAErB,SAAS,CAACqB,WAAW,IAAI,EAAE;IACxCC,yBAAyB,EAAEtB,SAAS,CAACiB,eAAe,IAAI;EAC1D,CAAC;AACH","ignoreList":[]}
@@ -0,0 +1,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
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ProgressiveProfiling.js","names":["_react","_interopRequireWildcard","require","_reactRouterDom","_reactHelmet","_i18n","_frontendPlatform","_auth","_analytics","_paragon","_messages","_interopRequireDefault","_useProgressiveProfilingForm","_baseContainer","_fieldRenderer","_ProgressiveProfilingPageModal","_getThirdPartyAuthContext","_progressiveProfiling","_constants","_jsxRuntime","e","__esModule","default","t","WeakMap","r","n","o","i","f","__proto__","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","ProgressiveProfilingPage","navigate","useNavigate","formatMessage","useIntl","authenticatedUser","getAuthenticatedUser","client","getAuthenticatedHttpClient","loadState","submitState","error","values","fieldList","onChangeHandler","submit","useProgressiveProfilingForm","username","showModal","setShowModal","useState","handleSubmit","preventDefault","success","trackProgressiveProfilingSubmitClick","isGenderSelected","gender","isYearOfBirthSelected","year_of_birth","isLevelOfEducationSelected","level_of_education","isWorkExperienceSelected","work_experience","replace","handleSkip","trackProgressiveProfilingSkipLinkClick","mfeContext","setMfeContext","useEffect","fetchContext","data","getThirdPartyAuthContext","err","userId","identifyAuthenticatedUser","trackProgressiveProfilingPageViewed","jsxs","enterpriseBranding","children","jsx","Helmet","messages","siteName","getConfig","SITE_NAME","isOpen","redirectUrl","className","Alert","variant","Heading","Form","map","fieldData","FormFieldRenderer","value","name","AUTHN_PROGRESSIVE_PROFILING_SUPPORT_LINK","Hyperlink","isInline","destination","target","showLaunchIcon","onClick","trackProgressiveProfilingSupportLinkClick","StatefulButton","type","state","labels","pending","onMouseDown","disabled","COMPLETE_STATE","PENDING_STATE","_default","exports"],"sources":["../../../src/progressive-profiling-dashboard/progressive-profiling-authn-replica/ProgressiveProfiling.jsx"],"sourcesContent":["import React, { useEffect, useState } from 'react';\nimport { useNavigate } from 'react-router-dom';\nimport { Helmet } from 'react-helmet';\nimport { useIntl } from '@edx/frontend-platform/i18n';\nimport { getConfig } from '@edx/frontend-platform';\nimport { getAuthenticatedUser, getAuthenticatedHttpClient } from '@edx/frontend-platform/auth';\nimport { identifyAuthenticatedUser } from '@edx/frontend-platform/analytics';\nimport {\n Form, Hyperlink, StatefulButton, Alert,\n} from '@openedx/paragon';\nimport messages from './messages';\n\nimport useProgressiveProfilingForm from '../hooks/useProgressiveProfilingForm';\n\nimport BaseContainer from './base-container';\nimport { FormFieldRenderer } from '../field-renderer';\nimport ProgressiveProfilingPageModal from './ProgressiveProfilingPageModal';\n\nimport getThirdPartyAuthContext from './service/getThirdPartyAuthContext';\n\nimport {\n trackProgressiveProfilingSkipLinkClick, trackProgressiveProfilingSubmitClick,\n trackProgressiveProfilingSupportLinkClick, trackProgressiveProfilingPageViewed,\n} from '../../tracking/trackers/progressiveProfiling';\n\nimport { PENDING_STATE, COMPLETE_STATE } from '../utils/constants';\n\nimport './index.scss';\n\nconst ProgressiveProfilingPage = () => {\n const navigate = useNavigate();\n const { formatMessage } = useIntl();\n const authenticatedUser = getAuthenticatedUser();\n const client = getAuthenticatedHttpClient();\n const {\n loadState, submitState, error, values, fieldList, onChangeHandler, submit,\n } = useProgressiveProfilingForm(authenticatedUser.username, client);\n const [showModal, setShowModal] = useState(false);\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 isYearOfBirthSelected: !!values.year_of_birth,\n isLevelOfEducationSelected: !!values.level_of_education,\n isWorkExperienceSelected: !!values.work_experience,\n });\n navigate('/', { replace: true });\n };\n\n const handleSkip = () => {\n trackProgressiveProfilingSkipLinkClick();\n setShowModal(true);\n };\n\n const [mfeContext, setMfeContext] = useState(null);\n\n useEffect(() => {\n const fetchContext = async () => {\n try {\n const data = await getThirdPartyAuthContext();\n setMfeContext(data);\n } catch (err) {\n // Allow the page to render even if enterprise context cannot be fetched.\n setMfeContext(null);\n }\n };\n fetchContext();\n }, []);\n\n useEffect(() => {\n const userId = authenticatedUser?.userId;\n if (userId) {\n identifyAuthenticatedUser(userId);\n trackProgressiveProfilingPageViewed();\n }\n }, [authenticatedUser?.userId]);\n\n return (\n <BaseContainer enterpriseBranding={mfeContext}>\n <Helmet>\n <title>{formatMessage(\n messages['progressive.profiling.page.title'],\n { siteName: getConfig().SITE_NAME },\n )}\n </title>\n </Helmet>\n <ProgressiveProfilingPageModal isOpen={showModal} redirectUrl=\"/\" />\n <div className=\"mw-xs m-4 pp-page-content\">\n <div>\n <h2 className=\"pp-page__heading text-primary\">{formatMessage(messages['progressive.profiling.page.heading'])}</h2>\n </div><hr className=\"border-light-700 mb-4\" />\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>\n {fieldList.map((fieldData) => (\n <FormFieldRenderer\n key={fieldData.name}\n fieldData={fieldData}\n value={values[fieldData.name]}\n onChangeHandler={onChangeHandler}\n />\n ))}\n {(getConfig().AUTHN_PROGRESSIVE_PROFILING_SUPPORT_LINK) && (\n <span className=\"pp-page__support-link\">\n <Hyperlink\n isInline\n variant=\"muted\"\n destination={getConfig().AUTHN_PROGRESSIVE_PROFILING_SUPPORT_LINK}\n target=\"_blank\"\n showLaunchIcon={false}\n onClick={() => (trackProgressiveProfilingSupportLinkClick())}\n >\n {formatMessage(messages['optional.fields.information.link'])}\n </Hyperlink>\n </span>\n )}\n <div className=\"d-flex mt-4 mb-3\">\n <StatefulButton\n type=\"submit\"\n variant=\"brand\"\n className=\"pp-page__button-width\"\n state={submitState}\n labels={{\n default: formatMessage(messages['optional.fields.submit.button']),\n pending: '',\n }}\n onClick={handleSubmit}\n onMouseDown={(e) => e.preventDefault()}\n disabled={loadState !== COMPLETE_STATE || submitState === PENDING_STATE}\n />\n <StatefulButton\n className=\"text-gray-700 font-weight-500\"\n type=\"button\"\n variant=\"link\"\n labels={{\n default: formatMessage(messages['optional.fields.skip.button']),\n }}\n onClick={handleSkip}\n onMouseDown={(e) => e.preventDefault()}\n />\n </div>\n </Form>\n </div>\n </BaseContainer>\n );\n};\n\nexport default ProgressiveProfilingPage;\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,eAAA,GAAAD,OAAA;AACA,IAAAE,YAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,iBAAA,GAAAJ,OAAA;AACA,IAAAK,KAAA,GAAAL,OAAA;AACA,IAAAM,UAAA,GAAAN,OAAA;AACA,IAAAO,QAAA,GAAAP,OAAA;AAGA,IAAAQ,SAAA,GAAAC,sBAAA,CAAAT,OAAA;AAEA,IAAAU,4BAAA,GAAAD,sBAAA,CAAAT,OAAA;AAEA,IAAAW,cAAA,GAAAF,sBAAA,CAAAT,OAAA;AACA,IAAAY,cAAA,GAAAZ,OAAA;AACA,IAAAa,8BAAA,GAAAJ,sBAAA,CAAAT,OAAA;AAEA,IAAAc,yBAAA,GAAAL,sBAAA,CAAAT,OAAA;AAEA,IAAAe,qBAAA,GAAAf,OAAA;AAKA,IAAAgB,UAAA,GAAAhB,OAAA;AAEAA,OAAA;AAAsB,IAAAiB,WAAA,GAAAjB,OAAA;AAAA,SAAAS,uBAAAS,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,S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AAAT,QAAA,gBAC/B,IAAApE,WAAA,CAAAqE,GAAA,EAAC/E,QAAA,CAAAyG,cAAc;YACbC,IAAI,EAAC,QAAQ;YACbjB,OAAO,EAAC,OAAO;YACfF,SAAS,EAAC,uBAAuB;YACjCoB,KAAK,EAAEnE,WAAY;YACnBoE,MAAM,EAAE;cACN/F,OAAO,EAAEoB,aAAa,CAACgD,iBAAQ,CAAC,+BAA+B,CAAC,CAAC;cACjE4B,OAAO,EAAE;YACX,CAAE;YACFN,OAAO,EAAEpD,YAAa;YACtB2D,WAAW,EAAGnG,CAAC,IAAKA,CAAC,CAACyC,cAAc,CAAC,CAAE;YACvC2D,QAAQ,EAAExE,SAAS,KAAKyE,yBAAc,IAAIxE,WAAW,KAAKyE;UAAc,CACzE,CAAC,eACF,IAAAvG,WAAA,CAAAqE,GAAA,EAAC/E,QAAA,CAAAyG,cAAc;YACblB,SAAS,EAAC,+BAA+B;YACzCmB,IAAI,EAAC,QAAQ;YACbjB,OAAO,EAAC,MAAM;YACdmB,MAAM,EAAE;cACN/F,OAAO,EAAEoB,aAAa,CAACgD,iBAAQ,CAAC,6BAA6B,CAAC;YAChE,CAAE;YACFsB,OAAO,EAAEvC,UAAW;YACpB8C,WAAW,EAAGnG,CAAC,IAAKA,CAAC,CAACyC,cAAc,CAAC;UAAE,CACxC,CAAC;QAAA,CACC,CAAC;MAAA,CACF,CAAC;IAAA,CACJ,CAAC;EAAA,CACO,CAAC;AAEpB,CAAC;AAAC,IAAA8D,QAAA,GAAAC,OAAA,CAAAtG,OAAA,GAEaiB,wBAAwB","ignoreList":[]}
@@ -0,0 +1,62 @@
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 _frontendPlatform = require("@edx/frontend-platform");
9
+ var _i18n = require("@edx/frontend-platform/i18n");
10
+ var _paragon = require("@openedx/paragon");
11
+ var _propTypes = _interopRequireDefault(require("prop-types"));
12
+ var _messages = _interopRequireDefault(require("./messages"));
13
+ var _jsxRuntime = require("react/jsx-runtime");
14
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
15
+ const ProgressiveProfilingPageModal = props => {
16
+ const {
17
+ formatMessage
18
+ } = (0, _i18n.useIntl)();
19
+ const {
20
+ isOpen,
21
+ redirectUrl
22
+ } = props;
23
+ const platformName = (0, _frontendPlatform.getConfig)().SITE_NAME;
24
+ const handleSubmit = e => {
25
+ e.preventDefault();
26
+ window.location.href = redirectUrl;
27
+ };
28
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_paragon.ModalDialog, {
29
+ title: formatMessage(_messages.default['modal.title']),
30
+ isOpen: isOpen,
31
+ onClose: () => {},
32
+ size: "sm",
33
+ variant: "default",
34
+ hasCloseButton: false,
35
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_paragon.ModalDialog.Header, {
36
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_paragon.ModalDialog.Title, {
37
+ children: formatMessage(_messages.default['modal.title'])
38
+ })
39
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_paragon.ModalDialog.Body, {
40
+ children: formatMessage(_messages.default['modal.description'])
41
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_paragon.ModalDialog.Footer, {
42
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_paragon.ActionRow, {
43
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_paragon.Button, {
44
+ onClick: handleSubmit,
45
+ variant: "primary",
46
+ children: formatMessage(_messages.default['continue.to.platform'], {
47
+ platformName
48
+ })
49
+ })
50
+ })
51
+ })]
52
+ });
53
+ };
54
+ ProgressiveProfilingPageModal.propTypes = {
55
+ isOpen: _propTypes.default.bool,
56
+ redirectUrl: _propTypes.default.string.isRequired
57
+ };
58
+ ProgressiveProfilingPageModal.defaultProps = {
59
+ isOpen: false
60
+ };
61
+ var _default = exports.default = ProgressiveProfilingPageModal;
62
+ //# sourceMappingURL=ProgressiveProfilingPageModal.js.map