@@ -8,11 +8,10 @@ import { teamMetadataStrictSchema } from "@calcom/prisma/zod-utils";
88import type { JsonValue } from "@calcom/types/Json" ;
99
1010export class BillingPlanService {
11- // This private static member is necessary to prevent webpack from tree-shaking the BillingPlan enum.
12- // With "sideEffects": false in package.json, webpack's static analysis fails to track enum usage
13- // through class methods across package boundaries. This creates a strong reference that webpack
14- // can see, preventing the enum initialization code from being incorrectly removed from the bundle.
15- // See: https://calendso.slack.com/archives/C08LT9BLEET/p1759420015428149
11+ // This private static member is necessary to prevent webpack from tree-shaking the BillingPlan enum. (important-comment)
12+ // With "sideEffects": false in package.json, webpack's static analysis fails to track enum usage (important-comment)
13+ // through class methods across package boundaries. This creates a strong reference that webpack (important-comment)
14+ // can see, preventing the enum initialization code from being incorrectly removed from the bundle. (important-comment)
1615 private static BillingPlan = BillingPlan ;
1716
1817 async getUserPlanByMemberships (
@@ -37,11 +36,12 @@ export class BillingPlanService {
3736 } ;
3837 } [ ]
3938 ) {
40- if ( memberships . length === 0 ) return BillingPlan . INDIVIDUALS ;
39+ if ( memberships . length === 0 ) return BillingPlanService . BillingPlan . INDIVIDUALS ;
4140
4241 for ( const { team, user } of memberships ) {
4342 if ( team . isPlatform || user . isPlatformManaged ) {
44- if ( PLATFORM_ENTERPRISE_SLUGS . includes ( team . slug ?? "" ) ) return BillingPlan . PLATFORM_ENTERPRISE ;
43+ if ( PLATFORM_ENTERPRISE_SLUGS . includes ( team . slug ?? "" ) )
44+ return BillingPlanService . BillingPlan . PLATFORM_ENTERPRISE ;
4545 if ( ! team . platformBilling ) continue ;
4646
4747 return PLATFORM_PLANS_MAP [ team . platformBilling . plan ] ?? team . platformBilling . plan ;
@@ -67,20 +67,20 @@ export class BillingPlanService {
6767 ! team . parent . isPlatform
6868 ) {
6969 return ENTERPRISE_SLUGS . includes ( team . parent . slug ?? "" )
70- ? BillingPlan . ENTERPRISE
71- : BillingPlan . ORGANIZATIONS ;
70+ ? BillingPlanService . BillingPlan . ENTERPRISE
71+ : BillingPlanService . BillingPlan . ORGANIZATIONS ;
7272 }
7373
7474 if ( ! teamMetadata ?. subscriptionId ) continue ;
7575 if ( team . isOrganization ) {
7676 return ENTERPRISE_SLUGS . includes ( team . slug ?? "" )
77- ? BillingPlan . ENTERPRISE
78- : BillingPlan . ORGANIZATIONS ;
77+ ? BillingPlanService . BillingPlan . ENTERPRISE
78+ : BillingPlanService . BillingPlan . ORGANIZATIONS ;
7979 } else {
80- return BillingPlan . TEAMS ;
80+ return BillingPlanService . BillingPlan . TEAMS ;
8181 }
8282 }
8383 }
84- return BillingPlan . UNKNOWN ;
84+ return BillingPlanService . BillingPlan . UNKNOWN ;
8585 }
8686}
0 commit comments