diff --git a/src/client/index.ts b/src/client/index.ts index b9f4a4c..41df6be 100644 --- a/src/client/index.ts +++ b/src/client/index.ts @@ -333,10 +333,10 @@ export class StripeSubscriptions { * export default http; * ``` */ -export function registerRoutes( +export function registerRoutes( http: HttpRouter, component: ComponentApi, - config?: RegisterRoutesConfig, + config?: RegisterRoutesConfig, ) { const webhookPath = config?.webhookPath ?? "/stripe/webhook"; const eventHandlers = config?.events ?? {}; diff --git a/src/client/types.ts b/src/client/types.ts index 68b2284..a7234cc 100644 --- a/src/client/types.ts +++ b/src/client/types.ts @@ -23,25 +23,27 @@ export type ActionCtx = Pick< /** * Handler function for a specific Stripe webhook event. - * Receives the mutation context and the full Stripe event object. + * Receives the action context and the full Stripe event object. */ export type StripeEventHandler< - Ctx extends ActionCtx = ActionCtx, T extends Stripe.Event.Type = Stripe.Event.Type, -> = (ctx: Ctx, event: Stripe.Event & { type: T }) => Promise; +> = ( + ctx: GenericActionCtx, + event: Stripe.Event & { type: T } +) => Promise; /** * Map of event types to their handlers. * Users can provide handlers for any Stripe webhook event type. */ -export type StripeEventHandlers = { - [K in Stripe.Event.Type]?: StripeEventHandler; +export type StripeEventHandlers = { + [K in Stripe.Event.Type]?: StripeEventHandler; }; /** * Configuration for webhook registration. */ -export type RegisterRoutesConfig = { +export type RegisterRoutesConfig = { /** * Optional webhook path. Defaults to "/stripe/webhook" */ @@ -58,7 +60,7 @@ export type RegisterRoutesConfig = { * Optional generic event handler that runs for all events. * This runs after default processing and before specific event handlers. */ - onEvent?: StripeEventHandler; + onEvent?: StripeEventHandler; /** * Stripe webhook secret for signature verification. * Defaults to process.env.STRIPE_WEBHOOK_SECRET