Add billing error handling and UI updates

- Introduced billing error patterns to match specific error messages and display appropriate user prompts in the ChatSidebar.
- Enhanced SidebarContentPanel and AccountSettings components to reflect subscription status, including trial expiration details.
- Updated button actions to direct users to the app URL for subscription management and upgrades.
- Added a new Payment section in AccountSettings for managing invoices and payment methods, with conditional rendering based on subscription status.
This commit is contained in:
tusharmagar 2026-04-07 21:51:17 +05:30
parent 2739de6c67
commit 75ffbc781c
6 changed files with 126 additions and 11 deletions

View file

@ -6,6 +6,7 @@ export interface BillingInfo {
userId: string | null;
subscriptionPlan: string | null;
subscriptionStatus: string | null;
trialExpiresAt: string | null;
sanctionedCredits: number;
availableCredits: number;
}
@ -26,6 +27,7 @@ export async function getBillingInfo(): Promise<BillingInfo> {
billing: {
plan: string | null;
status: string | null;
trialExpiresAt: string | null;
usage: {
sanctionedCredits: number;
availableCredits: number;
@ -37,6 +39,7 @@ export async function getBillingInfo(): Promise<BillingInfo> {
userId: body.user.id ?? null,
subscriptionPlan: body.billing.plan,
subscriptionStatus: body.billing.status,
trialExpiresAt: body.billing.trialExpiresAt ?? null,
sanctionedCredits: body.billing.usage.sanctionedCredits,
availableCredits: body.billing.usage.availableCredits,
};