@xapp/chat-widget 1.35.1 → 1.36.1

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.
@@ -25,7 +25,18 @@ export interface ChatState {
25
25
  isChatting: boolean;
26
26
  queuePosition: number;
27
27
  chips: (string | ChatServerActionLink)[];
28
+ /**
29
+ * @deprecated Use userId
30
+ */
28
31
  visitorId: string;
32
+ /**
33
+ * ID to be used for the user
34
+ */
35
+ userId?: string;
36
+ /**
37
+ * Users access token for making authenticated API calls.
38
+ */
39
+ accessToken?: string;
29
40
  activeContexts?: readonly string[];
30
41
  }
31
42
  export interface ConnectionState {
@@ -1,4 +1,4 @@
1
1
  import { Store } from "redux";
2
- import { ServerConfig } from "..";
2
+ import { WidgetEnv } from "..";
3
3
  import { ActionType } from "./ChatAction";
4
- export declare function createChatStore(config: ServerConfig, dataStorage?: Storage): Store<unknown, ActionType>;
4
+ export declare function createChatStore(config: WidgetEnv, dataStorage?: Storage): Store<unknown, ActionType>;
@@ -1,3 +1,3 @@
1
1
  import { ChatState } from "./ChatState";
2
- export declare function createDefaultState(): ChatState;
2
+ export declare function createDefaultState(state?: Partial<ChatState>): ChatState;
3
3
  export declare const DEFAULT_STATE: ChatState;
@@ -26,7 +26,16 @@ export interface OfflineMessage {
26
26
  export interface VisitorInfoMessage {
27
27
  readonly name?: string;
28
28
  readonly displayName?: string;
29
+ /**
30
+ * The email of the visitor
31
+ */
29
32
  email?: string;
30
- token?: string;
33
+ /**
34
+ * Visitors access token
35
+ */
36
+ readonly accessToken?: string;
37
+ /**
38
+ * Visitor's ID, can also be userId
39
+ */
31
40
  readonly visitorId?: string;
32
41
  }
@@ -7,11 +7,20 @@ import { ChatUserInfo } from "./UserInfo";
7
7
  * It's the same request in both (visitor <-> agent) direction!
8
8
  */
9
9
  export interface ChatMessageRequest {
10
+ /**
11
+ * Type of message
12
+ */
10
13
  type: "rating" | "ratingRequest" | "comment" | "msg" | "custom" | "startTyping" | "stopTyping" | "userJoined" | "userLeft" | "handOff" | "handBack" | "permissionRequest" | "permissionGrant";
11
14
  timestamp: number;
12
15
  msg?: ChatServerMessage;
16
+ /**
17
+ * Information related to the user sending the request
18
+ */
13
19
  readonly user: ChatUserInfo;
14
20
  agent?: boolean;
21
+ /**
22
+ * The user has requested to end the session.
23
+ */
15
24
  endSession?: boolean;
16
25
  handoffMessage?: string;
17
26
  handoffTarget?: string;
@@ -8,6 +8,7 @@ export interface StentorDirectChatConfig {
8
8
  export declare class StentorDirectChat implements ChatServer {
9
9
  private _userId;
10
10
  private _sessionId;
11
+ private _accessToken;
11
12
  private dispatch;
12
13
  private visitorInfo;
13
14
  private isNewSession;
@@ -1,6 +1,15 @@
1
1
  import { UserInfo } from "@xapp/stentor-chat-widget";
2
2
  export interface ChatUserInfo extends UserInfo {
3
+ /**
4
+ * Users name
5
+ */
3
6
  readonly display_name?: string;
7
+ /**
8
+ * The token that is received after a login
9
+ */
4
10
  token?: string;
11
+ /**
12
+ * If the user is typing or not
13
+ */
5
14
  typing?: boolean;
6
15
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xapp/chat-widget",
3
- "version": "1.35.1",
3
+ "version": "1.36.1",
4
4
  "description": "XAPP Chat Widget",
5
5
  "scripts": {
6
6
  "clean": "rm -rf ./lib/* && rm -rf ./dist/*",
@@ -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.1.1",
43
+ "@rollup/plugin-node-resolve": "13.1.3",
44
44
  "@storybook/addon-actions": "6.4.9",
45
45
  "@storybook/addon-essentials": "6.4.9",
46
46
  "@storybook/addon-links": "6.4.9",
@@ -54,14 +54,14 @@
54
54
  "@types/react-transition-group": "4.4.4",
55
55
  "@types/socket.io-client": "1.4.36",
56
56
  "@types/store": "2.0.2",
57
- "@typescript-eslint/eslint-plugin": "4.33.0",
58
- "@typescript-eslint/parser": "4.33.0",
57
+ "@typescript-eslint/eslint-plugin": "5.10.2",
58
+ "@typescript-eslint/parser": "5.10.2",
59
59
  "babel-eslint": "10.1.0",
60
60
  "babel-jest": "27.4.5",
61
61
  "babel-loader": "8.2.3",
62
62
  "enzyme": "3.11.0",
63
63
  "enzyme-adapter-react-16": "1.15.6",
64
- "eslint": "7.32.0",
64
+ "eslint": "8.8.0",
65
65
  "eslint-config-prettier": "7.2.0",
66
66
  "eslint-config-react-app": "6.0.0",
67
67
  "eslint-plugin-flowtype": "8.0.3",
@@ -100,13 +100,13 @@
100
100
  },
101
101
  "dependencies": {
102
102
  "@rollup/plugin-replace": "^3.0.0",
103
- "@xapp/chat-widget-core": "1.35.1",
104
- "@xapp/stentor-chat-widget": "1.35.0",
103
+ "@xapp/chat-widget-core": "1.36.1",
104
+ "@xapp/stentor-chat-widget": "1.36.1",
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": "7f55da11342c806a526d58b9508840629255dee2"
111
+ "gitHead": "0cda0b96516f1dde6a00a2ed4d24952facf46a60"
112
112
  }