@ujet/websdk-headless 3.6.2 → 3.6.4
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 +8 -0
- package/dist/index.d.ts +4 -2
- package/dist/index.js +70 -69
- package/dist/index.mjs +11191 -10566
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -384,12 +384,20 @@ This method is used to get all the previous messages, it is usually used
|
|
|
384
384
|
together with `loadOngoingChat`. You would use this method after chat
|
|
385
385
|
is connected.
|
|
386
386
|
|
|
387
|
+
The following snippet is using a Deprecated event, please use `chat.connectedMessages` instead.
|
|
387
388
|
```ts
|
|
388
389
|
client.on("chat.connected", async () => {
|
|
389
390
|
const messages = await client.fetchMessages()
|
|
390
391
|
})
|
|
391
392
|
```
|
|
392
393
|
|
|
394
|
+
Additionally, you can use the `chat.connectedMessages` event and recieve a duple with the `Chat` and an array of `MessageResponse`:
|
|
395
|
+
```ts
|
|
396
|
+
client.on("chat.connectedMessages", async ({chat, messages}: { chat: Chat, messages: MessageResponse[]}) => {
|
|
397
|
+
// ...
|
|
398
|
+
})
|
|
399
|
+
```
|
|
400
|
+
|
|
393
401
|
### `sendTextMessage`
|
|
394
402
|
|
|
395
403
|
Send a text message:
|
package/dist/index.d.ts
CHANGED
|
@@ -414,7 +414,7 @@ declare class Chat {
|
|
|
414
414
|
private provider;
|
|
415
415
|
private store;
|
|
416
416
|
private globalEvents;
|
|
417
|
-
state: ChatResponse;
|
|
417
|
+
state: ChatResponse | null;
|
|
418
418
|
connected: boolean;
|
|
419
419
|
allowSkipVirtualAgent: boolean;
|
|
420
420
|
inEscalation: boolean;
|
|
@@ -465,6 +465,7 @@ declare class Chat {
|
|
|
465
465
|
clearMediaStore(): Promise<void>;
|
|
466
466
|
_handleChatEndedEvent(message: MessageResponse): void;
|
|
467
467
|
private triggerEvent;
|
|
468
|
+
private registerProviderEvents;
|
|
468
469
|
private registerMessageEvents;
|
|
469
470
|
}
|
|
470
471
|
|
|
@@ -540,7 +541,7 @@ declare class Client {
|
|
|
540
541
|
getChatHistory(page?: number): Promise<ChatHistoryResponse>;
|
|
541
542
|
fetchMessages(): Promise<MessageResponse[]>;
|
|
542
543
|
sendFileMessage(file: File): Promise<number>;
|
|
543
|
-
sendTextMessage(
|
|
544
|
+
sendTextMessage(rawContent: string): Promise<void>;
|
|
544
545
|
createCobrowseCode(lang?: string, customData?: Record<string, string>): Promise<string>;
|
|
545
546
|
startCobrowse(from?: string): Promise<void>;
|
|
546
547
|
getMessageAttachment(message: MessageResponse): Promise<File>;
|
|
@@ -574,6 +575,7 @@ declare abstract class BaseProvider {
|
|
|
574
575
|
abstract sendMessage(message: MessageRequest): Promise<number>;
|
|
575
576
|
abstract startTyping(): void;
|
|
576
577
|
abstract stopTyping(): void;
|
|
578
|
+
abstract registerConversationEvents(): void;
|
|
577
579
|
}
|
|
578
580
|
declare function addProviderType(Provider: typeof BaseProvider): void;
|
|
579
581
|
|