Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Canada strike message #1429

Merged
merged 4 commits into from
Dec 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions client/components/mma/accountoverview/AccountOverview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ import type { IsFromAppProps } from '../shared/IsFromAppProps';
import { NewspaperArchiveCta } from '../shared/NewspaperArchiveCta';
import { nonServiceableCountries } from '../shared/NonServiceableCountries';
import { PaymentFailureAlertIfApplicable } from '../shared/PaymentFailureAlertIfApplicable';
import { CanadaStrike } from './CanadaStrike';
import { CancelledProductCard } from './CancelledProductCard';
import { EmptyAccountOverview } from './EmptyAccountOverview';
import { InAppPurchaseCard } from './InAppPurchaseCard';
Expand Down Expand Up @@ -197,6 +198,18 @@ const AccountOverviewPage = ({ isFromApp }: IsFromAppProps) => {
return specificProductType.groupedProductType;
};

const possiblyAffectedByCanadaPostStrike = allActiveProductDetails.some(
(product) => {
const deliveryCountry =
product.subscription.deliveryAddress?.country.toUpperCase();
return (
(product.tier === 'Tier Three' ||
product.tier === 'Guardian Weekly - ROW') &&
Comment on lines +206 to +207
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can GW in Canada not be `'Guardian Weekly - Domestic'?

(deliveryCountry === 'CANADA' || deliveryCountry === 'CA')
);
},
);

return (
<>
<PersonalisedHeader
Expand All @@ -208,6 +221,7 @@ const AccountOverviewPage = ({ isFromApp }: IsFromAppProps) => {
productDetails={allActiveProductDetails}
isFromApp={isFromApp}
/>
{possiblyAffectedByCanadaPostStrike && <CanadaStrike />}
{uniqueProductCategories.map((category) => {
const groupedProductType = GROUPED_PRODUCT_TYPES[category];
const activeProductsInCategory = allActiveProductDetails.filter(
Expand Down
37 changes: 37 additions & 0 deletions client/components/mma/accountoverview/CanadaStrike.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import { css } from '@emotion/react';
import { Link } from '@guardian/source/react-components';
import { ProblemAlert } from '../shared/ProblemAlert';

export const CanadaStrike = () => (
<ProblemAlert
message={
<div>
<p>
Due to industrial action by Canada Post, it is not possible
to deliver your copies of the Guardian Weekly. You are
welcome to pause your subscription during the period of
industrial action, details on how to do so can be found{' '}
<Link
href="https://manage.theguardian.com/help-centre/article/i-need-to-pause-my-delivery"
priority="primary"
>
here
</Link>
.
</p>
<p>
If you have reached your allowance limit please contact{' '}
<Link
href="mailto:[email protected]"
priority="primary"
>
[email protected]
</Link>
</p>
</div>
}
additionalcss={css`
margin-top: 30px;
`}
/>
);
45 changes: 26 additions & 19 deletions client/components/mma/shared/ProblemAlert.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ interface AlertButtonProps {
}

interface ProblemAlertProps {
title: string;
message: string;
title?: string;
message: string | React.ReactElement;
button?: AlertButtonProps;
additionalcss?: SerializedStyles;
}
Expand All @@ -48,23 +48,30 @@ export const ProblemAlert = (props: ProblemAlertProps) => (
>
<ErrorIcon />
</i>
<h4
css={css`
${textSansBold17};
margin: 0;
`}
>
{props.title}
</h4>
<p
css={css`
margin: ${space[2]}px 0 ${props.button ? `${space[3]}px` : '0'}
0;
${textSans17};
`}
>
{props.message}
</p>
{props.title && (
<h4
css={css`
${textSansBold17};
margin: 0;
`}
>
{props.title}
</h4>
)}
{typeof props.message === 'string' ? (
<p
css={css`
margin: ${space[2]}px 0
${props.button ? `${space[3]}px` : '0'} 0;
${textSans17};
`}
>
{props.message}
</p>
) : (
props.message
)}

{props.button && (
<LinkButton
to={props.button.link}
Expand Down
Loading