@edx/frontend-app-alacarte-checkout 1.35.0 → 1.37.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.
Files changed (41) hide show
  1. package/dist/components/OrderHistory/OrderHistoryDetails.d.ts +2 -0
  2. package/dist/components/OrderHistory/OrderHistoryDetails.js +31 -0
  3. package/dist/components/OrderHistory/OrderHistoryDetails.js.map +1 -0
  4. package/dist/components/OrderHistory/OrderHistoryTabDetails/CoursePayments.js +23 -2
  5. package/dist/components/OrderHistory/OrderHistoryTabDetails/CoursePayments.js.map +1 -1
  6. package/dist/components/OrderHistory/OrderList.d.ts +2 -1
  7. package/dist/components/OrderHistory/OrderList.js +7 -40
  8. package/dist/components/OrderHistory/OrderList.js.map +1 -1
  9. package/dist/components/OrderHistory/data/orderDetailsData.d.ts +13 -0
  10. package/dist/components/OrderHistory/data/orderDetailsData.js +37 -0
  11. package/dist/components/OrderHistory/data/orderDetailsData.js.map +1 -0
  12. package/dist/components/OrderHistory/data/receiptRows.d.ts +17 -0
  13. package/dist/components/OrderHistory/data/receiptRows.js +16 -0
  14. package/dist/components/OrderHistory/data/receiptRows.js.map +1 -0
  15. package/dist/components/OrderHistory/messages.d.ts +65 -0
  16. package/dist/components/OrderHistory/messages.js +66 -1
  17. package/dist/components/OrderHistory/messages.js.map +1 -1
  18. package/dist/data/hooks/keys.d.ts +1 -0
  19. package/dist/data/hooks/keys.js +1 -0
  20. package/dist/data/hooks/keys.js.map +1 -1
  21. package/dist/data/hooks/useAlacarteQueries.d.ts +2 -0
  22. package/dist/data/hooks/useAlacarteQueries.js +11 -0
  23. package/dist/data/hooks/useAlacarteQueries.js.map +1 -1
  24. package/dist/routes.d.ts +18 -2
  25. package/dist/routes.js +27 -0
  26. package/dist/routes.js.map +1 -1
  27. package/dist/styles/components/orderHistory.scss +4 -0
  28. package/dist/types/alacarte.d.ts +1 -0
  29. package/dist/types/alacarte.js.map +1 -1
  30. package/dist/types/orderHistory.d.ts +14 -0
  31. package/dist/types/orderHistory.js +2 -0
  32. package/dist/types/orderHistory.js.map +1 -0
  33. package/dist/utils/alacarteApi.d.ts +2 -0
  34. package/dist/utils/alacarteApi.js +9 -1
  35. package/dist/utils/alacarteApi.js.map +1 -1
  36. package/dist/utils/alacarteCheckout.js +1 -0
  37. package/dist/utils/alacarteCheckout.js.map +1 -1
  38. package/dist/utils/alacarteQueries.d.ts +2 -0
  39. package/dist/utils/alacarteQueries.js +4 -0
  40. package/dist/utils/alacarteQueries.js.map +1 -1
  41. package/package.json +1 -1
@@ -0,0 +1,2 @@
1
+ declare const OrderHistoryDetails: () => import("react/jsx-runtime").JSX.Element;
2
+ export default OrderHistoryDetails;
@@ -0,0 +1,31 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { useParams } from 'react-router-dom';
3
+ import { Container } from '@openedx/paragon';
4
+ import { useIntl } from '@openedx/frontend-base';
5
+ import orders from './data/orderDetailsData';
6
+ import messages from './messages';
7
+ import { getOrderSummaryRows, getOrderItemRows, } from './data/receiptRows';
8
+ const formatAmount = (amount, currency) => (`${currency === 'USD' ? '$' : ''}${amount.toFixed(2)} ${currency}`);
9
+ const formatDate = (isoDate) => (new Date(isoDate).toLocaleDateString('en-US', {
10
+ month: 'short',
11
+ day: 'numeric',
12
+ year: 'numeric',
13
+ }));
14
+ const ReceiptRow = ({ label, children }) => (_jsxs("div", { className: "d-flex align-items-baseline mb-2", children: [_jsx("span", { className: "font-weight-bold text-gray-700", children: label }), _jsx("span", { className: "flex-grow-1 mx-2 text-gray-700", style: { borderBottom: '1px dotted currentColor' } }), _jsx("span", { children: children })] }));
15
+ const OrderReceipt = ({ order }) => {
16
+ const { formatMessage } = useIntl();
17
+ const orderDate = formatDate(order.purchasedAt);
18
+ const total = formatAmount(order.total.amount, order.total.currency);
19
+ const discountAmount = formatAmount(0, order.total.currency);
20
+ const orderSummaryRows = getOrderSummaryRows(order, orderDate, total, discountAmount);
21
+ const orderItemRows = getOrderItemRows(order, total, discountAmount);
22
+ const renderRows = (rows) => rows.map(({ label, value }) => (_jsx(ReceiptRow, { label: formatMessage(label), children: value }, label.id)));
23
+ return (_jsxs(_Fragment, { children: [_jsxs("h1", { className: "h1 mb-4 mt-4 text-primary-500 orderHistoryTitle", children: [formatMessage(messages.orderDateTitle), ": ", orderDate] }), _jsx("h3", { className: "h3 font-weight-bold mb-3 text-primary-500", children: formatMessage(messages.orderSummaryTitle) }), renderRows(orderSummaryRows), _jsx("hr", { className: "my-4 divider" }), _jsx("h3", { className: "font-weight-bold mb-3 text-primary-500", children: formatMessage(messages.orderItemsTitle) }), renderRows(orderItemRows), _jsx("hr", { className: "my-4 divider" }), _jsx("h3", { className: "font-weight-bold mb-3 text-primary-500", children: formatMessage(messages.paymentTitle) }), _jsx(ReceiptRow, { label: formatMessage(messages.receiptAmountLabel), children: total })] }));
24
+ };
25
+ const OrderHistoryDetails = () => {
26
+ const { orderId } = useParams();
27
+ const order = orders.find(item => item.orderId === orderId);
28
+ return (_jsx(Container, { fluid: true, size: "xl", className: "py-4", children: order && _jsx(OrderReceipt, { order: order }) }));
29
+ };
30
+ export default OrderHistoryDetails;
31
+ //# sourceMappingURL=OrderHistoryDetails.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"OrderHistoryDetails.js","sourceRoot":"","sources":["../../../src/components/OrderHistory/OrderHistoryDetails.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAEjD,OAAO,MAAiC,MAAM,yBAAyB,CAAC;AACxE,OAAO,QAAQ,MAAM,YAAY,CAAC;AAClC,OAAO,EACL,mBAAmB,EACnB,gBAAgB,GACjB,MAAM,oBAAoB,CAAC;AAE5B,MAAM,YAAY,GAAG,CAAC,MAAc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,IAAI,KAAC,YAAY,IAAC,KAAK,EAAE,KAAK,GAAI,GAC9B,CACb,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,mBAAmB,CAAC","sourcesContent":["import type { ReactNode } from 'react';\nimport { useParams } from 'react-router-dom';\nimport { Container } from '@openedx/paragon';\nimport { useIntl } from '@openedx/frontend-base';\n\nimport orders, { type OrderDetailsData } from './data/orderDetailsData';\nimport messages from './messages';\nimport {\n getOrderSummaryRows,\n getOrderItemRows,\n} from './data/receiptRows';\n\nconst formatAmount = (amount: number, currency: string) => (\n `${currency === 'USD' ? '$' : ''}${amount.toFixed(2)} ${currency}`\n);\n\nconst formatDate = (isoDate: string) => (\n new Date(isoDate).toLocaleDateString('en-US', {\n month: 'short',\n day: 'numeric',\n year: 'numeric',\n })\n);\n\ninterface ReceiptRowProps {\n label: string,\n children: ReactNode,\n}\n\nconst ReceiptRow = ({ label, children }: ReceiptRowProps) => (\n <div className=\"d-flex align-items-baseline mb-2\">\n <span className=\"font-weight-bold text-gray-700\">{label}</span>\n <span\n className=\"flex-grow-1 mx-2 text-gray-700\"\n style={{ borderBottom: '1px dotted currentColor' }}\n />\n <span>{children}</span>\n </div>\n);\n\nconst OrderReceipt = ({ order }: { order: OrderDetailsData }) => {\n const { formatMessage } = useIntl();\n const orderDate = formatDate(order.purchasedAt);\n const total = formatAmount(order.total.amount, order.total.currency);\n const discountAmount = formatAmount(0, order.total.currency);\n\n const orderSummaryRows = getOrderSummaryRows(order, orderDate, total, discountAmount);\n\n const orderItemRows = getOrderItemRows(order, total, discountAmount);\n\n const renderRows = (rows: typeof orderSummaryRows | typeof orderItemRows) =>\n rows.map(({ label, value }) => (\n <ReceiptRow key={label.id} label={formatMessage(label)}>\n {value}\n </ReceiptRow>\n ));\n\n return (\n <>\n <h1 className=\"h1 mb-4 mt-4 text-primary-500 orderHistoryTitle\">\n {formatMessage(messages.orderDateTitle)}: {orderDate}\n </h1>\n\n <h3 className=\"h3 font-weight-bold mb-3 text-primary-500\">\n {formatMessage(messages.orderSummaryTitle)}\n </h3>\n {renderRows(orderSummaryRows)}\n\n <hr className=\"my-4 divider\" />\n\n <h3 className=\"font-weight-bold mb-3 text-primary-500\">\n {formatMessage(messages.orderItemsTitle)}\n </h3>\n {renderRows(orderItemRows)}\n\n <hr className=\"my-4 divider\" />\n\n <h3 className=\"font-weight-bold mb-3 text-primary-500\">\n {formatMessage(messages.paymentTitle)}\n </h3>\n <ReceiptRow label={formatMessage(messages.receiptAmountLabel)}>\n {total}\n </ReceiptRow>\n </>\n );\n};\n\nconst OrderHistoryDetails = () => {\n const { orderId } = useParams();\n const order = orders.find(item => item.orderId === orderId);\n\n return (\n <Container fluid size=\"xl\" className=\"py-4\">\n {order && <OrderReceipt order={order} />}\n </Container>\n );\n};\n\nexport default OrderHistoryDetails;\n"]}
@@ -1,10 +1,31 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { useIntl } from '@openedx/frontend-base';
2
+ import { useEffect, useMemo } from 'react';
3
+ import { getAppConfig, getSiteConfig, useIntl } from '@openedx/frontend-base';
4
+ import { appId } from '../../../constants';
5
+ import { useViaxSessionQuery } from '../../../data/hooks/useCheckoutQueries';
6
+ import { usePurchaseHistoryQuery } from '../../../data/hooks/useAlacarteQueries';
7
+ import { createAlacarteCheckoutClient } from '../../../utils/alacarteCheckout';
3
8
  import messages from './messages';
4
9
  import OrdersList from '../OrderList';
5
10
  const CoursePayments = () => {
11
+ var _a, _b;
6
12
  const { formatMessage } = useIntl();
7
- return (_jsxs("section", { className: "pt-4", "aria-labelledby": "course-payments-empty-heading", children: [_jsxs("div", { className: "my-2 px-4", children: [_jsx("h2", { id: "course-payments-empty-heading", className: "h5 font-weight-bold text-primary-700 mb-1", children: formatMessage(messages.otherPurchasesTitle) }), _jsx("p", { className: "medium text-gray-700 mb-0", children: formatMessage(messages.coursePurchasesEmptyMessage) })] }), _jsx("div", { className: "mt-2", children: _jsx(OrdersList, {}) })] }));
13
+ const config = getAppConfig(appId);
14
+ const siteConfig = getSiteConfig();
15
+ const lmsBaseUrl = siteConfig.lmsBaseUrl.replace(/\/$/, '');
16
+ const isDevelopment = siteConfig.environment === 'development';
17
+ const apiUrl = config.VIAX_API_URL;
18
+ const edxSessionUrl = `${isDevelopment ? 'https://courses.stage.edx.org' : lmsBaseUrl}/api/edx-session`;
19
+ const client = useMemo(() => (apiUrl ? createAlacarteCheckoutClient({ apiUrl }) : null), [apiUrl]);
20
+ const sessionQuery = useViaxSessionQuery(edxSessionUrl);
21
+ useEffect(() => {
22
+ if (sessionQuery.data && client) {
23
+ client.setToken(sessionQuery.data.viaxToken);
24
+ }
25
+ }, [client, sessionQuery.data]);
26
+ const purchaseHistoryQuery = usePurchaseHistoryQuery(client, !!sessionQuery.data);
27
+ const orders = (_b = (_a = purchaseHistoryQuery.data) === null || _a === void 0 ? void 0 : _a.orders) !== null && _b !== void 0 ? _b : [];
28
+ return (_jsxs("section", { className: "pt-4", "aria-labelledby": "course-payments-empty-heading", children: [_jsxs("div", { className: "my-2 px-4", children: [_jsx("h2", { id: "course-payments-empty-heading", className: "h5 font-weight-bold text-primary-700 mb-1", children: formatMessage(messages.otherPurchasesTitle) }), _jsx("p", { className: "medium text-gray-700 mb-0", children: formatMessage(messages.coursePurchasesEmptyMessage) })] }), _jsx("div", { className: "mt-2", children: _jsx(OrdersList, { orders: orders }) })] }));
8
29
  };
9
30
  export default CoursePayments;
10
31
  //# sourceMappingURL=CoursePayments.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"CoursePayments.js","sourceRoot":"","sources":["../../../../src/components/OrderHistory/OrderHistoryTabDetails/CoursePayments.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,QAAQ,MAAM,YAAY,CAAC;AAClC,OAAO,UAAU,MAAM,cAAc,CAAC;AAEtC,MAAM,cAAc,GAAa,GAAG,EAAE;IACpC,MAAM,EAAE,aAAa,EAAE,GAAG,OAAO,EAAE,CAAC;IAEpC,OAAO,CACL,mBAAS,SAAS,EAAC,MAAM,qBAAiB,+BAA+B,aACvE,eAAK,SAAS,EAAC,WAAW,aACxB,aAAI,EAAE,EAAC,+BAA+B,EAAC,SAAS,EAAC,2CAA2C,YACzF,aAAa,CAAC,QAAQ,CAAC,mBAAmB,CAAC,GACzC,EACL,YAAG,SAAS,EAAC,2BAA2B,YACrC,aAAa,CAAC,QAAQ,CAAC,2BAA2B,CAAC,GAClD,IACA,EACN,cAAK,SAAS,EAAC,MAAM,YACnB,KAAC,UAAU,KAAG,GACV,IACE,CACX,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,cAAc,CAAC","sourcesContent":["import React from 'react';\nimport { useIntl } from '@openedx/frontend-base';\nimport messages from './messages';\nimport OrdersList from '../OrderList';\n\nconst CoursePayments: React.FC = () => {\n const { formatMessage } = useIntl();\n\n return (\n <section className=\"pt-4\" aria-labelledby=\"course-payments-empty-heading\">\n <div className=\"my-2 px-4\">\n <h2 id=\"course-payments-empty-heading\" className=\"h5 font-weight-bold text-primary-700 mb-1\">\n {formatMessage(messages.otherPurchasesTitle)}\n </h2>\n <p className=\"medium text-gray-700 mb-0\">\n {formatMessage(messages.coursePurchasesEmptyMessage)}\n </p>\n </div>\n <div className=\"mt-2\">\n <OrdersList />\n </div>\n </section>\n );\n};\n\nexport default CoursePayments;\n"]}
1
+ {"version":3,"file":"CoursePayments.js","sourceRoot":"","sources":["../../../../src/components/OrderHistory/OrderHistoryTabDetails/CoursePayments.tsx"],"names":[],"mappings":";AAAA,OAAc,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAC9E,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,EAAE,mBAAmB,EAAE,MAAM,wCAAwC,CAAC;AAC7E,OAAO,EAAE,uBAAuB,EA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AM,MAAM,GAAG,MAAA,MAAA,oBAAoB,CAAC,IAAI,0CAAE,MAAM,mCAAI,EAAE,CAAC;IAEvD,OAAO,CACL,mBAAS,SAAS,EAAC,MAAM,qBAAiB,+BAA+B,aACvE,eAAK,SAAS,EAAC,WAAW,aACxB,aAAI,EAAE,EAAC,+BAA+B,EAAC,SAAS,EAAC,2CAA2C,YACzF,aAAa,CAAC,QAAQ,CAAC,mBAAmB,CAAC,GACzC,EACL,YAAG,SAAS,EAAC,2BAA2B,YACrC,aAAa,CAAC,QAAQ,CAAC,2BAA2B,CAAC,GAClD,IACA,EACN,cAAK,SAAS,EAAC,MAAM,YACnB,KAAC,UAAU,IAAC,MAAM,EAAE,MAAM,GAAI,GAC1B,IACE,CACX,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,cAAc,CAAC","sourcesContent":["import React, { useEffect, useMemo } from 'react';\nimport { getAppConfig, getSiteConfig, useIntl } from '@openedx/frontend-base';\nimport { appId } from '../../../constants';\nimport { useViaxSessionQuery } from '../../../data/hooks/useCheckoutQueries';\nimport { usePurchaseHistoryQuery } from '../../../data/hooks/useAlacarteQueries';\nimport { createAlacarteCheckoutClient } from '../../../utils/alacarteCheckout';\nimport messages from './messages';\nimport OrdersList from '../OrderList';\n\nconst CoursePayments: React.FC = () => {\n const { formatMessage } = useIntl();\n const config = getAppConfig(appId);\n const siteConfig = getSiteConfig();\n const lmsBaseUrl = siteConfig.lmsBaseUrl.replace(/\\/$/, '');\n const isDevelopment = siteConfig.environment === 'development';\n const apiUrl = config.VIAX_API_URL as string | undefined;\n const edxSessionUrl = `${isDevelopment ? 'https://courses.stage.edx.org' : lmsBaseUrl}/api/edx-session`;\n\n const client = useMemo(\n () => (apiUrl ? createAlacarteCheckoutClient({ apiUrl }) : null),\n [apiUrl],\n );\n const sessionQuery = useViaxSessionQuery(edxSessionUrl);\n\n useEffect(() => {\n if (sessionQuery.data && client) {\n client.setToken(sessionQuery.data.viaxToken);\n }\n }, [client, sessionQuery.data]);\n\n const purchaseHistoryQuery = usePurchaseHistoryQuery(client, !!sessionQuery.data);\n\n const orders = purchaseHistoryQuery.data?.orders ?? [];\n\n return (\n <section className=\"pt-4\" aria-labelledby=\"course-payments-empty-heading\">\n <div className=\"my-2 px-4\">\n <h2 id=\"course-payments-empty-heading\" className=\"h5 font-weight-bold text-primary-700 mb-1\">\n {formatMessage(messages.otherPurchasesTitle)}\n </h2>\n <p className=\"medium text-gray-700 mb-0\">\n {formatMessage(messages.coursePurchasesEmptyMessage)}\n </p>\n </div>\n <div className=\"mt-2\">\n <OrdersList orders={orders} />\n </div>\n </section>\n );\n};\n\nexport default CoursePayments;\n"]}
@@ -1,2 +1,3 @@
1
- declare const OrdersList: () => import("react/jsx-runtime").JSX.Element;
1
+ import type { OrdersListProps } from '../../types/orderHistory';
2
+ declare const OrdersList: ({ orders }: OrdersListProps) => import("react/jsx-runtime").JSX.Element;
2
3
  export default OrdersList;
@@ -1,44 +1,11 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import OrderHistoryCard from './OrderHistoryCard';
3
- const orders = [
4
- {
5
- orderId: 'BI0QZ4UAFLTYBCXC',
6
- orderNumber: '2U-ORD-62638121',
7
- purchasedAt: '2026-10-26T14:37:56.721Z',
8
- paymentIntentId: 'pi_3UUp24EUxB2SCTmQ1LBPdo4n',
9
- name: 'A Verified and Audi course or b2c testing 001',
10
- total: {
11
- amount: 90,
12
- currency: 'USD',
13
- },
14
- },
15
- {
16
- orderId: 'BI1RX5VBGMUZCDYD',
17
- orderNumber: '2U-ORD-62638122',
18
- purchasedAt: '2026-10-24T10:15:30.000Z',
19
- paymentIntentId: 'pi_3UUp25EUxB2SCTmQ2LBPdo5p',
20
- name: 'Harvard University CS50 Introduction to Computer Science',
21
- total: {
22
- amount: 219,
23
- currency: 'USD',
24
- },
25
- },
26
- {
27
- orderId: 'BI2SY6WCHNVAEZE',
28
- orderNumber: '2U-ORD-62638123',
29
- purchasedAt: '2026-10-20T08:45:12.000Z',
30
- paymentIntentId: 'pi_3UUp26EUxB2SCTmQ3LBPdo6q',
31
- name: 'Introduction to Python Programming',
32
- total: {
33
- amount: 49,
34
- currency: 'USD',
35
- },
36
- },
37
- ];
38
- const OrdersList = () => (_jsx("div", { className: "px-4", children: orders.map((order) => (_jsx("div", { className: "mb-3", children: _jsx(OrderHistoryCard, { title: order.name, purchaseDate: new Date(order.purchasedAt).toLocaleDateString('en-US'), totalCost: `${order.total.currency === 'USD' ? '$' : ''}${order.total.amount.toFixed(2)} ${order.total.currency}`, orderNumber: order.orderNumber, onViewReceipt: () => {
39
- console.log('View receipt:', order.paymentIntentId);
40
- }, onViewOrderDetails: () => {
41
- console.log('View order details:', order.orderId);
42
- } }) }, order.orderId))) }));
3
+ import { useNavigate } from 'react-router-dom';
4
+ const OrdersList = ({ orders }) => {
5
+ const navigate = useNavigate();
6
+ return (_jsx("div", { className: "px-4", children: orders.map((order) => (_jsx("div", { className: "mb-3", children: _jsx(OrderHistoryCard, { title: order.name, purchaseDate: new Date(order.purchasedAt).toLocaleDateString('en-US'), totalCost: `${order.total.currency === 'USD' ? '$' : ''}${order.total.amount.toFixed(2)} ${order.total.currency}`, orderNumber: order.orderNumber, onViewReceipt: () => {
7
+ console.log('View receipt:', order.paymentIntentId);
8
+ }, onViewOrderDetails: () => navigate(`/aca-order-details/${order.orderId}`) }) }, order.orderId))) }));
9
+ };
43
10
  export default OrdersList;
44
11
  //# sourceMappingURL=OrderList.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"OrderList.js","sourceRoot":"","sources":["../../../src/components/OrderHistory/OrderList.tsx"],"names":[],"mappings":";AAAA,OAAO,gBAAgB,MAAM,oBAAoB,CAAC;AAElD,MAAM,MAAM,GAAG;IACb;QACE,OAAO,EAAE,kBAAkB;QAC3B,WAAW,EAAE,iBAAiB;QAC9B,WAAW,EAAE,0BAA0B;QACvC,eAAe,EAAE,6BAA6B;QAC9C,IAAI,EAAE,+CAA+C;QACrD,KAAK,EAAE;YACL,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AC,GAAG,CAAC,qBAAqB,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;YACpD,CAAC,GACD,IAZM,KAAK,CAAC,OAAO,CAajB,CACP,CAAC,GACE,CACP,CAAC;AAEF,eAAe,UAAU,CAAC","sourcesContent":["import OrderHistoryCard from './OrderHistoryCard';\n\nconst orders = [\n {\n orderId: 'BI0QZ4UAFLTYBCXC',\n orderNumber: '2U-ORD-62638121',\n purchasedAt: '2026-10-26T14:37:56.721Z',\n paymentIntentId: 'pi_3UUp24EUxB2SCTmQ1LBPdo4n',\n name: 'A Verified and Audi course or b2c testing 001',\n total: {\n amount: 90,\n currency: 'USD',\n },\n },\n {\n orderId: 'BI1RX5VBGMUZCDYD',\n orderNumber: '2U-ORD-62638122',\n purchasedAt: '2026-10-24T10:15:30.000Z',\n paymentIntentId: 'pi_3UUp25EUxB2SCTmQ2LBPdo5p',\n name: 'Harvard University CS50 Introduction to Computer Science',\n total: {\n amount: 219,\n currency: 'USD',\n },\n },\n {\n orderId: 'BI2SY6WCHNVAEZE',\n orderNumber: '2U-ORD-62638123',\n purchasedAt: '2026-10-20T08:45:12.000Z',\n paymentIntentId: 'pi_3UUp26EUxB2SCTmQ3LBPdo6q',\n name: 'Introduction to Python Programming',\n total: {\n amount: 49,\n currency: 'USD',\n },\n },\n];\n\nconst OrdersList = () => (\n <div className=\"px-4\">\n {orders.map((order) => (\n <div key={order.orderId} className=\"mb-3\">\n <OrderHistoryCard\n title={order.name}\n purchaseDate={new Date(order.purchasedAt).toLocaleDateString('en-US')}\n totalCost={`${order.total.currency === 'USD' ? '$' : ''}${order.total.amount.toFixed(2)} ${order.total.currency}`}\n orderNumber={order.orderNumber}\n onViewReceipt={() => {\n console.log('View receipt:', order.paymentIntentId);\n }}\n onViewOrderDetails={() => {\n console.log('View order details:', order.orderId);\n }}\n />\n </div>\n ))}\n </div>\n);\n\nexport default OrdersList;\n"]}
1
+ {"version":3,"file":"OrderList.js","sourceRoot":"","sources":["../../../src/components/OrderHistory/OrderList.tsx"],"names":[],"mappings":";AACA,OAAO,gBAAgB,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/C,MAAM,UAAU,GAAG,CAAC,EAAE,MAAM,EAAmB,EAAE,EAAE;IACjD,MAAM,QAAQ,GAAG,WAAW,EAAE,CAAC;IAE/B,OAAO,CACL,cAAK,SAAS,EAAC,MAAM,YAClB,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CACrB,cAAyB,SAAS,EAAC,MAAM,YACvC,KAAC,gBAAgB,IACf,KAAK,EAAE,KAAK,CAAC,IAAI,EACjB,YAAY,EAAE,IAAI,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,kBAAkB,CAAC,OAAO,CAAC,EACrE,SAAS,EAAE,GAAG,KAAK,CAAC,KAAK,CAAC,QAAQ,KAAK,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,GAAG,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,KAAK,CAAC,QAAQ,EAAE,EACjH,WAAW,EAAE,KAAK,CAAC,WAAW,EAC9B,aAAa,EAAE,GAAG,EAAE;oBAClB,OAAO,CAAC,GAAG,CAAC,eAAe,EAAE,KAAK,CAAC,eAAe,CAAC,CAAC;gBACtD,CAAC,EACD,kBAAkB,EAAE,GAAG,EAAE,CAAC,QAAQ,CAAC,sBAAsB,KAAK,CAAC,OAAO,EAAE,CAAC,GACzE,IAVM,KAAK,CAAC,OAAO,CAWjB,CACP,CAAC,GACE,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,UAAU,CAAC","sourcesContent":["import type { OrdersListProps } from '../../types/orderHistory';\nimport OrderHistoryCard from './OrderHistoryCard';\nimport { useNavigate } from 'react-router-dom';\n\nconst OrdersList = ({ orders }: OrdersListProps) => {\n const navigate = useNavigate();\n\n return (\n <div className=\"px-4\">\n {orders.map((order) => (\n <div key={order.orderId} className=\"mb-3\">\n <OrderHistoryCard\n title={order.name}\n purchaseDate={new Date(order.purchasedAt).toLocaleDateString('en-US')}\n totalCost={`${order.total.currency === 'USD' ? '$' : ''}${order.total.amount.toFixed(2)} ${order.total.currency}`}\n orderNumber={order.orderNumber}\n onViewReceipt={() => {\n console.log('View receipt:', order.paymentIntentId);\n }}\n onViewOrderDetails={() => navigate(`/aca-order-details/${order.orderId}`)}\n />\n </div>\n ))}\n </div>\n );\n};\n\nexport default OrdersList;\n"]}
@@ -0,0 +1,13 @@
1
+ export interface OrderDetailsData {
2
+ orderId: string;
3
+ orderNumber: string;
4
+ purchasedAt: string;
5
+ paymentIntentId: string;
6
+ name: string;
7
+ total: {
8
+ amount: number;
9
+ currency: string;
10
+ };
11
+ }
12
+ declare const orderDetailsData: OrderDetailsData[];
13
+ export default orderDetailsData;
@@ -0,0 +1,37 @@
1
+ const orderDetailsData = [
2
+ {
3
+ orderId: 'BI0QZ4UAFLTYBCXC',
4
+ orderNumber: '2U-ORD-62638121',
5
+ purchasedAt: '2026-10-26T14:37:56.721Z',
6
+ paymentIntentId: 'pi_3UUp24EUxB2SCTmQ1LBPdo4n',
7
+ name: 'A Verified and Audi course or b2c testing 001',
8
+ total: {
9
+ amount: 90,
10
+ currency: 'USD',
11
+ },
12
+ },
13
+ {
14
+ orderId: 'BI1RX5VBGMUZCDYD',
15
+ orderNumber: '2U-ORD-62638122',
16
+ purchasedAt: '2026-10-24T10:15:30.000Z',
17
+ paymentIntentId: 'pi_3UUp25EUxB2SCTmQ2LBPdo5p',
18
+ name: 'Harvard University CS50 Introduction to Computer Science',
19
+ total: {
20
+ amount: 219,
21
+ currency: 'USD',
22
+ },
23
+ },
24
+ {
25
+ orderId: 'BI2SY6WCHNVAEZE',
26
+ orderNumber: '2U-ORD-62638123',
27
+ purchasedAt: '2026-10-20T08:45:12.000Z',
28
+ paymentIntentId: 'pi_3UUp26EUxB2SCTmQ3LBPdo6q',
29
+ name: 'Introduction to Python Programming',
30
+ total: {
31
+ amount: 49,
32
+ currency: 'USD',
33
+ },
34
+ },
35
+ ];
36
+ export default orderDetailsData;
37
+ //# sourceMappingURL=orderDetailsData.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"orderDetailsData.js","sourceRoot":"","sources":["../../../../src/components/OrderHistory/data/orderDetailsData.ts"],"names":[],"mappings":"AAYA,MAAM,gBAAgB,GAAuB;IAC3C;QACE,OAAO,EAAE,kBAAkB;QAC3B,WAAW,EAAE,iBAAiB;QAC9B,WAAW,EAAE,0BAA0B;QACvC,eAAe,EAAE,6BAA6B;QAC9C,IAAI,EAAE,+CAA+C;QACrD,KAAK,EAAE;YACL,MAAM,EAAE,EAAE;YACV,QAAQ,EAAE,KAAK;SAChB;KACF;IACD;QACE,OAAO,EAAE,kBAAkB;QAC3B,WAAW,EAAE,iBAAiB;QAC9B,WAAW,EAAE,0BAA0B;QACvC,eAAe,EAAE,6BAA6B;QAC9C,IAAI,EAAE,0DAA0D;QAChE,KAAK,EAAE;YACL,MAAM,EAAE,GAAG;YACX,QAAQ,EAAE,KAAK;SAChB;KACF;IACD;QACE,OAAO,EAAE,iBAAiB;QAC1B,WAAW,EAAE,iBAAiB;QAC9B,WAAW,EAAE,0BAA0B;QACvC,eAAe,EAAE,6BAA6B;QAC9C,IAAI,EAAE,oCAAoC;QAC1C,KAAK,EAAE;YACL,MAAM,EAAE,EAAE;YACV,QAAQ,EAAE,KAAK;SAChB;KACF;CACF,CAAC;AAEF,eAAe,gBAAgB,CAAC","sourcesContent":["export interface OrderDetailsData {\n orderId: string,\n orderNumber: string,\n purchasedAt: string,\n paymentIntentId: string,\n name: string,\n total: {\n amount: number,\n currency: string,\n },\n}\n\nconst orderDetailsData: OrderDetailsData[] = [\n {\n orderId: 'BI0QZ4UAFLTYBCXC',\n orderNumber: '2U-ORD-62638121',\n purchasedAt: '2026-10-26T14:37:56.721Z',\n paymentIntentId: 'pi_3UUp24EUxB2SCTmQ1LBPdo4n',\n name: 'A Verified and Audi course or b2c testing 001',\n total: {\n amount: 90,\n currency: 'USD',\n },\n },\n {\n orderId: 'BI1RX5VBGMUZCDYD',\n orderNumber: '2U-ORD-62638122',\n purchasedAt: '2026-10-24T10:15:30.000Z',\n paymentIntentId: 'pi_3UUp25EUxB2SCTmQ2LBPdo5p',\n name: 'Harvard University CS50 Introduction to Computer Science',\n total: {\n amount: 219,\n currency: 'USD',\n },\n },\n {\n orderId: 'BI2SY6WCHNVAEZE',\n orderNumber: '2U-ORD-62638123',\n purchasedAt: '2026-10-20T08:45:12.000Z',\n paymentIntentId: 'pi_3UUp26EUxB2SCTmQ3LBPdo6q',\n name: 'Introduction to Python Programming',\n total: {\n amount: 49,\n currency: 'USD',\n },\n },\n];\n\nexport default orderDetailsData;\n"]}
@@ -0,0 +1,17 @@
1
+ import type { OrderDetailsData } from './orderDetailsData';
2
+ export declare const getOrderSummaryRows: (order: OrderDetailsData, orderDate: string, total: string, discountAmount: string) => {
3
+ label: {
4
+ id: string;
5
+ defaultMessage: string;
6
+ description: string;
7
+ };
8
+ value: string;
9
+ }[];
10
+ export declare const getOrderItemRows: (order: OrderDetailsData, total: string, discountAmount: string) => {
11
+ label: {
12
+ id: string;
13
+ defaultMessage: string;
14
+ description: string;
15
+ };
16
+ value: string;
17
+ }[];
@@ -0,0 +1,16 @@
1
+ import messages from '../messages';
2
+ export const getOrderSummaryRows = (order, orderDate, total, discountAmount) => [
3
+ { label: messages.receiptOrderNumberLabel, value: order.orderNumber },
4
+ { label: messages.receiptOrderDateLabel, value: orderDate },
5
+ { label: messages.receiptSubtotalLabel, value: total },
6
+ { label: messages.receiptDiscountCodeLabel, value: 'None' },
7
+ { label: messages.receiptDiscountAmountLabel, value: discountAmount },
8
+ { label: messages.receiptTotalAfterDiscountLabel, value: total },
9
+ ];
10
+ export const getOrderItemRows = (order, total, discountAmount) => [
11
+ { label: messages.receiptNameLabel, value: order.name },
12
+ { label: messages.receiptPriceLabel, value: total },
13
+ { label: messages.receiptDiscountAmountLabel, value: discountAmount },
14
+ { label: messages.receiptTotalAfterDiscountLabel, value: total },
15
+ ];
16
+ //# sourceMappingURL=receiptRows.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"receiptRows.js","sourceRoot":"","sources":["../../../../src/components/OrderHistory/data/receiptRows.ts"],"names":[],"mappings":"AACA,OAAO,QAAQ,MAAM,aAAa,CAAC;AAEnC,MAAM,CAAC,MAAM,mBAAmB,GAAG,CACjC,KAAuB,EACvB,SAAiB,EACjB,KAAa,EACb,cAAsB,EACtB,EAAE,CAAC;IACH,EAAE,KAAK,EAAE,QAAQ,CAAC,uBAAuB,EAAE,KAAK,EAAE,KAAK,CAAC,WAAW,EAAE;IACrE,EAAE,KAAK,EAAE,QAAQ,CAAC,qBAAqB,EAAE,KAAK,EAAE,SAAS,EAAE;IAC3D,EAAE,KAAK,EAAE,QAAQ,CAAC,oBAAoB,EAAE,KAAK,EAAE,KAAK,EAAE;IACtD,EAAE,KAAK,EAAE,QAAQ,CAAC,wBAAwB,EAAE,KAAK,EAAE,MAAM,EAAE;IAC3D,EAAE,KAAK,EAAE,QAAQ,CAAC,0BAA0B,EAAE,KAAK,EAAE,cAAc,EAAE;IACrE,EAAE,KAAK,EAAE,QAAQ,CAAC,8BAA8B,EAAE,KAAK,EAAE,KAAK,EAAE;CACjE,CAAC;AAEF,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAC9B,KAAuB,EACvB,KAAa,EACb,cAAsB,EACtB,EAAE,CAAC;IACH,EAAE,KAAK,EAAE,QAAQ,CAAC,gBAAgB,EAAE,KAAK,EAAE,KAAK,CAAC,IAAI,EAAE;IACvD,EAAE,KAAK,EAAE,QAAQ,CAAC,iBAAiB,EAAE,KAAK,EAAE,KAAK,EAAE;IACnD,EAAE,KAAK,EAAE,QAAQ,CAAC,0BAA0B,EAAE,KAAK,EAAE,cAAc,EAAE;IACrE,EAAE,KAAK,EAAE,QAAQ,CAAC,8BAA8B,EAAE,KAAK,EAAE,KAAK,EAAE;CACjE,CAAC","sourcesContent":["import type { OrderDetailsData } from './orderDetailsData';\nimport messages from '../messages';\n\nexport const getOrderSummaryRows = (\n order: OrderDetailsData,\n orderDate: string,\n total: string,\n discountAmount: string,\n) => [\n { label: messages.receiptOrderNumberLabel, value: order.orderNumber },\n { label: messages.receiptOrderDateLabel, value: orderDate },\n { label: messages.receiptSubtotalLabel, value: total },\n { label: messages.receiptDiscountCodeLabel, value: 'None' },\n { label: messages.receiptDiscountAmountLabel, value: discountAmount },\n { label: messages.receiptTotalAfterDiscountLabel, value: total },\n];\n\nexport const getOrderItemRows = (\n order: OrderDetailsData,\n total: string,\n discountAmount: string,\n) => [\n { label: messages.receiptNameLabel, value: order.name },\n { label: messages.receiptPriceLabel, value: total },\n { label: messages.receiptDiscountAmountLabel, value: discountAmount },\n { label: messages.receiptTotalAfterDiscountLabel, value: total },\n];\n"]}
@@ -19,5 +19,70 @@ declare const messages: {
19
19
  defaultMessage: string;
20
20
  description: string;
21
21
  };
22
+ orderDateTitle: {
23
+ id: string;
24
+ defaultMessage: string;
25
+ description: string;
26
+ };
27
+ orderSummaryTitle: {
28
+ id: string;
29
+ defaultMessage: string;
30
+ description: string;
31
+ };
32
+ orderItemsTitle: {
33
+ id: string;
34
+ defaultMessage: string;
35
+ description: string;
36
+ };
37
+ paymentTitle: {
38
+ id: string;
39
+ defaultMessage: string;
40
+ description: string;
41
+ };
42
+ receiptOrderNumberLabel: {
43
+ id: string;
44
+ defaultMessage: string;
45
+ description: string;
46
+ };
47
+ receiptOrderDateLabel: {
48
+ id: string;
49
+ defaultMessage: string;
50
+ description: string;
51
+ };
52
+ receiptSubtotalLabel: {
53
+ id: string;
54
+ defaultMessage: string;
55
+ description: string;
56
+ };
57
+ receiptDiscountCodeLabel: {
58
+ id: string;
59
+ defaultMessage: string;
60
+ description: string;
61
+ };
62
+ receiptDiscountAmountLabel: {
63
+ id: string;
64
+ defaultMessage: string;
65
+ description: string;
66
+ };
67
+ receiptTotalAfterDiscountLabel: {
68
+ id: string;
69
+ defaultMessage: string;
70
+ description: string;
71
+ };
72
+ receiptNameLabel: {
73
+ id: string;
74
+ defaultMessage: string;
75
+ description: string;
76
+ };
77
+ receiptPriceLabel: {
78
+ id: string;
79
+ defaultMessage: string;
80
+ description: string;
81
+ };
82
+ receiptAmountLabel: {
83
+ id: string;
84
+ defaultMessage: string;
85
+ description: string;
86
+ };
22
87
  };
23
88
  export default messages;
@@ -19,7 +19,72 @@ const messages = defineMessages({
19
19
  id: 'coursePaymentsTab',
20
20
  defaultMessage: 'Course payments',
21
21
  description: 'Course payments tab label',
22
- }
22
+ },
23
+ orderDateTitle: {
24
+ id: 'orderDateTitle',
25
+ defaultMessage: 'Order date',
26
+ description: 'Label for order date',
27
+ },
28
+ orderSummaryTitle: {
29
+ id: 'orderSummaryTitle',
30
+ defaultMessage: 'Order summary',
31
+ description: 'Heading for order summary section',
32
+ },
33
+ orderItemsTitle: {
34
+ id: 'orderItemsTitle',
35
+ defaultMessage: 'Order items',
36
+ description: 'Heading for order items section',
37
+ },
38
+ paymentTitle: {
39
+ id: 'paymentTitle',
40
+ defaultMessage: 'Payment',
41
+ description: 'Heading for payment section',
42
+ },
43
+ receiptOrderNumberLabel: {
44
+ id: 'receiptOrderNumberLabel',
45
+ defaultMessage: 'Order number:',
46
+ description: 'Receipt label for the order number',
47
+ },
48
+ receiptOrderDateLabel: {
49
+ id: 'receiptOrderDateLabel',
50
+ defaultMessage: 'Order date:',
51
+ description: 'Receipt label for the order date',
52
+ },
53
+ receiptSubtotalLabel: {
54
+ id: 'receiptSubtotalLabel',
55
+ defaultMessage: 'Subtotal:',
56
+ description: 'Receipt label for the subtotal amount',
57
+ },
58
+ receiptDiscountCodeLabel: {
59
+ id: 'receiptDiscountCodeLabel',
60
+ defaultMessage: 'Discount code:',
61
+ description: 'Receipt label for the discount code',
62
+ },
63
+ receiptDiscountAmountLabel: {
64
+ id: 'receiptDiscountAmountLabel',
65
+ defaultMessage: 'Discount amount:',
66
+ description: 'Receipt label for the discount amount',
67
+ },
68
+ receiptTotalAfterDiscountLabel: {
69
+ id: 'receiptTotalAfterDiscountLabel',
70
+ defaultMessage: 'Total after discount:',
71
+ description: 'Receipt label for the total after discount',
72
+ },
73
+ receiptNameLabel: {
74
+ id: 'receiptNameLabel',
75
+ defaultMessage: 'Name:',
76
+ description: 'Receipt label for the item name',
77
+ },
78
+ receiptPriceLabel: {
79
+ id: 'receiptPriceLabel',
80
+ defaultMessage: 'Price:',
81
+ description: 'Receipt label for the item price',
82
+ },
83
+ receiptAmountLabel: {
84
+ id: 'receiptAmountLabel',
85
+ defaultMessage: 'Amount:',
86
+ description: 'Receipt label for the payment amount',
87
+ },
23
88
  });
24
89
  export default messages;
25
90
  //# sourceMappingURL=messages.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"messages.js","sourceRoot":"","sources":["../../../src/components/OrderHistory/messages.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAExD,MAAM,QAAQ,GAAG,cAAc,CAAC;IAC9B,iBAAiB,EAAE;QACjB,EAAE,EAAE,mBAAmB;QACvB,cAAc,EAAE,eAAe;QAC/B,WAAW,EAAE,2BAA2B;KACzC;IACD,oBAAoB,EAAE;QACpB,EAAE,EAAE,sBAAsB;QAC1B,cAAc,EAAE,wDAAwD;QACxE,WAAW,EAAE,mCAAmC;KACjD;IACD,uBAAuB,EAAE;QACvB,EAAE,EAAE,yBAAyB;QAC7B,cAAc,EAAE,uBAAuB;QACvC,WAAW,EAAE,iCAAiC;KAC/C;IACD,iBAAiB,EAAE;QACjB,EAAE,EAAE,mBAAmB;QACvB,cAAc,EAAE,iBAAiB;QACjC,WAAW,EAAE,2BAA2B;KACzC;CACF,CAAC,CAAC;AAEH,eAAe,QAAQ,CAAC","sourcesContent":["import { defineMessages } from '@openedx/frontend-base';\n\nconst messages = defineMessages({\n orderHistoryTitle: {\n id: 'orderHistoryTitle',\n defaultMessage: 'Order History',\n description: 'Heading for order history',\n },\n orderHistorySubTitle: {\n id: 'orderHistorySubTitle',\n defaultMessage: 'View previous purchases and manage your subscription. ',\n description: 'Page subtitle under Order History',\n },\n subscriptionPaymentsTab: {\n id: 'subscriptionPaymentsTab',\n defaultMessage: 'Subscription payments',\n description: 'Subscription payments tab label',\n },\n coursePaymentsTab: {\n id: 'coursePaymentsTab',\n defaultMessage: 'Course payments',\n description: 'Course payments tab label',\n }\n});\n\nexport default messages;\n"]}
1
+ {"version":3,"file":"messages.js","sourceRoot":"","sources":["../../../src/components/OrderHistory/messages.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAExD,MAAM,QAAQ,GAAG,cAAc,CAAC;IAC9B,iBAAiB,EAAE;QACjB,EAAE,EAAE,mBAAmB;QACvB,cAAc,EAAE,eAAe;QAC/B,WAAW,EAAE,2BAA2B;KACzC;IACD,oBAAoB,EAAE;QACpB,EAAE,EAAE,sBAAsB;QAC1B,cAAc,EAAE,wDAAwD;QACxE,WAAW,EAAE,mCAAmC;KACjD;IACD,uBAAuB,EAAE;QACvB,EAAE,EAAE,yBAAyB;QAC7B,cAAc,EAAE,uBAAuB;QACvC,WAAW,EAAE,iCAAiC;KAC/C;IACD,iBAAiB,EAAE;QACjB,EAAE,EAAE,mBAAmB;QACvB,cAAc,EAAE,iBAAiB;QACjC,WAAW,EAAE,2BAA2B;KACzC;IACD,cAAc,EAAE;QACd,EAAE,EAAE,gBAAgB;QACpB,cAAc,EAAE,YAAY;QAC5B,WAAW,EAAE,sBAAsB;KACpC;IACD,iBAAiB,EAAE;QACjB,EAAE,EAAE,mBAAmB;QACvB,cAAc,EAAE,eAAe;QAC/B,WAAW,EAAE,mCAAmC;KACjD;IACD,eAAe,EAAE;QACf,EAAE,EAAE,iBAAiB;QACrB,cAAc,EAAE,aAAa;QAC7B,WAAW,EAAE,iCAAiC;KAC/C;IACD,YAAY,EAAE;QACZ,EAAE,EAAE,cAAc;QAClB,cAAc,EAAE,SAAS;QACzB,WAAW,EAAE,6BAA6B;KAC3C;IACD,uBAAuB,EAAE;QACvB,EAAE,EAAE,yBAAyB;QAC7B,cAAc,EAAE,eAAe;QAC/B,WAAW,EAAE,oCAAoC;KAClD;IACD,qBAAqB,EAAE;QACrB,EAAE,EAAE,uBAAuB;QAC3B,cAAc,EAAE,aAAa;QAC7B,WAAW,EAAE,kCAAkC;KAChD;IACD,oBAAoB,EAAE;QACpB,EAAE,EAAE,sBAAsB;QAC1B,cAAc,EAAE,WAAW;QAC3B,WAAW,EAAE,uCAAuC;KACrD;IACD,wBAAwB,EAAE;QACxB,EAAE,EAAE,0BAA0B;QAC9B,cAAc,EAAE,gBAAgB;QAChC,WAAW,EAAE,qCAAqC;KACnD;IACD,0BAA0B,EAAE;QAC1B,EAAE,EAAE,4BAA4B;QAChC,cAAc,EAAE,kBAAkB;QAClC,WAAW,EAAE,uCAAuC;KACrD;IACD,8BAA8B,EAAE;QAC9B,EAAE,EAAE,gCAAgC;QACpC,cAAc,EAAE,uBAAuB;QACvC,WAAW,EAAE,4CAA4C;KAC1D;IACD,gBAAgB,EAAE;QAChB,EAAE,EAAE,kBAAkB;QACtB,cAAc,EAAE,OAAO;QACvB,WAAW,EAAE,iCAAiC;KAC/C;IACD,iBAAiB,EAAE;QACjB,EAAE,EAAE,mBAAmB;QACvB,cAAc,EAAE,QAAQ;QACxB,WAAW,EAAE,kCAAkC;KAChD;IACD,kBAAkB,EAAE;QAClB,EAAE,EAAE,oBAAoB;QACxB,cAAc,EAAE,SAAS;QACzB,WAAW,EAAE,sCAAsC;KACpD;CACF,CAAC,CAAC;AAEH,eAAe,QAAQ,CAAC","sourcesContent":["import { defineMessages } from '@openedx/frontend-base';\n\nconst messages = defineMessages({\n orderHistoryTitle: {\n id: 'orderHistoryTitle',\n defaultMessage: 'Order History',\n description: 'Heading for order history',\n },\n orderHistorySubTitle: {\n id: 'orderHistorySubTitle',\n defaultMessage: 'View previous purchases and manage your subscription. ',\n description: 'Page subtitle under Order History',\n },\n subscriptionPaymentsTab: {\n id: 'subscriptionPaymentsTab',\n defaultMessage: 'Subscription payments',\n description: 'Subscription payments tab label',\n },\n coursePaymentsTab: {\n id: 'coursePaymentsTab',\n defaultMessage: 'Course payments',\n description: 'Course payments tab label',\n },\n orderDateTitle: {\n id: 'orderDateTitle',\n defaultMessage: 'Order date',\n description: 'Label for order date',\n },\n orderSummaryTitle: {\n id: 'orderSummaryTitle',\n defaultMessage: 'Order summary',\n description: 'Heading for order summary section',\n },\n orderItemsTitle: {\n id: 'orderItemsTitle',\n defaultMessage: 'Order items',\n description: 'Heading for order items section',\n },\n paymentTitle: {\n id: 'paymentTitle',\n defaultMessage: 'Payment',\n description: 'Heading for payment section',\n },\n receiptOrderNumberLabel: {\n id: 'receiptOrderNumberLabel',\n defaultMessage: 'Order number:',\n description: 'Receipt label for the order number',\n },\n receiptOrderDateLabel: {\n id: 'receiptOrderDateLabel',\n defaultMessage: 'Order date:',\n description: 'Receipt label for the order date',\n },\n receiptSubtotalLabel: {\n id: 'receiptSubtotalLabel',\n defaultMessage: 'Subtotal:',\n description: 'Receipt label for the subtotal amount',\n },\n receiptDiscountCodeLabel: {\n id: 'receiptDiscountCodeLabel',\n defaultMessage: 'Discount code:',\n description: 'Receipt label for the discount code',\n },\n receiptDiscountAmountLabel: {\n id: 'receiptDiscountAmountLabel',\n defaultMessage: 'Discount amount:',\n description: 'Receipt label for the discount amount',\n },\n receiptTotalAfterDiscountLabel: {\n id: 'receiptTotalAfterDiscountLabel',\n defaultMessage: 'Total after discount:',\n description: 'Receipt label for the total after discount',\n },\n receiptNameLabel: {\n id: 'receiptNameLabel',\n defaultMessage: 'Name:',\n description: 'Receipt label for the item name',\n },\n receiptPriceLabel: {\n id: 'receiptPriceLabel',\n defaultMessage: 'Price:',\n description: 'Receipt label for the item price',\n },\n receiptAmountLabel: {\n id: 'receiptAmountLabel',\n defaultMessage: 'Amount:',\n description: 'Receipt label for the payment amount',\n },\n});\n\nexport default messages;\n"]}
@@ -18,4 +18,5 @@ export declare const alacarteKeys: {
18
18
  productDetail: (key: string) => readonly ["alacarte", "productDetail", string];
19
19
  placedOrder: (biId: string) => readonly ["alacarte", "placedOrder", string];
20
20
  orderDates: (biId: string) => readonly ["alacarte", "orderDates", string];
21
+ purchaseHistory: () => readonly ["alacarte", "purchaseHistory"];
21
22
  };
@@ -18,5 +18,6 @@ export const alacarteKeys = {
18
18
  productDetail: (key) => ['alacarte', 'productDetail', key],
19
19
  placedOrder: (biId) => ['alacarte', 'placedOrder', biId],
20
20
  orderDates: (biId) => ['alacarte', 'orderDates', biId],
21
+ purchaseHistory: () => ['alacarte', 'purchaseHistory'],
21
22
  };
22
23
  //# sourceMappingURL=keys.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"keys.js","sourceRoot":"","sources":["../../../src/data/hooks/keys.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B,GAAG,EAAE,CAAC,UAAU,CAAU;IAC1B,MAAM,EAAE,CAAC,QAAgB,EAAE,EAAE,CAAC,CAAC,UAAU,EAAE,QAAQ,EAAE,QAAQ,CAAU;IACvE,YAAY,EAAE,CAAC,cAAsB,EAAE,EAAE,CAAC,CAAC,UAAU,EAAE,cAAc,EAAE,cAAc,CAAU;IAC/F,cAAc,EAAE,CAAC,QAAgB,EAAE,EAAE,CAAC,CAAC,UAAU,EAAE,gBAAgB,EAAE,QAAQ,CAAU;IACvF,QAAQ,EAAE,CAAC,SAAiB,EAAE,EAAE,CAAC,CAAC,UAAU,EAAE,UAAU,EAAE,SAAS,CAAU;IAC7E,OAAO,EAAE,CAAC,IAAY,EAAE,EAAE,CAAC,CAAC,UAAU,EAAE,SAAS,EAAE,IAAI,CAAU;IACjE,WAAW,EAAE,GAAG,EAAE,CAAC,CAAC,UAAU,EAAE,aAAa,CAAU;IACvD,YAAY,EAAE,CAAC,SAAiB,EAAE,EAAE,CAAC,CAAC,UAAU,EAAE,cAAc,EAAE,SAAS,CAAU;IACrF,qBAAqB,EAAE,CAAC,YAAoB,EAAE,EAAE,CAAC,CAAC,UAAU,EAAE,uBAAuB,EAAE,YAAY,CAAU;CAC9G,CAAC;AAEF,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B,QAAQ,EAAE,GAAG,EAAE,CAAC,CAAC,UAAU,EAAE,UAAU,CAAU;IACjD,YAAY,EAAE,CAAC,SAAiB,EAAE,EAAE,CAAC,CAAC,UAAU,EAAE,cAAc,EAAE,SAAS,CAAU;IACrF,aAAa,EAAE,CAAC,GAAW,EAAE,EAAE,CAAC,CAAC,UAAU,EAAE,eAAe,EAAE,GAAG,CAAU;IAC3E,WAAW,EAAE,CAAC,IAAY,EAAE,EAAE,CAAC,CAAC,UAAU,EAAE,aAAa,EAAE,IAAI,CAAU;IACzE,UAAU,EAAE,CAAC,IAAY,EAAE,EAAE,CAAC,CAAC,UAAU,EAAE,YAAY,EAAE,IAAI,CAAU;CACxE,CAAC","sourcesContent":["/**\n * query/keys.ts — typed query-key factory for the checkout module.\n */\nexport const checkoutKeys = {\n all: ['checkout'] as const,\n status: (cartBiId: string) => ['checkout', 'status', cartBiId] as const,\n clientSecret: (subscriptionId: string) => ['checkout', 'clientSecret', subscriptionId] as const,\n subscriptionId: (cartBiId: string) => ['checkout', 'subscriptionId', cartBiId] as const,\n customer: (userEmail: string) => ['checkout', 'customer', userEmail] as const,\n salable: (maId: string) => ['checkout', 'salable', maId] as const,\n viaxSession: () => ['checkout', 'viaxSession'] as const,\n courseDetail: (courseKey: string) => ['checkout', 'courseDetail', courseKey] as const,\n subscriptionCourseKey: (courseRunKey: string) => ['checkout', 'subscriptionCourseKey', courseRunKey] as const,\n};\n\nexport const alacarteKeys = {\n checkout: () => ['alacarte', 'checkout'] as const,\n ownedProduct: (productId: string) => ['alacarte', 'ownedProduct', productId] as const,\n productDetail: (key: string) => ['alacarte', 'productDetail', key] as const,\n placedOrder: (biId: string) => ['alacarte', 'placedOrder', biId] as const,\n orderDates: (biId: string) => ['alacarte', 'orderDates', biId] as const,\n};\n"]}
1
+ {"version":3,"file":"keys.js","sourceRoot":"","sources":["../../../src/data/hooks/keys.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B,GAAG,EAAE,CAAC,UAAU,CAAU;IAC1B,MAAM,EAAE,CAAC,QAAgB,EAAE,EAAE,CAAC,CAAC,UAAU,EAAE,QAAQ,EAAE,QAAQ,CAAU;IACvE,YAAY,EAAE,CAAC,cAAsB,EAAE,EAAE,CAAC,CAAC,UAAU,EAAE,cAAc,EAAE,cAAc,CAAU;IAC/F,cAAc,EAAE,CAAC,QAAgB,EAAE,EAAE,CAAC,CAAC,UAAU,EAAE,gBAAgB,EAAE,QAAQ,CAAU;IACvF,QAAQ,EAAE,CAAC,SAAiB,EAAE,EAAE,CAAC,CAAC,UAAU,EAAE,UAAU,EAAE,SAAS,CAAU;IAC7E,OAAO,EAAE,CAAC,IAAY,EAAE,EAAE,CAAC,CAAC,UAAU,EAAE,SAAS,EAAE,IAAI,CAAU;IACjE,WAAW,EAAE,GAAG,EAAE,CAAC,CAAC,UAAU,EAAE,aAAa,CAAU;IACvD,YAAY,EAAE,CAAC,SAAiB,EAAE,EAAE,CAAC,CAAC,UAAU,EAAE,cAAc,EAAE,SAAS,CAAU;IACrF,qBAAqB,EAAE,CAAC,YAAoB,EAAE,EAAE,CAAC,CAAC,UAAU,EAAE,uBAAuB,EAAE,YAAY,CAAU;CAC9G,CAAC;AAEF,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B,QAAQ,EAAE,GAAG,EAAE,CAAC,CAAC,UAAU,EAAE,UAAU,CAAU;IACjD,YAAY,EAAE,CAAC,SAAiB,EAAE,EAAE,CAAC,CAAC,UAAU,EAAE,cAAc,EAAE,SAAS,CAAU;IACrF,aAAa,EAAE,CAAC,GAAW,EAAE,EAAE,CAAC,CAAC,UAAU,EAAE,eAAe,EAAE,GAAG,CAAU;IAC3E,WAAW,EAAE,CAAC,IAAY,EAAE,EAAE,CAAC,CAAC,UAAU,EAAE,aAAa,EAAE,IAAI,CAAU;IACzE,UAAU,EAAE,CAAC,IAAY,EAAE,EAAE,CAAC,CAAC,UAAU,EAAE,YAAY,EAAE,IAAI,CAAU;IACvE,eAAe,EAAE,GAAG,EAAE,CAAC,CAAC,UAAU,EAAE,iBAAiB,CAAU;CAChE,CAAC","sourcesContent":["/**\n * query/keys.ts — typed query-key factory for the checkout module.\n */\nexport const checkoutKeys = {\n all: ['checkout'] as const,\n status: (cartBiId: string) => ['checkout', 'status', cartBiId] as const,\n clientSecret: (subscriptionId: string) => ['checkout', 'clientSecret', subscriptionId] as const,\n subscriptionId: (cartBiId: string) => ['checkout', 'subscriptionId', cartBiId] as const,\n customer: (userEmail: string) => ['checkout', 'customer', userEmail] as const,\n salable: (maId: string) => ['checkout', 'salable', maId] as const,\n viaxSession: () => ['checkout', 'viaxSession'] as const,\n courseDetail: (courseKey: string) => ['checkout', 'courseDetail', courseKey] as const,\n subscriptionCourseKey: (courseRunKey: string) => ['checkout', 'subscriptionCourseKey', courseRunKey] as const,\n};\n\nexport const alacarteKeys = {\n checkout: () => ['alacarte', 'checkout'] as const,\n ownedProduct: (productId: string) => ['alacarte', 'ownedProduct', productId] as const,\n productDetail: (key: string) => ['alacarte', 'productDetail', key] as const,\n placedOrder: (biId: string) => ['alacarte', 'placedOrder', biId] as const,\n orderDates: (biId: string) => ['alacarte', 'orderDates', biId] as const,\n purchaseHistory: () => ['alacarte', 'purchaseHistory'] as const,\n};\n"]}
@@ -201,3 +201,5 @@ export declare function usePlacedOrderQuery(client: AlacarteCheckoutClient | nul
201
201
  * confirmation page's purchase date and refund-window deadline.
202
202
  * Polls until tPlacedAt is set (it stays null while payment is pending). */
203
203
  export declare function useOrderDatesQuery(client: AlacarteCheckoutClient | null, biId: string | null, enabled: boolean): import("@tanstack/react-query").UseQueryResult<OrderDatesResult, Error>;
204
+ /** Fetches the learner's purchase-history payload for the course payments tab. */
205
+ export declare function usePurchaseHistoryQuery(client: AlacarteCheckoutClient | null, enabled: boolean): import("@tanstack/react-query").UseQueryResult<any, Error>;
@@ -138,4 +138,15 @@ export function useOrderDatesQuery(client, biId, enabled) {
138
138
  refetchInterval: (q) => orderDatesRefetchInterval(q.state.data, poll.elapsedMs()),
139
139
  });
140
140
  }
141
+ /** Fetches the learner's purchase-history payload for the course payments tab. */
142
+ export function usePurchaseHistoryQuery(client, enabled) {
143
+ return useQuery({
144
+ queryKey: alacarteKeys.purchaseHistory(),
145
+ enabled: enabled && !!client,
146
+ queryFn: () => client.getPurchaseHistory(),
147
+ staleTime: 5 * 60 * 1000,
148
+ refetchOnWindowFocus: false,
149
+ retry: 1,
150
+ });
151
+ }
141
152
  //# sourceMappingURL=useAlacarteQueries.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useAlacarteQueries.js","sourceRoot":"","sources":["../../../src/data/hooks/useAlacarteQueries.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACpD,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAC9D,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,EACL,4BAA4B,EAC5B,yBAAyB,EACzB,0BAA0B,GAC3B,MAAM,mBAAmB,CAAC;AAM3B,mEAAmE;AACnE,SAAS,aAAa,CAAC,MAAe;IACpC,MAAM,YAAY,GAAG,MAAM,CAAgB,IAAI,CAAC,CAAC;IACjD,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAEhD,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,CAAC,MAAM,EAAE,CAAC;YACZ,YAAY,CAAC,OAAO,GAAG,IAAI,CAAC;YAC5B,WAAW,C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E,CAAC,yBAAyB,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,SAAS,EAAE,CAAC;KAClF,CAAC,CAAC;AACL,CAAC","sourcesContent":["/**\n * data/hooks/useAlacarteQueries.ts — read/write-side TanStack Query hooks for\n * the à la carte checkout flow. Mirrors useCheckoutQueries.ts's conventions.\n */\nimport { useEffect, useRef, useState } from 'react';\nimport { useQuery, useMutation } from '@tanstack/react-query';\nimport { alacarteKeys } from './keys';\nimport {\n PLACED_ORDER_POLL_TIMEOUT_MS,\n orderDatesRefetchInterval,\n placedOrderRefetchInterval,\n} from './placedOrderPoll';\nimport type {\n AlacarteCheckoutClient, AlacarteCheckoutResult, OwnedProductResult, ProductSelector, ProductDetail,\n PlacedOrderResult, OrderDatesResult,\n} from '../../types/alacarte';\n\n/** 30s window starting when a post-payment poll becomes active. */\nfunction usePollWindow(active: boolean): { elapsedMs: () => number, timedOut: boolean } {\n const startedAtRef = useRef<number | null>(null);\n const [timedOut, setTimedOut] = useState(false);\n\n useEffect(() => {\n if (!active) {\n startedAtRef.current = null;\n setTimedOut(false);\n return undefined;\n }\n startedAtRef.current = Date.now();\n setTimedOut(false);\n const timer = window.setTimeout(() => setTimedOut(true), PLACED_ORDER_POLL_TIMEOUT_MS);\n return () => window.clearTimeout(timer);\n }, [active]);\n\n const elapsedMs = () => (startedAtRef.current == null ? 0 : Date.now() - startedAtRef.current);\n return { elapsedMs, timedOut };\n}\n\n/** Checks ownership of the product identified by the query params. */\nexport function useOwnedProductQuery(\n client: AlacarteCheckoutClient | null,\n enabled: boolean,\n productId: string | null,\n) {\n return useQuery({\n queryKey: alacarteKeys.ownedProduct(productId ?? 'none'),\n enabled: enabled && !!client && !!productId,\n queryFn: (): Promise<OwnedProductResult> => client!.getOwnedProduct(productId!),\n staleTime: Infinity,\n refetchOnWindowFocus: false,\n retry: 1,\n });\n}\n\n/** Reads the learner's existing open checkout (used when there's no product selector). */\nexport function useAlacarteCheckoutQuery(client: AlacarteCheckoutClient | null, enabled: boolean) {\n return useQuery({\n queryKey: alacarteKeys.checkout(),\n enabled: enabled && !!client,\n queryFn: (): Promise<AlacarteCheckoutResult> => client!.getCheckout(),\n // Keep the open checkout stable while the tab is backgrounded — a focus\n // refetch would remount payment UI / re-run select for no user action.\n staleTime: Infinity,\n refetchOnWindowFocus: false,\n retry: 1,\n });\n}\n\n/** Selects a course or program into the learner's checkout — fired once ownership is confirmed not-full.\n * `viewedPrice` is `tOwnedProducts.price.amountDue` (USD, before any coupon) for ALC-159. */\nexport function useSelectProductMutation(client: AlacarteCheckoutClient | null) {\n return useMutation({\n mutationFn: (args: {\n selector: ProductSelector,\n viewedPrice?: number,\n }): Promise<AlacarteCheckoutResult> => {\n if (!client) return Promise.reject(new Error('Alacarte client not ready.'));\n const { selector, viewedPrice } = args;\n if (selector.kind === 'course') {\n return client.selectCourse(selector.courseUid, selector.runKey, viewedPrice);\n }\n if (selector.kind === 'program') {\n return client.selectProgram(selector.programUid, viewedPrice);\n }\n return Promise.reject(new Error('selectMutation called with no product selector.'));\n },\n });\n}\n\n/** Updates the learner's checkout — used here to apply ?discount_code= right\n * after the checkout is created. */\nexport function useUpdateCheckoutMutation(client: AlacarteCheckoutClient | null) {\n return useMutation({\n mutationFn: (args: {\n biId?: string, couponCode?: string, termsAccepted?: boolean, acceptPrice?: boolean,\n }): Promise<AlacarteCheckoutResult> => {\n if (!client) return Promise.reject(new Error('Alacarte client not ready.'));\n return client.updateCheckout(args);\n },\n });\n}\n\n/** Fetches display details for the selected product.\n * A course is looked up in Viax by elements[0].course from the\n * subscription course-run API (not the course-run key or the URL param).\n * A program uses filterTwouProgram by tProgramUuid. */\nexport function useProductDetailQuery(\n client: AlacarteCheckoutClient | null,\n enabled: boolean,\n selector: ProductSelector,\n courseKey: string | null = null,\n) {\n const productKey = selector.kind === 'course'\n ? (courseKey ?? 'none')\n : selector.kind === 'program' ? selector.programUid : 'none';\n\n return useQuery({\n queryKey: alacarteKeys.productDetail(`${selector.kind}:${productKey}`),\n enabled: enabled && !!client && (\n selector.kind === 'program' || (selector.kind === 'course' && !!courseKey)\n ),\n queryFn: (): Promise<ProductDetail | null> => {\n if (selector.kind === 'course') return client!.getCourseDetail(courseKey!);\n if (selector.kind === 'program') return client!.getProgramDetail(selector.programUid);\n return Promise.resolve(null);\n },\n staleTime: Infinity,\n refetchOnWindowFocus: false,\n retry: 1,\n });\n}\n\n/**\n * Fetches a placed order for the confirmation page.\n * Polls for 30s while the payment is still confirming (PAYMENT_PENDING,\n * including 3DS). Stops on a placed order, or immediately on NOT_PLACED\n * (payment failed — caller returns the learner to checkout).\n */\nexport function usePlacedOrderQuery(\n client: AlacarteCheckoutClient | null,\n biId: string | null,\n enabled: boolean,\n) {\n const active = enabled && !!client && !!biId;\n const poll = usePollWindow(active);\n const query = useQuery({\n queryKey: alacarteKeys.placedOrder(biId ?? 'none'),\n enabled: active,\n queryFn: (): Promise<PlacedOrderResult> => client!.getPlacedOrder(biId!),\n staleTime: 0,\n refetchOnWindowFocus: false,\n refetchIntervalInBackground: true,\n retry: 1,\n refetchInterval: (q) => placedOrderRefetchInterval(q.state.data, poll.elapsedMs()),\n });\n return { ...query, pollTimedOut: poll.timedOut };\n}\n\n/** Fetches the order's placement/creation timestamps — used for the\n * confirmation page's purchase date and refund-window deadline.\n * Polls until tPlacedAt is set (it stays null while payment is pending). */\nexport function useOrderDatesQuery(\n client: AlacarteCheckoutClient | null,\n biId: string | null,\n enabled: boolean,\n) {\n const active = enabled && !!client && !!biId;\n const poll = usePollWindow(active);\n return useQuery({\n queryKey: alacarteKeys.orderDates(biId ?? 'none'),\n enabled: active,\n queryFn: (): Promise<OrderDatesResult> => client!.getOrderDates(biId!),\n staleTime: 0,\n refetchOnWindowFocus: false,\n refetchIntervalInBackground: true,\n retry: 1,\n refetchInterval: (q) => orderDatesRefetchInterval(q.state.data, poll.elapsedMs()),\n });\n}\n"]}
1
+ {"version":3,"file":"useAlacarteQueries.js","sourceRoot":"","sources":["../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AE,YAAY,EAAE,IAAI,CAAC,QAAQ,IAAG;AACnD,CAAC;AAED;;6EAE6E;AAC7E,MAAM,UAAU,kBAAkB,CAChC,MAAqC,EACrC,IAAmB,EACnB,OAAgB;IAEhB,MAAM,MAAM,GAAG,OAAO,IAAI,CAAC,CAAC,MAAM,IAAI,CAAC,CAAC,IAAI,CAAC;IAC7C,MAAM,IAAI,GAAG,aAAa,CAAC,MAAM,CAAC,CAAC;IACnC,OAAO,QAAQ,CAAC;QACd,QAAQ,EAAE,YAAY,CAAC,UAAU,CAAC,IAAI,aAAJ,IAAI,cAAJ,IAAI,GAAI,MAAM,CAAC;QACjD,OAAO,EAAE,MAAM;QACf,OAAO,EAAE,GAA8B,EAAE,CAAC,MAAO,CAAC,aAAa,CAAC,IAAK,CAAC;QACtE,SAAS,EAAE,CAAC;QACZ,oBAAoB,EAAE,KAAK;QAC3B,2BAA2B,EAAE,IAAI;QACjC,KAAK,EAAE,CAAC;QACR,eAAe,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,yBAAyB,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,SAAS,EAAE,CAAC;KAClF,CAAC,CAAC;AACL,CAAC;AAED,kFAAkF;AAClF,MAAM,UAAU,uBAAuB,CAAC,MAAqC,EAAE,OAAgB;IAC7F,OAAO,QAAQ,CAAC;QACd,QAAQ,EAAE,YAAY,CAAC,eAAe,EAAE;QACxC,OAAO,EAAE,OAAO,IAAI,CAAC,CAAC,MAAM;QAC5B,OAAO,EAAE,GAAiB,EAAE,CAAC,MAAO,CAAC,kBAAkB,EAAE;QACzD,SAAS,EAAE,CAAC,GAAG,EAAE,GAAG,IAAI;QACxB,oBAAoB,EAAE,KAAK;QAC3B,KAAK,EAAE,CAAC;KACT,CAAC,CAAC;AACL,CAAC","sourcesContent":["/**\n * data/hooks/useAlacarteQueries.ts — read/write-side TanStack Query hooks for\n * the à la carte checkout flow. Mirrors useCheckoutQueries.ts's conventions.\n */\nimport { useEffect, useRef, useState } from 'react';\nimport { useQuery, useMutation } from '@tanstack/react-query';\nimport { alacarteKeys } from './keys';\nimport {\n PLACED_ORDER_POLL_TIMEOUT_MS,\n orderDatesRefetchInterval,\n placedOrderRefetchInterval,\n} from './placedOrderPoll';\nimport type {\n AlacarteCheckoutClient, AlacarteCheckoutResult, OwnedProductResult, ProductSelector, ProductDetail,\n PlacedOrderResult, OrderDatesResult,\n} from '../../types/alacarte';\n\n/** 30s window starting when a post-payment poll becomes active. */\nfunction usePollWindow(active: boolean): { elapsedMs: () => number, timedOut: boolean } {\n const startedAtRef = useRef<number | null>(null);\n const [timedOut, setTimedOut] = useState(false);\n\n useEffect(() => {\n if (!active) {\n startedAtRef.current = null;\n setTimedOut(false);\n return undefined;\n }\n startedAtRef.current = Date.now();\n setTimedOut(false);\n const timer = window.setTimeout(() => setTimedOut(true), PLACED_ORDER_POLL_TIMEOUT_MS);\n return () => window.clearTimeout(timer);\n }, [active]);\n\n const elapsedMs = () => (startedAtRef.current == null ? 0 : Date.now() - startedAtRef.current);\n return { elapsedMs, timedOut };\n}\n\n/** Checks ownership of the product identified by the query params. */\nexport function useOwnedProductQuery(\n client: AlacarteCheckoutClient | null,\n enabled: boolean,\n productId: string | null,\n) {\n return useQuery({\n queryKey: alacarteKeys.ownedProduct(productId ?? 'none'),\n enabled: enabled && !!client && !!productId,\n queryFn: (): Promise<OwnedProductResult> => client!.getOwnedProduct(productId!),\n staleTime: Infinity,\n refetchOnWindowFocus: false,\n retry: 1,\n });\n}\n\n/** Reads the learner's existing open checkout (used when there's no product selector). */\nexport function useAlacarteCheckoutQuery(client: AlacarteCheckoutClient | null, enabled: boolean) {\n return useQuery({\n queryKey: alacarteKeys.checkout(),\n enabled: enabled && !!client,\n queryFn: (): Promise<AlacarteCheckoutResult> => client!.getCheckout(),\n // Keep the open checkout stable while the tab is backgrounded — a focus\n // refetch would remount payment UI / re-run select for no user action.\n staleTime: Infinity,\n refetchOnWindowFocus: false,\n retry: 1,\n });\n}\n\n/** Selects a course or program into the learner's checkout — fired once ownership is confirmed not-full.\n * `viewedPrice` is `tOwnedProducts.price.amountDue` (USD, before any coupon) for ALC-159. */\nexport function useSelectProductMutation(client: AlacarteCheckoutClient | null) {\n return useMutation({\n mutationFn: (args: {\n selector: ProductSelector,\n viewedPrice?: number,\n }): Promise<AlacarteCheckoutResult> => {\n if (!client) return Promise.reject(new Error('Alacarte client not ready.'));\n const { selector, viewedPrice } = args;\n if (selector.kind === 'course') {\n return client.selectCourse(selector.courseUid, selector.runKey, viewedPrice);\n }\n if (selector.kind === 'program') {\n return client.selectProgram(selector.programUid, viewedPrice);\n }\n return Promise.reject(new Error('selectMutation called with no product selector.'));\n },\n });\n}\n\n/** Updates the learner's checkout — used here to apply ?discount_code= right\n * after the checkout is created. */\nexport function useUpdateCheckoutMutation(client: AlacarteCheckoutClient | null) {\n return useMutation({\n mutationFn: (args: {\n biId?: string, couponCode?: string, termsAccepted?: boolean, acceptPrice?: boolean,\n }): Promise<AlacarteCheckoutResult> => {\n if (!client) return Promise.reject(new Error('Alacarte client not ready.'));\n return client.updateCheckout(args);\n },\n });\n}\n\n/** Fetches display details for the selected product.\n * A course is looked up in Viax by elements[0].course from the\n * subscription course-run API (not the course-run key or the URL param).\n * A program uses filterTwouProgram by tProgramUuid. */\nexport function useProductDetailQuery(\n client: AlacarteCheckoutClient | null,\n enabled: boolean,\n selector: ProductSelector,\n courseKey: string | null = null,\n) {\n const productKey = selector.kind === 'course'\n ? (courseKey ?? 'none')\n : selector.kind === 'program' ? selector.programUid : 'none';\n\n return useQuery({\n queryKey: alacarteKeys.productDetail(`${selector.kind}:${productKey}`),\n enabled: enabled && !!client && (\n selector.kind === 'program' || (selector.kind === 'course' && !!courseKey)\n ),\n queryFn: (): Promise<ProductDetail | null> => {\n if (selector.kind === 'course') return client!.getCourseDetail(courseKey!);\n if (selector.kind === 'program') return client!.getProgramDetail(selector.programUid);\n return Promise.resolve(null);\n },\n staleTime: Infinity,\n refetchOnWindowFocus: false,\n retry: 1,\n });\n}\n\n/**\n * Fetches a placed order for the confirmation page.\n * Polls for 30s while the payment is still confirming (PAYMENT_PENDING,\n * including 3DS). Stops on a placed order, or immediately on NOT_PLACED\n * (payment failed — caller returns the learner to checkout).\n */\nexport function usePlacedOrderQuery(\n client: AlacarteCheckoutClient | null,\n biId: string | null,\n enabled: boolean,\n) {\n const active = enabled && !!client && !!biId;\n const poll = usePollWindow(active);\n const query = useQuery({\n queryKey: alacarteKeys.placedOrder(biId ?? 'none'),\n enabled: active,\n queryFn: (): Promise<PlacedOrderResult> => client!.getPlacedOrder(biId!),\n staleTime: 0,\n refetchOnWindowFocus: false,\n refetchIntervalInBackground: true,\n retry: 1,\n refetchInterval: (q) => placedOrderRefetchInterval(q.state.data, poll.elapsedMs()),\n });\n return { ...query, pollTimedOut: poll.timedOut };\n}\n\n/** Fetches the order's placement/creation timestamps — used for the\n * confirmation page's purchase date and refund-window deadline.\n * Polls until tPlacedAt is set (it stays null while payment is pending). */\nexport function useOrderDatesQuery(\n client: AlacarteCheckoutClient | null,\n biId: string | null,\n enabled: boolean,\n) {\n const active = enabled && !!client && !!biId;\n const poll = usePollWindow(active);\n return useQuery({\n queryKey: alacarteKeys.orderDates(biId ?? 'none'),\n enabled: active,\n queryFn: (): Promise<OrderDatesResult> => client!.getOrderDates(biId!),\n staleTime: 0,\n refetchOnWindowFocus: false,\n refetchIntervalInBackground: true,\n retry: 1,\n refetchInterval: (q) => orderDatesRefetchInterval(q.state.data, poll.elapsedMs()),\n });\n}\n\n/** Fetches the learner's purchase-history payload for the course payments tab. */\nexport function usePurchaseHistoryQuery(client: AlacarteCheckoutClient | null, enabled: boolean) {\n return useQuery({\n queryKey: alacarteKeys.purchaseHistory(),\n enabled: enabled && !!client,\n queryFn: (): Promise<any> => client!.getPurchaseHistory(),\n staleTime: 5 * 60 * 1000,\n refetchOnWindowFocus: false,\n retry: 1,\n });\n}\n"]}
package/dist/routes.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- declare const routes: {
1
+ declare const routes: ({
2
2
  id: string;
3
3
  path: string;
4
4
  loader: (args: any) => Promise<null>;
@@ -14,5 +14,21 @@ declare const routes: {
14
14
  Component: import("react").FC<{}>;
15
15
  }>;
16
16
  }[];
17
- }[];
17
+ } | {
18
+ id: string;
19
+ path: string;
20
+ loader: (args: any) => Promise<null>;
21
+ handle: {
22
+ roles: string[];
23
+ };
24
+ lazy(): Promise<{
25
+ Component: () => import("react/jsx-runtime").JSX.Element;
26
+ }>;
27
+ children: {
28
+ index: boolean;
29
+ lazy(): Promise<{
30
+ Component: () => import("react/jsx-runtime").JSX.Element;
31
+ }>;
32
+ }[];
33
+ })[];
18
34
  export default routes;
package/dist/routes.js CHANGED
@@ -88,6 +88,33 @@ const routes = [
88
88
  },
89
89
  ],
90
90
  },
91
+ {
92
+ id: 'org.openedx.frontend.route.template.main.aca-order-details',
93
+ path: 'aca-order-details/:orderId',
94
+ loader: protectedLoader,
95
+ handle: {
96
+ roles: [acaCheckoutRole],
97
+ },
98
+ lazy() {
99
+ return __awaiter(this, void 0, void 0, function* () {
100
+ const module = yield import(
101
+ /* webpackChunkName: "template-main" */ './Main');
102
+ return { Component: module.default };
103
+ });
104
+ },
105
+ children: [
106
+ {
107
+ index: true,
108
+ lazy() {
109
+ return __awaiter(this, void 0, void 0, function* () {
110
+ const module = yield import(
111
+ /* webpackChunkName: "OrderHistoryDetails" */ './components/OrderHistory/OrderHistoryDetails');
112
+ return { Component: module.default };
113
+ });
114
+ },
115
+ },
116
+ ],
117
+ },
91
118
  ];
92
119
  export default routes;
93
120
  //# sourceMappingURL=routes.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"routes.js","sourceRoot":"","sources":["../src/routes.tsx"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EACL,mBAAmB,GACpB,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAE9C;;;;;;;;GAQG;AACH,MAAM,u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ACzB,MAAM,EAAE,eAAe;QACvB,MAAM,EAAE;YACN,KAAK,EAAE,CAAC,eAAe,CAAC;SACzB;QACK,IAAI;;gBACR,MAAM,MAAM,GAAG,MAAM,MAAM;gBACzB,uCAAuC,CAAC,QAAQ,CACjD,CAAC;gBACF,OAAO,EAAE,SAAS,EAAE,MAAM,CAAC,OAAO,EAAE,CAAC;YACvC,CAAC;SAAA;QACD,QAAQ,EAAE;YACR;gBACE,KAAK,EAAE,IAAI;gBACL,IAAI;;wBACR,MAAM,MAAM,GAAG,MAAM,MAAM;wBACzB,sCAAsC,CAAC,wCAAwC,CAChF,CAAC;wBACF,OAAO,EAAE,SAAS,EAAE,MAAM,CAAC,OAAO,EAAE,CAAC;oBACvC,CAAC;iBAAA;aACF;SACF;KACF;CACF,CAAC;AAEF,eAAe,MAAM,CAAC","sourcesContent":["import {\n authenticatedLoader,\n} from '@openedx/frontend-base';\n\nimport { acaCheckoutRole } from './constants';\n\n/**\n * LMS JWT cookies are host-bound to localhost:18000. On https://localhost or an\n * ngrok tunnel they are missing, so authenticatedLoader sends you to LMS login\n * → usually /dashboard. DEV_MOCK_SESSION covers Viax tokens for that case.\n *\n * Do not use getAppConfig() here — app configs are registered after the router\n * is created, so the first loader pass often sees an empty config and still\n * redirects. Use the request hostname instead.\n */\nconst shouldSkipLmsCookieAuth = (requestUrl: string): boolean => {\n const { hostname } = new URL(requestUrl);\n return hostname === 'localhost'\n || hostname === '127.0.0.1'\n || hostname.endsWith('.ngrok-free.app')\n || hostname.endsWith('.ngrok-free.dev')\n || hostname.endsWith('.ngrok.app')\n || hostname.endsWith('.ngrok.io');\n};\n\nconst protectedLoader = async (args) => {\n if (!shouldSkipLmsCookieAuth(args.request.url)) {\n await authenticatedLoader(args);\n }\n\n return null;\n};\n\nconst routes = [\n {\n id: 'org.openedx.frontend.route.template.main.aca-checkout',\n path: 'aca-checkout',\n loader: protectedLoader,\n handle: {\n roles: [acaCheckoutRole],\n },\n async lazy() {\n const module = await import(\n /* webpackChunkName: \"template-main\" */ './Main'\n );\n return { Component: module.default };\n },\n children: [\n {\n index: true,\n async lazy() {\n const module = await import(\n /* webpackChunkName: \"CheckoutPage\" */ './checkoutPage/CheckoutPage'\n );\n return { Component: module.default };\n },\n },\n ],\n },\n {\n id: 'org.openedx.frontend.route.template.main.aca-order-history',\n path: 'aca-order-history',\n loader: protectedLoader,\n handle: {\n roles: [acaCheckoutRole],\n },\n async lazy() {\n const module = await import(\n /* webpackChunkName: \"template-main\" */ './Main'\n );\n return { Component: module.default };\n },\n children: [\n {\n index: true,\n async lazy() {\n const module = await import(\n /* webpackChunkName: \"OrderHistory\" */ './components/OrderHistory/OrderHistory'\n );\n return { Component: module.default };\n },\n },\n ],\n },\n];\n\nexport default routes;\n"]}
1
+ {"version":3,"file":"routes.js","sourceRoot":"","sources":["../src/routes.tsx"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EACL,mBAAmB,GACpB,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAE9C;;;;;;;;GAQG;AACH,MAAM,uBAAuB,GAAG,CAAC,UAAkB,EAAW,EAAE;IAC9D,MAAM,EAAE,QAAQ,EAAE,GAAG,IAAI,GAAG,CAAC,UAAU,CAAC,CAAC;IACzC,OAAO,QAAQ,KAAK,WAAW;WAC1B,QAAQ,KAAK,WAAW;WACxB,QAAQ,CAAC,QAAQ,CAAC,iBAAiB,CAAC;WACpC,QAAQ,CAAC,QAAQ,CAAC,iBAAiB,CAAC;WACpC,QAAQ,CAAC,QAAQ,CAAC,YAAY,CAAC;WAC/B,QAAQ,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC;AACtC,CAAC,CAAC;AAEF,MAAM,eAAe,GAAG,CAAO,IAAI,EAAE,EAAE;IACrC,IAAI,CAAC,uBAAuB,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC;QAC/C,MAAM,mBAAmB,CAAC,IAAI,CAAC,C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M,EAAE,eAAe;QACvB,MAAM,EAAE;YACN,KAAK,EAAE,CAAC,eAAe,CAAC;SACzB;QACK,IAAI;;gBACR,MAAM,MAAM,GAAG,MAAM,MAAM;gBACzB,uCAAuC,CAAC,QAAQ,CACjD,CAAC;gBACF,OAAO,EAAE,SAAS,EAAE,MAAM,CAAC,OAAO,EAAE,CAAC;YACvC,CAAC;SAAA;QACD,QAAQ,EAAE;YACR;gBACE,KAAK,EAAE,IAAI;gBACL,IAAI;;wBACR,MAAM,MAAM,GAAG,MAAM,MAAM;wBACzB,6CAA6C,CAAC,+CAA+C,CAC9F,CAAC;wBACF,OAAO,EAAE,SAAS,EAAE,MAAM,CAAC,OAAO,EAAE,CAAC;oBACvC,CAAC;iBAAA;aACF;SACF;KACF;CACF,CAAC;AAEF,eAAe,MAAM,CAAC","sourcesContent":["import {\n authenticatedLoader,\n} from '@openedx/frontend-base';\n\nimport { acaCheckoutRole } from './constants';\n\n/**\n * LMS JWT cookies are host-bound to localhost:18000. On https://localhost or an\n * ngrok tunnel they are missing, so authenticatedLoader sends you to LMS login\n * → usually /dashboard. DEV_MOCK_SESSION covers Viax tokens for that case.\n *\n * Do not use getAppConfig() here — app configs are registered after the router\n * is created, so the first loader pass often sees an empty config and still\n * redirects. Use the request hostname instead.\n */\nconst shouldSkipLmsCookieAuth = (requestUrl: string): boolean => {\n const { hostname } = new URL(requestUrl);\n return hostname === 'localhost'\n || hostname === '127.0.0.1'\n || hostname.endsWith('.ngrok-free.app')\n || hostname.endsWith('.ngrok-free.dev')\n || hostname.endsWith('.ngrok.app')\n || hostname.endsWith('.ngrok.io');\n};\n\nconst protectedLoader = async (args) => {\n if (!shouldSkipLmsCookieAuth(args.request.url)) {\n await authenticatedLoader(args);\n }\n\n return null;\n};\n\nconst routes = [\n {\n id: 'org.openedx.frontend.route.template.main.aca-checkout',\n path: 'aca-checkout',\n loader: protectedLoader,\n handle: {\n roles: [acaCheckoutRole],\n },\n async lazy() {\n const module = await import(\n /* webpackChunkName: \"template-main\" */ './Main'\n );\n return { Component: module.default };\n },\n children: [\n {\n index: true,\n async lazy() {\n const module = await import(\n /* webpackChunkName: \"CheckoutPage\" */ './checkoutPage/CheckoutPage'\n );\n return { Component: module.default };\n },\n },\n ],\n },\n {\n id: 'org.openedx.frontend.route.template.main.aca-order-history',\n path: 'aca-order-history',\n loader: protectedLoader,\n handle: {\n roles: [acaCheckoutRole],\n },\n async lazy() {\n const module = await import(\n /* webpackChunkName: \"template-main\" */ './Main'\n );\n return { Component: module.default };\n },\n children: [\n {\n index: true,\n async lazy() {\n const module = await import(\n /* webpackChunkName: \"OrderHistory\" */ './components/OrderHistory/OrderHistory'\n );\n return { Component: module.default };\n },\n },\n ],\n },\n {\n id: 'org.openedx.frontend.route.template.main.aca-order-details',\n path: 'aca-order-details/:orderId',\n loader: protectedLoader,\n handle: {\n roles: [acaCheckoutRole],\n },\n async lazy() {\n const module = await import(\n /* webpackChunkName: \"template-main\" */ './Main'\n );\n return { Component: module.default };\n },\n children: [\n {\n index: true,\n async lazy() {\n const module = await import(\n /* webpackChunkName: \"OrderHistoryDetails\" */ './components/OrderHistory/OrderHistoryDetails'\n );\n return { Component: module.default };\n },\n },\n ],\n },\n];\n\nexport default routes;\n"]}
@@ -11,4 +11,8 @@
11
11
  &__link {
12
12
  color: #002B2B;
13
13
  }
14
+ }
15
+
16
+ .divider {
17
+ border-top: 1px solid #002B2B;
14
18
  }
@@ -399,6 +399,7 @@ export interface AlacarteCheckoutClient {
399
399
  getCourseDetail: (courseKey: string) => Promise<CourseDetail | null>;
400
400
  getPlacedOrder: (biId: string) => Promise<PlacedOrderResult>;
401
401
  getOrderDates: (biId: string) => Promise<OrderDatesResult>;
402
+ getPurchaseHistory: () => Promise<any>;
402
403
  /** One-call place order — returns Stripe client secret (section 5a). */
403
404
  placeCheckoutOrder: (biId: string, billing?: AlacarteBillingAddress, paymentMethod?: AlacartePaymentMethod) => Promise<AlacartePlaceOrderApiResult>;
404
405
  capturePaypalOrder: (biId: string, paypalOrderId: string) => Promise<AlacartePaypalOrderResult>;
@@ -1 +1 @@
1
- {"version":3,"file":"alacarte.js","sourceRoot":"","sources":["../../src/types/alacarte.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * types/alacarte.ts — domain types for the à la carte checkout flow\n * (tCheckout / tCheckoutSelect / tCheckoutUpdate / tOwnedProducts), a separate\n * bounded context from the subscription checkout modeled in ../types.ts.\n * See alacarte-checkout-api.md and alacarte-owned-products-api.md at the repo\n * root for the full contract.\n */\nimport type { GqlRunner, CourseDetail } from '../types';\n\nexport type { GqlRunner };\n\n// --- Checkout status -----------------------------------------------------------\nexport type AlacarteStatus =\n | 'CART_CREATED'\n | 'CART_SANCTION_PASSED'\n | 'CART_PAYMENT_FAILED';\n\n// --- Money -----------------------------------------------------------------------\nexport interface AlacarteMoney {\n amount: number,\n currency: string,\n}\n\n// --- Checkout line (discriminated union on `kind`) --------------------------------\n/** Where the line discount came from — coupon code vs automatic offer (bundle / first-order). */\nexport type AlacarteDiscountSource = 'coupon' | 'automatic';\n\nexport interface AlacarteCourseLine {\n biiId: string,\n kind: 'course',\n courseName: string,\n courseUid: string,\n courseRunKey: string,\n /** The seat being bought on that run, e.g. \"verified\". */\n seatType: string | null,\n price: AlacarteMoney | null,\n /** Taken off by an applied coupon or automatic offer; absent when neither applies. */\n discount: AlacarteMoney | null,\n /** `\"coupon\"` or `\"automatic\"`; absent with no discount. */\n discountSource?: AlacarteDiscountSource | null,\n /** Discount name for the order summary, e.g. \"First order discount\". */\n discountName?: string | null,\n /** price less discount. */\n amountDue: AlacarteMoney | null,\n billingAddressSet: boolean,\n}\n\n/** Owned member course on a program checkout line (simpler than OwnedCourseRef). */\nexport interface AlacarteProgramOwnedCourse {\n courseId: string,\n name: string,\n via: 'order' | 'program' | 'enrollment',\n}\n\nexport interface AlacarteProgramLine {\n biiId: string,\n kind: 'program',\n programId: string,\n programName: string,\n price: AlacarteMoney | null,\n /** Taken off for member courses the learner already owns; absent when they own none. */\n deduction: AlacarteMoney | null,\n /**\n * Member courses the learner already owns — explains the deduction\n * (\"Already yours: …\"). Empty/absent when they own none.\n */\n ownedCourses?: AlacarteProgramOwnedCourse[] | null,\n /** Taken off by an applied coupon or automatic offer; absent when neither applies. */\n discount: AlacarteMoney | null,\n /** `\"coupon\"` or `\"automatic\"`; absent with no discount. */\n discountSource?: AlacarteDiscountSource | null,\n /** Discount name for the order summary, e.g. \"Bundle discount\". */\n discountName?: string | null,\n /** price less deduction less discount. */\n amountDue: AlacarteMoney | null,\n billingAddressSet: boolean,\n}\n\nexport type AlacarteLine = AlacarteCourseLine | AlacarteProgramLine;\n\n/** Present when the learner switches product while a coupon is on the cart. */\nexport type AlacarteCouponRecheckOutcome = 'kept' | 'rejected' | 'unverified';\n\nexport interface AlacarteCouponRecheck {\n outcome: AlacarteCouponRecheckOutcome,\n /** Coupon error code when outcome is `rejected`. */\n reason?: AlacarteErrorCode | string | null,\n}\n\n/** Last card-decline details; cleared when the next payment attempt starts. */\nexport interface AlacartePaymentDecline {\n code?: string | null,\n /** Ready to show the learner. */\n message: string,\n}\n\n/** Why a selection was refused — see section 5 of alacarte-checkout-api.md. */\nexport interface AlacarteBlocked {\n reason: 'ALREADY_OWNED' | 'NOT_PURCHASABLE',\n productId: string,\n kind: 'course' | 'program',\n /** ALREADY_OWNED only — where to send the learner (the learner dashboard). */\n route?: string,\n /** ALREADY_OWNED only. */\n ownedCourses?: OwnedCourseRef[],\n /** NOT_PURCHASABLE only — the catalog's reason, e.g. \"program_not_one_click_eligible\". */\n detail?: string,\n}\n\n/** Present when the price the learner saw (viewedPrice) differs from what checkout resolves now. */\nexport interface AlacartePriceChanged {\n viewed: AlacarteMoney,\n current: AlacarteMoney,\n}\n\n// --- Checkout envelope -------------------------------------------------------------\nexport interface AlacarteCheckout {\n biId: string,\n uid: string,\n status: AlacarteStatus,\n // Not always present in real responses (absent, not null, when no coupon was entered).\n couponCode?: string | null,\n termsAcceptedAt: string | null,\n acceptedAmount?: AlacarteMoney | null,\n priceAccepted?: boolean,\n /** True when this is the learner's first à-la-carte order (first-order offer applies). */\n firstOrder?: boolean,\n /** Present after the card was declined on the last attempt. */\n paymentDecline?: AlacartePaymentDecline | null,\n line: AlacarteLine | null,\n}\n\nexport type AlacarteErrorCode =\n | 'NOT_AUTHENTICATED'\n | 'RUN_KEY_REQUIRED'\n | 'CONFLICTING_SELECTION'\n | 'NOTHING_SELECTED'\n | 'COURSE_NOT_FOUND'\n | 'PROGRAM_NOT_FOUND'\n | 'CHECKOUT_NOT_FOUND'\n | 'CHECKOUT_NOT_YOURS'\n | 'PRODUCT_NOT_FOUND'\n // Blocked selection — details in the `blocked` envelope field.\n | 'ALREADY_OWNED'\n | 'NOT_PURCHASABLE'\n // No price can be resolved for the product right now.\n | 'PRICING_UNAVAILABLE'\n // Coupon errors — returned from tCheckoutUpdate, checkout left unchanged.\n | 'COUPON_INVALID'\n | 'COUPON_NOT_ACTIVE'\n | 'COUPON_EXPIRED'\n | 'COUPON_CAP_REACHED'\n | 'COUPON_PRODUCT_NOT_ELIGIBLE'\n | 'COUPON_PARTY_NOT_ELIGIBLE'\n | 'COUPON_PER_CUSTOMER_LIMIT'\n | 'COUPON_REJECTED'\n // tPlacedOrder errors.\n | 'ORDER_ID_REQUIRED'\n | 'ORDER_NOT_FOUND'\n | 'NOT_PLACED'\n | 'ORDER_READ_FAILED'\n // Payment is still being confirmed, including a 3D Secure check. Poll; not a failure yet.\n | 'PAYMENT_PENDING';\n\nexport interface AlacarteReplaced {\n courseName?: string,\n courseUid?: string,\n courseRunKey?: string,\n programId?: string,\n programName?: string,\n}\n\n/** Shared response envelope for tCheckout / tCheckoutSelect / tCheckoutUpdate. */\nexport interface AlacarteCheckoutResult {\n ok: boolean,\n checkout: AlacarteCheckout | null,\n replaced?: AlacarteReplaced,\n priceChanged?: AlacartePriceChanged,\n blocked?: AlacarteBlocked,\n /** Present when select switches product while a coupon was applied. */\n couponRecheck?: AlacarteCouponRecheck,\n error?: AlacarteErrorCode | string,\n}\n\n// --- Owned products ------------------------------------------------------------------\nexport type OwnedProductStatus = 'full' | 'partial' | 'none';\n\nexport interface OwnedCourseRef {\n courseId: string,\n via: 'order' | 'program' | 'enrollment',\n orderBiId?: string,\n enrollmentBiId?: string,\n programId?: string,\n name: string,\n slug: string,\n}\n\nexport interface OwnedProductPrice {\n full: number,\n deduction: number,\n amountDue: number,\n currency: string,\n}\n\nexport interface OwnedProduct {\n productId: string,\n kind: 'course' | 'program',\n name: string,\n slug: string,\n status: OwnedProductStatus,\n memberCount?: number,\n ownedCourses: OwnedCourseRef[],\n /** Pricing breakdown — available when the backend returns it (e.g. for\n * already-owned products where the checkout line is not created). */\n price?: OwnedProductPrice | null,\n}\n\nexport interface OwnedProductResult {\n ok: boolean,\n product: OwnedProduct | null,\n error?: AlacarteErrorCode | string,\n}\n\nexport interface OwnedProgramRef {\n programId: string,\n orderBiId: string,\n}\n\nexport interface OwnedProductsSummary {\n courses: OwnedCourseRef[],\n programs: OwnedProgramRef[],\n}\n\nexport interface AllOwnedProductsResult {\n ok: boolean,\n owned: OwnedProductsSummary | null,\n error?: AlacarteErrorCode | string,\n}\n\n// --- Program details (filterTwouProgram, by tProgramUuid) -----------------------------\nexport interface ProgramCourseRef {\n id: string,\n uid: string | null,\n maName: string | null,\n maDescription: string | null,\n tShortDescription: string | null,\n imageUrl: string | null,\n tBrandText: string | null,\n tOrgLogoUrl: string | null,\n tUrlCourse: string | null,\n tMarketingSlug: string | null,\n tStatus: { code: string } | null,\n}\n\nexport interface ProgramDetail {\n uid: string,\n tEffortLow: number | null,\n tEnrollmentCount: number | null,\n tMarketingSlug: string | null,\n tSkills: string[] | null,\n tFaq: string | null,\n tLevelType: string | null,\n tCourses: ProgramCourseRef[],\n}\n\n/** Course or program detail, depending on which was selected. */\nexport type ProductDetail = CourseDetail | ProgramDetail;\n\n// --- Banner details (PDP banner before checkout) ---------------------------------\n\nexport interface BannerCourseInstructor {\n tGivenName: string | null,\n tFamilyName: string | null,\n tOrganization: string | null,\n tInstructorUuid: string | null,\n tSortValue: number | null,\n}\n\nexport interface BannerCourseDetail {\n uid: string,\n id: string | null,\n maName: string,\n tEnrollmentCount: number | null,\n tAlacartePurchasable: boolean | null,\n tCourseKey: string | null,\n tShortDescription: string | null,\n maDescription: string | null,\n tBrandText: string | null,\n tOrgLogoUrl: string | null,\n imageUrl: string | null,\n tUrlCourse: string | null,\n tMarketingSlug: string | null,\n tLevelType: string | null,\n tPacingType: string | null,\n tDurationLow: number | null,\n tDurationHigh: number | null,\n tDurationUnit: string | null,\n tEffortLow: number | null,\n tEffortHigh: number | null,\n tEffortUnit: string | null,\n tLanguage: string | null,\n tExpectedLearningItems: string | null,\n tSkills: string[] | null,\n tPrerequisites: string | null,\n tSyllabus: string | null,\n tFaq: string | null,\n tTestimonials: string | null,\n tTranscriptLanguages: string[] | null,\n tInstructors: BannerCourseInstructor[],\n}\n\nexport interface BannerProgramCourse {\n id: string,\n uid: string | null,\n maName: string | null,\n tShortDescription: string | null,\n maDescription: string | null,\n tBrandText: string | null,\n tOrgLogoUrl: string | null,\n tCourseKey: string | null,\n imageUrl: string | null,\n tUrlCourse: string | null,\n tMarketingSlug: string | null,\n tStatus: { code: string } | null,\n}\n\nexport interface BannerProgramDetail {\n uid: string,\n tEffortLow: number | null,\n tEnrollmentCount: number | null,\n tMarketingSlug: string | null,\n tAlacartePurchasable: boolean | null,\n tSkills: string[] | null,\n tFaq: string | null,\n tLevelType: string | null,\n imageUrl: string | null,\n tBannerImageUrl: string | null,\n tCourses: BannerProgramCourse[],\n}\n\nexport type BannerData =\n | { kind: 'course', data: BannerCourseDetail }\n | { kind: 'program', data: BannerProgramDetail };\n\n// --- Placed order (tPlacedOrder, confirmation page) -------------------------------------\nexport interface PlacedOrderAmounts {\n price: number,\n deduction: number,\n discount: number,\n paid: number,\n currency: string,\n}\n\nexport interface PlacedOrderLine {\n lineId: string,\n kind: 'course' | 'program',\n productId?: string,\n productUid?: string,\n name: string,\n /** Present on course lines and on each course line of a program order. */\n courseRunKey?: string | null,\n seatType?: string | null,\n /** Set on every line of a program order (one line per course bought). */\n programId?: string,\n bundleRef?: string,\n discountRuleId?: string,\n amounts: PlacedOrderAmounts,\n}\n\nexport interface PlacedOrder {\n orderId: string,\n orderNumber: string,\n status: string,\n couponCode: string | null,\n paymentMethod: { brand: string, last4: string } | null,\n lines: PlacedOrderLine[],\n totals: PlacedOrderAmounts,\n}\n\nexport interface PlacedOrderResult {\n ok: boolean,\n order: PlacedOrder | null,\n error?: AlacarteErrorCode | string,\n}\n\n/** getTwouOrder(biId) — order placement/creation timestamps, ISO strings. */\nexport interface OrderDates {\n tPlacedAt: string | null,\n biCreatedAt: string | null,\n}\n\nexport interface OrderDatesResult {\n ok: boolean,\n dates: OrderDates | null,\n}\n\n/** Billing for tCheckoutPlaceOrder. Only `country` (ISO-2) is required;\n * name/line/city/etc. are optional when the UI doesn't collect a full address. */\nexport interface AlacarteBillingAddress {\n country: string,\n firstName?: string,\n lastName?: string,\n line1?: string,\n line2?: string,\n city?: string,\n state?: string,\n postcode?: string,\n}\n\n/** Stripe payment details returned by a successful tCheckoutPlaceOrder. */\nexport interface AlacartePlaceOrderPayment {\n clientSecret: string,\n paymentIntentId: string,\n /** Amount in cents. */\n amount: number,\n currency: string,\n}\n\nexport type AlacartePlaceOrderErrorCode =\n | 'TERMS_NOT_ACCEPTED'\n | 'PRICE_NOT_ACCEPTED'\n | 'BILLING_ADDRESS_REQUIRED'\n | 'SANCTIONS_BLOCKED'\n | 'COUPON_UNAVAILABLE'\n | 'PAYMENT_NOT_STARTED'\n | 'CHECKOUT_NOT_FOUND'\n | 'NOT_AUTHENTICATED';\n\n/** PayPal order returned by tCheckoutPlaceOrder(paymentMethod: \"PAYPAL\"). */\nexport interface AlacartePaypalPayment {\n paypalOrderId: string,\n /** Amount in cents. */\n amount: number,\n currency: string,\n}\n\n/** paymentMethod argument of tCheckoutPlaceOrder — omitted means STRIPE. */\nexport type AlacartePaymentMethod = 'STRIPE' | 'PAYPAL';\n\n/** tCheckoutCapturePaypalOrder / tCheckoutCancelPaypalOrder response. */\nexport interface AlacartePaypalOrderResult {\n ok: boolean,\n status?: 'COMPLETED' | 'PENDING' | 'FAILED' | 'CANCELLED',\n orderNumber?: string,\n error?: string,\n}\n\nexport interface AlacartePlaceOrderApiResult {\n ok: boolean,\n payment: AlacartePlaceOrderPayment | null,\n /** Set instead of `payment` when placed with paymentMethod \"PAYPAL\". */\n paypal?: AlacartePaypalPayment | null,\n /** Present on some failures (e.g. PRICE_NOT_ACCEPTED, COUPON_UNAVAILABLE). */\n checkout?: AlacarteCheckout | null,\n error?: AlacartePlaceOrderErrorCode | string,\n}\n\n// --- Product selector (derived from query params) --------------------------------------\nexport type ProductSelector =\n | { kind: 'course', courseUid: string, runKey: string }\n | { kind: 'program', programUid: string }\n | { kind: 'invalid' }\n | { kind: 'none' };\n\n// --- Client surface --------------------------------------------------------------------\nexport interface AlacarteCheckoutClient {\n gql: GqlRunner,\n setToken: (token: string) => void,\n getCheckout: () => Promise<AlacarteCheckoutResult>,\n /** viewedPrice: the amount the learner saw on the page before checkout (USD, before any coupon). */\n selectCourse: (courseUid: string, runKey: string, viewedPrice?: number) => Promise<AlacarteCheckoutResult>,\n selectProgram: (programUid: string, viewedPrice?: number) => Promise<AlacarteCheckoutResult>,\n updateCheckout: (args: {\n biId?: string, couponCode?: string, termsAccepted?: boolean, acceptPrice?: boolean,\n }) => Promise<AlacarteCheckoutResult>,\n getOwnedProduct: (productId: string) => Promise<OwnedProductResult>,\n getAllOwnedProducts: () => Promise<AllOwnedProductsResult>,\n getProgramDetail: (programUid: string) => Promise<ProgramDetail | null>,\n getCourseDetail: (courseKey: string) => Promise<CourseDetail | null>,\n getPlacedOrder: (biId: string) => Promise<PlacedOrderResult>,\n getOrderDates: (biId: string) => Promise<OrderDatesResult>,\n /** One-call place order — returns Stripe client secret (section 5a). */\n placeCheckoutOrder: (\n biId: string,\n billing?: AlacarteBillingAddress,\n paymentMethod?: AlacartePaymentMethod,\n ) => Promise<AlacartePlaceOrderApiResult>,\n capturePaypalOrder: (biId: string, paypalOrderId: string) => Promise<AlacartePaypalOrderResult>,\n cancelPaypalOrder: (biId: string, paypalOrderId: string) => Promise<AlacartePaypalOrderResult>,\n}\n"]}
1
+ {"version":3,"file":"alacarte.js","sourceRoot":"","sources":["../../src/types/alacarte.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * types/alacarte.ts — domain types for the à la carte checkout flow\n * (tCheckout / tCheckoutSelect / tCheckoutUpdate / tOwnedProducts), a separate\n * bounded context from the subscription checkout modeled in ../types.ts.\n * See alacarte-checkout-api.md and alacarte-owned-products-api.md at the repo\n * root for the full contract.\n */\nimport type { GqlRunner, CourseDetail } from '../types';\n\nexport type { GqlRunner };\n\n// --- Checkout status -----------------------------------------------------------\nexport type AlacarteStatus =\n | 'CART_CREATED'\n | 'CART_SANCTION_PASSED'\n | 'CART_PAYMENT_FAILED';\n\n// --- Money -----------------------------------------------------------------------\nexport interface AlacarteMoney {\n amount: number,\n currency: string,\n}\n\n// --- Checkout line (discriminated union on `kind`) --------------------------------\n/** Where the line discount came from — coupon code vs automatic offer (bundle / first-order). */\nexport type AlacarteDiscountSource = 'coupon' | 'automatic';\n\nexport interface AlacarteCourseLine {\n biiId: string,\n kind: 'course',\n courseName: string,\n courseUid: string,\n courseRunKey: string,\n /** The seat being bought on that run, e.g. \"verified\". */\n seatType: string | null,\n price: AlacarteMoney | null,\n /** Taken off by an applied coupon or automatic offer; absent when neither applies. */\n discount: AlacarteMoney | null,\n /** `\"coupon\"` or `\"automatic\"`; absent with no discount. */\n discountSource?: AlacarteDiscountSource | null,\n /** Discount name for the order summary, e.g. \"First order discount\". */\n discountName?: string | null,\n /** price less discount. */\n amountDue: AlacarteMoney | null,\n billingAddressSet: boolean,\n}\n\n/** Owned member course on a program checkout line (simpler than OwnedCourseRef). */\nexport interface AlacarteProgramOwnedCourse {\n courseId: string,\n name: string,\n via: 'order' | 'program' | 'enrollment',\n}\n\nexport interface AlacarteProgramLine {\n biiId: string,\n kind: 'program',\n programId: string,\n programName: string,\n price: AlacarteMoney | null,\n /** Taken off for member courses the learner already owns; absent when they own none. */\n deduction: AlacarteMoney | null,\n /**\n * Member courses the learner already owns — explains the deduction\n * (\"Already yours: …\"). Empty/absent when they own none.\n */\n ownedCourses?: AlacarteProgramOwnedCourse[] | null,\n /** Taken off by an applied coupon or automatic offer; absent when neither applies. */\n discount: AlacarteMoney | null,\n /** `\"coupon\"` or `\"automatic\"`; absent with no discount. */\n discountSource?: AlacarteDiscountSource | null,\n /** Discount name for the order summary, e.g. \"Bundle discount\". */\n discountName?: string | null,\n /** price less deduction less discount. */\n amountDue: AlacarteMoney | null,\n billingAddressSet: boolean,\n}\n\nexport type AlacarteLine = AlacarteCourseLine | AlacarteProgramLine;\n\n/** Present when the learner switches product while a coupon is on the cart. */\nexport type AlacarteCouponRecheckOutcome = 'kept' | 'rejected' | 'unverified';\n\nexport interface AlacarteCouponRecheck {\n outcome: AlacarteCouponRecheckOutcome,\n /** Coupon error code when outcome is `rejected`. */\n reason?: AlacarteErrorCode | string | null,\n}\n\n/** Last card-decline details; cleared when the next payment attempt starts. */\nexport interface AlacartePaymentDecline {\n code?: string | null,\n /** Ready to show the learner. */\n message: string,\n}\n\n/** Why a selection was refused — see section 5 of alacarte-checkout-api.md. */\nexport interface AlacarteBlocked {\n reason: 'ALREADY_OWNED' | 'NOT_PURCHASABLE',\n productId: string,\n kind: 'course' | 'program',\n /** ALREADY_OWNED only — where to send the learner (the learner dashboard). */\n route?: string,\n /** ALREADY_OWNED only. */\n ownedCourses?: OwnedCourseRef[],\n /** NOT_PURCHASABLE only — the catalog's reason, e.g. \"program_not_one_click_eligible\". */\n detail?: string,\n}\n\n/** Present when the price the learner saw (viewedPrice) differs from what checkout resolves now. */\nexport interface AlacartePriceChanged {\n viewed: AlacarteMoney,\n current: AlacarteMoney,\n}\n\n// --- Checkout envelope -------------------------------------------------------------\nexport interface AlacarteCheckout {\n biId: string,\n uid: string,\n status: AlacarteStatus,\n // Not always present in real responses (absent, not null, when no coupon was entered).\n couponCode?: string | null,\n termsAcceptedAt: string | null,\n acceptedAmount?: AlacarteMoney | null,\n priceAccepted?: boolean,\n /** True when this is the learner's first à-la-carte order (first-order offer applies). */\n firstOrder?: boolean,\n /** Present after the card was declined on the last attempt. */\n paymentDecline?: AlacartePaymentDecline | null,\n line: AlacarteLine | null,\n}\n\nexport type AlacarteErrorCode =\n | 'NOT_AUTHENTICATED'\n | 'RUN_KEY_REQUIRED'\n | 'CONFLICTING_SELECTION'\n | 'NOTHING_SELECTED'\n | 'COURSE_NOT_FOUND'\n | 'PROGRAM_NOT_FOUND'\n | 'CHECKOUT_NOT_FOUND'\n | 'CHECKOUT_NOT_YOURS'\n | 'PRODUCT_NOT_FOUND'\n // Blocked selection — details in the `blocked` envelope field.\n | 'ALREADY_OWNED'\n | 'NOT_PURCHASABLE'\n // No price can be resolved for the product right now.\n | 'PRICING_UNAVAILABLE'\n // Coupon errors — returned from tCheckoutUpdate, checkout left unchanged.\n | 'COUPON_INVALID'\n | 'COUPON_NOT_ACTIVE'\n | 'COUPON_EXPIRED'\n | 'COUPON_CAP_REACHED'\n | 'COUPON_PRODUCT_NOT_ELIGIBLE'\n | 'COUPON_PARTY_NOT_ELIGIBLE'\n | 'COUPON_PER_CUSTOMER_LIMIT'\n | 'COUPON_REJECTED'\n // tPlacedOrder errors.\n | 'ORDER_ID_REQUIRED'\n | 'ORDER_NOT_FOUND'\n | 'NOT_PLACED'\n | 'ORDER_READ_FAILED'\n // Payment is still being confirmed, including a 3D Secure check. Poll; not a failure yet.\n | 'PAYMENT_PENDING';\n\nexport interface AlacarteReplaced {\n courseName?: string,\n courseUid?: string,\n courseRunKey?: string,\n programId?: string,\n programName?: string,\n}\n\n/** Shared response envelope for tCheckout / tCheckoutSelect / tCheckoutUpdate. */\nexport interface AlacarteCheckoutResult {\n ok: boolean,\n checkout: AlacarteCheckout | null,\n replaced?: AlacarteReplaced,\n priceChanged?: AlacartePriceChanged,\n blocked?: AlacarteBlocked,\n /** Present when select switches product while a coupon was applied. */\n couponRecheck?: AlacarteCouponRecheck,\n error?: AlacarteErrorCode | string,\n}\n\n// --- Owned products ------------------------------------------------------------------\nexport type OwnedProductStatus = 'full' | 'partial' | 'none';\n\nexport interface OwnedCourseRef {\n courseId: string,\n via: 'order' | 'program' | 'enrollment',\n orderBiId?: string,\n enrollmentBiId?: string,\n programId?: string,\n name: string,\n slug: string,\n}\n\nexport interface OwnedProductPrice {\n full: number,\n deduction: number,\n amountDue: number,\n currency: string,\n}\n\nexport interface OwnedProduct {\n productId: string,\n kind: 'course' | 'program',\n name: string,\n slug: string,\n status: OwnedProductStatus,\n memberCount?: number,\n ownedCourses: OwnedCourseRef[],\n /** Pricing breakdown — available when the backend returns it (e.g. for\n * already-owned products where the checkout line is not created). */\n price?: OwnedProductPrice | null,\n}\n\nexport interface OwnedProductResult {\n ok: boolean,\n product: OwnedProduct | null,\n error?: AlacarteErrorCode | string,\n}\n\nexport interface OwnedProgramRef {\n programId: string,\n orderBiId: string,\n}\n\nexport interface OwnedProductsSummary {\n courses: OwnedCourseRef[],\n programs: OwnedProgramRef[],\n}\n\nexport interface AllOwnedProductsResult {\n ok: boolean,\n owned: OwnedProductsSummary | null,\n error?: AlacarteErrorCode | string,\n}\n\n// --- Program details (filterTwouProgram, by tProgramUuid) -----------------------------\nexport interface ProgramCourseRef {\n id: string,\n uid: string | null,\n maName: string | null,\n maDescription: string | null,\n tShortDescription: string | null,\n imageUrl: string | null,\n tBrandText: string | null,\n tOrgLogoUrl: string | null,\n tUrlCourse: string | null,\n tMarketingSlug: string | null,\n tStatus: { code: string } | null,\n}\n\nexport interface ProgramDetail {\n uid: string,\n tEffortLow: number | null,\n tEnrollmentCount: number | null,\n tMarketingSlug: string | null,\n tSkills: string[] | null,\n tFaq: string | null,\n tLevelType: string | null,\n tCourses: ProgramCourseRef[],\n}\n\n/** Course or program detail, depending on which was selected. */\nexport type ProductDetail = CourseDetail | ProgramDetail;\n\n// --- Banner details (PDP banner before checkout) ---------------------------------\n\nexport interface BannerCourseInstructor {\n tGivenName: string | null,\n tFamilyName: string | null,\n tOrganization: string | null,\n tInstructorUuid: string | null,\n tSortValue: number | null,\n}\n\nexport interface BannerCourseDetail {\n uid: string,\n id: string | null,\n maName: string,\n tEnrollmentCount: number | null,\n tAlacartePurchasable: boolean | null,\n tCourseKey: string | null,\n tShortDescription: string | null,\n maDescription: string | null,\n tBrandText: string | null,\n tOrgLogoUrl: string | null,\n imageUrl: string | null,\n tUrlCourse: string | null,\n tMarketingSlug: string | null,\n tLevelType: string | null,\n tPacingType: string | null,\n tDurationLow: number | null,\n tDurationHigh: number | null,\n tDurationUnit: string | null,\n tEffortLow: number | null,\n tEffortHigh: number | null,\n tEffortUnit: string | null,\n tLanguage: string | null,\n tExpectedLearningItems: string | null,\n tSkills: string[] | null,\n tPrerequisites: string | null,\n tSyllabus: string | null,\n tFaq: string | null,\n tTestimonials: string | null,\n tTranscriptLanguages: string[] | null,\n tInstructors: BannerCourseInstructor[],\n}\n\nexport interface BannerProgramCourse {\n id: string,\n uid: string | null,\n maName: string | null,\n tShortDescription: string | null,\n maDescription: string | null,\n tBrandText: string | null,\n tOrgLogoUrl: string | null,\n tCourseKey: string | null,\n imageUrl: string | null,\n tUrlCourse: string | null,\n tMarketingSlug: string | null,\n tStatus: { code: string } | null,\n}\n\nexport interface BannerProgramDetail {\n uid: string,\n tEffortLow: number | null,\n tEnrollmentCount: number | null,\n tMarketingSlug: string | null,\n tAlacartePurchasable: boolean | null,\n tSkills: string[] | null,\n tFaq: string | null,\n tLevelType: string | null,\n imageUrl: string | null,\n tBannerImageUrl: string | null,\n tCourses: BannerProgramCourse[],\n}\n\nexport type BannerData =\n | { kind: 'course', data: BannerCourseDetail }\n | { kind: 'program', data: BannerProgramDetail };\n\n// --- Placed order (tPlacedOrder, confirmation page) -------------------------------------\nexport interface PlacedOrderAmounts {\n price: number,\n deduction: number,\n discount: number,\n paid: number,\n currency: string,\n}\n\nexport interface PlacedOrderLine {\n lineId: string,\n kind: 'course' | 'program',\n productId?: string,\n productUid?: string,\n name: string,\n /** Present on course lines and on each course line of a program order. */\n courseRunKey?: string | null,\n seatType?: string | null,\n /** Set on every line of a program order (one line per course bought). */\n programId?: string,\n bundleRef?: string,\n discountRuleId?: string,\n amounts: PlacedOrderAmounts,\n}\n\nexport interface PlacedOrder {\n orderId: string,\n orderNumber: string,\n status: string,\n couponCode: string | null,\n paymentMethod: { brand: string, last4: string } | null,\n lines: PlacedOrderLine[],\n totals: PlacedOrderAmounts,\n}\n\nexport interface PlacedOrderResult {\n ok: boolean,\n order: PlacedOrder | null,\n error?: AlacarteErrorCode | string,\n}\n\n/** getTwouOrder(biId) — order placement/creation timestamps, ISO strings. */\nexport interface OrderDates {\n tPlacedAt: string | null,\n biCreatedAt: string | null,\n}\n\nexport interface OrderDatesResult {\n ok: boolean,\n dates: OrderDates | null,\n}\n\n/** Billing for tCheckoutPlaceOrder. Only `country` (ISO-2) is required;\n * name/line/city/etc. are optional when the UI doesn't collect a full address. */\nexport interface AlacarteBillingAddress {\n country: string,\n firstName?: string,\n lastName?: string,\n line1?: string,\n line2?: string,\n city?: string,\n state?: string,\n postcode?: string,\n}\n\n/** Stripe payment details returned by a successful tCheckoutPlaceOrder. */\nexport interface AlacartePlaceOrderPayment {\n clientSecret: string,\n paymentIntentId: string,\n /** Amount in cents. */\n amount: number,\n currency: string,\n}\n\nexport type AlacartePlaceOrderErrorCode =\n | 'TERMS_NOT_ACCEPTED'\n | 'PRICE_NOT_ACCEPTED'\n | 'BILLING_ADDRESS_REQUIRED'\n | 'SANCTIONS_BLOCKED'\n | 'COUPON_UNAVAILABLE'\n | 'PAYMENT_NOT_STARTED'\n | 'CHECKOUT_NOT_FOUND'\n | 'NOT_AUTHENTICATED';\n\n/** PayPal order returned by tCheckoutPlaceOrder(paymentMethod: \"PAYPAL\"). */\nexport interface AlacartePaypalPayment {\n paypalOrderId: string,\n /** Amount in cents. */\n amount: number,\n currency: string,\n}\n\n/** paymentMethod argument of tCheckoutPlaceOrder — omitted means STRIPE. */\nexport type AlacartePaymentMethod = 'STRIPE' | 'PAYPAL';\n\n/** tCheckoutCapturePaypalOrder / tCheckoutCancelPaypalOrder response. */\nexport interface AlacartePaypalOrderResult {\n ok: boolean,\n status?: 'COMPLETED' | 'PENDING' | 'FAILED' | 'CANCELLED',\n orderNumber?: string,\n error?: string,\n}\n\nexport interface AlacartePlaceOrderApiResult {\n ok: boolean,\n payment: AlacartePlaceOrderPayment | null,\n /** Set instead of `payment` when placed with paymentMethod \"PAYPAL\". */\n paypal?: AlacartePaypalPayment | null,\n /** Present on some failures (e.g. PRICE_NOT_ACCEPTED, COUPON_UNAVAILABLE). */\n checkout?: AlacarteCheckout | null,\n error?: AlacartePlaceOrderErrorCode | string,\n}\n\n// --- Product selector (derived from query params) --------------------------------------\nexport type ProductSelector =\n | { kind: 'course', courseUid: string, runKey: string }\n | { kind: 'program', programUid: string }\n | { kind: 'invalid' }\n | { kind: 'none' };\n\n// --- Client surface --------------------------------------------------------------------\nexport interface AlacarteCheckoutClient {\n gql: GqlRunner,\n setToken: (token: string) => void,\n getCheckout: () => Promise<AlacarteCheckoutResult>,\n /** viewedPrice: the amount the learner saw on the page before checkout (USD, before any coupon). */\n selectCourse: (courseUid: string, runKey: string, viewedPrice?: number) => Promise<AlacarteCheckoutResult>,\n selectProgram: (programUid: string, viewedPrice?: number) => Promise<AlacarteCheckoutResult>,\n updateCheckout: (args: {\n biId?: string, couponCode?: string, termsAccepted?: boolean, acceptPrice?: boolean,\n }) => Promise<AlacarteCheckoutResult>,\n getOwnedProduct: (productId: string) => Promise<OwnedProductResult>,\n getAllOwnedProducts: () => Promise<AllOwnedProductsResult>,\n getProgramDetail: (programUid: string) => Promise<ProgramDetail | null>,\n getCourseDetail: (courseKey: string) => Promise<CourseDetail | null>,\n getPlacedOrder: (biId: string) => Promise<PlacedOrderResult>,\n getOrderDates: (biId: string) => Promise<OrderDatesResult>,\n getPurchaseHistory: () => Promise<any>,\n /** One-call place order — returns Stripe client secret (section 5a). */\n placeCheckoutOrder: (\n biId: string,\n billing?: AlacarteBillingAddress,\n paymentMethod?: AlacartePaymentMethod,\n ) => Promise<AlacartePlaceOrderApiResult>,\n capturePaypalOrder: (biId: string, paypalOrderId: string) => Promise<AlacartePaypalOrderResult>,\n cancelPaypalOrder: (biId: string, paypalOrderId: string) => Promise<AlacartePaypalOrderResult>,\n}\n"]}
@@ -0,0 +1,14 @@
1
+ export interface PurchaseHistoryItem {
2
+ orderId: string;
3
+ orderNumber: string;
4
+ purchasedAt: string;
5
+ paymentIntentId?: string;
6
+ name: string;
7
+ total: {
8
+ amount: number;
9
+ currency: string;
10
+ };
11
+ }
12
+ export interface OrdersListProps {
13
+ orders: PurchaseHistoryItem[];
14
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=orderHistory.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"orderHistory.js","sourceRoot":"","sources":["../../src/types/orderHistory.ts"],"names":[],"mappings":"","sourcesContent":["export interface PurchaseHistoryItem {\n orderId: string,\n orderNumber: string,\n purchasedAt: string,\n paymentIntentId?: string,\n name: string,\n total: {\n amount: number,\n currency: string,\n },\n}\n\nexport interface OrdersListProps {\n orders: PurchaseHistoryItem[],\n}\n"]}
@@ -26,6 +26,8 @@ export declare function capturePaypalOrder(gql: GqlRunner, biId: string, paypalO
26
26
  export declare function cancelPaypalOrder(gql: GqlRunner, biId: string, paypalOrderId: string): Promise<AlacartePaypalOrderResult>;
27
27
  export declare function getOwnedProduct(gql: GqlRunner, productId: string): Promise<OwnedProductResult>;
28
28
  export declare function getAllOwnedProducts(gql: GqlRunner): Promise<AllOwnedProductsResult>;
29
+ /** Reads the learner's purchase-history payload for the course payments tab. */
30
+ export declare function getPurchaseHistory(gql: GqlRunner): Promise<any>;
29
31
  /** `tCourseRuns` returns every run it knows. Compliance needs the run the
30
32
  * learner would actually buy: published runs when any exist, otherwise
31
33
  * whatever keys came back so a course is not dropped. */
@@ -17,7 +17,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
17
17
  * itself and propagate unchanged, exactly as with every other function in
18
18
  * bootstrapApi.ts/cartApi.ts.
19
19
  */
20
- import { GET_ALACARTE_CHECKOUT, SELECT_ALACARTE_PRODUCT, UPDATE_ALACARTE_CHECKOUT, GET_OWNED_PRODUCT, GET_ALL_OWNED_PRODUCTS, GET_PROGRAM_DETAIL, GET_PROGRAM_COURSE_IDS, GET_PLACED_ORDER, GET_ORDER_DATES, PLACE_ALACARTE_ORDER, GET_BANNER_COURSE_DETAIL, GET_BANNER_PROGRAM_DETAIL, CAPTURE_PAYPAL_ORDER, CANCEL_PAYPAL_ORDER, } from './alacarteQueries';
20
+ import { GET_ALACARTE_CHECKOUT, SELECT_ALACARTE_PRODUCT, UPDATE_ALACARTE_CHECKOUT, GET_OWNED_PRODUCT, GET_ALL_OWNED_PRODUCTS, GET_PROGRAM_DETAIL, GET_PROGRAM_COURSE_IDS, GET_PLACED_ORDER, GET_ORDER_DATES, GET_PURCHASE_HISTORY, PLACE_ALACARTE_ORDER, GET_BANNER_COURSE_DETAIL, GET_BANNER_PROGRAM_DETAIL, CAPTURE_PAYPAL_ORDER, CANCEL_PAYPAL_ORDER, } from './alacarteQueries';
21
21
  function normalizeCheckoutResult(payload) {
22
22
  var _a;
23
23
  return {
@@ -177,6 +177,14 @@ export function getAllOwnedProducts(gql) {
177
177
  };
178
178
  });
179
179
  }
180
+ /** Reads the learner's purchase-history payload for the course payments tab. */
181
+ export function getPurchaseHistory(gql) {
182
+ return __awaiter(this, void 0, void 0, function* () {
183
+ var _a;
184
+ const data = yield gql(GET_PURCHASE_HISTORY);
185
+ return (_a = data === null || data === void 0 ? void 0 : data.tOrderHistory) !== null && _a !== void 0 ? _a : null;
186
+ });
187
+ }
180
188
  function programUuidFilter(programUid) {
181
189
  return `tProgramUu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MAAA,IAAI,CAAC,gBAAgB,mCAAI,IAAI;YAC/C,cAAc,EAAE,MAAA,IAAI,CAAC,cAAc,mCAAI,IAAI;YAC3C,oBAAoB,EAAE,MAAA,IAAI,CAAC,oBAAoB,mCAAI,IAAI;YACvD,OAAO,EAAE,MAAA,IAAI,CAAC,OAAO,mCAAI,IAAI;YAC7B,IAAI,EAAE,MAAA,IAAI,CAAC,IAAI,mCAAI,IAAI;YACvB,UAAU,EAAE,MAAA,IAAI,CAAC,UAAU,mCAAI,IAAI;YACnC,QAAQ,EAAE,MAAA,IAAI,CAAC,QAAQ,mCAAI,IAAI;YAC/B,eAAe,EAAE,MAAA,IAAI,CAAC,eAAe,mCAAI,IAAI;YAC7C,QAAQ;SACT,CAAC;IACJ,CAAC;CAAA","sourcesContent":["/**\n * utils/alacarteApi.ts — à la carte checkout + owned-products operations.\n *\n * Convention: every function here returns the `{ ok, ... }` envelope as-is.\n * `ok: false` is a normal domain outcome (see alacarte-*-api.md `error` table)\n * and must be branched on by the caller — it is NOT thrown here. Transport\n * errors (missing token, HTTP 401, GraphQL errors[]) are thrown by gql()\n * itself and propagate unchanged, exactly as with every other function in\n * bootstrapApi.ts/cartApi.ts.\n */\nimport {\n GET_ALACARTE_CHECKOUT, SELECT_ALACARTE_PRODUCT, UPDATE_ALACARTE_CHECKOUT,\n GET_OWNED_PRODUCT, GET_ALL_OWNED_PRODUCTS, GET_PROGRAM_DETAIL, GET_PROGRAM_COURSE_IDS,\n GET_PLACED_ORDER,\n GET_ORDER_DATES, PLACE_ALACARTE_ORDER, GET_BANNER_COURSE_DETAIL, GET_BANNER_PROGRAM_DETAIL,\n CAPTURE_PAYPAL_ORDER, CANCEL_PAYPAL_ORDER,\n} from './alacarteQueries';\nimport type {\n GqlRunner, AlacarteCheckoutResult, OwnedProductResult, AllOwnedProductsResult,\n ProgramDetail, ProgramCourseRef, PlacedOrderResult, OrderDatesResult,\n AlacarteBillingAddress, AlacartePlaceOrderApiResult, AlacartePaymentMethod, AlacartePaypalOrderResult,\n BannerCourseDetail, BannerCourseInstructor, BannerProgramDetail, BannerProgramCourse,\n} from '../types/alacarte';\n\nfunction normalizeCheckoutResult(payload: any): AlacarteCheckoutResult {\n return {\n ok: payload?.ok === true,\n checkout: payload?.checkout ?? null,\n replaced: payload?.replaced,\n priceChanged: payload?.priceChanged,\n blocked: payload?.blocked,\n couponRecheck: payload?.couponRecheck,\n error: payload?.error,\n };\n}\n\nexport async function getCheckout(gql: GqlRunner): Promise<AlacarteCheckoutResult> {\n const data = await gql(GET_ALACARTE_CHECKOUT);\n return normalizeCheckoutResult(data?.tCheckout);\n}\n\nexport async function selectCourse(\n gql: GqlRunner, courseUid: string, runKey: string, viewedPrice?: number,\n): Promise<AlacarteCheckoutResult> {\n const data = await gql(SELECT_ALACARTE_PRODUCT, { courseUid, runKey, viewedPrice });\n return normalizeCheckoutResult(data?.tCheckoutSelect);\n}\n\nexport async function selectProgram(\n gql: GqlRunner, programUid: string, viewedPrice?: number,\n): Promise<AlacarteCheckoutResult> {\n const data = await gql(SELECT_ALACARTE_PRODUCT, { programUid, viewedPrice });\n return normalizeCheckoutResult(data?.tCheckoutSelect);\n}\n\nexport async function updateCheckout(\n gql: GqlRunner,\n args: { biId?: string, couponCode?: string, termsAccepted?: boolean, acceptPrice?: boolean },\n): Promise<AlacarteCheckoutResult> {\n const data = await gql(UPDATE_ALACARTE_CHECKOUT, args);\n return normalizeCheckoutResult(data?.tCheckoutUpdate);\n}\n\n/** Reads the placed order for the confirmation page — never re-priced. */\nexport async function getPlacedOrder(gql: GqlRunner, biId: string): Promise<PlacedOrderResult> {\n const data = await gql(GET_PLACED_ORDER, { biId });\n const payload = data?.tPlacedOrder;\n return {\n ok: payload?.ok === true,\n order: payload?.order ?? null,\n error: payload?.error,\n };\n}\n\n/** Reads the order's placement/creation timestamps for the confirmation page. */\nexport async function getOrderDates(gql: GqlRunner, biId: string): Promise<OrderDatesResult> {\n const data = await gql(GET_ORDER_DATES, { biId });\n const payload = data?.getTwouOrder;\n return {\n ok: !!payload,\n dates: payload\n ? { tPlacedAt: payload.tPlacedAt ?? null, biCreatedAt: payload.biCreatedAt ?? null }\n : null,\n };\n}\n\n/**\n * One-call place order (section 5a). Runs sanctions + payment start and\n * returns the Stripe client secret.\n *\n * Only `country` (two-letter ISO) is required. Other address fields are\n * optional — the checkout UI also collects country-specific fields (ALC-177).\n */\nexport async function placeCheckoutOrder(\n gql: GqlRunner,\n biId: string,\n billing?: AlacarteBillingAddress,\n paymentMethod?: AlacartePaymentMethod,\n): Promise<AlacartePlaceOrderApiResult> {\n const optional = (value?: string): string | undefined => {\n const trimmed = value?.trim();\n return trimmed ? trimmed : undefined;\n };\n\n const data = await gql(PLACE_ALACARTE_ORDER, {\n biId,\n paymentMethod,\n country: billing?.country?.trim().toUpperCase() || undefined,\n firstName: optional(billing?.firstName),\n lastName: optional(billing?.lastName),\n line1: optional(billing?.line1),\n line2: optional(billing?.line2),\n city: optional(billing?.city),\n state: optional(billing?.state),\n postcode: optional(billing?.postcode),\n });\n const payload = data?.tCheckoutPlaceOrder;\n const payment = payload?.payment;\n return {\n ok: payload?.ok === true,\n payment: payment?.clientSecret\n ? {\n clientSecret: payment.clientSecret,\n paymentIntentId: payment.paymentIntentId ?? '',\n amount: payment.amount ?? 0,\n currency: payment.currency ?? 'usd',\n }\n : null,\n paypal: payment?.paypalOrderId\n ? {\n paypalOrderId: payment.paypalOrderId,\n amount: payment.amount ?? 0,\n currency: payment.currency ?? 'usd',\n }\n : null,\n checkout: payload?.checkout ?? null,\n error: payload?.error,\n };\n}\n\nfunction normalizePaypalOrderResult(payload: any): AlacartePaypalOrderResult {\n return {\n ok: payload?.ok === true,\n status: payload?.status,\n orderNumber: payload?.orderNumber,\n error: payload?.error,\n };\n}\n\n/** Captures the PayPal order the learner approved — places the order on COMPLETED. */\nexport async function capturePaypalOrder(\n gql: GqlRunner, biId: string, paypalOrderId: string,\n): Promise<AlacartePaypalOrderResult> {\n const data = await gql(CAPTURE_PAYPAL_ORDER, { biId, paypalOrderId });\n return normalizePaypalOrderResult(data?.tCheckoutCapturePaypalOrder);\n}\n\n/** Abandons an unapproved PayPal order so the checkout can be paid again. */\nexport async function cancelPaypalOrder(\n gql: GqlRunner, biId: string, paypalOrderId: string,\n): Promise<AlacartePaypalOrderResult> {\n const data = await gql(CANCEL_PAYPAL_ORDER, { biId, paypalOrderId });\n return normalizePaypalOrderResult(data?.tCheckoutCancelPaypalOrder);\n}\n\nexport async function getOwnedProduct(gql: GqlRunner, productId: string): Promise<OwnedProductResult> {\n const data = await gql(GET_OWNED_PRODUCT, { productId });\n const payload = data?.tOwnedProducts;\n return {\n ok: payload?.ok === true,\n product: payload?.product ?? null,\n error: payload?.error,\n };\n}\n\nexport async function getAllOwnedProducts(gql: GqlRunner): Promise<AllOwnedProductsResult> {\n const data = await gql(GET_ALL_OWNED_PRODUCTS);\n const payload = data?.tOwnedProducts;\n return {\n ok: payload?.ok === true,\n owned: payload?.owned ?? null,\n error: payload?.error,\n };\n}\n\nfunction programUuidFilter(programUid: string): string {\n return `tProgramUuid='${programUid.trim().replace(/'/g, \"''\")}'`;\n}\n\n/** `tCourseRuns` returns every run it knows. Compliance needs the run the\n * learner would actually buy: published runs when any exist, otherwise\n * whatever keys came back so a course is not dropped. */\nexport function courseRunKeysFromRuns(runs: unknown): string[] {\n if (!Array.isArray(runs)) return [];\n const withKeys = runs.flatMap((run) => {\n if (!run || typeof run !== 'object') return [];\n const record = run as { courserun_key?: unknown, courserun_status?: unknown };\n const key = typeof record.courserun_key === 'string' ? record.courserun_key.trim() : '';\n if (!key) return [];\n return [{ key, published: record.courserun_status === 'published' || record.courserun_status == null }];\n });\n const published = withKeys.filter((run) => run.published);\n const chosen = published.length > 0 ? published : withKeys;\n return chosen.map((run) => run.key);\n}\n\n/**\n * Course run keys for every course in a program.\n * Compliance-check takes course run keys (`course-v1:...`), and a program\n * has no single run key of its own — look the program's courses up, then\n * each course's runs via `tCourseRuns(courseUuid: <maId>)`.\n */\nexport async function getProgramCourseRunKeys(gql: GqlRunner, programUid: string): Promise<string[]> {\n const tProgramUuid = programUid.trim();\n if (!tProgramUuid) return [];\n\n const data = await gql(GET_PROGRAM_COURSE_IDS, { filter: programUuidFilter(tProgramUuid) });\n const courses = data?.filterTwouProgram?.edges?.[0]?.node?.tCourses ?? [];\n const courseIds: string[] = [];\n for (const course of courses) {\n const maId = typeof course?.maId === 'string' ? course.maId.trim() : '';\n if (maId && !courseIds.includes(maId)) courseIds.push(maId);\n }\n if (courseIds.length === 0) return [];\n\n const fields = courseIds.map((id, index) => (\n `c${index}: tCourseRuns(courseUuid: ${JSON.stringify(id)})`\n )).join('\\n');\n const runsData = await gql(`query ProgramCourseRuns {\\n${fields}\\n}`);\n\n const keys: string[] = [];\n courseIds.forEach((_, index) => {\n for (const key of courseRunKeysFromRuns(runsData?.[`c${index}`]?.runs)) {\n if (!keys.includes(key)) keys.push(key);\n }\n });\n return keys;\n}\n\n/** Fetch a program's catalog/marketing details by tProgramUuid. */\nexport async function getProgramDetail(gql: GqlRunner, programUid: string): Promise<ProgramDetail | null> {\n const tProgramUuid = programUid.trim();\n if (!tProgramUuid) return null;\n\n const data = await gql(GET_PROGRAM_DETAIL, { filter: programUuidFilter(tProgramUuid) });\n const node = data?.filterTwouProgram?.edges?.[0]?.node;\n if (!node?.uid) return null;\n\n const tCourses: ProgramCourseRef[] = (node.tCourses ?? []).map((c: any) => ({\n id: c.id,\n uid: c.uid ?? null,\n maName: c.maName ?? null,\n maDescription: c.maDescription ?? null,\n tShortDescription: c.tShortDescription ?? null,\n imageUrl: c.imageUrl ?? null,\n tBrandText: c.tBrandText ?? null,\n tOrgLogoUrl: c.tOrgLogoUrl ?? null,\n tUrlCourse: c.tUrlCourse ?? null,\n tMarketingSlug: c.tMarketingSlug ?? null,\n tStatus: c.tStatus?.code ? { code: c.tStatus.code } : null,\n }));\n\n return {\n uid: node.uid,\n tEffortLow: node.tEffortLow ?? null,\n tEnrollmentCount: node.tEnrollmentCount ?? null,\n tMarketingSlug: node.tMarketingSlug ?? null,\n tSkills: node.tSkills ?? null,\n tFaq: node.tFaq ?? null,\n tLevelType: node.tLevelType ?? null,\n tCourses,\n };\n}\n\n// ─── Banner details (PDP banner before checkout) ─────────────────────────────\n\n/** Fetch a course's full catalog/marketing details by Viax tCourseKey for the PDP banner. */\nexport async function getBannerCourseDetail(gql: GqlRunner, courseKey: string): Promise<BannerCourseDetail | null> {\n const key = courseKey.trim();\n if (!key) return null;\n\n const filter = `tCourseKey = '${key.replace(/'/g, \"''\")}' and tAlacartePurchasable='true'`;\n const data = await gql(GET_BANNER_COURSE_DETAIL, { filter });\n const node = data?.filterTwouCourse?.edges?.[0]?.node;\n if (!node?.uid) return null;\n\n const instructors: BannerCourseInstructor[] = (node.tInstructors ?? []).map((i: any) => ({\n tGivenName: i.tGivenName ?? null,\n tFamilyName: i.tFamilyName ?? null,\n tOrganization: i.tOrganization ?? null,\n tInstructorUuid: i.tInstructorUuid ?? null,\n tSortValue: i.tSortValue ?? null,\n }));\n\n return {\n uid: node.uid,\n id: node.id ?? null,\n maName: node.maName ?? '',\n tEnrollmentCount: node.tEnrollmentCount ?? null,\n tAlacartePurchasable: node.tAlacartePurchasable ?? null,\n tCourseKey: node.tCourseKey ?? null,\n tShortDescription: node.tShortDescription ?? null,\n maDescription: node.maDescription ?? null,\n tBrandText: node.tBrandText ?? null,\n tOrgLogoUrl: node.tOrgLogoUrl ?? null,\n imageUrl: node.imageUrl ?? null,\n tUrlCourse: node.tUrlCourse ?? null,\n tMarketingSlug: node.tMarketingSlug ?? null,\n tLevelType: node.tLevelType ?? null,\n tPacingType: node.tPacingType?.code ?? null,\n tDurationLow: node.tDurationLow ?? null,\n tDurationHigh: node.tDurationHigh ?? null,\n tDurationUnit: node.tDurationUnit?.code ?? null,\n tEffortLow: node.tEffortLow ?? null,\n tEffortHigh: node.tEffortHigh ?? null,\n tEffortUnit: node.tEffortUnit?.code ?? null,\n tLanguage: node.tLanguage ?? null,\n tExpectedLearningItems: node.tExpectedLearningItems ?? null,\n tSkills: node.tSkills ?? null,\n tPrerequisites: node.tPrerequisites ?? null,\n tSyllabus: node.tSyllabus ?? null,\n tFaq: node.tFaq ?? null,\n tTestimonials: node.tTestimonials ?? null,\n tTranscriptLanguages: node.tTranscriptLanguages ?? null,\n tInstructors: instructors,\n };\n}\n\n/** Fetch a program's full catalog/marketing details by tProgramUuid for the PDP banner. */\nexport async function getBannerProgramDetail(gql: GqlRunner, programUid: string): Promise<BannerProgramDetail | null> {\n const tProgramUuid = programUid.trim();\n if (!tProgramUuid) return null;\n\n const filter = `tProgramUuid='${tProgramUuid.replace(/'/g, \"''\")}' AND tAlacartePurchasable=true`;\n const data = await gql(GET_BANNER_PROGRAM_DETAIL, { filter });\n const node = data?.filterTwouProgram?.edges?.[0]?.node;\n if (!node?.uid) return null;\n\n const tCourses: BannerProgramCourse[] = (node.tCourses ?? []).map((c: any) => ({\n id: c.id,\n uid: c.uid ?? null,\n maName: c.maName ?? null,\n maDescription: c.maDescription ?? null,\n tShortDescription: c.tShortDescription ?? null,\n tBrandText: c.tBrandText ?? null,\n tOrgLogoUrl: c.tOrgLogoUrl ?? null,\n tCourseKey: c.tCourseKey ?? null,\n imageUrl: c.imageUrl ?? null,\n tUrlCourse: c.tUrlCourse ?? null,\n tMarketingSlug: c.tMarketingSlug ?? null,\n tStatus: c.tStatus?.code ? { code: c.tStatus.code } : null,\n }));\n\n return {\n uid: node.uid,\n tEffortLow: node.tEffortLow ?? null,\n tEnrollmentCount: node.tEnrollmentCount ?? null,\n tMarketingSlug: node.tMarketingSlug ?? null,\n tAlacartePurchasable: node.tAlacartePurchasable ?? null,\n tSkills: node.tSkills ?? null,\n tFaq: node.tFaq ?? null,\n tLevelType: node.tLevelType ?? null,\n imageUrl: node.imageUrl ?? null,\n tBannerImageUrl: node.tBannerImageUrl ?? null,\n tCourses,\n };\n}\n"]}
1
+ {"version":3,"file":"alacarteApi.js","sourceRoot":"","sources":["../../src/ut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C,CAAC;QAEJ,OAAO;YACL,GAAG,EAAE,IAAI,CAAC,GAAG;YACb,UAAU,EAAE,MAAA,IAAI,CAAC,UAAU,mCAAI,IAAI;YACnC,gBAAgB,EAAE,MAAA,IAAI,CAAC,gBAAgB,mCAAI,IAAI;YAC/C,cAAc,EAAE,MAAA,IAAI,CAAC,cAAc,mCAAI,IAAI;YAC3C,oBAAoB,EAAE,MAAA,IAAI,CAAC,oBAAoB,mCAAI,IAAI;YACvD,OAAO,EAAE,MAAA,IAAI,CAAC,OAAO,mCAAI,IAAI;YAC7B,IAAI,EAAE,MAAA,IAAI,CAAC,IAAI,mCAAI,IAAI;YACvB,UAAU,EAAE,MAAA,IAAI,CAAC,UAAU,mCAAI,IAAI;YACnC,QAAQ,EAAE,MAAA,IAAI,CAAC,QAAQ,mCAAI,IAAI;YAC/B,eAAe,EAAE,MAAA,IAAI,CAAC,eAAe,mCAAI,IAAI;YAC7C,QAAQ;SACT,CAAC;IACJ,CAAC;CAAA","sourcesContent":["/**\n * utils/alacarteApi.ts — à la carte checkout + owned-products operations.\n *\n * Convention: every function here returns the `{ ok, ... }` envelope as-is.\n * `ok: false` is a normal domain outcome (see alacarte-*-api.md `error` table)\n * and must be branched on by the caller — it is NOT thrown here. Transport\n * errors (missing token, HTTP 401, GraphQL errors[]) are thrown by gql()\n * itself and propagate unchanged, exactly as with every other function in\n * bootstrapApi.ts/cartApi.ts.\n */\nimport {\n GET_ALACARTE_CHECKOUT, SELECT_ALACARTE_PRODUCT, UPDATE_ALACARTE_CHECKOUT,\n GET_OWNED_PRODUCT, GET_ALL_OWNED_PRODUCTS, GET_PROGRAM_DETAIL, GET_PROGRAM_COURSE_IDS,\n GET_PLACED_ORDER,\n GET_ORDER_DATES, GET_PURCHASE_HISTORY, PLACE_ALACARTE_ORDER, GET_BANNER_COURSE_DETAIL, GET_BANNER_PROGRAM_DETAIL,\n CAPTURE_PAYPAL_ORDER, CANCEL_PAYPAL_ORDER,\n} from './alacarteQueries';\nimport type {\n GqlRunner, AlacarteCheckoutResult, OwnedProductResult, AllOwnedProductsResult,\n ProgramDetail, ProgramCourseRef, PlacedOrderResult, OrderDatesResult,\n AlacarteBillingAddress, AlacartePlaceOrderApiResult, AlacartePaymentMethod, AlacartePaypalOrderResult,\n BannerCourseDetail, BannerCourseInstructor, BannerProgramDetail, BannerProgramCourse,\n} from '../types/alacarte';\n\nfunction normalizeCheckoutResult(payload: any): AlacarteCheckoutResult {\n return {\n ok: payload?.ok === true,\n checkout: payload?.checkout ?? null,\n replaced: payload?.replaced,\n priceChanged: payload?.priceChanged,\n blocked: payload?.blocked,\n couponRecheck: payload?.couponRecheck,\n error: payload?.error,\n };\n}\n\nexport async function getCheckout(gql: GqlRunner): Promise<AlacarteCheckoutResult> {\n const data = await gql(GET_ALACARTE_CHECKOUT);\n return normalizeCheckoutResult(data?.tCheckout);\n}\n\nexport async function selectCourse(\n gql: GqlRunner, courseUid: string, runKey: string, viewedPrice?: number,\n): Promise<AlacarteCheckoutResult> {\n const data = await gql(SELECT_ALACARTE_PRODUCT, { courseUid, runKey, viewedPrice });\n return normalizeCheckoutResult(data?.tCheckoutSelect);\n}\n\nexport async function selectProgram(\n gql: GqlRunner, programUid: string, viewedPrice?: number,\n): Promise<AlacarteCheckoutResult> {\n const data = await gql(SELECT_ALACARTE_PRODUCT, { programUid, viewedPrice });\n return normalizeCheckoutResult(data?.tCheckoutSelect);\n}\n\nexport async function updateCheckout(\n gql: GqlRunner,\n args: { biId?: string, couponCode?: string, termsAccepted?: boolean, acceptPrice?: boolean },\n): Promise<AlacarteCheckoutResult> {\n const data = await gql(UPDATE_ALACARTE_CHECKOUT, args);\n return normalizeCheckoutResult(data?.tCheckoutUpdate);\n}\n\n/** Reads the placed order for the confirmation page — never re-priced. */\nexport async function getPlacedOrder(gql: GqlRunner, biId: string): Promise<PlacedOrderResult> {\n const data = await gql(GET_PLACED_ORDER, { biId });\n const payload = data?.tPlacedOrder;\n return {\n ok: payload?.ok === true,\n order: payload?.order ?? null,\n error: payload?.error,\n };\n}\n\n/** Reads the order's placement/creation timestamps for the confirmation page. */\nexport async function getOrderDates(gql: GqlRunner, biId: string): Promise<OrderDatesResult> {\n const data = await gql(GET_ORDER_DATES, { biId });\n const payload = data?.getTwouOrder;\n return {\n ok: !!payload,\n dates: payload\n ? { tPlacedAt: payload.tPlacedAt ?? null, biCreatedAt: payload.biCreatedAt ?? null }\n : null,\n };\n}\n\n/**\n * One-call place order (section 5a). Runs sanctions + payment start and\n * returns the Stripe client secret.\n *\n * Only `country` (two-letter ISO) is required. Other address fields are\n * optional — the checkout UI also collects country-specific fields (ALC-177).\n */\nexport async function placeCheckoutOrder(\n gql: GqlRunner,\n biId: string,\n billing?: AlacarteBillingAddress,\n paymentMethod?: AlacartePaymentMethod,\n): Promise<AlacartePlaceOrderApiResult> {\n const optional = (value?: string): string | undefined => {\n const trimmed = value?.trim();\n return trimmed ? trimmed : undefined;\n };\n\n const data = await gql(PLACE_ALACARTE_ORDER, {\n biId,\n paymentMethod,\n country: billing?.country?.trim().toUpperCase() || undefined,\n firstName: optional(billing?.firstName),\n lastName: optional(billing?.lastName),\n line1: optional(billing?.line1),\n line2: optional(billing?.line2),\n city: optional(billing?.city),\n state: optional(billing?.state),\n postcode: optional(billing?.postcode),\n });\n const payload = data?.tCheckoutPlaceOrder;\n const payment = payload?.payment;\n return {\n ok: payload?.ok === true,\n payment: payment?.clientSecret\n ? {\n clientSecret: payment.clientSecret,\n paymentIntentId: payment.paymentIntentId ?? '',\n amount: payment.amount ?? 0,\n currency: payment.currency ?? 'usd',\n }\n : null,\n paypal: payment?.paypalOrderId\n ? {\n paypalOrderId: payment.paypalOrderId,\n amount: payment.amount ?? 0,\n currency: payment.currency ?? 'usd',\n }\n : null,\n checkout: payload?.checkout ?? null,\n error: payload?.error,\n };\n}\n\nfunction normalizePaypalOrderResult(payload: any): AlacartePaypalOrderResult {\n return {\n ok: payload?.ok === true,\n status: payload?.status,\n orderNumber: payload?.orderNumber,\n error: payload?.error,\n };\n}\n\n/** Captures the PayPal order the learner approved — places the order on COMPLETED. */\nexport async function capturePaypalOrder(\n gql: GqlRunner, biId: string, paypalOrderId: string,\n): Promise<AlacartePaypalOrderResult> {\n const data = await gql(CAPTURE_PAYPAL_ORDER, { biId, paypalOrderId });\n return normalizePaypalOrderResult(data?.tCheckoutCapturePaypalOrder);\n}\n\n/** Abandons an unapproved PayPal order so the checkout can be paid again. */\nexport async function cancelPaypalOrder(\n gql: GqlRunner, biId: string, paypalOrderId: string,\n): Promise<AlacartePaypalOrderResult> {\n const data = await gql(CANCEL_PAYPAL_ORDER, { biId, paypalOrderId });\n return normalizePaypalOrderResult(data?.tCheckoutCancelPaypalOrder);\n}\n\nexport async function getOwnedProduct(gql: GqlRunner, productId: string): Promise<OwnedProductResult> {\n const data = await gql(GET_OWNED_PRODUCT, { productId });\n const payload = data?.tOwnedProducts;\n return {\n ok: payload?.ok === true,\n product: payload?.product ?? null,\n error: payload?.error,\n };\n}\n\nexport async function getAllOwnedProducts(gql: GqlRunner): Promise<AllOwnedProductsResult> {\n const data = await gql(GET_ALL_OWNED_PRODUCTS);\n const payload = data?.tOwnedProducts;\n return {\n ok: payload?.ok === true,\n owned: payload?.owned ?? null,\n error: payload?.error,\n };\n}\n\n/** Reads the learner's purchase-history payload for the course payments tab. */\nexport async function getPurchaseHistory(gql: GqlRunner): Promise<any> {\n const data = await gql(GET_PURCHASE_HISTORY);\n return data?.tOrderHistory ?? null;\n}\n\nfunction programUuidFilter(programUid: string): string {\n return `tProgramUuid='${programUid.trim().replace(/'/g, \"''\")}'`;\n}\n\n/** `tCourseRuns` returns every run it knows. Compliance needs the run the\n * learner would actually buy: published runs when any exist, otherwise\n * whatever keys came back so a course is not dropped. */\nexport function courseRunKeysFromRuns(runs: unknown): string[] {\n if (!Array.isArray(runs)) return [];\n const withKeys = runs.flatMap((run) => {\n if (!run || typeof run !== 'object') return [];\n const record = run as { courserun_key?: unknown, courserun_status?: unknown };\n const key = typeof record.courserun_key === 'string' ? record.courserun_key.trim() : '';\n if (!key) return [];\n return [{ key, published: record.courserun_status === 'published' || record.courserun_status == null }];\n });\n const published = withKeys.filter((run) => run.published);\n const chosen = published.length > 0 ? published : withKeys;\n return chosen.map((run) => run.key);\n}\n\n/**\n * Course run keys for every course in a program.\n * Compliance-check takes course run keys (`course-v1:...`), and a program\n * has no single run key of its own — look the program's courses up, then\n * each course's runs via `tCourseRuns(courseUuid: <maId>)`.\n */\nexport async function getProgramCourseRunKeys(gql: GqlRunner, programUid: string): Promise<string[]> {\n const tProgramUuid = programUid.trim();\n if (!tProgramUuid) return [];\n\n const data = await gql(GET_PROGRAM_COURSE_IDS, { filter: programUuidFilter(tProgramUuid) });\n const courses = data?.filterTwouProgram?.edges?.[0]?.node?.tCourses ?? [];\n const courseIds: string[] = [];\n for (const course of courses) {\n const maId = typeof course?.maId === 'string' ? course.maId.trim() : '';\n if (maId && !courseIds.includes(maId)) courseIds.push(maId);\n }\n if (courseIds.length === 0) return [];\n\n const fields = courseIds.map((id, index) => (\n `c${index}: tCourseRuns(courseUuid: ${JSON.stringify(id)})`\n )).join('\\n');\n const runsData = await gql(`query ProgramCourseRuns {\\n${fields}\\n}`);\n\n const keys: string[] = [];\n courseIds.forEach((_, index) => {\n for (const key of courseRunKeysFromRuns(runsData?.[`c${index}`]?.runs)) {\n if (!keys.includes(key)) keys.push(key);\n }\n });\n return keys;\n}\n\n/** Fetch a program's catalog/marketing details by tProgramUuid. */\nexport async function getProgramDetail(gql: GqlRunner, programUid: string): Promise<ProgramDetail | null> {\n const tProgramUuid = programUid.trim();\n if (!tProgramUuid) return null;\n\n const data = await gql(GET_PROGRAM_DETAIL, { filter: programUuidFilter(tProgramUuid) });\n const node = data?.filterTwouProgram?.edges?.[0]?.node;\n if (!node?.uid) return null;\n\n const tCourses: ProgramCourseRef[] = (node.tCourses ?? []).map((c: any) => ({\n id: c.id,\n uid: c.uid ?? null,\n maName: c.maName ?? null,\n maDescription: c.maDescription ?? null,\n tShortDescription: c.tShortDescription ?? null,\n imageUrl: c.imageUrl ?? null,\n tBrandText: c.tBrandText ?? null,\n tOrgLogoUrl: c.tOrgLogoUrl ?? null,\n tUrlCourse: c.tUrlCourse ?? null,\n tMarketingSlug: c.tMarketingSlug ?? null,\n tStatus: c.tStatus?.code ? { code: c.tStatus.code } : null,\n }));\n\n return {\n uid: node.uid,\n tEffortLow: node.tEffortLow ?? null,\n tEnrollmentCount: node.tEnrollmentCount ?? null,\n tMarketingSlug: node.tMarketingSlug ?? null,\n tSkills: node.tSkills ?? null,\n tFaq: node.tFaq ?? null,\n tLevelType: node.tLevelType ?? null,\n tCourses,\n };\n}\n\n// ─── Banner details (PDP banner before checkout) ─────────────────────────────\n\n/** Fetch a course's full catalog/marketing details by Viax tCourseKey for the PDP banner. */\nexport async function getBannerCourseDetail(gql: GqlRunner, courseKey: string): Promise<BannerCourseDetail | null> {\n const key = courseKey.trim();\n if (!key) return null;\n\n const filter = `tCourseKey = '${key.replace(/'/g, \"''\")}' and tAlacartePurchasable='true'`;\n const data = await gql(GET_BANNER_COURSE_DETAIL, { filter });\n const node = data?.filterTwouCourse?.edges?.[0]?.node;\n if (!node?.uid) return null;\n\n const instructors: BannerCourseInstructor[] = (node.tInstructors ?? []).map((i: any) => ({\n tGivenName: i.tGivenName ?? null,\n tFamilyName: i.tFamilyName ?? null,\n tOrganization: i.tOrganization ?? null,\n tInstructorUuid: i.tInstructorUuid ?? null,\n tSortValue: i.tSortValue ?? null,\n }));\n\n return {\n uid: node.uid,\n id: node.id ?? null,\n maName: node.maName ?? '',\n tEnrollmentCount: node.tEnrollmentCount ?? null,\n tAlacartePurchasable: node.tAlacartePurchasable ?? null,\n tCourseKey: node.tCourseKey ?? null,\n tShortDescription: node.tShortDescription ?? null,\n maDescription: node.maDescription ?? null,\n tBrandText: node.tBrandText ?? null,\n tOrgLogoUrl: node.tOrgLogoUrl ?? null,\n imageUrl: node.imageUrl ?? null,\n tUrlCourse: node.tUrlCourse ?? null,\n tMarketingSlug: node.tMarketingSlug ?? null,\n tLevelType: node.tLevelType ?? null,\n tPacingType: node.tPacingType?.code ?? null,\n tDurationLow: node.tDurationLow ?? null,\n tDurationHigh: node.tDurationHigh ?? null,\n tDurationUnit: node.tDurationUnit?.code ?? null,\n tEffortLow: node.tEffortLow ?? null,\n tEffortHigh: node.tEffortHigh ?? null,\n tEffortUnit: node.tEffortUnit?.code ?? null,\n tLanguage: node.tLanguage ?? null,\n tExpectedLearningItems: node.tExpectedLearningItems ?? null,\n tSkills: node.tSkills ?? null,\n tPrerequisites: node.tPrerequisites ?? null,\n tSyllabus: node.tSyllabus ?? null,\n tFaq: node.tFaq ?? null,\n tTestimonials: node.tTestimonials ?? null,\n tTranscriptLanguages: node.tTranscriptLanguages ?? null,\n tInstructors: instructors,\n };\n}\n\n/** Fetch a program's full catalog/marketing details by tProgramUuid for the PDP banner. */\nexport async function getBannerProgramDetail(gql: GqlRunner, programUid: string): Promise<BannerProgramDetail | null> {\n const tProgramUuid = programUid.trim();\n if (!tProgramUuid) return null;\n\n const filter = `tProgramUuid='${tProgramUuid.replace(/'/g, \"''\")}' AND tAlacartePurchasable=true`;\n const data = await gql(GET_BANNER_PROGRAM_DETAIL, { filter });\n const node = data?.filterTwouProgram?.edges?.[0]?.node;\n if (!node?.uid) return null;\n\n const tCourses: BannerProgramCourse[] = (node.tCourses ?? []).map((c: any) => ({\n id: c.id,\n uid: c.uid ?? null,\n maName: c.maName ?? null,\n maDescription: c.maDescription ?? null,\n tShortDescription: c.tShortDescription ?? null,\n tBrandText: c.tBrandText ?? null,\n tOrgLogoUrl: c.tOrgLogoUrl ?? null,\n tCourseKey: c.tCourseKey ?? null,\n imageUrl: c.imageUrl ?? null,\n tUrlCourse: c.tUrlCourse ?? null,\n tMarketingSlug: c.tMarketingSlug ?? null,\n tStatus: c.tStatus?.code ? { code: c.tStatus.code } : null,\n }));\n\n return {\n uid: node.uid,\n tEffortLow: node.tEffortLow ?? null,\n tEnrollmentCount: node.tEnrollmentCount ?? null,\n tMarketingSlug: node.tMarketingSlug ?? null,\n tAlacartePurchasable: node.tAlacartePurchasable ?? null,\n tSkills: node.tSkills ?? null,\n tFaq: node.tFaq ?? null,\n tLevelType: node.tLevelType ?? null,\n imageUrl: node.imageUrl ?? null,\n tBannerImageUrl: node.tBannerImageUrl ?? null,\n tCourses,\n };\n}\n"]}
@@ -21,6 +21,7 @@ export function createAlacarteCheckoutClient({ apiUrl }) {
21
21
  getCourseDetail: (courseKey) => getCourseDetail(gql, courseKey),
22
22
  getPlacedOrder: (biId) => alacarteApi.getPlacedOrder(gql, biId),
23
23
  getOrderDates: (biId) => alacarteApi.getOrderDates(gql, biId),
24
+ getPurchaseHistory: () => alacarteApi.getPurchaseHistory(gql),
24
25
  placeCheckoutOrder: (biId, billing, paymentMethod) => (alacarteApi.placeCheckoutOrder(gql, biId, billing, paymentMethod)),
25
26
  capturePaypalOrder: (biId, paypalOrderId) => alacarteApi.capturePaypalOrder(gql, biId, paypalOrderId),
26
27
  cancelPaypalOrder: (biId, paypalOrderId) => alacarteApi.cancelPaypalOrder(gql, biId, paypalOrderId),
@@ -1 +1 @@
1
- {"version":3,"file":"alacarteCheckout.js","sourceRoot":"","sources":["../../src/utils/alacarteCheckout.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACjD,OAAO,KAAK,WAAW,MAAM,eAAe,CAAC;AAO7C,MAAM,UAAU,4BAA4B,CAC1C,EAAE,MAAM,EAAgC;IAExC,MAAM,EAAE,GAAG,EAAE,QAAQ,EAAE,GAAG,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC;IAEtD,OAAO;QACL,GAAG;QACH,QAAQ;QACR,WAAW,EAAE,GAAG,EAAE,CAAC,WAAW,CAAC,WAAW,CAAC,GAAG,CAAC;QAC/C,YAAY,EAAE,CAAC,SAAS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E,CAAC,WAAW,CAAC,iBAAiB,CAAC,GAAG,EAAE,IAAI,EAAE,aAAa,CAAC;KACpG,CAAC;AACJ,CAAC","sourcesContent":["/**\n * utils/alacarteCheckout.ts — composition root for the à la carte checkout\n * client. Kept separate from utils/checkout.ts (the subscription client) —\n * different bounded context, same underlying graphqlClient/token mechanics.\n */\nimport { createGqlClient } from './graphqlClient';\nimport { getCourseDetail } from './bootstrapApi';\nimport * as alacarteApi from './alacarteApi';\nimport type { AlacarteCheckoutClient } from '../types/alacarte';\n\ninterface AlacarteCheckoutClientConfig {\n apiUrl: string,\n}\n\nexport function createAlacarteCheckoutClient(\n { apiUrl }: AlacarteCheckoutClientConfig,\n): AlacarteCheckoutClient {\n const { gql, setToken } = createGqlClient({ apiUrl });\n\n return {\n gql,\n setToken,\n getCheckout: () => alacarteApi.getCheckout(gql),\n selectCourse: (courseUid, runKey, viewedPrice) => alacarteApi.selectCourse(gql, courseUid, runKey, viewedPrice),\n selectProgram: (programUid, viewedPrice) => alacarteApi.selectProgram(gql, programUid, viewedPrice),\n updateCheckout: (args) => alacarteApi.updateCheckout(gql, args),\n getOwnedProduct: (productId) => alacarteApi.getOwnedProduct(gql, productId),\n getAllOwnedProducts: () => alacarteApi.getAllOwnedProducts(gql),\n getProgramDetail: (programUid) => alacarteApi.getProgramDetail(gql, programUid),\n getCourseDetail: (courseKey) => getCourseDetail(gql, courseKey),\n getPlacedOrder: (biId) => alacarteApi.getPlacedOrder(gql, biId),\n getOrderDates: (biId) => alacarteApi.getOrderDates(gql, biId),\n placeCheckoutOrder: (biId, billing, paymentMethod) => (\n alacarteApi.placeCheckoutOrder(gql, biId, billing, paymentMethod)\n ),\n capturePaypalOrder: (biId, paypalOrderId) => alacarteApi.capturePaypalOrder(gql, biId, paypalOrderId),\n cancelPaypalOrder: (biId, paypalOrderId) => alacarteApi.cancelPaypalOrder(gql, biId, paypalOrderId),\n };\n}\n"]}
1
+ {"version":3,"file":"alacarteCheckout.js","sourceRoot":"","sources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CAAC,cAAc,CAAC,GAAG,EAAE,IAAI,CAAC;QAC/D,aAAa,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,WAAW,CAAC,aAAa,CAAC,GAAG,EAAE,IAAI,CAAC;QAC7D,kBAAkB,EAAE,GAAG,EAAE,CAAC,WAAW,CAAC,kBAAkB,CAAC,GAAG,CAAC;QAC7D,kBAAkB,EAAE,CAAC,IAAI,EAAE,OAAO,EAAE,aAAa,EAAE,EAAE,CAAC,CACpD,WAAW,CAAC,kBAAkB,CAAC,GAAG,EAAE,IAAI,EAAE,OAAO,EAAE,aAAa,CAAC,CAClE;QACD,kBAAkB,EAAE,CAAC,IAAI,EAAE,aAAa,EAAE,EAAE,CAAC,WAAW,CAAC,kBAAkB,CAAC,GAAG,EAAE,IAAI,EAAE,aAAa,CAAC;QACrG,iBAAiB,EAAE,CAAC,IAAI,EAAE,aAAa,EAAE,EAAE,CAAC,WAAW,CAAC,iBAAiB,CAAC,GAAG,EAAE,IAAI,EAAE,aAAa,CAAC;KACpG,CAAC;AACJ,CAAC","sourcesContent":["/**\n * utils/alacarteCheckout.ts — composition root for the à la carte checkout\n * client. Kept separate from utils/checkout.ts (the subscription client) —\n * different bounded context, same underlying graphqlClient/token mechanics.\n */\nimport { createGqlClient } from './graphqlClient';\nimport { getCourseDetail } from './bootstrapApi';\nimport * as alacarteApi from './alacarteApi';\nimport type { AlacarteCheckoutClient } from '../types/alacarte';\n\ninterface AlacarteCheckoutClientConfig {\n apiUrl: string,\n}\n\nexport function createAlacarteCheckoutClient(\n { apiUrl }: AlacarteCheckoutClientConfig,\n): AlacarteCheckoutClient {\n const { gql, setToken } = createGqlClient({ apiUrl });\n\n return {\n gql,\n setToken,\n getCheckout: () => alacarteApi.getCheckout(gql),\n selectCourse: (courseUid, runKey, viewedPrice) => alacarteApi.selectCourse(gql, courseUid, runKey, viewedPrice),\n selectProgram: (programUid, viewedPrice) => alacarteApi.selectProgram(gql, programUid, viewedPrice),\n updateCheckout: (args) => alacarteApi.updateCheckout(gql, args),\n getOwnedProduct: (productId) => alacarteApi.getOwnedProduct(gql, productId),\n getAllOwnedProducts: () => alacarteApi.getAllOwnedProducts(gql),\n getProgramDetail: (programUid) => alacarteApi.getProgramDetail(gql, programUid),\n getCourseDetail: (courseKey) => getCourseDetail(gql, courseKey),\n getPlacedOrder: (biId) => alacarteApi.getPlacedOrder(gql, biId),\n getOrderDates: (biId) => alacarteApi.getOrderDates(gql, biId),\n getPurchaseHistory: () => alacarteApi.getPurchaseHistory(gql),\n placeCheckoutOrder: (biId, billing, paymentMethod) => (\n alacarteApi.placeCheckoutOrder(gql, biId, billing, paymentMethod)\n ),\n capturePaypalOrder: (biId, paypalOrderId) => alacarteApi.capturePaypalOrder(gql, biId, paypalOrderId),\n cancelPaypalOrder: (biId, paypalOrderId) => alacarteApi.cancelPaypalOrder(gql, biId, paypalOrderId),\n };\n}\n"]}
@@ -19,6 +19,8 @@ export declare const SELECT_ALACARTE_PRODUCT = "mutation SelectAlacarteProduct($
19
19
  export declare const UPDATE_ALACARTE_CHECKOUT = "mutation UpdateAlacarteCheckout($biId: String, $couponCode: String, $termsAccepted: Boolean, $acceptPrice: Boolean) {\n tCheckoutUpdate(biId: $biId, couponCode: $couponCode, termsAccepted: $termsAccepted, acceptPrice: $acceptPrice)\n}";
20
20
  export declare const GET_OWNED_PRODUCT = "query GetOwnedProduct($productId: String!) {\n tOwnedProducts(productId: $productId)\n}";
21
21
  export declare const GET_ALL_OWNED_PRODUCTS = "query GetAllOwnedProducts {\n tOwnedProducts\n}";
22
+ /** Fetches the learner's purchase history for the course payments tab. */
23
+ export declare const GET_PURCHASE_HISTORY = "query PurchaseHistory {\n tOrderHistory\n}";
22
24
  /** Reads the order as recorded at placement — the same biId the checkout had.
23
25
  * Never re-priced, so a later catalog change doesn't alter what this shows. */
24
26
  export declare const GET_PLACED_ORDER = "query GetPlacedOrder($biId: String!) {\n tPlacedOrder(biId: $biId)\n}";
@@ -31,6 +31,10 @@ export const GET_OWNED_PRODUCT = `query GetOwnedProduct($productId: String!) {
31
31
  export const GET_ALL_OWNED_PRODUCTS = `query GetAllOwnedProducts {
32
32
  tOwnedProducts
33
33
  }`;
34
+ /** Fetches the learner's purchase history for the course payments tab. */
35
+ export const GET_PURCHASE_HISTORY = `query PurchaseHistory {
36
+ tOrderHistory
37
+ }`;
34
38
  // ─── Placed order (confirmation page) ────────────────────────────────────────
35
39
  /** Reads the order as recorded at placement — the same biId the checkout had.
36
40
  * Never re-priced, so a later catalog change doesn't alter what this shows. */
@@ -1 +1 @@
1
- {"version":3,"file":"alacarteQueries.js","sourceRoot":"","sources":["../../src/utils/alacarteQueries.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,iFAAiF;AAEjF,MAAM,CAAC,MAAM,qBAAqB,GAAG;;EAEnC,CAAC;AAEH;;;;;+DAK+D;AAC/D,MAAM,CAAC,MAAM,uBAAuB,GAAG;;EAErC,CAAC;AAEH,MAAM,CAAC,MAAM,wBAAwB,GAAG;;EAEtC,CAAC;AAEH,iFAAiF;AAEjF,MAAM,CAAC,MAAM,iBAAiB,GAAG;;EAE/B,CAAC;AAEH,MAAM,CAAC,MAAM,sBAAsB,GAAG;;EAEpC,CAAC;AAEH,gFAAgF;AAEhF;gFACgF;AAChF,MAAM,CAAC,MAAM,gBAAgB,GAAG;;EAE9B,CAAC;AAEH;;6CAE6C;AAC7C,MAAM,CAAC,MAAM,eAAe,GAAG;;;;;EAK7B,CAAC;AAEH;;;;;GAKG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;EAwBlC,CAAC;AAEH;oEACoE;AACpE,MAAM,CAAC,MAAM,oBAAoB,GAAG;;EAElC,CAAC;AAEH;kEACkE;AAClE,MAAM,CAAC,MAAM,mBAAmB,GAAG;;EAEjC,CAAC;AAEH,iFAAiF;AAEjF;uEACuE;AACvE,MAAM,CAAC,MAAM,sBAAsB,GAAG;;;;;;;;EAQpC,CAAC;AAEH;+DAC+D;AAC/D,MAAM,CAAC,MAAM,kBAAkB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA6BhC,CAAC;AAEH,gFAAgF;AAEhF,wFAAwF;AACxF,MAAM,CAAC,MAAM,wBAAwB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA2CtC,CAAC;AAEH,2FAA2F;AAC3F,MAAM,CAAC,MAAM,yBAAyB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAiCvC,CAAC","sourcesContent":["/**\n * utils/alacarteQueries.ts — GraphQL documents for the à la carte checkout flow.\n * tCheckout / tCheckoutSelect / tCheckoutUpdate / tOwnedProducts / tPlacedOrder\n * are JSON-scalar fields — no field selection sets allowed; the whole response\n * object comes back as-is (same style as GET_IS_CURRENT_USER_SUBSCRIBER in\n * queries.ts). GET_PROGRAM_DETAIL is the one exception — filterTwouProgram is\n * a normal typed field with an explicit selection set, mirroring GET_COURSE_DETAIL.\n * See alacarte-checkout-api.md and alacarte-owned-products-api.md at the repo\n * root for the full contract.\n */\n\n// ─── Checkout ─────────────────────────────────────────────────────────────────\n\nexport const GET_ALACARTE_CHECKOUT = `query GetAlacarteCheckout {\n tCheckout\n}`;\n\n/** Selects a course or a program into the learner's open checkout. Pass only\n * the relevant variables — courseUid+runKey for a course, programUid alone\n * for a program; GraphQL omits unset optional variables cleanly.\n * viewedPrice is the amount (USD, before any coupon) the learner saw before\n * checkout — for a program, the price after already-owned courses are taken\n * off. Omit it to accept whatever price checkout resolves. */\nexport const SELECT_ALACARTE_PRODUCT = `mutation SelectAlacarteProduct($courseUid: String, $runKey: String, $programUid: String, $viewedPrice: Float) {\n tCheckoutSelect(courseUid: $courseUid, runKey: $runKey, programUid: $programUid, viewedPrice: $viewedPrice)\n}`;\n\nexport const UPDATE_ALACARTE_CHECKOUT = `mutation UpdateAlacarteCheckout($biId: String, $couponCode: String, $termsAccepted: Boolean, $acceptPrice: Boolean) {\n tCheckoutUpdate(biId: $biId, couponCode: $couponCode, termsAccepted: $termsAccepted, acceptPrice: $acceptPrice)\n}`;\n\n// ─── Owned products ───────────────────────────────────────────────────────────\n\nexport const GET_OWNED_PRODUCT = `query GetOwnedProduct($productId: String!) {\n tOwnedProducts(productId: $productId)\n}`;\n\nexport const GET_ALL_OWNED_PRODUCTS = `query GetAllOwnedProducts {\n tOwnedProducts\n}`;\n\n// ─── Placed order (confirmation page) ────────────────────────────────────────\n\n/** Reads the order as recorded at placement — the same biId the checkout had.\n * Never re-priced, so a later catalog change doesn't alter what this shows. */\nexport const GET_PLACED_ORDER = `query GetPlacedOrder($biId: String!) {\n tPlacedOrder(biId: $biId)\n}`;\n\n/** Order placement/creation timestamps — used for purchase date and the\n * refund-window deadline on the confirmation page. Use tPlacedAt; fall back\n * to biCreatedAt when tPlacedAt is null. */\nexport const GET_ORDER_DATES = `query GetSingleOrder($biId: String!) {\n getTwouOrder(biId: $biId) {\n tPlacedAt\n biCreatedAt\n }\n}`;\n\n/**\n * One-call \"Place your order\" — sanctions, payment start, and Stripe client\n * secret. Only `country` (two-letter ISO) is required; other address fields\n * are optional when the UI collects country alone.\n * See alacarte-checkout-api.md section 5a.\n */\nexport const PLACE_ALACARTE_ORDER = `mutation PlaceAlacarteOrder(\n $biId: String,\n $paymentMethod: String,\n $firstName: String,\n $lastName: String,\n $line1: String,\n $line2: String,\n $city: String,\n $state: String,\n $postcode: String,\n $country: String\n) {\n tCheckoutPlaceOrder(\n biId: $biId,\n paymentMethod: $paymentMethod,\n firstName: $firstName,\n lastName: $lastName,\n line1: $line1,\n line2: $line2,\n city: $city,\n state: $state,\n postcode: $postcode,\n country: $country\n )\n}`;\n\n/** Captures the PayPal order the learner approved in the PayPal buttons\n * (tCheckoutPlaceOrder with paymentMethod \"PAYPAL\" created it). */\nexport const CAPTURE_PAYPAL_ORDER = `mutation CapturePaypalOrder($biId: String!, $paypalOrderId: String!) {\n tCheckoutCapturePaypalOrder(biId: $biId, paypalOrderId: $paypalOrderId)\n}`;\n\n/** The learner closed the PayPal window without approving — settles the\n * attempt as a failed payment so the checkout can be retried. */\nexport const CANCEL_PAYPAL_ORDER = `mutation CancelPaypalOrder($biId: String!, $paypalOrderId: String!) {\n tCheckoutCancelPaypalOrder(biId: $biId, paypalOrderId: $paypalOrderId)\n}`;\n\n// ─── Program details ──────────────────────────────────────────────────────────\n\n/** Catalog ids (`maId`) of the courses in a program. `tCourseRuns` looks up\n * course run keys by this id, not by the Viax uid or `tCourseKey`. */\nexport const GET_PROGRAM_COURSE_IDS = `query GetProgramCourseIds($filter: String!) {\n filterTwouProgram(_first: 1, _filter: $filter) {\n edges {\n node {\n tCourses { maId }\n }\n }\n }\n}`;\n\n/** Fetch a program's catalog/marketing details by tProgramUuid (program analog of\n * GET_COURSE_DETAIL, which filters courses by tCourseKey). */\nexport const GET_PROGRAM_DETAIL = `query GetProgramDetail($filter: String!) {\n filterTwouProgram(_first: 1, _filter: $filter) {\n edges {\n node {\n uid\n tProgramUuid\n tEffortLow\n tEnrollmentCount\n tMarketingSlug\n tSkills\n tFaq\n tLevelType\n tCourses {\n id\n maName\n uid\n tCourseKey\n tShortDescription\n maDescription\n tBrandText\n tOrgLogoUrl\n imageUrl\n tUrlCourse\n tMarketingSlug\n tStatus { code }\n }\n }\n }\n }\n}`;\n\n// ─── Banner details (PDP banner before checkout) ─────────────────────────────\n\n/** Fetch a course's full catalog/marketing details by tCourseKey for the PDP banner. */\nexport const GET_BANNER_COURSE_DETAIL = `query GetBannerCourseDetail($filter: String!) {\n filterTwouCourse(_first: 1, _filter: $filter) {\n edges {\n node {\n maName\n tEnrollmentCount\n tAlacartePurchasable\n uid\n id\n tCourseKey\n tShortDescription\n maDescription\n tBrandText\n tOrgLogoUrl\n imageUrl\n tUrlCourse\n tMarketingSlug\n tLevelType\n tPacingType { code }\n tDurationLow\n tDurationHigh\n tDurationUnit { code }\n tEffortLow\n tEffortHigh\n tEffortUnit { code }\n tLanguage\n tExpectedLearningItems\n tSkills\n tPrerequisites\n tSyllabus\n tFaq\n tTestimonials\n tTranscriptLanguages\n tInstructors {\n tGivenName\n tFamilyName\n tOrganization\n tInstructorUuid\n tSortValue\n }\n }\n }\n }\n}`;\n\n/** Fetch a program's full catalog/marketing details by tProgramUuid for the PDP banner. */\nexport const GET_BANNER_PROGRAM_DETAIL = `query GetBannerProgramDetail($filter: String!) {\n filterTwouProgram(_first: 1, _filter: $filter) {\n edges {\n node {\n uid\n tProgramUuid\n tEffortLow\n tEnrollmentCount\n tMarketingSlug\n tAlacartePurchasable\n tSkills\n tFaq\n tLevelType\n imageUrl\n tBannerImageUrl\n tCourses {\n id\n maName\n uid\n tCourseKey\n tShortDescription\n maDescription\n tBrandText\n tOrgLogoUrl\n tCourseKey\n imageUrl\n tUrlCourse\n tMarketingSlug\n tStatus { code }\n }\n }\n }\n }\n}`;\n"]}
1
+ {"version":3,"file":"alacarteQueries.js","sourceRoot":"","sources":["../../src/utils/alacarteQueries.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,iFAAiF;AAEjF,MAAM,CAAC,MAAM,qBAAqB,GAAG;;EAEnC,CAAC;AAEH;;;;;+DAK+D;AAC/D,MAAM,CAAC,MAAM,uBAAuB,GAAG;;EAErC,CAAC;AAEH,MAAM,CAAC,MAAM,wBAAwB,GAAG;;EAEtC,CAAC;AAEH,iFAAiF;AAEjF,MAAM,CAAC,MAAM,iBAAiB,GAAG;;EAE/B,CAAC;AAEH,MAAM,CAAC,MAAM,sBAAsB,GAAG;;EAEpC,CAAC;AAEH,0EAA0E;AAC1E,MAAM,CAAC,MAAM,oBAAoB,GAAG;;EAElC,CAAC;AAEH,gFAAgF;AAEhF;gFACgF;AAChF,MAAM,CAAC,MAAM,gBAAgB,GAAG;;EAE9B,CAAC;AAEH;;6CAE6C;AAC7C,MAAM,CAAC,MAAM,eAAe,GAAG;;;;;EAK7B,CAAC;AAEH;;;;;GAKG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;EAwBlC,CAAC;AAEH;oEACoE;AACpE,MAAM,CAAC,MAAM,oBAAoB,GAAG;;EAElC,CAAC;AAEH;kEACkE;AAClE,MAAM,CAAC,MAAM,mBAAmB,GAAG;;EAEjC,CAAC;AAEH,iFAAiF;AAEjF;uEACuE;AACvE,MAAM,CAAC,MAAM,sBAAsB,GAAG;;;;;;;;EAQpC,CAAC;AAEH;+DAC+D;AAC/D,MAAM,CAAC,MAAM,kBAAkB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA6BhC,CAAC;AAEH,gFAAgF;AAEhF,wFAAwF;AACxF,MAAM,CAAC,MAAM,wBAAwB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA2CtC,CAAC;AAEH,2FAA2F;AAC3F,MAAM,CAAC,MAAM,yBAAyB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAiCvC,CAAC","sourcesContent":["/**\n * utils/alacarteQueries.ts — GraphQL documents for the à la carte checkout flow.\n * tCheckout / tCheckoutSelect / tCheckoutUpdate / tOwnedProducts / tPlacedOrder\n * are JSON-scalar fields — no field selection sets allowed; the whole response\n * object comes back as-is (same style as GET_IS_CURRENT_USER_SUBSCRIBER in\n * queries.ts). GET_PROGRAM_DETAIL is the one exception — filterTwouProgram is\n * a normal typed field with an explicit selection set, mirroring GET_COURSE_DETAIL.\n * See alacarte-checkout-api.md and alacarte-owned-products-api.md at the repo\n * root for the full contract.\n */\n\n// ─── Checkout ─────────────────────────────────────────────────────────────────\n\nexport const GET_ALACARTE_CHECKOUT = `query GetAlacarteCheckout {\n tCheckout\n}`;\n\n/** Selects a course or a program into the learner's open checkout. Pass only\n * the relevant variables — courseUid+runKey for a course, programUid alone\n * for a program; GraphQL omits unset optional variables cleanly.\n * viewedPrice is the amount (USD, before any coupon) the learner saw before\n * checkout — for a program, the price after already-owned courses are taken\n * off. Omit it to accept whatever price checkout resolves. */\nexport const SELECT_ALACARTE_PRODUCT = `mutation SelectAlacarteProduct($courseUid: String, $runKey: String, $programUid: String, $viewedPrice: Float) {\n tCheckoutSelect(courseUid: $courseUid, runKey: $runKey, programUid: $programUid, viewedPrice: $viewedPrice)\n}`;\n\nexport const UPDATE_ALACARTE_CHECKOUT = `mutation UpdateAlacarteCheckout($biId: String, $couponCode: String, $termsAccepted: Boolean, $acceptPrice: Boolean) {\n tCheckoutUpdate(biId: $biId, couponCode: $couponCode, termsAccepted: $termsAccepted, acceptPrice: $acceptPrice)\n}`;\n\n// ─── Owned products ───────────────────────────────────────────────────────────\n\nexport const GET_OWNED_PRODUCT = `query GetOwnedProduct($productId: String!) {\n tOwnedProducts(productId: $productId)\n}`;\n\nexport const GET_ALL_OWNED_PRODUCTS = `query GetAllOwnedProducts {\n tOwnedProducts\n}`;\n\n/** Fetches the learner's purchase history for the course payments tab. */\nexport const GET_PURCHASE_HISTORY = `query PurchaseHistory {\n tOrderHistory\n}`;\n\n// ─── Placed order (confirmation page) ────────────────────────────────────────\n\n/** Reads the order as recorded at placement — the same biId the checkout had.\n * Never re-priced, so a later catalog change doesn't alter what this shows. */\nexport const GET_PLACED_ORDER = `query GetPlacedOrder($biId: String!) {\n tPlacedOrder(biId: $biId)\n}`;\n\n/** Order placement/creation timestamps — used for purchase date and the\n * refund-window deadline on the confirmation page. Use tPlacedAt; fall back\n * to biCreatedAt when tPlacedAt is null. */\nexport const GET_ORDER_DATES = `query GetSingleOrder($biId: String!) {\n getTwouOrder(biId: $biId) {\n tPlacedAt\n biCreatedAt\n }\n}`;\n\n/**\n * One-call \"Place your order\" — sanctions, payment start, and Stripe client\n * secret. Only `country` (two-letter ISO) is required; other address fields\n * are optional when the UI collects country alone.\n * See alacarte-checkout-api.md section 5a.\n */\nexport const PLACE_ALACARTE_ORDER = `mutation PlaceAlacarteOrder(\n $biId: String,\n $paymentMethod: String,\n $firstName: String,\n $lastName: String,\n $line1: String,\n $line2: String,\n $city: String,\n $state: String,\n $postcode: String,\n $country: String\n) {\n tCheckoutPlaceOrder(\n biId: $biId,\n paymentMethod: $paymentMethod,\n firstName: $firstName,\n lastName: $lastName,\n line1: $line1,\n line2: $line2,\n city: $city,\n state: $state,\n postcode: $postcode,\n country: $country\n )\n}`;\n\n/** Captures the PayPal order the learner approved in the PayPal buttons\n * (tCheckoutPlaceOrder with paymentMethod \"PAYPAL\" created it). */\nexport const CAPTURE_PAYPAL_ORDER = `mutation CapturePaypalOrder($biId: String!, $paypalOrderId: String!) {\n tCheckoutCapturePaypalOrder(biId: $biId, paypalOrderId: $paypalOrderId)\n}`;\n\n/** The learner closed the PayPal window without approving — settles the\n * attempt as a failed payment so the checkout can be retried. */\nexport const CANCEL_PAYPAL_ORDER = `mutation CancelPaypalOrder($biId: String!, $paypalOrderId: String!) {\n tCheckoutCancelPaypalOrder(biId: $biId, paypalOrderId: $paypalOrderId)\n}`;\n\n// ─── Program details ──────────────────────────────────────────────────────────\n\n/** Catalog ids (`maId`) of the courses in a program. `tCourseRuns` looks up\n * course run keys by this id, not by the Viax uid or `tCourseKey`. */\nexport const GET_PROGRAM_COURSE_IDS = `query GetProgramCourseIds($filter: String!) {\n filterTwouProgram(_first: 1, _filter: $filter) {\n edges {\n node {\n tCourses { maId }\n }\n }\n }\n}`;\n\n/** Fetch a program's catalog/marketing details by tProgramUuid (program analog of\n * GET_COURSE_DETAIL, which filters courses by tCourseKey). */\nexport const GET_PROGRAM_DETAIL = `query GetProgramDetail($filter: String!) {\n filterTwouProgram(_first: 1, _filter: $filter) {\n edges {\n node {\n uid\n tProgramUuid\n tEffortLow\n tEnrollmentCount\n tMarketingSlug\n tSkills\n tFaq\n tLevelType\n tCourses {\n id\n maName\n uid\n tCourseKey\n tShortDescription\n maDescription\n tBrandText\n tOrgLogoUrl\n imageUrl\n tUrlCourse\n tMarketingSlug\n tStatus { code }\n }\n }\n }\n }\n}`;\n\n// ─── Banner details (PDP banner before checkout) ─────────────────────────────\n\n/** Fetch a course's full catalog/marketing details by tCourseKey for the PDP banner. */\nexport const GET_BANNER_COURSE_DETAIL = `query GetBannerCourseDetail($filter: String!) {\n filterTwouCourse(_first: 1, _filter: $filter) {\n edges {\n node {\n maName\n tEnrollmentCount\n tAlacartePurchasable\n uid\n id\n tCourseKey\n tShortDescription\n maDescription\n tBrandText\n tOrgLogoUrl\n imageUrl\n tUrlCourse\n tMarketingSlug\n tLevelType\n tPacingType { code }\n tDurationLow\n tDurationHigh\n tDurationUnit { code }\n tEffortLow\n tEffortHigh\n tEffortUnit { code }\n tLanguage\n tExpectedLearningItems\n tSkills\n tPrerequisites\n tSyllabus\n tFaq\n tTestimonials\n tTranscriptLanguages\n tInstructors {\n tGivenName\n tFamilyName\n tOrganization\n tInstructorUuid\n tSortValue\n }\n }\n }\n }\n}`;\n\n/** Fetch a program's full catalog/marketing details by tProgramUuid for the PDP banner. */\nexport const GET_BANNER_PROGRAM_DETAIL = `query GetBannerProgramDetail($filter: String!) {\n filterTwouProgram(_first: 1, _filter: $filter) {\n edges {\n node {\n uid\n tProgramUuid\n tEffortLow\n tEnrollmentCount\n tMarketingSlug\n tAlacartePurchasable\n tSkills\n tFaq\n tLevelType\n imageUrl\n tBannerImageUrl\n tCourses {\n id\n maName\n uid\n tCourseKey\n tShortDescription\n maDescription\n tBrandText\n tOrgLogoUrl\n tCourseKey\n imageUrl\n tUrlCourse\n tMarketingSlug\n tStatus { code }\n }\n }\n }\n }\n}`;\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@edx/frontend-app-alacarte-checkout",
3
- "version": "1.35.0",
3
+ "version": "1.37.0",
4
4
  "description": "alacarte Checkout Frontend application",
5
5
  "repository": {
6
6
  "type": "git",