Resolve stash merge conflicts: keep both inline-task and billing features

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
tusharmagar 2026-03-13 10:44:48 +05:30 committed by Ramnique Singh
parent e27a93d051
commit 27e8fe0f22
6 changed files with 117 additions and 0 deletions

View file

@ -0,0 +1,38 @@
import { getAccessToken } from '../models/gateway.js';
import { ROWBOAT_BILLING_BASE_URL } from '../config/env.js';
export interface BillingInfo {
subscriptionPlan: string | null;
subscriptionStatus: string | null;
trialUsed: boolean;
sanctionedCredits: number;
availableCredits: number;
}
export async function getBillingInfo(): Promise<BillingInfo> {
const accessToken = await getAccessToken();
const response = await fetch(`${ROWBOAT_BILLING_BASE_URL}/me`, {
headers: { Authorization: `Bearer ${accessToken}` },
});
if (!response.ok) {
throw new Error(`Billing API failed: ${response.status}`);
}
const body = await response.json() as {
customer: {
subscriptionPlan: string | null;
subscriptionStatus: string | null;
trialUsed: boolean;
};
usage: {
sanctionedCredits: number;
availableCredits: number;
};
};
return {
subscriptionPlan: body.customer.subscriptionPlan,
subscriptionStatus: body.customer.subscriptionStatus,
trialUsed: body.customer.trialUsed,
sanctionedCredits: body.usage.sanctionedCredits,
availableCredits: body.usage.availableCredits,
};
}

View file

@ -3,3 +3,6 @@ export const API_URL =
export const SUPABASE_PROJECT_URL =
process.env.SUPABASE_PROJECT_URL || 'http://127.0.0.1:54321';
export const ROWBOAT_BILLING_BASE_URL =
process.env.ROWBOAT_BILLING_BASE_URL || 'https://billing.staging.x.rowboatlabs.com';

View file

@ -516,6 +516,17 @@ const ipcSchemas = {
]).nullable(),
}),
},
// Billing channels
'billing:getInfo': {
req: z.null(),
res: z.object({
subscriptionPlan: z.string().nullable(),
subscriptionStatus: z.string().nullable(),
trialUsed: z.boolean(),
sanctionedCredits: z.number(),
availableCredits: z.number(),
}),
},
} as const;
// ============================================================================