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

Fix/ppdsc 2208 newskit not working on iframe REVERT CHANGES #227

Merged
merged 7 commits into from
Jun 14, 2022
Merged
Show file tree
Hide file tree
Changes from 6 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
20 changes: 10 additions & 10 deletions cypress/site/functional/consent.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@ describe('Consent component', () => {
it('should show up and verify cookie banner does not pop up anymore once user accepts the cookie consent', () => {
// They have been set for the previous tests in order to be able to run them correctly.
// For the purpose of the following test they need to be cleared first.
// cy.clearCookie('euconsent-v2');
// cy.clearCookie('consentUUID');
cy.clearCookie('euconsent-v2');
cy.clearCookie('consentUUID');

cy.visit('/');
// const iFrame = "iframe[id^='sp_message_iframe']";
// cy.get(iFrame, {timeout: 10000}).should('be.visible');
// cy.acceptCookieBanner();
// // Non TCF and TCF behave differently in this regard,hidden and removed respectively, we need to support both during switch over
// // TODO: uncomment once PPDSC-1504 released
// // cy.get(iFrame).should('not.exist');
// cy.reload();
// cy.get(iFrame, {timeout: 10000}).should('not.exist');
const iFrame = "iframe[id^='sp_message_iframe']";
cy.get(iFrame, {timeout: 10000}).should('be.visible');
cy.acceptCookieBanner();
// Non TCF and TCF behave differently in this regard,hidden and removed respectively, we need to support both during switch over
// TODO: uncomment once PPDSC-1504 released
cy.get(iFrame).should('not.exist');
cy.reload();
cy.get(iFrame, {timeout: 10000}).should('not.exist');
});
});
17 changes: 15 additions & 2 deletions site/pages/_document.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import * as React from 'react';
import Document, {Head, Main, NextScript, Html} from 'next/document';
import {Global, css} from 'newskit';
import {Global, css, Consent, Tealium} from 'newskit';
import Helmet from 'react-helmet';
import {HTMLMeta} from '../components/html-meta';

Expand All @@ -16,7 +16,7 @@ const Base = () => <base href={baseHref} />;

export default class MyDocument extends Document {
render() {
// const isSiteEnvProduction = process.env.SITE_ENV === 'production';
const isSiteEnvProduction = process.env.SITE_ENV === 'production';
const helmet = Helmet.rewind();
return (
<Html lang="en">
Expand All @@ -35,6 +35,14 @@ export default class MyDocument extends Document {
</style>
{helmet.script.toComponent()}
<HTMLMeta />
<Consent
sourcePointConfigUnified={{
accountId: 259,
propertyHref: 'https://newskit.co.uk',
gdpr: {},
}}
reactHelmet={Helmet}
/>
</Head>
<body>
<Global
Expand Down Expand Up @@ -226,6 +234,11 @@ export default class MyDocument extends Document {
}
`}
/>
<Tealium
accountId="newsinternational"
profileId="thetimes.newskit"
env={isSiteEnvProduction ? 'prod' : 'dev'}
/>
<Main />
<NextScript />
</body>
Expand Down