@xapp/chat-widget 1.49.2 → 1.49.5
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/CancelButton/CancelButton.d.ts +1 -0
- package/dist/components/ChatFooter/ChatFooter.d.ts +3 -0
- package/dist/components/Input/Input.d.ts +3 -0
- package/dist/components/MinimizeButton/MinimizeButton.d.ts +1 -0
- package/dist/components/RefreshButton/RefreshButton.d.ts +1 -0
- package/dist/components/SendButton/SendButton.d.ts +1 -0
- package/dist/index.css +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.es.js +45 -41
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +45 -41
- package/dist/index.js.map +1 -1
- package/package.json +6 -6
package/dist/index.js
CHANGED
|
@@ -1696,7 +1696,7 @@ function getLeftArrowSvg() {
|
|
|
1696
1696
|
React__default$1["default"].createElement("path", { d: "M 2.5 -15 L -2.5 0 L 2.5 15", stroke: "currentColor", strokeLinecap: "square", strokeWidth: "4px", fill: "none" })));
|
|
1697
1697
|
}
|
|
1698
1698
|
var ChevronLeft = function (props) {
|
|
1699
|
-
return (React__default$1["default"].createElement("
|
|
1699
|
+
return (React__default$1["default"].createElement("button", { onClick: props.onClick, className: "chevron" }, getLeftArrowSvg()));
|
|
1700
1700
|
};
|
|
1701
1701
|
|
|
1702
1702
|
function getRightArrowSvg() {
|
|
@@ -1704,7 +1704,7 @@ function getRightArrowSvg() {
|
|
|
1704
1704
|
React__default$1["default"].createElement("path", { d: "M -2.5 -15 L 2.5 0 L -2.5 15", stroke: "currentColor", strokeLinecap: "square", strokeWidth: "4px", fill: "none" })));
|
|
1705
1705
|
}
|
|
1706
1706
|
var ChevronRight = function (props) {
|
|
1707
|
-
return (React__default$1["default"].createElement("
|
|
1707
|
+
return (React__default$1["default"].createElement("button", { onClick: props.onClick, className: "chevron" }, getRightArrowSvg()));
|
|
1708
1708
|
};
|
|
1709
1709
|
|
|
1710
1710
|
var Carousel = function (props) {
|
|
@@ -1894,11 +1894,11 @@ var CtaBubbleContainer = function (props) {
|
|
|
1894
1894
|
};
|
|
1895
1895
|
|
|
1896
1896
|
var ChatButton = function (props) {
|
|
1897
|
-
return (React__default$1["default"].createElement("button", { className: "chat-button ".concat(props.addClass), onClick: props.onClick },
|
|
1898
|
-
React__default$1["default"].createElement("div", { id: "xapp-widget-button", className: "chat-button__btn" },
|
|
1897
|
+
return (React__default$1["default"].createElement("button", { className: "xapp-chat-button ".concat(props.addClass), onClick: props.onClick },
|
|
1898
|
+
React__default$1["default"].createElement("div", { id: "xapp-widget-button", className: "xapp-chat-button__btn" },
|
|
1899
1899
|
React__default$1["default"].createElement("svg", { width: "22", height: "22", viewBox: "0 0 22 22" },
|
|
1900
1900
|
React__default$1["default"].createElement("path", { d: "M13 22l-4-6H2c-1.11-.043-2-.935-2-2V2C0 .89.89 0 2 0h18c1.11 0 2 .892 2 2v12c0 1.067-.89 1.957-2 2h-3l-4 6zm3-8h4c-.005.3-.01-12 0-12-.01.004-18 .006-18 0 .005.006 0 12 0 12h8l3 5 3-5z", fill: "#FFF", fillRule: "evenodd" }))),
|
|
1901
|
-
props.config && props.config.message && (React__default$1["default"].createElement("div", { className: "chat-button__cta" },
|
|
1901
|
+
props.config && props.config.message && (React__default$1["default"].createElement("div", { className: "xapp-chat-button__cta" },
|
|
1902
1902
|
React__default$1["default"].createElement(CtaBubbleContainer, { timeout: props.config.timeout, visible: !props.visible }, props.config.message)))));
|
|
1903
1903
|
};
|
|
1904
1904
|
|
|
@@ -2229,7 +2229,7 @@ var React__default = /*#__PURE__*/_interopDefaultLegacy$1(React);
|
|
|
2229
2229
|
var IconButton = function (props) {
|
|
2230
2230
|
var type = props.type || "button";
|
|
2231
2231
|
var Icon = props.icon;
|
|
2232
|
-
return (React__default["default"].createElement("button", { type: type, className: "xapp-search-icon-button ".concat(props.className || ""), onClick: props.onClick },
|
|
2232
|
+
return (React__default["default"].createElement("button", { type: type, tabIndex: props.tabIndex ? Number(props.tabIndex) : 0, className: "xapp-search-icon-button ".concat(props.className || ""), onClick: props.onClick },
|
|
2233
2233
|
React__default["default"].createElement("div", { className: "xapp-search-icon-button__content" },
|
|
2234
2234
|
React__default["default"].createElement(Icon, null))));
|
|
2235
2235
|
};
|
|
@@ -2433,7 +2433,7 @@ var RichText = function (props) {
|
|
|
2433
2433
|
};
|
|
2434
2434
|
|
|
2435
2435
|
var RichInput = function (props) {
|
|
2436
|
-
var id = props.id, value = props.value, type = props.type, autoFocus = props.autoFocus, spellCheck = props.spellCheck, onChange = props.onChange, onInput = props.onInput, onKeyDown = props.onKeyDown, onSearch = props.onSearch;
|
|
2436
|
+
var id = props.id, value = props.value, type = props.type, autoFocus = props.autoFocus, spellCheck = props.spellCheck, tabIndex = props.tabIndex, onChange = props.onChange, onInput = props.onInput, onKeyDown = props.onKeyDown, onSearch = props.onSearch;
|
|
2437
2437
|
var rich = value.formats.some(function (f) { return f.type === "inputText"; });
|
|
2438
2438
|
var handleChange = React.useCallback(function (ev) {
|
|
2439
2439
|
onChange({
|
|
@@ -2483,7 +2483,7 @@ var RichInput = function (props) {
|
|
|
2483
2483
|
return undefined;
|
|
2484
2484
|
}, [inputNode, onSearch]);
|
|
2485
2485
|
return (React__default["default"].createElement("div", { className: "xappw-rich-input ".concat(props.className) }, rich ?
|
|
2486
|
-
React__default["default"].createElement(RichText, { id: id, value: value, onChange: handleRichChange, onInput: handleRichInput, onKeyDown: handleKeyDown, className: "xappw-rich-input__input ".concat(props.className, "__input") }) : React__default["default"].createElement("input", { id: id, ref: inputRef, type: type, value: value.text, autoFocus: autoFocus, placeholder: props.placeholder, spellCheck: spellCheck, className: "xappw-rich-input__input ".concat(props.className, "__input"), onFocus: props.onFocus, onChange: handleChange, onInput: handleInput, onKeyDown: handleKeyDown })));
|
|
2486
|
+
React__default["default"].createElement(RichText, { id: id, value: value, onChange: handleRichChange, onInput: handleRichInput, onKeyDown: handleKeyDown, className: "xappw-rich-input__input ".concat(props.className, "__input") }) : React__default["default"].createElement("input", { id: id, ref: inputRef, type: type, value: value.text, autoComplete: "off", autoFocus: autoFocus, placeholder: props.placeholder, spellCheck: spellCheck, tabIndex: tabIndex ? Number(tabIndex) : 0, className: "xappw-rich-input__input ".concat(props.className, "__input"), onFocus: props.onFocus, onChange: handleChange, onInput: handleInput, onKeyDown: handleKeyDown })));
|
|
2487
2487
|
};
|
|
2488
2488
|
|
|
2489
2489
|
var SuggestionsGroupHeading = function (props) {
|
|
@@ -7209,10 +7209,10 @@ var ChatMenu = function (props) {
|
|
|
7209
7209
|
}, src: item.imageUrl, alt: "Menu Item" })));
|
|
7210
7210
|
}
|
|
7211
7211
|
else if (lib.isStaticTextMenuItem(item)) {
|
|
7212
|
-
return (React__default$1["default"].createElement("div", { key: i, className: "chat-menu-item-static" },
|
|
7212
|
+
return (React__default$1["default"].createElement("div", { key: i, className: "chat-menu-item-static-text" },
|
|
7213
7213
|
React__default$1["default"].createElement("div", null,
|
|
7214
7214
|
React__default$1["default"].createElement("div", null, item.title),
|
|
7215
|
-
React__default$1["default"].createElement("div", { className: "chat-menu-item-static--body" }, item.body))));
|
|
7215
|
+
React__default$1["default"].createElement("div", { className: "chat-menu-item-static-text--body" }, item.body))));
|
|
7216
7216
|
}
|
|
7217
7217
|
return React__default$1["default"].createElement("p", null, "Unknown");
|
|
7218
7218
|
})));
|
|
@@ -8016,13 +8016,14 @@ var SendIcon = function () {
|
|
|
8016
8016
|
};
|
|
8017
8017
|
|
|
8018
8018
|
var SendButton = function (props) {
|
|
8019
|
-
return (React__default$1["default"].createElement(React__default$1["default"].Fragment, null, !props.sendButtonIcon ? (React__default$1["default"].createElement(IconButton_1, { className: "xappw-send-button ".concat(props.className || ""), onClick: props.onClick, icon: SendIcon })) : (React__default$1["default"].createElement("
|
|
8019
|
+
return (React__default$1["default"].createElement(React__default$1["default"].Fragment, null, !props.sendButtonIcon ? (React__default$1["default"].createElement(IconButton_1, { className: "xappw-send-button ".concat(props.className || ""), tabIndex: props.tabIndex, onClick: props.onClick, icon: SendIcon })) : (React__default$1["default"].createElement("button", { className: "xappw-custom-send-button", tabIndex: props.tabIndex ? Number(props.tabIndex) : 0, onClick: props.onClick },
|
|
8020
8020
|
React__default$1["default"].createElement("img", { src: props.sendButtonIcon, alt: "Send button", draggable: false })))));
|
|
8021
8021
|
};
|
|
8022
8022
|
|
|
8023
8023
|
var Input = function (props) {
|
|
8024
|
-
var
|
|
8025
|
-
var
|
|
8024
|
+
var _a, _b;
|
|
8025
|
+
var value = props.value, placeholder = props.placeholder, sendButtonIcon = props.sendButtonIcon, suggestion = props.suggestion, footerConfig = props.footerConfig, inputConfig = props.inputConfig, onChange = props.onChange, onSubmit = props.onSubmit, onSuggestionCommand = props.onSuggestionCommand;
|
|
8026
|
+
var _c = React$1.useState(false), dragover = _c[0], setDragover = _c[1];
|
|
8026
8027
|
function onDragOver(event) {
|
|
8027
8028
|
setDragover(true);
|
|
8028
8029
|
event.preventDefault();
|
|
@@ -8069,12 +8070,12 @@ var Input = function (props) {
|
|
|
8069
8070
|
}, [suggestion, onChange, onSuggestionCommand]);
|
|
8070
8071
|
return (React__default$1["default"].createElement("div", { className: "xappw-input-container ".concat(props.addClass, " ").concat(dragover ? "drag-drop-zone" : ""), onDrop: onDrop, onDragOver: onDragOver, onDragLeave: onDragLeave },
|
|
8071
8072
|
React__default$1["default"].createElement("form", { className: "xappw-input-form", onSubmit: handleOnSubmit },
|
|
8072
|
-
React__default$1["default"].createElement(RichInput_1, { key: "input", id: "chatWidgetInput", className: "xappw-input", placeholder: placeholder !== null && placeholder !== void 0 ? placeholder : "Type your question here...", onInput: onChange, onChange: onChange, onKeyDown: handleKeyDown,
|
|
8073
|
+
React__default$1["default"].createElement(RichInput_1, { key: "input", id: "chatWidgetInput", className: "xappw-input", placeholder: placeholder !== null && placeholder !== void 0 ? placeholder : "Type your question here...", tabIndex: inputConfig === null || inputConfig === void 0 ? void 0 : inputConfig.tabIndex, onInput: onChange, onChange: onChange, onKeyDown: handleKeyDown,
|
|
8073
8074
|
// onFocus={onFocus}
|
|
8074
8075
|
value: value, spellCheck: true }),
|
|
8075
8076
|
React__default$1["default"].createElement("div", { className: "xappw-input-form__buttons" },
|
|
8076
|
-
value.text && React__default$1["default"].createElement(IconButton_1, { icon: CloseIcon, className: "xappw-input-form__btn", onClick: handleClear }),
|
|
8077
|
-
React__default$1["default"].createElement(SendButton, { className: "xappw-input-form__btn", sendButtonIcon: sendButtonIcon, onClick: handleOnSubmit })))));
|
|
8077
|
+
value.text && React__default$1["default"].createElement(IconButton_1, { icon: CloseIcon, tabIndex: (_a = footerConfig === null || footerConfig === void 0 ? void 0 : footerConfig.clearButton) === null || _a === void 0 ? void 0 : _a.tabIndex, className: "xappw-input-form__btn", onClick: handleClear }),
|
|
8078
|
+
React__default$1["default"].createElement(SendButton, { className: "xappw-input-form__btn", sendButtonIcon: sendButtonIcon, tabIndex: (_b = footerConfig === null || footerConfig === void 0 ? void 0 : footerConfig.sendButton) === null || _b === void 0 ? void 0 : _b.tabIndex, onClick: handleOnSubmit })))));
|
|
8078
8079
|
};
|
|
8079
8080
|
|
|
8080
8081
|
function createActions(onItemUse) {
|
|
@@ -8116,7 +8117,7 @@ var Suggestions = function (props) {
|
|
|
8116
8117
|
|
|
8117
8118
|
var ChatFooter = function (props) {
|
|
8118
8119
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
8119
|
-
var placeholder = props.placeholder, sendButtonIcon = props.sendButtonIcon, onSubmit = props.onSubmit;
|
|
8120
|
+
var placeholder = props.placeholder, sendButtonIcon = props.sendButtonIcon, footerConfig = props.footerConfig, inputConfig = props.inputConfig, onSubmit = props.onSubmit;
|
|
8120
8121
|
var _k = React$1.useState(false), drawer = _k[0], setDrawerState = _k[1]; // false initially
|
|
8121
8122
|
var _l = React$1.useState(), suggestionSearch = _l[0], setSuggestionSearch = _l[1];
|
|
8122
8123
|
var contexts = reactRedux.useSelector(function (state) { return state.activeContexts; });
|
|
@@ -8165,7 +8166,7 @@ var ChatFooter = function (props) {
|
|
|
8165
8166
|
React__default$1["default"].createElement("div", { className: "chat-footer__menu-icon" },
|
|
8166
8167
|
React__default$1["default"].createElement(DrawerBars, { onToggle: toggleDrawer }))) : React__default$1["default"].createElement(React__default$1["default"].Fragment, null),
|
|
8167
8168
|
((_j = suggestions.suggestions) === null || _j === void 0 ? void 0 : _j.length) > 0 && React__default$1["default"].createElement(Suggestions, { className: "xappw-chat-footer__suggestions", data: suggestions.suggestions, index: suggestions.index, onItemClick: handleItemClick, onItemUse: handleItemUse }),
|
|
8168
|
-
React__default$1["default"].createElement(Input, { addClass: "chat-footer__input " + (props.isChatting && props.visible ? "visible" : ""), suggestion: suggestions.item, value: input, placeholder: placeholder, sendButtonIcon: sendButtonIcon, onSubmit: handleSubmit, onChange: handleChange, onSuggestionCommand: suggestions.execute,
|
|
8169
|
+
React__default$1["default"].createElement(Input, { addClass: "chat-footer__input " + (props.isChatting && props.visible ? "visible" : ""), suggestion: suggestions.item, value: input, placeholder: placeholder, sendButtonIcon: sendButtonIcon, footerConfig: footerConfig, inputConfig: inputConfig, onSubmit: handleSubmit, onChange: handleChange, onSuggestionCommand: suggestions.execute,
|
|
8169
8170
|
// onFocus={this.inputOnFocus}
|
|
8170
8171
|
onFileUpload: props.onFileUpload }),
|
|
8171
8172
|
brandingEnabled && React__default$1["default"].createElement(ChatBranding, { text: branding })));
|
|
@@ -30689,46 +30690,49 @@ var ServerOffline = function () {
|
|
|
30689
30690
|
};
|
|
30690
30691
|
|
|
30691
30692
|
var CancelButton = function (props) {
|
|
30692
|
-
return React__default$1["default"].createElement("button", { id: "xapp-widget-close", className: "cancel-button", onClick: props.onClick });
|
|
30693
|
+
return React__default$1["default"].createElement("button", { id: "xapp-widget-close", tabIndex: props.tabIndex ? Number(props.tabIndex) : 0, className: "cancel-button", onClick: props.onClick });
|
|
30693
30694
|
};
|
|
30694
30695
|
|
|
30695
30696
|
var MinimizeButton = function (props) {
|
|
30696
|
-
return (React__default$1["default"].createElement("button", { id: "xapp-widget-minimize", className: "minimize-button ".concat(props.showInRight ? "positionRight" : ""), onClick: props.onClick }));
|
|
30697
|
+
return (React__default$1["default"].createElement("button", { id: "xapp-widget-minimize", tabIndex: props.tabIndex ? Number(props.tabIndex) : 0, className: "minimize-button ".concat(props.showInRight ? "positionRight" : ""), onClick: props.onClick }));
|
|
30697
30698
|
};
|
|
30698
30699
|
|
|
30699
30700
|
var RefreshButton = function (props) {
|
|
30700
|
-
return (React__default$1["default"].createElement("button", { id: "xapp-widget-refresh", className: "refresh-button ".concat(props.showInRight ? "positionRight" : props.showInLeft ? "positionLeft" : ""), onClick: props.onClick }));
|
|
30701
|
+
return (React__default$1["default"].createElement("button", { id: "xapp-widget-refresh", tabIndex: props.tabIndex ? Number(props.tabIndex) : 0, className: "refresh-button ".concat(props.showInRight ? "positionRight" : props.showInLeft ? "positionLeft" : ""), onClick: props.onClick }));
|
|
30701
30702
|
};
|
|
30702
30703
|
|
|
30703
30704
|
var DEFAULT_STATUS_CONFIG = {
|
|
30704
30705
|
online: "Virtual Assistant",
|
|
30705
30706
|
offline: "Leave us a message",
|
|
30706
30707
|
away: "We're away!",
|
|
30707
|
-
connecting: "Connecting..."
|
|
30708
|
+
connecting: "Connecting...",
|
|
30708
30709
|
};
|
|
30709
30710
|
function getStatusText(status, config) {
|
|
30710
30711
|
var _a, _b, _c, _d;
|
|
30711
30712
|
switch (status) {
|
|
30712
|
-
case "online":
|
|
30713
|
-
|
|
30714
|
-
case "
|
|
30715
|
-
|
|
30713
|
+
case "online":
|
|
30714
|
+
return (_a = config === null || config === void 0 ? void 0 : config.online) !== null && _a !== void 0 ? _a : DEFAULT_STATUS_CONFIG.online;
|
|
30715
|
+
case "offline":
|
|
30716
|
+
return (_b = config === null || config === void 0 ? void 0 : config.offline) !== null && _b !== void 0 ? _b : DEFAULT_STATUS_CONFIG.offline;
|
|
30717
|
+
case "away":
|
|
30718
|
+
return (_c = config === null || config === void 0 ? void 0 : config.away) !== null && _c !== void 0 ? _c : DEFAULT_STATUS_CONFIG.away;
|
|
30719
|
+
default:
|
|
30720
|
+
return (_d = config === null || config === void 0 ? void 0 : config.connecting) !== null && _d !== void 0 ? _d : DEFAULT_STATUS_CONFIG.connecting;
|
|
30716
30721
|
}
|
|
30717
30722
|
}
|
|
30718
30723
|
var StatusContainer = function (props) {
|
|
30719
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
30724
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
|
30720
30725
|
return (React__default$1["default"].createElement("div", { className: "status-container" },
|
|
30721
30726
|
React__default$1["default"].createElement("div", { className: "status-container__avatar" },
|
|
30722
30727
|
React__default$1["default"].createElement(Avatar, { entity: props.agent })),
|
|
30723
|
-
React__default$1["default"].createElement("div", { className: "".concat("status-text", " ").concat(((_a = props.config) === null || _a === void 0 ? void 0 : _a.alignTextCenter)
|
|
30728
|
+
React__default$1["default"].createElement("div", { className: "".concat("status-text", " ").concat(((_a = props.config) === null || _a === void 0 ? void 0 : _a.alignTextCenter)
|
|
30729
|
+
? "status-text-positionCenter"
|
|
30730
|
+
: "status-text-positionLeft") },
|
|
30724
30731
|
React__default$1["default"].createElement("span", { className: "status-text-title" }, getStatusText(props.accountStatus, (_b = props.config) === null || _b === void 0 ? void 0 : _b.status)),
|
|
30725
|
-
((_d = (_c = props.config) === null || _c === void 0 ? void 0 : _c.subtitle) === null || _d === void 0 ? void 0 : _d.enabled) && React__default$1["default"].createElement("span", { className: "status-text-subtitle" }, (_g = (_f = (_e = props.config) === null || _e === void 0 ? void 0 : _e.subtitle) === null || _f === void 0 ? void 0 : _f.text) !== null && _g !== void 0 ? _g : "")),
|
|
30726
|
-
props.canRefresh &&
|
|
30727
|
-
|
|
30728
|
-
props.
|
|
30729
|
-
React__default$1["default"].createElement(MinimizeButton, { onClick: props.minimizeOnClick, showInRight: !props.canCancel }),
|
|
30730
|
-
props.canCancel &&
|
|
30731
|
-
React__default$1["default"].createElement(CancelButton, { onClick: props.cancelOnClick })));
|
|
30732
|
+
((_d = (_c = props.config) === null || _c === void 0 ? void 0 : _c.subtitle) === null || _d === void 0 ? void 0 : _d.enabled) && (React__default$1["default"].createElement("span", { className: "status-text-subtitle" }, (_g = (_f = (_e = props.config) === null || _e === void 0 ? void 0 : _e.subtitle) === null || _f === void 0 ? void 0 : _f.text) !== null && _g !== void 0 ? _g : ""))),
|
|
30733
|
+
props.canRefresh && (React__default$1["default"].createElement(RefreshButton, { onClick: props.refreshOnClick, tabIndex: (_j = (_h = props.config) === null || _h === void 0 ? void 0 : _h.actions) === null || _j === void 0 ? void 0 : _j.refreshTabIndex, showInLeft: props.canMinimize && props.canCancel, showInRight: !props.canMinimize && !props.canCancel })),
|
|
30734
|
+
props.canMinimize && (React__default$1["default"].createElement(MinimizeButton, { onClick: props.minimizeOnClick, tabIndex: (_l = (_k = props.config) === null || _k === void 0 ? void 0 : _k.actions) === null || _l === void 0 ? void 0 : _l.minimizeTabIndex, showInRight: !props.canCancel })),
|
|
30735
|
+
props.canCancel && (React__default$1["default"].createElement(CancelButton, { onClick: props.cancelOnClick, tabIndex: (_o = (_m = props.config) === null || _m === void 0 ? void 0 : _m.actions) === null || _o === void 0 ? void 0 : _o.cancelTabIndex }))));
|
|
30732
30736
|
};
|
|
30733
30737
|
|
|
30734
30738
|
function buildStyleContent(theme) {
|
|
@@ -30819,7 +30823,7 @@ function getChatButtonStyle(style) {
|
|
|
30819
30823
|
if (!style) {
|
|
30820
30824
|
return empty();
|
|
30821
30825
|
}
|
|
30822
|
-
return withPrefix("chat-button-", union(getMargins(style.margin), getBackgroundStyle(style.background)));
|
|
30826
|
+
return withPrefix("xapp-chat-button-", union(getMargins(style.margin), getBackgroundStyle(style.background)));
|
|
30823
30827
|
}
|
|
30824
30828
|
function getMessagesStyle(style) {
|
|
30825
30829
|
if (!style) {
|
|
@@ -31028,7 +31032,7 @@ var ChatWidgetWrapper = function (props) {
|
|
|
31028
31032
|
React__default$1["default"].createElement(ChatWidget, __assign({}, props)))));
|
|
31029
31033
|
};
|
|
31030
31034
|
var ChatWidget = function (props) {
|
|
31031
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u;
|
|
31035
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w;
|
|
31032
31036
|
var innerDispatch = useChatDispatch();
|
|
31033
31037
|
var dispatch = useChatServerDispatch();
|
|
31034
31038
|
// From Redux
|
|
@@ -31048,8 +31052,8 @@ var ChatWidget = function (props) {
|
|
|
31048
31052
|
canCancel = !dockedMode && !staticMode;
|
|
31049
31053
|
}
|
|
31050
31054
|
// Our state - pull from storage
|
|
31051
|
-
var
|
|
31052
|
-
var
|
|
31055
|
+
var _x = React$1.useState((!canMinimize && !canCancel) || !!get("visible") || (((_k = props.config) === null || _k === void 0 ? void 0 : _k.autoOpenOnWidth) && window.matchMedia("(min-width: ".concat((_l = props.config) === null || _l === void 0 ? void 0 : _l.autoOpenOnWidth, ")")).matches)), visible = _x[0], setVisibleState = _x[1];
|
|
31056
|
+
var _y = React$1.useState(false), typing = _y[0], setTypingState = _y[1]; // false initially
|
|
31053
31057
|
var chatServer = React$1.useContext(ChatServerContext);
|
|
31054
31058
|
var setVisible = React$1.useCallback(function (newVisible) {
|
|
31055
31059
|
if (staticMode) {
|
|
@@ -31190,8 +31194,8 @@ var ChatWidget = function (props) {
|
|
|
31190
31194
|
React__default$1["default"].createElement("div", { className: "spinner-container ".concat(visible && connectionStatus === "pending" ? "visible" : "") },
|
|
31191
31195
|
React__default$1["default"].createElement("div", { className: "spinner" })),
|
|
31192
31196
|
connectionStatus === "offline" && React__default$1["default"].createElement(ServerOffline, null),
|
|
31193
|
-
React__default$1["default"].createElement(ChatFooter, { isChatting: chatState.isChatting, placeholder: (_r = config === null || config === void 0 ? void 0 : config.input) === null || _r === void 0 ? void 0 : _r.placeholder, sendButtonIcon: (_t = (_s = config === null || config === void 0 ? void 0 : config.footer) === null || _s === void 0 ? void 0 : _s.sendButton) === null || _t === void 0 ? void 0 : _t.icon, visible: visible, onChange: handleOnChange, onSubmit: handleOnSubmit, onFileUpload: handleFileUpload })),
|
|
31194
|
-
React__default$1["default"].createElement(ChatButton, { addClass: getVisibilityClass(), onClick: chatButtonOnClick, config: (
|
|
31197
|
+
React__default$1["default"].createElement(ChatFooter, { isChatting: chatState.isChatting, placeholder: (_r = config === null || config === void 0 ? void 0 : config.input) === null || _r === void 0 ? void 0 : _r.placeholder, sendButtonIcon: (_t = (_s = config === null || config === void 0 ? void 0 : config.footer) === null || _s === void 0 ? void 0 : _s.sendButton) === null || _t === void 0 ? void 0 : _t.icon, visible: visible, footerConfig: (_u = props.config) === null || _u === void 0 ? void 0 : _u.footer, inputConfig: (_v = props.config) === null || _v === void 0 ? void 0 : _v.input, onChange: handleOnChange, onSubmit: handleOnSubmit, onFileUpload: handleFileUpload })),
|
|
31198
|
+
React__default$1["default"].createElement(ChatButton, { addClass: getVisibilityClass(), onClick: chatButtonOnClick, config: (_w = props.config) === null || _w === void 0 ? void 0 : _w.cta, visible: visible })));
|
|
31195
31199
|
};
|
|
31196
31200
|
|
|
31197
31201
|
function tryParseJson(str) {
|