Mini Kabibi Habibi
console.log("inside message handler");
function dontSendButtonAPI(userEmail) {
console.log("called dontSendButtonAPI");
const messageData = {
event: "dontSendButtonClicked",
userEmail: userEmail
};
window.chrome.webview.postMessage(JSON.stringify(messageData));
}
function sendReportButtonAPI(silentSendChecked, userCommentTextArea, userEmail) {
console.log("called sendReportButtonAPI");
var silentSendCheckedValue = "", userCommentTextAreaValue = "", userEmailValue = "";
if(silentSendChecked.length > 0){
silentSendCheckedValue = silentSendChecked;
}
if(userCommentTextArea.length > 0){
userCommentTextAreaValue = userCommentTextArea;
}
if(userEmail.length > 0){
userEmailValue = userEmail;
}
const jsonData = {
event: "sendButtonClicked",
silentSendChecked: silentSendCheckedValue,
userCommentTextArea: userCommentTextAreaValue,
userEmail: userEmailValue
};
const jsonString = JSON.stringify(jsonData);
window.chrome.webview.postMessage(jsonString);
}
function viewReportLinkAPI(userCommentTextArea, userEmail) {
console.log("called viewReportLinkAPI");
console.log("userCommentTextArea = ", userCommentTextArea);
console.log("userEmail = ", userEmail);
var userCommentTextAreaValue = "", userEmailValue = "";
if(userCommentTextArea.length > 0){
userCommentTextAreaValue = userCommentTextArea;
}
if(userEmail.length > 0){
userEmailValue = userEmail;
}
console.log("userCommentTextAreaValue = ", userCommentTextAreaValue);
console.log("userEmailValue = ", userEmailValue);
const messageData = {
event: "viewReport",
userEmail: userEmail,
userCommentTextArea: userCommentTextAreaValue
};
window.chrome.webview.postMessage(JSON.stringify(messageData));
}