@@ -26,6 +26,8 @@ import TeamUsageBasedBilling from "./TeamUsageBasedBilling";
26
26
import { UserContext } from "../user-context" ;
27
27
import { FeatureFlagContext } from "../contexts/FeatureFlagContext" ;
28
28
import { publicApiTeamMembersToProtocol , teamsService } from "../service/public-api" ;
29
+ import Alert from "../components/Alert" ;
30
+ import { getExperimentsClient } from "../experiments/client" ;
29
31
30
32
type PendingPlan = Plan & { pendingSince : number } ;
31
33
@@ -38,6 +40,7 @@ export default function TeamBilling() {
38
40
const [ isUserOwner , setIsUserOwner ] = useState ( true ) ;
39
41
const [ teamSubscription , setTeamSubscription ] = useState < TeamSubscription2 | undefined > ( ) ;
40
42
const { currency, setCurrency } = useContext ( PaymentContext ) ;
43
+ const [ isUsageBasedBillingEnabled , setIsUsageBasedBillingEnabled ] = useState < boolean > ( false ) ;
41
44
const [ teamBillingMode , setTeamBillingMode ] = useState < BillingMode | undefined > ( undefined ) ;
42
45
const [ pendingTeamPlan , setPendingTeamPlan ] = useState < PendingPlan | undefined > ( ) ;
43
46
const [ pollTeamSubscriptionTimeout , setPollTeamSubscriptionTimeout ] = useState < NodeJS . Timeout | undefined > ( ) ;
@@ -114,6 +117,20 @@ export default function TeamBilling() {
114
117
} ;
115
118
} , [ pendingTeamPlan , pollTeamSubscriptionTimeout , team , teamSubscription ] ) ;
116
119
120
+ useEffect ( ( ) => {
121
+ if ( ! team || ! user ) {
122
+ return ;
123
+ }
124
+ ( async ( ) => {
125
+ const isEnabled = await getExperimentsClient ( ) . getValueAsync ( "isUsageBasedBillingEnabled" , false , {
126
+ user,
127
+ teamId : team . id ,
128
+ teamName : team . name ,
129
+ } ) ;
130
+ setIsUsageBasedBillingEnabled ( isEnabled ) ;
131
+ } ) ( ) ;
132
+ } , [ team , user ] ) ;
133
+
117
134
const availableTeamPlans = Plans . getAvailableTeamPlans ( currency || "USD" ) . filter ( ( p ) => p . type !== "student" ) ;
118
135
119
136
const checkout = async ( plan : Plan ) => {
@@ -161,6 +178,20 @@ export default function TeamBilling() {
161
178
function renderTeamBilling ( ) : JSX . Element {
162
179
return (
163
180
< >
181
+ { isUsageBasedBillingEnabled && (
182
+ < Alert type = "message" className = "mb-4" >
183
+ To access{ " " }
184
+ < a className = "gp-link" href = "https://www.gitpod.io/docs/configure/workspaces/workspace-classes" >
185
+ large workspaces
186
+ </ a > { " " }
187
+ and{ " " }
188
+ < a className = "gp-link" href = "https://www.gitpod.io/docs/configure/billing/pay-as-you-go" >
189
+ pay-as-you-go
190
+ </ a >
191
+ , first cancel your existing plan. Existing plans will keep working until the end of March,
192
+ 2023.
193
+ </ Alert >
194
+ ) }
164
195
< h3 > { ! teamPlan ? "Select Team Plan" : "Team Plan" } </ h3 >
165
196
< h2 className = "text-gray-500" >
166
197
{ ! teamPlan ? (
0 commit comments