@cometchat/skills 4.3.0 → 4.4.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.
- 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 +3 -2
- 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 +258 -20
- package/skills/cometchat-customization/SKILL.md +50 -25
- package/skills/cometchat-features/SKILL.md +314 -35
- 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 +140 -79
- 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 +36 -19
- package/skills/cometchat-native-calls/SKILL.md +29 -17
- 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 +102 -33
- package/skills/cometchat-native-customization/SKILL.md +150 -28
- package/skills/cometchat-native-expo-patterns/SKILL.md +60 -29
- package/skills/cometchat-native-features/SKILL.md +24 -17
- 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 +11 -5
- package/skills/cometchat-nextjs-patterns/SKILL.md +22 -8
- 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 +45 -5
- package/skills/cometchat-react-push/SKILL.md +258 -72
- package/skills/cometchat-react-router-patterns/SKILL.md +12 -6
- 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,27 +1,21 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: cometchat-angular-placement
|
|
3
|
-
description: "Where to put chat in an Angular app — Route-based, Sidebar, Modal/Dialog, Tab-based, and Embedded placements.
|
|
3
|
+
description: "Where to put chat in an Angular UI Kit v5 app — Route-based, Sidebar, Modal/Dialog, Tab-based, and Embedded placements. Each maps to standalone-component composition (no composites, no NgModule) with Angular Router / Material wiring."
|
|
4
4
|
license: "MIT"
|
|
5
|
-
compatibility: "Angular >=
|
|
6
|
-
allowed-tools: "shell, file-read, file-search, file-list, ask-user"
|
|
5
|
+
compatibility: "Angular >=17 <22; @cometchat/chat-uikit-angular ^5.0"
|
|
7
6
|
metadata:
|
|
8
7
|
author: "CometChat"
|
|
9
|
-
version: "
|
|
10
|
-
tags: "cometchat angular placement routing sidebar modal tabs embedded layout"
|
|
8
|
+
version: "4.0.0"
|
|
9
|
+
tags: "cometchat angular placement routing sidebar modal tabs embedded layout standalone v5"
|
|
11
10
|
---
|
|
12
11
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
Teaches Claude the five canonical placement patterns for putting chat inside an Angular app. Each pattern specifies:
|
|
12
|
+
> **Ground truth:** `@cometchat/chat-uikit-angular@5.x` standalone components + `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 symbols against the installed package/source before relying on them.
|
|
16
13
|
|
|
17
|
-
|
|
18
|
-
2. How to wire the placement into Angular Router or Angular Material
|
|
19
|
-
3. Layout gotchas (flex containers, height constraints, z-index)
|
|
20
|
-
4. When to choose this placement over the alternatives
|
|
14
|
+
## Purpose
|
|
21
15
|
|
|
22
|
-
**Read `cometchat-angular-core`
|
|
16
|
+
The five canonical placement patterns for chat in an Angular app, each as **v5 standalone-component composition**. Read `cometchat-angular-core` (setup) + `cometchat-angular-components` (catalog) first.
|
|
23
17
|
|
|
24
|
-
|
|
18
|
+
**v5 has no composite components.** There is no `<cometchat-conversations-with-messages>` — every layout composes the individual standalone components (`<cometchat-conversations>` + `<cometchat-message-header>` / `-message-list>` / `-message-composer>`). Import each component class into the host standalone component's `imports: []`. No NgModule, no `CUSTOM_ELEMENTS_SCHEMA`.
|
|
25
19
|
|
|
26
20
|
---
|
|
27
21
|
|
|
@@ -29,657 +23,292 @@ Ground truth: `docs/ui-kit/angular/getting-started`, `docs/ui-kit/angular/multi-
|
|
|
29
23
|
|
|
30
24
|
| User intent | Recommended placement | Experience |
|
|
31
25
|
|---|---|---|
|
|
32
|
-
| Messaging app (WhatsApp / Telegram style) | **Route-based** — `/conversations` → `/messages/:uid` | Full-page chat
|
|
33
|
-
| SaaS / marketplace with chat as a feature | **Sidebar** — persistent
|
|
34
|
-
| Support app or focused 1-to-1 | **Route-based (single thread)** —
|
|
35
|
-
| Full messaging hub with calls / users / groups | **Tab-based** — Chats / Users / Groups / Calls tabs |
|
|
36
|
-
| Occasional chat overlay from a non-chat screen | **Modal/Dialog** — Angular Material `MatDialog`
|
|
37
|
-
| Chat embedded inside an existing page section | **Embedded** —
|
|
26
|
+
| Messaging app (WhatsApp / Telegram style) | **Route-based** — `/conversations` → `/messages/:uid` | Full-page chat |
|
|
27
|
+
| SaaS / marketplace with chat as a feature | **Sidebar** — persistent panel alongside main content | Split-pane |
|
|
28
|
+
| Support app or focused 1-to-1 | **Route-based (single thread)** — straight into one chat | Single thread |
|
|
29
|
+
| Full messaging hub with calls / users / groups | **Tab-based** — Chats / Users / Groups / Calls tabs | Tabbed messenger |
|
|
30
|
+
| Occasional chat overlay from a non-chat screen | **Modal/Dialog** — Angular Material `MatDialog` / CDK overlay | Modal |
|
|
31
|
+
| Chat embedded inside an existing page section | **Embedded** — components inside a parent layout | Inline |
|
|
38
32
|
|
|
39
33
|
---
|
|
40
34
|
|
|
41
|
-
## Visual reference
|
|
42
|
-
|
|
43
|
-
### 1. Route-based (full page)
|
|
44
|
-
|
|
45
|
-
```
|
|
46
|
-
┌─────────────────────────────────────────┐
|
|
47
|
-
│ ← Hiking Group ⋮ │ ← cometchat-message-header
|
|
48
|
-
├─────────────────────────────────────────┤
|
|
49
|
-
│ │
|
|
50
|
-
│ (messages) │ ← cometchat-message-list
|
|
51
|
-
│ │
|
|
52
|
-
├─────────────────────────────────────────┤
|
|
53
|
-
│ + Type a message... ▶ │ ← cometchat-message-composer
|
|
54
|
-
└─────────────────────────────────────────┘
|
|
55
|
-
```
|
|
56
|
-
|
|
57
|
-
### 2. Sidebar (split-pane)
|
|
35
|
+
## Visual reference
|
|
58
36
|
|
|
59
37
|
```
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
│
|
|
63
|
-
│
|
|
64
|
-
│
|
|
65
|
-
│
|
|
66
|
-
│
|
|
67
|
-
|
|
68
|
-
|
|
38
|
+
1. Route-based (full page) 2. Sidebar (split-pane)
|
|
39
|
+
┌───────────────────────────┐ ┌────────────┬────────────────┐
|
|
40
|
+
│ ← Hiking Group ⋮ │ │ Convos │ ← Group ⋮ │
|
|
41
|
+
├───────────────────────────┤ │ ───────────│ ───────────────│
|
|
42
|
+
│ (messages) │ │ Hiking │ (messages) │
|
|
43
|
+
├───────────────────────────┤ │ Alice │ ───────────────│
|
|
44
|
+
│ + Type a message… ▶ │ │ Bob │ Type message ▶ │
|
|
45
|
+
└───────────────────────────┘ └────────────┴────────────────┘
|
|
46
|
+
|
|
47
|
+
3. Modal/Dialog 4. Tab-based 5. Embedded
|
|
48
|
+
┌──────────────────┐ ┌────────────────────┐ ┌──────────────────────┐
|
|
49
|
+
│ Chat w/ Alice ✕ │ │ Chats Users Groups │ │ Product details │
|
|
50
|
+
├──────────────────┤ ├────────────────────┤ ├──────────────────────┤
|
|
51
|
+
│ (messages) │ │ (active tab) │ │ Chat with seller │
|
|
52
|
+
│ Type message ▶ │ │ │ │ [header/list/composer]│
|
|
53
|
+
└──────────────────┘ └────────────────────┘ └──────────────────────┘
|
|
69
54
|
```
|
|
70
55
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
```
|
|
74
|
-
┌──────────────────────┐
|
|
75
|
-
│ Chat with Alice ✕ │
|
|
76
|
-
├──────────────────────┤
|
|
77
|
-
│ │
|
|
78
|
-
│ (messages) │
|
|
79
|
-
│ │
|
|
80
|
-
├──────────────────────┤
|
|
81
|
-
│ Type message... ▶ │
|
|
82
|
-
└──────────────────────┘
|
|
83
|
-
(page content dimmed behind)
|
|
84
|
-
```
|
|
85
|
-
|
|
86
|
-
### 4. Tab-based
|
|
87
|
-
|
|
88
|
-
```
|
|
89
|
-
┌─────────────────────────────────────────┐
|
|
90
|
-
│ Chats Users Groups Calls │ ← tab bar
|
|
91
|
-
├─────────────────────────────────────────┤
|
|
92
|
-
│ │
|
|
93
|
-
│ (active tab content) │
|
|
94
|
-
│ │
|
|
95
|
-
└─────────────────────────────────────────┘
|
|
96
|
-
```
|
|
97
|
-
|
|
98
|
-
### 5. Embedded (inside an existing page)
|
|
99
|
-
|
|
100
|
-
```
|
|
101
|
-
┌─────────────────────────────────────────┐
|
|
102
|
-
│ Product details │
|
|
103
|
-
│ [product image + specs] │
|
|
104
|
-
├─────────────────────────────────────────┤
|
|
105
|
-
│ Chat with seller │
|
|
106
|
-
│ ┌─────────────────────────────────────┐ │
|
|
107
|
-
│ │ cometchat-message-header │ │
|
|
108
|
-
│ │ cometchat-message-list │ │ ← embedded chat
|
|
109
|
-
│ │ cometchat-message-composer │ │
|
|
110
|
-
│ └─────────────────────────────────────┘ │
|
|
111
|
-
└─────────────────────────────────────────┘
|
|
112
|
-
```
|
|
56
|
+
All five compose the same primitives — only the container/routing differs.
|
|
113
57
|
|
|
114
58
|
---
|
|
115
59
|
|
|
116
|
-
##
|
|
117
|
-
|
|
118
|
-
The most common pattern — chat lives in its own route, navigated via Angular Router.
|
|
119
|
-
|
|
120
|
-
### Pattern A — Conversations list → Messages (two routes)
|
|
60
|
+
## A shared two-pane chat component
|
|
121
61
|
|
|
122
|
-
|
|
123
|
-
// app-routing.module.ts
|
|
124
|
-
import { Routes } from "@angular/router";
|
|
125
|
-
import { ConversationsComponent } from "./conversations/conversations.component";
|
|
126
|
-
import { MessagesComponent } from "./messages/messages.component";
|
|
127
|
-
|
|
128
|
-
export const routes: Routes = [
|
|
129
|
-
{ path: "conversations", component: ConversationsComponent },
|
|
130
|
-
{ path: "messages/user/:uid", component: MessagesComponent },
|
|
131
|
-
{ path: "messages/group/:guid", component: MessagesComponent },
|
|
132
|
-
{ path: "", redirectTo: "conversations", pathMatch: "full" },
|
|
133
|
-
];
|
|
134
|
-
```
|
|
62
|
+
Most placements reuse one composed chat surface. Define it once as a standalone component:
|
|
135
63
|
|
|
136
64
|
```typescript
|
|
137
|
-
//
|
|
138
|
-
import { Component } from "@angular/core";
|
|
139
|
-
import {
|
|
65
|
+
// chat-pane.component.ts
|
|
66
|
+
import { Component, Input } from "@angular/core";
|
|
67
|
+
import {
|
|
68
|
+
CometChatMessageHeaderComponent,
|
|
69
|
+
CometChatMessageListComponent,
|
|
70
|
+
CometChatMessageComposerComponent,
|
|
71
|
+
} from "@cometchat/chat-uikit-angular";
|
|
140
72
|
import { CometChat } from "@cometchat/chat-sdk-javascript";
|
|
141
|
-
import { CometChatConversations } from "@cometchat/chat-uikit-angular";
|
|
142
|
-
import { CUSTOM_ELEMENTS_SCHEMA } from "@angular/core";
|
|
143
73
|
|
|
144
74
|
@Component({
|
|
145
|
-
selector: "app-
|
|
75
|
+
selector: "app-chat-pane",
|
|
146
76
|
standalone: true,
|
|
147
|
-
imports: [
|
|
148
|
-
|
|
77
|
+
imports: [
|
|
78
|
+
CometChatMessageHeaderComponent,
|
|
79
|
+
CometChatMessageListComponent,
|
|
80
|
+
CometChatMessageComposerComponent,
|
|
81
|
+
],
|
|
149
82
|
template: `
|
|
150
|
-
<
|
|
151
|
-
<cometchat-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
</div
|
|
156
|
-
|
|
83
|
+
<ng-container *ngIf="user || group; else empty">
|
|
84
|
+
<cometchat-message-header [user]="user" [group]="group"></cometchat-message-header>
|
|
85
|
+
<cometchat-message-list [user]="user" [group]="group"></cometchat-message-list>
|
|
86
|
+
<cometchat-message-composer [user]="user" [group]="group"></cometchat-message-composer>
|
|
87
|
+
</ng-container>
|
|
88
|
+
<ng-template #empty><div class="empty">Select a conversation</div></ng-template>`,
|
|
89
|
+
styles: [`
|
|
90
|
+
:host { display: flex; flex-direction: column; height: 100%; }
|
|
91
|
+
cometchat-message-header, cometchat-message-composer { flex-shrink: 0; }
|
|
92
|
+
cometchat-message-list { flex: 1; min-height: 0; overflow: hidden; display: flex; flex-direction: column; }
|
|
93
|
+
`],
|
|
157
94
|
})
|
|
158
|
-
export class
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
handleConvClick = (conversation: CometChat.Conversation): void => {
|
|
162
|
-
const entity = conversation.getConversationWith();
|
|
163
|
-
const type = conversation.getConversationType();
|
|
164
|
-
if (type === "user") {
|
|
165
|
-
this.router.navigate(["/messages/user", (entity as CometChat.User).getUid()]);
|
|
166
|
-
} else {
|
|
167
|
-
this.router.navigate(["/messages/group", (entity as CometChat.Group).getGuid()]);
|
|
168
|
-
}
|
|
169
|
-
};
|
|
95
|
+
export class ChatPaneComponent {
|
|
96
|
+
@Input() user?: CometChat.User;
|
|
97
|
+
@Input() group?: CometChat.Group;
|
|
170
98
|
}
|
|
171
99
|
```
|
|
172
100
|
|
|
173
|
-
|
|
174
|
-
// messages.component.ts
|
|
175
|
-
import { Component, OnInit } from "@angular/core";
|
|
176
|
-
import { ActivatedRoute, Router } from "@angular/router";
|
|
177
|
-
import { CometChat } from "@cometchat/chat-sdk-javascript";
|
|
178
|
-
import {
|
|
179
|
-
CometChatMessageHeader,
|
|
180
|
-
CometChatMessageList,
|
|
181
|
-
CometChatMessageComposer,
|
|
182
|
-
} from "@cometchat/chat-uikit-angular";
|
|
183
|
-
import { CommonModule } from "@angular/common";
|
|
184
|
-
import { CUSTOM_ELEMENTS_SCHEMA } from "@angular/core";
|
|
101
|
+
### Two ways to drive the active conversation (both verified against the kit source)
|
|
185
102
|
|
|
186
|
-
|
|
187
|
-
selector: "app-messages",
|
|
188
|
-
standalone: true,
|
|
189
|
-
imports: [CommonModule, CometChatMessageHeader, CometChatMessageList, CometChatMessageComposer],
|
|
190
|
-
schemas: [CUSTOM_ELEMENTS_SCHEMA],
|
|
191
|
-
template: `
|
|
192
|
-
<div style="height: 100vh; display: flex; flex-direction: column;">
|
|
193
|
-
<cometchat-message-header
|
|
194
|
-
[user]="selectedUser"
|
|
195
|
-
[group]="selectedGroup"
|
|
196
|
-
[onBack]="goBack"
|
|
197
|
-
[hideBackButton]="false"
|
|
198
|
-
></cometchat-message-header>
|
|
199
|
-
<cometchat-message-list
|
|
200
|
-
[user]="selectedUser"
|
|
201
|
-
[group]="selectedGroup"
|
|
202
|
-
style="flex: 1; overflow: hidden;"
|
|
203
|
-
></cometchat-message-list>
|
|
204
|
-
<cometchat-message-composer
|
|
205
|
-
[user]="selectedUser"
|
|
206
|
-
[group]="selectedGroup"
|
|
207
|
-
></cometchat-message-composer>
|
|
208
|
-
</div>
|
|
209
|
-
`,
|
|
210
|
-
})
|
|
211
|
-
export class MessagesComponent implements OnInit {
|
|
212
|
-
selectedUser: CometChat.User | undefined;
|
|
213
|
-
selectedGroup: CometChat.Group | undefined;
|
|
103
|
+
`<cometchat-message-header>` / `-message-list>` / `-message-composer>` each expose optional `@Input() user?` and `@Input() group?`. They also inject the kit's `ChatStateService` (exported from `@cometchat/chat-uikit-angular`) and auto-subscribe to its `activeUser()` / `activeGroup()` signals when no input is bound. So:
|
|
214
104
|
|
|
215
|
-
|
|
105
|
+
- **State-service mode (canonical V5 default — what the docs and sample app use).** Render the three message components with **no `[user]`/`[group]` bindings**. When `<cometchat-conversations>` has **no `(itemClick)` handler bound**, clicking a row auto-calls `ChatStateService.setActiveConversation(conv)`, which the message components react to. You only read state for layout gating, e.g. `@if (chatState.activeUser() || chatState.activeGroup())`. To drive it yourself (a thread route, a deep link), call `chatState.setActiveUser(user)` / `setActiveGroup(group)` — these are mutually exclusive (setting one clears the other).
|
|
106
|
+
- **Props mode (explicit control).** Pass **`user` XOR `group`** down as inputs (shown in `app-chat-pane` above). Use this when you bind your own `(itemClick)` handler and route/own the selection — see the next note.
|
|
216
107
|
|
|
217
|
-
|
|
218
|
-
const uid = this.route.snapshot.paramMap.get("uid");
|
|
219
|
-
const guid = this.route.snapshot.paramMap.get("guid");
|
|
108
|
+
The `app-chat-pane` above uses props mode so it's reusable across routes/modals/embeds. For a single-host sidebar that matches the docs verbatim, drop the inputs and let `ChatStateService` wire it.
|
|
220
109
|
|
|
221
|
-
|
|
222
|
-
CometChat.getUser(uid).then((user) => (this.selectedUser = user));
|
|
223
|
-
} else if (guid) {
|
|
224
|
-
CometChat.getGroup(guid).then((group) => (this.selectedGroup = group));
|
|
225
|
-
}
|
|
226
|
-
}
|
|
110
|
+
> **Load-bearing kit behavior:** `<cometchat-conversations>` only auto-sets `ChatStateService` *when `(itemClick)` is not observed*. The source is literally `if (this.itemClick.observed) { this.itemClick.emit(conv); } else { this.chatStateService.setActiveConversation(conv); }`. **The moment you bind `(itemClick)`, the auto-wiring stops** — you must then drive the view yourself (props, `chatState.setActive*`, or `router.navigate`). `<cometchat-users>` / `<cometchat-groups>` behave the same way with `setActiveUser` / `setActiveGroup`.
|
|
227
111
|
|
|
228
|
-
|
|
229
|
-
this.router.navigate(["/conversations"]);
|
|
230
|
-
};
|
|
231
|
-
}
|
|
232
|
-
```
|
|
112
|
+
The kit's `<cometchat-*>` elements are `display: inline` by default, so the list won't flex or scroll without the host contract above. Two things are load-bearing: (1) the host is a flex column with `height: 100%`, and (2) each custom element is itself made a flex column — `cometchat-message-list` needs `flex: 1; min-height: 0; overflow: hidden` (the `min-height: 0` is what lets it shrink and scroll inside the flex parent; omit it and the list overflows instead of scrolling). The app's `index.html`/global styles must also set `html, body { height: 100% }` so the `height: 100%` chain has a root to resolve against.
|
|
233
113
|
|
|
234
|
-
|
|
114
|
+
---
|
|
115
|
+
|
|
116
|
+
## 1. Route-based placement
|
|
117
|
+
|
|
118
|
+
Two routes: a conversation list and a thread. Lazy-load both as standalone components.
|
|
235
119
|
|
|
236
|
-
|
|
120
|
+
```typescript
|
|
121
|
+
// app.routes.ts
|
|
122
|
+
export const routes: Routes = [
|
|
123
|
+
{ path: "conversations", loadComponent: () =>
|
|
124
|
+
import("./conversations-page.component").then(m => m.ConversationsPageComponent) },
|
|
125
|
+
{ path: "messages/:uid", loadComponent: () =>
|
|
126
|
+
import("./messages-page.component").then(m => m.MessagesPageComponent) },
|
|
127
|
+
];
|
|
128
|
+
```
|
|
237
129
|
|
|
238
130
|
```typescript
|
|
239
|
-
//
|
|
131
|
+
// conversations-page.component.ts
|
|
240
132
|
@Component({
|
|
241
|
-
selector: "app-support-chat",
|
|
242
133
|
standalone: true,
|
|
243
|
-
imports: [
|
|
244
|
-
|
|
245
|
-
template: `
|
|
246
|
-
<div *ngIf="agent; else loading" style="height: 100vh; display: flex; flex-direction: column;">
|
|
247
|
-
<cometchat-message-header [user]="agent"></cometchat-message-header>
|
|
248
|
-
<cometchat-message-list
|
|
249
|
-
[user]="agent"
|
|
250
|
-
style="flex: 1; overflow: hidden;"
|
|
251
|
-
></cometchat-message-list>
|
|
252
|
-
<cometchat-message-composer [user]="agent"></cometchat-message-composer>
|
|
253
|
-
</div>
|
|
254
|
-
<ng-template #loading><p>Connecting to support...</p></ng-template>
|
|
255
|
-
`,
|
|
134
|
+
imports: [CometChatConversationsComponent],
|
|
135
|
+
template: `<cometchat-conversations (itemClick)="open($event)"></cometchat-conversations>`,
|
|
256
136
|
})
|
|
257
|
-
export class
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
CometChat.
|
|
137
|
+
export class ConversationsPageComponent {
|
|
138
|
+
constructor(private router: Router) {}
|
|
139
|
+
open(c: CometChat.Conversation) {
|
|
140
|
+
const e = c.getConversationWith();
|
|
141
|
+
if (e instanceof CometChat.User) this.router.navigate(["/messages", e.getUid()]);
|
|
262
142
|
}
|
|
263
143
|
}
|
|
264
144
|
```
|
|
265
145
|
|
|
146
|
+
`messages-page.component.ts` reads `:uid`, resolves the `CometChat.User` (via `CometChat.getUser(uid)`), and renders `<app-chat-pane [user]="user">`.
|
|
147
|
+
|
|
148
|
+
Binding `(itemClick)` here is deliberate: it suppresses the kit's auto-`setActiveConversation` (you want a navigation, not an in-place swap) and hands you the conversation to route with. The thread page then uses props mode (or calls `chatState.setActiveUser`) since the list and the thread live on different routes.
|
|
149
|
+
|
|
266
150
|
---
|
|
267
151
|
|
|
268
152
|
## 2. Sidebar placement (split-pane)
|
|
269
153
|
|
|
270
|
-
|
|
154
|
+
One standalone component, conversations on the left, the chat surface on the right. This is the layout the docs and the kit's own sample app (`cometchat-home` → `cometchat-selector` + `cometchat-messages`) ship — both use **state-service mode**.
|
|
155
|
+
|
|
156
|
+
**Recommended — state-service auto-wiring (docs/sample-app verbatim).** No `(itemClick)`, no inputs, no manual reassignment. `<cometchat-conversations>` auto-sets `ChatStateService` on click and the message components auto-subscribe. Import `inject` from `@angular/core` and `ChatStateService` + the four component classes from `@cometchat/chat-uikit-angular`:
|
|
271
157
|
|
|
272
158
|
```typescript
|
|
273
|
-
// chat-layout.component.ts
|
|
274
159
|
@Component({
|
|
275
|
-
selector: "app-chat-
|
|
160
|
+
selector: "app-chat-sidebar",
|
|
276
161
|
standalone: true,
|
|
277
162
|
imports: [
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
CometChatMessageComposer,
|
|
163
|
+
CometChatConversationsComponent,
|
|
164
|
+
CometChatMessageHeaderComponent,
|
|
165
|
+
CometChatMessageListComponent,
|
|
166
|
+
CometChatMessageComposerComponent,
|
|
283
167
|
],
|
|
284
|
-
schemas: [CUSTOM_ELEMENTS_SCHEMA],
|
|
285
168
|
template: `
|
|
286
|
-
<div
|
|
287
|
-
|
|
288
|
-
<
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
[group]="selectedGroup"
|
|
307
|
-
style="flex: 1; overflow: hidden;"
|
|
308
|
-
></cometchat-message-list>
|
|
309
|
-
<cometchat-message-composer
|
|
310
|
-
[user]="selectedUser"
|
|
311
|
-
[group]="selectedGroup"
|
|
312
|
-
></cometchat-message-composer>
|
|
313
|
-
</ng-container>
|
|
314
|
-
<ng-template #placeholder>
|
|
315
|
-
<div style="flex: 1; display: flex; align-items: center; justify-content: center; color: #727272;">
|
|
316
|
-
Select a conversation to start chatting
|
|
317
|
-
</div>
|
|
318
|
-
</ng-template>
|
|
319
|
-
</div>
|
|
320
|
-
</div>
|
|
321
|
-
`,
|
|
169
|
+
<div class="split">
|
|
170
|
+
<aside><cometchat-conversations></cometchat-conversations></aside>
|
|
171
|
+
<main>
|
|
172
|
+
@if (chatState.activeUser() || chatState.activeGroup()) {
|
|
173
|
+
<cometchat-message-header></cometchat-message-header>
|
|
174
|
+
<cometchat-message-list></cometchat-message-list>
|
|
175
|
+
<cometchat-message-composer></cometchat-message-composer>
|
|
176
|
+
} @else {
|
|
177
|
+
<div class="empty">Select a conversation</div>
|
|
178
|
+
}
|
|
179
|
+
</main>
|
|
180
|
+
</div>`,
|
|
181
|
+
styles: [`
|
|
182
|
+
.split { display: flex; height: 100%; }
|
|
183
|
+
aside { width: 320px; flex-shrink: 0; border-right: 1px solid var(--cometchat-border-color-light); overflow: hidden; display: flex; flex-direction: column; }
|
|
184
|
+
aside cometchat-conversations { flex: 1; min-height: 0; overflow: hidden; display: flex; flex-direction: column; }
|
|
185
|
+
main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
|
|
186
|
+
main cometchat-message-header, main cometchat-message-composer { flex-shrink: 0; }
|
|
187
|
+
main cometchat-message-list { flex: 1; min-height: 0; overflow: hidden; display: flex; flex-direction: column; }
|
|
188
|
+
`],
|
|
322
189
|
})
|
|
323
|
-
export class
|
|
324
|
-
|
|
325
|
-
selectedGroup: CometChat.Group | undefined;
|
|
326
|
-
activeConversation: CometChat.Conversation | undefined;
|
|
327
|
-
|
|
328
|
-
handleConvClick = (conversation: CometChat.Conversation): void => {
|
|
329
|
-
this.activeConversation = conversation;
|
|
330
|
-
const entity = conversation.getConversationWith();
|
|
331
|
-
if (entity instanceof CometChat.User) {
|
|
332
|
-
this.selectedUser = entity;
|
|
333
|
-
this.selectedGroup = undefined;
|
|
334
|
-
} else {
|
|
335
|
-
this.selectedGroup = entity as CometChat.Group;
|
|
336
|
-
this.selectedUser = undefined;
|
|
337
|
-
}
|
|
338
|
-
};
|
|
190
|
+
export class ChatSidebarComponent {
|
|
191
|
+
chatState = inject(ChatStateService);
|
|
339
192
|
}
|
|
340
193
|
```
|
|
341
194
|
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
- The sidebar container needs `overflow: hidden` — `<cometchat-conversations>` fills 100% of its parent.
|
|
345
|
-
- The message area needs `flex: 1; overflow: hidden` so the list fills the remaining space.
|
|
346
|
-
- Pass `[activeConversation]` to `<cometchat-conversations>` to highlight the selected row.
|
|
347
|
-
- `[hideBackButton]="true"` on the header since there's no navigation to go back to.
|
|
348
|
-
|
|
349
|
-
---
|
|
350
|
-
|
|
351
|
-
## 3. Modal/Dialog placement
|
|
352
|
-
|
|
353
|
-
For occasional chat that doesn't belong in the primary navigation. Use Angular Material `MatDialog` or Angular CDK overlay.
|
|
354
|
-
|
|
355
|
-
### ⚠️ Critical — never use `<cometchat-conversations-with-messages>` in a modal
|
|
356
|
-
|
|
357
|
-
The composite renders a 3-panel layout (Conversations + Messages + Details) and needs **≥ 1024px** of horizontal space. Modals are typically 480–960px wide; the Details panel ends up as empty whitespace and the layout looks broken (one column unused, X close button orphaned). Use the **Two-pane** pattern (Pattern A0) for inbox-in-modal, or the **Granular** 1:1 pattern (Pattern A) for "Contact seller"-style direct chat.
|
|
358
|
-
|
|
359
|
-
### Pattern A0 — Inbox in modal (Two-pane: Conversations + Messages)
|
|
360
|
-
|
|
361
|
-
For "click → open a modal showing the user's inbox + selected thread" (Slack-in-a-popup style).
|
|
195
|
+
**Alternative — props mode (explicit control).** Bind `(itemClick)` and drive `app-chat-pane` yourself. Binding `(itemClick)` suppresses the auto-wiring (see the load-bearing note above), so you own the selection:
|
|
362
196
|
|
|
363
197
|
```typescript
|
|
364
|
-
// inbox-modal.component.ts
|
|
365
|
-
import { Component, OnInit } from "@angular/core";
|
|
366
|
-
import { MatDialogRef } from "@angular/material/dialog";
|
|
367
|
-
import { CometChat } from "@cometchat/chat-sdk-javascript";
|
|
368
|
-
import {
|
|
369
|
-
CometChatConversations,
|
|
370
|
-
CometChatMessages,
|
|
371
|
-
} from "@cometchat/chat-uikit-angular";
|
|
372
|
-
import { CUSTOM_ELEMENTS_SCHEMA } from "@angular/core";
|
|
373
|
-
import { CommonModule } from "@angular/common";
|
|
374
|
-
|
|
375
198
|
@Component({
|
|
376
|
-
selector: "app-
|
|
199
|
+
selector: "app-chat-sidebar",
|
|
377
200
|
standalone: true,
|
|
378
|
-
imports: [
|
|
379
|
-
schemas: [CUSTOM_ELEMENTS_SCHEMA],
|
|
201
|
+
imports: [CometChatConversationsComponent, ChatPaneComponent],
|
|
380
202
|
template: `
|
|
381
|
-
<div
|
|
382
|
-
<cometchat-conversations
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
></cometchat-conversations>
|
|
387
|
-
<cometchat-messages
|
|
388
|
-
*ngIf="activeUser || activeGroup; else empty"
|
|
389
|
-
[user]="activeUser"
|
|
390
|
-
[group]="activeGroup"
|
|
391
|
-
style="flex: 1 1 auto;"
|
|
392
|
-
></cometchat-messages>
|
|
393
|
-
<ng-template #empty>
|
|
394
|
-
<div style="flex: 1; display: flex; align-items: center; justify-content: center; color: #9ca3af;">
|
|
395
|
-
Select a conversation
|
|
396
|
-
</div>
|
|
397
|
-
</ng-template>
|
|
398
|
-
</div>
|
|
399
|
-
`,
|
|
203
|
+
<div class="split">
|
|
204
|
+
<aside><cometchat-conversations (itemClick)="select($event)"></cometchat-conversations></aside>
|
|
205
|
+
<main><app-chat-pane [user]="activeUser" [group]="activeGroup"></app-chat-pane></main>
|
|
206
|
+
</div>`,
|
|
207
|
+
styles: [`.split{display:flex;height:100%} aside{width:320px;flex-shrink:0;border-right:1px solid var(--cometchat-border-color-light)} main{flex:1;min-width:0}`],
|
|
400
208
|
})
|
|
401
|
-
export class
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
this.activeConversation = conv;
|
|
410
|
-
const target = conv.getConversationWith();
|
|
411
|
-
if (target instanceof CometChat.User) {
|
|
412
|
-
this.activeUser = target;
|
|
413
|
-
this.activeGroup = null;
|
|
414
|
-
} else {
|
|
415
|
-
this.activeGroup = target as CometChat.Group;
|
|
416
|
-
this.activeUser = null;
|
|
417
|
-
}
|
|
418
|
-
};
|
|
209
|
+
export class ChatSidebarComponent {
|
|
210
|
+
activeUser?: CometChat.User; activeGroup?: CometChat.Group;
|
|
211
|
+
select(c: CometChat.Conversation) {
|
|
212
|
+
const e = c.getConversationWith();
|
|
213
|
+
// reassign (new ref) so OnPush hosts update
|
|
214
|
+
if (e instanceof CometChat.User) { this.activeUser = e; this.activeGroup = undefined; }
|
|
215
|
+
if (e instanceof CometChat.Group) { this.activeGroup = e; this.activeUser = undefined; }
|
|
216
|
+
}
|
|
419
217
|
}
|
|
420
218
|
```
|
|
421
219
|
|
|
422
|
-
|
|
423
|
-
// Trigger:
|
|
424
|
-
this.dialog.open(InboxModalComponent, { panelClass: "inbox-dialog" });
|
|
425
|
-
```
|
|
220
|
+
---
|
|
426
221
|
|
|
427
|
-
|
|
428
|
-
- **No third panel** — Conversations (left) + Messages (right) consumes the entire dialog width.
|
|
429
|
-
- **Explicit flex sizing** — Conversations is fixed-width (`flex: 0 0 320px`), Messages takes the rest (`flex: 1 1 auto`). No empty whitespace.
|
|
430
|
-
- **Empty state handled** — `*ngIf` shows a "Select a conversation" placeholder until the user clicks one.
|
|
222
|
+
## 3. Modal/Dialog placement (Angular Material)
|
|
431
223
|
|
|
432
|
-
|
|
224
|
+
Render the composed chat pane inside a `MatDialog`. **Never a composite** — there isn't one, and a 3-panel composite wouldn't fit a modal anyway.
|
|
433
225
|
|
|
434
226
|
```typescript
|
|
435
|
-
//
|
|
436
|
-
|
|
437
|
-
import { MAT_DIALOG_DATA, MatDialogRef } from "@angular/material/dialog";
|
|
438
|
-
import { CometChat } from "@cometchat/chat-sdk-javascript";
|
|
439
|
-
import {
|
|
440
|
-
CometChatMessageHeader,
|
|
441
|
-
CometChatMessageList,
|
|
442
|
-
CometChatMessageComposer,
|
|
443
|
-
} from "@cometchat/chat-uikit-angular";
|
|
444
|
-
import { CUSTOM_ELEMENTS_SCHEMA } from "@angular/core";
|
|
227
|
+
// open from any component:
|
|
228
|
+
this.dialog.open(ChatDialogComponent, { width: "420px", height: "640px", data: { user } });
|
|
445
229
|
|
|
230
|
+
// chat-dialog.component.ts
|
|
446
231
|
@Component({
|
|
447
|
-
selector: "app-chat-dialog",
|
|
448
232
|
standalone: true,
|
|
449
|
-
imports: [
|
|
450
|
-
|
|
451
|
-
template: `
|
|
452
|
-
<div style="width: 480px; height: 600px; display: flex; flex-direction: column;">
|
|
453
|
-
<cometchat-message-header
|
|
454
|
-
[user]="data.user"
|
|
455
|
-
[onBack]="close"
|
|
456
|
-
[hideBackButton]="false"
|
|
457
|
-
></cometchat-message-header>
|
|
458
|
-
<cometchat-message-list
|
|
459
|
-
[user]="data.user"
|
|
460
|
-
style="flex: 1; overflow: hidden;"
|
|
461
|
-
></cometchat-message-list>
|
|
462
|
-
<cometchat-message-composer [user]="data.user"></cometchat-message-composer>
|
|
463
|
-
</div>
|
|
464
|
-
`,
|
|
233
|
+
imports: [ChatPaneComponent],
|
|
234
|
+
template: `<app-chat-pane [user]="data.user"></app-chat-pane>`,
|
|
465
235
|
})
|
|
466
236
|
export class ChatDialogComponent {
|
|
467
|
-
constructor(
|
|
468
|
-
public dialogRef: MatDialogRef<ChatDialogComponent>,
|
|
469
|
-
@Inject(MAT_DIALOG_DATA) public data: { user: CometChat.User }
|
|
470
|
-
) {}
|
|
471
|
-
|
|
472
|
-
close = (): void => this.dialogRef.close();
|
|
473
|
-
}
|
|
474
|
-
```
|
|
475
|
-
|
|
476
|
-
```typescript
|
|
477
|
-
// Trigger from any component:
|
|
478
|
-
import { MatDialog } from "@angular/material/dialog";
|
|
479
|
-
|
|
480
|
-
@Component({ /* ... */ })
|
|
481
|
-
export class ProductComponent {
|
|
482
|
-
constructor(private dialog: MatDialog) {}
|
|
483
|
-
|
|
484
|
-
openChat(sellerUid: string): void {
|
|
485
|
-
CometChat.getUser(sellerUid).then((user) => {
|
|
486
|
-
this.dialog.open(ChatDialogComponent, {
|
|
487
|
-
data: { user },
|
|
488
|
-
panelClass: "chat-dialog",
|
|
489
|
-
disableClose: false,
|
|
490
|
-
});
|
|
491
|
-
});
|
|
492
|
-
}
|
|
237
|
+
constructor(@Inject(MAT_DIALOG_DATA) public data: { user: CometChat.User }) {}
|
|
493
238
|
}
|
|
494
239
|
```
|
|
495
240
|
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
```typescript
|
|
499
|
-
import { Overlay, OverlayRef } from "@angular/cdk/overlay";
|
|
500
|
-
import { ComponentPortal } from "@angular/cdk/portal";
|
|
501
|
-
|
|
502
|
-
@Component({ /* ... */ })
|
|
503
|
-
export class TriggerComponent {
|
|
504
|
-
private overlayRef: OverlayRef | null = null;
|
|
505
|
-
|
|
506
|
-
constructor(private overlay: Overlay) {}
|
|
507
|
-
|
|
508
|
-
openChat(): void {
|
|
509
|
-
this.overlayRef = this.overlay.create({
|
|
510
|
-
hasBackdrop: true,
|
|
511
|
-
positionStrategy: this.overlay.position().global().centerHorizontally().centerVertically(),
|
|
512
|
-
});
|
|
513
|
-
const portal = new ComponentPortal(ChatDialogComponent);
|
|
514
|
-
this.overlayRef.attach(portal);
|
|
515
|
-
this.overlayRef.backdropClick().subscribe(() => this.overlayRef?.dispose());
|
|
516
|
-
}
|
|
517
|
-
}
|
|
518
|
-
```
|
|
241
|
+
(For an inbox-in-modal, drop `<cometchat-conversations>` above the pane in a two-pane dialog body.)
|
|
519
242
|
|
|
520
243
|
---
|
|
521
244
|
|
|
522
245
|
## 4. Tab-based placement
|
|
523
246
|
|
|
524
|
-
|
|
247
|
+
A standalone shell with Material tabs (or your own) over Conversations / Users / Groups / Call Logs.
|
|
525
248
|
|
|
526
249
|
```typescript
|
|
527
|
-
// chat-tabs.component.ts
|
|
528
|
-
import { Component } from "@angular/core";
|
|
529
|
-
import { MatTabsModule } from "@angular/material/tabs";
|
|
530
|
-
import {
|
|
531
|
-
CometChatConversations,
|
|
532
|
-
CometChatUsers,
|
|
533
|
-
CometChatGroups,
|
|
534
|
-
CometChatCallLogs,
|
|
535
|
-
} from "@cometchat/chat-uikit-angular";
|
|
536
|
-
import { CUSTOM_ELEMENTS_SCHEMA } from "@angular/core";
|
|
537
|
-
|
|
538
250
|
@Component({
|
|
539
|
-
selector: "app-chat-tabs",
|
|
540
251
|
standalone: true,
|
|
541
|
-
imports: [MatTabsModule,
|
|
542
|
-
|
|
252
|
+
imports: [MatTabsModule, CometChatConversationsComponent, CometChatUsersComponent,
|
|
253
|
+
CometChatGroupsComponent, CometChatCallLogsComponent, ChatPaneComponent],
|
|
543
254
|
template: `
|
|
544
|
-
<mat-tab-group
|
|
545
|
-
<mat-tab label="Chats">
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
</mat-tab>
|
|
557
|
-
<mat-tab label="Groups">
|
|
558
|
-
<cometchat-groups
|
|
559
|
-
[onItemClick]="handleGroupClick"
|
|
560
|
-
style="height: calc(100vh - 48px);"
|
|
561
|
-
></cometchat-groups>
|
|
562
|
-
</mat-tab>
|
|
563
|
-
<mat-tab label="Calls">
|
|
564
|
-
<cometchat-call-logs
|
|
565
|
-
style="height: calc(100vh - 48px);"
|
|
566
|
-
></cometchat-call-logs>
|
|
567
|
-
</mat-tab>
|
|
568
|
-
</mat-tab-group>
|
|
569
|
-
`,
|
|
255
|
+
<mat-tab-group>
|
|
256
|
+
<mat-tab label="Chats"><div class="tab-pane"><cometchat-conversations (itemClick)="select($event)"></cometchat-conversations></div></mat-tab>
|
|
257
|
+
<mat-tab label="Users"><div class="tab-pane"><cometchat-users (itemClick)="selectUser($event)"></cometchat-users></div></mat-tab>
|
|
258
|
+
<mat-tab label="Groups"><div class="tab-pane"><cometchat-groups (itemClick)="selectGroup($event)"></cometchat-groups></div></mat-tab>
|
|
259
|
+
<mat-tab label="Calls"><div class="tab-pane"><cometchat-call-logs></cometchat-call-logs></div></mat-tab>
|
|
260
|
+
</mat-tab-group>`,
|
|
261
|
+
styles: [`
|
|
262
|
+
:host { display: flex; flex-direction: column; height: 100%; }
|
|
263
|
+
mat-tab-group { flex: 1; min-height: 0; }
|
|
264
|
+
.tab-pane { display: flex; flex-direction: column; height: 100%; min-height: 0; }
|
|
265
|
+
.tab-pane > * { flex: 1; min-height: 0; overflow: hidden; display: flex; flex-direction: column; }
|
|
266
|
+
`],
|
|
570
267
|
})
|
|
571
|
-
export class ChatTabsComponent {
|
|
572
|
-
handleConvClick = (conversation: CometChat.Conversation): void => { /* navigate */ };
|
|
573
|
-
handleUserClick = (user: CometChat.User): void => { /* navigate */ };
|
|
574
|
-
handleGroupClick = (group: CometChat.Group): void => { /* navigate */ };
|
|
575
|
-
}
|
|
268
|
+
export class ChatTabsComponent { /* select handlers route to a thread or open the pane */ }
|
|
576
269
|
```
|
|
577
270
|
|
|
578
|
-
|
|
271
|
+
`MatTabsModule` is a standalone-importable Angular Material module — add it to `imports: []` alongside the CometChat components.
|
|
579
272
|
|
|
580
|
-
- `
|
|
581
|
-
|
|
582
|
-
-
|
|
273
|
+
Selection wiring is the same trade-off as the sidebar. If you want the kit to auto-route a click into the active conversation (the docs' tab example does this), **drop the `(itemClick)` handlers** — `<cometchat-conversations>` auto-calls `setActiveConversation` and `<cometchat-users>` auto-calls `setActiveUser`, then mount the message components in a side/center pane gated on `chatState.activeUser()`/`activeGroup()`. Bind `(itemClick)` only when you want to route to a separate page or otherwise own the selection.
|
|
274
|
+
|
|
275
|
+
The list components inside each `<mat-tab>` need the same flex-host treatment as the chat pane — a Material tab body has no implicit height, so without a flex `.tab-pane` wrapper (and the elements made `flex: 1; min-height: 0; overflow: hidden`) the inline `<cometchat-*>` lists collapse to zero height and won't scroll.
|
|
583
276
|
|
|
584
277
|
---
|
|
585
278
|
|
|
586
279
|
## 5. Embedded placement
|
|
587
280
|
|
|
588
|
-
|
|
281
|
+
Drop `<app-chat-pane>` (or the raw header/list/composer) inside an existing page, scoped to a known user/group.
|
|
589
282
|
|
|
590
283
|
```typescript
|
|
591
|
-
// product-detail.component.ts
|
|
592
284
|
@Component({
|
|
593
|
-
selector: "app-product-detail",
|
|
594
285
|
standalone: true,
|
|
595
|
-
imports: [
|
|
596
|
-
CommonModule,
|
|
597
|
-
CometChatMessageHeader,
|
|
598
|
-
CometChatMessageList,
|
|
599
|
-
CometChatMessageComposer,
|
|
600
|
-
],
|
|
601
|
-
schemas: [CUSTOM_ELEMENTS_SCHEMA],
|
|
286
|
+
imports: [ChatPaneComponent],
|
|
602
287
|
template: `
|
|
603
|
-
<
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
<div class="chat-section">
|
|
609
|
-
<h3>Chat with seller</h3>
|
|
610
|
-
<div style="height: 480px; display: flex; flex-direction: column; border: 1px solid #e8e8e8; border-radius: 8px; overflow: hidden;">
|
|
611
|
-
<ng-container *ngIf="seller; else loadingChat">
|
|
612
|
-
<cometchat-message-header
|
|
613
|
-
[user]="seller"
|
|
614
|
-
[hideBackButton]="true"
|
|
615
|
-
></cometchat-message-header>
|
|
616
|
-
<cometchat-message-list
|
|
617
|
-
[user]="seller"
|
|
618
|
-
style="flex: 1; overflow: hidden;"
|
|
619
|
-
></cometchat-message-list>
|
|
620
|
-
<cometchat-message-composer [user]="seller"></cometchat-message-composer>
|
|
621
|
-
</ng-container>
|
|
622
|
-
<ng-template #loadingChat>
|
|
623
|
-
<div style="flex: 1; display: flex; align-items: center; justify-content: center;">
|
|
624
|
-
Loading chat...
|
|
625
|
-
</div>
|
|
626
|
-
</ng-template>
|
|
627
|
-
</div>
|
|
628
|
-
</div>
|
|
629
|
-
</div>
|
|
630
|
-
`,
|
|
288
|
+
<section class="product">…product details…</section>
|
|
289
|
+
<section class="seller-chat" style="height:480px">
|
|
290
|
+
<h3>Chat with seller</h3>
|
|
291
|
+
<app-chat-pane [user]="seller"></app-chat-pane>
|
|
292
|
+
</section>`,
|
|
631
293
|
})
|
|
632
|
-
export class
|
|
633
|
-
seller: CometChat.User | undefined;
|
|
634
|
-
|
|
635
|
-
ngOnInit(): void {
|
|
636
|
-
CometChat.getUser(this.product.sellerUid).then((user) => (this.seller = user));
|
|
637
|
-
}
|
|
638
|
-
}
|
|
294
|
+
export class ProductPageComponent { seller!: CometChat.User; }
|
|
639
295
|
```
|
|
640
296
|
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
- **Fixed height required.** CometChat components fill 100% of their parent. Without a bounded height (`height: 480px` or `flex: 1` inside a flex container), the list collapses to zero height and renders empty.
|
|
644
|
-
- **Overflow hidden on the container.** The inner components have their own scroll — the outer container must not scroll over them.
|
|
645
|
-
- Usually the embedded pattern is the wrong default — prefer a Modal trigger from a button on the page, which gives users a dedicated surface for chatting.
|
|
297
|
+
Give the embedded container an explicit height — the message list fills its parent.
|
|
646
298
|
|
|
647
299
|
---
|
|
648
300
|
|
|
649
301
|
## Hard rules
|
|
650
302
|
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
3. **Pass either `[user]` or `[group]`, never both.** Passing both causes runtime errors. Branch in the template based on which one is set.
|
|
658
|
-
|
|
659
|
-
4. **Resolve user / group before rendering.** The `[user]` and `[group]` inputs expect `CometChat.User` and `CometChat.Group` instances — not bare UID strings. Fetch via `CometChat.getUser(uid)` / `CometChat.getGroup(guid)` in `ngOnInit` and gate the render on the resolved object with `*ngIf`.
|
|
660
|
-
|
|
661
|
-
5. **Wire `[onThreadRepliesClick]` if you want threads**, or leave it unwired to keep the thread option hidden. The `[onThreadRepliesClick]` input is an `@Input()` callback — use `[onThreadRepliesClick]="myFn"` (square brackets). See `cometchat-angular-components` § 11 for the full threading pattern.
|
|
662
|
-
|
|
663
|
-
6. **For modal placements, set an explicit width and height on the dialog container.** Angular Material dialogs don't constrain their content by default — without explicit dimensions, CometChat components may render at 0px.
|
|
664
|
-
|
|
665
|
-
6a. **Never use `<cometchat-conversations-with-messages>` (or `<cometchat-users-with-messages>` / `<cometchat-groups-with-messages>`) inside a modal, dialog, drawer, or sidebar.** These composites render a 3-panel layout (List + Messages + Details) and need ≥ 1024px of horizontal space. In a 480–960px modal, the Details panel ends up as empty whitespace and the layout looks broken. Use the Two-pane pattern (`<cometchat-conversations>` + `<cometchat-messages>`, see § 3 Pattern A0) for inbox-in-modal, or the Granular pattern (`<cometchat-message-header>` + `-message-list>` + `-message-composer>`, see § 3 Pattern A) for 1:1 chat.
|
|
666
|
-
|
|
667
|
-
7. **For sidebar placements, use `overflow: hidden` on both the sidebar and message area containers.** CometChat components have internal scroll; the outer containers must not add a second scroll layer.
|
|
668
|
-
|
|
669
|
-
8. **Never animate a CometChat-containing container with CSS `transform`.** `transform` creates a new stacking context, which reparents `position: fixed` overlays (emoji picker, action sheet, reactions popover) and makes them misalign. Animate `left` / `right` / `top` / `bottom` offsets instead.
|
|
670
|
-
|
|
671
|
-
---
|
|
303
|
+
1. **No composites in v5.** `<cometchat-conversations-with-messages>` / `-users-with-messages>` / `-groups-with-messages>` do not exist — compose `<cometchat-conversations>` + the message components. (If you've seen these in v4 docs, they were removed.)
|
|
304
|
+
2. **No `CUSTOM_ELEMENTS_SCHEMA`, no NgModule** — import each component class into the host standalone component's `imports: []`.
|
|
305
|
+
3. **Drive the active chat one of two ways — don't mix them on the same surface.** Either (a) **state-service mode** (canonical V5 default): no `[user]`/`[group]`, no `(itemClick)` — `<cometchat-conversations>`/`-users>`/`-groups>` auto-call `ChatStateService.setActive*` and the message components auto-subscribe; gate layout on `chatState.activeUser()`/`activeGroup()`. Or (b) **props mode**: pass `user` XOR `group` on header/list/composer (reassign a new reference on change so OnPush hosts re-render). **Binding `(itemClick)` suppresses the auto-wiring** (kit source: `itemClick.observed ? emit : setActiveConversation`) — once bound, you own selection via props, `chatState.setActive*`, or routing.
|
|
306
|
+
4. **Give chat containers an explicit height AND make the custom elements flex.** The kit's `<cometchat-*>` elements are `display: inline` by default — they will not flex or scroll on their own. The host must be a flex column with a resolvable `height: 100%` (so set `html, body { height: 100% }` globally), and each element must itself be `display: flex; flex-direction: column`. `cometchat-message-list` needs `flex: 1; min-height: 0; overflow: hidden` — without `min-height: 0` it overflows the viewport instead of scrolling; header/composer take `flex-shrink: 0`. With no height or no element-flex, the list collapses or fails to scroll.
|
|
307
|
+
5. **Lazy-load full-page chat routes** via `loadComponent` so the kit bundle isn't in the initial chunk.
|
|
308
|
+
6. **Brand/theme via CSS variables** (`--cometchat-*`) — see `cometchat-angular-theming`, not a theme service.
|
|
672
309
|
|
|
673
310
|
## Skill routing reference
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
| `cometchat-angular-components` | For component prop details — always |
|
|
679
|
-
| `cometchat-angular-placement` | This skill — picking + wiring a placement |
|
|
680
|
-
| `cometchat-angular-patterns` | Angular-specific routing, lazy loading, guards |
|
|
681
|
-
| `cometchat-angular-theming` | Customize colors / typography / dark mode |
|
|
682
|
-
| `cometchat-angular-features` | Calls, extensions, AI — the "add a feature" flow |
|
|
683
|
-
| `cometchat-angular-customization` | Custom slot views, text formatters, events |
|
|
684
|
-
| `cometchat-angular-production` | Server-side auth tokens |
|
|
685
|
-
| `cometchat-angular-troubleshooting` | Blank chat / height issues / dialog sizing |
|
|
311
|
+
- `cometchat-angular-core` — setup, init, login, `ChatStateService` lifecycle
|
|
312
|
+
- `cometchat-angular-components` — component catalog + bindings (`@Input user/group`, `itemClick`)
|
|
313
|
+
- `cometchat-angular-patterns` — routing, guards, lazy loading, NgZone, SSR
|
|
314
|
+
- `cometchat-angular-theming` — CSS-variable theming
|