@meshconnect/web-link-sdk 2.0.1 → 2.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Link.d.ts +2 -2
- package/Link.js +161 -145
- package/README.md +120 -127
- package/cjs/Link.js +165 -149
- package/cjs/index.js +21 -21
- package/cjs/utils/event-types.js +31 -31
- package/cjs/utils/popup.js +39 -39
- package/cjs/utils/sdk-specs.js +8 -0
- package/cjs/utils/style.js +18 -18
- package/cjs/utils/types.js +2 -2
- package/cjs/utils/version.js +4 -0
- package/index.d.ts +3 -3
- package/index.js +3 -3
- package/package.json +6 -6
- package/utils/event-types.d.ts +152 -152
- package/utils/event-types.js +27 -27
- package/utils/popup.d.ts +3 -3
- package/utils/popup.js +34 -34
- package/utils/sdk-specs.d.ts +4 -0
- package/utils/sdk-specs.js +5 -0
- package/utils/style.d.ts +3 -3
- package/utils/style.js +13 -13
- package/utils/types.d.ts +103 -108
- package/utils/types.js +1 -1
- package/utils/version.d.ts +1 -0
- package/utils/version.js +1 -0
package/utils/types.d.ts
CHANGED
@@ -1,108 +1,103 @@
|
|
1
|
-
import type { BrokerType } from '@meshconnect/node-api';
|
2
|
-
import { SessionSymmary, LinkEventType } from './event-types';
|
3
|
-
export type EventType = 'brokerageAccountAccessToken' | 'delayedAuthentication' | 'loaded' | 'oauthLinkOpen' | 'transferFinished';
|
4
|
-
export interface Link {
|
5
|
-
/**
|
6
|
-
* A function that takes linkToken parameter from `/api/v1/linktoken` endpoint as an input, and opens the Link UI popup
|
7
|
-
*/
|
8
|
-
openLink: (linkToken: string) => Promise<void>;
|
9
|
-
/**
|
10
|
-
* A function to close Link UI popup
|
11
|
-
*/
|
12
|
-
closeLink: () => void;
|
13
|
-
}
|
14
|
-
export interface AccountToken {
|
15
|
-
account: Account;
|
16
|
-
accessToken: string;
|
17
|
-
refreshToken?: string;
|
18
|
-
}
|
19
|
-
export interface Account {
|
20
|
-
accountId: string;
|
21
|
-
accountName: string;
|
22
|
-
fund?: number;
|
23
|
-
cash?: number;
|
24
|
-
isReconnected?: boolean;
|
25
|
-
}
|
26
|
-
export interface BrandInfo {
|
27
|
-
brokerLogo: string;
|
28
|
-
brokerPrimaryColor?: string;
|
29
|
-
}
|
30
|
-
export interface LinkPayload {
|
31
|
-
accessToken?: AccessTokenPayload;
|
32
|
-
delayedAuth?: DelayedAuthPayload;
|
33
|
-
}
|
34
|
-
export interface AccessTokenPayload {
|
35
|
-
accountTokens: AccountToken[];
|
36
|
-
brokerBrandInfo: BrandInfo;
|
37
|
-
expiresInSeconds?: number;
|
38
|
-
refreshTokenExpiresInSeconds?: number;
|
39
|
-
brokerType: BrokerType;
|
40
|
-
brokerName: string;
|
41
|
-
}
|
42
|
-
export interface DelayedAuthPayload {
|
43
|
-
refreshTokenExpiresInSeconds?: number;
|
44
|
-
brokerType: BrokerType;
|
45
|
-
refreshToken: string;
|
46
|
-
brokerName: string;
|
47
|
-
brokerBrandInfo: BrandInfo;
|
48
|
-
}
|
49
|
-
export interface
|
50
|
-
status: 'success';
|
51
|
-
txId: string;
|
52
|
-
fromAddress: string;
|
53
|
-
toAddress: string;
|
54
|
-
symbol: string;
|
55
|
-
amount: number;
|
56
|
-
networkId: string;
|
57
|
-
}
|
58
|
-
export interface
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
*
|
73
|
-
*/
|
74
|
-
|
75
|
-
/**
|
76
|
-
* A callback function that is called when
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
*
|
82
|
-
*/
|
83
|
-
|
84
|
-
/**
|
85
|
-
* (Optional) A callback function that is called when
|
86
|
-
* It receives
|
87
|
-
*/
|
88
|
-
|
89
|
-
/**
|
90
|
-
* (Optional)
|
91
|
-
*
|
92
|
-
*/
|
93
|
-
|
94
|
-
/**
|
95
|
-
* (Optional) An array of integration access tokens.
|
96
|
-
*
|
97
|
-
*/
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
}
|
105
|
-
export interface LinkStyle {
|
106
|
-
ir: number;
|
107
|
-
io: number;
|
108
|
-
}
|
1
|
+
import type { BrokerType } from '@meshconnect/node-api';
|
2
|
+
import { SessionSymmary, LinkEventType } from './event-types';
|
3
|
+
export type EventType = 'brokerageAccountAccessToken' | 'delayedAuthentication' | 'loaded' | 'oauthLinkOpen' | 'transferFinished';
|
4
|
+
export interface Link {
|
5
|
+
/**
|
6
|
+
* A function that takes linkToken parameter from `/api/v1/linktoken` endpoint as an input, and opens the Link UI popup
|
7
|
+
*/
|
8
|
+
openLink: (linkToken: string) => Promise<void>;
|
9
|
+
/**
|
10
|
+
* A function to close Link UI popup
|
11
|
+
*/
|
12
|
+
closeLink: () => void;
|
13
|
+
}
|
14
|
+
export interface AccountToken {
|
15
|
+
account: Account;
|
16
|
+
accessToken: string;
|
17
|
+
refreshToken?: string;
|
18
|
+
}
|
19
|
+
export interface Account {
|
20
|
+
accountId: string;
|
21
|
+
accountName: string;
|
22
|
+
fund?: number;
|
23
|
+
cash?: number;
|
24
|
+
isReconnected?: boolean;
|
25
|
+
}
|
26
|
+
export interface BrandInfo {
|
27
|
+
brokerLogo: string;
|
28
|
+
brokerPrimaryColor?: string;
|
29
|
+
}
|
30
|
+
export interface LinkPayload {
|
31
|
+
accessToken?: AccessTokenPayload;
|
32
|
+
delayedAuth?: DelayedAuthPayload;
|
33
|
+
}
|
34
|
+
export interface AccessTokenPayload {
|
35
|
+
accountTokens: AccountToken[];
|
36
|
+
brokerBrandInfo: BrandInfo;
|
37
|
+
expiresInSeconds?: number;
|
38
|
+
refreshTokenExpiresInSeconds?: number;
|
39
|
+
brokerType: BrokerType;
|
40
|
+
brokerName: string;
|
41
|
+
}
|
42
|
+
export interface DelayedAuthPayload {
|
43
|
+
refreshTokenExpiresInSeconds?: number;
|
44
|
+
brokerType: BrokerType;
|
45
|
+
refreshToken: string;
|
46
|
+
brokerName: string;
|
47
|
+
brokerBrandInfo: BrandInfo;
|
48
|
+
}
|
49
|
+
export interface TransferFinishedPayload {
|
50
|
+
status: 'success';
|
51
|
+
txId: string;
|
52
|
+
fromAddress: string;
|
53
|
+
toAddress: string;
|
54
|
+
symbol: string;
|
55
|
+
amount: number;
|
56
|
+
networkId: string;
|
57
|
+
}
|
58
|
+
export interface IntegrationAccessToken {
|
59
|
+
accountId: string;
|
60
|
+
accountName: string;
|
61
|
+
accessToken: string;
|
62
|
+
brokerType: BrokerType;
|
63
|
+
brokerName: string;
|
64
|
+
}
|
65
|
+
export interface LinkOptions {
|
66
|
+
/**
|
67
|
+
* Client ID that can be obtained at https://dashboard.meshconnect.com/company/keys
|
68
|
+
*/
|
69
|
+
clientId: string;
|
70
|
+
/**
|
71
|
+
* A callback function that is called when an integration is successfully connected.
|
72
|
+
* It receives a payload of type `LinkPayload`.
|
73
|
+
*/
|
74
|
+
onIntegrationConnected: (payload: LinkPayload) => void;
|
75
|
+
/**
|
76
|
+
* (Optional) A callback function that is called when the Front iframe is closed.
|
77
|
+
*/
|
78
|
+
onExit?: (error?: string, summary?: SessionSymmary) => void;
|
79
|
+
/**
|
80
|
+
* (Optional) A callback function that is called when a transfer is finished.
|
81
|
+
* It receives a payload of type `TransferFinishedPayload`.
|
82
|
+
*/
|
83
|
+
onTransferFinished?: (payload: TransferFinishedPayload) => void;
|
84
|
+
/**
|
85
|
+
* (Optional) A callback function that is called when various events occur within the Front iframe.
|
86
|
+
* It receives an object with type `LinkEventTypeKeys` indicating the event, and an optional 'payload' containing additional data.
|
87
|
+
*/
|
88
|
+
onEvent?: (event: LinkEventType) => void;
|
89
|
+
/**
|
90
|
+
* (Optional) An array of integration access tokens.
|
91
|
+
* These access tokens are used to initialize crypto transfers flow at 'Select asset step'
|
92
|
+
*/
|
93
|
+
accessTokens?: IntegrationAccessToken[];
|
94
|
+
/**
|
95
|
+
* (Optional) An array of integration access tokens.
|
96
|
+
* Can be used to initialize the crypto transfers flow as an alternative to the target addresses.
|
97
|
+
*/
|
98
|
+
transferDestinationTokens?: IntegrationAccessToken[];
|
99
|
+
}
|
100
|
+
export interface LinkStyle {
|
101
|
+
ir: number;
|
102
|
+
io: number;
|
103
|
+
}
|
package/utils/types.js
CHANGED
@@ -1 +1 @@
|
|
1
|
-
export {};
|
1
|
+
export {};
|
@@ -0,0 +1 @@
|
|
1
|
+
export declare const sdkVersion = "2.0.3";
|
package/utils/version.js
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
export var sdkVersion = '2.0.3';
|