@xapp/chat-widget 1.53.0 → 1.53.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.
- package/dist/components/ChatMessage/ChatMessage.d.ts +1 -0
- package/dist/components/MessageList/MessageList.d.ts +6 -0
- package/dist/index.css +2 -2
- package/dist/index.es.js +15 -4
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +15 -4
- package/dist/index.js.map +1 -1
- package/dist/store/ChatState.d.ts +6 -0
- package/package.json +8 -8
package/dist/index.js
CHANGED
|
@@ -1553,7 +1553,7 @@ var logOnce = function (key) {
|
|
|
1553
1553
|
};
|
|
1554
1554
|
|
|
1555
1555
|
function getVisitorSvg() {
|
|
1556
|
-
return (React__default$1["default"].createElement("svg", { width: "16", height: "19", viewBox: "0 0 16 19" },
|
|
1556
|
+
return (React__default$1["default"].createElement("svg", { width: "16", height: "19", viewBox: "0 0 16 19", style: { margin: "0 auto", display: "block" } },
|
|
1557
1557
|
React__default$1["default"].createElement("path", { d: "M11.5 5c0-1.933-1.567-3.5-3.5-3.5S4.5 3.067 4.5 5 6.067 8.5 8 8.5s3.5-1.567 3.5-3.5zM3 5c0-2.76 2.24-5 5-5s5 2.24 5 5-2.24 5-5 5-5-2.24-5-5zM1.955 17.294c.21-.642.504-1.285.898-1.88C3.963 13.74 5.615 12.75 8 12.75c2.385 0 4.038.99 5.147 2.664.394.595.69 1.238.898 1.88.124.382.19.672.214.822.063.41.447.69.856.625.41-.063.69-.447.625-.856-.034-.225-.118-.59-.27-1.053-.247-.763-.598-1.527-1.073-2.244C13.024 12.51 10.917 11.25 8 11.25c-2.916 0-5.024 1.26-6.397 3.336-.475.717-.826 1.48-1.074 2.245-.152.463-.236.83-.27 1.054-.065.41.215.793.624.857.41.065.793-.215.857-.624.025-.15.09-.44.215-.822z", fill: "#FFF", fillRule: "evenodd" })));
|
|
1558
1558
|
}
|
|
1559
1559
|
var Avatar = function (props) {
|
|
@@ -7999,6 +7999,9 @@ var List = function (props) {
|
|
|
7999
7999
|
|
|
8000
8000
|
var ListMiddlewareWidget = function (props) {
|
|
8001
8001
|
var msg = props.msg, ctx = props.ctx;
|
|
8002
|
+
if (!ctx) {
|
|
8003
|
+
throw new TypeError("ctx not provided to ".concat(ListMiddlewareWidget.name));
|
|
8004
|
+
}
|
|
8002
8005
|
var list = React$1.useMemo(function () { return convertFromListDisplay(msg); }, [msg]);
|
|
8003
8006
|
var handleExecute = useExecuteActionCallback();
|
|
8004
8007
|
var handleButton = useButtonCallback();
|
|
@@ -8143,6 +8146,9 @@ var ChatMarkdownMessage = function (props) {
|
|
|
8143
8146
|
|
|
8144
8147
|
var ChatPermissionMessage = function (props) {
|
|
8145
8148
|
var message = props.message, ctx = props.ctx;
|
|
8149
|
+
if (!ctx) {
|
|
8150
|
+
throw new TypeError("ctx not provided to ".concat(ChatPermissionMessage.name));
|
|
8151
|
+
}
|
|
8146
8152
|
var user = ctx.user;
|
|
8147
8153
|
var permissionRequest = message.msg.permissionRequest;
|
|
8148
8154
|
var agentMessage = isAgent(props.message.user.nick);
|
|
@@ -8233,11 +8239,13 @@ function getClassName(msg) {
|
|
|
8233
8239
|
var avaKeys = ["text", "html", "card", "list"];
|
|
8234
8240
|
/**
|
|
8235
8241
|
* Chat Message Bubble with an Avatar
|
|
8242
|
+
*
|
|
8236
8243
|
* @param props
|
|
8237
8244
|
* @returns
|
|
8238
8245
|
*/
|
|
8239
8246
|
var ChatMessage = function (props) {
|
|
8240
8247
|
var middleware = props.messageMiddleware || StandardMiddlewares;
|
|
8248
|
+
var ctx = props.middlewareContext;
|
|
8241
8249
|
var user = props.agent;
|
|
8242
8250
|
function renderByType() {
|
|
8243
8251
|
var _a;
|
|
@@ -8261,9 +8269,9 @@ var ChatMessage = function (props) {
|
|
|
8261
8269
|
React__default$1["default"].createElement("span", { className: "message-sr-only" }, "at " + props.time + " the bot said"),
|
|
8262
8270
|
React__default$1["default"].createElement(Middleware, { key: index, msg: display, ctx: props.middlewareContext })));
|
|
8263
8271
|
}),
|
|
8264
|
-
msg.permissionRequest &&
|
|
8272
|
+
msg.permissionRequest && ctx &&
|
|
8265
8273
|
React__default$1["default"].createElement(ChatMessagePart, { showAvatar: avaKey === "permissionRequest", user: user },
|
|
8266
|
-
React__default$1["default"].createElement(ChatPermissionMessage, { message: props.message, sibling: props.sibling, ctx:
|
|
8274
|
+
React__default$1["default"].createElement(ChatPermissionMessage, { message: props.message, sibling: props.sibling, ctx: ctx, time: props.time }))));
|
|
8267
8275
|
}
|
|
8268
8276
|
return (React__default$1["default"].createElement(React__default$1["default"].Fragment, null));
|
|
8269
8277
|
}
|
|
@@ -31120,6 +31128,9 @@ var MessageList = function (props) {
|
|
|
31120
31128
|
function renderByType(msg, sibling) {
|
|
31121
31129
|
var _a;
|
|
31122
31130
|
var user = ((_a = props.agents[msg.user.nick]) === null || _a === void 0 ? void 0 : _a.user) || props.agent;
|
|
31131
|
+
if (!user) {
|
|
31132
|
+
console.warn("Could not get a user from agents list from ".concat(msg.user.nick, " or has an "));
|
|
31133
|
+
}
|
|
31123
31134
|
switch (msg.type) {
|
|
31124
31135
|
case "chat.file":
|
|
31125
31136
|
case "chat.msg":
|
|
@@ -31338,7 +31349,7 @@ function getChatButtonStyle(style) {
|
|
|
31338
31349
|
if (!style) {
|
|
31339
31350
|
return empty();
|
|
31340
31351
|
}
|
|
31341
|
-
return withPrefix("
|
|
31352
|
+
return withPrefix("chat-button-", union(getMargins(style.margin), getBackgroundStyle(style.background)));
|
|
31342
31353
|
}
|
|
31343
31354
|
function getMessagesStyle(style) {
|
|
31344
31355
|
if (!style) {
|