From 00146bcbb2fcbcf9ede57ecede87add6a21d0388 Mon Sep 17 00:00:00 2001 From: zeppi Date: Wed, 14 Jul 2021 11:04:14 -0400 Subject: [PATCH] restrict pixel from auth and mobile --- web/component/pixel/index.js | 9 +++++++++ web/component/{pixel.jsx => pixel/view.jsx} | 10 ++++++++-- 2 files changed, 17 insertions(+), 2 deletions(-) create mode 100644 web/component/pixel/index.js rename web/component/{pixel.jsx => pixel/view.jsx} (75%) diff --git a/web/component/pixel/index.js b/web/component/pixel/index.js new file mode 100644 index 000000000..ae39ece09 --- /dev/null +++ b/web/component/pixel/index.js @@ -0,0 +1,9 @@ +import { connect } from 'react-redux'; +import { selectUserVerifiedEmail } from 'redux/selectors/user'; +import Pixel from './view'; + +const select = (state) => ({ + isAuthenticated: Boolean(selectUserVerifiedEmail(state)), +}); + +export default connect(select)(Pixel); diff --git a/web/component/pixel.jsx b/web/component/pixel/view.jsx similarity index 75% rename from web/component/pixel.jsx rename to web/component/pixel/view.jsx index 697e378d3..d073ca9c7 100644 --- a/web/component/pixel.jsx +++ b/web/component/pixel/view.jsx @@ -1,13 +1,19 @@ // @flow import React from 'react'; import { SIMPLE_SITE } from 'config'; +import { useIsMobile } from 'effects/use-screensize'; + type Props = { type: string, + isAuthenticated: boolean, }; const Pixel = (props: Props) => { - const { type } = props; - if (!SIMPLE_SITE) { + const { type, isAuthenticated } = props; + const isMobile = useIsMobile(); + + // TODO: restrict to country + if (!SIMPLE_SITE || isMobile || isAuthenticated) { return null; } if (type === 'retargeting') {