@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,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,38 @@
1
+ import type { UIOptions, EmbedPosition, EmbedLayout, ThemeMode } from '../types/options';
2
+ export declare class EmbedConfig {
3
+ readonly container: string | HTMLElement | undefined;
4
+ readonly width: string;
5
+ readonly height: string;
6
+ readonly primaryColor: string;
7
+ readonly secondaryColor: string;
8
+ readonly primaryLight?: string;
9
+ readonly primaryDark?: string;
10
+ readonly primaryBg?: string;
11
+ readonly bg?: string;
12
+ readonly bgDark?: string;
13
+ readonly textColor?: string;
14
+ readonly textLight?: string;
15
+ readonly textMuted?: string;
16
+ readonly borderColor?: string;
17
+ readonly borderLight?: string;
18
+ /** True when primaryColor came from the integrator (and is not the legacy `#6C5CE7`). */
19
+ readonly hasExplicitPrimary: boolean;
20
+ /** True when secondaryColor came from the integrator. */
21
+ readonly hasExplicitSecondary: boolean;
22
+ readonly fontFamily?: string;
23
+ readonly logoUrl?: string;
24
+ readonly theme: ThemeMode;
25
+ readonly layout?: EmbedLayout;
26
+ readonly floating: boolean;
27
+ readonly position: EmbedPosition;
28
+ readonly preload: boolean;
29
+ readonly embedMode: 'auto' | 'web' | 'app';
30
+ readonly appVersion?: string;
31
+ constructor(options: UIOptions);
32
+ /** Theme values to send: defined optional keys, plus primary/secondary only when explicit. */
33
+ private themeRecord;
34
+ /** Query string for theming the embedded chat page (`?theme=` always included). */
35
+ toQueryParams(): string;
36
+ /** `livechatta:theme` postMessage payload with the same values as the query string. */
37
+ toPostMessagePayload(): Record<string, string>;
38
+ }
@@ -0,0 +1,44 @@
1
+ import { Config } from '../core/Config';
2
+ import { TokenManager } from '../core/TokenManager';
3
+ import { Bridge } from '../core/Bridge';
4
+ import { Launcher } from './Launcher';
5
+ import type { UIOptions, ThemeOptions } from '../types/options';
6
+ import type { LinkWidgetConfig } from '../types/models';
7
+ /** Loads the link's widget settings (LiveChatta passes `api().getLinkWorkspaceInfo`). */
8
+ export type WidgetConfigLoader = () => Promise<LinkWidgetConfig | null | undefined>;
9
+ /** Minimum `allow` list every LiveChatta iframe needs (voice, video, screen share, copy). */
10
+ export declare const EMBED_IFRAME_ALLOW = "microphone; camera; display-capture; clipboard-write";
11
+ export declare const IFRAME_ALLOW: string;
12
+ export declare const IFRAME_SANDBOX: string;
13
+ export declare class EmbedUI {
14
+ private readonly config;
15
+ private readonly tokenManager;
16
+ private readonly loadWidgetConfig?;
17
+ private iframe;
18
+ private embedConfig;
19
+ private options;
20
+ private launcher;
21
+ private unsubs;
22
+ /** Bridge handed to LiveChatta.bridge — wired on every mount(). */
23
+ readonly bridge: Bridge;
24
+ constructor(config: Config, tokenManager: TokenManager, loadWidgetConfig?: WidgetConfigLoader | undefined);
25
+ /** Mount the chat UI (inline into `container`, or as a floating launcher). */
26
+ mount(options: UIOptions): Promise<HTMLIFrameElement>;
27
+ private mountFloating;
28
+ private applyLinkWidget;
29
+ /** Unmount the iframe (and the launcher, if floating). */
30
+ unmount(): void;
31
+ /** Get the iframe element */
32
+ getIframe(): HTMLIFrameElement | null;
33
+ /** Floating launcher instance (null for inline embeds). */
34
+ getLauncher(): Launcher | null;
35
+ open(): void;
36
+ close(): void;
37
+ toggle(): void;
38
+ isOpen(): boolean;
39
+ /** Drive the launcher badge yourself (e.g. from sock() events). */
40
+ setUnread(count: number): void;
41
+ /** Update theming at runtime via postMessage (falls back to iframe reload) */
42
+ updateTheme(options: Partial<ThemeOptions>): Promise<void>;
43
+ private buildEmbedUrl;
44
+ }
@@ -0,0 +1,122 @@
1
+ import type { EmbedPosition } from '../types/options';
2
+ import { type ThemeMode } from './brand';
3
+ import { type BusinessHours } from './hours';
4
+ import { type PreChatForm, type PreChatValues } from './prechat';
5
+ export interface LauncherConfig {
6
+ /** Used to scope the remembered greeting dismissal (usually the link code). */
7
+ storageKey: string;
8
+ position?: EmbedPosition;
9
+ theme?: ThemeMode;
10
+ /** Explicit SDK brand; wins over the link theme. Legacy `#6C5CE7` counts as unset. */
11
+ brandColor?: string;
12
+ title?: string;
13
+ subtitle?: string;
14
+ logoUrl?: string;
15
+ launcherLabel?: string;
16
+ greeting?: string;
17
+ greetingDelay?: number;
18
+ zIndex?: number;
19
+ autoOpen?: boolean;
20
+ width?: string;
21
+ height?: string;
22
+ onOpenChange?: (open: boolean) => void;
23
+ /** Second brand colour (unread badge). Default: the primary brand. */
24
+ secondaryColor?: string;
25
+ /** Guest pre-chat form shown once per link before the chat. */
26
+ preChat?: boolean | PreChatForm;
27
+ /** Await to register/route the guest; a throw keeps the form open with an error. */
28
+ onPreChatSubmit?: (values: PreChatValues) => void | Promise<void>;
29
+ /** Fired after a successful submit (EmbedUI forwards the values to the chat frame). */
30
+ onPreChatComplete?: (values: PreChatValues) => void;
31
+ /** Opening windows; outside them the panel shows the away state first. */
32
+ businessHours?: BusinessHours;
33
+ /** Enables "leave a message" while away; await to deliver it (email, ticket, API). */
34
+ onAwayMessage?: (message: string, values: PreChatValues | null) => void | Promise<void>;
35
+ /** Clock source (tests). */
36
+ now?: () => Date;
37
+ }
38
+ /** Panel collapses to full screen at or below this viewport width (px). */
39
+ export declare const LAUNCHER_FULLSCREEN_MAX = 640;
40
+ export declare class Launcher {
41
+ private readonly cfg;
42
+ readonly host: HTMLElement;
43
+ private readonly root;
44
+ private readonly wrap;
45
+ private readonly btn;
46
+ private readonly count;
47
+ private readonly greet;
48
+ private readonly panel;
49
+ private readonly body;
50
+ private readonly closeBtn;
51
+ private readonly sub;
52
+ private readonly gate;
53
+ private readonly pid;
54
+ private preChat;
55
+ private preChatValues;
56
+ private hours;
57
+ private awayDismissed;
58
+ private awaySent;
59
+ private gateKind;
60
+ private explicitAccent;
61
+ private linkAccent;
62
+ private iframe;
63
+ private pendingSrc;
64
+ private opened;
65
+ private unread;
66
+ private mode;
67
+ private frameMode;
68
+ private explicitBrand;
69
+ private linkBrand;
70
+ private greetTimer;
71
+ private mql;
72
+ private prevOverflow;
73
+ private readonly onMql;
74
+ private readonly onResize;
75
+ constructor(cfg: LauncherConfig);
76
+ /** Attach to the page. Pass `deferredSrc` to load the iframe only on first open. */
77
+ mount(iframe: HTMLIFrameElement, deferredSrc?: string): void;
78
+ open(moveFocus?: boolean): void;
79
+ close(): void;
80
+ toggle(): void;
81
+ isOpen(): boolean;
82
+ /** Unread badge; 0 hides it. Accepts the bridge's `number | { count }` shape. */
83
+ setUnread(value: number | {
84
+ count: number;
85
+ }): void;
86
+ /** Brand reported by the link (bridge `onThemeLoaded`); an explicit SDK colour still wins. */
87
+ setLinkBrand(color?: string | null): void;
88
+ /** Secondary colour reported by the link; an explicit SDK secondary still wins. */
89
+ setLinkSecondary(color?: string | null): void;
90
+ /** Link-provided pre-chat / business hours (arrive after mount); SDK options win. */
91
+ setWidgetConfig(link: {
92
+ preChat?: PreChatForm | null;
93
+ businessHours?: BusinessHours | null;
94
+ }): void;
95
+ /** Which gate covers the chat right now: '', 'prechat' or 'away'. */
96
+ getGate(): '' | 'prechat' | 'away';
97
+ /** Explicit SDK brand (e.g. from updateTheme); `null`/legacy clears it. */
98
+ setBrand(color?: string | null): void;
99
+ setTheme(mode: ThemeMode): void;
100
+ /** Effective mode the frame actually rendered (bridge `onThemeLoaded.mode`). */
101
+ setFrameMode(mode?: string): void;
102
+ getEffectiveMode(): 'light' | 'dark';
103
+ destroy(): void;
104
+ private brand;
105
+ private applyBrand;
106
+ private applyBrandText;
107
+ private applyTheme;
108
+ private updateLabel;
109
+ private greetingKey;
110
+ private scheduleGreeting;
111
+ private dismissGreeting;
112
+ private preChatKey;
113
+ private preChatDone;
114
+ private renderGate;
115
+ private syncFrameInert;
116
+ private firstGateControl;
117
+ private uncover;
118
+ private field;
119
+ private buildPreChat;
120
+ private buildAway;
121
+ private syncModal;
122
+ }
@@ -0,0 +1,27 @@
1
+ export type ThemeMode = 'light' | 'dark' | 'system';
2
+ /** Signal default brand (used when no brand colour is set). */
3
+ export declare const SIGNAL_BRAND = "#D2400B";
4
+ /** Signal default secondary ("lagoon"). */
5
+ export declare const SIGNAL_SECONDARY = "#0B6E66";
6
+ /** Pre-Signal default primary; treated as "no brand" everywhere. */
7
+ export declare const LEGACY_DEFAULT_BRAND = "#6C5CE7";
8
+ /** Signal ink — the dark alternative for text/icons on a brand fill. */
9
+ export declare const SIGNAL_INK = "#191715";
10
+ /** Returns `#RRGGBB` (upper-case) for `#rgb`, `rgb`, `#rrggbb` or `rrggbb`; otherwise null. */
11
+ export declare function normalizeHex(value?: string | null): string | null;
12
+ /** True when the colour is a valid hex and not the legacy `#6C5CE7` default. */
13
+ export declare function hasCustomBrand(value?: string | null): boolean;
14
+ /** The brand to render: the custom colour if set, else Signal `#D2400B`. */
15
+ export declare function resolveBrand(value?: string | null): string;
16
+ /** WCAG relative luminance of a hex colour (0–1). */
17
+ export declare function relativeLuminance(hex: string): number;
18
+ /** WCAG contrast ratio between two hex colours (1–21). */
19
+ export declare function contrastRatio(a: string, b: string): number;
20
+ /** White or Signal ink for icons/text on a brand fill, whichever contrasts more. */
21
+ export declare function onBrandColor(brand: string): string;
22
+ /** Brand darkened (light bg) or lightened (dark bg) until it reads >= 4.5:1 as text on `bg`. */
23
+ export declare function brandTextOn(brand: string, bg: string): string;
24
+ /** Accepts only the three contract values; anything else falls back. */
25
+ export declare function normalizeThemeMode(value: unknown, fallback: ThemeMode): ThemeMode;
26
+ /** Effective mode for `system` (live OS preference); SSR-safe. */
27
+ export declare function effectiveMode(mode: ThemeMode): 'light' | 'dark';
@@ -0,0 +1,23 @@
1
+ import type { Launcher } from './Launcher';
2
+ export declare const EMBED_MESSAGE_TYPES: {
3
+ /** Web embed: `{ primaryColor, secondaryColor?, mode?, themeMode? }` (provisional). */
4
+ readonly brand: "livechatta:brand";
5
+ /** Web embed: `{ count }` or a bare number (provisional). */
6
+ readonly unread: "livechatta:unread";
7
+ /** Native-shell bridge (frozen): `{ primaryColor, mode, themeMode }`. */
8
+ readonly themeLoaded: "CHATTA_APP:onThemeLoaded";
9
+ /** Native-shell bridge: number or `{ count }`. */
10
+ readonly unreadChange: "CHATTA_APP:onUnreadChange";
11
+ /** Host → frame after the pre-chat form: `{ name, email, topic?, … }` (provisional). */
12
+ readonly preChat: "livechatta:prechat";
13
+ /** Host → frame on every iframe load: `{ type }` only. Lets the chat page learn its parent's origin when the browser gives it none. */
14
+ readonly hello: "livechatta:hello";
15
+ };
16
+ /** The origin of a frame URL, or null for anything that is not http(s): a message is never addressed to '*' or to an opaque origin. */
17
+ export declare function frameOrigin(src: string | null | undefined): string | null;
18
+ /** Post `{ type: 'livechatta:hello' }` to the chat iframe, addressed to the origin of its own URL. Returns whether it was sent. */
19
+ export declare function sendHello(iframe: HTMLIFrameElement): boolean;
20
+ /** Send the hello each time the iframe finishes loading (also after a deferred first open). Call before setting `src`. */
21
+ export declare function helloOnLoad(iframe: HTMLIFrameElement): void;
22
+ /** Applies a brand/unread message to the launcher; returns true if it was one. */
23
+ export declare function applyEmbedMessage(launcher: Launcher, data: unknown): boolean;
@@ -0,0 +1,35 @@
1
+ /** One opening window; `day` 0 = Sunday … 6 = Saturday, times `HH:MM` 24h in `timezone`. */
2
+ export interface BusinessHoursWindow {
3
+ day: number;
4
+ open: string;
5
+ close: string;
6
+ }
7
+ export interface BusinessHours {
8
+ /** Off switch for link-provided config. Default: true when `windows` is non-empty. */
9
+ enabled?: boolean;
10
+ /** IANA zone, e.g. 'Africa/Lagos'. Default: the visitor's zone. */
11
+ timezone?: string;
12
+ /** Short zone label for the "back at" line, e.g. 'WAT'. */
13
+ timezoneLabel?: string;
14
+ windows: BusinessHoursWindow[];
15
+ /** Extra line under "We're away", e.g. "Leave a message and we'll email you." */
16
+ awayMessage?: string;
17
+ }
18
+ export interface AwayState {
19
+ /** e.g. 'Mon 9:00 WAT', 'tomorrow 9:00', 'today 14:30' */
20
+ backAt: string | null;
21
+ message?: string;
22
+ }
23
+ /** `HH:MM` → minutes after midnight, or null. */
24
+ export declare function parseClock(v: unknown): number | null;
25
+ /** Weekday + minutes-after-midnight of `now` in `tz`; null for an unknown zone. */
26
+ export declare function zonedClock(now: Date, tz?: string): {
27
+ day: number;
28
+ minutes: number;
29
+ } | null;
30
+ /** True when `now` falls in a window (overnight windows like 22:00–02:00 included). */
31
+ export declare function isWithinHours(h: BusinessHours | null | undefined, now?: Date): boolean;
32
+ /** Next opening after `now`, as 'today 9:00' / 'tomorrow 9:00' / 'Mon 9:00' (+ zone label). */
33
+ export declare function nextOpening(h: BusinessHours | null | undefined, now?: Date): string | null;
34
+ /** Away state for the widget, or null while open (or when hours are not configured). */
35
+ export declare function awayState(h: BusinessHours | null | undefined, now?: Date): AwayState | null;