@edx/frontend-app-subscription-manage 1.11.0 → 1.13.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.
@@ -16,7 +16,10 @@ const PaymentHistory = ({ subscriber, invoices, isLoading = false, isError = fal
16
16
  const title = formatMessage(invoice.isTrial
17
17
  ? messages['manage.paymentHistory.desc.trial']
18
18
  : messages['manage.paymentHistory.tileTitle']);
19
- return (_jsxs("li", { className: "manage-payment-history__tile bg-white border rounded", children: [_jsx("h3", { className: "manage-payment-history__tile-title h5 font-weight-bold text-primary-500 mb-3", children: title }), _jsxs("dl", { className: "manage-payment-history__meta mb-0", children: [_jsxs("div", { className: "manage-payment-history__meta-row", children: [_jsx("dt", { className: "manage-payment-history__label font-weight-bold text-gray-700 mb-0", children: formatMessage(messages['manage.paymentHistory.startOfService']) }), _jsx("dd", { className: "manage-payment-history__value text-gray-700 mb-0", children: startOfService !== null && startOfService !== void 0 ? startOfService : '—' })] }), _jsxs("div", { className: "manage-payment-history__meta-row", children: [_jsx("dt", { className: "manage-payment-history__label font-weight-bold text-gray-700 mb-0", children: formatMessage(messages['manage.paymentHistory.totalCost']) }), _jsx("dd", { className: "manage-payment-history__value text-gray-700 mb-0", children: formatMoney(invoice.amount, invoice.currency) })] }), _jsxs("div", { className: "manage-payment-history__meta-row", children: [_jsx("dt", { className: "manage-payment-history__label font-weight-bold text-gray-700 mb-0", children: formatMessage(messages['manage.paymentHistory.orderNumber']) }), _jsx("dd", { className: "manage-payment-history__value text-gray-700 mb-0", children: invoice.orderNumber || '—' })] })] })] }, invoice.biId));
19
+ const paymentMethodLabel = invoice.paymentProcessor
20
+ ? formatMessage(messages[`manage.paymentHistory.method.${invoice.paymentProcessor}`])
21
+ : null;
22
+ return (_jsxs("li", { className: "manage-payment-history__tile bg-white border rounded", children: [_jsx("h3", { className: "manage-payment-history__tile-title h5 font-weight-bold text-primary-500 mb-3", children: title }), _jsxs("dl", { className: "manage-payment-history__meta mb-0", children: [_jsxs("div", { className: "manage-payment-history__meta-row", children: [_jsx("dt", { className: "manage-payment-history__label font-weight-bold text-gray-700 mb-0", children: formatMessage(messages['manage.paymentHistory.startOfService']) }), _jsx("dd", { className: "manage-payment-history__value text-gray-700 mb-0", children: startOfService !== null && startOfService !== void 0 ? startOfService : '—' })] }), _jsxs("div", { className: "manage-payment-history__meta-row", children: [_jsx("dt", { className: "manage-payment-history__label font-weight-bold text-gray-700 mb-0", children: formatMessage(messages['manage.paymentHistory.totalCost']) }), _jsx("dd", { className: "manage-payment-history__value text-gray-700 mb-0", children: formatMoney(invoice.amount, invoice.currency) })] }), _jsxs("div", { className: "manage-payment-history__meta-row", children: [_jsx("dt", { className: "manage-payment-history__label font-weight-bold text-gray-700 mb-0", children: formatMessage(messages['manage.paymentHistory.orderNumber']) }), _jsx("dd", { className: "manage-payment-history__value text-gray-700 mb-0", children: invoice.orderNumber || '—' })] }), paymentMethodLabel && (_jsxs("div", { className: "manage-payment-history__meta-row", children: [_jsx("dt", { className: "manage-payment-history__label font-weight-bold text-gray-700 mb-0", children: formatMessage(messages['manage.paymentHistory.paymentMethod']) }), _jsx("dd", { className: "manage-payment-history__value text-gray-700 mb-0", children: paymentMethodLabel })] }))] })] }, invoice.biId));
20
23
  }) }))] }));
21
24
  };
22
25
  export default PaymentHistory;
@@ -1 +1 @@
1
- {"version":3,"file":"PaymentHistory.js","sourceRoot":"","sources":["../../../src/components/PaymentHistory/PaymentHistory.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAGjD,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC9E,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,OAAO,QAAQ,MAAM,aAAa,CAAC;AASnC,MAAM,cAAc,GAAkC,CAAC,EACr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AO,CAAC,WAAW,IAAI,GAAG,GACxB,IACD,IACH,KA/BA,OAAO,CAAC,IAAI,CAgCd,CACN,CAAC;gBACJ,CAAC,CAAC,GACC,CACN,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 { CurrentUserSubscriberResult, PaymentHistoryItem } from '../../types';\nimport { formatDisplayDate, formatNumericDate } from '../../utils/formatDate';\nimport { formatMoney } from '../../utils/invoiceAmount';\nimport messages from '../messages';\n\ninterface PaymentHistoryProps {\n subscriber: CurrentUserSubscriberResult | null,\n invoices: PaymentHistoryItem[],\n isLoading?: boolean,\n isError?: boolean,\n}\n\nconst PaymentHistory: React.FC<PaymentHistoryProps> = ({\n subscriber,\n invoices,\n isLoading = false,\n isError = false,\n}) => {\n const { formatMessage } = useIntl();\n const nextPayment = formatDisplayDate(subscriber?.currentPeriodEnd);\n const hasSubscription = Boolean(subscriber?.subscriptionBiId);\n\n return (\n <section className=\"manage-section manage-payment-history mt-4\">\n <h2 className=\"manage-section__title h3 font-weight-bold text-primary-500 mb-1\">\n {formatMessage(messages['manage.paymentHistory.heading'])}\n </h2>\n\n {nextPayment && (\n <p className=\"manage-section__subtitle text-gray-700 mb-3\">\n {formatMessage(messages['manage.paymentHistory.nextPayment'], {\n date: nextPayment,\n })}\n </p>\n )}\n\n {!hasSubscription && (\n <p className=\"manage-section__subtitle text-gray-700 mb-3\">\n {formatMessage(messages['manage.paymentHistory.noSubscription'])}\n </p>\n )}\n\n {hasSubscription && isLoading && (\n <div className=\"d-flex justify-content-center py-4\">\n <Spinner\n animation=\"border\"\n screenReaderText={formatMessage(messages['manage.loading'])}\n />\n </div>\n )}\n\n {hasSubscription && isError && (\n <Alert variant=\"danger\">\n {formatMessage(messages['manage.paymentHistory.error'])}\n </Alert>\n )}\n\n {hasSubscription && !isLoading && !isError && invoices.length === 0 && (\n <p className=\"manage-section__subtitle text-gray-700 mb-3\">\n {formatMessage(messages['manage.paymentHistory.empty'])}\n </p>\n )}\n\n {hasSubscription && !isLoading && !isError && invoices.length > 0 && (\n <ul className=\"manage-payment-history__tiles list-unstyled mb-0\">\n {invoices.map((invoice) => {\n const startOfService = formatNumericDate(invoice.periodStart)\n ?? formatNumericDate(invoice.billDate);\n const title = formatMessage(\n invoice.isTrial\n ? messages['manage.paymentHistory.desc.trial']\n : messages['manage.paymentHistory.tileTitle'],\n );\n\n return (\n <li\n key={invoice.biId}\n className=\"manage-payment-history__tile bg-white border rounded\"\n >\n <h3 className=\"manage-payment-history__tile-title h5 font-weight-bold text-primary-500 mb-3\">\n {title}\n </h3>\n <dl className=\"manage-payment-history__meta mb-0\">\n <div className=\"manage-payment-history__meta-row\">\n <dt className=\"manage-payment-history__label font-weight-bold text-gray-700 mb-0\">\n {formatMessage(messages['manage.paymentHistory.startOfService'])}\n </dt>\n <dd className=\"manage-payment-history__value text-gray-700 mb-0\">\n {startOfService ?? '—'}\n </dd>\n </div>\n <div className=\"manage-payment-history__meta-row\">\n <dt className=\"manage-payment-history__label font-weight-bold text-gray-700 mb-0\">\n {formatMessage(messages['manage.paymentHistory.totalCost'])}\n </dt>\n <dd className=\"manage-payment-history__value text-gray-700 mb-0\">\n {formatMoney(invoice.amount, invoice.currency)}\n </dd>\n </div>\n <div className=\"manage-payment-history__meta-row\">\n <dt className=\"manage-payment-history__label font-weight-bold text-gray-700 mb-0\">\n {formatMessage(messages['manage.paymentHistory.orderNumber'])}\n </dt>\n <dd className=\"manage-payment-history__value text-gray-700 mb-0\">\n {invoice.orderNumber || '—'}\n </dd>\n </div>\n </dl>\n </li>\n );\n })}\n </ul>\n )}\n </section>\n );\n};\n\nexport default PaymentHistory;\n"]}
1
+ {"version":3,"file":"PaymentHistory.js","sourceRoot":"","sources":["../../../src/components/PaymentHistory/PaymentHistory.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,KAAK,EAAE,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,cAAc,cAAd,cAAc,GAAI,GAAG,GACnB,IACD,EACN,eAAK,SAAS,EAAC,kCAAkC,aAC/C,aAAI,SAAS,EAAC,mEAAmE,YAC9E,aAAa,CAAC,QAAQ,CAAC,iCAAiC,CAAC,CAAC,GACxD,EACL,aAAI,SAAS,EAAC,kDAAkD,YAC7D,WAAW,CAAC,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC,QAAQ,CAAC,GAC3C,IACD,EACN,eAAK,SAAS,EAAC,kCAAkC,aAC/C,aAAI,SAAS,EAAC,mEAAmE,YAC9E,aAAa,CAAC,QAAQ,CAAC,mCAAmC,CAAC,CAAC,GAC1D,EACL,aAAI,SAAS,EAAC,kDAAkD,YAC7D,OAAO,CAAC,WAAW,IAAI,GAAG,GACxB,IACD,EACL,kBAAkB,IAAI,CACrB,eAAK,SAAS,EAAC,kCAAkC,aAC/C,aAAI,SAAS,EAAC,mEAAmE,YAC9E,aAAa,CAAC,QAAQ,CAAC,qCAAqC,CAAC,CAAC,GAC5D,EACL,aAAI,SAAS,EAAC,kDAAkD,YAC7D,kBAAkB,GAChB,IACD,CACP,IACE,KAzCA,OAAO,CAAC,IAAI,CA0Cd,CACN,CAAC;gBACJ,CAAC,CAAC,GACC,CACN,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 { CurrentUserSubscriberResult, PaymentHistoryItem } from '../../types';\nimport { formatDisplayDate, formatNumericDate } from '../../utils/formatDate';\nimport { formatMoney } from '../../utils/invoiceAmount';\nimport messages from '../messages';\n\ninterface PaymentHistoryProps {\n subscriber: CurrentUserSubscriberResult | null,\n invoices: PaymentHistoryItem[],\n isLoading?: boolean,\n isError?: boolean,\n}\n\nconst PaymentHistory: React.FC<PaymentHistoryProps> = ({\n subscriber,\n invoices,\n isLoading = false,\n isError = false,\n}) => {\n const { formatMessage } = useIntl();\n const nextPayment = formatDisplayDate(subscriber?.currentPeriodEnd);\n const hasSubscription = Boolean(subscriber?.subscriptionBiId);\n\n return (\n <section className=\"manage-section manage-payment-history mt-4\">\n <h2 className=\"manage-section__title h3 font-weight-bold text-primary-500 mb-1\">\n {formatMessage(messages['manage.paymentHistory.heading'])}\n </h2>\n\n {nextPayment && (\n <p className=\"manage-section__subtitle text-gray-700 mb-3\">\n {formatMessage(messages['manage.paymentHistory.nextPayment'], {\n date: nextPayment,\n })}\n </p>\n )}\n\n {!hasSubscription && (\n <p className=\"manage-section__subtitle text-gray-700 mb-3\">\n {formatMessage(messages['manage.paymentHistory.noSubscription'])}\n </p>\n )}\n\n {hasSubscription && isLoading && (\n <div className=\"d-flex justify-content-center py-4\">\n <Spinner\n animation=\"border\"\n screenReaderText={formatMessage(messages['manage.loading'])}\n />\n </div>\n )}\n\n {hasSubscription && isError && (\n <Alert variant=\"danger\">\n {formatMessage(messages['manage.paymentHistory.error'])}\n </Alert>\n )}\n\n {hasSubscription && !isLoading && !isError && invoices.length === 0 && (\n <p className=\"manage-section__subtitle text-gray-700 mb-3\">\n {formatMessage(messages['manage.paymentHistory.empty'])}\n </p>\n )}\n\n {hasSubscription && !isLoading && !isError && invoices.length > 0 && (\n <ul className=\"manage-payment-history__tiles list-unstyled mb-0\">\n {invoices.map((invoice) => {\n const startOfService = formatNumericDate(invoice.periodStart)\n ?? formatNumericDate(invoice.billDate);\n const title = formatMessage(\n invoice.isTrial\n ? messages['manage.paymentHistory.desc.trial']\n : messages['manage.paymentHistory.tileTitle'],\n );\n const paymentMethodLabel = invoice.paymentProcessor\n ? formatMessage(messages[`manage.paymentHistory.method.${invoice.paymentProcessor}`])\n : null;\n\n return (\n <li\n key={invoice.biId}\n className=\"manage-payment-history__tile bg-white border rounded\"\n >\n <h3 className=\"manage-payment-history__tile-title h5 font-weight-bold text-primary-500 mb-3\">\n {title}\n </h3>\n <dl className=\"manage-payment-history__meta mb-0\">\n <div className=\"manage-payment-history__meta-row\">\n <dt className=\"manage-payment-history__label font-weight-bold text-gray-700 mb-0\">\n {formatMessage(messages['manage.paymentHistory.startOfService'])}\n </dt>\n <dd className=\"manage-payment-history__value text-gray-700 mb-0\">\n {startOfService ?? '—'}\n </dd>\n </div>\n <div className=\"manage-payment-history__meta-row\">\n <dt className=\"manage-payment-history__label font-weight-bold text-gray-700 mb-0\">\n {formatMessage(messages['manage.paymentHistory.totalCost'])}\n </dt>\n <dd className=\"manage-payment-history__value text-gray-700 mb-0\">\n {formatMoney(invoice.amount, invoice.currency)}\n </dd>\n </div>\n <div className=\"manage-payment-history__meta-row\">\n <dt className=\"manage-payment-history__label font-weight-bold text-gray-700 mb-0\">\n {formatMessage(messages['manage.paymentHistory.orderNumber'])}\n </dt>\n <dd className=\"manage-payment-history__value text-gray-700 mb-0\">\n {invoice.orderNumber || '—'}\n </dd>\n </div>\n {paymentMethodLabel && (\n <div className=\"manage-payment-history__meta-row\">\n <dt className=\"manage-payment-history__label font-weight-bold text-gray-700 mb-0\">\n {formatMessage(messages['manage.paymentHistory.paymentMethod'])}\n </dt>\n <dd className=\"manage-payment-history__value text-gray-700 mb-0\">\n {paymentMethodLabel}\n </dd>\n </div>\n )}\n </dl>\n </li>\n );\n })}\n </ul>\n )}\n </section>\n );\n};\n\nexport default PaymentHistory;\n"]}
@@ -79,6 +79,21 @@ declare const messages: {
79
79
  defaultMessage: string;
80
80
  description: string;
81
81
  };
82
+ 'manage.paymentHistory.paymentMethod': {
83
+ id: string;
84
+ defaultMessage: string;
85
+ description: string;
86
+ };
87
+ 'manage.paymentHistory.method.stripe': {
88
+ id: string;
89
+ defaultMessage: string;
90
+ description: string;
91
+ };
92
+ 'manage.paymentHistory.method.paypal': {
93
+ id: string;
94
+ defaultMessage: string;
95
+ description: string;
96
+ };
82
97
  'manage.paymentHistory.desc.trial': {
83
98
  id: string;
84
99
  defaultMessage: string;
@@ -80,6 +80,21 @@ const messages = defineMessages({
80
80
  defaultMessage: 'Order number:',
81
81
  description: 'Label for order number on payment history tile',
82
82
  },
83
+ 'manage.paymentHistory.paymentMethod': {
84
+ id: 'manage.paymentHistory.paymentMethod',
85
+ defaultMessage: 'Paid with:',
86
+ description: 'Label for the payment method (card or PayPal) on a payment history tile',
87
+ },
88
+ 'manage.paymentHistory.method.stripe': {
89
+ id: 'manage.paymentHistory.method.stripe',
90
+ defaultMessage: 'Card',
91
+ description: 'Payment method value for an invoice billed through Stripe',
92
+ },
93
+ 'manage.paymentHistory.method.paypal': {
94
+ id: 'manage.paymentHistory.method.paypal',
95
+ defaultMessage: 'PayPal',
96
+ description: 'Payment method value for an invoice billed through PayPal',
97
+ },
83
98
  'manage.paymentHistory.desc.trial': {
84
99
  id: 'manage.paymentHistory.desc.trial',
85
100
  defaultMessage: 'edX Plus Subscription — free trial',
@@ -1 +1 @@
1
- {"version":3,"file":"messages.js","sourceRoot":"","sources":["../../src/components/messages.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAExD,MAAM,QAAQ,GAAG,cAAc,CAAC;IAC9B,mBAAmB,EAAE;QACnB,EAAE,EAAE,mBAAmB;QACvB,cAAc,EAAE,4BAA4B;QAC5C,WAAW,EAAE,iDAAiD;KAC/D;IACD,gBAAgB,EAAE;QAChB,EAAE,EAAE,gBAAgB;QACpB,cAAc,EAAE,uBAAuB;QACvC,WAAW,EAAE,gDAAgD;KAC9D;IACD,cAAc,EAAE;QACd,EAAE,EAAE,cAAc;QAClB,cAAc,EAAE,8DAA8D;QAC9E,WAAW,EAAE,2CAA2C;KACzD;IACD,qBAAqB,EAAE;QACrB,EAAE,EAAE,qBAAqB;QACzB,cAAc,EAAE,eAAe;QAC/B,WAAW,EAAE,sDAAsD;KACpE;IACD,wBAAwB,EAAE;QACxB,EAAE,EAAE,wBAAwB;QAC5B,cAAc,EAAE,uDAAuD;QACvE,WAAW,EAAE,mCAAmC;KACjD;IACD,yBAAyB,EAAE;QACzB,EAAE,EAAE,yB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0DAA0D;KACxE;IACD,oBAAoB,EAAE;QACpB,EAAE,EAAE,oBAAoB;QACxB,cAAc,EAAE,0BAA0B;QAC1C,WAAW,EAAE,wCAAwC;KACtD;IACD,uBAAuB,EAAE;QACvB,EAAE,EAAE,uBAAuB;QAC3B,cAAc,EAAE,0BAA0B;QAC1C,WAAW,EAAE,wCAAwC;KACtD;IACD,0BAA0B,EAAE;QAC1B,EAAE,EAAE,0BAA0B;QAC9B,cAAc,EAAE,aAAa;QAC7B,WAAW,EAAE,mDAAmD;KACjE;IACD,qBAAqB,EAAE;QACrB,EAAE,EAAE,qBAAqB;QACzB,cAAc,EAAE,0DAA0D;QAC1E,WAAW,EAAE,kCAAkC;KAChD;IACD,+BAA+B,EAAE;QAC/B,EAAE,EAAE,+BAA+B;QACnC,cAAc,EAAE,kBAAkB;QAClC,WAAW,EAAE,gDAAgD;KAC9D;IAED,iBAAiB;IACjB,4BAA4B,EAAE;QAC5B,EAAE,EAAE,4BAA4B;QAChC,cAAc,EAAE,wEAAwE;QACxF,WAAW,EAAE,2BAA2B;KACzC;IACD,2BAA2B,EAAE;QAC3B,EAAE,EAAE,2BAA2B;QAC/B,cAAc,EAAE,8IAA8I;QAC9J,WAAW,EAAE,oDAAoD;KAClE;IACD,iCAAiC,EAAE;QACjC,EAAE,EAAE,iCAAiC;QACrC,cAAc,EAAE,iIAAiI;QACjJ,WAAW,EAAE,kCAAkC;KAChD;IACD,6BAA6B,EAAE;QAC7B,EAAE,EAAE,6BAA6B;QACjC,cAAc,EAAE,qBAAqB;QACrC,WAAW,EAAE,8CAA8C;KAC5D;CACF,CAAC,CAAC;AAEH,eAAe,QAAQ,CAAC","sourcesContent":["import { defineMessages } from '@openedx/frontend-base';\n\nconst messages = defineMessages({\n 'manage.page.title': {\n id: 'manage.page.title',\n defaultMessage: 'Order History | {siteName}',\n description: 'Document title for the manage subscription page',\n },\n 'manage.loading': {\n id: 'manage.loading',\n defaultMessage: 'Loading subscription…',\n description: 'Loading state for the manage subscription page',\n },\n 'manage.error': {\n id: 'manage.error',\n defaultMessage: 'We could not load your subscription. Please try again later.',\n description: 'Error alert when subscription fetch fails',\n },\n 'manage.header.title': {\n id: 'manage.header.title',\n defaultMessage: 'Order History',\n description: 'Page heading for order history / manage subscription',\n },\n 'manage.header.subtitle': {\n id: 'manage.header.subtitle',\n defaultMessage: 'View previous purchases and manage your subscription.',\n description: 'Page subtitle under Order History',\n },\n 'manage.tab.subscription': {\n id: 'manage.tab.subscription',\n defaultMessage: 'Subscription',\n description: 'Subscription tab label',\n },\n 'manage.tab.paymentHistory': {\n id: 'manage.tab.paymentHistory',\n defaultMessage: 'Payment history',\n description: 'Payment history tab label',\n },\n 'manage.paymentHistory.heading': {\n id: 'manage.paymentHistory.heading',\n defaultMessage: 'Payment history',\n description: 'Heading for the payment history panel',\n },\n 'manage.paymentHistory.nextPayment': {\n id: 'manage.paymentHistory.nextPayment',\n defaultMessage: 'Next payment scheduled for {date}.',\n description: 'Next payment line above the invoice list',\n },\n 'manage.paymentHistory.empty': {\n id: 'manage.paymentHistory.empty',\n defaultMessage: 'No payments yet.',\n description: 'Empty state when the learner has no invoices',\n },\n 'manage.paymentHistory.error': {\n id: 'manage.paymentHistory.error',\n defaultMessage: 'We could not load your payment history. Please try again later.',\n description: 'Error alert when invoice fetch fails',\n },\n 'manage.paymentHistory.noSubscription': {\n id: 'manage.paymentHistory.noSubscription',\n defaultMessage: 'Payment history is available after you subscribe.',\n description: 'Shown when there is no subscriptionBiId to query invoices',\n },\n 'manage.paymentHistory.tileTitle': {\n id: 'manage.paymentHistory.tileTitle',\n defaultMessage: 'edX Plus Subscription',\n description: 'Title on each payment history invoice tile',\n },\n 'manage.paymentHistory.startOfService': {\n id: 'manage.paymentHistory.startOfService',\n defaultMessage: 'Start of service:',\n description: 'Label for invoice period start on payment history tile',\n },\n 'manage.paymentHistory.totalCost': {\n id: 'manage.paymentHistory.totalCost',\n defaultMessage: 'Total cost:',\n description: 'Label for invoice total on payment history tile',\n },\n 'manage.paymentHistory.orderNumber': {\n id: 'manage.paymentHistory.orderNumber',\n defaultMessage: 'Order number:',\n description: 'Label for order number on payment history tile',\n },\n 'manage.paymentHistory.desc.trial': {\n id: 'manage.paymentHistory.desc.trial',\n defaultMessage: 'edX Plus Subscription — free trial',\n description: 'Description for a $0 trial invoice',\n },\n 'manage.paymentHistory.desc.paid': {\n id: 'manage.paymentHistory.desc.paid',\n defaultMessage: 'edX Plus Subscription',\n description: 'Description for a paid subscription invoice',\n },\n 'manage.paymentHistory.status.paid': {\n id: 'manage.paymentHistory.status.paid',\n defaultMessage: 'Paid',\n description: 'Invoice status label: PAID',\n },\n 'manage.paymentHistory.status.open': {\n id: 'manage.paymentHistory.status.open',\n defaultMessage: 'Open',\n description: 'Invoice status label: OPEN',\n },\n 'manage.paymentHistory.status.draft': {\n id: 'manage.paymentHistory.status.draft',\n defaultMessage: 'Draft',\n description: 'Invoice status label: DRAFT',\n },\n 'manage.help.prefix': {\n id: 'manage.help.prefix',\n defaultMessage: 'Need more help? Visit the',\n description: 'Prefix before Learner Help Center link',\n },\n 'manage.help.link': {\n id: 'manage.help.link',\n defaultMessage: 'Learner Help Center',\n description: 'Learner Help Center link text',\n },\n\n // Become a subscriber\n 'manage.none.heading': {\n id: 'manage.none.heading',\n defaultMessage: 'Become a subscriber',\n description: 'Section heading when user has no subscription',\n },\n 'manage.none.subheading': {\n id: 'manage.none.subheading',\n defaultMessage: 'You will manage your subscription here.',\n description: 'Section subheading when user has no subscription',\n },\n 'manage.none.cardTitle': {\n id: 'manage.none.cardTitle',\n defaultMessage: 'Try edX Subscription for free',\n description: 'Upsell card title for non-subscribers',\n },\n 'manage.none.cardBody': {\n id: 'manage.none.cardBody',\n defaultMessage: 'Get access to hundreds of courses for ${price}/month {currency}',\n description: 'Upsell card body including monthly price',\n },\n 'manage.none.cardBodyNoPrice': {\n id: 'manage.none.cardBodyNoPrice',\n defaultMessage: 'Get access to hundreds of courses with edX subscription',\n description: 'Upsell card body when price is unavailable',\n },\n 'manage.none.subscribe': {\n id: 'manage.none.subscribe',\n defaultMessage: 'Subscribe',\n description: 'Primary subscribe CTA',\n },\n 'manage.none.learnMore': {\n id: 'manage.none.learnMore',\n defaultMessage: 'Learn about edX Subscription',\n description: 'Secondary learn-more link on upsell card',\n },\n\n // Active\n 'manage.active.heading': {\n id: 'manage.active.heading',\n defaultMessage: 'Manage your subscription',\n description: 'Section heading for active subscribers',\n },\n 'manage.active.since': {\n id: 'manage.active.since',\n defaultMessage: 'Subscriber since {date}.',\n description: 'Subscriber since date line',\n },\n 'manage.active.statusMonthly': {\n id: 'manage.active.statusMonthly',\n defaultMessage: 'Active, Monthly Plan',\n description: 'Active monthly plan status label',\n },\n 'manage.active.statusAnnual': {\n id: 'manage.active.statusAnnual',\n defaultMessage: 'Active, Annual Plan',\n description: 'Active annual plan status label',\n },\n 'manage.active.nextPayment': {\n id: 'manage.active.nextPayment',\n defaultMessage: 'Your next payment is {date}.',\n description: 'Next payment date line for active subscribers',\n },\n 'manage.active.changeAnnual': {\n id: 'manage.active.changeAnnual',\n defaultMessage: 'Change to annual and save',\n description: 'CTA to switch to annual billing',\n },\n 'manage.active.updatePayment': {\n id: 'manage.active.updatePayment',\n defaultMessage: 'Update payment method',\n description: 'CTA to update payment method',\n },\n 'manage.updatePayment.title': {\n id: 'manage.updatePayment.title',\n defaultMessage: 'Update payment method.',\n description: 'Update payment method modal title',\n },\n 'manage.updatePayment.intro': {\n id: 'manage.updatePayment.intro',\n defaultMessage: 'By providing your card information, you allow edX to charge your card for future payments.',\n description: 'Update payment method modal intro copy',\n },\n 'manage.updatePayment.sectionTitle': {\n id: 'manage.updatePayment.sectionTitle',\n defaultMessage: 'Add new payment method',\n description: 'Heading above Stripe card fields',\n },\n 'manage.updatePayment.cardNumber': {\n id: 'manage.updatePayment.cardNumber',\n defaultMessage: 'Card number',\n description: 'Label for Stripe card number field',\n },\n 'manage.updatePayment.cvc': {\n id: 'manage.updatePayment.cvc',\n defaultMessage: 'Security code',\n description: 'Label for Stripe CVC field',\n },\n 'manage.updatePayment.expiry': {\n id: 'manage.updatePayment.expiry',\n defaultMessage: 'Expiration date',\n description: 'Label for Stripe expiry field',\n },\n 'manage.updatePayment.postal': {\n id: 'manage.updatePayment.postal',\n defaultMessage: 'Zip/Postal code',\n description: 'Label for postal code field',\n },\n 'manage.updatePayment.submit': {\n id: 'manage.updatePayment.submit',\n defaultMessage: 'Update card',\n description: 'Primary CTA to submit new payment method',\n },\n 'manage.updatePayment.submitting': {\n id: 'manage.updatePayment.submitting',\n defaultMessage: 'Updating…',\n description: 'Submit button label while update is in progress',\n },\n 'manage.updatePayment.close': {\n id: 'manage.updatePayment.close',\n defaultMessage: 'Close',\n description: 'Close button on update payment method modal',\n },\n 'manage.updatePayment.successTitle': {\n id: 'manage.updatePayment.successTitle',\n defaultMessage: 'Payment method updated.',\n description: 'Success modal title after payment method update',\n },\n 'manage.updatePayment.successBody': {\n id: 'manage.updatePayment.successBody',\n defaultMessage: 'Your new payment method will be applied on your next billing date, {date}.',\n description: 'Success modal body with next billing date',\n },\n 'manage.updatePayment.successBodyNoDate': {\n id: 'manage.updatePayment.successBodyNoDate',\n defaultMessage: 'Your new payment method will be applied on your next billing date.',\n description: 'Success modal body when next billing date is unknown',\n },\n 'manage.updatePayment.postalRequired': {\n id: 'manage.updatePayment.postalRequired',\n defaultMessage: 'Enter a zip/postal code.',\n description: 'Validation error when postal code is empty',\n },\n 'manage.updatePayment.error': {\n id: 'manage.updatePayment.error',\n defaultMessage: 'We could not update your payment method. Please try again.',\n description: 'Generic error when payment method update fails',\n },\n 'manage.updatePayment.invalidCard': {\n id: 'manage.updatePayment.invalidCard',\n defaultMessage: 'This card is not valid. Please try a different card.',\n description: 'Shown when the backend rejects the card during validation',\n },\n 'manage.updatePayment.stripeMissing': {\n id: 'manage.updatePayment.stripeMissing',\n defaultMessage: 'Payment updates are temporarily unavailable. Please try again later.',\n description: 'Shown when Stripe publishable key is not configured',\n },\n 'manage.active.cancelPrompt': {\n id: 'manage.active.cancelPrompt',\n defaultMessage: 'Need a break?',\n description: 'Prompt before cancel subscription link',\n },\n 'manage.active.cancelLink': {\n id: 'manage.active.cancelLink',\n defaultMessage: 'Cancel subscription',\n description: 'Cancel subscription link text',\n },\n\n // Canceled with access / renew banner\n 'manage.canceled.bannerTitle': {\n id: 'manage.canceled.bannerTitle',\n defaultMessage: 'Renew your subscription before it expires.',\n description: 'Expiring subscription banner title',\n },\n 'manage.canceled.bannerBody': {\n id: 'manage.canceled.bannerBody',\n defaultMessage: 'Your subscription is set to expire on {date} and you will have limited access to edX. Renew your subscription to keep your learning flexible.',\n description: 'Expiring subscription banner body',\n },\n 'manage.canceled.statusMonthly': {\n id: 'manage.canceled.statusMonthly',\n defaultMessage: 'Cancelled, Monthly plan',\n description: 'Cancelled monthly plan status label',\n },\n 'manage.canceled.statusAnnual': {\n id: 'manage.canceled.statusAnnual',\n defaultMessage: 'Cancelled, Annual plan',\n description: 'Cancelled annual plan status label',\n },\n 'manage.canceled.noPayments': {\n id: 'manage.canceled.noPayments',\n defaultMessage: 'You have no upcoming payments. You cancelled your subscription on {date}.',\n description: 'Cancelled status card body with cancel date',\n },\n 'manage.canceled.noPaymentsNoDate': {\n id: 'manage.canceled.noPaymentsNoDate',\n defaultMessage: 'You have no upcoming payments. You cancelled your subscription.',\n description: 'Cancelled status card body without cancel date',\n },\n 'manage.canceled.renew': {\n id: 'manage.canceled.renew',\n defaultMessage: 'Renew subscription',\n description: 'Renew subscription CTA',\n },\n 'manage.canceled.renewing': {\n id: 'manage.canceled.renewing',\n defaultMessage: 'Renewing…',\n description: 'Renew button label while reactivation mutation is in progress',\n },\n 'manage.canceled.renewError': {\n id: 'manage.canceled.renewError',\n defaultMessage: 'We could not renew your subscription. Please try again.',\n description: 'Error when reactivate mutation fails',\n },\n\n // Renew confirmation modal\n 'manage.renewModal.title': {\n id: 'manage.renewModal.title',\n defaultMessage: 'Renew your edX Plus subscription for ${price}/{frequency}',\n description: 'Renew modal title with price',\n },\n 'manage.renewModal.titleNoPrice': {\n id: 'manage.renewModal.titleNoPrice',\n defaultMessage: 'Renew your edX Plus subscription',\n description: 'Renew modal title when price is unavailable',\n },\n 'manage.renewModal.body': {\n id: 'manage.renewModal.body',\n defaultMessage: 'Your subscription will renew on {date} for ${price}/{frequency} {currency} (inclusive of applicable taxes). Cancel your subscription anytime from your dashboard. By clicking “Confirm subscription” you agree to our {termsLink}, and {refundLink}.',\n description: 'Renew modal body with terms links',\n },\n 'manage.renewModal.termsOfUse': {\n id: 'manage.renewModal.termsOfUse',\n defaultMessage: 'Terms of Use',\n description: 'Terms of Use link text in renew modal',\n },\n 'manage.renewModal.refundPolicy': {\n id: 'manage.renewModal.refundPolicy',\n defaultMessage: 'Refund Policy',\n description: 'Refund Policy link text in renew modal',\n },\n 'manage.renewModal.paymentMethod': {\n id: 'manage.renewModal.paymentMethod',\n defaultMessage: 'Payment Method',\n description: 'Payment method section heading in renew modal',\n },\n 'manage.renewModal.card': {\n id: 'manage.renewModal.card',\n defaultMessage: 'Card',\n description: 'Card payment method label in renew modal',\n },\n 'manage.renewModal.updatePayment': {\n id: 'manage.renewModal.updatePayment',\n defaultMessage: 'Update payment method',\n description: 'Update payment method button in renew modal',\n },\n 'manage.renewModal.recurringConfirm': {\n id: 'manage.renewModal.recurringConfirm',\n defaultMessage: 'I agree to enroll in a recurring {cycle} subscription for ${price}/{frequency} {currency}.',\n description: 'Recurring subscription consent checkbox',\n },\n 'manage.renewModal.ukCaConfirm': {\n id: 'manage.renewModal.ukCaConfirm',\n defaultMessage: 'Second checkbox only for UK and CA residents',\n description: 'Extra consent checkbox for UK and CA residents',\n },\n 'manage.renewModal.confirm': {\n id: 'manage.renewModal.confirm',\n defaultMessage: 'Confirm subscription',\n description: 'Confirm renew / reactivate button',\n },\n\n // Canceled expired / resubscribe\n 'manage.expired.heading': {\n id: 'manage.expired.heading',\n defaultMessage: 'Pick up where you left off',\n description: 'Section heading for expired / canceled without access (placeholder until final copy lands)',\n },\n 'manage.expired.subheading': {\n id: 'manage.expired.subheading',\n defaultMessage: 'You will manage your subscription here.',\n description: 'Section subheading for expired subscription state',\n },\n 'manage.expired.resubscribeTitle': {\n id: 'manage.expired.resubscribeTitle',\n defaultMessage: 'Resubscribe for ${price}/month {currency}',\n description: 'Resubscribe card title with price',\n },\n 'manage.expired.resubscribeTitleNoPrice': {\n id: 'manage.expired.resubscribeTitleNoPrice',\n defaultMessage: 'Resubscribe to edX Subscription',\n description: 'Resubscribe card title when price is unavailable',\n },\n 'manage.expired.canceledOn': {\n id: 'manage.expired.canceledOn',\n defaultMessage: 'You cancelled your subscription on {date}.',\n description: 'Resubscribe card cancelled-on line',\n },\n 'manage.expired.canceledOnNoDate': {\n id: 'manage.expired.canceledOnNoDate',\n defaultMessage: 'You cancelled your subscription.',\n description: 'Resubscribe card when cancel date is unknown',\n },\n\n // Cancel confirmation\n 'manage.cancel.title': {\n id: 'manage.cancel.title',\n defaultMessage: 'Are you sure you want to cancel?',\n description: 'Cancel confirmation page title',\n },\n 'manage.cancel.body': {\n id: 'manage.cancel.body',\n defaultMessage: 'If you cancel, you will lose access to all graded course content when your subscription expires on {date}. Your course progress will be saved if you re-subscribe within the calendar year.',\n description: 'Cancel confirmation body with period end date',\n },\n 'manage.cancel.bodyNoDate': {\n id: 'manage.cancel.bodyNoDate',\n defaultMessage: 'If you cancel, you will lose access to all graded course content when your subscription expires. Your course progress will be saved if you re-subscribe within the calendar year.',\n description: 'Cancel confirmation body without period end date',\n },\n 'manage.cancel.coursesHeading': {\n id: 'manage.cancel.coursesHeading',\n defaultMessage: 'Courses you are enrolled in ({count})',\n description: 'Heading for enrolled courses list on cancel confirmation',\n },\n 'manage.cancel.keep': {\n id: 'manage.cancel.keep',\n defaultMessage: 'No, keep my subscription',\n description: 'Secondary button to abort cancellation',\n },\n 'manage.cancel.confirm': {\n id: 'manage.cancel.confirm',\n defaultMessage: 'Yes, cancel subscription',\n description: 'Primary button to confirm cancellation',\n },\n 'manage.cancel.confirming': {\n id: 'manage.cancel.confirming',\n defaultMessage: 'Cancelling…',\n description: 'Cancel button label while mutation is in progress',\n },\n 'manage.cancel.error': {\n id: 'manage.cancel.error',\n defaultMessage: 'We could not cancel your subscription. Please try again.',\n description: 'Error when cancel mutation fails',\n },\n 'manage.cancel.viewCertificate': {\n id: 'manage.cancel.viewCertificate',\n defaultMessage: 'View certificate',\n description: 'View certificate button on enrolled course row',\n },\n\n // Cancel success\n 'manage.cancelSuccess.title': {\n id: 'manage.cancelSuccess.title',\n defaultMessage: 'Thank you for learning with us on edX. Your subscription is cancelled.',\n description: 'Cancel success page title',\n },\n 'manage.cancelSuccess.body': {\n id: 'manage.cancelSuccess.body',\n defaultMessage: 'Your edX Plus subscription has been cancelled and you will no longer be charged after {date}. You will receive a confirmation email shortly.',\n description: 'Cancel success body with last charge / access date',\n },\n 'manage.cancelSuccess.bodyNoDate': {\n id: 'manage.cancelSuccess.bodyNoDate',\n defaultMessage: 'Your edX Plus subscription has been cancelled and you will no longer be charged. You will receive a confirmation email shortly.',\n description: 'Cancel success body without date',\n },\n 'manage.cancelSuccess.return': {\n id: 'manage.cancelSuccess.return',\n defaultMessage: 'Return to Dashboard',\n description: 'Return to dashboard CTA after cancel success',\n },\n});\n\nexport default messages;\n"]}
1
+ {"version":3,"file":"messages.js","sourceRoot":"","sources":["../../src/components/messages.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAExD,MAAM,QAAQ,GAAG,cAAc,CAAC;IAC9B,mBAAmB,EAAE;QACnB,EAAE,EAAE,mBAAmB;QACvB,cAAc,EAAE,4BAA4B;QAC5C,WAAW,EAAE,iDAAiD;KAC/D;IACD,gBAAgB,EAAE;QAChB,EAAE,EAAE,gBAAgB;QACpB,cAAc,EAAE,uBAAuB;QACvC,WAAW,EAAE,gDAAgD;KAC9D;IACD,cAAc,EAAE;QACd,EAAE,EAAE,cAAc;QAClB,cAAc,EAAE,8DA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ACxF,WAAW,EAAE,2BAA2B;KACzC;IACD,2BAA2B,EAAE;QAC3B,EAAE,EAAE,2BAA2B;QAC/B,cAAc,EAAE,8IAA8I;QAC9J,WAAW,EAAE,oDAAoD;KAClE;IACD,iCAAiC,EAAE;QACjC,EAAE,EAAE,iCAAiC;QACrC,cAAc,EAAE,iIAAiI;QACjJ,WAAW,EAAE,kCAAkC;KAChD;IACD,6BAA6B,EAAE;QAC7B,EAAE,EAAE,6BAA6B;QACjC,cAAc,EAAE,qBAAqB;QACrC,WAAW,EAAE,8CAA8C;KAC5D;CACF,CAAC,CAAC;AAEH,eAAe,QAAQ,CAAC","sourcesContent":["import { defineMessages } from '@openedx/frontend-base';\n\nconst messages = defineMessages({\n 'manage.page.title': {\n id: 'manage.page.title',\n defaultMessage: 'Order History | {siteName}',\n description: 'Document title for the manage subscription page',\n },\n 'manage.loading': {\n id: 'manage.loading',\n defaultMessage: 'Loading subscription…',\n description: 'Loading state for the manage subscription page',\n },\n 'manage.error': {\n id: 'manage.error',\n defaultMessage: 'We could not load your subscription. Please try again later.',\n description: 'Error alert when subscription fetch fails',\n },\n 'manage.header.title': {\n id: 'manage.header.title',\n defaultMessage: 'Order History',\n description: 'Page heading for order history / manage subscription',\n },\n 'manage.header.subtitle': {\n id: 'manage.header.subtitle',\n defaultMessage: 'View previous purchases and manage your subscription.',\n description: 'Page subtitle under Order History',\n },\n 'manage.tab.subscription': {\n id: 'manage.tab.subscription',\n defaultMessage: 'Subscription',\n description: 'Subscription tab label',\n },\n 'manage.tab.paymentHistory': {\n id: 'manage.tab.paymentHistory',\n defaultMessage: 'Payment history',\n description: 'Payment history tab label',\n },\n 'manage.paymentHistory.heading': {\n id: 'manage.paymentHistory.heading',\n defaultMessage: 'Payment history',\n description: 'Heading for the payment history panel',\n },\n 'manage.paymentHistory.nextPayment': {\n id: 'manage.paymentHistory.nextPayment',\n defaultMessage: 'Next payment scheduled for {date}.',\n description: 'Next payment line above the invoice list',\n },\n 'manage.paymentHistory.empty': {\n id: 'manage.paymentHistory.empty',\n defaultMessage: 'No payments yet.',\n description: 'Empty state when the learner has no invoices',\n },\n 'manage.paymentHistory.error': {\n id: 'manage.paymentHistory.error',\n defaultMessage: 'We could not load your payment history. Please try again later.',\n description: 'Error alert when invoice fetch fails',\n },\n 'manage.paymentHistory.noSubscription': {\n id: 'manage.paymentHistory.noSubscription',\n defaultMessage: 'Payment history is available after you subscribe.',\n description: 'Shown when there is no subscriptionBiId to query invoices',\n },\n 'manage.paymentHistory.tileTitle': {\n id: 'manage.paymentHistory.tileTitle',\n defaultMessage: 'edX Plus Subscription',\n description: 'Title on each payment history invoice tile',\n },\n 'manage.paymentHistory.startOfService': {\n id: 'manage.paymentHistory.startOfService',\n defaultMessage: 'Start of service:',\n description: 'Label for invoice period start on payment history tile',\n },\n 'manage.paymentHistory.totalCost': {\n id: 'manage.paymentHistory.totalCost',\n defaultMessage: 'Total cost:',\n description: 'Label for invoice total on payment history tile',\n },\n 'manage.paymentHistory.orderNumber': {\n id: 'manage.paymentHistory.orderNumber',\n defaultMessage: 'Order number:',\n description: 'Label for order number on payment history tile',\n },\n 'manage.paymentHistory.paymentMethod': {\n id: 'manage.paymentHistory.paymentMethod',\n defaultMessage: 'Paid with:',\n description: 'Label for the payment method (card or PayPal) on a payment history tile',\n },\n 'manage.paymentHistory.method.stripe': {\n id: 'manage.paymentHistory.method.stripe',\n defaultMessage: 'Card',\n description: 'Payment method value for an invoice billed through Stripe',\n },\n 'manage.paymentHistory.method.paypal': {\n id: 'manage.paymentHistory.method.paypal',\n defaultMessage: 'PayPal',\n description: 'Payment method value for an invoice billed through PayPal',\n },\n 'manage.paymentHistory.desc.trial': {\n id: 'manage.paymentHistory.desc.trial',\n defaultMessage: 'edX Plus Subscription — free trial',\n description: 'Description for a $0 trial invoice',\n },\n 'manage.paymentHistory.desc.paid': {\n id: 'manage.paymentHistory.desc.paid',\n defaultMessage: 'edX Plus Subscription',\n description: 'Description for a paid subscription invoice',\n },\n 'manage.paymentHistory.status.paid': {\n id: 'manage.paymentHistory.status.paid',\n defaultMessage: 'Paid',\n description: 'Invoice status label: PAID',\n },\n 'manage.paymentHistory.status.open': {\n id: 'manage.paymentHistory.status.open',\n defaultMessage: 'Open',\n description: 'Invoice status label: OPEN',\n },\n 'manage.paymentHistory.status.draft': {\n id: 'manage.paymentHistory.status.draft',\n defaultMessage: 'Draft',\n description: 'Invoice status label: DRAFT',\n },\n 'manage.help.prefix': {\n id: 'manage.help.prefix',\n defaultMessage: 'Need more help? Visit the',\n description: 'Prefix before Learner Help Center link',\n },\n 'manage.help.link': {\n id: 'manage.help.link',\n defaultMessage: 'Learner Help Center',\n description: 'Learner Help Center link text',\n },\n\n // Become a subscriber\n 'manage.none.heading': {\n id: 'manage.none.heading',\n defaultMessage: 'Become a subscriber',\n description: 'Section heading when user has no subscription',\n },\n 'manage.none.subheading': {\n id: 'manage.none.subheading',\n defaultMessage: 'You will manage your subscription here.',\n description: 'Section subheading when user has no subscription',\n },\n 'manage.none.cardTitle': {\n id: 'manage.none.cardTitle',\n defaultMessage: 'Try edX Subscription for free',\n description: 'Upsell card title for non-subscribers',\n },\n 'manage.none.cardBody': {\n id: 'manage.none.cardBody',\n defaultMessage: 'Get access to hundreds of courses for ${price}/month {currency}',\n description: 'Upsell card body including monthly price',\n },\n 'manage.none.cardBodyNoPrice': {\n id: 'manage.none.cardBodyNoPrice',\n defaultMessage: 'Get access to hundreds of courses with edX subscription',\n description: 'Upsell card body when price is unavailable',\n },\n 'manage.none.subscribe': {\n id: 'manage.none.subscribe',\n defaultMessage: 'Subscribe',\n description: 'Primary subscribe CTA',\n },\n 'manage.none.learnMore': {\n id: 'manage.none.learnMore',\n defaultMessage: 'Learn about edX Subscription',\n description: 'Secondary learn-more link on upsell card',\n },\n\n // Active\n 'manage.active.heading': {\n id: 'manage.active.heading',\n defaultMessage: 'Manage your subscription',\n description: 'Section heading for active subscribers',\n },\n 'manage.active.since': {\n id: 'manage.active.since',\n defaultMessage: 'Subscriber since {date}.',\n description: 'Subscriber since date line',\n },\n 'manage.active.statusMonthly': {\n id: 'manage.active.statusMonthly',\n defaultMessage: 'Active, Monthly Plan',\n description: 'Active monthly plan status label',\n },\n 'manage.active.statusAnnual': {\n id: 'manage.active.statusAnnual',\n defaultMessage: 'Active, Annual Plan',\n description: 'Active annual plan status label',\n },\n 'manage.active.nextPayment': {\n id: 'manage.active.nextPayment',\n defaultMessage: 'Your next payment is {date}.',\n description: 'Next payment date line for active subscribers',\n },\n 'manage.active.changeAnnual': {\n id: 'manage.active.changeAnnual',\n defaultMessage: 'Change to annual and save',\n description: 'CTA to switch to annual billing',\n },\n 'manage.active.updatePayment': {\n id: 'manage.active.updatePayment',\n defaultMessage: 'Update payment method',\n description: 'CTA to update payment method',\n },\n 'manage.updatePayment.title': {\n id: 'manage.updatePayment.title',\n defaultMessage: 'Update payment method.',\n description: 'Update payment method modal title',\n },\n 'manage.updatePayment.intro': {\n id: 'manage.updatePayment.intro',\n defaultMessage: 'By providing your card information, you allow edX to charge your card for future payments.',\n description: 'Update payment method modal intro copy',\n },\n 'manage.updatePayment.sectionTitle': {\n id: 'manage.updatePayment.sectionTitle',\n defaultMessage: 'Add new payment method',\n description: 'Heading above Stripe card fields',\n },\n 'manage.updatePayment.cardNumber': {\n id: 'manage.updatePayment.cardNumber',\n defaultMessage: 'Card number',\n description: 'Label for Stripe card number field',\n },\n 'manage.updatePayment.cvc': {\n id: 'manage.updatePayment.cvc',\n defaultMessage: 'Security code',\n description: 'Label for Stripe CVC field',\n },\n 'manage.updatePayment.expiry': {\n id: 'manage.updatePayment.expiry',\n defaultMessage: 'Expiration date',\n description: 'Label for Stripe expiry field',\n },\n 'manage.updatePayment.postal': {\n id: 'manage.updatePayment.postal',\n defaultMessage: 'Zip/Postal code',\n description: 'Label for postal code field',\n },\n 'manage.updatePayment.submit': {\n id: 'manage.updatePayment.submit',\n defaultMessage: 'Update card',\n description: 'Primary CTA to submit new payment method',\n },\n 'manage.updatePayment.submitting': {\n id: 'manage.updatePayment.submitting',\n defaultMessage: 'Updating…',\n description: 'Submit button label while update is in progress',\n },\n 'manage.updatePayment.close': {\n id: 'manage.updatePayment.close',\n defaultMessage: 'Close',\n description: 'Close button on update payment method modal',\n },\n 'manage.updatePayment.successTitle': {\n id: 'manage.updatePayment.successTitle',\n defaultMessage: 'Payment method updated.',\n description: 'Success modal title after payment method update',\n },\n 'manage.updatePayment.successBody': {\n id: 'manage.updatePayment.successBody',\n defaultMessage: 'Your new payment method will be applied on your next billing date, {date}.',\n description: 'Success modal body with next billing date',\n },\n 'manage.updatePayment.successBodyNoDate': {\n id: 'manage.updatePayment.successBodyNoDate',\n defaultMessage: 'Your new payment method will be applied on your next billing date.',\n description: 'Success modal body when next billing date is unknown',\n },\n 'manage.updatePayment.postalRequired': {\n id: 'manage.updatePayment.postalRequired',\n defaultMessage: 'Enter a zip/postal code.',\n description: 'Validation error when postal code is empty',\n },\n 'manage.updatePayment.error': {\n id: 'manage.updatePayment.error',\n defaultMessage: 'We could not update your payment method. Please try again.',\n description: 'Generic error when payment method update fails',\n },\n 'manage.updatePayment.invalidCard': {\n id: 'manage.updatePayment.invalidCard',\n defaultMessage: 'This card is not valid. Please try a different card.',\n description: 'Shown when the backend rejects the card during validation',\n },\n 'manage.updatePayment.stripeMissing': {\n id: 'manage.updatePayment.stripeMissing',\n defaultMessage: 'Payment updates are temporarily unavailable. Please try again later.',\n description: 'Shown when Stripe publishable key is not configured',\n },\n 'manage.active.cancelPrompt': {\n id: 'manage.active.cancelPrompt',\n defaultMessage: 'Need a break?',\n description: 'Prompt before cancel subscription link',\n },\n 'manage.active.cancelLink': {\n id: 'manage.active.cancelLink',\n defaultMessage: 'Cancel subscription',\n description: 'Cancel subscription link text',\n },\n\n // Canceled with access / renew banner\n 'manage.canceled.bannerTitle': {\n id: 'manage.canceled.bannerTitle',\n defaultMessage: 'Renew your subscription before it expires.',\n description: 'Expiring subscription banner title',\n },\n 'manage.canceled.bannerBody': {\n id: 'manage.canceled.bannerBody',\n defaultMessage: 'Your subscription is set to expire on {date} and you will have limited access to edX. Renew your subscription to keep your learning flexible.',\n description: 'Expiring subscription banner body',\n },\n 'manage.canceled.statusMonthly': {\n id: 'manage.canceled.statusMonthly',\n defaultMessage: 'Cancelled, Monthly plan',\n description: 'Cancelled monthly plan status label',\n },\n 'manage.canceled.statusAnnual': {\n id: 'manage.canceled.statusAnnual',\n defaultMessage: 'Cancelled, Annual plan',\n description: 'Cancelled annual plan status label',\n },\n 'manage.canceled.noPayments': {\n id: 'manage.canceled.noPayments',\n defaultMessage: 'You have no upcoming payments. You cancelled your subscription on {date}.',\n description: 'Cancelled status card body with cancel date',\n },\n 'manage.canceled.noPaymentsNoDate': {\n id: 'manage.canceled.noPaymentsNoDate',\n defaultMessage: 'You have no upcoming payments. You cancelled your subscription.',\n description: 'Cancelled status card body without cancel date',\n },\n 'manage.canceled.renew': {\n id: 'manage.canceled.renew',\n defaultMessage: 'Renew subscription',\n description: 'Renew subscription CTA',\n },\n 'manage.canceled.renewing': {\n id: 'manage.canceled.renewing',\n defaultMessage: 'Renewing…',\n description: 'Renew button label while reactivation mutation is in progress',\n },\n 'manage.canceled.renewError': {\n id: 'manage.canceled.renewError',\n defaultMessage: 'We could not renew your subscription. Please try again.',\n description: 'Error when reactivate mutation fails',\n },\n\n // Renew confirmation modal\n 'manage.renewModal.title': {\n id: 'manage.renewModal.title',\n defaultMessage: 'Renew your edX Plus subscription for ${price}/{frequency}',\n description: 'Renew modal title with price',\n },\n 'manage.renewModal.titleNoPrice': {\n id: 'manage.renewModal.titleNoPrice',\n defaultMessage: 'Renew your edX Plus subscription',\n description: 'Renew modal title when price is unavailable',\n },\n 'manage.renewModal.body': {\n id: 'manage.renewModal.body',\n defaultMessage: 'Your subscription will renew on {date} for ${price}/{frequency} {currency} (inclusive of applicable taxes). Cancel your subscription anytime from your dashboard. By clicking “Confirm subscription” you agree to our {termsLink}, and {refundLink}.',\n description: 'Renew modal body with terms links',\n },\n 'manage.renewModal.termsOfUse': {\n id: 'manage.renewModal.termsOfUse',\n defaultMessage: 'Terms of Use',\n description: 'Terms of Use link text in renew modal',\n },\n 'manage.renewModal.refundPolicy': {\n id: 'manage.renewModal.refundPolicy',\n defaultMessage: 'Refund Policy',\n description: 'Refund Policy link text in renew modal',\n },\n 'manage.renewModal.paymentMethod': {\n id: 'manage.renewModal.paymentMethod',\n defaultMessage: 'Payment Method',\n description: 'Payment method section heading in renew modal',\n },\n 'manage.renewModal.card': {\n id: 'manage.renewModal.card',\n defaultMessage: 'Card',\n description: 'Card payment method label in renew modal',\n },\n 'manage.renewModal.updatePayment': {\n id: 'manage.renewModal.updatePayment',\n defaultMessage: 'Update payment method',\n description: 'Update payment method button in renew modal',\n },\n 'manage.renewModal.recurringConfirm': {\n id: 'manage.renewModal.recurringConfirm',\n defaultMessage: 'I agree to enroll in a recurring {cycle} subscription for ${price}/{frequency} {currency}.',\n description: 'Recurring subscription consent checkbox',\n },\n 'manage.renewModal.ukCaConfirm': {\n id: 'manage.renewModal.ukCaConfirm',\n defaultMessage: 'Second checkbox only for UK and CA residents',\n description: 'Extra consent checkbox for UK and CA residents',\n },\n 'manage.renewModal.confirm': {\n id: 'manage.renewModal.confirm',\n defaultMessage: 'Confirm subscription',\n description: 'Confirm renew / reactivate button',\n },\n\n // Canceled expired / resubscribe\n 'manage.expired.heading': {\n id: 'manage.expired.heading',\n defaultMessage: 'Pick up where you left off',\n description: 'Section heading for expired / canceled without access (placeholder until final copy lands)',\n },\n 'manage.expired.subheading': {\n id: 'manage.expired.subheading',\n defaultMessage: 'You will manage your subscription here.',\n description: 'Section subheading for expired subscription state',\n },\n 'manage.expired.resubscribeTitle': {\n id: 'manage.expired.resubscribeTitle',\n defaultMessage: 'Resubscribe for ${price}/month {currency}',\n description: 'Resubscribe card title with price',\n },\n 'manage.expired.resubscribeTitleNoPrice': {\n id: 'manage.expired.resubscribeTitleNoPrice',\n defaultMessage: 'Resubscribe to edX Subscription',\n description: 'Resubscribe card title when price is unavailable',\n },\n 'manage.expired.canceledOn': {\n id: 'manage.expired.canceledOn',\n defaultMessage: 'You cancelled your subscription on {date}.',\n description: 'Resubscribe card cancelled-on line',\n },\n 'manage.expired.canceledOnNoDate': {\n id: 'manage.expired.canceledOnNoDate',\n defaultMessage: 'You cancelled your subscription.',\n description: 'Resubscribe card when cancel date is unknown',\n },\n\n // Cancel confirmation\n 'manage.cancel.title': {\n id: 'manage.cancel.title',\n defaultMessage: 'Are you sure you want to cancel?',\n description: 'Cancel confirmation page title',\n },\n 'manage.cancel.body': {\n id: 'manage.cancel.body',\n defaultMessage: 'If you cancel, you will lose access to all graded course content when your subscription expires on {date}. Your course progress will be saved if you re-subscribe within the calendar year.',\n description: 'Cancel confirmation body with period end date',\n },\n 'manage.cancel.bodyNoDate': {\n id: 'manage.cancel.bodyNoDate',\n defaultMessage: 'If you cancel, you will lose access to all graded course content when your subscription expires. Your course progress will be saved if you re-subscribe within the calendar year.',\n description: 'Cancel confirmation body without period end date',\n },\n 'manage.cancel.coursesHeading': {\n id: 'manage.cancel.coursesHeading',\n defaultMessage: 'Courses you are enrolled in ({count})',\n description: 'Heading for enrolled courses list on cancel confirmation',\n },\n 'manage.cancel.keep': {\n id: 'manage.cancel.keep',\n defaultMessage: 'No, keep my subscription',\n description: 'Secondary button to abort cancellation',\n },\n 'manage.cancel.confirm': {\n id: 'manage.cancel.confirm',\n defaultMessage: 'Yes, cancel subscription',\n description: 'Primary button to confirm cancellation',\n },\n 'manage.cancel.confirming': {\n id: 'manage.cancel.confirming',\n defaultMessage: 'Cancelling…',\n description: 'Cancel button label while mutation is in progress',\n },\n 'manage.cancel.error': {\n id: 'manage.cancel.error',\n defaultMessage: 'We could not cancel your subscription. Please try again.',\n description: 'Error when cancel mutation fails',\n },\n 'manage.cancel.viewCertificate': {\n id: 'manage.cancel.viewCertificate',\n defaultMessage: 'View certificate',\n description: 'View certificate button on enrolled course row',\n },\n\n // Cancel success\n 'manage.cancelSuccess.title': {\n id: 'manage.cancelSuccess.title',\n defaultMessage: 'Thank you for learning with us on edX. Your subscription is cancelled.',\n description: 'Cancel success page title',\n },\n 'manage.cancelSuccess.body': {\n id: 'manage.cancelSuccess.body',\n defaultMessage: 'Your edX Plus subscription has been cancelled and you will no longer be charged after {date}. You will receive a confirmation email shortly.',\n description: 'Cancel success body with last charge / access date',\n },\n 'manage.cancelSuccess.bodyNoDate': {\n id: 'manage.cancelSuccess.bodyNoDate',\n defaultMessage: 'Your edX Plus subscription has been cancelled and you will no longer be charged. You will receive a confirmation email shortly.',\n description: 'Cancel success body without date',\n },\n 'manage.cancelSuccess.return': {\n id: 'manage.cancelSuccess.return',\n defaultMessage: 'Return to Dashboard',\n description: 'Return to dashboard CTA after cancel success',\n },\n});\n\nexport default messages;\n"]}
@@ -25,8 +25,8 @@ export declare function useIsSubscriberQuery(client: ViaxGqlClient | null, sessi
25
25
  export declare function useBillingPlansQuery(client: ViaxGqlClient | null, sessionReady: boolean): UseQueryResult<BillingPlansResult>;
26
26
  /** Enrollments for cancel confirmation. */
27
27
  export declare function useSubscriptionEnrollmentsQuery(client: ViaxGqlClient | null, sessionReady: boolean, subscriptionBiIds: string | string[] | null | undefined): UseQueryResult<SubscriptionEnrollment[]>;
28
- /** Invoices for the Payment history tab. */
29
- export declare function usePaymentHistoryQuery(client: ViaxGqlClient | null, sessionReady: boolean, subscriptionBiId: string | null | undefined): UseQueryResult<PaymentHistoryItem[]>;
28
+ /** Invoices (Stripe and PayPal) for the Payment history tab, across one or more subscriptions. */
29
+ export declare function usePaymentHistoryQuery(client: ViaxGqlClient | null, sessionReady: boolean, subscriptionBiIds: string | string[] | null | undefined): UseQueryResult<PaymentHistoryItem[]>;
30
30
  /** Stripe payment method on file for renew / manage display. */
31
31
  export declare function useSubscriptionPaymentMethodQuery(client: ViaxGqlClient | null, sessionReady: boolean, subscriptionBiId: string | null | undefined, enabled?: boolean): UseQueryResult<SubscriptionPaymentMethod | null>;
32
32
  /** Cancel subscription mutation; invalidates subscriber query on success. */
@@ -19,7 +19,7 @@ import { fetchEdxSession, getEdxSessionUrl } from '../../utils/edxSession';
19
19
  import { cancelSubscription } from '../services/subscription/cancelSubscription';
20
20
  import { getBillingPlans } from '../services/subscription/getBillingPlans';
21
21
  import { getIsCurrentUserSubscriber } from '../services/subscription/getIsCurrentUserSubscriber';
22
- import { getPaymentHistory } from '../services/subscription/getPaymentHistory';
22
+ import { getPaymentHistory, normalizeSubscriptionBiIds, } from '../services/subscription/getPaymentHistory';
23
23
  import { getSubscriptionEnrollments } from '../services/subscription/getSubscriptionEnrollments';
24
24
  import { getSubscriptionPaymentMethod, } from '../services/subscription/getSubscriptionPaymentMethod';
25
25
  import { reactivateSubscription } from '../services/subscription/reactivateSubscription';
@@ -112,13 +112,14 @@ export function useSubscriptionEnrollmentsQuery(client, sessionReady, subscripti
112
112
  retry: 1,
113
113
  });
114
114
  }
115
- /** Invoices for the Payment history tab. */
116
- export function usePaymentHistoryQuery(client, sessionReady, subscriptionBiId) {
117
- const sub = (subscriptionBiId === null || subscriptionBiId === void 0 ? void 0 : subscriptionBiId.trim()) || '';
115
+ /** Invoices (Stripe and PayPal) for the Payment history tab, across one or more subscriptions. */
116
+ export function usePaymentHistoryQuery(client, sessionReady, subscriptionBiIds) {
117
+ const ids = normalizeSubscriptionBiIds(subscriptionBiIds);
118
+ const key = ids.join(',');
118
119
  return useQuery({
119
- queryKey: manageKeys.paymentHistory(sub || 'none'),
120
- enabled: !!client && sessionReady && !!sub,
121
- queryFn: () => getPaymentHistory(client.gql, sub),
120
+ queryKey: manageKeys.paymentHistory(key || 'none'),
121
+ enabled: !!client && sessionReady && ids.length > 0,
122
+ queryFn: () => getPaymentHistory(client.gql, ids),
122
123
  staleTime: 60 * 1000,
123
124
  retry: 1,
124
125
  });
@@ -1 +1 @@
1
- {"version":3,"file":"useManageQueries.js","sourceRoot":"","sources":["../../../src/data/hooks/useManageQueries.ts"],"names":[],"mappings":"AAAA;;GAEG;;;;;;;;;;AAEH,OAAO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CAAC,IAA6B,EAAE,EAAE;YAC5C,IAAI,CAAC,MAAM,EAAE,CAAC;gBACZ,MAAM,IAAI,KAAK,CAAC,gCAAgC,CAAC,CAAC;YACpD,CAAC;YACD,OAAO,yBAAyB,CAAC,MAAM,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;QACrD,CAAC;KACF,CAAC,CAAC;AACL,CAAC;AAED,gEAAgE;AAChE,MAAM,UAAU,8BAA8B,CAC5C,MAA4B;IAE5B,MAAM,WAAW,GAAG,cAAc,EAAE,CAAC;IAErC,OAAO,WAAW,CAAC;QACjB,UAAU,EAAE,CAAC,IAA6B,EAAE,EAAE;YAC5C,IAAI,CAAC,MAAM,EAAE,CAAC;gBACZ,MAAM,IAAI,KAAK,CAAC,gCAAgC,CAAC,CAAC;YACpD,CAAC;YACD,OAAO,+BAA+B,CAAC,MAAM,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;QAC3D,CAAC;QACD,SAAS,EAAE,GAAG,EAAE;YACd,WAAW,CAAC,iBAAiB,CAAC,EAAE,QAAQ,EAAE,UAAU,CAAC,YAAY,EAAE,EAAE,CAAC,CAAC;YACvE,WAAW,CAAC,iBAAiB,CAAC;gBAC5B,QAAQ,EAAE,CAAC,GAAG,UAAU,CAAC,GAAG,EAAE,eAAe,CAAC;aAC/C,CAAC,CAAC;QACL,CAAC;KACF,CAAC,CAAC;AACL,CAAC","sourcesContent":["/**\n * Hooks for Viax session, subscriber status, enrollments, and cancel mutation.\n */\n\nimport { useEffect, useMemo } from 'react';\nimport {\n useMutation,\n useQuery,\n useQueryClient,\n type UseMutationResult,\n type UseQueryResult,\n} from '@tanstack/react-query';\nimport { getAppConfig, getSiteConfig } from '@openedx/frontend-base';\n\nimport { appId } from '../../constants';\nimport type {\n CurrentUserSubscriberResult,\n PaymentHistoryItem,\n SubscriptionEnrollment,\n BillingPlansResult,\n} from '../../types';\nimport { createGqlClient, type ViaxGqlClient } from '../../utils/graphqlClient';\nimport { fetchEdxSession, getEdxSessionUrl } from '../../utils/edxSession';\nimport { cancelSubscription } from '../services/subscription/cancelSubscription';\nimport { getBillingPlans } from '../services/subscription/getBillingPlans';\nimport { getIsCurrentUserSubscriber } from '../services/subscription/getIsCurrentUserSubscriber';\nimport { getPaymentHistory } from '../services/subscription/getPaymentHistory';\nimport { getSubscriptionEnrollments } from '../services/subscription/getSubscriptionEnrollments';\nimport {\n getSubscriptionPaymentMethod,\n type SubscriptionPaymentMethod,\n} from '../services/subscription/getSubscriptionPaymentMethod';\nimport { reactivateSubscription } from '../services/subscription/reactivateSubscription';\nimport {\n updateSubscriptionPaymentMethod,\n type UpdatePaymentMethodArgs,\n} from '../services/subscription/updateSubscriptionPaymentMethod';\nimport { validateCartPaymentMethod } from '../services/subscription/validateCartPaymentMethod';\nimport { manageKeys } from './keys';\n\n/** Shared Viax GraphQL client for the manage MFE (singleton per API URL). */\nlet cachedClient: ViaxGqlClient | null = null;\nlet cachedApiUrl: string | undefined;\n\nexport function useViaxClient(): ViaxGqlClient | null {\n const config = getAppConfig(appId);\n const apiUrl = config.VIAX_API_URL as string | undefined;\n\n return useMemo(() => {\n if (!apiUrl) {\n return null;\n }\n if (cachedClient && cachedApiUrl === apiUrl) {\n return cachedClient;\n }\n cachedClient = createGqlClient({ apiUrl });\n cachedApiUrl = apiUrl;\n return cachedClient;\n }, [apiUrl]);\n}\n\n/** Exchange edX session cookies for a Viax token. */\nexport function useViaxSessionQuery(): UseQueryResult<Awaited<ReturnType<typeof fetchEdxSession>>> {\n const sessionUrl = getSiteConfig().lmsBaseUrl\n ? getEdxSessionUrl()\n : null;\n\n return useQuery({\n queryKey: manageKeys.viaxSession(),\n enabled: !!sessionUrl,\n queryFn: () => fetchEdxSession(sessionUrl!),\n staleTime: 5 * 60 * 1000,\n retry: 1,\n });\n}\n\n/**\n * Applies the Viax token from the session query onto the GraphQL client.\n */\nexport function useViaxSession(client: ViaxGqlClient | null) {\n const sessionQuery = useViaxSessionQuery();\n\n useEffect(() => {\n if (client && sessionQuery.data?.viaxToken) {\n client.setToken(sessionQuery.data.viaxToken);\n }\n }, [client, sessionQuery.data?.viaxToken]);\n\n return {\n sessionReady: Boolean(client && sessionQuery.isSuccess && sessionQuery.data?.viaxToken),\n isSessionLoading: sessionQuery.isPending,\n isSessionError: sessionQuery.isError,\n sessionError: sessionQuery.error,\n };\n}\n\n/** Current user's subscription context. */\nexport function useIsSubscriberQuery(\n client: ViaxGqlClient | null,\n sessionReady: boolean,\n): UseQueryResult<CurrentUserSubscriberResult | null> {\n return useQuery({\n queryKey: manageKeys.isSubscriber(),\n enabled: !!client && sessionReady,\n queryFn: () => getIsCurrentUserSubscriber(client!.gql),\n staleTime: 2 * 60 * 1000,\n retry: 1,\n });\n}\n\n/** Available monthly / annual billing plans for price display. */\nexport function useBillingPlansQuery(\n client: ViaxGqlClient | null,\n sessionReady: boolean,\n): UseQueryResult<BillingPlansResult> {\n return useQuery({\n queryKey: manageKeys.billingPlans(),\n enabled: !!client && sessionReady,\n queryFn: () => getBillingPlans(client!.gql),\n staleTime: 10 * 60 * 1000,\n retry: 1,\n });\n}\n\n/** Enrollments for cancel confirmation. */\nexport function useSubscriptionEnrollmentsQuery(\n client: ViaxGqlClient | null,\n sessionReady: boolean,\n subscriptionBiIds: string | string[] | null | undefined,\n): UseQueryResult<SubscriptionEnrollment[]> {\n const ids = (Array.isArray(subscriptionBiIds)\n ? subscriptionBiIds\n : [subscriptionBiIds ?? ''])\n .map((id) => (id ?? '').trim())\n .filter(Boolean);\n const key = ids.join(',') || 'none';\n\n return useQuery({\n queryKey: manageKeys.enrollments(key),\n enabled: !!client && sessionReady && ids.length > 0,\n queryFn: () => getSubscriptionEnrollments(client!.gql, ids),\n staleTime: 60 * 1000,\n retry: 1,\n });\n}\n\n/** Invoices for the Payment history tab. */\nexport function usePaymentHistoryQuery(\n client: ViaxGqlClient | null,\n sessionReady: boolean,\n subscriptionBiId: string | null | undefined,\n): UseQueryResult<PaymentHistoryItem[]> {\n const sub = subscriptionBiId?.trim() || '';\n\n return useQuery({\n queryKey: manageKeys.paymentHistory(sub || 'none'),\n enabled: !!client && sessionReady && !!sub,\n queryFn: () => getPaymentHistory(client!.gql, sub),\n staleTime: 60 * 1000,\n retry: 1,\n });\n}\n\n/** Stripe payment method on file for renew / manage display. */\nexport function useSubscriptionPaymentMethodQuery(\n client: ViaxGqlClient | null,\n sessionReady: boolean,\n subscriptionBiId: string | null | undefined,\n enabled = true,\n): UseQueryResult<SubscriptionPaymentMethod | null> {\n const sub = subscriptionBiId?.trim() || '';\n\n return useQuery({\n queryKey: manageKeys.paymentMethod(sub || 'none'),\n enabled: !!client && sessionReady && !!sub && enabled,\n queryFn: () => getSubscriptionPaymentMethod(client!.gql, sub),\n staleTime: 60 * 1000,\n retry: 1,\n });\n}\n\n/** Cancel subscription mutation; invalidates subscriber query on success. */\nexport function useCancelSubscriptionMutation(\n client: ViaxGqlClient | null,\n): UseMutationResult<Record<string, unknown> | null, Error, string> {\n const queryClient = useQueryClient();\n\n return useMutation({\n mutationFn: (subscriptionBiId: string) => {\n if (!client) {\n throw new Error('Viax client is not configured.');\n }\n return cancelSubscription(client.gql, subscriptionBiId);\n },\n onSuccess: () => {\n queryClient.invalidateQueries({ queryKey: manageKeys.isSubscriber() });\n },\n });\n}\n\n/** Undo pending cancellation before period end; refreshes subscriber view on success. */\nexport function useReactivateSubscriptionMutation(\n client: ViaxGqlClient | null,\n): UseMutationResult<Record<string, unknown> | null, Error, string> {\n const queryClient = useQueryClient();\n\n const markActive = (\n prev: CurrentUserSubscriberResult | null | undefined,\n ): CurrentUserSubscriberResult | null => {\n if (!prev) {\n return prev ?? null;\n }\n return {\n ...prev,\n isSubscriber: true,\n canEnroll: true,\n status: 'ACTIVE',\n canceledAt: null,\n };\n };\n\n return useMutation({\n mutationFn: (subscriptionBiId: string) => {\n if (!client) {\n throw new Error('Viax client is not configured.');\n }\n return reactivateSubscription(client.gql, subscriptionBiId);\n },\n onSuccess: async () => {\n // Immediate UI flip to the active manage view.\n queryClient.setQueryData(manageKeys.isSubscriber(), markActive);\n\n await queryClient.refetchQueries({ queryKey: manageKeys.isSubscriber() });\n\n // If the read-after-write still shows a cancel status, keep the active view\n // (reactivate already succeeded).\n queryClient.setQueryData(\n manageKeys.isSubscriber(),\n (prev: CurrentUserSubscriberResult | null | undefined) => {\n if (!prev) {\n return prev ?? null;\n }\n const status = (prev.status ?? '').toUpperCase();\n const stillCanceled = (\n status.includes('CANCEL')\n );\n return stillCanceled ? markActive(prev) : {\n ...prev,\n canceledAt: null,\n };\n },\n );\n\n await queryClient.invalidateQueries({\n queryKey: [...manageKeys.all, 'paymentHistory'],\n });\n },\n });\n}\n\n/** Pre-check for a tokenized card; call before the update mutation attaches it. */\nexport function useValidateCartPaymentMethodMutation(\n client: ViaxGqlClient | null,\n): UseMutationResult<Record<string, unknown> | null, Error, UpdatePaymentMethodArgs> {\n return useMutation({\n mutationFn: (args: UpdatePaymentMethodArgs) => {\n if (!client) {\n throw new Error('Viax client is not configured.');\n }\n return validateCartPaymentMethod(client.gql, args);\n },\n });\n}\n\n/** Update default Stripe payment method on the subscription. */\nexport function useUpdatePaymentMethodMutation(\n client: ViaxGqlClient | null,\n): UseMutationResult<Record<string, unknown> | null, Error, UpdatePaymentMethodArgs> {\n const queryClient = useQueryClient();\n\n return useMutation({\n mutationFn: (args: UpdatePaymentMethodArgs) => {\n if (!client) {\n throw new Error('Viax client is not configured.');\n }\n return updateSubscriptionPaymentMethod(client.gql, args);\n },\n onSuccess: () => {\n queryClient.invalidateQueries({ queryKey: manageKeys.isSubscriber() });\n queryClient.invalidateQueries({\n queryKey: [...manageKeys.all, 'paymentMethod'],\n });\n },\n });\n}\n"]}
1
+ {"version":3,"file":"useManageQueries.js","sourceRoot":"","sources":["../../../src/data/hooks/useManageQueries.ts"],"names":[],"mappings":"AAAA;;GAEG;;;;;;;;;;AAEH,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAC3C,OAAO,EACL,WAAW,E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IAAI,CAAC,MAAM,EAAE,CAAC;gBACZ,MAAM,IAAI,KAAK,CAAC,gCAAgC,CAAC,CAAC;YACpD,CAAC;YACD,OAAO,yBAAyB,CAAC,MAAM,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;QACrD,CAAC;KACF,CAAC,CAAC;AACL,CAAC;AAED,gEAAgE;AAChE,MAAM,UAAU,8BAA8B,CAC5C,MAA4B;IAE5B,MAAM,WAAW,GAAG,cAAc,EAAE,CAAC;IAErC,OAAO,WAAW,CAAC;QACjB,UAAU,EAAE,CAAC,IAA6B,EAAE,EAAE;YAC5C,IAAI,CAAC,MAAM,EAAE,CAAC;gBACZ,MAAM,IAAI,KAAK,CAAC,gCAAgC,CAAC,CAAC;YACpD,CAAC;YACD,OAAO,+BAA+B,CAAC,MAAM,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;QAC3D,CAAC;QACD,SAAS,EAAE,GAAG,EAAE;YACd,WAAW,CAAC,iBAAiB,CAAC,EAAE,QAAQ,EAAE,UAAU,CAAC,YAAY,EAAE,EAAE,CAAC,CAAC;YACvE,WAAW,CAAC,iBAAiB,CAAC;gBAC5B,QAAQ,EAAE,CAAC,GAAG,UAAU,CAAC,GAAG,EAAE,eAAe,CAAC;aAC/C,CAAC,CAAC;QACL,CAAC;KACF,CAAC,CAAC;AACL,CAAC","sourcesContent":["/**\n * Hooks for Viax session, subscriber status, enrollments, and cancel mutation.\n */\n\nimport { useEffect, useMemo } from 'react';\nimport {\n useMutation,\n useQuery,\n useQueryClient,\n type UseMutationResult,\n type UseQueryResult,\n} from '@tanstack/react-query';\nimport { getAppConfig, getSiteConfig } from '@openedx/frontend-base';\n\nimport { appId } from '../../constants';\nimport type {\n CurrentUserSubscriberResult,\n PaymentHistoryItem,\n SubscriptionEnrollment,\n BillingPlansResult,\n} from '../../types';\nimport { createGqlClient, type ViaxGqlClient } from '../../utils/graphqlClient';\nimport { fetchEdxSession, getEdxSessionUrl } from '../../utils/edxSession';\nimport { cancelSubscription } from '../services/subscription/cancelSubscription';\nimport { getBillingPlans } from '../services/subscription/getBillingPlans';\nimport { getIsCurrentUserSubscriber } from '../services/subscription/getIsCurrentUserSubscriber';\nimport {\n getPaymentHistory,\n normalizeSubscriptionBiIds,\n} from '../services/subscription/getPaymentHistory';\nimport { getSubscriptionEnrollments } from '../services/subscription/getSubscriptionEnrollments';\nimport {\n getSubscriptionPaymentMethod,\n type SubscriptionPaymentMethod,\n} from '../services/subscription/getSubscriptionPaymentMethod';\nimport { reactivateSubscription } from '../services/subscription/reactivateSubscription';\nimport {\n updateSubscriptionPaymentMethod,\n type UpdatePaymentMethodArgs,\n} from '../services/subscription/updateSubscriptionPaymentMethod';\nimport { validateCartPaymentMethod } from '../services/subscription/validateCartPaymentMethod';\nimport { manageKeys } from './keys';\n\n/** Shared Viax GraphQL client for the manage MFE (singleton per API URL). */\nlet cachedClient: ViaxGqlClient | null = null;\nlet cachedApiUrl: string | undefined;\n\nexport function useViaxClient(): ViaxGqlClient | null {\n const config = getAppConfig(appId);\n const apiUrl = config.VIAX_API_URL as string | undefined;\n\n return useMemo(() => {\n if (!apiUrl) {\n return null;\n }\n if (cachedClient && cachedApiUrl === apiUrl) {\n return cachedClient;\n }\n cachedClient = createGqlClient({ apiUrl });\n cachedApiUrl = apiUrl;\n return cachedClient;\n }, [apiUrl]);\n}\n\n/** Exchange edX session cookies for a Viax token. */\nexport function useViaxSessionQuery(): UseQueryResult<Awaited<ReturnType<typeof fetchEdxSession>>> {\n const sessionUrl = getSiteConfig().lmsBaseUrl\n ? getEdxSessionUrl()\n : null;\n\n return useQuery({\n queryKey: manageKeys.viaxSession(),\n enabled: !!sessionUrl,\n queryFn: () => fetchEdxSession(sessionUrl!),\n staleTime: 5 * 60 * 1000,\n retry: 1,\n });\n}\n\n/**\n * Applies the Viax token from the session query onto the GraphQL client.\n */\nexport function useViaxSession(client: ViaxGqlClient | null) {\n const sessionQuery = useViaxSessionQuery();\n\n useEffect(() => {\n if (client && sessionQuery.data?.viaxToken) {\n client.setToken(sessionQuery.data.viaxToken);\n }\n }, [client, sessionQuery.data?.viaxToken]);\n\n return {\n sessionReady: Boolean(client && sessionQuery.isSuccess && sessionQuery.data?.viaxToken),\n isSessionLoading: sessionQuery.isPending,\n isSessionError: sessionQuery.isError,\n sessionError: sessionQuery.error,\n };\n}\n\n/** Current user's subscription context. */\nexport function useIsSubscriberQuery(\n client: ViaxGqlClient | null,\n sessionReady: boolean,\n): UseQueryResult<CurrentUserSubscriberResult | null> {\n return useQuery({\n queryKey: manageKeys.isSubscriber(),\n enabled: !!client && sessionReady,\n queryFn: () => getIsCurrentUserSubscriber(client!.gql),\n staleTime: 2 * 60 * 1000,\n retry: 1,\n });\n}\n\n/** Available monthly / annual billing plans for price display. */\nexport function useBillingPlansQuery(\n client: ViaxGqlClient | null,\n sessionReady: boolean,\n): UseQueryResult<BillingPlansResult> {\n return useQuery({\n queryKey: manageKeys.billingPlans(),\n enabled: !!client && sessionReady,\n queryFn: () => getBillingPlans(client!.gql),\n staleTime: 10 * 60 * 1000,\n retry: 1,\n });\n}\n\n/** Enrollments for cancel confirmation. */\nexport function useSubscriptionEnrollmentsQuery(\n client: ViaxGqlClient | null,\n sessionReady: boolean,\n subscriptionBiIds: string | string[] | null | undefined,\n): UseQueryResult<SubscriptionEnrollment[]> {\n const ids = (Array.isArray(subscriptionBiIds)\n ? subscriptionBiIds\n : [subscriptionBiIds ?? ''])\n .map((id) => (id ?? '').trim())\n .filter(Boolean);\n const key = ids.join(',') || 'none';\n\n return useQuery({\n queryKey: manageKeys.enrollments(key),\n enabled: !!client && sessionReady && ids.length > 0,\n queryFn: () => getSubscriptionEnrollments(client!.gql, ids),\n staleTime: 60 * 1000,\n retry: 1,\n });\n}\n\n/** Invoices (Stripe and PayPal) for the Payment history tab, across one or more subscriptions. */\nexport function usePaymentHistoryQuery(\n client: ViaxGqlClient | null,\n sessionReady: boolean,\n subscriptionBiIds: string | string[] | null | undefined,\n): UseQueryResult<PaymentHistoryItem[]> {\n const ids = normalizeSubscriptionBiIds(subscriptionBiIds);\n const key = ids.join(',');\n\n return useQuery({\n queryKey: manageKeys.paymentHistory(key || 'none'),\n enabled: !!client && sessionReady && ids.length > 0,\n queryFn: () => getPaymentHistory(client!.gql, ids),\n staleTime: 60 * 1000,\n retry: 1,\n });\n}\n\n/** Stripe payment method on file for renew / manage display. */\nexport function useSubscriptionPaymentMethodQuery(\n client: ViaxGqlClient | null,\n sessionReady: boolean,\n subscriptionBiId: string | null | undefined,\n enabled = true,\n): UseQueryResult<SubscriptionPaymentMethod | null> {\n const sub = subscriptionBiId?.trim() || '';\n\n return useQuery({\n queryKey: manageKeys.paymentMethod(sub || 'none'),\n enabled: !!client && sessionReady && !!sub && enabled,\n queryFn: () => getSubscriptionPaymentMethod(client!.gql, sub),\n staleTime: 60 * 1000,\n retry: 1,\n });\n}\n\n/** Cancel subscription mutation; invalidates subscriber query on success. */\nexport function useCancelSubscriptionMutation(\n client: ViaxGqlClient | null,\n): UseMutationResult<Record<string, unknown> | null, Error, string> {\n const queryClient = useQueryClient();\n\n return useMutation({\n mutationFn: (subscriptionBiId: string) => {\n if (!client) {\n throw new Error('Viax client is not configured.');\n }\n return cancelSubscription(client.gql, subscriptionBiId);\n },\n onSuccess: () => {\n queryClient.invalidateQueries({ queryKey: manageKeys.isSubscriber() });\n },\n });\n}\n\n/** Undo pending cancellation before period end; refreshes subscriber view on success. */\nexport function useReactivateSubscriptionMutation(\n client: ViaxGqlClient | null,\n): UseMutationResult<Record<string, unknown> | null, Error, string> {\n const queryClient = useQueryClient();\n\n const markActive = (\n prev: CurrentUserSubscriberResult | null | undefined,\n ): CurrentUserSubscriberResult | null => {\n if (!prev) {\n return prev ?? null;\n }\n return {\n ...prev,\n isSubscriber: true,\n canEnroll: true,\n status: 'ACTIVE',\n canceledAt: null,\n };\n };\n\n return useMutation({\n mutationFn: (subscriptionBiId: string) => {\n if (!client) {\n throw new Error('Viax client is not configured.');\n }\n return reactivateSubscription(client.gql, subscriptionBiId);\n },\n onSuccess: async () => {\n // Immediate UI flip to the active manage view.\n queryClient.setQueryData(manageKeys.isSubscriber(), markActive);\n\n await queryClient.refetchQueries({ queryKey: manageKeys.isSubscriber() });\n\n // If the read-after-write still shows a cancel status, keep the active view\n // (reactivate already succeeded).\n queryClient.setQueryData(\n manageKeys.isSubscriber(),\n (prev: CurrentUserSubscriberResult | null | undefined) => {\n if (!prev) {\n return prev ?? null;\n }\n const status = (prev.status ?? '').toUpperCase();\n const stillCanceled = (\n status.includes('CANCEL')\n );\n return stillCanceled ? markActive(prev) : {\n ...prev,\n canceledAt: null,\n };\n },\n );\n\n await queryClient.invalidateQueries({\n queryKey: [...manageKeys.all, 'paymentHistory'],\n });\n },\n });\n}\n\n/** Pre-check for a tokenized card; call before the update mutation attaches it. */\nexport function useValidateCartPaymentMethodMutation(\n client: ViaxGqlClient | null,\n): UseMutationResult<Record<string, unknown> | null, Error, UpdatePaymentMethodArgs> {\n return useMutation({\n mutationFn: (args: UpdatePaymentMethodArgs) => {\n if (!client) {\n throw new Error('Viax client is not configured.');\n }\n return validateCartPaymentMethod(client.gql, args);\n },\n });\n}\n\n/** Update default Stripe payment method on the subscription. */\nexport function useUpdatePaymentMethodMutation(\n client: ViaxGqlClient | null,\n): UseMutationResult<Record<string, unknown> | null, Error, UpdatePaymentMethodArgs> {\n const queryClient = useQueryClient();\n\n return useMutation({\n mutationFn: (args: UpdatePaymentMethodArgs) => {\n if (!client) {\n throw new Error('Viax client is not configured.');\n }\n return updateSubscriptionPaymentMethod(client.gql, args);\n },\n onSuccess: () => {\n queryClient.invalidateQueries({ queryKey: manageKeys.isSubscriber() });\n queryClient.invalidateQueries({\n queryKey: [...manageKeys.all, 'paymentMethod'],\n });\n },\n });\n}\n"]}
@@ -21,6 +21,9 @@ export function getIsCurrentUserSubscriber(gql) {
21
21
  isSubscriber: result.isSubscriber === true,
22
22
  canEnroll: result.canEnroll === true,
23
23
  subscriptionBiId: (_a = result.subscriptionBiId) !== null && _a !== void 0 ? _a : null,
24
+ subscriptionBiIds: Array.isArray(result.subscriptionBiIds)
25
+ ? result.subscriptionBiIds.filter((id) => typeof id === 'string' && id.trim() !== '')
26
+ : [],
24
27
  status: (_b = result.status) !== null && _b !== void 0 ? _b : null,
25
28
  currentPeriodEnd: (_c = result.currentPeriodEnd) !== null && _c !== void 0 ? _c : null,
26
29
  subscriptionStartDate: (_d = result.subscriptionStartDate) !== null && _d !== void 0 ? _d : null,
@@ -1 +1 @@
1
- {"version":3,"file":"getIsCurrentUserSubscriber.js","sourceRoot":"","sources":["../../../../src/data/services/subscription/getIsCurrentUserSubscriber.ts"],"names":[],"mappings":";;;;;;;;;AACA,OAAO,EAAE,8BAA8B,EAAE,MAAM,wBAAwB,CAAC;AAExE,gFAAgF;AAChF,MAAM,UAAgB,0BAA0B,CAC9C,GAAc;;;QAEd,MAAM,IAAI,GAAG,MAAM,GAAG,CAAC,8BAA8B,CAAC,CAAC;QACvD,MAAM,MAAM,GAAG,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,wBAAwB,CAAC;QAC9C,IAAI,CAAC,MAAM,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE,CAAC;YAC1C,OAAO,IAAI,CAAC;QACd,CAAC;QAED,OAAO;YACL,YAAY,EAAE,MAAM,CAAC,YAAY,KAAK,IAAI;YAC1C,SAAS,EAAE,MAAM,CAAC,SAAS,KAAK,IAAI;YACpC,gBAAgB,EAAE,MAAA,MAAM,CAAC,gBAAgB,mCAAI,IAAI;YACjD,MAAM,EAAE,MAAA,MAAM,CAAC,MAAM,mCAAI,IAAI;YAC7B,gBAAgB,EAAE,MAAA,MAAM,CAAC,gBAAgB,mCAAI,IAAI;YACjD,qBAAqB,EAAE,MAAA,MAAM,CAAC,qBAAqB,mCAAI,IAAI;YAC3D,mBAAmB,EAAE,MAAA,MAAM,CAAC,mBAAmB,mCAAI,IAAI;YACvD,yEAAyE;YACzE,uDAAuD;YACvD,WAAW,EACT,MAAA,MAAA,MAAA,MAAM,CAAC,gBAAgB,mCAAI,MAAM,CAAC,WAAW,mCAAI,MAAM,CAAC,QAAQ,mCAAI,IAAI;YAC1E,UAAU,EAAE,MAAA,MAAA,MAAM,CAAC,UAAU,mCAAI,MAAM,CAAC,WAAW,mCAAI,IAAI;YAC3D,MAAM,EAAE,MAAA,MAAA,MAAM,CAAC,MAAM,mCAAI,MAAM,CAAC,KAAK,mCAAI,IAAI;YAC7C,QAAQ,EAAE,MAAA,MAAM,CAAC,QAAQ,mCAAI,IAAI;YACjC,cAAc,EAAE,MAAA,MAAM,CAAC,cAAc,mCAAI,IAAI;YAC7C,QAAQ,EAAE,MAAA,MAAM,CAAC,QAAQ,mCAAI,IAAI;YACjC,eAAe,EAAE,MAAA,MAAM,CAAC,eAAe,mCAAI,IAAI;YAC/C,iBAAiB,EAAE,MAAA,MAAM,CAAC,iBAAiB,mCAAI,IAAI;SACpD,CAAC;IACJ,CAAC;CAAA","sourcesContent":["import type { GqlRunner, CurrentUserSubscriberResult } from '../../../types';\nimport { GET_IS_CURRENT_USER_SUBSCRIBER } from '../../../utils/queries';\n\n/** Check whether the authenticated user has an active / recent subscription. */\nexport async function getIsCurrentUserSubscriber(\n gql: GqlRunner,\n): Promise<CurrentUserSubscriberResult | null> {\n const data = await gql(GET_IS_CURRENT_USER_SUBSCRIBER);\n const result = data?.tIsCurrentUserSubscriber;\n if (!result || typeof result !== 'object') {\n return null;\n }\n\n return {\n isSubscriber: result.isSubscriber === true,\n canEnroll: result.canEnroll === true,\n subscriptionBiId: result.subscriptionBiId ?? null,\n status: result.status ?? null,\n currentPeriodEnd: result.currentPeriodEnd ?? null,\n subscriptionStartDate: result.subscriptionStartDate ?? null,\n subscriptionEndDate: result.subscriptionEndDate ?? null,\n // Prefer billingFrequency (e.g. ANNUAL / MONTHLY); planName is a display\n // label and usually does not encode the billing cycle.\n renewalType:\n result.billingFrequency ?? result.renewalType ?? result.planName ?? null,\n canceledAt: result.canceledAt ?? result.cancelledAt ?? null,\n amount: result.amount ?? result.price ?? null,\n currency: result.currency ?? null,\n billingPlanUid: result.billingPlanUid ?? null,\n interval: result.interval ?? null,\n billingInterval: result.billingInterval ?? null,\n bipOwnershipModel: result.bipOwnershipModel ?? null,\n };\n}\n"]}
1
+ {"version":3,"file":"getIsCurrentUserSubscriber.js","sourceRoot":"","sources":["../../../../src/data/services/subscription/getIsCurrentUserSubscriber.ts"],"names":[],"mappings":";;;;;;;;;AACA,OAAO,EAAE,8BAA8B,EAAE,MAAM,wBAAwB,CAAC;AAExE,gFAAgF;AAChF,MAAM,UAAgB,0BAA0B,CAC9C,GAAc;;;QAEd,MAAM,IAAI,GAAG,MAAM,GAAG,CAAC,8BAA8B,CAAC,CAAC;QACvD,MAAM,MAAM,GAAG,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,wBAAwB,CAAC;QAC9C,IAAI,CAAC,MAAM,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE,CAAC;YAC1C,OAAO,IAAI,CAAC;QACd,CAAC;QAED,OAAO;YACL,YAAY,EAAE,MAAM,CAAC,YAAY,KAAK,IAAI;YAC1C,SAAS,EAAE,MAAM,CAAC,SAAS,KAAK,IAAI;YACpC,gBAAgB,EAAE,MAAA,MAAM,CAAC,gBAAgB,mCAAI,IAAI;YACjD,iBAAiB,EAAE,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,iBAAiB,CAAC;gBACxD,CAAC,CAAC,MAAM,CAAC,iBAAiB,CAAC,MAAM,CAC7B,CAAC,EAAW,EAAgB,EAAE,CAAC,OAAO,EAAE,KAAK,QAAQ,IAAI,EAAE,CAAC,IAAI,EAAE,KAAK,EAAE,CAC1E;gBACH,CAAC,CAAC,EAAE;YACN,MAAM,EAAE,MAAA,MAAM,CAAC,MAAM,mCAAI,IAAI;YAC7B,gBAAgB,EAAE,MAAA,MAAM,CAAC,gBAAgB,mCAAI,IAAI;YACjD,qBAAqB,EAAE,MAAA,MAAM,CAAC,qBAAqB,mCAAI,IAAI;YAC3D,mBAAmB,EAAE,MAAA,MAAM,CAAC,mBAAmB,mCAAI,IAAI;YACvD,yEAAyE;YACzE,uDAAuD;YACvD,WAAW,EACT,MAAA,MAAA,MAAA,MAAM,CAAC,gBAAgB,mCAAI,MAAM,CAAC,WAAW,mCAAI,MAAM,CAAC,QAAQ,mCAAI,IAAI;YAC1E,UAAU,EAAE,MAAA,MAAA,MAAM,CAAC,UAAU,mCAAI,MAAM,CAAC,WAAW,mCAAI,IAAI;YAC3D,MAAM,EAAE,MAAA,MAAA,MAAM,CAAC,MAAM,mCAAI,MAAM,CAAC,KAAK,mCAAI,IAAI;YAC7C,QAAQ,EAAE,MAAA,MAAM,CAAC,QAAQ,mCAAI,IAAI;YACjC,cAAc,EAAE,MAAA,MAAM,CAAC,cAAc,mCAAI,IAAI;YAC7C,QAAQ,EAAE,MAAA,MAAM,CAAC,QAAQ,mCAAI,IAAI;YACjC,eAAe,EAAE,MAAA,MAAM,CAAC,eAAe,mCAAI,IAAI;YAC/C,iBAAiB,EAAE,MAAA,MAAM,CAAC,iBAAiB,mCAAI,IAAI;SACpD,CAAC;IACJ,CAAC;CAAA","sourcesContent":["import type { GqlRunner, CurrentUserSubscriberResult } from '../../../types';\nimport { GET_IS_CURRENT_USER_SUBSCRIBER } from '../../../utils/queries';\n\n/** Check whether the authenticated user has an active / recent subscription. */\nexport async function getIsCurrentUserSubscriber(\n gql: GqlRunner,\n): Promise<CurrentUserSubscriberResult | null> {\n const data = await gql(GET_IS_CURRENT_USER_SUBSCRIBER);\n const result = data?.tIsCurrentUserSubscriber;\n if (!result || typeof result !== 'object') {\n return null;\n }\n\n return {\n isSubscriber: result.isSubscriber === true,\n canEnroll: result.canEnroll === true,\n subscriptionBiId: result.subscriptionBiId ?? null,\n subscriptionBiIds: Array.isArray(result.subscriptionBiIds)\n ? result.subscriptionBiIds.filter(\n (id: unknown): id is string => typeof id === 'string' && id.trim() !== '',\n )\n : [],\n status: result.status ?? null,\n currentPeriodEnd: result.currentPeriodEnd ?? null,\n subscriptionStartDate: result.subscriptionStartDate ?? null,\n subscriptionEndDate: result.subscriptionEndDate ?? null,\n // Prefer billingFrequency (e.g. ANNUAL / MONTHLY); planName is a display\n // label and usually does not encode the billing cycle.\n renewalType:\n result.billingFrequency ?? result.renewalType ?? result.planName ?? null,\n canceledAt: result.canceledAt ?? result.cancelledAt ?? null,\n amount: result.amount ?? result.price ?? null,\n currency: result.currency ?? null,\n billingPlanUid: result.billingPlanUid ?? null,\n interval: result.interval ?? null,\n billingInterval: result.billingInterval ?? null,\n bipOwnershipModel: result.bipOwnershipModel ?? null,\n };\n}\n"]}
@@ -1,6 +1,16 @@
1
- import type { GqlRunner, PaymentHistoryItem } from '../../../types';
1
+ import type { CurrentUserSubscriberResult, GqlRunner, PaymentHistoryItem } from '../../../types';
2
+ /** Trimmed, de-duplicated subscription BI ids (order preserved). */
3
+ export declare function normalizeSubscriptionBiIds(subscriptionBiIds: string | string[] | null | undefined): string[];
2
4
  /**
3
- * Payment history invoices for a subscription.
5
+ * Every subscription whose invoices belong in Payment history: the reported
6
+ * subscription first, then any others the learner holds (e.g. an older Stripe
7
+ * subscription alongside a PayPal one).
8
+ */
9
+ export declare function getPaymentHistorySubscriptionIds(subscriber: CurrentUserSubscriberResult | null | undefined): string[];
10
+ /** Build `biRelatesTo.biId = '…' OR biRelatesTo.biId = '…'`; null when no ids. */
11
+ export declare function buildPaymentHistoryFilter(subscriptionBiIds: string | string[] | null | undefined): string | null;
12
+ /**
13
+ * Payment history invoices (Stripe and PayPal) for one or more subscriptions.
4
14
  * Sorted newest billDate first.
5
15
  */
6
- export declare function getPaymentHistory(gql: GqlRunner, subscriptionBiId: string, first?: number): Promise<PaymentHistoryItem[]>;
16
+ export declare function getPaymentHistory(gql: GqlRunner, subscriptionBiIds: string | string[], first?: number): Promise<PaymentHistoryItem[]>;
@@ -20,41 +20,92 @@ function codeOrName(value) {
20
20
  return value;
21
21
  return (_b = (_a = value.code) !== null && _a !== void 0 ? _a : value.name) !== null && _b !== void 0 ? _b : null;
22
22
  }
23
+ function resolvePaymentProcessor(stripeInvoiceId, paypalInvoiceId) {
24
+ if (paypalInvoiceId)
25
+ return 'paypal';
26
+ if (stripeInvoiceId)
27
+ return 'stripe';
28
+ return null;
29
+ }
23
30
  function normalizeInvoice(node) {
24
- var _a, _b, _c, _d, _e, _f, _g;
31
+ var _a, _b, _c, _d, _e, _f;
25
32
  const { amount, currency } = sumFinancialCharges(node.billFinancialCharges);
26
33
  const biId = String((_a = node.biId) !== null && _a !== void 0 ? _a : '');
34
+ const stripeInvoiceId = node.tStripeInvoiceId || null;
35
+ const paypalInvoiceId = node.tPaypalInvoiceId || null;
27
36
  return {
28
37
  biId,
29
38
  orderNumber: biId ? `EDX-${biId}` : '',
30
- stripeInvoiceId: (_b = node.tStripeInvoiceId) !== null && _b !== void 0 ? _b : null,
39
+ stripeInvoiceId,
40
+ paypalInvoiceId,
41
+ paymentProcessor: resolvePaymentProcessor(stripeInvoiceId, paypalInvoiceId),
31
42
  status: codeOrName(node.bpStatus),
32
- billDate: (_c = node.billDate) !== null && _c !== void 0 ? _c : null,
33
- periodStart: (_e = (_d = node.billBillingPeriod) === null || _d === void 0 ? void 0 : _d.start) !== null && _e !== void 0 ? _e : null,
34
- periodEnd: (_g = (_f = node.billBillingPeriod) === null || _f === void 0 ? void 0 : _f.end) !== null && _g !== void 0 ? _g : null,
43
+ billDate: (_b = node.billDate) !== null && _b !== void 0 ? _b : null,
44
+ periodStart: (_d = (_c = node.billBillingPeriod) === null || _c === void 0 ? void 0 : _c.start) !== null && _d !== void 0 ? _d : null,
45
+ periodEnd: (_f = (_e = node.billBillingPeriod) === null || _e === void 0 ? void 0 : _e.end) !== null && _f !== void 0 ? _f : null,
35
46
  amount,
36
47
  currency,
37
48
  isTrial: amount === 0,
38
49
  };
39
50
  }
51
+ /** Trimmed, de-duplicated subscription BI ids (order preserved). */
52
+ export function normalizeSubscriptionBiIds(subscriptionBiIds) {
53
+ const list = Array.isArray(subscriptionBiIds) ? subscriptionBiIds : [subscriptionBiIds];
54
+ const ids = list
55
+ .map((id) => (typeof id === 'string' ? id.trim() : ''))
56
+ .filter(Boolean);
57
+ return Array.from(new Set(ids));
58
+ }
59
+ /**
60
+ * Every subscription whose invoices belong in Payment history: the reported
61
+ * subscription first, then any others the learner holds (e.g. an older Stripe
62
+ * subscription alongside a PayPal one).
63
+ */
64
+ export function getPaymentHistorySubscriptionIds(subscriber) {
65
+ var _a, _b;
66
+ if (!subscriber)
67
+ return [];
68
+ return normalizeSubscriptionBiIds([
69
+ (_a = subscriber.subscriptionBiId) !== null && _a !== void 0 ? _a : '',
70
+ ...((_b = subscriber.subscriptionBiIds) !== null && _b !== void 0 ? _b : []),
71
+ ]);
72
+ }
73
+ /** Build `biRelatesTo.biId = '…' OR biRelatesTo.biId = '…'`; null when no ids. */
74
+ export function buildPaymentHistoryFilter(subscriptionBiIds) {
75
+ const ids = normalizeSubscriptionBiIds(subscriptionBiIds);
76
+ if (!ids.length) {
77
+ return null;
78
+ }
79
+ return ids
80
+ .map((id) => `biRelatesTo.biId = '${escapeFilterValue(id)}'`)
81
+ .join(' OR ');
82
+ }
40
83
  /**
41
- * Payment history invoices for a subscription.
84
+ * Payment history invoices (Stripe and PayPal) for one or more subscriptions.
42
85
  * Sorted newest billDate first.
43
86
  */
44
- export function getPaymentHistory(gql_1, subscriptionBiId_1) {
45
- return __awaiter(this, arguments, void 0, function* (gql, subscriptionBiId, first = 50) {
87
+ export function getPaymentHistory(gql_1, subscriptionBiIds_1) {
88
+ return __awaiter(this, arguments, void 0, function* (gql, subscriptionBiIds, first = 100) {
46
89
  var _a, _b;
47
- const sub = subscriptionBiId.trim();
48
- if (!sub) {
90
+ const filter = buildPaymentHistoryFilter(subscriptionBiIds);
91
+ if (!filter) {
49
92
  return [];
50
93
  }
51
- const filter = `biRelatesTo.biId = '${escapeFilterValue(sub)}'`;
52
94
  const data = yield gql(GET_PAYMENT_HISTORY, { filter, first });
53
95
  const edges = (_b = (_a = data === null || data === void 0 ? void 0 : data.filterTwouInvoice) === null || _a === void 0 ? void 0 : _a.edges) !== null && _b !== void 0 ? _b : [];
96
+ const seen = new Set();
54
97
  return edges
55
98
  .map((edge) => edge === null || edge === void 0 ? void 0 : edge.node)
56
99
  .filter(Boolean)
57
100
  .map((node) => normalizeInvoice(node))
101
+ .filter((invoice) => {
102
+ if (!invoice.biId)
103
+ return true;
104
+ if (seen.has(invoice.biId))
105
+ return false;
106
+ seen.add(invoice.biId);
107
+ return true;
108
+ })
58
109
  .sort((a, b) => {
59
110
  const aTime = a.billDate ? new Date(a.billDate).getTime() : 0;
60
111
  const bTime = b.billDate ? new Date(b.billDate).getTime() : 0;
@@ -1 +1 @@
1
- {"version":3,"file":"getPaymentHistory.js","sourceRoot":"","sources":["../../../../src/data/services/subscription/getPaymentHistory.ts"],"names":[],"mappings":";;;;;;;;;AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAC7D,OAAO,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AAEnE,SAAS,iBAAiB,CAAC,KAAa;IACtC,OAAO,KAAK,CAAC,OAAO,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;AAC3D,CAAC;AAED,SAAS,UAAU,CACjB,KAAmE;;IAEnE,IAAI,CAAC,KAAK;QAAE,OAAO,IAAI,CAAC;IACxB,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAC;IAC5C,OAAO,MAAA,MAAA,KAAK,CAAC,IAAI,mCAAI,KAAK,CAAC,IAAI,mCAAI,IAAI,CAAC;AAC1C,CAAC;AAED,SAAS,gBAAgB,CAAC,IAAyB;;IACjD,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,GAAG,mBAAmB,CAAC,IAAI,CAAC,oBAAoB,CAAC,CAAC;IAC5E,MAAM,IAAI,GAAG,MAAM,CAAC,MAAA,I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CAAC,IAAyB,EAAE,EAAE,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC;aAC1D,IAAI,CAAC,CAAC,CAAqB,EAAE,CAAqB,EAAE,EAAE;YACrD,MAAM,KAAK,GAAG,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;YAC9D,MAAM,KAAK,GAAG,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;YAC9D,OAAO,KAAK,GAAG,KAAK,CAAC;QACvB,CAAC,CAAC,CAAC;IACP,CAAC;CAAA","sourcesContent":["import type { GqlRunner, PaymentHistoryItem } from '../../../types';\nimport { GET_PAYMENT_HISTORY } from '../../../utils/queries';\nimport { sumFinancialCharges } from '../../../utils/invoiceAmount';\n\nfunction escapeFilterValue(value: string): string {\n return value.replace(/\\\\/g, '\\\\\\\\').replace(/'/g, \"\\\\'\");\n}\n\nfunction codeOrName(\n value: { code?: string, name?: string } | string | null | undefined,\n): string | null {\n if (!value) return null;\n if (typeof value === 'string') return value;\n return value.code ?? value.name ?? null;\n}\n\nfunction normalizeInvoice(node: Record<string, any>): PaymentHistoryItem {\n const { amount, currency } = sumFinancialCharges(node.billFinancialCharges);\n const biId = String(node.biId ?? '');\n\n return {\n biId,\n orderNumber: biId ? `EDX-${biId}` : '',\n stripeInvoiceId: node.tStripeInvoiceId ?? null,\n status: codeOrName(node.bpStatus),\n billDate: node.billDate ?? null,\n periodStart: node.billBillingPeriod?.start ?? null,\n periodEnd: node.billBillingPeriod?.end ?? null,\n amount,\n currency,\n isTrial: amount === 0,\n };\n}\n\n/**\n * Payment history invoices for a subscription.\n * Sorted newest billDate first.\n */\nexport async function getPaymentHistory(\n gql: GqlRunner,\n subscriptionBiId: string,\n first = 50,\n): Promise<PaymentHistoryItem[]> {\n const sub = subscriptionBiId.trim();\n if (!sub) {\n return [];\n }\n\n const filter = `biRelatesTo.biId = '${escapeFilterValue(sub)}'`;\n const data = await gql(GET_PAYMENT_HISTORY, { filter, first });\n const edges = data?.filterTwouInvoice?.edges ?? [];\n\n return edges\n .map((edge: { node?: Record<string, any> }) => edge?.node)\n .filter(Boolean)\n .map((node: Record<string, any>) => normalizeInvoice(node))\n .sort((a: PaymentHistoryItem, b: PaymentHistoryItem) => {\n const aTime = a.billDate ? new Date(a.billDate).getTime() : 0;\n const bTime = b.billDate ? new Date(b.billDate).getTime() : 0;\n return bTime - aTime;\n });\n}\n"]}
1
+ {"version":3,"file":"getPaymentHistory.js","sourceRoot":"","sources":["../../../../src/data/services/subscription/getPaymentHistory.ts"],"names":[],"mappings":";;;;;;;;;AAMA,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAC7D,OAAO,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AAEnE,SAAS,iBAAiB,CAAC,KAAa;IACtC,OAAO,KAAK,CAAC,OAAO,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;AAC3D,CAAC;AAED,SAAS,UAAU,CACjB,KAAmE;;IAEnE,IAAI,CAAC,KAAK;QAAE,OAAO,IAAI,CAAC;IACxB,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAC;IAC5C,OAAO,MAAA,MAAA,KAAK,CAAC,IAAI,mCAAI,KAAK,CAAC,IAAI,mCAAI,IAAI,CAAC;AAC1C,CAAC;AAED,SAAS,uBAAuB,CAC9B,eAA8B,EAC9B,eAA8B;IAE9B,IAAI,eAAe;QAAE,OAAO,QAAQ,CAAC;IACrC,IAAI,eAAe;QAAE,OAAO,QAAQ,CAAC;IACrC,OAAO,IAAI,CAAC;AACd,CAAC;AAED,SAAS,gBAAgB,CAAC,IAAyB;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CAAC;QAE/B,OAAO,KAAK;aACT,GAAG,CAAC,CAAC,IAAoC,EAAE,EAAE,CAAC,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,IAAI,CAAC;aACzD,MAAM,CAAC,OAAO,CAAC;aACf,GAAG,CAAC,CAAC,IAAyB,EAAE,EAAE,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC;aAC1D,MAAM,CAAC,CAAC,OAA2B,EAAE,EAAE;YACtC,IAAI,CAAC,OAAO,CAAC,IAAI;gBAAE,OAAO,IAAI,CAAC;YAC/B,IAAI,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC;gBAAE,OAAO,KAAK,CAAC;YACzC,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;YACvB,OAAO,IAAI,CAAC;QACd,CAAC,CAAC;aACD,IAAI,CAAC,CAAC,CAAqB,EAAE,CAAqB,EAAE,EAAE;YACrD,MAAM,KAAK,GAAG,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;YAC9D,MAAM,KAAK,GAAG,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;YAC9D,OAAO,KAAK,GAAG,KAAK,CAAC;QACvB,CAAC,CAAC,CAAC;IACP,CAAC;CAAA","sourcesContent":["import type {\n CurrentUserSubscriberResult,\n GqlRunner,\n PaymentHistoryItem,\n PaymentProcessor,\n} from '../../../types';\nimport { GET_PAYMENT_HISTORY } from '../../../utils/queries';\nimport { sumFinancialCharges } from '../../../utils/invoiceAmount';\n\nfunction escapeFilterValue(value: string): string {\n return value.replace(/\\\\/g, '\\\\\\\\').replace(/'/g, \"\\\\'\");\n}\n\nfunction codeOrName(\n value: { code?: string, name?: string } | string | null | undefined,\n): string | null {\n if (!value) return null;\n if (typeof value === 'string') return value;\n return value.code ?? value.name ?? null;\n}\n\nfunction resolvePaymentProcessor(\n stripeInvoiceId: string | null,\n paypalInvoiceId: string | null,\n): PaymentProcessor | null {\n if (paypalInvoiceId) return 'paypal';\n if (stripeInvoiceId) return 'stripe';\n return null;\n}\n\nfunction normalizeInvoice(node: Record<string, any>): PaymentHistoryItem {\n const { amount, currency } = sumFinancialCharges(node.billFinancialCharges);\n const biId = String(node.biId ?? '');\n const stripeInvoiceId = node.tStripeInvoiceId || null;\n const paypalInvoiceId = node.tPaypalInvoiceId || null;\n\n return {\n biId,\n orderNumber: biId ? `EDX-${biId}` : '',\n stripeInvoiceId,\n paypalInvoiceId,\n paymentProcessor: resolvePaymentProcessor(stripeInvoiceId, paypalInvoiceId),\n status: codeOrName(node.bpStatus),\n billDate: node.billDate ?? null,\n periodStart: node.billBillingPeriod?.start ?? null,\n periodEnd: node.billBillingPeriod?.end ?? null,\n amount,\n currency,\n isTrial: amount === 0,\n };\n}\n\n/** Trimmed, de-duplicated subscription BI ids (order preserved). */\nexport function normalizeSubscriptionBiIds(\n subscriptionBiIds: string | string[] | null | undefined,\n): string[] {\n const list = Array.isArray(subscriptionBiIds) ? subscriptionBiIds : [subscriptionBiIds];\n const ids = list\n .map((id) => (typeof id === 'string' ? id.trim() : ''))\n .filter(Boolean);\n return Array.from(new Set(ids));\n}\n\n/**\n * Every subscription whose invoices belong in Payment history: the reported\n * subscription first, then any others the learner holds (e.g. an older Stripe\n * subscription alongside a PayPal one).\n */\nexport function getPaymentHistorySubscriptionIds(\n subscriber: CurrentUserSubscriberResult | null | undefined,\n): string[] {\n if (!subscriber) return [];\n return normalizeSubscriptionBiIds([\n subscriber.subscriptionBiId ?? '',\n ...(subscriber.subscriptionBiIds ?? []),\n ]);\n}\n\n/** Build `biRelatesTo.biId = '…' OR biRelatesTo.biId = '…'`; null when no ids. */\nexport function buildPaymentHistoryFilter(\n subscriptionBiIds: string | string[] | null | undefined,\n): string | null {\n const ids = normalizeSubscriptionBiIds(subscriptionBiIds);\n if (!ids.length) {\n return null;\n }\n return ids\n .map((id) => `biRelatesTo.biId = '${escapeFilterValue(id)}'`)\n .join(' OR ');\n}\n\n/**\n * Payment history invoices (Stripe and PayPal) for one or more subscriptions.\n * Sorted newest billDate first.\n */\nexport async function getPaymentHistory(\n gql: GqlRunner,\n subscriptionBiIds: string | string[],\n first = 100,\n): Promise<PaymentHistoryItem[]> {\n const filter = buildPaymentHistoryFilter(subscriptionBiIds);\n if (!filter) {\n return [];\n }\n\n const data = await gql(GET_PAYMENT_HISTORY, { filter, first });\n const edges = data?.filterTwouInvoice?.edges ?? [];\n const seen = new Set<string>();\n\n return edges\n .map((edge: { node?: Record<string, any> }) => edge?.node)\n .filter(Boolean)\n .map((node: Record<string, any>) => normalizeInvoice(node))\n .filter((invoice: PaymentHistoryItem) => {\n if (!invoice.biId) return true;\n if (seen.has(invoice.biId)) return false;\n seen.add(invoice.biId);\n return true;\n })\n .sort((a: PaymentHistoryItem, b: PaymentHistoryItem) => {\n const aTime = a.billDate ? new Date(a.billDate).getTime() : 0;\n const bTime = b.billDate ? new Date(b.billDate).getTime() : 0;\n return bTime - aTime;\n });\n}\n"]}
@@ -13,6 +13,7 @@ import ResubscribeCard from '../components/ResubscribeCard/ResubscribeCard';
13
13
  import SubscriptionTabs from '../components/SubscriptionTabs/SubscriptionTabs';
14
14
  import messages from '../components/messages';
15
15
  import { useBillingPlansQuery, useIsSubscriberQuery, usePaymentHistoryQuery, useReactivateSubscriptionMutation, useViaxClient, useViaxSession, } from '../data/hooks/useManageQueries';
16
+ import { getPaymentHistorySubscriptionIds } from '../data/services/subscription/getPaymentHistory';
16
17
  import { getPlanPrice } from '../utils/billingDetails';
17
18
  import { formatDisplayDate } from '../utils/formatDate';
18
19
  import { resolvePlanLabel, resolveSubscriptionView, } from '../utils/subscriptionView';
@@ -27,7 +28,7 @@ const ManageSubscriptionPage = () => {
27
28
  const billingPlansQuery = useBillingPlansQuery(client, sessionReady);
28
29
  const reactivateMutation = useReactivateSubscriptionMutation(client);
29
30
  const subscriptionBiId = (_b = (_a = subscriberQuery.data) === null || _a === void 0 ? void 0 : _a.subscriptionBiId) !== null && _b !== void 0 ? _b : null;
30
- const paymentHistoryQuery = usePaymentHistoryQuery(client, sessionReady && activeTab === 'payment-history', subscriptionBiId);
31
+ const paymentHistoryQuery = usePaymentHistoryQuery(client, sessionReady && activeTab === 'payment-history', getPaymentHistorySubscriptionIds(subscriberQuery.data));
31
32
  const subscriber = (_c = subscriberQuery.data) !== null && _c !== void 0 ? _c : null;
32
33
  const planCycle = resolvePlanLabel(subscriber);
33
34
  const planPrice = getPlanPrice((_e = (_d = billingPlansQuery.data) === null || _d === void 0 ? void 0 : _d.plans) !== null && _e !== void 0 ? _e : [], planCycle);
@@ -1 +1 @@
1
- {"version":3,"file":"ManageSubscriptionPage.js","sourceRoot":"","sources":["../../src/manageSubscriptionPage/ManageSubscriptionPage.tsx"],"names":[],"mappings":";AAAA,OAAc,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACnD,OAAO,EACL,KAAK,EACL,SAAS,EACT,OAAO,GACR,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAEjD,OAAO,kBAAkB,MAAM,qDAAqD,CAAC;AACrF,OAAO,gBAAgB,MAAM,iDAAiD,CAAC;AAC/E,OAAO,oBAAoB,EAAE,EAC3B,WAAW,GACZ,MAAM,yDAAyD,CAAC;AACjE,OAAO,UAAU,MAAM,qCAAqC,CAAC;AAC7D,OAAO,kBAAkB,MAAM,qDAAqD,CAAC;AACrF,OAAO,cAAc,MAAM,6CAA6C,CAAC;AACzE,OAAO,sBAAsB,MAAM,6DAA6D,CAAC;AACjG,OAAO,eAAe,MAAM,+CAA+C,CAAC;AAC5E,OAAO,gBAAgB,MAAM,iDAAiD,CAAC;AAC/E,OA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AClB,KAAK,EAAE,SAAS,GAChB,IACE,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,sBAAsB,CAAC","sourcesContent":["import React, { useEffect, useState } from 'react';\nimport {\n Alert,\n Container,\n Spinner,\n} from '@openedx/paragon';\nimport { useIntl } from '@openedx/frontend-base';\n\nimport ActiveSubscription from '../components/ActiveSubscription/ActiveSubscription';\nimport BecomeSubscriber from '../components/BecomeSubscriber/BecomeSubscriber';\nimport CanceledSubscription, {\n RenewBanner,\n} from '../components/CanceledSubscription/CanceledSubscription';\nimport HelpFooter from '../components/HelpFooter/HelpFooter';\nimport OrderHistoryHeader from '../components/OrderHistoryHeader/OrderHistoryHeader';\nimport PaymentHistory from '../components/PaymentHistory/PaymentHistory';\nimport RenewSubscriptionModal from '../components/RenewSubscriptionModal/RenewSubscriptionModal';\nimport ResubscribeCard from '../components/ResubscribeCard/ResubscribeCard';\nimport SubscriptionTabs from '../components/SubscriptionTabs/SubscriptionTabs';\nimport messages from '../components/messages';\nimport {\n useBillingPlansQuery,\n useIsSubscriberQuery,\n usePaymentHistoryQuery,\n useReactivateSubscriptionMutation,\n useViaxClient,\n useViaxSession,\n} from '../data/hooks/useManageQueries';\nimport type { ManageTab } from '../types';\nimport { getPlanPrice } from '../utils/billingDetails';\nimport { formatDisplayDate } from '../utils/formatDate';\nimport {\n resolvePlanLabel,\n resolveSubscriptionView,\n} from '../utils/subscriptionView';\n\nconst ManageSubscriptionPage: React.FC = () => {\n const { formatMessage } = useIntl();\n const [activeTab, setActiveTab] = useState<ManageTab>('subscription');\n const [isRenewModalOpen, setIsRenewModalOpen] = useState(false);\n const client = useViaxClient();\n const { sessionReady, isSessionLoading, isSessionError } = useViaxSession(client);\n const subscriberQuery = useIsSubscriberQuery(client, sessionReady);\n const billingPlansQuery = useBillingPlansQuery(client, sessionReady);\n const reactivateMutation = useReactivateSubscriptionMutation(client);\n const subscriptionBiId = subscriberQuery.data?.subscriptionBiId ?? null;\n const paymentHistoryQuery = usePaymentHistoryQuery(\n client,\n sessionReady && activeTab === 'payment-history',\n subscriptionBiId,\n );\n\n const subscriber = subscriberQuery.data ?? null;\n const planCycle = resolvePlanLabel(subscriber);\n const planPrice = getPlanPrice(\n billingPlansQuery.data?.plans ?? [],\n planCycle,\n );\n const price = planPrice?.amount ?? null;\n const currency = planPrice?.currency ?? null;\n const renewalDate = formatDisplayDate(\n subscriber?.currentPeriodEnd ?? subscriber?.subscriptionEndDate,\n );\n\n const handleOpenRenewModal = () => {\n if (!subscriptionBiId) {\n return;\n }\n reactivateMutation.reset();\n setIsRenewModalOpen(true);\n };\n\n const handleConfirmRenew = () => {\n if (!subscriptionBiId || reactivateMutation.isPending) {\n return;\n }\n reactivateMutation.mutate(subscriptionBiId);\n };\n\n useEffect(() => {\n if (reactivateMutation.isSuccess) {\n setIsRenewModalOpen(false);\n }\n }, [reactivateMutation.isSuccess]);\n\n const isLoading = isSessionLoading || (sessionReady && subscriberQuery.isPending);\n const isError = isSessionError || subscriberQuery.isError;\n\n if (isLoading) {\n return (\n <div className=\"manage-page manage-page--loading d-flex justify-content-center align-items-center\">\n <Spinner\n animation=\"border\"\n screenReaderText={formatMessage(messages['manage.loading'])}\n />\n </div>\n );\n }\n\n if (isError) {\n return (\n <div className=\"manage-page\">\n <Container size=\"lg\" className=\"manage-page__inner px-3 px-md-4 py-5\">\n <Alert variant=\"danger\">{formatMessage(messages['manage.error'])}</Alert>\n </Container>\n </div>\n );\n }\n\n const resolvedView = resolveSubscriptionView(subscriber);\n const showRenewBanner = resolvedView === 'canceled_access';\n const renewProps = {\n onRenew: handleOpenRenewModal,\n };\n\n let subscriptionPanel: React.ReactNode;\n switch (resolvedView) {\n case 'active':\n subscriptionPanel = <ActiveSubscription subscriber={subscriber} />;\n break;\n case 'canceled_access':\n subscriptionPanel = (\n <CanceledSubscription subscriber={subscriber} {...renewProps} />\n );\n break;\n case 'canceled_expired':\n subscriptionPanel = (\n <ResubscribeCard\n subscriber={subscriber}\n price={price}\n currency={currency}\n />\n );\n break;\n case 'none':\n default:\n subscriptionPanel = (\n <BecomeSubscriber price={price} currency={currency} />\n );\n break;\n }\n\n return (\n <div className=\"manage-page\">\n {showRenewBanner && (\n <div className=\"manage-renew-banner py-5 mb-2\">\n <Container size=\"lg\" className=\"px-3 px-md-4\">\n <div className=\"manage-renew-banner__inner d-flex flex-column align-items-start\">\n <RenewBanner\n expireDate={renewalDate}\n {...renewProps}\n />\n </div>\n </Container>\n </div>\n )}\n\n <Container size=\"lg\" className=\"manage-page__inner px-3 px-md-4 py-5\">\n <OrderHistoryHeader />\n <SubscriptionTabs activeTab={activeTab} onChange={setActiveTab} />\n\n {activeTab === 'subscription' ? (\n <div\n role=\"tabpanel\"\n id=\"manage-tabpanel-subscription\"\n aria-labelledby=\"manage-tab-subscription\"\n >\n {subscriptionPanel}\n <HelpFooter />\n </div>\n ) : (\n <div\n role=\"tabpanel\"\n id=\"manage-tabpanel-payment-history\"\n aria-labelledby=\"manage-tab-payment-history\"\n >\n <PaymentHistory\n subscriber={subscriber}\n invoices={paymentHistoryQuery.data ?? []}\n isLoading={paymentHistoryQuery.isPending}\n isError={paymentHistoryQuery.isError}\n />\n <HelpFooter />\n </div>\n )}\n </Container>\n\n <RenewSubscriptionModal\n isOpen={isRenewModalOpen}\n onClose={() => setIsRenewModalOpen(false)}\n onConfirm={handleConfirmRenew}\n isConfirming={reactivateMutation.isPending}\n confirmError={reactivateMutation.isError}\n subscriptionBiId={subscriptionBiId}\n renewalDate={renewalDate}\n price={price}\n currency={currency}\n cycle={planCycle}\n />\n </div>\n );\n};\n\nexport default ManageSubscriptionPage;\n"]}
1
+ {"version":3,"file":"ManageSubscriptionPage.js","sourceRoot":"","sources":["../../src/manageSubscriptionPage/ManageSubscriptionPage.tsx"],"names":[],"mappings":";AAAA,OAAc,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACnD,OAAO,EACL,KAAK,EACL,SAAS,EACT,OAAO,GACR,MAAM,kBAAkB,C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AE5C,KAAC,cAAc,IACb,UAAU,EAAE,UAAU,EACtB,QAAQ,EAAE,MAAA,mBAAmB,CAAC,IAAI,mCAAI,EAAE,EACxC,SAAS,EAAE,mBAAmB,CAAC,SAAS,EACxC,OAAO,EAAE,mBAAmB,CAAC,OAAO,GACpC,EACF,KAAC,UAAU,KAAG,IACV,CACP,IACS,EAEZ,KAAC,sBAAsB,IACrB,MAAM,EAAE,gBAAgB,EACxB,OAAO,EAAE,GAAG,EAAE,CAAC,mBAAmB,CAAC,KAAK,CAAC,EACzC,SAAS,EAAE,kBAAkB,EAC7B,YAAY,EAAE,kBAAkB,CAAC,SAAS,EAC1C,YAAY,EAAE,kBAAkB,CAAC,OAAO,EACxC,gBAAgB,EAAE,gBAAgB,EAClC,WAAW,EAAE,WAAW,EACxB,KAAK,EAAE,KAAK,EACZ,QAAQ,EAAE,QAAQ,EAClB,KAAK,EAAE,SAAS,GAChB,IACE,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,sBAAsB,CAAC","sourcesContent":["import React, { useEffect, useState } from 'react';\nimport {\n Alert,\n Container,\n Spinner,\n} from '@openedx/paragon';\nimport { useIntl } from '@openedx/frontend-base';\n\nimport ActiveSubscription from '../components/ActiveSubscription/ActiveSubscription';\nimport BecomeSubscriber from '../components/BecomeSubscriber/BecomeSubscriber';\nimport CanceledSubscription, {\n RenewBanner,\n} from '../components/CanceledSubscription/CanceledSubscription';\nimport HelpFooter from '../components/HelpFooter/HelpFooter';\nimport OrderHistoryHeader from '../components/OrderHistoryHeader/OrderHistoryHeader';\nimport PaymentHistory from '../components/PaymentHistory/PaymentHistory';\nimport RenewSubscriptionModal from '../components/RenewSubscriptionModal/RenewSubscriptionModal';\nimport ResubscribeCard from '../components/ResubscribeCard/ResubscribeCard';\nimport SubscriptionTabs from '../components/SubscriptionTabs/SubscriptionTabs';\nimport messages from '../components/messages';\nimport {\n useBillingPlansQuery,\n useIsSubscriberQuery,\n usePaymentHistoryQuery,\n useReactivateSubscriptionMutation,\n useViaxClient,\n useViaxSession,\n} from '../data/hooks/useManageQueries';\nimport { getPaymentHistorySubscriptionIds } from '../data/services/subscription/getPaymentHistory';\nimport type { ManageTab } from '../types';\nimport { getPlanPrice } from '../utils/billingDetails';\nimport { formatDisplayDate } from '../utils/formatDate';\nimport {\n resolvePlanLabel,\n resolveSubscriptionView,\n} from '../utils/subscriptionView';\n\nconst ManageSubscriptionPage: React.FC = () => {\n const { formatMessage } = useIntl();\n const [activeTab, setActiveTab] = useState<ManageTab>('subscription');\n const [isRenewModalOpen, setIsRenewModalOpen] = useState(false);\n const client = useViaxClient();\n const { sessionReady, isSessionLoading, isSessionError } = useViaxSession(client);\n const subscriberQuery = useIsSubscriberQuery(client, sessionReady);\n const billingPlansQuery = useBillingPlansQuery(client, sessionReady);\n const reactivateMutation = useReactivateSubscriptionMutation(client);\n const subscriptionBiId = subscriberQuery.data?.subscriptionBiId ?? null;\n const paymentHistoryQuery = usePaymentHistoryQuery(\n client,\n sessionReady && activeTab === 'payment-history',\n getPaymentHistorySubscriptionIds(subscriberQuery.data),\n );\n\n const subscriber = subscriberQuery.data ?? null;\n const planCycle = resolvePlanLabel(subscriber);\n const planPrice = getPlanPrice(\n billingPlansQuery.data?.plans ?? [],\n planCycle,\n );\n const price = planPrice?.amount ?? null;\n const currency = planPrice?.currency ?? null;\n const renewalDate = formatDisplayDate(\n subscriber?.currentPeriodEnd ?? subscriber?.subscriptionEndDate,\n );\n\n const handleOpenRenewModal = () => {\n if (!subscriptionBiId) {\n return;\n }\n reactivateMutation.reset();\n setIsRenewModalOpen(true);\n };\n\n const handleConfirmRenew = () => {\n if (!subscriptionBiId || reactivateMutation.isPending) {\n return;\n }\n reactivateMutation.mutate(subscriptionBiId);\n };\n\n useEffect(() => {\n if (reactivateMutation.isSuccess) {\n setIsRenewModalOpen(false);\n }\n }, [reactivateMutation.isSuccess]);\n\n const isLoading = isSessionLoading || (sessionReady && subscriberQuery.isPending);\n const isError = isSessionError || subscriberQuery.isError;\n\n if (isLoading) {\n return (\n <div className=\"manage-page manage-page--loading d-flex justify-content-center align-items-center\">\n <Spinner\n animation=\"border\"\n screenReaderText={formatMessage(messages['manage.loading'])}\n />\n </div>\n );\n }\n\n if (isError) {\n return (\n <div className=\"manage-page\">\n <Container size=\"lg\" className=\"manage-page__inner px-3 px-md-4 py-5\">\n <Alert variant=\"danger\">{formatMessage(messages['manage.error'])}</Alert>\n </Container>\n </div>\n );\n }\n\n const resolvedView = resolveSubscriptionView(subscriber);\n const showRenewBanner = resolvedView === 'canceled_access';\n const renewProps = {\n onRenew: handleOpenRenewModal,\n };\n\n let subscriptionPanel: React.ReactNode;\n switch (resolvedView) {\n case 'active':\n subscriptionPanel = <ActiveSubscription subscriber={subscriber} />;\n break;\n case 'canceled_access':\n subscriptionPanel = (\n <CanceledSubscription subscriber={subscriber} {...renewProps} />\n );\n break;\n case 'canceled_expired':\n subscriptionPanel = (\n <ResubscribeCard\n subscriber={subscriber}\n price={price}\n currency={currency}\n />\n );\n break;\n case 'none':\n default:\n subscriptionPanel = (\n <BecomeSubscriber price={price} currency={currency} />\n );\n break;\n }\n\n return (\n <div className=\"manage-page\">\n {showRenewBanner && (\n <div className=\"manage-renew-banner py-5 mb-2\">\n <Container size=\"lg\" className=\"px-3 px-md-4\">\n <div className=\"manage-renew-banner__inner d-flex flex-column align-items-start\">\n <RenewBanner\n expireDate={renewalDate}\n {...renewProps}\n />\n </div>\n </Container>\n </div>\n )}\n\n <Container size=\"lg\" className=\"manage-page__inner px-3 px-md-4 py-5\">\n <OrderHistoryHeader />\n <SubscriptionTabs activeTab={activeTab} onChange={setActiveTab} />\n\n {activeTab === 'subscription' ? (\n <div\n role=\"tabpanel\"\n id=\"manage-tabpanel-subscription\"\n aria-labelledby=\"manage-tab-subscription\"\n >\n {subscriptionPanel}\n <HelpFooter />\n </div>\n ) : (\n <div\n role=\"tabpanel\"\n id=\"manage-tabpanel-payment-history\"\n aria-labelledby=\"manage-tab-payment-history\"\n >\n <PaymentHistory\n subscriber={subscriber}\n invoices={paymentHistoryQuery.data ?? []}\n isLoading={paymentHistoryQuery.isPending}\n isError={paymentHistoryQuery.isError}\n />\n <HelpFooter />\n </div>\n )}\n </Container>\n\n <RenewSubscriptionModal\n isOpen={isRenewModalOpen}\n onClose={() => setIsRenewModalOpen(false)}\n onConfirm={handleConfirmRenew}\n isConfirming={reactivateMutation.isPending}\n confirmError={reactivateMutation.isError}\n subscriptionBiId={subscriptionBiId}\n renewalDate={renewalDate}\n price={price}\n currency={currency}\n cycle={planCycle}\n />\n </div>\n );\n};\n\nexport default ManageSubscriptionPage;\n"]}
@@ -10,6 +10,7 @@ export interface CommonTrackingProps {
10
10
  session_id?: string | null;
11
11
  experimentation?: string | null;
12
12
  device_type?: string | null;
13
+ opt_in?: boolean | null;
13
14
  }
14
15
  export declare const setCommonTrackingProps: (props: CommonTrackingProps) => void;
15
16
  export declare const getCommonTrackingProps: () => CommonTrackingProps;
@@ -6,7 +6,7 @@ export const setCommonTrackingProps = (props) => {
6
6
  export const getCommonTrackingProps = () => commonProps;
7
7
  // Single place that maps the subs/init API response -> tracking props
8
8
  export const mapSubsInitToTrackingProps = (data) => {
9
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
9
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
10
10
  return ({
11
11
  free_trial_status: (_a = data === null || data === void 0 ? void 0 : data.userSubscription) === null || _a === void 0 ? void 0 : _a.trialActive,
12
12
  subscription_status: (_b = data === null || data === void 0 ? void 0 : data.userSubscription) === null || _b === void 0 ? void 0 : _b.status,
@@ -19,6 +19,7 @@ export const mapSubsInitToTrackingProps = (data) => {
19
19
  session_id: '',
20
20
  experimentation: '',
21
21
  device_type: '',
22
+ opt_in: (_p = data === null || data === void 0 ? void 0 : data.opt_in) !== null && _p !== void 0 ? _p : null,
22
23
  });
23
24
  };
24
25
  //# sourceMappingURL=trackingContext.js.map
@@ -1 +1 @@
1
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mCAAI,IAAI;QACjD,UAAU,EAAE,EAAE;QACd,eAAe,EAAE,EAAE;QACnB,WAAW,EAAE,EAAE;KAChB,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 paymentMethod?: string | null,\n user_email?: string | null,\n session_id?: string | null,\n experimentation?: string | null,\n device_type?: string | null,\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 paymentMethod: data?.userSubscription?.paymentMethod ?? null,\n user_email: getAuthenticatedUser()?.email ?? null,\n session_id: '',\n experimentation: '',\n device_type: '',\n});\n"]}
1
+ {"version":3,"file":"trackingContext.js","sourceRoot":"","sources":["../../src/tracking/trackingContext.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAiB9D,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,aAAa,EAAE,MAAA,MAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,gBAAgB,0CAAE,aAAa,mCAAI,IAAI;QAC5D,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;KAC7B,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 paymentMethod?: 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}\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 paymentMethod: 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});\n"]}
package/dist/types.d.ts CHANGED
@@ -10,6 +10,12 @@ export interface CurrentUserSubscriberResult {
10
10
  /** Enrollable right now (ACTIVE / TRIAL_ACTIVE). */
11
11
  canEnroll: boolean;
12
12
  subscriptionBiId: string | null;
13
+ /**
14
+ * Every subscription the learner has held (all statuses, newest first),
15
+ * e.g. a cancelled Stripe one plus a newer PayPal one. Payment history
16
+ * lists invoices across all of them. Empty until the API returns it.
17
+ */
18
+ subscriptionBiIds?: string[];
13
19
  status: string | null;
14
20
  currentPeriodEnd: string | null;
15
21
  subscriptionStartDate: string | null;
@@ -54,12 +60,17 @@ export interface SubscriptionEnrollment {
54
60
  /** Absolute certificate link (`COURSES_BASE_URL` + `tCertificateUrl`). */
55
61
  certificateUrl: string | null;
56
62
  }
63
+ export type PaymentProcessor = 'stripe' | 'paypal';
57
64
  /** Normalized invoice row for the Payment history tab. */
58
65
  export interface PaymentHistoryItem {
59
66
  biId: string;
60
67
  /** Display order number, e.g. EDX-BI3X25N5SY30OSIK */
61
68
  orderNumber: string;
62
69
  stripeInvoiceId: string | null;
70
+ /** PayPal sale id, or `trial:<PayPal subscription id>` for a $0 trial row. */
71
+ paypalInvoiceId: string | null;
72
+ /** Which processor billed this invoice; null when neither id is set. */
73
+ paymentProcessor: PaymentProcessor | null;
63
74
  status: string | null;
64
75
  billDate: string | null;
65
76
  periodStart: string | null;
package/dist/types.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;GAEG","sourcesContent":["/**\n * Manage Subscription — domain types for Viax subscriber + enrollment data.\n */\n\n/** GraphQL runner used by VIAX fetchers. */\nexport type GqlRunner = (\n query: string,\n variables?: Record<string, unknown>,\n) => Promise<any>;\n\n/** Result of `tIsCurrentUserSubscriber` (JSON scalar). */\nexport interface CurrentUserSubscriberResult {\n /** Has/expects access — drive manage vs upsell messaging. */\n isSubscriber: boolean,\n /** Enrollable right now (ACTIVE / TRIAL_ACTIVE). */\n canEnroll: boolean,\n subscriptionBiId: string | null,\n status: string | null,\n currentPeriodEnd: string | null,\n subscriptionStartDate: string | null,\n subscriptionEndDate: string | null,\n /**\n * Billing cycle / plan label used by UI (from `billingFrequency`,\n * `renewalType`, or `planName` on the API payload).\n */\n renewalType?: string | null,\n /** Optional cancel timestamp when present. */\n canceledAt?: string | null,\n /** Optional price display amount when present. */\n amount?: string | null,\n currency?: string | null,\n /**\n * Billing-plan fallback fields used when `renewalType` is missing\n * (e.g. PayPal payloads). See `resolvePlanLabel`.\n */\n billingPlanUid?: string | null,\n interval?: string | null,\n billingInterval?: string | null,\n bipOwnershipModel?: { uid?: string, omName?: string } | null,\n}\n\n/** Normalized enrollment for the cancel confirmation course list. */\nexport interface SubscriptionEnrollment {\n biId: string,\n courseMaId: string | null,\n courseName: string | null,\n courseSlug: string | null,\n /** Course card / thumbnail image. */\n imageUrl: string | null,\n orgName: string | null,\n orgLogoUrl: string | null,\n courseRunKey: string | null,\n /** TwouEnrollment bpStatus.code (ACTIVE, COMPLETED, …). */\n status: string | null,\n /** True when the enrollment has a certificate id and/or URL. */\n hasCertificate: boolean,\n /** Absolute certificate link (`COURSES_BASE_URL` + `tCertificateUrl`). */\n certificateUrl: string | null,\n}\n\n/** Normalized invoice row for the Payment history tab. */\nexport interface PaymentHistoryItem {\n biId: string,\n /** Display order number, e.g. EDX-BI3X25N5SY30OSIK */\n orderNumber: string,\n stripeInvoiceId: string | null,\n status: string | null,\n billDate: string | null,\n periodStart: string | null,\n periodEnd: string | null,\n /** Charged amount in major currency units (e.g. 59.00). */\n amount: number,\n currency: string,\n isTrial: boolean,\n}\n\n/** UI view derived from subscriber status. */\nexport type SubscriptionView =\n | 'none'\n | 'active'\n | 'canceled_access'\n | 'canceled_expired';\n\nexport type ManageTab = 'subscription' | 'payment-history';\n\nexport type BillingCycle = 'monthly' | 'annual';\n\nexport interface BillingPlanOwnershipModel {\n uid: string,\n omName: string,\n}\n\n/** Normalized row from `filterCustomerBillingPlan`. */\nexport interface BillingPlan {\n uid: string,\n stripePriceId: string,\n /** Price amount e.g. \"39.99\" */\n amount: string,\n /** Currency code e.g. \"USD\" */\n currency: string,\n isTemplate: boolean,\n ownershipModel: BillingPlanOwnershipModel,\n}\n\nexport interface BillingPlansResult {\n plans: BillingPlan[],\n}\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;GAEG","sourcesContent":["/**\n * Manage Subscription — domain types for Viax subscriber + enrollment data.\n */\n\n/** GraphQL runner used by VIAX fetchers. */\nexport type GqlRunner = (\n query: string,\n variables?: Record<string, unknown>,\n) => Promise<any>;\n\n/** Result of `tIsCurrentUserSubscriber` (JSON scalar). */\nexport interface CurrentUserSubscriberResult {\n /** Has/expects access — drive manage vs upsell messaging. */\n isSubscriber: boolean,\n /** Enrollable right now (ACTIVE / TRIAL_ACTIVE). */\n canEnroll: boolean,\n subscriptionBiId: string | null,\n /**\n * Every subscription the learner has held (all statuses, newest first),\n * e.g. a cancelled Stripe one plus a newer PayPal one. Payment history\n * lists invoices across all of them. Empty until the API returns it.\n */\n subscriptionBiIds?: string[],\n status: string | null,\n currentPeriodEnd: string | null,\n subscriptionStartDate: string | null,\n subscriptionEndDate: string | null,\n /**\n * Billing cycle / plan label used by UI (from `billingFrequency`,\n * `renewalType`, or `planName` on the API payload).\n */\n renewalType?: string | null,\n /** Optional cancel timestamp when present. */\n canceledAt?: string | null,\n /** Optional price display amount when present. */\n amount?: string | null,\n currency?: string | null,\n /**\n * Billing-plan fallback fields used when `renewalType` is missing\n * (e.g. PayPal payloads). See `resolvePlanLabel`.\n */\n billingPlanUid?: string | null,\n interval?: string | null,\n billingInterval?: string | null,\n bipOwnershipModel?: { uid?: string, omName?: string } | null,\n}\n\n/** Normalized enrollment for the cancel confirmation course list. */\nexport interface SubscriptionEnrollment {\n biId: string,\n courseMaId: string | null,\n courseName: string | null,\n courseSlug: string | null,\n /** Course card / thumbnail image. */\n imageUrl: string | null,\n orgName: string | null,\n orgLogoUrl: string | null,\n courseRunKey: string | null,\n /** TwouEnrollment bpStatus.code (ACTIVE, COMPLETED, …). */\n status: string | null,\n /** True when the enrollment has a certificate id and/or URL. */\n hasCertificate: boolean,\n /** Absolute certificate link (`COURSES_BASE_URL` + `tCertificateUrl`). */\n certificateUrl: string | null,\n}\n\nexport type PaymentProcessor = 'stripe' | 'paypal';\n\n/** Normalized invoice row for the Payment history tab. */\nexport interface PaymentHistoryItem {\n biId: string,\n /** Display order number, e.g. EDX-BI3X25N5SY30OSIK */\n orderNumber: string,\n stripeInvoiceId: string | null,\n /** PayPal sale id, or `trial:<PayPal subscription id>` for a $0 trial row. */\n paypalInvoiceId: string | null,\n /** Which processor billed this invoice; null when neither id is set. */\n paymentProcessor: PaymentProcessor | null,\n status: string | null,\n billDate: string | null,\n periodStart: string | null,\n periodEnd: string | null,\n /** Charged amount in major currency units (e.g. 59.00). */\n amount: number,\n currency: string,\n isTrial: boolean,\n}\n\n/** UI view derived from subscriber status. */\nexport type SubscriptionView =\n | 'none'\n | 'active'\n | 'canceled_access'\n | 'canceled_expired';\n\nexport type ManageTab = 'subscription' | 'payment-history';\n\nexport type BillingCycle = 'monthly' | 'annual';\n\nexport interface BillingPlanOwnershipModel {\n uid: string,\n omName: string,\n}\n\n/** Normalized row from `filterCustomerBillingPlan`. */\nexport interface BillingPlan {\n uid: string,\n stripePriceId: string,\n /** Price amount e.g. \"39.99\" */\n amount: string,\n /** Currency code e.g. \"USD\" */\n currency: string,\n isTemplate: boolean,\n ownershipModel: BillingPlanOwnershipModel,\n}\n\nexport interface BillingPlansResult {\n plans: BillingPlan[],\n}\n"]}
@@ -12,10 +12,11 @@ export declare const GET_IS_CURRENT_USER_SUBSCRIBER = "query IsCurrentUserSubscr
12
12
  */
13
13
  export declare const GET_SUBSCRIPTION_ENROLLMENTS = "query EnrollmentsForSubscriptions($filter: String!) {\n filterTwouEnrollment(_first: 200, _filter: $filter) {\n edges {\n node {\n biId\n tSubscriptionBiId\n bpStatus { code }\n tCourseRunKey\n tCertificateId\n tCertificateUrl\n tCourse {\n maId\n maName\n imageUrl\n tBrandText\n tSchools {\n tName\n tSortValue\n }\n }\n }\n }\n }\n}";
14
14
  /**
15
- * Invoices for the learner's subscription (payment history).
16
- * Filter is inlined client-side: biRelatesTo.biId = '<subscriptionBiId>'.
15
+ * Invoices for the learner's subscriptions (payment history) — Stripe and PayPal.
16
+ * Filter is inlined client-side, one clause per subscription:
17
+ * biRelatesTo.biId = '<biId>' OR biRelatesTo.biId = '<biId>'.
17
18
  */
18
- export declare const GET_PAYMENT_HISTORY = "query PaymentHistory($filter: String!, $first: Int!) {\n filterTwouInvoice(_first: $first, _filter: $filter) {\n edges {\n node {\n biId\n tStripeInvoiceId\n bpStatus { code name }\n billDate\n billBillingPeriod { start end }\n billFinancialCharges {\n fichAmount {\n amount\n units { code }\n }\n }\n }\n }\n }\n}";
19
+ export declare const GET_PAYMENT_HISTORY = "query PaymentHistory($filter: String!, $first: Int!) {\n filterTwouInvoice(_first: $first, _filter: $filter) {\n edges {\n node {\n biId\n tStripeInvoiceId\n tPaypalInvoiceId\n bpStatus { code name }\n billDate\n billBillingPeriod { start end }\n billFinancialCharges {\n fichAmount {\n amount\n units { code }\n }\n }\n }\n }\n }\n}";
19
20
  /**
20
21
  * Cancel the learner's subscription (default: at period end).
21
22
  * Pass `immediate: true` to end access immediately.
@@ -37,8 +37,9 @@ export const GET_SUBSCRIPTION_ENROLLMENTS = `query EnrollmentsForSubscriptions($
37
37
  }
38
38
  }`;
39
39
  /**
40
- * Invoices for the learner's subscription (payment history).
41
- * Filter is inlined client-side: biRelatesTo.biId = '<subscriptionBiId>'.
40
+ * Invoices for the learner's subscriptions (payment history) — Stripe and PayPal.
41
+ * Filter is inlined client-side, one clause per subscription:
42
+ * biRelatesTo.biId = '<biId>' OR biRelatesTo.biId = '<biId>'.
42
43
  */
43
44
  export const GET_PAYMENT_HISTORY = `query PaymentHistory($filter: String!, $first: Int!) {
44
45
  filterTwouInvoice(_first: $first, _filter: $filter) {
@@ -46,6 +47,7 @@ export const GET_PAYMENT_HISTORY = `query PaymentHistory($filter: String!, $firs
46
47
  node {
47
48
  biId
48
49
  tStripeInvoiceId
50
+ tPaypalInvoiceId
49
51
  bpStatus { code name }
50
52
  billDate
51
53
  billBillingPeriod { start end }
@@ -1 +1 @@
1
- {"version":3,"file":"queries.js","sourceRoot":"","sources":["../../src/utils/queries.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;;GAGG;AACH,MAAM,CAAC,MAAM,8BAA8B,GAAG;;EAE5C,CAAC;AAEH;;;GAGG;AACH,MAAM,CAAC,MAAM,4BAA4B,GAAG;;;;;;;;;;;;;;;;;;;;;;;EAuB1C,CAAC;AAEH;;;GAGG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG;;;;;;;;;;;;;;;;;;EAkBjC,CAAC;AAEH;;;GAGG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG;;EAEjC,CAAC;AAEH;;GAEG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG;;EAErC,CAAC;AAEH;;GAEG;AACH,MAAM,CAAC,MAAM,+BAA+B,GAAG;;;;;;;;;;;;;;;;;;;EAmB7C,CAAC;AAEH;;;GAGG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG;;;;;;;;;;;;;;;EAe/B,CAAC;AAEH;;;GAGG;AACH,MAAM,CAAC,MAAM,4BAA4B,GAAG;;;;;;;;EAQ1C,CAAC;AAEH;;GAEG;AACH,MAAM,CAAC,MAAM,kCAAkC,GAAG;;;;;;;;EAQhD,CAAC","sourcesContent":["/**\n * GraphQL documents for the manage-subscription MFE.\n */\n\n/**\n * tIsCurrentUserSubscriber is a JSON scalar — returns the full object;\n * no subfield selection is allowed.\n */\nexport const GET_IS_CURRENT_USER_SUBSCRIBER = `query IsCurrentUserSubscriber {\n tIsCurrentUserSubscriber\n}`;\n\n/**\n * Enrollments for cancel confirmation.\n * Build `_filter` client-side, e.g. tSubscriptionBiId IN ('BI…', 'BI…').\n */\nexport const GET_SUBSCRIPTION_ENROLLMENTS = `query EnrollmentsForSubscriptions($filter: String!) {\n filterTwouEnrollment(_first: 200, _filter: $filter) {\n edges {\n node {\n biId\n tSubscriptionBiId\n bpStatus { code }\n tCourseRunKey\n tCertificateId\n tCertificateUrl\n tCourse {\n maId\n maName\n imageUrl\n tBrandText\n tSchools {\n tName\n tSortValue\n }\n }\n }\n }\n }\n}`;\n\n/**\n * Invoices for the learner's subscription (payment history).\n * Filter is inlined client-side: biRelatesTo.biId = '<subscriptionBiId>'.\n */\nexport const GET_PAYMENT_HISTORY = `query PaymentHistory($filter: String!, $first: Int!) {\n filterTwouInvoice(_first: $first, _filter: $filter) {\n edges {\n node {\n biId\n tStripeInvoiceId\n bpStatus { code name }\n billDate\n billBillingPeriod { start end }\n billFinancialCharges {\n fichAmount {\n amount\n units { code }\n }\n }\n }\n }\n }\n}`;\n\n/**\n * Cancel the learner's subscription (default: at period end).\n * Pass `immediate: true` to end access immediately.\n */\nexport const CANCEL_SUBSCRIPTION = `mutation CancelSubscription($biId: String!, $immediate: Boolean) {\n tCancelSubscription(biId: $biId, immediate: $immediate)\n}`;\n\n/**\n * Resume a cancelled subscription before the period end / cancellation date.\n */\nexport const REACTIVATE_SUBSCRIPTION = `mutation ReactivateSubscription($biId: String!) {\n tReactivateSubscription(biId: $biId)\n}`;\n\n/**\n * Payment method on an existing subscription (for renew / manage display).\n */\nexport const GET_SUBSCRIPTION_PAYMENT_METHOD = `query SubscriptionPaymentMethod($filter: String!) {\n filterTwouSubscription(_first: 1, _filter: $filter) {\n edges {\n node {\n biId\n hiConsistsOf {\n ... on TwouSubscriptionItem {\n paybPayment {\n ... on TwouStripePayment {\n tStripePaymentMethodId\n tPaymentMethodLast4\n tPaymentMethodBrand\n }\n }\n }\n }\n }\n }\n }\n}`;\n\n/**\n * Available customer billing plans (monthly / annual template prices).\n * Same query as frontend-app-subscription-checkout.\n */\nexport const GET_BILLING_PLANS = `query GetBillingPlans {\n filterCustomerBillingPlan(_first: 10) {\n edges {\n node {\n uid\n tStripePriceId\n tStripeAmount {\n amount\n units { code }\n }\n bipIsTemplate\n bipOwnershipModel { uid omName }\n }\n }\n }\n}`;\n\n/**\n * Validate a tokenized card (pm_…) before attaching it to the subscription.\n * Runs after stripe.createPaymentMethod, before UPDATE_SUBSCRIPTION_PAYMENT_METHOD.\n */\nexport const VALIDATE_CART_PAYMENT_METHOD = `mutation ValidateCartPaymentMethod(\n $biId: String!\n $tStripePaymentMethodId: String!\n) {\n tValidateCartPaymentMethod(\n biId: $biId\n tStripePaymentMethodId: $tStripePaymentMethodId\n )\n}`;\n\n/**\n * Attach a new Stripe payment method (pm_…) as the subscription default.\n */\nexport const UPDATE_SUBSCRIPTION_PAYMENT_METHOD = `mutation UpdateSubscriptionPaymentMethod(\n $biId: String!\n $tStripePaymentMethodId: String!\n) {\n tUpdateSubscriptionPaymentMethod(\n biId: $biId\n tStripePaymentMethodId: $tStripePaymentMethodId\n )\n}`;\n"]}
1
+ {"version":3,"file":"queries.js","sourceRoot":"","sources":["../../src/utils/queries.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;;GAGG;AACH,MAAM,CAAC,MAAM,8BAA8B,GAAG;;EAE5C,CAAC;AAEH;;;GAGG;AACH,MAAM,CAAC,MAAM,4BAA4B,GAAG;;;;;;;;;;;;;;;;;;;;;;;EAuB1C,CAAC;AAEH;;;;GAIG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG;;;;;;;;;;;;;;;;;;;EAmBjC,CAAC;AAEH;;;GAGG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG;;EAEjC,CAAC;AAEH;;GAEG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG;;EAErC,CAAC;AAEH;;GAEG;AACH,MAAM,CAAC,MAAM,+BAA+B,GAAG;;;;;;;;;;;;;;;;;;;EAmB7C,CAAC;AAEH;;;GAGG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG;;;;;;;;;;;;;;;EAe/B,CAAC;AAEH;;;GAGG;AACH,MAAM,CAAC,MAAM,4BAA4B,GAAG;;;;;;;;EAQ1C,CAAC;AAEH;;GAEG;AACH,MAAM,CAAC,MAAM,kCAAkC,GAAG;;;;;;;;EAQhD,CAAC","sourcesContent":["/**\n * GraphQL documents for the manage-subscription MFE.\n */\n\n/**\n * tIsCurrentUserSubscriber is a JSON scalar — returns the full object;\n * no subfield selection is allowed.\n */\nexport const GET_IS_CURRENT_USER_SUBSCRIBER = `query IsCurrentUserSubscriber {\n tIsCurrentUserSubscriber\n}`;\n\n/**\n * Enrollments for cancel confirmation.\n * Build `_filter` client-side, e.g. tSubscriptionBiId IN ('BI…', 'BI…').\n */\nexport const GET_SUBSCRIPTION_ENROLLMENTS = `query EnrollmentsForSubscriptions($filter: String!) {\n filterTwouEnrollment(_first: 200, _filter: $filter) {\n edges {\n node {\n biId\n tSubscriptionBiId\n bpStatus { code }\n tCourseRunKey\n tCertificateId\n tCertificateUrl\n tCourse {\n maId\n maName\n imageUrl\n tBrandText\n tSchools {\n tName\n tSortValue\n }\n }\n }\n }\n }\n}`;\n\n/**\n * Invoices for the learner's subscriptions (payment history) — Stripe and PayPal.\n * Filter is inlined client-side, one clause per subscription:\n * biRelatesTo.biId = '<biId>' OR biRelatesTo.biId = '<biId>'.\n */\nexport const GET_PAYMENT_HISTORY = `query PaymentHistory($filter: String!, $first: Int!) {\n filterTwouInvoice(_first: $first, _filter: $filter) {\n edges {\n node {\n biId\n tStripeInvoiceId\n tPaypalInvoiceId\n bpStatus { code name }\n billDate\n billBillingPeriod { start end }\n billFinancialCharges {\n fichAmount {\n amount\n units { code }\n }\n }\n }\n }\n }\n}`;\n\n/**\n * Cancel the learner's subscription (default: at period end).\n * Pass `immediate: true` to end access immediately.\n */\nexport const CANCEL_SUBSCRIPTION = `mutation CancelSubscription($biId: String!, $immediate: Boolean) {\n tCancelSubscription(biId: $biId, immediate: $immediate)\n}`;\n\n/**\n * Resume a cancelled subscription before the period end / cancellation date.\n */\nexport const REACTIVATE_SUBSCRIPTION = `mutation ReactivateSubscription($biId: String!) {\n tReactivateSubscription(biId: $biId)\n}`;\n\n/**\n * Payment method on an existing subscription (for renew / manage display).\n */\nexport const GET_SUBSCRIPTION_PAYMENT_METHOD = `query SubscriptionPaymentMethod($filter: String!) {\n filterTwouSubscription(_first: 1, _filter: $filter) {\n edges {\n node {\n biId\n hiConsistsOf {\n ... on TwouSubscriptionItem {\n paybPayment {\n ... on TwouStripePayment {\n tStripePaymentMethodId\n tPaymentMethodLast4\n tPaymentMethodBrand\n }\n }\n }\n }\n }\n }\n }\n}`;\n\n/**\n * Available customer billing plans (monthly / annual template prices).\n * Same query as frontend-app-subscription-checkout.\n */\nexport const GET_BILLING_PLANS = `query GetBillingPlans {\n filterCustomerBillingPlan(_first: 10) {\n edges {\n node {\n uid\n tStripePriceId\n tStripeAmount {\n amount\n units { code }\n }\n bipIsTemplate\n bipOwnershipModel { uid omName }\n }\n }\n }\n}`;\n\n/**\n * Validate a tokenized card (pm_…) before attaching it to the subscription.\n * Runs after stripe.createPaymentMethod, before UPDATE_SUBSCRIPTION_PAYMENT_METHOD.\n */\nexport const VALIDATE_CART_PAYMENT_METHOD = `mutation ValidateCartPaymentMethod(\n $biId: String!\n $tStripePaymentMethodId: String!\n) {\n tValidateCartPaymentMethod(\n biId: $biId\n tStripePaymentMethodId: $tStripePaymentMethodId\n )\n}`;\n\n/**\n * Attach a new Stripe payment method (pm_…) as the subscription default.\n */\nexport const UPDATE_SUBSCRIPTION_PAYMENT_METHOD = `mutation UpdateSubscriptionPaymentMethod(\n $biId: String!\n $tStripePaymentMethodId: String!\n) {\n tUpdateSubscriptionPaymentMethod(\n biId: $biId\n tStripePaymentMethodId: $tStripePaymentMethodId\n )\n}`;\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@edx/frontend-app-subscription-manage",
3
- "version": "1.11.0",
3
+ "version": "1.13.0",
4
4
  "description": "Subscription Manage Frontend application",
5
5
  "repository": {
6
6
  "type": "git",