@front-finance/link
Advanced tools
Comparing version 1.0.6 to 1.0.7
import { FrontOptions, FrontConnection } from './utils/types'; | ||
export declare const createFrontConnection: (options: FrontOptions) => FrontConnection; |
@@ -0,0 +0,0 @@ "use strict"; |
export * from './utils/nonce'; | ||
export * from './utils/types'; | ||
export { createFrontConnection } from './FrontConnection'; |
@@ -0,0 +0,0 @@ "use strict"; |
export declare function generateAndSaveNonce(): Promise<string>; | ||
export declare function validateNonce(nonce: string): Promise<boolean>; |
@@ -0,0 +0,0 @@ "use strict"; |
import { FrontOptions } from './types'; | ||
export declare function removePopup(): void; | ||
export declare function addPopup(iframeLink: string, options: FrontOptions): void; |
@@ -18,3 +18,3 @@ "use strict"; | ||
function eventsListener(event) { | ||
var _a, _b, _c, _d; | ||
var _a, _b, _c, _d, _e; | ||
switch (event.data.type) { | ||
@@ -35,5 +35,10 @@ case 'brokerageAccountAccessToken': { | ||
} | ||
case 'transferFinished': { | ||
var payload = event.data.payload; | ||
(_c = currentOptions === null || currentOptions === void 0 ? void 0 : currentOptions.onTransferFinished) === null || _c === void 0 ? void 0 : _c.call(currentOptions, payload); | ||
break; | ||
} | ||
case 'close': | ||
case 'done': { | ||
(_c = currentOptions === null || currentOptions === void 0 ? void 0 : currentOptions.onExit) === null || _c === void 0 ? void 0 : _c.call(currentOptions, event.data.message); | ||
(_d = currentOptions === null || currentOptions === void 0 ? void 0 : currentOptions.onExit) === null || _d === void 0 ? void 0 : _d.call(currentOptions, event.data.message); | ||
removePopup(); | ||
@@ -48,4 +53,4 @@ break; | ||
var top_1 = screen.height / 2 - h / 2; | ||
(_d = window | ||
.open(event.data.link, '_blank', "popup,noopener,noreferrer,resizable,scrollbars,width=".concat(w, ",height=").concat(h, ",top=").concat(top_1, ",left=").concat(left))) === null || _d === void 0 ? void 0 : _d.focus(); | ||
(_e = window | ||
.open(event.data.link, '_blank', "popup,noopener,noreferrer,resizable,scrollbars,width=".concat(w, ",height=").concat(h, ",top=").concat(top_1, ",left=").concat(left))) === null || _e === void 0 ? void 0 : _e.focus(); | ||
} | ||
@@ -52,0 +57,0 @@ break; |
import type { BrokerType } from '@front-finance/api'; | ||
export type EventType = 'brokerageAccountAccessToken' | 'delayedAuthentication' | 'close' | 'done' | 'loaded' | 'oauthLinkOpen'; | ||
export type EventType = 'brokerageAccountAccessToken' | 'delayedAuthentication' | 'close' | 'done' | 'loaded' | 'oauthLinkOpen' | 'transferFinished'; | ||
export interface FrontConnection { | ||
@@ -48,2 +48,16 @@ openLink: (authLink: string) => Promise<void>; | ||
} | ||
export interface TransferFinishedSuccessPayload { | ||
status: 'success'; | ||
txId: string; | ||
fromAddress: string; | ||
toAddress: string; | ||
symbol: string; | ||
amount: number; | ||
networkId: string; | ||
} | ||
export interface TransferFinishedErrorPayload { | ||
status: 'error'; | ||
errorMessage: string; | ||
} | ||
export type TransferFinishedPayload = TransferFinishedSuccessPayload | TransferFinishedErrorPayload; | ||
export interface FrontOptions { | ||
@@ -53,2 +67,3 @@ clientId: string; | ||
onExit?: (error?: string) => void; | ||
onTransferFinished?: (payload: TransferFinishedPayload) => void; | ||
} |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); |
import { FrontOptions, FrontConnection } from './utils/types'; | ||
export declare const createFrontConnection: (options: FrontOptions) => FrontConnection; |
@@ -0,0 +0,0 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { |
export * from './utils/nonce'; | ||
export * from './utils/types'; | ||
export { createFrontConnection } from './FrontConnection'; |
export * from './utils/nonce'; | ||
export * from './utils/types'; | ||
export { createFrontConnection } from './FrontConnection'; |
{ | ||
"name": "@front-finance/link", | ||
"version": "1.0.6", | ||
"version": "1.0.7", | ||
"description": "Front Finance accounts connection client lib", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
@@ -105,7 +105,8 @@ # @front-finance/link | ||
| 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 | | ||
| 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 | | ||
| `onTransferFinished` | `(payload: TransferFinishedPayload) => void` | Callback called when a crypto transfer is executed | | ||
@@ -112,0 +113,0 @@ #### `createFrontConnection` return value |
export declare function generateAndSaveNonce(): Promise<string>; | ||
export declare function validateNonce(nonce: string): Promise<boolean>; |
@@ -0,0 +0,0 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { |
import { FrontOptions } from './types'; | ||
export declare function removePopup(): void; | ||
export declare function addPopup(iframeLink: string, options: FrontOptions): void; |
@@ -15,3 +15,3 @@ var popupId = 'front-link-popup'; | ||
function eventsListener(event) { | ||
var _a, _b, _c, _d; | ||
var _a, _b, _c, _d, _e; | ||
switch (event.data.type) { | ||
@@ -32,5 +32,10 @@ case 'brokerageAccountAccessToken': { | ||
} | ||
case 'transferFinished': { | ||
var payload = event.data.payload; | ||
(_c = currentOptions === null || currentOptions === void 0 ? void 0 : currentOptions.onTransferFinished) === null || _c === void 0 ? void 0 : _c.call(currentOptions, payload); | ||
break; | ||
} | ||
case 'close': | ||
case 'done': { | ||
(_c = currentOptions === null || currentOptions === void 0 ? void 0 : currentOptions.onExit) === null || _c === void 0 ? void 0 : _c.call(currentOptions, event.data.message); | ||
(_d = currentOptions === null || currentOptions === void 0 ? void 0 : currentOptions.onExit) === null || _d === void 0 ? void 0 : _d.call(currentOptions, event.data.message); | ||
removePopup(); | ||
@@ -45,4 +50,4 @@ break; | ||
var top_1 = screen.height / 2 - h / 2; | ||
(_d = window | ||
.open(event.data.link, '_blank', "popup,noopener,noreferrer,resizable,scrollbars,width=".concat(w, ",height=").concat(h, ",top=").concat(top_1, ",left=").concat(left))) === null || _d === void 0 ? void 0 : _d.focus(); | ||
(_e = window | ||
.open(event.data.link, '_blank', "popup,noopener,noreferrer,resizable,scrollbars,width=".concat(w, ",height=").concat(h, ",top=").concat(top_1, ",left=").concat(left))) === null || _e === void 0 ? void 0 : _e.focus(); | ||
} | ||
@@ -49,0 +54,0 @@ break; |
import type { BrokerType } from '@front-finance/api'; | ||
export type EventType = 'brokerageAccountAccessToken' | 'delayedAuthentication' | 'close' | 'done' | 'loaded' | 'oauthLinkOpen'; | ||
export type EventType = 'brokerageAccountAccessToken' | 'delayedAuthentication' | 'close' | 'done' | 'loaded' | 'oauthLinkOpen' | 'transferFinished'; | ||
export interface FrontConnection { | ||
@@ -48,2 +48,16 @@ openLink: (authLink: string) => Promise<void>; | ||
} | ||
export interface TransferFinishedSuccessPayload { | ||
status: 'success'; | ||
txId: string; | ||
fromAddress: string; | ||
toAddress: string; | ||
symbol: string; | ||
amount: number; | ||
networkId: string; | ||
} | ||
export interface TransferFinishedErrorPayload { | ||
status: 'error'; | ||
errorMessage: string; | ||
} | ||
export type TransferFinishedPayload = TransferFinishedSuccessPayload | TransferFinishedErrorPayload; | ||
export interface FrontOptions { | ||
@@ -53,2 +67,3 @@ clientId: string; | ||
onExit?: (error?: string) => void; | ||
onTransferFinished?: (payload: TransferFinishedPayload) => void; | ||
} |
export {}; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
48173
935
127
1