Skip to content

Commit

Permalink
Refactor widget import and add popover component
Browse files Browse the repository at this point in the history
  • Loading branch information
faltawy committed Sep 9, 2024
1 parent 9713347 commit 31d8b61
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions docs/widget/embed.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,9 @@ There are several ways you can integrate the chat widget into your application/w
2. Use the Component inside your application

```jsx
import { OpenWidget, Root } from "@openchatai/widget";
import { Widget, WidgetRoot, WidgetPopover } from "@openchatai/widget";
import "@openchatai/widget/dist/style.css";

const options = {
/** ## Basic and required options ## */
token: "your_organization_token_goes_here", // (required) Settings -> Metadata -> Token
Expand Down Expand Up @@ -142,13 +144,14 @@ const options = {
// onHandoff: ({ handoff }) => { // A function that will be called when the user is handed off to a human agent. read more about [handoff](/resources/human-handoff)
// console.log("handoff", handoff)
// },

}

function Widget(){
return (
<Root options={options}>
<InitOpenScript />
</Root>
<WidgetRoot options={options}>
<Widget /> // the inline chat widget
<WidgetPopover /> // optional, if you want to use the popover
</WidgetRoot>
)
}
```
Expand Down

0 comments on commit 31d8b61

Please sign in to comment.