@cometchat/skills 4.2.1 → 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 (234) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +33 -12
  3. package/bin/install.js +59 -4
  4. package/package.json +14 -1
  5. package/skills/cometchat/SKILL.md +460 -77
  6. package/skills/cometchat/references/asking-questions.md +48 -0
  7. package/skills/cometchat-a11y/SKILL.md +3 -2
  8. package/skills/cometchat-android-v5/SKILL.md +2 -1
  9. package/skills/cometchat-android-v5-calls/SKILL.md +36 -22
  10. package/skills/cometchat-android-v5-calls/references/README.md +1 -1
  11. package/skills/cometchat-android-v5-calls/references/add-calls-to-existing-chat.md +7 -5
  12. package/skills/cometchat-android-v5-calls/references/audio-controls.md +4 -4
  13. package/skills/cometchat-android-v5-calls/references/call-layouts.md +33 -25
  14. package/skills/cometchat-android-v5-calls/references/call-session.md +2 -2
  15. package/skills/cometchat-android-v5-calls/references/custom-ui.md +5 -5
  16. package/skills/cometchat-android-v5-calls/references/event-listeners.md +2 -2
  17. package/skills/cometchat-android-v5-calls/references/idle-timeout.md +20 -14
  18. package/skills/cometchat-android-v5-calls/references/in-call-chat.md +1 -1
  19. package/skills/cometchat-android-v5-calls/references/migration-v4-to-v5.md +43 -27
  20. package/skills/cometchat-android-v5-calls/references/participant-management.md +3 -3
  21. package/skills/cometchat-android-v5-calls/references/raise-hand.md +25 -19
  22. package/skills/cometchat-android-v5-calls/references/recording.md +2 -2
  23. package/skills/cometchat-android-v5-calls/references/ringing-integration.md +1 -1
  24. package/skills/cometchat-android-v5-calls/references/screen-sharing.md +5 -9
  25. package/skills/cometchat-android-v5-calls/references/session-settings.md +3 -3
  26. package/skills/cometchat-android-v5-calls/references/setup.md +1 -1
  27. package/skills/cometchat-android-v5-calls/references/share-invite.md +9 -4
  28. package/skills/cometchat-android-v5-calls/references/video-controls.md +4 -4
  29. package/skills/cometchat-android-v5-calls/references/voip-calling.md +2 -2
  30. package/skills/cometchat-android-v5-components/SKILL.md +4 -3
  31. package/skills/cometchat-android-v5-core/SKILL.md +20 -2
  32. package/skills/cometchat-android-v5-customization/SKILL.md +171 -7
  33. package/skills/cometchat-android-v5-extensions/SKILL.md +7 -4
  34. package/skills/cometchat-android-v5-features/SKILL.md +5 -4
  35. package/skills/cometchat-android-v5-placement/SKILL.md +2 -1
  36. package/skills/cometchat-android-v5-production/SKILL.md +2 -1
  37. package/skills/cometchat-android-v5-push/SKILL.md +2 -3
  38. package/skills/cometchat-android-v5-testing/SKILL.md +2 -1
  39. package/skills/cometchat-android-v5-theming/SKILL.md +2 -1
  40. package/skills/cometchat-android-v5-troubleshooting/SKILL.md +3 -2
  41. package/skills/cometchat-android-v6/SKILL.md +2 -1
  42. package/skills/cometchat-android-v6-builder-settings/SKILL.md +11 -7
  43. package/skills/cometchat-android-v6-calls/SKILL.md +79 -18
  44. package/skills/cometchat-android-v6-calls/references/advanced-features.md +87 -0
  45. package/skills/cometchat-android-v6-calls/references/call-layouts.md +24 -15
  46. package/skills/cometchat-android-v6-calls/references/call-session.md +2 -2
  47. package/skills/cometchat-android-v6-calls/references/device-management.md +17 -16
  48. package/skills/cometchat-android-v6-calls/references/idle-timeout.md +7 -4
  49. package/skills/cometchat-android-v6-calls/references/in-call-chat.md +13 -8
  50. package/skills/cometchat-android-v6-calls/references/raise-hand.md +6 -4
  51. package/skills/cometchat-android-v6-compose-components/SKILL.md +52 -29
  52. package/skills/cometchat-android-v6-compose-customization/SKILL.md +156 -1
  53. package/skills/cometchat-android-v6-compose-placement/SKILL.md +129 -40
  54. package/skills/cometchat-android-v6-compose-theming/SKILL.md +27 -1
  55. package/skills/cometchat-android-v6-core/SKILL.md +389 -9
  56. package/skills/cometchat-android-v6-events/SKILL.md +4 -1
  57. package/skills/cometchat-android-v6-extensions/SKILL.md +2 -1
  58. package/skills/cometchat-android-v6-features/SKILL.md +26 -2
  59. package/skills/cometchat-android-v6-kotlin-components/SKILL.md +31 -1
  60. package/skills/cometchat-android-v6-kotlin-customization/SKILL.md +172 -1
  61. package/skills/cometchat-android-v6-kotlin-placement/SKILL.md +20 -5
  62. package/skills/cometchat-android-v6-kotlin-theming/SKILL.md +36 -5
  63. package/skills/cometchat-android-v6-migration/SKILL.md +44 -42
  64. package/skills/cometchat-android-v6-production/SKILL.md +6 -3
  65. package/skills/cometchat-android-v6-push/SKILL.md +43 -2
  66. package/skills/cometchat-android-v6-testing/SKILL.md +11 -8
  67. package/skills/cometchat-android-v6-troubleshooting/SKILL.md +26 -5
  68. package/skills/cometchat-angular-calls/SKILL.md +256 -389
  69. package/skills/cometchat-angular-calls/references/add-calls-to-existing-chat.md +3 -2
  70. package/skills/cometchat-angular-calls/references/call-layouts.md +29 -12
  71. package/skills/cometchat-angular-calls/references/call-session.md +2 -2
  72. package/skills/cometchat-angular-calls/references/custom-ui.md +18 -10
  73. package/skills/cometchat-angular-calls/references/device-management.md +53 -34
  74. package/skills/cometchat-angular-calls/references/group-calls.md +45 -24
  75. package/skills/cometchat-angular-calls/references/idle-timeout.md +31 -15
  76. package/skills/cometchat-angular-calls/references/ngzone-and-async-callbacks.md +7 -6
  77. package/skills/cometchat-angular-calls/references/raise-hand.md +9 -4
  78. package/skills/cometchat-angular-calls/references/recording-screen-share.md +32 -39
  79. package/skills/cometchat-angular-calls/references/ringing-integration.md +3 -1
  80. package/skills/cometchat-angular-calls/references/share-invite.md +11 -5
  81. package/skills/cometchat-angular-calls/references/virtual-background.md +29 -0
  82. package/skills/cometchat-angular-components/SKILL.md +149 -620
  83. package/skills/cometchat-angular-core/SKILL.md +235 -293
  84. package/skills/cometchat-angular-customization/SKILL.md +415 -223
  85. package/skills/cometchat-angular-features/SKILL.md +216 -334
  86. package/skills/cometchat-angular-patterns/SKILL.md +168 -359
  87. package/skills/cometchat-angular-placement/SKILL.md +189 -560
  88. package/skills/cometchat-angular-production/SKILL.md +241 -92
  89. package/skills/cometchat-angular-push/SKILL.md +280 -294
  90. package/skills/cometchat-angular-testing/SKILL.md +430 -158
  91. package/skills/cometchat-angular-theming/SKILL.md +190 -265
  92. package/skills/cometchat-angular-troubleshooting/SKILL.md +192 -157
  93. package/skills/cometchat-astro-patterns/SKILL.md +22 -1
  94. package/skills/cometchat-calls/SKILL.md +25 -19
  95. package/skills/cometchat-calls/references/use-case-broadcast.md +15 -10
  96. package/skills/cometchat-calls/references/use-case-marketplace.md +2 -3
  97. package/skills/cometchat-calls/references/use-case-support.md +3 -4
  98. package/skills/cometchat-calls/references/use-case-team.md +23 -12
  99. package/skills/cometchat-calls/references/use-case-telehealth.md +3 -4
  100. package/skills/cometchat-components/SKILL.md +163 -25
  101. package/skills/cometchat-core/SKILL.md +412 -13
  102. package/skills/cometchat-customization/SKILL.md +50 -25
  103. package/skills/cometchat-features/SKILL.md +313 -34
  104. package/skills/cometchat-flutter-v5/SKILL.md +10 -4
  105. package/skills/cometchat-flutter-v5-calls/SKILL.md +188 -158
  106. package/skills/cometchat-flutter-v5-calls/references/add-calls-to-existing-chat.md +48 -24
  107. package/skills/cometchat-flutter-v5-calls/references/call-layouts.md +20 -15
  108. package/skills/cometchat-flutter-v5-calls/references/call-session.md +100 -145
  109. package/skills/cometchat-flutter-v5-calls/references/device-management.md +12 -8
  110. package/skills/cometchat-flutter-v5-calls/references/group-calls.md +30 -36
  111. package/skills/cometchat-flutter-v5-calls/references/idle-timeout.md +15 -13
  112. package/skills/cometchat-flutter-v5-calls/references/in-call-chat.md +12 -9
  113. package/skills/cometchat-flutter-v5-calls/references/migration-v4-to-v5.md +115 -65
  114. package/skills/cometchat-flutter-v5-calls/references/raise-hand.md +41 -30
  115. package/skills/cometchat-flutter-v5-calls/references/ringing-integration.md +17 -14
  116. package/skills/cometchat-flutter-v5-calls/references/share-invite.md +8 -2
  117. package/skills/cometchat-flutter-v5-conversations/SKILL.md +2 -1
  118. package/skills/cometchat-flutter-v5-core/SKILL.md +20 -2
  119. package/skills/cometchat-flutter-v5-customization/SKILL.md +136 -5
  120. package/skills/cometchat-flutter-v5-events/SKILL.md +2 -1
  121. package/skills/cometchat-flutter-v5-messages/SKILL.md +2 -1
  122. package/skills/cometchat-flutter-v5-production/SKILL.md +15 -6
  123. package/skills/cometchat-flutter-v5-push/SKILL.md +2 -1
  124. package/skills/cometchat-flutter-v5-testing/SKILL.md +17 -6
  125. package/skills/cometchat-flutter-v5-theming/SKILL.md +2 -1
  126. package/skills/cometchat-flutter-v5-troubleshooting/SKILL.md +7 -6
  127. package/skills/cometchat-flutter-v5-users-groups/SKILL.md +3 -2
  128. package/skills/cometchat-flutter-v6/SKILL.md +17 -16
  129. package/skills/cometchat-flutter-v6-calls/SKILL.md +78 -63
  130. package/skills/cometchat-flutter-v6-calls/references/add-calls-to-existing-chat.md +8 -6
  131. package/skills/cometchat-flutter-v6-calls/references/advanced-features.md +89 -0
  132. package/skills/cometchat-flutter-v6-calls/references/call-layouts.md +15 -12
  133. package/skills/cometchat-flutter-v6-calls/references/call-session.md +2 -2
  134. package/skills/cometchat-flutter-v6-calls/references/device-management.md +9 -3
  135. package/skills/cometchat-flutter-v6-calls/references/group-calls.md +10 -10
  136. package/skills/cometchat-flutter-v6-calls/references/idle-timeout.md +15 -7
  137. package/skills/cometchat-flutter-v6-calls/references/in-call-chat.md +6 -3
  138. package/skills/cometchat-flutter-v6-calls/references/raise-hand.md +23 -16
  139. package/skills/cometchat-flutter-v6-components/SKILL.md +32 -11
  140. package/skills/cometchat-flutter-v6-conversations/SKILL.md +39 -11
  141. package/skills/cometchat-flutter-v6-core/SKILL.md +348 -10
  142. package/skills/cometchat-flutter-v6-customization/SKILL.md +97 -25
  143. package/skills/cometchat-flutter-v6-events/SKILL.md +3 -2
  144. package/skills/cometchat-flutter-v6-features/SKILL.md +15 -6
  145. package/skills/cometchat-flutter-v6-messages/SKILL.md +111 -60
  146. package/skills/cometchat-flutter-v6-migration/SKILL.md +18 -25
  147. package/skills/cometchat-flutter-v6-placement/SKILL.md +79 -50
  148. package/skills/cometchat-flutter-v6-production/SKILL.md +13 -12
  149. package/skills/cometchat-flutter-v6-push/SKILL.md +43 -21
  150. package/skills/cometchat-flutter-v6-testing/SKILL.md +6 -6
  151. package/skills/cometchat-flutter-v6-theming/SKILL.md +38 -5
  152. package/skills/cometchat-flutter-v6-troubleshooting/SKILL.md +182 -17
  153. package/skills/cometchat-flutter-v6-users-groups/SKILL.md +12 -4
  154. package/skills/cometchat-i18n/SKILL.md +139 -78
  155. package/skills/cometchat-ios/SKILL.md +4 -2
  156. package/skills/cometchat-ios-calls/SKILL.md +225 -95
  157. package/skills/cometchat-ios-calls/references/add-calls-to-existing-chat.md +11 -9
  158. package/skills/cometchat-ios-calls/references/audio-modes-and-controls.md +45 -0
  159. package/skills/cometchat-ios-calls/references/avaudiosession-routing.md +6 -7
  160. package/skills/cometchat-ios-calls/references/call-layouts.md +31 -91
  161. package/skills/cometchat-ios-calls/references/call-session.md +51 -54
  162. package/skills/cometchat-ios-calls/references/callkit-and-pushkit.md +33 -29
  163. package/skills/cometchat-ios-calls/references/custom-ui.md +38 -38
  164. package/skills/cometchat-ios-calls/references/group-calls.md +33 -70
  165. package/skills/cometchat-ios-calls/references/idle-timeout.md +24 -25
  166. package/skills/cometchat-ios-calls/references/in-call-chat.md +19 -23
  167. package/skills/cometchat-ios-calls/references/migration-v4-to-v5.md +128 -70
  168. package/skills/cometchat-ios-calls/references/picture-in-picture.md +20 -20
  169. package/skills/cometchat-ios-calls/references/raise-hand.md +14 -227
  170. package/skills/cometchat-ios-calls/references/recording-screen-share.md +35 -122
  171. package/skills/cometchat-ios-calls/references/ringing-integration.md +17 -16
  172. package/skills/cometchat-ios-calls/references/share-invite.md +8 -12
  173. package/skills/cometchat-ios-calls/references/swiftui-uikit-hosting.md +4 -4
  174. package/skills/cometchat-ios-components/SKILL.md +200 -12
  175. package/skills/cometchat-ios-core/SKILL.md +281 -11
  176. package/skills/cometchat-ios-customization/SKILL.md +276 -110
  177. package/skills/cometchat-ios-features/SKILL.md +64 -36
  178. package/skills/cometchat-ios-placement/SKILL.md +15 -12
  179. package/skills/cometchat-ios-production/SKILL.md +12 -4
  180. package/skills/cometchat-ios-push/SKILL.md +53 -19
  181. package/skills/cometchat-ios-testing/SKILL.md +14 -9
  182. package/skills/cometchat-ios-theming/SKILL.md +39 -3
  183. package/skills/cometchat-ios-troubleshooting/SKILL.md +41 -21
  184. package/skills/cometchat-native-bare-patterns/SKILL.md +56 -18
  185. package/skills/cometchat-native-calls/SKILL.md +89 -19
  186. package/skills/cometchat-native-calls/references/add-calls-to-existing-chat.md +2 -2
  187. package/skills/cometchat-native-calls/references/call-layouts.md +15 -14
  188. package/skills/cometchat-native-calls/references/call-session.md +2 -2
  189. package/skills/cometchat-native-calls/references/custom-ui.md +12 -8
  190. package/skills/cometchat-native-calls/references/device-management.md +53 -30
  191. package/skills/cometchat-native-calls/references/group-calls.md +35 -30
  192. package/skills/cometchat-native-calls/references/idle-timeout.md +6 -6
  193. package/skills/cometchat-native-calls/references/in-call-chat.md +10 -8
  194. package/skills/cometchat-native-calls/references/migration-v4-to-v5.md +2 -2
  195. package/skills/cometchat-native-calls/references/raise-hand.md +15 -13
  196. package/skills/cometchat-native-calls/references/recording-screen-share.md +49 -170
  197. package/skills/cometchat-native-calls/references/share-invite.md +7 -5
  198. package/skills/cometchat-native-calls/references/voip-push-end-to-end.md +4 -2
  199. package/skills/cometchat-native-components/SKILL.md +91 -57
  200. package/skills/cometchat-native-core/SKILL.md +281 -9
  201. package/skills/cometchat-native-customization/SKILL.md +150 -28
  202. package/skills/cometchat-native-expo-patterns/SKILL.md +77 -27
  203. package/skills/cometchat-native-features/SKILL.md +79 -49
  204. package/skills/cometchat-native-placement/SKILL.md +19 -10
  205. package/skills/cometchat-native-production/SKILL.md +9 -3
  206. package/skills/cometchat-native-push/SKILL.md +2 -1
  207. package/skills/cometchat-native-testing/SKILL.md +1 -2
  208. package/skills/cometchat-native-theming/SKILL.md +54 -29
  209. package/skills/cometchat-native-troubleshooting/SKILL.md +71 -3
  210. package/skills/cometchat-nextjs-patterns/SKILL.md +48 -6
  211. package/skills/cometchat-placement/SKILL.md +42 -3
  212. package/skills/cometchat-production/SKILL.md +12 -5
  213. package/skills/cometchat-react-calls/SKILL.md +220 -10
  214. package/skills/cometchat-react-calls/references/add-calls-to-existing-chat.md +4 -3
  215. package/skills/cometchat-react-calls/references/call-layouts.md +5 -6
  216. package/skills/cometchat-react-calls/references/call-session.md +1 -1
  217. package/skills/cometchat-react-calls/references/custom-ui.md +61 -15
  218. package/skills/cometchat-react-calls/references/device-management.md +55 -51
  219. package/skills/cometchat-react-calls/references/group-calls.md +18 -23
  220. package/skills/cometchat-react-calls/references/idle-timeout.md +25 -12
  221. package/skills/cometchat-react-calls/references/in-call-chat.md +7 -7
  222. package/skills/cometchat-react-calls/references/migration-v4-to-v5.md +9 -11
  223. package/skills/cometchat-react-calls/references/raise-hand.md +14 -14
  224. package/skills/cometchat-react-calls/references/recording-screen-share.md +39 -38
  225. package/skills/cometchat-react-calls/references/ringing-integration.md +2 -2
  226. package/skills/cometchat-react-calls/references/share-invite.md +4 -5
  227. package/skills/cometchat-react-calls/references/testing-calls-on-web.md +20 -2
  228. package/skills/cometchat-react-calls/references/virtual-background.md +32 -0
  229. package/skills/cometchat-react-patterns/SKILL.md +57 -4
  230. package/skills/cometchat-react-push/SKILL.md +258 -72
  231. package/skills/cometchat-react-router-patterns/SKILL.md +43 -4
  232. package/skills/cometchat-react-testing/SKILL.md +14 -5
  233. package/skills/cometchat-theming/SKILL.md +181 -18
  234. package/skills/cometchat-troubleshooting/SKILL.md +40 -20
@@ -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
 
@@ -573,3 +613,16 @@ When integrating CometChat into a React (Vite/CRA) project, follow these steps i
573
613
  9. Add a "Messages" link to the existing nav
574
614
 
575
615
  **Do not skip step 6.** The provider must wrap the app root so init happens once, regardless of which route or modal opens chat.
616
+
617
+ ## 9. Visual Builder integration (v4.3)
618
+
619
+ If the customer picks **Visually** in dispatcher Step 3.1, the React-on-Vite/CRA recipe diverges from the code-driven path described above. Instead of authoring a `CometChatProvider`, skills runs `cometchat builder export --platform react --json` to download the canonical `src/CometChat/` directory + patch `CometChatSettings.ts` with the customer's per-builder configuration. Then patches `src/main.tsx` (Vite) or `src/index.tsx` (CRA) to mount `<CometChatApp />`.
620
+
621
+ **Full recipe lives in `cometchat-core` §11 "Visual Builder integration".** This section is a pointer + Vite/CRA-specific gotchas:
622
+
623
+ - **`cometchat builder export --platform react`** is the single command — replaces the v4.2 era "fetch JSON + manually copy" pattern. Defaults to `--output src/CometChat`. Resync = same command with `--force`. See `cometchat-core` §11.1.
624
+ - **Vite 7+ tsconfig is auto-relaxed by `cometchat apply`** (Finding F35, 2026-05-22) — `verbatimModuleSyntax`, `noUnusedLocals`, `noUnusedParameters`, `erasableSyntaxOnly` all set to `false`. CRA's defaults are already permissive — no change needed for CRA. For Visually path, also set `resolveJsonModule: true` + `allowJs: true` per cometchat-core §11.2.
625
+ - **`package.json` needs `cometChatCustomConfig`** block (Finding F2). The canonical context reads `packageJson.cometChatCustomConfig.{name, version, production}`.
626
+ - **Pinned versions**: `@cometchat/chat-uikit-react@6.4.3` + `@cometchat/calls-sdk-javascript@4.2.5` (per the canonical README; newer versions may drift from the copied CometChat/ API surface).
627
+
628
+ If the customer picks **In code**, ignore this section — sections 1-8 above are the path. (`cometchat apply` auto-patches tsconfig for both paths per F35.)