diff --git a/src/account-settings/AccountSettingsPage.jsx b/src/account-settings/AccountSettingsPage.jsx index 34858cb..8ed54bf 100644 --- a/src/account-settings/AccountSettingsPage.jsx +++ b/src/account-settings/AccountSettingsPage.jsx @@ -488,11 +488,11 @@ AccountSettingsPage.propTypes = { social_link_facebook: PropTypes.string, social_link_twitter: PropTypes.string, time_zone: PropTypes.string, - coaching: PropTypes.objectOf(PropTypes.shape({ - coaching_consent: PropTypes.string.isRequired, + coaching: PropTypes.shape({ + coaching_consent: PropTypes.bool.isRequired, user: PropTypes.number.isRequired, eligible_for_coaching: PropTypes.bool.isRequired, - })), + }), }).isRequired, siteLanguage: PropTypes.shape({ previousValue: PropTypes.string, diff --git a/src/account-settings/coaching/CoachingConsent.jsx b/src/account-settings/coaching/CoachingConsent.jsx index 4bb647c..0839bab 100644 --- a/src/account-settings/coaching/CoachingConsent.jsx +++ b/src/account-settings/coaching/CoachingConsent.jsx @@ -133,11 +133,14 @@ class CoachingConsent extends React.Component { // !important: The order of this data matters! // The order that this data is in, is the order that the saveSettings() function // is called. - this.props.saveMultipleSettings([ - { + const settingsSubmissions = []; + if (!this.props.profileDataManager) { + settingsSubmissions.push({ formId: 'name', commitValues: fullName, - }, + }); + } + Array.prototype.push.apply(settingsSubmissions, [ { formId: 'coaching', commitValues: { @@ -152,6 +155,7 @@ class CoachingConsent extends React.Component { commitValues: phoneNumber, }, ]); + this.props.saveMultipleSettings(settingsSubmissions); } async declineCoaching(e) { @@ -181,6 +185,7 @@ class CoachingConsent extends React.Component { formErrors={this.state.formErrors} formValues={this.props.formValues} redirectUrl={this.state.redirectUrl} + profileDataManager={this.props.profileDataManager} />); case VIEWS.SUCCESS_PENDING: return ; @@ -273,6 +278,7 @@ AutoRedirect.propTypes = { CoachingConsent.defaultProps = { loaded: false, saveState: undefined, + profileDataManager: null, }; CoachingConsent.propTypes = { @@ -298,7 +304,9 @@ CoachingConsent.propTypes = { }).isRequired, fetchSettings: PropTypes.func.isRequired, saveSettings: PropTypes.func.isRequired, + saveMultipleSettings: PropTypes.func.isRequired, saveState: PropTypes.string, + profileDataManager: PropTypes.string, }; export default connect(coachingConsentPageSelector, { diff --git a/src/account-settings/coaching/CoachingConsent.messages.js b/src/account-settings/coaching/CoachingConsent.messages.js index 0eae5ae..ffd5464 100644 --- a/src/account-settings/coaching/CoachingConsent.messages.js +++ b/src/account-settings/coaching/CoachingConsent.messages.js @@ -56,6 +56,11 @@ const messages = defineMessages({ defaultMessage: 'Start my course', description: 'Text that the user will be sent back to the courseware', }, + 'account.settings.coaching.managed.support': { + id: 'account.settings.coaching.managed.support', + defaultMessage: 'support', + description: 'website support', + }, }); export default messages; diff --git a/src/account-settings/coaching/CoachingConsentForm.jsx b/src/account-settings/coaching/CoachingConsentForm.jsx index 1403fc5..5db4612 100644 --- a/src/account-settings/coaching/CoachingConsentForm.jsx +++ b/src/account-settings/coaching/CoachingConsentForm.jsx @@ -1,15 +1,30 @@ import React from 'react'; -import { injectIntl, intlShape } from '@edx/frontend-platform/i18n'; +import { getConfig } from '@edx/frontend-platform'; +import { injectIntl, intlShape, FormattedMessage } from '@edx/frontend-platform/i18n'; import { Input, Button, Hyperlink } from '@edx/paragon'; + import PropTypes from 'prop-types'; +import Alert from '../Alert'; import messages from './CoachingConsent.messages'; const ErrorMessage = props => (
{props.message}
); +const ManagedProfileAlert = ({ profileDataManager }) => ( + + {profileDataManager}, + }} + /> + +); const CoachingForm = props => (

@@ -19,12 +34,17 @@ const CoachingForm = props => (
+ { + !!props.profileDataManager && + + }
@@ -91,6 +111,7 @@ CoachingForm.propTypes = { phone_number: PropTypes.string, }), redirectUrl: PropTypes.string.isRequired, + profileDataManager: PropTypes.string.isRequired, }; ErrorMessage.defaultProps = { @@ -101,4 +122,9 @@ ErrorMessage.propTypes = { message: PropTypes.string, }; +ManagedProfileAlert.propTypes = { + profileDataManager: PropTypes.string.isRequired, + intl: intlShape.isRequired, +}; + export default injectIntl(CoachingForm); diff --git a/src/account-settings/coaching/CoachingToggle.jsx b/src/account-settings/coaching/CoachingToggle.jsx index 1b7b438..b56c206 100644 --- a/src/account-settings/coaching/CoachingToggle.jsx +++ b/src/account-settings/coaching/CoachingToggle.jsx @@ -55,17 +55,18 @@ const CoachingToggle = props => ( CoachingToggle.defaultProps = { phone_number: '', error: '', + saveState: undefined, }; CoachingToggle.propTypes = { name: PropTypes.string.isRequired, error: PropTypes.string, - coaching: PropTypes.objectOf(PropTypes.shape({ - coaching_consent: PropTypes.string.isRequired, + coaching: PropTypes.shape({ + coaching_consent: PropTypes.bool.isRequired, user: PropTypes.number.isRequired, eligible_for_coaching: PropTypes.bool.isRequired, - })).isRequired, - saveState: PropTypes.func.isRequired, + }).isRequired, + saveState: PropTypes.oneOf(['default', 'pending', 'complete', 'error']), saveSettings: PropTypes.func.isRequired, updateDraft: PropTypes.func.isRequired, intl: intlShape.isRequired, diff --git a/src/account-settings/data/selectors.js b/src/account-settings/data/selectors.js index 0f287e5..f2289ff 100644 --- a/src/account-settings/data/selectors.js +++ b/src/account-settings/data/selectors.js @@ -167,6 +167,7 @@ export const coachingConsentPageSelector = createSelector( accountSettingsSelector, formValuesSelector, activeAccountSelector, + profileDataManagerSelector, saveStateSelector, confirmationValuesSelector, errorSelector, @@ -174,6 +175,7 @@ export const coachingConsentPageSelector = createSelector( accountSettings, formValues, activeAccount, + profileDataManager, saveState, confirmationValues, errors, @@ -182,6 +184,7 @@ export const coachingConsentPageSelector = createSelector( loaded: accountSettings.loaded, loadingError: accountSettings.loadingError, isActive: activeAccount, + profileDataManager, formValues, saveState, confirmationValues,