@lorikeetai/react-native-sdk
v1.2.0
Published
LorikeetCX React Native widget for embedding the chat widget via WebView
Maintainers
Readme
@lorikeetai/react-native-sdk
SDK containing embeddable React Native components that renders the LorikeetCX web widget inside a react-native-webview.
Installation
pnpm add @lorikeetai/react-native-sdkBasic Usage
import { LorikeetWidgetView } from '@lorikeetai/react-native-sdk'
export default function Screen() {
return (
<LorikeetWidgetView
publicKey="wk_xxx"
authToken="your-auth-token"
onWebViewMessage={(event) => console.log(event.nativeEvent.data)}
/>
)
}Props:
publicKey(required): The public key for your Lorikeet accountauthToken(required): Authentication token for the userbaseUrl(optional): Base URL for the Lorikeet API (defaults tohttps://chat.lorikeetcx.ai)customisations(optional): Widget customization options from@lorikeetai/web-sdkstyles(optional): Style overrides for the header textonWebViewMessage(optional): Handler for messages from the webview
Headless components
You may use these if you want to compose the lorikeet widget itself. It comprises of 2 components - the widget view & header view - which are rolled up together in 'LorikeetWidgetView'.
LorikeetWidgetHeader
Header component for the widget.
<LorikeetWidgetHeader title='Testing' style={{ fontFamily: 'Inter' ... }} />Props:
title(required): The title text to displaystyle(optional): Style for the header texticon(optional): Clickable icon to be rendered on the right side of the header. Defaults to a new chat icononIconPress(optional): Callback when the header icon is pressed.
LorikeetWidgetWebView
WebView component that handles the widget content.
<LorikeetWidgetWebView
uri={url}
webviewProps={{
scalesPageToFit: true,
startInLoadingState: true,
style: ...
}}
/>Props:
uri(required): The URI that the web view will loadbaseUrl(optional): Base URL for the Lorikeet API (defaults tohttps://chat.lorikeetcx.ai)webviewProps(optional): Passed through to the webview component
Development
- Build:
pnpm -w turbo build --filter=@lorikeetai/react-native-sdk - Lint:
pnpm --filter=@lorikeetai/react-native-sdk lint
License
MIT
