1
0
Fork 0
mirror of synced 2024-07-02 13:01:09 +12:00

Merge pull request #7969 from Budibase/fix/update-billing-messaging

Minor update replacing upgrade terminology for billing notifications
This commit is contained in:
Rory Powell 2022-09-26 16:25:32 +01:00 committed by GitHub
commit 901a10b855
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 33 additions and 15 deletions

View file

@ -8,7 +8,7 @@
let accountDowngradeModal let accountDowngradeModal
$: accountUrl = $admin.accountPortalUrl $: accountUrl = $admin.accountPortalUrl
$: upgradeUrl = `${accountUrl}/portal/upgrade` $: billingUrl = `${accountUrl}/portal/billing`
export function show() { export function show() {
accountDowngradeModal.show() accountDowngradeModal.show()
@ -24,10 +24,10 @@
title="Your account is now on the Free plan" title="Your account is now on the Free plan"
size="M" size="M"
showCancelButton={$auth.user.accountPortalAccess} showCancelButton={$auth.user.accountPortalAccess}
confirmText={$auth.user.accountPortalAccess ? "Upgrade" : "Confirm"} confirmText={$auth.user.accountPortalAccess ? "Billing" : "Confirm"}
onConfirm={$auth.user.accountPortalAccess onConfirm={$auth.user.accountPortalAccess
? () => { ? () => {
window.location.href = upgradeUrl window.location.href = billingUrl
} }
: null} : null}
> >
@ -35,7 +35,9 @@
The payment for your subscription has failed and we have downgraded your The payment for your subscription has failed and we have downgraded your
account to the <span class="free-plan">Free plan</span>. account to the <span class="free-plan">Free plan</span>.
</Body> </Body>
<Body>Upgrade to restore full functionality.</Body> <Body>
Please update your billing details to restore full functionality.
</Body>
{#if !$auth.user.accountPortalAccess} {#if !$auth.user.accountPortalAccess}
<Body>Please contact the account holder to upgrade.</Body> <Body>Please contact the account holder to upgrade.</Body>
{/if} {/if}

View file

@ -11,7 +11,7 @@
const paymentFailedTitle = "Payment failed" const paymentFailedTitle = "Payment failed"
$: accountUrl = $admin.accountPortalUrl $: accountUrl = $admin.accountPortalUrl
$: upgradeUrl = `${accountUrl}/portal/upgrade` $: billingUrl = `${accountUrl}/portal/billing`
export function show() { export function show() {
paymentFailedModal.show() paymentFailedModal.show()
@ -33,14 +33,14 @@
<ModalContent <ModalContent
title={paymentFailedTitle} title={paymentFailedTitle}
size="M" size="M"
confirmText="Upgrade" confirmText="Billing"
onConfirm={() => { onConfirm={() => {
window.location.href = upgradeUrl window.location.href = billingUrl
}} }}
> >
<Body>The payment for your subscription has failed</Body> <Body>The payment for your subscription has failed</Body>
<Body> <Body>
Please upgrade your billing details before your account gets downgraded Please update your billing details before your account gets downgraded
to the free plan to the free plan
</Body> </Body>
<Body weight={800}> <Body weight={800}>

View file

@ -10,15 +10,31 @@ const defaultCacheFn = key => {
temporalStore.actions.setExpiring(key, {}, oneDayInSeconds) 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) { if (!get(auth).user.accountPortalAccess) {
return {} return {}
} }
return { return {
extraButtonText: "Upgrade Plan", extraButtonText: actionText,
extraButtonAction: () => { extraButtonAction: () => {
defaultCacheFn(key) defaultCacheFn(key)
window.location.href = `${get(admin).accountPortalUrl}/portal/upgrade` window.location.href = url
}, },
} }
} }
@ -65,7 +81,7 @@ const buildUsageInfoBanner = (
? bannerConfig ? bannerConfig
: { : {
...bannerConfig, ...bannerConfig,
...defaultAction(cacheKey), ...upgradeAction(cacheKey),
} }
} }
@ -84,7 +100,7 @@ const buildDayPassBanner = () => {
? "" ? ""
: "Please contact your account holder to upgrade." : "Please contact your account holder to upgrade."
}`, }`,
...defaultAction(), ...upgradeAction(),
showCloseButton: false, showCloseButton: false,
} }
} }
@ -115,11 +131,11 @@ const buildPaymentFailedBanner = () => {
criteria: () => { criteria: () => {
return get(licensing)?.accountPastDue && !get(licensing).isFreePlan 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} day${
get(licensing)?.pastDueDaysRemaining == 1 ? "" : "s" get(licensing)?.pastDueDaysRemaining == 1 ? "" : "s"
}`, }`,
...defaultAction(), ...billingAction(),
showCloseButton: false, showCloseButton: false,
tooltip: get(licensing).pastDueEndDate, tooltip: get(licensing).pastDueEndDate,
} }