instantsearch.js 4.77.0 → 4.77.2
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/components/RefinementList/RefinementList.js +2 -2
- package/cjs/lib/utils/getAppIdAndApiKey.js +3 -3
- package/cjs/lib/version.js +1 -1
- package/cjs/widgets/frequently-bought-together/frequently-bought-together.js +8 -2
- package/cjs/widgets/looking-similar/looking-similar.js +8 -2
- package/cjs/widgets/related-products/related-products.js +8 -2
- package/cjs/widgets/trending-items/trending-items.js +8 -2
- package/dist/instantsearch.development.d.ts +36 -36
- package/dist/instantsearch.development.js +75 -22
- package/dist/instantsearch.development.js.map +1 -1
- package/dist/instantsearch.production.d.ts +36 -36
- package/dist/instantsearch.production.min.d.ts +36 -36
- package/dist/instantsearch.production.min.js +2 -2
- package/dist/instantsearch.production.min.js.map +1 -1
- package/es/components/RefinementList/RefinementList.js +2 -2
- package/es/connectors/frequently-bought-together/connectFrequentlyBoughtTogether.d.ts +4 -4
- package/es/connectors/looking-similar/connectLookingSimilar.d.ts +4 -4
- package/es/connectors/related-products/connectRelatedProducts.d.ts +4 -4
- package/es/connectors/trending-items/connectTrendingItems.d.ts +4 -4
- package/es/lib/utils/getAppIdAndApiKey.js +3 -3
- package/es/lib/version.d.ts +1 -1
- package/es/lib/version.js +1 -1
- package/es/widgets/frequently-bought-together/frequently-bought-together.d.ts +7 -7
- package/es/widgets/frequently-bought-together/frequently-bought-together.js +8 -2
- package/es/widgets/looking-similar/looking-similar.d.ts +7 -7
- package/es/widgets/looking-similar/looking-similar.js +8 -2
- package/es/widgets/related-products/related-products.d.ts +7 -7
- package/es/widgets/related-products/related-products.js +8 -2
- package/es/widgets/trending-items/trending-items.d.ts +7 -7
- package/es/widgets/trending-items/trending-items.js +8 -2
- package/package.json +7 -7
|
@@ -168,8 +168,8 @@ var RefinementList = /*#__PURE__*/function (_Component) {
|
|
|
168
168
|
}, {
|
|
169
169
|
key: "componentDidUpdate",
|
|
170
170
|
value: function componentDidUpdate() {
|
|
171
|
-
var _this$listRef$current, _this$listRef$current2;
|
|
172
|
-
(_this$listRef$current = this.listRef.current) === null || _this$listRef$current === void 0 ? void 0 : (_this$listRef$current2 = _this$listRef$current.querySelector("input[value=\"".concat(this.lastRefinedValue, "\"]"))) === null || _this$listRef$current2 === void 0 ? void 0 : _this$listRef$current2.focus();
|
|
171
|
+
var _this$listRef$current, _this$listRef$current2, _this$lastRefinedValu;
|
|
172
|
+
(_this$listRef$current = this.listRef.current) === null || _this$listRef$current === void 0 ? void 0 : (_this$listRef$current2 = _this$listRef$current.querySelector("input[value=\"".concat((_this$lastRefinedValu = this.lastRefinedValue) === null || _this$lastRefinedValu === void 0 ? void 0 : _this$lastRefinedValu.replace('"', '\\"'), "\"]"))) === null || _this$listRef$current2 === void 0 ? void 0 : _this$listRef$current2.focus();
|
|
173
173
|
this.lastRefinedValue = undefined;
|
|
174
174
|
}
|
|
175
175
|
}, {
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import type { SendEventForHits } from '../../lib/utils';
|
|
2
|
-
import type { Connector, TransformItems, BaseHit, Renderer, Unmounter, UnknownWidgetParams, RecommendResponse, AlgoliaHit } from '../../types';
|
|
2
|
+
import type { Connector, TransformItems, BaseHit, Renderer, Unmounter, UnknownWidgetParams, RecommendResponse, Hit, AlgoliaHit } from '../../types';
|
|
3
3
|
import type { PlainSearchParameters } from 'algoliasearch-helper';
|
|
4
4
|
export type FrequentlyBoughtTogetherRenderState<THit extends NonNullable<object> = BaseHit> = {
|
|
5
5
|
/**
|
|
6
6
|
* The matched recommendations from Algolia API.
|
|
7
7
|
*/
|
|
8
|
-
items: Array<
|
|
8
|
+
items: Array<Hit<THit>>;
|
|
9
9
|
/**
|
|
10
10
|
* Sends an event to the Insights middleware.
|
|
11
11
|
*/
|
|
@@ -37,7 +37,7 @@ export type FrequentlyBoughtTogetherConnectorParams<THit extends NonNullable<obj
|
|
|
37
37
|
/**
|
|
38
38
|
* Function to transform the items passed to the templates.
|
|
39
39
|
*/
|
|
40
|
-
transformItems?: TransformItems<
|
|
40
|
+
transformItems?: TransformItems<Hit<THit>, {
|
|
41
41
|
results: RecommendResponse<AlgoliaHit<THit>>;
|
|
42
42
|
}>;
|
|
43
43
|
};
|
|
@@ -157,7 +157,7 @@ declare const _default: <TWidgetParams extends UnknownWidgetParams>(renderFn: Re
|
|
|
157
157
|
} & {
|
|
158
158
|
results: RecommendResponse<any>;
|
|
159
159
|
})): {
|
|
160
|
-
items:
|
|
160
|
+
items: Hit<THit>[];
|
|
161
161
|
widgetParams: TWidgetParams & FrequentlyBoughtTogetherConnectorParams<THit>;
|
|
162
162
|
sendEvent: SendEventForHits;
|
|
163
163
|
};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import type { SendEventForHits } from '../../lib/utils';
|
|
2
|
-
import type { Connector, TransformItems, BaseHit, Renderer, Unmounter, UnknownWidgetParams, RecommendResponse, AlgoliaHit } from '../../types';
|
|
2
|
+
import type { Connector, TransformItems, BaseHit, Renderer, Unmounter, UnknownWidgetParams, RecommendResponse, Hit, AlgoliaHit } from '../../types';
|
|
3
3
|
import type { PlainSearchParameters } from 'algoliasearch-helper';
|
|
4
4
|
export type LookingSimilarRenderState<THit extends NonNullable<object> = BaseHit> = {
|
|
5
5
|
/**
|
|
6
6
|
* The matched recommendations from the Algolia API.
|
|
7
7
|
*/
|
|
8
|
-
items: Array<
|
|
8
|
+
items: Array<Hit<THit>>;
|
|
9
9
|
/**
|
|
10
10
|
* Sends an event to the Insights middleware.
|
|
11
11
|
*/
|
|
@@ -41,7 +41,7 @@ export type LookingSimilarConnectorParams<THit extends NonNullable<object> = Bas
|
|
|
41
41
|
/**
|
|
42
42
|
* Function to transform the items passed to the templates.
|
|
43
43
|
*/
|
|
44
|
-
transformItems?: TransformItems<
|
|
44
|
+
transformItems?: TransformItems<Hit<THit>, {
|
|
45
45
|
results: RecommendResponse<AlgoliaHit<THit>>;
|
|
46
46
|
}>;
|
|
47
47
|
};
|
|
@@ -161,7 +161,7 @@ declare const _default: <TWidgetParams extends UnknownWidgetParams>(renderFn: Re
|
|
|
161
161
|
} & {
|
|
162
162
|
results: RecommendResponse<any>;
|
|
163
163
|
})): {
|
|
164
|
-
items:
|
|
164
|
+
items: Hit<THit>[];
|
|
165
165
|
widgetParams: TWidgetParams & LookingSimilarConnectorParams<THit>;
|
|
166
166
|
sendEvent: SendEventForHits;
|
|
167
167
|
};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import type { SendEventForHits } from '../../lib/utils';
|
|
2
|
-
import type { Connector, TransformItems, BaseHit, Renderer, Unmounter, UnknownWidgetParams, RecommendResponse, AlgoliaHit } from '../../types';
|
|
2
|
+
import type { Connector, TransformItems, BaseHit, Renderer, Unmounter, UnknownWidgetParams, RecommendResponse, Hit, AlgoliaHit } from '../../types';
|
|
3
3
|
import type { PlainSearchParameters } from 'algoliasearch-helper';
|
|
4
4
|
export type RelatedProductsRenderState<THit extends NonNullable<object> = BaseHit> = {
|
|
5
5
|
/**
|
|
6
6
|
* The matched recommendations from the Algolia API.
|
|
7
7
|
*/
|
|
8
|
-
items: Array<
|
|
8
|
+
items: Array<Hit<THit>>;
|
|
9
9
|
/**
|
|
10
10
|
* Sends an event to the Insights middleware.
|
|
11
11
|
*/
|
|
@@ -41,7 +41,7 @@ export type RelatedProductsConnectorParams<THit extends NonNullable<object> = Ba
|
|
|
41
41
|
/**
|
|
42
42
|
* Function to transform the items passed to the templates.
|
|
43
43
|
*/
|
|
44
|
-
transformItems?: TransformItems<
|
|
44
|
+
transformItems?: TransformItems<Hit<THit>, {
|
|
45
45
|
results: RecommendResponse<AlgoliaHit<THit>>;
|
|
46
46
|
}>;
|
|
47
47
|
};
|
|
@@ -161,7 +161,7 @@ declare const _default: <TWidgetParams extends UnknownWidgetParams>(renderFn: Re
|
|
|
161
161
|
} & {
|
|
162
162
|
results: RecommendResponse<any>;
|
|
163
163
|
})): {
|
|
164
|
-
items:
|
|
164
|
+
items: Hit<BaseHit>[] | Hit<THit>[];
|
|
165
165
|
widgetParams: TWidgetParams & RelatedProductsConnectorParams<THit>;
|
|
166
166
|
sendEvent: SendEventForHits;
|
|
167
167
|
};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import type { SendEventForHits } from '../../lib/utils';
|
|
2
|
-
import type { Connector, TransformItems, BaseHit, Renderer, Unmounter, UnknownWidgetParams, RecommendResponse, AlgoliaHit } from '../../types';
|
|
2
|
+
import type { Connector, TransformItems, BaseHit, Renderer, Unmounter, UnknownWidgetParams, RecommendResponse, Hit, AlgoliaHit } from '../../types';
|
|
3
3
|
import type { PlainSearchParameters } from 'algoliasearch-helper';
|
|
4
4
|
export type TrendingItemsRenderState<THit extends NonNullable<object> = BaseHit> = {
|
|
5
5
|
/**
|
|
6
6
|
* The matched recommendations from the Algolia API.
|
|
7
7
|
*/
|
|
8
|
-
items: Array<
|
|
8
|
+
items: Array<Hit<THit>>;
|
|
9
9
|
/**
|
|
10
10
|
* Sends an event to the Insights middleware.
|
|
11
11
|
*/
|
|
@@ -49,7 +49,7 @@ export type TrendingItemsConnectorParams<THit extends NonNullable<object> = Base
|
|
|
49
49
|
/**
|
|
50
50
|
* Function to transform the items passed to the templates.
|
|
51
51
|
*/
|
|
52
|
-
transformItems?: TransformItems<
|
|
52
|
+
transformItems?: TransformItems<Hit<THit>, {
|
|
53
53
|
results: RecommendResponse<AlgoliaHit<THit>>;
|
|
54
54
|
}>;
|
|
55
55
|
};
|
|
@@ -169,7 +169,7 @@ declare const _default: <TWidgetParams extends UnknownWidgetParams>(renderFn: Re
|
|
|
169
169
|
} & {
|
|
170
170
|
results: RecommendResponse<any>;
|
|
171
171
|
})): {
|
|
172
|
-
items:
|
|
172
|
+
items: Hit<THit>[];
|
|
173
173
|
widgetParams: TWidgetParams & TrendingItemsConnectorParams<THit>;
|
|
174
174
|
sendEvent: SendEventForHits;
|
|
175
175
|
};
|
|
@@ -10,9 +10,9 @@ export function getAppIdAndApiKey(searchClient) {
|
|
|
10
10
|
var queryParameters = transporter.queryParameters || transporter.baseQueryParameters;
|
|
11
11
|
var APP_ID = 'x-algolia-application-id';
|
|
12
12
|
var API_KEY = 'x-algolia-api-key';
|
|
13
|
-
var
|
|
14
|
-
var
|
|
15
|
-
return [
|
|
13
|
+
var appId = headers[APP_ID] || queryParameters[APP_ID];
|
|
14
|
+
var apiKey = headers[API_KEY] || queryParameters[API_KEY];
|
|
15
|
+
return [appId, apiKey];
|
|
16
16
|
} else {
|
|
17
17
|
// searchClient v3
|
|
18
18
|
return [searchClient.applicationID, searchClient.apiKey];
|
package/es/lib/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: "4.77.
|
|
1
|
+
declare const _default: "4.77.2";
|
|
2
2
|
export default _default;
|
package/es/lib/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export default '4.77.
|
|
1
|
+
export default '4.77.2';
|
|
@@ -1,29 +1,29 @@
|
|
|
1
1
|
|
|
2
2
|
import type { FrequentlyBoughtTogetherWidgetDescription, FrequentlyBoughtTogetherConnectorParams } from '../../connectors/frequently-bought-together/connectFrequentlyBoughtTogether';
|
|
3
|
-
import type { Template, WidgetFactory,
|
|
3
|
+
import type { Template, WidgetFactory, BaseHit, RecommendResponse, Hit, TemplateWithBindEvent } from '../../types';
|
|
4
4
|
import type { RecommendClassNames, FrequentlyBoughtTogetherProps as FrequentlyBoughtTogetherUiProps } from 'instantsearch-ui-components';
|
|
5
5
|
export type FrequentlyBoughtTogetherCSSClasses = Partial<RecommendClassNames>;
|
|
6
6
|
export type FrequentlyBoughtTogetherTemplates<THit extends NonNullable<object> = BaseHit> = Partial<{
|
|
7
7
|
/**
|
|
8
8
|
* Template to use when there are no results.
|
|
9
9
|
*/
|
|
10
|
-
empty: Template<RecommendResponse<
|
|
10
|
+
empty: Template<RecommendResponse<Hit<THit>>>;
|
|
11
11
|
/**
|
|
12
12
|
* Template to use for the header of the widget.
|
|
13
13
|
*/
|
|
14
|
-
header: Template<Pick<Parameters<NonNullable<FrequentlyBoughtTogetherUiProps<
|
|
14
|
+
header: Template<Pick<Parameters<NonNullable<FrequentlyBoughtTogetherUiProps<Hit<THit>>['headerComponent']>>[0], 'items'> & {
|
|
15
15
|
cssClasses: RecommendClassNames;
|
|
16
16
|
}>;
|
|
17
17
|
/**
|
|
18
18
|
* Template to use for each result. This template will receive an object containing a single record.
|
|
19
19
|
*/
|
|
20
|
-
item:
|
|
20
|
+
item: TemplateWithBindEvent<Hit<THit>>;
|
|
21
21
|
/**
|
|
22
22
|
* Template to use to wrap all items.
|
|
23
23
|
*/
|
|
24
|
-
layout: Template<Pick<Parameters<NonNullable<FrequentlyBoughtTogetherUiProps<
|
|
24
|
+
layout: Template<Pick<Parameters<NonNullable<FrequentlyBoughtTogetherUiProps<Hit<THit>>['layout']>>[0], 'items'> & {
|
|
25
25
|
templates: {
|
|
26
|
-
item: FrequentlyBoughtTogetherUiProps<
|
|
26
|
+
item: FrequentlyBoughtTogetherUiProps<Hit<THit>>['itemComponent'];
|
|
27
27
|
};
|
|
28
28
|
cssClasses: Pick<FrequentlyBoughtTogetherCSSClasses, 'list' | 'item'>;
|
|
29
29
|
}>;
|
|
@@ -227,7 +227,7 @@ declare const _default: <THit extends NonNullable<object> = BaseHit>(widgetParam
|
|
|
227
227
|
} & {
|
|
228
228
|
results: RecommendResponse<any>;
|
|
229
229
|
})): {
|
|
230
|
-
items:
|
|
230
|
+
items: Hit<THit>[];
|
|
231
231
|
widgetParams: Partial<FrequentlyBoughtTogetherWidgetParams<BaseHit>> & FrequentlyBoughtTogetherConnectorParams<THit>;
|
|
232
232
|
sendEvent: import("../../lib/utils").SendEventForHits;
|
|
233
233
|
};
|
|
@@ -1,9 +1,12 @@
|
|
|
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
|
+
var _excluded = ["item", "sendEvent"];
|
|
2
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; }
|
|
3
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; }
|
|
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(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
6
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(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; }
|
|
7
10
|
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
11
|
import { createFrequentlyBoughtTogetherComponent } from 'instantsearch-ui-components';
|
|
9
12
|
import { Fragment, h, render } from 'preact';
|
|
@@ -47,12 +50,15 @@ var renderer = function renderer(_ref) {
|
|
|
47
50
|
}));
|
|
48
51
|
} : undefined;
|
|
49
52
|
var itemComponent = templates.item ? function (_ref3) {
|
|
50
|
-
var item = _ref3.item
|
|
53
|
+
var item = _ref3.item,
|
|
54
|
+
_sendEvent = _ref3.sendEvent,
|
|
55
|
+
rootProps = _objectWithoutProperties(_ref3, _excluded);
|
|
51
56
|
return h(TemplateComponent, _extends({}, renderState.templateProps, {
|
|
52
57
|
templateKey: "item",
|
|
53
58
|
rootTagName: "fragment",
|
|
54
59
|
data: item,
|
|
55
|
-
sendEvent:
|
|
60
|
+
sendEvent: _sendEvent,
|
|
61
|
+
rootProps: _objectSpread({}, rootProps)
|
|
56
62
|
}));
|
|
57
63
|
} : undefined;
|
|
58
64
|
var emptyComponent = templates.empty ? function () {
|
|
@@ -1,29 +1,29 @@
|
|
|
1
1
|
|
|
2
2
|
import type { LookingSimilarWidgetDescription, LookingSimilarConnectorParams } from '../../connectors/looking-similar/connectLookingSimilar';
|
|
3
|
-
import type { Template, WidgetFactory,
|
|
3
|
+
import type { Template, WidgetFactory, BaseHit, RecommendResponse, Hit, TemplateWithBindEvent } from '../../types';
|
|
4
4
|
import type { RecommendClassNames, LookingSimilarProps as LookingSimilarUiProps } from 'instantsearch-ui-components';
|
|
5
5
|
export type LookingSimilarCSSClasses = Partial<RecommendClassNames>;
|
|
6
6
|
export type LookingSimilarTemplates<THit extends NonNullable<object> = BaseHit> = Partial<{
|
|
7
7
|
/**
|
|
8
8
|
* Template to use when there are no results.
|
|
9
9
|
*/
|
|
10
|
-
empty: Template<RecommendResponse<
|
|
10
|
+
empty: Template<RecommendResponse<Hit<THit>>>;
|
|
11
11
|
/**
|
|
12
12
|
* Template to use for the header of the widget.
|
|
13
13
|
*/
|
|
14
|
-
header: Template<Pick<Parameters<NonNullable<LookingSimilarUiProps<
|
|
14
|
+
header: Template<Pick<Parameters<NonNullable<LookingSimilarUiProps<Hit<THit>>['headerComponent']>>[0], 'items'> & {
|
|
15
15
|
cssClasses: RecommendClassNames;
|
|
16
16
|
}>;
|
|
17
17
|
/**
|
|
18
18
|
* Template to use for each result. This template will receive an object containing a single record.
|
|
19
19
|
*/
|
|
20
|
-
item:
|
|
20
|
+
item: TemplateWithBindEvent<Hit<THit>>;
|
|
21
21
|
/**
|
|
22
22
|
* Template to use to wrap all items.
|
|
23
23
|
*/
|
|
24
|
-
layout: Template<Pick<Parameters<NonNullable<LookingSimilarUiProps<
|
|
24
|
+
layout: Template<Pick<Parameters<NonNullable<LookingSimilarUiProps<Hit<THit>>['layout']>>[0], 'items'> & {
|
|
25
25
|
templates: {
|
|
26
|
-
item: LookingSimilarUiProps<
|
|
26
|
+
item: LookingSimilarUiProps<Hit<THit>>['itemComponent'];
|
|
27
27
|
};
|
|
28
28
|
cssClasses: Pick<LookingSimilarCSSClasses, 'list' | 'item'>;
|
|
29
29
|
}>;
|
|
@@ -227,7 +227,7 @@ declare const _default: <THit extends NonNullable<object> = BaseHit>(widgetParam
|
|
|
227
227
|
} & {
|
|
228
228
|
results: RecommendResponse<any>;
|
|
229
229
|
})): {
|
|
230
|
-
items:
|
|
230
|
+
items: Hit<THit>[];
|
|
231
231
|
widgetParams: Partial<LookingSimilarWidgetParams<BaseHit>> & LookingSimilarConnectorParams<THit>;
|
|
232
232
|
sendEvent: import("../../lib/utils").SendEventForHits;
|
|
233
233
|
};
|
|
@@ -1,9 +1,12 @@
|
|
|
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
|
+
var _excluded = ["item", "sendEvent"];
|
|
2
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; }
|
|
3
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; }
|
|
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(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
6
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(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; }
|
|
7
10
|
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
11
|
import { createLookingSimilarComponent } from 'instantsearch-ui-components';
|
|
9
12
|
import { Fragment, h, render } from 'preact';
|
|
@@ -47,12 +50,15 @@ function createRenderer(_ref) {
|
|
|
47
50
|
}));
|
|
48
51
|
} : undefined;
|
|
49
52
|
var itemComponent = templates.item ? function (_ref3) {
|
|
50
|
-
var item = _ref3.item
|
|
53
|
+
var item = _ref3.item,
|
|
54
|
+
_sendEvent = _ref3.sendEvent,
|
|
55
|
+
rootProps = _objectWithoutProperties(_ref3, _excluded);
|
|
51
56
|
return h(TemplateComponent, _extends({}, renderState.templateProps, {
|
|
52
57
|
templateKey: "item",
|
|
53
58
|
rootTagName: "fragment",
|
|
54
59
|
data: item,
|
|
55
|
-
sendEvent:
|
|
60
|
+
sendEvent: _sendEvent,
|
|
61
|
+
rootProps: _objectSpread({}, rootProps)
|
|
56
62
|
}));
|
|
57
63
|
} : undefined;
|
|
58
64
|
var emptyComponent = templates.empty ? function () {
|
|
@@ -1,29 +1,29 @@
|
|
|
1
1
|
|
|
2
2
|
import type { RelatedProductsWidgetDescription, RelatedProductsConnectorParams } from '../../connectors/related-products/connectRelatedProducts';
|
|
3
|
-
import type { Template, WidgetFactory,
|
|
3
|
+
import type { Template, WidgetFactory, Hit, BaseHit, RecommendResponse, TemplateWithBindEvent } from '../../types';
|
|
4
4
|
import type { RecommendClassNames, RelatedProductsProps as RelatedProductsUiProps } from 'instantsearch-ui-components';
|
|
5
5
|
export type RelatedProductsCSSClasses = Partial<RecommendClassNames>;
|
|
6
6
|
export type RelatedProductsTemplates<THit extends NonNullable<object> = BaseHit> = Partial<{
|
|
7
7
|
/**
|
|
8
8
|
* Template to use when there are no results.
|
|
9
9
|
*/
|
|
10
|
-
empty: Template<RecommendResponse<
|
|
10
|
+
empty: Template<RecommendResponse<Hit<THit>>>;
|
|
11
11
|
/**
|
|
12
12
|
* Template to use for the header of the widget.
|
|
13
13
|
*/
|
|
14
|
-
header: Template<Pick<Parameters<NonNullable<RelatedProductsUiProps<
|
|
14
|
+
header: Template<Pick<Parameters<NonNullable<RelatedProductsUiProps<Hit<THit>>['headerComponent']>>[0], 'items'> & {
|
|
15
15
|
cssClasses: RecommendClassNames;
|
|
16
16
|
}>;
|
|
17
17
|
/**
|
|
18
18
|
* Template to use for each result. This template will receive an object containing a single record.
|
|
19
19
|
*/
|
|
20
|
-
item:
|
|
20
|
+
item: TemplateWithBindEvent<Hit<THit>>;
|
|
21
21
|
/**
|
|
22
22
|
* Template to use to wrap all items.
|
|
23
23
|
*/
|
|
24
|
-
layout: Template<Pick<Parameters<NonNullable<RelatedProductsUiProps<
|
|
24
|
+
layout: Template<Pick<Parameters<NonNullable<RelatedProductsUiProps<Hit<THit>>['layout']>>[0], 'items'> & {
|
|
25
25
|
templates: {
|
|
26
|
-
item: RelatedProductsUiProps<
|
|
26
|
+
item: RelatedProductsUiProps<Hit<THit>>['itemComponent'];
|
|
27
27
|
};
|
|
28
28
|
cssClasses: Pick<RelatedProductsCSSClasses, 'list' | 'item'>;
|
|
29
29
|
}>;
|
|
@@ -227,7 +227,7 @@ declare const _default: <THit extends NonNullable<object> = BaseHit>(widgetParam
|
|
|
227
227
|
} & {
|
|
228
228
|
results: RecommendResponse<any>;
|
|
229
229
|
})): {
|
|
230
|
-
items:
|
|
230
|
+
items: Hit<BaseHit>[] | Hit<THit>[];
|
|
231
231
|
widgetParams: Partial<RelatedProductsWidgetParams<BaseHit>> & RelatedProductsConnectorParams<THit>;
|
|
232
232
|
sendEvent: import("../../lib/utils").SendEventForHits;
|
|
233
233
|
};
|
|
@@ -1,9 +1,12 @@
|
|
|
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
|
+
var _excluded = ["item", "sendEvent"];
|
|
2
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; }
|
|
3
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; }
|
|
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(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
6
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(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; }
|
|
7
10
|
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
11
|
import { createRelatedProductsComponent } from 'instantsearch-ui-components';
|
|
9
12
|
import { Fragment, h, render } from 'preact';
|
|
@@ -47,12 +50,15 @@ function createRenderer(_ref) {
|
|
|
47
50
|
}));
|
|
48
51
|
} : undefined;
|
|
49
52
|
var itemComponent = templates.item ? function (_ref3) {
|
|
50
|
-
var item = _ref3.item
|
|
53
|
+
var item = _ref3.item,
|
|
54
|
+
_sendEvent = _ref3.sendEvent,
|
|
55
|
+
rootProps = _objectWithoutProperties(_ref3, _excluded);
|
|
51
56
|
return h(TemplateComponent, _extends({}, renderState.templateProps, {
|
|
52
57
|
templateKey: "item",
|
|
53
58
|
rootTagName: "fragment",
|
|
54
59
|
data: item,
|
|
55
|
-
sendEvent:
|
|
60
|
+
sendEvent: _sendEvent,
|
|
61
|
+
rootProps: _objectSpread({}, rootProps)
|
|
56
62
|
}));
|
|
57
63
|
} : undefined;
|
|
58
64
|
var emptyComponent = templates.empty ? function () {
|
|
@@ -1,29 +1,29 @@
|
|
|
1
1
|
|
|
2
2
|
import type { TrendingItemsWidgetDescription, TrendingItemsConnectorParams } from '../../connectors/trending-items/connectTrendingItems';
|
|
3
|
-
import type { Template, WidgetFactory,
|
|
3
|
+
import type { Template, WidgetFactory, BaseHit, RecommendResponse, Hit, TemplateWithBindEvent } from '../../types';
|
|
4
4
|
import type { RecommendClassNames, TrendingItemsProps as TrendingItemsUiProps } from 'instantsearch-ui-components';
|
|
5
5
|
export type TrendingItemsCSSClasses = Partial<RecommendClassNames>;
|
|
6
6
|
export type TrendingItemsTemplates<THit extends NonNullable<object> = BaseHit> = Partial<{
|
|
7
7
|
/**
|
|
8
8
|
* Template to use when there are no results.
|
|
9
9
|
*/
|
|
10
|
-
empty: Template<RecommendResponse<
|
|
10
|
+
empty: Template<RecommendResponse<Hit<THit>>>;
|
|
11
11
|
/**
|
|
12
12
|
* Template to use for the header of the widget.
|
|
13
13
|
*/
|
|
14
|
-
header: Template<Pick<Parameters<NonNullable<TrendingItemsUiProps<
|
|
14
|
+
header: Template<Pick<Parameters<NonNullable<TrendingItemsUiProps<Hit<THit>>['headerComponent']>>[0], 'items'> & {
|
|
15
15
|
cssClasses: RecommendClassNames;
|
|
16
16
|
}>;
|
|
17
17
|
/**
|
|
18
18
|
* Template to use for each result. This template will receive an object containing a single record.
|
|
19
19
|
*/
|
|
20
|
-
item:
|
|
20
|
+
item: TemplateWithBindEvent<Hit<THit>>;
|
|
21
21
|
/**
|
|
22
22
|
* Template to use to wrap all items.
|
|
23
23
|
*/
|
|
24
|
-
layout: Template<Pick<Parameters<NonNullable<TrendingItemsUiProps<
|
|
24
|
+
layout: Template<Pick<Parameters<NonNullable<TrendingItemsUiProps<Hit<THit>>['layout']>>[0], 'items'> & {
|
|
25
25
|
templates: {
|
|
26
|
-
item: TrendingItemsUiProps<
|
|
26
|
+
item: TrendingItemsUiProps<Hit<THit>>['itemComponent'];
|
|
27
27
|
};
|
|
28
28
|
cssClasses: Pick<TrendingItemsCSSClasses, 'list' | 'item'>;
|
|
29
29
|
}>;
|
|
@@ -227,7 +227,7 @@ declare const _default: <THit extends NonNullable<object> = BaseHit>(widgetParam
|
|
|
227
227
|
} & {
|
|
228
228
|
results: RecommendResponse<any>;
|
|
229
229
|
})): {
|
|
230
|
-
items:
|
|
230
|
+
items: Hit<THit>[];
|
|
231
231
|
widgetParams: Partial<TrendingItemsWidgetParams<BaseHit>> & TrendingItemsConnectorParams<THit>;
|
|
232
232
|
sendEvent: import("../../lib/utils").SendEventForHits;
|
|
233
233
|
};
|
|
@@ -1,9 +1,12 @@
|
|
|
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
|
+
var _excluded = ["item", "sendEvent"];
|
|
2
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; }
|
|
3
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; }
|
|
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(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
6
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(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; }
|
|
7
10
|
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
11
|
import { createTrendingItemsComponent } from 'instantsearch-ui-components';
|
|
9
12
|
import { Fragment, h, render } from 'preact';
|
|
@@ -47,12 +50,15 @@ function createRenderer(_ref) {
|
|
|
47
50
|
}));
|
|
48
51
|
} : undefined;
|
|
49
52
|
var itemComponent = templates.item ? function (_ref3) {
|
|
50
|
-
var item = _ref3.item
|
|
53
|
+
var item = _ref3.item,
|
|
54
|
+
_sendEvent = _ref3.sendEvent,
|
|
55
|
+
rootProps = _objectWithoutProperties(_ref3, _excluded);
|
|
51
56
|
return h(TemplateComponent, _extends({}, renderState.templateProps, {
|
|
52
57
|
templateKey: "item",
|
|
53
58
|
rootTagName: "fragment",
|
|
54
59
|
data: item,
|
|
55
|
-
sendEvent:
|
|
60
|
+
sendEvent: _sendEvent,
|
|
61
|
+
rootProps: _objectSpread({}, rootProps)
|
|
56
62
|
}));
|
|
57
63
|
} : undefined;
|
|
58
64
|
var emptyComponent = templates.empty ? function () {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "instantsearch.js",
|
|
3
|
-
"version": "4.77.
|
|
3
|
+
"version": "4.77.2",
|
|
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.55.12",
|
|
32
32
|
"@types/hogan.js": "^3.0.0",
|
|
33
33
|
"@types/qs": "^6.5.3",
|
|
34
|
-
"algoliasearch-helper": "3.
|
|
34
|
+
"algoliasearch-helper": "3.24.0",
|
|
35
35
|
"hogan.js": "^3.0.2",
|
|
36
36
|
"htm": "^3.0.0",
|
|
37
|
-
"instantsearch-ui-components": "0.11.
|
|
37
|
+
"instantsearch-ui-components": "0.11.1",
|
|
38
38
|
"preact": "^10.10.0",
|
|
39
39
|
"qs": "^6.5.1 < 6.10",
|
|
40
40
|
"search-insights": "^2.17.2"
|
|
@@ -56,9 +56,9 @@
|
|
|
56
56
|
"watch:es": "yarn --silent build:es:base --watch"
|
|
57
57
|
},
|
|
58
58
|
"devDependencies": {
|
|
59
|
-
"@instantsearch/mocks": "1.
|
|
60
|
-
"@instantsearch/tests": "1.
|
|
61
|
-
"@instantsearch/testutils": "1.
|
|
59
|
+
"@instantsearch/mocks": "1.69.0",
|
|
60
|
+
"@instantsearch/tests": "1.69.0",
|
|
61
|
+
"@instantsearch/testutils": "1.58.0",
|
|
62
62
|
"@storybook/html": "5.3.9",
|
|
63
63
|
"@types/scriptjs": "0.0.2",
|
|
64
64
|
"algoliasearch": "5.1.1",
|
|
@@ -66,5 +66,5 @@
|
|
|
66
66
|
"scriptjs": "2.5.9",
|
|
67
67
|
"webpack": "4.47.0"
|
|
68
68
|
},
|
|
69
|
-
"gitHead": "
|
|
69
|
+
"gitHead": "ea8a64806e3638af93e59f9403caf7c7234578ab"
|
|
70
70
|
}
|