Migration Guide
Steps to migrate from @suprsend/react-inbox to @suprsend/react
@suprsend/react-inbox
only contains inbox related code.Migrating from @suprsend/react-inbox to @suprsend/react changes
Most of features that inbox component supports remain unchanged. Following are changes that happened in new SDK.
Authentication changes
Authentication mechanism has been changed from HMAC authentication to JWT authentication because HMAC authentication (subscriberId) is not as secure as that of JWT authentication. Earlier SuprSendInbox
component and SuprSendProvider
component(headless) used to take care of authentication if you pass distinctId
, workspaceKey
and subscriberId
. But in new SDK you can use SuprSendProvider to authenticate user and all other features like inbox, preferences, webpush etc can be accessed inside that context provide.
Toast functionality has been removed
SuprSendInbox
used to have inbuilt toast notification feature using react-toastify library. But the latest versions of this library created few peerDependencies which created issues for us. So we have exposed event listener to listen to new notification arrival and in that callback you will get new notification payload which you can use to show toast notification using any of your toast library. Refer implementation guide here.
Steps to migrate SuprSendInbox
component (Drop-in)
Remove existing `@suprsend/react-inbox` and install `@suprsend/react`
Change User Authentication
For authenticating user, follow integration steps of SuprSendProvider.
Import New `Inbox` component
Import Inbox
component and use it instead of SuprSendInbox
. Remove distinctId
, workspaceKey
and subscriberId
props since authentication is handled by SuprSendProvider in above step. Please remove any invalid prop present in existing component. Check all available props in new component.
Change Toast Implementation
Since default toast notification feature has been removed, you can refer this section to integrate toast notification functionality.
Steps to migrate headless implementation
If you are migrating headless version of inbox then its better to re-implement the headless inbox, as architecture of methods have been changed. Please refer this guide.
Please reach out to use if you face any issues in migration.