@meshconnect/web-link-sdk 3.9.7 → 3.9.8

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
@@ -45,7 +45,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
45
45
  if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
46
46
  }
47
47
  };
48
- import { addPopup, iframeId, removePopup } from './utils/popup';
48
+ import { addPopup, buildIframeAllowPolicy, iframeId, removePopup } from './utils/popup';
49
49
  import { isLinkEventTypeKey } from './utils/event-types';
50
50
  import { sdkSpecs } from './utils/sdk-specs';
51
51
  import { appendQueryParam } from './utils/url';
@@ -195,7 +195,7 @@ export var createLink = function (options) {
195
195
  if (customIframeId) {
196
196
  var iframe_1 = document.getElementById(customIframeId);
197
197
  if (iframe_1) {
198
- iframe_1.allow = 'clipboard-read *; clipboard-write *';
198
+ iframe_1.allow = buildIframeAllowPolicy(linkTokenOrigin);
199
199
  iframe_1.src = linkUrl;
200
200
  currentIframeId = customIframeId;
201
201
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@meshconnect/web-link-sdk",
3
- "version": "3.9.7",
3
+ "version": "3.9.8",
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,4 @@
1
1
  export declare const iframeId = "mesh-link-popup__iframe";
2
+ export declare function buildIframeAllowPolicy(origin: string): string;
2
3
  export declare function removePopup(): void;
3
4
  export declare function addPopup(iframeLink: string): void;
package/utils/popup.js CHANGED
@@ -5,6 +5,9 @@ var popupContentId = 'mesh-link-popup__popup-content';
5
5
  var stylesId = 'mesh-link-popup__styles';
6
6
  export var iframeId = 'mesh-link-popup__iframe';
7
7
  var getStylesContent = function (style) { return "\n body {\n position: fixed;\n left: 0;\n top: 0;\n bottom: 0;\n right: 0;\n overflow: hidden;\n }\n\n #".concat(popupId, " {\n all: unset;\n position: fixed;\n left: 0;\n top: 0;\n bottom: 0;\n right: 0;\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n z-index: 10000;\n pointer-events: auto;\n }\n\n #").concat(backdropId, " {\n position: absolute;\n left: 0;\n top: 0;\n bottom: 0;\n right: 0;\n z-index: 10000;\n background: black;\n opacity: ").concat(getNumber(0.6, style === null || style === void 0 ? void 0 : style.io), ";\n }\n\n #").concat(popupContentId, " {\n position: absolute;\n height: 80%;\n max-height: 710px;\n min-height: 685px;\n margin: auto;\n z-index: 10001;\n width: 30%;\n max-width: 430px;\n min-width: 380px;\n display: flex;\n flex-direction: column;\n border-radius: ").concat(getNumber(24, style === null || style === void 0 ? void 0 : style.ir), "px;\n flex-grow: 1;\n }\n\n #").concat(popupContentId, " iframe {\n border: none;\n width: 100%;\n flex-grow: 1;\n border-radius: ").concat(getNumber(24, style === null || style === void 0 ? void 0 : style.ir), "px;\n }\n\n @media only screen and (max-width: 768px) {\n #").concat(popupContentId, " {\n height: 100vh;\n width: 100vw;\n max-width: 100%;\n min-width: 100%;\n max-height: 100%;\n min-height: 100%;\n border-radius: 0px;\n }\n\n #").concat(popupContentId, " iframe {\n border-radius: 0px;\n }\n }\n\n @media only screen and (max-height: 710px) {\n #").concat(popupContentId, " {\n max-height: 100%;\n min-height: 100%;\n }\n }\n"); };
8
+ export function buildIframeAllowPolicy(origin) {
9
+ return "clipboard-read *; clipboard-write *; camera ".concat(origin, "; microphone ").concat(origin);
10
+ }
8
11
  export function removePopup() {
9
12
  var _a, _b;
10
13
  var existingPopup = window.document.getElementById(popupId);
@@ -29,7 +32,7 @@ export function addPopup(iframeLink) {
29
32
  var iframeElement = document.createElement('iframe');
30
33
  iframeElement.id = iframeId;
31
34
  iframeElement.src = iframeLink;
32
- iframeElement.allow = 'clipboard-read *; clipboard-write *';
35
+ iframeElement.allow = buildIframeAllowPolicy(new URL(iframeLink).origin);
33
36
  popupContentElement.appendChild(iframeElement);
34
37
  popupRootElement.appendChild(popupContentElement);
35
38
  window.document.body.appendChild(popupRootElement);
@@ -1 +1 @@
1
- export declare const sdkVersion = "3.9.7";
1
+ export declare const sdkVersion = "3.9.8";
package/utils/version.js CHANGED
@@ -1 +1 @@
1
- export var sdkVersion = '3.9.7';
1
+ export var sdkVersion = '3.9.8';