Add ability to paywall component settings

This commit is contained in:
Andrew Kingston 2024-04-04 16:21:17 +01:00
parent af0e9cf4d3
commit f83e6a2e12
4 changed files with 35 additions and 2 deletions

View File

@ -1,4 +1,6 @@
import { Checkbox, Select, RadioGroup, Stepper, Input } from "@budibase/bbui" import { Checkbox, Select, RadioGroup, Stepper, Input } from "@budibase/bbui"
import { licensing } from "stores/portal"
import { get } from "svelte/store"
import DataSourceSelect from "./controls/DataSourceSelect/DataSourceSelect.svelte" import DataSourceSelect from "./controls/DataSourceSelect/DataSourceSelect.svelte"
import S3DataSourceSelect from "./controls/S3DataSourceSelect.svelte" import S3DataSourceSelect from "./controls/S3DataSourceSelect.svelte"
import DataProviderSelect from "./controls/DataProviderSelect.svelte" import DataProviderSelect from "./controls/DataProviderSelect.svelte"
@ -26,7 +28,8 @@ import FieldConfiguration from "./controls/FieldConfiguration/FieldConfiguration
import ButtonConfiguration from "./controls/ButtonConfiguration/ButtonConfiguration.svelte" import ButtonConfiguration from "./controls/ButtonConfiguration/ButtonConfiguration.svelte"
import RelationshipFilterEditor from "./controls/RelationshipFilterEditor.svelte" import RelationshipFilterEditor from "./controls/RelationshipFilterEditor.svelte"
import FormStepConfiguration from "./controls/FormStepConfiguration.svelte" import FormStepConfiguration from "./controls/FormStepConfiguration.svelte"
import FormStepControls from "components/design/settings/controls/FormStepControls.svelte" import FormStepControls from "./controls/FormStepControls.svelte"
import PaywalledSetting from "./controls/PaywalledSetting.svelte"
const componentMap = { const componentMap = {
text: DrawerBindableInput, text: DrawerBindableInput,
@ -86,11 +89,16 @@ const componentMap = {
} }
export const getComponentForSetting = setting => { export const getComponentForSetting = setting => {
const { type, showInBar, barStyle } = setting || {} const { type, showInBar, barStyle, license } = setting || {}
if (!type) { if (!type) {
return null return null
} }
// Check for paywalled settings
if (license && get(licensing).isFreePlan) {
return PaywalledSetting
}
// We can show a clone of the bar settings for certain select settings // We can show a clone of the bar settings for certain select settings
if (showInBar && type === "select" && barStyle === "buttons") { if (showInBar && type === "select" && barStyle === "buttons") {
return BarButtonList return BarButtonList

View File

@ -0,0 +1,23 @@
<script>
import { Tag, Tags } from "@budibase/bbui"
import { getFormattedPlanName } from "helpers/planTitle"
export let license
$: title = getFormattedPlanName(license)
</script>
<div>
<Tags>
<Tag icon="LockClosed">{title}</Tag>
</Tags>
</div>
<style>
div {
height: 32px;
display: flex;
flex-direction: column;
justify-content: center;
}
</style>

View File

@ -183,6 +183,7 @@
props={{ props={{
// Generic settings // Generic settings
placeholder: setting.placeholder || null, placeholder: setting.placeholder || null,
license: setting.license,
// Select settings // Select settings
options: setting.options || [], options: setting.options || [],

View File

@ -4614,6 +4614,7 @@
"type": "select", "type": "select",
"label": "Auto-refresh", "label": "Auto-refresh",
"key": "autoRefresh", "key": "autoRefresh",
"license": "premium",
"placeholder": "Never", "placeholder": "Never",
"options": [ "options": [
{ {