mirror of
https://github.com/rowboatlabs/rowboat.git
synced 2026-06-03 19:25:19 +02:00
- update billing contract to consume split monthly/daily usage - show monthly and daily credit percentage bars in account settings - keep sidebar plan labels normalized - update out-of-credits copy for daily credits
24 lines
806 B
TypeScript
24 lines
806 B
TypeScript
import { z } from 'zod';
|
|
|
|
export const BillingPlanSchema = z.enum(['free', 'starter', 'pro']);
|
|
export type BillingPlan = z.infer<typeof BillingPlanSchema>;
|
|
|
|
export const BillingUsageBucketSchema = z.object({
|
|
sanctionedCredits: z.number(),
|
|
usedCredits: z.number(),
|
|
availableCredits: z.number(),
|
|
});
|
|
export type BillingUsageBucket = z.infer<typeof BillingUsageBucketSchema>;
|
|
|
|
export const BillingInfoSchema = z.object({
|
|
userEmail: z.string().nullable(),
|
|
userId: z.string().nullable(),
|
|
subscriptionPlan: BillingPlanSchema.nullable(),
|
|
subscriptionStatus: z.string().nullable(),
|
|
trialExpiresAt: z.string().nullable(),
|
|
monthly: BillingUsageBucketSchema,
|
|
daily: BillingUsageBucketSchema.extend({
|
|
usageDay: z.string(),
|
|
}),
|
|
});
|
|
export type BillingInfo = z.infer<typeof BillingInfoSchema>;
|