Our application is prepared using Angular2 and we are just including default feedback widget code in the index.html page.
window.addEventListener("message",zsReceiveMessage,false); } else if (window.attachEvent) { // IE before version 9 window.attachEvent("onmessage",zsReceiveMessage ); } } //Function which receives and processes the Screen-Shot Content of i-frame type
var isScreenShotAdded = false;
var zsScreenShotBlob = "";
function zsReceiveMessage(event) {
var zsUrlRegex = /^(ht|f)tp(s?)\:\/\/[0-9a-zA-Z]([-.\w]*[0-9a-zA-Z])*(:(0-9)*)*(\/?)([a-zA-Z0-9\-\.\?\,\:\'\/\\\+=&%\$#_]*)?$/;
if(zsUrlRegex.test(event.origin)) {
var zsMessageType = event.data.split("&&&")[0];
if(zsMessageType == "zsScreenShotContent") {
var zsScreenShotImage = event.data.split("&&&")[1];
var zsScreenShotImageContents = zsScreenShotImage.split(",");
zsScreenShotBlob = new Blob([zsScreenShotImageContents[1]],{ type : "image/png"}); zsWidgetJQuery("#screenshot").text("Screenshot.png");// No i18n zsWidgetJQuery("#screenshotPreviewContainer,#screenshotmdiv").show(); zsWidgetJQuery("#hilightSelDiv,#blackoutSelDiv").attr("class","fleft fbssnormal"); zsWidgetJQuery("#screenshotPreview").attr("src",zsScreenShotImage); isScreenShotAdded = true;
} else if(zsMessageType == "ZSUserDetails") {
zsWidgetJQuery("#feedbNameTxtField,#feedbEmailTxtField,#zsCaptcha").remove(); zsWidgetJQuery(".zsfeedbkrpanel,.zsfeedbklpanel").removeClass("zscaptcha").addClass("zsnocaptcha"); zsWidgetJQuery("#zsUserNameEmailContainer").addClass("zsnonameemail");
zsLoggedInUserName = event.data.split("&&&")[1];
zsLoggedInUserEmail = event.data.split("&&&")[2];
isZsCaptchaPresent = false; //To handle in widget Minimise and Maximise */
} else if(zsMessageType == "zsClosePopup") {
zsClosePopup();
}
}
}