@integration-app/sdk
Advanced tools
Comparing version 0.0.6 to 0.0.7
@@ -665,2 +665,4 @@ (function (global, factory) { | ||
const BODY_CLASS = '__integration-app-open'; | ||
let initialized = false; | ||
let handshakeTimeout = null; | ||
/* | ||
@@ -675,3 +677,4 @@ Open a full-page iframe with a given URI and | ||
return __awaiter(this, void 0, void 0, function* () { | ||
{ | ||
if (!initialized) { | ||
initialized = true; | ||
yield init(); | ||
@@ -681,2 +684,11 @@ } | ||
close(); | ||
console.log('Setting handshake timeout'); | ||
handshakeTimeout = setTimeout(() => { | ||
console.log('Handhsake timeout expired'); | ||
console.error('It takes too long for Integration UI to load. Something must be wrong.'); | ||
close(); | ||
}, 5000); | ||
function handshake() { | ||
clearHandshakeTimeout(); | ||
} | ||
function doOpen() { | ||
@@ -692,3 +704,3 @@ const iframe = document.createElement('iframe'); | ||
iframe, | ||
methods: Object.assign(Object.assign({}, callbacks), { close }), | ||
methods: Object.assign(Object.assign({}, callbacks), { close, handshake }), | ||
}); | ||
@@ -721,2 +733,3 @@ } | ||
} | ||
clearHandshakeTimeout(); | ||
} | ||
@@ -751,2 +764,8 @@ function init() { | ||
exports.init = init; | ||
function clearHandshakeTimeout() { | ||
if (handshakeTimeout) { | ||
clearTimeout(handshakeTimeout); | ||
handshakeTimeout = null; | ||
} | ||
} | ||
}); | ||
@@ -753,0 +772,0 @@ |
@@ -17,3 +17,4 @@ "use strict"; | ||
const BODY_CLASS = '__integration-app-open'; | ||
const initialized = false; | ||
let initialized = false; | ||
let handshakeTimeout = null; | ||
/* | ||
@@ -29,2 +30,3 @@ Open a full-page iframe with a given URI and | ||
if (!initialized) { | ||
initialized = true; | ||
yield init(); | ||
@@ -34,2 +36,11 @@ } | ||
close(); | ||
console.log('Setting handshake timeout'); | ||
handshakeTimeout = setTimeout(() => { | ||
console.log('Handhsake timeout expired'); | ||
console.error('It takes too long for Integration UI to load. Something must be wrong.'); | ||
close(); | ||
}, 5000); | ||
function handshake() { | ||
clearHandshakeTimeout(); | ||
} | ||
function doOpen() { | ||
@@ -45,3 +56,3 @@ const iframe = document.createElement('iframe'); | ||
iframe, | ||
methods: Object.assign(Object.assign({}, callbacks), { close }), | ||
methods: Object.assign(Object.assign({}, callbacks), { close, handshake }), | ||
}); | ||
@@ -74,2 +85,3 @@ } | ||
} | ||
clearHandshakeTimeout(); | ||
} | ||
@@ -104,1 +116,7 @@ function init() { | ||
exports.init = init; | ||
function clearHandshakeTimeout() { | ||
if (handshakeTimeout) { | ||
clearTimeout(handshakeTimeout); | ||
handshakeTimeout = null; | ||
} | ||
} |
{ | ||
"name": "@integration-app/sdk", | ||
"version": "0.0.6", | ||
"version": "0.0.7", | ||
"description": "JavaScript SDK for Integration.app", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -6,3 +6,4 @@ import { connectToChild } from 'penpal' | ||
const BODY_CLASS = '__integration-app-open' | ||
const initialized = false | ||
let initialized = false | ||
let handshakeTimeout: any = null | ||
@@ -22,2 +23,3 @@ type Callbacks = { | ||
if (!initialized) { | ||
initialized = true | ||
await init() | ||
@@ -29,2 +31,13 @@ } | ||
handshakeTimeout = setTimeout(() => { | ||
console.error( | ||
'It takes too long for Integration UI to load. Something must be wrong.', | ||
) | ||
close() | ||
}, 5000) | ||
function handshake() { | ||
clearHandshakeTimeout() | ||
} | ||
function doOpen() { | ||
@@ -40,3 +53,3 @@ const iframe = document.createElement('iframe') | ||
iframe, | ||
methods: { ...callbacks, close }, | ||
methods: { ...callbacks, close, handshake }, | ||
}) | ||
@@ -71,2 +84,3 @@ } else { | ||
} | ||
clearHandshakeTimeout() | ||
} | ||
@@ -101,1 +115,8 @@ | ||
} | ||
function clearHandshakeTimeout() { | ||
if (handshakeTimeout) { | ||
clearTimeout(handshakeTimeout) | ||
handshakeTimeout = null | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
163596
1305