Hello Gareth,
The problem for this error is that you probably haven't set the main structure initially (I mean window._genesys.widgets.main).
So with javascript, you cannot set elements/attributes in this structure directly (like window._genesys.widgets.main.them and window._genesys.widgets.main.themes).
It would have to be something like this:
window._genesys.widgets.main = {
theme: "mybrand",
themes: {
"mybrand": "cx-theme-mybrand"
}
};
But if you set this where I think you set this, it still won't work. You have to define the themes at widgets configuration level, before the Widgets plugin are loaded.
So instead - do this at the same time you define window._genesys.widgets.webchat.
window._genesys = {
widgets: {
main: {
timeFormat: 24,
lang: 'en',
theme: "mybrand",
themes: {
"mybrand": "cx-theme-mybrand"
},
mobileMode: 'auto',
mobileModeBreakpoint: 600
},
webchat: {
transport: {
type: 'purecloud-v2-sockets',
dataURL: 'https://api.mypurecloud.com',
deploymentKey: 'xxxxxxx',
orgGuid: 'yyyyyyyyy',
interactionData: {
routing: {
targetType: 'QUEUE',
targetAddress: 'ABCD',
priority: 2
}
}
},
userData: {}
}
}
};
Regards,
------------------------------
Jerome Saint-Marc
Genesys - Employees
------------------------------
Original Message:
Sent: 02-17-2021 07:29
From: Gareth James
Subject: Custom theme in Widget V2
Hoping someone can help with an issue I have at the moment implementing the V2 web chat widget with a custom theme. The standard widget code is fine on the page and produces no issues, however when I add the code to register the theme and then make it active I receive the following error response: Uncaught TypeError: Cannot set property 'theme' of undefined at (index):141
This is the section of code being referred to in the error, to keep it simple the branding has been based on the example included within the Widget development guide
const customPlugin = CXBus.registerPlugin('Custom');
window._genesys.widgets.main.theme = "mybrand";
window._genesys.widgets.main.themes = {
"mybrand": "cx-theme-mybrand"
};
</script>
I am hoping that I am just missing something very simple, any assistance would be greatly appreciated
#DigitalChannels
------------------------------
Gareth James
CALLSCAN AUSTRALIA PTY. LTD.
------------------------------