@connectycube/chat-widget 0.30.2 → 0.32.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.
Files changed (26) hide show
  1. package/CHANGELOG.md +29 -0
  2. package/README.md +24 -13
  3. package/dist/connectycube-chat-widget-sw.js +26 -1
  4. package/dist/index.es.js +7546 -7217
  5. package/dist/index.umd.js +46 -46
  6. package/dist/react19/connectycube-chat-widget-sw.js +26 -1
  7. package/dist/react19/index.es.js +6762 -6433
  8. package/dist/react19/types/components/home/main/message/message-attachment.d.ts +3 -2
  9. package/dist/react19/types/components/home/main/message/message-url-preview.d.ts +1 -0
  10. package/dist/react19/types/components/home/main/message/message.d.ts +2 -0
  11. package/dist/react19/types/components/home/sidebar/chat-item.d.ts +1 -0
  12. package/dist/react19/types/components/home/sidebar/chats-list.d.ts +1 -4
  13. package/dist/react19/types/helpers/widget.d.ts +1 -0
  14. package/dist/react19/types/hooks/store/useLinkPreviewStore.d.ts +1 -0
  15. package/dist/react19/types/index.d.ts +9 -0
  16. package/dist/react19/types/locales/en/translation.json.d.ts +1 -1
  17. package/dist/types/components/home/main/message/message-attachment.d.ts +3 -2
  18. package/dist/types/components/home/main/message/message-url-preview.d.ts +1 -0
  19. package/dist/types/components/home/main/message/message.d.ts +2 -0
  20. package/dist/types/components/home/sidebar/chat-item.d.ts +1 -0
  21. package/dist/types/components/home/sidebar/chats-list.d.ts +1 -4
  22. package/dist/types/helpers/widget.d.ts +1 -0
  23. package/dist/types/hooks/store/useLinkPreviewStore.d.ts +1 -0
  24. package/dist/types/index.d.ts +9 -0
  25. package/dist/types/locales/en/translation.json.d.ts +1 -1
  26. package/package.json +25 -25
package/CHANGELOG.md CHANGED
@@ -1,5 +1,34 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## 0.32.0
4
+
5
+ ### Misc
6
+
7
+ - SSR (Server-Side Rendering) support
8
+ - implemented `localStorage` and `document` guards
9
+ - updated authentication logic
10
+
11
+ ### Fixed
12
+
13
+ - removed unnecessary text from `README.md`
14
+ - word "Messed" changed to "Missed" in `en/translation.json` file
15
+ - resets specific store data to prevent displaying the useless toast about a missed call
16
+
17
+ ## 0.31.0
18
+
19
+ ### Misc
20
+
21
+ - Uses the `<VList/>` component from the `virtua` scroll library
22
+ - Added infinite scroll to load and prepend earlier messages in chat history
23
+ - Added infinite scroll to load and append more dialogs in the chat list
24
+ - Updated messages styles and alignment
25
+ - Updated dialog list styles
26
+ - Can open the widget by clicking on the push notification
27
+
28
+ ### Fixed
29
+
30
+ - Playing stop call audio on app start
31
+
3
32
  ## 0.30.2
4
33
 
5
34
  ### Fixed
package/README.md CHANGED
@@ -1,10 +1,3 @@
1
- WebRTCPeerConnection.ts:134 [VideoChat]: onSignalingStateHandler: have-remote-offer
2
- helpers.ts:7 [useCalls][onRemoteStream][Log]: {session: e, userID: 13308918, stream: MediaStream}
3
- WebRTCPeerConnection.ts:134 [VideoChat]: setRemoteSessionDescription - success
4
- WebRTCPeerConnection.ts:134 [VideoChat]: onSignalingStateHandler: stable
5
- WebRTCPeerConnection.ts:134 [VideoChat]: Set maxBandwidth success [13308918]: 0 kbps
6
- WebRTCPeerConnection.ts:134 [VideoChat]: getAndSetLocalSessionDescription - success
7
-
8
1
  # ConnectyCube Chat Widget
9
2
 
10
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.
@@ -39,13 +32,11 @@ Single-view chat widget:
39
32
 
40
33
  ### React
41
34
 
42
- ```
35
+ ```bash
36
+ # npm
43
37
  npm install @connectycube/chat-widget
44
- ```
45
-
46
- or
47
38
 
48
- ```
39
+ # yarn
49
40
  yarn add @connectycube/chat-widget
50
41
  ```
51
42
 
@@ -53,7 +44,7 @@ yarn add @connectycube/chat-widget
53
44
 
54
45
  Add the following scripts on your html page somewhere in `head` element:
55
46
 
56
- ```
47
+ ```html
57
48
  <script src="https://unpkg.com/react@18/umd/react.production.min.js" crossorigin></script>
58
49
  <script src="https://unpkg.com/react-dom@18/umd/react-dom.production.min.js" crossorigin></script>
59
50
  <script src="https://unpkg.com/connectycube@4/dist/connectycube.min.js"></script>
@@ -163,6 +154,26 @@ See all available props <https://developers.connectycube.com/js/chat-widget/#pro
163
154
 
164
155
  See all available recipes <https://developers.connectycube.com/js/chat-widget/#recipes>
165
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
+
166
177
  ## Have an issue?
167
178
 
168
179
  Join our [Discord](https://discord.com/invite/zqbBWNCCFJ) for quick answers to your questions
@@ -15,5 +15,30 @@ self.addEventListener('push', (event) => {
15
15
 
16
16
  self.addEventListener('notificationclick', (event) => {
17
17
  event.notification.close();
18
- event.waitUntil(clients.openWindow('/'));
18
+ event.waitUntil(
19
+ clients.matchAll({ type: 'window', includeUncontrolled: true }).then((clientList) => {
20
+ const matchedClient = clientList.find((client) =>
21
+ client.url.startsWith(self.location.origin) && 'focus' in client
22
+ );
23
+
24
+ if (matchedClient) {
25
+ matchedClient.focus();
26
+ } else {
27
+ clients.openWindow('/').then((chatWidget) => {
28
+ const payload = {
29
+ badge: event.notification.badge || '',
30
+ body: event.notification.body || '',
31
+ data: event.notification.data || null,
32
+ dir: event.notification.dir || '',
33
+ lang: event.notification.lang || '',
34
+ title: event.notification.title || '',
35
+ icon: event.notification.icon || '',
36
+ timestamp: event.notification.timestamp || Date.now(),
37
+ };
38
+
39
+ chatWidget?.postMessage({ action: 'connectycube-chat-widget-sw/initialNotification', payload });
40
+ });
41
+ }
42
+ })
43
+ );
19
44
  });