0.0.1-alpha.1 • Published 6 months ago

aplisay-react-widget v0.0.1-alpha.1

Weekly downloads
-
License
ISC
Repository
-
Last release
6 months ago

Aplisay Logo

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

PropTypeRequiredDescription
listenerIdstringYesYour unique listener identifier
urlstringYesThe Aplisay API endpoint URL
roomKeystringYesAuthentication key for the room
verbosebooleanNoEnable detailed logging (default: false)
mode'light' | 'dark'NoColor scheme mode (default: 'light')
themeThemeObjectNoCustom 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