Update app.py
Browse files
app.py
CHANGED
@@ -158,7 +158,11 @@ window.postMessageToParent = function(prompt, event, source, value) {
|
|
158 |
// Post the message to the parent window
|
159 |
window.parent.postMessage(message, '*');
|
160 |
}else if(isValidEnv()){
|
161 |
-
|
|
|
|
|
|
|
|
|
162 |
}else{
|
163 |
console.log("Not in an iframe, can't post to parent");
|
164 |
}
|
@@ -184,7 +188,11 @@ function uploadImage(prompt, images, event, source, value) {
|
|
184 |
};
|
185 |
window.parent.postMessage(JSON.stringify(data), '*');
|
186 |
} else if (isValidEnv()){
|
187 |
-
|
|
|
|
|
|
|
|
|
188 |
}else{
|
189 |
console.log("Not in an iframe, can't post to parent");
|
190 |
}
|
|
|
158 |
// Post the message to the parent window
|
159 |
window.parent.postMessage(message, '*');
|
160 |
}else if(isValidEnv()){
|
161 |
+
try{
|
162 |
+
sendCustomEventToDataLayer({},event,source,value)
|
163 |
+
} catch (error) {
|
164 |
+
console.error("Error in sendCustomEventToDataLayer:", error);
|
165 |
+
}
|
166 |
}else{
|
167 |
console.log("Not in an iframe, can't post to parent");
|
168 |
}
|
|
|
188 |
};
|
189 |
window.parent.postMessage(JSON.stringify(data), '*');
|
190 |
} else if (isValidEnv()){
|
191 |
+
try{
|
192 |
+
sendCustomEventToDataLayer({},event,source,{"prompt": prompt, "image":imageUrl})
|
193 |
+
} catch (error) {
|
194 |
+
console.error("Error in sendCustomEventToDataLayer:", error);
|
195 |
+
}
|
196 |
}else{
|
197 |
console.log("Not in an iframe, can't post to parent");
|
198 |
}
|