0.1.5 • Published 7 months ago

opensesame-copilot-widget-sdk-v3 v0.1.5

Weekly downloads
-
License
MIT
Repository
-
Last release
7 months ago

OpenSesame Widget SDK

A React component library for embedding OpenSesame's AI copilot functionality into your applications.

Installation

npm install @opensesame/widget-sdk
# or
yarn add @opensesame/widget-sdk
# or
pnpm add @opensesame/widget-sdk

Usage

Basic Usage

import { CopilotPreview } from '@opensesame/widget-sdk';

function App() {
  return (
    <CopilotPreview
      config={{
        primaryColor: '#0099ff',
        theme: 'system', // 'light' | 'dark' | 'system'
        selectedEndpoints: ['endpoint1', 'endpoint2']
      }}
    />
  );
}

Embedding via Script

You can also embed the widget using a script tag:

<div id="opensesame-copilot"></div>
<script>
  (function() {
    const script = document.createElement('script');
    script.src = 'https://opensesame.dev/embed.js';
    script.async = true;
    script.onload = function() {
      window.OpenSesame.init({
        container: '#opensesame-copilot',
        config: {
          primaryColor: '#0099ff',
          theme: 'system',
          selectedEndpoints: ['endpoint1', 'endpoint2']
        }
      });
    };
    document.head.appendChild(script);
  })();
</script>

Configuration

The config prop accepts the following options:

  • primaryColor: The primary color for the widget (hex code)
  • theme: Color theme ('light' | 'dark' | 'system')
  • selectedEndpoints: Array of enabled endpoint IDs

Development

# Install dependencies
npm install

# Start development server
npm run dev

# Build package
npm run build

# Run linting
npm run lint

License

MIT © OpenSesame