@livechatta/sdk 0.0.0-stage → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (246) hide show
  1. package/CHANGELOG.md +228 -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 +7259 -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 +7078 -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 +7263 -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 +274 -4
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Manages embed token creation.
3
+ * Encrypts { apiKey, chatUsername, linkCode } with the public RSA key
4
+ * so the server can verify identity without exposing credentials.
5
+ */
6
+ export declare class TokenManager {
7
+ private readonly apiKey;
8
+ private readonly linkCode;
9
+ private readonly chatUsername?;
10
+ private readonly publicKey?;
11
+ private cachedToken;
12
+ constructor(apiKey: string, linkCode: string, chatUsername?: string | undefined, publicKey?: string | undefined);
13
+ /** Whether a public key was provided for RSA-OAEP encryption */
14
+ get hasPublicKey(): boolean;
15
+ /**
16
+ * Get or create the encrypted embed token.
17
+ * If a public key is provided, encrypts credentials.
18
+ * Otherwise, returns the raw API key (for direct API key auth mode).
19
+ */
20
+ getToken(): Promise<string>;
21
+ /** Invalidate cached token (e.g. on config change) */
22
+ invalidate(): void;
23
+ /** Invalidate and re-generate the token. Used on 401 to force a fresh token. */
24
+ refresh(): Promise<string>;
25
+ }
@@ -0,0 +1,140 @@
1
+ import type { ThemeLoadedPayload } from './Bridge';
2
+ import type { LinkUnavailablePayload } from '../types/chat-core';
3
+ /** Outbound — chat → shell. Listen with `bridge.on(name, payload => ...)`. */
4
+ export interface OutboundEventMap {
5
+ onLoginSuccess: {
6
+ linkCode: string;
7
+ linkName?: string;
8
+ linkLogo?: string;
9
+ primaryColor?: string;
10
+ accessToken: string;
11
+ refreshToken?: string;
12
+ expireInSeconds?: number;
13
+ userId?: string;
14
+ username?: string;
15
+ };
16
+ onLogout: void;
17
+ onUnreadChange: number | {
18
+ count: number;
19
+ };
20
+ onThemeLoaded: ThemeLoadedPayload;
21
+ openExternal: {
22
+ url: string;
23
+ };
24
+ openWorkspaceDrawer: void;
25
+ enableScreenshotProtection: {
26
+ enabled: boolean;
27
+ };
28
+ hopStartCall: {
29
+ sessionId?: string;
30
+ };
31
+ hopEndCall: void;
32
+ hopRecordingStarted: void;
33
+ hopRecordingStopped: void;
34
+ notify: {
35
+ title?: string;
36
+ body?: string;
37
+ linkCode?: string;
38
+ conversationId?: string;
39
+ extra?: Record<string, unknown>;
40
+ };
41
+ grantUpdate: {
42
+ kind: string;
43
+ granted: boolean;
44
+ };
45
+ setClipboard: {
46
+ text: string;
47
+ };
48
+ share: {
49
+ title?: string;
50
+ text?: string;
51
+ url?: string;
52
+ };
53
+ haptic: {
54
+ style?: 'light' | 'medium' | 'heavy' | 'success' | 'warning' | 'error';
55
+ };
56
+ windowControl: {
57
+ action: 'minimize' | 'maximize' | 'close';
58
+ };
59
+ /** Link is expired, disabled or archived (the chat route answered 410). */
60
+ onLinkUnavailable: LinkUnavailablePayload;
61
+ /** Mic muted / unmuted in the call: mirror it on the native call UI (CallKit / Telecom). */
62
+ hopMuteChanged: {
63
+ sessionId: string;
64
+ muted: boolean;
65
+ };
66
+ }
67
+ /** Actions the shell's native call UI reports into the frame (`CHATTA_APP:nativeCall`). */
68
+ export declare const NATIVE_CALL_ACTIONS: readonly ["ringing", "cancel", "end", "mute", "unmute", "hold", "unhold"];
69
+ export type NativeCallAction = (typeof NATIVE_CALL_ACTIONS)[number];
70
+ /** Inbound — shell → chat. Send with `bridge.send(name, payload)`. */
71
+ export interface InboundEventMap {
72
+ restoreSession: {
73
+ accessToken: string;
74
+ refreshToken?: string;
75
+ expireInSeconds?: number;
76
+ userId?: string;
77
+ username?: string;
78
+ };
79
+ restoreGrants: Record<string, boolean>;
80
+ hopInvite: {
81
+ sessionId: string;
82
+ [key: string]: unknown;
83
+ };
84
+ onLinkNotFound: void;
85
+ updateReady: {
86
+ version: string;
87
+ notes?: string;
88
+ };
89
+ connectionLost: {
90
+ reason?: string;
91
+ };
92
+ /** Shell hello: `nativeCallUi: true` = the shell rings calls natively, so the chat holds its own ring briefly. */
93
+ init: {
94
+ shortcuts?: string[];
95
+ nativeCallUi?: boolean;
96
+ };
97
+ /** Native call UI event: ringing / cancel drop the in-page ring, end hangs up, mute / hold mirror the mic. */
98
+ nativeCall: {
99
+ action: NativeCallAction;
100
+ sessionId: string;
101
+ };
102
+ /** Stage shared files in the open chat's composer (≤ 10 `File`s, `text` ≤ 4000); nothing is sent automatically. */
103
+ shareFiles: {
104
+ files: File[];
105
+ text?: string;
106
+ };
107
+ }
108
+ /** String-enum form for callers that prefer a constant over a literal. */
109
+ export declare const ChattaEvent: {
110
+ readonly OnLoginSuccess: "onLoginSuccess";
111
+ readonly OnLogout: "onLogout";
112
+ readonly OnUnreadChange: "onUnreadChange";
113
+ readonly OnThemeLoaded: "onThemeLoaded";
114
+ readonly OpenExternal: "openExternal";
115
+ readonly OpenWorkspaceDrawer: "openWorkspaceDrawer";
116
+ readonly EnableScreenshotProtection: "enableScreenshotProtection";
117
+ readonly HopStartCall: "hopStartCall";
118
+ readonly HopEndCall: "hopEndCall";
119
+ readonly HopRecordingStarted: "hopRecordingStarted";
120
+ readonly HopRecordingStopped: "hopRecordingStopped";
121
+ readonly Notify: "notify";
122
+ readonly GrantUpdate: "grantUpdate";
123
+ readonly SetClipboard: "setClipboard";
124
+ readonly Share: "share";
125
+ readonly Haptic: "haptic";
126
+ readonly WindowControl: "windowControl";
127
+ readonly OnLinkUnavailable: "onLinkUnavailable";
128
+ readonly HopMuteChanged: "hopMuteChanged";
129
+ readonly RestoreSession: "restoreSession";
130
+ readonly RestoreGrants: "restoreGrants";
131
+ readonly HopInvite: "hopInvite";
132
+ readonly OnLinkNotFound: "onLinkNotFound";
133
+ readonly UpdateReady: "updateReady";
134
+ readonly ConnectionLost: "connectionLost";
135
+ readonly ShareFiles: "shareFiles";
136
+ readonly Init: "init";
137
+ readonly NativeCall: "nativeCall";
138
+ };
139
+ export type OutboundEventName = keyof OutboundEventMap;
140
+ export type InboundEventName = keyof InboundEventMap;
@@ -0,0 +1,110 @@
1
+ /** Points on the rating scale; `score` is 1 to this. */
2
+ export declare const CSAT_SCALE = 5;
3
+ /** Longest rating comment and longest custom question the server keeps. */
4
+ export declare const CSAT_COMMENT_MAX = 500;
5
+ export declare const CSAT_QUESTION_MAX = 140;
6
+ /** A score of 4 or 5 counts as satisfied (`satisfiedPct`). */
7
+ export declare const CSAT_SATISFIED_MIN = 4;
8
+ /** The question the card asks when the link sets none. */
9
+ export declare const CSAT_DEFAULT_QUESTION = "How would you rate the help you got today?";
10
+ /** `open` until rated or its 7 days run out; `superseded` when a later resolve sent a new card. */
11
+ export type CsatStatus = 'open' | 'rated' | 'superseded';
12
+ /** `Message.csat` on a SYSTEM message with `messageKind: 'CSAT'`; only `customerId` may rate it. */
13
+ export interface MessageCsatCard {
14
+ ratingId: string;
15
+ question: string;
16
+ customerId: string;
17
+ scale: number;
18
+ expiresAt: string;
19
+ status: CsatStatus;
20
+ score: number | null;
21
+ }
22
+ /** `POST /chats/conversations/:conversationId/csat` (the customer's member token). */
23
+ export interface SubmitCsatPayload {
24
+ /** 1 – 5. */
25
+ score: number;
26
+ /** Up to 500 characters. */
27
+ comment?: string;
28
+ /** The card's `csat.ratingId`; omitted rates the open card. */
29
+ ratingId?: string;
30
+ }
31
+ /** One rating request (owner and API-key lists, the submit answer, the agent pane). */
32
+ export interface CsatRating {
33
+ _id: string;
34
+ conversationId: string;
35
+ chatLinkId: string | null;
36
+ customerId: string;
37
+ agentId: string | null;
38
+ agentName: string;
39
+ teamId: string | null;
40
+ teamName: string;
41
+ question: string;
42
+ scale: number;
43
+ /** Null until rated. */
44
+ score: number | null;
45
+ comment: string;
46
+ status: CsatStatus;
47
+ expiresAt: string | null;
48
+ ratedAt: string | null;
49
+ createdAt: string | null;
50
+ }
51
+ /** Window on the request date: `from` defaults to 30 days before `to` (default now, exclusive); at most 366 days. */
52
+ export interface CsatQuery {
53
+ from?: string;
54
+ to?: string;
55
+ chatLinkId?: string;
56
+ nextCursor?: string;
57
+ /** 1 – 20. */
58
+ limit?: number;
59
+ }
60
+ /** Rated requests only, newest first; `nextCursor` is the last row's `_id`. */
61
+ export interface CsatRatingPage {
62
+ results: CsatRating[];
63
+ nextCursor: string | null;
64
+ hasMore: boolean;
65
+ }
66
+ /** One agent or team in the summary; `id` is the user or team id (null = none). */
67
+ export interface CsatSummaryGroup {
68
+ id: string | null;
69
+ name: string;
70
+ responses: number;
71
+ /** 1 – 5 with two decimals; null when nothing was rated. */
72
+ average: number | null;
73
+ satisfiedPct: number | null;
74
+ }
75
+ /** `GET /chats/csat/summary`: raw numbers for the window. Percentages have one decimal. */
76
+ export interface CsatSummary {
77
+ from: string;
78
+ to: string;
79
+ chatLinkId: string | null;
80
+ /** Cards sent; `responses` of them were rated. */
81
+ requests: number;
82
+ responses: number;
83
+ average: number | null;
84
+ satisfiedPct: number | null;
85
+ responseRatePct: number | null;
86
+ agents: CsatSummaryGroup[];
87
+ teams: CsatSummaryGroup[];
88
+ }
89
+ /** `csat-updated`: a card was rated or replaced. Agents' own rooms also get `rating` (with the comment). */
90
+ export interface CsatUpdatedEvent {
91
+ conversationId: string;
92
+ messageId: string | null;
93
+ csat: MessageCsatCard;
94
+ rating?: CsatRating;
95
+ }
96
+ /** `data` of the `csat:submit` webhook (alias `csat.submitted`). */
97
+ export interface CsatWebhookPayload {
98
+ ratingId: string;
99
+ conversationId: string;
100
+ chatLinkId: string | null;
101
+ customerId: string;
102
+ agentId: string | null;
103
+ agentName: string;
104
+ teamId: string | null;
105
+ teamName: string;
106
+ score: number | null;
107
+ scale: number;
108
+ comment: string;
109
+ ratedAt: string | null;
110
+ }
@@ -0,0 +1,12 @@
1
+ // Support CSAT (chatta support-csat): after a support conversation is resolved the customer gets
2
+ // a rating card (1 = very unhappy … 5 = very happy) and owners read the ratings. Dates are ISO strings.
3
+ /** Points on the rating scale; `score` is 1 to this. */
4
+ export const CSAT_SCALE = 5;
5
+ /** Longest rating comment and longest custom question the server keeps. */
6
+ export const CSAT_COMMENT_MAX = 500;
7
+ export const CSAT_QUESTION_MAX = 140;
8
+ /** A score of 4 or 5 counts as satisfied (`satisfiedPct`). */
9
+ export const CSAT_SATISFIED_MIN = 4;
10
+ /** The question the card asks when the link sets none. */
11
+ export const CSAT_DEFAULT_QUESTION = 'How would you rate the help you got today?';
12
+ //# sourceMappingURL=csat.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"csat.js","sourceRoot":"","sources":["../../src/types/csat.ts"],"names":[],"mappings":"AAAA,iGAAiG;AACjG,wGAAwG;AAExG,wDAAwD;AACxD,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,CAAC;AAC5B,2EAA2E;AAC3E,MAAM,CAAC,MAAM,gBAAgB,GAAG,GAAG,CAAC;AACpC,MAAM,CAAC,MAAM,iBAAiB,GAAG,GAAG,CAAC;AACrC,8DAA8D;AAC9D,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,CAAC;AACpC,0DAA0D;AAC1D,MAAM,CAAC,MAAM,qBAAqB,GAAG,4CAA4C,CAAC"}
@@ -0,0 +1,242 @@
1
+ export declare enum ChatEvent {
2
+ ALL_CONVERSATIONS = "all-conversations",
3
+ NEW_CONVERSATION = "new-conversation",
4
+ ENTER_CONVERSATION = "enter-conversation",
5
+ JOIN_CONVERSATION = "join-conversation",
6
+ EDIT_CONVERSATION = "edit-conversation",
7
+ MAKE_ADMIN_CONVERSATION = "make-admin-conversation",
8
+ TOGGLE_CONVERSATION = "toggle-conversation",
9
+ STATUS_CHANGE_CONVERSATION = "status-change-conversation",
10
+ MEMBER_STATUS_CHANGE_CONVERSATION = "member-status-change-conversation",
11
+ /** Server → member when they are kicked/banned/left; drop the conversation locally. */
12
+ MEMBERSHIP_REVOKED = "membership-revoked",
13
+ /** Server → owners and admins of a workspace: another workspace invited yours to a channel. */
14
+ SHARED_CHANNEL_INVITE = "shared-channel-invite",
15
+ /** Server → a share changed (staff of both sides) or the badge changed (the channel's members). */
16
+ SHARED_CHANNEL_UPDATED = "shared-channel-updated",
17
+ MESSAGE_STATUS_CHANGE = "message-status-change",
18
+ MESSAGE_REACTION = "message-reaction",
19
+ VALIDATE_PASSWORD = "validate-password",
20
+ ALL_MESSAGES = "all-messages",
21
+ NEW_MESSAGE = "new-message",
22
+ NEW_TYPING = "new-typing",
23
+ SAVE_DRAFT = "save-draft",
24
+ DRAFT_UPDATED = "draft-updated",
25
+ SET_STATUS = "set-status",
26
+ STATUS_UPDATED = "status-updated",
27
+ UPDATE_LIVE_LOCATION = "update-live-location",
28
+ LIVE_LOCATION_UPDATED = "live-location-updated",
29
+ STOP_LIVE_LOCATION = "stop-live-location",
30
+ LIVE_LOCATION_ENDED = "live-location-ended",
31
+ FORGOT_PASSWORD = "forgot-password",
32
+ CHANGE_PASSWORD = "change-password",
33
+ RESET_PASSWORD = "reset-password",
34
+ REFRESH_TOKEN = "refresh-token",
35
+ REVOKE_TOKEN = "revoke-token",
36
+ ONLINE = "online",
37
+ OFFLINE = "offline",
38
+ CHAT_ERROR = "chat-error",
39
+ AUTH_ERROR = "auth-error",
40
+ UNREAD_COUNT_UPDATE = "unread-count-update",
41
+ NOTIFICATION = "notification",
42
+ EDIT_MESSAGE = "edit-message",
43
+ FORWARD_MESSAGE = "forward-message",
44
+ FORWARD_POST = "forward-post",
45
+ MESSAGE_FAILED = "message-failed",
46
+ MESSAGE_READ = "message-read",
47
+ SEARCH_MESSAGES = "search-messages",
48
+ SCHEDULED_MESSAGE = "scheduled-message",
49
+ SEARCH_CHAT_USERS = "search-chat-users",
50
+ THREAD_MESSAGES = "thread-messages",
51
+ TOGGLE_BOOKMARK = "toggle-bookmark",
52
+ GET_BOOKMARKS = "get-bookmarks",
53
+ GET_ALL_BOOKMARKS = "get-all-bookmarks",
54
+ VOTE_POLL = "vote-poll",
55
+ CREATE_POST = "create-post",
56
+ GET_POSTS = "get-posts",
57
+ GET_STORIES = "get-stories",
58
+ VIEW_POST = "view-post",
59
+ REACT_TO_POST = "react-to-post",
60
+ REPLY_TO_POST = "reply-to-post",
61
+ UPDATE_POST = "update-post",
62
+ DELETE_POST = "delete-post",
63
+ GET_POST_MESSAGES = "get-post-messages",
64
+ ALL_THREADS = "all-threads",
65
+ NEW_STORY = "new-story",
66
+ TRANSLATE_MESSAGE = "translate-message",
67
+ SET_LANGUAGE = "set-language",
68
+ PIN_CONVERSATION = "pin-conversation",
69
+ CONVERSATION_MEMBERS = "conversation-members",
70
+ LINK_HANDLES = "link-handles",
71
+ LINK_HOPS = "link-hops",
72
+ LINK_USER_JOINED = "link-user-joined",
73
+ LINK_USER_UPDATED = "link-user-updated",
74
+ ONLINE_USERS = "online-users",
75
+ HEARTBEAT = "heartbeat",
76
+ HOP_START = "hop-start",
77
+ HOP_END = "hop-end",
78
+ HOP_JOIN = "hop-join",
79
+ HOP_LEAVE = "hop-leave",
80
+ HOP_CONNECT_TRANSPORT = "hop-connect-transport",
81
+ HOP_PRODUCE = "hop-produce",
82
+ HOP_CONSUME = "hop-consume",
83
+ HOP_RESUME_CONSUMER = "hop-resume-consumer",
84
+ HOP_MEDIA_CHANGE = "hop-media-change",
85
+ HOP_SCREENSHARE_START = "hop-screenshare-start",
86
+ HOP_SCREENSHARE_STOP = "hop-screenshare-stop",
87
+ HOP_RECORDING_START = "hop-recording-start",
88
+ HOP_RECORDING_STOP = "hop-recording-stop",
89
+ HOP_INVITE_DECLINE = "hop-invite-decline",
90
+ HOP_ADMIT = "hop-admit",
91
+ HOP_DENY = "hop-deny",
92
+ HOP_ICE_RESTART = "hop-ice-restart",
93
+ HOP_REJOIN_ROOM = "hop-rejoin-room",
94
+ HOP_AD_HOC_START = "hop-ad-hoc-start",
95
+ HOP_INVITE_REQUEST = "hop-invite-request",
96
+ HOP_GET_SESSION = "hop-get-session",
97
+ HOP_MEETING_CREATE = "hop-meeting-create",
98
+ HOP_MEETING_CANCEL = "hop-meeting-cancel",
99
+ HOP_MEETING_LIST = "hop-meeting-list",
100
+ HOP_LIST_PRODUCERS = "hop-list-producers",
101
+ HOP_LIST_PARTICIPANTS = "hop-list-participants",
102
+ HOP_MUTE_PARTICIPANT = "hop-mute-participant",
103
+ HOP_DROP_PARTICIPANT = "hop-drop-participant",
104
+ HOP_PIN_FOR_ALL = "hop-pin-for-all",
105
+ HOP_LIST_ACTIVE = "hop-list-active",
106
+ HOP_TRANSPORT_PARAMS = "hop-transport-params",
107
+ HOP_STARTED = "hop-started",
108
+ HOP_ENDED = "hop-ended",
109
+ HOP_PARTICIPANT_JOINED = "hop-participant-joined",
110
+ HOP_PARTICIPANT_LEFT = "hop-participant-left",
111
+ HOP_NEW_PRODUCER = "hop-new-producer",
112
+ HOP_PRODUCER_CLOSED = "hop-producer-closed",
113
+ HOP_INVITE = "hop-invite",
114
+ HOP_MEETING_UPDATED = "hop-meeting-updated",
115
+ HOP_LOBBY_WAITING = "hop-lobby-waiting",
116
+ HOP_DENIED = "hop-denied",
117
+ HOP_REDIRECT = "hop-redirect",
118
+ HOP_RECORDING_STARTED = "hop-recording-started",
119
+ HOP_RECORDING_STOPPED = "hop-recording-stopped",
120
+ HOP_RECORDING_READY = "hop-recording-ready",
121
+ HOP_RECORDING_ALREADY_ACTIVE = "hop-recording-already-active",
122
+ HOP_RECORDING_FORBIDDEN = "hop-recording-forbidden",
123
+ HOP_INVITE_DECLINED = "hop-invite-declined",
124
+ HOP_SCREENSHARE_STARTED = "hop-screenshare-started",
125
+ HOP_MEDIA_CHANGED = "hop-media-changed",
126
+ HOP_MEETING_REMINDER = "hop-meeting-reminder",
127
+ HOP_PARTICIPANT_MUTED = "hop-participant-muted",
128
+ HOP_PINNED_FOR_ALL = "hop-pinned-for-all",
129
+ HOP_PARTICIPANT_DROPPED = "hop-participant-dropped",
130
+ HOP_YOU_WERE_DROPPED = "hop-you-were-dropped",
131
+ /** You joined this call on another device: stop ringing here (chatta #376). */
132
+ HOP_INVITE_ANSWERED = "hop-invite-answered",
133
+ /** A host asked you to unmute; the mic stays off until you turn it on. */
134
+ HOP_UNMUTE_REQUESTED = "hop-unmute-requested",
135
+ HOP_REACTION = "hop-reaction",
136
+ /** The caller or host alone in a call chose to keep waiting: restarts the auto-end clock. */
137
+ HOP_KEEP_WAITING = "hop-keep-waiting",
138
+ HOP_VOTE = "hop-vote",
139
+ HOP_VOTE_UPDATED = "hop-vote-updated",
140
+ HOP_RAISE_HAND = "hop-raise-hand",
141
+ HOP_NEW_VOTE_ROUND = "hop-new-vote-round",
142
+ HOP_VOTE_COMPLETE = "hop-vote-complete",
143
+ HOP_HOST_CHANGED = "hop-host-changed",
144
+ HOP_MAKE_HOST = "hop-make-host",
145
+ HOP_ADMITTED = "hop-admitted",
146
+ HOP_CO_HOST_ASSIGN = "hop-co-host-assign",
147
+ HOP_CO_HOST_ASSIGNED = "hop-co-host-assigned",
148
+ HOP_POLL_LAUNCH = "hop-poll-launch",
149
+ HOP_POLL_LAUNCHED = "hop-poll-launched",
150
+ HOP_POLL_VOTE = "hop-poll-vote",
151
+ HOP_POLL_VOTE_UPDATED = "hop-poll-vote-updated",
152
+ HOP_WHITEBOARD_SYNC = "hop-whiteboard-sync",
153
+ HOP_WHITEBOARD_DELTA = "hop-whiteboard-delta",
154
+ HOP_POLL_CLOSE = "hop-poll-close",
155
+ HOP_COLLAB_STATE = "hop-collab-state",
156
+ HOP_CAPTIONS_TOGGLE = "hop-captions-toggle",
157
+ HOP_CAPTION = "hop-caption",
158
+ HOP_RECORDING_LIST = "hop-recording-list",
159
+ HOP_CAPTIONS_STATE = "hop-captions-state",
160
+ HOP_CAPTION_TEXT = "hop-caption-text",
161
+ AI_CREDITS_UPDATED = "ai-credits-updated",
162
+ AI_CREDITS_EXHAUSTED = "ai-credits-exhausted",
163
+ WHITEBOARD_OPEN = "whiteboard-open",
164
+ WHITEBOARD_STROKE = "whiteboard-stroke",
165
+ WHITEBOARD_CLEAR = "whiteboard-clear",
166
+ WHITEBOARD_CLOSE = "whiteboard-close",
167
+ WHITEBOARD_SNAPSHOT = "whiteboard-snapshot",
168
+ CREATE_AUTOMATION = "create-automation",
169
+ UPDATE_AUTOMATION = "update-automation",
170
+ DELETE_AUTOMATION = "delete-automation",
171
+ GET_AUTOMATIONS = "get-automations",
172
+ START_WEBINAR = "start-webinar",
173
+ RAISE_HAND = "raise-hand",
174
+ LOWER_HAND = "lower-hand",
175
+ PROMOTE_ATTENDEE_AUDIO = "promote-attendee-audio",
176
+ WEBINAR_QA_SUBMIT = "webinar-qa-submit",
177
+ WEBINAR_QA_ANSWER = "webinar-qa-answer",
178
+ WEBINAR_STARTED = "webinar-started",
179
+ WEBINAR_HAND_RAISED = "webinar-hand-raised",
180
+ WEBINAR_HAND_LOWERED = "webinar-hand-lowered",
181
+ WEBINAR_ATTENDEE_PROMOTED = "webinar-attendee-promoted",
182
+ WEBINAR_QA_UPDATED = "webinar-qa-updated",
183
+ GET_CONVERSATION_STATS = "get-conversation-stats",
184
+ UPDATE_CHAT_USER_SETTINGS = "update-chat-user-settings",
185
+ MESSAGE_DELIVERED = "message-delivered",
186
+ MESSAGE_INFO = "message-info",
187
+ MUTE_CONVERSATION = "mute-conversation",
188
+ CONVERSATION_MUTED = "conversation-muted",
189
+ UPDATE_QUIET_HOURS = "update-quiet-hours",
190
+ QUIET_HOURS_UPDATED = "quiet-hours-updated",
191
+ SET_MESSAGE_REMINDER = "set-message-reminder",
192
+ CANCEL_MESSAGE_REMINDER = "cancel-message-reminder",
193
+ MESSAGE_REMINDERS_CHANGED = "message-reminders-changed",
194
+ MESSAGE_REMINDER_DUE = "message-reminder-due",
195
+ UPDATE_CONVERSATION_PERMISSIONS = "update-conversation-permissions",
196
+ CONVERSATION_PERMISSIONS_UPDATED = "conversation-permissions-updated",
197
+ HUDDLE_START = "huddle-start",
198
+ HUDDLE_STATUS = "huddle-status",
199
+ HUDDLE_END = "huddle-end",
200
+ HUDDLE_UPDATED = "huddle-updated",
201
+ TRANSCRIBE_MESSAGE = "transcribe-message",
202
+ MESSAGE_TRANSCRIPT_UPDATED = "message-transcript-updated",
203
+ INBOX_UPDATED = "inbox-updated",
204
+ INTERNAL_NOTE = "internal-note",
205
+ INTERNAL_NOTE_DELETED = "internal-note-deleted",
206
+ CONVERSATION_NOTES_UPDATED = "conversation-notes-updated",
207
+ CSAT_UPDATED = "csat-updated",
208
+ CONVERSATION_READ = "conversation-read",
209
+ CONVERSATION_UNREAD = "conversation-unread",
210
+ /** Ack-only: unread per sidebar lane over the whole list (chatta #427). */
211
+ UNREAD_TOTALS = "unread-totals",
212
+ DELETE_MESSAGE = "delete-message",
213
+ MESSAGE_DELETED = "message-deleted",
214
+ SEARCH_ALL = "search-all",
215
+ SUBMIT_PRE_CHAT = "submit-pre-chat",
216
+ PRE_CHAT_SUBMITTED = "pre-chat-submitted",
217
+ LINK_SETTINGS_UPDATED = "link-settings-updated",
218
+ CALL_LOGGED = "call-logged",
219
+ STICKERS_MINE = "stickers-mine",
220
+ STICKERS_SEARCH = "stickers-search",
221
+ STICKER_UPLOAD = "sticker-upload",
222
+ STICKER_ADD = "sticker-add",
223
+ STICKER_REMOVE = "sticker-remove",
224
+ CHATTA_MONEY_CARD = "chatta-money-card",
225
+ CHATTA_MONEY_CONFIRM = "chatta-money-confirm",
226
+ MONEY_CARD_GET = "money-card-get",
227
+ MONEY_CARD_ACTION = "money-card-action",
228
+ MONEY_CARD_UPDATE = "money-card-update",
229
+ WEBINAR_QA_ANSWER_LIVE = "webinar-qa-answer-live",
230
+ WEBINAR_QA_VOTE = "webinar-qa-vote",
231
+ WEBINAR_VIEWER_COUNT = "webinar-viewer-count"
232
+ }
233
+ /** SDK lifecycle events (not socket events) */
234
+ export declare enum SDKEvent {
235
+ CONNECTING = "sdk:connecting",
236
+ CONNECTED = "sdk:connected",
237
+ DISCONNECTED = "sdk:disconnected",
238
+ RECONNECTING = "sdk:reconnecting",
239
+ RECONNECTED = "sdk:reconnected",
240
+ ERROR = "sdk:error",
241
+ QUEUE_FLUSH = "sdk:queue-flush"
242
+ }