@truly-you/trulyyou-web-sdk 0.1.14 → 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 +27 -2
package/package.json
CHANGED
package/src/sdk/TrulyYouSDK.ts
CHANGED
|
@@ -307,24 +307,35 @@ 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) => {
|
|
323
331
|
const data = event.data as any
|
|
324
332
|
|
|
325
|
-
//
|
|
333
|
+
// Log ALL messages during probe to debug
|
|
334
|
+
console.log('[SDK-PROBE-DEBUG]: Message received - type:', data?.type, 'origin:', event.origin, 'data:', data)
|
|
335
|
+
|
|
336
|
+
// Only process probe-related messages
|
|
326
337
|
if (data?.type === 'KEY_CHECK_RESULT' || data?.type === 'KEY_CHECK_FAILED') {
|
|
327
|
-
console.log('[SDK-PROBE]:
|
|
338
|
+
console.log('[SDK-PROBE]: Processing probe message:', event.data, 'from origin:', event.origin)
|
|
328
339
|
|
|
329
340
|
try {
|
|
330
341
|
const frontendOrigin = new URL(this.frontendUrl).origin
|
|
@@ -361,9 +372,23 @@ export class TrulyYouSDK {
|
|
|
361
372
|
}
|
|
362
373
|
}
|
|
363
374
|
|
|
375
|
+
console.log('[SDK-PROBE]: Registering message listener on window')
|
|
364
376
|
window.addEventListener('message', handleMessage)
|
|
377
|
+
console.log('[SDK-PROBE]: Message listener registered, appending iframe')
|
|
365
378
|
document.body.appendChild(iframe)
|
|
366
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)
|
|
367
392
|
|
|
368
393
|
// Timeout to allow for React hydration on sign page
|
|
369
394
|
timeout = setTimeout(() => {
|