@meshconnect/web-link-sdk 2.0.0 → 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.js CHANGED
@@ -1,3 +1,14 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
1
12
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
13
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
14
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -36,13 +47,14 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
36
47
  };
37
48
  import { addPopup, iframeId, removePopup } from './utils/popup';
38
49
  import { isLinkEventTypeKey } from './utils/event-types';
50
+ import { sdkSpecs } from './utils/sdk-specs';
39
51
  var currentOptions;
40
52
  var iframeUrlObject;
41
53
  var iframeElement = function () {
42
54
  return document.getElementById(iframeId);
43
55
  };
44
56
  function eventsListener(event) {
45
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
57
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
46
58
  switch (event.data.type) {
47
59
  case 'brokerageAccountAccessToken': {
48
60
  var payload = {
@@ -77,7 +89,8 @@ function eventsListener(event) {
77
89
  }
78
90
  case 'close':
79
91
  case 'done': {
80
- (_g = currentOptions === null || currentOptions === void 0 ? void 0 : currentOptions.onExit) === null || _g === void 0 ? void 0 : _g.call(currentOptions, event.data.message);
92
+ var payload = (_g = event.data) === null || _g === void 0 ? void 0 : _g.payload;
93
+ (_h = currentOptions === null || currentOptions === void 0 ? void 0 : currentOptions.onExit) === null || _h === void 0 ? void 0 : _h.call(currentOptions, payload === null || payload === void 0 ? void 0 : payload.errorMessage, payload);
81
94
  removePopup();
82
95
  break;
83
96
  }
@@ -87,27 +100,31 @@ function eventsListener(event) {
87
100
  var h = 800;
88
101
  var left = screen.width / 2 - w / 2;
89
102
  var top_1 = screen.height / 2 - h / 2;
90
- (_h = window
91
- .open(event.data.link, '_blank', "popup,noopener,noreferrer,resizable,scrollbars,width=".concat(w, ",height=").concat(h, ",top=").concat(top_1, ",left=").concat(left))) === null || _h === void 0 ? void 0 : _h.focus();
103
+ (_j = window
104
+ .open(event.data.link, '_blank', "popup,noopener,noreferrer,resizable,scrollbars,width=".concat(w, ",height=").concat(h, ",top=").concat(top_1, ",left=").concat(left))) === null || _j === void 0 ? void 0 : _j.focus();
92
105
  }
93
106
  break;
94
107
  }
95
108
  case 'loaded': {
96
109
  if (currentOptions === null || currentOptions === void 0 ? void 0 : currentOptions.accessTokens) {
97
- (_j = iframeElement().contentWindow) === null || _j === void 0 ? void 0 : _j.postMessage({ type: 'frontAccessTokens', payload: currentOptions.accessTokens }, (iframeUrlObject === null || iframeUrlObject === void 0 ? void 0 : iframeUrlObject.origin) || 'https://web.meshconnect.com');
110
+ (_k = iframeElement().contentWindow) === null || _k === void 0 ? void 0 : _k.postMessage({
111
+ type: 'meshSDKSpecs',
112
+ payload: __assign({}, sdkSpecs)
113
+ }, (iframeUrlObject === null || iframeUrlObject === void 0 ? void 0 : iframeUrlObject.origin) || 'https://web.meshconnect.com');
114
+ (_l = iframeElement().contentWindow) === null || _l === void 0 ? void 0 : _l.postMessage({ type: 'frontAccessTokens', payload: currentOptions.accessTokens }, (iframeUrlObject === null || iframeUrlObject === void 0 ? void 0 : iframeUrlObject.origin) || 'https://web.meshconnect.com');
98
115
  }
99
116
  if (currentOptions === null || currentOptions === void 0 ? void 0 : currentOptions.transferDestinationTokens) {
100
- (_k = iframeElement().contentWindow) === null || _k === void 0 ? void 0 : _k.postMessage({
117
+ (_m = iframeElement().contentWindow) === null || _m === void 0 ? void 0 : _m.postMessage({
101
118
  type: 'frontTransferDestinationTokens',
102
119
  payload: currentOptions.transferDestinationTokens
103
120
  }, (iframeUrlObject === null || iframeUrlObject === void 0 ? void 0 : iframeUrlObject.origin) || 'https://web.meshconnect.com');
104
121
  }
105
- (_l = currentOptions === null || currentOptions === void 0 ? void 0 : currentOptions.onEvent) === null || _l === void 0 ? void 0 : _l.call(currentOptions, { type: 'pageLoaded' });
122
+ (_o = currentOptions === null || currentOptions === void 0 ? void 0 : currentOptions.onEvent) === null || _o === void 0 ? void 0 : _o.call(currentOptions, { type: 'pageLoaded' });
106
123
  break;
107
124
  }
108
125
  default: {
109
126
  if (isLinkEventTypeKey(event.data.type)) {
110
- (_m = currentOptions === null || currentOptions === void 0 ? void 0 : currentOptions.onEvent) === null || _m === void 0 ? void 0 : _m.call(currentOptions, event.data);
127
+ (_p = currentOptions === null || currentOptions === void 0 ? void 0 : currentOptions.onEvent) === null || _p === void 0 ? void 0 : _p.call(currentOptions, event.data);
111
128
  }
112
129
  break;
113
130
  }
package/README.md CHANGED
@@ -23,8 +23,7 @@ Link token should be obtained from the GET `/api/v1/linktoken` endpoint. Api ref
23
23
  ```json
24
24
  {
25
25
  "content": {
26
- "linkToken": "{linktoken}"
27
- },
26
+ "linkToken": "{linktoken}"
28
27
  },
29
28
  "status": "ok",
30
29
  "message": ""
@@ -66,17 +65,11 @@ linkConnection.openLink(linkToken)
66
65
  ℹ️ See full source code example at [react-example/src/ui/Link.tsx](../../examples/react-example/src/ui/Link.tsx)
67
66
 
68
67
  ```tsx
69
- import {
70
- createLink,
71
- Link,
72
- LinkPayload
73
- } from '@meshconnect/web-link-sdk'
68
+ import { createLink, Link, LinkPayload } from '@meshconnect/web-link-sdk'
74
69
 
75
70
  // ...
76
71
 
77
- const [linkConnection, setLinkConnection] = useState<Link | null>(
78
- null
79
- )
72
+ const [linkConnection, setLinkConnection] = useState<Link | null>(null)
80
73
 
81
74
  useEffect(() => {
82
75
  setLinkConnection(createLink(options))
@@ -102,21 +95,21 @@ After successfull authentication on the Link session, the popup will be closed a
102
95
 
103
96
  #### `createLink` arguments
104
97
 
105
- | key | type | description |
106
- |--------------------------|---------------------------------------------------------| ------------------------------------------------------------------------------------ |
107
- | `clientId` | `string` | Keys from https://dashboard.getfront.com/company/keys page |
108
- | `onIntegrationConnected` | `(payload: LinkPayload) => void` | Callback called when users connects their accounts |
109
- | `onExit` | `((error?: string \| undefined) => void) \| undefined` | Called if connection not happened |
110
- | `onTransferFinished` | `(payload: TransferFinishedPayload) => void` | Callback called when a crypto transfer is executed |
98
+ | key | type | description |
99
+ | ------------------------ | ------------------------------------------------------ | ------------------------------------------------------------------------------------ |
100
+ | `clientId` | `string` | Keys from https://dashboard.getfront.com/company/keys page |
101
+ | `onIntegrationConnected` | `(payload: LinkPayload) => void` | Callback called when users connects their accounts |
102
+ | `onExit` | `((error?: string \| undefined) => void) \| undefined` | Called if connection not happened |
103
+ | `onTransferFinished` | `(payload: TransferFinishedPayload) => void` | Callback called when a crypto transfer is executed |
111
104
  | `onEvent` | `(payload: LinkEventType) => void` | A callback function that is called when various events occur within the Front iframe |
112
- | `accessTokens` | `IntegrationAccessToken[]` | An array of integration access tokens |
105
+ | `accessTokens` | `IntegrationAccessToken[]` | An array of integration access tokens |
113
106
 
114
107
  #### `createLink` return value
115
108
 
116
- | key | type | description |
117
- | ------------ | -------------------------------------- | ------------------------------ |
118
- | `openLink` | `(linkToken: string) => Promise<void>` | Opens the Link UI popup |
119
- | `closeLink` | `() => Promise<void>` | Closes the Link UI popup |
109
+ | key | type | description |
110
+ | ----------- | -------------------------------------- | ------------------------ |
111
+ | `openLink` | `(linkToken: string) => Promise<void>` | Opens the Link UI popup |
112
+ | `closeLink` | `() => Promise<void>` | Closes the Link UI popup |
120
113
 
121
114
  ### Using tokens
122
115
 
package/cjs/Link.js CHANGED
@@ -1,4 +1,15 @@
1
1
  "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
2
13
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
14
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
15
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -39,13 +50,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
39
50
  exports.createLink = void 0;
40
51
  var popup_1 = require("./utils/popup");
41
52
  var event_types_1 = require("./utils/event-types");
53
+ var sdk_specs_1 = require("./utils/sdk-specs");
42
54
  var currentOptions;
43
55
  var iframeUrlObject;
44
56
  var iframeElement = function () {
45
57
  return document.getElementById(popup_1.iframeId);
46
58
  };
47
59
  function eventsListener(event) {
48
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
60
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
49
61
  switch (event.data.type) {
50
62
  case 'brokerageAccountAccessToken': {
51
63
  var payload = {
@@ -80,7 +92,8 @@ function eventsListener(event) {
80
92
  }
81
93
  case 'close':
82
94
  case 'done': {
83
- (_g = currentOptions === null || currentOptions === void 0 ? void 0 : currentOptions.onExit) === null || _g === void 0 ? void 0 : _g.call(currentOptions, event.data.message);
95
+ var payload = (_g = event.data) === null || _g === void 0 ? void 0 : _g.payload;
96
+ (_h = currentOptions === null || currentOptions === void 0 ? void 0 : currentOptions.onExit) === null || _h === void 0 ? void 0 : _h.call(currentOptions, payload === null || payload === void 0 ? void 0 : payload.errorMessage, payload);
84
97
  (0, popup_1.removePopup)();
85
98
  break;
86
99
  }
@@ -90,27 +103,31 @@ function eventsListener(event) {
90
103
  var h = 800;
91
104
  var left = screen.width / 2 - w / 2;
92
105
  var top_1 = screen.height / 2 - h / 2;
93
- (_h = window
94
- .open(event.data.link, '_blank', "popup,noopener,noreferrer,resizable,scrollbars,width=".concat(w, ",height=").concat(h, ",top=").concat(top_1, ",left=").concat(left))) === null || _h === void 0 ? void 0 : _h.focus();
106
+ (_j = window
107
+ .open(event.data.link, '_blank', "popup,noopener,noreferrer,resizable,scrollbars,width=".concat(w, ",height=").concat(h, ",top=").concat(top_1, ",left=").concat(left))) === null || _j === void 0 ? void 0 : _j.focus();
95
108
  }
96
109
  break;
97
110
  }
98
111
  case 'loaded': {
99
112
  if (currentOptions === null || currentOptions === void 0 ? void 0 : currentOptions.accessTokens) {
100
- (_j = iframeElement().contentWindow) === null || _j === void 0 ? void 0 : _j.postMessage({ type: 'frontAccessTokens', payload: currentOptions.accessTokens }, (iframeUrlObject === null || iframeUrlObject === void 0 ? void 0 : iframeUrlObject.origin) || 'https://web.meshconnect.com');
113
+ (_k = iframeElement().contentWindow) === null || _k === void 0 ? void 0 : _k.postMessage({
114
+ type: 'meshSDKSpecs',
115
+ payload: __assign({}, sdk_specs_1.sdkSpecs)
116
+ }, (iframeUrlObject === null || iframeUrlObject === void 0 ? void 0 : iframeUrlObject.origin) || 'https://web.meshconnect.com');
117
+ (_l = iframeElement().contentWindow) === null || _l === void 0 ? void 0 : _l.postMessage({ type: 'frontAccessTokens', payload: currentOptions.accessTokens }, (iframeUrlObject === null || iframeUrlObject === void 0 ? void 0 : iframeUrlObject.origin) || 'https://web.meshconnect.com');
101
118
  }
102
119
  if (currentOptions === null || currentOptions === void 0 ? void 0 : currentOptions.transferDestinationTokens) {
103
- (_k = iframeElement().contentWindow) === null || _k === void 0 ? void 0 : _k.postMessage({
120
+ (_m = iframeElement().contentWindow) === null || _m === void 0 ? void 0 : _m.postMessage({
104
121
  type: 'frontTransferDestinationTokens',
105
122
  payload: currentOptions.transferDestinationTokens
106
123
  }, (iframeUrlObject === null || iframeUrlObject === void 0 ? void 0 : iframeUrlObject.origin) || 'https://web.meshconnect.com');
107
124
  }
108
- (_l = currentOptions === null || currentOptions === void 0 ? void 0 : currentOptions.onEvent) === null || _l === void 0 ? void 0 : _l.call(currentOptions, { type: 'pageLoaded' });
125
+ (_o = currentOptions === null || currentOptions === void 0 ? void 0 : currentOptions.onEvent) === null || _o === void 0 ? void 0 : _o.call(currentOptions, { type: 'pageLoaded' });
109
126
  break;
110
127
  }
111
128
  default: {
112
129
  if ((0, event_types_1.isLinkEventTypeKey)(event.data.type)) {
113
- (_m = currentOptions === null || currentOptions === void 0 ? void 0 : currentOptions.onEvent) === null || _m === void 0 ? void 0 : _m.call(currentOptions, event.data);
130
+ (_p = currentOptions === null || currentOptions === void 0 ? void 0 : currentOptions.onEvent) === null || _p === void 0 ? void 0 : _p.call(currentOptions, event.data);
114
131
  }
115
132
  break;
116
133
  }
@@ -4,6 +4,10 @@ exports.isLinkEventTypeKey = void 0;
4
4
  var LINK_EVENT_TYPE_KEYS = [
5
5
  'integrationConnected',
6
6
  'integrationConnectionError',
7
+ 'integrationMfaRequired',
8
+ 'integrationMfaEntered',
9
+ 'integrationOAuthStarted',
10
+ 'integrationAccountSelectionRequired',
7
11
  'transferCompleted',
8
12
  'integrationSelected',
9
13
  'credentialsEntered',
@@ -11,7 +15,15 @@ var LINK_EVENT_TYPE_KEYS = [
11
15
  'transferPreviewed',
12
16
  'transferPreviewError',
13
17
  'transferExecutionError',
14
- 'pageLoaded'
18
+ 'pageLoaded',
19
+ 'transferAssetSelected',
20
+ 'transferNetworkSelected',
21
+ 'transferAmountEntered',
22
+ 'transferMfaRequired',
23
+ 'transferMfaEntered',
24
+ 'transferKycRequired',
25
+ 'done',
26
+ 'close'
15
27
  ];
16
28
  function isLinkEventTypeKey(key) {
17
29
  return LINK_EVENT_TYPE_KEYS.includes(key);
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.sdkSpecs = void 0;
4
+ var version_1 = require("./version");
5
+ exports.sdkSpecs = {
6
+ platform: 'web',
7
+ version: version_1.sdkVersion
8
+ };
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.sdkVersion = void 0;
4
+ exports.sdkVersion = '2.0.3';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@meshconnect/web-link-sdk",
3
- "version": "2.0.0",
3
+ "version": "2.0.3",
4
4
  "description": "A client-side JS library for integrating with Mesh Connect",
5
5
  "license": "MIT",
6
6
  "repository": "https://github.com/FrontFin/mesh-web-sdk.git",
@@ -14,13 +14,13 @@
14
14
  "eslint-plugin-prettier": "^3.4.0",
15
15
  "prettier": "^2.2.1",
16
16
  "typescript": "^4.6.4",
17
- "ts-jest": "^29.1.1",
18
- "jest": "^29.6.4",
19
- "@types/jest": "^29.5.4",
20
- "jest-environment-jsdom": "^29.6.4"
17
+ "ts-jest": "^29.1.2",
18
+ "jest": "^29.7.0",
19
+ "@types/jest": "^29.5.12",
20
+ "jest-environment-jsdom": "^29.7.0"
21
21
  },
22
22
  "dependencies": {
23
- "@meshconnect/node-api": "^2.0.0"
23
+ "@meshconnect/node-api": "^2.0.3"
24
24
  },
25
25
  "jest": {
26
26
  "preset": "ts-jest",
@@ -1,6 +1,6 @@
1
1
  import { LinkPayload, TransferFinishedPayload } from './types';
2
- export type LinkEventType = IntegrationConnected | IntegrationConnectionError | TransferCompleted | IntegrationSelected | CredentialsEntered | TransferStarted | TransferPreviewed | TransferPreviewError | TransferExecutionError | PageLoaded;
3
- declare const LINK_EVENT_TYPE_KEYS: readonly ["integrationConnected", "integrationConnectionError", "transferCompleted", "integrationSelected", "credentialsEntered", "transferStarted", "transferPreviewed", "transferPreviewError", "transferExecutionError", "pageLoaded"];
2
+ export type LinkEventType = IntegrationConnected | IntegrationConnectionError | TransferCompleted | IntegrationSelected | CredentialsEntered | TransferStarted | TransferPreviewed | TransferPreviewError | TransferExecutionError | PageLoaded | IntegrationMfaRequired | IntegrationMfaEntered | IntegrationOAuthStarted | IntegrationAccountSelectionRequired | TransferAssetSelected | TransferNetworkSelected | TransferAmountEntered | TransferMfaRequired | TransferMfaEntered | TransferKycRequired | DoneEvent | CloseEvent;
3
+ declare const LINK_EVENT_TYPE_KEYS: readonly ["integrationConnected", "integrationConnectionError", "integrationMfaRequired", "integrationMfaEntered", "integrationOAuthStarted", "integrationAccountSelectionRequired", "transferCompleted", "integrationSelected", "credentialsEntered", "transferStarted", "transferPreviewed", "transferPreviewError", "transferExecutionError", "pageLoaded", "transferAssetSelected", "transferNetworkSelected", "transferAmountEntered", "transferMfaRequired", "transferMfaEntered", "transferKycRequired", "done", "close"];
4
4
  export type LinkEventTypeKeys = (typeof LINK_EVENT_TYPE_KEYS)[number];
5
5
  export declare function isLinkEventTypeKey(key: string): key is LinkEventTypeKeys;
6
6
  interface LinkEventBase {
@@ -65,4 +65,88 @@ export interface TransferExecutionError extends LinkEventBase {
65
65
  errorMessage: string;
66
66
  };
67
67
  }
68
+ export interface IntegrationMfaRequired extends LinkEventBase {
69
+ type: 'integrationMfaRequired';
70
+ }
71
+ export interface IntegrationMfaEntered extends LinkEventBase {
72
+ type: 'integrationMfaEntered';
73
+ }
74
+ export interface IntegrationOAuthStarted extends LinkEventBase {
75
+ type: 'integrationOAuthStarted';
76
+ }
77
+ export interface IntegrationAccountSelectionRequired extends LinkEventBase {
78
+ type: 'integrationAccountSelectionRequired';
79
+ }
80
+ export interface TransferAssetSelected extends LinkEventBase {
81
+ type: 'transferAssetSelected';
82
+ payload: {
83
+ symbol: string;
84
+ };
85
+ }
86
+ export interface TransferNetworkSelected extends LinkEventBase {
87
+ type: 'transferNetworkSelected';
88
+ payload: {
89
+ id: string;
90
+ name: string;
91
+ };
92
+ }
93
+ export interface TransferAmountEntered extends LinkEventBase {
94
+ type: 'transferAmountEntered';
95
+ }
96
+ export interface TransferMfaRequired extends LinkEventBase {
97
+ type: 'transferMfaRequired';
98
+ }
99
+ export interface TransferMfaEntered extends LinkEventBase {
100
+ type: 'transferMfaEntered';
101
+ }
102
+ export interface TransferKycRequired extends LinkEventBase {
103
+ type: 'transferKycRequired';
104
+ }
105
+ export interface DoneEvent extends LinkEventBase {
106
+ type: 'done';
107
+ payload: SessionSymmary;
108
+ }
109
+ export interface CloseEvent extends LinkEventBase {
110
+ type: 'close';
111
+ payload: SessionSymmary;
112
+ }
113
+ export interface SessionSymmary {
114
+ /**
115
+ * Current page of application. Possible values:
116
+ * `startPage`
117
+ * `integrationsCatalogPage`
118
+ * `integrationLoginPage`
119
+ * `integrationMfaPage`
120
+ * `integrationAccountSelectPage`
121
+ * `integrationConnectedPage`
122
+ * `errorPage`
123
+ * `transferKycPage`
124
+ * `transferHoldingSelectionPage`
125
+ * `transferNetworkSelectionPage`
126
+ * `transferAmountSelectionPage`
127
+ * `transferPreviewPage`
128
+ * `transferMfaPage`
129
+ * `transferFundingPage`
130
+ * `transferExecutedPage`
131
+ * `termsAndConditionPage`
132
+ *
133
+ * This list may change in future.
134
+ */
135
+ page: string;
136
+ /** Selected integration */
137
+ selectedIntegration?: {
138
+ id?: string;
139
+ name?: string;
140
+ };
141
+ /** Transfer information */
142
+ transfer?: {
143
+ previewId?: string;
144
+ symbol?: string;
145
+ amount?: number;
146
+ amountInFiat?: number;
147
+ transactionId?: string;
148
+ networkId?: string;
149
+ };
150
+ errorMessage?: string;
151
+ }
68
152
  export {};
@@ -1,6 +1,10 @@
1
1
  var LINK_EVENT_TYPE_KEYS = [
2
2
  'integrationConnected',
3
3
  'integrationConnectionError',
4
+ 'integrationMfaRequired',
5
+ 'integrationMfaEntered',
6
+ 'integrationOAuthStarted',
7
+ 'integrationAccountSelectionRequired',
4
8
  'transferCompleted',
5
9
  'integrationSelected',
6
10
  'credentialsEntered',
@@ -8,7 +12,15 @@ var LINK_EVENT_TYPE_KEYS = [
8
12
  'transferPreviewed',
9
13
  'transferPreviewError',
10
14
  'transferExecutionError',
11
- 'pageLoaded'
15
+ 'pageLoaded',
16
+ 'transferAssetSelected',
17
+ 'transferNetworkSelected',
18
+ 'transferAmountEntered',
19
+ 'transferMfaRequired',
20
+ 'transferMfaEntered',
21
+ 'transferKycRequired',
22
+ 'done',
23
+ 'close'
12
24
  ];
13
25
  export function isLinkEventTypeKey(key) {
14
26
  return LINK_EVENT_TYPE_KEYS.includes(key);
@@ -0,0 +1,4 @@
1
+ export declare const sdkSpecs: {
2
+ platform: string;
3
+ version: string;
4
+ };
@@ -0,0 +1,5 @@
1
+ import { sdkVersion } from './version';
2
+ export var sdkSpecs = {
3
+ platform: 'web',
4
+ version: sdkVersion
5
+ };
package/utils/types.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import type { BrokerType } from '@meshconnect/node-api';
2
- import { LinkEventType } from './event-types';
3
- export type EventType = 'brokerageAccountAccessToken' | 'delayedAuthentication' | 'close' | 'done' | 'loaded' | 'oauthLinkOpen' | 'transferFinished';
2
+ import { SessionSymmary, LinkEventType } from './event-types';
3
+ export type EventType = 'brokerageAccountAccessToken' | 'delayedAuthentication' | 'loaded' | 'oauthLinkOpen' | 'transferFinished';
4
4
  export interface Link {
5
5
  /**
6
6
  * A function that takes linkToken parameter from `/api/v1/linktoken` endpoint as an input, and opens the Link UI popup
@@ -46,7 +46,7 @@ export interface DelayedAuthPayload {
46
46
  brokerName: string;
47
47
  brokerBrandInfo: BrandInfo;
48
48
  }
49
- export interface TransferFinishedSuccessPayload {
49
+ export interface TransferFinishedPayload {
50
50
  status: 'success';
51
51
  txId: string;
52
52
  fromAddress: string;
@@ -55,11 +55,6 @@ export interface TransferFinishedSuccessPayload {
55
55
  amount: number;
56
56
  networkId: string;
57
57
  }
58
- export interface TransferFinishedErrorPayload {
59
- status: 'error';
60
- errorMessage: string;
61
- }
62
- export type TransferFinishedPayload = TransferFinishedSuccessPayload | TransferFinishedErrorPayload;
63
58
  export interface IntegrationAccessToken {
64
59
  accountId: string;
65
60
  accountName: string;
@@ -80,7 +75,7 @@ export interface LinkOptions {
80
75
  /**
81
76
  * (Optional) A callback function that is called when the Front iframe is closed.
82
77
  */
83
- onExit?: (error?: string) => void;
78
+ onExit?: (error?: string, summary?: SessionSymmary) => void;
84
79
  /**
85
80
  * (Optional) A callback function that is called when a transfer is finished.
86
81
  * It receives a payload of type `TransferFinishedPayload`.
@@ -0,0 +1 @@
1
+ export declare const sdkVersion = "2.0.3";
@@ -0,0 +1 @@
1
+ export var sdkVersion = '2.0.3';