@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.
Files changed (246) hide show
  1. package/CHANGELOG.md +218 -0
  2. package/LICENSE +21 -0
  3. package/README.md +2558 -2
  4. package/bin/chatta.mjs +7 -0
  5. package/bin/lib/cli.d.mts +46 -0
  6. package/bin/lib/cli.mjs +2088 -0
  7. package/dist/cjs/livechatta.cjs.js +7258 -0
  8. package/dist/cjs/livechatta.cjs.js.map +1 -0
  9. package/dist/cjs/livechatta.cjs.min.js +2 -0
  10. package/dist/cjs/livechatta.cjs.min.js.map +1 -0
  11. package/dist/esm/livechatta.esm.js +7077 -0
  12. package/dist/esm/livechatta.esm.js.map +1 -0
  13. package/dist/esm/livechatta.esm.min.js +2 -0
  14. package/dist/esm/livechatta.esm.min.js.map +1 -0
  15. package/dist/platforms/android/LiveChattaClient.kt +367 -0
  16. package/dist/platforms/android/LiveChattaHttpAPI.kt +2630 -0
  17. package/dist/platforms/android/LiveChattaJson.kt +83 -0
  18. package/dist/platforms/android/LiveChattaModels.kt +22805 -0
  19. package/dist/platforms/android/LiveChattaSentFrom.kt +30 -0
  20. package/dist/platforms/android/LiveChattaSocketAPI.kt +2113 -0
  21. package/dist/platforms/android/LiveChattaTyped.kt +239 -0
  22. package/dist/platforms/android/LiveChattaWebView.kt +158 -0
  23. package/dist/platforms/angular/livechatta-bridge.service.d.ts +35 -0
  24. package/dist/platforms/angular/livechatta-bridge.service.js +1 -0
  25. package/dist/platforms/angular/livechatta-bridge.service.js.map +1 -0
  26. package/dist/platforms/angular/livechatta-embed.component.d.ts +46 -0
  27. package/dist/platforms/angular/livechatta-embed.component.js +1 -0
  28. package/dist/platforms/angular/livechatta-embed.component.js.map +1 -0
  29. package/dist/platforms/angular/livechatta.service.d.ts +66 -0
  30. package/dist/platforms/angular/livechatta.service.js +1 -0
  31. package/dist/platforms/angular/livechatta.service.js.map +1 -0
  32. package/dist/platforms/capacitor/CapacitorBridge.d.ts +27 -0
  33. package/dist/platforms/capacitor/CapacitorBridge.js +1 -0
  34. package/dist/platforms/capacitor/CapacitorBridge.js.map +1 -0
  35. package/dist/platforms/capacitor/CapacitorDeepLinks.d.ts +23 -0
  36. package/dist/platforms/capacitor/CapacitorDeepLinks.js +1 -0
  37. package/dist/platforms/capacitor/CapacitorDeepLinks.js.map +1 -0
  38. package/dist/platforms/capacitor/CapacitorPermissions.d.ts +29 -0
  39. package/dist/platforms/capacitor/CapacitorPermissions.js +1 -0
  40. package/dist/platforms/capacitor/CapacitorPermissions.js.map +1 -0
  41. package/dist/platforms/capacitor/CapacitorPush.d.ts +33 -0
  42. package/dist/platforms/capacitor/CapacitorPush.js +1 -0
  43. package/dist/platforms/capacitor/CapacitorPush.js.map +1 -0
  44. package/dist/platforms/capacitor/index.d.ts +24 -0
  45. package/dist/platforms/capacitor/index.js +1 -0
  46. package/dist/platforms/capacitor/index.js.map +1 -0
  47. package/dist/platforms/flutter/livechatta_client.dart +359 -0
  48. package/dist/platforms/flutter/livechatta_http_api.dart +1942 -0
  49. package/dist/platforms/flutter/livechatta_json.dart +57 -0
  50. package/dist/platforms/flutter/livechatta_models.dart +23531 -0
  51. package/dist/platforms/flutter/livechatta_sent_from.dart +35 -0
  52. package/dist/platforms/flutter/livechatta_socket_api.dart +1504 -0
  53. package/dist/platforms/flutter/livechatta_typed.dart +234 -0
  54. package/dist/platforms/flutter/livechatta_webview.dart +190 -0
  55. package/dist/platforms/ios/LiveChattaClient.swift +374 -0
  56. package/dist/platforms/ios/LiveChattaHttpAPI.swift +2431 -0
  57. package/dist/platforms/ios/LiveChattaJSON.swift +84 -0
  58. package/dist/platforms/ios/LiveChattaModels.swift +27050 -0
  59. package/dist/platforms/ios/LiveChattaSentFrom.swift +32 -0
  60. package/dist/platforms/ios/LiveChattaSocketAPI.swift +1446 -0
  61. package/dist/platforms/ios/LiveChattaTyped.swift +268 -0
  62. package/dist/platforms/ios/LiveChattaWebView.swift +191 -0
  63. package/dist/platforms/nuxt/LiveChattaView.d.ts +1 -0
  64. package/dist/platforms/nuxt/LiveChattaView.js +1 -0
  65. package/dist/platforms/nuxt/LiveChattaView.js.map +1 -0
  66. package/dist/platforms/nuxt/useChattaBridge.d.ts +9 -0
  67. package/dist/platforms/nuxt/useChattaBridge.js +1 -0
  68. package/dist/platforms/nuxt/useChattaBridge.js.map +1 -0
  69. package/dist/platforms/nuxt/useLiveChatta.d.ts +63 -0
  70. package/dist/platforms/nuxt/useLiveChatta.js +1 -0
  71. package/dist/platforms/nuxt/useLiveChatta.js.map +1 -0
  72. package/dist/platforms/react/LiveChattaView.d.ts +58 -0
  73. package/dist/platforms/react/LiveChattaView.js +1 -0
  74. package/dist/platforms/react/LiveChattaView.js.map +1 -0
  75. package/dist/platforms/react/useChattaBridge.d.ts +1 -0
  76. package/dist/platforms/react/useChattaBridge.js +1 -0
  77. package/dist/platforms/react/useChattaBridge.js.map +1 -0
  78. package/dist/platforms/react/useChattaDeepLink.d.ts +2 -0
  79. package/dist/platforms/react/useChattaDeepLink.js +1 -0
  80. package/dist/platforms/react/useChattaDeepLink.js.map +1 -0
  81. package/dist/platforms/react/useChattaPermissions.d.ts +9 -0
  82. package/dist/platforms/react/useChattaPermissions.js +1 -0
  83. package/dist/platforms/react/useChattaPermissions.js.map +1 -0
  84. package/dist/platforms/react/useChattaUnread.d.ts +1 -0
  85. package/dist/platforms/react/useChattaUnread.js +1 -0
  86. package/dist/platforms/react/useChattaUnread.js.map +1 -0
  87. package/dist/platforms/react/useLiveChatta.d.ts +29 -0
  88. package/dist/platforms/react/useLiveChatta.js +1 -0
  89. package/dist/platforms/react/useLiveChatta.js.map +1 -0
  90. package/dist/platforms/react-native/LiveChattaView.d.ts +52 -0
  91. package/dist/platforms/react-native/LiveChattaView.js +1 -0
  92. package/dist/platforms/react-native/LiveChattaView.js.map +1 -0
  93. package/dist/platforms/react-native/useChattaBridge.d.ts +12 -0
  94. package/dist/platforms/react-native/useChattaBridge.js +1 -0
  95. package/dist/platforms/react-native/useChattaBridge.js.map +1 -0
  96. package/dist/platforms/react-native/useLiveChatta.d.ts +29 -0
  97. package/dist/platforms/react-native/useLiveChatta.js +1 -0
  98. package/dist/platforms/react-native/useLiveChatta.js.map +1 -0
  99. package/dist/platforms/svelte/LiveChattaEmbed.d.ts +54 -0
  100. package/dist/platforms/svelte/LiveChattaEmbed.js +1 -0
  101. package/dist/platforms/svelte/LiveChattaEmbed.js.map +1 -0
  102. package/dist/platforms/svelte/chattaBridgeStore.d.ts +19 -0
  103. package/dist/platforms/svelte/chattaBridgeStore.js +1 -0
  104. package/dist/platforms/svelte/chattaBridgeStore.js.map +1 -0
  105. package/dist/platforms/svelte/useLiveChatta.d.ts +61 -0
  106. package/dist/platforms/svelte/useLiveChatta.js +1 -0
  107. package/dist/platforms/svelte/useLiveChatta.js.map +1 -0
  108. package/dist/platforms/tauri/TauriBridge.d.ts +34 -0
  109. package/dist/platforms/tauri/TauriBridge.js +1 -0
  110. package/dist/platforms/tauri/TauriBridge.js.map +1 -0
  111. package/dist/platforms/tauri/TauriDeepLinks.d.ts +29 -0
  112. package/dist/platforms/tauri/TauriDeepLinks.js +1 -0
  113. package/dist/platforms/tauri/TauriDeepLinks.js.map +1 -0
  114. package/dist/platforms/tauri/TauriPermissions.d.ts +21 -0
  115. package/dist/platforms/tauri/TauriPermissions.js +1 -0
  116. package/dist/platforms/tauri/TauriPermissions.js.map +1 -0
  117. package/dist/platforms/tauri/TauriUpdater.d.ts +31 -0
  118. package/dist/platforms/tauri/TauriUpdater.js +1 -0
  119. package/dist/platforms/tauri/TauriUpdater.js.map +1 -0
  120. package/dist/platforms/tauri/index.d.ts +22 -0
  121. package/dist/platforms/tauri/index.js +1 -0
  122. package/dist/platforms/tauri/index.js.map +1 -0
  123. package/dist/platforms/vue/LiveChattaView.d.ts +1 -0
  124. package/dist/platforms/vue/LiveChattaView.js +1 -0
  125. package/dist/platforms/vue/LiveChattaView.js.map +1 -0
  126. package/dist/platforms/vue/useChattaBridge.d.ts +11 -0
  127. package/dist/platforms/vue/useChattaBridge.js +1 -0
  128. package/dist/platforms/vue/useChattaBridge.js.map +1 -0
  129. package/dist/platforms/vue/useChattaDeepLink.d.ts +2 -0
  130. package/dist/platforms/vue/useChattaDeepLink.js +1 -0
  131. package/dist/platforms/vue/useChattaDeepLink.js.map +1 -0
  132. package/dist/platforms/vue/useChattaPermissions.d.ts +9 -0
  133. package/dist/platforms/vue/useChattaPermissions.js +1 -0
  134. package/dist/platforms/vue/useChattaPermissions.js.map +1 -0
  135. package/dist/platforms/vue/useChattaUnread.d.ts +8 -0
  136. package/dist/platforms/vue/useChattaUnread.js +1 -0
  137. package/dist/platforms/vue/useChattaUnread.js.map +1 -0
  138. package/dist/platforms/vue/useLiveChatta.d.ts +58 -0
  139. package/dist/platforms/vue/useLiveChatta.js +1 -0
  140. package/dist/platforms/vue/useLiveChatta.js.map +1 -0
  141. package/dist/platforms/web/LiveChattaEmbed.d.ts +94 -0
  142. package/dist/platforms/web/LiveChattaEmbed.js +1 -0
  143. package/dist/platforms/web/LiveChattaEmbed.js.map +1 -0
  144. package/dist/platforms/web/bridge.d.ts +8 -0
  145. package/dist/platforms/web/bridge.js +1 -0
  146. package/dist/platforms/web/bridge.js.map +1 -0
  147. package/dist/platforms/web/permissions.d.ts +8 -0
  148. package/dist/platforms/web/permissions.js +1 -0
  149. package/dist/platforms/web/permissions.js.map +1 -0
  150. package/dist/types/billing.d.ts +355 -0
  151. package/dist/types/billing.js +53 -0
  152. package/dist/types/billing.js.map +1 -0
  153. package/dist/types/calendar.d.ts +132 -0
  154. package/dist/types/calendar.js +15 -0
  155. package/dist/types/calendar.js.map +1 -0
  156. package/dist/types/chat-core.d.ts +901 -0
  157. package/dist/types/chat-core.js +98 -0
  158. package/dist/types/chat-core.js.map +1 -0
  159. package/dist/types/chat-features.d.ts +775 -0
  160. package/dist/types/chat-features.js +50 -0
  161. package/dist/types/chat-features.js.map +1 -0
  162. package/dist/types/content.d.ts +138 -0
  163. package/dist/types/content.js +2 -0
  164. package/dist/types/content.js.map +1 -0
  165. package/dist/types/core/AutoRefresh.d.ts +68 -0
  166. package/dist/types/core/Bridge.d.ts +124 -0
  167. package/dist/types/core/Config.d.ts +26 -0
  168. package/dist/types/core/DeepLinks.d.ts +38 -0
  169. package/dist/types/core/EventBus.d.ts +15 -0
  170. package/dist/types/core/GrantStore.d.ts +29 -0
  171. package/dist/types/core/LiveChatta.d.ts +128 -0
  172. package/dist/types/core/Permissions.d.ts +34 -0
  173. package/dist/types/core/TokenManager.d.ts +25 -0
  174. package/dist/types/core/events.d.ts +140 -0
  175. package/dist/types/csat.d.ts +110 -0
  176. package/dist/types/csat.js +12 -0
  177. package/dist/types/csat.js.map +1 -0
  178. package/dist/types/events.d.ts +242 -0
  179. package/dist/types/events.js +275 -0
  180. package/dist/types/events.js.map +1 -0
  181. package/dist/types/extras.d.ts +353 -0
  182. package/dist/types/extras.js +31 -0
  183. package/dist/types/extras.js.map +1 -0
  184. package/dist/types/http/HttpAPI.d.ts +944 -0
  185. package/dist/types/http/HttpTransport.d.ts +66 -0
  186. package/dist/types/http/incomingWebhook.d.ts +17 -0
  187. package/dist/types/incoming-webhooks.d.ts +78 -0
  188. package/dist/types/incoming-webhooks.js +16 -0
  189. package/dist/types/incoming-webhooks.js.map +1 -0
  190. package/dist/types/index.d.ts +15 -0
  191. package/dist/types/index.js +16 -0
  192. package/dist/types/index.js.map +1 -0
  193. package/dist/types/liveflex.d.ts +578 -0
  194. package/dist/types/liveflex.js +7 -0
  195. package/dist/types/liveflex.js.map +1 -0
  196. package/dist/types/models.d.ts +1753 -0
  197. package/dist/types/models.js +148 -0
  198. package/dist/types/models.js.map +1 -0
  199. package/dist/types/options.d.ts +190 -0
  200. package/dist/types/options.js +43 -0
  201. package/dist/types/options.js.map +1 -0
  202. package/dist/types/shared-channels.d.ts +236 -0
  203. package/dist/types/shared-channels.js +50 -0
  204. package/dist/types/shared-channels.js.map +1 -0
  205. package/dist/types/socket/SocketAPI.d.ts +1026 -0
  206. package/dist/types/socket/SocketTransport.d.ts +44 -0
  207. package/dist/types/types/billing.d.ts +355 -0
  208. package/dist/types/types/calendar.d.ts +132 -0
  209. package/dist/types/types/chat-core.d.ts +901 -0
  210. package/dist/types/types/chat-features.d.ts +775 -0
  211. package/dist/types/types/content.d.ts +138 -0
  212. package/dist/types/types/csat.d.ts +110 -0
  213. package/dist/types/types/events.d.ts +242 -0
  214. package/dist/types/types/extras.d.ts +353 -0
  215. package/dist/types/types/incoming-webhooks.d.ts +78 -0
  216. package/dist/types/types/index.d.ts +15 -0
  217. package/dist/types/types/liveflex.d.ts +578 -0
  218. package/dist/types/types/models.d.ts +1753 -0
  219. package/dist/types/types/options.d.ts +190 -0
  220. package/dist/types/types/shared-channels.d.ts +236 -0
  221. package/dist/types/types/workspace-gifs.d.ts +95 -0
  222. package/dist/types/types/workspace.d.ts +390 -0
  223. package/dist/types/ui/EmbedConfig.d.ts +38 -0
  224. package/dist/types/ui/EmbedUI.d.ts +44 -0
  225. package/dist/types/ui/Launcher.d.ts +122 -0
  226. package/dist/types/ui/brand.d.ts +27 -0
  227. package/dist/types/ui/embedMessages.d.ts +23 -0
  228. package/dist/types/ui/hours.d.ts +35 -0
  229. package/dist/types/ui/prechat.d.ts +35 -0
  230. package/dist/types/ui/widgetConfig.d.ts +4 -0
  231. package/dist/types/utils/crypto.d.ts +6 -0
  232. package/dist/types/utils/hmac.d.ts +40 -0
  233. package/dist/types/utils/permissions.d.ts +5 -0
  234. package/dist/types/utils/platform.d.ts +18 -0
  235. package/dist/types/utils/visitor.d.ts +2 -0
  236. package/dist/types/workspace-gifs.d.ts +95 -0
  237. package/dist/types/workspace-gifs.js +3 -0
  238. package/dist/types/workspace-gifs.js.map +1 -0
  239. package/dist/types/workspace.d.ts +390 -0
  240. package/dist/types/workspace.js +13 -0
  241. package/dist/types/workspace.js.map +1 -0
  242. package/dist/umd/livechatta.umd.js +7262 -0
  243. package/dist/umd/livechatta.umd.js.map +1 -0
  244. package/dist/umd/livechatta.umd.min.js +2 -0
  245. package/dist/umd/livechatta.umd.min.js.map +1 -0
  246. package/package.json +278 -4
@@ -0,0 +1,1753 @@
1
+ import type { PreChatForm } from '../ui/prechat';
2
+ import type { BusinessHours } from '../ui/hours';
3
+ import type { ThreadParticipant, MessageGift, PreChatSubmission, MemberLinkAccess, ConversationMode, ConversationAudience, SidebarUnreadTotals } from './chat-core';
4
+ import type { MessageVisibility, SentFrom, ConversationTopic, ChatUserPreferencesPayload } from './chat-features';
5
+ import type { OwnerFlags } from './extras';
6
+ import type { MessagePeerGift, HopMeetingCard } from './workspace';
7
+ import type { MessageGif } from './workspace-gifs';
8
+ import type { SharedWith } from './shared-channels';
9
+ import type { MessageCsatCard } from './csat';
10
+ export declare enum ChatConversationType {
11
+ SINGLE = "SINGLE",
12
+ GROUP = "GROUP",
13
+ CHANNEL = "CHANNEL",
14
+ SELF = "SELF"
15
+ }
16
+ export declare enum ChatMessageStatus {
17
+ SENT = "SENT",
18
+ DELIVERED = "DELIVERED",
19
+ READ = "READ",
20
+ DELETED = "DELETED",
21
+ SCHEDULED = "SCHEDULED"
22
+ }
23
+ export declare enum ChatMessageType {
24
+ SYSTEM = "SYSTEM",
25
+ USER = "USER",
26
+ ADMIN = "ADMIN"
27
+ }
28
+ export declare enum ChatMessageKind {
29
+ PARENT = "PARENT",
30
+ THREAD = "THREAD",
31
+ POLL = "POLL",
32
+ STICKER = "STICKER",
33
+ /** A GIF from search or the default pack; see `gif`. */
34
+ GIF = "GIF",
35
+ HOP_SYSTEM = "HOP_SYSTEM",
36
+ /** Carries the call recording (HLS) as an attachment. */
37
+ HOP_RECORDING = "HOP_RECORDING",
38
+ HOP_VOTE = "HOP_VOTE",
39
+ /** Scheduled-meeting card in the meeting's "Where" channel; see `hopMeeting`. */
40
+ HOP_MEETING = "HOP_MEETING",
41
+ /** Support satisfaction card after a resolve (SYSTEM message); see `csat`. */
42
+ CSAT = "CSAT"
43
+ }
44
+ /** Send a link-pack sticker by item id or shortcode (no `message` text); the server resolves the URL. */
45
+ export interface StickerRef {
46
+ id?: string;
47
+ shortcode?: string;
48
+ }
49
+ /** Server-resolved sticker on a STICKER message (also mirrored as a `sticker:<shortcode>` PHOTO attachment). */
50
+ export interface MessageSticker {
51
+ id: string;
52
+ shortcode: string;
53
+ url: string;
54
+ width: number;
55
+ height: number;
56
+ animated: boolean;
57
+ }
58
+ /** On a message an incoming webhook posted (chatta): the hook that sent it and the name and picture to show for that post. */
59
+ export interface MessageViaWebhook {
60
+ hookId: string;
61
+ name: string;
62
+ /** https picture; empty when the hook has none. */
63
+ iconUrl: string;
64
+ }
65
+ export declare enum UserStatus {
66
+ ACTIVE = "ACTIVE",
67
+ DISABLE = "DISABLE",
68
+ DEACTIVATE = "DEACTIVATE",
69
+ BLOCKED = "BLOCKED",
70
+ LEAVE = "LEAVE",
71
+ FULLY_CLOSED = "FULLY_CLOSED"
72
+ }
73
+ export declare enum UserConversationRole {
74
+ SUPER_ADMIN = "SUPER_ADMIN",
75
+ ADMIN = "ADMIN",
76
+ MODERATOR = "MODERATOR",
77
+ MEMBER = "MEMBER"
78
+ }
79
+ /**
80
+ * Valid status values for `changeMessageStatus()`.
81
+ * Admins and moderators can use DELETE on any message;
82
+ * regular members can only DELETE their own messages.
83
+ */
84
+ export declare enum MessageChangeStatus {
85
+ DELETE = "DELETE",
86
+ PIN = "PIN",
87
+ UNPIN = "UNPIN",
88
+ STARRED = "STARRED",
89
+ UNSTARRED = "UNSTARRED"
90
+ }
91
+ /**
92
+ * Permissions granted to users with `MODERATOR` role.
93
+ * Moderators can perform these actions without being a conversation admin.
94
+ */
95
+ export declare const ModeratorPermissions: readonly ["pin_message", "delete_message", "mute_member"];
96
+ export type ModeratorPermission = typeof ModeratorPermissions[number];
97
+ export declare enum ConnectionState {
98
+ DISCONNECTED = "DISCONNECTED",
99
+ CONNECTING = "CONNECTING",
100
+ CONNECTED = "CONNECTED",
101
+ RECONNECTING = "RECONNECTING"
102
+ }
103
+ /**
104
+ * Attachment kind — mirrors the backend `DocType` enum. The server routes
105
+ * uploads to the correct Bunny CDN folder based on this value.
106
+ */
107
+ export declare enum AttachmentType {
108
+ PHOTO = "PHOTO",
109
+ VIDEO = "VIDEO",
110
+ AUDIO = "AUDIO",
111
+ WORD = "WORD",
112
+ PDF = "PDF",
113
+ EXCEL = "EXCEL",
114
+ ZIP = "ZIP",
115
+ OTHER = "OTHER"
116
+ }
117
+ /**
118
+ * Attachment as returned by the backend on a message/post. Mirrors the
119
+ * backend `DocLinkType` shape: `link` holds the CDN URL after upload,
120
+ * `name` is the display name, `type` is the {@link AttachmentType}.
121
+ */
122
+ export interface Attachment {
123
+ name: string;
124
+ link: string;
125
+ type?: AttachmentType;
126
+ updatedAt?: string;
127
+ }
128
+ /**
129
+ * Attachment payload (backend `DocLinkType`): `name`, `link` (base64 data URI or URL to upload)
130
+ * and `type` are all required (`uploadAttachments` throws without `type`). */
131
+ export interface AttachmentInput {
132
+ name: string;
133
+ link: string;
134
+ type: AttachmentType;
135
+ }
136
+ export interface Member {
137
+ _id: string;
138
+ firstName: string;
139
+ lastName: string;
140
+ username: string;
141
+ displayName?: string;
142
+ handle?: string;
143
+ profilePhoto?: string;
144
+ photo?: string;
145
+ status: UserStatus;
146
+ isChattingOnline?: boolean;
147
+ caption?: string;
148
+ /** Custom status note set via /status (1.6.4). */
149
+ statusText?: string;
150
+ statusEmoji?: string;
151
+ statusAway?: boolean;
152
+ lastActive?: string;
153
+ isSystemBot?: boolean;
154
+ }
155
+ /** GET /chat-users/me: the signed-in chat user. */
156
+ export interface ChatUserMe extends Member {
157
+ /** True when an active business account shares this chat user's email (offer the Business dashboard). */
158
+ hasBusinessAccount?: boolean;
159
+ /** Feature flags of your link owner (hide what is switched off, e.g. `hop_calls`). */
160
+ flags?: OwnerFlags;
161
+ }
162
+ export interface Conversation {
163
+ _id: string;
164
+ name?: string;
165
+ handle?: string;
166
+ caption?: string;
167
+ profilePhoto?: string;
168
+ type: ChatConversationType;
169
+ status: UserStatus;
170
+ isLocked?: boolean;
171
+ isPinned?: boolean;
172
+ isArchived?: boolean;
173
+ isStarred?: boolean;
174
+ /** New groups are private (not listed, no self-join) unless created public; channels default public. */
175
+ isPrivate?: boolean;
176
+ disappearAfter?: number | null;
177
+ chatLink?: {
178
+ _id: string;
179
+ code: string;
180
+ name: string;
181
+ };
182
+ admins?: string[];
183
+ totalMembers?: number;
184
+ /** Join-card topic the customer picked (support inbox). */
185
+ topic?: ConversationTopic | null;
186
+ /** Widget pre-chat answers. */
187
+ preChat?: PreChatSubmission | null;
188
+ /** Conversation mode (absent = standard). */
189
+ mode?: ConversationMode | null;
190
+ /** Sidebar section on community links, e.g. "Text" / "Voice". */
191
+ category?: string | null;
192
+ /** `followers`: a creator's followers-only room (follow adds you, unfollow leaves you). */
193
+ audience?: ConversationAudience;
194
+ /** Shared with other workspaces (names only); an entry with `ended` marks a partner's read-only archive. */
195
+ sharedWith?: SharedWith[];
196
+ createdAt: string;
197
+ updatedAt: string;
198
+ }
199
+ /** One read / delivered receipt on a message. */
200
+ export interface MessageReceipt {
201
+ userId: string;
202
+ readAt?: string;
203
+ deliveredAt?: string;
204
+ }
205
+ export interface Message {
206
+ _id?: string;
207
+ referenceId: string;
208
+ conversationId?: string;
209
+ conversation?: string;
210
+ /** Present when the message is returned with a populated sender (`sender`). */
211
+ senderId?: string;
212
+ sender?: Member;
213
+ message?: string;
214
+ attachments?: Attachment[];
215
+ type: ChatMessageType;
216
+ /** Delivery status — backend field is `messageStatus` (SENT/DELIVERED/READ…). */
217
+ messageStatus?: ChatMessageStatus;
218
+ status?: UserStatus;
219
+ isPinned?: boolean;
220
+ isStarred?: boolean;
221
+ isEdited?: boolean;
222
+ editedAt?: string;
223
+ isScheduled?: boolean;
224
+ scheduledAt?: string;
225
+ codeLang?: string;
226
+ messageKind?: ChatMessageKind;
227
+ /** Parent message id on a thread reply — backend field is `parentMessage`. */
228
+ parentMessage?: string;
229
+ poll?: Poll;
230
+ /** 1.6.6: tappable quick-reply options shown under the message (P-N8). */
231
+ quickReplies?: string[];
232
+ /** Set when `messageKind` is STICKER (or a THREAD reply carrying a sticker). */
233
+ sticker?: MessageSticker;
234
+ /** Set when `messageKind` is GIF. */
235
+ gif?: MessageGif;
236
+ threadCount?: number;
237
+ isBookmarked?: boolean;
238
+ forwardedFrom?: {
239
+ messageId: string;
240
+ conversationName?: string;
241
+ senderName?: string;
242
+ };
243
+ replyTo?: {
244
+ messageId: string;
245
+ text?: string;
246
+ senderName?: string;
247
+ };
248
+ reactions?: {
249
+ emoji: string;
250
+ user: string;
251
+ userId: string;
252
+ createdAt: string;
253
+ }[];
254
+ reactionCount?: number;
255
+ /** Last distinct thread repliers (newest first, max 3) on a thread parent. */
256
+ threadParticipants?: ThreadParticipant[];
257
+ lastThreadReplyAt?: string | null;
258
+ /** 'internal' = agent-only note (never sent to customers). */
259
+ visibility?: MessageVisibility;
260
+ /** 1.6.10 (P-N13): the device class it was sent from, set by the server (API-key sends are `api`); absent on older messages. */
261
+ sentFrom?: SentFrom;
262
+ /** Set when deleted for everyone; render "This message was deleted". */
263
+ deletedForEveryoneAt?: string | null;
264
+ deletedBy?: string | null;
265
+ /** Server-written after a verified gift checkout. */
266
+ gift?: MessageGift;
267
+ /** Person-to-person gift shared on this message (server-set). */
268
+ peerGift?: MessagePeerGift;
269
+ /** HOP_MEETING card. */
270
+ hopMeeting?: HopMeetingCard;
271
+ /** CSAT card: the customer rates it once with `submitCsat`; `csat-updated` changes it. */
272
+ csat?: MessageCsatCard;
273
+ /** Full lists by default; with `compactReceipts: '1'` only the viewer's own entry. */
274
+ readBy?: MessageReceipt[];
275
+ deliveredTo?: MessageReceipt[];
276
+ /** Totals, present with `compactReceipts: '1'` (DB-10); `getMessageInfo` keeps the full lists. */
277
+ readCount?: number;
278
+ deliveredCount?: number;
279
+ clientDate: string;
280
+ createdAt: string;
281
+ updatedAt: string;
282
+ /** Set on a message an incoming webhook posted: show `name` and `iconUrl` instead of the sender's (the app user). */
283
+ viaWebhook?: MessageViaWebhook;
284
+ }
285
+ export interface ConversationUser {
286
+ _id: string;
287
+ member: Member;
288
+ conversation: Conversation;
289
+ role: UserConversationRole;
290
+ status: UserStatus;
291
+ unreadCount: number;
292
+ isPinned?: boolean;
293
+ isArchived?: boolean;
294
+ isStarred?: boolean;
295
+ isBlocked?: boolean;
296
+ }
297
+ export interface PaginatedResult<T> {
298
+ results: T[];
299
+ /** Backend `cursorPaginate` always returns this key; the value is `null`
300
+ * (not absent) when there is no further page. */
301
+ nextCursor?: string | null;
302
+ prevCursor?: string | null;
303
+ hasMore: boolean;
304
+ /** Present on every backend `cursorPaginate` envelope. */
305
+ hasPrev?: boolean;
306
+ }
307
+ /** Full cursor-pagination envelope — includes `hasPrev` for bidirectional navigation. */
308
+ export interface CursorPage<T> {
309
+ results: T[];
310
+ nextCursor: string | null;
311
+ prevCursor: string | null;
312
+ hasMore: boolean;
313
+ hasPrev: boolean;
314
+ }
315
+ /**
316
+ * Envelope from `getMemberConversations` / `getConversationUsers`: results live at `.main.results`;
317
+ * `other` / `conversation` are filled only when a search term is supplied, else null. */
318
+ export interface ConversationUsersPage {
319
+ main: PaginatedResult<ConversationUser>;
320
+ other: PaginatedResult<Member> | null;
321
+ conversation: PaginatedResult<Conversation> | null;
322
+ }
323
+ /**
324
+ * Response echoed back by the message status-change endpoints (delete / cancel).
325
+ * The backend `changeMessageStatus` returns the mutation payload, not a
326
+ * `{ status: boolean }` envelope.
327
+ */
328
+ export interface MessageMutationResult {
329
+ messageId: string;
330
+ conversationId: string;
331
+ status: string;
332
+ memberId?: string;
333
+ isPinned?: boolean;
334
+ pinnedBy?: string | null;
335
+ pinnedAt?: string | null;
336
+ }
337
+ /**
338
+ * Envelope returned by the socket `all-conversations` event. The primary page
339
+ * lives under `conversations`; `othersSuggested`/`conversationsSuggested` are
340
+ * only populated on search and are otherwise `null`.
341
+ */
342
+ export interface SocketConversationsResult {
343
+ memberId: string;
344
+ member: Member;
345
+ conversations: PaginatedResult<ConversationUser>;
346
+ othersSuggested: PaginatedResult<Member> | null;
347
+ conversationsSuggested: PaginatedResult<Conversation> | null;
348
+ /** Unfiltered first page only (no cursor/search): 'blocked' means show the blocked-member state. */
349
+ linkAccess?: MemberLinkAccess;
350
+ /** First All-lane page only (no cursor, search, type filter or lookup): unread over the whole list (chatta #427). */
351
+ unreadTotals?: SidebarUnreadTotals;
352
+ }
353
+ export interface ChatError {
354
+ statusCode: number;
355
+ message: string;
356
+ timestamp: string;
357
+ /** UPPER_SNAKE machine code on some client errors (e.g. `LINK_MEMBER_BLOCKED`). */
358
+ code?: string;
359
+ }
360
+ export interface NewConversationEvent {
361
+ senderId: string;
362
+ conversationId: string;
363
+ participantIds?: string[];
364
+ memberId: string;
365
+ member: Member;
366
+ conversation?: Conversation;
367
+ }
368
+ export interface EditConversationEvent {
369
+ memberId: string;
370
+ conversationId: string;
371
+ conversation: Conversation;
372
+ }
373
+ export interface MakeAdminConversationEvent {
374
+ conversation: Conversation;
375
+ memberId: string;
376
+ member: Member;
377
+ }
378
+ export interface MemberStatusEvent {
379
+ conversationId: string;
380
+ memberId: string;
381
+ status: UserStatus;
382
+ }
383
+ export interface MessageStatusEvent {
384
+ conversationId: string;
385
+ memberId: string;
386
+ messageId: string;
387
+ status: MessageChangeStatus | string;
388
+ isPinned?: boolean;
389
+ pinnedBy?: string;
390
+ pinnedAt?: string;
391
+ isStarred?: boolean;
392
+ starredBy?: {
393
+ user: string;
394
+ createdAt: string;
395
+ }[];
396
+ }
397
+ export interface MessageReactionEvent {
398
+ messageId: string;
399
+ conversationId: string;
400
+ emoji: string;
401
+ userId: string;
402
+ user: Member;
403
+ action: 'added' | 'removed';
404
+ }
405
+ export interface TypingEvent {
406
+ memberId: string;
407
+ member: Member;
408
+ conversationId: string;
409
+ message: string;
410
+ isTyping: boolean;
411
+ }
412
+ export interface SaveDraftPayload {
413
+ conversationId: string;
414
+ /** Unsent composer text; empty clears the draft. */
415
+ text: string;
416
+ }
417
+ export interface DraftView {
418
+ conversationId: string;
419
+ text: string;
420
+ at: number;
421
+ }
422
+ /** Broadcast to all of a member's devices when a draft changes (1.6.1). */
423
+ export interface DraftUpdatedEvent {
424
+ conversationId: string;
425
+ text: string;
426
+ at: number;
427
+ }
428
+ export interface SetChatStatusPayload {
429
+ /** Status note; empty + away=false clears it. */
430
+ text?: string;
431
+ emoji?: string;
432
+ away?: boolean;
433
+ }
434
+ /** Ack of setChatStatus and the live STATUS_UPDATED broadcast (1.6.4). */
435
+ export interface ChatStatusEvent {
436
+ userId?: string;
437
+ statusText: string;
438
+ statusEmoji: string;
439
+ statusAway: boolean;
440
+ }
441
+ export interface OnlineEvent {
442
+ memberId: string;
443
+ member: Member;
444
+ conversationId: string;
445
+ unreadCount: number;
446
+ }
447
+ export interface OfflineEvent {
448
+ memberId: string;
449
+ member: Member;
450
+ }
451
+ export interface UnreadCountUpdate {
452
+ conversationId: string;
453
+ /** Skip the unread bump when this is you (your own message on another device). */
454
+ senderId?: string;
455
+ lastMessageText: string;
456
+ lastMessageSenderName: string;
457
+ lastMessageAt: string;
458
+ }
459
+ export interface NotificationData {
460
+ [key: string]: string | number | boolean | undefined;
461
+ }
462
+ export interface NotificationEvent {
463
+ _id: string;
464
+ type: string;
465
+ title: string;
466
+ body: string;
467
+ data?: NotificationData;
468
+ createdAt: string;
469
+ }
470
+ export interface ValidatePasswordPayload {
471
+ password: string;
472
+ }
473
+ /** `forgot-password` / `POST chat-users/forgot-password`. `chatLinkCode` is required since chatta #413 (else nothing is sent). */
474
+ export interface ForgotPasswordPayload {
475
+ /** Email or handle (≤ 320 chars). */
476
+ identifier: string;
477
+ /** The chat space the account belongs to (chat accounts are per link owner). */
478
+ chatLinkCode: string;
479
+ }
480
+ /** `reset-password` on every door: the 8-character emailed code (spaces / dashes ignored) and the new password twice. */
481
+ export interface ResetPasswordPayload {
482
+ token: string;
483
+ /** 8–200 chars (`PASSWORD_MIN_LENGTH` / `PASSWORD_MAX_LENGTH`). */
484
+ newPassword: string;
485
+ /** Must equal `newPassword`; else 400 `New password and confirm password do not match.` */
486
+ confirmPassword: string;
487
+ }
488
+ export declare const PASSWORD_MIN_LENGTH = 8;
489
+ export declare const PASSWORD_MAX_LENGTH = 200;
490
+ /** Same checks the server runs before using the code; null when the pair is fine. */
491
+ export declare function newPasswordProblem(newPassword: string, confirmPassword: string): 'too-short' | 'too-long' | 'mismatch' | null;
492
+ /** Which login door a reset belongs to. */
493
+ export type ResetAudience = 'business' | 'admin' | 'chat';
494
+ /** Reply of every reset (`/users`, `/chat-users`, `/in/:code` and socket `reset-password`). */
495
+ export interface ResetPasswordResult {
496
+ status: true;
497
+ message: string;
498
+ audience: ResetAudience;
499
+ /** Where the "Log in" button goes (business, admin or the link's chat sign-in). */
500
+ loginUrl: string;
501
+ /** How many signed-in sessions were signed out. */
502
+ signedOut: number;
503
+ }
504
+ /** Generic forgot-password answer (same whether or not the account exists). */
505
+ export interface ForgotPasswordResult {
506
+ status: true;
507
+ message: string;
508
+ }
509
+ /** `GET users/reset-password/status?token=`: lets a reset page say expired / used before the form. */
510
+ export interface ResetTokenStatus {
511
+ state: 'valid' | 'used' | 'expired' | 'invalid';
512
+ audience?: ResetAudience;
513
+ /** 'set' = first password for an account made on someone's behalf. */
514
+ purpose?: 'reset' | 'set';
515
+ linkCode?: string;
516
+ /** Masked, valid codes only. */
517
+ email?: string;
518
+ }
519
+ export interface ChangePasswordPayload {
520
+ oldPassword: string;
521
+ newPassword: string;
522
+ }
523
+ export interface RefreshTokenPayload {
524
+ refreshToken: string;
525
+ }
526
+ export interface RevokeTokenPayload {
527
+ revokeToken: string;
528
+ /** This browser's web push token; the server releases it for this person (max 4096 characters). */
529
+ webToken?: string;
530
+ }
531
+ export interface StatusResponse {
532
+ status: boolean;
533
+ }
534
+ /** Envelope returned by backend delete endpoints (`{ success: true }`). */
535
+ export interface SuccessResponse {
536
+ success: boolean;
537
+ }
538
+ export interface EmbedTokenPayload {
539
+ apiKey: string;
540
+ linkCode: string;
541
+ chatUsername?: string;
542
+ }
543
+ export interface HttpHeaders {
544
+ [header: string]: string;
545
+ }
546
+ export interface HttpRequestOptions {
547
+ body?: unknown;
548
+ query?: QueryParams;
549
+ /** URL root: 'external' (default) = /api/v1/external, 'api' = /api/v1, 'root' = server root. */
550
+ base?: 'external' | 'api' | 'root';
551
+ /**
552
+ * 'apiKey' (default) = x-api-key; 'owner' / 'member' = that Bearer token; 'user' = member token,
553
+ * else owner token (routes open to both); 'none' = public route. */
554
+ auth?: 'apiKey' | 'owner' | 'member' | 'user' | 'none';
555
+ /** Skip 5xx retries for non-idempotent calls (e.g. click counters). */
556
+ noRetry?: boolean;
557
+ /** Extra request headers (e.g. `X-Recording-Token`); auth headers always win. */
558
+ headers?: HttpHeaders;
559
+ }
560
+ export interface QueryParams {
561
+ [key: string]: string | number | boolean | undefined;
562
+ }
563
+ export interface InviteNewParticipant {
564
+ displayName: string;
565
+ email: string;
566
+ country?: string;
567
+ phone?: string;
568
+ }
569
+ export interface ReplyToPayload {
570
+ messageId: string;
571
+ senderName: string;
572
+ text: string;
573
+ }
574
+ export interface SocketQueryParams {
575
+ linkCode: string;
576
+ token?: string;
577
+ apiKey?: string;
578
+ chatUsername?: string;
579
+ chatLinkCode?: string;
580
+ }
581
+ export interface AuthTokenResponse {
582
+ accessToken: string;
583
+ refreshToken: string;
584
+ user: Member;
585
+ chatLink?: {
586
+ _id: string;
587
+ code: string;
588
+ name: string;
589
+ };
590
+ }
591
+ export interface JoinConversationEvent {
592
+ conversation: Conversation;
593
+ conversationId: string;
594
+ participantIds: string[];
595
+ senderId: string;
596
+ memberId: string;
597
+ member: Member;
598
+ }
599
+ export interface EditMessageEvent {
600
+ conversationId: string;
601
+ messageId: string;
602
+ message: string;
603
+ senderId: string;
604
+ editedAt: string;
605
+ /** true: a pending scheduled message; only the sender's other devices get this event. */
606
+ isScheduled?: boolean;
607
+ }
608
+ export interface ForwardMessageEvent {
609
+ conversationId: string;
610
+ message: Message;
611
+ forwardedFrom: {
612
+ conversationId: string;
613
+ messageId: string;
614
+ senderName?: string;
615
+ };
616
+ }
617
+ export interface ForwardPostPayload {
618
+ postId: string;
619
+ toConversationId: string;
620
+ senderId: string;
621
+ }
622
+ export interface ForwardPostEvent {
623
+ conversationId: string;
624
+ message: Message;
625
+ }
626
+ export interface MessageFailedEvent {
627
+ referenceId: string;
628
+ conversationId: string;
629
+ error: string;
630
+ }
631
+ export interface MarkMessagesReadPayload {
632
+ conversationId: string;
633
+ messageIds: string[];
634
+ }
635
+ export interface MessageReadEvent {
636
+ conversationId: string;
637
+ messageIds: string[];
638
+ readBy: string;
639
+ readAt: string;
640
+ }
641
+ export interface SearchMessagesPayload {
642
+ conversationId: string;
643
+ query: string;
644
+ }
645
+ export interface SearchMessagesResult {
646
+ results: Message[];
647
+ }
648
+ export interface ScheduledMessageEvent {
649
+ referenceId: string;
650
+ conversationId: string;
651
+ scheduledAt: string;
652
+ message: string;
653
+ }
654
+ export interface SearchChatUsersPayload {
655
+ chatUserSearch: string;
656
+ limit?: string;
657
+ }
658
+ export interface SearchChatUsersResult {
659
+ results: Member[];
660
+ }
661
+ export interface PollOption {
662
+ text: string;
663
+ /** Anonymous polls: only your own id (if you voted) or []. */
664
+ votes: string[];
665
+ /** Anonymous polls: the option's vote count. */
666
+ count?: number;
667
+ }
668
+ export interface Poll {
669
+ question: string;
670
+ options: PollOption[];
671
+ multiSelect: boolean;
672
+ /** Members see counts only, never who voted. */
673
+ anonymous?: boolean;
674
+ expiresAt: string | null;
675
+ voteCount: number;
676
+ }
677
+ export interface ThreadMessagesPayload {
678
+ parentMessageId: string;
679
+ conversationId: string;
680
+ }
681
+ export interface ThreadMessagesResult {
682
+ parentMessageId: string;
683
+ conversationId: string;
684
+ messages: Message[];
685
+ }
686
+ export interface ThreadUpdateEvent {
687
+ type: 'thread_update';
688
+ parentMessageId: string;
689
+ conversationId: string;
690
+ /** The fresh replier, to update the avatar stack without a refetch. */
691
+ replier?: ThreadParticipant;
692
+ /** REST-sent replies carry the reply itself. */
693
+ message?: Message;
694
+ }
695
+ export interface ToggleBookmarkPayload {
696
+ conversationId: string;
697
+ messageId: string;
698
+ }
699
+ export interface ToggleBookmarkResult {
700
+ messageId: string;
701
+ conversationId: string;
702
+ memberId: string;
703
+ action: 'added' | 'removed';
704
+ }
705
+ export interface GetBookmarksPayload {
706
+ conversationId: string;
707
+ }
708
+ export interface GetBookmarksResult {
709
+ conversationId: string;
710
+ bookmarks: string[];
711
+ }
712
+ /** `get-all-bookmarks`: cursor = last message id of the previous page; limit 1–30 (default 15). */
713
+ export interface GetAllBookmarksPayload {
714
+ cursor?: string;
715
+ limit?: number;
716
+ }
717
+ export interface BookmarkedMessage {
718
+ _id: string;
719
+ message?: string;
720
+ attachments?: unknown[];
721
+ createdAt: string;
722
+ clientDate?: string;
723
+ conversation: string;
724
+ sender?: {
725
+ _id: string;
726
+ displayName?: string;
727
+ handle?: string;
728
+ firstName?: string;
729
+ username?: string;
730
+ isSystemBot?: boolean;
731
+ };
732
+ }
733
+ export interface GetAllBookmarksResult {
734
+ messages: BookmarkedMessage[];
735
+ nextCursor: string | null;
736
+ }
737
+ /** Revocation statuses the gateway reports (kick, ban, leave, delete, close). */
738
+ export type MembershipRevokedStatus = 'DISABLE' | 'FULLY_CLOSED' | 'BLOCKED' | 'DELETE' | 'LEAVE';
739
+ export interface MembershipRevokedEvent {
740
+ conversationId: string;
741
+ memberId: string;
742
+ status: MembershipRevokedStatus;
743
+ /** `lobby-ended`: the call ended while you waited to be let in; you may ask to join again (`joinMeetingByLink`). */
744
+ reason?: 'lobby-ended';
745
+ }
746
+ export interface VotePollPayload {
747
+ conversationId: string;
748
+ messageId: string;
749
+ optionIndex: number;
750
+ }
751
+ export interface VotePollResult {
752
+ messageId: string;
753
+ conversationId: string;
754
+ poll: Poll;
755
+ action: 'added' | 'removed';
756
+ }
757
+ /** Saved-reply category (dashboard chips). */
758
+ export type CannedCategory = 'GREETINGS' | 'CLOSINGS' | 'SUPPORT' | 'SALES' | 'TECHNICAL' | 'GENERAL' | 'ONBOARDING' | 'BILLING';
759
+ /** Body may hold {{first_name}}, {{link_name}}, {{agent_name}}; status DISABLE = draft. */
760
+ export interface CannedResponse {
761
+ _id: string;
762
+ title: string;
763
+ body: string;
764
+ shortcut?: string;
765
+ status?: string;
766
+ category?: CannedCategory;
767
+ usedCount?: number;
768
+ createdAt?: string;
769
+ updatedAt?: string;
770
+ }
771
+ export interface CreateCannedResponsePayload {
772
+ title: string;
773
+ body: string;
774
+ shortcut?: string;
775
+ category?: CannedCategory;
776
+ status?: 'ACTIVE' | 'DISABLE';
777
+ }
778
+ export interface UpdateCannedResponsePayload {
779
+ title?: string;
780
+ body?: string;
781
+ shortcut?: string;
782
+ category?: CannedCategory;
783
+ status?: 'ACTIVE' | 'DISABLE';
784
+ }
785
+ export declare enum PostType {
786
+ STORY = "STORY",
787
+ POST = "POST",
788
+ PROMOTION = "PROMOTION"
789
+ }
790
+ export interface PostReply {
791
+ member: Member;
792
+ message: string;
793
+ createdAt: string;
794
+ }
795
+ export interface PostReaction {
796
+ emoji: string;
797
+ userId: string;
798
+ createdAt: string;
799
+ }
800
+ export interface Post {
801
+ _id: string;
802
+ type: PostType;
803
+ content?: string;
804
+ caption?: string;
805
+ attachments?: Attachment[];
806
+ memberId: string;
807
+ member?: Member;
808
+ owner: string;
809
+ reactions?: PostReaction[];
810
+ replies?: PostReply[];
811
+ views?: string[];
812
+ viewCount?: number;
813
+ replyCount?: number;
814
+ expiresAt?: string;
815
+ ctaLabel?: string;
816
+ ctaUrl?: string;
817
+ /** Backend CTA object (PROMOTION). */
818
+ cta?: {
819
+ label: string;
820
+ url: string;
821
+ };
822
+ /** DRAFT | SCHEDULED | ACTIVE | ARCHIVED | DELETED */
823
+ status?: string;
824
+ /** Go-live time of a SCHEDULED post. */
825
+ scheduledAt?: string | null;
826
+ /** Set when the post goes live. */
827
+ publishedAt?: string | null;
828
+ /** Lifetime promo impressions / CTA clicks / unique CTA clicks. */
829
+ impressionCount?: number;
830
+ ctaClickCount?: number;
831
+ ctaUniqueClickCount?: number;
832
+ /** False: only the author can reply. */
833
+ allowReplies?: boolean;
834
+ /** Text story background; null = default ink. */
835
+ background?: StoryBackground | null;
836
+ createdAt: string;
837
+ updatedAt: string;
838
+ }
839
+ export declare const STORY_BACKGROUNDS: readonly ["ink", "brand", "lagoon", "sun"];
840
+ export type StoryBackground = (typeof STORY_BACKGROUNDS)[number];
841
+ /** Error when replying to a post whose author turned replies off. */
842
+ export declare const POST_REPLIES_OFF_MESSAGE = "Replies are turned off for this post.";
843
+ export interface CreatePostPayload {
844
+ type: PostType;
845
+ content?: string;
846
+ caption?: string;
847
+ attachments?: AttachmentInput[];
848
+ memberId: string;
849
+ /** @deprecated The backend reads `cta`; kept for compatibility. */
850
+ ctaLabel?: string;
851
+ /** @deprecated The backend reads `cta`; kept for compatibility. */
852
+ ctaUrl?: string;
853
+ /** PROMOTION call to action (backend `CreatePostDto.cta`). */
854
+ cta?: {
855
+ label: string;
856
+ url: string;
857
+ };
858
+ expiresAt?: string;
859
+ /** Default true; false = only the author can reply. */
860
+ allowReplies?: boolean;
861
+ /** STORY only. */
862
+ background?: StoryBackground;
863
+ /** FOLLOWERS: only your followers in this link see it. */
864
+ visibility?: 'LINK_MEMBERS' | 'PUBLIC' | 'FOLLOWERS';
865
+ }
866
+ export interface GetPostsPayload {
867
+ nextCursor?: string;
868
+ limit?: string;
869
+ type?: PostType;
870
+ }
871
+ export interface ViewPostPayload {
872
+ postId: string;
873
+ memberId: string;
874
+ }
875
+ export interface ReactToPostPayload {
876
+ postId: string;
877
+ emoji: string;
878
+ memberId: string;
879
+ }
880
+ export interface ReplyToPostPayload {
881
+ postId: string;
882
+ message: string;
883
+ attachments?: AttachmentInput[];
884
+ memberId: string;
885
+ }
886
+ export interface UpdatePostPayload {
887
+ postId: string;
888
+ content?: string;
889
+ caption?: string;
890
+ attachments?: AttachmentInput[];
891
+ }
892
+ export interface DeletePostPayload {
893
+ postId: string;
894
+ }
895
+ export interface PostsResult {
896
+ results: Post[];
897
+ /** Backend `cursorPaginate` always returns this key; the value is `null`
898
+ * (not absent) when there is no further page. */
899
+ nextCursor?: string | null;
900
+ hasMore: boolean;
901
+ }
902
+ export interface GetPostMessagesPayload {
903
+ postId: string;
904
+ limit?: string;
905
+ nextCursor?: string;
906
+ }
907
+ /**
908
+ * Result of the socket `get-post-messages` event. The backend returns the raw
909
+ * `cursorPaginate` page of reply messages — there is no `{ postId, messages,
910
+ * totalMessages }` envelope.
911
+ */
912
+ export type GetPostMessagesResult = PaginatedResult<Message>;
913
+ export interface ConversationMembersPayload {
914
+ conversationId: string;
915
+ }
916
+ export interface ConversationMembersResult {
917
+ conversationId: string;
918
+ members: Member[];
919
+ }
920
+ /**
921
+ * Minimal chat user record used by the @mention dropdown. Returned by the
922
+ * Redis-backed `link-handles` event so SDK consumers can render a mention
923
+ * picker for any chat link member without scanning users on every keystroke.
924
+ */
925
+ export interface LinkHandleEntry {
926
+ _id: string;
927
+ handle: string;
928
+ displayName: string;
929
+ photo?: string;
930
+ }
931
+ export interface LinkHandlesResult {
932
+ chatLinkId: string | null;
933
+ handles: LinkHandleEntry[];
934
+ }
935
+ /** Broadcast payload when a new chat user joins the active chat link. */
936
+ export interface LinkUserJoinedEvent {
937
+ chatLinkId: string;
938
+ handles: LinkHandleEntry[];
939
+ }
940
+ /** Broadcast payload when a chat link member updates handle/displayName/photo. */
941
+ export interface LinkUserUpdatedEvent {
942
+ chatLinkId: string;
943
+ handle: LinkHandleEntry;
944
+ }
945
+ /** Hop product modes — see docs/hop-voice-video-meetings.md §4. */
946
+ export declare enum HopMode {
947
+ NOW = "NOW",
948
+ CIRCLE = "CIRCLE",
949
+ MEETING = "MEETING"
950
+ }
951
+ export declare enum HopStatus {
952
+ IDLE = "IDLE",
953
+ SCHEDULED = "SCHEDULED",
954
+ LIVE = "LIVE",
955
+ ENDED = "ENDED",
956
+ CANCELLED = "CANCELLED"
957
+ }
958
+ export interface HopPublicState {
959
+ sessionId: string;
960
+ conversationId: string;
961
+ mode: HopMode | 'NOW' | 'CIRCLE' | 'MEETING';
962
+ status: HopStatus;
963
+ startedAt?: string;
964
+ hostId: string;
965
+ initialMediaKind: 'audio' | 'video';
966
+ hasVideoProducers: boolean;
967
+ screenShareActive: boolean;
968
+ activeParticipantIds: string[];
969
+ participantCount: number;
970
+ recordingEnabled: boolean;
971
+ recordingStarterId?: string;
972
+ endpoint?: string;
973
+ }
974
+ /** Payload accepted by `socketApi.startHop(...)`. */
975
+ export interface StartHopPayload {
976
+ conversationId: string;
977
+ mode: 'NOW' | 'CIRCLE';
978
+ initialMediaKind?: 'audio' | 'video';
979
+ }
980
+ /** Payload accepted by `socketApi.startHopAdHoc(...)`. */
981
+ export interface StartHopAdHocPayload {
982
+ chatUserIds: string[];
983
+ name?: string;
984
+ initialMediaKind?: 'audio' | 'video';
985
+ }
986
+ /** Payload accepted by `socketApi.joinHop(...)`. */
987
+ export interface JoinHopPayload {
988
+ conversationId: string;
989
+ }
990
+ /** Response from joinHop — the mediasoup router capabilities + transport params. */
991
+ /**
992
+ * ICE server entry, passed straight to mediasoup-client `createSendTransport({ iceServers })`.
993
+ * `username` / `credential` exist on TURN entries only. */
994
+ export interface HopIceServer {
995
+ urls: string[];
996
+ username?: string;
997
+ credential?: string;
998
+ }
999
+ export interface JoinHopResult {
1000
+ admitted: boolean;
1001
+ sessionId: string;
1002
+ mode?: 'NOW' | 'CIRCLE' | 'MEETING';
1003
+ initialMediaKind?: 'audio' | 'video';
1004
+ routerRtpCapabilities?: any;
1005
+ sendTransport?: any;
1006
+ recvTransport?: any;
1007
+ /**
1008
+ * STUN (+ TURN when the backend sets TURN_HOST + TURN_SECRET, with ~1h RFC 5766 HMAC credentials)
1009
+ * servers for the mediasoup Device's ICE gathering. */
1010
+ iceServers?: HopIceServer[];
1011
+ existingProducers?: Array<{
1012
+ producerId: string;
1013
+ userId: string;
1014
+ kind: 'audio' | 'video';
1015
+ source: 'mic' | 'cam' | 'screen';
1016
+ }>;
1017
+ /** false = webinar attendee: consume only (no `hop-produce`) until a host promotes you. Absent on older servers. */
1018
+ canProduce?: boolean;
1019
+ }
1020
+ export interface ScheduleHopMeetingPayload {
1021
+ title: string;
1022
+ description?: string;
1023
+ startAt: string;
1024
+ endAt: string;
1025
+ /** May be empty when `guestEmails` or `locationConversationId` is set. */
1026
+ participantIds: string[];
1027
+ recordByDefault?: boolean;
1028
+ requireAdmit?: boolean;
1029
+ reminderMinutes?: number;
1030
+ timezone?: string;
1031
+ /** Recurrence pattern. ONCE (default), DAILY, WEEKLY, or CUSTOM. */
1032
+ recurrence?: 'ONCE' | 'DAILY' | 'WEEKLY' | 'CUSTOM';
1033
+ /** Custom interval in days. Only used when recurrence=CUSTOM. */
1034
+ recurIntervalDays?: number;
1035
+ /** ISO date — last day of the recurring series. */
1036
+ recurUntil?: string;
1037
+ /** Run as webinar (registration, stage, Q&A); 403 unless the plan has `allowWebinarMode`. */
1038
+ runAsWebinar?: boolean;
1039
+ /** "Where": a conversation you are an active member of; the meeting card is posted there. */
1040
+ locationConversationId?: string;
1041
+ /** External guests (≤ 20) emailed a single-use join pass. */
1042
+ guestEmails?: string[];
1043
+ }
1044
+ /** `hop-meeting-create` ack (and REST `POST hops/meetings`). */
1045
+ export interface ScheduleHopMeetingResult {
1046
+ conversationId: string;
1047
+ conversationCode: string;
1048
+ calendarStatus: 'created' | 'skipped' | 'failed';
1049
+ googleEventId?: string;
1050
+ occurrences?: number;
1051
+ seriesId?: string;
1052
+ locationConversationId?: string;
1053
+ guestsInvited?: number;
1054
+ }
1055
+ /** `hop-lobby-waiting` to hosts: someone is waiting to be admitted. */
1056
+ export interface HopLobbyWaitingEvent {
1057
+ sessionId: string;
1058
+ userId: string;
1059
+ /** '' when the user has no name or handle. */
1060
+ displayName: string;
1061
+ /** True when this person left or was turned away and asked to join again. */
1062
+ askedAgain?: boolean;
1063
+ }
1064
+ export interface HopMeetingRecord {
1065
+ _id: string;
1066
+ code: string;
1067
+ name: string;
1068
+ meetingMetadata: {
1069
+ startAt: string;
1070
+ endAt: string;
1071
+ durationMinutes: number;
1072
+ title?: string;
1073
+ description?: string;
1074
+ requireAdmit: boolean;
1075
+ recordByDefault: boolean;
1076
+ reminderMinutes: number;
1077
+ timezone?: string;
1078
+ status: HopStatus | 'SCHEDULED' | 'LIVE' | 'ENDED' | 'CANCELLED';
1079
+ googleEventId?: string;
1080
+ /** Set by `runAsWebinar` (with `maxAttendees: 500`, attendee audio off). */
1081
+ isWebinar?: boolean;
1082
+ maxAttendees?: number;
1083
+ };
1084
+ totalMembers: number;
1085
+ }
1086
+ export interface HopRecordingStartedEvent {
1087
+ sessionId: string;
1088
+ starterId: string;
1089
+ segmentId: number;
1090
+ startedAt: string;
1091
+ }
1092
+ export interface HopRecordingReadyEvent {
1093
+ sessionId: string;
1094
+ conversationId: string;
1095
+ manifestUrl: string;
1096
+ }
1097
+ export interface HopParticipantJoinedEvent {
1098
+ sessionId: string;
1099
+ userId: string;
1100
+ }
1101
+ export interface HopParticipantLeftEvent {
1102
+ sessionId: string;
1103
+ userId: string;
1104
+ }
1105
+ export interface HopInviteEvent {
1106
+ sessionId: string;
1107
+ /** Also on a `hop-invite-request` ring (chatta #376). */
1108
+ conversationId?: string;
1109
+ invitedBy: string;
1110
+ invitedByName: string;
1111
+ }
1112
+ export interface HopRedirectEvent {
1113
+ endpoint: string;
1114
+ reason: string;
1115
+ }
1116
+ export interface HopInviteEventExtended extends HopInviteEvent {
1117
+ conversationId: string;
1118
+ conversationName?: string;
1119
+ participantCount?: number;
1120
+ /** Ring label "HopNow · video call": NOW for 1:1, CIRCLE for groups. */
1121
+ mode?: 'NOW' | 'CIRCLE' | 'MEETING';
1122
+ /** Which accept leads: Accept audio or Accept video. */
1123
+ media?: 'audio' | 'video';
1124
+ }
1125
+ export interface HopParticipantInfo {
1126
+ _id: string;
1127
+ displayName: string;
1128
+ handle: string;
1129
+ photo: string;
1130
+ isHost?: boolean;
1131
+ isMuted?: boolean;
1132
+ }
1133
+ export interface HopListParticipantsResult {
1134
+ onCall: HopParticipantInfo[];
1135
+ offCall: HopParticipantInfo[];
1136
+ hostId: string;
1137
+ }
1138
+ export interface HopActiveSession {
1139
+ sessionId: string;
1140
+ conversationId: string;
1141
+ conversationName: string;
1142
+ mode: string;
1143
+ startedAt: string;
1144
+ participantCount: number;
1145
+ }
1146
+ export interface HopListActiveResult {
1147
+ sessions: HopActiveSession[];
1148
+ }
1149
+ export interface HopListProducersResult {
1150
+ producers: Array<{
1151
+ producerId: string;
1152
+ userId: string;
1153
+ kind: 'audio' | 'video';
1154
+ source: 'mic' | 'cam' | 'screen';
1155
+ }>;
1156
+ }
1157
+ export interface HopParticipantMutedEvent {
1158
+ sessionId: string;
1159
+ userId: string;
1160
+ /** true = now muted, false = now unmuted. */
1161
+ muted: boolean;
1162
+ /** The participant changed their own mic (`hop-media-change`), not a host. */
1163
+ self?: boolean;
1164
+ }
1165
+ export interface HopParticipantDroppedEvent {
1166
+ sessionId: string;
1167
+ userId: string;
1168
+ }
1169
+ export interface HopYouWereDroppedEvent {
1170
+ sessionId: string;
1171
+ /** `moved`: you joined the same call from another tab or device; this one is no longer in it. */
1172
+ reason?: 'moved';
1173
+ }
1174
+ export interface HopReactionEvent {
1175
+ sessionId: string;
1176
+ emoji: string;
1177
+ userId: string;
1178
+ displayName: string;
1179
+ }
1180
+ export interface HopVoteEvent {
1181
+ sessionId: string;
1182
+ conversationId: string;
1183
+ userId: string;
1184
+ direction: 'up' | 'down' | 'none';
1185
+ }
1186
+ export interface HopVoteUpdatedEvent {
1187
+ messageId: string;
1188
+ conversationId: string;
1189
+ hopVote: {
1190
+ sessionId: string;
1191
+ upVoters: string[];
1192
+ downVoters: string[];
1193
+ totalVotes: number;
1194
+ };
1195
+ }
1196
+ export interface HopRaiseHandEvent {
1197
+ sessionId: string;
1198
+ userId: string;
1199
+ displayName: string;
1200
+ raised: boolean;
1201
+ }
1202
+ export interface HopVoteCompleteEvent {
1203
+ sessionId: string;
1204
+ round: number;
1205
+ totalVoted: number;
1206
+ }
1207
+ export interface HopNewVoteRoundEvent {
1208
+ sessionId: string;
1209
+ round: number;
1210
+ }
1211
+ export interface HopHostChangedEvent {
1212
+ sessionId: string;
1213
+ hostId: string;
1214
+ coHosts: Record<string, boolean>;
1215
+ }
1216
+ export interface PostDeleteEvent {
1217
+ postId: string;
1218
+ }
1219
+ export interface PinConversationEvent {
1220
+ conversationId: string;
1221
+ isPinned: boolean;
1222
+ }
1223
+ export interface TranslateMessagePayload {
1224
+ messageId: string;
1225
+ targetLanguage: string;
1226
+ }
1227
+ /**
1228
+ * `translateMessageById` result (`POST /chats/translate`, socket `translate-message`): message id,
1229
+ * target language, `translation` (not `translatedText`) and `cached`; `{ error }` on failure. */
1230
+ export type TranslateMessageResult = {
1231
+ messageId: string;
1232
+ targetLanguage: string;
1233
+ translation: string;
1234
+ cached: boolean;
1235
+ } | {
1236
+ error: string;
1237
+ };
1238
+ export interface SetLanguagePayload {
1239
+ language: string;
1240
+ }
1241
+ /** Ack returned by the socket `set-language` event. */
1242
+ export interface SetLanguageResult {
1243
+ success: boolean;
1244
+ language: string;
1245
+ }
1246
+ export interface OnlineUsersPayload {
1247
+ /** Backend `GetOnlineUsersDto` field is `memberIds` (chat-user ids). */
1248
+ memberIds: string[];
1249
+ }
1250
+ export interface OnlineUsersResult {
1251
+ onlineUserIds: string[];
1252
+ }
1253
+ export interface AiCredits {
1254
+ used: number;
1255
+ total: number;
1256
+ remaining: number;
1257
+ }
1258
+ export declare enum WebhookStatus {
1259
+ ACTIVE = "ACTIVE",
1260
+ DISABLED = "DISABLED"
1261
+ }
1262
+ export declare enum WebhookEvent {
1263
+ MESSAGE_SENT = "message.sent",
1264
+ CONVERSATION_CREATED = "conversation.created",
1265
+ USER_JOINED = "user.joined",
1266
+ USER_LEFT = "user.left",
1267
+ CONVERSATION_LOCKED = "conversation.locked",
1268
+ CONVERSATION_UNLOCKED = "conversation.unlocked",
1269
+ /** Alias of `csat:submit`: a customer rated a support conversation (`CsatWebhookPayload`). */
1270
+ CSAT_SUBMITTED = "csat.submitted"
1271
+ }
1272
+ /** One delivery outcome; `code` is e.g. '200', 'HTTP 502' or 'timeout'. */
1273
+ export interface WebhookAttempt {
1274
+ ok: boolean;
1275
+ code: string;
1276
+ at: string;
1277
+ }
1278
+ /** Attempts in one UTC hour (`h` = hour start). */
1279
+ export interface WebhookHourBucket {
1280
+ h: string;
1281
+ ok: number;
1282
+ fail: number;
1283
+ }
1284
+ export interface Webhook {
1285
+ /** Read-only: the last 40 attempts and 24 h of hourly buckets. */
1286
+ recentDeliveries?: WebhookAttempt[];
1287
+ statsHour?: WebhookHourBucket[];
1288
+ _id: string;
1289
+ url: string;
1290
+ events: string[];
1291
+ secret?: string;
1292
+ status: WebhookStatus;
1293
+ name?: string;
1294
+ failCount?: number;
1295
+ lastTriggeredAt?: string;
1296
+ lastError?: string;
1297
+ createdAt?: string;
1298
+ updatedAt?: string;
1299
+ }
1300
+ export interface CreateWebhookPayload {
1301
+ /** REQUIRED by the backend `CreateWebhookDto` (omitting it 400s). */
1302
+ name: string;
1303
+ /** Must be a valid HTTPS URL. */
1304
+ url: string;
1305
+ events: string[];
1306
+ secret?: string;
1307
+ }
1308
+ export interface UpdateWebhookPayload {
1309
+ url?: string;
1310
+ events?: string[];
1311
+ secret?: string;
1312
+ name?: string;
1313
+ status?: WebhookStatus;
1314
+ }
1315
+ export interface UpdateChatUserProfilePayload {
1316
+ displayName?: string;
1317
+ handle?: string;
1318
+ photo?: string;
1319
+ caption?: string;
1320
+ country?: string;
1321
+ /** Max 30 chars (backend `UpdateChatUserProfileDto`). */
1322
+ phone?: string;
1323
+ /** Nested `UpdateUserPreferencesDto`, merged by key (sound, privacy, timezone, notifyMatrix). */
1324
+ preferences?: ChatUserPreferencesPayload;
1325
+ }
1326
+ export interface HandleEditInfo {
1327
+ editsThisMonth: number;
1328
+ maxEditsPerMonth: number;
1329
+ remaining: number;
1330
+ }
1331
+ /**
1332
+ * Body for `POST /external/chats/messages/admin-reply` (`AdminReplyDto`): no `attachments` field;
1333
+ * `parentMessageId` threads the reply. */
1334
+ export interface AdminReplyPayload {
1335
+ conversationId: string;
1336
+ message: string;
1337
+ /** Parent message ID for threading. */
1338
+ parentMessageId?: string;
1339
+ }
1340
+ export interface FeaturePricing {
1341
+ _id: string;
1342
+ featureKey: string;
1343
+ name: string;
1344
+ description: string;
1345
+ pricePerDay: number;
1346
+ usageLimit: number;
1347
+ category: 'FEATURE' | 'AI_CREDITS' | 'STORAGE';
1348
+ status: string;
1349
+ }
1350
+ /**
1351
+ * Body for `POST /external/subscriptions/features/gift` — backend
1352
+ * `GiftFeaturePurchaseDto`. Contract fix: `callbackUrl` is not on the DTO
1353
+ * (it was silently stripped) and has been removed.
1354
+ */
1355
+ export interface GiftFeaturePayload {
1356
+ featurePricingId: string;
1357
+ /** 1–365 days (backend-enforced). */
1358
+ durationDays: number;
1359
+ }
1360
+ export interface VerifyGiftPayload {
1361
+ reference: string;
1362
+ }
1363
+ export interface GiftFeatureResult {
1364
+ authorizationUrl: string;
1365
+ reference: string;
1366
+ accessCode: string;
1367
+ }
1368
+ /**
1369
+ * Feature purchase returned by `verifyGiftFeature` once Paystack confirms; `null` when another
1370
+ * delivery already activated the same reference (idempotent). */
1371
+ export interface FeaturePurchase {
1372
+ _id: string;
1373
+ owner: string;
1374
+ featurePricing: string;
1375
+ featureKey: string;
1376
+ category: 'FEATURE' | 'AI_CREDITS' | string;
1377
+ pricePerDay: number;
1378
+ durationDays: number;
1379
+ pricePaid: number;
1380
+ amountPaid: number;
1381
+ usageLimit: number;
1382
+ purchasedAt: string;
1383
+ expiresAt: string;
1384
+ status: string;
1385
+ reference: string;
1386
+ giftedBy?: string | null;
1387
+ createdAt?: string;
1388
+ updatedAt?: string;
1389
+ }
1390
+ export interface GetAllThreadsPayload {
1391
+ conversationId?: string;
1392
+ nextCursor?: string;
1393
+ prevCursor?: string;
1394
+ cursorDirection?: 'ASC' | 'DESC';
1395
+ limit?: string;
1396
+ }
1397
+ export interface AllThreadsResult {
1398
+ results: Message[];
1399
+ nextCursor?: string | null;
1400
+ prevCursor?: string | null;
1401
+ hasMore: boolean;
1402
+ hasPrev?: boolean;
1403
+ }
1404
+ export interface SuggestedCannedResponse {
1405
+ /** Backend key is `id` (a UUID), not `_id` — these are Redis/data-log
1406
+ * records, not Mongo documents. */
1407
+ id: string;
1408
+ title: string;
1409
+ body: string;
1410
+ category?: string;
1411
+ shortcut?: string;
1412
+ status?: string;
1413
+ usageCount?: number;
1414
+ createdAt?: string;
1415
+ updatedAt?: string;
1416
+ }
1417
+ export interface GlobalSearchResult {
1418
+ messages: Message[];
1419
+ conversations: Conversation[];
1420
+ chatUsers: Member[];
1421
+ }
1422
+ /**
1423
+ * Body for `POST /external/chats/conversations/bulk-export` — backend
1424
+ * `BulkExportConversationsDto`. Contract fix: `email` is REQUIRED by the DTO
1425
+ * (`@IsDefined @IsEmail`) — omitting it 400s.
1426
+ */
1427
+ export interface BulkExportChatPayload {
1428
+ /** 1–50 conversation IDs (backend-enforced). */
1429
+ conversationIds: string[];
1430
+ email: string;
1431
+ /** ChatExportFormat, e.g. CSV (default) | PDF. */
1432
+ format?: string;
1433
+ }
1434
+ export interface BulkExportChatResult {
1435
+ success: boolean;
1436
+ exportId?: string;
1437
+ conversationCount?: number;
1438
+ message?: string;
1439
+ }
1440
+ export interface WhiteboardStrokePayload {
1441
+ conversationId: string;
1442
+ /** Backend `AddWhiteboardStrokeDto` carries `whiteboardId`. Optional here so
1443
+ * existing conversation-scoped calls keep compiling while the backend
1444
+ * migrates to deriving it; forwarded when the caller has the board id. */
1445
+ whiteboardId?: string;
1446
+ stroke: {
1447
+ tool: 'pen' | 'eraser' | 'line' | 'rect' | 'circle' | 'shape' | 'text';
1448
+ color?: string;
1449
+ width?: number;
1450
+ points: {
1451
+ x: number;
1452
+ y: number;
1453
+ }[];
1454
+ /** Text tool only; the server keeps the first 200 characters. */
1455
+ text?: string;
1456
+ };
1457
+ }
1458
+ export interface WhiteboardSnapshotPayload {
1459
+ conversationId: string;
1460
+ /** Optional `whiteboardId` — see `WhiteboardStrokePayload`. */
1461
+ whiteboardId?: string;
1462
+ imageData: string;
1463
+ }
1464
+ export interface WhiteboardStrokeEvent {
1465
+ /** The backend re-broadcasts `{ whiteboardId, stroke, senderId }`; both key
1466
+ * fields are optional here to stay forward-compatible with the derived id. */
1467
+ conversationId?: string;
1468
+ whiteboardId?: string;
1469
+ userId?: string;
1470
+ senderId?: string;
1471
+ stroke: WhiteboardStrokePayload['stroke'];
1472
+ }
1473
+ export interface WhiteboardSnapshotEvent {
1474
+ conversationId?: string;
1475
+ whiteboardId?: string;
1476
+ imageData: string;
1477
+ createdBy?: string;
1478
+ senderId?: string;
1479
+ createdAt?: string;
1480
+ }
1481
+ /** Backend `AutomationTrigger` enum (stored as a string). */
1482
+ export type AutomationTrigger = 'MEMBER_JOINED' | 'MESSAGE_CONTAINS' | 'NO_RESPONSE_AFTER' | 'POLL_COMPLETED' | 'MEETING_ENDED';
1483
+ /** Backend `AutomationAction` enum (stored as a string). */
1484
+ export type AutomationAction = 'SEND_MESSAGE' | 'ASSIGN_MODERATOR' | 'LOCK_CONVERSATION' | 'SEND_WEBHOOK' | 'TAG_USER'
1485
+ /** actionConfig.cannedId: reply with that canned response. */
1486
+ | 'REPLY_CANNED'
1487
+ /** actionConfig.teamId (named team, round-robin) or actionConfig.assigneeId (one teammate). */
1488
+ | 'ASSIGN_TEAM';
1489
+ /** `triggerConfig`: MESSAGE_CONTAINS fires when any keyword matches as a whole word. */
1490
+ export interface AutomationTriggerConfig {
1491
+ [key: string]: unknown;
1492
+ keyword?: string;
1493
+ keywords?: string[];
1494
+ /** NO_RESPONSE_AFTER only: a guest waits this long (1 min – 7 days, default 5) with no team reply. */
1495
+ delayMinutes?: number;
1496
+ /** Any rule: run its actions this many seconds after the trigger (0 – 3600; 0 = right away). */
1497
+ delaySeconds?: number;
1498
+ }
1499
+ /** One extra step run after the primary action (at most 3 per rule). */
1500
+ export interface AutomationStep {
1501
+ action: AutomationAction;
1502
+ actionConfig?: Record<string, unknown>;
1503
+ }
1504
+ export interface AutomationCondition {
1505
+ field: string;
1506
+ operator: string;
1507
+ value: string;
1508
+ }
1509
+ /**
1510
+ * An automation workflow. The backend stores `trigger`/`action` as string
1511
+ * enums, with their parameters in the separate `triggerConfig`/`actionConfig`
1512
+ * objects. Automations are scoped to a chat link.
1513
+ */
1514
+ export interface Automation {
1515
+ _id: string;
1516
+ chatLink: string;
1517
+ owner: string;
1518
+ name: string;
1519
+ trigger: AutomationTrigger;
1520
+ triggerConfig?: AutomationTriggerConfig;
1521
+ action: AutomationAction;
1522
+ actionConfig?: Record<string, unknown>;
1523
+ extraActions?: AutomationStep[];
1524
+ conditions?: AutomationCondition[];
1525
+ isActive: boolean;
1526
+ /** Read-only: ISO week key of `runWeekCount` ("ran N× this week" when it is this week). */
1527
+ runWeek?: string | null;
1528
+ runWeekCount?: number;
1529
+ createdAt?: string;
1530
+ updatedAt?: string;
1531
+ }
1532
+ export interface CreateAutomationPayload {
1533
+ chatLinkId: string;
1534
+ name: string;
1535
+ trigger: AutomationTrigger;
1536
+ triggerConfig?: AutomationTriggerConfig;
1537
+ action: AutomationAction;
1538
+ actionConfig?: Record<string, unknown>;
1539
+ conditions?: AutomationCondition[];
1540
+ /** ≤ 3 more actions run in order after `action`. */
1541
+ extraActions?: AutomationStep[];
1542
+ }
1543
+ export interface UpdateAutomationPayload {
1544
+ automationId: string;
1545
+ name?: string;
1546
+ trigger?: AutomationTrigger;
1547
+ triggerConfig?: AutomationTriggerConfig;
1548
+ action?: AutomationAction;
1549
+ actionConfig?: Record<string, unknown>;
1550
+ isActive?: boolean;
1551
+ /** Replaces the extra steps (≤ 3); `[]` clears them. */
1552
+ extraActions?: AutomationStep[];
1553
+ }
1554
+ export interface GetAutomationsPayload {
1555
+ chatLinkId: string;
1556
+ }
1557
+ export interface DeleteAutomationPayload {
1558
+ automationId: string;
1559
+ }
1560
+ /** Envelope returned by the socket `get-automations` event. */
1561
+ export interface AutomationsResult {
1562
+ automations: Automation[];
1563
+ }
1564
+ export interface StartWebinarPayload {
1565
+ conversationId: string;
1566
+ /** Max attendees allowed. Backend default is 500. */
1567
+ maxAttendees?: number;
1568
+ }
1569
+ /** Ack returned by the socket `start-webinar` event. */
1570
+ export interface StartWebinarResult {
1571
+ conversationId: string;
1572
+ isWebinar: boolean;
1573
+ }
1574
+ /** A single Q&A queue entry (as stored on the conversation). */
1575
+ export interface WebinarQaEntry {
1576
+ id: string;
1577
+ attendeeId: string;
1578
+ question: string;
1579
+ askedAt: string;
1580
+ answered: boolean;
1581
+ answer?: string;
1582
+ answeredAt?: string;
1583
+ }
1584
+ /** Ack returned by the socket `webinar-qa-submit` event. */
1585
+ export interface WebinarQaSubmitResult {
1586
+ conversationId: string;
1587
+ qa: WebinarQaEntry;
1588
+ }
1589
+ /** Ack returned by the socket `webinar-qa-answer` event. */
1590
+ export interface WebinarQaAnswerResult {
1591
+ conversationId: string;
1592
+ qaId: string;
1593
+ answered: boolean;
1594
+ answer: string;
1595
+ qa: WebinarQaEntry;
1596
+ }
1597
+ /** Ack returned by the socket `promote-attendee-audio` event. */
1598
+ export interface PromoteAttendeeAudioResult {
1599
+ conversationId: string;
1600
+ attendeeId: string;
1601
+ promoted: boolean;
1602
+ }
1603
+ export interface RaiseHandPayload {
1604
+ conversationId: string;
1605
+ }
1606
+ export interface LowerHandPayload {
1607
+ conversationId: string;
1608
+ }
1609
+ export interface PromoteAttendeeAudioPayload {
1610
+ conversationId: string;
1611
+ attendeeId: string;
1612
+ }
1613
+ export interface WebinarQaSubmitPayload {
1614
+ conversationId: string;
1615
+ question: string;
1616
+ }
1617
+ export interface WebinarQaAnswerPayload {
1618
+ conversationId: string;
1619
+ qaId: string;
1620
+ answer: string;
1621
+ }
1622
+ export interface WebinarStartedEvent {
1623
+ conversationId: string;
1624
+ startedBy: string;
1625
+ startedAt: string;
1626
+ }
1627
+ export interface WebinarHandRaisedEvent {
1628
+ conversationId: string;
1629
+ attendeeId: string;
1630
+ displayName: string;
1631
+ }
1632
+ export interface WebinarHandLoweredEvent {
1633
+ conversationId: string;
1634
+ attendeeId: string;
1635
+ }
1636
+ export interface WebinarAttendeePromotedEvent {
1637
+ conversationId: string;
1638
+ attendeeId: string;
1639
+ }
1640
+ export interface WebinarQaUpdatedEvent {
1641
+ conversationId: string;
1642
+ qaId: string;
1643
+ question: string;
1644
+ answer?: string;
1645
+ status: 'pending' | 'answered';
1646
+ submittedBy: string;
1647
+ }
1648
+ export interface WebinarRegistration {
1649
+ _id: string;
1650
+ userId: string;
1651
+ displayName: string;
1652
+ email?: string;
1653
+ registeredAt: string;
1654
+ }
1655
+ export interface GetConversationStatsPayload {
1656
+ conversationId: string;
1657
+ }
1658
+ /**
1659
+ * Lightweight per-conversation analytics returned by the socket
1660
+ * `get-conversation-stats` event. Fields mirror the backend
1661
+ * `getConversationStats` return exactly.
1662
+ */
1663
+ export interface ConversationStats {
1664
+ conversationId: string;
1665
+ messageCount: number;
1666
+ messagesPerDay: {
1667
+ date: string;
1668
+ count: number;
1669
+ }[];
1670
+ avgResponseTimeMinutes: number | null;
1671
+ peakHour: number | null;
1672
+ }
1673
+ export interface UpdateChatUserSettingsPayload {
1674
+ /** ISO 639-1 locale code, e.g. `en`, `fr`, `es`, `ar`, `pt`. */
1675
+ preferredLocale?: string;
1676
+ /** Auto-translate incoming messages to the preferred locale. */
1677
+ autoTranslate?: boolean;
1678
+ }
1679
+ export interface ChatUserSettingsResult {
1680
+ updated: boolean;
1681
+ preferredLocale?: string;
1682
+ autoTranslate?: boolean;
1683
+ }
1684
+ export interface LinkWorkspaceOwner {
1685
+ displayName: string | null;
1686
+ handle: string | null;
1687
+ }
1688
+ export interface LinkWorkspaceInfo {
1689
+ code: string;
1690
+ name: string;
1691
+ icon: string | null;
1692
+ status: string;
1693
+ memberCount: number;
1694
+ owner: LinkWorkspaceOwner;
1695
+ /** Embed widget settings (PROVISIONAL shape until chatta ships the link fields). */
1696
+ widget?: LinkWidgetConfig;
1697
+ }
1698
+ /** Link-level widget settings the floating launcher reads; SDK options always win. */
1699
+ export interface LinkWidgetConfig {
1700
+ preChat?: PreChatForm | null;
1701
+ businessHours?: BusinessHours | null;
1702
+ }
1703
+ /** Store release of the native app on one platform; empty strings mean not configured (show no prompt). */
1704
+ export interface NativeAppRelease {
1705
+ latest: string;
1706
+ min: string;
1707
+ storeUrl: string;
1708
+ }
1709
+ /** Store releases per platform on `AppVersionInfo.platforms`. */
1710
+ export interface AppVersionPlatforms {
1711
+ ios: NativeAppRelease;
1712
+ android: NativeAppRelease;
1713
+ }
1714
+ /** `GET /external/version`; the top three fields are the legacy shape. Cached by the server for 5 minutes. */
1715
+ export interface AppVersionInfo {
1716
+ version: string;
1717
+ minVersion: string;
1718
+ updateUrl: string | null;
1719
+ /** Per-platform store versions; absent on servers before chatta 2026-11-27. */
1720
+ platforms?: AppVersionPlatforms;
1721
+ }
1722
+ export interface HopInviteDeclineEvent {
1723
+ sessionId: string;
1724
+ declinedBy: string;
1725
+ }
1726
+ export interface HopScreenshareStartEvent {
1727
+ sessionId: string;
1728
+ producerId: string;
1729
+ userId: string;
1730
+ }
1731
+ export interface HopMediaChangeEvent {
1732
+ sessionId: string;
1733
+ userId: string;
1734
+ videoEnabled: boolean;
1735
+ audioEnabled: boolean;
1736
+ }
1737
+ export interface HopTransportParamsEvent {
1738
+ sessionId: string;
1739
+ transportId: string;
1740
+ connected: boolean;
1741
+ }
1742
+ export interface HopNewProducerEvent {
1743
+ sessionId: string;
1744
+ producerId: string;
1745
+ userId: string;
1746
+ kind: 'audio' | 'video';
1747
+ source?: string;
1748
+ }
1749
+ export interface HopProducerClosedEvent {
1750
+ sessionId: string;
1751
+ producerId: string;
1752
+ userId: string;
1753
+ }