@jokkoo/sdk-react 0.1.0
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/LICENSE +17 -0
- package/README.md +87 -0
- package/dist/index.css +846 -0
- package/dist/index.css.map +1 -0
- package/dist/index.d.mts +227 -0
- package/dist/index.d.ts +227 -0
- package/dist/index.js +2772 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +2794 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +58 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
Copyright 2026 Jokkoo
|
|
6
|
+
|
|
7
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
8
|
+
you may not use this file except in compliance with the License.
|
|
9
|
+
You may obtain a copy of the License at
|
|
10
|
+
|
|
11
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
+
|
|
13
|
+
Unless required by applicable law or agreed to in writing, software
|
|
14
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
15
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
16
|
+
See the License for the specific language governing permissions and
|
|
17
|
+
limitations under the License.
|
package/README.md
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
# @jokkoo/sdk-react
|
|
2
|
+
|
|
3
|
+
Official Jokkoo client embed SDK for React web applications.
|
|
4
|
+
|
|
5
|
+
Provides a floating support widget with conversation list, realtime chat, file
|
|
6
|
+
attachments, voice messages, satisfaction rating, theming, and i18n (fr/en).
|
|
7
|
+
|
|
8
|
+
## Install
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
pnpm add @jokkoo/sdk-react @jokkoo/sdk-web @tanstack/react-query
|
|
12
|
+
# peer: react, react-dom >= 18
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
Import styles once in your app entry (or rely on the bundled CSS side-effect from the package entry):
|
|
16
|
+
|
|
17
|
+
```ts
|
|
18
|
+
import "@jokkoo/sdk-react/styles.css"
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Quick start
|
|
22
|
+
|
|
23
|
+
```tsx
|
|
24
|
+
import { JokkooProvider, JokkooWidget } from "@jokkoo/sdk-react"
|
|
25
|
+
import "@jokkoo/sdk-react/styles.css"
|
|
26
|
+
|
|
27
|
+
function App() {
|
|
28
|
+
return (
|
|
29
|
+
<JokkooProvider
|
|
30
|
+
clientToken="ct_..."
|
|
31
|
+
userTokenProvider={async () => {
|
|
32
|
+
const res = await fetch("/api/jokkoo-token")
|
|
33
|
+
const data = await res.json()
|
|
34
|
+
return data.token as string
|
|
35
|
+
}}
|
|
36
|
+
locale="fr"
|
|
37
|
+
theme={{ colors: { primary: "#1C1C1C" } }}
|
|
38
|
+
>
|
|
39
|
+
<JokkooWidget />
|
|
40
|
+
</JokkooProvider>
|
|
41
|
+
)
|
|
42
|
+
}
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
Your tenant backend should sign short-lived user JWTs with
|
|
46
|
+
[`@jokkoo/nodejs-server`](../nodejs-server) (or the Java server helper).
|
|
47
|
+
|
|
48
|
+
## Web channel origins
|
|
49
|
+
|
|
50
|
+
For `channelType === "web"`, the Jokkoo API validates the browser `Origin`
|
|
51
|
+
against the channel's **allowed origins** configured in the Jokkoo dashboard.
|
|
52
|
+
Add your production (and staging) origins before embedding the widget.
|
|
53
|
+
|
|
54
|
+
## Architecture
|
|
55
|
+
|
|
56
|
+
- `@jokkoo/sdk-web` — framework-agnostic core (API client, realtime, tokens, i18n, shared utils)
|
|
57
|
+
- `@jokkoo/sdk-react` — React bindings + UI widget (this package)
|
|
58
|
+
|
|
59
|
+
## Public API
|
|
60
|
+
|
|
61
|
+
| Export | Description |
|
|
62
|
+
|--------|-------------|
|
|
63
|
+
| `JokkooProvider` | Initializes SDK, QueryClient, navigation, unread state |
|
|
64
|
+
| `JokkooWidget` | Floating launcher + panel (request list + conversation) |
|
|
65
|
+
| `JokkooButton` / `FloatingButton` | Standalone launcher button |
|
|
66
|
+
| `useConversations` / `useMessages` | React Query data hooks |
|
|
67
|
+
| `useRealtimeStatus` / `useSendMessage` / `useUnreadCount` | Supporting hooks |
|
|
68
|
+
| `defaultTheme` / `mergeTheme` | Theming helpers |
|
|
69
|
+
|
|
70
|
+
## Theming
|
|
71
|
+
|
|
72
|
+
Pass a partial theme to `JokkooProvider`. Values map to CSS custom properties on
|
|
73
|
+
`.jokkoo-widget` (e.g. `--jk-color-primary`).
|
|
74
|
+
|
|
75
|
+
## Features
|
|
76
|
+
|
|
77
|
+
- Realtime messaging (Socket.IO `/sdk`)
|
|
78
|
+
- File attachments (presigned upload)
|
|
79
|
+
- Voice messages (MediaRecorder)
|
|
80
|
+
- Closed-conversation policy + resolved banner
|
|
81
|
+
- Satisfaction rating
|
|
82
|
+
- Fullscreen expand
|
|
83
|
+
- Locales: `fr` (default), `en`
|
|
84
|
+
|
|
85
|
+
## License
|
|
86
|
+
|
|
87
|
+
Apache-2.0
|