@connectycube/chat-widget 0.36.0 → 0.37.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/README.md +203 -0
- package/dist/index.es.js +9802 -3634
- package/dist/index.umd.js +155 -99
- package/dist/react18.es.js +10020 -3852
- package/dist/types/App.d.ts +1 -1
- package/dist/types/components/calls/calls-nav-buttons.d.ts +5 -0
- package/dist/types/components/calls/calls-screen.d.ts +2 -0
- package/dist/types/components/connectycube-ui/stream-view.d.ts +47 -0
- package/dist/types/components/connectycube-ui/utils.d.ts +3 -0
- package/dist/types/components/home/main/chat-info-user.d.ts +1 -1
- package/dist/types/components/home/main/chat-input.d.ts +2 -2
- package/dist/types/components/home/main/message/call-message.d.ts +1 -1
- package/dist/types/components/home/main/message/message-attachment.d.ts +1 -1
- package/dist/types/components/home/main/message/message-status-mark.d.ts +1 -1
- package/dist/types/components/home/main/message/message.d.ts +1 -1
- package/dist/types/components/home/main/my-profile/my-block-list-item.d.ts +1 -1
- package/dist/types/components/home/sidebar/chat-item.d.ts +1 -1
- package/dist/types/components/home/sidebar/new-chat/create-group-chat/create-group-chat.d.ts +1 -1
- package/dist/types/helpers/connectycube.d.ts +2 -2
- package/dist/types/helpers/widget.d.ts +1 -1
- package/dist/types/hooks/store/useAppDefaultChatStore.d.ts +1 -0
- package/dist/types/hooks/store/useProfileStore.d.ts +2 -2
- package/dist/types/hooks/useAppAuthorization.d.ts +1 -1
- package/dist/types/hooks/useCallHistory.d.ts +3 -3
- package/dist/types/hooks/useNotification.d.ts +1 -1
- package/dist/types/hooks/useTypingStatusText.d.ts +1 -1
- package/dist/types/lib/utils.d.ts +1 -1
- package/package.json +32 -34
- package/dist/types/components/calls/calls-fullscreen-stream.d.ts +0 -6
- package/dist/types/components/calls/calls-modal-screen.d.ts +0 -2
- package/dist/types/components/calls/calls-navigation/calls-nav-buttons.d.ts +0 -5
- package/dist/types/components/calls/calls-navigation/calls-nav-hung-up.d.ts +0 -2
- package/dist/types/components/calls/calls-navigation/calls-nav-screen-share.d.ts +0 -2
- package/dist/types/components/calls/calls-navigation/calls-nav-toggle-camera.d.ts +0 -2
- package/dist/types/components/calls/calls-navigation/calls-nav-toggle-mic.d.ts +0 -2
- /package/dist/types/components/calls/{calls-header-buttons.d.ts → calls-buttons.d.ts} +0 -0
package/README.md
ADDED
|
@@ -0,0 +1,203 @@
|
|
|
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
|
+
- React: <https://connectycube-chat-widget.onrender.com>
|
|
18
|
+
- Vanilla JS: <https://connectycube-chat-widget-vanilla.onrender.com>
|
|
19
|
+
|
|
20
|
+
Split-view chat widget:
|
|
21
|
+
|
|
22
|
+
<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>
|
|
23
|
+
|
|
24
|
+
Single-view chat widget:
|
|
25
|
+
|
|
26
|
+
<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>
|
|
27
|
+
|
|
28
|
+
## Documentation
|
|
29
|
+
|
|
30
|
+
<https://developers.connectycube.com/js/chat-widget>
|
|
31
|
+
|
|
32
|
+
## Installation
|
|
33
|
+
|
|
34
|
+
### React
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
# npm
|
|
38
|
+
npm install @connectycube/chat-widget
|
|
39
|
+
|
|
40
|
+
# yarn
|
|
41
|
+
yarn add @connectycube/chat-widget
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
### Vanilla JS
|
|
45
|
+
|
|
46
|
+
Add the following scripts on your html page somewhere in `head` element:
|
|
47
|
+
|
|
48
|
+
```html
|
|
49
|
+
<script src="https://unpkg.com/react@18/umd/react.production.min.js" crossorigin></script>
|
|
50
|
+
<script src="https://unpkg.com/react-dom@18/umd/react-dom.production.min.js" crossorigin></script>
|
|
51
|
+
<script src="https://unpkg.com/connectycube@4/dist/connectycube.min.js"></script>
|
|
52
|
+
<script src="https://unpkg.com/@connectycube/chat-widget@latest/dist/index.umd.js"></script>
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## Usage
|
|
56
|
+
|
|
57
|
+
### Before you start
|
|
58
|
+
|
|
59
|
+
Before you start, make sure:
|
|
60
|
+
|
|
61
|
+
1. You have access to your ConnectyCube account. If you don’t have an account, [sign up here](https://admin.connectycube.com/register).
|
|
62
|
+
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.
|
|
63
|
+
|
|
64
|
+
### Display widget
|
|
65
|
+
|
|
66
|
+
#### React
|
|
67
|
+
|
|
68
|
+
Import and place the following component in your app:
|
|
69
|
+
|
|
70
|
+
```js
|
|
71
|
+
import ConnectyCubeChatWidget from "@connectycube/chat-widget";
|
|
72
|
+
|
|
73
|
+
...
|
|
74
|
+
|
|
75
|
+
<ConnectyCubeChatWidget
|
|
76
|
+
appId="111"
|
|
77
|
+
authKey="11111111-2222-3333-4444-55555555"
|
|
78
|
+
config={{ debug: { mode: 1 } }}
|
|
79
|
+
userId="112233"
|
|
80
|
+
userName="Samuel"
|
|
81
|
+
showOnlineUsersTab={false}
|
|
82
|
+
splitView={true}
|
|
83
|
+
/>
|
|
84
|
+
|
|
85
|
+
// userName - how other users will see your user name
|
|
86
|
+
// userId - a User Id from your system
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
See chat widget code samples <https://github.com/ConnectyCube/connectycube-chat-widget-samples/tree/main/react-ts> as a reference for faster integration.
|
|
90
|
+
|
|
91
|
+
##### React version support
|
|
92
|
+
|
|
93
|
+
Since v0.35.0, the default build of the widget targets React 19 and is provided as an ESM module.
|
|
94
|
+
For React 18 projects, use the dedicated ESM-only build:
|
|
95
|
+
|
|
96
|
+
```js
|
|
97
|
+
// v0.35.0 and later:
|
|
98
|
+
import ConnectyCubeChatWidget from '@connectycube/chat-widget'; // default: React 19
|
|
99
|
+
import ConnectyCubeChatWidget from '@connectycube/chat-widget/react19'; // explicit React 19 build
|
|
100
|
+
import ConnectyCubeChatWidget from '@connectycube/chat-widget/react18'; // dedicated React 18 build
|
|
101
|
+
|
|
102
|
+
// v0.34.0 and earlier:
|
|
103
|
+
import ConnectyCubeChatWidget from '@connectycube/chat-widget'; // default: React 18
|
|
104
|
+
import ConnectyCubeChatWidget from '@connectycube/chat-widget/react19'; // React 19 build
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
#### Vanilla JS
|
|
108
|
+
|
|
109
|
+
Place the following script in your app:
|
|
110
|
+
|
|
111
|
+
```html
|
|
112
|
+
<!DOCTYPE html>
|
|
113
|
+
<html lang="en">
|
|
114
|
+
<head>
|
|
115
|
+
<!-- ... -->
|
|
116
|
+
</head>
|
|
117
|
+
<body>
|
|
118
|
+
<!-- ... -->
|
|
119
|
+
<!-- @connectycube/chat-widget - start -->
|
|
120
|
+
<script src="https://unpkg.com/react@18/umd/react.production.min.js" crossorigin></script>
|
|
121
|
+
<script src="https://unpkg.com/react-dom@18/umd/react-dom.production.min.js" crossorigin></script>
|
|
122
|
+
<script src="https://unpkg.com/connectycube@4/dist/connectycube.min.js"></script>
|
|
123
|
+
<script src="https://unpkg.com/@connectycube/chat-widget@latest/dist/index.umd.js"></script>
|
|
124
|
+
<script>
|
|
125
|
+
const chatWidgetContainer = document.createElement('div');
|
|
126
|
+
chatWidgetContainer.id = 'ConnectyCube_chat-widget';
|
|
127
|
+
document.body.appendChild(chatWidgetContainer);
|
|
128
|
+
const props = {
|
|
129
|
+
appId: 111,
|
|
130
|
+
authKey: '11111111-2222-3333-4444-55555555',
|
|
131
|
+
config: { debug: { mode: 1 } },
|
|
132
|
+
userId: '112233', // a User Id from your system
|
|
133
|
+
userName: 'Samuel', // how other users will see your user name
|
|
134
|
+
showOnlineUsersTab: false,
|
|
135
|
+
splitView: true,
|
|
136
|
+
hideWidgetButton: false,
|
|
137
|
+
onOpenChange: (open) => {
|
|
138
|
+
console.log('Chat widget is open:', open);
|
|
139
|
+
},
|
|
140
|
+
onUnreadCountChange: (count) => {
|
|
141
|
+
console.log('Unread messages count:', count);
|
|
142
|
+
},
|
|
143
|
+
};
|
|
144
|
+
ReactDOM.createRoot(chatWidgetContainer).render(React.createElement(ConnectyCubeChatWidget, props));
|
|
145
|
+
|
|
146
|
+
// use the code below as an example to toggle the chat widget visibility state for custom button
|
|
147
|
+
document.getElementById('someCustomButton').addEventListener('click', () => {
|
|
148
|
+
ConnectyCubeChatWidget.toggle();
|
|
149
|
+
});
|
|
150
|
+
</script>
|
|
151
|
+
<!-- @connectycube/chat-widget - end -->
|
|
152
|
+
</body>
|
|
153
|
+
</html>
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
See chat widget code samples <https://github.com/ConnectyCube/connectycube-chat-widget-samples/tree/main/vanilla> as a reference for faster integration.
|
|
157
|
+
|
|
158
|
+
## Props
|
|
159
|
+
|
|
160
|
+
See all available props <https://developers.connectycube.com/js/chat-widget/#props>
|
|
161
|
+
|
|
162
|
+
## Recipes
|
|
163
|
+
|
|
164
|
+
See all available recipes <https://developers.connectycube.com/js/chat-widget/#recipes>
|
|
165
|
+
|
|
166
|
+
## SSR (Server-Side Rendering) Guide
|
|
167
|
+
|
|
168
|
+
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:
|
|
169
|
+
|
|
170
|
+
### Usage
|
|
171
|
+
|
|
172
|
+
```bash
|
|
173
|
+
# npm
|
|
174
|
+
npm install @connectycube/chat-widget
|
|
175
|
+
npx connectycube patch-ssr # Apply SSR patches
|
|
176
|
+
# npx connectycube revert-ssr # Revert SSR patches
|
|
177
|
+
|
|
178
|
+
# yarn
|
|
179
|
+
yarn add @connectycube/chat-widget
|
|
180
|
+
yarn connectycube patch-ssr # Apply SSR patches
|
|
181
|
+
# yarn connectycube revert-ssr # Revert SSR patches
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
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.
|
|
185
|
+
|
|
186
|
+
## Have an issue?
|
|
187
|
+
|
|
188
|
+
Join our [Discord](https://discord.com/invite/zqbBWNCCFJ) community to get real-time help from our team
|
|
189
|
+
|
|
190
|
+
## Community
|
|
191
|
+
|
|
192
|
+
- [Blog](https://connectycube.com/blog)
|
|
193
|
+
- X (twitter)[@ConnectyCube](https://x.com/ConnectyCube)
|
|
194
|
+
- [Facebook](https://www.facebook.com/ConnectyCube)
|
|
195
|
+
- [Medium](https://medium.com/@connectycube)
|
|
196
|
+
- [YouTube](https://www.youtube.com/@ConnectyCube)
|
|
197
|
+
|
|
198
|
+
**Want to support our team**:<br>
|
|
199
|
+
<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>
|
|
200
|
+
|
|
201
|
+
## Changelog
|
|
202
|
+
|
|
203
|
+
<https://github.com/ConnectyCube/connectycube-chat-widget-samples/blob/main/CHANGELOG.md>
|