# @inkeep/js

To run:

```bash
pnpm dev
```

This spins up a local server that serves the js scripts on localhost:3001.

To use the js scripts in your project, you can use the following import:

```html
<script type="module" defer src="http://localhost:3001/embed.js"></script>
```

## Usage

Sample usage:

```ts
function loadScript(url, callback) {
  const script = document.createElement('script')
  script.src = url
  script.type = 'text/javascript'
  script.onload = callback
  document.head.appendChild(script)
}

// Usage example:
loadScript('http://localhost:3001/index.js', () => {
  const settings = {
    baseSettings: {
      apiKey: 'YOUR_API_KEY',
      primaryBrandColor: '#26D6FF',
      organizationDisplayName: 'Your Org',
    },
    aiChatSettings: {
      aiAssistantAvatar: 'https://mydomain.com/mylogo.svg',
      exampleQuestions: ['Example question 1?', 'Example question 2?', 'Example question 3?'],
    },
  }

  // Initialize search modal with your settings
  Inkeep.ModalSearchAndChat(settings)

  // Initialize chat button with your settings
  Inkeep.ChatButton(settings)
})
```
