diff --git a/packages/builder/package.json b/packages/builder/package.json index 702e53c12a..95644fc399 100644 --- a/packages/builder/package.json +++ b/packages/builder/package.json @@ -62,6 +62,7 @@ "@budibase/frontend-core": "0.0.1", "@budibase/shared-core": "0.0.1", "@budibase/string-templates": "0.0.1", + "@budibase/types": "0.0.1", "@fortawesome/fontawesome-svg-core": "^6.2.1", "@fortawesome/free-brands-svg-icons": "^6.2.1", "@fortawesome/free-solid-svg-icons": "^6.2.1", diff --git a/packages/builder/src/components/portal/licensing/AccountLockedModal.svelte b/packages/builder/src/components/portal/licensing/AccountLockedModal.svelte new file mode 100644 index 0000000000..a33d982627 --- /dev/null +++ b/packages/builder/src/components/portal/licensing/AccountLockedModal.svelte @@ -0,0 +1,31 @@ + + + + + Due to the free plan user limit being exceeded, your account has been + de-activated. Upgrade your plan to re-activate your account. + + diff --git a/packages/builder/src/components/portal/licensing/licensingBanners.js b/packages/builder/src/components/portal/licensing/licensingBanners.js index dafa8cfaed..ea4a1bb946 100644 --- a/packages/builder/src/components/portal/licensing/licensingBanners.js +++ b/packages/builder/src/components/portal/licensing/licensingBanners.js @@ -3,7 +3,6 @@ import { temporalStore } from "builderStore" import { admin, auth, licensing } from "stores/portal" import { get } from "svelte/store" import { BANNER_TYPES } from "@budibase/bbui" -import { capitalise } from "helpers" const oneDayInSeconds = 86400 @@ -146,23 +145,19 @@ const buildUsersAboveLimitBanner = EXPIRY_KEY => { const userLicensing = get(licensing) return { key: EXPIRY_KEY, - type: BANNER_TYPES.WARNING, + type: BANNER_TYPES.NEGATIVE, onChange: () => { defaultCacheFn(EXPIRY_KEY) }, criteria: () => { - return userLicensing.warnUserLimit + return userLicensing.errUserLimit }, - message: `${capitalise( - userLicensing.license.plan.type - )} plan changes - Users will be limited to ${ - userLicensing.userLimit - } users in ${userLicensing.userLimitDays}`, + message: "Your Budibase account is de-activated. Upgrade your plan", ...{ - extraButtonText: "Find out more", + extraButtonText: "View plans", extraButtonAction: () => { defaultCacheFn(ExpiringKeys.LICENSING_USERS_ABOVE_LIMIT_BANNER) - window.location.href = "/builder/portal/users/users" + window.location.href = "https://budibase.com/pricing/" }, }, showCloseButton: true, diff --git a/packages/builder/src/components/start/AppRow.svelte b/packages/builder/src/components/start/AppRow.svelte index 34d083a096..194f897fdc 100644 --- a/packages/builder/src/components/start/AppRow.svelte +++ b/packages/builder/src/components/start/AppRow.svelte @@ -6,6 +6,8 @@ export let app + export let lockedAction + const handleDefaultClick = () => { if (window.innerWidth < 640) { goToOverview() @@ -29,7 +31,7 @@ } -
+
@@ -58,8 +60,11 @@
- - + +
diff --git a/packages/builder/src/pages/builder/apps/index.svelte b/packages/builder/src/pages/builder/apps/index.svelte index 23f4df5bb5..4b77671345 100644 --- a/packages/builder/src/pages/builder/apps/index.svelte +++ b/packages/builder/src/pages/builder/apps/index.svelte @@ -133,7 +133,7 @@ - {#if $licensing.usageMetrics?.dayPasses >= 100} + {#if $licensing.usageMetrics?.dayPasses >= 100 || $licensing.errUserLimit}
spaceman diff --git a/packages/builder/src/pages/builder/portal/apps/index.svelte b/packages/builder/src/pages/builder/portal/apps/index.svelte index 783cac49d7..ce1c249087 100644 --- a/packages/builder/src/pages/builder/portal/apps/index.svelte +++ b/packages/builder/src/pages/builder/portal/apps/index.svelte @@ -14,6 +14,7 @@ import Spinner from "components/common/Spinner.svelte" import CreateAppModal from "components/start/CreateAppModal.svelte" import AppLimitModal from "components/portal/licensing/AppLimitModal.svelte" + import AccountLockedModal from "components/portal/licensing/AccountLockedModal.svelte" import { store, automationStore } from "builderStore" import { API } from "api" @@ -28,6 +29,7 @@ let template let creationModal let appLimitModal + let accountLockedModal let creatingApp = false let searchTerm = "" let creatingFromTemplate = false @@ -48,6 +50,11 @@ : true) ) $: automationErrors = getAutomationErrors(enrichedApps) + $: isOwner = $auth.accountPortalAccess && $admin.cloud + + const usersLimitLockAction = $licensing?.errUserLimit + ? () => accountLockedModal.show() + : null const enrichApps = (apps, user, sortBy) => { const enrichedApps = apps.map(app => ({ @@ -189,6 +196,9 @@ creatingFromTemplate = true createAppFromTemplateUrl(initInfo.init_template) } + if (usersLimitLockAction) { + usersLimitLockAction() + } } catch (error) { notifications.error("Error getting init info") } @@ -230,20 +240,30 @@
- {#if $apps?.length > 0} {/if} {#if !$apps?.length} - {/if} @@ -267,7 +287,7 @@
{#each filteredApps as app (app.appId)} - + {/each}
@@ -294,6 +314,11 @@ + + isOwner ? $licensing.goToUpgradePage() : $licensing.goToPricingPage()} +/>