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.
19 lines
494 B
TypeScript
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;
|
|
}
|