Skip to content

Commit

Permalink
export event detail type
Browse files Browse the repository at this point in the history
  • Loading branch information
jhesgodi committed Aug 29, 2024
1 parent 661296b commit 9b737f3
Showing 1 changed file with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,13 @@ export enum PostMessageHandlerEventType {
WIDGET_EVENT = 'IMTBL_CHECKOUT_WIDGET_EVENT',
}

export type WidgetEventDetail<T extends WidgetType> = {
[K in keyof WidgetEventData[T]]: {
type: K;
data: WidgetEventData[T][K];
};
}[keyof WidgetEventData[T]];

export type PostMessageProviderRelayData = any;

export type PostMessageEIP6963Data = any;
Expand All @@ -18,12 +25,7 @@ export type PostMessageWidgetEventData<
T extends WidgetType = WidgetType.CHECKOUT,
> = {
type: IMTBLWidgetEvents.IMTBL_CHECKOUT_WIDGET_EVENT;
detail: {
[K in keyof WidgetEventData[T]]: {
type: K;
data: WidgetEventData[T][K];
};
}[keyof WidgetEventData[T]];
detail: WidgetEventDetail<T>;
};

export type PostMessageData =
Expand Down

0 comments on commit 9b737f3

Please sign in to comment.