@cometh/checkout-sdk
Advanced tools
Comparing version 0.1.0-dev.2 to 0.1.0-dev.3
import { EventEmitter } from 'eventemitter3'; | ||
declare enum DisplayMode { | ||
REDIRECT_CURRENT = "redirect-current", | ||
TAB = "tab", | ||
@@ -33,2 +32,3 @@ IFRAME = "iframe", | ||
transactionId: string; | ||
txHash: string; | ||
status: TransactionStatus; | ||
@@ -38,3 +38,5 @@ } | ||
message: string; | ||
status?: TransactionStatus; | ||
transactionId?: string; | ||
txHash?: string; | ||
status: TransactionStatus; | ||
} | ||
@@ -41,0 +43,0 @@ type CheckoutEventMap = { |
@@ -7,3 +7,2 @@ var __defProp = Object.defineProperty; | ||
var DisplayMode = /* @__PURE__ */ ((DisplayMode3) => { | ||
DisplayMode3["REDIRECT_CURRENT"] = "redirect-current"; | ||
DisplayMode3["TAB"] = "tab"; | ||
@@ -50,7 +49,3 @@ DisplayMode3["IFRAME"] = "iframe"; | ||
window.removeEventListener("message", handler); | ||
reject({ | ||
type, | ||
data: { message: "User terminated the flow by closing the modal." }, | ||
success: false | ||
}); | ||
reject({ message: "User unexpectedly closed the flow." }); | ||
} | ||
@@ -313,2 +308,3 @@ }; | ||
transactionId: response.transactionId, | ||
txHash: response.txHash, | ||
status: "completed" /* COMPLETED */ | ||
@@ -319,4 +315,6 @@ }); | ||
this.emit("checkoutFailure" /* FAILURE */, { | ||
transactionId: e.transactionId, | ||
txHash: e.txHash, | ||
message: e.message, | ||
status: e.status | ||
status: e.status || "cancelled" /* CANCELLED */ | ||
}); | ||
@@ -323,0 +321,0 @@ } |
{ | ||
"name": "@cometh/checkout-sdk", | ||
"version": "0.1.0-dev.2", | ||
"version": "0.1.0-dev.3", | ||
"author": "Cometh", | ||
@@ -5,0 +5,0 @@ "description": "SDK Cometh Checkout", |
@@ -12,4 +12,5 @@ # Connect Checkout SDK | ||
1. Initialize SDK | ||
```typescript | ||
import { CheckoutSDK } from '@cometh/checkout-sdk' | ||
import {CheckoutSDK} from '@cometh/checkout-sdk' | ||
@@ -20,2 +21,3 @@ const sdk = new CheckoutSDK(apiKey) | ||
2. Start checkout flow | ||
```typescript | ||
@@ -35,13 +37,15 @@ const request = { | ||
```js | ||
import { CheckoutSuccess, CheckoutError } from '@cometh/checkout-sdk' | ||
sdk.on('start', () => { | ||
console.log('display is ON and flow has started'); | ||
}); | ||
```ts | ||
import {CheckoutSDK, CheckoutError, CheckoutSuccess} from '@cometh/checkout-sdk' | ||
sdk.on('success', (result: CheckoutSuccess) => { | ||
}); | ||
const sdk = new CheckoutSDK(apiKey) | ||
sdk.on('start', () => { | ||
console.log('display is ON and flow has started'); | ||
}); | ||
sdk.on('failure', (error: CheckoutError) => { | ||
}); | ||
``` | ||
sdk.on('success', (result: CheckoutSuccess) => { | ||
}); | ||
sdk.on('failure', (error: CheckoutError) => { | ||
}); | ||
``` |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
24436
48
727