@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,190 @@
1
+ export interface InitOptions {
2
+ /** Required — chat link code */
3
+ linkCode: string;
4
+ /** Required — API key for authentication */
5
+ apiKey: string;
6
+ /** Base URL of the LiveChatta server. Default: https://api.livechatta.com */
7
+ baseUrl?: string;
8
+ /** Chat username identifying the individual user. Required for embed mode (each embed is per-user). Optional for headless mode. */
9
+ chatUsername?: string;
10
+ /** Required — RSA public key (PEM) for encrypting embed tokens */
11
+ publicKey: string;
12
+ /** Enable WebSocket transport. Default: true */
13
+ enableSocket?: boolean;
14
+ /** Enable HTTP transport. Default: true */
15
+ enableHttp?: boolean;
16
+ /** Enable debug logging. Default: false */
17
+ debug?: boolean;
18
+ /** Owner account access token (JWT) for owner-console routes; keep server-side. */
19
+ ownerToken?: string;
20
+ /** Chat-member access token (JWT, e.g. from bridge `onLoginSuccess`) for member REST routes. */
21
+ memberToken?: string;
22
+ }
23
+ export type { ThemeMode } from '../ui/brand';
24
+ import type { ThemeMode } from '../ui/brand';
25
+ import type { BusinessHours } from '../ui/hours';
26
+ import type { PreChatForm, PreChatValues } from '../ui/prechat';
27
+ export type { BusinessHours, BusinessHoursWindow, AwayState } from '../ui/hours';
28
+ export type { PreChatForm, PreChatField, PreChatFieldType, PreChatValues } from '../ui/prechat';
29
+ /** Corner the floating launcher sits in. */
30
+ export type EmbedPosition = 'bottom-right' | 'bottom-left';
31
+ /** Message layout inside the chat (passed through as `?layout=`). */
32
+ export type EmbedLayout = 'bubbles' | 'lines';
33
+ /** Floating launcher/widget options. All optional; omit `floating` for the classic inline iframe. */
34
+ export interface LauncherOptions {
35
+ /** Render a floating launcher + chat panel instead of an inline iframe. Default: false */
36
+ floating?: boolean;
37
+ /** Launcher corner. Default: 'bottom-right' */
38
+ position?: EmbedPosition;
39
+ /** Open the panel as soon as it mounts. Default: false */
40
+ autoOpen?: boolean;
41
+ /** Proactive greeting shown next to the closed launcher; dismissal is remembered per link. */
42
+ greeting?: string;
43
+ /** Delay before the greeting appears, in ms. Default: 10000 */
44
+ greetingDelay?: number;
45
+ /** Panel header title (e.g. your link or brand name). Default: 'Chat' */
46
+ title?: string;
47
+ /** Panel header subtitle (e.g. 'Usually replies in 5 min') */
48
+ subtitle?: string;
49
+ /** Accessible label for the launcher button. Default: 'Open chat' */
50
+ launcherLabel?: string;
51
+ /** z-index of the launcher and panel. Default: 2147483000 */
52
+ zIndex?: number;
53
+ /** Load the chat iframe on mount so unread counts and link brand arrive while closed. Default: true */
54
+ preload?: boolean;
55
+ /** Called whenever the panel opens or closes. */
56
+ onOpenChange?: (open: boolean) => void;
57
+ /** Guest pre-chat form (name, email, optional topic), shown once per link. `true` = defaults. */
58
+ preChat?: boolean | PreChatForm;
59
+ /** Await to register or route the guest before the chat opens; throw to show an error. */
60
+ onPreChatSubmit?: (values: PreChatValues) => void | Promise<void>;
61
+ /** Opening hours; outside them the panel opens on the away state ("back Mon 9:00"). */
62
+ businessHours?: BusinessHours;
63
+ /** Adds "leave a message" to the away state; await to deliver it (email, ticket, your API). */
64
+ onAwayMessage?: (message: string, values: PreChatValues | null) => void | Promise<void>;
65
+ /** Read pre-chat / hours / greeting from the link's widget settings. Default: true (floating). */
66
+ linkConfig?: boolean;
67
+ }
68
+ export interface UIOptions extends LauncherOptions {
69
+ /** CSS selector or DOM element to mount the iframe into. Required unless `floating: true`. */
70
+ container?: string | HTMLElement;
71
+ /** Width of the iframe (inline) or panel (floating). Default: '100%' inline, '380px' floating */
72
+ width?: string;
73
+ /** Height of the iframe (inline) or panel (floating). Default: '600px' inline, '640px' floating */
74
+ height?: string;
75
+ /** Primary brand colour. Default: the link's theme, else Signal '#D2400B' ('#6C5CE7' = no brand) */
76
+ primaryColor?: string;
77
+ /** Secondary colour. Default: the link's theme, else Signal lagoon '#0B6E66' */
78
+ secondaryColor?: string;
79
+ /** Lighter shade of primary. Auto-generated from primaryColor if omitted */
80
+ primaryLight?: string;
81
+ /** Darker shade of primary. Auto-generated from primaryColor if omitted */
82
+ primaryDark?: string;
83
+ /** Primary background tint (e.g. rgba). Auto-generated from primaryColor if omitted */
84
+ primaryBg?: string;
85
+ /** Chat canvas background (light mode only; dark mode uses Signal charcoal) */
86
+ bg?: string;
87
+ /** Chat canvas background in dark mode (used only if it keeps >= 10:1 against text) */
88
+ bgDark?: string;
89
+ /** Primary text colour (light mode; replaced if under 4.5:1 on bg) */
90
+ textColor?: string;
91
+ /** Secondary text colour (light mode) */
92
+ textLight?: string;
93
+ /** Muted/disabled text colour (light mode) */
94
+ textMuted?: string;
95
+ /** Border colour (light mode) */
96
+ borderColor?: string;
97
+ /** Light border colour (light mode) */
98
+ borderLight?: string;
99
+ /** Custom font family */
100
+ fontFamily?: string;
101
+ /** Custom logo URL (https) */
102
+ logoUrl?: string;
103
+ /** Theme mode, sent as `?theme=`. Default: 'light' inline, 'system' floating */
104
+ theme?: ThemeMode;
105
+ /** Message layout. Default: the link's setting */
106
+ layout?: EmbedLayout;
107
+ /**
108
+ * 'auto' (default) picks `/app/embed/chat` inside a detected native shell, else `/embed/chat`;
109
+ * 'web' / 'app' force one route ('app' adds the HMAC signature for custom WebView shells). */
110
+ embedMode?: 'auto' | 'web' | 'app';
111
+ /** App version string baked into the HMAC signature. Default: '1.0.0'. */
112
+ appVersion?: string;
113
+ }
114
+ /** Theme-only subset of UIOptions for updateTheme() calls */
115
+ export type ThemeOptions = Pick<UIOptions, 'primaryColor' | 'secondaryColor' | 'primaryLight' | 'primaryDark' | 'primaryBg' | 'bg' | 'bgDark' | 'textColor' | 'textLight' | 'textMuted' | 'borderColor' | 'borderLight' | 'fontFamily' | 'logoUrl' | 'theme'>;
116
+ /** Color keys that store hex values (stored without '#' internally) */
117
+ export declare const THEME_COLOR_KEYS: readonly ["primaryColor", "secondaryColor", "primaryLight", "primaryDark", "primaryBg", "bg", "bgDark", "textColor", "textLight", "textMuted", "borderColor", "borderLight"];
118
+ /** All theme keys including non-color properties */
119
+ export declare const THEME_ALL_KEYS: readonly ["primaryColor", "secondaryColor", "primaryLight", "primaryDark", "primaryBg", "bg", "bgDark", "textColor", "textLight", "textMuted", "borderColor", "borderLight", "fontFamily", "logoUrl", "theme"];
120
+ /** Launcher + layout keys that framework wrappers forward unchanged to LiveChattaEmbed. */
121
+ export declare const EMBED_OPTION_KEYS: readonly ["floating", "position", "autoOpen", "greeting", "greetingDelay", "title", "subtitle", "launcherLabel", "zIndex", "preload", "layout", "onOpenChange", "preChat", "onPreChatSubmit", "businessHours", "onAwayMessage", "linkConfig"];
122
+ /** Copy defined properties from a source object to a target, for the given keys. */
123
+ export declare function assignDefinedProps<T extends Record<string, unknown>>(source: T, target: Record<string, string>, keys: readonly string[]): void;
124
+ /** Returns a new object with only the defined `keys` of `source` (wrapper prop forwarding). */
125
+ export declare function pickDefined<K extends string>(source: Partial<Record<K, unknown>>, keys: readonly K[]): Partial<Record<K, any>>;
126
+ /**
127
+ * Server page caps (chatta #417, #427): a larger `limit` gets the capped page plus a cursor; 0, negative or junk gets
128
+ * the route default. `conversations` = REST lists (default 10); `sidebarConversations` = socket `all-conversations`. */
129
+ export declare const SERVER_PAGE_CAPS: {
130
+ readonly conversations: 100;
131
+ readonly sidebarConversations: 40;
132
+ readonly messages: 50;
133
+ readonly stories: 20;
134
+ readonly billingHistory: 100;
135
+ readonly signups: 100;
136
+ readonly giftPurchases: 100;
137
+ readonly cursorLists: 20;
138
+ };
139
+ /** Socket `all-conversations` default page size, also its cap; keep one size for every page of a list (chatta #427). */
140
+ export declare const SIDEBAR_PAGE_SIZE = 40;
141
+ export interface PaginationQuery {
142
+ [key: string]: string | undefined;
143
+ nextCursor?: string;
144
+ prevCursor?: string;
145
+ limit?: string;
146
+ }
147
+ export interface MemberQuery extends PaginationQuery {
148
+ chatUserSearch?: string;
149
+ chatUserByIds?: string;
150
+ chatUserByStatuses?: string;
151
+ chatUserByOwnerIds?: string;
152
+ chatUserByIsChattingOnline?: string;
153
+ chatDateRange?: string;
154
+ }
155
+ export interface ChatLinkQuery extends PaginationQuery {
156
+ chatLinkSearch?: string;
157
+ chatLinkByStatuses?: string;
158
+ chatLinkByLinkTypes?: string;
159
+ chatLinkByConversationTypes?: string;
160
+ chatLinkByOwnerIds?: string;
161
+ chatLinkByCodes?: string;
162
+ chatDateRange?: string;
163
+ /** Owner `GET /chats/links`: ACTIVE links expiring within N days (1–365, default 7). */
164
+ chatLinkExpiringDays?: string;
165
+ }
166
+ export interface ConversationQuery extends PaginationQuery {
167
+ chatUserSearch?: string;
168
+ chatUserByStatuses?: string;
169
+ chatUserByRoles?: string;
170
+ chatByIsLocked?: string;
171
+ chatByIsPinned?: string;
172
+ chatByIsArchived?: string;
173
+ chatByIsStarred?: string;
174
+ chatByIsBlocked?: string;
175
+ chatDateRange?: string;
176
+ }
177
+ export interface MessageQuery extends PaginationQuery {
178
+ chatMessageSearch?: string;
179
+ chatMessageByTypes?: string;
180
+ chatMessageByStatuses?: string;
181
+ chatMessageByDeliveryStatuses?: string;
182
+ chatMessageBySenderIds?: string;
183
+ chatMessageByDeleted?: string;
184
+ chatMessageByIsPinned?: string;
185
+ chatMessageByIsStarred?: string;
186
+ chatMessageByIsBlocked?: string;
187
+ chatDateRange?: string;
188
+ /** '1': `readBy` / `deliveredTo` keep only the caller's entry, plus `readCount` / `deliveredCount`. */
189
+ compactReceipts?: '1';
190
+ }
@@ -0,0 +1,236 @@
1
+ import type { UserStatus } from './models';
2
+ export type SharedChannelStatus = 'PENDING' | 'ACTIVE' | 'DECLINED' | 'REVOKED' | 'ENDED' | 'EXPIRED';
3
+ /** `ALL` is the accepting workspace's own team (verified owner, admins, agents), never customers. `PICKED` is a list of members. */
4
+ export type SharedChannelAudience = 'ALL' | 'PICKED';
5
+ /** `CODE`: the partner's link code, accepted by id. `LINK`: a single-use token. */
6
+ export type SharedChannelInviteKind = 'CODE' | 'LINK';
7
+ /** `DM` rows are shared direct messages; they never appear in `listSharedChannels`. */
8
+ export type SharedChannelKind = 'CHANNEL' | 'DM';
9
+ export type SharedChannelSide = 'HOST' | 'PARTNER';
10
+ /** Limits the server enforces (the server answers 400 past them). */
11
+ export declare const SHARED_CHANNEL_LIMITS: {
12
+ readonly inviteDefaultHours: 168;
13
+ readonly inviteMaxHours: 720;
14
+ readonly maxPickedMembers: 500;
15
+ readonly maxPartners: 10;
16
+ readonly archiveMaxMessages: 10000;
17
+ readonly pickPageSize: 20;
18
+ readonly listPageSize: 30;
19
+ readonly auditPageSize: 30;
20
+ };
21
+ /** Names only: the badge a conversation carries while it is shared ("shared with <workspace>"). */
22
+ export interface SharedWith {
23
+ name: string;
24
+ side: SharedChannelSide;
25
+ /** True on a partner's read-only archive after the share ended. */
26
+ ended?: boolean;
27
+ }
28
+ /**
29
+ * A person of another workspace as a shared conversation shows them: names and @handle only.
30
+ * There is never an `email`, `phone`, `mobile`, `phoneNumber`, `accountId` or workspace owner id on it, and `username`
31
+ * is the @handle, not an email login (it can be missing). Show `displayName`, then `handle`; never build a label from an email.
32
+ */
33
+ export interface SharedParticipant {
34
+ /** Chat user id inside their own workspace. Use it for `openSharedDirect` and `removeSharedChannelMember`; it says nothing about their account. */
35
+ _id: string;
36
+ displayName?: string;
37
+ handle?: string;
38
+ /** The @handle in a shared conversation. Never an email address. */
39
+ username?: string;
40
+ firstName?: string;
41
+ lastName?: string;
42
+ photo?: string;
43
+ profilePhoto?: string;
44
+ status?: UserStatus;
45
+ isChattingOnline?: boolean;
46
+ }
47
+ /** One share as the caller's own workspace may see it: no token hash, no member ids, no foreign owner. */
48
+ export interface SharedChannelView {
49
+ _id: string;
50
+ conversationId: string;
51
+ conversationName: string;
52
+ kind: SharedChannelKind;
53
+ /** Which side the caller's workspace is on. */
54
+ side: SharedChannelSide;
55
+ status: SharedChannelStatus;
56
+ inviteKind: SharedChannelInviteKind;
57
+ hostName: string;
58
+ partnerName: string;
59
+ audience: SharedChannelAudience;
60
+ /** Partner members who currently have the channel. */
61
+ memberCount: number;
62
+ invitedByName: string;
63
+ expiresAt: string | null;
64
+ createdAt: string;
65
+ acceptedAt: string | null;
66
+ endedAt: string | null;
67
+ endedSide: SharedChannelSide | null;
68
+ /** The read-only copy the partner keeps after the share ended. */
69
+ archiveConversationId: string | null;
70
+ }
71
+ /** `GET /shared-channels` and `GET /shared-channels/conversations/:id` query: the workspace you are signed in to. */
72
+ export interface SharedChannelScopeQuery {
73
+ chatLinkId: string;
74
+ }
75
+ export interface SharedChannelListQuery extends SharedChannelScopeQuery {
76
+ nextCursor?: string;
77
+ }
78
+ export interface SharedChannelPage {
79
+ results: SharedChannelView[];
80
+ nextCursor: string | null;
81
+ }
82
+ /** `inviteSharedChannel` body. Host owner or team admin only. */
83
+ export interface InviteSharedChannelPayload {
84
+ /** The host workspace you are signed in to. */
85
+ chatLinkId: string;
86
+ /** A group or channel of that workspace. */
87
+ conversationId: string;
88
+ /** The partner workspace's link code. Leave it out for a single-use invite link. */
89
+ partnerLinkCode?: string;
90
+ /** 1 to 720; the server default is 168 (7 days). */
91
+ expiresInHours?: number;
92
+ }
93
+ /** The single-use token and URL are in this response once; the server keeps only a hash. */
94
+ export interface SharedChannelInviteResult {
95
+ sharedChannel: SharedChannelView;
96
+ inviteToken?: string;
97
+ /** `<app>/my/chat-links#shared-invite=<token>`; the token sits in the fragment, so no server or log sees it. */
98
+ inviteUrl?: string;
99
+ }
100
+ /** What a token holder sees before accepting; looking does not use the link up. */
101
+ export interface SharedChannelPreview {
102
+ hostName: string;
103
+ channelName: string;
104
+ invitedByName: string;
105
+ expiresAt: string | null;
106
+ }
107
+ export interface SharedChannelPreviewPayload {
108
+ token: string;
109
+ }
110
+ /** `acceptSharedChannel`, `acceptSharedChannelByToken` and `updateSharedChannelMembers` body. Partner owner or team admin only. */
111
+ export interface AcceptSharedChannelPayload {
112
+ /** The partner workspace you are signed in to. */
113
+ chatLinkId: string;
114
+ audience: SharedChannelAudience;
115
+ /** Required with `PICKED` (1 to 500 members of your workspace). */
116
+ memberIds?: string[];
117
+ }
118
+ export interface AcceptSharedChannelByTokenPayload extends AcceptSharedChannelPayload {
119
+ /** The single-use token from the invite link. */
120
+ token: string;
121
+ }
122
+ /** `GET /shared-channels/members` query: pick people of your workspace for `PICKED`. */
123
+ export interface SharedChannelMembersQuery extends SharedChannelScopeQuery {
124
+ /** Name or handle, up to 40 characters. */
125
+ q?: string;
126
+ /** Marks who already has this share. */
127
+ sharedChannelId?: string;
128
+ nextCursor?: string;
129
+ }
130
+ /** A person of your own workspace the admin can pick: display name and handle only. */
131
+ export interface SharedChannelPickableMember {
132
+ _id: string;
133
+ displayName: string;
134
+ handle: string;
135
+ photo: string;
136
+ /** Has the channel now. */
137
+ enrolled: boolean;
138
+ }
139
+ export interface SharedChannelMembersPage {
140
+ results: SharedChannelPickableMember[];
141
+ nextCursor: string | null;
142
+ }
143
+ export type SharedChannelAuditAction = 'INVITED' | 'INVITE_CANCELLED' | 'ACCEPTED' | 'DECLINED' | 'MEMBERS_CHANGED' | 'MEMBER_REMOVED' | 'ENDED_BY_HOST' | 'LEFT_BY_PARTNER' | 'EXPIRED' | 'DM_OPENED' | 'MESSAGE_MODERATED' | 'REFUSED';
144
+ /** One line of your own workspace's activity log for a share. Each side reads only its own. */
145
+ export interface SharedChannelAuditView {
146
+ _id: string;
147
+ action: SharedChannelAuditAction;
148
+ actorName: string;
149
+ detail: string;
150
+ createdAt: string;
151
+ }
152
+ export interface SharedChannelAuditPage {
153
+ results: SharedChannelAuditView[];
154
+ nextCursor: string | null;
155
+ }
156
+ /** What your workspace may do in a shared channel, and which members come from another workspace. */
157
+ export interface SharedConversationPermissions {
158
+ /** `null` when the conversation is not shared with you. */
159
+ side: SharedChannelSide | null;
160
+ canRemoveMessages: boolean;
161
+ canRemoveMembers: boolean;
162
+ /** Ids of members who belong to another workspace than yours. */
163
+ externalIds: string[];
164
+ }
165
+ /** `openSharedDirect` body: message a person of a partner workspace you share an active channel with. Both workspaces must allow it. */
166
+ export interface OpenSharedDirectPayload {
167
+ chatLinkId: string;
168
+ /** A shared channel you both are in. */
169
+ conversationId: string;
170
+ memberId: string;
171
+ }
172
+ export interface SharedDirectResult {
173
+ /** The person is in your own workspace: use the normal direct message flow. */
174
+ internal?: boolean;
175
+ conversationId?: string;
176
+ created?: boolean;
177
+ }
178
+ /** `removeSharedChannelMember` body. The host removes one partner member; it holds across a re-share of the same channel. */
179
+ export interface RemoveSharedMemberPayload {
180
+ chatLinkId: string;
181
+ conversationId: string;
182
+ memberId: string;
183
+ }
184
+ /** `removeSharedChannelMessage` body. Wipes the message for everyone and writes an activity line on both sides. */
185
+ export interface RemoveSharedMessagePayload {
186
+ chatLinkId: string;
187
+ conversationId: string;
188
+ messageId: string;
189
+ }
190
+ export interface RemoveSharedMessageResult {
191
+ messageId: string;
192
+ }
193
+ /** `shared-channel-invite` and the staff form of `shared-channel-updated`: to the owner and admins of a workspace. */
194
+ export interface SharedChannelEvent {
195
+ sharedChannelId: string;
196
+ conversationId: string;
197
+ status: SharedChannelStatus;
198
+ /** The side of the workspace that receives the event. */
199
+ side: SharedChannelSide;
200
+ hostName?: string;
201
+ partnerName?: string;
202
+ channelName?: string;
203
+ /** The partner's read-only copy, on an ended share. */
204
+ archiveConversationId?: string;
205
+ }
206
+ /** The badge form of `shared-channel-updated`: to the channel's members, names only. */
207
+ export interface SharedChannelBadgeEvent {
208
+ conversationId: string;
209
+ sharedWith: SharedWith[];
210
+ }
211
+ export type SharedChannelUpdatedEvent = SharedChannelEvent | SharedChannelBadgeEvent;
212
+ /** `linkChatUserToAccount` body (owner token): bind a verified teammate to the chat user that is theirs. */
213
+ export interface LinkChatUserToAccountPayload {
214
+ /** A verified member of your team. */
215
+ accountId: string;
216
+ /** Your chat user that uses the teammate's email. */
217
+ chatUserId: string;
218
+ }
219
+ export interface LinkChatUserToAccountResult {
220
+ linked: true;
221
+ }
222
+ /** Error `code` of the isolated-workspace switch (`ChatLinkSettingsPatch.isolated`): 403 on a blocked path. */
223
+ export declare const ISOLATION_ERRORS: readonly ["WORKSPACE_ISOLATED"];
224
+ export type IsolationError = (typeof ISOLATION_ERRORS)[number];
225
+ /** True for the badge form of `shared-channel-updated`. */
226
+ export declare function isSharedChannelBadgeEvent(e: SharedChannelUpdatedEvent): e is SharedChannelBadgeEvent;
227
+ /** True while a conversation carries a live share badge (an ended one is a read-only archive). */
228
+ export declare function isSharedConversation(conversation: {
229
+ sharedWith?: SharedWith[] | null;
230
+ } | null | undefined): boolean;
231
+ /** True for the read-only copy a partner keeps after the share ended. */
232
+ export declare function isSharedArchive(conversation: {
233
+ sharedWith?: SharedWith[] | null;
234
+ } | null | undefined): boolean;
235
+ /** A display label for a person in a shared conversation: display name, handle, first and last name, then 'Member'. A value that looks like an email or a phone number is skipped, never shown. */
236
+ export declare function sharedParticipantLabel(p: Partial<SharedParticipant> | null | undefined): string;
@@ -0,0 +1,95 @@
1
+ /** `livechatta` is the built-in default pack. */
2
+ export type GifProviderName = 'klipy' | 'giphy' | 'livechatta';
3
+ export type GifRating = 'g' | 'pg';
4
+ /** `default` when no provider is set, one is down, or a search found nothing. */
5
+ export type GifSource = 'provider' | 'default';
6
+ /** Which GIFs a request wants: `livechatta` is the built-in pack only, `provider` is GIPHY or Klipy only. */
7
+ export type GifTab = 'livechatta' | 'provider';
8
+ export type GifReportReason = 'sexual' | 'violent' | 'hateful' | 'spam' | 'other';
9
+ /** One GIF as every provider is mapped to it. Provider keys and analytics URLs never appear. */
10
+ export interface GifItem {
11
+ /** Provider id; the slug for the default pack. */
12
+ id: string;
13
+ provider: GifProviderName;
14
+ title: string;
15
+ /** Full-size animated GIF (https). */
16
+ url: string;
17
+ /** Small animated preview for a picker grid (https). */
18
+ previewUrl: string;
19
+ width: number;
20
+ height: number;
21
+ rating: GifRating;
22
+ /** "via GIPHY" or "via KLIPY" for provider GIFs; show it when set. */
23
+ attribution?: string;
24
+ tags?: string[];
25
+ }
26
+ export interface GifPage {
27
+ results: GifItem[];
28
+ nextCursor: string | null;
29
+ hasMore: boolean;
30
+ source: GifSource;
31
+ /** True when the default pack stands in for a provider that failed or had nothing. */
32
+ fallback: boolean;
33
+ /** A provider is configured: offer a provider tab. */
34
+ hasProviders: boolean;
35
+ /** Label for the provider tab: "GIPHY", "Klipy", or "More GIFs" for both; empty with no provider. */
36
+ providerLabel: string;
37
+ /** True when a `source: 'livechatta'` search matched nothing and these are provider results: switch to the provider tab. */
38
+ switched: boolean;
39
+ }
40
+ /** Query for `searchGifs` and `trendingGifs`. An empty `q` on a search returns trending. */
41
+ export interface GifQuery {
42
+ /** Up to 60 characters. */
43
+ q?: string;
44
+ nextCursor?: string;
45
+ /** `livechatta` always answers from the built-in pack; `provider` only from the provider. Left out: provider first, pack as the fallback. */
46
+ source?: GifTab;
47
+ }
48
+ /** What the member's GIF picker may rely on. `enabled: false` means GIF search is off; the other GIF routes then answer 404. */
49
+ export interface GifConfigView {
50
+ enabled: boolean;
51
+ providers: GifProviderName[];
52
+ /** Label for the provider tab; empty with no provider. */
53
+ providerLabel: string;
54
+ /** Business plans always get `g`. */
55
+ rating: GifRating;
56
+ }
57
+ /** `registerGifShare`: call once after a GIF was sent (some providers require the ping). */
58
+ export interface GifShareRef {
59
+ provider: GifProviderName;
60
+ id: string;
61
+ /** The search that found it, if any. */
62
+ q?: string;
63
+ }
64
+ export interface GifShareResult {
65
+ ok: boolean;
66
+ counted: boolean;
67
+ }
68
+ export interface GifReportResult {
69
+ ok: boolean;
70
+ }
71
+ export interface ReportGifPayload {
72
+ provider: GifProviderName;
73
+ id: string;
74
+ reason: GifReportReason;
75
+ /** Up to 300 characters. */
76
+ note?: string;
77
+ /** The message the GIF came in, when reporting from a chat. */
78
+ messageId?: string;
79
+ }
80
+ /** Send a GIF with `sendMessage({ gif })`: only the provider and id; the server looks the GIF up itself. */
81
+ export interface GifRef {
82
+ provider: GifProviderName;
83
+ id: string;
84
+ }
85
+ /** The server-resolved GIF on a GIF message (also mirrored as a `gif:<id>` PHOTO attachment for older clients). */
86
+ export interface MessageGif {
87
+ id: string;
88
+ provider: GifProviderName;
89
+ title: string;
90
+ url: string;
91
+ previewUrl: string;
92
+ width: number;
93
+ height: number;
94
+ attribution?: string;
95
+ }