@edx/frontend-app-subscription-manage 1.20.0 → 1.22.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.
@@ -1,6 +1,13 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { Card, Button, Icon } from '@openedx/paragon';
3
+ import { useIntl } from 'react-intl';
3
4
  import { Launch } from '@openedx/paragon/icons';
4
- const OrderHistoryCard = ({ title, purchaseDate, totalCost, orderNumber, isReceiptDisabled = false, onViewReceipt, onViewOrderDetails, }) => (_jsx(Card, { className: "order-card", children: _jsx(Card.Body, { className: "p-3", children: _jsxs("div", { className: "d-flex justify-content-between align-items-start flex-wrap", children: [_jsxs("div", { children: [_jsx("h6", { className: "mb-2", children: title }), _jsxs("div", { className: "d-flex gap-1", children: [_jsxs("div", { className: "x-small", children: [_jsx("p", { className: "text-muted orderHistoryCard__details mr1-1 mb-0", children: "Date of purchase:" }), _jsx("p", { className: "text-muted mr-1 orderHistoryCard__details mb-0", children: "Total cost:" }), _jsx("p", { className: "text-muted mr-1 orderHistoryCard__details mb-0", children: "Order number:" })] }), _jsxs("div", { className: "x-small", children: [_jsx("p", { className: "mb-0", children: purchaseDate }), _jsx("p", { className: "mb-0", children: totalCost }), _jsx("p", { className: "mb-0", children: orderNumber })] })] })] }), _jsxs("div", { className: "d-flex align-items-center gap-3 mt-2 mt-md-auto", children: [_jsxs(Button, { variant: "link", size: "sm", onClick: isReceiptDisabled ? undefined : onViewReceipt, disabled: isReceiptDisabled, className: "d-flex gap-1 p-0 orderHistoryCard__link", children: ["View receipt ", _jsx("span", { children: _jsx(Icon, { size: "xs", src: Launch }) })] }), _jsx(Button, { variant: "link", size: "sm", onClick: onViewOrderDetails, className: "p-0 orderHistoryCard__link", children: "View order details" })] })] }) }) }));
5
+ import messages from './messages';
6
+ const OrderHistoryCard = ({ title, purchaseDate, totalCost, orderNumber, isReceiptDisabled = false, onViewReceipt, onViewOrderDetails, }) => {
7
+ const { formatMessage } = useIntl();
8
+ const receiptDescriptionId = `receipt-description-${orderNumber.replace(/\s+/g, '-').toLowerCase()}`;
9
+ const detailsDescriptionId = `details-description-${orderNumber.replace(/\s+/g, '-').toLowerCase()}`;
10
+ return (_jsx(Card, { className: "order-card", "aria-label": `${title} order details`, children: _jsx(Card.Body, { className: "p-3", children: _jsxs("div", { className: "d-flex justify-content-between align-items-start flex-wrap", children: [_jsxs("div", { children: [_jsx("h6", { className: "mb-2", children: title }), _jsxs("div", { className: "d-flex gap-1", children: [_jsxs("div", { className: "x-small", children: [_jsxs("p", { className: "text-muted orderHistoryCard__details mr1-1 mb-0", children: [formatMessage(messages.dateOfPurchaseLabel), ":"] }), _jsxs("p", { className: "text-muted mr-1 orderHistoryCard__details mb-0", children: [formatMessage(messages.totalCostLabel), ":"] }), _jsxs("p", { className: "text-muted mr-1 orderHistoryCard__details mb-0", children: [formatMessage(messages.orderNumberLabel), ":"] })] }), _jsxs("div", { className: "x-small", children: [_jsx("p", { className: "mb-0", children: purchaseDate }), _jsx("p", { className: "mb-0", children: totalCost }), _jsx("p", { className: "mb-0", children: orderNumber })] })] })] }), _jsxs("div", { className: "d-flex align-items-center gap-3 mt-2 mt-md-auto", children: [_jsxs(Button, { variant: "link", size: "sm", onClick: isReceiptDisabled ? undefined : onViewReceipt, disabled: isReceiptDisabled, className: "d-flex gap-1 p-0 orderHistoryCard__link", "aria-describedby": receiptDescriptionId, children: [formatMessage(messages.viewReceiptButton), " ", _jsx("span", { children: _jsx(Icon, { size: "xs", src: Launch, "aria-hidden": true }) }), _jsxs("span", { id: receiptDescriptionId, className: "sr-only", children: [' ', "for ", title] })] }), _jsxs(Button, { variant: "link", size: "sm", onClick: onViewOrderDetails, className: "p-0 orderHistoryCard__link", "aria-describedby": detailsDescriptionId, children: [formatMessage(messages.viewOrderDetailsButton), _jsxs("span", { id: detailsDescriptionId, className: "sr-only", children: [' ', "for ", title] })] })] })] }) }) }));
11
+ };
5
12
  export default OrderHistoryCard;
6
13
  //# sourceMappingURL=OrderHistoryCard.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"OrderHistoryCard.js","sourceRoot":"","sources":["../../../src/components/OrderHistory/OrderHistoryCard.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAYhD,MAAM,gBAAgB,GAAG,CAAC,EACxB,KAAK,EACL,YAAY,EACZ,SAAS,EACT,WAAW,EACX,iBAAiB,GAAG,KAAK,EACzB,aAAa,EACb,kBAAkB,GACH,EAAE,EAAE,CAAC,CACpB,KAAC,IAAI,IAAC,SAAS,EAAC,YAAY,YAC1B,KAAC,IAAI,CAAC,IAAI,IAAC,SAAS,EAAC,KAAK,YACxB,eAAK,SAAS,EAAC,4DAA4D,aACzE,0BACE,aAAI,SAAS,EAAC,MAAM,YAAE,KAAK,GAAM,EAEjC,eAAK,SAAS,EAAC,cAAc,aAC3B,eAAK,SAAS,EAAC,SAAS,aACtB,YAAG,SAAS,EAAC,iDAAiD,kCAAsB,EACpF,YAAG,SAAS,EAAC,gDAAgD,4BAAgB,EAC7E,YAAG,SAAS,EAAC,gDAAgD,8BAAkB,IAC3E,EAEN,eAAK,SAAS,EAAC,SAAS,aACtB,YAAG,SAAS,EAAC,MAAM,YAAE,YAAY,GAAK,EACtC,YAAG,SAAS,EAAC,MAAM,YAAE,SAAS,GAAK,EACnC,YAAG,SAAS,EAAC,MAAM,YAAE,WAAW,GAAK,IACjC,IACF,IACF,EAEN,eAAK,SAAS,EAAC,iDAAiD,aAC9D,MAAC,MAAM,IACL,OAAO,EAAC,MAAM,EACd,IAAI,EAAC,IAAI,EACT,OAAO,EAAE,iBAAiB,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,aAAa,EACtD,QAAQ,EAAE,iBAAiB,EAC3B,SAAS,EAAC,yCAAyC,8BAEtC,yBAAM,KAAC,IAAI,IAAC,IAAI,EAAC,IAAI,EAAC,GAAG,EAAE,MAAM,GAAI,GAAO,IAClD,EAET,KAAC,MAAM,IACL,OAAO,EAAC,MAAM,EACd,IAAI,EAAC,IAAI,EACT,OAAO,EAAE,kBAAkB,EAC3B,SAAS,EAAC,4BAA4B,mCAG/B,IACL,IACF,GACI,GACP,CACR,CAAC;AAEF,eAAe,gBAAgB,CAAC","sourcesContent":["import { Card, Button, Icon } from '@openedx/paragon';\nimport { Launch } from '@openedx/paragon/icons';\n\ninterface OrderCardProps {\n title: string,\n purchaseDate: string,\n totalCost: string,\n orderNumber: string,\n isReceiptDisabled?: boolean,\n onViewReceipt: () => void,\n onViewOrderDetails: () => void,\n}\n\nconst OrderHistoryCard = ({\n title,\n purchaseDate,\n totalCost,\n orderNumber,\n isReceiptDisabled = false,\n onViewReceipt,\n onViewOrderDetails,\n}: OrderCardProps) => (\n <Card className=\"order-card\">\n <Card.Body className=\"p-3\">\n <div className=\"d-flex justify-content-between align-items-start flex-wrap\">\n <div>\n <h6 className=\"mb-2\">{title}</h6>\n\n <div className=\"d-flex gap-1\">\n <div className=\"x-small\">\n <p className=\"text-muted orderHistoryCard__details mr1-1 mb-0\">Date of purchase:</p>\n <p className=\"text-muted mr-1 orderHistoryCard__details mb-0\">Total cost:</p>\n <p className=\"text-muted mr-1 orderHistoryCard__details mb-0\">Order number:</p>\n </div>\n\n <div className=\"x-small\">\n <p className=\"mb-0\">{purchaseDate}</p>\n <p className=\"mb-0\">{totalCost}</p>\n <p className=\"mb-0\">{orderNumber}</p>\n </div>\n </div>\n </div>\n\n <div className=\"d-flex align-items-center gap-3 mt-2 mt-md-auto\">\n <Button\n variant=\"link\"\n size=\"sm\"\n onClick={isReceiptDisabled ? undefined : onViewReceipt}\n disabled={isReceiptDisabled}\n className=\"d-flex gap-1 p-0 orderHistoryCard__link\"\n >\n View receipt <span><Icon size=\"xs\" src={Launch} /></span>\n </Button>\n\n <Button\n variant=\"link\"\n size=\"sm\"\n onClick={onViewOrderDetails}\n className=\"p-0 orderHistoryCard__link\"\n >\n View order details\n </Button>\n </div>\n </div>\n </Card.Body>\n </Card>\n);\n\nexport default OrderHistoryCard;\n"]}
1
+ {"version":3,"file":"OrderHistoryCard.js","sourceRoot":"","sources":["../../../src/components/OrderHistory/OrderHistoryCard.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACrC,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAChD,OAAO,QAAQ,MAAM,YAAY,CAAC;AAYlC,MAAM,gBAAgB,GAAG,CAAC,EACxB,KAAK,EACL,YAAY,EACZ,SAAS,EACT,WAAW,EACX,iBAAiB,GAAG,KAAK,EACzB,aAAa,EACb,kBAAkB,GACH,EAAE,EAAE;IACnB,MAAM,EAAE,aAAa,EAAE,GAAG,OAAO,EAAE,CAAC;IACpC,MAAM,oBAAoB,GAAG,uBAAuB,WAAW,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC;IACrG,MAAM,oBAAoB,GAAG,uBAAuB,WAAW,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC;IAErG,OAAO,CACL,KAAC,IAAI,IAAC,SAAS,EAAC,YAAY,gBAAa,GAAG,KAAK,gBAAgB,YAC/D,KAAC,IAAI,CAAC,IAAI,IAAC,SAAS,EAAC,KAAK,YACxB,eAAK,SAAS,EAAC,4DAA4D,aACzE,0BACE,aAAI,SAAS,EAAC,MAAM,YAAE,KAAK,GAAM,EAEjC,eAAK,SAAS,EAAC,cAAc,aAC3B,eAAK,SAAS,EAAC,SAAS,aACtB,aAAG,SAAS,EAAC,iDAAiD,aAAE,aAAa,CAAC,QAAQ,CAAC,mBAAmB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Intl } from 'react-intl';\nimport { Launch } from '@openedx/paragon/icons';\nimport messages from './messages';\n\ninterface OrderCardProps {\n title: string,\n purchaseDate: string,\n totalCost: string,\n orderNumber: string,\n isReceiptDisabled?: boolean,\n onViewReceipt: () => void,\n onViewOrderDetails: () => void,\n}\n\nconst OrderHistoryCard = ({\n title,\n purchaseDate,\n totalCost,\n orderNumber,\n isReceiptDisabled = false,\n onViewReceipt,\n onViewOrderDetails,\n}: OrderCardProps) => {\n const { formatMessage } = useIntl();\n const receiptDescriptionId = `receipt-description-${orderNumber.replace(/\\s+/g, '-').toLowerCase()}`;\n const detailsDescriptionId = `details-description-${orderNumber.replace(/\\s+/g, '-').toLowerCase()}`;\n\n return (\n <Card className=\"order-card\" aria-label={`${title} order details`}>\n <Card.Body className=\"p-3\">\n <div className=\"d-flex justify-content-between align-items-start flex-wrap\">\n <div>\n <h6 className=\"mb-2\">{title}</h6>\n\n <div className=\"d-flex gap-1\">\n <div className=\"x-small\">\n <p className=\"text-muted orderHistoryCard__details mr1-1 mb-0\">{formatMessage(messages.dateOfPurchaseLabel)}:</p>\n <p className=\"text-muted mr-1 orderHistoryCard__details mb-0\">{formatMessage(messages.totalCostLabel)}:</p>\n <p className=\"text-muted mr-1 orderHistoryCard__details mb-0\">{formatMessage(messages.orderNumberLabel)}:</p>\n </div>\n\n <div className=\"x-small\">\n <p className=\"mb-0\">{purchaseDate}</p>\n <p className=\"mb-0\">{totalCost}</p>\n <p className=\"mb-0\">{orderNumber}</p>\n </div>\n </div>\n </div>\n\n <div className=\"d-flex align-items-center gap-3 mt-2 mt-md-auto\">\n <Button\n variant=\"link\"\n size=\"sm\"\n onClick={isReceiptDisabled ? undefined : onViewReceipt}\n disabled={isReceiptDisabled}\n className=\"d-flex gap-1 p-0 orderHistoryCard__link\"\n aria-describedby={receiptDescriptionId}\n >\n {formatMessage(messages.viewReceiptButton)} <span><Icon size=\"xs\" src={Launch} aria-hidden /></span>\n <span id={receiptDescriptionId} className=\"sr-only\">\n {' '}for {title}\n </span>\n </Button>\n\n <Button\n variant=\"link\"\n size=\"sm\"\n onClick={onViewOrderDetails}\n className=\"p-0 orderHistoryCard__link\"\n aria-describedby={detailsDescriptionId}\n >\n {formatMessage(messages.viewOrderDetailsButton)}\n <span id={detailsDescriptionId} className=\"sr-only\">\n {' '}for {title}\n </span>\n </Button>\n </div>\n </div>\n </Card.Body>\n </Card>\n );\n};\n\nexport default OrderHistoryCard;\n"]}
@@ -15,7 +15,7 @@ const formatDate = (isoDate) => (new Date(isoDate).toLocaleDateString('en-US', {
15
15
  day: 'numeric',
16
16
  year: 'numeric',
17
17
  }));
18
- 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 #B4B1A8' } }), _jsx("span", { children: children })] }));
18
+ const ReceiptRow = ({ label, children }) => (_jsxs("div", { className: "d-flex align-items-baseline mb-2", role: "listitem", children: [_jsx("dt", { className: "font-weight-bold text-gray-700", children: label }), _jsx("span", { className: "flex-grow-1 mx-2 text-gray-700", style: { borderBottom: '1px dotted #B4B1A8' }, "aria-hidden": "true" }), _jsx("dd", { className: "mb-0", children: children })] }));
19
19
  const normalizeDiscountCode = (value) => {
20
20
  var _a;
21
21
  if (!value) {
@@ -92,8 +92,8 @@ const OrderReceipt = ({ order }) => {
92
92
  });
93
93
  const orderSummaryRows = getOrderSummaryRows(order, orderDate, subtotal, total, discountAmount, (_d = order.discountCode) !== null && _d !== void 0 ? _d : '');
94
94
  const orderItemRows = getOrderItemRows(order, itemPrice, total, discountAmount);
95
- const renderRows = (rows) => rows.map(({ label, value }) => (_jsx(ReceiptRow, { label: formatMessage(label), children: value }, label.id)));
96
- return (_jsxs(_Fragment, { children: [_jsx("div", { className: "my-2", children: _jsx(Breadcrumb, { ariaLabel: "breadcrumb", links: [{ label: formatMessage(messages.orderHistoryTitle), href: `${ORDER_HISTORY_PATH}?tab=payment-history` }], activeLabel: `${formatMessage(messages.orderDateTitle)}: ${orderDate}` }) }), _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) }), order.itemType === 'program' ? (_jsxs(_Fragment, { children: [_jsxs("div", { className: "mb-2 text-gray-700 mb-1", children: [_jsx("span", { className: "font-weight-bold", children: formatMessage(messages.receiptNameLabel) }), ' ', _jsx("span", { children: order.name })] }), _jsx(ProgramItemsTable, { items: (_e = order.items) !== null && _e !== void 0 ? _e : [], currency: order.total.currency })] })) : 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 })] }));
95
+ const renderRows = (rows, listLabel) => (_jsx("dl", { className: "mb-0", role: "list", "aria-label": listLabel, children: rows.map(({ label, value }) => (_jsx(ReceiptRow, { label: formatMessage(label), children: value }, label.id))) }));
96
+ return (_jsxs("article", { "aria-labelledby": "order-receipt-title", children: [_jsx("div", { className: "my-2", children: _jsx(Breadcrumb, { ariaLabel: "breadcrumb", links: [{ label: formatMessage(messages.orderHistoryTitle), href: `${ORDER_HISTORY_PATH}?tab=payment-history` }], activeLabel: `${formatMessage(messages.orderDateTitle)}: ${orderDate}` }) }), _jsxs("h1", { id: "order-receipt-title", className: "h1 mb-4 mt-4 text-primary-500 orderHistoryTitle", children: [formatMessage(messages.orderDateTitle), ": ", orderDate] }), _jsxs("section", { "aria-labelledby": "order-summary-title", children: [_jsx("h3", { id: "order-summary-title", className: "h3 font-weight-bold mb-3 text-primary-500", children: formatMessage(messages.orderSummaryTitle) }), renderRows(orderSummaryRows, 'Order summary details')] }), _jsx("hr", { className: "my-4 divider" }), _jsxs("section", { "aria-labelledby": "order-items-title", children: [_jsx("h3", { id: "order-items-title", className: "font-weight-bold mb-3 text-primary-500", children: formatMessage(messages.orderItemsTitle) }), order.itemType === 'program' ? (_jsxs(_Fragment, { children: [_jsxs("div", { className: "mb-2 text-gray-700 mb-1", children: [_jsx("span", { className: "font-weight-bold", children: formatMessage(messages.receiptNameLabel) }), ' ', _jsx("span", { children: order.name })] }), _jsx(ProgramItemsTable, { items: (_e = order.items) !== null && _e !== void 0 ? _e : [], currency: order.total.currency })] })) : renderRows(orderItemRows, 'Order item details')] }), _jsx("hr", { className: "my-4 divider" }), _jsxs("section", { "aria-labelledby": "payment-title", children: [_jsx("h3", { id: "payment-title", className: "font-weight-bold mb-3 text-primary-500", children: formatMessage(messages.paymentTitle) }), _jsx("dl", { className: "mb-0", role: "list", "aria-label": "Payment details", children: _jsx(ReceiptRow, { label: formatMessage(messages.receiptAmountLabel), children: total }) })] })] }));
97
97
  };
98
98
  const OrderHistoryDetails = () => {
99
99
  const { formatMessage } = useIntl();
@@ -1 +1 @@
1
- {"version":3,"file":"OrderHistoryDetails.js","sourceRoot":"","sources":["../../../src/components/OrderHistory/OrderHistoryDetails.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAChC,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AACzE,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAGjD,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,oBAAoB,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,mC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CAAC,QAAQ,CAAC,aAAa,CAAC,GAAI,GACnF,CACP,CAAC;IACJ,CAAC;SAAM,CAAC;QACN,OAAO,GAAG,KAAK;YACb,CAAC,CAAC,KAAC,YAAY,IAAC,KAAK,EAAE,KAAK,GAAI;YAChC,CAAC,CAAC,KAAC,KAAK,IAAC,OAAO,EAAC,SAAS,YAAE,aAAa,CAAC,QAAQ,CAAC,aAAa,CAAC,GAAS,CAAC;IAC/E,CAAC;IAED,OAAO,CACL,KAAC,SAAS,IAAC,KAAK,QAAC,IAAI,EAAC,IAAI,EAAC,SAAS,EAAC,mBAAmB,YACrD,OAAO,GACE,CACb,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,mBAAmB,CAAC","sourcesContent":["import type { ReactNode } from 'react';\nimport { useMemo } from 'react';\nimport { useParams } from 'react-router-dom';\nimport { Alert, Breadcrumb, Container, Spinner } from '@openedx/paragon';\nimport { useIntl } from '@openedx/frontend-base';\n\nimport type { MoneyAmount, OrderDetailsData } from '../../types';\nimport { ORDER_HISTORY_PATH } from '../../constants';\nimport getFormattedCurrency from '../../utils/currency';\nimport { useViaxClient, useViaxSession } from '../../data/hooks/useManageQueries';\nimport { useOrderDetailsQuery } from '../../data/hooks/useOrderHistoryQueries';\nimport messages from './messages';\nimport { getOrderSummaryRows, getOrderItemRows } from './data/receiptRows';\nimport { ProgramItemsTable } from './ProgramItemsTable';\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 #B4B1A8' }}\n />\n <span>{children}</span>\n </div>\n);\n\nconst normalizeDiscountCode = (value?: string | null): string | null => {\n if (!value) {\n return null;\n }\n\n const cleaned = value.split(':')[0]?.trim();\n return cleaned || null;\n};\n\nconst normalizeOrderDetails = (payload: any): OrderDetailsData | null => {\n if (!payload || typeof payload !== 'object') {\n return null;\n }\n\n const order = payload.order ?? payload;\n if (!order || typeof order !== 'object') {\n return null;\n }\n\n const totals = order.totals ?? {\n amount: order.amount ?? 0,\n currency: order.currency ?? 'USD',\n };\n const currency = String(order.pricing?.total?.currency ?? totals.currency ?? 'USD');\n const money = (amount: unknown): MoneyAmount => ({\n amount: Number.isFinite(Number(amount)) ? Number(amount) : 0,\n currency,\n });\n\n const discounts: any[] | null = Array.isArray(order.pricing?.discounts) ? order.pricing.discounts : null;\n const discountTotal = discounts\n ? discounts.reduce((sum, item) => sum + Number(item?.amount ?? 0), 0)\n : Number(order.totals?.discount ?? order.discount ?? 0);\n const firstDiscount = discounts?.[0];\n const discountCode = normalizeDiscountCode(\n firstDiscount?.code ?? firstDiscount?.offerId ?? order.discountCode ?? null,\n );\n\n const firstItem = Array.isArray(order.items) ? order.items[0] : null;\n const item = firstItem ?? (Array.isArray(order.lines) ? order.lines[0] : null);\n const itemName = String(item?.name ?? item?.productName ?? item?.title ?? order.name ?? 'Order');\n\n const base = {\n orderId: String(order.orderId ?? ''),\n orderNumber: String(order.orderNumber ?? ''),\n purchasedAt: String(order.purchasedAt ?? order.placedAt ?? order.createdAt ?? new Date().toISOString()),\n paymentIntentId: String(order.paymentIntentId ?? ''),\n subtotalAmount: money(order.pricing?.subtotal?.amount),\n itemPriceAmount: money(item?.price?.amount),\n discountCode,\n total: money(order.pricing?.total?.amount ?? totals.paid),\n discountAmount: money(discountTotal),\n };\n\n if (firstItem?.kind === 'program') {\n const programCourses: any[] = Array.isArray(firstItem.courses) ? firstItem.courses : [];\n\n return {\n ...base,\n name: String(firstItem.name ?? itemName),\n itemType: 'program',\n items: programCourses.map((entry) => ({\n productId: entry.productId,\n courseRunKey: entry.courseRunKey,\n name: entry.name ?? itemName,\n price: entry.price ?? money(entry.amount),\n discount: entry.discount ?? money(0),\n total: entry.total ?? money(entry.amount),\n })),\n };\n }\n\n return { ...base, name: itemName, itemType: 'course' };\n};\n\nconst OrderReceipt = ({ order }: { order: OrderDetailsData }) => {\n const { formatMessage } = useIntl();\n const orderDate = formatDate(order.purchasedAt);\n const subtotal = getFormattedCurrency(order.subtotalAmount ?? order.total);\n const itemPrice = getFormattedCurrency(order.itemPriceAmount ?? order.total);\n const total = getFormattedCurrency(order.total);\n const discountValue = order.discountAmount ?? { amount: 0, currency: order.total.currency };\n const discountAmount = getFormattedCurrency({\n amount: -Math.abs(discountValue.amount) || 0,\n currency: discountValue.currency,\n });\n\n const orderSummaryRows = getOrderSummaryRows(\n order,\n orderDate,\n subtotal,\n total,\n discountAmount,\n order.discountCode ?? '',\n );\n const orderItemRows = getOrderItemRows(order, itemPrice, 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 <div className=\"my-2\">\n <Breadcrumb\n ariaLabel=\"breadcrumb\"\n links={[{ label: formatMessage(messages.orderHistoryTitle), href: `${ORDER_HISTORY_PATH}?tab=payment-history` }]}\n activeLabel={`${formatMessage(messages.orderDateTitle)}: ${orderDate}`}\n />\n </div>\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 {order.itemType === 'program' ? (\n <>\n <div className=\"mb-2 text-gray-700 mb-1\">\n <span className=\"font-weight-bold\">{formatMessage(messages.receiptNameLabel)}</span>{' '}\n <span>{order.name}</span>\n </div>\n <ProgramItemsTable items={order.items ?? []} currency={order.total.currency} />\n </>\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 { formatMessage } = useIntl();\n const { orderNumber } = useParams<{ orderNumber: string }>();\n const client = useViaxClient();\n const { sessionReady } = useViaxSession(client);\n const orderDetailsQuery = useOrderDetailsQuery(client, orderNumber ?? null, sessionReady);\n const order = useMemo(() => normalizeOrderDetails(orderDetailsQuery.data), [orderDetailsQuery.data]);\n\n let content: ReactNode;\n if (orderDetailsQuery.isError) {\n content = <Alert variant=\"danger\">{formatMessage(messages.purchaseHistoryError)}</Alert>;\n } else if (!orderDetailsQuery.isSuccess) {\n content = (\n <div className=\"d-flex justify-content-center py-4\">\n <Spinner animation=\"border\" screenReaderText={formatMessage(messages.loadingOrders)} />\n </div>\n );\n } else {\n content = order\n ? <OrderReceipt order={order} />\n : <Alert variant=\"warning\">{formatMessage(messages.orderNotFound)}</Alert>;\n }\n\n return (\n <Container fluid size=\"xl\" className=\"py-4 orderHistory\">\n {content}\n </Container>\n );\n};\n\nexport default OrderHistoryDetails;\n"]}
1
+ {"version":3,"file":"OrderHistoryDetails.js","sourceRoot":"","sources":["../../../src/components/OrderHistory/OrderHistoryDetails.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAChC,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AACzE,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAGjD,OAAO,EAA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AM,EAAE,WAAW,aAAX,WAAW,cAAX,WAAW,GAAI,IAAI,EAAE,YAAY,CAAC,CAAC;IAC1F,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC,qBAAqB,CAAC,iBAAiB,CAAC,IAAI,CAAC,EAAE,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC,CAAC;IAErG,IAAI,OAAkB,CAAC;IACvB,IAAI,iBAAiB,CAAC,OAAO,EAAE,CAAC;QAC9B,OAAO,GAAG,KAAC,KAAK,IAAC,OAAO,EAAC,QAAQ,YAAE,aAAa,CAAC,QAAQ,CAAC,oBAAoB,CAAC,GAAS,CAAC;IAC3F,CAAC;SAAM,IAAI,CAAC,iBAAiB,CAAC,SAAS,EAAE,CAAC;QACxC,OAAO,GAAG,CACR,cAAK,SAAS,EAAC,oCAAoC,YACjD,KAAC,OAAO,IAAC,SAAS,EAAC,QAAQ,EAAC,gBAAgB,EAAE,aAAa,CAAC,QAAQ,CAAC,aAAa,CAAC,GAAI,GACnF,CACP,CAAC;IACJ,CAAC;SAAM,CAAC;QACN,OAAO,GAAG,KAAK;YACb,CAAC,CAAC,KAAC,YAAY,IAAC,KAAK,EAAE,KAAK,GAAI;YAChC,CAAC,CAAC,KAAC,KAAK,IAAC,OAAO,EAAC,SAAS,YAAE,aAAa,CAAC,QAAQ,CAAC,aAAa,CAAC,GAAS,CAAC;IAC/E,CAAC;IAED,OAAO,CACL,KAAC,SAAS,IAAC,KAAK,QAAC,IAAI,EAAC,IAAI,EAAC,SAAS,EAAC,mBAAmB,YACrD,OAAO,GACE,CACb,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,mBAAmB,CAAC","sourcesContent":["import type { ReactNode } from 'react';\nimport { useMemo } from 'react';\nimport { useParams } from 'react-router-dom';\nimport { Alert, Breadcrumb, Container, Spinner } from '@openedx/paragon';\nimport { useIntl } from '@openedx/frontend-base';\n\nimport type { MoneyAmount, OrderDetailsData } from '../../types';\nimport { ORDER_HISTORY_PATH } from '../../constants';\nimport getFormattedCurrency from '../../utils/currency';\nimport { useViaxClient, useViaxSession } from '../../data/hooks/useManageQueries';\nimport { useOrderDetailsQuery } from '../../data/hooks/useOrderHistoryQueries';\nimport messages from './messages';\nimport { getOrderSummaryRows, getOrderItemRows } from './data/receiptRows';\nimport { ProgramItemsTable } from './ProgramItemsTable';\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\" role=\"listitem\">\n <dt className=\"font-weight-bold text-gray-700\">{label}</dt>\n <span\n className=\"flex-grow-1 mx-2 text-gray-700\"\n style={{ borderBottom: '1px dotted #B4B1A8' }}\n aria-hidden=\"true\"\n />\n <dd className=\"mb-0\">{children}</dd>\n </div>\n);\n\nconst normalizeDiscountCode = (value?: string | null): string | null => {\n if (!value) {\n return null;\n }\n\n const cleaned = value.split(':')[0]?.trim();\n return cleaned || null;\n};\n\nconst normalizeOrderDetails = (payload: any): OrderDetailsData | null => {\n if (!payload || typeof payload !== 'object') {\n return null;\n }\n\n const order = payload.order ?? payload;\n if (!order || typeof order !== 'object') {\n return null;\n }\n\n const totals = order.totals ?? {\n amount: order.amount ?? 0,\n currency: order.currency ?? 'USD',\n };\n const currency = String(order.pricing?.total?.currency ?? totals.currency ?? 'USD');\n const money = (amount: unknown): MoneyAmount => ({\n amount: Number.isFinite(Number(amount)) ? Number(amount) : 0,\n currency,\n });\n\n const discounts: any[] | null = Array.isArray(order.pricing?.discounts) ? order.pricing.discounts : null;\n const discountTotal = discounts\n ? discounts.reduce((sum, item) => sum + Number(item?.amount ?? 0), 0)\n : Number(order.totals?.discount ?? order.discount ?? 0);\n const firstDiscount = discounts?.[0];\n const discountCode = normalizeDiscountCode(\n firstDiscount?.code ?? firstDiscount?.offerId ?? order.discountCode ?? null,\n );\n\n const firstItem = Array.isArray(order.items) ? order.items[0] : null;\n const item = firstItem ?? (Array.isArray(order.lines) ? order.lines[0] : null);\n const itemName = String(item?.name ?? item?.productName ?? item?.title ?? order.name ?? 'Order');\n\n const base = {\n orderId: String(order.orderId ?? ''),\n orderNumber: String(order.orderNumber ?? ''),\n purchasedAt: String(order.purchasedAt ?? order.placedAt ?? order.createdAt ?? new Date().toISOString()),\n paymentIntentId: String(order.paymentIntentId ?? ''),\n subtotalAmount: money(order.pricing?.subtotal?.amount),\n itemPriceAmount: money(item?.price?.amount),\n discountCode,\n total: money(order.pricing?.total?.amount ?? totals.paid),\n discountAmount: money(discountTotal),\n };\n\n if (firstItem?.kind === 'program') {\n const programCourses: any[] = Array.isArray(firstItem.courses) ? firstItem.courses : [];\n\n return {\n ...base,\n name: String(firstItem.name ?? itemName),\n itemType: 'program',\n items: programCourses.map((entry) => ({\n productId: entry.productId,\n courseRunKey: entry.courseRunKey,\n name: entry.name ?? itemName,\n price: entry.price ?? money(entry.amount),\n discount: entry.discount ?? money(0),\n total: entry.total ?? money(entry.amount),\n })),\n };\n }\n\n return { ...base, name: itemName, itemType: 'course' };\n};\n\nconst OrderReceipt = ({ order }: { order: OrderDetailsData }) => {\n const { formatMessage } = useIntl();\n const orderDate = formatDate(order.purchasedAt);\n const subtotal = getFormattedCurrency(order.subtotalAmount ?? order.total);\n const itemPrice = getFormattedCurrency(order.itemPriceAmount ?? order.total);\n const total = getFormattedCurrency(order.total);\n const discountValue = order.discountAmount ?? { amount: 0, currency: order.total.currency };\n const discountAmount = getFormattedCurrency({\n amount: -Math.abs(discountValue.amount) || 0,\n currency: discountValue.currency,\n });\n\n const orderSummaryRows = getOrderSummaryRows(\n order,\n orderDate,\n subtotal,\n total,\n discountAmount,\n order.discountCode ?? '',\n );\n const orderItemRows = getOrderItemRows(order, itemPrice, total, discountAmount);\n\n const renderRows = (\n rows: typeof orderSummaryRows | typeof orderItemRows,\n listLabel: string,\n ) => (\n <dl className=\"mb-0\" role=\"list\" aria-label={listLabel}>\n {rows.map(({ label, value }) => (\n <ReceiptRow key={label.id} label={formatMessage(label)}>\n {value}\n </ReceiptRow>\n ))}\n </dl>\n );\n\n return (\n <article aria-labelledby=\"order-receipt-title\">\n <div className=\"my-2\">\n <Breadcrumb\n ariaLabel=\"breadcrumb\"\n links={[{ label: formatMessage(messages.orderHistoryTitle), href: `${ORDER_HISTORY_PATH}?tab=payment-history` }]}\n activeLabel={`${formatMessage(messages.orderDateTitle)}: ${orderDate}`}\n />\n </div>\n <h1 id=\"order-receipt-title\" className=\"h1 mb-4 mt-4 text-primary-500 orderHistoryTitle\">\n {formatMessage(messages.orderDateTitle)}: {orderDate}\n </h1>\n\n <section aria-labelledby=\"order-summary-title\">\n <h3 id=\"order-summary-title\" className=\"h3 font-weight-bold mb-3 text-primary-500\">\n {formatMessage(messages.orderSummaryTitle)}\n </h3>\n {renderRows(orderSummaryRows, 'Order summary details')}\n </section>\n\n <hr className=\"my-4 divider\" />\n\n <section aria-labelledby=\"order-items-title\">\n <h3 id=\"order-items-title\" className=\"font-weight-bold mb-3 text-primary-500\">\n {formatMessage(messages.orderItemsTitle)}\n </h3>\n {order.itemType === 'program' ? (\n <>\n <div className=\"mb-2 text-gray-700 mb-1\">\n <span className=\"font-weight-bold\">{formatMessage(messages.receiptNameLabel)}</span>{' '}\n <span>{order.name}</span>\n </div>\n <ProgramItemsTable items={order.items ?? []} currency={order.total.currency} />\n </>\n ) : renderRows(orderItemRows, 'Order item details')}\n </section>\n\n <hr className=\"my-4 divider\" />\n\n <section aria-labelledby=\"payment-title\">\n <h3 id=\"payment-title\" className=\"font-weight-bold mb-3 text-primary-500\">\n {formatMessage(messages.paymentTitle)}\n </h3>\n <dl className=\"mb-0\" role=\"list\" aria-label=\"Payment details\">\n <ReceiptRow label={formatMessage(messages.receiptAmountLabel)}>\n {total}\n </ReceiptRow>\n </dl>\n </section>\n </article>\n );\n};\n\nconst OrderHistoryDetails = () => {\n const { formatMessage } = useIntl();\n const { orderNumber } = useParams<{ orderNumber: string }>();\n const client = useViaxClient();\n const { sessionReady } = useViaxSession(client);\n const orderDetailsQuery = useOrderDetailsQuery(client, orderNumber ?? null, sessionReady);\n const order = useMemo(() => normalizeOrderDetails(orderDetailsQuery.data), [orderDetailsQuery.data]);\n\n let content: ReactNode;\n if (orderDetailsQuery.isError) {\n content = <Alert variant=\"danger\">{formatMessage(messages.purchaseHistoryError)}</Alert>;\n } else if (!orderDetailsQuery.isSuccess) {\n content = (\n <div className=\"d-flex justify-content-center py-4\">\n <Spinner animation=\"border\" screenReaderText={formatMessage(messages.loadingOrders)} />\n </div>\n );\n } else {\n content = order\n ? <OrderReceipt order={order} />\n : <Alert variant=\"warning\">{formatMessage(messages.orderNotFound)}</Alert>;\n }\n\n return (\n <Container fluid size=\"xl\" className=\"py-4 orderHistory\">\n {content}\n </Container>\n );\n};\n\nexport default OrderHistoryDetails;\n"]}
@@ -5,7 +5,7 @@ import { ORDER_DETAILS_PATH } from '../../constants';
5
5
  import OrderHistoryCard from './OrderHistoryCard';
6
6
  const OrdersList = ({ orders, onViewReceipt }) => {
7
7
  const navigate = useNavigate();
8
- return (_jsx("div", { children: orders.map((order) => (_jsx("div", { className: "mb-3", children: _jsx(OrderHistoryCard, { title: order.name, purchaseDate: new Date(order.purchasedAt).toLocaleDateString('en-US'), totalCost: getFormattedCurrency(order.total), orderNumber: order.orderNumber,
8
+ return (_jsx("ul", { className: "list-unstyled mb-0", role: "list", children: orders.map((order) => (_jsx("li", { className: "mb-3", role: "listitem", children: _jsx(OrderHistoryCard, { title: order.name, purchaseDate: new Date(order.purchasedAt).toLocaleDateString('en-US'), totalCost: getFormattedCurrency(order.total), orderNumber: order.orderNumber,
9
9
  // TODO: Enable when paymentMethodType is in the API response.
10
10
  isReceiptDisabled: false, onViewReceipt: () => onViewReceipt === null || onViewReceipt === void 0 ? void 0 : onViewReceipt(order), onViewOrderDetails: () => navigate(`${ORDER_DETAILS_PATH}/${encodeURIComponent(order.orderNumber)}`) }) }, order.orderId))) }));
11
11
  };
@@ -1 +1 @@
1
- {"version":3,"file":"OrderList.js","sourceRoot":"","sources":["../../../src/components/OrderHistory/OrderList.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/C,OAAO,oBAAoB,MAAM,sBAAsB,CAAC;AAExD,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,gBAAgB,MAAM,oBAAoB,CAAC;AAElD,MAAM,UAAU,GAAG,CAAC,EAAE,MAAM,EAAE,aAAa,EAAmB,EAAE,EAAE;IAChE,MAAM,QAAQ,GAAG,WAAW,EAAE,CAAC;IAE/B,OAAO,CACL,wBACG,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,oBAAoB,CAAC,KAAK,CAAC,KAAK,CAAC,EAC5C,WAAW,EAAE,KAAK,CAAC,WAAW;gBAC9B,8DAA8D;gBAC9D,iBAAiB,EAAE,KAAK,EACxB,aAAa,EAAE,GAAG,EAAE,CAAC,aAAa,aAAb,aAAa,uBAAb,aAAa,CAAG,KAAK,CAAC,EAC3C,kBAAkB,EAAE,GAAG,EAAE,CAAC,QAAQ,CAAC,GAAG,kBAAkB,IAAI,kBAAkB,CAAC,KAAK,CAAC,WAAW,CAAC,EAAE,CAAC,GACpG,IAVM,KAAK,CAAC,OAAO,CAWjB,CACP,CAAC,GACE,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,UAAU,CAAC","sourcesContent":["import { useNavigate } from 'react-router-dom';\n\nimport getFormattedCurrency from '../../utils/currency';\nimport type { OrdersListProps } from '../../types';\nimport { ORDER_DETAILS_PATH } from '../../constants';\nimport OrderHistoryCard from './OrderHistoryCard';\n\nconst OrdersList = ({ orders, onViewReceipt }: OrdersListProps) => {\n const navigate = useNavigate();\n\n return (\n <div>\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={getFormattedCurrency(order.total)}\n orderNumber={order.orderNumber}\n // TODO: Enable when paymentMethodType is in the API response.\n isReceiptDisabled={false}\n onViewReceipt={() => onViewReceipt?.(order)}\n onViewOrderDetails={() => navigate(`${ORDER_DETAILS_PATH}/${encodeURIComponent(order.orderNumber)}`)}\n />\n </div>\n ))}\n </div>\n );\n};\n\nexport default OrdersList;\n"]}
1
+ {"version":3,"file":"OrderList.js","sourceRoot":"","sources":["../../../src/components/OrderHistory/OrderList.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/C,OAAO,oBAAoB,MAAM,sBAAsB,CAAC;AAExD,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,gBAAgB,MAAM,oBAAoB,CAAC;AAElD,MAAM,UAAU,GAAG,CAAC,EAAE,MAAM,EAAE,aAAa,EAAmB,EAAE,EAAE;IAChE,MAAM,QAAQ,GAAG,WAAW,EAAE,CAAC;IAE/B,OAAO,CACL,aAAI,SAAS,EAAC,oBAAoB,EAAC,IAAI,EAAC,MAAM,YAC3C,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CACrB,aAAwB,SAAS,EAAC,MAAM,EAAC,IAAI,EAAC,UAAU,YACtD,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,oBAAoB,CAAC,KAAK,CAAC,KAAK,CAAC,EAC5C,WAAW,EAAE,KAAK,CAAC,WAAW;gBAC9B,8DAA8D;gBAC9D,iBAAiB,EAAE,KAAK,EACxB,aAAa,EAAE,GAAG,EAAE,CAAC,aAAa,aAAb,aAAa,uBAAb,aAAa,CAAG,KAAK,CAAC,EAC3C,kBAAkB,EAAE,GAAG,EAAE,CAAC,QAAQ,CAAC,GAAG,kBAAkB,IAAI,kBAAkB,CAAC,KAAK,CAAC,WAAW,CAAC,EAAE,CAAC,GACpG,IAVK,KAAK,CAAC,OAAO,CAWjB,CACN,CAAC,GACC,CACN,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,UAAU,CAAC","sourcesContent":["import { useNavigate } from 'react-router-dom';\n\nimport getFormattedCurrency from '../../utils/currency';\nimport type { OrdersListProps } from '../../types';\nimport { ORDER_DETAILS_PATH } from '../../constants';\nimport OrderHistoryCard from './OrderHistoryCard';\n\nconst OrdersList = ({ orders, onViewReceipt }: OrdersListProps) => {\n const navigate = useNavigate();\n\n return (\n <ul className=\"list-unstyled mb-0\" role=\"list\">\n {orders.map((order) => (\n <li key={order.orderId} className=\"mb-3\" role=\"listitem\">\n <OrderHistoryCard\n title={order.name}\n purchaseDate={new Date(order.purchasedAt).toLocaleDateString('en-US')}\n totalCost={getFormattedCurrency(order.total)}\n orderNumber={order.orderNumber}\n // TODO: Enable when paymentMethodType is in the API response.\n isReceiptDisabled={false}\n onViewReceipt={() => onViewReceipt?.(order)}\n onViewOrderDetails={() => navigate(`${ORDER_DETAILS_PATH}/${encodeURIComponent(order.orderNumber)}`)}\n />\n </li>\n ))}\n </ul>\n );\n};\n\nexport default OrdersList;\n"]}
@@ -38,7 +38,7 @@ const OrderPurchases = () => {
38
38
  console.error('Unable to load payment receipt.', error);
39
39
  }
40
40
  });
41
- return (_jsxs("section", { className: "manage-section mt-5", "aria-labelledby": "order-purchases-title", children: [_jsx("h2", { id: "order-purchases-title", className: "manage-section__title h3 font-weight-bold text-primary-500 mb-1", children: formatMessage(messages.otherPurchasesTitle) }), purchaseHistoryQuery.isError && (_jsx(Alert, { variant: "danger", children: formatMessage(messages.purchaseHistoryError) })), !purchaseHistoryQuery.isError && !purchaseHistoryQuery.isSuccess && (_jsx("div", { className: "d-flex justify-content-center py-4", children: _jsx(Spinner, { animation: "border", screenReaderText: formatMessage(messages.loadingOrders) }) })), purchaseHistoryQuery.isSuccess && orders.length === 0 && (_jsx("p", { className: "manage-section__subtitle text-gray-700 mb-3", children: formatMessage(messages.coursePurchasesEmptyMessage) })), purchaseHistoryQuery.isSuccess && orders.length > 0 && (_jsxs(_Fragment, { children: [_jsx(OrdersList, { orders: orders, onViewReceipt: handleViewReceipt }), _jsx(RefundNotice, {})] }))] }));
41
+ return (_jsxs("section", { className: "manage-section mt-5", "aria-labelledby": "order-purchases-title", "aria-live": "polite", "aria-busy": purchaseHistoryQuery.isLoading || purchaseHistoryQuery.isFetching, children: [_jsx("h2", { id: "order-purchases-title", className: "manage-section__title h3 font-weight-bold text-primary-500 mb-1", children: formatMessage(messages.otherPurchasesTitle) }), purchaseHistoryQuery.isError && (_jsx(Alert, { variant: "danger", children: formatMessage(messages.purchaseHistoryError) })), !purchaseHistoryQuery.isError && !purchaseHistoryQuery.isSuccess && (_jsx("div", { className: "d-flex justify-content-center py-4", children: _jsx(Spinner, { animation: "border", screenReaderText: formatMessage(messages.loadingOrders) }) })), purchaseHistoryQuery.isSuccess && orders.length === 0 && (_jsx("p", { className: "manage-section__subtitle text-gray-700 mb-3", children: formatMessage(messages.coursePurchasesEmptyMessage) })), purchaseHistoryQuery.isSuccess && orders.length > 0 && (_jsxs(_Fragment, { children: [_jsx(OrdersList, { orders: orders, onViewReceipt: handleViewReceipt }), _jsx(RefundNotice, {})] }))] }));
42
42
  };
43
43
  export default OrderPurchases;
44
44
  //# sourceMappingURL=OrderPurchases.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"OrderPurchases.js","sourceRoot":"","s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YACf,OAAO,CAAC,KAAK,CAAC,iCAAiC,EAAE,KAAK,CAAC,CAAC;QAC1D,CAAC;IACH,CAAC,CAAA,CAAC;IAEF,OAAO,CACL,mBAAS,SAAS,EAAC,qBAAqB,qBAAiB,uBAAuB,aAC9E,aAAI,EAAE,EAAC,uBAAuB,EAAC,SAAS,EAAC,iEAAiE,YACvG,aAAa,CAAC,QAAQ,CAAC,mBAAmB,CAAC,GACzC,EAEJ,oBAAoB,CAAC,OAAO,IAAI,CAC/B,KAAC,KAAK,IAAC,OAAO,EAAC,QAAQ,YAAE,aAAa,CAAC,QAAQ,CAAC,oBAAoB,CAAC,GAAS,CAC/E,EAEA,CAAC,oBAAoB,CAAC,OAAO,IAAI,CAAC,oBAAoB,CAAC,SAAS,IAAI,CACnE,cAAK,SAAS,EAAC,oCAAoC,YACjD,KAAC,OAAO,IAAC,SAAS,EAAC,QAAQ,EAAC,gBAAgB,EAAE,aAAa,CAAC,QAAQ,CAAC,aAAa,CAAC,GAAI,GACnF,CACP,EAEA,oBAAoB,CAAC,SAAS,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,IAAI,CACxD,YAAG,SAAS,EAAC,6CAA6C,YACvD,aAAa,CAAC,QAAQ,CAAC,2BAA2B,CAAC,GAClD,CACL,EAEA,oBAAoB,CAAC,SAAS,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,IAAI,CACtD,8BACE,KAAC,UAAU,IAAC,MAAM,EAAE,MAAM,EAAE,aAAa,EAAE,iBAAiB,GAAI,EAChE,KAAC,YAAY,KAAG,IACf,CACJ,IACO,CACX,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,cAAc,CAAC","sourcesContent":["import React from 'react';\nimport { Alert, Spinner } from '@openedx/paragon';\nimport { useIntl } from '@openedx/frontend-base';\n\nimport type { PurchaseHistoryItem } from '../../types';\nimport { getStripePaymentReceipt } from '../../data/services/orderHistory/orderHistory';\nimport { usePurchaseHistoryQuery } from '../../data/hooks/useOrderHistoryQueries';\nimport { useViaxClient, useViaxSession } from '../../data/hooks/useManageQueries';\nimport OrdersList from './OrderList';\nimport RefundNotice from '../RefundNotice/RefundNotice';\nimport messages from './messages';\n\n/** One-off course and program purchases, shown in the payment history tab. */\nconst OrderPurchases: React.FC = () => {\n const { formatMessage } = useIntl();\n const client = useViaxClient();\n const { sessionReady } = useViaxSession(client);\n const purchaseHistoryQuery = usePurchaseHistoryQuery(client, sessionReady);\n const orders = purchaseHistoryQuery.data ?? [];\n\n const handleViewReceipt = async (order: PurchaseHistoryItem) => {\n if (!client || !order.orderId) {\n return;\n }\n\n try {\n const receiptUrl = await getStripePaymentReceipt(client.gql, order.orderId);\n if (receiptUrl) {\n window.open(receiptUrl, '_blank', 'noopener,noreferrer');\n }\n } catch (error) {\n console.error('Unable to load payment receipt.', error);\n }\n };\n\n return (\n <section className=\"manage-section mt-5\" aria-labelledby=\"order-purchases-title\">\n <h2 id=\"order-purchases-title\" className=\"manage-section__title h3 font-weight-bold text-primary-500 mb-1\">\n {formatMessage(messages.otherPurchasesTitle)}\n </h2>\n\n {purchaseHistoryQuery.isError && (\n <Alert variant=\"danger\">{formatMessage(messages.purchaseHistoryError)}</Alert>\n )}\n\n {!purchaseHistoryQuery.isError && !purchaseHistoryQuery.isSuccess && (\n <div className=\"d-flex justify-content-center py-4\">\n <Spinner animation=\"border\" screenReaderText={formatMessage(messages.loadingOrders)} />\n </div>\n )}\n\n {purchaseHistoryQuery.isSuccess && orders.length === 0 && (\n <p className=\"manage-section__subtitle text-gray-700 mb-3\">\n {formatMessage(messages.coursePurchasesEmptyMessage)}\n </p>\n )}\n\n {purchaseHistoryQuery.isSuccess && orders.length > 0 && (\n <>\n <OrdersList orders={orders} onViewReceipt={handleViewReceipt} />\n <RefundNotice />\n </>\n )}\n </section>\n );\n};\n\nexport default OrderPurchases;\n"]}
1
+ {"version":3,"file":"OrderPurchases.js","sourceRoot":"","sources":["../../../src/components/OrderHistory/OrderPurchases.tsx"],"names":[],"mappings":";;;;;;;;;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C;QAC1D,CAAC;IACH,CAAC,CAAA,CAAC;IAEF,OAAO,CACL,mBACE,SAAS,EAAC,qBAAqB,qBACf,uBAAuB,eAC7B,QAAQ,eACP,oBAAoB,CAAC,SAAS,IAAI,oBAAoB,CAAC,UAAU,aAE5E,aAAI,EAAE,EAAC,uBAAuB,EAAC,SAAS,EAAC,iEAAiE,YACvG,aAAa,CAAC,QAAQ,CAAC,mBAAmB,CAAC,GACzC,EAEJ,oBAAoB,CAAC,OAAO,IAAI,CAC/B,KAAC,KAAK,IAAC,OAAO,EAAC,QAAQ,YAAE,aAAa,CAAC,QAAQ,CAAC,oBAAoB,CAAC,GAAS,CAC/E,EAEA,CAAC,oBAAoB,CAAC,OAAO,IAAI,CAAC,oBAAoB,CAAC,SAAS,IAAI,CACnE,cAAK,SAAS,EAAC,oCAAoC,YACjD,KAAC,OAAO,IAAC,SAAS,EAAC,QAAQ,EAAC,gBAAgB,EAAE,aAAa,CAAC,QAAQ,CAAC,aAAa,CAAC,GAAI,GACnF,CACP,EAEA,oBAAoB,CAAC,SAAS,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,IAAI,CACxD,YAAG,SAAS,EAAC,6CAA6C,YACvD,aAAa,CAAC,QAAQ,CAAC,2BAA2B,CAAC,GAClD,CACL,EAEA,oBAAoB,CAAC,SAAS,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,IAAI,CACtD,8BACE,KAAC,UAAU,IAAC,MAAM,EAAE,MAAM,EAAE,aAAa,EAAE,iBAAiB,GAAI,EAChE,KAAC,YAAY,KAAG,IACf,CACJ,IACO,CACX,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,cAAc,CAAC","sourcesContent":["import React from 'react';\nimport { Alert, Spinner } from '@openedx/paragon';\nimport { useIntl } from '@openedx/frontend-base';\n\nimport type { PurchaseHistoryItem } from '../../types';\nimport { getStripePaymentReceipt } from '../../data/services/orderHistory/orderHistory';\nimport { usePurchaseHistoryQuery } from '../../data/hooks/useOrderHistoryQueries';\nimport { useViaxClient, useViaxSession } from '../../data/hooks/useManageQueries';\nimport OrdersList from './OrderList';\nimport RefundNotice from '../RefundNotice/RefundNotice';\nimport messages from './messages';\n\n/** One-off course and program purchases, shown in the payment history tab. */\nconst OrderPurchases: React.FC = () => {\n const { formatMessage } = useIntl();\n const client = useViaxClient();\n const { sessionReady } = useViaxSession(client);\n const purchaseHistoryQuery = usePurchaseHistoryQuery(client, sessionReady);\n const orders = purchaseHistoryQuery.data ?? [];\n\n const handleViewReceipt = async (order: PurchaseHistoryItem) => {\n if (!client || !order.orderId) {\n return;\n }\n\n try {\n const receiptUrl = await getStripePaymentReceipt(client.gql, order.orderId);\n if (receiptUrl) {\n window.open(receiptUrl, '_blank', 'noopener,noreferrer');\n }\n } catch (error) {\n console.error('Unable to load payment receipt.', error);\n }\n };\n\n return (\n <section\n className=\"manage-section mt-5\"\n aria-labelledby=\"order-purchases-title\"\n aria-live=\"polite\"\n aria-busy={purchaseHistoryQuery.isLoading || purchaseHistoryQuery.isFetching}\n >\n <h2 id=\"order-purchases-title\" className=\"manage-section__title h3 font-weight-bold text-primary-500 mb-1\">\n {formatMessage(messages.otherPurchasesTitle)}\n </h2>\n\n {purchaseHistoryQuery.isError && (\n <Alert variant=\"danger\">{formatMessage(messages.purchaseHistoryError)}</Alert>\n )}\n\n {!purchaseHistoryQuery.isError && !purchaseHistoryQuery.isSuccess && (\n <div className=\"d-flex justify-content-center py-4\">\n <Spinner animation=\"border\" screenReaderText={formatMessage(messages.loadingOrders)} />\n </div>\n )}\n\n {purchaseHistoryQuery.isSuccess && orders.length === 0 && (\n <p className=\"manage-section__subtitle text-gray-700 mb-3\">\n {formatMessage(messages.coursePurchasesEmptyMessage)}\n </p>\n )}\n\n {purchaseHistoryQuery.isSuccess && orders.length > 0 && (\n <>\n <OrdersList orders={orders} onViewReceipt={handleViewReceipt} />\n <RefundNotice />\n </>\n )}\n </section>\n );\n};\n\nexport default OrderPurchases;\n"]}
@@ -114,5 +114,30 @@ declare const messages: {
114
114
  defaultMessage: string;
115
115
  description: string;
116
116
  };
117
+ viewReceiptButton: {
118
+ id: string;
119
+ defaultMessage: string;
120
+ description: string;
121
+ };
122
+ viewOrderDetailsButton: {
123
+ id: string;
124
+ defaultMessage: string;
125
+ description: string;
126
+ };
127
+ dateOfPurchaseLabel: {
128
+ id: string;
129
+ defaultMessage: string;
130
+ description: string;
131
+ };
132
+ totalCostLabel: {
133
+ id: string;
134
+ defaultMessage: string;
135
+ description: string;
136
+ };
137
+ orderNumberLabel: {
138
+ id: string;
139
+ defaultMessage: string;
140
+ description: string;
141
+ };
117
142
  };
118
143
  export default messages;
@@ -115,6 +115,31 @@ const messages = defineMessages({
115
115
  defaultMessage: 'Total after discount',
116
116
  description: 'Program order items table header for the total after discount column',
117
117
  },
118
+ viewReceiptButton: {
119
+ id: 'viewReceiptButton',
120
+ defaultMessage: 'View receipt',
121
+ description: 'Button text for viewing a payment receipt',
122
+ },
123
+ viewOrderDetailsButton: {
124
+ id: 'viewOrderDetailsButton',
125
+ defaultMessage: 'View order details',
126
+ description: 'Button text for viewing order details',
127
+ },
128
+ dateOfPurchaseLabel: {
129
+ id: 'dateOfPurchaseLabel',
130
+ defaultMessage: 'Date of purchase',
131
+ description: 'Label for the date of purchase in the order history card',
132
+ },
133
+ totalCostLabel: {
134
+ id: 'totalCostLabel',
135
+ defaultMessage: 'Total cost',
136
+ description: 'Label for the total cost in the order history card',
137
+ },
138
+ orderNumberLabel: {
139
+ id: 'orderNumberLabel',
140
+ defaultMessage: 'Order number',
141
+ description: 'Label for the order number in the order history card',
142
+ },
118
143
  });
119
144
  export default messages;
120
145
  //# 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;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Messages({\n orderHistoryTitle: {\n id: 'orderHistoryTitle',\n defaultMessage: 'Order History',\n description: 'Heading for order history',\n },\n otherPurchasesTitle: {\n id: 'orderHistory.coursePayments.otherPurchasesTitle',\n defaultMessage: 'Other purchases',\n description: 'Heading above the list of course and program purchases.',\n },\n coursePurchasesEmptyMessage: {\n id: 'orderHistory.coursePayments.emptyMessage',\n defaultMessage: 'Courses you purchased in the last 180 days will appear here. If possible, please retain receipts for your records.',\n description: 'Message shown when there are no course purchases to display.',\n },\n loadingOrders: {\n id: 'orderHistory.loadingOrders',\n defaultMessage: 'Loading orders…',\n description: 'Loading state while the order history is fetched',\n },\n purchaseHistoryError: {\n id: 'orderHistory.purchaseHistoryError',\n defaultMessage: 'We could not load your orders. Please try again later.',\n description: 'Error alert when the order history fails to load',\n },\n orderNotFound: {\n id: 'orderHistory.orderNotFound',\n defaultMessage: 'We could not find this order.',\n description: 'Shown on the order details page when no matching order exists',\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 receiptTableCourseHeader: {\n id: 'receiptTableCourseHeader',\n defaultMessage: 'Course',\n description: 'Program order items table header for the course name column',\n },\n receiptTablePriceHeader: {\n id: 'receiptTablePriceHeader',\n defaultMessage: 'Price',\n description: 'Program order items table header for the course price column',\n },\n receiptTableDiscountAmountHeader: {\n id: 'receiptTableDiscountAmountHeader',\n defaultMessage: 'Discount amount',\n description: 'Program order items table header for the discount amount column',\n },\n receiptTableTotalAfterDiscountHeader: {\n id: 'receiptTableTotalAfterDiscountHeader',\n defaultMessage: 'Total after discount',\n description: 'Program order items table header for the total after discount column',\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,mBAAmB,EAAE;QACnB,EAAE,EAAE,iDAAiD;QACrD,cAAc,EAAE,iBAAiB;QACjC,WAAW,EAAE,yDAAyD;KACvE;IACD,2BAA2B,EAAE;QAC3B,EAAE,EAAE,0CAA0C;QAC9C,cAAc,EAAE,oHAAoH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gB;QACpB,cAAc,EAAE,YAAY;QAC5B,WAAW,EAAE,oDAAoD;KAClE;IACD,gBAAgB,EAAE;QAChB,EAAE,EAAE,kBAAkB;QACtB,cAAc,EAAE,cAAc;QAC9B,WAAW,EAAE,sDAAsD;KACpE;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 otherPurchasesTitle: {\n id: 'orderHistory.coursePayments.otherPurchasesTitle',\n defaultMessage: 'Other purchases',\n description: 'Heading above the list of course and program purchases.',\n },\n coursePurchasesEmptyMessage: {\n id: 'orderHistory.coursePayments.emptyMessage',\n defaultMessage: 'Courses you purchased in the last 180 days will appear here. If possible, please retain receipts for your records.',\n description: 'Message shown when there are no course purchases to display.',\n },\n loadingOrders: {\n id: 'orderHistory.loadingOrders',\n defaultMessage: 'Loading orders…',\n description: 'Loading state while the order history is fetched',\n },\n purchaseHistoryError: {\n id: 'orderHistory.purchaseHistoryError',\n defaultMessage: 'We could not load your orders. Please try again later.',\n description: 'Error alert when the order history fails to load',\n },\n orderNotFound: {\n id: 'orderHistory.orderNotFound',\n defaultMessage: 'We could not find this order.',\n description: 'Shown on the order details page when no matching order exists',\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 receiptTableCourseHeader: {\n id: 'receiptTableCourseHeader',\n defaultMessage: 'Course',\n description: 'Program order items table header for the course name column',\n },\n receiptTablePriceHeader: {\n id: 'receiptTablePriceHeader',\n defaultMessage: 'Price',\n description: 'Program order items table header for the course price column',\n },\n receiptTableDiscountAmountHeader: {\n id: 'receiptTableDiscountAmountHeader',\n defaultMessage: 'Discount amount',\n description: 'Program order items table header for the discount amount column',\n },\n receiptTableTotalAfterDiscountHeader: {\n id: 'receiptTableTotalAfterDiscountHeader',\n defaultMessage: 'Total after discount',\n description: 'Program order items table header for the total after discount column',\n },\n viewReceiptButton: {\n id: 'viewReceiptButton',\n defaultMessage: 'View receipt',\n description: 'Button text for viewing a payment receipt',\n },\n viewOrderDetailsButton: {\n id: 'viewOrderDetailsButton',\n defaultMessage: 'View order details',\n description: 'Button text for viewing order details',\n },\n dateOfPurchaseLabel: {\n id: 'dateOfPurchaseLabel',\n defaultMessage: 'Date of purchase',\n description: 'Label for the date of purchase in the order history card',\n },\n totalCostLabel: {\n id: 'totalCostLabel',\n defaultMessage: 'Total cost',\n description: 'Label for the total cost in the order history card',\n },\n orderNumberLabel: {\n id: 'orderNumberLabel',\n defaultMessage: 'Order number',\n description: 'Label for the order number in the order history card',\n },\n});\n\nexport default messages;\n"]}
package/dist/routes.js CHANGED
@@ -12,17 +12,13 @@ import { getSubsInitApiUrl } from './data/services/subs/urls';
12
12
  import { subscriptionManageRole } from './constants';
13
13
  import { setCommonTrackingProps, mapSubsInitToTrackingProps } from './tracking/trackingContext';
14
14
  // loader to set common tracking props from subscription init data
15
- let trackingInitialized = false;
16
15
  const subscriptionTrackingLoader = () => __awaiter(void 0, void 0, void 0, function* () {
17
- if (trackingInitialized) {
18
- return null;
19
- }
20
16
  try {
21
17
  const { data } = yield getAuthenticatedHttpClient().get(getSubsInitApiUrl());
22
18
  setCommonTrackingProps(mapSubsInitToTrackingProps(data));
23
- trackingInitialized = true;
24
19
  }
25
20
  catch (_a) {
21
+ setCommonTrackingProps({ isSubscriber: false });
26
22
  // Tracking failures must not block page load
27
23
  }
28
24
  return null;
@@ -1 +1 @@
1
- {"version":3,"file":"routes.js","sourceRoot":"","sources":["../src/routes.tsx"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EACL,mBAAmB,EACnB,0BAA0B,GAC3B,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AACrD,OAAO,EAAE,sBAAsB,EAAE,0BAA0B,EAAE,MAAM,4BAA4B,CAAC;AAEhG,kEAAkE;AAClE,IAAI,mBAAmB,GAAG,KAAK,CAAC;AAChC,MAAM,0BAA0B,GAAG,GAAS,EAAE;IAC5C,IAAI,mBAAmB,EAAE,CAAC;QACxB,OAAO,IAAI,CAAC;IACd,CAAC;IACD,IAAI,CAAC;QACH,MAAM,EAAE,IA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D,CAAC,uCAAuC,CACzF,CAAC;wBACF,OAAO,EAAE,SAAS,EAAE,MAAM,CAAC,OAAO,EAAE,CAAC;oBACvC,CAAC;iBAAA;aACF;YACD;gBACE,IAAI,EAAE,gBAAgB;gBAChB,IAAI;;wBACR,MAAM,MAAM,GAAG,MAAM,MAAM;wBACzB,2CAA2C,CAAC,kCAAkC,CAC/E,CAAC;wBACF,OAAO,EAAE,SAAS,EAAE,MAAM,CAAC,OAAO,EAAE,CAAC;oBACvC,CAAC;iBAAA;aACF;SACF;KACF;IACD;QACE,EAAE,EAAE,8DAA8D;QAClE,IAAI,EAAE,4BAA4B;QAClC,MAAM,EAAE,eAAe;QACvB,MAAM,EAAE;YACN,KAAK,EAAE,CAAC,sBAAsB,CAAC;SAChC;QACK,IAAI;;gBACR,MAAM,MAAM,GAAG,MAAM,MAAM;gBACzB,kDAAkD,CAAC,QAAQ,CAC5D,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 getAuthenticatedHttpClient,\n} from '@openedx/frontend-base';\n\nimport { getSubsInitApiUrl } from './data/services/subs/urls';\nimport { subscriptionManageRole } from './constants';\nimport { setCommonTrackingProps, mapSubsInitToTrackingProps } from './tracking/trackingContext';\n\n// loader to set common tracking props from subscription init data\nlet trackingInitialized = false;\nconst subscriptionTrackingLoader = async () => {\n if (trackingInitialized) {\n return null;\n }\n try {\n const { data } = await getAuthenticatedHttpClient().get(getSubsInitApiUrl());\n setCommonTrackingProps(mapSubsInitToTrackingProps(data));\n trackingInitialized = true;\n } catch {\n // Tracking failures must not block page load\n }\n\n return null;\n};\n\n// composed loader that checks for authentication and sets tracking props\nconst protectedLoader = async (args) => {\n await authenticatedLoader(args);\n await subscriptionTrackingLoader();\n\n return null;\n};\n\nconst routes = [\n {\n id: 'org.openedx.frontend.route.subscription.manage.main',\n path: 'order-history',\n loader: protectedLoader,\n shouldRevalidate: ({ currentUrl, nextUrl }) => currentUrl.pathname !== nextUrl.pathname,\n handle: {\n roles: [subscriptionManageRole],\n },\n async lazy() {\n const module = await import(\n /* webpackChunkName: \"subscription-manage-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\" */ './orderHistory/OrderHistoryPage'\n );\n return { Component: module.default };\n },\n },\n {\n path: 'cancel',\n async lazy() {\n const module = await import(\n /* webpackChunkName: \"CancelSubscriptionPage\" */ './orderHistory/CancelSubscriptionPage'\n );\n return { Component: module.default };\n },\n },\n {\n path: 'cancel/success',\n async lazy() {\n const module = await import(\n /* webpackChunkName: \"CancelSuccessPage\" */ './orderHistory/CancelSuccessPage'\n );\n return { Component: module.default };\n },\n },\n ],\n },\n {\n id: 'org.openedx.frontend.route.subscription.manage.order-details',\n path: 'order-details/:orderNumber',\n loader: protectedLoader,\n handle: {\n roles: [subscriptionManageRole],\n },\n async lazy() {\n const module = await import(\n /* webpackChunkName: \"subscription-manage-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"]}
1
+ {"version":3,"file":"routes.js","sourceRoot":"","sources":["../src/routes.tsx"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EACL,mBAAmB,EACnB,0BAA0B,GAC3B,MAAM,w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["import {\n authenticatedLoader,\n getAuthenticatedHttpClient,\n} from '@openedx/frontend-base';\n\nimport { getSubsInitApiUrl } from './data/services/subs/urls';\nimport { subscriptionManageRole } from './constants';\nimport { setCommonTrackingProps, mapSubsInitToTrackingProps } from './tracking/trackingContext';\n\n// loader to set common tracking props from subscription init data\nconst subscriptionTrackingLoader = async () => {\n try {\n const { data } = await getAuthenticatedHttpClient().get(getSubsInitApiUrl());\n setCommonTrackingProps(mapSubsInitToTrackingProps(data));\n } catch {\n setCommonTrackingProps({ isSubscriber: false });\n // Tracking failures must not block page load\n }\n\n return null;\n};\n\n// composed loader that checks for authentication and sets tracking props\nconst protectedLoader = async (args) => {\n await authenticatedLoader(args);\n await subscriptionTrackingLoader();\n\n return null;\n};\n\nconst routes = [\n {\n id: 'org.openedx.frontend.route.subscription.manage.main',\n path: 'order-history',\n loader: protectedLoader,\n shouldRevalidate: ({ currentUrl, nextUrl }) => currentUrl.pathname !== nextUrl.pathname,\n handle: {\n roles: [subscriptionManageRole],\n },\n async lazy() {\n const module = await import(\n /* webpackChunkName: \"subscription-manage-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\" */ './orderHistory/OrderHistoryPage'\n );\n return { Component: module.default };\n },\n },\n {\n path: 'cancel',\n async lazy() {\n const module = await import(\n /* webpackChunkName: \"CancelSubscriptionPage\" */ './orderHistory/CancelSubscriptionPage'\n );\n return { Component: module.default };\n },\n },\n {\n path: 'cancel/success',\n async lazy() {\n const module = await import(\n /* webpackChunkName: \"CancelSuccessPage\" */ './orderHistory/CancelSuccessPage'\n );\n return { Component: module.default };\n },\n },\n ],\n },\n {\n id: 'org.openedx.frontend.route.subscription.manage.order-details',\n path: 'order-details/:orderNumber',\n loader: protectedLoader,\n handle: {\n roles: [subscriptionManageRole],\n },\n async lazy() {\n const module = await import(\n /* webpackChunkName: \"subscription-manage-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,6 +11,7 @@ export interface CommonTrackingProps {
11
11
  experimentation?: string | null;
12
12
  device_type?: string | null;
13
13
  opt_in?: boolean | null;
14
+ isSubscriber?: boolean;
14
15
  isUserSuspended?: boolean | null | undefined;
15
16
  }
16
17
  export declare const setCommonTrackingProps: (props: CommonTrackingProps) => void;
@@ -2,11 +2,14 @@ import { getAuthenticatedUser } from '@openedx/frontend-base';
2
2
  let commonProps = {};
3
3
  export const setCommonTrackingProps = (props) => {
4
4
  commonProps = Object.assign(Object.assign({}, commonProps), props);
5
+ if (typeof window !== 'undefined' && props.isSubscriber !== undefined) {
6
+ window.__EDX_IS_SUBSCRIBER__ = props.isSubscriber;
7
+ }
5
8
  };
6
9
  export const getCommonTrackingProps = () => commonProps;
7
10
  // Single place that maps the subs/init API response -> tracking props
8
11
  export const mapSubsInitToTrackingProps = (data) => {
9
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
12
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
10
13
  return ({
11
14
  free_trial_status: (_a = data === null || data === void 0 ? void 0 : data.userSubscription) === null || _a === void 0 ? void 0 : _a.trialActive,
12
15
  subscription_status: (_b = data === null || data === void 0 ? void 0 : data.userSubscription) === null || _b === void 0 ? void 0 : _b.status,
@@ -20,7 +23,8 @@ export const mapSubsInitToTrackingProps = (data) => {
20
23
  experimentation: '',
21
24
  device_type: '',
22
25
  opt_in: (_p = data === null || data === void 0 ? void 0 : data.opt_in) !== null && _p !== void 0 ? _p : null,
23
- isUserSuspended: (_r = (_q = data === null || data === void 0 ? void 0 : data.userSubscription) === null || _q === void 0 ? void 0 : _q.tIsUserSuspended) !== null && _r !== void 0 ? _r : null,
26
+ isSubscriber: ((_q = data === null || data === void 0 ? void 0 : data.userSubscription) === null || _q === void 0 ? void 0 : _q.isSubscriber) === true,
27
+ isUserSuspended: (_s = (_r = data === null || data === void 0 ? void 0 : data.userSubscription) === null || _r === void 0 ? void 0 : _r.tIsUserSuspended) !== null && _s !== void 0 ? _s : null,
24
28
  });
25
29
  };
26
30
  //# sourceMappingURL=trackingContext.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"trackingContext.js","sourceRoot":"","sources":["../../src/tracking/trackingContext.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAkB9D,IAAI,WAAW,GAAwB,EAAE,CAAC;AAE1C,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,KAA0B,EAAE,EAAE;IACnE,WAAW,mCAAQ,WAAW,GAAK,KAAK,CAAE,CAAC;AAC7C,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,sBAAsB,GAAG,GAAwB,EAAE,CAAC,WAAW,CAAC;AAE7E,sEAAsE;AACtE,MAAM,CAAC,MAAM,0BAA0B,GAAG,CAAC,IAAS,EAAuB,EAAE;;IAAC,OAAA,CAAC;QAC7E,iBAAiB,EAAE,MAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,gBAAgB,0CAAE,WAAW;QACtD,mBAAmB,EAAE,MAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,gBAAgB,0CAAE,MAAM;QACnD,iBAAiB,EAAE,MAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,gBAAgB,0CAAE,gBAAgB;QAC3D,uBAAuB,EAAE,MAAA,MAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,gBAAgB,0CAAE,qBAAqB,mCAAI,IAAI;QAC9E,qBAAqB,EAAE,MAAA,MAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,gBAAgB,0CAAE,mBAAmB,mCAAI,IAAI;QAC1E,kBAAkB,EAAE,MAAA,MAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,gBAAgB,0CAAE,gBAAgB,mCAAI,IAAI;QACpE,cAAc,EAAE,MAAA,MAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,gBAAgB,0CAAE,aAAa,mCAAI,IAAI;QAC7D,UAAU,EAAE,MAAA,MAAA,oBAAoB,EAAE,0CAAE,KAAK,mCAAI,IAAI;QACjD,UAAU,EAAE,EAAE;QACd,eAAe,EAAE,EAAE;QACnB,WAAW,EAAE,EAAE;QACf,MAAM,EAAE,MAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,MAAM,mCAAI,IAAI;QAC5B,eAAe,EAAE,MAAA,MAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,gBAAgB,0CAAE,gBAAgB,mCAAI,IAAI;KAClE,CAAC,CAAA;CAAA,CAAC","sourcesContent":["import { getAuthenticatedUser } from '@openedx/frontend-base';\n\nexport interface CommonTrackingProps {\n free_trial_status?: string,\n subscription_status?: string,\n subscription_tier?: string,\n subscription_start_date?: string | null,\n subscription_end_date?: string | null,\n current_period_end?: string | null,\n payment_method?: string | null,\n user_email?: string | null,\n session_id?: string | null,\n experimentation?: string | null,\n device_type?: string | null,\n opt_in?: boolean | null,\n isUserSuspended?: boolean | null | undefined,\n}\n\nlet commonProps: CommonTrackingProps = {};\n\nexport const setCommonTrackingProps = (props: CommonTrackingProps) => {\n commonProps = { ...commonProps, ...props };\n};\n\nexport const getCommonTrackingProps = (): CommonTrackingProps => commonProps;\n\n// Single place that maps the subs/init API response -> tracking props\nexport const mapSubsInitToTrackingProps = (data: any): CommonTrackingProps => ({\n free_trial_status: data?.userSubscription?.trialActive,\n subscription_status: data?.userSubscription?.status,\n subscription_tier: data?.userSubscription?.billingFrequency,\n subscription_start_date: data?.userSubscription?.subscriptionStartDate ?? null,\n subscription_end_date: data?.userSubscription?.subscriptionEndDate ?? null,\n current_period_end: data?.userSubscription?.currentPeriodEnd ?? null,\n payment_method: data?.userSubscription?.paymentMethod ?? null,\n user_email: getAuthenticatedUser()?.email ?? null,\n session_id: '',\n experimentation: '',\n device_type: '',\n opt_in: data?.opt_in ?? null,\n isUserSuspended: data?.userSubscription?.tIsUserSuspended ?? null,\n});\n"]}
1
+ {"version":3,"file":"trackingContext.js","sourceRoot":"","sources":["../../src/tracking/trackingContext.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAmB9D,IAAI,WAAW,GAAwB,EAAE,CAAC;AAE1C,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,KAA0B,EAAE,EAAE;IACnE,WAAW,mCAAQ,WAAW,GAAK,KAAK,CAAE,CAAC;IAC3C,IAAI,OAAO,MAAM,KAAK,WAAW,IAAI,KAAK,CAAC,YAAY,KAAK,SAAS,EAAE,CAAC;QACrE,MAAuD,CAAC,qBAAqB,GAAG,KAAK,CAAC,YAAY,CAAC;IACtG,CAAC;AACH,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,sBAAsB,GAAG,GAAwB,EAAE,CAAC,WAAW,CAAC;AAE7E,sEAAsE;AACtE,MAAM,CAAC,MAAM,0BAA0B,GAAG,CAAC,IAAS,EAAuB,EAAE;;IAAC,OAAA,CAAC;QAC7E,iBAAiB,EAAE,MAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,gBAAgB,0CAAE,WAAW;QACtD,mBAAmB,EAAE,MAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,gBAAgB,0CAAE,MAAM;QACnD,iBAAiB,EAAE,MAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,gBAAgB,0CAAE,gBAAgB;QAC3D,uBAAuB,EAAE,MAAA,MAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,gBAAgB,0CAAE,qBAAqB,mCAAI,IAAI;QAC9E,qBAAqB,EAAE,MAAA,MAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,gBAAgB,0CAAE,mBAAmB,mCAAI,IAAI;QAC1E,kBAAkB,EAAE,MAAA,MAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,gBAAgB,0CAAE,gBAAgB,mCAAI,IAAI;QACpE,cAAc,EAAE,MAAA,MAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,gBAAgB,0CAAE,aAAa,mCAAI,IAAI;QAC7D,UAAU,EAAE,MAAA,MAAA,oBAAoB,EAAE,0CAAE,KAAK,mCAAI,IAAI;QACjD,UAAU,EAAE,EAAE;QACd,eAAe,EAAE,EAAE;QACnB,WAAW,EAAE,EAAE;QACf,MAAM,EAAE,MAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,MAAM,mCAAI,IAAI;QAC5B,YAAY,EAAE,CAAA,MAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,gBAAgB,0CAAE,YAAY,MAAK,IAAI;QAC3D,eAAe,EAAE,MAAA,MAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,gBAAgB,0CAAE,gBAAgB,mCAAI,IAAI;KAClE,CAAC,CAAA;CAAA,CAAC","sourcesContent":["import { getAuthenticatedUser } from '@openedx/frontend-base';\n\nexport interface CommonTrackingProps {\n free_trial_status?: string,\n subscription_status?: string,\n subscription_tier?: string,\n subscription_start_date?: string | null,\n subscription_end_date?: string | null,\n current_period_end?: string | null,\n payment_method?: string | null,\n user_email?: string | null,\n session_id?: string | null,\n experimentation?: string | null,\n device_type?: string | null,\n opt_in?: boolean | null,\n isSubscriber?: boolean,\n isUserSuspended?: boolean | null | undefined,\n}\n\nlet commonProps: CommonTrackingProps = {};\n\nexport const setCommonTrackingProps = (props: CommonTrackingProps) => {\n commonProps = { ...commonProps, ...props };\n if (typeof window !== 'undefined' && props.isSubscriber !== undefined) {\n (window as Window & { __EDX_IS_SUBSCRIBER__?: boolean }).__EDX_IS_SUBSCRIBER__ = props.isSubscriber;\n }\n};\n\nexport const getCommonTrackingProps = (): CommonTrackingProps => commonProps;\n\n// Single place that maps the subs/init API response -> tracking props\nexport const mapSubsInitToTrackingProps = (data: any): CommonTrackingProps => ({\n free_trial_status: data?.userSubscription?.trialActive,\n subscription_status: data?.userSubscription?.status,\n subscription_tier: data?.userSubscription?.billingFrequency,\n subscription_start_date: data?.userSubscription?.subscriptionStartDate ?? null,\n subscription_end_date: data?.userSubscription?.subscriptionEndDate ?? null,\n current_period_end: data?.userSubscription?.currentPeriodEnd ?? null,\n payment_method: data?.userSubscription?.paymentMethod ?? null,\n user_email: getAuthenticatedUser()?.email ?? null,\n session_id: '',\n experimentation: '',\n device_type: '',\n opt_in: data?.opt_in ?? null,\n isSubscriber: data?.userSubscription?.isSubscriber === true,\n isUserSuspended: data?.userSubscription?.tIsUserSuspended ?? null,\n});\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@edx/frontend-app-subscription-manage",
3
- "version": "1.20.0",
3
+ "version": "1.22.0",
4
4
  "description": "Subscription Manage Frontend application",
5
5
  "repository": {
6
6
  "type": "git",