From aba414ab7986c7931aa379a3912f49f26318c439 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Germ=C3=A1n=20Mart=C3=ADnez?= Date: Wed, 10 Feb 2021 11:51:20 +0100 Subject: [PATCH] Adapt cookie banner for GDPR (#1814) * Update cookie banner action and reducer * Add cookie banner new assets * Update cookie banner * Update cookie banner migration * Disable cookie banner and intercom in desktop app * Use google analytics hook in Open Safe component Co-authored-by: Daniel Sanchez --- .travis.yml | 3 +- .../CookiesBanner/assets/alert-red.svg | 11 + .../CookiesBanner/assets/intercom.png | Bin 0 -> 20681 bytes src/components/CookiesBanner/index.tsx | 277 +++++++++++------- .../cookies/store/actions/openCookieBanner.ts | 10 +- src/logic/cookies/store/reducer/cookies.ts | 7 +- .../wallets/store/actions/fetchProvider.ts | 2 +- src/routes/open/container/Open.tsx | 10 +- src/utils/intercom.ts | 15 +- 9 files changed, 209 insertions(+), 126 deletions(-) create mode 100644 src/components/CookiesBanner/assets/alert-red.svg create mode 100644 src/components/CookiesBanner/assets/intercom.png diff --git a/.travis.yml b/.travis.yml index 249b42bb..8ee6afc9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -44,7 +44,7 @@ matrix: if: (branch = master AND NOT type = pull_request) OR tag IS present cache: npm: false - yarn: false + yarn: true before_script: - if [[ -n "$TRAVIS_TAG" ]]; then export REACT_APP_ENV='production'; fi; - if [ $TRAVIS_PULL_REQUEST != "false" ]; then export PUBLIC_URL="/${REACT_APP_NETWORK}/app"; fi; @@ -54,7 +54,6 @@ before_install: - sudo apt-get -y install python3-pip python3-dev libusb-1.0-0-dev libudev-dev - pip install awscli --upgrade --user script: - - yarn lint:check - yarn prettier:check - yarn test:coverage - yarn build diff --git a/src/components/CookiesBanner/assets/alert-red.svg b/src/components/CookiesBanner/assets/alert-red.svg new file mode 100644 index 00000000..6a20c41c --- /dev/null +++ b/src/components/CookiesBanner/assets/alert-red.svg @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/src/components/CookiesBanner/assets/intercom.png b/src/components/CookiesBanner/assets/intercom.png new file mode 100644 index 0000000000000000000000000000000000000000..74eb6efac15b691c9ac3e5f1446eb49f99dcf89b GIT binary patch literal 20681 zcmV)hK%>8jP)005u}1^@s6i_d2*00001b5ch_0Itp) z=>Px#L}ge>W=%~1DgXcg2mk?xX#fNO00031000^Q000001E2u_0{{R30RRC20H6W@ z1ONa40RR91pr8W)1ONa40RR91pa1{>0H^F3i2wjV07*naRCodHy?eA}M}6P9&$;jJ zzTHwIfsn*Y65=5d1CqcP1TwM^m;@7?gf~uB63=q%EU%eN{s^87VOAJtC0R3*SvJ^C zW+icW+rhxt0a+kqga|JgY$G0e@DMEtA*m(x?e5$6dFK21R{i#=v+q9Vp4)x9)w-Hm zcb}^I{eJbUs$YHguO54!dpgzsABI|>*XwnLGPl6!bUM8)h(E4Gx5dDZC5vqrs7_X& zA8%mY(EvQ%!8R_4cQPn<6aY^q;NJc2cW=p7?|Rp}PTI7)lK{CTqmFyWo=Umx0^L>t zcA|aUE`UDP!T6X2;E96nM8J0It+$S}*(H};a@?NpL_zsj1mj3!p6Fe^o#jsibmIbU zGjMHJf5rvri2(Ak0>;xGfX55GaX>c;aQEMT|F+uZ?6c1v>KVrYbO++L8hN`s z1bU7Kc$4IthaNgEJI$VXW*>kFlNoonRKvj81mq|%?gStnmto`X-OhMBfj185YQSZn zjRM)y;lsyerG=cc20dOne+bZzN z>9zE9CFn};mVnj=+4AzSPIc}^%&pXb+{h~_Q!Rk2?y0Kj>DdB^2dWa70J6hU$&&2d}0lccJ0XhK6K|mhJ z({?#s2N*|r#kNh$Ry^XV2I96DxV-yErN;%|);(UDW}CocEf=0HKsO9M1Rtmd3 z!Cg9IwWN*eW#T}2+Cv?aRdsmx)WqSrPWSL!cXDA@ck1x2$;tb7PfXphXL9=X zsbed*SKqkr&U?Oo>#-&<1C#;CCKzXC?ytRP6O3&hu>|6Yc*9c#!czjkalp5k*V_v4 zn%*v^)_>KWUjD$!(v|nFEI$9fOslEXwzV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!Xn0Zd3^geK4^Vj$+S0XVYubR;t9MtM8L(o{R#;~{grUXQY; z3Vg1Mk5d`O1tD$PiZ?{Qe8Yx30U#3d-DF}ytQAQww|GbBgc6jAa(tg9*wC;Ma8UbG ztaJH4QSqWEc|sfTpvO9o^oanE@~0Afu8)sLBWx!SY5$-{)MkZ6qW*aCHToA|EIlK< z5|HFeP?C>Odd#4;#Wlc6X6@aAI0(3yUg5TZj{l1hZz>~Gf{y%S4S2MfP!CSZp4!i? zfRL7L<`I!8fk-~QBI#jZgvZMd#AQgpgmQjK-a`6-WqBE(SqQ*EtG_AO^mH(98JuPz zZ8z}Hd8)l0bw=1=^kAIIcq>3`10ijVW1DDq6Nu0aMiLFr2#HX7Nb+rmwzviv zOam>X2G?^zB_0=a$Zo~kAx}6Ryk2Ta`aJCb7>(O*AfmSkMrdtQHS{tha6&0iSqf}O zC$yEDh7BT_&;%UhwhcvDekTAg`g7U>FdBF~K&0%j={fWgw*fNv;{Y>c$BEm37Uebr z9CF74I?A1H9*;Ja;j{-}H1>FbNcnNVh} { +interface CookiesBannerFormProps { + alertMessage: boolean +} + +const CookiesBanner = (): ReactElement => { const classes = useStyles() const dispatch = useDispatch() const [showAnalytics, setShowAnalytics] = useState(false) + const [showIntercom, setShowIntercom] = useState(false) const [localNecessary, setLocalNecessary] = useState(true) const [localAnalytics, setLocalAnalytics] = useState(false) - const showBanner = useSelector(cookieBannerOpen) + const [localIntercom, setLocalIntercom] = useState(false) - const acceptCookiesHandler = useCallback(async () => { - const newState = { - acceptedNecessary: true, - acceptedAnalytics: !isDesktop, - } - await saveCookie(COOKIES_KEY, newState, 365) - dispatch(openCookieBanner(false)) - setShowAnalytics(!isDesktop) - }, [dispatch]) + const showBanner = useSelector(cookieBannerOpen) useEffect(() => { async function fetchCookiesFromStorage() { const cookiesState = await loadFromCookie(COOKIES_KEY) - if (cookiesState) { - const { acceptedAnalytics, acceptedNecessary } = cookiesState + if (!cookiesState) { + dispatch(openCookieBanner(true)) + } else { + const { acceptedIntercom, acceptedAnalytics, acceptedNecessary } = cookiesState + if (acceptedIntercom === undefined) { + const newState = { + acceptedNecessary, + acceptedAnalytics, + acceptedIntercom: acceptedAnalytics, + } + const expDays = acceptedAnalytics ? 365 : 7 + await saveCookie(COOKIES_KEY, newState, expDays) + setLocalIntercom(newState.acceptedIntercom) + setShowIntercom(newState.acceptedIntercom) + } else { + setLocalIntercom(acceptedIntercom) + setShowIntercom(acceptedIntercom) + } setLocalAnalytics(acceptedAnalytics) setLocalNecessary(acceptedNecessary) - const openBanner = acceptedNecessary === false || showBanner - dispatch(openCookieBanner(openBanner)) - setShowAnalytics(acceptedAnalytics) - } else { - dispatch(openCookieBanner(true)) } } fetchCookiesFromStorage() - }, [dispatch, showBanner]) + }, [showAnalytics, showIntercom]) - useEffect(() => { - if (isDesktop && showBanner) acceptCookiesHandler() - }, [acceptCookiesHandler, showBanner]) + const acceptCookiesHandler = async () => { + const newState = { + acceptedNecessary: true, + acceptedAnalytics: !isDesktop, + acceptedIntercom: true, + } + await saveCookie(COOKIES_KEY, newState, 365) + setShowAnalytics(!isDesktop) + setShowIntercom(true) + dispatch(openCookieBanner(false)) + } const closeCookiesBannerHandler = async () => { const newState = { acceptedNecessary: true, acceptedAnalytics: localAnalytics, + acceptedIntercom: localIntercom, } const expDays = localAnalytics ? 365 : 7 await saveCookie(COOKIES_KEY, newState, expDays) setShowAnalytics(localAnalytics) + setShowIntercom(localIntercom) + if (!localIntercom && isIntercomLoaded()) { + closeIntercom() + } dispatch(openCookieBanner(false)) } - const cookieBannerContent = ( -
- - Accept preferences > - -
-

- We use cookies to give you the best experience and to help improve our website. Please read our{' '} - - Cookie Policy - {' '} - for more information. By clicking "Accept all", you agree to the storing of cookies on your device - to enhance site navigation, analyze site usage and provide customer support. -

-
-
- } - disabled - label="Necessary" - name="Necessary" - onChange={() => setLocalNecessary((prev) => !prev)} - value={localNecessary} - /> -
-
- } - label="Analytics" - name="Analytics" - onChange={() => setLocalAnalytics((prev) => !prev)} - value={localAnalytics} - /> -
-
- + if (showAnalytics && !isDesktop) { + loadGoogleAnalytics() + } + + if (showIntercom) { + loadIntercom() + } + + const CookiesBannerForm = (props: CookiesBannerFormProps) => { + const { alertMessage } = props + return ( +
+
+ {alertMessage && ( +
+ + You attempted to open the customer support chat. Please accept the customer support cookie. +
+ )} +

+ We use cookies to provide you with the best experience and to help improve our website and application. + Please read our{' '} + + Cookie Policy + {' '} + for more information. By clicking "Accept all", you agree to the storing of cookies on your device + to enhance site navigation, analyze site usage and provide customer support. +

+
+
+ } + disabled + label="Necessary" + name="Necessary" + onChange={() => setLocalNecessary((prev) => !prev)} + value={localNecessary} + /> +
+
+ } + label="Customer support" + name="Customer support" + onChange={() => setLocalIntercom((prev) => !prev)} + value={localIntercom} + /> +
+
+ } + label="Analytics" + name="Analytics" + onChange={() => setLocalAnalytics((prev) => !prev)} + value={localAnalytics} + /> +
+
+ +
+
+ +
-
- ) - - if (showAnalytics) { - loadIntercom() - loadGoogleAnalytics() + ) } - if (isDesktop) loadIntercom() - return showBanner && !isDesktop ? cookieBannerContent : null + return ( + <> + {!isDesktop && !showIntercom && ( + dispatch(openCookieBanner(true, true))} + /> + )} + {!isDesktop && showBanner?.cookieBannerOpen && ( + + )} + + ) } export default CookiesBanner diff --git a/src/logic/cookies/store/actions/openCookieBanner.ts b/src/logic/cookies/store/actions/openCookieBanner.ts index 64eaa774..2f0a6231 100644 --- a/src/logic/cookies/store/actions/openCookieBanner.ts +++ b/src/logic/cookies/store/actions/openCookieBanner.ts @@ -2,6 +2,10 @@ import { createAction } from 'redux-actions' export const OPEN_COOKIE_BANNER = 'OPEN_COOKIE_BANNER' -export const openCookieBanner = createAction(OPEN_COOKIE_BANNER, (cookieBannerOpen) => ({ - cookieBannerOpen, -})) +export const openCookieBanner = createAction( + OPEN_COOKIE_BANNER, + (cookieBannerOpen, intercomAlertDisplayed = false) => ({ + cookieBannerOpen, + intercomAlertDisplayed, + }), +) diff --git a/src/logic/cookies/store/reducer/cookies.ts b/src/logic/cookies/store/reducer/cookies.ts index 11da0cc9..43b1bca3 100644 --- a/src/logic/cookies/store/reducer/cookies.ts +++ b/src/logic/cookies/store/reducer/cookies.ts @@ -1,17 +1,12 @@ import { Map } from 'immutable' import { handleActions } from 'redux-actions' - import { OPEN_COOKIE_BANNER } from 'src/logic/cookies/store/actions/openCookieBanner' export const COOKIES_REDUCER_ID = 'cookies' export default handleActions( { - [OPEN_COOKIE_BANNER]: (state, action) => { - const { cookieBannerOpen } = action.payload - - return state.set('cookieBannerOpen', cookieBannerOpen) - }, + [OPEN_COOKIE_BANNER]: (state, action) => state.set('cookieBannerOpen', action.payload), }, Map(), ) diff --git a/src/logic/wallets/store/actions/fetchProvider.ts b/src/logic/wallets/store/actions/fetchProvider.ts index 79ce4479..def1045f 100644 --- a/src/logic/wallets/store/actions/fetchProvider.ts +++ b/src/logic/wallets/store/actions/fetchProvider.ts @@ -1,4 +1,5 @@ import ReactGA from 'react-ga' +import { Dispatch } from 'redux' import addProvider from './addProvider' @@ -8,7 +9,6 @@ import enqueueSnackbar from 'src/logic/notifications/store/actions/enqueueSnackb import { getProviderInfo, getWeb3 } from 'src/logic/wallets/getWeb3' import { makeProvider } from 'src/logic/wallets/store/model/provider' import { updateStoredTransactionsStatus } from 'src/logic/safe/store/actions/transactions/utils/transactionHelpers' -import { Dispatch } from 'redux' export const processProviderResponse = (dispatch, provider) => { const walletRecord = makeProvider(provider) diff --git a/src/routes/open/container/Open.tsx b/src/routes/open/container/Open.tsx index 8b5df977..9744f4f3 100644 --- a/src/routes/open/container/Open.tsx +++ b/src/routes/open/container/Open.tsx @@ -1,8 +1,10 @@ import { Loader } from '@gnosis.pm/safe-react-components' import queryString from 'query-string' import React, { useEffect, useState } from 'react' -import ReactGA from 'react-ga' import { useDispatch, useSelector } from 'react-redux' +import { useLocation } from 'react-router-dom' +import { PromiEvent, TransactionReceipt } from 'web3-core' + import { SafeDeployment } from 'src/routes/opening' import { InitialValuesForm, Layout } from 'src/routes/open/components/Layout' import Page from 'src/components/layout/Page' @@ -23,8 +25,7 @@ import { loadFromStorage, removeFromStorage, saveToStorage } from 'src/utils/sto import { userAccountSelector } from 'src/logic/wallets/store/selectors' import { SafeRecordProps } from 'src/logic/safe/store/models/safe' import { addOrUpdateSafe } from 'src/logic/safe/store/actions/addOrUpdateSafe' -import { PromiEvent, TransactionReceipt } from 'web3-core' -import { useLocation } from 'react-router-dom' +import { useAnalytics } from 'src/utils/googleAnalytics' const SAFE_PENDING_CREATION_STORAGE_KEY = 'SAFE_PENDING_CREATION_STORAGE_KEY' @@ -121,6 +122,7 @@ const Open = (): React.ReactElement => { const userAccount = useSelector(userAccountSelector) const dispatch = useDispatch() const location = useLocation() + const { trackEvent } = useAnalytics() useEffect(() => { // #122: Allow to migrate an old Multisig by passing the parameters to the URL. @@ -179,7 +181,7 @@ const Open = (): React.ReactElement => { await dispatch(addOrUpdateSafe(safeProps)) - ReactGA.event({ + trackEvent({ category: 'User', action: 'Created a safe', }) diff --git a/src/utils/intercom.ts b/src/utils/intercom.ts index 68035e7d..605ac63d 100644 --- a/src/utils/intercom.ts +++ b/src/utils/intercom.ts @@ -1,11 +1,15 @@ import { INTERCOM_ID } from 'src/utils/constants' +let intercomLoaded = false + +export const isIntercomLoaded = () => intercomLoaded + // eslint-disable-next-line consistent-return -export const loadIntercom = () => { +export const loadIntercom = (): void => { const APP_ID = INTERCOM_ID if (!APP_ID) { console.error('[Intercom] - In order to use Intercom you need to add an appID') - return null + return } const d = document const s = d.createElement('script') @@ -20,5 +24,12 @@ export const loadIntercom = () => { app_id: APP_ID, consent: true, }) + intercomLoaded = true } } + +export const closeIntercom = (): void => { + if (!isIntercomLoaded()) return + intercomLoaded = false + ;(window as any).Intercom('shutdown') +}