Cleaned up stripe success/cancel urls
no refs Removes old portal specific cancel/success params for stripe checkout/billing update
This commit is contained in:
parent
97f797b168
commit
87f08919b7
@ -127,7 +127,7 @@ export default class PopupNotification extends React.Component {
|
||||
const {type} = popupNotification || {};
|
||||
if (e.animationName === 'popupnotification-slideout') {
|
||||
if (type === 'stripe:billing-update') {
|
||||
clearURLParams(['stripe', 'portal-stripe']);
|
||||
clearURLParams(['stripe']);
|
||||
}
|
||||
this.context.onAction('clearPopupNotification');
|
||||
}
|
||||
|
@ -131,13 +131,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('stripe', 'portal-success');
|
||||
checkoutSuccessUrl.searchParams.set('stripe', 'success');
|
||||
successUrl = checkoutSuccessUrl.href;
|
||||
}
|
||||
|
||||
if (!cancelUrl) {
|
||||
const checkoutCancelUrl = window.location.href.startsWith(siteUrlObj.href) ? new URL(window.location.href) : new URL(siteUrl);
|
||||
checkoutCancelUrl.searchParams.set('stripe', 'portal-cancel');
|
||||
checkoutCancelUrl.searchParams.set('stripe', 'cancel');
|
||||
cancelUrl = checkoutCancelUrl.href;
|
||||
}
|
||||
return makeRequest({
|
||||
@ -183,13 +183,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('stripe', 'portal-billing-update-success');
|
||||
checkoutSuccessUrl.searchParams.set('stripe', 'billing-update-success');
|
||||
successUrl = checkoutSuccessUrl.href;
|
||||
}
|
||||
|
||||
if (!cancelUrl) {
|
||||
const checkoutCancelUrl = window.location.href.startsWith(siteUrlObj.href) ? new URL(window.location.href) : new URL(siteUrl);
|
||||
checkoutCancelUrl.searchParams.set('stripe', 'portal-billing-update-cancel');
|
||||
checkoutCancelUrl.searchParams.set('stripe', 'billing-update-cancel');
|
||||
cancelUrl = checkoutCancelUrl.href;
|
||||
}
|
||||
return makeRequest({
|
||||
|
@ -12,8 +12,8 @@ export const handleAuthActions = ({qsParams, action, status}) => {
|
||||
};
|
||||
|
||||
export const handleStripeActions = ({status, billingOnly}) => {
|
||||
if (!billingOnly && ['portal-success'].includes(status)) {
|
||||
const statusVal = status === 'portal-success' ? 'success' : 'warning';
|
||||
if (!billingOnly && ['success'].includes(status)) {
|
||||
const statusVal = ['success'].includes(status) ? 'success' : 'warning';
|
||||
return {
|
||||
type: 'stripe:checkout',
|
||||
status: statusVal,
|
||||
@ -22,8 +22,8 @@ export const handleStripeActions = ({status, billingOnly}) => {
|
||||
};
|
||||
}
|
||||
|
||||
if (billingOnly && ['portal-billing-update-success', 'portal-billing-update-cancel'].includes(status)) {
|
||||
const statusVal = status === 'portal-billing-update-success' ? 'success' : 'warning';
|
||||
if (billingOnly && ['billing-update-success', 'billing-update-cancel'].includes(status)) {
|
||||
const statusVal = status === 'billing-update-success' ? 'success' : 'warning';
|
||||
return {
|
||||
type: 'stripe:billing-update',
|
||||
status: statusVal,
|
||||
|
Loading…
Reference in New Issue
Block a user