Skip to content

Commit

Permalink
copy change to make the cancellation confirmation page title more suc…
Browse files Browse the repository at this point in the history
…cinct

fix for the reset of the page title for the cancellation offer page
  • Loading branch information
Richard Bangay committed May 21, 2024
1 parent d2d7fbc commit 9c7078b
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 10 deletions.
7 changes: 4 additions & 3 deletions client/components/mma/cancel/CancellationSummary.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,10 @@ const actuallyCancelled = (
`,
]}
>
{`Your ${productType.friendlyName(
cancelledProductDetail,
)} is cancelled`}
{`Your ${
productType.shortFriendlyName ||
productType.friendlyName(cancelledProductDetail)
} is cancelled`}
</Heading>
{productType.cancellation &&
!productType.cancellation.shouldHideSummaryMainPara && (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { useLocation, useNavigate } from 'react-router-dom';
import { measure } from '@/client/styles/typography';
import type { DiscountPreviewResponse } from '@/client/utilities/discountPreview';
import { getMainPlan } from '@/shared/productResponse';
import { GROUPED_PRODUCT_TYPES } from '@/shared/productTypes';
import type { DeliveryRecordDetail } from '../../../delivery/records/deliveryRecordsApi';
import type { OutstandingHolidayStop } from '../../../holiday/HolidayStopApi';
import { BenefitsSection } from '../../../shared/benefits/BenefitsSection';
Expand Down Expand Up @@ -48,6 +49,13 @@ export const SupporterPlusOffer = () => {
const productType = cancellationContext.productType;
const mainPlan = getMainPlan(productDetail.subscription);

const pageTitleContext = useContext(
CancellationPageTitleContext,
) as CancellationPageTitleInterface;

const groupedProductType =
GROUPED_PRODUCT_TYPES[productType.groupedProductType];

const currentSubscriptionBoxCss = css`
display: flex;
justify-content: space-between;
Expand Down Expand Up @@ -84,12 +92,11 @@ export const SupporterPlusOffer = () => {
false,
);

const pageTitleContext = useContext(
CancellationPageTitleContext,
) as CancellationPageTitleInterface;

pageTitleContext.setPageTitle(
`Cancel ${productType.shortFriendlyName || productType.friendlyName()}`,
`Cancel ${
groupedProductType.shortFriendlyName ||
groupedProductType.friendlyName()
}`,
); // reset the page title here incase you are coming back from the offer review page where the page title was changed

return (
Expand Down
4 changes: 2 additions & 2 deletions cypress/tests/mocked/parallel-2/cancelSupporterPlus.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ describe('Cancel Supporter Plus', () => {
cy.wait('@get_cancelled_product');

cy.findByRole('heading', {
name: 'Your all-access digital subscription is cancelled',
name: 'Your all-access digital is cancelled',
});

cy.get('@get_cancellation_date.all').should('have.length', 0);
Expand Down Expand Up @@ -244,7 +244,7 @@ describe('Cancel Supporter Plus', () => {
cy.wait('@get_cancelled_product');

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

cy.get('@get_cancellation_date.all').should('have.length', 0);
Expand Down
1 change: 1 addition & 0 deletions shared/productTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -621,6 +621,7 @@ export const PRODUCT_TYPES: { [productKey in ProductTypeKeys]: ProductType } = {
supporterplus: {
productTitle: () => 'All-access digital',
friendlyName: () => 'all-access digital subscription',
shortFriendlyName: 'all-access digital',
productType: 'supporterplus',
groupedProductType: 'recurringSupport',
allProductsProductTypeFilterString: 'SupporterPlus',
Expand Down

0 comments on commit 9c7078b

Please sign in to comment.