@xapp/chat-widget 1.36.8 → 1.37.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.
@@ -37,7 +37,14 @@ export interface ChatState {
37
37
  * Users access token for making authenticated API calls.
38
38
  */
39
39
  accessToken?: string;
40
+ /**
41
+ * Current active contexts
42
+ */
40
43
  activeContexts?: readonly string[];
44
+ /**
45
+ * Attributes to be sent on every request.
46
+ */
47
+ attributes?: Record<string, unknown>;
41
48
  }
42
49
  export interface ConnectionState {
43
50
  readonly token: string | null;
@@ -9,3 +9,4 @@ export { default as sendTyping } from "./sendTyping";
9
9
  export { default as sendVisitorInfo } from "./sendVisitorInfo";
10
10
  export { default as setAccountStatus } from "./setAccountStatus";
11
11
  export { default as setConnectionStatus } from "./setConnectionStatus";
12
+ export { default as reset } from "./resetAction";
@@ -1,2 +1,2 @@
1
1
  import { ResetAction } from "../ChatAction";
2
- export declare function reset(): ResetAction;
2
+ export default function reset(): ResetAction;
@@ -7,6 +7,16 @@ export interface ChatServer {
7
7
  sendChatMsg(message: ChatServerMessage, cb: (err?: Error) => void): void;
8
8
  sendChatMsgRequest(message: ChatMessageRequest, cb: (err?: Error) => void): void;
9
9
  sendTyping(isTyping: boolean): void;
10
+ /**
11
+ * Sets who the visitor is (userId, accessToken, attributes)
12
+ *
13
+ * This data is then used on the requests to the server.
14
+ *
15
+ * Developer Note: This same information can be found on the redux state, it is only pulled from there once in the beginning.
16
+ *
17
+ * @param visitorInfo
18
+ * @param cb
19
+ */
10
20
  setVisitorInfo(visitorInfo: VisitorInfoMessage, cb: (error?: Error) => void): void;
11
21
  sendChatRating(rating?: "bad" | "good"): void;
12
22
  sendFile(file: File, cb: (err?: Error) => void): void;
@@ -23,8 +33,17 @@ export interface OfflineMessage {
23
33
  readonly email: string;
24
34
  readonly message: string;
25
35
  }
36
+ /**
37
+ * The visitor is on person on the browser, talking to either the bot or the live agent.
38
+ */
26
39
  export interface VisitorInfoMessage {
40
+ /**
41
+ * Visitors name
42
+ */
27
43
  readonly name?: string;
44
+ /**
45
+ * Visitor's display name
46
+ */
28
47
  readonly displayName?: string;
29
48
  /**
30
49
  * The email of the visitor
@@ -34,8 +53,18 @@ export interface VisitorInfoMessage {
34
53
  * Visitors access token
35
54
  */
36
55
  readonly accessToken?: string;
56
+ /**
57
+ * User ID of the visitor
58
+ */
59
+ readonly userId?: string;
37
60
  /**
38
61
  * Visitor's ID, can also be userId
62
+ *
63
+ * @deprecated - Use userId
39
64
  */
40
65
  readonly visitorId?: string;
66
+ /**
67
+ * Optional request attributes.
68
+ */
69
+ readonly attributes?: Record<string, any>;
41
70
  }
@@ -24,6 +24,10 @@ export interface ChatMessageRequest {
24
24
  endSession?: boolean;
25
25
  handoffMessage?: string;
26
26
  handoffTarget?: string;
27
+ /**
28
+ * Optional, open ended, attributes to append to each request.
29
+ */
30
+ attributes?: Record<string, unknown>;
27
31
  }
28
32
  export declare type PermissionRequestType = "EMAIL" | "PHONE_NUMBER" | "LOCATION_PRECISE";
29
33
  export interface PermissionRequest {
@@ -47,6 +51,10 @@ export interface ChatServerMessage {
47
51
  location?: ChatServerLocation;
48
52
  displays?: readonly Display[];
49
53
  context?: readonly string[];
54
+ /**
55
+ * Optional, open ended, attributes to append to each request.
56
+ */
57
+ attributes?: Record<string, unknown>;
50
58
  }
51
59
  export interface ChatServerLocation {
52
60
  readonly latitude: number;
@@ -9,6 +9,7 @@ export declare class StentorDirectChat implements ChatServer {
9
9
  private _userId;
10
10
  private _sessionId;
11
11
  private _accessToken;
12
+ private _attributes;
12
13
  private dispatch;
13
14
  private visitorInfo;
14
15
  private isNewSession;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xapp/chat-widget",
3
- "version": "1.36.8",
3
+ "version": "1.37.2",
4
4
  "description": "XAPP Chat Widget",
5
5
  "scripts": {
6
6
  "clean": "rm -rf ./lib/* && rm -rf ./dist/*",
@@ -39,7 +39,7 @@
39
39
  "homepage": "https://github.com/XappMedia/chat-widget#readme",
40
40
  "devDependencies": {
41
41
  "@babel/core": "7.16.5",
42
- "@rollup/plugin-commonjs": "21.0.1",
42
+ "@rollup/plugin-commonjs": "21.0.2",
43
43
  "@rollup/plugin-node-resolve": "13.1.3",
44
44
  "@storybook/addon-actions": "6.4.9",
45
45
  "@storybook/addon-essentials": "6.4.9",
@@ -49,8 +49,8 @@
49
49
  "@types/enzyme": "3.10.11",
50
50
  "@types/enzyme-adapter-react-16": "1.0.6",
51
51
  "@types/jest": "27.0.3",
52
- "@types/react": "17.0.39",
53
- "@types/react-redux": "7.1.20",
52
+ "@types/react": "17.0.41",
53
+ "@types/react-redux": "7.1.23",
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",
@@ -84,7 +84,7 @@
84
84
  "rollup-plugin-typescript2": "0.31.2",
85
85
  "sass": "1.45.0",
86
86
  "sass-loader": "10.2.1",
87
- "stentor-models": "1.52.27",
87
+ "stentor-models": "1.54.3",
88
88
  "ts-jest": "27.1.1",
89
89
  "typescript": "4.5.4"
90
90
  },
@@ -101,12 +101,12 @@
101
101
  },
102
102
  "dependencies": {
103
103
  "@rollup/plugin-replace": "^3.0.0",
104
- "@xapp/chat-widget-core": "1.36.2",
105
- "@xapp/stentor-chat-widget": "1.36.8",
104
+ "@xapp/chat-widget-core": "1.37.0",
105
+ "@xapp/stentor-chat-widget": "1.37.2",
106
106
  "react-transition-group": "4.4.2",
107
107
  "socket.io-client": "4.4.0",
108
108
  "store": "2.0.12",
109
109
  "tslib": "2.3.1"
110
110
  },
111
- "gitHead": "70572aef716e9261f51e05f80a2efa50d155293c"
111
+ "gitHead": "4b1a7f9e86e0490e7a0bd32de020d85d8613968c"
112
112
  }
@@ -1,9 +0,0 @@
1
- import { FC, MouseEvent, VFC } from "react";
2
- import "./IconButton.scss";
3
- export interface IconButtonProps {
4
- readonly type?: "button" | "submit";
5
- readonly className?: string;
6
- readonly icon: VFC;
7
- onClick?(ev: MouseEvent<HTMLButtonElement>): void;
8
- }
9
- export declare const IconButton: FC<IconButtonProps>;
@@ -1 +0,0 @@
1
- export { IconButton } from "./IconButton";
@@ -1,5 +0,0 @@
1
- import { ChatDetail } from "../../store/ChatAction";
2
- import { ChatServerMessage } from "../../xapp/ChatServerMessage";
3
- export declare const carouselMessage: ChatServerMessage;
4
- export declare const listMessage: ChatServerMessage;
5
- export declare const messages: readonly ChatDetail[];
@@ -1,16 +0,0 @@
1
- import { FC } from "react";
2
- import { SuggestionItemData, SuggestionType } from "./data";
3
- import "./SuggestionsGroupItem.scss";
4
- export interface SuggestionsGroupItemProps {
5
- readonly group: SuggestionsGroupItemData;
6
- readonly currentIndex: number;
7
- onItemClick(data: SuggestionItemData): void;
8
- onItemUse(data: SuggestionItemData): void;
9
- onItemHover?(data: SuggestionItemData): void;
10
- }
11
- export interface SuggestionsGroupItemData {
12
- readonly type: SuggestionType;
13
- readonly items: SuggestionItemData[];
14
- readonly startIndex: number;
15
- }
16
- export declare const SuggestionsGroupItem: FC<SuggestionsGroupItemProps>;
@@ -1,11 +0,0 @@
1
- import { FC } from "react";
2
- import { SuggestionItemData } from "./data";
3
- import "./SuggestionsItem.scss";
4
- export interface SuggestionsItemProps {
5
- readonly data: SuggestionItemData;
6
- readonly current: boolean;
7
- onClick(data: SuggestionItemData): void;
8
- onUse(data: SuggestionItemData): void;
9
- onHover(data: SuggestionItemData): void;
10
- }
11
- export declare const SuggestionsItem: FC<SuggestionsItemProps>;
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export declare function resetChatWidget(): void;
@@ -1 +0,0 @@
1
- export {};
@@ -1,8 +0,0 @@
1
- /**
2
- * Append the provided query params to the URL
3
- *
4
- * It will overwrite existing params on the URL if there are conflicts
5
- * @param url
6
- * @param params
7
- */
8
- export declare function addQueryParametersToURL(url: string, params: URLSearchParams): URL;
@@ -1,20 +0,0 @@
1
- export interface JsonFetchOptions {
2
- readonly pause?: boolean;
3
- }
4
- export declare type JsonFetchResponse<T> = JsonFetchSuccessResponse<T> | JsonFetchErrorResponse | JsonFetchFetchingResponse;
5
- export interface JsonFetchSuccessResponse<T> {
6
- readonly fetching: false;
7
- readonly success: true;
8
- readonly data: T;
9
- }
10
- export interface JsonFetchErrorResponse {
11
- readonly fetching: false;
12
- readonly success: false;
13
- readonly error: {
14
- readonly httpStatus: number;
15
- };
16
- }
17
- export interface JsonFetchFetchingResponse {
18
- readonly fetching: true;
19
- }
20
- export declare function useJsonFetch<T>(url: string, options?: JsonFetchOptions): JsonFetchResponse<T>;
@@ -1,7 +0,0 @@
1
- /**
2
- * Quicker configurable uuid
3
- *
4
- * @export
5
- * @returns {string}
6
- */
7
- export declare function uuid(): string;
@@ -1 +0,0 @@
1
- export {};