0.0.1-alpha.1 • Published 6 months ago
aplisay-react-widget v0.0.1-alpha.1
aplisay-react-widget
A React component for integrating Aplisay's conversational AI into your web applications.
Installation
npm install aplisay-react-widget
Basic Usage
import React from 'react';
import { AplisayWidget } from 'aplisay-react-widget';
function App() {
return (
<AplisayWidget
listenerId="YOUR_LISTENER_ID"
url="YOUR_APLISAY_URL"
roomKey="YOUR_ROOM_KEY"
verbose={true}
mode="light"
theme={{
palette: {
primary: { main: '#f63bcb' },
background: { default: '#ffffff' },
text: { primary: '#374151' },
error: { main: '#ef4444' }
}
}}
/>
);
}
Props
Prop | Type | Required | Description |
---|---|---|---|
listenerId | string | Yes | Your unique listener identifier |
url | string | Yes | The Aplisay API endpoint URL |
roomKey | string | Yes | Authentication key for the room |
verbose | boolean | No | Enable detailed logging (default: false) |
mode | 'light' | 'dark' | No | Color scheme mode (default: 'light') |
theme | ThemeObject | No | Custom theme configuration |
Controlled Mode
If you wish, the widget can be controlled by the open
prop, the setter will be called with the new state of the widget if it changes due to interaction from the user (pressing hangup, etc).
| open
| boolean | No | Whether the widget is active (default: true) |
| setOpen
| (open: boolean) => void | No | Function to set the widget's open/active state |
Theme Configuration
The theme object structure:
interface Theme {
palette: {
primary: {
main: string; // Primary color
};
background: {
default: string; // Background color
};
text: {
primary: string; // Text color
};
error?: {
main: string; // Error color
};
};
}
Room States
The widget can be in one of these states:
initial
parameter_error
join
connected
error
Additional Exports
import { useAplisayRoom } from 'aplisay-react-widget';
TODO: DOCUMENT HOOK for those building their own widget.
Support
For issues, feature requests, or questions, please just use this GitHub repository in the first instance.
License
MIT License, for any code written by Aplisay for this widget.
0.0.1-alpha.1
6 months ago