Desktop connection SaaS: config, billing, team support (#5768)

Co-authored-by: James Brunton <[email protected]>
Co-authored-by: James Brunton <[email protected]>
This commit is contained in:
ConnorYoh
2026-02-25 14:13:07 +00:00
committed by GitHub
co-authored by James Brunton James Brunton
parent 86072ec91a
commit 5c39acecd8
76 changed files with 6231 additions and 119 deletions
+59
View File
@@ -0,0 +1,59 @@
/**
* Billing Configuration for Desktop
* Single source of truth for billing-related constants
*/
export const BILLING_CONFIG = {
// Credits included in Free plan (per month)
FREE_CREDITS_PER_MONTH: 50,
// Credits included in Pro plan (per month)
INCLUDED_CREDITS_PER_MONTH: 500,
// Overage pricing (per credit) - also fetched dynamically from Stripe
OVERAGE_PRICE_PER_CREDIT: 0.05,
// Credit warning threshold
LOW_CREDIT_THRESHOLD: 10,
// Stripe lookup keys
PRO_PLAN_LOOKUP_KEY: 'plan:pro',
METER_LOOKUP_KEY: 'meter:overage',
// Display formats
CURRENCY_SYMBOLS: {
gbp: '£',
usd: '$',
eur: '€',
cny: '¥',
inr: '₹',
brl: 'R$',
idr: 'Rp',
jpy: '¥'
} as const
} as const;
/**
* Get current billing configuration
*/
export function getBillingConfig() {
return BILLING_CONFIG;
}
/**
* Format overage price with currency symbol
* @param currency Currency code (e.g., 'usd', 'gbp')
* @param price Optional price override (defaults to BILLING_CONFIG.OVERAGE_PRICE_PER_CREDIT)
*/
export function getFormattedOveragePrice(currency: string = 'usd', price?: number): string {
const symbol = BILLING_CONFIG.CURRENCY_SYMBOLS[currency.toLowerCase() as keyof typeof BILLING_CONFIG.CURRENCY_SYMBOLS] || '$';
const amount = price ?? BILLING_CONFIG.OVERAGE_PRICE_PER_CREDIT;
return `${symbol}${amount.toFixed(2)}`;
}
/**
* Get currency symbol from currency code
*/
export function getCurrencySymbol(currency: string): string {
return BILLING_CONFIG.CURRENCY_SYMBOLS[currency.toLowerCase() as keyof typeof BILLING_CONFIG.CURRENCY_SYMBOLS] || currency.toUpperCase();
}
@@ -0,0 +1,86 @@
/**
* Desktop plan features configuration
* Single source of truth for plan features in desktop billing page
*/
export interface PlanFeatureConfig {
translationKey: string;
defaultText: string;
}
export const FREE_PLAN_FEATURES: PlanFeatureConfig[] = [
{
translationKey: 'credits.modal.allInOneWorkspace',
defaultText: 'All-in-one PDF workspace (viewer, tools & agent)'
},
{
translationKey: 'credits.modal.fullyPrivateFiles',
defaultText: 'Fully private files'
},
{
translationKey: 'credits.modal.standardThroughput',
defaultText: 'Standard throughput'
},
{
translationKey: 'credits.modal.customSmartFolders',
defaultText: 'Custom Smart Folders'
},
{
translationKey: 'credits.modal.apiSandbox',
defaultText: 'API sandbox'
}
];
export const TEAM_PLAN_FEATURES: PlanFeatureConfig[] = [
{
translationKey: 'credits.modal.unlimitedSeats',
defaultText: 'Unlimited seats'
},
{
translationKey: 'credits.modal.fasterThroughput',
defaultText: '10x faster throughput'
},
{
translationKey: 'credits.modal.largeFileProcessing',
defaultText: 'Large file processing'
},
{
translationKey: 'credits.modal.premiumAiModels',
defaultText: 'Premium AI models'
},
{
translationKey: 'credits.modal.secureApiAccess',
defaultText: 'Secure API access'
},
{
translationKey: 'credits.modal.prioritySupport',
defaultText: 'Priority support'
}
];
export const ENTERPRISE_PLAN_FEATURES: PlanFeatureConfig[] = [
{
translationKey: 'credits.modal.orgWideAccess',
defaultText: 'Org-wide access controls'
},
{
translationKey: 'credits.modal.privateDocCloud',
defaultText: 'Private Document Cloud'
},
{
translationKey: 'credits.modal.ragFineTuning',
defaultText: 'RAG + fine-tuning'
},
{
translationKey: 'credits.modal.unlimitedApiAccess',
defaultText: 'Unlimited API access'
},
{
translationKey: 'credits.modal.advancedMonitoring',
defaultText: 'Advanced monitoring'
},
{
translationKey: 'credits.modal.dedicatedSupportSlas',
defaultText: 'Dedicated support & SLAs'
}
];