diff --git a/src/components/course/routes/ExternalCourseEnrollmentConfirmation.jsx b/src/components/course/routes/ExternalCourseEnrollmentConfirmation.jsx index d63c47f0e2..cdacc471a8 100644 --- a/src/components/course/routes/ExternalCourseEnrollmentConfirmation.jsx +++ b/src/components/course/routes/ExternalCourseEnrollmentConfirmation.jsx @@ -1,11 +1,14 @@ import { React, useContext } from 'react'; -import { Container } from '@edx/paragon'; +import { Button, Container, Hyperlink } from '@edx/paragon'; +import { AppContext } from '@edx/frontend-platform/react'; +import { getConfig } from '@edx/frontend-platform/config'; -import { useExternalEnrollmentFailureReason, useMinimalCourseMetadata } from '../data/hooks'; +import { useExternalEnrollmentFailureReason, useIsCourseAssigned, useMinimalCourseMetadata } from '../data/hooks'; import CourseSummaryCard from '../../executive-education-2u/components/CourseSummaryCard'; import EnrollmentCompletedSummaryCard from '../../executive-education-2u/components/EnrollmentCompletedSummaryCard'; import ErrorPageContent from '../../executive-education-2u/components/ErrorPageContent'; import { CourseContext } from '../CourseContextProvider'; +import { UserSubsidyContext } from '../../enterprise-user-subsidy'; const ExternalCourseEnrollmentConfirmation = () => { const courseMetadata = useMinimalCourseMetadata(); @@ -19,6 +22,20 @@ const ExternalCourseEnrollmentConfirmation = () => { failureMessage, } = useExternalEnrollmentFailureReason(); + const config = getConfig(); + const { + enterpriseConfig: { authOrgId, slug }, + } = useContext(AppContext); + const { redeemableLearnerCreditPolicies } = useContext(UserSubsidyContext); + const isCourseAssigned = useIsCourseAssigned(redeemableLearnerCreditPolicies?.learnerContentAssignments, course?.key); + const externalDashboardQueryParams = new URLSearchParams({ + org_id: authOrgId, + }); + const externalDashboardQueryString = externalDashboardQueryParams ? `?${externalDashboardQueryParams.toString()}` : ''; + const externalDashboardUrl = `${config.GETSMARTER_LEARNER_DASHBOARD_URL}${externalDashboardQueryString ?? ''}`; + const enterpriseSlug = `/${slug}`; + const dashboardUrl = `${config.BASE_URL}${enterpriseSlug}`; + const getStudnetTCUrl = config.GETSMARTER_STUDENT_TC_URL; return (
{failureReason ? ( @@ -28,13 +45,25 @@ const ExternalCourseEnrollmentConfirmation = () => { failureMessage={failureMessage} /> ) : ( - +

Congratulations, you have completed your enrollment for your online course

+ - +
)}
diff --git a/src/components/executive-education-2u/EnrollmentCompleted.test.jsx b/src/components/executive-education-2u/EnrollmentCompleted.test.jsx index b623d48790..980524de64 100644 --- a/src/components/executive-education-2u/EnrollmentCompleted.test.jsx +++ b/src/components/executive-education-2u/EnrollmentCompleted.test.jsx @@ -111,10 +111,4 @@ describe('EnrollmentCompleted', () => { expect(screen.getByText(8)).toBeInTheDocument(); expect(screen.getByText('Start date:')).toBeInTheDocument(); }); - it('renders get smarter learner dashboard URL on enrollment.', () => { - renderWithRouter(); - expect( - screen.getByRole('link', { name: 'GetSmarter learner dashboard in a new tab' }), - ).toHaveAttribute('href', 'https://getsmarter.example.com/account?org_id=test-enterprise-slug'); - }); }); diff --git a/src/components/executive-education-2u/components/EnrollmentCompletedSummaryCard.jsx b/src/components/executive-education-2u/components/EnrollmentCompletedSummaryCard.jsx index d0a3ef2b29..4746a82788 100644 --- a/src/components/executive-education-2u/components/EnrollmentCompletedSummaryCard.jsx +++ b/src/components/executive-education-2u/components/EnrollmentCompletedSummaryCard.jsx @@ -1,85 +1,75 @@ -import React, { useContext } from 'react'; +import React from 'react'; import PropTypes from 'prop-types'; import { Card, Col, Hyperlink, Row, } from '@edx/paragon'; -import { getConfig } from '@edx/frontend-platform/config'; -import { AppContext } from '@edx/frontend-platform/react'; import GetSmarterLogo from '../../../assets/icons/get-smarter-logo-black.svg'; -import { UserSubsidyContext } from '../../enterprise-user-subsidy'; -import { useIsCourseAssigned } from '../../course/data/hooks'; import { features } from '../../../config'; -const EnrollmentCompletedSummaryCard = ({ courseKey }) => { - const config = getConfig(); - const { - enterpriseConfig: { authOrgId, slug }, - } = useContext(AppContext); - const { redeemableLearnerCreditPolicies } = useContext(UserSubsidyContext); - const isCourseAssigned = useIsCourseAssigned(redeemableLearnerCreditPolicies?.learnerContentAssignments, courseKey); - const externalDashboardQueryParams = new URLSearchParams({ org_id: authOrgId }); - const externalDashboardQueryString = externalDashboardQueryParams ? `?${externalDashboardQueryParams.toString()}` : ''; - const externalDashboardUrl = `${config.GETSMARTER_LEARNER_DASHBOARD_URL}${externalDashboardQueryString ?? ''}`; - const enterpriseSlug = `/${slug}`; - const dashboardUrl = `${config.BASE_URL}${enterpriseSlug}`; - - return ( - - - - - partner-header-logo - - - - -
What happens next?
-
-
Notified by email
-
- GetSmarter will email you when your course starts. Alternatively, you can visit your{' '} - - {(features.FEATURE_ENABLE_TOP_DOWN_ASSIGNMENT && isCourseAssigned) ? 'edX dashboard' : 'GetSmarter learner dashboard'} - - {' '}for course status updates. -
+const EnrollmentCompletedSummaryCard = ({ + isCourseAssigned, + externalDashboardUrl, + dashboardUrl, + getStudnetTCUrl, +}) => ( + + + + + partner-header-logo + + + + +
What happens next?
+
+
Notified by email
+
+ GetSmarter will email you when your course starts. Alternatively, you can visit your{' '} + + {(features.FEATURE_ENABLE_TOP_DOWN_ASSIGNMENT && isCourseAssigned) ? 'edX dashboard' : 'GetSmarter learner dashboard'} + + {' '}for course status updates. +
+
+
+
Read the refund policy
+
+ As part of our commitment to your professional development, you may request to change + your course start date or request your money back if you're not fully satisfied with + 14 calendar days of your course start date.
-
-
Read the refund policy
-
- As part of our commitment to your professional development, you may request to change - your course start date or request your money back if you're not fully satisfied with - 14 calendar days of your course start date. -
-
- Read GetSmarter's{' '} - - Terms and Conditions - +
+ Read GetSmarter's{' '} + + Terms and Conditions +  for the full course postponement and cancellation policy. -
- - - - - ); -}; +
+ + + + +); EnrollmentCompletedSummaryCard.propTypes = { - courseKey: PropTypes.string.isRequired, + isCourseAssigned: PropTypes.bool.isRequired, + externalDashboardUrl: PropTypes.string.isRequired, + dashboardUrl: PropTypes.string.isRequired, + getStudnetTCUrl: PropTypes.string.isRequired, }; export default EnrollmentCompletedSummaryCard;