* Update billing page data handling and version bump to 2.12.0 - Refactored billing page components to streamline data loading for subscriptions and orders. - Introduced `getProductPlan` function to encapsulate product plan resolution logic. - Updated `package.json` version from 2.11.0 to 2.12.0.
24 lines
750 B
TypeScript
24 lines
750 B
TypeScript
import 'server-only';
|
|
|
|
import { cache } from 'react';
|
|
|
|
import { getSupabaseServerClient } from '@kit/supabase/server-client';
|
|
import { createTeamAccountsApi } from '@kit/team-accounts/api';
|
|
|
|
/**
|
|
* @name loadTeamAccountBillingPage
|
|
* @description Load the team account billing page data for the given account.
|
|
*/
|
|
export const loadTeamAccountBillingPage = cache(teamAccountBillingPageLoader);
|
|
|
|
function teamAccountBillingPageLoader(accountId: string) {
|
|
const client = getSupabaseServerClient();
|
|
const api = createTeamAccountsApi(client);
|
|
|
|
const subscription = api.getSubscription(accountId);
|
|
const order = api.getOrder(accountId);
|
|
const customerId = api.getCustomerId(accountId);
|
|
|
|
return Promise.all([subscription, order, customerId]);
|
|
}
|