@connectycube/chat-widget 0.34.0 → 0.36.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/dist/index.es.js +2672 -3024
- package/dist/index.umd.js +83 -89
- package/dist/{react19.es.js → react18.es.js} +2958 -2610
- package/dist/types/App.d.ts +2 -2
- package/dist/types/helpers/connectycube.d.ts +1 -1
- package/dist/types/index.d.ts +2 -1
- package/package.json +41 -41
- package/CHANGELOG.md +0 -160
- package/README.md +0 -194
package/dist/types/App.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Config } from 'connectycube/types';
|
|
2
2
|
import { AppPresets } from './hooks/useAppPresets';
|
|
3
3
|
export type AppProps = AppPresets & {
|
|
4
|
-
appId:
|
|
5
|
-
authKey:
|
|
4
|
+
appId: number | string;
|
|
5
|
+
authKey: string;
|
|
6
6
|
config?: Config.Options;
|
|
7
7
|
userId?: string;
|
|
8
8
|
userName?: string;
|
|
@@ -40,7 +40,7 @@ export declare const updateUserSettings: (settings: {
|
|
|
40
40
|
export declare const getSessionToken: () => string | null;
|
|
41
41
|
export declare const getSessionUserId: () => number | null;
|
|
42
42
|
export declare const isSessionExpired: () => boolean;
|
|
43
|
-
export declare const isUserIdChanged: (userId?: string) => boolean;
|
|
43
|
+
export declare const isUserIdChanged: (userId?: string | number | null) => boolean;
|
|
44
44
|
export declare const sha256: (str: string) => Promise<string>;
|
|
45
45
|
export declare const getUserName: (user: Users.User | null | undefined, force?: boolean) => string;
|
|
46
46
|
export declare const getPhotoUrl: (photoOrAvatar?: string | null) => string;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
export { default } from './App';
|
|
2
|
+
export type { AppProps as ConnectyCubeChatWidgetProps } from './App';
|
|
1
3
|
export type ChatWidgetInWindow = {
|
|
2
4
|
initialNotification?: MessageEvent['data'];
|
|
3
5
|
open?: () => void;
|
|
@@ -7,4 +9,3 @@ export type ChatWidgetInWindow = {
|
|
|
7
9
|
export type WindowWithChatWidget = Window & typeof globalThis & {
|
|
8
10
|
ConnectyCubeChatWidget?: ChatWidgetInWindow;
|
|
9
11
|
};
|
|
10
|
-
export { default } from './App';
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@connectycube/chat-widget",
|
|
3
|
-
"description": "A React
|
|
4
|
-
"version": "0.
|
|
3
|
+
"description": "A customizable React chat widget built on the ConnectyCube platform, enabling real-time messaging, calls, and user engagement in any web app.",
|
|
4
|
+
"version": "0.36.0",
|
|
5
5
|
"license": "GPL-3.0-only",
|
|
6
|
-
"homepage": "https://github.com/ConnectyCube/connectycube-chat-widget#readme",
|
|
6
|
+
"homepage": "https://github.com/ConnectyCube/connectycube-chat-widget/chat-widget#readme",
|
|
7
7
|
"bugs": {
|
|
8
8
|
"url": "https://github.com/ConnectyCube/connectycube-chat-widget/issues"
|
|
9
9
|
},
|
|
@@ -45,13 +45,18 @@
|
|
|
45
45
|
},
|
|
46
46
|
"./react19": {
|
|
47
47
|
"types": "./dist/types/index.d.ts",
|
|
48
|
-
"import": "./dist/
|
|
49
|
-
"default": "./dist/
|
|
48
|
+
"import": "./dist/index.es.js",
|
|
49
|
+
"default": "./dist/index.es.js"
|
|
50
|
+
},
|
|
51
|
+
"./react18": {
|
|
52
|
+
"types": "./dist/types/index.d.ts",
|
|
53
|
+
"import": "./dist/react18.es.js",
|
|
54
|
+
"default": "./dist/react18.es.js"
|
|
50
55
|
}
|
|
51
56
|
},
|
|
52
57
|
"files": [
|
|
53
58
|
"dist",
|
|
54
|
-
"CHANGELOG.md"
|
|
59
|
+
"../../CHANGELOG.md"
|
|
55
60
|
],
|
|
56
61
|
"publishConfig": {
|
|
57
62
|
"access": "public"
|
|
@@ -67,26 +72,21 @@
|
|
|
67
72
|
"tailwindcss": "npx @tailwindcss/cli -i ./src/index.css -o ./src/widget.css",
|
|
68
73
|
"tailwindcss:watch": "npx @tailwindcss/cli -i ./src/index.css -o ./src/widget.css --watch",
|
|
69
74
|
"tailwindcss:minify": "npx @tailwindcss/cli -i ./src/index.css -o ./src/widget.css --minify",
|
|
70
|
-
"dev": "npx npm-run-all --parallel vite:dev tailwindcss:watch",
|
|
71
75
|
"dev:18": "npm run react:18 && REACT_VERSION=18 BUNDLE_FORMAT=es vite",
|
|
72
76
|
"dev:19": "npm run react:19 && REACT_VERSION=19 BUNDLE_FORMAT=es vite",
|
|
73
|
-
"
|
|
77
|
+
"dev": "npx npm-run-all --parallel vite:dev tailwindcss:watch",
|
|
74
78
|
"build:18": "npm run tailwindcss:minify && npm run react:18 && REACT_VERSION=18 npm run vite:build:es && KEEP_DIST=true npm run vite:build:umd",
|
|
75
79
|
"build:19": "npm run tailwindcss:minify && npm run react:19 && REACT_VERSION=19 npm run vite:build:es",
|
|
76
80
|
"build:default": "npm run tailwindcss:minify && npm run vite:build",
|
|
81
|
+
"build": "npm run tailwindcss:minify && npm run react:18 && REACT_VERSION=18 npm run vite:build:es && KEEP_DIST=true npm run vite:build:umd && npm run react:19 && REACT_VERSION=19 KEEP_DIST=true npm run vite:build:es && npm run react:default",
|
|
77
82
|
"preview": "npm run tailwindcss && npm run vite:preview",
|
|
78
83
|
"lint": "eslint .",
|
|
79
84
|
"test": "vitest",
|
|
80
85
|
"test:ci": "vitest run",
|
|
81
|
-
"coverage": "vitest run --coverage"
|
|
82
|
-
"version": "node ./scripts/bump-version.cjs",
|
|
83
|
-
"version:patch": "npm run version patch",
|
|
84
|
-
"version:minor": "npm run version minor",
|
|
85
|
-
"version:major": "npm run version major",
|
|
86
|
-
"changelog": "node ./scripts/changelog.cjs"
|
|
86
|
+
"coverage": "vitest run --coverage"
|
|
87
87
|
},
|
|
88
88
|
"dependencies": {
|
|
89
|
-
"@ai-sdk/google": "^2.0.
|
|
89
|
+
"@ai-sdk/google": "^2.0.17",
|
|
90
90
|
"@connectycube/use-calls": "^0.12.1",
|
|
91
91
|
"@connectycube/use-chat": "^0.27.0",
|
|
92
92
|
"@radix-ui/react-alert-dialog": "^1.1.15",
|
|
@@ -99,23 +99,23 @@
|
|
|
99
99
|
"@radix-ui/react-switch": "^1.2.6",
|
|
100
100
|
"@radix-ui/react-tabs": "^1.1.13",
|
|
101
101
|
"@radix-ui/react-tooltip": "^1.2.8",
|
|
102
|
-
"ai": "^5.0.
|
|
102
|
+
"ai": "^5.0.54",
|
|
103
103
|
"class-variance-authority": "^0.7.1",
|
|
104
104
|
"clsx": "^2.1.1",
|
|
105
|
-
"connectycube": "^4.7.
|
|
106
|
-
"get-browser-fingerprint": "^4.1.
|
|
107
|
-
"i18next": "^25.
|
|
105
|
+
"connectycube": "^4.7.2",
|
|
106
|
+
"get-browser-fingerprint": "^4.1.1",
|
|
107
|
+
"i18next": "^25.5.2",
|
|
108
108
|
"linkify-react": "^4.3.2",
|
|
109
109
|
"linkifyjs": "^4.3.2",
|
|
110
|
-
"lucide-react": "^0.
|
|
110
|
+
"lucide-react": "^0.544.0",
|
|
111
111
|
"next-themes": "^0.4.6",
|
|
112
|
-
"react-hook-form": "^7.
|
|
113
|
-
"react-i18next": "^
|
|
112
|
+
"react-hook-form": "^7.63.0",
|
|
113
|
+
"react-i18next": "^16.0.0",
|
|
114
114
|
"react-icons": "^5.5.0",
|
|
115
115
|
"react-intersection-observer": "^9.16.0",
|
|
116
116
|
"react-player": "^2.16.1",
|
|
117
117
|
"sonner": "^2.0.7",
|
|
118
|
-
"virtua": "^0.
|
|
118
|
+
"virtua": "^0.43.4",
|
|
119
119
|
"zustand": "^5.0.8"
|
|
120
120
|
},
|
|
121
121
|
"peerDependencies": {
|
|
@@ -123,37 +123,37 @@
|
|
|
123
123
|
"react-dom": ">=18"
|
|
124
124
|
},
|
|
125
125
|
"devDependencies": {
|
|
126
|
-
"@eslint/js": "^9.
|
|
127
|
-
"@tailwindcss/postcss": "^4.1.
|
|
128
|
-
"@tailwindcss/vite": "^4.1.
|
|
129
|
-
"@types/node": "^24.
|
|
130
|
-
"@types/react": "^19.1.
|
|
131
|
-
"@types/react-dom": "^19.1.
|
|
132
|
-
"@vitejs/plugin-react": "^5.0.
|
|
126
|
+
"@eslint/js": "^9.36.0",
|
|
127
|
+
"@tailwindcss/postcss": "^4.1.13",
|
|
128
|
+
"@tailwindcss/vite": "^4.1.13",
|
|
129
|
+
"@types/node": "^24.5.2",
|
|
130
|
+
"@types/react": "^19.1.13",
|
|
131
|
+
"@types/react-dom": "^19.1.9",
|
|
132
|
+
"@vitejs/plugin-react": "^5.0.3",
|
|
133
133
|
"@vitest/coverage-v8": "^3.2.4",
|
|
134
|
-
"eslint": "^9.
|
|
134
|
+
"eslint": "^9.36.0",
|
|
135
135
|
"eslint-plugin-react-hooks": "^5.2.0",
|
|
136
|
-
"eslint-plugin-react-refresh": "^0.4.
|
|
137
|
-
"globals": "^16.
|
|
138
|
-
"jsdom": "^
|
|
136
|
+
"eslint-plugin-react-refresh": "^0.4.22",
|
|
137
|
+
"globals": "^16.4.0",
|
|
138
|
+
"jsdom": "^27.0.0",
|
|
139
139
|
"prettier": "3.6.2",
|
|
140
140
|
"tailwind-merge": "^3.3.1",
|
|
141
141
|
"tailwind-scrollbar": "^4.0.2",
|
|
142
|
-
"tailwindcss": "^4.1.
|
|
143
|
-
"tw-animate-css": "^1.
|
|
142
|
+
"tailwindcss": "^4.1.13",
|
|
143
|
+
"tw-animate-css": "^1.4.0",
|
|
144
144
|
"typescript": "^5.9.2",
|
|
145
|
-
"typescript-eslint": "^8.
|
|
146
|
-
"vite": "^7.1.
|
|
145
|
+
"typescript-eslint": "^8.44.1",
|
|
146
|
+
"vite": "^7.1.7",
|
|
147
147
|
"vite-plugin-dts": "^4.5.4",
|
|
148
148
|
"vitest": "^3.2.4"
|
|
149
149
|
},
|
|
150
150
|
"optionalDependencies": {
|
|
151
|
-
"@rollup/rollup-linux-x64-gnu": "4.
|
|
152
|
-
"@tailwindcss/oxide-linux-x64-gnu": "^4.1.
|
|
151
|
+
"@rollup/rollup-linux-x64-gnu": "4.52.2",
|
|
152
|
+
"@tailwindcss/oxide-linux-x64-gnu": "^4.1.13",
|
|
153
153
|
"lightningcss-linux-x64-gnu": "^1.30.1"
|
|
154
154
|
},
|
|
155
155
|
"engines": {
|
|
156
156
|
"node": ">=20.0.0",
|
|
157
157
|
"npm": ">=10.0.0"
|
|
158
158
|
}
|
|
159
|
-
}
|
|
159
|
+
}
|
package/CHANGELOG.md
DELETED
|
@@ -1,160 +0,0 @@
|
|
|
1
|
-
<a name="0.34.0"></a>
|
|
2
|
-
|
|
3
|
-
## 0.34.0
|
|
4
|
-
|
|
5
|
-
### Chores
|
|
6
|
-
|
|
7
|
-
- new commands in `package.json` to bump major/minor/patch versions
|
|
8
|
-
|
|
9
|
-
### Features
|
|
10
|
-
|
|
11
|
-
- call history
|
|
12
|
-
- implemented auto-grow text input for typing message
|
|
13
|
-
- ability to change tone of message for typed text via AI
|
|
14
|
-
- AI text summarization in chat
|
|
15
|
-
- new prop `ai` to configure AI options. `ai: { textSummarization: boolean }`
|
|
16
|
-
- supported new variable `GOOGLE_GENERATIVE_AI_API_KEY` in `.env` to set `apiKey` for "gemini-2.5-flash" model
|
|
17
|
-
|
|
18
|
-
<a name="0.33.0"></a>
|
|
19
|
-
|
|
20
|
-
## 0.33.0
|
|
21
|
-
|
|
22
|
-
<a name="0.32.1"></a>
|
|
23
|
-
|
|
24
|
-
## 0.32.1
|
|
25
|
-
|
|
26
|
-
<a name="0.32.0"></a>
|
|
27
|
-
|
|
28
|
-
## 0.32.0
|
|
29
|
-
|
|
30
|
-
<a name="0.31.0"></a>
|
|
31
|
-
|
|
32
|
-
## 0.31.0
|
|
33
|
-
|
|
34
|
-
<a name="0.30.2"></a>
|
|
35
|
-
|
|
36
|
-
## 0.30.2
|
|
37
|
-
|
|
38
|
-
<a name="0.30.1"></a>
|
|
39
|
-
|
|
40
|
-
## 0.30.1
|
|
41
|
-
|
|
42
|
-
<a name="0.30.0"></a>
|
|
43
|
-
|
|
44
|
-
## 0.30.0
|
|
45
|
-
|
|
46
|
-
<a name="0.29.0"></a>
|
|
47
|
-
|
|
48
|
-
## 0.29.0
|
|
49
|
-
|
|
50
|
-
<a name="0.28.0"></a>
|
|
51
|
-
|
|
52
|
-
## 0.28.0
|
|
53
|
-
|
|
54
|
-
<a name="0.27.0"></a>
|
|
55
|
-
|
|
56
|
-
## 0.27.0
|
|
57
|
-
|
|
58
|
-
<a name="0.26.1"></a>
|
|
59
|
-
|
|
60
|
-
## 0.26.1
|
|
61
|
-
|
|
62
|
-
<a name="0.26.0"></a>
|
|
63
|
-
|
|
64
|
-
## 0.26.0
|
|
65
|
-
|
|
66
|
-
<a name="0.25.0"></a>
|
|
67
|
-
|
|
68
|
-
## 0.25.0
|
|
69
|
-
|
|
70
|
-
<a name="0.24.0"></a>
|
|
71
|
-
|
|
72
|
-
## 0.24.0
|
|
73
|
-
|
|
74
|
-
<a name="0.23.0"></a>
|
|
75
|
-
|
|
76
|
-
## 0.23.0
|
|
77
|
-
|
|
78
|
-
<a name="0.22.0"></a>
|
|
79
|
-
|
|
80
|
-
## 0.22.0
|
|
81
|
-
|
|
82
|
-
<a name="0.21.1"></a>
|
|
83
|
-
|
|
84
|
-
## 0.21.1
|
|
85
|
-
|
|
86
|
-
<a name="0.21.0"></a>
|
|
87
|
-
|
|
88
|
-
## 0.21.0
|
|
89
|
-
|
|
90
|
-
<a name="0.20.0"></a>
|
|
91
|
-
|
|
92
|
-
## 0.20.0
|
|
93
|
-
|
|
94
|
-
### Reverts
|
|
95
|
-
|
|
96
|
-
- bump connectycube[@4](https://github.com/4).1.4
|
|
97
|
-
|
|
98
|
-
<a name="0.19.0"></a>
|
|
99
|
-
|
|
100
|
-
## 0.19.0
|
|
101
|
-
|
|
102
|
-
<a name="0.18.0"></a>
|
|
103
|
-
|
|
104
|
-
## 0.18.0
|
|
105
|
-
|
|
106
|
-
<a name="0.17.0"></a>
|
|
107
|
-
|
|
108
|
-
## 0.17.0
|
|
109
|
-
|
|
110
|
-
<a name="0.16.0"></a>
|
|
111
|
-
|
|
112
|
-
## 0.16.0
|
|
113
|
-
|
|
114
|
-
<a name="0.15.2"></a>
|
|
115
|
-
|
|
116
|
-
## 0.15.2
|
|
117
|
-
|
|
118
|
-
<a name="0.15.1"></a>
|
|
119
|
-
|
|
120
|
-
## 0.15.1
|
|
121
|
-
|
|
122
|
-
<a name="0.15.0"></a>
|
|
123
|
-
|
|
124
|
-
## 0.15.0
|
|
125
|
-
|
|
126
|
-
<a name="0.14.4"></a>
|
|
127
|
-
|
|
128
|
-
## 0.14.4
|
|
129
|
-
|
|
130
|
-
<a name="0.14.3"></a>
|
|
131
|
-
|
|
132
|
-
## 0.14.3
|
|
133
|
-
|
|
134
|
-
### Reverts
|
|
135
|
-
|
|
136
|
-
- [JS-59] update attachments
|
|
137
|
-
|
|
138
|
-
<a name="0.14.2"></a>
|
|
139
|
-
|
|
140
|
-
## 0.14.2
|
|
141
|
-
|
|
142
|
-
<a name="0.14.0"></a>
|
|
143
|
-
|
|
144
|
-
## 0.14.0
|
|
145
|
-
|
|
146
|
-
<a name="0.13.0"></a>
|
|
147
|
-
|
|
148
|
-
## 0.13.0
|
|
149
|
-
|
|
150
|
-
<a name="0.12.0"></a>
|
|
151
|
-
|
|
152
|
-
## 0.12.0
|
|
153
|
-
|
|
154
|
-
<a name="0.11.0"></a>
|
|
155
|
-
|
|
156
|
-
## 0.11.0
|
|
157
|
-
|
|
158
|
-
<a name="0.10.0"></a>
|
|
159
|
-
|
|
160
|
-
## 0.10.0
|
package/README.md
DELETED
|
@@ -1,194 +0,0 @@
|
|
|
1
|
-
# ConnectyCube Chat Widget
|
|
2
|
-
|
|
3
|
-
A React component that seamlessly integrates ConnectyCube's real-time chat capabilities into your web applications. This widget offers an out-of-the-box solution for embedding chat features—such as instant messaging, user presence, and file sharing—without the overhead of building a complete chat system from scratch.
|
|
4
|
-
|
|
5
|
-
## Overview
|
|
6
|
-
|
|
7
|
-
The ConnectyCube Web Chat Widget for React is designed to simplify the process of adding chat functionality to your React apps. With a few configuration steps and minimal code, you can quickly enable robust, real-time communication powered by ConnectyCube. Key benefits include:
|
|
8
|
-
|
|
9
|
-
- **Easy Integration:** Plug the widget into your existing React projects.
|
|
10
|
-
- **Customizable Interface:** Adjust the look and feel to match your brand.
|
|
11
|
-
- **Real-Time Messaging:** Leverage ConnectyCube's reliable backend for instant communication.
|
|
12
|
-
- **Responsive Design:** Works seamlessly on both desktop and mobile devices.
|
|
13
|
-
- **Modular and Extensible:** Adapt the widget to your unique requirements.
|
|
14
|
-
|
|
15
|
-
## Demo
|
|
16
|
-
|
|
17
|
-
<https://connectycube-chat-widget.onrender.com>
|
|
18
|
-
|
|
19
|
-
Split-view chat widget:
|
|
20
|
-
|
|
21
|
-
<kbd><img alt="ConnectyCube chat widget, split view image demo" src="https://developers.connectycube.com/images/chat_widget/chat-widget-1.png" width="400" /></kbd>
|
|
22
|
-
|
|
23
|
-
Single-view chat widget:
|
|
24
|
-
|
|
25
|
-
<kbd><img alt="ConnectyCube chat widget, single view image demo" src="https://developers.connectycube.com/images/chat_widget/chat-widget-2.png" width="400" /></kbd>
|
|
26
|
-
|
|
27
|
-
## Documentation
|
|
28
|
-
|
|
29
|
-
<https://developers.connectycube.com/js/chat-widget>
|
|
30
|
-
|
|
31
|
-
## Installation
|
|
32
|
-
|
|
33
|
-
### React
|
|
34
|
-
|
|
35
|
-
```bash
|
|
36
|
-
# npm
|
|
37
|
-
npm install @connectycube/chat-widget
|
|
38
|
-
|
|
39
|
-
# yarn
|
|
40
|
-
yarn add @connectycube/chat-widget
|
|
41
|
-
```
|
|
42
|
-
|
|
43
|
-
### Vanilla JS
|
|
44
|
-
|
|
45
|
-
Add the following scripts on your html page somewhere in `head` element:
|
|
46
|
-
|
|
47
|
-
```html
|
|
48
|
-
<script src="https://unpkg.com/react@18/umd/react.production.min.js" crossorigin></script>
|
|
49
|
-
<script src="https://unpkg.com/react-dom@18/umd/react-dom.production.min.js" crossorigin></script>
|
|
50
|
-
<script src="https://unpkg.com/connectycube@4/dist/connectycube.min.js"></script>
|
|
51
|
-
<script src="https://unpkg.com/@connectycube/chat-widget@latest/dist/index.umd.js"></script>
|
|
52
|
-
```
|
|
53
|
-
|
|
54
|
-
## Usage
|
|
55
|
-
|
|
56
|
-
### Before you start
|
|
57
|
-
|
|
58
|
-
Before you start, make sure:
|
|
59
|
-
|
|
60
|
-
1. You have access to your ConnectyCube account. If you don’t have an account, [sign up here](https://admin.connectycube.com/register).
|
|
61
|
-
2. An app created in ConnectyCube dashboard. Once logged into [your ConnectyCube account](https://admin.connectycube.com/), create a new application and make a note of the app credentials (**App ID** and **Authorization Key**) that you’ll need for authentication.
|
|
62
|
-
|
|
63
|
-
### Display widget
|
|
64
|
-
|
|
65
|
-
#### React
|
|
66
|
-
|
|
67
|
-
Import and place the following component in your app:
|
|
68
|
-
|
|
69
|
-
```js
|
|
70
|
-
import ConnectyCubeChatWidget from "@connectycube/chat-widget";
|
|
71
|
-
|
|
72
|
-
...
|
|
73
|
-
|
|
74
|
-
<ConnectyCubeChatWidget
|
|
75
|
-
appId="111"
|
|
76
|
-
authKey="11111111-2222-3333-4444-55555555"
|
|
77
|
-
config={{ debug: { mode: 1 } }}
|
|
78
|
-
userId="112233"
|
|
79
|
-
userName="Samuel"
|
|
80
|
-
showOnlineUsersTab={false}
|
|
81
|
-
splitView={true}
|
|
82
|
-
/>
|
|
83
|
-
|
|
84
|
-
// userName - how other users will see your user name
|
|
85
|
-
// userId - a User Id from your system
|
|
86
|
-
```
|
|
87
|
-
|
|
88
|
-
See chat widget code samples <https://github.com/ConnectyCube/connectycube-chat-widget-samples> as a reference for faster integration.
|
|
89
|
-
|
|
90
|
-
#### React 19
|
|
91
|
-
|
|
92
|
-
By default, the widget uses the React 18-compatible build. To use it with React 19, import the dedicated ESM-only build instead:
|
|
93
|
-
|
|
94
|
-
```js
|
|
95
|
-
import ConnectyCubeChatWidget from '@connectycube/chat-widget/react19';
|
|
96
|
-
```
|
|
97
|
-
|
|
98
|
-
#### Vanilla JS
|
|
99
|
-
|
|
100
|
-
Place the following script in your app:
|
|
101
|
-
|
|
102
|
-
```html
|
|
103
|
-
<!doctype html>
|
|
104
|
-
<html lang="en">
|
|
105
|
-
<head>
|
|
106
|
-
<!-- ... -->
|
|
107
|
-
</head>
|
|
108
|
-
<body>
|
|
109
|
-
<!-- ... -->
|
|
110
|
-
<!-- @connectycube/chat-widget - start -->
|
|
111
|
-
<script src="https://unpkg.com/react@18/umd/react.production.min.js" crossorigin></script>
|
|
112
|
-
<script src="https://unpkg.com/react-dom@18/umd/react-dom.production.min.js" crossorigin></script>
|
|
113
|
-
<script src="https://unpkg.com/connectycube@4/dist/connectycube.min.js"></script>
|
|
114
|
-
<script src="https://unpkg.com/@connectycube/chat-widget@latest/dist/index.umd.js"></script>
|
|
115
|
-
<script>
|
|
116
|
-
const chatWidgetContainer = document.createElement('div');
|
|
117
|
-
chatWidgetContainer.id = 'ConnectyCube_chat-widget';
|
|
118
|
-
document.body.appendChild(chatWidgetContainer);
|
|
119
|
-
const props = {
|
|
120
|
-
appId: 111,
|
|
121
|
-
authKey: '11111111-2222-3333-4444-55555555',
|
|
122
|
-
config: { debug: { mode: 1 } },
|
|
123
|
-
userId: '112233', // a User Id from your system
|
|
124
|
-
userName: 'Samuel', // how other users will see your user name
|
|
125
|
-
showOnlineUsersTab: false,
|
|
126
|
-
splitView: true,
|
|
127
|
-
hideWidgetButton: false,
|
|
128
|
-
onOpenChange: (open) => {
|
|
129
|
-
console.log('Chat widget is open:', open);
|
|
130
|
-
},
|
|
131
|
-
onUnreadCountChange: (count) => {
|
|
132
|
-
console.log('Unread messages count:', count);
|
|
133
|
-
},
|
|
134
|
-
};
|
|
135
|
-
ReactDOM.createRoot(chatWidgetContainer).render(React.createElement(ConnectyCubeChatWidget, props));
|
|
136
|
-
|
|
137
|
-
// use the code below as an example to toggle the chat widget visibility state for custom button
|
|
138
|
-
document.getElementById('someCustomButton').addEventListener('click', () => {
|
|
139
|
-
ConnectyCubeChatWidget.toggle();
|
|
140
|
-
});
|
|
141
|
-
</script>
|
|
142
|
-
<!-- @connectycube/chat-widget - end -->
|
|
143
|
-
</body>
|
|
144
|
-
</html>
|
|
145
|
-
```
|
|
146
|
-
|
|
147
|
-
See chat widget code samples <https://github.com/ConnectyCube/connectycube-chat-widget-samples> as a reference for faster integration.
|
|
148
|
-
|
|
149
|
-
## Props
|
|
150
|
-
|
|
151
|
-
See all available props <https://developers.connectycube.com/js/chat-widget/#props>
|
|
152
|
-
|
|
153
|
-
## Recipes
|
|
154
|
-
|
|
155
|
-
See all available recipes <https://developers.connectycube.com/js/chat-widget/#recipes>
|
|
156
|
-
|
|
157
|
-
## SSR (Server-Side Rendering) Guide
|
|
158
|
-
|
|
159
|
-
When using `@connectycube/chat-widget` in SSR environments (e.g., Next.js, Remix), some native Node.js modules like events may cause errors due to differences between Node and browser environments. Here are recommendations to ensure smooth SSR integration:
|
|
160
|
-
|
|
161
|
-
### Usage
|
|
162
|
-
|
|
163
|
-
```bash
|
|
164
|
-
# npm
|
|
165
|
-
npm install @connectycube/chat-widget
|
|
166
|
-
npx connectycube patch-ssr # Apply SSR patches
|
|
167
|
-
# npx connectycube revert-ssr # Revert SSR patches
|
|
168
|
-
|
|
169
|
-
# yarn
|
|
170
|
-
yarn add @connectycube/chat-widget
|
|
171
|
-
yarn connectycube patch-ssr # Apply SSR patches
|
|
172
|
-
# yarn connectycube revert-ssr # Revert SSR patches
|
|
173
|
-
```
|
|
174
|
-
|
|
175
|
-
The `connectycube` CLI will be available as part of the `connectycube` package, which is installed automatically as a dependency of `@connectycube/chat-widget`. This script applies fixes to make the SDK compatible with SSR environments.
|
|
176
|
-
|
|
177
|
-
## Have an issue?
|
|
178
|
-
|
|
179
|
-
Join our [Discord](https://discord.com/invite/zqbBWNCCFJ) community to get real-time help from our team
|
|
180
|
-
|
|
181
|
-
## Community
|
|
182
|
-
|
|
183
|
-
- [Blog](https://connectycube.com/blog)
|
|
184
|
-
- X (twitter)[@ConnectyCube](https://x.com/ConnectyCube)
|
|
185
|
-
- [Facebook](https://www.facebook.com/ConnectyCube)
|
|
186
|
-
- [Medium](https://medium.com/@connectycube)
|
|
187
|
-
- [YouTube](https://www.youtube.com/@ConnectyCube)
|
|
188
|
-
|
|
189
|
-
**Want to support our team**:<br>
|
|
190
|
-
<a href="https://www.buymeacoffee.com/connectycube" target="_blank"><img src="https://cdn.buymeacoffee.com/buttons/v2/default-blue.png" alt="Buy Me A Coffee" style="height: 60px !important;width: 217px !important;" ></a>
|
|
191
|
-
|
|
192
|
-
## Changelog
|
|
193
|
-
|
|
194
|
-
<https://github.com/ConnectyCube/connectycube-chat-widget-samples/blob/main/CHANGELOG.md>
|