@jexity/chat-widget 0.1.0 → 0.2.0-canary.6b459f2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +38 -8
- package/dist/index.mjs +272 -260
- package/dist/index.mjs.map +1 -1
- package/dist/react.mjs +35 -0
- package/dist/react.mjs.map +1 -0
- package/dist/types/app.d.ts +3 -2
- package/dist/types/app.d.ts.map +1 -1
- package/dist/types/index.d.ts +3 -17
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/react.d.ts +15 -0
- package/dist/types/react.d.ts.map +1 -0
- package/dist/types/types.d.ts +18 -0
- package/dist/types/types.d.ts.map +1 -0
- package/dist/widget.js +1 -1
- package/dist/widget.js.map +1 -1
- package/package.json +20 -2
package/README.md
CHANGED
|
@@ -20,13 +20,32 @@ npm install @jexity/chat-widget
|
|
|
20
20
|
```
|
|
21
21
|
|
|
22
22
|
```ts
|
|
23
|
-
import {
|
|
23
|
+
import { JexityChat } from '@jexity/chat-widget'
|
|
24
24
|
|
|
25
|
-
const
|
|
25
|
+
const chat = JexityChat({
|
|
26
26
|
orgId: 'YOUR_ORG_ID',
|
|
27
27
|
})
|
|
28
28
|
|
|
29
|
-
// Later:
|
|
29
|
+
// Later: chat.shutdown()
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
### React Provider
|
|
33
|
+
|
|
34
|
+
```tsx
|
|
35
|
+
import { JexityChatProvider, useJexityChat } from '@jexity/chat-widget/react'
|
|
36
|
+
|
|
37
|
+
function App() {
|
|
38
|
+
return (
|
|
39
|
+
<JexityChatProvider orgId="YOUR_ORG_ID">
|
|
40
|
+
<HomePage />
|
|
41
|
+
</JexityChatProvider>
|
|
42
|
+
)
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
function HomePage() {
|
|
46
|
+
const { open, close, toggle, isOpen } = useJexityChat()
|
|
47
|
+
return <button onClick={open}>Chat with us</button>
|
|
48
|
+
}
|
|
30
49
|
```
|
|
31
50
|
|
|
32
51
|
## Configuration
|
|
@@ -44,12 +63,23 @@ const widget = init({
|
|
|
44
63
|
## Programmatic API
|
|
45
64
|
|
|
46
65
|
```ts
|
|
47
|
-
const
|
|
66
|
+
const chat = JexityChat(options)
|
|
48
67
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
68
|
+
chat.open() // Open the chat window
|
|
69
|
+
chat.close() // Close the chat window
|
|
70
|
+
chat.toggle() // Toggle open/closed
|
|
71
|
+
chat.shutdown() // Remove widget from DOM
|
|
72
|
+
chat.isOpen // readonly boolean
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
## Script Tag Global
|
|
76
|
+
|
|
77
|
+
```html
|
|
78
|
+
<script src="https://cdn.jexity.chat/widget/latest/widget.js" data-org-id="YOUR_ORG_ID"></script>
|
|
79
|
+
<script>
|
|
80
|
+
window.JexityChat.open()
|
|
81
|
+
window.JexityChat.shutdown()
|
|
82
|
+
</script>
|
|
53
83
|
```
|
|
54
84
|
|
|
55
85
|
## License
|