From 8131d9dc6feb520fb7223bf9aa9eb9abf93d667d Mon Sep 17 00:00:00 2001 From: Dean Date: Mon, 27 Mar 2023 15:17:14 +0100 Subject: [PATCH] Branding feature flag changes, config trimming and some fixes --- .../builder/src/pages/builder/Branding.svelte | 2 +- .../builder/portal/settings/branding.svelte | 55 ++++++++++++------- .../builder/src/stores/portal/licensing.js | 6 +- packages/frontend-core/src/constants.js | 1 + packages/types/src/sdk/licensing/feature.ts | 1 + 5 files changed, 44 insertions(+), 21 deletions(-) diff --git a/packages/builder/src/pages/builder/Branding.svelte b/packages/builder/src/pages/builder/Branding.svelte index 4e737054d8..106b7574fc 100644 --- a/packages/builder/src/pages/builder/Branding.svelte +++ b/packages/builder/src/pages/builder/Branding.svelte @@ -8,7 +8,7 @@ $: platformTitleText = $organisation.platformTitle $: platformTitleText, (platformTitle = - !$admin.isCloud && !$auth.user ? platformTitleText : "Budibase") + !$auth.user && platformTitleText ? platformTitleText : "Budibase") $: faviconUrl = $organisation.faviconUrl || "https://i.imgur.com/Xhdt1YP.png" diff --git a/packages/builder/src/pages/builder/portal/settings/branding.svelte b/packages/builder/src/pages/builder/portal/settings/branding.svelte index fd003aecc9..3a99373e65 100644 --- a/packages/builder/src/pages/builder/portal/settings/branding.svelte +++ b/packages/builder/src/pages/builder/portal/settings/branding.svelte @@ -47,12 +47,8 @@ $: onConfigUpdate(config, mounted) $: init = Object.keys(config).length > 0 - $: cloudPremium = !$licensing.isFreePlan - $: selfhostPremium = $licensing.isEnterprisePlan || $licensing.isBusinessPlan $: isCloud = $admin.cloud - - $: isLicenseLocked = - (isCloud && !cloudPremium) || (!isCloud && !selfhostPremium) + $: brandingEnabled = $licensing.brandingEnabled const onConfigUpdate = () => { if (!mounted || updated || !init) { @@ -152,6 +148,27 @@ faviconPreview = null } } + + // Trim + const userStrings = [ + "metaTitle", + "platformTitle", + "loginButton", + "loginHeading", + "metaDescription", + "metaImageUrl", + ] + + const trimmed = userStrings.reduce((acc, fieldName) => { + acc[fieldName] = config[fieldName] ? config[fieldName].trim() : undefined + return acc + }, {}) + + config = { + ...config, + ...trimmed, + } + try { // Update settings await organisation.save(config) @@ -190,12 +207,12 @@
Branding - {#if !isCloud && !selfhostPremium} + {#if !isCloud && !brandingEnabled} Business {/if} - {#if isCloud && !cloudPremium} + {#if isCloud && !brandingEnabled} Pro @@ -226,7 +243,7 @@ config = clone }} value={logoFile || logo} - disabled={isLicenseLocked || saving} + disabled={!brandingEnabled || saving} allowClear={true} />
@@ -251,7 +268,7 @@ config = clone }} value={faviconFile || favicon} - disabled={isLicenseLocked || saving} + disabled={!brandingEnabled || saving} allowClear={true} /> @@ -265,7 +282,7 @@ config = clone }} value={config.platformTitle || ""} - disabled={!selfhostPremium || saving} + disabled={!brandingEnabled || saving} /> {/if} @@ -278,7 +295,7 @@ config = clone }} value={!config.emailBrandingEnabled} - disabled={isLicenseLocked || saving} + disabled={!brandingEnabled || saving} /> @@ -300,7 +317,7 @@ config = clone }} value={config.loginHeading || ""} - disabled={!selfhostPremium || saving} + disabled={!brandingEnabled || saving} /> @@ -313,7 +330,7 @@ config = clone }} value={config.loginButton || ""} - disabled={!selfhostPremium || saving} + disabled={!brandingEnabled || saving} />
@@ -325,7 +342,7 @@ config = clone }} value={!config.testimonialsEnabled} - disabled={!selfhostPremium || saving} + disabled={!brandingEnabled || saving} />
@@ -357,7 +374,7 @@ config = clone }} value={config.metaImageUrl} - disabled={isLicenseLocked || saving} + disabled={!brandingEnabled || saving} />
@@ -369,7 +386,7 @@ config = clone }} value={config.metaTitle} - disabled={isLicenseLocked || saving} + disabled={!brandingEnabled || saving} />
@@ -381,13 +398,13 @@ config = clone }} value={config.metaDescription} - disabled={isLicenseLocked || saving} + disabled={!brandingEnabled || saving} />
- {#if isLicenseLocked} + {#if !brandingEnabled}