diff --git a/ghost/portal/src/App.js b/ghost/portal/src/App.js index c5774b85cd..97848a2ae4 100644 --- a/ghost/portal/src/App.js +++ b/ghost/portal/src/App.js @@ -9,7 +9,7 @@ import * as Fixtures from './utils/fixtures'; import ActionHandler from './actions'; import './App.css'; import NotificationParser from './utils/notifications'; -import {createPopupNotification, getCurrencySymbol, getFirstpromoterId, getQueryPrice, getSiteDomain, isComplimentaryMember, removePortalLinkFromUrl} from './utils/helpers'; +import {createPopupNotification, getCurrencySymbol, getFirstpromoterId, getQueryPrice, getSiteDomain, isComplimentaryMember, isInviteOnlySite, removePortalLinkFromUrl} from './utils/helpers'; const handleDataAttributes = require('./data-attributes'); const React = require('react'); @@ -516,10 +516,11 @@ export default class App extends React.Component { } /**Get final page set in App context from state data*/ - getContextPage({page, member}) { + getContextPage({site, page, member}) { /**Set default page based on logged-in status */ if (!page) { - page = member ? 'accountHome' : 'signup'; + const loggedOutPage = isInviteOnlySite({site}) ? 'signin' : 'signup'; + page = member ? 'accountHome' : loggedOutPage; } if (page === 'accountPlan' && isComplimentaryMember({member})) { @@ -552,7 +553,7 @@ export default class App extends React.Component { /**Get final App level context from App state*/ getContextFromState() { const {site, member, action, page, lastPage, showPopup, pageQuery, popupNotification} = this.state; - const contextPage = this.getContextPage({page, member}); + const contextPage = this.getContextPage({site, page, member}); const contextMember = this.getContextMember({page: contextPage, member}); return { site, diff --git a/ghost/portal/src/components/TriggerButton.js b/ghost/portal/src/components/TriggerButton.js index 623b6eb371..0f08ef68cf 100644 --- a/ghost/portal/src/components/TriggerButton.js +++ b/ghost/portal/src/components/TriggerButton.js @@ -9,6 +9,7 @@ import {ReactComponent as ButtonIcon3} from '../images/icons/button-icon-3.svg'; import {ReactComponent as ButtonIcon4} from '../images/icons/button-icon-4.svg'; import {ReactComponent as ButtonIcon5} from '../images/icons/button-icon-5.svg'; import TriggerButtonStyle from './TriggerButton.styles'; +import {isInviteOnlySite} from '../utils/helpers'; const React = require('react'); @@ -163,11 +164,12 @@ class TriggerButtonContent extends React.Component { } onToggle() { - const {showPopup, member} = this.context; + const {showPopup, member, site} = this.context; if (showPopup) { this.context.onAction('closePopup'); } else { - const page = member ? 'accountHome' : 'signup'; + const loggedOutPage = isInviteOnlySite({site}) ? 'signin' : 'signup'; + const page = member ? 'accountHome' : loggedOutPage; this.context.onAction('openPopup', {page}); } } diff --git a/ghost/portal/src/components/common/PlansSection.js b/ghost/portal/src/components/common/PlansSection.js index 903217d693..556406d362 100644 --- a/ghost/portal/src/components/common/PlansSection.js +++ b/ghost/portal/src/components/common/PlansSection.js @@ -388,7 +388,7 @@ function PlanOptions({plans, selectedPlan, onPlanSelect, changePlan}) { const {site} = useContext(AppContext); const {free_price_name: freePriceName, free_price_description: freePriceDescription} = site; addDiscountToPlans(plans); - return plans.map(({ name, currency_symbol: currencySymbol, amount, description, interval, id}) => { + return plans.map(({name, currency_symbol: currencySymbol, amount, description, interval, id}) => { const price = amount / 100; const isChecked = selectedPlan === id; const classes = (isChecked ? 'gh-portal-plan-section checked' : 'gh-portal-plan-section'); diff --git a/ghost/portal/src/utils/helpers.js b/ghost/portal/src/utils/helpers.js index d6d1839c66..dcda9a3fd9 100644 --- a/ghost/portal/src/utils/helpers.js +++ b/ghost/portal/src/utils/helpers.js @@ -145,7 +145,7 @@ export function capitalize(str) { return str.charAt(0).toUpperCase() + str.slice(1); } -export function isInviteOnlySite({site = {}, pageQuery}) { +export function isInviteOnlySite({site = {}, pageQuery = ''}) { const prices = getSitePrices({site, pageQuery}); return prices.length === 0 || (site && site.members_signup_access === 'invite'); }