Hello,
Here are some tests related to issues I faced mostly with session reset, session loading and token id setting. The result seem not logical to me but maybe I use the sdk wrong. The sdk functions called (or onLoaded callback) are given at each steps:
Step 1: anonymous user not connected
Crisp.configure(xxx, { locale: 'fr', autoload: false })
Crisp.load()
=> Crisp.session.onLoaded(session_1)
- result: new empty chatbox ✅
Step 2: login as userA
- result: messages from anonymous
session_1
still visible ❌
- expected: new empty chatbox for userA (
sessionMerge
false by default)
Step 3: logout, now anonymous again
Crisp.session.reset()
=> Crisp.session.onLoaded(session_2)
- result: chatbox has messages from
session_2
(maybe a previous session I had locally ??)
completely other messages, not related to first anonymous session with Step 1 (session_1
) ❌
- expected: messages from anonymous
session_1
or new empty chatbox
Step 4: page reload, still anonymous
Crisp.configure(xxx, { locale: 'fr', autoload: false })
Crisp.load()
=> Crisp.session.onLoaded(session_2)
Step 5: login as userB
- result : no changes in chatbox, still messages from
session_2
❌
- expected: new empty chatbox for userB
Step 6: page reload as userB
Crisp.configure(xxx, { locale: 'fr', autoload: false })
Crisp.setTokenId(userB)
Crisp.load()
=> Crisp.session.onLoaded(session_3)
- result: messages from userB visible ✅
Step 7: logout, now anonymous again
Crisp.session.reset()
=> Crisp.session.onLoaded(session_3)
- result: messages from userB still visible (
session_3
) ❌
- expected: messages from anonymous
session_1
or new empty chatbox
Step 8: page reload as anonymous
Crisp.configure(xxx, { locale: 'fr', autoload: false })
Crisp.load()
=> Crisp.session.onLoaded(session_3)
- result: messages from userB still visible (
session_3
) ❌
- expected: messages from anonymous
session_1
or new empty chatbox