@truly-you/trulyyou-web-sdk 0.1.15 → 0.1.16
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/dist/index.esm.js +1 -1
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.umd.js +1 -1
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/sdk/TrulyYouSDK.ts +22 -0
package/package.json
CHANGED
package/src/sdk/TrulyYouSDK.ts
CHANGED
|
@@ -307,16 +307,24 @@ export class TrulyYouSDK {
|
|
|
307
307
|
console.log('[SDK-PROBE]: Frontend URL:', this.frontendUrl)
|
|
308
308
|
|
|
309
309
|
let timeout: NodeJS.Timeout | undefined
|
|
310
|
+
let globalTimeout: NodeJS.Timeout | undefined
|
|
310
311
|
let backendCheckPromise: Promise<boolean> | null = null
|
|
312
|
+
let globalListener: ((e: MessageEvent) => void) | undefined
|
|
311
313
|
|
|
312
314
|
const cleanup = () => {
|
|
313
315
|
window.removeEventListener('message', handleMessage)
|
|
316
|
+
if (globalListener) {
|
|
317
|
+
window.removeEventListener('message', globalListener)
|
|
318
|
+
}
|
|
314
319
|
if (iframe.parentNode) {
|
|
315
320
|
iframe.parentNode.removeChild(iframe)
|
|
316
321
|
}
|
|
317
322
|
if (timeout) {
|
|
318
323
|
clearTimeout(timeout)
|
|
319
324
|
}
|
|
325
|
+
if (globalTimeout) {
|
|
326
|
+
clearTimeout(globalTimeout)
|
|
327
|
+
}
|
|
320
328
|
}
|
|
321
329
|
|
|
322
330
|
const handleMessage = async (event: MessageEvent) => {
|
|
@@ -364,9 +372,23 @@ export class TrulyYouSDK {
|
|
|
364
372
|
}
|
|
365
373
|
}
|
|
366
374
|
|
|
375
|
+
console.log('[SDK-PROBE]: Registering message listener on window')
|
|
367
376
|
window.addEventListener('message', handleMessage)
|
|
377
|
+
console.log('[SDK-PROBE]: Message listener registered, appending iframe')
|
|
368
378
|
document.body.appendChild(iframe)
|
|
369
379
|
console.log('[SDK-PROBE]: Iframe appended to body, waiting for response...')
|
|
380
|
+
|
|
381
|
+
// Also add a temporary global listener to see if ANY messages arrive
|
|
382
|
+
globalListener = (e: MessageEvent) => {
|
|
383
|
+
console.log('[SDK-PROBE-GLOBAL]: Any message received:', e.data, 'from:', e.origin)
|
|
384
|
+
}
|
|
385
|
+
window.addEventListener('message', globalListener)
|
|
386
|
+
globalTimeout = setTimeout(() => {
|
|
387
|
+
if (globalListener) {
|
|
388
|
+
window.removeEventListener('message', globalListener)
|
|
389
|
+
console.log('[SDK-PROBE-GLOBAL]: Removed temporary global listener')
|
|
390
|
+
}
|
|
391
|
+
}, 5000)
|
|
370
392
|
|
|
371
393
|
// Timeout to allow for React hydration on sign page
|
|
372
394
|
timeout = setTimeout(() => {
|