Help popout email support license validation check (#13133)

* Added helper function to check user plan type.

* Updated help menu email support license check.

* Removed stray output check

* Updated function name as per feedback.

* Reworked code to use the licensing store over the auth store.

* Removed unnecessary variable declaration and return instead.

* Updated function name to maintain consistency.
This commit is contained in:
Conor Webb 2024-02-26 11:45:47 +00:00 committed by GitHub
parent c1f4cb685c
commit af7b6a46a9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 14 additions and 7 deletions

View File

@ -1,11 +1,11 @@
<script>
import FontAwesomeIcon from "./FontAwesomeIcon.svelte"
import { Popover, Heading, Body } from "@budibase/bbui"
import { licensing } from "stores/portal"
import { isEnabled, TENANT_FEATURE_FLAGS } from "helpers/featureFlags"
import { licensing } from "stores/portal"
import { isPremiumOrAbove } from "helpers/planTitle"
$: isBusinessAndAbove =
$licensing.isBusinessPlan || $licensing.isEnterprisePlan
$: premiumOrAboveLicense = isPremiumOrAbove($licensing?.license.plan.type)
let show
let hide
@ -56,22 +56,25 @@
<div class="divider" />
{#if isEnabled(TENANT_FEATURE_FLAGS.LICENSING)}
<a
href={isBusinessAndAbove
href={premiumOrAboveLicense
? "mailto:support@budibase.com"
: "/builder/portal/account/usage"}
>
<div class="premiumLinkContent" class:disabled={!isBusinessAndAbove}>
<div
class="premiumLinkContent"
class:disabled={!premiumOrAboveLicense}
>
<div class="icon">
<FontAwesomeIcon name="fa-solid fa-envelope" />
</div>
<Body size="S">Email support</Body>
</div>
{#if !isBusinessAndAbove}
{#if !premiumOrAboveLicense}
<div class="premiumBadge">
<div class="icon">
<FontAwesomeIcon name="fa-solid fa-lock" />
</div>
<Body size="XS">Business</Body>
<Body size="XS">Premium</Body>
</div>
{/if}
</a>

View File

@ -25,3 +25,7 @@ export function getFormattedPlanName(userPlanType) {
}
return `${planName} Plan`
}
export function isPremiumOrAbove(userPlanType) {
return ![PlanType.PRO, PlanType.TEAM, PlanType.FREE].includes(userPlanType)
}