Hello readers,
I am currently developing a custom application which is displaying a phone dialer in a page on the cti_global_sidebar.
On random refreshes, the contents of the cti_global_sidebar defined within my index.html and app.js do not load : The button to display the cti_global_sidebar with my app logo is still here and works but the content of the cti_global_sidebar is completely empty. The web console displays a JS error : App is not loaded
I first initialized the code using freshdesk doc Your First App and got this issue
I then found this topic App is not defined error in Freshdesk frontend application which seems to be about the same behaviour I’m trying to fi. I followed the recommendation and I changed my initialization code to resemble this one https://github.com/freshworks/marketplace-sample-apps/blob/master/Freshworks-Samples/Freshdesk/sample_cti_app/app/app.js#L113C1-L113C1 Unfortunately the behaviour is still here and I randomly get this App is not defined error.
Here is the gist of my app initialization code :
function onDocumentReady() {
app.initialized()
.then(async function (_client) {
window.client = _client;
try {
// Initialisation Actions Here
} catch (error) {
console.error("Problem with retrieving Installation Parameters", error);
}
console.debug('RC APP init finished');
client.interface.trigger("show", { id: "softphone" })
}).catch(function (error) {
console.error('The app failed to get initialized');
console.error(error);
});
};
Would anyone know where this random behaviour could be coming from or have an idea on how to fix it ?
If you need any additional information, please let me know
Thanks for your help on this !