@front-finance/link
Advanced tools
Comparing version 1.0.0 to 1.0.1
{ | ||
"name": "@front-finance/link", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "Front Finance accounts connection client lib", | ||
"type": "module", | ||
"license": "MIT", | ||
"repository": "https://github.com/FrontFin/front-b2b-link.git", | ||
"homepage": "https://github.com/FrontFin/front-b2b-link", | ||
"devDependencies": { | ||
@@ -19,3 +21,6 @@ "@typescript-eslint/eslint-plugin": "^4.21.0", | ||
"localforage": "^1.10.0" | ||
} | ||
}, | ||
"main": "cjs/index.js", | ||
"module": "index.js", | ||
"types": "index.d.ts" | ||
} |
@@ -19,2 +19,19 @@ # @front-finance/link | ||
### Getting connection link | ||
Connection link should be obtained from the GET `/api/v1/cataloglink` endpoint. Api reference for this request is available [here](https://integration-api.getfront.com/apireference#tag/Integrations/paths/~1api~1v1~1cataloglink/get). Request must be preformed from the server side because it requires the client secret. You will get the response in the following format: | ||
```json | ||
{ | ||
"content": { | ||
"url": "https://web.getfront.com/broker-connect?auth_code={authCode}", | ||
"iFrameUrl": "https://web.getfront.com/b2b-iframe/{clientId}/broker-connect?auth_code={authCode}" | ||
}, | ||
"status": "ok", | ||
"message": "" | ||
} | ||
``` | ||
You can use `iFrameUrl` from this response to open the popup window with `openPopup` method. `url` field is used to open link in the same tab by `openLink` method. | ||
### Generating connection method | ||
@@ -89,16 +106,22 @@ | ||
| key | type | | ||
| ------------------- | ------------------------------------------------------ | | ||
| `clientId` | `string` | | ||
| `onBrokerConnected` | `(payload: FrontPayload) => void` | | ||
| `onExit` | `((error?: string \| undefined) => void) \| undefined` | | ||
| key | type | description | | ||
| ------------------- | ------------------------------------------------------ | ---------------------------------------------------------- | | ||
| `clientId` | `string` | Keys from https://dashboard.getfront.com/company/keys page | | ||
| `onBrokerConnected` | `(payload: FrontPayload) => void` | Callback called when users connects their accounts | | ||
| `onExit` | `((error?: string \| undefined) => void) \| undefined` | Called if connection not happened | | ||
#### `createFrontConnection` return value | ||
| key | type | | ||
| ---------- | --------------------- | | ||
| `openLink` | `() => Promise<void>` | | ||
| key | type | description | | ||
| ------------ | -------------------------------------- | ---------------------- | | ||
| `openLink` | `(link: string) => Promise<void>` | Opens url in same tab. | | ||
| `openPopup` | `(iframeUrl: string) => Promise<void>` | Opens url in popup | | ||
| `closePopup` | `() => Promise<void>` | Closes popup window | | ||
### Using tokens | ||
You can use broker tokens to perform requests to get current balance, assets and execute transactions. Full API reference can be found [here](https://integration-api.getfront.com/apireference). | ||
## Typescript support | ||
TypeScript definitions for `@front-finance/link` are built into the npm package. |
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
No website
QualityPackage does not have a website.
Found 1 instance in 1 package
47589
0
126