learning_ai_notes/web/src/lib/billing-client.ts
saravanakumardb1 4813c850a3 feat(web,mobile): add @bytelyst/billing-client and platform-client
Web:
- New lib/billing-client.ts: factory wrapper using shared getAccessToken.
- Add @bytelyst/billing-client to web deps.

Mobile:
- New lib/billing-client.ts: factory wrapper using MMKV token storage.
- New lib/platform-api.ts: typed platform-client wrapper for settings,
  sessions, and profile management.
- Add @bytelyst/billing-client and @bytelyst/platform-client to deps.
2026-04-13 10:30:02 -07:00

19 lines
494 B
TypeScript

"use client";
import { createBillingClient, type BillingClient } from "@bytelyst/billing-client";
import { PLATFORM_SERVICE_URL, PRODUCT_ID } from "@/lib/product-config";
import { getAccessToken } from "@/lib/api-helpers";
let _client: BillingClient | null = null;
export function getBillingClient(): BillingClient {
if (!_client) {
_client = createBillingClient({
baseUrl: PLATFORM_SERVICE_URL,
productId: PRODUCT_ID,
getAccessToken,
});
}
return _client;
}