Added cookies disabled check

no issue

- Added dummy banner if cookies are disabled
- Adds new helper to check if cookies are disabled
This commit is contained in:
Rish 2020-09-24 13:37:49 +05:30
parent 2105872859
commit 71fcfb4918
2 changed files with 16 additions and 0 deletions

View File

@ -4,6 +4,7 @@ import AppContext from '../AppContext';
import FrameStyle from './Frame.styles';
import Pages, {getActivePage} from '../pages';
import PopupNotification from './common/PopupNotification';
import { isCookiesDisabled } from '../utils/helpers';
const React = require('react');
@ -38,6 +39,16 @@ const StylesWrapper = ({member}) => {
};
};
const CookieDisabledBanner = () => {
const cookieDisabled = isCookiesDisabled();
if (cookieDisabled) {
return (
<div> Cookies are disabled </div>
);
}
return null;
}
class PopupContent extends React.Component {
static contextType = AppContext;
@ -100,6 +111,7 @@ class PopupContent extends React.Component {
return (
<div className='gh-portal-popup-wrapper'>
<div className={(hasMode(['preview', 'dev']) ? 'gh-portal-popup-container preview' : 'gh-portal-popup-container') + ' ' + popupWidthStyle} style={pageStyle} ref={node => (this.node = node)} tabIndex="-1">
<CookieDisabledBanner />
{this.renderPopupNotification()}
{this.renderActivePage()}
</div>

View File

@ -1,5 +1,9 @@
import CalculateDiscount from './discount';
export function isCookiesDisabled() {
return !(navigator && navigator.cookieEnabled);
}
export function getMemberSubscription({member = {}}) {
if (member.paid) {
const [subscription] = member.subscriptions || [];