@cometchat/skills 4.4.2 → 5.0.1

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 (518) hide show
  1. package/.claude-plugin/marketplace.json +55 -0
  2. package/.claude-plugin/plugin.json +14 -0
  3. package/CHANGELOG.md +44 -0
  4. package/LICENSE +21 -0
  5. package/MIGRATING.md +187 -0
  6. package/README.md +52 -156
  7. package/RULES.md +125 -0
  8. package/bin/cometchat-skills.mjs +1280 -0
  9. package/bin/legacy-skills.json +95 -0
  10. package/catalogs/android-v6.json +1646 -0
  11. package/catalogs/flutter-v6.json +651 -0
  12. package/catalogs/ios-v5.json +1383 -0
  13. package/catalogs/rn-calls-v5.json +134 -0
  14. package/catalogs/rn-calls-v5.symbols.txt +58 -0
  15. package/catalogs/rn-sdk-v4.json +672 -0
  16. package/catalogs/rn-v5.json +449 -0
  17. package/catalogs/rn-v5.symbols.txt +216 -0
  18. package/catalogs/sdk-android-v5.json +514 -0
  19. package/contracts.android-calls-v5.json +122 -0
  20. package/contracts.android-v6.json +135 -0
  21. package/contracts.angular-v5.json +694 -0
  22. package/contracts.flutter-calls-v5.json +77 -0
  23. package/contracts.flutter-v6.json +126 -0
  24. package/contracts.ios-calls-v5.json +67 -0
  25. package/contracts.ios-v5.json +436 -0
  26. package/contracts.json +82 -0
  27. package/contracts.rn-calls-v5.json +77 -0
  28. package/contracts.rn-v5.json +727 -0
  29. package/contracts.sdk-android-v5.json +15 -0
  30. package/contracts.web-calls-v5.json +45 -0
  31. package/features.android-calls-v5.json +246 -0
  32. package/features.android-v6.json +65 -0
  33. package/features.angular-v5.json +521 -0
  34. package/features.flutter-calls-v5.json +286 -0
  35. package/features.flutter-v6.json +484 -0
  36. package/features.ios-calls-v5.json +236 -0
  37. package/features.ios-v5.json +573 -0
  38. package/features.json +61 -0
  39. package/features.rn-calls-v5.json +187 -0
  40. package/features.rn-v5.json +614 -0
  41. package/features.sdk-android-v5.json +40 -0
  42. package/features.sdk-jsv4.json +24 -0
  43. package/features.web-calls-v5.json +108 -0
  44. package/package.json +156 -74
  45. package/peers.yaml +355 -0
  46. package/registry/README.md +31 -0
  47. package/registry/android-calls-v5.json +94 -0
  48. package/registry/android-v6.json +177 -0
  49. package/registry/angular-v5.json +154 -0
  50. package/registry/flutter-calls-v5.json +94 -0
  51. package/registry/flutter-v6.json +159 -0
  52. package/registry/ios-calls-v5.json +99 -0
  53. package/registry/ios-v5.json +152 -0
  54. package/registry/rn-calls-v5.json +99 -0
  55. package/registry/rn-v5.json +169 -0
  56. package/registry/sdk-android-v5.json +93 -0
  57. package/registry/sdk-jsv4.json +93 -0
  58. package/registry/web-calls-v5.json +94 -0
  59. package/registry/web-v7.json +154 -0
  60. package/skills/cometchat/SKILL.md +47 -2096
  61. package/skills/cometchat-a11y/SKILL.md +44 -472
  62. package/skills/cometchat-analytics/SKILL.md +61 -0
  63. package/skills/cometchat-android-v5-calls-sdk/SKILL.md +206 -0
  64. package/skills/cometchat-android-v5-calls-sdk/references/build-truth.md +63 -0
  65. package/skills/cometchat-android-v5-calls-sdk/references/docs-map.md +119 -0
  66. package/skills/cometchat-android-v5-calls-sdk/references/method-map.md +53 -0
  67. package/skills/cometchat-android-v5-calls-sdk/references/pitfalls.md +72 -0
  68. package/skills/cometchat-android-v5-calls-sdk/references/ringing.md +92 -0
  69. package/skills/cometchat-android-v5-calls-sdk/references/user-switch.md +90 -0
  70. package/skills/cometchat-android-v5-sdk/SKILL.md +127 -0
  71. package/skills/cometchat-android-v5-sdk/references/app-surface.md +88 -0
  72. package/skills/cometchat-android-v5-sdk/references/docs-map.md +91 -0
  73. package/skills/cometchat-android-v6-builder-settings/SKILL.md +51 -137
  74. package/skills/cometchat-android-v6-calls/SKILL.md +128 -413
  75. package/skills/cometchat-android-v6-compose-components/SKILL.md +84 -194
  76. package/skills/cometchat-android-v6-compose-customization/SKILL.md +66 -411
  77. package/skills/cometchat-android-v6-compose-placement/SKILL.md +154 -237
  78. package/skills/cometchat-android-v6-core/SKILL.md +236 -672
  79. package/skills/cometchat-android-v6-core/references/anti-patterns.md +31 -0
  80. package/skills/cometchat-android-v6-core/references/component-props.md +168 -0
  81. package/skills/cometchat-android-v6-core/references/docs-map.md +153 -0
  82. package/skills/cometchat-android-v6-core/references/layout.md +112 -0
  83. package/skills/cometchat-android-v6-core/references/lifecycle.md +75 -0
  84. package/skills/cometchat-android-v6-core/references/setup-credentials.md +105 -0
  85. package/skills/cometchat-android-v6-core/references/troubleshooting.md +36 -0
  86. package/skills/cometchat-android-v6-events/SKILL.md +46 -184
  87. package/skills/cometchat-android-v6-extensions/SKILL.md +39 -179
  88. package/skills/cometchat-android-v6-features/SKILL.md +74 -143
  89. package/skills/cometchat-android-v6-kotlin-components/SKILL.md +75 -193
  90. package/skills/cometchat-android-v6-kotlin-customization/SKILL.md +67 -419
  91. package/skills/cometchat-android-v6-kotlin-placement/SKILL.md +77 -223
  92. package/skills/cometchat-android-v6-migration/SKILL.md +67 -378
  93. package/skills/cometchat-android-v6-production/SKILL.md +41 -179
  94. package/skills/cometchat-android-v6-push/SKILL.md +39 -289
  95. package/skills/cometchat-android-v6-testing/SKILL.md +50 -265
  96. package/skills/cometchat-android-v6-troubleshooting/SKILL.md +70 -254
  97. package/skills/cometchat-angular-v5-calls/SKILL.md +193 -0
  98. package/skills/cometchat-angular-v5-components/SKILL.md +131 -0
  99. package/skills/cometchat-angular-v5-components/references/catalog.md +111 -0
  100. package/skills/cometchat-angular-v5-components/references/host-composed.md +46 -0
  101. package/skills/cometchat-angular-v5-core/SKILL.md +300 -0
  102. package/skills/cometchat-angular-v5-core/references/anti-patterns.md +49 -0
  103. package/skills/cometchat-angular-v5-core/references/component-props.md +55 -0
  104. package/skills/cometchat-angular-v5-core/references/dependencies.md +66 -0
  105. package/skills/cometchat-angular-v5-core/references/docs-map.md +132 -0
  106. package/skills/cometchat-angular-v5-core/references/layout.md +64 -0
  107. package/skills/cometchat-angular-v5-core/references/lifecycle.md +202 -0
  108. package/skills/cometchat-angular-v5-core/references/setup-credentials.md +137 -0
  109. package/skills/cometchat-angular-v5-core/references/theming.md +70 -0
  110. package/skills/cometchat-angular-v5-core/references/troubleshooting.md +27 -0
  111. package/skills/cometchat-angular-v5-customization/SKILL.md +94 -0
  112. package/skills/cometchat-angular-v5-features/SKILL.md +107 -0
  113. package/skills/cometchat-angular-v5-features/references/custom-messages.md +133 -0
  114. package/skills/cometchat-angular-v5-features/references/formatters.md +28 -0
  115. package/skills/cometchat-angular-v5-features/references/host-composed-extensions.md +85 -0
  116. package/skills/cometchat-angular-v5-migration/SKILL.md +40 -0
  117. package/skills/cometchat-angular-v5-migration/references/migration-guide.md +165 -0
  118. package/skills/cometchat-angular-v5-patterns/SKILL.md +107 -0
  119. package/skills/cometchat-angular-v5-placement/SKILL.md +133 -0
  120. package/skills/cometchat-angular-v5-placement/references/combined-app.md +174 -0
  121. package/skills/cometchat-angular-v5-placement/references/core-surface.md +199 -0
  122. package/skills/cometchat-angular-v5-production/SKILL.md +102 -0
  123. package/skills/cometchat-angular-v5-push/SKILL.md +61 -0
  124. package/skills/cometchat-angular-v5-testing/SKILL.md +112 -0
  125. package/skills/cometchat-angular-v5-troubleshooting/SKILL.md +96 -0
  126. package/skills/cometchat-audit/SKILL.md +61 -0
  127. package/skills/cometchat-compliance/SKILL.md +63 -0
  128. package/skills/cometchat-flutter-v5-sdk/SKILL.md +188 -0
  129. package/skills/cometchat-flutter-v5-sdk/references/doc-corrections.md +55 -0
  130. package/skills/cometchat-flutter-v5-sdk/references/docs-map.md +211 -0
  131. package/skills/cometchat-flutter-v5-sdk/references/platform-notes.md +48 -0
  132. package/skills/cometchat-flutter-v5-sdk/references/transcription.md +87 -0
  133. package/skills/cometchat-flutter-v6-calls/SKILL.md +75 -389
  134. package/skills/cometchat-flutter-v6-components/SKILL.md +88 -361
  135. package/skills/cometchat-flutter-v6-core/SKILL.md +154 -593
  136. package/skills/cometchat-flutter-v6-core/references/anti-patterns.md +55 -0
  137. package/skills/cometchat-flutter-v6-core/references/docs-map.md +143 -0
  138. package/skills/cometchat-flutter-v6-core/references/layout.md +45 -0
  139. package/skills/cometchat-flutter-v6-core/references/lifecycle.md +87 -0
  140. package/skills/cometchat-flutter-v6-core/references/setup-credentials.md +84 -0
  141. package/skills/cometchat-flutter-v6-core/references/troubleshooting.md +26 -0
  142. package/skills/cometchat-flutter-v6-customization/SKILL.md +70 -712
  143. package/skills/cometchat-flutter-v6-events/SKILL.md +79 -174
  144. package/skills/cometchat-flutter-v6-features/SKILL.md +55 -394
  145. package/skills/cometchat-flutter-v6-migration/SKILL.md +68 -367
  146. package/skills/cometchat-flutter-v6-migration/references/migration-guide.md +132 -0
  147. package/skills/cometchat-flutter-v6-patterns/SKILL.md +61 -0
  148. package/skills/cometchat-flutter-v6-placement/SKILL.md +94 -381
  149. package/skills/cometchat-flutter-v6-production/SKILL.md +59 -615
  150. package/skills/cometchat-flutter-v6-push/SKILL.md +46 -455
  151. package/skills/cometchat-flutter-v6-testing/SKILL.md +68 -299
  152. package/skills/cometchat-flutter-v6-troubleshooting/SKILL.md +54 -878
  153. package/skills/cometchat-i18n/SKILL.md +35 -404
  154. package/skills/cometchat-ios-calls/SKILL.md +112 -563
  155. package/skills/cometchat-ios-components/SKILL.md +44 -834
  156. package/skills/cometchat-ios-core/SKILL.md +182 -1068
  157. package/skills/cometchat-ios-core/references/anti-patterns.md +113 -0
  158. package/skills/cometchat-ios-core/references/docs-map.md +124 -0
  159. package/skills/cometchat-ios-core/references/install.md +23 -0
  160. package/skills/cometchat-ios-core/references/layout.md +219 -0
  161. package/skills/cometchat-ios-core/references/setup-credentials.md +197 -0
  162. package/skills/cometchat-ios-core/references/swiftui.md +91 -0
  163. package/skills/cometchat-ios-core/references/troubleshooting.md +100 -0
  164. package/skills/cometchat-ios-customization/SKILL.md +33 -968
  165. package/skills/cometchat-ios-features/SKILL.md +29 -738
  166. package/skills/cometchat-ios-migration/SKILL.md +39 -0
  167. package/skills/cometchat-ios-placement/SKILL.md +51 -729
  168. package/skills/cometchat-ios-production/SKILL.md +67 -723
  169. package/skills/cometchat-ios-push/SKILL.md +24 -602
  170. package/skills/cometchat-ios-testing/SKILL.md +36 -355
  171. package/skills/cometchat-ios-troubleshooting/SKILL.md +31 -989
  172. package/skills/cometchat-ios-v5-sdk/SKILL.md +161 -0
  173. package/skills/cometchat-ios-v5-sdk/references/docs-map.md +326 -0
  174. package/skills/cometchat-js-v5-sdk/SKILL.md +95 -0
  175. package/skills/cometchat-js-v5-sdk/references/docs-map.md +114 -0
  176. package/skills/cometchat-migrate-from-getstream/SKILL.md +65 -0
  177. package/skills/cometchat-migrate-from-getstream/references/concept-map.md +98 -0
  178. package/skills/cometchat-migrate-from-getstream/references/data-migration.md +74 -0
  179. package/skills/cometchat-migrate-from-getstream/references/feature-map.md +108 -0
  180. package/skills/cometchat-migrate-from-getstream/references/inventory.md +82 -0
  181. package/skills/cometchat-migrate-from-getstream/references/native-build.md +9 -0
  182. package/skills/cometchat-migrate-from-getstream/references/report-template.md +59 -0
  183. package/skills/cometchat-migrate-from-sendbird/SKILL.md +64 -0
  184. package/skills/cometchat-migrate-from-sendbird/references/concept-map.md +99 -0
  185. package/skills/cometchat-migrate-from-sendbird/references/data-migration.md +74 -0
  186. package/skills/cometchat-migrate-from-sendbird/references/feature-map.md +104 -0
  187. package/skills/cometchat-migrate-from-sendbird/references/inventory.md +86 -0
  188. package/skills/cometchat-migrate-from-sendbird/references/native-build.md +10 -0
  189. package/skills/cometchat-migrate-from-sendbird/references/report-template.md +59 -0
  190. package/skills/cometchat-migrate-from-twilio/SKILL.md +52 -0
  191. package/skills/cometchat-migrate-from-twilio/references/concept-map.md +49 -0
  192. package/skills/cometchat-migrate-from-twilio/references/data-migration.md +50 -0
  193. package/skills/cometchat-migrate-from-twilio/references/feature-map.md +27 -0
  194. package/skills/cometchat-migrate-from-twilio/references/inventory.md +53 -0
  195. package/skills/cometchat-migrate-from-twilio/references/report-template.md +52 -0
  196. package/skills/cometchat-moderation/SKILL.md +58 -0
  197. package/skills/cometchat-onboarding/SKILL.md +92 -0
  198. package/skills/cometchat-onboarding/references/archetypes.md +51 -0
  199. package/skills/cometchat-onboarding/references/calling-first.md +77 -0
  200. package/skills/cometchat-onboarding/references/not-in-this-pack.md +8 -0
  201. package/skills/cometchat-onboarding/references/plan-artifact.md +133 -0
  202. package/skills/cometchat-onboarding/references/platforms.md +105 -0
  203. package/skills/cometchat-react-native-bare-patterns/SKILL.md +120 -0
  204. package/skills/cometchat-react-native-calls/SKILL.md +200 -0
  205. package/skills/cometchat-react-native-components/SKILL.md +142 -0
  206. package/skills/cometchat-react-native-core/SKILL.md +335 -0
  207. package/skills/cometchat-react-native-core/references/anti-patterns.md +79 -0
  208. package/skills/cometchat-react-native-core/references/component-props.md +105 -0
  209. package/skills/cometchat-react-native-core/references/dependencies.md +62 -0
  210. package/skills/cometchat-react-native-core/references/docs-map.md +127 -0
  211. package/skills/cometchat-react-native-core/references/layout.md +61 -0
  212. package/skills/cometchat-react-native-core/references/lifecycle.md +64 -0
  213. package/skills/cometchat-react-native-core/references/setup-credentials.md +39 -0
  214. package/skills/cometchat-react-native-customization/SKILL.md +198 -0
  215. package/skills/cometchat-react-native-expo-patterns/SKILL.md +116 -0
  216. package/skills/cometchat-react-native-features/SKILL.md +122 -0
  217. package/skills/cometchat-react-native-migration/SKILL.md +103 -0
  218. package/skills/cometchat-react-native-placement/SKILL.md +158 -0
  219. package/skills/cometchat-react-native-production/SKILL.md +79 -0
  220. package/skills/cometchat-react-native-push/SKILL.md +88 -0
  221. package/skills/cometchat-react-native-sdk/SKILL.md +133 -0
  222. package/skills/cometchat-react-native-sdk/references/method-map.md +239 -0
  223. package/skills/cometchat-react-native-sdk/references/page-map.md +96 -0
  224. package/skills/cometchat-react-native-testing/SKILL.md +94 -0
  225. package/skills/cometchat-react-native-troubleshooting/SKILL.md +174 -0
  226. package/skills/cometchat-react-native-v5-sdk/SKILL.md +150 -0
  227. package/skills/cometchat-react-native-v5-sdk/references/docs-map.md +127 -0
  228. package/skills/cometchat-react-native-v5-sdk/references/ringing-voip.md +369 -0
  229. package/skills/cometchat-react-v7-calls/SKILL.md +75 -0
  230. package/skills/cometchat-react-v7-components/SKILL.md +72 -0
  231. package/skills/cometchat-react-v7-core/SKILL.md +101 -0
  232. package/skills/cometchat-react-v7-core/references/anti-patterns.md +19 -0
  233. package/skills/cometchat-react-v7-core/references/component-props.md +82 -0
  234. package/skills/cometchat-react-v7-core/references/dependencies.md +23 -0
  235. package/skills/cometchat-react-v7-core/references/docs-map.md +117 -0
  236. package/skills/cometchat-react-v7-core/references/layout.md +150 -0
  237. package/skills/cometchat-react-v7-core/references/lifecycle.md +74 -0
  238. package/skills/cometchat-react-v7-core/references/setup-credentials.md +58 -0
  239. package/skills/cometchat-react-v7-core/references/ssr.md +11 -0
  240. package/skills/cometchat-react-v7-core/references/theming.md +52 -0
  241. package/skills/cometchat-react-v7-customization/SKILL.md +84 -0
  242. package/skills/cometchat-react-v7-features/SKILL.md +92 -0
  243. package/skills/cometchat-react-v7-migration/SKILL.md +39 -0
  244. package/skills/cometchat-react-v7-migration/references/migration-guide.md +119 -0
  245. package/skills/cometchat-react-v7-patterns/SKILL.md +43 -0
  246. package/skills/cometchat-react-v7-placement/SKILL.md +106 -0
  247. package/skills/cometchat-react-v7-placement/references/recipes.md +354 -0
  248. package/skills/cometchat-react-v7-production/SKILL.md +84 -0
  249. package/skills/cometchat-react-v7-push/SKILL.md +53 -0
  250. package/skills/cometchat-react-v7-testing/SKILL.md +60 -0
  251. package/skills/cometchat-react-v7-troubleshooting/SKILL.md +47 -0
  252. package/skills/cometchat-security/SKILL.md +80 -0
  253. package/skills/cometchat-self-host/SKILL.md +56 -0
  254. package/test-suite/README.md +70 -0
  255. package/test-suite/catalogs/android-calls-v5.json +830 -0
  256. package/test-suite/catalogs/android-calls-v5.symbols.txt +499 -0
  257. package/test-suite/catalogs/android-v6.json +1646 -0
  258. package/test-suite/catalogs/android-v6.symbols.txt +298 -0
  259. package/test-suite/catalogs/angular-v5.json +7587 -0
  260. package/test-suite/catalogs/flutter-calls-v5.json +196 -0
  261. package/test-suite/catalogs/flutter-calls-v5.symbols.txt +59 -0
  262. package/test-suite/catalogs/flutter-v6.json +651 -0
  263. package/test-suite/catalogs/ios-calls-v5.json +158 -0
  264. package/test-suite/catalogs/ios-calls-v5.symbols.txt +70 -0
  265. package/test-suite/catalogs/ios-v5.json +1383 -0
  266. package/test-suite/catalogs/ios-v5.symbols.txt +699 -0
  267. package/test-suite/catalogs/rn-calls-v5.json +134 -0
  268. package/test-suite/catalogs/rn-sdk-v4.json +672 -0
  269. package/test-suite/catalogs/rn-v5.json +449 -0
  270. package/test-suite/catalogs/sdk-android-v5.json +514 -0
  271. package/test-suite/catalogs/sdk-android-v5.symbols.txt +254 -0
  272. package/test-suite/catalogs/sdk-jsv4.json +800 -0
  273. package/test-suite/catalogs/web-calls-v5.json +195 -0
  274. package/test-suite/catalogs/web-v7.json +1243 -0
  275. package/test-suite/scripts/build-registry.mjs +113 -0
  276. package/test-suite/scripts/catalog-refresh-dart.mjs +151 -0
  277. package/test-suite/scripts/catalog-refresh.mjs +100 -0
  278. package/test-suite/scripts/lint-skills.mjs +932 -0
  279. package/test-suite/scripts/measure-tokens.mjs +169 -0
  280. package/test-suite/scripts/typecheck-fences-dart.mjs +437 -0
  281. package/test-suite/scripts/typecheck-fences-kotlin.mjs +269 -0
  282. package/test-suite/scripts/typecheck-fences.mjs +206 -0
  283. package/test-suite/scripts/verify-catalog.mjs +242 -0
  284. package/test-suite/scripts/verify-contract-fences.mjs +94 -0
  285. package/test-suite/scripts/verify-detection.mjs +178 -0
  286. package/test-suite/scripts/verify-docs-base.mjs +91 -0
  287. package/test-suite/scripts/verify-family-agnostic.mjs +134 -0
  288. package/test-suite/scripts/verify-golden-path.mjs +138 -0
  289. package/test-suite/scripts/verify-oracle-components.mjs +133 -0
  290. package/test-suite/scripts/verify-template-bindings.mjs +148 -0
  291. package/test-suite/typecheck/angular-v5/package.json +21 -0
  292. package/test-suite/typecheck/angular-v5/tsconfig.json +21 -0
  293. package/test-suite/typecheck/flutter-v6/analysis_options.yaml +25 -0
  294. package/test-suite/typecheck/flutter-v6/pubspec.yaml +21 -0
  295. package/test-suite/typecheck/web-v7/package.json +18 -0
  296. package/test-suite/typecheck/web-v7/tsconfig.json +19 -0
  297. package/bin/install.js +0 -1003
  298. package/skills/.claude-plugin/marketplace.json +0 -86
  299. package/skills/cometchat/references/asking-questions.md +0 -48
  300. package/skills/cometchat-android-v5/SKILL.md +0 -121
  301. package/skills/cometchat-android-v5-calls/SKILL.md +0 -429
  302. package/skills/cometchat-android-v5-calls/references/README.md +0 -53
  303. package/skills/cometchat-android-v5-calls/references/add-calls-to-existing-chat.md +0 -197
  304. package/skills/cometchat-android-v5-calls/references/audio-controls.md +0 -91
  305. package/skills/cometchat-android-v5-calls/references/background-handling.md +0 -168
  306. package/skills/cometchat-android-v5-calls/references/call-layouts.md +0 -131
  307. package/skills/cometchat-android-v5-calls/references/call-logs.md +0 -113
  308. package/skills/cometchat-android-v5-calls/references/call-session.md +0 -274
  309. package/skills/cometchat-android-v5-calls/references/custom-ui.md +0 -150
  310. package/skills/cometchat-android-v5-calls/references/event-listeners.md +0 -123
  311. package/skills/cometchat-android-v5-calls/references/group-calls.md +0 -205
  312. package/skills/cometchat-android-v5-calls/references/idle-timeout.md +0 -117
  313. package/skills/cometchat-android-v5-calls/references/in-call-chat.md +0 -134
  314. package/skills/cometchat-android-v5-calls/references/join-session.md +0 -120
  315. package/skills/cometchat-android-v5-calls/references/migration-v4-to-v5.md +0 -222
  316. package/skills/cometchat-android-v5-calls/references/participant-management.md +0 -110
  317. package/skills/cometchat-android-v5-calls/references/picture-in-picture.md +0 -106
  318. package/skills/cometchat-android-v5-calls/references/raise-hand.md +0 -248
  319. package/skills/cometchat-android-v5-calls/references/recording.md +0 -101
  320. package/skills/cometchat-android-v5-calls/references/ringing-integration.md +0 -152
  321. package/skills/cometchat-android-v5-calls/references/screen-sharing.md +0 -78
  322. package/skills/cometchat-android-v5-calls/references/server-fcm-voip.md +0 -215
  323. package/skills/cometchat-android-v5-calls/references/session-settings.md +0 -121
  324. package/skills/cometchat-android-v5-calls/references/setup.md +0 -137
  325. package/skills/cometchat-android-v5-calls/references/share-invite.md +0 -156
  326. package/skills/cometchat-android-v5-calls/references/video-controls.md +0 -87
  327. package/skills/cometchat-android-v5-calls/references/voip-calling.md +0 -526
  328. package/skills/cometchat-android-v5-components/SKILL.md +0 -431
  329. package/skills/cometchat-android-v5-core/SKILL.md +0 -486
  330. package/skills/cometchat-android-v5-customization/SKILL.md +0 -469
  331. package/skills/cometchat-android-v5-extensions/SKILL.md +0 -127
  332. package/skills/cometchat-android-v5-features/SKILL.md +0 -131
  333. package/skills/cometchat-android-v5-placement/SKILL.md +0 -277
  334. package/skills/cometchat-android-v5-production/SKILL.md +0 -95
  335. package/skills/cometchat-android-v5-push/SKILL.md +0 -619
  336. package/skills/cometchat-android-v5-testing/SKILL.md +0 -188
  337. package/skills/cometchat-android-v5-theming/SKILL.md +0 -167
  338. package/skills/cometchat-android-v5-troubleshooting/SKILL.md +0 -74
  339. package/skills/cometchat-android-v6/SKILL.md +0 -108
  340. package/skills/cometchat-android-v6-calls/references/add-calls-to-existing-chat.md +0 -97
  341. package/skills/cometchat-android-v6-calls/references/advanced-features.md +0 -87
  342. package/skills/cometchat-android-v6-calls/references/call-layouts.md +0 -100
  343. package/skills/cometchat-android-v6-calls/references/call-session.md +0 -163
  344. package/skills/cometchat-android-v6-calls/references/device-management.md +0 -172
  345. package/skills/cometchat-android-v6-calls/references/group-calls.md +0 -191
  346. package/skills/cometchat-android-v6-calls/references/idle-timeout.md +0 -110
  347. package/skills/cometchat-android-v6-calls/references/in-call-chat.md +0 -141
  348. package/skills/cometchat-android-v6-calls/references/raise-hand.md +0 -188
  349. package/skills/cometchat-android-v6-calls/references/ringing-integration.md +0 -176
  350. package/skills/cometchat-android-v6-calls/references/server-fcm-voip.md +0 -127
  351. package/skills/cometchat-android-v6-calls/references/share-invite.md +0 -105
  352. package/skills/cometchat-android-v6-compose-theming/SKILL.md +0 -250
  353. package/skills/cometchat-android-v6-kotlin-theming/SKILL.md +0 -233
  354. package/skills/cometchat-angular-calls/SKILL.md +0 -380
  355. package/skills/cometchat-angular-calls/references/add-calls-to-existing-chat.md +0 -96
  356. package/skills/cometchat-angular-calls/references/call-layouts.md +0 -123
  357. package/skills/cometchat-angular-calls/references/call-session.md +0 -167
  358. package/skills/cometchat-angular-calls/references/custom-ui.md +0 -239
  359. package/skills/cometchat-angular-calls/references/device-management.md +0 -154
  360. package/skills/cometchat-angular-calls/references/group-calls.md +0 -433
  361. package/skills/cometchat-angular-calls/references/idle-timeout.md +0 -161
  362. package/skills/cometchat-angular-calls/references/in-call-chat.md +0 -148
  363. package/skills/cometchat-angular-calls/references/lazy-loading-pitfalls.md +0 -205
  364. package/skills/cometchat-angular-calls/references/migration-v4-to-v5.md +0 -53
  365. package/skills/cometchat-angular-calls/references/ngzone-and-async-callbacks.md +0 -184
  366. package/skills/cometchat-angular-calls/references/picture-in-picture.md +0 -285
  367. package/skills/cometchat-angular-calls/references/raise-hand.md +0 -172
  368. package/skills/cometchat-angular-calls/references/recording-screen-share.md +0 -260
  369. package/skills/cometchat-angular-calls/references/ringing-integration.md +0 -133
  370. package/skills/cometchat-angular-calls/references/server-web-push-vapid.md +0 -100
  371. package/skills/cometchat-angular-calls/references/share-invite.md +0 -122
  372. package/skills/cometchat-angular-calls/references/virtual-background.md +0 -29
  373. package/skills/cometchat-angular-components/SKILL.md +0 -235
  374. package/skills/cometchat-angular-core/SKILL.md +0 -386
  375. package/skills/cometchat-angular-customization/SKILL.md +0 -616
  376. package/skills/cometchat-angular-features/SKILL.md +0 -329
  377. package/skills/cometchat-angular-patterns/SKILL.md +0 -256
  378. package/skills/cometchat-angular-placement/SKILL.md +0 -314
  379. package/skills/cometchat-angular-production/SKILL.md +0 -564
  380. package/skills/cometchat-angular-push/SKILL.md +0 -389
  381. package/skills/cometchat-angular-testing/SKILL.md +0 -605
  382. package/skills/cometchat-angular-theming/SKILL.md +0 -290
  383. package/skills/cometchat-angular-troubleshooting/SKILL.md +0 -364
  384. package/skills/cometchat-astro-patterns/SKILL.md +0 -708
  385. package/skills/cometchat-calls/SKILL.md +0 -364
  386. package/skills/cometchat-calls/references/use-case-broadcast.md +0 -199
  387. package/skills/cometchat-calls/references/use-case-marketplace.md +0 -157
  388. package/skills/cometchat-calls/references/use-case-support.md +0 -189
  389. package/skills/cometchat-calls/references/use-case-team.md +0 -180
  390. package/skills/cometchat-calls/references/use-case-telehealth.md +0 -153
  391. package/skills/cometchat-components/SKILL.md +0 -1142
  392. package/skills/cometchat-core/SKILL.md +0 -1048
  393. package/skills/cometchat-customization/SKILL.md +0 -580
  394. package/skills/cometchat-customization/references/component-catalog.md +0 -236
  395. package/skills/cometchat-features/SKILL.md +0 -861
  396. package/skills/cometchat-flutter-v5/SKILL.md +0 -173
  397. package/skills/cometchat-flutter-v5-calls/SKILL.md +0 -455
  398. package/skills/cometchat-flutter-v5-calls/references/add-calls-to-existing-chat.md +0 -193
  399. package/skills/cometchat-flutter-v5-calls/references/call-layouts.md +0 -103
  400. package/skills/cometchat-flutter-v5-calls/references/call-session.md +0 -285
  401. package/skills/cometchat-flutter-v5-calls/references/device-management.md +0 -124
  402. package/skills/cometchat-flutter-v5-calls/references/group-calls.md +0 -181
  403. package/skills/cometchat-flutter-v5-calls/references/idle-timeout.md +0 -99
  404. package/skills/cometchat-flutter-v5-calls/references/in-call-chat.md +0 -135
  405. package/skills/cometchat-flutter-v5-calls/references/migration-v4-to-v5.md +0 -210
  406. package/skills/cometchat-flutter-v5-calls/references/raise-hand.md +0 -255
  407. package/skills/cometchat-flutter-v5-calls/references/ringing-integration.md +0 -196
  408. package/skills/cometchat-flutter-v5-calls/references/server-push-bridge.md +0 -101
  409. package/skills/cometchat-flutter-v5-calls/references/share-invite.md +0 -148
  410. package/skills/cometchat-flutter-v5-conversations/SKILL.md +0 -118
  411. package/skills/cometchat-flutter-v5-core/SKILL.md +0 -239
  412. package/skills/cometchat-flutter-v5-customization/SKILL.md +0 -358
  413. package/skills/cometchat-flutter-v5-events/SKILL.md +0 -156
  414. package/skills/cometchat-flutter-v5-messages/SKILL.md +0 -259
  415. package/skills/cometchat-flutter-v5-production/SKILL.md +0 -216
  416. package/skills/cometchat-flutter-v5-push/SKILL.md +0 -285
  417. package/skills/cometchat-flutter-v5-testing/SKILL.md +0 -401
  418. package/skills/cometchat-flutter-v5-theming/SKILL.md +0 -161
  419. package/skills/cometchat-flutter-v5-troubleshooting/SKILL.md +0 -130
  420. package/skills/cometchat-flutter-v5-users-groups/SKILL.md +0 -152
  421. package/skills/cometchat-flutter-v6/SKILL.md +0 -446
  422. package/skills/cometchat-flutter-v6-calls/references/add-calls-to-existing-chat.md +0 -136
  423. package/skills/cometchat-flutter-v6-calls/references/advanced-features.md +0 -89
  424. package/skills/cometchat-flutter-v6-calls/references/call-layouts.md +0 -105
  425. package/skills/cometchat-flutter-v6-calls/references/call-session.md +0 -229
  426. package/skills/cometchat-flutter-v6-calls/references/device-management.md +0 -105
  427. package/skills/cometchat-flutter-v6-calls/references/group-calls.md +0 -190
  428. package/skills/cometchat-flutter-v6-calls/references/idle-timeout.md +0 -88
  429. package/skills/cometchat-flutter-v6-calls/references/in-call-chat.md +0 -125
  430. package/skills/cometchat-flutter-v6-calls/references/raise-hand.md +0 -275
  431. package/skills/cometchat-flutter-v6-calls/references/ringing-integration.md +0 -171
  432. package/skills/cometchat-flutter-v6-calls/references/server-push-bridge.md +0 -93
  433. package/skills/cometchat-flutter-v6-calls/references/share-invite.md +0 -102
  434. package/skills/cometchat-flutter-v6-conversations/SKILL.md +0 -238
  435. package/skills/cometchat-flutter-v6-messages/SKILL.md +0 -384
  436. package/skills/cometchat-flutter-v6-theming/SKILL.md +0 -293
  437. package/skills/cometchat-flutter-v6-users-groups/SKILL.md +0 -224
  438. package/skills/cometchat-ios/SKILL.md +0 -325
  439. package/skills/cometchat-ios-calls/references/add-calls-to-existing-chat.md +0 -181
  440. package/skills/cometchat-ios-calls/references/audio-modes-and-controls.md +0 -45
  441. package/skills/cometchat-ios-calls/references/avaudiosession-routing.md +0 -188
  442. package/skills/cometchat-ios-calls/references/call-layouts.md +0 -76
  443. package/skills/cometchat-ios-calls/references/call-session.md +0 -218
  444. package/skills/cometchat-ios-calls/references/callkit-and-pushkit.md +0 -357
  445. package/skills/cometchat-ios-calls/references/custom-ui.md +0 -322
  446. package/skills/cometchat-ios-calls/references/device-management.md +0 -171
  447. package/skills/cometchat-ios-calls/references/group-calls.md +0 -359
  448. package/skills/cometchat-ios-calls/references/idle-timeout.md +0 -184
  449. package/skills/cometchat-ios-calls/references/in-call-chat.md +0 -179
  450. package/skills/cometchat-ios-calls/references/migration-v4-to-v5.md +0 -196
  451. package/skills/cometchat-ios-calls/references/picture-in-picture.md +0 -246
  452. package/skills/cometchat-ios-calls/references/raise-hand.md +0 -26
  453. package/skills/cometchat-ios-calls/references/recording-screen-share.md +0 -252
  454. package/skills/cometchat-ios-calls/references/ringing-integration.md +0 -143
  455. package/skills/cometchat-ios-calls/references/server-apns-pushkit.md +0 -267
  456. package/skills/cometchat-ios-calls/references/share-invite.md +0 -148
  457. package/skills/cometchat-ios-calls/references/swiftui-uikit-hosting.md +0 -246
  458. package/skills/cometchat-ios-calls/references/voip-cert-setup.md +0 -166
  459. package/skills/cometchat-ios-theming/SKILL.md +0 -667
  460. package/skills/cometchat-native-bare-patterns/SKILL.md +0 -550
  461. package/skills/cometchat-native-calls/SKILL.md +0 -671
  462. package/skills/cometchat-native-calls/references/add-calls-to-existing-chat.md +0 -203
  463. package/skills/cometchat-native-calls/references/call-layouts.md +0 -125
  464. package/skills/cometchat-native-calls/references/call-session.md +0 -182
  465. package/skills/cometchat-native-calls/references/custom-ui.md +0 -254
  466. package/skills/cometchat-native-calls/references/device-management.md +0 -158
  467. package/skills/cometchat-native-calls/references/expo-vs-bare.md +0 -179
  468. package/skills/cometchat-native-calls/references/group-calls.md +0 -296
  469. package/skills/cometchat-native-calls/references/idle-timeout.md +0 -128
  470. package/skills/cometchat-native-calls/references/in-call-chat.md +0 -145
  471. package/skills/cometchat-native-calls/references/migration-v4-to-v5.md +0 -72
  472. package/skills/cometchat-native-calls/references/picture-in-picture.md +0 -276
  473. package/skills/cometchat-native-calls/references/raise-hand.md +0 -205
  474. package/skills/cometchat-native-calls/references/recording-screen-share.md +0 -169
  475. package/skills/cometchat-native-calls/references/ringing-integration.md +0 -118
  476. package/skills/cometchat-native-calls/references/server-push-bridge.md +0 -135
  477. package/skills/cometchat-native-calls/references/server-push-payloads.md +0 -193
  478. package/skills/cometchat-native-calls/references/share-invite.md +0 -146
  479. package/skills/cometchat-native-calls/references/voip-push-end-to-end.md +0 -319
  480. package/skills/cometchat-native-components/SKILL.md +0 -628
  481. package/skills/cometchat-native-core/SKILL.md +0 -679
  482. package/skills/cometchat-native-customization/SKILL.md +0 -716
  483. package/skills/cometchat-native-expo-patterns/SKILL.md +0 -552
  484. package/skills/cometchat-native-features/SKILL.md +0 -638
  485. package/skills/cometchat-native-placement/SKILL.md +0 -509
  486. package/skills/cometchat-native-production/SKILL.md +0 -700
  487. package/skills/cometchat-native-push/SKILL.md +0 -594
  488. package/skills/cometchat-native-testing/SKILL.md +0 -582
  489. package/skills/cometchat-native-theming/SKILL.md +0 -681
  490. package/skills/cometchat-native-troubleshooting/SKILL.md +0 -501
  491. package/skills/cometchat-nextjs-patterns/SKILL.md +0 -899
  492. package/skills/cometchat-placement/SKILL.md +0 -1360
  493. package/skills/cometchat-production/SKILL.md +0 -1027
  494. package/skills/cometchat-react-calls/SKILL.md +0 -752
  495. package/skills/cometchat-react-calls/references/add-calls-to-existing-chat.md +0 -146
  496. package/skills/cometchat-react-calls/references/call-layouts.md +0 -160
  497. package/skills/cometchat-react-calls/references/call-session.md +0 -235
  498. package/skills/cometchat-react-calls/references/custom-ui.md +0 -247
  499. package/skills/cometchat-react-calls/references/device-management.md +0 -210
  500. package/skills/cometchat-react-calls/references/group-calls.md +0 -257
  501. package/skills/cometchat-react-calls/references/idle-timeout.md +0 -188
  502. package/skills/cometchat-react-calls/references/in-call-chat.md +0 -212
  503. package/skills/cometchat-react-calls/references/migration-v4-to-v5.md +0 -170
  504. package/skills/cometchat-react-calls/references/picture-in-picture.md +0 -245
  505. package/skills/cometchat-react-calls/references/raise-hand.md +0 -238
  506. package/skills/cometchat-react-calls/references/recording-screen-share.md +0 -144
  507. package/skills/cometchat-react-calls/references/ringing-integration.md +0 -255
  508. package/skills/cometchat-react-calls/references/server-web-push-vapid.md +0 -241
  509. package/skills/cometchat-react-calls/references/share-invite.md +0 -175
  510. package/skills/cometchat-react-calls/references/testing-calls-on-web.md +0 -216
  511. package/skills/cometchat-react-calls/references/virtual-background.md +0 -32
  512. package/skills/cometchat-react-calls/references/voip-and-web-push.md +0 -165
  513. package/skills/cometchat-react-patterns/SKILL.md +0 -628
  514. package/skills/cometchat-react-push/SKILL.md +0 -634
  515. package/skills/cometchat-react-router-patterns/SKILL.md +0 -758
  516. package/skills/cometchat-react-testing/SKILL.md +0 -413
  517. package/skills/cometchat-theming/SKILL.md +0 -498
  518. package/skills/cometchat-troubleshooting/SKILL.md +0 -294
@@ -1,1048 +0,0 @@
1
- ---
2
- name: cometchat-core
3
- description: "Shared rules for CometChat React UI Kit v6. Always loaded alongside framework + placement skills. Read this first."
4
- license: "MIT"
5
- compatibility: "Node.js >=18; React >=18; @cometchat/chat-uikit-react ^6; @cometchat/chat-sdk-javascript ^4"
6
- metadata:
7
- author: "CometChat"
8
- version: "3.0.0"
9
- tags: "chat cometchat react core rules initialization patterns"
10
- ---
11
-
12
- > **Ground truth:** the installed `@cometchat/chat-uikit-react@^6` + `@cometchat/chat-sdk-javascript@^4` package types (`node_modules/@cometchat/chat-uikit-react`) + `docs/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 on agents without MCP). Verify any non-obvious symbol against the installed package types before relying on it.
13
-
14
- ## Purpose
15
-
16
- This is the foundational skill for every CometChat React UI Kit v6 integration. It teaches Claude HOW CometChat works -- initialization, login, CSS, environment variables, SSR safety, and the provider pattern -- so Claude can write project-appropriate code instead of relying on templates.
17
-
18
- **Read this skill first, before any framework or placement skill.**
19
-
20
- ## When to use
21
-
22
- - Any React-family integration: Vite + React, Next.js (App or Pages Router), React Router v6/v7, Astro with React islands.
23
- - BEFORE loading any framework-specific patterns skill (`cometchat-react-patterns`, `cometchat-nextjs-patterns`, etc.) — those layer on top of this.
24
- - When the user is asking about CometChat init, login, env vars, CSS, provider pattern, SSR safety, or production auth.
25
-
26
- ## When NOT to use
27
-
28
- - **React Native** (Expo or bare) — load `cometchat-native-core` instead. The wrappers, env-var prefixes, and lifecycle are different.
29
- - **Angular** — load `cometchat-angular-core`. Uses `APP_INITIALIZER` + `CUSTOM_ELEMENTS_SCHEMA` + `environment.ts`, not React's provider chain.
30
- - **Native Android (V5 or V6)** — load `cometchat-android-v5-core` or `cometchat-android-v6-core`. Kotlin init, `local.properties` credentials.
31
- - **Native iOS (V5)** — load `cometchat-ios-core`. Swift init, CocoaPods/SPM.
32
- - **Flutter (V5 or V6)** — load `cometchat-flutter-v5-core` or `cometchat-flutter-v6-core`. Dart init via `pubspec.yaml`.
33
- - **Backend-only token-mint server work** — load `cometchat-production` for the REST-API token recipes; this skill is client-side.
34
-
35
- ## Common Rationalizations — and why they're wrong
36
-
37
- A two-column anti-skip defense. Every excuse below has been used by agents (or could plausibly be) to skip rules in this skill. The rebuttal cites the validated incident.
38
-
39
- | Excuse the agent might invent | Reality |
40
- |---|---|
41
- | "StrictMode double-invocation is a dev-only quirk, so I can skip the in-flight login promise pattern (§2)" | The same race fires anywhere a parent component re-mounts (React Router v6 nested routes, Suspense boundary retries, error-boundary resets). Skipping yields the canonical `"Please wait until the previous login request ends"` error on production refreshes too. |
42
- | "This is a quick prototype, I'll hardcode `cometchat-uid-1` instead of asking the user" | Two testers shipped apps where the default UID was a Bot in their dashboard (ENG-35717). Auth-key login refuses bot users by design; the error `Auth token creation not allowed for this bot <uid>` is opaque. **Always ask via the dispatcher's Step 3d.1 prompt.** |
43
- | "I'll use `setError(String(e))` for now and pretty-print later" | `String(e)` on a CometChatException renders `[object Object]` — testers wasted 10-minute debugging sessions on this (ENG-35719). Always emit the §6 `formatCometChatError` helper from `cometchat/errors.ts`. "Later" never comes. |
44
- | "The env file looks right, I don't need to run `config show --json`" | Two testers shipped code with empty `VITE_COMETCHAT_APP_ID` because the dispatcher moved on without confirming (ENG-35718). The pre-flight is 1 second; the cost of skipping is a customer-facing init failure. |
45
- | "I know React, I can skip reading the framework-specific patterns skill" | The framework patterns carry version-pinned traps that aren't in training data: the Next.js 15+ rule `dynamic(ssr:false)` must live in a Client Component (verified by runtime smoke 2026-06-02), the Vite Visual Builder `tsconfig` patches (resolveJsonModule, jsx: react-jsx, verbatimModuleSyntax: false), the React Router v7 `appDirectory` constraint. Skipping = customer-visible build failure. |
46
- | "I'll add the telemetry hook later; the basic provider works without it" | The telemetry prop is opt-in by design (no-op if not passed) — but the four lifecycle events (init_started / init_finished / login_started / login_finished + their _failed variants) are how customers wire analytics into onboarding funnels without monkey-patching. Skipping ENG-35715 wiring means the customer has to refactor their provider post-launch. |
47
-
48
- ## Red flags — signs you're misapplying this skill
49
-
50
- - The agent emitted `setError(String(e))` anywhere in code — should be `setError(formatCometChatError(e))` per §6 (ENG-35719).
51
- - The agent's plan (Step 3f) doesn't include `cometchat/errors.ts` as a created file.
52
- - The agent emitted bare `CometChatUIKit.login(uid)` without the in-flight-promise guard (`ensureLoggedIn`) — guaranteed StrictMode race in dev.
53
- - A `<style>` or CSS rule targets internal class names like `.cometchat-conversation-list-item` (anti-pattern §8.3) instead of the `--cometchat-*` CSS variables.
54
- - The agent picked `cometchat-uid-1` without asking the user (ENG-35717 — the bot-flag failure mode).
55
- - The agent's env file uses the wrong framework prefix (e.g., `VITE_*` in a Next.js project, or `EXPO_PUBLIC_*` in a Vite project).
56
- - The provider doesn't gate `{children}` on `isReady` — chat components mount before init completes and throw `CometChat is not initialized` errors.
57
-
58
- ## Verification — before declaring this skill applied
59
-
60
- Run through this checklist before saying "done" for any task that touched cometchat-core territory:
61
-
62
- - [ ] `grep -nE "setError\(String\(" src/` returns ZERO matches (ENG-35719 — must use `formatCometChatError`).
63
- - [ ] `src/cometchat/errors.ts` exists and exports `formatCometChatError` + `logCometChatError`.
64
- - [ ] The provider has an `ensureLoggedIn`-style in-flight guard (no bare `CometChatUIKit.login` calls).
65
- - [ ] `tsc --noEmit` passes against the project's existing `tsconfig`.
66
- - [ ] Env vars use the **detected framework's prefix** (`VITE_*` / `NEXT_PUBLIC_*` / `PUBLIC_*` / `EXPO_PUBLIC_*`), and `.env` (or `.env.local` for Next.js) is in `.gitignore`.
67
- - [ ] CSS imports happen once at the entry / root (per framework section in §3).
68
- - [ ] If the user is on Next.js: the page that owns CometChat components has `"use client"` (App Router) or is dynamic-imported with `ssr: false` (App Router only inside another Client Component, per the Next.js 15+ rule verified 2026-06-02).
69
- - [ ] The user confirmed the dev-mode UID via the dispatcher's Step 3d.1 prompt — NOT silently picked.
70
-
71
- ---
72
-
73
- ## 1. Initialization
74
-
75
- CometChat must be initialized exactly once before any UI component renders. Initialization is asynchronous and must complete fully before mounting any `CometChat*` component.
76
-
77
- ### File-based init with `cometchat-settings.json` (recommended)
78
-
79
- > **Version requirement (ENG-35866 — Skills Telemetry).** `CometChatUIKit.initFromSettings(settings)` reads a `cometchat-settings.json` object and lets the SDK self-report `integrationSource = "ai-agent"` to `/user_sessions`. It ships GA in **`@cometchat/chat-uikit-react >= 6.5.2`** + **`@cometchat/chat-sdk-javascript >= 4.1.11`** (npm `latest`). On an older UI Kit the method does not exist — use the **`UIKitSettingsBuilder` fallback** below.
80
-
81
- **Step 1 — create `cometchat-settings.json` at the project root.** Fill `appId` / `region` / `credentials.authKey` from the CLI `provision setup` output; leave everything else at the defaults below. This is the single source of credentials — no second copy to keep in sync.
82
-
83
- ```json
84
- {
85
- "appId": "APP_ID_HERE",
86
- "region": "us",
87
- "credentials": {
88
- "authKey": "AUTH_KEY_HERE"
89
- },
90
- "chatSDK": {
91
- "presenceSubscription": {
92
- "type": "ALL_USERS",
93
- "roles": []
94
- },
95
- "autoEstablishSocketConnection": true,
96
- "adminHost": null,
97
- "clientHost": null
98
- },
99
- "callsSDK": {
100
- "host": null,
101
- "adminHost": null,
102
- "clientHost": null,
103
- "callsHost": null
104
- },
105
- "uiKit": {
106
- "subscribePresenceForAllUsers": true
107
- }
108
- }
109
- ```
110
-
111
- **Step 2 — init by importing the JSON as a build-time module.** Vite, CRA, Next.js, and Astro all have `resolveJsonModule` on by default, so the import is type-safe with no extra config:
112
-
113
- ```typescript
114
- // initFromSettings ships GA in @cometchat/chat-uikit-react >= 6.5.2 (ENG-35866)
115
- import { CometChatUIKit } from "@cometchat/chat-uikit-react";
116
- import cometchatSettings from "./cometchat-settings.json"; // adjust path to the file's location
117
-
118
- await CometChatUIKit.initFromSettings(cometchatSettings);
119
- ```
120
-
121
- - **Commit `cometchat-settings.json` — do not gitignore it** (the file is part of the integration). Its `authKey` is an **optional demo/POC credential**: a quick-start affordance so a PM or developer can see working chat *before* the backend auth-token flow is wired (that flow often waits on internal approvals). Because the file is committed to source control, treat the key as public — use a **dedicated demo CometChat app** (a committed key trips secret scanners and stays in git history; never reuse a production app's key). Switch to a server-minted `authToken` via `loginWithAuthToken` before production, where `authKey` must not ship.
122
- - The same module-flag / `useEffect` / entry-point placement rules in the rest of this section apply unchanged — just swap `CometChatUIKit.init(settings)` for `CometChatUIKit.initFromSettings(cometchatSettings)`.
123
-
124
- ### The UIKitSettingsBuilder (fallback — UI Kit before file-based init)
125
-
126
- ```typescript
127
- import { CometChatUIKit, UIKitSettingsBuilder } from "@cometchat/chat-uikit-react";
128
-
129
- const settings = new UIKitSettingsBuilder()
130
- .setAppId(APP_ID) // Required. String from the CometChat dashboard.
131
- .setRegion(REGION) // Required. "us", "eu", "in", etc.
132
- .setAuthKey(AUTH_KEY) // Required for dev mode. Omit in production (use auth tokens).
133
- .subscribePresenceForAllUsers() // Optional but recommended -- enables online/offline indicators.
134
- .build();
135
- ```
136
-
137
- ### Init must happen once
138
-
139
- Use a module-level flag to prevent double-init. This is critical because React StrictMode in development calls effects twice:
140
-
141
- ```typescript
142
- let initialized = false;
143
-
144
- async function initCometChat(): Promise<void> {
145
- if (initialized) return;
146
- initialized = true;
147
-
148
- // Fail loud if env vars didn't load. Empty credentials otherwise surface
149
- // much later as a cryptic `ERROR_API_KEY_NOT_FOUND` / failed init that's hard
150
- // to trace back to a missing/mis-prefixed .env. (audit P0-5)
151
- if (!APP_ID || !REGION || !AUTH_KEY) {
152
- throw new Error(
153
- "CometChat credentials are empty — check .env and the framework's env prefix " +
154
- "(VITE_ / NEXT_PUBLIC_ / PUBLIC_), and restart the dev server after editing .env.",
155
- );
156
- }
157
-
158
- const settings = new UIKitSettingsBuilder()
159
- .setAppId(APP_ID)
160
- .setRegion(REGION)
161
- .setAuthKey(AUTH_KEY)
162
- .subscribePresenceForAllUsers()
163
- .build();
164
-
165
- await CometChatUIKit.init(settings);
166
- }
167
- ```
168
-
169
- ### Init must be in useEffect (React components) or before mount (entry files)
170
-
171
- **In a useEffect (Next.js, Astro, React Router SSR):**
172
-
173
- ```typescript
174
- useEffect(() => {
175
- initCometChat()
176
- .then(() => loginUser())
177
- .then(() => setReady(true))
178
- .catch((e) => setError(String(e)));
179
- }, []);
180
- ```
181
-
182
- **At the entry point (Vite/CRA -- no SSR):**
183
-
184
- ```typescript
185
- // main.tsx -- runs once, before React mounts
186
- CometChatUIKit.init(settings)
187
- ?.then(() => CometChatUIKit.login("cometchat-uid-1"))
188
- .then(() => mount())
189
- .catch((e) => mountError(String(e)));
190
- ```
191
-
192
- The init-at-entry pattern works for Vite/CRA because `main.tsx` only runs in the browser. For frameworks with SSR (Next.js, Astro, React Router v7 SSR), you MUST use the useEffect pattern because the module runs on the server first.
193
-
194
- ---
195
-
196
- ## 2. Login
197
-
198
- ### Development mode
199
-
200
- Use `CometChatUIKit.login(uid)` with a test UID. Every new CometChat app comes with five pre-created test users: `cometchat-uid-1` through `cometchat-uid-5`.
201
-
202
- ```typescript
203
- const user = await CometChatUIKit.getLoggedinUser();
204
- if (!user) {
205
- await CometChatUIKit.login("cometchat-uid-1");
206
- }
207
- ```
208
-
209
- ### ⚠️ `login()` is safe to call sequentially, NOT concurrently
210
-
211
- A subtle but important distinction:
212
-
213
- - **Sequential** (first `login()` completes, then second is called): the SDK's second call returns immediately with the already-logged-in user. Safe.
214
- - **Concurrent** (a second `login()` fires while the first is still in-flight): the SDK throws `"Please wait until the previous login request ends."` The user sees a red error on the page, has to refresh, and only then does it work (because the first session is now cached).
215
-
216
- This is exactly the case that React 18 StrictMode triggers in development: effects run mount → unmount → mount, so a `useEffect` that calls `login()` fires twice with no time for the first call to finish. Production builds don't double-mount, but any code path that can call `login()` from two places simultaneously hits the same error.
217
-
218
- **Guard concurrent login with a module-level in-flight promise:**
219
-
220
- ```typescript
221
- let loginInFlight: Promise<unknown> | null = null;
222
-
223
- async function ensureLoggedIn(
224
- uid: string,
225
- authToken?: string,
226
- ): Promise<void> {
227
- const existing = await CometChatUIKit.getLoggedinUser();
228
- // Same user already logged in → nothing to do (sequential case).
229
- if (existing && existing.getUid?.() === uid) return;
230
- // A DIFFERENT user is logged in (account switch, or logout → login-as-other).
231
- // Log out first: otherwise the SDK keeps the old session and login() silently
232
- // no-ops, so the app shows the previous account. (Switching accounts requires
233
- // an explicit logout — login() is a no-op against an existing session.)
234
- if (existing) await CometChatUIKit.logout();
235
- if (loginInFlight) { // concurrent case — reuse pending promise
236
- await loginInFlight;
237
- return;
238
- }
239
- loginInFlight = authToken
240
- ? CometChatUIKit.loginWithAuthToken(authToken)
241
- : CometChatUIKit.login(uid);
242
- try {
243
- await loginInFlight;
244
- } finally {
245
- loginInFlight = null;
246
- }
247
- }
248
- ```
249
-
250
- Call `ensureLoggedIn()` from the provider / effect instead of `CometChatUIKit.login()` directly. Both StrictMode mounts resolve against the same promise, so only one login request actually hits the server.
251
-
252
- **Why not just a boolean flag?** A boolean would require extra wait-loop code to handle "login started but not finished yet." A cached promise handles that automatically — `await` on the same promise is free for all callers.
253
-
254
- ### Getting the current logged-in UID in app code
255
-
256
- When your integration code needs the current user's UID (for example, to decide which conversation to target, or to filter by sender), **always fetch it from the SDK — never hardcode a UID like `"cometchat-uid-1"`**.
257
-
258
- Two getters, for different contexts. **Default to the sync version** — it matches the v6 sample app and works for almost all app code, because by the time UI components render, the kit's init + login flow is already complete:
259
-
260
- ```typescript
261
- // ✓ Preferred — sync, returns User | null directly. Use this in app code.
262
- import { CometChatUIKitLoginListener } from "@cometchat/chat-uikit-react";
263
- const me = CometChatUIKitLoginListener.getLoggedInUser(); // note capital `I` in `InUser`
264
- const myUid = me?.getUid();
265
-
266
- // Fallback — async, for the bootstrap path where init may not be complete
267
- // (e.g., inside the provider's init effect, or before the first login resolves).
268
- const me = await CometChatUIKit.getLoggedinUser();
269
- const myUid = me?.getUid();
270
- ```
271
-
272
- The sync `CometChatUIKitLoginListener.getLoggedInUser()` is the right call from any component that mounts AFTER login completes — which is virtually all of them, since the dispatcher's recipes put login on a dedicated route or in the provider's init effect that gates rendering. Reach for the async `CometChatUIKit.getLoggedinUser()` only when you're inside that init effect itself.
273
-
274
- **Casing matters.** Note `getLogged**In**User` (capital `I`) on the LoginListener vs `getLogged**in**User` (lowercase `i`) on `CometChatUIKit` — both casings exist in the kit, they're different methods.
275
-
276
- Hardcoding `"cometchat-uid-1"` only works in the dev mode login call (`CometChatUIKit.login("cometchat-uid-1")`) because you're *choosing* who to log in as. Once logged in, the getters are the source of truth — useful when the logged-in user comes from production auth (a real user ID, not a test UID), or when the user logs out and logs in as someone else.
277
-
278
- ### Production mode
279
-
280
- Use `CometChatUIKit.loginWithAuthToken(token)` with a token obtained from your backend. The backend generates the token using the CometChat REST API with your `AUTH_TOKEN` (not the client-side `AUTH_KEY`).
281
-
282
- ```typescript
283
- // Fetch token from YOUR backend, which calls CometChat's REST API
284
- const response = await fetch("/api/cometchat-token", {
285
- method: "POST",
286
- headers: { "Content-Type": "application/json" },
287
- body: JSON.stringify({ uid: currentUser.id }),
288
- });
289
- const { token } = await response.json();
290
-
291
- await CometChatUIKit.loginWithAuthToken(token);
292
- ```
293
-
294
- For the full production auth setup, use `npx @cometchat/skills-cli production-auth`. Never hardcode auth keys in source code that ships to production.
295
-
296
- ### Logout
297
-
298
- ```typescript
299
- await CometChatUIKit.logout();
300
- ```
301
-
302
- Call this when the user signs out of your application. This clears CometChat's local session.
303
-
304
- ---
305
-
306
- ## 3. CSS
307
-
308
- ### Import once at the app root
309
-
310
- ```typescript
311
- import "@cometchat/chat-uikit-react/css-variables.css";
312
- ```
313
-
314
- This import MUST appear exactly once, at the highest level of your application:
315
-
316
- | Framework | Where to import |
317
- |---|---|
318
- | React (Vite) | `src/main.tsx` or `src/index.css` via `@import` |
319
- | Next.js (App Router) | `app/globals.css` via `@import` or `app/layout.tsx` |
320
- | Next.js (Pages Router) | `pages/_app.tsx` or `styles/globals.css` |
321
- | Astro | Global layout file or `src/styles/global.css` |
322
- | React Router | Root route module or `app/root.tsx` |
323
-
324
- ### Theming with CSS variables
325
-
326
- All CometChat components respect `--cometchat-*` CSS variables. Override them on a parent element or `:root`:
327
-
328
- ```css
329
- :root {
330
- --cometchat-primary-color: #6851d6;
331
- --cometchat-background-color-01: #ffffff;
332
- --cometchat-text-color-primary: #141414;
333
- --cometchat-font-family: "Inter", sans-serif;
334
- --cometchat-border-radius-lg: 12px;
335
- }
336
- ```
337
-
338
- ### Never target internal class names
339
-
340
- CometChat's internal class names (like `.cometchat-message-bubble__wrapper`) are not part of the public API and may change between versions. Always use CSS variables for customization. The only exception is when explicitly copying patterns from the v6 sample app that use documented BEM class names.
341
-
342
- ---
343
-
344
- ## 4. Environment variables
345
-
346
- Each framework has its own convention for exposing env vars to client-side code. CometChat needs three variables: `APP_ID`, `REGION`, and `AUTH_KEY`.
347
-
348
- ### Per-framework naming
349
-
350
- | Framework | Prefix | Example |
351
- |---|---|---|
352
- | React (Vite) | `VITE_` | `import.meta.env.VITE_COMETCHAT_APP_ID` |
353
- | Next.js | `NEXT_PUBLIC_` | `process.env.NEXT_PUBLIC_COMETCHAT_APP_ID` |
354
- | Astro | `PUBLIC_` | `import.meta.env.PUBLIC_COMETCHAT_APP_ID` |
355
- | React Router (Vite) | `VITE_` | `import.meta.env.VITE_COMETCHAT_APP_ID` |
356
- | CRA | `REACT_APP_` | `process.env.REACT_APP_COMETCHAT_APP_ID` |
357
-
358
- ### The three variables
359
-
360
- | Variable suffix | Required | Description |
361
- |---|---|---|
362
- | `COMETCHAT_APP_ID` | Yes | Your app ID from the CometChat dashboard |
363
- | `COMETCHAT_REGION` | Yes | Region code: `"us"`, `"eu"`, `"in"`, etc. |
364
- | `COMETCHAT_AUTH_KEY` | Dev only | Client-side auth key. Replace with auth tokens for production. |
365
-
366
- ### .env file placement
367
-
368
- | Framework | File | Gitignored by default |
369
- |---|---|---|
370
- | Vite / React Router | `.env` | No -- add to `.gitignore` |
371
- | Next.js | `.env.local` | Yes |
372
- | Astro | `.env` | No -- add to `.gitignore` |
373
- | CRA | `.env` | No -- add to `.gitignore` |
374
-
375
- ---
376
-
377
- ## 5. SSR safety
378
-
379
- All CometChat UI Kit components are browser-only. They access `window`, `document`, and browser APIs during import. Rendering them on the server will crash.
380
-
381
- ### Framework-specific SSR prevention
382
-
383
- **Next.js (App Router):**
384
-
385
- Mark the file containing CometChat components with `"use client"` at the top. Use `next/dynamic` with `ssr: false` if the component is imported from a server component:
386
-
387
- ```typescript
388
- "use client";
389
- // This entire file only runs in the browser
390
-
391
- import { CometChatConversations } from "@cometchat/chat-uikit-react";
392
- ```
393
-
394
- Or from a server component:
395
-
396
- ```typescript
397
- import dynamic from "next/dynamic";
398
-
399
- const ChatView = dynamic(() => import("./ChatView"), { ssr: false });
400
- ```
401
-
402
- **Next.js (Pages Router):**
403
-
404
- Use `next/dynamic` with `ssr: false`:
405
-
406
- ```typescript
407
- import dynamic from "next/dynamic";
408
-
409
- const CometChatNoSSR = dynamic(() => import("../components/CometChatNoSSR"), {
410
- ssr: false,
411
- });
412
- ```
413
-
414
- **Astro:**
415
-
416
- Use the `client:only="react"` directive. This prevents the component from rendering during Astro's static build:
417
-
418
- ```astro
419
- ---
420
- import ChatPanel from "../components/ChatPanel";
421
- ---
422
- <ChatPanel client:only="react" />
423
- ```
424
-
425
- **React Router v7 (SSR mode):**
426
-
427
- Use `React.lazy()` with `Suspense` in a `clientLoader` or `useEffect` guard:
428
-
429
- ```typescript
430
- import { lazy, Suspense } from "react";
431
-
432
- const ChatView = lazy(() => import("./ChatView"));
433
-
434
- export default function ChatRoute() {
435
- const [mounted, setMounted] = useState(false);
436
- useEffect(() => setMounted(true), []);
437
-
438
- if (!mounted) return null;
439
- return (
440
- <Suspense fallback={<div>Loading chat...</div>}>
441
- <ChatView />
442
- </Suspense>
443
- );
444
- }
445
- ```
446
-
447
- **React (Vite / CRA):**
448
-
449
- No SSR concerns. These are client-only by nature. Import and use directly.
450
-
451
- ---
452
-
453
- ## 6. Provider pattern
454
-
455
- Instead of inlining init/login logic in every component, create a reusable `CometChatProvider` that handles initialization, login, and ready-state gating. Wrap your chat UI with it.
456
-
457
- ```typescript
458
- // CometChatProvider.tsx
459
- "use client"; // Required for Next.js App Router; harmless in other frameworks
460
-
461
- import React, { useEffect, useState, createContext, useContext } from "react";
462
- import { CometChatUIKit, UIKitSettingsBuilder } from "@cometchat/chat-uikit-react";
463
-
464
- interface CometChatContextValue {
465
- isReady: boolean;
466
- error: string | null;
467
- }
468
-
469
- const CometChatContext = createContext<CometChatContextValue>({
470
- isReady: false,
471
- error: null,
472
- });
473
-
474
- export const useCometChat = () => useContext(CometChatContext);
475
-
476
- // Module-level state: shared across all mounts so React 18 StrictMode's
477
- // double-invocation of effects doesn't fire init or login twice.
478
- let initialized = false;
479
- let loginInFlight: Promise<unknown> | null = null;
480
-
481
- async function ensureLoggedIn(
482
- uid: string,
483
- authToken?: string,
484
- ): Promise<void> {
485
- const existing = await CometChatUIKit.getLoggedinUser();
486
- if (existing) return;
487
- if (loginInFlight) {
488
- // A prior StrictMode mount (or another effect) already started login —
489
- // reuse its promise instead of calling login() a second time, which
490
- // throws "Please wait until the previous login request ends."
491
- await loginInFlight;
492
- return;
493
- }
494
- loginInFlight = authToken
495
- ? CometChatUIKit.loginWithAuthToken(authToken)
496
- : CometChatUIKit.login(uid);
497
- try {
498
- await loginInFlight;
499
- } finally {
500
- loginInFlight = null;
501
- }
502
- }
503
-
504
- // ENG-35715 telemetry hook — opt-in callback for init/login lifecycle.
505
- // Fires at six phases. If `telemetry` prop is not passed, all calls are no-ops.
506
- export type CometChatTelemetryEvent =
507
- | { phase: "init_started"; appId: string; region: string }
508
- | { phase: "init_finished"; durationMs: number }
509
- | { phase: "init_failed"; error: unknown }
510
- | { phase: "login_started"; uid: string; mode: "authKey" | "authToken" }
511
- | { phase: "login_finished"; durationMs: number }
512
- | { phase: "login_failed"; error: unknown };
513
-
514
- interface CometChatProviderProps {
515
- appId: string;
516
- region: string;
517
- authKey?: string;
518
- authToken?: string;
519
- uid?: string;
520
- telemetry?: (event: CometChatTelemetryEvent) => void; // ← opt-in lifecycle hook
521
- children: React.ReactNode;
522
- }
523
-
524
- export function CometChatProvider({
525
- appId,
526
- region,
527
- authKey,
528
- authToken,
529
- uid = "cometchat-uid-1",
530
- telemetry,
531
- children,
532
- }: CometChatProviderProps) {
533
- const [isReady, setIsReady] = useState(false);
534
- const [error, setError] = useState<string | null>(null);
535
-
536
- useEffect(() => {
537
- async function setup() {
538
- const initStart = performance.now();
539
- try {
540
- if (!initialized) {
541
- initialized = true;
542
- telemetry?.({ phase: "init_started", appId, region });
543
- const builder = new UIKitSettingsBuilder()
544
- .setAppId(appId)
545
- .setRegion(region)
546
- .subscribePresenceForAllUsers();
547
-
548
- if (authKey) {
549
- builder.setAuthKey(authKey);
550
- }
551
-
552
- const settings = builder.build();
553
- await CometChatUIKit.init(settings);
554
- telemetry?.({ phase: "init_finished", durationMs: performance.now() - initStart });
555
- }
556
-
557
- const loginStart = performance.now();
558
- telemetry?.({ phase: "login_started", uid, mode: authToken ? "authToken" : "authKey" });
559
- await ensureLoggedIn(uid, authToken);
560
- telemetry?.({ phase: "login_finished", durationMs: performance.now() - loginStart });
561
-
562
- setIsReady(true);
563
- } catch (e) {
564
- // If init never completed, this is an init_failed; otherwise login_failed.
565
- const phase = isReady ? "login_failed" : "init_failed";
566
- telemetry?.({ phase, error: e } as CometChatTelemetryEvent);
567
- setError(formatCometChatError(e));
568
- }
569
- }
570
-
571
- setup();
572
- }, [appId, region, authKey, authToken, uid, telemetry]);
573
-
574
- if (error) {
575
- return (
576
- <div style={{ color: "red", padding: 16, fontFamily: "monospace" }}>
577
- CometChat Error: {error}
578
- </div>
579
- );
580
- }
581
-
582
- if (!isReady) {
583
- return null; // Or a loading spinner
584
- }
585
-
586
- return (
587
- <CometChatContext.Provider value={{ isReady, error }}>
588
- {children}
589
- </CometChatContext.Provider>
590
- );
591
- }
592
- ```
593
-
594
- ### Usage
595
-
596
- ```typescript
597
- // In your app layout or route wrapper:
598
- <CometChatProvider
599
- appId={import.meta.env.VITE_COMETCHAT_APP_ID}
600
- region={import.meta.env.VITE_COMETCHAT_REGION}
601
- authKey={import.meta.env.VITE_COMETCHAT_AUTH_KEY}
602
- // Optional — wire your analytics on each lifecycle event (ENG-35715):
603
- telemetry={(event) => {
604
- if (event.phase === "init_finished" || event.phase === "login_finished") {
605
- analytics.track(`cometchat.${event.phase}`, { ms: event.durationMs });
606
- } else if (event.phase === "init_failed" || event.phase === "login_failed") {
607
- analytics.trackError(`cometchat.${event.phase}`, { error: String(event.error) });
608
- } else {
609
- analytics.track(`cometchat.${event.phase}`, event);
610
- }
611
- }}
612
- >
613
- <ChatPage />
614
- </CometChatProvider>
615
- ```
616
-
617
- The provider pattern keeps init/login logic in one place. Chat components inside `<CometChatProvider>` are guaranteed to render only after init and login succeed.
618
-
619
- ### Pretty-print errors — DO NOT `String(error)` (ENG-35719)
620
-
621
- `CometChat.CometChatException` objects look like `{ code: "ERROR_API_KEY_NOT_FOUND", message: "Auth Key cannot be empty", details: ..., source: ... }` (in some kit versions the fields are `errorCode` / `errorDescription`). Calling `String(e)` on them yields `"[object Object]"` — the integrator then has to open devtools, copy the error to the console, and `JSON.stringify` it by hand just to read the message. Testers consistently flag this as the most frustrating moment of the first-run integration.
622
-
623
- **Emit this helper in `cometchat/errors.ts` and reuse it from the provider, login screen, and any feature module that catches a kit error:**
624
-
625
- ```typescript
626
- // cometchat/errors.ts
627
- export function formatCometChatError(e: unknown): string {
628
- if (e == null) return "Unknown CometChat error.";
629
- const err = e as Record<string, unknown>;
630
- const code =
631
- (err.code as string | undefined) ??
632
- (err.errorCode as string | undefined);
633
- const message =
634
- (err.message as string | undefined) ??
635
- (err.errorDescription as string | undefined);
636
- if (code && message) return `[CometChat ${code}] ${message}`;
637
- if (message) return `[CometChat] ${message}`;
638
- try {
639
- return `[CometChat] ${JSON.stringify(e)}`;
640
- } catch {
641
- return `[CometChat] ${String(e)}`;
642
- }
643
- }
644
-
645
- const KNOWN_DOC_HINTS: Record<string, string> = {
646
- ERROR_API_KEY_NOT_FOUND:
647
- "Auth Key is missing or invalid. Check your env vars (VITE_COMETCHAT_AUTH_KEY / EXPO_PUBLIC_COMETCHAT_AUTH_KEY) and confirm the key in Dashboard → App → Credentials.",
648
- ERR_UID_NOT_FOUND:
649
- "The UID you're logging in with doesn't exist in this CometChat app. Create the user in Dashboard → Users, or pick one of the pre-seeded test UIDs (cometchat-uid-1 .. cometchat-uid-5).",
650
- ERR_AUTH_TOKEN_NOT_FOUND:
651
- "Auth token is empty or expired. Re-mint it from your backend via the CometChat REST API.",
652
- AUTH_ERR_BOT:
653
- "This UID is flagged as a Bot in the dashboard — auth-key login is refused for bot users by design. Toggle Bot OFF in Dashboard → Users, or pick a non-bot UID.",
654
- };
655
-
656
- export function logCometChatError(e: unknown): void {
657
- const formatted = formatCometChatError(e);
658
- console.error(formatted, e);
659
- const code = (e as { code?: string; errorCode?: string })?.code ??
660
- (e as { code?: string; errorCode?: string })?.errorCode;
661
- if (code && KNOWN_DOC_HINTS[code]) {
662
- console.warn(`[CometChat hint] ${KNOWN_DOC_HINTS[code]}`);
663
- }
664
- }
665
- ```
666
-
667
- Then in the provider:
668
-
669
- ```typescript
670
- } catch (e) {
671
- logCometChatError(e);
672
- setError(formatCometChatError(e));
673
- }
674
- ```
675
-
676
- And in the error renderer:
677
-
678
- ```tsx
679
- if (error) {
680
- return (
681
- <div role="alert" style={{ color: "#b91c1c", padding: 16, fontFamily: "ui-monospace, monospace", whiteSpace: "pre-wrap" }}>
682
- <strong>CometChat failed to initialize.</strong>
683
- <div style={{ marginTop: 8 }}>{error}</div>
684
- <div style={{ marginTop: 8, fontSize: 12, opacity: 0.7 }}>
685
- See the browser console for the full error object and any [CometChat hint] line above it.
686
- </div>
687
- </div>
688
- );
689
- }
690
- ```
691
-
692
- This three-part recipe — `formatCometChatError` for the visible message, `logCometChatError` for the console (with a docs hint for known codes), and a multi-line render that points at the console — turns "ERR_API_KEY_NOT_FOUND" from a 10-minute debugging session into a 10-second fix.
693
-
694
- > ⚠️ **Replace `setError(String(e))` everywhere.** The two earlier examples in this skill (§1 init-in-useEffect, §6 provider's setup() catch) use `setError(String(e))` for compactness — when you scaffold the real integration, emit `formatCometChatError(e)` instead and import it from `cometchat/errors.ts`. The same applies to RN (`cometchat-native-core`), Angular (`cometchat-angular-core`), and the native cores — the helper is platform-agnostic, just adapt the file extension.
695
-
696
- ---
697
-
698
- ## 7. RTL, i18n, and accessibility
699
-
700
- These three concerns share one property: the UI Kit handles them out of the box, but a careless customization can break them. Read this before writing custom views, composer actions, or header replacements.
701
-
702
- ### RTL (right-to-left)
703
-
704
- The UI Kit reads `dir="rtl"` from the document root. If the project already sets `<html dir="rtl">` (or toggles it dynamically for Arabic/Hebrew locales), **CometChat components flip automatically** — message bubbles mirror, avatars swap sides, icons rotate where appropriate. No CometChat-specific config needed.
705
-
706
- **To test:** add `<html dir="rtl">` to `index.html` (or set it via JS in Next.js App Router: `<html dir="rtl">` in `app/layout.tsx`). Reload — the conversation list avatar + text should render on the right, message bubbles mirror, the composer input aligns right.
707
-
708
- **When customizing:** if you replace a default view (e.g. a custom message bubble), test it in both LTR and RTL. The UI Kit's components use logical properties (`margin-inline-start`, `padding-inline-end`) — your custom components should too, or they'll break RTL.
709
-
710
- ### i18n (translations)
711
-
712
- The UI Kit has a built-in `CometChatLocalize` utility that covers ~40 languages out of the box. Initialize it once, alongside `CometChatUIKit.init()`:
713
-
714
- ```typescript
715
- import { CometChatLocalize } from "@cometchat/chat-uikit-react";
716
-
717
- CometChatLocalize.init({
718
- language: "es", // or "fr", "de", "ar", "hi", etc.
719
- });
720
- ```
721
-
722
- For a dynamic language switcher, call `CometChatLocalize.setCurrentLanguage(newLang)` when the user picks a language (NOT `setLocale` — that method doesn't exist in v6). The UI Kit re-renders with the new strings.
723
-
724
- **To override a string:** there's no nested `resources: { en: {...} }` option. Use either `translationsForLanguage` at init (a FLAT key→value map for the chosen `language`), or the standalone `CometChatLocalize.addTranslation({...})`:
725
-
726
- ```typescript
727
- // (a) at init — flat map for the active language
728
- CometChatLocalize.init({
729
- language: "en",
730
- translationsForLanguage: {
731
- "type a message": "Write your message…",
732
- "start a conversation": "Say hi 👋",
733
- },
734
- });
735
-
736
- // (b) anytime after init
737
- CometChatLocalize.addTranslation({
738
- "type a message": "Write your message…",
739
- });
740
- ```
741
-
742
- **Full translation key list** lives under `node_modules/@cometchat/chat-uikit-react/dist/types/resources/` (types) or the docs MCP. Don't invent keys — unknown keys fall through to the default.
743
-
744
- ### Accessibility
745
-
746
- Default components ship with:
747
- - `aria-label` on icon-only buttons (send, attach, call, etc.)
748
- - `role="listbox"` + `role="option"` on conversation / user / group lists
749
- - Keyboard navigation: `Tab` to focus, `Enter` to activate, `Esc` to close modals
750
- - Focus management: opening a thread view moves focus to the thread header; closing returns focus to the trigger
751
-
752
- **Rules when customizing:**
753
-
754
- 1. **Replacing an icon-only button?** Add `aria-label="<verb>"` (e.g. `aria-label="Send message"`).
755
- 2. **Replacing a list item?** Keep `role="option"` + `aria-selected` on the wrapping element.
756
- 3. **Replacing the composer?** Preserve the `<textarea>` with an accessible `<label>` (visible or `aria-label`), and keep `Enter`/`Shift+Enter` behavior.
757
- 4. **Replacing a modal?** Trap focus inside the modal while open, restore focus to the trigger on close, and add `role="dialog"` + `aria-modal="true"` + a labelled heading.
758
- 5. **Color contrast:** when theming with custom colors, verify text contrast ≥ 4.5:1 against background. A low-saturation primary color on a white background breaks AA contrast.
759
-
760
- For deep customization (e.g. a fully custom message bubble), the a11y responsibility shifts to the custom component — the UI Kit only guarantees it for its own defaults. Test with a screen reader (VoiceOver on macOS, NVDA on Windows) and keyboard-only navigation before shipping.
761
-
762
- ---
763
-
764
- ## 8. Anti-patterns
765
-
766
- These are specific things NOT to do. Each one causes real bugs that are hard to debug.
767
-
768
- 1. **Do NOT call `CometChatUIKit.init()` during render.** Init is async and has side effects. Calling it during render causes infinite re-render loops. Always call in `useEffect` or before `createRoot`.
769
-
770
- 2. **Do NOT import `css-variables.css` in multiple files.** Duplicate imports cause CSS specificity conflicts and doubled variable declarations. Import it exactly once at the app root.
771
-
772
- 3. **Do NOT render CometChat components before init completes.** Components assume the SDK is initialized. Rendering before init finishes causes "CometChat is not initialized" runtime errors. Use the provider pattern or a ready-state gate.
773
-
774
- 4. **Do NOT hardcode `AUTH_KEY` in source files.** The auth key is a secret. Use environment variables during development. Use auth tokens in production.
775
-
776
- 5. **Guard concurrent `login()` calls with a module-level in-flight promise.** `login()` is only safe to call sequentially. Two `login()` calls overlapping (e.g. React 18 StrictMode's double effect) throw *"Please wait until the previous login request ends."* Cache the first login's promise at module scope and `await` that from subsequent callers. See the `ensureLoggedIn` helper in section 2 and section 6's provider pattern.
777
-
778
- 6. **Do NOT render CometChat components in a server-side context.** All components require browser APIs. In Next.js, always use `"use client"`. In Astro, always use `client:only="react"`.
779
-
780
- 7. **Do NOT target CometChat's internal CSS class names for styling.** These are not part of the public API. Use `--cometchat-*` CSS variables instead. Internal classes change between minor versions.
781
-
782
- 8. **Do NOT create CometChat components without a container that has explicit dimensions.** CometChat components fill 100% of their container. If the container has no height, the components collapse to zero height. Always set `height`, `min-height`, or use flexbox/grid to give the container dimensions.
783
-
784
- 9. **Do NOT re-initialize CometChat when navigating between routes.** Init should happen once at the app level (in the provider or entry file), not per-route. Re-initializing causes flickering and dropped WebSocket connections.
785
-
786
- 10. **Do NOT invent component names.** CometChat exports specific components with specific names. Check the `cometchat-components` skill before writing any `<CometChat*>` JSX. Using a wrong name (e.g., `<CometChatChat>`, `<CometChatMessenger>`) causes a build error.
787
-
788
- 11. **Do NOT wrap CometChat components in a `transform`ed container.** Per the CSS spec, any non-`none` `transform` on an element creates a new containing block for `position: fixed` descendants. CometChat UI Kit renders several overlays as `position: fixed` (message options menu, emoji picker, file preview, reactions popover, thread panel) and expects them to anchor to the viewport. Wrapping the chat in a container that uses `transform: translateX(...)` — a common pattern for slide-in drawers / sidebars — reparents those overlays to the drawer, causing them to appear clipped, offset, or drift mid-animation.
789
-
790
- **This includes Tailwind's `translate-x-*` utilities — `translate-x-full`, `-translate-x-full`, `translate-x-0`, `translate-x-[420px]`, etc. all compile to `transform: translateX(...)` and trigger the same bug.** Same for `-translate-y-*`, `translate-*`, `scale-*`, `rotate-*`, `skew-*`, `transform-*`, and any `transition-transform` utility applied to a container wrapping CometChat components. If you see yourself reaching for any Tailwind class in the `transform:` family on a drawer/sidebar/modal that contains chat UI, stop.
791
-
792
- **Animate the `right` / `left` offset instead**, or use `margin-right: isOpen ? 0 : -<width>`. In Tailwind: toggle between `right-0` and a negative `right-[-420px]` with `transition-[right]` instead of `transition-transform`.
793
-
794
- Same rule applies to `filter`, `perspective`, `backdrop-filter`, and `will-change: transform` — any of those also trigger the containing-block takeover. See `cometchat-placement`'s drawer and widget patterns for the correct right-offset animation.
795
-
796
- ---
797
-
798
- ## 9. Docs MCP (recommended, not required)
799
-
800
- The CometChat docs MCP provides runtime access to the latest documentation, including prop types, callback signatures, request builder methods, SDK events, CSS variable names, and error decoders.
801
-
802
- ### Installation
803
-
804
- ```bash
805
- claude mcp add --transport http cometchat-docs https://www.cometchat.com/docs/mcp
806
- ```
807
-
808
- For other clients, see: https://www.cometchat.com/docs/mcp-server
809
-
810
- ### When to use
811
-
812
- - Looking up a prop's exact type or default value
813
- - Finding callback signatures (e.g., what `onItemClick` passes)
814
- - Checking request builder methods (e.g., `ConversationsRequestBuilder.setLimit`)
815
- - Understanding SDK events (e.g., `CometChatMessageEvents.ccMessageSent`)
816
- - Verifying CSS variable names before writing overrides
817
- - Decoding error messages (e.g., "INVALID_AUTH_KEY")
818
-
819
- ### When NOT to use
820
-
821
- - For component names and basic props -- use the `cometchat-components` skill instead (it works offline)
822
- - For init/login/CSS patterns -- they are in this skill
823
- - For placement patterns -- they are in the `cometchat-placement` skill
824
- - For anything the CLI handles -- the CLI templates are the source of truth for those paths
825
-
826
- ### Fallback when not installed
827
-
828
- If the docs MCP is not installed and you need information beyond what the component and core skills contain, check the installed TypeScript definitions:
829
-
830
- ```bash
831
- grep -A 80 "interface CometChat<ComponentName>Props" \
832
- node_modules/@cometchat/chat-uikit-react/dist/index.d.ts \
833
- 2>/dev/null | head -80
834
- ```
835
-
836
- This is faster and more accurate than guessing from training data. Never invent SDK signatures from memory.
837
-
838
- ---
839
-
840
- ## 10. Package dependencies
841
-
842
- Every CometChat React integration requires these two packages:
843
-
844
- ```json
845
- {
846
- "@cometchat/chat-uikit-react": "^6",
847
- "@cometchat/chat-sdk-javascript": "^4"
848
- }
849
- ```
850
-
851
- The UI Kit (`@cometchat/chat-uikit-react`) provides all the React components. The SDK (`@cometchat/chat-sdk-javascript`) provides the `CometChat` namespace with types (`CometChat.User`, `CometChat.Group`, `CometChat.Conversation`, `CometChat.BaseMessage`) and methods.
852
-
853
- Install with your project's package manager:
854
-
855
- ```bash
856
- npm install @cometchat/chat-uikit-react@^6 @cometchat/chat-sdk-javascript@^4
857
- ```
858
-
859
- > ⚠️ **Keep the `@^6` / `@^4` major pins — never run a bare `npm install @cometchat/chat-uikit-react`.** v7 of the React UI Kit is published on npm; a bare (unpinned) install resolves to whatever is tagged `latest`, so once v7 promotes to `latest` it will pull v7 — and these skills teach the **v6** API, so the integration breaks. The `@^6` pin keeps you on the latest v6 (currently 6.5.2) regardless. Bump to `@^7` only when you've moved to the v7 skills.
860
-
861
- > 💡 **Cost transparency (ENG-35722) — disclose proactively when integrating into a new project:** the kit adds roughly **2.8 MB of JS** (~860 KB gzipped), **~860 KB of CSS**, and **~1.5 MB of Roboto TTF fonts** (9 weights bundled). If the customer's app already loads custom fonts, the Roboto bundle is redundant; override via the `--cometchat-font-family` CSS variable to skip preloading the kit fonts (the TTFs still ship but the browser doesn't download them unless they're actually used). For SaaS founders evaluating CometChat vs self-build, also mention:
862
- > - **Pricing:** https://www.cometchat.com/pricing (free tier covers small dev/test use)
863
- > - **Data extraction / migration:** REST API endpoints `GET /v3/users`, `GET /v3/groups`, `GET /v3/messages?conversationId=` can export everything; no proprietary lock-in
864
- > - **Demo without account:** for `intent: "evaluating"` users, point at the hosted demo at https://app.cometchat.com/login (sign-up gives a free app immediately; ENG-35722 demo-without-account hosted-demo is a vendor follow-up)
865
-
866
- ### SDK types you will use
867
-
868
- ```typescript
869
- import { CometChat } from "@cometchat/chat-sdk-javascript";
870
-
871
- // Common types:
872
- CometChat.User // A chat user
873
- CometChat.Group // A chat group
874
- CometChat.Conversation // A conversation (wraps User or Group)
875
- CometChat.BaseMessage // A message (text, media, custom, etc.)
876
- CometChat.TextMessage // A text message specifically
877
-
878
- // Common static methods:
879
- CometChat.getUser(uid: string): Promise<CometChat.User>
880
- CometChat.getGroup(guid: string): Promise<CometChat.Group>
881
- ```
882
-
883
- ## 11. Visual Builder integration
884
-
885
- When the dispatcher's Step 3.1 sets `customize=visual`, skills runs **`cometchat builder export --platform react`** — a single CLI command that mirrors the dashboard's Export-button workflow. It downloads the canonical static template ZIP from `preview.cometchat.com/downloads/cometchat-builder-react.zip`, fetches the per-builder settings JSON via `GET /vcb/builders/{id}`, unzips the template, **splices** the fetched JSON (+ missing-field defaults) into `CometChatSettings.ts`, and writes the result to `--output` (default: `src/CometChat/`).
886
-
887
- **How `CometChatSettings.ts` is patched (splice, not full-file overwrite):** the canonical file declares both `export interface CometChatSettingsInterface { ... }` and `export const CometChatSettings: CometChatSettingsInterface = { ... }`. The CLI rewrites **only the `export const CometChatSettings = {...}` object literal** with the per-builder JSON, **preserving the `export interface CometChatSettingsInterface`** above it (the const is typed against that interface — destroying it breaks the build). The sentinel comment (`SKILLS-AUTO-GENERATED — do not edit by hand. Last sync: <ISO>`) is **prepended to the spliced file**. Do not describe this as a full-file replace.
888
-
889
- The `src/CometChat/` directory contains `CometChatApp.tsx`, the repo's own `CometChatProvider`-style context, `CometChatHome` with tabs (Chats / Calls / Users / Groups), theme hooks (`useThemeStyles`, `useSystemColorScheme`), login listener wiring, and 13 supporting components. Skills does NOT hand-roll these — the copied directory is the integration. Two valid render entry points exist: the canonical CRA app's own `src/App.tsx` composes `CometChatHome` + `CometChatLogin` directly (gated on a login listener), while the Next.js entry renders the higher-level `<CometChatApp />` wrapper. Both are fine — `<CometChatApp />` is the simplest, but don't assume it's the only canonical shape.
890
-
891
- This is the same pattern iOS (verbatim `MessagesVC.swift`), Android v6 (verbatim `BuilderSettingsHelper.kt`), and Flutter v6 (verbatim `chat_builder/` package) use. React just happens to copy a directory of TSX files instead of a single class.
892
-
893
- ### 11.1 Run `cometchat builder export`
894
-
895
- After Step 3.1.v step 4 (customer says "Done" + skills caches the builderId in `.cometchat/builder.json`), run:
896
-
897
- ```bash
898
- cometchat builder export --platform react --json
899
- ```
900
-
901
- This produces the full per-builder integration in one shot:
902
-
903
- | What | Where |
904
- |---|---|
905
- | Downloads static template ZIP | `https://preview.cometchat.com/downloads/cometchat-builder-react.zip` |
906
- | Fetches per-builder settings | `GET /vcb/builders/{builderId}` via the same `Bearer` token used elsewhere |
907
- | Applies F3 + F10 missing-field defaults | `chatFeatures.inAppSounds` + `chatFeatures.deeperUserEngagement.mentionAll` |
908
- | Unzips template into temp dir | `/tmp/cometchat-builder-export-XXXX/extracted/` |
909
- | Splices `CometChatSettings.ts` | Rewrites only the `export const CometChatSettings = {...}` literal with the per-builder JSON; preserves `export interface CometChatSettingsInterface`; prepends the sentinel comment ("SKILLS-AUTO-GENERATED — do not edit by hand. Last sync: <ISO>") |
910
- | Copies to `--output` | Default `src/CometChat/` |
911
- | Reports JSON | `{ status: "exported", builderId, appId, platform, output, settings_file, builder_name }` |
912
-
913
- **For Next.js App Router**, pass `--output src/app/CometChat`. For React Router v7 framework mode, pass `--output app/CometChat`. The CLI's F25 case-collision pre-check warns if a lowercase `src/cometchat/` exists with In-code-shape files (init.ts / CometChatProvider.tsx).
914
-
915
- **For resync** (Step 7 iteration menu → Re-sync visual builder), re-run the SAME command with `--force`. This re-downloads the latest canonical template + re-fetches the latest settings + replaces the `--output` directory entirely. Customer hand-edits inside the `CometChat/` directory are lost — matches the "SKILLS-AUTO-GENERATED" contract on the sentinel.
916
-
917
- ### 11.2 Files patched (after export)
918
-
919
- The `builder export` command writes the canonical files. Skills then patches the customer's existing project to wire it in:
920
-
921
- | Path | Patch |
922
- |---|---|
923
- | `package.json` | (1) `npm install @cometchat/chat-uikit-react@6.4.3 @cometchat/calls-sdk-javascript@4.2.5` — **pinned versions from the canonical repo's README**. Older/newer versions of `chat-uikit-react` may drift from the exported `src/CometChat/` directory's expected API surface. (2) **REQUIRED for Vite — add the `cometChatCustomConfig` block to `package.json`.** The canonical `package.json` carries a top-level `cometChatCustomConfig` block, and the copied context (`CometChat/context/CometChatContext.tsx:~216`) reads `pkg?.default?.cometChatCustomConfig.name`. ⚠ This **IS build-breaking on Vite**: the Builder tsconfig requires `resolveJsonModule: true` (next row), so `tsc -b` (the project-references build `npm run build` runs) **statically types `package.json`** → `TS2339: Property 'cometChatCustomConfig' does not exist` when absent. (`tsc --noEmit` passes and HIDES this — use `tsc -b`/`npm run build` for the build proof. Verified 2026-06-14 on a real export build.) Add: `"cometChatCustomConfig": { "name": "<your-app-name>", "version": "<your-app-version>", "production": true }`. |
924
- | Entry file — `src/main.tsx` (Vite) / `src/index.tsx` (CRA) / new client component (Next.js) / route file (React Router) / `.astro` page (Astro) | Init UI Kit + render `<CometChatProvider><App /></CometChatProvider>`. Pattern below — varies by framework. |
925
- | `tsconfig.app.json` (Vite 7+) or `tsconfig.json` (CRA / older Vite) | **Imports resolve on Vite as-is** — the current `builder export` writes `src/CometChat/` with **relative imports** (`../utils/utils`, `../context/CometChatContext`), NOT the bare `CometChat/…`-rooted imports older CRA exports used. So you do **NOT** need `vite-tsconfig-paths` / `baseUrl` (verified 2026-06-14: zero `from "CometChat/…"` in a fresh export; resolves on Vite out of the box). *(Historical: pre-2026 CRA exports used `baseUrl:"./src"` bare imports that needed `vite-tsconfig-paths`; the current template ships relative.)*<br><br>You DO still need these stricter-than-CRA tsconfig flags — Vite 7+ template defaults will otherwise fail the build with `TS6133` / `TS1484`:<br>• `"resolveJsonModule": true` — required (`utils/utils.ts` imports a JSON locale)<br>• `"jsx": "react-jsx"` — required<br>• `"verbatimModuleSyntax": false` — Vite 7+ default is `true`; canonical code uses mixed value + type imports without the `type` modifier<br>• `"noUnusedLocals": false` — Vite 7+ default is `true`; canonical code has many unused-by-default destructured listener args (e.g. `({ groupOwner, kickedUser, ... })`)<br>• `"noUnusedParameters": false` — same rationale<br>• `"erasableSyntaxOnly": false` — Vite 7+ template flag; canonical code uses const enums / namespace patterns<br>• `"allowJs": true` — canonical app's tsconfig sets this; some kit internals may rely on JS fallthrough<br>Validated 2026-05-21 against `create-vite@8` + canonical `uikit-builder-app` (CRA) + `@cometchat/chat-uikit-react@6.4.3`. |
926
- | `.env` (framework-prefixed) | Already written by Step 2c provision. Skip if present; warn if missing. |
927
-
928
- The `builder export` command handles the JSON patching + sentinel comment automatically. Skills only needs to patch the four files above (package.json, entry file, tsconfig, .env).
929
-
930
- ### 11.3 Entry-file init pattern (Vite + React)
931
-
932
- ```tsx
933
- // src/main.tsx
934
- import { createRoot } from "react-dom/client";
935
- import "./index.css";
936
- import App from "./App.tsx";
937
- import {
938
- UIKitSettingsBuilder,
939
- CometChatUIKit,
940
- } from "@cometchat/chat-uikit-react";
941
- import { CometChat } from "@cometchat/chat-sdk-javascript";
942
- import { setupLocalization } from "./CometChat/utils/utils.ts";
943
- import { CometChatProvider } from "./CometChat/context/CometChatContext.tsx";
944
-
945
- export const COMETCHAT_CONSTANTS = {
946
- APP_ID: import.meta.env.VITE_COMETCHAT_APP_ID!,
947
- REGION: import.meta.env.VITE_COMETCHAT_REGION!,
948
- AUTH_KEY: import.meta.env.VITE_COMETCHAT_AUTH_KEY!,
949
- };
950
-
951
- const uiKitSettings = new UIKitSettingsBuilder()
952
- .setAppId(COMETCHAT_CONSTANTS.APP_ID)
953
- .setRegion(COMETCHAT_CONSTANTS.REGION)
954
- .setAuthKey(COMETCHAT_CONSTANTS.AUTH_KEY)
955
- .subscribePresenceForAllUsers()
956
- .build();
957
-
958
- CometChatUIKit.init(uiKitSettings)?.then(() => {
959
- setupLocalization();
960
- createRoot(document.getElementById("root")!).render(
961
- <CometChatProvider>
962
- <App />
963
- </CometChatProvider>
964
- );
965
- });
966
- ```
967
-
968
- Then in `src/App.tsx`:
969
-
970
- ```tsx
971
- import CometChatApp from "./CometChat/CometChatApp";
972
-
973
- export default function App() {
974
- return (
975
- // CometChatApp requires an explicit width and height to render. Adjust as needed
976
- // for your Step 3c placement (full route, drawer, modal, embedded panel).
977
- <div style={{ width: "100vw", height: "100dvh" }}>
978
- <CometChatApp />
979
- </div>
980
- );
981
- }
982
- ```
983
-
984
- **Critical:**
985
-
986
- - `CometChatProvider` is the **repo's own context** from `./CometChat/context/CometChatContext`, NOT the kit's `CometChatUIKit` export. It manages the builder's `styleFeatures` / `chatFeatures` state and is required for `CometChatHome`, `useThemeStyles`, and the customization toggles to work.
987
- - `setupLocalization()` from `./CometChat/utils/utils` is required before render — it wires the builder's i18n catalog into the kit. Skipping it leaves UI strings empty.
988
- - `CometChatUIKit.init(...)` returns a Promise — render only AFTER it resolves. Rendering before init resolves causes `CometChatHome` to throw on first listener attach.
989
- - Login is handled by `CometChatApp` itself (the canonical component uses `CometChat.addLoginListener` + `CometChatUIKit.getLoggedinUser`). For dev mode, the customer's `App.tsx` should call `CometChatUIKit.login("cometchat-uid-1")` after init resolves but BEFORE rendering — see §2's login order. The canonical app shows a `LoginPlaceholder` until a user is present.
990
-
991
- ### 11.4 Per-framework variants
992
-
993
- | Framework | Where to put `CometChat/` | Entry-file pattern | SSR notes |
994
- |---|---|---|---|
995
- | **Vite + React** | `src/CometChat/` | `src/main.tsx` (above) | N/A |
996
- | **Create React App** | `src/CometChat/` | `src/index.tsx` — same as Vite but use `ReactDOM.createRoot` from `react-dom/client` | N/A |
997
- | **Next.js App Router** | `src/app/CometChat/` | Create `src/app/CometChatNoSSR/CometChatNoSSR.tsx` (client component) that does init + login + renders `<CometChatProvider><CometChatApp /></CometChatProvider>`. Then create `src/app/CometChatAppWrapper.tsx` with `"use client"` + `dynamic(() => import("../app/CometChatNoSSR/CometChatNoSSR"), { ssr: false })`. Import the wrapper in `src/app/page.tsx`. | The canonical `src/CometChat/` uses `window` / `document` / WebSocket APIs at module scope. `{ ssr: false }` on the wrapper is **non-negotiable** — direct import from a server component causes hydration errors. Use `process.env.NEXT_PUBLIC_COMETCHAT_*` instead of `import.meta.env.*`. |
998
- | **Next.js Pages Router** | `src/CometChat/` | `pages/chat.tsx` — `const CometChatApp = dynamic(() => import("../src/CometChat/CometChatApp"), { ssr: false });` Init in `pages/_app.tsx` inside `useEffect`. | Same SSR rationale as App Router. |
999
- | **React Router v7** | `app/CometChat/` (framework mode) or `src/CometChat/` (data mode) | Framework mode: use a `.client.tsx` suffix or `<ClientOnly>` from `remix-utils/client-only`. Data mode: same as Vite. | Framework mode SSRs by default — `.client.tsx` suffix OR `<ClientOnly>` is the only safe pattern. |
1000
- | **Astro** | `src/CometChat/` | `<CometChatApp client:only="react" />` inside an `.astro` page. Init runs in a sibling `.tsx` component that mounts before `CometChatApp`. | `client:only="react"` — never `client:load` (Astro will still SSR the import resolution and crash). |
1001
-
1002
- ### 11.5 Calls + builder
1003
-
1004
- If `CometChatSettings.callFeatures` has any `true` value (`oneOnOneVoiceCalling`, `oneOnOneVideoCalling`, `groupVideoConference`, `groupVoiceConference`):
1005
-
1006
- 1. The canonical `src/CometChat/` already wires `CometChatIncomingCall` inside `CometChatHome` — no extra mount required.
1007
- 2. Skills patches `package.json` to add `@cometchat/calls-sdk-javascript@4.2.5` (already in the canonical install command above) and the Cloudsmith-hosted `@cometchat/calls-lib-webrtc` per `cometchat-react-calls`.
1008
- 3. Calls SDK init runs alongside UI Kit init — pattern in `cometchat-react-calls § 2`.
1009
-
1010
- Invoke `cometchat-react-calls` after this section with `{ mode: "additive" }` so it adds Calls SDK init + lib-webrtc without duplicating the kit-level wiring already present in the copied `src/CometChat/`.
1011
-
1012
- ### 11.6 Resync flow
1013
-
1014
- The "Re-sync visual builder" iteration menu option (see `cometchat/SKILL.md § Step 7`) is a **one-command re-run**:
1015
-
1016
- ```bash
1017
- cometchat builder export --platform react --force
1018
- ```
1019
-
1020
- The `--force` flag is mandatory: it explicitly authorizes replacing the existing `src/CometChat/` directory. Without it, the CLI bails with *"--output directory \`src/CometChat\` already exists. Pass --force to replace it (full re-download per the resync flow), or pick a different --output path."*
1021
-
1022
- This matches the product contract for step 7 of the UI Kit Builder workflow:
1023
-
1024
- 1. Re-download the canonical static template ZIP (in case vendor has shipped fixes)
1025
- 2. Re-fetch the customer's current settings JSON (in case they tweaked in browser)
1026
- 3. Apply the F3 + F10 missing-field defaults
1027
- 4. Replace the `src/CometChat/` directory entirely
1028
-
1029
- **Customer hand-edits inside `src/CometChat/` are lost on resync.** This is intentional — the SKILLS-AUTO-GENERATED sentinel comment prepended to `CometChatSettings.ts` documents the "do not edit by hand" contract. (Note the export itself is a splice — only the `export const CometChatSettings = {...}` literal is rewritten and `export interface CometChatSettingsInterface` is preserved — but on `--force` resync the whole `src/CometChat/` directory is re-downloaded and replaced, so any in-folder hand-edits are discarded regardless.)
1030
-
1031
- If a customer needs to override beyond what the Visual Builder exposes, the supported escape hatches are:
1032
- - Edit the entry file (e.g., `src/main.tsx`) — outside `src/CometChat/`, never touched by resync
1033
- - Edit `src/App.tsx` to wrap `<CometChatApp />` with additional providers / styling
1034
- - Use `cometchat apply-feature <id>` for extension toggles (server-side, survives resync)
1035
- - For one-off CSS overrides, edit `src/index.css` or equivalent — also outside `src/CometChat/`
1036
-
1037
- > **Builder feature toggles vs. dashboard extensions — two independent layers.** The Visual Builder's `chatFeatures` toggles (baked into `CometChatSettings.ts`) only control whether a feature's **UI** is shown. Extension- and AI-backed features (polls, message translation, collaborative document/whiteboard, stickers, smart replies, conversation starter/summary) need their **server-side capability** enabled separately — the dashboard extensions store, which `cometchat apply-feature <id>` writes and the builder export **never touches**. So: (a) `apply-feature`'d extensions always survive `builder export --force`; (b) turning a feature ON in the builder shows its UI but it fails at runtime until the matching extension is enabled — that's why `builder export` reports a `dashboardSetupNeeded` list (the dispatcher runs `apply-feature` for each). The two flows are complementary: the builder draws the UI, `apply-feature` turns on the capability behind it.
1038
-
1039
- The `cometchat-core` §11.7 "Override hook pattern" documents the recommended places to override without touching the canonical.
1040
-
1041
- `verify --builder` runs after resync to confirm the new export is structurally sound.
1042
-
1043
- ### 11.7 What this section does NOT emit
1044
-
1045
- The canonical `src/CometChat/` honors every Builder setting it supports — theme colors, typography, dark/light, sidebar toggle, layout tabs, `chatFeatures.*`, `callFeatures.*`, `agent.*` (per the repo's `CometChatHome` + `styleConfig.ts`). The only setting that isn't auto-applied is `noCode.docked` (the floating-widget shape) — that's a runtime DOM injection that requires the customer to mount `<CometChatApp />` inside a docked overlay container. Surface this in the post-emit summary:
1046
-
1047
- > Builder settings honored: theme, typography, layout/tabs, sidebar, chat features (mentions/reactions/threads/media/etc.), call features, agent UI.
1048
- > Builder settings deferred: `noCode.docked` floating-widget mode — requires manual mount inside a positioned overlay; see `cometchat-placement § Floating widget`.