1
0
Fork 0
mirror of synced 2024-09-25 13:51:40 +12:00

Fix logic, enterprise is the only tier that can use this

This commit is contained in:
Conor Webb 2024-08-13 12:39:56 +01:00
parent bd5789f59c
commit 9a6a1abb84

View file

@ -24,6 +24,7 @@
const dispatch = createEventDispatcher() const dispatch = createEventDispatcher()
const RemoveID = "remove" const RemoveID = "remove"
const subType = $licensing.license.plan.type
$: enrichLabel = label => (labelPrefix ? `${labelPrefix} ${label}` : label) $: enrichLabel = label => (labelPrefix ? `${labelPrefix} ${label}` : label)
$: options = getOptions( $: options = getOptions(
@ -68,13 +69,19 @@
})) }))
// Add creator if required // Add creator if required
if (allowCreator) { if (
allowCreator ||
subType === Constants.PlanType.ENTERPRISE ||
subType === Constants.PlanType.ENTERPRISE_BASIC
) {
options.unshift({ options.unshift({
_id: Constants.Roles.CREATOR, _id: Constants.Roles.CREATOR,
name: "Can edit", name: "Can edit",
tag: tag:
!$licensing.perAppBuildersEnabled && subType === Constants.PlanType.ENTERPRISE ||
capitalise(Constants.PlanType.ENTERPRISE), subType === Constants.PlanType.ENTERPRISE_BASIC
? null
: capitalise(Constants.PlanType.ENTERPRISE),
}) })
} }
@ -134,9 +141,16 @@
getOptionValue={role => role._id} getOptionValue={role => role._id}
getOptionColour={getColor} getOptionColour={getColor}
getOptionIcon={getIcon} getOptionIcon={getIcon}
isOptionEnabled={option => isOptionEnabled={option => {
option._id !== Constants.Roles.CREATOR || if (option._id === Constants.Roles.CREATOR) {
$licensing.perAppBuildersEnabled} return (
subType === Constants.PlanType.ENTERPRISE ||
(subType === Constants.PlanType.ENTERPRISE_BASIC_TRIAL &&
$licensing.perAppBuildersEnabled)
)
}
return true
}}
{placeholder} {placeholder}
{error} {error}
/> />
@ -154,10 +168,16 @@
getOptionValue={role => role._id} getOptionValue={role => role._id}
getOptionColour={getColor} getOptionColour={getColor}
getOptionIcon={getIcon} getOptionIcon={getIcon}
isOptionEnabled={option => isOptionEnabled={option => {
(option._id !== Constants.Roles.CREATOR || if (option._id === Constants.Roles.CREATOR) {
$licensing.perAppBuildersEnabled) && return (
option.enabled !== false} subType === Constants.PlanType.ENTERPRISE ||
(subType === Constants.PlanType.ENTERPRISE_BASIC_TRIAL &&
$licensing.perAppBuildersEnabled)
)
}
return option.enabled !== false
}}
{placeholder} {placeholder}
{error} {error}
/> />