@telia-ace/widget-conversational-hub 1.1.2
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/connection-interface.d.ts +29 -0
- package/connection.d.ts +21 -0
- package/dialog.d.ts +28 -0
- package/index-5087564d.mjs +335 -0
- package/index-6dd00f59.js +1 -0
- package/index.d.ts +2 -0
- package/index.js +160 -0
- package/index.mjs +3961 -0
- package/package.json +18 -0
- package/plugin.d.ts +3 -0
- package/provider.d.ts +24 -0
- package/types.d.ts +16 -0
- package/utils.d.ts +6 -0
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export type SendMessagePayload = {
|
|
2
|
+
sequenceNumber: number;
|
|
3
|
+
};
|
|
4
|
+
export type SendMessageTextPayload = {
|
|
5
|
+
inputPayload: {
|
|
6
|
+
textInputContent: {
|
|
7
|
+
text: string;
|
|
8
|
+
};
|
|
9
|
+
};
|
|
10
|
+
} & SendMessagePayload;
|
|
11
|
+
export type SubscriptionHandlerDelegate = (options: {
|
|
12
|
+
text: string;
|
|
13
|
+
isComplete: boolean;
|
|
14
|
+
sequenceNumber: number;
|
|
15
|
+
}) => void;
|
|
16
|
+
export type SubscriptionUnknownHandlerDelegate = (options: {
|
|
17
|
+
sequenceNumber: number;
|
|
18
|
+
}) => void;
|
|
19
|
+
export type SendMessageInitializePayload = {
|
|
20
|
+
initializeRequestPayload: {
|
|
21
|
+
extension: string;
|
|
22
|
+
};
|
|
23
|
+
} & SendMessagePayload;
|
|
24
|
+
export interface IConnection {
|
|
25
|
+
isConnected: boolean;
|
|
26
|
+
sendMessage: (payload: SendMessageTextPayload | SendMessageInitializePayload) => void;
|
|
27
|
+
subscribe: (fn: SubscriptionHandlerDelegate) => void;
|
|
28
|
+
subscribeUnknown: (fn: SubscriptionUnknownHandlerDelegate) => void;
|
|
29
|
+
}
|
package/connection.d.ts
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { IConnection, SendMessageInitializePayload, SendMessageTextPayload } from './connection-interface';
|
|
2
|
+
export declare class Connection implements IConnection {
|
|
3
|
+
private ws;
|
|
4
|
+
isConnected: boolean;
|
|
5
|
+
private messageDelegate?;
|
|
6
|
+
private unknownMessageDelegate?;
|
|
7
|
+
constructor(url: string);
|
|
8
|
+
private onConnected;
|
|
9
|
+
private onMessage;
|
|
10
|
+
private onError;
|
|
11
|
+
private onClose;
|
|
12
|
+
sendMessage(payload: SendMessageTextPayload | SendMessageInitializePayload): void;
|
|
13
|
+
subscribe(handler: (options: {
|
|
14
|
+
text: string;
|
|
15
|
+
isComplete: boolean;
|
|
16
|
+
sequenceNumber: number;
|
|
17
|
+
}) => void): void;
|
|
18
|
+
subscribeUnknown(handler: (options: {
|
|
19
|
+
sequenceNumber: number;
|
|
20
|
+
}) => void): void;
|
|
21
|
+
}
|
package/dialog.d.ts
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { ConversationEntry } from '@telia-ace/widget-conversation-flamingo';
|
|
2
|
+
type SendMessagePayload = {
|
|
3
|
+
text: string;
|
|
4
|
+
};
|
|
5
|
+
export type ReceiveMessage = {
|
|
6
|
+
text: string;
|
|
7
|
+
isComplete: boolean;
|
|
8
|
+
sequenceNumber: number;
|
|
9
|
+
};
|
|
10
|
+
type DialogSettings = {
|
|
11
|
+
connectionUri: string;
|
|
12
|
+
};
|
|
13
|
+
export declare class Dialog {
|
|
14
|
+
private settings;
|
|
15
|
+
private connection;
|
|
16
|
+
private bucket;
|
|
17
|
+
private currentSequenceNumber;
|
|
18
|
+
private messageSubscription?;
|
|
19
|
+
constructor(settings: DialogSettings);
|
|
20
|
+
sendMessage(message: SendMessagePayload): void;
|
|
21
|
+
isConnected(): boolean;
|
|
22
|
+
subscribe(handler: (message: ReceiveMessage) => ConversationEntry | null): void;
|
|
23
|
+
private onMessage;
|
|
24
|
+
private onUnknown;
|
|
25
|
+
private handleIncomingSequenceNumber;
|
|
26
|
+
private incrementSequenceNumber;
|
|
27
|
+
}
|
|
28
|
+
export {};
|