@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,35 @@
1
+ export type PreChatFieldType = 'text' | 'email' | 'tel' | 'select' | 'textarea';
2
+ export interface PreChatField {
3
+ /** Key in the submitted values, e.g. 'name', 'email', 'topic'. */
4
+ name: string;
5
+ label: string;
6
+ type?: PreChatFieldType;
7
+ required?: boolean;
8
+ /** Choices for `type: 'select'`. */
9
+ options?: string[];
10
+ placeholder?: string;
11
+ }
12
+ export interface PreChatForm {
13
+ /** Off switch for link-provided config. Default: true. */
14
+ enabled?: boolean;
15
+ /** Fields in order. Default: name + email (both required), plus topic when `topics` is set. */
16
+ fields?: PreChatField[];
17
+ /** Shortcut for a required "What do you need?" select. */
18
+ topics?: string[];
19
+ /** Panel copy above the form. */
20
+ intro?: string;
21
+ /** Submit button text. Default: 'Start chat' */
22
+ submitLabel?: string;
23
+ /** Small print under the button. Default: 'We only use your email to reply.' */
24
+ note?: string;
25
+ }
26
+ export type PreChatValues = Record<string, string>;
27
+ export interface ResolvedPreChat extends PreChatForm {
28
+ fields: PreChatField[];
29
+ submitLabel: string;
30
+ note: string;
31
+ }
32
+ /** Resolves `true` / a config / link config into a field list, or null when off. */
33
+ export declare function resolvePreChat(input?: boolean | PreChatForm | null): ResolvedPreChat | null;
34
+ /** Per-field error messages (empty object = valid). Values are trimmed first. */
35
+ export declare function validatePreChat(fields: PreChatField[], values: PreChatValues): Record<string, string>;
@@ -0,0 +1,4 @@
1
+ import type { WidgetConfig } from '../types/chat-core';
2
+ import type { LinkWidgetConfig } from '../types/models';
3
+ /** `topics` (link inbox topic labels) turn the topic field into a select. */
4
+ export declare function toLinkWidgetConfig(cfg: WidgetConfig | null | undefined, topics?: string[]): LinkWidgetConfig;
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Browser-compatible RSA-OAEP encryption using Web Crypto API.
3
+ * Falls back to Node.js crypto module when WebCrypto is unavailable.
4
+ */
5
+ import type { EmbedTokenPayload } from '../types/models';
6
+ export declare function encryptEmbedToken(pemPublicKey: string, payload: EmbedTokenPayload): Promise<string>;
@@ -0,0 +1,40 @@
1
+ /**
2
+ * HMAC-SHA256 helpers for building the `x-chatta-app` signature that
3
+ * unlocks the `/in/:linkCode/app/embed/chat` route.
4
+ *
5
+ * Signed message format (fixed — keep in sync across all implementations):
6
+ * `CHATTA-APP:{platform}:{version}:{hex}`
7
+ * message = `{linkCode}:{platform}:{version}`
8
+ * hex = lowercase-hex HMAC-SHA256(message, apiKey)
9
+ *
10
+ * === Cross-Reference (3 implementations — update ALL if format changes) ===
11
+ * - Verification: chatta/src/shared/utils/crypto.util.ts (server, Node.js)
12
+ * - App signing: chatta-apps/chatta-app-shared/hmac.js (desktop/mobile shells)
13
+ * - SDK signing: chatta-sdk/src/utils/hmac.ts (this file, SDK consumers)
14
+ *
15
+ * Strategy: Web Crypto API → pure-JS fallback → Node.js crypto (SSR/CLI).
16
+ */
17
+ /** Compute lowercase-hex HMAC-SHA256(message, secret). */
18
+ export declare function hmacSha256Hex(message: string, secret: string): Promise<string>;
19
+ export interface AppSignature {
20
+ /** Full header value: `CHATTA-APP:{platform}:{version}:{hex}`. Set as `x-chatta-app`. */
21
+ header: string;
22
+ /** Same value, ready for `?_app_sig=` (already URL-encoded). */
23
+ querySig: string;
24
+ /** Just the lowercase-hex HMAC. Useful for custom transports. */
25
+ signature: string;
26
+ platform: string;
27
+ version: string;
28
+ }
29
+ /**
30
+ * Build the `CHATTA-APP:{platform}:{version}:{hex}` signature for a given
31
+ * chat link. The caller passes their `linkCode` + `apiKey` (HMAC secret);
32
+ * we return both the header form and the query-param form so they can
33
+ * pick whichever fits their transport.
34
+ */
35
+ export declare function buildAppSignature(opts: {
36
+ linkCode: string;
37
+ platform: string;
38
+ version: string;
39
+ apiKey: string;
40
+ }): Promise<AppSignature>;
@@ -0,0 +1,5 @@
1
+ import type { PermissionDenial } from '../types/chat-features';
2
+ /** Socket / REST error when a non-admin sends to a locked conversation. */
3
+ export declare const CONVERSATION_LOCKED_MESSAGE = "This conversation is locked. Only admins can send messages.";
4
+ /** Returns the denial for a permission/slow-mode error (string, Error, LiveChattaError or ChatError), else null. */
5
+ export declare function parsePermissionDenial(err: unknown): PermissionDenial | null;
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Runtime detection — figures out whether the SDK is running inside a
3
+ * browser tab, a Capacitor mobile shell, a Tauri desktop shell, or a
4
+ * React Native WebView. Drives the embed URL choice (web `/embed/chat`
5
+ * vs app `/app/embed/chat`) and the bridge / permissions implementation.
6
+ */
7
+ export type RuntimeKind = 'web' | 'capacitor-ios' | 'capacitor-android' | 'tauri-macos' | 'tauri-windows' | 'tauri-linux' | 'react-native' | 'node';
8
+ export interface RuntimeInfo {
9
+ kind: RuntimeKind;
10
+ /** Coarse classification used by HMAC signing. */
11
+ platform: 'mobile-ios' | 'mobile-android' | 'desktop-macos' | 'desktop-windows' | 'desktop-linux' | 'web' | 'node';
12
+ /** True when running inside a native shell that hosts the chat in a WebView. */
13
+ isAppShell: boolean;
14
+ }
15
+ export declare function detectRuntime(): RuntimeInfo;
16
+ export declare function getRuntime(): RuntimeInfo;
17
+ /** Force a re-detection (test-only). */
18
+ export declare function _resetRuntimeCache(): void;
@@ -0,0 +1,2 @@
1
+ /** Returns this device's visitor id, creating and storing it on first use. */
2
+ export declare function getPromoVisitorId(): 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
+ }
@@ -0,0 +1,3 @@
1
+ // GIF search (chatta P-N7): one server service reads KLIPY, GIPHY or both, with the 100+ LiveChatta default GIFs as the fallback.
2
+ export {};
3
+ //# sourceMappingURL=workspace-gifs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workspace-gifs.js","sourceRoot":"","sources":["../../src/types/workspace-gifs.ts"],"names":[],"mappings":"AAAA,kIAAkI"}
@@ -0,0 +1,390 @@
1
+ export declare const WORKSPACE_TEAM_NAME_MAX = 40;
2
+ export declare const WORKSPACE_TEAM_DESCRIPTION_MAX = 200;
3
+ export declare const WORKSPACE_TEAM_MAX_MEMBERS = 50;
4
+ export interface WorkspaceTeamView {
5
+ _id: string;
6
+ name: string;
7
+ description: string;
8
+ /** Link the team is scoped to, or null for the whole workspace. */
9
+ chatLink: string | null;
10
+ /** Business User ids (owner or teammates). */
11
+ members: string[];
12
+ memberCount: number;
13
+ createdAt?: string;
14
+ updatedAt?: string;
15
+ }
16
+ export interface WorkspaceTeamList {
17
+ results: WorkspaceTeamView[];
18
+ /** Most teams one workspace may have. */
19
+ max: number;
20
+ }
21
+ export interface CreateWorkspaceTeamPayload {
22
+ /** ≤ 40 chars. */
23
+ name: string;
24
+ /** ≤ 200 chars. */
25
+ description?: string;
26
+ /** Scope to one link; null = whole workspace. */
27
+ chatLinkId?: string | null;
28
+ /** ≤ 50 business User ids. */
29
+ memberIds?: string[];
30
+ }
31
+ /** `memberIds` replaces the list; `chatLinkId: null` clears the scope. */
32
+ export type UpdateWorkspaceTeamPayload = Partial<CreateWorkspaceTeamPayload>;
33
+ export interface WorkspaceTeamDeleteResult {
34
+ status: boolean;
35
+ }
36
+ /** Body of `POST /users/team/invite` (owner or ADMIN teammate). */
37
+ export interface InviteTeamMemberPayload {
38
+ firstName: string;
39
+ lastName?: string;
40
+ /** The teammate's email. */
41
+ username: string;
42
+ /** Default AGENT. */
43
+ teamRole?: 'ADMIN' | 'AGENT';
44
+ /** AGENT only: link ids they can answer (≤ 50); empty = every link. */
45
+ answerLinks?: string[];
46
+ }
47
+ /** The pending teammate (chatta #385 allowlist; disabled until they accept, no secrets). */
48
+ export interface TeamInviteResult {
49
+ _id: string;
50
+ firstName: string;
51
+ lastName: string;
52
+ username: string;
53
+ handle: string;
54
+ teamRole: 'OWNER' | 'ADMIN' | 'AGENT';
55
+ answerLinks: string[];
56
+ invitePending: boolean;
57
+ invitedAt: string | null;
58
+ createdAt: string | null;
59
+ }
60
+ /** Same allowlisted teammate row (chatta `TeamMemberView`). */
61
+ export type TeamMemberView = TeamInviteResult;
62
+ /** Inbox state stamped when a rule assigned through a named team. */
63
+ export interface InboxAssignedTeam {
64
+ assignedTeam?: string | null;
65
+ assignedTeamName?: string | null;
66
+ }
67
+ export interface InviteChatUserPayload {
68
+ /** ≤ 60 chars. */
69
+ firstName: string;
70
+ lastName?: string;
71
+ email: string;
72
+ /** One of your links. */
73
+ chatLinkId: string;
74
+ /** Send the set-password welcome email (default true). */
75
+ sendWelcome?: boolean;
76
+ }
77
+ export interface InviteChatUserResult {
78
+ _id: string;
79
+ /** True when the email already had a chat account (it is added to the link). */
80
+ existed: boolean;
81
+ emailed: 'set-password' | 'added' | 'none';
82
+ }
83
+ /** `GET|POST|DELETE chat-users/links/:linkId/members/:memberId/follow`. */
84
+ export interface MemberFollowStatus {
85
+ chatLinkId: string;
86
+ memberId: string;
87
+ followers: number;
88
+ following: number;
89
+ isFollowing: boolean;
90
+ followsYou: boolean;
91
+ canFollow: boolean;
92
+ }
93
+ export declare const PUSH_REPLY_MAX_LENGTH = 4000;
94
+ /** Reply tokens are single use and live 6 h. */
95
+ export declare const PUSH_REPLY_TTL_SECONDS: number;
96
+ /** String-only FCM data of a chat push to an app that registered with `inlineReply: true`. */
97
+ export interface AndroidChatPushData {
98
+ type: string;
99
+ kind: 'chat';
100
+ conversationId: string;
101
+ linkCode: string;
102
+ linkName: string;
103
+ senderId: string;
104
+ senderName: string;
105
+ title: string;
106
+ preview: string;
107
+ channelId: string;
108
+ groupKey: string;
109
+ threadKey: string;
110
+ /** Numeric string. */
111
+ groupedCount: string;
112
+ replyToken: string;
113
+ /** Epoch ms as a string. */
114
+ replyExpiresAt: string;
115
+ replyUrl: string;
116
+ }
117
+ export interface PushReplyResult {
118
+ sent: true;
119
+ messageId: string;
120
+ conversationId: string;
121
+ /** Next single-use token for a follow-up reply from the same notification. */
122
+ replyToken?: string;
123
+ replyExpiresAt?: number;
124
+ }
125
+ /** One row of `POST commons/upload/form/files?detailed=1`, in request order. */
126
+ export interface UploadFileResult {
127
+ index: number;
128
+ name: string;
129
+ /** Set on success. */
130
+ link?: string;
131
+ /** Set on failure; retry just that file. */
132
+ error?: string;
133
+ }
134
+ /** `POST hops/meetings/guest-pass`, `…/join-by-link` and `…/:id/join-from-channel`. */
135
+ export interface HopMeetingJoinResult {
136
+ conversationId: string;
137
+ conversationCode: string;
138
+ }
139
+ /** `hopMeeting` on a HOP_MEETING message posted into the meeting's "Where" channel. */
140
+ export interface HopMeetingCard {
141
+ meetingConversationId: string;
142
+ code: string;
143
+ title: string;
144
+ startAt: string;
145
+ endAt: string;
146
+ timezone: string;
147
+ hostName: string;
148
+ isWebinar: boolean;
149
+ /** > 1 for a recurring series. */
150
+ occurrences: number;
151
+ }
152
+ export interface WebinarRecordingItem {
153
+ id: string;
154
+ manifestUrl: string;
155
+ durationSec: number;
156
+ startedAt: string;
157
+ }
158
+ export interface WebinarRecordingsView {
159
+ title: string;
160
+ results: WebinarRecordingItem[];
161
+ }
162
+ /** Always `{ sent: true }`: registered or not, nothing is revealed (429 when rate-limited). */
163
+ export interface WebinarRecordingLinkResult {
164
+ sent: true;
165
+ }
166
+ export declare const GIFT_PAYOUT_MIN_MINOR = 1000;
167
+ export interface GiftCatalogItem {
168
+ id: string;
169
+ key: string;
170
+ name: string;
171
+ emoji: string;
172
+ description: string;
173
+ priceMinor: number;
174
+ currency: string;
175
+ }
176
+ export interface SendPeerGiftPayload {
177
+ conversationId: string;
178
+ /** ChatUser id of the person receiving it. */
179
+ recipientId: string;
180
+ /** Catalog key, e.g. 'coffee'. */
181
+ giftKey: string;
182
+ /** ≤ 200 chars. */
183
+ note?: string;
184
+ }
185
+ /** Paystack checkout to open; then `verifyPeerGift(reference)`. */
186
+ export interface PeerGiftCheckout {
187
+ authorizationUrl: string;
188
+ accessCode: string;
189
+ /** `pg_<uuid>`. */
190
+ reference: string;
191
+ amountMinor: number;
192
+ currency: string;
193
+ }
194
+ export interface PeerGiftVerifyResult {
195
+ status: 'success' | 'pending';
196
+ reference: string;
197
+ /** The chat message the gift was shared on. */
198
+ messageId?: string;
199
+ }
200
+ /** `peerGift` on the chat message a gift is shared on (server-set). */
201
+ export interface MessagePeerGift {
202
+ giftId: string;
203
+ key: string;
204
+ name: string;
205
+ emoji: string;
206
+ amountMinor: number;
207
+ currency: string;
208
+ recipientId: string;
209
+ recipientName: string;
210
+ }
211
+ export interface PayeeBalanceView {
212
+ currency: string;
213
+ availableMinor: number;
214
+ pendingPayoutMinor: number;
215
+ lifetimeMinor: number;
216
+ }
217
+ export interface PayoutRequestView {
218
+ id: string;
219
+ payeeId: string;
220
+ payeeName: string;
221
+ payeeEmail: string;
222
+ ownerId: string;
223
+ amountMinor: number;
224
+ currency: string;
225
+ status: 'requested' | 'paid' | 'rejected';
226
+ requestedAt: string;
227
+ }
228
+ export interface ReceivedGiftItem {
229
+ id: string;
230
+ name: string;
231
+ emoji: string;
232
+ amountMinor: number;
233
+ netMinor: number;
234
+ currency: string;
235
+ note: string;
236
+ senderName: string;
237
+ conversationId: string;
238
+ paidAt: string;
239
+ }
240
+ export interface GiftsReceivedPage {
241
+ balance: PayeeBalanceView;
242
+ openPayout: PayoutRequestView | null;
243
+ results: ReceivedGiftItem[];
244
+ nextCursor: string | null;
245
+ prevCursor: string | null;
246
+ hasMore: boolean;
247
+ hasPrev: boolean;
248
+ }
249
+ export interface GiftsReceivedQuery {
250
+ [key: string]: string | undefined;
251
+ nextCursor?: string;
252
+ prevCursor?: string;
253
+ limit?: string;
254
+ }
255
+ export interface GiftPayoutResult {
256
+ payout: PayoutRequestView;
257
+ balance: PayeeBalanceView;
258
+ }
259
+ /** One paid gift in your links, with the platform fee and what the recipient nets. */
260
+ export interface OwnerGiftItem {
261
+ id: string;
262
+ name: string;
263
+ emoji: string;
264
+ amountMinor: number;
265
+ /** Basis points (1000 = 10%). */
266
+ platformFeeBps: number;
267
+ feeMinor: number;
268
+ netMinor: number;
269
+ currency: string;
270
+ senderName: string;
271
+ recipientName: string;
272
+ conversationId: string;
273
+ paidAt: string;
274
+ }
275
+ export interface OwnerGiftTotals {
276
+ currency: string;
277
+ count: number;
278
+ grossMinor: number;
279
+ feeMinor: number;
280
+ netMinor: number;
281
+ }
282
+ export interface OwnerGiftsPage {
283
+ totals: OwnerGiftTotals;
284
+ results: OwnerGiftItem[];
285
+ nextCursor: string | null;
286
+ prevCursor: string | null;
287
+ hasMore: boolean;
288
+ hasPrev: boolean;
289
+ }
290
+ /** Cursor query (`limit` ≤ 20) for `/gifts/owner` and `/staff-access`. */
291
+ export interface CursorPageQuery {
292
+ nextCursor?: string;
293
+ prevCursor?: string;
294
+ limit?: number;
295
+ }
296
+ export type StaffAccessMode = 'view' | 'act';
297
+ export type StaffAccessStatus = 'active' | 'ended' | 'expired';
298
+ /** One time LiveChatta support viewed (`view`) or acted (`act`) in your account. */
299
+ export interface StaffAccessEntry {
300
+ id: string;
301
+ /** First name only. */
302
+ staffName: string;
303
+ mode: StaffAccessMode;
304
+ reason: string;
305
+ startedAt: string;
306
+ endedAt: string | null;
307
+ durationSec: number;
308
+ status: StaffAccessStatus;
309
+ pageViews: number;
310
+ /** Writes made while acting. */
311
+ actions: Array<{
312
+ at: string;
313
+ summary: string;
314
+ }>;
315
+ /** Country and masked IP, e.g. "NG · 102.89.•••". */
316
+ where: string;
317
+ }
318
+ export interface StaffAccessPage {
319
+ results: StaffAccessEntry[];
320
+ nextCursor: string | null;
321
+ prevCursor: string | null;
322
+ hasMore: boolean;
323
+ hasPrev: boolean;
324
+ }
325
+ export type OwnerMeetingStatus = 'upcoming' | 'live' | 'ended' | 'all';
326
+ export type MeetingState = 'upcoming' | 'live' | 'ended' | 'cancelled';
327
+ export interface OwnerMeetingsQuery {
328
+ /** Required: the 24-hex id of the link. */
329
+ linkId: string;
330
+ /** Default `upcoming`; only `all` includes cancelled meetings. */
331
+ status?: OwnerMeetingStatus;
332
+ /** Default 20, max 100. */
333
+ limit?: number;
334
+ nextCursor?: string;
335
+ }
336
+ /** One meeting of a link. Note the id field is `id`, not `_id`. Parse tolerantly: the server may add fields. */
337
+ export interface OwnerMeeting {
338
+ id: string;
339
+ /** Short code of the meeting (`/hop/{code}`). */
340
+ code?: string;
341
+ linkId?: string;
342
+ title: string;
343
+ description?: string;
344
+ /** ISO times. */
345
+ startAt: string;
346
+ endAt?: string;
347
+ durationMinutes: number;
348
+ status?: MeetingState;
349
+ joinUrl?: string;
350
+ hostId?: string;
351
+ hostName?: string;
352
+ requireAdmit?: boolean;
353
+ memberCount?: number;
354
+ /** IANA zone. */
355
+ timezone?: string;
356
+ }
357
+ export interface ScheduleOwnerMeetingPayload {
358
+ linkId: string;
359
+ /** 1 to 200 characters. */
360
+ title: string;
361
+ /** A future ISO time. */
362
+ startAt: string;
363
+ /** 5 to 1440. */
364
+ durationMinutes: number;
365
+ /** Up to 2000 characters. */
366
+ description?: string;
367
+ /** Member ids or emails: at least 1, at most 70. */
368
+ invitees: string[];
369
+ /** Default true. */
370
+ requireAdmit?: boolean;
371
+ /** IANA zone, default `UTC`. */
372
+ timezone?: string;
373
+ }
374
+ /** `POST /hops/owner/meetings` reply: the meeting plus who was invited. */
375
+ export interface ScheduledOwnerMeeting extends OwnerMeeting {
376
+ invitedMembers?: number;
377
+ guestsInvited?: number;
378
+ occurrences?: number;
379
+ }
380
+ /** Options of `scheduleMeeting`: a key replays the first result for 24 h, which makes a retry safe. */
381
+ export interface ScheduleMeetingOptions {
382
+ idempotencyKey?: string;
383
+ }
384
+ /** `DELETE /hops/owner/meetings/:id`; repeating it is safe (`alreadyCancelled`). */
385
+ export interface OwnerMeetingCancelResult {
386
+ ok: boolean;
387
+ id: string;
388
+ status: 'cancelled';
389
+ alreadyCancelled: boolean;
390
+ }
@@ -0,0 +1,13 @@
1
+ // Teams, followers, chat-user invites, push reply, uploads, Hop meeting "Where" + guests,
2
+ // webinar recordings and person-to-person gifts (chatta #297–#341). Dates are ISO strings.
3
+ // ── Named workspace teams (/users/teams, owner token) ───────────────────────
4
+ export const WORKSPACE_TEAM_NAME_MAX = 40;
5
+ export const WORKSPACE_TEAM_DESCRIPTION_MAX = 200;
6
+ export const WORKSPACE_TEAM_MAX_MEMBERS = 50;
7
+ // ── Android inline Reply (public, token-authorised) ─────────────────────────
8
+ export const PUSH_REPLY_MAX_LENGTH = 4000;
9
+ /** Reply tokens are single use and live 6 h. */
10
+ export const PUSH_REPLY_TTL_SECONDS = 6 * 3600;
11
+ // ── Person-to-person gifts (minor units, USD cents) ─────────────────────────
12
+ export const GIFT_PAYOUT_MIN_MINOR = 1000;
13
+ //# sourceMappingURL=workspace.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workspace.js","sourceRoot":"","sources":["../../src/types/workspace.ts"],"names":[],"mappings":"AAAA,0FAA0F;AAC1F,2FAA2F;AAE3F,+EAA+E;AAE/E,MAAM,CAAC,MAAM,uBAAuB,GAAG,EAAE,CAAC;AAC1C,MAAM,CAAC,MAAM,8BAA8B,GAAG,GAAG,CAAC;AAClD,MAAM,CAAC,MAAM,0BAA0B,GAAG,EAAE,CAAC;AA2G7C,+EAA+E;AAE/E,MAAM,CAAC,MAAM,qBAAqB,GAAG,IAAI,CAAC;AAC1C,gDAAgD;AAChD,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,GAAG,IAAI,CAAC;AAsF/C,+EAA+E;AAE/E,MAAM,CAAC,MAAM,qBAAqB,GAAG,IAAI,CAAC"}