@cometchat/skills 4.0.0 → 4.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (258) hide show
  1. package/README.md +42 -2
  2. package/bin/install.js +448 -57
  3. package/package.json +1 -1
  4. package/skills/cometchat/SKILL.md +337 -80
  5. package/skills/cometchat-a11y/SKILL.md +476 -0
  6. package/skills/cometchat-android-v5/SKILL.md +1 -1
  7. package/skills/cometchat-android-v5-calls/SKILL.md +413 -0
  8. package/skills/cometchat-android-v5-calls/references/README.md +53 -0
  9. package/skills/cometchat-android-v5-calls/references/add-calls-to-existing-chat.md +195 -0
  10. package/skills/cometchat-android-v5-calls/references/audio-controls.md +91 -0
  11. package/skills/cometchat-android-v5-calls/references/background-handling.md +168 -0
  12. package/skills/cometchat-android-v5-calls/references/call-layouts.md +123 -0
  13. package/skills/cometchat-android-v5-calls/references/call-logs.md +113 -0
  14. package/skills/cometchat-android-v5-calls/references/call-session.md +274 -0
  15. package/skills/cometchat-android-v5-calls/references/custom-ui.md +150 -0
  16. package/skills/cometchat-android-v5-calls/references/event-listeners.md +123 -0
  17. package/skills/cometchat-android-v5-calls/references/group-calls.md +205 -0
  18. package/skills/cometchat-android-v5-calls/references/idle-timeout.md +111 -0
  19. package/skills/cometchat-android-v5-calls/references/in-call-chat.md +134 -0
  20. package/skills/cometchat-android-v5-calls/references/join-session.md +120 -0
  21. package/skills/cometchat-android-v5-calls/references/migration-v4-to-v5.md +206 -0
  22. package/skills/cometchat-android-v5-calls/references/participant-management.md +110 -0
  23. package/skills/cometchat-android-v5-calls/references/picture-in-picture.md +106 -0
  24. package/skills/cometchat-android-v5-calls/references/raise-hand.md +242 -0
  25. package/skills/cometchat-android-v5-calls/references/recording.md +101 -0
  26. package/skills/cometchat-android-v5-calls/references/ringing-integration.md +152 -0
  27. package/skills/cometchat-android-v5-calls/references/screen-sharing.md +82 -0
  28. package/skills/cometchat-android-v5-calls/references/server-fcm-voip.md +215 -0
  29. package/skills/cometchat-android-v5-calls/references/session-settings.md +121 -0
  30. package/skills/cometchat-android-v5-calls/references/setup.md +137 -0
  31. package/skills/cometchat-android-v5-calls/references/share-invite.md +151 -0
  32. package/skills/cometchat-android-v5-calls/references/video-controls.md +87 -0
  33. package/skills/cometchat-android-v5-calls/references/voip-calling.md +526 -0
  34. package/skills/cometchat-android-v5-components/SKILL.md +1 -1
  35. package/skills/cometchat-android-v5-core/SKILL.md +1 -1
  36. package/skills/cometchat-android-v5-customization/SKILL.md +1 -1
  37. package/skills/cometchat-android-v5-extensions/SKILL.md +1 -1
  38. package/skills/cometchat-android-v5-features/SKILL.md +1 -1
  39. package/skills/cometchat-android-v5-placement/SKILL.md +1 -1
  40. package/skills/cometchat-android-v5-production/SKILL.md +1 -1
  41. package/skills/cometchat-android-v5-push/SKILL.md +1 -1
  42. package/skills/cometchat-android-v5-testing/SKILL.md +1 -1
  43. package/skills/cometchat-android-v5-theming/SKILL.md +1 -1
  44. package/skills/cometchat-android-v5-troubleshooting/SKILL.md +1 -1
  45. package/skills/cometchat-android-v6/SKILL.md +1 -1
  46. package/skills/cometchat-android-v6-builder-settings/SKILL.md +1 -1
  47. package/skills/cometchat-android-v6-calls/SKILL.md +375 -0
  48. package/skills/cometchat-android-v6-calls/references/add-calls-to-existing-chat.md +97 -0
  49. package/skills/cometchat-android-v6-calls/references/call-layouts.md +91 -0
  50. package/skills/cometchat-android-v6-calls/references/call-session.md +163 -0
  51. package/skills/cometchat-android-v6-calls/references/device-management.md +171 -0
  52. package/skills/cometchat-android-v6-calls/references/group-calls.md +191 -0
  53. package/skills/cometchat-android-v6-calls/references/idle-timeout.md +107 -0
  54. package/skills/cometchat-android-v6-calls/references/in-call-chat.md +136 -0
  55. package/skills/cometchat-android-v6-calls/references/raise-hand.md +186 -0
  56. package/skills/cometchat-android-v6-calls/references/ringing-integration.md +176 -0
  57. package/skills/cometchat-android-v6-calls/references/server-fcm-voip.md +127 -0
  58. package/skills/cometchat-android-v6-calls/references/share-invite.md +105 -0
  59. package/skills/cometchat-android-v6-compose-components/SKILL.md +2 -2
  60. package/skills/cometchat-android-v6-compose-customization/SKILL.md +1 -1
  61. package/skills/cometchat-android-v6-compose-placement/SKILL.md +1 -1
  62. package/skills/cometchat-android-v6-compose-theming/SKILL.md +1 -1
  63. package/skills/cometchat-android-v6-core/SKILL.md +1 -1
  64. package/skills/cometchat-android-v6-events/SKILL.md +1 -1
  65. package/skills/cometchat-android-v6-extensions/SKILL.md +1 -1
  66. package/skills/cometchat-android-v6-features/SKILL.md +1 -1
  67. package/skills/cometchat-android-v6-kotlin-components/SKILL.md +1 -1
  68. package/skills/cometchat-android-v6-kotlin-customization/SKILL.md +1 -1
  69. package/skills/cometchat-android-v6-kotlin-placement/SKILL.md +1 -1
  70. package/skills/cometchat-android-v6-kotlin-theming/SKILL.md +1 -1
  71. package/skills/cometchat-android-v6-migration/SKILL.md +398 -0
  72. package/skills/cometchat-android-v6-production/SKILL.md +1 -1
  73. package/skills/cometchat-android-v6-push/SKILL.md +1 -1
  74. package/skills/cometchat-android-v6-testing/SKILL.md +1 -1
  75. package/skills/cometchat-android-v6-troubleshooting/SKILL.md +1 -1
  76. package/skills/cometchat-angular-calls/SKILL.md +511 -0
  77. package/skills/cometchat-angular-calls/references/add-calls-to-existing-chat.md +95 -0
  78. package/skills/cometchat-angular-calls/references/call-layouts.md +106 -0
  79. package/skills/cometchat-angular-calls/references/call-session.md +167 -0
  80. package/skills/cometchat-angular-calls/references/custom-ui.md +231 -0
  81. package/skills/cometchat-angular-calls/references/device-management.md +135 -0
  82. package/skills/cometchat-angular-calls/references/group-calls.md +412 -0
  83. package/skills/cometchat-angular-calls/references/idle-timeout.md +145 -0
  84. package/skills/cometchat-angular-calls/references/in-call-chat.md +148 -0
  85. package/skills/cometchat-angular-calls/references/lazy-loading-pitfalls.md +205 -0
  86. package/skills/cometchat-angular-calls/references/migration-v4-to-v5.md +53 -0
  87. package/skills/cometchat-angular-calls/references/ngzone-and-async-callbacks.md +183 -0
  88. package/skills/cometchat-angular-calls/references/picture-in-picture.md +285 -0
  89. package/skills/cometchat-angular-calls/references/raise-hand.md +167 -0
  90. package/skills/cometchat-angular-calls/references/recording-screen-share.md +267 -0
  91. package/skills/cometchat-angular-calls/references/ringing-integration.md +131 -0
  92. package/skills/cometchat-angular-calls/references/server-web-push-vapid.md +100 -0
  93. package/skills/cometchat-angular-calls/references/share-invite.md +116 -0
  94. package/skills/cometchat-angular-components/SKILL.md +1 -1
  95. package/skills/cometchat-angular-core/SKILL.md +1 -1
  96. package/skills/cometchat-angular-customization/SKILL.md +1 -1
  97. package/skills/cometchat-angular-features/SKILL.md +1 -1
  98. package/skills/cometchat-angular-patterns/SKILL.md +1 -1
  99. package/skills/cometchat-angular-placement/SKILL.md +1 -1
  100. package/skills/cometchat-angular-production/SKILL.md +1 -1
  101. package/skills/cometchat-angular-push/SKILL.md +403 -0
  102. package/skills/cometchat-angular-testing/SKILL.md +333 -0
  103. package/skills/cometchat-angular-theming/SKILL.md +1 -1
  104. package/skills/cometchat-angular-troubleshooting/SKILL.md +1 -1
  105. package/skills/cometchat-astro-patterns/SKILL.md +1 -1
  106. package/skills/cometchat-calls/SKILL.md +358 -0
  107. package/skills/cometchat-calls/references/use-case-broadcast.md +194 -0
  108. package/skills/cometchat-calls/references/use-case-marketplace.md +158 -0
  109. package/skills/cometchat-calls/references/use-case-support.md +190 -0
  110. package/skills/cometchat-calls/references/use-case-team.md +169 -0
  111. package/skills/cometchat-calls/references/use-case-telehealth.md +154 -0
  112. package/skills/cometchat-components/SKILL.md +1 -1
  113. package/skills/cometchat-core/SKILL.md +1 -1
  114. package/skills/cometchat-customization/SKILL.md +2 -2
  115. package/skills/cometchat-features/SKILL.md +2 -2
  116. package/skills/cometchat-flutter-v5/SKILL.md +1 -1
  117. package/skills/cometchat-flutter-v5-calls/SKILL.md +325 -94
  118. package/skills/cometchat-flutter-v5-calls/references/add-calls-to-existing-chat.md +169 -0
  119. package/skills/cometchat-flutter-v5-calls/references/call-layouts.md +98 -0
  120. package/skills/cometchat-flutter-v5-calls/references/call-session.md +330 -0
  121. package/skills/cometchat-flutter-v5-calls/references/device-management.md +120 -0
  122. package/skills/cometchat-flutter-v5-calls/references/group-calls.md +187 -0
  123. package/skills/cometchat-flutter-v5-calls/references/idle-timeout.md +97 -0
  124. package/skills/cometchat-flutter-v5-calls/references/in-call-chat.md +132 -0
  125. package/skills/cometchat-flutter-v5-calls/references/migration-v4-to-v5.md +160 -0
  126. package/skills/cometchat-flutter-v5-calls/references/raise-hand.md +244 -0
  127. package/skills/cometchat-flutter-v5-calls/references/ringing-integration.md +193 -0
  128. package/skills/cometchat-flutter-v5-calls/references/server-push-bridge.md +101 -0
  129. package/skills/cometchat-flutter-v5-calls/references/share-invite.md +142 -0
  130. package/skills/cometchat-flutter-v5-conversations/SKILL.md +1 -1
  131. package/skills/cometchat-flutter-v5-core/SKILL.md +1 -1
  132. package/skills/cometchat-flutter-v5-customization/SKILL.md +1 -1
  133. package/skills/cometchat-flutter-v5-events/SKILL.md +1 -1
  134. package/skills/cometchat-flutter-v5-messages/SKILL.md +1 -1
  135. package/skills/cometchat-flutter-v5-production/SKILL.md +1 -1
  136. package/skills/cometchat-flutter-v5-push/SKILL.md +1 -1
  137. package/skills/cometchat-flutter-v5-testing/SKILL.md +390 -0
  138. package/skills/cometchat-flutter-v5-theming/SKILL.md +1 -1
  139. package/skills/cometchat-flutter-v5-troubleshooting/SKILL.md +1 -1
  140. package/skills/cometchat-flutter-v5-users-groups/SKILL.md +1 -1
  141. package/skills/cometchat-flutter-v6/SKILL.md +1 -1
  142. package/skills/cometchat-flutter-v6-calls/SKILL.md +308 -243
  143. package/skills/cometchat-flutter-v6-calls/references/add-calls-to-existing-chat.md +134 -0
  144. package/skills/cometchat-flutter-v6-calls/references/call-layouts.md +102 -0
  145. package/skills/cometchat-flutter-v6-calls/references/call-session.md +229 -0
  146. package/skills/cometchat-flutter-v6-calls/references/device-management.md +99 -0
  147. package/skills/cometchat-flutter-v6-calls/references/group-calls.md +190 -0
  148. package/skills/cometchat-flutter-v6-calls/references/idle-timeout.md +80 -0
  149. package/skills/cometchat-flutter-v6-calls/references/in-call-chat.md +122 -0
  150. package/skills/cometchat-flutter-v6-calls/references/raise-hand.md +268 -0
  151. package/skills/cometchat-flutter-v6-calls/references/ringing-integration.md +171 -0
  152. package/skills/cometchat-flutter-v6-calls/references/server-push-bridge.md +93 -0
  153. package/skills/cometchat-flutter-v6-calls/references/share-invite.md +102 -0
  154. package/skills/cometchat-flutter-v6-components/SKILL.md +1 -1
  155. package/skills/cometchat-flutter-v6-conversations/SKILL.md +1 -1
  156. package/skills/cometchat-flutter-v6-core/SKILL.md +1 -1
  157. package/skills/cometchat-flutter-v6-customization/SKILL.md +1 -1
  158. package/skills/cometchat-flutter-v6-events/SKILL.md +1 -1
  159. package/skills/cometchat-flutter-v6-features/SKILL.md +1 -1
  160. package/skills/cometchat-flutter-v6-messages/SKILL.md +1 -1
  161. package/skills/cometchat-flutter-v6-migration/SKILL.md +1 -1
  162. package/skills/cometchat-flutter-v6-placement/SKILL.md +1 -1
  163. package/skills/cometchat-flutter-v6-production/SKILL.md +1 -1
  164. package/skills/cometchat-flutter-v6-push/SKILL.md +452 -0
  165. package/skills/cometchat-flutter-v6-testing/SKILL.md +319 -0
  166. package/skills/cometchat-flutter-v6-theming/SKILL.md +1 -1
  167. package/skills/cometchat-flutter-v6-troubleshooting/SKILL.md +1 -1
  168. package/skills/cometchat-flutter-v6-users-groups/SKILL.md +1 -1
  169. package/skills/cometchat-i18n/SKILL.md +358 -0
  170. package/skills/cometchat-ios/SKILL.md +5 -5
  171. package/skills/cometchat-ios-calls/SKILL.md +409 -0
  172. package/skills/cometchat-ios-calls/references/add-calls-to-existing-chat.md +172 -0
  173. package/skills/cometchat-ios-calls/references/avaudiosession-routing.md +189 -0
  174. package/skills/cometchat-ios-calls/references/call-layouts.md +136 -0
  175. package/skills/cometchat-ios-calls/references/call-session.md +221 -0
  176. package/skills/cometchat-ios-calls/references/callkit-and-pushkit.md +353 -0
  177. package/skills/cometchat-ios-calls/references/custom-ui.md +322 -0
  178. package/skills/cometchat-ios-calls/references/device-management.md +171 -0
  179. package/skills/cometchat-ios-calls/references/group-calls.md +396 -0
  180. package/skills/cometchat-ios-calls/references/idle-timeout.md +185 -0
  181. package/skills/cometchat-ios-calls/references/in-call-chat.md +183 -0
  182. package/skills/cometchat-ios-calls/references/migration-v4-to-v5.md +138 -0
  183. package/skills/cometchat-ios-calls/references/picture-in-picture.md +246 -0
  184. package/skills/cometchat-ios-calls/references/raise-hand.md +239 -0
  185. package/skills/cometchat-ios-calls/references/recording-screen-share.md +339 -0
  186. package/skills/cometchat-ios-calls/references/ringing-integration.md +142 -0
  187. package/skills/cometchat-ios-calls/references/server-apns-pushkit.md +267 -0
  188. package/skills/cometchat-ios-calls/references/share-invite.md +152 -0
  189. package/skills/cometchat-ios-calls/references/swiftui-uikit-hosting.md +246 -0
  190. package/skills/cometchat-ios-calls/references/voip-cert-setup.md +166 -0
  191. package/skills/cometchat-ios-components/SKILL.md +1 -1
  192. package/skills/cometchat-ios-core/SKILL.md +1 -1
  193. package/skills/cometchat-ios-customization/SKILL.md +1 -1
  194. package/skills/cometchat-ios-features/SKILL.md +1 -1
  195. package/skills/cometchat-ios-placement/SKILL.md +1 -1
  196. package/skills/cometchat-ios-production/SKILL.md +1 -1
  197. package/skills/cometchat-ios-push/SKILL.md +1 -1
  198. package/skills/cometchat-ios-testing/SKILL.md +371 -0
  199. package/skills/cometchat-ios-theming/SKILL.md +1 -1
  200. package/skills/cometchat-ios-troubleshooting/SKILL.md +1 -1
  201. package/skills/cometchat-native-bare-patterns/SKILL.md +45 -3
  202. package/skills/cometchat-native-calls/SKILL.md +599 -0
  203. package/skills/cometchat-native-calls/references/add-calls-to-existing-chat.md +203 -0
  204. package/skills/cometchat-native-calls/references/call-layouts.md +124 -0
  205. package/skills/cometchat-native-calls/references/call-session.md +182 -0
  206. package/skills/cometchat-native-calls/references/custom-ui.md +250 -0
  207. package/skills/cometchat-native-calls/references/device-management.md +135 -0
  208. package/skills/cometchat-native-calls/references/expo-vs-bare.md +179 -0
  209. package/skills/cometchat-native-calls/references/group-calls.md +291 -0
  210. package/skills/cometchat-native-calls/references/idle-timeout.md +128 -0
  211. package/skills/cometchat-native-calls/references/in-call-chat.md +143 -0
  212. package/skills/cometchat-native-calls/references/migration-v4-to-v5.md +72 -0
  213. package/skills/cometchat-native-calls/references/picture-in-picture.md +276 -0
  214. package/skills/cometchat-native-calls/references/raise-hand.md +203 -0
  215. package/skills/cometchat-native-calls/references/recording-screen-share.md +290 -0
  216. package/skills/cometchat-native-calls/references/ringing-integration.md +118 -0
  217. package/skills/cometchat-native-calls/references/server-push-bridge.md +135 -0
  218. package/skills/cometchat-native-calls/references/server-push-payloads.md +193 -0
  219. package/skills/cometchat-native-calls/references/share-invite.md +144 -0
  220. package/skills/cometchat-native-calls/references/voip-push-end-to-end.md +317 -0
  221. package/skills/cometchat-native-components/SKILL.md +1 -1
  222. package/skills/cometchat-native-core/SKILL.md +1 -1
  223. package/skills/cometchat-native-customization/SKILL.md +1 -1
  224. package/skills/cometchat-native-expo-patterns/SKILL.md +18 -1
  225. package/skills/cometchat-native-features/SKILL.md +1 -1
  226. package/skills/cometchat-native-placement/SKILL.md +1 -1
  227. package/skills/cometchat-native-production/SKILL.md +1 -1
  228. package/skills/cometchat-native-push/SKILL.md +1 -1
  229. package/skills/cometchat-native-testing/SKILL.md +1 -1
  230. package/skills/cometchat-native-theming/SKILL.md +1 -1
  231. package/skills/cometchat-native-troubleshooting/SKILL.md +1 -1
  232. package/skills/cometchat-nextjs-patterns/SKILL.md +1 -1
  233. package/skills/cometchat-placement/SKILL.md +29 -1
  234. package/skills/cometchat-production/SKILL.md +1 -1
  235. package/skills/cometchat-react-calls/SKILL.md +539 -0
  236. package/skills/cometchat-react-calls/references/add-calls-to-existing-chat.md +145 -0
  237. package/skills/cometchat-react-calls/references/call-layouts.md +161 -0
  238. package/skills/cometchat-react-calls/references/call-session.md +235 -0
  239. package/skills/cometchat-react-calls/references/custom-ui.md +201 -0
  240. package/skills/cometchat-react-calls/references/device-management.md +206 -0
  241. package/skills/cometchat-react-calls/references/group-calls.md +262 -0
  242. package/skills/cometchat-react-calls/references/idle-timeout.md +175 -0
  243. package/skills/cometchat-react-calls/references/in-call-chat.md +212 -0
  244. package/skills/cometchat-react-calls/references/migration-v4-to-v5.md +172 -0
  245. package/skills/cometchat-react-calls/references/picture-in-picture.md +245 -0
  246. package/skills/cometchat-react-calls/references/raise-hand.md +238 -0
  247. package/skills/cometchat-react-calls/references/recording-screen-share.md +143 -0
  248. package/skills/cometchat-react-calls/references/ringing-integration.md +255 -0
  249. package/skills/cometchat-react-calls/references/server-web-push-vapid.md +241 -0
  250. package/skills/cometchat-react-calls/references/share-invite.md +176 -0
  251. package/skills/cometchat-react-calls/references/testing-calls-on-web.md +198 -0
  252. package/skills/cometchat-react-calls/references/voip-and-web-push.md +165 -0
  253. package/skills/cometchat-react-patterns/SKILL.md +56 -8
  254. package/skills/cometchat-react-push/SKILL.md +448 -0
  255. package/skills/cometchat-react-router-patterns/SKILL.md +1 -1
  256. package/skills/cometchat-react-testing/SKILL.md +404 -0
  257. package/skills/cometchat-theming/SKILL.md +3 -3
  258. package/skills/cometchat-troubleshooting/SKILL.md +2 -2
@@ -0,0 +1,403 @@
1
+ ---
2
+ name: cometchat-angular-push
3
+ description: Push notifications for CometChat Angular UI Kit v4 in Angular 12-15 projects. Web doesn't have native push — covers @angular/service-worker setup, ngsw-config.json, SwPush subscription, server-side webhook to send pushes, click-through routing via Angular Router, Angular Universal SSR considerations, and HTTPS requirements.
4
+ license: "MIT"
5
+ compatibility: "Angular 12-15 (LTS focus on 15); @angular/service-worker (matched to Angular major); Web Push API (Chrome 50+, Firefox 44+, Edge 17+, Safari 16+ desktop, Safari 16.4+ iOS PWA-only); HTTPS required"
6
+ allowed-tools: "shell, file-read, file-search, file-list, ask-user"
7
+ metadata:
8
+ author: "CometChat"
9
+ version: "4.0.0"
10
+ tags: "cometchat angular web push notifications service-worker swpush ngsw vapid universal ssr"
11
+ ---
12
+
13
+ ## Purpose
14
+
15
+ Web Push for Angular CometChat integrations. Angular's `@angular/service-worker` package provides `SwPush` — a thin wrapper over the Push API — that integrates with Angular's DI tree and Router, so it's the recommended path over hand-rolled Service Workers.
16
+
17
+ **Read these other skills first:**
18
+ - `cometchat-angular-core` — UIKitSettingsBuilder, login order
19
+ - `cometchat-angular-patterns` — module setup
20
+ - `cometchat-react-push` — same Web Push spec, React-flavored explanation; shared concepts (VAPID, server-side webhook, iOS PWA caveat) covered there in depth
21
+
22
+ **Ground truth:**
23
+ - `@angular/service-worker` — https://angular.io/guide/service-worker-intro
24
+ - `SwPush` API — https://angular.io/api/service-worker/SwPush
25
+ - Web Push spec — https://datatracker.ietf.org/doc/html/rfc8030
26
+
27
+ ---
28
+
29
+ ## 1. Architecture (same as web)
30
+
31
+ Same shape as `cometchat-react-push`: client SW + push server + CometChat webhook. Angular's `SwPush` is the client-side primitive; everything else is the same.
32
+
33
+ ---
34
+
35
+ ## 2. Add @angular/service-worker
36
+
37
+ ```bash
38
+ ng add @angular/service-worker
39
+ ```
40
+
41
+ This:
42
+ - Adds `@angular/service-worker` to dependencies
43
+ - Creates `ngsw-config.json` at project root
44
+ - Imports `ServiceWorkerModule.register('ngsw-worker.js', ...)` in `AppModule`
45
+ - Sets `serviceWorker: true` in `angular.json` build options
46
+
47
+ Verify in `app.module.ts`:
48
+
49
+ ```ts
50
+ @NgModule({
51
+ imports: [
52
+ BrowserModule,
53
+ ServiceWorkerModule.register('ngsw-worker.js', {
54
+ enabled: !isDevMode(), // SW disabled in dev mode by default
55
+ registrationStrategy: 'registerWhenStable:30000',
56
+ }),
57
+ ],
58
+ })
59
+ export class AppModule {}
60
+ ```
61
+
62
+ ---
63
+
64
+ ## 3. ngsw-config.json — minimal config for chat push
65
+
66
+ The default config caches assets for offline-first PWAs. For chat push, you mostly need the data-sources for live API calls:
67
+
68
+ ```json
69
+ {
70
+ "$schema": "./node_modules/@angular/service-worker/config/schema.json",
71
+ "index": "/index.html",
72
+ "assetGroups": [
73
+ {
74
+ "name": "app",
75
+ "installMode": "prefetch",
76
+ "resources": {
77
+ "files": ["/favicon.ico", "/index.html", "/manifest.webmanifest", "/*.css", "/*.js"]
78
+ }
79
+ },
80
+ {
81
+ "name": "assets",
82
+ "installMode": "lazy",
83
+ "updateMode": "prefetch",
84
+ "resources": {
85
+ "files": ["/assets/**", "/*.(svg|cur|jpg|jpeg|png|apng|webp|avif|gif|otf|ttf|woff|woff2)"]
86
+ }
87
+ }
88
+ ],
89
+ "dataGroups": [
90
+ {
91
+ "name": "cometchat-api",
92
+ "urls": ["https://api-*.cometchat.io/**"],
93
+ "cacheConfig": {
94
+ "maxSize": 100,
95
+ "maxAge": "0d",
96
+ "strategy": "freshness"
97
+ }
98
+ }
99
+ ]
100
+ }
101
+ ```
102
+
103
+ **Don't cache CometChat API responses** — they're real-time. The freshness strategy with `maxAge: "0d"` effectively disables caching.
104
+
105
+ ---
106
+
107
+ ## 4. SwPush registration
108
+
109
+ ```ts
110
+ // services/push.service.ts
111
+ import { Injectable } from "@angular/core";
112
+ import { SwPush } from "@angular/service-worker";
113
+ import { Router } from "@angular/router";
114
+ import { environment } from "../../environments/environment";
115
+
116
+ @Injectable({ providedIn: "root" })
117
+ export class PushService {
118
+ constructor(private swPush: SwPush, private router: Router) {
119
+ // Listen for notification clicks — fired when user taps a push notification
120
+ this.swPush.notificationClicks.subscribe(({ notification }) => {
121
+ const data = notification.data;
122
+ const targetUrl = data.receiverType === "group"
123
+ ? `/messages/group/${data.conversationId}`
124
+ : `/messages/user/${data.senderUid}`;
125
+ this.router.navigateByUrl(targetUrl);
126
+ });
127
+ }
128
+
129
+ async subscribe(uid: string): Promise<void> {
130
+ if (!this.swPush.isEnabled) {
131
+ console.warn("SwPush not enabled — Service Worker not registered or not supported");
132
+ return;
133
+ }
134
+
135
+ try {
136
+ const subscription = await this.swPush.requestSubscription({
137
+ serverPublicKey: environment.vapidPublic,
138
+ });
139
+
140
+ // Send to YOUR push server, keyed by uid
141
+ await fetch("/api/push/subscribe", {
142
+ method: "POST",
143
+ headers: { "Content-Type": "application/json" },
144
+ body: JSON.stringify({ uid, subscription }),
145
+ });
146
+ } catch (err) {
147
+ // User denied permission, or push not supported
148
+ console.warn("Web Push subscription failed:", err);
149
+ }
150
+ }
151
+
152
+ async unsubscribe(uid: string): Promise<void> {
153
+ if (!this.swPush.isEnabled) return;
154
+ const subscription = await this.swPush.subscription.toPromise();
155
+ if (!subscription) return;
156
+
157
+ await fetch("/api/push/unsubscribe", {
158
+ method: "POST",
159
+ headers: { "Content-Type": "application/json" },
160
+ body: JSON.stringify({ uid, subscription }),
161
+ });
162
+ await this.swPush.unsubscribe();
163
+ }
164
+ }
165
+ ```
166
+
167
+ **Permission gesture rule:** `requestSubscription` triggers the browser's permission prompt. Browsers require this in response to a user gesture (click). Don't call this from `OnInit` — wire it to a button click.
168
+
169
+ ---
170
+
171
+ ## 5. Wire into the auth flow
172
+
173
+ ```ts
174
+ // services/auth.service.ts (or wherever login happens)
175
+ import { PushService } from "./push.service";
176
+
177
+ @Injectable({ providedIn: "root" })
178
+ export class AuthService {
179
+ constructor(private pushService: PushService) {}
180
+
181
+ async loginAndEnableChat(uid: string): Promise<void> {
182
+ await CometChatUIKit.login(uid);
183
+ // Don't auto-subscribe to push — let the user opt in via a button
184
+ }
185
+
186
+ async logout(uid: string): Promise<void> {
187
+ await this.pushService.unsubscribe(uid); // CRITICAL — clean up before SDK logout
188
+ await CometChatUIKit.logout();
189
+ }
190
+ }
191
+ ```
192
+
193
+ ---
194
+
195
+ ## 6. "Enable notifications" button
196
+
197
+ ```ts
198
+ // components/notification-prompt.component.ts
199
+ @Component({
200
+ selector: "app-notification-prompt",
201
+ template: `
202
+ <button (click)="enable()" *ngIf="!enabled">
203
+ Enable notifications
204
+ </button>
205
+ `,
206
+ })
207
+ export class NotificationPromptComponent {
208
+ enabled = false;
209
+
210
+ constructor(private pushService: PushService, private auth: AuthService) {}
211
+
212
+ async enable() {
213
+ const user = await CometChatUIKit.getLoggedInUser();
214
+ if (!user) return;
215
+ await this.pushService.subscribe(user.uid);
216
+ this.enabled = true;
217
+ }
218
+ }
219
+ ```
220
+
221
+ Mount this somewhere visible — chat header, settings page, or a one-time onboarding card.
222
+
223
+ ---
224
+
225
+ ## 7. Service Worker push event handler
226
+
227
+ `@angular/service-worker` ships its own `ngsw-worker.js` that handles push events automatically — when a push arrives, it calls `ServiceWorkerRegistration.showNotification` with the push payload.
228
+
229
+ **However**, the default behavior shows the entire payload as the notification body. For chat, you want a custom UI: sender name as title, preview as body, conversation tag for dedup.
230
+
231
+ Two paths:
232
+
233
+ ### Path A — Use the payload shape `ngsw-worker.js` expects
234
+
235
+ The Angular SW expects this payload shape:
236
+
237
+ ```json
238
+ {
239
+ "notification": {
240
+ "title": "Alice",
241
+ "body": "Hi there",
242
+ "icon": "/avatars/alice.png",
243
+ "tag": "chat-conversation-123",
244
+ "data": {
245
+ "conversationId": "conversation-123",
246
+ "senderUid": "cometchat-uid-1",
247
+ "receiverType": "user"
248
+ }
249
+ }
250
+ }
251
+ ```
252
+
253
+ Your push server sends this exact shape. `ngsw-worker.js` extracts `notification` and shows it.
254
+
255
+ ### Path B — Custom Service Worker
256
+
257
+ If you need behavior beyond what Angular's SW provides (e.g. checking if the chat tab is focused before notifying), eject from `ngsw-worker.js` and write a custom SW. Heavier maintenance — only needed for advanced cases.
258
+
259
+ ---
260
+
261
+ ## 8. Server-side push send
262
+
263
+ Same shape as `cometchat-react-push` Section 6. Different payload shape — Angular SW expects the wrapped `{ notification: {...} }` form:
264
+
265
+ ```ts
266
+ const payload = JSON.stringify({
267
+ notification: {
268
+ title: sender.name,
269
+ body: truncate(data.text, 80),
270
+ icon: sender.avatar ?? "/icons/chat.png",
271
+ tag: `chat-${receiver}`,
272
+ data: {
273
+ conversationId: receiver,
274
+ senderUid: sender.uid,
275
+ receiverType: data.entityType,
276
+ },
277
+ },
278
+ });
279
+ ```
280
+
281
+ The webhook setup, signature verification, and dead-subscription cleanup are identical to the React version.
282
+
283
+ ---
284
+
285
+ ## 9. CometChat webhook setup
286
+
287
+ Same as `cometchat-react-push` Section 7 — configure in CometChat dashboard, point at your push server, copy the signing secret.
288
+
289
+ ---
290
+
291
+ ## 10. Angular Universal (SSR) considerations
292
+
293
+ If your app uses Angular Universal:
294
+
295
+ ```ts
296
+ // services/push.service.ts
297
+ import { isPlatformBrowser } from "@angular/common";
298
+ import { Inject, PLATFORM_ID } from "@angular/core";
299
+
300
+ @Injectable({ providedIn: "root" })
301
+ export class PushService {
302
+ constructor(
303
+ private swPush: SwPush,
304
+ private router: Router,
305
+ @Inject(PLATFORM_ID) private platformId: object,
306
+ ) {
307
+ if (!isPlatformBrowser(this.platformId)) return; // skip on server
308
+ this.swPush.notificationClicks.subscribe(/* ... */);
309
+ }
310
+
311
+ async subscribe(uid: string): Promise<void> {
312
+ if (!isPlatformBrowser(this.platformId)) return;
313
+ if (!this.swPush.isEnabled) return;
314
+ // ...
315
+ }
316
+ }
317
+ ```
318
+
319
+ Without these guards, the SSR build crashes at boot with `ReferenceError: ServiceWorkerRegistration is not defined`.
320
+
321
+ `@angular/service-worker` itself ships with SSR-safe stubs, but downstream code that touches `swPush.subscription` etc. needs guards.
322
+
323
+ ---
324
+
325
+ ## 11. iOS Safari 16.4+ PWA-only caveat
326
+
327
+ Same as `cometchat-react-push` Section 9 — iOS Web Push works ONLY for sites added to the Home Screen as PWAs. Angular CLI generates `manifest.webmanifest` automatically when you `ng add @angular/pwa`; verify it's present and correct:
328
+
329
+ ```json
330
+ {
331
+ "name": "Your App",
332
+ "short_name": "YourApp",
333
+ "theme_color": "#1976d2",
334
+ "background_color": "#fafafa",
335
+ "display": "standalone",
336
+ "start_url": "/",
337
+ "icons": [/* ... */]
338
+ }
339
+ ```
340
+
341
+ iOS users must use Safari → Share → "Add to Home Screen" once for Web Push to work.
342
+
343
+ ---
344
+
345
+ ## 12. HTTPS requirement
346
+
347
+ Service Workers + Push API both require HTTPS (or `localhost`). `ng serve --ssl` works for local HTTPS dev.
348
+
349
+ For production: Vercel / Netlify / Cloudflare Pages / Firebase Hosting all default to HTTPS.
350
+
351
+ ---
352
+
353
+ ## 13. Build + deploy
354
+
355
+ `@angular/service-worker` generates `ngsw-worker.js` at build time:
356
+
357
+ ```bash
358
+ ng build --configuration production
359
+ ```
360
+
361
+ Output: `dist/your-app/ngsw-worker.js` + `dist/your-app/ngsw.json` (the SW config baked in).
362
+
363
+ Deploy these files alongside `index.html`. The SW updates automatically when `ngsw.json` changes (a hash of all included assets); users get the new SW on next page load.
364
+
365
+ ---
366
+
367
+ ## 14. Anti-patterns
368
+
369
+ 1. **Calling `swPush.requestSubscription()` from `ngOnInit`.** Browsers reject permission requests not tied to user gestures. Wire to a button click.
370
+ 2. **Subscribing on `OnInit` of a lazy module.** Lazy modules instantiate after navigation; user has already missed pushes during navigation. Subscribe in eager AppModule.
371
+ 3. **Sending the Auth Key in push payloads.** Visible in the Service Worker. Use the user's UID as a key into your server.
372
+ 4. **Skipping the SSR guard** in Angular Universal projects. SSR boot crashes.
373
+ 5. **Not unsubscribing on logout.** Previous user keeps getting notifications for the new user's messages.
374
+ 6. **Hardcoding the VAPID public key in `environment.ts`.** It's not secret (it's "public"), but rotate-able is better — read from runtime config.
375
+ 7. **Using `*ngIf="enabled"` based on a local boolean** instead of `swPush.subscription` observable. Multi-tab scenarios get out of sync.
376
+
377
+ ---
378
+
379
+ ## 15. Verification checklist
380
+
381
+ - [ ] `@angular/service-worker` installed via `ng add`
382
+ - [ ] `ngsw-config.json` exists and excludes CometChat API from caching
383
+ - [ ] `ServiceWorkerModule.register('ngsw-worker.js', { enabled: !isDevMode() })` in AppModule
384
+ - [ ] `PushService` injects `SwPush`
385
+ - [ ] `swPush.notificationClicks.subscribe` routes to the conversation
386
+ - [ ] VAPID public key in `environment.ts`; private key in server env (NOT client)
387
+ - [ ] Subscribe via a user-clicked button, not OnInit
388
+ - [ ] Subscription registered AFTER login resolves
389
+ - [ ] Logout unsubscribes BEFORE `CometChatUIKit.logout()`
390
+ - [ ] Server sends `{ notification: {...} }` payload shape (Angular SW format)
391
+ - [ ] CometChat dashboard webhook configured + signature verified
392
+ - [ ] HTTPS or localhost only
393
+ - [ ] `manifest.webmanifest` present for iOS PWA support
394
+ - [ ] Angular Universal: `isPlatformBrowser` guards in PushService
395
+
396
+ ---
397
+
398
+ ## 16. Pointers
399
+
400
+ - `cometchat-react-push` — sister skill; covers VAPID, server-side webhook, iOS PWA caveat in depth
401
+ - `cometchat-angular-core` — login order
402
+ - `cometchat-angular-patterns` — module setup, lazy loading
403
+ - `cometchat-angular-troubleshooting` — SW registration debugging, ngsw issues