@edx/frontend-app-subscription-learner-dashboard 1.27.1 → 1.28.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -5,21 +5,17 @@ import { ActionRow, Row, Col, Badge } from '@openedx/paragon';
5
5
  import { useIntl } from '@openedx/frontend-base';
6
6
  import { useCourseData, useEntitlementInfo } from '../../../../hooks';
7
7
  import CourseCardActionSlot from '../../../../slots/CourseCardActionSlot';
8
- import SelectSessionButton from './SelectSessionButton';
9
8
  import BeginCourseButton from './BeginCourseButton';
10
9
  import ResumeButton from './ResumeButton';
11
- import ViewCourseButton from './ViewCourseButton';
12
10
  import messages from './messages';
13
11
  export const CourseCardActions = ({ cardId, verifiedCourse, isHistoryTab }) => {
14
12
  var _a, _b;
15
13
  const cardData = useCourseData(cardId);
16
14
  const { formatMessage } = useIntl();
17
15
  const hasStarted = ((_a = cardData === null || cardData === void 0 ? void 0 : cardData.enrollment) === null || _a === void 0 ? void 0 : _a.hasStarted) || false;
18
- const { isEntitlement, isFulfilled } = useEntitlementInfo(cardData);
16
+ const { isEntitlement } = useEntitlementInfo(cardData);
19
17
  const isArchived = ((_b = cardData === null || cardData === void 0 ? void 0 : cardData.courseRun) === null || _b === void 0 ? void 0 : _b.isArchived) || false;
20
- return (_jsxs(Row, { className: "align-items-center mt-3", children: [_jsx(Col, { xs: 12, sm: 6, className: "mb-2 mb-lg-0", children: verifiedCourse && !isHistoryTab ? (_jsx(Badge, { variant: "success", className: "px-3 py-2", children: formatMessage(messages.subsVerifiedCourseText) })) : (!isHistoryTab && (_jsx("span", { className: "small text-info", children: formatMessage(messages.subsIncludedCourseText) }))) }), _jsx(Col, { xs: 12, className: "d-flex justify-content-end", sm: 6, children: !isHistoryTab && (_jsxs(ActionRow, { "data-testid": "CourseCardActions", children: [_jsx(CourseCardActionSlot, { cardId: cardId }), isEntitlement && (isFulfilled
21
- ? _jsx(ViewCourseButton, { cardId: cardId })
22
- : _jsx(SelectSessionButton, { cardId: cardId })), (isArchived && !isEntitlement) && (_jsx(ViewCourseButton, { cardId: cardId })), !(isArchived || isEntitlement) && (hasStarted
18
+ return (_jsxs(Row, { className: "align-items-center mt-3", children: [_jsx(Col, { xs: 12, sm: 6, className: "mb-2 mb-lg-0", children: verifiedCourse && !isHistoryTab ? (_jsx(Badge, { variant: "success", className: "px-3 py-2", children: formatMessage(messages.subsVerifiedCourseText) })) : (!isHistoryTab && (_jsx("span", { className: "small text-info", children: formatMessage(messages.subsIncludedCourseText) }))) }), _jsx(Col, { xs: 12, className: "d-flex justify-content-end", sm: 6, children: !isHistoryTab && (_jsxs(ActionRow, { "data-testid": "CourseCardActions", children: [_jsx(CourseCardActionSlot, { cardId: cardId }), !(isArchived || isEntitlement) && (hasStarted
23
19
  ? _jsx(ResumeButton, { cardId: cardId })
24
20
  : _jsx(BeginCourseButton, { cardId: cardId }))] })) })] }));
25
21
  };
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/containers/CourseCard/components/CourseCardActions/index.jsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,SAAS,MAAM,YAAY,CAAC;AAEnC,OAAO,EAAE,SAAS,EAAE,GAAG,EAAE,GAAG,EAAE,KAAK,EAAG,MAAM,kBAAkB,CAAC;AAC/D,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAEjD,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAE/D,OAAO,oBAAoB,MAAM,iCAAiC,CAAC;AACnE,OAAO,mBAAmB,MAAM,uBAAuB,CAAC;AACxD,OAAO,iBAAiB,MAAM,qBAAqB,CAAC;AACpD,OAAO,YAAY,MAAM,gBAAgB,CAAC;AAC1C,OAAO,gBAAgB,MAAM,oBAAoB,CAAC;AAClD,OAAO,QAAQ,MAAM,YAAY,CAAC;AAElC,MAAM,CAAC,MAAM,iBAAiB,GAA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MAAM,GAAI;4BACtC,CAAC,CAAC,KAAC,mBAAmB,IAAC,MAAM,EAAE,MAAM,GAAI,CAC1C,EACA,CAAC,UAAU,IAAI,CAAC,aAAa,CAAC,IAAI,CACjC,KAAC,gBAAgB,IAAC,MAAM,EAAE,MAAM,GAAI,CACrC,EACA,CAAC,CAAC,UAAU,IAAI,aAAa,CAAC,IAAI,CAAC,UAAU;4BAC5C,CAAC,CAAC,KAAC,YAAY,IAAC,MAAM,EAAE,MAAM,GAAI;4BAClC,CAAC,CAAC,KAAC,iBAAiB,IAAC,MAAM,EAAE,MAAM,GAAI,CACxC,IACS,CACb,GACG,IACJ,CAEP,CAAC;AACJ,CAAC,CAAC;AACF,iBAAiB,CAAC,SAAS,GAAG;IAC5B,MAAM,EAAE,SAAS,CAAC,MAAM,CAAC,UAAU;IACnC,cAAc,EAAE,SAAS,CAAC,IAAI;IAC9B,YAAY,EAAE,SAAS,CAAC,IAAI;CAC7B,CAAC;AAEF,eAAe,iBAAiB,CAAC","sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\n\nimport { ActionRow, Row, Col, Badge } from '@openedx/paragon';\nimport { useIntl } from '@openedx/frontend-base';\n\nimport { useCourseData, useEntitlementInfo } from '@src/hooks';\n\nimport CourseCardActionSlot from '@src/slots/CourseCardActionSlot';\nimport SelectSessionButton from './SelectSessionButton';\nimport BeginCourseButton from './BeginCourseButton';\nimport ResumeButton from './ResumeButton';\nimport ViewCourseButton from './ViewCourseButton';\nimport messages from './messages';\n\nexport const CourseCardActions = ({ cardId, verifiedCourse, isHistoryTab }) => {\n const cardData = useCourseData(cardId);\n const { formatMessage } = useIntl();\n const hasStarted = cardData?.enrollment?.hasStarted || false;\n const { isEntitlement, isFulfilled } = useEntitlementInfo(cardData);\n const isArchived = cardData?.courseRun?.isArchived || false;\n\n return (\n <Row className=\"align-items-center mt-3\">\n <Col xs={12} sm={6} className=\"mb-2 mb-lg-0\">\n {/* TODO [TEMP]: Showing 2 types of badges for now. After backend connection, can anticipate 3rd type of badge as well\n Reason: Development before backend connection\n Action: Revisit after backend connection and finalize badge types and conditions for each type\n */}\n {verifiedCourse && !isHistoryTab ? (\n <Badge variant=\"success\" className=\"px-3 py-2\">\n {formatMessage(messages.subsVerifiedCourseText)}\n </Badge>\n ) : (\n !isHistoryTab && (\n <span className=\"small text-info\">\n {formatMessage(messages.subsIncludedCourseText)}\n </span>\n )\n )}\n </Col>\n\n <Col xs={12} className=\"d-flex justify-content-end\" sm={6}>\n {!isHistoryTab && (\n <ActionRow data-testid=\"CourseCardActions\">\n <CourseCardActionSlot cardId={cardId} />\n {isEntitlement && (isFulfilled\n ? <ViewCourseButton cardId={cardId} />\n : <SelectSessionButton cardId={cardId} />\n )}\n {(isArchived && !isEntitlement) && (\n <ViewCourseButton cardId={cardId} />\n )}\n {!(isArchived || isEntitlement) && (hasStarted\n ? <ResumeButton cardId={cardId} />\n : <BeginCourseButton cardId={cardId} />\n )}\n </ActionRow>\n )}\n </Col>\n </Row>\n \n );\n};\nCourseCardActions.propTypes = {\n cardId: PropTypes.string.isRequired,\n verifiedCourse: PropTypes.bool,\n isHistoryTab: PropTypes.bool,\n};\n\nexport default CourseCardActions;\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/containers/CourseCard/components/CourseCardActions/index.jsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,SAAS,MAAM,YAAY,CAAC;AAEnC,OAAO,EAAE,SAAS,EAAE,GAAG,EAAE,GAAG,EAAE,KAAK,EAAG,MAAM,kBAAkB,CAAC;AAC/D,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAEjD,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAE/D,OAAO,oBAAoB,MAAM,iCAAiC,CAAC;AACnE,OAAO,iBAAiB,MAAM,qBAAqB,CAAC;AACpD,OAAO,YAAY,MAAM,gBAAgB,CAAC;AA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U,IAAI,aAAa,CAAC,IAAI,CAAC,UAAU;4BAC5C,CAAC,CAAC,KAAC,YAAY,IAAC,MAAM,EAAE,MAAM,GAAI;4BAClC,CAAC,CAAC,KAAC,iBAAiB,IAAC,MAAM,EAAE,MAAM,GAAI,CACxC,IACS,CACb,GACG,IACJ,CAEP,CAAC;AACJ,CAAC,CAAC;AACF,iBAAiB,CAAC,SAAS,GAAG;IAC5B,MAAM,EAAE,SAAS,CAAC,MAAM,CAAC,UAAU;IACnC,cAAc,EAAE,SAAS,CAAC,IAAI;IAC9B,YAAY,EAAE,SAAS,CAAC,IAAI;CAC7B,CAAC;AAEF,eAAe,iBAAiB,CAAC","sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\n\nimport { ActionRow, Row, Col, Badge } from '@openedx/paragon';\nimport { useIntl } from '@openedx/frontend-base';\n\nimport { useCourseData, useEntitlementInfo } from '@src/hooks';\n\nimport CourseCardActionSlot from '@src/slots/CourseCardActionSlot';\nimport BeginCourseButton from './BeginCourseButton';\nimport ResumeButton from './ResumeButton';\nimport messages from './messages';\n\nexport const CourseCardActions = ({ cardId, verifiedCourse, isHistoryTab }) => {\n const cardData = useCourseData(cardId);\n const { formatMessage } = useIntl();\n const hasStarted = cardData?.enrollment?.hasStarted || false;\n const { isEntitlement } = useEntitlementInfo(cardData);\n const isArchived = cardData?.courseRun?.isArchived || false;\n\n return (\n <Row className=\"align-items-center mt-3\">\n <Col xs={12} sm={6} className=\"mb-2 mb-lg-0\">\n {/* TODO [TEMP]: Showing 2 types of badges for now. After backend connection, can anticipate 3rd type of badge as well\n Reason: Development before backend connection\n Action: Revisit after backend connection and finalize badge types and conditions for each type\n */}\n {verifiedCourse && !isHistoryTab ? (\n <Badge variant=\"success\" className=\"px-3 py-2\">\n {formatMessage(messages.subsVerifiedCourseText)}\n </Badge>\n ) : (\n !isHistoryTab && (\n <span className=\"small text-info\">\n {formatMessage(messages.subsIncludedCourseText)}\n </span>\n )\n )}\n </Col>\n\n <Col xs={12} className=\"d-flex justify-content-end\" sm={6}>\n {!isHistoryTab && (\n <ActionRow data-testid=\"CourseCardActions\">\n <CourseCardActionSlot cardId={cardId} />\n {/* Currently, only the Begin and Resume actions are supported as per the Figma design.\n Keep the following actions commented out for now; they can be enabled in the future\n if the corresponding functionality is required. */}\n {/* {isEntitlement && (isFulfilled\n ? <ViewCourseButton cardId={cardId} />\n : <SelectSessionButton cardId={cardId} />\n )}\n {(isArchived && !isEntitlement) && (\n <ViewCourseButton cardId={cardId} />\n )} */}\n {!(isArchived || isEntitlement) && (hasStarted\n ? <ResumeButton cardId={cardId} />\n : <BeginCourseButton cardId={cardId} />\n )}\n </ActionRow>\n )}\n </Col>\n </Row>\n \n );\n};\nCourseCardActions.propTypes = {\n cardId: PropTypes.string.isRequired,\n verifiedCourse: PropTypes.bool,\n isHistoryTab: PropTypes.bool,\n};\n\nexport default CourseCardActions;\n"]}
package/dist/routes.js CHANGED
@@ -7,15 +7,15 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
7
7
  step((generator = generator.apply(thisArg, _arguments || [])).next());
8
8
  });
9
9
  };
10
- import { authenticatedLoader, getAuthenticatedHttpClient } from '@openedx/frontend-base';
11
- import { subscriptionDashboardRole, subscriptionDashboardUrlPath, subscriptionProgramProgressRole } from './constants';
10
+ import { authenticatedLoader, getAuthenticatedHttpClient, getAppConfig } from '@openedx/frontend-base';
11
+ import { appId, subscriptionDashboardRole, subscriptionDashboardUrlPath, subscriptionProgramProgressRole } from './constants';
12
12
  import { getSubsInitApiUrl } from './data/services/subs/urls';
13
13
  import { redirect } from 'react-router-dom';
14
14
  // loader to check if the user has subscription access
15
15
  const subscriptionAccessLoader = () => __awaiter(void 0, void 0, void 0, function* () {
16
16
  try {
17
17
  const { data } = yield getAuthenticatedHttpClient().get(getSubsInitApiUrl());
18
- if (!(data === null || data === void 0 ? void 0 : data.userSubscription) || !data.userSubscription.isSubscriber) {
18
+ if (!(data === null || data === void 0 ? void 0 : data.userSubscription) || !data.userSubscription.isSubscriber || !getAppConfig(appId).ENABLE_SUBSCRIPTION_SITE) {
19
19
  throw redirect('/learner-dashboard'); //redirect to learner dashboard if user does not have subscription access
20
20
  }
21
21
  return null;
@@ -1 +1 @@
1
- {"version":3,"file":"routes.js","sourceRoot":"","sources":["../src/routes.jsx"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,mBAAmB,EAAE,0BAA0B,EAAE,MAAM,wBAAwB,CAAC;AAEzF,OAAO,EAAG,yBAAyB,EAAE,4BAA4B,EAAE,+BAA+B,EAAE,MAAM,aAAa,CAAC;AACxH,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAE5C,sDAAsD;AACtD,MAAM,wBAAwB,GAAG,GAAS,EAAE;IAC1C,IAAI,CAAC;QACH,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,0BAA0B,EAAE,CAAC,GAAG,CAAC,iBAAiB,EAAE,CAAC,CAAC;QAE7E,IAAI,CAAC,CAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,gBAAgB,CAAA,IAAI,CAAC,IAAI,CAAC,gBAAgB,CAAC,YAAY,EAAE,CAAC;YACnE,MAAM,QAAQ,CAAC,oBAAoB,CAAC,CAAC,CAAE,yEAAyE;QAClH,CAAC;QAED,OAAO,IAAI,CAAC;IACd,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,mCAAmC;QACnC,IAAI,KAAK,YAAY,QAAQ,EAAE,CAAC;YAC9B,MAAM,KAAK,CAAC;QACd,CAAC;QAED,MAAM,QAAQ,CAAC,oBAAoB,CAAC,CAAC,CAAC,mDAAmD;IAC3F,CAAC;AACH,CAAC,CAAA,CAAC;AAEF,yEAAyE;AACzE,MAAM,eAAe,GAAG,CAAO,IAAI,EAAE,EAAE;IACrC,MAAM,mBAAmB,CAAC,IAAI,CAAC,CAAC;IAChC,MAAM,wBAAwB,EAAE,CAAC;IAEjC,OAAO,IAAI,CAAC;AACd,CAAC,CAAA,CAAC;AAEF,MAAM,MAAM,GAAG;IACb;QACE,EAAE,EAAE,kDAAkD;QACtD,IAAI,EAAE,4BAA4B;QAClC,MAAM,EAAE,eAAe;QACvB,MAAM,EAAE;YACN,IAAI,EAAE,yBAAyB;SAChC;QACK,IAAI;;gBACR,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,QAAQ,CAAC,CAAC;gBACtC,OAAO,EAAE,SAAS,EAAE,MAAM,CAAC,OAAO,EAAE,CAAC;YACvC,CAAC;SAAA;KACF;IACD;QACE,EAAE,EAAE,6DAA6D;QACjE,IAAI,EAAE,sCAAsC;QAC5C,MAAM,EAAE,eAAe;QACvB,MAAM,EAAE;YACN,IAAI,EAAE,+BAA+B;SACtC;QACK,IAAI;;gBACR,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,qDAAqD,CAAC,CAAC;gBACnF,OAAO,EAAE,SAAS,EAAE,MAAM,CAAC,OAAO,EAAE,CAAC;YACvC,CAAC;SAAA;KACF;CACF,CAAC;AAEF,eAAe,MAAM,CAAC","sourcesContent":["import { authenticatedLoader, getAuthenticatedHttpClient } from '@openedx/frontend-base';\n\nimport { subscriptionDashboardRole, subscriptionDashboardUrlPath, subscriptionProgramProgressRole } from './constants';\nimport { getSubsInitApiUrl } from './data/services/subs/urls';\nimport { redirect } from 'react-router-dom';\n\n// loader to check if the user has subscription access\nconst subscriptionAccessLoader = async () => {\n try {\n const { data } = await getAuthenticatedHttpClient().get(getSubsInitApiUrl());\n\n if (!data?.userSubscription || !data.userSubscription.isSubscriber) {\n throw redirect('/learner-dashboard'); //redirect to learner dashboard if user does not have subscription access\n }\n \n return null;\n } catch (error) {\n // Let redirect responses bubble up\n if (error instanceof Response) {\n throw error;\n }\n\n throw redirect('/learner-dashboard'); // redirect to learner dashboard if an error occurs\n }\n};\n\n// composed loader that checks for authentication and subscription access\nconst protectedLoader = async (args) => {\n await authenticatedLoader(args);\n await subscriptionAccessLoader();\n\n return null;\n};\n\nconst routes = [\n {\n id: 'org.edx.frontend.route.subsLearnerDashboard.main',\n path: subscriptionDashboardUrlPath,\n loader: protectedLoader,\n handle: {\n role: subscriptionDashboardRole\n },\n async lazy () {\n const module = await import('./Main');\n return { Component: module.default };\n },\n },\n {\n id: 'org.edx.frontend.route.subsLearnerDashboard.programProgress',\n path: '/subscription-program-progress/:uuid',\n loader: protectedLoader,\n handle: {\n role: subscriptionProgramProgressRole\n },\n async lazy () {\n const module = await import('./containers/ProgramDashboard/ProgramProgress/index');\n return { Component: module.default };\n },\n }\n];\n\nexport default routes;\n"]}
1
+ {"version":3,"file":"routes.js","sourceRoot":"","sources":["../src/routes.jsx"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,mBAAmB,EAAE,0BAA0B,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAEvG,OAAO,EAAE,KAAK,EAAE,yBAAyB,EAAE,4BAA4B,EAAE,+BAA+B,EAAE,MAAM,aAAa,CAAC;AAC9H,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAE5C,sDAAsD;AACtD,MAAM,wBAAwB,GAAG,GAAS,EAAE;IAC1C,IAAI,CAAC;QACH,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,0BAA0B,EAAE,CAAC,GAAG,CAAC,iBAAiB,EAAE,CAAC,CAAC;QAE7E,IAAI,CAAC,CAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,gBAAgB,CAAA,IAAI,CAAC,IAAI,CAAC,gBAAgB,CAAC,YAAY,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC,wBAAwB,EAAE,CAAC;YACpH,MAAM,QAAQ,CAAC,oBAAoB,CAAC,CAAC,CAAE,yEAAyE;QAClH,CAAC;QAED,OAAO,IAAI,CAAC;IACd,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,mCAAmC;QACnC,IAAI,KAAK,YAAY,QAAQ,EAAE,CAAC;YAC9B,MAAM,KAAK,CAAC;QACd,CAAC;QAED,MAAM,QAAQ,CAAC,oBAAoB,CAAC,CAAC,CAAC,mDAAmD;IAC3F,CAAC;AACH,CAAC,CAAA,CAAC;AAEF,yEAAyE;AACzE,MAAM,eAAe,GAAG,CAAO,IAAI,EAAE,EAAE;IACrC,MAAM,mBAAmB,CAAC,IAAI,CAAC,CAAC;IAChC,MAAM,wBAAwB,EAAE,CAAC;IAEjC,OAAO,IAAI,CAAC;AACd,CAAC,CAAA,CAAC;AAEF,MAAM,MAAM,GAAG;IACb;QACE,EAAE,EAAE,kDAAkD;QACtD,IAAI,EAAE,4BAA4B;QAClC,MAAM,EAAE,eAAe;QACvB,MAAM,EAAE;YACN,IAAI,EAAE,yBAAyB;SAChC;QACK,IAAI;;gBACR,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,QAAQ,CAAC,CAAC;gBACtC,OAAO,EAAE,SAAS,EAAE,MAAM,CAAC,OAAO,EAAE,CAAC;YACvC,CAAC;SAAA;KACF;IACD;QACE,EAAE,EAAE,6DAA6D;QACjE,IAAI,EAAE,sCAAsC;QAC5C,MAAM,EAAE,eAAe;QACvB,MAAM,EAAE;YACN,IAAI,EAAE,+BAA+B;SACtC;QACK,IAAI;;gBACR,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,qDAAqD,CAAC,CAAC;gBACnF,OAAO,EAAE,SAAS,EAAE,MAAM,CAAC,OAAO,EAAE,CAAC;YACvC,CAAC;SAAA;KACF;CACF,CAAC;AAEF,eAAe,MAAM,CAAC","sourcesContent":["import { authenticatedLoader, getAuthenticatedHttpClient, getAppConfig } from '@openedx/frontend-base';\n\nimport { appId, subscriptionDashboardRole, subscriptionDashboardUrlPath, subscriptionProgramProgressRole } from './constants';\nimport { getSubsInitApiUrl } from './data/services/subs/urls';\nimport { redirect } from 'react-router-dom';\n\n// loader to check if the user has subscription access\nconst subscriptionAccessLoader = async () => {\n try {\n const { data } = await getAuthenticatedHttpClient().get(getSubsInitApiUrl());\n\n if (!data?.userSubscription || !data.userSubscription.isSubscriber || !getAppConfig(appId).ENABLE_SUBSCRIPTION_SITE) {\n throw redirect('/learner-dashboard'); //redirect to learner dashboard if user does not have subscription access\n }\n \n return null;\n } catch (error) {\n // Let redirect responses bubble up\n if (error instanceof Response) {\n throw error;\n }\n\n throw redirect('/learner-dashboard'); // redirect to learner dashboard if an error occurs\n }\n};\n\n// composed loader that checks for authentication and subscription access\nconst protectedLoader = async (args) => {\n await authenticatedLoader(args);\n await subscriptionAccessLoader();\n\n return null;\n};\n\nconst routes = [\n {\n id: 'org.edx.frontend.route.subsLearnerDashboard.main',\n path: subscriptionDashboardUrlPath,\n loader: protectedLoader,\n handle: {\n role: subscriptionDashboardRole\n },\n async lazy () {\n const module = await import('./Main');\n return { Component: module.default };\n },\n },\n {\n id: 'org.edx.frontend.route.subsLearnerDashboard.programProgress',\n path: '/subscription-program-progress/:uuid',\n loader: protectedLoader,\n handle: {\n role: subscriptionProgramProgressRole\n },\n async lazy () {\n const module = await import('./containers/ProgramDashboard/ProgramProgress/index');\n return { Component: module.default };\n },\n }\n];\n\nexport default routes;\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@edx/frontend-app-subscription-learner-dashboard",
3
- "version": "1.27.1",
3
+ "version": "1.28.0",
4
4
  "description": "",
5
5
  "repository": {
6
6
  "type": "git",