@livechatta/sdk 0.0.0-stage → 1.0.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/CHANGELOG.md +218 -0
- package/LICENSE +21 -0
- package/README.md +2558 -2
- package/bin/chatta.mjs +7 -0
- package/bin/lib/cli.d.mts +46 -0
- package/bin/lib/cli.mjs +2088 -0
- package/dist/cjs/livechatta.cjs.js +7258 -0
- package/dist/cjs/livechatta.cjs.js.map +1 -0
- package/dist/cjs/livechatta.cjs.min.js +2 -0
- package/dist/cjs/livechatta.cjs.min.js.map +1 -0
- package/dist/esm/livechatta.esm.js +7077 -0
- package/dist/esm/livechatta.esm.js.map +1 -0
- package/dist/esm/livechatta.esm.min.js +2 -0
- package/dist/esm/livechatta.esm.min.js.map +1 -0
- package/dist/platforms/android/LiveChattaClient.kt +367 -0
- package/dist/platforms/android/LiveChattaHttpAPI.kt +2630 -0
- package/dist/platforms/android/LiveChattaJson.kt +83 -0
- package/dist/platforms/android/LiveChattaModels.kt +22805 -0
- package/dist/platforms/android/LiveChattaSentFrom.kt +30 -0
- package/dist/platforms/android/LiveChattaSocketAPI.kt +2113 -0
- package/dist/platforms/android/LiveChattaTyped.kt +239 -0
- package/dist/platforms/android/LiveChattaWebView.kt +158 -0
- package/dist/platforms/angular/livechatta-bridge.service.d.ts +35 -0
- package/dist/platforms/angular/livechatta-bridge.service.js +1 -0
- package/dist/platforms/angular/livechatta-bridge.service.js.map +1 -0
- package/dist/platforms/angular/livechatta-embed.component.d.ts +46 -0
- package/dist/platforms/angular/livechatta-embed.component.js +1 -0
- package/dist/platforms/angular/livechatta-embed.component.js.map +1 -0
- package/dist/platforms/angular/livechatta.service.d.ts +66 -0
- package/dist/platforms/angular/livechatta.service.js +1 -0
- package/dist/platforms/angular/livechatta.service.js.map +1 -0
- package/dist/platforms/capacitor/CapacitorBridge.d.ts +27 -0
- package/dist/platforms/capacitor/CapacitorBridge.js +1 -0
- package/dist/platforms/capacitor/CapacitorBridge.js.map +1 -0
- package/dist/platforms/capacitor/CapacitorDeepLinks.d.ts +23 -0
- package/dist/platforms/capacitor/CapacitorDeepLinks.js +1 -0
- package/dist/platforms/capacitor/CapacitorDeepLinks.js.map +1 -0
- package/dist/platforms/capacitor/CapacitorPermissions.d.ts +29 -0
- package/dist/platforms/capacitor/CapacitorPermissions.js +1 -0
- package/dist/platforms/capacitor/CapacitorPermissions.js.map +1 -0
- package/dist/platforms/capacitor/CapacitorPush.d.ts +33 -0
- package/dist/platforms/capacitor/CapacitorPush.js +1 -0
- package/dist/platforms/capacitor/CapacitorPush.js.map +1 -0
- package/dist/platforms/capacitor/index.d.ts +24 -0
- package/dist/platforms/capacitor/index.js +1 -0
- package/dist/platforms/capacitor/index.js.map +1 -0
- package/dist/platforms/flutter/livechatta_client.dart +359 -0
- package/dist/platforms/flutter/livechatta_http_api.dart +1942 -0
- package/dist/platforms/flutter/livechatta_json.dart +57 -0
- package/dist/platforms/flutter/livechatta_models.dart +23531 -0
- package/dist/platforms/flutter/livechatta_sent_from.dart +35 -0
- package/dist/platforms/flutter/livechatta_socket_api.dart +1504 -0
- package/dist/platforms/flutter/livechatta_typed.dart +234 -0
- package/dist/platforms/flutter/livechatta_webview.dart +190 -0
- package/dist/platforms/ios/LiveChattaClient.swift +374 -0
- package/dist/platforms/ios/LiveChattaHttpAPI.swift +2431 -0
- package/dist/platforms/ios/LiveChattaJSON.swift +84 -0
- package/dist/platforms/ios/LiveChattaModels.swift +27050 -0
- package/dist/platforms/ios/LiveChattaSentFrom.swift +32 -0
- package/dist/platforms/ios/LiveChattaSocketAPI.swift +1446 -0
- package/dist/platforms/ios/LiveChattaTyped.swift +268 -0
- package/dist/platforms/ios/LiveChattaWebView.swift +191 -0
- package/dist/platforms/nuxt/LiveChattaView.d.ts +1 -0
- package/dist/platforms/nuxt/LiveChattaView.js +1 -0
- package/dist/platforms/nuxt/LiveChattaView.js.map +1 -0
- package/dist/platforms/nuxt/useChattaBridge.d.ts +9 -0
- package/dist/platforms/nuxt/useChattaBridge.js +1 -0
- package/dist/platforms/nuxt/useChattaBridge.js.map +1 -0
- package/dist/platforms/nuxt/useLiveChatta.d.ts +63 -0
- package/dist/platforms/nuxt/useLiveChatta.js +1 -0
- package/dist/platforms/nuxt/useLiveChatta.js.map +1 -0
- package/dist/platforms/react/LiveChattaView.d.ts +58 -0
- package/dist/platforms/react/LiveChattaView.js +1 -0
- package/dist/platforms/react/LiveChattaView.js.map +1 -0
- package/dist/platforms/react/useChattaBridge.d.ts +1 -0
- package/dist/platforms/react/useChattaBridge.js +1 -0
- package/dist/platforms/react/useChattaBridge.js.map +1 -0
- package/dist/platforms/react/useChattaDeepLink.d.ts +2 -0
- package/dist/platforms/react/useChattaDeepLink.js +1 -0
- package/dist/platforms/react/useChattaDeepLink.js.map +1 -0
- package/dist/platforms/react/useChattaPermissions.d.ts +9 -0
- package/dist/platforms/react/useChattaPermissions.js +1 -0
- package/dist/platforms/react/useChattaPermissions.js.map +1 -0
- package/dist/platforms/react/useChattaUnread.d.ts +1 -0
- package/dist/platforms/react/useChattaUnread.js +1 -0
- package/dist/platforms/react/useChattaUnread.js.map +1 -0
- package/dist/platforms/react/useLiveChatta.d.ts +29 -0
- package/dist/platforms/react/useLiveChatta.js +1 -0
- package/dist/platforms/react/useLiveChatta.js.map +1 -0
- package/dist/platforms/react-native/LiveChattaView.d.ts +52 -0
- package/dist/platforms/react-native/LiveChattaView.js +1 -0
- package/dist/platforms/react-native/LiveChattaView.js.map +1 -0
- package/dist/platforms/react-native/useChattaBridge.d.ts +12 -0
- package/dist/platforms/react-native/useChattaBridge.js +1 -0
- package/dist/platforms/react-native/useChattaBridge.js.map +1 -0
- package/dist/platforms/react-native/useLiveChatta.d.ts +29 -0
- package/dist/platforms/react-native/useLiveChatta.js +1 -0
- package/dist/platforms/react-native/useLiveChatta.js.map +1 -0
- package/dist/platforms/svelte/LiveChattaEmbed.d.ts +54 -0
- package/dist/platforms/svelte/LiveChattaEmbed.js +1 -0
- package/dist/platforms/svelte/LiveChattaEmbed.js.map +1 -0
- package/dist/platforms/svelte/chattaBridgeStore.d.ts +19 -0
- package/dist/platforms/svelte/chattaBridgeStore.js +1 -0
- package/dist/platforms/svelte/chattaBridgeStore.js.map +1 -0
- package/dist/platforms/svelte/useLiveChatta.d.ts +61 -0
- package/dist/platforms/svelte/useLiveChatta.js +1 -0
- package/dist/platforms/svelte/useLiveChatta.js.map +1 -0
- package/dist/platforms/tauri/TauriBridge.d.ts +34 -0
- package/dist/platforms/tauri/TauriBridge.js +1 -0
- package/dist/platforms/tauri/TauriBridge.js.map +1 -0
- package/dist/platforms/tauri/TauriDeepLinks.d.ts +29 -0
- package/dist/platforms/tauri/TauriDeepLinks.js +1 -0
- package/dist/platforms/tauri/TauriDeepLinks.js.map +1 -0
- package/dist/platforms/tauri/TauriPermissions.d.ts +21 -0
- package/dist/platforms/tauri/TauriPermissions.js +1 -0
- package/dist/platforms/tauri/TauriPermissions.js.map +1 -0
- package/dist/platforms/tauri/TauriUpdater.d.ts +31 -0
- package/dist/platforms/tauri/TauriUpdater.js +1 -0
- package/dist/platforms/tauri/TauriUpdater.js.map +1 -0
- package/dist/platforms/tauri/index.d.ts +22 -0
- package/dist/platforms/tauri/index.js +1 -0
- package/dist/platforms/tauri/index.js.map +1 -0
- package/dist/platforms/vue/LiveChattaView.d.ts +1 -0
- package/dist/platforms/vue/LiveChattaView.js +1 -0
- package/dist/platforms/vue/LiveChattaView.js.map +1 -0
- package/dist/platforms/vue/useChattaBridge.d.ts +11 -0
- package/dist/platforms/vue/useChattaBridge.js +1 -0
- package/dist/platforms/vue/useChattaBridge.js.map +1 -0
- package/dist/platforms/vue/useChattaDeepLink.d.ts +2 -0
- package/dist/platforms/vue/useChattaDeepLink.js +1 -0
- package/dist/platforms/vue/useChattaDeepLink.js.map +1 -0
- package/dist/platforms/vue/useChattaPermissions.d.ts +9 -0
- package/dist/platforms/vue/useChattaPermissions.js +1 -0
- package/dist/platforms/vue/useChattaPermissions.js.map +1 -0
- package/dist/platforms/vue/useChattaUnread.d.ts +8 -0
- package/dist/platforms/vue/useChattaUnread.js +1 -0
- package/dist/platforms/vue/useChattaUnread.js.map +1 -0
- package/dist/platforms/vue/useLiveChatta.d.ts +58 -0
- package/dist/platforms/vue/useLiveChatta.js +1 -0
- package/dist/platforms/vue/useLiveChatta.js.map +1 -0
- package/dist/platforms/web/LiveChattaEmbed.d.ts +94 -0
- package/dist/platforms/web/LiveChattaEmbed.js +1 -0
- package/dist/platforms/web/LiveChattaEmbed.js.map +1 -0
- package/dist/platforms/web/bridge.d.ts +8 -0
- package/dist/platforms/web/bridge.js +1 -0
- package/dist/platforms/web/bridge.js.map +1 -0
- package/dist/platforms/web/permissions.d.ts +8 -0
- package/dist/platforms/web/permissions.js +1 -0
- package/dist/platforms/web/permissions.js.map +1 -0
- package/dist/types/billing.d.ts +355 -0
- package/dist/types/billing.js +53 -0
- package/dist/types/billing.js.map +1 -0
- package/dist/types/calendar.d.ts +132 -0
- package/dist/types/calendar.js +15 -0
- package/dist/types/calendar.js.map +1 -0
- package/dist/types/chat-core.d.ts +901 -0
- package/dist/types/chat-core.js +98 -0
- package/dist/types/chat-core.js.map +1 -0
- package/dist/types/chat-features.d.ts +775 -0
- package/dist/types/chat-features.js +50 -0
- package/dist/types/chat-features.js.map +1 -0
- package/dist/types/content.d.ts +138 -0
- package/dist/types/content.js +2 -0
- package/dist/types/content.js.map +1 -0
- package/dist/types/core/AutoRefresh.d.ts +68 -0
- package/dist/types/core/Bridge.d.ts +124 -0
- package/dist/types/core/Config.d.ts +26 -0
- package/dist/types/core/DeepLinks.d.ts +38 -0
- package/dist/types/core/EventBus.d.ts +15 -0
- package/dist/types/core/GrantStore.d.ts +29 -0
- package/dist/types/core/LiveChatta.d.ts +128 -0
- package/dist/types/core/Permissions.d.ts +34 -0
- package/dist/types/core/TokenManager.d.ts +25 -0
- package/dist/types/core/events.d.ts +140 -0
- package/dist/types/csat.d.ts +110 -0
- package/dist/types/csat.js +12 -0
- package/dist/types/csat.js.map +1 -0
- package/dist/types/events.d.ts +242 -0
- package/dist/types/events.js +275 -0
- package/dist/types/events.js.map +1 -0
- package/dist/types/extras.d.ts +353 -0
- package/dist/types/extras.js +31 -0
- package/dist/types/extras.js.map +1 -0
- package/dist/types/http/HttpAPI.d.ts +944 -0
- package/dist/types/http/HttpTransport.d.ts +66 -0
- package/dist/types/http/incomingWebhook.d.ts +17 -0
- package/dist/types/incoming-webhooks.d.ts +78 -0
- package/dist/types/incoming-webhooks.js +16 -0
- package/dist/types/incoming-webhooks.js.map +1 -0
- package/dist/types/index.d.ts +15 -0
- package/dist/types/index.js +16 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/liveflex.d.ts +578 -0
- package/dist/types/liveflex.js +7 -0
- package/dist/types/liveflex.js.map +1 -0
- package/dist/types/models.d.ts +1753 -0
- package/dist/types/models.js +148 -0
- package/dist/types/models.js.map +1 -0
- package/dist/types/options.d.ts +190 -0
- package/dist/types/options.js +43 -0
- package/dist/types/options.js.map +1 -0
- package/dist/types/shared-channels.d.ts +236 -0
- package/dist/types/shared-channels.js +50 -0
- package/dist/types/shared-channels.js.map +1 -0
- package/dist/types/socket/SocketAPI.d.ts +1026 -0
- package/dist/types/socket/SocketTransport.d.ts +44 -0
- package/dist/types/types/billing.d.ts +355 -0
- package/dist/types/types/calendar.d.ts +132 -0
- package/dist/types/types/chat-core.d.ts +901 -0
- package/dist/types/types/chat-features.d.ts +775 -0
- package/dist/types/types/content.d.ts +138 -0
- package/dist/types/types/csat.d.ts +110 -0
- package/dist/types/types/events.d.ts +242 -0
- package/dist/types/types/extras.d.ts +353 -0
- package/dist/types/types/incoming-webhooks.d.ts +78 -0
- package/dist/types/types/index.d.ts +15 -0
- package/dist/types/types/liveflex.d.ts +578 -0
- package/dist/types/types/models.d.ts +1753 -0
- package/dist/types/types/options.d.ts +190 -0
- package/dist/types/types/shared-channels.d.ts +236 -0
- package/dist/types/types/workspace-gifs.d.ts +95 -0
- package/dist/types/types/workspace.d.ts +390 -0
- package/dist/types/ui/EmbedConfig.d.ts +38 -0
- package/dist/types/ui/EmbedUI.d.ts +44 -0
- package/dist/types/ui/Launcher.d.ts +122 -0
- package/dist/types/ui/brand.d.ts +27 -0
- package/dist/types/ui/embedMessages.d.ts +23 -0
- package/dist/types/ui/hours.d.ts +35 -0
- package/dist/types/ui/prechat.d.ts +35 -0
- package/dist/types/ui/widgetConfig.d.ts +4 -0
- package/dist/types/utils/crypto.d.ts +6 -0
- package/dist/types/utils/hmac.d.ts +40 -0
- package/dist/types/utils/permissions.d.ts +5 -0
- package/dist/types/utils/platform.d.ts +18 -0
- package/dist/types/utils/visitor.d.ts +2 -0
- package/dist/types/workspace-gifs.d.ts +95 -0
- package/dist/types/workspace-gifs.js +3 -0
- package/dist/types/workspace-gifs.js.map +1 -0
- package/dist/types/workspace.d.ts +390 -0
- package/dist/types/workspace.js +13 -0
- package/dist/types/workspace.js.map +1 -0
- package/dist/umd/livechatta.umd.js +7262 -0
- package/dist/umd/livechatta.umd.js.map +1 -0
- package/dist/umd/livechatta.umd.min.js +2 -0
- package/dist/umd/livechatta.umd.min.js.map +1 -0
- package/package.json +278 -4
|
@@ -0,0 +1,1504 @@
|
|
|
1
|
+
/// Flutter socket API mirroring the TypeScript SocketAPI: emitters ack via callback, listeners
|
|
2
|
+
/// register for server events. Usage: README "Flutter (Dart)".
|
|
3
|
+
|
|
4
|
+
import 'package:socket_io_client/socket_io_client.dart' as IO;
|
|
5
|
+
import 'livechatta_client.dart';
|
|
6
|
+
|
|
7
|
+
/// FCM data of an incoming-call push; Decline without a socket = api().declineHopInvite(sessionId).
|
|
8
|
+
class LiveChattaIncomingCall {
|
|
9
|
+
static const type = 'HOP_INVITE';
|
|
10
|
+
static const category = 'INCOMING_CALL';
|
|
11
|
+
static const androidChannel = 'livechatta_calls';
|
|
12
|
+
static const ringSeconds = 30;
|
|
13
|
+
static const actionAnswer = 'ANSWER';
|
|
14
|
+
static const actionDecline = 'DECLINE';
|
|
15
|
+
|
|
16
|
+
final String callId;
|
|
17
|
+
final String sessionId;
|
|
18
|
+
final String conversationId;
|
|
19
|
+
final String invitedByName;
|
|
20
|
+
final int participantCount;
|
|
21
|
+
final String linkCode;
|
|
22
|
+
/// 'audio' or 'video' ('' on older servers).
|
|
23
|
+
final String media;
|
|
24
|
+
/// Single-use, ~2 min, for `api().pushDeclineCall(token)`; '' for calls over 50 people.
|
|
25
|
+
final String declineToken;
|
|
26
|
+
final String declineUrl;
|
|
27
|
+
|
|
28
|
+
const LiveChattaIncomingCall({
|
|
29
|
+
required this.callId,
|
|
30
|
+
required this.sessionId,
|
|
31
|
+
required this.conversationId,
|
|
32
|
+
required this.invitedByName,
|
|
33
|
+
required this.participantCount,
|
|
34
|
+
required this.linkCode,
|
|
35
|
+
this.media = '',
|
|
36
|
+
this.declineToken = '',
|
|
37
|
+
this.declineUrl = '',
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
/// Parses RemoteMessage.data (string values); null when it is not a call push.
|
|
41
|
+
static LiveChattaIncomingCall? fromData(Map<String, dynamic> data) {
|
|
42
|
+
String str(String k) => data[k]?.toString() ?? '';
|
|
43
|
+
if (str('type') != type) return null;
|
|
44
|
+
final session = str('sessionId').isNotEmpty ? str('sessionId') : str('callId');
|
|
45
|
+
if (session.isEmpty) return null;
|
|
46
|
+
return LiveChattaIncomingCall(
|
|
47
|
+
callId: str('callId').isNotEmpty ? str('callId') : session,
|
|
48
|
+
sessionId: session,
|
|
49
|
+
conversationId: str('conversationId'),
|
|
50
|
+
invitedByName: str('invitedByName'),
|
|
51
|
+
participantCount: int.tryParse(str('participantCount')) ?? 0,
|
|
52
|
+
linkCode: str('linkCode'),
|
|
53
|
+
media: str('media'),
|
|
54
|
+
declineToken: str('declineToken'),
|
|
55
|
+
declineUrl: str('declineUrl'),
|
|
56
|
+
);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/// HOP_INVITE_CANCEL push: stop the native ring; reason answered | declined | ended.
|
|
61
|
+
class LiveChattaCallCancel {
|
|
62
|
+
static const type = 'HOP_INVITE_CANCEL';
|
|
63
|
+
final String callId;
|
|
64
|
+
final String sessionId;
|
|
65
|
+
final String reason;
|
|
66
|
+
|
|
67
|
+
const LiveChattaCallCancel({required this.callId, required this.sessionId, required this.reason});
|
|
68
|
+
|
|
69
|
+
static LiveChattaCallCancel? fromData(Map<String, dynamic> data) {
|
|
70
|
+
String str(String k) => data[k]?.toString() ?? '';
|
|
71
|
+
if (str('type') != type) return null;
|
|
72
|
+
final session = str('sessionId').isNotEmpty ? str('sessionId') : str('callId');
|
|
73
|
+
if (session.isEmpty) return null;
|
|
74
|
+
const reasons = {'answered', 'declined', 'ended'};
|
|
75
|
+
return LiveChattaCallCancel(
|
|
76
|
+
callId: str('callId').isNotEmpty ? str('callId') : session,
|
|
77
|
+
sessionId: session,
|
|
78
|
+
reason: reasons.contains(str('reason')) ? str('reason') : 'ended',
|
|
79
|
+
);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
class LiveChattaSocketAPI {
|
|
84
|
+
final IO.Socket _socket;
|
|
85
|
+
final LiveChattaClient _client;
|
|
86
|
+
|
|
87
|
+
// Offline message queue
|
|
88
|
+
final List<_QueuedEmit> _queue = [];
|
|
89
|
+
|
|
90
|
+
/// Called with (event, error) when the server denies an emit; that emit's callback then gets null.
|
|
91
|
+
void Function(String event, dynamic error)? onAckError;
|
|
92
|
+
|
|
93
|
+
// Event constants — matching server ChatEvent enum
|
|
94
|
+
static const allConversations = 'all-conversations';
|
|
95
|
+
static const newConversation = 'new-conversation';
|
|
96
|
+
static const enterConversation = 'enter-conversation';
|
|
97
|
+
static const joinConversation = 'join-conversation';
|
|
98
|
+
static const editConversation = 'edit-conversation';
|
|
99
|
+
static const makeAdminConversation = 'make-admin-conversation';
|
|
100
|
+
static const toggleConversation = 'toggle-conversation';
|
|
101
|
+
static const statusChangeConversation = 'status-change-conversation';
|
|
102
|
+
static const memberStatusChangeConversation = 'member-status-change-conversation';
|
|
103
|
+
static const messageStatusChange = 'message-status-change';
|
|
104
|
+
static const messageReaction = 'message-reaction';
|
|
105
|
+
static const validatePasswordEvent = 'validate-password';
|
|
106
|
+
static const allMessages = 'all-messages';
|
|
107
|
+
static const newMessage = 'new-message';
|
|
108
|
+
static const newTyping = 'new-typing';
|
|
109
|
+
static const saveDraftEvent = 'save-draft';
|
|
110
|
+
static const draftUpdated = 'draft-updated';
|
|
111
|
+
static const forgotPasswordEvent = 'forgot-password';
|
|
112
|
+
static const changePasswordEvent = 'change-password';
|
|
113
|
+
static const resetPasswordEvent = 'reset-password';
|
|
114
|
+
static const refreshTokenEvent = 'refresh-token';
|
|
115
|
+
static const revokeTokenEvent = 'revoke-token';
|
|
116
|
+
static const online = 'online';
|
|
117
|
+
static const offline = 'offline';
|
|
118
|
+
static const chatError = 'chat-error';
|
|
119
|
+
static const unreadCountUpdate = 'unread-count-update';
|
|
120
|
+
static const notification = 'notification';
|
|
121
|
+
static const editMessageEvent = 'edit-message';
|
|
122
|
+
static const forwardMessageEvent = 'forward-message';
|
|
123
|
+
static const forwardPostEvent = 'forward-post';
|
|
124
|
+
static const messageFailed = 'message-failed';
|
|
125
|
+
static const messageReadEvent = 'message-read';
|
|
126
|
+
static const searchMessagesEvent = 'search-messages';
|
|
127
|
+
static const scheduledMessageEvent = 'scheduled-message';
|
|
128
|
+
static const searchChatUsersEvent = 'search-chat-users';
|
|
129
|
+
static const threadMessagesEvent = 'thread-messages';
|
|
130
|
+
static const toggleBookmarkEvent = 'toggle-bookmark';
|
|
131
|
+
static const getBookmarksEvent = 'get-bookmarks';
|
|
132
|
+
static const getAllBookmarksEvent = 'get-all-bookmarks';
|
|
133
|
+
static const membershipRevoked = 'membership-revoked';
|
|
134
|
+
static const sharedChannelInviteEvent = 'shared-channel-invite';
|
|
135
|
+
static const sharedChannelUpdatedEvent = 'shared-channel-updated';
|
|
136
|
+
static const votePollEvent = 'vote-poll';
|
|
137
|
+
static const pinConversationEvent = 'pin-conversation';
|
|
138
|
+
static const conversationMembersEvent = 'conversation-members';
|
|
139
|
+
static const allThreadsEvent = 'all-threads';
|
|
140
|
+
static const getPostMessagesEvent = 'get-post-messages';
|
|
141
|
+
// Chat-link-wide @mention handle list (Redis-cached on the server).
|
|
142
|
+
static const linkHandlesEvent = 'link-handles';
|
|
143
|
+
// Real-time broadcasts when a chat user joins / updates in this link.
|
|
144
|
+
static const linkUserJoinedEvent = 'link-user-joined';
|
|
145
|
+
static const linkUserUpdatedEvent = 'link-user-updated';
|
|
146
|
+
|
|
147
|
+
// ========= HOP (voice / video / meetings) =========
|
|
148
|
+
static const hopStartEvent = 'hop-start';
|
|
149
|
+
static const hopEndEvent = 'hop-end';
|
|
150
|
+
static const hopJoinEvent = 'hop-join';
|
|
151
|
+
static const hopLeaveEvent = 'hop-leave';
|
|
152
|
+
static const hopConnectTransportEvent = 'hop-connect-transport';
|
|
153
|
+
static const hopProduceEvent = 'hop-produce';
|
|
154
|
+
static const hopConsumeEvent = 'hop-consume';
|
|
155
|
+
static const hopResumeConsumerEvent = 'hop-resume-consumer';
|
|
156
|
+
static const hopMediaChangeEvent = 'hop-media-change';
|
|
157
|
+
static const hopScreenShareStartEvent = 'hop-screenshare-start';
|
|
158
|
+
static const hopScreenShareStopEvent = 'hop-screenshare-stop';
|
|
159
|
+
static const hopRecordingStartEvent = 'hop-recording-start';
|
|
160
|
+
static const hopRecordingStopEvent = 'hop-recording-stop';
|
|
161
|
+
static const hopInviteDeclineEvent = 'hop-invite-decline';
|
|
162
|
+
static const hopAdmitEvent = 'hop-admit';
|
|
163
|
+
static const hopDenyEvent = 'hop-deny';
|
|
164
|
+
static const hopIceRestartEvent = 'hop-ice-restart';
|
|
165
|
+
static const hopRejoinRoomEvent = 'hop-rejoin-room';
|
|
166
|
+
static const hopAdHocStartEvent = 'hop-ad-hoc-start';
|
|
167
|
+
static const hopInviteRequestEvent = 'hop-invite-request';
|
|
168
|
+
static const hopGetSessionEvent = 'hop-get-session';
|
|
169
|
+
static const hopListProducersEvent = 'hop-list-producers';
|
|
170
|
+
static const hopListParticipantsEvent = 'hop-list-participants';
|
|
171
|
+
static const hopMuteParticipantEvent = 'hop-mute-participant';
|
|
172
|
+
static const hopDropParticipantEvent = 'hop-drop-participant';
|
|
173
|
+
static const hopPinForAllEvent = 'hop-pin-for-all';
|
|
174
|
+
static const hopListActiveEvent = 'hop-list-active';
|
|
175
|
+
static const hopMeetingCreateEvent = 'hop-meeting-create';
|
|
176
|
+
static const hopMeetingCancelEvent = 'hop-meeting-cancel';
|
|
177
|
+
static const hopMeetingListEvent = 'hop-meeting-list';
|
|
178
|
+
// Broadcasts
|
|
179
|
+
static const hopStartedEvent = 'hop-started';
|
|
180
|
+
static const hopEndedEvent = 'hop-ended';
|
|
181
|
+
static const hopParticipantJoinedEvent = 'hop-participant-joined';
|
|
182
|
+
static const hopParticipantLeftEvent = 'hop-participant-left';
|
|
183
|
+
static const hopNewProducerEvent = 'hop-new-producer';
|
|
184
|
+
static const hopProducerClosedEvent = 'hop-producer-closed';
|
|
185
|
+
static const hopInviteEvent = 'hop-invite';
|
|
186
|
+
static const hopLobbyWaitingEvent = 'hop-lobby-waiting';
|
|
187
|
+
static const hopDeniedEvent = 'hop-denied';
|
|
188
|
+
static const hopRedirectEvent = 'hop-redirect';
|
|
189
|
+
static const hopRecordingStartedEvent = 'hop-recording-started';
|
|
190
|
+
static const hopRecordingStoppedEvent = 'hop-recording-stopped';
|
|
191
|
+
static const hopRecordingReadyEvent = 'hop-recording-ready';
|
|
192
|
+
static const hopRecordingAlreadyActiveEvent = 'hop-recording-already-active';
|
|
193
|
+
static const hopRecordingForbiddenEvent = 'hop-recording-forbidden';
|
|
194
|
+
static const hopInviteDeclinedEvent = 'hop-invite-declined';
|
|
195
|
+
static const hopScreenShareStartedEvent = 'hop-screenshare-started';
|
|
196
|
+
static const hopMediaChangedEvent = 'hop-media-changed';
|
|
197
|
+
static const hopTransportParamsEvent = 'hop-transport-params';
|
|
198
|
+
static const hopMeetingReminderEvent = 'hop-meeting-reminder';
|
|
199
|
+
static const hopReactionEvent = 'hop-reaction';
|
|
200
|
+
static const hopKeepWaitingEvent = 'hop-keep-waiting';
|
|
201
|
+
static const hopVoteEvent = 'hop-vote';
|
|
202
|
+
static const hopVoteUpdatedEvent = 'hop-vote-updated';
|
|
203
|
+
static const hopRaiseHandEvent = 'hop-raise-hand';
|
|
204
|
+
static const hopNewVoteRoundEvent = 'hop-new-vote-round';
|
|
205
|
+
static const hopVoteCompleteEvent = 'hop-vote-complete';
|
|
206
|
+
static const hopHostChangedEvent = 'hop-host-changed';
|
|
207
|
+
static const hopMakeHostEvent = 'hop-make-host';
|
|
208
|
+
static const hopParticipantMutedEvent = 'hop-participant-muted';
|
|
209
|
+
static const hopPinnedForAllEvent = 'hop-pinned-for-all';
|
|
210
|
+
static const hopParticipantDroppedEvent = 'hop-participant-dropped';
|
|
211
|
+
static const hopYouWereDroppedEvent = 'hop-you-were-dropped';
|
|
212
|
+
static const hopInviteAnsweredEvent = 'hop-invite-answered';
|
|
213
|
+
static const hopUnmuteRequestedEvent = 'hop-unmute-requested';
|
|
214
|
+
static const hopAdmittedEvent = 'hop-admitted';
|
|
215
|
+
static const aiCreditsUpdatedEvent = 'ai-credits-updated';
|
|
216
|
+
static const aiCreditsExhaustedEvent = 'ai-credits-exhausted';
|
|
217
|
+
|
|
218
|
+
// ========= WHITEBOARD =========
|
|
219
|
+
static const whiteboardOpenEvent = 'whiteboard-open';
|
|
220
|
+
static const whiteboardStrokeEvent = 'whiteboard-stroke';
|
|
221
|
+
static const whiteboardClearEvent = 'whiteboard-clear';
|
|
222
|
+
static const whiteboardCloseEvent = 'whiteboard-close';
|
|
223
|
+
static const whiteboardSnapshotEvent = 'whiteboard-snapshot';
|
|
224
|
+
// Server → client broadcasts. The backend re-broadcasts on the SAME event
|
|
225
|
+
// names it receives (whiteboard-stroke/clear/close/snapshot), so these aliases
|
|
226
|
+
// resolve to the base names — NOT "*-received"/"*-ready".
|
|
227
|
+
static const whiteboardStrokeReceivedEvent = 'whiteboard-stroke';
|
|
228
|
+
static const whiteboardClearedEvent = 'whiteboard-clear';
|
|
229
|
+
static const whiteboardClosedEvent = 'whiteboard-close';
|
|
230
|
+
static const whiteboardSnapshotReadyEvent = 'whiteboard-snapshot';
|
|
231
|
+
|
|
232
|
+
// ========= AUTOMATION =========
|
|
233
|
+
static const createAutomationEvent = 'create-automation';
|
|
234
|
+
static const updateAutomationEvent = 'update-automation';
|
|
235
|
+
static const deleteAutomationEvent = 'delete-automation';
|
|
236
|
+
static const getAutomationsEvent = 'get-automations';
|
|
237
|
+
|
|
238
|
+
// ========= WEBINAR =========
|
|
239
|
+
static const startWebinarEvent = 'start-webinar';
|
|
240
|
+
static const raiseHandEvent = 'raise-hand';
|
|
241
|
+
static const lowerHandEvent = 'lower-hand';
|
|
242
|
+
static const promoteAttendeeAudioEvent = 'promote-attendee-audio';
|
|
243
|
+
static const webinarQaSubmitEvent = 'webinar-qa-submit';
|
|
244
|
+
static const webinarQaAnswerEvent = 'webinar-qa-answer';
|
|
245
|
+
static const webinarStartedEvent = 'webinar-started';
|
|
246
|
+
static const webinarHandRaisedEvent = 'webinar-hand-raised';
|
|
247
|
+
static const webinarHandLoweredEvent = 'webinar-hand-lowered';
|
|
248
|
+
static const webinarAttendeePromotedEvent = 'webinar-attendee-promoted';
|
|
249
|
+
static const webinarQaUpdatedEvent = 'webinar-qa-updated';
|
|
250
|
+
|
|
251
|
+
// ========= CONVERSATION STATS =========
|
|
252
|
+
static const getConversationStatsEvent = 'get-conversation-stats';
|
|
253
|
+
// The backend replies to `get-conversation-stats` via the emit ack; it does
|
|
254
|
+
// not emit a separate "conversation-stats" broadcast. Alias kept pointing at
|
|
255
|
+
// the real event for any `onConversationStats` subscriber.
|
|
256
|
+
static const conversationStatsEvent = 'get-conversation-stats';
|
|
257
|
+
|
|
258
|
+
// ========= CHAT USER SETTINGS =========
|
|
259
|
+
static const updateChatUserSettingsEvent = 'update-chat-user-settings';
|
|
260
|
+
|
|
261
|
+
// ========= POSTS / STORIES =========
|
|
262
|
+
static const createPostEvent = 'create-post';
|
|
263
|
+
static const getPostsEvent = 'get-posts';
|
|
264
|
+
static const getStoriesEvent = 'get-stories';
|
|
265
|
+
static const viewPostEvent = 'view-post';
|
|
266
|
+
static const reactToPostEvent = 'react-to-post';
|
|
267
|
+
static const replyToPostEvent = 'reply-to-post';
|
|
268
|
+
static const updatePostEvent = 'update-post';
|
|
269
|
+
static const deletePostEvent = 'delete-post';
|
|
270
|
+
static const newStoryEvent = 'new-story';
|
|
271
|
+
|
|
272
|
+
// ========= TRANSLATION =========
|
|
273
|
+
static const translateMessageEvent = 'translate-message';
|
|
274
|
+
static const setLanguageEvent = 'set-language';
|
|
275
|
+
|
|
276
|
+
// ========= PRESENCE =========
|
|
277
|
+
static const onlineUsersEvent = 'online-users';
|
|
278
|
+
static const heartbeatEvent = 'heartbeat';
|
|
279
|
+
|
|
280
|
+
// ========= AUTH =========
|
|
281
|
+
static const authErrorEvent = 'auth-error';
|
|
282
|
+
|
|
283
|
+
// ========= HOP COLLAB (co-host / poll / whiteboard) =========
|
|
284
|
+
static const hopCoHostAssignEvent = 'hop-co-host-assign';
|
|
285
|
+
static const hopCoHostAssignedEvent = 'hop-co-host-assigned';
|
|
286
|
+
static const hopPollLaunchEvent = 'hop-poll-launch';
|
|
287
|
+
static const hopPollLaunchedEvent = 'hop-poll-launched';
|
|
288
|
+
static const hopPollVoteEvent = 'hop-poll-vote';
|
|
289
|
+
static const hopPollVoteUpdatedEvent = 'hop-poll-vote-updated';
|
|
290
|
+
static const hopWhiteboardSyncEvent = 'hop-whiteboard-sync';
|
|
291
|
+
static const hopWhiteboardDeltaEvent = 'hop-whiteboard-delta';
|
|
292
|
+
|
|
293
|
+
/// Valid status values for changeMessageStatus().
|
|
294
|
+
static const messageChangeStatusDelete = 'DELETE';
|
|
295
|
+
static const messageChangeStatusPin = 'PIN';
|
|
296
|
+
static const messageChangeStatusUnpin = 'UNPIN';
|
|
297
|
+
static const messageChangeStatusStarred = 'STARRED';
|
|
298
|
+
static const messageChangeStatusUnstarred = 'UNSTARRED';
|
|
299
|
+
|
|
300
|
+
/// Conversation roles — ADMIN and MODERATOR can delete any message.
|
|
301
|
+
static const roleSuperAdmin = 'SUPER_ADMIN';
|
|
302
|
+
static const roleAdmin = 'ADMIN';
|
|
303
|
+
static const roleModerator = 'MODERATOR';
|
|
304
|
+
static const roleMember = 'MEMBER';
|
|
305
|
+
|
|
306
|
+
// Chat features (chatta planner/docs/chat-features-api.md)
|
|
307
|
+
static const messageDeliveredEvent = 'message-delivered';
|
|
308
|
+
static const messageInfoEvent = 'message-info';
|
|
309
|
+
static const muteConversationEvent = 'mute-conversation';
|
|
310
|
+
static const conversationMutedEvent = 'conversation-muted';
|
|
311
|
+
static const updateQuietHoursEvent = 'update-quiet-hours';
|
|
312
|
+
static const quietHoursUpdatedEvent = 'quiet-hours-updated';
|
|
313
|
+
static const setMessageReminderEvent = 'set-message-reminder';
|
|
314
|
+
static const cancelMessageReminderEvent = 'cancel-message-reminder';
|
|
315
|
+
static const messageRemindersChangedEvent = 'message-reminders-changed';
|
|
316
|
+
static const messageReminderDueEvent = 'message-reminder-due';
|
|
317
|
+
static const updateConversationPermissionsEvent = 'update-conversation-permissions';
|
|
318
|
+
static const conversationPermissionsUpdatedEvent = 'conversation-permissions-updated';
|
|
319
|
+
static const huddleStartEvent = 'huddle-start';
|
|
320
|
+
static const huddleStatusEvent = 'huddle-status';
|
|
321
|
+
static const huddleEndEvent = 'huddle-end';
|
|
322
|
+
static const huddleUpdatedEvent = 'huddle-updated';
|
|
323
|
+
static const setStatusEvent = 'set-status';
|
|
324
|
+
static const statusUpdatedEvent = 'status-updated';
|
|
325
|
+
static const updateLiveLocationEvent = 'update-live-location';
|
|
326
|
+
static const liveLocationUpdatedEvent = 'live-location-updated';
|
|
327
|
+
static const stopLiveLocationEvent = 'stop-live-location';
|
|
328
|
+
static const liveLocationEndedEvent = 'live-location-ended';
|
|
329
|
+
static const hopMeetingUpdatedEvent = 'hop-meeting-updated';
|
|
330
|
+
static const transcribeMessageEvent = 'transcribe-message';
|
|
331
|
+
static const messageTranscriptUpdatedEvent = 'message-transcript-updated';
|
|
332
|
+
static const inboxUpdatedEvent = 'inbox-updated';
|
|
333
|
+
|
|
334
|
+
// Hop collab: poll close, snapshot, live captions, recordings list
|
|
335
|
+
static const hopPollCloseEvent = 'hop-poll-close';
|
|
336
|
+
static const hopCollabStateEvent = 'hop-collab-state';
|
|
337
|
+
static const hopCaptionsToggleEvent = 'hop-captions-toggle';
|
|
338
|
+
static const hopCaptionEvent = 'hop-caption';
|
|
339
|
+
static const hopRecordingListEvent = 'hop-recording-list';
|
|
340
|
+
static const linkSettingsUpdatedEvent = 'link-settings-updated';
|
|
341
|
+
static const callLoggedEvent = 'call-logged';
|
|
342
|
+
static const stickersMineEvent = 'stickers-mine';
|
|
343
|
+
static const stickersSearchEvent = 'stickers-search';
|
|
344
|
+
static const stickerUploadEvent = 'sticker-upload';
|
|
345
|
+
static const stickerAddEvent = 'sticker-add';
|
|
346
|
+
static const stickerRemoveEvent = 'sticker-remove';
|
|
347
|
+
static const chattaMoneyCardEvent = 'chatta-money-card';
|
|
348
|
+
static const chattaMoneyConfirmEvent = 'chatta-money-confirm';
|
|
349
|
+
static const moneyCardGetEvent = 'money-card-get';
|
|
350
|
+
static const moneyCardActionEvent = 'money-card-action';
|
|
351
|
+
static const moneyCardUpdateEvent = 'money-card-update';
|
|
352
|
+
static const webinarQaAnswerLiveEvent = 'webinar-qa-answer-live';
|
|
353
|
+
static const webinarQaVoteEvent = 'webinar-qa-vote';
|
|
354
|
+
static const webinarViewerCountEvent = 'webinar-viewer-count';
|
|
355
|
+
static const hopCaptionsStateEvent = 'hop-captions-state';
|
|
356
|
+
static const hopCaptionTextEvent = 'hop-caption-text';
|
|
357
|
+
|
|
358
|
+
// Support inbox (agent user: rooms) + chat core (chat-features-api.md §8b, §14)
|
|
359
|
+
static const internalNoteEvent = 'internal-note';
|
|
360
|
+
static const internalNoteDeletedEvent = 'internal-note-deleted';
|
|
361
|
+
static const conversationNotesUpdatedEvent = 'conversation-notes-updated';
|
|
362
|
+
static const csatUpdatedEvent = 'csat-updated';
|
|
363
|
+
static const conversationReadEvent = 'conversation-read';
|
|
364
|
+
static const conversationUnreadEvent = 'conversation-unread';
|
|
365
|
+
static const unreadTotalsEvent = 'unread-totals';
|
|
366
|
+
static const deleteMessageEvent = 'delete-message';
|
|
367
|
+
static const messageDeletedEvent = 'message-deleted';
|
|
368
|
+
static const searchAllEvent = 'search-all';
|
|
369
|
+
static const submitPreChatEvent = 'submit-pre-chat';
|
|
370
|
+
static const preChatSubmittedEvent = 'pre-chat-submitted';
|
|
371
|
+
|
|
372
|
+
/// `linkAccess` on the unfiltered first getConversations() page (chatta #179).
|
|
373
|
+
static const linkAccessOk = 'ok';
|
|
374
|
+
static const linkAccessBlocked = 'blocked';
|
|
375
|
+
static const linkAccessInviteOnly = 'invite-only';
|
|
376
|
+
|
|
377
|
+
/// True when a getConversations() result says the member is blocked from this link.
|
|
378
|
+
static bool isLinkBlocked(dynamic result) =>
|
|
379
|
+
result is Map && result['linkAccess'] == linkAccessBlocked;
|
|
380
|
+
|
|
381
|
+
/// True when the link is invite-only and this member is not on the list (no link room).
|
|
382
|
+
static bool isLinkInviteOnly(dynamic result) =>
|
|
383
|
+
result is Map && result['linkAccess'] == linkAccessInviteOnly;
|
|
384
|
+
|
|
385
|
+
/// Sidebar paging (chatta #427): `all-conversations` default and max are 40; badges read `unreadTotals`.
|
|
386
|
+
static const sidebarPageSize = 40;
|
|
387
|
+
static const unreadTotalsMaxExclude = 1000;
|
|
388
|
+
|
|
389
|
+
/// `unreadTotals.total` from a first page or `unread-totals` ack; null when the server sent none.
|
|
390
|
+
static int? unreadTotal(dynamic result) {
|
|
391
|
+
final totals = result is Map ? result['unreadTotals'] : null;
|
|
392
|
+
final total = totals is Map ? totals['total'] : null;
|
|
393
|
+
return total is num ? total.toInt() : null;
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
LiveChattaSocketAPI({
|
|
397
|
+
required IO.Socket socket,
|
|
398
|
+
required LiveChattaClient client,
|
|
399
|
+
}) : _socket = socket,
|
|
400
|
+
_client = client;
|
|
401
|
+
|
|
402
|
+
// ===================
|
|
403
|
+
// EMITTERS
|
|
404
|
+
// ===================
|
|
405
|
+
|
|
406
|
+
/// Fetch user's conversations; the unfiltered first page also carries `linkAccess`.
|
|
407
|
+
void getConversations([
|
|
408
|
+
Map<String, dynamic> query = const {},
|
|
409
|
+
Function(dynamic)? callback,
|
|
410
|
+
]) => _emit(allConversations, query, callback);
|
|
411
|
+
|
|
412
|
+
/// Start a new conversation; GROUP / CHANNEL may set mode (standard|broadcast|announcement|qa|voice|support) and category
|
|
413
|
+
void startConversation(
|
|
414
|
+
Map<String, dynamic> data, {
|
|
415
|
+
Function(dynamic)? callback,
|
|
416
|
+
}) => _emit(newConversation, data, callback);
|
|
417
|
+
|
|
418
|
+
/// Enter a conversation (join room, get presence)
|
|
419
|
+
void enterConversationById(
|
|
420
|
+
String conversationId, {
|
|
421
|
+
Function(dynamic)? callback,
|
|
422
|
+
}) => _emit(enterConversation, {'conversationId': conversationId}, callback);
|
|
423
|
+
|
|
424
|
+
/// Join an existing conversation with participants
|
|
425
|
+
void joinConversationWithData(
|
|
426
|
+
Map<String, dynamic> data, {
|
|
427
|
+
Function(dynamic)? callback,
|
|
428
|
+
}) => _emit(joinConversation, data, callback);
|
|
429
|
+
|
|
430
|
+
/// Edit conversation details (name, caption, photo)
|
|
431
|
+
void editConversationWithData(
|
|
432
|
+
Map<String, dynamic> data, {
|
|
433
|
+
Function(dynamic)? callback,
|
|
434
|
+
}) => _emit(editConversation, data, callback);
|
|
435
|
+
|
|
436
|
+
/// Toggle pin on a conversation for the current member
|
|
437
|
+
void pinConversation(
|
|
438
|
+
Map<String, dynamic> data, {
|
|
439
|
+
Function(dynamic)? callback,
|
|
440
|
+
}) => _emit(pinConversationEvent, data, callback);
|
|
441
|
+
|
|
442
|
+
/// Promote users to admin in a conversation
|
|
443
|
+
void makeAdmin(
|
|
444
|
+
Map<String, dynamic> data, {
|
|
445
|
+
Function(dynamic)? callback,
|
|
446
|
+
}) => _emit(makeAdminConversation, data, callback);
|
|
447
|
+
|
|
448
|
+
/// Lock or unlock a conversation
|
|
449
|
+
void toggleLock(
|
|
450
|
+
Map<String, dynamic> data, {
|
|
451
|
+
Function(dynamic)? callback,
|
|
452
|
+
}) => _emit(toggleConversation, data, callback);
|
|
453
|
+
|
|
454
|
+
/// Change conversation status (ACTIVE, LEAVE, BLOCK)
|
|
455
|
+
void changeConversationStatus(
|
|
456
|
+
Map<String, dynamic> data, {
|
|
457
|
+
Function(dynamic)? callback,
|
|
458
|
+
}) => _emit(statusChangeConversation, data, callback);
|
|
459
|
+
|
|
460
|
+
/// Change a member's status in a conversation
|
|
461
|
+
void changeMemberStatus(
|
|
462
|
+
Map<String, dynamic> data, {
|
|
463
|
+
Function(dynamic)? callback,
|
|
464
|
+
}) => _emit(memberStatusChangeConversation, data, callback);
|
|
465
|
+
|
|
466
|
+
/// Fetch paginated messages with filters; compactReceipts '1' = only your own readBy / deliveredTo entry plus readCount / deliveredCount
|
|
467
|
+
void getMessages(
|
|
468
|
+
Map<String, dynamic> query, {
|
|
469
|
+
Function(dynamic)? callback,
|
|
470
|
+
}) => _emit(allMessages, query, callback);
|
|
471
|
+
|
|
472
|
+
/// Send a message; polls: messageKind 'POLL', question, options, multiSelect?, anonymous? (counts only)
|
|
473
|
+
void sendMessage(
|
|
474
|
+
Map<String, dynamic> data, {
|
|
475
|
+
Function(dynamic)? callback,
|
|
476
|
+
}) => _emit(newMessage, data, callback);
|
|
477
|
+
|
|
478
|
+
/// Broadcast typing indicator
|
|
479
|
+
void typing(
|
|
480
|
+
Map<String, dynamic> data, {
|
|
481
|
+
Function(dynamic)? callback,
|
|
482
|
+
}) => _emit(newTyping, data, callback);
|
|
483
|
+
|
|
484
|
+
/// Save a conversation draft; it syncs to this member's other devices
|
|
485
|
+
void saveDraft(
|
|
486
|
+
Map<String, dynamic> data, [
|
|
487
|
+
Function(dynamic)? callback,
|
|
488
|
+
]) => _emit(saveDraftEvent, data, callback);
|
|
489
|
+
|
|
490
|
+
/// Set your custom status (/status, /away): { text?, emoji?, away? }; empty text and away false clears it. Ack: { userId?, statusText, statusEmoji, statusAway }
|
|
491
|
+
void setChatStatus(
|
|
492
|
+
Map<String, dynamic> data, [
|
|
493
|
+
Function(dynamic)? callback,
|
|
494
|
+
]) => _emit(setStatusEvent, data, callback);
|
|
495
|
+
|
|
496
|
+
/// Move a live-location point you shared; it broadcasts to the conversation
|
|
497
|
+
void updateLiveLocation(
|
|
498
|
+
Map<String, dynamic> data, [
|
|
499
|
+
Function(dynamic)? callback,
|
|
500
|
+
]) => _emit(updateLiveLocationEvent, data, callback);
|
|
501
|
+
|
|
502
|
+
/// End a live-location share early
|
|
503
|
+
void stopLiveLocation(
|
|
504
|
+
Map<String, dynamic> data, [
|
|
505
|
+
Function(dynamic)? callback,
|
|
506
|
+
]) => _emit(stopLiveLocationEvent, data, callback);
|
|
507
|
+
|
|
508
|
+
/// Change a message's status (e.g., DELETED)
|
|
509
|
+
void changeMessageStatus(
|
|
510
|
+
Map<String, dynamic> data, {
|
|
511
|
+
Function(dynamic)? callback,
|
|
512
|
+
}) => _emit(messageStatusChange, data, callback);
|
|
513
|
+
|
|
514
|
+
/// React to a message with an emoji
|
|
515
|
+
void reactToMessage(
|
|
516
|
+
Map<String, dynamic> data, {
|
|
517
|
+
Function(dynamic)? callback,
|
|
518
|
+
}) => _emit(messageReaction, data, callback);
|
|
519
|
+
|
|
520
|
+
/// data: { messageId, conversationId, senderId, message }. Past 24 h the ack error code is EDIT_WINDOW_CLOSED.
|
|
521
|
+
void editMessage(
|
|
522
|
+
Map<String, dynamic> data, {
|
|
523
|
+
Function(dynamic)? callback,
|
|
524
|
+
}) => _emit(editMessageEvent, data, callback);
|
|
525
|
+
|
|
526
|
+
/// data: { messageId, fromConversationId, toConversationId, senderId }; one target per call
|
|
527
|
+
void forwardMessage(
|
|
528
|
+
Map<String, dynamic> data, {
|
|
529
|
+
Function(dynamic)? callback,
|
|
530
|
+
}) => _emit(forwardMessageEvent, data, callback);
|
|
531
|
+
|
|
532
|
+
/// Forward a post to a conversation
|
|
533
|
+
void forwardPost(
|
|
534
|
+
Map<String, dynamic> data, {
|
|
535
|
+
Function(dynamic)? callback,
|
|
536
|
+
}) => _emit(forwardPostEvent, data, callback);
|
|
537
|
+
|
|
538
|
+
/// Mark messages as read in a conversation
|
|
539
|
+
void markMessagesRead(
|
|
540
|
+
Map<String, dynamic> data, {
|
|
541
|
+
Function(dynamic)? callback,
|
|
542
|
+
}) => _emit(messageReadEvent, data, callback);
|
|
543
|
+
|
|
544
|
+
/// Search messages in a conversation
|
|
545
|
+
void searchMessages(
|
|
546
|
+
Map<String, dynamic> data, {
|
|
547
|
+
Function(dynamic)? callback,
|
|
548
|
+
}) => _emit(searchMessagesEvent, data, callback);
|
|
549
|
+
|
|
550
|
+
/// Search chat users by name/handle
|
|
551
|
+
void searchChatUsers(
|
|
552
|
+
Map<String, dynamic> data, {
|
|
553
|
+
Function(dynamic)? callback,
|
|
554
|
+
}) => _emit(searchChatUsersEvent, data, callback);
|
|
555
|
+
|
|
556
|
+
/// Link-wide @mention handles (Redis-cached, safe to repeat) for a picker beyond the current
|
|
557
|
+
/// conversation; keep fresh via onLinkUserJoined / onLinkUserUpdated.
|
|
558
|
+
void getLinkHandles({Function(dynamic)? callback}) =>
|
|
559
|
+
_emit(linkHandlesEvent, <String, dynamic>{}, callback);
|
|
560
|
+
|
|
561
|
+
/// Fetch members of a conversation.
|
|
562
|
+
void getConversationMembers(
|
|
563
|
+
Map<String, dynamic> data, {
|
|
564
|
+
Function(dynamic)? callback,
|
|
565
|
+
}) => _emit(conversationMembersEvent, data, callback);
|
|
566
|
+
|
|
567
|
+
/// Fetch all parent thread messages (Pulse+ plan-gated, cursor-paginated).
|
|
568
|
+
void getAllThreads({
|
|
569
|
+
Map<String, dynamic>? data,
|
|
570
|
+
Function(dynamic)? callback,
|
|
571
|
+
}) => _emit(allThreadsEvent, data ?? <String, dynamic>{}, callback);
|
|
572
|
+
|
|
573
|
+
/// Fetch messages in a thread post.
|
|
574
|
+
void getPostMessages(
|
|
575
|
+
Map<String, dynamic> data, {
|
|
576
|
+
Function(dynamic)? callback,
|
|
577
|
+
}) => _emit(getPostMessagesEvent, data, callback);
|
|
578
|
+
|
|
579
|
+
// ========= HOP (voice / video / meetings) =========
|
|
580
|
+
|
|
581
|
+
void startHop(Map<String, dynamic> data, {Function(dynamic)? callback}) =>
|
|
582
|
+
_emit(hopStartEvent, data, callback);
|
|
583
|
+
void startHopAdHoc(Map<String, dynamic> data, {Function(dynamic)? callback}) =>
|
|
584
|
+
_emit(hopAdHocStartEvent, data, callback);
|
|
585
|
+
/// Join a live Hop: router RTP caps + transport params; canProduce false = webinar attendee (consume only).
|
|
586
|
+
void joinHop(Map<String, dynamic> data, {Function(dynamic)? callback}) =>
|
|
587
|
+
_emit(hopJoinEvent, data, callback);
|
|
588
|
+
void leaveHop(Map<String, dynamic> data, {Function(dynamic)? callback}) =>
|
|
589
|
+
_emit(hopLeaveEvent, data, callback);
|
|
590
|
+
void endHop(Map<String, dynamic> data, {Function(dynamic)? callback}) =>
|
|
591
|
+
_emit(hopEndEvent, data, callback);
|
|
592
|
+
void inviteToHop(Map<String, dynamic> data, {Function(dynamic)? callback}) =>
|
|
593
|
+
_emit(hopInviteRequestEvent, data, callback);
|
|
594
|
+
void getHopSession(Map<String, dynamic> data, {Function(dynamic)? callback}) =>
|
|
595
|
+
_emit(hopGetSessionEvent, data, callback);
|
|
596
|
+
void hopConnectTransport(Map<String, dynamic> data, {Function(dynamic)? callback}) =>
|
|
597
|
+
_emit(hopConnectTransportEvent, data, callback);
|
|
598
|
+
void hopProduce(Map<String, dynamic> data, {Function(dynamic)? callback}) =>
|
|
599
|
+
_emit(hopProduceEvent, data, callback);
|
|
600
|
+
void hopConsume(Map<String, dynamic> data, {Function(dynamic)? callback}) =>
|
|
601
|
+
_emit(hopConsumeEvent, data, callback);
|
|
602
|
+
void hopResumeConsumer(Map<String, dynamic> data, {Function(dynamic)? callback}) =>
|
|
603
|
+
_emit(hopResumeConsumerEvent, data, callback);
|
|
604
|
+
void hopStartRecording(Map<String, dynamic> data, {Function(dynamic)? callback}) =>
|
|
605
|
+
_emit(hopRecordingStartEvent, data, callback);
|
|
606
|
+
void hopStopRecording(Map<String, dynamic> data, {Function(dynamic)? callback}) =>
|
|
607
|
+
_emit(hopRecordingStopEvent, data, callback);
|
|
608
|
+
/// data: { title, startAt, endAt, participantIds (may be empty), locationConversationId?, guestEmails? (≤20), … }; ack adds locationConversationId, guestsInvited
|
|
609
|
+
void scheduleHopMeeting(Map<String, dynamic> data, {Function(dynamic)? callback}) =>
|
|
610
|
+
_emit(hopMeetingCreateEvent, data, callback);
|
|
611
|
+
void cancelHopMeeting(Map<String, dynamic> data, {Function(dynamic)? callback}) =>
|
|
612
|
+
_emit(hopMeetingCancelEvent, data, callback);
|
|
613
|
+
void listHopMeetings({Map<String, dynamic> data = const {}, Function(dynamic)? callback}) =>
|
|
614
|
+
_emit(hopMeetingListEvent, data, callback);
|
|
615
|
+
|
|
616
|
+
/// Fetch thread replies for a parent message
|
|
617
|
+
void getThreadMessages(
|
|
618
|
+
Map<String, dynamic> data, {
|
|
619
|
+
Function(dynamic)? callback,
|
|
620
|
+
}) => _emit(threadMessagesEvent, data, callback);
|
|
621
|
+
|
|
622
|
+
/// Toggle bookmark on a message
|
|
623
|
+
void toggleBookmark(
|
|
624
|
+
Map<String, dynamic> data, {
|
|
625
|
+
Function(dynamic)? callback,
|
|
626
|
+
}) => _emit(toggleBookmarkEvent, data, callback);
|
|
627
|
+
|
|
628
|
+
/// Get bookmarked messages in a conversation
|
|
629
|
+
void getBookmarks(
|
|
630
|
+
Map<String, dynamic> data, {
|
|
631
|
+
Function(dynamic)? callback,
|
|
632
|
+
}) => _emit(getBookmarksEvent, data, callback);
|
|
633
|
+
|
|
634
|
+
/// All bookmarked messages across conversations; data: { cursor?, limit? }
|
|
635
|
+
void getAllBookmarks([
|
|
636
|
+
Map<String, dynamic> data = const {},
|
|
637
|
+
Function(dynamic)? callback,
|
|
638
|
+
]) => _emit(getAllBookmarksEvent, data, callback);
|
|
639
|
+
|
|
640
|
+
/// Vote on a poll option
|
|
641
|
+
void votePoll(
|
|
642
|
+
Map<String, dynamic> data, {
|
|
643
|
+
Function(dynamic)? callback,
|
|
644
|
+
}) => _emit(votePollEvent, data, callback);
|
|
645
|
+
|
|
646
|
+
/// Validate a user's password
|
|
647
|
+
void validatePassword(
|
|
648
|
+
Map<String, dynamic> data, {
|
|
649
|
+
Function(dynamic)? callback,
|
|
650
|
+
}) => _emit(validatePasswordEvent, data, callback);
|
|
651
|
+
|
|
652
|
+
/// Email a chat user a reset code; data: { identifier, chatLinkCode } (chatLinkCode required since 1.2.2 / chatta #413)
|
|
653
|
+
void forgotPassword(
|
|
654
|
+
Map<String, dynamic> data, {
|
|
655
|
+
Function(dynamic)? callback,
|
|
656
|
+
}) => _emit(forgotPasswordEvent, data, callback);
|
|
657
|
+
|
|
658
|
+
/// data: { token, newPassword, confirmPassword } (8–200, must match): { status, message, audience, loginUrl, signedOut }
|
|
659
|
+
void resetPassword(
|
|
660
|
+
Map<String, dynamic> data, {
|
|
661
|
+
Function(dynamic)? callback,
|
|
662
|
+
}) => _emit(resetPasswordEvent, data, callback);
|
|
663
|
+
|
|
664
|
+
/// Change authenticated user's password
|
|
665
|
+
void changePassword(
|
|
666
|
+
Map<String, dynamic> data, {
|
|
667
|
+
Function(dynamic)? callback,
|
|
668
|
+
}) => _emit(changePasswordEvent, data, callback);
|
|
669
|
+
|
|
670
|
+
/// Refresh authentication token
|
|
671
|
+
void refreshToken(
|
|
672
|
+
Map<String, dynamic> data, {
|
|
673
|
+
Function(dynamic)? callback,
|
|
674
|
+
}) => _emit(refreshTokenEvent, data, callback);
|
|
675
|
+
|
|
676
|
+
/// Revoke authentication token
|
|
677
|
+
void revokeToken(
|
|
678
|
+
Map<String, dynamic> data, {
|
|
679
|
+
Function(dynamic)? callback,
|
|
680
|
+
}) => _emit(revokeTokenEvent, data, callback);
|
|
681
|
+
|
|
682
|
+
// ===================
|
|
683
|
+
// LISTENERS
|
|
684
|
+
// ===================
|
|
685
|
+
|
|
686
|
+
/// Listen for new messages
|
|
687
|
+
LiveChattaSocketAPI onMessage(Function(Map<String, dynamic>) callback) {
|
|
688
|
+
_listen(newMessage, callback);
|
|
689
|
+
return this;
|
|
690
|
+
}
|
|
691
|
+
|
|
692
|
+
/// Listen for new conversations
|
|
693
|
+
LiveChattaSocketAPI onConversation(Function(Map<String, dynamic>) callback) {
|
|
694
|
+
_listen(newConversation, callback);
|
|
695
|
+
return this;
|
|
696
|
+
}
|
|
697
|
+
|
|
698
|
+
/// Listen for conversation edits
|
|
699
|
+
LiveChattaSocketAPI onEditConversation(Function(Map<String, dynamic>) callback) {
|
|
700
|
+
_listen(editConversation, callback);
|
|
701
|
+
return this;
|
|
702
|
+
}
|
|
703
|
+
|
|
704
|
+
/// Listen for admin role changes. Payload: `{ conversation, memberId, member }`.
|
|
705
|
+
LiveChattaSocketAPI onMakeAdmin(Function(Map<String, dynamic>) callback) {
|
|
706
|
+
_listen(makeAdminConversation, callback);
|
|
707
|
+
return this;
|
|
708
|
+
}
|
|
709
|
+
|
|
710
|
+
/// Convenience listener for lock/unlock. NOTE: the backend re-broadcasts a
|
|
711
|
+
/// toggle as an `edit-conversation` frame — prefer [onEditConversation].
|
|
712
|
+
/// Kept for parity with the TS SDK.
|
|
713
|
+
LiveChattaSocketAPI onToggleConversation(Function(Map<String, dynamic>) callback) {
|
|
714
|
+
_listen(toggleConversation, callback);
|
|
715
|
+
return this;
|
|
716
|
+
}
|
|
717
|
+
|
|
718
|
+
/// Convenience listener for status changes. NOTE: the backend re-broadcasts a
|
|
719
|
+
/// status change as an `edit-conversation` frame — prefer [onEditConversation].
|
|
720
|
+
/// Kept for parity with the TS SDK.
|
|
721
|
+
LiveChattaSocketAPI onStatusChangeConversation(Function(Map<String, dynamic>) callback) {
|
|
722
|
+
_listen(statusChangeConversation, callback);
|
|
723
|
+
return this;
|
|
724
|
+
}
|
|
725
|
+
|
|
726
|
+
/// Listener for pin/unpin. NOTE: pinning is a per-member setting resolved via
|
|
727
|
+
/// the `pin-conversation` ack; the backend does not broadcast a separate
|
|
728
|
+
/// frame. Kept for parity with the TS SDK.
|
|
729
|
+
LiveChattaSocketAPI onPinConversation(Function(Map<String, dynamic>) callback) {
|
|
730
|
+
_listen(pinConversationEvent, callback);
|
|
731
|
+
return this;
|
|
732
|
+
}
|
|
733
|
+
|
|
734
|
+
/// Listen for member status changes
|
|
735
|
+
LiveChattaSocketAPI onMemberStatusChange(Function(Map<String, dynamic>) callback) {
|
|
736
|
+
_listen(memberStatusChangeConversation, callback);
|
|
737
|
+
return this;
|
|
738
|
+
}
|
|
739
|
+
|
|
740
|
+
/// Listen for message status changes
|
|
741
|
+
LiveChattaSocketAPI onMessageStatusChange(Function(Map<String, dynamic>) callback) {
|
|
742
|
+
_listen(messageStatusChange, callback);
|
|
743
|
+
return this;
|
|
744
|
+
}
|
|
745
|
+
|
|
746
|
+
/// Listen for message reactions
|
|
747
|
+
LiveChattaSocketAPI onMessageReaction(Function(Map<String, dynamic>) callback) {
|
|
748
|
+
_listen(messageReaction, callback);
|
|
749
|
+
return this;
|
|
750
|
+
}
|
|
751
|
+
|
|
752
|
+
/// Listen for typing indicators
|
|
753
|
+
LiveChattaSocketAPI onDraftUpdated(Function(Map<String, dynamic>) callback) {
|
|
754
|
+
_listen(draftUpdated, callback);
|
|
755
|
+
return this;
|
|
756
|
+
}
|
|
757
|
+
|
|
758
|
+
LiveChattaSocketAPI onTyping(Function(Map<String, dynamic>) callback) {
|
|
759
|
+
_listen(newTyping, callback);
|
|
760
|
+
return this;
|
|
761
|
+
}
|
|
762
|
+
|
|
763
|
+
/// Listen for users coming online
|
|
764
|
+
LiveChattaSocketAPI onOnline(Function(Map<String, dynamic>) callback) {
|
|
765
|
+
_listen(online, callback);
|
|
766
|
+
return this;
|
|
767
|
+
}
|
|
768
|
+
|
|
769
|
+
/// Listen for users going offline
|
|
770
|
+
LiveChattaSocketAPI onOffline(Function(Map<String, dynamic>) callback) {
|
|
771
|
+
_listen(offline, callback);
|
|
772
|
+
return this;
|
|
773
|
+
}
|
|
774
|
+
|
|
775
|
+
/// Listen for users joining a conversation
|
|
776
|
+
LiveChattaSocketAPI onJoinConversation(Function(Map<String, dynamic>) callback) {
|
|
777
|
+
_listen(joinConversation, callback);
|
|
778
|
+
return this;
|
|
779
|
+
}
|
|
780
|
+
|
|
781
|
+
/// Listen for unread count updates
|
|
782
|
+
LiveChattaSocketAPI onUnreadCountUpdate(Function(Map<String, dynamic>) callback) {
|
|
783
|
+
_listen(unreadCountUpdate, callback);
|
|
784
|
+
return this;
|
|
785
|
+
}
|
|
786
|
+
|
|
787
|
+
/// Membership revoked (kick/ban/leave): { conversationId, memberId, status }
|
|
788
|
+
LiveChattaSocketAPI onMembershipRevoked(Function(Map<String, dynamic>) callback) {
|
|
789
|
+
_listen(membershipRevoked, callback);
|
|
790
|
+
return this;
|
|
791
|
+
}
|
|
792
|
+
|
|
793
|
+
/// Another workspace invited yours to a channel (owner and admins only): { sharedChannelId, conversationId, status, side, hostName, partnerName, channelName }
|
|
794
|
+
LiveChattaSocketAPI onSharedChannelInvite(Function(Map<String, dynamic>) callback) {
|
|
795
|
+
_listen(sharedChannelInviteEvent, callback);
|
|
796
|
+
return this;
|
|
797
|
+
}
|
|
798
|
+
|
|
799
|
+
/// A share changed (owner and admins of both sides: the invite fields plus archiveConversationId?) or a badge changed (channel members: { conversationId, sharedWith: [{ name, side, ended? }] })
|
|
800
|
+
LiveChattaSocketAPI onSharedChannelUpdated(Function(Map<String, dynamic>) callback) {
|
|
801
|
+
_listen(sharedChannelUpdatedEvent, callback);
|
|
802
|
+
return this;
|
|
803
|
+
}
|
|
804
|
+
|
|
805
|
+
/// Listen for notifications
|
|
806
|
+
LiveChattaSocketAPI onNotification(Function(Map<String, dynamic>) callback) {
|
|
807
|
+
_listen(notification, callback);
|
|
808
|
+
return this;
|
|
809
|
+
}
|
|
810
|
+
|
|
811
|
+
/// Listen for edited messages
|
|
812
|
+
LiveChattaSocketAPI onEditMessage(Function(Map<String, dynamic>) callback) {
|
|
813
|
+
_listen(editMessageEvent, callback);
|
|
814
|
+
return this;
|
|
815
|
+
}
|
|
816
|
+
|
|
817
|
+
/// Listen for forwarded messages
|
|
818
|
+
LiveChattaSocketAPI onForwardMessage(Function(Map<String, dynamic>) callback) {
|
|
819
|
+
_listen(forwardMessageEvent, callback);
|
|
820
|
+
return this;
|
|
821
|
+
}
|
|
822
|
+
|
|
823
|
+
/// Listen for message read receipts
|
|
824
|
+
LiveChattaSocketAPI onMessageRead(Function(Map<String, dynamic>) callback) {
|
|
825
|
+
_listen(messageReadEvent, callback);
|
|
826
|
+
return this;
|
|
827
|
+
}
|
|
828
|
+
|
|
829
|
+
/// Listen for scheduled messages
|
|
830
|
+
LiveChattaSocketAPI onScheduledMessage(Function(Map<String, dynamic>) callback) {
|
|
831
|
+
_listen(scheduledMessageEvent, callback);
|
|
832
|
+
return this;
|
|
833
|
+
}
|
|
834
|
+
|
|
835
|
+
/// Listen for message delivery failures
|
|
836
|
+
LiveChattaSocketAPI onMessageFailed(Function(Map<String, dynamic>) callback) {
|
|
837
|
+
_listen(messageFailed, callback);
|
|
838
|
+
return this;
|
|
839
|
+
}
|
|
840
|
+
|
|
841
|
+
/// Listen for poll vote updates
|
|
842
|
+
LiveChattaSocketAPI onVotePoll(Function(Map<String, dynamic>) callback) {
|
|
843
|
+
_listen(votePollEvent, callback);
|
|
844
|
+
return this;
|
|
845
|
+
}
|
|
846
|
+
|
|
847
|
+
/// Listen for new chat users joining the active chat link.
|
|
848
|
+
LiveChattaSocketAPI onLinkUserJoined(Function(Map<String, dynamic>) callback) {
|
|
849
|
+
_listen(linkUserJoinedEvent, callback);
|
|
850
|
+
return this;
|
|
851
|
+
}
|
|
852
|
+
|
|
853
|
+
/// Listen for handle/displayName/photo updates from chat link members.
|
|
854
|
+
LiveChattaSocketAPI onLinkUserUpdated(Function(Map<String, dynamic>) callback) {
|
|
855
|
+
_listen(linkUserUpdatedEvent, callback);
|
|
856
|
+
return this;
|
|
857
|
+
}
|
|
858
|
+
|
|
859
|
+
void listHopProducers(Map<String, dynamic> data, {Function(dynamic)? callback}) =>
|
|
860
|
+
_emit(hopListProducersEvent, data, callback);
|
|
861
|
+
void listHopParticipants(Map<String, dynamic> data, {Function(dynamic)? callback}) =>
|
|
862
|
+
_emit(hopListParticipantsEvent, data, callback);
|
|
863
|
+
void muteHopParticipant(Map<String, dynamic> data, {Function(dynamic)? callback}) =>
|
|
864
|
+
_emit(hopMuteParticipantEvent, data, callback);
|
|
865
|
+
void dropHopParticipant(Map<String, dynamic> data, {Function(dynamic)? callback}) =>
|
|
866
|
+
_emit(hopDropParticipantEvent, data, callback);
|
|
867
|
+
/// Host / co-host only; data: { sessionId, userId? } (no userId clears). Ack: { pinned }
|
|
868
|
+
void hopPinForAll(Map<String, dynamic> data, {Function(dynamic)? callback}) =>
|
|
869
|
+
_emit(hopPinForAllEvent, data, callback);
|
|
870
|
+
void listActiveHops({Function(dynamic)? callback}) =>
|
|
871
|
+
_emit(hopListActiveEvent, <String, dynamic>{}, callback);
|
|
872
|
+
void sendHopReaction(Map<String, dynamic> data, {Function(dynamic)? callback}) =>
|
|
873
|
+
_emit(hopReactionEvent, data, callback);
|
|
874
|
+
void keepHopWaiting(Map<String, dynamic> data, {Function(dynamic)? callback}) =>
|
|
875
|
+
_emit(hopKeepWaitingEvent, data, callback);
|
|
876
|
+
void sendHopVote(Map<String, dynamic> data, {Function(dynamic)? callback}) =>
|
|
877
|
+
_emit(hopVoteEvent, data, callback);
|
|
878
|
+
void raiseHand(Map<String, dynamic> data, {Function(dynamic)? callback}) =>
|
|
879
|
+
_emit(hopRaiseHandEvent, data, callback);
|
|
880
|
+
void startNewVoteRound(Map<String, dynamic> data, {Function(dynamic)? callback}) =>
|
|
881
|
+
_emit(hopNewVoteRoundEvent, data, callback);
|
|
882
|
+
void makeHost(Map<String, dynamic> data, {Function(dynamic)? callback}) =>
|
|
883
|
+
_emit(hopMakeHostEvent, data, callback);
|
|
884
|
+
void stopHopScreenShare(Map<String, dynamic> data, {Function(dynamic)? callback}) =>
|
|
885
|
+
_emit(hopScreenShareStopEvent, data, callback);
|
|
886
|
+
void rejoinHop(Map<String, dynamic> data, {Function(dynamic)? callback}) =>
|
|
887
|
+
_emit(hopRejoinRoomEvent, data, callback);
|
|
888
|
+
void restartHopIce(Map<String, dynamic> data, {Function(dynamic)? callback}) =>
|
|
889
|
+
_emit(hopIceRestartEvent, data, callback);
|
|
890
|
+
void hopAdmit(Map<String, dynamic> data, {Function(dynamic)? callback}) =>
|
|
891
|
+
_emit(hopAdmitEvent, data, callback);
|
|
892
|
+
/// Deny a user waiting in the Hop lobby. Host/co-host only; `block` also stops them asking again. Ack: `{ ok: true }`.
|
|
893
|
+
void hopDeny(String sessionId, String userId, {bool block = false, Function(dynamic)? callback}) =>
|
|
894
|
+
_emit(hopDenyEvent, {'sessionId': sessionId, 'userId': userId, if (block) 'block': true}, callback);
|
|
895
|
+
/// Decline a Hop invite. Payload: `{ sessionId }`. Ack: `{ ok: true }`.
|
|
896
|
+
void hopInviteDecline(Map<String, dynamic> data, {Function(dynamic)? callback}) =>
|
|
897
|
+
_emit(hopInviteDeclineEvent, data, callback);
|
|
898
|
+
/// Update local media state. Payload: `{ sessionId, videoEnabled?, audioEnabled? }`. Ack: `{ ok: true }`.
|
|
899
|
+
void hopMediaChange(Map<String, dynamic> data, {Function(dynamic)? callback}) =>
|
|
900
|
+
_emit(hopMediaChangeEvent, data, callback);
|
|
901
|
+
/// Start screensharing. Payload: `{ sessionId, producerId? }`. Ack: `{ ok: true }`.
|
|
902
|
+
void startHopScreenShare(Map<String, dynamic> data, {Function(dynamic)? callback}) =>
|
|
903
|
+
_emit(hopScreenShareStartEvent, data, callback);
|
|
904
|
+
/// Alias for [startHopScreenShare] — mirrors the TS SDK surface.
|
|
905
|
+
void hopScreenshareStart(Map<String, dynamic> data, {Function(dynamic)? callback}) =>
|
|
906
|
+
_emit(hopScreenShareStartEvent, data, callback);
|
|
907
|
+
|
|
908
|
+
// ========= HOP listeners =========
|
|
909
|
+
|
|
910
|
+
LiveChattaSocketAPI onHopAdmitted(Function(Map<String, dynamic>) cb) {
|
|
911
|
+
_listen(hopAdmittedEvent, cb); return this;
|
|
912
|
+
}
|
|
913
|
+
|
|
914
|
+
LiveChattaSocketAPI onHopStarted(Function(Map<String, dynamic>) cb) {
|
|
915
|
+
_listen(hopStartedEvent, cb); return this;
|
|
916
|
+
}
|
|
917
|
+
LiveChattaSocketAPI onHopEnded(Function(Map<String, dynamic>) cb) {
|
|
918
|
+
_listen(hopEndedEvent, cb); return this;
|
|
919
|
+
}
|
|
920
|
+
LiveChattaSocketAPI onHopParticipantJoined(Function(Map<String, dynamic>) cb) {
|
|
921
|
+
_listen(hopParticipantJoinedEvent, cb); return this;
|
|
922
|
+
}
|
|
923
|
+
LiveChattaSocketAPI onHopParticipantLeft(Function(Map<String, dynamic>) cb) {
|
|
924
|
+
_listen(hopParticipantLeftEvent, cb); return this;
|
|
925
|
+
}
|
|
926
|
+
LiveChattaSocketAPI onHopNewProducer(Function(Map<String, dynamic>) cb) {
|
|
927
|
+
_listen(hopNewProducerEvent, cb); return this;
|
|
928
|
+
}
|
|
929
|
+
LiveChattaSocketAPI onHopProducerClosed(Function(Map<String, dynamic>) cb) {
|
|
930
|
+
_listen(hopProducerClosedEvent, cb); return this;
|
|
931
|
+
}
|
|
932
|
+
LiveChattaSocketAPI onHopInvite(Function(Map<String, dynamic>) cb) {
|
|
933
|
+
_listen(hopInviteEvent, cb); return this;
|
|
934
|
+
}
|
|
935
|
+
LiveChattaSocketAPI onHopRecordingStarted(Function(Map<String, dynamic>) cb) {
|
|
936
|
+
_listen(hopRecordingStartedEvent, cb); return this;
|
|
937
|
+
}
|
|
938
|
+
LiveChattaSocketAPI onHopRecordingStopped(Function(Map<String, dynamic>) cb) {
|
|
939
|
+
_listen(hopRecordingStoppedEvent, cb); return this;
|
|
940
|
+
}
|
|
941
|
+
LiveChattaSocketAPI onHopRecordingReady(Function(Map<String, dynamic>) cb) {
|
|
942
|
+
_listen(hopRecordingReadyEvent, cb); return this;
|
|
943
|
+
}
|
|
944
|
+
LiveChattaSocketAPI onHopMeetingReminder(Function(Map<String, dynamic>) cb) {
|
|
945
|
+
_listen(hopMeetingReminderEvent, cb); return this;
|
|
946
|
+
}
|
|
947
|
+
LiveChattaSocketAPI onHopRedirect(Function(Map<String, dynamic>) cb) {
|
|
948
|
+
_listen(hopRedirectEvent, cb); return this;
|
|
949
|
+
}
|
|
950
|
+
LiveChattaSocketAPI onHopReaction(Function(Map<String, dynamic>) cb) {
|
|
951
|
+
_listen(hopReactionEvent, cb); return this;
|
|
952
|
+
}
|
|
953
|
+
LiveChattaSocketAPI onHopVoteUpdated(Function(Map<String, dynamic>) cb) {
|
|
954
|
+
_listen(hopVoteUpdatedEvent, cb); return this;
|
|
955
|
+
}
|
|
956
|
+
LiveChattaSocketAPI onHopRaiseHand(Function(Map<String, dynamic>) cb) {
|
|
957
|
+
_listen(hopRaiseHandEvent, cb); return this;
|
|
958
|
+
}
|
|
959
|
+
LiveChattaSocketAPI onHopVoteComplete(Function(Map<String, dynamic>) cb) {
|
|
960
|
+
_listen(hopVoteCompleteEvent, cb); return this;
|
|
961
|
+
}
|
|
962
|
+
LiveChattaSocketAPI onHopNewVoteRound(Function(Map<String, dynamic>) cb) {
|
|
963
|
+
_listen(hopNewVoteRoundEvent, cb); return this;
|
|
964
|
+
}
|
|
965
|
+
LiveChattaSocketAPI onHopHostChanged(Function(Map<String, dynamic>) cb) {
|
|
966
|
+
_listen(hopHostChangedEvent, cb); return this;
|
|
967
|
+
}
|
|
968
|
+
/// Hosts: { sessionId, userId, displayName } is waiting in the lobby
|
|
969
|
+
LiveChattaSocketAPI onHopLobbyWaiting(Function(Map<String, dynamic>) cb) {
|
|
970
|
+
_listen(hopLobbyWaitingEvent, cb); return this;
|
|
971
|
+
}
|
|
972
|
+
LiveChattaSocketAPI onHopDenied(Function(Map<String, dynamic>) cb) {
|
|
973
|
+
_listen(hopDeniedEvent, cb); return this;
|
|
974
|
+
}
|
|
975
|
+
LiveChattaSocketAPI onHopRecordingAlreadyActive(Function(Map<String, dynamic>) cb) {
|
|
976
|
+
_listen(hopRecordingAlreadyActiveEvent, cb); return this;
|
|
977
|
+
}
|
|
978
|
+
LiveChattaSocketAPI onHopParticipantMuted(Function(Map<String, dynamic>) cb) {
|
|
979
|
+
_listen(hopParticipantMutedEvent, cb); return this;
|
|
980
|
+
}
|
|
981
|
+
/// { sessionId, userId (null = unpin), by }: pin that tile for everyone.
|
|
982
|
+
LiveChattaSocketAPI onHopPinnedForAll(Function(Map<String, dynamic>) cb) {
|
|
983
|
+
_listen(hopPinnedForAllEvent, cb); return this;
|
|
984
|
+
}
|
|
985
|
+
LiveChattaSocketAPI onHopParticipantDropped(Function(Map<String, dynamic>) cb) {
|
|
986
|
+
_listen(hopParticipantDroppedEvent, cb); return this;
|
|
987
|
+
}
|
|
988
|
+
/// { sessionId, reason? }; reason 'moved' = you joined this call from another device
|
|
989
|
+
LiveChattaSocketAPI onHopYouWereDropped(Function(Map<String, dynamic>) cb) {
|
|
990
|
+
_listen(hopYouWereDroppedEvent, cb); return this;
|
|
991
|
+
}
|
|
992
|
+
|
|
993
|
+
/// { sessionId, conversationId }: you answered on another device, stop ringing here
|
|
994
|
+
LiveChattaSocketAPI onHopInviteAnswered(Function(Map<String, dynamic>) cb) {
|
|
995
|
+
_listen(hopInviteAnsweredEvent, cb); return this;
|
|
996
|
+
}
|
|
997
|
+
|
|
998
|
+
/// { sessionId, by }: a host asked you to unmute (the mic stays off until you turn it on)
|
|
999
|
+
LiveChattaSocketAPI onHopUnmuteRequested(Function(Map<String, dynamic>) cb) {
|
|
1000
|
+
_listen(hopUnmuteRequestedEvent, cb); return this;
|
|
1001
|
+
}
|
|
1002
|
+
|
|
1003
|
+
/// Fires when a participant declines a Hop invite. Payload: `{ sessionId, declinedBy }`.
|
|
1004
|
+
LiveChattaSocketAPI onHopInviteDeclined(Function(Map<String, dynamic>) cb) {
|
|
1005
|
+
_listen(hopInviteDeclinedEvent, cb); return this;
|
|
1006
|
+
}
|
|
1007
|
+
/// Fires when a participant toggles video/audio. Payload: `{ sessionId, userId, videoEnabled?, audioEnabled? }`.
|
|
1008
|
+
LiveChattaSocketAPI onHopMediaChanged(Function(Map<String, dynamic>) cb) {
|
|
1009
|
+
_listen(hopMediaChangedEvent, cb); return this;
|
|
1010
|
+
}
|
|
1011
|
+
/// Fires when a participant starts screensharing. Payload: `{ sessionId, producerId, userId }`.
|
|
1012
|
+
LiveChattaSocketAPI onHopScreenshareStarted(Function(Map<String, dynamic>) cb) {
|
|
1013
|
+
_listen(hopScreenShareStartedEvent, cb); return this;
|
|
1014
|
+
}
|
|
1015
|
+
/// Fires when a transport is confirmed connected. Payload: `{ sessionId, transportId, status }`.
|
|
1016
|
+
LiveChattaSocketAPI onHopTransportParams(Function(Map<String, dynamic>) cb) {
|
|
1017
|
+
_listen(hopTransportParamsEvent, cb); return this;
|
|
1018
|
+
}
|
|
1019
|
+
/// Fires when recording is forbidden by plan/permission. Payload: `{ sessionId, reason }`.
|
|
1020
|
+
LiveChattaSocketAPI onHopRecordingForbidden(Function(Map<String, dynamic>) cb) {
|
|
1021
|
+
_listen(hopRecordingForbiddenEvent, cb); return this;
|
|
1022
|
+
}
|
|
1023
|
+
/// Fires when a vote fly-animation is broadcast. Payload: `{ sessionId, userId, direction, conversationId }`.
|
|
1024
|
+
LiveChattaSocketAPI onHopVote(Function(Map<String, dynamic>) cb) {
|
|
1025
|
+
_listen(hopVoteEvent, cb); return this;
|
|
1026
|
+
}
|
|
1027
|
+
|
|
1028
|
+
// ========= WHITEBOARD =========
|
|
1029
|
+
|
|
1030
|
+
/// Open (create) a whiteboard. Backend requires `conversationId` + `chatLinkId`;
|
|
1031
|
+
/// pass `chatLinkId` when known. The ack returns the created board.
|
|
1032
|
+
LiveChattaSocketAPI openWhiteboard(String conversationId, {String? chatLinkId}) {
|
|
1033
|
+
final payload = <String, dynamic>{'conversationId': conversationId};
|
|
1034
|
+
if (chatLinkId != null) payload['chatLinkId'] = chatLinkId;
|
|
1035
|
+
_emit(whiteboardOpenEvent, payload, null); return this;
|
|
1036
|
+
}
|
|
1037
|
+
LiveChattaSocketAPI sendWhiteboardStroke(Map<String, dynamic> data) { _emit(whiteboardStrokeEvent, data, null); return this; }
|
|
1038
|
+
/// Clear a whiteboard. `whiteboardId` optional — forwarded when known,
|
|
1039
|
+
/// otherwise derived from the conversation board by the backend.
|
|
1040
|
+
LiveChattaSocketAPI clearWhiteboard(String conversationId, {String? whiteboardId}) {
|
|
1041
|
+
final payload = <String, dynamic>{'conversationId': conversationId};
|
|
1042
|
+
if (whiteboardId != null) payload['whiteboardId'] = whiteboardId;
|
|
1043
|
+
_emit(whiteboardClearEvent, payload, null); return this;
|
|
1044
|
+
}
|
|
1045
|
+
/// Close a whiteboard. `whiteboardId` optional — see [clearWhiteboard].
|
|
1046
|
+
LiveChattaSocketAPI closeWhiteboard(String conversationId, {String? whiteboardId}) {
|
|
1047
|
+
final payload = <String, dynamic>{'conversationId': conversationId};
|
|
1048
|
+
if (whiteboardId != null) payload['whiteboardId'] = whiteboardId;
|
|
1049
|
+
_emit(whiteboardCloseEvent, payload, null); return this;
|
|
1050
|
+
}
|
|
1051
|
+
LiveChattaSocketAPI snapshotWhiteboard(Map<String, dynamic> data) { _emit(whiteboardSnapshotEvent, data, null); return this; }
|
|
1052
|
+
LiveChattaSocketAPI onWhiteboardStrokeReceived(Function(Map<String, dynamic>) cb) { _listen(whiteboardStrokeReceivedEvent, cb); return this; }
|
|
1053
|
+
LiveChattaSocketAPI onWhiteboardCleared(Function(Map<String, dynamic>) cb) { _listen(whiteboardClearedEvent, cb); return this; }
|
|
1054
|
+
LiveChattaSocketAPI onWhiteboardClosed(Function(Map<String, dynamic>) cb) { _listen(whiteboardClosedEvent, cb); return this; }
|
|
1055
|
+
LiveChattaSocketAPI onWhiteboardSnapshotReady(Function(Map<String, dynamic>) cb) { _listen(whiteboardSnapshotReadyEvent, cb); return this; }
|
|
1056
|
+
|
|
1057
|
+
// ========= AUTOMATION =========
|
|
1058
|
+
|
|
1059
|
+
LiveChattaSocketAPI createAutomation(Map<String, dynamic> data, {Function(dynamic)? callback}) { _emit(createAutomationEvent, data, callback); return this; }
|
|
1060
|
+
LiveChattaSocketAPI updateAutomation(Map<String, dynamic> data, {Function(dynamic)? callback}) { _emit(updateAutomationEvent, data, callback); return this; }
|
|
1061
|
+
LiveChattaSocketAPI deleteAutomation(String automationId, {Function(dynamic)? callback}) { _emit(deleteAutomationEvent, {'automationId': automationId}, callback); return this; }
|
|
1062
|
+
/// List automations for a chat link. The backend `GetAutomationsDto` requires
|
|
1063
|
+
/// `chatLinkId` — omitting it returns a 400. Acks with `{ automations }`.
|
|
1064
|
+
LiveChattaSocketAPI getAutomations(String chatLinkId, {Function(dynamic)? callback}) { _emit(getAutomationsEvent, {'chatLinkId': chatLinkId}, callback); return this; }
|
|
1065
|
+
|
|
1066
|
+
// ========= WEBINAR =========
|
|
1067
|
+
|
|
1068
|
+
LiveChattaSocketAPI startWebinar(Map<String, dynamic> data, {Function(dynamic)? callback}) { _emit(startWebinarEvent, data, callback); return this; }
|
|
1069
|
+
LiveChattaSocketAPI raiseHandWebinar(String conversationId) { _emit(raiseHandEvent, {'conversationId': conversationId}, null); return this; }
|
|
1070
|
+
LiveChattaSocketAPI lowerHand(String conversationId) { _emit(lowerHandEvent, {'conversationId': conversationId}, null); return this; }
|
|
1071
|
+
LiveChattaSocketAPI promoteAttendeeAudio(Map<String, dynamic> data, {Function(dynamic)? callback}) { _emit(promoteAttendeeAudioEvent, data, callback); return this; }
|
|
1072
|
+
LiveChattaSocketAPI submitWebinarQa(Map<String, dynamic> data, {Function(dynamic)? callback}) { _emit(webinarQaSubmitEvent, data, callback); return this; }
|
|
1073
|
+
LiveChattaSocketAPI answerWebinarQa(Map<String, dynamic> data, {Function(dynamic)? callback}) { _emit(webinarQaAnswerEvent, data, callback); return this; }
|
|
1074
|
+
LiveChattaSocketAPI onCallLogged(Function(Map<String, dynamic>) cb) { _listen(callLoggedEvent, cb); return this; }
|
|
1075
|
+
LiveChattaSocketAPI onChattaMoneyCard(Function(Map<String, dynamic>) cb) { _listen(chattaMoneyCardEvent, cb); return this; }
|
|
1076
|
+
/// 1.7.0: a shared money card changed (paid, declined, cancelled, expired, contribution, payout)
|
|
1077
|
+
LiveChattaSocketAPI onMoneyCardUpdate(Function(Map<String, dynamic>) cb) { _listen(moneyCardUpdateEvent, cb); return this; }
|
|
1078
|
+
LiveChattaSocketAPI onLinkSettingsUpdated(Function(Map<String, dynamic>) cb) { _listen(linkSettingsUpdatedEvent, cb); return this; }
|
|
1079
|
+
LiveChattaSocketAPI onWebinarViewerCount(Function(Map<String, dynamic>) cb) { _listen(webinarViewerCountEvent, cb); return this; }
|
|
1080
|
+
LiveChattaSocketAPI onWebinarStarted(Function(Map<String, dynamic>) cb) { _listen(webinarStartedEvent, cb); return this; }
|
|
1081
|
+
LiveChattaSocketAPI onWebinarRaisedHand(Function(Map<String, dynamic>) cb) { _listen(webinarHandRaisedEvent, cb); return this; }
|
|
1082
|
+
LiveChattaSocketAPI onWebinarHandLowered(Function(Map<String, dynamic>) cb) { _listen(webinarHandLoweredEvent, cb); return this; }
|
|
1083
|
+
LiveChattaSocketAPI onWebinarAttendeePromoted(Function(Map<String, dynamic>) cb) { _listen(webinarAttendeePromotedEvent, cb); return this; }
|
|
1084
|
+
LiveChattaSocketAPI onWebinarQaUpdated(Function(Map<String, dynamic>) cb) { _listen(webinarQaUpdatedEvent, cb); return this; }
|
|
1085
|
+
|
|
1086
|
+
// ========= CONVERSATION STATS =========
|
|
1087
|
+
|
|
1088
|
+
LiveChattaSocketAPI getConversationStats(String conversationId, {Function(dynamic)? callback}) { _emit(getConversationStatsEvent, {'conversationId': conversationId}, callback); return this; }
|
|
1089
|
+
LiveChattaSocketAPI onConversationStats(Function(Map<String, dynamic>) cb) { _listen(conversationStatsEvent, cb); return this; }
|
|
1090
|
+
LiveChattaSocketAPI onAiCreditsUpdated(Function(Map<String, dynamic>) cb) { _listen(aiCreditsUpdatedEvent, cb); return this; }
|
|
1091
|
+
LiveChattaSocketAPI onAiCreditsExhausted(Function(Map<String, dynamic>) cb) { _listen(aiCreditsExhaustedEvent, cb); return this; }
|
|
1092
|
+
|
|
1093
|
+
// ========= CHAT USER SETTINGS =========
|
|
1094
|
+
|
|
1095
|
+
LiveChattaSocketAPI updateChatUserSettings(Map<String, dynamic> data, {Function(dynamic)? callback}) { _emit(updateChatUserSettingsEvent, data, callback); return this; }
|
|
1096
|
+
|
|
1097
|
+
// ========= POSTS / STORIES =========
|
|
1098
|
+
|
|
1099
|
+
/// Create a post or story; allowReplies? (default true), background? (STORY: ink|brand|lagoon|sun)
|
|
1100
|
+
LiveChattaSocketAPI createPost(Map<String, dynamic> data, {Function(dynamic)? callback}) { _emit(createPostEvent, data, callback); return this; }
|
|
1101
|
+
/// Fetch posts (cursor-paginated). Acks with `{ results, nextCursor, hasMore }`.
|
|
1102
|
+
LiveChattaSocketAPI getPosts({Map<String, dynamic> data = const {}, Function(dynamic)? callback}) { _emit(getPostsEvent, data, callback); return this; }
|
|
1103
|
+
/// Fetch active stories.
|
|
1104
|
+
LiveChattaSocketAPI getStories({Map<String, dynamic> data = const {}, Function(dynamic)? callback}) { _emit(getStoriesEvent, data, callback); return this; }
|
|
1105
|
+
/// Mark a post/story as viewed.
|
|
1106
|
+
LiveChattaSocketAPI viewPost(Map<String, dynamic> data, {Function(dynamic)? callback}) { _emit(viewPostEvent, data, callback); return this; }
|
|
1107
|
+
/// React to a post with an emoji.
|
|
1108
|
+
LiveChattaSocketAPI reactToPost(Map<String, dynamic> data, {Function(dynamic)? callback}) { _emit(reactToPostEvent, data, callback); return this; }
|
|
1109
|
+
/// Reply to a post.
|
|
1110
|
+
LiveChattaSocketAPI replyToPost(Map<String, dynamic> data, {Function(dynamic)? callback}) { _emit(replyToPostEvent, data, callback); return this; }
|
|
1111
|
+
/// Update a post's content/caption/attachments.
|
|
1112
|
+
LiveChattaSocketAPI updatePost(Map<String, dynamic> data, {Function(dynamic)? callback}) { _emit(updatePostEvent, data, callback); return this; }
|
|
1113
|
+
/// Delete a post.
|
|
1114
|
+
LiveChattaSocketAPI deletePost(Map<String, dynamic> data, {Function(dynamic)? callback}) { _emit(deletePostEvent, data, callback); return this; }
|
|
1115
|
+
|
|
1116
|
+
LiveChattaSocketAPI onCreatePost(Function(Map<String, dynamic>) cb) { _listen(createPostEvent, cb); return this; }
|
|
1117
|
+
LiveChattaSocketAPI onNewStory(Function(Map<String, dynamic>) cb) { _listen(newStoryEvent, cb); return this; }
|
|
1118
|
+
LiveChattaSocketAPI onUpdatePost(Function(Map<String, dynamic>) cb) { _listen(updatePostEvent, cb); return this; }
|
|
1119
|
+
LiveChattaSocketAPI onDeletePost(Function(Map<String, dynamic>) cb) { _listen(deletePostEvent, cb); return this; }
|
|
1120
|
+
LiveChattaSocketAPI onReactToPost(Function(Map<String, dynamic>) cb) { _listen(reactToPostEvent, cb); return this; }
|
|
1121
|
+
LiveChattaSocketAPI onReplyToPost(Function(Map<String, dynamic>) cb) { _listen(replyToPostEvent, cb); return this; }
|
|
1122
|
+
|
|
1123
|
+
// ========= TRANSLATION =========
|
|
1124
|
+
|
|
1125
|
+
/// Translate a message. Ack: `{ messageId, targetLanguage, translation, cached }` or `{ error }`.
|
|
1126
|
+
LiveChattaSocketAPI translateMessage(Map<String, dynamic> data, {Function(dynamic)? callback}) { _emit(translateMessageEvent, data, callback); return this; }
|
|
1127
|
+
/// Set the caller's preferred language. Ack: `{ success, language }`.
|
|
1128
|
+
LiveChattaSocketAPI setLanguage(Map<String, dynamic> data, {Function(dynamic)? callback}) { _emit(setLanguageEvent, data, callback); return this; }
|
|
1129
|
+
LiveChattaSocketAPI onTranslateMessage(Function(Map<String, dynamic>) cb) { _listen(translateMessageEvent, cb); return this; }
|
|
1130
|
+
|
|
1131
|
+
// ========= PRESENCE =========
|
|
1132
|
+
|
|
1133
|
+
/// Resolve which of `memberIds` are currently online. Ack: `{ onlineUserIds }`.
|
|
1134
|
+
LiveChattaSocketAPI getOnlineUsers(Map<String, dynamic> data, {Function(dynamic)? callback}) { _emit(onlineUsersEvent, data, callback); return this; }
|
|
1135
|
+
/// Send a presence heartbeat (recommended every 30s). `visible: false` while the chat is hidden, so a push still goes out.
|
|
1136
|
+
LiveChattaSocketAPI heartbeat({bool? visible}) { _emit(heartbeatEvent, <String, dynamic>{if (visible != null) 'visible': visible}, null); return this; }
|
|
1137
|
+
|
|
1138
|
+
// ========= HOP COLLAB (co-host / poll / whiteboard) =========
|
|
1139
|
+
|
|
1140
|
+
/// Promote a participant to co-host. Host/co-host only.
|
|
1141
|
+
LiveChattaSocketAPI hopCoHostAssign(Map<String, dynamic> data) { _emit(hopCoHostAssignEvent, data, null); return this; }
|
|
1142
|
+
LiveChattaSocketAPI onHopCoHostAssigned(Function(Map<String, dynamic>) cb) { _listen(hopCoHostAssignedEvent, cb); return this; }
|
|
1143
|
+
/// Launch a poll visible to all session participants.
|
|
1144
|
+
LiveChattaSocketAPI hopPollLaunch(Map<String, dynamic> data) { _emit(hopPollLaunchEvent, data, null); return this; }
|
|
1145
|
+
LiveChattaSocketAPI onHopPollLaunched(Function(Map<String, dynamic>) cb) { _listen(hopPollLaunchedEvent, cb); return this; }
|
|
1146
|
+
/// Cast a vote in a running hop poll.
|
|
1147
|
+
LiveChattaSocketAPI hopPollVote(Map<String, dynamic> data) { _emit(hopPollVoteEvent, data, null); return this; }
|
|
1148
|
+
/// Poll summary {pollId, sessionId, question, options[{id,text,count}], total, closed, ...} after a vote or close.
|
|
1149
|
+
LiveChattaSocketAPI onHopPollVoteUpdated(Function(Map<String, dynamic>) cb) { _listen(hopPollVoteUpdatedEvent, cb); return this; }
|
|
1150
|
+
/// Broadcast a whiteboard drawing delta to other hop participants.
|
|
1151
|
+
LiveChattaSocketAPI hopWhiteboardSync(Map<String, dynamic> data) { _emit(hopWhiteboardSyncEvent, data, null); return this; }
|
|
1152
|
+
LiveChattaSocketAPI onHopWhiteboardDelta(Function(Map<String, dynamic>) cb) { _listen(hopWhiteboardDeltaEvent, cb); return this; }
|
|
1153
|
+
|
|
1154
|
+
/// Listen for authentication errors (invalid/expired token).
|
|
1155
|
+
LiveChattaSocketAPI onAuthError(Function(Map<String, dynamic>) callback) { _listen(authErrorEvent, callback); return this; }
|
|
1156
|
+
|
|
1157
|
+
/// Listen for chat errors
|
|
1158
|
+
LiveChattaSocketAPI onError(Function(Map<String, dynamic>) callback) {
|
|
1159
|
+
_listen(chatError, callback);
|
|
1160
|
+
return this;
|
|
1161
|
+
}
|
|
1162
|
+
|
|
1163
|
+
/// Listen for SDK connect event
|
|
1164
|
+
LiveChattaSocketAPI onConnect(Function() callback) {
|
|
1165
|
+
_client.on(LiveChattaClient.eventConnected, (_) => callback());
|
|
1166
|
+
return this;
|
|
1167
|
+
}
|
|
1168
|
+
|
|
1169
|
+
/// Listen for SDK disconnect event
|
|
1170
|
+
LiveChattaSocketAPI onDisconnect(Function(String) callback) {
|
|
1171
|
+
_client.on(LiveChattaClient.eventDisconnected, (data) {
|
|
1172
|
+
final reason = (data is Map) ? (data['reason']?.toString() ?? 'unknown') : 'unknown';
|
|
1173
|
+
callback(reason);
|
|
1174
|
+
});
|
|
1175
|
+
return this;
|
|
1176
|
+
}
|
|
1177
|
+
|
|
1178
|
+
/// Listen for SDK reconnect event
|
|
1179
|
+
LiveChattaSocketAPI onReconnect(Function(int) callback) {
|
|
1180
|
+
_client.on(LiveChattaClient.eventReconnected, (data) {
|
|
1181
|
+
final attempt = (data is Map) ? (data['attempt'] as int? ?? 0) : 0;
|
|
1182
|
+
callback(attempt);
|
|
1183
|
+
});
|
|
1184
|
+
return this;
|
|
1185
|
+
}
|
|
1186
|
+
|
|
1187
|
+
/// Listen for SDK reconnecting event
|
|
1188
|
+
LiveChattaSocketAPI onReconnecting(Function(int) callback) {
|
|
1189
|
+
_client.on(LiveChattaClient.eventReconnecting, (data) {
|
|
1190
|
+
final attempt = (data is Map) ? (data['attempt'] as int? ?? 0) : 0;
|
|
1191
|
+
callback(attempt);
|
|
1192
|
+
});
|
|
1193
|
+
return this;
|
|
1194
|
+
}
|
|
1195
|
+
|
|
1196
|
+
/// Remove listener(s) for an event
|
|
1197
|
+
LiveChattaSocketAPI off(String event) {
|
|
1198
|
+
_socket.off(event);
|
|
1199
|
+
return this;
|
|
1200
|
+
}
|
|
1201
|
+
|
|
1202
|
+
// ===================
|
|
1203
|
+
// CHAT FEATURES
|
|
1204
|
+
// ===================
|
|
1205
|
+
|
|
1206
|
+
/// { conversationId, messageIds (≤100) } — ack delivery of messages you didn't send
|
|
1207
|
+
void messageDelivered(Map<String, dynamic> data, {Function(dynamic)? callback}) =>
|
|
1208
|
+
_emit(messageDeliveredEvent, data, callback);
|
|
1209
|
+
|
|
1210
|
+
/// { conversationId, messageId, nextCursor?, limit? } — seen-by list
|
|
1211
|
+
void messageInfo(Map<String, dynamic> data, {Function(dynamic)? callback}) =>
|
|
1212
|
+
_emit(messageInfoEvent, data, callback);
|
|
1213
|
+
|
|
1214
|
+
/// { conversationId, duration: 1h|8h|1w|forever|off }
|
|
1215
|
+
void muteConversation(Map<String, dynamic> data, {Function(dynamic)? callback}) =>
|
|
1216
|
+
_emit(muteConversationEvent, data, callback);
|
|
1217
|
+
|
|
1218
|
+
/// { enabled, start: HH:mm, end: HH:mm, timezone }
|
|
1219
|
+
void updateQuietHours(Map<String, dynamic> data, {Function(dynamic)? callback}) =>
|
|
1220
|
+
_emit(updateQuietHoursEvent, data, callback);
|
|
1221
|
+
|
|
1222
|
+
/// { conversationId, messageId, kind: remind|read_later, preset?, remindAt?, note? }
|
|
1223
|
+
void setMessageReminder(Map<String, dynamic> data, {Function(dynamic)? callback}) =>
|
|
1224
|
+
_emit(setMessageReminderEvent, data, callback);
|
|
1225
|
+
|
|
1226
|
+
/// { reminderId }
|
|
1227
|
+
void cancelMessageReminder(Map<String, dynamic> data, {Function(dynamic)? callback}) =>
|
|
1228
|
+
_emit(cancelMessageReminderEvent, data, callback);
|
|
1229
|
+
|
|
1230
|
+
/// { conversationId, membersCan*?, slowModeSeconds?, allowScreenshots?, isPrivate? }
|
|
1231
|
+
void updateConversationPermissions(Map<String, dynamic> data, {Function(dynamic)? callback}) =>
|
|
1232
|
+
_emit(updateConversationPermissionsEvent, data, callback);
|
|
1233
|
+
|
|
1234
|
+
/// { conversationId, initialMediaKind? } — then joinHop for media
|
|
1235
|
+
void huddleStart(Map<String, dynamic> data, {Function(dynamic)? callback}) =>
|
|
1236
|
+
_emit(huddleStartEvent, data, callback);
|
|
1237
|
+
|
|
1238
|
+
/// { conversationId }
|
|
1239
|
+
void huddleStatus(Map<String, dynamic> data, {Function(dynamic)? callback}) =>
|
|
1240
|
+
_emit(huddleStatusEvent, data, callback);
|
|
1241
|
+
|
|
1242
|
+
/// { conversationId } — host/co-host or conversation admin
|
|
1243
|
+
void huddleEnd(Map<String, dynamic> data, {Function(dynamic)? callback}) =>
|
|
1244
|
+
_emit(huddleEndEvent, data, callback);
|
|
1245
|
+
|
|
1246
|
+
/// { conversationId, messageId } — failures arrive as transcript.errorCode
|
|
1247
|
+
void transcribeMessage(Map<String, dynamic> data, {Function(dynamic)? callback}) =>
|
|
1248
|
+
_emit(transcribeMessageEvent, data, callback);
|
|
1249
|
+
|
|
1250
|
+
LiveChattaSocketAPI onMessageDelivered(Function(Map<String, dynamic>) cb) {
|
|
1251
|
+
_listen(messageDeliveredEvent, cb); return this;
|
|
1252
|
+
}
|
|
1253
|
+
|
|
1254
|
+
LiveChattaSocketAPI onConversationMuted(Function(Map<String, dynamic>) cb) {
|
|
1255
|
+
_listen(conversationMutedEvent, cb); return this;
|
|
1256
|
+
}
|
|
1257
|
+
|
|
1258
|
+
LiveChattaSocketAPI onQuietHoursUpdated(Function(Map<String, dynamic>) cb) {
|
|
1259
|
+
_listen(quietHoursUpdatedEvent, cb); return this;
|
|
1260
|
+
}
|
|
1261
|
+
|
|
1262
|
+
LiveChattaSocketAPI onMessageRemindersChanged(Function(Map<String, dynamic>) cb) {
|
|
1263
|
+
_listen(messageRemindersChangedEvent, cb); return this;
|
|
1264
|
+
}
|
|
1265
|
+
|
|
1266
|
+
LiveChattaSocketAPI onMessageReminderDue(Function(Map<String, dynamic>) cb) {
|
|
1267
|
+
_listen(messageReminderDueEvent, cb); return this;
|
|
1268
|
+
}
|
|
1269
|
+
|
|
1270
|
+
LiveChattaSocketAPI onConversationPermissionsUpdated(Function(Map<String, dynamic>) cb) {
|
|
1271
|
+
_listen(conversationPermissionsUpdatedEvent, cb); return this;
|
|
1272
|
+
}
|
|
1273
|
+
|
|
1274
|
+
/// A chat peer set or cleared their /status or /away
|
|
1275
|
+
LiveChattaSocketAPI onStatusUpdated(Function(Map<String, dynamic>) cb) {
|
|
1276
|
+
_listen(statusUpdatedEvent, cb); return this;
|
|
1277
|
+
}
|
|
1278
|
+
|
|
1279
|
+
/// A live-location point moved
|
|
1280
|
+
LiveChattaSocketAPI onLiveLocationUpdated(Function(Map<String, dynamic>) cb) {
|
|
1281
|
+
_listen(liveLocationUpdatedEvent, cb); return this;
|
|
1282
|
+
}
|
|
1283
|
+
|
|
1284
|
+
/// A live-location share ended
|
|
1285
|
+
LiveChattaSocketAPI onLiveLocationEnded(Function(Map<String, dynamic>) cb) {
|
|
1286
|
+
_listen(liveLocationEndedEvent, cb); return this;
|
|
1287
|
+
}
|
|
1288
|
+
|
|
1289
|
+
/// A connected calendar moved a meeting you are in: { conversationId, startAt, endAt, title }
|
|
1290
|
+
LiveChattaSocketAPI onHopMeetingUpdated(Function(Map<String, dynamic>) cb) {
|
|
1291
|
+
_listen(hopMeetingUpdatedEvent, cb); return this;
|
|
1292
|
+
}
|
|
1293
|
+
|
|
1294
|
+
LiveChattaSocketAPI onHuddleUpdated(Function(Map<String, dynamic>) cb) {
|
|
1295
|
+
_listen(huddleUpdatedEvent, cb); return this;
|
|
1296
|
+
}
|
|
1297
|
+
|
|
1298
|
+
LiveChattaSocketAPI onMessageTranscriptUpdated(Function(Map<String, dynamic>) cb) {
|
|
1299
|
+
_listen(messageTranscriptUpdatedEvent, cb); return this;
|
|
1300
|
+
}
|
|
1301
|
+
|
|
1302
|
+
LiveChattaSocketAPI onInboxUpdated(Function(Map<String, dynamic>) cb) {
|
|
1303
|
+
_listen(inboxUpdatedEvent, cb); return this;
|
|
1304
|
+
}
|
|
1305
|
+
|
|
1306
|
+
// ===================
|
|
1307
|
+
// CHAT CORE + HOP COLLAB emitters (ack = callback payload)
|
|
1308
|
+
// ===================
|
|
1309
|
+
|
|
1310
|
+
/// { conversationId } — zero your unread count; ack { conversationId, unreadCount, lastReadAt }
|
|
1311
|
+
void conversationRead(Map<String, dynamic> data, {Function(dynamic)? callback}) =>
|
|
1312
|
+
_emit(conversationReadEvent, data, callback);
|
|
1313
|
+
|
|
1314
|
+
/// { conversationId, messageId } — mark unread from that message; ack { conversationId, unreadCount, lastReadAt }
|
|
1315
|
+
void conversationUnread(Map<String, dynamic> data, {Function(dynamic)? callback}) =>
|
|
1316
|
+
_emit(conversationUnreadEvent, data, callback);
|
|
1317
|
+
|
|
1318
|
+
/// Unread per lane for rows you have not loaded; ack { unreadTotals: { total, active, archived, people, groups, channels, saved } }
|
|
1319
|
+
void getUnreadTotals({List<String> excludeConversationIds = const [], Function(dynamic)? callback}) =>
|
|
1320
|
+
_emit(unreadTotalsEvent, {
|
|
1321
|
+
'excludeConversationIds': excludeConversationIds.take(unreadTotalsMaxExclude).toList(),
|
|
1322
|
+
}, callback);
|
|
1323
|
+
|
|
1324
|
+
/// { conversationId, messageId, scope: me|everyone } — everyone: sender ≤48 h or admins
|
|
1325
|
+
void deleteMessage(Map<String, dynamic> data, {Function(dynamic)? callback}) =>
|
|
1326
|
+
_emit(deleteMessageEvent, data, callback);
|
|
1327
|
+
|
|
1328
|
+
/// { q (2–64), scope?: all|messages|conversations|people, nextCursor? }
|
|
1329
|
+
void searchAll(Map<String, dynamic> data, {Function(dynamic)? callback}) =>
|
|
1330
|
+
_emit(searchAllEvent, data, callback);
|
|
1331
|
+
|
|
1332
|
+
/// { conversationId, name?, email?, phone?, topic? } — validated against the link's fields
|
|
1333
|
+
void submitPreChat(Map<String, dynamic> data, {Function(dynamic)? callback}) =>
|
|
1334
|
+
_emit(submitPreChatEvent, data, callback);
|
|
1335
|
+
|
|
1336
|
+
/// { sessionId, pollId } — host or poll starter; ack { ok, poll }
|
|
1337
|
+
void hopPollClose(Map<String, dynamic> data, {Function(dynamic)? callback}) =>
|
|
1338
|
+
_emit(hopPollCloseEvent, data, callback);
|
|
1339
|
+
|
|
1340
|
+
/// { sessionId } — polls, hands, captions and recording state on (re)join
|
|
1341
|
+
void hopCollabState(Map<String, dynamic> data, {Function(dynamic)? callback}) =>
|
|
1342
|
+
_emit(hopCollabStateEvent, data, callback);
|
|
1343
|
+
|
|
1344
|
+
/// { sessionId, enabled } — the room gets hop-captions-state
|
|
1345
|
+
void hopCaptionsToggle(Map<String, dynamic> data, {Function(dynamic)? callback}) =>
|
|
1346
|
+
_emit(hopCaptionsToggleEvent, data, callback);
|
|
1347
|
+
|
|
1348
|
+
/// { sessionId, text, final?, lang? } — one speech-to-text line while captions are on
|
|
1349
|
+
void hopCaption(Map<String, dynamic> data, {Function(dynamic)? callback}) =>
|
|
1350
|
+
_emit(hopCaptionEvent, data, callback);
|
|
1351
|
+
|
|
1352
|
+
/// { conversationId, nextCursor?, limit? (≤20) } — ack { ok, results, nextCursor, hasMore }
|
|
1353
|
+
/// {} — ack { results: [{ id, name, url, width, height, animated, useCount, mine, uploadedByMe, source }] }
|
|
1354
|
+
void stickersMine([Map<String, dynamic> data = const {}, Function(dynamic)? callback]) =>
|
|
1355
|
+
_emit(stickersMineEvent, data, callback);
|
|
1356
|
+
|
|
1357
|
+
/// { q?, nextCursor? } — ack { results, nextCursor, hasMore }
|
|
1358
|
+
void stickersSearch([Map<String, dynamic> data = const {}, Function(dynamic)? callback]) =>
|
|
1359
|
+
_emit(stickersSearchEvent, data, callback);
|
|
1360
|
+
|
|
1361
|
+
/// { image (data URI, 64–512 px, ≤512 KB), name (2–40), tags? } — ack { sticker }
|
|
1362
|
+
void stickerUpload([Map<String, dynamic> data = const {}, Function(dynamic)? callback]) =>
|
|
1363
|
+
_emit(stickerUploadEvent, data, callback);
|
|
1364
|
+
|
|
1365
|
+
/// { stickerId } — ack { ok }
|
|
1366
|
+
void stickerAdd([Map<String, dynamic> data = const {}, Function(dynamic)? callback]) =>
|
|
1367
|
+
_emit(stickerAddEvent, data, callback);
|
|
1368
|
+
|
|
1369
|
+
/// { stickerId, everywhere? (uploader only) } — ack { ok }
|
|
1370
|
+
void stickerRemove([Map<String, dynamic> data = const {}, Function(dynamic)? callback]) =>
|
|
1371
|
+
_emit(stickerRemoveEvent, data, callback);
|
|
1372
|
+
|
|
1373
|
+
/// { intentId, actionId, code?, conversationId } — the result arrives on onChattaMoneyCard
|
|
1374
|
+
void chattaMoneyConfirm([Map<String, dynamic> data = const {}, Function(dynamic)? callback]) =>
|
|
1375
|
+
_emit(chattaMoneyConfirmEvent, data, callback);
|
|
1376
|
+
|
|
1377
|
+
/// 1.7.0: { kind: request | split | pot | paylink, id } — ack is the card (members of its chat, or the two people in a request)
|
|
1378
|
+
void getMoneyCard([Map<String, dynamic> data = const {}, Function(dynamic)? callback]) =>
|
|
1379
|
+
_emit(moneyCardGetEvent, data, callback);
|
|
1380
|
+
|
|
1381
|
+
/// 1.7.0: { conversationId, kind, id, action: pay | decline | cancel | contribute | close | refund | wallet | card | block, amount? (the server takes the chat from the card, so conversationId is optional) } — money-moving taps answer on onChattaMoneyCard
|
|
1382
|
+
void moneyCardAction([Map<String, dynamic> data = const {}, Function(dynamic)? callback]) =>
|
|
1383
|
+
_emit(moneyCardActionEvent, data, callback);
|
|
1384
|
+
|
|
1385
|
+
/// { conversationId, qaId } — host/admin; ack { conversationId, qaId, attendeeId, promoted }
|
|
1386
|
+
void webinarQaAnswerLive([Map<String, dynamic> data = const {}, Function(dynamic)? callback]) =>
|
|
1387
|
+
_emit(webinarQaAnswerLiveEvent, data, callback);
|
|
1388
|
+
|
|
1389
|
+
/// { conversationId, qaId } — upvote; the room gets webinar-qa-updated
|
|
1390
|
+
void webinarQaVote([Map<String, dynamic> data = const {}, Function(dynamic)? callback]) =>
|
|
1391
|
+
_emit(webinarQaVoteEvent, data, callback);
|
|
1392
|
+
|
|
1393
|
+
void hopRecordingList(Map<String, dynamic> data, {Function(dynamic)? callback}) =>
|
|
1394
|
+
_emit(hopRecordingListEvent, data, callback);
|
|
1395
|
+
|
|
1396
|
+
/// Agents only: { conversationId, note }
|
|
1397
|
+
LiveChattaSocketAPI onInternalNote(Function(Map<String, dynamic>) cb) {
|
|
1398
|
+
_listen(internalNoteEvent, cb); return this;
|
|
1399
|
+
}
|
|
1400
|
+
|
|
1401
|
+
/// { conversationId, noteId }
|
|
1402
|
+
LiveChattaSocketAPI onInternalNoteDeleted(Function(Map<String, dynamic>) cb) {
|
|
1403
|
+
_listen(internalNoteDeletedEvent, cb); return this;
|
|
1404
|
+
}
|
|
1405
|
+
|
|
1406
|
+
/// { conversationId, action: created|updated|deleted, note?, noteId? }
|
|
1407
|
+
LiveChattaSocketAPI onConversationNotesUpdated(Function(Map<String, dynamic>) cb) {
|
|
1408
|
+
_listen(conversationNotesUpdatedEvent, cb); return this;
|
|
1409
|
+
}
|
|
1410
|
+
|
|
1411
|
+
/// CSAT card rated or replaced: { conversationId, messageId, csat, rating? (agents only, with the comment) }
|
|
1412
|
+
LiveChattaSocketAPI onCsatUpdated(Function(Map<String, dynamic>) cb) {
|
|
1413
|
+
_listen(csatUpdatedEvent, cb); return this;
|
|
1414
|
+
}
|
|
1415
|
+
|
|
1416
|
+
/// You read a conversation on any device: clear its badge.
|
|
1417
|
+
LiveChattaSocketAPI onConversationRead(Function(Map<String, dynamic>) cb) {
|
|
1418
|
+
_listen(conversationReadEvent, cb); return this;
|
|
1419
|
+
}
|
|
1420
|
+
|
|
1421
|
+
/// You marked a conversation unread on any device: show its badge again.
|
|
1422
|
+
LiveChattaSocketAPI onConversationUnread(Function(Map<String, dynamic>) cb) {
|
|
1423
|
+
_listen(conversationUnreadEvent, cb); return this;
|
|
1424
|
+
}
|
|
1425
|
+
|
|
1426
|
+
/// { conversationId, messageId, scope, deletedAt, deletedBy, parentMessageId }
|
|
1427
|
+
LiveChattaSocketAPI onMessageDeleted(Function(Map<String, dynamic>) cb) {
|
|
1428
|
+
_listen(messageDeletedEvent, cb); return this;
|
|
1429
|
+
}
|
|
1430
|
+
|
|
1431
|
+
/// { conversationId, ownerId, name, email, phone, topic, submittedBy, submittedAt }
|
|
1432
|
+
LiveChattaSocketAPI onPreChatSubmitted(Function(Map<String, dynamic>) cb) {
|
|
1433
|
+
_listen(preChatSubmittedEvent, cb); return this;
|
|
1434
|
+
}
|
|
1435
|
+
|
|
1436
|
+
/// thread-messages broadcasts { type: thread_update, parentMessageId, conversationId, replier? }
|
|
1437
|
+
LiveChattaSocketAPI onThreadUpdate(Function(Map<String, dynamic>) cb) {
|
|
1438
|
+
_listen(threadMessagesEvent, cb); return this;
|
|
1439
|
+
}
|
|
1440
|
+
|
|
1441
|
+
/// { sessionId, enabled, byUserId?, byName?, at? }
|
|
1442
|
+
LiveChattaSocketAPI onHopCaptionsState(Function(Map<String, dynamic>) cb) {
|
|
1443
|
+
_listen(hopCaptionsStateEvent, cb); return this;
|
|
1444
|
+
}
|
|
1445
|
+
|
|
1446
|
+
/// { sessionId, userId, displayName, text, final, lang, ts }
|
|
1447
|
+
LiveChattaSocketAPI onHopCaptionText(Function(Map<String, dynamic>) cb) {
|
|
1448
|
+
_listen(hopCaptionTextEvent, cb); return this;
|
|
1449
|
+
}
|
|
1450
|
+
|
|
1451
|
+
// ===================
|
|
1452
|
+
// INTERNAL
|
|
1453
|
+
// ===================
|
|
1454
|
+
|
|
1455
|
+
void flushQueue() {
|
|
1456
|
+
if (_queue.isEmpty) return;
|
|
1457
|
+
_client.log('Flushing ${_queue.length} queued emits');
|
|
1458
|
+
final pending = List<_QueuedEmit>.from(_queue);
|
|
1459
|
+
_queue.clear();
|
|
1460
|
+
_client.emitLifecycleEvent(LiveChattaClient.eventQueueFlush, {'count': pending.length});
|
|
1461
|
+
|
|
1462
|
+
for (final item in pending) {
|
|
1463
|
+
_emit(item.event, item.data, item.callback);
|
|
1464
|
+
}
|
|
1465
|
+
}
|
|
1466
|
+
|
|
1467
|
+
void _emit(String event, Map<String, dynamic> data, Function(dynamic)? callback) {
|
|
1468
|
+
if (_socket.connected == true) {
|
|
1469
|
+
_socket.emitWithAck(event, data, ack: (response) {
|
|
1470
|
+
// Denied calls ack { error }; never hand that to the callback as a success payload.
|
|
1471
|
+
final denied = response is Map ? response['error'] : null;
|
|
1472
|
+
if (denied != null) {
|
|
1473
|
+
onAckError?.call(event, denied);
|
|
1474
|
+
callback?.call(null);
|
|
1475
|
+
} else {
|
|
1476
|
+
callback?.call(response);
|
|
1477
|
+
}
|
|
1478
|
+
});
|
|
1479
|
+
} else {
|
|
1480
|
+
_client.log('Queuing emit: $event');
|
|
1481
|
+
_queue.add(_QueuedEmit(event: event, data: data, callback: callback));
|
|
1482
|
+
}
|
|
1483
|
+
}
|
|
1484
|
+
|
|
1485
|
+
void _listen(String event, Function(Map<String, dynamic>) callback) {
|
|
1486
|
+
_socket.on(event, (data) {
|
|
1487
|
+
if (data is Map<String, dynamic>) {
|
|
1488
|
+
callback(data);
|
|
1489
|
+
} else if (data is Map) {
|
|
1490
|
+
callback(Map<String, dynamic>.from(data));
|
|
1491
|
+
} else {
|
|
1492
|
+
callback({});
|
|
1493
|
+
}
|
|
1494
|
+
});
|
|
1495
|
+
}
|
|
1496
|
+
}
|
|
1497
|
+
|
|
1498
|
+
class _QueuedEmit {
|
|
1499
|
+
final String event;
|
|
1500
|
+
final Map<String, dynamic> data;
|
|
1501
|
+
final Function(dynamic)? callback;
|
|
1502
|
+
|
|
1503
|
+
_QueuedEmit({required this.event, required this.data, this.callback});
|
|
1504
|
+
}
|