Skip to content

Commit

Permalink
[NO CHANEGELOG] [Checkout Widget] Add checkout connect success event …
Browse files Browse the repository at this point in the history
…and swap rejected event (#2072)
  • Loading branch information
jiyounglee authored Aug 6, 2024
1 parent bc8d10e commit 3d18c96
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions packages/checkout/sdk/src/widgets/definitions/events/checkout.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Web3Provider } from '@ethersproject/providers';
import { CheckoutFlowType } from '../parameters/checkout';
import { ConnectionFailed } from './connect';
import { ConnectionFailed, ConnectionSuccess } from './connect';
import {
SaleFailed,
SalePaymentMethod,
Expand All @@ -16,7 +16,7 @@ import {
BridgeFailed,
BridgeTransactionSent,
} from './bridge';
import { SwapFailed, SwapSuccess } from './swap';
import { SwapFailed, SwapRejected, SwapSuccess } from './swap';
import { WalletNetworkSwitch } from './wallet';

export enum CheckoutEventType {
Expand All @@ -39,6 +39,8 @@ export enum CheckoutSuccessEventType {
export enum CheckoutFailureEventType {
BRIDGE_FAILED = 'BRIDGE_FAILED',
BRIDGE_CLAIM_WITHDRAWAL_FAILED = 'BRIDGE_CLAIM_WITHDRAWAL_FAILED',
SWAP_FAILED = 'SWAP_FAILED',
SWAP_REJECTED = 'SWAP_REJECTED',
}

export enum CheckoutUserActionEventType {
Expand Down Expand Up @@ -89,7 +91,13 @@ export type CheckoutSwapSuccessEvent = {
data: SwapSuccess;
}; // FIMXE: TransactionSent

export type CheckoutConnectSuccessEvent = {
flow: CheckoutFlowType.CONNECT;
data: ConnectionSuccess;
};

export type CheckoutSuccessEvent =
| CheckoutConnectSuccessEvent
| CheckoutBridgeSuccessEvent
| CheckoutBridgeClaimWithdrawalSuccessEvent
| CheckoutOnRampSuccessEvent
Expand Down Expand Up @@ -121,9 +129,16 @@ export type CheckoutOnRampFailureEvent = {

export type CheckoutSwapFailureEvent = {
flow: CheckoutFlowType.SWAP;
type: CheckoutFailureEventType.SWAP_FAILED;
data: SwapFailed;
}; // FIMXE: Error

export type CheckoutSwapRejectedEvent = {
flow: CheckoutFlowType.SWAP;
type: CheckoutFailureEventType.SWAP_REJECTED;
data: SwapRejected;
}; // FIMXE: Error

export type CheckoutSaleFailureEvent = {
flow: CheckoutFlowType.SALE;
data: SaleFailed;
Expand All @@ -135,6 +150,7 @@ export type CheckoutFailureEvent =
| CheckoutConnectFailureEvent
| CheckoutOnRampFailureEvent
| CheckoutSwapFailureEvent
| CheckoutSwapRejectedEvent
| CheckoutSaleFailureEvent;

export type CheckoutPaymentMethodSelectedEvent = {
Expand Down

0 comments on commit 3d18c96

Please sign in to comment.