diff --git a/packages/builder/src/components/portal/licensing/AccountDowngradedModal.svelte b/packages/builder/src/components/portal/licensing/AccountDowngradedModal.svelte index 53683faa87..2278b4f6df 100644 --- a/packages/builder/src/components/portal/licensing/AccountDowngradedModal.svelte +++ b/packages/builder/src/components/portal/licensing/AccountDowngradedModal.svelte @@ -8,7 +8,7 @@ let accountDowngradeModal $: accountUrl = $admin.accountPortalUrl - $: upgradeUrl = `${accountUrl}/portal/upgrade` + $: billingUrl = `${accountUrl}/portal/billing` export function show() { accountDowngradeModal.show() @@ -24,10 +24,10 @@ title="Your account is now on the Free plan" size="M" showCancelButton={$auth.user.accountPortalAccess} - confirmText={$auth.user.accountPortalAccess ? "Upgrade" : "Confirm"} + confirmText={$auth.user.accountPortalAccess ? "Billing" : "Confirm"} onConfirm={$auth.user.accountPortalAccess ? () => { - window.location.href = upgradeUrl + window.location.href = billingUrl } : null} > @@ -35,7 +35,9 @@ The payment for your subscription has failed and we have downgraded your account to the Free plan. - Upgrade to restore full functionality. + + Please update your billing details to restore full functionality. + {#if !$auth.user.accountPortalAccess} Please contact the account holder to upgrade. {/if} diff --git a/packages/builder/src/components/portal/licensing/PaymentFailedModal.svelte b/packages/builder/src/components/portal/licensing/PaymentFailedModal.svelte index 21a3c2dcd9..502d43d644 100644 --- a/packages/builder/src/components/portal/licensing/PaymentFailedModal.svelte +++ b/packages/builder/src/components/portal/licensing/PaymentFailedModal.svelte @@ -11,7 +11,7 @@ const paymentFailedTitle = "Payment failed" $: accountUrl = $admin.accountPortalUrl - $: upgradeUrl = `${accountUrl}/portal/upgrade` + $: billingUrl = `${accountUrl}/portal/billing` export function show() { paymentFailedModal.show() @@ -33,14 +33,14 @@ { - window.location.href = upgradeUrl + window.location.href = billingUrl }} > The payment for your subscription has failed - Please upgrade your billing details before your account gets downgraded + Please update your billing details before your account gets downgraded to the free plan diff --git a/packages/builder/src/components/portal/licensing/licensingBanners.js b/packages/builder/src/components/portal/licensing/licensingBanners.js index d93305cbf6..34df283b68 100644 --- a/packages/builder/src/components/portal/licensing/licensingBanners.js +++ b/packages/builder/src/components/portal/licensing/licensingBanners.js @@ -10,15 +10,31 @@ const defaultCacheFn = key => { temporalStore.actions.setExpiring(key, {}, oneDayInSeconds) } -const defaultAction = key => { +const upgradeAction = key => { + return defaultNavigateAction( + key, + "Upgrade Plan", + `${get(admin).accountPortalUrl}/portal/upgrade` + ) +} + +const billingAction = key => { + return defaultNavigateAction( + key, + "Billing", + `${get(admin).accountPortalUrl}/portal/billing` + ) +} + +const defaultNavigateAction = (key, actionText, url) => { if (!get(auth).user.accountPortalAccess) { return {} } return { - extraButtonText: "Upgrade Plan", + extraButtonText: actionText, extraButtonAction: () => { defaultCacheFn(key) - window.location.href = `${get(admin).accountPortalUrl}/portal/upgrade` + window.location.href = url }, } } @@ -65,7 +81,7 @@ const buildUsageInfoBanner = ( ? bannerConfig : { ...bannerConfig, - ...defaultAction(cacheKey), + ...upgradeAction(cacheKey), } } @@ -84,7 +100,7 @@ const buildDayPassBanner = () => { ? "" : "Please contact your account holder to upgrade." }`, - ...defaultAction(), + ...upgradeAction(), showCloseButton: false, } } @@ -115,11 +131,11 @@ const buildPaymentFailedBanner = () => { criteria: () => { return get(licensing)?.accountPastDue && !get(licensing).isFreePlan }, - message: `Payment Failed - Please update your billing details or your account will be downgrades in + message: `Payment Failed - Please update your billing details or your account will be downgraded in ${get(licensing)?.pastDueDaysRemaining} day${ get(licensing)?.pastDueDaysRemaining == 1 ? "" : "s" }`, - ...defaultAction(), + ...billingAction(), showCloseButton: false, tooltip: get(licensing).pastDueEndDate, }