@edx/frontend-app-subscription-learner-dashboard 1.80.0 → 1.80.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.
|
@@ -21,17 +21,20 @@ const getProgramCertificateLabel = (programType, formatMessage) => {
|
|
|
21
21
|
}
|
|
22
22
|
};
|
|
23
23
|
export const ProgramProgressSidebar = ({ inProgress, remaining, completed }) => {
|
|
24
|
-
var _a, _b
|
|
24
|
+
var _a, _b;
|
|
25
25
|
const { formatMessage } = useIntl();
|
|
26
26
|
const { programProgressData, isLoading } = useProgressData();
|
|
27
|
-
const
|
|
28
|
-
const
|
|
27
|
+
const programData = programProgressData === null || programProgressData === void 0 ? void 0 : programProgressData.programData;
|
|
28
|
+
const priceRange = (_b = (_a = programData === null || programData === void 0 ? void 0 : programData.priceRanges) === null || _a === void 0 ? void 0 : _a[0]) !== null && _b !== void 0 ? _b : undefined;
|
|
29
|
+
const hasPriceRange = Boolean(priceRange && Number.isFinite(Number(priceRange.total)) && priceRange.currency);
|
|
30
|
+
const price = !isLoading && hasPriceRange ? (_jsx(FormattedNumber, { value: priceRange.total, style: "currency", currency: priceRange.currency })) : null;
|
|
31
|
+
const type = (programData === null || programData === void 0 ? void 0 : programData.type) || '';
|
|
29
32
|
const programType = getProgramCertificateLabel(type, formatMessage);
|
|
30
33
|
return (_jsxs("div", { className: "program-certificate-widget", "data-testid": "program-certificate-progress", children: [_jsx(ProgramProgressCircle, { inProgress: inProgress, remaining: remaining, completed: completed }), _jsx("h6", { className: "progress-heading-circle my-5", children: formatMessage(messages.programProgressCertificateLabel) }), type.trim().toLowerCase()
|
|
31
34
|
!== PROGRAM_TYPE_MAP.MICROMASTERS.toLowerCase() && (_jsxs("div", { className: "progress-certificate-content pt-3 px-3", children: [_jsx("p", { className: "text-gray-800", children: formatMessage(messages.programProgressCertificateContentOne, {
|
|
32
35
|
programType: programType,
|
|
33
|
-
}) }), _jsx("p", { className: "text-gray-800", children: formatMessage(messages.programProgressCertificateContentTwo, {
|
|
36
|
+
}) }), price && (_jsx("p", { className: "text-gray-800", children: formatMessage(messages.programProgressCertificateContentTwo, {
|
|
34
37
|
price,
|
|
35
|
-
}) })] }))] }));
|
|
38
|
+
}) }))] }))] }));
|
|
36
39
|
};
|
|
37
40
|
//# sourceMappingURL=index.js.map
|
package/dist/containers/ProgramDashboard/ProgramProgress/ProgramProgressSidebar/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/containers/ProgramDashboard/ProgramProgress/ProgramProgressSidebar/index.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAClE,OAAO,QAAQ,MAAM,aAAa,CAAC;AAEnC,OAAO,qBAAqB,MAAM,yBAAyB,CAAC;AAC5D,OAAO,cAAc,CAAC;AACtB,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAExD,MAAM,0BAA0B,GAAG,CAAC,WAAoB,EAAE,aAAmF,EAAE,EAAE;IAC/I,MAAM,cAAc,GAAG,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,IAAI,EAAE,CAAC;IAE3C,IAAI,CAAC,cAAc,EAAE,CAAC;QACpB,OAAO,aAAa,CAAC,CAAC,CAAC,aAAa,CAAC,QAAQ,CAAC,8BAA8B,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC;IAChG,CAAC;IAED,MAAM,aAAa,GAAG,cAAc,CAAC,WAAW,EAAE,CAAC;IAEnD,QAAQ,aAAa,EAAE,CAAC;QACtB,KAAK,gBAAgB,CAAC,OAAO,CAAC,WAAW,EAAE;YACzC,OAAO,aAAa,CAAC,CAAC,CAAC,aAAa,CAAC,QAAQ,CAAC,sCAAsC,CAAC,CAAC,CAAC,CAAC,qBAAqB,CAAC;QAChH,KAAK,gBAAgB,CAAC,wBAAwB,CAAC,WAAW,EAAE;YAC1D,OAAO,cAAc,CAAC;QACxB;YACE,OAAO,GAAG,cAAc,IAAI,aAAa,CAAC,CAAC,CAAC,aAAa,CAAC,QAAQ,CAAC,8BAA8B,CAAC,CAAC,CAAC,CAAC,aAAa,EAAE,CAAC;IACzH,CAAC;AACH,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,sBAAsB,GAAoC,CAAC,EACtE,UAAU,EAAE,SAAS,EAAE,SAAS,EACjC,EAAE,EAAE;;IACH,MAAM,EAAE,aAAa,EAAE,GAAG,OAAO,EAAE,CAAC;IACpC,MAAM,EAAE,mBAAmB,EAAE,SAAS,EAAE,GAAG,eAAe,EAAE,CAAC;IAE7D,MAAM,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/containers/ProgramDashboard/ProgramProgress/ProgramProgressSidebar/index.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAClE,OAAO,QAAQ,MAAM,aAAa,CAAC;AAEnC,OAAO,qBAAqB,MAAM,yBAAyB,CAAC;AAC5D,OAAO,cAAc,CAAC;AACtB,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAExD,MAAM,0BAA0B,GAAG,CAAC,WAAoB,EAAE,aAAmF,EAAE,EAAE;IAC/I,MAAM,cAAc,GAAG,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,IAAI,EAAE,CAAC;IAE3C,IAAI,CAAC,cAAc,EAAE,CAAC;QACpB,OAAO,aAAa,CAAC,CAAC,CAAC,aAAa,CAAC,QAAQ,CAAC,8BAA8B,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC;IAChG,CAAC;IAED,MAAM,aAAa,GAAG,cAAc,CAAC,WAAW,EAAE,CAAC;IAEnD,QAAQ,aAAa,EAAE,CAAC;QAC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A,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,IAAI,KAAI,EAAE,CAAC;IACrC,MAAM,WAAW,GAAG,0BAA0B,CAAC,IAAI,EAAE,aAAa,CAAC,CAAC;IAEpE,OAAO,CACL,eACE,SAAS,EAAC,4BAA4B,iBAC1B,8BAA8B,aAE1C,KAAC,qBAAqB,IAAC,UAAU,EAAE,UAAU,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,GAAI,EAC7F,aAAI,SAAS,EAAC,8BAA8B,YACzC,aAAa,CAAC,QAAQ,CAAC,+BAA+B,CAAC,GACrD,EACJ,IAAI,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE;oBACtB,gBAAgB,CAAC,YAAY,CAAC,WAAW,EAAE,IAAI,CACjD,eAAK,SAAS,EAAC,wCAAwC,aACrD,YAAG,SAAS,EAAC,eAAe,YACzB,aAAa,CAAC,QAAQ,CAAC,oCAAoC,EAAE;4BAC5D,WAAW,EAAE,WAAW;yBACzB,CAAC,GACA,EACH,KAAK,IAAI,CACR,YAAG,SAAS,EAAC,eAAe,YACzB,aAAa,CAAC,QAAQ,CAAC,oCAAoC,EAAE;4BAC5D,KAAK;yBACN,CAAC,GACA,CACL,IACG,CACP,IACG,CACP,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import { FC } from 'react';\nimport { useIntl, FormattedNumber } from '@openedx/frontend-base';\nimport messages from '../messages';\nimport { ProgramProgressSidebarProps } from '../../data/types';\nimport ProgramProgressCircle from './ProgramProgressCircle';\nimport './index.scss';\nimport { useProgressData } from '@src/hooks';\nimport { PROGRAM_TYPE_MAP } from '../../data/constants';\n\nconst getProgramCertificateLabel = (programType?: string, formatMessage?: (message: typeof messages.programProgressCertificateText) => string) => {\n const normalizedType = programType?.trim();\n\n if (!normalizedType) {\n return formatMessage ? formatMessage(messages.programProgressCertificateText) : 'certificate';\n }\n\n const lowercaseType = normalizedType.toLowerCase();\n\n switch (lowercaseType) {\n case PROGRAM_TYPE_MAP.XSERIES.toLowerCase():\n return formatMessage ? formatMessage(messages.programProgressXSeriesCertificateLabel) : 'XSeries Certificate';\n case PROGRAM_TYPE_MAP.PROFESSIONAL_CERTIFICATE.toLowerCase():\n return normalizedType;\n default:\n return `${normalizedType} ${formatMessage ? formatMessage(messages.programProgressCertificateText) : 'certificate'}`;\n }\n};\n\nexport const ProgramProgressSidebar: FC<ProgramProgressSidebarProps> = ({\n inProgress, remaining, completed\n}) => {\n const { formatMessage } = useIntl();\n const { programProgressData, isLoading } = useProgressData();\n\n const programData = programProgressData?.programData;\n const priceRange = programData?.priceRanges?.[0] ?? undefined;\n const hasPriceRange = Boolean(\n priceRange && Number.isFinite(Number(priceRange.total)) && priceRange.currency,\n );\n const price = !isLoading && hasPriceRange ? (\n <FormattedNumber value={priceRange.total} style=\"currency\" currency={priceRange.currency} />\n ) : null;\n const type = programData?.type || '';\n const programType = getProgramCertificateLabel(type, formatMessage);\n\n return (\n <div\n className=\"program-certificate-widget\"\n data-testid=\"program-certificate-progress\"\n >\n <ProgramProgressCircle inProgress={inProgress} remaining={remaining} completed={completed} />\n <h6 className=\"progress-heading-circle my-5\">\n {formatMessage(messages.programProgressCertificateLabel)}\n </h6>\n {type.trim().toLowerCase()\n !== PROGRAM_TYPE_MAP.MICROMASTERS.toLowerCase() && (\n <div className=\"progress-certificate-content pt-3 px-3\">\n <p className=\"text-gray-800\">\n {formatMessage(messages.programProgressCertificateContentOne, {\n programType: programType,\n })}\n </p>\n {price && (\n <p className=\"text-gray-800\">\n {formatMessage(messages.programProgressCertificateContentTwo, {\n price,\n })}\n </p>\n )}\n </div>\n )}\n </div>\n );\n};\n"]}
|