@apideck/vault-js
Advanced tools
Comparing version
@@ -54,4 +54,4 @@ 'use strict'; | ||
if (event.data === 'on-close') { | ||
window.removeEventListener('message', onMessage); | ||
onClose == null ? void 0 : onClose(); | ||
window.removeEventListener('message', onMessage); | ||
// Remove the iframe from the DOM after transition animation | ||
@@ -61,2 +61,3 @@ setTimeout(function () { | ||
document.body.removeChild(modal); | ||
modal = null; | ||
}, 300); | ||
@@ -80,7 +81,6 @@ } | ||
var _modal, _modal$contentWindow2; | ||
if (modal === null) return; | ||
(_modal = modal) == null ? void 0 : (_modal$contentWindow2 = _modal.contentWindow) == null ? void 0 : _modal$contentWindow2.postMessage({ | ||
type: 'close' | ||
}, vaultIframeUrl); | ||
// Remove the iframe from the DOM after transition animation | ||
// Fallback remove the iframe from the DOM in case the iframe doesn't send a message | ||
setTimeout(function () { | ||
@@ -90,3 +90,3 @@ if (modal === null) return; | ||
modal = null; | ||
}, 300); | ||
}, 500); | ||
} | ||
@@ -93,0 +93,0 @@ }; |
@@ -1,2 +0,2 @@ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=["onClose","onReady","onConnectionChange","onConnectionDelete"];exports.ApideckVault=function(){var n=null;return{open:function(t){var o=t.onClose,l=t.onReady,a=t.onConnectionChange,s=t.onConnectionDelete,d=function(e,n){if(null==e)return{};var t,o,l={},a=Object.keys(e);for(o=0;o<a.length;o++)n.indexOf(t=a[o])>=0||(l[t]=e[t]);return l}(t,e);n=function(){var e=document.createElement("iframe");return e.style.display="none",e.style.position="fixed",e.style.top="0",e.style.left="0",e.style.width="100%",e.style.height="100%",e.style.border="none",e.style.zIndex="9999",e.src="https://vaultjs.apideck.com",e}(),document.body.appendChild(n),window.addEventListener("message",(function e(t){var i,c,u;if(null!==n&&("on-ready"===t.data&&(n.style.display="block",null==(c=n.contentWindow)||c.postMessage(d,"https://vaultjs.apideck.com"),null==l||l()),"on-close"===t.data&&(null==o||o(),window.removeEventListener("message",e),setTimeout((function(){null!==n&&document.body.removeChild(n)}),300)),"object"==typeof t.data&&null!=(i=t.data)&&i.data))switch(null==(u=t.data)?void 0:u.type){case"on-connection-change":null==a||a(t.data.data);break;case"on-connection-delete":null==s||s(t.data.data)}}))},close:function(){var e,t;null!==n&&(null==(e=n)||null==(t=e.contentWindow)||t.postMessage({type:"close"},"https://vaultjs.apideck.com"),setTimeout((function(){null!==n&&(document.body.removeChild(n),n=null)}),300))}}}(); | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=["onClose","onReady","onConnectionChange","onConnectionDelete"];exports.ApideckVault=function(){var n=null;return{open:function(t){var o=t.onClose,l=t.onReady,a=t.onConnectionChange,s=t.onConnectionDelete,d=function(e,n){if(null==e)return{};var t,o,l={},a=Object.keys(e);for(o=0;o<a.length;o++)n.indexOf(t=a[o])>=0||(l[t]=e[t]);return l}(t,e);n=function(){var e=document.createElement("iframe");return e.style.display="none",e.style.position="fixed",e.style.top="0",e.style.left="0",e.style.width="100%",e.style.height="100%",e.style.border="none",e.style.zIndex="9999",e.src="https://vaultjs.apideck.com",e}(),document.body.appendChild(n),window.addEventListener("message",(function e(t){var i,c,u;if(null!==n&&("on-ready"===t.data&&(n.style.display="block",null==(c=n.contentWindow)||c.postMessage(d,"https://vaultjs.apideck.com"),null==l||l()),"on-close"===t.data&&(window.removeEventListener("message",e),null==o||o(),setTimeout((function(){null!==n&&(document.body.removeChild(n),n=null)}),300)),"object"==typeof t.data&&null!=(i=t.data)&&i.data))switch(null==(u=t.data)?void 0:u.type){case"on-connection-change":null==a||a(t.data.data);break;case"on-connection-delete":null==s||s(t.data.data)}}))},close:function(){var e,t;null==(e=n)||null==(t=e.contentWindow)||t.postMessage({type:"close"},"https://vaultjs.apideck.com"),setTimeout((function(){null!==n&&(document.body.removeChild(n),n=null)}),500)}}}(); | ||
//# sourceMappingURL=vault-js.cjs.production.min.js.map |
@@ -50,4 +50,4 @@ function _objectWithoutPropertiesLoose(source, excluded) { | ||
if (event.data === 'on-close') { | ||
window.removeEventListener('message', onMessage); | ||
onClose == null ? void 0 : onClose(); | ||
window.removeEventListener('message', onMessage); | ||
// Remove the iframe from the DOM after transition animation | ||
@@ -57,2 +57,3 @@ setTimeout(function () { | ||
document.body.removeChild(modal); | ||
modal = null; | ||
}, 300); | ||
@@ -76,7 +77,6 @@ } | ||
var _modal, _modal$contentWindow2; | ||
if (modal === null) return; | ||
(_modal = modal) == null ? void 0 : (_modal$contentWindow2 = _modal.contentWindow) == null ? void 0 : _modal$contentWindow2.postMessage({ | ||
type: 'close' | ||
}, vaultIframeUrl); | ||
// Remove the iframe from the DOM after transition animation | ||
// Fallback remove the iframe from the DOM in case the iframe doesn't send a message | ||
setTimeout(function () { | ||
@@ -86,3 +86,3 @@ if (modal === null) return; | ||
modal = null; | ||
}, 300); | ||
}, 500); | ||
} | ||
@@ -89,0 +89,0 @@ }; |
@@ -56,4 +56,4 @@ (function (global, factory) { | ||
if (event.data === 'on-close') { | ||
window.removeEventListener('message', onMessage); | ||
onClose == null ? void 0 : onClose(); | ||
window.removeEventListener('message', onMessage); | ||
// Remove the iframe from the DOM after transition animation | ||
@@ -63,2 +63,3 @@ setTimeout(function () { | ||
document.body.removeChild(modal); | ||
modal = null; | ||
}, 300); | ||
@@ -82,7 +83,6 @@ } | ||
var _modal, _modal$contentWindow2; | ||
if (modal === null) return; | ||
(_modal = modal) == null ? void 0 : (_modal$contentWindow2 = _modal.contentWindow) == null ? void 0 : _modal$contentWindow2.postMessage({ | ||
type: 'close' | ||
}, vaultIframeUrl); | ||
// Remove the iframe from the DOM after transition animation | ||
// Fallback remove the iframe from the DOM in case the iframe doesn't send a message | ||
setTimeout(function () { | ||
@@ -92,3 +92,3 @@ if (modal === null) return; | ||
modal = null; | ||
}, 300); | ||
}, 500); | ||
} | ||
@@ -95,0 +95,0 @@ }; |
@@ -1,2 +0,2 @@ | ||
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):(e=e||self).ApideckVault=n()}(this,(function(){"use strict";var e=["onClose","onReady","onConnectionChange","onConnectionDelete"];return function(){var n=null;return{open:function(t){var o=t.onClose,l=t.onReady,a=t.onConnectionChange,d=t.onConnectionDelete,i=function(e,n){if(null==e)return{};var t,o,l={},a=Object.keys(e);for(o=0;o<a.length;o++)n.indexOf(t=a[o])>=0||(l[t]=e[t]);return l}(t,e);n=function(){var e=document.createElement("iframe");return e.style.display="none",e.style.position="fixed",e.style.top="0",e.style.left="0",e.style.width="100%",e.style.height="100%",e.style.border="none",e.style.zIndex="9999",e.src="https://vaultjs.apideck.com",e}(),document.body.appendChild(n),window.addEventListener("message",(function e(t){var s,c,u;if(null!==n&&("on-ready"===t.data&&(n.style.display="block",null==(c=n.contentWindow)||c.postMessage(i,"https://vaultjs.apideck.com"),null==l||l()),"on-close"===t.data&&(null==o||o(),window.removeEventListener("message",e),setTimeout((function(){null!==n&&document.body.removeChild(n)}),300)),"object"==typeof t.data&&null!=(s=t.data)&&s.data))switch(null==(u=t.data)?void 0:u.type){case"on-connection-change":null==a||a(t.data.data);break;case"on-connection-delete":null==d||d(t.data.data)}}))},close:function(){var e,t;null!==n&&(null==(e=n)||null==(t=e.contentWindow)||t.postMessage({type:"close"},"https://vaultjs.apideck.com"),setTimeout((function(){null!==n&&(document.body.removeChild(n),n=null)}),300))}}}()})); | ||
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):(e=e||self).ApideckVault=n()}(this,(function(){"use strict";var e=["onClose","onReady","onConnectionChange","onConnectionDelete"];return function(){var n=null;return{open:function(t){var o=t.onClose,l=t.onReady,a=t.onConnectionChange,d=t.onConnectionDelete,i=function(e,n){if(null==e)return{};var t,o,l={},a=Object.keys(e);for(o=0;o<a.length;o++)n.indexOf(t=a[o])>=0||(l[t]=e[t]);return l}(t,e);n=function(){var e=document.createElement("iframe");return e.style.display="none",e.style.position="fixed",e.style.top="0",e.style.left="0",e.style.width="100%",e.style.height="100%",e.style.border="none",e.style.zIndex="9999",e.src="https://vaultjs.apideck.com",e}(),document.body.appendChild(n),window.addEventListener("message",(function e(t){var s,c,u;if(null!==n&&("on-ready"===t.data&&(n.style.display="block",null==(c=n.contentWindow)||c.postMessage(i,"https://vaultjs.apideck.com"),null==l||l()),"on-close"===t.data&&(window.removeEventListener("message",e),null==o||o(),setTimeout((function(){null!==n&&(document.body.removeChild(n),n=null)}),300)),"object"==typeof t.data&&null!=(s=t.data)&&s.data))switch(null==(u=t.data)?void 0:u.type){case"on-connection-change":null==a||a(t.data.data);break;case"on-connection-delete":null==d||d(t.data.data)}}))},close:function(){var e,t;null==(e=n)||null==(t=e.contentWindow)||t.postMessage({type:"close"},"https://vaultjs.apideck.com"),setTimeout((function(){null!==n&&(document.body.removeChild(n),n=null)}),500)}}}()})); | ||
//# sourceMappingURL=vault-js.umd.production.min.js.map |
{ | ||
"version": "1.3.2", | ||
"version": "1.3.3", | ||
"license": "MIT", | ||
@@ -4,0 +4,0 @@ "main": "dist/index.js", |
@@ -12,3 +12,3 @@ <img src="https://user-images.githubusercontent.com/8850410/208065819-716c6e02-98c9-4df5-b687-e5acd1e3c4e5.png" width="100%" /> | ||
**Vault JS** | [React Vault](https://github.com/apideck-libraries/react-vault) | [Vue Vault](https://github.com/apideck-libraries/vue-vault) | ||
**Vault JS** | [React Vault](https://github.com/apideck-libraries/vault-react) | [Vue Vault](https://github.com/apideck-libraries/vue-vault) | ||
@@ -15,0 +15,0 @@ ## Installation |
@@ -46,4 +46,4 @@ import { ApideckVaultOptions } from './types'; | ||
if (event.data === 'on-close') { | ||
window.removeEventListener('message', onMessage); | ||
onClose?.(); | ||
window.removeEventListener('message', onMessage); | ||
@@ -55,2 +55,3 @@ // Remove the iframe from the DOM after transition animation | ||
document.body.removeChild(modal); | ||
modal = null; | ||
}, 300); | ||
@@ -74,6 +75,5 @@ } | ||
close(): any { | ||
if (modal === null) return; | ||
modal?.contentWindow?.postMessage({ type: 'close' }, vaultIframeUrl); | ||
// Remove the iframe from the DOM after transition animation | ||
// Fallback remove the iframe from the DOM in case the iframe doesn't send a message | ||
setTimeout(() => { | ||
@@ -83,3 +83,3 @@ if (modal === null) return; | ||
modal = null; | ||
}, 300); | ||
}, 500); | ||
}, | ||
@@ -86,0 +86,0 @@ }; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
110906
103.86%25
25%1137
97.4%