@xapp/chat-widget 1.76.0 → 1.77.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -64,7 +64,7 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
64
64
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
65
65
  PERFORMANCE OF THIS SOFTWARE.
66
66
  ***************************************************************************** */
67
- /* global Reflect, Promise, SuppressedError, Symbol */
67
+ /* global Reflect, Promise, SuppressedError, Symbol, Iterator */
68
68
 
69
69
 
70
70
  var __assign = function() {
@@ -101,8 +101,8 @@ function __awaiter$1(thisArg, _arguments, P, generator) {
101
101
  }
102
102
 
103
103
  function __generator$1(thisArg, body) {
104
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
105
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
104
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
105
+ return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
106
106
  function verb(n) { return function (v) { return step([n, v]); }; }
107
107
  function step(op) {
108
108
  if (f) throw new TypeError("Generator is already executing.");
@@ -797,7 +797,7 @@ var ChatButton = function (_a) {
797
797
  };
798
798
  }, [mobileWidth]);
799
799
  var maxSvgSize = 22;
800
- var svgSize = Math.min(maxSvgSize, (+buttonWidth / 48) * maxSvgSize);
800
+ var svgSize = Math.min(maxSvgSize, (+buttonWidth / +defaultWidgetButtonWidth) * maxSvgSize);
801
801
  return (React$1.createElement("button", { "aria-label": "open chat", className: "xapp-chat-button ".concat(addClass || "").trim(), onClick: onClick },
802
802
  React$1.createElement("div", { id: "xapp-widget-button", className: "xapp-chat-button__btn", style: {
803
803
  width: "".concat(buttonWidth, "px"),
@@ -1676,7 +1676,7 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
1676
1676
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
1677
1677
  PERFORMANCE OF THIS SOFTWARE.
1678
1678
  ***************************************************************************** */
1679
- /* global Reflect, Promise, SuppressedError, Symbol */
1679
+ /* global Reflect, Promise, SuppressedError, Symbol, Iterator */
1680
1680
 
1681
1681
 
1682
1682
  function __awaiter(thisArg, _arguments, P, generator) {
@@ -1690,8 +1690,8 @@ function __awaiter(thisArg, _arguments, P, generator) {
1690
1690
  }
1691
1691
 
1692
1692
  function __generator(thisArg, body) {
1693
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
1694
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
1693
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
1694
+ return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
1695
1695
  function verb(n) { return function (v) { return step([n, v]); }; }
1696
1696
  function step(op) {
1697
1697
  if (f) throw new TypeError("Generator is already executing.");
@@ -9231,11 +9231,11 @@ var _typeof = {exports: {}};
9231
9231
  function _typeof(o) {
9232
9232
  "@babel/helpers - typeof";
9233
9233
 
9234
- return (module.exports = _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
9234
+ return module.exports = _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
9235
9235
  return typeof o;
9236
9236
  } : function (o) {
9237
9237
  return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
9238
- }, module.exports.__esModule = true, module.exports["default"] = module.exports), _typeof(o);
9238
+ }, module.exports.__esModule = true, module.exports["default"] = module.exports, _typeof(o);
9239
9239
  }
9240
9240
  module.exports = _typeof, module.exports.__esModule = true, module.exports["default"] = module.exports;
9241
9241
  } (_typeof));
@@ -19783,9 +19783,9 @@ var setPrototypeOf = {exports: {}};
19783
19783
 
19784
19784
  (function (module) {
19785
19785
  function _setPrototypeOf(t, e) {
19786
- return (module.exports = _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) {
19786
+ return module.exports = _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) {
19787
19787
  return t.__proto__ = e, t;
19788
- }, module.exports.__esModule = true, module.exports["default"] = module.exports), _setPrototypeOf(t, e);
19788
+ }, module.exports.__esModule = true, module.exports["default"] = module.exports, _setPrototypeOf(t, e);
19789
19789
  }
19790
19790
  module.exports = _setPrototypeOf, module.exports.__esModule = true, module.exports["default"] = module.exports;
19791
19791
  } (setPrototypeOf));
@@ -19817,9 +19817,9 @@ var getPrototypeOf = {exports: {}};
19817
19817
 
19818
19818
  (function (module) {
19819
19819
  function _getPrototypeOf(t) {
19820
- return (module.exports = _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) {
19820
+ return module.exports = _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) {
19821
19821
  return t.__proto__ || Object.getPrototypeOf(t);
19822
- }, module.exports.__esModule = true, module.exports["default"] = module.exports), _getPrototypeOf(t);
19822
+ }, module.exports.__esModule = true, module.exports["default"] = module.exports, _getPrototypeOf(t);
19823
19823
  }
19824
19824
  module.exports = _getPrototypeOf, module.exports.__esModule = true, module.exports["default"] = module.exports;
19825
19825
  } (getPrototypeOf));
@@ -30935,7 +30935,7 @@ var defaultProps = {
30935
30935
  onSend: function () { return Promise.resolve(); },
30936
30936
  onWrite: function () { return Promise.resolve(); },
30937
30937
  onOpenUrl: function () { },
30938
- minimizeOnClick: function () { }
30938
+ minimizeOnClick: function () { },
30939
30939
  };
30940
30940
  var MessageList = function (props) {
30941
30941
  if (props === void 0) { props = defaultProps; }
@@ -30952,13 +30952,15 @@ var MessageList = function (props) {
30952
30952
  onWrite(msg);
30953
30953
  messagesEndRef.current.scrollIntoView({ behavior: "smooth" });
30954
30954
  }, [onWrite]);
30955
- var ctxCache = React$1.useMemo(function () { return new MiddlewareContextFactory({
30956
- send: handleSend,
30957
- write: handleWrite,
30958
- openUrl: onOpenUrl
30959
- }); }, [handleSend, handleWrite, onOpenUrl]);
30955
+ var ctxCache = React$1.useMemo(function () {
30956
+ return new MiddlewareContextFactory({
30957
+ send: handleSend,
30958
+ write: handleWrite,
30959
+ openUrl: onOpenUrl,
30960
+ });
30961
+ }, [handleSend, handleWrite, onOpenUrl]);
30960
30962
  var date = new Date();
30961
- var time = date.getHours() + ':' + date.getMinutes();
30963
+ var time = date.getHours() + ":" + date.getMinutes();
30962
30964
  /**
30963
30965
  * Render the message based on widget state or message type. offline and pre chat are pseudo messages.
30964
30966
  *
@@ -31027,7 +31029,7 @@ var MessageList = function (props) {
31027
31029
  // if (next && next.type === message.type && currentNick && currentNick === prevNick) {
31028
31030
  // sibling = true;
31029
31031
  // }
31030
- // Message types that will show time
31032
+ // Message types that will show time
31031
31033
  var tsTypes = [
31032
31034
  "chat.file",
31033
31035
  "chat.msg",
@@ -31038,7 +31040,7 @@ var MessageList = function (props) {
31038
31040
  // "chat.typing",
31039
31041
  "chat.request.rating",
31040
31042
  "chat.offline",
31041
- "chat.prechat"
31043
+ "chat.prechat",
31042
31044
  ];
31043
31045
  // show first and las TS and after at least 5 minutes gap. Don't show "router user"
31044
31046
  var showTs = false;
@@ -31049,10 +31051,14 @@ var MessageList = function (props) {
31049
31051
  else {
31050
31052
  var previous = props.messages[index - 1];
31051
31053
  if (message.timestamp && previous.timestamp) {
31052
- showTs = (message.timestamp - previous.timestamp) > 300 * 1000; // 5 minutes
31054
+ showTs = message.timestamp - previous.timestamp > 300 * 1000; // 5 minutes
31053
31055
  }
31054
31056
  }
31055
31057
  }
31058
+ // we also don't showTs if it is the very first message in the list & it is a chat.memberjoin
31059
+ if (index === 0 && message.type === "chat.memberjoin") {
31060
+ showTs = false;
31061
+ }
31056
31062
  var ts = showTs ? new Date(message.timestamp).toLocaleString() : undefined;
31057
31063
  return (React$1.createElement("span", { key: "message-list-render-all-".concat(index) },
31058
31064
  showTs && (React$1.createElement("div", { className: "ts-msg-container" },
@@ -32008,6 +32014,7 @@ function configureStore(options) {
32008
32014
  reducer = void 0,
32009
32015
  middleware,
32010
32016
  devTools = true,
32017
+ duplicateMiddlewareCheck = true,
32011
32018
  preloadedState = void 0,
32012
32019
  enhancers = void 0
32013
32020
  } = options || {};