From 55a38c4cd9d98285cf4f1f800c68703c201a53ef Mon Sep 17 00:00:00 2001 From: edx-abolger <74684094+edx-abolger@users.noreply.github.com> Date: Fri, 12 Mar 2021 11:56:52 -0500 Subject: [PATCH] ENT-4276 lp codes bugfixes (#238) * ENT-4276 use new ecommerce param to allow pass through of params to grant_data_sharing_permissions url when we don't go directly there. * Fixing message typo. * ESLint error fix * Fix to correct prop type to remove React console error. enrollLabel property now consistent across repo. --- src/components/course/data/hooks.js | 7 ++++--- src/components/course/enrollment/common.jsx | 2 +- .../course/enrollment/components/DisabledEnroll.jsx | 2 +- .../course/enrollment/components/ToCoursewarePage.jsx | 2 +- .../course/enrollment/components/ToDataSharingConsent.jsx | 2 +- .../course/enrollment/components/ToVoucherRedeemPage.jsx | 2 +- .../course/enrollment/components/ViewOnDashboard.jsx | 2 +- src/components/enterprise-user-subsidy/OffersAlert.jsx | 2 +- 8 files changed, 11 insertions(+), 10 deletions(-) diff --git a/src/components/course/data/hooks.js b/src/components/course/data/hooks.js index a849ad1aa..4c15fe9a3 100644 --- a/src/components/course/data/hooks.js +++ b/src/components/course/data/hooks.js @@ -280,6 +280,9 @@ const useCourseEnrollmentUrl = ({ license_uuid: subscriptionLicense.uuid, course_id: key, enterprise_customer_uuid: enterpriseConfig.uuid, + // We don't want any sidebar text we show the data consent page from this workflow since + // the text on the sidebar is used when a learner is coming from their employer's system. + left_sidebar_text_override: '', }; return `${config.LMS_BASE_URL}/enterprise/grant_data_sharing_permissions/?${qs.stringify(enrollOptions)}`; } @@ -288,9 +291,7 @@ const useCourseEnrollmentUrl = ({ const enrollOptions = { ...baseEnrollmentOptions, sku, - // We don't want any sidebar text we show the data consent page from this workflow: - left_sidebar_text_override: '', - + consent_url_param_string: encodeURI('left_sidebar_text_override='), // Deliberately doubly encoded since it will get parsed on the redirect. }; // get the index of the first offer that applies to a catalog that the course is in const offerForCourse = findOfferForCourse(offers, catalogList); diff --git a/src/components/course/enrollment/common.jsx b/src/components/course/enrollment/common.jsx index 5af8548ee..5b70f2927 100644 --- a/src/components/course/enrollment/common.jsx +++ b/src/components/course/enrollment/common.jsx @@ -33,6 +33,6 @@ const EnrollButtonCta = ({ enrollLabel: EnrollLabel, ...props }) => ( ); -EnrollButtonCta.propTypes = { enrollLabel: PropTypes.shape.isRequired }; +EnrollButtonCta.propTypes = { enrollLabel: PropTypes.node.isRequired }; export { EnrollButtonCta }; diff --git a/src/components/course/enrollment/components/DisabledEnroll.jsx b/src/components/course/enrollment/components/DisabledEnroll.jsx index 862d2b8a5..d88da1d3b 100644 --- a/src/components/course/enrollment/components/DisabledEnroll.jsx +++ b/src/components/course/enrollment/components/DisabledEnroll.jsx @@ -12,7 +12,7 @@ const EnrollBtnDisabled = ({ enrollLabel }) => ( ); EnrollBtnDisabled.propTypes = { - enrollLabel: PropTypes.shape.isRequired, + enrollLabel: PropTypes.node.isRequired, }; export default EnrollBtnDisabled; diff --git a/src/components/course/enrollment/components/ToCoursewarePage.jsx b/src/components/course/enrollment/components/ToCoursewarePage.jsx index de5128647..fa904ae99 100644 --- a/src/components/course/enrollment/components/ToCoursewarePage.jsx +++ b/src/components/course/enrollment/components/ToCoursewarePage.jsx @@ -36,7 +36,7 @@ const ToCoursewarePage = ({ }; ToCoursewarePage.propTypes = { - enrollLabel: PropTypes.shape.isRequired, + enrollLabel: PropTypes.node.isRequired, enrollmentUrl: PropTypes.string.isRequired, userEnrollment: PropTypes.shape.isRequired, subscriptionLicense: PropTypes.shape.isRequired, diff --git a/src/components/course/enrollment/components/ToDataSharingConsent.jsx b/src/components/course/enrollment/components/ToDataSharingConsent.jsx index 5ac1947db..caf01454d 100644 --- a/src/components/course/enrollment/components/ToDataSharingConsent.jsx +++ b/src/components/course/enrollment/components/ToDataSharingConsent.jsx @@ -16,7 +16,7 @@ const ToDataSharingConsentPage = ({ enrollLabel, enrollmentUrl }) => ( ); ToDataSharingConsentPage.propTypes = { - enrollLabel: PropTypes.shape.isRequired, + enrollLabel: PropTypes.node.isRequired, enrollmentUrl: PropTypes.string.isRequired, }; diff --git a/src/components/course/enrollment/components/ToVoucherRedeemPage.jsx b/src/components/course/enrollment/components/ToVoucherRedeemPage.jsx index 9ac5ce3cc..4030effb3 100644 --- a/src/components/course/enrollment/components/ToVoucherRedeemPage.jsx +++ b/src/components/course/enrollment/components/ToVoucherRedeemPage.jsx @@ -29,7 +29,7 @@ const ToVoucherRedeemPage = ({ enrollLabel, enrollmentUrl }) => { ); }; ToVoucherRedeemPage.propTypes = { - enrollLabel: PropTypes.shape.isRequired, + enrollLabel: PropTypes.node.isRequired, enrollmentUrl: PropTypes.string.isRequired, }; diff --git a/src/components/course/enrollment/components/ViewOnDashboard.jsx b/src/components/course/enrollment/components/ViewOnDashboard.jsx index 24990c5d1..0db63738f 100644 --- a/src/components/course/enrollment/components/ViewOnDashboard.jsx +++ b/src/components/course/enrollment/components/ViewOnDashboard.jsx @@ -22,7 +22,7 @@ const ViewOnDashboard = ({ enrollLabel }) => { }; ViewOnDashboard.propTypes = { - enrollLabel: PropTypes.shape.isRequired, + enrollLabel: PropTypes.node.isRequired, }; export default ViewOnDashboard; diff --git a/src/components/enterprise-user-subsidy/OffersAlert.jsx b/src/components/enterprise-user-subsidy/OffersAlert.jsx index 137d47c63..e4b2d23cf 100644 --- a/src/components/enterprise-user-subsidy/OffersAlert.jsx +++ b/src/components/enterprise-user-subsidy/OffersAlert.jsx @@ -5,7 +5,7 @@ import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; import { faInfoCircle } from '@fortawesome/free-solid-svg-icons'; import { UserSubsidyContext } from '.'; -export const getOffersText = (number) => `You have ${number} enrollment codes${number > 1 ? 's' : ''} left to use.`; +export const getOffersText = (number) => `You have ${number} enrollment code${number > 1 ? 's' : ''} left to use.`; const OffersAlert = () => { const { offers } = useContext(UserSubsidyContext);