Typescript library with react components for Text Platform Developer App.
npm install @livechat/developer-ui-react> Typescript library with react components for Text Platform Developer App

Use the npm or yarn package managers to install the package in your project.
``bash`
npm install -g @livechat/developer-ui-reactor
yarn global add @livechat/developer-ui-react
`tsx
import { Button, Card } from "@livechat/design-system-react-components";
import type { AppConfig } from "@livechat/developer-sdk";
import { AppProvider, useApp } from "@livechat/developer-ui-react";
// import app config (aka. manifest) from proper location
// it can be downloaded using 'txdev app pull/clone' (@livechat/developer-cli)
import config from "./livechat.config.json";
function Component() {
const { app } = useApp();
return (
App is now initialized and ready to use.
Account ID: {app.authorization?.data?.account_id}
);
}
function Wrapper() {
return (
);
}
`
To be able to use useApp hook, Component must be wrapped with AppProvider. It takes config of your app (aka. manifest) and uses it to construct app instance, to run initialization and authorization (if needed) under the hood. If you don't have your app config (aka. manifest) yet, please refer to @livechat/developer-cli to see how use Text Platform Developer CLI to pull/clone your app.
Also, have a look at @livechat/developer-sdk to see how you can use app instance and its built-in features f.e. reporting.
`tsx
import { Button, Card } from "@livechat/design-system-react-components";
import {
useLiveChatDetails,
withLiveChatDetails,
LiveChatDetailsProvider,
} from "@livechat/developer-ui-react";
const Widget = ({ widget, customerProfile }: LiveChatDetailsContext) => (
const WidgetContainer = () => (
{(context) =>
);
// or
const WidgetContainer = () => (
);
const WidgetWrappedWithHook = () => {
const context = useLiveChatDetails();
return
};
const WidgetWrappedWithHoc = withLiveChatDetails(Widget);
`
For now we are supporting widgets:
- LiveChat
- Chat Details - LiveChatDetailsProvider and useLiveChatDetailsLiveChatMessageBoxProvider
- Message Box - and useLiveChatMessageBoxLiveChatFullscreenProvider
- Fullscreen - and useLiveChatFullscreenHelpDeskDetailsProvider
- HelpDesk
- Ticket Details - and useHelpDeskDetailsHelpDeskFullscreenProvider
- Fullscreen - and useHelpDeskFullscreen`
The code and documentation in this project are released under the MIT License.