@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.
- 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/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
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
export const progressiveProfilingFields = {
|
|
2
|
+
fields: {
|
|
3
|
+
gender: {
|
|
4
|
+
name: 'gender',
|
|
5
|
+
type: 'select',
|
|
6
|
+
label: 'Gender',
|
|
7
|
+
options: [
|
|
8
|
+
['f', 'Female'],
|
|
9
|
+
['m', 'Male'],
|
|
10
|
+
['o', 'Other'],
|
|
11
|
+
],
|
|
12
|
+
},
|
|
13
|
+
year_of_birth: {
|
|
14
|
+
name: 'year_of_birth',
|
|
15
|
+
type: 'select',
|
|
16
|
+
label: 'Year of Birth',
|
|
17
|
+
options: Array.from({ length: 100 }, (_, i) => {
|
|
18
|
+
const year = new Date().getFullYear() - i;
|
|
19
|
+
return [year.toString(), year.toString()];
|
|
20
|
+
}),
|
|
21
|
+
},
|
|
22
|
+
level_of_education: {
|
|
23
|
+
name: 'level_of_education',
|
|
24
|
+
type: 'select',
|
|
25
|
+
label: 'Level of Education',
|
|
26
|
+
options: [
|
|
27
|
+
['p', 'Doctorate'],
|
|
28
|
+
['m', 'Master\'s or professional degree'],
|
|
29
|
+
['b', 'Bachelor\'s Degree'],
|
|
30
|
+
['a', 'Associate Degree'],
|
|
31
|
+
['hs', 'Secondary/High School'],
|
|
32
|
+
['jhs', 'Junior secondary/junior high/middle school'],
|
|
33
|
+
['el', 'Elementary/primary school'],
|
|
34
|
+
['none', 'No formal education'],
|
|
35
|
+
['other', 'Other education'],
|
|
36
|
+
],
|
|
37
|
+
},
|
|
38
|
+
work_experience: {
|
|
39
|
+
name: 'work_experience',
|
|
40
|
+
type: 'checkbox',
|
|
41
|
+
label: 'Work Experience',
|
|
42
|
+
options: [
|
|
43
|
+
['0', 'No Experience'],
|
|
44
|
+
['1', '1-2 Years'],
|
|
45
|
+
['3', '3-5 Years'],
|
|
46
|
+
['5', '5+ Years'],
|
|
47
|
+
],
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
extendedProfile: ['work_experience'],
|
|
51
|
+
redirectUrl: '',
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
export const progressiveProfilingFieldsReplica = {
|
|
55
|
+
fields: {
|
|
56
|
+
gender: {
|
|
57
|
+
name: 'gender',
|
|
58
|
+
type: 'select',
|
|
59
|
+
label: 'Gender',
|
|
60
|
+
options: [
|
|
61
|
+
['f', 'Female'],
|
|
62
|
+
['m', 'Male'],
|
|
63
|
+
['o', 'Other'],
|
|
64
|
+
],
|
|
65
|
+
},
|
|
66
|
+
level_of_education: {
|
|
67
|
+
name: 'level_of_education',
|
|
68
|
+
type: 'select',
|
|
69
|
+
label: 'Level of Education',
|
|
70
|
+
options: [
|
|
71
|
+
['p', 'Doctorate'],
|
|
72
|
+
['m', 'Master\'s or professional degree'],
|
|
73
|
+
['b', 'Bachelor\'s Degree'],
|
|
74
|
+
['a', 'Associate Degree'],
|
|
75
|
+
['hs', 'Secondary/High School'],
|
|
76
|
+
['jhs', 'Junior secondary/junior high/middle school'],
|
|
77
|
+
['el', 'Elementary/primary school'],
|
|
78
|
+
['none', 'No formal education'],
|
|
79
|
+
['other', 'Other education'],
|
|
80
|
+
],
|
|
81
|
+
},
|
|
82
|
+
},
|
|
83
|
+
extendedProfile: ['work_experience'],
|
|
84
|
+
redirectUrl: '',
|
|
85
|
+
};
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import { Form } from '@openedx/paragon';
|
|
4
|
+
|
|
5
|
+
const FormFieldRenderer = ({
|
|
6
|
+
fieldData, value, onChangeHandler, className,
|
|
7
|
+
}) => {
|
|
8
|
+
switch (fieldData.type) {
|
|
9
|
+
case 'select':
|
|
10
|
+
return (
|
|
11
|
+
<Form.Group controlId={fieldData.name}>
|
|
12
|
+
<Form.Control
|
|
13
|
+
as="select"
|
|
14
|
+
className={className}
|
|
15
|
+
name={fieldData.name}
|
|
16
|
+
value={value ?? ''}
|
|
17
|
+
onChange={onChangeHandler}
|
|
18
|
+
floatingLabel={fieldData.label}
|
|
19
|
+
>
|
|
20
|
+
<option value="">{fieldData.label}</option>
|
|
21
|
+
{fieldData.options.map(option => (
|
|
22
|
+
<option key={option[0]} value={option[0]}>
|
|
23
|
+
{option[1]}
|
|
24
|
+
</option>
|
|
25
|
+
))}
|
|
26
|
+
</Form.Control>
|
|
27
|
+
</Form.Group>
|
|
28
|
+
);
|
|
29
|
+
|
|
30
|
+
case 'textarea':
|
|
31
|
+
return (
|
|
32
|
+
<Form.Group controlId={fieldData.name}>
|
|
33
|
+
<Form.Control
|
|
34
|
+
as="textarea"
|
|
35
|
+
className={className}
|
|
36
|
+
name={fieldData.name}
|
|
37
|
+
value={value ?? ''}
|
|
38
|
+
onChange={onChangeHandler}
|
|
39
|
+
floatingLabel={fieldData.label}
|
|
40
|
+
/>
|
|
41
|
+
</Form.Group>
|
|
42
|
+
);
|
|
43
|
+
|
|
44
|
+
case 'checkbox':
|
|
45
|
+
return (
|
|
46
|
+
<Form.Group controlId={fieldData.name}>
|
|
47
|
+
<Form.Checkbox
|
|
48
|
+
id={fieldData.name}
|
|
49
|
+
name={fieldData.name}
|
|
50
|
+
checked={!!value}
|
|
51
|
+
onChange={onChangeHandler}
|
|
52
|
+
>
|
|
53
|
+
{fieldData.label}
|
|
54
|
+
</Form.Checkbox>
|
|
55
|
+
</Form.Group>
|
|
56
|
+
);
|
|
57
|
+
|
|
58
|
+
default:
|
|
59
|
+
return (
|
|
60
|
+
<Form.Group controlId={fieldData.name}>
|
|
61
|
+
<Form.Control
|
|
62
|
+
className={className}
|
|
63
|
+
name={fieldData.name}
|
|
64
|
+
value={value ?? ''}
|
|
65
|
+
onChange={onChangeHandler}
|
|
66
|
+
floatingLabel={fieldData.label}
|
|
67
|
+
/>
|
|
68
|
+
</Form.Group>
|
|
69
|
+
);
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
FormFieldRenderer.propTypes = {
|
|
74
|
+
fieldData: PropTypes.shape({
|
|
75
|
+
name: PropTypes.string.isRequired,
|
|
76
|
+
type: PropTypes.string.isRequired,
|
|
77
|
+
label: PropTypes.string,
|
|
78
|
+
options: PropTypes.arrayOf(
|
|
79
|
+
PropTypes.arrayOf(PropTypes.string),
|
|
80
|
+
),
|
|
81
|
+
}).isRequired,
|
|
82
|
+
value: PropTypes.oneOfType([PropTypes.string, PropTypes.bool]),
|
|
83
|
+
onChangeHandler: PropTypes.func.isRequired,
|
|
84
|
+
className: PropTypes.string,
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
export default FormFieldRenderer;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as FormFieldRenderer } from './FieldRenderer';
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { useMemo, useState } from 'react';
|
|
2
|
+
import {
|
|
3
|
+
COMPLETE_STATE, DEFAULT_STATE, PENDING_STATE,
|
|
4
|
+
} from '../utils/constants';
|
|
5
|
+
import { saveProgressiveProfiling } from '../api/service';
|
|
6
|
+
import { progressiveProfilingFieldsReplica } from '../data/progressiveProfilingFields';
|
|
7
|
+
|
|
8
|
+
export default function useProgressiveProfilingForm(username, client) {
|
|
9
|
+
const [submitState, setSubmitState] = useState(DEFAULT_STATE);
|
|
10
|
+
const [error, setError] = useState(null);
|
|
11
|
+
const [values, setValues] = useState({});
|
|
12
|
+
|
|
13
|
+
const fieldData = progressiveProfilingFieldsReplica;
|
|
14
|
+
|
|
15
|
+
const fieldList = useMemo(
|
|
16
|
+
() => Object.keys(fieldData.fields).map((key) => fieldData.fields[key]),
|
|
17
|
+
[fieldData],
|
|
18
|
+
);
|
|
19
|
+
|
|
20
|
+
const onChangeHandler = (event) => {
|
|
21
|
+
const {
|
|
22
|
+
name, type, value, checked,
|
|
23
|
+
} = event.target;
|
|
24
|
+
setValues((prev) => ({
|
|
25
|
+
...prev,
|
|
26
|
+
[name]: type === 'checkbox' ? checked : value,
|
|
27
|
+
}));
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
const submit = async () => {
|
|
31
|
+
try {
|
|
32
|
+
setSubmitState(PENDING_STATE);
|
|
33
|
+
setError(null);
|
|
34
|
+
await saveProgressiveProfiling(username, client, values, fieldData.extendedProfile || []);
|
|
35
|
+
setSubmitState(COMPLETE_STATE);
|
|
36
|
+
return true;
|
|
37
|
+
} catch (err) {
|
|
38
|
+
setSubmitState(DEFAULT_STATE);
|
|
39
|
+
setError(err);
|
|
40
|
+
return false;
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
return {
|
|
45
|
+
loadState: COMPLETE_STATE,
|
|
46
|
+
submitState,
|
|
47
|
+
error,
|
|
48
|
+
values,
|
|
49
|
+
fieldList,
|
|
50
|
+
onChangeHandler,
|
|
51
|
+
submit,
|
|
52
|
+
redirectUrl: fieldData.redirectUrl || '',
|
|
53
|
+
extendedProfileFieldNames: fieldData.extendedProfile || [],
|
|
54
|
+
};
|
|
55
|
+
}
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
import React, { useEffect, useState } from 'react';
|
|
2
|
+
import { useNavigate } from 'react-router-dom';
|
|
3
|
+
import { Helmet } from 'react-helmet';
|
|
4
|
+
import { useIntl } from '@edx/frontend-platform/i18n';
|
|
5
|
+
import { getConfig } from '@edx/frontend-platform';
|
|
6
|
+
import { getAuthenticatedUser, getAuthenticatedHttpClient } from '@edx/frontend-platform/auth';
|
|
7
|
+
import { identifyAuthenticatedUser } from '@edx/frontend-platform/analytics';
|
|
8
|
+
import {
|
|
9
|
+
Form, Hyperlink, StatefulButton, Alert,
|
|
10
|
+
} from '@openedx/paragon';
|
|
11
|
+
import messages from './messages';
|
|
12
|
+
|
|
13
|
+
import useProgressiveProfilingForm from '../hooks/useProgressiveProfilingForm';
|
|
14
|
+
|
|
15
|
+
import BaseContainer from './base-container';
|
|
16
|
+
import { FormFieldRenderer } from '../field-renderer';
|
|
17
|
+
import ProgressiveProfilingPageModal from './ProgressiveProfilingPageModal';
|
|
18
|
+
|
|
19
|
+
import getThirdPartyAuthContext from './service/getThirdPartyAuthContext';
|
|
20
|
+
|
|
21
|
+
import {
|
|
22
|
+
trackProgressiveProfilingSkipLinkClick, trackProgressiveProfilingSubmitClick,
|
|
23
|
+
trackProgressiveProfilingSupportLinkClick, trackProgressiveProfilingPageViewed,
|
|
24
|
+
} from '../../tracking/trackers/progressiveProfiling';
|
|
25
|
+
|
|
26
|
+
import { PENDING_STATE, COMPLETE_STATE } from '../utils/constants';
|
|
27
|
+
|
|
28
|
+
import './index.scss';
|
|
29
|
+
|
|
30
|
+
const ProgressiveProfilingPage = () => {
|
|
31
|
+
const navigate = useNavigate();
|
|
32
|
+
const { formatMessage } = useIntl();
|
|
33
|
+
const authenticatedUser = getAuthenticatedUser();
|
|
34
|
+
const client = getAuthenticatedHttpClient();
|
|
35
|
+
const {
|
|
36
|
+
loadState, submitState, error, values, fieldList, onChangeHandler, submit,
|
|
37
|
+
} = useProgressiveProfilingForm(authenticatedUser.username, client);
|
|
38
|
+
const [showModal, setShowModal] = useState(false);
|
|
39
|
+
|
|
40
|
+
const handleSubmit = async (e) => {
|
|
41
|
+
e.preventDefault();
|
|
42
|
+
const success = await submit();
|
|
43
|
+
if (!success) { return; }
|
|
44
|
+
|
|
45
|
+
trackProgressiveProfilingSubmitClick({
|
|
46
|
+
isGenderSelected: !!values.gender,
|
|
47
|
+
isYearOfBirthSelected: !!values.year_of_birth,
|
|
48
|
+
isLevelOfEducationSelected: !!values.level_of_education,
|
|
49
|
+
isWorkExperienceSelected: !!values.work_experience,
|
|
50
|
+
});
|
|
51
|
+
navigate('/', { replace: true });
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
const handleSkip = () => {
|
|
55
|
+
trackProgressiveProfilingSkipLinkClick();
|
|
56
|
+
setShowModal(true);
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
const [mfeContext, setMfeContext] = useState(null);
|
|
60
|
+
|
|
61
|
+
useEffect(() => {
|
|
62
|
+
const fetchContext = async () => {
|
|
63
|
+
try {
|
|
64
|
+
const data = await getThirdPartyAuthContext();
|
|
65
|
+
setMfeContext(data);
|
|
66
|
+
} catch (err) {
|
|
67
|
+
// Allow the page to render even if enterprise context cannot be fetched.
|
|
68
|
+
setMfeContext(null);
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
fetchContext();
|
|
72
|
+
}, []);
|
|
73
|
+
|
|
74
|
+
useEffect(() => {
|
|
75
|
+
const userId = authenticatedUser?.userId;
|
|
76
|
+
if (userId) {
|
|
77
|
+
identifyAuthenticatedUser(userId);
|
|
78
|
+
trackProgressiveProfilingPageViewed();
|
|
79
|
+
}
|
|
80
|
+
}, [authenticatedUser?.userId]);
|
|
81
|
+
|
|
82
|
+
return (
|
|
83
|
+
<BaseContainer enterpriseBranding={mfeContext}>
|
|
84
|
+
<Helmet>
|
|
85
|
+
<title>{formatMessage(
|
|
86
|
+
messages['progressive.profiling.page.title'],
|
|
87
|
+
{ siteName: getConfig().SITE_NAME },
|
|
88
|
+
)}
|
|
89
|
+
</title>
|
|
90
|
+
</Helmet>
|
|
91
|
+
<ProgressiveProfilingPageModal isOpen={showModal} redirectUrl="/" />
|
|
92
|
+
<div className="mw-xs m-4 pp-page-content">
|
|
93
|
+
<div>
|
|
94
|
+
<h2 className="pp-page__heading text-primary">{formatMessage(messages['progressive.profiling.page.heading'])}</h2>
|
|
95
|
+
</div><hr className="border-light-700 mb-4" />
|
|
96
|
+
{error && (
|
|
97
|
+
<Alert variant="danger">
|
|
98
|
+
<Alert.Heading>{formatMessage(messages['welcome.page.error.heading'])}</Alert.Heading>
|
|
99
|
+
<p>{formatMessage(messages['welcome.page.error.message'])}</p>
|
|
100
|
+
</Alert>
|
|
101
|
+
)}
|
|
102
|
+
<Form>
|
|
103
|
+
{fieldList.map((fieldData) => (
|
|
104
|
+
<FormFieldRenderer
|
|
105
|
+
key={fieldData.name}
|
|
106
|
+
fieldData={fieldData}
|
|
107
|
+
value={values[fieldData.name]}
|
|
108
|
+
onChangeHandler={onChangeHandler}
|
|
109
|
+
/>
|
|
110
|
+
))}
|
|
111
|
+
{(getConfig().AUTHN_PROGRESSIVE_PROFILING_SUPPORT_LINK) && (
|
|
112
|
+
<span className="pp-page__support-link">
|
|
113
|
+
<Hyperlink
|
|
114
|
+
isInline
|
|
115
|
+
variant="muted"
|
|
116
|
+
destination={getConfig().AUTHN_PROGRESSIVE_PROFILING_SUPPORT_LINK}
|
|
117
|
+
target="_blank"
|
|
118
|
+
showLaunchIcon={false}
|
|
119
|
+
onClick={() => (trackProgressiveProfilingSupportLinkClick())}
|
|
120
|
+
>
|
|
121
|
+
{formatMessage(messages['optional.fields.information.link'])}
|
|
122
|
+
</Hyperlink>
|
|
123
|
+
</span>
|
|
124
|
+
)}
|
|
125
|
+
<div className="d-flex mt-4 mb-3">
|
|
126
|
+
<StatefulButton
|
|
127
|
+
type="submit"
|
|
128
|
+
variant="brand"
|
|
129
|
+
className="pp-page__button-width"
|
|
130
|
+
state={submitState}
|
|
131
|
+
labels={{
|
|
132
|
+
default: formatMessage(messages['optional.fields.submit.button']),
|
|
133
|
+
pending: '',
|
|
134
|
+
}}
|
|
135
|
+
onClick={handleSubmit}
|
|
136
|
+
onMouseDown={(e) => e.preventDefault()}
|
|
137
|
+
disabled={loadState !== COMPLETE_STATE || submitState === PENDING_STATE}
|
|
138
|
+
/>
|
|
139
|
+
<StatefulButton
|
|
140
|
+
className="text-gray-700 font-weight-500"
|
|
141
|
+
type="button"
|
|
142
|
+
variant="link"
|
|
143
|
+
labels={{
|
|
144
|
+
default: formatMessage(messages['optional.fields.skip.button']),
|
|
145
|
+
}}
|
|
146
|
+
onClick={handleSkip}
|
|
147
|
+
onMouseDown={(e) => e.preventDefault()}
|
|
148
|
+
/>
|
|
149
|
+
</div>
|
|
150
|
+
</Form>
|
|
151
|
+
</div>
|
|
152
|
+
</BaseContainer>
|
|
153
|
+
);
|
|
154
|
+
};
|
|
155
|
+
|
|
156
|
+
export default ProgressiveProfilingPage;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
import { getConfig } from '@edx/frontend-platform';
|
|
4
|
+
import { useIntl } from '@edx/frontend-platform/i18n';
|
|
5
|
+
import { ActionRow, Button, ModalDialog } from '@openedx/paragon';
|
|
6
|
+
import PropTypes from 'prop-types';
|
|
7
|
+
|
|
8
|
+
import messages from './messages';
|
|
9
|
+
|
|
10
|
+
const ProgressiveProfilingPageModal = (props) => {
|
|
11
|
+
const { formatMessage } = useIntl();
|
|
12
|
+
const { isOpen, redirectUrl } = props;
|
|
13
|
+
const platformName = getConfig().SITE_NAME;
|
|
14
|
+
|
|
15
|
+
const handleSubmit = (e) => {
|
|
16
|
+
e.preventDefault();
|
|
17
|
+
window.location.href = redirectUrl;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
return (
|
|
21
|
+
<ModalDialog
|
|
22
|
+
title={formatMessage(messages['modal.title'])}
|
|
23
|
+
isOpen={isOpen}
|
|
24
|
+
onClose={() => {}}
|
|
25
|
+
size="sm"
|
|
26
|
+
variant="default"
|
|
27
|
+
hasCloseButton={false}
|
|
28
|
+
>
|
|
29
|
+
<ModalDialog.Header>
|
|
30
|
+
<ModalDialog.Title>
|
|
31
|
+
{formatMessage(messages['modal.title'])}
|
|
32
|
+
</ModalDialog.Title>
|
|
33
|
+
</ModalDialog.Header>
|
|
34
|
+
|
|
35
|
+
<ModalDialog.Body>
|
|
36
|
+
{formatMessage(messages['modal.description'])}
|
|
37
|
+
</ModalDialog.Body>
|
|
38
|
+
|
|
39
|
+
<ModalDialog.Footer>
|
|
40
|
+
<ActionRow>
|
|
41
|
+
<Button onClick={handleSubmit} variant="primary">
|
|
42
|
+
{formatMessage(messages['continue.to.platform'], { platformName })}
|
|
43
|
+
</Button>
|
|
44
|
+
</ActionRow>
|
|
45
|
+
</ModalDialog.Footer>
|
|
46
|
+
</ModalDialog>
|
|
47
|
+
);
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
ProgressiveProfilingPageModal.propTypes = {
|
|
51
|
+
isOpen: PropTypes.bool,
|
|
52
|
+
redirectUrl: PropTypes.string.isRequired,
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
ProgressiveProfilingPageModal.defaultProps = {
|
|
56
|
+
isOpen: false,
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
export default ProgressiveProfilingPageModal;
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
|
|
4
|
+
import { getConfig } from '@edx/frontend-platform';
|
|
5
|
+
import { useIntl } from '@edx/frontend-platform/i18n';
|
|
6
|
+
import { Hyperlink, Image } from '@openedx/paragon';
|
|
7
|
+
import classNames from 'classnames';
|
|
8
|
+
|
|
9
|
+
import messages from './messages';
|
|
10
|
+
|
|
11
|
+
const LargeLayout = ({ enterpriseBranding }) => {
|
|
12
|
+
const { formatMessage } = useIntl();
|
|
13
|
+
|
|
14
|
+
const enterpriseLogoUrl = enterpriseBranding?.enterpriseLogoUrl || null;
|
|
15
|
+
const enterpriseName = enterpriseBranding?.enterpriseName || null;
|
|
16
|
+
|
|
17
|
+
const enterpriseWelcomeHtml = enterpriseBranding?.enterpriseBrandedWelcomeString
|
|
18
|
+
|| enterpriseBranding?.platformWelcomeString
|
|
19
|
+
|| '';
|
|
20
|
+
|
|
21
|
+
const siteName = getConfig().SITE_NAME;
|
|
22
|
+
const baseLogoSrc = getConfig().LOGO_WHITE_URL || getConfig().LOGO_URL;
|
|
23
|
+
|
|
24
|
+
return (
|
|
25
|
+
<div className="w-50 d-flex">
|
|
26
|
+
<div className="col-md-10 bg-primary-400 auth-hero-left position-relative">
|
|
27
|
+
{/* base edX logo at very top-left */}
|
|
28
|
+
<Hyperlink destination={getConfig().MARKETING_SITE_BASE_URL}>
|
|
29
|
+
<Image
|
|
30
|
+
className="welcome-page-logo auth-hero-base-logo"
|
|
31
|
+
alt={siteName}
|
|
32
|
+
src={baseLogoSrc}
|
|
33
|
+
/>
|
|
34
|
+
</Hyperlink>
|
|
35
|
+
|
|
36
|
+
{/* main hero content block, aligned like Figma */}
|
|
37
|
+
<div className="auth-hero-content d-flex flex-column">
|
|
38
|
+
{/* row: [enterprise logo] [yellow slash] [Start learning with edX] */}
|
|
39
|
+
<div className="d-flex align-items-center">
|
|
40
|
+
{enterpriseLogoUrl && (
|
|
41
|
+
<div className="auth-hero-enterprise-logo-wrapper mr-4">
|
|
42
|
+
<Image
|
|
43
|
+
alt={enterpriseName || 'Enterprise'}
|
|
44
|
+
src={enterpriseLogoUrl}
|
|
45
|
+
className="auth-hero-enterprise-logo"
|
|
46
|
+
/>
|
|
47
|
+
</div>
|
|
48
|
+
)}
|
|
49
|
+
|
|
50
|
+
<div className="auth-hero-slash mr-4" aria-hidden="true" />
|
|
51
|
+
|
|
52
|
+
<div className="auth-hero-heading">
|
|
53
|
+
<div
|
|
54
|
+
className={classNames(
|
|
55
|
+
'auth-hero-heading-line text-white',
|
|
56
|
+
)}
|
|
57
|
+
>
|
|
58
|
+
{formatMessage(messages['start.learning'])}
|
|
59
|
+
</div>
|
|
60
|
+
<div className="auth-hero-heading-line text-accent-a">
|
|
61
|
+
{formatMessage(messages['with.edx'])}
|
|
62
|
+
</div>
|
|
63
|
+
</div>
|
|
64
|
+
</div>
|
|
65
|
+
|
|
66
|
+
{/* enterprise-specific message aligned under heading */}
|
|
67
|
+
{enterpriseWelcomeHtml && (
|
|
68
|
+
<div
|
|
69
|
+
className="auth-hero-message mt-4"
|
|
70
|
+
// eslint-disable-next-line react/no-danger
|
|
71
|
+
dangerouslySetInnerHTML={{ __html: enterpriseWelcomeHtml }}
|
|
72
|
+
/>
|
|
73
|
+
)}
|
|
74
|
+
</div>
|
|
75
|
+
</div>
|
|
76
|
+
|
|
77
|
+
{/* keep existing right decorative triangle */}
|
|
78
|
+
<div className="col-md-3 bg-white p-0">
|
|
79
|
+
<svg
|
|
80
|
+
className="m1-n1 w-100 h-100 large-screen-svg-primary"
|
|
81
|
+
preserveAspectRatio="xMaxYMin meet"
|
|
82
|
+
>
|
|
83
|
+
<g transform="skewX(171.6)">
|
|
84
|
+
<rect x="0" y="0" height="100%" width="100%" />
|
|
85
|
+
</g>
|
|
86
|
+
</svg>
|
|
87
|
+
</div>
|
|
88
|
+
</div>
|
|
89
|
+
);
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
LargeLayout.propTypes = {
|
|
93
|
+
enterpriseBranding: PropTypes.shape({
|
|
94
|
+
enterpriseLogoUrl: PropTypes.string,
|
|
95
|
+
enterpriseName: PropTypes.string,
|
|
96
|
+
enterpriseBrandedWelcomeString: PropTypes.string,
|
|
97
|
+
platformWelcomeString: PropTypes.string,
|
|
98
|
+
}),
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
LargeLayout.defaultProps = {
|
|
102
|
+
enterpriseBranding: null,
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
export default LargeLayout;
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
|
|
4
|
+
import { getConfig } from '@edx/frontend-platform';
|
|
5
|
+
import { useIntl } from '@edx/frontend-platform/i18n';
|
|
6
|
+
import { Hyperlink, Image } from '@openedx/paragon';
|
|
7
|
+
|
|
8
|
+
import messages from './messages';
|
|
9
|
+
|
|
10
|
+
const MediumLayout = ({ enterpriseBranding }) => {
|
|
11
|
+
const { formatMessage } = useIntl();
|
|
12
|
+
|
|
13
|
+
const enterpriseLogoUrl = enterpriseBranding?.enterpriseLogoUrl || null;
|
|
14
|
+
const enterpriseName = enterpriseBranding?.enterpriseName || null;
|
|
15
|
+
const enterpriseWelcomeHtml = enterpriseBranding?.enterpriseBrandedWelcomeString
|
|
16
|
+
|| enterpriseBranding?.platformWelcomeString
|
|
17
|
+
|| '';
|
|
18
|
+
|
|
19
|
+
const siteName = getConfig().SITE_NAME;
|
|
20
|
+
const baseLogoSrc = getConfig().LOGO_WHITE_URL || getConfig().LOGO_URL;
|
|
21
|
+
|
|
22
|
+
return (
|
|
23
|
+
<>
|
|
24
|
+
<div className="w-100 medium-screen-top-stripe" />
|
|
25
|
+
<div className="w-100 p-0 mb-3 d-flex">
|
|
26
|
+
<div className="col-md-10 bg-primary-400 auth-hero-left">
|
|
27
|
+
<Hyperlink destination={getConfig().MARKETING_SITE_BASE_URL}>
|
|
28
|
+
<Image className="welcome-page-logo auth-hero-base-logo" alt={siteName} src={baseLogoSrc} />
|
|
29
|
+
</Hyperlink>
|
|
30
|
+
|
|
31
|
+
<div className="auth-hero-content d-flex flex-column">
|
|
32
|
+
<div className="d-flex align-items-center">
|
|
33
|
+
{enterpriseLogoUrl && (
|
|
34
|
+
<div className="auth-hero-enterprise-logo-wrapper mr-4">
|
|
35
|
+
<Image
|
|
36
|
+
alt={enterpriseName || 'Enterprise'}
|
|
37
|
+
src={enterpriseLogoUrl}
|
|
38
|
+
className="auth-hero-enterprise-logo"
|
|
39
|
+
/>
|
|
40
|
+
</div>
|
|
41
|
+
)}
|
|
42
|
+
|
|
43
|
+
<div className="auth-hero-slash mr-4" aria-hidden="true">
|
|
44
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="191" height="250" viewBox="0 0 191 250" fill="none" style={{ width: '100%', height: '100%' }}>
|
|
45
|
+
<line x1="69.8107" y1="33.833" x2="32.9503" y2="206.952" stroke="#F0CC00" strokeWidth="8" />
|
|
46
|
+
</svg>
|
|
47
|
+
</div>
|
|
48
|
+
|
|
49
|
+
<div className="auth-hero-heading">
|
|
50
|
+
<div className="auth-hero-heading-line text-white">
|
|
51
|
+
{formatMessage(messages['start.learning'])}
|
|
52
|
+
</div>
|
|
53
|
+
<div className="auth-hero-heading-line text-accent-a">
|
|
54
|
+
{formatMessage(messages['with.site.name'], { siteName })}
|
|
55
|
+
</div>
|
|
56
|
+
</div>
|
|
57
|
+
</div>
|
|
58
|
+
|
|
59
|
+
{enterpriseWelcomeHtml && (
|
|
60
|
+
<div
|
|
61
|
+
className="auth-hero-message mt-3"
|
|
62
|
+
// eslint-disable-next-line react/no-danger
|
|
63
|
+
dangerouslySetInnerHTML={{
|
|
64
|
+
__html: enterpriseWelcomeHtml,
|
|
65
|
+
}}
|
|
66
|
+
/>
|
|
67
|
+
)}
|
|
68
|
+
</div>
|
|
69
|
+
</div>
|
|
70
|
+
<div className="col-md-2 bg-white p-0">
|
|
71
|
+
<svg className="w-100 h-100 medium-screen-svg-primary" preserveAspectRatio="xMaxYMin meet">
|
|
72
|
+
<g transform="skewX(168)">
|
|
73
|
+
<rect x="0" y="0" height="100%" width="100%" />
|
|
74
|
+
</g>
|
|
75
|
+
</svg>
|
|
76
|
+
</div>
|
|
77
|
+
</div>
|
|
78
|
+
</>
|
|
79
|
+
);
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
MediumLayout.propTypes = {
|
|
83
|
+
enterpriseBranding: PropTypes.shape({
|
|
84
|
+
enterpriseLogoUrl: PropTypes.string,
|
|
85
|
+
enterpriseName: PropTypes.string,
|
|
86
|
+
enterpriseBrandedWelcomeString: PropTypes.string,
|
|
87
|
+
platformWelcomeString: PropTypes.string,
|
|
88
|
+
}),
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
MediumLayout.defaultProps = {
|
|
92
|
+
enterpriseBranding: null,
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
export default MediumLayout;
|