Fix: Only show free trial banner/modal to account owner (#13692)
* Add free_trial to deploy camunda script * Fix only show trial banner to owner
This commit is contained in:
parent
9f2f177560
commit
a350a715fa
|
@ -2,21 +2,21 @@
|
||||||
import { Modal, ModalContent } from "@budibase/bbui"
|
import { Modal, ModalContent } from "@budibase/bbui"
|
||||||
import FreeTrial from "../../../../assets/FreeTrial.svelte"
|
import FreeTrial from "../../../../assets/FreeTrial.svelte"
|
||||||
import { get } from "svelte/store"
|
import { get } from "svelte/store"
|
||||||
import { auth, licensing } from "stores/portal"
|
import { auth, licensing, admin } from "stores/portal"
|
||||||
import { API } from "api"
|
import { API } from "api"
|
||||||
import { PlanType } from "@budibase/types"
|
import { PlanType } from "@budibase/types"
|
||||||
import { sdk } from "@budibase/shared-core"
|
|
||||||
|
|
||||||
let freeTrialModal
|
let freeTrialModal
|
||||||
|
|
||||||
$: planType = $licensing?.license?.plan?.type
|
$: planType = $licensing?.license?.plan?.type
|
||||||
$: showFreeTrialModal(planType, freeTrialModal)
|
$: showFreeTrialModal(planType, freeTrialModal)
|
||||||
|
$: isOwner = $auth.accountPortalAccess && $admin.cloud
|
||||||
|
|
||||||
const showFreeTrialModal = (planType, freeTrialModal) => {
|
const showFreeTrialModal = (planType, freeTrialModal) => {
|
||||||
if (
|
if (
|
||||||
planType === PlanType.ENTERPRISE_BASIC_TRIAL &&
|
planType === PlanType.ENTERPRISE_BASIC_TRIAL &&
|
||||||
!$auth.user?.freeTrialConfirmedAt &&
|
!$auth.user?.freeTrialConfirmedAt &&
|
||||||
sdk.users.isAdmin($auth.user)
|
isOwner
|
||||||
) {
|
) {
|
||||||
freeTrialModal?.show()
|
freeTrialModal?.show()
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,14 @@
|
||||||
<script>
|
<script>
|
||||||
import { isActive, redirect, goto, url } from "@roxi/routify"
|
import { isActive, redirect, goto, url } from "@roxi/routify"
|
||||||
import { Icon, notifications, Tabs, Tab } from "@budibase/bbui"
|
import { Icon, notifications, Tabs, Tab } from "@budibase/bbui"
|
||||||
import { organisation, auth, menu, appsStore, licensing } from "stores/portal"
|
import {
|
||||||
|
organisation,
|
||||||
|
auth,
|
||||||
|
menu,
|
||||||
|
appsStore,
|
||||||
|
licensing,
|
||||||
|
admin,
|
||||||
|
} from "stores/portal"
|
||||||
import { onMount } from "svelte"
|
import { onMount } from "svelte"
|
||||||
import UpgradeButton from "./_components/UpgradeButton.svelte"
|
import UpgradeButton from "./_components/UpgradeButton.svelte"
|
||||||
import MobileMenu from "./_components/MobileMenu.svelte"
|
import MobileMenu from "./_components/MobileMenu.svelte"
|
||||||
|
@ -20,6 +27,7 @@
|
||||||
$: $url(), updateActiveTab($menu)
|
$: $url(), updateActiveTab($menu)
|
||||||
$: isOnboarding =
|
$: isOnboarding =
|
||||||
!$appsStore.apps.length && sdk.users.hasBuilderPermissions($auth.user)
|
!$appsStore.apps.length && sdk.users.hasBuilderPermissions($auth.user)
|
||||||
|
$: isOwner = $auth.accountPortalAccess && $admin.cloud
|
||||||
|
|
||||||
const updateActiveTab = menu => {
|
const updateActiveTab = menu => {
|
||||||
for (let entry of menu) {
|
for (let entry of menu) {
|
||||||
|
@ -38,8 +46,7 @@
|
||||||
const showFreeTrialBanner = () => {
|
const showFreeTrialBanner = () => {
|
||||||
return (
|
return (
|
||||||
$licensing.license?.plan?.type ===
|
$licensing.license?.plan?.type ===
|
||||||
Constants.PlanType.ENTERPRISE_BASIC_TRIAL &&
|
Constants.PlanType.ENTERPRISE_BASIC_TRIAL && isOwner
|
||||||
sdk.users.isAdmin($auth.user)
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue