Skip to content

Conversation

julienbourdeau
Copy link
Contributor

@julienbourdeau julienbourdeau commented Jul 18, 2025

How to use

This is a little different from the API endpoints because I think our apps has different need.

I expect the subscription view to do a few thing:

  1. get all entitlements from the subscription plan
  2. get the subscription entitlements (to be discussed if this should be part of the SubscriptionObject)
  3. merge the two list by:
  4. removing features of the subscription entitlements has removed: true
  5. adding features from subscription of not in plan entitlements
  6. override values if feature is in both

I believe the frontend needs a way to:

  • show the default plan value
  • highlight that a feature is supposed to be available but was removed specifically for this sub
    • and a way to undo the removal
  • highlight that a feature was added specifically for this sub

This complexity is exactly why the db view exists in #4022 so we can easily retrieve the complete data.

Payload Examples

Plan entitlements

[
    {
        "code": "seats",
        "name": "Feature Name",
        "description": "Feature Description",
        "privileges":
        [
            {
                "code": "max",
                "value": "10",
                "name": null,
                "valueType": "integer",
                "config":
                {}
            }
        ]
    },
    {
        "code": "support",
        "name": "Premium Support",
        "description": null,
        "privileges": []
    },
    {
        "code": "salesforce",
        "name": "Salesforce Integration",
        "description": null,
        "privileges": []
    }
]

Subscription entitlements

[
    {
        "code": "seats",
        "name": "Feature Name",
        "description": "Feature Description",
        "removed": false,
        "privileges":
        [
            {
                "code": "max",
                "value": "25",
                "name": null,
                "valueType": "integer",
                "config": {}
            },
            {
                "code": "max_admin",
                "value": "2",
                "name": null,
                "valueType": "integer",
                "config": {}
            }
        ]
    },
    {
        "code": "mcp",
        "name": "MCP Server",
        "description": null,
        "removed": false,
        "privileges": []
    },
    {
        "code": "salesforce",
        "name": "Salesforce Integration",
        "description": null,
        "removed": true,
        "privileges": []
    }
]

Expected merged list to display

  • seats.max value is added overridden
  • seats.max_admin is added
  • salesforce is removed
  • mcp is added
[
    {
        "code": "seats",
        "name": "Feature Name",
        "description": "Feature Description",
        "privileges":
        [
            {
                "code": "max",
                "value": "25",
                "name": null,
                "valueType": "integer",
                "config": {}
            },
            {
                "code": "max_admin",
                "value": "2",
                "name": null,
                "valueType": "integer",
                "config": {}
            }
        ]
    },
    {
        "code": "support",
        "name": "Premium Support",
        "description": null,
        "privileges": []
    },
    {
        "code": "mcp",
        "name": "MCP Server",
        "description": null,
        "privileges": []
    }
]

@julienbourdeau
Copy link
Contributor Author

Let's keep this for future reference

julienbourdeau added a commit that referenced this pull request Jul 25, 2025
…#4029)

Simplified version of #4024

Entitlements are a new field on subscriptions

### Payload

```json
[
    {
        "code": "seats",
        "name": "Feature Name",
        "description": "Feature Description",
        "privileges":
        [
            {
                "code": "max",
                "name": null,
                "valueType": "string",
                "value": "100",
                "planValue": "100",
                "overrideValue": null
            },
            {
                "code": "max_admins",
                "name": null,
                "valueType": "string",
                "value": "12",
                "planValue": "5",
                "overrideValue": "12"
            }
        ]
    },
    {
        "code": "api",
        "name": "Feature Name",
        "description": "Feature Description",
        "privileges": []
    },
    {
        "code": "storage",
        "name": "Feature Name",
        "description": "Feature Description",
        "privileges": []
    }
]
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant