@edx/frontend-app-subscription-learner-dashboard 1.8.2 → 1.8.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/containers/ProgramDashboard/ProgramsList/ProgramListCard.js +1 -1
- package/dist/containers/ProgramDashboard/ProgramsList/ProgramListCard.js.map +1 -1
- package/dist/containers/ProgramDashboard/ProgramsList/index.d.ts +2 -1
- package/dist/containers/ProgramDashboard/ProgramsList/index.js +4 -12
- package/dist/containers/ProgramDashboard/ProgramsList/index.js.map +1 -1
- package/dist/containers/ProgramsPanel/index.js +8 -4
- package/dist/containers/ProgramsPanel/index.js.map +1 -1
- package/dist/data/hooks/queryHooks.d.ts +2 -2
- package/dist/data/hooks/queryHooks.js +3 -3
- package/dist/data/hooks/queryHooks.js.map +1 -1
- package/dist/data/services/lms/api.d.ts +1 -2
- package/dist/data/services/lms/api.js +1 -6
- package/dist/data/services/lms/api.js.map +1 -1
- package/dist/data/services/lms/urls.d.ts +0 -1
- package/dist/data/services/lms/urls.js +0 -2
- package/dist/data/services/lms/urls.js.map +1 -1
- package/dist/data/services/subs/api.d.ts +1 -0
- package/dist/data/services/subs/api.js +11 -1
- package/dist/data/services/subs/api.js.map +1 -1
- package/dist/data/services/subs/index.d.ts +1 -1
- package/dist/data/services/subs/index.js +1 -1
- package/dist/data/services/subs/index.js.map +1 -1
- package/dist/data/services/subs/urls.d.ts +1 -0
- package/dist/data/services/subs/urls.js +1 -0
- package/dist/data/services/subs/urls.js.map +1 -1
- package/dist/routes.js +6 -6
- package/dist/routes.js.map +1 -1
- package/package.json +2 -2
|
@@ -36,7 +36,7 @@ const ProgramListCard = ({ program, }) => {
|
|
|
36
36
|
}
|
|
37
37
|
return '';
|
|
38
38
|
};
|
|
39
|
-
return (_jsxs(Card, { className: "program-list-card mb-4 mr-4", isClickable: true, as: Link, to: `/program-progress/${program.uuid}`, "data-testid": "program-list-card", children: [_jsx(Card.ImageCap, { src: getBannerImageURL() || programCardFallbackImage, srcAlt: `program card image for ${program.title}`, logoSrc: getOrgImageUrl(), logoAlt: program.authoringOrganizations && ((_a = program.authoringOrganizations[0]) === null || _a === void 0 ? void 0 : _a.key), className: "banner-image" }), _jsx(Card.Section, { className: "pb-0 small", children: _jsxs(Row, { className: "justify-content-between px-2.5", children: [program.authoringOrganizations && (_jsx("p", { className: "truncate-text-1", children: program.authoringOrganizations.map(org => org.key).join(', ') })), _jsx("p", { children: program.type })] }) }), _jsx(Card.Section, { children: _jsx("h4", { className: "truncate-text-2", children: program.title }) }), _jsx(Card.Section, { children: _jsx(ProgressCategoryBubbles, { inProgress: program.progress.inProgress, notStarted: program.progress.notStarted, completed: program.progress.completed }) })] }));
|
|
39
|
+
return (_jsxs(Card, { className: "program-list-card mb-4 mr-4", isClickable: true, as: Link, to: `/subscription-program-progress/${program.uuid}`, "data-testid": "program-list-card", children: [_jsx(Card.ImageCap, { src: getBannerImageURL() || programCardFallbackImage, srcAlt: `program card image for ${program.title}`, logoSrc: getOrgImageUrl(), logoAlt: program.authoringOrganizations && ((_a = program.authoringOrganizations[0]) === null || _a === void 0 ? void 0 : _a.key), className: "banner-image" }), _jsx(Card.Section, { className: "pb-0 small", children: _jsxs(Row, { className: "justify-content-between px-2.5", children: [program.authoringOrganizations && (_jsx("p", { className: "truncate-text-1", children: program.authoringOrganizations.map(org => org.key).join(', ') })), _jsx("p", { children: program.type })] }) }), _jsx(Card.Section, { children: _jsx("h4", { className: "truncate-text-2", children: program.title }) }), _jsx(Card.Section, { children: _jsx(ProgressCategoryBubbles, { inProgress: program.progress.inProgress, notStarted: program.progress.notStarted, completed: program.progress.completed }) })] }));
|
|
40
40
|
};
|
|
41
41
|
export default ProgramListCard;
|
|
42
42
|
//# sourceMappingURL=ProgramListCard.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProgramListCard.js","sourceRoot":"","sources":["../../../../src/containers/ProgramDashboard/ProgramsList/ProgramListCard.tsx"],"names":[],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AAQ,GAAG,OAAO,CAAC,WAAW,CAAC,KAAK,CAAC,GAAG,CAAC;YAC3C,CAAC;iBAAM,CAAC;gBACN,QAAQ,GAAG,OAAO,CAAC,WAAW,CAAC,MAAM,CAAC,GAAG,CAAC;YAC5C,CAAC;QACH,CAAC;QACD,OAAO,QAAQ,CAAC;IAClB,CAAC,CAAC;IAEF,MAAM,cAAc,GAAG,GAAW,EAAE;;QAClC,IAAI,CAAA,MAAA,OAAO,CAAC,sBAAsB,0CAAE,MAAM,MAAK,CAAC,IAAI,OAAO,CAAC,sBAAsB,CAAC,CAAC,CAAC,CAAC,YAAY,EAAE,CAAC;YACnG,OAAO,OAAO,CAAC,sBAAsB,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC;QACxD,CAAC;QACD,OAAO,EAAE,CAAC;IACZ,CAAC,CAAC;IAEF,OAAO,CACL,MAAC,IAAI,IACH,SAAS,EAAC,6BAA6B,EACvC,WAAW,QACX,EAAE,EAAE,IAAI,EACR,EAAE,EAAE,
|
|
1
|
+
{"version":3,"file":"ProgramListCard.js","sourceRoot":"","sources":["../../../../src/containers/ProgramDashboard/ProgramsList/ProgramListCard.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AACxC,OAAO,EACL,WAAW,EACX,aAAa,EACb,IAAI,EACJ,GAAG,GACJ,MAAM,kBAAkB,CAAC;AAC1B,OAAO,wBAAwB,MAAM,qCAAqC,CAAC;AAE3E,OAAO,uBAAuB,MAAM,2BAA2B,CAAC;AAEhE,MAAM,eAAe,GAA+B,CAAC,EACnD,OAAO,GACR,EAAE,EAAE;;IACH,MAAM,EAAE,KAAK,EAAE,WAAW,EAAE,GAAG,aAAa,EAAE,CAAC;IAE/C,MAAM,iBAAiB,GAAG,GAAW,EAAE;QACrC,IAAI,QAAQ,GAAG,EAAE,CAAC;QAClB,oEAAoE;QACpE,kFAAkF;QAClF,IAAI,OAAO,CAAC,WAAW,IAAI,MAAM,CAAC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ize,\n Card,\n Row,\n} from '@openedx/paragon';\nimport programCardFallbackImage from '../assets/program-card-fallback.svg';\nimport { ProgramCardProps } from '../data/types';\nimport ProgressCategoryBubbles from './ProgressCategoryBubbles';\n\nconst ProgramListCard: React.FC<ProgramCardProps> = ({\n program,\n}) => {\n const { width: windowWidth } = useWindowSize();\n\n const getBannerImageURL = (): string => {\n let imageURL = '';\n // We need to check that the breakpoint value exists before using it\n // Otherwise TypeScript will flag it as it can potentially be undefined in Paragon\n if (program.bannerImage && Object.keys(program.bannerImage).length > 0) {\n if (!windowWidth) {\n return program.bannerImage.medium.url;\n }\n\n if (typeof breakpoints.large.minWidth === 'number' && windowWidth >= breakpoints.large.minWidth) {\n imageURL = program.bannerImage.large.url;\n } else if (typeof breakpoints.medium.minWidth === 'number' && windowWidth >= breakpoints.medium.minWidth) {\n imageURL = program.bannerImage.medium.url;\n } else if (typeof breakpoints.small.minWidth === 'number' && windowWidth >= breakpoints.small.minWidth) {\n imageURL = program.bannerImage.small.url;\n } else {\n imageURL = program.bannerImage.xSmall.url;\n }\n }\n return imageURL;\n };\n\n const getOrgImageUrl = (): string => {\n if (program.authoringOrganizations?.length === 1 && program.authoringOrganizations[0].logoImageUrl) {\n return program.authoringOrganizations[0].logoImageUrl;\n }\n return '';\n };\n\n return (\n <Card\n className=\"program-list-card mb-4 mr-4\"\n isClickable\n as={Link}\n to={`/subscription-program-progress/${program.uuid}`}\n data-testid=\"program-list-card\"\n >\n <Card.ImageCap\n src={getBannerImageURL() || programCardFallbackImage}\n srcAlt={`program card image for ${program.title}`}\n logoSrc={getOrgImageUrl()}\n logoAlt={program.authoringOrganizations && program.authoringOrganizations[0]?.key}\n className=\"banner-image\"\n />\n <Card.Section className=\"pb-0 small\">\n <Row className=\"justify-content-between px-2.5\">\n {program.authoringOrganizations && (\n <p className=\"truncate-text-1\">\n {program.authoringOrganizations.map(org => org.key).join(', ')}\n </p>\n )}\n <p>\n {program.type}\n </p>\n </Row>\n </Card.Section>\n <Card.Section>\n <h4 className=\"truncate-text-2\">{program.title}</h4>\n </Card.Section>\n <Card.Section>\n <ProgressCategoryBubbles\n inProgress={program.progress.inProgress}\n notStarted={program.progress.notStarted}\n completed={program.progress.completed}\n />\n </Card.Section>\n </Card>\n );\n};\nexport default ProgramListCard;\n"]}
|
|
@@ -1,20 +1,12 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { useIntl, logError, getSiteConfig } from '@openedx/frontend-base';
|
|
2
|
+
import { Alert, CardGrid, Col, Row, Spinner, } from '@openedx/paragon';
|
|
3
|
+
import { useIntl, getSiteConfig } from '@openedx/frontend-base';
|
|
5
4
|
import appMessages from '../../../messages';
|
|
6
5
|
import ProgramListCard from './ProgramListCard';
|
|
7
6
|
import messages from './messages';
|
|
8
7
|
import './index.scss';
|
|
9
|
-
|
|
10
|
-
const ProgramsList = () => {
|
|
8
|
+
const ProgramsList = ({ programsData, isLoading, errorState }) => {
|
|
11
9
|
const { formatMessage } = useIntl();
|
|
12
|
-
const { data: programsData = [], isLoading, isError: errorState, error, } = useProgramsListData();
|
|
13
|
-
useEffect(() => {
|
|
14
|
-
if (error) {
|
|
15
|
-
logError(error);
|
|
16
|
-
}
|
|
17
|
-
}, [error]);
|
|
18
10
|
const renderPrograms = () => {
|
|
19
11
|
if (isLoading) {
|
|
20
12
|
return (_jsx(Col, { sm: 12, className: "d-flex justify-content-center py-4", children: _jsx(Spinner, { animation: "border", screenReaderText: formatMessage(appMessages['subs-dash.loadingSR']) }) }));
|
|
@@ -30,7 +22,7 @@ const ProgramsList = () => {
|
|
|
30
22
|
contactSupportUrl: (_jsx(Alert.Link, { href: contactUrl, children: contactUrl })),
|
|
31
23
|
}) }));
|
|
32
24
|
};
|
|
33
|
-
return (_jsxs(
|
|
25
|
+
return (_jsxs("div", { children: [_jsx("p", { children: formatMessage(messages.programsListDescriptionText) }), _jsx(Row, { className: "py-3", children: errorState ? renderFailureAlert() : renderPrograms() })] }));
|
|
34
26
|
};
|
|
35
27
|
export default ProgramsList;
|
|
36
28
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/containers/ProgramDashboard/ProgramsList/index.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/containers/ProgramDashboard/ProgramsList/index.tsx"],"names":[],"mappings":";AACA,OAAO,EACL,KAAK,EAAE,QAAQ,EAAE,GAAG,EAAE,GAAG,EAAE,OAAO,GACnC,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAChE,OAAO,WAAW,MAAM,mBAAmB,CAAC;AAC5C,OAAO,eAAe,MAAM,mBAAmB,CAAC;AAChD,OAAO,QAAQ,MAAM,YAAY,CAAC;AAGlC,OAAO,cAAc,CAAC;AAEtB,MAAM,YAAY,GAA0B,CAAC,EAAE,YAAY,EAAE,SAAS,EAAE,UAAU,EAAE,EAAE,EAAE;IACtF,MAAM,EAAE,aAAa,EAAE,GAAG,OAAO,EAAE,CAAC;IAEpC,MAAM,cAAc,GAAG,GAAG,EAAE;QAC1B,IAAI,SAAS,EAAE,CAAC;YACd,OAAO,CACL,KAAC,GAAG,IAAC,EAAE,EAAE,EAAE,EAAE,SAAS,EAAC,oCAAoC,YACzD,KAAC,OAAO,IAAC,SAAS,EAAC,QAAQ,EAAC,gBAAgB,EAAE,aAAa,CAAC,WAAW,CAAC,qBAAqB,CAAC,CAAC,GAAI,GAC/F,CACP,CAAC;QACJ,CAAC;QACD,IAAI,YAAY,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAC5B,OAAO,CACL,4BACE,KAAC,GAAG,IAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,YACjB,KAAC,QAAQ,IAAC,WAAW,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,EAAE,YACrC,YAAY,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,CAAC,CAC3B,KAAC,eAAe,IAEd,OAAO,EAAE,OAAO,IADX,OAAO,CAAC,IAAI,CAEjB,CACH,CAAC,GACO,GACP,GACL,CACJ,CAAC;QACJ,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC,CAAC;IAEF,MAAM,kBAAkB,GAAG,GAAG,EAAE;QAC9B,MAAM,UAAU,GAAG,GAAG,aAAa,EAAE,CAAC,UAAU,UAAU,CAAC;QAC3D,OAAO,CACL,KAAC,KAAK,IAAC,SAAS,EAAC,yBAAyB,EAAC,OAAO,EAAC,QAAQ,YACxD,aAAa,CAAC,QAAQ,CAAC,8BAA8B,EAAE;gBACtD,iBAAiB,EAAE,CACjB,KAAC,KAAK,CAAC,IAAI,IAAC,IAAI,EAAE,UAAU,YACzB,UAAU,GACA,CACd;aACF,CAAC,GACI,CACT,CAAC;IACJ,CAAC,CAAC;IAEF,OAAO,CACL,0BACE,sBACG,aAAa,CAAC,QAAQ,CAAC,2BAA2B,CAAC,GAClD,EACJ,KAAC,GAAG,IAAC,SAAS,EAAC,MAAM,YAClB,UAAU,CAAC,CAAC,CAAC,kBAAkB,EAAE,CAAC,CAAC,CAAC,cAAc,EAAE,GACjD,IACF,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,YAAY,CAAC","sourcesContent":["import React from 'react';\nimport {\n Alert, CardGrid, Col, Row, Spinner,\n} from '@openedx/paragon';\nimport { useIntl, getSiteConfig } from '@openedx/frontend-base';\nimport appMessages from '../../../messages';\nimport ProgramListCard from './ProgramListCard';\nimport messages from './messages';\nimport { ProgramList } from '../data/types';\n\nimport './index.scss';\n\nconst ProgramsList: React.FC<ProgramList> = ({ programsData, isLoading, errorState }) => {\n const { formatMessage } = useIntl();\n\n const renderPrograms = () => {\n if (isLoading) {\n return (\n <Col sm={12} className=\"d-flex justify-content-center py-4\">\n <Spinner animation=\"border\" screenReaderText={formatMessage(appMessages['subs-dash.loadingSR'])} />\n </Col>\n );\n }\n if (programsData.length > 0) {\n return (\n <>\n <Col sm={12} md={12}>\n <CardGrid columnSizes={{ xs: 12, lg: 6 }}>\n {programsData.map(program => (\n <ProgramListCard\n key={program.uuid}\n program={program}\n />\n ))}\n </CardGrid>\n </Col>\n </>\n );\n }\n return null;\n };\n\n const renderFailureAlert = () => {\n const contactUrl = `${getSiteConfig().lmsBaseUrl}/contact`;\n return (\n <Alert className=\"mx-auto container-mw-md\" variant=\"danger\">\n {formatMessage(messages.errorLoadingProgramEnrollments, {\n contactSupportUrl: (\n <Alert.Link href={contactUrl}>\n {contactUrl}\n </Alert.Link>\n ),\n })}\n </Alert>\n );\n };\n\n return (\n <div>\n <p>\n {formatMessage(messages.programsListDescriptionText)}\n </p>\n <Row className=\"py-3\">\n {errorState ? renderFailureAlert() : renderPrograms()}\n </Row>\n </div>\n );\n};\n\nexport default ProgramsList;\n"]}
|
|
@@ -1,15 +1,19 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { useMemo } from 'react';
|
|
3
|
-
import { useIntl } from '@openedx/frontend-base';
|
|
3
|
+
import { camelCaseObject, useIntl } from '@openedx/frontend-base';
|
|
4
4
|
import messages from './messages';
|
|
5
5
|
import NoProgramsView from './NoProgramsView';
|
|
6
6
|
import { ProgramsList } from '../ProgramDashboard';
|
|
7
7
|
import { useProgramsListData } from '../../data/hooks/queryHooks';
|
|
8
8
|
export const ProgramsPanel = () => {
|
|
9
9
|
const { formatMessage } = useIntl();
|
|
10
|
-
const { data
|
|
11
|
-
const
|
|
12
|
-
|
|
10
|
+
const { data, isLoading, isError: errorState } = useProgramsListData();
|
|
11
|
+
const programsData = useMemo(() => { var _a; return (_a = camelCaseObject(data === null || data === void 0 ? void 0 : data.programs)) !== null && _a !== void 0 ? _a : []; }, [data === null || data === void 0 ? void 0 : data.programs]);
|
|
12
|
+
const hasProgramsEnrollment = programsData.length > 0;
|
|
13
|
+
const shouldRenderNoProgramsView = !isLoading && !errorState && !hasProgramsEnrollment;
|
|
14
|
+
return (_jsx(_Fragment, { children: _jsxs("div", { className: "programs-list-container mb-5", "data-testid": "programs-list", children: [_jsx("div", { className: "d-flex flex-row justify-content-between text-center", children: _jsx("h3", { className: "programs-list-title mb-3", children: formatMessage(messages.myPrograms) }) }), shouldRenderNoProgramsView
|
|
15
|
+
? _jsx(NoProgramsView, {})
|
|
16
|
+
: _jsx(ProgramsList, { programsData: programsData, isLoading: isLoading, errorState: errorState })] }) }));
|
|
13
17
|
};
|
|
14
18
|
export default ProgramsPanel;
|
|
15
19
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/containers/ProgramsPanel/index.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAM,OAAO,EAAE,MAAM,OAAO,CAAC;AACpC,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/containers/ProgramsPanel/index.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAM,OAAO,EAAE,MAAM,OAAO,CAAC;AACpC,OAAO,EAAE,eAAe,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAClE,OAAO,QAAQ,MAAM,YAAY,CAAC;AAClC,OAAO,cAAc,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAEjE,MAAM,CAAC,MAAM,aAAa,GAAO,GAAG,EAAE;IACpC,MAAM,EAAE,aAAa,EAAE,GAAG,OAAO,EAAE,CAAC;IACpC,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,UAAU,EAAE,GAAG,mBAAmB,EAAE,CAAC;IACvE,MAAM,YAAY,GAAG,OAAO,CAAC,GAAG,EAAE,WAAC,OAAA,MAAA,eAAe,CAAC,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,QAAQ,CAAC,mCAAI,EAAE,CAAA,EAAA,EAAE,CAAC,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,QAAQ,CAAC,CAAC,CAAC;IAC5F,MAAM,qBAAqB,GAAG,YAAY,CAAC,MAAM,GAAG,CAAC,CAAC;IACtD,MAAM,0BAA0B,GAAG,CAAC,SAAS,IAAI,CAAC,UAAU,IAAI,CAAC,qBAAqB,CAAC;IAEvF,OAAO,CACL,4BACE,eAAK,SAAS,EAAC,8BAA8B,iBAAa,eAAe,aACvE,cAAK,SAAS,EAAC,qDAAqD,YAClE,aAAI,SAAS,EAAC,0BAA0B,YAAE,aAAa,CAAC,QAAQ,CAAC,UAAU,CAAC,GAAM,GAC9E,EACL,0BAA0B;oBACzB,CAAC,CAAC,KAAC,cAAc,KAAG;oBACpB,CAAC,CAAC,KAAC,YAAY,IAAC,YAAY,EAAE,YAAY,EAAE,SAAS,EAAE,SAAS,EAAE,UAAU,EAAE,UAAU,GAAI,IAC1F,GACL,CACJ,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,aAAa,CAAC","sourcesContent":["import { FC, useMemo } from 'react';\nimport { camelCaseObject, useIntl } from '@openedx/frontend-base';\nimport messages from './messages';\nimport NoProgramsView from './NoProgramsView';\nimport { ProgramsList } from '../ProgramDashboard';\nimport { useProgramsListData } from '@src/data/hooks/queryHooks';\n\nexport const ProgramsPanel: FC = () => {\n const { formatMessage } = useIntl();\n const { data, isLoading, isError: errorState } = useProgramsListData();\n const programsData = useMemo(() => camelCaseObject(data?.programs) ?? [], [data?.programs]);\n const hasProgramsEnrollment = programsData.length > 0;\n const shouldRenderNoProgramsView = !isLoading && !errorState && !hasProgramsEnrollment;\n\n return (\n <>\n <div className=\"programs-list-container mb-5\" data-testid=\"programs-list\">\n <div className=\"d-flex flex-row justify-content-between text-center\">\n <h3 className=\"programs-list-title mb-3\">{formatMessage(messages.myPrograms)}</h3>\n </div>\n {shouldRenderNoProgramsView\n ? <NoProgramsView />\n : <ProgramsList programsData={programsData} isLoading={isLoading} errorState={errorState} />}\n </div>\n </>\n );\n};\n\nexport default ProgramsPanel;\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ProgramListData, ProgramProgressData } from '@src/containers/ProgramDashboard/data/types';
|
|
2
2
|
declare const useInitializeLearnerHome: () => {
|
|
3
3
|
data: any;
|
|
4
4
|
error: any;
|
|
@@ -162,6 +162,6 @@ declare const useInitializeLearnerHome: () => {
|
|
|
162
162
|
fetchStatus: import("@tanstack/query-core").FetchStatus;
|
|
163
163
|
promise: Promise<any>;
|
|
164
164
|
};
|
|
165
|
-
declare const useProgramsListData: () => import("@tanstack/react-query").UseQueryResult<
|
|
165
|
+
declare const useProgramsListData: () => import("@tanstack/react-query").UseQueryResult<ProgramListData, Error>;
|
|
166
166
|
declare const useProgramProgressData: (uuid: string) => import("@tanstack/react-query").UseQueryResult<ProgramProgressData, Error>;
|
|
167
167
|
export { useInitializeLearnerHome, useProgramProgressData, useProgramsListData, };
|
|
@@ -11,10 +11,10 @@ import { useQuery, useQueryClient } from '@tanstack/react-query';
|
|
|
11
11
|
import { useContext, useEffect } from 'react';
|
|
12
12
|
import { useMasquerade } from '../../data/context';
|
|
13
13
|
import GlobalDataContext from '../../data/contexts/GlobalDataContext';
|
|
14
|
-
import { initializeList,
|
|
14
|
+
import { initializeList, } from '../../data/services/lms/api';
|
|
15
15
|
import { getTransformedCourseDataObject } from '../../utils/dataTransformers';
|
|
16
16
|
import { learnerDashboardQueryKeys } from './queryKeys';
|
|
17
|
-
import { getProgramProgressData } from '../../data/services/subs';
|
|
17
|
+
import { getProgramProgressData, getProgramsListData } from '../../data/services/subs';
|
|
18
18
|
const useInitializeLearnerHome = () => {
|
|
19
19
|
const { masqueradeUser } = useMasquerade();
|
|
20
20
|
const queryClient = useQueryClient();
|
|
@@ -57,7 +57,7 @@ const useInitializeLearnerHome = () => {
|
|
|
57
57
|
const useProgramsListData = () => {
|
|
58
58
|
return useQuery({
|
|
59
59
|
queryKey: ['programsList'],
|
|
60
|
-
queryFn:
|
|
60
|
+
queryFn: getProgramsListData,
|
|
61
61
|
retry: false,
|
|
62
62
|
refetchOnWindowFocus: false,
|
|
63
63
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"queryHooks.js","sourceRoot":"","sources":["../../../src/data/hooks/queryHooks.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACjE,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAC9C,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,iBAAiB,MAAM,sCAAsC,CAAC;AACrE,OAAO,EACL,cAAc,
|
|
1
|
+
{"version":3,"file":"queryHooks.js","sourceRoot":"","sources":["../../../src/data/hooks/queryHooks.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACjE,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAC9C,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,iBAAiB,MAAM,sCAAsC,CAAC;AACrE,OAAO,EACL,cAAc,GACf,MAAM,4BAA4B,CAAC;AAEpC,OAAO,EAAE,8BAA8B,EAAE,MAAM,6BAA6B,CAAC;AAC7E,OAAO,EAAE,yBAAyB,EAAE,MAAM,aAAa,CAAC;AACxD,OAAO,EAAE,sBAAsB,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAEtF,MAAM,wBAAwB,GAAG,GA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ext, useEffect } from 'react';\nimport { useMasquerade } from '@src/data/context';\nimport GlobalDataContext from '@src/data/contexts/GlobalDataContext';\nimport {\n initializeList,\n} from '@src/data/services/lms/api';\nimport { ProgramListData, ProgramProgressData } from '@src/containers/ProgramDashboard/data/types';\nimport { getTransformedCourseDataObject } from '@src/utils/dataTransformers';\nimport { learnerDashboardQueryKeys } from './queryKeys';\nimport { getProgramProgressData, getProgramsListData } from '@src/data/services/subs';\n\nconst useInitializeLearnerHome = () => {\n const { masqueradeUser } = useMasquerade();\n const queryClient = useQueryClient();\n const { setEmailConfirmation, setPlatformSettings } = useContext(GlobalDataContext);\n\n const query = useQuery({\n queryKey: learnerDashboardQueryKeys.initialize(masqueradeUser),\n queryFn: async () => {\n const data = await initializeList(masqueradeUser);\n return {\n ...data,\n coursesByCardId: getTransformedCourseDataObject(data?.courses || []),\n };\n },\n staleTime: 5 * 60 * 1000, // 5 minutes — dashboard data rarely changes while viewing\n retry: (failureCount, error: any) => {\n // Don't retry client errors (4xx) — they won't resolve on retry\n if (error?.response?.status >= 400 && error?.response?.status < 500) return false;\n return failureCount < 3;\n },\n retryOnMount: !masqueradeUser,\n refetchOnMount: !masqueradeUser,\n });\n\n // Populate shell-level GlobalDataProvider so header widgets can access this data\n useEffect(() => {\n if (query.data && !masqueradeUser) {\n if (query.data.emailConfirmation && setEmailConfirmation) {\n setEmailConfirmation(query.data.emailConfirmation);\n }\n if (query.data.platformSettings && setPlatformSettings) {\n setPlatformSettings(query.data.platformSettings);\n }\n }\n }, [masqueradeUser, query.data, setEmailConfirmation, setPlatformSettings]);\n\n // When masquerading fails, fall back to the normal user's cached data\n let { data } = query;\n if (masqueradeUser && query.isError) {\n data = queryClient.getQueryData(learnerDashboardQueryKeys.initialize(undefined));\n }\n\n return { ...query, data };\n};\n\nconst useProgramsListData = () => {\n return useQuery<ProgramListData>({\n queryKey: ['programsList'],\n queryFn: getProgramsListData,\n retry: false,\n refetchOnWindowFocus: false,\n });\n};\n\nconst useProgramProgressData = (uuid: string) => {\n return useQuery<ProgramProgressData>({\n queryKey: ['programProgress', uuid],\n queryFn: () => getProgramProgressData(uuid),\n enabled: !!uuid,\n staleTime: 1000 * 60 * 5, // 5 min caching\n retry: 2,\n });\n};\n\nexport {\n useInitializeLearnerHome,\n useProgramProgressData,\n useProgramsListData,\n};\n"]}
|
|
@@ -29,5 +29,4 @@ declare const createCreditRequest: ({ providerId, courseId, username }: {
|
|
|
29
29
|
username: any;
|
|
30
30
|
}) => Promise<any>;
|
|
31
31
|
declare const sendConfirmEmail: (sendEmailUrl: string) => Promise<any>;
|
|
32
|
-
|
|
33
|
-
export { initializeList, unenrollFromCourse, updateEntitlementEnrollment, deleteEntitlementEnrollment, updateEmailSettings, logEvent, logShare, createCreditRequest, sendConfirmEmail, fetchProgramsListData, };
|
|
32
|
+
export { initializeList, unenrollFromCourse, updateEntitlementEnrollment, deleteEntitlementEnrollment, updateEmailSettings, logEvent, logShare, createCreditRequest, sendConfirmEmail, };
|
|
@@ -76,10 +76,5 @@ const sendConfirmEmail = (sendEmailUrl) => __awaiter(void 0, void 0, void 0, fun
|
|
|
76
76
|
const response = yield getAuthenticatedHttpClient().post(sendEmailUrl);
|
|
77
77
|
return response;
|
|
78
78
|
});
|
|
79
|
-
|
|
80
|
-
const url = urls.programsApiUrl();
|
|
81
|
-
const { data } = yield getAuthenticatedHttpClient().get(url);
|
|
82
|
-
return data;
|
|
83
|
-
});
|
|
84
|
-
export { initializeList, unenrollFromCourse, updateEntitlementEnrollment, deleteEntitlementEnrollment, updateEmailSettings, logEvent, logShare, createCreditRequest, sendConfirmEmail, fetchProgramsListData, };
|
|
79
|
+
export { initializeList, unenrollFromCourse, updateEntitlementEnrollment, deleteEntitlementEnrollment, updateEmailSettings, logEvent, logShare, createCreditRequest, sendConfirmEmail, };
|
|
85
80
|
//# sourceMappingURL=api.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api.js","sourceRoot":"","sources":["../../../../src/data/services/lms/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AAC;AAEF,OAAO,EACL,cAAc,EACd,kBAAkB,EAClB,2BAA2B,EAC3B,2BAA2B,EAC3B,mBAAmB,EACnB,QAAQ,EACR,QAAQ,EACR,mBAAmB,EACnB,gBAAgB,GACjB,CAAC","sourcesContent":["import { getAuthenticatedHttpClient } from '@openedx/frontend-base';\nimport { apiKeys, enableEmailsAction, unenrollmentAction } from '@src/data/services/lms/constants';\nimport urls from '@src/data/services/lms/urls';\nimport { stringifyUrl } from '@src/data/services/lms/utils';\nimport eventNames from '@src/tracking/constants';\n\nconst initializeList = async (user) => {\n const { data } = await getAuthenticatedHttpClient().get(\n stringifyUrl(urls.getInitApiUrl(), { [apiKeys.user]: user }),\n );\n return data;\n};\n\nconst unenrollFromCourse = async ({ courseId }) => {\n const url = urls.courseUnenroll();\n const formData = new FormData();\n formData.append(apiKeys.courseId, courseId);\n Object.entries(unenrollmentAction).forEach(([key, value]) => {\n formData.append(key, value);\n });\n const response = await getAuthenticatedHttpClient().post(url, formData);\n return response;\n};\n\nconst updateEntitlementEnrollment = async ({ uuid, courseId }) => {\n const url = urls.entitlementEnrollment(uuid);\n const content = { [apiKeys.courseRunId]: courseId };\n const response = await getAuthenticatedHttpClient().post(url, content);\n return response;\n};\n\nconst deleteEntitlementEnrollment = async ({ uuid, isRefundable }) => {\n const url = stringifyUrl(\n urls.entitlementEnrollment(uuid),\n { [apiKeys.isRefund]: isRefundable },\n );\n const response = await getAuthenticatedHttpClient().delete(url);\n return response;\n};\n\nconst updateEmailSettings = async ({ courseId, enable }) => {\n const url = urls.updateEmailSettings();\n const content = { [apiKeys.courseId]: courseId, ...(enable && enableEmailsAction) };\n const response = await getAuthenticatedHttpClient().post(url, content);\n return response;\n};\n\nconst logEvent = async ({ eventName, data, courseId }) => {\n const url = urls.event();\n const content = {\n courserun_key: courseId,\n event_type: eventName,\n page: window.location.href,\n event: JSON.stringify(data),\n };\n const response = await getAuthenticatedHttpClient().post(url, content);\n return response;\n};\n\nconst logShare = ({ courseId, site }) => {\n const eventData = {\n eventName: eventNames.shareClicked,\n courseId,\n data: {\n course_id: courseId,\n social_media_site: site,\n location: 'dashboard',\n },\n };\n return logEvent(eventData);\n};\n\nconst createCreditRequest = async ({ providerId, courseId, username }) => {\n const url = urls.creditRequestUrl(providerId);\n const content = { course_key: courseId, username };\n const response = await getAuthenticatedHttpClient().post(url, content);\n return response;\n};\n\nconst sendConfirmEmail = async (sendEmailUrl: string) => {\n const response = await getAuthenticatedHttpClient().post(sendEmailUrl);\n return response;\n};\n\nexport {\n initializeList,\n unenrollFromCourse,\n updateEntitlementEnrollment,\n deleteEntitlementEnrollment,\n updateEmailSettings,\n logEvent,\n logShare,\n createCreditRequest,\n sendConfirmEmail,\n};\n"]}
|
|
@@ -4,6 +4,5 @@ export function baseAppUrl(url: any): any;
|
|
|
4
4
|
export function learningMfeUrl(url: any): any;
|
|
5
5
|
export function creditPurchaseUrl(courseId: any): string;
|
|
6
6
|
export function creditRequestUrl(providerId: any): string;
|
|
7
|
-
export function programsApiUrl(): string;
|
|
8
7
|
declare const _default: any;
|
|
9
8
|
export default _default;
|
|
@@ -21,7 +21,6 @@ export const creditPurchaseUrl = (courseId) => {
|
|
|
21
21
|
: `${config.ECOMMERCE_BASE_URL}/credit/checkout/${courseId}/`;
|
|
22
22
|
};
|
|
23
23
|
export const creditRequestUrl = (providerId) => `${getApiUrl()}/credit/v1/providers/${providerId}/request/`;
|
|
24
|
-
export const programsApiUrl = () => `${getApiUrl()}/dashboard/v0/programs/`;
|
|
25
24
|
export default StrictDict({
|
|
26
25
|
getApiUrl,
|
|
27
26
|
baseAppUrl,
|
|
@@ -34,6 +33,5 @@ export default StrictDict({
|
|
|
34
33
|
learningMfeUrl,
|
|
35
34
|
programsUrl,
|
|
36
35
|
updateEmailSettings,
|
|
37
|
-
programsApiUrl,
|
|
38
36
|
});
|
|
39
37
|
//# sourceMappingURL=urls.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"urls.js","sourceRoot":"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,MAAM,gBAAgB,GAAG,CAAC,UAAU,EAAE,EAAE,CAAC,GAAG,SAAS,EAAE,wBAAwB,UAAU,WAAW,CAAC;AAE5G,eAAe,UAAU,CAAC;IACxB,SAAS;IACT,UAAU;IACV,cAAc;IACd,iBAAiB;IACjB,gBAAgB;IAChB,qBAAqB;IACrB,KAAK;IACL,aAAa;IACb,cAAc;IACd,WAAW;IACX,mBAAmB;CACpB,CAAC,CAAC","sourcesContent":["import { appId } from '../../../constants';\nimport { StrictDict } from '../../../utils';\n\nimport { getAppConfig, getSiteConfig } from '@openedx/frontend-base';\n\nconst getBaseUrl = () => getSiteConfig().lmsBaseUrl;\n\nexport const getApiUrl = () => (`${getSiteConfig().lmsBaseUrl}/api`);\n\nconst getInitApiUrl = () => (`${getApiUrl()}/learner_home/init`);\n\nconst event = () => `${getBaseUrl()}/event`;\nconst courseUnenroll = () => `${getBaseUrl()}/change_enrollment`;\nconst updateEmailSettings = () => `${getApiUrl()}/change_email_settings`;\nconst entitlementEnrollment = (uuid) => `${getApiUrl()}/entitlements/v1/entitlements/${uuid}/enrollments`;\n\n// if url is null or absolute, return it as is\nexport const updateUrl = (base, url) => ((url == null || url.startsWith('http://') || url.startsWith('https://')) ? url : `${base}${url}`);\n\nexport const baseAppUrl = (url) => updateUrl(getBaseUrl(), url);\nexport const learningMfeUrl = (url) => updateUrl(getAppConfig(appId).LEARNING_BASE_URL, url);\n\n// static view url\nconst programsUrl = () => baseAppUrl('/dashboard/programs');\n\nexport const creditPurchaseUrl = (courseId) => {\n const config = getAppConfig(appId);\n return config.CREDIT_PURCHASE_URL\n ? `${config.CREDIT_PURCHASE_URL}/${courseId}/`\n : `${config.ECOMMERCE_BASE_URL}/credit/checkout/${courseId}/`;\n};\nexport const creditRequestUrl = (providerId) => `${getApiUrl()}/credit/v1/providers/${providerId}/request/`;\n\nexport default StrictDict({\n getApiUrl,\n baseAppUrl,\n courseUnenroll,\n creditPurchaseUrl,\n creditRequestUrl,\n entitlementEnrollment,\n event,\n getInitApiUrl,\n learningMfeUrl,\n programsUrl,\n updateEmailSettings,\n});\n"]}
|
|
@@ -8,7 +8,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
10
|
import { getAuthenticatedHttpClient } from '@openedx/frontend-base';
|
|
11
|
-
import { programProgressUrl } from './urls';
|
|
11
|
+
import { programProgressUrl, programsApiUrl } from './urls';
|
|
12
12
|
const optimizedData = (data, size) => (data.length > size ? `${data.slice(0, size)}...` : data);
|
|
13
13
|
export const fetchRecommendedCourses = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
14
14
|
/* TODO [TEMP]: Replace with actual API call to fetch recommended courses data. For now, returning hardcoded data to simulate the API response. Also, built the test case for the same.
|
|
@@ -130,4 +130,14 @@ export const getProgramProgressData = (uuid) => __awaiter(void 0, void 0, void 0
|
|
|
130
130
|
throw error;
|
|
131
131
|
}
|
|
132
132
|
});
|
|
133
|
+
export const getProgramsListData = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
134
|
+
try {
|
|
135
|
+
const { data } = yield getAuthenticatedHttpClient().get(programsApiUrl());
|
|
136
|
+
return data;
|
|
137
|
+
}
|
|
138
|
+
catch (error) {
|
|
139
|
+
console.error('Error fetching program list data:', error);
|
|
140
|
+
throw error;
|
|
141
|
+
}
|
|
142
|
+
});
|
|
133
143
|
//# 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,MAAM,QAAQ,CAAC;AAE5C,MAAM,aAAa,GAAG,CAAC,IAAY,EAAE,IAAY,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC,CAAC,GAAG,I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0B;gBACnC,WAAW,EAAE,WAAW;aACzB;YACD;gBACE,EAAE,EAAE,CAAC;gBACL,KAAK,EAAE,aAAa,CAAC,cAAc,EAAE,EAAE,CAAC;gBACxC,IAAI,EAAE,aAAa,CAAC,2KAA2K,EAAE,GAAG,CAAC;gBACrM,GAAG,EAAE,qEAAqE;gBAC1E,SAAS,EAAE,6EAA6E;gBACxF,SAAS,EAAE,KAAK;gBAChB,OAAO,EAAE,EAAE;gBACX,WAAW,EAAE,QAAQ;aACtB;SACF,CAAC;QAEF,OAAO,SAAS,CAAC;IACnB,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,2DAA2D,EAAE,KAAK,CAAC,CAAC;QAClF,MAAM,KAAK,CAAC;IACd,CAAC;AACH,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","sourcesContent":["import { getAuthenticatedHttpClient } from '@openedx/frontend-base';\nimport { programProgressUrl } from './urls';\n\nconst optimizedData = (data: string, size: number) => (data.length > size ? `${data.slice(0, size)}...` : data);\n\nexport const fetchRecommendedCourses = async () => {\n /* TODO [TEMP]: Replace with actual API call to fetch recommended courses data. For now, returning hardcoded data to simulate the API response. Also, built the test case for the same.\n Reason: The API endpoint is not yet available and the data structure is still being finalized.\n Action: Revisit after endpoint is made available.\n */\n\n try {\n const finalData = [\n {\n id: 1,\n title: optimizedData('Essence Mascara Lash Princess', 30),\n body: optimizedData('The Essence Mascara Lash Princess is a popular mascara known for its volumizing and lengthening effects. Achieve dramatic lashes with this long-lasting and cruelty-free formula.', 100),\n url: 'https://cdn.dummyjson.com/product-images/beauty/essence-mascara-lash-princess/1.webp',\n thumbnail: 'https://cdn.dummyjson.com/product-images/beauty/essence-mascara-lash-princess/thumbnail.webp',\n isProgram: false,\n tagText: '',\n footerLabel: 'Course'\n },\n {\n id: 2,\n title: optimizedData('Eyeshadow Palette with Mirror', 30),\n body: optimizedData(\"The Eyeshadow Palette with Mirror offers a versatile range of eyeshadow shades for creating stunning eye looks. With a built-in mirror, it's convenient for on-the-go makeup application.\", 100),\n url: 'https://cdn.dummyjson.com/product-images/beauty/eyeshadow-palette-with-mirror/1.webp',\n thumbnail: 'https://cdn.dummyjson.com/product-images/beauty/eyeshadow-palette-with-mirror/thumbnail.webp',\n isProgram: false,\n tagText: '',\n footerLabel: 'Course'\n },\n {\n id: 3,\n title: optimizedData('Powder Canister', 30),\n body: optimizedData('The Powder Canister is a finely milled setting powder designed to set makeup and control shine. With a lightweight and translucent formula, it provides a smooth and matte finish.', 100),\n url: 'https://cdn.dummyjson.com/product-images/beauty/powder-canister/1.webp',\n thumbnail: 'https://cdn.dummyjson.com/product-images/beauty/powder-canister/thumbnail.webp',\n isProgram: true, // TODO\n tagText: 'Professional Certificate',\n footerLabel: '2 Courses'\n },\n {\n id: 4,\n title: optimizedData('Red Lipstick', 30),\n body: optimizedData('The Red Lipstick is a classic and bold choice for adding a pop of color to your lips. With a creamy and pigmented formula, it provides a vibrant and long-lasting finish.', 100),\n url: 'https://cdn.dummyjson.com/product-images/beauty/red-lipstick/1.webp',\n thumbnail: 'https://cdn.dummyjson.com/product-images/beauty/red-lipstick/thumbnail.webp',\n isProgram: false,\n tagText: '',\n footerLabel: 'Course'\n }\n ];\n\n return finalData;\n } catch (error) {\n console.error('Error fetching cards data:', error);\n throw error;\n }\n};\n\nexport const fetchRecentlyViewedCoursesAndPrograms = async () => {\n /* TODO [TEMP]: Replace with actual API call to fetch recently viewed courses and programs data.\n Reason: The API endpoint is not yet available and the data structure is still being finalized.\n Action: Revisit after endpoint is made available.\n */\n\n try {\n const finalData = [\n {\n id: 1,\n title: optimizedData('Data Analytics Fundamentals', 30),\n body: optimizedData('Learn the core concepts of data analytics, including data cleaning, visualization, and basic statistical interpretation.', 100),\n url: 'https://cdn.dummyjson.com/product-images/beauty/essence-mascara-lash-princess/1.webp',\n thumbnail: 'https://cdn.dummyjson.com/product-images/beauty/essence-mascara-lash-princess/thumbnail.webp',\n isProgram: false,\n tagText: '',\n footerLabel: 'Course'\n },\n {\n id: 2,\n title: optimizedData('Product Management Essentials', 30),\n body: optimizedData('Review the workflows, tools, and communication patterns used by product managers to guide delivery across teams.', 100),\n url: 'https://cdn.dummyjson.com/product-images/beauty/eyeshadow-palette-with-mirror/1.webp',\n thumbnail: 'https://cdn.dummyjson.com/product-images/beauty/eyeshadow-palette-with-mirror/thumbnail.webp',\n isProgram: false,\n tagText: '',\n footerLabel: 'Course'\n },\n {\n id: 3,\n title: optimizedData('AI Product Strategy', 30),\n body: optimizedData('Continue a professional certificate covering AI roadmap planning, experimentation, and responsible product delivery.', 100),\n url: 'https://cdn.dummyjson.com/product-images/beauty/powder-canister/1.webp',\n thumbnail: 'https://cdn.dummyjson.com/product-images/beauty/powder-canister/thumbnail.webp',\n isProgram: true,\n tagText: 'Professional Certificate',\n footerLabel: '3 Courses'\n },\n {\n id: 4,\n title: optimizedData('Red Lipstick', 30),\n body: optimizedData('The Red Lipstick is a classic and bold choice for adding a pop of color to your lips. With a creamy and pigmented formula, it provides a vibrant and long-lasting finish.', 100),\n url: 'https://cdn.dummyjson.com/product-images/beauty/red-lipstick/1.webp',\n thumbnail: 'https://cdn.dummyjson.com/product-images/beauty/red-lipstick/thumbnail.webp',\n isProgram: false,\n tagText: '',\n footerLabel: 'Course'\n }\n ];\n\n return finalData;\n } catch (error) {\n console.error('Error fetching recently viewed courses and programs data:', error);\n throw error;\n }\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"]}
|
|
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,MAAM,aAAa,GAAG,CAAC,IAAY,EAAE,IAAY,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;AAEhH,MAAM,CAAC,MAAM,uBAAuB,GAAG,GAAS,EAAE;IAChD;;;QAGI;IAEJ,IAAI,CAAC;QACH,MAAM,SAAS,GAAG;YAChB;gBACE,EAAE,EAAE,CAAC;gBACL,KAAK,EAAE,aAAa,CAAC,+BAA+B,EAAE,EAAE,CAAC;gBACzD,IAAI,EAAE,aAAa,CAAC,mLAAmL,EAAE,GAAG,CAAC;gBAC7M,GAAG,EAAE,sFAAsF;gBAC3F,SAAS,EAAE,8FAA8F;gBACzG,SAAS,EAAE,KAAK;gBAChB,OAAO,EAAE,EAAE;gBACX,WAAW,EAAE,QAAQ;aACtB;YACD;gBACE,EAAE,EAAE,CAAC;gBACL,KAAK,EAAE,aAAa,CAAC,+BAA+B,EAAE,EAAE,CAAC;gBACzD,IAAI,EAAE,aAAa,CAAC,2LAA2L,EAAE,GAAG,CAAC;gBACrN,GAAG,EAAE,sFAAsF;gBAC3F,SAAS,EAAE,8FAA8F;gBACzG,SAAS,EAAE,KAAK;gBAChB,OAAO,EAAE,EAAE;gBACX,WAAW,EAAE,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,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\nconst optimizedData = (data: string, size: number) => (data.length > size ? `${data.slice(0, size)}...` : data);\n\nexport const fetchRecommendedCourses = async () => {\n /* TODO [TEMP]: Replace with actual API call to fetch recommended courses data. For now, returning hardcoded data to simulate the API response. Also, built the test case for the same.\n Reason: The API endpoint is not yet available and the data structure is still being finalized.\n Action: Revisit after endpoint is made available.\n */\n\n try {\n const finalData = [\n {\n id: 1,\n title: optimizedData('Essence Mascara Lash Princess', 30),\n body: optimizedData('The Essence Mascara Lash Princess is a popular mascara known for its volumizing and lengthening effects. Achieve dramatic lashes with this long-lasting and cruelty-free formula.', 100),\n url: 'https://cdn.dummyjson.com/product-images/beauty/essence-mascara-lash-princess/1.webp',\n thumbnail: 'https://cdn.dummyjson.com/product-images/beauty/essence-mascara-lash-princess/thumbnail.webp',\n isProgram: false,\n tagText: '',\n footerLabel: 'Course'\n },\n {\n id: 2,\n title: optimizedData('Eyeshadow Palette with Mirror', 30),\n body: optimizedData(\"The Eyeshadow Palette with Mirror offers a versatile range of eyeshadow shades for creating stunning eye looks. With a built-in mirror, it's convenient for on-the-go makeup application.\", 100),\n url: 'https://cdn.dummyjson.com/product-images/beauty/eyeshadow-palette-with-mirror/1.webp',\n thumbnail: 'https://cdn.dummyjson.com/product-images/beauty/eyeshadow-palette-with-mirror/thumbnail.webp',\n isProgram: false,\n tagText: '',\n footerLabel: 'Course'\n },\n {\n id: 3,\n title: optimizedData('Powder Canister', 30),\n body: optimizedData('The Powder Canister is a finely milled setting powder designed to set makeup and control shine. With a lightweight and translucent formula, it provides a smooth and matte finish.', 100),\n url: 'https://cdn.dummyjson.com/product-images/beauty/powder-canister/1.webp',\n thumbnail: 'https://cdn.dummyjson.com/product-images/beauty/powder-canister/thumbnail.webp',\n isProgram: true, // TODO\n tagText: 'Professional Certificate',\n footerLabel: '2 Courses'\n },\n {\n id: 4,\n title: optimizedData('Red Lipstick', 30),\n body: optimizedData('The Red Lipstick is a classic and bold choice for adding a pop of color to your lips. With a creamy and pigmented formula, it provides a vibrant and long-lasting finish.', 100),\n url: 'https://cdn.dummyjson.com/product-images/beauty/red-lipstick/1.webp',\n thumbnail: 'https://cdn.dummyjson.com/product-images/beauty/red-lipstick/thumbnail.webp',\n isProgram: false,\n tagText: '',\n footerLabel: 'Course'\n }\n ];\n\n return finalData;\n } catch (error) {\n console.error('Error fetching cards data:', error);\n throw error;\n }\n};\n\nexport const fetchRecentlyViewedCoursesAndPrograms = async () => {\n /* TODO [TEMP]: Replace with actual API call to fetch recently viewed courses and programs data.\n Reason: The API endpoint is not yet available and the data structure is still being finalized.\n Action: Revisit after endpoint is made available.\n */\n\n try {\n const finalData = [\n {\n id: 1,\n title: optimizedData('Data Analytics Fundamentals', 30),\n body: optimizedData('Learn the core concepts of data analytics, including data cleaning, visualization, and basic statistical interpretation.', 100),\n url: 'https://cdn.dummyjson.com/product-images/beauty/essence-mascara-lash-princess/1.webp',\n thumbnail: 'https://cdn.dummyjson.com/product-images/beauty/essence-mascara-lash-princess/thumbnail.webp',\n isProgram: false,\n tagText: '',\n footerLabel: 'Course'\n },\n {\n id: 2,\n title: optimizedData('Product Management Essentials', 30),\n body: optimizedData('Review the workflows, tools, and communication patterns used by product managers to guide delivery across teams.', 100),\n url: 'https://cdn.dummyjson.com/product-images/beauty/eyeshadow-palette-with-mirror/1.webp',\n thumbnail: 'https://cdn.dummyjson.com/product-images/beauty/eyeshadow-palette-with-mirror/thumbnail.webp',\n isProgram: false,\n tagText: '',\n footerLabel: 'Course'\n },\n {\n id: 3,\n title: optimizedData('AI Product Strategy', 30),\n body: optimizedData('Continue a professional certificate covering AI roadmap planning, experimentation, and responsible product delivery.', 100),\n url: 'https://cdn.dummyjson.com/product-images/beauty/powder-canister/1.webp',\n thumbnail: 'https://cdn.dummyjson.com/product-images/beauty/powder-canister/thumbnail.webp',\n isProgram: true,\n tagText: 'Professional Certificate',\n footerLabel: '3 Courses'\n },\n {\n id: 4,\n title: optimizedData('Red Lipstick', 30),\n body: optimizedData('The Red Lipstick is a classic and bold choice for adding a pop of color to your lips. With a creamy and pigmented formula, it provides a vibrant and long-lasting finish.', 100),\n url: 'https://cdn.dummyjson.com/product-images/beauty/red-lipstick/1.webp',\n thumbnail: 'https://cdn.dummyjson.com/product-images/beauty/red-lipstick/thumbnail.webp',\n isProgram: false,\n tagText: '',\n footerLabel: 'Course'\n }\n ];\n\n return finalData;\n } catch (error) {\n console.error('Error fetching recently viewed courses and programs data:', error);\n throw error;\n }\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"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { fetchRecommendedCourses, fetchRecentlyViewedCoursesAndPrograms, getProgramProgressData, } from './api';
|
|
1
|
+
export { fetchRecommendedCourses, fetchRecentlyViewedCoursesAndPrograms, getProgramProgressData, getProgramsListData, } from './api';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { fetchRecommendedCourses, fetchRecentlyViewedCoursesAndPrograms, getProgramProgressData, } from './api';
|
|
1
|
+
export { fetchRecommendedCourses, fetchRecentlyViewedCoursesAndPrograms, getProgramProgressData, getProgramsListData, } 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,uBAAuB,EACvB,qCAAqC,EACrC,sBAAsB,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/data/services/subs/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,uBAAuB,EACvB,qCAAqC,EACrC,sBAAsB,EACtB,mBAAmB,GACpB,MAAM,OAAO,CAAC","sourcesContent":["export {\n fetchRecommendedCourses,\n fetchRecentlyViewedCoursesAndPrograms,\n getProgramProgressData,\n getProgramsListData,\n} from './api';\n"]}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { getSiteConfig } from '@openedx/frontend-base';
|
|
2
2
|
export const getApiUrl = () => (`${getSiteConfig().lmsBaseUrl}/api`);
|
|
3
3
|
export const programProgressUrl = (uuid) => `${getApiUrl()}/dashboard/v0/programs/${encodeURIComponent(uuid)}/progress_details/`;
|
|
4
|
+
export const programsApiUrl = () => `${getApiUrl()}/subscription/programs/dashboard/`;
|
|
4
5
|
//# 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;AAEvD,MAAM,CAAC,MAAM,SAAS,GAAG,GAAG,EAAE,CAAC,CAAC,GAAG,aAAa,EAAE,CAAC,UAAU,MAAM,CAAC,CAAC;AAErE,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,IAAY,EAAE,EAAE,CAAC,GAAG,SAAS,EAAE,0BAA0B,kBAAkB,CAAC,IAAI,CAAC,oBAAoB,CAAC","sourcesContent":["import { getSiteConfig } from '@openedx/frontend-base';\n\nexport const getApiUrl = () => (`${getSiteConfig().lmsBaseUrl}/api`);\n\nexport const programProgressUrl = (uuid: string) => `${getApiUrl()}/dashboard/v0/programs/${encodeURIComponent(uuid)}/progress_details/`;\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;AAEvD,MAAM,CAAC,MAAM,SAAS,GAAG,GAAG,EAAE,CAAC,CAAC,GAAG,aAAa,EAAE,CAAC,UAAU,MAAM,CAAC,CAAC;AAErE,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,IAAY,EAAE,EAAE,CAAC,GAAG,SAAS,EAAE,0BAA0B,kBAAkB,CAAC,IAAI,CAAC,oBAAoB,CAAC;AACzI,MAAM,CAAC,MAAM,cAAc,GAAG,GAAG,EAAE,CAAC,GAAG,SAAS,EAAE,mCAAmC,CAAC","sourcesContent":["import { getSiteConfig } from '@openedx/frontend-base';\n\nexport const getApiUrl = () => (`${getSiteConfig().lmsBaseUrl}/api`);\n\nexport const programProgressUrl = (uuid: string) => `${getApiUrl()}/dashboard/v0/programs/${encodeURIComponent(uuid)}/progress_details/`;\nexport const programsApiUrl = () => `${getApiUrl()}/subscription/programs/dashboard/`;\n"]}
|
package/dist/routes.js
CHANGED
|
@@ -10,11 +10,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
import { authenticatedLoader } from '@openedx/frontend-base';
|
|
11
11
|
const routes = [
|
|
12
12
|
{
|
|
13
|
-
id: 'org.
|
|
14
|
-
path: '/learner-dashboard',
|
|
13
|
+
id: 'org.edx.frontend.route.subsLearnerDashboard.main',
|
|
14
|
+
path: '/subscription-learner-dashboard',
|
|
15
15
|
loader: authenticatedLoader,
|
|
16
16
|
handle: {
|
|
17
|
-
role: 'org.
|
|
17
|
+
role: 'org.edx.frontend.subs.role.dashboard'
|
|
18
18
|
},
|
|
19
19
|
lazy() {
|
|
20
20
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -24,11 +24,11 @@ const routes = [
|
|
|
24
24
|
},
|
|
25
25
|
},
|
|
26
26
|
{
|
|
27
|
-
id: 'org.
|
|
28
|
-
path: '/program-progress/:uuid',
|
|
27
|
+
id: 'org.edx.frontend.route.subsLearnerDashboard.programProgress',
|
|
28
|
+
path: '/subscription-program-progress/:uuid',
|
|
29
29
|
loader: authenticatedLoader,
|
|
30
30
|
handle: {
|
|
31
|
-
role: 'org.
|
|
31
|
+
role: 'org.edx.frontend.subs.role.programProgress'
|
|
32
32
|
},
|
|
33
33
|
lazy() {
|
|
34
34
|
return __awaiter(this, void 0, void 0, function* () {
|
package/dist/routes.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"routes.js","sourceRoot":"","sources":["../src/routes.jsx"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAE7D,MAAM,MAAM,GAAG;IACb;QACE,EAAE,EAAE,kDAAkD;QACtD,IAAI,EAAE,
|
|
1
|
+
{"version":3,"file":"routes.js","sourceRoot":"","sources":["../src/routes.jsx"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAE7D,MAAM,MAAM,GAAG;IACb;QACE,EAAE,EAAE,kDAAkD;QACtD,IAAI,EAAE,iCAAiC;QACvC,MAAM,EAAE,mBAAmB;QAC3B,MAAM,EAAE;YACN,IAAI,EAAE,sCAAsC;SAC7C;QACK,IAAI;;gBACR,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,QAAQ,CAAC,CAAC;gBACtC,OAAO,EAAE,SAAS,EAAE,MAAM,CAAC,OAAO,EAAE,CAAC;YACvC,CAAC;SAAA;KACF;IACD;QACE,EAAE,EAAE,6DAA6D;QACjE,IAAI,EAAE,sCAAsC;QAC5C,MAAM,EAAE,mBAAmB;QAC3B,MAAM,EAAE;YACN,IAAI,EAAE,4CAA4C;SACnD;QACK,IAAI;;gBACR,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,qDAAqD,CAAC,CAAC;gBACnF,OAAO,EAAE,SAAS,EAAE,MAAM,CAAC,OAAO,EAAE,CAAC;YACvC,CAAC;SAAA;KACF;CACF,CAAC;AAEF,eAAe,MAAM,CAAC","sourcesContent":["import { authenticatedLoader } from '@openedx/frontend-base';\n\nconst routes = [\n {\n id: 'org.edx.frontend.route.subsLearnerDashboard.main',\n path: '/subscription-learner-dashboard',\n loader: authenticatedLoader,\n handle: {\n role: 'org.edx.frontend.subs.role.dashboard'\n },\n async lazy () {\n const module = await import('./Main');\n return { Component: module.default };\n },\n },\n {\n id: 'org.edx.frontend.route.subsLearnerDashboard.programProgress',\n path: '/subscription-program-progress/:uuid',\n loader: authenticatedLoader,\n handle: {\n role: 'org.edx.frontend.subs.role.programProgress'\n },\n async lazy () {\n const module = await import('./containers/ProgramDashboard/ProgramProgress/index');\n return { Component: module.default };\n },\n }\n];\n\nexport default routes;\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@edx/frontend-app-subscription-learner-dashboard",
|
|
3
|
-
"version": "1.8.
|
|
3
|
+
"version": "1.8.4",
|
|
4
4
|
"description": "",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"scripts": {
|
|
23
23
|
"build": "make build",
|
|
24
24
|
"clean": "make clean",
|
|
25
|
-
"dev": "PORT=1996 PUBLIC_PATH=/learner-dashboard openedx dev",
|
|
25
|
+
"dev": "PORT=1996 PUBLIC_PATH=/subscription-learner-dashboard openedx dev",
|
|
26
26
|
"i18n_extract": "openedx formatjs extract",
|
|
27
27
|
"lint": "openedx lint .",
|
|
28
28
|
"lint:fix": "openedx lint --fix .",
|