Skip to content

Commit

Permalink
fix: Remove Manage my subscriptions CTA
Browse files Browse the repository at this point in the history
  • Loading branch information
julianajlk committed Jul 30, 2024
1 parent a8da25d commit 0fd73d4
Showing 1 changed file with 3 additions and 31 deletions.
34 changes: 3 additions & 31 deletions src/subscriptions/Subscriptions.jsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
import React, { useEffect } from 'react';
import React from 'react';
import { useDispatch, useSelector } from 'react-redux';
import { sendTrackEvent } from '@edx/frontend-platform/analytics';
import { FormattedMessage, useIntl } from '@edx/frontend-platform/i18n';
import { StatefulButton } from '@edx/paragon';
import { Launch, SpinnerSimple } from '@edx/paragon/icons';
import { SpinnerSimple } from '@edx/paragon/icons';

Check failure on line 4 in src/subscriptions/Subscriptions.jsx

View workflow job for this annotation

GitHub Actions / tests

'SpinnerSimple' is defined but never used

import { BasicAlert } from '../components';

import SubscriptionCardsView from './SubscriptionCardsView';
import SubscriptionUpsell from './SubscriptionUpsell';

import { clearStripeError, fetchStripeCustomerPortalURL } from './actions';
import { clearStripeError } from './actions';
import { subscriptionsSelector } from './selectors';

import messages from './Subscriptions.messages';
Expand All @@ -20,9 +18,7 @@ const Subscriptions = () => {
const dispatch = useDispatch();
const {
subscriptions,
stripeCustomerPortalURL,
stripeError,
stripeLoading,
} = useSelector(subscriptionsSelector);
const hasSubscriptions = subscriptions.length > 0;
const activeCount = subscriptions.filter(
Expand All @@ -39,25 +35,10 @@ const Subscriptions = () => {
messages['ecommerce.order.history.subscriptions.manage.button'],
);

const handleManageSubscriptionsClick = () => {
sendTrackEvent('edx.bi.user.subscription.order-page.manage.clicked');
dispatch(fetchStripeCustomerPortalURL());
};

const handeAlertClose = () => {
dispatch(clearStripeError());
};

useEffect(() => {
if (stripeCustomerPortalURL) {
window.open(stripeCustomerPortalURL, '_blank', 'noopener,noreferrer');
}
}, [stripeCustomerPortalURL]);

const renderSpinner = () => (
<div className="icon-spin">{SpinnerSimple()}</div>
);

const renderEmpty = () => (
<>
<FormattedMessage
Expand All @@ -80,15 +61,6 @@ const Subscriptions = () => {
buttonLabel: <i>{buttonLabel}</i>,
})}
</span>
<StatefulButton
size="sm"
className="text-nowrap"
labels={{ default: buttonLabel }}
icons={{ default: undefined }}
iconAfter={stripeLoading ? renderSpinner : Launch}
state={stripeLoading ? 'pending' : 'default'}
onClick={handleManageSubscriptionsClick}
/>
</div>
<SubscriptionCardsView subscriptions={subscriptions} />
<BasicAlert isModal isVisible={stripeError} onClose={handeAlertClose} />
Expand Down

0 comments on commit 0fd73d4

Please sign in to comment.