@xapp/chat-widget 1.52.7 → 1.53.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.
- package/dist/index.css +2 -2
- package/dist/index.es.js +463 -11
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +463 -11
- package/dist/index.js.map +1 -1
- package/dist/store/ChatAction.d.ts +1 -1
- package/dist/utils/PersistentStorage.d.ts +1 -1
- package/dist/utils/compiler/models.d.ts +1 -1
- package/dist/utils/requestFromMessage.d.ts +4 -0
- package/dist/utils/requestToMessage.d.ts +12 -0
- package/dist/xapp/StentorRouterChat.d.ts +66 -0
- package/package.json +7 -7
|
@@ -109,7 +109,7 @@ export interface SyntheticFileDetail extends ChatActionDetail<"visitor.send.file
|
|
|
109
109
|
/**
|
|
110
110
|
* Optional request attributes.
|
|
111
111
|
*/
|
|
112
|
-
readonly attributes?: Record<string,
|
|
112
|
+
readonly attributes?: Record<string, unknown>;
|
|
113
113
|
}
|
|
114
114
|
export interface ResetAction extends Action<"reset"> {
|
|
115
115
|
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/*! Copyright (c) 2022, XAPPmedia */
|
|
2
|
+
import { ChatMessageRequest } from "../xapp/ChatServerMessage";
|
|
3
|
+
import { StentorRequest } from "./http-utils";
|
|
4
|
+
export declare function requestFromMessage(message: ChatMessageRequest, userId: string, isNewSession: boolean, sessionId: string, accessToken: string, attributes: Record<string, unknown>): StentorRequest;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Request } from "stentor-models";
|
|
2
|
+
import { ChatMessageRequest } from "../xapp/ChatServerMessage";
|
|
3
|
+
/**
|
|
4
|
+
* Converts a Stentor Request (from a widget) to a ChatMessageRequest
|
|
5
|
+
*
|
|
6
|
+
* it's text only - need to look into file exchange (this is widget-to-widget communication)
|
|
7
|
+
*
|
|
8
|
+
* @param botRequest
|
|
9
|
+
* @param now
|
|
10
|
+
* @returns
|
|
11
|
+
*/
|
|
12
|
+
export declare function requestToMessage(botRequest: Request, now?: number): ChatMessageRequest;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { Request, Response } from "stentor-models";
|
|
2
|
+
import { ActionType } from "../store/ChatAction";
|
|
3
|
+
import { ChatServer, ChatServerOptions, OfflineMessage, VisitorInfoMessage } from "./ChatServer";
|
|
4
|
+
import { ChatMessageRequest, ChatServerMessage } from "./ChatServerMessage";
|
|
5
|
+
export interface StentorRouterChatConfig {
|
|
6
|
+
readonly url: string;
|
|
7
|
+
}
|
|
8
|
+
export declare type StentorMessage = Request | Response | undefined;
|
|
9
|
+
export interface RouterMessage {
|
|
10
|
+
event: string;
|
|
11
|
+
data: StentorMessage;
|
|
12
|
+
sender: VisitorInfo;
|
|
13
|
+
}
|
|
14
|
+
export interface VisitorInfo {
|
|
15
|
+
deviceId: "Widget" | "Bot";
|
|
16
|
+
userId: string;
|
|
17
|
+
isAdmin: boolean;
|
|
18
|
+
avatarPath?: string;
|
|
19
|
+
displayName?: string;
|
|
20
|
+
email?: string;
|
|
21
|
+
urlAttributes: {
|
|
22
|
+
path?: string[];
|
|
23
|
+
query?: {
|
|
24
|
+
(name: string): string;
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
export interface HandlerStore {
|
|
29
|
+
(event: string): (data: StentorMessage, sender: VisitorInfo) => void;
|
|
30
|
+
}
|
|
31
|
+
export declare class StentorRouterChat implements ChatServer {
|
|
32
|
+
private dispatch;
|
|
33
|
+
private _userId;
|
|
34
|
+
private _sessionId;
|
|
35
|
+
private visitorInfo;
|
|
36
|
+
private accessToken;
|
|
37
|
+
private attributes;
|
|
38
|
+
private isNewSession;
|
|
39
|
+
private isAdmin;
|
|
40
|
+
private urlAttributes;
|
|
41
|
+
private readonly config;
|
|
42
|
+
private readonly options;
|
|
43
|
+
private serverUrl;
|
|
44
|
+
private ws;
|
|
45
|
+
private handlers;
|
|
46
|
+
constructor(config: StentorRouterChatConfig, options?: ChatServerOptions);
|
|
47
|
+
init(dispatch: (action: ActionType) => void): void;
|
|
48
|
+
private autoReconnect;
|
|
49
|
+
private wsCreate;
|
|
50
|
+
private emit;
|
|
51
|
+
private setAccountStatus;
|
|
52
|
+
sendOfflineMsg(_: OfflineMessage, cb: (error?: Error) => void): void;
|
|
53
|
+
sendChatMsg(message: ChatServerMessage, cb: (err?: Error) => void): Promise<void>;
|
|
54
|
+
sendChatMsgRequest(serviceRequest: ChatMessageRequest, cb: (err?: Error) => void): Promise<void>;
|
|
55
|
+
sendTyping(isTyping: boolean): void;
|
|
56
|
+
setVisitorInfo(visitorInfoMessage: VisitorInfoMessage, cb: (error?: Error) => void): void;
|
|
57
|
+
sendChatRating(): void;
|
|
58
|
+
sendFile(_: File, cb: (err?: Error) => void): void;
|
|
59
|
+
markAsRead(): void;
|
|
60
|
+
flush(): void;
|
|
61
|
+
dispose(): void;
|
|
62
|
+
private postMessage;
|
|
63
|
+
private startSession;
|
|
64
|
+
get userId(): string;
|
|
65
|
+
get sessionId(): string;
|
|
66
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xapp/chat-widget",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.53.0",
|
|
4
4
|
"description": "XAPP Chat Widget",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"clean": "rm -rf ./lib/* && rm -rf ./dist/*",
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
"@types/enzyme": "3.10.12",
|
|
51
51
|
"@types/enzyme-adapter-react-16": "1.0.6",
|
|
52
52
|
"@types/jest": "27.5.2",
|
|
53
|
-
"@types/react": "17.0.
|
|
53
|
+
"@types/react": "17.0.52",
|
|
54
54
|
"@types/react-redux": "7.1.24",
|
|
55
55
|
"@types/react-transition-group": "4.4.5",
|
|
56
56
|
"@types/socket.io-client": "1.4.36",
|
|
@@ -82,10 +82,10 @@
|
|
|
82
82
|
"rollup-plugin-peer-deps-external": "2.2.4",
|
|
83
83
|
"rollup-plugin-scss": "3.0.0",
|
|
84
84
|
"rollup-plugin-terser": "7.0.2",
|
|
85
|
-
"rollup-plugin-typescript2": "0.
|
|
85
|
+
"rollup-plugin-typescript2": "0.34.1",
|
|
86
86
|
"sass": "1.53.0",
|
|
87
87
|
"sass-loader": "10.3.1",
|
|
88
|
-
"stentor-models": "1.
|
|
88
|
+
"stentor-models": "1.57.23",
|
|
89
89
|
"ts-jest": "27.1.5",
|
|
90
90
|
"typescript": "4.7.4"
|
|
91
91
|
},
|
|
@@ -102,13 +102,13 @@
|
|
|
102
102
|
},
|
|
103
103
|
"dependencies": {
|
|
104
104
|
"@rollup/plugin-replace": "^4.0.0",
|
|
105
|
-
"@xapp/chat-widget-core": "1.
|
|
106
|
-
"@xapp/stentor-chat-widget": "1.
|
|
105
|
+
"@xapp/chat-widget-core": "1.53.0",
|
|
106
|
+
"@xapp/stentor-chat-widget": "1.53.0",
|
|
107
107
|
"date-fns": "2.28.0",
|
|
108
108
|
"react-transition-group": "4.4.5",
|
|
109
109
|
"socket.io-client": "4.5.1",
|
|
110
110
|
"store": "2.0.12",
|
|
111
111
|
"tslib": "2.4.0"
|
|
112
112
|
},
|
|
113
|
-
"gitHead": "
|
|
113
|
+
"gitHead": "790e52d7da2ada2f92ec27d2c02d5d73c96c5ab8"
|
|
114
114
|
}
|