diff --git a/packages/embed/src/js/basic-kyc.js b/packages/embed/src/js/basic-kyc.js index 8f1330b8..6181b7be 100644 --- a/packages/embed/src/js/basic-kyc.js +++ b/packages/embed/src/js/basic-kyc.js @@ -466,7 +466,10 @@ import { version as sdkVersion } from '../../package.json'; EndUserConsent.addEventListener( 'end-user-consent.denied', () => { - referenceWindow.postMessage('SmileIdentity::ConsentDenied', '*'); + (referenceWindow.parent || referenceWindow).postMessage( + 'SmileIdentity::ConsentDenied', + '*', + ); closeWindow(); }, false, @@ -475,7 +478,7 @@ import { version as sdkVersion } from '../../package.json'; EndUserConsent.addEventListener( 'end-user-consent.totp.denied.contact-methods-outdated', (event) => { - referenceWindow.postMessage( + (referenceWindow.parent || referenceWindow).postMessage( 'SmileIdentity::ConsentDenied::TOTP::ContactMethodsOutdated', '*', ); diff --git a/packages/embed/src/js/biometric-kyc.js b/packages/embed/src/js/biometric-kyc.js index 15e750a4..82337245 100644 --- a/packages/embed/src/js/biometric-kyc.js +++ b/packages/embed/src/js/biometric-kyc.js @@ -560,7 +560,10 @@ import { version as sdkVersion } from '../../package.json'; EndUserConsent.addEventListener( 'end-user-consent.denied', () => { - referenceWindow.postMessage('SmileIdentity::ConsentDenied', '*'); + (referenceWindow.parent || referenceWindow).postMessage( + 'SmileIdentity::ConsentDenied', + '*', + ); closeWindow(); }, false, diff --git a/packages/embed/src/js/ekyc.js b/packages/embed/src/js/ekyc.js index 5810ce1f..b6d83d08 100644 --- a/packages/embed/src/js/ekyc.js +++ b/packages/embed/src/js/ekyc.js @@ -462,7 +462,10 @@ import { version as sdkVersion } from '../../package.json'; EndUserConsent.addEventListener( 'end-user-consent.denied', () => { - referenceWindow.postMessage('SmileIdentity::ConsentDenied', '*'); + (referenceWindow.parent || referenceWindow).postMessage( + 'SmileIdentity::ConsentDenied', + '*', + ); closeWindow(); }, false, diff --git a/packages/embed/src/js/product-selection.js b/packages/embed/src/js/product-selection.js index 57334e9b..61bb180e 100644 --- a/packages/embed/src/js/product-selection.js +++ b/packages/embed/src/js/product-selection.js @@ -113,8 +113,8 @@ if (!validIdType) { const legacyValidIdType = - legacyProductConstraints.doc_verification[country].id_types[id_type] || - legacyProductConstraints.enhanced_kyc[country].id_types[id_type]; + legacyProductConstraints.doc_verification[country]?.id_types[id_type] || + legacyProductConstraints.enhanced_kyc[country]?.id_types[id_type]; if (legacyValidIdType) { validIdType = { name: legacyValidIdType.label,