@botonic/webchat-core 2.23.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 (88) hide show
  1. package/CHANGELOG.md +247 -0
  2. package/PR-LOCALE-SUPPORT.md +156 -0
  3. package/README.md +11 -0
  4. package/package.json +29 -0
  5. package/src/index.d.ts +11 -0
  6. package/src/index.js +15 -0
  7. package/src/index.js.map +1 -0
  8. package/src/lib/controllers/index.d.ts +2 -0
  9. package/src/lib/controllers/index.js +3 -0
  10. package/src/lib/controllers/index.js.map +1 -0
  11. package/src/lib/controllers/public.d.ts +383 -0
  12. package/src/lib/controllers/public.js +194 -0
  13. package/src/lib/controllers/public.js.map +1 -0
  14. package/src/lib/controllers/webchat.d.ts +414 -0
  15. package/src/lib/controllers/webchat.js +255 -0
  16. package/src/lib/controllers/webchat.js.map +1 -0
  17. package/src/lib/domain/index.d.ts +50 -0
  18. package/src/lib/domain/index.js +11 -0
  19. package/src/lib/domain/index.js.map +1 -0
  20. package/src/lib/infra/clients/hubtype-api.d.ts +53 -0
  21. package/src/lib/infra/clients/hubtype-api.js +189 -0
  22. package/src/lib/infra/clients/hubtype-api.js.map +1 -0
  23. package/src/lib/infra/clients/index.d.ts +3 -0
  24. package/src/lib/infra/clients/index.js +4 -0
  25. package/src/lib/infra/clients/index.js.map +1 -0
  26. package/src/lib/infra/clients/realtime.d.ts +92 -0
  27. package/src/lib/infra/clients/realtime.js +277 -0
  28. package/src/lib/infra/clients/realtime.js.map +1 -0
  29. package/src/lib/infra/clients/types.d.ts +21 -0
  30. package/src/lib/infra/clients/types.js +2 -0
  31. package/src/lib/infra/clients/types.js.map +1 -0
  32. package/src/lib/infra/repositories/index.d.ts +1 -0
  33. package/src/lib/infra/repositories/index.js +2 -0
  34. package/src/lib/infra/repositories/index.js.map +1 -0
  35. package/src/lib/infra/repositories/storage/base-storage.d.ts +23 -0
  36. package/src/lib/infra/repositories/storage/base-storage.js +102 -0
  37. package/src/lib/infra/repositories/storage/base-storage.js.map +1 -0
  38. package/src/lib/infra/repositories/storage/browser-storage.d.ts +9 -0
  39. package/src/lib/infra/repositories/storage/browser-storage.js +46 -0
  40. package/src/lib/infra/repositories/storage/browser-storage.js.map +1 -0
  41. package/src/lib/infra/repositories/storage/factory.d.ts +2 -0
  42. package/src/lib/infra/repositories/storage/factory.js +20 -0
  43. package/src/lib/infra/repositories/storage/factory.js.map +1 -0
  44. package/src/lib/infra/repositories/storage/in-memory.d.ts +9 -0
  45. package/src/lib/infra/repositories/storage/in-memory.js +21 -0
  46. package/src/lib/infra/repositories/storage/in-memory.js.map +1 -0
  47. package/src/lib/infra/repositories/storage/index.d.ts +7 -0
  48. package/src/lib/infra/repositories/storage/index.js +7 -0
  49. package/src/lib/infra/repositories/storage/index.js.map +1 -0
  50. package/src/lib/infra/repositories/storage/local-storage.d.ts +4 -0
  51. package/src/lib/infra/repositories/storage/local-storage.js +7 -0
  52. package/src/lib/infra/repositories/storage/local-storage.js.map +1 -0
  53. package/src/lib/infra/repositories/storage/session-storage.d.ts +4 -0
  54. package/src/lib/infra/repositories/storage/session-storage.js +7 -0
  55. package/src/lib/infra/repositories/storage/session-storage.js.map +1 -0
  56. package/src/lib/infra/repositories/storage/types.d.ts +30 -0
  57. package/src/lib/infra/repositories/storage/types.js +2 -0
  58. package/src/lib/infra/repositories/storage/types.js.map +1 -0
  59. package/src/lib/machines/message.d.ts +200 -0
  60. package/src/lib/machines/message.js +210 -0
  61. package/src/lib/machines/message.js.map +1 -0
  62. package/src/lib/machines/overlay.d.ts +299 -0
  63. package/src/lib/machines/overlay.js +217 -0
  64. package/src/lib/machines/overlay.js.map +1 -0
  65. package/src/lib/machines/webchat.d.ts +641 -0
  66. package/src/lib/machines/webchat.js +768 -0
  67. package/src/lib/machines/webchat.js.map +1 -0
  68. package/src/lib/services/webchat-service.d.ts +125 -0
  69. package/src/lib/services/webchat-service.js +339 -0
  70. package/src/lib/services/webchat-service.js.map +1 -0
  71. package/src/lib/utils/locale-detection.d.ts +2 -0
  72. package/src/lib/utils/locale-detection.js +20 -0
  73. package/src/lib/utils/locale-detection.js.map +1 -0
  74. package/src/lib/utils/timezone-to-country.d.ts +1 -0
  75. package/src/lib/utils/timezone-to-country.js +105 -0
  76. package/src/lib/utils/timezone-to-country.js.map +1 -0
  77. package/src/lib/webview/constants.d.ts +10 -0
  78. package/src/lib/webview/constants.js +10 -0
  79. package/src/lib/webview/constants.js.map +1 -0
  80. package/src/lib/webview/index.d.ts +3 -0
  81. package/src/lib/webview/index.js +4 -0
  82. package/src/lib/webview/index.js.map +1 -0
  83. package/src/lib/webview/types.d.ts +35 -0
  84. package/src/lib/webview/types.js +16 -0
  85. package/src/lib/webview/types.js.map +1 -0
  86. package/src/lib/webview/utils.d.ts +9 -0
  87. package/src/lib/webview/utils.js +33 -0
  88. package/src/lib/webview/utils.js.map +1 -0
@@ -0,0 +1,641 @@
1
+ import { type HubtypeUser, type WebchatMessage } from '@botonic/shared';
2
+ import { ActorRefFrom } from 'xstate';
3
+ import { ConnectionStatus, WebchatConfig } from '../domain';
4
+ import { type StorageRepository, type StoredMessage } from '../infra/repositories';
5
+ import { WebchatService } from '../services/webchat-service';
6
+ import { WebchatMessageMachine, WebchatMessageStatus } from './message';
7
+ import { OverlayMachineActor } from './overlay';
8
+ export interface WebchatConnectionConfig {
9
+ appId: string;
10
+ apiUrl?: string;
11
+ pusherAppKey?: string;
12
+ pusherCluster?: string;
13
+ }
14
+ export interface ConnectedWebchatContext {
15
+ user: HubtypeUser;
16
+ messages: StoredMessage[];
17
+ messageActors: Map<string, ActorRefFrom<typeof WebchatMessageMachine>>;
18
+ storageRepository: StorageRepository;
19
+ webchatService: WebchatService;
20
+ appId: string;
21
+ config: WebchatConnectionConfig;
22
+ }
23
+ type InitializedWebchatContext = ConnectedWebchatContext;
24
+ export interface WebchatControllerContext extends Partial<ConnectedWebchatContext> {
25
+ config: WebchatConfig;
26
+ isOpen: boolean;
27
+ connectionStatus: ConnectionStatus;
28
+ messageActors: Map<string, ActorRefFrom<typeof WebchatMessageMachine>>;
29
+ reconnectAttempt?: number;
30
+ isTypingOn: boolean;
31
+ overlayActor: OverlayMachineActor;
32
+ }
33
+ /**
34
+ * Main webchat machine that handles the complete lifecycle
35
+ *
36
+ * Flow:
37
+ * 1. idle → initializing (setup services, load session)
38
+ * 2. initializing → operational (ready for messaging)
39
+ * 3. operational → (handle messages, connections, UI state)
40
+ */
41
+ export declare const WebchatMachine: import("xstate").StateMachine<WebchatControllerContext, {
42
+ type: "INITIALIZE";
43
+ } | {
44
+ type: "RETRY_INITIALIZATION";
45
+ } | {
46
+ type: "RETRY_CONNECTION";
47
+ } | {
48
+ type: "CONNECTION_STATUS_CHANGED";
49
+ status: string;
50
+ } | {
51
+ type: "RECONNECT";
52
+ } | {
53
+ type: "CANCEL_RECONNECT";
54
+ } | {
55
+ type: "SET_ONLINE";
56
+ online: boolean;
57
+ } | {
58
+ type: "SET_TYPING";
59
+ isTypingOn: boolean;
60
+ } | {
61
+ type: "TOGGLE_WEBCHAT";
62
+ isOpen?: boolean;
63
+ } | {
64
+ type: "SEND_MESSAGE";
65
+ message: WebchatMessage;
66
+ } | {
67
+ type: "MESSAGE_RECEIVED";
68
+ message: WebchatMessage;
69
+ } | {
70
+ type: "MESSAGE_STATUS_CHANGED";
71
+ messageId: string;
72
+ status: WebchatMessageStatus;
73
+ message: WebchatMessage;
74
+ } | {
75
+ type: "UPDATE_USER";
76
+ user: Partial<HubtypeUser>;
77
+ } | {
78
+ type: "CLEAR_MESSAGES";
79
+ } | {
80
+ type: "UPDATE_MESSAGE";
81
+ messageId: string;
82
+ updates: Partial<WebchatMessage>;
83
+ } | {
84
+ type: "DELETE_MESSAGE";
85
+ messageId: string;
86
+ } | {
87
+ type: "PERSISTENCE.SAVE_MESSAGE";
88
+ } | {
89
+ type: "WEBVIEW.OPEN";
90
+ url: string;
91
+ title?: string;
92
+ }, {
93
+ [x: string]: import("xstate").ActorRefFromLogic<import("xstate").PromiseActorLogic<{
94
+ webchatService: WebchatService;
95
+ storageRepository: StorageRepository;
96
+ }, {
97
+ config: WebchatConfig;
98
+ }, import("xstate").EventObject>> | import("xstate").ActorRefFromLogic<import("xstate").PromiseActorLogic<StoredMessage[], {
99
+ storageRepository: StorageRepository;
100
+ appId: string;
101
+ userId: string;
102
+ }, import("xstate").EventObject>> | import("xstate").ActorRefFromLogic<import("xstate").PromiseActorLogic<HubtypeUser | null, {
103
+ storageRepository: StorageRepository;
104
+ appId: string;
105
+ }, import("xstate").EventObject>> | import("xstate").ActorRefFromLogic<import("xstate").PromiseActorLogic<{
106
+ success: boolean;
107
+ }, {
108
+ webchatService: WebchatService;
109
+ user: HubtypeUser;
110
+ messages: WebchatMessage[];
111
+ }, import("xstate").EventObject>> | import("xstate").ActorRefFromLogic<import("xstate").PromiseActorLogic<{
112
+ success: boolean;
113
+ }, {
114
+ webchatService: WebchatService;
115
+ user: HubtypeUser;
116
+ messages: WebchatMessage[];
117
+ attempt: number;
118
+ }, import("xstate").EventObject>> | undefined;
119
+ }, {
120
+ src: "initializeWebchatService";
121
+ logic: import("xstate").PromiseActorLogic<{
122
+ webchatService: WebchatService;
123
+ storageRepository: StorageRepository;
124
+ }, {
125
+ config: WebchatConfig;
126
+ }, import("xstate").EventObject>;
127
+ id: string | undefined;
128
+ } | {
129
+ src: "loadMessages";
130
+ logic: import("xstate").PromiseActorLogic<StoredMessage[], {
131
+ storageRepository: StorageRepository;
132
+ appId: string;
133
+ userId: string;
134
+ }, import("xstate").EventObject>;
135
+ id: string | undefined;
136
+ } | {
137
+ src: "loadLastUser";
138
+ logic: import("xstate").PromiseActorLogic<HubtypeUser | null, {
139
+ storageRepository: StorageRepository;
140
+ appId: string;
141
+ }, import("xstate").EventObject>;
142
+ id: string | undefined;
143
+ } | {
144
+ src: "initializeRealtimeConnection";
145
+ logic: import("xstate").PromiseActorLogic<{
146
+ success: boolean;
147
+ }, {
148
+ webchatService: WebchatService;
149
+ user: HubtypeUser;
150
+ messages: WebchatMessage[];
151
+ }, import("xstate").EventObject>;
152
+ id: string | undefined;
153
+ } | {
154
+ src: "reconnectToRealtime";
155
+ logic: import("xstate").PromiseActorLogic<{
156
+ success: boolean;
157
+ }, {
158
+ webchatService: WebchatService;
159
+ user: HubtypeUser;
160
+ messages: WebchatMessage[];
161
+ attempt: number;
162
+ }, import("xstate").EventObject>;
163
+ id: string | undefined;
164
+ }, {
165
+ type: "assignWebchatService";
166
+ params: import("xstate").NonReducibleUnknown;
167
+ } | {
168
+ type: "assignLoadedUser";
169
+ params: import("xstate").NonReducibleUnknown;
170
+ } | {
171
+ type: "createAnonymousUser";
172
+ params: import("xstate").NonReducibleUnknown;
173
+ } | {
174
+ type: "assignLoadedMessages";
175
+ params: import("xstate").NonReducibleUnknown;
176
+ } | {
177
+ type: "spawnPersistedMessageActors";
178
+ params: import("xstate").NonReducibleUnknown;
179
+ } | {
180
+ type: "saveUser";
181
+ params: unknown;
182
+ } | {
183
+ type: "forwardWebviewOpenToOverlay";
184
+ params: unknown;
185
+ } | {
186
+ type: "subscribeToWebchatService";
187
+ params: unknown;
188
+ } | {
189
+ type: "cleanupWebchatServiceSubscriptions";
190
+ params: unknown;
191
+ } | {
192
+ type: "toggleWebchat";
193
+ params: import("xstate").NonReducibleUnknown;
194
+ } | {
195
+ type: "emitWebchatToggled";
196
+ params: import("xstate").NonReducibleUnknown;
197
+ } | {
198
+ type: "updateConnectionStatus";
199
+ params: import("xstate").NonReducibleUnknown;
200
+ } | {
201
+ type: "addMessage";
202
+ params: import("xstate").NonReducibleUnknown;
203
+ } | {
204
+ type: "saveMessages";
205
+ params: unknown;
206
+ } | {
207
+ type: "emitMessageAdded";
208
+ params: import("xstate").NonReducibleUnknown;
209
+ } | {
210
+ type: "emitMessageSent";
211
+ params: import("xstate").NonReducibleUnknown;
212
+ } | {
213
+ type: "emitMessageReceived";
214
+ params: import("xstate").NonReducibleUnknown;
215
+ } | {
216
+ type: "emitMessageUpdated";
217
+ params: import("xstate").NonReducibleUnknown;
218
+ } | {
219
+ type: "emitMessagesCleared";
220
+ params: import("xstate").NonReducibleUnknown;
221
+ } | {
222
+ type: "emitUserUpdated";
223
+ params: import("xstate").NonReducibleUnknown;
224
+ } | {
225
+ type: "emitWebchatOpened";
226
+ params: import("xstate").NonReducibleUnknown;
227
+ } | {
228
+ type: "emitWebchatClosed";
229
+ params: import("xstate").NonReducibleUnknown;
230
+ } | {
231
+ type: "emitInitializationStarted";
232
+ params: import("xstate").NonReducibleUnknown;
233
+ } | {
234
+ type: "emitInitializationCompleted";
235
+ params: import("xstate").NonReducibleUnknown;
236
+ } | {
237
+ type: "emitInitializationFailed";
238
+ params: import("xstate").NonReducibleUnknown;
239
+ } | {
240
+ type: "emitConnectionChanged";
241
+ params: import("xstate").NonReducibleUnknown;
242
+ } | {
243
+ type: "emitMessageDeleted";
244
+ params: import("xstate").NonReducibleUnknown;
245
+ } | {
246
+ type: "updateUser";
247
+ params: import("xstate").NonReducibleUnknown;
248
+ } | {
249
+ type: "clearMessages";
250
+ params: import("xstate").NonReducibleUnknown;
251
+ } | {
252
+ type: "updateMessage";
253
+ params: import("xstate").NonReducibleUnknown;
254
+ } | {
255
+ type: "deleteMessage";
256
+ params: import("xstate").NonReducibleUnknown;
257
+ } | {
258
+ type: "setTyping";
259
+ params: import("xstate").NonReducibleUnknown;
260
+ } | {
261
+ type: "setTypingExternal";
262
+ params: import("xstate").NonReducibleUnknown;
263
+ } | {
264
+ type: "setOnline";
265
+ params: unknown;
266
+ }, {
267
+ type: "isInitialized";
268
+ params: unknown;
269
+ } | {
270
+ type: "hasLoadedUser";
271
+ params: unknown;
272
+ } | {
273
+ type: "isMaxReconnectAttempts";
274
+ params: unknown;
275
+ } | {
276
+ type: "isTypingEvent";
277
+ params: unknown;
278
+ }, never, "idle" | "connectionFailed" | "reconnecting" | "operational" | {
279
+ initializing: "initializingServices" | "loadingSession" | "loadingMessages" | "connectingToRealtime" | "spawningPersistedMessages";
280
+ }, string, WebchatConfig, import("xstate").NonReducibleUnknown, {
281
+ type: "INITIALIZATION_STARTED";
282
+ } | {
283
+ type: "INITIALIZATION_COMPLETED";
284
+ context: InitializedWebchatContext;
285
+ } | {
286
+ type: "INITIALIZATION_FAILED";
287
+ error: string;
288
+ } | {
289
+ type: "MESSAGE_ADDED";
290
+ message: WebchatMessage;
291
+ actor: any;
292
+ } | {
293
+ type: "MESSAGE_SENT";
294
+ message: WebchatMessage;
295
+ } | {
296
+ type: "MESSAGE_RECEIVED";
297
+ message: WebchatMessage;
298
+ } | {
299
+ type: "MESSAGE_UPDATED";
300
+ messageId: string;
301
+ updates: Partial<WebchatMessage>;
302
+ } | {
303
+ type: "MESSAGE_DELETED";
304
+ messageId: string;
305
+ } | {
306
+ type: "MESSAGES_CLEARED";
307
+ } | {
308
+ type: "USER_UPDATED";
309
+ user: Partial<HubtypeUser>;
310
+ } | {
311
+ type: "TYPING_CHANGED";
312
+ isTyping: boolean;
313
+ } | {
314
+ type: "WEBCHAT_OPENED";
315
+ } | {
316
+ type: "WEBCHAT_CLOSED";
317
+ } | {
318
+ type: "CONNECTION_CHANGED";
319
+ status: ConnectionStatus;
320
+ } | {
321
+ type: "STATUS_CHANGED";
322
+ status: ConnectionStatus;
323
+ }, import("xstate").MetaObject, {
324
+ id: "webchat";
325
+ states: {
326
+ readonly idle: {};
327
+ readonly initializing: {
328
+ states: {
329
+ readonly initializingServices: {};
330
+ readonly loadingSession: {};
331
+ readonly loadingMessages: {};
332
+ readonly spawningPersistedMessages: {};
333
+ readonly connectingToRealtime: {};
334
+ };
335
+ };
336
+ readonly connectionFailed: {};
337
+ readonly reconnecting: {};
338
+ readonly operational: {};
339
+ };
340
+ }>;
341
+ export declare function createWebchatMachine(webchatConfig: WebchatConfig): import("xstate").Actor<import("xstate").StateMachine<WebchatControllerContext, {
342
+ type: "INITIALIZE";
343
+ } | {
344
+ type: "RETRY_INITIALIZATION";
345
+ } | {
346
+ type: "RETRY_CONNECTION";
347
+ } | {
348
+ type: "CONNECTION_STATUS_CHANGED";
349
+ status: string;
350
+ } | {
351
+ type: "RECONNECT";
352
+ } | {
353
+ type: "CANCEL_RECONNECT";
354
+ } | {
355
+ type: "SET_ONLINE";
356
+ online: boolean;
357
+ } | {
358
+ type: "SET_TYPING";
359
+ isTypingOn: boolean;
360
+ } | {
361
+ type: "TOGGLE_WEBCHAT";
362
+ isOpen?: boolean;
363
+ } | {
364
+ type: "SEND_MESSAGE";
365
+ message: WebchatMessage;
366
+ } | {
367
+ type: "MESSAGE_RECEIVED";
368
+ message: WebchatMessage;
369
+ } | {
370
+ type: "MESSAGE_STATUS_CHANGED";
371
+ messageId: string;
372
+ status: WebchatMessageStatus;
373
+ message: WebchatMessage;
374
+ } | {
375
+ type: "UPDATE_USER";
376
+ user: Partial<HubtypeUser>;
377
+ } | {
378
+ type: "CLEAR_MESSAGES";
379
+ } | {
380
+ type: "UPDATE_MESSAGE";
381
+ messageId: string;
382
+ updates: Partial<WebchatMessage>;
383
+ } | {
384
+ type: "DELETE_MESSAGE";
385
+ messageId: string;
386
+ } | {
387
+ type: "PERSISTENCE.SAVE_MESSAGE";
388
+ } | {
389
+ type: "WEBVIEW.OPEN";
390
+ url: string;
391
+ title?: string;
392
+ }, {
393
+ [x: string]: import("xstate").ActorRefFromLogic<import("xstate").PromiseActorLogic<{
394
+ webchatService: WebchatService;
395
+ storageRepository: StorageRepository;
396
+ }, {
397
+ config: WebchatConfig;
398
+ }, import("xstate").EventObject>> | import("xstate").ActorRefFromLogic<import("xstate").PromiseActorLogic<StoredMessage[], {
399
+ storageRepository: StorageRepository;
400
+ appId: string;
401
+ userId: string;
402
+ }, import("xstate").EventObject>> | import("xstate").ActorRefFromLogic<import("xstate").PromiseActorLogic<HubtypeUser | null, {
403
+ storageRepository: StorageRepository;
404
+ appId: string;
405
+ }, import("xstate").EventObject>> | import("xstate").ActorRefFromLogic<import("xstate").PromiseActorLogic<{
406
+ success: boolean;
407
+ }, {
408
+ webchatService: WebchatService;
409
+ user: HubtypeUser;
410
+ messages: WebchatMessage[];
411
+ }, import("xstate").EventObject>> | import("xstate").ActorRefFromLogic<import("xstate").PromiseActorLogic<{
412
+ success: boolean;
413
+ }, {
414
+ webchatService: WebchatService;
415
+ user: HubtypeUser;
416
+ messages: WebchatMessage[];
417
+ attempt: number;
418
+ }, import("xstate").EventObject>> | undefined;
419
+ }, {
420
+ src: "initializeWebchatService";
421
+ logic: import("xstate").PromiseActorLogic<{
422
+ webchatService: WebchatService;
423
+ storageRepository: StorageRepository;
424
+ }, {
425
+ config: WebchatConfig;
426
+ }, import("xstate").EventObject>;
427
+ id: string | undefined;
428
+ } | {
429
+ src: "loadMessages";
430
+ logic: import("xstate").PromiseActorLogic<StoredMessage[], {
431
+ storageRepository: StorageRepository;
432
+ appId: string;
433
+ userId: string;
434
+ }, import("xstate").EventObject>;
435
+ id: string | undefined;
436
+ } | {
437
+ src: "loadLastUser";
438
+ logic: import("xstate").PromiseActorLogic<HubtypeUser | null, {
439
+ storageRepository: StorageRepository;
440
+ appId: string;
441
+ }, import("xstate").EventObject>;
442
+ id: string | undefined;
443
+ } | {
444
+ src: "initializeRealtimeConnection";
445
+ logic: import("xstate").PromiseActorLogic<{
446
+ success: boolean;
447
+ }, {
448
+ webchatService: WebchatService;
449
+ user: HubtypeUser;
450
+ messages: WebchatMessage[];
451
+ }, import("xstate").EventObject>;
452
+ id: string | undefined;
453
+ } | {
454
+ src: "reconnectToRealtime";
455
+ logic: import("xstate").PromiseActorLogic<{
456
+ success: boolean;
457
+ }, {
458
+ webchatService: WebchatService;
459
+ user: HubtypeUser;
460
+ messages: WebchatMessage[];
461
+ attempt: number;
462
+ }, import("xstate").EventObject>;
463
+ id: string | undefined;
464
+ }, {
465
+ type: "assignWebchatService";
466
+ params: import("xstate").NonReducibleUnknown;
467
+ } | {
468
+ type: "assignLoadedUser";
469
+ params: import("xstate").NonReducibleUnknown;
470
+ } | {
471
+ type: "createAnonymousUser";
472
+ params: import("xstate").NonReducibleUnknown;
473
+ } | {
474
+ type: "assignLoadedMessages";
475
+ params: import("xstate").NonReducibleUnknown;
476
+ } | {
477
+ type: "spawnPersistedMessageActors";
478
+ params: import("xstate").NonReducibleUnknown;
479
+ } | {
480
+ type: "saveUser";
481
+ params: unknown;
482
+ } | {
483
+ type: "forwardWebviewOpenToOverlay";
484
+ params: unknown;
485
+ } | {
486
+ type: "subscribeToWebchatService";
487
+ params: unknown;
488
+ } | {
489
+ type: "cleanupWebchatServiceSubscriptions";
490
+ params: unknown;
491
+ } | {
492
+ type: "toggleWebchat";
493
+ params: import("xstate").NonReducibleUnknown;
494
+ } | {
495
+ type: "emitWebchatToggled";
496
+ params: import("xstate").NonReducibleUnknown;
497
+ } | {
498
+ type: "updateConnectionStatus";
499
+ params: import("xstate").NonReducibleUnknown;
500
+ } | {
501
+ type: "addMessage";
502
+ params: import("xstate").NonReducibleUnknown;
503
+ } | {
504
+ type: "saveMessages";
505
+ params: unknown;
506
+ } | {
507
+ type: "emitMessageAdded";
508
+ params: import("xstate").NonReducibleUnknown;
509
+ } | {
510
+ type: "emitMessageSent";
511
+ params: import("xstate").NonReducibleUnknown;
512
+ } | {
513
+ type: "emitMessageReceived";
514
+ params: import("xstate").NonReducibleUnknown;
515
+ } | {
516
+ type: "emitMessageUpdated";
517
+ params: import("xstate").NonReducibleUnknown;
518
+ } | {
519
+ type: "emitMessagesCleared";
520
+ params: import("xstate").NonReducibleUnknown;
521
+ } | {
522
+ type: "emitUserUpdated";
523
+ params: import("xstate").NonReducibleUnknown;
524
+ } | {
525
+ type: "emitWebchatOpened";
526
+ params: import("xstate").NonReducibleUnknown;
527
+ } | {
528
+ type: "emitWebchatClosed";
529
+ params: import("xstate").NonReducibleUnknown;
530
+ } | {
531
+ type: "emitInitializationStarted";
532
+ params: import("xstate").NonReducibleUnknown;
533
+ } | {
534
+ type: "emitInitializationCompleted";
535
+ params: import("xstate").NonReducibleUnknown;
536
+ } | {
537
+ type: "emitInitializationFailed";
538
+ params: import("xstate").NonReducibleUnknown;
539
+ } | {
540
+ type: "emitConnectionChanged";
541
+ params: import("xstate").NonReducibleUnknown;
542
+ } | {
543
+ type: "emitMessageDeleted";
544
+ params: import("xstate").NonReducibleUnknown;
545
+ } | {
546
+ type: "updateUser";
547
+ params: import("xstate").NonReducibleUnknown;
548
+ } | {
549
+ type: "clearMessages";
550
+ params: import("xstate").NonReducibleUnknown;
551
+ } | {
552
+ type: "updateMessage";
553
+ params: import("xstate").NonReducibleUnknown;
554
+ } | {
555
+ type: "deleteMessage";
556
+ params: import("xstate").NonReducibleUnknown;
557
+ } | {
558
+ type: "setTyping";
559
+ params: import("xstate").NonReducibleUnknown;
560
+ } | {
561
+ type: "setTypingExternal";
562
+ params: import("xstate").NonReducibleUnknown;
563
+ } | {
564
+ type: "setOnline";
565
+ params: unknown;
566
+ }, {
567
+ type: "isInitialized";
568
+ params: unknown;
569
+ } | {
570
+ type: "hasLoadedUser";
571
+ params: unknown;
572
+ } | {
573
+ type: "isMaxReconnectAttempts";
574
+ params: unknown;
575
+ } | {
576
+ type: "isTypingEvent";
577
+ params: unknown;
578
+ }, never, "idle" | "connectionFailed" | "reconnecting" | "operational" | {
579
+ initializing: "initializingServices" | "loadingSession" | "loadingMessages" | "connectingToRealtime" | "spawningPersistedMessages";
580
+ }, string, WebchatConfig, import("xstate").NonReducibleUnknown, {
581
+ type: "INITIALIZATION_STARTED";
582
+ } | {
583
+ type: "INITIALIZATION_COMPLETED";
584
+ context: InitializedWebchatContext;
585
+ } | {
586
+ type: "INITIALIZATION_FAILED";
587
+ error: string;
588
+ } | {
589
+ type: "MESSAGE_ADDED";
590
+ message: WebchatMessage;
591
+ actor: any;
592
+ } | {
593
+ type: "MESSAGE_SENT";
594
+ message: WebchatMessage;
595
+ } | {
596
+ type: "MESSAGE_RECEIVED";
597
+ message: WebchatMessage;
598
+ } | {
599
+ type: "MESSAGE_UPDATED";
600
+ messageId: string;
601
+ updates: Partial<WebchatMessage>;
602
+ } | {
603
+ type: "MESSAGE_DELETED";
604
+ messageId: string;
605
+ } | {
606
+ type: "MESSAGES_CLEARED";
607
+ } | {
608
+ type: "USER_UPDATED";
609
+ user: Partial<HubtypeUser>;
610
+ } | {
611
+ type: "TYPING_CHANGED";
612
+ isTyping: boolean;
613
+ } | {
614
+ type: "WEBCHAT_OPENED";
615
+ } | {
616
+ type: "WEBCHAT_CLOSED";
617
+ } | {
618
+ type: "CONNECTION_CHANGED";
619
+ status: ConnectionStatus;
620
+ } | {
621
+ type: "STATUS_CHANGED";
622
+ status: ConnectionStatus;
623
+ }, import("xstate").MetaObject, {
624
+ id: "webchat";
625
+ states: {
626
+ readonly idle: {};
627
+ readonly initializing: {
628
+ states: {
629
+ readonly initializingServices: {};
630
+ readonly loadingSession: {};
631
+ readonly loadingMessages: {};
632
+ readonly spawningPersistedMessages: {};
633
+ readonly connectingToRealtime: {};
634
+ };
635
+ };
636
+ readonly connectionFailed: {};
637
+ readonly reconnecting: {};
638
+ readonly operational: {};
639
+ };
640
+ }>>;
641
+ export {};