@xapp/chat-widget 1.29.2 → 1.30.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
@@ -2230,7 +2230,7 @@ function getOutput(value) {
2230
2230
  * @returns
2231
2231
  */
2232
2232
  function responseToMessage(botResponse, now) {
2233
- var _a, _b, _c, _d;
2233
+ var _a, _b, _c, _d, _e;
2234
2234
  if (now === void 0) { now = new Date().getTime(); }
2235
2235
  var responseMessage;
2236
2236
  if (!botResponse) {
@@ -2276,24 +2276,20 @@ function responseToMessage(botResponse, now) {
2276
2276
  if (html) {
2277
2277
  responseMessage.msg = __assign(__assign({}, responseMessage.msg), { html: html });
2278
2278
  }
2279
- if (text || html) {
2280
- responseMessage.msg.options = [];
2281
- if (outputSpeech.suggestions && outputSpeech.suggestions.length > 0) {
2282
- for (var _i = 0, _e = outputSpeech.suggestions; _i < _e.length; _i++) {
2283
- var suggestion = _e[_i];
2284
- if (typeof suggestion === "string") {
2285
- // Simple chips (strings)
2286
- responseMessage.msg.options.push(suggestion);
2287
- }
2288
- else {
2289
- // "call out" chips
2290
- responseMessage.msg.options.push({
2291
- label: suggestion.title,
2292
- actionUrl: suggestion.url
2293
- });
2294
- }
2279
+ if ((_e = outputSpeech.suggestions) === null || _e === void 0 ? void 0 : _e.length) {
2280
+ responseMessage.msg.options = outputSpeech.suggestions.map(function (suggestion) {
2281
+ if (typeof suggestion === "string") {
2282
+ // Simple chips (strings)
2283
+ return suggestion;
2295
2284
  }
2296
- }
2285
+ else {
2286
+ // "call out" chips
2287
+ return {
2288
+ label: suggestion.title,
2289
+ actionUrl: suggestion.url
2290
+ };
2291
+ }
2292
+ });
2297
2293
  }
2298
2294
  }
2299
2295
  return responseMessage;
@@ -7242,9 +7238,9 @@ var SuggestionsItem = function (props) {
7242
7238
  }, [data, onHover]);
7243
7239
  var formats = React.useMemo(function () { return mapFormat$1(data.format, suggestion.length); }, [data.format, suggestion]);
7244
7240
  var canUse = data.type !== "FAQ";
7245
- return (React__default["default"].createElement("div", { className: "xappw-suggestions-item " + (props.current ? "xappw-suggestions-item--current" : ""), onClick: handleClick, onMouseEnter: handleHover },
7246
- React__default["default"].createElement("div", { className: "xappw-suggestions-item__texts" }, formats.map(function (format, index) { return (React__default["default"].createElement("span", { className: "xappw-suggestions-item__text xappw-suggestions-item__text--" + format.type, key: index }, suggestion.substring(format.start, format.end))); })),
7247
- canUse && React__default["default"].createElement(IconButton, { className: "xappw-suggestions-item__use", onClick: handleUse, icon: LeftDownArrowIcon })));
7241
+ return (React__default["default"].createElement("div", { className: "xapp-suggestions-item " + (props.current ? "xapp-suggestions-item--current" : ""), onClick: handleClick, onMouseEnter: handleHover },
7242
+ React__default["default"].createElement("div", { className: "xapp-suggestions-item__texts" }, formats.map(function (format, index) { return (React__default["default"].createElement("span", { className: "xapp-suggestions-item__text xapp-suggestions-item__text--" + format.type, key: index }, suggestion.substring(format.start, format.end))); })),
7243
+ canUse && React__default["default"].createElement(IconButton, { className: "xapp-suggestions-item__use", onClick: handleUse, icon: LeftDownArrowIcon })));
7248
7244
  };
7249
7245
 
7250
7246
  function getLabel(type) {