Files
calendar/packages/features/ee/billing/di/modules/SeatBillingStrategyFactory.module.ts
T
sean-brydonGitHubunknown <>unknown <>sean@cal.com <Sean@brydon.io>Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
d52e2d9fad feat: active user billing (#27867)
* factory and statergie

* chore: use correct method of DI

* feat: add onchagne

* add logic to HWM stat

* add webhook resolver methods to each statergy

* move seat tracking + webhooks over to own statergy

* Move to factory base approach

* move logic to correct class

* rename create -> createByTeamId

* fix: remove debug `true ||` overrides from IS_STRIPE_ENABLED and IS_TEAM_BILLING_ENABLED

Remove accidentally committed debug overrides that short-circuited
IS_STRIPE_ENABLED and IS_TEAM_BILLING_ENABLED to always be true,
bypassing Stripe credential checks. This would break self-hosted
instances without Stripe configured.

Identified by cubic (https://cubic.dev)

Co-Authored-By: unknown <>

* feat: active user billing

* add tests

* UI side for users on active billing

* use correct period of stripe sub

* feat: claude feedback

* fix: skip Stripe sync for canceled/expired subscriptions to prevent repeated API calls

Co-Authored-By: unknown <>

* feat: feedback

* feat: only render when active users mode is set

* fix type error

* fix: constants + feature flags

* fix: default to null in tests

* chore: use seats in test

* fix: use node:crypto protocol for Node.js builtin imports

Co-Authored-By: sean@cal.com <Sean@brydon.io>

---------

Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-02-12 13:57:32 +00:00

44 lines
1.9 KiB
TypeScript

import {
bindModuleToClassOnToken,
createModule,
type ModuleLoader,
} from "@calcom/features/di/di";
import { moduleLoader as featuresRepositoryModuleLoader } from "@calcom/features/di/modules/FeaturesRepository";
import { moduleLoader as activeUserBillingServiceModuleLoader } from "@calcom/features/ee/billing/active-user/di/ActiveUserBillingService.module";
import { SeatBillingStrategyFactory } from "@calcom/features/ee/billing/service/seatBillingStrategy/SeatBillingStrategyFactory";
import { DI_TOKENS } from "../tokens";
import { billingPeriodServiceModuleLoader } from "./BillingPeriodService.module";
import { billingProviderServiceModuleLoader } from "./BillingProviderService";
import { highWaterMarkRepositoryModuleLoader } from "./HighWaterMarkRepository";
import { highWaterMarkServiceModuleLoader } from "./HighWaterMarkService";
import { monthlyProrationServiceModuleLoader } from "./MonthlyProrationService";
import { teamBillingDataRepositoryModuleLoader } from "./TeamBillingDataRepositoryFactory";
const thisModule = createModule();
const token = DI_TOKENS.SEAT_BILLING_STRATEGY_FACTORY;
const moduleToken = DI_TOKENS.SEAT_BILLING_STRATEGY_FACTORY_MODULE;
const loadModule = bindModuleToClassOnToken({
module: thisModule,
moduleToken,
token,
classs: SeatBillingStrategyFactory,
depsMap: {
billingPeriodService: billingPeriodServiceModuleLoader,
featuresRepository: featuresRepositoryModuleLoader,
billingProviderService: billingProviderServiceModuleLoader,
highWaterMarkRepository: highWaterMarkRepositoryModuleLoader,
highWaterMarkService: highWaterMarkServiceModuleLoader,
monthlyProrationService: monthlyProrationServiceModuleLoader,
teamBillingDataRepository: teamBillingDataRepositoryModuleLoader,
activeUserBillingService: activeUserBillingServiceModuleLoader,
},
});
export const seatBillingStrategyFactoryModuleLoader: ModuleLoader = {
token,
loadModule,
};
export type { SeatBillingStrategyFactory };