Deep Link
Overview
Handles the deep link behavior in the application.
Users can create an invite link and send it to their friends.
When the friend opens the link, the application will process the login
and redirect to the SDK overlay, where the welcome screen is displayed.
This behavior is handled by the onDeepLinkHandled
prop.
For more information, see the Deep Link
type DeepLinkUrlParams = {
// StreamLayer user id
sldl_uid?: string
// StreamLayer event id
sldl_eid?: string
// Masters event id
sldl_e_eid?: string
}
type OnDeepLinkHandled = ({ sldl_uid, sldl_eid, sldl_e_eid }: DeepLinkUrlParams) => void
How it works
When a page is opened through a deep link and we detect it - we will invoke the callback. At this point you should evaluate where the user is, auth state, perform login in if necessary and redirect to the correct page/activate correct SDK event.
import { StreamLayerProvider, StreamLayerSDKReact, StreamLayerSDKPoints } from '@streamlayer/react'
const deepLinkHandledCallback = ({ sldl_uid, sldl_eid, sldl_e_eid }: DeepLinkUrlParams) => {
// if user is not logged in
if (!user) {
// perform login
// redirect to the correct page
} else {
// redirect to the correct page
}
}
...
<StreamLayerProvider {...providerProps} onDeepLinkHandled={deepLinkHandledCallback}>
// other components
</StreamLayerProvider>
...