@cometchat/skills 4.3.0 → 4.4.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 (233) hide show
  1. package/LICENSE +21 -0
  2. package/bin/install.js +27 -0
  3. package/package.json +14 -1
  4. package/skills/cometchat/SKILL.md +233 -69
  5. package/skills/cometchat/references/asking-questions.md +48 -0
  6. package/skills/cometchat-a11y/SKILL.md +3 -2
  7. package/skills/cometchat-android-v5/SKILL.md +2 -1
  8. package/skills/cometchat-android-v5-calls/SKILL.md +36 -22
  9. package/skills/cometchat-android-v5-calls/references/README.md +1 -1
  10. package/skills/cometchat-android-v5-calls/references/add-calls-to-existing-chat.md +7 -5
  11. package/skills/cometchat-android-v5-calls/references/audio-controls.md +4 -4
  12. package/skills/cometchat-android-v5-calls/references/call-layouts.md +33 -25
  13. package/skills/cometchat-android-v5-calls/references/call-session.md +2 -2
  14. package/skills/cometchat-android-v5-calls/references/custom-ui.md +5 -5
  15. package/skills/cometchat-android-v5-calls/references/event-listeners.md +2 -2
  16. package/skills/cometchat-android-v5-calls/references/idle-timeout.md +20 -14
  17. package/skills/cometchat-android-v5-calls/references/in-call-chat.md +1 -1
  18. package/skills/cometchat-android-v5-calls/references/migration-v4-to-v5.md +43 -27
  19. package/skills/cometchat-android-v5-calls/references/participant-management.md +3 -3
  20. package/skills/cometchat-android-v5-calls/references/raise-hand.md +25 -19
  21. package/skills/cometchat-android-v5-calls/references/recording.md +2 -2
  22. package/skills/cometchat-android-v5-calls/references/ringing-integration.md +1 -1
  23. package/skills/cometchat-android-v5-calls/references/screen-sharing.md +5 -9
  24. package/skills/cometchat-android-v5-calls/references/session-settings.md +3 -3
  25. package/skills/cometchat-android-v5-calls/references/setup.md +1 -1
  26. package/skills/cometchat-android-v5-calls/references/share-invite.md +9 -4
  27. package/skills/cometchat-android-v5-calls/references/video-controls.md +4 -4
  28. package/skills/cometchat-android-v5-calls/references/voip-calling.md +2 -2
  29. package/skills/cometchat-android-v5-components/SKILL.md +4 -3
  30. package/skills/cometchat-android-v5-core/SKILL.md +5 -3
  31. package/skills/cometchat-android-v5-customization/SKILL.md +171 -7
  32. package/skills/cometchat-android-v5-extensions/SKILL.md +7 -4
  33. package/skills/cometchat-android-v5-features/SKILL.md +5 -4
  34. package/skills/cometchat-android-v5-placement/SKILL.md +2 -1
  35. package/skills/cometchat-android-v5-production/SKILL.md +2 -1
  36. package/skills/cometchat-android-v5-push/SKILL.md +2 -3
  37. package/skills/cometchat-android-v5-testing/SKILL.md +2 -1
  38. package/skills/cometchat-android-v5-theming/SKILL.md +2 -1
  39. package/skills/cometchat-android-v5-troubleshooting/SKILL.md +3 -2
  40. package/skills/cometchat-android-v6/SKILL.md +2 -1
  41. package/skills/cometchat-android-v6-builder-settings/SKILL.md +11 -7
  42. package/skills/cometchat-android-v6-calls/SKILL.md +79 -18
  43. package/skills/cometchat-android-v6-calls/references/advanced-features.md +87 -0
  44. package/skills/cometchat-android-v6-calls/references/call-layouts.md +24 -15
  45. package/skills/cometchat-android-v6-calls/references/call-session.md +2 -2
  46. package/skills/cometchat-android-v6-calls/references/device-management.md +17 -16
  47. package/skills/cometchat-android-v6-calls/references/idle-timeout.md +7 -4
  48. package/skills/cometchat-android-v6-calls/references/in-call-chat.md +13 -8
  49. package/skills/cometchat-android-v6-calls/references/raise-hand.md +6 -4
  50. package/skills/cometchat-android-v6-compose-components/SKILL.md +52 -29
  51. package/skills/cometchat-android-v6-compose-customization/SKILL.md +156 -1
  52. package/skills/cometchat-android-v6-compose-placement/SKILL.md +129 -40
  53. package/skills/cometchat-android-v6-compose-theming/SKILL.md +27 -1
  54. package/skills/cometchat-android-v6-core/SKILL.md +208 -28
  55. package/skills/cometchat-android-v6-events/SKILL.md +4 -1
  56. package/skills/cometchat-android-v6-extensions/SKILL.md +2 -1
  57. package/skills/cometchat-android-v6-features/SKILL.md +26 -2
  58. package/skills/cometchat-android-v6-kotlin-components/SKILL.md +31 -1
  59. package/skills/cometchat-android-v6-kotlin-customization/SKILL.md +172 -1
  60. package/skills/cometchat-android-v6-kotlin-placement/SKILL.md +20 -5
  61. package/skills/cometchat-android-v6-kotlin-theming/SKILL.md +36 -5
  62. package/skills/cometchat-android-v6-migration/SKILL.md +44 -42
  63. package/skills/cometchat-android-v6-production/SKILL.md +6 -3
  64. package/skills/cometchat-android-v6-push/SKILL.md +43 -2
  65. package/skills/cometchat-android-v6-testing/SKILL.md +11 -8
  66. package/skills/cometchat-android-v6-troubleshooting/SKILL.md +26 -5
  67. package/skills/cometchat-angular-calls/SKILL.md +256 -389
  68. package/skills/cometchat-angular-calls/references/add-calls-to-existing-chat.md +3 -2
  69. package/skills/cometchat-angular-calls/references/call-layouts.md +29 -12
  70. package/skills/cometchat-angular-calls/references/call-session.md +2 -2
  71. package/skills/cometchat-angular-calls/references/custom-ui.md +18 -10
  72. package/skills/cometchat-angular-calls/references/device-management.md +53 -34
  73. package/skills/cometchat-angular-calls/references/group-calls.md +45 -24
  74. package/skills/cometchat-angular-calls/references/idle-timeout.md +31 -15
  75. package/skills/cometchat-angular-calls/references/ngzone-and-async-callbacks.md +7 -6
  76. package/skills/cometchat-angular-calls/references/raise-hand.md +9 -4
  77. package/skills/cometchat-angular-calls/references/recording-screen-share.md +32 -39
  78. package/skills/cometchat-angular-calls/references/ringing-integration.md +3 -1
  79. package/skills/cometchat-angular-calls/references/share-invite.md +11 -5
  80. package/skills/cometchat-angular-calls/references/virtual-background.md +29 -0
  81. package/skills/cometchat-angular-components/SKILL.md +149 -620
  82. package/skills/cometchat-angular-core/SKILL.md +232 -312
  83. package/skills/cometchat-angular-customization/SKILL.md +415 -223
  84. package/skills/cometchat-angular-features/SKILL.md +216 -334
  85. package/skills/cometchat-angular-patterns/SKILL.md +168 -359
  86. package/skills/cometchat-angular-placement/SKILL.md +189 -560
  87. package/skills/cometchat-angular-production/SKILL.md +241 -92
  88. package/skills/cometchat-angular-push/SKILL.md +280 -294
  89. package/skills/cometchat-angular-testing/SKILL.md +430 -158
  90. package/skills/cometchat-angular-theming/SKILL.md +190 -265
  91. package/skills/cometchat-angular-troubleshooting/SKILL.md +192 -157
  92. package/skills/cometchat-astro-patterns/SKILL.md +2 -1
  93. package/skills/cometchat-calls/SKILL.md +25 -19
  94. package/skills/cometchat-calls/references/use-case-broadcast.md +15 -10
  95. package/skills/cometchat-calls/references/use-case-marketplace.md +2 -3
  96. package/skills/cometchat-calls/references/use-case-support.md +3 -4
  97. package/skills/cometchat-calls/references/use-case-team.md +23 -12
  98. package/skills/cometchat-calls/references/use-case-telehealth.md +3 -4
  99. package/skills/cometchat-components/SKILL.md +163 -25
  100. package/skills/cometchat-core/SKILL.md +255 -19
  101. package/skills/cometchat-customization/SKILL.md +50 -25
  102. package/skills/cometchat-features/SKILL.md +313 -34
  103. package/skills/cometchat-flutter-v5/SKILL.md +10 -4
  104. package/skills/cometchat-flutter-v5-calls/SKILL.md +188 -158
  105. package/skills/cometchat-flutter-v5-calls/references/add-calls-to-existing-chat.md +48 -24
  106. package/skills/cometchat-flutter-v5-calls/references/call-layouts.md +20 -15
  107. package/skills/cometchat-flutter-v5-calls/references/call-session.md +100 -145
  108. package/skills/cometchat-flutter-v5-calls/references/device-management.md +12 -8
  109. package/skills/cometchat-flutter-v5-calls/references/group-calls.md +30 -36
  110. package/skills/cometchat-flutter-v5-calls/references/idle-timeout.md +15 -13
  111. package/skills/cometchat-flutter-v5-calls/references/in-call-chat.md +12 -9
  112. package/skills/cometchat-flutter-v5-calls/references/migration-v4-to-v5.md +115 -65
  113. package/skills/cometchat-flutter-v5-calls/references/raise-hand.md +41 -30
  114. package/skills/cometchat-flutter-v5-calls/references/ringing-integration.md +17 -14
  115. package/skills/cometchat-flutter-v5-calls/references/share-invite.md +8 -2
  116. package/skills/cometchat-flutter-v5-conversations/SKILL.md +2 -1
  117. package/skills/cometchat-flutter-v5-core/SKILL.md +5 -4
  118. package/skills/cometchat-flutter-v5-customization/SKILL.md +136 -5
  119. package/skills/cometchat-flutter-v5-events/SKILL.md +2 -1
  120. package/skills/cometchat-flutter-v5-messages/SKILL.md +2 -1
  121. package/skills/cometchat-flutter-v5-production/SKILL.md +15 -6
  122. package/skills/cometchat-flutter-v5-push/SKILL.md +2 -1
  123. package/skills/cometchat-flutter-v5-testing/SKILL.md +17 -6
  124. package/skills/cometchat-flutter-v5-theming/SKILL.md +2 -1
  125. package/skills/cometchat-flutter-v5-troubleshooting/SKILL.md +7 -6
  126. package/skills/cometchat-flutter-v5-users-groups/SKILL.md +3 -2
  127. package/skills/cometchat-flutter-v6/SKILL.md +17 -16
  128. package/skills/cometchat-flutter-v6-calls/SKILL.md +72 -57
  129. package/skills/cometchat-flutter-v6-calls/references/add-calls-to-existing-chat.md +5 -3
  130. package/skills/cometchat-flutter-v6-calls/references/advanced-features.md +89 -0
  131. package/skills/cometchat-flutter-v6-calls/references/call-layouts.md +15 -12
  132. package/skills/cometchat-flutter-v6-calls/references/call-session.md +2 -2
  133. package/skills/cometchat-flutter-v6-calls/references/device-management.md +9 -3
  134. package/skills/cometchat-flutter-v6-calls/references/group-calls.md +10 -10
  135. package/skills/cometchat-flutter-v6-calls/references/idle-timeout.md +15 -7
  136. package/skills/cometchat-flutter-v6-calls/references/in-call-chat.md +6 -3
  137. package/skills/cometchat-flutter-v6-calls/references/raise-hand.md +23 -16
  138. package/skills/cometchat-flutter-v6-components/SKILL.md +32 -11
  139. package/skills/cometchat-flutter-v6-conversations/SKILL.md +39 -11
  140. package/skills/cometchat-flutter-v6-core/SKILL.md +182 -21
  141. package/skills/cometchat-flutter-v6-customization/SKILL.md +97 -25
  142. package/skills/cometchat-flutter-v6-events/SKILL.md +3 -2
  143. package/skills/cometchat-flutter-v6-features/SKILL.md +15 -6
  144. package/skills/cometchat-flutter-v6-messages/SKILL.md +111 -60
  145. package/skills/cometchat-flutter-v6-migration/SKILL.md +18 -25
  146. package/skills/cometchat-flutter-v6-placement/SKILL.md +79 -50
  147. package/skills/cometchat-flutter-v6-production/SKILL.md +13 -12
  148. package/skills/cometchat-flutter-v6-push/SKILL.md +41 -19
  149. package/skills/cometchat-flutter-v6-testing/SKILL.md +4 -4
  150. package/skills/cometchat-flutter-v6-theming/SKILL.md +38 -5
  151. package/skills/cometchat-flutter-v6-troubleshooting/SKILL.md +182 -17
  152. package/skills/cometchat-flutter-v6-users-groups/SKILL.md +12 -4
  153. package/skills/cometchat-i18n/SKILL.md +139 -78
  154. package/skills/cometchat-ios/SKILL.md +4 -2
  155. package/skills/cometchat-ios-calls/SKILL.md +225 -95
  156. package/skills/cometchat-ios-calls/references/add-calls-to-existing-chat.md +11 -9
  157. package/skills/cometchat-ios-calls/references/audio-modes-and-controls.md +45 -0
  158. package/skills/cometchat-ios-calls/references/avaudiosession-routing.md +6 -7
  159. package/skills/cometchat-ios-calls/references/call-layouts.md +31 -91
  160. package/skills/cometchat-ios-calls/references/call-session.md +51 -54
  161. package/skills/cometchat-ios-calls/references/callkit-and-pushkit.md +33 -29
  162. package/skills/cometchat-ios-calls/references/custom-ui.md +38 -38
  163. package/skills/cometchat-ios-calls/references/group-calls.md +33 -70
  164. package/skills/cometchat-ios-calls/references/idle-timeout.md +24 -25
  165. package/skills/cometchat-ios-calls/references/in-call-chat.md +19 -23
  166. package/skills/cometchat-ios-calls/references/migration-v4-to-v5.md +128 -70
  167. package/skills/cometchat-ios-calls/references/picture-in-picture.md +20 -20
  168. package/skills/cometchat-ios-calls/references/raise-hand.md +14 -227
  169. package/skills/cometchat-ios-calls/references/recording-screen-share.md +35 -122
  170. package/skills/cometchat-ios-calls/references/ringing-integration.md +17 -16
  171. package/skills/cometchat-ios-calls/references/share-invite.md +8 -12
  172. package/skills/cometchat-ios-calls/references/swiftui-uikit-hosting.md +4 -4
  173. package/skills/cometchat-ios-components/SKILL.md +200 -12
  174. package/skills/cometchat-ios-core/SKILL.md +173 -45
  175. package/skills/cometchat-ios-customization/SKILL.md +276 -110
  176. package/skills/cometchat-ios-features/SKILL.md +64 -36
  177. package/skills/cometchat-ios-placement/SKILL.md +15 -12
  178. package/skills/cometchat-ios-production/SKILL.md +12 -4
  179. package/skills/cometchat-ios-push/SKILL.md +53 -19
  180. package/skills/cometchat-ios-testing/SKILL.md +14 -9
  181. package/skills/cometchat-ios-theming/SKILL.md +39 -3
  182. package/skills/cometchat-ios-troubleshooting/SKILL.md +41 -21
  183. package/skills/cometchat-native-bare-patterns/SKILL.md +34 -17
  184. package/skills/cometchat-native-calls/SKILL.md +28 -16
  185. package/skills/cometchat-native-calls/references/add-calls-to-existing-chat.md +2 -2
  186. package/skills/cometchat-native-calls/references/call-layouts.md +15 -14
  187. package/skills/cometchat-native-calls/references/call-session.md +2 -2
  188. package/skills/cometchat-native-calls/references/custom-ui.md +12 -8
  189. package/skills/cometchat-native-calls/references/device-management.md +53 -30
  190. package/skills/cometchat-native-calls/references/group-calls.md +35 -30
  191. package/skills/cometchat-native-calls/references/idle-timeout.md +6 -6
  192. package/skills/cometchat-native-calls/references/in-call-chat.md +10 -8
  193. package/skills/cometchat-native-calls/references/migration-v4-to-v5.md +2 -2
  194. package/skills/cometchat-native-calls/references/raise-hand.md +15 -13
  195. package/skills/cometchat-native-calls/references/recording-screen-share.md +49 -170
  196. package/skills/cometchat-native-calls/references/share-invite.md +7 -5
  197. package/skills/cometchat-native-calls/references/voip-push-end-to-end.md +4 -2
  198. package/skills/cometchat-native-components/SKILL.md +84 -52
  199. package/skills/cometchat-native-core/SKILL.md +101 -32
  200. package/skills/cometchat-native-customization/SKILL.md +150 -28
  201. package/skills/cometchat-native-expo-patterns/SKILL.md +57 -26
  202. package/skills/cometchat-native-features/SKILL.md +23 -16
  203. package/skills/cometchat-native-placement/SKILL.md +19 -10
  204. package/skills/cometchat-native-production/SKILL.md +9 -3
  205. package/skills/cometchat-native-push/SKILL.md +2 -1
  206. package/skills/cometchat-native-testing/SKILL.md +1 -2
  207. package/skills/cometchat-native-theming/SKILL.md +54 -29
  208. package/skills/cometchat-native-troubleshooting/SKILL.md +9 -3
  209. package/skills/cometchat-nextjs-patterns/SKILL.md +20 -6
  210. package/skills/cometchat-placement/SKILL.md +42 -3
  211. package/skills/cometchat-production/SKILL.md +12 -5
  212. package/skills/cometchat-react-calls/SKILL.md +220 -10
  213. package/skills/cometchat-react-calls/references/add-calls-to-existing-chat.md +4 -3
  214. package/skills/cometchat-react-calls/references/call-layouts.md +5 -6
  215. package/skills/cometchat-react-calls/references/call-session.md +1 -1
  216. package/skills/cometchat-react-calls/references/custom-ui.md +61 -15
  217. package/skills/cometchat-react-calls/references/device-management.md +55 -51
  218. package/skills/cometchat-react-calls/references/group-calls.md +18 -23
  219. package/skills/cometchat-react-calls/references/idle-timeout.md +25 -12
  220. package/skills/cometchat-react-calls/references/in-call-chat.md +7 -7
  221. package/skills/cometchat-react-calls/references/migration-v4-to-v5.md +9 -11
  222. package/skills/cometchat-react-calls/references/raise-hand.md +14 -14
  223. package/skills/cometchat-react-calls/references/recording-screen-share.md +39 -38
  224. package/skills/cometchat-react-calls/references/ringing-integration.md +2 -2
  225. package/skills/cometchat-react-calls/references/share-invite.md +4 -5
  226. package/skills/cometchat-react-calls/references/testing-calls-on-web.md +20 -2
  227. package/skills/cometchat-react-calls/references/virtual-background.md +32 -0
  228. package/skills/cometchat-react-patterns/SKILL.md +44 -4
  229. package/skills/cometchat-react-push/SKILL.md +258 -72
  230. package/skills/cometchat-react-router-patterns/SKILL.md +10 -4
  231. package/skills/cometchat-react-testing/SKILL.md +14 -5
  232. package/skills/cometchat-theming/SKILL.md +181 -18
  233. package/skills/cometchat-troubleshooting/SKILL.md +40 -20
@@ -13,35 +13,39 @@ Recording is a paid feature gated by your CometChat plan. Enable it in **Dashboa
13
13
  ### Client-side: opt-in per session
14
14
 
15
15
  ```ts
16
- const settings = new CometChatCalls.CallSettingsBuilder()
17
- .setSessionID(sessionId)
18
- .setIsAudioOnly(false)
19
- .enableRecording(true) // server starts recording when session begins
20
- .setShowRecordingButton(true) // user-toggleable mid-call
21
- .build();
16
+ // SessionSettings object passed to joinSession(token, settings, container).
17
+ // These are object fields — NOT CallSettingsBuilder methods (the v4 builder had
18
+ // enableRecording/setShowRecordingButton; v5 uses the object below).
19
+ const settings = {
20
+ sessionType: 'VIDEO', // 'VOICE' for audio-only (replaces setIsAudioOnly)
21
+ autoStartRecording: true, // ← server starts recording when the session begins
22
+ hideRecordingButton: false, // ← keep the user-toggleable Record button visible
23
+ };
22
24
  ```
23
25
 
24
- Two flags, two behaviors:
26
+ Two fields, two behaviors:
25
27
 
26
- - `enableRecording(true)` — recording starts the moment the session begins. Server-side flag.
27
- - `setShowRecordingButton(true)` — exposes a "Record" toggle in the default control panel. User decides when to start/stop. Custom-UI code must wire its own button.
28
+ - `autoStartRecording: true` — recording starts the moment the session begins. Server-side flag.
29
+ - `hideRecordingButton: false` — exposes a "Record" toggle in the default control panel. User decides when to start/stop. Custom-UI code must wire its own button (`CometChatCalls.startRecording()` / `stopRecording()` — there is no `toggleRecording()`; track state yourself and call the right one).
28
30
 
29
31
  **Compliance note:** in some jurisdictions you must notify all participants before recording starts. The default kit UI shows a small "Recording" indicator; if you're using custom UI, you must render this yourself. The skill's verification checklist flags this.
30
32
 
31
33
  ### Recording lifecycle events
32
34
 
33
35
  ```ts
34
- const listener = new CometChatCalls.OngoingCallListener({
35
- onRecordingStarted: (rec: unknown) => {
36
- // server confirmed recording is active
37
- },
38
- onRecordingStopped: (rec: unknown) => {
39
- // server stopped — file will appear in dashboard within ~30 seconds
40
- },
41
- onRecordingFailed: (error: unknown) => {
42
- // surface to UI — usually plan limits or storage quota
43
- },
36
+ // v5 uses the static event bus; addEventListener returns an unsubscribe fn.
37
+ const offStarted = CometChatCalls.addEventListener("onRecordingStarted", () => {
38
+ // server confirmed recording is active
44
39
  });
40
+ const offStopped = CometChatCalls.addEventListener("onRecordingStopped", () => {
41
+ // server stopped — file will appear in dashboard within ~30 seconds
42
+ });
43
+ // Cleanup when the call ends: offStarted(); offStopped();
44
+ //
45
+ // NOTE: there is no `onRecordingFailed` event on the v5 bus (and no
46
+ // onRecordingFailed member on OngoingCallListener). Plan-limit / storage-quota
47
+ // failures surface as a rejection from generateToken/joinSession or a server
48
+ // error — handle those, not a dedicated recording-failed callback.
45
49
  ```
46
50
 
47
51
  ### Where the recordings go
@@ -54,7 +58,7 @@ CometChat hosts the file. It appears in **Dashboard → Calls → Recordings** w
54
58
 
55
59
  ### Two roles: presenter + viewer
56
60
 
57
- - **Presenter** (the user sharing their screen) — calls `CometChatCalls.startScreenShare()` and receives a `MediaStream` from `getDisplayMedia`
61
+ - **Presenter** (the user sharing their screen) — calls `CometChatCalls.startScreenSharing()`; the SDK handles `getDisplayMedia` + signaling internally
58
62
  - **Viewer** (everyone else) — sees the presenter's screen as another video tile, no special API call needed
59
63
 
60
64
  Browser support: Chrome/Edge (full), Firefox (full), Safari 13+ (full). On mobile browsers, `getDisplayMedia` is supported on iOS 16+ Safari and recent Android Chrome.
@@ -64,7 +68,7 @@ Browser support: Chrome/Edge (full), Firefox (full), Safari 13+ (full). On mobil
64
68
  ```ts
65
69
  async function startScreenShare() {
66
70
  try {
67
- await CometChatCalls.startScreenShare();
71
+ CometChatCalls.startScreenSharing();
68
72
  // SDK handled getDisplayMedia + signaling; UI updates via onScreenShareStarted
69
73
  } catch (err: unknown) {
70
74
  if ((err as Error).name === "NotAllowedError") {
@@ -79,37 +83,34 @@ async function startScreenShare() {
79
83
  Stop sharing:
80
84
 
81
85
  ```ts
82
- CometChatCalls.endScreenShare();
86
+ CometChatCalls.stopScreenSharing();
83
87
  ```
84
88
 
85
- The browser also fires its own "Stop sharing" button (the system overlay Chrome shows during a screen-share). The SDK listens for this too; `onScreenShareEnded` fires either way.
89
+ The browser also fires its own "Stop sharing" button (the system overlay Chrome shows during a screen-share). The SDK listens for this too; `onScreenShareStopped` fires either way.
86
90
 
87
91
  ### Viewer — listen for screen-share events
88
92
 
89
93
  ```ts
90
- const listener = new CometChatCalls.OngoingCallListener({
91
- onScreenShareStarted: (presenterUid: string, stream: MediaStream) => {
92
- // attach the stream to a <video> element
93
- if (screenShareVideoRef.current) {
94
- screenShareVideoRef.current.srcObject = stream;
95
- }
96
- },
97
- onScreenShareEnded: () => {
98
- if (screenShareVideoRef.current) {
99
- screenShareVideoRef.current.srcObject = null;
100
- }
101
- },
94
+ // The v5 bus callbacks take NO arguments — they're notifications, not stream
95
+ // handoffs. The SDK renders the presenter's screen as a tile in its own layout;
96
+ // you don't receive a MediaStream to attach yourself (that was the v4 model).
97
+ const offStart = CometChatCalls.addEventListener("onScreenShareStarted", () => {
98
+ setSomeoneSharing(true);
99
+ });
100
+ const offStop = CometChatCalls.addEventListener("onScreenShareStopped", () => {
101
+ setSomeoneSharing(false);
102
102
  });
103
+ // Cleanup: offStart(); offStop();
103
104
  ```
104
105
 
105
- Compose the screen-share tile alongside the camera tiles in your custom layout.
106
+ The SDK composes the screen-share tile alongside the camera tiles automatically. (Truly hand-rendering the shared stream requires the deprecated `OngoingCallListener` + `startSession` track-level path — see `custom-ui.md`.)
106
107
 
107
108
  ### Audio passthrough during screen share
108
109
 
109
110
  By default, `getDisplayMedia` captures video only. To capture system audio (for sharing a video with sound), pass `audio: true`:
110
111
 
111
112
  ```ts
112
- // Browser-level API — the SDK's startScreenShare wraps this internally
113
+ // Browser-level API — the SDK's startScreenSharing wraps this internally
113
114
  const stream = await navigator.mediaDevices.getDisplayMedia({
114
115
  video: true,
115
116
  audio: true,
@@ -118,7 +119,7 @@ const stream = await navigator.mediaDevices.getDisplayMedia({
118
119
 
119
120
  Browser support is uneven — Chrome desktop has it; Firefox does not; Safari has it for tab capture but not full-screen.
120
121
 
121
- The Calls SDK's `startScreenShare()` does NOT request audio by default in v4. If you need audio passthrough, use the lower-level `getDisplayMedia` API directly + pipe the audio track via a custom track-add hook (covered in `custom-ui.md`).
122
+ The Calls SDK's `startScreenSharing()` does NOT request audio by default. If you need audio passthrough, use the lower-level `getDisplayMedia` API directly + pipe the audio track via a custom track-add hook (covered in `custom-ui.md`).
122
123
 
123
124
  ---
124
125
 
@@ -242,7 +242,7 @@ function IncomingCallScreen({ call, onAccept, onReject }: Props) {
242
242
  - [ ] `onCallEndedMessageReceived` tears down UI when other party ends
243
243
  - [ ] `onIncomingCallCancelled` tears down UI when caller cancels mid-ring
244
244
  - [ ] Custom UI: `role="alertdialog"`, ringtone audio, accept/decline buttons with aria-labels
245
- - [ ] Smoke: 2 tabs, caller initiates → recipient sees custom incoming UI → accept → both join session → either ends → both UIs dismiss
245
+ - [ ] Smoke: **two ISOLATED browser contexts** (normal + Incognito window, or two browsers/devices — NOT two tabs of one browser; the Chat SDK is a single shared session per origin, so a second tab can't be an independent callee), caller initiates → recipient sees custom incoming UI → accept → both join session → either ends → both UIs dismiss
246
246
 
247
247
  ---
248
248
 
@@ -251,5 +251,5 @@ function IncomingCallScreen({ call, onAccept, onReject }: Props) {
251
251
  - `cometchat-react-calls/SKILL.md` — architecture + seven hard rules
252
252
  - `cometchat-react-calls/references/call-session.md` — Mode 3 (joinSession with no ringing)
253
253
  - `cometchat-react-calls/references/in-call-chat.md` — chat panel during a call
254
- - `cometchat-react-calls/references/recording.md` — recording mid-call
254
+ - `cometchat-react-calls/references/recording-screen-share.md` — recording mid-call
255
255
  - Canonical docs: https://www.cometchat.com/docs/calls/javascript/ringing
@@ -35,10 +35,9 @@ const callSettings = {
35
35
  ```tsx
36
36
  useEffect(() => {
37
37
  const handler = () => shareCallInvite(sessionId);
38
- CometChatCalls.addEventListener("onShareInviteButtonClicked", handler);
39
- return () => {
40
- CometChatCalls.removeEventListener("onShareInviteButtonClicked", handler);
41
- };
38
+ // addEventListener returns an unsubscribe fn — there is no removeEventListener.
39
+ const off = CometChatCalls.addEventListener("onShareInviteButtonClicked", handler);
40
+ return () => off();
42
41
  }, [sessionId]);
43
42
  ```
44
43
 
@@ -128,7 +127,7 @@ function CallQR({ sessionId }: { sessionId: string }) {
128
127
  2. **Wiring share before the deep-link route works.** Recipients click → 404.
129
128
  3. **`navigator.clipboard.writeText` without a manual-copy fallback.** Fails in non-https contexts (e.g., embedded iframes, dev tunnels).
130
129
  4. **Showing "Link copied!" toast even when share was cancelled.** `AbortError` is the user dismissing the share sheet — silent.
131
- 5. **Forgetting `removeEventListener` on unmount.** Listener accumulates → multiple share sheets per click.
130
+ 5. **Forgetting to call the unsubscribe fn on unmount.** `addEventListener` returns a `() => void` — call it in cleanup (there is no `removeEventListener`). Otherwise the listener accumulates → multiple share sheets per click.
132
131
  6. **Hard-coding `https://yourapp.com`.** Use `window.location.origin` or `import.meta.env.VITE_APP_URL`.
133
132
 
134
133
  ---
@@ -10,6 +10,25 @@ This reference covers all three. For chat-side testing patterns, see `cometchat-
10
10
 
11
11
  ---
12
12
 
13
+ ## ⚠️ Ringing-mode manual testing needs TWO ISOLATED browser contexts (not two tabs)
14
+
15
+ The single most common "incoming call never rings / Accept never appears" report is a **test-setup** problem, not a code bug:
16
+
17
+ **The Chat SDK is one session per browser origin.** `CometChat.login()` persists the logged-in user in **IndexedDB/localStorage keyed by `appId`** and maintains **one WebSocket per origin** — both **shared across every tab** of `localhost:5173`. Two tabs in the *same* browser therefore CANNOT hold two different logins: the second tab's login overwrites the shared session, so there is no independent callee connected to receive `onIncomingCallReceived`. A per-tab `sessionStorage` "user switcher" only changes what *your app* thinks the user is — the Chat SDK underneath is still a single shared session.
18
+
19
+ - **Ringing mode (1:1 / `initiateCall` → `onIncomingCallReceived`)** → needs **two isolated contexts**: a normal window for the caller + an **Incognito/Private window** (or a different browser, or a second device) for the callee. Only then are there two distinct Chat-SDK sessions + sockets.
20
+ - **Session/meeting mode (`joinSession` on a shared `sessionId`)** → two tabs in the *same* browser are fine — it doesn't depend on two live Chat-SDK logins; both sides just join the same session id.
21
+
22
+ Sanity-check in the callee context's console — it must show the callee, not the caller:
23
+ ```js
24
+ await CometChat.getLoggedinUser() // → User { uid: "cometchat-uid-2", ... }
25
+ ```
26
+ If it shows the caller's uid (or `null`), the callee isn't an independent receiver — that's the shared-session symptom.
27
+
28
+ Two devices on a LAN need HTTPS for `getUserMedia` (secure-context), but the ring itself arrives over plain `localhost` in incognito.
29
+
30
+ ---
31
+
13
32
  ## 1. Unit tests — mock the SDK module
14
33
 
15
34
  Vitest's `vi.mock` with a hoisted factory:
@@ -37,8 +56,7 @@ vi.mock("@cometchat/calls-sdk-javascript", () => ({
37
56
  startSession: vi.fn(),
38
57
  endSession: vi.fn(),
39
58
  CallSettingsBuilder: class {
40
- setSessionID() { return this; }
41
- setIsAudioOnly() { return this; }
59
+ setIsAudioOnlyCall() { return this; }
42
60
  enableDefaultLayout() { return this; }
43
61
  build() { return {}; }
44
62
  },
@@ -0,0 +1,32 @@
1
+ # Virtual Background (web)
2
+
3
+ Verified against `@cometchat/calls-sdk-javascript@5`. Web (React/Angular) is one of the few platforms that supports virtual background (native iOS/Android do not). Two ways to expose it:
4
+
5
+ ## A. Let the kit show its built-in setting (additive / kit components)
6
+
7
+ Enable the kit's own Virtual Background button on the call settings builder — it renders a blur/image/clear picker inside the call UI, no custom code:
8
+
9
+ ```ts
10
+ const settings = new CometChatCalls.CallSettingsBuilder()
11
+ .enableDefaultLayout(true)
12
+ .showVirtualBackgroundSetting(true) // ← shows the built-in VB control
13
+ .build();
14
+ ```
15
+
16
+ To read the current state, call `getVirtualBackground()` on a built `CallSettings` instance — it's an **instance** method on `CallSettings` (`callSettings.getVirtualBackground(): VirtualBackground`), not a `CometChatCalls` static.
17
+
18
+ ## B. Apply programmatically (custom call surface)
19
+
20
+ Three static methods on `CometChatCalls`, callable during an active session:
21
+
22
+ ```ts
23
+ import { CometChatCalls } from "@cometchat/calls-sdk-javascript";
24
+
25
+ CometChatCalls.setVirtualBackgroundBlurLevel(50); // blur (0–100)
26
+ CometChatCalls.setVirtualBackgroundImage("https://…/bg.jpg"); // custom image
27
+ CometChatCalls.clearVirtualBackground(); // remove
28
+ ```
29
+
30
+ > The older `setBackgroundBlur()` / `setBackgroundImage()` names are **deprecated** — use the `setVirtualBackground*` forms above.
31
+
32
+ Verified (calls-sdk `index.d.ts`): `CallSettingsBuilder.showVirtualBackgroundSetting(boolean)`, instance `CallSettings.getVirtualBackground(): VirtualBackground`, and the statics `CometChatCalls.setVirtualBackgroundBlurLevel(number)` / `setVirtualBackgroundImage(string)` / `clearVirtualBackground()`.
@@ -3,13 +3,14 @@ name: cometchat-react-patterns
3
3
  description: "Framework-specific patterns for integrating CometChat React UI Kit v6 into React projects (Vite or CRA). Covers provider setup, routing, layout integration, env vars, and common pitfalls."
4
4
  license: "MIT"
5
5
  compatibility: "Node.js >=18; React >=18; Vite >=4 or react-scripts (CRA); @cometchat/chat-uikit-react ^6; @cometchat/chat-sdk-javascript ^4"
6
- allowed-tools: "shell, file-read, file-search, file-list"
7
6
  metadata:
8
7
  author: "CometChat"
9
8
  version: "3.0.0"
10
9
  tags: "chat cometchat react vite cra patterns provider routing integration"
11
10
  ---
12
11
 
12
+ > **Ground truth:** `@cometchat/chat-uikit-react@^6` (+ `@cometchat/calls-sdk-javascript@^5`) — installed package types + `ui-kit/react`. **Official docs:** https://www.cometchat.com/docs/ui-kit/react/overview · **Docs MCP:** `claude mcp add --transport http cometchat-docs https://www.cometchat.com/docs/mcp` (or fetch the URL directly without MCP). Verify symbols against the installed package/source before relying on them.
13
+
13
14
  ## Purpose
14
15
 
15
16
  This skill teaches Claude how to integrate CometChat into a React project that uses Vite or Create React App. These are client-only environments with no SSR, which simplifies integration significantly.
@@ -84,7 +85,12 @@ async function ensureLoggedIn(
84
85
  authToken?: string,
85
86
  ): Promise<void> {
86
87
  const existing = await CometChatUIKit.getLoggedinUser();
87
- if (existing) return;
88
+ if (existing && existing.getUid?.() === uid) return; // same user — done
89
+ // Different user logged in (account switch / logout→login-as-other): log out
90
+ // first, else login() silently no-ops and the app shows the old account.
91
+ // (Switching accounts requires an explicit logout — login() no-ops on an
92
+ // existing session.)
93
+ if (existing) await CometChatUIKit.logout();
88
94
  if (loginInFlight) {
89
95
  await loginInFlight; // a prior mount already started login — reuse its promise
90
96
  return;
@@ -127,7 +133,8 @@ export function CometChatProvider({ children }: CometChatProviderProps) {
127
133
 
128
134
  setIsReady(true);
129
135
  } catch (e) {
130
- setError(String(e));
136
+ setError(formatCometChatError(e)); // from cometchat-core §6 errors.ts — NOT String(e),
137
+ // which renders "[object Object]" on kit errors (ENG-35719)
131
138
  }
132
139
  }
133
140
 
@@ -474,6 +481,9 @@ CometChat components fill 100% of their container. Two visual bugs to avoid:
474
481
 
475
482
  **Bug 1 — zero height:** components render with zero height because the container has no explicit dimensions.
476
483
  **Bug 2 — message list grows past the viewport:** the list scrolls fine until it has too many messages, then pushes the composer below the fold. **This is the classic flex-shrink trap.**
484
+ **Bug 3 — list won't scroll at all even with a bounded parent:** the height chain looks right but the list still grows/clips instead of scrolling. **Cause: the kit renders a `.cometchat` flex element as the immediate child inside your list wrapper, and `CometChatMessageList`'s own `height: 100%` only resolves if that injected element also has a height.** Inline styles can't target an auto-injected child, so you MUST add a real CSS child rule. This is the #1 cause of "I set height everywhere and it still won't scroll."
485
+
486
+ **The full height chain must reach a definite height** — `html, body { height: 100% }` and `#root { height: 100vh }` (NOT `min-height` — `min-height` lets the container grow with content, so the list never gets a bound to scroll within). Vite/CRA starter CSS ships `#root { min-height: 100vh; max-width: 1280px; ... }` — delete it.
477
487
 
478
488
  The hard rule for two-pane / header+list+composer layouts: every flex container in the chain MUST have `minHeight: 0` (and `minWidth: 0` for horizontal flex). Without it, browsers default flex-children to `min-height: auto` (their intrinsic content size), so the list grows beyond the parent's bounds as messages accumulate.
479
489
 
@@ -536,9 +546,39 @@ The hard rule for two-pane / header+list+composer layouts: every flex container
536
546
 
537
547
  **Why `minHeight: 0` is non-obvious:** the W3C spec sets the default `min-height` of a flex item to `auto` (its intrinsic content height). For a scrollable list inside a flex column, this means the list refuses to shrink below its content even when the parent is bounded. Setting `minHeight: 0` on the flex parent overrides this, letting the list shrink and scroll within the bounded container instead of overflowing it.
538
548
 
549
+ **The kit-injected `.cometchat` wrapper (the part inline styles can't fix).** `CometChatMessageList` renders a `.cometchat` flex element as its outermost node, with `.cometchat-message-list { height: 100% }` inside it. If you wrap the list in your own div, that injected `.cometchat` sits between your div and the list — and a percentage `height: 100%` resolves to `auto` against an auto-height parent, so the list grows/clips instead of scrolling. Give the list its own wrapper **class** and add a child rule (this is exactly what the kit's own sample app does — `.cometchat-message-list-wrapper > .cometchat`):
550
+
551
+ ```tsx
552
+ // JSX — wrap the LIST (header/composer can stay direct siblings)
553
+ <div style={{ display: "flex", flexDirection: "column", height: "100%", minHeight: 0 }}>
554
+ <CometChatMessageHeader user={user} />
555
+ <div className="cc-msg-list">
556
+ <CometChatMessageList user={user} />
557
+ </div>
558
+ <CometChatMessageComposer user={user} />
559
+ </div>
560
+ ```
561
+
562
+ ```css
563
+ /* CSS — TWO load-bearing lines, both required (verified at runtime in Chromium
564
+ against kit 6.5, 2026-06-13):
565
+ 1. .cc-msg-list needs an EXPLICIT `height: 100%`, NOT just `flex: 1 1 0`. A height
566
+ that comes only from flex-grow is treated as INDEFINITE by Chromium/Safari, so
567
+ the kit's injected `.cometchat` child's `height: 100%` collapses to auto (content
568
+ height) and the list overflows/clips instead of scrolling. The explicit height
569
+ (resolving against the definite-height column) makes it definite so the % resolves.
570
+ `flex: 1 1 0; min-height: 0` still sizes it correctly in the column — keep them too.
571
+ 2. The `> .cometchat` child rule — inline styles cannot target the kit's
572
+ auto-injected child, so it MUST live in a stylesheet. */
573
+ .cc-msg-list { flex: 1 1 0; min-height: 0; height: 100%; overflow: hidden; }
574
+ .cc-msg-list > .cometchat { height: 100%; overflow: hidden; }
575
+ ```
576
+
577
+ > ⚠️ **The `height: 100%` on `.cc-msg-list` is non-negotiable and easy to miss.** A wrapper sized purely by `flex: 1 1 0` measures correctly (e.g. 645px) but Chromium still treats that height as *indefinite* for percentage-height children, so `.cometchat` falls back to content height (e.g. 1014px) and the messages clip silently with no scrollbar. This is the #1 "I followed the recipe and it still won't scroll" trap. The column that contains `.cc-msg-list` must itself have a definite height (the `height: 100%` + `minHeight: 0` flex column above, anchored to a definite-height `#root`).
578
+
539
579
  **The rule, restated as something to grep for:**
540
580
 
541
- > Every flex container that holds `CometChatMessageList` (directly or indirectly) MUST have `minHeight: 0` on it. Same for `minWidth: 0` on horizontal flex parents. Skip this and the layout works for short conversations and breaks for long ones.
581
+ > Every flex container that holds `CometChatMessageList` (directly or indirectly) MUST have `minHeight: 0`. Same for `minWidth: 0` on horizontal flex parents. AND when you wrap the list, add a `.your-list-wrapper > .cometchat { height: 100%; overflow: hidden }` CSS rule for the kit's injected child — without it the list won't scroll no matter how many heights you set inline. The full chain (`html`/`body`/`#root`) must use a definite `height`, never `min-height`.
542
582
 
543
583
  ### Vite dependency optimization
544
584