Skip to content

Commit

Permalink
Remove close() call on TRANSAK_WIDGET_CLOSE event
Browse files Browse the repository at this point in the history
  • Loading branch information
rushil-transak authored and debajitr committed Sep 23, 2024
1 parent ab974db commit 545f420
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 6 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@transak/transak-sdk",
"version": "3.1.2",
"version": "3.1.3",
"description": "Transak SDK that allows you to easily integrate fiat on/off ramp",
"type": "module",
"types": "lib/index.d.ts",
Expand Down
5 changes: 1 addition & 4 deletions src/Utils/handle-events.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { EventEmitter } from 'events';
import { Events } from 'Constants/events';

export function makeHandleEvents(eventEmitter: EventEmitter, close: () => void) {
export function makeHandleEvents(eventEmitter: EventEmitter) {
return function handleEvents(event: MessageEvent<{ event_id: Events; data: unknown }>) {
if (event?.data?.event_id) {
// eslint-disable-next-line default-case
Expand Down Expand Up @@ -65,9 +65,6 @@ export function makeHandleEvents(eventEmitter: EventEmitter, close: () => void)
eventName: Events.TRANSAK_WIDGET_CLOSE,
status: true,
});

close();

break;
}

Expand Down
2 changes: 1 addition & 1 deletion src/transak.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class Transak {
if (!transakConfig?.apiKey) throw new Error('[Transak SDK] => Please enter your API Key');

this.#config = transakConfig;
this.#handleMessage = makeHandleEvents(eventEmitter, this.close);
this.#handleMessage = makeHandleEvents(eventEmitter);
}

static on = (type: '*' | keyof typeof Events, cb: (data: unknown) => void) => {
Expand Down

0 comments on commit 545f420

Please sign in to comment.