Gate and meter email group: enterprise license (self-host) + credits (cloud) (#22390)
Email group (marketing email) was gated only by the `IS_EMAIL_GROUP_ENABLED` feature flag with no server-side enforcement. This adds real gating, split by deployment: - **Self-hosted** (`IS_BILLING_ENABLED=false`): requires a valid Enterprise plan. - **Cloud** (billing enabled): metered by credits, mirroring the existing AI credit system. Priced on AWS SES cost ($0.10/1,000 outbound) × 3 margin = $0.30/1,000 (300 micro-credits/email). Pre-flight blocks sends when out of credits; each email is charged after SES accepts it, in the async send job — matching how AWS bills us (no refund on bounce). Enforcement is applied at every email group resolver, and denials surface as proper client errors through a dedicated GraphQL exception filter.
This commit is contained in:
+1
@@ -22,6 +22,7 @@ const USAGE_UNIT_BY_OPERATION_TYPE: Record<UsageOperationType, UsageUnit> = {
|
||||
[UsageOperationType.CODE_EXECUTION]: UsageUnit.INVOCATION,
|
||||
[UsageOperationType.WEB_SEARCH]: UsageUnit.INVOCATION,
|
||||
[UsageOperationType.CALL_RECORDING]: UsageUnit.MINUTE,
|
||||
[UsageOperationType.EMAIL_SEND]: UsageUnit.INVOCATION,
|
||||
};
|
||||
|
||||
// `workspaceId` + `applicationId` come from the application-access token,
|
||||
|
||||
Reference in New Issue
Block a user