react-instantsearch-core 7.17.0 → 7.19.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/cjs/components/Configure.js +2 -2
- package/dist/cjs/components/DynamicWidgets.js +3 -4
- package/dist/cjs/components/Index.js +3 -3
- package/dist/cjs/components/InstantSearch.js +3 -4
- package/dist/cjs/components/InstantSearchSSRProvider.js +5 -5
- package/dist/cjs/connectors/useAutocomplete.js +12 -0
- package/dist/cjs/connectors/useBreadcrumb.js +1 -1
- package/dist/cjs/connectors/useChat.js +5 -109
- package/dist/cjs/connectors/useClearRefinements.js +1 -1
- package/dist/cjs/connectors/useConfigure.js +1 -1
- package/dist/cjs/connectors/useCurrentRefinements.js +1 -1
- package/dist/cjs/connectors/useDynamicWidgets.js +3 -3
- package/dist/cjs/connectors/useFrequentlyBoughtTogether.js +1 -1
- package/dist/cjs/connectors/useGeoSearch.js +1 -1
- package/dist/cjs/connectors/useHierarchicalMenu.js +1 -1
- package/dist/cjs/connectors/useHits.js +1 -1
- package/dist/cjs/connectors/useHitsPerPage.js +1 -1
- package/dist/cjs/connectors/useInfiniteHits.js +1 -1
- package/dist/cjs/connectors/useLookingSimilar.js +1 -1
- package/dist/cjs/connectors/useMenu.js +1 -1
- package/dist/cjs/connectors/useNumericMenu.js +1 -1
- package/dist/cjs/connectors/usePagination.js +1 -1
- package/dist/cjs/connectors/useQueryRules.js +1 -1
- package/dist/cjs/connectors/useRange.js +1 -1
- package/dist/cjs/connectors/useRefinementList.js +1 -1
- package/dist/cjs/connectors/useRelatedProducts.js +1 -1
- package/dist/cjs/connectors/useSearchBox.js +1 -1
- package/dist/cjs/connectors/useSortBy.js +1 -1
- package/dist/cjs/connectors/useStats.js +1 -1
- package/dist/cjs/connectors/useToggleRefinement.js +1 -1
- package/dist/cjs/connectors/useTrendingItems.js +1 -1
- package/dist/cjs/hooks/useConnector.js +8 -8
- package/dist/cjs/index.js +13 -1
- package/dist/cjs/index.umd.js +13 -1
- package/dist/cjs/lib/createSearchResults.js +1 -1
- package/dist/cjs/lib/getIndexSearchResults.js +2 -2
- package/dist/cjs/lib/use.js +1 -2
- package/dist/cjs/lib/useForceUpdate.js +4 -4
- package/dist/cjs/lib/useIndex.js +1 -1
- package/dist/cjs/lib/useInstantSearchApi.js +4 -5
- package/dist/cjs/lib/useSearchResults.js +4 -4
- package/dist/cjs/lib/useSearchState.js +4 -4
- package/dist/cjs/lib/useStableValue.js +4 -4
- package/dist/cjs/server/getServerState.js +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/es/components/Configure.js +2 -2
- package/dist/es/components/DynamicWidgets.js +2 -2
- package/dist/es/components/Index.js +2 -2
- package/dist/es/components/InstantSearch.js +2 -2
- package/dist/es/components/InstantSearchSSRProvider.js +4 -4
- package/dist/es/connectors/useAutocomplete.d.ts +4 -0
- package/dist/es/connectors/useAutocomplete.js +5 -0
- package/dist/es/connectors/useChat.d.ts +5 -31
- package/dist/es/connectors/useChat.js +4 -109
- package/dist/es/connectors/useDynamicWidgets.js +2 -2
- package/dist/es/hooks/useConnector.js +8 -8
- package/dist/es/index.d.ts +1 -0
- package/dist/es/index.js +1 -0
- package/dist/es/index.umd.d.ts +1 -0
- package/dist/es/index.umd.js +1 -0
- package/dist/es/lib/getIndexSearchResults.js +2 -2
- package/dist/es/lib/useForceUpdate.js +4 -4
- package/dist/es/lib/useInstantSearchApi.js +2 -2
- package/dist/es/lib/useSearchResults.js +4 -4
- package/dist/es/lib/useSearchState.js +4 -4
- package/dist/es/lib/useStableValue.js +4 -4
- package/dist/es/version.d.ts +1 -1
- package/dist/es/version.js +1 -1
- package/dist/umd/ReactInstantSearchCore.js +1649 -1833
- package/dist/umd/ReactInstantSearchCore.js.map +1 -1
- package/dist/umd/ReactInstantSearchCore.min.js +1 -1
- package/dist/umd/ReactInstantSearchCore.min.js.map +1 -1
- package/package.json +4 -4
package/dist/cjs/index.umd.js
CHANGED
|
@@ -87,6 +87,18 @@ Object.keys(_InstantSearchSSRProvider).forEach(function (key) {
|
|
|
87
87
|
}
|
|
88
88
|
});
|
|
89
89
|
});
|
|
90
|
+
var _useAutocomplete = require("./connectors/useAutocomplete");
|
|
91
|
+
Object.keys(_useAutocomplete).forEach(function (key) {
|
|
92
|
+
if (key === "default" || key === "__esModule") return;
|
|
93
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
94
|
+
if (key in exports && exports[key] === _useAutocomplete[key]) return;
|
|
95
|
+
Object.defineProperty(exports, key, {
|
|
96
|
+
enumerable: true,
|
|
97
|
+
get: function get() {
|
|
98
|
+
return _useAutocomplete[key];
|
|
99
|
+
}
|
|
100
|
+
});
|
|
101
|
+
});
|
|
90
102
|
var _useBreadcrumb = require("./connectors/useBreadcrumb");
|
|
91
103
|
Object.keys(_useBreadcrumb).forEach(function (key) {
|
|
92
104
|
if (key === "default" || key === "__esModule") return;
|
|
@@ -483,7 +495,7 @@ Object.keys(_server).forEach(function (key) {
|
|
|
483
495
|
}
|
|
484
496
|
});
|
|
485
497
|
});
|
|
486
|
-
function _interopRequireDefault(
|
|
498
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
487
499
|
var useChat = exports.useChat = function useChat() {
|
|
488
500
|
throw new Error("\"useChat()\" is not available from the UMD build.\n\nPlease use React InstantSearch with a packaging system:\nhttps://www.algolia.com/doc/guides/building-search-ui/installation/react/#install-react-instantsearch-as-an-npm-package");
|
|
489
501
|
};
|
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.createSearchResults = createSearchResults;
|
|
7
7
|
var _algoliasearchHelper = _interopRequireDefault(require("algoliasearch-helper"));
|
|
8
|
-
function _interopRequireDefault(
|
|
8
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
9
9
|
function createSearchResults(state) {
|
|
10
10
|
var _state$query, _state$page, _state$hitsPerPage;
|
|
11
11
|
return new _algoliasearchHelper.default.SearchResults(state, [{
|
|
@@ -8,8 +8,8 @@ var _createSearchResults = require("./createSearchResults");
|
|
|
8
8
|
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); }
|
|
9
9
|
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; }
|
|
10
10
|
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; }
|
|
11
|
-
function _defineProperty(
|
|
12
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i :
|
|
11
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
12
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
13
13
|
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); }
|
|
14
14
|
function getIndexSearchResults(indexWidget) {
|
|
15
15
|
var helper = indexWidget.getHelper();
|
package/dist/cjs/lib/use.js
CHANGED
|
@@ -6,8 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.use = void 0;
|
|
8
8
|
var React = _interopRequireWildcard(require("react"));
|
|
9
|
-
function
|
|
10
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
9
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
11
10
|
var useKey = 'use';
|
|
12
11
|
|
|
13
12
|
// @TODO: Remove this file and import directly from React when available.
|
|
@@ -5,12 +5,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.useForceUpdate = useForceUpdate;
|
|
7
7
|
var _react = require("react");
|
|
8
|
-
function _slicedToArray(
|
|
8
|
+
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
9
9
|
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."); }
|
|
10
|
-
function _unsupportedIterableToArray(
|
|
11
|
-
function _arrayLikeToArray(
|
|
10
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
11
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
12
12
|
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; } }
|
|
13
|
-
function _arrayWithHoles(
|
|
13
|
+
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
14
14
|
/**
|
|
15
15
|
* Forces a React update that triggers a rerender.
|
|
16
16
|
* @link https://reactjs.org/docs/hooks-faq.html#is-there-something-like-forceupdate
|
package/dist/cjs/lib/useIndex.js
CHANGED
|
@@ -13,7 +13,7 @@ var _useInstantSearchSSRContext = require("./useInstantSearchSSRContext");
|
|
|
13
13
|
var _useIsomorphicLayoutEffect = require("./useIsomorphicLayoutEffect");
|
|
14
14
|
var _useStableValue = require("./useStableValue");
|
|
15
15
|
var _useWidget = require("./useWidget");
|
|
16
|
-
function _interopRequireDefault(
|
|
16
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
17
17
|
function useIndex(props) {
|
|
18
18
|
var serverContext = (0, _useInstantSearchServerContext.useInstantSearchServerContext)();
|
|
19
19
|
var ssrContext = (0, _useInstantSearchSSRContext.useInstantSearchSSRContext)();
|
|
@@ -14,14 +14,13 @@ var _useInstantSearchServerContext = require("./useInstantSearchServerContext");
|
|
|
14
14
|
var _useInstantSearchSSRContext = require("./useInstantSearchSSRContext");
|
|
15
15
|
var _useRSCContext2 = require("./useRSCContext");
|
|
16
16
|
var _warn = require("./warn");
|
|
17
|
-
function _interopRequireDefault(
|
|
18
|
-
function
|
|
19
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
17
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
18
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
20
19
|
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); }
|
|
21
20
|
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; }
|
|
22
21
|
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; }
|
|
23
|
-
function _defineProperty(
|
|
24
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i :
|
|
22
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
23
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
25
24
|
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); }
|
|
26
25
|
var defaultUserAgents = ["react (".concat(_react.version, ")"), "react-instantsearch (".concat(_version.default, ")"), "react-instantsearch-core (".concat(_version.default, ")")];
|
|
27
26
|
var serverUserAgent = "react-instantsearch-server (".concat(_version.default, ")");
|
|
@@ -9,12 +9,12 @@ var _react = require("react");
|
|
|
9
9
|
var _getIndexSearchResults = require("./getIndexSearchResults");
|
|
10
10
|
var _useIndexContext = require("./useIndexContext");
|
|
11
11
|
var _useInstantSearchContext = require("./useInstantSearchContext");
|
|
12
|
-
function _slicedToArray(
|
|
12
|
+
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
13
13
|
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."); }
|
|
14
|
-
function _unsupportedIterableToArray(
|
|
15
|
-
function _arrayLikeToArray(
|
|
14
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
15
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
16
16
|
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; } }
|
|
17
|
-
function _arrayWithHoles(
|
|
17
|
+
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
18
18
|
function useSearchResults() {
|
|
19
19
|
var search = (0, _useInstantSearchContext.useInstantSearchContext)();
|
|
20
20
|
var searchIndex = (0, _useIndexContext.useIndexContext)();
|
|
@@ -7,12 +7,12 @@ exports.useSearchState = useSearchState;
|
|
|
7
7
|
var _react = require("react");
|
|
8
8
|
var _useIndexContext = require("./useIndexContext");
|
|
9
9
|
var _useInstantSearchContext = require("./useInstantSearchContext");
|
|
10
|
-
function _slicedToArray(
|
|
10
|
+
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
11
11
|
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."); }
|
|
12
|
-
function _unsupportedIterableToArray(
|
|
13
|
-
function _arrayLikeToArray(
|
|
12
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
13
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
14
14
|
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; } }
|
|
15
|
-
function _arrayWithHoles(
|
|
15
|
+
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
16
16
|
function useSearchState() {
|
|
17
17
|
var search = (0, _useInstantSearchContext.useInstantSearchContext)();
|
|
18
18
|
var searchIndex = (0, _useIndexContext.useIndexContext)();
|
|
@@ -6,12 +6,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.useStableValue = useStableValue;
|
|
7
7
|
var _react = require("react");
|
|
8
8
|
var _dequal = require("./dequal");
|
|
9
|
-
function _slicedToArray(
|
|
9
|
+
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
10
10
|
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."); }
|
|
11
|
-
function _unsupportedIterableToArray(
|
|
12
|
-
function _arrayLikeToArray(
|
|
11
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
12
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
13
13
|
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; } }
|
|
14
|
-
function _arrayWithHoles(
|
|
14
|
+
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
15
15
|
function useStableValue(value) {
|
|
16
16
|
var _useState = (0, _react.useState)(function () {
|
|
17
17
|
return value;
|
|
@@ -9,7 +9,7 @@ var _utils = require("instantsearch.js/cjs/lib/utils");
|
|
|
9
9
|
var _react = _interopRequireDefault(require("react"));
|
|
10
10
|
var _InstantSearchServerContext = require("../components/InstantSearchServerContext");
|
|
11
11
|
var _InstantSearchSSRProvider = require("../components/InstantSearchSSRProvider");
|
|
12
|
-
function _interopRequireDefault(
|
|
12
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
13
13
|
/**
|
|
14
14
|
* Returns the InstantSearch server state from a component.
|
|
15
15
|
*/
|
package/dist/cjs/version.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
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); }
|
|
2
2
|
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; }
|
|
3
3
|
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; }
|
|
4
|
-
function _defineProperty(
|
|
5
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i :
|
|
4
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
5
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
6
6
|
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); }
|
|
7
7
|
import { useConfigure } from "../connectors/useConfigure.js";
|
|
8
8
|
export function Configure(props) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var _excluded = ["children", "fallbackComponent"];
|
|
2
2
|
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); }
|
|
3
|
-
function _objectWithoutProperties(
|
|
4
|
-
function _objectWithoutPropertiesLoose(
|
|
3
|
+
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
|
4
|
+
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
|
5
5
|
import React, { Fragment } from 'react';
|
|
6
6
|
import { useDynamicWidgets } from "../connectors/useDynamicWidgets.js";
|
|
7
7
|
import { invariant } from "../lib/invariant.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
var _excluded = ["children"];
|
|
2
|
-
function _objectWithoutProperties(
|
|
3
|
-
function _objectWithoutPropertiesLoose(
|
|
2
|
+
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
|
3
|
+
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
|
4
4
|
import React from 'react';
|
|
5
5
|
import { IndexContext } from "../lib/IndexContext.js";
|
|
6
6
|
import { useIndex } from "../lib/useIndex.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
var _excluded = ["children"];
|
|
2
|
-
function _objectWithoutProperties(
|
|
3
|
-
function _objectWithoutPropertiesLoose(
|
|
2
|
+
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
|
3
|
+
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
|
4
4
|
import React, { useEffect } from 'react';
|
|
5
5
|
import { IndexContext } from "../lib/IndexContext.js";
|
|
6
6
|
import { InstantSearchContext } from "../lib/InstantSearchContext.js";
|
|
@@ -2,11 +2,11 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
2
2
|
var _excluded = ["children"];
|
|
3
3
|
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; }
|
|
4
4
|
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; }
|
|
5
|
-
function _defineProperty(
|
|
6
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i :
|
|
5
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
6
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
7
7
|
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); }
|
|
8
|
-
function _objectWithoutProperties(
|
|
9
|
-
function _objectWithoutPropertiesLoose(
|
|
8
|
+
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
|
9
|
+
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
|
10
10
|
import React from 'react';
|
|
11
11
|
import { InstantSearchSSRContext } from "../lib/InstantSearchSSRContext.js";
|
|
12
12
|
/**
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { AdditionalWidgetProperties } from '../hooks/useConnector';
|
|
2
|
+
import type { AutocompleteConnectorParams } from 'instantsearch.js/es/connectors/autocomplete/connectAutocomplete';
|
|
3
|
+
export type UseAutocompleteProps = AutocompleteConnectorParams;
|
|
4
|
+
export declare function useAutocomplete(props?: UseAutocompleteProps, additionalWidgetProperties?: AdditionalWidgetProperties): import("instantsearch.js/es/connectors/autocomplete/connectAutocomplete").AutocompleteRenderState;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import connectAutocomplete from "instantsearch.js/es/connectors/autocomplete/connectAutocomplete.js";
|
|
2
|
+
import { useConnector } from "../hooks/useConnector.js";
|
|
3
|
+
export function useAutocomplete(props, additionalWidgetProperties) {
|
|
4
|
+
return useConnector(connectAutocomplete, props, additionalWidgetProperties);
|
|
5
|
+
}
|
|
@@ -1,31 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import type {
|
|
4
|
-
export type
|
|
5
|
-
|
|
6
|
-
* The id of the chat.
|
|
7
|
-
*/
|
|
8
|
-
readonly id: string;
|
|
9
|
-
/**
|
|
10
|
-
* Update the `messages` state locally. This is useful when you want to
|
|
11
|
-
* edit the messages on the client, and then trigger the `reload` method
|
|
12
|
-
* manually to regenerate the AI response.
|
|
13
|
-
*/
|
|
14
|
-
setMessages: (messages: TUiMessage[] | ((m: TUiMessage[]) => TUiMessage[])) => void;
|
|
15
|
-
error: Error | undefined;
|
|
16
|
-
} & Pick<AbstractChat<TUiMessage>, 'sendMessage' | 'regenerate' | 'stop' | 'resumeStream' | 'addToolResult' | 'status' | 'messages' | 'clearError'>;
|
|
17
|
-
export type ChatInitWithoutTransport<TUiMessage extends UIMessage> = Omit<ChatInitAi<TUiMessage>, 'transport'>;
|
|
18
|
-
export type ChatTransport = {
|
|
19
|
-
agentId?: string;
|
|
20
|
-
transport?: ConstructorParameters<typeof DefaultChatTransport>[0];
|
|
21
|
-
};
|
|
22
|
-
export type ChatInit<TUiMessage extends UIMessage> = ChatInitWithoutTransport<TUiMessage> & ChatTransport;
|
|
23
|
-
export type UseChatOptions<TUiMessage extends UIMessage> = ({
|
|
24
|
-
chat: Chat<TUiMessage>;
|
|
25
|
-
} | ChatInit<TUiMessage>) & {
|
|
26
|
-
/**
|
|
27
|
-
* Whether to resume an ongoing chat generation stream.
|
|
28
|
-
*/
|
|
29
|
-
resume?: boolean;
|
|
30
|
-
};
|
|
31
|
-
export declare function useChat<TUiMessage extends UIMessage = UIMessage>({ resume, ...options }?: UseChatOptions<TUiMessage>): UseChatHelpers<TUiMessage>;
|
|
1
|
+
import type { AdditionalWidgetProperties } from '../hooks/useConnector';
|
|
2
|
+
import type { ChatConnectorParams } from 'instantsearch.js/es/connectors/chat/connectChat';
|
|
3
|
+
import type { UIMessage } from 'instantsearch.js/es/lib/chat';
|
|
4
|
+
export type UseChatProps<TUiMessage extends UIMessage = UIMessage> = ChatConnectorParams<TUiMessage>;
|
|
5
|
+
export declare function useChat<TUiMessage extends UIMessage = UIMessage>(props: UseChatProps<TUiMessage>, additionalWidgetProperties?: AdditionalWidgetProperties): import("instantsearch.js/es/connectors/chat/connectChat").ChatRenderState<TUiMessage>;
|
|
@@ -1,110 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
function
|
|
4
|
-
|
|
5
|
-
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; }
|
|
6
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
7
|
-
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); }
|
|
8
|
-
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
9
|
-
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."); }
|
|
10
|
-
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); }
|
|
11
|
-
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; }
|
|
12
|
-
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; } }
|
|
13
|
-
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
14
|
-
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; }
|
|
15
|
-
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; }
|
|
16
|
-
import { DefaultChatTransport } from 'ai';
|
|
17
|
-
import { Chat } from "instantsearch.js/es/lib/chat/index.js";
|
|
18
|
-
import { useCallback, useEffect, useMemo, useRef, useSyncExternalStore } from 'react';
|
|
19
|
-
import { useAppIdAndApiKey } from "../lib/useAppIdAndApiKey.js";
|
|
20
|
-
import { warn } from "../lib/warn.js";
|
|
21
|
-
export function useChat() {
|
|
22
|
-
var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
23
|
-
_ref$resume = _ref.resume,
|
|
24
|
-
resume = _ref$resume === void 0 ? false : _ref$resume,
|
|
25
|
-
options = _objectWithoutProperties(_ref, _excluded);
|
|
26
|
-
process.env.NODE_ENV === 'development' ? warn(false, 'Chat is not yet stable and will change in the future.') : void 0;
|
|
27
|
-
process.env.NODE_ENV === 'development' ? warn(!('agentId' in options && 'transport' in options), "`useChat` with `agentId` and `transport` can't be used together. The `transport` option will be used.") : void 0;
|
|
28
|
-
var _useAppIdAndApiKey = useAppIdAndApiKey(),
|
|
29
|
-
_useAppIdAndApiKey2 = _slicedToArray(_useAppIdAndApiKey, 2),
|
|
30
|
-
appId = _useAppIdAndApiKey2[0],
|
|
31
|
-
apiKey = _useAppIdAndApiKey2[1];
|
|
32
|
-
var transport = useMemo(function () {
|
|
33
|
-
if ('transport' in options && options.transport) {
|
|
34
|
-
return new DefaultChatTransport(options.transport);
|
|
35
|
-
}
|
|
36
|
-
if ('agentId' in options && options.agentId) {
|
|
37
|
-
var agentId = options.agentId;
|
|
38
|
-
if (!appId || !apiKey) {
|
|
39
|
-
throw new Error('The `useChat` hook requires an `appId` and `apiKey` to be set on the `InstantSearch` component when using the `agentId` option.');
|
|
40
|
-
}
|
|
41
|
-
return new DefaultChatTransport({
|
|
42
|
-
api: "https://".concat(appId, ".algolia.net/agent-studio/1/agents/").concat(agentId, "/completions?compatibilityMode=ai-sdk-5"),
|
|
43
|
-
headers: {
|
|
44
|
-
'x-algolia-application-id': appId,
|
|
45
|
-
'x-algolia-api-Key': apiKey
|
|
46
|
-
}
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
throw new Error('You need to provide either an `agentId` or a `transport`.');
|
|
50
|
-
}, [apiKey, appId, options]);
|
|
51
|
-
var optionsWithTransport = useMemo(function () {
|
|
52
|
-
if ('chat' in options) {
|
|
53
|
-
return options;
|
|
54
|
-
}
|
|
55
|
-
return _objectSpread(_objectSpread({}, options), {}, {
|
|
56
|
-
transport: transport
|
|
57
|
-
});
|
|
58
|
-
}, [options, transport]);
|
|
59
|
-
var chatRef = useRef('chat' in optionsWithTransport ? optionsWithTransport.chat : new Chat(optionsWithTransport));
|
|
60
|
-
var shouldRecreateChat = 'chat' in optionsWithTransport && optionsWithTransport.chat !== chatRef.current || 'id' in optionsWithTransport && chatRef.current.id !== optionsWithTransport.id;
|
|
61
|
-
if (shouldRecreateChat) {
|
|
62
|
-
chatRef.current = 'chat' in optionsWithTransport ? optionsWithTransport.chat : new Chat(optionsWithTransport);
|
|
63
|
-
}
|
|
64
|
-
var optionsId = 'id' in optionsWithTransport ? optionsWithTransport.id : null;
|
|
65
|
-
var subscribeToMessages = useCallback(function (update) {
|
|
66
|
-
return chatRef.current['~registerMessagesCallback'](update);
|
|
67
|
-
},
|
|
68
|
-
// optionsId is required to trigger re-subscription when the chat ID changes
|
|
69
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
70
|
-
[optionsId]);
|
|
71
|
-
var messages = useSyncExternalStore(subscribeToMessages, function () {
|
|
72
|
-
return chatRef.current.messages;
|
|
73
|
-
}, function () {
|
|
74
|
-
return chatRef.current.messages;
|
|
75
|
-
});
|
|
76
|
-
var status = useSyncExternalStore(chatRef.current['~registerStatusCallback'], function () {
|
|
77
|
-
return chatRef.current.status;
|
|
78
|
-
}, function () {
|
|
79
|
-
return chatRef.current.status;
|
|
80
|
-
});
|
|
81
|
-
var error = useSyncExternalStore(chatRef.current['~registerErrorCallback'], function () {
|
|
82
|
-
return chatRef.current.error;
|
|
83
|
-
}, function () {
|
|
84
|
-
return chatRef.current.error;
|
|
85
|
-
});
|
|
86
|
-
var setMessages = useCallback(function (messagesParam) {
|
|
87
|
-
if (typeof messagesParam === 'function') {
|
|
88
|
-
messagesParam = messagesParam(chatRef.current.messages);
|
|
89
|
-
}
|
|
90
|
-
chatRef.current.messages = messagesParam;
|
|
91
|
-
}, [chatRef]);
|
|
92
|
-
useEffect(function () {
|
|
93
|
-
if (resume) {
|
|
94
|
-
chatRef.current.resumeStream();
|
|
95
|
-
}
|
|
96
|
-
}, [resume, chatRef]);
|
|
97
|
-
return {
|
|
98
|
-
id: chatRef.current.id,
|
|
99
|
-
messages: messages,
|
|
100
|
-
setMessages: setMessages,
|
|
101
|
-
sendMessage: chatRef.current.sendMessage,
|
|
102
|
-
regenerate: chatRef.current.regenerate,
|
|
103
|
-
clearError: chatRef.current.clearError,
|
|
104
|
-
stop: chatRef.current.stop,
|
|
105
|
-
error: error,
|
|
106
|
-
resumeStream: chatRef.current.resumeStream,
|
|
107
|
-
status: status,
|
|
108
|
-
addToolResult: chatRef.current.addToolResult
|
|
109
|
-
};
|
|
1
|
+
import connectChat from "instantsearch.js/es/connectors/chat/connectChat.js";
|
|
2
|
+
import { useConnector } from "../hooks/useConnector.js";
|
|
3
|
+
export function useChat(props, additionalWidgetProperties) {
|
|
4
|
+
return useConnector(connectChat, props, additionalWidgetProperties);
|
|
110
5
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
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); }
|
|
2
2
|
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; }
|
|
3
3
|
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; }
|
|
4
|
-
function _defineProperty(
|
|
5
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i :
|
|
4
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
5
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
6
6
|
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); }
|
|
7
7
|
import connectDynamicWidgets from "instantsearch.js/es/connectors/dynamic-widgets/connectDynamicWidgets.js";
|
|
8
8
|
import { useConnector } from "../hooks/useConnector.js";
|
|
@@ -2,19 +2,19 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
2
2
|
var _excluded = ["skipSuspense"],
|
|
3
3
|
_excluded2 = ["instantSearchInstance", "widgetParams"],
|
|
4
4
|
_excluded3 = ["widgetParams"];
|
|
5
|
-
function _slicedToArray(
|
|
5
|
+
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
6
6
|
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."); }
|
|
7
|
-
function _unsupportedIterableToArray(
|
|
8
|
-
function _arrayLikeToArray(
|
|
7
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
8
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
9
9
|
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; } }
|
|
10
|
-
function _arrayWithHoles(
|
|
10
|
+
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
11
11
|
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; }
|
|
12
12
|
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; }
|
|
13
|
-
function _defineProperty(
|
|
14
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i :
|
|
13
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
14
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
15
15
|
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); }
|
|
16
|
-
function _objectWithoutProperties(
|
|
17
|
-
function _objectWithoutPropertiesLoose(
|
|
16
|
+
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
|
17
|
+
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
|
18
18
|
import { useMemo, useRef, useState } from 'react';
|
|
19
19
|
import { dequal } from "../lib/dequal.js";
|
|
20
20
|
import { getIndexSearchResults } from "../lib/getIndexSearchResults.js";
|
package/dist/es/index.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ export * from './components/Index';
|
|
|
5
5
|
export * from './components/InstantSearch';
|
|
6
6
|
export * from './components/InstantSearchServerContext';
|
|
7
7
|
export * from './components/InstantSearchSSRProvider';
|
|
8
|
+
export * from './connectors/useAutocomplete';
|
|
8
9
|
export * from './connectors/useBreadcrumb';
|
|
9
10
|
export * from './connectors/useChat';
|
|
10
11
|
export * from './connectors/useClearRefinements';
|
package/dist/es/index.js
CHANGED
|
@@ -5,6 +5,7 @@ export * from "./components/Index.js";
|
|
|
5
5
|
export * from "./components/InstantSearch.js";
|
|
6
6
|
export * from "./components/InstantSearchServerContext.js";
|
|
7
7
|
export * from "./components/InstantSearchSSRProvider.js";
|
|
8
|
+
export * from "./connectors/useAutocomplete.js";
|
|
8
9
|
export * from "./connectors/useBreadcrumb.js";
|
|
9
10
|
export * from "./connectors/useChat.js";
|
|
10
11
|
export * from "./connectors/useClearRefinements.js";
|
package/dist/es/index.umd.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ export * from './components/Index';
|
|
|
5
5
|
export * from './components/InstantSearch';
|
|
6
6
|
export * from './components/InstantSearchServerContext';
|
|
7
7
|
export * from './components/InstantSearchSSRProvider';
|
|
8
|
+
export * from './connectors/useAutocomplete';
|
|
8
9
|
export * from './connectors/useBreadcrumb';
|
|
9
10
|
export declare const useChat: () => never;
|
|
10
11
|
export * from './connectors/useClearRefinements';
|
package/dist/es/index.umd.js
CHANGED
|
@@ -5,6 +5,7 @@ export * from "./components/Index.js";
|
|
|
5
5
|
export * from "./components/InstantSearch.js";
|
|
6
6
|
export * from "./components/InstantSearchServerContext.js";
|
|
7
7
|
export * from "./components/InstantSearchSSRProvider.js";
|
|
8
|
+
export * from "./connectors/useAutocomplete.js";
|
|
8
9
|
export * from "./connectors/useBreadcrumb.js";
|
|
9
10
|
export var useChat = function useChat() {
|
|
10
11
|
throw new Error("\"useChat()\" is not available from the UMD build.\n\nPlease use React InstantSearch with a packaging system:\nhttps://www.algolia.com/doc/guides/building-search-ui/installation/react/#install-react-instantsearch-as-an-npm-package");
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
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); }
|
|
2
2
|
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; }
|
|
3
3
|
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; }
|
|
4
|
-
function _defineProperty(
|
|
5
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i :
|
|
4
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
5
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
6
6
|
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); }
|
|
7
7
|
import { createSearchResults } from "./createSearchResults.js";
|
|
8
8
|
export function getIndexSearchResults(indexWidget) {
|