@xapp/chat-widget 1.31.0 → 1.34.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/components/Avatar/Avatar.d.ts +2 -2
- package/dist/components/ChatMessage/ChatMessage.d.ts +2 -2
- package/dist/components/ChatMessagePart/ChatMessagePart.d.ts +2 -2
- package/dist/components/ChatRating/ChatRating.d.ts +2 -2
- package/dist/components/ChatRating/ChatRatingContainer.d.ts +2 -2
- package/dist/components/StatusContainer/StatusContainer.d.ts +2 -2
- package/dist/index.css +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.es.js +282 -214
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +282 -214
- package/dist/index.js.map +1 -1
- package/dist/middlewares/message-middleware.d.ts +2 -2
- package/dist/middlewares/middleware-ctx-factory.d.ts +2 -2
- package/dist/store/ChatAction.d.ts +3 -3
- package/dist/store/ChatState.d.ts +3 -3
- package/dist/store/actions/writeMessage.d.ts +2 -2
- package/dist/utils/index.d.ts +4 -3
- package/dist/xapp/ChatServer.d.ts +5 -0
- package/dist/xapp/ChatServerMessage.d.ts +2 -2
- package/dist/xapp/StentorDirectChat.d.ts +10 -5
- package/dist/xapp/StentorServerChat.d.ts +4 -5
- package/dist/xapp/UserInfo.d.ts +2 -4
- package/dist/xapp/XappChat.d.ts +3 -3
- package/package.json +13 -13
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { FC } from "react";
|
|
2
2
|
import { Display } from "stentor-models";
|
|
3
3
|
import { ChatMessageRequest } from "../xapp/ChatServerMessage";
|
|
4
|
-
import {
|
|
4
|
+
import { ChatUserInfo } from "../xapp/UserInfo";
|
|
5
5
|
export declare type MessageMiddlewareSendMessage = Omit<ChatMessageRequest, "timestamp">;
|
|
6
6
|
export interface MessageMiddlewareContext {
|
|
7
|
-
readonly user:
|
|
7
|
+
readonly user: ChatUserInfo;
|
|
8
8
|
send(msg: MessageMiddlewareSendMessage): void;
|
|
9
9
|
write(msg: MessageMiddlewareSendMessage): void;
|
|
10
10
|
openUrl(url: string): void;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ChatUserInfo } from "../xapp/UserInfo";
|
|
2
2
|
import { MessageMiddlewareContext } from "./message-middleware";
|
|
3
3
|
export declare type MessageMiddlewareContextTemplate = Omit<MessageMiddlewareContext, "user">;
|
|
4
4
|
export declare class MiddlewareContextFactory {
|
|
5
5
|
private readonly cache;
|
|
6
6
|
private readonly template;
|
|
7
7
|
constructor(template: MessageMiddlewareContextTemplate);
|
|
8
|
-
resolve(user:
|
|
8
|
+
resolve(user: ChatUserInfo): MessageMiddlewareContext | undefined;
|
|
9
9
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Action } from "redux";
|
|
2
2
|
import { Attachment } from "../xapp/Attachment";
|
|
3
3
|
import { ChatServerMessage } from "../xapp/ChatServerMessage";
|
|
4
|
-
import {
|
|
4
|
+
import { ChatUserInfo } from "../xapp/UserInfo";
|
|
5
5
|
export declare type CONNECTION_STATUS_TYPE = "online" | "pending" | "offline";
|
|
6
6
|
export declare type ACCOUNT_STATUS_TYPE = "offline" | "online";
|
|
7
7
|
export declare type ACTION_TYPE = "chat" | "account_status" | "connection_update" | "department_update" | "visitor_update" | "agent_update" | "error" | "reset";
|
|
@@ -10,7 +10,7 @@ export interface ActionDetail {
|
|
|
10
10
|
}
|
|
11
11
|
export interface ChatActionDetail<T> extends ActionDetail {
|
|
12
12
|
readonly type: T;
|
|
13
|
-
readonly user:
|
|
13
|
+
readonly user: ChatUserInfo;
|
|
14
14
|
}
|
|
15
15
|
export interface ChatAction extends Action<"chat"> {
|
|
16
16
|
detail: ChatDetail;
|
|
@@ -91,7 +91,7 @@ export interface SyntheticAction extends Action<"synthetic"> {
|
|
|
91
91
|
export interface SyntheticMsgDetail extends ActionDetail {
|
|
92
92
|
readonly type: "write_msg";
|
|
93
93
|
readonly msg: ChatServerMessage;
|
|
94
|
-
readonly user:
|
|
94
|
+
readonly user: ChatUserInfo;
|
|
95
95
|
}
|
|
96
96
|
export interface SyntheticOptionDetail extends ChatActionDetail<"visitor.send.option"> {
|
|
97
97
|
msg: ChatServerMessage;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ChatServerActionLink } from "../xapp/ChatServerMessage";
|
|
2
|
-
import {
|
|
2
|
+
import { ChatUserInfo } from "../xapp/UserInfo";
|
|
3
3
|
import { ACCOUNT_STATUS_TYPE, ChatDetail, CONNECTION_STATUS_TYPE, DepartmentUpdateDetail } from "./ChatAction";
|
|
4
4
|
interface ChatDepartments {
|
|
5
5
|
[id: string]: DepartmentUpdateDetail;
|
|
@@ -9,14 +9,14 @@ export interface ChatAgents {
|
|
|
9
9
|
}
|
|
10
10
|
export interface ChatAgentInfo {
|
|
11
11
|
readonly typing: boolean;
|
|
12
|
-
readonly user:
|
|
12
|
+
readonly user: ChatUserInfo;
|
|
13
13
|
readonly joined: boolean;
|
|
14
14
|
}
|
|
15
15
|
export interface ChatState {
|
|
16
16
|
readonly connection: ConnectionState;
|
|
17
17
|
accountStatus: ACCOUNT_STATUS_TYPE;
|
|
18
18
|
departments: ChatDepartments;
|
|
19
|
-
visitor:
|
|
19
|
+
visitor: ChatUserInfo;
|
|
20
20
|
readonly agents: ChatAgents;
|
|
21
21
|
chats: ChatDetail[];
|
|
22
22
|
lastTimestamp: number;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { ChatServerMessage } from "../../xapp/ChatServerMessage";
|
|
2
|
-
import {
|
|
2
|
+
import { ChatUserInfo } from "../../xapp/UserInfo";
|
|
3
3
|
import { ActionType } from "../ChatAction";
|
|
4
|
-
export declare function writeMessage(msg: ChatServerMessage, user:
|
|
4
|
+
export declare function writeMessage(msg: ChatServerMessage, user: ChatUserInfo): ActionType;
|
package/dist/utils/index.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
export declare const EMAIL_REGEX = "^\\w+([\\.-]?\\w+)*@\\w+([\\.-]?\\w+)*(\\.\\w{2,3})+$";
|
|
2
|
-
|
|
3
|
-
export declare function
|
|
4
|
-
export declare
|
|
2
|
+
declare type LogParam = unknown;
|
|
3
|
+
export declare function log(...args: readonly LogParam[]): void;
|
|
4
|
+
export declare function err(...args: readonly LogParam[]): void;
|
|
5
|
+
export declare const logOnce: (key: string, ...args: readonly LogParam[]) => void;
|
|
5
6
|
export { default as insertSorted } from "./insertSorted";
|
|
6
7
|
export * from "./nick-utils";
|
|
7
8
|
export * from "./PersistentStorage";
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { UserInfo } from "@xapp/stentor-chat-widget";
|
|
1
2
|
import { ActionType } from "../store/ChatAction";
|
|
2
3
|
import { ChatMessageRequest, ChatServerMessage } from "./ChatServerMessage";
|
|
3
4
|
export interface ChatServer {
|
|
@@ -13,6 +14,10 @@ export interface ChatServer {
|
|
|
13
14
|
flush(): void;
|
|
14
15
|
dispose(): void;
|
|
15
16
|
}
|
|
17
|
+
export interface ChatServerOptions {
|
|
18
|
+
readonly token?: string;
|
|
19
|
+
readonly bot?: UserInfo;
|
|
20
|
+
}
|
|
16
21
|
export interface OfflineMessage {
|
|
17
22
|
readonly name: string;
|
|
18
23
|
readonly email: string;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* This mirrors the declaration in Chat-Server
|
|
3
3
|
*/
|
|
4
4
|
import { Display } from "stentor-models";
|
|
5
|
-
import {
|
|
5
|
+
import { ChatUserInfo } from "./UserInfo";
|
|
6
6
|
/**
|
|
7
7
|
* It's the same request in both (visitor <-> agent) direction!
|
|
8
8
|
*/
|
|
@@ -10,7 +10,7 @@ export interface ChatMessageRequest {
|
|
|
10
10
|
type: "rating" | "ratingRequest" | "comment" | "msg" | "custom" | "startTyping" | "stopTyping" | "userJoined" | "userLeft" | "handOff" | "handBack" | "permissionRequest" | "permissionGrant";
|
|
11
11
|
timestamp: number;
|
|
12
12
|
msg?: ChatServerMessage;
|
|
13
|
-
readonly user:
|
|
13
|
+
readonly user: ChatUserInfo;
|
|
14
14
|
agent?: boolean;
|
|
15
15
|
endSession?: boolean;
|
|
16
16
|
handoffMessage?: string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ActionType } from "../store/ChatAction";
|
|
2
|
-
import { ChatServer, OfflineMessage, VisitorInfoMessage } from "./ChatServer";
|
|
2
|
+
import { ChatServer, ChatServerOptions, OfflineMessage, VisitorInfoMessage } from "./ChatServer";
|
|
3
3
|
import { ChatMessageRequest, ChatServerMessage } from "./ChatServerMessage";
|
|
4
4
|
export interface StentorDirectChatConfig {
|
|
5
5
|
readonly url: string;
|
|
@@ -11,14 +11,19 @@ export declare class StentorDirectChat implements ChatServer {
|
|
|
11
11
|
private dispatch;
|
|
12
12
|
private visitorInfo;
|
|
13
13
|
private isNewSession;
|
|
14
|
-
private readonly avatarPath;
|
|
15
|
-
getAvatarPath(): string;
|
|
16
14
|
private readonly config;
|
|
17
|
-
|
|
15
|
+
private readonly options;
|
|
16
|
+
constructor(config: StentorDirectChatConfig, options?: ChatServerOptions);
|
|
18
17
|
init(dispatch: (action: ActionType) => void): void;
|
|
19
|
-
private
|
|
18
|
+
private setConnectionStatus;
|
|
19
|
+
private setAccountStatus;
|
|
20
|
+
private sendNewMessage;
|
|
21
|
+
private userJoined;
|
|
22
|
+
private typing;
|
|
23
|
+
private stopTyping;
|
|
20
24
|
sendOfflineMsg(_: OfflineMessage, cb: (error?: Error) => void): void;
|
|
21
25
|
sendChatMsg(message: ChatServerMessage, cb: (err?: Error) => void): Promise<void>;
|
|
26
|
+
private getBot;
|
|
22
27
|
sendChatMsgRequest(serviceRequest: ChatMessageRequest, cb: (err?: Error) => void): Promise<void>;
|
|
23
28
|
sendTyping(): void;
|
|
24
29
|
setVisitorInfo(visitorInfo: VisitorInfoMessage, cb: (error?: Error) => void): void;
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { ActionType } from "../store/ChatAction";
|
|
2
|
-
import { ChatServer, OfflineMessage } from "./ChatServer";
|
|
2
|
+
import { ChatServer, ChatServerOptions, OfflineMessage } from "./ChatServer";
|
|
3
3
|
import { ChatMessageRequest, ChatServerMessage } from "./ChatServerMessage";
|
|
4
|
-
import {
|
|
4
|
+
import { ChatUserInfo } from "./UserInfo";
|
|
5
5
|
export interface StentorServerChatConfig {
|
|
6
6
|
readonly url: string;
|
|
7
|
-
readonly token: string;
|
|
8
7
|
}
|
|
9
8
|
export declare class StentorServerChat implements ChatServer {
|
|
10
9
|
private socket;
|
|
@@ -12,13 +11,13 @@ export declare class StentorServerChat implements ChatServer {
|
|
|
12
11
|
private visitorInfo;
|
|
13
12
|
private token;
|
|
14
13
|
private readonly config;
|
|
15
|
-
constructor(config: StentorServerChatConfig);
|
|
14
|
+
constructor(config: StentorServerChatConfig, options?: ChatServerOptions);
|
|
16
15
|
init(dispatch: (action: ActionType) => void): void;
|
|
17
16
|
sendOfflineMsg(_: OfflineMessage, cb: (error?: Error) => void): void;
|
|
18
17
|
sendChatMsg(message: ChatServerMessage, cb: (err?: Error) => void): void;
|
|
19
18
|
sendChatMsgRequest(message: ChatMessageRequest, cb: (err?: Error) => void): void;
|
|
20
19
|
sendTyping(isTyping: boolean): void;
|
|
21
|
-
setVisitorInfo(visitorInfo:
|
|
20
|
+
setVisitorInfo(visitorInfo: ChatUserInfo, cb: (error?: Error) => void): void;
|
|
22
21
|
sendChatRating(): void;
|
|
23
22
|
sendFile(_: File, cb: (err?: Error) => void): void;
|
|
24
23
|
markAsRead(): void;
|
package/dist/xapp/UserInfo.d.ts
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
readonly nick: string;
|
|
1
|
+
import { UserInfo } from "@xapp/stentor-chat-widget";
|
|
2
|
+
export interface ChatUserInfo extends UserInfo {
|
|
4
3
|
readonly display_name?: string;
|
|
5
|
-
readonly displayName?: string;
|
|
6
4
|
token?: string;
|
|
7
5
|
typing?: boolean;
|
|
8
6
|
}
|
package/dist/xapp/XappChat.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { ServerConfig } from "@xapp/stentor-chat-widget";
|
|
3
|
-
import { ChatServer } from "./ChatServer";
|
|
4
|
-
export declare function createChatServer(config: ServerConfig,
|
|
3
|
+
import { ChatServer, ChatServerOptions } from "./ChatServer";
|
|
4
|
+
export declare function createChatServer(config: ServerConfig, options?: ChatServerOptions): ChatServer;
|
|
5
5
|
export declare const ChatServerContext: import("react").Context<ChatServer>;
|
|
6
|
-
export declare function useChatServer(config: ServerConfig): ChatServer;
|
|
6
|
+
export declare function useChatServer(config: ServerConfig, options?: ChatServerOptions): ChatServer;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xapp/chat-widget",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.34.0",
|
|
4
4
|
"description": "XAPP Chat Widget",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"clean": "rm -rf ./lib/* && rm -rf ./dist/*",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"Chat",
|
|
32
32
|
"Widget"
|
|
33
33
|
],
|
|
34
|
-
"author": "
|
|
34
|
+
"author": "XAPP AI",
|
|
35
35
|
"license": "Apache-2.0",
|
|
36
36
|
"bugs": {
|
|
37
37
|
"url": "https://github.com/XappMedia/chat-widget/issues"
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"devDependencies": {
|
|
41
41
|
"@babel/core": "7.16.5",
|
|
42
42
|
"@rollup/plugin-commonjs": "21.0.1",
|
|
43
|
-
"@rollup/plugin-node-resolve": "13.
|
|
43
|
+
"@rollup/plugin-node-resolve": "13.1.1",
|
|
44
44
|
"@storybook/addon-actions": "6.4.9",
|
|
45
45
|
"@storybook/addon-essentials": "6.4.9",
|
|
46
46
|
"@storybook/addon-links": "6.4.9",
|
|
@@ -69,13 +69,13 @@
|
|
|
69
69
|
"eslint-plugin-jsx-a11y": "6.5.1",
|
|
70
70
|
"eslint-plugin-react": "7.27.1",
|
|
71
71
|
"eslint-plugin-react-hooks": "4.3.0",
|
|
72
|
-
"jest": "27.4.
|
|
72
|
+
"jest": "27.4.5",
|
|
73
73
|
"prettier": "2.4.1",
|
|
74
|
-
"react": "16.
|
|
75
|
-
"react-dom": "16.
|
|
76
|
-
"react-redux": "7.
|
|
77
|
-
"redux": "4.
|
|
78
|
-
"redux-thunk": "2.
|
|
74
|
+
"react": "16.14.0",
|
|
75
|
+
"react-dom": "16.14.0",
|
|
76
|
+
"react-redux": "7.2.6",
|
|
77
|
+
"redux": "4.1.2",
|
|
78
|
+
"redux-thunk": "2.4.1",
|
|
79
79
|
"rollup": "2.61.1",
|
|
80
80
|
"rollup-plugin-inject-process-env": "1.3.1",
|
|
81
81
|
"rollup-plugin-peer-deps-external": "2.2.4",
|
|
@@ -85,7 +85,7 @@
|
|
|
85
85
|
"sass": "1.45.0",
|
|
86
86
|
"sass-loader": "10.2.0",
|
|
87
87
|
"ts-jest": "27.1.1",
|
|
88
|
-
"typescript": "4.5.
|
|
88
|
+
"typescript": "4.5.4"
|
|
89
89
|
},
|
|
90
90
|
"files": [
|
|
91
91
|
"dist"
|
|
@@ -100,13 +100,13 @@
|
|
|
100
100
|
},
|
|
101
101
|
"dependencies": {
|
|
102
102
|
"@rollup/plugin-replace": "^3.0.0",
|
|
103
|
-
"@xapp/chat-widget-core": "1.
|
|
104
|
-
"@xapp/stentor-chat-widget": "1.
|
|
103
|
+
"@xapp/chat-widget-core": "1.34.0",
|
|
104
|
+
"@xapp/stentor-chat-widget": "1.34.0",
|
|
105
105
|
"react-transition-group": "4.4.2",
|
|
106
106
|
"socket.io-client": "4.4.0",
|
|
107
107
|
"stentor-models": "1.X",
|
|
108
108
|
"store": "2.0.12",
|
|
109
109
|
"tslib": "2.3.1"
|
|
110
110
|
},
|
|
111
|
-
"gitHead": "
|
|
111
|
+
"gitHead": "05cfb809dd06504c42b4f3ce8cb58ab3d7ee1572"
|
|
112
112
|
}
|