2.18.0: New Invitation flow, refactored Database Webhooks, new ShadCN UI Components (#384)

* Streamlined invitations flow
* Removed web hooks in favor of handling logic directly in server actions
* Added new Shadcn UI Components
This commit is contained in:
Giancarlo Buomprisco
2025-10-05 17:54:16 +08:00
committed by GitHub
parent 195cf41680
commit 2e20d3e76f
60 changed files with 3760 additions and 1009 deletions

View File

@@ -24,40 +24,14 @@ class DatabaseWebhookRouterService {
*/
async handleWebhook(body: RecordChange<keyof Tables>) {
switch (body.table) {
case 'invitations': {
const payload = body as RecordChange<typeof body.table>;
return this.handleInvitationsWebhook(payload);
}
case 'subscriptions': {
const payload = body as RecordChange<typeof body.table>;
return this.handleSubscriptionsWebhook(payload);
}
case 'accounts': {
const payload = body as RecordChange<typeof body.table>;
return this.handleAccountsWebhook(payload);
}
default: {
return;
}
}
}
private async handleInvitationsWebhook(body: RecordChange<'invitations'>) {
const { createAccountInvitationsWebhookService } = await import(
'@kit/team-accounts/webhooks'
);
const service = createAccountInvitationsWebhookService(this.adminClient);
return service.handleInvitationWebhook(body.record);
}
private async handleSubscriptionsWebhook(
body: RecordChange<'subscriptions'>,
) {
@@ -71,16 +45,4 @@ class DatabaseWebhookRouterService {
return service.handleSubscriptionDeletedWebhook(body.old_record);
}
}
private async handleAccountsWebhook(body: RecordChange<'accounts'>) {
if (body.type === 'DELETE' && body.old_record) {
const { createAccountWebhooksService } = await import(
'@kit/team-accounts/webhooks'
);
const service = createAccountWebhooksService();
return service.handleAccountDeletedWebhook(body.old_record);
}
}
}