instantsearch.js 4.79.2 → 4.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 (69) hide show
  1. package/cjs/components/Template/Template.js +1 -1
  2. package/cjs/connectors/chat/connectChat.js +200 -0
  3. package/cjs/connectors/index.js +7 -0
  4. package/cjs/connectors/index.umd.js +239 -0
  5. package/cjs/index.js +2 -2
  6. package/cjs/lib/InstantSearch.js +2 -10
  7. package/cjs/lib/chat/chat.js +177 -0
  8. package/cjs/lib/chat/index.js +27 -0
  9. package/cjs/lib/useStickToBottom.js +20 -0
  10. package/cjs/lib/version.js +1 -1
  11. package/cjs/templates/carousel/carousel.js +31 -4
  12. package/cjs/widgets/chat/chat.js +615 -0
  13. package/cjs/widgets/index/index.js +78 -24
  14. package/cjs/widgets/index.js +7 -0
  15. package/cjs/widgets/index.umd.js +267 -0
  16. package/dist/instantsearch.development.d.ts +123 -15
  17. package/dist/instantsearch.development.js +186 -91
  18. package/dist/instantsearch.development.js.map +1 -1
  19. package/dist/instantsearch.production.d.ts +123 -15
  20. package/dist/instantsearch.production.min.d.ts +123 -15
  21. package/dist/instantsearch.production.min.js +2 -2
  22. package/dist/instantsearch.production.min.js.map +1 -1
  23. package/es/components/Template/Template.js +1 -1
  24. package/es/connectors/chat/connectChat.d.ts +413 -0
  25. package/es/connectors/chat/connectChat.js +194 -0
  26. package/es/connectors/frequently-bought-together/connectFrequentlyBoughtTogether.d.ts +2 -0
  27. package/es/connectors/geo-search/connectGeoSearch.d.ts +1 -0
  28. package/es/connectors/hits/connectHits.d.ts +1 -0
  29. package/es/connectors/hits/connectHitsWithInsights.d.ts +1 -0
  30. package/es/connectors/index.d.ts +1 -0
  31. package/es/connectors/index.js +2 -1
  32. package/es/connectors/index.umd.d.ts +39 -0
  33. package/es/connectors/index.umd.js +47 -0
  34. package/es/connectors/infinite-hits/connectInfiniteHits.d.ts +1 -0
  35. package/es/connectors/infinite-hits/connectInfiniteHitsWithInsights.d.ts +1 -0
  36. package/es/connectors/looking-similar/connectLookingSimilar.d.ts +2 -0
  37. package/es/connectors/related-products/connectRelatedProducts.d.ts +2 -0
  38. package/es/connectors/trending-items/connectTrendingItems.d.ts +2 -0
  39. package/es/lib/InstantSearch.d.ts +2 -2
  40. package/es/lib/InstantSearch.js +2 -10
  41. package/es/lib/chat/chat.d.ts +40 -0
  42. package/es/lib/chat/chat.js +166 -0
  43. package/es/lib/chat/index.d.ts +7 -0
  44. package/es/lib/chat/index.js +5 -0
  45. package/es/lib/useStickToBottom.d.ts +1 -0
  46. package/es/lib/useStickToBottom.js +14 -0
  47. package/es/lib/version.d.ts +1 -1
  48. package/es/lib/version.js +1 -1
  49. package/es/templates/carousel/carousel.d.ts +10 -3
  50. package/es/templates/carousel/carousel.js +32 -5
  51. package/es/types/render-state.d.ts +2 -1
  52. package/es/types/templates.d.ts +1 -1
  53. package/es/types/widget.d.ts +2 -2
  54. package/es/widgets/chat/chat.d.ts +555 -0
  55. package/es/widgets/chat/chat.js +597 -0
  56. package/es/widgets/frequently-bought-together/frequently-bought-together.d.ts +3 -1
  57. package/es/widgets/geo-search/geo-search.d.ts +1 -0
  58. package/es/widgets/hits/hits.d.ts +1 -0
  59. package/es/widgets/index/index.d.ts +46 -2
  60. package/es/widgets/index/index.js +78 -24
  61. package/es/widgets/index.d.ts +1 -0
  62. package/es/widgets/index.js +2 -1
  63. package/es/widgets/index.umd.d.ts +44 -0
  64. package/es/widgets/index.umd.js +51 -0
  65. package/es/widgets/infinite-hits/infinite-hits.d.ts +1 -0
  66. package/es/widgets/looking-similar/looking-similar.d.ts +3 -1
  67. package/es/widgets/related-products/related-products.d.ts +3 -1
  68. package/es/widgets/trending-items/trending-items.d.ts +3 -1
  69. package/package.json +11 -7
@@ -0,0 +1,177 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "AbstractChat", {
7
+ enumerable: true,
8
+ get: function get() {
9
+ return _ai.AbstractChat;
10
+ }
11
+ });
12
+ exports.ChatState = exports.Chat = exports.CACHE_KEY = void 0;
13
+ var _ai = require("ai");
14
+ var _excluded = ["messages", "agentId"];
15
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
16
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
17
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
18
+ function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
19
+ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
20
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
21
+ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
22
+ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
23
+ function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
24
+ function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
25
+ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
26
+ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
27
+ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
28
+ function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
29
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
30
+ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
31
+ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
32
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
33
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
34
+ function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
35
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
36
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
37
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
38
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
39
+ var CACHE_KEY = exports.CACHE_KEY = 'instantsearch-chat-initial-messages-';
40
+ function getDefaultInitialMessages(id) {
41
+ var initialMessages = sessionStorage.getItem(CACHE_KEY + id);
42
+ return initialMessages ? JSON.parse(initialMessages) : [];
43
+ }
44
+ var ChatState = exports.ChatState = /*#__PURE__*/function () {
45
+ function ChatState() {
46
+ var _this = this;
47
+ var id = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : undefined;
48
+ var initialMessages = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : getDefaultInitialMessages(id);
49
+ _classCallCheck(this, ChatState);
50
+ _defineProperty(this, "_messages", void 0);
51
+ _defineProperty(this, "_status", 'ready');
52
+ _defineProperty(this, "_error", undefined);
53
+ _defineProperty(this, "_messagesCallbacks", new Set());
54
+ _defineProperty(this, "_statusCallbacks", new Set());
55
+ _defineProperty(this, "_errorCallbacks", new Set());
56
+ _defineProperty(this, "pushMessage", function (message) {
57
+ _this._messages = _this._messages.concat(message);
58
+ _this._callMessagesCallbacks();
59
+ });
60
+ _defineProperty(this, "popMessage", function () {
61
+ _this._messages = _this._messages.slice(0, -1);
62
+ _this._callMessagesCallbacks();
63
+ });
64
+ _defineProperty(this, "replaceMessage", function (index, message) {
65
+ _this._messages = [].concat(_toConsumableArray(_this._messages.slice(0, index)), [
66
+ // We deep clone the message here to ensure the new React Compiler (currently in RC) detects deeply nested parts/metadata changes:
67
+ _this.snapshot(message)], _toConsumableArray(_this._messages.slice(index + 1)));
68
+ _this._callMessagesCallbacks();
69
+ });
70
+ _defineProperty(this, "snapshot", function (thing) {
71
+ return JSON.parse(JSON.stringify(thing));
72
+ });
73
+ _defineProperty(this, '~registerMessagesCallback', function (onChange) {
74
+ var callback = onChange;
75
+ _this._messagesCallbacks.add(callback);
76
+ return function () {
77
+ _this._messagesCallbacks.delete(callback);
78
+ };
79
+ });
80
+ _defineProperty(this, '~registerStatusCallback', function (onChange) {
81
+ _this._statusCallbacks.add(onChange);
82
+ return function () {
83
+ _this._statusCallbacks.delete(onChange);
84
+ };
85
+ });
86
+ _defineProperty(this, '~registerErrorCallback', function (onChange) {
87
+ _this._errorCallbacks.add(onChange);
88
+ return function () {
89
+ _this._errorCallbacks.delete(onChange);
90
+ };
91
+ });
92
+ _defineProperty(this, "_callMessagesCallbacks", function () {
93
+ _this._messagesCallbacks.forEach(function (callback) {
94
+ return callback();
95
+ });
96
+ });
97
+ _defineProperty(this, "_callStatusCallbacks", function () {
98
+ _this._statusCallbacks.forEach(function (callback) {
99
+ return callback();
100
+ });
101
+ });
102
+ _defineProperty(this, "_callErrorCallbacks", function () {
103
+ _this._errorCallbacks.forEach(function (callback) {
104
+ return callback();
105
+ });
106
+ });
107
+ this._messages = initialMessages;
108
+ var saveMessagesInLocalStorage = function saveMessagesInLocalStorage() {
109
+ if (_this.status === 'ready') {
110
+ try {
111
+ sessionStorage.setItem(CACHE_KEY + id, JSON.stringify(_this.messages));
112
+ } catch (e) {
113
+ // Do nothing if sessionStorage is not available or full
114
+ }
115
+ }
116
+ };
117
+ this['~registerMessagesCallback'](saveMessagesInLocalStorage);
118
+ this['~registerStatusCallback'](saveMessagesInLocalStorage);
119
+ }
120
+ _createClass(ChatState, [{
121
+ key: "status",
122
+ get: function get() {
123
+ return this._status;
124
+ },
125
+ set: function set(newStatus) {
126
+ this._status = newStatus;
127
+ this._callStatusCallbacks();
128
+ }
129
+ }, {
130
+ key: "error",
131
+ get: function get() {
132
+ return this._error;
133
+ },
134
+ set: function set(newError) {
135
+ this._error = newError;
136
+ this._callErrorCallbacks();
137
+ }
138
+ }, {
139
+ key: "messages",
140
+ get: function get() {
141
+ return this._messages;
142
+ },
143
+ set: function set(newMessages) {
144
+ this._messages = _toConsumableArray(newMessages);
145
+ this._callMessagesCallbacks();
146
+ }
147
+ }]);
148
+ return ChatState;
149
+ }();
150
+ var Chat = exports.Chat = /*#__PURE__*/function (_AbstractChat) {
151
+ _inherits(Chat, _AbstractChat);
152
+ var _super = _createSuper(Chat);
153
+ function Chat(_ref) {
154
+ var _this2;
155
+ var messages = _ref.messages,
156
+ agentId = _ref.agentId,
157
+ init = _objectWithoutProperties(_ref, _excluded);
158
+ _classCallCheck(this, Chat);
159
+ var state = new ChatState(agentId, messages);
160
+ _this2 = _super.call(this, _objectSpread(_objectSpread({}, init), {}, {
161
+ state: state
162
+ }));
163
+ _defineProperty(_assertThisInitialized(_this2), "_state", void 0);
164
+ _defineProperty(_assertThisInitialized(_this2), '~registerMessagesCallback', function (onChange) {
165
+ return _this2._state['~registerMessagesCallback'](onChange);
166
+ });
167
+ _defineProperty(_assertThisInitialized(_this2), '~registerStatusCallback', function (onChange) {
168
+ return _this2._state['~registerStatusCallback'](onChange);
169
+ });
170
+ _defineProperty(_assertThisInitialized(_this2), '~registerErrorCallback', function (onChange) {
171
+ return _this2._state['~registerErrorCallback'](onChange);
172
+ });
173
+ _this2._state = state;
174
+ return _this2;
175
+ }
176
+ return _createClass(Chat);
177
+ }(_ai.AbstractChat);
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "AbstractChat", {
7
+ enumerable: true,
8
+ get: function get() {
9
+ return _chat.AbstractChat;
10
+ }
11
+ });
12
+ Object.defineProperty(exports, "Chat", {
13
+ enumerable: true,
14
+ get: function get() {
15
+ return _chat.Chat;
16
+ }
17
+ });
18
+ Object.defineProperty(exports, "ChatState", {
19
+ enumerable: true,
20
+ get: function get() {
21
+ return _chat.ChatState;
22
+ }
23
+ });
24
+ exports.SearchIndexToolType = exports.RecommendToolType = void 0;
25
+ var _chat = require("./chat");
26
+ var SearchIndexToolType = exports.SearchIndexToolType = 'algolia_search_index';
27
+ var RecommendToolType = exports.RecommendToolType = 'algolia_recommend';
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.useStickToBottom = void 0;
7
+ var _instantsearchUiComponents = require("instantsearch-ui-components");
8
+ var _hooks = require("preact/hooks");
9
+ /* !---------------------------------------------------------------------------------------------
10
+ * Copyright (c) StackBlitz. All rights reserved.
11
+ * Licensed under the MIT License. See License.txt in the project root for license information.
12
+ *--------------------------------------------------------------------------------------------*/
13
+
14
+ var useStickToBottom = exports.useStickToBottom = (0, _instantsearchUiComponents.createStickToBottom)({
15
+ useCallback: _hooks.useCallback,
16
+ useEffect: _hooks.useEffect,
17
+ useMemo: _hooks.useMemo,
18
+ useRef: _hooks.useRef,
19
+ useState: _hooks.useState
20
+ });
@@ -4,4 +4,4 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
- var _default = exports.default = '4.79.2';
7
+ var _default = exports.default = '4.81.0';
@@ -15,16 +15,34 @@ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key i
15
15
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
16
16
  function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
17
17
  function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
18
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
19
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
20
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
21
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
22
+ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
23
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
18
24
  var Carousel = (0, _instantsearchUiComponents.createCarouselComponent)({
19
25
  createElement: _preact2.h,
20
26
  Fragment: _preact2.Fragment
21
27
  });
22
28
  function CarouselWithRefs(props) {
29
+ var _useState = (0, _hooks.useState)(false),
30
+ _useState2 = _slicedToArray(_useState, 2),
31
+ canScrollLeft = _useState2[0],
32
+ setCanScrollLeft = _useState2[1];
33
+ var _useState3 = (0, _hooks.useState)(true),
34
+ _useState4 = _slicedToArray(_useState3, 2),
35
+ canScrollRight = _useState4[0],
36
+ setCanScrollRight = _useState4[1];
23
37
  var carouselRefs = {
24
38
  listRef: (0, _hooks.useRef)(null),
25
39
  nextButtonRef: (0, _hooks.useRef)(null),
26
40
  previousButtonRef: (0, _hooks.useRef)(null),
27
- carouselIdRef: (0, _hooks.useRef)((0, _instantsearchUiComponents.generateCarouselId)())
41
+ carouselIdRef: (0, _hooks.useRef)((0, _instantsearchUiComponents.generateCarouselId)()),
42
+ canScrollLeft: canScrollLeft,
43
+ canScrollRight: canScrollRight,
44
+ setCanScrollLeft: setCanScrollLeft,
45
+ setCanScrollRight: setCanScrollRight
28
46
  };
29
47
  return (0, _preact2.h)(Carousel, _extends({}, carouselRefs, props));
30
48
  }
@@ -32,7 +50,9 @@ function carousel() {
32
50
  var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
33
51
  cssClasses = _ref.cssClasses,
34
52
  _ref$templates = _ref.templates,
35
- templates = _ref$templates === void 0 ? {} : _ref$templates;
53
+ templates = _ref$templates === void 0 ? {} : _ref$templates,
54
+ _ref$showNavigation = _ref.showNavigation,
55
+ showNavigation = _ref$showNavigation === void 0 ? true : _ref$showNavigation;
36
56
  return function CarouselTemplate(_ref2) {
37
57
  var items = _ref2.items,
38
58
  widgetTemplates = _ref2.templates,
@@ -41,11 +61,17 @@ function carousel() {
41
61
  _ref2$sendEvent = _ref2.sendEvent,
42
62
  sendEvent = _ref2$sendEvent === void 0 ? function () {} : _ref2$sendEvent;
43
63
  var previous = templates.previous,
44
- next = templates.next;
64
+ next = templates.next,
65
+ header = templates.header;
45
66
  return (0, _preact2.h)(CarouselWithRefs, {
46
67
  items: items,
47
68
  sendEvent: sendEvent,
48
69
  itemComponent: widgetTemplates.item,
70
+ headerComponent: header ? function (props) {
71
+ return header(_objectSpread({
72
+ html: _preact.html
73
+ }, props));
74
+ } : undefined,
49
75
  previousIconComponent: previous ? function () {
50
76
  return previous({
51
77
  html: _preact.html
@@ -59,7 +85,8 @@ function carousel() {
59
85
  classNames: _objectSpread(_objectSpread({}, cssClasses), {
60
86
  list: (0, _instantsearchUiComponents.cx)(cssClasses === null || cssClasses === void 0 ? void 0 : cssClasses.list, widgetCssClasses === null || widgetCssClasses === void 0 ? void 0 : widgetCssClasses.list),
61
87
  item: (0, _instantsearchUiComponents.cx)(cssClasses === null || cssClasses === void 0 ? void 0 : cssClasses.item, widgetCssClasses === null || widgetCssClasses === void 0 ? void 0 : widgetCssClasses.item)
62
- })
88
+ }),
89
+ showNavigation: showNavigation
63
90
  });
64
91
  };
65
92
  }