@xapp/chat-widget 1.58.0 → 1.59.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/ChatButton/ChatButton.d.ts +0 -0
- package/dist/components/ChatButton/ChatButton.stories.d.ts +1 -0
- package/dist/components/ChatWidget/ChatWidget.stories.d.ts +1 -0
- package/dist/index.css +2 -2
- package/dist/index.es.js +13 -7
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +13 -7
- package/dist/index.js.map +1 -1
- package/dist/xapp-chat-widget.css +1 -1
- package/dist/xapp-chat-widget.js +3 -3
- package/dist/xapp-chat-widget.js.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -703,14 +703,17 @@ var CtaBubbleContainer = function (props) {
|
|
|
703
703
|
};
|
|
704
704
|
|
|
705
705
|
var ChatButton = function (props) {
|
|
706
|
-
return (React__default$1["default"].createElement("button", { className: "xapp-chat-button ".concat(props.addClass), onClick: props.onClick },
|
|
706
|
+
return (React__default$1["default"].createElement("button", { className: "xapp-chat-button ".concat(props.addClass || "").trim(), onClick: props.onClick },
|
|
707
707
|
React__default$1["default"].createElement("div", { id: "xapp-widget-button", className: "xapp-chat-button__btn", style: props.borderStyle && {
|
|
708
708
|
border: 'solid',
|
|
709
709
|
borderWidth: props.borderStyle.width,
|
|
710
710
|
borderColor: props.borderStyle.color
|
|
711
|
-
} },
|
|
712
|
-
|
|
713
|
-
|
|
711
|
+
} }, props.imageUrl ? (
|
|
712
|
+
// Display image from URL
|
|
713
|
+
React__default$1["default"].createElement("img", { src: props.imageUrl, alt: "Chat Icon", width: "22", height: "22" })) : (
|
|
714
|
+
// Fallback to default SVG
|
|
715
|
+
React__default$1["default"].createElement("svg", { width: "22", height: "22", viewBox: "0 0 22 22" },
|
|
716
|
+
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" })))),
|
|
714
717
|
props.config && props.config.message && (React__default$1["default"].createElement("div", { className: "xapp-chat-button__cta" },
|
|
715
718
|
React__default$1["default"].createElement(CtaBubbleContainer, { timeout: props.config.timeout, visible: !props.visible }, props.config.message)))));
|
|
716
719
|
};
|
|
@@ -932,7 +935,7 @@ function sendGreeting(PRECHAT_FORM_ENABLED) {
|
|
|
932
935
|
if (!state.connection.greetingRequested) {
|
|
933
936
|
log("sending greeting");
|
|
934
937
|
// Send nothing to get the greeting content
|
|
935
|
-
chatServer.sendChatMsg({ text: undefined }, function (err2) {
|
|
938
|
+
chatServer.sendChatMsg({ text: undefined, attributes: { isGreeting: true } }, function (err2) {
|
|
936
939
|
if (err2) {
|
|
937
940
|
log("Error sending message");
|
|
938
941
|
}
|
|
@@ -2471,7 +2474,7 @@ var StentorLocalChat = /** @class */ (function () {
|
|
|
2471
2474
|
/*! Copyright (c) 2022, XAPPmedia */
|
|
2472
2475
|
var PERMISSION_QUESTION_EXPIRATION_MS = 300000; // 5 minutes
|
|
2473
2476
|
function requestFromMessage(message, userId, isNewSession, sessionId, accessToken, attributes, visitorInfo) {
|
|
2474
|
-
var _a, _b, _c, _d;
|
|
2477
|
+
var _a, _b, _c, _d, _e;
|
|
2475
2478
|
var request;
|
|
2476
2479
|
var now = new Date().getTime();
|
|
2477
2480
|
if (isNewSession && !((_a = message === null || message === void 0 ? void 0 : message.msg) === null || _a === void 0 ? void 0 : _a.text)) {
|
|
@@ -2566,6 +2569,9 @@ function requestFromMessage(message, userId, isNewSession, sessionId, accessToke
|
|
|
2566
2569
|
};
|
|
2567
2570
|
}
|
|
2568
2571
|
}
|
|
2572
|
+
if ((_e = message.msg) === null || _e === void 0 ? void 0 : _e.attributes) {
|
|
2573
|
+
request.attributes = __assign(__assign({}, request.attributes), message.msg.attributes);
|
|
2574
|
+
}
|
|
2569
2575
|
return request;
|
|
2570
2576
|
}
|
|
2571
2577
|
function looksLikeEmail(email) {
|
|
@@ -31074,7 +31080,7 @@ var ChatWidget = function (props) {
|
|
|
31074
31080
|
React__default$1["default"].createElement(ChatFooter, { isAdmin: config === null || config === void 0 ? void 0 : config.isAdmin, isChatting: chatState.isChatting, placeholder: (_x = config === null || config === void 0 ? void 0 : config.input) === null || _x === void 0 ? void 0 : _x.placeholder, sendButtonIcon: (_z = (_y = config === null || config === void 0 ? void 0 : config.footer) === null || _y === void 0 ? void 0 : _y.sendButton) === null || _z === void 0 ? void 0 : _z.icon, visible: visible, menuConfig: props.config.menu, footerConfig: (_0 = props.config) === null || _0 === void 0 ? void 0 : _0.footer, inputConfig: (_1 = props.config) === null || _1 === void 0 ? void 0 : _1.input, onChange: handleOnChange, onSubmit: handleOnSubmit, onFileUpload: handleFileUpload }),
|
|
31075
31081
|
React__default$1["default"].createElement("div", { className: "restartModal", ref: modalRef, onClick: handleRestartModalCloseClick },
|
|
31076
31082
|
React__default$1["default"].createElement(ModalContent, { onClose: handleRestartModalCloseClick, onReset: handleReset }))),
|
|
31077
|
-
React__default$1["default"].createElement(ChatButton, { addClass: getVisibilityClass(), onClick: chatButtonOnClick, config: (_2 =
|
|
31083
|
+
React__default$1["default"].createElement(ChatButton, { addClass: getVisibilityClass(), onClick: chatButtonOnClick, config: config === null || config === void 0 ? void 0 : config.cta, imageUrl: (_2 = config === null || config === void 0 ? void 0 : config.chatButton) === null || _2 === void 0 ? void 0 : _2.imageUrl, visible: visible })));
|
|
31078
31084
|
};
|
|
31079
31085
|
|
|
31080
31086
|
function tryParseJson(str) {
|