@xapp/chat-widget 1.80.0 → 1.81.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.
Files changed (30) hide show
  1. package/dist/components/AdminBar/AdminBar.d.ts +0 -0
  2. package/dist/components/CardContainer/CardContainer.d.ts +0 -0
  3. package/dist/components/ChatActionButtons/ChatActionButton.d.ts +0 -0
  4. package/dist/components/ChatActionButtons/ChatActionButtons.d.ts +0 -0
  5. package/dist/components/ChatMedia/ChatMedia.d.ts +1 -1
  6. package/dist/components/ChatMessage/ChatMessage.d.ts +0 -0
  7. package/dist/components/ChatMessagePart/ChatMessagePart.d.ts +0 -0
  8. package/dist/components/ChatRating/ChatRating.d.ts +0 -0
  9. package/dist/components/Icons/CloseIcon.d.ts +0 -0
  10. package/dist/components/Icons/LeftDownArrowIcon.d.ts +0 -0
  11. package/dist/components/Icons/SendIcon.d.ts +0 -0
  12. package/dist/components/Input/Input.d.ts +0 -0
  13. package/dist/components/MessageList/MessageList.d.ts +0 -0
  14. package/dist/components/MessageSvg/MessageSvg.d.ts +0 -0
  15. package/dist/components/QueuePosition/QueuePosition.d.ts +0 -0
  16. package/dist/components/ServerOffline/ServerOffline.d.ts +0 -0
  17. package/dist/components/UknownMessage/UnknownMessage.d.ts +0 -0
  18. package/dist/index.css +1 -1
  19. package/dist/index.es.js +644 -699
  20. package/dist/index.es.js.map +1 -1
  21. package/dist/index.js +799 -854
  22. package/dist/index.js.map +1 -1
  23. package/dist/store/ChatAction.d.ts +0 -0
  24. package/dist/store/ChatState.d.ts +0 -0
  25. package/dist/storybook/store.d.ts +2 -2
  26. package/dist/xapp/StentorRouterChat.d.ts +0 -0
  27. package/dist/xapp-chat-widget.css +1 -1
  28. package/dist/xapp-chat-widget.js +4 -4
  29. package/dist/xapp-chat-widget.js.map +1 -1
  30. package/package.json +21 -16
package/dist/index.es.js CHANGED
@@ -1,5 +1,6 @@
1
- import React$1, { useRef, useEffect, useCallback, createContext, useMemo, useContext, useState, useLayoutEffect } from 'react';
1
+ import require$$1, { useRef, useEffect, useCallback, createContext, useMemo, useContext, memo, useState, useLayoutEffect } from 'react';
2
2
  export { default as React } from 'react';
3
+ import require$$0, { jsx, Fragment, jsxs } from 'react/jsx-runtime';
3
4
  import { useSelector, useDispatch, Provider } from 'react-redux';
4
5
 
5
6
  var ActionButton = function (_a) {
@@ -10,7 +11,7 @@ var ActionButton = function (_a) {
10
11
  onClick(label);
11
12
  }
12
13
  }
13
- return (React$1.createElement("button", { disabled: disable, type: type, className: "action-button ".concat(addClass), onClick: handleClick }, label));
14
+ return (jsx("button", { disabled: disable, type: type, className: "action-button ".concat(addClass), onClick: handleClick, children: label }));
14
15
  };
15
16
 
16
17
  /******************************************************************************
@@ -402,22 +403,21 @@ var Avatar = function (props) {
402
403
  child = getVisitorSvg();
403
404
  }
404
405
  var hasImage = !!style.backgroundImage || !!child;
405
- return (React$1.createElement("div", { className: "avatar ".concat(agentAva ? "avatar--agent" : "avatar--visitor", " ").concat(!hasImage ? "avatar--empty" : ""), style: style, title: entity ? entity.display_name : "Agent" }, child));
406
+ return (jsx("div", { className: "avatar ".concat(agentAva ? "avatar--agent" : "avatar--visitor", " ").concat(!hasImage ? "avatar--empty" : ""), style: style, title: entity ? entity.display_name : "Agent", children: child }));
406
407
  };
407
408
  /**
408
409
  * Generates an SVG based on the
409
410
  * @returns
410
411
  */
411
412
  function getVisitorSvg() {
412
- return (React$1.createElement("svg", { width: "16", height: "19", viewBox: "0 0 16 19", style: { margin: "0 auto", display: "block" } },
413
- React$1.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" })));
413
+ return (jsx("svg", { width: "16", height: "19", viewBox: "0 0 16 19", style: { margin: "0 auto", display: "block" }, children: jsx("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" }) }));
414
414
  }
415
415
  function GenerateAvatar(props) {
416
416
  var initials = (props === null || props === void 0 ? void 0 : props.initials) || "?";
417
417
  var size = (props === null || props === void 0 ? void 0 : props.size) || 40;
418
418
  var backgroundColor = (props === null || props === void 0 ? void 0 : props.backgroundColor) || "#007bff";
419
419
  var textColor = (props === null || props === void 0 ? void 0 : props.textColor) || "#ffffff";
420
- var image = React$1.useMemo(function () {
420
+ var image = useMemo(function () {
421
421
  return generateImage(initials, size, backgroundColor, textColor);
422
422
  }, [initials, size, backgroundColor, textColor]);
423
423
  return image;
@@ -469,10 +469,10 @@ var OptionalLink = function (props) {
469
469
  }
470
470
  }, [url, onOpen]);
471
471
  if (url) {
472
- return (React$1.createElement("div", { onClick: handleOpenUrl, className: className }, props.children));
472
+ return (jsx("div", { onClick: handleOpenUrl, className: className, children: props.children }));
473
473
  }
474
474
  else {
475
- return (React$1.createElement("div", { onClick: props.onClick, className: className }, props.children));
475
+ return (jsx("div", { onClick: props.onClick, className: className, children: props.children }));
476
476
  }
477
477
  };
478
478
 
@@ -493,17 +493,17 @@ var ActionItem = function (props) {
493
493
  }
494
494
  }, [item, onExecute, onButtonClick]);
495
495
  var className = "xappw-chat-action-item ".concat(singleButton ? "xappw-chat-action-item--action" : "", " ").concat(props.className);
496
- return (React$1.createElement(OptionalLink, { className: className, url: getItemUrl(item), onClick: handleClick, onOpen: props.onOpenUrl }, props.children));
496
+ return (jsx(OptionalLink, { className: className, url: getItemUrl(item), onClick: handleClick, onOpen: props.onOpenUrl, children: props.children }));
497
497
  };
498
498
 
499
499
  var ChatImage = function (props) {
500
500
  var cleanUrl = props.imageUrl.replace(/'/g, "%27");
501
- var content = React$1.createElement("div", { className: "chat-card-img__content", style: { backgroundImage: "url(".concat(cleanUrl, ")") } });
501
+ var content = (jsx("div", { className: "chat-card-img__content", style: { backgroundImage: "url(".concat(cleanUrl, ")") } }));
502
502
  if (!props.imageActionUrl) {
503
- return (React$1.createElement("div", { className: "chat-card-img" }, content));
503
+ return jsx("div", { className: "chat-card-img", children: content });
504
504
  }
505
505
  else {
506
- return (React$1.createElement("a", { href: props.imageActionUrl, "aria-label": "read more", target: "_blank", rel: "noopener noreferrer", className: "chat-card-img" }, content));
506
+ return (jsx("a", { href: props.imageActionUrl, "aria-label": "read more", target: "_blank", rel: "noopener noreferrer", className: "chat-card-img", children: content }));
507
507
  }
508
508
  };
509
509
 
@@ -514,13 +514,12 @@ var ActionItemImage = function (props) {
514
514
  var itemUrl = getItemUrl(item);
515
515
  if (item.imageUrl) {
516
516
  var imageActionUrl = !singleButton ? item.imageActionUrl : null;
517
- return (React$1.createElement("div", { className: props.className },
518
- React$1.createElement(ChatImage, { imageUrl: item.imageUrl, imageActionUrl: !itemUrl && imageActionUrl })));
517
+ return (jsx("div", { className: props.className, children: jsx(ChatImage, { imageUrl: item.imageUrl, imageActionUrl: !itemUrl && imageActionUrl }) }));
519
518
  }
520
519
  else if (props.emptyImageVisible) {
521
- return (React$1.createElement("div", { className: props.className }));
520
+ return jsx("div", { className: props.className });
522
521
  }
523
- return React$1.createElement(React$1.Fragment, null);
522
+ return jsx(Fragment, {});
524
523
  };
525
524
 
526
525
  var ChatActionButtonInner = function (props) {
@@ -528,44 +527,35 @@ var ChatActionButtonInner = function (props) {
528
527
  var handleButton = useCallback(function () {
529
528
  onClick(button);
530
529
  }, [button, onClick]);
531
- return (React$1.createElement(ActionButton, { onClick: handleButton, addClass: "button-card", label: button.label }));
530
+ return jsx(ActionButton, { onClick: handleButton, addClass: "button-card", label: button.label });
532
531
  };
533
- var ChatActionButton = React$1.memo(ChatActionButtonInner);
532
+ var ChatActionButton = memo(ChatActionButtonInner);
534
533
 
535
534
  var ChatActionButtonsInner = function (props) {
536
- return (React$1.createElement("div", { className: "buttons-container " + (props.className || "") }, props.buttons.map(function (button, i) {
537
- return React$1.createElement(ChatActionButton, { button: button, onClick: props.onClick, key: i });
538
- })));
535
+ return (jsx("div", { className: "buttons-container " + (props.className || ""), children: props.buttons.map(function (button, i) {
536
+ return jsx(ChatActionButton, { button: button, onClick: props.onClick }, i);
537
+ }) }));
539
538
  };
540
- var ChatActionButtons = React$1.memo(ChatActionButtonsInner);
539
+ var ChatActionButtons = memo(ChatActionButtonsInner);
541
540
 
542
541
  var CarouselItem = function (props) {
543
542
  var _a;
544
543
  var item = props.item;
545
- return (React$1.createElement(ActionItem, { className: "chat-list-item-container", item: item, onButtonClick: props.onButtonClick, onExecute: props.onExecute, onOpenUrl: props.onOpenUrl },
546
- React$1.createElement("div", { className: "chat-list-item" },
547
- React$1.createElement(ActionItemImage, { item: item, className: "chat-list-item__img", emptyImageVisible: props.emptyImageVisible }),
548
- item.title && React$1.createElement("div", { className: "chat-list-item__title" },
549
- React$1.createElement("span", null, item.title)),
550
- item.subTitle && React$1.createElement("div", { className: "chat-list-item__subtitle" },
551
- React$1.createElement("span", null, item.subTitle)),
552
- !!((_a = item.buttons) === null || _a === void 0 ? void 0 : _a.length) && React$1.createElement(ChatActionButtons, { className: "chat-list-item__actions", buttons: item.buttons, onClick: props.onButtonClick }))));
544
+ return (jsx(ActionItem, { className: "chat-list-item-container", item: item, onButtonClick: props.onButtonClick, onExecute: props.onExecute, onOpenUrl: props.onOpenUrl, children: jsxs("div", { className: "chat-list-item", children: [jsx(ActionItemImage, { item: item, className: "chat-list-item__img", emptyImageVisible: props.emptyImageVisible }), item.title && (jsx("div", { className: "chat-list-item__title", children: jsx("span", { children: item.title }) })), item.subTitle && (jsx("div", { className: "chat-list-item__subtitle", children: jsx("span", { children: item.subTitle }) })), !!((_a = item.buttons) === null || _a === void 0 ? void 0 : _a.length) && (jsx(ChatActionButtons, { className: "chat-list-item__actions", buttons: item.buttons, onClick: props.onButtonClick }))] }) }));
553
545
  };
554
546
 
555
547
  function getLeftArrowSvg() {
556
- return (React$1.createElement("svg", { viewBox: "-5 -18 10 36" },
557
- React$1.createElement("path", { d: "M 2.5 -15 L -2.5 0 L 2.5 15", stroke: "currentColor", strokeLinecap: "square", strokeWidth: "4px", fill: "none" })));
548
+ return (jsx("svg", { viewBox: "-5 -18 10 36", children: jsx("path", { d: "M 2.5 -15 L -2.5 0 L 2.5 15", stroke: "currentColor", strokeLinecap: "square", strokeWidth: "4px", fill: "none" }) }));
558
549
  }
559
550
  var ChevronLeft = function (props) {
560
- return (React$1.createElement("button", { onClick: props.onClick, className: "xa-chevron" }, getLeftArrowSvg()));
551
+ return (jsx("button", { onClick: props.onClick, className: "xa-chevron", children: getLeftArrowSvg() }));
561
552
  };
562
553
 
563
554
  function getRightArrowSvg() {
564
- return (React$1.createElement("svg", { viewBox: "-5 -18 10 36" },
565
- React$1.createElement("path", { d: "M -2.5 -15 L 2.5 0 L -2.5 15", stroke: "currentColor", strokeLinecap: "square", strokeWidth: "4px", fill: "none" })));
555
+ return (jsx("svg", { viewBox: "-5 -18 10 36", children: jsx("path", { d: "M -2.5 -15 L 2.5 0 L -2.5 15", stroke: "currentColor", strokeLinecap: "square", strokeWidth: "4px", fill: "none" }) }));
566
556
  }
567
557
  var ChevronRight = function (props) {
568
- return (React$1.createElement("button", { onClick: props.onClick, className: "xa-chevron" }, getRightArrowSvg()));
558
+ return (jsx("button", { onClick: props.onClick, className: "xa-chevron", children: getRightArrowSvg() }));
569
559
  };
570
560
 
571
561
  var Carousel = function (props) {
@@ -604,15 +594,9 @@ var Carousel = function (props) {
604
594
  var hasOnlyOneItem = props.list.items.length === 1;
605
595
  var hasImage = props.list.items.some(function (item) { return item.imageUrl; });
606
596
  var listItems = props.list.items.map(function (item, itemIndex) {
607
- return (React$1.createElement("div", { className: "xappw-carousel-items__item", key: "item-key-".concat(itemIndex) },
608
- React$1.createElement(CarouselItem, { item: item, emptyImageVisible: hasImage, onExecute: props.onExecute, onButtonClick: props.onButtonClick, onOpenUrl: props.onOpenUrl })));
597
+ return (jsx("div", { className: "xappw-carousel-items__item", children: jsx(CarouselItem, { item: item, emptyImageVisible: hasImage, onExecute: props.onExecute, onButtonClick: props.onButtonClick, onOpenUrl: props.onOpenUrl }) }, "item-key-".concat(itemIndex)));
609
598
  });
610
- return (React$1.createElement("div", { className: "xappw-carousel" },
611
- !hasOnlyOneItem && (React$1.createElement("div", { className: "xappw-carousel__prev" },
612
- React$1.createElement(ChevronLeft, { onClick: function () { return scrollMe(-1); } }))),
613
- React$1.createElement("div", { ref: listRef, className: "xappw-carousel-items ".concat(hasOnlyOneItem ? "xappw-carousel-items--one-item" : "") }, listItems),
614
- !hasOnlyOneItem && (React$1.createElement("div", { className: "xappw-carousel__next" },
615
- React$1.createElement(ChevronRight, { onClick: function () { return scrollMe(1); } })))));
599
+ return (jsxs("div", { className: "xappw-carousel", children: [!hasOnlyOneItem && (jsx("div", { className: "xappw-carousel__prev", children: jsx(ChevronLeft, { onClick: function () { return scrollMe(-1); } }) })), jsx("div", { ref: listRef, className: "xappw-carousel-items ".concat(hasOnlyOneItem ? "xappw-carousel-items--one-item" : ""), children: listItems }), !hasOnlyOneItem && (jsx("div", { className: "xappw-carousel__next", children: jsx(ChevronRight, { onClick: function () { return scrollMe(1); } }) }))] }));
616
600
  };
617
601
 
618
602
  function useDimensions() {
@@ -714,9 +698,7 @@ var CtaBubbleTail = function (props) {
714
698
  var _a, _b;
715
699
  var _c = useDimensions(), ref = _c[0], rect = _c[1];
716
700
  var viewPort = { x: (_a = rect === null || rect === void 0 ? void 0 : rect.width) !== null && _a !== void 0 ? _a : 0, y: (_b = rect === null || rect === void 0 ? void 0 : rect.height) !== null && _b !== void 0 ? _b : 0 };
717
- return (React$1.createElement("div", { ref: ref, className: "cta-bubble__tail" },
718
- React$1.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 ".concat(viewPort.x, " ").concat(viewPort.y) },
719
- React$1.createElement("path", { d: getTailSvgPath$1(props, viewPort), fill: "currentColor" }))));
701
+ return (jsx("div", { ref: ref, className: "cta-bubble__tail", children: jsx("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 ".concat(viewPort.x, " ").concat(viewPort.y), children: jsx("path", { d: getTailSvgPath$1(props, viewPort), fill: "currentColor" }) }) }));
720
702
  };
721
703
  var CtaBubble = function (props) {
722
704
  var _a, _b, _c, _d;
@@ -730,17 +712,12 @@ var CtaBubble = function (props) {
730
712
  }
731
713
  };
732
714
  console.log("Returning CTABubble with message: ", props.children);
733
- return (React$1.createElement("div", { ref: ref, style: {
715
+ return (jsxs("div", { ref: ref, style: {
734
716
  border: props.borderStyle ? "solid" : "none",
735
717
  borderWidth: ((_a = props.borderStyle) === null || _a === void 0 ? void 0 : _a.width) || "0px",
736
718
  borderColor: ((_b = props.borderStyle) === null || _b === void 0 ? void 0 : _b.color) || "transparent",
737
719
  animation: "".concat(animation, " 1s infinite"),
738
- }, className: "cta-bubble", onClick: props.onClick },
739
- React$1.createElement(CtaBubbleTail, { width: (_c = rect === null || rect === void 0 ? void 0 : rect.width) !== null && _c !== void 0 ? _c : 0, height: (_d = rect === null || rect === void 0 ? void 0 : rect.height) !== null && _d !== void 0 ? _d : 0, direction: 60, angle: 45, length: 16 }),
740
- React$1.createElement("div", { className: "cta-bubble__content" }, props.children),
741
- props.dismissible && (React$1.createElement("button", { className: "cta-bubble__dismiss", onClick: handleDismiss, "aria-label": "Dismiss" },
742
- React$1.createElement("svg", { width: "12", height: "12", viewBox: "0 0 12 12", fill: "none", xmlns: "http://www.w3.org/2000/svg" },
743
- React$1.createElement("path", { d: "M11 1L1 11M1 1L11 11", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }))))));
720
+ }, className: "cta-bubble", onClick: props.onClick, children: [jsx(CtaBubbleTail, { width: (_c = rect === null || rect === void 0 ? void 0 : rect.width) !== null && _c !== void 0 ? _c : 0, height: (_d = rect === null || rect === void 0 ? void 0 : rect.height) !== null && _d !== void 0 ? _d : 0, direction: 60, angle: 45, length: 16 }), jsx("div", { className: "cta-bubble__content", children: props.children }), props.dismissible && (jsx("button", { className: "cta-bubble__dismiss", onClick: handleDismiss, "aria-label": "Dismiss", children: jsx("svg", { width: "12", height: "12", viewBox: "0 0 12 12", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: jsx("path", { d: "M11 1L1 11M1 1L11 11", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) }) }))] }));
744
721
  };
745
722
 
746
723
  var CtaBubbleContainer = function (props) {
@@ -835,7 +812,7 @@ var CtaBubbleContainer = function (props) {
835
812
  // Final render decision
836
813
  var shouldRender = visible && showBubble;
837
814
  log("[CtaBubbleContainer] Render decision: visible=".concat(visible, ", showBubble=").concat(showBubble, ", shouldRender=").concat(shouldRender));
838
- return (React$1.createElement(React$1.Fragment, null, visible && showBubble && (React$1.createElement(CtaBubble, { onClick: onClick, animate: animate, buttonAnimation: buttonAnimation, dismissible: dismissible, onDismiss: handleDismiss }, children))));
815
+ return (jsx(Fragment, { children: visible && showBubble && (jsx(CtaBubble, { onClick: onClick, animate: animate, buttonAnimation: buttonAnimation, dismissible: dismissible, onDismiss: handleDismiss, children: children })) }));
839
816
  };
840
817
 
841
818
  var ChatButton = function (_a) {
@@ -914,23 +891,19 @@ var ChatButton = function (_a) {
914
891
  }, [mobileWidth]);
915
892
  var maxSvgSize = 22;
916
893
  var svgSize = Math.min(maxSvgSize, (+buttonWidth / +defaultWidgetButtonWidth) * maxSvgSize);
917
- return (React$1.createElement("button", { "aria-label": "open chat", className: "xapp-chat-button ".concat(addClass || "").trim(), onClick: onClick },
918
- React$1.createElement("div", { id: "xapp-widget-button", className: "xapp-chat-button__btn", style: {
919
- width: "".concat(buttonWidth, "px"),
920
- height: "".concat(buttonWidth, "px"),
921
- borderRadius: "".concat(+buttonWidth / 2, "px"),
922
- border: borderStyle && borderStyle.width ? "solid" : "none",
923
- borderWidth: (borderStyle === null || borderStyle === void 0 ? void 0 : borderStyle.width) || "0px",
924
- borderColor: (borderStyle === null || borderStyle === void 0 ? void 0 : borderStyle.color) || "transparent",
925
- animation: "".concat(animation, " 1s infinite"),
926
- } }, imageUrl ? (
927
- // Display image from URL
928
- React$1.createElement("img", { src: imageUrl, alt: "Chat Icon" })) : (
929
- // Fallback to default SVG
930
- React$1.createElement("svg", { width: svgSize, height: svgSize, viewBox: "0 0 22 22" },
931
- React$1.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" })))),
932
- configToApply && configToApply.message && !hasInteracted && (React$1.createElement("div", { className: "xapp-chat-button__cta" },
933
- React$1.createElement(CtaBubbleContainer, { timeout: configToApply === null || configToApply === void 0 ? void 0 : configToApply.timeout, delay: configToApply === null || configToApply === void 0 ? void 0 : configToApply.delay, animate: animate, buttonAnimation: animation, dismissible: configToApply === null || configToApply === void 0 ? void 0 : configToApply.dismissible, visible: !visible /** Why is this !visible */, onDismiss: onCtaDismiss }, configToApply === null || configToApply === void 0 ? void 0 : configToApply.message)))));
894
+ return (jsxs("button", { "aria-label": "open chat", className: "xapp-chat-button ".concat(addClass || "").trim(), onClick: onClick, children: [jsx("div", { id: "xapp-widget-button", className: "xapp-chat-button__btn", style: {
895
+ width: "".concat(buttonWidth, "px"),
896
+ height: "".concat(buttonWidth, "px"),
897
+ borderRadius: "".concat(+buttonWidth / 2, "px"),
898
+ border: borderStyle && borderStyle.width ? "solid" : "none",
899
+ borderWidth: (borderStyle === null || borderStyle === void 0 ? void 0 : borderStyle.width) || "0px",
900
+ borderColor: (borderStyle === null || borderStyle === void 0 ? void 0 : borderStyle.color) || "transparent",
901
+ animation: "".concat(animation, " 1s infinite"),
902
+ }, children: imageUrl ? (
903
+ // Display image from URL
904
+ jsx("img", { src: imageUrl, alt: "Chat Icon" })) : (
905
+ // Fallback to default SVG
906
+ jsx("svg", { width: svgSize, height: svgSize, viewBox: "0 0 22 22", children: jsx("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" }) })) }), configToApply && configToApply.message && !hasInteracted && (jsx("div", { className: "xapp-chat-button__cta", children: jsx(CtaBubbleContainer, { timeout: configToApply === null || configToApply === void 0 ? void 0 : configToApply.timeout, delay: configToApply === null || configToApply === void 0 ? void 0 : configToApply.delay, animate: animate, buttonAnimation: animation, dismissible: configToApply === null || configToApply === void 0 ? void 0 : configToApply.dismissible, visible: !visible /** Why is this !visible */, onDismiss: onCtaDismiss, children: configToApply === null || configToApply === void 0 ? void 0 : configToApply.message }) }))] }));
934
907
  };
935
908
 
936
909
  var ChatCard = function (props) {
@@ -940,40 +913,32 @@ var ChatCard = function (props) {
940
913
  var image;
941
914
  var content;
942
915
  if (card.imageUrl) {
943
- image = React$1.createElement("div", { className: "chat-card-container__img" },
944
- React$1.createElement(ChatImage, { imageUrl: card.imageUrl, imageActionUrl: card.imageActionUrl }));
916
+ image = (jsx("div", { className: "chat-card-container__img", children: jsx(ChatImage, { imageUrl: card.imageUrl, imageActionUrl: card.imageActionUrl }) }));
945
917
  }
946
918
  if (card.title) {
947
- title =
948
- React$1.createElement("div", { className: "chat-card-title" },
949
- React$1.createElement("span", null, card.title));
919
+ title = (jsx("div", { className: "chat-card-title", children: jsx("span", { children: card.title }) }));
950
920
  }
951
921
  if (card.content) {
952
- content =
953
- React$1.createElement("div", { className: "chat-card-sub-title" },
954
- React$1.createElement("span", null, card.content));
955
- }
956
- return (React$1.createElement("div", { className: "chat-card-container" },
957
- image,
958
- title,
959
- content,
960
- !!((_a = card.buttons) === null || _a === void 0 ? void 0 : _a.length) && React$1.createElement(ChatActionButtons, { buttons: card.buttons, onClick: props.onButtonClick })));
922
+ content = (jsx("div", { className: "chat-card-sub-title", children: jsx("span", { children: card.content }) }));
923
+ }
924
+ return (jsxs("div", { className: "chat-card-container", children: [image, title, content, !!((_a = card.buttons) === null || _a === void 0 ? void 0 : _a.length) && (jsx(ChatActionButtons, { buttons: card.buttons, onClick: props.onButtonClick }))] }));
961
925
  };
962
926
 
963
927
  var ChatChip = function (props) {
964
928
  var option = props.option;
965
- var className = option.actionUrl ? "chat-chip chat-chip-link" : "chat-chip";
966
- return (React$1.createElement("div", { onClick: function () { return props === null || props === void 0 ? void 0 : props.onClick(option); }, className: className },
967
- React$1.createElement("span", null, typeof option === "object" ? option.label : option)));
929
+ var className = option.actionUrl
930
+ ? "chat-chip chat-chip-link"
931
+ : "chat-chip";
932
+ return (jsx("div", { onClick: function () { return props === null || props === void 0 ? void 0 : props.onClick(option); }, className: className, children: jsx("span", { children: typeof option === "object" ? option.label : option }) }));
968
933
  };
969
934
 
970
935
  /**
971
936
  * Render option list. We just follow the order.
972
937
  */
973
938
  var ChatChips = function (props) {
974
- return (React$1.createElement("div", { className: "chat-chips" }, props.options.map(function (option, i) {
975
- return React$1.createElement(ChatChip, { key: i, onClick: props.onOptionClick, option: option });
976
- })));
939
+ return (jsx("div", { className: "chat-chips", children: props.options.map(function (option, i) {
940
+ return jsx(ChatChip, { onClick: props.onOptionClick, option: option }, i);
941
+ }) }));
977
942
  };
978
943
 
979
944
  var defaultBehavior = {
@@ -1397,13 +1362,12 @@ function getDefaultExportFromCjs (x) {
1397
1362
  return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
1398
1363
  }
1399
1364
 
1400
- var React = React$1;
1365
+ var jsxRuntime = require$$0;
1366
+ var react = require$$1;
1401
1367
 
1402
1368
  var IconButton = function (props) {
1403
1369
  var Icon = props.icon;
1404
- return (React.createElement("div", { tabIndex: props.tabIndex ? Number(props.tabIndex) : 0, className: "xapp-search-icon-button ".concat(props.className || ""), onClick: props.onClick },
1405
- React.createElement("div", { className: "xapp-search-icon-button__content" },
1406
- React.createElement(Icon, null))));
1370
+ return (jsxRuntime.jsx("div", { tabIndex: props.tabIndex ? Number(props.tabIndex) : 0, className: "xapp-search-icon-button ".concat(props.className || ""), onClick: props.onClick, children: jsxRuntime.jsx("div", { className: "xapp-search-icon-button__content", children: jsxRuntime.jsx(Icon, {}) }) }));
1407
1371
  };
1408
1372
 
1409
1373
  // compile time full switch-case verification
@@ -1413,17 +1377,17 @@ function throwBadKind(x) {
1413
1377
 
1414
1378
  var RichTextBoldSpan = function (props) {
1415
1379
  var format = props.format, text = props.text;
1416
- return (React.createElement("span", { "data-rich-text-type": "bold", className: "xapp-search-rich-text-bold-span" }, text.substring(format.start, format.end)));
1380
+ return (jsxRuntime.jsx("span", { "data-rich-text-type": "bold", className: "xapp-search-rich-text-bold-span", children: text.substring(format.start, format.end) }));
1417
1381
  };
1418
1382
 
1419
1383
  var RichTextInputSpan = function (props) {
1420
1384
  var format = props.format, text = props.text, readOnly = props.readOnly, onClick = props.onClick;
1421
1385
  var defaultValue = format.text || text.substring(format.start, format.end);
1422
- var _a = React.useState(defaultValue), value = _a[0], setValue = _a[1];
1423
- var handleChange = React.useCallback(function (ev) {
1386
+ var _a = react.useState(defaultValue), value = _a[0], setValue = _a[1];
1387
+ var handleChange = react.useCallback(function (ev) {
1424
1388
  setValue(ev.target.value);
1425
1389
  }, []);
1426
- var handleClick = React.useCallback(function (ev) {
1390
+ var handleClick = react.useCallback(function (ev) {
1427
1391
  if (onClick) {
1428
1392
  var res = onClick(format);
1429
1393
  if (res === false) {
@@ -1433,14 +1397,14 @@ var RichTextInputSpan = function (props) {
1433
1397
  }
1434
1398
  }, [onClick, format]);
1435
1399
  if (readOnly) {
1436
- return (React.createElement("span", { className: "xapp-search-rich-text-input-span xapp-search-rich-text-input-span--readonly", onClick: handleClick }, defaultValue));
1400
+ return (jsxRuntime.jsx("span", { className: "xapp-search-rich-text-input-span xapp-search-rich-text-input-span--readonly", onClick: handleClick, children: defaultValue }));
1437
1401
  }
1438
- return (React.createElement("input", { type: "text", value: value, className: "xapp-search-rich-text-input-span", "data-rich-text-type": "inputText", onChange: handleChange, onClick: handleClick, readOnly: readOnly }));
1402
+ return (jsxRuntime.jsx("input", { type: "text", value: value, className: "xapp-search-rich-text-input-span", "data-rich-text-type": "inputText", onChange: handleChange, onClick: handleClick, readOnly: readOnly }));
1439
1403
  };
1440
1404
 
1441
1405
  var RichTextNormalSpan = function (props) {
1442
1406
  var format = props.format, text = props.text;
1443
- return (React.createElement("span", { "data-rich-text-type": "normal", className: "xapp-search-rich-text-normal-span" }, text.substring(format.start, format.end)));
1407
+ return (jsxRuntime.jsx("span", { "data-rich-text-type": "normal", className: "xapp-search-rich-text-normal-span", children: text.substring(format.start, format.end) }));
1444
1408
  };
1445
1409
 
1446
1410
  var RichTextSpan = function (props) {
@@ -1448,11 +1412,11 @@ var RichTextSpan = function (props) {
1448
1412
  var type = format.type;
1449
1413
  switch (type) {
1450
1414
  case "normal":
1451
- return (React.createElement(RichTextNormalSpan, { text: text, format: format, readOnly: readOnly }));
1415
+ return jsxRuntime.jsx(RichTextNormalSpan, { text: text, format: format, readOnly: readOnly });
1452
1416
  case "bold":
1453
- return (React.createElement(RichTextBoldSpan, { text: text, format: format, readOnly: readOnly }));
1417
+ return jsxRuntime.jsx(RichTextBoldSpan, { text: text, format: format, readOnly: readOnly });
1454
1418
  case "inputText":
1455
- return (React.createElement(RichTextInputSpan, { text: text, format: format, readOnly: readOnly, onClick: onClick }));
1419
+ return (jsxRuntime.jsx(RichTextInputSpan, { text: text, format: format, readOnly: readOnly, onClick: onClick }));
1456
1420
  default:
1457
1421
  throwBadKind(type);
1458
1422
  }
@@ -1537,7 +1501,7 @@ function parseContent(node) {
1537
1501
  formats.push({
1538
1502
  type: type,
1539
1503
  start: text.length,
1540
- end: text.length + innerText.length
1504
+ end: text.length + innerText.length,
1541
1505
  });
1542
1506
  text += innerText;
1543
1507
  }
@@ -1548,7 +1512,7 @@ function parseContent(node) {
1548
1512
  formats.push({
1549
1513
  type: "normal",
1550
1514
  start: text.length,
1551
- end: text.length + innerText.length
1515
+ end: text.length + innerText.length,
1552
1516
  });
1553
1517
  text += innerText;
1554
1518
  }
@@ -1556,7 +1520,7 @@ function parseContent(node) {
1556
1520
  });
1557
1521
  return cleanRichTextValue({
1558
1522
  text: text,
1559
- formats: formats
1523
+ formats: formats,
1560
1524
  });
1561
1525
  }
1562
1526
  function cleanContent(node) {
@@ -1574,22 +1538,21 @@ function cleanContent(node) {
1574
1538
  try {
1575
1539
  (_a = c.parentElement) === null || _a === void 0 ? void 0 : _a.removeChild(c);
1576
1540
  }
1577
- catch (_b) {
1578
- }
1541
+ catch (_b) { }
1579
1542
  }
1580
1543
  }
1581
1544
  var RichText = function (props) {
1582
1545
  var value = props.value, className = props.className, readOnly = props.readOnly, onInput = props.onInput, onChange = props.onChange, onSpanClick = props.onSpanClick;
1583
1546
  var formatsRaw = value.formats, text = value.text;
1584
- var formats = React.useMemo(function () { return extendFormat(formatsRaw, text.length); }, [formatsRaw, text.length]);
1585
- var handleInput = React.useCallback(function (ev) {
1547
+ var formats = react.useMemo(function () { return extendFormat(formatsRaw, text.length); }, [formatsRaw, text.length]);
1548
+ var handleInput = react.useCallback(function (ev) {
1586
1549
  var target = ev.currentTarget;
1587
1550
  var newValue = parseContent(target);
1588
1551
  if (onInput) {
1589
1552
  onInput(newValue);
1590
1553
  }
1591
1554
  }, [onInput]);
1592
- var handleBlur = React.useCallback(function (ev) {
1555
+ var handleBlur = react.useCallback(function (ev) {
1593
1556
  var target = ev.currentTarget;
1594
1557
  var newValue = parseContent(target);
1595
1558
  cleanContent(target);
@@ -1597,49 +1560,53 @@ var RichText = function (props) {
1597
1560
  onChange(newValue);
1598
1561
  }
1599
1562
  }, [onChange]);
1600
- return (React.createElement("div", { id: props.id, className: "xapp-search-rich-text ".concat(className || ""), contentEditable: !readOnly, suppressContentEditableWarning: true, onInput: handleInput, onBlur: handleBlur, onKeyDown: props.onKeyDown }, formats.map(function (format, index) { return (React.createElement(RichTextSpan, { key: index, format: format, text: text, readOnly: readOnly, onClick: onSpanClick })); })));
1563
+ return (jsxRuntime.jsx("div", { id: props.id, className: "xapp-search-rich-text ".concat(className || ""), contentEditable: !readOnly, suppressContentEditableWarning: true, onInput: handleInput, onBlur: handleBlur, onKeyDown: props.onKeyDown, children: formats.map(function (format, index) { return (jsxRuntime.jsx(RichTextSpan, { format: format, text: text, readOnly: readOnly, onClick: onSpanClick }, index)); }) }));
1601
1564
  };
1602
1565
 
1603
1566
  var RichInput = function (props) {
1604
1567
  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;
1605
1568
  var rich = value.formats.some(function (f) { return f.type === "inputText"; });
1606
- var handleChange = React.useCallback(function (ev) {
1607
- onChange({
1608
- text: ev.target.value,
1609
- formats: []
1610
- });
1569
+ var handleChange = react.useCallback(function (ev) {
1570
+ if (onChange) {
1571
+ onChange({
1572
+ text: ev.target.value,
1573
+ formats: [],
1574
+ });
1575
+ }
1611
1576
  }, [onChange]);
1612
- var handleRichChange = React.useCallback(function (val) {
1613
- onChange(val);
1577
+ var handleRichChange = react.useCallback(function (val) {
1578
+ if (onChange) {
1579
+ onChange(val);
1580
+ }
1614
1581
  }, [onChange]);
1615
- var handleInput = React.useCallback(function (ev) {
1582
+ var handleInput = react.useCallback(function (ev) {
1616
1583
  if (onInput) {
1617
1584
  onInput({
1618
1585
  text: ev.target.value,
1619
- formats: []
1586
+ formats: [],
1620
1587
  });
1621
1588
  }
1622
1589
  }, [onInput]);
1623
- var handleRichInput = React.useCallback(function (val) {
1590
+ var handleRichInput = react.useCallback(function (val) {
1624
1591
  if (onInput) {
1625
1592
  onInput(val);
1626
1593
  }
1627
1594
  }, [onInput]);
1628
- var handleKeyDown = React.useCallback(function (event) {
1595
+ var handleKeyDown = react.useCallback(function (event) {
1629
1596
  if (onKeyDown) {
1630
1597
  onKeyDown(event);
1631
1598
  }
1632
1599
  }, [onKeyDown]);
1633
- var inputRef = React.useRef(null);
1600
+ var inputRef = react.useRef(null);
1634
1601
  var inputNode = inputRef.current;
1635
- React.useEffect(function () {
1602
+ react.useEffect(function () {
1636
1603
  if (inputNode && onSearch) {
1637
1604
  var handler_1 = function (ev) {
1638
1605
  var target = ev.target;
1639
1606
  if (target) {
1640
1607
  onSearch({
1641
1608
  text: target.value,
1642
- formats: []
1609
+ formats: [],
1643
1610
  });
1644
1611
  }
1645
1612
  };
@@ -1650,12 +1617,11 @@ var RichInput = function (props) {
1650
1617
  }
1651
1618
  return undefined;
1652
1619
  }, [inputNode, onSearch]);
1653
- return (React.createElement("div", { className: "xappw-rich-input ".concat(props.className) }, rich ?
1654
- React.createElement(RichText, { id: id, value: value, onChange: handleRichChange, onInput: handleRichInput, onKeyDown: handleKeyDown, className: "xappw-rich-input__input ".concat(props.className, "__input") }) : React.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 })));
1620
+ return (jsxRuntime.jsx("div", { className: "xappw-rich-input ".concat(props.className), children: rich ? (jsxRuntime.jsx(RichText, { id: id, value: value, onChange: handleRichChange, onInput: handleRichInput, onKeyDown: handleKeyDown, className: "xappw-rich-input__input ".concat(props.className, "__input") })) : (jsxRuntime.jsx("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 })) }));
1655
1621
  };
1656
1622
 
1657
1623
  var SuggestionsGroupHeading = function (props) {
1658
- return (React.createElement("div", { className: "xappw-suggestions-group-heading" }, props.label));
1624
+ return jsxRuntime.jsx("div", { className: "xappw-suggestions-group-heading", children: props.label });
1659
1625
  };
1660
1626
 
1661
1627
  function getScrollContainer(node) {
@@ -1667,22 +1633,22 @@ function getScrollContainer(node) {
1667
1633
  }
1668
1634
  var SuggestionsItem = function (props) {
1669
1635
  var data = props.data, current = props.current, ActionsComponent = props.actions, onClick = props.onClick, onHover = props.onHover, onSpanClick = props.onSpanClick;
1670
- var handleClick = React.useCallback(function () {
1636
+ var handleClick = react.useCallback(function () {
1671
1637
  onClick(data);
1672
1638
  }, [data, onClick]);
1673
- var handleHover = React.useCallback(function () {
1639
+ var handleHover = react.useCallback(function () {
1674
1640
  if (onHover) {
1675
1641
  onHover(data);
1676
1642
  }
1677
1643
  }, [data, onHover]);
1678
- var handleSpanClick = React.useCallback(function (span) {
1644
+ var handleSpanClick = react.useCallback(function (span) {
1679
1645
  if (onSpanClick) {
1680
1646
  return onSpanClick(data, span);
1681
1647
  }
1682
1648
  return undefined;
1683
1649
  }, [onSpanClick, data]);
1684
- var ref = React.useRef(null);
1685
- React.useEffect(function () {
1650
+ var ref = react.useRef(null);
1651
+ react.useEffect(function () {
1686
1652
  var node = ref.current;
1687
1653
  if (current && node) {
1688
1654
  var scrollContainer = getScrollContainer(node);
@@ -1699,22 +1665,13 @@ var SuggestionsItem = function (props) {
1699
1665
  }
1700
1666
  }
1701
1667
  }, [current]);
1702
- return (React.createElement("div", { ref: ref, className: "xappw-suggestions-item ".concat(current ? "xappw-suggestions-item--current" : ""), onClick: handleClick, onMouseEnter: handleHover },
1703
- React.createElement(RichText, { value: data, className: "xappw-suggestions-item__texts", readOnly: true, onSpanClick: handleSpanClick }),
1704
- ActionsComponent &&
1705
- React.createElement("div", { className: "xappw-suggestions-item__actions" },
1706
- React.createElement(ActionsComponent, { data: data, current: current }))));
1668
+ return (jsxRuntime.jsxs("div", { ref: ref, className: "xappw-suggestions-item ".concat(current ? "xappw-suggestions-item--current" : ""), onClick: handleClick, onMouseEnter: handleHover, children: [jsxRuntime.jsx(RichText, { value: data, className: "xappw-suggestions-item__texts", readOnly: true, onSpanClick: handleSpanClick }), ActionsComponent && (jsxRuntime.jsx("div", { className: "xappw-suggestions-item__actions", children: jsxRuntime.jsx(ActionsComponent, { data: data, current: current }) }))] }));
1707
1669
  };
1708
1670
 
1709
1671
  var SuggestionsGroup = function (props) {
1710
1672
  var group = props.group, currentIndex = props.currentIndex, itemActions = props.itemActions;
1711
1673
  var heading = group.heading, items = group.items;
1712
- return (React.createElement("div", { className: "xappw-suggestions-group" },
1713
- React.createElement("div", { className: "xappw-suggestions-group__heading" },
1714
- React.createElement(SuggestionsGroupHeading, { label: heading })),
1715
- React.createElement("div", { className: "xappw-suggestions-group__items" }, items.map(function (item, itemIndex) {
1716
- return React.createElement(SuggestionsItem, { key: itemIndex, data: item, current: currentIndex === itemIndex, actions: itemActions, onClick: props.onItemClick, onHover: props.onItemHover, onSpanClick: props.onSpanClick });
1717
- }))));
1674
+ return (jsxRuntime.jsxs("div", { className: "xappw-suggestions-group", children: [jsxRuntime.jsx("div", { className: "xappw-suggestions-group__heading", children: jsxRuntime.jsx(SuggestionsGroupHeading, { label: heading }) }), jsxRuntime.jsx("div", { className: "xappw-suggestions-group__items", children: items.map(function (item, itemIndex) { return (jsxRuntime.jsx(SuggestionsItem, { data: item, current: currentIndex === itemIndex, actions: itemActions, onClick: props.onItemClick, onHover: props.onItemHover, onSpanClick: props.onSpanClick }, itemIndex)); }) })] }));
1718
1675
  };
1719
1676
 
1720
1677
  function getItemsLength(result) {
@@ -1723,7 +1680,7 @@ function getItemsLength(result) {
1723
1680
 
1724
1681
  var SuggestionsList = function (props) {
1725
1682
  var suggestions = props.suggestions, itemActions = props.itemActions, className = props.className;
1726
- var length = React.useMemo(function () {
1683
+ var length = react.useMemo(function () {
1727
1684
  if (suggestions) {
1728
1685
  return getItemsLength(suggestions);
1729
1686
  }
@@ -1731,11 +1688,11 @@ var SuggestionsList = function (props) {
1731
1688
  }, [suggestions]);
1732
1689
  var currentIndex = length >= 0 ? props.index : NaN;
1733
1690
  var indexWalker = 0;
1734
- return (React.createElement("div", { className: "xappw-suggestions-list ".concat(className || "") }, suggestions === null || suggestions === void 0 ? void 0 : suggestions.map(function (group, index) {
1735
- var res = (React.createElement(SuggestionsGroup, { key: index, group: group, currentIndex: currentIndex - indexWalker, itemActions: itemActions, onItemClick: props.onItemClick, onItemHover: props.onItemHover, onSpanClick: props.onSpanClick }));
1736
- indexWalker += group.items.length;
1737
- return res;
1738
- })));
1691
+ return (jsxRuntime.jsx("div", { className: "xappw-suggestions-list ".concat(className || ""), children: suggestions === null || suggestions === void 0 ? void 0 : suggestions.map(function (group, index) {
1692
+ var res = (jsxRuntime.jsx(SuggestionsGroup, { group: group, currentIndex: currentIndex - indexWalker, itemActions: itemActions, onItemClick: props.onItemClick, onItemHover: props.onItemHover, onSpanClick: props.onSpanClick }, index));
1693
+ indexWalker += group.items.length;
1694
+ return res;
1695
+ }) }));
1739
1696
  };
1740
1697
 
1741
1698
  function findItemByIndex(groups, index) {
@@ -1754,65 +1711,6 @@ function findItemByIndex(groups, index) {
1754
1711
  return undefined;
1755
1712
  }
1756
1713
 
1757
- function parseSuggestionsFormat(format) {
1758
- var types = Object.keys(format);
1759
- var type = types[0];
1760
- var item = format[type];
1761
- if (!item) {
1762
- throw new Error();
1763
- }
1764
- return {
1765
- type: type,
1766
- start: item.start,
1767
- end: item.end
1768
- };
1769
- }
1770
- function parseSuggestionsFormats(formats) {
1771
- return formats.map(parseSuggestionsFormat);
1772
- }
1773
- function parseSuggestionsResponseItem(item) {
1774
- return {
1775
- text: item.suggestion,
1776
- content: item.answer,
1777
- formats: parseSuggestionsFormats(item.format),
1778
- type: item.type
1779
- };
1780
- }
1781
- function getHeading(type) {
1782
- switch (type) {
1783
- case "FAQ":
1784
- return "FAQs";
1785
- case "INTENT":
1786
- return "Suggestions";
1787
- case "HISTORICAL":
1788
- return "Suggestions";
1789
- default:
1790
- return type;
1791
- }
1792
- }
1793
- function parseSuggestionsResponse(response, direction) {
1794
- if (direction === void 0) { direction = 1; }
1795
- if (!response) {
1796
- return undefined;
1797
- }
1798
- var items = sortSuggestionItems(response.suggestions, direction);
1799
- return items.reduce(function (result, current) {
1800
- var mappedItem = parseSuggestionsResponseItem(current);
1801
- if (result.length) {
1802
- var prevGroup = result[result.length - 1];
1803
- if (prevGroup.heading === getHeading(current.type)) {
1804
- prevGroup.items.push(mappedItem);
1805
- return result;
1806
- }
1807
- }
1808
- result.push({
1809
- heading: getHeading(current.type),
1810
- items: [mappedItem]
1811
- });
1812
- return result;
1813
- }, []);
1814
- }
1815
-
1816
1714
  /******************************************************************************
1817
1715
  Copyright (c) Microsoft Corporation.
1818
1716
 
@@ -1895,6 +1793,65 @@ function sortSuggestionItems(items, direction) {
1895
1793
  return __spreadArray([], items).sort(function (left, right) { return compareSuggestionItems(left, right, direction); });
1896
1794
  }
1897
1795
 
1796
+ function parseSuggestionsFormat(format) {
1797
+ var types = Object.keys(format);
1798
+ var type = types[0];
1799
+ var item = format[type];
1800
+ if (!item) {
1801
+ throw new Error();
1802
+ }
1803
+ return {
1804
+ type: type,
1805
+ start: item.start,
1806
+ end: item.end,
1807
+ };
1808
+ }
1809
+ function parseSuggestionsFormats(formats) {
1810
+ return formats.map(parseSuggestionsFormat);
1811
+ }
1812
+ function parseSuggestionsResponseItem(item) {
1813
+ return {
1814
+ text: item.suggestion,
1815
+ content: item.answer,
1816
+ formats: parseSuggestionsFormats(item.format),
1817
+ type: item.type,
1818
+ };
1819
+ }
1820
+ function getHeading(type) {
1821
+ switch (type) {
1822
+ case "FAQ":
1823
+ return "FAQs";
1824
+ case "INTENT":
1825
+ return "Suggestions";
1826
+ case "HISTORICAL":
1827
+ return "Suggestions";
1828
+ default:
1829
+ return type;
1830
+ }
1831
+ }
1832
+ function parseSuggestionsResponse(response, direction) {
1833
+ if (direction === void 0) { direction = 1; }
1834
+ if (!response) {
1835
+ return undefined;
1836
+ }
1837
+ var items = sortSuggestionItems(response.suggestions, direction);
1838
+ return items.reduce(function (result, current) {
1839
+ var mappedItem = parseSuggestionsResponseItem(current);
1840
+ if (result.length) {
1841
+ var prevGroup = result[result.length - 1];
1842
+ if (prevGroup.heading === getHeading(current.type)) {
1843
+ prevGroup.items.push(mappedItem);
1844
+ return result;
1845
+ }
1846
+ }
1847
+ result.push({
1848
+ heading: getHeading(current.type),
1849
+ items: [mappedItem],
1850
+ });
1851
+ return result;
1852
+ }, []);
1853
+ }
1854
+
1898
1855
  /**
1899
1856
  * Append the provided query params to the URL
1900
1857
  *
@@ -1917,11 +1874,11 @@ function noop$1() {
1917
1874
  }
1918
1875
  function useJsonFetch(url, options) {
1919
1876
  if (options === void 0) { options = defaultOptions$2; }
1920
- var _a = React.useState({
1877
+ var _a = react.useState({
1921
1878
  state: "paused"
1922
1879
  }), value = _a[0], setValue = _a[1];
1923
1880
  var pause = options.pause;
1924
- React.useEffect(function () {
1881
+ react.useEffect(function () {
1925
1882
  if (pause) {
1926
1883
  setValue({
1927
1884
  state: "paused"
@@ -1986,7 +1943,7 @@ function useJsonFetch(url, options) {
1986
1943
 
1987
1944
  function useSuggestionsFetch$1(options) {
1988
1945
  var baseUrl = options.url, context = options.context, query = options.query;
1989
- var url = React.useMemo(function () {
1946
+ var url = react.useMemo(function () {
1990
1947
  if (!baseUrl) {
1991
1948
  return undefined;
1992
1949
  }
@@ -3032,6 +2989,11 @@ var StentorRouterChat = /** @class */ (function () {
3032
2989
  if (typeof ((_a = _this.options.hooks) === null || _a === void 0 ? void 0 : _a.onResponse) === "function") {
3033
2990
  _this.options.hooks.onResponse(response);
3034
2991
  }
2992
+ // Session is initialized after first bot response (same as StentorDirectChat)
2993
+ if (_this.isNewSession) {
2994
+ _this.isNewSession = false;
2995
+ log("Session initialized after receiving first bot response");
2996
+ }
3035
2997
  message = responseToMessage(response);
3036
2998
  }
3037
2999
  else if (sender.deviceId === "Widget") {
@@ -3054,35 +3016,43 @@ var StentorRouterChat = /** @class */ (function () {
3054
3016
  },
3055
3017
  });
3056
3018
  };
3057
- this.handlers["user joined"] = function (_data, sender, ts, _attributes) {
3019
+ this.handlers["user joined"] = function (data, sender, ts, _attributes) {
3058
3020
  var _a, _b;
3059
3021
  var nick = senderToNick(sender);
3060
3022
  log("Received \"user joined\" event - deviceId: ".concat(sender.deviceId, ", userId: ").concat(sender.userId, ", displayName: ").concat(sender.displayName, ", nick: ").concat(nick));
3061
3023
  log("Dispatching chat.memberjoin for ".concat(sender.displayName || "Unknown"));
3024
+ var userData = data;
3062
3025
  _this.dispatch({
3063
3026
  type: "chat",
3064
3027
  detail: {
3065
3028
  type: "chat.memberjoin",
3066
3029
  user: {
3067
- avatarPath: (_b = (_a = _this.options) === null || _a === void 0 ? void 0 : _a.bot) === null || _b === void 0 ? void 0 : _b.avatarPath,
3030
+ avatarPath: sender.avatarPath || ((_b = (_a = _this.options) === null || _a === void 0 ? void 0 : _a.bot) === null || _b === void 0 ? void 0 : _b.avatarPath),
3068
3031
  displayName: sender.displayName,
3069
3032
  nick: nick,
3070
3033
  },
3071
3034
  timestamp: ts || new Date().getTime(),
3035
+ showDivider: userData === null || userData === void 0 ? void 0 : userData.showDivider,
3036
+ message: userData === null || userData === void 0 ? void 0 : userData.message,
3037
+ hideUserInfo: userData === null || userData === void 0 ? void 0 : userData.hideUserInfo,
3072
3038
  },
3073
3039
  });
3074
3040
  log("chat.memberjoin dispatched for nick: ".concat(nick));
3075
3041
  };
3076
- this.handlers["user left"] = function (_data, sender, ts, _attributes) {
3042
+ this.handlers["user left"] = function (data, sender, ts, _attributes) {
3043
+ var userData = data;
3077
3044
  _this.dispatch({
3078
3045
  type: "chat",
3079
3046
  detail: {
3080
3047
  type: "chat.memberleave",
3081
3048
  user: {
3049
+ avatarPath: sender.avatarPath,
3082
3050
  displayName: sender.displayName,
3083
3051
  nick: senderToNick(sender),
3084
3052
  },
3085
3053
  timestamp: ts || new Date().getTime(),
3054
+ showDivider: userData === null || userData === void 0 ? void 0 : userData.showDivider,
3055
+ message: userData === null || userData === void 0 ? void 0 : userData.message,
3086
3056
  },
3087
3057
  });
3088
3058
  };
@@ -3153,6 +3123,54 @@ var StentorRouterChat = /** @class */ (function () {
3153
3123
  _this.dispatch(dismissWsButton(data.id));
3154
3124
  }, WS_BUTTON_DISMISS_ANIMATION_DURATION);
3155
3125
  };
3126
+ this.handlers["system-message"] = function (data, sender, ts, _attributes) {
3127
+ log("Received \"system-message\" event - id: ".concat(data.id, ", message: ").concat(data.message, ", dismissId: ").concat(data.dismissId));
3128
+ // If there's a dismissId, dispatch dismiss action first
3129
+ if (data.dismissId) {
3130
+ _this.dispatch({
3131
+ type: "chat",
3132
+ detail: {
3133
+ type: "chat.systemmessagedismiss",
3134
+ user: {
3135
+ displayName: sender.displayName || "System",
3136
+ nick: senderToNick(sender),
3137
+ },
3138
+ id: data.dismissId,
3139
+ timestamp: ts || new Date().getTime(),
3140
+ },
3141
+ });
3142
+ }
3143
+ // Then dispatch the new system message
3144
+ _this.dispatch({
3145
+ type: "chat",
3146
+ detail: {
3147
+ type: "chat.systemmessage",
3148
+ user: {
3149
+ displayName: sender.displayName || "System",
3150
+ nick: senderToNick(sender),
3151
+ },
3152
+ id: data.id,
3153
+ message: data.message,
3154
+ dismissId: data.dismissId,
3155
+ timestamp: ts || new Date().getTime(),
3156
+ },
3157
+ });
3158
+ };
3159
+ this.handlers["system-message-dismiss"] = function (data, sender, ts, _attributes) {
3160
+ log("Received \"system-message-dismiss\" event - id: ".concat(data.id));
3161
+ _this.dispatch({
3162
+ type: "chat",
3163
+ detail: {
3164
+ type: "chat.systemmessagedismiss",
3165
+ user: {
3166
+ displayName: sender.displayName || "System",
3167
+ nick: senderToNick(sender),
3168
+ },
3169
+ id: data.id,
3170
+ timestamp: ts || new Date().getTime(),
3171
+ },
3172
+ });
3173
+ };
3156
3174
  // Register the router as a pseudo-agent (serverInfo) so it can send messages (like internal errors)
3157
3175
  this.dispatch({
3158
3176
  type: "chat",
@@ -7727,7 +7745,7 @@ var StentorServerChat = /** @class */ (function () {
7727
7745
  type: "chat.memberjoin",
7728
7746
  user: {
7729
7747
  displayName: data.username,
7730
- nick: "agent:robot",
7748
+ nick: data.nick || "agent:robot",
7731
7749
  avatarPath: data.avatarPath
7732
7750
  },
7733
7751
  timestamp: +new Date(),
@@ -7886,7 +7904,7 @@ function useChatServer(config, options) {
7886
7904
  var dispatch = useChatDispatch();
7887
7905
  var deps = [options, config, dispatch];
7888
7906
  // Track previous values to detect what changed
7889
- var prevDepsRef = useRef();
7907
+ var prevDepsRef = useRef(undefined);
7890
7908
  // Log what caused the "effect"
7891
7909
  // useWhatChanged(deps, "options, config, dispatch");
7892
7910
  useEffect(function () {
@@ -7959,17 +7977,16 @@ var ChatChipsContainer = function (_) {
7959
7977
  }));
7960
7978
  }
7961
7979
  }
7962
- return (React$1.createElement("div", { className: "message-list-container__chips ".concat(!(chips === null || chips === void 0 ? void 0 : chips.length) ? "message-list-container__chips--empty" : "") },
7963
- React$1.createElement(ChatChips, { options: chips, onOptionClick: optionOnChange })));
7980
+ return (jsx("div", { className: "message-list-container__chips ".concat(!(chips === null || chips === void 0 ? void 0 : chips.length) ? "message-list-container__chips--empty" : ""), children: jsx(ChatChips, { options: chips, onOptionClick: optionOnChange }) }));
7964
7981
  };
7965
7982
 
7966
7983
  var ButtonGroup = function (_a) {
7967
7984
  var children = _a.children, _b = _a.className, className = _b === void 0 ? "" : _b;
7968
- return (React$1.createElement("div", { className: "button-group ".concat(className) }, children));
7985
+ return (jsx("div", { className: "button-group ".concat(className), children: children }));
7969
7986
  };
7970
7987
 
7971
7988
  var CancelButton = function (props) {
7972
- return (React$1.createElement("div", { id: "xapp-widget-close", "aria-label": "close widget", "aria-hidden": false, tabIndex: props.tabIndex ? Number(props.tabIndex) : 0, className: "cancel-button", onClick: props.onClick }));
7989
+ return (jsx("div", { id: "xapp-widget-close", "aria-label": "close widget", "aria-hidden": false, tabIndex: props.tabIndex ? Number(props.tabIndex) : 0, className: "cancel-button", onClick: props.onClick }));
7973
7990
  };
7974
7991
 
7975
7992
  var lib = {};
@@ -8054,10 +8071,8 @@ var ChatMenuItem = function (props) {
8054
8071
  props.onClick(props.label);
8055
8072
  }
8056
8073
  }
8057
- var content = props.subtitle ? (React$1.createElement("span", null,
8058
- React$1.createElement("div", null, props.label),
8059
- React$1.createElement("div", { className: "chat-menu-item--subtitle" }, props.subtitle))) : (React$1.createElement("span", null, props.label));
8060
- return (React$1.createElement("button", { type: "button", className: "chat-menu-item", tabIndex: props.tabIndex ? Number(props.tabIndex) : 0, onClick: handleClick }, content));
8074
+ var content = props.subtitle ? (jsxs("span", { children: [jsx("div", { children: props.label }), jsx("div", { className: "chat-menu-item--subtitle", children: props.subtitle })] })) : (jsx("span", { children: props.label }));
8075
+ return (jsx("button", { type: "button", className: "chat-menu-item", tabIndex: props.tabIndex ? Number(props.tabIndex) : 0, onClick: handleClick, children: content }));
8061
8076
  };
8062
8077
 
8063
8078
  var _this = undefined;
@@ -8067,28 +8082,24 @@ var ChatMenu = function (props) {
8067
8082
  var handleOpenUrl = useOpenUrlCallback();
8068
8083
  var chatDispatch = useChatDispatch();
8069
8084
  var visuals = useSelector(function (state) { return state.visuals; });
8070
- return (React$1.createElement("div", { className: "chat-menu-".concat(openFrom, " ").concat(opened ? "chat-menu-".concat(openFrom, "--opened") : "chat-menu-".concat(openFrom, "--closed")) }, items.map(function (item, i) {
8071
- if (lib.isStandardMenuItem(item)) {
8072
- return React$1.createElement(ChatMenuItem, { key: i, onClick: props.onItemClick, label: item.label, subtitle: item.subtitle });
8073
- }
8074
- else if (lib.isStaticImageMenuItem(item)) {
8075
- return (React$1.createElement("div", { key: i, className: "chat-menu-item-static" },
8076
- React$1.createElement("img", { style: {
8077
- maxHeight: "100%",
8078
- maxWidth: "auto"
8079
- }, src: item.imageUrl, alt: "Menu Item" })));
8080
- }
8081
- else if (lib.isStaticTextMenuItem(item)) {
8082
- return (React$1.createElement("div", { key: i, className: "chat-menu-item-static-text" },
8083
- React$1.createElement("div", null,
8084
- React$1.createElement("div", null, item.title),
8085
- React$1.createElement("div", { className: "chat-menu-item-static-text--body" }, item.body))));
8086
- }
8087
- else if (lib.isOpenURLMenuItem(item)) {
8088
- return React$1.createElement("button", { key: i, className: "chat-menu-item", onClick: handleOpenUrl.bind(_this, item.url, chatDispatch, visuals, item.behavior) }, item.text);
8089
- }
8090
- return React$1.createElement("p", null, "Unknown");
8091
- })));
8085
+ return (jsx("div", { className: "chat-menu-".concat(openFrom, " ").concat(opened ? "chat-menu-".concat(openFrom, "--opened") : "chat-menu-".concat(openFrom, "--closed")), children: items.map(function (item, i) {
8086
+ if (lib.isStandardMenuItem(item)) {
8087
+ return (jsx(ChatMenuItem, { onClick: props.onItemClick, label: item.label, subtitle: item.subtitle }, i));
8088
+ }
8089
+ else if (lib.isStaticImageMenuItem(item)) {
8090
+ return (jsx("div", { className: "chat-menu-item-static", children: jsx("img", { style: {
8091
+ maxHeight: "100%",
8092
+ maxWidth: "auto",
8093
+ }, src: item.imageUrl, alt: "Menu Item" }) }, i));
8094
+ }
8095
+ else if (lib.isStaticTextMenuItem(item)) {
8096
+ return (jsx("div", { className: "chat-menu-item-static-text", children: jsxs("div", { children: [jsx("div", { children: item.title }), jsx("div", { className: "chat-menu-item-static-text--body", children: item.body })] }) }, i));
8097
+ }
8098
+ else if (lib.isOpenURLMenuItem(item)) {
8099
+ return (jsx("button", { className: "chat-menu-item", onClick: handleOpenUrl.bind(_this, item.url, chatDispatch, visuals, item.behavior), children: item.text }, i));
8100
+ }
8101
+ return jsx("p", { children: "Unknown" });
8102
+ }) }));
8092
8103
  };
8093
8104
 
8094
8105
  var DrawerBars = function (props) {
@@ -8100,23 +8111,23 @@ var DrawerBars = function (props) {
8100
8111
  function getBars() {
8101
8112
  var barElements = [];
8102
8113
  for (var bar = 0; bar < bars; bar++) {
8103
- barElements.push(React$1.createElement("div", { key: "drawer-bar-".concat(bar), className: "drawer-bar bar".concat(bar) }));
8114
+ barElements.push(jsx("div", { className: "drawer-bar bar".concat(bar) }, "drawer-bar-".concat(bar)));
8104
8115
  }
8105
8116
  return barElements;
8106
8117
  }
8107
- return (React$1.createElement("button", { className: "drawer-bars", tabIndex: props.tabIndex ? Number(props.tabIndex) : 0, "aria-label": "open menu", "aria-hidden": false, onClick: props.onToggle }, getBars()));
8118
+ return (jsx("button", { className: "drawer-bars", tabIndex: props.tabIndex ? Number(props.tabIndex) : 0, "aria-label": "open menu", "aria-hidden": false, onClick: props.onToggle, children: getBars() }));
8108
8119
  };
8109
8120
 
8110
8121
  var MenuButton = function (props) {
8111
- return (React$1.createElement("div", { id: "xapp-widget-menu", "aria-label": "open menu", "aria-hidden": false, tabIndex: props.tabIndex ? Number(props.tabIndex) : 0, className: "menu-button", onClick: props.onClick }));
8122
+ return (jsx("div", { id: "xapp-widget-menu", "aria-label": "open menu", "aria-hidden": false, tabIndex: props.tabIndex ? Number(props.tabIndex) : 0, className: "menu-button", onClick: props.onClick }));
8112
8123
  };
8113
8124
 
8114
8125
  var MinimizeButton = function (props) {
8115
- return (React$1.createElement("div", { id: "xapp-widget-minimize", "aria-label": "minimize widget", "aria-hidden": false, tabIndex: props.tabIndex ? Number(props.tabIndex) : 0, className: "minimize-button ".concat(props.showInRight ? "positionRight" : ""), onClick: props.onClick }));
8126
+ return (jsx("div", { id: "xapp-widget-minimize", "aria-label": "minimize widget", "aria-hidden": false, tabIndex: props.tabIndex ? Number(props.tabIndex) : 0, className: "minimize-button ".concat(props.showInRight ? "positionRight" : ""), onClick: props.onClick }));
8116
8127
  };
8117
8128
 
8118
8129
  var RefreshButton = function (props) {
8119
- return (React$1.createElement("div", { id: "xapp-widget-refresh", "aria-label": "refresh chat", "aria-hidden": false, tabIndex: props.tabIndex ? Number(props.tabIndex) : 0, className: "refresh-button ".concat(props.showInRight ? "positionRight" : props.showInLeft ? "positionLeft" : ""), onClick: props.onClick }));
8130
+ return (jsx("div", { id: "xapp-widget-refresh", "aria-label": "refresh chat", "aria-hidden": false, tabIndex: props.tabIndex ? Number(props.tabIndex) : 0, className: "refresh-button ".concat(props.showInRight ? "positionRight" : props.showInLeft ? "positionLeft" : ""), onClick: props.onClick }));
8120
8131
  };
8121
8132
 
8122
8133
  var DEFAULT_STATUS_CONFIG = {
@@ -8139,14 +8150,119 @@ function getStatusText(status, config) {
8139
8150
  return (_d = config === null || config === void 0 ? void 0 : config.connecting) !== null && _d !== void 0 ? _d : DEFAULT_STATUS_CONFIG.connecting;
8140
8151
  }
8141
8152
  }
8153
+ /**
8154
+ * Determines if a string contains HTML tags
8155
+ */
8156
+ function isHtmlString(text) {
8157
+ if (typeof text !== "string") {
8158
+ return false;
8159
+ }
8160
+ // Check for common HTML patterns
8161
+ var htmlPattern = /<\/?[a-z][\s\S]*>/i;
8162
+ return htmlPattern.test(text);
8163
+ }
8164
+ /**
8165
+ * Sanitizes HTML string by removing potentially dangerous elements and attributes
8166
+ */
8167
+ function sanitizeHtml(html) {
8168
+ try {
8169
+ // Check if DOMParser is available
8170
+ if (typeof DOMParser === "undefined") {
8171
+ log("DOMParser not available, returning text content only");
8172
+ return html.replace(/<[^>]*>/g, ""); // Strip all HTML tags as fallback
8173
+ }
8174
+ // Create a temporary DOM element to parse the HTML
8175
+ var doc_1 = new DOMParser().parseFromString(html, "text/html");
8176
+ // Check if parsing was successful
8177
+ if (!doc_1 || !doc_1.body) {
8178
+ log("DOMParser failed to parse HTML, returning text content only");
8179
+ return html.replace(/<[^>]*>/g, ""); // Strip all HTML tags as fallback
8180
+ }
8181
+ // List of allowed tags (whitelist approach)
8182
+ var allowedTags_1 = ["span", "div", "p", "strong", "em", "b", "i", "u", "br"];
8183
+ // List of allowed style properties
8184
+ var allowedStyleProps_1 = [
8185
+ "color", "background-color", "font-size", "font-weight", "font-style",
8186
+ "text-align", "display", "flex", "align-items", "justify-content",
8187
+ "gap", "margin", "padding", "width", "height", "border-radius"
8188
+ ];
8189
+ // Recursive function to clean nodes
8190
+ var cleanNode_1 = function (node) {
8191
+ if (node.nodeType === Node.ELEMENT_NODE) {
8192
+ var element_1 = node;
8193
+ var tagName = element_1.tagName.toLowerCase();
8194
+ // Remove if not in allowed tags, but preserve text content
8195
+ if (!allowedTags_1.includes(tagName)) {
8196
+ // Replace the element with its text content
8197
+ var textNode = doc_1.createTextNode(element_1.textContent || "");
8198
+ element_1.replaceWith(textNode);
8199
+ return;
8200
+ }
8201
+ // Remove all attributes except style
8202
+ var attributes = Array.from(element_1.attributes);
8203
+ attributes.forEach(function (attr) {
8204
+ if (attr.name !== "style") {
8205
+ element_1.removeAttribute(attr.name);
8206
+ }
8207
+ });
8208
+ // Clean style attribute - only allow safe properties
8209
+ if (element_1.hasAttribute("style")) {
8210
+ var styleText = element_1.getAttribute("style") || "";
8211
+ var cleanedStyles_1 = [];
8212
+ // Parse individual style properties
8213
+ styleText.split(";").forEach(function (declaration) {
8214
+ var _a = declaration.split(":"), prop = _a[0], valueParts = _a.slice(1);
8215
+ var value = valueParts.join(":").trim(); // Rejoin in case value contains colons
8216
+ var propTrimmed = prop.trim();
8217
+ if (propTrimmed && value && allowedStyleProps_1.includes(propTrimmed.toLowerCase())) {
8218
+ // Additional validation: ensure value doesn't contain javascript: or expression()
8219
+ if (!/javascript:|expression\(|@import|behavior:/i.test(value)) {
8220
+ cleanedStyles_1.push("".concat(propTrimmed, ": ").concat(value));
8221
+ }
8222
+ }
8223
+ });
8224
+ if (cleanedStyles_1.length > 0) {
8225
+ element_1.setAttribute("style", cleanedStyles_1.join("; "));
8226
+ }
8227
+ else {
8228
+ element_1.removeAttribute("style");
8229
+ }
8230
+ }
8231
+ // Recursively clean child nodes
8232
+ var children = Array.from(element_1.childNodes);
8233
+ children.forEach(function (child) { return cleanNode_1(child); });
8234
+ }
8235
+ };
8236
+ // Clean each child of the body, not the body itself
8237
+ Array.from(doc_1.body.childNodes).forEach(function (child) { return cleanNode_1(child); });
8238
+ return doc_1.body.innerHTML;
8239
+ }
8240
+ catch (error) {
8241
+ log("Error sanitizing HTML: ".concat(error));
8242
+ // Fallback: strip all HTML tags
8243
+ return html.replace(/<[^>]*>/g, "");
8244
+ }
8245
+ }
8246
+ /**
8247
+ * Safely renders subtitle text that can be plain text, JSX, or HTML string
8248
+ */
8249
+ function renderSubtitleText(text) {
8250
+ // If it's an HTML string, sanitize and render it using dangerouslySetInnerHTML
8251
+ if (isHtmlString(text)) {
8252
+ var sanitizedHtml = sanitizeHtml(text);
8253
+ return jsx("span", { dangerouslySetInnerHTML: { __html: sanitizedHtml } });
8254
+ }
8255
+ // Otherwise, render as-is (handles JSX and plain text)
8256
+ return text;
8257
+ }
8142
8258
  var refreshButtonAriaLabel = "To refresh chat click on clockwise gapped circle arrow icon in top right side of widget. ";
8143
8259
  var minimizeButtonAriaLabel = "To minimize widget click on minus icon in top right side of widget. ";
8144
8260
  var closeButtonAriaLabel = "To close widget click on close icon in top right side of widget.";
8145
8261
  var ChatHeader = function (props) {
8146
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
8262
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
8147
8263
  var innerDispatch = useChatDispatch();
8148
8264
  var menuConfig = props.menuConfig, onSubmit = props.onSubmit;
8149
- var _s = useState(false), drawerOpen = _s[0], setDrawerState = _s[1]; // false initially
8265
+ var _r = useState(false), drawerOpen = _r[0], setDrawerState = _r[1]; // false initially
8150
8266
  var menuPosition = (menuConfig === null || menuConfig === void 0 ? void 0 : menuConfig.menuButtonLocation) || "FOOTER";
8151
8267
  var showMenuLeft = menuPosition === "HEADER_LEFT";
8152
8268
  var showMenuRight = menuPosition === "HEADER_RIGHT";
@@ -8178,50 +8294,30 @@ var ChatHeader = function (props) {
8178
8294
  if (canCancel) {
8179
8295
  ariaLabel = "".concat(ariaLabel).concat(closeButtonAriaLabel);
8180
8296
  }
8181
- return (React$1.createElement(React$1.Fragment, null,
8182
- React$1.createElement("div", { className: "status-container background-header", "aria-label": ariaLabel, "aria-hidden": false },
8183
- showMenuLeft && menuItems.length ? (React$1.createElement(React$1.Fragment, null,
8184
- React$1.createElement("div", { className: "chat-footer__menu-icon" },
8185
- React$1.createElement(DrawerBars, { bars: 3, tabIndex: menuButtonTabIndex, onToggle: toggleDrawer })))) : (React$1.createElement(React$1.Fragment, null)),
8186
- ((_b = props === null || props === void 0 ? void 0 : props.agent) === null || _b === void 0 ? void 0 : _b.avatarPath) === undefined ? (React$1.createElement("div", null)) : (React$1.createElement("div", { className: "status-container__avatar" },
8187
- React$1.createElement(Avatar, { entity: props.agent }))),
8188
- React$1.createElement("div", { className: "\n ".concat("status-text", "\n ").concat(showMenuLeft && menuItems.length
8189
- ? "status-text-positionWithMenu"
8190
- : ((_c = props === null || props === void 0 ? void 0 : props.agent) === null || _c === void 0 ? void 0 : _c.avatarPath) === undefined
8191
- ? "status-text-positionLeftNoAvatar"
8192
- : "status-text-positionLeft", "\n ").concat(((_d = props.config) === null || _d === void 0 ? void 0 : _d.alignTextCenter)
8193
- ? "status-text-positionCenter"
8194
- : "", " \n ") },
8195
- React$1.createElement("span", { className: "status-text-title" }, getStatusText(props.accountStatus, (_e = props.config) === null || _e === void 0 ? void 0 : _e.status)),
8196
- ((_g = (_f = props.config) === null || _f === void 0 ? void 0 : _f.subtitle) === null || _g === void 0 ? void 0 : _g.enabled) && (React$1.createElement("span", { className: "status-text-subtitle" }, (_k = (_j = (_h = props.config) === null || _h === void 0 ? void 0 : _h.subtitle) === null || _j === void 0 ? void 0 : _j.text) !== null && _k !== void 0 ? _k : ""))),
8197
- React$1.createElement(ButtonGroup, null,
8198
- hasRightMenu && (React$1.createElement(MenuButton, { onClick: toggleDrawer, tabIndex: menuButtonTabIndex })),
8199
- props.canRefresh && (React$1.createElement(RefreshButton, { onClick: props.refreshOnClick, tabIndex: (_m = (_l = props.config) === null || _l === void 0 ? void 0 : _l.actions) === null || _m === void 0 ? void 0 : _m.refreshTabIndex, showInLeft: false, showInRight: false })),
8200
- props.canMinimize && (React$1.createElement(MinimizeButton, { onClick: props.minimizeOnClick, tabIndex: (_p = (_o = props.config) === null || _o === void 0 ? void 0 : _o.actions) === null || _p === void 0 ? void 0 : _p.minimizeTabIndex, showInRight: false })),
8201
- props.canCancel && (React$1.createElement(CancelButton, { onClick: props.cancelOnClick, tabIndex: (_r = (_q = props.config) === null || _q === void 0 ? void 0 : _q.actions) === null || _r === void 0 ? void 0 : _r.cancelTabIndex })))),
8202
- drawerOpen ? (React$1.createElement("div", { className: "xa-chat-menu-container" },
8203
- React$1.createElement(ChatMenu, { openFrom: showMenuRight ? "right" : "left", opened: drawerOpen, tabIndex: menuItemsTabIndex, onItemClick: handleMenuItem, items: menuItems }))) : (React$1.createElement(React$1.Fragment, null))));
8297
+ return (jsxs(Fragment, { children: [jsxs("div", { className: "status-container background-header", "aria-label": ariaLabel, "aria-hidden": false, children: [showMenuLeft && menuItems.length ? (jsx(Fragment, { children: jsx("div", { className: "chat-footer__menu-icon", children: jsx(DrawerBars, { bars: 3, tabIndex: menuButtonTabIndex, onToggle: toggleDrawer }) }) })) : (jsx(Fragment, {})), ((_b = props === null || props === void 0 ? void 0 : props.agent) === null || _b === void 0 ? void 0 : _b.avatarPath) === undefined ? (jsx("div", {})) : (jsx("div", { className: "status-container__avatar", children: jsx(Avatar, { entity: props.agent }) })), jsxs("div", { className: "\n ".concat("status-text", "\n ").concat(showMenuLeft && menuItems.length
8298
+ ? "status-text-positionWithMenu"
8299
+ : ((_c = props === null || props === void 0 ? void 0 : props.agent) === null || _c === void 0 ? void 0 : _c.avatarPath) === undefined
8300
+ ? "status-text-positionLeftNoAvatar"
8301
+ : "status-text-positionLeft", "\n ").concat(((_d = props.config) === null || _d === void 0 ? void 0 : _d.alignTextCenter)
8302
+ ? "status-text-positionCenter"
8303
+ : "", " \n "), children: [jsx("span", { className: "status-text-title", children: getStatusText(props.accountStatus, (_e = props.config) === null || _e === void 0 ? void 0 : _e.status) }), ((_g = (_f = props.config) === null || _f === void 0 ? void 0 : _f.subtitle) === null || _g === void 0 ? void 0 : _g.enabled) && (jsx("span", { className: "status-text-subtitle", children: renderSubtitleText((_j = (_h = props.config) === null || _h === void 0 ? void 0 : _h.subtitle) === null || _j === void 0 ? void 0 : _j.text) }))] }), jsxs(ButtonGroup, { children: [hasRightMenu && (jsx(MenuButton, { onClick: toggleDrawer, tabIndex: menuButtonTabIndex })), props.canRefresh && (jsx(RefreshButton, { onClick: props.refreshOnClick, tabIndex: (_l = (_k = props.config) === null || _k === void 0 ? void 0 : _k.actions) === null || _l === void 0 ? void 0 : _l.refreshTabIndex, showInLeft: false, showInRight: false })), props.canMinimize && (jsx(MinimizeButton, { onClick: props.minimizeOnClick, tabIndex: (_o = (_m = props.config) === null || _m === void 0 ? void 0 : _m.actions) === null || _o === void 0 ? void 0 : _o.minimizeTabIndex, showInRight: false })), props.canCancel && (jsx(CancelButton, { onClick: props.cancelOnClick, tabIndex: (_q = (_p = props.config) === null || _p === void 0 ? void 0 : _p.actions) === null || _q === void 0 ? void 0 : _q.cancelTabIndex }))] })] }), drawerOpen ? (jsx("div", { className: "xa-chat-menu-container", children: jsx(ChatMenu, { openFrom: showMenuRight ? "right" : "left", opened: drawerOpen, tabIndex: menuItemsTabIndex, onItemClick: handleMenuItem, items: menuItems }) })) : (jsx(Fragment, {}))] }));
8204
8304
  };
8205
8305
 
8206
- var UnknownMessage = function () { return React$1.createElement(React$1.Fragment, null); };
8306
+ var UnknownMessage = function () { return jsx(Fragment, {}); };
8207
8307
 
8208
8308
  function renderAvatar(entity) {
8209
- return (React$1.createElement("div", { className: "xappw-chat-msg-part__avatar" },
8210
- React$1.createElement(Avatar, { entity: entity })));
8309
+ return (jsx("div", { className: "xappw-chat-msg-part__avatar", children: jsx(Avatar, { entity: entity }) }));
8211
8310
  }
8212
8311
  var ChatMessagePart = function (props) {
8213
8312
  var _a;
8214
8313
  var position = (_a = props.avatarPosition) !== null && _a !== void 0 ? _a : "left";
8215
8314
  var containerClass = "xappw-chat-msg-part" +
8216
- (position === "below" ? " xappw-chat-msg-part--avatar-below" : "");
8217
- var user = props.user;
8218
- return (React$1.createElement("div", { className: containerClass }, position === "left" ? (React$1.createElement(React$1.Fragment, null,
8219
- props.showAvatar && renderAvatar(user),
8220
- props.children)) : (React$1.createElement(React$1.Fragment, null,
8221
- props.children,
8222
- props.showAvatar && (React$1.createElement("div", { className: "xappw-chat-msg-part__avatar-wrapper" },
8223
- renderAvatar(user),
8224
- (user === null || user === void 0 ? void 0 : user.displayName) && (React$1.createElement("div", { className: "xappw-chat-msg-part__avatar-name" }, user.displayName))))))));
8315
+ (position === "below" ? " xappw-chat-msg-part--avatar-below" : "") +
8316
+ (position === "bottom" ? " xappw-chat-msg-part--avatar-bottom" : "");
8317
+ var user = props.user, hideUserInfo = props.hideUserInfo;
8318
+ // Hide user info if hideUserInfo is true and position is "bottom"
8319
+ var shouldHideUserInfo = hideUserInfo && position === "bottom";
8320
+ return (jsx("div", { className: containerClass, children: position === "left" ? (jsxs(Fragment, { children: [props.showAvatar && renderAvatar(user), props.children] })) : (jsxs(Fragment, { children: [props.children, props.showAvatar && !shouldHideUserInfo && (jsxs("div", { className: "xappw-chat-msg-part__avatar-wrapper", children: [renderAvatar(user), (user === null || user === void 0 ? void 0 : user.displayName) && (jsx("div", { className: "xappw-chat-msg-part__avatar-name", children: user.displayName }))] }))] })) }));
8225
8321
  };
8226
8322
 
8227
8323
  function useExecuteActionCallback() {
@@ -8272,14 +8368,12 @@ var CardMiddlewareWidget = function (props) {
8272
8368
  var card = useMemo(function () { return convertFromCardDisplay(msg); }, [msg]);
8273
8369
  var user = ctx.user;
8274
8370
  var handleButton = useButtonCallback();
8275
- return (React$1.createElement(ChatMessagePart, { showAvatar: true, user: user },
8276
- React$1.createElement("div", { className: "chat-msg" },
8277
- React$1.createElement(ChatCard, { card: card, onButtonClick: handleButton }))));
8371
+ return (jsx(ChatMessagePart, { showAvatar: true, user: user, children: jsx("div", { className: "chat-msg", children: jsx(ChatCard, { card: card, onButtonClick: handleButton }) }) }));
8278
8372
  };
8279
8373
  var CardMiddleware = function (next) { return function (props) {
8280
8374
  var msg = props.msg, ctx = props.ctx;
8281
8375
  if (isCard(msg)) {
8282
- return React$1.createElement(CardMiddlewareWidget, { msg: msg, ctx: ctx });
8376
+ return jsx(CardMiddlewareWidget, { msg: msg, ctx: ctx });
8283
8377
  }
8284
8378
  return next(props);
8285
8379
  }; };
@@ -8363,16 +8457,14 @@ function useLateMiddleware() {
8363
8457
  }
8364
8458
 
8365
8459
  function getSvg() {
8366
- return (React$1.createElement("svg", { viewBox: "0 0 20 20" },
8367
- React$1.createElement("path", { d: "M17 17H3V3h5V1H3a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-5h-2z" }),
8368
- React$1.createElement("path", { d: "M19 1h-8l3.29 3.29-5.73 5.73 1.42 1.42 5.73-5.73L19 9V1z" })));
8460
+ return (jsxs("svg", { viewBox: "0 0 20 20", children: [jsx("path", { d: "M17 17H3V3h5V1H3a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-5h-2z" }), jsx("path", { d: "M19 1h-8l3.29 3.29-5.73 5.73 1.42 1.42 5.73-5.73L19 9V1z" })] }));
8369
8461
  }
8370
8462
  var ExternalLink = function (props) {
8371
8463
  var url = props.url;
8372
8464
  var handleClick = useCallback(function (ev) {
8373
8465
  ev.preventDefault();
8374
8466
  }, []);
8375
- return (React$1.createElement("a", { href: url, "aria-label": "read more", target: "_blank", rel: "noreferrer", className: props.className, onClick: handleClick }, getSvg()));
8467
+ return (jsx("a", { href: url, "aria-label": "read more", target: "_blank", rel: "noreferrer", className: props.className, onClick: handleClick, children: getSvg() }));
8376
8468
  };
8377
8469
 
8378
8470
  function firstIndex(val, patterns) {
@@ -8485,7 +8577,7 @@ var SmartLink = function (props) {
8485
8577
  var handleClick = useCallback(function (ev) {
8486
8578
  ev.preventDefault();
8487
8579
  }, []);
8488
- return (React$1.createElement("a", { href: url, "aria-label": "read more", target: "_blank", rel: "noreferrer", className: className, onClick: handleClick }, reduceLink(url, 40)));
8580
+ return (jsx("a", { href: url, "aria-label": "read more", target: "_blank", rel: "noreferrer", className: className, onClick: handleClick, children: reduceLink(url, 40) }));
8489
8581
  };
8490
8582
 
8491
8583
  var ListItem = function (props) {
@@ -8493,18 +8585,7 @@ var ListItem = function (props) {
8493
8585
  var item = props.item;
8494
8586
  var layout = props.layout || "normal";
8495
8587
  var url = item.url || item.imageActionUrl;
8496
- return (React$1.createElement(ActionItem, { className: "xappw-vlist-item-container", item: item, onButtonClick: props.onButtonClick, onExecute: props.onExecute, onOpenUrl: props.onOpenUrl },
8497
- React$1.createElement("div", { className: "xappw-vlist-item xappw-vlist-item--".concat(layout) },
8498
- React$1.createElement("div", { className: "xappw-vlist-item__description" },
8499
- item.title && React$1.createElement("div", { className: "xappw-vlist-item__title" },
8500
- React$1.createElement("span", null, item.title)),
8501
- url && React$1.createElement(SmartLink, { url: url, className: "xappw-vlist-item__link" }),
8502
- item.subTitle && React$1.createElement("div", { className: "xappw-vlist-item__subtitle" },
8503
- React$1.createElement("span", null, item.subTitle)),
8504
- !!((_a = item.buttons) === null || _a === void 0 ? void 0 : _a.length) && React$1.createElement(ChatActionButtons, { buttons: item.buttons, onClick: props.onButtonClick })),
8505
- React$1.createElement("div", { className: "xappw-vlist-item__side" },
8506
- url && React$1.createElement(ExternalLink, { url: "url", className: "xappw-vlist-item__external-link" }),
8507
- React$1.createElement(ActionItemImage, { item: item, className: "xappw-vlist-item__img", emptyImageVisible: props.emptyImageVisible })))));
8588
+ return (jsx(ActionItem, { className: "xappw-vlist-item-container", item: item, onButtonClick: props.onButtonClick, onExecute: props.onExecute, onOpenUrl: props.onOpenUrl, children: jsxs("div", { className: "xappw-vlist-item xappw-vlist-item--".concat(layout), children: [jsxs("div", { className: "xappw-vlist-item__description", children: [item.title && (jsx("div", { className: "xappw-vlist-item__title", children: jsx("span", { children: item.title }) })), url && jsx(SmartLink, { url: url, className: "xappw-vlist-item__link" }), item.subTitle && (jsx("div", { className: "xappw-vlist-item__subtitle", children: jsx("span", { children: item.subTitle }) })), !!((_a = item.buttons) === null || _a === void 0 ? void 0 : _a.length) && (jsx(ChatActionButtons, { buttons: item.buttons, onClick: props.onButtonClick }))] }), jsxs("div", { className: "xappw-vlist-item__side", children: [url && jsx(ExternalLink, { url: "url", className: "xappw-vlist-item__external-link" }), jsx(ActionItemImage, { item: item, className: "xappw-vlist-item__img", emptyImageVisible: props.emptyImageVisible })] })] }) }));
8508
8589
  };
8509
8590
 
8510
8591
  var List = function (props) {
@@ -8513,13 +8594,9 @@ var List = function (props) {
8513
8594
  var hasImage = list.items.some(function (item) { return item.imageUrl; });
8514
8595
  var titlesOnly = !list.items.some(function (item) { var _a; return item.subTitle || ((_a = item.buttons) === null || _a === void 0 ? void 0 : _a.length); });
8515
8596
  var listItems = list.items.map(function (item, itemIndex) {
8516
- return (React$1.createElement("div", { className: "xappw-vlist-container__item", key: "item-key-".concat(itemIndex) },
8517
- React$1.createElement(ListItem, { item: item, layout: titlesOnly ? "titles" : "normal", emptyImageVisible: hasImage, onExecute: props.onExecute, onButtonClick: props.onButtonClick, onOpenUrl: props.onOpenUrl })));
8597
+ return (jsx("div", { className: "xappw-vlist-container__item", children: jsx(ListItem, { item: item, layout: titlesOnly ? "titles" : "normal", emptyImageVisible: hasImage, onExecute: props.onExecute, onButtonClick: props.onButtonClick, onOpenUrl: props.onOpenUrl }) }, "item-key-".concat(itemIndex)));
8518
8598
  });
8519
- return (React$1.createElement("div", { className: "xappw-vlist" },
8520
- React$1.createElement("div", { ref: listRef, className: "xappw-vlist-container" },
8521
- props.list.title && React$1.createElement("div", { className: "xappw-vlist__header" }, props.list.title),
8522
- listItems)));
8599
+ return (jsx("div", { className: "xappw-vlist", children: jsxs("div", { ref: listRef, className: "xappw-vlist-container", children: [props.list.title && jsx("div", { className: "xappw-vlist__header", children: props.list.title }), listItems] }) }));
8523
8600
  };
8524
8601
 
8525
8602
  var ListMiddlewareWidget = function (props) {
@@ -8534,16 +8611,12 @@ var ListMiddlewareWidget = function (props) {
8534
8611
  }, [executeActionCallback]);
8535
8612
  var handleButton = useButtonCallback();
8536
8613
  var user = ctx.user;
8537
- return (React$1.createElement(ChatMessagePart, { showAvatar: false, user: user },
8538
- list.type === "CAROUSEL" && (React$1.createElement("div", { className: "chat-msg chat-msg--fullwidth chat-msg--no-ava" },
8539
- React$1.createElement(Carousel, { list: list, onExecute: handleExecute.bind(null, "carousel"), onButtonClick: handleButton, onOpenUrl: ctx.openUrl }))),
8540
- list.type === "LIST" && (React$1.createElement("div", { className: "chat-msg chat-msg--expand" },
8541
- React$1.createElement(List, { list: list, onExecute: handleExecute.bind(null, "list"), onButtonClick: handleButton, onOpenUrl: ctx.openUrl })))));
8614
+ return (jsxs(ChatMessagePart, { showAvatar: false, user: user, children: [list.type === "CAROUSEL" && (jsx("div", { className: "chat-msg chat-msg--fullwidth chat-msg--no-ava", children: jsx(Carousel, { list: list, onExecute: handleExecute.bind(null, "carousel"), onButtonClick: handleButton, onOpenUrl: ctx.openUrl }) })), list.type === "LIST" && (jsx("div", { className: "chat-msg chat-msg--expand", children: jsx(List, { list: list, onExecute: handleExecute.bind(null, "list"), onButtonClick: handleButton, onOpenUrl: ctx.openUrl }) }))] }));
8542
8615
  };
8543
8616
  var ListMiddleware = function (next) { return function (props) {
8544
8617
  var msg = props.msg, ctx = props.ctx;
8545
8618
  if (isList(msg)) {
8546
- return React$1.createElement(ListMiddlewareWidget, { msg: msg, ctx: ctx });
8619
+ return jsx(ListMiddlewareWidget, { msg: msg, ctx: ctx });
8547
8620
  }
8548
8621
  return next(props);
8549
8622
  }; };
@@ -8555,10 +8628,7 @@ var MultiSelect = function (props) {
8555
8628
  var id = ev.target.value;
8556
8629
  onChange(__assign(__assign({}, checked), (_a = {}, _a[id] = !checked[id], _a)));
8557
8630
  }, [checked, onChange]);
8558
- return (React$1.createElement("ul", { className: "xappw-multiselect" }, items === null || items === void 0 ? void 0 : items.map(function (item) { return (React$1.createElement("li", { key: item.id },
8559
- React$1.createElement("label", null,
8560
- React$1.createElement("input", { type: "checkbox", checked: checked[item.id] || false, onChange: handleToggle, value: item.id }),
8561
- React$1.createElement("span", null, item.title)))); })));
8631
+ return (jsx("ul", { className: "xappw-multiselect", children: items === null || items === void 0 ? void 0 : items.map(function (item) { return (jsx("li", { children: jsxs("label", { children: [jsx("input", { type: "checkbox", checked: checked[item.id] || false, onChange: handleToggle, value: item.id }), jsx("span", { children: item.title })] }) }, item.id)); }) }));
8562
8632
  };
8563
8633
 
8564
8634
  function isMultiSelect(display) {
@@ -8578,20 +8648,16 @@ var MultiSelectMiddlewareWidget = function (props) {
8578
8648
  payload: JSON.stringify({
8579
8649
  type: "OPTION_SELECT_REQUEST",
8580
8650
  intentId: "OptionSelect",
8581
- selected: Object.keys(checked).map(function (k) { return ({ id: k }); })
8582
- })
8651
+ selected: Object.keys(checked).map(function (k) { return ({ id: k }); }),
8652
+ }),
8583
8653
  });
8584
8654
  }, [ctx, checked]);
8585
- return (React$1.createElement(ChatMessagePart, { showAvatar: true, user: user },
8586
- React$1.createElement("div", { className: "chat-msg" },
8587
- React$1.createElement("div", null,
8588
- React$1.createElement(MultiSelect, { items: items, checked: checked, onChange: setChecked }),
8589
- React$1.createElement(ActionButton, { label: "Submit", onClick: handleSubmit })))));
8655
+ return (jsx(ChatMessagePart, { showAvatar: true, user: user, children: jsx("div", { className: "chat-msg", children: jsxs("div", { children: [jsx(MultiSelect, { items: items, checked: checked, onChange: setChecked }), jsx(ActionButton, { label: "Submit", onClick: handleSubmit })] }) }) }));
8590
8656
  };
8591
8657
  var MultiSelectMiddleware = function (next) { return function (props) {
8592
8658
  var msg = props.msg, ctx = props.ctx;
8593
8659
  if (isMultiSelect(msg)) {
8594
- return React$1.createElement(MultiSelectMiddlewareWidget, { msg: msg, ctx: ctx });
8660
+ return jsx(MultiSelectMiddlewareWidget, { msg: msg, ctx: ctx });
8595
8661
  }
8596
8662
  return next(props);
8597
8663
  }; };
@@ -8621,8 +8687,7 @@ function getTailSvgPath(owner) {
8621
8687
  return "m 0 0 v 240 h 60 c -40 -40 -60 -160 -60 -240";
8622
8688
  }
8623
8689
  function getTailSvg(owner) {
8624
- return (React$1.createElement("svg", { className: "chat-text-bubble__tail", xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 80 240" },
8625
- React$1.createElement("path", { d: getTailSvgPath(owner), fill: "currentColor" })));
8690
+ return (jsx("svg", { className: "chat-text-bubble__tail", xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 80 240", children: jsx("path", { d: getTailSvgPath(owner), fill: "currentColor" }) }));
8626
8691
  }
8627
8692
  var ChatMessageBubble = function (props) {
8628
8693
  var owner = props.owner, onClick = props.onClick;
@@ -8631,15 +8696,13 @@ var ChatMessageBubble = function (props) {
8631
8696
  onClick();
8632
8697
  }
8633
8698
  }, [onClick]);
8634
- return (React$1.createElement("div", { onClick: handleClick, className: "chat-text-bubble ".concat(owner === "mine" ? "chat-text-bubble--mine" : "chat-text-bubble--others") },
8635
- (props.hasTail) && getTailSvg(owner),
8636
- props.children));
8699
+ return (jsxs("div", { onClick: handleClick, className: "chat-text-bubble ".concat(owner === "mine" ? "chat-text-bubble--mine" : "chat-text-bubble--others"), children: [props.hasTail && getTailSvg(owner), props.children] }));
8637
8700
  };
8638
8701
 
8639
8702
  var ChatMarkdownMessage = function (props) {
8640
8703
  var onOpenUrl = props.onOpenUrl;
8641
8704
  var agentMessage = isAgent(props.message.user.nick);
8642
- var ref = useRef();
8705
+ var ref = useRef(null);
8643
8706
  var chatDispatch = useChatDispatch();
8644
8707
  var visuals = useSelector(function (state) { return state.visuals; });
8645
8708
  var html = props.message.msg.html;
@@ -8667,11 +8730,7 @@ var ChatMarkdownMessage = function (props) {
8667
8730
  }
8668
8731
  return undefined;
8669
8732
  }, [ref, html, onOpenUrl, handleLinkClick]);
8670
- return (React$1.createElement("div", { className: "chat-msg" },
8671
- React$1.createElement("div", { className: "chat-text-container" },
8672
- React$1.createElement(ChatMessageBubble, { owner: agentMessage ? "others" : "mine", hasTail: agentMessage && !props.sibling },
8673
- React$1.createElement("span", { className: "message-sr-only" }, "at " + props.time + (agentMessage ? " the bot said" : " the user said")),
8674
- React$1.createElement("div", { ref: ref })))));
8733
+ return (jsx("div", { className: "chat-msg", children: jsx("div", { className: "chat-text-container", children: jsxs(ChatMessageBubble, { owner: agentMessage ? "others" : "mine", hasTail: agentMessage && !props.sibling, children: [jsx("span", { className: "message-sr-only", children: "at " + props.time + (agentMessage ? " the bot said" : " the user said") }), jsx("div", { ref: ref })] }) }) }));
8675
8734
  };
8676
8735
 
8677
8736
  var ChatPermissionMessage = function (props) {
@@ -8689,14 +8748,14 @@ var ChatPermissionMessage = function (props) {
8689
8748
  ctx.write({
8690
8749
  type: "msg",
8691
8750
  user: author,
8692
- msg: msg
8751
+ msg: msg,
8693
8752
  });
8694
8753
  }, [ctx, author]);
8695
8754
  var writeAsUser = useCallback(function (msg) {
8696
8755
  ctx.write({
8697
8756
  type: "msg",
8698
8757
  user: user,
8699
- msg: msg
8758
+ msg: msg,
8700
8759
  });
8701
8760
  }, [ctx, user]);
8702
8761
  var handleFail = useCallback(function () {
@@ -8704,28 +8763,30 @@ var ChatPermissionMessage = function (props) {
8704
8763
  type: "msg",
8705
8764
  user: undefined,
8706
8765
  msg: {
8707
- text: denyLabel
8708
- }
8766
+ text: denyLabel,
8767
+ },
8709
8768
  });
8710
8769
  }, [ctx]);
8711
8770
  var handleSend = useCallback(function (msg) {
8712
8771
  ctx.send({
8713
8772
  type: "permissionGrant",
8714
8773
  user: author,
8715
- msg: msg
8774
+ msg: msg,
8716
8775
  });
8717
8776
  }, [author, ctx]);
8718
8777
  var handleResult = useCallback(function (position, userMsg) {
8719
8778
  handleSend({
8720
8779
  text: userMsg,
8721
- location: position ? {
8722
- latitude: position.coords.latitude,
8723
- longitude: position.coords.longitude
8724
- } : undefined,
8725
- permissionRequest: permissionRequest
8780
+ location: position
8781
+ ? {
8782
+ latitude: position.coords.latitude,
8783
+ longitude: position.coords.longitude,
8784
+ }
8785
+ : undefined,
8786
+ permissionRequest: permissionRequest,
8726
8787
  });
8727
8788
  writeAsUser({
8728
- text: userMsg
8789
+ text: userMsg,
8729
8790
  });
8730
8791
  var agentMsg = position ? permissionRequest === null || permissionRequest === void 0 ? void 0 : permissionRequest.approve : permissionRequest === null || permissionRequest === void 0 ? void 0 : permissionRequest.deny;
8731
8792
  if (agentMsg) {
@@ -8745,25 +8806,17 @@ var ChatPermissionMessage = function (props) {
8745
8806
  }
8746
8807
  }, [handleFail, handleResult]);
8747
8808
  if (!permissionRequest) {
8748
- return React$1.createElement(React$1.Fragment, null);
8809
+ return jsx(Fragment, {});
8749
8810
  }
8750
- return (React$1.createElement("div", { className: "chat-msg" },
8751
- React$1.createElement("span", { className: "message-sr-only" }, "at " + props.time + (agentMessage ? " the bot said" : " the user said")),
8752
- React$1.createElement("div", { className: "buttons-container" },
8753
- React$1.createElement(ActionButton, { label: allowLabel, addClass: "button", onClick: handleAllow }),
8754
- React$1.createElement(ActionButton, { label: denyLabel, addClass: "button", onClick: handleDeny }))));
8811
+ return (jsxs("div", { className: "chat-msg", children: [jsx("span", { className: "message-sr-only", children: "at " + props.time + (agentMessage ? " the bot said" : " the user said") }), jsxs("div", { className: "buttons-container", children: [jsx(ActionButton, { label: allowLabel, addClass: "button", onClick: handleAllow }), jsx(ActionButton, { label: denyLabel, addClass: "button", onClick: handleDeny })] })] }));
8755
8812
  };
8756
8813
 
8757
8814
  var ChatTextMessage = function (props) {
8758
8815
  var message = props.message;
8759
8816
  var date = new Date(message.timestamp);
8760
- var time = date.getHours() + ':' + date.getMinutes();
8817
+ var time = date.getHours() + ":" + date.getMinutes();
8761
8818
  var agentMessage = isAgent(props.message.user.nick);
8762
- return (React$1.createElement("div", { className: "chat-msg" },
8763
- React$1.createElement("div", { className: "chat-text-container" },
8764
- React$1.createElement(ChatMessageBubble, { owner: agentMessage ? "others" : "mine", hasTail: agentMessage && !props.sibling },
8765
- React$1.createElement("span", { className: "message-sr-only" }, "at " + time + (agentMessage ? " the bot said" : " the user said")),
8766
- React$1.createElement("span", null, message.msg.text)))));
8819
+ return (jsx("div", { className: "chat-msg", children: jsx("div", { className: "chat-text-container", children: jsxs(ChatMessageBubble, { owner: agentMessage ? "others" : "mine", hasTail: agentMessage && !props.sibling, children: [jsx("span", { className: "message-sr-only", children: "at " + time + (agentMessage ? " the bot said" : " the user said") }), jsx("span", { children: message.msg.text })] }) }) }));
8767
8820
  };
8768
8821
 
8769
8822
  var ChatScheduleWidget = function (props) {
@@ -8774,10 +8827,7 @@ var ChatScheduleWidget = function (props) {
8774
8827
  function handleClick() {
8775
8828
  openUrl(scheduleWidgetUrl, chatDispatch, visuals);
8776
8829
  }
8777
- return (React$1.createElement("div", { className: "chat-schedule-button-container" },
8778
- React$1.createElement("button", { className: "chat-schedule-button", onClick: handleClick },
8779
- React$1.createElement("i", { className: "fa fa-lg fa-calendar" }),
8780
- React$1.createElement("span", null, display.label || "Schedule Now!"))));
8830
+ return (jsx("div", { className: "chat-schedule-button-container", children: jsxs("button", { className: "chat-schedule-button", onClick: handleClick, children: [jsx("i", { className: "fa fa-lg fa-calendar" }), jsx("span", { children: display.label || "Schedule Now!" })] }) }));
8781
8831
  };
8782
8832
 
8783
8833
  function getClassName(msg) {
@@ -8791,13 +8841,17 @@ var avaKeys = ["text", "html", "card", "list"];
8791
8841
  * @returns
8792
8842
  */
8793
8843
  var ChatMessage = function (props) {
8844
+ var _a;
8794
8845
  var middleware = props.messageMiddleware || StandardMiddlewares;
8795
8846
  var chatConfig = useContext(ChatConfigContext);
8796
8847
  // console.log(`########### chatConfig: ${JSON.stringify(chatConfig, null, 2)}`);
8797
8848
  var ctx = props.middlewareContext;
8798
8849
  var user = props.agent;
8850
+ // Get hideUserInfo from the agent info based on the message sender's nick
8851
+ var agentInfo = (_a = props.agents) === null || _a === void 0 ? void 0 : _a[props.message.user.nick];
8852
+ var hideUserInfo = (agentInfo === null || agentInfo === void 0 ? void 0 : agentInfo.hideUserInfo) || false;
8799
8853
  function renderByType() {
8800
- var _a;
8854
+ var _a, _b, _c, _d;
8801
8855
  var msg = props.message.msg;
8802
8856
  switch (props.message.type) {
8803
8857
  // TODO: props actually requires it to be "chat.msg". Fix prop typing?
@@ -8805,38 +8859,27 @@ var ChatMessage = function (props) {
8805
8859
  // Here is the deal. If we have text (output speech), then text - card - list - options
8806
8860
  // OR card OR list only. Avatar with text bubble.
8807
8861
  var avaKey = avaKeys.find(function (key) { return !!msg[key]; });
8808
- return (React$1.createElement(React$1.Fragment, null,
8809
- msg.text &&
8810
- React$1.createElement(ChatMessagePart, { showAvatar: avaKey === "text", user: user, avatarPosition: chatConfig.env.theme.messages.avatarPosition },
8811
- React$1.createElement(ChatTextMessage, { message: props.message, sibling: props.sibling })),
8812
- msg.html &&
8813
- React$1.createElement(ChatMessagePart, { showAvatar: avaKey === "html", user: user, avatarPosition: chatConfig.env.theme.messages.avatarPosition },
8814
- React$1.createElement(ChatMarkdownMessage, { message: props.message, sibling: props.sibling, onOpenUrl: (_a = props.middlewareContext) === null || _a === void 0 ? void 0 : _a.openUrl })),
8815
- msg.displays && middleware && msg.displays.map(function (display, index) {
8816
- if (display.type === "ScheduleButton") {
8817
- return (React$1.createElement(ChatScheduleWidget, { minimizeOnClick: props.minimizeOnClick, display: display }));
8818
- }
8819
- var Middleware = middleware;
8820
- return (React$1.createElement(Middleware, { key: index, msg: display, ctx: props.middlewareContext }));
8821
- }),
8822
- msg.permissionRequest && ctx &&
8823
- React$1.createElement(ChatMessagePart, { showAvatar: avaKey === "permissionRequest", user: user, avatarPosition: chatConfig.env.theme.messages.avatarPosition },
8824
- React$1.createElement(ChatPermissionMessage, { message: props.message, sibling: props.sibling, ctx: ctx }))));
8862
+ return (jsxs(Fragment, { children: [msg.text &&
8863
+ jsx(ChatMessagePart, { showAvatar: avaKey === "text", user: user, avatarPosition: (_a = chatConfig.env.theme.messages) === null || _a === void 0 ? void 0 : _a.avatarPosition, hideUserInfo: hideUserInfo, children: jsx(ChatTextMessage, { message: props.message, sibling: props.sibling }) }), msg.html &&
8864
+ jsx(ChatMessagePart, { showAvatar: avaKey === "html", user: user, avatarPosition: (_b = chatConfig.env.theme.messages) === null || _b === void 0 ? void 0 : _b.avatarPosition, hideUserInfo: hideUserInfo, children: jsx(ChatMarkdownMessage, { message: props.message, sibling: props.sibling, onOpenUrl: (_c = props.middlewareContext) === null || _c === void 0 ? void 0 : _c.openUrl }) }), msg.displays && middleware && msg.displays.map(function (display, index) {
8865
+ if (display.type === "ScheduleButton") {
8866
+ return (jsx(ChatScheduleWidget, { minimizeOnClick: props.minimizeOnClick, display: display }));
8867
+ }
8868
+ var Middleware = middleware;
8869
+ return (jsx(Middleware, { msg: display, ctx: props.middlewareContext }, index));
8870
+ }), msg.permissionRequest && ctx &&
8871
+ jsx(ChatMessagePart, { showAvatar: avaKey === "permissionRequest", user: user, avatarPosition: (_d = chatConfig.env.theme.messages) === null || _d === void 0 ? void 0 : _d.avatarPosition, hideUserInfo: hideUserInfo, children: jsx(ChatPermissionMessage, { message: props.message, sibling: props.sibling, ctx: ctx }) })] }));
8825
8872
  }
8826
- return (React$1.createElement(React$1.Fragment, null));
8873
+ return (jsx(Fragment, {}));
8827
8874
  }
8828
8875
  function renderTimestamp() {
8829
8876
  var timestamp = props.message.timestamp;
8830
8877
  var ts = new Date(timestamp);
8831
8878
  var timeAgo = getTimeAgo(ts);
8832
- return (React$1.createElement("div", { className: "chat-msg-timestamp ".concat(isAgent(props.message.user.nick) ? "agent" : "visitor") },
8833
- React$1.createElement("span", null, timeAgo)));
8879
+ return (jsx("div", { className: "chat-msg-timestamp ".concat(isAgent(props.message.user.nick) ? "agent" : "visitor"), children: jsx("span", { children: timeAgo }) }));
8834
8880
  }
8835
8881
  // empty
8836
- return (React$1.createElement("div", { className: "chat-msg-container-wrapper ".concat(isAgent(props.message.user.nick) ? "agent" : "visitor", " ").concat(props.sibling ? "sibling" : "") },
8837
- React$1.createElement("div", { className: "chat-msg-container ".concat(getClassName(props.message)) },
8838
- renderByType(),
8839
- renderTimestamp())));
8882
+ return (jsx("div", { className: "chat-msg-container-wrapper ".concat(isAgent(props.message.user.nick) ? "agent" : "visitor", " ").concat(props.sibling ? "sibling" : ""), children: jsxs("div", { className: "chat-msg-container ".concat(getClassName(props.message)), children: [renderByType(), renderTimestamp()] }) }));
8840
8883
  };
8841
8884
 
8842
8885
  /**
@@ -9071,18 +9114,12 @@ var AdminBar = function (_a) {
9071
9114
  }
9072
9115
  }
9073
9116
  function renderJoin() {
9074
- return (React$1.createElement("form", { className: "xappw-admin-input-form", onSubmit: onSubmit },
9075
- React$1.createElement("div", { className: "xappw-admin-input-form__buttons" },
9076
- React$1.createElement(ActionButton, { addClass: "xappw-admin-input-form__btn", type: "submit", label: "Join", disable: disable })),
9077
- React$1.createElement("div", { className: "xappw-admin-input" },
9078
- React$1.createElement("input", { ref: name, id: "adminBarInput", placeholder: "Type your name here...", className: "xappw-admin-input__input", onChange: handleInputChange }))));
9117
+ return (jsxs("form", { className: "xappw-admin-input-form", onSubmit: onSubmit, children: [jsx("div", { className: "xappw-admin-input-form__buttons", children: jsx(ActionButton, { addClass: "xappw-admin-input-form__btn", type: "submit", label: "Join", disable: disable }) }), jsx("div", { className: "xappw-admin-input", children: jsx("input", { ref: name, id: "adminBarInput", placeholder: "Type your name here...", className: "xappw-admin-input__input", onChange: handleInputChange }) })] }));
9079
9118
  }
9080
9119
  function renderLeave() {
9081
- return (React$1.createElement("form", { className: "xappw-admin-input-form", onSubmit: onSubmit },
9082
- React$1.createElement("div", { className: "xappw-admin-input-form__buttons" },
9083
- React$1.createElement(ActionButton, { addClass: "xappw-admin-input-form__btn", type: "submit", label: "Leave" }))));
9120
+ return (jsx("form", { className: "xappw-admin-input-form", onSubmit: onSubmit, children: jsx("div", { className: "xappw-admin-input-form__buttons", children: jsx(ActionButton, { addClass: "xappw-admin-input-form__btn", type: "submit", label: "Leave" }) }) }));
9084
9121
  }
9085
- return (React$1.createElement("div", { className: "xappw-admin-input-container visible" }, joined ? renderLeave() : renderJoin()));
9122
+ return (jsx("div", { className: "xappw-admin-input-container visible", children: joined ? renderLeave() : renderJoin() }));
9086
9123
  };
9087
9124
 
9088
9125
  var classnames = {exports: {}};
@@ -9181,39 +9218,32 @@ var MarkdownBuilder = function (_a) {
9181
9218
  var level = hashes.length;
9182
9219
  return "<h".concat(level, ">").concat(headerText, "</h").concat(level, ">");
9183
9220
  });
9184
- return (React$1.createElement("div", { className: containerClass, dangerouslySetInnerHTML: { __html: parsedText } }));
9221
+ return (jsx("div", { className: containerClass, dangerouslySetInnerHTML: { __html: parsedText } }));
9185
9222
  };
9186
9223
 
9187
9224
  var ChatBranding = function (_a) {
9188
9225
  var text = _a.text;
9189
9226
  var regex = /\[([^\]]+)\]\((https?:\/\/[^\)]+)\)/;
9190
9227
  var match = text === null || text === void 0 ? void 0 : text.match(regex);
9191
- return match ? React$1.createElement(MarkdownBuilder, { text: text, applyBrandingClass: true, linkColor: "white" })
9192
- :
9193
- React$1.createElement("div", { className: "chat-footer__branding", style: { color: "white" } }, text);
9228
+ return match ? (jsx(MarkdownBuilder, { text: text, applyBrandingClass: true, linkColor: "white" })) : (jsx("div", { className: "chat-footer__branding", style: { color: "white" }, children: text }));
9194
9229
  };
9195
9230
 
9196
9231
  var CloseIcon = function () {
9197
9232
  // Sergey, I added this style, you will probably want to change it to be more appropriate
9198
- return (React$1.createElement("svg", { style: { color: "grey", paddingRight: "5px" }, xmlns: "http://www.w3.org/2000/svg", fill: "currentColor", viewBox: "0 0 16 16" },
9199
- React$1.createElement("path", { d: "M1.293 1.293a1 1 0 0 1 1.414 0L8 6.586l5.293-5.293a1 1 0 1 1 1.414 1.414L9.414 8l5.293 5.293a1 1 0 0 1-1.414 1.414L8 9.414l-5.293 5.293a1 1 0 0 1-1.414-1.414L6.586 8 1.293 2.707a1 1 0 0 1 0-1.414z" })));
9233
+ return (jsx("svg", { style: { color: "grey", paddingRight: "5px" }, xmlns: "http://www.w3.org/2000/svg", fill: "currentColor", viewBox: "0 0 16 16", children: jsx("path", { d: "M1.293 1.293a1 1 0 0 1 1.414 0L8 6.586l5.293-5.293a1 1 0 1 1 1.414 1.414L9.414 8l5.293 5.293a1 1 0 0 1-1.414 1.414L8 9.414l-5.293 5.293a1 1 0 0 1-1.414-1.414L6.586 8 1.293 2.707a1 1 0 0 1 0-1.414z" }) }));
9200
9234
  };
9201
9235
 
9202
9236
  var LeftDownArrowIcon = function () {
9203
- return (React$1.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "currentColor", viewBox: "0 0 16 16" },
9204
- React$1.createElement("path", { fillRule: "evenodd", d: "M2 13.5a.5.5 0 0 0 .5.5h6a.5.5 0 0 0 0-1H3.707L13.854 2.854a.5.5 0 0 0-.708-.708L3 12.293V7.5a.5.5 0 0 0-1 0v6z" })));
9237
+ return (jsx("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "currentColor", viewBox: "0 0 16 16", children: jsx("path", { fillRule: "evenodd", d: "M2 13.5a.5.5 0 0 0 .5.5h6a.5.5 0 0 0 0-1H3.707L13.854 2.854a.5.5 0 0 0-.708-.708L3 12.293V7.5a.5.5 0 0 0-1 0v6z" }) }));
9205
9238
  };
9206
9239
 
9207
9240
  var SendIcon = function () {
9208
- return (React$1.createElement("svg", { viewBox: "80.208 98.129 313.069 282.823", xmlns: "http://www.w3.org/2000/svg" },
9209
- React$1.createElement("g", { transform: "matrix(0.024498, 0, 0, -0.038359, 79.83091, 381.182404)", fill: "currentColor", stroke: "none" },
9210
- React$1.createElement("path", { d: "M12670 7345 c-63 -18 -272 -77 -465 -130 -192 -53 -478 -132 -635 -175 -508 -141 -1091 -302 -2345 -649 -676 -187 -2038 -563 -3025 -836 -987 -273 -2072 -573 -2410 -666 -338 -94 -802 -222 -1030 -285 -1857 -514 -2579 -714 -2684 -742 -38 -10 -65 -21 -60 -24 5 -3 67 -22 139 -41 72 -20 326 -90 565 -157 239 -67 611 -170 825 -230 215 -60 586 -163 825 -230 239 -67 491 -137 560 -156 l126 -34 974 439 c1397 629 4128 1858 6050 2724 910 410 1826 822 2035 917 209 94 387 173 395 176 35 10 -66 -39 -8200 -3928 -586 -280 -1068 -512 -1071 -516 -3 -4 33 -117 82 -252 76 -213 355 -996 765 -2147 65 -183 120 -330 122 -329 1 2 114 558 250 1236 l248 1233 3455 2064 c1900 1135 3670 2193 3933 2351 264 158 491 293 505 301 62 33 -5 -12 -271 -182 -1671 -1070 -7188 -4613 -7188 -4617 0 -7 3661 -2455 3669 -2454 4 1 3713 6853 3977 7347 8 15 11 27 7 26 -5 0 -60 -15 -123 -34z" }),
9211
- React$1.createElement("path", { d: "M5030 2232 c-15 -61 -479 -1861 -531 -2058 -21 -83 -39 -154 -39 -158 0 -3 369 330 820 740 452 411 817 750 813 754 -11 10 -1025 754 -1039 763 -8 4 -16 -10 -24 -41z" }))));
9241
+ return (jsx("svg", { viewBox: "80.208 98.129 313.069 282.823", xmlns: "http://www.w3.org/2000/svg", children: jsxs("g", { transform: "matrix(0.024498, 0, 0, -0.038359, 79.83091, 381.182404)", fill: "currentColor", stroke: "none", children: [jsx("path", { d: "M12670 7345 c-63 -18 -272 -77 -465 -130 -192 -53 -478 -132 -635 -175 -508 -141 -1091 -302 -2345 -649 -676 -187 -2038 -563 -3025 -836 -987 -273 -2072 -573 -2410 -666 -338 -94 -802 -222 -1030 -285 -1857 -514 -2579 -714 -2684 -742 -38 -10 -65 -21 -60 -24 5 -3 67 -22 139 -41 72 -20 326 -90 565 -157 239 -67 611 -170 825 -230 215 -60 586 -163 825 -230 239 -67 491 -137 560 -156 l126 -34 974 439 c1397 629 4128 1858 6050 2724 910 410 1826 822 2035 917 209 94 387 173 395 176 35 10 -66 -39 -8200 -3928 -586 -280 -1068 -512 -1071 -516 -3 -4 33 -117 82 -252 76 -213 355 -996 765 -2147 65 -183 120 -330 122 -329 1 2 114 558 250 1236 l248 1233 3455 2064 c1900 1135 3670 2193 3933 2351 264 158 491 293 505 301 62 33 -5 -12 -271 -182 -1671 -1070 -7188 -4613 -7188 -4617 0 -7 3661 -2455 3669 -2454 4 1 3713 6853 3977 7347 8 15 11 27 7 26 -5 0 -60 -15 -123 -34z" }), jsx("path", { d: "M5030 2232 c-15 -61 -479 -1861 -531 -2058 -21 -83 -39 -154 -39 -158 0 -3 369 330 820 740 452 411 817 750 813 754 -11 10 -1025 754 -1039 763 -8 4 -16 -10 -24 -41z" })] }) }));
9212
9242
  };
9213
9243
 
9214
9244
  var SendButton = function (props) {
9215
9245
  var _a = props.disabled, disabled = _a === void 0 ? false : _a;
9216
- var _b = React$1.useState(false), isHovered = _b[0], setIsHovered = _b[1];
9246
+ var _b = require$$1.useState(false), isHovered = _b[0], setIsHovered = _b[1];
9217
9247
  // Determine which icon to show based on state
9218
9248
  var getIconSrc = function () {
9219
9249
  if (disabled && props.sendButtonIconDisabled) {
@@ -9224,8 +9254,7 @@ var SendButton = function (props) {
9224
9254
  }
9225
9255
  return props.sendButtonIcon;
9226
9256
  };
9227
- return (React$1.createElement(React$1.Fragment, null, !props.sendButtonIcon ? (React$1.createElement(IconButton_1, { className: "xappw-send-button ".concat(props.className || "", " ").concat(disabled ? 'disabled' : ''), tabIndex: props.tabIndex, onClick: disabled ? undefined : props.onClick, icon: SendIcon })) : (React$1.createElement("button", { className: "xappw-custom-send-button ".concat(disabled ? 'disabled' : ''), tabIndex: props.tabIndex ? Number(props.tabIndex) : 0, onClick: props.onClick, disabled: disabled, onMouseEnter: function () { return setIsHovered(true); }, onMouseLeave: function () { return setIsHovered(false); } },
9228
- React$1.createElement("img", { src: getIconSrc(), alt: "Send button", draggable: false, className: "send-button-icon" })))));
9257
+ return (jsx(Fragment, { children: !props.sendButtonIcon ? (jsx(IconButton_1, { className: "xappw-send-button ".concat(props.className || "", " ").concat(disabled ? 'disabled' : ''), tabIndex: props.tabIndex, onClick: disabled ? undefined : props.onClick, icon: SendIcon })) : (jsx("button", { className: "xappw-custom-send-button ".concat(disabled ? 'disabled' : ''), tabIndex: props.tabIndex ? Number(props.tabIndex) : 0, onClick: props.onClick, disabled: disabled, onMouseEnter: function () { return setIsHovered(true); }, onMouseLeave: function () { return setIsHovered(false); }, children: jsx("img", { src: getIconSrc(), alt: "Send button", draggable: false, className: "send-button-icon" }) })) }));
9229
9258
  };
9230
9259
 
9231
9260
  var Input = function (props) {
@@ -9276,17 +9305,12 @@ var Input = function (props) {
9276
9305
  }
9277
9306
  }
9278
9307
  }, [suggestion, onChange, onSuggestionCommand]);
9279
- return (React$1.createElement("div", { className: "xappw-input-container ".concat(props.addClass, " ").concat(dragover ? "drag-drop-zone" : ""), "aria-label": "To start typing click on rounded rectangle at the bottom of widget. To send your message click icon on right side of rounded rectangle at the bottom of widget" +
9308
+ return (jsx("div", { className: "xappw-input-container ".concat(props.addClass, " ").concat(dragover ? "drag-drop-zone" : ""), "aria-label": "To start typing click on rounded rectangle at the bottom of widget. To send your message click icon on right side of rounded rectangle at the bottom of widget" +
9280
9309
  value.text
9281
9310
  ? "To clear input field click on clear icon on the left of send button"
9282
- : "", "aria-hidden": false, onDrop: onDrop, onDragOver: onDragOver, onDragLeave: onDragLeave },
9283
- React$1.createElement("form", { className: "xappw-input-form", onSubmit: handleOnSubmit },
9284
- React$1.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,
9285
- // onFocus={onFocus}
9286
- value: value, spellCheck: true }),
9287
- React$1.createElement("div", { className: "xappw-input-form__buttons" },
9288
- value.text && (React$1.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 })),
9289
- React$1.createElement(SendButton, { className: "xappw-input-form__btn", sendButtonIcon: sendButtonIcon, sendButtonIconHover: sendButtonIconHover, sendButtonIconDisabled: sendButtonIconDisabled, tabIndex: (_b = footerConfig === null || footerConfig === void 0 ? void 0 : footerConfig.sendButton) === null || _b === void 0 ? void 0 : _b.tabIndex, disabled: !value.text, onClick: handleOnSubmit })))));
9311
+ : "", "aria-hidden": false, onDrop: onDrop, onDragOver: onDragOver, onDragLeave: onDragLeave, children: jsxs("form", { className: "xappw-input-form", onSubmit: handleOnSubmit, children: [jsx(RichInput_1, { 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,
9312
+ // onFocus={onFocus}
9313
+ value: value, spellCheck: true }, "input"), jsxs("div", { className: "xappw-input-form__buttons", children: [value.text && (jsx(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 })), jsx(SendButton, { className: "xappw-input-form__btn", sendButtonIcon: sendButtonIcon, sendButtonIconHover: sendButtonIconHover, sendButtonIconDisabled: sendButtonIconDisabled, tabIndex: (_b = footerConfig === null || footerConfig === void 0 ? void 0 : footerConfig.sendButton) === null || _b === void 0 ? void 0 : _b.tabIndex, disabled: !value.text, onClick: handleOnSubmit })] })] }) }));
9290
9314
  };
9291
9315
 
9292
9316
  function createActions(onItemUse) {
@@ -9298,9 +9322,9 @@ function createActions(onItemUse) {
9298
9322
  ev.stopPropagation();
9299
9323
  }, [data]);
9300
9324
  if (!canUse) {
9301
- return React$1.createElement(React$1.Fragment, null);
9325
+ return jsx(Fragment, {});
9302
9326
  }
9303
- return (React$1.createElement(IconButton_1, { className: "xappw-suggestions__use", onClick: handleUse, icon: LeftDownArrowIcon }));
9327
+ return (jsx(IconButton_1, { className: "xappw-suggestions__use", onClick: handleUse, icon: LeftDownArrowIcon }));
9304
9328
  };
9305
9329
  }
9306
9330
  var Suggestions = function (props) {
@@ -9335,16 +9359,14 @@ var Suggestions = function (props) {
9335
9359
  var lines = content.split('\n');
9336
9360
  return lines.map(function (line) {
9337
9361
  if (line) {
9338
- return React$1.createElement(MarkdownBuilder, { text: line });
9362
+ return jsx(MarkdownBuilder, { text: line });
9339
9363
  }
9340
- return React$1.createElement(React$1.Fragment, null);
9364
+ return jsx(Fragment, {});
9341
9365
  });
9342
9366
  };
9343
9367
  var containerClass = "xappw-suggestions ".concat(props.className || "", " ").concat(props.hasWsButton ? "xappw-suggestions--with-ws-button" : "").trim();
9344
- return (React$1.createElement("div", { className: containerClass },
9345
- (activeItem === null || activeItem === void 0 ? void 0 : activeItem.content) && React$1.createElement("div", { className: "xappw-suggestions__answer" }, transformContent(activeItem.content)),
9346
- fixedSuggestions && fixedSuggestions.length > 0 &&
9347
- React$1.createElement(SuggestionsList_1, { suggestions: fixedSuggestions, index: currentIndex, className: "xappw-suggestions__groups", itemActions: actions, onItemClick: props.onItemClick, onItemHover: setActiveItem, onSpanClick: handleSpanClick })));
9368
+ return (jsxs("div", { className: containerClass, children: [(activeItem === null || activeItem === void 0 ? void 0 : activeItem.content) && jsx("div", { className: "xappw-suggestions__answer", children: transformContent(activeItem.content) }), fixedSuggestions && fixedSuggestions.length > 0 &&
9369
+ jsx(SuggestionsList_1, { suggestions: fixedSuggestions, index: currentIndex, className: "xappw-suggestions__groups", itemActions: actions, onItemClick: props.onItemClick, onItemHover: setActiveItem, onSpanClick: handleSpanClick })] }));
9348
9370
  };
9349
9371
 
9350
9372
  var ChatFooter = function (props) {
@@ -9406,19 +9428,10 @@ var ChatFooter = function (props) {
9406
9428
  var handleAdminJoin = function (status) {
9407
9429
  setEnableInput(status);
9408
9430
  };
9409
- return (React$1.createElement("div", { className: "chat-footer background-footer", "aria-label": menuItems.length ? "to open menu click a button above the rounded rectangle at the bottom of widget" : "", "aria-hidden": false },
9410
- showMenu && menuItems.length ?
9411
- React$1.createElement(React$1.Fragment, null,
9412
- drawerOpen ? React$1.createElement(ChatMenu, { opened: drawerOpen, tabIndex: menuItemsTabIndex, onItemClick: handleMenuItem, items: menuItems }) : React$1.createElement(React$1.Fragment, null),
9413
- React$1.createElement("div", { className: "chat-footer__menu-icon" },
9414
- React$1.createElement(DrawerBars, { tabIndex: menuButtonTabIndex, onToggle: toggleDrawer }))) : React$1.createElement(React$1.Fragment, null),
9415
- React$1.createElement(Suggestions, { className: "xappw-chat-footer__suggestions", data: suggestions.suggestions, index: suggestions.index, searchTerms: suggestionSearch, hasWsButton: hasWsButton, onItemClick: handleItemClick, onItemUse: handleItemUse }),
9416
- isAdmin && isChatting && visible && React$1.createElement(AdminBar, { onAdminJoin: handleAdminJoin }),
9417
- React$1.createElement("div", { style: { pointerEvents: enableInput ? "auto" : "none", opacity: enableInput ? 1 : 0.5 } },
9418
- React$1.createElement(Input, { addClass: "chat-footer__input " + (isChatting && visible ? "visible" : ""), suggestion: suggestions.item, value: input, placeholder: placeholder, sendButtonIcon: sendButtonIcon, sendButtonIconHover: sendButtonIconHover, sendButtonIconDisabled: sendButtonIconDisabled, footerConfig: footerConfig, inputConfig: inputConfig, onSubmit: handleSubmit, onChange: handleChange, onSuggestionCommand: suggestions.execute,
9419
- // onFocus={this.inputOnFocus}
9420
- onFileUpload: props.onFileUpload })),
9421
- brandingEnabled && brandingText && React$1.createElement(ChatBranding, { text: brandingText })));
9431
+ return (jsxs("div", { className: "chat-footer background-footer", "aria-label": menuItems.length ? "to open menu click a button above the rounded rectangle at the bottom of widget" : "", "aria-hidden": false, children: [showMenu && menuItems.length ?
9432
+ jsxs(Fragment, { children: [drawerOpen ? jsx(ChatMenu, { opened: drawerOpen, tabIndex: menuItemsTabIndex, onItemClick: handleMenuItem, items: menuItems }) : jsx(Fragment, {}), jsx("div", { className: "chat-footer__menu-icon", children: jsx(DrawerBars, { tabIndex: menuButtonTabIndex, onToggle: toggleDrawer }) })] }) : jsx(Fragment, {}), jsx(Suggestions, { className: "xappw-chat-footer__suggestions", data: suggestions.suggestions, index: suggestions.index, searchTerms: suggestionSearch, hasWsButton: hasWsButton, onItemClick: handleItemClick, onItemUse: handleItemUse }), isAdmin && isChatting && visible && jsx(AdminBar, { onAdminJoin: handleAdminJoin }), jsx("div", { style: { pointerEvents: enableInput ? "auto" : "none", opacity: enableInput ? 1 : 0.5 }, children: jsx(Input, { addClass: "chat-footer__input " + (isChatting && visible ? "visible" : ""), suggestion: suggestions.item, value: input, placeholder: placeholder, sendButtonIcon: sendButtonIcon, sendButtonIconHover: sendButtonIconHover, sendButtonIconDisabled: sendButtonIconDisabled, footerConfig: footerConfig, inputConfig: inputConfig, onSubmit: handleSubmit, onChange: handleChange, onSuggestionCommand: suggestions.execute,
9433
+ // onFocus={this.inputOnFocus}
9434
+ onFileUpload: props.onFileUpload }) }), brandingEnabled && brandingText && jsx(ChatBranding, { text: brandingText })] }));
9422
9435
  };
9423
9436
 
9424
9437
  var noop = function () { };
@@ -9451,27 +9464,16 @@ var MiddlewareContextFactory = /** @class */ (function () {
9451
9464
 
9452
9465
  var CardContainer = function (props) {
9453
9466
  function renderIcon() {
9454
- var isString = typeof (props.icon) === "string";
9455
- return (React$1.createElement("div", { className: "card-container__icon" }, !isString && props.icon));
9456
- }
9457
- return (React$1.createElement("div", { className: "card-container ".concat(props.addClass) },
9458
- renderIcon(),
9459
- React$1.createElement("div", { className: "card-container__content ".concat(props.contentAddClass) },
9460
- React$1.createElement("div", { className: "card-container__title" }, props.title),
9461
- props.children)));
9467
+ var isString = typeof props.icon === "string";
9468
+ return jsx("div", { className: "card-container__icon", children: !isString && props.icon });
9469
+ }
9470
+ return (jsxs("div", { className: "card-container ".concat(props.addClass), children: [renderIcon(), jsxs("div", { className: "card-container__content ".concat(props.contentAddClass), children: [jsx("div", { className: "card-container__title", children: props.title }), props.children] })] }));
9462
9471
  };
9463
9472
 
9464
- var defaultProps$2 = {
9465
- agent: {},
9466
- hasRating: false,
9467
- shouldDisplay: true,
9468
- onRate: function () {
9473
+ var ChatRating = function (_a) {
9474
+ var _b = _a.agent, agent = _b === void 0 ? {} : _b, _c = _a.hasRating, hasRating = _c === void 0 ? false : _c, _d = _a.shouldDisplay, shouldDisplay = _d === void 0 ? true : _d, _e = _a.onRate, onRate = _e === void 0 ? function () {
9469
9475
  // no-op
9470
- }
9471
- };
9472
- var ChatRating = function (props) {
9473
- if (props === void 0) { props = defaultProps$2; }
9474
- var onRate = props.onRate;
9476
+ } : _e;
9475
9477
  var rateBadButtonOnClick = useCallback(function () {
9476
9478
  onRate("bad");
9477
9479
  }, [onRate]);
@@ -9482,22 +9484,14 @@ var ChatRating = function (props) {
9482
9484
  onRate(undefined);
9483
9485
  }, [onRate]);
9484
9486
  // Do not think this prop should be here
9485
- if (!props.shouldDisplay) {
9487
+ if (!shouldDisplay) {
9486
9488
  return null;
9487
9489
  }
9488
- if (!props.hasRating) {
9489
- return (React$1.createElement(CardContainer, { title: "Chat Rating", addClass: "chat-rating-card" },
9490
- props.agent.displayName,
9491
- " has requested you to rate the chat service.",
9492
- React$1.createElement("div", { className: "buttons-container" },
9493
- React$1.createElement(ActionButton, { addClass: "button button-rate-bad", label: "Rate Bad", onClick: rateBadButtonOnClick }),
9494
- React$1.createElement(ActionButton, { addClass: "button button-rate-good", label: "Rate Good", onClick: rateGoodButtonOnClick }))));
9490
+ if (!hasRating) {
9491
+ return (jsxs(CardContainer, { title: "Chat Rating", addClass: "chat-rating-card", children: [agent.displayName, " has requested you to rate the chat service.", jsxs("div", { className: "buttons-container", children: [jsx(ActionButton, { addClass: "button button-rate-bad", label: "Rate Bad", onClick: rateBadButtonOnClick }), jsx(ActionButton, { addClass: "button button-rate-good", label: "Rate Good", onClick: rateGoodButtonOnClick })] })] }));
9495
9492
  }
9496
9493
  else {
9497
- return (React$1.createElement(CardContainer, { title: "Chat Rating", addClass: "chat-rating-card" },
9498
- "You have rated the chat service.",
9499
- React$1.createElement("div", { className: "buttons-container" },
9500
- React$1.createElement(ActionButton, { addClass: "button button-rate-again", label: "Rate again", onClick: rateAgainButtonOnClick }))));
9494
+ return (jsxs(CardContainer, { title: "Chat Rating", addClass: "chat-rating-card", children: ["You have rated the chat service.", jsx("div", { className: "buttons-container", children: jsx(ActionButton, { addClass: "button button-rate-again", label: "Rate again", onClick: rateAgainButtonOnClick }) })] }));
9501
9495
  }
9502
9496
  };
9503
9497
 
@@ -9506,9 +9500,7 @@ var ChatRatingContainer = function (props) {
9506
9500
  var handleRate = useCallback(function (rating) {
9507
9501
  dispatch(sendChatRating(rating));
9508
9502
  }, [dispatch]);
9509
- return (React$1.createElement(React$1.Fragment, null,
9510
- React$1.createElement("span", { className: "message-sr-only" }, "at " + props.time + " system message"),
9511
- React$1.createElement(ChatRating, { agent: props.agent, hasRating: props.hasRating, shouldDisplay: props.shouldDisplay, onRate: handleRate })));
9503
+ return (jsxs(Fragment, { children: [jsx("span", { className: "message-sr-only", children: "at " + props.time + " system message" }), jsx(ChatRating, { agent: props.agent, hasRating: props.hasRating, shouldDisplay: props.shouldDisplay, onRate: handleRate })] }));
9512
9504
  };
9513
9505
 
9514
9506
  var dateFns = {};
@@ -31033,23 +31025,18 @@ var FailureMessage = function (props) {
31033
31025
  return compileSlotValues(text, slots);
31034
31026
  }, [text, slots]);
31035
31027
  if (countdown === 0) {
31036
- return React$1.createElement(React$1.Fragment, null);
31028
+ return jsx(Fragment, {});
31037
31029
  }
31038
- return (React$1.createElement(React$1.Fragment, null, agent_names.map(function (agent) {
31039
- var _a, _b;
31040
- return (React$1.createElement("div", { className: "chat-msg-container-wrapper", key: "failure-msg-".concat((_a = agent === null || agent === void 0 ? void 0 : agent.user) === null || _a === void 0 ? void 0 : _a.nick) },
31041
- React$1.createElement("div", { className: "chat-msg-container agent", key: (_b = agent === null || agent === void 0 ? void 0 : agent.user) === null || _b === void 0 ? void 0 : _b.nick },
31042
- React$1.createElement(ChatMessagePart, { user: agent === null || agent === void 0 ? void 0 : agent.user, showAvatar: true },
31043
- React$1.createElement("div", { className: "chat-msg" },
31044
- React$1.createElement(ChatMessageBubble, { owner: "others", hasTail: true },
31045
- React$1.createElement("span", { className: "message-sr-only" }, "at " + time + " the bot said"),
31046
- React$1.createElement("span", null, typeof failureMessage === "object" ? failureMessage.displayText : failureMessage)))))));
31047
- })));
31030
+ return (jsx(Fragment, { children: agent_names.map(function (agent) {
31031
+ var _a, _b;
31032
+ return (jsx("div", { className: "chat-msg-container-wrapper", children: jsx("div", { className: "chat-msg-container agent", children: jsx(ChatMessagePart, { user: agent === null || agent === void 0 ? void 0 : agent.user, showAvatar: true, children: jsx("div", { className: "chat-msg", children: jsxs(ChatMessageBubble, { owner: "others", hasTail: true, children: [jsx("span", { className: "message-sr-only", children: "at " + time + " the bot said" }), jsx("span", { children: typeof failureMessage === "object"
31033
+ ? failureMessage.displayText
31034
+ : failureMessage })] }) }) }) }, (_a = agent === null || agent === void 0 ? void 0 : agent.user) === null || _a === void 0 ? void 0 : _a.nick) }, "failure-msg-".concat((_b = agent === null || agent === void 0 ? void 0 : agent.user) === null || _b === void 0 ? void 0 : _b.nick)));
31035
+ }) }));
31048
31036
  };
31049
31037
 
31050
31038
  var MessageSvg = function (_) {
31051
- return (React$1.createElement("svg", { className: "message-svg", width: "16", height: "12", viewBox: "0 0 16 12" },
31052
- React$1.createElement("path", { d: "M14.4 0H1.6C.72 0 .008.675.008 1.5L0 10.5c0 .825.72 1.5 1.6 1.5h12.8c.88 0 1.6-.675 1.6-1.5v-9c0-.825-.72-1.5-1.6-1.5zm0 3L8 6.75 1.6 3V1.5L8 5.25l6.4-3.75V3z", fill: "#424242", fillRule: "evenodd" })));
31039
+ return (jsx("svg", { className: "message-svg", width: "16", height: "12", viewBox: "0 0 16 12", children: jsx("path", { d: "M14.4 0H1.6C.72 0 .008.675.008 1.5L0 10.5c0 .825.72 1.5 1.6 1.5h12.8c.88 0 1.6-.675 1.6-1.5v-9c0-.825-.72-1.5-1.6-1.5zm0 3L8 6.75 1.6 3V1.5L8 5.25l6.4-3.75V3z", fill: "#424242", fillRule: "evenodd" }) }));
31053
31040
  };
31054
31041
 
31055
31042
  var MessageForm = function (props) {
@@ -31077,7 +31064,7 @@ var MessageForm = function (props) {
31077
31064
  props.onSubmit({
31078
31065
  name: (_c = name.current) === null || _c === void 0 ? void 0 : _c.value,
31079
31066
  email: (_d = email.current) === null || _d === void 0 ? void 0 : _d.value,
31080
- message: (_e = message.current) === null || _e === void 0 ? void 0 : _e.value
31067
+ message: (_e = message.current) === null || _e === void 0 ? void 0 : _e.value,
31081
31068
  });
31082
31069
  setSent(true);
31083
31070
  }
@@ -31085,30 +31072,16 @@ var MessageForm = function (props) {
31085
31072
  setSent(false);
31086
31073
  }
31087
31074
  function renderSent() {
31088
- return (React$1.createElement("div", { key: "sent", className: "message-form--sent" },
31089
- "Your message has been sent. We will get back to you as soon as possible.",
31090
- React$1.createElement(ActionButton, { addClass: "button-resend", label: "Send another", onClick: sendAnother })));
31075
+ return (jsxs("div", { className: "message-form--sent", children: ["Your message has been sent. We will get back to you as soon as possible.", jsx(ActionButton, { addClass: "button-resend", label: "Send another", onClick: sendAnother })] }, "sent"));
31091
31076
  }
31092
31077
  function renderForm() {
31093
- return (React$1.createElement("form", { ref: form, key: "not-sent", className: "message-form", onSubmit: send },
31094
- React$1.createElement("div", { className: "content" },
31095
- React$1.createElement("div", { className: "section" },
31096
- React$1.createElement("label", { className: "label" }, "Name"),
31097
- React$1.createElement("input", { ref: name, maxLength: 255 })),
31098
- React$1.createElement("div", { className: "section" },
31099
- React$1.createElement("label", { className: "label" }, "Email"),
31100
- React$1.createElement("input", { ref: email, onChange: emailChanged, type: "email", required: true, pattern: EMAIL_REGEX })),
31101
- React$1.createElement("div", { className: "section" },
31102
- React$1.createElement("label", { className: "label" }, "Message"),
31103
- React$1.createElement("textarea", { required: true, ref: message }))),
31104
- React$1.createElement("div", { className: "button-container" },
31105
- React$1.createElement(ActionButton, { type: "submit", addClass: "message-form__submit", label: "Send" }))));
31106
- }
31107
- return (React$1.createElement(CardContainer, { title: props.title, addClass: "offline-card", contentAddClass: sent ? "sent" : "", icon: React$1.createElement(MessageSvg, null) }, sent ? renderSent() : renderForm()));
31078
+ return (jsxs("form", { ref: form, className: "message-form", onSubmit: send, children: [jsxs("div", { className: "content", children: [jsxs("div", { className: "section", children: [jsx("label", { className: "label", children: "Name" }), jsx("input", { ref: name, maxLength: 255 })] }), jsxs("div", { className: "section", children: [jsx("label", { className: "label", children: "Email" }), jsx("input", { ref: email, onChange: emailChanged, type: "email", required: true, pattern: EMAIL_REGEX })] }), jsxs("div", { className: "section", children: [jsx("label", { className: "label", children: "Message" }), jsx("textarea", { required: true, ref: message })] })] }), jsx("div", { className: "button-container", children: jsx(ActionButton, { type: "submit", addClass: "message-form__submit", label: "Send" }) })] }, "not-sent"));
31079
+ }
31080
+ return (jsx(CardContainer, { title: props.title, addClass: "offline-card", contentAddClass: sent ? "sent" : "", icon: jsx(MessageSvg, {}), children: sent ? renderSent() : renderForm() }));
31108
31081
  };
31109
31082
 
31110
31083
  var OfflineForm = function (props) {
31111
- return React$1.createElement(MessageForm, { title: "Offline message card title", onSubmit: props.onSubmit });
31084
+ return jsx(MessageForm, { title: "Offline message card title", onSubmit: props.onSubmit });
31112
31085
  };
31113
31086
 
31114
31087
  var OfflineFormContainer = function (props) {
@@ -31116,9 +31089,7 @@ var OfflineFormContainer = function (props) {
31116
31089
  var handleSubmit = useCallback(function (data) {
31117
31090
  dispatch(sendOfflineMsg(data));
31118
31091
  }, [dispatch]);
31119
- return (React$1.createElement(React$1.Fragment, null,
31120
- React$1.createElement("span", { className: "message-sr-only" }, "at " + props.time + " system message"),
31121
- React$1.createElement(OfflineForm, { onSubmit: handleSubmit })));
31092
+ return (jsxs(Fragment, { children: [jsx("span", { className: "message-sr-only", children: "at " + props.time + " system message" }), jsx(OfflineForm, { onSubmit: handleSubmit })] }));
31122
31093
  };
31123
31094
 
31124
31095
  var PrechatForm = function (props) {
@@ -31128,7 +31099,7 @@ var PrechatForm = function (props) {
31128
31099
  onSubmit(msg);
31129
31100
  setSent(true);
31130
31101
  }, [onSubmit]);
31131
- return (React$1.createElement(React$1.Fragment, null, !sent && React$1.createElement(MessageForm, { title: "Introduce yourself!", onSubmit: handleSubmit })));
31102
+ return jsx(Fragment, { children: !sent && jsx(MessageForm, { title: "Introduce yourself!", onSubmit: handleSubmit }) });
31132
31103
  };
31133
31104
 
31134
31105
  var PrechatFormContainer = function (props) {
@@ -31144,34 +31115,34 @@ var PrechatFormContainer = function (props) {
31144
31115
  }, sessionId));
31145
31116
  dispatch(executeAction(data.message));
31146
31117
  }, [dispatch, sessionId]);
31147
- return (React$1.createElement(React$1.Fragment, null,
31148
- React$1.createElement("span", { className: "message-sr-only" }, "at " + props.time + " system message"),
31149
- React$1.createElement(PrechatForm, { onSubmit: handleSubmit })));
31118
+ return (jsxs(Fragment, { children: [jsx("span", { className: "message-sr-only", children: "at " + props.time + " system message" }), jsx(PrechatForm, { onSubmit: handleSubmit })] }));
31150
31119
  };
31151
31120
 
31152
- var defaultProps$1 = {
31153
- position: 0
31154
- };
31155
- var QueuePosition = function (props) {
31156
- if (props === void 0) { props = defaultProps$1; }
31157
- if (props.position <= 0)
31121
+ var QueuePosition = function (_a) {
31122
+ var _b = _a.position, position = _b === void 0 ? 0 : _b;
31123
+ if (position <= 0)
31158
31124
  return null;
31159
- return (React$1.createElement("div", { className: "system-msg-container" },
31160
- React$1.createElement("span", { className: "system-msg" },
31161
- "Queue position: ",
31162
- props.position)));
31125
+ return (jsx("div", { className: "system-msg-container", children: jsxs("span", { className: "system-msg", children: ["Queue position: ", position] }) }));
31163
31126
  };
31164
31127
 
31165
31128
  function isServerUser(user) {
31166
31129
  var _a;
31167
31130
  return (_a = user.nick) === null || _a === void 0 ? void 0 : _a.endsWith(ROUTER_USER);
31168
31131
  }
31132
+ function shouldShowDivider(message) {
31133
+ return (message.type === "chat.memberjoin" && message.showDivider) ||
31134
+ (message.type === "chat.memberleave" && message.showDivider);
31135
+ }
31169
31136
  function getMessageByType(msg) {
31170
31137
  switch (msg.type) {
31171
31138
  case "chat.memberjoin":
31172
- return "".concat(msg.user.displayName || "Bot", " has joined the chat");
31139
+ // Use custom message if provided, otherwise use default
31140
+ return msg.message || "".concat(msg.user.displayName || "Bot", " has joined the chat");
31173
31141
  case "chat.memberleave":
31174
- return "".concat(msg.user.displayName || "Bot", " has left the chat");
31142
+ // Use custom message if provided, otherwise use default
31143
+ return msg.message || "".concat(msg.user.displayName || "Bot", " has left the chat");
31144
+ case "chat.systemmessage":
31145
+ return msg.message;
31175
31146
  case "chat.rating":
31176
31147
  if (!msg.newRating) {
31177
31148
  return "You have removed the chat rating";
@@ -31185,10 +31156,12 @@ function getMessageByType(msg) {
31185
31156
  }
31186
31157
  }
31187
31158
  var SystemMessage = function (props) {
31159
+ var _a;
31188
31160
  if (!isServerUser(props.message.user)) {
31189
- return (React$1.createElement("div", { className: "system-msg-container" },
31190
- React$1.createElement("span", { className: "message-sr-only" }, "at " + props.time + " system message"),
31191
- React$1.createElement("span", { className: "system-msg" }, getMessageByType(props.message))));
31161
+ var message = props.message;
31162
+ var showDivider = shouldShowDivider(message);
31163
+ var avatarUrl = (_a = message.user) === null || _a === void 0 ? void 0 : _a.avatarPath;
31164
+ return (jsxs("div", { className: "system-msg-container", children: [showDivider && avatarUrl && (jsxs("div", { className: "system-msg-divider", children: [jsx("div", { className: "divider-line" }), jsx("div", { className: "divider-avatar", children: jsx("img", { src: avatarUrl, alt: "".concat(message.user.displayName || "User", "'s avatar") }) }), jsx("div", { className: "divider-line" })] })), jsx("span", { className: "message-sr-only", children: "at " + props.time + " system message" }), jsx("span", { className: "system-msg", children: getMessageByType(props.message) })] }));
31192
31165
  }
31193
31166
  else {
31194
31167
  return null;
@@ -31199,10 +31172,7 @@ function convertToSentenceCase(s) {
31199
31172
  }
31200
31173
 
31201
31174
  var TypingIndicator = function (_) {
31202
- return (React$1.createElement("div", { className: "typing-indicator" },
31203
- React$1.createElement("div", { className: "typing-indicator-part" }),
31204
- React$1.createElement("div", { className: "typing-indicator-part" }),
31205
- React$1.createElement("div", { className: "typing-indicator-part" })));
31175
+ return (jsxs("div", { className: "typing-indicator", children: [jsx("div", { className: "typing-indicator-part" }), jsx("div", { className: "typing-indicator-part" }), jsx("div", { className: "typing-indicator-part" })] }));
31206
31176
  };
31207
31177
 
31208
31178
  /**
@@ -31210,42 +31180,19 @@ var TypingIndicator = function (_) {
31210
31180
  */
31211
31181
  var TypingStatus = function (props) {
31212
31182
  var agentsTyping = Object.values(props.agents).filter(function (agent) { return agent.typing; });
31213
- return (React$1.createElement(React$1.Fragment, null, agentsTyping.map(function (agent, index) {
31214
- var _a, _b;
31215
- var key = ((_a = agent.user) === null || _a === void 0 ? void 0 : _a.nick) || "".concat(index);
31216
- var displayName = ((_b = agent.user) === null || _b === void 0 ? void 0 : _b.displayName) || "Somebody";
31217
- return (React$1.createElement("span", { key: "typing-status-".concat(index) }, !props.textTypingStatusEnabled ? (React$1.createElement("div", { className: "chat-msg-container-wrapper", key: "typing-status-".concat(key) },
31218
- React$1.createElement("div", { key: key, className: "chat-msg-container agent chat-typing-progress" },
31219
- React$1.createElement(ChatMessagePart, { user: agent.user, showAvatar: true },
31220
- React$1.createElement("div", { className: "chat-msg" },
31221
- React$1.createElement(ChatMessageBubble, { owner: "others", hasTail: true },
31222
- React$1.createElement(TypingIndicator, null))))))) : (React$1.createElement("div", { key: "typing-status-".concat(key), className: "chat-msg-agent-typing" },
31223
- displayName,
31224
- " is typing"))));
31225
- })));
31183
+ return (jsx(Fragment, { children: agentsTyping.map(function (agent, index) {
31184
+ var _a, _b;
31185
+ var key = ((_a = agent.user) === null || _a === void 0 ? void 0 : _a.nick) || "".concat(index);
31186
+ var displayName = ((_b = agent.user) === null || _b === void 0 ? void 0 : _b.displayName) || "Somebody";
31187
+ return (jsx("span", { children: !props.textTypingStatusEnabled ? (jsx("div", { className: "chat-msg-container-wrapper", children: jsx("div", { className: "chat-msg-container agent chat-typing-progress", children: jsx(ChatMessagePart, { user: agent.user, showAvatar: true, children: jsx("div", { className: "chat-msg", children: jsx(ChatMessageBubble, { owner: "others", hasTail: true, children: jsx(TypingIndicator, {}) }) }) }) }, key) }, "typing-status-".concat(key))) : (jsxs("div", { className: "chat-msg-agent-typing", children: [displayName, " is typing"] }, "typing-status-".concat(key))) }, "typing-status-".concat(index)));
31188
+ }) }));
31226
31189
  };
31227
31190
 
31228
- var defaultProps = {
31229
- visible: true,
31230
- messages: [],
31231
- agents: {},
31232
- isOffline: true,
31233
- isChatting: false,
31234
- queuePosition: 0,
31235
- lastRatingRequestTimestamp: 0,
31236
- hasRating: false,
31237
- visitorId: "",
31238
- onSend: function () { return Promise.resolve(); },
31239
- onWrite: function () { return Promise.resolve(); },
31240
- onOpenUrl: function () { },
31241
- minimizeOnClick: function () { },
31242
- };
31243
- var MessageList = function (props) {
31244
- if (props === void 0) { props = defaultProps; }
31245
- var onSend = props.onSend, onWrite = props.onWrite, onOpenUrl = props.onOpenUrl, minimizeOnClick = props.minimizeOnClick;
31191
+ var MessageList = function (_a) {
31192
+ _a.visible; var _c = _a.messages, messages = _c === void 0 ? [] : _c, _d = _a.agents, agents = _d === void 0 ? {} : _d; _a.isOffline; _a.isChatting; var _g = _a.queuePosition, queuePosition = _g === void 0 ? 0 : _g, _h = _a.lastRatingRequestTimestamp, lastRatingRequestTimestamp = _h === void 0 ? 0 : _h, _j = _a.hasRating, hasRating = _j === void 0 ? false : _j; _a.visitorId; var messageMiddleware = _a.messageMiddleware, textTypingStatusEnabled = _a.textTypingStatusEnabled, agent = _a.agent, hasWsButton = _a.hasWsButton, _l = _a.onSend, onSend = _l === void 0 ? function () { return Promise.resolve(); } : _l, _m = _a.onWrite, onWrite = _m === void 0 ? function () { return Promise.resolve(); } : _m, _o = _a.onOpenUrl, onOpenUrl = _o === void 0 ? function () { } : _o, _p = _a.minimizeOnClick, minimizeOnClick = _p === void 0 ? function () { } : _p; _a.children;
31246
31193
  var messagesEndRef = useRef(null);
31247
31194
  var containerRef = useRef(null);
31248
- var prevHasWsButtonRef = useRef(props.hasWsButton);
31195
+ var prevHasWsButtonRef = useRef(hasWsButton);
31249
31196
  // Check if user is scrolled to bottom
31250
31197
  var isAtBottom = useCallback(function () {
31251
31198
  if (!containerRef.current)
@@ -31263,11 +31210,11 @@ var MessageList = function (props) {
31263
31210
  // Always scroll to bottom when messages change
31264
31211
  useEffect(function () {
31265
31212
  scrollToBottom("smooth");
31266
- }, [props.messages, props.agents, scrollToBottom]);
31213
+ }, [messages, agents, scrollToBottom]);
31267
31214
  // Handle WS button dismissal - only scroll when button is removed
31268
31215
  useEffect(function () {
31269
31216
  var prevHasButton = prevHasWsButtonRef.current;
31270
- var currentHasButton = props.hasWsButton;
31217
+ var currentHasButton = hasWsButton;
31271
31218
  // Update ref for next render
31272
31219
  prevHasWsButtonRef.current = currentHasButton;
31273
31220
  // Only handle button dismissal (was true, now false)
@@ -31282,7 +31229,7 @@ var MessageList = function (props) {
31282
31229
  }
31283
31230
  }
31284
31231
  return undefined;
31285
- }, [props.hasWsButton, isAtBottom, scrollToBottom]);
31232
+ }, [hasWsButton, isAtBottom, scrollToBottom]);
31286
31233
  var handleSend = useCallback(function (msg) {
31287
31234
  onSend(msg);
31288
31235
  messagesEndRef.current.scrollIntoView({ behavior: "smooth" });
@@ -31314,7 +31261,7 @@ var MessageList = function (props) {
31314
31261
  user = msg.user;
31315
31262
  }
31316
31263
  else {
31317
- user = ((_c = props.agents[msg.user.nick]) === null || _c === void 0 ? void 0 : _c.user) || props.agent;
31264
+ user = ((_c = agents[msg.user.nick]) === null || _c === void 0 ? void 0 : _c.user) || agent;
31318
31265
  // Still nothing?
31319
31266
  if (!user) {
31320
31267
  log("Could not get a user from agents list with nick: \"".concat(msg.user.nick, "\""));
@@ -31324,26 +31271,23 @@ var MessageList = function (props) {
31324
31271
  switch (msg.type) {
31325
31272
  case "chat.file":
31326
31273
  case "chat.msg":
31327
- return (React$1.createElement(ChatMessage, { key: "cm-".concat(msg.type, "-").concat(msg.timestamp), message: msg, sibling: sibling, agent: user, messageMiddleware: props.messageMiddleware, middlewareContext: ctxCache.resolve(user), minimizeOnClick: minimizeOnClick }));
31274
+ return (jsx(ChatMessage, { message: msg, sibling: sibling, agent: user, messageMiddleware: messageMiddleware, middlewareContext: ctxCache.resolve(user), minimizeOnClick: minimizeOnClick }, "cm-".concat(msg.type, "-").concat(msg.timestamp)));
31328
31275
  case "chat.failureMsg":
31329
- return (React$1.createElement(FailureMessage, __assign({ key: "fm-".concat(msg.type, "-").concat(msg.timestamp), agents: props.agents, time: time }, msg.failureMsg)));
31276
+ return (jsx(FailureMessage, __assign({ agents: agents, time: time }, msg.failureMsg), "fm-".concat(msg.type, "-").concat(msg.timestamp)));
31330
31277
  case "chat.memberjoin":
31331
31278
  case "chat.memberleave":
31279
+ case "chat.systemmessage":
31332
31280
  case "chat.rating":
31333
31281
  case "chat.typing":
31334
- return (React$1.createElement(SystemMessage, { key: "sm-".concat(msg.type, "-").concat(msg.timestamp), time: time, message: msg }));
31282
+ return (jsx(SystemMessage, { time: time, message: msg }, "sm-".concat(msg.type, "-").concat(msg.timestamp)));
31335
31283
  case "chat.request.rating":
31336
- return (React$1.createElement(ChatRatingContainer, { key: "cr-".concat(msg.type, "-").concat(msg.timestamp), agent: user, hasRating: props.hasRating, time: time, shouldDisplay: msg.timestamp === props.lastRatingRequestTimestamp }));
31284
+ return (jsx(ChatRatingContainer, { agent: user, hasRating: hasRating, time: time, shouldDisplay: msg.timestamp === lastRatingRequestTimestamp }, "cr-".concat(msg.type, "-").concat(msg.timestamp)));
31337
31285
  case "chat.offline":
31338
- return React$1.createElement(OfflineFormContainer, { key: "offline-".concat(msg.timestamp), time: time });
31286
+ return jsx(OfflineFormContainer, { time: time }, "offline-".concat(msg.timestamp));
31339
31287
  case "chat.prechat":
31340
- return React$1.createElement(PrechatFormContainer, { key: "prechat", time: time });
31288
+ return jsx(PrechatFormContainer, { time: time }, "prechat");
31341
31289
  default:
31342
- return (React$1.createElement("span", { key: "default-".concat(msg.timestamp) },
31343
- React$1.createElement("span", { className: "message-sr-only" }, "at " + time + " system message"),
31344
- React$1.createElement("div", { key: "uhm-".concat(+new Date()) },
31345
- "Unhandled message: ",
31346
- JSON.stringify(msg))));
31290
+ return (jsxs("span", { children: [jsx("span", { className: "message-sr-only", children: "at " + time + " system message" }), jsxs("div", { children: ["Unhandled message: ", JSON.stringify(msg)] }, "uhm-".concat(+new Date()))] }, "default-".concat(msg.timestamp)));
31347
31291
  }
31348
31292
  }
31349
31293
  /**
@@ -31352,14 +31296,14 @@ var MessageList = function (props) {
31352
31296
  */
31353
31297
  function renderAll() {
31354
31298
  var lastMsgIndex = -1;
31355
- for (var i = props.messages.length - 1; i > 0; i--) {
31356
- if (props.messages[i].type === "chat.msg") {
31299
+ for (var i = messages.length - 1; i > 0; i--) {
31300
+ if (messages[i].type === "chat.msg") {
31357
31301
  lastMsgIndex = i;
31358
31302
  break;
31359
31303
  }
31360
31304
  }
31361
- return props.messages.map(function (message, index) {
31362
- // const next = props.messages[index + 1];
31305
+ return messages.map(function (message, index) {
31306
+ // const next = messages[index + 1];
31363
31307
  var _a, _b;
31364
31308
  // let sibling = false;
31365
31309
  // const currentNick = message.nick;
@@ -31375,6 +31319,7 @@ var MessageList = function (props) {
31375
31319
  // "chat.failureMsg",
31376
31320
  "chat.memberjoin",
31377
31321
  "chat.memberleave",
31322
+ // "chat.systemmessage", // System messages don't show timestamps
31378
31323
  "chat.rating",
31379
31324
  // "chat.typing",
31380
31325
  "chat.request.rating",
@@ -31384,11 +31329,11 @@ var MessageList = function (props) {
31384
31329
  // show first and las TS and after at least 5 minutes gap. Don't show "router user"
31385
31330
  var showTs = false;
31386
31331
  if (tsTypes.includes(message.type) && !((_b = (_a = message.user) === null || _a === void 0 ? void 0 : _a.nick) === null || _b === void 0 ? void 0 : _b.endsWith(ROUTER_USER))) {
31387
- if (index === 0 || index === props.messages.length - 1 || index === lastMsgIndex) {
31332
+ if (index === 0 || index === messages.length - 1 || index === lastMsgIndex) {
31388
31333
  showTs = true;
31389
31334
  }
31390
31335
  else {
31391
- var previous = props.messages[index - 1];
31336
+ var previous = messages[index - 1];
31392
31337
  if (message.timestamp && previous.timestamp) {
31393
31338
  showTs = message.timestamp - previous.timestamp > 300 * 1000; // 5 minutes
31394
31339
  }
@@ -31399,26 +31344,14 @@ var MessageList = function (props) {
31399
31344
  showTs = false;
31400
31345
  }
31401
31346
  var ts = showTs ? new Date(message.timestamp).toLocaleString() : undefined;
31402
- return (React$1.createElement("span", { key: "message-list-render-all-".concat(index) },
31403
- showTs && (React$1.createElement("div", { className: "ts-msg-container" },
31404
- React$1.createElement("span", { className: "ts-msg" }, ts))),
31405
- renderByType(message, false)));
31347
+ return (jsxs("span", { children: [showTs && (jsx("div", { className: "ts-msg-container", children: jsx("span", { className: "ts-msg", children: ts }) })), renderByType(message, false)] }, "message-list-render-all-".concat(index)));
31406
31348
  });
31407
31349
  }
31408
- var agents = props.agents, queuePosition = props.queuePosition;
31409
- return (React$1.createElement("div", { className: "message-list-container", ref: containerRef },
31410
- React$1.createElement("div", { className: "message-list-container__msgs" },
31411
- renderAll(),
31412
- React$1.createElement("div", { ref: messagesEndRef, style: { float: "left", clear: "both" } }),
31413
- React$1.createElement(QueuePosition, { position: queuePosition }),
31414
- React$1.createElement(TypingStatus, { agents: agents, textTypingStatusEnabled: props.textTypingStatusEnabled })),
31415
- React$1.createElement(ChatChipsContainer, null)));
31350
+ return (jsxs("div", { className: "message-list-container", ref: containerRef, children: [jsxs("div", { className: "message-list-container__msgs", children: [renderAll(), jsx("div", { ref: messagesEndRef, style: { float: "left", clear: "both" } }), jsx(QueuePosition, { position: queuePosition }), jsx(TypingStatus, { agents: agents, textTypingStatusEnabled: textTypingStatusEnabled })] }), jsx(ChatChipsContainer, {})] }));
31416
31351
  };
31417
31352
 
31418
31353
  var ServerOffline = function () {
31419
- return React$1.createElement("div", { className: "server-offline" },
31420
- React$1.createElement("h2", null, "Chat is currently unavailable"),
31421
- React$1.createElement("h3", null, "Server is offline"));
31354
+ return (jsxs("div", { className: "server-offline", children: [jsx("h2", { children: "Chat is currently unavailable" }), jsx("h3", { children: "Server is offline" })] }));
31422
31355
  };
31423
31356
 
31424
31357
  function buildStyleContent(theme) {
@@ -31428,7 +31361,7 @@ function buildStyleContent(theme) {
31428
31361
  function WidgetStylesheet(props) {
31429
31362
  var theme = props.theme;
31430
31363
  var stylesContent = buildStyleContent(theme);
31431
- return React$1.createElement("style", null, stylesContent);
31364
+ return jsx("style", { children: stylesContent });
31432
31365
  }
31433
31366
  function buildVariables(gen) {
31434
31367
  var result = gen.next();
@@ -31975,31 +31908,7 @@ var ErrorOverlay = function (_a) {
31975
31908
  if (errors.length === 0) {
31976
31909
  return null;
31977
31910
  }
31978
- return (React$1.createElement("div", { className: "error-overlay error-overlay--".concat(position, " ").concat(isMinimized ? "minimized" : "") },
31979
- React$1.createElement("div", { className: "error-overlay-header" },
31980
- React$1.createElement("span", { className: "error-overlay-title" },
31981
- "Debug Console (",
31982
- errors.length,
31983
- ")"),
31984
- React$1.createElement("div", { className: "error-overlay-actions" },
31985
- React$1.createElement("button", { onClick: copyToClipboard, title: "Copy all to clipboard" }, "\uD83D\uDCCB"),
31986
- React$1.createElement("button", { onClick: clearErrors, title: "Clear all" }, "\uD83D\uDDD1\uFE0F"),
31987
- React$1.createElement("button", { onClick: togglePosition, title: "Move to ".concat(position === "bottom" ? "top" : "bottom") }, position === "bottom" ? "⬆️" : "⬇️"),
31988
- React$1.createElement("button", { onClick: toggleEnabled, title: "Disable Error Overlay" }, "\uD83D\uDD27"),
31989
- React$1.createElement("button", { onClick: function () { return setIsMinimized(!isMinimized); }, title: "Minimize/Maximize" }, isMinimized ? "▲" : "▼"),
31990
- React$1.createElement("button", { onClick: function () { return setIsVisible(false); }, title: "Close" }, "\u2715"))),
31991
- !isMinimized && (React$1.createElement("div", { className: "error-overlay-content" }, errors.map(function (error) { return (React$1.createElement("div", { key: error.id, className: "error-entry error-".concat(error.type) },
31992
- React$1.createElement("div", { className: "error-header" },
31993
- React$1.createElement("span", { className: "error-time" }, new Date(error.timestamp).toLocaleTimeString()),
31994
- error.count > 1 && (React$1.createElement("span", { className: "error-count" },
31995
- "(",
31996
- error.count,
31997
- "x)")),
31998
- React$1.createElement("span", { className: "error-badge error-badge-".concat(error.type) }, error.type)),
31999
- React$1.createElement("div", { className: "error-message" }, error.message),
32000
- error.stack && (React$1.createElement("details", { className: "error-stack" },
32001
- React$1.createElement("summary", null, "Stack trace"),
32002
- React$1.createElement("pre", null, error.stack))))); })))));
31911
+ return (jsxs("div", { className: "error-overlay error-overlay--".concat(position, " ").concat(isMinimized ? "minimized" : ""), children: [jsxs("div", { className: "error-overlay-header", children: [jsxs("span", { className: "error-overlay-title", children: ["Debug Console (", errors.length, ")"] }), jsxs("div", { className: "error-overlay-actions", children: [jsx("button", { onClick: copyToClipboard, title: "Copy all to clipboard", children: "\uD83D\uDCCB" }), jsx("button", { onClick: clearErrors, title: "Clear all", children: "\uD83D\uDDD1\uFE0F" }), jsx("button", { onClick: togglePosition, title: "Move to ".concat(position === "bottom" ? "top" : "bottom"), children: position === "bottom" ? "⬆️" : "⬇️" }), jsx("button", { onClick: toggleEnabled, title: "Disable Error Overlay", children: "\uD83D\uDD27" }), jsx("button", { onClick: function () { return setIsMinimized(!isMinimized); }, title: "Minimize/Maximize", children: isMinimized ? "▲" : "▼" }), jsx("button", { onClick: function () { return setIsVisible(false); }, title: "Close", children: "\u2715" })] })] }), !isMinimized && (jsx("div", { className: "error-overlay-content", children: errors.map(function (error) { return (jsxs("div", { className: "error-entry error-".concat(error.type), children: [jsxs("div", { className: "error-header", children: [jsx("span", { className: "error-time", children: new Date(error.timestamp).toLocaleTimeString() }), error.count > 1 && (jsxs("span", { className: "error-count", children: ["(", error.count, "x)"] })), jsx("span", { className: "error-badge error-badge-".concat(error.type), children: error.type })] }), jsx("div", { className: "error-message", children: error.message }), error.stack && (jsxs("details", { className: "error-stack", children: [jsx("summary", { children: "Stack trace" }), jsx("pre", { children: error.stack })] }))] }, error.id)); }) }))] }));
32003
31912
  };
32004
31913
 
32005
31914
  var WsButton = function (_a) {
@@ -32026,23 +31935,19 @@ var WsButton = function (_a) {
32026
31935
  }
32027
31936
  return classes.join(" ");
32028
31937
  }, [button.isDismissing]);
32029
- return (React$1.createElement("div", { className: containerClassName },
32030
- React$1.createElement("button", { className: className, onClick: handleClick, disabled: button.pressBehavior === "disabled" || button.isPressed, "aria-label": button.text, "aria-busy": button.isPressed && button.pressBehavior === "spinning" },
32031
- button.isPressed && button.pressBehavior === "spinning" && (React$1.createElement("span", { className: "ws-button__spinner" })),
32032
- React$1.createElement("span", { className: "ws-button__text" }, button.text))));
31938
+ return (jsx("div", { className: containerClassName, children: jsxs("button", { className: className, onClick: handleClick, disabled: button.pressBehavior === "disabled" || button.isPressed, "aria-label": button.text, "aria-busy": button.isPressed && button.pressBehavior === "spinning", children: [button.isPressed && button.pressBehavior === "spinning" && (jsx("span", { className: "ws-button__spinner" })), jsx("span", { className: "ws-button__text", children: button.text })] }) }));
32033
31939
  };
32034
31940
 
32035
31941
  var ModalContent = function (_a) {
32036
31942
  var onClose = _a.onClose, onReset = _a.onReset;
32037
- return (React$1.createElement("div", { className: "modalContent" },
32038
- React$1.createElement("div", { className: "modalBody" },
32039
- React$1.createElement("h2", null, "Restart Conversation"),
32040
- React$1.createElement("p", null, "Would you like to refresh and return to the starting point of the conversation?")),
32041
- React$1.createElement("div", { className: "modalActions" },
32042
- React$1.createElement("button", { onClick: onClose, className: "cancelBtn" }, "Cancel"),
32043
- React$1.createElement("button", { onClick: onReset, className: "restartBtn" }, "Restart"))));
31943
+ return (jsxs("div", { className: "modalContent", children: [jsxs("div", { className: "modalBody", children: [jsx("h2", { children: "Restart Conversation" }), jsx("p", { children: "Would you like to refresh and return to the starting point of the conversation?" })] }), jsxs("div", { className: "modalActions", children: [jsx("button", { onClick: onClose, className: "cancelBtn", children: "Cancel" }), jsx("button", { onClick: onReset, className: "restartBtn", children: "Restart" })] })] }));
32044
31944
  };
32045
31945
 
31946
+ /**
31947
+ * Debounce delay for typing indicator in milliseconds.
31948
+ * After this delay of inactivity, the "stop typing" event will be sent.
31949
+ */
31950
+ var TYPING_INDICATOR_DEBOUNCE_MS = 2000;
32046
31951
  var ChatWidgetWrapper = function (props) {
32047
31952
  var _a;
32048
31953
  var _b = useState(props.config), rawConfig = _b[0], setRawConfig = _b[1];
@@ -32113,20 +32018,13 @@ var ChatWidgetWrapper = function (props) {
32113
32018
  var modeClass = "widget-container--".concat(mode);
32114
32019
  // Show loading state while config is being fetched
32115
32020
  if (configLoading) {
32116
- return (React$1.createElement("div", { className: "widget-container widget-container--loading ".concat(modeClass) },
32117
- React$1.createElement("div", { className: "xa-spinner-container visible" },
32118
- React$1.createElement("div", { className: "xa-spinner" }))));
32021
+ return (jsx("div", { className: "widget-container widget-container--loading ".concat(modeClass), children: jsx("div", { className: "xa-spinner-container visible", children: jsx("div", { className: "xa-spinner" }) }) }));
32119
32022
  }
32120
32023
  // Show error state if config failed to load
32121
32024
  if (configError) {
32122
- return (React$1.createElement("div", { className: "widget-container widget-container--error ".concat(modeClass) },
32123
- React$1.createElement("div", { className: "widget-error-message" },
32124
- "Failed to load chat configuration: ",
32125
- configError.message)));
32126
- }
32127
- return (React$1.createElement(ChatConfigContext.Provider, { value: config },
32128
- React$1.createElement(ChatServerContext.Provider, { value: chatServer },
32129
- React$1.createElement(ChatWidget, __assign({}, props, { config: rawConfig })))));
32025
+ return (jsx("div", { className: "widget-container widget-container--error ".concat(modeClass), children: jsxs("div", { className: "widget-error-message", children: ["Failed to load chat configuration: ", configError.message] }) }));
32026
+ }
32027
+ return (jsx(ChatConfigContext.Provider, { value: config, children: jsx(ChatServerContext.Provider, { value: chatServer, children: jsx(ChatWidget, __assign({}, props, { config: rawConfig })) }) }));
32130
32028
  };
32131
32029
  var ChatWidget = function (props) {
32132
32030
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7;
@@ -32162,7 +32060,11 @@ var ChatWidget = function (props) {
32162
32060
  chatState.visuals.visible ||
32163
32061
  (((_m = props.config) === null || _m === void 0 ? void 0 : _m.autoOpenOnWidth) &&
32164
32062
  window.matchMedia("(min-width: ".concat((_o = props.config) === null || _o === void 0 ? void 0 : _o.autoOpenOnWidth, ")")).matches)), visible = _8[0], setVisibleState = _8[1];
32165
- var _9 = useState(false), typing = _9[0], setTypingState = _9[1]; // false initially
32063
+ var _9 = useState(false); _9[0]; var setTypingState = _9[1]; // false initially - state kept for potential external observers
32064
+ // Ref to track typing state for use in timeout callbacks
32065
+ var typingRef = useRef(false);
32066
+ // Timeout ref for debouncing "stop typing" events
32067
+ var stopTypingTimeoutRef = useRef(null);
32166
32068
  var chatServer = useContext(ChatServerContext);
32167
32069
  var patternsConfig = (_q = (_p = props.config) === null || _p === void 0 ? void 0 : _p.autoOpenOnPattern) === null || _q === void 0 ? void 0 : _q.patterns;
32168
32070
  var currentUrl = window.location.href;
@@ -32197,6 +32099,10 @@ var ChatWidget = function (props) {
32197
32099
  }
32198
32100
  return function () {
32199
32101
  document.removeEventListener("keydown", handleKeyDown);
32102
+ // Cleanup typing timeout on unmount
32103
+ if (stopTypingTimeoutRef.current) {
32104
+ clearTimeout(stopTypingTimeoutRef.current);
32105
+ }
32200
32106
  };
32201
32107
  // eslint-disable-next-line react-hooks/exhaustive-deps
32202
32108
  }, []);
@@ -32253,19 +32159,34 @@ var ChatWidget = function (props) {
32253
32159
  chatState.visuals.opened,
32254
32160
  mode,
32255
32161
  ]);
32256
- function handleOnChange() {
32257
- if (!typing) {
32258
- dispatch(sendTyping(true));
32259
- setTypingState(true);
32260
- }
32261
- stopTyping();
32262
- }
32263
- function stopTyping() {
32264
- if (!typing)
32162
+ var stopTyping = useCallback(function () {
32163
+ if (!typingRef.current)
32265
32164
  return;
32165
+ // Clear the timeout if it exists
32166
+ if (stopTypingTimeoutRef.current) {
32167
+ clearTimeout(stopTypingTimeoutRef.current);
32168
+ stopTypingTimeoutRef.current = null;
32169
+ }
32266
32170
  dispatch(sendTyping(false));
32267
32171
  setTypingState(false);
32268
- }
32172
+ typingRef.current = false;
32173
+ }, [dispatch]);
32174
+ var handleOnChange = useCallback(function () {
32175
+ // Send "typing" event only on first keystroke
32176
+ if (!typingRef.current) {
32177
+ dispatch(sendTyping(true));
32178
+ setTypingState(true);
32179
+ typingRef.current = true;
32180
+ }
32181
+ // Clear any existing timeout
32182
+ if (stopTypingTimeoutRef.current) {
32183
+ clearTimeout(stopTypingTimeoutRef.current);
32184
+ }
32185
+ // Set a new timeout to send "stop typing" after inactivity
32186
+ stopTypingTimeoutRef.current = window.setTimeout(function () {
32187
+ stopTyping();
32188
+ }, TYPING_INDICATOR_DEBOUNCE_MS);
32189
+ }, [dispatch, stopTyping]);
32269
32190
  function handleSendMessage(msg) {
32270
32191
  dispatch(sendMessage(msg));
32271
32192
  }
@@ -32417,20 +32338,7 @@ var ChatWidget = function (props) {
32417
32338
  avatarPath: config.avatarUrl,
32418
32339
  display_name: "Agent",
32419
32340
  };
32420
- return (React$1.createElement(React$1.Fragment, null,
32421
- React$1.createElement("div", { className: "widget-container ".concat(modeClass, " ").concat(getVisibilityClass()) },
32422
- React$1.createElement(WidgetStylesheet, { theme: config === null || config === void 0 ? void 0 : config.theme }),
32423
- React$1.createElement(ChatHeader, { accountStatus: chatState.accountStatus, refreshOnClick: handleRestartClick, minimizeOnClick: handleMinimizeClick, cancelOnClick: handleCancelClick, agent: widgetAgent, canRefresh: canRefresh, canMinimize: canMinimize, canCancel: canCancel, config: config === null || config === void 0 ? void 0 : config.header, menuConfig: config.menu, onSubmit: handleOnSubmit }),
32424
- React$1.createElement(MessageList, { visible: visible, queuePosition: chatState.queuePosition, isChatting: chatState.isChatting, isOffline: isOffline, messages: messages, agents: chatState.agents, agent: config === null || config === void 0 ? void 0 : config.agent, lastRatingRequestTimestamp: chatState.lastRatingRequestTimestamp, hasRating: chatState.hasRating, visitorId: chatState.visitorId, hasWsButton: !!chatState.wsButton, messageMiddleware: props.messageMiddleware, textTypingStatusEnabled: (_w = (_v = props.config) === null || _v === void 0 ? void 0 : _v.typingStatus) === null || _w === void 0 ? void 0 : _w.textTypingStatusEnabled, onSend: handleSendMessage, onWrite: handleWriteMessage, onOpenUrl: handleOpenUrl, minimizeOnClick: handleMinimizeClick }),
32425
- React$1.createElement("div", { className: "xa-spinner-container ".concat(visible && connectionStatus === "pending" ? "visible" : "") },
32426
- React$1.createElement("div", { className: "xa-spinner" })),
32427
- connectionStatus === "offline" && React$1.createElement(ServerOffline, null),
32428
- chatState.wsButton && visible && (React$1.createElement(WsButton, { button: chatState.wsButton, onPress: handleWsButtonPress })),
32429
- React$1.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, sendButtonIconHover: (_1 = (_0 = config === null || config === void 0 ? void 0 : config.footer) === null || _0 === void 0 ? void 0 : _0.sendButton) === null || _1 === void 0 ? void 0 : _1.iconHover, sendButtonIconDisabled: (_3 = (_2 = config === null || config === void 0 ? void 0 : config.footer) === null || _2 === void 0 ? void 0 : _2.sendButton) === null || _3 === void 0 ? void 0 : _3.iconDisabled, visible: visible, hasWsButton: !!chatState.wsButton, menuConfig: props.config.menu, footerConfig: (_4 = props.config) === null || _4 === void 0 ? void 0 : _4.footer, inputConfig: (_5 = props.config) === null || _5 === void 0 ? void 0 : _5.input, onChange: handleOnChange, onSubmit: handleOnSubmit, onFileUpload: handleFileUpload }),
32430
- React$1.createElement("div", { className: "restartModal", ref: modalRef, onClick: handleRestartModalCloseClick },
32431
- React$1.createElement(ModalContent, { onClose: handleRestartModalCloseClick, onReset: handleReset }))),
32432
- React$1.createElement(ChatButton, { addClass: getVisibilityClass(), onClick: chatButtonOnClick, config: config === null || config === void 0 ? void 0 : config.cta, imageUrl: (_6 = config === null || config === void 0 ? void 0 : config.chatButton) === null || _6 === void 0 ? void 0 : _6.imageUrl, visible: visible, hasInteracted: (_7 = chatState.visuals) === null || _7 === void 0 ? void 0 : _7.hasInteracted, onCtaDismiss: handleCtaDismiss }),
32433
- React$1.createElement(ErrorOverlay, { enableErrorOverlay: config === null || config === void 0 ? void 0 : config.enableErrorOverlay })));
32341
+ return (jsxs(Fragment, { children: [jsxs("div", { className: "widget-container ".concat(modeClass, " ").concat(getVisibilityClass()), children: [jsx(WidgetStylesheet, { theme: config === null || config === void 0 ? void 0 : config.theme }), jsx(ChatHeader, { accountStatus: chatState.accountStatus, refreshOnClick: handleRestartClick, minimizeOnClick: handleMinimizeClick, cancelOnClick: handleCancelClick, agent: widgetAgent, canRefresh: canRefresh, canMinimize: canMinimize, canCancel: canCancel, config: config === null || config === void 0 ? void 0 : config.header, menuConfig: config.menu, onSubmit: handleOnSubmit }), jsx(MessageList, { visible: visible, queuePosition: chatState.queuePosition, isChatting: chatState.isChatting, isOffline: isOffline, messages: messages, agents: chatState.agents, agent: config === null || config === void 0 ? void 0 : config.agent, lastRatingRequestTimestamp: chatState.lastRatingRequestTimestamp, hasRating: chatState.hasRating, visitorId: chatState.visitorId, hasWsButton: !!chatState.wsButton, messageMiddleware: props.messageMiddleware, textTypingStatusEnabled: (_w = (_v = props.config) === null || _v === void 0 ? void 0 : _v.typingStatus) === null || _w === void 0 ? void 0 : _w.textTypingStatusEnabled, onSend: handleSendMessage, onWrite: handleWriteMessage, onOpenUrl: handleOpenUrl, minimizeOnClick: handleMinimizeClick }), jsx("div", { className: "xa-spinner-container ".concat(visible && connectionStatus === "pending" ? "visible" : ""), children: jsx("div", { className: "xa-spinner" }) }), connectionStatus === "offline" && jsx(ServerOffline, {}), chatState.wsButton && visible && (jsx(WsButton, { button: chatState.wsButton, onPress: handleWsButtonPress })), jsx(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, sendButtonIconHover: (_1 = (_0 = config === null || config === void 0 ? void 0 : config.footer) === null || _0 === void 0 ? void 0 : _0.sendButton) === null || _1 === void 0 ? void 0 : _1.iconHover, sendButtonIconDisabled: (_3 = (_2 = config === null || config === void 0 ? void 0 : config.footer) === null || _2 === void 0 ? void 0 : _2.sendButton) === null || _3 === void 0 ? void 0 : _3.iconDisabled, visible: visible, hasWsButton: !!chatState.wsButton, menuConfig: props.config.menu, footerConfig: (_4 = props.config) === null || _4 === void 0 ? void 0 : _4.footer, inputConfig: (_5 = props.config) === null || _5 === void 0 ? void 0 : _5.input, onChange: handleOnChange, onSubmit: handleOnSubmit, onFileUpload: handleFileUpload }), jsx("div", { className: "restartModal", ref: modalRef, onClick: handleRestartModalCloseClick, children: jsx(ModalContent, { onClose: handleRestartModalCloseClick, onReset: handleReset }) })] }), jsx(ChatButton, { addClass: getVisibilityClass(), onClick: chatButtonOnClick, config: config === null || config === void 0 ? void 0 : config.cta, imageUrl: (_6 = config === null || config === void 0 ? void 0 : config.chatButton) === null || _6 === void 0 ? void 0 : _6.imageUrl, visible: visible, hasInteracted: (_7 = chatState.visuals) === null || _7 === void 0 ? void 0 : _7.hasInteracted, onCtaDismiss: handleCtaDismiss }), jsx(ErrorOverlay, { enableErrorOverlay: config === null || config === void 0 ? void 0 : config.enableErrorOverlay })] }));
32434
32342
  };
32435
32343
 
32436
32344
  // src/utils/formatProdErrorMessage.ts
@@ -33747,15 +33655,23 @@ function memberJoin(state, detail) {
33747
33655
  // }
33748
33656
  var agents = __assign({}, state.agents);
33749
33657
  var prevAgentInfo = state.agents[detail.user.nick];
33750
- agents[detail.user.nick] = __assign(__assign({}, prevAgentInfo), { user: __assign(__assign({}, detail.user), { displayName: detail.user.displayName || "Agent" }), joined: true, typing: false });
33658
+ agents[detail.user.nick] = __assign(__assign({}, prevAgentInfo), { user: __assign(__assign({}, detail.user), { displayName: detail.user.displayName || "Agent" }), joined: true, typing: false, hideUserInfo: detail.hideUserInfo });
33751
33659
  if (isAgent(detail.user.nick)) {
33752
- if (prevAgentInfo === null || prevAgentInfo === void 0 ? void 0 : prevAgentInfo.joined) {
33660
+ // Always show join messages with special visual features (divider or custom message)
33661
+ // These are important conversation markers, not routine join notifications
33662
+ var hasSpecialVisuals = detail.showDivider || detail.message;
33663
+ if ((prevAgentInfo === null || prevAgentInfo === void 0 ? void 0 : prevAgentInfo.joined) && !hasSpecialVisuals) {
33753
33664
  log("DEDUPLICATION: Agent \"".concat(detail.user.displayName || "Unknown", "\" (nick: ").concat(detail.user.nick, ") already joined. NOT adding duplicate join message to chat."));
33754
33665
  }
33755
33666
  else {
33756
- log("Agent \"".concat(detail.user.displayName || "Unknown", "\" (nick: ").concat(detail.user.nick, ") is joining. Adding join message to chat."));
33667
+ if (hasSpecialVisuals) {
33668
+ log("Agent \"".concat(detail.user.displayName || "Unknown", "\" (nick: ").concat(detail.user.nick, ") is joining with special visuals (divider or custom message). Adding join message to chat."));
33669
+ }
33670
+ else {
33671
+ log("Agent \"".concat(detail.user.displayName || "Unknown", "\" (nick: ").concat(detail.user.nick, ") is joining. Adding join message to chat."));
33672
+ }
33757
33673
  }
33758
- return __assign(__assign({}, state), { isChatting: true, chats: (prevAgentInfo === null || prevAgentInfo === void 0 ? void 0 : prevAgentInfo.joined) ? state.chats : joinMessages(state.chats, detail), agents: agents });
33674
+ return __assign(__assign({}, state), { isChatting: true, chats: ((prevAgentInfo === null || prevAgentInfo === void 0 ? void 0 : prevAgentInfo.joined) && !hasSpecialVisuals) ? state.chats : joinMessages(state.chats, detail), agents: agents });
33759
33675
  }
33760
33676
  else {
33761
33677
  log("Non-agent member \"".concat(detail.user.displayName || "Unknown", "\" (nick: ").concat(detail.user.nick, ") is joining. Adding join message to chat."));
@@ -33771,9 +33687,22 @@ function memberLeave(state, detail) {
33771
33687
  var agentsJoined = Object.values(agents).filter(function (agent) { return agent.joined; });
33772
33688
  var isChatting = agentsJoined.length > 0;
33773
33689
  if (isAgent(detail.user.nick)) {
33690
+ var hasSpecialVisuals = detail.showDivider || detail.message;
33691
+ if (prevAgentInfo === null || prevAgentInfo === void 0 ? void 0 : prevAgentInfo.joined) {
33692
+ if (hasSpecialVisuals) {
33693
+ log("Agent \"".concat(detail.user.displayName || "Unknown", "\" (nick: ").concat(detail.user.nick, ") is leaving with special visuals (divider or custom message). Adding leave message to chat."));
33694
+ }
33695
+ else {
33696
+ log("Agent \"".concat(detail.user.displayName || "Unknown", "\" (nick: ").concat(detail.user.nick, ") is leaving. Adding leave message to chat."));
33697
+ }
33698
+ }
33699
+ else {
33700
+ log("DEDUPLICATION: Agent \"".concat(detail.user.displayName || "Unknown", "\" (nick: ").concat(detail.user.nick, ") already left. NOT adding duplicate leave message to chat."));
33701
+ }
33774
33702
  return __assign(__assign({}, state), { isChatting: isChatting, chats: (prevAgentInfo === null || prevAgentInfo === void 0 ? void 0 : prevAgentInfo.joined) ? joinMessages(state.chats, detail) : state.chats, agents: agents });
33775
33703
  }
33776
33704
  else {
33705
+ log("Non-agent member \"".concat(detail.user.displayName || "Unknown", "\" (nick: ").concat(detail.user.nick, ") is leaving. Adding leave message to chat."));
33777
33706
  return __assign(__assign({}, state), { isChatting: isChatting, chats: joinMessages(state.chats, detail), agents: agents });
33778
33707
  }
33779
33708
  }
@@ -33799,6 +33728,10 @@ function resetReducer(state) {
33799
33728
  visuals: {} });
33800
33729
  }
33801
33730
 
33731
+ // Type guard for ChatSystemMessageDetail
33732
+ function isChatSystemMessage(chat) {
33733
+ return chat.type === "chat.systemmessage";
33734
+ }
33802
33735
  // todo: create reducer (requires redux-thunk dependency)
33803
33736
  function appendMessageToState(state, msg) {
33804
33737
  state.chats = joinMessages(state.chats, msg);
@@ -33867,6 +33800,20 @@ function update(state, action) {
33867
33800
  return memberJoin(state, action.detail);
33868
33801
  case "chat.memberleave":
33869
33802
  return memberLeave(state, action.detail);
33803
+ case "chat.systemmessage":
33804
+ // Add the system message to the chat
33805
+ appendMessageToState(newState, action.detail);
33806
+ return newState;
33807
+ case "chat.systemmessagedismiss":
33808
+ // Remove system message(s) with the specified id
33809
+ var dismissId_1 = action.detail.id;
33810
+ return __assign(__assign({}, newState), { chats: newState.chats.filter(function (chat) {
33811
+ // Keep all non-system messages, and system messages that don't match the id
33812
+ if (isChatSystemMessage(chat)) {
33813
+ return chat.id !== dismissId_1;
33814
+ }
33815
+ return true;
33816
+ }) });
33870
33817
  case "chat.queue.position":
33871
33818
  newState.queuePosition = action.detail.queuePosition;
33872
33819
  return newState;
@@ -34058,12 +34005,11 @@ var ChatWidgetContainer = function (props) {
34058
34005
  });
34059
34006
  }, [connection, (_a = props.config) === null || _a === void 0 ? void 0 : _a.userId, (_b = props.config) === null || _b === void 0 ? void 0 : _b.accessToken, (_c = props.config) === null || _c === void 0 ? void 0 : _c.attributes, (_d = props.config) === null || _d === void 0 ? void 0 : _d.sessionExpiration, (_e = props.config) === null || _e === void 0 ? void 0 : _e.enableErrorOverlay]);
34060
34007
  if ((_f = props.config) === null || _f === void 0 ? void 0 : _f.disabled) {
34061
- return React$1.createElement(React$1.Fragment, null);
34008
+ return jsx(Fragment, {});
34062
34009
  }
34063
34010
  var widgetProps = __assign(__assign({}, props), { messageMiddleware: messageMiddleware, getConfig: props.getConfig // Pass through getConfig callback
34064
34011
  });
34065
- return (React$1.createElement(Provider, { store: chatStore },
34066
- React$1.createElement(ChatWidgetWrapper, __assign({}, widgetProps))));
34012
+ return (jsx(Provider, { store: chatStore, children: jsx(ChatWidgetWrapper, __assign({}, widgetProps)) }));
34067
34013
  };
34068
34014
 
34069
34015
  // Function to create a static reducer
@@ -34097,11 +34043,10 @@ var StaticChatWidgetContainer = function (props) {
34097
34043
  var config = useMemo(function () {
34098
34044
  return __assign(__assign({}, props.config), { connection: {
34099
34045
  serverUrl: "",
34100
- type: "local"
34046
+ type: "local",
34101
34047
  } });
34102
34048
  }, [props.config]);
34103
- return (React$1.createElement(Provider, { store: store },
34104
- React$1.createElement(ChatWidgetWrapper, __assign({}, props, { config: config }))));
34049
+ return (jsx(Provider, { store: store, children: jsx(ChatWidgetWrapper, __assign({}, props, { config: config })) }));
34105
34050
  };
34106
34051
 
34107
34052
  function createStateFromMessages(messages) {
@@ -34114,7 +34059,7 @@ var StaticMessagesChatWidgetContainer = function (props) {
34114
34059
  var state = useMemo(function () {
34115
34060
  return createStateFromMessages(messages);
34116
34061
  }, [messages]);
34117
- return (React$1.createElement(StaticChatWidgetContainer, { state: state, mode: props.mode, config: props.config }));
34062
+ return jsx(StaticChatWidgetContainer, { state: state, mode: props.mode, config: props.config });
34118
34063
  };
34119
34064
 
34120
34065
  export { ActionButton, Avatar, CardMiddleware, Carousel, CarouselItem, ChatWidgetContainer as Chat, ChatButton, ChatCard, ChatChip, ChatChips, ChatHeader, ChatMenu, ChatMessage, ChatMessageBubble, ChatMessagePart, ChatWidgetWrapper as ChatWidget, CtaBubble, CtaBubbleContainer, List, ListItem, ListMiddleware, MessageList, MiddlewareContextFactory, StaticChatWidgetContainer, StaticMessagesChatWidgetContainer, joinMiddlewares, responseToMessage, useLateMiddleware, useStandardMiddleware };