Files
myeasycms-v2/apps/web/app/home/[account]/_lib/server/team-account-billing-page.loader.ts
Giancarlo Buomprisco da8a3a903d Update billing page data handling and version bump to 2.12.0 (#300)
* 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.
2025-07-16 17:11:55 +08:00

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]);
}