Added function to get correct plan display name (#12810)
* Changed minPlan BUSINESS to PREMIUM_PLUS * Added new helper to display the correct string plan * Changed ManageAccessModal to use the new helper * Refactored to use plan title helper, removed title function * Removed capitalised function from svelte template * Fixed linting issues * Ran yarn lint. Fixed linting issues.
This commit is contained in:
parent
7241a8ae34
commit
fa36701f0f
|
@ -13,6 +13,7 @@
|
|||
Icon,
|
||||
} from "@budibase/bbui"
|
||||
import { capitalise } from "helpers"
|
||||
import { getFormattedPlanName } from "helpers/planTitle"
|
||||
import { get } from "svelte/store"
|
||||
|
||||
export let resourceId
|
||||
|
@ -99,7 +100,9 @@
|
|||
{#if requiresPlanToModify}
|
||||
<span class="lock-tag">
|
||||
<Tags>
|
||||
<Tag icon="LockClosed">{capitalise(requiresPlanToModify)}</Tag>
|
||||
<Tag icon="LockClosed"
|
||||
>{getFormattedPlanName(requiresPlanToModify)}</Tag
|
||||
>
|
||||
</Tags>
|
||||
</span>
|
||||
{/if}
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
import { PlanType } from "@budibase/types"
|
||||
|
||||
export function getFormattedPlanName(userPlanType) {
|
||||
let planName = "Free"
|
||||
if (userPlanType === PlanType.PREMIUM_PLUS) {
|
||||
planName = "Premium"
|
||||
} else if (userPlanType === PlanType.ENTERPRISE_BASIC) {
|
||||
planName = "Enterprise"
|
||||
}
|
||||
return `${planName} Plan`
|
||||
}
|
|
@ -15,7 +15,7 @@
|
|||
import { DashCard, Usage } from "components/usage"
|
||||
import { PlanModel } from "constants"
|
||||
import { sdk } from "@budibase/shared-core"
|
||||
import { PlanType } from "@budibase/types"
|
||||
import { getFormattedPlanName } from "helpers/planTitle"
|
||||
|
||||
let staticUsage = []
|
||||
let monthlyUsage = []
|
||||
|
@ -100,23 +100,6 @@
|
|||
cancelAt = license?.billing?.subscription?.cancelAt
|
||||
}
|
||||
|
||||
const capitalise = string => {
|
||||
if (string) {
|
||||
return string.charAt(0).toUpperCase() + string.slice(1)
|
||||
}
|
||||
}
|
||||
|
||||
const planTitle = () => {
|
||||
const planType = license?.plan.type
|
||||
let planName = license?.plan.type
|
||||
if (planType === PlanType.PREMIUM_PLUS) {
|
||||
planName = "Premium"
|
||||
} else if (planType === PlanType.ENTERPRISE_BASIC) {
|
||||
planName = "Enterprise"
|
||||
}
|
||||
return `${capitalise(planName)} Plan`
|
||||
}
|
||||
|
||||
const getDaysRemaining = timestamp => {
|
||||
if (!timestamp) {
|
||||
return
|
||||
|
@ -227,7 +210,7 @@
|
|||
|
||||
<DashCard
|
||||
description="YOUR CURRENT PLAN"
|
||||
title={planTitle()}
|
||||
title={getFormattedPlanName(license?.plan.type)}
|
||||
{primaryActionText}
|
||||
primaryAction={showButton ? goToAccountPortal : undefined}
|
||||
{textRows}
|
||||
|
|
|
@ -61,7 +61,7 @@ export async function getInheritablePermissions(
|
|||
export async function allowsExplicitPermissions(resourceId: string) {
|
||||
if (isViewID(resourceId)) {
|
||||
const allowed = await features.isViewPermissionEnabled()
|
||||
const minPlan = !allowed ? PlanType.BUSINESS : undefined
|
||||
const minPlan = !allowed ? PlanType.PREMIUM_PLUS : undefined
|
||||
|
||||
return {
|
||||
allowed,
|
||||
|
|
Loading…
Reference in New Issue