@edx/frontend-app-alacarte-checkout 1.30.0 → 1.32.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/AlacarteConfirmation/AlacarteConfirmation.js +2 -2
- package/dist/components/AlacarteConfirmation/AlacarteConfirmation.js.map +1 -1
- package/dist/components/CartSummary/CartSummary.js +1 -1
- package/dist/components/CartSummary/CartSummary.js.map +1 -1
- package/dist/components/CheckoutGate/CheckoutGate.js +1 -1
- package/dist/components/CheckoutGate/CheckoutGate.js.map +1 -1
- package/dist/components/HelpCenter/HelpCenter.d.ts +3 -0
- package/dist/components/HelpCenter/HelpCenter.js +13 -0
- package/dist/components/HelpCenter/HelpCenter.js.map +1 -0
- package/dist/components/HelpCenter/messages.d.ts +13 -0
- package/dist/components/HelpCenter/messages.js +15 -0
- package/dist/components/HelpCenter/messages.js.map +1 -0
- package/dist/components/OrderHistory/OrderHistory.d.ts +3 -0
- package/dist/components/OrderHistory/OrderHistory.js +10 -0
- package/dist/components/OrderHistory/OrderHistory.js.map +1 -0
- package/dist/components/OrderHistory/OrderHistoryHeader.d.ts +3 -0
- package/dist/components/OrderHistory/OrderHistoryHeader.js +9 -0
- package/dist/components/OrderHistory/OrderHistoryHeader.js.map +1 -0
- package/dist/components/OrderHistory/OrderHistoryTabDetails/CoursePayments.d.ts +3 -0
- package/dist/components/OrderHistory/OrderHistoryTabDetails/CoursePayments.js +9 -0
- package/dist/components/OrderHistory/OrderHistoryTabDetails/CoursePayments.js.map +1 -0
- package/dist/components/OrderHistory/OrderHistoryTabDetails/SubscriptionPayments.d.ts +3 -0
- package/dist/components/OrderHistory/OrderHistoryTabDetails/SubscriptionPayments.js +9 -0
- package/dist/components/OrderHistory/OrderHistoryTabDetails/SubscriptionPayments.js.map +1 -0
- package/dist/components/OrderHistory/OrderHistoryTabDetails/messages.d.ts +18 -0
- package/dist/components/OrderHistory/OrderHistoryTabDetails/messages.js +20 -0
- package/dist/components/OrderHistory/OrderHistoryTabDetails/messages.js.map +1 -0
- package/dist/components/OrderHistory/OrderHistoryTabs/OrderHistoryTabs.d.ts +2 -0
- package/dist/components/OrderHistory/OrderHistoryTabs/OrderHistoryTabs.js +32 -0
- package/dist/components/OrderHistory/OrderHistoryTabs/OrderHistoryTabs.js.map +1 -0
- package/dist/components/OrderHistory/messages.d.ts +23 -0
- package/dist/components/OrderHistory/messages.js +25 -0
- package/dist/components/OrderHistory/messages.js.map +1 -0
- package/dist/components/ProgramEnrollmentCard/ProgramEnrollmentCard.js +1 -1
- package/dist/components/ProgramEnrollmentCard/ProgramEnrollmentCard.js.map +1 -1
- package/dist/components/PromoCode/PromoCode.js +1 -1
- package/dist/components/PromoCode/PromoCode.js.map +1 -1
- package/dist/routes.js +27 -0
- package/dist/routes.js.map +1 -1
- package/dist/style.scss +1 -0
- package/dist/styles/components/alacarteConfirmation.scss +12 -0
- package/dist/styles/components/cartSummary.scss +7 -0
- package/dist/styles/components/orderHistory.scss +3 -0
- package/dist/styles/components/programEnrollmentCard.scss +2 -0
- package/dist/styles/components/promoCode.scss +4 -0
- package/package.json +1 -1
|
@@ -85,9 +85,9 @@ const AlacarteConfirmation = ({ order, awaiting, error, onContinue, productDetai
|
|
|
85
85
|
amount: discount.toFixed(2),
|
|
86
86
|
currency,
|
|
87
87
|
}) })] })), _jsxs("div", { className: "alacarte-confirmation__price-row alacarte-confirmation__price-row--paid", children: [_jsx("span", { children: formatMessage(messages.amountPaid) }), _jsx("span", { children: money(paid) })] })] }));
|
|
88
|
-
return (_jsx("div", { className: "alacarte-confirmation", "data-testid": "alacarte-confirmation", children: _jsxs(Row, { className: "alacarte-confirmation__row", children: [_jsxs(Col, { xs: 12, lg: 7, className: "alacarte-confirmation__main", children: [_jsx("h1", { className: "alacarte-confirmation__headline font-weight-bold mb-4", children: formatMessage(messages.headline) }), _jsx("p", { className: "alacarte-confirmation__subheadline mb-4", children: formatMessage(programOrder ? messages.subheadlineProgram : messages.subheadlineCourse, { productLabel }) }), _jsxs("div", { className: "alacarte-confirmation__ctas d-flex align-items-center flex-wrap mb-4.5", children: [_jsx(Button, { variant: "brand", className: "alacarte-confirmation__cta-primary", onClick: onContinue, children: formatMessage(programOrder ? messages.startProgram : messages.startCourse) }), orderHistoryUrl && (_jsx("a", { href: orderHistoryUrl, className: "alacarte-confirmation__order-history", children: formatMessage(messages.viewOrderHistory) }))] }), _jsx("div", { className: "alacarte-confirmation__summary-mobile d-lg-none", children: summaryCard }), programOrder && (purchasedCourseNames.length > 0 || previouslyPurchased.length > 0) && (_jsxs("div", { className: "alacarte-confirmation__about-program mb-5", children: [_jsx("h2", { className: "alacarte-confirmation__about-title", children: formatMessage(messages.aboutProgram) }), purchasedCourseNames.length > 0 && (_jsxs(_Fragment, { children: [_jsx("
|
|
88
|
+
return (_jsx("div", { className: "alacarte-confirmation", "data-testid": "alacarte-confirmation", children: _jsxs(Row, { className: "alacarte-confirmation__row", children: [_jsxs(Col, { xs: 12, lg: 7, className: "alacarte-confirmation__main", children: [_jsx("h1", { className: "alacarte-confirmation__headline font-weight-bold mb-4", children: formatMessage(messages.headline) }), _jsx("p", { className: "alacarte-confirmation__subheadline mb-4", children: formatMessage(programOrder ? messages.subheadlineProgram : messages.subheadlineCourse, { productLabel }) }), _jsxs("div", { className: "alacarte-confirmation__ctas d-flex align-items-center flex-wrap mb-4.5", children: [_jsx(Button, { variant: "brand", className: "alacarte-confirmation__cta-primary", onClick: onContinue, children: formatMessage(programOrder ? messages.startProgram : messages.startCourse) }), orderHistoryUrl && (_jsx("a", { href: orderHistoryUrl, className: "alacarte-confirmation__order-history", children: formatMessage(messages.viewOrderHistory) }))] }), _jsx("div", { className: "alacarte-confirmation__summary-mobile d-lg-none", children: summaryCard }), programOrder && (purchasedCourseNames.length > 0 || previouslyPurchased.length > 0) && (_jsxs("div", { className: "alacarte-confirmation__about-program mb-5", children: [_jsx("h2", { className: "alacarte-confirmation__about-title", children: formatMessage(messages.aboutProgram) }), purchasedCourseNames.length > 0 && (_jsxs(_Fragment, { children: [_jsx("h3", { className: "alacarte-confirmation__courses-included", children: formatMessage(messages.coursesIncluded, { count: programCourseTotal }) }), _jsx("ul", { className: "alacarte-confirmation__course-list mb-0", children: purchasedCourseNames.map((name) => (_jsx("li", { children: name }, name))) })] })), previouslyPurchased.length > 0 && (_jsxs("div", { className: "alacarte-confirmation__previously-purchased", "data-testid": "confirmation-previously-purchased", children: [_jsx("h3", { className: "alacarte-confirmation__previously-purchased-heading", children: formatMessage(messages.previouslyPurchased, {
|
|
89
89
|
count: previouslyPurchased.length,
|
|
90
|
-
}) }), _jsx("ul", { className: "alacarte-confirmation__course-list mb-0", children: previouslyPurchased.map((name) => (_jsx("li", { children: name }, name))) })] }))] })), _jsxs(Row, { children: [_jsxs(Col, { xs: 12, md: 7, className: "mb-4", children: [_jsx("h2", { className: "h5 font-weight-bold mb-3", children: formatMessage(messages.whatsIncluded) }), _jsxs("ul", { className: "alacarte-confirmation__benefits", children: [_jsx("li", { children: formatMessage(messages.benefit1) }), _jsx("li", { children: formatMessage(messages.benefit2) }), _jsx("li", { children: formatMessage(messages.benefit3) })] })] }), _jsxs(Col, { xs: 12, md: 5, className: "mb-4", children: [_jsxs("div", { className: "mb-3", children: [_jsx("
|
|
90
|
+
}) }), _jsx("ul", { className: "alacarte-confirmation__course-list mb-0", children: previouslyPurchased.map((name) => (_jsx("li", { children: name }, name))) })] }))] })), _jsxs(Row, { children: [_jsxs(Col, { xs: 12, md: 7, className: "mb-4", children: [_jsx("h2", { className: "h5 font-weight-bold mb-3", children: formatMessage(messages.whatsIncluded) }), _jsxs("ul", { className: "alacarte-confirmation__benefits", children: [_jsx("li", { children: formatMessage(messages.benefit1) }), _jsx("li", { children: formatMessage(messages.benefit2) }), _jsx("li", { children: formatMessage(messages.benefit3) })] })] }), _jsxs(Col, { xs: 12, md: 5, className: "mb-4", children: [_jsxs("div", { className: "mb-3", children: [_jsx("h2", { className: "alacarte-confirmation__detail-heading font-weight-bold mb-0", children: formatMessage(messages.orderNumber) }), _jsx("p", { className: "text-muted mb-0", children: order.orderNumber })] }), _jsxs("div", { children: [_jsx("h2", { className: "alacarte-confirmation__detail-heading font-weight-bold mb-0", children: formatMessage(messages.purchaseDate) }), _jsx("p", { className: "text-muted mb-0", children: purchaseDate !== null && purchaseDate !== void 0 ? purchaseDate : '' })] })] })] }), refundWindowOpen && refundBy && (_jsxs(_Fragment, { children: [_jsx("hr", { className: "alacarte-confirmation__divider" }), _jsx("p", { className: "alacarte-confirmation__refund text-muted small mb-0", children: formatMessage(messages.refundNotice, { date: refundBy }) })] }))] }), _jsx(Col, { xs: 12, lg: 5, className: "alacarte-confirmation__summary-col d-none d-lg-block", children: summaryCard })] }) }));
|
|
91
91
|
};
|
|
92
92
|
export default AlacarteConfirmation;
|
|
93
93
|
//# sourceMappingURL=AlacarteConfirmation.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AlacarteConfirmation.js","sourceRoot":"","sources":["../../../src/components/AlacarteConfirmation/AlacarteConfirmation.tsx"],"names":[],"mappings":";AAAA,OAAc,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAC;AACjE,OAAO,EAAE,KAAK,IAAI,SAAS,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACrE,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAKlE,OAAO,QAAQ,MAAM,YAAY,CAAC;AAqBlC,SAAS,aAAa,CAAC,IAAY;IACjC,OAAO,IAAI,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;AACxD,CAAC;AAED,SAAS,cAAc,CAAC,KAAkB;IACxC,OAAO,KAAK,CAAC,K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K,aAAa,CAAC,QAAQ,CAAC,QAAQ,CAAC,GAAM,IACxC,IACD,EACN,MAAC,GAAG,IAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,EAAE,SAAS,EAAC,MAAM,aAClC,eAAK,SAAS,EAAC,MAAM,aACnB,YAAG,SAAS,EAAC,uBAAuB,YACjC,aAAa,CAAC,QAAQ,CAAC,WAAW,CAAC,GAClC,EACJ,YAAG,SAAS,EAAC,iBAAiB,YAAE,KAAK,CAAC,WAAW,GAAK,IAClD,EACN,0BACE,YAAG,SAAS,EAAC,uBAAuB,YACjC,aAAa,CAAC,QAAQ,CAAC,YAAY,CAAC,GACnC,EACJ,YAAG,SAAS,EAAC,iBAAiB,YAAE,YAAY,aAAZ,YAAY,cAAZ,YAAY,GAAI,EAAE,GAAK,IACnD,IACF,IACF,EAEL,gBAAgB,IAAI,QAAQ,IAAI,CAC/B,8BACE,aAAI,SAAS,EAAC,gCAAgC,GAAG,EACjD,YAAG,SAAS,EAAC,qDAAqD,YAC/D,aAAa,CAAC,QAAQ,CAAC,YAAY,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC,GACvD,IACH,CACJ,IACG,EAEN,KAAC,GAAG,IAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,EAAE,SAAS,EAAC,sDAAsD,YACjF,WAAW,GACR,IACF,GACF,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,oBAAoB,CAAC","sourcesContent":["import React, { useMemo } from 'react';\nimport { Alert, Button, Col, Icon, Row } from '@openedx/paragon';\nimport { Error as ErrorIcon, Monitor } from '@openedx/paragon/icons';\nimport { useIntl } from '@openedx/frontend-base';\nimport { ProcessingScreen } from '../StatusScreens/StatusScreens';\nimport type { CourseDetail } from '../../types';\nimport type {\n AlacarteProgramOwnedCourse, PlacedOrder, ProductDetail, ProgramDetail,\n} from '../../types/alacarte';\nimport messages from './Messages';\n\nexport interface AlacarteConfirmationProps {\n order: PlacedOrder | null,\n awaiting: boolean,\n error: string | null,\n onContinue?: () => void,\n /** Optional catalog detail from checkout — logo / brand. */\n productDetail?: ProductDetail | null,\n /** Display title from the checkout line (course or program name). */\n productTitle?: string | null,\n /** Program member courses already owned before this order. */\n ownedCourses?: AlacarteProgramOwnedCourse[] | null,\n /** Learner order-history / dashboard URL for the secondary CTA. */\n orderHistoryUrl?: string | null,\n /** ISO timestamp the order was placed (tPlacedAt, falling back to\n * biCreatedAt). Drives both the purchase date and the refund deadline\n * (placedAt + 14 days); the refund line is hidden once that date passes. */\n placedAt?: string | null,\n}\n\nfunction normalizeName(name: string): string {\n return name.trim().toLowerCase().replace(/\\s+/g, ' ');\n}\n\nfunction isProgramOrder(order: PlacedOrder): boolean {\n return order.lines.some((line) => line.kind === 'program' || !!line.programId);\n}\n\nfunction formatPurchaseDate(locale: string, date: Date): string {\n return new Intl.DateTimeFormat(locale, {\n month: 'long',\n day: 'numeric',\n year: 'numeric',\n }).format(date);\n}\n\nfunction addDays(from: Date, days: number): Date {\n const result = new Date(from);\n result.setDate(result.getDate() + days);\n return result;\n}\n\nconst AlacarteConfirmation = ({\n order,\n awaiting,\n error,\n onContinue,\n productDetail = null,\n productTitle = null,\n ownedCourses = null,\n orderHistoryUrl = null,\n placedAt = null,\n}: AlacarteConfirmationProps) => {\n const { formatMessage, locale = 'en-US' } = useIntl();\n\n const placedAtDate = useMemo(() => {\n const parsed = placedAt ? new Date(placedAt) : null;\n return parsed && !Number.isNaN(parsed.getTime()) ? parsed : null;\n }, [placedAt]);\n\n const purchaseDate = useMemo(\n () => (placedAtDate ? formatPurchaseDate(locale, placedAtDate) : null),\n [locale, placedAtDate],\n );\n const refundDeadlineDate = useMemo(\n () => (placedAtDate ? addDays(placedAtDate, 14) : null),\n [placedAtDate],\n );\n const refundBy = useMemo(\n () => (refundDeadlineDate ? formatPurchaseDate(locale, refundDeadlineDate) : null),\n [locale, refundDeadlineDate],\n );\n const refundWindowOpen = !!refundDeadlineDate && refundDeadlineDate.getTime() >= Date.now();\n\n if (awaiting && !order) {\n return <ProcessingScreen />;\n }\n\n if (error && !order) {\n return (\n <Alert variant=\"danger\" icon={ErrorIcon}>\n {formatMessage(messages.orderLoadError, { error })}\n </Alert>\n );\n }\n\n if (!order) {\n return null;\n }\n\n const programOrder = isProgramOrder(order);\n const courseDetail = productDetail && 'maId' in productDetail\n ? (productDetail as CourseDetail)\n : null;\n const programDetail = productDetail && 'tCourses' in productDetail\n ? (productDetail as ProgramDetail)\n : null;\n\n const firstLine = order.lines[0];\n const brand = courseDetail?.tBrandText?.trim()\n || programDetail?.tCourses?.[0]?.tBrandText?.trim()\n || '';\n const baseName = productTitle\n || firstLine?.name\n || (programOrder ? 'your program' : 'your course');\n\n const productLabel = !programOrder && brand && !productTitle?.includes(brand)\n ? `${brand}: ${baseName}`\n : baseName;\n\n const orgLogo = courseDetail?.imageUrl\n || programDetail?.tCourses?.[0]?.tOrgLogoUrl\n || programDetail?.tCourses?.[0]?.imageUrl\n || null;\n\n const currency = order.totals?.currency ?? 'USD';\n // Subtotal is price less owned-course deduction (before coupon/offer discount).\n const subtotal = Math.max(\n 0,\n (order.totals?.price ?? 0) - (order.totals?.deduction ?? 0),\n );\n const discount = order.totals?.discount ?? 0;\n const paid = order.totals?.paid ?? 0;\n\n const money = (amount: number) => formatMessage(messages.moneyAmount, {\n amount: amount.toFixed(2),\n currency,\n });\n\n const purchasedCourseNames = programOrder\n ? order.lines.map((line) => line.name?.trim()).filter((name): name is string => !!name)\n : [];\n const purchasedNameSet = new Set(purchasedCourseNames.map(normalizeName));\n\n const previouslyPurchased = (ownedCourses ?? [])\n .map((c) => c.name?.trim())\n .filter((name): name is string => !!name && !purchasedNameSet.has(normalizeName(name)));\n\n const programCourseTotal = programDetail?.tCourses?.length\n ?? (purchasedCourseNames.length + previouslyPurchased.length);\n\n const summaryCard = (\n <aside\n className=\"alacarte-confirmation__summary\"\n aria-label={formatMessage(messages.purchaseSummary)}\n >\n <h2 className=\"alacarte-confirmation__summary-title font-weight-bold mb-0\">\n {formatMessage(messages.purchaseSummary)}\n </h2>\n <hr className=\"alacarte-confirmation__summary-divider\" />\n\n <div className=\"alacarte-confirmation__product d-flex align-items-start\">\n {orgLogo ? (\n <img\n src={orgLogo}\n alt=\"\"\n className=\"alacarte-confirmation__org-logo\"\n />\n ) : (\n <div\n className=\"alacarte-confirmation__org-logo alacarte-confirmation__org-logo--placeholder\"\n aria-hidden\n />\n )}\n <div>\n <span className=\"alacarte-confirmation__badge\">\n <Icon src={Monitor} className=\"alacarte-confirmation__badge-icon\" />\n {formatMessage(messages.verifiedCertificate)}\n </span>\n <p className=\"alacarte-confirmation__product-name font-weight-bold mb-0\">\n {productLabel}\n </p>\n </div>\n </div>\n\n <hr className=\"alacarte-confirmation__summary-divider\" />\n\n <div className=\"alacarte-confirmation__price-row\">\n <span>{formatMessage(messages.subtotal)}</span>\n <span>{money(subtotal)}</span>\n </div>\n {discount > 0 && (\n <div className=\"alacarte-confirmation__price-row alacarte-confirmation__price-row--discount\">\n <span>{formatMessage(messages.discountsApplied)}</span>\n <span>\n {formatMessage(messages.discountAmount, {\n amount: discount.toFixed(2),\n currency,\n })}\n </span>\n </div>\n )}\n <div className=\"alacarte-confirmation__price-row alacarte-confirmation__price-row--paid\">\n <span>{formatMessage(messages.amountPaid)}</span>\n <span>{money(paid)}</span>\n </div>\n </aside>\n );\n\n return (\n <div className=\"alacarte-confirmation\" data-testid=\"alacarte-confirmation\">\n <Row className=\"alacarte-confirmation__row\">\n <Col xs={12} lg={7} className=\"alacarte-confirmation__main\">\n <h1 className=\"alacarte-confirmation__headline font-weight-bold mb-4\">\n {formatMessage(messages.headline)}\n </h1>\n <p className=\"alacarte-confirmation__subheadline mb-4\">\n {formatMessage(\n programOrder ? messages.subheadlineProgram : messages.subheadlineCourse,\n { productLabel },\n )}\n </p>\n\n <div className=\"alacarte-confirmation__ctas d-flex align-items-center flex-wrap mb-4.5\">\n <Button\n variant=\"brand\"\n className=\"alacarte-confirmation__cta-primary\"\n onClick={onContinue}\n >\n {formatMessage(programOrder ? messages.startProgram : messages.startCourse)}\n </Button>\n {orderHistoryUrl && (\n <a href={orderHistoryUrl} className=\"alacarte-confirmation__order-history\">\n {formatMessage(messages.viewOrderHistory)}\n </a>\n )}\n </div>\n\n <div className=\"alacarte-confirmation__summary-mobile d-lg-none\">\n {summaryCard}\n </div>\n\n {programOrder && (purchasedCourseNames.length > 0 || previouslyPurchased.length > 0) && (\n <div className=\"alacarte-confirmation__about-program mb-5\">\n <h2 className=\"alacarte-confirmation__about-title\">\n {formatMessage(messages.aboutProgram)}\n </h2>\n {purchasedCourseNames.length > 0 && (\n <>\n <p className=\"alacarte-confirmation__courses-included\">\n {formatMessage(messages.coursesIncluded, { count: programCourseTotal })}\n </p>\n <ul className=\"alacarte-confirmation__course-list mb-0\">\n {purchasedCourseNames.map((name) => (\n <li key={name}>{name}</li>\n ))}\n </ul>\n </>\n )}\n {previouslyPurchased.length > 0 && (\n <div\n className=\"alacarte-confirmation__previously-purchased\"\n data-testid=\"confirmation-previously-purchased\"\n >\n <p className=\"alacarte-confirmation__previously-purchased-heading\">\n {formatMessage(messages.previouslyPurchased, {\n count: previouslyPurchased.length,\n })}\n </p>\n <ul className=\"alacarte-confirmation__course-list mb-0\">\n {previouslyPurchased.map((name) => (\n <li key={name}>{name}</li>\n ))}\n </ul>\n </div>\n )}\n </div>\n )}\n\n <Row>\n <Col xs={12} md={7} className=\"mb-4\">\n <h2 className=\"h5 font-weight-bold mb-3\">\n {formatMessage(messages.whatsIncluded)}\n </h2>\n <ul className=\"alacarte-confirmation__benefits\">\n <li>{formatMessage(messages.benefit1)}</li>\n <li>{formatMessage(messages.benefit2)}</li>\n <li>{formatMessage(messages.benefit3)}</li>\n </ul>\n </Col>\n <Col xs={12} md={5} className=\"mb-4\">\n <div className=\"mb-3\">\n <p className=\"font-weight-bold mb-0\">\n {formatMessage(messages.orderNumber)}\n </p>\n <p className=\"text-muted mb-0\">{order.orderNumber}</p>\n </div>\n <div>\n <p className=\"font-weight-bold mb-0\">\n {formatMessage(messages.purchaseDate)}\n </p>\n <p className=\"text-muted mb-0\">{purchaseDate ?? ''}</p>\n </div>\n </Col>\n </Row>\n\n {refundWindowOpen && refundBy && (\n <>\n <hr className=\"alacarte-confirmation__divider\" />\n <p className=\"alacarte-confirmation__refund text-muted small mb-0\">\n {formatMessage(messages.refundNotice, { date: refundBy })}\n </p>\n </>\n )}\n </Col>\n\n <Col xs={12} lg={5} className=\"alacarte-confirmation__summary-col d-none d-lg-block\">\n {summaryCard}\n </Col>\n </Row>\n </div>\n );\n};\n\nexport default AlacarteConfirmation;\n"]}
|
|
1
|
+
{"version":3,"file":"AlacarteConfirmation.js","sourceRoot":"","sources":["../../../src/components/AlacarteConfirmation/AlacarteConfirmation.tsx"],"names":[],"mappings":";AAAA,OAAc,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAC;AACjE,OAAO,EAAE,KAAK,IAAI,SAAS,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACrE,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAKlE,OAAO,QAAQ,MAAM,YAAY,CAAC;AAqBlC,SAAS,aAAa,CAAC,IAAY;IACjC,OAAO,IAAI,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;AACxD,CAAC;AAED,SAAS,cAAc,CAAC,KAAkB;IACxC,OAAO,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,KAAK,SAAS,IAAI,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;AACjF,CAAC;AAED,SAAS,kBAA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S,EAAC,MAAM,aACnB,aAAI,SAAS,EAAC,6DAA6D,YACxE,aAAa,CAAC,QAAQ,CAAC,WAAW,CAAC,GACjC,EACL,YAAG,SAAS,EAAC,iBAAiB,YAAE,KAAK,CAAC,WAAW,GAAK,IAClD,EACN,0BACE,aAAI,SAAS,EAAC,6DAA6D,YACxE,aAAa,CAAC,QAAQ,CAAC,YAAY,CAAC,GAClC,EACL,YAAG,SAAS,EAAC,iBAAiB,YAAE,YAAY,aAAZ,YAAY,cAAZ,YAAY,GAAI,EAAE,GAAK,IACnD,IACF,IACF,EAEL,gBAAgB,IAAI,QAAQ,IAAI,CAC/B,8BACE,aAAI,SAAS,EAAC,gCAAgC,GAAG,EACjD,YAAG,SAAS,EAAC,qDAAqD,YAC/D,aAAa,CAAC,QAAQ,CAAC,YAAY,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC,GACvD,IACH,CACJ,IACG,EAEN,KAAC,GAAG,IAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,EAAE,SAAS,EAAC,sDAAsD,YACjF,WAAW,GACR,IACF,GACF,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,oBAAoB,CAAC","sourcesContent":["import React, { useMemo } from 'react';\nimport { Alert, Button, Col, Icon, Row } from '@openedx/paragon';\nimport { Error as ErrorIcon, Monitor } from '@openedx/paragon/icons';\nimport { useIntl } from '@openedx/frontend-base';\nimport { ProcessingScreen } from '../StatusScreens/StatusScreens';\nimport type { CourseDetail } from '../../types';\nimport type {\n AlacarteProgramOwnedCourse, PlacedOrder, ProductDetail, ProgramDetail,\n} from '../../types/alacarte';\nimport messages from './Messages';\n\nexport interface AlacarteConfirmationProps {\n order: PlacedOrder | null,\n awaiting: boolean,\n error: string | null,\n onContinue?: () => void,\n /** Optional catalog detail from checkout — logo / brand. */\n productDetail?: ProductDetail | null,\n /** Display title from the checkout line (course or program name). */\n productTitle?: string | null,\n /** Program member courses already owned before this order. */\n ownedCourses?: AlacarteProgramOwnedCourse[] | null,\n /** Learner order-history / dashboard URL for the secondary CTA. */\n orderHistoryUrl?: string | null,\n /** ISO timestamp the order was placed (tPlacedAt, falling back to\n * biCreatedAt). Drives both the purchase date and the refund deadline\n * (placedAt + 14 days); the refund line is hidden once that date passes. */\n placedAt?: string | null,\n}\n\nfunction normalizeName(name: string): string {\n return name.trim().toLowerCase().replace(/\\s+/g, ' ');\n}\n\nfunction isProgramOrder(order: PlacedOrder): boolean {\n return order.lines.some((line) => line.kind === 'program' || !!line.programId);\n}\n\nfunction formatPurchaseDate(locale: string, date: Date): string {\n return new Intl.DateTimeFormat(locale, {\n month: 'long',\n day: 'numeric',\n year: 'numeric',\n }).format(date);\n}\n\nfunction addDays(from: Date, days: number): Date {\n const result = new Date(from);\n result.setDate(result.getDate() + days);\n return result;\n}\n\nconst AlacarteConfirmation = ({\n order,\n awaiting,\n error,\n onContinue,\n productDetail = null,\n productTitle = null,\n ownedCourses = null,\n orderHistoryUrl = null,\n placedAt = null,\n}: AlacarteConfirmationProps) => {\n const { formatMessage, locale = 'en-US' } = useIntl();\n\n const placedAtDate = useMemo(() => {\n const parsed = placedAt ? new Date(placedAt) : null;\n return parsed && !Number.isNaN(parsed.getTime()) ? parsed : null;\n }, [placedAt]);\n\n const purchaseDate = useMemo(\n () => (placedAtDate ? formatPurchaseDate(locale, placedAtDate) : null),\n [locale, placedAtDate],\n );\n const refundDeadlineDate = useMemo(\n () => (placedAtDate ? addDays(placedAtDate, 14) : null),\n [placedAtDate],\n );\n const refundBy = useMemo(\n () => (refundDeadlineDate ? formatPurchaseDate(locale, refundDeadlineDate) : null),\n [locale, refundDeadlineDate],\n );\n const refundWindowOpen = !!refundDeadlineDate && refundDeadlineDate.getTime() >= Date.now();\n\n if (awaiting && !order) {\n return <ProcessingScreen />;\n }\n\n if (error && !order) {\n return (\n <Alert variant=\"danger\" icon={ErrorIcon}>\n {formatMessage(messages.orderLoadError, { error })}\n </Alert>\n );\n }\n\n if (!order) {\n return null;\n }\n\n const programOrder = isProgramOrder(order);\n const courseDetail = productDetail && 'maId' in productDetail\n ? (productDetail as CourseDetail)\n : null;\n const programDetail = productDetail && 'tCourses' in productDetail\n ? (productDetail as ProgramDetail)\n : null;\n\n const firstLine = order.lines[0];\n const brand = courseDetail?.tBrandText?.trim()\n || programDetail?.tCourses?.[0]?.tBrandText?.trim()\n || '';\n const baseName = productTitle\n || firstLine?.name\n || (programOrder ? 'your program' : 'your course');\n\n const productLabel = !programOrder && brand && !productTitle?.includes(brand)\n ? `${brand}: ${baseName}`\n : baseName;\n\n const orgLogo = courseDetail?.imageUrl\n || programDetail?.tCourses?.[0]?.tOrgLogoUrl\n || programDetail?.tCourses?.[0]?.imageUrl\n || null;\n\n const currency = order.totals?.currency ?? 'USD';\n // Subtotal is price less owned-course deduction (before coupon/offer discount).\n const subtotal = Math.max(\n 0,\n (order.totals?.price ?? 0) - (order.totals?.deduction ?? 0),\n );\n const discount = order.totals?.discount ?? 0;\n const paid = order.totals?.paid ?? 0;\n\n const money = (amount: number) => formatMessage(messages.moneyAmount, {\n amount: amount.toFixed(2),\n currency,\n });\n\n const purchasedCourseNames = programOrder\n ? order.lines.map((line) => line.name?.trim()).filter((name): name is string => !!name)\n : [];\n const purchasedNameSet = new Set(purchasedCourseNames.map(normalizeName));\n\n const previouslyPurchased = (ownedCourses ?? [])\n .map((c) => c.name?.trim())\n .filter((name): name is string => !!name && !purchasedNameSet.has(normalizeName(name)));\n\n const programCourseTotal = programDetail?.tCourses?.length\n ?? (purchasedCourseNames.length + previouslyPurchased.length);\n\n const summaryCard = (\n <aside\n className=\"alacarte-confirmation__summary\"\n aria-label={formatMessage(messages.purchaseSummary)}\n >\n <h2 className=\"alacarte-confirmation__summary-title font-weight-bold mb-0\">\n {formatMessage(messages.purchaseSummary)}\n </h2>\n <hr className=\"alacarte-confirmation__summary-divider\" />\n\n <div className=\"alacarte-confirmation__product d-flex align-items-start\">\n {orgLogo ? (\n <img\n src={orgLogo}\n alt=\"\"\n className=\"alacarte-confirmation__org-logo\"\n />\n ) : (\n <div\n className=\"alacarte-confirmation__org-logo alacarte-confirmation__org-logo--placeholder\"\n aria-hidden\n />\n )}\n <div>\n <span className=\"alacarte-confirmation__badge\">\n <Icon src={Monitor} className=\"alacarte-confirmation__badge-icon\" />\n {formatMessage(messages.verifiedCertificate)}\n </span>\n <p className=\"alacarte-confirmation__product-name font-weight-bold mb-0\">\n {productLabel}\n </p>\n </div>\n </div>\n\n <hr className=\"alacarte-confirmation__summary-divider\" />\n\n <div className=\"alacarte-confirmation__price-row\">\n <span>{formatMessage(messages.subtotal)}</span>\n <span>{money(subtotal)}</span>\n </div>\n {discount > 0 && (\n <div className=\"alacarte-confirmation__price-row alacarte-confirmation__price-row--discount\">\n <span>{formatMessage(messages.discountsApplied)}</span>\n <span>\n {formatMessage(messages.discountAmount, {\n amount: discount.toFixed(2),\n currency,\n })}\n </span>\n </div>\n )}\n <div className=\"alacarte-confirmation__price-row alacarte-confirmation__price-row--paid\">\n <span>{formatMessage(messages.amountPaid)}</span>\n <span>{money(paid)}</span>\n </div>\n </aside>\n );\n\n return (\n <div className=\"alacarte-confirmation\" data-testid=\"alacarte-confirmation\">\n <Row className=\"alacarte-confirmation__row\">\n <Col xs={12} lg={7} className=\"alacarte-confirmation__main\">\n <h1 className=\"alacarte-confirmation__headline font-weight-bold mb-4\">\n {formatMessage(messages.headline)}\n </h1>\n <p className=\"alacarte-confirmation__subheadline mb-4\">\n {formatMessage(\n programOrder ? messages.subheadlineProgram : messages.subheadlineCourse,\n { productLabel },\n )}\n </p>\n\n <div className=\"alacarte-confirmation__ctas d-flex align-items-center flex-wrap mb-4.5\">\n <Button\n variant=\"brand\"\n className=\"alacarte-confirmation__cta-primary\"\n onClick={onContinue}\n >\n {formatMessage(programOrder ? messages.startProgram : messages.startCourse)}\n </Button>\n {orderHistoryUrl && (\n <a href={orderHistoryUrl} className=\"alacarte-confirmation__order-history\">\n {formatMessage(messages.viewOrderHistory)}\n </a>\n )}\n </div>\n\n <div className=\"alacarte-confirmation__summary-mobile d-lg-none\">\n {summaryCard}\n </div>\n\n {programOrder && (purchasedCourseNames.length > 0 || previouslyPurchased.length > 0) && (\n <div className=\"alacarte-confirmation__about-program mb-5\">\n <h2 className=\"alacarte-confirmation__about-title\">\n {formatMessage(messages.aboutProgram)}\n </h2>\n {purchasedCourseNames.length > 0 && (\n <>\n <h3 className=\"alacarte-confirmation__courses-included\">\n {formatMessage(messages.coursesIncluded, { count: programCourseTotal })}\n </h3>\n <ul className=\"alacarte-confirmation__course-list mb-0\">\n {purchasedCourseNames.map((name) => (\n <li key={name}>{name}</li>\n ))}\n </ul>\n </>\n )}\n {previouslyPurchased.length > 0 && (\n <div\n className=\"alacarte-confirmation__previously-purchased\"\n data-testid=\"confirmation-previously-purchased\"\n >\n <h3 className=\"alacarte-confirmation__previously-purchased-heading\">\n {formatMessage(messages.previouslyPurchased, {\n count: previouslyPurchased.length,\n })}\n </h3>\n <ul className=\"alacarte-confirmation__course-list mb-0\">\n {previouslyPurchased.map((name) => (\n <li key={name}>{name}</li>\n ))}\n </ul>\n </div>\n )}\n </div>\n )}\n\n <Row>\n <Col xs={12} md={7} className=\"mb-4\">\n <h2 className=\"h5 font-weight-bold mb-3\">\n {formatMessage(messages.whatsIncluded)}\n </h2>\n <ul className=\"alacarte-confirmation__benefits\">\n <li>{formatMessage(messages.benefit1)}</li>\n <li>{formatMessage(messages.benefit2)}</li>\n <li>{formatMessage(messages.benefit3)}</li>\n </ul>\n </Col>\n <Col xs={12} md={5} className=\"mb-4\">\n <div className=\"mb-3\">\n <h2 className=\"alacarte-confirmation__detail-heading font-weight-bold mb-0\">\n {formatMessage(messages.orderNumber)}\n </h2>\n <p className=\"text-muted mb-0\">{order.orderNumber}</p>\n </div>\n <div>\n <h2 className=\"alacarte-confirmation__detail-heading font-weight-bold mb-0\">\n {formatMessage(messages.purchaseDate)}\n </h2>\n <p className=\"text-muted mb-0\">{purchaseDate ?? ''}</p>\n </div>\n </Col>\n </Row>\n\n {refundWindowOpen && refundBy && (\n <>\n <hr className=\"alacarte-confirmation__divider\" />\n <p className=\"alacarte-confirmation__refund text-muted small mb-0\">\n {formatMessage(messages.refundNotice, { date: refundBy })}\n </p>\n </>\n )}\n </Col>\n\n <Col xs={12} lg={5} className=\"alacarte-confirmation__summary-col d-none d-lg-block\">\n {summaryCard}\n </Col>\n </Row>\n </div>\n );\n};\n\nexport default AlacarteConfirmation;\n"]}
|
|
@@ -48,7 +48,7 @@ const CartSummary = ({ productTitle, productBlurb, learnerCount: learnerCountPro
|
|
|
48
48
|
.filter(Boolean)
|
|
49
49
|
.join(', ');
|
|
50
50
|
const discount = (_g = alacarteLine === null || alacarteLine === void 0 ? void 0 : alacarteLine.discount) !== null && _g !== void 0 ? _g : null;
|
|
51
|
-
return (_jsxs("div", { className: "cart-summary ", children: [_jsxs(Card, { className: "cart-summary__card p-3", children: [_jsxs(Card.Section, { className: "d-flex justify-content-between align-items-center p-0 pb-3", children: [_jsx("
|
|
51
|
+
return (_jsxs("div", { className: "cart-summary ", children: [_jsxs(Card, { className: "cart-summary__card p-3", children: [_jsxs(Card.Section, { className: "d-flex justify-content-between align-items-center p-0 pb-3", children: [_jsx("h2", { className: "cart-summary__heading font-weight-bold text-gray-900 mb-0", children: formatMessage(messages.summaryHeading) }), _jsxs(Badge, { variant: "light", className: "d-flex align-items-center px-2 py-1", children: [_jsx(Icon, { src: Group, className: "mr-1", style: { width: '1rem', height: '1rem' } }), subscriberCount == null ? (_jsx("span", { className: "cart-summary__count-skeleton", "aria-busy": "true", "aria-label": formatMessage(messages.loadingSubscribers), "data-testid": "subscriber-count-skeleton", children: _jsx(Skeleton, { width: 96, height: 12 }) })) : (formatMessage(messages.learnersSubscribed, {
|
|
52
52
|
count: subscriberCount.toLocaleString(),
|
|
53
53
|
}))] })] }), _jsx(Card.Divider, {}), _jsxs(Card.Section, { className: "p-0 py-3", children: [course ? (_jsx(CourseEnrollmentCard, { course: course, variant: "summary" })) : programDetail ? (_jsx(ProgramEnrollmentCard, { program: programDetail, programName: lineName !== null && lineName !== void 0 ? lineName : '', ownedCourses: ownedCourses })) : lineName ? (_jsx("p", { className: "font-weight-bold mb-0 text-primary-500", children: lineName })) : (_jsxs("div", { className: "d-flex align-items-start", children: [_jsx(EdxUnlimitedLogo, { ariaLabel: "edX Plus" }), _jsxs("div", { children: [_jsx("p", { className: "font-weight-bold mb-0 text-primary-500", children: title }), _jsx("p", { className: "small mb-0 text-gray-900", children: blurb })] })] })), !programDetail && ownedCourseNames && (_jsx("p", { className: "cart-summary__already-yours small text-gray-700 mb-0 mt-2", "data-testid": "already-yours", children: formatMessage(messages.alreadyYours, { names: ownedCourseNames }) }))] }), _jsx(Card.Divider, {}), _jsxs(Card.Section, { className: "cart-summary__subtotal-row d-flex justify-content-between align-items-center p-0 pt-3", children: [_jsx("span", { className: "cart-summary__subtotal text-gray-900", children: formatMessage(messages.subtotal) }), _jsx("span", { className: "cart-summary__subtotal text-gray-900", children: subtotalText })] }), discount && (_jsxs(Card.Section, { className: "d-flex justify-content-between align-items-center p-0", "data-testid": "discount-row", children: [_jsx("span", { className: "text-success font-weight-bold", children: formatMessage(messages.discountApplied) }), _jsx("span", { className: "text-success font-weight-bold", children: formatMessage(messages.discountAmount, {
|
|
54
54
|
amount: discount.amount.toFixed(2),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CartSummary.js","sourceRoot":"","sources":["../../../src/components/CartSummary/CartSummary.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC/D,OAAO,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAC;AAC/C,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,oBAAoB,MAAM,8CAA8C,CAAC;AAChF,OAAO,q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,CAAC,QAAQ;iCAC5B,CAAC,GACG,IACM,CAChB,EAED,MAAC,IAAI,CAAC,OAAO,IAAC,SAAS,EAAC,uDAAuD,aAC7E,eAAM,SAAS,EAAC,yCAAyC,YACtD,aAAa,CAAC,QAAQ,CAAC,WAAW,CAAC,GAC/B,EACP,eAAM,SAAS,EAAC,8CAA8C,YAC3D,SAAS,GACL,IACM,IACV,EAEN,SAAS,CAAC,CAAC,CAAC,KAAC,SAAS,oBAAK,SAAS,EAAI,CAAC,CAAC,CAAC,IAAI,EAGhD,eAAK,SAAS,EAAC,sCAAsC,aACnD,eAAK,SAAS,EAAC,mDAAmD,aAChE,cAAK,GAAG,EAAE,YAAY,EAAE,GAAG,EAAC,EAAE,EAAC,KAAK,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,SAAS,EAAC,MAAM,GAAG,EACzE,0BACE,YAAG,SAAS,EAAC,8DAA8D,YACxE,aAAa,CAAC,QAAQ,CAAC,aAAa,CAAC,GACpC,EACJ,YAAG,SAAS,EAAC,6CAA6C,YACvD,aAAa,CAAC,QAAQ,CAAC,aAAa,CAAC,GACpC,IACA,IACF,EACN,eAAK,SAAS,EAAC,8CAA8C,aAC3D,cAAK,GAAG,EAAE,gBAAgB,EAAE,GAAG,EAAC,EAAE,EAAC,KAAK,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,SAAS,EAAC,MAAM,GAAG,EAC7E,0BACE,YAAG,SAAS,EAAC,8DAA8D,YACxE,aAAa,CAAC,QAAQ,CAAC,iBAAiB,CAAC,GACxC,EACJ,YAAG,SAAS,EAAC,6CAA6C,YACvD,aAAa,CAAC,QAAQ,CAAC,iBAAiB,CAAC,GACxC,IACA,IACF,IACF,IACF,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,WAAW,CAAC","sourcesContent":["import React from 'react';\nimport { Badge, Card, Icon, Skeleton } from '@openedx/paragon';\nimport { Group } from '@openedx/paragon/icons';\nimport { useIntl } from '@openedx/frontend-base';\nimport { EdxUnlimitedLogo } from '../BrandMarks/BrandMarks';\nimport CourseEnrollmentCard from '../CourseEnrollmentCard/CourseEnrollmentCard';\nimport ProgramEnrollmentCard from '../ProgramEnrollmentCard/ProgramEnrollmentCard';\nimport PromoCode from '../PromoCode/PromoCode';\nimport type { PromoCodeProps } from '../PromoCode/PromoCode';\nimport type { CourseDetail } from '../../types';\nimport type { AlacarteLine, ProgramDetail } from '../../types/alacarte';\nimport messages from './Messages';\nimport learnersIcon from './world-icon.svg';\nimport institutionsIcon from './student-icon.svg';\n\nexport type BillingCycle = 'monthly' | 'annual';\n\nexport interface CartSummaryProps {\n productTitle?: string,\n productBlurb?: string,\n /** Promotional monthly price amount e.g. \"39\" */\n monthlyAmount?: string,\n /** Regular monthly price after the promo period e.g. \"59\" */\n monthlyRegularAmount?: string,\n /** Length of the promotional period in months */\n promoMonths?: number,\n /** Annual price amount e.g. \"299\" */\n annualAmount?: string,\n currency?: string,\n defaultCycle?: BillingCycle,\n monthlyRenewalLabel?: string,\n annualRenewalLabel?: string,\n /** Called when the learner switches monthly ↔ annual. */\n onCycleChange?: (cycle: BillingCycle) => void,\n learnerCount?: number,\n /** When set, shows the course enrollment preview card below the summary card. */\n course?: CourseDetail | null,\n /** À la carte checkout line — when present, drives the subtotal/total and\n * the product name shown, in place of the generic edX Plus placeholder. */\n alacarteLine?: AlacarteLine | null,\n /** Program catalog detail (filterTwouProgram) — when present, drives the\n * \"Courses included in this program\" list. */\n programDetail?: ProgramDetail | null,\n /** Fallback program name — used when there is no alacarteLine to provide it\n * (e.g. already-owned overlay). */\n programName?: string | null,\n /** Coupon input — when set, wires PromoCode to tCheckoutUpdate. */\n promoCode?: PromoCodeProps | null,\n}\n\nconst CartSummary = ({\n productTitle,\n productBlurb,\n learnerCount: learnerCountProp,\n course = null,\n alacarteLine = null,\n programDetail = null,\n programName: programNameProp = null,\n promoCode = null,\n}: CartSummaryProps) => {\n const { formatMessage } = useIntl();\n const title = productTitle ?? formatMessage(messages.productTitle);\n const blurb = productBlurb ?? formatMessage(messages.productBlurb);\n\n // Prefer the product's own enrollment count (course or program catalog field).\n const isProgramLine = alacarteLine?.kind === 'program';\n const subscriberCount = course?.tEnrollmentCount\n ?? programDetail?.tEnrollmentCount\n ?? learnerCountProp\n ?? null;\n\n // No fallback amount — an unresolved à la carte line means we don't know\n // the price yet, so the row is left blank rather than showing a made-up\n // number that could be mistaken for the real one.\n // Program subtotal is price less owned-course deduction (before coupon/discount).\n const deductionAmount = isProgramLine && alacarteLine.kind === 'program'\n ? (alacarteLine.deduction?.amount ?? 0)\n : 0;\n const subtotalAmount = alacarteLine?.price\n ? Math.max(0, alacarteLine.price.amount - deductionAmount)\n : null;\n const subtotalText = subtotalAmount != null && alacarteLine?.price\n ? formatMessage(messages.subtotalAmount, {\n amount: subtotalAmount.toFixed(2), currency: alacarteLine.price.currency,\n })\n : '';\n const totalText = alacarteLine?.amountDue\n ? formatMessage(messages.todaysTotalValue, {\n amount: alacarteLine.amountDue.amount.toFixed(2), currency: alacarteLine.amountDue.currency,\n })\n : '';\n\n const lineName = alacarteLine\n ? (alacarteLine.kind === 'course' ? alacarteLine.courseName : alacarteLine.programName)\n : programNameProp;\n\n const ownedCourses = isProgramLine && alacarteLine.kind === 'program'\n ? (alacarteLine.ownedCourses ?? [])\n : [];\n const ownedCourseNames = ownedCourses\n .map((c) => c.name)\n .filter(Boolean)\n .join(', ');\n const discount = alacarteLine?.discount ?? null;\n\n return (\n <div className=\"cart-summary \">\n <Card className=\"cart-summary__card p-3\">\n <Card.Section className=\"d-flex justify-content-between align-items-center p-0 pb-3\">\n <span className=\"font-weight-bold text-gray-900\">\n {formatMessage(messages.summaryHeading)}\n </span>\n <Badge\n variant=\"light\"\n className=\"d-flex align-items-center px-2 py-1\"\n >\n <Icon\n src={Group}\n className=\"mr-1\"\n style={{ width: '1rem', height: '1rem' }}\n />\n {subscriberCount == null ? (\n <span\n className=\"cart-summary__count-skeleton\"\n aria-busy=\"true\"\n aria-label={formatMessage(messages.loadingSubscribers)}\n data-testid=\"subscriber-count-skeleton\"\n >\n <Skeleton width={96} height={12} />\n </span>\n ) : (\n formatMessage(messages.learnersSubscribed, {\n count: subscriberCount.toLocaleString(),\n })\n )}\n </Badge>\n </Card.Section>\n\n <Card.Divider />\n\n <Card.Section className=\"p-0 py-3\">\n {course ? (\n <CourseEnrollmentCard course={course} variant=\"summary\" />\n ) : programDetail ? (\n <ProgramEnrollmentCard\n program={programDetail}\n programName={lineName ?? ''}\n ownedCourses={ownedCourses}\n />\n ) : lineName ? (\n <p className=\"font-weight-bold mb-0 text-primary-500\">{lineName}</p>\n ) : (\n <div className=\"d-flex align-items-start\">\n <EdxUnlimitedLogo ariaLabel=\"edX Plus\" />\n <div>\n <p className=\"font-weight-bold mb-0 text-primary-500\">{title}</p>\n <p className=\"small mb-0 text-gray-900\">{blurb}</p>\n </div>\n </div>\n )}\n {/* Fallback when catalog detail hasn't loaded yet — once it has,\n owned courses are listed under \"Previously purchased\" in the card. */}\n {!programDetail && ownedCourseNames && (\n <p\n className=\"cart-summary__already-yours small text-gray-700 mb-0 mt-2\"\n data-testid=\"already-yours\"\n >\n {formatMessage(messages.alreadyYours, { names: ownedCourseNames })}\n </p>\n )}\n </Card.Section>\n\n <Card.Divider />\n\n <Card.Section className=\"cart-summary__subtotal-row d-flex justify-content-between align-items-center p-0 pt-3\">\n <span className=\"cart-summary__subtotal text-gray-900\">\n {formatMessage(messages.subtotal)}\n </span>\n <span className=\"cart-summary__subtotal text-gray-900\">\n {subtotalText}\n </span>\n </Card.Section>\n\n {discount && (\n <Card.Section\n className=\"d-flex justify-content-between align-items-center p-0\"\n data-testid=\"discount-row\"\n >\n <span className=\"text-success font-weight-bold\">\n {formatMessage(messages.discountApplied)}\n </span>\n <span className=\"text-success font-weight-bold\">\n {formatMessage(messages.discountAmount, {\n amount: discount.amount.toFixed(2),\n currency: discount.currency,\n })}\n </span>\n </Card.Section>\n )}\n\n <Card.Section className=\"d-flex justify-content-between align-items-center p-0\">\n <span className=\"cart-summary__total-label text-gray-900\">\n {formatMessage(messages.todaysTotal)}\n </span>\n <span className=\"cart-summary__total-value mb-0 text-gray-900\">\n {totalText}\n </span>\n </Card.Section>\n </Card>\n\n {promoCode ? <PromoCode {...promoCode} /> : null}\n\n {/* Stats row */}\n <div className=\"cart-summary__stats d-none d-lg-flex\">\n <div className=\"cart-summary__stat d-flex align-items-center mr-4\">\n <img src={learnersIcon} alt=\"\" width={50} height={50} className=\"mr-2\" />\n <div>\n <p className=\"cart-summary__stat-count font-weight-bold text-gray-500 mb-0\">\n {formatMessage(messages.learnersCount)}\n </p>\n <p className=\"cart-summary__stat-label text-gray-500 mb-0\">\n {formatMessage(messages.learnersLabel)}\n </p>\n </div>\n </div>\n <div className=\"cart-summary__stat d-flex align-items-center\">\n <img src={institutionsIcon} alt=\"\" width={50} height={50} className=\"mr-2\" />\n <div>\n <p className=\"cart-summary__stat-count font-weight-bold text-gray-500 mb-0\">\n {formatMessage(messages.institutionsCount)}\n </p>\n <p className=\"cart-summary__stat-label text-gray-500 mb-0\">\n {formatMessage(messages.institutionsLabel)}\n </p>\n </div>\n </div>\n </div>\n </div>\n );\n};\n\nexport default CartSummary;\n"]}
|
|
1
|
+
{"version":3,"file":"CartSummary.js","sourceRoot":"","sources":["../../../src/components/CartSummary/CartSummary.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC/D,OAAO,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAC;AAC/C,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,oBAAoB,MAAM,8CAA8C,CAAC;AAChF,OAAO,qBAAqB,MAAM,gDAAgD,CAAC;AACnF,OAAO,SAAS,MAAM,wBAAwB,CAAC;AAI/C,OAAO,QAAQ,MAA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uDAAuD,aAC7E,eAAM,SAAS,EAAC,yCAAyC,YACtD,aAAa,CAAC,QAAQ,CAAC,WAAW,CAAC,GAC/B,EACP,eAAM,SAAS,EAAC,8CAA8C,YAC3D,SAAS,GACL,IACM,IACV,EAEN,SAAS,CAAC,CAAC,CAAC,KAAC,SAAS,oBAAK,SAAS,EAAI,CAAC,CAAC,CAAC,IAAI,EAGhD,eAAK,SAAS,EAAC,sCAAsC,aACnD,eAAK,SAAS,EAAC,mDAAmD,aAChE,cAAK,GAAG,EAAE,YAAY,EAAE,GAAG,EAAC,EAAE,EAAC,KAAK,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,SAAS,EAAC,MAAM,GAAG,EACzE,0BACE,YAAG,SAAS,EAAC,8DAA8D,YACxE,aAAa,CAAC,QAAQ,CAAC,aAAa,CAAC,GACpC,EACJ,YAAG,SAAS,EAAC,6CAA6C,YACvD,aAAa,CAAC,QAAQ,CAAC,aAAa,CAAC,GACpC,IACA,IACF,EACN,eAAK,SAAS,EAAC,8CAA8C,aAC3D,cAAK,GAAG,EAAE,gBAAgB,EAAE,GAAG,EAAC,EAAE,EAAC,KAAK,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,SAAS,EAAC,MAAM,GAAG,EAC7E,0BACE,YAAG,SAAS,EAAC,8DAA8D,YACxE,aAAa,CAAC,QAAQ,CAAC,iBAAiB,CAAC,GACxC,EACJ,YAAG,SAAS,EAAC,6CAA6C,YACvD,aAAa,CAAC,QAAQ,CAAC,iBAAiB,CAAC,GACxC,IACA,IACF,IACF,IACF,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,WAAW,CAAC","sourcesContent":["import React from 'react';\nimport { Badge, Card, Icon, Skeleton } from '@openedx/paragon';\nimport { Group } from '@openedx/paragon/icons';\nimport { useIntl } from '@openedx/frontend-base';\nimport { EdxUnlimitedLogo } from '../BrandMarks/BrandMarks';\nimport CourseEnrollmentCard from '../CourseEnrollmentCard/CourseEnrollmentCard';\nimport ProgramEnrollmentCard from '../ProgramEnrollmentCard/ProgramEnrollmentCard';\nimport PromoCode from '../PromoCode/PromoCode';\nimport type { PromoCodeProps } from '../PromoCode/PromoCode';\nimport type { CourseDetail } from '../../types';\nimport type { AlacarteLine, ProgramDetail } from '../../types/alacarte';\nimport messages from './Messages';\nimport learnersIcon from './world-icon.svg';\nimport institutionsIcon from './student-icon.svg';\n\nexport type BillingCycle = 'monthly' | 'annual';\n\nexport interface CartSummaryProps {\n productTitle?: string,\n productBlurb?: string,\n /** Promotional monthly price amount e.g. \"39\" */\n monthlyAmount?: string,\n /** Regular monthly price after the promo period e.g. \"59\" */\n monthlyRegularAmount?: string,\n /** Length of the promotional period in months */\n promoMonths?: number,\n /** Annual price amount e.g. \"299\" */\n annualAmount?: string,\n currency?: string,\n defaultCycle?: BillingCycle,\n monthlyRenewalLabel?: string,\n annualRenewalLabel?: string,\n /** Called when the learner switches monthly ↔ annual. */\n onCycleChange?: (cycle: BillingCycle) => void,\n learnerCount?: number,\n /** When set, shows the course enrollment preview card below the summary card. */\n course?: CourseDetail | null,\n /** À la carte checkout line — when present, drives the subtotal/total and\n * the product name shown, in place of the generic edX Plus placeholder. */\n alacarteLine?: AlacarteLine | null,\n /** Program catalog detail (filterTwouProgram) — when present, drives the\n * \"Courses included in this program\" list. */\n programDetail?: ProgramDetail | null,\n /** Fallback program name — used when there is no alacarteLine to provide it\n * (e.g. already-owned overlay). */\n programName?: string | null,\n /** Coupon input — when set, wires PromoCode to tCheckoutUpdate. */\n promoCode?: PromoCodeProps | null,\n}\n\nconst CartSummary = ({\n productTitle,\n productBlurb,\n learnerCount: learnerCountProp,\n course = null,\n alacarteLine = null,\n programDetail = null,\n programName: programNameProp = null,\n promoCode = null,\n}: CartSummaryProps) => {\n const { formatMessage } = useIntl();\n const title = productTitle ?? formatMessage(messages.productTitle);\n const blurb = productBlurb ?? formatMessage(messages.productBlurb);\n\n // Prefer the product's own enrollment count (course or program catalog field).\n const isProgramLine = alacarteLine?.kind === 'program';\n const subscriberCount = course?.tEnrollmentCount\n ?? programDetail?.tEnrollmentCount\n ?? learnerCountProp\n ?? null;\n\n // No fallback amount — an unresolved à la carte line means we don't know\n // the price yet, so the row is left blank rather than showing a made-up\n // number that could be mistaken for the real one.\n // Program subtotal is price less owned-course deduction (before coupon/discount).\n const deductionAmount = isProgramLine && alacarteLine.kind === 'program'\n ? (alacarteLine.deduction?.amount ?? 0)\n : 0;\n const subtotalAmount = alacarteLine?.price\n ? Math.max(0, alacarteLine.price.amount - deductionAmount)\n : null;\n const subtotalText = subtotalAmount != null && alacarteLine?.price\n ? formatMessage(messages.subtotalAmount, {\n amount: subtotalAmount.toFixed(2), currency: alacarteLine.price.currency,\n })\n : '';\n const totalText = alacarteLine?.amountDue\n ? formatMessage(messages.todaysTotalValue, {\n amount: alacarteLine.amountDue.amount.toFixed(2), currency: alacarteLine.amountDue.currency,\n })\n : '';\n\n const lineName = alacarteLine\n ? (alacarteLine.kind === 'course' ? alacarteLine.courseName : alacarteLine.programName)\n : programNameProp;\n\n const ownedCourses = isProgramLine && alacarteLine.kind === 'program'\n ? (alacarteLine.ownedCourses ?? [])\n : [];\n const ownedCourseNames = ownedCourses\n .map((c) => c.name)\n .filter(Boolean)\n .join(', ');\n const discount = alacarteLine?.discount ?? null;\n\n return (\n <div className=\"cart-summary \">\n <Card className=\"cart-summary__card p-3\">\n <Card.Section className=\"d-flex justify-content-between align-items-center p-0 pb-3\">\n <h2 className=\"cart-summary__heading font-weight-bold text-gray-900 mb-0\">\n {formatMessage(messages.summaryHeading)}\n </h2>\n <Badge\n variant=\"light\"\n className=\"d-flex align-items-center px-2 py-1\"\n >\n <Icon\n src={Group}\n className=\"mr-1\"\n style={{ width: '1rem', height: '1rem' }}\n />\n {subscriberCount == null ? (\n <span\n className=\"cart-summary__count-skeleton\"\n aria-busy=\"true\"\n aria-label={formatMessage(messages.loadingSubscribers)}\n data-testid=\"subscriber-count-skeleton\"\n >\n <Skeleton width={96} height={12} />\n </span>\n ) : (\n formatMessage(messages.learnersSubscribed, {\n count: subscriberCount.toLocaleString(),\n })\n )}\n </Badge>\n </Card.Section>\n\n <Card.Divider />\n\n <Card.Section className=\"p-0 py-3\">\n {course ? (\n <CourseEnrollmentCard course={course} variant=\"summary\" />\n ) : programDetail ? (\n <ProgramEnrollmentCard\n program={programDetail}\n programName={lineName ?? ''}\n ownedCourses={ownedCourses}\n />\n ) : lineName ? (\n <p className=\"font-weight-bold mb-0 text-primary-500\">{lineName}</p>\n ) : (\n <div className=\"d-flex align-items-start\">\n <EdxUnlimitedLogo ariaLabel=\"edX Plus\" />\n <div>\n <p className=\"font-weight-bold mb-0 text-primary-500\">{title}</p>\n <p className=\"small mb-0 text-gray-900\">{blurb}</p>\n </div>\n </div>\n )}\n {/* Fallback when catalog detail hasn't loaded yet — once it has,\n owned courses are listed under \"Previously purchased\" in the card. */}\n {!programDetail && ownedCourseNames && (\n <p\n className=\"cart-summary__already-yours small text-gray-700 mb-0 mt-2\"\n data-testid=\"already-yours\"\n >\n {formatMessage(messages.alreadyYours, { names: ownedCourseNames })}\n </p>\n )}\n </Card.Section>\n\n <Card.Divider />\n\n <Card.Section className=\"cart-summary__subtotal-row d-flex justify-content-between align-items-center p-0 pt-3\">\n <span className=\"cart-summary__subtotal text-gray-900\">\n {formatMessage(messages.subtotal)}\n </span>\n <span className=\"cart-summary__subtotal text-gray-900\">\n {subtotalText}\n </span>\n </Card.Section>\n\n {discount && (\n <Card.Section\n className=\"d-flex justify-content-between align-items-center p-0\"\n data-testid=\"discount-row\"\n >\n <span className=\"text-success font-weight-bold\">\n {formatMessage(messages.discountApplied)}\n </span>\n <span className=\"text-success font-weight-bold\">\n {formatMessage(messages.discountAmount, {\n amount: discount.amount.toFixed(2),\n currency: discount.currency,\n })}\n </span>\n </Card.Section>\n )}\n\n <Card.Section className=\"d-flex justify-content-between align-items-center p-0\">\n <span className=\"cart-summary__total-label text-gray-900\">\n {formatMessage(messages.todaysTotal)}\n </span>\n <span className=\"cart-summary__total-value mb-0 text-gray-900\">\n {totalText}\n </span>\n </Card.Section>\n </Card>\n\n {promoCode ? <PromoCode {...promoCode} /> : null}\n\n {/* Stats row */}\n <div className=\"cart-summary__stats d-none d-lg-flex\">\n <div className=\"cart-summary__stat d-flex align-items-center mr-4\">\n <img src={learnersIcon} alt=\"\" width={50} height={50} className=\"mr-2\" />\n <div>\n <p className=\"cart-summary__stat-count font-weight-bold text-gray-500 mb-0\">\n {formatMessage(messages.learnersCount)}\n </p>\n <p className=\"cart-summary__stat-label text-gray-500 mb-0\">\n {formatMessage(messages.learnersLabel)}\n </p>\n </div>\n </div>\n <div className=\"cart-summary__stat d-flex align-items-center\">\n <img src={institutionsIcon} alt=\"\" width={50} height={50} className=\"mr-2\" />\n <div>\n <p className=\"cart-summary__stat-count font-weight-bold text-gray-500 mb-0\">\n {formatMessage(messages.institutionsCount)}\n </p>\n <p className=\"cart-summary__stat-label text-gray-500 mb-0\">\n {formatMessage(messages.institutionsLabel)}\n </p>\n </div>\n </div>\n </div>\n </div>\n );\n};\n\nexport default CartSummary;\n"]}
|
|
@@ -37,7 +37,7 @@ const CheckoutGate = (_a) => {
|
|
|
37
37
|
if (gateStatus === 'blocked') {
|
|
38
38
|
return (_jsx(_Fragment, { children: _jsx(CountryUnavailableModal, { isOpen: true, homeUrl: homeUrl }) }));
|
|
39
39
|
}
|
|
40
|
-
return (_jsx(Checkout, Object.assign({}, checkoutProps, { userCountry: userCountry, homeUrl: homeUrl, orderHistoryUrl:
|
|
40
|
+
return (_jsx(Checkout, Object.assign({}, checkoutProps, { userCountry: userCountry, homeUrl: homeUrl, orderHistoryUrl: "/aca-order-history" })));
|
|
41
41
|
};
|
|
42
42
|
export default CheckoutGate;
|
|
43
43
|
//# sourceMappingURL=CheckoutGate.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CheckoutGate.js","sourceRoot":"","sources":["../../../src/components/CheckoutGate/CheckoutGate.tsx"],"names":[],"mappings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AI,UAAU,KAAK,SAAS,EAAE,CAAC;QAC7B,OAAO,CACL,cAAK,SAAS,EAAC,mBAAmB,EAAC,IAAI,EAAC,QAAQ,eAAW,QAAQ,YACjE,KAAC,OAAO,IAAC,SAAS,EAAC,QAAQ,EAAC,gBAAgB,EAAC,6BAAwB,GAAG,GACpE,CACP,CAAC;IACJ,CAAC;IAED,IAAI,UAAU,KAAK,OAAO,EAAE,CAAC;QAC3B,OAAO,CACL,MAAC,KAAK,IAAC,OAAO,EAAC,QAAQ,EAAC,IAAI,EAAE,SAAS,aACpC,WAAW,aAAX,WAAW,cAAX,WAAW,GACT,aAAa,CAAC,QAAQ,CAAC,mBAAmB,CAAC,EAAE,GAAG,EAClD,mBAAmB,IAAI,CACtB,YAAG,IAAI,EAAE,mBAAmB,EAAE,SAAS,EAAC,YAAY,6CAEhD,CACL,IACK,CACT,CAAC;IACJ,CAAC;IAED,IAAI,UAAU,KAAK,SAAS,EAAE,CAAC;QAC7B,OAAO,CACL,4BACE,KAAC,uBAAuB,IAAC,MAAM,QAAC,OAAO,EAAE,OAAO,GAAI,GACnD,CACJ,CAAC;IACJ,CAAC;IACD,OAAO,CACL,KAAC,QAAQ,oBACH,aAAa,IACjB,WAAW,EAAE,WAAW,EACxB,OAAO,EAAE,OAAO,EAChB,eAAe,EAAC,oBAAoB,IACpC,CACH,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,YAAY,CAAC","sourcesContent":["import { Alert, Spinner } from '@openedx/paragon';\nimport { Error as ErrorIcon } from '@openedx/paragon/icons';\nimport { useIntl } from '@openedx/frontend-base';\nimport { useCheckoutGate } from '../../data/hooks/useCheckoutGate';\nimport Checkout from '../Checkout/Checkout';\nimport CountryUnavailableModal from '../CountryUnavailableModal/CountryUnavailableModal';\nimport type { CheckoutProps } from '../Checkout/Checkout';\nimport messages from './Messages';\n\nexport interface CheckoutGateProps extends CheckoutProps {\n /** URL linked in session-error recovery messaging. */\n learnerDashboardUrl?: string,\n /** Homepage URL for the country-unavailable modal CTA. */\n homeUrl?: string,\n /** ALC-307 compliance-check endpoint — decides whether the learner is embargoed. */\n complianceCheckUrl?: string,\n /** When true, skip the compliance-check request. */\n disableComplianceCheck?: boolean,\n}\n\nconst CheckoutGate = ({\n learnerDashboardUrl,\n homeUrl = '/',\n complianceCheckUrl,\n disableComplianceCheck,\n ...checkoutProps\n}: CheckoutGateProps) => {\n const { formatMessage } = useIntl();\n const { gateStatus, userCountry, gateMessage } = useCheckoutGate({\n apiUrl: checkoutProps.apiUrl,\n edxSessionUrl: checkoutProps.edxSessionUrl,\n geolocationUrl: checkoutProps.geolocationUrl,\n complianceCheckUrl,\n disableComplianceCheck,\n learnerDashboardUrl,\n });\n\n if (gateStatus === 'loading') {\n return (\n <div className=\"processing-screen\" role=\"status\" aria-live=\"polite\">\n <Spinner animation=\"border\" screenReaderText=\"Checking your account…\" />\n </div>\n );\n }\n\n if (gateStatus === 'error') {\n return (\n <Alert variant=\"danger\" icon={ErrorIcon}>\n {gateMessage\n ?? formatMessage(messages.defaultErrorMessage)}{' '}\n {learnerDashboardUrl && (\n <a href={learnerDashboardUrl} className=\"alert-link\">\n Go to your learner dashboard\n </a>\n )}\n </Alert>\n );\n }\n\n if (gateStatus === 'blocked') {\n return (\n <>\n <CountryUnavailableModal isOpen homeUrl={homeUrl} />\n </>\n );\n }\n return (\n <Checkout\n {...checkoutProps}\n userCountry={userCountry}\n homeUrl={homeUrl}\n orderHistoryUrl=\"/aca-order-history\"\n />\n );\n};\n\nexport default CheckoutGate;\n"]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Link } from 'react-router-dom';
|
|
3
|
+
import { useIntl } from '@openedx/frontend-base';
|
|
4
|
+
import messages from './messages';
|
|
5
|
+
import { LEARNER_HELP_CENTER_URL } from '../../constants';
|
|
6
|
+
import Icon from '@openedx/paragon/dist/Icon';
|
|
7
|
+
import { Launch } from '@openedx/paragon/icons';
|
|
8
|
+
const HelpCenter = () => {
|
|
9
|
+
const { formatMessage } = useIntl();
|
|
10
|
+
return (_jsx("div", { className: "manage-help mt-5 pt-4 border-top", children: _jsxs("p", { className: "manage-help__text text-gray-700 small mb-0", children: [formatMessage(messages.helpLinkText), ' ', _jsxs(Link, { to: LEARNER_HELP_CENTER_URL, className: "manage-help__link text-primary-500 d-inline-flex align-items-center", target: "_blank", rel: "noopener noreferrer", children: [formatMessage(messages.helpLink), _jsx(Icon, { src: Launch, className: "icon mr-1", "data-testid": "help-center-icon" })] })] }) }));
|
|
11
|
+
};
|
|
12
|
+
export default HelpCenter;
|
|
13
|
+
//# sourceMappingURL=HelpCenter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HelpCenter.js","sourceRoot":"","sources":["../../../src/components/HelpCenter/HelpCenter.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AACxC,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAEjD,OAAO,QAAQ,MAAM,YAAY,CAAC;AAClC,OAAO,EAAE,uBAAuB,EAAE,MAAM,iBAAiB,CAAC;AAC1D,OAAO,IAAI,MAAM,4BAA4B,CAAC;AAC9C,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAEhD,MAAM,UAAU,GAAa,GAAG,EAAE;IAChC,MAAM,EAAE,aAAa,EAAE,GAAG,OAAO,EAAE,CAAC;IAEpC,OAAO,CACL,cAAK,SAAS,EAAC,kCAAkC,YAC/C,aAAG,SAAS,EAAC,4CAA4C,aACtD,aAAa,CAAC,QAAQ,CAAC,YAAY,CAAC,EACpC,GAAG,EACJ,MAAC,IAAI,IAAC,EAAE,EAAE,uBAAuB,EAAE,SAAS,EAAC,qEAAqE,EAAC,MAAM,EAAC,QAAQ,EAAC,GAAG,EAAC,qBAAqB,aACzJ,aAAa,CAAC,QAAQ,CAAC,QAAQ,CAAC,EACjC,KAAC,IAAI,IAAC,GAAG,EAAE,MAAM,EAAE,SAAS,EAAC,WAAW,iBAAa,kBAAkB,GAAG,IACrE,IACL,GACA,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,UAAU,CAAC","sourcesContent":["import React from 'react';\nimport { Link } from 'react-router-dom';\nimport { useIntl } from '@openedx/frontend-base';\n\nimport messages from './messages';\nimport { LEARNER_HELP_CENTER_URL } from '../../constants';\nimport Icon from '@openedx/paragon/dist/Icon';\nimport { Launch } from '@openedx/paragon/icons';\n\nconst HelpCenter: React.FC = () => {\n const { formatMessage } = useIntl();\n\n return (\n <div className=\"manage-help mt-5 pt-4 border-top\">\n <p className=\"manage-help__text text-gray-700 small mb-0\">\n {formatMessage(messages.helpLinkText)}\n {' '}\n <Link to={LEARNER_HELP_CENTER_URL} className=\"manage-help__link text-primary-500 d-inline-flex align-items-center\" target=\"_blank\" rel=\"noopener noreferrer\">\n {formatMessage(messages.helpLink)}\n <Icon src={Launch} className=\"icon mr-1\" data-testid=\"help-center-icon\" />\n </Link>\n </p>\n </div>\n );\n};\n\nexport default HelpCenter;\n"]}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { defineMessages } from '@openedx/frontend-base';
|
|
2
|
+
const messages = defineMessages({
|
|
3
|
+
helpLinkText: {
|
|
4
|
+
id: 'helpLinkText',
|
|
5
|
+
defaultMessage: 'Need more help? Visit the',
|
|
6
|
+
description: 'Text before the help center link',
|
|
7
|
+
},
|
|
8
|
+
helpLink: {
|
|
9
|
+
id: 'helpLink',
|
|
10
|
+
defaultMessage: 'Learner Help Center',
|
|
11
|
+
description: 'Text for the help center link',
|
|
12
|
+
},
|
|
13
|
+
});
|
|
14
|
+
export default messages;
|
|
15
|
+
//# sourceMappingURL=messages.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"messages.js","sourceRoot":"","sources":["../../../src/components/HelpCenter/messages.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAExD,MAAM,QAAQ,GAAG,cAAc,CAAC;IAC9B,YAAY,EAAE;QACZ,EAAE,EAAE,cAAc;QAClB,cAAc,EAAE,2BAA2B;QAC3C,WAAW,EAAE,kCAAkC;KAChD;IACD,QAAQ,EAAE;QACR,EAAE,EAAE,UAAU;QACd,cAAc,EAAE,qBAAqB;QACrC,WAAW,EAAE,+BAA+B;KAC7C;CACF,CAAC,CAAC;AAEH,eAAe,QAAQ,CAAC","sourcesContent":["import { defineMessages } from '@openedx/frontend-base';\n\nconst messages = defineMessages({\n helpLinkText: {\n id: 'helpLinkText',\n defaultMessage: 'Need more help? Visit the',\n description: 'Text before the help center link',\n },\n helpLink: {\n id: 'helpLink',\n defaultMessage: 'Learner Help Center',\n description: 'Text for the help center link',\n },\n});\n\nexport default messages;\n"]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { Container, Row, Col, } from '@openedx/paragon';
|
|
3
|
+
import OrderHistoryTabs from './OrderHistoryTabs/OrderHistoryTabs';
|
|
4
|
+
import OrderHistoryHeader from './OrderHistoryHeader';
|
|
5
|
+
import HelpCenter from '../HelpCenter/HelpCenter';
|
|
6
|
+
const OrderHistory = () => {
|
|
7
|
+
return (_jsxs(_Fragment, { children: [_jsxs(Container, { fluid: true, size: "xl", children: [_jsx(OrderHistoryHeader, {}), _jsx(Row, { children: _jsx(Col, { xs: 12, lg: 8, children: _jsx(OrderHistoryTabs, {}) }) })] }), _jsx(Container, { fluid: true, className: "mt-4 bg-light-300", children: _jsx(Container, { fluid: true, size: "xl", className: "mb-4", children: _jsx(Row, { children: _jsx(Col, { xs: 12, lg: 8, children: _jsx(HelpCenter, {}) }) }) }) })] }));
|
|
8
|
+
};
|
|
9
|
+
export default OrderHistory;
|
|
10
|
+
//# sourceMappingURL=OrderHistory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OrderHistory.js","sourceRoot":"","sources":["../../../src/components/OrderHistory/OrderHistory.tsx"],"names":[],"mappings":";AACA,OAAO,EACL,SAAS,EACT,GAAG,EACH,GAAG,GACJ,MAAM,kBAAkB,CAAC;AAC1B,OAAO,gBAAgB,MAAM,qCAAqC,CAAC;AACnE,OAAO,kBAAkB,MAAM,sBAAsB,CAAC;AACtD,OAAO,UAAU,MAAM,0BAA0B,CAAC;AAElD,MAAM,YAAY,GAAa,GAAG,EAAE;IAClC,OAAO,CACL,8BACE,MAAC,SAAS,IAAC,KAAK,QAAC,IAAI,EAAC,IAAI,aACxB,KAAC,kBAAkB,KAAG,EACtB,KAAC,GAAG,cACF,KAAC,GAAG,IAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,YAChB,KAAC,gBAAgB,KAAG,GAChB,GACF,IACI,EACZ,KAAC,SAAS,IAAC,KAAK,QAAC,SAAS,EAAC,mBAAmB,YAC5C,KAAC,SAAS,IAAC,KAAK,QAAC,IAAI,EAAC,IAAI,EAAC,SAAS,EAAC,MAAM,YACzC,KAAC,GAAG,cACF,KAAC,GAAG,IAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,YAChB,KAAC,UAAU,KAAG,GACV,GACF,GACI,GACF,IACX,CACJ,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,YAAY,CAAC","sourcesContent":["import React from 'react';\nimport {\n Container,\n Row,\n Col,\n} from '@openedx/paragon';\nimport OrderHistoryTabs from './OrderHistoryTabs/OrderHistoryTabs';\nimport OrderHistoryHeader from './OrderHistoryHeader';\nimport HelpCenter from '../HelpCenter/HelpCenter';\n\nconst OrderHistory: React.FC = () => {\n return (\n <>\n <Container fluid size=\"xl\">\n <OrderHistoryHeader />\n <Row>\n <Col xs={12} lg={8}>\n <OrderHistoryTabs />\n </Col>\n </Row>\n </Container>\n <Container fluid className=\"mt-4 bg-light-300\">\n <Container fluid size=\"xl\" className=\"mb-4\">\n <Row>\n <Col xs={12} lg={8}>\n <HelpCenter />\n </Col>\n </Row>\n </Container>\n </Container>\n </>\n );\n};\n\nexport default OrderHistory;\n"]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useIntl } from '@openedx/frontend-base';
|
|
3
|
+
import messages from './messages';
|
|
4
|
+
const OrderHistoryHeader = () => {
|
|
5
|
+
const { formatMessage } = useIntl();
|
|
6
|
+
return (_jsxs("header", { className: "manage-header", children: [_jsx("h1", { className: "manage-header__title h1 text-primary-500 mb-2 mt-4 orderHistoryTitle", children: formatMessage(messages.orderHistoryTitle) }), _jsx("p", { className: "manage-header__subtitle text-gray-700 mb-2.5", children: formatMessage(messages.orderHistorySubTitle) })] }));
|
|
7
|
+
};
|
|
8
|
+
export default OrderHistoryHeader;
|
|
9
|
+
//# sourceMappingURL=OrderHistoryHeader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OrderHistoryHeader.js","sourceRoot":"","sources":["../../../src/components/OrderHistory/OrderHistoryHeader.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAEjD,OAAO,QAAQ,MAAM,YAAY,CAAC;AAElC,MAAM,kBAAkB,GAAa,GAAG,EAAE;IACxC,MAAM,EAAE,aAAa,EAAE,GAAG,OAAO,EAAE,CAAC;IAEpC,OAAO,CACL,kBAAQ,SAAS,EAAC,eAAe,aAC/B,aAAI,SAAS,EAAC,sEAAsE,YACjF,aAAa,CAAC,QAAQ,CAAC,iBAAiB,CAAC,GACvC,EACL,YAAG,SAAS,EAAC,8CAA8C,YACxD,aAAa,CAAC,QAAQ,CAAC,oBAAoB,CAAC,GAC3C,IACG,CACV,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,kBAAkB,CAAC","sourcesContent":["import React from 'react';\nimport { useIntl } from '@openedx/frontend-base';\n\nimport messages from './messages';\n\nconst OrderHistoryHeader: React.FC = () => {\n const { formatMessage } = useIntl();\n\n return (\n <header className=\"manage-header\">\n <h1 className=\"manage-header__title h1 text-primary-500 mb-2 mt-4 orderHistoryTitle\">\n {formatMessage(messages.orderHistoryTitle)}\n </h1>\n <p className=\"manage-header__subtitle text-gray-700 mb-2.5\">\n {formatMessage(messages.orderHistorySubTitle)}\n </p>\n </header>\n );\n};\n\nexport default OrderHistoryHeader;\n"]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useIntl } from '@openedx/frontend-base';
|
|
3
|
+
import messages from './messages';
|
|
4
|
+
const CoursePayments = () => {
|
|
5
|
+
const { formatMessage } = useIntl();
|
|
6
|
+
return (_jsxs("section", { className: "pt-4", "aria-labelledby": "course-payments-empty-heading", children: [_jsx("h2", { id: "course-payments-empty-heading", className: "h5 font-weight-bold text-primary-700 mb-1", children: formatMessage(messages.otherPurchasesTitle) }), _jsx("p", { className: "medium text-gray-700 mb-0", children: formatMessage(messages.coursePurchasesEmptyMessage) })] }));
|
|
7
|
+
};
|
|
8
|
+
export default CoursePayments;
|
|
9
|
+
//# sourceMappingURL=CoursePayments.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CoursePayments.js","sourceRoot":"","sources":["../../../../src/components/OrderHistory/OrderHistoryTabDetails/CoursePayments.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,QAAQ,MAAM,YAAY,CAAC;AAElC,MAAM,cAAc,GAAa,GAAG,EAAE;IACpC,MAAM,EAAE,aAAa,EAAE,GAAG,OAAO,EAAE,CAAC;IAEpC,OAAO,CACL,mBAAS,SAAS,EAAC,MAAM,qBAAiB,+BAA+B,aACvE,aAAI,EAAE,EAAC,+BAA+B,EAAC,SAAS,EAAC,2CAA2C,YACzF,aAAa,CAAC,QAAQ,CAAC,mBAAmB,CAAC,GACzC,EACL,YAAG,SAAS,EAAC,2BAA2B,YACrC,aAAa,CAAC,QAAQ,CAAC,2BAA2B,CAAC,GAClD,IACI,CACX,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,cAAc,CAAC","sourcesContent":["import React from 'react';\nimport { useIntl } from '@openedx/frontend-base';\nimport messages from './messages';\n\nconst CoursePayments: React.FC = () => {\n const { formatMessage } = useIntl();\n\n return (\n <section className=\"pt-4\" aria-labelledby=\"course-payments-empty-heading\">\n <h2 id=\"course-payments-empty-heading\" className=\"h5 font-weight-bold text-primary-700 mb-1\">\n {formatMessage(messages.otherPurchasesTitle)}\n </h2>\n <p className=\"medium text-gray-700 mb-0\">\n {formatMessage(messages.coursePurchasesEmptyMessage)}\n </p>\n </section>\n );\n};\n\nexport default CoursePayments;\n"]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useIntl } from '@openedx/frontend-base';
|
|
3
|
+
import messages from './messages';
|
|
4
|
+
const SubscriptionPayments = () => {
|
|
5
|
+
const { formatMessage } = useIntl();
|
|
6
|
+
return (_jsx("section", { className: "pt-4", children: _jsx("p", { className: "medium text-gray-700 mb-0", children: formatMessage(messages.subscriptionPaymentsEmptyMessage) }) }));
|
|
7
|
+
};
|
|
8
|
+
export default SubscriptionPayments;
|
|
9
|
+
//# sourceMappingURL=SubscriptionPayments.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SubscriptionPayments.js","sourceRoot":"","sources":["../../../../src/components/OrderHistory/OrderHistoryTabDetails/SubscriptionPayments.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,QAAQ,MAAM,YAAY,CAAC;AAElC,MAAM,oBAAoB,GAAa,GAAG,EAAE;IAC1C,MAAM,EAAE,aAAa,EAAE,GAAG,OAAO,EAAE,CAAC;IAEpC,OAAO,CACL,kBAAS,SAAS,EAAC,MAAM,YACvB,YAAG,SAAS,EAAC,2BAA2B,YACrC,aAAa,CAAC,QAAQ,CAAC,gCAAgC,CAAC,GACvD,GACI,CACX,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,oBAAoB,CAAC","sourcesContent":["import React from 'react';\nimport { useIntl } from '@openedx/frontend-base';\nimport messages from './messages';\n\nconst SubscriptionPayments: React.FC = () => {\n const { formatMessage } = useIntl();\n\n return (\n <section className=\"pt-4\">\n <p className=\"medium text-gray-700 mb-0\">\n {formatMessage(messages.subscriptionPaymentsEmptyMessage)}\n </p>\n </section>\n );\n};\n\nexport default SubscriptionPayments;\n"]}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
declare const messages: {
|
|
2
|
+
otherPurchasesTitle: {
|
|
3
|
+
id: string;
|
|
4
|
+
defaultMessage: string;
|
|
5
|
+
description: string;
|
|
6
|
+
};
|
|
7
|
+
coursePurchasesEmptyMessage: {
|
|
8
|
+
id: string;
|
|
9
|
+
defaultMessage: string;
|
|
10
|
+
description: string;
|
|
11
|
+
};
|
|
12
|
+
subscriptionPaymentsEmptyMessage: {
|
|
13
|
+
id: string;
|
|
14
|
+
defaultMessage: string;
|
|
15
|
+
description: string;
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
export default messages;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { defineMessages } from '@openedx/frontend-base';
|
|
2
|
+
const messages = defineMessages({
|
|
3
|
+
otherPurchasesTitle: {
|
|
4
|
+
id: 'orderHistory.coursePayments.otherPurchasesTitle',
|
|
5
|
+
defaultMessage: 'Other purchases',
|
|
6
|
+
description: 'Heading above the list of other course purchases.',
|
|
7
|
+
},
|
|
8
|
+
coursePurchasesEmptyMessage: {
|
|
9
|
+
id: 'orderHistory.coursePayments.emptyMessage',
|
|
10
|
+
defaultMessage: 'Courses you purchased in the last 180 days will appear here. If possible, please retain receipts for your records.',
|
|
11
|
+
description: 'Message shown when there are no course purchases to display.',
|
|
12
|
+
},
|
|
13
|
+
subscriptionPaymentsEmptyMessage: {
|
|
14
|
+
id: 'orderHistory.subscriptionPayments.emptyMessage',
|
|
15
|
+
defaultMessage: 'Subscription payments you made in the last 180 days will appear here. If possible, please retain receipts for your records.',
|
|
16
|
+
description: 'Message shown when there are no subscription payments to display.',
|
|
17
|
+
},
|
|
18
|
+
});
|
|
19
|
+
export default messages;
|
|
20
|
+
//# sourceMappingURL=messages.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"messages.js","sourceRoot":"","sources":["../../../../src/components/OrderHistory/OrderHistoryTabDetails/messages.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAExD,MAAM,QAAQ,GAAG,cAAc,CAAC;IAC9B,mBAAmB,EAAE;QACnB,EAAE,EAAE,iDAAiD;QACrD,cAAc,EAAE,iBAAiB;QACjC,WAAW,EAAE,mDAAmD;KACjE;IACD,2BAA2B,EAAE;QAC3B,EAAE,EAAE,0CAA0C;QAC9C,cAAc,EAAE,oHAAoH;QACpI,WAAW,EAAE,8DAA8D;KAC5E;IACD,gCAAgC,EAAE;QAChC,EAAE,EAAE,gDAAgD;QACpD,cAAc,EAAE,6HAA6H;QAC7I,WAAW,EAAE,mEAAmE;KACjF;CACF,CAAC,CAAC;AAEH,eAAe,QAAQ,CAAC","sourcesContent":["import { defineMessages } from '@openedx/frontend-base';\n\nconst messages = defineMessages({\n otherPurchasesTitle: {\n id: 'orderHistory.coursePayments.otherPurchasesTitle',\n defaultMessage: 'Other purchases',\n description: 'Heading above the list of other course purchases.',\n },\n coursePurchasesEmptyMessage: {\n id: 'orderHistory.coursePayments.emptyMessage',\n defaultMessage: 'Courses you purchased in the last 180 days will appear here. If possible, please retain receipts for your records.',\n description: 'Message shown when there are no course purchases to display.',\n },\n subscriptionPaymentsEmptyMessage: {\n id: 'orderHistory.subscriptionPayments.emptyMessage',\n defaultMessage: 'Subscription payments you made in the last 180 days will appear here. If possible, please retain receipts for your records.',\n description: 'Message shown when there are no subscription payments to display.',\n },\n});\n\nexport default messages;\n"]}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo, useState, useCallback } from 'react';
|
|
3
|
+
import { Tabs, Tab } from '@openedx/paragon';
|
|
4
|
+
import SubscriptionPayments from '../OrderHistoryTabDetails/SubscriptionPayments';
|
|
5
|
+
import CoursePayments from '../OrderHistoryTabDetails/CoursePayments';
|
|
6
|
+
const OrderHistoryTabs = () => {
|
|
7
|
+
var _a;
|
|
8
|
+
const orderHistoryTabs = useMemo(() => {
|
|
9
|
+
const tabs = [
|
|
10
|
+
{
|
|
11
|
+
key: 'courses',
|
|
12
|
+
title: 'Subscription Payments',
|
|
13
|
+
panel: _jsx(SubscriptionPayments, {}),
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
key: 'programs',
|
|
17
|
+
title: 'Course Payments',
|
|
18
|
+
panel: _jsx(CoursePayments, {}),
|
|
19
|
+
},
|
|
20
|
+
];
|
|
21
|
+
return tabs;
|
|
22
|
+
}, []);
|
|
23
|
+
const [activeTab, setActiveTab] = useState(orderHistoryTabs[0].key);
|
|
24
|
+
const handleTabSelect = useCallback((tabKey) => {
|
|
25
|
+
if (tabKey) {
|
|
26
|
+
setActiveTab(tabKey);
|
|
27
|
+
}
|
|
28
|
+
}, []);
|
|
29
|
+
return (_jsx(Tabs, { id: "order-history-tabs", defaultActiveKey: (_a = orderHistoryTabs[0]) === null || _a === void 0 ? void 0 : _a.key, activeKey: activeTab, onSelect: handleTabSelect, className: "mb-4", mountOnEnter: true, children: orderHistoryTabs.map(tab => (_jsx(Tab, { eventKey: tab.key, title: tab.title, children: tab.panel }, tab.key))) }));
|
|
30
|
+
};
|
|
31
|
+
export default OrderHistoryTabs;
|
|
32
|
+
//# sourceMappingURL=OrderHistoryTabs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OrderHistoryTabs.js","sourceRoot":"","sources":["../../../../src/components/OrderHistory/OrderHistoryTabs/OrderHistoryTabs.tsx"],"names":[],"mappings":";AAAA,OAAc,EAAE,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAC9D,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,oBAAoB,MAAM,gDAAgD,CAAC;AAClF,OAAO,cAAc,MAAM,0CAA0C,CAAC;AAEtE,MAAM,gBAAgB,GAAG,GAAG,EAAE;;IAC5B,MAAM,gBAAgB,GAAG,OAAO,CAAC,GAAG,EAAE;QACpC,MAAM,IAAI,GAAG;YACX;gBACE,GAAG,EAAE,SAAS;gBACd,KAAK,EAAE,uBAAuB;gBAC9B,KAAK,EAAE,KAAC,oBAAoB,KAAG;aAChC;YACD;gBACE,GAAG,EAAE,UAAU;gBACf,KAAK,EAAE,iBAAiB;gBACxB,KAAK,EAAE,KAAC,cAAc,KAAG;aAC1B;SACF,CAAC;QAEF,OAAO,IAAI,CAAC;IACd,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG,QAAQ,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;IACpE,MAAM,eAAe,GAAG,WAAW,CAAC,CAAC,MAAM,EAAE,EAAE;QAC7C,IAAI,MAAM,EAAE,CAAC;YACX,YAAY,CAAC,MAAM,CAAC,CAAC;QACvB,CAAC;IACH,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,OAAO,CACL,KAAC,IAAI,IACH,EAAE,EAAC,oBAAoB,EACvB,gBAAgB,EAAE,MAAA,gBAAgB,CAAC,CAAC,CAAC,0CAAE,GAAG,EAC1C,SAAS,EAAE,SAAS,EACpB,QAAQ,EAAE,eAAe,EACzB,SAAS,EAAC,MAAM,EAChB,YAAY,kBAEX,gBAAgB,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,CAC3B,KAAC,GAAG,IAAC,QAAQ,EAAE,GAAG,CAAC,GAAG,EAAE,KAAK,EAAE,GAAG,CAAC,KAAK,YACrC,GAAG,CAAC,KAAK,IADmC,GAAG,CAAC,GAAG,CAEhD,CACP,CAAC,GACG,CACR,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,gBAAgB,CAAC","sourcesContent":["import React, { useMemo, useState, useCallback } from 'react';\nimport { Tabs, Tab } from '@openedx/paragon';\nimport SubscriptionPayments from '../OrderHistoryTabDetails/SubscriptionPayments';\nimport CoursePayments from '../OrderHistoryTabDetails/CoursePayments';\n\nconst OrderHistoryTabs = () => {\n const orderHistoryTabs = useMemo(() => {\n const tabs = [\n {\n key: 'courses',\n title: 'Subscription Payments',\n panel: <SubscriptionPayments />,\n },\n {\n key: 'programs',\n title: 'Course Payments',\n panel: <CoursePayments />,\n },\n ];\n\n return tabs;\n }, []);\n\n const [activeTab, setActiveTab] = useState(orderHistoryTabs[0].key);\n const handleTabSelect = useCallback((tabKey) => {\n if (tabKey) {\n setActiveTab(tabKey);\n }\n }, []);\n\n return (\n <Tabs\n id=\"order-history-tabs\"\n defaultActiveKey={orderHistoryTabs[0]?.key}\n activeKey={activeTab}\n onSelect={handleTabSelect}\n className=\"mb-4\"\n mountOnEnter\n >\n {orderHistoryTabs.map(tab => (\n <Tab eventKey={tab.key} title={tab.title} key={tab.key}>\n {tab.panel}\n </Tab>\n ))}\n </Tabs>\n );\n};\n\nexport default OrderHistoryTabs;\n"]}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
declare const messages: {
|
|
2
|
+
orderHistoryTitle: {
|
|
3
|
+
id: string;
|
|
4
|
+
defaultMessage: string;
|
|
5
|
+
description: string;
|
|
6
|
+
};
|
|
7
|
+
orderHistorySubTitle: {
|
|
8
|
+
id: string;
|
|
9
|
+
defaultMessage: string;
|
|
10
|
+
description: string;
|
|
11
|
+
};
|
|
12
|
+
subscriptionPaymentsTab: {
|
|
13
|
+
id: string;
|
|
14
|
+
defaultMessage: string;
|
|
15
|
+
description: string;
|
|
16
|
+
};
|
|
17
|
+
coursePaymentsTab: {
|
|
18
|
+
id: string;
|
|
19
|
+
defaultMessage: string;
|
|
20
|
+
description: string;
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
export default messages;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { defineMessages } from '@openedx/frontend-base';
|
|
2
|
+
const messages = defineMessages({
|
|
3
|
+
orderHistoryTitle: {
|
|
4
|
+
id: 'orderHistoryTitle',
|
|
5
|
+
defaultMessage: 'Order History',
|
|
6
|
+
description: 'Heading for order history',
|
|
7
|
+
},
|
|
8
|
+
orderHistorySubTitle: {
|
|
9
|
+
id: 'orderHistorySubTitle',
|
|
10
|
+
defaultMessage: 'View previous purchases and manage your subscription. ',
|
|
11
|
+
description: 'Page subtitle under Order History',
|
|
12
|
+
},
|
|
13
|
+
subscriptionPaymentsTab: {
|
|
14
|
+
id: 'subscriptionPaymentsTab',
|
|
15
|
+
defaultMessage: 'Subscription payments',
|
|
16
|
+
description: 'Subscription payments tab label',
|
|
17
|
+
},
|
|
18
|
+
coursePaymentsTab: {
|
|
19
|
+
id: 'coursePaymentsTab',
|
|
20
|
+
defaultMessage: 'Course payments',
|
|
21
|
+
description: 'Course payments tab label',
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
export default messages;
|
|
25
|
+
//# sourceMappingURL=messages.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"messages.js","sourceRoot":"","sources":["../../../src/components/OrderHistory/messages.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAExD,MAAM,QAAQ,GAAG,cAAc,CAAC;IAC9B,iBAAiB,EAAE;QACjB,EAAE,EAAE,mBAAmB;QACvB,cAAc,EAAE,eAAe;QAC/B,WAAW,EAAE,2BAA2B;KACzC;IACD,oBAAoB,EAAE;QACpB,EAAE,EAAE,sBAAsB;QAC1B,cAAc,EAAE,wDAAwD;QACxE,WAAW,EAAE,mCAAmC;KACjD;IACD,uBAAuB,EAAE;QACvB,EAAE,EAAE,yBAAyB;QAC7B,cAAc,EAAE,uBAAuB;QACvC,WAAW,EAAE,iCAAiC;KAC/C;IACD,iBAAiB,EAAE;QACjB,EAAE,EAAE,mBAAmB;QACvB,cAAc,EAAE,iBAAiB;QACjC,WAAW,EAAE,2BAA2B;KACzC;CACF,CAAC,CAAC;AAEH,eAAe,QAAQ,CAAC","sourcesContent":["import { defineMessages } from '@openedx/frontend-base';\n\nconst messages = defineMessages({\n orderHistoryTitle: {\n id: 'orderHistoryTitle',\n defaultMessage: 'Order History',\n description: 'Heading for order history',\n },\n orderHistorySubTitle: {\n id: 'orderHistorySubTitle',\n defaultMessage: 'View previous purchases and manage your subscription. ',\n description: 'Page subtitle under Order History',\n },\n subscriptionPaymentsTab: {\n id: 'subscriptionPaymentsTab',\n defaultMessage: 'Subscription payments',\n description: 'Subscription payments tab label',\n },\n coursePaymentsTab: {\n id: 'coursePaymentsTab',\n defaultMessage: 'Course payments',\n description: 'Course payments tab label',\n }\n});\n\nexport default messages;\n"]}
|
|
@@ -52,7 +52,7 @@ const ProgramEnrollmentCard = ({ program, programName, ownedCourses = null, }) =
|
|
|
52
52
|
? includedCourses
|
|
53
53
|
: includedCourses.slice(0, INITIAL_VISIBLE_COURSES);
|
|
54
54
|
const hasMoreIncluded = includedCourses.length > INITIAL_VISIBLE_COURSES;
|
|
55
|
-
return (_jsxs("div", { className: "program-enrollment-card", children: [_jsxs("div", { className: "program-enrollment-card__header d-flex align-items-start", children: [brandLogoUrl && (_jsx("div", { className: "program-enrollment-card__logo-wrap flex-shrink-0", children: _jsx("img", { src: brandLogoUrl, alt: formatMessage(messages.logoAlt, { brand: brandText }), className: "program-enrollment-card__logo" }) })), _jsxs("div", { className: "program-enrollment-card__content flex-grow-1", children: [_jsxs("span", { className: "program-enrollment-card__certificate-badge", children: [_jsx(Icon, { src: Monitor, className: "program-enrollment-card__certificate-icon" }), formatMessage(messages.verifiedCertificate)] }), _jsx("p", { className: "program-enrollment-card__title font-weight-bold mb-0", children: programName })] })] }), includedCourses.length > 0 && (_jsxs("div", { className: "program-enrollment-card__courses", children: [_jsx("
|
|
55
|
+
return (_jsxs("div", { className: "program-enrollment-card", children: [_jsxs("div", { className: "program-enrollment-card__header d-flex align-items-start", children: [brandLogoUrl && (_jsx("div", { className: "program-enrollment-card__logo-wrap flex-shrink-0", children: _jsx("img", { src: brandLogoUrl, alt: formatMessage(messages.logoAlt, { brand: brandText }), className: "program-enrollment-card__logo" }) })), _jsxs("div", { className: "program-enrollment-card__content flex-grow-1", children: [_jsxs("span", { className: "program-enrollment-card__certificate-badge", children: [_jsx(Icon, { src: Monitor, className: "program-enrollment-card__certificate-icon" }), formatMessage(messages.verifiedCertificate)] }), _jsx("p", { className: "program-enrollment-card__title font-weight-bold mb-0", children: programName })] })] }), includedCourses.length > 0 && (_jsxs("div", { className: "program-enrollment-card__courses", children: [_jsx("h3", { className: "program-enrollment-card__courses-heading font-weight-bold mb-2 text-gray-900", children: formatMessage(messages.coursesIncluded, { count: program.tCourses.length }) }), _jsx("ul", { className: "program-enrollment-card__course-list mb-2", children: visibleIncluded.map((c) => (_jsx("li", { children: courseLabel(c) }, c.id))) }), hasMoreIncluded && (_jsx(Button, { variant: "tertiary", size: "sm", className: "program-enrollment-card__toggle px-0", onClick: () => setExpanded((value) => !value), iconAfter: expanded ? ExpandLess : ExpandMore, children: formatMessage(expanded ? messages.showLess : messages.showAll) }))] })), previouslyPurchased.length > 0 && (_jsxs("div", { className: "program-enrollment-card__purchased", "data-testid": "previously-purchased", children: [_jsx("h3", { className: "program-enrollment-card__purchased-heading font-weight-bold font-italic mb-2 text-gray-900", children: formatMessage(messages.previouslyPurchased, { count: previouslyPurchased.length }) }), _jsx("ul", { className: "program-enrollment-card__course-list mb-0", children: previouslyPurchased.map((name) => (_jsx("li", { children: name }, name))) })] }))] }));
|
|
56
56
|
};
|
|
57
57
|
export default ProgramEnrollmentCard;
|
|
58
58
|
//# sourceMappingURL=ProgramEnrollmentCard.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProgramEnrollmentCard.js","sourceRoot":"","sources":["../../../src/components/ProgramEnrollmentCard/ProgramEnrollmentCard.tsx"],"names":[],"mappings":";AAAA,OAAc,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACjD,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACzE,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAEjD,OAAO,QAAQ,MAAM,YAAY,CAAC;AAUlC,MAAM,uBAAuB,GAAG,CAAC,CAAC;AAElC,SAAS,WAAW,CAAC,MAA4E;;IAC/F,OAAO,MAAA,MAAA,MAAM,CAAC,MAAM,mCAAI,MAAM,CAAC,cAAc,mCAAI,MAAM,CAAC,EAAE,CAAC;AAC7D,CAAC;AAED,6FAA6F;AAC7F,SAAS,WAAW,CAAC,EAAU;IAC7B,MAAM,OAAO,GAAG,EAAE,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;IACxC,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACjC,OAAO,KAAK,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,IAAI,OAAO,CAAC;AAC5C,CAAC;AAED,SAAS,aAAa,CAAC,IAAY;IACjC,OAAO,IAAI,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;AACxD,CAAC;AAED,SAAS,oBAAoB,CAC3B,MAAyC,EACzC,QAAqB,EACrB,UAAuB;IAEvB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AO,CAAC,GACxD,CACV,IACG,CACP,EAEA,mBAAmB,CAAC,MAAM,GAAG,CAAC,IAAI,CACjC,eACE,SAAS,EAAC,oCAAoC,iBAClC,sBAAsB,aAElC,YAAG,SAAS,EAAC,4FAA4F,YACtG,aAAa,CAAC,QAAQ,CAAC,mBAAmB,EAAE,EAAE,KAAK,EAAE,mBAAmB,CAAC,MAAM,EAAE,CAAC,GACjF,EACJ,aAAI,SAAS,EAAC,2CAA2C,YACtD,mBAAmB,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CACjC,uBAAgB,IAAI,IAAX,IAAI,CAAa,CAC3B,CAAC,GACC,IACD,CACP,IACG,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,qBAAqB,CAAC","sourcesContent":["import React, { useMemo, useState } from 'react';\nimport { Button, Icon } from '@openedx/paragon';\nimport { Monitor, ExpandMore, ExpandLess } from '@openedx/paragon/icons';\nimport { useIntl } from '@openedx/frontend-base';\nimport type { AlacarteProgramOwnedCourse, ProgramDetail } from '../../types/alacarte';\nimport messages from './Messages';\n\nexport interface ProgramEnrollmentCardProps {\n program: ProgramDetail,\n /** The line's own programName — filterTwouProgram has no name field of its own. */\n programName: string,\n /** Member courses the learner already owns — shown under \"Previously purchased\". */\n ownedCourses?: AlacarteProgramOwnedCourse[] | null,\n}\n\nconst INITIAL_VISIBLE_COURSES = 2;\n\nfunction courseLabel(course: { id: string, maName: string | null, tMarketingSlug: string | null }): string {\n return course.maName ?? course.tMarketingSlug ?? course.id;\n}\n\n/** Catalog ids sometimes arrive as `TwouCourse:<uuid>` while owned courseId is bare UUID. */\nfunction normalizeId(id: string): string {\n const trimmed = id.trim().toLowerCase();\n const parts = trimmed.split(':');\n return parts[parts.length - 1] || trimmed;\n}\n\nfunction normalizeName(name: string): string {\n return name.trim().toLowerCase().replace(/\\s+/g, ' ');\n}\n\nfunction isOwnedCatalogCourse(\n course: ProgramDetail['tCourses'][number],\n ownedIds: Set<string>,\n ownedNames: Set<string>,\n): boolean {\n if (ownedIds.has(normalizeId(course.id))) return true;\n if (course.uid && ownedIds.has(normalizeId(course.uid))) return true;\n const label = courseLabel(course);\n return !!label && ownedNames.has(normalizeName(label));\n}\n\nconst ProgramEnrollmentCard = ({\n program,\n programName,\n ownedCourses = null,\n}: ProgramEnrollmentCardProps) => {\n const { formatMessage } = useIntl();\n const [expanded, setExpanded] = useState(false);\n\n const ownedList = useMemo(() => ownedCourses ?? [], [ownedCourses]);\n const ownedIds = useMemo(\n () => new Set(\n ownedList\n .map((c) => c.courseId)\n .filter(Boolean)\n .map(normalizeId),\n ),\n [ownedList],\n );\n const ownedNames = useMemo(\n () => new Set(\n ownedList\n .map((c) => c.name?.trim())\n .filter((name): name is string => !!name)\n .map(normalizeName),\n ),\n [ownedList],\n );\n\n const includedCourses = useMemo(\n () => program.tCourses.filter((c) => !isOwnedCatalogCourse(c, ownedIds, ownedNames)),\n [program.tCourses, ownedIds, ownedNames],\n );\n\n const previouslyPurchased = useMemo(\n () => ownedList\n .map((c) => c.name?.trim())\n .filter((name): name is string => !!name),\n [ownedList],\n );\n\n // The program itself has no brand/logo field in filterTwouProgram — approximate\n // it from its first member course, which does carry tOrgLogoUrl/tBrandText.\n const primaryCourse = program.tCourses[0];\n const brandLogoUrl = primaryCourse?.tOrgLogoUrl ?? null;\n const brandText = primaryCourse?.tBrandText ?? '';\n\n const visibleIncluded = expanded\n ? includedCourses\n : includedCourses.slice(0, INITIAL_VISIBLE_COURSES);\n const hasMoreIncluded = includedCourses.length > INITIAL_VISIBLE_COURSES;\n\n return (\n <div className=\"program-enrollment-card\">\n <div className=\"program-enrollment-card__header d-flex align-items-start\">\n {brandLogoUrl && (\n <div className=\"program-enrollment-card__logo-wrap flex-shrink-0\">\n <img\n src={brandLogoUrl}\n alt={formatMessage(messages.logoAlt, { brand: brandText })}\n className=\"program-enrollment-card__logo\"\n />\n </div>\n )}\n <div className=\"program-enrollment-card__content flex-grow-1\">\n <span className=\"program-enrollment-card__certificate-badge\">\n <Icon src={Monitor} className=\"program-enrollment-card__certificate-icon\" />\n {formatMessage(messages.verifiedCertificate)}\n </span>\n <p className=\"program-enrollment-card__title font-weight-bold mb-0\">\n {programName}\n </p>\n </div>\n </div>\n\n {includedCourses.length > 0 && (\n <div className=\"program-enrollment-card__courses\">\n <p className=\"program-enrollment-card__courses-heading font-weight-bold mb-2 text-gray-900\">\n {formatMessage(messages.coursesIncluded, { count: program.tCourses.length })}\n </p>\n <ul className=\"program-enrollment-card__course-list mb-2\">\n {visibleIncluded.map((c) => (\n <li key={c.id}>{courseLabel(c)}</li>\n ))}\n </ul>\n {hasMoreIncluded && (\n <Button\n variant=\"tertiary\"\n size=\"sm\"\n className=\"program-enrollment-card__toggle px-0\"\n onClick={() => setExpanded((value) => !value)}\n iconAfter={expanded ? ExpandLess : ExpandMore}\n >\n {formatMessage(expanded ? messages.showLess : messages.showAll)}\n </Button>\n )}\n </div>\n )}\n\n {previouslyPurchased.length > 0 && (\n <div\n className=\"program-enrollment-card__purchased\"\n data-testid=\"previously-purchased\"\n >\n <p className=\"program-enrollment-card__purchased-heading font-weight-bold font-italic mb-2 text-gray-900\">\n {formatMessage(messages.previouslyPurchased, { count: previouslyPurchased.length })}\n </p>\n <ul className=\"program-enrollment-card__course-list mb-0\">\n {previouslyPurchased.map((name) => (\n <li key={name}>{name}</li>\n ))}\n </ul>\n </div>\n )}\n </div>\n );\n};\n\nexport default ProgramEnrollmentCard;\n"]}
|
|
1
|
+
{"version":3,"file":"ProgramEnrollmentCard.js","sourceRoot":"","sources":["../../../src/components/ProgramEnrollmentCard/ProgramEnrollmentCard.tsx"],"names":[],"mappings":";AAAA,OAAc,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACjD,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACzE,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Content":["import React, { useMemo, useState } from 'react';\nimport { Button, Icon } from '@openedx/paragon';\nimport { Monitor, ExpandMore, ExpandLess } from '@openedx/paragon/icons';\nimport { useIntl } from '@openedx/frontend-base';\nimport type { AlacarteProgramOwnedCourse, ProgramDetail } from '../../types/alacarte';\nimport messages from './Messages';\n\nexport interface ProgramEnrollmentCardProps {\n program: ProgramDetail,\n /** The line's own programName — filterTwouProgram has no name field of its own. */\n programName: string,\n /** Member courses the learner already owns — shown under \"Previously purchased\". */\n ownedCourses?: AlacarteProgramOwnedCourse[] | null,\n}\n\nconst INITIAL_VISIBLE_COURSES = 2;\n\nfunction courseLabel(course: { id: string, maName: string | null, tMarketingSlug: string | null }): string {\n return course.maName ?? course.tMarketingSlug ?? course.id;\n}\n\n/** Catalog ids sometimes arrive as `TwouCourse:<uuid>` while owned courseId is bare UUID. */\nfunction normalizeId(id: string): string {\n const trimmed = id.trim().toLowerCase();\n const parts = trimmed.split(':');\n return parts[parts.length - 1] || trimmed;\n}\n\nfunction normalizeName(name: string): string {\n return name.trim().toLowerCase().replace(/\\s+/g, ' ');\n}\n\nfunction isOwnedCatalogCourse(\n course: ProgramDetail['tCourses'][number],\n ownedIds: Set<string>,\n ownedNames: Set<string>,\n): boolean {\n if (ownedIds.has(normalizeId(course.id))) return true;\n if (course.uid && ownedIds.has(normalizeId(course.uid))) return true;\n const label = courseLabel(course);\n return !!label && ownedNames.has(normalizeName(label));\n}\n\nconst ProgramEnrollmentCard = ({\n program,\n programName,\n ownedCourses = null,\n}: ProgramEnrollmentCardProps) => {\n const { formatMessage } = useIntl();\n const [expanded, setExpanded] = useState(false);\n\n const ownedList = useMemo(() => ownedCourses ?? [], [ownedCourses]);\n const ownedIds = useMemo(\n () => new Set(\n ownedList\n .map((c) => c.courseId)\n .filter(Boolean)\n .map(normalizeId),\n ),\n [ownedList],\n );\n const ownedNames = useMemo(\n () => new Set(\n ownedList\n .map((c) => c.name?.trim())\n .filter((name): name is string => !!name)\n .map(normalizeName),\n ),\n [ownedList],\n );\n\n const includedCourses = useMemo(\n () => program.tCourses.filter((c) => !isOwnedCatalogCourse(c, ownedIds, ownedNames)),\n [program.tCourses, ownedIds, ownedNames],\n );\n\n const previouslyPurchased = useMemo(\n () => ownedList\n .map((c) => c.name?.trim())\n .filter((name): name is string => !!name),\n [ownedList],\n );\n\n // The program itself has no brand/logo field in filterTwouProgram — approximate\n // it from its first member course, which does carry tOrgLogoUrl/tBrandText.\n const primaryCourse = program.tCourses[0];\n const brandLogoUrl = primaryCourse?.tOrgLogoUrl ?? null;\n const brandText = primaryCourse?.tBrandText ?? '';\n\n const visibleIncluded = expanded\n ? includedCourses\n : includedCourses.slice(0, INITIAL_VISIBLE_COURSES);\n const hasMoreIncluded = includedCourses.length > INITIAL_VISIBLE_COURSES;\n\n return (\n <div className=\"program-enrollment-card\">\n <div className=\"program-enrollment-card__header d-flex align-items-start\">\n {brandLogoUrl && (\n <div className=\"program-enrollment-card__logo-wrap flex-shrink-0\">\n <img\n src={brandLogoUrl}\n alt={formatMessage(messages.logoAlt, { brand: brandText })}\n className=\"program-enrollment-card__logo\"\n />\n </div>\n )}\n <div className=\"program-enrollment-card__content flex-grow-1\">\n <span className=\"program-enrollment-card__certificate-badge\">\n <Icon src={Monitor} className=\"program-enrollment-card__certificate-icon\" />\n {formatMessage(messages.verifiedCertificate)}\n </span>\n <p className=\"program-enrollment-card__title font-weight-bold mb-0\">\n {programName}\n </p>\n </div>\n </div>\n\n {includedCourses.length > 0 && (\n <div className=\"program-enrollment-card__courses\">\n <h3 className=\"program-enrollment-card__courses-heading font-weight-bold mb-2 text-gray-900\">\n {formatMessage(messages.coursesIncluded, { count: program.tCourses.length })}\n </h3>\n <ul className=\"program-enrollment-card__course-list mb-2\">\n {visibleIncluded.map((c) => (\n <li key={c.id}>{courseLabel(c)}</li>\n ))}\n </ul>\n {hasMoreIncluded && (\n <Button\n variant=\"tertiary\"\n size=\"sm\"\n className=\"program-enrollment-card__toggle px-0\"\n onClick={() => setExpanded((value) => !value)}\n iconAfter={expanded ? ExpandLess : ExpandMore}\n >\n {formatMessage(expanded ? messages.showLess : messages.showAll)}\n </Button>\n )}\n </div>\n )}\n\n {previouslyPurchased.length > 0 && (\n <div\n className=\"program-enrollment-card__purchased\"\n data-testid=\"previously-purchased\"\n >\n <h3 className=\"program-enrollment-card__purchased-heading font-weight-bold font-italic mb-2 text-gray-900\">\n {formatMessage(messages.previouslyPurchased, { count: previouslyPurchased.length })}\n </h3>\n <ul className=\"program-enrollment-card__course-list mb-0\">\n {previouslyPurchased.map((name) => (\n <li key={name}>{name}</li>\n ))}\n </ul>\n </div>\n )}\n </div>\n );\n};\n\nexport default ProgramEnrollmentCard;\n"]}
|
|
@@ -6,7 +6,7 @@ import { useIntl } from '@openedx/frontend-base';
|
|
|
6
6
|
import messages from './Messages';
|
|
7
7
|
const PromoBanner = ({ testId, children, }) => {
|
|
8
8
|
const { formatMessage } = useIntl();
|
|
9
|
-
return (_jsxs("div", { className: "promo-code__banner", "data-testid": testId, children: [_jsx("
|
|
9
|
+
return (_jsxs("div", { className: "promo-code__banner", "data-testid": testId, children: [_jsx("h3", { className: "promo-code__banner-text", children: children }), _jsx(Icon, { src: InfoOutline, className: "promo-code__banner-icon", screenReaderText: formatMessage(messages.bannerInfo) })] }));
|
|
10
10
|
};
|
|
11
11
|
const PromoCode = ({ value, onChange, onApply, onRemove, appliedCode = null, discount = null, offer = null, error = null, isApplying = false, disabled = false, }) => {
|
|
12
12
|
const { formatMessage } = useIntl();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PromoCode.js","sourceRoot":"","sources":["../../../src/components/PromoCode/PromoCode.tsx"],"names":[],"mappings":";AAAA,OAAc,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACxC,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AACxC,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,EAAE,OAAO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C,QAAQ,CAAC,WAAW,CAAC,GAC9B,EACR,gBACE,EAAE,EAAC,WAAW,EACd,IAAI,EAAC,MAAM,EACX,SAAS,EAAC,mBAAmB,EAC7B,KAAK,EAAE,KAAK,EACZ,QAAQ,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EACzC,OAAO,EAAE,GAAG,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,EAC/B,MAAM,EAAE,GAAG,EAAE,CAAC,UAAU,CAAC,KAAK,CAAC,EAC/B,QAAQ,EAAE,QAAQ,IAAI,UAAU,kBAClB,CAAC,CAAC,KAAK,sBACH,KAAK,CAAC,CAAC,CAAC,iBAAiB,CAAC,CAAC,CAAC,SAAS,GACvD,IACE,EACN,iBACE,IAAI,EAAC,QAAQ,EACb,QAAQ,EAAE,CAAC,QAAQ,EACnB,SAAS,EAAC,mBAAmB,YAE5B,UAAU;4BACT,CAAC,CAAC,aAAa,CAAC,QAAQ,CAAC,QAAQ,CAAC;4BAClC,CAAC,CAAC,aAAa,CAAC,QAAQ,CAAC,KAAK,CAAC,GAC1B,IACJ,CACR,EACA,KAAK,IAAI,CACR,eAAK,EAAE,EAAC,iBAAiB,EAAC,SAAS,EAAC,mBAAmB,EAAC,IAAI,EAAC,OAAO,aAClE,eAAM,SAAS,EAAC,wBAAwB,iBAAa,MAAM,GAAG,EAC7D,KAAK,IACF,CACP,IACG,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,SAAS,CAAC","sourcesContent":["import React, { useState } from 'react';\nimport { Icon } from '@openedx/paragon';\nimport { Check, InfoOutline } from '@openedx/paragon/icons';\nimport { useIntl } from '@openedx/frontend-base';\nimport messages from './Messages';\n\nexport interface PromoDiscount {\n /** Whole-number percent off, e.g. 15. */\n percent: number,\n amount: number,\n currency: string,\n}\n\n/** A known offer advertised before the learner applies it. */\nexport interface PromoOffer {\n code: string,\n percent: number,\n}\n\nexport interface PromoCodeProps {\n value: string,\n onChange: (value: string) => void,\n onApply: () => void,\n /** Clears an applied coupon (sends empty string to the API). */\n onRemove?: () => void,\n appliedCode?: string | null,\n /** Applied coupon's discount. Drives the applied banner and amount row. */\n discount?: PromoDiscount | null,\n /** Shown on the empty field when we already know a code and its percent. */\n offer?: PromoOffer | null,\n error?: string | null,\n isApplying?: boolean,\n disabled?: boolean,\n}\n\nconst PromoBanner = ({\n testId,\n children,\n}: {\n testId: string,\n children: React.ReactNode,\n}) => {\n const { formatMessage } = useIntl();\n return (\n <div className=\"promo-code__banner\" data-testid={testId}>\n <span className=\"promo-code__banner-text\">{children}</span>\n <Icon\n src={InfoOutline}\n className=\"promo-code__banner-icon\"\n screenReaderText={formatMessage(messages.bannerInfo)}\n />\n </div>\n );\n};\n\nconst PromoCode = ({\n value,\n onChange,\n onApply,\n onRemove,\n appliedCode = null,\n discount = null,\n offer = null,\n error = null,\n isApplying = false,\n disabled = false,\n}: PromoCodeProps) => {\n const { formatMessage } = useIntl();\n const [focused, setFocused] = useState(false);\n const trimmed = value.trim();\n const canApply = !disabled && !isApplying && trimmed.length > 0;\n const offerMatchesField = !trimmed\n || (!!offer && trimmed.toLowerCase() === offer.code.toLowerCase());\n // A discount on the line without a coupon code means the backend omitted the\n // code string but the coupon is still active — show the applied state.\n const hasAppliedState = !!appliedCode || !!discount;\n const showOffer = !hasAppliedState && !!offer && offerMatchesField;\n\n const handleSubmit = (event: React.FormEvent) => {\n event.preventDefault();\n if (canApply) onApply();\n };\n\n return (\n <div className=\"promo-code\">\n {hasAppliedState && discount ? (\n <PromoBanner testId=\"promo-applied-banner\">\n {formatMessage(messages.discountAppliedBanner)}\n </PromoBanner>\n ) : null}\n {appliedCode && !discount ? (\n <PromoBanner testId=\"promo-applied-banner\">\n {formatMessage(messages.couponApplied, { code: appliedCode })}\n </PromoBanner>\n ) : null}\n {showOffer && offer ? (\n <PromoBanner testId=\"promo-offer-banner\">\n {formatMessage(messages.saveWithCode, { percent: offer.percent, code: offer.code })}\n </PromoBanner>\n ) : null}\n\n {hasAppliedState ? (\n <div className=\"promo-code__applied\">\n {appliedCode && discount ? (\n <p className=\"promo-code__celebration\">\n <span aria-hidden=\"true\">🎉</span>\n {formatMessage(messages.couponApplied, { code: appliedCode })}\n </p>\n ) : null}\n {discount ? (\n <>\n <hr className=\"promo-code__divider\" />\n <div className=\"promo-code__discount-row\" data-testid=\"promo-discount-row\">\n <span className=\"promo-code__discount-label\">\n {formatMessage(messages.discountApplied)}\n <Icon src={Check} className=\"promo-code__check\" aria-hidden />\n </span>\n {onRemove ? (\n <button\n type=\"button\"\n className=\"promo-code__remove\"\n onClick={onRemove}\n disabled={disabled || isApplying}\n >\n {formatMessage(messages.remove)}\n </button>\n ) : null}\n <span className=\"promo-code__amount\">\n {formatMessage(messages.discountAmount, {\n amount: discount.amount.toFixed(2),\n currency: discount.currency,\n })}\n </span>\n </div>\n </>\n ) : onRemove && (\n <button\n type=\"button\"\n className=\"promo-code__remove\"\n onClick={onRemove}\n disabled={disabled || isApplying}\n >\n {formatMessage(messages.remove)}\n </button>\n )}\n </div>\n ) : (\n <form className=\"promo-code__form\" onSubmit={handleSubmit}>\n <div className={`promo-code__field${focused || value ? ' promo-code__field--active' : ''}${error ? ' promo-code__field--error' : ''}`}>\n <label htmlFor=\"promoCode\" className=\"promo-code__label\">\n {formatMessage(messages.placeholder)}\n </label>\n <input\n id=\"promoCode\"\n type=\"text\"\n className=\"promo-code__input\"\n value={value}\n onChange={(e) => onChange(e.target.value)}\n onFocus={() => setFocused(true)}\n onBlur={() => setFocused(false)}\n disabled={disabled || isApplying}\n aria-invalid={!!error}\n aria-describedby={error ? 'promoCode-error' : undefined}\n />\n </div>\n <button\n type=\"submit\"\n disabled={!canApply}\n className=\"promo-code__apply\"\n >\n {isApplying\n ? formatMessage(messages.applying)\n : formatMessage(messages.apply)}\n </button>\n </form>\n )}\n {error && (\n <div id=\"promoCode-error\" className=\"promo-code__error\" role=\"alert\">\n <span className=\"promo-code__error-icon\" aria-hidden=\"true\" />\n {error}\n </div>\n )}\n </div>\n );\n};\n\nexport default PromoCode;\n"]}
|
|
1
|
+
{"version":3,"file":"PromoCode.js","sourceRoot":"","sources":["../../../src/components/PromoCode/PromoCode.tsx"],"names":[],"mappings":";AAAA,OAAc,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACxC,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AACxC,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,QAAQ,MAAM,YAAY,CAAC;AA+BlC,MAAM,WAAW,GAAG,CAAC,EACnB,MAAM,EACN,QAAQ,GAIT,EAAE,EAAE;IACH,MAAM,EAAE,aAAa,EAAE,GAAG,OAAO,EAAE,CAAC;IACpC,OAAO,CACL,eAAK,SAAS,EAAC,oBAAoB,iBAAc,MAAM,aACrD,aAAI,SAAS,EAAC,yBAAyB,YAAE,QAAQ,GAAM,EACvD,KAAC,IAAI,IACH,GAAG,EAAE,WAAW,EAChB,SAAS,EAAC,yBAAyB,EACnC,gBAAgB,EAAE,aAAa,CAAC,QAAQ,CAAC,UAAU,CAAC,GACpD,IACE,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,SAAS,GAAG,CAAC,EACjB,KAAK,EACL,QAAQ,EACR,OAAO,EACP,QAAQ,EACR,WAAW,GAAG,IAAI,EAClB,QAAQ,GAAG,IAAI,EACf,KAAK,GAAG,IAAI,EACZ,KAAK,GAAG,IAAI,EACZ,UAAU,GAAG,KAAK,EAClB,QAAQ,GAAG,KAAK,GACD,EAAE,EAAE;IACnB,MAAM,EAAE,aAAa,EAAE,GAAG,OAAO,EAAE,CAAC;IACpC,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAC9C,MAAM,OAAO,GAAG,KAAK,CAAC,IA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AC7D,KAAK,IACF,CACP,IACG,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,SAAS,CAAC","sourcesContent":["import React, { useState } from 'react';\nimport { Icon } from '@openedx/paragon';\nimport { Check, InfoOutline } from '@openedx/paragon/icons';\nimport { useIntl } from '@openedx/frontend-base';\nimport messages from './Messages';\n\nexport interface PromoDiscount {\n /** Whole-number percent off, e.g. 15. */\n percent: number,\n amount: number,\n currency: string,\n}\n\n/** A known offer advertised before the learner applies it. */\nexport interface PromoOffer {\n code: string,\n percent: number,\n}\n\nexport interface PromoCodeProps {\n value: string,\n onChange: (value: string) => void,\n onApply: () => void,\n /** Clears an applied coupon (sends empty string to the API). */\n onRemove?: () => void,\n appliedCode?: string | null,\n /** Applied coupon's discount. Drives the applied banner and amount row. */\n discount?: PromoDiscount | null,\n /** Shown on the empty field when we already know a code and its percent. */\n offer?: PromoOffer | null,\n error?: string | null,\n isApplying?: boolean,\n disabled?: boolean,\n}\n\nconst PromoBanner = ({\n testId,\n children,\n}: {\n testId: string,\n children: React.ReactNode,\n}) => {\n const { formatMessage } = useIntl();\n return (\n <div className=\"promo-code__banner\" data-testid={testId}>\n <h3 className=\"promo-code__banner-text\">{children}</h3>\n <Icon\n src={InfoOutline}\n className=\"promo-code__banner-icon\"\n screenReaderText={formatMessage(messages.bannerInfo)}\n />\n </div>\n );\n};\n\nconst PromoCode = ({\n value,\n onChange,\n onApply,\n onRemove,\n appliedCode = null,\n discount = null,\n offer = null,\n error = null,\n isApplying = false,\n disabled = false,\n}: PromoCodeProps) => {\n const { formatMessage } = useIntl();\n const [focused, setFocused] = useState(false);\n const trimmed = value.trim();\n const canApply = !disabled && !isApplying && trimmed.length > 0;\n const offerMatchesField = !trimmed\n || (!!offer && trimmed.toLowerCase() === offer.code.toLowerCase());\n // A discount on the line without a coupon code means the backend omitted the\n // code string but the coupon is still active — show the applied state.\n const hasAppliedState = !!appliedCode || !!discount;\n const showOffer = !hasAppliedState && !!offer && offerMatchesField;\n\n const handleSubmit = (event: React.FormEvent) => {\n event.preventDefault();\n if (canApply) onApply();\n };\n\n return (\n <div className=\"promo-code\">\n {hasAppliedState && discount ? (\n <PromoBanner testId=\"promo-applied-banner\">\n {formatMessage(messages.discountAppliedBanner)}\n </PromoBanner>\n ) : null}\n {appliedCode && !discount ? (\n <PromoBanner testId=\"promo-applied-banner\">\n {formatMessage(messages.couponApplied, { code: appliedCode })}\n </PromoBanner>\n ) : null}\n {showOffer && offer ? (\n <PromoBanner testId=\"promo-offer-banner\">\n {formatMessage(messages.saveWithCode, { percent: offer.percent, code: offer.code })}\n </PromoBanner>\n ) : null}\n\n {hasAppliedState ? (\n <div className=\"promo-code__applied\">\n {appliedCode && discount ? (\n <p className=\"promo-code__celebration\">\n <span aria-hidden=\"true\">🎉</span>\n {formatMessage(messages.couponApplied, { code: appliedCode })}\n </p>\n ) : null}\n {discount ? (\n <>\n <hr className=\"promo-code__divider\" />\n <div className=\"promo-code__discount-row\" data-testid=\"promo-discount-row\">\n <span className=\"promo-code__discount-label\">\n {formatMessage(messages.discountApplied)}\n <Icon src={Check} className=\"promo-code__check\" aria-hidden />\n </span>\n {onRemove ? (\n <button\n type=\"button\"\n className=\"promo-code__remove\"\n onClick={onRemove}\n disabled={disabled || isApplying}\n >\n {formatMessage(messages.remove)}\n </button>\n ) : null}\n <span className=\"promo-code__amount\">\n {formatMessage(messages.discountAmount, {\n amount: discount.amount.toFixed(2),\n currency: discount.currency,\n })}\n </span>\n </div>\n </>\n ) : onRemove && (\n <button\n type=\"button\"\n className=\"promo-code__remove\"\n onClick={onRemove}\n disabled={disabled || isApplying}\n >\n {formatMessage(messages.remove)}\n </button>\n )}\n </div>\n ) : (\n <form className=\"promo-code__form\" onSubmit={handleSubmit}>\n <div className={`promo-code__field${focused || value ? ' promo-code__field--active' : ''}${error ? ' promo-code__field--error' : ''}`}>\n <label htmlFor=\"promoCode\" className=\"promo-code__label\">\n {formatMessage(messages.placeholder)}\n </label>\n <input\n id=\"promoCode\"\n type=\"text\"\n className=\"promo-code__input\"\n value={value}\n onChange={(e) => onChange(e.target.value)}\n onFocus={() => setFocused(true)}\n onBlur={() => setFocused(false)}\n disabled={disabled || isApplying}\n aria-invalid={!!error}\n aria-describedby={error ? 'promoCode-error' : undefined}\n />\n </div>\n <button\n type=\"submit\"\n disabled={!canApply}\n className=\"promo-code__apply\"\n >\n {isApplying\n ? formatMessage(messages.applying)\n : formatMessage(messages.apply)}\n </button>\n </form>\n )}\n {error && (\n <div id=\"promoCode-error\" className=\"promo-code__error\" role=\"alert\">\n <span className=\"promo-code__error-icon\" aria-hidden=\"true\" />\n {error}\n </div>\n )}\n </div>\n );\n};\n\nexport default PromoCode;\n"]}
|
package/dist/routes.js
CHANGED
|
@@ -61,6 +61,33 @@ const routes = [
|
|
|
61
61
|
},
|
|
62
62
|
],
|
|
63
63
|
},
|
|
64
|
+
{
|
|
65
|
+
id: 'org.openedx.frontend.route.template.main.aca-order-history',
|
|
66
|
+
path: 'aca-order-history',
|
|
67
|
+
loader: protectedLoader,
|
|
68
|
+
handle: {
|
|
69
|
+
roles: [acaCheckoutRole],
|
|
70
|
+
},
|
|
71
|
+
lazy() {
|
|
72
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
73
|
+
const module = yield import(
|
|
74
|
+
/* webpackChunkName: "template-main" */ './Main');
|
|
75
|
+
return { Component: module.default };
|
|
76
|
+
});
|
|
77
|
+
},
|
|
78
|
+
children: [
|
|
79
|
+
{
|
|
80
|
+
index: true,
|
|
81
|
+
lazy() {
|
|
82
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
83
|
+
const module = yield import(
|
|
84
|
+
/* webpackChunkName: "OrderHistory" */ './components/OrderHistory/OrderHistory');
|
|
85
|
+
return { Component: module.default };
|
|
86
|
+
});
|
|
87
|
+
},
|
|
88
|
+
},
|
|
89
|
+
],
|
|
90
|
+
},
|
|
64
91
|
];
|
|
65
92
|
export default routes;
|
|
66
93
|
//# sourceMappingURL=routes.js.map
|
package/dist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E,IAAI;gBACL,IAAI;;wBACR,MAAM,MAAM,GAAG,MAAM,MAAM;wBACzB,sCAAsC,CAAC,6BAA6B,CACrE,CAAC;wBACF,OAAO,EAAE,SAAS,EAAE,MAAM,CAAC,OAAO,EAAE,CAAC;oBACvC,CAAC;iBAAA;aACF;SACF;KACF;CACF,CAAC;AAEF,eAAe,MAAM,CAAC","sourcesContent":["import {\n authenticatedLoader,\n} from '@openedx/frontend-base';\n\nimport { acaCheckoutRole } from './constants';\n\n/**\n * LMS JWT cookies are host-bound to localhost:18000. On https://localhost or an\n * ngrok tunnel they are missing, so authenticatedLoader sends you to LMS login\n * → usually /dashboard. DEV_MOCK_SESSION covers Viax tokens for that case.\n *\n * Do not use getAppConfig() here — app configs are registered after the router\n * is created, so the first loader pass often sees an empty config and still\n * redirects. Use the request hostname instead.\n */\nconst shouldSkipLmsCookieAuth = (requestUrl: string): boolean => {\n const { hostname } = new URL(requestUrl);\n return hostname === 'localhost'\n || hostname === '127.0.0.1'\n || hostname.endsWith('.ngrok-free.app')\n || hostname.endsWith('.ngrok-free.dev')\n || hostname.endsWith('.ngrok.app')\n || hostname.endsWith('.ngrok.io');\n};\n\nconst protectedLoader = async (args) => {\n if (!shouldSkipLmsCookieAuth(args.request.url)) {\n await authenticatedLoader(args);\n }\n\n return null;\n};\n\nconst routes = [\n {\n id: 'org.openedx.frontend.route.template.main.aca-checkout',\n path: 'aca-checkout',\n loader: protectedLoader,\n handle: {\n roles: [acaCheckoutRole],\n },\n async lazy() {\n const module = await import(\n /* webpackChunkName: \"template-main\" */ './Main'\n );\n return { Component: module.default };\n },\n children: [\n {\n index: true,\n async lazy() {\n const module = await import(\n /* webpackChunkName: \"CheckoutPage\" */ './checkoutPage/CheckoutPage'\n );\n return { Component: module.default };\n },\n },\n ],\n },\n];\n\nexport default routes;\n"]}
|
|
1
|
+
{"version":3,"file":"routes.js","sourceRoot":"","sources":["../src/routes.tsx"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EACL,m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CAAC,OAAO,EAAE,CAAC;oBACvC,CAAC;iBAAA;aACF;SACF;KACF;IACD;QACE,EAAE,EAAE,4DAA4D;QAChE,IAAI,EAAE,mBAAmB;QACzB,MAAM,EAAE,eAAe;QACvB,MAAM,EAAE;YACN,KAAK,EAAE,CAAC,eAAe,CAAC;SACzB;QACK,IAAI;;gBACR,MAAM,MAAM,GAAG,MAAM,MAAM;gBACzB,uCAAuC,CAAC,QAAQ,CACjD,CAAC;gBACF,OAAO,EAAE,SAAS,EAAE,MAAM,CAAC,OAAO,EAAE,CAAC;YACvC,CAAC;SAAA;QACD,QAAQ,EAAE;YACR;gBACE,KAAK,EAAE,IAAI;gBACL,IAAI;;wBACR,MAAM,MAAM,GAAG,MAAM,MAAM;wBACzB,sCAAsC,CAAC,wCAAwC,CAChF,CAAC;wBACF,OAAO,EAAE,SAAS,EAAE,MAAM,CAAC,OAAO,EAAE,CAAC;oBACvC,CAAC;iBAAA;aACF;SACF;KACF;CACF,CAAC;AAEF,eAAe,MAAM,CAAC","sourcesContent":["import {\n authenticatedLoader,\n} from '@openedx/frontend-base';\n\nimport { acaCheckoutRole } from './constants';\n\n/**\n * LMS JWT cookies are host-bound to localhost:18000. On https://localhost or an\n * ngrok tunnel they are missing, so authenticatedLoader sends you to LMS login\n * → usually /dashboard. DEV_MOCK_SESSION covers Viax tokens for that case.\n *\n * Do not use getAppConfig() here — app configs are registered after the router\n * is created, so the first loader pass often sees an empty config and still\n * redirects. Use the request hostname instead.\n */\nconst shouldSkipLmsCookieAuth = (requestUrl: string): boolean => {\n const { hostname } = new URL(requestUrl);\n return hostname === 'localhost'\n || hostname === '127.0.0.1'\n || hostname.endsWith('.ngrok-free.app')\n || hostname.endsWith('.ngrok-free.dev')\n || hostname.endsWith('.ngrok.app')\n || hostname.endsWith('.ngrok.io');\n};\n\nconst protectedLoader = async (args) => {\n if (!shouldSkipLmsCookieAuth(args.request.url)) {\n await authenticatedLoader(args);\n }\n\n return null;\n};\n\nconst routes = [\n {\n id: 'org.openedx.frontend.route.template.main.aca-checkout',\n path: 'aca-checkout',\n loader: protectedLoader,\n handle: {\n roles: [acaCheckoutRole],\n },\n async lazy() {\n const module = await import(\n /* webpackChunkName: \"template-main\" */ './Main'\n );\n return { Component: module.default };\n },\n children: [\n {\n index: true,\n async lazy() {\n const module = await import(\n /* webpackChunkName: \"CheckoutPage\" */ './checkoutPage/CheckoutPage'\n );\n return { Component: module.default };\n },\n },\n ],\n },\n {\n id: 'org.openedx.frontend.route.template.main.aca-order-history',\n path: 'aca-order-history',\n loader: protectedLoader,\n handle: {\n roles: [acaCheckoutRole],\n },\n async lazy() {\n const module = await import(\n /* webpackChunkName: \"template-main\" */ './Main'\n );\n return { Component: module.default };\n },\n children: [\n {\n index: true,\n async lazy() {\n const module = await import(\n /* webpackChunkName: \"OrderHistory\" */ './components/OrderHistory/OrderHistory'\n );\n return { Component: module.default };\n },\n },\n ],\n },\n];\n\nexport default routes;\n"]}
|
package/dist/style.scss
CHANGED
|
@@ -18,4 +18,5 @@
|
|
|
18
18
|
@use "./styles/components/alacarteNotice.scss";
|
|
19
19
|
@use "./styles/components/alacarteConfirmation.scss";
|
|
20
20
|
@use "./styles/components/orderBlockedModal.scss";
|
|
21
|
+
@use "./styles/components/orderHistory.scss";
|
|
21
22
|
@use "./styles/components/alacarteDebugPanel.scss"; // TEMPORARY — remove alongside AlacarteDebugPanel.
|
|
@@ -72,6 +72,14 @@
|
|
|
72
72
|
padding: 1rem;
|
|
73
73
|
}
|
|
74
74
|
|
|
75
|
+
// Order number / Purchase date — semantic <h2>s styled as bold body text.
|
|
76
|
+
&__detail-heading {
|
|
77
|
+
font-family: inherit;
|
|
78
|
+
font-size: inherit;
|
|
79
|
+
line-height: inherit;
|
|
80
|
+
color: inherit;
|
|
81
|
+
}
|
|
82
|
+
|
|
75
83
|
&__about-title {
|
|
76
84
|
font-size: 1.125rem;
|
|
77
85
|
font-weight: 700;
|
|
@@ -80,6 +88,8 @@
|
|
|
80
88
|
}
|
|
81
89
|
|
|
82
90
|
&__courses-included {
|
|
91
|
+
font-family: inherit;
|
|
92
|
+
line-height: inherit;
|
|
83
93
|
font-size: 1rem;
|
|
84
94
|
font-weight: 600;
|
|
85
95
|
color: #000000;
|
|
@@ -91,6 +101,8 @@
|
|
|
91
101
|
}
|
|
92
102
|
|
|
93
103
|
&__previously-purchased-heading {
|
|
104
|
+
font-family: inherit;
|
|
105
|
+
line-height: inherit;
|
|
94
106
|
font-size: 1rem;
|
|
95
107
|
font-weight: 700;
|
|
96
108
|
font-style: italic;
|
|
@@ -9,6 +9,13 @@
|
|
|
9
9
|
margin-top: 32px;
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
+
// Semantic <h2> styled as the surrounding body text, not Paragon's h2 scale.
|
|
13
|
+
&__heading {
|
|
14
|
+
font-family: inherit;
|
|
15
|
+
font-size: inherit;
|
|
16
|
+
line-height: inherit;
|
|
17
|
+
}
|
|
18
|
+
|
|
12
19
|
&__stats {
|
|
13
20
|
display: flex;
|
|
14
21
|
gap: 1.5rem;
|