@xapp/stentor-chat-widget 1.49.5 → 1.51.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/lib/WidgetEnv.d.ts +80 -2
- package/lib/guards.d.ts +2 -1
- package/lib/guards.js +5 -1
- package/lib/guards.js.map +1 -1
- package/package.json +2 -2
package/lib/WidgetEnv.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/*! Copyright (c) 2021, XAPPmedia */
|
|
2
|
+
import { Response } from "stentor-models";
|
|
2
3
|
import { WidgetTheme } from "./WidgetTheme";
|
|
3
4
|
export interface CtaConfig {
|
|
4
5
|
readonly message: string;
|
|
@@ -87,21 +88,46 @@ export interface WidgetEnv extends WidgetEnvDeprecated {
|
|
|
87
88
|
*/
|
|
88
89
|
readonly theme?: WidgetTheme;
|
|
89
90
|
/**
|
|
90
|
-
*
|
|
91
|
+
* Optional configurable message that appears
|
|
91
92
|
*/
|
|
92
93
|
readonly cta?: CtaConfig;
|
|
94
|
+
/**
|
|
95
|
+
* Optional, configure the chat button tab index
|
|
96
|
+
*/
|
|
93
97
|
readonly chatButton?: WidgetChatButtonConfig;
|
|
98
|
+
/**
|
|
99
|
+
* Optional, custom header configuration including messages for the widget.
|
|
100
|
+
*/
|
|
94
101
|
readonly header?: WidgetHeaderConfig;
|
|
102
|
+
/**
|
|
103
|
+
* Optional, configure aspects of the footer.
|
|
104
|
+
*/
|
|
95
105
|
readonly footer?: WidgetFooterConfig;
|
|
106
|
+
/**
|
|
107
|
+
* Optional menu configuration, add items and configure location of toggle button.
|
|
108
|
+
*/
|
|
96
109
|
readonly menu?: WidgetMenuConfig;
|
|
110
|
+
/**
|
|
111
|
+
* Configure input field
|
|
112
|
+
*/
|
|
97
113
|
readonly input?: WidgetInputConfig;
|
|
98
114
|
/**
|
|
99
115
|
* When set, the widget will automatically open when the screen width is wider than what is provided. This is useful if you want to open
|
|
100
116
|
* on desktop widths automatically but not on mobile.
|
|
101
117
|
*/
|
|
102
118
|
readonly autoOpenOnWidth?: string;
|
|
119
|
+
/**
|
|
120
|
+
* Configure how the URLs within suggestion chips, markdown and list items are opened. You can choose same window, new window or new tab.
|
|
121
|
+
*/
|
|
103
122
|
readonly urls?: WidgetUrlsConfig;
|
|
123
|
+
/**
|
|
124
|
+
* Configurable error messages.
|
|
125
|
+
*/
|
|
104
126
|
readonly configurableMessages?: WidgetConfigurableMessagesConfig;
|
|
127
|
+
/**
|
|
128
|
+
* Optional set of hooks to register with the widget to receive events.
|
|
129
|
+
*/
|
|
130
|
+
readonly hooks?: WidgetHooks;
|
|
105
131
|
}
|
|
106
132
|
export interface WidgetConfigurableMessagesConfig {
|
|
107
133
|
readonly items?: WidgetConfigurableMessageConfig[];
|
|
@@ -157,12 +183,37 @@ export interface WidgetFooterConfig {
|
|
|
157
183
|
readonly sendButton?: WidgetSendButtonConfig;
|
|
158
184
|
}
|
|
159
185
|
export interface WidgetBrandingConfig {
|
|
186
|
+
/**
|
|
187
|
+
* Enable display of the branding text
|
|
188
|
+
*/
|
|
160
189
|
readonly enabled?: boolean;
|
|
190
|
+
/**
|
|
191
|
+
* Configurable text for the branding
|
|
192
|
+
*/
|
|
161
193
|
readonly text?: string;
|
|
162
194
|
}
|
|
163
|
-
export declare type WidgetMenuItems = WidgetMenuItemConfig | WidgetMenuItemStaticImage | WidgetMenuItemStaticText;
|
|
195
|
+
export declare type WidgetMenuItems = WidgetMenuItemConfig | WidgetMenuItemStaticImage | WidgetMenuItemStaticText | WidgetMenuItemOpenURL;
|
|
164
196
|
export interface WidgetMenuConfig {
|
|
197
|
+
/**
|
|
198
|
+
* Set the location for the menu button.
|
|
199
|
+
*
|
|
200
|
+
* Defaults to "FOOTER" with a two bar icon.
|
|
201
|
+
*
|
|
202
|
+
* If set to "HEADER_LEFT" then the menu button will display in the header left position with a three bar icon.
|
|
203
|
+
*/
|
|
204
|
+
readonly menuButtonLocation?: "HEADER_LEFT" | "FOOTER";
|
|
205
|
+
/**
|
|
206
|
+
* Menu items to be displayed.
|
|
207
|
+
*/
|
|
165
208
|
readonly items: readonly WidgetMenuItems[];
|
|
209
|
+
/**
|
|
210
|
+
* Tab index for menu items.
|
|
211
|
+
*/
|
|
212
|
+
readonly itemsTabIndex?: string;
|
|
213
|
+
/**
|
|
214
|
+
* Menu button configuration
|
|
215
|
+
*/
|
|
216
|
+
readonly button?: WidgetMenuButtonConfig;
|
|
166
217
|
}
|
|
167
218
|
export interface WidgetInputConfig {
|
|
168
219
|
readonly placeholder?: string;
|
|
@@ -179,6 +230,20 @@ export interface WidgetMenuItemStaticText {
|
|
|
179
230
|
readonly title: string;
|
|
180
231
|
readonly body: string;
|
|
181
232
|
}
|
|
233
|
+
export interface WidgetMenuItemOpenURL {
|
|
234
|
+
/**
|
|
235
|
+
* URL to be opened
|
|
236
|
+
*/
|
|
237
|
+
readonly url: string;
|
|
238
|
+
/**
|
|
239
|
+
* Display label for the URL
|
|
240
|
+
*/
|
|
241
|
+
readonly text: string;
|
|
242
|
+
/**
|
|
243
|
+
* How the URL opens, defaults to defined behavior on URL opening config.
|
|
244
|
+
*/
|
|
245
|
+
readonly behavior?: WidgetUrlBehavior;
|
|
246
|
+
}
|
|
182
247
|
export interface WidgetHeaderSubtitleConfig {
|
|
183
248
|
readonly enabled?: boolean;
|
|
184
249
|
readonly text?: string;
|
|
@@ -196,3 +261,16 @@ export interface WidgetChatButtonConfig {
|
|
|
196
261
|
export interface WidgetClearButtonConfig {
|
|
197
262
|
readonly tabIndex?: string;
|
|
198
263
|
}
|
|
264
|
+
export interface WidgetMenuButtonConfig {
|
|
265
|
+
readonly tabIndex?: string;
|
|
266
|
+
}
|
|
267
|
+
export interface WidgetHooks {
|
|
268
|
+
/**
|
|
269
|
+
* Optional callback when a response is received.
|
|
270
|
+
*
|
|
271
|
+
* This can be used to parse any part of the message, including additional instructions included in the response.data field.
|
|
272
|
+
*
|
|
273
|
+
* @param response
|
|
274
|
+
*/
|
|
275
|
+
onResponse?(response: Response): void;
|
|
276
|
+
}
|
package/lib/guards.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { WidgetMenuItems, WidgetMenuItemConfig, WidgetMenuItemStaticImage, WidgetMenuItemStaticText } from "./WidgetEnv";
|
|
1
|
+
import { WidgetMenuItems, WidgetMenuItemConfig, WidgetMenuItemStaticImage, WidgetMenuItemStaticText, WidgetMenuItemOpenURL } from "./WidgetEnv";
|
|
2
2
|
export declare function isStaticImageMenuItem(item: WidgetMenuItems): item is WidgetMenuItemStaticImage;
|
|
3
3
|
export declare function isStaticTextMenuItem(item: WidgetMenuItems): item is WidgetMenuItemStaticText;
|
|
4
4
|
export declare function isStandardMenuItem(item: WidgetMenuItems): item is WidgetMenuItemConfig;
|
|
5
|
+
export declare function isOpenURLMenuItem(item: WidgetMenuItems): item is WidgetMenuItemOpenURL;
|
package/lib/guards.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isStandardMenuItem = exports.isStaticTextMenuItem = exports.isStaticImageMenuItem = void 0;
|
|
3
|
+
exports.isOpenURLMenuItem = exports.isStandardMenuItem = exports.isStaticTextMenuItem = exports.isStaticImageMenuItem = void 0;
|
|
4
4
|
function isStaticImageMenuItem(item) {
|
|
5
5
|
return !!item && !!item.imageUrl;
|
|
6
6
|
}
|
|
@@ -13,4 +13,8 @@ function isStandardMenuItem(item) {
|
|
|
13
13
|
return !!item && !!item.label;
|
|
14
14
|
}
|
|
15
15
|
exports.isStandardMenuItem = isStandardMenuItem;
|
|
16
|
+
function isOpenURLMenuItem(item) {
|
|
17
|
+
return !!item && !!item.url;
|
|
18
|
+
}
|
|
19
|
+
exports.isOpenURLMenuItem = isOpenURLMenuItem;
|
|
16
20
|
//# sourceMappingURL=guards.js.map
|
package/lib/guards.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"guards.js","sourceRoot":"","sources":["../src/guards.ts"],"names":[],"mappings":";;;AAEA,SAAgB,qBAAqB,CAAC,IAAqB;IACvD,OAAO,CAAC,CAAC,IAAI,IAAI,CAAC,CAAE,IAAkC,CAAC,QAAQ,CAAC;AACpE,CAAC;AAFD,sDAEC;AAED,SAAgB,oBAAoB,CAAC,IAAqB;IACtD,OAAO,CAAC,CAAC,IAAI,IAAI,CAAC,CAAE,IAAiC,CAAC,IAAI,CAAC;AAC/D,CAAC;AAFD,oDAEC;AAED,SAAgB,kBAAkB,CAAC,IAAqB;IACpD,OAAO,CAAC,CAAC,IAAI,IAAI,CAAC,CAAE,IAA6B,CAAC,KAAK,CAAC;AAC5D,CAAC;AAFD,gDAEC"}
|
|
1
|
+
{"version":3,"file":"guards.js","sourceRoot":"","sources":["../src/guards.ts"],"names":[],"mappings":";;;AAEA,SAAgB,qBAAqB,CAAC,IAAqB;IACvD,OAAO,CAAC,CAAC,IAAI,IAAI,CAAC,CAAE,IAAkC,CAAC,QAAQ,CAAC;AACpE,CAAC;AAFD,sDAEC;AAED,SAAgB,oBAAoB,CAAC,IAAqB;IACtD,OAAO,CAAC,CAAC,IAAI,IAAI,CAAC,CAAE,IAAiC,CAAC,IAAI,CAAC;AAC/D,CAAC;AAFD,oDAEC;AAED,SAAgB,kBAAkB,CAAC,IAAqB;IACpD,OAAO,CAAC,CAAC,IAAI,IAAI,CAAC,CAAE,IAA6B,CAAC,KAAK,CAAC;AAC5D,CAAC;AAFD,gDAEC;AAED,SAAgB,iBAAiB,CAAC,IAAqB;IACnD,OAAO,CAAC,CAAC,IAAI,IAAI,CAAC,CAAE,IAA8B,CAAC,GAAG,CAAC;AAC3D,CAAC;AAFD,8CAEC"}
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
7
|
-
"version": "1.
|
|
7
|
+
"version": "1.51.0",
|
|
8
8
|
"description": "Chat Widget channel for stentor",
|
|
9
9
|
"types": "lib/index",
|
|
10
10
|
"main": "lib/index",
|
|
@@ -38,5 +38,5 @@
|
|
|
38
38
|
"build": "tsc -d true -p .",
|
|
39
39
|
"clean": "rm -rf ./lib/*"
|
|
40
40
|
},
|
|
41
|
-
"gitHead": "
|
|
41
|
+
"gitHead": "d314fdeeef894c66ae6bcf577762374934d93028"
|
|
42
42
|
}
|