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