@edx/frontend-plugin-learner-dashboard 3.3.5 → 3.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +14 -0
- package/dist/index.js.map +1 -1
- package/dist/package.json +6 -3
- package/dist/progressive-profiling-dashboard/ProgressiveProfilingEntry.js +38 -0
- package/dist/progressive-profiling-dashboard/ProgressiveProfilingEntry.js.map +1 -0
- package/dist/progressive-profiling-dashboard/ProgressiveProfilingModal.js +117 -0
- package/dist/progressive-profiling-dashboard/ProgressiveProfilingModal.js.map +1 -0
- package/dist/progressive-profiling-dashboard/api/service.js +37 -0
- package/dist/progressive-profiling-dashboard/api/service.js.map +1 -0
- package/dist/progressive-profiling-dashboard/data/progressiveProfilingFields.js +25 -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/useClearProgressiveProfilingQueryParams.js +16 -0
- package/dist/progressive-profiling-dashboard/hooks/useClearProgressiveProfilingQueryParams.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/hooks/useProgressiveProfilingTrigger.js +14 -0
- package/dist/progressive-profiling-dashboard/hooks/useProgressiveProfilingTrigger.js.map +1 -0
- package/dist/progressive-profiling-dashboard/index.js +9 -0
- package/dist/progressive-profiling-dashboard/index.js.map +1 -0
- package/dist/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 +47 -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 +4 -0
- package/src/progressive-profiling-dashboard/ProgressiveProfilingEntry.jsx +33 -0
- package/src/progressive-profiling-dashboard/ProgressiveProfilingModal.jsx +110 -0
- package/src/progressive-profiling-dashboard/api/service.js +32 -0
- package/src/progressive-profiling-dashboard/data/progressiveProfilingFields.js +32 -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/useClearProgressiveProfilingQueryParams.jsx +12 -0
- package/src/progressive-profiling-dashboard/hooks/useProgressiveProfilingForm.jsx +55 -0
- package/src/progressive-profiling-dashboard/hooks/useProgressiveProfilingTrigger.jsx +9 -0
- package/src/progressive-profiling-dashboard/index.jsx +3 -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 +45 -0
- package/src/tracking/utils.js +16 -2
|
@@ -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;
|
|
@@ -0,0 +1,85 @@
|
|
|
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 SmallLayout = ({ 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
|
+
<div className="min-vw-100 bg-primary-400 auth-hero-left">
|
|
24
|
+
<div className="col-md-12 small-screen-top-stripe" />
|
|
25
|
+
<Hyperlink destination={getConfig().MARKETING_SITE_BASE_URL}>
|
|
26
|
+
<Image className="logo-small auth-hero-base-logo" alt={siteName} src={baseLogoSrc} />
|
|
27
|
+
</Hyperlink>
|
|
28
|
+
|
|
29
|
+
<div className="auth-hero-content d-flex flex-column">
|
|
30
|
+
<div className="d-flex align-items-center">
|
|
31
|
+
{enterpriseLogoUrl && (
|
|
32
|
+
<div className="auth-hero-enterprise-logo-wrapper mr-4">
|
|
33
|
+
<Image
|
|
34
|
+
alt={enterpriseName || 'Enterprise'}
|
|
35
|
+
src={enterpriseLogoUrl}
|
|
36
|
+
className="auth-hero-enterprise-logo"
|
|
37
|
+
/>
|
|
38
|
+
</div>
|
|
39
|
+
)}
|
|
40
|
+
|
|
41
|
+
<div className="auth-hero-slash mr-4" aria-hidden="true">
|
|
42
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="191" height="250" viewBox="0 0 191 250" fill="none" style={{ width: '100%', height: '100%' }}>
|
|
43
|
+
<line x1="69.8107" y1="33.833" x2="32.9503" y2="206.952" stroke="#F0CC00" strokeWidth="8" />
|
|
44
|
+
</svg>
|
|
45
|
+
</div>
|
|
46
|
+
|
|
47
|
+
<div className="auth-hero-heading">
|
|
48
|
+
<div className="auth-hero-heading-line text-white">
|
|
49
|
+
{formatMessage(messages['start.learning'])}
|
|
50
|
+
</div>
|
|
51
|
+
<div className="auth-hero-heading-line text-accent-a">
|
|
52
|
+
{formatMessage(messages['with.site.name'], { siteName })}
|
|
53
|
+
</div>
|
|
54
|
+
</div>
|
|
55
|
+
</div>
|
|
56
|
+
|
|
57
|
+
{enterpriseWelcomeHtml && (
|
|
58
|
+
<div
|
|
59
|
+
className="auth-hero-message mt-3"
|
|
60
|
+
// eslint-disable-next-line react/no-danger
|
|
61
|
+
// HTML is provided by trusted enterprise branding config (sanitized upstream).
|
|
62
|
+
dangerouslySetInnerHTML={{
|
|
63
|
+
__html: enterpriseWelcomeHtml,
|
|
64
|
+
}}
|
|
65
|
+
/>
|
|
66
|
+
)}
|
|
67
|
+
</div>
|
|
68
|
+
</div>
|
|
69
|
+
);
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
SmallLayout.propTypes = {
|
|
73
|
+
enterpriseBranding: PropTypes.shape({
|
|
74
|
+
enterpriseLogoUrl: PropTypes.string,
|
|
75
|
+
enterpriseName: PropTypes.string,
|
|
76
|
+
enterpriseBrandedWelcomeString: PropTypes.string,
|
|
77
|
+
platformWelcomeString: PropTypes.string,
|
|
78
|
+
}),
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
SmallLayout.defaultProps = {
|
|
82
|
+
enterpriseBranding: null,
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
export default SmallLayout;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { defineMessages } from '@edx/frontend-platform/i18n';
|
|
2
|
+
|
|
3
|
+
const messages = defineMessages({
|
|
4
|
+
'welcome.to.platform': {
|
|
5
|
+
id: 'welcome.to.platform',
|
|
6
|
+
defaultMessage: 'Welcome to {siteName}, {fullName}!',
|
|
7
|
+
description: 'Welcome message that appears on progressive profile page',
|
|
8
|
+
},
|
|
9
|
+
'start.learning': {
|
|
10
|
+
id: 'start.learning',
|
|
11
|
+
defaultMessage: 'Start learning',
|
|
12
|
+
description: 'Header text for logistration MFE pages',
|
|
13
|
+
},
|
|
14
|
+
'with.site.name': {
|
|
15
|
+
id: 'with.site.name',
|
|
16
|
+
defaultMessage: 'with {siteName}',
|
|
17
|
+
description: 'Header text with site name for logistration MFE pages',
|
|
18
|
+
},
|
|
19
|
+
'with.edx': {
|
|
20
|
+
id: 'with.edx',
|
|
21
|
+
defaultMessage: ' with edX',
|
|
22
|
+
},
|
|
23
|
+
'complete.your.profile.1': {
|
|
24
|
+
id: 'complete.your.profile.1',
|
|
25
|
+
defaultMessage: 'Complete',
|
|
26
|
+
description: 'part of text "complete your profile"',
|
|
27
|
+
},
|
|
28
|
+
'complete.your.profile.2': {
|
|
29
|
+
id: 'complete.your.profile.2',
|
|
30
|
+
defaultMessage: 'your profile',
|
|
31
|
+
description: 'part of text "complete your profile"',
|
|
32
|
+
},
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
export default messages;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
import { breakpoints } from '@openedx/paragon';
|
|
4
|
+
import PropTypes from 'prop-types';
|
|
5
|
+
import MediaQuery from 'react-responsive';
|
|
6
|
+
|
|
7
|
+
import { AuthLargeLayout, AuthMediumLayout, AuthSmallLayout } from './components/welcome-page-layout';
|
|
8
|
+
|
|
9
|
+
const BaseContainer = ({ children, enterpriseBranding }) => {
|
|
10
|
+
const brandingData = enterpriseBranding?.thirdPartyAuthContext?.enterpriseBranding;
|
|
11
|
+
|
|
12
|
+
return (
|
|
13
|
+
<>
|
|
14
|
+
<div className="col-md-12 extra-large-screen-top-stripe" />
|
|
15
|
+
<div className="layout">
|
|
16
|
+
<MediaQuery maxWidth={breakpoints.small.maxWidth - 1}>
|
|
17
|
+
<AuthSmallLayout enterpriseBranding={brandingData} />
|
|
18
|
+
</MediaQuery>
|
|
19
|
+
<MediaQuery minWidth={breakpoints.medium.minWidth} maxWidth={breakpoints.large.maxWidth - 1}>
|
|
20
|
+
<AuthMediumLayout enterpriseBranding={brandingData} />
|
|
21
|
+
</MediaQuery>
|
|
22
|
+
<MediaQuery minWidth={breakpoints.extraLarge.minWidth}>
|
|
23
|
+
<AuthLargeLayout enterpriseBranding={brandingData} />
|
|
24
|
+
</MediaQuery>
|
|
25
|
+
<div className="content">
|
|
26
|
+
{children}
|
|
27
|
+
</div>
|
|
28
|
+
</div>
|
|
29
|
+
</>
|
|
30
|
+
);
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
BaseContainer.defaultProps = {
|
|
34
|
+
enterpriseBranding: null,
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
BaseContainer.propTypes = {
|
|
38
|
+
children: PropTypes.node.isRequired,
|
|
39
|
+
enterpriseBranding: PropTypes.shape({
|
|
40
|
+
thirdPartyAuthContext: PropTypes.shape({
|
|
41
|
+
enterpriseBranding: PropTypes.shape({}),
|
|
42
|
+
}),
|
|
43
|
+
}),
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
export default BaseContainer;
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { IntlProvider } from '@edx/frontend-platform/i18n';
|
|
3
|
+
import { render, screen } from '@testing-library/react';
|
|
4
|
+
|
|
5
|
+
import BaseContainer from '../index';
|
|
6
|
+
|
|
7
|
+
jest.mock('../components/welcome-page-layout', () => ({
|
|
8
|
+
AuthSmallLayout: () => <div data-testid="auth-small-layout" />,
|
|
9
|
+
AuthMediumLayout: () => <div data-testid="auth-medium-layout" />,
|
|
10
|
+
AuthLargeLayout: () => <div data-testid="auth-large-layout" />,
|
|
11
|
+
}));
|
|
12
|
+
|
|
13
|
+
let mockWidth = 1400;
|
|
14
|
+
|
|
15
|
+
jest.mock('react-responsive', () => ({
|
|
16
|
+
__esModule: true,
|
|
17
|
+
// eslint-disable-next-line react/prop-types
|
|
18
|
+
default: ({ children, minWidth, maxWidth }) => {
|
|
19
|
+
const matches = (minWidth === undefined || mockWidth >= minWidth)
|
|
20
|
+
&& (maxWidth === undefined || mockWidth <= maxWidth);
|
|
21
|
+
return matches ? children : null;
|
|
22
|
+
},
|
|
23
|
+
}));
|
|
24
|
+
|
|
25
|
+
const renderAtWidth = (width, props = {}) => {
|
|
26
|
+
mockWidth = width;
|
|
27
|
+
return render(
|
|
28
|
+
<IntlProvider locale="en">
|
|
29
|
+
<BaseContainer {...props}>
|
|
30
|
+
<div>Test Content</div>
|
|
31
|
+
</BaseContainer>
|
|
32
|
+
</IntlProvider>,
|
|
33
|
+
);
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
describe('BaseContainer', () => {
|
|
37
|
+
it('renders children', () => {
|
|
38
|
+
renderAtWidth(1400);
|
|
39
|
+
expect(screen.getByText('Test Content')).toBeInTheDocument();
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
it('renders the top stripe', () => {
|
|
43
|
+
const { container } = renderAtWidth(1400);
|
|
44
|
+
expect(container.querySelector('.extra-large-screen-top-stripe')).toBeInTheDocument();
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
it('renders AuthSmallLayout at small screen widths', () => {
|
|
48
|
+
renderAtWidth(400);
|
|
49
|
+
expect(screen.getByTestId('auth-small-layout')).toBeInTheDocument();
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
it('renders AuthMediumLayout at medium screen widths', () => {
|
|
53
|
+
renderAtWidth(800);
|
|
54
|
+
expect(screen.getByTestId('auth-medium-layout')).toBeInTheDocument();
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
it('renders AuthLargeLayout at extra-large screen widths', () => {
|
|
58
|
+
renderAtWidth(1400);
|
|
59
|
+
expect(screen.getByTestId('auth-large-layout')).toBeInTheDocument();
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
it('renders without enterpriseBranding prop', () => {
|
|
63
|
+
renderAtWidth(1400);
|
|
64
|
+
expect(screen.getByTestId('auth-large-layout')).toBeInTheDocument();
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
it('renders with enterpriseBranding prop without errors', () => {
|
|
68
|
+
const enterpriseBranding = {
|
|
69
|
+
thirdPartyAuthContext: {
|
|
70
|
+
enterpriseBranding: { enterpriseName: 'Test Corp', enterpriseLogoUrl: 'https://example.com/logo.png' },
|
|
71
|
+
},
|
|
72
|
+
};
|
|
73
|
+
renderAtWidth(1400, { enterpriseBranding });
|
|
74
|
+
expect(screen.getByTestId('auth-large-layout')).toBeInTheDocument();
|
|
75
|
+
});
|
|
76
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as ProgressiveProfiling } from './ProgressiveProfiling';
|