For instance I have YOTI object injected into browser:
When I run this in console:
window.YOTI
I get:
{onShare: ƒ, redirect: ƒ}
Then if I access redirect method I get this:
window.YOTI.redirect
ƒ (callbackUrl, token) {
var currentQuery = window.location.search.replace('?','')
var currentFragment = window.location.hash
var separator = (callbackU…
I want to modify this property in angular onInit() and I tried this from here(https://yoti.zendesk.com/hc/en-us/articles/360008958873-Does-the-Yoti-frontend-client-support-an-Angular-App-):
const ytcontainer = {
};
Object.defineProperty(window, 'YOTI', {
get: () => ytcontainer.YOTI,
set: yoti => {
ytcontainer.YOTI = yoti;
Object.defineProperty(yoti, 'redirect', {
get: () => {
return (callbackUrl, token) => {
console.log(callbackUrl);
console.log(token);
};
},
});
},
});
but after that, when I run window.YOTI I get undefined object.
window.YOTI
undefined
What am I doing wrong here?