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:
melohagan 2024-05-15 11:33:02 +01:00 committed by GitHub
parent 9f2f177560
commit a350a715fa
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 543 additions and 148 deletions

View File

@ -2,21 +2,21 @@
import { Modal, ModalContent } from "@budibase/bbui"
import FreeTrial from "../../../../assets/FreeTrial.svelte"
import { get } from "svelte/store"
import { auth, licensing } from "stores/portal"
import { auth, licensing, admin } from "stores/portal"
import { API } from "api"
import { PlanType } from "@budibase/types"
import { sdk } from "@budibase/shared-core"
let freeTrialModal
$: planType = $licensing?.license?.plan?.type
$: showFreeTrialModal(planType, freeTrialModal)
$: isOwner = $auth.accountPortalAccess && $admin.cloud
const showFreeTrialModal = (planType, freeTrialModal) => {
if (
planType === PlanType.ENTERPRISE_BASIC_TRIAL &&
!$auth.user?.freeTrialConfirmedAt &&
sdk.users.isAdmin($auth.user)
isOwner
) {
freeTrialModal?.show()
}

View File

@ -1,7 +1,14 @@
<script>
import { isActive, redirect, goto, url } from "@roxi/routify"
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 UpgradeButton from "./_components/UpgradeButton.svelte"
import MobileMenu from "./_components/MobileMenu.svelte"
@ -20,6 +27,7 @@
$: $url(), updateActiveTab($menu)
$: isOnboarding =
!$appsStore.apps.length && sdk.users.hasBuilderPermissions($auth.user)
$: isOwner = $auth.accountPortalAccess && $admin.cloud
const updateActiveTab = menu => {
for (let entry of menu) {
@ -38,8 +46,7 @@
const showFreeTrialBanner = () => {
return (
$licensing.license?.plan?.type ===
Constants.PlanType.ENTERPRISE_BASIC_TRIAL &&
sdk.users.isAdmin($auth.user)
Constants.PlanType.ENTERPRISE_BASIC_TRIAL && isOwner
)
}

672
yarn.lock

File diff suppressed because it is too large Load Diff