@meshconnect/web-link-sdk 3.1.3 → 3.1.4

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
@@ -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
- ### Install
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
- ### Getting Link token
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
- ### Generating connection method
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
- ### Using connection to open auth link
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
- ### Getting tokens
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@meshconnect/web-link-sdk",
3
- "version": "3.1.3",
3
+ "version": "3.1.4",
4
4
  "description": "A client-side JS library for integrating with Mesh Connect",
5
5
  "exports": "./index.js",
6
6
  "license": "MIT",
package/utils/popup.d.ts CHANGED
@@ -1,3 +1,3 @@
1
1
  export declare const iframeId = "mesh-link-popup__iframe";
2
2
  export declare function removePopup(): void;
3
- export declare function addPopup(iframeLink: string): void;
3
+ export declare function addPopup(iframeLink: string, language: string | undefined): void;
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
@@ -141,6 +141,10 @@ export interface LinkOptions {
141
141
  * Can be used to initialize the crypto transfers flow as an alternative to the target addresses.
142
142
  */
143
143
  transferDestinationTokens?: IntegrationAccessToken[];
144
+ /**
145
+ * Link UI language. Right now only 'en' is supported.
146
+ */
147
+ language?: 'en';
144
148
  }
145
149
  export interface LinkStyle {
146
150
  ir: number;
@@ -1 +1 @@
1
- export declare const sdkVersion = "3.1.3";
1
+ export declare const sdkVersion = "3.1.4";
package/utils/version.js CHANGED
@@ -1 +1 @@
1
- export var sdkVersion = '3.1.3';
1
+ export var sdkVersion = '3.1.4';