@edx/frontend-app-subscription-learner-dashboard 1.34.1 → 1.35.1

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.
Files changed (39) hide show
  1. package/dist/components/ConfirmCourseUpgradeActionModal.d.ts +40 -0
  2. package/dist/components/ConfirmCourseUpgradeActionModal.js +28 -0
  3. package/dist/components/ConfirmCourseUpgradeActionModal.js.map +1 -0
  4. package/dist/containers/ProgramDashboard/ProgramProgress/InProgressTabData/index.js +2 -1
  5. package/dist/containers/ProgramDashboard/ProgramProgress/InProgressTabData/index.js.map +1 -1
  6. package/dist/containers/ProgramDashboard/ProgramProgress/ProgramProgress.js +8 -2
  7. package/dist/containers/ProgramDashboard/ProgramProgress/ProgramProgress.js.map +1 -1
  8. package/dist/containers/ProgramDashboard/ProgramProgress/ProgressCard/index.js +12 -12
  9. package/dist/containers/ProgramDashboard/ProgramProgress/ProgressCard/index.js.map +1 -1
  10. package/dist/containers/ProgramDashboard/ProgramProgress/ProgressCardActions/ProgressCardButton.js +3 -8
  11. package/dist/containers/ProgramDashboard/ProgramProgress/ProgressCardActions/ProgressCardButton.js.map +1 -1
  12. package/dist/containers/ProgramDashboard/ProgramProgress/ProgressCardActions/UpgradeCourseButton.d.ts +3 -0
  13. package/dist/containers/ProgramDashboard/ProgramProgress/ProgressCardActions/UpgradeCourseButton.js +20 -0
  14. package/dist/containers/ProgramDashboard/ProgramProgress/ProgressCardActions/UpgradeCourseButton.js.map +1 -0
  15. package/dist/containers/ProgramDashboard/ProgramProgress/messages.d.ts +7 -7
  16. package/dist/containers/ProgramDashboard/ProgramProgress/messages.js +13 -13
  17. package/dist/containers/ProgramDashboard/ProgramProgress/messages.js.map +1 -1
  18. package/dist/data/hooks/mutationHooks.d.ts +11 -1
  19. package/dist/data/hooks/mutationHooks.js +21 -1
  20. package/dist/data/hooks/mutationHooks.js.map +1 -1
  21. package/dist/data/hooks/queryKeys.d.ts +1 -0
  22. package/dist/data/hooks/queryKeys.js +1 -0
  23. package/dist/data/hooks/queryKeys.js.map +1 -1
  24. package/dist/data/services/subs/api.d.ts +1 -0
  25. package/dist/data/services/subs/api.js +11 -0
  26. package/dist/data/services/subs/api.js.map +1 -1
  27. package/dist/data/services/subs/index.d.ts +1 -1
  28. package/dist/data/services/subs/index.js +1 -1
  29. package/dist/data/services/subs/index.js.map +1 -1
  30. package/dist/data/services/subs/urls.d.ts +1 -0
  31. package/dist/data/services/subs/urls.js +2 -0
  32. package/dist/data/services/subs/urls.js.map +1 -1
  33. package/dist/hooks/index.d.ts +2 -1
  34. package/dist/hooks/index.js +2 -0
  35. package/dist/hooks/index.js.map +1 -1
  36. package/dist/hooks/useActionWithModal.d.ts +15 -0
  37. package/dist/hooks/useActionWithModal.js +49 -0
  38. package/dist/hooks/useActionWithModal.js.map +1 -0
  39. package/package.json +1 -1
@@ -0,0 +1,40 @@
1
+ export default ConfirmCourseUpgradeActionModal;
2
+ declare function ConfirmCourseUpgradeActionModal({ isOpen, title, body, navigateLabel, reloadLabel, onSuccess, onReload, navigateTo, }: {
3
+ isOpen: any;
4
+ title: any;
5
+ body: any;
6
+ navigateLabel: any;
7
+ reloadLabel: any;
8
+ onSuccess: any;
9
+ onReload: any;
10
+ navigateTo: any;
11
+ }): import("react/jsx-runtime").JSX.Element;
12
+ declare namespace ConfirmCourseUpgradeActionModal {
13
+ namespace propTypes {
14
+ let isOpen: PropTypes.Validator<boolean>;
15
+ let title: PropTypes.Requireable<string>;
16
+ let body: PropTypes.Requireable<string>;
17
+ let navigateLabel: PropTypes.Requireable<string>;
18
+ let reloadLabel: PropTypes.Requireable<string>;
19
+ let onSuccess: PropTypes.Requireable<(...args: any[]) => any>;
20
+ let onReload: PropTypes.Requireable<(...args: any[]) => any>;
21
+ let navigateTo: PropTypes.Requireable<string>;
22
+ }
23
+ namespace defaultProps {
24
+ let title_1: null;
25
+ export { title_1 as title };
26
+ let body_1: null;
27
+ export { body_1 as body };
28
+ let navigateLabel_1: string;
29
+ export { navigateLabel_1 as navigateLabel };
30
+ let reloadLabel_1: string;
31
+ export { reloadLabel_1 as reloadLabel };
32
+ export function onSuccess_1(): void;
33
+ export { onSuccess_1 as onSuccess };
34
+ export function onReload_1(): void;
35
+ export { onReload_1 as onReload };
36
+ let navigateTo_1: string;
37
+ export { navigateTo_1 as navigateTo };
38
+ }
39
+ }
40
+ import PropTypes from 'prop-types';
@@ -0,0 +1,28 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import PropTypes from 'prop-types';
3
+ import { ModalDialog, ActionRow, Button } from '@openedx/paragon';
4
+ import { Link } from 'react-router-dom';
5
+ const ConfirmCourseUpgradeActionModal = ({ isOpen, title, body, navigateLabel, reloadLabel, onSuccess, onReload, navigateTo, }) => {
6
+ return (_jsxs(ModalDialog, { isOpen: isOpen, title: title, hasCloseButton: false, isBlocking: true, children: [title && (_jsx(ModalDialog.Header, { children: _jsx(ModalDialog.Title, { children: title }) })), body && (_jsx(ModalDialog.Body, { children: _jsx("p", { children: body }) })), _jsx(ModalDialog.Footer, { children: _jsxs(ActionRow, { children: [_jsx(Button, { variant: "tertiary", onClick: onReload, children: reloadLabel }), _jsx(Button, { variant: "primary", as: Link, to: navigateTo, children: navigateLabel })] }) })] }));
7
+ };
8
+ ConfirmCourseUpgradeActionModal.propTypes = {
9
+ isOpen: PropTypes.bool.isRequired,
10
+ title: PropTypes.string,
11
+ body: PropTypes.string,
12
+ navigateLabel: PropTypes.string,
13
+ reloadLabel: PropTypes.string,
14
+ onSuccess: PropTypes.func,
15
+ onReload: PropTypes.func,
16
+ navigateTo: PropTypes.string,
17
+ };
18
+ ConfirmCourseUpgradeActionModal.defaultProps = {
19
+ title: null,
20
+ body: null,
21
+ navigateLabel: 'Resume Course',
22
+ reloadLabel: 'Close',
23
+ onSuccess: () => { },
24
+ onReload: () => { },
25
+ navigateTo: '',
26
+ };
27
+ export default ConfirmCourseUpgradeActionModal;
28
+ //# sourceMappingURL=ConfirmCourseUpgradeActionModal.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ConfirmCourseUpgradeActionModal.js","sourceRoot":"","sources":["../../src/components/ConfirmCourseUpgradeActionModal.jsx"],"names":[],"mappings":";AAAA,OAAO,SAAS,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAClE,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAExC,MAAM,+BAA+B,GAAG,CAAC,EACrC,MAAM,EACN,KAAK,EACL,IAAI,EACJ,aAAa,EACb,WAAW,EACX,SAAS,EACT,QAAQ,EACR,UAAU,GACb,EAAE,EAAE;IACD,OAAO,CACH,MAAC,WAAW,IACR,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,KAAK,EACZ,cAAc,EAAE,KAAK,EACrB,UAAU,mBAET,KAAK,IAAI,CACN,KAAC,WAAW,CAAC,MAAM,cACf,KAAC,WAAW,CAAC,KAAK,cAAE,KAAK,GAAqB,GAC7B,CACxB,EACA,IAAI,IAAI,CACL,KAAC,WAAW,CAAC,IAAI,cACb,sBAAI,IAAI,GAAK,GACE,CACtB,EACD,KAAC,WAAW,CAAC,MAAM,cACf,MAAC,SAAS,eACN,KAAC,MAAM,IAAC,OAAO,EAAC,UAAU,EAAC,OAAO,EAAE,QAAQ,YAAG,WAAW,GAAU,EACpE,KAAC,MAAM,IAAC,OAAO,EAAC,SAAS,EAAC,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,UAAU,YAAG,aAAa,GAAU,IACpE,GACK,IACX,CACjB,CAAC;AACN,CAAC,CAAC;AAEF,+BAA+B,CAAC,SAAS,GAAG;IACxC,MAAM,EAAE,SAAS,CAAC,IAAI,CAAC,UAAU;IACjC,KAAK,EAAE,SAAS,CAAC,MAAM;IACvB,IAAI,EAAE,SAAS,CAAC,MAAM;IACtB,aAAa,EAAE,SAAS,CAAC,MAAM;IAC/B,WAAW,EAAE,SAAS,CAAC,MAAM;IAC7B,SAAS,EAAE,SAAS,CAAC,IAAI;IACzB,QAAQ,EAAE,SAAS,CAAC,IAAI;IACxB,UAAU,EAAE,SAAS,CAAC,MAAM;CAC/B,CAAC;AAEF,+BAA+B,CAAC,YAAY,GAAG;IAC3C,KAAK,EAAE,IAAI;IACX,IAAI,EAAE,IAAI;IACV,aAAa,EAAE,eAAe;IAC9B,WAAW,EAAE,OAAO;IACpB,SAAS,EAAE,GAAG,EAAE,GAAE,CAAC;IACnB,QAAQ,EAAE,GAAG,EAAE,GAAE,CAAC;IAClB,UAAU,EAAE,EAAE;CACjB,CAAC;AAEF,eAAe,+BAA+B,CAAC","sourcesContent":["import PropTypes from 'prop-types';\nimport { ModalDialog, ActionRow, Button } from '@openedx/paragon';\nimport { Link } from 'react-router-dom';\n\nconst ConfirmCourseUpgradeActionModal = ({\n isOpen,\n title,\n body,\n navigateLabel,\n reloadLabel,\n onSuccess,\n onReload,\n navigateTo,\n}) => {\n return (\n <ModalDialog\n isOpen={isOpen}\n title={title}\n hasCloseButton={false}\n isBlocking\n >\n {title && (\n <ModalDialog.Header>\n <ModalDialog.Title>{title}</ModalDialog.Title>\n </ModalDialog.Header>\n )}\n {body && (\n <ModalDialog.Body>\n <p>{body}</p>\n </ModalDialog.Body>\n )}\n <ModalDialog.Footer>\n <ActionRow>\n <Button variant=\"tertiary\" onClick={onReload}>{reloadLabel}</Button>\n <Button variant=\"primary\" as={Link} to={navigateTo}>{navigateLabel}</Button>\n </ActionRow>\n </ModalDialog.Footer>\n </ModalDialog>\n );\n};\n\nConfirmCourseUpgradeActionModal.propTypes = {\n isOpen: PropTypes.bool.isRequired,\n title: PropTypes.string,\n body: PropTypes.string,\n navigateLabel: PropTypes.string,\n reloadLabel: PropTypes.string,\n onSuccess: PropTypes.func,\n onReload: PropTypes.func,\n navigateTo: PropTypes.string,\n}; \n\nConfirmCourseUpgradeActionModal.defaultProps = {\n title: null,\n body: null,\n navigateLabel: 'Resume Course',\n reloadLabel: 'Close',\n onSuccess: () => {},\n onReload: () => {},\n navigateTo: '',\n};\n\nexport default ConfirmCourseUpgradeActionModal;"]}
@@ -19,7 +19,7 @@ export const InProgressTabData = () => {
19
19
  const shouldShowCompletedMessage = !inProgressCount && !remainingCount && completedCount > 0;
20
20
  const progressCards = inProgressData.map((course) => {
21
21
  const courseRuns = course.courseRuns || [];
22
- const [{ pacingType = '', enrollmentDate = '', end = '', courseUrl = '', upgradeUrl = '', seats = [] } = {}] = Array.isArray(courseRuns) ? courseRuns : [];
22
+ const [{ pacingType = '', enrollmentDate = '', end = '', courseUrl = '', upgradeUrl = '', seats = [], key = '' } = {}] = Array.isArray(courseRuns) ? courseRuns : [];
23
23
  const progressCardData = {
24
24
  title: course.title,
25
25
  enrollment_date: enrollmentDate,
@@ -31,6 +31,7 @@ export const InProgressTabData = () => {
31
31
  checkoutUrl: checkoutUrl || '',
32
32
  seats: seats || [],
33
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
+ courseRunKey: key || '',
34
35
  };
35
36
  return (_jsx(ProgressCard, { progressCardData: progressCardData, isLoading: isLoading, tabType: inProgressTabType }, course.key));
36
37
  });
@@ -1 +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,M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GAAG,EAAE,CAAC,GAAG,KAAK,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,CAAC;QAE3J,MAAM,gBAAgB,GAAG;YACvB,KAAK,EAAE,MAAM,CAAC,KAAK;YACnB,eAAe,EAAE,cAAc;YAC/B,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,wBACG,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,GACJ,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 = '', enrollmentDate = '', end = '', courseUrl = '', upgradeUrl = '', seats = [] } = {}] = Array.isArray(courseRuns) ? courseRuns : [];\n\n const progressCardData = {\n title: course.title,\n enrollment_date: enrollmentDate,\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 {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"]}
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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aAAa,CAAC,QAAQ,CAAC,yCAAyC,CAAC,GAAK,CAC3E,CAAC,CAAC,CAAC,IAAI,GACJ,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 = '', enrollmentDate = '', end = '', courseUrl = '', upgradeUrl = '', seats = [], key = '' } = {}] = Array.isArray(courseRuns) ? courseRuns : [];\n\n const progressCardData = {\n title: course.title,\n enrollment_date: enrollmentDate,\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 courseRunKey: key || '',\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 {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"]}
@@ -1,15 +1,21 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
2
  import { Helmet } from 'react-helmet';
3
- import { Col, Container, Row } from '@openedx/paragon';
3
+ import { Link } from 'react-router-dom';
4
+ import { Col, Container, Icon, Row } from '@openedx/paragon';
5
+ import { ArrowBack } from '@openedx/paragon/icons';
6
+ import { useIntl } from '@openedx/frontend-base';
4
7
  import './index.scss';
5
8
  import { useProgressData } from '../../../hooks';
6
9
  import ProgramProgressHeader from './ProgramProgressHeader';
7
10
  import ProgramProgressInfo from './ProgramProgressInfo';
8
11
  import { ProgramProgressTabs } from './ProgramProgressTabs';
9
12
  import { ProgramProgressSidebar } from './ProgramProgressSidebar';
13
+ import { subscriptionDashboardUrlPath } from '../../../constants';
14
+ import messages from './messages';
10
15
  const ProgramProgress = () => {
11
16
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
12
17
  const { programProgressData, isLoading, error } = useProgressData();
18
+ const { formatMessage } = useIntl();
13
19
  if (programProgressData === null) {
14
20
  return _jsx("div", { children: "Invalid URL" });
15
21
  }
@@ -32,7 +38,7 @@ const ProgramProgress = () => {
32
38
  const remainingCourseCount = ((_j = courseData === null || courseData === void 0 ? void 0 : courseData.notStarted) === null || _j === void 0 ? void 0 : _j.length) || 0;
33
39
  const completedCourseCount = ((_k = courseData === null || courseData === void 0 ? void 0 : courseData.completed) === null || _k === void 0 ? void 0 : _k.length) || 0;
34
40
  const discountData = programData === null || programData === void 0 ? void 0 : programData.discountData;
35
- return (_jsxs(_Fragment, { children: [_jsx(Helmet, { title: `${programData === null || programData === void 0 ? void 0 : programData.title}` }), _jsxs(Container, { fluid: false, size: "xl", className: "p-4.5", children: [_jsx(ProgramProgressHeader, { programTitle: (_l = programData === null || programData === void 0 ? void 0 : programData.title) !== null && _l !== void 0 ? _l : '', programType: (_m = programData === null || programData === void 0 ? void 0 : programData.type) !== null && _m !== void 0 ? _m : '', authoringOrganizations: programData === null || programData === void 0 ? void 0 : programData.authoringOrganizations }), _jsxs(Row, { children: [_jsxs(Col, { sm: 12, md: 8, children: [_jsx(ProgramProgressInfo, { allCoursesCompleted: allCoursesCompleted, totalCoursesInProgram: totalCoursesInProgram, programTitle: (_o = programData === null || programData === void 0 ? void 0 : programData.title) !== null && _o !== void 0 ? _o : '', discountData: discountData }), _jsx(ProgramProgressTabs, { counts: { inProgress: inProgressCourseCount, remaining: remainingCourseCount, completed: completedCourseCount }, type: programType })] }), _jsx(Col, { sm: 12, md: 4, children: _jsx(ProgramProgressSidebar, { inProgress: inProgressCourseCount, remaining: remainingCourseCount, completed: completedCourseCount }) })] })] })] }));
41
+ return (_jsxs(_Fragment, { children: [_jsx(Helmet, { title: `${programData === null || programData === void 0 ? void 0 : programData.title}` }), _jsxs(Container, { fluid: false, size: "xl", className: "p-4.5", children: [_jsx("div", { className: "d-block d-lg-none mb-4", children: _jsxs(Link, { to: subscriptionDashboardUrlPath, className: "text-reset text-decoration-none d-inline-flex align-items-center", children: [_jsx(Icon, { src: ArrowBack, className: "mr-2" }), formatMessage(messages.programProgressReturnToDashboardText)] }) }), _jsx(ProgramProgressHeader, { programTitle: (_l = programData === null || programData === void 0 ? void 0 : programData.title) !== null && _l !== void 0 ? _l : '', programType: (_m = programData === null || programData === void 0 ? void 0 : programData.type) !== null && _m !== void 0 ? _m : '', authoringOrganizations: programData === null || programData === void 0 ? void 0 : programData.authoringOrganizations }), _jsxs(Row, { children: [_jsxs(Col, { sm: 12, md: 8, children: [_jsx(ProgramProgressInfo, { allCoursesCompleted: allCoursesCompleted, totalCoursesInProgram: totalCoursesInProgram, programTitle: (_o = programData === null || programData === void 0 ? void 0 : programData.title) !== null && _o !== void 0 ? _o : '', discountData: discountData }), _jsx(ProgramProgressTabs, { counts: { inProgress: inProgressCourseCount, remaining: remainingCourseCount, completed: completedCourseCount }, type: programType })] }), _jsx(Col, { sm: 12, md: 4, children: _jsx(ProgramProgressSidebar, { inProgress: inProgressCourseCount, remaining: remainingCourseCount, completed: completedCourseCount }) })] })] })] }));
36
42
  };
37
43
  export default ProgramProgress;
38
44
  //# sourceMappingURL=ProgramProgress.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ProgramProgress.js","sourceRoot":"","sources":["../../../../src/containers/ProgramDashboard/ProgramProgress/ProgramProgress.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,GAAG,EAAE,SAAS,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAC;AAEvD,OAAO,cAAc,CAAC;AACtB,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,qBAAqB,MAAM,yBAAyB,CAAC;AAC5D,OAAO,mBAAmB,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAElE,MAAM,eAAe,GAAO,GAAG,EAAE;;IAC/B,MAAM,EAAE,mBAAmB,EAAE,SAAS,EAAE,KAAK,EAAE,GAAG,eAAe,EAAE,CAAC;IAEpE,IAAI,mBAAmB,KAAK,IAAI,EAAE,CAAC;QACjC,OAAO,wCAAsB,CAAC;IAChC,CAAC;IAED,IAAI,SAAS,EAAE,CAAC;QACd,OAAO,uCAAqB,CAAC;IAC/B,CAAC;IAED,IAAI,KAAK,EAAE,CAAC;QACV,OAAO,2CAAyB,CAAC;IACnC,CAAC;IAED,MAAM,WAAW,GAAG,mBAAmB,aAAnB,mBAAmB,uBAAnB,mBAAmB,CAAE,WAAW,CAAC;IACrD,MAAM,UAAU,GAAG,mBAAmB,aAAnB,mBAAmB,uBAAnB,mBAAmB,CAAE,UAAU,CAAC;IAEnD,MAAM,qBAAqB,GAAG,CAAC,CAAA,MAAA,UAAU,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AAA,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,IAAI,mCAAI,EAAE,EACpC,sBAAsB,EAAE,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,sBAAsB,GAC3D,EACF,MAAC,GAAG,eACF,MAAC,GAAG,IAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,aAChB,KAAC,mBAAmB,IAClB,mBAAmB,EAAE,mBAAmB,EACxC,qBAAqB,EAAE,qBAAqB,EAC5C,YAAY,EAAE,MAAA,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,KAAK,mCAAI,EAAE,EACtC,YAAY,EAAE,YAAY,GAC1B,EACF,KAAC,mBAAmB,IAAC,MAAM,EAAE,EAAE,UAAU,EAAE,qBAAqB,EAAE,SAAS,EAAE,oBAAoB,EAAE,SAAS,EAAE,oBAAoB,EAAE,EAAE,IAAI,EAAE,WAAW,GAAI,IACvJ,EAEN,KAAC,GAAG,IAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,YAChB,KAAC,sBAAsB,IACrB,UAAU,EAAE,qBAAqB,EACjC,SAAS,EAAE,oBAAoB,EAC/B,SAAS,EAAE,oBAAoB,GAC/B,GACE,IACF,IACI,IACX,CACJ,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,eAAe,CAAC","sourcesContent":["import { FC } from 'react';\nimport { Helmet } from 'react-helmet';\nimport { Col, Container, Row } from '@openedx/paragon';\n\nimport './index.scss';\nimport { useProgressData } from '@src/hooks';\nimport ProgramProgressHeader from './ProgramProgressHeader';\nimport ProgramProgressInfo from './ProgramProgressInfo';\nimport { ProgramProgressTabs } from './ProgramProgressTabs';\nimport { ProgramProgressSidebar } from './ProgramProgressSidebar';\n\nconst ProgramProgress: FC = () => {\n const { programProgressData, isLoading, error } = useProgressData();\n\n if (programProgressData === null) {\n return <div>Invalid URL</div>;\n }\n\n if (isLoading) {\n return <div>Loading...</div>;\n }\n\n if (error) {\n return <div>Error occurred</div>;\n }\n\n const programData = programProgressData?.programData;\n const courseData = programProgressData?.courseData;\n\n const totalCoursesInProgram = (courseData.notStarted?.length || 0)\n + (courseData.completed?.length || 0)\n + (courseData.inProgress?.length || 0);\n\n const allCoursesCompleted = !courseData.notStarted?.length\n && !courseData.inProgress?.length\n && courseData.completed?.length;\n\n const programType = programData?.type ?? '';\n const inProgressCourseCount = courseData?.inProgress?.length || 0;\n const remainingCourseCount = courseData?.notStarted?.length || 0;\n const completedCourseCount = courseData?.completed?.length || 0;\n const discountData = programData?.discountData;\n\n return (\n <>\n <Helmet title={`${programData?.title}`} />\n <Container fluid={false} size=\"xl\" className=\"p-4.5\">\n <ProgramProgressHeader\n programTitle={programData?.title ?? ''}\n programType={programData?.type ?? ''}\n authoringOrganizations={programData?.authoringOrganizations}\n />\n <Row>\n <Col sm={12} md={8}>\n <ProgramProgressInfo\n allCoursesCompleted={allCoursesCompleted}\n totalCoursesInProgram={totalCoursesInProgram}\n programTitle={programData?.title ?? ''}\n discountData={discountData}\n />\n <ProgramProgressTabs counts={{ inProgress: inProgressCourseCount, remaining: remainingCourseCount, completed: completedCourseCount }} type={programType} />\n </Col>\n\n <Col sm={12} md={4}>\n <ProgramProgressSidebar\n inProgress={inProgressCourseCount}\n remaining={remainingCourseCount}\n completed={completedCourseCount}\n />\n </Col>\n </Row>\n </Container>\n </>\n );\n};\n\nexport default ProgramProgress;\n"]}
1
+ {"version":3,"file":"ProgramProgress.js","sourceRoot":"","sources":["../../../../src/containers/ProgramDashboard/ProgramProgress/ProgramProgress.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AACxC,OAAO,EAAE,GAAG,EAAE,SAAS,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAC;AAC7D,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnD,OAAO,EAAE,OAAO,EAAE,MAA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W,uBAAX,WAAW,CAAE,IAAI,mCAAI,EAAE,EACpC,sBAAsB,EAAE,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,sBAAsB,GAC3D,EACF,MAAC,GAAG,eACF,MAAC,GAAG,IAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,aAChB,KAAC,mBAAmB,IAClB,mBAAmB,EAAE,mBAAmB,EACxC,qBAAqB,EAAE,qBAAqB,EAC5C,YAAY,EAAE,MAAA,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,KAAK,mCAAI,EAAE,EACtC,YAAY,EAAE,YAAY,GAC1B,EACF,KAAC,mBAAmB,IAAC,MAAM,EAAE,EAAE,UAAU,EAAE,qBAAqB,EAAE,SAAS,EAAE,oBAAoB,EAAE,SAAS,EAAE,oBAAoB,EAAE,EAAE,IAAI,EAAE,WAAW,GAAI,IACvJ,EAEN,KAAC,GAAG,IAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,YAChB,KAAC,sBAAsB,IACrB,UAAU,EAAE,qBAAqB,EACjC,SAAS,EAAE,oBAAoB,EAC/B,SAAS,EAAE,oBAAoB,GAC/B,GACE,IACF,IACI,IACX,CACJ,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,eAAe,CAAC","sourcesContent":["import { FC } from 'react';\nimport { Helmet } from 'react-helmet';\nimport { Link } from 'react-router-dom';\nimport { Col, Container, Icon, Row } from '@openedx/paragon';\nimport { ArrowBack } from '@openedx/paragon/icons';\nimport { useIntl } from '@openedx/frontend-base';\n\nimport './index.scss';\nimport { useProgressData } from '@src/hooks';\nimport ProgramProgressHeader from './ProgramProgressHeader';\nimport ProgramProgressInfo from './ProgramProgressInfo';\nimport { ProgramProgressTabs } from './ProgramProgressTabs';\nimport { ProgramProgressSidebar } from './ProgramProgressSidebar';\nimport { subscriptionDashboardUrlPath } from '@src/constants';\nimport messages from './messages';\n\nconst ProgramProgress: FC = () => {\n const { programProgressData, isLoading, error } = useProgressData();\n const { formatMessage } = useIntl();\n\n if (programProgressData === null) {\n return <div>Invalid URL</div>;\n }\n\n if (isLoading) {\n return <div>Loading...</div>;\n }\n\n if (error) {\n return <div>Error occurred</div>;\n }\n\n const programData = programProgressData?.programData;\n const courseData = programProgressData?.courseData;\n\n const totalCoursesInProgram = (courseData.notStarted?.length || 0)\n + (courseData.completed?.length || 0)\n + (courseData.inProgress?.length || 0);\n\n const allCoursesCompleted = !courseData.notStarted?.length\n && !courseData.inProgress?.length\n && courseData.completed?.length;\n\n const programType = programData?.type ?? '';\n const inProgressCourseCount = courseData?.inProgress?.length || 0;\n const remainingCourseCount = courseData?.notStarted?.length || 0;\n const completedCourseCount = courseData?.completed?.length || 0;\n const discountData = programData?.discountData;\n\n return (\n <>\n <Helmet title={`${programData?.title}`} />\n <Container fluid={false} size=\"xl\" className=\"p-4.5\">\n <div className=\"d-block d-lg-none mb-4\">\n <Link to={subscriptionDashboardUrlPath} className=\"text-reset text-decoration-none d-inline-flex align-items-center\">\n <Icon src={ArrowBack} className=\"mr-2\" />\n {formatMessage(messages.programProgressReturnToDashboardText)}\n </Link>\n </div>\n <ProgramProgressHeader\n programTitle={programData?.title ?? ''}\n programType={programData?.type ?? ''}\n authoringOrganizations={programData?.authoringOrganizations}\n />\n <Row>\n <Col sm={12} md={8}>\n <ProgramProgressInfo\n allCoursesCompleted={allCoursesCompleted}\n totalCoursesInProgram={totalCoursesInProgram}\n programTitle={programData?.title ?? ''}\n discountData={discountData}\n />\n <ProgramProgressTabs counts={{ inProgress: inProgressCourseCount, remaining: remainingCourseCount, completed: completedCourseCount }} type={programType} />\n </Col>\n\n <Col sm={12} md={4}>\n <ProgramProgressSidebar\n inProgress={inProgressCourseCount}\n remaining={remainingCourseCount}\n completed={completedCourseCount}\n />\n </Col>\n </Row>\n </Container>\n </>\n );\n};\n\nexport default ProgramProgress;\n"]}
@@ -8,14 +8,16 @@ import { dateFormatter } from '../../../../utils/dateFormatter';
8
8
  import { ProgressCardButton } from '../ProgressCardActions/ProgressCardButton';
9
9
  import { PROGRAM_TYPE_MAP } from '../../data/constants';
10
10
  import { getCertificatePriceString } from '../../data/util';
11
+ import { UpgradeCourseButton } from '../ProgressCardActions/UpgradeCourseButton';
11
12
  export const ProgressCard = ({ progressCardData, isLoading, tabType }) => {
12
13
  const { formatMessage, formatDate } = useIntl();
13
- const { title, enrollment_date, end, certificateUrl, courseUrl, upgradeUrl, programType, checkoutUrl, expired, seats, description, destinationUrl } = progressCardData;
14
+ const { title, enrollment_date, end, certificateUrl, courseUrl, upgradeUrl, programType, checkoutUrl, expired, seats, description, destinationUrl, courseRunKey } = progressCardData;
14
15
  const inProgressTabKey = formatMessage(messages.programProgressInProgressTab).toLowerCase();
15
16
  const isInProgressTab = tabType === inProgressTabKey;
16
17
  const isRemainingTab = tabType === formatMessage(messages.programProgressRemainingTab).toLowerCase();
17
18
  const isPathwaysTab = tabType === formatMessage(messages.programProgressPathwaysTab).toLowerCase();
18
19
  const isProfessionalProgram = programType === PROGRAM_TYPE_MAP.PROFESSIONAL_CERTIFICATE;
20
+ const isXSeriesProgram = programType === PROGRAM_TYPE_MAP.XSERIES;
19
21
  const isMicroMastersProgram = programType === PROGRAM_TYPE_MAP.MICROMASTERS;
20
22
  /*
21
23
  - Formatting pacing type safely
@@ -39,16 +41,14 @@ export const ProgressCard = ({ progressCardData, isLoading, tabType }) => {
39
41
  const canUpgrade = Boolean(upgradeUrl) && !expired;
40
42
  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: [isPathwaysTab ? (_jsx("h5", { className: "mb-1 font-weight-bold card-title", children: title })) : (_jsx("h4", { className: "mb-1 font-weight-bold card-title", children: title })), _jsxs("div", { className: "card-description", children: [enrollmentInfo, description && (_jsx(_Fragment, { children: description }))] })] }), _jsx(ProgressCardActions, { tabType: tabType, redirectUrl: destinationUrl || 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, {
41
43
  certificateDate: (end ? dateFormatter(formatDate, end, 'short') : ''),
42
- })) }), _jsx(ProgressCardButton, { variant: "brand", redirectUrl: certificateUrl ? `${getSiteConfig().lmsBaseUrl}${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, {
43
- status: canUpgrade ? formatMessage(messages.programProgressInProgressCertificateNeedsVerified) : formatMessage(messages.programProgressInProgressCertificateNotEarned), // TODO : Certificate status will change after Upgrade is successful through api
44
- }) }), isProfessionalProgram
45
- && canUpgrade
46
- && getCertificatePriceString(seats)
47
- && (_jsx(ProgressCardButton, { variant: "brand", redirectUrl: "", buttonText: formatMessage(messages.programProgressCardUpgradeButton), type: "upgrade", title: title, price: getCertificatePriceString(seats), courseUrl: courseUrl })), isMicroMastersProgram
48
- && checkoutUrl
49
- && canUpgrade
50
- && (_jsx(ProgressCardButton, { variant: "brand", redirectUrl: checkoutUrl, buttonText: formatMessage(messages.programProgressInProgressCourseMicromastersUpgrade, {
51
- price: getCertificatePriceString(seats, true),
52
- }) }))] }) }))] }) }));
44
+ })) }), _jsx(ProgressCardButton, { variant: "brand", redirectUrl: certificateUrl ? `${getSiteConfig().lmsBaseUrl}${certificateUrl}` : '', buttonText: formatMessage(messages.programProgressCardCompletedCertificateButton) })] }) })), isInProgressTab && (_jsxs(_Fragment, { children: [(isProfessionalProgram || isXSeriesProgram)
45
+ && canUpgrade
46
+ && getCertificatePriceString(seats)
47
+ && (_jsxs(Row, { className: "pt-3 pb-2 px-2 border-top border-2 border-muted mb-2 align-items-center", children: [_jsx(Col, { xs: 12, md: 8, className: "d-flex justify-content-between align-items-center px-0", children: _jsx("span", { className: "text-start", children: formatMessage(messages.programProgressInProgressProfessionalCertificate) }) }), _jsx(Col, { xs: 12, md: 4, className: "d-flex justify-content-between align-items-center px-0", children: _jsx(UpgradeCourseButton, { variant: "brand", buttonText: formatMessage(messages.programProgressCardUpgradeButton), title: title, price: getCertificatePriceString(seats), courseRunKey: courseRunKey || '', courseUrl: courseUrl ? `${getSiteConfig().lmsBaseUrl}${courseUrl}` : '' }) })] })), isMicroMastersProgram
48
+ && checkoutUrl
49
+ && canUpgrade
50
+ && (_jsxs(Row, { className: "pt-3 pb-2 px-2 border-top border-2 border-muted mb-2 align-items-center", children: [_jsx(Col, { xs: 12, md: 8, className: "d-flex justify-content-between align-items-center px-0", children: _jsx("span", { className: "text-start", children: formatMessage(messages.programProgressInProgressMicromastersCertificate) }) }), _jsx(Col, { xs: 12, md: 4, className: "d-flex justify-content-between align-items-center", children: _jsx(ProgressCardButton, { variant: "brand", redirectUrl: checkoutUrl, buttonText: formatMessage(messages.programProgressInProgressCourseMicromastersUpgrade, {
51
+ price: getCertificatePriceString(seats, true),
52
+ }) }) })] }))] }))] }) }));
53
53
  };
54
54
  //# 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,aAAa,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAGhE,OAAO,QAAQ,MAAM,aAAa,CAAC;AACnC,OAAO,cAAc,CAAC;AACtB,OAAO,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AAC,kBAAkB,IACjB,OAAO,EAAC,OAAO,EACf,WAAW,EAAE,WAAW,EACxB,UAAU,EAAE,aAAa,CAAC,QAAQ,CAAC,kDAAkD,EAAE;wCACrF,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 { getSiteConfig, 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, enrollment_date, end, certificateUrl, courseUrl, upgradeUrl, programType, checkoutUrl, expired, seats, description, destinationUrl } = progressCardData;\n\n const inProgressTabKey = formatMessage(messages.programProgressInProgressTab).toLowerCase();\n const isInProgressTab = tabType === inProgressTabKey;\n const isRemainingTab = tabType === formatMessage(messages.programProgressRemainingTab).toLowerCase();\n const isPathwaysTab = tabType === formatMessage(messages.programProgressPathwaysTab).toLowerCase();\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 // base string; pathways tab has no enrollment/subscription status\n let enrollmentInfo = '';\n if (!isPathwaysTab) {\n enrollmentInfo = isRemainingTab\n ? formatMessage(messages.programProgressCardIncludedInSubscriptionText)\n : formatMessage(messages.programProgressCardEnrollText);\n }\n\n // if enrollment start exists\n if (!isPathwaysTab && !isRemainingTab && enrollment_date) {\n const enrollment_date_formatted = dateFormatter(formatDate, enrollment_date, 'short');\n\n enrollmentInfo = enrollmentInfo && `${enrollmentInfo} ${enrollment_date_formatted}`;\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 {isPathwaysTab ? (\n <h5 className=\"mb-1 font-weight-bold card-title\">{title}</h5>\n ) : (\n <h4 className=\"mb-1 font-weight-bold card-title\">{title}</h4>\n )}\n <div className=\"card-description\">\n {enrollmentInfo}\n {description && (\n <>\n {description}\n </>\n )}\n </div>\n </Col>\n <ProgressCardActions tabType={tabType} redirectUrl={destinationUrl || 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 ? `${getSiteConfig().lmsBaseUrl}${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"]}
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,aAAa,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAGhE,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;AAC/E,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,yBAAyB,EAAE,MAAM,iBAAiB,CAAC;AAC5D,OAAO,EAAE,mBAAmB,EAAE,MAAM,4CAA4C,CAAC;AAEjF,MAAM,CAAC,MAAM,YAAY,GAA0B,CAAC,EAAE,gBAAgB,EAAE,SAAS,E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AC,QAAQ,CAAC,gDAAgD,CAAC,GACpE,GACH,EACN,KAAC,GAAG,IAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,EAAE,SAAS,EAAC,mDAAmD,YAC/E,KAAC,kBAAkB,IACjB,OAAO,EAAC,OAAO,EACf,WAAW,EAAE,WAAW,EACxB,UAAU,EAAE,aAAa,CAAC,QAAQ,CAAC,kDAAkD,EAAE;gDACrF,KAAK,EAAE,yBAAyB,CAAC,KAAK,EAAE,IAAI,CAAC;6CAC9C,CAAC,GACF,GACE,IACF,CACP,IACA,CACJ,IAEY,GACV,CACR,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import { FC } from 'react';\nimport { Card, Row, Col } from '@openedx/paragon';\nimport { getSiteConfig, 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';\nimport { UpgradeCourseButton } from '../ProgressCardActions/UpgradeCourseButton';\n\nexport const ProgressCard: FC<ProgressCardProps> = ({ progressCardData, isLoading, tabType }) => {\n const { formatMessage, formatDate } = useIntl();\n\n const { title, enrollment_date, end, certificateUrl, courseUrl, upgradeUrl, programType, checkoutUrl, expired, seats, description, destinationUrl, courseRunKey } = progressCardData;\n\n const inProgressTabKey = formatMessage(messages.programProgressInProgressTab).toLowerCase();\n const isInProgressTab = tabType === inProgressTabKey;\n const isRemainingTab = tabType === formatMessage(messages.programProgressRemainingTab).toLowerCase();\n const isPathwaysTab = tabType === formatMessage(messages.programProgressPathwaysTab).toLowerCase();\n const isProfessionalProgram = programType === PROGRAM_TYPE_MAP.PROFESSIONAL_CERTIFICATE;\n const isXSeriesProgram = programType === PROGRAM_TYPE_MAP.XSERIES;\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 // base string; pathways tab has no enrollment/subscription status\n let enrollmentInfo = '';\n if (!isPathwaysTab) {\n enrollmentInfo = isRemainingTab\n ? formatMessage(messages.programProgressCardIncludedInSubscriptionText)\n : formatMessage(messages.programProgressCardEnrollText);\n }\n\n // if enrollment start exists\n if (!isPathwaysTab && !isRemainingTab && enrollment_date) {\n const enrollment_date_formatted = dateFormatter(formatDate, enrollment_date, 'short');\n\n enrollmentInfo = enrollmentInfo && `${enrollmentInfo} ${enrollment_date_formatted}`;\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 {isPathwaysTab ? (\n <h5 className=\"mb-1 font-weight-bold card-title\">{title}</h5>\n ) : (\n <h4 className=\"mb-1 font-weight-bold card-title\">{title}</h4>\n )}\n <div className=\"card-description\">\n {enrollmentInfo}\n {description && (\n <>\n {description}\n </>\n )}\n </div>\n </Col>\n <ProgressCardActions tabType={tabType} redirectUrl={destinationUrl || 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 ? `${getSiteConfig().lmsBaseUrl}${certificateUrl}` : ''} buttonText={formatMessage(messages.programProgressCardCompletedCertificateButton)} />\n </Col>\n </Row>\n )}\n\n {isInProgressTab && (\n <>\n {(isProfessionalProgram || isXSeriesProgram)\n && canUpgrade\n && getCertificatePriceString(seats)\n && (\n <Row className=\"pt-3 pb-2 px-2 border-top border-2 border-muted mb-2 align-items-center\">\n <Col xs={12} md={8} className=\"d-flex justify-content-between align-items-center px-0\">\n <span className=\"text-start\">\n {formatMessage(messages.programProgressInProgressProfessionalCertificate)}\n </span>\n </Col>\n <Col xs={12} md={4} className=\"d-flex justify-content-between align-items-center px-0\">\n <UpgradeCourseButton\n variant=\"brand\"\n buttonText={formatMessage(messages.programProgressCardUpgradeButton)}\n title={title}\n price={getCertificatePriceString(seats)}\n courseRunKey={courseRunKey || ''}\n courseUrl={courseUrl ? `${getSiteConfig().lmsBaseUrl}${courseUrl}` : ''}\n />\n </Col>\n </Row>\n )}\n {isMicroMastersProgram\n && checkoutUrl\n && canUpgrade\n && (\n <Row className=\"pt-3 pb-2 px-2 border-top border-2 border-muted mb-2 align-items-center\">\n <Col xs={12} md={8} className=\"d-flex justify-content-between align-items-center px-0\">\n <span className=\"text-start\">\n {formatMessage(messages.programProgressInProgressMicromastersCertificate)}\n </span>\n </Col>\n <Col xs={12} md={4} className=\"d-flex justify-content-between align-items-center\">\n <ProgressCardButton\n variant=\"brand\"\n redirectUrl={checkoutUrl}\n buttonText={formatMessage(messages.programProgressInProgressCourseMicromastersUpgrade, {\n price: getCertificatePriceString(seats, true),\n })}\n />\n </Col>\n </Row>\n )}\n </>\n )}\n\n </Card.Section>\n </Card>\n );\n};\n"]}
@@ -1,19 +1,14 @@
1
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
- import { Button, StandardModal, useToggle, ActionRow, Icon } from '@openedx/paragon';
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Button, Icon } from '@openedx/paragon';
3
3
  import { useIntl } from '@openedx/frontend-base';
4
4
  import { Link } from 'react-router-dom';
5
5
  import messages from '../messages';
6
6
  import { Launch } from '@openedx/paragon/icons';
7
- export const ProgressCardButton = ({ variant, redirectUrl, buttonText, type, title, price, courseUrl, destinationUrl }) => {
8
- const [isOpen, open, close] = useToggle(false);
7
+ export const ProgressCardButton = ({ variant, redirectUrl, buttonText, destinationUrl }) => {
9
8
  const { formatMessage } = useIntl();
10
- const isUpgradeButton = type === 'upgrade' && courseUrl; // TODO : Check needs to be added to open this modal only when Upgrade api is as success
11
9
  if (redirectUrl) {
12
10
  return (_jsx(Button, { variant: variant, as: Link, to: redirectUrl, children: buttonText }));
13
11
  }
14
- if (isUpgradeButton) {
15
- 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 }) }) })] }));
16
- }
17
12
  if (destinationUrl) {
18
13
  return (_jsxs(Button, { variant: variant, href: destinationUrl, children: [buttonText, buttonText === formatMessage(messages.programProgressPathwaysCreditPathwayLearnMore) && (_jsx(Icon, { src: Launch, className: "ms-1 ml-1.5" }))] }));
19
14
  }
@@ -1 +1 @@
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,IAAI,EAAE,MAAM,kBAAkB,CAAC;AACrF,OAAO,EAAE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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,IAAI,cAAc,EAAE,CAAC;QACnB,OAAO,CACL,MAAC,MAAM,IAAC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,cAAc,aAC3C,UAAU,EACV,UAAU,KAAK,aAAa,CAAC,QAAQ,CAAC,6CAA6C,CAAC,IAAI,CACvF,KAAC,IAAI,IAAC,GAAG,EAAE,MAAM,EAAE,SAAS,EAAC,aAAa,GAAG,CAC9C,IACM,CACV,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, Icon } 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';\nimport { Launch } from '@openedx/paragon/icons';\n\nexport const ProgressCardButton: FC<ProgressCardButtonProps> = ({ variant, redirectUrl, buttonText, type, title, price, courseUrl, destinationUrl }) => {\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 if (destinationUrl) {\n return (\n <Button variant={variant} href={destinationUrl}>\n {buttonText}\n {buttonText === formatMessage(messages.programProgressPathwaysCreditPathwayLearnMore) && (\n <Icon src={Launch} className=\"ms-1 ml-1.5\" />\n )}\n </Button>\n );\n }\n\n return (\n <Button variant={variant}>\n {buttonText}\n </Button>\n );\n};\n"]}
1
+ {"version":3,"file":"ProgressCardButton.js","sourceRoot":"","sources":["../../../../../src/containers/ProgramDashboard/ProgramProgress/ProgressCardActions/ProgressCardButton.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAGxC,OAAO,QAAQ,MAAM,aAAa,CAAC;AACnC,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAEhD,MAAM,CAAC,MAAM,kBAAkB,GAAgC,CAAC,EAAE,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,cAAc,EAAE,EAAE,EAAE;IACtH,MAAM,EAAE,aAAa,EAAE,GAAG,OAAO,EAAE,CAAC;IAEpC,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,cAAc,EAAE,CAAC;QACnB,OAAO,CACL,MAAC,MAAM,IAAC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,cAAc,aAC3C,UAAU,EACV,UAAU,KAAK,aAAa,CAAC,QAAQ,CAAC,6CAA6C,CAAC,IAAI,CACvF,KAAC,IAAI,IAAC,GAAG,EAAE,MAAM,EAAE,SAAS,EAAC,aAAa,GAAG,CAC9C,IACM,CACV,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, Icon } 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';\nimport { Launch } from '@openedx/paragon/icons';\n\nexport const ProgressCardButton: FC<ProgressCardButtonProps> = ({ variant, redirectUrl, buttonText, destinationUrl }) => {\n const { formatMessage } = useIntl();\n\n if (redirectUrl) {\n return (\n <Button variant={variant} as={Link} to={redirectUrl}>\n {buttonText}\n </Button>\n );\n }\n\n if (destinationUrl) {\n return (\n <Button variant={variant} href={destinationUrl}>\n {buttonText}\n {buttonText === formatMessage(messages.programProgressPathwaysCreditPathwayLearnMore) && (\n <Icon src={Launch} className=\"ms-1 ml-1.5\" />\n )}\n </Button>\n );\n }\n\n return (\n <Button variant={variant}>\n {buttonText}\n </Button>\n );\n};\n"]}
@@ -0,0 +1,3 @@
1
+ import { FC } from 'react';
2
+ import { UpgradeCourseButtonProps } from '../../data/types';
3
+ export declare const UpgradeCourseButton: FC<UpgradeCourseButtonProps>;
@@ -0,0 +1,20 @@
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useQueryClient } from '@tanstack/react-query';
3
+ import { Button } from '@openedx/paragon';
4
+ import { useIntl } from '@openedx/frontend-base';
5
+ import messages from '../messages';
6
+ import ConfirmCourseUpgradeActionModal from '../../../../components/ConfirmCourseUpgradeActionModal';
7
+ import { useUpgradeCourseEnrollment } from '../../../../data/hooks/mutationHooks';
8
+ import { useActionWithModal } from '../../../../hooks';
9
+ export const UpgradeCourseButton = ({ variant, buttonText, title, price, courseRunKey, courseUrl }) => {
10
+ const { formatMessage } = useIntl();
11
+ const queryClient = useQueryClient();
12
+ const { mutateAsync, isPending } = useUpgradeCourseEnrollment();
13
+ const normalizedCourseRunKey = courseRunKey !== null && courseRunKey !== void 0 ? courseRunKey : '';
14
+ const { isModalOpen, isTriggering, trigger, handleSuccessAction, handleCancelAction } = useActionWithModal(() => mutateAsync({ courseRunKey: normalizedCourseRunKey }), {
15
+ shouldOpenModal: (response) => (response === null || response === void 0 ? void 0 : response.success) === true,
16
+ onCancel: () => queryClient.invalidateQueries({ queryKey: ['programProgress'] }),
17
+ });
18
+ return (_jsxs(_Fragment, { children: [_jsx(Button, { variant: variant, onClick: trigger, disabled: !normalizedCourseRunKey || isTriggering || isPending, children: buttonText }), _jsx(ConfirmCourseUpgradeActionModal, { isOpen: isModalOpen, title: formatMessage(messages.programProgressInProgressCourseProfessionalUpgradeModalTitle, { title }), body: formatMessage(messages.programProgressInProgressCourseProfessionalUpgradeModalContent, { price }), onSuccess: handleSuccessAction, onReload: handleCancelAction, reloadLabel: "Close", navigateLabel: "Resume Course", navigateTo: courseUrl || `/courses/${normalizedCourseRunKey}` })] }));
19
+ };
20
+ //# sourceMappingURL=UpgradeCourseButton.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"UpgradeCourseButton.js","sourceRoot":"","sources":["../../../../../src/containers/ProgramDashboard/ProgramProgress/ProgressCardActions/UpgradeCourseButton.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,cAAc,E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sB,IAAI,YAAY,IAAI,SAAS,YAAG,UAAU,GAAU,EAEjI,KAAC,+BAA+B,IAC9B,MAAM,EAAE,WAAW,EACnB,KAAK,EAAE,aAAa,CAAC,QAAQ,CAAC,4DAA4D,EAAE,EAAE,KAAK,EAAE,CAAC,EACtG,IAAI,EAAE,aAAa,CAAC,QAAQ,CAAC,8DAA8D,EAAE,EAAE,KAAK,EAAE,CAAC,EACvG,SAAS,EAAE,mBAAmB,EAC9B,QAAQ,EAAE,kBAAkB,EAC5B,WAAW,EAAC,OAAO,EACnB,aAAa,EAAC,eAAe,EAC7B,UAAU,EAAE,SAAS,IAAI,YAAY,sBAAsB,EAAE,GAC7D,IACD,CACJ,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import { FC } from 'react';\nimport { useQueryClient } from '@tanstack/react-query';\nimport { Button } from '@openedx/paragon';\nimport { useIntl } from '@openedx/frontend-base';\n\nimport { UpgradeCourseButtonProps } from '../../data/types';\nimport messages from '../messages';\n\nimport ConfirmCourseUpgradeActionModal from '@src/components/ConfirmCourseUpgradeActionModal';\nimport { useUpgradeCourseEnrollment } from '@src/data/hooks/mutationHooks';\nimport { useActionWithModal } from '@src/hooks';\n\nexport const UpgradeCourseButton: FC<UpgradeCourseButtonProps> = ({ variant, buttonText, title, price, courseRunKey, courseUrl }) => {\n const { formatMessage } = useIntl();\n const queryClient = useQueryClient();\n const { mutateAsync, isPending } = useUpgradeCourseEnrollment();\n\n const normalizedCourseRunKey = courseRunKey ?? '';\n\n const { isModalOpen, isTriggering, trigger, handleSuccessAction, handleCancelAction } = useActionWithModal(\n () => mutateAsync({ courseRunKey: normalizedCourseRunKey }),\n {\n shouldOpenModal: (response) => response?.success === true,\n onCancel: () => queryClient.invalidateQueries({ queryKey: ['programProgress'] }),\n }\n );\n\n return (\n <>\n <Button variant={variant} onClick={trigger} disabled={!normalizedCourseRunKey || isTriggering || isPending}>{buttonText}</Button>\n\n <ConfirmCourseUpgradeActionModal\n isOpen={isModalOpen}\n title={formatMessage(messages.programProgressInProgressCourseProfessionalUpgradeModalTitle, { title })}\n body={formatMessage(messages.programProgressInProgressCourseProfessionalUpgradeModalContent, { price })}\n onSuccess={handleSuccessAction}\n onReload={handleCancelAction}\n reloadLabel=\"Close\"\n navigateLabel=\"Resume Course\"\n navigateTo={courseUrl || `/courses/${normalizedCourseRunKey}`}\n />\n </>\n );\n};\n"]}
@@ -179,17 +179,12 @@ declare const messages: {
179
179
  id: string;
180
180
  description: string;
181
181
  };
182
- programProgressInProgressCertificateStatus: {
182
+ programProgressInProgressProfessionalCertificate: {
183
183
  defaultMessage: string;
184
184
  id: string;
185
185
  description: string;
186
186
  };
187
- programProgressInProgressCertificateNeedsVerified: {
188
- defaultMessage: string;
189
- id: string;
190
- description: string;
191
- };
192
- programProgressInProgressCertificateNotEarned: {
187
+ programProgressInProgressMicromastersCertificate: {
193
188
  defaultMessage: string;
194
189
  id: string;
195
190
  description: string;
@@ -229,5 +224,10 @@ declare const messages: {
229
224
  id: string;
230
225
  description: string;
231
226
  };
227
+ programProgressReturnToDashboardText: {
228
+ defaultMessage: string;
229
+ id: string;
230
+ description: string;
231
+ };
232
232
  };
233
233
  export default messages;
@@ -180,20 +180,15 @@ const messages = defineMessages({
180
180
  id: 'program.progress.in.progress.course.professional.upgrade.modal.content',
181
181
  description: 'Modal content for Professional Certificate courses in the In Progress tab.',
182
182
  },
183
- programProgressInProgressCertificateStatus: {
184
- defaultMessage: 'Certificate Status: {status}',
185
- id: 'program.progress.in.progress.certificate.status',
186
- description: 'Certificate status for courses in the In Progress tab.',
183
+ programProgressInProgressProfessionalCertificate: {
184
+ defaultMessage: 'This course is included in your subscription. Upgrade to get full course access.',
185
+ id: 'program.progress.in.progress.professional.certificate.status',
186
+ description: 'Certificate status for courses in the In Progress tab related to professional program.',
187
187
  },
188
- programProgressInProgressCertificateNeedsVerified: {
189
- defaultMessage: 'Needs verified certificate',
190
- id: 'program.progress.in.progress.certificate.needs.verified',
191
- description: 'Certificate status indicating that a verified certificate is needed for courses in the In Progress tab.',
192
- },
193
- programProgressInProgressCertificateNotEarned: {
194
- defaultMessage: 'Not earned yet',
195
- id: 'program.progress.in.progress.certificate.not.earned',
196
- description: 'Certificate status indicating that the certificate has not been earned yet for courses in the In Progress tab.',
188
+ programProgressInProgressMicromastersCertificate: {
189
+ defaultMessage: 'Upgrade to get full course access. This course is not included in your subscription.',
190
+ id: 'program.progress.in.progress.micromasters.certificate.needs.verified',
191
+ description: 'Certificate status indicating that a verified certificate is needed for Micromasters courses in the In Progress tab.',
197
192
  },
198
193
  programProgressPathwaysCreditPathwayTitle: {
199
194
  defaultMessage: 'Credit pathways',
@@ -230,6 +225,11 @@ const messages = defineMessages({
230
225
  id: 'program.progress.pathways.credit.pathway.faq.description',
231
226
  description: 'Description for the FAQ section in the Credit Pathway section of the Pathways tab.',
232
227
  },
228
+ programProgressReturnToDashboardText: {
229
+ defaultMessage: 'Return to dashboard',
230
+ id: 'program.progress.return.to.dashboard.text',
231
+ description: 'Text for the return to dashboard link.',
232
+ },
233
233
  });
234
234
  export default messages;
235
235
  //# 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;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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AA6C,EAAE;QAC7C,cAAc,EAAE,gBAAgB;QAChC,EAAE,EAAE,qDAAqD;QACzD,WAAW,EAAE,gHAAgH;KAC9H;IACD,yCAAyC,EAAE;QACzC,cAAc,EAAE,iBAAiB;QACjC,EAAE,EAAE,gDAAgD;QACpD,WAAW,EAAE,2DAA2D;KACzE;IACD,oDAAoD,EAAE;QACpD,cAAc,EAAE,0DAA0D;QAC1E,EAAE,EAAE,4DAA4D;QAChE,WAAW,EAAE,+EAA+E;KAC7F;IACD,oDAAoD,EAAE;QACpD,cAAc,EAAE,2KAA2K;QAC3L,EAAE,EAAE,4DAA4D;QAChE,WAAW,EAAE,gFAAgF;KAC9F;IACD,6CAA6C,EAAE;QAC7C,cAAc,EAAE,YAAY;QAC5B,EAAE,EAAE,qDAAqD;QACzD,WAAW,EAAE,iFAAiF;KAC/F;IACD,6CAA6C,EAAE;QAC7C,cAAc,EAAE,yBAAyB;QACzC,EAAE,EAAE,8CAA8C;QAClD,WAAW,EAAE,0EAA0E;KACxF;IACD,4CAA4C,EAAE;QAC5C,cAAc,EAAE,oDAAoD;QACpE,EAAE,EAAE,oDAAoD;QACxD,WAAW,EAAE,8EAA8E;KAC5F;IACD,kDAAkD,EAAE;QAClD,cAAc,EAAE,iIAAiI;QACjJ,EAAE,EAAE,0DAA0D;QAC9D,WAAW,EAAE,oFAAoF;KAClG;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 on:',\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 programProgressCardIncludedInSubscriptionText: {\n defaultMessage: 'Included in your subscription',\n id: 'program.progress.card.included.in.subscription.text',\n description: 'text to display on the progress card for remaining courses that are included in the subscription',\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 programProgressPathwaysCreditPathwayTitle: {\n defaultMessage: 'Credit pathways',\n id: 'program.progress.pathways.credit.pathway.title',\n description: 'Title for the Credit Pathway section in the Pathways tab.',\n },\n programProgressPathwaysCreditPathwayDescriptionLine1: {\n defaultMessage: 'Transform your {org} {type} into a full master’s degree.',\n id: 'program.progress.pathways.credit.pathway.description.line1',\n description: 'First line of description for the Credit Pathway section in the Pathways tab.',\n },\n programProgressPathwaysCreditPathwayDescriptionLine2: {\n defaultMessage: 'Successful completion of <i>{org} {title}</i> credential can be applied towards flexible, rigorous, and affordable masters degrees from the world’s leading universities.',\n id: 'program.progress.pathways.credit.pathway.description.line2',\n description: 'Second line of description for the Credit Pathway section in the Pathways tab.',\n },\n programProgressPathwaysCreditPathwayLearnMore: {\n defaultMessage: 'Learn more',\n id: 'program.progress.pathways.credit.pathway.learn.more',\n description: 'Text for the Learn More link in the Credit Pathway section of the Pathways tab.',\n },\n programProgressPathwaysCreditPathwayFaqButton: {\n defaultMessage: 'MicroMasters Credit FAQ',\n id: 'program.progress.pathways.credit.pathway.faq',\n description: 'Text for the FAQ link in the Credit Pathway section of the Pathways tab.',\n },\n programProgressPathwaysCreditPathwayFaqTitle: {\n defaultMessage: 'Learn more about how to transfer your MicroMasters',\n id: 'program.progress.pathways.credit.pathway.faq.title',\n description: 'Title for the FAQ section in the Credit Pathway section of the Pathways tab.',\n },\n programProgressPathwaysCreditPathwayFaqDescription: {\n defaultMessage: 'Helper copy to be updated here. Information about how to earn and transfer credits from edX partners to university institutions',\n id: 'program.progress.pathways.credit.pathway.faq.description',\n description: 'Description for the FAQ section in the Credit Pathway section of the Pathways tab.',\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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E,0EAA0E;KACxF;IACD,4CAA4C,EAAE;QAC5C,cAAc,EAAE,oDAAoD;QACpE,EAAE,EAAE,oDAAoD;QACxD,WAAW,EAAE,8EAA8E;KAC5F;IACD,kDAAkD,EAAE;QAClD,cAAc,EAAE,iIAAiI;QACjJ,EAAE,EAAE,0DAA0D;QAC9D,WAAW,EAAE,oFAAoF;KAClG;IACD,oCAAoC,EAAE;QACpC,cAAc,EAAE,qBAAqB;QACrC,EAAE,EAAE,2CAA2C;QAC/C,WAAW,EAAE,wCAAwC;KACtD;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 on:',\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 programProgressCardIncludedInSubscriptionText: {\n defaultMessage: 'Included in your subscription',\n id: 'program.progress.card.included.in.subscription.text',\n description: 'text to display on the progress card for remaining courses that are included in the subscription',\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 programProgressInProgressProfessionalCertificate: {\n defaultMessage: 'This course is included in your subscription. Upgrade to get full course access.',\n id: 'program.progress.in.progress.professional.certificate.status',\n description: 'Certificate status for courses in the In Progress tab related to professional program.',\n },\n programProgressInProgressMicromastersCertificate: {\n defaultMessage: 'Upgrade to get full course access. This course is not included in your subscription.',\n id: 'program.progress.in.progress.micromasters.certificate.needs.verified',\n description: 'Certificate status indicating that a verified certificate is needed for Micromasters courses in the In Progress tab.',\n },\n programProgressPathwaysCreditPathwayTitle: {\n defaultMessage: 'Credit pathways',\n id: 'program.progress.pathways.credit.pathway.title',\n description: 'Title for the Credit Pathway section in the Pathways tab.',\n },\n programProgressPathwaysCreditPathwayDescriptionLine1: {\n defaultMessage: 'Transform your {org} {type} into a full master’s degree.',\n id: 'program.progress.pathways.credit.pathway.description.line1',\n description: 'First line of description for the Credit Pathway section in the Pathways tab.',\n },\n programProgressPathwaysCreditPathwayDescriptionLine2: {\n defaultMessage: 'Successful completion of <i>{org} {title}</i> credential can be applied towards flexible, rigorous, and affordable masters degrees from the world’s leading universities.',\n id: 'program.progress.pathways.credit.pathway.description.line2',\n description: 'Second line of description for the Credit Pathway section in the Pathways tab.',\n },\n programProgressPathwaysCreditPathwayLearnMore: {\n defaultMessage: 'Learn more',\n id: 'program.progress.pathways.credit.pathway.learn.more',\n description: 'Text for the Learn More link in the Credit Pathway section of the Pathways tab.',\n },\n programProgressPathwaysCreditPathwayFaqButton: {\n defaultMessage: 'MicroMasters Credit FAQ',\n id: 'program.progress.pathways.credit.pathway.faq',\n description: 'Text for the FAQ link in the Credit Pathway section of the Pathways tab.',\n },\n programProgressPathwaysCreditPathwayFaqTitle: {\n defaultMessage: 'Learn more about how to transfer your MicroMasters',\n id: 'program.progress.pathways.credit.pathway.faq.title',\n description: 'Title for the FAQ section in the Credit Pathway section of the Pathways tab.',\n },\n programProgressPathwaysCreditPathwayFaqDescription: {\n defaultMessage: 'Helper copy to be updated here. Information about how to earn and transfer credits from edX partners to university institutions',\n id: 'program.progress.pathways.credit.pathway.faq.description',\n description: 'Description for the FAQ section in the Credit Pathway section of the Pathways tab.',\n },\n programProgressReturnToDashboardText: {\n defaultMessage: 'Return to dashboard',\n id: 'program.progress.return.to.dashboard.text',\n description: 'Text for the return to dashboard link.',\n },\n});\n\nexport default messages;\n"]}
@@ -15,6 +15,15 @@ interface CreditParams {
15
15
  courseId: string;
16
16
  username: string;
17
17
  }
18
+ interface UpgradeCourseEnrollmentParams {
19
+ courseRunKey: string;
20
+ }
21
+ interface UpgradeCourseEnrollmentResponse {
22
+ success: boolean;
23
+ biId: string;
24
+ status: string;
25
+ existing: boolean;
26
+ }
18
27
  declare const useUnenrollFromCourse: () => import("@tanstack/react-query").UseMutationResult<any, Error, {
19
28
  courseId: string;
20
29
  }, unknown>;
@@ -23,4 +32,5 @@ declare const useDeleteEntitlementEnrollment: () => import("@tanstack/react-quer
23
32
  declare const useUpdateEmailSettings: () => import("@tanstack/react-query").UseMutationResult<any, Error, UpdateEmailSettingsParams, unknown>;
24
33
  declare const useCreateCreditRequest: () => import("@tanstack/react-query").UseMutationResult<any, Error, CreditParams, unknown>;
25
34
  declare const useSendConfirmEmail: (sendEmailUrl: string) => import("@tanstack/react-query").UseMutationResult<any, Error, void, unknown>;
26
- export { useUnenrollFromCourse, useUpdateEntitlementEnrollment, useDeleteEntitlementEnrollment, useUpdateEmailSettings, useCreateCreditRequest, useSendConfirmEmail, };
35
+ declare const useUpgradeCourseEnrollment: () => import("@tanstack/react-query").UseMutationResult<UpgradeCourseEnrollmentResponse, Error, UpgradeCourseEnrollmentParams, unknown>;
36
+ export { useUnenrollFromCourse, useUpdateEntitlementEnrollment, useDeleteEntitlementEnrollment, useUpdateEmailSettings, useCreateCreditRequest, useSendConfirmEmail, useUpgradeCourseEnrollment, };
@@ -1,7 +1,17 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
1
10
  import { useQueryClient, useMutation } from '@tanstack/react-query';
2
11
  import { logError } from '@openedx/frontend-base';
3
12
  import { createCreditRequest, deleteEntitlementEnrollment, sendConfirmEmail, unenrollFromCourse, updateEmailSettings, updateEntitlementEnrollment, } from '../../data/services/lms/api';
4
13
  import { learnerDashboardQueryKeys, learnerDashboardMutationKeys } from './queryKeys';
14
+ import { upgradeCourseEnrollment } from '../services/subs';
5
15
  const useUnenrollFromCourse = () => {
6
16
  const queryClient = useQueryClient();
7
17
  return useMutation({
@@ -80,5 +90,15 @@ const useSendConfirmEmail = (sendEmailUrl) => {
80
90
  },
81
91
  });
82
92
  };
83
- export { useUnenrollFromCourse, useUpdateEntitlementEnrollment, useDeleteEntitlementEnrollment, useUpdateEmailSettings, useCreateCreditRequest, useSendConfirmEmail, };
93
+ const useUpgradeCourseEnrollment = () => useMutation({
94
+ mutationKey: learnerDashboardMutationKeys.upgradeCourseEnrollment(),
95
+ mutationFn: (_a) => __awaiter(void 0, [_a], void 0, function* ({ courseRunKey }) {
96
+ const response = yield upgradeCourseEnrollment(courseRunKey);
97
+ return response;
98
+ }),
99
+ onError: (error, variables) => {
100
+ logError(`Failed to upgrade course enrollment for courseRunKey ${variables.courseRunKey}:`, error);
101
+ },
102
+ });
103
+ export { useUnenrollFromCourse, useUpdateEntitlementEnrollment, useDeleteEntitlementEnrollment, useUpdateEmailSettings, useCreateCreditRequest, useSendConfirmEmail, useUpgradeCourseEnrollment, };
84
104
  //# sourceMappingURL=mutationHooks.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"mutationHooks.js","sourceRoot":"","sources":["../../../src/data/hooks/mutationHooks.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpE,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAClD,OAAO,EACL,mBAAmB,EACnB,2BAA2B,EAC3B,gBAAgB,EAChB,kBAAkB,EAClB,mBAAmB,EACnB,2BAA2B,GAC5B,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,yBAAyB,EAAE,4BAA4B,EAAE,MAAM,aAAa,CAAC;AAuBtF,MAAM,qBAAqB,GAAG,GAAG,EAAE;IACjC,MAAM,WAAW,GAAG,cAAc,EAAE,CAAC;IAErC,OAAO,WAAW,CAAC;QACjB,WAAW,EAAE,4BAA4B,CAAC,k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AAQ,EAAE,yBAAyB,CAAC,cAAc,EAAE,EAAE,CAAC,CAAC;QAC1F,CAAC;QACD,OAAO,EAAE,CAAC,KAAK,EAAE,SAAS,EAAE,EAAE;YAC5B,QAAQ,CAAC,8CAA8C,SAAS,CAAC,QAAQ,kBAAkB,SAAS,CAAC,UAAU,GAAG,EAAE,KAAK,CAAC,CAAC;QAC7H,CAAC;KACF,CAAC,CAAC;AACL,CAAC,CAAC;AAEF,MAAM,mBAAmB,GAAG,CAAC,YAAoB,EAAE,EAAE;IACnD,MAAM,WAAW,GAAG,cAAc,EAAE,CAAC;IAErC,OAAO,WAAW,CAAC;QACjB,WAAW,EAAE,4BAA4B,CAAC,gBAAgB,CAAC,YAAY,CAAC;QACxE,UAAU,EAAE,GAAG,EAAE,CAAC,gBAAgB,CAAC,YAAY,CAAC;QAChD,SAAS,EAAE,GAAG,EAAE;YACd,WAAW,CAAC,iBAAiB,CAAC,EAAE,QAAQ,EAAE,yBAAyB,CAAC,cAAc,EAAE,EAAE,CAAC,CAAC;QAC1F,CAAC;QACD,OAAO,EAAE,CAAC,KAAK,EAAE,EAAE;YACjB,QAAQ,CAAC,oCAAoC,EAAE,KAAK,CAAC,CAAC;QACxD,CAAC;KACF,CAAC,CAAC;AACL,CAAC,CAAC;AAEF,OAAO,EACL,qBAAqB,EACrB,8BAA8B,EAC9B,8BAA8B,EAC9B,sBAAsB,EACtB,sBAAsB,EACtB,mBAAmB,GACpB,CAAC","sourcesContent":["import { useQueryClient, useMutation } from '@tanstack/react-query';\nimport { logError } from '@openedx/frontend-base';\nimport {\n createCreditRequest,\n deleteEntitlementEnrollment,\n sendConfirmEmail,\n unenrollFromCourse,\n updateEmailSettings,\n updateEntitlementEnrollment,\n} from '@src/data/services/lms/api';\nimport { learnerDashboardQueryKeys, learnerDashboardMutationKeys } from './queryKeys';\n\ninterface UpdateEntitlementProps {\n uuid: string,\n courseId: string,\n}\n\ninterface DeleteEntitlementParams {\n uuid: string,\n isRefundable: boolean,\n}\n\ninterface UpdateEmailSettingsParams {\n courseId: string,\n enable: boolean,\n}\n\ninterface CreditParams {\n providerId: string,\n courseId: string,\n username: string,\n}\n\nconst useUnenrollFromCourse = () => {\n const queryClient = useQueryClient();\n\n return useMutation({\n mutationKey: learnerDashboardMutationKeys.unenrollFromCourse(),\n mutationFn: ({ courseId }: { courseId: string }) => unenrollFromCourse({ courseId }),\n onSuccess: () => {\n queryClient.invalidateQueries({ queryKey: learnerDashboardQueryKeys.initializeBase() });\n },\n onError: (error, variables) => {\n logError(`Failed to unenroll from course ${variables.courseId}:`, error);\n },\n });\n};\n\nconst useUpdateEntitlementEnrollment = () => {\n const queryClient = useQueryClient();\n\n return useMutation({\n mutationKey: learnerDashboardMutationKeys.updateEntitlementEnrollment(),\n mutationFn: ({ uuid, courseId }: UpdateEntitlementProps) => updateEntitlementEnrollment({ uuid, courseId }),\n onSuccess: () => {\n queryClient.invalidateQueries({ queryKey: learnerDashboardQueryKeys.initializeBase() });\n },\n onError: (error, variables) => {\n logError(`Failed to update entitlement enrollment for UUID ${variables.uuid}:`, error);\n },\n });\n};\n\nconst useDeleteEntitlementEnrollment = () => {\n const queryClient = useQueryClient();\n\n return useMutation({\n mutationKey: learnerDashboardMutationKeys.deleteEntitlementEnrollment(),\n mutationFn: (params: DeleteEntitlementParams) => deleteEntitlementEnrollment(params),\n onSuccess: () => {\n queryClient.invalidateQueries({ queryKey: learnerDashboardQueryKeys.initializeBase() });\n },\n onError: (error, variables) => {\n logError(`Failed to delete entitlement enrollment for UUID ${variables.uuid}:`, error);\n },\n });\n};\n\nconst useUpdateEmailSettings = () => {\n const queryClient = useQueryClient();\n\n return useMutation({\n mutationKey: learnerDashboardMutationKeys.updateEmailSettings(),\n mutationFn: ({ courseId, enable }: UpdateEmailSettingsParams) => updateEmailSettings({ courseId, enable }),\n onSuccess: () => {\n queryClient.invalidateQueries({ queryKey: learnerDashboardQueryKeys.initializeBase() });\n },\n onError: (error, variables) => {\n logError(`Failed to update email settings for course ${variables.courseId}:`, error);\n },\n });\n};\n\nconst useCreateCreditRequest = () => {\n const queryClient = useQueryClient();\n\n return useMutation({\n mutationKey: learnerDashboardMutationKeys.createCreditRequest(),\n mutationFn: (props: CreditParams) => createCreditRequest(props),\n onSuccess: () => {\n queryClient.invalidateQueries({ queryKey: learnerDashboardQueryKeys.initializeBase() });\n },\n onError: (error, variables) => {\n logError(`Failed to create credit request for course ${variables.courseId} with provider ${variables.providerId}:`, error);\n },\n });\n};\n\nconst useSendConfirmEmail = (sendEmailUrl: string) => {\n const queryClient = useQueryClient();\n\n return useMutation({\n mutationKey: learnerDashboardMutationKeys.sendConfirmEmail(sendEmailUrl),\n mutationFn: () => sendConfirmEmail(sendEmailUrl),\n onSuccess: () => {\n queryClient.invalidateQueries({ queryKey: learnerDashboardQueryKeys.initializeBase() });\n },\n onError: (error) => {\n logError('Failed to send confirmation email:', error);\n },\n });\n};\n\nexport {\n useUnenrollFromCourse,\n useUpdateEntitlementEnrollment,\n useDeleteEntitlementEnrollment,\n useUpdateEmailSettings,\n useCreateCreditRequest,\n useSendConfirmEmail,\n};\n"]}
1
+ {"version":3,"file":"mutationHooks.js","sourceRoot":"","sources":["../../../src/data/hooks/mutationHooks.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpE,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAClD,OAAO,EACL,mBAAmB,EACnB,2BAA2B,EAC3B,gBAAgB,EAChB,kBAAkB,EAClB,mBAAmB,EACnB,2BAA2B,GAC5B,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,yBAAyB,EAAE,4BAA4B,EAAE,MAAM,aAAa,CAAC;AACtF,OAAO,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAC;AAkC3D,MAAM,qBAAqB,GAAG,GAAG,EAAE;IACjC,MAAM,WAAW,GAAG,cAAc,EAAE,CAAC;IAErC,OAAO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CAAC;IACrG,CAAC;CACF,CAAC,CAAC;AAEH,OAAO,EACL,qBAAqB,EACrB,8BAA8B,EAC9B,8BAA8B,EAC9B,sBAAsB,EACtB,sBAAsB,EACtB,mBAAmB,EACnB,0BAA0B,GAC3B,CAAC","sourcesContent":["import { useQueryClient, useMutation } from '@tanstack/react-query';\nimport { logError } from '@openedx/frontend-base';\nimport {\n createCreditRequest,\n deleteEntitlementEnrollment,\n sendConfirmEmail,\n unenrollFromCourse,\n updateEmailSettings,\n updateEntitlementEnrollment,\n} from '@src/data/services/lms/api';\nimport { learnerDashboardQueryKeys, learnerDashboardMutationKeys } from './queryKeys';\nimport { upgradeCourseEnrollment } from '../services/subs';\n\ninterface UpdateEntitlementProps {\n uuid: string,\n courseId: string,\n}\n\ninterface DeleteEntitlementParams {\n uuid: string,\n isRefundable: boolean,\n}\n\ninterface UpdateEmailSettingsParams {\n courseId: string,\n enable: boolean,\n}\n\ninterface CreditParams {\n providerId: string,\n courseId: string,\n username: string,\n}\n\ninterface UpgradeCourseEnrollmentParams {\n courseRunKey: string,\n}\n\ninterface UpgradeCourseEnrollmentResponse {\n success: boolean,\n biId: string,\n status: string,\n existing: boolean,\n}\n\nconst useUnenrollFromCourse = () => {\n const queryClient = useQueryClient();\n\n return useMutation({\n mutationKey: learnerDashboardMutationKeys.unenrollFromCourse(),\n mutationFn: ({ courseId }: { courseId: string }) => unenrollFromCourse({ courseId }),\n onSuccess: () => {\n queryClient.invalidateQueries({ queryKey: learnerDashboardQueryKeys.initializeBase() });\n },\n onError: (error, variables) => {\n logError(`Failed to unenroll from course ${variables.courseId}:`, error);\n },\n });\n};\n\nconst useUpdateEntitlementEnrollment = () => {\n const queryClient = useQueryClient();\n\n return useMutation({\n mutationKey: learnerDashboardMutationKeys.updateEntitlementEnrollment(),\n mutationFn: ({ uuid, courseId }: UpdateEntitlementProps) => updateEntitlementEnrollment({ uuid, courseId }),\n onSuccess: () => {\n queryClient.invalidateQueries({ queryKey: learnerDashboardQueryKeys.initializeBase() });\n },\n onError: (error, variables) => {\n logError(`Failed to update entitlement enrollment for UUID ${variables.uuid}:`, error);\n },\n });\n};\n\nconst useDeleteEntitlementEnrollment = () => {\n const queryClient = useQueryClient();\n\n return useMutation({\n mutationKey: learnerDashboardMutationKeys.deleteEntitlementEnrollment(),\n mutationFn: (params: DeleteEntitlementParams) => deleteEntitlementEnrollment(params),\n onSuccess: () => {\n queryClient.invalidateQueries({ queryKey: learnerDashboardQueryKeys.initializeBase() });\n },\n onError: (error, variables) => {\n logError(`Failed to delete entitlement enrollment for UUID ${variables.uuid}:`, error);\n },\n });\n};\n\nconst useUpdateEmailSettings = () => {\n const queryClient = useQueryClient();\n\n return useMutation({\n mutationKey: learnerDashboardMutationKeys.updateEmailSettings(),\n mutationFn: ({ courseId, enable }: UpdateEmailSettingsParams) => updateEmailSettings({ courseId, enable }),\n onSuccess: () => {\n queryClient.invalidateQueries({ queryKey: learnerDashboardQueryKeys.initializeBase() });\n },\n onError: (error, variables) => {\n logError(`Failed to update email settings for course ${variables.courseId}:`, error);\n },\n });\n};\n\nconst useCreateCreditRequest = () => {\n const queryClient = useQueryClient();\n\n return useMutation({\n mutationKey: learnerDashboardMutationKeys.createCreditRequest(),\n mutationFn: (props: CreditParams) => createCreditRequest(props),\n onSuccess: () => {\n queryClient.invalidateQueries({ queryKey: learnerDashboardQueryKeys.initializeBase() });\n },\n onError: (error, variables) => {\n logError(`Failed to create credit request for course ${variables.courseId} with provider ${variables.providerId}:`, error);\n },\n });\n};\n\nconst useSendConfirmEmail = (sendEmailUrl: string) => {\n const queryClient = useQueryClient();\n\n return useMutation({\n mutationKey: learnerDashboardMutationKeys.sendConfirmEmail(sendEmailUrl),\n mutationFn: () => sendConfirmEmail(sendEmailUrl),\n onSuccess: () => {\n queryClient.invalidateQueries({ queryKey: learnerDashboardQueryKeys.initializeBase() });\n },\n onError: (error) => {\n logError('Failed to send confirmation email:', error);\n },\n });\n};\n\nconst useUpgradeCourseEnrollment = () => useMutation({\n mutationKey: learnerDashboardMutationKeys.upgradeCourseEnrollment(),\n mutationFn: async ({ courseRunKey }: UpgradeCourseEnrollmentParams,\n ): Promise<UpgradeCourseEnrollmentResponse> => {\n const response = await upgradeCourseEnrollment(courseRunKey);\n return response;\n },\n onError: (error, variables) => {\n logError(`Failed to upgrade course enrollment for courseRunKey ${variables.courseRunKey}:`, error);\n },\n});\n\nexport {\n useUnenrollFromCourse,\n useUpdateEntitlementEnrollment,\n useDeleteEntitlementEnrollment,\n useUpdateEmailSettings,\n useCreateCreditRequest,\n useSendConfirmEmail,\n useUpgradeCourseEnrollment,\n};\n"]}
@@ -11,4 +11,5 @@ export declare const learnerDashboardMutationKeys: {
11
11
  updateEmailSettings: () => readonly ["learner-dashboard", "updateEmailSettings"];
12
12
  createCreditRequest: () => readonly ["learner-dashboard", "createCreditRequest"];
13
13
  sendConfirmEmail: (sendEmailUrl: string) => readonly ["learner-dashboard", "sendConfirmEmail", string];
14
+ upgradeCourseEnrollment: () => readonly ["learner-dashboard", "upgradeCourseEnrollment"];
14
15
  };
@@ -12,5 +12,6 @@ export const learnerDashboardMutationKeys = {
12
12
  updateEmailSettings: () => [...BASE_KEY, 'updateEmailSettings'],
13
13
  createCreditRequest: () => [...BASE_KEY, 'createCreditRequest'],
14
14
  sendConfirmEmail: (sendEmailUrl) => [...BASE_KEY, 'sendConfirmEmail', sendEmailUrl],
15
+ upgradeCourseEnrollment: () => [...BASE_KEY, 'upgradeCourseEnrollment'],
15
16
  };
16
17
  //# sourceMappingURL=queryKeys.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"queryKeys.js","sourceRoot":"","sources":["../../../src/data/hooks/queryKeys.ts"],"names":[],"mappings":"AAAA,MAAM,QAAQ,GAAG,CAAC,mBAAmB,CAAU,CAAC;AAEhD,MAAM,CAAC,MAAM,yBAAyB,GAAG;IACvC,GAAG,EAAE,QAAQ;IACb,cAAc,EAAE,GAAG,EAAE,CAAC,CAAC,GAAG,QAAQ,EAAE,YAAY,CAAU;IAC1D,uBAAuB,EAAE,CAAC,eAA+B,EAAE,EAAE,CAAC,CAAC,GAAG,QAAQ,EAAE,YAAY,EAAE,cAAc,EAAE,eAAe,CAAU;IACnI,6BAA6B,EAAE,CAAC,eAA+B,EAAE,EAAE,CAAC,CAAC,GAAG,QAAQ,EAAE,YAAY,EAAE,uBAAuB,EAAE,eAAe,CAAU;CACnJ,CAAC;AAEF,MAAM,CAAC,MAAM,4BAA4B,GAAG;IAC1C,kBAAkB,EAAE,GAAG,EAAE,CAAC,CAAC,GAAG,QAAQ,EAAE,oBAAoB,CAAU;IACtE,2BAA2B,EAAE,GAAG,EAAE,CAAC,CAAC,GAAG,QAAQ,EAAE,6BAA6B,CAAU;IACxF,2BAA2B,EAAE,GAAG,EAAE,CAAC,CAAC,GAAG,QAAQ,EAAE,6BAA6B,CAAU;IACxF,mBAAmB,EAAE,GAAG,EAAE,CAAC,CAAC,GAAG,QAAQ,EAAE,qBAAqB,CAAU;IACxE,mBAAmB,EAAE,GAAG,EAAE,CAAC,CAAC,GAAG,QAAQ,EAAE,qBAAqB,CAAU;IACxE,gBAAgB,EAAE,CAAC,YAAoB,EAAE,EAAE,CAAC,CAAC,GAAG,QAAQ,EAAE,kBAAkB,EAAE,YAAY,CAAU;CACrG,CAAC","sourcesContent":["const BASE_KEY = ['learner-dashboard'] as const;\n\nexport const learnerDashboardQueryKeys = {\n all: BASE_KEY,\n initializeBase: () => [...BASE_KEY, 'initialize'] as const,\n initializeSubsDashboard: (masqueradedUser?: string | null) => [...BASE_KEY, 'initialize', 'learner-home', masqueradedUser] as const,\n initializeSubsCourseDashboard: (masqueradedUser?: string | null) => [...BASE_KEY, 'initialize', 'subs-course-dashboard', masqueradedUser] as const,\n};\n\nexport const learnerDashboardMutationKeys = {\n unenrollFromCourse: () => [...BASE_KEY, 'unenrollFromCourse'] as const,\n updateEntitlementEnrollment: () => [...BASE_KEY, 'updateEntitlementEnrollment'] as const,\n deleteEntitlementEnrollment: () => [...BASE_KEY, 'deleteEntitlementEnrollment'] as const,\n updateEmailSettings: () => [...BASE_KEY, 'updateEmailSettings'] as const,\n createCreditRequest: () => [...BASE_KEY, 'createCreditRequest'] as const,\n sendConfirmEmail: (sendEmailUrl: string) => [...BASE_KEY, 'sendConfirmEmail', sendEmailUrl] as const,\n};\n"]}
1
+ {"version":3,"file":"queryKeys.js","sourceRoot":"","sources":["../../../src/data/hooks/queryKeys.ts"],"names":[],"mappings":"AAAA,MAAM,QAAQ,GAAG,CAAC,mBAAmB,CAAU,CAAC;AAEhD,MAAM,CAAC,MAAM,yBAAyB,GAAG;IACvC,GAAG,EAAE,QAAQ;IACb,cAAc,EAAE,GAAG,EAAE,CAAC,CAAC,GAAG,QAAQ,EAAE,YAAY,CAAU;IAC1D,uBAAuB,EAAE,CAAC,eAA+B,EAAE,EAAE,CAAC,CAAC,GAAG,QAAQ,EAAE,YAAY,EAAE,cAAc,EAAE,eAAe,CAAU;IACnI,6BAA6B,EAAE,CAAC,eAA+B,EAAE,EAAE,CAAC,CAAC,GAAG,QAAQ,EAAE,YAAY,EAAE,uBAAuB,EAAE,eAAe,CAAU;CACnJ,CAAC;AAEF,MAAM,CAAC,MAAM,4BAA4B,GAAG;IAC1C,kBAAkB,EAAE,GAAG,EAAE,CAAC,CAAC,GAAG,QAAQ,EAAE,oBAAoB,CAAU;IACtE,2BAA2B,EAAE,GAAG,EAAE,CAAC,CAAC,GAAG,QAAQ,EAAE,6BAA6B,CAAU;IACxF,2BAA2B,EAAE,GAAG,EAAE,CAAC,CAAC,GAAG,QAAQ,EAAE,6BAA6B,CAAU;IACxF,mBAAmB,EAAE,GAAG,EAAE,CAAC,CAAC,GAAG,QAAQ,EAAE,qBAAqB,CAAU;IACxE,mBAAmB,EAAE,GAAG,EAAE,CAAC,CAAC,GAAG,QAAQ,EAAE,qBAAqB,CAAU;IACxE,gBAAgB,EAAE,CAAC,YAAoB,EAAE,EAAE,CAAC,CAAC,GAAG,QAAQ,EAAE,kBAAkB,EAAE,YAAY,CAAU;IACpG,uBAAuB,EAAE,GAAG,EAAE,CAAC,CAAC,GAAG,QAAQ,EAAE,yBAAyB,CAAU;CACjF,CAAC","sourcesContent":["const BASE_KEY = ['learner-dashboard'] as const;\n\nexport const learnerDashboardQueryKeys = {\n all: BASE_KEY,\n initializeBase: () => [...BASE_KEY, 'initialize'] as const,\n initializeSubsDashboard: (masqueradedUser?: string | null) => [...BASE_KEY, 'initialize', 'learner-home', masqueradedUser] as const,\n initializeSubsCourseDashboard: (masqueradedUser?: string | null) => [...BASE_KEY, 'initialize', 'subs-course-dashboard', masqueradedUser] as const,\n};\n\nexport const learnerDashboardMutationKeys = {\n unenrollFromCourse: () => [...BASE_KEY, 'unenrollFromCourse'] as const,\n updateEntitlementEnrollment: () => [...BASE_KEY, 'updateEntitlementEnrollment'] as const,\n deleteEntitlementEnrollment: () => [...BASE_KEY, 'deleteEntitlementEnrollment'] as const,\n updateEmailSettings: () => [...BASE_KEY, 'updateEmailSettings'] as const,\n createCreditRequest: () => [...BASE_KEY, 'createCreditRequest'] as const,\n sendConfirmEmail: (sendEmailUrl: string) => [...BASE_KEY, 'sendConfirmEmail', sendEmailUrl] as const,\n upgradeCourseEnrollment: () => [...BASE_KEY, 'upgradeCourseEnrollment'] as const,\n};\n"]}
@@ -2,3 +2,4 @@ export declare const initializeSubsList: (user: any) => Promise<any>;
2
2
  export declare const initializeCourseList: (user: any) => Promise<any>;
3
3
  export declare const getProgramProgressData: (uuid: string) => Promise<any>;
4
4
  export declare const getProgramsListData: () => Promise<any>;
5
+ export declare const upgradeCourseEnrollment: (courseRunKey: string) => Promise<any>;
@@ -40,4 +40,15 @@ export const getProgramsListData = () => __awaiter(void 0, void 0, void 0, funct
40
40
  throw error;
41
41
  }
42
42
  });
43
+ export const upgradeCourseEnrollment = (courseRunKey) => __awaiter(void 0, void 0, void 0, function* () {
44
+ try {
45
+ const content = { courseRunKey };
46
+ const { data } = yield getAuthenticatedHttpClient().post(urls.upgradeCourseEnrollment(), content);
47
+ return data;
48
+ }
49
+ catch (error) {
50
+ console.error('Error upgrading course enrollment:', error);
51
+ throw error;
52
+ }
53
+ });
43
54
  //# sourceMappingURL=api.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"api.js","sourceRoot":"","sources":["../../../../src/data/services/subs/api.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,0BAA0B,EAAE,MAAM,wBAAwB,CAAC;AACpE,OAAO,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAC;AAE5D,OAAO,EAAE,OAAO,EAAE,MAAM,kCAAkC,CAAC;AAC3D,OAAO,IAAI,MAAM,8BAA8B,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAE5D,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAO,IAAI,EAAE,EAAE;IAC/C,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,0BAA0B,EAAE,CAAC,GAAG,CACrD,YAAY,CAAC,IAAI,CAAC,iBAAiB,EAAE,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,CAAC,CACjE,CAAC;IACF,OAAO,IAAI,CAAC;AACd,CAAC,CAAA,CAAC;AAEF,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAO,IAAI,EAAE,EAAE;IACjD,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,0BAA0B,EAAE,CAAC,GAAG,CACrD,YAAY,CAAC,IAAI,CAAC,oBAAoB,EAAE,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,CAAC,CACpE,CAAC;IACF,OAAO,IAAI,CAAC;AACd,CAAC,CAAA,CAAC;AAEF,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAO,IAAY,EAAE,EAAE;IAC3D,IAAI,CAAC;QACH,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,0BAA0B,EAAE,CAAC,GAAG,CAAC,kBAAkB,CAAC,IAAI,CAAC,CAAC,CAAC;QAClF,OAAO,IAAI,CAAC;IACd,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,uCAAuC,EAAE,KAAK,CAAC,CAAC;QAC9D,MAAM,KAAK,CAAC;IACd,CAAC;AACH,CAAC,CAAA,CAAC;AAEF,MAAM,CAAC,MAAM,mBAAmB,GAAG,GAAS,EAAE;IAC5C,IAAI,CAAC;QACH,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,0BAA0B,EAAE,CAAC,GAAG,CAAC,cAAc,EAAE,CAAC,CAAC;QAC1E,OAAO,IAAI,CAAC;IACd,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,mCAAmC,EAAE,KAAK,CAAC,CAAC;QAC1D,MAAM,KAAK,CAAC;IACd,CAAC;AACH,CAAC,CAAA,CAAC","sourcesContent":["import { getAuthenticatedHttpClient } from '@openedx/frontend-base';\nimport { programProgressUrl, programsApiUrl } from './urls';\n\nimport { apiKeys } from '@src/data/services/lms/constants';\nimport urls from '@src/data/services/subs/urls';\nimport { stringifyUrl } from '@src/data/services/lms/utils';\n\nexport const initializeSubsList = async (user) => {\n const { data } = await getAuthenticatedHttpClient().get(\n stringifyUrl(urls.getSubsInitApiUrl(), { [apiKeys.user]: user }),\n );\n return data;\n};\n\nexport const initializeCourseList = async (user) => {\n const { data } = await getAuthenticatedHttpClient().get(\n stringifyUrl(urls.getSubsCoursesApiUrl(), { [apiKeys.user]: user }),\n );\n return data;\n};\n\nexport const getProgramProgressData = async (uuid: string) => {\n try {\n const { data } = await getAuthenticatedHttpClient().get(programProgressUrl(uuid));\n return data;\n } catch (error) {\n console.error('Error fetching program progress data:', error);\n throw error;\n }\n};\n\nexport const getProgramsListData = async () => {\n try {\n const { data } = await getAuthenticatedHttpClient().get(programsApiUrl());\n return data;\n } catch (error) {\n console.error('Error fetching program list data:', error);\n throw error;\n }\n};\n"]}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uCAAuC,EAAE,KAAK,CAAC,CAAC;QAC9D,MAAM,KAAK,CAAC;IACd,CAAC;AACH,CAAC,CAAA,CAAC;AAEF,MAAM,CAAC,MAAM,mBAAmB,GAAG,GAAS,EAAE;IAC5C,IAAI,CAAC;QACH,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,0BAA0B,EAAE,CAAC,GAAG,CAAC,cAAc,EAAE,CAAC,CAAC;QAC1E,OAAO,IAAI,CAAC;IACd,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,mCAAmC,EAAE,KAAK,CAAC,CAAC;QAC1D,MAAM,KAAK,CAAC;IACd,CAAC;AACH,CAAC,CAAA,CAAC;AAEF,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAO,YAAoB,EAAE,EAAE;IACpE,IAAI,CAAC;QACH,MAAM,OAAO,GAAG,EAAE,YAAY,EAAE,CAAC;QACjC,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,0BAA0B,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,uBAAuB,EAAE,EAAE,OAAO,CAAC,CAAC;QAClG,OAAO,IAAI,CAAC;IACd,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,oCAAoC,EAAE,KAAK,CAAC,CAAC;QAC3D,MAAM,KAAK,CAAC;IACd,CAAC;AACH,CAAC,CAAA,CAAC","sourcesContent":["import { getAuthenticatedHttpClient } from '@openedx/frontend-base';\nimport { programProgressUrl, programsApiUrl } from './urls';\n\nimport { apiKeys } from '@src/data/services/lms/constants';\nimport urls from '@src/data/services/subs/urls';\nimport { stringifyUrl } from '@src/data/services/lms/utils';\n\nexport const initializeSubsList = async (user) => {\n const { data } = await getAuthenticatedHttpClient().get(\n stringifyUrl(urls.getSubsInitApiUrl(), { [apiKeys.user]: user }),\n );\n return data;\n};\n\nexport const initializeCourseList = async (user) => {\n const { data } = await getAuthenticatedHttpClient().get(\n stringifyUrl(urls.getSubsCoursesApiUrl(), { [apiKeys.user]: user }),\n );\n return data;\n};\n\nexport const getProgramProgressData = async (uuid: string) => {\n try {\n const { data } = await getAuthenticatedHttpClient().get(programProgressUrl(uuid));\n return data;\n } catch (error) {\n console.error('Error fetching program progress data:', error);\n throw error;\n }\n};\n\nexport const getProgramsListData = async () => {\n try {\n const { data } = await getAuthenticatedHttpClient().get(programsApiUrl());\n return data;\n } catch (error) {\n console.error('Error fetching program list data:', error);\n throw error;\n }\n};\n\nexport const upgradeCourseEnrollment = async (courseRunKey: string) => {\n try {\n const content = { courseRunKey };\n const { data } = await getAuthenticatedHttpClient().post(urls.upgradeCourseEnrollment(), content);\n return data;\n } catch (error) {\n console.error('Error upgrading course enrollment:', error);\n throw error;\n }\n};\n"]}
@@ -1 +1 @@
1
- export { getProgramProgressData, getProgramsListData, initializeCourseList, initializeSubsList, } from './api';
1
+ export { getProgramProgressData, getProgramsListData, initializeCourseList, initializeSubsList, upgradeCourseEnrollment } from './api';
@@ -1,2 +1,2 @@
1
- export { getProgramProgressData, getProgramsListData, initializeCourseList, initializeSubsList, } from './api';
1
+ export { getProgramProgressData, getProgramsListData, initializeCourseList, initializeSubsList, upgradeCourseEnrollment } from './api';
2
2
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/data/services/subs/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,sBAAsB,EACtB,mBAAmB,EACnB,oBAAoB,EACpB,kBAAkB,GACnB,MAAM,OAAO,CAAC","sourcesContent":["export {\n getProgramProgressData,\n getProgramsListData,\n initializeCourseList,\n initializeSubsList,\n} from './api';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/data/services/subs/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,sBAAsB,EACtB,mBAAmB,EACnB,oBAAoB,EACpB,kBAAkB,EAClB,uBAAuB,EACxB,MAAM,OAAO,CAAC","sourcesContent":["export {\n getProgramProgressData,\n getProgramsListData,\n initializeCourseList,\n initializeSubsList,\n upgradeCourseEnrollment\n} from './api';\n"]}
@@ -3,5 +3,6 @@ export declare const getSubsInitApiUrl: () => string;
3
3
  export declare const programProgressUrl: (uuid: string) => string;
4
4
  export declare const programsApiUrl: () => string;
5
5
  export declare const getSubsCoursesApiUrl: () => string;
6
+ export declare const upgradeCourseEnrollment: () => string;
6
7
  declare const _default: any;
7
8
  export default _default;
@@ -5,11 +5,13 @@ 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/`);
8
+ export const upgradeCourseEnrollment = () => (`${getApiUrl()}/subscription/enrollment/upgrade/`);
8
9
  export default StrictDict({
9
10
  getApiUrl,
10
11
  programProgressUrl,
11
12
  programsApiUrl,
12
13
  getSubsCoursesApiUrl,
13
14
  getSubsInitApiUrl,
15
+ upgradeCourseEnrollment,
14
16
  });
15
17
  //# sourceMappingURL=urls.js.map
@@ -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,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"]}
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,MAAM,CAAC,MAAM,uBAAuB,GAAG,GAAG,EAAE,CAAC,CAAC,GAAG,SAAS,EAAE,mCAAmC,CAAC,CAAC;AAEjG,eAAe,UAAU,CAAC;IACxB,SAAS;IACT,kBAAkB;IAClB,cAAc;IACd,oBAAoB;IACpB,iBAAiB;IACjB,uBAAuB;CACxB,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 const upgradeCourseEnrollment = () => (`${getApiUrl()}/subscription/enrollment/upgrade/`);\n\nexport default StrictDict({\n getApiUrl,\n programProgressUrl,\n programsApiUrl,\n getSubsCoursesApiUrl,\n getSubsInitApiUrl,\n upgradeCourseEnrollment,\n});\n"]}
@@ -5,4 +5,5 @@ import useCourseTrackingEvent from './useCourseTrackingEvent';
5
5
  import useEntitlementInfo from './useEntitlementInfo';
6
6
  import useIsMasquerading from './useIsMasquerading';
7
7
  import { useProgressData } from './useProgressData';
8
- export { useCourseData, useCourseTrackingEvent, useEntitlementInfo, useIsMasquerading, useProgressData };
8
+ import { useActionWithModal } from './useActionWithModal';
9
+ export { useCourseData, useCourseTrackingEvent, useEntitlementInfo, useIsMasquerading, useProgressData, useActionWithModal };
@@ -4,10 +4,12 @@ import useCourseTrackingEvent from './useCourseTrackingEvent';
4
4
  import useEntitlementInfo from './useEntitlementInfo';
5
5
  import useIsMasquerading from './useIsMasquerading';
6
6
  import { useProgressData } from './useProgressData';
7
+ import { useActionWithModal } from './useActionWithModal';
7
8
  export const utilHooks = utils;
8
9
  export { useCourseData };
9
10
  export { useCourseTrackingEvent };
10
11
  export { useEntitlementInfo };
11
12
  export { useIsMasquerading };
12
13
  export { useProgressData };
14
+ export { useActionWithModal };
13
15
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/hooks/index.js"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,SAAS,CAAC;AACjC,OAAO,aAAa,MAAM,iBAAiB,CAAC;AAC5C,OAAO,sBAAsB,MAAM,0BAA0B,CAAC;AAC9D,OAAO,kBAAkB,MAAM,sBAAsB,CAAC;AACtD,OAAO,iBAAiB,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEpD,MAAM,CAAC,MAAM,SAAS,GAAG,KAAK,CAAC;AAC/B,OAAO,EAAE,aAAa,EAAE,CAAC;AACzB,OAAO,EAAE,sBAAsB,EAAE,CAAC;AAClC,OAAO,EAAE,kBAAkB,EAAE,CAAC;AAC9B,OAAO,EAAE,iBAAiB,EAAE,CAAC;AAC7B,OAAO,EAAE,eAAe,EAAE,CAAC","sourcesContent":["import * as utils from './utils';\nimport useCourseData from './useCourseData';\nimport useCourseTrackingEvent from './useCourseTrackingEvent';\nimport useEntitlementInfo from './useEntitlementInfo';\nimport useIsMasquerading from './useIsMasquerading';\nimport { useProgressData } from './useProgressData';\n\nexport const utilHooks = utils;\nexport { useCourseData };\nexport { useCourseTrackingEvent };\nexport { useEntitlementInfo };\nexport { useIsMasquerading };\nexport { useProgressData };\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/hooks/index.js"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,SAAS,CAAC;AACjC,OAAO,aAAa,MAAM,iBAAiB,CAAC;AAC5C,OAAO,sBAAsB,MAAM,0BAA0B,CAAC;AAC9D,OAAO,kBAAkB,MAAM,sBAAsB,CAAC;AACtD,OAAO,iBAAiB,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE1D,MAAM,CAAC,MAAM,SAAS,GAAG,KAAK,CAAC;AAC/B,OAAO,EAAE,aAAa,EAAE,CAAC;AACzB,OAAO,EAAE,sBAAsB,EAAE,CAAC;AAClC,OAAO,EAAE,kBAAkB,EAAE,CAAC;AAC9B,OAAO,EAAE,iBAAiB,EAAE,CAAC;AAC7B,OAAO,EAAE,eAAe,EAAE,CAAC;AAC3B,OAAO,EAAE,kBAAkB,EAAE,CAAC","sourcesContent":["import * as utils from './utils';\nimport useCourseData from './useCourseData';\nimport useCourseTrackingEvent from './useCourseTrackingEvent';\nimport useEntitlementInfo from './useEntitlementInfo';\nimport useIsMasquerading from './useIsMasquerading';\nimport { useProgressData } from './useProgressData';\nimport { useActionWithModal } from './useActionWithModal';\n\nexport const utilHooks = utils;\nexport { useCourseData };\nexport { useCourseTrackingEvent };\nexport { useEntitlementInfo };\nexport { useIsMasquerading };\nexport { useProgressData };\nexport { useActionWithModal };\n"]}
@@ -0,0 +1,15 @@
1
+ interface UseActionWithModalProps<TResponse> {
2
+ shouldOpenModal?: (response: TResponse) => boolean;
3
+ onSuccess?: () => void;
4
+ onCancel?: () => void;
5
+ onError?: (error: unknown) => void;
6
+ }
7
+ export declare const useActionWithModal: <TArgs extends unknown[], TResponse>(action: (...args: TArgs) => Promise<TResponse>, options?: UseActionWithModalProps<TResponse>) => {
8
+ isModalOpen: boolean;
9
+ isTriggering: boolean;
10
+ trigger: (...args: TArgs) => Promise<TResponse>;
11
+ handleSuccessAction: () => void;
12
+ handleCancelAction: () => void;
13
+ closeModal: () => void;
14
+ };
15
+ export {};
@@ -0,0 +1,49 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ import { useState, useCallback } from 'react';
11
+ export const useActionWithModal = (action, options = {}) => {
12
+ const { shouldOpenModal = (response) => Boolean(response), onSuccess, onCancel, onError } = options;
13
+ const [isModalOpen, setIsModalOpen] = useState(false);
14
+ const [isTriggering, setIsTrigerring] = useState(false);
15
+ const trigger = useCallback((...args) => __awaiter(void 0, void 0, void 0, function* () {
16
+ setIsTrigerring(true);
17
+ try {
18
+ const response = yield action(...args);
19
+ if (shouldOpenModal(response)) {
20
+ setIsModalOpen(true);
21
+ }
22
+ return response;
23
+ }
24
+ catch (error) {
25
+ onError === null || onError === void 0 ? void 0 : onError(error);
26
+ throw error;
27
+ }
28
+ finally {
29
+ setIsTrigerring(false);
30
+ }
31
+ }), [action, shouldOpenModal, onError]);
32
+ const handleSuccessAction = useCallback(() => {
33
+ setIsModalOpen(false);
34
+ onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess();
35
+ }, [onSuccess]);
36
+ const handleCancelAction = useCallback(() => {
37
+ setIsModalOpen(false);
38
+ onCancel === null || onCancel === void 0 ? void 0 : onCancel();
39
+ }, [onCancel]);
40
+ return {
41
+ isModalOpen,
42
+ isTriggering,
43
+ trigger,
44
+ handleSuccessAction,
45
+ handleCancelAction,
46
+ closeModal: () => setIsModalOpen(false)
47
+ };
48
+ };
49
+ //# sourceMappingURL=useActionWithModal.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useActionWithModal.js","sourceRoot":"","sources":["../../src/hooks/useActionWithModal.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAS9C,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAChC,MAA8C,EAC9C,UAA8C,EAAE,EAChD,EAAE;IACF,MAAM,EAAE,eAAe,GAAG,CAAC,QAAmB,EAAE,EAAE,CAAC,OAAO,CAAC,QAAQ,CAAC,EAClE,SAAS,EACT,QAAQ,EACR,OAAO,EACR,GAAG,OAAO,CAAC;IAEZ,MAAM,CAAC,WAAW,EAAE,cAAc,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IACtD,MAAM,CAAC,YAAY,EAAE,eAAe,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAExD,MAAM,OAAO,GAAG,WAAW,CAAC,CAAO,GAAG,IAAW,EAAE,EAAE;QACnD,eAAe,CAAC,IAAI,CAAC,CAAC;QACtB,IAAI,CAAC;YACH,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,GAAG,IAAI,CAAC,CAAC;YACvC,IAAI,eAAe,CAAC,QAAQ,CAAC,EAAE,CAAC;gBAC9B,cAAc,CAAC,IAAI,CAAC,CAAC;YACvB,CAAC;YACD,OAAO,QAAQ,CAAC;QAClB,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAG,KAAK,CAAC,CAAC;YACjB,MAAM,KAAK,CAAC;QACd,CAAC;gBAAS,CAAC;YACT,eAAe,CAAC,KAAK,CAAC,CAAC;QACzB,CAAC;IACH,CAAC,CAAA,EAAE,CAAC,MAAM,EAAE,eAAe,EAAE,OAAO,CAAC,CAAC,CAAC;IAEvC,MAAM,mBAAmB,GAAG,WAAW,CAAC,GAAG,EAAE;QAC3C,cAAc,CAAC,KAAK,CAAC,CAAC;QACtB,SAAS,aAAT,SAAS,uBAAT,SAAS,EAAI,CAAC;IAChB,CAAC,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC;IAEhB,MAAM,kBAAkB,GAAG,WAAW,CAAC,GAAG,EAAE;QAC1C,cAAc,CAAC,KAAK,CAAC,CAAC;QACtB,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,EAAI,CAAC;IACf,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC;IAEf,OAAO;QACL,WAAW;QACX,YAAY;QACZ,OAAO;QACP,mBAAmB;QACnB,kBAAkB;QAClB,UAAU,EAAE,GAAG,EAAE,CAAC,cAAc,CAAC,KAAK,CAAC;KACxC,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import { useState, useCallback } from 'react';\n\ninterface UseActionWithModalProps<TResponse> {\n shouldOpenModal?: (response: TResponse) => boolean,\n onSuccess?: () => void,\n onCancel?: () => void,\n onError?: (error: unknown) => void,\n}\n\nexport const useActionWithModal = <TArgs extends unknown[], TResponse>(\n action: (...args: TArgs) => Promise<TResponse>,\n options: UseActionWithModalProps<TResponse> = {}\n) => {\n const { shouldOpenModal = (response: TResponse) => Boolean(response),\n onSuccess,\n onCancel,\n onError\n } = options;\n\n const [isModalOpen, setIsModalOpen] = useState(false);\n const [isTriggering, setIsTrigerring] = useState(false);\n\n const trigger = useCallback(async (...args: TArgs) => {\n setIsTrigerring(true);\n try {\n const response = await action(...args);\n if (shouldOpenModal(response)) {\n setIsModalOpen(true);\n }\n return response;\n } catch (error) {\n onError?.(error);\n throw error;\n } finally {\n setIsTrigerring(false);\n }\n }, [action, shouldOpenModal, onError]);\n\n const handleSuccessAction = useCallback(() => {\n setIsModalOpen(false);\n onSuccess?.();\n }, [onSuccess]);\n\n const handleCancelAction = useCallback(() => {\n setIsModalOpen(false);\n onCancel?.();\n }, [onCancel]);\n\n return {\n isModalOpen,\n isTriggering,\n trigger,\n handleSuccessAction,\n handleCancelAction,\n closeModal: () => setIsModalOpen(false)\n };\n};\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@edx/frontend-app-subscription-learner-dashboard",
3
- "version": "1.34.1",
3
+ "version": "1.35.1",
4
4
  "description": "",
5
5
  "repository": {
6
6
  "type": "git",