Skip to content

Commit 3a38ed4

Browse files
authored
Merge branch 'main' into osweb
2 parents cae65d9 + f1b4de9 commit 3a38ed4

18 files changed

+9
-461
lines changed

src/app/auth/hooks/trackUser.spec.ts

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
1-
import { getType } from 'typesafe-actions';
21
import { GoogleAnalyticsClient } from '../../../gateways/googleAnalyticsClient';
32
import googleAnalyticsClient from '../../../gateways/googleAnalyticsClient';
4-
import { clearAcceptCookies, doAcceptCookies } from '../../notifications/acceptCookies';
5-
import { acceptCookies } from '../../notifications/actions';
63
import { receiveUser } from '../actions';
74
import { User } from '../types';
85
import { trackUserHookBody } from './trackUser';
@@ -31,9 +28,6 @@ describe('trackUser', () => {
3128
});
3229

3330
describe('user already accepted Cookies', () => {
34-
beforeEach(() => {
35-
doAcceptCookies();
36-
});
3731

3832
it('tracks the user', async() => {
3933
await (trackUserHookBody(helpers))(receiveUser(user));
@@ -49,9 +43,6 @@ describe('trackUser', () => {
4943
});
5044

5145
describe('user not yet accepted cookies', () => {
52-
beforeEach(() => {
53-
clearAcceptCookies();
54-
});
5546

5647
it('tracks the user', async() => {
5748
await (trackUserHookBody(helpers))(receiveUser(user));
@@ -70,25 +61,6 @@ describe('trackUser', () => {
7061
await (trackUserHookBody(helpers))(receiveUser(user));
7162
expect(dispatchMock).not.toHaveBeenCalled();
7263
});
73-
74-
it('prompts to accept if CookieYes is not running', async() => {
75-
window.cookieYesActive = false;
76-
await (trackUserHookBody(helpers))(receiveUser(user));
77-
expect(dispatchMock).toHaveBeenCalledWith({
78-
meta: undefined,
79-
payload: undefined,
80-
type: getType(acceptCookies),
81-
});
82-
});
83-
});
84-
85-
it('prompts to accept cookies', async() => {
86-
await (trackUserHookBody(helpers))(receiveUser(user));
87-
expect(dispatchMock).toHaveBeenCalledWith({
88-
meta: undefined,
89-
payload: undefined,
90-
type: getType(acceptCookies),
91-
});
9264
});
9365
});
9466
});

src/app/auth/hooks/trackUser.ts

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,10 @@
11
import googleAnalyticsClient from '../../../gateways/googleAnalyticsClient';
2-
import { isAcceptCookiesNeeded } from '../../notifications/acceptCookies';
3-
import { acceptCookies } from '../../notifications/actions';
42
import { ActionHookBody } from '../../types';
53
import { actionHook } from '../../utils';
64
import { receiveUser } from '../actions';
75

8-
export const trackUserHookBody: ActionHookBody<typeof receiveUser> = (middleware) => async({payload}) => {
6+
export const trackUserHookBody: ActionHookBody<typeof receiveUser> = () => async({payload}) => {
97
if (payload.isNotGdprLocation) {
10-
if (isAcceptCookiesNeeded()) {
11-
middleware.dispatch(acceptCookies());
12-
}
138

149
googleAnalyticsClient.setUserId(payload.uuid);
1510
}

src/app/developer/components/Notifications.tsx

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,10 @@ interface Props {
1212
updateAvailable: () => void;
1313
error: (error: Error) => void;
1414
sendMessages: () => void;
15-
acceptCookies: () => void;
1615
}
1716

1817
// tslint:disable-next-line:variable-name
19-
const Notifications = ({updateAvailable, error, sendMessages, acceptCookies}: Props) => {
18+
const Notifications = ({updateAvailable, error, sendMessages}: Props) => {
2019
const [showError, setError] = useState(false);
2120

2221
if (showError) {
@@ -26,8 +25,6 @@ const Notifications = ({updateAvailable, error, sendMessages, acceptCookies}: Pr
2625
return <Panel title='Notifications'>
2726
<ButtonGroup expand vertical>
2827

29-
<Button onClick={acceptCookies} >accept cookies</Button>
30-
3128
<Button onClick={updateAvailable} data-testid='trigger-updates-available'>update available</Button>
3229
<Button onClick={sendMessages} data-testid='trigger-messages'>app messages</Button>
3330
<Button onClick={() => setError(true)} data-testid='trigger-inline-error'>inline error</Button>
@@ -41,7 +38,6 @@ const Notifications = ({updateAvailable, error, sendMessages, acceptCookies}: Pr
4138
export default connect<{}, React.ComponentProps<typeof Notifications>>(
4239
() => ({}),
4340
(dispatch: Dispatch): Props => ({
44-
acceptCookies: flow(notifications.acceptCookies, dispatch),
4541
error: (error: Error) => {
4642
dispatch(recordError(error));
4743
dispatch(showErrorDialog());

src/app/developer/components/__snapshots__/Home.spec.tsx.snap

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -469,12 +469,6 @@ Array [
469469
<div
470470
className="c7"
471471
>
472-
<button
473-
className="c8"
474-
onClick={[Function]}
475-
>
476-
accept cookies
477-
</button>
478472
<button
479473
className="c8"
480474
data-testid="trigger-updates-available"

src/app/notifications/acceptCookies.ts

Lines changed: 0 additions & 15 deletions
This file was deleted.

src/app/notifications/actions.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import { AnyNotification, Message, ToastMeta } from './types';
33

44
export const retiredBookRedirect = createStandardAction('Notification/retiredBookRedirect')();
55
export const updateAvailable = createStandardAction('Notification/updateAvailable')();
6-
export const acceptCookies = createStandardAction('Notification/acceptCookies')();
76

87
export const addToast = createStandardAction('Notification/toasts/add')
98
.map((messageKey: string, meta: ToastMeta) => ({

src/app/notifications/components/AcceptCookies.spec.tsx

Lines changed: 0 additions & 34 deletions
This file was deleted.

src/app/notifications/components/AcceptCookies.tsx

Lines changed: 0 additions & 40 deletions
This file was deleted.

src/app/notifications/components/Notifications.spec.tsx

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import renderer from 'react-test-renderer';
33
import createTestStore from '../../../test/createTestStore';
44
import TestContainer from '../../../test/TestContainer';
55
import { Store } from '../../types';
6-
import { acceptCookies, receiveMessages, retiredBookRedirect, updateAvailable } from '../actions';
6+
import { receiveMessages, retiredBookRedirect, updateAvailable } from '../actions';
77
import ConnectedNotifications from './Notifications';
88

99
describe('Notifications', () => {
@@ -35,17 +35,6 @@ describe('Notifications', () => {
3535
expect(tree).toMatchSnapshot();
3636
});
3737

38-
it('matches snapshot for acceptCookies', () => {
39-
store.dispatch(acceptCookies());
40-
41-
const component = renderer.create(<TestContainer store={store}>
42-
<ConnectedNotifications />
43-
</TestContainer>);
44-
45-
const tree = component.toJSON();
46-
expect(tree).toMatchSnapshot();
47-
});
48-
4938
it('matches snapshot for appMessage', () => {
5039
store.dispatch(receiveMessages([{
5140
dismissable: false,

src/app/notifications/components/Notifications.tsx

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import * as actions from '../actions';
66
import { appMessageType } from '../reducer';
77
import * as select from '../selectors';
88
import { ModalNotification } from '../types';
9-
import AcceptCookies from './AcceptCookies';
109
import AppMessage from './AppMessage';
1110
import RetiredBookRedirect from './RetiredBookRedirect';
1211
import UpdatesAvailable from './UpdatesAvailable';
@@ -27,11 +26,6 @@ const renderNotificationModal = (
2726
case getType(actions.updateAvailable): {
2827
return <UpdatesAvailable className={className} />;
2928
}
30-
case getType(actions.acceptCookies): {
31-
return (
32-
<AcceptCookies notification={notification} className={className} />
33-
);
34-
}
3529
case appMessageType: {
3630
return <AppMessage notification={notification} className={className} />;
3731
}

0 commit comments

Comments
 (0)