2022-04-26 12:28:31 +02:00
|
|
|
import { authStore } from "../stores/auth.js"
|
|
|
|
import { get } from "svelte/store"
|
2022-09-29 10:17:22 +02:00
|
|
|
import { Constants } from "@budibase/frontend-core"
|
2022-04-26 12:28:31 +02:00
|
|
|
|
|
|
|
const getLicense = () => {
|
|
|
|
const user = get(authStore)
|
|
|
|
if (user) {
|
|
|
|
return user.license
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export const isFreePlan = () => {
|
|
|
|
const license = getLicense()
|
|
|
|
if (license) {
|
2022-09-29 10:17:22 +02:00
|
|
|
return license.plan.type === Constants.PlanType.FREE
|
2022-04-26 12:28:31 +02:00
|
|
|
} else {
|
|
|
|
// safety net - no license means free plan
|
|
|
|
return true
|
|
|
|
}
|
|
|
|
}
|