@edx/frontend-app-subscription-learner-dashboard 1.16.0 → 1.17.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/containers/ProgramDashboard/ProgramProgress/InProgressTabData/index.d.ts +2 -0
- package/dist/containers/ProgramDashboard/ProgramProgress/InProgressTabData/index.js +39 -0
- package/dist/containers/ProgramDashboard/ProgramProgress/InProgressTabData/index.js.map +1 -0
- package/dist/containers/ProgramDashboard/ProgramProgress/ProgramProgressTabs/index.js +2 -1
- package/dist/containers/ProgramDashboard/ProgramProgress/ProgramProgressTabs/index.js.map +1 -1
- package/dist/containers/ProgramDashboard/ProgramProgress/ProgressCard/index.js +20 -2
- package/dist/containers/ProgramDashboard/ProgramProgress/ProgressCard/index.js.map +1 -1
- package/dist/containers/ProgramDashboard/ProgramProgress/ProgressCardActions/ProgressCardButton.js +15 -6
- package/dist/containers/ProgramDashboard/ProgramProgress/ProgressCardActions/ProgressCardButton.js.map +1 -1
- package/dist/containers/ProgramDashboard/ProgramProgress/ProgressCardActions/index.js +5 -2
- package/dist/containers/ProgramDashboard/ProgramProgress/ProgressCardActions/index.js.map +1 -1
- package/dist/containers/ProgramDashboard/ProgramProgress/index.scss +6 -0
- package/dist/containers/ProgramDashboard/ProgramProgress/messages.d.ts +45 -0
- package/dist/containers/ProgramDashboard/ProgramProgress/messages.js +45 -0
- package/dist/containers/ProgramDashboard/ProgramProgress/messages.js.map +1 -1
- package/dist/containers/ProgramDashboard/data/util.d.ts +14 -0
- package/dist/containers/ProgramDashboard/data/util.js +26 -0
- package/dist/containers/ProgramDashboard/data/util.js.map +1 -1
- package/dist/data/services/subs/urls.d.ts +1 -0
- package/dist/data/services/subs/urls.js +1 -1
- package/dist/data/services/subs/urls.js.map +1 -1
- package/dist/routes.d.ts +2 -3
- package/dist/routes.js +28 -3
- package/dist/routes.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useProgressData } from '../../../../hooks';
|
|
3
|
+
import { useIntl } from '@openedx/frontend-base';
|
|
4
|
+
import { ProgressCard } from '../ProgressCard';
|
|
5
|
+
import messages from '../messages';
|
|
6
|
+
export const InProgressTabData = () => {
|
|
7
|
+
var _a, _b, _c, _d;
|
|
8
|
+
const { programProgressData, isLoading } = useProgressData();
|
|
9
|
+
const { formatMessage } = useIntl();
|
|
10
|
+
const courseData = programProgressData === null || programProgressData === void 0 ? void 0 : programProgressData.courseData;
|
|
11
|
+
const remainingCount = ((_a = courseData === null || courseData === void 0 ? void 0 : courseData.notStarted) === null || _a === void 0 ? void 0 : _a.length) || 0;
|
|
12
|
+
const inProgressData = (courseData === null || courseData === void 0 ? void 0 : courseData.inProgress) || [];
|
|
13
|
+
const completedCount = ((_b = courseData === null || courseData === void 0 ? void 0 : courseData.completed) === null || _b === void 0 ? void 0 : _b.length) || 0;
|
|
14
|
+
const inProgressCount = inProgressData.length;
|
|
15
|
+
const programType = ((_c = programProgressData === null || programProgressData === void 0 ? void 0 : programProgressData.programData) === null || _c === void 0 ? void 0 : _c.type) || '';
|
|
16
|
+
const checkoutUrl = ((_d = programProgressData === null || programProgressData === void 0 ? void 0 : programProgressData.urls) === null || _d === void 0 ? void 0 : _d.buyButtonUrl) || '';
|
|
17
|
+
const inProgressTabType = formatMessage(messages.programProgressInProgressTab).toLowerCase();
|
|
18
|
+
const shouldShowRemainingMessage = !inProgressCount && remainingCount > 0;
|
|
19
|
+
const shouldShowCompletedMessage = !inProgressCount && !remainingCount && completedCount > 0;
|
|
20
|
+
const progressCards = inProgressData.map((course) => {
|
|
21
|
+
const courseRuns = course.courseRuns || [];
|
|
22
|
+
const [{ pacingType = '', start = '', end = '', courseUrl = '', upgradeUrl = '', seats = [] } = {}] = Array.isArray(courseRuns) ? courseRuns : [];
|
|
23
|
+
const progressCardData = {
|
|
24
|
+
title: course.title,
|
|
25
|
+
start: start,
|
|
26
|
+
end: end || '',
|
|
27
|
+
pacingType: pacingType,
|
|
28
|
+
courseUrl: courseUrl || '',
|
|
29
|
+
upgradeUrl: upgradeUrl || '',
|
|
30
|
+
programType: programType || '',
|
|
31
|
+
checkoutUrl: checkoutUrl || '',
|
|
32
|
+
seats: seats || [],
|
|
33
|
+
expired: course.expired || false, // using expired from course object to determine if the course is expired as per condition on confluence and learners dashboard code.
|
|
34
|
+
};
|
|
35
|
+
return (_jsx(ProgressCard, { progressCardData: progressCardData, isLoading: isLoading, tabType: inProgressTabType }, course.key));
|
|
36
|
+
});
|
|
37
|
+
return (_jsxs("div", { children: [_jsx("h5", { children: formatMessage(messages.programProgressInProgressCourse) }), inProgressCount > 0 ? (progressCards) : shouldShowRemainingMessage ? (_jsx("p", { children: formatMessage(messages.programProgressInProgressRemainingCourses) })) : shouldShowCompletedMessage ? (_jsx("p", { children: formatMessage(messages.programProgressInProgressCompletedCourses) })) : null] }));
|
|
38
|
+
};
|
|
39
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/containers/ProgramDashboard/ProgramProgress/InProgressTabData/index.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAEjD,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,QAAQ,MAAM,aAAa,CAAC;AAEnC,MAAM,CAAC,MAAM,iBAAiB,GAAO,GAAG,EAAE;;IACxC,MAAM,EAAE,mBAAmB,EAAE,SAAS,EAAE,GAAG,eAAe,EAAE,CAAC;IAE7D,MAAM,EAAE,aAAa,EAAE,GAAG,OAAO,EAAE,CAAC;IACpC,MAAM,UAAU,GAAG,mBAAmB,aAAnB,mBAAmB,uBAAnB,mBAAmB,CAAE,UAAU,CAAC;IACnD,M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,CAAC,CAAC,CAAC,EAAE,CAAC;QAElJ,MAAM,gBAAgB,GAAG;YACvB,KAAK,EAAE,MAAM,CAAC,KAAK;YACnB,KAAK,EAAE,KAAK;YACZ,GAAG,EAAE,GAAG,IAAI,EAAE;YACd,UAAU,EAAE,UAAU;YACtB,SAAS,EAAE,SAAS,IAAI,EAAE;YAC1B,UAAU,EAAE,UAAU,IAAI,EAAE;YAC5B,WAAW,EAAE,WAAW,IAAI,EAAE;YAC9B,WAAW,EAAE,WAAW,IAAI,EAAE;YAC9B,KAAK,EAAE,KAAK,IAAI,EAAE;YAClB,OAAO,EAAE,MAAM,CAAC,OAAO,IAAI,KAAK,EAAE,qIAAqI;SACxK,CAAC;QAEF,OAAO,CACL,KAAC,YAAY,IAEX,gBAAgB,EAAE,gBAAgB,EAClC,SAAS,EAAE,SAAS,EACpB,OAAO,EAAE,iBAAiB,IAHrB,MAAM,CAAC,GAAG,CAIf,CACH,CAAC;IACJ,CAAC,CAAC,CAAC;IAEH,OAAO,CACL,0BACE,uBAAK,aAAa,CAAC,QAAQ,CAAC,+BAA+B,CAAC,GAAM,EACjE,eAAe,GAAG,CAAC,CAAC,CAAC,CAAC,CACrB,aAAa,CACd,CAAC,CAAC,CAAC,0BAA0B,CAAC,CAAC,CAAC,CAC/B,sBAAI,aAAa,CAAC,QAAQ,CAAC,yCAAyC,CAAC,GAAK,CAC3E,CAAC,CAAC,CAAC,0BAA0B,CAAC,CAAC,CAAC,CAC/B,sBAAI,aAAa,CAAC,QAAQ,CAAC,yCAAyC,CAAC,GAAK,CAC3E,CAAC,CAAC,CAAC,IAAI,IACJ,CACP,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import { FC } from 'react';\nimport { useProgressData } from '@src/hooks';\nimport { useIntl } from '@openedx/frontend-base';\n\nimport { ProgressCard } from '../ProgressCard';\nimport messages from '../messages';\n\nexport const InProgressTabData: FC = () => {\n const { programProgressData, isLoading } = useProgressData();\n\n const { formatMessage } = useIntl();\n const courseData = programProgressData?.courseData;\n const remainingCount = courseData?.notStarted?.length || 0;\n const inProgressData = courseData?.inProgress || [];\n const completedCount = courseData?.completed?.length || 0;\n const inProgressCount = inProgressData.length;\n const programType = programProgressData?.programData?.type || '';\n const checkoutUrl = programProgressData?.urls?.buyButtonUrl || '';\n const inProgressTabType = formatMessage(messages.programProgressInProgressTab).toLowerCase();\n\n const shouldShowRemainingMessage = !inProgressCount && remainingCount > 0;\n const shouldShowCompletedMessage = !inProgressCount && !remainingCount && completedCount > 0;\n\n const progressCards = inProgressData.map((course) => {\n const courseRuns = course.courseRuns || [];\n const [{ pacingType = '', start = '', end = '', courseUrl = '', upgradeUrl = '', seats = [] } = {}] = Array.isArray(courseRuns) ? courseRuns : [];\n\n const progressCardData = {\n title: course.title,\n start: start,\n end: end || '',\n pacingType: pacingType,\n courseUrl: courseUrl || '',\n upgradeUrl: upgradeUrl || '',\n programType: programType || '',\n checkoutUrl: checkoutUrl || '',\n seats: seats || [],\n expired: course.expired || false, // using expired from course object to determine if the course is expired as per condition on confluence and learners dashboard code.\n };\n\n return (\n <ProgressCard\n key={course.key}\n progressCardData={progressCardData}\n isLoading={isLoading}\n tabType={inProgressTabType}\n />\n );\n });\n\n return (\n <div>\n <h5>{formatMessage(messages.programProgressInProgressCourse)}</h5>\n {inProgressCount > 0 ? (\n progressCards\n ) : shouldShowRemainingMessage ? (\n <p>{formatMessage(messages.programProgressInProgressRemainingCourses)}</p>\n ) : shouldShowCompletedMessage ? (\n <p>{formatMessage(messages.programProgressInProgressCompletedCourses)}</p>\n ) : null}\n </div>\n );\n};\n"]}
|
|
@@ -5,6 +5,7 @@ import { useIntl } from '@openedx/frontend-base';
|
|
|
5
5
|
import messages from '../messages';
|
|
6
6
|
import { RemainingTabData } from '../RemainingTabData';
|
|
7
7
|
import { CompletedTabData } from '../CompletedTabData';
|
|
8
|
+
import { InProgressTabData } from '../InProgressTabData';
|
|
8
9
|
export const ProgramProgressTabs = ({ type, counts }) => {
|
|
9
10
|
const { inProgress, remaining, completed } = counts;
|
|
10
11
|
const { formatMessage } = useIntl();
|
|
@@ -13,7 +14,7 @@ export const ProgramProgressTabs = ({ type, counts }) => {
|
|
|
13
14
|
key: 'in-progress',
|
|
14
15
|
title: formatMessage(messages.programProgressInProgressTab),
|
|
15
16
|
count: inProgress,
|
|
16
|
-
panel: _jsx(
|
|
17
|
+
panel: _jsx(InProgressTabData, {}),
|
|
17
18
|
},
|
|
18
19
|
{
|
|
19
20
|
key: 'remaining',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/containers/ProgramDashboard/ProgramProgress/ProgramProgressTabs/index.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAM,QAAQ,EAAE,MAAM,OAAO,CAAC;AACrC,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAGjD,OAAO,QAAQ,MAAM,aAAa,CAAC;AACnC,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/containers/ProgramDashboard/ProgramProgress/ProgramProgressTabs/index.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAM,QAAQ,EAAE,MAAM,OAAO,CAAC;AACrC,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAGjD,OAAO,QAAQ,MAAM,aAAa,CAAC;AACnC,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAEzD,MAAM,CA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AAI,IACH,EAAE,EAAC,uBAAuB,EAC1B,SAAS,EAAE,SAAS,EACpB,QAAQ,EAAE,eAAe,EACzB,SAAS,EAAC,MAAM,EAChB,YAAY,kBAEX,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,CACnB,KAAC,GAAG,IAAC,QAAQ,EAAE,GAAG,CAAC,GAAG,EAAgB,KAAK,EAAE,GAAG,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,KAAK,KAAK,GAAG,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,YAC7G,GAAG,CAAC,KAAK,IADiB,GAAG,CAAC,GAAG,CAE9B,CACP,CAAC,GACG,CACR,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import { FC, useState } from 'react';\nimport { Tabs, Tab } from '@openedx/paragon';\nimport { useIntl } from '@openedx/frontend-base';\n\nimport { ProgramProgressTabsProps, ProgramProgressTabItems } from '../../data/types';\nimport messages from '../messages';\nimport { RemainingTabData } from '../RemainingTabData';\nimport { CompletedTabData } from '../CompletedTabData';\nimport { InProgressTabData } from '../InProgressTabData';\n\nexport const ProgramProgressTabs: FC<ProgramProgressTabsProps> = ({ type, counts }) => {\n const { inProgress, remaining, completed } = counts;\n const { formatMessage } = useIntl();\n\n const tabsData: ProgramProgressTabItems[] = [\n {\n key: 'in-progress',\n title: formatMessage(messages.programProgressInProgressTab),\n count: inProgress,\n panel: <InProgressTabData />,\n },\n {\n key: 'remaining',\n title: formatMessage(messages.programProgressRemainingTab),\n count: remaining,\n panel: <RemainingTabData />,\n },\n {\n key: 'completed',\n title: formatMessage(messages.programProgressCompletedTab),\n count: completed,\n panel: <CompletedTabData />,\n },\n ...(type?.toLowerCase() === 'micromasters'\n ? [{\n key: 'pathways',\n title: formatMessage(messages.programProgressPathwaysTab),\n panel: <span>Pathways tab data will be available soon.</span>,\n }]\n : []),\n ];\n\n const [activeTab, setActiveTab] = useState<string>(tabsData[0].key);\n\n const handleTabSelect = (tabKey: string | null) => {\n if (tabKey) setActiveTab(tabKey);\n };\n\n return (\n <Tabs\n id=\"program-progress-tabs\"\n activeKey={activeTab}\n onSelect={handleTabSelect}\n className=\"mb-4\"\n mountOnEnter\n >\n {tabsData.map(tab => (\n <Tab eventKey={tab.key} key={tab.key} title={tab.count !== undefined ? `${tab.title} (${tab.count})` : tab.title}>\n {tab.panel}\n </Tab>\n ))}\n </Tabs>\n );\n};\n"]}
|
|
@@ -6,9 +6,15 @@ import './index.scss';
|
|
|
6
6
|
import { ProgressCardActions } from '../ProgressCardActions';
|
|
7
7
|
import { dateFormatter } from '../../../../utils/dateFormatter';
|
|
8
8
|
import { ProgressCardButton } from '../ProgressCardActions/ProgressCardButton';
|
|
9
|
+
import { PROGRAM_TYPE_MAP } from '../../data/constants';
|
|
10
|
+
import { getCertificatePriceString } from '../../data/util';
|
|
9
11
|
export const ProgressCard = ({ progressCardData, isLoading, tabType }) => {
|
|
10
12
|
const { formatMessage, formatDate } = useIntl();
|
|
11
|
-
const { title, pacingType, start, end, certificateUrl, courseUrl } = progressCardData;
|
|
13
|
+
const { title, pacingType, start, end, certificateUrl, courseUrl, upgradeUrl, programType, checkoutUrl, expired, seats } = progressCardData;
|
|
14
|
+
const inProgressTabKey = formatMessage(messages.programProgressInProgressTab).toLowerCase();
|
|
15
|
+
const isInProgressTab = tabType === inProgressTabKey;
|
|
16
|
+
const isProfessionalProgram = programType === PROGRAM_TYPE_MAP.PROFESSIONAL_CERTIFICATE;
|
|
17
|
+
const isMicroMastersProgram = programType === PROGRAM_TYPE_MAP.MICROMASTERS;
|
|
12
18
|
/*
|
|
13
19
|
- Formatting pacing type safely
|
|
14
20
|
- replace underscores with spaces
|
|
@@ -30,8 +36,20 @@ export const ProgressCard = ({ progressCardData, isLoading, tabType }) => {
|
|
|
30
36
|
? `${enrollmentInfo} ${formatMessage(messages.programProgressCardStartText)} ${startDate}`
|
|
31
37
|
: `${formatMessage(messages.programProgressCardStartText)} ${startDate}`;
|
|
32
38
|
}
|
|
39
|
+
// using expired key from course object to determine if the course is expired as per condition on confluence and learners dashboard code.
|
|
40
|
+
const canUpgrade = Boolean(upgradeUrl) && !expired;
|
|
33
41
|
return (_jsx(Card, { className: "progress-card mb-3", "data-testid": "progress-card", isLoading: isLoading, children: _jsxs(Card.Section, { className: "pt-3 pb-2 px-4", children: [_jsxs(Row, { className: "mb-2", children: [_jsxs(Col, { xs: 12, children: [_jsx("h4", { className: "mb-1 font-weight-bold", children: title }), _jsx("div", { className: "text-muted", children: enrollmentInfo })] }), _jsx(ProgressCardActions, { tabType: tabType, redirectUrl: courseUrl })] }), tabType === (formatMessage(messages.programProgressCompletedTab).toLowerCase()) && (_jsx(Row, { className: "pt-3 pb-2 px-2 border-top border-2 border-muted mb-2 align-items-center", children: _jsxs(Col, { xs: 12, className: "d-flex justify-content-between align-items-center px-0", children: [_jsx("span", { className: "text-start", children: end && (formatMessage(messages.programProgressCardCompletedCertificateText, {
|
|
34
42
|
certificateDate: (end ? dateFormatter(formatDate, end, 'short') : ''),
|
|
35
|
-
})) }), _jsx(ProgressCardButton, { variant: "brand", redirectUrl: certificateUrl || '', buttonText: formatMessage(messages.programProgressCardCompletedCertificateButton) })] }) }))
|
|
43
|
+
})) }), _jsx(ProgressCardButton, { variant: "brand", redirectUrl: certificateUrl || '', buttonText: formatMessage(messages.programProgressCardCompletedCertificateButton) })] }) })), isInProgressTab && (_jsx(Row, { className: "pt-3 pb-2 px-2 border-top border-2 border-muted mb-2 align-items-center", children: _jsxs(Col, { xs: 12, className: "d-flex justify-content-between align-items-center px-0", children: [_jsx("span", { className: "text-start", children: formatMessage(messages.programProgressInProgressCertificateStatus, {
|
|
44
|
+
status: canUpgrade ? formatMessage(messages.programProgressInProgressCertificateNeedsVerified) : formatMessage(messages.programProgressInProgressCertificateNotEarned), // TODO : Certificate status will change after Upgrade is successful through api
|
|
45
|
+
}) }), isProfessionalProgram
|
|
46
|
+
&& canUpgrade
|
|
47
|
+
&& getCertificatePriceString(seats)
|
|
48
|
+
&& (_jsx(ProgressCardButton, { variant: "brand", redirectUrl: "", buttonText: formatMessage(messages.programProgressCardUpgradeButton), type: "upgrade", title: title, price: getCertificatePriceString(seats), courseUrl: courseUrl })), isMicroMastersProgram
|
|
49
|
+
&& checkoutUrl
|
|
50
|
+
&& canUpgrade
|
|
51
|
+
&& (_jsx(ProgressCardButton, { variant: "brand", redirectUrl: checkoutUrl, buttonText: formatMessage(messages.programProgressInProgressCourseMicromastersUpgrade, {
|
|
52
|
+
price: getCertificatePriceString(seats, true),
|
|
53
|
+
}) }))] }) }))] }) }));
|
|
36
54
|
};
|
|
37
55
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/containers/ProgramDashboard/ProgramProgress/ProgressCard/index.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAGjD,OAAO,QAAQ,MAAM,aAAa,CAAC;AACnC,OAAO,cAAc,CAAC;AACtB,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAC7D,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,EAAE,kBAAkB,EAAE,MAAM,2CAA2C,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/containers/ProgramDashboard/ProgramProgress/ProgressCard/index.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAGjD,OAAO,QAAQ,MAAM,aAAa,CAAC;AACnC,OAAO,cAAc,CAAC;AACtB,OAAO,EAAE,mBAAmB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rF,KAAK,EAAE,yBAAyB,CAAC,KAAK,EAAE,IAAI,CAAC;qCAC9C,CAAC,GACF,CACH,IACG,GACF,CACP,IAEY,GACV,CACR,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import { FC } from 'react';\nimport { Card, Row, Col } from '@openedx/paragon';\nimport { useIntl } from '@openedx/frontend-base';\n\nimport { ProgressCardProps } from '../../data/types';\nimport messages from '../messages';\nimport './index.scss';\nimport { ProgressCardActions } from '../ProgressCardActions';\nimport { dateFormatter } from '@src/utils/dateFormatter';\nimport { ProgressCardButton } from '../ProgressCardActions/ProgressCardButton';\nimport { PROGRAM_TYPE_MAP } from '../../data/constants';\nimport { getCertificatePriceString } from '../../data/util';\n\nexport const ProgressCard: FC<ProgressCardProps> = ({ progressCardData, isLoading, tabType }) => {\n const { formatMessage, formatDate } = useIntl();\n\n const { title, pacingType, start, end, certificateUrl, courseUrl, upgradeUrl, programType, checkoutUrl, expired, seats } = progressCardData;\n\n const inProgressTabKey = formatMessage(messages.programProgressInProgressTab).toLowerCase();\n const isInProgressTab = tabType === inProgressTabKey;\n const isProfessionalProgram = programType === PROGRAM_TYPE_MAP.PROFESSIONAL_CERTIFICATE;\n const isMicroMastersProgram = programType === PROGRAM_TYPE_MAP.MICROMASTERS;\n /*\n - Formatting pacing type safely\n - replace underscores with spaces\n - capitalize first letter of each word\n - example: 'self_paced' -> 'Self Paced'\n */\n const formattedPacing = pacingType\n ? pacingType.replace(/_/g, ' ').replace(/\\b\\w/g, c => c.toUpperCase())\n : '';\n\n // base string\n let enrollmentInfo = tabType !== 'remaining' ? formatMessage(messages.programProgressCardEnrollText) : '';\n\n if (formattedPacing) {\n enrollmentInfo += `${enrollmentInfo ? ' ' : ''}(${formattedPacing})`;\n }\n\n // add start date if exists\n if (start) {\n const startDate = dateFormatter(formatDate, start, 'short');\n\n enrollmentInfo = enrollmentInfo\n ? `${enrollmentInfo} ${formatMessage(messages.programProgressCardStartText)} ${startDate}`\n : `${formatMessage(messages.programProgressCardStartText)} ${startDate}`;\n }\n\n // using expired key from course object to determine if the course is expired as per condition on confluence and learners dashboard code.\n const canUpgrade = Boolean(upgradeUrl) && !expired;\n return (\n <Card className=\"progress-card mb-3\" data-testid=\"progress-card\" isLoading={isLoading}>\n <Card.Section className=\"pt-3 pb-2 px-4\">\n <Row className=\"mb-2\">\n <Col xs={12}>\n <h4 className=\"mb-1 font-weight-bold\">{title}</h4>\n <div className=\"text-muted\">\n {enrollmentInfo}\n </div>\n </Col>\n <ProgressCardActions tabType={tabType} redirectUrl={courseUrl} />\n </Row>\n\n {tabType === (formatMessage(messages.programProgressCompletedTab).toLowerCase()) && (\n <Row className=\"pt-3 pb-2 px-2 border-top border-2 border-muted mb-2 align-items-center\">\n <Col xs={12} className=\"d-flex justify-content-between align-items-center px-0\">\n <span className=\"text-start\">\n {end && (\n formatMessage(messages.programProgressCardCompletedCertificateText, {\n certificateDate: (end ? dateFormatter(formatDate, end, 'short') : ''),\n })\n )}\n </span>\n\n <ProgressCardButton variant=\"brand\" redirectUrl={certificateUrl || ''} buttonText={formatMessage(messages.programProgressCardCompletedCertificateButton)} />\n </Col>\n </Row>\n )}\n\n {isInProgressTab && (\n <Row className=\"pt-3 pb-2 px-2 border-top border-2 border-muted mb-2 align-items-center\">\n <Col xs={12} className=\"d-flex justify-content-between align-items-center px-0\">\n {/* TODO : Certificate status will change after Upgrade is successful through api */}\n <span className=\"text-start\">\n {formatMessage(messages.programProgressInProgressCertificateStatus, {\n status: canUpgrade ? formatMessage(messages.programProgressInProgressCertificateNeedsVerified) : formatMessage(messages.programProgressInProgressCertificateNotEarned), // TODO : Certificate status will change after Upgrade is successful through api\n })}\n </span>\n\n {isProfessionalProgram\n && canUpgrade\n && getCertificatePriceString(seats)\n && (\n <ProgressCardButton\n variant=\"brand\"\n redirectUrl=\"\"\n buttonText={formatMessage(messages.programProgressCardUpgradeButton)}\n type=\"upgrade\"\n title={title}\n price={getCertificatePriceString(seats)}\n courseUrl={courseUrl}\n />\n )}\n {isMicroMastersProgram\n && checkoutUrl\n && canUpgrade\n && (\n <ProgressCardButton\n variant=\"brand\"\n redirectUrl={checkoutUrl}\n buttonText={formatMessage(messages.programProgressInProgressCourseMicromastersUpgrade, {\n price: getCertificatePriceString(seats, true),\n })}\n />\n )}\n </Col>\n </Row>\n )}\n\n </Card.Section>\n </Card>\n );\n};\n"]}
|
package/dist/containers/ProgramDashboard/ProgramProgress/ProgressCardActions/ProgressCardButton.js
CHANGED
|
@@ -1,9 +1,18 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { Button } from '@openedx/paragon';
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { Button, StandardModal, useToggle, ActionRow } from '@openedx/paragon';
|
|
3
|
+
import { useIntl } from '@openedx/frontend-base';
|
|
3
4
|
import { Link } from 'react-router-dom';
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
import messages from '../messages';
|
|
6
|
+
export const ProgressCardButton = ({ variant, redirectUrl, buttonText, type, title, price, courseUrl }) => {
|
|
7
|
+
const [isOpen, open, close] = useToggle(false);
|
|
8
|
+
const { formatMessage } = useIntl();
|
|
9
|
+
const isUpgradeButton = type === 'upgrade' && courseUrl; // TODO : Check needs to be added to open this modal only when Upgrade api is as success
|
|
10
|
+
if (redirectUrl) {
|
|
11
|
+
return (_jsx(Button, { variant: variant, as: Link, to: redirectUrl, children: buttonText }));
|
|
12
|
+
}
|
|
13
|
+
if (isUpgradeButton) {
|
|
14
|
+
return (_jsxs(_Fragment, { children: [_jsx(Button, { variant: variant, onClick: open, children: buttonText }), _jsx(StandardModal, { title: formatMessage(messages.programProgressInProgressCourseProfessionalUpgradeModalTitle, { title }), isOpen: isOpen, onClose: close, hasCloseButton: false, className: "program-progress-upgrade-modal", footerNode: (_jsxs(ActionRow, { children: [_jsx(Button, { variant: "tertiary", onClick: close, children: "Close" }), _jsx(Button, { as: Link, to: courseUrl, variant: "brand", "data-testid": "action-row-btn", children: formatMessage(messages.programProgressCardResumeCourseButton) })] })), isOverflowVisible: false, children: _jsx("p", { children: formatMessage(messages.programProgressInProgressCourseProfessionalUpgradeModalContent, { price }) }) })] }));
|
|
15
|
+
}
|
|
16
|
+
return (_jsx(Button, { variant: variant, children: buttonText }));
|
|
8
17
|
};
|
|
9
18
|
//# sourceMappingURL=ProgressCardButton.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProgressCardButton.js","sourceRoot":"","sources":["../../../../../src/containers/ProgramDashboard/ProgramProgress/ProgressCardActions/ProgressCardButton.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"ProgressCardButton.js","sourceRoot":"","sources":["../../../../../src/containers/ProgramDashboard/ProgramProgress/ProgressCardActions/ProgressCardButton.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC/E,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAGxC,OAAO,QAAQ,MAAM,aAAa,CAAC;AAEnC,MAAM,CAAC,MAAM,kBAAkB,GAAgC,CAAC,EAAE,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,EAAE,EAAE;IACrI,MAAM,CAAC,MAAM,EAAE,IAAI,EAAE,KAAK,CAAC,GAAG,SAAS,CAAC,KAAK,CAAC,CAAC;IAC/C,MAAM,EAAE,aAAa,EAAE,GAAG,OAAO,EAAE,CAAC;IACpC,MAAM,eAAe,GAAG,IAAI,KAAK,SAAS,IAAI,SAAS,CAAC,CAAC,wFAAwF;IAEjJ,IAAI,WAAW,EAAE,CAAC;QAChB,OAAO,CACL,KAAC,MAAM,IAAC,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,WAAW,YAChD,UAAU,GACJ,CACV,CAAC;IACJ,CAAC;IAED,IAAI,eAAe,EAAE,CAAC;QACpB,OAAO,CACL,8BAGE,KAAC,MAAM,IAAC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,YAAG,UAAU,GAAU,EAC9D,KAAC,aAAa,IACZ,KAAK,EAAE,aAAa,CAAC,QAAQ,CAAC,4DAA4D,EAAE,EAAE,KAAK,EAAE,CAAC,EACtG,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,KAAK,EACd,cAAc,EAAE,KAAK,EACrB,SAAS,EAAC,gCAAgC,EAC1C,UAAU,EAAE,CACV,MAAC,SAAS,eACR,KAAC,MAAM,IAAC,OAAO,EAAC,UAAU,EAAC,OAAO,EAAE,KAAK,sBAAgB,EACzD,KAAC,MAAM,IACL,EAAE,EAAE,IAAI,EACR,EAAE,EAAE,SAAU,EACd,OAAO,EAAC,OAAO,iBACH,gBAAgB,YAE3B,aAAa,CAAC,QAAQ,CAAC,qCAAqC,CAAC,GACvD,IACC,CACb,EACD,iBAAiB,EAAE,KAAK,YAExB,sBACG,aAAa,CAAC,QAAQ,CAAC,8DAA8D,EAAE,EAAE,KAAK,EAAE,CAAC,GAChG,GACU,IACf,CACJ,CAAC;IACJ,CAAC;IAED,OAAO,CACL,KAAC,MAAM,IAAC,OAAO,EAAE,OAAO,YACrB,UAAU,GACJ,CACV,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import { FC } from 'react';\nimport { Button, StandardModal, useToggle, ActionRow } from '@openedx/paragon';\nimport { useIntl } from '@openedx/frontend-base';\nimport { Link } from 'react-router-dom';\n\nimport { ProgressCardButtonProps } from '../../data/types';\nimport messages from '../messages';\n\nexport const ProgressCardButton: FC<ProgressCardButtonProps> = ({ variant, redirectUrl, buttonText, type, title, price, courseUrl }) => {\n const [isOpen, open, close] = useToggle(false);\n const { formatMessage } = useIntl();\n const isUpgradeButton = type === 'upgrade' && courseUrl; // TODO : Check needs to be added to open this modal only when Upgrade api is as success\n\n if (redirectUrl) {\n return (\n <Button variant={variant} as={Link} to={redirectUrl}>\n {buttonText}\n </Button>\n );\n }\n\n if (isUpgradeButton) {\n return (\n <>\n {/* TODO rerender the page after upgrade. This is the modal after clicking the upgrade button and the upgrade is successful.\n Also, work is needed on what should happen if the upgrade fails, once confirmed */}\n <Button variant={variant} onClick={open}>{buttonText}</Button>\n <StandardModal\n title={formatMessage(messages.programProgressInProgressCourseProfessionalUpgradeModalTitle, { title })}\n isOpen={isOpen}\n onClose={close}\n hasCloseButton={false}\n className=\"program-progress-upgrade-modal\"\n footerNode={(\n <ActionRow>\n <Button variant=\"tertiary\" onClick={close}>Close</Button>\n <Button\n as={Link}\n to={courseUrl!}\n variant=\"brand\"\n data-testid=\"action-row-btn\"\n >\n {formatMessage(messages.programProgressCardResumeCourseButton)}\n </Button>\n </ActionRow>\n )}\n isOverflowVisible={false}\n >\n <p>\n {formatMessage(messages.programProgressInProgressCourseProfessionalUpgradeModalContent, { price })}\n </p>\n </StandardModal>\n </>\n );\n }\n\n return (\n <Button variant={variant}>\n {buttonText}\n </Button>\n );\n};\n"]}
|
|
@@ -5,12 +5,15 @@ import { useProgressData } from '../../../../hooks';
|
|
|
5
5
|
import { ProgressCardButton } from './ProgressCardButton';
|
|
6
6
|
import messages from '../messages';
|
|
7
7
|
export const ProgressCardActions = ({ tabType, redirectUrl }) => {
|
|
8
|
-
var _a, _b;
|
|
8
|
+
var _a, _b, _c;
|
|
9
9
|
const { programProgressData } = useProgressData();
|
|
10
10
|
const { formatMessage } = useIntl();
|
|
11
11
|
const courseData = (programProgressData === null || programProgressData === void 0 ? void 0 : programProgressData.courseData) || {};
|
|
12
12
|
const remainingCourseCount = ((_a = courseData === null || courseData === void 0 ? void 0 : courseData.notStarted) === null || _a === void 0 ? void 0 : _a.length) || 0;
|
|
13
13
|
const completedCourseCount = ((_b = courseData === null || courseData === void 0 ? void 0 : courseData.completed) === null || _b === void 0 ? void 0 : _b.length) || 0;
|
|
14
|
-
|
|
14
|
+
const inProgressCourseCount = ((_c = courseData === null || courseData === void 0 ? void 0 : courseData.inProgress) === null || _c === void 0 ? void 0 : _c.length) || 0;
|
|
15
|
+
return (_jsxs(Col, { xs: 12, className: "d-flex justify-content-md-end align-items-start mb-2", children: [tabType === formatMessage(messages.programProgressRemainingTab).toLowerCase() && remainingCourseCount > 0 && (_jsx(ProgressCardButton, { variant: "outline-primary", redirectUrl: redirectUrl || '', buttonText: formatMessage(messages.programProgressCardViewCourseDetailButton) })), ((tabType === formatMessage(messages.programProgressCompletedTab).toLowerCase() && completedCourseCount > 0)
|
|
16
|
+
|| (tabType === formatMessage(messages.programProgressInProgressTab).toLowerCase() && inProgressCourseCount > 0))
|
|
17
|
+
&& (_jsx(ProgressCardButton, { variant: "primary", redirectUrl: redirectUrl || '', buttonText: formatMessage(messages.programProgressCardResumeCourseButton) }))] }));
|
|
15
18
|
};
|
|
16
19
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/containers/ProgramDashboard/ProgramProgress/ProgressCardActions/index.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAEjD,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAE7C,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,QAAQ,MAAM,aAAa,CAAC;AAEnC,MAAM,CAAC,MAAM,mBAAmB,GAAiC,CAAC,EAAE,OAAO,EAAE,WAAW,EAAE,EAAE,EAAE;;IAC5F,MAAM,EAAE,mBAAmB,EAAE,GAAG,eAAe,EAAE,CAAC;IAClD,MAAM,EAAE,aAAa,EAAE,GAAG,OAAO,EAAE,CAAC;IAEpC,MAAM,UAAU,GAAG,CAAA,mBAAmB,aAAnB,mBAAmB,uBAAnB,mBAAmB,CAAE,UAAU,KAAI,EAAE,CAAC;IACzD,MAAM,oBAAoB,GAAG,CAAA,MAAA,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,UAAU,0CAAE,MAAM,KAAI,CAAC,CAAC;IACjE,MAAM,oBAAoB,GAAG,CAAA,MAAA,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,SAAS,0CAAE,MAAM,KAAI,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/containers/ProgramDashboard/ProgramProgress/ProgressCardActions/index.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAEjD,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAE7C,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,QAAQ,MAAM,aAAa,CAAC;AAEnC,MAAM,CAAC,MAAM,mBAAmB,GAAiC,CAAC,EAAE,OAAO,EAAE,WAAW,EAAE,EAAE,EAAE;;IAC5F,MAAM,EAAE,mBAAmB,EAAE,GAAG,eAAe,EAAE,CAAC;IAClD,MAAM,EAAE,aAAa,EAAE,GAAG,OAAO,EAAE,CAAC;IAEpC,MAAM,UAAU,GAAG,CAAA,mBAAmB,aAAnB,mBAAmB,uBAAnB,mBAAmB,CAAE,UAAU,KAAI,EAAE,CAAC;IACzD,MAAM,oBAAoB,GAAG,CAAA,MAAA,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,UAAU,0CAAE,MAAM,KAAI,CAAC,CAAC;IACjE,MAAM,oBAAoB,GAAG,CAAA,MAAA,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,SAAS,0CAAE,MAAM,KAAI,CAAC,CAAC;IAChE,MAAM,qBAAqB,GAAG,CAAA,MAAA,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,UAAU,0CAAE,MAAM,KAAI,CAAC,CAAC;IAElE,OAAO,CACL,MAAC,GAAG,IAAC,EAAE,EAAE,EAAE,EAAE,SAAS,EAAC,sDAAsD,aAE1E,OAAO,KAAK,aAAa,CAAC,QAAQ,CAAC,2BAA2B,CAAC,CAAC,WAAW,EAAE,IAAI,oBAAoB,GAAG,CAAC,IAAI,CAC5G,KAAC,kBAAkB,IAAC,OAAO,EAAC,iBAAiB,EAAC,WAAW,EAAE,WAAW,IAAI,EAAE,EAAE,UAAU,EAAE,aAAa,CAAC,QAAQ,CAAC,yCAAyC,CAAC,GAAI,CAChK,EAGA,CACC,CAAC,OAAO,KAAK,aAAa,CAAC,QAAQ,CAAC,2BAA2B,CAAC,CAAC,WAAW,EAAE,IAAI,oBAAoB,GAAG,CAAC,CAAC;mBACxG,CAAC,OAAO,KAAK,aAAa,CAAC,QAAQ,CAAC,4BAA4B,CAAC,CAAC,WAAW,EAAE,IAAI,qBAAqB,GAAG,CAAC,CAAC,CACjH;mBACE,CACD,KAAC,kBAAkB,IAAC,OAAO,EAAC,SAAS,EAAC,WAAW,EAAE,WAAW,IAAI,EAAE,EAAE,UAAU,EAAE,aAAa,CAAC,QAAQ,CAAC,qCAAqC,CAAC,GAAI,CACpJ,IACG,CACP,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import { FC } from 'react';\nimport { Col } from '@openedx/paragon';\nimport { useIntl } from '@openedx/frontend-base';\n\nimport { useProgressData } from '@src/hooks';\nimport { ProgressCardActionsProps } from '../../data/types';\nimport { ProgressCardButton } from './ProgressCardButton';\nimport messages from '../messages';\n\nexport const ProgressCardActions: FC<ProgressCardActionsProps> = ({ tabType, redirectUrl }) => {\n const { programProgressData } = useProgressData();\n const { formatMessage } = useIntl();\n\n const courseData = programProgressData?.courseData || {};\n const remainingCourseCount = courseData?.notStarted?.length || 0;\n const completedCourseCount = courseData?.completed?.length || 0;\n const inProgressCourseCount = courseData?.inProgress?.length || 0;\n\n return (\n <Col xs={12} className=\"d-flex justify-content-md-end align-items-start mb-2\">\n {/** View course details button */}\n {tabType === formatMessage(messages.programProgressRemainingTab).toLowerCase() && remainingCourseCount > 0 && (\n <ProgressCardButton variant=\"outline-primary\" redirectUrl={redirectUrl || ''} buttonText={formatMessage(messages.programProgressCardViewCourseDetailButton)} />\n )}\n\n {/** Resume course button */}\n {(\n (tabType === formatMessage(messages.programProgressCompletedTab).toLowerCase() && completedCourseCount > 0)\n || (tabType === formatMessage(messages.programProgressInProgressTab).toLowerCase() && inProgressCourseCount > 0)\n )\n && (\n <ProgressCardButton variant=\"primary\" redirectUrl={redirectUrl || ''} buttonText={formatMessage(messages.programProgressCardResumeCourseButton)} />\n )}\n </Col>\n );\n};\n"]}
|
|
@@ -144,5 +144,50 @@ declare const messages: {
|
|
|
144
144
|
id: string;
|
|
145
145
|
description: string;
|
|
146
146
|
};
|
|
147
|
+
programProgressInProgressCourse: {
|
|
148
|
+
defaultMessage: string;
|
|
149
|
+
id: string;
|
|
150
|
+
description: string;
|
|
151
|
+
};
|
|
152
|
+
programProgressInProgressCourseMicromastersUpgrade: {
|
|
153
|
+
defaultMessage: string;
|
|
154
|
+
id: string;
|
|
155
|
+
description: string;
|
|
156
|
+
};
|
|
157
|
+
programProgressInProgressRemainingCourses: {
|
|
158
|
+
defaultMessage: string;
|
|
159
|
+
id: string;
|
|
160
|
+
description: string;
|
|
161
|
+
};
|
|
162
|
+
programProgressInProgressCompletedCourses: {
|
|
163
|
+
defaultMessage: string;
|
|
164
|
+
id: string;
|
|
165
|
+
description: string;
|
|
166
|
+
};
|
|
167
|
+
programProgressInProgressCourseProfessionalUpgradeModalTitle: {
|
|
168
|
+
defaultMessage: string;
|
|
169
|
+
id: string;
|
|
170
|
+
description: string;
|
|
171
|
+
};
|
|
172
|
+
programProgressInProgressCourseProfessionalUpgradeModalContent: {
|
|
173
|
+
defaultMessage: string;
|
|
174
|
+
id: string;
|
|
175
|
+
description: string;
|
|
176
|
+
};
|
|
177
|
+
programProgressInProgressCertificateStatus: {
|
|
178
|
+
defaultMessage: string;
|
|
179
|
+
id: string;
|
|
180
|
+
description: string;
|
|
181
|
+
};
|
|
182
|
+
programProgressInProgressCertificateNeedsVerified: {
|
|
183
|
+
defaultMessage: string;
|
|
184
|
+
id: string;
|
|
185
|
+
description: string;
|
|
186
|
+
};
|
|
187
|
+
programProgressInProgressCertificateNotEarned: {
|
|
188
|
+
defaultMessage: string;
|
|
189
|
+
id: string;
|
|
190
|
+
description: string;
|
|
191
|
+
};
|
|
147
192
|
};
|
|
148
193
|
export default messages;
|
|
@@ -145,6 +145,51 @@ const messages = defineMessages({
|
|
|
145
145
|
id: 'program.progress.certificate.content.two',
|
|
146
146
|
description: 'Second content paragraph shown under the program progress circle',
|
|
147
147
|
},
|
|
148
|
+
programProgressInProgressCourse: {
|
|
149
|
+
defaultMessage: 'Courses in progress',
|
|
150
|
+
id: 'program.progress.in.progress.course',
|
|
151
|
+
description: 'Header text to be displayed inside the In Progress tab of the program progress page.',
|
|
152
|
+
},
|
|
153
|
+
programProgressInProgressCourseMicromastersUpgrade: {
|
|
154
|
+
defaultMessage: 'Upgrade to verified for {price}',
|
|
155
|
+
id: 'program.progress.in.progress.course.micromasters.upgrade',
|
|
156
|
+
description: 'Upgrade message for Micromasters courses in the In Progress tab.',
|
|
157
|
+
},
|
|
158
|
+
programProgressInProgressRemainingCourses: {
|
|
159
|
+
defaultMessage: 'Enroll in the next course in the program.',
|
|
160
|
+
id: 'program.progress.in.progress.remaining.courses',
|
|
161
|
+
description: 'Message for remaining courses in the In Progress tab.',
|
|
162
|
+
},
|
|
163
|
+
programProgressInProgressCompletedCourses: {
|
|
164
|
+
defaultMessage: 'You have completed all courses in the program.',
|
|
165
|
+
id: 'program.progress.in.progress.completed.courses',
|
|
166
|
+
description: 'Message for completed courses in the In Progress tab.',
|
|
167
|
+
},
|
|
168
|
+
programProgressInProgressCourseProfessionalUpgradeModalTitle: {
|
|
169
|
+
defaultMessage: 'You now have full access to the {title}',
|
|
170
|
+
id: 'program.progress.in.progress.course.professional.upgrade.modal.title',
|
|
171
|
+
description: 'Modal title for Professional Certificate courses in the In Progress tab.',
|
|
172
|
+
},
|
|
173
|
+
programProgressInProgressCourseProfessionalUpgradeModalContent: {
|
|
174
|
+
defaultMessage: "You're saving as a subscriber. This course is valued at {price}.",
|
|
175
|
+
id: 'program.progress.in.progress.course.professional.upgrade.modal.content',
|
|
176
|
+
description: 'Modal content for Professional Certificate courses in the In Progress tab.',
|
|
177
|
+
},
|
|
178
|
+
programProgressInProgressCertificateStatus: {
|
|
179
|
+
defaultMessage: 'Certificate Status: {status}',
|
|
180
|
+
id: 'program.progress.in.progress.certificate.status',
|
|
181
|
+
description: 'Certificate status for courses in the In Progress tab.',
|
|
182
|
+
},
|
|
183
|
+
programProgressInProgressCertificateNeedsVerified: {
|
|
184
|
+
defaultMessage: 'Needs verified certificate',
|
|
185
|
+
id: 'program.progress.in.progress.certificate.needs.verified',
|
|
186
|
+
description: 'Certificate status indicating that a verified certificate is needed for courses in the In Progress tab.',
|
|
187
|
+
},
|
|
188
|
+
programProgressInProgressCertificateNotEarned: {
|
|
189
|
+
defaultMessage: 'Not earned yet',
|
|
190
|
+
id: 'program.progress.in.progress.certificate.not.earned',
|
|
191
|
+
description: 'Certificate status indicating that the certificate has not been earned yet for courses in the In Progress tab.',
|
|
192
|
+
},
|
|
148
193
|
});
|
|
149
194
|
export default messages;
|
|
150
195
|
//# sourceMappingURL=messages.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"messages.js","sourceRoot":"","sources":["../../../../src/containers/ProgramDashboard/ProgramProgress/messages.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAExD,MAAM,QAAQ,GAAG,cAAc,CAAC;IAC9B,2BAA2B,EAAE;QAC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EAAE,EAAE,sDAAsD;QAC1D,WAAW,EAAE,4GAA4G;KAC1H;IACD,oDAAoD,EAAE;QACpD,cAAc,EAAE,oBAAoB;QACpC,EAAE,EAAE,6DAA6D;QACjE,WAAW,EAAE,mHAAmH;KACjI;IACD,iCAAiC,EAAE;QACjC,cAAc,EAAE,qBAAqB;QACrC,EAAE,EAAE,sCAAsC;QAC1C,WAAW,EAAE,4CAA4C;KAC1D;IACD,+BAA+B,EAAE;QAC/B,cAAc,EAAE,8BAA8B;QAC9C,EAAE,EAAE,+CAA+C;QACnD,WAAW,EAAE,+CAA+C;KAC7D;IACD,oCAAoC,EAAE;QACpC,cAAc,EAAE,2FAA2F;QAC3G,EAAE,EAAE,0CAA0C;QAC9C,WAAW,EAAE,iEAAiE;KAC/E;IACD,oCAAoC,EAAE;QACpC,cAAc,EAAE,8DAA8D;QAC9E,EAAE,EAAE,0CAA0C;QAC9C,WAAW,EAAE,kEAAkE;KAChF;CACF,CAAC,CAAC;AAEH,eAAe,QAAQ,CAAC","sourcesContent":["import { defineMessages } from '@openedx/frontend-base';\n\nconst messages = defineMessages({\n programProgressInstitutions: {\n defaultMessage: 'Institutions',\n id: 'program.progress.institutions',\n description: 'Label text for organization image logos',\n },\n programTypeLabel: {\n defaultMessage: '{programType} program',\n id: 'program.progress.program.type.label',\n description: 'Label displaying the program type (e.g. \"MicroMasters program\", \"Professional Certificate program\")',\n },\n programProgressCompleteHeader: {\n defaultMessage: 'Congratulations!',\n id: 'program.progress.complete.header',\n description: 'header text for the program progress page when all courses are complete',\n },\n programProgressCompleteText: {\n defaultMessage: 'You have successfully completed all the requirements for {programTitle}.',\n id: 'program.progress.complete.text',\n description: 'text to display when a user has completed all of the courses for the program',\n },\n programProgressIncompleteHeader: {\n defaultMessage: 'Your Program Journey',\n id: 'program.progress.incomplete.header',\n description: 'header text to display when the user has remaining incomplete courses in the program',\n },\n programProgressIncompleteText: {\n defaultMessage: 'Track and plan your progress through the {totalCoursesInProgram} courses in this program. To complete the program, you must earn a verified certificate for each course.',\n id: 'program.progress.incomplete.text',\n description: 'text to display when a user has not completed all of the courses for a program',\n },\n programProgressCardCompletedCertificateText: {\n defaultMessage: 'You earned the certificate on {certificateDate}',\n id: 'program.progress.card.completed.certificate.text',\n description: 'text to display on the progress card completed tab related to the certificate status for the course',\n },\n programProgressCardCompletedCertificateButton: {\n defaultMessage: 'View certificate',\n id: 'program.progress.card.completed.certificate.button.text',\n description: 'text to display on the progress card on certificate button for completed courses',\n },\n programProgressCardViewCourseDetailButton: {\n defaultMessage: 'View course details',\n id: 'program.progress.card.view.course.detail.button.text',\n description: 'text to display on the progress card for the view course details button',\n },\n programProgressCardResumeCourseButton: {\n defaultMessage: 'Resume course',\n id: 'program.progress.card.resume.course.button.text',\n description: 'text to display on the progress card for the resume course button',\n },\n programProgressCardUpgradeButton: {\n defaultMessage: 'Upgrade with your subscription',\n id: 'program.progress.card.upgrade.button.text',\n description: 'text to display on the progress card for the upgrade button',\n },\n programProgressCardEnrollText: {\n defaultMessage: 'Enrolled:',\n id: 'program.progress.card.enroll.text',\n description: 'text to display on the progress card for the enrolled status of the course',\n },\n programProgressCardStartText: {\n defaultMessage: 'Started',\n id: 'program.progress.card.start.text',\n description: 'text to display on the progress card for the start date of the course',\n },\n programProgressInProgressTab: {\n defaultMessage: 'In progress',\n id: 'program.progress.in.progress.tab',\n description: 'Label for the \"In progress\" tab on the program progress page, which lists courses that the user has started but not yet completed.',\n },\n programProgressRemainingTab: {\n defaultMessage: 'Remaining',\n id: 'program.progress.remaining.tab',\n description: 'Label for the \"Remaining\" tab on the program progress page, which lists courses that the user has not yet started.',\n },\n programProgressCompletedTab: {\n defaultMessage: 'Completed',\n id: 'program.progress.completed.tab',\n description: 'Label for the \"Completed\" tab on the program progress page, which lists courses that the user has completed.',\n },\n programProgressPathwaysTab: {\n defaultMessage: 'Pathways',\n id: 'program.progress.pathways.tab',\n description: 'Label for the \"Pathways\" tab on the program progress page, which gives details of how the program can be used to further the learners education. This tab is only shown for MicroMasters programs.',\n },\n programProgressRemainingCourse: {\n defaultMessage: 'Remaining Courses',\n id: 'program.progress.remaining.course',\n description: 'Header text to be displayed inside the Remaining tab of the program progress page.',\n },\n programProgressRemainingTabNoCourse: {\n defaultMessage: \"You have enrolled in all of this program's courses.\",\n id: 'program.progress.remaining.tab.no.course',\n description: 'Text to display on the Remaining tab of the program progress page when there is no course remaining for the user',\n },\n programProgressCompletedCourse: {\n defaultMessage: 'Completed courses',\n id: 'program.progress.completed.course',\n description: 'Header text to be displayed inside the Completed tab of the program progress page.',\n },\n programProgressCompletedTabNoCourse: {\n defaultMessage: 'As you complete courses, you will see them listed here.',\n id: 'program.progress.completed.tab.no.course',\n description: 'Text to display on the Completed tab of the program progress page when no course is completed for the user',\n },\n programProgressCompletedBannerTitle: {\n defaultMessage: 'Earning a program record',\n id: 'program.progress.completed.banner.title',\n description: 'Title text for the banner displayed on the Completed tab of the program progress page.',\n },\n programProgressCompletedBannerDescription: {\n defaultMessage: 'Once you meet all course and program requirements, you will receive a program record and your professional certificate.',\n id: 'program.progress.completed.banner.description',\n description: 'Description text for the banner displayed on the Completed tab of the program progress page.',\n },\n programProgressCompletedBannerHelpCenterButton: {\n defaultMessage: 'Help center',\n id: 'program.progress.completed.banner.help.center.button',\n description: 'Text for the Help Center button displayed on the banner in the Completed tab of the program progress page.',\n },\n programProgressCompletedBannerMyProgramRecordsButton: {\n defaultMessage: 'My program records',\n id: 'program.progress.completed.banner.my.program.records.button',\n description: 'Text for the My Program Records button displayed on the banner in the Completed tab of the program progress page.',\n },\n programProgressEarnedCertificates: {\n defaultMessage: 'Earned Certificates',\n id: 'program.progress.earned.certificates',\n description: 'Label shown in the program progress circle',\n },\n programProgressCertificateLabel: {\n defaultMessage: 'Program Certificate Progress',\n id: 'program.progress.certificate.program.progress',\n description: 'Label shown under the program progress circle',\n },\n programProgressCertificateContentOne: {\n defaultMessage: 'Earn a professional certificate when you meet requirements for all courses in the series.',\n id: 'program.progress.certificate.content.one',\n description: 'First content paragraph shown under the program progress circle',\n },\n programProgressCertificateContentTwo: {\n defaultMessage: \"This program is valued at '{'{price}'}' for non-subscribers.\",\n id: 'program.progress.certificate.content.two',\n description: 'Second content paragraph shown under the program progress circle',\n },\n});\n\nexport default messages;\n"]}
|
|
1
|
+
{"version":3,"file":"messages.js","sourceRoot":"","sources":["../../../../src/containers/ProgramDashboard/ProgramProgress/messages.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAExD,MAAM,QAAQ,GAAG,cAAc,CAAC;IAC9B,2BAA2B,EAAE;QAC3B,cAAc,EAAE,cAAc;QAC9B,EAAE,EAAE,+BAA+B;QACnC,WAAW,EAAE,yCAAyC;KACvD;IACD,gBAAgB,EAAE;QAChB,cAAc,EAAE,uBAAuB;QACvC,EAAE,EAAE,qCAAqC;QACzC,WAAW,EAAE,qGAAqG;KACnH;IACD,6BAA6B,EAAE;QAC7B,cAAc,EAAE,kBAAkB;QAClC,EAAE,EAAE,kCAAkC;QACtC,WAAW,EAAE,yEAAyE;KACvF;IACD,2BAA2B,EAAE;QAC3B,cAAc,EAAE,0EAA0E;QAC1F,EAAE,EAAE,gCAAgC;QACpC,WAAW,EAAE,8EAA8E;KAC5F;IACD,+BAA+B,EAAE;QAC/B,cAAc,EAAE,sBAAsB;QACtC,EAAE,EAAE,oCAAoC;QACxC,WAAW,EAAE,sFAAsF;KACpG;IACD,6BAA6B,EAAE;QAC7B,cAAc,EAAE,0KAA0K;QAC1L,EAAE,EAAE,kCAAkC;QACtC,WAAW,EAAE,gFAAgF;KAC9F;IACD,2CAA2C,EAAE;QAC3C,cAAc,EAAE,iDAAiD;QACjE,EAAE,EAAE,kDAAkD;QACtD,WAAW,EAAE,qGAAqG;KACnH;IACD,6CAA6C,EAAE;QAC7C,cAAc,EAAE,kBAAkB;QAClC,EAAE,EAAE,yDAAyD;QAC7D,WAAW,EAAE,kFAAkF;KAChG;IACD,yCAAyC,EAAE;QAC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AC3D,EAAE,EAAE,gDAAgD;QACpD,WAAW,EAAE,uDAAuD;KACrE;IACD,yCAAyC,EAAE;QACzC,cAAc,EAAE,gDAAgD;QAChE,EAAE,EAAE,gDAAgD;QACpD,WAAW,EAAE,uDAAuD;KACrE;IACD,4DAA4D,EAAE;QAC5D,cAAc,EAAE,yCAAyC;QACzD,EAAE,EAAE,sEAAsE;QAC1E,WAAW,EAAE,0EAA0E;KACxF;IACD,8DAA8D,EAAE;QAC9D,cAAc,EAAE,kEAAkE;QAClF,EAAE,EAAE,wEAAwE;QAC5E,WAAW,EAAE,4EAA4E;KAC1F;IACD,0CAA0C,EAAE;QAC1C,cAAc,EAAE,8BAA8B;QAC9C,EAAE,EAAE,iDAAiD;QACrD,WAAW,EAAE,wDAAwD;KACtE;IACD,iDAAiD,EAAE;QACjD,cAAc,EAAE,4BAA4B;QAC5C,EAAE,EAAE,yDAAyD;QAC7D,WAAW,EAAE,yGAAyG;KACvH;IACD,6CAA6C,EAAE;QAC7C,cAAc,EAAE,gBAAgB;QAChC,EAAE,EAAE,qDAAqD;QACzD,WAAW,EAAE,gHAAgH;KAC9H;CACF,CAAC,CAAC;AAEH,eAAe,QAAQ,CAAC","sourcesContent":["import { defineMessages } from '@openedx/frontend-base';\n\nconst messages = defineMessages({\n programProgressInstitutions: {\n defaultMessage: 'Institutions',\n id: 'program.progress.institutions',\n description: 'Label text for organization image logos',\n },\n programTypeLabel: {\n defaultMessage: '{programType} program',\n id: 'program.progress.program.type.label',\n description: 'Label displaying the program type (e.g. \"MicroMasters program\", \"Professional Certificate program\")',\n },\n programProgressCompleteHeader: {\n defaultMessage: 'Congratulations!',\n id: 'program.progress.complete.header',\n description: 'header text for the program progress page when all courses are complete',\n },\n programProgressCompleteText: {\n defaultMessage: 'You have successfully completed all the requirements for {programTitle}.',\n id: 'program.progress.complete.text',\n description: 'text to display when a user has completed all of the courses for the program',\n },\n programProgressIncompleteHeader: {\n defaultMessage: 'Your Program Journey',\n id: 'program.progress.incomplete.header',\n description: 'header text to display when the user has remaining incomplete courses in the program',\n },\n programProgressIncompleteText: {\n defaultMessage: 'Track and plan your progress through the {totalCoursesInProgram} courses in this program. To complete the program, you must earn a verified certificate for each course.',\n id: 'program.progress.incomplete.text',\n description: 'text to display when a user has not completed all of the courses for a program',\n },\n programProgressCardCompletedCertificateText: {\n defaultMessage: 'You earned the certificate on {certificateDate}',\n id: 'program.progress.card.completed.certificate.text',\n description: 'text to display on the progress card completed tab related to the certificate status for the course',\n },\n programProgressCardCompletedCertificateButton: {\n defaultMessage: 'View certificate',\n id: 'program.progress.card.completed.certificate.button.text',\n description: 'text to display on the progress card on certificate button for completed courses',\n },\n programProgressCardViewCourseDetailButton: {\n defaultMessage: 'View course details',\n id: 'program.progress.card.view.course.detail.button.text',\n description: 'text to display on the progress card for the view course details button',\n },\n programProgressCardResumeCourseButton: {\n defaultMessage: 'Resume course',\n id: 'program.progress.card.resume.course.button.text',\n description: 'text to display on the progress card for the resume course button',\n },\n programProgressCardUpgradeButton: {\n defaultMessage: 'Upgrade with your subscription',\n id: 'program.progress.card.upgrade.button.text',\n description: 'text to display on the progress card for the upgrade button',\n },\n programProgressCardEnrollText: {\n defaultMessage: 'Enrolled:',\n id: 'program.progress.card.enroll.text',\n description: 'text to display on the progress card for the enrolled status of the course',\n },\n programProgressCardStartText: {\n defaultMessage: 'Started',\n id: 'program.progress.card.start.text',\n description: 'text to display on the progress card for the start date of the course',\n },\n programProgressInProgressTab: {\n defaultMessage: 'In progress',\n id: 'program.progress.in.progress.tab',\n description: 'Label for the \"In progress\" tab on the program progress page, which lists courses that the user has started but not yet completed.',\n },\n programProgressRemainingTab: {\n defaultMessage: 'Remaining',\n id: 'program.progress.remaining.tab',\n description: 'Label for the \"Remaining\" tab on the program progress page, which lists courses that the user has not yet started.',\n },\n programProgressCompletedTab: {\n defaultMessage: 'Completed',\n id: 'program.progress.completed.tab',\n description: 'Label for the \"Completed\" tab on the program progress page, which lists courses that the user has completed.',\n },\n programProgressPathwaysTab: {\n defaultMessage: 'Pathways',\n id: 'program.progress.pathways.tab',\n description: 'Label for the \"Pathways\" tab on the program progress page, which gives details of how the program can be used to further the learners education. This tab is only shown for MicroMasters programs.',\n },\n programProgressRemainingCourse: {\n defaultMessage: 'Remaining Courses',\n id: 'program.progress.remaining.course',\n description: 'Header text to be displayed inside the Remaining tab of the program progress page.',\n },\n programProgressRemainingTabNoCourse: {\n defaultMessage: \"You have enrolled in all of this program's courses.\",\n id: 'program.progress.remaining.tab.no.course',\n description: 'Text to display on the Remaining tab of the program progress page when there is no course remaining for the user',\n },\n programProgressCompletedCourse: {\n defaultMessage: 'Completed courses',\n id: 'program.progress.completed.course',\n description: 'Header text to be displayed inside the Completed tab of the program progress page.',\n },\n programProgressCompletedTabNoCourse: {\n defaultMessage: 'As you complete courses, you will see them listed here.',\n id: 'program.progress.completed.tab.no.course',\n description: 'Text to display on the Completed tab of the program progress page when no course is completed for the user',\n },\n programProgressCompletedBannerTitle: {\n defaultMessage: 'Earning a program record',\n id: 'program.progress.completed.banner.title',\n description: 'Title text for the banner displayed on the Completed tab of the program progress page.',\n },\n programProgressCompletedBannerDescription: {\n defaultMessage: 'Once you meet all course and program requirements, you will receive a program record and your professional certificate.',\n id: 'program.progress.completed.banner.description',\n description: 'Description text for the banner displayed on the Completed tab of the program progress page.',\n },\n programProgressCompletedBannerHelpCenterButton: {\n defaultMessage: 'Help center',\n id: 'program.progress.completed.banner.help.center.button',\n description: 'Text for the Help Center button displayed on the banner in the Completed tab of the program progress page.',\n },\n programProgressCompletedBannerMyProgramRecordsButton: {\n defaultMessage: 'My program records',\n id: 'program.progress.completed.banner.my.program.records.button',\n description: 'Text for the My Program Records button displayed on the banner in the Completed tab of the program progress page.',\n },\n programProgressEarnedCertificates: {\n defaultMessage: 'Earned Certificates',\n id: 'program.progress.earned.certificates',\n description: 'Label shown in the program progress circle',\n },\n programProgressCertificateLabel: {\n defaultMessage: 'Program Certificate Progress',\n id: 'program.progress.certificate.program.progress',\n description: 'Label shown under the program progress circle',\n },\n programProgressCertificateContentOne: {\n defaultMessage: 'Earn a professional certificate when you meet requirements for all courses in the series.',\n id: 'program.progress.certificate.content.one',\n description: 'First content paragraph shown under the program progress circle',\n },\n programProgressCertificateContentTwo: {\n defaultMessage: \"This program is valued at '{'{price}'}' for non-subscribers.\",\n id: 'program.progress.certificate.content.two',\n description: 'Second content paragraph shown under the program progress circle',\n },\n programProgressInProgressCourse: {\n defaultMessage: 'Courses in progress',\n id: 'program.progress.in.progress.course',\n description: 'Header text to be displayed inside the In Progress tab of the program progress page.',\n },\n programProgressInProgressCourseMicromastersUpgrade: {\n defaultMessage: 'Upgrade to verified for {price}',\n id: 'program.progress.in.progress.course.micromasters.upgrade',\n description: 'Upgrade message for Micromasters courses in the In Progress tab.',\n },\n programProgressInProgressRemainingCourses: {\n defaultMessage: 'Enroll in the next course in the program.',\n id: 'program.progress.in.progress.remaining.courses',\n description: 'Message for remaining courses in the In Progress tab.',\n },\n programProgressInProgressCompletedCourses: {\n defaultMessage: 'You have completed all courses in the program.',\n id: 'program.progress.in.progress.completed.courses',\n description: 'Message for completed courses in the In Progress tab.',\n },\n programProgressInProgressCourseProfessionalUpgradeModalTitle: {\n defaultMessage: 'You now have full access to the {title}',\n id: 'program.progress.in.progress.course.professional.upgrade.modal.title',\n description: 'Modal title for Professional Certificate courses in the In Progress tab.',\n },\n programProgressInProgressCourseProfessionalUpgradeModalContent: {\n defaultMessage: \"You're saving as a subscriber. This course is valued at {price}.\",\n id: 'program.progress.in.progress.course.professional.upgrade.modal.content',\n description: 'Modal content for Professional Certificate courses in the In Progress tab.',\n },\n programProgressInProgressCertificateStatus: {\n defaultMessage: 'Certificate Status: {status}',\n id: 'program.progress.in.progress.certificate.status',\n description: 'Certificate status for courses in the In Progress tab.',\n },\n programProgressInProgressCertificateNeedsVerified: {\n defaultMessage: 'Needs verified certificate',\n id: 'program.progress.in.progress.certificate.needs.verified',\n description: 'Certificate status indicating that a verified certificate is needed for courses in the In Progress tab.',\n },\n programProgressInProgressCertificateNotEarned: {\n defaultMessage: 'Not earned yet',\n id: 'program.progress.in.progress.certificate.not.earned',\n description: 'Certificate status indicating that the certificate has not been earned yet for courses in the In Progress tab.',\n },\n});\n\nexport default messages;\n"]}
|
|
@@ -1 +1,15 @@
|
|
|
1
|
+
import type { Seat } from './types';
|
|
2
|
+
export declare const UPGRADEABLE_SEAT_TYPES: string[];
|
|
3
|
+
/**
|
|
4
|
+
* Returns a formatted price string for the first upgradeable seat in a course run.
|
|
5
|
+
* Mirrors the logic in edx-platform:
|
|
6
|
+
* lms/static/js/learner_dashboard/models/course_card_model.js -> getCertificatePriceString()
|
|
7
|
+
*
|
|
8
|
+
* Upgradeable seat types: 'verified', 'professional', 'no-id-professional', 'credit'
|
|
9
|
+
* Format:
|
|
10
|
+
* - USD (default): '$300.00'
|
|
11
|
+
* - USD (includeUSDCode): '$300.00 USD'
|
|
12
|
+
* - Other currencies: '300.00 EUR'
|
|
13
|
+
*/
|
|
14
|
+
export declare function getCertificatePriceString(seats?: Seat[], includeUSDCode?: boolean): string;
|
|
1
15
|
export declare function getProgramIcon(type: string): string;
|
|
@@ -2,6 +2,32 @@ import MicroMastersProgramDetailsSvgIcon from '../assets/micromasters-icon.svg';
|
|
|
2
2
|
import ProfCertProgramDetailsSvgIcon from '../assets/professional-certificate-program-details.svg';
|
|
3
3
|
import XSeriesProgramDetailsSvgIcon from '../assets/xseries-program-details.svg';
|
|
4
4
|
import { PROGRAM_TYPE_MAP } from './constants';
|
|
5
|
+
export const UPGRADEABLE_SEAT_TYPES = ['verified', 'professional', 'no-id-professional', 'credit'];
|
|
6
|
+
/**
|
|
7
|
+
* Returns a formatted price string for the first upgradeable seat in a course run.
|
|
8
|
+
* Mirrors the logic in edx-platform:
|
|
9
|
+
* lms/static/js/learner_dashboard/models/course_card_model.js -> getCertificatePriceString()
|
|
10
|
+
*
|
|
11
|
+
* Upgradeable seat types: 'verified', 'professional', 'no-id-professional', 'credit'
|
|
12
|
+
* Format:
|
|
13
|
+
* - USD (default): '$300.00'
|
|
14
|
+
* - USD (includeUSDCode): '$300.00 USD'
|
|
15
|
+
* - Other currencies: '300.00 EUR'
|
|
16
|
+
*/
|
|
17
|
+
export function getCertificatePriceString(seats, includeUSDCode = false) {
|
|
18
|
+
if (!seats || seats.length === 0) {
|
|
19
|
+
return '';
|
|
20
|
+
}
|
|
21
|
+
const upgradeableSeats = seats.filter((seat) => UPGRADEABLE_SEAT_TYPES.includes(seat.type));
|
|
22
|
+
if (upgradeableSeats.length === 0) {
|
|
23
|
+
return '';
|
|
24
|
+
}
|
|
25
|
+
const seat = upgradeableSeats[0];
|
|
26
|
+
if (seat.currency === 'USD') {
|
|
27
|
+
return includeUSDCode ? `$${seat.price} USD` : `$${seat.price}`;
|
|
28
|
+
}
|
|
29
|
+
return `${seat.price} ${seat.currency}`;
|
|
30
|
+
}
|
|
5
31
|
export function getProgramIcon(type) {
|
|
6
32
|
switch (type) {
|
|
7
33
|
case PROGRAM_TYPE_MAP.XSERIES:
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"util.js","sourceRoot":"","sources":["../../../../src/containers/ProgramDashboard/data/util.ts"],"names":[],"mappings":"AAAA,OAAO,iCAAiC,MAAM,iCAAiC,CAAC;AAChF,OAAO,6BAA6B,MAAM,wDAAwD,CAAC;AACnG,OAAO,4BAA4B,MAAM,uCAAuC,CAAC;AACjF,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"util.js","sourceRoot":"","sources":["../../../../src/containers/ProgramDashboard/data/util.ts"],"names":[],"mappings":"AAAA,OAAO,iCAAiC,MAAM,iCAAiC,CAAC;AAChF,OAAO,6BAA6B,MAAM,wDAAwD,CAAC;AACnG,OAAO,4BAA4B,MAAM,uCAAuC,CAAC;AACjF,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAG/C,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,UAAU,EAAE,cAAc,EAAE,oBAAoB,EAAE,QAAQ,CAAC,CAAC;AAEnG;;;;;;;;;;GAUG;AACH,MAAM,UAAU,yBAAyB,CAAC,KAAc,EAAE,cAAc,GAAG,KAAK;IAC9E,IAAI,CAAC,KAAK,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACjC,OAAO,EAAE,CAAC;IACZ,CAAC;IACD,MAAM,gBAAgB,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,sBAAsB,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IAC5F,IAAI,gBAAgB,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAClC,OAAO,EAAE,CAAC;IACZ,CAAC;IACD,MAAM,IAAI,GAAG,gBAAgB,CAAC,CAAC,CAAC,CAAC;IACjC,IAAI,IAAI,CAAC,QAAQ,KAAK,KAAK,EAAE,CAAC;QAC5B,OAAO,cAAc,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,KAAK,MAAM,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC;IAClE,CAAC;IACD,OAAO,GAAG,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;AAC1C,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,IAAY;IACzC,QAAQ,IAAI,EAAE,CAAC;QACb,KAAK,gBAAgB,CAAC,OAAO;YAC3B,OAAO,4BAA4B,CAAC;QACtC,KAAK,gBAAgB,CAAC,wBAAwB;YAC5C,OAAO,6BAA6B,CAAC;QACvC,KAAK,gBAAgB,CAAC,YAAY;YAChC,OAAO,iCAAiC,CAAC;QAC3C;YACE,OAAO,EAAE,CAAC;IACd,CAAC;AACH,CAAC","sourcesContent":["import MicroMastersProgramDetailsSvgIcon from '../assets/micromasters-icon.svg';\nimport ProfCertProgramDetailsSvgIcon from '../assets/professional-certificate-program-details.svg';\nimport XSeriesProgramDetailsSvgIcon from '../assets/xseries-program-details.svg';\nimport { PROGRAM_TYPE_MAP } from './constants';\nimport type { Seat } from './types';\n\nexport const UPGRADEABLE_SEAT_TYPES = ['verified', 'professional', 'no-id-professional', 'credit'];\n\n/**\n * Returns a formatted price string for the first upgradeable seat in a course run.\n * Mirrors the logic in edx-platform:\n * lms/static/js/learner_dashboard/models/course_card_model.js -> getCertificatePriceString()\n *\n * Upgradeable seat types: 'verified', 'professional', 'no-id-professional', 'credit'\n * Format:\n * - USD (default): '$300.00'\n * - USD (includeUSDCode): '$300.00 USD'\n * - Other currencies: '300.00 EUR'\n */\nexport function getCertificatePriceString(seats?: Seat[], includeUSDCode = false): string {\n if (!seats || seats.length === 0) {\n return '';\n }\n const upgradeableSeats = seats.filter((seat) => UPGRADEABLE_SEAT_TYPES.includes(seat.type));\n if (upgradeableSeats.length === 0) {\n return '';\n }\n const seat = upgradeableSeats[0];\n if (seat.currency === 'USD') {\n return includeUSDCode ? `$${seat.price} USD` : `$${seat.price}`;\n }\n return `${seat.price} ${seat.currency}`;\n}\n\nexport function getProgramIcon(type: string) {\n switch (type) {\n case PROGRAM_TYPE_MAP.XSERIES:\n return XSeriesProgramDetailsSvgIcon;\n case PROGRAM_TYPE_MAP.PROFESSIONAL_CERTIFICATE:\n return ProfCertProgramDetailsSvgIcon;\n case PROGRAM_TYPE_MAP.MICROMASTERS:\n return MicroMastersProgramDetailsSvgIcon;\n default:\n return '';\n }\n}\n"]}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export declare const getApiUrl: () => string;
|
|
2
|
+
export declare const getSubsInitApiUrl: () => string;
|
|
2
3
|
export declare const programProgressUrl: (uuid: string) => string;
|
|
3
4
|
export declare const programsApiUrl: () => string;
|
|
4
5
|
export declare const getSubsCoursesApiUrl: () => string;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { getSiteConfig } from '@openedx/frontend-base';
|
|
2
2
|
import StrictDict from '../../../utils/StrictDict';
|
|
3
3
|
export const getApiUrl = () => (`${getSiteConfig().lmsBaseUrl}/api`);
|
|
4
|
-
const getSubsInitApiUrl = () => (`${getApiUrl()}/subscription/init/`);
|
|
4
|
+
export const getSubsInitApiUrl = () => (`${getApiUrl()}/subscription/init/`);
|
|
5
5
|
export const programProgressUrl = (uuid) => `${getApiUrl()}/subscription/programs/${encodeURIComponent(uuid)}/`;
|
|
6
6
|
export const programsApiUrl = () => `${getApiUrl()}/subscription/programs/dashboard/`;
|
|
7
7
|
export const getSubsCoursesApiUrl = () => (`${getApiUrl()}/subscription/courses/dashboard/`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"urls.js","sourceRoot":"","sources":["../../../../src/data/services/subs/urls.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,UAAU,MAAM,uBAAuB,CAAC;AAE/C,MAAM,CAAC,MAAM,SAAS,GAAG,GAAG,EAAE,CAAC,CAAC,GAAG,aAAa,EAAE,CAAC,UAAU,MAAM,CAAC,CAAC;AAErE,MAAM,iBAAiB,GAAG,GAAG,EAAE,CAAC,CAAC,GAAG,SAAS,EAAE,qBAAqB,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"urls.js","sourceRoot":"","sources":["../../../../src/data/services/subs/urls.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,UAAU,MAAM,uBAAuB,CAAC;AAE/C,MAAM,CAAC,MAAM,SAAS,GAAG,GAAG,EAAE,CAAC,CAAC,GAAG,aAAa,EAAE,CAAC,UAAU,MAAM,CAAC,CAAC;AAErE,MAAM,CAAC,MAAM,iBAAiB,GAAG,GAAG,EAAE,CAAC,CAAC,GAAG,SAAS,EAAE,qBAAqB,CAAC,CAAC;AAE7E,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,IAAY,EAAE,EAAE,CAAC,GAAG,SAAS,EAAE,0BAA0B,kBAAkB,CAAC,IAAI,CAAC,GAAG,CAAC;AAExH,MAAM,CAAC,MAAM,cAAc,GAAG,GAAG,EAAE,CAAC,GAAG,SAAS,EAAE,mCAAmC,CAAC;AAEtF,MAAM,CAAC,MAAM,oBAAoB,GAAG,GAAG,EAAE,CAAC,CAAC,GAAG,SAAS,EAAE,kCAAkC,CAAC,CAAC;AAE7F,eAAe,UAAU,CAAC;IACxB,SAAS;IACT,kBAAkB;IAClB,cAAc;IACd,oBAAoB;IACpB,iBAAiB;CAClB,CAAC,CAAC","sourcesContent":["import { getSiteConfig } from '@openedx/frontend-base';\nimport StrictDict from '@src/utils/StrictDict';\n\nexport const getApiUrl = () => (`${getSiteConfig().lmsBaseUrl}/api`);\n\nexport const getSubsInitApiUrl = () => (`${getApiUrl()}/subscription/init/`);\n\nexport const programProgressUrl = (uuid: string) => `${getApiUrl()}/subscription/programs/${encodeURIComponent(uuid)}/`;\n\nexport const programsApiUrl = () => `${getApiUrl()}/subscription/programs/dashboard/`;\n\nexport const getSubsCoursesApiUrl = () => (`${getApiUrl()}/subscription/courses/dashboard/`);\n\nexport default StrictDict({\n getApiUrl,\n programProgressUrl,\n programsApiUrl,\n getSubsCoursesApiUrl,\n getSubsInitApiUrl,\n});\n"]}
|
package/dist/routes.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ export default routes;
|
|
|
2
2
|
declare const routes: ({
|
|
3
3
|
id: string;
|
|
4
4
|
path: string;
|
|
5
|
-
loader:
|
|
5
|
+
loader: (args: any) => Promise<null>;
|
|
6
6
|
handle: {
|
|
7
7
|
role: string;
|
|
8
8
|
};
|
|
@@ -12,7 +12,7 @@ declare const routes: ({
|
|
|
12
12
|
} | {
|
|
13
13
|
id: string;
|
|
14
14
|
path: string;
|
|
15
|
-
loader:
|
|
15
|
+
loader: (args: any) => Promise<null>;
|
|
16
16
|
handle: {
|
|
17
17
|
role: string;
|
|
18
18
|
};
|
|
@@ -20,4 +20,3 @@ declare const routes: ({
|
|
|
20
20
|
Component: import("react").FC;
|
|
21
21
|
}>;
|
|
22
22
|
})[];
|
|
23
|
-
import { authenticatedLoader } from '@openedx/frontend-base';
|
package/dist/routes.js
CHANGED
|
@@ -7,13 +7,38 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
7
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
|
-
import { authenticatedLoader } from '@openedx/frontend-base';
|
|
10
|
+
import { authenticatedLoader, getAuthenticatedHttpClient } from '@openedx/frontend-base';
|
|
11
11
|
import { subscriptionDashboardRole, subscriptionDashboardUrlPath, subscriptionProgramProgressRole } from './constants';
|
|
12
|
+
import { getSubsInitApiUrl } from './data/services/subs/urls';
|
|
13
|
+
import { redirect } from 'react-router-dom';
|
|
14
|
+
// loader to check if the user has subscription access
|
|
15
|
+
const subscriptionAccessLoader = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
16
|
+
try {
|
|
17
|
+
const { data } = yield getAuthenticatedHttpClient().get(getSubsInitApiUrl());
|
|
18
|
+
if (!(data === null || data === void 0 ? void 0 : data.userSubscription) || !data.userSubscription.isSubscriber) {
|
|
19
|
+
throw redirect('/learner-dashboard'); //redirect to learner dashboard if user does not have subscription access
|
|
20
|
+
}
|
|
21
|
+
return null;
|
|
22
|
+
}
|
|
23
|
+
catch (error) {
|
|
24
|
+
// Let redirect responses bubble up
|
|
25
|
+
if (error instanceof Response) {
|
|
26
|
+
throw error;
|
|
27
|
+
}
|
|
28
|
+
throw redirect('/learner-dashboard'); // redirect to learner dashboard if an error occurs
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
// composed loader that checks for authentication and subscription access
|
|
32
|
+
const protectedLoader = (args) => __awaiter(void 0, void 0, void 0, function* () {
|
|
33
|
+
yield authenticatedLoader(args);
|
|
34
|
+
yield subscriptionAccessLoader();
|
|
35
|
+
return null;
|
|
36
|
+
});
|
|
12
37
|
const routes = [
|
|
13
38
|
{
|
|
14
39
|
id: 'org.edx.frontend.route.subsLearnerDashboard.main',
|
|
15
40
|
path: subscriptionDashboardUrlPath,
|
|
16
|
-
loader:
|
|
41
|
+
loader: protectedLoader,
|
|
17
42
|
handle: {
|
|
18
43
|
role: subscriptionDashboardRole
|
|
19
44
|
},
|
|
@@ -27,7 +52,7 @@ const routes = [
|
|
|
27
52
|
{
|
|
28
53
|
id: 'org.edx.frontend.route.subsLearnerDashboard.programProgress',
|
|
29
54
|
path: '/subscription-program-progress/:uuid',
|
|
30
|
-
loader:
|
|
55
|
+
loader: protectedLoader,
|
|
31
56
|
handle: {
|
|
32
57
|
role: subscriptionProgramProgressRole
|
|
33
58
|
},
|
package/dist/routes.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"routes.js","sourceRoot":"","sources":["../src/routes.jsx"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"routes.js","sourceRoot":"","sources":["../src/routes.jsx"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,mBAAmB,EAAE,0BAA0B,EAAE,MAAM,wBAAwB,CAAC;AAEzF,OAAO,EAAG,yBAAyB,EAAE,4BAA4B,EAAE,+BAA+B,EAAE,MAAM,aAAa,CAAC;AACxH,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAE5C,sDAAsD;AACtD,MAAM,wBAAwB,GAAG,GAAS,EAAE;IAC1C,IAAI,CAAC;QACH,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,0BAA0B,EAAE,CAAC,GAAG,CAAC,iBAAiB,EAAE,CAAC,CAAC;QAE7E,IAAI,CAAC,CAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,gBAAgB,CAAA,IAAI,CAAC,IAAI,CAAC,gBAAgB,CAAC,YAAY,EAAE,CAAC;YACnE,MAAM,QAAQ,CAAC,oBAAoB,CAAC,CAAC,CAAE,yEAAyE;QAClH,CAAC;QAED,OAAO,IAAI,CAAC;IACd,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,mCAAmC;QACnC,IAAI,KAAK,YAAY,QAAQ,EAAE,CAAC;YAC9B,MAAM,KAAK,CAAC;QACd,CAAC;QAED,MAAM,QAAQ,CAAC,oBAAoB,CAAC,CAAC,CAAC,mDAAmD;IAC3F,CAAC;AACH,CAAC,CAAA,CAAC;AAEF,yEAAyE;AACzE,MAAM,eAAe,GAAG,CAAO,IAAI,EAAE,EAAE;IACrC,MAAM,mBAAmB,CAAC,IAAI,CAAC,CAAC;IAChC,MAAM,wBAAwB,EAAE,CAAC;IAEjC,OAAO,IAAI,CAAC;AACd,CAAC,CAAA,CAAC;AAEF,MAAM,MAAM,GAAG;IACb;QACE,EAAE,EAAE,kDAAkD;QACtD,IAAI,EAAE,4BAA4B;QAClC,MAAM,EAAE,eAAe;QACvB,MAAM,EAAE;YACN,IAAI,EAAE,yBAAyB;SAChC;QACK,IAAI;;gBACR,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,QAAQ,CAAC,CAAC;gBACtC,OAAO,EAAE,SAAS,EAAE,MAAM,CAAC,OAAO,EAAE,CAAC;YACvC,CAAC;SAAA;KACF;IACD;QACE,EAAE,EAAE,6DAA6D;QACjE,IAAI,EAAE,sCAAsC;QAC5C,MAAM,EAAE,eAAe;QACvB,MAAM,EAAE;YACN,IAAI,EAAE,+BAA+B;SACtC;QACK,IAAI;;gBACR,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,qDAAqD,CAAC,CAAC;gBACnF,OAAO,EAAE,SAAS,EAAE,MAAM,CAAC,OAAO,EAAE,CAAC;YACvC,CAAC;SAAA;KACF;CACF,CAAC;AAEF,eAAe,MAAM,CAAC","sourcesContent":["import { authenticatedLoader, getAuthenticatedHttpClient } from '@openedx/frontend-base';\n\nimport { subscriptionDashboardRole, subscriptionDashboardUrlPath, subscriptionProgramProgressRole } from './constants';\nimport { getSubsInitApiUrl } from './data/services/subs/urls';\nimport { redirect } from 'react-router-dom';\n\n// loader to check if the user has subscription access\nconst subscriptionAccessLoader = async () => {\n try {\n const { data } = await getAuthenticatedHttpClient().get(getSubsInitApiUrl());\n\n if (!data?.userSubscription || !data.userSubscription.isSubscriber) {\n throw redirect('/learner-dashboard'); //redirect to learner dashboard if user does not have subscription access\n }\n \n return null;\n } catch (error) {\n // Let redirect responses bubble up\n if (error instanceof Response) {\n throw error;\n }\n\n throw redirect('/learner-dashboard'); // redirect to learner dashboard if an error occurs\n }\n};\n\n// composed loader that checks for authentication and subscription access\nconst protectedLoader = async (args) => {\n await authenticatedLoader(args);\n await subscriptionAccessLoader();\n\n return null;\n};\n\nconst routes = [\n {\n id: 'org.edx.frontend.route.subsLearnerDashboard.main',\n path: subscriptionDashboardUrlPath,\n loader: protectedLoader,\n handle: {\n role: subscriptionDashboardRole\n },\n async lazy () {\n const module = await import('./Main');\n return { Component: module.default };\n },\n },\n {\n id: 'org.edx.frontend.route.subsLearnerDashboard.programProgress',\n path: '/subscription-program-progress/:uuid',\n loader: protectedLoader,\n handle: {\n role: subscriptionProgramProgressRole\n },\n async lazy () {\n const module = await import('./containers/ProgramDashboard/ProgramProgress/index');\n return { Component: module.default };\n },\n }\n];\n\nexport default routes;\n"]}
|