@cometchat/skills 4.1.0 → 4.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/install.js +298 -41
- package/package.json +1 -1
- package/skills/cometchat/SKILL.md +146 -27
- package/skills/cometchat-a11y/SKILL.md +476 -0
- package/skills/cometchat-android-v5/SKILL.md +1 -1
- package/skills/cometchat-android-v5-calls/SKILL.md +413 -0
- package/skills/cometchat-android-v5-calls/references/README.md +53 -0
- package/skills/cometchat-android-v5-calls/references/add-calls-to-existing-chat.md +195 -0
- package/skills/cometchat-android-v5-calls/references/audio-controls.md +91 -0
- package/skills/cometchat-android-v5-calls/references/background-handling.md +168 -0
- package/skills/cometchat-android-v5-calls/references/call-layouts.md +123 -0
- package/skills/cometchat-android-v5-calls/references/call-logs.md +113 -0
- package/skills/cometchat-android-v5-calls/references/call-session.md +274 -0
- package/skills/cometchat-android-v5-calls/references/custom-ui.md +150 -0
- package/skills/cometchat-android-v5-calls/references/event-listeners.md +123 -0
- package/skills/cometchat-android-v5-calls/references/group-calls.md +205 -0
- package/skills/cometchat-android-v5-calls/references/idle-timeout.md +111 -0
- package/skills/cometchat-android-v5-calls/references/in-call-chat.md +134 -0
- package/skills/cometchat-android-v5-calls/references/join-session.md +120 -0
- package/skills/cometchat-android-v5-calls/references/migration-v4-to-v5.md +206 -0
- package/skills/cometchat-android-v5-calls/references/participant-management.md +110 -0
- package/skills/cometchat-android-v5-calls/references/picture-in-picture.md +106 -0
- package/skills/cometchat-android-v5-calls/references/raise-hand.md +242 -0
- package/skills/cometchat-android-v5-calls/references/recording.md +101 -0
- package/skills/cometchat-android-v5-calls/references/ringing-integration.md +152 -0
- package/skills/cometchat-android-v5-calls/references/screen-sharing.md +82 -0
- package/skills/cometchat-android-v5-calls/references/server-fcm-voip.md +215 -0
- package/skills/cometchat-android-v5-calls/references/session-settings.md +121 -0
- package/skills/cometchat-android-v5-calls/references/setup.md +137 -0
- package/skills/cometchat-android-v5-calls/references/share-invite.md +151 -0
- package/skills/cometchat-android-v5-calls/references/video-controls.md +87 -0
- package/skills/cometchat-android-v5-calls/references/voip-calling.md +526 -0
- package/skills/cometchat-android-v5-components/SKILL.md +1 -1
- package/skills/cometchat-android-v5-core/SKILL.md +1 -1
- package/skills/cometchat-android-v5-customization/SKILL.md +1 -1
- package/skills/cometchat-android-v5-extensions/SKILL.md +1 -1
- package/skills/cometchat-android-v5-features/SKILL.md +1 -1
- package/skills/cometchat-android-v5-placement/SKILL.md +1 -1
- package/skills/cometchat-android-v5-production/SKILL.md +1 -1
- package/skills/cometchat-android-v5-push/SKILL.md +1 -1
- package/skills/cometchat-android-v5-testing/SKILL.md +1 -1
- package/skills/cometchat-android-v5-theming/SKILL.md +1 -1
- package/skills/cometchat-android-v5-troubleshooting/SKILL.md +1 -1
- package/skills/cometchat-android-v6/SKILL.md +1 -1
- package/skills/cometchat-android-v6-builder-settings/SKILL.md +1 -1
- package/skills/cometchat-android-v6-calls/SKILL.md +375 -0
- package/skills/cometchat-android-v6-calls/references/add-calls-to-existing-chat.md +97 -0
- package/skills/cometchat-android-v6-calls/references/call-layouts.md +91 -0
- package/skills/cometchat-android-v6-calls/references/call-session.md +163 -0
- package/skills/cometchat-android-v6-calls/references/device-management.md +171 -0
- package/skills/cometchat-android-v6-calls/references/group-calls.md +191 -0
- package/skills/cometchat-android-v6-calls/references/idle-timeout.md +107 -0
- package/skills/cometchat-android-v6-calls/references/in-call-chat.md +136 -0
- package/skills/cometchat-android-v6-calls/references/raise-hand.md +186 -0
- package/skills/cometchat-android-v6-calls/references/ringing-integration.md +176 -0
- package/skills/cometchat-android-v6-calls/references/server-fcm-voip.md +127 -0
- package/skills/cometchat-android-v6-calls/references/share-invite.md +105 -0
- package/skills/cometchat-android-v6-compose-components/SKILL.md +2 -2
- package/skills/cometchat-android-v6-compose-customization/SKILL.md +1 -1
- package/skills/cometchat-android-v6-compose-placement/SKILL.md +1 -1
- package/skills/cometchat-android-v6-compose-theming/SKILL.md +1 -1
- package/skills/cometchat-android-v6-core/SKILL.md +1 -1
- package/skills/cometchat-android-v6-events/SKILL.md +1 -1
- package/skills/cometchat-android-v6-extensions/SKILL.md +1 -1
- package/skills/cometchat-android-v6-features/SKILL.md +1 -1
- package/skills/cometchat-android-v6-kotlin-components/SKILL.md +1 -1
- package/skills/cometchat-android-v6-kotlin-customization/SKILL.md +1 -1
- package/skills/cometchat-android-v6-kotlin-placement/SKILL.md +1 -1
- package/skills/cometchat-android-v6-kotlin-theming/SKILL.md +1 -1
- package/skills/cometchat-android-v6-migration/SKILL.md +398 -0
- package/skills/cometchat-android-v6-production/SKILL.md +1 -1
- package/skills/cometchat-android-v6-push/SKILL.md +1 -1
- package/skills/cometchat-android-v6-testing/SKILL.md +1 -1
- package/skills/cometchat-android-v6-troubleshooting/SKILL.md +1 -1
- package/skills/cometchat-angular-calls/SKILL.md +511 -0
- package/skills/cometchat-angular-calls/references/add-calls-to-existing-chat.md +95 -0
- package/skills/cometchat-angular-calls/references/call-layouts.md +106 -0
- package/skills/cometchat-angular-calls/references/call-session.md +167 -0
- package/skills/cometchat-angular-calls/references/custom-ui.md +231 -0
- package/skills/cometchat-angular-calls/references/device-management.md +135 -0
- package/skills/cometchat-angular-calls/references/group-calls.md +412 -0
- package/skills/cometchat-angular-calls/references/idle-timeout.md +145 -0
- package/skills/cometchat-angular-calls/references/in-call-chat.md +148 -0
- package/skills/cometchat-angular-calls/references/lazy-loading-pitfalls.md +205 -0
- package/skills/cometchat-angular-calls/references/migration-v4-to-v5.md +53 -0
- package/skills/cometchat-angular-calls/references/ngzone-and-async-callbacks.md +183 -0
- package/skills/cometchat-angular-calls/references/picture-in-picture.md +285 -0
- package/skills/cometchat-angular-calls/references/raise-hand.md +167 -0
- package/skills/cometchat-angular-calls/references/recording-screen-share.md +267 -0
- package/skills/cometchat-angular-calls/references/ringing-integration.md +131 -0
- package/skills/cometchat-angular-calls/references/server-web-push-vapid.md +100 -0
- package/skills/cometchat-angular-calls/references/share-invite.md +116 -0
- package/skills/cometchat-angular-components/SKILL.md +1 -1
- package/skills/cometchat-angular-core/SKILL.md +1 -1
- package/skills/cometchat-angular-customization/SKILL.md +1 -1
- package/skills/cometchat-angular-features/SKILL.md +1 -1
- package/skills/cometchat-angular-patterns/SKILL.md +1 -1
- package/skills/cometchat-angular-placement/SKILL.md +1 -1
- package/skills/cometchat-angular-production/SKILL.md +1 -1
- package/skills/cometchat-angular-push/SKILL.md +403 -0
- package/skills/cometchat-angular-testing/SKILL.md +333 -0
- package/skills/cometchat-angular-theming/SKILL.md +1 -1
- package/skills/cometchat-angular-troubleshooting/SKILL.md +1 -1
- package/skills/cometchat-astro-patterns/SKILL.md +1 -1
- package/skills/cometchat-calls/SKILL.md +358 -0
- package/skills/cometchat-calls/references/use-case-broadcast.md +194 -0
- package/skills/cometchat-calls/references/use-case-marketplace.md +158 -0
- package/skills/cometchat-calls/references/use-case-support.md +190 -0
- package/skills/cometchat-calls/references/use-case-team.md +169 -0
- package/skills/cometchat-calls/references/use-case-telehealth.md +154 -0
- package/skills/cometchat-components/SKILL.md +1 -1
- package/skills/cometchat-core/SKILL.md +1 -1
- package/skills/cometchat-customization/SKILL.md +2 -2
- package/skills/cometchat-features/SKILL.md +2 -2
- package/skills/cometchat-flutter-v5/SKILL.md +1 -1
- package/skills/cometchat-flutter-v5-calls/SKILL.md +325 -94
- package/skills/cometchat-flutter-v5-calls/references/add-calls-to-existing-chat.md +169 -0
- package/skills/cometchat-flutter-v5-calls/references/call-layouts.md +98 -0
- package/skills/cometchat-flutter-v5-calls/references/call-session.md +330 -0
- package/skills/cometchat-flutter-v5-calls/references/device-management.md +120 -0
- package/skills/cometchat-flutter-v5-calls/references/group-calls.md +187 -0
- package/skills/cometchat-flutter-v5-calls/references/idle-timeout.md +97 -0
- package/skills/cometchat-flutter-v5-calls/references/in-call-chat.md +132 -0
- package/skills/cometchat-flutter-v5-calls/references/migration-v4-to-v5.md +160 -0
- package/skills/cometchat-flutter-v5-calls/references/raise-hand.md +244 -0
- package/skills/cometchat-flutter-v5-calls/references/ringing-integration.md +193 -0
- package/skills/cometchat-flutter-v5-calls/references/server-push-bridge.md +101 -0
- package/skills/cometchat-flutter-v5-calls/references/share-invite.md +142 -0
- package/skills/cometchat-flutter-v5-conversations/SKILL.md +1 -1
- package/skills/cometchat-flutter-v5-core/SKILL.md +1 -1
- package/skills/cometchat-flutter-v5-customization/SKILL.md +1 -1
- package/skills/cometchat-flutter-v5-events/SKILL.md +1 -1
- package/skills/cometchat-flutter-v5-messages/SKILL.md +1 -1
- package/skills/cometchat-flutter-v5-production/SKILL.md +1 -1
- package/skills/cometchat-flutter-v5-push/SKILL.md +1 -1
- package/skills/cometchat-flutter-v5-testing/SKILL.md +390 -0
- package/skills/cometchat-flutter-v5-theming/SKILL.md +1 -1
- package/skills/cometchat-flutter-v5-troubleshooting/SKILL.md +1 -1
- package/skills/cometchat-flutter-v5-users-groups/SKILL.md +1 -1
- package/skills/cometchat-flutter-v6/SKILL.md +1 -1
- package/skills/cometchat-flutter-v6-calls/SKILL.md +308 -243
- package/skills/cometchat-flutter-v6-calls/references/add-calls-to-existing-chat.md +134 -0
- package/skills/cometchat-flutter-v6-calls/references/call-layouts.md +102 -0
- package/skills/cometchat-flutter-v6-calls/references/call-session.md +229 -0
- package/skills/cometchat-flutter-v6-calls/references/device-management.md +99 -0
- package/skills/cometchat-flutter-v6-calls/references/group-calls.md +190 -0
- package/skills/cometchat-flutter-v6-calls/references/idle-timeout.md +80 -0
- package/skills/cometchat-flutter-v6-calls/references/in-call-chat.md +122 -0
- package/skills/cometchat-flutter-v6-calls/references/raise-hand.md +268 -0
- package/skills/cometchat-flutter-v6-calls/references/ringing-integration.md +171 -0
- package/skills/cometchat-flutter-v6-calls/references/server-push-bridge.md +93 -0
- package/skills/cometchat-flutter-v6-calls/references/share-invite.md +102 -0
- package/skills/cometchat-flutter-v6-components/SKILL.md +1 -1
- package/skills/cometchat-flutter-v6-conversations/SKILL.md +1 -1
- package/skills/cometchat-flutter-v6-core/SKILL.md +1 -1
- package/skills/cometchat-flutter-v6-customization/SKILL.md +1 -1
- package/skills/cometchat-flutter-v6-events/SKILL.md +1 -1
- package/skills/cometchat-flutter-v6-features/SKILL.md +1 -1
- package/skills/cometchat-flutter-v6-messages/SKILL.md +1 -1
- package/skills/cometchat-flutter-v6-migration/SKILL.md +1 -1
- package/skills/cometchat-flutter-v6-placement/SKILL.md +1 -1
- package/skills/cometchat-flutter-v6-production/SKILL.md +1 -1
- package/skills/cometchat-flutter-v6-push/SKILL.md +452 -0
- package/skills/cometchat-flutter-v6-testing/SKILL.md +319 -0
- package/skills/cometchat-flutter-v6-theming/SKILL.md +1 -1
- package/skills/cometchat-flutter-v6-troubleshooting/SKILL.md +1 -1
- package/skills/cometchat-flutter-v6-users-groups/SKILL.md +1 -1
- package/skills/cometchat-i18n/SKILL.md +358 -0
- package/skills/cometchat-ios/SKILL.md +5 -5
- package/skills/cometchat-ios-calls/SKILL.md +409 -0
- package/skills/cometchat-ios-calls/references/add-calls-to-existing-chat.md +172 -0
- package/skills/cometchat-ios-calls/references/avaudiosession-routing.md +189 -0
- package/skills/cometchat-ios-calls/references/call-layouts.md +136 -0
- package/skills/cometchat-ios-calls/references/call-session.md +221 -0
- package/skills/cometchat-ios-calls/references/callkit-and-pushkit.md +353 -0
- package/skills/cometchat-ios-calls/references/custom-ui.md +322 -0
- package/skills/cometchat-ios-calls/references/device-management.md +171 -0
- package/skills/cometchat-ios-calls/references/group-calls.md +396 -0
- package/skills/cometchat-ios-calls/references/idle-timeout.md +185 -0
- package/skills/cometchat-ios-calls/references/in-call-chat.md +183 -0
- package/skills/cometchat-ios-calls/references/migration-v4-to-v5.md +138 -0
- package/skills/cometchat-ios-calls/references/picture-in-picture.md +246 -0
- package/skills/cometchat-ios-calls/references/raise-hand.md +239 -0
- package/skills/cometchat-ios-calls/references/recording-screen-share.md +339 -0
- package/skills/cometchat-ios-calls/references/ringing-integration.md +142 -0
- package/skills/cometchat-ios-calls/references/server-apns-pushkit.md +267 -0
- package/skills/cometchat-ios-calls/references/share-invite.md +152 -0
- package/skills/cometchat-ios-calls/references/swiftui-uikit-hosting.md +246 -0
- package/skills/cometchat-ios-calls/references/voip-cert-setup.md +166 -0
- package/skills/cometchat-ios-components/SKILL.md +1 -1
- package/skills/cometchat-ios-core/SKILL.md +1 -1
- package/skills/cometchat-ios-customization/SKILL.md +1 -1
- package/skills/cometchat-ios-features/SKILL.md +1 -1
- package/skills/cometchat-ios-placement/SKILL.md +1 -1
- package/skills/cometchat-ios-production/SKILL.md +1 -1
- package/skills/cometchat-ios-push/SKILL.md +1 -1
- package/skills/cometchat-ios-testing/SKILL.md +371 -0
- package/skills/cometchat-ios-theming/SKILL.md +1 -1
- package/skills/cometchat-ios-troubleshooting/SKILL.md +1 -1
- package/skills/cometchat-native-bare-patterns/SKILL.md +45 -3
- package/skills/cometchat-native-calls/SKILL.md +599 -0
- package/skills/cometchat-native-calls/references/add-calls-to-existing-chat.md +203 -0
- package/skills/cometchat-native-calls/references/call-layouts.md +124 -0
- package/skills/cometchat-native-calls/references/call-session.md +182 -0
- package/skills/cometchat-native-calls/references/custom-ui.md +250 -0
- package/skills/cometchat-native-calls/references/device-management.md +135 -0
- package/skills/cometchat-native-calls/references/expo-vs-bare.md +179 -0
- package/skills/cometchat-native-calls/references/group-calls.md +291 -0
- package/skills/cometchat-native-calls/references/idle-timeout.md +128 -0
- package/skills/cometchat-native-calls/references/in-call-chat.md +143 -0
- package/skills/cometchat-native-calls/references/migration-v4-to-v5.md +72 -0
- package/skills/cometchat-native-calls/references/picture-in-picture.md +276 -0
- package/skills/cometchat-native-calls/references/raise-hand.md +203 -0
- package/skills/cometchat-native-calls/references/recording-screen-share.md +290 -0
- package/skills/cometchat-native-calls/references/ringing-integration.md +118 -0
- package/skills/cometchat-native-calls/references/server-push-bridge.md +135 -0
- package/skills/cometchat-native-calls/references/server-push-payloads.md +193 -0
- package/skills/cometchat-native-calls/references/share-invite.md +144 -0
- package/skills/cometchat-native-calls/references/voip-push-end-to-end.md +317 -0
- package/skills/cometchat-native-components/SKILL.md +1 -1
- package/skills/cometchat-native-core/SKILL.md +1 -1
- package/skills/cometchat-native-customization/SKILL.md +1 -1
- package/skills/cometchat-native-expo-patterns/SKILL.md +18 -1
- package/skills/cometchat-native-features/SKILL.md +1 -1
- package/skills/cometchat-native-placement/SKILL.md +1 -1
- package/skills/cometchat-native-production/SKILL.md +1 -1
- package/skills/cometchat-native-push/SKILL.md +1 -1
- package/skills/cometchat-native-testing/SKILL.md +1 -1
- package/skills/cometchat-native-theming/SKILL.md +1 -1
- package/skills/cometchat-native-troubleshooting/SKILL.md +1 -1
- package/skills/cometchat-nextjs-patterns/SKILL.md +1 -1
- package/skills/cometchat-placement/SKILL.md +1 -1
- package/skills/cometchat-production/SKILL.md +1 -1
- package/skills/cometchat-react-calls/SKILL.md +539 -0
- package/skills/cometchat-react-calls/references/add-calls-to-existing-chat.md +145 -0
- package/skills/cometchat-react-calls/references/call-layouts.md +161 -0
- package/skills/cometchat-react-calls/references/call-session.md +235 -0
- package/skills/cometchat-react-calls/references/custom-ui.md +201 -0
- package/skills/cometchat-react-calls/references/device-management.md +206 -0
- package/skills/cometchat-react-calls/references/group-calls.md +262 -0
- package/skills/cometchat-react-calls/references/idle-timeout.md +175 -0
- package/skills/cometchat-react-calls/references/in-call-chat.md +212 -0
- package/skills/cometchat-react-calls/references/migration-v4-to-v5.md +172 -0
- package/skills/cometchat-react-calls/references/picture-in-picture.md +245 -0
- package/skills/cometchat-react-calls/references/raise-hand.md +238 -0
- package/skills/cometchat-react-calls/references/recording-screen-share.md +143 -0
- package/skills/cometchat-react-calls/references/ringing-integration.md +255 -0
- package/skills/cometchat-react-calls/references/server-web-push-vapid.md +241 -0
- package/skills/cometchat-react-calls/references/share-invite.md +176 -0
- package/skills/cometchat-react-calls/references/testing-calls-on-web.md +198 -0
- package/skills/cometchat-react-calls/references/voip-and-web-push.md +165 -0
- package/skills/cometchat-react-patterns/SKILL.md +1 -1
- package/skills/cometchat-react-push/SKILL.md +448 -0
- package/skills/cometchat-react-router-patterns/SKILL.md +1 -1
- package/skills/cometchat-react-testing/SKILL.md +404 -0
- package/skills/cometchat-theming/SKILL.md +3 -3
- package/skills/cometchat-troubleshooting/SKILL.md +2 -2
|
@@ -0,0 +1,267 @@
|
|
|
1
|
+
# Recording + screen-share on Angular
|
|
2
|
+
|
|
3
|
+
Angular wraps the same JS Calls SDK as React; SDK semantics are identical. For SDK-level details (recording flag, lifecycle events, screen-share via `getDisplayMedia`, browser support) read `cometchat-react-calls/references/recording-screen-share.md` first. This reference is the Angular-specific wiring.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Recording — opt-in per session
|
|
8
|
+
|
|
9
|
+
Same `CallSettingsBuilder` flag as web:
|
|
10
|
+
|
|
11
|
+
```ts
|
|
12
|
+
// services/call.service.ts
|
|
13
|
+
import { CometChatCalls } from "@cometchat/calls-sdk-javascript";
|
|
14
|
+
|
|
15
|
+
@Injectable({ providedIn: "root" })
|
|
16
|
+
export class CallService {
|
|
17
|
+
buildSettings(sessionId: string, opts: { recording?: boolean; isAudioOnly?: boolean }) {
|
|
18
|
+
return new CometChatCalls.CallSettingsBuilder()
|
|
19
|
+
.setSessionID(sessionId)
|
|
20
|
+
.setIsAudioOnly(opts.isAudioOnly ?? false)
|
|
21
|
+
.enableRecording(opts.recording ?? false)
|
|
22
|
+
.setShowRecordingButton(opts.recording ?? false)
|
|
23
|
+
.build();
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
Toggle the recording prompt for the user via a settings input passed into your call screen component.
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
## REC indicator (compliance)
|
|
33
|
+
|
|
34
|
+
Wrap the lifecycle listener via NgZone — same rule as everywhere else in Angular calls:
|
|
35
|
+
|
|
36
|
+
```ts
|
|
37
|
+
@Component({
|
|
38
|
+
selector: "app-rec-badge",
|
|
39
|
+
template: `
|
|
40
|
+
<div class="rec-badge" *ngIf="recording">
|
|
41
|
+
<span class="rec-dot">●</span>
|
|
42
|
+
<span class="rec-label">REC</span>
|
|
43
|
+
</div>
|
|
44
|
+
`,
|
|
45
|
+
styles: [`
|
|
46
|
+
.rec-badge { position: absolute; top: 16px; left: 16px; display: flex; align-items: center; gap: 4px;
|
|
47
|
+
background: rgba(0,0,0,0.6); color: white; padding: 4px 8px; border-radius: 4px; }
|
|
48
|
+
.rec-dot { color: #ff3b30; animation: blink 1s infinite; }
|
|
49
|
+
@keyframes blink { 0%, 50% { opacity: 1; } 51%, 100% { opacity: 0.4; } }
|
|
50
|
+
`],
|
|
51
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
52
|
+
})
|
|
53
|
+
export class RecBadgeComponent {
|
|
54
|
+
@Input() recording = false;
|
|
55
|
+
}
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
In the parent component:
|
|
59
|
+
|
|
60
|
+
```ts
|
|
61
|
+
ngOnInit() {
|
|
62
|
+
const listener = new CometChatCalls.OngoingCallListener({
|
|
63
|
+
onRecordingStarted: () => {
|
|
64
|
+
this.zone.run(() => { this.recording = true; this.cd.markForCheck(); });
|
|
65
|
+
},
|
|
66
|
+
onRecordingStopped: () => {
|
|
67
|
+
this.zone.run(() => { this.recording = false; this.cd.markForCheck(); });
|
|
68
|
+
},
|
|
69
|
+
onRecordingFailed: (error: { message: string }) => {
|
|
70
|
+
this.zone.run(() => {
|
|
71
|
+
this.snackBar.open(`Recording failed: ${error.message}`, "Dismiss", { duration: 5000 });
|
|
72
|
+
});
|
|
73
|
+
},
|
|
74
|
+
});
|
|
75
|
+
// ... build settings, startSession ...
|
|
76
|
+
}
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
Compliance reminder: in two-party-consent jurisdictions (parts of the US, much of the EU under GDPR Art. 6/7), the REC indicator is legally required for active recording. Don't omit it.
|
|
80
|
+
|
|
81
|
+
---
|
|
82
|
+
|
|
83
|
+
## Screen sharing — Angular composition
|
|
84
|
+
|
|
85
|
+
Browser `getDisplayMedia` — same as web. Angular wraps the user-gesture-required call in a click handler:
|
|
86
|
+
|
|
87
|
+
```ts
|
|
88
|
+
@Component({
|
|
89
|
+
selector: "app-screen-share-button",
|
|
90
|
+
template: `
|
|
91
|
+
<button (click)="onClick()" [disabled]="!supported" [class.active]="sharing">
|
|
92
|
+
{{ sharing ? "Stop sharing" : "Share screen" }}
|
|
93
|
+
</button>
|
|
94
|
+
<div class="hint" *ngIf="!supported">
|
|
95
|
+
Screen sharing not supported in this browser.
|
|
96
|
+
</div>
|
|
97
|
+
`,
|
|
98
|
+
})
|
|
99
|
+
export class ScreenShareButtonComponent {
|
|
100
|
+
@Output() shareStarted = new EventEmitter<void>();
|
|
101
|
+
@Output() shareEnded = new EventEmitter<void>();
|
|
102
|
+
sharing = false;
|
|
103
|
+
supported = typeof navigator !== "undefined" && "mediaDevices" in navigator && "getDisplayMedia" in navigator.mediaDevices;
|
|
104
|
+
|
|
105
|
+
async onClick() {
|
|
106
|
+
if (!this.supported) return;
|
|
107
|
+
if (this.sharing) {
|
|
108
|
+
await CometChatCalls.endScreenShare();
|
|
109
|
+
this.sharing = false;
|
|
110
|
+
this.shareEnded.emit();
|
|
111
|
+
} else {
|
|
112
|
+
try {
|
|
113
|
+
await CometChatCalls.startScreenShare();
|
|
114
|
+
this.sharing = true;
|
|
115
|
+
this.shareStarted.emit();
|
|
116
|
+
} catch (err) {
|
|
117
|
+
if ((err as Error).name === "NotAllowedError") return; // user canceled
|
|
118
|
+
console.warn("Screen share failed:", err);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
The `(click)` handler is in response to a real user gesture — browsers accept the `getDisplayMedia` permission request.
|
|
126
|
+
|
|
127
|
+
---
|
|
128
|
+
|
|
129
|
+
## Screen-share viewer composition
|
|
130
|
+
|
|
131
|
+
When another participant shares, render their screen track in a dedicated tile:
|
|
132
|
+
|
|
133
|
+
```ts
|
|
134
|
+
@Component({
|
|
135
|
+
selector: "app-screen-share-view",
|
|
136
|
+
template: `
|
|
137
|
+
<div class="screen-share-tile">
|
|
138
|
+
<video #screenVideo autoplay playsinline></video>
|
|
139
|
+
<div class="presenter-badge">{{ presenterName }} is sharing their screen</div>
|
|
140
|
+
</div>
|
|
141
|
+
`,
|
|
142
|
+
})
|
|
143
|
+
export class ScreenShareViewComponent implements AfterViewInit {
|
|
144
|
+
@Input() stream!: MediaStream;
|
|
145
|
+
@Input() presenterName = "Someone";
|
|
146
|
+
@ViewChild("screenVideo") videoRef!: ElementRef<HTMLVideoElement>;
|
|
147
|
+
|
|
148
|
+
ngAfterViewInit() {
|
|
149
|
+
if (this.videoRef?.nativeElement && this.stream) {
|
|
150
|
+
this.videoRef.nativeElement.srcObject = this.stream;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
Listen for screen-share events at the parent component level and pass the stream down:
|
|
157
|
+
|
|
158
|
+
```ts
|
|
159
|
+
ngOnInit() {
|
|
160
|
+
const listener = new CometChatCalls.OngoingCallListener({
|
|
161
|
+
onScreenShareStarted: (presenterUid: string, stream: MediaStream) => {
|
|
162
|
+
this.zone.run(() => {
|
|
163
|
+
this.screenSharePresenterUid = presenterUid;
|
|
164
|
+
this.screenShareStream = stream;
|
|
165
|
+
this.cd.markForCheck();
|
|
166
|
+
});
|
|
167
|
+
},
|
|
168
|
+
onScreenShareEnded: () => {
|
|
169
|
+
this.zone.run(() => {
|
|
170
|
+
this.screenSharePresenterUid = null;
|
|
171
|
+
this.screenShareStream = null;
|
|
172
|
+
this.cd.markForCheck();
|
|
173
|
+
});
|
|
174
|
+
},
|
|
175
|
+
});
|
|
176
|
+
}
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
---
|
|
180
|
+
|
|
181
|
+
## Layout switch — main view vs screen share
|
|
182
|
+
|
|
183
|
+
When someone shares, the main view should switch from "participant grid" to "screen share + thumbnails":
|
|
184
|
+
|
|
185
|
+
```html
|
|
186
|
+
<ng-container *ngIf="screenShareStream; else gridView">
|
|
187
|
+
<app-screen-share-view [stream]="screenShareStream" [presenterName]="presenterName"></app-screen-share-view>
|
|
188
|
+
<div class="thumbnail-strip">
|
|
189
|
+
<app-participant-tile *ngFor="let p of participants; trackBy: trackByUid" [participant]="p" size="small"></app-participant-tile>
|
|
190
|
+
</div>
|
|
191
|
+
</ng-container>
|
|
192
|
+
|
|
193
|
+
<ng-template #gridView>
|
|
194
|
+
<div class="participant-grid">
|
|
195
|
+
<app-participant-tile *ngFor="let p of participants; trackBy: trackByUid" [participant]="p" size="medium"></app-participant-tile>
|
|
196
|
+
</div>
|
|
197
|
+
</ng-template>
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
Cleanly transitions via Angular's structural directive. No animation by default — add `@angular/animations` if you want a smooth swap.
|
|
201
|
+
|
|
202
|
+
---
|
|
203
|
+
|
|
204
|
+
## Recording download — server-side only
|
|
205
|
+
|
|
206
|
+
Same as web/RN — recordings live on CometChat's servers. To list/retrieve programmatically, use the dashboard REST API from your own backend (NEVER from Angular client code; the dashboard bearer token must not ship to clients).
|
|
207
|
+
|
|
208
|
+
Server-side proxy pattern:
|
|
209
|
+
|
|
210
|
+
```ts
|
|
211
|
+
// Your backend (Node + Express)
|
|
212
|
+
app.get("/api/recordings", requireAuth, async (req, res) => {
|
|
213
|
+
const recordings = await fetch(
|
|
214
|
+
`https://${region}.api-management.cometchat.io/v3/apps/${appId}/recordings`,
|
|
215
|
+
{ headers: { Authorization: `Bearer ${process.env.DASHBOARD_BEARER}` } },
|
|
216
|
+
).then(r => r.json());
|
|
217
|
+
res.json(recordings);
|
|
218
|
+
});
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
Then the Angular service hits your own backend:
|
|
222
|
+
|
|
223
|
+
```ts
|
|
224
|
+
@Injectable({ providedIn: "root" })
|
|
225
|
+
export class RecordingsService {
|
|
226
|
+
constructor(private http: HttpClient) {}
|
|
227
|
+
list() {
|
|
228
|
+
return this.http.get<Recording[]>("/api/recordings");
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
The skill scaffolds this proxy layer for projects with a backend; for serverless-only projects, points users at the dashboard UI for recording retrieval.
|
|
234
|
+
|
|
235
|
+
---
|
|
236
|
+
|
|
237
|
+
## Anti-patterns
|
|
238
|
+
|
|
239
|
+
1. **Calling `startScreenShare()` from a non-click handler.** Browsers reject — must be in a user-gesture stack. `(click)` works; `ngOnInit` doesn't.
|
|
240
|
+
2. **No NgZone wrap on `onRecordingStarted` / `onScreenShareStarted`.** UI doesn't update.
|
|
241
|
+
3. **Hardcoding the dashboard bearer token in `environment.ts`** to fetch recordings. Wrong — bearer is server-only. Always proxy.
|
|
242
|
+
4. **No "REC" indicator.** Compliance violation.
|
|
243
|
+
5. **Re-render thumbnails on every roster update** without `trackBy`. Tiles flicker; tracks die.
|
|
244
|
+
6. **`getDisplayMedia` polyfilled with screen-recording-extension stubs** in old browsers. Don't — feature detect and disable the button instead.
|
|
245
|
+
|
|
246
|
+
---
|
|
247
|
+
|
|
248
|
+
## Verification checklist
|
|
249
|
+
|
|
250
|
+
- [ ] `enableRecording(true)` opt-in via parent input (not always-on)
|
|
251
|
+
- [ ] REC indicator visible to all participants when active
|
|
252
|
+
- [ ] Recording lifecycle handlers wrapped in `NgZone.run` + `cd.markForCheck()`
|
|
253
|
+
- [ ] Screen-share button feature-detects `getDisplayMedia`
|
|
254
|
+
- [ ] Screen-share button triggered from `(click)`, not `ngOnInit`
|
|
255
|
+
- [ ] `onScreenShareStarted` / `onScreenShareEnded` wrapped in NgZone
|
|
256
|
+
- [ ] Layout swap renders screen-share view + thumbnail strip
|
|
257
|
+
- [ ] `trackBy` on `*ngFor` for participant tiles
|
|
258
|
+
- [ ] Recordings retrieved via server-side proxy, NOT direct dashboard API call from Angular
|
|
259
|
+
|
|
260
|
+
---
|
|
261
|
+
|
|
262
|
+
## Pointers
|
|
263
|
+
|
|
264
|
+
- `cometchat-react-calls/references/recording-screen-share.md` — sister reference (SDK details + browser semantics)
|
|
265
|
+
- `references/ngzone-and-async-callbacks.md` — NgZone wrapping rules
|
|
266
|
+
- `references/group-calls.md` — group calls + screen share interplay
|
|
267
|
+
- `cometchat-angular-calls` SKILL.md — base hard rules
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
# Ringing — call signaling with custom UI (Angular)
|
|
2
|
+
|
|
3
|
+
Same SDK API as web. Angular-specific deltas: NgZone-wrapped listener callbacks, BehaviorSubject-driven incoming/outgoing call state, root-level CallSignalingService.
|
|
4
|
+
|
|
5
|
+
**Read first:** `cometchat-react-calls/references/ringing-integration.md` — full architecture, hard rules, anti-patterns.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## CallSignalingService
|
|
10
|
+
|
|
11
|
+
```ts
|
|
12
|
+
import { Injectable, NgZone } from "@angular/core";
|
|
13
|
+
import { BehaviorSubject } from "rxjs";
|
|
14
|
+
import { CometChat } from "@cometchat/chat-sdk-javascript";
|
|
15
|
+
import { CometChatCalls } from "@cometchat/calls-sdk-javascript";
|
|
16
|
+
|
|
17
|
+
@Injectable({ providedIn: "root" })
|
|
18
|
+
export class CallSignalingService {
|
|
19
|
+
readonly incoming$ = new BehaviorSubject<CometChat.Call | null>(null);
|
|
20
|
+
readonly outgoing$ = new BehaviorSubject<CometChat.Call | null>(null);
|
|
21
|
+
readonly active$ = new BehaviorSubject<string | null>(null); // sessionId
|
|
22
|
+
|
|
23
|
+
private readonly listenerId = "app-call-signaling";
|
|
24
|
+
|
|
25
|
+
constructor(private zone: NgZone) {
|
|
26
|
+
CometChat.addCallListener(
|
|
27
|
+
this.listenerId,
|
|
28
|
+
new CometChat.CallListener({
|
|
29
|
+
onIncomingCallReceived: (call) => this.zone.run(() => this.incoming$.next(call)),
|
|
30
|
+
onOutgoingCallAccepted: (call) => this.zone.run(() => {
|
|
31
|
+
this.outgoing$.next(null);
|
|
32
|
+
this.active$.next(call.getSessionId());
|
|
33
|
+
}),
|
|
34
|
+
onOutgoingCallRejected: () => this.zone.run(() => this.outgoing$.next(null)),
|
|
35
|
+
onIncomingCallCancelled: () => this.zone.run(() => this.incoming$.next(null)),
|
|
36
|
+
onCallEndedMessageReceived: () => this.zone.run(() => {
|
|
37
|
+
this.incoming$.next(null);
|
|
38
|
+
this.outgoing$.next(null);
|
|
39
|
+
this.active$.next(null);
|
|
40
|
+
}),
|
|
41
|
+
}),
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
ngOnDestroy(): void {
|
|
46
|
+
CometChat.removeCallListener(this.listenerId);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
async initiate(receiverUid: string, type: "audio" | "video" = "video"): Promise<void> {
|
|
50
|
+
const call = new CometChat.Call(
|
|
51
|
+
receiverUid,
|
|
52
|
+
type === "video" ? CometChat.CALL_TYPE.VIDEO : CometChat.CALL_TYPE.AUDIO,
|
|
53
|
+
CometChat.RECEIVER_TYPE.USER,
|
|
54
|
+
);
|
|
55
|
+
const outgoing = await CometChat.initiateCall(call, 60);
|
|
56
|
+
this.outgoing$.next(outgoing);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
async accept(call: CometChat.Call): Promise<void> {
|
|
60
|
+
const accepted = await CometChat.acceptCall(call.getSessionId());
|
|
61
|
+
this.incoming$.next(null);
|
|
62
|
+
this.active$.next(accepted.getSessionId());
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
async reject(call: CometChat.Call): Promise<void> {
|
|
66
|
+
await CometChat.rejectCall(call.getSessionId(), CometChat.CALL_STATUS.REJECTED);
|
|
67
|
+
this.incoming$.next(null);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
async cancel(call: CometChat.Call): Promise<void> {
|
|
71
|
+
await CometChat.rejectCall(call.getSessionId(), CometChat.CALL_STATUS.CANCELLED);
|
|
72
|
+
this.outgoing$.next(null);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
---
|
|
78
|
+
|
|
79
|
+
## Incoming-call component
|
|
80
|
+
|
|
81
|
+
```ts
|
|
82
|
+
@Component({
|
|
83
|
+
selector: "app-incoming-call",
|
|
84
|
+
template: `
|
|
85
|
+
<ng-container *ngIf="incoming$ | async as call">
|
|
86
|
+
<div role="alertdialog" aria-labelledby="incoming-title" class="incoming-call-overlay">
|
|
87
|
+
<h3 id="incoming-title">{{ call.getCallInitiator().getName() }}</h3>
|
|
88
|
+
<p>Incoming {{ call.getType() }} call</p>
|
|
89
|
+
<button (click)="svc.reject(call)" class="reject" aria-label="Decline call">Decline</button>
|
|
90
|
+
<button (click)="svc.accept(call)" class="accept" aria-label="Accept call">Accept</button>
|
|
91
|
+
<audio src="/assets/ringtone.mp3" autoplay loop></audio>
|
|
92
|
+
</div>
|
|
93
|
+
</ng-container>
|
|
94
|
+
`,
|
|
95
|
+
})
|
|
96
|
+
export class IncomingCallComponent {
|
|
97
|
+
incoming$ = this.svc.incoming$;
|
|
98
|
+
constructor(public svc: CallSignalingService) {}
|
|
99
|
+
}
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
Mount in `app.component.html` (root) so it survives router changes.
|
|
103
|
+
|
|
104
|
+
---
|
|
105
|
+
|
|
106
|
+
## Anti-patterns
|
|
107
|
+
|
|
108
|
+
Web sister rules apply, plus Angular-specific:
|
|
109
|
+
|
|
110
|
+
1. **Not `providedIn: "root"`.** Service registered per-module → multiple instances → duplicate listeners.
|
|
111
|
+
2. **Skipping `NgZone.run`.** OnPush components don't update; UI feels stuck.
|
|
112
|
+
3. **`(click)` handlers calling SDK methods directly.** Bypass the service → state desyncs.
|
|
113
|
+
|
|
114
|
+
---
|
|
115
|
+
|
|
116
|
+
## Verification checklist
|
|
117
|
+
|
|
118
|
+
- [ ] `CallSignalingService` is `providedIn: "root"`
|
|
119
|
+
- [ ] All callbacks wrapped in `NgZone.run`
|
|
120
|
+
- [ ] `IncomingCallComponent` mounted in `app.component.html`, not a route
|
|
121
|
+
- [ ] `removeCallListener` in `ngOnDestroy`
|
|
122
|
+
- [ ] Smoke: 2 tabs, caller initiates, recipient sees alertdialog, accept opens session
|
|
123
|
+
|
|
124
|
+
---
|
|
125
|
+
|
|
126
|
+
## Pointers
|
|
127
|
+
|
|
128
|
+
- `cometchat-react-calls/references/ringing-integration.md` — canonical
|
|
129
|
+
- `cometchat-angular-calls/SKILL.md`
|
|
130
|
+
- `references/ngzone-and-async-callbacks.md`
|
|
131
|
+
- Canonical docs: https://www.cometchat.com/docs/calls/javascript/ringing
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
# Server-side Web Push VAPID for Angular
|
|
2
|
+
|
|
3
|
+
The Web Push server template, VAPID setup, and Service Worker code from the React canonical reference apply identically to Angular — the server doesn't care which client framework rendered the page.
|
|
4
|
+
|
|
5
|
+
**Canonical docs:** https://datatracker.ietf.org/doc/html/rfc8030
|
|
6
|
+
**Read first:** `cometchat-react-calls/references/server-web-push-vapid.md` — full Node + Python templates, hard rules, sw.js receiver.
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## Angular-specific delta: Service Worker registration
|
|
11
|
+
|
|
12
|
+
Angular has its own SW story (`@angular/service-worker` for the Angular SW + `ngsw-config.json`). For Web Push receiving a CometChat call, you typically want a **separate** SW (`/public/sw.js`) for push events — using the Angular SW for both routing your app's offline cache AND CometChat call pushes mixes concerns.
|
|
13
|
+
|
|
14
|
+
```ts
|
|
15
|
+
// app.config.ts or app.module.ts
|
|
16
|
+
import { provideServiceWorker } from "@angular/service-worker";
|
|
17
|
+
|
|
18
|
+
bootstrapApplication(AppComponent, {
|
|
19
|
+
providers: [
|
|
20
|
+
provideServiceWorker("ngsw-worker.js", { enabled: environment.production }),
|
|
21
|
+
// ...
|
|
22
|
+
],
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
// In a CallPushService:
|
|
26
|
+
@Injectable({ providedIn: "root" })
|
|
27
|
+
export class CallPushService {
|
|
28
|
+
async register(currentUserUid: string): Promise<void> {
|
|
29
|
+
if (!("serviceWorker" in navigator)) return;
|
|
30
|
+
// Register the call-specific worker
|
|
31
|
+
const reg = await navigator.serviceWorker.register("/sw-call.js", { scope: "/" });
|
|
32
|
+
const sub = await reg.pushManager.subscribe({
|
|
33
|
+
userVisibleOnly: true,
|
|
34
|
+
applicationServerKey: this.urlBase64ToUint8Array(environment.vapidPublicKey),
|
|
35
|
+
});
|
|
36
|
+
await this.api.registerWebPushSubscription(currentUserUid, sub.toJSON());
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
private urlBase64ToUint8Array(b64: string): Uint8Array {
|
|
40
|
+
const padding = "=".repeat((4 - (b64.length % 4)) % 4);
|
|
41
|
+
const base64 = (b64 + padding).replace(/-/g, "+").replace(/_/g, "/");
|
|
42
|
+
const raw = atob(base64);
|
|
43
|
+
const out = new Uint8Array(raw.length);
|
|
44
|
+
for (let i = 0; i < raw.length; ++i) out[i] = raw.charCodeAt(i);
|
|
45
|
+
return out;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
`/public/sw-call.js` is identical to the React canonical reference — the call-specific worker doesn't depend on Angular.
|
|
51
|
+
|
|
52
|
+
---
|
|
53
|
+
|
|
54
|
+
## NgZone re-entry for in-app ringer
|
|
55
|
+
|
|
56
|
+
When the Service Worker `postMessage`s the open client (so an in-app ringer can fire alongside the OS notification), Angular's change detection won't pick up state updates from outside the zone. Wrap:
|
|
57
|
+
|
|
58
|
+
```ts
|
|
59
|
+
@Injectable({ providedIn: "root" })
|
|
60
|
+
export class IncomingCallService {
|
|
61
|
+
readonly incoming$ = new BehaviorSubject<IncomingCallPayload | null>(null);
|
|
62
|
+
|
|
63
|
+
constructor(private zone: NgZone) {
|
|
64
|
+
if (!("serviceWorker" in navigator)) return;
|
|
65
|
+
navigator.serviceWorker.addEventListener("message", (event) => {
|
|
66
|
+
if (event.data?.type === "incoming_call") {
|
|
67
|
+
this.zone.run(() => this.incoming$.next(event.data));
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
---
|
|
75
|
+
|
|
76
|
+
## Anti-patterns
|
|
77
|
+
|
|
78
|
+
React sister rules apply, plus Angular-specific:
|
|
79
|
+
|
|
80
|
+
1. **Mixing Angular SW (`ngsw-worker.js`) + push handlers.** Angular SW's update mechanism can disable push subscriptions on update. Use a separate SW for call pushes.
|
|
81
|
+
2. **No `NgZone.run` on `serviceWorker.message` listeners.** OnPush components don't update.
|
|
82
|
+
3. **Importing VAPID public key from a non-public env var.** Use `environment.ts` (compile-time inlined for browser).
|
|
83
|
+
|
|
84
|
+
---
|
|
85
|
+
|
|
86
|
+
## Verification checklist
|
|
87
|
+
|
|
88
|
+
- [ ] Server template: see canonical react reference
|
|
89
|
+
- [ ] Separate `sw-call.js` registered alongside Angular SW
|
|
90
|
+
- [ ] `NgZone.run` wraps the `message` handler
|
|
91
|
+
- [ ] VAPID public key in `environment.ts`
|
|
92
|
+
- [ ] Browser smoke: 2 tabs (one minimized), caller dials, recipient minimized tab gets notification
|
|
93
|
+
|
|
94
|
+
---
|
|
95
|
+
|
|
96
|
+
## Pointers
|
|
97
|
+
|
|
98
|
+
- `cometchat-react-calls/references/server-web-push-vapid.md` — canonical (full server + sw.js)
|
|
99
|
+
- `cometchat-angular-calls` SKILL.md
|
|
100
|
+
- `references/ngzone-and-async-callbacks.md`
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
# Share invite on Angular
|
|
2
|
+
|
|
3
|
+
Same SDK API as web. Angular-specific: wrap the share logic in a service so multiple call surfaces (full-screen, mini, post-call) can reuse it.
|
|
4
|
+
|
|
5
|
+
**Canonical docs:** https://www.cometchat.com/docs/calls/javascript/share-invite
|
|
6
|
+
**Read first:** `cometchat-react-calls/references/share-invite.md` — deep-link rule, share dialog UX.
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## ShareInviteService
|
|
11
|
+
|
|
12
|
+
```ts
|
|
13
|
+
import { Injectable, NgZone, Inject } from "@angular/core";
|
|
14
|
+
import { MatSnackBar } from "@angular/material/snack-bar";
|
|
15
|
+
import { CometChatCalls } from "@cometchat/calls-sdk-javascript";
|
|
16
|
+
import { APP_CONFIG, AppConfig } from "../config";
|
|
17
|
+
|
|
18
|
+
@Injectable({ providedIn: "root" })
|
|
19
|
+
export class ShareInviteService {
|
|
20
|
+
constructor(
|
|
21
|
+
private snack: MatSnackBar,
|
|
22
|
+
private zone: NgZone,
|
|
23
|
+
@Inject(APP_CONFIG) private config: AppConfig,
|
|
24
|
+
) {}
|
|
25
|
+
|
|
26
|
+
bind(sessionId: string): () => void {
|
|
27
|
+
const handler = () => this.zone.run(() => this.share(sessionId));
|
|
28
|
+
CometChatCalls.addEventListener("onShareInviteButtonClicked", handler);
|
|
29
|
+
return () => CometChatCalls.removeEventListener("onShareInviteButtonClicked", handler);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
async share(sessionId: string): Promise<void> {
|
|
33
|
+
const url = `${this.config.appUrl}/call/${sessionId}`;
|
|
34
|
+
const data = { title: "Join my call", text: "I'm on a call — tap to join.", url };
|
|
35
|
+
|
|
36
|
+
if (navigator.share && navigator.canShare?.(data)) {
|
|
37
|
+
try {
|
|
38
|
+
await navigator.share(data);
|
|
39
|
+
return;
|
|
40
|
+
} catch (err) {
|
|
41
|
+
if ((err as Error).name === "AbortError") return;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
try {
|
|
46
|
+
await navigator.clipboard.writeText(url);
|
|
47
|
+
this.snack.open("Link copied to clipboard", undefined, { duration: 2000 });
|
|
48
|
+
} catch {
|
|
49
|
+
this.snack.open(`Copy this link: ${url}`, "OK", { duration: 8000 });
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
Inject `APP_CONFIG` (your standard token for env vars) so the URL isn't hard-coded.
|
|
56
|
+
|
|
57
|
+
---
|
|
58
|
+
|
|
59
|
+
## Use in a call component
|
|
60
|
+
|
|
61
|
+
```ts
|
|
62
|
+
@Component({ /* ... */ })
|
|
63
|
+
export class CallComponent implements OnInit, OnDestroy {
|
|
64
|
+
@Input() sessionId!: string;
|
|
65
|
+
private unbind?: () => void;
|
|
66
|
+
|
|
67
|
+
constructor(private shareSvc: ShareInviteService) {}
|
|
68
|
+
|
|
69
|
+
ngOnInit() {
|
|
70
|
+
this.unbind = this.shareSvc.bind(this.sessionId);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
ngOnDestroy() {
|
|
74
|
+
this.unbind?.();
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
---
|
|
80
|
+
|
|
81
|
+
## Pass the kit setting
|
|
82
|
+
|
|
83
|
+
```ts
|
|
84
|
+
const callSettings = new CallSettingsBuilder()
|
|
85
|
+
.setHideShareInviteButton(false)
|
|
86
|
+
.build();
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
---
|
|
90
|
+
|
|
91
|
+
## Anti-patterns
|
|
92
|
+
|
|
93
|
+
Web sister rules apply, plus Angular-specific:
|
|
94
|
+
|
|
95
|
+
1. **No `NgZone.run` wrap on the SDK callback.** `MatSnackBar.open` doesn't show in OnPush components.
|
|
96
|
+
2. **Service in feature module, not root.** Provider lifecycle desyncs with router.
|
|
97
|
+
3. **Hard-coded `https://yourapp.com`.** Use `APP_CONFIG` injection token.
|
|
98
|
+
|
|
99
|
+
---
|
|
100
|
+
|
|
101
|
+
## Verification checklist
|
|
102
|
+
|
|
103
|
+
- [ ] `ShareInviteService` provided in root
|
|
104
|
+
- [ ] App URL via `APP_CONFIG` (not hard-coded)
|
|
105
|
+
- [ ] `NgZone.run` wraps the callback
|
|
106
|
+
- [ ] Listener cleaned up in `ngOnDestroy`
|
|
107
|
+
- [ ] Browser smoke: copy link → paste in incognito → join call
|
|
108
|
+
|
|
109
|
+
---
|
|
110
|
+
|
|
111
|
+
## Pointers
|
|
112
|
+
|
|
113
|
+
- `cometchat-react-calls/references/share-invite.md` — sister
|
|
114
|
+
- `cometchat-angular-calls` SKILL.md
|
|
115
|
+
- `references/ngzone-and-async-callbacks.md`
|
|
116
|
+
- Canonical docs: https://www.cometchat.com/docs/calls/javascript/share-invite
|
|
@@ -3,7 +3,7 @@ name: cometchat-angular-components
|
|
|
3
3
|
description: "Component catalog for the CometChat Angular UI Kit v4 — HTML selector names, Angular Input bindings, Output events, slot templates, request builders, style objects, and composite components. Always loaded before writing <cometchat-*> HTML."
|
|
4
4
|
license: "MIT"
|
|
5
5
|
compatibility: "Angular >=12 <=15; @cometchat/chat-uikit-angular ^4; @cometchat/chat-sdk-javascript ^4"
|
|
6
|
-
allowed-tools: "
|
|
6
|
+
allowed-tools: "shell, file-read, file-search, file-list, ask-user"
|
|
7
7
|
metadata:
|
|
8
8
|
author: "CometChat"
|
|
9
9
|
version: "3.0.0"
|
|
@@ -3,7 +3,7 @@ name: cometchat-angular-core
|
|
|
3
3
|
description: "Foundational rules for CometChat Angular UI Kit v4 integration — UIKitSettingsBuilder init pattern, login order, CometChatThemeService, environment config via src/environments/environment.ts, and anti-patterns that break real Angular apps."
|
|
4
4
|
license: "MIT"
|
|
5
5
|
compatibility: "Angular >=12 <=15; @cometchat/chat-uikit-angular ^4; @cometchat/chat-sdk-javascript ^4"
|
|
6
|
-
allowed-tools: "
|
|
6
|
+
allowed-tools: "shell, file-read, file-search, file-list, ask-user"
|
|
7
7
|
metadata:
|
|
8
8
|
author: "CometChat"
|
|
9
9
|
version: "3.0.0"
|
|
@@ -3,7 +3,7 @@ name: cometchat-angular-customization
|
|
|
3
3
|
description: "Customize the CometChat Angular UI Kit without forking — four-tier model: Angular inputs → request builders → text formatters + message templates → DataSource decorators + event bus."
|
|
4
4
|
license: "MIT"
|
|
5
5
|
compatibility: "Angular >=12 <=15; @cometchat/chat-uikit-angular ^4; @cometchat/chat-sdk-javascript ^4"
|
|
6
|
-
allowed-tools: "
|
|
6
|
+
allowed-tools: "shell, file-read, file-search, file-list, ask-user"
|
|
7
7
|
metadata:
|
|
8
8
|
author: "CometChat"
|
|
9
9
|
version: "3.0.0"
|
|
@@ -3,7 +3,7 @@ name: cometchat-angular-features
|
|
|
3
3
|
description: "Feature catalog for Angular — calls (separate SDK), extensions (polls / stickers / translation / link preview / collaborative doc / whiteboard), AI features (smart replies / conversation summary / conversation starter), AI agent. Six-bucket taxonomy: default / extension / ai-feature / dashboard-only / package-install / component-swap."
|
|
4
4
|
license: "MIT"
|
|
5
5
|
compatibility: "Angular >=12 <=15; @cometchat/chat-uikit-angular ^4; @cometchat/chat-sdk-javascript ^4"
|
|
6
|
-
allowed-tools: "
|
|
6
|
+
allowed-tools: "shell, file-read, file-search, file-list, ask-user"
|
|
7
7
|
metadata:
|
|
8
8
|
author: "CometChat"
|
|
9
9
|
version: "3.0.0"
|
|
@@ -3,7 +3,7 @@ name: cometchat-angular-patterns
|
|
|
3
3
|
description: "Angular-specific integration patterns for CometChat UI Kit v4 — lazy loading, route guards, Angular Router integration, APP_INITIALIZER setup, standalone vs NgModule, and SSR/Universal considerations."
|
|
4
4
|
license: "MIT"
|
|
5
5
|
compatibility: "Angular >=12 <=15; @cometchat/chat-uikit-angular ^4; @cometchat/chat-sdk-javascript ^4"
|
|
6
|
-
allowed-tools: "
|
|
6
|
+
allowed-tools: "shell, file-read, file-search, file-list, ask-user"
|
|
7
7
|
metadata:
|
|
8
8
|
author: "CometChat"
|
|
9
9
|
version: "3.0.0"
|
|
@@ -3,7 +3,7 @@ name: cometchat-angular-placement
|
|
|
3
3
|
description: "Where to put chat in an Angular app — Route-based, Sidebar, Modal/Dialog, Tab-based, and Embedded placements. Maps each to CometChat component composition with Angular Router wiring and layout patterns."
|
|
4
4
|
license: "MIT"
|
|
5
5
|
compatibility: "Angular >=12 <=15; @cometchat/chat-uikit-angular ^4; @cometchat/chat-sdk-javascript ^4"
|
|
6
|
-
allowed-tools: "
|
|
6
|
+
allowed-tools: "shell, file-read, file-search, file-list, ask-user"
|
|
7
7
|
metadata:
|
|
8
8
|
author: "CometChat"
|
|
9
9
|
version: "3.0.0"
|
|
@@ -3,7 +3,7 @@ name: cometchat-angular-production
|
|
|
3
3
|
description: "Production-readiness for Angular — server-minted auth tokens, user management CRUD, external-backend recipes (Express / Hono / Firebase Functions / Vercel). Angular has no API routes, so the backend is always external."
|
|
4
4
|
license: "MIT"
|
|
5
5
|
compatibility: "Angular >=12 <=15; @cometchat/chat-uikit-angular ^4; @cometchat/chat-sdk-javascript ^4"
|
|
6
|
-
allowed-tools: "
|
|
6
|
+
allowed-tools: "shell, file-read, file-search, file-list, ask-user"
|
|
7
7
|
metadata:
|
|
8
8
|
author: "CometChat"
|
|
9
9
|
version: "3.0.0"
|