@servicetitan/titan-chat-ui-common 3.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 (75) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/dist/index.d.ts +5 -0
  3. package/dist/index.d.ts.map +1 -0
  4. package/dist/index.js +5 -0
  5. package/dist/index.js.map +1 -0
  6. package/dist/models/__mocks__/support-chat.mock.d.ts +9 -0
  7. package/dist/models/__mocks__/support-chat.mock.d.ts.map +1 -0
  8. package/dist/models/__mocks__/support-chat.mock.js +82 -0
  9. package/dist/models/__mocks__/support-chat.mock.js.map +1 -0
  10. package/dist/models/chat-customizations.d.ts +42 -0
  11. package/dist/models/chat-customizations.d.ts.map +1 -0
  12. package/dist/models/chat-customizations.js +2 -0
  13. package/dist/models/chat-customizations.js.map +1 -0
  14. package/dist/models/file-descriptor.d.ts +7 -0
  15. package/dist/models/file-descriptor.d.ts.map +1 -0
  16. package/dist/models/file-descriptor.js +2 -0
  17. package/dist/models/file-descriptor.js.map +1 -0
  18. package/dist/models/index.d.ts +4 -0
  19. package/dist/models/index.d.ts.map +1 -0
  20. package/dist/models/index.js +4 -0
  21. package/dist/models/index.js.map +1 -0
  22. package/dist/models/support-chat.d.ts +76 -0
  23. package/dist/models/support-chat.d.ts.map +1 -0
  24. package/dist/models/support-chat.js +75 -0
  25. package/dist/models/support-chat.js.map +1 -0
  26. package/dist/stores/__tests__/chat-ui.store.test.d.ts +2 -0
  27. package/dist/stores/__tests__/chat-ui.store.test.d.ts.map +1 -0
  28. package/dist/stores/__tests__/chat-ui.store.test.js +424 -0
  29. package/dist/stores/__tests__/chat-ui.store.test.js.map +1 -0
  30. package/dist/stores/chat-ui-backend-echo.store.d.ts +13 -0
  31. package/dist/stores/chat-ui-backend-echo.store.d.ts.map +1 -0
  32. package/dist/stores/chat-ui-backend-echo.store.js +115 -0
  33. package/dist/stores/chat-ui-backend-echo.store.js.map +1 -0
  34. package/dist/stores/chat-ui-backend.store.d.ts +6 -0
  35. package/dist/stores/chat-ui-backend.store.d.ts.map +1 -0
  36. package/dist/stores/chat-ui-backend.store.js +3 -0
  37. package/dist/stores/chat-ui-backend.store.js.map +1 -0
  38. package/dist/stores/chat-ui.store.d.ts +153 -0
  39. package/dist/stores/chat-ui.store.d.ts.map +1 -0
  40. package/dist/stores/chat-ui.store.js +683 -0
  41. package/dist/stores/chat-ui.store.js.map +1 -0
  42. package/dist/stores/index.d.ts +4 -0
  43. package/dist/stores/index.d.ts.map +1 -0
  44. package/dist/stores/index.js +4 -0
  45. package/dist/stores/index.js.map +1 -0
  46. package/dist/utils/__tests__/text-utils.test.d.ts +2 -0
  47. package/dist/utils/__tests__/text-utils.test.d.ts.map +1 -0
  48. package/dist/utils/__tests__/text-utils.test.js +59 -0
  49. package/dist/utils/__tests__/text-utils.test.js.map +1 -0
  50. package/dist/utils/test-utils.d.ts +5 -0
  51. package/dist/utils/test-utils.d.ts.map +1 -0
  52. package/dist/utils/test-utils.js +17 -0
  53. package/dist/utils/test-utils.js.map +1 -0
  54. package/dist/utils/text-utils.d.ts +6 -0
  55. package/dist/utils/text-utils.d.ts.map +1 -0
  56. package/dist/utils/text-utils.js +33 -0
  57. package/dist/utils/text-utils.js.map +1 -0
  58. package/package.json +36 -0
  59. package/src/cypress.d.ts +10 -0
  60. package/src/index.ts +4 -0
  61. package/src/models/__mocks__/support-chat.mock.ts +105 -0
  62. package/src/models/chat-customizations.ts +50 -0
  63. package/src/models/file-descriptor.ts +6 -0
  64. package/src/models/index.ts +3 -0
  65. package/src/models/support-chat.ts +117 -0
  66. package/src/stores/__tests__/chat-ui.store.test.ts +531 -0
  67. package/src/stores/chat-ui-backend-echo.store.ts +98 -0
  68. package/src/stores/chat-ui-backend.store.ts +10 -0
  69. package/src/stores/chat-ui.store.ts +539 -0
  70. package/src/stores/index.ts +11 -0
  71. package/src/utils/__tests__/text-utils.test.ts +70 -0
  72. package/src/utils/test-utils.ts +22 -0
  73. package/src/utils/text-utils.ts +36 -0
  74. package/tsconfig.json +15 -0
  75. package/tsconfig.tsbuildinfo +1 -0
@@ -0,0 +1,683 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ var __metadata = (this && this.__metadata) || function (k, v) {
8
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
9
+ };
10
+ import { EventEmitter } from 'events';
11
+ import { injectable, symbolToken } from '@servicetitan/react-ioc';
12
+ import { action, computed, makeObservable, observable, runInAction } from 'mobx';
13
+ import { nanoid } from 'nanoid';
14
+ import { ChatEndReason, ChatError, ChatMessageState, ChatParticipantIcon, ChatRunState, } from '../models';
15
+ export const symbolAgent = Symbol('SupportChatAgent');
16
+ export const symbolUser = Symbol('SupportChatUser');
17
+ export var ChatUiEvent;
18
+ (function (ChatUiEvent) {
19
+ ChatUiEvent["eventRun"] = "eventRun";
20
+ ChatUiEvent["eventDestroy"] = "eventDestroy";
21
+ ChatUiEvent["eventRestart"] = "eventRestart";
22
+ ChatUiEvent["eventCancel"] = "eventCancel";
23
+ ChatUiEvent["eventEndChat"] = "eventEndChat";
24
+ ChatUiEvent["eventRecover"] = "eventRecover";
25
+ ChatUiEvent["eventChasitorTyping"] = "eventChasitorTyping";
26
+ ChatUiEvent["eventTimerRestart"] = "eventTimerRestart";
27
+ ChatUiEvent["eventMessageSend"] = "eventMessageSend";
28
+ ChatUiEvent["eventMessageSendRetry"] = "eventMessageSendRetry";
29
+ ChatUiEvent["eventMessageSendFile"] = "eventMessageSendFile";
30
+ ChatUiEvent["eventMessageSendFileRetry"] = "eventMessageSendFileRetry";
31
+ })(ChatUiEvent || (ChatUiEvent = {}));
32
+ export const CHAT_UI_STORE_TOKEN = symbolToken('CHAT_UI_STORE_TOKEN');
33
+ let ChatUiStore = class ChatUiStore {
34
+ get agent() {
35
+ return this.participants[symbolAgent];
36
+ }
37
+ get user() {
38
+ return this.participants[symbolUser];
39
+ }
40
+ get isStarted() {
41
+ return this.status === ChatRunState.Started;
42
+ }
43
+ get isError() {
44
+ return this.status === ChatRunState.Error;
45
+ }
46
+ get isEnded() {
47
+ return this.status === ChatRunState.Ended;
48
+ }
49
+ get isStarting() {
50
+ return this.status === ChatRunState.Initializing;
51
+ }
52
+ get customizations() {
53
+ return this.customizationContext;
54
+ }
55
+ constructor() {
56
+ Object.defineProperty(this, "isAgentTyping", {
57
+ enumerable: true,
58
+ configurable: true,
59
+ writable: true,
60
+ value: false
61
+ });
62
+ Object.defineProperty(this, "status", {
63
+ enumerable: true,
64
+ configurable: true,
65
+ writable: true,
66
+ value: ChatRunState.Offline
67
+ });
68
+ Object.defineProperty(this, "isFilePickerEnabled", {
69
+ enumerable: true,
70
+ configurable: true,
71
+ writable: true,
72
+ value: false
73
+ });
74
+ Object.defineProperty(this, "file", {
75
+ enumerable: true,
76
+ configurable: true,
77
+ writable: true,
78
+ value: void 0
79
+ });
80
+ Object.defineProperty(this, "error", {
81
+ enumerable: true,
82
+ configurable: true,
83
+ writable: true,
84
+ value: void 0
85
+ });
86
+ Object.defineProperty(this, "endReason", {
87
+ enumerable: true,
88
+ configurable: true,
89
+ writable: true,
90
+ value: void 0
91
+ });
92
+ Object.defineProperty(this, "messages", {
93
+ enumerable: true,
94
+ configurable: true,
95
+ writable: true,
96
+ value: []
97
+ });
98
+ Object.defineProperty(this, "currentFileMessage", {
99
+ enumerable: true,
100
+ configurable: true,
101
+ writable: true,
102
+ value: void 0
103
+ });
104
+ Object.defineProperty(this, "scrollCounter", {
105
+ enumerable: true,
106
+ configurable: true,
107
+ writable: true,
108
+ value: 1
109
+ });
110
+ Object.defineProperty(this, "timer", {
111
+ enumerable: true,
112
+ configurable: true,
113
+ writable: true,
114
+ value: void 0
115
+ });
116
+ Object.defineProperty(this, "participants", {
117
+ enumerable: true,
118
+ configurable: true,
119
+ writable: true,
120
+ value: {
121
+ [symbolAgent]: {
122
+ isAgent: true,
123
+ name: 'Agent',
124
+ icon: ChatParticipantIcon.Initials,
125
+ },
126
+ [symbolUser]: {
127
+ isAgent: false,
128
+ name: 'User',
129
+ icon: ChatParticipantIcon.Initials,
130
+ },
131
+ }
132
+ });
133
+ Object.defineProperty(this, "customizationContext", {
134
+ enumerable: true,
135
+ configurable: true,
136
+ writable: true,
137
+ value: {}
138
+ });
139
+ Object.defineProperty(this, "eventEmitter", {
140
+ enumerable: true,
141
+ configurable: true,
142
+ writable: true,
143
+ value: new EventEmitter()
144
+ });
145
+ Object.defineProperty(this, "incomingMessageSound", {
146
+ enumerable: true,
147
+ configurable: true,
148
+ writable: true,
149
+ value: void 0
150
+ });
151
+ Object.defineProperty(this, "incomingMessageSoundPromise", {
152
+ enumerable: true,
153
+ configurable: true,
154
+ writable: true,
155
+ value: void 0
156
+ });
157
+ Object.defineProperty(this, "on", {
158
+ enumerable: true,
159
+ configurable: true,
160
+ writable: true,
161
+ value: (event, listener) => {
162
+ this.eventEmitter.on(event, listener);
163
+ }
164
+ });
165
+ Object.defineProperty(this, "off", {
166
+ enumerable: true,
167
+ configurable: true,
168
+ writable: true,
169
+ value: (event, listener) => {
170
+ this.eventEmitter.off(event, listener);
171
+ }
172
+ });
173
+ makeObservable(this);
174
+ }
175
+ setCustomizationContext(customizationContext) {
176
+ this.customizationContext = customizationContext !== null && customizationContext !== void 0 ? customizationContext : {};
177
+ this.triggerScroll();
178
+ }
179
+ setIncomingSound(soundUrl) {
180
+ if (this.incomingMessageSound) {
181
+ return;
182
+ }
183
+ this.incomingMessageSound = new Audio(soundUrl);
184
+ }
185
+ setFile(file) {
186
+ this.file = file;
187
+ }
188
+ setFilePickerEnabled(isEnabled) {
189
+ this.isFilePickerEnabled = isEnabled;
190
+ this.setFile();
191
+ this.triggerScroll();
192
+ }
193
+ setTimer(timer) {
194
+ this.timer = timer;
195
+ }
196
+ resetError(runState) {
197
+ this.error = undefined;
198
+ this.setStatus(runState);
199
+ this.triggerScroll();
200
+ }
201
+ setChatError(chatError) {
202
+ this.error = chatError;
203
+ this.setStatus(ChatRunState.Error);
204
+ this.triggerScroll();
205
+ }
206
+ setError(message, options) {
207
+ this.setChatError(new ChatError(message, options));
208
+ }
209
+ setStatus(status) {
210
+ this.status = status;
211
+ }
212
+ setMessages(messages) {
213
+ this.messages = messages;
214
+ this.triggerScroll();
215
+ }
216
+ setAgentName(name) {
217
+ this.agent.name = name;
218
+ }
219
+ setAgentIcon(icon) {
220
+ this.agent.icon = icon;
221
+ }
222
+ setAgentTyping(isAgentTyping) {
223
+ this.isAgentTyping = isAgentTyping;
224
+ this.triggerScroll();
225
+ }
226
+ setEndReason(reason) {
227
+ this.endReason = reason;
228
+ this.triggerScroll();
229
+ }
230
+ setEndedChatState(endReason) {
231
+ this.setEndReason(endReason);
232
+ this.setStatus(ChatRunState.Ended);
233
+ this.setAgentTyping(false);
234
+ this.resetFile();
235
+ this.triggerScroll();
236
+ }
237
+ configure(configuration) {
238
+ if (!configuration) {
239
+ return;
240
+ }
241
+ if (configuration.agentName) {
242
+ this.setAgentName(configuration.agentName);
243
+ }
244
+ if (configuration.agentIcon) {
245
+ this.setAgentIcon(configuration.agentIcon);
246
+ }
247
+ }
248
+ async run(configuration, data) {
249
+ this.configure(configuration);
250
+ if (!this.eventEmitter.listeners(ChatUiEvent.eventRun).length) {
251
+ throw new Error("No listeners for ChatUiEvent.eventRun ('eventRun')");
252
+ }
253
+ await this.emitAsync(ChatUiEvent.eventRun, data);
254
+ }
255
+ async recover() {
256
+ await this.emitAsync(ChatUiEvent.eventRecover, this.error);
257
+ }
258
+ async destroy() {
259
+ this.reset();
260
+ await this.emitAsync(ChatUiEvent.eventDestroy);
261
+ }
262
+ async restart() {
263
+ this.reset();
264
+ await this.emitAsync(ChatUiEvent.eventRestart);
265
+ }
266
+ async cancelChat() {
267
+ await this.emitAsync(ChatUiEvent.eventCancel);
268
+ }
269
+ async endChat(endReason) {
270
+ await this.emitAsync(ChatUiEvent.eventEndChat, endReason);
271
+ }
272
+ async chasitorTyping(isTyping) {
273
+ await this.emitAsync(ChatUiEvent.eventChasitorTyping, isTyping);
274
+ }
275
+ async sendMessageText(message) {
276
+ if (this.isFilePickerEnabled && this.file) {
277
+ // Send text message with file
278
+ runInAction(() => {
279
+ this.isFilePickerEnabled = false;
280
+ this.currentFileMessage = this.addMessageFile(this.file);
281
+ });
282
+ let messageModel;
283
+ if (message.trim() !== '') {
284
+ messageModel = this.addMessage(false, message);
285
+ }
286
+ await this.emitAsync(ChatUiEvent.eventMessageSendFile, this.currentFileMessage, this.file, messageModel);
287
+ }
288
+ else {
289
+ // Send plain text message
290
+ await this.sendMessageTextInternal(message);
291
+ }
292
+ }
293
+ async sendMessageRetry(messageModel) {
294
+ this.resetError(ChatRunState.Started);
295
+ this.setMessageState(messageModel, ChatMessageState.Delivering);
296
+ await this.emitAsync(ChatUiEvent.eventMessageSendRetry, messageModel);
297
+ await this.restartTimers();
298
+ }
299
+ async sendMessageFileRetry(messageModel) {
300
+ this.resetError(ChatRunState.Started);
301
+ this.setMessageState(messageModel, ChatMessageState.Delivering);
302
+ await this.emitAsync(ChatUiEvent.eventMessageSendFileRetry, messageModel);
303
+ }
304
+ getParticipant(participantKey) {
305
+ const participant = this.participants[participantKey];
306
+ return { ...participant };
307
+ }
308
+ addMessage(isAgent, message, data) {
309
+ return this.addMessageInternal({
310
+ type: 'message',
311
+ state: ChatMessageState.Delivering,
312
+ participant: this.getParticipant(isAgent ? symbolAgent : symbolUser),
313
+ data,
314
+ message,
315
+ });
316
+ }
317
+ addMessageTimeout() {
318
+ const isNewChat = this.messages.length === 0 || this.messages.every(m => m.type === 'welcome');
319
+ if (isNewChat) {
320
+ return;
321
+ }
322
+ return this.addMessageInternal({
323
+ type: 'timeout',
324
+ participant: this.agent,
325
+ state: ChatMessageState.Delivered,
326
+ });
327
+ }
328
+ addMessageWelcome(message) {
329
+ return this.addMessageInternal({
330
+ type: 'welcome',
331
+ state: ChatMessageState.Delivered,
332
+ participant: this.getParticipant(symbolAgent),
333
+ message,
334
+ });
335
+ }
336
+ addMessageFile(file) {
337
+ var _a;
338
+ return this.addMessageInternal({
339
+ fileName: (_a = file.displayName) !== null && _a !== void 0 ? _a : 'attachment',
340
+ type: 'file',
341
+ state: ChatMessageState.Delivering,
342
+ participant: this.user,
343
+ });
344
+ }
345
+ async restartTimers() {
346
+ this.removeMessageByType('timeout');
347
+ await this.emitAsync(ChatUiEvent.eventTimerRestart);
348
+ }
349
+ setMessageState(message, state, data) {
350
+ const foundMessage = this.messages.find(m => m.id === message.id);
351
+ if (foundMessage) {
352
+ foundMessage.state = state;
353
+ if (data) {
354
+ foundMessage.data = data;
355
+ }
356
+ }
357
+ }
358
+ resetFile() {
359
+ this.currentFileMessage = undefined;
360
+ this.file = undefined;
361
+ this.isFilePickerEnabled = false;
362
+ this.triggerScroll();
363
+ }
364
+ reset(resetStatus = true) {
365
+ this.setMessages([]);
366
+ if (resetStatus) {
367
+ this.status = ChatRunState.Offline;
368
+ }
369
+ this.error = undefined;
370
+ this.isAgentTyping = false;
371
+ this.endReason = undefined;
372
+ this.resetFile();
373
+ }
374
+ getLastFailedMessages() {
375
+ const result = [];
376
+ for (let i = this.messages.length - 1; i >= 0; i--) {
377
+ const message = this.messages[i];
378
+ if (message.type === 'message' && !message.participant.isAgent) {
379
+ if (message.state !== ChatMessageState.Failed) {
380
+ break;
381
+ }
382
+ result.push(message);
383
+ }
384
+ }
385
+ return result;
386
+ }
387
+ triggerScroll() {
388
+ setTimeout(() => {
389
+ runInAction(() => {
390
+ this.scrollCounter++;
391
+ });
392
+ }, 0);
393
+ }
394
+ async emitAsync(event, ...args) {
395
+ if (!this.eventEmitter.listenerCount(event)) {
396
+ return Promise.resolve();
397
+ }
398
+ return new Promise((resolve, reject) => {
399
+ this.eventEmitter.emit(event, resolve, reject, ...args);
400
+ });
401
+ }
402
+ addMessageInternal(message) {
403
+ if (message.type === 'timeout') {
404
+ this.removeMessageByType('timeout'); // Remove previous timeout messages
405
+ }
406
+ else {
407
+ this.restartTimers().then(() => { });
408
+ }
409
+ this.setMessages([...this.messages, this.createMessage(message)]);
410
+ if (message.participant.isAgent) {
411
+ this.beepIncoming().catch(() => { });
412
+ }
413
+ return this.messages.at(-1);
414
+ }
415
+ removeMessageByType(type) {
416
+ if (this.messages.some(m => m.type === type)) {
417
+ this.setMessages(this.messages.filter(m => m.type !== type));
418
+ }
419
+ }
420
+ async sendMessageTextInternal(message) {
421
+ if (message.trim() === '') {
422
+ return;
423
+ }
424
+ const messageModel = this.addMessage(false, message);
425
+ await this.emitAsync(ChatUiEvent.eventMessageSend, messageModel);
426
+ }
427
+ createMessage(rest) {
428
+ return {
429
+ id: nanoid(),
430
+ timestamp: new Date(),
431
+ ...rest,
432
+ };
433
+ }
434
+ async beepIncoming() {
435
+ if (!this.incomingMessageSound) {
436
+ return;
437
+ }
438
+ try {
439
+ if (!this.incomingMessageSoundPromise) {
440
+ this.incomingMessageSoundPromise = this.incomingMessageSound.play();
441
+ }
442
+ await this.incomingMessageSoundPromise;
443
+ }
444
+ finally {
445
+ this.incomingMessageSoundPromise = undefined;
446
+ }
447
+ }
448
+ };
449
+ __decorate([
450
+ observable,
451
+ __metadata("design:type", Object)
452
+ ], ChatUiStore.prototype, "isAgentTyping", void 0);
453
+ __decorate([
454
+ observable,
455
+ __metadata("design:type", Object)
456
+ ], ChatUiStore.prototype, "status", void 0);
457
+ __decorate([
458
+ observable,
459
+ __metadata("design:type", Object)
460
+ ], ChatUiStore.prototype, "isFilePickerEnabled", void 0);
461
+ __decorate([
462
+ observable.ref,
463
+ __metadata("design:type", ChatError)
464
+ ], ChatUiStore.prototype, "error", void 0);
465
+ __decorate([
466
+ observable,
467
+ __metadata("design:type", String)
468
+ ], ChatUiStore.prototype, "endReason", void 0);
469
+ __decorate([
470
+ observable,
471
+ __metadata("design:type", Array)
472
+ ], ChatUiStore.prototype, "messages", void 0);
473
+ __decorate([
474
+ observable,
475
+ __metadata("design:type", Object)
476
+ ], ChatUiStore.prototype, "currentFileMessage", void 0);
477
+ __decorate([
478
+ observable,
479
+ __metadata("design:type", Object)
480
+ ], ChatUiStore.prototype, "scrollCounter", void 0);
481
+ __decorate([
482
+ observable,
483
+ __metadata("design:type", Object)
484
+ ], ChatUiStore.prototype, "timer", void 0);
485
+ __decorate([
486
+ observable,
487
+ __metadata("design:type", Object)
488
+ ], ChatUiStore.prototype, "participants", void 0);
489
+ __decorate([
490
+ computed,
491
+ __metadata("design:type", Object),
492
+ __metadata("design:paramtypes", [])
493
+ ], ChatUiStore.prototype, "agent", null);
494
+ __decorate([
495
+ computed,
496
+ __metadata("design:type", Object),
497
+ __metadata("design:paramtypes", [])
498
+ ], ChatUiStore.prototype, "user", null);
499
+ __decorate([
500
+ computed,
501
+ __metadata("design:type", Object),
502
+ __metadata("design:paramtypes", [])
503
+ ], ChatUiStore.prototype, "isStarted", null);
504
+ __decorate([
505
+ computed,
506
+ __metadata("design:type", Object),
507
+ __metadata("design:paramtypes", [])
508
+ ], ChatUiStore.prototype, "isError", null);
509
+ __decorate([
510
+ computed,
511
+ __metadata("design:type", Object),
512
+ __metadata("design:paramtypes", [])
513
+ ], ChatUiStore.prototype, "isEnded", null);
514
+ __decorate([
515
+ computed,
516
+ __metadata("design:type", Object),
517
+ __metadata("design:paramtypes", [])
518
+ ], ChatUiStore.prototype, "isStarting", null);
519
+ __decorate([
520
+ computed,
521
+ __metadata("design:type", Object),
522
+ __metadata("design:paramtypes", [])
523
+ ], ChatUiStore.prototype, "customizations", null);
524
+ __decorate([
525
+ observable,
526
+ __metadata("design:type", Object)
527
+ ], ChatUiStore.prototype, "customizationContext", void 0);
528
+ __decorate([
529
+ action,
530
+ __metadata("design:type", Function),
531
+ __metadata("design:paramtypes", [Object]),
532
+ __metadata("design:returntype", void 0)
533
+ ], ChatUiStore.prototype, "setCustomizationContext", null);
534
+ __decorate([
535
+ action,
536
+ __metadata("design:type", Function),
537
+ __metadata("design:paramtypes", [Boolean]),
538
+ __metadata("design:returntype", void 0)
539
+ ], ChatUiStore.prototype, "setFilePickerEnabled", null);
540
+ __decorate([
541
+ action,
542
+ __metadata("design:type", Function),
543
+ __metadata("design:paramtypes", [Object]),
544
+ __metadata("design:returntype", void 0)
545
+ ], ChatUiStore.prototype, "setTimer", null);
546
+ __decorate([
547
+ action,
548
+ __metadata("design:type", Function),
549
+ __metadata("design:paramtypes", [Number]),
550
+ __metadata("design:returntype", void 0)
551
+ ], ChatUiStore.prototype, "resetError", null);
552
+ __decorate([
553
+ action,
554
+ __metadata("design:type", Function),
555
+ __metadata("design:paramtypes", [ChatError]),
556
+ __metadata("design:returntype", void 0)
557
+ ], ChatUiStore.prototype, "setChatError", null);
558
+ __decorate([
559
+ action,
560
+ __metadata("design:type", Function),
561
+ __metadata("design:paramtypes", [String, Object]),
562
+ __metadata("design:returntype", void 0)
563
+ ], ChatUiStore.prototype, "setError", null);
564
+ __decorate([
565
+ action,
566
+ __metadata("design:type", Function),
567
+ __metadata("design:paramtypes", [Number]),
568
+ __metadata("design:returntype", void 0)
569
+ ], ChatUiStore.prototype, "setStatus", null);
570
+ __decorate([
571
+ action,
572
+ __metadata("design:type", Function),
573
+ __metadata("design:paramtypes", [Array]),
574
+ __metadata("design:returntype", void 0)
575
+ ], ChatUiStore.prototype, "setMessages", null);
576
+ __decorate([
577
+ action,
578
+ __metadata("design:type", Function),
579
+ __metadata("design:paramtypes", [String]),
580
+ __metadata("design:returntype", void 0)
581
+ ], ChatUiStore.prototype, "setAgentName", null);
582
+ __decorate([
583
+ action,
584
+ __metadata("design:type", Function),
585
+ __metadata("design:paramtypes", [String]),
586
+ __metadata("design:returntype", void 0)
587
+ ], ChatUiStore.prototype, "setAgentIcon", null);
588
+ __decorate([
589
+ action,
590
+ __metadata("design:type", Function),
591
+ __metadata("design:paramtypes", [Boolean]),
592
+ __metadata("design:returntype", void 0)
593
+ ], ChatUiStore.prototype, "setAgentTyping", null);
594
+ __decorate([
595
+ action,
596
+ __metadata("design:type", Function),
597
+ __metadata("design:paramtypes", [String]),
598
+ __metadata("design:returntype", void 0)
599
+ ], ChatUiStore.prototype, "setEndReason", null);
600
+ __decorate([
601
+ action,
602
+ __metadata("design:type", Function),
603
+ __metadata("design:paramtypes", [String]),
604
+ __metadata("design:returntype", void 0)
605
+ ], ChatUiStore.prototype, "setEndedChatState", null);
606
+ __decorate([
607
+ action,
608
+ __metadata("design:type", Function),
609
+ __metadata("design:paramtypes", [Object]),
610
+ __metadata("design:returntype", void 0)
611
+ ], ChatUiStore.prototype, "configure", null);
612
+ __decorate([
613
+ action,
614
+ __metadata("design:type", Function),
615
+ __metadata("design:paramtypes", [String]),
616
+ __metadata("design:returntype", Promise)
617
+ ], ChatUiStore.prototype, "sendMessageText", null);
618
+ __decorate([
619
+ action,
620
+ __metadata("design:type", Function),
621
+ __metadata("design:paramtypes", [Object]),
622
+ __metadata("design:returntype", Promise)
623
+ ], ChatUiStore.prototype, "sendMessageRetry", null);
624
+ __decorate([
625
+ action,
626
+ __metadata("design:type", Function),
627
+ __metadata("design:paramtypes", [Object]),
628
+ __metadata("design:returntype", Promise)
629
+ ], ChatUiStore.prototype, "sendMessageFileRetry", null);
630
+ __decorate([
631
+ action,
632
+ __metadata("design:type", Function),
633
+ __metadata("design:paramtypes", [Boolean, String, Object]),
634
+ __metadata("design:returntype", void 0)
635
+ ], ChatUiStore.prototype, "addMessage", null);
636
+ __decorate([
637
+ action,
638
+ __metadata("design:type", Function),
639
+ __metadata("design:paramtypes", []),
640
+ __metadata("design:returntype", void 0)
641
+ ], ChatUiStore.prototype, "addMessageTimeout", null);
642
+ __decorate([
643
+ action,
644
+ __metadata("design:type", Function),
645
+ __metadata("design:paramtypes", [String]),
646
+ __metadata("design:returntype", void 0)
647
+ ], ChatUiStore.prototype, "addMessageWelcome", null);
648
+ __decorate([
649
+ action,
650
+ __metadata("design:type", Function),
651
+ __metadata("design:paramtypes", [Object]),
652
+ __metadata("design:returntype", void 0)
653
+ ], ChatUiStore.prototype, "addMessageFile", null);
654
+ __decorate([
655
+ action,
656
+ __metadata("design:type", Function),
657
+ __metadata("design:paramtypes", []),
658
+ __metadata("design:returntype", Promise)
659
+ ], ChatUiStore.prototype, "restartTimers", null);
660
+ __decorate([
661
+ action,
662
+ __metadata("design:type", Function),
663
+ __metadata("design:paramtypes", [Object, String, Object]),
664
+ __metadata("design:returntype", void 0)
665
+ ], ChatUiStore.prototype, "setMessageState", null);
666
+ __decorate([
667
+ action,
668
+ __metadata("design:type", Function),
669
+ __metadata("design:paramtypes", []),
670
+ __metadata("design:returntype", void 0)
671
+ ], ChatUiStore.prototype, "resetFile", null);
672
+ __decorate([
673
+ action,
674
+ __metadata("design:type", Function),
675
+ __metadata("design:paramtypes", [Object]),
676
+ __metadata("design:returntype", void 0)
677
+ ], ChatUiStore.prototype, "reset", null);
678
+ ChatUiStore = __decorate([
679
+ injectable(),
680
+ __metadata("design:paramtypes", [])
681
+ ], ChatUiStore);
682
+ export { ChatUiStore };
683
+ //# sourceMappingURL=chat-ui.store.js.map