instantsearch.js 4.65.0 → 4.66.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/cjs/connectors/answers/connectAnswers.js +3 -0
- package/cjs/lib/version.js +1 -1
- package/cjs/widgets/answers/answers.js +4 -1
- package/cjs/widgets/hits/hits.js +66 -30
- package/cjs/widgets/places/places.js +3 -1
- package/dist/instantsearch.development.d.ts +5 -25
- package/dist/instantsearch.development.js +280 -253
- package/dist/instantsearch.development.js.map +1 -1
- package/dist/instantsearch.production.d.ts +5 -25
- package/dist/instantsearch.production.min.d.ts +5 -25
- package/dist/instantsearch.production.min.js +2 -2
- package/dist/instantsearch.production.min.js.map +1 -1
- package/es/connectors/answers/connectAnswers.d.ts +3 -0
- package/es/connectors/answers/connectAnswers.js +3 -0
- package/es/lib/version.d.ts +1 -1
- package/es/lib/version.js +1 -1
- package/es/widgets/answers/answers.d.ts +2 -2
- package/es/widgets/answers/answers.js +5 -2
- package/es/widgets/hits/defaultTemplates.d.ts +2 -2
- package/es/widgets/hits/hits.d.ts +2 -18
- package/es/widgets/hits/hits.js +67 -31
- package/es/widgets/places/places.d.ts +2 -6
- package/es/widgets/places/places.js +4 -1
- package/package.json +12 -10
- package/cjs/components/Hits/Hits.js +0 -72
- package/es/components/Hits/Hits.d.ts +0 -19
- package/es/components/Hits/Hits.js +0 -65
|
@@ -56,5 +56,8 @@ export type AnswersWidgetDescription = {
|
|
|
56
56
|
};
|
|
57
57
|
};
|
|
58
58
|
export type AnswersConnector = Connector<AnswersWidgetDescription, AnswersConnectorParams>;
|
|
59
|
+
/**
|
|
60
|
+
* @deprecated the answers service is no longer offered, and this widget will be removed in InstantSearch.js v5
|
|
61
|
+
*/
|
|
59
62
|
declare const connectAnswers: AnswersConnector;
|
|
60
63
|
export default connectAnswers;
|
|
@@ -12,6 +12,9 @@ var withUsage = createDocumentationMessageGenerator({
|
|
|
12
12
|
name: 'answers',
|
|
13
13
|
connector: true
|
|
14
14
|
});
|
|
15
|
+
/**
|
|
16
|
+
* @deprecated the answers service is no longer offered, and this widget will be removed in InstantSearch.js v5
|
|
17
|
+
*/
|
|
15
18
|
var connectAnswers = function connectAnswers(renderFn) {
|
|
16
19
|
var unmountFn = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : noop;
|
|
17
20
|
checkRendering(renderFn, withUsage());
|
package/es/lib/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: "4.
|
|
1
|
+
declare const _default: "4.66.0";
|
|
2
2
|
export default _default;
|
package/es/lib/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export default '4.
|
|
1
|
+
export default '4.66.0';
|
|
@@ -61,5 +61,5 @@ export type AnswersWidgetParams = {
|
|
|
61
61
|
export type AnswersWidget = WidgetFactory<AnswersWidgetDescription & {
|
|
62
62
|
$$widgetType: 'ais.answers';
|
|
63
63
|
}, AnswersConnectorParams, AnswersWidgetParams>;
|
|
64
|
-
declare const
|
|
65
|
-
export default
|
|
64
|
+
declare const _default: AnswersWidget;
|
|
65
|
+
export default _default;
|
|
@@ -10,7 +10,7 @@ import Answers from "../../components/Answers/Answers.js";
|
|
|
10
10
|
import connectAnswers from "../../connectors/answers/connectAnswers.js";
|
|
11
11
|
import { component } from "../../lib/suit.js";
|
|
12
12
|
import { prepareTemplateProps } from "../../lib/templating/index.js";
|
|
13
|
-
import { createDocumentationMessageGenerator, getContainerNode } from "../../lib/utils/index.js";
|
|
13
|
+
import { createDocumentationMessageGenerator, deprecate, getContainerNode } from "../../lib/utils/index.js";
|
|
14
14
|
import defaultTemplates from "./defaultTemplates.js";
|
|
15
15
|
var withUsage = createDocumentationMessageGenerator({
|
|
16
16
|
name: 'answers'
|
|
@@ -41,6 +41,9 @@ var renderer = function renderer(_ref) {
|
|
|
41
41
|
}), containerNode);
|
|
42
42
|
};
|
|
43
43
|
};
|
|
44
|
+
/**
|
|
45
|
+
* @deprecated the answers service is no longer offered, and this widget will be removed in InstantSearch.js v5
|
|
46
|
+
*/
|
|
44
47
|
var answersWidget = function answersWidget(widgetParams) {
|
|
45
48
|
var _ref3 = widgetParams || {},
|
|
46
49
|
container = _ref3.container,
|
|
@@ -98,4 +101,4 @@ var answersWidget = function answersWidget(widgetParams) {
|
|
|
98
101
|
$$widgetType: 'ais.answers'
|
|
99
102
|
});
|
|
100
103
|
};
|
|
101
|
-
export default answersWidget;
|
|
104
|
+
export default deprecate(answersWidget, 'The answers widget is deprecated and will be removed in InstantSearch.js 5.0');
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
declare const defaultTemplates:
|
|
1
|
+
import type { HitsTemplates } from './hits';
|
|
2
|
+
declare const defaultTemplates: Required<HitsTemplates>;
|
|
3
3
|
export default defaultTemplates;
|
|
@@ -2,24 +2,8 @@
|
|
|
2
2
|
import type { HitsConnectorParams, HitsWidgetDescription } from '../../connectors/hits/connectHits';
|
|
3
3
|
import type { Template, TemplateWithBindEvent, Hit, WidgetFactory } from '../../types';
|
|
4
4
|
import type { SearchResults } from 'algoliasearch-helper';
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
* CSS class to add to the wrapping element.
|
|
8
|
-
*/
|
|
9
|
-
root: string | string[];
|
|
10
|
-
/**
|
|
11
|
-
* CSS class to add to the wrapping element when no results.
|
|
12
|
-
*/
|
|
13
|
-
emptyRoot: string | string[];
|
|
14
|
-
/**
|
|
15
|
-
* CSS class to add to the list of results.
|
|
16
|
-
*/
|
|
17
|
-
list: string | string[];
|
|
18
|
-
/**
|
|
19
|
-
* CSS class to add to each result.
|
|
20
|
-
*/
|
|
21
|
-
item: string | string[];
|
|
22
|
-
}>;
|
|
5
|
+
import type { HitsClassNames as HitsUiComponentClassNames } from 'instantsearch-ui-components';
|
|
6
|
+
export type HitsCSSClasses = Partial<HitsUiComponentClassNames>;
|
|
23
7
|
export type HitsTemplates = Partial<{
|
|
24
8
|
/**
|
|
25
9
|
* Template to use when there are no results.
|
package/es/widgets/hits/hits.js
CHANGED
|
@@ -1,22 +1,30 @@
|
|
|
1
1
|
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
2
|
+
var _excluded = ["hit", "index"];
|
|
2
3
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
3
4
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
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; }
|
|
5
6
|
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
6
7
|
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
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; }
|
|
9
|
+
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; }
|
|
10
|
+
function _objectDestructuringEmpty(obj) { if (obj == null) throw new TypeError("Cannot destructure " + obj); }
|
|
11
|
+
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); }
|
|
12
|
+
import { createHitsComponent } from 'instantsearch-ui-components';
|
|
13
|
+
import { Fragment, h, render } from 'preact';
|
|
14
|
+
import TemplateComponent from "../../components/Template/Template.js";
|
|
10
15
|
import connectHits from "../../connectors/hits/connectHits.js";
|
|
11
16
|
import { withInsights } from "../../lib/insights/index.js";
|
|
12
|
-
import {
|
|
17
|
+
import { createInsightsEventHandler } from "../../lib/insights/listener.js";
|
|
13
18
|
import { prepareTemplateProps } from "../../lib/templating/index.js";
|
|
14
|
-
import { getContainerNode, createDocumentationMessageGenerator } from "../../lib/utils/index.js";
|
|
19
|
+
import { getContainerNode, createDocumentationMessageGenerator, warning } from "../../lib/utils/index.js";
|
|
15
20
|
import defaultTemplates from "./defaultTemplates.js";
|
|
16
21
|
var withUsage = createDocumentationMessageGenerator({
|
|
17
22
|
name: 'hits'
|
|
18
23
|
});
|
|
19
|
-
var
|
|
24
|
+
var Hits = createHitsComponent({
|
|
25
|
+
createElement: h,
|
|
26
|
+
Fragment: Fragment
|
|
27
|
+
});
|
|
20
28
|
var renderer = function renderer(_ref) {
|
|
21
29
|
var renderState = _ref.renderState,
|
|
22
30
|
cssClasses = _ref.cssClasses,
|
|
@@ -37,42 +45,70 @@ var renderer = function renderer(_ref) {
|
|
|
37
45
|
});
|
|
38
46
|
return;
|
|
39
47
|
}
|
|
48
|
+
var handleInsightsClick = createInsightsEventHandler({
|
|
49
|
+
insights: insights,
|
|
50
|
+
sendEvent: sendEvent
|
|
51
|
+
});
|
|
52
|
+
var emptyComponent = function emptyComponent(_ref3) {
|
|
53
|
+
var rootProps = _extends({}, (_objectDestructuringEmpty(_ref3), _ref3));
|
|
54
|
+
return h(TemplateComponent, _extends({}, renderState.templateProps, {
|
|
55
|
+
rootProps: rootProps,
|
|
56
|
+
templateKey: "empty",
|
|
57
|
+
data: results
|
|
58
|
+
}));
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
// @MAJOR: Move default hit component back to the UI library
|
|
62
|
+
// once flavour specificities are erased
|
|
63
|
+
var itemComponent = function itemComponent(_ref4) {
|
|
64
|
+
var hit = _ref4.hit,
|
|
65
|
+
index = _ref4.index,
|
|
66
|
+
rootProps = _objectWithoutProperties(_ref4, _excluded);
|
|
67
|
+
return h(TemplateComponent, _extends({}, renderState.templateProps, {
|
|
68
|
+
templateKey: "item",
|
|
69
|
+
rootTagName: "li",
|
|
70
|
+
rootProps: _objectSpread(_objectSpread({}, rootProps), {}, {
|
|
71
|
+
onClick: function onClick(event) {
|
|
72
|
+
handleInsightsClick(event);
|
|
73
|
+
rootProps.onClick();
|
|
74
|
+
},
|
|
75
|
+
onAuxClick: function onAuxClick(event) {
|
|
76
|
+
handleInsightsClick(event);
|
|
77
|
+
rootProps.onAuxClick();
|
|
78
|
+
}
|
|
79
|
+
}),
|
|
80
|
+
data: _objectSpread(_objectSpread({}, hit), {}, {
|
|
81
|
+
get __hitIndex() {
|
|
82
|
+
process.env.NODE_ENV === 'development' ? warning(false, 'The `__hitIndex` property is deprecated. Use the absolute `__position` instead.') : void 0;
|
|
83
|
+
return index;
|
|
84
|
+
}
|
|
85
|
+
}),
|
|
86
|
+
bindEvent: bindEvent,
|
|
87
|
+
sendEvent: sendEvent
|
|
88
|
+
}));
|
|
89
|
+
};
|
|
40
90
|
render(h(Hits, {
|
|
41
|
-
cssClasses: cssClasses,
|
|
42
91
|
hits: receivedHits,
|
|
43
|
-
|
|
44
|
-
templateProps: renderState.templateProps,
|
|
45
|
-
insights: insights,
|
|
92
|
+
itemComponent: itemComponent,
|
|
46
93
|
sendEvent: sendEvent,
|
|
47
|
-
|
|
94
|
+
classNames: cssClasses,
|
|
95
|
+
emptyComponent: emptyComponent
|
|
48
96
|
}), containerNode);
|
|
49
97
|
};
|
|
50
98
|
};
|
|
51
99
|
var hits = function hits(widgetParams) {
|
|
52
|
-
var
|
|
53
|
-
container =
|
|
54
|
-
escapeHTML =
|
|
55
|
-
transformItems =
|
|
56
|
-
|
|
57
|
-
templates =
|
|
58
|
-
|
|
59
|
-
|
|
100
|
+
var _ref5 = widgetParams || {},
|
|
101
|
+
container = _ref5.container,
|
|
102
|
+
escapeHTML = _ref5.escapeHTML,
|
|
103
|
+
transformItems = _ref5.transformItems,
|
|
104
|
+
_ref5$templates = _ref5.templates,
|
|
105
|
+
templates = _ref5$templates === void 0 ? {} : _ref5$templates,
|
|
106
|
+
_ref5$cssClasses = _ref5.cssClasses,
|
|
107
|
+
cssClasses = _ref5$cssClasses === void 0 ? {} : _ref5$cssClasses;
|
|
60
108
|
if (!container) {
|
|
61
109
|
throw new Error(withUsage('The `container` option is required.'));
|
|
62
110
|
}
|
|
63
111
|
var containerNode = getContainerNode(container);
|
|
64
|
-
var cssClasses = {
|
|
65
|
-
root: cx(suit(), userCssClasses.root),
|
|
66
|
-
emptyRoot: cx(suit({
|
|
67
|
-
modifierName: 'empty'
|
|
68
|
-
}), userCssClasses.emptyRoot),
|
|
69
|
-
list: cx(suit({
|
|
70
|
-
descendantName: 'list'
|
|
71
|
-
}), userCssClasses.list),
|
|
72
|
-
item: cx(suit({
|
|
73
|
-
descendantName: 'item'
|
|
74
|
-
}), userCssClasses.item)
|
|
75
|
-
};
|
|
76
112
|
var specializedRenderer = renderer({
|
|
77
113
|
containerNode: containerNode,
|
|
78
114
|
cssClasses: cssClasses,
|
|
@@ -31,9 +31,5 @@ export type PlacesWidgetDescription = {
|
|
|
31
31
|
};
|
|
32
32
|
};
|
|
33
33
|
export type PlacesWidget = WidgetFactory<PlacesWidgetDescription, PlacesWidgetParams, PlacesWidgetParams>;
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
* result in the Algolia Places autocomplete.
|
|
37
|
-
*/
|
|
38
|
-
declare const placesWidget: PlacesWidget;
|
|
39
|
-
export default placesWidget;
|
|
34
|
+
declare const _default: PlacesWidget;
|
|
35
|
+
export default _default;
|
|
@@ -8,12 +8,15 @@ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _ty
|
|
|
8
8
|
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
9
9
|
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; }
|
|
10
10
|
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; }
|
|
11
|
+
import { deprecate } from "../../lib/utils/index.js";
|
|
12
|
+
|
|
11
13
|
/* Places.js is an optional dependency, no error should be reported if the package is missing */
|
|
12
14
|
/** @ts-ignore */
|
|
13
15
|
// using the type like this requires only one ts-ignore
|
|
14
16
|
/**
|
|
15
17
|
* This widget sets the geolocation value for the search based on the selected
|
|
16
18
|
* result in the Algolia Places autocomplete.
|
|
19
|
+
* @deprecated the places service is no longer offered, and this widget will be removed in InstantSearch.js v5
|
|
17
20
|
*/
|
|
18
21
|
var placesWidget = function placesWidget(widgetParams) {
|
|
19
22
|
var _ref = widgetParams || {},
|
|
@@ -99,4 +102,4 @@ var placesWidget = function placesWidget(widgetParams) {
|
|
|
99
102
|
}
|
|
100
103
|
};
|
|
101
104
|
};
|
|
102
|
-
export default placesWidget;
|
|
105
|
+
export default deprecate(placesWidget, 'The places widget is deprecated and will be removed in InstantSearch.js 5.0.');
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "instantsearch.js",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.66.0",
|
|
4
4
|
"description": "InstantSearch.js is a JavaScript library for building performant and instant search experiences with Algolia.",
|
|
5
5
|
"homepage": "https://www.algolia.com/doc/guides/building-search-ui/what-is-instantsearch/js/",
|
|
6
6
|
"types": "es/index.d.ts",
|
|
@@ -31,10 +31,10 @@
|
|
|
31
31
|
"@types/google.maps": "^3.45.3",
|
|
32
32
|
"@types/hogan.js": "^3.0.0",
|
|
33
33
|
"@types/qs": "^6.5.3",
|
|
34
|
-
"algoliasearch-helper": "3.16.
|
|
34
|
+
"algoliasearch-helper": "3.16.3",
|
|
35
35
|
"hogan.js": "^3.0.2",
|
|
36
36
|
"htm": "^3.0.0",
|
|
37
|
-
"instantsearch-ui-components": "0.
|
|
37
|
+
"instantsearch-ui-components": "0.4.0",
|
|
38
38
|
"preact": "^10.10.0",
|
|
39
39
|
"qs": "^6.5.1 < 6.10",
|
|
40
40
|
"search-insights": "^2.13.0"
|
|
@@ -46,23 +46,25 @@
|
|
|
46
46
|
"build": "yarn run build:cjs && yarn run build:es && yarn run build:umd && yarn run build:types",
|
|
47
47
|
"build:umd": "rm -rf dist && BABEL_ENV=umd rollup --config ./scripts/rollup/rollup.config.js",
|
|
48
48
|
"build:cjs": "rm -rf cjs && BABEL_ENV=cjs babel --root-mode upward src --extensions '.js,.ts,.tsx' --out-dir cjs/ --ignore 'src/index.es.ts','**/__tests__','**/__mocks__' --quiet",
|
|
49
|
-
"build:es": "
|
|
49
|
+
"build:es:base": "BABEL_ENV=es babel --root-mode upward src --extensions '.js,.ts,.tsx' --out-dir es/ --ignore 'src/index.es.ts','**/__tests__','**/__mocks__'",
|
|
50
|
+
"build:es": "rm -rf es && yarn build:es:base --quiet && BABEL_ENV=es babel --root-mode upward src/index.es.ts --out-file es/index.js --quiet && echo '{\"type\":\"module\",\"sideEffects\":false}' > es/package.json",
|
|
50
51
|
"build:types": "scripts/typescript/extract.js",
|
|
51
52
|
"storybook": "NODE_OPTIONS=--openssl-legacy-provider start-storybook --quiet --port 6006 --ci --static-dir .storybook/static",
|
|
52
53
|
"storybook:build": "NODE_OPTIONS=--openssl-legacy-provider build-storybook --quiet --output-dir ../../website/stories/js --static-dir .storybook/static",
|
|
53
54
|
"test:exports": "node test/module/is-es-module.mjs && node test/module/is-cjs-module.cjs",
|
|
54
|
-
"version": "./scripts/version/update-version.js"
|
|
55
|
+
"version": "./scripts/version/update-version.js",
|
|
56
|
+
"watch:es": "yarn --silent build:es:base --watch"
|
|
55
57
|
},
|
|
56
58
|
"devDependencies": {
|
|
57
|
-
"@instantsearch/mocks": "1.
|
|
58
|
-
"@instantsearch/tests": "1.
|
|
59
|
-
"@instantsearch/testutils": "1.
|
|
59
|
+
"@instantsearch/mocks": "1.39.0",
|
|
60
|
+
"@instantsearch/tests": "1.39.0",
|
|
61
|
+
"@instantsearch/testutils": "1.28.0",
|
|
60
62
|
"@storybook/html": "5.3.9",
|
|
61
63
|
"@types/scriptjs": "0.0.2",
|
|
62
|
-
"algoliasearch": "4.
|
|
64
|
+
"algoliasearch": "4.22.1",
|
|
63
65
|
"places.js": "1.17.1",
|
|
64
66
|
"scriptjs": "2.5.9",
|
|
65
67
|
"webpack": "4.47.0"
|
|
66
68
|
},
|
|
67
|
-
"gitHead": "
|
|
69
|
+
"gitHead": "358f849cba15cbbb415da05feb582b47358aa239"
|
|
68
70
|
}
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.default = Hits;
|
|
8
|
-
var _instantsearchUiComponents = require("instantsearch-ui-components");
|
|
9
|
-
var _preact = require("preact");
|
|
10
|
-
var _listener = require("../../lib/insights/listener");
|
|
11
|
-
var _utils = require("../../lib/utils");
|
|
12
|
-
var _Template = _interopRequireDefault(require("../Template/Template"));
|
|
13
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
14
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
15
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
16
|
-
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; }
|
|
17
|
-
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
18
|
-
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
19
|
-
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); }
|
|
20
|
-
function Hits(_ref) {
|
|
21
|
-
var results = _ref.results,
|
|
22
|
-
hits = _ref.hits,
|
|
23
|
-
insights = _ref.insights,
|
|
24
|
-
bindEvent = _ref.bindEvent,
|
|
25
|
-
sendEvent = _ref.sendEvent,
|
|
26
|
-
cssClasses = _ref.cssClasses,
|
|
27
|
-
templateProps = _ref.templateProps;
|
|
28
|
-
var handleInsightsClick = (0, _listener.createInsightsEventHandler)({
|
|
29
|
-
insights: insights,
|
|
30
|
-
sendEvent: sendEvent
|
|
31
|
-
});
|
|
32
|
-
if (results.hits.length === 0) {
|
|
33
|
-
return (0, _preact.h)(_Template.default, _extends({}, templateProps, {
|
|
34
|
-
templateKey: "empty",
|
|
35
|
-
rootProps: {
|
|
36
|
-
className: (0, _instantsearchUiComponents.cx)(cssClasses.root, cssClasses.emptyRoot),
|
|
37
|
-
onClick: handleInsightsClick
|
|
38
|
-
},
|
|
39
|
-
data: results
|
|
40
|
-
}));
|
|
41
|
-
}
|
|
42
|
-
return (0, _preact.h)("div", {
|
|
43
|
-
className: cssClasses.root
|
|
44
|
-
}, (0, _preact.h)("ol", {
|
|
45
|
-
className: cssClasses.list
|
|
46
|
-
}, hits.map(function (hit, index) {
|
|
47
|
-
return (0, _preact.h)(_Template.default, _extends({}, templateProps, {
|
|
48
|
-
templateKey: "item",
|
|
49
|
-
rootTagName: "li",
|
|
50
|
-
rootProps: {
|
|
51
|
-
className: cssClasses.item,
|
|
52
|
-
onClick: function onClick(event) {
|
|
53
|
-
handleInsightsClick(event);
|
|
54
|
-
sendEvent('click:internal', hit, 'Hit Clicked');
|
|
55
|
-
},
|
|
56
|
-
onAuxClick: function onAuxClick(event) {
|
|
57
|
-
handleInsightsClick(event);
|
|
58
|
-
sendEvent('click:internal', hit, 'Hit Clicked');
|
|
59
|
-
}
|
|
60
|
-
},
|
|
61
|
-
key: hit.objectID,
|
|
62
|
-
data: _objectSpread(_objectSpread({}, hit), {}, {
|
|
63
|
-
get __hitIndex() {
|
|
64
|
-
process.env.NODE_ENV === 'development' ? (0, _utils.warning)(false, 'The `__hitIndex` property is deprecated. Use the absolute `__position` instead.') : void 0;
|
|
65
|
-
return index;
|
|
66
|
-
}
|
|
67
|
-
}),
|
|
68
|
-
bindEvent: bindEvent,
|
|
69
|
-
sendEvent: sendEvent
|
|
70
|
-
}));
|
|
71
|
-
})));
|
|
72
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
import { h } from 'preact';
|
|
3
|
-
import type { PreparedTemplateProps } from '../../lib/templating';
|
|
4
|
-
import type { BindEventForHits, SendEventForHits } from '../../lib/utils';
|
|
5
|
-
import type { ComponentCSSClasses, Hit, InsightsClient } from '../../types';
|
|
6
|
-
import type { HitsCSSClasses, HitsTemplates } from '../../widgets/hits/hits';
|
|
7
|
-
import type { SearchResults } from 'algoliasearch-helper';
|
|
8
|
-
export type HitsComponentCSSClasses = ComponentCSSClasses<HitsCSSClasses>;
|
|
9
|
-
export type HitsComponentTemplates = Required<HitsTemplates>;
|
|
10
|
-
export type HitsProps = {
|
|
11
|
-
results: SearchResults;
|
|
12
|
-
hits: Hit[];
|
|
13
|
-
insights?: InsightsClient;
|
|
14
|
-
sendEvent: SendEventForHits;
|
|
15
|
-
bindEvent: BindEventForHits;
|
|
16
|
-
cssClasses: HitsComponentCSSClasses;
|
|
17
|
-
templateProps: PreparedTemplateProps<HitsComponentTemplates>;
|
|
18
|
-
};
|
|
19
|
-
export default function Hits({ results, hits, insights, bindEvent, sendEvent, cssClasses, templateProps, }: HitsProps): h.JSX.Element;
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
2
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
3
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
4
|
-
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; }
|
|
5
|
-
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
6
|
-
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
7
|
-
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); }
|
|
8
|
-
import { cx } from 'instantsearch-ui-components';
|
|
9
|
-
import { h } from 'preact';
|
|
10
|
-
import { createInsightsEventHandler } from "../../lib/insights/listener.js";
|
|
11
|
-
import { warning } from "../../lib/utils/index.js";
|
|
12
|
-
import Template from "../Template/Template.js";
|
|
13
|
-
export default function Hits(_ref) {
|
|
14
|
-
var results = _ref.results,
|
|
15
|
-
hits = _ref.hits,
|
|
16
|
-
insights = _ref.insights,
|
|
17
|
-
bindEvent = _ref.bindEvent,
|
|
18
|
-
sendEvent = _ref.sendEvent,
|
|
19
|
-
cssClasses = _ref.cssClasses,
|
|
20
|
-
templateProps = _ref.templateProps;
|
|
21
|
-
var handleInsightsClick = createInsightsEventHandler({
|
|
22
|
-
insights: insights,
|
|
23
|
-
sendEvent: sendEvent
|
|
24
|
-
});
|
|
25
|
-
if (results.hits.length === 0) {
|
|
26
|
-
return h(Template, _extends({}, templateProps, {
|
|
27
|
-
templateKey: "empty",
|
|
28
|
-
rootProps: {
|
|
29
|
-
className: cx(cssClasses.root, cssClasses.emptyRoot),
|
|
30
|
-
onClick: handleInsightsClick
|
|
31
|
-
},
|
|
32
|
-
data: results
|
|
33
|
-
}));
|
|
34
|
-
}
|
|
35
|
-
return h("div", {
|
|
36
|
-
className: cssClasses.root
|
|
37
|
-
}, h("ol", {
|
|
38
|
-
className: cssClasses.list
|
|
39
|
-
}, hits.map(function (hit, index) {
|
|
40
|
-
return h(Template, _extends({}, templateProps, {
|
|
41
|
-
templateKey: "item",
|
|
42
|
-
rootTagName: "li",
|
|
43
|
-
rootProps: {
|
|
44
|
-
className: cssClasses.item,
|
|
45
|
-
onClick: function onClick(event) {
|
|
46
|
-
handleInsightsClick(event);
|
|
47
|
-
sendEvent('click:internal', hit, 'Hit Clicked');
|
|
48
|
-
},
|
|
49
|
-
onAuxClick: function onAuxClick(event) {
|
|
50
|
-
handleInsightsClick(event);
|
|
51
|
-
sendEvent('click:internal', hit, 'Hit Clicked');
|
|
52
|
-
}
|
|
53
|
-
},
|
|
54
|
-
key: hit.objectID,
|
|
55
|
-
data: _objectSpread(_objectSpread({}, hit), {}, {
|
|
56
|
-
get __hitIndex() {
|
|
57
|
-
process.env.NODE_ENV === 'development' ? warning(false, 'The `__hitIndex` property is deprecated. Use the absolute `__position` instead.') : void 0;
|
|
58
|
-
return index;
|
|
59
|
-
}
|
|
60
|
-
}),
|
|
61
|
-
bindEvent: bindEvent,
|
|
62
|
-
sendEvent: sendEvent
|
|
63
|
-
}));
|
|
64
|
-
})));
|
|
65
|
-
}
|