@meshconnect/web-link-sdk 3.1.3 → 3.1.5
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 +1 -1
- package/README.md +6 -5
- package/package.json +1 -1
- package/utils/popup.d.ts +1 -1
- package/utils/popup.js +4 -1
- package/utils/types.d.ts +5 -0
- package/utils/version.d.ts +1 -1
- package/utils/version.js +1 -1
package/Link.js
CHANGED
@@ -386,7 +386,7 @@ export var createLink = function (options) {
|
|
386
386
|
possibleOrigins.add(iframeUrlObject.origin);
|
387
387
|
}
|
388
388
|
window.removeEventListener('message', eventsListener);
|
389
|
-
addPopup(linkUrl);
|
389
|
+
addPopup(linkUrl, currentOptions === null || currentOptions === void 0 ? void 0 : currentOptions.language);
|
390
390
|
window.addEventListener('message', eventsListener);
|
391
391
|
return [2 /*return*/];
|
392
392
|
});
|
package/README.md
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
A client-side JS library for integrating with Mesh Connect
|
4
4
|
|
5
|
-
|
5
|
+
## Install
|
6
6
|
|
7
7
|
With `npm`:
|
8
8
|
|
@@ -16,7 +16,7 @@ With `yarn`
|
|
16
16
|
yarn add @meshconnect/web-link-sdk
|
17
17
|
```
|
18
18
|
|
19
|
-
|
19
|
+
## Getting Link token
|
20
20
|
|
21
21
|
Link token should be obtained from the GET `/api/v1/linktoken` endpoint. Api reference for this request is available [here](https://docs.meshconnect.com/api-reference/managed-account-authentication/get-link-token-with-parameters). Request must be preformed from the server side because it requires the client secret. You will get the response in the following format:
|
22
22
|
|
@@ -32,7 +32,7 @@ Link token should be obtained from the GET `/api/v1/linktoken` endpoint. Api ref
|
|
32
32
|
|
33
33
|
You can use `linkToken` value from this response to open the popup window with `openLink` method.
|
34
34
|
|
35
|
-
|
35
|
+
## Generating connection method
|
36
36
|
|
37
37
|
```tsx
|
38
38
|
import { createLink } from '@meshconnect/web-link-sdk';
|
@@ -54,7 +54,7 @@ const linkConnection = createLink({
|
|
54
54
|
|
55
55
|
```
|
56
56
|
|
57
|
-
|
57
|
+
## Using connection to open auth link
|
58
58
|
|
59
59
|
To open authentication link provided by Front Finance Integration API you need to call `openLink` method:
|
60
60
|
|
@@ -84,7 +84,7 @@ useEffect(() => {
|
|
84
84
|
return <></>
|
85
85
|
```
|
86
86
|
|
87
|
-
|
87
|
+
## Getting tokens
|
88
88
|
|
89
89
|
After successfull authentication on the Link session, the popup will be closed and the broker tokens will be passed to the `onIntegrationConnected` function.
|
90
90
|
`Link` instance will check if URL contains query parameters, load broker tokens and fire the events.
|
@@ -103,6 +103,7 @@ After successfull authentication on the Link session, the popup will be closed a
|
|
103
103
|
| `onTransferFinished` | `(payload: TransferFinishedPayload) => void` | Callback called when a crypto transfer is executed |
|
104
104
|
| `onEvent` | `(payload: LinkEventType) => void` | A callback function that is called when various events occur within the Front iframe |
|
105
105
|
| `accessTokens` | `IntegrationAccessToken[]` | An array of integration access tokens |
|
106
|
+
| `language` | `'en' \| undefined` | Link UI language |
|
106
107
|
|
107
108
|
#### `createLink` return value
|
108
109
|
|
package/package.json
CHANGED
package/utils/popup.d.ts
CHANGED
package/utils/popup.js
CHANGED
@@ -12,13 +12,16 @@ export function removePopup() {
|
|
12
12
|
var existingStyles = window.document.getElementById(stylesId);
|
13
13
|
(_b = existingStyles === null || existingStyles === void 0 ? void 0 : existingStyles.parentElement) === null || _b === void 0 ? void 0 : _b.removeChild(existingStyles);
|
14
14
|
}
|
15
|
-
export function addPopup(iframeLink) {
|
15
|
+
export function addPopup(iframeLink, language) {
|
16
16
|
removePopup();
|
17
17
|
var styleElement = document.createElement('style');
|
18
18
|
styleElement.id = stylesId;
|
19
19
|
var style = getLinkStyle(iframeLink);
|
20
20
|
styleElement.textContent = getStylesContent(style);
|
21
21
|
window.document.head.appendChild(styleElement);
|
22
|
+
if (language) {
|
23
|
+
iframeLink = "".concat(iframeLink).concat(iframeLink.includes('?') ? '&' : '?', "lng=").concat(language);
|
24
|
+
}
|
22
25
|
var popupRootElement = document.createElement('div');
|
23
26
|
popupRootElement.id = popupId;
|
24
27
|
var popupBackdropElement = document.createElement('div');
|
package/utils/types.d.ts
CHANGED
@@ -26,6 +26,7 @@ export interface Account {
|
|
26
26
|
}
|
27
27
|
export interface BrandInfo {
|
28
28
|
brokerLogo: string;
|
29
|
+
brokerLogoUrl?: string;
|
29
30
|
brokerPrimaryColor?: string;
|
30
31
|
}
|
31
32
|
export interface LinkPayload {
|
@@ -141,6 +142,10 @@ export interface LinkOptions {
|
|
141
142
|
* Can be used to initialize the crypto transfers flow as an alternative to the target addresses.
|
142
143
|
*/
|
143
144
|
transferDestinationTokens?: IntegrationAccessToken[];
|
145
|
+
/**
|
146
|
+
* Link UI language. Right now only 'en' is supported.
|
147
|
+
*/
|
148
|
+
language?: 'en';
|
144
149
|
}
|
145
150
|
export interface LinkStyle {
|
146
151
|
ir: number;
|
package/utils/version.d.ts
CHANGED
@@ -1 +1 @@
|
|
1
|
-
export declare const sdkVersion = "3.1.
|
1
|
+
export declare const sdkVersion = "3.1.5";
|
package/utils/version.js
CHANGED
@@ -1 +1 @@
|
|
1
|
-
export var sdkVersion = '3.1.
|
1
|
+
export var sdkVersion = '3.1.5';
|