diff --git a/ghost/portal/src/App.js b/ghost/portal/src/App.js index 08d34b2609..c04727d1f4 100644 --- a/ghost/portal/src/App.js +++ b/ghost/portal/src/App.js @@ -10,7 +10,7 @@ import * as Fixtures from './utils/fixtures'; import ActionHandler from './actions'; import './App.css'; import NotificationParser from './utils/notifications'; -import {createPopupNotification, getCurrencySymbol, getFirstpromoterId, getPriceIdFromPageQuery, getProductFromId, getQueryPrice, getSiteDomain, isComplimentaryMember, isInviteOnlySite, isPaidMember, isSentryEventAllowed, removePortalLinkFromUrl} from './utils/helpers'; +import {createPopupNotification, getCurrencySymbol, getFirstpromoterId, getPriceIdFromPageQuery, getProductFromId, getQueryPrice, getSiteDomain, isActiveOffer, isComplimentaryMember, isInviteOnlySite, isPaidMember, isSentryEventAllowed, removePortalLinkFromUrl} from './utils/helpers'; const handleDataAttributes = require('./data-attributes'); const React = require('react'); @@ -576,7 +576,7 @@ export default class App extends React.Component { try { const offerData = await this.GhostApi.site.offer({offerId}); const offer = offerData?.offers[0]; - if (offer) { + if (isActiveOffer({offer})) { if (!portalButton) { const product = getProductFromId({site, productId: offer.tier.id}); const price = offer.cadence === 'month' ? product.monthlyPrice : product.yearlyPrice; diff --git a/ghost/portal/src/utils/helpers.js b/ghost/portal/src/utils/helpers.js index d86b452a4b..da97f01d38 100644 --- a/ghost/portal/src/utils/helpers.js +++ b/ghost/portal/src/utils/helpers.js @@ -528,3 +528,7 @@ export const getUpdatedOfferPrice = ({offer, price, useFormatted = false}) => { } return updatedAmount; }; + +export const isActiveOffer = ({offer}) => { + return offer?.status === 'active'; +};