@edx/frontend-app-subscription-manage 1.18.1 → 1.18.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Main.js +8 -2
- package/dist/Main.js.map +1 -1
- package/dist/components/ActiveSubscription/ActiveSubscription.js +2 -2
- package/dist/components/ActiveSubscription/ActiveSubscription.js.map +1 -1
- package/dist/components/CanceledSubscription/CanceledSubscription.js +2 -3
- package/dist/components/CanceledSubscription/CanceledSubscription.js.map +1 -1
- package/dist/components/RenewSubscriptionModal/RenewSubscriptionModal.js +2 -2
- package/dist/components/RenewSubscriptionModal/RenewSubscriptionModal.js.map +1 -1
- package/dist/data/services/segment/AnalyticsPageWrap.d.ts +9 -0
- package/dist/data/services/segment/AnalyticsPageWrap.js +14 -0
- package/dist/data/services/segment/AnalyticsPageWrap.js.map +1 -0
- package/dist/data/services/segment/index.js +4 -1
- package/dist/data/services/segment/index.js.map +1 -1
- package/dist/tracking/trackingContext.d.ts +1 -1
- package/dist/tracking/trackingContext.js +1 -1
- package/dist/tracking/trackingContext.js.map +1 -1
- package/package.json +1 -1
package/dist/Main.js
CHANGED
|
@@ -1,15 +1,21 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
2
|
+
import { useLocation } from 'react-router-dom';
|
|
3
|
+
import { CurrentAppProvider, getSiteConfig, useIntl } from '@openedx/frontend-base';
|
|
3
4
|
import { Helmet } from 'react-helmet';
|
|
4
5
|
import { Outlet } from 'react-router-dom';
|
|
5
6
|
import { appId } from './constants';
|
|
6
7
|
import messages from './messages';
|
|
8
|
+
import AnalyticsPageWrap from './data/services/segment/AnalyticsPageWrap';
|
|
7
9
|
import './style.scss';
|
|
8
10
|
const Main = () => {
|
|
9
11
|
const { formatMessage } = useIntl();
|
|
12
|
+
const { pathname } = useLocation();
|
|
13
|
+
const pageAction = pathname.replace(/\/$/, '').split('/').pop();
|
|
10
14
|
return (_jsxs(CurrentAppProvider, { appId: appId, children: [_jsx(Helmet, { children: _jsx("title", { children: formatMessage(messages['template.page.title'], {
|
|
11
15
|
siteName: getSiteConfig().siteName,
|
|
12
|
-
}) }) }), _jsx("main", { className: "d-flex flex-column flex-grow-1", children: _jsx(
|
|
16
|
+
}) }) }), _jsx("main", { className: "d-flex flex-column flex-grow-1", children: _jsx(AnalyticsPageWrap, { pageName: `Subscription Manage ${pageAction === 'cancel' ? 'Cancel' : ''}`, properties: {
|
|
17
|
+
category: 'Subscription'
|
|
18
|
+
}, children: _jsx(Outlet, {}) }) })] }));
|
|
13
19
|
};
|
|
14
20
|
export default Main;
|
|
15
21
|
//# sourceMappingURL=Main.js.map
|
package/dist/Main.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Main.js","sourceRoot":"","sources":["../src/Main.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,kBAAkB,EAClB,aAAa,EACb,OAAO,
|
|
1
|
+
{"version":3,"file":"Main.js","sourceRoot":"","sources":["../src/Main.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EACL,kBAAkB,EAClB,aAAa,EACb,OAAO,EACR,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,QAAQ,MAAM,YAAY,CAAC;AAClC,OAAO,iBAAiB,MAAM,2CAA2C,CAAC;AAE1E,OAAO,cAAc,CAAC;AAEtB,MAAM,IAAI,GAAG,GAAG,EAAE;IAChB,MAAM,EAAE,aAAa,EAAE,GAAG,OAAO,EAAE,CAAC;IACpC,MAAM,EAAE,QAAQ,EAAE,GAAG,WAAW,EAAE,CAAC;IACnC,MAAM,UAAU,GAAG,QAAQ,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,CAAC;IAChE,OAAO,CACL,MAAC,kBAAkB,IAAC,KAAK,EAAE,KAAK,aAC9B,KAAC,MAAM,cACL,0BACG,aAAa,CAAC,QAAQ,CAAC,qBAAqB,CAAC,EAAE;wBAC9C,QAAQ,EAAE,aAAa,EAAE,CAAC,QAAQ;qBACnC,CAAC,GACI,GACD,EACT,eAAM,SAAS,EAAC,gCAAgC,YAC9C,KAAC,iBAAiB,IAChB,QAAQ,EAAE,uBAAuB,UAAU,KAAK,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,EAAE,EAC1E,UAAU,EAAE;wBACV,QAAQ,EAAE,cAAc;qBACzB,YAED,KAAC,MAAM,KAAG,GACQ,GACf,IACY,CACtB,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,IAAI,CAAC","sourcesContent":["import { useLocation } from 'react-router-dom';\nimport {\n CurrentAppProvider,\n getSiteConfig,\n useIntl\n} from '@openedx/frontend-base';\nimport { Helmet } from 'react-helmet';\nimport { Outlet } from 'react-router-dom';\nimport { appId } from './constants';\nimport messages from './messages';\nimport AnalyticsPageWrap from './data/services/segment/AnalyticsPageWrap';\n\nimport './style.scss';\n\nconst Main = () => {\n const { formatMessage } = useIntl();\n const { pathname } = useLocation();\n const pageAction = pathname.replace(/\\/$/, '').split('/').pop();\n return (\n <CurrentAppProvider appId={appId}>\n <Helmet>\n <title>\n {formatMessage(messages['template.page.title'], {\n siteName: getSiteConfig().siteName,\n })}\n </title>\n </Helmet>\n <main className=\"d-flex flex-column flex-grow-1\">\n <AnalyticsPageWrap\n pageName={`Subscription Manage ${pageAction === 'cancel' ? 'Cancel' : ''}`}\n properties={{\n category: 'Subscription'\n }}\n >\n <Outlet />\n </AnalyticsPageWrap>\n </main>\n </CurrentAppProvider>\n );\n};\n\nexport default Main;\n"]}
|
|
@@ -18,14 +18,14 @@ const ActiveSubscription = ({ subscriber }) => {
|
|
|
18
18
|
const sinceDate = formatDisplayDate(subscriber === null || subscriber === void 0 ? void 0 : subscriber.subscriptionStartDate);
|
|
19
19
|
const nextPayment = formatDisplayDate(subscriber === null || subscriber === void 0 ? void 0 : subscriber.currentPeriodEnd);
|
|
20
20
|
const canUpdatePayment = Boolean(subscriber === null || subscriber === void 0 ? void 0 : subscriber.subscriptionBiId);
|
|
21
|
-
const {
|
|
21
|
+
const { payment_method } = getCommonTrackingProps();
|
|
22
22
|
const handleUpdatePaymentClick = () => {
|
|
23
23
|
trackManageSubscriptionUpdatePaymentButtonClick({ buttonName: 'updatePayment' });
|
|
24
24
|
setIsPaymentModalOpen(true);
|
|
25
25
|
};
|
|
26
26
|
return (_jsxs("section", { className: "manage-section mt-4", children: [_jsx("h2", { className: "manage-section__title h3 font-weight-bold text-primary-500 mb-1", children: formatMessage(messages['manage.active.heading']) }), sinceDate && (_jsx("p", { className: "manage-section__subtitle text-gray-700 mb-3", children: formatMessage(messages['manage.active.since'], { date: sinceDate }) })), _jsxs("div", { className: "manage-card d-flex flex-column flex-md-row align-items-md-center justify-content-md-between bg-white border p-4 rounded", children: [_jsxs("div", { className: "manage-card__content", children: [_jsxs("div", { className: "manage-card__status-row d-flex align-items-center mb-1", children: [_jsx(Icon, { src: SpinnerIcon, className: "manage-card__status-badge manage-card__status-badge--sync flex-shrink-0", "aria-hidden": true }), _jsx("span", { className: "manage-card__status-label font-weight-bold text-primary-500", children: formatMessage(plan === 'annual'
|
|
27
27
|
? messages['manage.active.statusAnnual']
|
|
28
|
-
: messages['manage.active.statusMonthly']) })] }), nextPayment && (_jsx("p", { className: "manage-card__body text-gray-700 mb-0", children: formatMessage(messages['manage.active.nextPayment'], { date: nextPayment }) }))] }), ((
|
|
28
|
+
: messages['manage.active.statusMonthly']) })] }), nextPayment && (_jsx("p", { className: "manage-card__body text-gray-700 mb-0", children: formatMessage(messages['manage.active.nextPayment'], { date: nextPayment }) }))] }), ((payment_method === null || payment_method === void 0 ? void 0 : payment_method.toLowerCase()) === STRIPE_PAYMENT_GATEWAY) && (_jsx("div", { className: "manage-card__actions manage-card__actions--row d-flex flex-wrap align-items-center flex-shrink-0 justify-content-end", children: _jsx(Button, { className: "manage-btn manage-btn--dark", variant: "primary", onClick: handleUpdatePaymentClick, disabled: !canUpdatePayment, children: formatMessage(messages['manage.active.updatePayment']) }) }))] }), _jsxs("p", { className: "manage-cancel-prompt mt-3 text-right text-gray-700 small", children: [formatMessage(messages['manage.active.cancelPrompt']), ' ', _jsx(Link, { className: "manage-cancel-prompt__link text-info-500 font-weight-bold text-decoration-none", to: `/${MANAGE_PAGE_PATH}/cancel`, children: formatMessage(messages['manage.active.cancelLink']) })] }), _jsx(UpdatePaymentMethodModal, { isOpen: isPaymentModalOpen, onClose: () => setIsPaymentModalOpen(false), subscriptionBiId: subscriber === null || subscriber === void 0 ? void 0 : subscriber.subscriptionBiId, nextBillingDate: nextPayment })] }));
|
|
29
29
|
};
|
|
30
30
|
export default ActiveSubscription;
|
|
31
31
|
//# sourceMappingURL=ActiveSubscription.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ActiveSubscription.js","sourceRoot":"","sources":["../../../src/components/ActiveSubscription/ActiveSubscription.tsx"],"names":[],"mappings":";AAAA,OAAc,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACxC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAGxC,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAChE,OAAO,EAAE,gBAAgB,EAAE,sBAAsB,EA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O,EAAE,GAAG,EAAE,CAAC,qBAAqB,CAAC,KAAK,CAAC,EAC3C,gBAAgB,EAAE,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,gBAAgB,EAC9C,eAAe,EAAE,WAAW,GAC5B,IACM,CACX,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,kBAAkB,CAAC","sourcesContent":["import React, { useState } from 'react';\nimport { Button, Icon } from '@openedx/paragon';\nimport { SpinnerIcon } from '@openedx/paragon/icons';\nimport { useIntl } from '@openedx/frontend-base';\nimport { Link } from 'react-router-dom';\n\nimport type { CurrentUserSubscriberResult } from '../../types';\nimport { formatDisplayDate } from '../../utils/formatDate';\nimport { resolvePlanLabel } from '../../utils/subscriptionView';\nimport { MANAGE_PAGE_PATH, STRIPE_PAYMENT_GATEWAY } from '../../constants';\nimport UpdatePaymentMethodModal from '../UpdatePaymentMethodModal/UpdatePaymentMethodModal';\nimport messages from '../messages';\nimport { trackManageSubscriptionUpdatePaymentButtonClick } from '@src/tracking';\nimport { getCommonTrackingProps } from '@src/tracking/trackingContext';\n\ninterface ActiveSubscriptionProps {\n subscriber: CurrentUserSubscriberResult | null,\n}\n\nconst ActiveSubscription: React.FC<ActiveSubscriptionProps> = ({ subscriber }) => {\n const { formatMessage } = useIntl();\n const [isPaymentModalOpen, setIsPaymentModalOpen] = useState(false);\n const plan = resolvePlanLabel(subscriber);\n const sinceDate = formatDisplayDate(subscriber?.subscriptionStartDate);\n const nextPayment = formatDisplayDate(subscriber?.currentPeriodEnd);\n const canUpdatePayment = Boolean(subscriber?.subscriptionBiId);\n const { payment_method } = getCommonTrackingProps();\n\n const handleUpdatePaymentClick = () => {\n trackManageSubscriptionUpdatePaymentButtonClick({ buttonName: 'updatePayment' });\n setIsPaymentModalOpen(true);\n };\n\n return (\n <section className=\"manage-section mt-4\">\n <h2 className=\"manage-section__title h3 font-weight-bold text-primary-500 mb-1\">\n {formatMessage(messages['manage.active.heading'])}\n </h2>\n {sinceDate && (\n <p className=\"manage-section__subtitle text-gray-700 mb-3\">\n {formatMessage(messages['manage.active.since'], { date: sinceDate })}\n </p>\n )}\n\n <div className=\"manage-card d-flex flex-column flex-md-row align-items-md-center justify-content-md-between bg-white border p-4 rounded\">\n <div className=\"manage-card__content\">\n <div className=\"manage-card__status-row d-flex align-items-center mb-1\">\n <Icon\n src={SpinnerIcon}\n className=\"manage-card__status-badge manage-card__status-badge--sync flex-shrink-0\"\n aria-hidden\n />\n <span className=\"manage-card__status-label font-weight-bold text-primary-500\">\n {formatMessage(\n plan === 'annual'\n ? messages['manage.active.statusAnnual']\n : messages['manage.active.statusMonthly'],\n )}\n </span>\n </div>\n {nextPayment && (\n <p className=\"manage-card__body text-gray-700 mb-0\">\n {formatMessage(messages['manage.active.nextPayment'], { date: nextPayment })}\n </p>\n )}\n </div>\n\n {(payment_method?.toLowerCase() === STRIPE_PAYMENT_GATEWAY) && (\n <div className=\"manage-card__actions manage-card__actions--row d-flex flex-wrap align-items-center flex-shrink-0 justify-content-end\">\n <Button\n className=\"manage-btn manage-btn--dark\"\n variant=\"primary\"\n onClick={handleUpdatePaymentClick}\n disabled={!canUpdatePayment}\n >\n {formatMessage(messages['manage.active.updatePayment'])}\n </Button>\n </div>\n )}\n </div>\n\n <p className=\"manage-cancel-prompt mt-3 text-right text-gray-700 small\">\n {formatMessage(messages['manage.active.cancelPrompt'])}\n {' '}\n <Link className=\"manage-cancel-prompt__link text-info-500 font-weight-bold text-decoration-none\" to={`/${MANAGE_PAGE_PATH}/cancel`}>\n {formatMessage(messages['manage.active.cancelLink'])}\n </Link>\n </p>\n\n <UpdatePaymentMethodModal\n isOpen={isPaymentModalOpen}\n onClose={() => setIsPaymentModalOpen(false)}\n subscriptionBiId={subscriber?.subscriptionBiId}\n nextBillingDate={nextPayment}\n />\n </section>\n );\n};\n\nexport default ActiveSubscription;\n"]}
|
|
@@ -6,9 +6,8 @@ import { resolvePlanLabel } from '../../utils/subscriptionView';
|
|
|
6
6
|
import messages from '../messages';
|
|
7
7
|
import { getCommonTrackingProps } from '../../tracking/trackingContext';
|
|
8
8
|
const isRenewEligible = () => {
|
|
9
|
-
const {
|
|
10
|
-
|
|
11
|
-
switch (paymentMethod === null || paymentMethod === void 0 ? void 0 : paymentMethod.toLowerCase()) {
|
|
9
|
+
const { payment_method, subscription_status, isUserSuspended } = getCommonTrackingProps();
|
|
10
|
+
switch (payment_method === null || payment_method === void 0 ? void 0 : payment_method.toLowerCase()) {
|
|
12
11
|
case 'stripe':
|
|
13
12
|
return (subscription_status === 'RENEWAL_FAILED'
|
|
14
13
|
|| subscription_status === 'CANCEL_PENDING');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CanceledSubscription.js","sourceRoot":"","sources":["../../../src/components/CanceledSubscription/CanceledSubscription.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAGjD,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAChE,OAAO,QAAQ,MAAM,aAAa,CAAC;AACnC,OAAO,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AAEvE,MAAM,eAAe,GAAG,GAAG,EAAE;IAC3B,MAAM,EAAE,
|
|
1
|
+
{"version":3,"file":"CanceledSubscription.js","sourceRoot":"","sources":["../../../src/components/CanceledSubscription/CanceledSubscription.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAGjD,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAChE,OAAO,QAAQ,MAAM,aAAa,CAAC;AACnC,OAAO,EAAE,sBAAs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YAAG,SAAS,EAAC,sCAAsC,YAChD,UAAU;oCACT,CAAC,CAAC,aAAa,CAAC,QAAQ,CAAC,4BAA4B,CAAC,EAAE,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC;oCAC7E,CAAC,CAAC,aAAa,CAAC,QAAQ,CAAC,kCAAkC,CAAC,CAAC,GAC7D,IACA,EACN,cAAK,SAAS,EAAC,wEAAwE,YACpF,eAAe,IAAI,CAClB,KAAC,MAAM,IACL,SAAS,EAAC,8BAA8B,EACxC,OAAO,EAAE,OAAO,YAEf,aAAa,CAAC,QAAQ,CAAC,uBAAuB,CAAC,CAAC,GAC1C,CACV,GACG,IACF,IACE,CACX,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,oBAAoB,CAAC","sourcesContent":["import React from 'react';\nimport { Button } from '@openedx/paragon';\nimport { useIntl } from '@openedx/frontend-base';\n\nimport type { CurrentUserSubscriberResult } from '../../types';\nimport { formatDisplayDate } from '../../utils/formatDate';\nimport { resolvePlanLabel } from '../../utils/subscriptionView';\nimport messages from '../messages';\nimport { getCommonTrackingProps } from '@src/tracking/trackingContext';\n\nconst isRenewEligible = () => {\n const { payment_method, subscription_status, isUserSuspended } = getCommonTrackingProps();\n switch (payment_method?.toLowerCase()) {\n case 'stripe':\n return (\n subscription_status === 'RENEWAL_FAILED'\n || subscription_status === 'CANCEL_PENDING'\n );\n\n case 'paypal':\n // User paused subscription or 3 renewal failures\n if (isUserSuspended)\n return true;\n\n // First renewal failure, grace period applies\n if (subscription_status === 'RENEWAL_FAILED')\n return false;\n\n return false;\n\n default:\n return false;\n }\n};\n\ninterface RenewActions {\n onRenew: () => void,\n}\n\ninterface CanceledSubscriptionProps extends RenewActions {\n subscriber: CurrentUserSubscriberResult | null,\n}\n\nexport const RenewBanner: React.FC<RenewActions & { expireDate: string | null }> = ({\n expireDate,\n onRenew,\n}) => {\n const { formatMessage } = useIntl();\n if (!expireDate) {\n return null;\n }\n\n const showRenewButton = isRenewEligible();\n\n return (\n <>\n <div className=\"manage-renew-banner__content\">\n <h2 className=\"manage-renew-banner__title h3 font-weight-bold text-primary-500 mb-2\">\n {formatMessage(messages['manage.canceled.bannerTitle'])}\n </h2>\n <p className=\"manage-renew-banner__body text-primary-500 mb-0\">\n {formatMessage(messages['manage.canceled.bannerBody'], { date: expireDate })}\n </p>\n </div>\n <div className=\"manage-renew-banner__actions\">\n {showRenewButton && (\n <Button\n className=\"manage-btn manage-btn--brand\"\n onClick={onRenew}\n >\n {formatMessage(messages['manage.canceled.renew'])}\n </Button>\n )}\n </div>\n </>\n );\n};\n\nconst CanceledSubscription: React.FC<CanceledSubscriptionProps> = ({\n subscriber,\n onRenew,\n}) => {\n const { formatMessage } = useIntl();\n const plan = resolvePlanLabel(subscriber);\n const sinceDate = formatDisplayDate(subscriber?.subscriptionStartDate);\n const canceledOn = formatDisplayDate(\n subscriber?.canceledAt ?? subscriber?.subscriptionEndDate ?? subscriber?.currentPeriodEnd,\n );\n const showRenewButton = isRenewEligible();\n\n return (\n <section className=\"manage-section mt-4\">\n <h2 className=\"manage-section__title h3 font-weight-bold text-primary-500 mb-1\">\n {formatMessage(messages['manage.active.heading'])}\n </h2>\n {sinceDate && (\n <p className=\"manage-section__subtitle text-gray-700 mb-3\">\n {formatMessage(messages['manage.active.since'], { date: sinceDate })}\n </p>\n )}\n\n <div className=\"manage-card d-flex flex-column flex-md-row align-items-md-center justify-content-md-between bg-white border p-4 rounded\">\n <div className=\"manage-card__content\">\n <div className=\"manage-card__status-row d-flex align-items-center mb-1\">\n <span className=\"manage-card__status-badge manage-card__status-badge--cancel flex-shrink-0\" aria-hidden=\"true\" />\n <span className=\"manage-card__status-label font-weight-bold text-primary-500\">\n {formatMessage(\n plan === 'annual'\n ? messages['manage.canceled.statusAnnual']\n : messages['manage.canceled.statusMonthly'],\n )}\n </span>\n </div>\n <p className=\"manage-card__body text-gray-700 mb-0\">\n {canceledOn\n ? formatMessage(messages['manage.canceled.noPayments'], { date: canceledOn })\n : formatMessage(messages['manage.canceled.noPaymentsNoDate'])}\n </p>\n </div>\n <div className=\"manage-card__actions d-flex flex-wrap align-items-center flex-shrink-0\">\n {showRenewButton && (\n <Button\n className=\"manage-btn manage-btn--brand\"\n onClick={onRenew}\n >\n {formatMessage(messages['manage.canceled.renew'])}\n </Button>\n )}\n </div>\n </div>\n </section>\n );\n};\n\nexport default CanceledSubscription;\n"]}
|
|
@@ -23,8 +23,8 @@ const RenewSubscriptionModal = ({ isOpen, onClose, onConfirm, isConfirming = fal
|
|
|
23
23
|
const displayPrice = price !== null && price !== void 0 ? price : '';
|
|
24
24
|
const displayCurrency = currency !== null && currency !== void 0 ? currency : 'USD';
|
|
25
25
|
const last4 = (_b = (_a = paymentMethodQuery.data) === null || _a === void 0 ? void 0 : _a.last4) !== null && _b !== void 0 ? _b : null;
|
|
26
|
-
const {
|
|
27
|
-
const isPayPal = (
|
|
26
|
+
const { payment_method } = getCommonTrackingProps();
|
|
27
|
+
const isPayPal = (payment_method === null || payment_method === void 0 ? void 0 : payment_method.toLowerCase()) === 'paypal';
|
|
28
28
|
useEffect(() => {
|
|
29
29
|
if (isOpen) {
|
|
30
30
|
setConfirmed(false);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RenewSubscriptionModal.js","sourceRoot":"","sources":["../../../src/components/RenewSubscriptionModal/RenewSubscriptionModal.tsx"],"names":[],"mappings":";AAAA,OAAc,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACnD,OAAO,EACL,KAAK,EACL,MAAM,EACN,IAAI,EACJ,WAAW,EACX,OAAO,GACR,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAEjD,OAAO,EAAE,iCAAiC,EAAE,MAAM,iBAAiB,CAAC;AACpE,OAAO,EACL,iCAAiC,EACjC,aAAa,EACb,cAAc,GACf,MAAM,mCAAmC,CAAC;AAC3C,OAAO,wBAAwB,MAAM,sDAAsD,CAAC;A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KAAC,IAAI,CAAC,QAAQ,IACZ,EAAE,EAAC,kBAAkB,EACrB,OAAO,EAAE,aAAa,EACtB,QAAQ,EAAE,CAAC,CAAsC,EAAE,EAAE;4CACnD,gBAAgB,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;wCACrC,CAAC,YAED,eAAM,SAAS,EAAC,kBAAkB,YAC/B,aAAa,CAAC,QAAQ,CAAC,+BAA+B,CAAC,CAAC,GACpD,GACO,GACL,CACd,EAEA,YAAY,IAAI,CACf,KAAC,KAAK,IAAC,OAAO,EAAC,QAAQ,EAAC,SAAS,EAAC,MAAM,YACrC,aAAa,CAAC,QAAQ,CAAC,4BAA4B,CAAC,CAAC,GAChD,CACT,EAED,KAAC,MAAM,IACL,SAAS,EAAC,+DAA+D,EACzE,OAAO,EAAE,SAAS,EAClB,QAAQ,EAAE,CAAC,UAAU,YAEpB,YAAY;wCACX,CAAC,CAAC,aAAa,CAAC,QAAQ,CAAC,0BAA0B,CAAC,CAAC;wCACrD,CAAC,CAAC,aAAa,CAAC,QAAQ,CAAC,2BAA2B,CAAC,CAAC,GACjD,IACL,GACW,IACP,EAEb,CAAC,QAAQ,IAAI,CACZ,KAAC,wBAAwB,IACvB,MAAM,EAAE,kBAAkB,EAC1B,OAAO,EAAE,GAAG,EAAE,CAAC,qBAAqB,CAAC,KAAK,CAAC,EAC3C,gBAAgB,EAAE,gBAAgB,EAClC,eAAe,EAAE,WAAW,GAC5B,CACH,IACA,CACJ,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,sBAAsB,CAAC","sourcesContent":["import React, { useEffect, useState } from 'react';\nimport {\n Alert,\n Button,\n Form,\n ModalDialog,\n Spinner,\n} from '@openedx/paragon';\nimport { useIntl } from '@openedx/frontend-base';\n\nimport { COUNTRIES_REQUIRING_EXTRA_CONFIRM } from '../../constants';\nimport {\n useSubscriptionPaymentMethodQuery,\n useViaxClient,\n useViaxSession,\n} from '../../data/hooks/useManageQueries';\nimport UpdatePaymentMethodModal from '../UpdatePaymentMethodModal/UpdatePaymentMethodModal';\nimport { getCommonTrackingProps } from '@src/tracking/trackingContext';\nimport messages from '../messages';\n\ninterface RenewSubscriptionModalProps {\n isOpen: boolean,\n onClose: () => void,\n onConfirm: () => void,\n isConfirming?: boolean,\n confirmError?: boolean,\n subscriptionBiId: string | null | undefined,\n renewalDate: string | null,\n price: string | null,\n currency: string | null,\n cycle?: 'monthly' | 'annual',\n /** ISO 3166-1 alpha-2 — shows UK/CA consent when GB or CA. */\n userCountry?: string | null,\n}\n\nconst CARD_ICON = (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"16\"\n height=\"16\"\n viewBox=\"0 0 16 16\"\n fill=\"none\"\n aria-hidden=\"true\"\n >\n <path\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n d=\"M0 4C0 3.46957 0.210714 2.96086 0.585786 2.58579C0.960859 2.21071 1.46957 2 2 2H14C14.5304 2 15.0391 2.21071 15.4142 2.58579C15.7893 2.96086 16 3.46957 16 4H0ZM0 6V12C0 12.5304 0.210714 13.0391 0.585786 13.4142C0.960859 13.7893 1.46957 14 2 14H14C14.5304 14 15.0391 13.7893 15.4142 13.4142C15.7893 13.0391 16 12.5304 16 12V6H0ZM3 11C3 10.7348 3.10536 10.4804 3.29289 10.2929C3.48043 10.1054 3.73478 10 4 10H5C5.26522 10 5.51957 10.1054 5.70711 10.2929C5.89464 10.4804 6 10.7348 6 11C6 11.2652 5.89464 11.5196 5.70711 11.7071C5.51957 11.8946 5.26522 12 5 12H4C3.73478 12 3.48043 11.8946 3.29289 11.7071C3.10536 11.5196 3 11.2652 3 11Z\"\n fill=\"#0270DE\"\n />\n </svg>\n);\n\nconst RenewSubscriptionModal: React.FC<RenewSubscriptionModalProps> = ({\n isOpen,\n onClose,\n onConfirm,\n isConfirming = false,\n confirmError = false,\n subscriptionBiId,\n renewalDate,\n price,\n currency,\n cycle = 'monthly',\n userCountry = null,\n}) => {\n const { formatMessage } = useIntl();\n const client = useViaxClient();\n const { sessionReady } = useViaxSession(client);\n const paymentMethodQuery = useSubscriptionPaymentMethodQuery(\n client,\n sessionReady,\n subscriptionBiId,\n isOpen,\n );\n\n const [confirmed, setConfirmed] = useState(false);\n const [ukCaConfirmed, setUkCaConfirmed] = useState(false);\n const [isPaymentModalOpen, setIsPaymentModalOpen] = useState(false);\n\n const showExtraConfirm = Boolean(\n userCountry && COUNTRIES_REQUIRING_EXTRA_CONFIRM.includes(userCountry),\n );\n const frequency = cycle === 'annual' ? 'year' : 'month';\n const cycleLabel = cycle === 'annual' ? 'annual' : 'monthly';\n const displayPrice = price ?? '';\n const displayCurrency = currency ?? 'USD';\n const last4 = paymentMethodQuery.data?.last4 ?? null;\n const { paymentMethod } = getCommonTrackingProps();\n const isPayPal = paymentMethod?.toLowerCase() === 'paypal';\n\n useEffect(() => {\n if (isOpen) {\n setConfirmed(false);\n setUkCaConfirmed(false);\n setIsPaymentModalOpen(false);\n }\n }, [isOpen]);\n\n const canConfirm = confirmed\n && (!showExtraConfirm || ukCaConfirmed)\n && !isConfirming\n && Boolean(subscriptionBiId);\n\n const title = displayPrice\n ? formatMessage(messages['manage.renewModal.title'], {\n price: displayPrice,\n frequency,\n })\n : formatMessage(messages['manage.renewModal.titleNoPrice']);\n\n return (\n <>\n <ModalDialog\n title={title}\n isOpen={isOpen && !isPaymentModalOpen}\n onClose={onClose}\n size=\"lg\"\n hasCloseButton\n isOverflowVisible={false}\n isFullscreenOnMobile\n className=\"manage-renew-modal\"\n >\n <ModalDialog.Header>\n <ModalDialog.Title>{title}</ModalDialog.Title>\n </ModalDialog.Header>\n\n <ModalDialog.Body>\n <div className=\"manage-renew-modal__content\">\n <p className=\"manage-renew-modal__intro text-primary-500 mb-4\">\n {formatMessage(messages['manage.renewModal.body'], {\n date: renewalDate ?? '{date}',\n price: displayPrice,\n frequency,\n currency: displayCurrency,\n termsLink: (\n <a href=\"/terms\" target=\"_blank\" rel=\"noreferrer\">\n {formatMessage(messages['manage.renewModal.termsOfUse'])}\n </a>\n ),\n refundLink: (\n <a href=\"/refund-policy\" target=\"_blank\" rel=\"noreferrer\">\n {formatMessage(messages['manage.renewModal.refundPolicy'])}\n </a>\n ),\n })}\n </p>\n\n {!isPayPal && (\n <div className=\"manage-renew-modal__payment mb-4\">\n <h3 className=\"manage-renew-modal__payment-heading font-weight-bold text-primary-500 mb-3\">\n {formatMessage(messages['manage.renewModal.paymentMethod'])}\n </h3>\n\n {paymentMethodQuery.isPending ? (\n <div className=\"d-flex align-items-center py-2\">\n <Spinner\n animation=\"border\"\n size=\"sm\"\n screenReaderText={formatMessage(messages['manage.loading'])}\n />\n </div>\n ) : (\n <label className=\"manage-renew-modal__card-row d-flex align-items-center mb-3\" htmlFor=\"renew-payment-card\">\n <input\n id=\"renew-payment-card\"\n type=\"radio\"\n name=\"renewPaymentMethod\"\n checked\n readOnly\n className=\"manage-renew-modal__radio m-0\"\n />\n {CARD_ICON}\n <span className=\"manage-renew-modal__card-label font-weight-bold text-info-500\">\n {formatMessage(messages['manage.renewModal.card'])}\n {last4 ? ` *${last4}` : ''}\n </span>\n </label>\n )}\n\n <Button\n className=\"manage-btn manage-btn--outline-dark manage-renew-modal__update-payment d-inline-flex\"\n variant=\"outline-primary\"\n onClick={() => setIsPaymentModalOpen(true)}\n disabled={!subscriptionBiId}\n >\n {formatMessage(messages['manage.renewModal.updatePayment'])}\n </Button>\n </div>\n )}\n <Form.Group controlId=\"renewRecurringConfirm\" className=\"mb-2\">\n <Form.Checkbox\n id=\"renewRecurringConfirm\"\n checked={confirmed}\n onChange={(e: React.ChangeEvent<HTMLInputElement>) => {\n setConfirmed(e.target.checked);\n }}\n >\n <span className=\"text-primary-500\">\n {formatMessage(messages['manage.renewModal.recurringConfirm'], {\n cycle: cycleLabel,\n price: displayPrice,\n frequency,\n currency: displayCurrency,\n })}\n </span>\n </Form.Checkbox>\n </Form.Group>\n\n {showExtraConfirm && (\n <Form.Group controlId=\"renewUkCaConfirm\" className=\"mb-3\">\n <Form.Checkbox\n id=\"renewUkCaConfirm\"\n checked={ukCaConfirmed}\n onChange={(e: React.ChangeEvent<HTMLInputElement>) => {\n setUkCaConfirmed(e.target.checked);\n }}\n >\n <span className=\"text-primary-500\">\n {formatMessage(messages['manage.renewModal.ukCaConfirm'])}\n </span>\n </Form.Checkbox>\n </Form.Group>\n )}\n\n {confirmError && (\n <Alert variant=\"danger\" className=\"mt-2\">\n {formatMessage(messages['manage.canceled.renewError'])}\n </Alert>\n )}\n\n <Button\n className=\"manage-btn manage-btn--brand manage-renew-modal__confirm mt-3\"\n onClick={onConfirm}\n disabled={!canConfirm}\n >\n {isConfirming\n ? formatMessage(messages['manage.canceled.renewing'])\n : formatMessage(messages['manage.renewModal.confirm'])}\n </Button>\n </div>\n </ModalDialog.Body>\n </ModalDialog>\n\n {!isPayPal && (\n <UpdatePaymentMethodModal\n isOpen={isPaymentModalOpen}\n onClose={() => setIsPaymentModalOpen(false)}\n subscriptionBiId={subscriptionBiId}\n nextBillingDate={renewalDate}\n />\n )}\n </>\n );\n};\n\nexport default RenewSubscriptionModal;\n"]}
|
|
1
|
+
{"version":3,"file":"RenewSubscriptionModal.js","sourceRoot":"","sources":["../../../src/components/RenewSubscriptionModal/RenewSubscriptionModal.tsx"],"names":[],"mappings":";AAAA,OAAc,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACnD,OAAO,EACL,KAAK,EACL,MAAM,EACN,IAAI,EACJ,WAAW,EACX,OAAO,GACR,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAEjD,OAAO,EAAE,iCAAiC,EAAE,MAAM,iBAAiB,CAAC;AACpE,OAAO,EACL,iCAAiC,EACjC,aAAa,EACb,cAAc,GACf,MAAM,mCAAmC,CAAC;AAC3C,OAAO,wBAAwB,MAAM,sDAAsD,CAAC;AAC5F,OAAO,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AACvE,OA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O,EAAE,aAAa,EACtB,QAAQ,EAAE,CAAC,CAAsC,EAAE,EAAE;4CACnD,gBAAgB,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;wCACrC,CAAC,YAED,eAAM,SAAS,EAAC,kBAAkB,YAC/B,aAAa,CAAC,QAAQ,CAAC,+BAA+B,CAAC,CAAC,GACpD,GACO,GACL,CACd,EAEA,YAAY,IAAI,CACf,KAAC,KAAK,IAAC,OAAO,EAAC,QAAQ,EAAC,SAAS,EAAC,MAAM,YACrC,aAAa,CAAC,QAAQ,CAAC,4BAA4B,CAAC,CAAC,GAChD,CACT,EAED,KAAC,MAAM,IACL,SAAS,EAAC,+DAA+D,EACzE,OAAO,EAAE,SAAS,EAClB,QAAQ,EAAE,CAAC,UAAU,YAEpB,YAAY;wCACX,CAAC,CAAC,aAAa,CAAC,QAAQ,CAAC,0BAA0B,CAAC,CAAC;wCACrD,CAAC,CAAC,aAAa,CAAC,QAAQ,CAAC,2BAA2B,CAAC,CAAC,GACjD,IACL,GACW,IACP,EAEb,CAAC,QAAQ,IAAI,CACZ,KAAC,wBAAwB,IACvB,MAAM,EAAE,kBAAkB,EAC1B,OAAO,EAAE,GAAG,EAAE,CAAC,qBAAqB,CAAC,KAAK,CAAC,EAC3C,gBAAgB,EAAE,gBAAgB,EAClC,eAAe,EAAE,WAAW,GAC5B,CACH,IACA,CACJ,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,sBAAsB,CAAC","sourcesContent":["import React, { useEffect, useState } from 'react';\nimport {\n Alert,\n Button,\n Form,\n ModalDialog,\n Spinner,\n} from '@openedx/paragon';\nimport { useIntl } from '@openedx/frontend-base';\n\nimport { COUNTRIES_REQUIRING_EXTRA_CONFIRM } from '../../constants';\nimport {\n useSubscriptionPaymentMethodQuery,\n useViaxClient,\n useViaxSession,\n} from '../../data/hooks/useManageQueries';\nimport UpdatePaymentMethodModal from '../UpdatePaymentMethodModal/UpdatePaymentMethodModal';\nimport { getCommonTrackingProps } from '@src/tracking/trackingContext';\nimport messages from '../messages';\n\ninterface RenewSubscriptionModalProps {\n isOpen: boolean,\n onClose: () => void,\n onConfirm: () => void,\n isConfirming?: boolean,\n confirmError?: boolean,\n subscriptionBiId: string | null | undefined,\n renewalDate: string | null,\n price: string | null,\n currency: string | null,\n cycle?: 'monthly' | 'annual',\n /** ISO 3166-1 alpha-2 — shows UK/CA consent when GB or CA. */\n userCountry?: string | null,\n}\n\nconst CARD_ICON = (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"16\"\n height=\"16\"\n viewBox=\"0 0 16 16\"\n fill=\"none\"\n aria-hidden=\"true\"\n >\n <path\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n d=\"M0 4C0 3.46957 0.210714 2.96086 0.585786 2.58579C0.960859 2.21071 1.46957 2 2 2H14C14.5304 2 15.0391 2.21071 15.4142 2.58579C15.7893 2.96086 16 3.46957 16 4H0ZM0 6V12C0 12.5304 0.210714 13.0391 0.585786 13.4142C0.960859 13.7893 1.46957 14 2 14H14C14.5304 14 15.0391 13.7893 15.4142 13.4142C15.7893 13.0391 16 12.5304 16 12V6H0ZM3 11C3 10.7348 3.10536 10.4804 3.29289 10.2929C3.48043 10.1054 3.73478 10 4 10H5C5.26522 10 5.51957 10.1054 5.70711 10.2929C5.89464 10.4804 6 10.7348 6 11C6 11.2652 5.89464 11.5196 5.70711 11.7071C5.51957 11.8946 5.26522 12 5 12H4C3.73478 12 3.48043 11.8946 3.29289 11.7071C3.10536 11.5196 3 11.2652 3 11Z\"\n fill=\"#0270DE\"\n />\n </svg>\n);\n\nconst RenewSubscriptionModal: React.FC<RenewSubscriptionModalProps> = ({\n isOpen,\n onClose,\n onConfirm,\n isConfirming = false,\n confirmError = false,\n subscriptionBiId,\n renewalDate,\n price,\n currency,\n cycle = 'monthly',\n userCountry = null,\n}) => {\n const { formatMessage } = useIntl();\n const client = useViaxClient();\n const { sessionReady } = useViaxSession(client);\n const paymentMethodQuery = useSubscriptionPaymentMethodQuery(\n client,\n sessionReady,\n subscriptionBiId,\n isOpen,\n );\n\n const [confirmed, setConfirmed] = useState(false);\n const [ukCaConfirmed, setUkCaConfirmed] = useState(false);\n const [isPaymentModalOpen, setIsPaymentModalOpen] = useState(false);\n\n const showExtraConfirm = Boolean(\n userCountry && COUNTRIES_REQUIRING_EXTRA_CONFIRM.includes(userCountry),\n );\n const frequency = cycle === 'annual' ? 'year' : 'month';\n const cycleLabel = cycle === 'annual' ? 'annual' : 'monthly';\n const displayPrice = price ?? '';\n const displayCurrency = currency ?? 'USD';\n const last4 = paymentMethodQuery.data?.last4 ?? null;\n const { payment_method } = getCommonTrackingProps();\n const isPayPal = payment_method?.toLowerCase() === 'paypal';\n\n useEffect(() => {\n if (isOpen) {\n setConfirmed(false);\n setUkCaConfirmed(false);\n setIsPaymentModalOpen(false);\n }\n }, [isOpen]);\n\n const canConfirm = confirmed\n && (!showExtraConfirm || ukCaConfirmed)\n && !isConfirming\n && Boolean(subscriptionBiId);\n\n const title = displayPrice\n ? formatMessage(messages['manage.renewModal.title'], {\n price: displayPrice,\n frequency,\n })\n : formatMessage(messages['manage.renewModal.titleNoPrice']);\n\n return (\n <>\n <ModalDialog\n title={title}\n isOpen={isOpen && !isPaymentModalOpen}\n onClose={onClose}\n size=\"lg\"\n hasCloseButton\n isOverflowVisible={false}\n isFullscreenOnMobile\n className=\"manage-renew-modal\"\n >\n <ModalDialog.Header>\n <ModalDialog.Title>{title}</ModalDialog.Title>\n </ModalDialog.Header>\n\n <ModalDialog.Body>\n <div className=\"manage-renew-modal__content\">\n <p className=\"manage-renew-modal__intro text-primary-500 mb-4\">\n {formatMessage(messages['manage.renewModal.body'], {\n date: renewalDate ?? '{date}',\n price: displayPrice,\n frequency,\n currency: displayCurrency,\n termsLink: (\n <a href=\"/terms\" target=\"_blank\" rel=\"noreferrer\">\n {formatMessage(messages['manage.renewModal.termsOfUse'])}\n </a>\n ),\n refundLink: (\n <a href=\"/refund-policy\" target=\"_blank\" rel=\"noreferrer\">\n {formatMessage(messages['manage.renewModal.refundPolicy'])}\n </a>\n ),\n })}\n </p>\n\n {!isPayPal && (\n <div className=\"manage-renew-modal__payment mb-4\">\n <h3 className=\"manage-renew-modal__payment-heading font-weight-bold text-primary-500 mb-3\">\n {formatMessage(messages['manage.renewModal.paymentMethod'])}\n </h3>\n\n {paymentMethodQuery.isPending ? (\n <div className=\"d-flex align-items-center py-2\">\n <Spinner\n animation=\"border\"\n size=\"sm\"\n screenReaderText={formatMessage(messages['manage.loading'])}\n />\n </div>\n ) : (\n <label className=\"manage-renew-modal__card-row d-flex align-items-center mb-3\" htmlFor=\"renew-payment-card\">\n <input\n id=\"renew-payment-card\"\n type=\"radio\"\n name=\"renewPaymentMethod\"\n checked\n readOnly\n className=\"manage-renew-modal__radio m-0\"\n />\n {CARD_ICON}\n <span className=\"manage-renew-modal__card-label font-weight-bold text-info-500\">\n {formatMessage(messages['manage.renewModal.card'])}\n {last4 ? ` *${last4}` : ''}\n </span>\n </label>\n )}\n\n <Button\n className=\"manage-btn manage-btn--outline-dark manage-renew-modal__update-payment d-inline-flex\"\n variant=\"outline-primary\"\n onClick={() => setIsPaymentModalOpen(true)}\n disabled={!subscriptionBiId}\n >\n {formatMessage(messages['manage.renewModal.updatePayment'])}\n </Button>\n </div>\n )}\n <Form.Group controlId=\"renewRecurringConfirm\" className=\"mb-2\">\n <Form.Checkbox\n id=\"renewRecurringConfirm\"\n checked={confirmed}\n onChange={(e: React.ChangeEvent<HTMLInputElement>) => {\n setConfirmed(e.target.checked);\n }}\n >\n <span className=\"text-primary-500\">\n {formatMessage(messages['manage.renewModal.recurringConfirm'], {\n cycle: cycleLabel,\n price: displayPrice,\n frequency,\n currency: displayCurrency,\n })}\n </span>\n </Form.Checkbox>\n </Form.Group>\n\n {showExtraConfirm && (\n <Form.Group controlId=\"renewUkCaConfirm\" className=\"mb-3\">\n <Form.Checkbox\n id=\"renewUkCaConfirm\"\n checked={ukCaConfirmed}\n onChange={(e: React.ChangeEvent<HTMLInputElement>) => {\n setUkCaConfirmed(e.target.checked);\n }}\n >\n <span className=\"text-primary-500\">\n {formatMessage(messages['manage.renewModal.ukCaConfirm'])}\n </span>\n </Form.Checkbox>\n </Form.Group>\n )}\n\n {confirmError && (\n <Alert variant=\"danger\" className=\"mt-2\">\n {formatMessage(messages['manage.canceled.renewError'])}\n </Alert>\n )}\n\n <Button\n className=\"manage-btn manage-btn--brand manage-renew-modal__confirm mt-3\"\n onClick={onConfirm}\n disabled={!canConfirm}\n >\n {isConfirming\n ? formatMessage(messages['manage.canceled.renewing'])\n : formatMessage(messages['manage.renewModal.confirm'])}\n </Button>\n </div>\n </ModalDialog.Body>\n </ModalDialog>\n\n {!isPayPal && (\n <UpdatePaymentMethodModal\n isOpen={isPaymentModalOpen}\n onClose={() => setIsPaymentModalOpen(false)}\n subscriptionBiId={subscriptionBiId}\n nextBillingDate={renewalDate}\n />\n )}\n </>\n );\n};\n\nexport default RenewSubscriptionModal;\n"]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
interface Props {
|
|
3
|
+
children: ReactNode;
|
|
4
|
+
category?: string;
|
|
5
|
+
pageName?: string;
|
|
6
|
+
properties?: Record<string, unknown>;
|
|
7
|
+
}
|
|
8
|
+
declare const AnalyticsPageWrap: ({ children, category, pageName, properties }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export default AnalyticsPageWrap;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect } from 'react';
|
|
3
|
+
import { useLocation } from 'react-router-dom';
|
|
4
|
+
import { sendPageEvent } from '@openedx/frontend-base';
|
|
5
|
+
const AnalyticsPageWrap = ({ children, category, pageName, properties = {} }) => {
|
|
6
|
+
const location = useLocation();
|
|
7
|
+
useEffect(() => {
|
|
8
|
+
sendPageEvent(category, pageName, Object.assign({ app: 'learner-home', path: location.pathname }, properties));
|
|
9
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
10
|
+
}, [location.pathname]);
|
|
11
|
+
return _jsx(_Fragment, { children: children });
|
|
12
|
+
};
|
|
13
|
+
export default AnalyticsPageWrap;
|
|
14
|
+
//# sourceMappingURL=AnalyticsPageWrap.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AnalyticsPageWrap.js","sourceRoot":"","sources":["../../../../src/data/services/segment/AnalyticsPageWrap.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAa,SAAS,EAAE,MAAM,OAAO,CAAC;AAC7C,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AASvD,MAAM,iBAAiB,GAAG,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,UAAU,GAAG,EAAE,EAAS,EAAE,EAAE;IACrF,MAAM,QAAQ,GAAG,WAAW,EAAE,CAAC;IAE/B,SAAS,CAAC,GAAG,EAAE;QACb,aAAa,CAAC,QAAQ,EAAE,QAAQ,kBAC9B,GAAG,EAAE,cAAc,EACnB,IAAI,EAAE,QAAQ,CAAC,QAAQ,IACpB,UAAU,EACb,CAAC;QACH,uDAAuD;IACzD,CAAC,EAAE,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC;IAExB,OAAO,4BAAG,QAAQ,GAAI,CAAC;AACzB,CAAC,CAAC;AAEF,eAAe,iBAAiB,CAAC","sourcesContent":["import { ReactNode, useEffect } from 'react';\nimport { useLocation } from 'react-router-dom';\nimport { sendPageEvent } from '@openedx/frontend-base';\n\ninterface Props {\n children: ReactNode,\n category?: string,\n pageName?: string,\n properties?: Record<string, unknown>,\n}\n\nconst AnalyticsPageWrap = ({ children, category, pageName, properties = {} }: Props) => {\n const location = useLocation();\n\n useEffect(() => {\n sendPageEvent(category, pageName, {\n app: 'learner-home',\n path: location.pathname,\n ...properties,\n });\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [location.pathname]);\n\n return <>{children}</>;\n};\n\nexport default AnalyticsPageWrap;\n"]}
|
|
@@ -2,7 +2,10 @@ import { sendTrackEvent } from '@openedx/frontend-base';
|
|
|
2
2
|
import { appName } from '../../../constants';
|
|
3
3
|
import { getCommonTrackingProps } from '../../../tracking/trackingContext';
|
|
4
4
|
export const LINK_TIMEOUT = 300;
|
|
5
|
-
export const createEventTracker = (name, options = {}) => () =>
|
|
5
|
+
export const createEventTracker = (name, options = {}) => () => {
|
|
6
|
+
const { payment_method, opt_in } = getCommonTrackingProps();
|
|
7
|
+
return sendTrackEvent(name, Object.assign(Object.assign({}, options), { app_name: appName, payment_method, opt_in }));
|
|
8
|
+
};
|
|
6
9
|
export const createLinkTracker = (tracker, href) => (e) => {
|
|
7
10
|
e.preventDefault();
|
|
8
11
|
tracker();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/data/services/segment/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAC7C,OAAO,EAAE,sBAAsB,EAAE,MAAM,mCAAmC,CAAC;AAE3E,MAAM,CAAC,MAAM,YAAY,GAAG,GAAG,CAAC;AAEhC,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,IAAY,EAAE,UAAmC,EAAE,EAAE,EAAE,CAAC,GAAG,EAAE,CAAC,cAAc,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/data/services/segment/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAC7C,OAAO,EAAE,sBAAsB,EAAE,MAAM,mCAAmC,CAAC;AAE3E,MAAM,CAAC,MAAM,YAAY,GAAG,GAAG,CAAC;AAEhC,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,IAAY,EAAE,UAAmC,EAAE,EAAE,EAAE,CAAC,GAAG,EAAE;IAC9F,MAAM,EAAE,cAAc,EAAE,MAAM,EAAE,GAAG,sBAAsB,EAAE,CAAC;IAC5D,OAAO,cAAc,CACnB,IAAI,kCACC,OAAO,KAAE,QAAQ,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,IACxD,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,OAAO,EAAE,IAAI,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE;IACxD,CAAC,CAAC,cAAc,EAAE,CAAC;IACnB,OAAO,EAAE,CAAC;IACV,OAAO,UAAU,CAAC,GAAG,EAAE;QACrB,MAAM,CAAC,QAAQ,CAAC,IAAI,GAAG,IAAI,CAAC;IAC9B,CAAC,EAAE,YAAY,CAAC,CAAC;AACnB,CAAC,CAAC","sourcesContent":["import { sendTrackEvent } from '@openedx/frontend-base';\nimport { appName } from '../../../constants';\nimport { getCommonTrackingProps } from '../../../tracking/trackingContext';\n\nexport const LINK_TIMEOUT = 300;\n\nexport const createEventTracker = (name: string, options: Record<string, unknown> = {}) => () => {\n const { payment_method, opt_in } = getCommonTrackingProps();\n return sendTrackEvent(\n name,\n { ...options, app_name: appName, payment_method, opt_in },\n );\n};\n\nexport const createLinkTracker = (tracker, href) => (e) => {\n e.preventDefault();\n tracker();\n return setTimeout(() => {\n global.location.href = href;\n }, LINK_TIMEOUT);\n};\n"]}
|
|
@@ -5,7 +5,7 @@ export interface CommonTrackingProps {
|
|
|
5
5
|
subscription_start_date?: string | null;
|
|
6
6
|
subscription_end_date?: string | null;
|
|
7
7
|
current_period_end?: string | null;
|
|
8
|
-
|
|
8
|
+
payment_method?: string | null;
|
|
9
9
|
user_email?: string | null;
|
|
10
10
|
session_id?: string | null;
|
|
11
11
|
experimentation?: string | null;
|
|
@@ -14,7 +14,7 @@ export const mapSubsInitToTrackingProps = (data) => {
|
|
|
14
14
|
subscription_start_date: (_e = (_d = data === null || data === void 0 ? void 0 : data.userSubscription) === null || _d === void 0 ? void 0 : _d.subscriptionStartDate) !== null && _e !== void 0 ? _e : null,
|
|
15
15
|
subscription_end_date: (_g = (_f = data === null || data === void 0 ? void 0 : data.userSubscription) === null || _f === void 0 ? void 0 : _f.subscriptionEndDate) !== null && _g !== void 0 ? _g : null,
|
|
16
16
|
current_period_end: (_j = (_h = data === null || data === void 0 ? void 0 : data.userSubscription) === null || _h === void 0 ? void 0 : _h.currentPeriodEnd) !== null && _j !== void 0 ? _j : null,
|
|
17
|
-
|
|
17
|
+
payment_method: (_l = (_k = data === null || data === void 0 ? void 0 : data.userSubscription) === null || _k === void 0 ? void 0 : _k.paymentMethod) !== null && _l !== void 0 ? _l : null,
|
|
18
18
|
user_email: (_o = (_m = getAuthenticatedUser()) === null || _m === void 0 ? void 0 : _m.email) !== null && _o !== void 0 ? _o : null,
|
|
19
19
|
session_id: '',
|
|
20
20
|
experimentation: '',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"trackingContext.js","sourceRoot":"","sources":["../../src/tracking/trackingContext.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAkB9D,IAAI,WAAW,GAAwB,EAAE,CAAC;AAE1C,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,KAA0B,EAAE,EAAE;IACnE,WAAW,mCAAQ,WAAW,GAAK,KAAK,CAAE,CAAC;AAC7C,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,sBAAsB,GAAG,GAAwB,EAAE,CAAC,WAAW,CAAC;AAE7E,sEAAsE;AACtE,MAAM,CAAC,MAAM,0BAA0B,GAAG,CAAC,IAAS,EAAuB,EAAE;;IAAC,OAAA,CAAC;QAC7E,iBAAiB,EAAE,MAAA,IAAI,aAAJ,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AiB,EAAE,MAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,gBAAgB,0CAAE,gBAAgB;QAC3D,uBAAuB,EAAE,MAAA,MAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,gBAAgB,0CAAE,qBAAqB,mCAAI,IAAI;QAC9E,qBAAqB,EAAE,MAAA,MAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,gBAAgB,0CAAE,mBAAmB,mCAAI,IAAI;QAC1E,kBAAkB,EAAE,MAAA,MAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,gBAAgB,0CAAE,gBAAgB,mCAAI,IAAI;QACpE,cAAc,EAAE,MAAA,MAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,gBAAgB,0CAAE,aAAa,mCAAI,IAAI;QAC7D,UAAU,EAAE,MAAA,MAAA,oBAAoB,EAAE,0CAAE,KAAK,mCAAI,IAAI;QACjD,UAAU,EAAE,EAAE;QACd,eAAe,EAAE,EAAE;QACnB,WAAW,EAAE,EAAE;QACf,MAAM,EAAE,MAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,MAAM,mCAAI,IAAI;QAC5B,eAAe,EAAE,MAAA,MAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,gBAAgB,0CAAE,gBAAgB,mCAAI,IAAI;KAClE,CAAC,CAAA;CAAA,CAAC","sourcesContent":["import { getAuthenticatedUser } from '@openedx/frontend-base';\n\nexport interface CommonTrackingProps {\n free_trial_status?: string,\n subscription_status?: string,\n subscription_tier?: string,\n subscription_start_date?: string | null,\n subscription_end_date?: string | null,\n current_period_end?: string | null,\n payment_method?: string | null,\n user_email?: string | null,\n session_id?: string | null,\n experimentation?: string | null,\n device_type?: string | null,\n opt_in?: boolean | null,\n isUserSuspended?: boolean | null | undefined,\n}\n\nlet commonProps: CommonTrackingProps = {};\n\nexport const setCommonTrackingProps = (props: CommonTrackingProps) => {\n commonProps = { ...commonProps, ...props };\n};\n\nexport const getCommonTrackingProps = (): CommonTrackingProps => commonProps;\n\n// Single place that maps the subs/init API response -> tracking props\nexport const mapSubsInitToTrackingProps = (data: any): CommonTrackingProps => ({\n free_trial_status: data?.userSubscription?.trialActive,\n subscription_status: data?.userSubscription?.status,\n subscription_tier: data?.userSubscription?.billingFrequency,\n subscription_start_date: data?.userSubscription?.subscriptionStartDate ?? null,\n subscription_end_date: data?.userSubscription?.subscriptionEndDate ?? null,\n current_period_end: data?.userSubscription?.currentPeriodEnd ?? null,\n payment_method: data?.userSubscription?.paymentMethod ?? null,\n user_email: getAuthenticatedUser()?.email ?? null,\n session_id: '',\n experimentation: '',\n device_type: '',\n opt_in: data?.opt_in ?? null,\n isUserSuspended: data?.userSubscription?.tIsUserSuspended ?? null,\n});\n"]}
|