@meshconnect/web-link-sdk 2.1.1 → 3.0.0-rc.1

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/cjs/index.js DELETED
@@ -1,21 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- exports.createLink = void 0;
18
- __exportStar(require("./utils/types"), exports);
19
- __exportStar(require("./utils/event-types"), exports);
20
- var Link_1 = require("./Link");
21
- Object.defineProperty(exports, "createLink", { enumerable: true, get: function () { return Link_1.createLink; } });
@@ -1,31 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isLinkEventTypeKey = void 0;
4
- var LINK_EVENT_TYPE_KEYS = [
5
- 'integrationConnected',
6
- 'integrationConnectionError',
7
- 'integrationMfaRequired',
8
- 'integrationMfaEntered',
9
- 'integrationOAuthStarted',
10
- 'integrationAccountSelectionRequired',
11
- 'transferCompleted',
12
- 'integrationSelected',
13
- 'credentialsEntered',
14
- 'transferStarted',
15
- 'transferPreviewed',
16
- 'transferPreviewError',
17
- 'transferExecutionError',
18
- 'pageLoaded',
19
- 'transferAssetSelected',
20
- 'transferNetworkSelected',
21
- 'transferAmountEntered',
22
- 'transferMfaRequired',
23
- 'transferMfaEntered',
24
- 'transferKycRequired',
25
- 'done',
26
- 'close'
27
- ];
28
- function isLinkEventTypeKey(key) {
29
- return LINK_EVENT_TYPE_KEYS.includes(key);
30
- }
31
- exports.isLinkEventTypeKey = isLinkEventTypeKey;
@@ -1,39 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.addPopup = exports.removePopup = exports.iframeId = void 0;
4
- var style_1 = require("./style");
5
- var popupId = 'mesh-link-popup';
6
- var backdropId = 'mesh-link-popup__backdrop';
7
- var popupContentId = 'mesh-link-popup__popup-content';
8
- var stylesId = 'mesh-link-popup__styles';
9
- exports.iframeId = 'mesh-link-popup__iframe';
10
- var getPopupHtml = function (link) { return "\n<div id=\"".concat(popupId, "\">\n <div id=\"").concat(backdropId, "\"></div>\n <div id=\"").concat(popupContentId, "\">\n <iframe id=\"").concat(exports.iframeId, "\" src=\"").concat(link, "\" allow=\"clipboard-read *; clipboard-write *\" />\n </div>\n</div>\n"); };
11
- var getStyles = function (style) { return "\n<style id=\"".concat(stylesId, "\">\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 }\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((0, style_1.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((0, style_1.getNumber)(24, style === null || style === void 0 ? void 0 : style.ir), "px;\n background: white;\n flex-grow: 1;\n }\n\n #").concat(popupContentId, " iframe {\n border: none;\n width: 100%;\n flex-grow: 1;\n border-radius: ").concat((0, style_1.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</style>\n"); };
12
- function removePopup() {
13
- var _a, _b;
14
- var existingPopup = window.document.getElementById(popupId);
15
- (_a = existingPopup === null || existingPopup === void 0 ? void 0 : existingPopup.parentElement) === null || _a === void 0 ? void 0 : _a.removeChild(existingPopup);
16
- var existingStyles = window.document.getElementById(stylesId);
17
- (_b = existingStyles === null || existingStyles === void 0 ? void 0 : existingStyles.parentElement) === null || _b === void 0 ? void 0 : _b.removeChild(existingStyles);
18
- }
19
- exports.removePopup = removePopup;
20
- function addPopup(iframeLink) {
21
- var style = (0, style_1.getLinkStyle)(iframeLink);
22
- removePopup();
23
- var popup = getPopupHtml(iframeLink);
24
- var stylesElement = htmlToElement(getStyles(style));
25
- if (stylesElement) {
26
- window.document.head.appendChild(stylesElement);
27
- }
28
- var popupElement = htmlToElement(popup);
29
- if (popupElement) {
30
- window.document.body.appendChild(popupElement);
31
- }
32
- }
33
- exports.addPopup = addPopup;
34
- function htmlToElement(html) {
35
- var template = document.createElement('template');
36
- html = html.trim();
37
- template.innerHTML = html;
38
- return template.content.firstChild;
39
- }
@@ -1,8 +0,0 @@
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
- };
@@ -1,18 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getNumber = exports.getLinkStyle = void 0;
4
- function getLinkStyle(url) {
5
- try {
6
- var params = new URLSearchParams(new URL(url).search);
7
- var style = params.get('link_style');
8
- return style && JSON.parse(window.atob(style));
9
- }
10
- catch (e) {
11
- return undefined;
12
- }
13
- }
14
- exports.getLinkStyle = getLinkStyle;
15
- function getNumber(def, value) {
16
- return value !== undefined ? value : def;
17
- }
18
- exports.getNumber = getNumber;
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,4 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.sdkVersion = void 0;
4
- exports.sdkVersion = '2.1.1';