Skip to content

Commit

Permalink
copy changes to refelect a switch from 'Monthly + extras' and 'Annual…
Browse files Browse the repository at this point in the history
… + extras' to 'All-access digital'. Adjacent copy changes 'Recurring support' to become 'subscription' and visually grouping contributions and all access digital products into the 'subscriptions sub section on the account overview'
  • Loading branch information
Richard Bangay committed May 17, 2024
1 parent 2a9ade2 commit 3e4fca2
Show file tree
Hide file tree
Showing 14 changed files with 89 additions and 99 deletions.
39 changes: 27 additions & 12 deletions client/components/mma/accountoverview/AccountOverview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import {
isSpecificProductType,
sortByJoinDate,
} from '../../../../shared/productResponse';
import type { GroupedProductTypeKeys } from '../../../../shared/productTypes';
import {
GROUPED_PRODUCT_TYPES,
PRODUCT_TYPES,
Expand Down Expand Up @@ -108,15 +109,17 @@ const AccountOverviewPage = ({ isFromApp }: IsFromAppProps) => {
);

const productCategories = [
...allActiveProductDetails,
...allCancelledProductDetails,
]
.map(
(product: ProductDetail | CancelledProductDetail) =>
product.mmaCategory,
)
.filter((value, index, self) => self.indexOf(value) === index);

...new Set(
[...allActiveProductDetails, ...allCancelledProductDetails].map(
(product: ProductDetail | CancelledProductDetail) => {
if (product.mmaCategory === 'recurringSupport') {
return 'subscriptions';
}
return product.mmaCategory;
},
),
),
];
const appSubscriptions = mpapiResponse.subscriptions.filter(
isValidAppSubscription,
);
Expand Down Expand Up @@ -165,6 +168,15 @@ const AccountOverviewPage = ({ isFromApp }: IsFromAppProps) => {
!hasDigiSubAndContribution &&
!hasNonServiceableCountry;

const visualProductGroupingCategory = (
product: ProductDetail | CancelledProductDetail,
): GroupedProductTypeKeys => {
if (product.mmaCategory === 'recurringSupport') {
return 'subscriptions';
}
return product.mmaCategory;
};

return (
<>
<PersonalisedHeader
Expand All @@ -179,12 +191,15 @@ const AccountOverviewPage = ({ isFromApp }: IsFromAppProps) => {
{productCategories.map((category) => {
const groupedProductType = GROUPED_PRODUCT_TYPES[category];
const activeProductsInCategory = allActiveProductDetails.filter(
(activeProduct) => activeProduct.mmaCategory === category,
(activeProduct) =>
visualProductGroupingCategory(activeProduct) ===
category,
);
const cancelledProductsInCategory =
allCancelledProductDetails.filter(
(activeProduct) =>
activeProduct.mmaCategory === category,
(cancelledProduct) =>
visualProductGroupingCategory(cancelledProduct) ===
category,
);

return (
Expand Down
13 changes: 13 additions & 0 deletions client/components/mma/accountoverview/ManageProduct.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { PRODUCT_TYPES } from '../../../../shared/productTypes';
import {
digitalPackPaidByDirectDebit,
guardianWeeklyPaidByCard,
monthlyContributionPaidByCard,
newspaperVoucherPaidByPaypal,
supporterPlusAnnual,
} from '../../../fixtures/productBuilder/testProducts';
Expand Down Expand Up @@ -55,6 +56,18 @@ export const NewspaperSubscriptionCard: StoryObj<typeof ManageProduct> = {
},
};

export const Contribution: StoryObj<typeof ManageProduct> = {
render: () => {
return <ManageProduct productType={PRODUCT_TYPES.contributions} />;
},

parameters: {
reactRouter: {
state: { productDetail: monthlyContributionPaidByCard() },
},
},
};

featureSwitches.supporterPlusUpdateAmount = true;

export const SupporterPlus: StoryObj<typeof ManageProduct> = {
Expand Down
11 changes: 2 additions & 9 deletions client/components/mma/accountoverview/ProductCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,7 @@ import type {
Subscription,
} from '@/shared/productResponse';
import { getMainPlan, isGift } from '@/shared/productResponse';
import {
calculateSupporterPlusTitle,
GROUPED_PRODUCT_TYPES,
} from '@/shared/productTypes';
import { GROUPED_PRODUCT_TYPES } from '@/shared/productTypes';
import { wideButtonLayoutCss } from '../../../styles/ButtonStyles';
import { trackEvent } from '../../../utilities/analytics';
import { ErrorIcon } from '../shared/assets/ErrorIcon';
Expand Down Expand Up @@ -373,11 +370,7 @@ export const ProductCard = ({
})
}
>
Change to{' '}
{calculateSupporterPlusTitle(
(mainPlan as PaidSubscriptionPlan)
.billingPeriod,
)}
Change to all-access digital
</Button>
</ThemeProvider>
)}
Expand Down
4 changes: 1 addition & 3 deletions client/components/mma/cancel/CancellationSummary.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,7 @@ const actuallyCancelled = (
`,
]}
>
{productType.cancellation?.alternateSummaryHeading(
cancelledProductDetail,
) ||
{productType.cancellation?.alternateSummaryHeading ||
`Your ${productType.friendlyName(
cancelledProductDetail,
)} is cancelled`}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ import { Heading } from '../../shared/Heading';
export const contributionsCancellationFlowStart = () => (
<Stack space={4}>
<Heading cssOverrides={measure.heading}>
We’re sorry to see you go…
We’re sorry to see you go
</Heading>

<p>
<strong>
…please could you take a moment to tell us why you would like to
cancel today?
please could you take a moment to tell us why you would like
to cancel today?
</strong>
<br />
As a reader-funded organisation, we rely on the generous support
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ import { Heading } from '../../shared/Heading';
export const supporterplusCancellationFlowStart = () => (
<Stack space={4}>
<Heading cssOverrides={measure.heading}>
We’re sorry to see you go…
We’re sorry to see you go
</Heading>

<p>
<strong>
…please could you take a moment to tell us why you would like to
cancel today?
please could you take a moment to tell us why you would like
to cancel today?
</strong>
<br />
As a reader-funded organisation, we rely on the generous support
Expand Down
2 changes: 1 addition & 1 deletion client/components/mma/shared/benefits/BenefitsToggle.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export const BenefitsToggle = (props: { productType: ProductTypeKeys }) => {
aria-controls="benefits"
onClick={() => setShowBenefits(!showBenefits)}
>
{showBenefits ? 'hide' : 'view'} extras
{showBenefits ? 'hide' : 'view'} benefits
</button>
</>
);
Expand Down
3 changes: 2 additions & 1 deletion client/components/mma/switch/SwitchContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,8 @@ const RenderedPage = (props: {
user: props.user,
mainPlan,
monthlyOrAnnual,
supporterPlusTitle: `${monthlyOrAnnual} + extras`,
supporterPlusTitle:
PRODUCT_TYPES.supporterplus.productTitle,
thresholds: getThresholds(
mainPlan,
monthlyOrAnnual == 'Monthly',
Expand Down
7 changes: 7 additions & 0 deletions client/fixtures/productBuilder/testProducts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,13 @@ export function digitalPackPaidByCardWithPaymentFailure() {
.getProductDetailObject();
}

export function monthlyContributionPaidByCard() {
return new ProductBuilder(baseContribution())
.payByCard()
.withPrice(400)
.getProductDetailObject();
}

export function annualContributionPaidByCardWithCurrency(
currency: CurrencyIso,
) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ describe('Update contribution amount', () => {

setSignInStatus();

cy.findByText('Manage recurring support').click();
cy.findByText('Manage subscription').click();
cy.wait('@cancelled');

cy.findByText('Change amount').click();
Expand All @@ -93,7 +93,7 @@ describe('Update contribution amount', () => {

setSignInStatus();

cy.findByText('Manage recurring support').click();
cy.findByText('Manage subscription').click();
cy.wait('@cancelled');

cy.findByText('Change amount').click();
Expand Down
4 changes: 2 additions & 2 deletions cypress/tests/mocked/parallel-2/cancelContribution.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ describe('Cancel contribution', () => {

setSignInStatus();

cy.findByText('Manage recurring support').click();
cy.findByText('Manage subscription').click();
cy.wait('@cancelled');

cy.findByRole('link', {
name: 'Cancel recurring support',
name: 'Cancel subscription',
}).click();
};

Expand Down
6 changes: 3 additions & 3 deletions cypress/tests/mocked/parallel-2/cancelSupporterPlus.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ describe('Cancel Supporter Plus', () => {
cy.wait('@mobile_subscriptions');
cy.wait('@single_contributions');

cy.findByText('Manage recurring support').click();
cy.findByText('Manage subscription').click();

cy.findByRole('link', {
name: 'Cancel recurring support',
name: 'Cancel subscription',
}).click();
};

Expand Down Expand Up @@ -123,7 +123,7 @@ describe('Cancel Supporter Plus', () => {
cy.wait('@get_cancelled_product');

cy.findByRole('heading', {
name: 'Monthly support + extras cancelled',
name: 'Your All-access digital subscription is cancelled',
});

cy.get('@get_cancellation_date.all').should('have.length', 0);
Expand Down
17 changes: 13 additions & 4 deletions cypress/tests/mocked/parallel-2/productSwitch.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,11 @@ describe('product switching', () => {
cy.visit('/');
setSignInStatus();

cy.findAllByText('Change to monthly + extras').should('have.length', 2);
cy.findAllByText('Change to monthly + extras').last().click();
cy.findAllByText('Change to all-access digital').should(
'have.length',
2,
);
cy.findAllByText('Change to all-access digital').last().click();
cy.findByText('Your current support').should('exist');

cy.findByRole('button', {
Expand Down Expand Up @@ -205,11 +208,17 @@ describe('product switching', () => {
cy.visit('/');
setSignInStatus();

cy.findAllByText('Change to monthly + extras').should('have.length', 0);
cy.findAllByText('Change to all-access digital').should(
'have.length',
0,
);

cy.visit('/switch');

cy.findByRole('heading', { name: 'Account overview' }).should('exist');
cy.findAllByText('Change to monthly + extras').should('have.length', 0);
cy.findAllByText('Change to all-access digital').should(
'have.length',
0,
);
});
});
Loading

0 comments on commit 3e4fca2

Please sign in to comment.