Adjusted Per seat billing and added example to the sample schema

This commit is contained in:
giancarlo
2024-04-22 22:48:02 +08:00
parent b96d4cf855
commit 70da6ef1fa
19 changed files with 2190 additions and 2066 deletions

View File

@@ -50,7 +50,7 @@ async function PersonalAccountBillingPage() {
/>
<PageBody>
<div className={'flex flex-col space-y-8'}>
<div className={'flex flex-col space-y-4'}>
<If condition={!data}>
<PersonalAccountCheckoutForm customerId={customerId} />

View File

@@ -242,7 +242,11 @@ export class TeamBillingService {
}> = [];
for (const lineItem of lineItems) {
if (lineItem.type === 'per-seat') {
// check if the line item is a per seat type
const isPerSeat = lineItem.type === 'per_seat';
if (isPerSeat) {
// get the current number of members in the account
const quantity = await this.getCurrentMembersCount(accountId);
const item = {
@@ -254,6 +258,7 @@ export class TeamBillingService {
}
}
// set initial quantity for the line items
return variantQuantities;
}

View File

@@ -80,7 +80,7 @@ async function TeamAccountBillingPage({ params }: Params) {
<PageBody>
<div
className={cn(`flex w-full flex-col space-y-6`, {
className={cn(`flex w-full flex-col space-y-4`, {
'mx-auto max-w-2xl': data,
})}
>

View File

@@ -54,18 +54,24 @@ async function ReturnCheckoutSessionPage({ searchParams }: SessionPageProps) {
/>
</div>
<div
className={
'fixed left-0 top-0 w-full bg-background/30 backdrop-blur-sm' +
' !m-0 h-full'
}
/>
<BlurryBackdrop />
</>
);
}
export default withI18n(ReturnCheckoutSessionPage);
function BlurryBackdrop() {
return (
<div
className={
'fixed left-0 top-0 w-full bg-background/30 backdrop-blur-sm' +
' !m-0 h-full'
}
/>
);
}
async function loadCheckoutSession(sessionId: string) {
const client = getSupabaseServerComponentClient();
const { error } = await requireUser(client);