Web library v1.2.12
- Added all internal events to the public events in
parleySettings.events - Added more Accessibility fixes to the DOM elements.
- Improved handling of multiple service workers
- Fixed an issue where the mobile "send" button would not appear correctly.
Improved handling of multiple service workers
it improves and completes the feature from v1.2.11
- Use our own "push" event handler inside the service worker (instead of letting the FCM library handle it), so we can send any push message to clients within our defined scope. This should prevent serviceworker01 to be able to send anything to chat02 and thus fix the issue where both chats would see "agent is typing" in a multi-chat setup.
- We now only unregister a service worker if it's registration actually exists to prevent the
Cannot read property 'unregister' of undefinederror - Added a setting called
fcmConfig.scopeBlacklistto provide a list of scopes that should be blocked inside the defined scope for a service worker. This means that if serviceworker01 has a scope of/and a scopeBlacklist containing["https://yourwebsite.com/shop"], it would not be able to send any push messages to the "/shop" scope. This way you can use a different chat instance on "/shop" (let's say "chat02" that creates serviceworker02). - To achieve the above we need to use the browser's
indexedDBto share the blacklist form the client with the service worker. To prevent clients overwriting the blacklist item in the DB, the items are prefixed the same way as the localStorage items. This prefix is transferred to the service worker by setting a query parameter when installing the service worker (solution from: https://stackoverflow.com/questions/44424709/passing-state-info-into-a-service-worker-before-install) - When the setting
fcmConfig.scopeis set tonullthis whole feature will be ignored (default).