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