@ujet/websdk-headless 3.0.3 → 3.0.5

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.
package/README.md CHANGED
@@ -87,13 +87,29 @@ interface CompanyResponse {
87
87
  }
88
88
  ```
89
89
 
90
+ ### `getAfterHourMessage`
91
+
92
+ This method is used for fetching the message for after hour deflection.
93
+
94
+ Request parameter:
95
+
96
+ ```ts
97
+ (lang?: string)
98
+ ```
99
+
100
+ Example:
101
+
102
+ ```js
103
+ const message: string = await client.getAfterHourMessage()
104
+ ```
105
+
90
106
  ### `getMenus`
91
107
 
92
108
  This method is used to list all the menu items available for the tenant.
93
109
 
94
110
  Request parameter:
95
111
 
96
- ```js
112
+ ```ts
97
113
  (key?: string, lang?: string)
98
114
  ```
99
115
 
@@ -139,7 +155,7 @@ This method is used to get available time slots for scheduled calls.
139
155
 
140
156
  Request parameter:
141
157
 
142
- ```js
158
+ ```ts
143
159
  (menuId: number | string, lang?: string)
144
160
  ```
145
161
 
@@ -166,6 +182,22 @@ Response data example:
166
182
  ]
167
183
  ```
168
184
 
185
+ ### `getWaitTimes`
186
+
187
+ This method is used to get the waiting time for chat channel and call channel of
188
+ a menu.
189
+
190
+ Request parameter:
191
+
192
+ ```ts
193
+ (menuId: number | string, lang?: string)
194
+ ```
195
+
196
+ Example:
197
+
198
+ ```ts
199
+ const {chat, voice_call} = await client.getWaitTimes(123)
200
+ ```
169
201
 
170
202
  ### `createCall`
171
203
 
@@ -298,6 +330,27 @@ method will try to load the ongoing chat information.
298
330
  const chat = await client.loadOngoingChat()
299
331
  ```
300
332
 
333
+ ### `getChatDeflection`
334
+
335
+ This method is used to fetch the chat deflection configuration.
336
+
337
+ Example:
338
+
339
+ ```ts
340
+ // this method can only be used when there is a chat
341
+ const deflection = await client.getChatDeflection()
342
+ ```
343
+
344
+ The response is `null` or:
345
+
346
+ ```ts
347
+ interface ChatDeflectionResponse {
348
+ enabled: boolean;
349
+ threshold: number;
350
+ keep_waiting: boolean;
351
+ }
352
+ ```
353
+
301
354
  ### `escalateChat`
302
355
 
303
356
  This method will transfer the chat from virtual agent to human agent.
@@ -324,6 +377,18 @@ This method will destroy current ongoing chat.
324
377
  client.destroyChat()
325
378
  ```
326
379
 
380
+ ### `fetchMessages`
381
+
382
+ This method is used to get all the previous messages, it is usually used
383
+ together with `loadOngoingChat`. You would use this method after chat
384
+ is connected.
385
+
386
+ ```ts
387
+ client.on("chat.connected", async () => {
388
+ const messages = await client.fetchMessages()
389
+ })
390
+ ```
391
+
327
392
  ### `sendTextMessage`
328
393
 
329
394
  Send a text message:
@@ -358,12 +423,12 @@ Create cobrowse code digits:
358
423
  client.createCobrowseCode()
359
424
  ```
360
425
 
361
- ### `sendChatTranscript`
426
+ ### `sendChatTranscripts`
362
427
 
363
- Send current chat transcript to the given emails.
428
+ Send current chat transcripts to the given emails.
364
429
 
365
430
  ```ts
366
- client.sendChatTranscript([
431
+ client.sendChatTranscripts([
367
432
  "name1@example.com",
368
433
  "name2@example.com",
369
434
  ])
@@ -486,6 +551,16 @@ client.on("authenticated", () => {
486
551
  })
487
552
  ```
488
553
 
554
+ ### chat.ongoing
555
+
556
+ Emit when there is an ongoing chat.
557
+
558
+ ```js
559
+ client.on("chat.ongoing", (chat) => {
560
+ console.log(chat)
561
+ })
562
+ ```
563
+
489
564
  ### chat.updated
490
565
 
491
566
  Emit when `chat` instance has updated.