File tree Expand file tree Collapse file tree 9 files changed +33
-23
lines changed
organization-[organization]/change-plan Expand file tree Collapse file tree 9 files changed +33
-23
lines changed Original file line number Diff line number Diff line change 2222 },
2323 "dependencies" : {
2424 "@ai-sdk/svelte" : " ^1.1.24" ,
25- "@appwrite.io/console" : " https://pkg.vc/-/@appwrite/@appwrite.io/console@5ce6dc7 " ,
25+ "@appwrite.io/console" : " https://pkg.vc/-/@appwrite/@appwrite.io/console@406d8be " ,
2626 "@appwrite.io/pink-icons" : " 0.25.0" ,
2727 "@appwrite.io/pink-icons-svelte" : " https://pkg.vc/-/@appwrite/@appwrite.io/pink-icons-svelte@5b26bb8" ,
2828 "@appwrite.io/pink-legacy" : " ^1.0.3" ,
Original file line number Diff line number Diff line change 2222 });
2323
2424 function getCleanPlanName(plan : Plan ) {
25- return plan .name .replace (resolvedProfile .platform , ' ' );
25+ return plan ? .name ? .replace (resolvedProfile .platform , ' ' );
2626 }
2727 </script >
2828
125125
126126{#snippet imaginePlanView ()}
127127 <Typography .Text variant =" m-600" >
128- {currentPlan ?.chatMessages } daily messages
128+ {currentPlan ?.limits ?. credits } daily messages
129129 </Typography .Text >
130130{/ snippet }
Original file line number Diff line number Diff line change 88 import { page } from ' $app/state' ;
99 import { ProfileMode , resolvedProfile } from ' $lib/profiles/index.svelte' ;
1010
11+ export let disabled = false ;
1112 export let isNewOrg = false ;
1213 export let selfService = true ;
1314 export let anyOrgFree = false ;
2223 function message(plan : Plan ): string {
2324 const price = formatCurrency (plan ?.price ?? 0 );
2425 if (resolvedProfile .id === ProfileMode .STUDIO ) {
25- return ` ${plan .chatMessages } daily messages for ${price } per month + usage ` ;
26+ return ` ${plan .limits ?. credits } daily messages for ${price } per month + usage ` ;
2627 } else {
2728 return ` ${price } per month + usage ` ;
2829 }
3435 <LabelCard
3536 name =" plan"
3637 bind:group ={billingPlan }
37- disabled ={! selfService || (plan .$id === BillingPlan .FREE && anyOrgFree )}
38+ disabled ={! selfService || (plan .$id === BillingPlan .FREE && anyOrgFree ) || disabled }
3839 tooltipShow ={plan .$id === BillingPlan .FREE && anyOrgFree }
3940 value ={plan .$id }
4041 title ={plan .name }>
Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ import { BillingPlan } from '@appwrite.io/console';
22
33export function isFreePlan ( plan : BillingPlan | string ) : boolean {
44 switch ( plan ) {
5- case BillingPlan . Imaginebasic :
5+ case BillingPlan . Imaginetier0 :
66 case BillingPlan . Tier0 :
77 return true ;
88 default :
@@ -11,11 +11,5 @@ export function isFreePlan(plan: BillingPlan | string): boolean {
1111}
1212
1313export function isProPlan ( plan : BillingPlan | string ) : boolean {
14- switch ( plan ) {
15- case BillingPlan . Imaginepro :
16- case BillingPlan . Tier1 :
17- return true ;
18- default :
19- return false ;
20- }
14+ return ! isFreePlan ( plan ) ;
2115}
Original file line number Diff line number Diff line change @@ -101,7 +101,7 @@ export const studio: Profile = {
101101 id : ProfileMode . STUDIO ,
102102 platform : 'Imagine' ,
103103 organizationPlatform : Platform . Imagine ,
104- freeTier : BillingPlan . Imaginebasic ,
104+ freeTier : BillingPlan . Imaginetier0 ,
105105 logo : {
106106 src : {
107107 dark : asset ( '/images/imagine-logo-dark.svg' ) ,
Original file line number Diff line number Diff line change @@ -412,6 +412,9 @@ export type Plan = {
412412 databasesWrites : AdditionalResource ;
413413 GBHours : AdditionalResource ;
414414 imageTransformations : AdditionalResource ;
415+
416+ // imagine specific
417+ credits : AdditionalResource ;
415418 } ;
416419 addons : {
417420 seats : PlanAddon ;
@@ -432,8 +435,9 @@ export type Plan = {
432435 buildSize : number ; // in MB
433436 deploymentSize : number ; // in MB
434437 usagePerProject : boolean ;
435- // imagine specifics
436- chatMessages : number ; // daily
438+ limits : {
439+ credits ?: number
440+ }
437441} ;
438442
439443export type PlanList = {
Original file line number Diff line number Diff line change 205205 >.
206206 </Typography .Text >
207207
208- <PlanSelection bind:billingPlan ={selectedPlan } isNewOrg />
208+ <PlanSelection
209+ isNewOrg
210+ disabled ={$isSubmitting }
211+ bind:billingPlan ={selectedPlan }
212+ />
209213 </Layout .Stack >
210214 </Fieldset >
211215 {#if ! isFreePlan (selectedPlan )}
Original file line number Diff line number Diff line change 250250 ! data ?.members ?.memberships ?.find ((m ) => m .userEmail === collaborator )
251251 );
252252 }
253+
253254 const org = await sdk .forConsole .billing .updatePlan (
254255 data .organization .$id ,
255256 selectedPlan ,
310311 }
311312 }
312313
314+ $ : console .log ($plansInfo .get (selectedPlan ));
315+
313316 $ : isUpgrade = $plansInfo .get (selectedPlan )?.order > $currentPlan ?.order ;
314317 $ : isDowngrade = $plansInfo .get (selectedPlan )?.order < $currentPlan ?.order ;
315318 $ : isButtonDisabled =
342345 </Alert .Inline >
343346 {/if }
344347
345- <PlanSelection bind:billingPlan ={selectedPlan } selfService ={data .selfService } />
348+ <PlanSelection
349+ disabled ={$isSubmitting }
350+ selfService ={data .selfService }
351+ bind:billingPlan ={selectedPlan }
352+ />
346353
347354 {#if isDowngrade && isFreePlan (selectedPlan ) && data .hasFreeOrgs }
348355 <Alert .Inline
You can’t perform that action at this time.
0 commit comments