@edx/frontend-app-alacarte-checkout 1.66.0 → 1.68.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 +1 -1
- package/dist/components/AlacarteConfirmation/AlacarteConfirmation.js.map +1 -1
- package/dist/components/CartSummary/CartSummary.js +9 -5
- package/dist/components/CartSummary/CartSummary.js.map +1 -1
- package/dist/components/CartSummary/Messages.d.ts +10 -0
- package/dist/components/CartSummary/Messages.js +10 -0
- package/dist/components/CartSummary/Messages.js.map +1 -1
- package/dist/components/Checkout/Checkout.d.ts +3 -1
- package/dist/components/Checkout/Checkout.js +29 -11
- package/dist/components/Checkout/Checkout.js.map +1 -1
- package/dist/components/Checkout/Messages.d.ts +10 -0
- package/dist/components/Checkout/Messages.js +11 -1
- package/dist/components/Checkout/Messages.js.map +1 -1
- package/dist/components/CheckoutGate/CheckoutGate.d.ts +0 -2
- package/dist/components/CheckoutGate/CheckoutGate.js +1 -1
- package/dist/components/CheckoutGate/CheckoutGate.js.map +1 -1
- package/dist/components/PaymentForm/PaymentForm.js +9 -4
- package/dist/components/PaymentForm/PaymentForm.js.map +1 -1
- package/dist/style.scss +1 -0
- package/dist/styles/_srOverlay.scss +17 -0
- package/package.json +1 -1
|
@@ -94,7 +94,7 @@ const AlacarteConfirmation = ({ order, awaiting, error, onContinue, productDetai
|
|
|
94
94
|
.map((c) => { var _a; return (_a = c.name) === null || _a === void 0 ? void 0 : _a.trim(); })
|
|
95
95
|
.filter((name) => !!name && !purchasedNameSet.has(normalizeCourseName(name)));
|
|
96
96
|
const programCourseTotal = (_v = (_u = programDetail === null || programDetail === void 0 ? void 0 : programDetail.tCourses) === null || _u === void 0 ? void 0 : _u.length) !== null && _v !== void 0 ? _v : (purchasedCourseNames.length + previouslyPurchased.length);
|
|
97
|
-
const summaryCard = (_jsxs("
|
|
97
|
+
const summaryCard = (_jsxs("div", { className: "alacarte-confirmation__summary", children: [_jsx("h2", { className: "alacarte-confirmation__summary-title font-weight-bold mb-0", children: formatMessage(messages.purchaseSummary) }), _jsx("hr", { className: "alacarte-confirmation__summary-divider" }), _jsxs("div", { className: "alacarte-confirmation__product d-flex align-items-start", children: [orgLogo ? (_jsx("img", { src: orgLogo, alt: "", "aria-hidden": "true", className: "alacarte-confirmation__org-logo" })) : (_jsx("div", { className: "alacarte-confirmation__org-logo alacarte-confirmation__org-logo--placeholder", "aria-hidden": true })), _jsxs("div", { children: [_jsxs("span", { className: "alacarte-confirmation__badge", children: [_jsx(Icon, { src: Monitor, className: "alacarte-confirmation__badge-icon", "aria-hidden": "true" }), formatMessage(messages.verifiedCertificate)] }), _jsx("p", { className: "alacarte-confirmation__product-name font-weight-bold mb-0", children: productLabel })] })] }), _jsx("hr", { className: "alacarte-confirmation__summary-divider" }), _jsxs("div", { className: "alacarte-confirmation__price-row", children: [_jsx("span", { children: formatMessage(messages.subtotal) }), _jsx("span", { children: money(subtotal) })] }), discount > 0 && (_jsxs("div", { className: "alacarte-confirmation__price-row alacarte-confirmation__price-row--discount", children: [_jsx("span", { children: formatMessage(messages.discountsApplied) }), _jsx("span", { children: formatMessage(messages.discountAmount, {
|
|
98
98
|
amount: discount.toFixed(2),
|
|
99
99
|
currency,
|
|
100
100
|
}) })] })), _jsxs("div", { className: "alacarte-confirmation__price-row alacarte-confirmation__price-row--paid", children: [_jsx("span", { children: formatMessage(messages.amountPaid) }), _jsx("span", { children: money(paid) })] })] }));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AlacarteConfirmation.js","sourceRoot":"","sources":["../../../src/components/AlacarteConfirmation/AlacarteConfirmation.tsx"],"names":[],"mappings":";AAAA,OAAc,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAC1D,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAC;A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AAY,CAAC,GAClC,EACL,YAAG,SAAS,EAAC,iBAAiB,YAAE,YAAY,aAAZ,YAAY,cAAZ,YAAY,GAAI,EAAE,GAAK,IACnD,IACF,IACF,EAEN,aAAI,SAAS,EAAC,gCAAgC,GAAG,EACjD,YAAG,SAAS,EAAC,qDAAqD,YAC/D,aAAa,CAAC,QAAQ,CAAC,YAAY,EAAE;gCACpC,KAAK,EAAE,CACL,YACE,IAAI,EAAE,UAAU,qBAAqB,EAAE,gBAC3B,aAAa,CAAC,QAAQ,CAAC,iBAAiB,CAAC,YAEpD,qBAAqB,GACpB,CACL;gCACD,YAAY,EAAE,CACZ,YACE,IAAI,EAAE,iBAAiB,EACvB,MAAM,EAAC,QAAQ,EACf,GAAG,EAAC,qBAAqB,gBACb,aAAa,CAAC,QAAQ,CAAC,iBAAiB,CAAC,YAEpD,aAAa,CAAC,QAAQ,CAAC,YAAY,CAAC,GACnC,CACL;6BACF,CAAC,GACA,IACA,IACF,GACF,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,oBAAoB,CAAC","sourcesContent":["import React, { useEffect, useMemo, useRef } 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 { BILLING_SUPPORT_EMAIL, REFUND_POLICY_URL } from '../../constants';\nimport { ProcessingScreen } from '../StatusScreens/StatusScreens';\nimport type { CourseDetail } from '../../types';\nimport type {\n AlacarteProgramOwnedCourse, PlacedOrder, ProductDetail, ProgramDetail,\n} from '../../types/alacarte';\nimport { normalizeCourseName, purchasedProgramCourseNames } from '../../utils/programOrderCourses';\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 the purchase date. */\n placedAt?: string | null,\n}\n\nfunction isProgramDetail(detail: ProductDetail | null): detail is ProgramDetail {\n return !!detail && 'tCourses' in detail;\n}\n\nfunction isProgramOrder(order: PlacedOrder, productDetail: ProductDetail | null): boolean {\n return isProgramDetail(productDetail)\n || 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\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\n // Checkout swaps to this view in place, unmounting the focused Pay now\n // button. Start keyboard and screen reader users at the headline so the\n // next Tab reaches the CTAs instead of restarting from the site header.\n const headlineRef = useRef<HTMLHeadingElement>(null);\n const hasOrder = !!order;\n useEffect(() => {\n if (hasOrder) headlineRef.current?.focus();\n }, [hasOrder]);\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, productDetail);\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 linePurchased = programOrder\n ? order.lines.map((line) => line.name?.trim()).filter((name): name is string => !!name)\n : [];\n // Partial program: catalog courses the learner does not already own are\n // the ones this order bought, when that count matches the order lines.\n const catalogPurchased = programOrder && isProgramDetail(programDetail)\n ? purchasedProgramCourseNames(programDetail.tCourses, ownedCourses ?? [], order.lines.length)\n : null;\n const purchasedCourseNames = catalogPurchased ?? linePurchased;\n const purchasedNameSet = new Set(purchasedCourseNames.map(normalizeCourseName));\n\n const previouslyPurchased = purchasedCourseNames.length === 0\n ? []\n : (ownedCourses ?? [])\n .map((c) => c.name?.trim())\n .filter((name): name is string => !!name && !purchasedNameSet.has(normalizeCourseName(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 {/* Decorative — the institution is named in the product title. */}\n {orgLogo ? (\n <img\n src={orgLogo}\n alt=\"\"\n aria-hidden=\"true\"\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\" aria-hidden=\"true\" />\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 {/* DOM order is the reading order on every breakpoint: intro, purchase\n summary, then order details. From lg up, the grid in\n alacarteConfirmation.scss moves the summary to the right column. */}\n <Row className=\"alacarte-confirmation__row\">\n <Col xs={12} className=\"alacarte-confirmation__main alacarte-confirmation__intro\">\n <h1\n ref={headlineRef}\n tabIndex={-1}\n className=\"alacarte-confirmation__headline font-weight-bold mb-4\"\n >\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\n href={orderHistoryUrl}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n className=\"alacarte-confirmation__order-history\"\n aria-label={formatMessage(messages.viewOrderHistoryLabel)}\n >\n {formatMessage(messages.viewOrderHistory)}\n </a>\n )}\n </div>\n </Col>\n\n <Col xs={12} className=\"alacarte-confirmation__summary-col\">\n {summaryCard}\n </Col>\n\n <Col xs={12} className=\"alacarte-confirmation__main alacarte-confirmation__details\">\n {programOrder && (purchasedCourseNames.length > 0 || previouslyPurchased.length > 0) && (\n <div className=\"alacarte-confirmation__about-program mb-5\">\n <h3 className=\"alacarte-confirmation__about-title\">\n {formatMessage(messages.aboutProgram)}\n </h3>\n {purchasedCourseNames.length > 0 && (\n <>\n <h4 className=\"alacarte-confirmation__courses-included\">\n {formatMessage(messages.coursesIncluded, { count: programCourseTotal })}\n </h4>\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 <h4 className=\"alacarte-confirmation__previously-purchased-heading\">\n {formatMessage(messages.previouslyPurchased, {\n count: previouslyPurchased.length,\n })}\n </h4>\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 <h3 className=\"h5 font-weight-bold mb-3\">\n {formatMessage(messages.whatsIncluded)}\n </h3>\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 <h3 className=\"alacarte-confirmation__detail-heading font-weight-bold mb-0\">\n {formatMessage(messages.orderNumber)}\n </h3>\n <p className=\"text-muted mb-0\">{order.orderNumber}</p>\n </div>\n <div>\n <h3 className=\"alacarte-confirmation__detail-heading font-weight-bold mb-0\">\n {formatMessage(messages.purchaseDate)}\n </h3>\n <p className=\"text-muted mb-0\">{purchaseDate ?? ''}</p>\n </div>\n </Col>\n </Row>\n\n <hr className=\"alacarte-confirmation__divider\" />\n <p className=\"alacarte-confirmation__refund text-muted small mb-0\">\n {formatMessage(messages.refundNotice, {\n email: (\n <a\n href={`mailto:${BILLING_SUPPORT_EMAIL}`}\n aria-label={formatMessage(messages.billingEmailLabel)}\n >\n {BILLING_SUPPORT_EMAIL}\n </a>\n ),\n refundPolicy: (\n <a\n href={REFUND_POLICY_URL}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n aria-label={formatMessage(messages.refundPolicyLabel)}\n >\n {formatMessage(messages.refundPolicy)}\n </a>\n ),\n })}\n </p>\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,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAC1D,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAC;AACjE,OAAO,EAAE,KAAK,IAAI,SAAS,EAAE,OAAO,EAA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E,GAAK,IACnD,IACF,IACF,EAEN,aAAI,SAAS,EAAC,gCAAgC,GAAG,EACjD,YAAG,SAAS,EAAC,qDAAqD,YAC/D,aAAa,CAAC,QAAQ,CAAC,YAAY,EAAE;gCACpC,KAAK,EAAE,CACL,YACE,IAAI,EAAE,UAAU,qBAAqB,EAAE,gBAC3B,aAAa,CAAC,QAAQ,CAAC,iBAAiB,CAAC,YAEpD,qBAAqB,GACpB,CACL;gCACD,YAAY,EAAE,CACZ,YACE,IAAI,EAAE,iBAAiB,EACvB,MAAM,EAAC,QAAQ,EACf,GAAG,EAAC,qBAAqB,gBACb,aAAa,CAAC,QAAQ,CAAC,iBAAiB,CAAC,YAEpD,aAAa,CAAC,QAAQ,CAAC,YAAY,CAAC,GACnC,CACL;6BACF,CAAC,GACA,IACA,IACF,GACF,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,oBAAoB,CAAC","sourcesContent":["import React, { useEffect, useMemo, useRef } 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 { BILLING_SUPPORT_EMAIL, REFUND_POLICY_URL } from '../../constants';\nimport { ProcessingScreen } from '../StatusScreens/StatusScreens';\nimport type { CourseDetail } from '../../types';\nimport type {\n AlacarteProgramOwnedCourse, PlacedOrder, ProductDetail, ProgramDetail,\n} from '../../types/alacarte';\nimport { normalizeCourseName, purchasedProgramCourseNames } from '../../utils/programOrderCourses';\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 the purchase date. */\n placedAt?: string | null,\n}\n\nfunction isProgramDetail(detail: ProductDetail | null): detail is ProgramDetail {\n return !!detail && 'tCourses' in detail;\n}\n\nfunction isProgramOrder(order: PlacedOrder, productDetail: ProductDetail | null): boolean {\n return isProgramDetail(productDetail)\n || 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\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\n // Checkout swaps to this view in place, unmounting the focused Pay now\n // button. Start keyboard and screen reader users at the headline so the\n // next Tab reaches the CTAs instead of restarting from the site header.\n const headlineRef = useRef<HTMLHeadingElement>(null);\n const hasOrder = !!order;\n useEffect(() => {\n if (hasOrder) headlineRef.current?.focus();\n }, [hasOrder]);\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, productDetail);\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 linePurchased = programOrder\n ? order.lines.map((line) => line.name?.trim()).filter((name): name is string => !!name)\n : [];\n // Partial program: catalog courses the learner does not already own are\n // the ones this order bought, when that count matches the order lines.\n const catalogPurchased = programOrder && isProgramDetail(programDetail)\n ? purchasedProgramCourseNames(programDetail.tCourses, ownedCourses ?? [], order.lines.length)\n : null;\n const purchasedCourseNames = catalogPurchased ?? linePurchased;\n const purchasedNameSet = new Set(purchasedCourseNames.map(normalizeCourseName));\n\n const previouslyPurchased = purchasedCourseNames.length === 0\n ? []\n : (ownedCourses ?? [])\n .map((c) => c.name?.trim())\n .filter((name): name is string => !!name && !purchasedNameSet.has(normalizeCourseName(name)));\n\n const programCourseTotal = programDetail?.tCourses?.length\n ?? (purchasedCourseNames.length + previouslyPurchased.length);\n\n const summaryCard = (\n <div className=\"alacarte-confirmation__summary\">\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 {/* Decorative — the institution is named in the product title. */}\n {orgLogo ? (\n <img\n src={orgLogo}\n alt=\"\"\n aria-hidden=\"true\"\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\" aria-hidden=\"true\" />\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 </div>\n );\n\n return (\n <div className=\"alacarte-confirmation\" data-testid=\"alacarte-confirmation\">\n {/* DOM order is the reading order on every breakpoint: intro, purchase\n summary, then order details. From lg up, the grid in\n alacarteConfirmation.scss moves the summary to the right column. */}\n <Row className=\"alacarte-confirmation__row\">\n <Col xs={12} className=\"alacarte-confirmation__main alacarte-confirmation__intro\">\n <h1\n ref={headlineRef}\n tabIndex={-1}\n className=\"alacarte-confirmation__headline font-weight-bold mb-4\"\n >\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\n href={orderHistoryUrl}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n className=\"alacarte-confirmation__order-history\"\n aria-label={formatMessage(messages.viewOrderHistoryLabel)}\n >\n {formatMessage(messages.viewOrderHistory)}\n </a>\n )}\n </div>\n </Col>\n\n <Col xs={12} className=\"alacarte-confirmation__summary-col\">\n {summaryCard}\n </Col>\n\n <Col xs={12} className=\"alacarte-confirmation__main alacarte-confirmation__details\">\n {programOrder && (purchasedCourseNames.length > 0 || previouslyPurchased.length > 0) && (\n <div className=\"alacarte-confirmation__about-program mb-5\">\n <h3 className=\"alacarte-confirmation__about-title\">\n {formatMessage(messages.aboutProgram)}\n </h3>\n {purchasedCourseNames.length > 0 && (\n <>\n <h4 className=\"alacarte-confirmation__courses-included\">\n {formatMessage(messages.coursesIncluded, { count: programCourseTotal })}\n </h4>\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 <h4 className=\"alacarte-confirmation__previously-purchased-heading\">\n {formatMessage(messages.previouslyPurchased, {\n count: previouslyPurchased.length,\n })}\n </h4>\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 <h3 className=\"h5 font-weight-bold mb-3\">\n {formatMessage(messages.whatsIncluded)}\n </h3>\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 <h3 className=\"alacarte-confirmation__detail-heading font-weight-bold mb-0\">\n {formatMessage(messages.orderNumber)}\n </h3>\n <p className=\"text-muted mb-0\">{order.orderNumber}</p>\n </div>\n <div>\n <h3 className=\"alacarte-confirmation__detail-heading font-weight-bold mb-0\">\n {formatMessage(messages.purchaseDate)}\n </h3>\n <p className=\"text-muted mb-0\">{purchaseDate ?? ''}</p>\n </div>\n </Col>\n </Row>\n\n <hr className=\"alacarte-confirmation__divider\" />\n <p className=\"alacarte-confirmation__refund text-muted small mb-0\">\n {formatMessage(messages.refundNotice, {\n email: (\n <a\n href={`mailto:${BILLING_SUPPORT_EMAIL}`}\n aria-label={formatMessage(messages.billingEmailLabel)}\n >\n {BILLING_SUPPORT_EMAIL}\n </a>\n ),\n refundPolicy: (\n <a\n href={REFUND_POLICY_URL}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n aria-label={formatMessage(messages.refundPolicyLabel)}\n >\n {formatMessage(messages.refundPolicy)}\n </a>\n ),\n })}\n </p>\n </Col>\n </Row>\n </div>\n );\n};\n\nexport default AlacarteConfirmation;\n"]}
|
|
@@ -48,12 +48,16 @@ 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
|
-
|
|
51
|
+
const discountText = discount
|
|
52
|
+
? formatMessage(messages.discountAmount, {
|
|
53
|
+
amount: discount.amount.toFixed(2),
|
|
54
|
+
currency: discount.currency,
|
|
55
|
+
})
|
|
56
|
+
: '';
|
|
57
|
+
const pairText = (label, value) => [label, value].filter(Boolean).join(' ');
|
|
58
|
+
return (_jsxs("div", { className: "cart-summary", children: [_jsxs("div", { className: "cart-summary__card card pgn__card pgn__card-light 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
59
|
count: subscriberCount.toLocaleString(),
|
|
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.
|
|
54
|
-
amount: discount.amount.toFixed(2),
|
|
55
|
-
currency: discount.currency,
|
|
56
|
-
}) })] })), _jsx(Card.Section, { className: "p-0", children: _jsxs("div", { className: "d-flex justify-content-between align-items-center", "aria-live": "polite", "aria-atomic": "true", "data-testid": "todays-total", children: [_jsx("span", { className: "cart-summary__total-label text-gray-900", children: formatMessage(messages.todaysTotal) }), _jsx("span", { className: "cart-summary__total-value mb-0 text-gray-900", children: totalText })] }) })] }), promoCode ? _jsx(PromoCode, Object.assign({}, promoCode)) : null, _jsxs("div", { className: "cart-summary__stats d-none d-lg-flex", children: [_jsxs("div", { className: "cart-summary__stat d-flex align-items-center mr-4", children: [_jsx("img", { src: learnersIcon, alt: "", width: 50, height: 50, className: "mr-2" }), _jsxs("div", { children: [_jsx("p", { className: "cart-summary__stat-count font-weight-bold text-gray-600 mb-0", children: formatMessage(messages.learnersCount) }), _jsx("p", { className: "cart-summary__stat-label text-gray-600 mb-0", children: formatMessage(messages.learnersLabel) })] })] }), _jsxs("div", { className: "cart-summary__stat d-flex align-items-center", children: [_jsx("img", { src: institutionsIcon, alt: "", width: 50, height: 50, className: "mr-2" }), _jsxs("div", { children: [_jsx("p", { className: "cart-summary__stat-count font-weight-bold text-gray-600 mb-0", children: formatMessage(messages.institutionsCount) }), _jsx("p", { className: "cart-summary__stat-label text-gray-600 mb-0", children: formatMessage(messages.institutionsLabel) })] })] })] })] }));
|
|
60
|
+
}))] })] }), _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 position-relative d-flex justify-content-between align-items-center p-0 pt-3", children: [_jsx("span", { className: "sr-overlay", children: pairText(formatMessage(messages.subtotal), subtotalText) }), _jsx("span", { className: "cart-summary__subtotal text-gray-900", "aria-hidden": "true", children: formatMessage(messages.subtotal) }), _jsx("span", { className: "cart-summary__subtotal text-gray-900", "aria-hidden": "true", children: subtotalText })] }), discount && (_jsxs(Card.Section, { className: "position-relative d-flex justify-content-between align-items-center p-0", "data-testid": "discount-row", children: [_jsx("span", { className: "sr-overlay", children: pairText(formatMessage(messages.discountApplied), discountText) }), _jsx("span", { className: "text-success font-weight-bold", "aria-hidden": "true", children: formatMessage(messages.discountApplied) }), _jsx("span", { className: "text-success font-weight-bold", "aria-hidden": "true", children: discountText })] })), _jsx(Card.Section, { className: "p-0", children: _jsxs("div", { className: "position-relative d-flex justify-content-between align-items-center", "aria-live": "polite", "aria-atomic": "true", "data-testid": "todays-total", children: [_jsx("span", { className: "sr-overlay", children: pairText(formatMessage(messages.todaysTotal), totalText) }), _jsx("span", { className: "cart-summary__total-label text-gray-900", "aria-hidden": "true", children: formatMessage(messages.todaysTotal) }), _jsx("span", { className: "cart-summary__total-value mb-0 text-gray-900", "aria-hidden": "true", children: totalText })] }) })] }), promoCode ? _jsx(PromoCode, Object.assign({}, promoCode)) : null, _jsxs("div", { className: "cart-summary__stats d-none d-lg-flex", children: [_jsxs("div", { className: "cart-summary__stat d-flex align-items-center mr-4", children: [_jsx("img", { src: learnersIcon, alt: "", width: 50, height: 50, className: "mr-2" }), _jsxs("div", { className: "position-relative", children: [_jsx("span", { className: "sr-overlay", children: formatMessage(messages.learnersStatScreenReader) }), _jsx("p", { className: "cart-summary__stat-count font-weight-bold text-gray-600 mb-0", "aria-hidden": "true", children: formatMessage(messages.learnersCount) }), _jsx("p", { className: "cart-summary__stat-label text-gray-600 mb-0", "aria-hidden": "true", children: formatMessage(messages.learnersLabel) })] })] }), _jsxs("div", { className: "cart-summary__stat d-flex align-items-center", children: [_jsx("img", { src: institutionsIcon, alt: "", width: 50, height: 50, className: "mr-2" }), _jsxs("div", { className: "position-relative", children: [_jsx("span", { className: "sr-overlay", children: formatMessage(messages.institutionsStatScreenReader) }), _jsx("p", { className: "cart-summary__stat-count font-weight-bold text-gray-600 mb-0", "aria-hidden": "true", children: formatMessage(messages.institutionsCount) }), _jsx("p", { className: "cart-summary__stat-label text-gray-600 mb-0", "aria-hidden": "true", children: formatMessage(messages.institutionsLabel) })] })] })] })] }));
|
|
57
61
|
};
|
|
58
62
|
export default CartSummary;
|
|
59
63
|
//# sourceMappingURL=CartSummary.js.map
|
|
@@ -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,qBAAqB,MAAM,gDAAgD,CAAC;AACnF,OAAO,SAAS,MAAM,wBAAwB,CAAC;AAI/C,OAAO,QAAQ,MAAM,YAAY,CA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I,CAAC,OAAO,IAAC,SAAS,EAAC,KAAK,YAE3B,eACE,SAAS,EAAC,mDAAmD,eACnD,QAAQ,iBACN,MAAM,iBACN,cAAc,aAE1B,eAAM,SAAS,EAAC,yCAAyC,YACtD,aAAa,CAAC,QAAQ,CAAC,WAAW,CAAC,GAC/B,EACP,eAAM,SAAS,EAAC,8CAA8C,YAC3D,SAAS,GACL,IACH,GACO,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,IACA,CACT,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 <aside className=\"cart-summary\" aria-labelledby=\"cart-summary-heading\">\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 id=\"cart-summary-heading\" 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=\"p-0\">\n {/* Announces the new total when a coupon is applied or removed. */}\n <div\n className=\"d-flex justify-content-between align-items-center\"\n aria-live=\"polite\"\n aria-atomic=\"true\"\n data-testid=\"todays-total\"\n >\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 </div>\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-600 mb-0\">\n {formatMessage(messages.learnersCount)}\n </p>\n <p className=\"cart-summary__stat-label text-gray-600 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-600 mb-0\">\n {formatMessage(messages.institutionsCount)}\n </p>\n <p className=\"cart-summary__stat-label text-gray-600 mb-0\">\n {formatMessage(messages.institutionsLabel)}\n </p>\n </div>\n </div>\n </div>\n </aside>\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,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,YAAY,EAAE,GAAG,EAAC,EAAE,EAAC,KAAK,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,SAAS,EAAC,MAAM,GAAG,EACzE,eAAK,SAAS,EAAC,mBAAmB,aAChC,eAAM,SAAS,EAAC,YAAY,YAAE,aAAa,CAAC,QAAQ,CAAC,wBAAwB,CAAC,GAAQ,EACtF,YAAG,SAAS,EAAC,8DAA8D,iBAAa,MAAM,YAC3F,aAAa,CAAC,QAAQ,CAAC,aAAa,CAAC,GACpC,EACJ,YAAG,SAAS,EAAC,6CAA6C,iBAAa,MAAM,YAC1E,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,eAAK,SAAS,EAAC,mBAAmB,aAChC,eAAM,SAAS,EAAC,YAAY,YAAE,aAAa,CAAC,QAAQ,CAAC,4BAA4B,CAAC,GAAQ,EAC1F,YAAG,SAAS,EAAC,8DAA8D,iBAAa,MAAM,YAC3F,aAAa,CAAC,QAAQ,CAAC,iBAAiB,CAAC,GACxC,EACJ,YAAG,SAAS,EAAC,6CAA6C,iBAAa,MAAM,YAC1E,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 const discountText = discount\n ? formatMessage(messages.discountAmount, {\n amount: discount.amount.toFixed(2),\n currency: discount.currency,\n })\n : '';\n\n const pairText = (label: string, value: string) => [label, value].filter(Boolean).join(' ');\n\n return (\n <div className=\"cart-summary\">\n {/* Paragon's Card always sets tabIndex=-1, which makes VoiceOver treat the\n whole summary as a single focusable group. Same markup, no tabindex. */}\n <div className=\"cart-summary__card card pgn__card pgn__card-light 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 {/* VoiceOver reads each flex child as its own item, so every row exposes\n its label and value as one overlay string and hides the visual spans. */}\n <Card.Section className=\"cart-summary__subtotal-row position-relative d-flex justify-content-between align-items-center p-0 pt-3\">\n <span className=\"sr-overlay\">{pairText(formatMessage(messages.subtotal), subtotalText)}</span>\n <span className=\"cart-summary__subtotal text-gray-900\" aria-hidden=\"true\">\n {formatMessage(messages.subtotal)}\n </span>\n <span className=\"cart-summary__subtotal text-gray-900\" aria-hidden=\"true\">\n {subtotalText}\n </span>\n </Card.Section>\n\n {discount && (\n <Card.Section\n className=\"position-relative d-flex justify-content-between align-items-center p-0\"\n data-testid=\"discount-row\"\n >\n <span className=\"sr-overlay\">{pairText(formatMessage(messages.discountApplied), discountText)}</span>\n <span className=\"text-success font-weight-bold\" aria-hidden=\"true\">\n {formatMessage(messages.discountApplied)}\n </span>\n <span className=\"text-success font-weight-bold\" aria-hidden=\"true\">\n {discountText}\n </span>\n </Card.Section>\n )}\n\n <Card.Section className=\"p-0\">\n {/* Announces the new total when a coupon is applied or removed. */}\n <div\n className=\"position-relative d-flex justify-content-between align-items-center\"\n aria-live=\"polite\"\n aria-atomic=\"true\"\n data-testid=\"todays-total\"\n >\n <span className=\"sr-overlay\">{pairText(formatMessage(messages.todaysTotal), totalText)}</span>\n <span className=\"cart-summary__total-label text-gray-900\" aria-hidden=\"true\">\n {formatMessage(messages.todaysTotal)}\n </span>\n <span className=\"cart-summary__total-value mb-0 text-gray-900\" aria-hidden=\"true\">\n {totalText}\n </span>\n </div>\n </Card.Section>\n </div>\n\n {promoCode ? <PromoCode {...promoCode} /> : null}\n\n {/* Stats row. Each stat is read as one phrase (\"100 million learners\"):\n \"100M\" alone is read as \"100 meters\". */}\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 className=\"position-relative\">\n <span className=\"sr-overlay\">{formatMessage(messages.learnersStatScreenReader)}</span>\n <p className=\"cart-summary__stat-count font-weight-bold text-gray-600 mb-0\" aria-hidden=\"true\">\n {formatMessage(messages.learnersCount)}\n </p>\n <p className=\"cart-summary__stat-label text-gray-600 mb-0\" aria-hidden=\"true\">\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 className=\"position-relative\">\n <span className=\"sr-overlay\">{formatMessage(messages.institutionsStatScreenReader)}</span>\n <p className=\"cart-summary__stat-count font-weight-bold text-gray-600 mb-0\" aria-hidden=\"true\">\n {formatMessage(messages.institutionsCount)}\n </p>\n <p className=\"cart-summary__stat-label text-gray-600 mb-0\" aria-hidden=\"true\">\n {formatMessage(messages.institutionsLabel)}\n </p>\n </div>\n </div>\n </div>\n </div>\n );\n};\n\nexport default CartSummary;\n"]}
|
|
@@ -79,6 +79,11 @@ declare const messages: {
|
|
|
79
79
|
defaultMessage: string;
|
|
80
80
|
description: string;
|
|
81
81
|
};
|
|
82
|
+
learnersStatScreenReader: {
|
|
83
|
+
id: string;
|
|
84
|
+
defaultMessage: string;
|
|
85
|
+
description: string;
|
|
86
|
+
};
|
|
82
87
|
institutionsCount: {
|
|
83
88
|
id: string;
|
|
84
89
|
defaultMessage: string;
|
|
@@ -89,5 +94,10 @@ declare const messages: {
|
|
|
89
94
|
defaultMessage: string;
|
|
90
95
|
description: string;
|
|
91
96
|
};
|
|
97
|
+
institutionsStatScreenReader: {
|
|
98
|
+
id: string;
|
|
99
|
+
defaultMessage: string;
|
|
100
|
+
description: string;
|
|
101
|
+
};
|
|
92
102
|
};
|
|
93
103
|
export default messages;
|
|
@@ -81,6 +81,11 @@ const messages = defineMessages({
|
|
|
81
81
|
defaultMessage: 'Learners',
|
|
82
82
|
description: 'Label under the learners count stat',
|
|
83
83
|
},
|
|
84
|
+
learnersStatScreenReader: {
|
|
85
|
+
id: 'checkout.cartSummary.learnersStatScreenReader',
|
|
86
|
+
defaultMessage: '100 million learners',
|
|
87
|
+
description: 'Screen reader text for the learners stat, read instead of the visual "100M" and "Learners"',
|
|
88
|
+
},
|
|
84
89
|
institutionsCount: {
|
|
85
90
|
id: 'checkout.cartSummary.institutionsCount',
|
|
86
91
|
defaultMessage: '250+',
|
|
@@ -91,6 +96,11 @@ const messages = defineMessages({
|
|
|
91
96
|
defaultMessage: 'Expert institutions',
|
|
92
97
|
description: 'Label under the institutions count stat',
|
|
93
98
|
},
|
|
99
|
+
institutionsStatScreenReader: {
|
|
100
|
+
id: 'checkout.cartSummary.institutionsStatScreenReader',
|
|
101
|
+
defaultMessage: '250+ expert institutions',
|
|
102
|
+
description: 'Screen reader text for the institutions stat, read instead of the visual "250+" and "Expert institutions"',
|
|
103
|
+
},
|
|
94
104
|
});
|
|
95
105
|
export default messages;
|
|
96
106
|
//# sourceMappingURL=Messages.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Messages.js","sourceRoot":"","sources":["../../../src/components/CartSummary/Messages.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAExD,MAAM,QAAQ,GAAG,cAAc,CAAC;IAC9B,cAAc;IACd,cAAc,EAAE;QACd,EAAE,EAAE,qCAAqC;QACzC,cAAc,EAAE,SAAS;QACzB,WAAW,EAAE,oCAAoC;KAClD;IACD,YAAY,EAAE;QACZ,EAAE,EAAE,mCAAmC;QACvC,cAAc,EAAE,UAAU;QAC1B,WAAW,EAAE,8CAA8C;KAC5D;IACD,YAAY,EAAE;QACZ,EAAE,EAAE,mCAAmC;QACvC,cAAc,EAAE,+DAA+D;QAC/E,WAAW,EAAE,oEAAoE;KAClF;IACD,kBAAkB,EAAE;QAClB,EAAE,EAAE,yCAAyC;QAC7C,cAAc,EAAE,0BAA0B;QAC1C,WAAW,EAAE,yCAAyC;KACvD;IACD,kBAAkB,EAAE;QAClB,EAAE,EAAE,yCAAyC;QAC7C,cAAc,EAAE,0BAA0B;QAC1C,WAAW,EAAE,oDAAoD;KAClE;IACD,QAAQ,EAAE;QACR,EAAE,EAAE,+BAA+B;QACnC,cAAc,EAAE,UAAU;QAC1B,WAAW,EAAE,4BAA4B;KAC1C;IACD,cAAc,EAAE;QACd,EAAE,EAAE,qCAAqC;QACzC,cAAc,EAAE,sBAAsB;QACtC,WAAW,EAAE,wDAAwD;KACtE;IACD,WAAW,EAAE;QACX,EAAE,EAAE,kCAAkC;QACtC,cAAc,EAAE,eAAe;QAC/B,WAAW,EAAE,mCAAmC;KACjD;IACD,gBAAgB,EAAE;QAChB,EAAE,EAAE,uCAAuC;QAC3C,cAAc,EAAE,sBAAsB;QACtC,WAAW,EAAE,6DAA6D;KAC3E;IACD,YAAY,EAAE;QACZ,EAAE,EAAE,mCAAmC;QACvC,cAAc,EAAE,wBAAwB;QACxC,WAAW,EAAE,gFAAgF;KAC9F;IACD,eAAe,EAAE;QACf,EAAE,EAAE,sCAAsC;QAC1C,cAAc,EAAE,mBAAmB;QACnC,WAAW,EAAE,gFAAgF;KAC9F;IACD,cAAc,EAAE;QACd,EAAE,EAAE,qCAAqC;QACzC,cAAc,EAAE,uBAAuB;QACvC,WAAW,EAAE,6CAA6C;KAC3D;IACD,SAAS,EAAE;QACT,EAAE,EAAE,gCAAgC;QACpC,cAAc,EAAE,uBAAuB;QACvC,WAAW,EAAE,gEAAgE;KAC9E;IACD,eAAe,EAAE;QACf,EAAE,EAAE,sCAAsC;QAC1C,cAAc,EAAE,uBAAuB;QACvC,WAAW,EAAE,8CAA8C;KAC5D;IACD,aAAa,EAAE;QACb,EAAE,EAAE,oCAAoC;QACxC,cAAc,EAAE,MAAM;QACtB,WAAW,EAAE,qBAAqB;KACnC;IACD,aAAa,EAAE;QACb,EAAE,EAAE,oCAAoC;QACxC,cAAc,EAAE,UAAU;QAC1B,WAAW,EAAE,qCAAqC;KACnD;IACD,iBAAiB,EAAE;QACjB,EAAE,EAAE,wCAAwC;QAC5C,cAAc,EAAE,MAAM;QACtB,WAAW,EAAE,gCAAgC;KAC9C;IACD,iBAAiB,EAAE;QACjB,EAAE,EAAE,wCAAwC;QAC5C,cAAc,EAAE,qBAAqB;QACrC,WAAW,EAAE,yCAAyC;KACvD;CACF,CAAC,CAAC;AAEH,eAAe,QAAQ,CAAC","sourcesContent":["import { defineMessages } from '@openedx/frontend-base';\n\nconst messages = defineMessages({\n // CartSummary\n summaryHeading: {\n id: 'checkout.cartSummary.summaryHeading',\n defaultMessage: 'Summary',\n description: 'Heading for the order summary card',\n },\n productTitle: {\n id: 'checkout.cartSummary.productTitle',\n defaultMessage: 'edX Plus',\n description: 'Product name shown in the order summary card',\n },\n productBlurb: {\n id: 'checkout.cartSummary.productBlurb',\n defaultMessage: 'Subscribe and get access to hundreds of courses and programs.',\n description: 'Short product description under the name in the order summary card',\n },\n learnersSubscribed: {\n id: 'checkout.cartSummary.learnersSubscribed',\n defaultMessage: '{count} already enrolled',\n description: 'Badge showing number of active learners',\n },\n loadingSubscribers: {\n id: 'checkout.cartSummary.loadingSubscribers',\n defaultMessage: 'Loading subscriber count',\n description: 'Accessible label for the subscriber count skeleton',\n },\n subtotal: {\n id: 'checkout.cartSummary.subtotal',\n defaultMessage: 'Subtotal',\n description: 'Label for the subtotal row',\n },\n subtotalAmount: {\n id: 'checkout.cartSummary.subtotalAmount',\n defaultMessage: '${amount} {currency}',\n description: 'Formatted subtotal with currency code e.g. $219.00 USD',\n },\n todaysTotal: {\n id: 'checkout.cartSummary.todaysTotal',\n defaultMessage: \"Today's total\",\n description: \"Label for today's total price row\",\n },\n todaysTotalValue: {\n id: 'checkout.cartSummary.todaysTotalValue',\n defaultMessage: '${amount} {currency}',\n description: \"Formatted today's total with currency code e.g. $219.00 USD\",\n },\n alreadyYours: {\n id: 'checkout.cartSummary.alreadyYours',\n defaultMessage: 'Already yours: {names}',\n description: 'Lists program member courses the learner already owns (explains the deduction)',\n },\n discountApplied: {\n id: 'checkout.cartSummary.discountApplied',\n defaultMessage: 'Discounts applied',\n description: 'Label for the discount row — always this, whatever the discount source or name',\n },\n discountAmount: {\n id: 'checkout.cartSummary.discountAmount',\n defaultMessage: '-${amount} {currency}',\n description: 'Formatted discount amount e.g. -$122.50 USD',\n },\n deduction: {\n id: 'checkout.cartSummary.deduction',\n defaultMessage: 'Already owned courses',\n description: 'Label for the program price deduction for owned member courses',\n },\n deductionAmount: {\n id: 'checkout.cartSummary.deductionAmount',\n defaultMessage: '-${amount} {currency}',\n description: 'Formatted deduction amount e.g. -$100.00 USD',\n },\n learnersCount: {\n id: 'checkout.cartSummary.learnersCount',\n defaultMessage: '100M',\n description: 'Total learners stat',\n },\n learnersLabel: {\n id: 'checkout.cartSummary.learnersLabel',\n defaultMessage: 'Learners',\n description: 'Label under the learners count stat',\n },\n institutionsCount: {\n id: 'checkout.cartSummary.institutionsCount',\n defaultMessage: '250+',\n description: 'Expert institutions count stat',\n },\n institutionsLabel: {\n id: 'checkout.cartSummary.institutionsLabel',\n defaultMessage: 'Expert institutions',\n description: 'Label under the institutions count stat',\n },\n});\n\nexport default messages;\n"]}
|
|
1
|
+
{"version":3,"file":"Messages.js","sourceRoot":"","sources":["../../../src/components/CartSummary/Messages.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAExD,MAAM,QAAQ,GAAG,cAAc,CAAC;IAC9B,cAAc;IACd,cAAc,EAAE;QACd,EAAE,EAAE,qCAAqC;QACzC,cAAc,EAAE,SAAS;QACzB,WAAW,EAAE,oCAAoC;KAClD;IACD,YAAY,EAAE;QACZ,EAAE,EAAE,mCAAmC;QACvC,cAAc,EAAE,UAAU;QAC1B,WAAW,EAAE,8CAA8C;KAC5D;IACD,YAAY,EAAE;QACZ,EAAE,EAAE,mCAAmC;QACvC,cAAc,EAAE,+DAA+D;QAC/E,WAAW,EAAE,oEAAoE;KAClF;IACD,kBAAkB,EAAE;QAClB,EAAE,EAAE,yCAAyC;QAC7C,cAAc,EAAE,0BAA0B;QAC1C,WAAW,EAAE,yCAAyC;KACvD;IACD,kBAAkB,EAAE;QAClB,EAAE,EAAE,yCAAyC;QAC7C,cAAc,EAAE,0BAA0B;QAC1C,WAAW,EAAE,oDAAoD;KAClE;IACD,QAAQ,EAAE;QACR,EAAE,EAAE,+BAA+B;QACnC,cAAc,EAAE,UAAU;QAC1B,WAAW,EAAE,4BAA4B;KAC1C;IACD,cAAc,EAAE;QACd,EAAE,EAAE,qCAAqC;QACzC,cAAc,EAAE,sBAAsB;QACtC,WAAW,EAAE,wD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E,yCAAyC;KACvD;IACD,4BAA4B,EAAE;QAC5B,EAAE,EAAE,mDAAmD;QACvD,cAAc,EAAE,0BAA0B;QAC1C,WAAW,EAAE,2GAA2G;KACzH;CACF,CAAC,CAAC;AAEH,eAAe,QAAQ,CAAC","sourcesContent":["import { defineMessages } from '@openedx/frontend-base';\n\nconst messages = defineMessages({\n // CartSummary\n summaryHeading: {\n id: 'checkout.cartSummary.summaryHeading',\n defaultMessage: 'Summary',\n description: 'Heading for the order summary card',\n },\n productTitle: {\n id: 'checkout.cartSummary.productTitle',\n defaultMessage: 'edX Plus',\n description: 'Product name shown in the order summary card',\n },\n productBlurb: {\n id: 'checkout.cartSummary.productBlurb',\n defaultMessage: 'Subscribe and get access to hundreds of courses and programs.',\n description: 'Short product description under the name in the order summary card',\n },\n learnersSubscribed: {\n id: 'checkout.cartSummary.learnersSubscribed',\n defaultMessage: '{count} already enrolled',\n description: 'Badge showing number of active learners',\n },\n loadingSubscribers: {\n id: 'checkout.cartSummary.loadingSubscribers',\n defaultMessage: 'Loading subscriber count',\n description: 'Accessible label for the subscriber count skeleton',\n },\n subtotal: {\n id: 'checkout.cartSummary.subtotal',\n defaultMessage: 'Subtotal',\n description: 'Label for the subtotal row',\n },\n subtotalAmount: {\n id: 'checkout.cartSummary.subtotalAmount',\n defaultMessage: '${amount} {currency}',\n description: 'Formatted subtotal with currency code e.g. $219.00 USD',\n },\n todaysTotal: {\n id: 'checkout.cartSummary.todaysTotal',\n defaultMessage: \"Today's total\",\n description: \"Label for today's total price row\",\n },\n todaysTotalValue: {\n id: 'checkout.cartSummary.todaysTotalValue',\n defaultMessage: '${amount} {currency}',\n description: \"Formatted today's total with currency code e.g. $219.00 USD\",\n },\n alreadyYours: {\n id: 'checkout.cartSummary.alreadyYours',\n defaultMessage: 'Already yours: {names}',\n description: 'Lists program member courses the learner already owns (explains the deduction)',\n },\n discountApplied: {\n id: 'checkout.cartSummary.discountApplied',\n defaultMessage: 'Discounts applied',\n description: 'Label for the discount row — always this, whatever the discount source or name',\n },\n discountAmount: {\n id: 'checkout.cartSummary.discountAmount',\n defaultMessage: '-${amount} {currency}',\n description: 'Formatted discount amount e.g. -$122.50 USD',\n },\n deduction: {\n id: 'checkout.cartSummary.deduction',\n defaultMessage: 'Already owned courses',\n description: 'Label for the program price deduction for owned member courses',\n },\n deductionAmount: {\n id: 'checkout.cartSummary.deductionAmount',\n defaultMessage: '-${amount} {currency}',\n description: 'Formatted deduction amount e.g. -$100.00 USD',\n },\n learnersCount: {\n id: 'checkout.cartSummary.learnersCount',\n defaultMessage: '100M',\n description: 'Total learners stat',\n },\n learnersLabel: {\n id: 'checkout.cartSummary.learnersLabel',\n defaultMessage: 'Learners',\n description: 'Label under the learners count stat',\n },\n learnersStatScreenReader: {\n id: 'checkout.cartSummary.learnersStatScreenReader',\n defaultMessage: '100 million learners',\n description: 'Screen reader text for the learners stat, read instead of the visual \"100M\" and \"Learners\"',\n },\n institutionsCount: {\n id: 'checkout.cartSummary.institutionsCount',\n defaultMessage: '250+',\n description: 'Expert institutions count stat',\n },\n institutionsLabel: {\n id: 'checkout.cartSummary.institutionsLabel',\n defaultMessage: 'Expert institutions',\n description: 'Label under the institutions count stat',\n },\n institutionsStatScreenReader: {\n id: 'checkout.cartSummary.institutionsStatScreenReader',\n defaultMessage: '250+ expert institutions',\n description: 'Screen reader text for the institutions stat, read instead of the visual \"250+\" and \"Expert institutions\"',\n },\n});\n\nexport default messages;\n"]}
|
|
@@ -6,8 +6,10 @@ export type CheckoutProps = UseCheckoutOptions & {
|
|
|
6
6
|
geolocationUrl?: string;
|
|
7
7
|
/** Learner dashboard / order history URL for confirmation CTAs. */
|
|
8
8
|
orderHistoryUrl?: string;
|
|
9
|
+
/** Learner dashboard URL — session-error recovery link and "See my courses" on the already-owned program alert. */
|
|
10
|
+
learnerDashboardUrl?: string;
|
|
9
11
|
/** PayPal JS SDK client id — enables the express PayPal button. */
|
|
10
12
|
paypalClientId?: string;
|
|
11
13
|
};
|
|
12
|
-
declare const Checkout: ({ homeUrl, orderHistoryUrl, paypalClientId, ...props }: CheckoutProps) => import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
declare const Checkout: ({ homeUrl, orderHistoryUrl, learnerDashboardUrl, paypalClientId, ...props }: CheckoutProps) => import("react/jsx-runtime").JSX.Element;
|
|
13
15
|
export default Checkout;
|
|
@@ -52,8 +52,8 @@ import messages from './Messages';
|
|
|
52
52
|
// Flip back to true to restore the redirect.
|
|
53
53
|
const REDIRECT_ON_NO_ACTIVE_CHECKOUT = false;
|
|
54
54
|
const Checkout = (_a) => {
|
|
55
|
-
var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
|
|
56
|
-
var { homeUrl = '/', orderHistoryUrl, paypalClientId } = _a, props = __rest(_a, ["homeUrl", "orderHistoryUrl", "paypalClientId"]);
|
|
55
|
+
var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v;
|
|
56
|
+
var { homeUrl = '/', orderHistoryUrl, learnerDashboardUrl, paypalClientId } = _a, props = __rest(_a, ["homeUrl", "orderHistoryUrl", "learnerDashboardUrl", "paypalClientId"]);
|
|
57
57
|
const { formatMessage } = useIntl();
|
|
58
58
|
const alacarte = useAlacarteCheckout({
|
|
59
59
|
apiUrl: props.apiUrl,
|
|
@@ -193,6 +193,26 @@ const Checkout = (_a) => {
|
|
|
193
193
|
? [c.course.tBrandText, c.course.maName].filter(Boolean).join(': ')
|
|
194
194
|
: null;
|
|
195
195
|
const isAlreadyOwned = alacarte.isAlreadyOwned;
|
|
196
|
+
// Fully-owned program: name the program and how many certificates it has.
|
|
197
|
+
// The line may be synthetic (built from owned products), so fall back to the
|
|
198
|
+
// owned-product name and the owned-course count.
|
|
199
|
+
const isAlreadyOwnedProgram = isAlreadyOwned && ((_k = alacarte.selector) === null || _k === void 0 ? void 0 : _k.kind) === 'program';
|
|
200
|
+
const ownedProgramName = (((_l = alacarte.line) === null || _l === void 0 ? void 0 : _l.kind) === 'program' ? alacarte.line.programName : null)
|
|
201
|
+
|| alacarte.ownedProductName;
|
|
202
|
+
const ownedProgramCertificateCount = (alacarteProgramDetail === null || alacarteProgramDetail === void 0 ? void 0 : alacarteProgramDetail.tCourses.length)
|
|
203
|
+
|| (((_m = alacarte.line) === null || _m === void 0 ? void 0 : _m.kind) === 'program' ? (_o = alacarte.line.ownedCourses) === null || _o === void 0 ? void 0 : _o.length : null)
|
|
204
|
+
|| null;
|
|
205
|
+
const alreadyOwnedMessage = !isAlreadyOwnedProgram
|
|
206
|
+
? formatMessage(messages.alreadyPaidCourse)
|
|
207
|
+
: ownedProgramName && ownedProgramCertificateCount
|
|
208
|
+
? formatMessage(messages.alreadyPaidAllProgramCertificates, {
|
|
209
|
+
certificateCount: ownedProgramCertificateCount,
|
|
210
|
+
programName: ownedProgramName,
|
|
211
|
+
})
|
|
212
|
+
: formatMessage(messages.alreadyPaidProgram);
|
|
213
|
+
const handleSeeMyCourses = () => {
|
|
214
|
+
window.location.href = learnerDashboardUrl || homeUrl || '/';
|
|
215
|
+
};
|
|
196
216
|
const { paymentTimedOut } = alacarte;
|
|
197
217
|
// Grey out and block the form + summary; only the alerts above stay usable.
|
|
198
218
|
const isLocked = isAlreadyOwned || paymentTimedOut;
|
|
@@ -229,13 +249,13 @@ const Checkout = (_a) => {
|
|
|
229
249
|
// getTwouOrder is still polling, keep the checkout form so Pay now can show
|
|
230
250
|
// "Processing..." instead of a full-page loader.
|
|
231
251
|
if (alacarte.placedOrder || alacarte.placedOrderError) {
|
|
232
|
-
const confirmationTitle = ((
|
|
252
|
+
const confirmationTitle = ((_p = alacarte.line) === null || _p === void 0 ? void 0 : _p.kind) === 'program'
|
|
233
253
|
? alacarte.line.programName
|
|
234
|
-
: ((
|
|
254
|
+
: ((_q = alacarte.line) === null || _q === void 0 ? void 0 : _q.kind) === 'course'
|
|
235
255
|
? alacarte.line.courseName
|
|
236
256
|
: null;
|
|
237
|
-
return (_jsxs(_Fragment, { children: [alacarteDebug, _jsx(Row, { className: "checkout__container alacarte-confirmation__container bg-light-200", children: _jsx(Col, { xs: 12, children: _jsx(AlacarteConfirmation, { order: alacarte.placedOrder, awaiting: false, error: alacarte.placedOrderError, onContinue: handleStartCourse, productDetail: alacarte.productDetail, productTitle: confirmationTitle, ownedCourses: ((
|
|
238
|
-
? ((
|
|
257
|
+
return (_jsxs(_Fragment, { children: [alacarteDebug, _jsx(Row, { className: "checkout__container alacarte-confirmation__container bg-light-200", children: _jsx(Col, { xs: 12, children: _jsx(AlacarteConfirmation, { order: alacarte.placedOrder, awaiting: false, error: alacarte.placedOrderError, onContinue: handleStartCourse, productDetail: alacarte.productDetail, productTitle: confirmationTitle, ownedCourses: ((_r = alacarte.line) === null || _r === void 0 ? void 0 : _r.kind) === 'program'
|
|
258
|
+
? ((_s = alacarte.line.ownedCourses) !== null && _s !== void 0 ? _s : null)
|
|
239
259
|
: null, orderHistoryUrl: orderHistoryUrl !== null && orderHistoryUrl !== void 0 ? orderHistoryUrl : null, placedAt: alacarte.placedOrderPlacedAt }) }) })] }));
|
|
240
260
|
}
|
|
241
261
|
if (alacarte.phase === 'loading') {
|
|
@@ -256,13 +276,11 @@ const Checkout = (_a) => {
|
|
|
256
276
|
// Price differs from what the learner viewed before checkout (ALC-159).
|
|
257
277
|
const showPriceChangedAlert = !!alacarte.priceChanged && !dismissedPriceChange && !isLocked;
|
|
258
278
|
const priceChangedKind = isProgramProduct ? 'program' : 'course';
|
|
259
|
-
return (_jsxs(_Fragment, { children: [alacarteDebug, _jsxs(Row, { className: "checkout__container bg-light-200", children: [alacarte.sanctionsBlocked && (_jsx(OrderBlockedModal, { isOpen: true, referenceCode: alacarte.sanctionsBlocked.referenceCode, homeUrl: homeUrl })), _jsx(Col, { xs: 12, className: isLocked ? 'checkout__locked-overlay' : '', children: _jsxs(Row, { className: "checkout__layout", children: [_jsx(Col, { xs: 12, className: "checkout__header", children: _jsxs("div", { children: [_jsx("h1", { className: "font-weight-bold text-primary-900 mb-lg-4", children: "Checkout" }), paymentTimedOut && (_jsx(PaymentTimeoutAlert, { className: "checkout__overlay-alert mb-3" })), isAlreadyOwned && (_jsxs(Alert, { variant: "danger", icon: ErrorIcon, className: "checkout__overlay-alert mb-3", "data-testid": "already-owned-alert", children: [_jsx("p", { className: "mb-3", children: formatMessage(((
|
|
260
|
-
? messages.alreadyPaidProgram
|
|
261
|
-
: messages.alreadyPaidCourse) }), _jsxs("div", { className: "d-flex align-items-center justify-content-end gap-3 flex-wrap", children: [orderHistoryUrl && (_jsx("a", { href: orderHistoryUrl, className: "checkout__order-history text-gray-900 font-weight-bold", children: formatMessage(messages.viewOrderHistory) })), _jsx(Button, { variant: "brand", className: "rounded-pill", onClick: handleStartCourse, children: formatMessage(messages.goToCourse) })] })] })), c.error && (_jsx(Alert, { variant: "danger", icon: ErrorIcon, dismissible: true, onClose: c.clearError, children: c.error })), alacarte.placeOrderError && (_jsx(Alert, { variant: "danger", icon: ErrorIcon, dismissible: true, onClose: alacarte.clearPlaceOrderError, className: "mb-3", children: alacarte.placeOrderError })), ((_q = alacarte.paymentDecline) === null || _q === void 0 ? void 0 : _q.message) && !alacarte.placeOrderError && !paymentTimedOut && (_jsx(Alert, { variant: "danger", icon: ErrorIcon, className: "mb-3", "data-testid": "payment-decline-alert", children: getLearnerFacingStripeMessage({
|
|
279
|
+
return (_jsxs(_Fragment, { children: [alacarteDebug, _jsxs(Row, { className: "checkout__container bg-light-200", children: [alacarte.sanctionsBlocked && (_jsx(OrderBlockedModal, { isOpen: true, referenceCode: alacarte.sanctionsBlocked.referenceCode, homeUrl: homeUrl })), _jsx(Col, { xs: 12, className: isLocked ? 'checkout__locked-overlay' : '', children: _jsxs(Row, { className: "checkout__layout", children: [_jsx(Col, { xs: 12, className: "checkout__header", children: _jsxs("div", { children: [_jsx("h1", { className: "font-weight-bold text-primary-900 mb-lg-4", children: "Checkout" }), paymentTimedOut && (_jsx(PaymentTimeoutAlert, { className: "checkout__overlay-alert mb-3" })), isAlreadyOwned && (_jsxs(Alert, { variant: "danger", icon: ErrorIcon, className: "checkout__overlay-alert mb-3", "data-testid": "already-owned-alert", children: [_jsx("p", { className: "mb-3", children: alreadyOwnedMessage }), _jsxs("div", { className: "d-flex align-items-center justify-content-end gap-3 flex-wrap", children: [orderHistoryUrl && (_jsx("a", { href: orderHistoryUrl, className: "checkout__order-history text-gray-900 font-weight-bold", children: formatMessage(messages.viewOrderHistory) })), isAlreadyOwnedProgram ? (_jsx(Button, { variant: "brand", className: "rounded-pill", onClick: handleSeeMyCourses, children: formatMessage(messages.seeMyCourses) })) : (_jsx(Button, { variant: "brand", className: "rounded-pill", onClick: handleStartCourse, children: formatMessage(messages.goToCourse) }))] })] })), c.error && (_jsx(Alert, { variant: "danger", icon: ErrorIcon, dismissible: true, onClose: c.clearError, children: c.error })), alacarte.placeOrderError && (_jsx(Alert, { variant: "danger", icon: ErrorIcon, dismissible: true, onClose: alacarte.clearPlaceOrderError, className: "mb-3", children: alacarte.placeOrderError })), ((_t = alacarte.paymentDecline) === null || _t === void 0 ? void 0 : _t.message) && !alacarte.placeOrderError && !paymentTimedOut && (_jsx(Alert, { variant: "danger", icon: ErrorIcon, className: "mb-3", "data-testid": "payment-decline-alert", children: getLearnerFacingStripeMessage({
|
|
262
280
|
message: alacarte.paymentDecline.message,
|
|
263
|
-
code: (
|
|
281
|
+
code: (_u = alacarte.paymentDecline.code) !== null && _u !== void 0 ? _u : undefined,
|
|
264
282
|
}) })), alacarte.paymentInterrupted && !alacarte.paymentDecline && !alacarte.placeOrderError && !paymentTimedOut && (_jsx(Alert, { variant: "danger", icon: ErrorIcon, dismissible: true, onClose: alacarte.clearPaymentInterrupted, className: "mb-3", "data-testid": "payment-interrupted-alert", children: formatMessage(messages.paymentInterruptedAlert) })), alacarte.walletPaymentCancelled && !alacarte.paymentInterrupted
|
|
265
|
-
&& !alacarte.paymentDecline && !alacarte.placeOrderError && !paymentTimedOut && (_jsx(Alert, { variant: "danger", icon: ErrorIcon, dismissible: true, onClose: alacarte.clearWalletPaymentCancelled, className: "mb-3", "data-testid": "wallet-payment-cancelled-alert", children: formatMessage(messages.walletPaymentCancelledAlert) })), showPriceChangedAlert && (_jsx(PriceChangedAlert, { kind: priceChangedKind, onDismiss: () => setDismissedPriceChange(true), className: "mb-3" })), !alacarte.priceAccepted && !alacarte.priceChanged && isAlacarteReady && ((
|
|
283
|
+
&& !alacarte.paymentDecline && !alacarte.placeOrderError && !paymentTimedOut && (_jsx(Alert, { variant: "danger", icon: ErrorIcon, dismissible: true, onClose: alacarte.clearWalletPaymentCancelled, className: "mb-3", "data-testid": "wallet-payment-cancelled-alert", children: formatMessage(messages.walletPaymentCancelledAlert) })), showPriceChangedAlert && (_jsx(PriceChangedAlert, { kind: priceChangedKind, onDismiss: () => setDismissedPriceChange(true), className: "mb-3" })), !alacarte.priceAccepted && !alacarte.priceChanged && isAlacarteReady && ((_v = alacarte.line) === null || _v === void 0 ? void 0 : _v.amountDue) && (_jsx(Alert, { variant: "info", className: "mb-3", "data-testid": "price-accept-notice", children: formatMessage(messages.priceChangedNotice, {
|
|
266
284
|
amount: alacarte.line.amountDue.amount.toFixed(2),
|
|
267
285
|
currency: alacarte.line.amountDue.currency,
|
|
268
286
|
}) })), showForm && (_jsxs(_Fragment, { children: [_jsx(PaymentValidationAlert, { fields: invalidPaymentFields, country: c.billing.country, focusRequest: validationRequest, onFieldSelect: focusPaymentField, className: "mb-3" }), c.phase === 'failed' && (_jsx(Alert, { variant: "danger", icon: ErrorIcon, className: "mb-3", children: failedMessage
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Checkout.js","sourceRoot":"","sources":["../../../src/components/Checkout/Checkout.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,OAAc,EAAE,WAAW,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAChE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,G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CAAC,CAAC,QAAQ,CAAC,0BAA0B,CAAC,CAAC,CAAC,SAAS,EAClF,cAAc,EAAE,cAAc,EAC9B,mBAAmB,EAAE,eAAe,CAAC,CAAC,CAAC,uBAAuB,CAAC,CAAC,CAAC,SAAS,EAC1E,eAAe,EAAE,eAAe,CAAC,CAAC,CAAC,QAAQ,CAAC,kBAAkB,CAAC,CAAC,CAAC,SAAS,EAC1E,cAAc,EAAE,eAAe,CAAC,CAAC,CAAC,QAAQ,CAAC,iBAAiB,CAAC,CAAC,CAAC,SAAS,GACxE,CACH,EAEA,CAAC,CAAC,KAAK,KAAK,SAAS,IAAI,CACxB,KAAC,aAAa,IACZ,YAAY,EAAE,YAAY,EAC1B,WAAW,EAAE,WAAW,EACxB,YAAY,EAAE,iBAAiB,GAC/B,CACH,EAEA,CAAC,CAAC,KAAK,KAAK,SAAS,IAAI,CACxB,KAAC,aAAa,IAAC,MAAM,EAAE,CAAC,CAAC,WAAW,GAAI,CACzC,IACG,GACF,IACF,GACF,IACF,IACL,CACJ,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,QAAQ,CAAC","sourcesContent":["import React, { useCallback, useEffect, useState } from 'react';\nimport { Alert, Button, Col, Row } from '@openedx/paragon';\nimport { CheckCircle, Error as ErrorIcon } from '@openedx/paragon/icons';\nimport { useIntl } from '@openedx/frontend-base';\nimport useCheckout from '../../data/hooks/useCheckout';\nimport type { UseCheckoutOptions } from '../../data/hooks/useCheckout';\nimport { useAlacarteCheckout } from '../../data/hooks/useAlacarteCheckout';\n// Billing-country gate disabled: every country can check out; embargo is enforced by the backend.\n// import { ALLOWED_CHECKOUT_COUNTRIES, GATE_CHECK_COUNTRY } from '../../constants';\nimport CartSummary from '../CartSummary/CartSummary';\nimport EnrollmentSummary from '../EnrollmentSummary/EnrollmentSummary';\nimport PaymentForm from '../PaymentForm/PaymentForm';\n// import CountryUnavailableModal from '../CountryUnavailableModal/CountryUnavailableModal';\nimport OrderBlockedModal from '../OrderBlockedModal/OrderBlockedModal';\nimport AlacarteNotice from '../AlacarteNotice/AlacarteNotice';\nimport AlacarteConfirmation from '../AlacarteConfirmation/AlacarteConfirmation';\nimport PaymentTimeoutAlert from '../PaymentTimeoutAlert/PaymentTimeoutAlert';\nimport PriceChangedAlert from '../PriceChangedAlert/PriceChangedAlert';\nimport PaymentValidationAlert from '../PaymentValidationAlert/PaymentValidationAlert';\nimport AutoDismissAlert from '../AutoDismissAlert/AutoDismissAlert';\nimport AlacarteDebugPanel from '../AlacarteDebugPanel/AlacarteDebugPanel'; // TEMPORARY — remove alongside AlacarteDebugPanel\nimport { getTrialDateRange } from '@src/utils';\nimport { getLearnerFacingCheckoutMessage } from '../../utils/checkoutErrors';\nimport { appliedDiscountPercent } from '../../utils/discount';\nimport { useInert } from '../../utils/inert';\nimport { getInvalidPaymentFields, isCardFieldKey } from '../../utils/paymentValidation';\nimport type { PaymentFieldKey } from '../../utils/paymentValidation';\nimport { confirmPaymentWithMethodId, getLearnerFacingStripeMessage } from '../../utils/stripeCard';\nimport { SuccessScreen, BlockedScreen, ProcessingScreen } from '../StatusScreens/StatusScreens';\nimport type { BillingCycle, CourseDetail } from '../../types';\nimport type { ProgramDetail } from '../../types/alacarte';\nimport messages from './Messages';\n\n// TEMPORARY — redirect-home-on-noActiveCheckout disabled per request; shows a\n// banner instead so the case is visible while the flow is being verified.\n// Flip back to true to restore the redirect.\nconst REDIRECT_ON_NO_ACTIVE_CHECKOUT = false;\n\nexport type CheckoutProps = UseCheckoutOptions & {\n /** Homepage URL for the country-unavailable modal CTA. */\n homeUrl?: string,\n /** Endpoint used to look up the representative IP for a selected country. */\n geolocationUrl?: string,\n /** Learner dashboard / order history URL for confirmation CTAs. */\n orderHistoryUrl?: string,\n /** PayPal JS SDK client id — enables the express PayPal button. */\n paypalClientId?: string,\n};\n\nconst Checkout = ({\n homeUrl = '/',\n orderHistoryUrl,\n paypalClientId,\n ...props\n}: CheckoutProps) => {\n const { formatMessage } = useIntl();\n const alacarte = useAlacarteCheckout({\n apiUrl: props.apiUrl,\n edxSessionUrl: props.edxSessionUrl,\n skipSubscriptionCourseRuns: props.skipSubscriptionCourseRuns,\n });\n const c = useCheckout(props);\n const [promoCodeValue, setPromoCodeValue] = useState('');\n const [dismissedCouponAlert, setDismissedCouponAlert] = useState<string | null>(null);\n // Set by the learner's own Apply / Remove, so the coupon alert it produces\n // takes focus (a coupon applied on load doesn't). By the time the alert\n // mounts, couponApplying has already gone false, so it can't drive this.\n const [focusCouponAlert, setFocusCouponAlert] = useState(false);\n // 0 hides the validation alert; each failed Pay now bumps it, which moves\n // focus to the alert.\n const [validationRequest, setValidationRequest] = useState(0);\n const [dismissedPriceChange, setDismissedPriceChange] = useState(false);\n // Last code we successfully priced — drives the \"Save {percent}% with code\n // {code}\" hint on the empty field while a coupon is not yet applied.\n const [advertisedOffer, setAdvertisedOffer] = useState<{ code: string, percent: number } | null>(null);\n const isAlacarteReady = (alacarte.phase === 'ready' || alacarte.phase === 'alreadyOwned') && !!alacarte.checkout;\n const appliedCouponCode = alacarte.checkout?.couponCode?.trim()\n ? alacarte.checkout.couponCode.trim()\n : null;\n const discountPercent = appliedDiscountPercent(alacarte.line);\n // Only treat the line discount as a removable coupon when the backend says\n // so (or a coupon code is present). Automatic offers show only in CartSummary's\n // discount row and must not drive PromoCode's applied/remove UI.\n const isCouponDiscount = !!alacarte.line?.discount\n && alacarte.line.discountSource !== 'automatic'\n && (alacarte.line.discountSource === 'coupon' || !!appliedCouponCode);\n const appliedDiscount = isCouponDiscount && discountPercent != null\n ? {\n percent: discountPercent,\n amount: alacarte.line!.discount!.amount,\n currency: alacarte.line!.discount!.currency,\n }\n : null;\n\n // Keep the coupon field in sync when a code is applied via URL or API.\n // Don't overwrite the field with empty when only an automatic offer applies.\n useEffect(() => {\n if (alacarte.checkout?.couponCode) {\n setPromoCodeValue(alacarte.checkout.couponCode);\n }\n }, [alacarte.checkout?.couponCode]);\n\n useEffect(() => {\n if (appliedCouponCode && isCouponDiscount && discountPercent != null) {\n setAdvertisedOffer({ code: appliedCouponCode, percent: discountPercent });\n }\n }, [appliedCouponCode, isCouponDiscount, discountPercent]);\n\n // A coupon alert closed with focus inside it: go back to the coupon control\n // (Remove when a coupon is applied, otherwise the field).\n const focusCouponControl = useCallback(() => {\n (document.getElementById('promoCodeRemove') ?? document.getElementById('promoCode'))?.focus();\n }, []);\n\n // No query params and no active cart — nothing to check out, send the\n // learner home rather than showing a placeholder.\n useEffect(() => {\n if (REDIRECT_ON_NO_ACTIVE_CHECKOUT && alacarte.phase === 'noActiveCheckout') {\n window.location.href = homeUrl;\n }\n }, [alacarte.phase, homeUrl]);\n\n // Express checkout (Apple Pay / Google Pay): runs the full place-order flow\n // using a wallet-provided PaymentMethod id instead of the mounted card element.\n const handleExpressPayment = useCallback(async (paymentMethodId: string, walletCountry?: string) => {\n if (!c.stripe) throw new Error('Stripe not loaded');\n const stripeInstance = c.stripe;\n const country = (c.billing.country || walletCountry || c.userCountry || '').trim().toUpperCase();\n if (!country) {\n throw new Error('Please select a country before using Apple Pay or Google Pay.');\n }\n\n await alacarte.placeOrderAsync({\n billing: {\n ...c.billing,\n country,\n },\n confirmCardPayment: async (clientSecret: string) => {\n await confirmPaymentWithMethodId({\n stripe: stripeInstance,\n clientSecret,\n paymentMethodId,\n });\n },\n });\n }, [alacarte, c.billing, c.userCountry, c.stripe]);\n\n // Express checkout (PayPal): tCheckoutPlaceOrder(PAYPAL) when the PayPal\n // button is clicked; approve/cancel go straight to the à la carte hook.\n // The card form isn't validated — PayPal collects the payer's details.\n const handlePaypalCreateOrder = useCallback(() => alacarte.startPaypalOrder({\n billing: {\n ...c.billing,\n country: c.billing.country || c.userCountry || '',\n },\n }), [alacarte, c.billing, c.userCountry]);\n\n const showProcessing\n = c.returningFromStripe\n && c.processingSubscription\n && c.phase !== 'success'\n && c.phase !== 'blocked'\n && c.phase !== 'failed';\n const showForm\n = !showProcessing\n && (c.phase === 'init'\n || c.phase === 'ready'\n || c.phase === 'failed'\n || c.phase === 'processing');\n const failedMessage = getLearnerFacingCheckoutMessage(c.lastComment);\n\n const { displayStart, displayEnd } = getTrialDateRange();\n\n // const isBillingCountryBlocked = GATE_CHECK_COUNTRY\n // && !!c.billing.country\n // && !ALLOWED_CHECKOUT_COUNTRIES.includes(c.billing.country);\n\n const selectedCycle: BillingCycle = c.selectedCycle;\n\n // Prefer the à la carte course's own detail (skills/badge/image, richer than\n // the subscription flow's ?course_run_key= lookup) when we selected a course.\n // When already-owned the line may be null, so fall back to the selector kind.\n const isCourseProduct = alacarte.line?.kind === 'course' || alacarte.selector?.kind === 'course';\n const isProgramProduct = alacarte.line?.kind === 'program' || alacarte.selector?.kind === 'program';\n\n const alacarteCourseDetail: CourseDetail | null\n = isCourseProduct && alacarte.productDetail && 'maId' in alacarte.productDetail\n ? alacarte.productDetail\n : null;\n const courseForSummary = alacarteCourseDetail ?? c.course;\n\n const alacarteProgramDetail: ProgramDetail | null\n = isProgramProduct && alacarte.productDetail && 'tCourses' in alacarte.productDetail\n ? alacarte.productDetail\n : null;\n\n const handleStartCourse = () => {\n const alacarteCourseUrl = alacarteCourseDetail?.tUrlCourse\n || (alacarte.productDetail && 'tUrlCourse' in alacarte.productDetail\n ? alacarte.productDetail.tUrlCourse\n : null);\n if (alacarteCourseUrl) {\n window.location.href = alacarteCourseUrl;\n } else if (c.course?.tUrlCourse) {\n window.location.href = c.course.tUrlCourse;\n } else {\n window.location.href = homeUrl || '/';\n }\n };\n\n const courseLabel = c.course\n ? [c.course.tBrandText, c.course.maName].filter(Boolean).join(': ')\n : null;\n\n const isAlreadyOwned = alacarte.isAlreadyOwned;\n const { paymentTimedOut } = alacarte;\n // Grey out and block the form + summary; only the alerts above stay usable.\n const isLocked = isAlreadyOwned || paymentTimedOut;\n // The overlay only blocks the pointer — inert takes the locked content out\n // of the tab order too.\n const lockedInertRef = useInert<HTMLDivElement>(isLocked);\n\n // Live while shown, so the links drop off as the learner fixes each field.\n const invalidPaymentFields = validationRequest > 0\n ? getInvalidPaymentFields(c.cardFieldStates, c.billing)\n : [];\n const handleValidationResult = (invalidFields: PaymentFieldKey[]) => {\n setValidationRequest((n) => (invalidFields.length > 0 ? n + 1 : 0));\n };\n const focusPaymentField = (field: PaymentFieldKey) => {\n if (isCardFieldKey(field)) {\n c.focusCardField(field);\n } else {\n // Billing controls use the field key as their id (Form.Group controlId).\n document.getElementById(field)?.focus();\n }\n };\n\n if (showProcessing) {\n return <ProcessingScreen />;\n }\n\n // TEMPORARY — flip to true to dump à la carte hook state while validating\n // against the real backend. Remove AlacarteDebugPanel once the flow is solid.\n const SHOW_ALACARTE_DEBUG = false;\n const alacarteDebug = SHOW_ALACARTE_DEBUG\n ? <AlacarteDebugPanel data={alacarte} />\n : null;\n\n // Confirmation: show once the order is ready (or failed to load). While\n // getTwouOrder is still polling, keep the checkout form so Pay now can show\n // \"Processing...\" instead of a full-page loader.\n if (alacarte.placedOrder || alacarte.placedOrderError) {\n const confirmationTitle = alacarte.line?.kind === 'program'\n ? alacarte.line.programName\n : alacarte.line?.kind === 'course'\n ? alacarte.line.courseName\n : null;\n\n return (\n <>\n {alacarteDebug}\n <Row className=\"checkout__container alacarte-confirmation__container bg-light-200\">\n <Col xs={12}>\n <AlacarteConfirmation\n order={alacarte.placedOrder}\n awaiting={false}\n error={alacarte.placedOrderError}\n onContinue={handleStartCourse}\n productDetail={alacarte.productDetail}\n productTitle={confirmationTitle}\n ownedCourses={\n alacarte.line?.kind === 'program'\n ? (alacarte.line.ownedCourses ?? null)\n : null\n }\n orderHistoryUrl={orderHistoryUrl ?? null}\n placedAt={alacarte.placedOrderPlacedAt}\n />\n </Col>\n </Row>\n </>\n );\n }\n\n if (alacarte.phase === 'loading') {\n return (\n <>\n {alacarteDebug}\n <ProcessingScreen />\n </>\n );\n }\n if (alacarte.phase === 'noActiveCheckout' && REDIRECT_ON_NO_ACTIVE_CHECKOUT) {\n // Redirects home via the effect above — show a spinner rather than a\n // notice while that happens.\n return (\n <>\n {alacarteDebug}\n <ProcessingScreen />\n </>\n );\n }\n if (alacarte.phase === 'noActiveCheckout') {\n return (\n <>\n {alacarteDebug}\n <AlacarteNotice messageId={alacarte.noticeMessageId!} />\n </>\n );\n }\n // Product unavailable / not found / not purchasable — banner only, no checkout form.\n if (alacarte.phase === 'notPurchasable' || alacarte.phase === 'error') {\n return (\n <>\n {alacarteDebug}\n <Row className=\"checkout__container bg-light-200\">\n <Col xs={12}>\n <Alert\n variant=\"danger\"\n icon={ErrorIcon}\n data-testid=\"alacarte-error-banner\"\n >\n {alacarte.error || 'Something went wrong with checkout.'}\n </Alert>\n </Col>\n </Row>\n </>\n );\n }\n\n // Price differs from what the learner viewed before checkout (ALC-159).\n const showPriceChangedAlert = !!alacarte.priceChanged && !dismissedPriceChange && !isLocked;\n const priceChangedKind = isProgramProduct ? 'program' : 'course';\n\n return (\n <>\n {alacarteDebug}\n <Row className=\"checkout__container bg-light-200\">\n {/* <CountryUnavailableModal\n isOpen={isBillingCountryBlocked}\n homeUrl={homeUrl}\n /> */}\n {alacarte.sanctionsBlocked && (\n <OrderBlockedModal\n isOpen\n referenceCode={alacarte.sanctionsBlocked.referenceCode}\n homeUrl={homeUrl}\n />\n )}\n <Col xs={12} className={isLocked ? 'checkout__locked-overlay' : ''}>\n {/* DOM order is the tab order on every breakpoint: alerts, then the\n summary and coupon, then payment. From lg up, the grid in\n checkout.scss moves the summary to the right column. */}\n <Row className=\"checkout__layout\">\n <Col xs={12} className=\"checkout__header\">\n <div>\n <h1 className=\"font-weight-bold text-primary-900 mb-lg-4\">\n Checkout\n </h1>\n\n {paymentTimedOut && (\n <PaymentTimeoutAlert className=\"checkout__overlay-alert mb-3\" />\n )}\n\n {isAlreadyOwned && (\n <Alert\n variant=\"danger\"\n icon={ErrorIcon}\n className=\"checkout__overlay-alert mb-3\"\n data-testid=\"already-owned-alert\"\n >\n <p className=\"mb-3\">\n {formatMessage(\n alacarte.selector?.kind === 'program'\n ? messages.alreadyPaidProgram\n : messages.alreadyPaidCourse,\n )}\n </p>\n <div className=\"d-flex align-items-center justify-content-end gap-3 flex-wrap\">\n {orderHistoryUrl && (\n <a href={orderHistoryUrl} className=\"checkout__order-history text-gray-900 font-weight-bold\">\n {formatMessage(messages.viewOrderHistory)}\n </a>\n )}\n <Button variant=\"brand\" className=\"rounded-pill\" onClick={handleStartCourse}>\n {formatMessage(messages.goToCourse)}\n </Button>\n </div>\n </Alert>\n )}\n\n {c.error && (\n <Alert\n variant=\"danger\"\n icon={ErrorIcon}\n dismissible\n onClose={c.clearError}\n >\n {c.error}\n </Alert>\n )}\n\n {alacarte.placeOrderError && (\n <Alert\n variant=\"danger\"\n icon={ErrorIcon}\n dismissible\n onClose={alacarte.clearPlaceOrderError}\n className=\"mb-3\"\n >\n {alacarte.placeOrderError}\n </Alert>\n )}\n\n {alacarte.paymentDecline?.message && !alacarte.placeOrderError && !paymentTimedOut && (\n <Alert\n variant=\"danger\"\n icon={ErrorIcon}\n className=\"mb-3\"\n data-testid=\"payment-decline-alert\"\n >\n {getLearnerFacingStripeMessage({\n message: alacarte.paymentDecline.message,\n code: alacarte.paymentDecline.code ?? undefined,\n })}\n </Alert>\n )}\n {/* paymentInterrupted alert shown when payment is interrupted but not declined, no place order error, and payment has not timed out */}\n {alacarte.paymentInterrupted && !alacarte.paymentDecline && !alacarte.placeOrderError && !paymentTimedOut && (\n <Alert\n variant=\"danger\"\n icon={ErrorIcon}\n dismissible\n onClose={alacarte.clearPaymentInterrupted}\n className=\"mb-3\"\n data-testid=\"payment-interrupted-alert\"\n >\n {formatMessage(messages.paymentInterruptedAlert)}\n </Alert>\n )}\n {/* walletPaymentCancelled alert shown when the Apple Pay / Google Pay sheet is closed without paying */}\n {alacarte.walletPaymentCancelled && !alacarte.paymentInterrupted\n && !alacarte.paymentDecline && !alacarte.placeOrderError && !paymentTimedOut && (\n <Alert\n variant=\"danger\"\n icon={ErrorIcon}\n dismissible\n onClose={alacarte.clearWalletPaymentCancelled}\n className=\"mb-3\"\n data-testid=\"wallet-payment-cancelled-alert\"\n >\n {formatMessage(messages.walletPaymentCancelledAlert)}\n </Alert>\n )}\n\n {showPriceChangedAlert && (\n <PriceChangedAlert\n kind={priceChangedKind}\n onDismiss={() => setDismissedPriceChange(true)}\n className=\"mb-3\"\n />\n )}\n\n {!alacarte.priceAccepted && !alacarte.priceChanged && isAlacarteReady && alacarte.line?.amountDue && (\n <Alert variant=\"info\" className=\"mb-3\" data-testid=\"price-accept-notice\">\n {formatMessage(messages.priceChangedNotice, {\n amount: alacarte.line.amountDue.amount.toFixed(2),\n currency: alacarte.line.amountDue.currency,\n })}\n </Alert>\n )}\n\n {showForm && (\n <>\n <PaymentValidationAlert\n fields={invalidPaymentFields}\n country={c.billing.country}\n focusRequest={validationRequest}\n onFieldSelect={focusPaymentField}\n className=\"mb-3\"\n />\n {c.phase === 'failed' && (\n <Alert variant=\"danger\" icon={ErrorIcon} className=\"mb-3\">\n {failedMessage\n || formatMessage(messages.paymentProcessingDescription)}\n </Alert>\n )}\n {appliedCouponCode && appliedDiscount && dismissedCouponAlert !== appliedCouponCode && (\n <AutoDismissAlert\n key={appliedCouponCode}\n variant=\"success\"\n icon={CheckCircle}\n dismissible\n closeLabel={formatMessage(messages.dismiss)}\n onClose={() => {\n setDismissedCouponAlert(appliedCouponCode);\n setFocusCouponAlert(false);\n }}\n className=\"coupon-applied-alert\"\n data-testid=\"coupon-applied-alert\"\n role=\"status\"\n // Only the learner's own Apply takes focus here, so\n // screen readers read the alert, not Remove.\n focusOnMount={focusCouponAlert}\n returnFocus={focusCouponControl}\n >\n <span aria-hidden=\"true\">🎉 </span>\n {formatMessage(messages.couponAppliedAlert, {\n code: appliedCouponCode,\n percent: appliedDiscount.percent,\n })}\n </AutoDismissAlert>\n )}\n {alacarte.removedCouponCode && (() => {\n const removedCode = alacarte.removedCouponCode;\n const removedText = formatMessage(\n messages.couponRemovedAlert,\n { code: removedCode },\n );\n // Bold the interpolated code without baking markup into the\n // translation string — find it in the formatted sentence.\n const codeIndex = removedText.indexOf(removedCode);\n return (\n <AutoDismissAlert\n key={removedCode}\n variant=\"success\"\n icon={CheckCircle}\n dismissible\n closeLabel={formatMessage(messages.dismiss)}\n onClose={() => {\n alacarte.clearRemovedCouponCode();\n setFocusCouponAlert(false);\n }}\n className=\"coupon-removed-alert\"\n data-testid=\"coupon-removed-alert\"\n role=\"status\"\n focusOnMount={focusCouponAlert}\n returnFocus={focusCouponControl}\n >\n {codeIndex === -1 ? removedText : (\n <>\n {removedText.slice(0, codeIndex)}\n <strong>{removedCode}</strong>\n {removedText.slice(codeIndex + removedCode.length)}\n </>\n )}\n </AutoDismissAlert>\n );\n })()}\n </>\n )}\n </div>\n </Col>\n\n {/* ── Summary — swaps to EnrollmentSummary on success ── */}\n <Col xs={12} className=\"payment__summary\">\n <div ref={lockedInertRef} data-testid=\"checkout-summary-region\">\n {c.phase === 'success' ? (\n <EnrollmentSummary\n course={c.course}\n onStartCourse={handleStartCourse}\n />\n ) : (\n <CartSummary\n defaultCycle={selectedCycle}\n onCycleChange={c.processingSubscription ? undefined : c.setCycle}\n course={courseForSummary}\n alacarteLine={alacarte.line}\n programDetail={alacarteProgramDetail}\n programName={alacarte.ownedProductName}\n promoCode={isAlacarteReady ? {\n value: promoCodeValue,\n // Keep a coupon error up while the learner edits the code;\n // applyCoupon clears it on the next Apply.\n onChange: setPromoCodeValue,\n onApply: () => {\n setFocusCouponAlert(true);\n alacarte.applyCoupon(promoCodeValue);\n },\n onRemove: () => {\n setFocusCouponAlert(true);\n alacarte.removeCoupon();\n setPromoCodeValue('');\n setAdvertisedOffer(null);\n // The applied alert auto-dismisses, so re-applying the\n // same code must be able to show it again.\n setDismissedCouponAlert(null);\n },\n appliedCode: appliedCouponCode,\n discount: appliedDiscount,\n offer: !appliedCouponCode ? advertisedOffer : null,\n error: alacarte.couponError,\n isApplying: alacarte.couponApplying,\n disabled: alacarte.placingOrder,\n } : null}\n />\n )}\n </div>\n </Col>\n\n {/* ── Payment ── */}\n <Col xs={12} className=\"payment__options\">\n <div ref={lockedInertRef} data-testid=\"checkout-payment-region\">\n {showForm && (\n <PaymentForm\n billing={c.billing}\n setField={c.setField}\n numberMountRef={c.numberMountRef}\n expiryMountRef={c.expiryMountRef}\n cvcMountRef={c.cvcMountRef}\n cardError={c.cardError}\n cardFieldStates={c.cardFieldStates}\n stripeReady={c.stripeReady}\n sessionReady={c.sessionReady}\n submitting={\n isAlacarteReady\n ? (alacarte.placingOrder || alacarte.awaitingPlacedOrder)\n : c.processingSubscription\n }\n onPlaceOrder={\n isAlacarteReady\n ? () => {\n alacarte.placeOrder({\n billing: {\n ...c.billing,\n // Country is required on tCheckoutPlaceOrder (two-letter ISO).\n // Prefer the form selection; fall back to gate geolocation.\n country: c.billing.country || c.userCountry || '',\n },\n confirmCardPayment: c.confirmCardPayment,\n });\n }\n : c.placeOrder\n }\n onValidationError={handleValidationResult}\n trialEnd={selectedCycle === 'monthly' ? displayEnd : undefined}\n priceToShow={null}\n cycleToShow={selectedCycle === 'monthly' ? 'monthly' : 'annual'}\n userCountry={c.userCountry}\n geolocationUrl={props.geolocationUrl}\n alacarteLine={alacarte.line}\n stripe={c.stripe}\n expressCountry={c.billing.country || c.userCountry || 'US'}\n onExpressPayment={isAlacarteReady ? handleExpressPayment : undefined}\n onExpressClick={isAlacarteReady ? alacarte.clearPaymentAlerts : undefined}\n onExpressCancel={isAlacarteReady ? alacarte.markWalletPaymentCancelled : undefined}\n paypalClientId={paypalClientId}\n onPaypalCreateOrder={isAlacarteReady ? handlePaypalCreateOrder : undefined}\n onPaypalApprove={isAlacarteReady ? alacarte.approvePaypalOrder : undefined}\n onPaypalCancel={isAlacarteReady ? alacarte.cancelPaypalOrder : undefined}\n />\n )}\n\n {c.phase === 'success' && (\n <SuccessScreen\n purchaseDate={displayStart}\n courseLabel={courseLabel}\n onFindCourse={handleStartCourse}\n />\n )}\n\n {c.phase === 'blocked' && (\n <BlockedScreen detail={c.lastComment} />\n )}\n </div>\n </Col>\n </Row>\n </Col>\n </Row>\n </>\n );\n};\n\nexport default Checkout;\n"]}
|
|
1
|
+
{"version":3,"file":"Checkout.js","sourceRoot":"","sources":["../../../src/components/Checkout/Checkout.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,OAAc,EAAE,WAAW,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAChE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAC;AAC3D,OAAO,EAAE,WAAW,EAAE,KAAK,IAAI,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACzE,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,WAAW,MAAM,8BAA8B,CAAC;AAEvD,OAAO,EAAE,mBAAmB,EAAE,MAAM,sCAAsC,CAAC;AAC3E,kGAAkG;AAClG,oFAAoF;AACpF,OAAO,WAAW,MAAM,4BAA4B,CAAC;AACrD,OAAO,iBAAiB,MAAM,wCAAwC,CAAC;AACvE,OAAO,WAAW,MAAM,4BAA4B,CAAC;AACrD,4FAA4F;AAC5F,OAAO,iBAAiB,MAAM,wCAAwC,CAAC;AACvE,OAAO,cAAc,MAAM,kCAAkC,CAAC;AAC9D,OAAO,oBAAoB,MAAM,8CAA8C,CAAC;AAChF,OAAO,mBAAmB,MAAM,4CAA4C,CAAC;AAC7E,OAAO,iBAAiB,MAAM,wCAAwC,CAAC;AACvE,OAAO,sBAAsB,MAAM,kDAAkD,CAAC;AACtF,OAAO,gBAAgB,MAAM,sCAAsC,CAAC;AACpE,OAAO,kBAAkB,MAAM,0CAA0C,CAAC,CAAC,kDAAkD;AAC7H,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAC/C,OAAO,EAAE,+BAA+B,EAAE,MAAM,4BAA4B,CAAC;AAC7E,OAAO,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;AAC9D,OAAO,EAAE,QAAQ,EAAE,MAAM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,CAAC,WAAW,IAAI,IAAI,EAC1D,gBAAgB,EAAE,eAAe,CAAC,CAAC,CAAC,oBAAoB,CAAC,CAAC,CAAC,SAAS,EACpE,cAAc,EAAE,eAAe,CAAC,CAAC,CAAC,QAAQ,CAAC,kBAAkB,CAAC,CAAC,CAAC,SAAS,EACzE,eAAe,EAAE,eAAe,CAAC,CAAC,CAAC,QAAQ,CAAC,0BAA0B,CAAC,CAAC,CAAC,SAAS,EAClF,cAAc,EAAE,cAAc,EAC9B,mBAAmB,EAAE,eAAe,CAAC,CAAC,CAAC,uBAAuB,CAAC,CAAC,CAAC,SAAS,EAC1E,eAAe,EAAE,eAAe,CAAC,CAAC,CAAC,QAAQ,CAAC,kBAAkB,CAAC,CAAC,CAAC,SAAS,EAC1E,cAAc,EAAE,eAAe,CAAC,CAAC,CAAC,QAAQ,CAAC,iBAAiB,CAAC,CAAC,CAAC,SAAS,GACxE,CACH,EAEA,CAAC,CAAC,KAAK,KAAK,SAAS,IAAI,CACxB,KAAC,aAAa,IACZ,YAAY,EAAE,YAAY,EAC1B,WAAW,EAAE,WAAW,EACxB,YAAY,EAAE,iBAAiB,GAC/B,CACH,EAEA,CAAC,CAAC,KAAK,KAAK,SAAS,IAAI,CACxB,KAAC,aAAa,IAAC,MAAM,EAAE,CAAC,CAAC,WAAW,GAAI,CACzC,IACG,GACF,IACF,GACF,IACF,IACL,CACJ,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,QAAQ,CAAC","sourcesContent":["import React, { useCallback, useEffect, useState } from 'react';\nimport { Alert, Button, Col, Row } from '@openedx/paragon';\nimport { CheckCircle, Error as ErrorIcon } from '@openedx/paragon/icons';\nimport { useIntl } from '@openedx/frontend-base';\nimport useCheckout from '../../data/hooks/useCheckout';\nimport type { UseCheckoutOptions } from '../../data/hooks/useCheckout';\nimport { useAlacarteCheckout } from '../../data/hooks/useAlacarteCheckout';\n// Billing-country gate disabled: every country can check out; embargo is enforced by the backend.\n// import { ALLOWED_CHECKOUT_COUNTRIES, GATE_CHECK_COUNTRY } from '../../constants';\nimport CartSummary from '../CartSummary/CartSummary';\nimport EnrollmentSummary from '../EnrollmentSummary/EnrollmentSummary';\nimport PaymentForm from '../PaymentForm/PaymentForm';\n// import CountryUnavailableModal from '../CountryUnavailableModal/CountryUnavailableModal';\nimport OrderBlockedModal from '../OrderBlockedModal/OrderBlockedModal';\nimport AlacarteNotice from '../AlacarteNotice/AlacarteNotice';\nimport AlacarteConfirmation from '../AlacarteConfirmation/AlacarteConfirmation';\nimport PaymentTimeoutAlert from '../PaymentTimeoutAlert/PaymentTimeoutAlert';\nimport PriceChangedAlert from '../PriceChangedAlert/PriceChangedAlert';\nimport PaymentValidationAlert from '../PaymentValidationAlert/PaymentValidationAlert';\nimport AutoDismissAlert from '../AutoDismissAlert/AutoDismissAlert';\nimport AlacarteDebugPanel from '../AlacarteDebugPanel/AlacarteDebugPanel'; // TEMPORARY — remove alongside AlacarteDebugPanel\nimport { getTrialDateRange } from '@src/utils';\nimport { getLearnerFacingCheckoutMessage } from '../../utils/checkoutErrors';\nimport { appliedDiscountPercent } from '../../utils/discount';\nimport { useInert } from '../../utils/inert';\nimport { getInvalidPaymentFields, isCardFieldKey } from '../../utils/paymentValidation';\nimport type { PaymentFieldKey } from '../../utils/paymentValidation';\nimport { confirmPaymentWithMethodId, getLearnerFacingStripeMessage } from '../../utils/stripeCard';\nimport { SuccessScreen, BlockedScreen, ProcessingScreen } from '../StatusScreens/StatusScreens';\nimport type { BillingCycle, CourseDetail } from '../../types';\nimport type { ProgramDetail } from '../../types/alacarte';\nimport messages from './Messages';\n\n// TEMPORARY — redirect-home-on-noActiveCheckout disabled per request; shows a\n// banner instead so the case is visible while the flow is being verified.\n// Flip back to true to restore the redirect.\nconst REDIRECT_ON_NO_ACTIVE_CHECKOUT = false;\n\nexport type CheckoutProps = UseCheckoutOptions & {\n /** Homepage URL for the country-unavailable modal CTA. */\n homeUrl?: string,\n /** Endpoint used to look up the representative IP for a selected country. */\n geolocationUrl?: string,\n /** Learner dashboard / order history URL for confirmation CTAs. */\n orderHistoryUrl?: string,\n /** Learner dashboard URL — session-error recovery link and \"See my courses\" on the already-owned program alert. */\n learnerDashboardUrl?: string,\n /** PayPal JS SDK client id — enables the express PayPal button. */\n paypalClientId?: string,\n};\n\nconst Checkout = ({\n homeUrl = '/',\n orderHistoryUrl,\n learnerDashboardUrl,\n paypalClientId,\n ...props\n}: CheckoutProps) => {\n const { formatMessage } = useIntl();\n const alacarte = useAlacarteCheckout({\n apiUrl: props.apiUrl,\n edxSessionUrl: props.edxSessionUrl,\n skipSubscriptionCourseRuns: props.skipSubscriptionCourseRuns,\n });\n const c = useCheckout(props);\n const [promoCodeValue, setPromoCodeValue] = useState('');\n const [dismissedCouponAlert, setDismissedCouponAlert] = useState<string | null>(null);\n // Set by the learner's own Apply / Remove, so the coupon alert it produces\n // takes focus (a coupon applied on load doesn't). By the time the alert\n // mounts, couponApplying has already gone false, so it can't drive this.\n const [focusCouponAlert, setFocusCouponAlert] = useState(false);\n // 0 hides the validation alert; each failed Pay now bumps it, which moves\n // focus to the alert.\n const [validationRequest, setValidationRequest] = useState(0);\n const [dismissedPriceChange, setDismissedPriceChange] = useState(false);\n // Last code we successfully priced — drives the \"Save {percent}% with code\n // {code}\" hint on the empty field while a coupon is not yet applied.\n const [advertisedOffer, setAdvertisedOffer] = useState<{ code: string, percent: number } | null>(null);\n const isAlacarteReady = (alacarte.phase === 'ready' || alacarte.phase === 'alreadyOwned') && !!alacarte.checkout;\n const appliedCouponCode = alacarte.checkout?.couponCode?.trim()\n ? alacarte.checkout.couponCode.trim()\n : null;\n const discountPercent = appliedDiscountPercent(alacarte.line);\n // Only treat the line discount as a removable coupon when the backend says\n // so (or a coupon code is present). Automatic offers show only in CartSummary's\n // discount row and must not drive PromoCode's applied/remove UI.\n const isCouponDiscount = !!alacarte.line?.discount\n && alacarte.line.discountSource !== 'automatic'\n && (alacarte.line.discountSource === 'coupon' || !!appliedCouponCode);\n const appliedDiscount = isCouponDiscount && discountPercent != null\n ? {\n percent: discountPercent,\n amount: alacarte.line!.discount!.amount,\n currency: alacarte.line!.discount!.currency,\n }\n : null;\n\n // Keep the coupon field in sync when a code is applied via URL or API.\n // Don't overwrite the field with empty when only an automatic offer applies.\n useEffect(() => {\n if (alacarte.checkout?.couponCode) {\n setPromoCodeValue(alacarte.checkout.couponCode);\n }\n }, [alacarte.checkout?.couponCode]);\n\n useEffect(() => {\n if (appliedCouponCode && isCouponDiscount && discountPercent != null) {\n setAdvertisedOffer({ code: appliedCouponCode, percent: discountPercent });\n }\n }, [appliedCouponCode, isCouponDiscount, discountPercent]);\n\n // A coupon alert closed with focus inside it: go back to the coupon control\n // (Remove when a coupon is applied, otherwise the field).\n const focusCouponControl = useCallback(() => {\n (document.getElementById('promoCodeRemove') ?? document.getElementById('promoCode'))?.focus();\n }, []);\n\n // No query params and no active cart — nothing to check out, send the\n // learner home rather than showing a placeholder.\n useEffect(() => {\n if (REDIRECT_ON_NO_ACTIVE_CHECKOUT && alacarte.phase === 'noActiveCheckout') {\n window.location.href = homeUrl;\n }\n }, [alacarte.phase, homeUrl]);\n\n // Express checkout (Apple Pay / Google Pay): runs the full place-order flow\n // using a wallet-provided PaymentMethod id instead of the mounted card element.\n const handleExpressPayment = useCallback(async (paymentMethodId: string, walletCountry?: string) => {\n if (!c.stripe) throw new Error('Stripe not loaded');\n const stripeInstance = c.stripe;\n const country = (c.billing.country || walletCountry || c.userCountry || '').trim().toUpperCase();\n if (!country) {\n throw new Error('Please select a country before using Apple Pay or Google Pay.');\n }\n\n await alacarte.placeOrderAsync({\n billing: {\n ...c.billing,\n country,\n },\n confirmCardPayment: async (clientSecret: string) => {\n await confirmPaymentWithMethodId({\n stripe: stripeInstance,\n clientSecret,\n paymentMethodId,\n });\n },\n });\n }, [alacarte, c.billing, c.userCountry, c.stripe]);\n\n // Express checkout (PayPal): tCheckoutPlaceOrder(PAYPAL) when the PayPal\n // button is clicked; approve/cancel go straight to the à la carte hook.\n // The card form isn't validated — PayPal collects the payer's details.\n const handlePaypalCreateOrder = useCallback(() => alacarte.startPaypalOrder({\n billing: {\n ...c.billing,\n country: c.billing.country || c.userCountry || '',\n },\n }), [alacarte, c.billing, c.userCountry]);\n\n const showProcessing\n = c.returningFromStripe\n && c.processingSubscription\n && c.phase !== 'success'\n && c.phase !== 'blocked'\n && c.phase !== 'failed';\n const showForm\n = !showProcessing\n && (c.phase === 'init'\n || c.phase === 'ready'\n || c.phase === 'failed'\n || c.phase === 'processing');\n const failedMessage = getLearnerFacingCheckoutMessage(c.lastComment);\n\n const { displayStart, displayEnd } = getTrialDateRange();\n\n // const isBillingCountryBlocked = GATE_CHECK_COUNTRY\n // && !!c.billing.country\n // && !ALLOWED_CHECKOUT_COUNTRIES.includes(c.billing.country);\n\n const selectedCycle: BillingCycle = c.selectedCycle;\n\n // Prefer the à la carte course's own detail (skills/badge/image, richer than\n // the subscription flow's ?course_run_key= lookup) when we selected a course.\n // When already-owned the line may be null, so fall back to the selector kind.\n const isCourseProduct = alacarte.line?.kind === 'course' || alacarte.selector?.kind === 'course';\n const isProgramProduct = alacarte.line?.kind === 'program' || alacarte.selector?.kind === 'program';\n\n const alacarteCourseDetail: CourseDetail | null\n = isCourseProduct && alacarte.productDetail && 'maId' in alacarte.productDetail\n ? alacarte.productDetail\n : null;\n const courseForSummary = alacarteCourseDetail ?? c.course;\n\n const alacarteProgramDetail: ProgramDetail | null\n = isProgramProduct && alacarte.productDetail && 'tCourses' in alacarte.productDetail\n ? alacarte.productDetail\n : null;\n\n const handleStartCourse = () => {\n const alacarteCourseUrl = alacarteCourseDetail?.tUrlCourse\n || (alacarte.productDetail && 'tUrlCourse' in alacarte.productDetail\n ? alacarte.productDetail.tUrlCourse\n : null);\n if (alacarteCourseUrl) {\n window.location.href = alacarteCourseUrl;\n } else if (c.course?.tUrlCourse) {\n window.location.href = c.course.tUrlCourse;\n } else {\n window.location.href = homeUrl || '/';\n }\n };\n\n const courseLabel = c.course\n ? [c.course.tBrandText, c.course.maName].filter(Boolean).join(': ')\n : null;\n\n const isAlreadyOwned = alacarte.isAlreadyOwned;\n // Fully-owned program: name the program and how many certificates it has.\n // The line may be synthetic (built from owned products), so fall back to the\n // owned-product name and the owned-course count.\n const isAlreadyOwnedProgram = isAlreadyOwned && alacarte.selector?.kind === 'program';\n const ownedProgramName = (alacarte.line?.kind === 'program' ? alacarte.line.programName : null)\n || alacarte.ownedProductName;\n const ownedProgramCertificateCount = alacarteProgramDetail?.tCourses.length\n || (alacarte.line?.kind === 'program' ? alacarte.line.ownedCourses?.length : null)\n || null;\n const alreadyOwnedMessage = !isAlreadyOwnedProgram\n ? formatMessage(messages.alreadyPaidCourse)\n : ownedProgramName && ownedProgramCertificateCount\n ? formatMessage(messages.alreadyPaidAllProgramCertificates, {\n certificateCount: ownedProgramCertificateCount,\n programName: ownedProgramName,\n })\n : formatMessage(messages.alreadyPaidProgram);\n const handleSeeMyCourses = () => {\n window.location.href = learnerDashboardUrl || homeUrl || '/';\n };\n const { paymentTimedOut } = alacarte;\n // Grey out and block the form + summary; only the alerts above stay usable.\n const isLocked = isAlreadyOwned || paymentTimedOut;\n // The overlay only blocks the pointer — inert takes the locked content out\n // of the tab order too.\n const lockedInertRef = useInert<HTMLDivElement>(isLocked);\n\n // Live while shown, so the links drop off as the learner fixes each field.\n const invalidPaymentFields = validationRequest > 0\n ? getInvalidPaymentFields(c.cardFieldStates, c.billing)\n : [];\n const handleValidationResult = (invalidFields: PaymentFieldKey[]) => {\n setValidationRequest((n) => (invalidFields.length > 0 ? n + 1 : 0));\n };\n const focusPaymentField = (field: PaymentFieldKey) => {\n if (isCardFieldKey(field)) {\n c.focusCardField(field);\n } else {\n // Billing controls use the field key as their id (Form.Group controlId).\n document.getElementById(field)?.focus();\n }\n };\n\n if (showProcessing) {\n return <ProcessingScreen />;\n }\n\n // TEMPORARY — flip to true to dump à la carte hook state while validating\n // against the real backend. Remove AlacarteDebugPanel once the flow is solid.\n const SHOW_ALACARTE_DEBUG = false;\n const alacarteDebug = SHOW_ALACARTE_DEBUG\n ? <AlacarteDebugPanel data={alacarte} />\n : null;\n\n // Confirmation: show once the order is ready (or failed to load). While\n // getTwouOrder is still polling, keep the checkout form so Pay now can show\n // \"Processing...\" instead of a full-page loader.\n if (alacarte.placedOrder || alacarte.placedOrderError) {\n const confirmationTitle = alacarte.line?.kind === 'program'\n ? alacarte.line.programName\n : alacarte.line?.kind === 'course'\n ? alacarte.line.courseName\n : null;\n\n return (\n <>\n {alacarteDebug}\n <Row className=\"checkout__container alacarte-confirmation__container bg-light-200\">\n <Col xs={12}>\n <AlacarteConfirmation\n order={alacarte.placedOrder}\n awaiting={false}\n error={alacarte.placedOrderError}\n onContinue={handleStartCourse}\n productDetail={alacarte.productDetail}\n productTitle={confirmationTitle}\n ownedCourses={\n alacarte.line?.kind === 'program'\n ? (alacarte.line.ownedCourses ?? null)\n : null\n }\n orderHistoryUrl={orderHistoryUrl ?? null}\n placedAt={alacarte.placedOrderPlacedAt}\n />\n </Col>\n </Row>\n </>\n );\n }\n\n if (alacarte.phase === 'loading') {\n return (\n <>\n {alacarteDebug}\n <ProcessingScreen />\n </>\n );\n }\n if (alacarte.phase === 'noActiveCheckout' && REDIRECT_ON_NO_ACTIVE_CHECKOUT) {\n // Redirects home via the effect above — show a spinner rather than a\n // notice while that happens.\n return (\n <>\n {alacarteDebug}\n <ProcessingScreen />\n </>\n );\n }\n if (alacarte.phase === 'noActiveCheckout') {\n return (\n <>\n {alacarteDebug}\n <AlacarteNotice messageId={alacarte.noticeMessageId!} />\n </>\n );\n }\n // Product unavailable / not found / not purchasable — banner only, no checkout form.\n if (alacarte.phase === 'notPurchasable' || alacarte.phase === 'error') {\n return (\n <>\n {alacarteDebug}\n <Row className=\"checkout__container bg-light-200\">\n <Col xs={12}>\n <Alert\n variant=\"danger\"\n icon={ErrorIcon}\n data-testid=\"alacarte-error-banner\"\n >\n {alacarte.error || 'Something went wrong with checkout.'}\n </Alert>\n </Col>\n </Row>\n </>\n );\n }\n\n // Price differs from what the learner viewed before checkout (ALC-159).\n const showPriceChangedAlert = !!alacarte.priceChanged && !dismissedPriceChange && !isLocked;\n const priceChangedKind = isProgramProduct ? 'program' : 'course';\n\n return (\n <>\n {alacarteDebug}\n <Row className=\"checkout__container bg-light-200\">\n {/* <CountryUnavailableModal\n isOpen={isBillingCountryBlocked}\n homeUrl={homeUrl}\n /> */}\n {alacarte.sanctionsBlocked && (\n <OrderBlockedModal\n isOpen\n referenceCode={alacarte.sanctionsBlocked.referenceCode}\n homeUrl={homeUrl}\n />\n )}\n <Col xs={12} className={isLocked ? 'checkout__locked-overlay' : ''}>\n {/* DOM order is the tab order on every breakpoint: alerts, then the\n summary and coupon, then payment. From lg up, the grid in\n checkout.scss moves the summary to the right column. */}\n <Row className=\"checkout__layout\">\n <Col xs={12} className=\"checkout__header\">\n <div>\n <h1 className=\"font-weight-bold text-primary-900 mb-lg-4\">\n Checkout\n </h1>\n\n {paymentTimedOut && (\n <PaymentTimeoutAlert className=\"checkout__overlay-alert mb-3\" />\n )}\n\n {isAlreadyOwned && (\n <Alert\n variant=\"danger\"\n icon={ErrorIcon}\n className=\"checkout__overlay-alert mb-3\"\n data-testid=\"already-owned-alert\"\n >\n <p className=\"mb-3\">{alreadyOwnedMessage}</p>\n <div className=\"d-flex align-items-center justify-content-end gap-3 flex-wrap\">\n {orderHistoryUrl && (\n <a href={orderHistoryUrl} className=\"checkout__order-history text-gray-900 font-weight-bold\">\n {formatMessage(messages.viewOrderHistory)}\n </a>\n )}\n {isAlreadyOwnedProgram ? (\n <Button variant=\"brand\" className=\"rounded-pill\" onClick={handleSeeMyCourses}>\n {formatMessage(messages.seeMyCourses)}\n </Button>\n ) : (\n <Button variant=\"brand\" className=\"rounded-pill\" onClick={handleStartCourse}>\n {formatMessage(messages.goToCourse)}\n </Button>\n )}\n </div>\n </Alert>\n )}\n\n {c.error && (\n <Alert\n variant=\"danger\"\n icon={ErrorIcon}\n dismissible\n onClose={c.clearError}\n >\n {c.error}\n </Alert>\n )}\n\n {alacarte.placeOrderError && (\n <Alert\n variant=\"danger\"\n icon={ErrorIcon}\n dismissible\n onClose={alacarte.clearPlaceOrderError}\n className=\"mb-3\"\n >\n {alacarte.placeOrderError}\n </Alert>\n )}\n\n {alacarte.paymentDecline?.message && !alacarte.placeOrderError && !paymentTimedOut && (\n <Alert\n variant=\"danger\"\n icon={ErrorIcon}\n className=\"mb-3\"\n data-testid=\"payment-decline-alert\"\n >\n {getLearnerFacingStripeMessage({\n message: alacarte.paymentDecline.message,\n code: alacarte.paymentDecline.code ?? undefined,\n })}\n </Alert>\n )}\n {/* paymentInterrupted alert shown when payment is interrupted but not declined, no place order error, and payment has not timed out */}\n {alacarte.paymentInterrupted && !alacarte.paymentDecline && !alacarte.placeOrderError && !paymentTimedOut && (\n <Alert\n variant=\"danger\"\n icon={ErrorIcon}\n dismissible\n onClose={alacarte.clearPaymentInterrupted}\n className=\"mb-3\"\n data-testid=\"payment-interrupted-alert\"\n >\n {formatMessage(messages.paymentInterruptedAlert)}\n </Alert>\n )}\n {/* walletPaymentCancelled alert shown when the Apple Pay / Google Pay sheet is closed without paying */}\n {alacarte.walletPaymentCancelled && !alacarte.paymentInterrupted\n && !alacarte.paymentDecline && !alacarte.placeOrderError && !paymentTimedOut && (\n <Alert\n variant=\"danger\"\n icon={ErrorIcon}\n dismissible\n onClose={alacarte.clearWalletPaymentCancelled}\n className=\"mb-3\"\n data-testid=\"wallet-payment-cancelled-alert\"\n >\n {formatMessage(messages.walletPaymentCancelledAlert)}\n </Alert>\n )}\n\n {showPriceChangedAlert && (\n <PriceChangedAlert\n kind={priceChangedKind}\n onDismiss={() => setDismissedPriceChange(true)}\n className=\"mb-3\"\n />\n )}\n\n {!alacarte.priceAccepted && !alacarte.priceChanged && isAlacarteReady && alacarte.line?.amountDue && (\n <Alert variant=\"info\" className=\"mb-3\" data-testid=\"price-accept-notice\">\n {formatMessage(messages.priceChangedNotice, {\n amount: alacarte.line.amountDue.amount.toFixed(2),\n currency: alacarte.line.amountDue.currency,\n })}\n </Alert>\n )}\n\n {showForm && (\n <>\n <PaymentValidationAlert\n fields={invalidPaymentFields}\n country={c.billing.country}\n focusRequest={validationRequest}\n onFieldSelect={focusPaymentField}\n className=\"mb-3\"\n />\n {c.phase === 'failed' && (\n <Alert variant=\"danger\" icon={ErrorIcon} className=\"mb-3\">\n {failedMessage\n || formatMessage(messages.paymentProcessingDescription)}\n </Alert>\n )}\n {appliedCouponCode && appliedDiscount && dismissedCouponAlert !== appliedCouponCode && (\n <AutoDismissAlert\n key={appliedCouponCode}\n variant=\"success\"\n icon={CheckCircle}\n dismissible\n closeLabel={formatMessage(messages.dismiss)}\n onClose={() => {\n setDismissedCouponAlert(appliedCouponCode);\n setFocusCouponAlert(false);\n }}\n className=\"coupon-applied-alert\"\n data-testid=\"coupon-applied-alert\"\n role=\"status\"\n // Only the learner's own Apply takes focus here, so\n // screen readers read the alert, not Remove.\n focusOnMount={focusCouponAlert}\n returnFocus={focusCouponControl}\n >\n <span aria-hidden=\"true\">🎉 </span>\n {formatMessage(messages.couponAppliedAlert, {\n code: appliedCouponCode,\n percent: appliedDiscount.percent,\n })}\n </AutoDismissAlert>\n )}\n {alacarte.removedCouponCode && (() => {\n const removedCode = alacarte.removedCouponCode;\n const removedText = formatMessage(\n messages.couponRemovedAlert,\n { code: removedCode },\n );\n // Bold the interpolated code without baking markup into the\n // translation string — find it in the formatted sentence.\n const codeIndex = removedText.indexOf(removedCode);\n return (\n <AutoDismissAlert\n key={removedCode}\n variant=\"success\"\n icon={CheckCircle}\n dismissible\n closeLabel={formatMessage(messages.dismiss)}\n onClose={() => {\n alacarte.clearRemovedCouponCode();\n setFocusCouponAlert(false);\n }}\n className=\"coupon-removed-alert\"\n data-testid=\"coupon-removed-alert\"\n role=\"status\"\n focusOnMount={focusCouponAlert}\n returnFocus={focusCouponControl}\n >\n {codeIndex === -1 ? removedText : (\n <>\n {removedText.slice(0, codeIndex)}\n <strong>{removedCode}</strong>\n {removedText.slice(codeIndex + removedCode.length)}\n </>\n )}\n </AutoDismissAlert>\n );\n })()}\n </>\n )}\n </div>\n </Col>\n\n {/* ── Summary — swaps to EnrollmentSummary on success ── */}\n <Col xs={12} className=\"payment__summary\">\n <div ref={lockedInertRef} data-testid=\"checkout-summary-region\">\n {c.phase === 'success' ? (\n <EnrollmentSummary\n course={c.course}\n onStartCourse={handleStartCourse}\n />\n ) : (\n <CartSummary\n defaultCycle={selectedCycle}\n onCycleChange={c.processingSubscription ? undefined : c.setCycle}\n course={courseForSummary}\n alacarteLine={alacarte.line}\n programDetail={alacarteProgramDetail}\n programName={alacarte.ownedProductName}\n promoCode={isAlacarteReady ? {\n value: promoCodeValue,\n // Keep a coupon error up while the learner edits the code;\n // applyCoupon clears it on the next Apply.\n onChange: setPromoCodeValue,\n onApply: () => {\n setFocusCouponAlert(true);\n alacarte.applyCoupon(promoCodeValue);\n },\n onRemove: () => {\n setFocusCouponAlert(true);\n alacarte.removeCoupon();\n setPromoCodeValue('');\n setAdvertisedOffer(null);\n // The applied alert auto-dismisses, so re-applying the\n // same code must be able to show it again.\n setDismissedCouponAlert(null);\n },\n appliedCode: appliedCouponCode,\n discount: appliedDiscount,\n offer: !appliedCouponCode ? advertisedOffer : null,\n error: alacarte.couponError,\n isApplying: alacarte.couponApplying,\n disabled: alacarte.placingOrder,\n } : null}\n />\n )}\n </div>\n </Col>\n\n {/* ── Payment ── */}\n <Col xs={12} className=\"payment__options\">\n <div ref={lockedInertRef} data-testid=\"checkout-payment-region\">\n {showForm && (\n <PaymentForm\n billing={c.billing}\n setField={c.setField}\n numberMountRef={c.numberMountRef}\n expiryMountRef={c.expiryMountRef}\n cvcMountRef={c.cvcMountRef}\n cardError={c.cardError}\n cardFieldStates={c.cardFieldStates}\n stripeReady={c.stripeReady}\n sessionReady={c.sessionReady}\n submitting={\n isAlacarteReady\n ? (alacarte.placingOrder || alacarte.awaitingPlacedOrder)\n : c.processingSubscription\n }\n onPlaceOrder={\n isAlacarteReady\n ? () => {\n alacarte.placeOrder({\n billing: {\n ...c.billing,\n // Country is required on tCheckoutPlaceOrder (two-letter ISO).\n // Prefer the form selection; fall back to gate geolocation.\n country: c.billing.country || c.userCountry || '',\n },\n confirmCardPayment: c.confirmCardPayment,\n });\n }\n : c.placeOrder\n }\n onValidationError={handleValidationResult}\n trialEnd={selectedCycle === 'monthly' ? displayEnd : undefined}\n priceToShow={null}\n cycleToShow={selectedCycle === 'monthly' ? 'monthly' : 'annual'}\n userCountry={c.userCountry}\n geolocationUrl={props.geolocationUrl}\n alacarteLine={alacarte.line}\n stripe={c.stripe}\n expressCountry={c.billing.country || c.userCountry || 'US'}\n onExpressPayment={isAlacarteReady ? handleExpressPayment : undefined}\n onExpressClick={isAlacarteReady ? alacarte.clearPaymentAlerts : undefined}\n onExpressCancel={isAlacarteReady ? alacarte.markWalletPaymentCancelled : undefined}\n paypalClientId={paypalClientId}\n onPaypalCreateOrder={isAlacarteReady ? handlePaypalCreateOrder : undefined}\n onPaypalApprove={isAlacarteReady ? alacarte.approvePaypalOrder : undefined}\n onPaypalCancel={isAlacarteReady ? alacarte.cancelPaypalOrder : undefined}\n />\n )}\n\n {c.phase === 'success' && (\n <SuccessScreen\n purchaseDate={displayStart}\n courseLabel={courseLabel}\n onFindCourse={handleStartCourse}\n />\n )}\n\n {c.phase === 'blocked' && (\n <BlockedScreen detail={c.lastComment} />\n )}\n </div>\n </Col>\n </Row>\n </Col>\n </Row>\n </>\n );\n};\n\nexport default Checkout;\n"]}
|
|
@@ -44,6 +44,11 @@ declare const messages: {
|
|
|
44
44
|
defaultMessage: string;
|
|
45
45
|
description: string;
|
|
46
46
|
};
|
|
47
|
+
alreadyPaidAllProgramCertificates: {
|
|
48
|
+
id: string;
|
|
49
|
+
defaultMessage: string;
|
|
50
|
+
description: string;
|
|
51
|
+
};
|
|
47
52
|
viewOrderHistory: {
|
|
48
53
|
id: string;
|
|
49
54
|
defaultMessage: string;
|
|
@@ -54,5 +59,10 @@ declare const messages: {
|
|
|
54
59
|
defaultMessage: string;
|
|
55
60
|
description: string;
|
|
56
61
|
};
|
|
62
|
+
seeMyCourses: {
|
|
63
|
+
id: string;
|
|
64
|
+
defaultMessage: string;
|
|
65
|
+
description: string;
|
|
66
|
+
};
|
|
57
67
|
};
|
|
58
68
|
export default messages;
|
|
@@ -43,7 +43,12 @@ const messages = defineMessages({
|
|
|
43
43
|
alreadyPaidProgram: {
|
|
44
44
|
id: 'checkout.alreadyPaid.program',
|
|
45
45
|
defaultMessage: "You've already paid for this program. You haven't been charged again.",
|
|
46
|
-
description: 'Alert shown when the learner already owns the program',
|
|
46
|
+
description: 'Alert shown when the learner already owns the program but its name or certificate count is unavailable',
|
|
47
|
+
},
|
|
48
|
+
alreadyPaidAllProgramCertificates: {
|
|
49
|
+
id: 'checkout.alreadyPaid.programAllCertificates',
|
|
50
|
+
defaultMessage: "You've purchased all {certificateCount} certificates {programName}, so there's nothing left to buy.",
|
|
51
|
+
description: 'Alert shown when the learner already owns every course (certificate) in the program',
|
|
47
52
|
},
|
|
48
53
|
viewOrderHistory: {
|
|
49
54
|
id: 'checkout.alreadyPaid.viewOrderHistory',
|
|
@@ -55,6 +60,11 @@ const messages = defineMessages({
|
|
|
55
60
|
defaultMessage: 'Go to course',
|
|
56
61
|
description: 'Button to navigate to the course on the already-paid alert',
|
|
57
62
|
},
|
|
63
|
+
seeMyCourses: {
|
|
64
|
+
id: 'checkout.alreadyPaid.seeMyCourses',
|
|
65
|
+
defaultMessage: 'See my courses',
|
|
66
|
+
description: 'Button to open the learner dashboard on the already-paid program alert',
|
|
67
|
+
},
|
|
58
68
|
});
|
|
59
69
|
export default messages;
|
|
60
70
|
//# sourceMappingURL=Messages.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Messages.js","sourceRoot":"","sources":["../../../src/components/Checkout/Messages.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAExD,MAAM,QAAQ,GAAG,cAAc,CAAC;IAC9B,4BAA4B,EAAE;QAC5B,EAAE,EAAE,mDAAmD;QACvD,cAAc,EAAE,oFAAoF;QACpG,WAAW,EAAE,gCAAgC;KAC9C;IACD,uBAAuB,EAAE;QACvB,EAAE,EAAE,kCAAkC;QACtC,cAAc,EAAE,uGAAuG;QACvH,WAAW,EAAE,6EAA6E;KAC3F;IACD,2BAA2B,EAAE;QAC3B,EAAE,EAAE,sCAAsC;QAC1C,cAAc,EAAE,uFAAuF;QACvG,WAAW,EAAE,qFAAqF;KACnG;IACD,kBAAkB,EAAE;QAClB,EAAE,EAAE,sCAAsC;QAC1C,cAAc,EAAE,0FAA0F;QAC1G,WAAW,EAAE,2FAA2F;KACzG;IACD,kBAAkB,EAAE;QAClB,EAAE,EAAE,6BAA6B;QACjC,cAAc,EAAE,gDAAgD;QAChE,WAAW,EAAE,sHAAsH;KACpI;IACD,kBAAkB,EAAE;QAClB,EAAE,EAAE,6BAA6B;QACjC,cAAc,EAAE,gDAAgD;QAChE,WAAW,EAAE,qEAAqE;KACnF;IACD,OAAO,EAAE;QACP,EAAE,EAAE,qCAAqC;QACzC,cAAc,EAAE,SAAS;QACzB,WAAW,EAAE,yCAAyC;KACvD;IACD,iBAAiB,EAAE;QACjB,EAAE,EAAE,6BAA6B;QACjC,cAAc,EAAE,sEAAsE;QACtF,WAAW,EAAE,sDAAsD;KACpE;IACD,kBAAkB,EAAE;QAClB,EAAE,EAAE,8BAA8B;QAClC,cAAc,EAAE,uEAAuE;QACvF,WAAW,EAAE,
|
|
1
|
+
{"version":3,"file":"Messages.js","sourceRoot":"","sources":["../../../src/components/Checkout/Messages.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAExD,MAAM,QAAQ,GAAG,cAAc,CAAC;IAC9B,4BAA4B,EAAE;QAC5B,EAAE,EAAE,mDAAmD;QACvD,cAAc,EAAE,oFAAoF;QACpG,WAAW,EAA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AAgB;QAChC,WAAW,EAAE,wEAAwE;KACtF;CACF,CAAC,CAAC;AAEH,eAAe,QAAQ,CAAC","sourcesContent":["import { defineMessages } from '@openedx/frontend-base';\n\nconst messages = defineMessages({\n paymentProcessingDescription: {\n id: 'checkout.paymentForm.paymentProcessingdescription',\n defaultMessage: 'Your payment could not be processed. Please check your card details and try again.',\n description: 'Payment processing description',\n },\n paymentInterruptedAlert: {\n id: 'checkout.paymentInterruptedAlert',\n defaultMessage: \"Your payment wasn't completed, and you haven't been charged. Try again or use another payment method.\",\n description: 'Alert shown when the learner returns to checkout without completing payment',\n },\n walletPaymentCancelledAlert: {\n id: 'checkout.walletPaymentCancelledAlert',\n defaultMessage: \"Your payment wasn't completed. You haven't been charged and your order is still here.\",\n description: 'Alert shown when the learner closes the Apple Pay / Google Pay sheet without paying',\n },\n priceChangedNotice: {\n id: 'checkout.alacarte.priceChangedNotice',\n defaultMessage: 'The price is now ${amount} {currency}. Click Pay now to accept this amount and continue.',\n description: 'Shown when checkout.priceAccepted is false so the learner confirms the current amount due',\n },\n couponAppliedAlert: {\n id: 'checkout.couponAppliedAlert',\n defaultMessage: 'Coupon code {code} applied for {percent}% off!',\n description: 'Success alert shown at the top of checkout after a coupon is applied, e.g. \"Coupon code SAVE15 applied for 15% off!\"',\n },\n couponRemovedAlert: {\n id: 'checkout.couponRemovedAlert',\n defaultMessage: 'Coupon code {code} was removed from your cart.',\n description: 'Success alert shown above payment methods after a coupon is removed',\n },\n dismiss: {\n id: 'checkout.couponAppliedAlert.dismiss',\n defaultMessage: 'Dismiss',\n description: 'Closes the coupon-applied success alert',\n },\n alreadyPaidCourse: {\n id: 'checkout.alreadyPaid.course',\n defaultMessage: \"You've already paid for this course. You haven't been charged again.\",\n description: 'Alert shown when the learner already owns the course',\n },\n alreadyPaidProgram: {\n id: 'checkout.alreadyPaid.program',\n defaultMessage: \"You've already paid for this program. You haven't been charged again.\",\n description: 'Alert shown when the learner already owns the program but its name or certificate count is unavailable',\n },\n alreadyPaidAllProgramCertificates: {\n id: 'checkout.alreadyPaid.programAllCertificates',\n defaultMessage: \"You've purchased all {certificateCount} certificates {programName}, so there's nothing left to buy.\",\n description: 'Alert shown when the learner already owns every course (certificate) in the program',\n },\n viewOrderHistory: {\n id: 'checkout.alreadyPaid.viewOrderHistory',\n defaultMessage: 'View order history',\n description: 'Link to order history on the already-paid alert',\n },\n goToCourse: {\n id: 'checkout.alreadyPaid.goToCourse',\n defaultMessage: 'Go to course',\n description: 'Button to navigate to the course on the already-paid alert',\n },\n seeMyCourses: {\n id: 'checkout.alreadyPaid.seeMyCourses',\n defaultMessage: 'See my courses',\n description: 'Button to open the learner dashboard on the already-paid program alert',\n },\n});\n\nexport default messages;\n"]}
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import type { CheckoutProps } from '../Checkout/Checkout';
|
|
2
2
|
export interface CheckoutGateProps extends CheckoutProps {
|
|
3
|
-
/** URL linked in session-error recovery messaging. */
|
|
4
|
-
learnerDashboardUrl?: string;
|
|
5
3
|
/** Homepage URL for the country-unavailable modal CTA. */
|
|
6
4
|
homeUrl?: string;
|
|
7
5
|
/** ALC-307 compliance-check endpoint — decides whether the learner is embargoed. */
|
|
@@ -38,7 +38,7 @@ const CheckoutGate = (_a) => {
|
|
|
38
38
|
if (gateStatus === 'blocked') {
|
|
39
39
|
return (_jsx(_Fragment, { children: _jsx(CountryUnavailableModal, { isOpen: true, homeUrl: homeUrl }) }));
|
|
40
40
|
}
|
|
41
|
-
return (_jsx(Checkout, Object.assign({}, checkoutProps, { userCountry: userCountry, homeUrl: homeUrl, orderHistoryUrl: "/order-history" })));
|
|
41
|
+
return (_jsx(Checkout, Object.assign({}, checkoutProps, { userCountry: userCountry, homeUrl: homeUrl, orderHistoryUrl: "/order-history", learnerDashboardUrl: learnerDashboardUrl })));
|
|
42
42
|
};
|
|
43
43
|
export default CheckoutGate;
|
|
44
44
|
//# sourceMappingURL=CheckoutGate.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CheckoutGate.js","sourceRoot":"","sources":["../../../src/components/CheckoutGate/CheckoutGate.tsx"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,KAAK,IAAI,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AACnE,OAAO,QAAQ,MAAM,sBAAsB,CAAC;AAC5C,OAAO,uBAAuB,MAAM,oDAAoD,CAAC;AAEzF,OAAO,QAAQ,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"CheckoutGate.js","sourceRoot":"","sources":["../../../src/components/CheckoutGate/CheckoutGate.tsx"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,KAAK,IAAI,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AACnE,OAAO,QAAQ,MAAM,sBAAsB,CAAC;AAC5C,OAAO,uBAAuB,MAAM,oDAAoD,CAAC;AAEzF,OAAO,QAAQ,MAAM,YAAY,CAAC;AAalC,MAAM,YAAY,GAAG,CAAC,EAOF,EAAE,EAAE;QAPF,EACpB,mBAAmB,EACnB,OAAO,GAAG,GAAG,EACb,kBAAkB,EAClB,sBAAsB,EACtB,kBAAkB,OAEA,EADf,aAAa,cANI,wGAOrB,CADiB;IAEhB,MAAM,EAAE,aAAa,EAAE,GAAG,OAAO,EAAE,CAAC;IACpC,MAAM,EAAE,UAAU,EAAE,WAAW,EAAE,WAAW,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,GAAG,eAAe,CAAC;QACrG,MAAM,EAAE,aAAa,CAAC,MAAM;QAC5B,aAAa,EAAE,aAAa,CAAC,aAAa;QAC1C,cAAc,EAAE,aAAa,CAAC,cAAc;QAC5C,kBAAkB;QAClB,sBAAsB;QACtB,kBAAkB;QAClB,mBAAmB;KACpB,CAAC,CAAC;IAEH,IAAI,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,SAAS,GAAG,GACrD,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,CAAC,gBAAgB,IAAI,mBAAmB,IAAI,CAC3C,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,gBAAgB,EAChC,mBAAmB,EAAE,mBAAmB,IACxC,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 /** 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 /** When true, skip the compliance-check request and show the blocked modal. */\n restrictCompliance?: boolean,\n}\n\nconst CheckoutGate = ({\n learnerDashboardUrl,\n homeUrl = '/',\n complianceCheckUrl,\n disableComplianceCheck,\n restrictCompliance,\n ...checkoutProps\n}: CheckoutGateProps) => {\n const { formatMessage } = useIntl();\n const { gateStatus, userCountry, gateMessage, isAccountLinkError: accountLinkError } = useCheckoutGate({\n apiUrl: checkoutProps.apiUrl,\n edxSessionUrl: checkoutProps.edxSessionUrl,\n geolocationUrl: checkoutProps.geolocationUrl,\n complianceCheckUrl,\n disableComplianceCheck,\n restrictCompliance,\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=\"Loading\" />\n </div>\n );\n }\n\n if (gateStatus === 'error') {\n return (\n <Alert variant=\"danger\" icon={ErrorIcon}>\n {gateMessage\n ?? formatMessage(messages.defaultErrorMessage)}{' '}\n {!accountLinkError && 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=\"/order-history\"\n learnerDashboardUrl={learnerDashboardUrl}\n />\n );\n};\n\nexport default CheckoutGate;\n"]}
|
|
@@ -8,7 +8,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
10
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
11
|
-
import { useState, useCallback, useMemo } from 'react';
|
|
11
|
+
import React, { useState, useCallback, useMemo } from 'react';
|
|
12
12
|
import { Button, Form } from '@openedx/paragon';
|
|
13
13
|
import { useIntl } from '@openedx/frontend-base';
|
|
14
14
|
import PaymentFields from '../PaymentFields/PaymentFields';
|
|
@@ -20,6 +20,9 @@ import { getCountryList } from '../../utils/countries';
|
|
|
20
20
|
import { useInert } from '../../utils/inert';
|
|
21
21
|
import { CARD_FIELD_KEYS, getInvalidPaymentFields } from '../../utils/paymentValidation';
|
|
22
22
|
import messages from './Messages';
|
|
23
|
+
// Hides the plain-text parts of a rich message from screen readers, leaving
|
|
24
|
+
// its elements (e.g. links) reachable.
|
|
25
|
+
const hideTextParts = (message) => React.Children.map(message, (part) => (typeof part === 'string' ? _jsx("span", { "aria-hidden": "true", children: part }) : part));
|
|
23
26
|
const PaymentForm = ({ billing, setField, numberMountRef, expiryMountRef, cvcMountRef, stripeReady, sessionReady, submitting, onPlaceOrder, alacarteLine = null, stripe = null, expressCountry = 'US', onExpressPayment, onExpressClick, onExpressCancel, paypalClientId, onPaypalCreateOrder, onPaypalApprove, onPaypalCancel, cardFieldStates, onValidationError, }) => {
|
|
24
27
|
var _a, _b, _c, _d;
|
|
25
28
|
const { formatMessage, locale } = useIntl();
|
|
@@ -143,9 +146,11 @@ const PaymentForm = ({ billing, setField, numberMountRef, expiryMountRef, cvcMou
|
|
|
143
146
|
}, onBlur: () => {
|
|
144
147
|
setPostalBlurred(true);
|
|
145
148
|
}, maxLength: (_b = getBillingPostalMaxLength(countryCode)) !== null && _b !== void 0 ? _b : undefined, placeholder: formatMessage(countryCode === 'US' ? messages.zipCodePlaceholder : messages.postalCodePlaceholder), "aria-label": formatMessage(countryCode === 'US' ? messages.zipCode : messages.postalCode), "aria-invalid": !!postalError, "aria-describedby": postalError ? 'postal-error' : undefined, autoComplete: "postal-code" }), _jsx(FieldError, { id: "postal-error", message: postalError, announce: announceErrors })] })) : null;
|
|
146
|
-
return (_jsxs("
|
|
147
|
-
link:
|
|
148
|
-
})
|
|
149
|
+
return (_jsxs("div", { className: "payment-form bg-white", children: [_jsxs("div", { children: [_jsx("h2", { className: "payment-form__heading font-weight-bold mb-3 text-primary-500", children: formatMessage(messages.selectPaymentMethod) }), _jsxs("p", { className: "payment-form__help position-relative small mb-0", children: [_jsx("span", { className: "sr-overlay", children: `${formatMessage(messages.needAssistance)} ${formatMessage(messages.needAssistanceBody, {
|
|
150
|
+
link: formatMessage(messages.learnerHelpCenter),
|
|
151
|
+
})}` }), _jsx("strong", { className: "d-block text-primary-500", "aria-hidden": "true", children: formatMessage(messages.needAssistance) }), ' ', _jsx("span", { className: "text-gray-700 gap-y-2", children: hideTextParts(formatMessage(messages.needAssistanceBody, {
|
|
152
|
+
link: (_jsx("a", { href: LEARNER_HELP_CENTER_URL, target: "_blank", rel: "noreferrer", className: "text-gray-700", "aria-label": formatMessage(messages.learnerHelpCenterLabel), children: formatMessage(messages.learnerHelpCenter) }, "help-center-link")),
|
|
153
|
+
})) })] })] }), _jsx(ExpressCheckout, { stripe: stripe, totalAmountCents: (alacarteLine === null || alacarteLine === void 0 ? void 0 : alacarteLine.amountDue)
|
|
149
154
|
? Math.round(alacarteLine.amountDue.amount * 100)
|
|
150
155
|
: null, currency: (_d = (_c = alacarteLine === null || alacarteLine === void 0 ? void 0 : alacarteLine.amountDue) === null || _c === void 0 ? void 0 : _c.currency) !== null && _d !== void 0 ? _d : null, country: expressCountry, onPaymentAuthorized: onExpressPayment !== null && onExpressPayment !== void 0 ? onExpressPayment : (() => __awaiter(void 0, void 0, void 0, function* () { })), onWalletClick: onExpressClick, onWalletCancel: onExpressCancel, paypalClientId: paypalClientId, onPaypalCreateOrder: onPaypalCreateOrder, onPaypalApprove: onPaypalApprove, onPaypalCancel: onPaypalCancel,
|
|
151
156
|
// Wallets need a real place-order handler (à la carte ready) — a missing
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PaymentForm.js","sourceRoot":"","sources":["../../../src/components/PaymentForm/PaymentForm.tsx"],"names":[],"mappings":";;;;;;;;;;AAAA,OAAc,EAAE,QAAQ,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAE9D,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,aAAa,MAAM,gCAAgC,CAAC;AAE3D,OAAO,UAAU,MAAM,6BAA6B,CAAC;AACrD,OAAO,eAAe,MAAM,oCAAoC,CAAC;AAGjE,OAAO,EAAE,uBAAuB,EAAE,MAAM,iBAAiB,CAAC;AAC1D,OAAO,EACL,uBAAuB,EACvB,yBAAyB,EACzB,oBAAoB,EACpB,yBAAyB,EACzB,0BAA0B,GAC3B,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,eAAe,EAAE,uBAAuB,EAAE,MAAM,+BAA+B,CAAC;AAEzF,OAAO,QAAQ,MAAM,YAAY,CAAC;AAiDlC,MAAM,WAAW,GAAG,CAAC,EACnB,OAAO,EACP,QAAQ,EACR,cAAc,EACd,cAAc,EACd,WAAW,EACX,WAAW,EACX,YAAY,EACZ,UAAU,EACV,YAAY,EACZ,YAAY,GAAG,IAAI,EACnB,MAAM,GAAG,IAAI,EACb,cAAc,GAAG,IAAI,EACrB,gBAAgB,EAChB,cAAc,EACd,eAAe,EACf,cAAc,EACd,mBAAmB,EACnB,eAAe,EACf,cA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AAQ,CAAC,eAAe,CAAC,GAC3B,EACJ,eAAK,SAAS,EAAC,yBAAyB,aACtC,aAAG,SAAS,EAAC,oBAAoB,aAC/B,iBAAQ,SAAS,EAAC,2BAA2B,YAAE,aAAa,CAAC,QAAQ,CAAC,KAAK,CAAC,GAAU,EAAC,GAAG,EAC1F,eAAM,SAAS,EAAC,2BAA2B,YACxC,SAAS,GACL,IACL,EACJ,KAAC,MAAM,IACL,OAAO,EAAC,OAAO,EACf,SAAS,EAAC,sBAAsB,EAChC,OAAO,EAAE,YAAY,EACrB,QAAQ,EAAE,UAAU,YAEnB,aAAa,CAAC,UAAU,CAAC,CAAC,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,GAC3D,IACL,IACF,IACE,CACX,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,WAAW,CAAC","sourcesContent":["import React, { useState, useCallback, useMemo } from 'react';\nimport type { Ref } from 'react';\nimport { Button, Form } from '@openedx/paragon';\nimport { useIntl } from '@openedx/frontend-base';\nimport PaymentFields from '../PaymentFields/PaymentFields';\nimport type { PaymentFieldErrors } from '../PaymentFields/PaymentFields';\nimport FieldError from '../PaymentFields/FieldError';\nimport ExpressCheckout from '../ExpressCheckout/ExpressCheckout';\nimport type { BillingInfo, CardFieldStates, CheckoutConsent, StripeLike, SupportedPaymentMethod } from '../../types';\nimport type { AlacarteLine } from '../../types/alacarte';\nimport { LEARNER_HELP_CENTER_URL } from '../../constants';\nimport {\n getBillingCountryFields,\n getBillingPostalMaxLength,\n isValidBillingPostal,\n isValidBillingSubdivision,\n sanitizeBillingPostalInput,\n} from '../../utils/billingAddress';\nimport { getCountryList } from '../../utils/countries';\nimport { useInert } from '../../utils/inert';\nimport { CARD_FIELD_KEYS, getInvalidPaymentFields } from '../../utils/paymentValidation';\nimport type { CardFieldKey, PaymentFieldKey } from '../../utils/paymentValidation';\nimport messages from './Messages';\n\nexport interface PaymentFormProps {\n billing: BillingInfo,\n setField: (field: keyof BillingInfo, value: string) => void,\n numberMountRef: Ref<HTMLDivElement>,\n expiryMountRef: Ref<HTMLDivElement>,\n cvcMountRef: Ref<HTMLDivElement>,\n cardError: string,\n stripeReady: boolean,\n sessionReady: boolean,\n submitting: boolean,\n onPlaceOrder: (consent: CheckoutConsent, paymentMethod: SupportedPaymentMethod) => void,\n /** @deprecated Subscription plan price — unused for à la carte (see alacarteLine). */\n priceToShow?: { label?: string, amount?: string } | null,\n cycleToShow?: string,\n trialEnd?: string,\n userCountry?: string | null,\n /** Promotional monthly price e.g. \"39\" — monthly plans only. */\n promoAmount?: string,\n /** Length of the promotional period in months. */\n promoMonths?: number,\n /** Regular monthly price after the promo period e.g. \"59\". */\n monthlyRegularAmount?: string,\n geolocationUrl?: string,\n /** À la carte checkout line — when present, drives the order total shown. */\n alacarteLine?: AlacarteLine | null,\n /** Stripe.js instance for express checkout (Apple Pay / Google Pay). */\n stripe?: StripeLike | null,\n /** Two-letter country code for express checkout initialisation. */\n expressCountry?: string,\n /** Called when the user authorises a wallet payment. */\n onExpressPayment?: (paymentMethodId: string, walletCountry?: string) => Promise<void>,\n /** Called when the learner clicks Apple Pay / Google Pay, before the sheet opens. */\n onExpressClick?: () => void,\n /** Called when the learner closes the Apple Pay / Google Pay sheet without paying. */\n onExpressCancel?: () => void,\n /** PayPal JS SDK client id for the express PayPal button. */\n paypalClientId?: string | null,\n /** PayPal express checkout handlers — see ExpressCheckout. */\n onPaypalCreateOrder?: () => Promise<string>,\n onPaypalApprove?: (paypalOrderId: string) => Promise<void>,\n onPaypalCancel?: (paypalOrderId: string) => Promise<void>,\n /** Tracks empty/complete state of each Stripe card element for validation. */\n cardFieldStates?: CardFieldStates,\n /** Called on Pay now with the fields that failed validation (empty when it passed). */\n onValidationError?: (invalidFields: PaymentFieldKey[]) => void,\n}\n\nconst PaymentForm = ({\n billing,\n setField,\n numberMountRef,\n expiryMountRef,\n cvcMountRef,\n stripeReady,\n sessionReady,\n submitting,\n onPlaceOrder,\n alacarteLine = null,\n stripe = null,\n expressCountry = 'US',\n onExpressPayment,\n onExpressClick,\n onExpressCancel,\n paypalClientId,\n onPaypalCreateOrder,\n onPaypalApprove,\n onPaypalCancel,\n cardFieldStates,\n onValidationError,\n}: PaymentFormProps) => {\n const { formatMessage, locale } = useIntl();\n const countryOptions = useMemo(() => getCountryList(locale), [locale]);\n const [showValidationErrors, setShowValidationErrors] = useState(false);\n /** Postal format errors only after blur — cleared again while the user types. */\n const [postalBlurred, setPostalBlurred] = useState(false);\n\n // No fallback amount — an unresolved à la carte line means we don't know\n // the price yet, so this is left blank rather than showing a made-up number.\n const totalText = alacarteLine?.amountDue\n ? formatMessage(messages.totalAmount, {\n amount: alacarteLine.amountDue.amount.toFixed(2), currency: alacarteLine.amountDue.currency,\n })\n : '';\n\n // Pay now stays enabled with missing fields so submitting can list them in\n // the validation alert; it's only disabled while busy.\n const isDisabled = submitting || !stripeReady || !sessionReady;\n const countryCode = billing.country.trim().toUpperCase();\n const countryFields = getBillingCountryFields(countryCode);\n // Card and billing fields leave the tab order while an order is in flight\n // (ExpressCheckout does the same for its disabled wallet buttons).\n const methodsInertRef = useInert<HTMLDivElement>(submitting);\n\n const requiredMsgs: Record<PaymentFieldKey, string> = {\n number: formatMessage(messages.cardNumberRequired),\n expiry: formatMessage(messages.expiryRequired),\n cvc: formatMessage(messages.cvcRequired),\n country: formatMessage(messages.countryRequired),\n state: formatMessage(countryCode === 'CA' ? messages.provinceRequired : messages.stateRequired),\n postal: formatMessage(countryCode === 'US' ? messages.zipCodeRequired : messages.postalCodeRequired),\n };\n // Errors raised by Pay now are read from the error summary and, per field,\n // on focus — only blur-time errors announce themselves as they appear.\n const announceErrors = !showValidationErrors;\n\n // Per-field error: show Stripe's inline error on blur, or \"required\" on submit.\n const fieldErrorFor = (field: CardFieldKey): string | undefined => {\n const state = cardFieldStates?.[field];\n if (!state) return undefined;\n // Submit-time: empty fields ask for the missing value\n if (showValidationErrors && state.empty) return requiredMsgs[field];\n // Blur-time: show Stripe's validation error once the user has left the field\n if ((state.blurred || showValidationErrors) && state.error) return state.error;\n // Submit-time: incomplete with no Stripe message yet still blocks Pay now.\n if (showValidationErrors && !state.complete) return requiredMsgs[field];\n return undefined;\n };\n\n const fieldErrors: PaymentFieldErrors | undefined = cardFieldStates\n ? {\n number: fieldErrorFor('number'),\n expiry: fieldErrorFor('expiry'),\n cvc: fieldErrorFor('cvc'),\n }\n : undefined;\n const focusedCardField = CARD_FIELD_KEYS.find((field) => cardFieldStates?.[field].focused) ?? null;\n\n const countryError = showValidationErrors && !billing.country ? requiredMsgs.country : undefined;\n\n const stateError = (() => {\n if (!countryFields.needsState) return undefined;\n if (!billing.state.trim()) {\n return showValidationErrors ? requiredMsgs.state : undefined;\n }\n // Subdivision is a select of known values — only surface if somehow invalid on submit.\n if (showValidationErrors && !isValidBillingSubdivision(countryCode, billing.state)) {\n return requiredMsgs.state;\n }\n return undefined;\n })();\n\n const postalError = (() => {\n if (!countryFields.needsPostal) return undefined;\n const zip = billing.zip.trim();\n if (!zip) {\n return showValidationErrors ? requiredMsgs.postal : undefined;\n }\n // Format check only after blur (or when Pay now forces validation).\n if (!(postalBlurred || showValidationErrors)) return undefined;\n if (!isValidBillingPostal(countryCode, zip)) {\n return formatMessage(\n countryCode === 'US' ? messages.zipCodeInvalid : messages.postalCodeInvalid,\n );\n }\n return undefined;\n })();\n\n const handleCountryChange = useCallback((country: string) => {\n setField('country', country);\n // Subdivision / postal values are country-specific — clear them on change.\n setField('state', '');\n setField('zip', '');\n setPostalBlurred(false);\n }, [setField]);\n\n // This design has no terms/consent checkboxes, so there's nothing for the\n // learner to opt into on screen — send a default consent record instead of\n // building it from UI state that doesn't exist here.\n const handlePayNow = useCallback(() => {\n const invalidFields = getInvalidPaymentFields(cardFieldStates, billing);\n onValidationError?.(invalidFields);\n if (invalidFields.length > 0) {\n setShowValidationErrors(true);\n return;\n }\n\n setShowValidationErrors(false);\n onPlaceOrder({\n tConsentRecurring: true,\n tConsentUkCa: null,\n tConsentAt: new Date().toISOString(),\n tConsentText: '',\n }, 'card');\n }, [cardFieldStates, billing, onPlaceOrder, onValidationError]);\n\n const countryControl = (\n <Form.Group\n controlId=\"country\"\n className={`mb-0 payment__field--country${countryError ? ' payment__field--country-error' : ''}`}\n >\n <Form.Label className=\"payment--field__label text-gray-900\">\n {formatMessage(messages.country)}\n </Form.Label>\n <Form.Control\n as=\"select\"\n value={billing.country}\n onChange={(e: React.ChangeEvent<HTMLSelectElement>) => {\n handleCountryChange(e.target.value);\n }}\n aria-label={formatMessage(messages.country)}\n aria-invalid={!!countryError}\n aria-describedby={countryError ? 'country-error' : undefined}\n >\n <option value=\"\" disabled hidden>\n {formatMessage(messages.countryPlaceholder)}\n </option>\n {countryOptions.map(({ code, name }) => (\n <option key={code} value={code}>\n {name}\n </option>\n ))}\n </Form.Control>\n <FieldError id=\"country-error\" message={countryError} announce={announceErrors} />\n </Form.Group>\n );\n\n const stateControl = countryFields.needsState && countryFields.subdivisions ? (\n <Form.Group\n controlId=\"state\"\n className={`mb-0 payment__field--state${stateError ? ' payment__field--state-error' : ''}`}\n >\n <Form.Label className=\"payment--field__label text-gray-900\">\n {formatMessage(countryCode === 'CA' ? messages.province : messages.state)}\n </Form.Label>\n <Form.Control\n as=\"select\"\n value={billing.state}\n onChange={(e: React.ChangeEvent<HTMLSelectElement>) => {\n setField('state', e.target.value);\n }}\n aria-label={formatMessage(countryCode === 'CA' ? messages.province : messages.state)}\n aria-invalid={!!stateError}\n aria-describedby={stateError ? 'state-error' : undefined}\n >\n <option value=\"\" disabled hidden>\n {formatMessage(\n countryCode === 'CA' ? messages.provincePlaceholder : messages.statePlaceholder,\n )}\n </option>\n {countryFields.subdivisions.map((subdivision) => (\n <option key={subdivision[0]} value={subdivision[0]}>\n {subdivision[1]}\n </option>\n ))}\n </Form.Control>\n <FieldError id=\"state-error\" message={stateError} announce={announceErrors} />\n </Form.Group>\n ) : null;\n\n const postalControl = countryFields.needsPostal ? (\n <Form.Group\n controlId=\"postal\"\n className={`mb-0 payment__field--postal${postalError ? ' payment__field--postal-error' : ''}`}\n >\n <Form.Label className=\"payment--field__label text-gray-900\">\n {formatMessage(countryCode === 'US' ? messages.zipCode : messages.postalCode)}\n </Form.Label>\n <Form.Control\n value={billing.zip}\n onChange={(e: React.ChangeEvent<HTMLInputElement>) => {\n setField('zip', sanitizeBillingPostalInput(countryCode, e.target.value));\n // Hide format errors while typing; re-validate on the next blur.\n setPostalBlurred(false);\n }}\n onBlur={() => {\n setPostalBlurred(true);\n }}\n maxLength={getBillingPostalMaxLength(countryCode) ?? undefined}\n placeholder={formatMessage(\n countryCode === 'US' ? messages.zipCodePlaceholder : messages.postalCodePlaceholder,\n )}\n aria-label={formatMessage(countryCode === 'US' ? messages.zipCode : messages.postalCode)}\n aria-invalid={!!postalError}\n aria-describedby={postalError ? 'postal-error' : undefined}\n autoComplete=\"postal-code\"\n />\n <FieldError id=\"postal-error\" message={postalError} announce={announceErrors} />\n </Form.Group>\n ) : null;\n\n return (\n <section className=\"payment-form bg-white\" aria-labelledby=\"payment-form-heading\">\n <div>\n <h2 id=\"payment-form-heading\" className=\"payment-form__heading font-weight-bold mb-3 text-primary-500\">\n {formatMessage(messages.selectPaymentMethod)}\n </h2>\n\n <p className=\"payment-form__help small mb-0\">\n <strong className=\"d-block text-primary-500\">\n {formatMessage(messages.needAssistance)}\n </strong>{' '}\n <span className=\"text-gray-700 gap-y-2\">\n {formatMessage(messages.needAssistanceBody, {\n link: (\n <a\n href={LEARNER_HELP_CENTER_URL}\n target=\"_blank\"\n rel=\"noreferrer\"\n className=\"text-gray-700\"\n aria-label={formatMessage(messages.learnerHelpCenterLabel)}\n >\n {formatMessage(messages.learnerHelpCenter)}\n </a>\n ),\n })}\n </span>\n </p>\n </div>\n\n <ExpressCheckout\n stripe={stripe}\n totalAmountCents={\n alacarteLine?.amountDue\n ? Math.round(alacarteLine.amountDue.amount * 100)\n : null\n }\n currency={alacarteLine?.amountDue?.currency ?? null}\n country={expressCountry}\n onPaymentAuthorized={onExpressPayment ?? (async () => {})}\n onWalletClick={onExpressClick}\n onWalletCancel={onExpressCancel}\n paypalClientId={paypalClientId}\n onPaypalCreateOrder={onPaypalCreateOrder}\n onPaypalApprove={onPaypalApprove}\n onPaypalCancel={onPaypalCancel}\n // Wallets need a real place-order handler (à la carte ready) — a missing\n // handler used to no-op after wallet auth and mark the sheet successful.\n disabled={isDisabled || !onExpressPayment}\n // PayPal is not gated on Stripe, country or postal code — only an\n // in-flight order. Its handlers are undefined until à la carte is ready.\n paypalDisabled={submitting}\n />\n\n {/* ── Payment method ── */}\n <div className=\"payment-form__methods\" ref={methodsInertRef}>\n <div className=\"payment-form__method payment-form__method--selected\">\n <div className=\"payment-form__card-panel\" role=\"group\" aria-labelledby=\"payment-form-card-heading\">\n <h3 id=\"payment-form-card-heading\" className=\"payment-form__card-heading font-weight-bold text-center text-primary-500 mb-2\">\n {formatMessage(messages.payWithCard)}\n </h3>\n <p className=\"payment-form__required-note small text-gray-700 mb-3\">\n {formatMessage(messages.allFieldsRequired)}\n </p>\n <PaymentFields\n numberMountRef={numberMountRef}\n expiryMountRef={expiryMountRef}\n cvcMountRef={cvcMountRef}\n fieldErrors={fieldErrors}\n announceErrors={announceErrors}\n focusedField={focusedCardField}\n cardBrand={cardFieldStates?.number.brand}\n />\n {/* Changing the country adds or removes State / Province / ZIP\n fields; the live region announces them. One stable row keeps\n the Country select mounted, so focus stays on it, and puts new\n fields in the tab order right after it. */}\n <div className=\"payment-form__billing mt-3\" aria-live=\"polite\" data-testid=\"billing-fields\">\n <div className={`payment-form__billing-row${\n countryFields.countryFullWidth ? ' payment-form__billing-row--country-full' : ''\n }${!stateControl && !postalControl ? ' payment-form__billing-row--single' : ''}`}\n >\n {countryControl}\n {stateControl}\n {postalControl}\n </div>\n </div>\n </div>\n </div>\n </div>\n\n {/* ── Order total ── */}\n <div className=\"payment-form__total\">\n <p className=\"payment-form__total-disclaimer text-gray-700 mb-3\">\n {formatMessage(alacarteLine?.kind === 'program'\n ? messages.orderDisclaimerProgram\n : messages.orderDisclaimer)}\n </p>\n <div className=\"payment-form__total-row\">\n <p className=\"mb-0 text-gray-900\">\n <strong className=\"payment-form__total-label\">{formatMessage(messages.total)}</strong>{' '}\n <span className=\"payment-form__total-value\">\n {totalText}\n </span>\n </p>\n <Button\n variant=\"brand\"\n className=\"payment-form__submit\"\n onClick={handlePayNow}\n disabled={isDisabled}\n >\n {formatMessage(submitting ? messages.processing : messages.payNow)}\n </Button>\n </div>\n </div>\n </section>\n );\n};\n\nexport default PaymentForm;\n"]}
|
|
1
|
+
{"version":3,"file":"PaymentForm.js","sourceRoot":"","sources":["../../../src/components/PaymentForm/PaymentForm.tsx"],"names":[],"mappings":";;;;;;;;;;AAAA,OAAO,KAAK,EAAE,EAAE,QAAQ,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAE9D,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,aAAa,MAAM,gCAAgC,CAAC;AAE3D,OAAO,UAAU,MAAM,6BAA6B,CAAC;AACrD,OAAO,eAAe,MAAM,oCAAoC,CAAC;AAGjE,OAAO,EAAE,uBAAuB,EAAE,MAAM,iBAAiB,CAAC;AAC1D,OAAO,EACL,uBAAuB,EACvB,yBAAyB,EACzB,oBAAoB,EACpB,yBAAyB,EACzB,0BAA0B,GAC3B,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,eAAe,EAAE,uBAAuB,EAAE,MAAM,+BAA+B,CAAC;AAEzF,OAAO,QAAQ,MAAM,YAAY,CAAC;AAElC,4EAA4E;AAC5E,uCAAuC;AACvC,MAAM,aAAa,GAAG,CAAC,OAAw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,CAAC;AAEF,eAAe,WAAW,CAAC","sourcesContent":["import React, { useState, useCallback, useMemo } from 'react';\nimport type { Ref } from 'react';\nimport { Button, Form } from '@openedx/paragon';\nimport { useIntl } from '@openedx/frontend-base';\nimport PaymentFields from '../PaymentFields/PaymentFields';\nimport type { PaymentFieldErrors } from '../PaymentFields/PaymentFields';\nimport FieldError from '../PaymentFields/FieldError';\nimport ExpressCheckout from '../ExpressCheckout/ExpressCheckout';\nimport type { BillingInfo, CardFieldStates, CheckoutConsent, StripeLike, SupportedPaymentMethod } from '../../types';\nimport type { AlacarteLine } from '../../types/alacarte';\nimport { LEARNER_HELP_CENTER_URL } from '../../constants';\nimport {\n getBillingCountryFields,\n getBillingPostalMaxLength,\n isValidBillingPostal,\n isValidBillingSubdivision,\n sanitizeBillingPostalInput,\n} from '../../utils/billingAddress';\nimport { getCountryList } from '../../utils/countries';\nimport { useInert } from '../../utils/inert';\nimport { CARD_FIELD_KEYS, getInvalidPaymentFields } from '../../utils/paymentValidation';\nimport type { CardFieldKey, PaymentFieldKey } from '../../utils/paymentValidation';\nimport messages from './Messages';\n\n// Hides the plain-text parts of a rich message from screen readers, leaving\n// its elements (e.g. links) reachable.\nconst hideTextParts = (message: React.ReactNode) => React.Children.map(\n message,\n (part) => (typeof part === 'string' ? <span aria-hidden=\"true\">{part}</span> : part),\n);\n\nexport interface PaymentFormProps {\n billing: BillingInfo,\n setField: (field: keyof BillingInfo, value: string) => void,\n numberMountRef: Ref<HTMLDivElement>,\n expiryMountRef: Ref<HTMLDivElement>,\n cvcMountRef: Ref<HTMLDivElement>,\n cardError: string,\n stripeReady: boolean,\n sessionReady: boolean,\n submitting: boolean,\n onPlaceOrder: (consent: CheckoutConsent, paymentMethod: SupportedPaymentMethod) => void,\n /** @deprecated Subscription plan price — unused for à la carte (see alacarteLine). */\n priceToShow?: { label?: string, amount?: string } | null,\n cycleToShow?: string,\n trialEnd?: string,\n userCountry?: string | null,\n /** Promotional monthly price e.g. \"39\" — monthly plans only. */\n promoAmount?: string,\n /** Length of the promotional period in months. */\n promoMonths?: number,\n /** Regular monthly price after the promo period e.g. \"59\". */\n monthlyRegularAmount?: string,\n geolocationUrl?: string,\n /** À la carte checkout line — when present, drives the order total shown. */\n alacarteLine?: AlacarteLine | null,\n /** Stripe.js instance for express checkout (Apple Pay / Google Pay). */\n stripe?: StripeLike | null,\n /** Two-letter country code for express checkout initialisation. */\n expressCountry?: string,\n /** Called when the user authorises a wallet payment. */\n onExpressPayment?: (paymentMethodId: string, walletCountry?: string) => Promise<void>,\n /** Called when the learner clicks Apple Pay / Google Pay, before the sheet opens. */\n onExpressClick?: () => void,\n /** Called when the learner closes the Apple Pay / Google Pay sheet without paying. */\n onExpressCancel?: () => void,\n /** PayPal JS SDK client id for the express PayPal button. */\n paypalClientId?: string | null,\n /** PayPal express checkout handlers — see ExpressCheckout. */\n onPaypalCreateOrder?: () => Promise<string>,\n onPaypalApprove?: (paypalOrderId: string) => Promise<void>,\n onPaypalCancel?: (paypalOrderId: string) => Promise<void>,\n /** Tracks empty/complete state of each Stripe card element for validation. */\n cardFieldStates?: CardFieldStates,\n /** Called on Pay now with the fields that failed validation (empty when it passed). */\n onValidationError?: (invalidFields: PaymentFieldKey[]) => void,\n}\n\nconst PaymentForm = ({\n billing,\n setField,\n numberMountRef,\n expiryMountRef,\n cvcMountRef,\n stripeReady,\n sessionReady,\n submitting,\n onPlaceOrder,\n alacarteLine = null,\n stripe = null,\n expressCountry = 'US',\n onExpressPayment,\n onExpressClick,\n onExpressCancel,\n paypalClientId,\n onPaypalCreateOrder,\n onPaypalApprove,\n onPaypalCancel,\n cardFieldStates,\n onValidationError,\n}: PaymentFormProps) => {\n const { formatMessage, locale } = useIntl();\n const countryOptions = useMemo(() => getCountryList(locale), [locale]);\n const [showValidationErrors, setShowValidationErrors] = useState(false);\n /** Postal format errors only after blur — cleared again while the user types. */\n const [postalBlurred, setPostalBlurred] = useState(false);\n\n // No fallback amount — an unresolved à la carte line means we don't know\n // the price yet, so this is left blank rather than showing a made-up number.\n const totalText = alacarteLine?.amountDue\n ? formatMessage(messages.totalAmount, {\n amount: alacarteLine.amountDue.amount.toFixed(2), currency: alacarteLine.amountDue.currency,\n })\n : '';\n\n // Pay now stays enabled with missing fields so submitting can list them in\n // the validation alert; it's only disabled while busy.\n const isDisabled = submitting || !stripeReady || !sessionReady;\n const countryCode = billing.country.trim().toUpperCase();\n const countryFields = getBillingCountryFields(countryCode);\n // Card and billing fields leave the tab order while an order is in flight\n // (ExpressCheckout does the same for its disabled wallet buttons).\n const methodsInertRef = useInert<HTMLDivElement>(submitting);\n\n const requiredMsgs: Record<PaymentFieldKey, string> = {\n number: formatMessage(messages.cardNumberRequired),\n expiry: formatMessage(messages.expiryRequired),\n cvc: formatMessage(messages.cvcRequired),\n country: formatMessage(messages.countryRequired),\n state: formatMessage(countryCode === 'CA' ? messages.provinceRequired : messages.stateRequired),\n postal: formatMessage(countryCode === 'US' ? messages.zipCodeRequired : messages.postalCodeRequired),\n };\n // Errors raised by Pay now are read from the error summary and, per field,\n // on focus — only blur-time errors announce themselves as they appear.\n const announceErrors = !showValidationErrors;\n\n // Per-field error: show Stripe's inline error on blur, or \"required\" on submit.\n const fieldErrorFor = (field: CardFieldKey): string | undefined => {\n const state = cardFieldStates?.[field];\n if (!state) return undefined;\n // Submit-time: empty fields ask for the missing value\n if (showValidationErrors && state.empty) return requiredMsgs[field];\n // Blur-time: show Stripe's validation error once the user has left the field\n if ((state.blurred || showValidationErrors) && state.error) return state.error;\n // Submit-time: incomplete with no Stripe message yet still blocks Pay now.\n if (showValidationErrors && !state.complete) return requiredMsgs[field];\n return undefined;\n };\n\n const fieldErrors: PaymentFieldErrors | undefined = cardFieldStates\n ? {\n number: fieldErrorFor('number'),\n expiry: fieldErrorFor('expiry'),\n cvc: fieldErrorFor('cvc'),\n }\n : undefined;\n const focusedCardField = CARD_FIELD_KEYS.find((field) => cardFieldStates?.[field].focused) ?? null;\n\n const countryError = showValidationErrors && !billing.country ? requiredMsgs.country : undefined;\n\n const stateError = (() => {\n if (!countryFields.needsState) return undefined;\n if (!billing.state.trim()) {\n return showValidationErrors ? requiredMsgs.state : undefined;\n }\n // Subdivision is a select of known values — only surface if somehow invalid on submit.\n if (showValidationErrors && !isValidBillingSubdivision(countryCode, billing.state)) {\n return requiredMsgs.state;\n }\n return undefined;\n })();\n\n const postalError = (() => {\n if (!countryFields.needsPostal) return undefined;\n const zip = billing.zip.trim();\n if (!zip) {\n return showValidationErrors ? requiredMsgs.postal : undefined;\n }\n // Format check only after blur (or when Pay now forces validation).\n if (!(postalBlurred || showValidationErrors)) return undefined;\n if (!isValidBillingPostal(countryCode, zip)) {\n return formatMessage(\n countryCode === 'US' ? messages.zipCodeInvalid : messages.postalCodeInvalid,\n );\n }\n return undefined;\n })();\n\n const handleCountryChange = useCallback((country: string) => {\n setField('country', country);\n // Subdivision / postal values are country-specific — clear them on change.\n setField('state', '');\n setField('zip', '');\n setPostalBlurred(false);\n }, [setField]);\n\n // This design has no terms/consent checkboxes, so there's nothing for the\n // learner to opt into on screen — send a default consent record instead of\n // building it from UI state that doesn't exist here.\n const handlePayNow = useCallback(() => {\n const invalidFields = getInvalidPaymentFields(cardFieldStates, billing);\n onValidationError?.(invalidFields);\n if (invalidFields.length > 0) {\n setShowValidationErrors(true);\n return;\n }\n\n setShowValidationErrors(false);\n onPlaceOrder({\n tConsentRecurring: true,\n tConsentUkCa: null,\n tConsentAt: new Date().toISOString(),\n tConsentText: '',\n }, 'card');\n }, [cardFieldStates, billing, onPlaceOrder, onValidationError]);\n\n const countryControl = (\n <Form.Group\n controlId=\"country\"\n className={`mb-0 payment__field--country${countryError ? ' payment__field--country-error' : ''}`}\n >\n <Form.Label className=\"payment--field__label text-gray-900\">\n {formatMessage(messages.country)}\n </Form.Label>\n <Form.Control\n as=\"select\"\n value={billing.country}\n onChange={(e: React.ChangeEvent<HTMLSelectElement>) => {\n handleCountryChange(e.target.value);\n }}\n aria-label={formatMessage(messages.country)}\n aria-invalid={!!countryError}\n aria-describedby={countryError ? 'country-error' : undefined}\n >\n <option value=\"\" disabled hidden>\n {formatMessage(messages.countryPlaceholder)}\n </option>\n {countryOptions.map(({ code, name }) => (\n <option key={code} value={code}>\n {name}\n </option>\n ))}\n </Form.Control>\n <FieldError id=\"country-error\" message={countryError} announce={announceErrors} />\n </Form.Group>\n );\n\n const stateControl = countryFields.needsState && countryFields.subdivisions ? (\n <Form.Group\n controlId=\"state\"\n className={`mb-0 payment__field--state${stateError ? ' payment__field--state-error' : ''}`}\n >\n <Form.Label className=\"payment--field__label text-gray-900\">\n {formatMessage(countryCode === 'CA' ? messages.province : messages.state)}\n </Form.Label>\n <Form.Control\n as=\"select\"\n value={billing.state}\n onChange={(e: React.ChangeEvent<HTMLSelectElement>) => {\n setField('state', e.target.value);\n }}\n aria-label={formatMessage(countryCode === 'CA' ? messages.province : messages.state)}\n aria-invalid={!!stateError}\n aria-describedby={stateError ? 'state-error' : undefined}\n >\n <option value=\"\" disabled hidden>\n {formatMessage(\n countryCode === 'CA' ? messages.provincePlaceholder : messages.statePlaceholder,\n )}\n </option>\n {countryFields.subdivisions.map((subdivision) => (\n <option key={subdivision[0]} value={subdivision[0]}>\n {subdivision[1]}\n </option>\n ))}\n </Form.Control>\n <FieldError id=\"state-error\" message={stateError} announce={announceErrors} />\n </Form.Group>\n ) : null;\n\n const postalControl = countryFields.needsPostal ? (\n <Form.Group\n controlId=\"postal\"\n className={`mb-0 payment__field--postal${postalError ? ' payment__field--postal-error' : ''}`}\n >\n <Form.Label className=\"payment--field__label text-gray-900\">\n {formatMessage(countryCode === 'US' ? messages.zipCode : messages.postalCode)}\n </Form.Label>\n <Form.Control\n value={billing.zip}\n onChange={(e: React.ChangeEvent<HTMLInputElement>) => {\n setField('zip', sanitizeBillingPostalInput(countryCode, e.target.value));\n // Hide format errors while typing; re-validate on the next blur.\n setPostalBlurred(false);\n }}\n onBlur={() => {\n setPostalBlurred(true);\n }}\n maxLength={getBillingPostalMaxLength(countryCode) ?? undefined}\n placeholder={formatMessage(\n countryCode === 'US' ? messages.zipCodePlaceholder : messages.postalCodePlaceholder,\n )}\n aria-label={formatMessage(countryCode === 'US' ? messages.zipCode : messages.postalCode)}\n aria-invalid={!!postalError}\n aria-describedby={postalError ? 'postal-error' : undefined}\n autoComplete=\"postal-code\"\n />\n <FieldError id=\"postal-error\" message={postalError} announce={announceErrors} />\n </Form.Group>\n ) : null;\n\n return (\n <div className=\"payment-form bg-white\">\n <div>\n <h2 className=\"payment-form__heading font-weight-bold mb-3 text-primary-500\">\n {formatMessage(messages.selectPaymentMethod)}\n </h2>\n\n {/* Read as one sentence, then the link on the next VoiceOver move. The\n visual text is hidden piece by piece so the link stays reachable. */}\n <p className=\"payment-form__help position-relative small mb-0\">\n <span className=\"sr-overlay\">\n {`${formatMessage(messages.needAssistance)} ${formatMessage(messages.needAssistanceBody, {\n link: formatMessage(messages.learnerHelpCenter),\n })}`}\n </span>\n <strong className=\"d-block text-primary-500\" aria-hidden=\"true\">\n {formatMessage(messages.needAssistance)}\n </strong>{' '}\n <span className=\"text-gray-700 gap-y-2\">\n {hideTextParts(formatMessage(messages.needAssistanceBody, {\n link: (\n <a\n key=\"help-center-link\"\n href={LEARNER_HELP_CENTER_URL}\n target=\"_blank\"\n rel=\"noreferrer\"\n className=\"text-gray-700\"\n aria-label={formatMessage(messages.learnerHelpCenterLabel)}\n >\n {formatMessage(messages.learnerHelpCenter)}\n </a>\n ),\n }))}\n </span>\n </p>\n </div>\n\n <ExpressCheckout\n stripe={stripe}\n totalAmountCents={\n alacarteLine?.amountDue\n ? Math.round(alacarteLine.amountDue.amount * 100)\n : null\n }\n currency={alacarteLine?.amountDue?.currency ?? null}\n country={expressCountry}\n onPaymentAuthorized={onExpressPayment ?? (async () => {})}\n onWalletClick={onExpressClick}\n onWalletCancel={onExpressCancel}\n paypalClientId={paypalClientId}\n onPaypalCreateOrder={onPaypalCreateOrder}\n onPaypalApprove={onPaypalApprove}\n onPaypalCancel={onPaypalCancel}\n // Wallets need a real place-order handler (à la carte ready) — a missing\n // handler used to no-op after wallet auth and mark the sheet successful.\n disabled={isDisabled || !onExpressPayment}\n // PayPal is not gated on Stripe, country or postal code — only an\n // in-flight order. Its handlers are undefined until à la carte is ready.\n paypalDisabled={submitting}\n />\n\n {/* ── Payment method ── */}\n <div className=\"payment-form__methods\" ref={methodsInertRef}>\n <div className=\"payment-form__method payment-form__method--selected\">\n <div className=\"payment-form__card-panel\" role=\"group\" aria-labelledby=\"payment-form-card-heading\">\n <h3 id=\"payment-form-card-heading\" className=\"payment-form__card-heading font-weight-bold text-center text-primary-500 mb-2\">\n {formatMessage(messages.payWithCard)}\n </h3>\n <p className=\"payment-form__required-note small text-gray-700 mb-3\">\n {formatMessage(messages.allFieldsRequired)}\n </p>\n <PaymentFields\n numberMountRef={numberMountRef}\n expiryMountRef={expiryMountRef}\n cvcMountRef={cvcMountRef}\n fieldErrors={fieldErrors}\n announceErrors={announceErrors}\n focusedField={focusedCardField}\n cardBrand={cardFieldStates?.number.brand}\n />\n {/* Changing the country adds or removes State / Province / ZIP\n fields; the live region announces them. One stable row keeps\n the Country select mounted, so focus stays on it, and puts new\n fields in the tab order right after it. */}\n <div className=\"payment-form__billing mt-3\" aria-live=\"polite\" data-testid=\"billing-fields\">\n <div className={`payment-form__billing-row${\n countryFields.countryFullWidth ? ' payment-form__billing-row--country-full' : ''\n }${!stateControl && !postalControl ? ' payment-form__billing-row--single' : ''}`}\n >\n {countryControl}\n {stateControl}\n {postalControl}\n </div>\n </div>\n </div>\n </div>\n </div>\n\n {/* ── Order total ── */}\n <div className=\"payment-form__total\">\n <p className=\"payment-form__total-disclaimer text-gray-700 mb-3\">\n {formatMessage(alacarteLine?.kind === 'program'\n ? messages.orderDisclaimerProgram\n : messages.orderDisclaimer)}\n </p>\n <div className=\"payment-form__total-row\">\n <p className=\"mb-0 text-gray-900\">\n <strong className=\"payment-form__total-label\">{formatMessage(messages.total)}</strong>{' '}\n <span className=\"payment-form__total-value\">\n {totalText}\n </span>\n </p>\n <Button\n variant=\"brand\"\n className=\"payment-form__submit\"\n onClick={handlePayNow}\n disabled={isDisabled}\n >\n {formatMessage(submitting ? messages.processing : messages.payNow)}\n </Button>\n </div>\n </div>\n </div>\n );\n};\n\nexport default PaymentForm;\n"]}
|
package/dist/style.scss
CHANGED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// styles/_srOverlay.scss
|
|
2
|
+
//
|
|
3
|
+
// Screen-reader text laid over its (aria-hidden) visual content. Unlike
|
|
4
|
+
// .sr-only it keeps the content's box, so VoiceOver's focus ring lines up
|
|
5
|
+
// with what's on screen. The parent needs position: relative.
|
|
6
|
+
.sr-overlay {
|
|
7
|
+
position: absolute;
|
|
8
|
+
top: 0;
|
|
9
|
+
right: 0;
|
|
10
|
+
bottom: 0;
|
|
11
|
+
left: 0;
|
|
12
|
+
overflow: hidden;
|
|
13
|
+
white-space: nowrap;
|
|
14
|
+
color: transparent;
|
|
15
|
+
pointer-events: none;
|
|
16
|
+
user-select: none;
|
|
17
|
+
}
|