1 import { c } from 'ttag';
3 import { Button } from '@proton/atoms';
4 import SettingsParagraph from '@proton/components/containers/account/SettingsParagraph';
5 import SettingsSection from '@proton/components/containers/account/SettingsSection';
6 import useCancellationFlow from '@proton/components/containers/payments/subscription/cancellationFlow/useCancellationFlow';
7 import type { APP_NAMES } from '@proton/shared/lib/constants';
8 import { BRAND_NAME } from '@proton/shared/lib/constants';
10 import { useCancelSubscriptionFlow } from './useCancelSubscriptionFlow';
12 export const CancelSubscriptionSection = ({ app }: { app: APP_NAMES }) => {
13 const { redirectToCancellationFlow, b2bAccess, b2cAccess } = useCancellationFlow();
14 const { loadingCancelSubscription, cancelSubscriptionModals, cancelSubscription } = useCancelSubscriptionFlow({
18 if (loadingCancelSubscription) {
22 const handleContinueClick = () => {
23 if (b2cAccess || b2bAccess) {
24 redirectToCancellationFlow();
26 void cancelSubscription();
32 {cancelSubscriptionModals}
34 <SettingsParagraph>{c('Info')
35 .t`When you cancel, your subscription won't be renewed, but you can still enjoy plan benefits until the end of the subscription period. After that, you will be downgraded to the ${BRAND_NAME} Free plan.`}</SettingsParagraph>
37 onClick={handleContinueClick}
38 data-testid="CancelSubscriptionButton"
40 disabled={loadingCancelSubscription}
42 {c('Action').t`Continue`}