diff --git a/ghost/portal/src/components/Notification.js b/ghost/portal/src/components/Notification.js index 3741db31fa..35d1d959a1 100644 --- a/ghost/portal/src/components/Notification.js +++ b/ghost/portal/src/components/Notification.js @@ -188,9 +188,9 @@ export default class Notification extends React.Component { const type = this.state.type; const deleteParams = []; if (['signin', 'signup'].includes(type)) { - deleteParams.push('action', 'portal-action', 'success'); + deleteParams.push('portal-action', 'success'); } else if (['stripe:checkout'].includes(type)) { - deleteParams.push('stripe', 'portal-stripe'); + deleteParams.push('stripe'); } clearURLParams(deleteParams); this.setState({ diff --git a/ghost/portal/src/utils/api.js b/ghost/portal/src/utils/api.js index e0043ce262..0bd304cd2b 100644 --- a/ghost/portal/src/utils/api.js +++ b/ghost/portal/src/utils/api.js @@ -130,13 +130,13 @@ function setupGhostApi({siteUrl = window.location.origin}) { const url = endpointFor({type: 'members', resource: 'create-stripe-checkout-session'}); if (!successUrl) { const checkoutSuccessUrl = new URL(siteUrl); - checkoutSuccessUrl.searchParams.set('portal-stripe', 'success'); + checkoutSuccessUrl.searchParams.set('stripe', 'portal-success'); successUrl = checkoutSuccessUrl.href; } if (!cancelUrl) { const checkoutCancelUrl = new URL(siteUrl); - checkoutCancelUrl.searchParams.set('portal-stripe', 'cancel'); + checkoutCancelUrl.searchParams.set('stripe', 'portal-cancel'); cancelUrl = checkoutCancelUrl.href; } return makeRequest({ @@ -181,13 +181,13 @@ function setupGhostApi({siteUrl = window.location.origin}) { const url = endpointFor({type: 'members', resource: 'create-stripe-update-session'}); if (!successUrl) { const checkoutSuccessUrl = new URL(siteUrl); - checkoutSuccessUrl.searchParams.set('portal-stripe', 'success'); + checkoutSuccessUrl.searchParams.set('stripe', 'portal-billing-update-success'); successUrl = checkoutSuccessUrl.href; } if (!cancelUrl) { const checkoutCancelUrl = new URL(siteUrl); - checkoutCancelUrl.searchParams.set('portal-stripe', 'cancel'); + checkoutCancelUrl.searchParams.set('stripe', 'portal-billing-update-cancel'); cancelUrl = checkoutCancelUrl.href; } return makeRequest({ diff --git a/ghost/portal/src/utils/notifications.js b/ghost/portal/src/utils/notifications.js index e81eb7e8fa..d9d4a964b5 100644 --- a/ghost/portal/src/utils/notifications.js +++ b/ghost/portal/src/utils/notifications.js @@ -12,8 +12,8 @@ export const handleAuthActions = ({qsParams, action, status}) => { }; export const handleStripeActions = ({status, billingOnly}) => { - if (!billingOnly && ['success'].includes(status)) { - const statusVal = status === 'success' ? 'success' : 'warning'; + if (!billingOnly && ['portal-success'].includes(status)) { + const statusVal = status === 'portal-success' ? 'success' : 'warning'; return { type: 'stripe:checkout', status: statusVal, @@ -22,8 +22,8 @@ export const handleStripeActions = ({status, billingOnly}) => { }; } - if (billingOnly && ['billing-update-success', 'billing-update-cancel'].includes(status)) { - const statusVal = status === 'billing-update-success' ? 'success' : 'warning'; + if (billingOnly && ['portal-billing-update-success', 'portal-billing-update-cancel'].includes(status)) { + const statusVal = status === 'portal-billing-update-success' ? 'success' : 'warning'; return { type: 'stripe:billing-update', status: statusVal, @@ -53,7 +53,7 @@ export default function NotificationParser({billingOnly = false} = {}) { const qsParams = new URLSearchParams(qs); const action = qsParams.get('portal-action'); const successStatus = qsParams.get('success'); - const stripeStatus = qsParams.get('stripe') || qsParams.get('portal-stripe'); + const stripeStatus = qsParams.get('stripe'); let notificationData = null; if (stripeStatus) {