diff --git a/sdks/js/packages/core/react/components/organization/billing/index.tsx b/sdks/js/packages/core/react/components/organization/billing/index.tsx index 6ee5d1c3e..ddf1c57d6 100644 --- a/sdks/js/packages/core/react/components/organization/billing/index.tsx +++ b/sdks/js/packages/core/react/components/organization/billing/index.tsx @@ -1,15 +1,65 @@ import { Flex, Text } from '@raystack/apsara'; import { Outlet } from '@tanstack/react-router'; import { styles } from '../styles'; +import { useFrontier } from '~/react/contexts/FrontierContext'; +import { useEffect } from 'react'; + +interface BillingHeaderProps { + billingSupportEmail?: string; +} + +export const BillingHeader = ({ billingSupportEmail }: BillingHeaderProps) => { + return ( + + + Billing + + Oversee your billing and invoices. + {billingSupportEmail ? ( + <> + {' '} + For more details, contact{' '} + + {billingSupportEmail} + + + ) : null} + + + + ); +}; export default function Billing() { + const { billingAccount, client, config } = useFrontier(); + + useEffect(() => { + async function getPaymentMethod(orgId: string, billingId: string) { + const resp = await client?.frontierServiceGetBillingAccount( + orgId, + billingId, + { with_payment_methods: true } + ); + console.log(resp); + } + if (billingAccount?.id && billingAccount?.org_id) { + getPaymentMethod(billingAccount?.org_id, billingAccount?.id); + } + }, [billingAccount?.id, billingAccount?.org_id, client]); + return ( Billing - + + + diff --git a/sdks/js/packages/core/shared/types.ts b/sdks/js/packages/core/shared/types.ts index 5a7197cea..9ff6e0175 100644 --- a/sdks/js/packages/core/shared/types.ts +++ b/sdks/js/packages/core/shared/types.ts @@ -6,6 +6,7 @@ export interface FrontierClientOptions { redirectLogin?: string; redirectMagicLinkVerify?: string; callbackUrl?: string; + billingSupportEmail?: string; } export interface InitialState {