Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions packages/sdk/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@

# Changelog

## [1.6.4] - 2025-05-30

### Added

- Added `onClose` callback to `connectAccount` method that fires whenever the Connect iFrame is closed (success or cancel)

Check failure on line 9 in packages/sdk/CHANGELOG.md

View workflow job for this annotation

GitHub Actions / test

Line length

packages/sdk/CHANGELOG.md:9:81 MD013/line-length Line length [Expected: 80; Actual: 122] https://github.com/DavidAnson/markdownlint/blob/v0.35.0/doc/md013.md

Check failure on line 9 in packages/sdk/CHANGELOG.md

View workflow job for this annotation

GitHub Actions / test

Line length

packages/sdk/CHANGELOG.md:9:81 MD013/line-length Line length [Expected: 80; Actual: 122] https://github.com/DavidAnson/markdownlint/blob/v0.35.0/doc/md013.md
- Added `onCancel` callback to `connectAccount` method that fires when the Connect iFrame is closed without successfully connecting

Check failure on line 10 in packages/sdk/CHANGELOG.md

View workflow job for this annotation

GitHub Actions / test

Line length

packages/sdk/CHANGELOG.md:10:81 MD013/line-length Line length [Expected: 80; Actual: 131] https://github.com/DavidAnson/markdownlint/blob/v0.35.0/doc/md013.md

Check failure on line 10 in packages/sdk/CHANGELOG.md

View workflow job for this annotation

GitHub Actions / test

Line length

packages/sdk/CHANGELOG.md:10:81 MD013/line-length Line length [Expected: 80; Actual: 131] https://github.com/DavidAnson/markdownlint/blob/v0.35.0/doc/md013.md

## [1.6.3] - 2025-05-20b

### Added
Expand Down Expand Up @@ -61,8 +68,8 @@

### Added

- PD_SDK_DEBUG env var. Set it to true to enable debugging of Pipedream Connect
API requests. Simple sanitization is performed to prevent sensitive field leakage
- PD_SDK_DEBUG env var. Set it to true to enable debugging of Pipedream Connect
API requests. Simple sanitization is performed to prevent sensitive field leakage
but use caution.

## [1.5.1] - 2025-04-15
Expand Down
2 changes: 1 addition & 1 deletion packages/sdk/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@pipedream/sdk",
"type": "module",
"version": "1.6.3",
"version": "1.6.4",
"description": "Pipedream SDK",
"main": "./dist/server.js",
"module": "./dist/server.js",
Expand Down
25 changes: 25 additions & 0 deletions packages/sdk/src/browser/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,17 @@
* @param err - The error that occurred during the connection.
*/
onError?: (err: ConnectError) => void;

/**
* Callback function to be called when the Connect iFrame is closed.
*/
onClose?: () => void;

/**
* Callback function to be called when the user cancels/closes the Connect
* iFrame without successfully connecting an account.
*/
onCancel?: () => void;
};

/**
Expand Down Expand Up @@ -223,13 +234,22 @@
* onError: (err) => {
* console.error("Connection error:", err);
* },
* onClose: () => {
* console.log("Connect iFrame closed");
* },
* onCancel: () => {
* console.log("User cancelled without connecting");
* },
* });
* ```
*/
public async connectAccount(opts: StartConnectOpts) {
let connectionSuccessful = false;

Check failure on line 248 in packages/sdk/src/browser/index.ts

View workflow job for this annotation

GitHub Actions / Lint Code Base

Trailing spaces not allowed
const onMessage = (e: MessageEvent) => {
switch (e.data?.type) {
case "success":
connectionSuccessful = true;
opts.onSuccess?.({
id: e.data?.authProvisionId,
});
Expand All @@ -239,6 +259,11 @@
break;
case "close":
this.cleanup(onMessage);
opts.onClose?.();
// Call onCancel if the connection wasn't successful
if (!connectionSuccessful) {
opts.onCancel?.();
}
break;
default:
break;
Expand Down
Loading