diff --git a/_locales/en/messages.json b/_locales/en/messages.json index ac933fcdd..fcc4118af 100644 --- a/_locales/en/messages.json +++ b/_locales/en/messages.json @@ -727,6 +727,9 @@ "panel_detail_rewards_cliqz_text": { "message": "Feature already active in the Cliqz MyOffrz control panel." }, + "panel_detail_rewards_edge_text": { + "message": "Ghostery Rewards are not supported in Edge browser" + }, "panel_detail_rewards_loading": { "message": "Loading Rewards..." }, diff --git a/app/panel/components/Rewards.jsx b/app/panel/components/Rewards.jsx index 3a36932bf..2ed96ff38 100644 --- a/app/panel/components/Rewards.jsx +++ b/app/panel/components/Rewards.jsx @@ -21,6 +21,7 @@ import globals from '../../../src/classes/Globals'; import { log } from '../../../src/utils/common'; const IS_CLIQZ = (globals.BROWSER_INFO.name === 'cliqz'); +const IS_EDGE = (globals.BROWSER_INFO.name === 'edge'); /** * @class The Rewards Panel shows offers generated by Ghostery Rewards. @@ -93,6 +94,7 @@ class Rewards extends React.Component { } sendToIframe(message) { + if (!this.iframe.current) { return; } this.iframe.current.contentWindow.postMessage(JSON.stringify({ target: 'cliqz-offers-cc', origin: 'window', @@ -106,10 +108,12 @@ class Rewards extends React.Component { log('myoffrzSendRuntimeMessage, runtime.lastError', chrome.runtime.lastError); return; } - if (result.action !== 'pushData' || !this.iframe.current) { return; } + if (result.action !== 'pushData') { return; } const { data: { vouchers = [] } = {} } = result; const rewardsCount = vouchers.length; this.setState({ shouldHideRewards: rewardsCount === 0, rewardsCount }); + + if (!this.iframe.current) { return; } this.iframe.current.frameBorder = 0; this.sendToIframe(result); }); @@ -174,11 +178,12 @@ class Rewards extends React.Component { const { enable_offers } = this.props; const headerClassNames = ClassNames('RewardsPanel__header', 'flex-container', 'align-middle', 'align-justify'); const headerTitleClassNames = ClassNames('RewardsPanel__title'); + const shouldHideSlider = IS_CLIQZ || IS_EDGE; return (