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

Newspaper archive auth - show disclaimer message to user missing entitlements #1406

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
2 changes: 2 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 { PaymentFailureAlertIfApplicable } from '../shared/PaymentFailureAlertIf
import { CancelledProductCard } from './CancelledProductCard';
import { EmptyAccountOverview } from './EmptyAccountOverview';
import { InAppPurchaseCard } from './InAppPurchaseCard';
import { MaybeNewspaperArchiveInfo } from './MaybeNewspaperArchiveInfo';
import { PersonalisedHeader } from './PersonalisedHeader';
import { ProductCard } from './ProductCard';
import { SingleContributionCard } from './SingleContributionCard';
Expand Down Expand Up @@ -196,6 +197,7 @@ const AccountOverviewPage = ({ isFromApp }: IsFromAppProps) => {
mdapiResponse={mdapiResponse}
mpapiResponse={mpapiResponse}
/>
<MaybeNewspaperArchiveInfo />

<PaymentFailureAlertIfApplicable
productDetails={allActiveProductDetails}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { InfoSummary } from '@guardian/source-development-kitchen/react-components';

export function MaybeNewspaperArchiveInfo() {
const urlSearchParams = new URLSearchParams(window.location.search);
const missingNewspaperArchiveEntitlement = urlSearchParams.get(
'missingNewspaperArchiveEntitlement',
);

return missingNewspaperArchiveEntitlement ? (
<InfoSummary
message="You do not have access to the Guardian's newspaper archive"
context="Subscribe to Digital + Print to get access"
/>
) : null;
}
3 changes: 1 addition & 2 deletions server/routes/newspaperArchive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,7 @@ router.get('/auth', async (req: Request, res: Response) => {
const hasCorrectEntitlement = await checkSupporterEntitlement(req);

if (!hasCorrectEntitlement) {
// ToDo: show the user an error/info page
return res.redirect('/');
return res.redirect('/?missingNewspaperArchiveEntitlement=true');
}

const authHeader = base64(`${authString}`);
Expand Down
Loading