Customerly / react-live-chat-customerly

MIT License
0 stars 0 forks source link

Issue with logout() #1

Open rossjcooper opened 10 months ago

rossjcooper commented 10 months ago

Hello, I am trying to integrate Customerly into our React project, but I am getting this error when calling logout()

chunk-WZDUAPVE.js?v=6099763a:8786 Uncaught TypeError: Cannot read properties of undefined (reading 'apply')
    at Caller2 (react-live-chat-customerly.js?v=6099763a:85:61)
    at react-live-chat-customerly.js?v=6099763a:166:7
    at react-live-chat-customerly.js?v=6099763a:115:12
    at Object.logout (react-live-chat-customerly.js?v=6099763a:165:5)
const Customerly = useCustomerly();
//...
Customerly.logout();

To clarify I am calling this code within a component inside the CustomerlyProvider, Customerly.load() and update() seem to be working fine.

IgorZanellaDev commented 7 months ago

Hi Ross, thank you for reporting the error.

I think the problem is that you didn't load Customerly at that point. Because as you can see the error is cannot read properties of undefined, so window.customerly is undefined in that case.

Are you sure you called .load() before calling .logout()?

Thank you