-
Notifications
You must be signed in to change notification settings - Fork 32
Description
Info
We have four entities that can be restricted to a premium feature:
- Tabs
- Groups (Accordion, Group)
- Input Fields
- Input Field options (Checkbox, Chips, Dropdown, Select)
Please take note, that Accordion and Group are currently not used, since they have been replaced by the new Tabs field (while theoretically they could be used inside of a tab). Additionally, Chips and Dropdown will probably be replaced by the generic Select field in the future.
Suggestion
I suggest a requires entry, which supports several types of requirements that can be fulfilled, e.g.
{
"requires": {
"pro-subscription": true,
"sku-id": "<sku-id>"
}
}This entry will be supported by every input field and every option of an input field with multiple options (except the Platforms field). If multiple requirements are given, only one of them suffices to unlock the feature. This avoids locking features behind multiple conditions, but allows unlocking a feature by different means.
Tabs
[
{
"id": "tabs",
"type": "tabs",
"tabs": [
{
"label": "Font Settings",
"requires": {
"pro-subscription": true
},
"fields": [
{
"id": "font-settings",
"type": "font-settings"
}
]
}
]
}
]Groups
{
"id": "accordion",
"type": "accordion",
"requires": {
"pro-subscription": true
},
"fields": []
}Input Fields
{
"id": "font-settings",
"type": "font-settings",
"requires": {
"pro-subscription": true
},
"attributes": {
"value": {}
}
}Input Field Options
{
"id": "select",
"type": "select",
"options": [
{
"label": "Free Option",
"value": "free-option"
},
{
"label": "Paid Option",
"value": "paid-option",
"requires": {
"pro-subscription": true
}
}
]
}Restricting the scene
To enable a smooth transition between paid and non-paid states, no validation is done when saving the scene. When retrieving the scene, the backend will check all extensions for premium values that deviate from their default state. If there are values that can not be satisfied by any of the requires entries, an additional restriction will be put on the scene and displayed in presenting mode.