@cometchat/skills 4.3.0 → 4.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/bin/install.js +27 -0
- package/package.json +14 -1
- package/skills/cometchat/SKILL.md +233 -69
- package/skills/cometchat/references/asking-questions.md +48 -0
- package/skills/cometchat-a11y/SKILL.md +3 -2
- package/skills/cometchat-android-v5/SKILL.md +2 -1
- package/skills/cometchat-android-v5-calls/SKILL.md +36 -22
- package/skills/cometchat-android-v5-calls/references/README.md +1 -1
- package/skills/cometchat-android-v5-calls/references/add-calls-to-existing-chat.md +7 -5
- package/skills/cometchat-android-v5-calls/references/audio-controls.md +4 -4
- package/skills/cometchat-android-v5-calls/references/call-layouts.md +33 -25
- package/skills/cometchat-android-v5-calls/references/call-session.md +2 -2
- package/skills/cometchat-android-v5-calls/references/custom-ui.md +5 -5
- package/skills/cometchat-android-v5-calls/references/event-listeners.md +2 -2
- package/skills/cometchat-android-v5-calls/references/idle-timeout.md +20 -14
- package/skills/cometchat-android-v5-calls/references/in-call-chat.md +1 -1
- package/skills/cometchat-android-v5-calls/references/migration-v4-to-v5.md +43 -27
- package/skills/cometchat-android-v5-calls/references/participant-management.md +3 -3
- package/skills/cometchat-android-v5-calls/references/raise-hand.md +25 -19
- package/skills/cometchat-android-v5-calls/references/recording.md +2 -2
- package/skills/cometchat-android-v5-calls/references/ringing-integration.md +1 -1
- package/skills/cometchat-android-v5-calls/references/screen-sharing.md +5 -9
- package/skills/cometchat-android-v5-calls/references/session-settings.md +3 -3
- package/skills/cometchat-android-v5-calls/references/setup.md +1 -1
- package/skills/cometchat-android-v5-calls/references/share-invite.md +9 -4
- package/skills/cometchat-android-v5-calls/references/video-controls.md +4 -4
- package/skills/cometchat-android-v5-calls/references/voip-calling.md +2 -2
- package/skills/cometchat-android-v5-components/SKILL.md +4 -3
- package/skills/cometchat-android-v5-core/SKILL.md +5 -3
- package/skills/cometchat-android-v5-customization/SKILL.md +171 -7
- package/skills/cometchat-android-v5-extensions/SKILL.md +7 -4
- package/skills/cometchat-android-v5-features/SKILL.md +5 -4
- package/skills/cometchat-android-v5-placement/SKILL.md +2 -1
- package/skills/cometchat-android-v5-production/SKILL.md +2 -1
- package/skills/cometchat-android-v5-push/SKILL.md +2 -3
- package/skills/cometchat-android-v5-testing/SKILL.md +2 -1
- package/skills/cometchat-android-v5-theming/SKILL.md +2 -1
- package/skills/cometchat-android-v5-troubleshooting/SKILL.md +3 -2
- package/skills/cometchat-android-v6/SKILL.md +2 -1
- package/skills/cometchat-android-v6-builder-settings/SKILL.md +11 -7
- package/skills/cometchat-android-v6-calls/SKILL.md +79 -18
- package/skills/cometchat-android-v6-calls/references/advanced-features.md +87 -0
- package/skills/cometchat-android-v6-calls/references/call-layouts.md +24 -15
- package/skills/cometchat-android-v6-calls/references/call-session.md +2 -2
- package/skills/cometchat-android-v6-calls/references/device-management.md +17 -16
- package/skills/cometchat-android-v6-calls/references/idle-timeout.md +7 -4
- package/skills/cometchat-android-v6-calls/references/in-call-chat.md +13 -8
- package/skills/cometchat-android-v6-calls/references/raise-hand.md +6 -4
- package/skills/cometchat-android-v6-compose-components/SKILL.md +52 -29
- package/skills/cometchat-android-v6-compose-customization/SKILL.md +156 -1
- package/skills/cometchat-android-v6-compose-placement/SKILL.md +129 -40
- package/skills/cometchat-android-v6-compose-theming/SKILL.md +27 -1
- package/skills/cometchat-android-v6-core/SKILL.md +208 -28
- package/skills/cometchat-android-v6-events/SKILL.md +4 -1
- package/skills/cometchat-android-v6-extensions/SKILL.md +2 -1
- package/skills/cometchat-android-v6-features/SKILL.md +26 -2
- package/skills/cometchat-android-v6-kotlin-components/SKILL.md +31 -1
- package/skills/cometchat-android-v6-kotlin-customization/SKILL.md +172 -1
- package/skills/cometchat-android-v6-kotlin-placement/SKILL.md +20 -5
- package/skills/cometchat-android-v6-kotlin-theming/SKILL.md +36 -5
- package/skills/cometchat-android-v6-migration/SKILL.md +44 -42
- package/skills/cometchat-android-v6-production/SKILL.md +6 -3
- package/skills/cometchat-android-v6-push/SKILL.md +43 -2
- package/skills/cometchat-android-v6-testing/SKILL.md +11 -8
- package/skills/cometchat-android-v6-troubleshooting/SKILL.md +26 -5
- package/skills/cometchat-angular-calls/SKILL.md +256 -389
- package/skills/cometchat-angular-calls/references/add-calls-to-existing-chat.md +3 -2
- package/skills/cometchat-angular-calls/references/call-layouts.md +29 -12
- package/skills/cometchat-angular-calls/references/call-session.md +2 -2
- package/skills/cometchat-angular-calls/references/custom-ui.md +18 -10
- package/skills/cometchat-angular-calls/references/device-management.md +53 -34
- package/skills/cometchat-angular-calls/references/group-calls.md +45 -24
- package/skills/cometchat-angular-calls/references/idle-timeout.md +31 -15
- package/skills/cometchat-angular-calls/references/ngzone-and-async-callbacks.md +7 -6
- package/skills/cometchat-angular-calls/references/raise-hand.md +9 -4
- package/skills/cometchat-angular-calls/references/recording-screen-share.md +32 -39
- package/skills/cometchat-angular-calls/references/ringing-integration.md +3 -1
- package/skills/cometchat-angular-calls/references/share-invite.md +11 -5
- package/skills/cometchat-angular-calls/references/virtual-background.md +29 -0
- package/skills/cometchat-angular-components/SKILL.md +149 -620
- package/skills/cometchat-angular-core/SKILL.md +232 -312
- package/skills/cometchat-angular-customization/SKILL.md +415 -223
- package/skills/cometchat-angular-features/SKILL.md +216 -334
- package/skills/cometchat-angular-patterns/SKILL.md +168 -359
- package/skills/cometchat-angular-placement/SKILL.md +189 -560
- package/skills/cometchat-angular-production/SKILL.md +241 -92
- package/skills/cometchat-angular-push/SKILL.md +280 -294
- package/skills/cometchat-angular-testing/SKILL.md +430 -158
- package/skills/cometchat-angular-theming/SKILL.md +190 -265
- package/skills/cometchat-angular-troubleshooting/SKILL.md +192 -157
- package/skills/cometchat-astro-patterns/SKILL.md +2 -1
- package/skills/cometchat-calls/SKILL.md +25 -19
- package/skills/cometchat-calls/references/use-case-broadcast.md +15 -10
- package/skills/cometchat-calls/references/use-case-marketplace.md +2 -3
- package/skills/cometchat-calls/references/use-case-support.md +3 -4
- package/skills/cometchat-calls/references/use-case-team.md +23 -12
- package/skills/cometchat-calls/references/use-case-telehealth.md +3 -4
- package/skills/cometchat-components/SKILL.md +163 -25
- package/skills/cometchat-core/SKILL.md +255 -19
- package/skills/cometchat-customization/SKILL.md +50 -25
- package/skills/cometchat-features/SKILL.md +313 -34
- package/skills/cometchat-flutter-v5/SKILL.md +10 -4
- package/skills/cometchat-flutter-v5-calls/SKILL.md +188 -158
- package/skills/cometchat-flutter-v5-calls/references/add-calls-to-existing-chat.md +48 -24
- package/skills/cometchat-flutter-v5-calls/references/call-layouts.md +20 -15
- package/skills/cometchat-flutter-v5-calls/references/call-session.md +100 -145
- package/skills/cometchat-flutter-v5-calls/references/device-management.md +12 -8
- package/skills/cometchat-flutter-v5-calls/references/group-calls.md +30 -36
- package/skills/cometchat-flutter-v5-calls/references/idle-timeout.md +15 -13
- package/skills/cometchat-flutter-v5-calls/references/in-call-chat.md +12 -9
- package/skills/cometchat-flutter-v5-calls/references/migration-v4-to-v5.md +115 -65
- package/skills/cometchat-flutter-v5-calls/references/raise-hand.md +41 -30
- package/skills/cometchat-flutter-v5-calls/references/ringing-integration.md +17 -14
- package/skills/cometchat-flutter-v5-calls/references/share-invite.md +8 -2
- package/skills/cometchat-flutter-v5-conversations/SKILL.md +2 -1
- package/skills/cometchat-flutter-v5-core/SKILL.md +5 -4
- package/skills/cometchat-flutter-v5-customization/SKILL.md +136 -5
- package/skills/cometchat-flutter-v5-events/SKILL.md +2 -1
- package/skills/cometchat-flutter-v5-messages/SKILL.md +2 -1
- package/skills/cometchat-flutter-v5-production/SKILL.md +15 -6
- package/skills/cometchat-flutter-v5-push/SKILL.md +2 -1
- package/skills/cometchat-flutter-v5-testing/SKILL.md +17 -6
- package/skills/cometchat-flutter-v5-theming/SKILL.md +2 -1
- package/skills/cometchat-flutter-v5-troubleshooting/SKILL.md +7 -6
- package/skills/cometchat-flutter-v5-users-groups/SKILL.md +3 -2
- package/skills/cometchat-flutter-v6/SKILL.md +17 -16
- package/skills/cometchat-flutter-v6-calls/SKILL.md +72 -57
- package/skills/cometchat-flutter-v6-calls/references/add-calls-to-existing-chat.md +5 -3
- package/skills/cometchat-flutter-v6-calls/references/advanced-features.md +89 -0
- package/skills/cometchat-flutter-v6-calls/references/call-layouts.md +15 -12
- package/skills/cometchat-flutter-v6-calls/references/call-session.md +2 -2
- package/skills/cometchat-flutter-v6-calls/references/device-management.md +9 -3
- package/skills/cometchat-flutter-v6-calls/references/group-calls.md +10 -10
- package/skills/cometchat-flutter-v6-calls/references/idle-timeout.md +15 -7
- package/skills/cometchat-flutter-v6-calls/references/in-call-chat.md +6 -3
- package/skills/cometchat-flutter-v6-calls/references/raise-hand.md +23 -16
- package/skills/cometchat-flutter-v6-components/SKILL.md +32 -11
- package/skills/cometchat-flutter-v6-conversations/SKILL.md +39 -11
- package/skills/cometchat-flutter-v6-core/SKILL.md +182 -21
- package/skills/cometchat-flutter-v6-customization/SKILL.md +97 -25
- package/skills/cometchat-flutter-v6-events/SKILL.md +3 -2
- package/skills/cometchat-flutter-v6-features/SKILL.md +15 -6
- package/skills/cometchat-flutter-v6-messages/SKILL.md +111 -60
- package/skills/cometchat-flutter-v6-migration/SKILL.md +18 -25
- package/skills/cometchat-flutter-v6-placement/SKILL.md +79 -50
- package/skills/cometchat-flutter-v6-production/SKILL.md +13 -12
- package/skills/cometchat-flutter-v6-push/SKILL.md +41 -19
- package/skills/cometchat-flutter-v6-testing/SKILL.md +4 -4
- package/skills/cometchat-flutter-v6-theming/SKILL.md +38 -5
- package/skills/cometchat-flutter-v6-troubleshooting/SKILL.md +182 -17
- package/skills/cometchat-flutter-v6-users-groups/SKILL.md +12 -4
- package/skills/cometchat-i18n/SKILL.md +139 -78
- package/skills/cometchat-ios/SKILL.md +4 -2
- package/skills/cometchat-ios-calls/SKILL.md +225 -95
- package/skills/cometchat-ios-calls/references/add-calls-to-existing-chat.md +11 -9
- package/skills/cometchat-ios-calls/references/audio-modes-and-controls.md +45 -0
- package/skills/cometchat-ios-calls/references/avaudiosession-routing.md +6 -7
- package/skills/cometchat-ios-calls/references/call-layouts.md +31 -91
- package/skills/cometchat-ios-calls/references/call-session.md +51 -54
- package/skills/cometchat-ios-calls/references/callkit-and-pushkit.md +33 -29
- package/skills/cometchat-ios-calls/references/custom-ui.md +38 -38
- package/skills/cometchat-ios-calls/references/group-calls.md +33 -70
- package/skills/cometchat-ios-calls/references/idle-timeout.md +24 -25
- package/skills/cometchat-ios-calls/references/in-call-chat.md +19 -23
- package/skills/cometchat-ios-calls/references/migration-v4-to-v5.md +128 -70
- package/skills/cometchat-ios-calls/references/picture-in-picture.md +20 -20
- package/skills/cometchat-ios-calls/references/raise-hand.md +14 -227
- package/skills/cometchat-ios-calls/references/recording-screen-share.md +35 -122
- package/skills/cometchat-ios-calls/references/ringing-integration.md +17 -16
- package/skills/cometchat-ios-calls/references/share-invite.md +8 -12
- package/skills/cometchat-ios-calls/references/swiftui-uikit-hosting.md +4 -4
- package/skills/cometchat-ios-components/SKILL.md +200 -12
- package/skills/cometchat-ios-core/SKILL.md +173 -45
- package/skills/cometchat-ios-customization/SKILL.md +276 -110
- package/skills/cometchat-ios-features/SKILL.md +64 -36
- package/skills/cometchat-ios-placement/SKILL.md +15 -12
- package/skills/cometchat-ios-production/SKILL.md +12 -4
- package/skills/cometchat-ios-push/SKILL.md +53 -19
- package/skills/cometchat-ios-testing/SKILL.md +14 -9
- package/skills/cometchat-ios-theming/SKILL.md +39 -3
- package/skills/cometchat-ios-troubleshooting/SKILL.md +41 -21
- package/skills/cometchat-native-bare-patterns/SKILL.md +34 -17
- package/skills/cometchat-native-calls/SKILL.md +28 -16
- package/skills/cometchat-native-calls/references/add-calls-to-existing-chat.md +2 -2
- package/skills/cometchat-native-calls/references/call-layouts.md +15 -14
- package/skills/cometchat-native-calls/references/call-session.md +2 -2
- package/skills/cometchat-native-calls/references/custom-ui.md +12 -8
- package/skills/cometchat-native-calls/references/device-management.md +53 -30
- package/skills/cometchat-native-calls/references/group-calls.md +35 -30
- package/skills/cometchat-native-calls/references/idle-timeout.md +6 -6
- package/skills/cometchat-native-calls/references/in-call-chat.md +10 -8
- package/skills/cometchat-native-calls/references/migration-v4-to-v5.md +2 -2
- package/skills/cometchat-native-calls/references/raise-hand.md +15 -13
- package/skills/cometchat-native-calls/references/recording-screen-share.md +49 -170
- package/skills/cometchat-native-calls/references/share-invite.md +7 -5
- package/skills/cometchat-native-calls/references/voip-push-end-to-end.md +4 -2
- package/skills/cometchat-native-components/SKILL.md +84 -52
- package/skills/cometchat-native-core/SKILL.md +101 -32
- package/skills/cometchat-native-customization/SKILL.md +150 -28
- package/skills/cometchat-native-expo-patterns/SKILL.md +57 -26
- package/skills/cometchat-native-features/SKILL.md +23 -16
- package/skills/cometchat-native-placement/SKILL.md +19 -10
- package/skills/cometchat-native-production/SKILL.md +9 -3
- package/skills/cometchat-native-push/SKILL.md +2 -1
- package/skills/cometchat-native-testing/SKILL.md +1 -2
- package/skills/cometchat-native-theming/SKILL.md +54 -29
- package/skills/cometchat-native-troubleshooting/SKILL.md +9 -3
- package/skills/cometchat-nextjs-patterns/SKILL.md +20 -6
- package/skills/cometchat-placement/SKILL.md +42 -3
- package/skills/cometchat-production/SKILL.md +12 -5
- package/skills/cometchat-react-calls/SKILL.md +220 -10
- package/skills/cometchat-react-calls/references/add-calls-to-existing-chat.md +4 -3
- package/skills/cometchat-react-calls/references/call-layouts.md +5 -6
- package/skills/cometchat-react-calls/references/call-session.md +1 -1
- package/skills/cometchat-react-calls/references/custom-ui.md +61 -15
- package/skills/cometchat-react-calls/references/device-management.md +55 -51
- package/skills/cometchat-react-calls/references/group-calls.md +18 -23
- package/skills/cometchat-react-calls/references/idle-timeout.md +25 -12
- package/skills/cometchat-react-calls/references/in-call-chat.md +7 -7
- package/skills/cometchat-react-calls/references/migration-v4-to-v5.md +9 -11
- package/skills/cometchat-react-calls/references/raise-hand.md +14 -14
- package/skills/cometchat-react-calls/references/recording-screen-share.md +39 -38
- package/skills/cometchat-react-calls/references/ringing-integration.md +2 -2
- package/skills/cometchat-react-calls/references/share-invite.md +4 -5
- package/skills/cometchat-react-calls/references/testing-calls-on-web.md +20 -2
- package/skills/cometchat-react-calls/references/virtual-background.md +32 -0
- package/skills/cometchat-react-patterns/SKILL.md +44 -4
- package/skills/cometchat-react-push/SKILL.md +258 -72
- package/skills/cometchat-react-router-patterns/SKILL.md +10 -4
- package/skills/cometchat-react-testing/SKILL.md +14 -5
- package/skills/cometchat-theming/SKILL.md +181 -18
- package/skills/cometchat-troubleshooting/SKILL.md +40 -20
|
@@ -1,453 +1,370 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: cometchat-angular-core
|
|
3
|
-
description: "Foundational rules for CometChat Angular UI Kit
|
|
3
|
+
description: "Foundational rules for CometChat Angular UI Kit v5 (@cometchat/chat-uikit-angular@5) — standalone-component setup, UIKitSettingsBuilder init, Promise-based login (bare uid string), loggedInUser$ observable, environment config, CSS-variable theming, and the anti-patterns that break real Angular apps. Read this first."
|
|
4
4
|
license: "MIT"
|
|
5
|
-
compatibility: "Angular >=
|
|
6
|
-
allowed-tools: "shell, file-read, file-search, file-list, ask-user"
|
|
5
|
+
compatibility: "Angular >=17.0.0 <22.0.0 (standalone APIs); @cometchat/chat-uikit-angular ^5.0 (5.0.3 verified — file-based initFromSettings GA); @cometchat/chat-sdk-javascript ^4.1.11; @cometchat/calls-sdk-javascript ^5.0 (optional peer — calls only); dompurify ^3"
|
|
7
6
|
metadata:
|
|
8
7
|
author: "CometChat"
|
|
9
|
-
version: "
|
|
10
|
-
tags: "cometchat angular typescript core init login uikit
|
|
8
|
+
version: "4.0.0"
|
|
9
|
+
tags: "cometchat angular typescript core init login standalone uikit environment provider v5"
|
|
11
10
|
---
|
|
12
11
|
|
|
13
12
|
## Purpose
|
|
14
13
|
|
|
15
|
-
|
|
14
|
+
Foundational skill for every CometChat **Angular UI Kit v5** (`@cometchat/chat-uikit-angular@5`) integration. It teaches HOW CometChat works in Angular v5 — initialization order, the `UIKitSettingsBuilder` pattern, login, environment config, **standalone-component** wiring, and the anti-patterns that break real apps.
|
|
16
15
|
|
|
17
|
-
**
|
|
16
|
+
**Angular UI Kit v5 is standalone-component-based and requires Angular 17–21.** This is a hard requirement — the package's peer range is `@angular/core` / `@angular/common` `>=17.0.0 <22.0.0`. Projects on older Angular must upgrade before using UI Kit v5.
|
|
18
17
|
|
|
19
|
-
**Read this skill first, before any placement or patterns skill.**
|
|
18
|
+
**Read this skill first, before any placement, components, or patterns skill.**
|
|
20
19
|
|
|
21
|
-
Ground truth:
|
|
20
|
+
Ground truth: `@cometchat/chat-uikit-angular@5.0.3` kit source (`projects/cometchat-uikit/src/lib`) + `docs/ui-kit/angular`. **Official docs:** https://www.cometchat.com/docs/ui-kit/angular/overview · **Docs MCP:** `claude mcp add --transport http cometchat-docs https://www.cometchat.com/docs/mcp` (or fetch the URL directly without MCP). Verify any non-obvious symbol against the installed package types before relying on it.
|
|
22
21
|
|
|
23
22
|
---
|
|
24
23
|
|
|
25
|
-
##
|
|
24
|
+
## 2. Install
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
npm install @cometchat/chat-uikit-angular@^5
|
|
28
|
+
# Calls features only — also install the calls SDK peer:
|
|
29
|
+
npm install @cometchat/calls-sdk-javascript@^5
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
> ⚠️ **Angular 22 is NOT supported — pin the CLI to 21 when scaffolding (verified — real `npm install` ERESOLVE).** The kit's peer range is `@angular/core`/`@angular/common` `>=17.0.0 <22.0.0`. `npx @angular/cli@latest new …` now installs Angular **22**, so `npm install @cometchat/chat-uikit-angular@^5` then hard-fails with `ERESOLVE … peer @angular/common@">=17.0.0 <22.0.0"`. For a fresh project scaffold with a supported major: `npx -y @angular/cli@21 new <app> …` (Angular 17–21 all work). Existing projects on 22 must stay on the prior major until the kit widens its range.
|
|
33
|
+
|
|
34
|
+
> ⚠️ **`ng build` (production) fails the default bundle budget — raise it.** The kit's initial bundle is ~3.78 MB; Angular's default production `budgets` cap `initial` at 1 MB `maximumError`, so the literal `ng build` exits non-zero with `bundle initial exceeded maximum budget`. In `angular.json` raise (or remove) the `initial` budget — e.g. set `maximumError` to `5mb` — or build with `--configuration development` while iterating. This is a guaranteed failure otherwise; it is not a problem with your code.
|
|
35
|
+
|
|
36
|
+
The chat SDK (`@cometchat/chat-sdk-javascript@^4.1.8`), `dompurify@^3`, and (for calls only) the calls SDK are peer deps. `@cometchat/calls-sdk-javascript` is an **optional** peer — npm won't auto-install it; add it yourself when you need calling. There is **no** `@cometchat/uikit-shared` / `-elements` / `-resources` in v5 — do not install or import them.
|
|
37
|
+
|
|
38
|
+
### Stylesheet (mandatory — layout + tokens break without it)
|
|
39
|
+
|
|
40
|
+
Add the kit's CSS-variable stylesheet via `angular.json` → `...build.options.styles` (**use this form** — it's the one that builds):
|
|
41
|
+
|
|
42
|
+
```json
|
|
43
|
+
"styles": [
|
|
44
|
+
"src/styles.css",
|
|
45
|
+
"node_modules/@cometchat/chat-uikit-angular/styles/css-variables.css"
|
|
46
|
+
]
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
> ⚠️ **Do NOT use the `@import` package-specifier form on Angular 17+** (the default `@angular/build` esbuild builder). `@import '@cometchat/chat-uikit-angular/styles/css-variables.css';` fails the build — `Could not resolve … the path "./styles/css-variables.css" is not exported by package` — because the package `exports` map only exposes `.` and `./package.json`. The `angular.json` `styles` array above works because the full `node_modules/...` path bypasses the exports map. (Verified — real `ng build`.)
|
|
50
|
+
|
|
51
|
+
### Assets (mandatory — icons break without it)
|
|
52
|
+
|
|
53
|
+
`angular.json` → `projects.<app>.architect.build.options.assets`:
|
|
54
|
+
|
|
55
|
+
```json
|
|
56
|
+
{
|
|
57
|
+
"glob": "**/*",
|
|
58
|
+
"input": "node_modules/@cometchat/chat-uikit-angular/src/lib/assets",
|
|
59
|
+
"output": "assets"
|
|
60
|
+
}
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
The kit ships its SVG icons under `src/lib/assets` in the published package — map that to `output: assets`. Missing this = broken icons throughout the kit. It's the most commonly missed step.
|
|
64
|
+
|
|
65
|
+
---
|
|
66
|
+
|
|
67
|
+
## 3. The init → login → render order
|
|
26
68
|
|
|
27
69
|
CometChat Angular has exactly one valid lifecycle:
|
|
28
70
|
|
|
29
71
|
```
|
|
30
|
-
CometChatUIKit.init(UIKitSettings) → CometChatUIKit.login(
|
|
72
|
+
CometChatUIKit.init(UIKitSettings) → CometChatUIKit.login(uid) → render <cometchat-*> components
|
|
31
73
|
```
|
|
32
74
|
|
|
33
|
-
Breaking this order produces a blank component, a "CometChat is not initialized" console error, or a hung login.
|
|
75
|
+
Both `init()` and `login()` return **Promises**. Breaking this order produces a blank component, a "CometChat is not initialized" console error, or a hung login.
|
|
76
|
+
|
|
77
|
+
### File-based init with `cometchat-settings.json` (recommended where available)
|
|
34
78
|
|
|
35
|
-
|
|
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"`. It ships GA in **`@cometchat/chat-uikit-angular >= 5.0.3`** + **`@cometchat/chat-sdk-javascript >= 4.1.11`** (npm `latest`). On an older kit (`<= 5.0.2`) the method does not exist — only the `UIKitSettingsBuilder` + `init()` path below works (reporting `integrationSource = "manual"`); use that fallback. (The kit routes `initFromSettings` to the SDK's `CometChat.initFromSettings`, which stamps `ai-agent` — plain `init(settings)` does not; ENG-36203.)
|
|
36
80
|
|
|
37
|
-
|
|
81
|
+
**Step 1 — create `cometchat-settings.json` at the project root** (e.g. alongside `angular.json`). Fill `appId` / `region` / `credentials.authKey` from the CLI `provision setup` output; leave the rest at the defaults:
|
|
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 in `main.ts` by importing the JSON.** Angular CLI projects have `resolveJsonModule: true` by default, so the import is type-safe:
|
|
38
112
|
|
|
39
113
|
```typescript
|
|
40
|
-
|
|
114
|
+
// main.ts — initFromSettings ships GA in @cometchat/chat-uikit-angular >= 5.0.3 (ENG-35866)
|
|
115
|
+
import { bootstrapApplication } from "@angular/platform-browser";
|
|
41
116
|
import { CometChatUIKit } from "@cometchat/chat-uikit-angular";
|
|
117
|
+
import { AppComponent } from "./app/app.component";
|
|
118
|
+
import { appConfig } from "./app/app.config";
|
|
119
|
+
import cometchatSettings from "../cometchat-settings.json";
|
|
120
|
+
|
|
121
|
+
CometChatUIKit.initFromSettings(cometchatSettings)
|
|
122
|
+
.then(() => bootstrapApplication(AppComponent, appConfig))
|
|
123
|
+
.catch((err) => console.error("CometChat init failed:", err));
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
- **Do NOT gitignore `cometchat-settings.json`.** The dev-mode `authKey` ships in the built bundle either way; production uses server-minted auth tokens.
|
|
127
|
+
|
|
128
|
+
### UIKitSettingsBuilder — the init pattern (fallback — published kit; reports `manual`)
|
|
129
|
+
|
|
130
|
+
`UIKitSettingsBuilder` and `UIKitSettings` are exported from **`@cometchat/chat-uikit-angular`** (not `uikit-shared`, which no longer exists):
|
|
131
|
+
|
|
132
|
+
```typescript
|
|
133
|
+
import { UIKitSettingsBuilder, CometChatUIKit } from "@cometchat/chat-uikit-angular";
|
|
42
134
|
import { environment } from "../environments/environment";
|
|
43
135
|
|
|
44
|
-
const
|
|
136
|
+
const settings = new UIKitSettingsBuilder()
|
|
45
137
|
.setAppId(environment.cometchat.appId)
|
|
46
|
-
.setRegion(environment.cometchat.region)
|
|
47
|
-
.setAuthKey(environment.cometchat.authKey)
|
|
138
|
+
.setRegion(environment.cometchat.region) // "us" | "eu" | "in"
|
|
139
|
+
.setAuthKey(environment.cometchat.authKey) // dev only — omit in production
|
|
48
140
|
.subscribePresenceForAllUsers()
|
|
49
141
|
.build();
|
|
50
142
|
|
|
51
|
-
CometChatUIKit.init(
|
|
52
|
-
.then(() => {
|
|
53
|
-
console.log("CometChat initialized");
|
|
54
|
-
// Now safe to call login
|
|
55
|
-
})
|
|
56
|
-
.catch(console.error);
|
|
143
|
+
const initPromise = CometChatUIKit.init(settings); // Promise<InitResult> | undefined
|
|
57
144
|
```
|
|
58
145
|
|
|
59
|
-
|
|
146
|
+
> `init()` returns `Promise<InitResult> | undefined` (it returns `undefined` if settings are missing/invalid). Guard for the `undefined` case rather than blindly `.then()`-ing the result.
|
|
60
147
|
|
|
61
|
-
|
|
148
|
+
Builder methods (verified against v5 `UIKitSettings.ts`): `setAppId`, `setRegion`, `setAuthKey`, `subscribePresenceForAllUsers`, `subscribePresenceForFriends`, `subscribePresenceForRoles(roles)`, `setRoles(roles)`, `setAutoEstablishSocketConnection(bool)`, `setAdminHost`, `setClientHost`, `setStorageMode`, `setCallingEnabled(bool)`, `setCallAppSettings`, `build()`.
|
|
62
149
|
|
|
63
|
-
|
|
150
|
+
### Init must run once, before any chat component renders
|
|
64
151
|
|
|
65
|
-
|
|
66
|
-
// app.component.ts
|
|
67
|
-
import { Component, OnInit } from "@angular/core";
|
|
68
|
-
import { UIKitSettingsBuilder } from "@cometchat/uikit-shared";
|
|
69
|
-
import { CometChatUIKit } from "@cometchat/chat-uikit-angular";
|
|
70
|
-
import { environment } from "../environments/environment";
|
|
152
|
+
The canonical pattern (used by both the docs and the kit's own sample app) is to **init in `main.ts` and only bootstrap the Angular app once init resolves.** Do NOT init inside a lazily-loaded route that mounts after a `<cometchat-*>` component could already be on screen.
|
|
71
153
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
.
|
|
90
|
-
|
|
91
|
-
return CometChatUIKit.login({ uid: "cometchat-uid-1" });
|
|
92
|
-
}
|
|
93
|
-
return user;
|
|
94
|
-
})
|
|
95
|
-
.then(() => {
|
|
96
|
-
this.isReady = true;
|
|
97
|
-
})
|
|
98
|
-
.catch(console.error);
|
|
99
|
-
}
|
|
154
|
+
```typescript
|
|
155
|
+
// main.ts (Angular 17+ standalone bootstrap)
|
|
156
|
+
import { bootstrapApplication } from "@angular/platform-browser";
|
|
157
|
+
import { UIKitSettingsBuilder, CometChatUIKit } from "@cometchat/chat-uikit-angular";
|
|
158
|
+
import { AppComponent } from "./app/app.component";
|
|
159
|
+
import { appConfig } from "./app/app.config";
|
|
160
|
+
import { environment } from "./environments/environment";
|
|
161
|
+
|
|
162
|
+
// Fail loud if environment.cometchat values are EMPTY (env block missing, or
|
|
163
|
+
// the wrong environment file picked at build). Note: this catches empty/unset
|
|
164
|
+
// only — a non-empty placeholder like "YOUR_APP_ID" is truthy and passes, so
|
|
165
|
+
// still paste real values. Otherwise empty creds surface later as a cryptic
|
|
166
|
+
// init failure. (audit P0-5)
|
|
167
|
+
const cc = environment.cometchat;
|
|
168
|
+
if (!cc?.appId || !cc?.region || !cc?.authKey) {
|
|
169
|
+
throw new Error(
|
|
170
|
+
"CometChat credentials are empty in environment.cometchat — fill appId/region/authKey " +
|
|
171
|
+
"in src/environments/environment.ts (and environment.prod.ts).",
|
|
172
|
+
);
|
|
100
173
|
}
|
|
101
|
-
```
|
|
102
174
|
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
175
|
+
const settings = new UIKitSettingsBuilder()
|
|
176
|
+
.setAppId(cc.appId)
|
|
177
|
+
.setRegion(cc.region)
|
|
178
|
+
.setAuthKey(cc.authKey)
|
|
179
|
+
.subscribePresenceForAllUsers()
|
|
180
|
+
.build();
|
|
181
|
+
|
|
182
|
+
// `init(...)` is typed `Promise<InitResult> | undefined` in v5.0.2, so coalesce to a
|
|
183
|
+
// Promise before chaining — `init(settings)?.then(...).catch(...)` still leaves the
|
|
184
|
+
// `.catch` on a possibly-undefined value and fails `tsc` strict (TS2532) on Angular 21.
|
|
185
|
+
(CometChatUIKit.init(settings) ?? Promise.resolve())
|
|
186
|
+
.then(() => {
|
|
187
|
+
bootstrapApplication(AppComponent, appConfig).catch((err) => console.error(err));
|
|
188
|
+
})
|
|
189
|
+
.catch((err) => console.error("CometChat init failed:", err));
|
|
108
190
|
```
|
|
109
191
|
|
|
110
|
-
|
|
192
|
+
Bootstrapping only after init resolves means every component that mounts afterward can safely assume CometChat is initialized. Login (dev user or token) then happens in the root component / a route guard / an auth service — see §4.
|
|
193
|
+
|
|
194
|
+
> **Filename convention — modern CLI scaffolds differ from these examples.** Examples here use the classic `AppComponent` in `src/app/app.component.ts`. Angular CLI 17+ (and 21) scaffolds the root component as **`App`** in `src/app/app.ts` (no `.component` suffix), with `app.config.ts` + `app.routes.ts`. On a freshly-scaffolded project, import `App` (not `AppComponent`) from `./app/app` and adapt the filenames — the wiring is identical, only the names changed.
|
|
195
|
+
|
|
196
|
+
> **Alternative — `APP_INITIALIZER`:** if you prefer to bootstrap unconditionally and block on a DI provider, register an `APP_INITIALIZER` factory that returns the `CometChatUIKit.init(settings)` Promise. Angular blocks bootstrap until it resolves. Either way the rule holds: init must finish before any `<cometchat-*>` renders.
|
|
111
197
|
|
|
112
198
|
---
|
|
113
199
|
|
|
114
|
-
##
|
|
200
|
+
## 4. Login
|
|
115
201
|
|
|
116
|
-
### Development mode
|
|
202
|
+
### Development mode — `login(uid)` takes a BARE STRING
|
|
117
203
|
|
|
118
204
|
```typescript
|
|
119
205
|
import { CometChatUIKit } from "@cometchat/chat-uikit-angular";
|
|
120
206
|
|
|
121
|
-
CometChatUIKit.getLoggedinUser()
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
console.log("Login successful:", loggedInUser);
|
|
126
|
-
})
|
|
127
|
-
.catch(console.error);
|
|
128
|
-
}
|
|
129
|
-
});
|
|
207
|
+
const user = await CometChatUIKit.getLoggedinUser(); // async getter → Promise<User | null>
|
|
208
|
+
if (!user) {
|
|
209
|
+
await CometChatUIKit.login("cometchat-uid-1"); // ← bare string, NOT { uid: "..." }
|
|
210
|
+
}
|
|
130
211
|
```
|
|
131
212
|
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
**⚠️ `login()` takes an object `{ uid: "..." }`, not a bare string.** Passing `"cometchat-uid-1"` directly throws a type error in TypeScript and silently fails in JavaScript.
|
|
213
|
+
> `login()` takes a **string** uid, not an object — its signature is `login(uid: string): Promise<CometChat.User>`. Passing `{ uid: "..." }` fails type-checking. (Token login is a separate method — see Production.)
|
|
135
214
|
|
|
136
|
-
|
|
215
|
+
Every new CometChat app ships 5 pre-seeded test users — `cometchat-uid-1` … `cometchat-uid-5`.
|
|
137
216
|
|
|
138
|
-
|
|
217
|
+
### Reading the current user — three options
|
|
139
218
|
|
|
140
219
|
```typescript
|
|
141
|
-
//
|
|
142
|
-
const user =
|
|
143
|
-
const myUid = user?.getUid();
|
|
144
|
-
|
|
145
|
-
// Sync — use in guards, components, and anywhere after login completes
|
|
146
|
-
import { CometChatUIKitLoginListener } from "@cometchat/chat-uikit-angular";
|
|
147
|
-
const user = CometChatUIKitLoginListener.getLoggedInUser(); // note capital 'I' in 'In'
|
|
148
|
-
const myUid = user?.getUid();
|
|
149
|
-
```
|
|
150
|
-
|
|
151
|
-
**Default to the sync version** in components and route guards — by the time they run, login is already complete. Use the async version only inside the init/login flow itself.
|
|
220
|
+
// 1. Sync getter — use in components, route guards, anywhere after login completes:
|
|
221
|
+
const user = CometChatUIKit.getLoggedInUser(); // User | null (note capital "In")
|
|
152
222
|
|
|
153
|
-
|
|
223
|
+
// 2. Async getter — use inside the init/login flow:
|
|
224
|
+
const user = await CometChatUIKit.getLoggedinUser(); // Promise<User | null> (note lowercase "in")
|
|
154
225
|
|
|
155
|
-
|
|
226
|
+
// 3. Reactive (idiomatic Angular) — react to login/logout in templates with the async pipe:
|
|
227
|
+
CometChatUIKit.loggedInUser$.subscribe(u => this.currentUser = u);
|
|
228
|
+
```
|
|
156
229
|
|
|
157
|
-
|
|
230
|
+
`CometChatUIKitLoginListener` exists only as an **internal** kit class — it is not exported from `@cometchat/chat-uikit-angular`'s public API and has no public `getLoggedInUser()`. Use the static getters or the `loggedInUser$` observable instead. Never hardcode a UID to identify the current user — in production it comes from your auth system.
|
|
158
231
|
|
|
159
|
-
###
|
|
232
|
+
### Production mode
|
|
160
233
|
|
|
161
234
|
```typescript
|
|
162
|
-
CometChatUIKit.
|
|
163
|
-
// Navigate to login page
|
|
164
|
-
});
|
|
235
|
+
await CometChatUIKit.loginWithAuthToken(tokenFromYourBackend);
|
|
165
236
|
```
|
|
166
237
|
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
## 3. Module setup (mandatory)
|
|
238
|
+
The backend mints the token via the CometChat REST API using the server-only **REST API Key**. See `cometchat-angular-production`.
|
|
170
239
|
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
### AppModule setup
|
|
240
|
+
### Logout
|
|
174
241
|
|
|
175
242
|
```typescript
|
|
176
|
-
//
|
|
177
|
-
import { CUSTOM_ELEMENTS_SCHEMA, NgModule } from "@angular/core";
|
|
178
|
-
import { BrowserModule } from "@angular/platform-browser";
|
|
179
|
-
import { BrowserAnimationsModule } from "@angular/platform-browser/animations";
|
|
180
|
-
import {
|
|
181
|
-
CometChatConversationsWithMessages,
|
|
182
|
-
CometChatConversations,
|
|
183
|
-
CometChatMessages,
|
|
184
|
-
CometChatMessageHeader,
|
|
185
|
-
CometChatMessageList,
|
|
186
|
-
CometChatMessageComposer,
|
|
187
|
-
CometChatUsers,
|
|
188
|
-
CometChatGroups,
|
|
189
|
-
} from "@cometchat/chat-uikit-angular";
|
|
190
|
-
import { AppComponent } from "./app.component";
|
|
191
|
-
|
|
192
|
-
@NgModule({
|
|
193
|
-
imports: [
|
|
194
|
-
BrowserModule,
|
|
195
|
-
BrowserAnimationsModule,
|
|
196
|
-
// Import only the CometChat components you use
|
|
197
|
-
CometChatConversationsWithMessages,
|
|
198
|
-
CometChatConversations,
|
|
199
|
-
CometChatMessages,
|
|
200
|
-
CometChatMessageHeader,
|
|
201
|
-
CometChatMessageList,
|
|
202
|
-
CometChatMessageComposer,
|
|
203
|
-
CometChatUsers,
|
|
204
|
-
CometChatGroups,
|
|
205
|
-
],
|
|
206
|
-
declarations: [AppComponent],
|
|
207
|
-
providers: [],
|
|
208
|
-
bootstrap: [AppComponent],
|
|
209
|
-
schemas: [CUSTOM_ELEMENTS_SCHEMA], // Required for web components
|
|
210
|
-
})
|
|
211
|
-
export class AppModule {}
|
|
243
|
+
await CometChatUIKit.logout(); // Promise<LogoutResult> — then navigate to your login route
|
|
212
244
|
```
|
|
213
245
|
|
|
214
|
-
|
|
246
|
+
---
|
|
247
|
+
|
|
248
|
+
## 5. Using components — standalone imports (no NgModule, no schema)
|
|
215
249
|
|
|
216
|
-
|
|
250
|
+
v5 components are **standalone Angular components**. Import the component *class* into the `imports: []` of whatever standalone component renders it. They are real Angular components (not generic web components), so **`CUSTOM_ELEMENTS_SCHEMA` is NOT needed** — and there is no NgModule to register.
|
|
217
251
|
|
|
218
252
|
```typescript
|
|
219
253
|
// chat.component.ts
|
|
220
254
|
import { Component } from "@angular/core";
|
|
221
|
-
import {
|
|
222
|
-
import { CometChatConversations } from "@cometchat/chat-uikit-angular";
|
|
223
|
-
import { CUSTOM_ELEMENTS_SCHEMA } from "@angular/core";
|
|
255
|
+
import { CometChatConversationsComponent } from "@cometchat/chat-uikit-angular";
|
|
224
256
|
|
|
225
257
|
@Component({
|
|
226
258
|
selector: "app-chat",
|
|
227
259
|
standalone: true,
|
|
228
|
-
imports: [
|
|
229
|
-
schemas: [CUSTOM_ELEMENTS_SCHEMA],
|
|
260
|
+
imports: [CometChatConversationsComponent], // import the class you use; no schema
|
|
230
261
|
template: `<cometchat-conversations></cometchat-conversations>`,
|
|
231
262
|
})
|
|
232
263
|
export class ChatComponent {}
|
|
233
264
|
```
|
|
234
265
|
|
|
235
|
-
|
|
266
|
+
- Class names carry the **`Component`** suffix (`CometChatConversationsComponent`); the **HTML selectors do not** (`<cometchat-conversations>`).
|
|
267
|
+
- Import only the components you actually use.
|
|
268
|
+
- There is **no composite** `<cometchat-conversations-with-messages>` in v5 — build a two-pane layout by composing `cometchat-conversations` with `cometchat-message-header` / `-list` / `-composer` (see `cometchat-angular-placement`).
|
|
236
269
|
|
|
237
|
-
|
|
270
|
+
> Using an NgModule-based app (not yet migrated to standalone)? You can still add these standalone classes to an `@NgModule({ imports: [...] })` — standalone components are importable into NgModules. You still do **not** need `CUSTOM_ELEMENTS_SCHEMA`.
|
|
238
271
|
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
```json
|
|
242
|
-
// angular.json — inside build.options.assets
|
|
243
|
-
"assets": [
|
|
244
|
-
"src/favicon.ico",
|
|
245
|
-
"src/assets",
|
|
246
|
-
{
|
|
247
|
-
"glob": "**/*",
|
|
248
|
-
"input": "./node_modules/@cometchat/chat-uikit-angular/assets/",
|
|
249
|
-
"output": "assets/"
|
|
250
|
-
}
|
|
251
|
-
]
|
|
252
|
-
```
|
|
253
|
-
|
|
254
|
-
**⚠️ Missing assets config = broken icons throughout the UI Kit.** This is the most commonly missed setup step. Always verify `angular.json` before debugging icon issues.
|
|
272
|
+
See `cometchat-angular-components` for the full catalog of selectors, `@Input`/`@Output` bindings, and slot templates.
|
|
255
273
|
|
|
256
274
|
---
|
|
257
275
|
|
|
258
|
-
##
|
|
259
|
-
|
|
260
|
-
Angular does not use `.env` files or `process.env`. Configuration lives in `src/environments/environment.ts` (TypeScript constant objects).
|
|
276
|
+
## 6. Environment variables
|
|
261
277
|
|
|
262
|
-
|
|
278
|
+
Angular has no `.env` / `process.env`. Config lives in `src/environments/environment.ts`.
|
|
263
279
|
|
|
264
280
|
```typescript
|
|
265
|
-
// src/environments/environment.ts
|
|
281
|
+
// src/environments/environment.ts (development)
|
|
266
282
|
export const environment = {
|
|
267
283
|
production: false,
|
|
268
284
|
cometchat: {
|
|
269
285
|
appId: "YOUR_APP_ID",
|
|
270
|
-
region: "us",
|
|
271
|
-
authKey: "YOUR_AUTH_KEY",
|
|
286
|
+
region: "us", // "us" | "eu" | "in"
|
|
287
|
+
authKey: "YOUR_AUTH_KEY", // dev only — never in production builds
|
|
272
288
|
},
|
|
273
289
|
};
|
|
274
290
|
```
|
|
275
291
|
|
|
276
292
|
```typescript
|
|
277
|
-
// src/environments/environment.prod.ts
|
|
293
|
+
// src/environments/environment.prod.ts (production)
|
|
278
294
|
export const environment = {
|
|
279
295
|
production: true,
|
|
280
296
|
cometchat: {
|
|
281
297
|
appId: "YOUR_APP_ID",
|
|
282
298
|
region: "us",
|
|
283
|
-
// No authKey in production —
|
|
299
|
+
// No authKey in production — mint auth tokens server-side
|
|
284
300
|
tokenEndpoint: "https://api.yourapp.com/cometchat-token",
|
|
285
301
|
},
|
|
286
302
|
};
|
|
287
303
|
```
|
|
288
304
|
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
### Using environment values
|
|
292
|
-
|
|
293
|
-
```typescript
|
|
294
|
-
import { environment } from "../environments/environment";
|
|
295
|
-
|
|
296
|
-
// In your component or service:
|
|
297
|
-
const appId = environment.cometchat.appId;
|
|
298
|
-
```
|
|
299
|
-
|
|
300
|
-
Angular's build system automatically swaps `environment.ts` for `environment.prod.ts` when building with `--configuration production`.
|
|
305
|
+
**Never put the REST API Key in any environment file.** Angular bundles `environment.ts` into client JS — the REST API Key is server-only.
|
|
301
306
|
|
|
302
307
|
---
|
|
303
308
|
|
|
304
|
-
##
|
|
309
|
+
## 7. Theming — CSS variables (no theme service)
|
|
305
310
|
|
|
306
|
-
|
|
311
|
+
v5 has **no `CometChatThemeService`** and no programmatic palette API. Theming is done with CSS custom properties (`--cometchat-*`), the same model as the React kit. Light/dark mode is a single setter:
|
|
307
312
|
|
|
308
313
|
```typescript
|
|
309
|
-
|
|
310
|
-
import { CometChatThemeService } from "@cometchat/chat-uikit-angular";
|
|
311
|
-
|
|
312
|
-
@Component({ selector: "app-root", templateUrl: "./app.component.html" })
|
|
313
|
-
export class AppComponent {
|
|
314
|
-
constructor(private themeService: CometChatThemeService) {
|
|
315
|
-
// Set mode: "light" | "dark"
|
|
316
|
-
themeService.theme.palette.setMode("light");
|
|
317
|
-
// Set primary brand color
|
|
318
|
-
themeService.theme.palette.setPrimary({ light: "#6851D6", dark: "#6851D6" });
|
|
319
|
-
}
|
|
320
|
-
}
|
|
314
|
+
CometChatUIKit.themeMode = "dark"; // 'light' | 'dark'
|
|
321
315
|
```
|
|
322
316
|
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
```bash
|
|
330
|
-
npm install @cometchat/chat-uikit-angular
|
|
331
|
-
npm install @cometchat/uikit-elements @cometchat/uikit-resources @cometchat/uikit-shared
|
|
332
|
-
```
|
|
333
|
-
|
|
334
|
-
The UI Kit depends on `@cometchat/chat-sdk-javascript` (installed automatically as a peer dep). Do NOT install `@cometchat/chat-sdk-javascript` separately unless you need a specific version — let the UI Kit manage it.
|
|
335
|
-
|
|
336
|
-
### Peer dependencies
|
|
337
|
-
|
|
338
|
-
```bash
|
|
339
|
-
# Required for Angular animations (used by some UI Kit components)
|
|
340
|
-
npm install @angular/animations
|
|
317
|
+
```css
|
|
318
|
+
/* styles.css — override brand + tokens globally */
|
|
319
|
+
:root {
|
|
320
|
+
--cometchat-primary-color: #6852D6;
|
|
321
|
+
}
|
|
341
322
|
```
|
|
342
323
|
|
|
343
|
-
|
|
324
|
+
See `cometchat-angular-theming` for the full CSS-variable token reference and dark-mode strategy. Do **not** reach for `CometChatThemeService` / `theme.palette.setPrimary()` — no such programmatic palette API exists; theming is CSS-variable only.
|
|
344
325
|
|
|
345
326
|
---
|
|
346
327
|
|
|
347
328
|
## 8. Anti-patterns
|
|
348
329
|
|
|
349
|
-
1. **
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
6. **Do NOT render `<cometchat-*>` components before `isReady`.** Gate on the init + login promise resolving. Use `*ngIf="isReady"` on the container.
|
|
360
|
-
|
|
361
|
-
7. **Do NOT call `login()` with a bare string.** It takes `{ uid: "..." }` or `{ authToken: "..." }`.
|
|
362
|
-
|
|
363
|
-
8. **Do NOT import `@cometchat/chat-sdk-javascript` directly** unless you need SDK-level access (e.g., `CometChat.getUser(uid)`). The UI Kit re-exports the SDK's `CometChat` namespace — import from `@cometchat/chat-sdk-javascript` only when you need the raw SDK.
|
|
364
|
-
|
|
365
|
-
9. **Do NOT forget `BrowserAnimationsModule`** in `AppModule`. Some UI Kit components use Angular animations; missing this module causes runtime errors.
|
|
366
|
-
|
|
367
|
-
10. **Do NOT bundle `REST_API_KEY` in any Angular file.** Angular bundles everything in `src/` into the client JavaScript. Server-only keys belong on your backend.
|
|
330
|
+
1. **Don't target Angular ≤16.** UI Kit v5's peer range is Angular 17–21 (`>=17.0.0 <22.0.0`). On older Angular, upgrade before integrating.
|
|
331
|
+
2. **Don't install or import `@cometchat/uikit-shared` / `-elements` / `-resources`.** They don't exist in the v5 dependency set — everything is in `@cometchat/chat-uikit-angular`.
|
|
332
|
+
3. **Don't add `CUSTOM_ELEMENTS_SCHEMA`** for CometChat components — they are real Angular components (not generic web components), so the schema is unnecessary.
|
|
333
|
+
4. **Don't call `login({ uid })`.** v5 takes a bare string: `login("cometchat-uid-1")`.
|
|
334
|
+
5. **Don't use `CometChatUIKitLoginListener`** — it's an internal class, not public API. Use `CometChatUIKit.getLoggedInUser()` / `getLoggedinUser()` / `loggedInUser$`.
|
|
335
|
+
6. **Don't use `CometChatThemeService`** — it doesn't exist in v5. Theme via CSS variables + `themeMode`.
|
|
336
|
+
7. **Don't reach for `<cometchat-conversations-with-messages>`** — removed in v5. Compose the layout from the individual components.
|
|
337
|
+
8. **Don't init inside a lazy-loaded route.** Init must complete before any `<cometchat-*>` renders — use `APP_INITIALIZER` or gate on an `isReady` flag.
|
|
338
|
+
9. **Don't render `<cometchat-*>` before init+login resolve.** Gate with `*ngIf`.
|
|
339
|
+
10. **Don't bundle the REST API Key** in any `src/` file — Angular ships `src/` to the client.
|
|
368
340
|
|
|
369
341
|
---
|
|
370
342
|
|
|
371
|
-
## 9.
|
|
372
|
-
|
|
373
|
-
### i18n (translations)
|
|
374
|
-
|
|
375
|
-
The Angular UI Kit ships `CometChatLocalize` for built-in translations (~40 languages). Initialize it once alongside `CometChatUIKit.init()`:
|
|
376
|
-
|
|
377
|
-
```typescript
|
|
378
|
-
import { CometChatLocalize } from "@cometchat/chat-uikit-angular";
|
|
379
|
-
|
|
380
|
-
// In AppComponent.ngOnInit, after init resolves:
|
|
381
|
-
CometChatLocalize.init("es"); // "fr", "de", "ar", "hi", etc.
|
|
382
|
-
```
|
|
383
|
-
|
|
384
|
-
To override specific strings, pass a resources object as the second positional argument:
|
|
385
|
-
|
|
386
|
-
```typescript
|
|
387
|
-
CometChatLocalize.init("en", {
|
|
388
|
-
en: {
|
|
389
|
-
"type a message": "Write your message…",
|
|
390
|
-
},
|
|
391
|
-
});
|
|
392
|
-
```
|
|
343
|
+
## 9. SDK access
|
|
393
344
|
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
The UI Kit reads `dir="rtl"` from the document root. Set it in `index.html` or toggle it dynamically:
|
|
397
|
-
|
|
398
|
-
```html
|
|
399
|
-
<!-- index.html -->
|
|
400
|
-
<html dir="rtl" lang="ar">
|
|
401
|
-
```
|
|
345
|
+
For raw SDK calls (e.g. `CometChat.getUser(uid)`), import the `CometChat` namespace directly from the chat SDK peer dependency:
|
|
402
346
|
|
|
403
347
|
```typescript
|
|
404
|
-
|
|
405
|
-
document.documentElement.setAttribute("dir", isRtl ? "rtl" : "ltr");
|
|
348
|
+
import { CometChat } from "@cometchat/chat-sdk-javascript";
|
|
406
349
|
```
|
|
407
350
|
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
### Accessibility
|
|
411
|
-
|
|
412
|
-
Default components ship with `aria-label` on icon-only buttons, `role="listbox"` on lists, and keyboard navigation (`Tab`, `Enter`, `Esc`). When writing custom `ng-template` slot views:
|
|
413
|
-
|
|
414
|
-
1. **Icon-only buttons** — add `aria-label="<verb>"` (e.g. `aria-label="Send message"`)
|
|
415
|
-
2. **Custom list items** — keep `role="option"` + `aria-selected` on the wrapper
|
|
416
|
-
3. **Color overrides** — verify text contrast ≥ 4.5:1 against background
|
|
351
|
+
Use the kit's `CometChatUIKit.*` helpers (sendTextMessage, createUser, updateUser, etc.) when available — they emit the UI events the components listen for.
|
|
417
352
|
|
|
418
353
|
---
|
|
419
354
|
|
|
420
|
-
## 10. Docs MCP (recommended
|
|
421
|
-
|
|
422
|
-
The CometChat docs MCP gives runtime access to the most current Angular UI Kit docs. Install:
|
|
355
|
+
## 10. Docs MCP (recommended)
|
|
423
356
|
|
|
424
357
|
```bash
|
|
425
358
|
claude mcp add --transport http cometchat-docs https://www.cometchat.com/docs/mcp
|
|
426
359
|
```
|
|
427
360
|
|
|
428
|
-
Use
|
|
361
|
+
Use it to confirm prop names, event signatures, theme tokens, or error meanings before writing non-obvious code.
|
|
429
362
|
|
|
430
363
|
---
|
|
431
364
|
|
|
432
|
-
## 11. Visual Builder
|
|
433
|
-
|
|
434
|
-
When the dispatcher's Step 3.1 (Customization preference) runs on an Angular project, **it auto-routes to the code-driven path**. The dashboard's Visual Builder export pipeline at `https://preview.cometchat.com/downloads/cometchat-builder-{platform}.zip` ships ZIPs for `react`, `react-native`, `ios`, `android`, and `flutter` — there's no `angular` emitter. Skills can't bridge that gap by translating React/JSON output into Angular code because the kit's Angular package (`@cometchat/chat-uikit-angular`) has different selectors (`<cometchat-conversations>`), module shapes (`CometChatConversationsModule`), and content-projection slot APIs than React.
|
|
435
|
-
|
|
436
|
-
For comparison, the other family core skills have a `## Visual Builder integration` section that documents per-platform copy-the-canonical-app recipes. Angular has no equivalent; this section is the intentional empty entry.
|
|
437
|
-
|
|
438
|
-
**What the dispatcher does on an Angular project:**
|
|
439
|
-
|
|
440
|
-
1. Skips the Visually-vs-In-code prompt entirely.
|
|
441
|
-
2. Surfaces a one-time message in the chat:
|
|
442
|
-
|
|
443
|
-
> *"The Visual Builder doesn't ship Angular code yet (the dashboard's export covers React / React Native / iOS / Android / Flutter today). I'll set up the code-driven Angular integration instead — you can theme via `CometChatThemeService` later. Want to be notified when an Angular Visual Builder lands? Drop a 👍 on https://github.com/cometchat/cometchat-skills/discussions/categories/feature-requests."*
|
|
444
|
-
|
|
445
|
-
3. Sets `customize=code` in `.cometchat/config.json` via `npx @cometchat/skills-cli config save --customize code --json`.
|
|
446
|
-
4. Continues to the standard Angular flow (§3a intent → §3b recommendation → §3c placement → §5 code emission via this skill + `cometchat-angular-{components,placement,patterns,theming}`).
|
|
447
|
-
|
|
448
|
-
If a customer arrives at an Angular project with a stale `customize=visual` value (carried over from a previous run on a React/Flutter/etc. project), the dispatcher OVERWRITES it to `code` before routing — calling `builder create --platform angular` would fail at the CLI layer (rejected: "Missing or invalid --platform"). The override prevents the customer from seeing a confusing error instead of the explanatory note above.
|
|
365
|
+
## 11. Visual Builder — not available for Angular
|
|
449
366
|
|
|
450
|
-
|
|
367
|
+
The dashboard's Visual Builder export ships ZIPs for React / React Native / iOS / Android / Flutter — there is **no Angular emitter**. On an Angular project the dispatcher auto-routes to the code-driven path (sets `customize=code`), skips the Visually-vs-In-code prompt, and continues with this skill + `cometchat-angular-{components,placement,patterns,theming}`. If a stale `customize=visual` carried over from another project, the dispatcher overwrites it to `code` (a `builder ... --platform angular` call would be rejected at the CLI). Theming is via CSS variables (§7), not a builder.
|
|
451
368
|
|
|
452
369
|
---
|
|
453
370
|
|
|
@@ -457,10 +374,13 @@ If a customer arrives at an Angular project with a stale `customize=visual` valu
|
|
|
457
374
|
|---|---|
|
|
458
375
|
| `cometchat-angular-core` | Always — before any integration code |
|
|
459
376
|
| `cometchat-angular-components` | Always — before writing any `<cometchat-*>` HTML |
|
|
460
|
-
| `cometchat-angular-placement` | When integrating —
|
|
461
|
-
| `cometchat-angular-patterns` |
|
|
462
|
-
| `cometchat-angular-theming` |
|
|
463
|
-
| `cometchat-angular-features` |
|
|
464
|
-
| `cometchat-angular-customization` |
|
|
465
|
-
| `cometchat-angular-production` |
|
|
466
|
-
| `cometchat-angular-troubleshooting` |
|
|
377
|
+
| `cometchat-angular-placement` | When integrating — route / modal / drawer / embedded patterns |
|
|
378
|
+
| `cometchat-angular-patterns` | Standalone wiring, routing, NgZone, change detection |
|
|
379
|
+
| `cometchat-angular-theming` | CSS-variable theming, dark mode, typography |
|
|
380
|
+
| `cometchat-angular-features` | Calls, extensions, AI |
|
|
381
|
+
| `cometchat-angular-customization` | Slot templates, formatters, builders, events |
|
|
382
|
+
| `cometchat-angular-production` | Server-side auth tokens + user management |
|
|
383
|
+
| `cometchat-angular-troubleshooting` | Build errors, runtime failures, drift |
|
|
384
|
+
| `cometchat-angular-calls` | Voice/video calling |
|
|
385
|
+
| `cometchat-angular-push` | Push notifications |
|
|
386
|
+
| `cometchat-angular-testing` | Unit / component / E2E tests |
|