feat: allow feature plan map in super admin (#9318)

- Add subscribed_features method in models/enterprise/account and include it in the JSON response
This commit is contained in:
Shivam Mishra
2024-05-09 11:28:46 +05:30
committed by GitHub
parent 4eec0aa11a
commit eff24c0d71
5 changed files with 59 additions and 0 deletions

View File

@@ -6,8 +6,19 @@ module Enterprise::Account
}
end
def subscribed_features
plan_features = InstallationConfig.find_by(name: 'CHATWOOT_CLOUD_PLAN_FEATURES')&.value
return [] if plan_features.blank?
plan_features[plan_name]
end
private
def plan_name
custom_attributes['plan_name']
end
def agent_limits
subscribed_quantity = custom_attributes['subscribed_quantity']
subscribed_quantity || get_limits(:agents)