Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

This fixes onError not propagated to grandparent of the window #349

Merged
merged 2 commits into from
Oct 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions packages/embed/src/js/basic-kyc.js
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,9 @@ import { version as sdkVersion } from '../../package.json';
EndUserConsent.addEventListener(
'end-user-consent.denied',
() => {
referenceWindow.postMessage('SmileIdentity::ConsentDenied', '*');
[referenceWindow.parent, referenceWindow].forEach((win) => {
win.postMessage('SmileIdentity::ConsentDenied', '*');
});
closeWindow();
},
false,
Expand All @@ -475,10 +477,12 @@ import { version as sdkVersion } from '../../package.json';
EndUserConsent.addEventListener(
'end-user-consent.totp.denied.contact-methods-outdated',
(event) => {
referenceWindow.postMessage(
'SmileIdentity::ConsentDenied::TOTP::ContactMethodsOutdated',
'*',
);
[referenceWindow.parent, referenceWindow].forEach((win) => {
win.postMessage(
'SmileIdentity::ConsentDenied::TOTP::ContactMethodsOutdated',
'*',
);
});
closeWindow();
},
false,
Expand Down
5 changes: 4 additions & 1 deletion packages/embed/src/js/biometric-kyc.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
21 changes: 12 additions & 9 deletions packages/embed/src/js/ekyc.js
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,9 @@ import { version as sdkVersion } from '../../package.json';
EndUserConsent.addEventListener(
'end-user-consent.denied',
() => {
referenceWindow.postMessage('SmileIdentity::ConsentDenied', '*');
[referenceWindow.parent || referenceWindow].forEach((win) => {
win.postMessage('SmileIdentity::ConsentDenied', '*');
});
closeWindow();
},
false,
Expand All @@ -471,10 +473,12 @@ import { version as sdkVersion } from '../../package.json';
EndUserConsent.addEventListener(
'end-user-consent.totp.denied.contact-methods-outdated',
(event) => {
(referenceWindow.parent || referenceWindow).postMessage(
'SmileIdentity::ConsentDenied::TOTP::ContactMethodsOutdated',
'*',
);
[referenceWindow.parent || referenceWindow].forEach((win) => {
win.postMessage(
'SmileIdentity::ConsentDenied::TOTP::ContactMethodsOutdated',
'*',
);
});
closeWindow();
},
false,
Expand Down Expand Up @@ -861,9 +865,8 @@ import { version as sdkVersion } from '../../package.json';
}

function handleSuccess() {
(referenceWindow.parent || referenceWindow).postMessage(
'SmileIdentity::Success',
'*',
);
[referenceWindow.parent, referenceWindow].forEach((win) => {
win.postMessage('SmileIdentity::Success', '*');
});
}
})();
4 changes: 2 additions & 2 deletions packages/embed/src/js/product-selection.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down