instantsearch.js 4.46.0 → 4.46.1
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/CHANGELOG.md +12 -1
- package/cjs/connectors/toggle-refinement/connectToggleRefinement.js +3 -1
- package/cjs/helpers/components/Highlight.js +7 -7
- package/cjs/helpers/components/ReverseHighlight.js +7 -7
- package/cjs/helpers/components/ReverseSnippet.js +7 -7
- package/cjs/helpers/components/Snippet.js +7 -7
- package/cjs/lib/InstantSearch.js +33 -24
- package/cjs/lib/utils/capitalize.js +2 -5
- package/cjs/lib/utils/checkIndexUiState.js +3 -5
- package/cjs/lib/utils/checkRendering.js +4 -9
- package/cjs/lib/utils/clearRefinements.js +3 -9
- package/cjs/lib/utils/concatHighlightedParts.js +1 -1
- package/cjs/lib/utils/createSendEventForFacet.js +2 -4
- package/cjs/lib/utils/defer.js +3 -6
- package/cjs/lib/utils/detect-insights-client.js +1 -1
- package/cjs/lib/utils/documentation.js +6 -9
- package/cjs/lib/utils/escape-highlight.js +4 -6
- package/cjs/lib/utils/escape-html.js +60 -0
- package/cjs/lib/utils/find.js +2 -5
- package/cjs/lib/utils/findIndex.js +2 -5
- package/cjs/lib/utils/getContainerNode.js +4 -9
- package/cjs/lib/utils/getHighlightFromSiblings.js +3 -5
- package/cjs/lib/utils/getHighlightedParts.js +1 -1
- package/cjs/lib/utils/getObjectType.js +2 -5
- package/cjs/lib/utils/getPropertyByPath.js +2 -5
- package/cjs/lib/utils/getRefinements.js +4 -6
- package/cjs/lib/utils/index.js +562 -440
- package/cjs/lib/utils/isDomElement.js +2 -5
- package/cjs/lib/utils/isEqual.js +2 -5
- package/cjs/lib/utils/isFacetRefined.js +1 -1
- package/cjs/lib/utils/isFiniteNumber.js +3 -5
- package/cjs/lib/utils/isIndexWidget.js +10 -0
- package/cjs/lib/utils/isPlainObject.js +2 -5
- package/cjs/lib/utils/isSpecialClick.js +2 -5
- package/cjs/lib/utils/logger.js +3 -5
- package/cjs/lib/utils/mergeSearchParameters.js +7 -10
- package/cjs/lib/utils/noop.js +2 -5
- package/cjs/lib/utils/prepareTemplateProps.js +4 -9
- package/cjs/lib/utils/range.js +2 -5
- package/cjs/lib/utils/renderTemplate.js +2 -5
- package/cjs/lib/utils/resolveSearchParameters.js +3 -6
- package/cjs/lib/utils/reverseHighlightedParts.js +3 -5
- package/cjs/lib/utils/setIndexHelperState.js +28 -0
- package/cjs/lib/utils/toArray.js +2 -5
- package/cjs/lib/utils/uniq.js +2 -5
- package/cjs/lib/version.js +1 -1
- package/cjs/middlewares/createInsightsMiddleware.js +23 -30
- package/cjs/middlewares/createMetadataMiddleware.js +1 -0
- package/cjs/middlewares/createRouterMiddleware.js +1 -0
- package/cjs/widgets/index/index.js +8 -12
- package/dist/instantsearch.development.d.ts +11 -3
- package/dist/instantsearch.development.js +2242 -2181
- package/dist/instantsearch.development.js.map +1 -1
- package/dist/instantsearch.production.d.ts +11 -3
- package/dist/instantsearch.production.min.d.ts +11 -3
- package/dist/instantsearch.production.min.js +2 -2
- package/dist/instantsearch.production.min.js.map +1 -1
- package/es/components/Breadcrumb/Breadcrumb.d.ts +1 -1
- package/es/components/ClearRefinements/ClearRefinements.d.ts +1 -1
- package/es/components/GeoSearchControls/GeoSearchControls.d.ts +1 -1
- package/es/components/Hits/Hits.d.ts +1 -2
- package/es/components/RefinementList/RefinementList.d.ts +1 -1
- package/es/components/Template/Template.d.ts +1 -2
- package/es/components/ToggleRefinement/ToggleRefinement.d.ts +1 -4
- package/es/components/ToggleRefinement/ToggleRefinement.js +0 -4
- package/es/connectors/toggle-refinement/connectToggleRefinement.d.ts +3 -2
- package/es/connectors/toggle-refinement/connectToggleRefinement.js +3 -1
- package/es/helpers/components/Highlight.js +7 -5
- package/es/helpers/components/ReverseHighlight.js +7 -5
- package/es/helpers/components/ReverseSnippet.js +7 -5
- package/es/helpers/components/Snippet.js +7 -5
- package/es/lib/InstantSearch.d.ts +6 -1
- package/es/lib/InstantSearch.js +34 -21
- package/es/lib/utils/capitalize.d.ts +1 -2
- package/es/lib/utils/capitalize.js +2 -4
- package/es/lib/utils/checkIndexUiState.js +1 -1
- package/es/lib/utils/checkRendering.d.ts +1 -2
- package/es/lib/utils/checkRendering.js +3 -6
- package/es/lib/utils/clearRefinements.d.ts +4 -8
- package/es/lib/utils/clearRefinements.js +3 -8
- package/es/lib/utils/concatHighlightedParts.d.ts +1 -1
- package/es/lib/utils/concatHighlightedParts.js +1 -1
- package/es/lib/utils/createSendEventForFacet.js +1 -1
- package/es/lib/utils/createSendEventForHits.d.ts +0 -3
- package/es/lib/utils/createSendEventForHits.js +0 -3
- package/es/lib/utils/defer.d.ts +2 -2
- package/es/lib/utils/defer.js +2 -5
- package/es/lib/utils/detect-insights-client.d.ts +1 -1
- package/es/lib/utils/detect-insights-client.js +1 -1
- package/es/lib/utils/documentation.d.ts +2 -2
- package/es/lib/utils/documentation.js +4 -4
- package/es/lib/utils/escape-highlight.js +2 -2
- package/es/lib/utils/{escape.d.ts → escape-html.d.ts} +6 -2
- package/es/lib/utils/escape-html.js +51 -0
- package/es/lib/utils/escapeFacetValue.d.ts +1 -1
- package/es/lib/utils/find.d.ts +1 -2
- package/es/lib/utils/find.js +2 -4
- package/es/lib/utils/findIndex.d.ts +1 -2
- package/es/lib/utils/findIndex.js +2 -4
- package/es/lib/utils/getContainerNode.d.ts +1 -2
- package/es/lib/utils/getContainerNode.js +3 -5
- package/es/lib/utils/getHighlightFromSiblings.d.ts +1 -1
- package/es/lib/utils/getHighlightFromSiblings.js +2 -2
- package/es/lib/utils/getHighlightedParts.d.ts +1 -1
- package/es/lib/utils/getHighlightedParts.js +1 -1
- package/es/lib/utils/getObjectType.d.ts +1 -2
- package/es/lib/utils/getObjectType.js +2 -4
- package/es/lib/utils/getPropertyByPath.d.ts +1 -2
- package/es/lib/utils/getPropertyByPath.js +2 -4
- package/es/lib/utils/getRefinements.d.ts +1 -1
- package/es/lib/utils/getRefinements.js +2 -2
- package/es/lib/utils/index.d.ts +46 -46
- package/es/lib/utils/index.js +46 -46
- package/es/lib/utils/isDomElement.d.ts +1 -2
- package/es/lib/utils/isDomElement.js +2 -4
- package/es/lib/utils/isEqual.d.ts +1 -2
- package/es/lib/utils/isEqual.js +2 -4
- package/es/lib/utils/isFacetRefined.d.ts +1 -1
- package/es/lib/utils/isFacetRefined.js +1 -1
- package/es/lib/utils/isFiniteNumber.d.ts +1 -2
- package/es/lib/utils/isFiniteNumber.js +3 -4
- package/es/lib/utils/isIndexWidget.d.ts +3 -0
- package/es/lib/utils/isIndexWidget.js +3 -0
- package/es/lib/utils/isPlainObject.d.ts +1 -2
- package/es/lib/utils/isPlainObject.js +2 -4
- package/es/lib/utils/isSpecialClick.d.ts +1 -2
- package/es/lib/utils/isSpecialClick.js +2 -4
- package/es/lib/utils/logger.js +1 -1
- package/es/lib/utils/mergeSearchParameters.d.ts +1 -2
- package/es/lib/utils/mergeSearchParameters.js +4 -6
- package/es/lib/utils/noop.d.ts +1 -2
- package/es/lib/utils/noop.js +1 -3
- package/es/lib/utils/prepareTemplateProps.d.ts +2 -2
- package/es/lib/utils/prepareTemplateProps.js +3 -5
- package/es/lib/utils/range.d.ts +2 -2
- package/es/lib/utils/range.js +2 -4
- package/es/lib/utils/renderTemplate.d.ts +1 -2
- package/es/lib/utils/renderTemplate.js +2 -4
- package/es/lib/utils/resolveSearchParameters.d.ts +1 -2
- package/es/lib/utils/resolveSearchParameters.js +2 -4
- package/es/lib/utils/reverseHighlightedParts.d.ts +1 -1
- package/es/lib/utils/reverseHighlightedParts.js +2 -2
- package/es/lib/utils/setIndexHelperState.d.ts +3 -0
- package/es/lib/utils/setIndexHelperState.js +19 -0
- package/es/lib/utils/toArray.d.ts +3 -2
- package/es/lib/utils/toArray.js +2 -4
- package/es/lib/utils/uniq.d.ts +1 -2
- package/es/lib/utils/uniq.js +2 -4
- package/es/lib/version.d.ts +1 -1
- package/es/lib/version.js +1 -1
- package/es/middlewares/createInsightsMiddleware.js +23 -27
- package/es/middlewares/createMetadataMiddleware.js +1 -0
- package/es/middlewares/createRouterMiddleware.js +1 -0
- package/es/types/middleware.d.ts +1 -0
- package/es/widgets/index/index.d.ts +0 -1
- package/es/widgets/index/index.js +5 -6
- package/package.json +5 -5
- package/cjs/lib/utils/convertNumericRefinementsToFilters.js +0 -31
- package/cjs/lib/utils/escape.js +0 -35
- package/cjs/lib/utils/unescape.js +0 -32
- package/es/lib/utils/convertNumericRefinementsToFilters.d.ts +0 -2
- package/es/lib/utils/convertNumericRefinementsToFilters.js +0 -24
- package/es/lib/utils/escape.js +0 -27
- package/es/lib/utils/unescape.d.ts +0 -9
- package/es/lib/utils/unescape.js +0 -25
package/es/lib/utils/range.js
CHANGED
|
@@ -10,7 +10,7 @@ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToAr
|
|
|
10
10
|
|
|
11
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
12
|
|
|
13
|
-
function range(_ref) {
|
|
13
|
+
export function range(_ref) {
|
|
14
14
|
var _ref$start = _ref.start,
|
|
15
15
|
start = _ref$start === void 0 ? 0 : _ref$start,
|
|
16
16
|
end = _ref.end,
|
|
@@ -27,6 +27,4 @@ function range(_ref) {
|
|
|
27
27
|
return _toConsumableArray(Array(arrayLength)).map(function (_, current) {
|
|
28
28
|
return start + current * limitStep;
|
|
29
29
|
});
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
export default range;
|
|
30
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { HoganOptions } from 'hogan.js';
|
|
2
2
|
import type { Templates, HoganHelpers } from '../../types';
|
|
3
3
|
import type { BindEventForHits, SendEventForHits } from './createSendEventForHits';
|
|
4
|
-
declare function renderTemplate({ templates, templateKey, compileOptions, helpers, data, bindEvent, sendEvent, }: {
|
|
4
|
+
export declare function renderTemplate({ templates, templateKey, compileOptions, helpers, data, bindEvent, sendEvent, }: {
|
|
5
5
|
templates: Templates;
|
|
6
6
|
templateKey: string;
|
|
7
7
|
compileOptions?: HoganOptions;
|
|
@@ -10,4 +10,3 @@ declare function renderTemplate({ templates, templateKey, compileOptions, helper
|
|
|
10
10
|
bindEvent?: BindEventForHits;
|
|
11
11
|
sendEvent?: SendEventForHits;
|
|
12
12
|
}): string | import("preact").VNode<{}> | import("preact").VNode<{}>[];
|
|
13
|
-
export default renderTemplate;
|
|
@@ -33,7 +33,7 @@ function transformHelpersToHogan() {
|
|
|
33
33
|
}, {});
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
-
function renderTemplate(_ref) {
|
|
36
|
+
export function renderTemplate(_ref) {
|
|
37
37
|
var templates = _ref.templates,
|
|
38
38
|
templateKey = _ref.templateKey,
|
|
39
39
|
compileOptions = _ref.compileOptions,
|
|
@@ -67,6 +67,4 @@ function renderTemplate(_ref) {
|
|
|
67
67
|
})).replace(/[ \n\r\t\f\xA0]+/g, function (spaces) {
|
|
68
68
|
return spaces.replace(/(^|\xA0+)[^\xA0]+/g, '$1 ');
|
|
69
69
|
}).trim();
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
export default renderTemplate;
|
|
70
|
+
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
1
|
import type { SearchParameters } from 'algoliasearch-helper';
|
|
2
2
|
import type { IndexWidget } from '../../widgets/index/index';
|
|
3
|
-
declare
|
|
4
|
-
export default resolveSearchParameters;
|
|
3
|
+
export declare function resolveSearchParameters(current: IndexWidget): SearchParameters[];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
export function resolveSearchParameters(current) {
|
|
2
2
|
var parent = current.getParent();
|
|
3
3
|
var states = [current.getHelper().state];
|
|
4
4
|
|
|
@@ -8,6 +8,4 @@ var resolveSearchParameters = function resolveSearchParameters(current) {
|
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
return states;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export default resolveSearchParameters;
|
|
11
|
+
}
|
|
@@ -4,8 +4,8 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
4
4
|
|
|
5
5
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
6
6
|
|
|
7
|
-
import getHighlightFromSiblings from "./getHighlightFromSiblings.js";
|
|
8
|
-
export
|
|
7
|
+
import { getHighlightFromSiblings } from "./getHighlightFromSiblings.js";
|
|
8
|
+
export function reverseHighlightedParts(parts) {
|
|
9
9
|
if (!parts.some(function (part) {
|
|
10
10
|
return part.isHighlighted;
|
|
11
11
|
})) {
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { isIndexWidget } from "./isIndexWidget.js";
|
|
2
|
+
import { checkIndexUiState } from "./checkIndexUiState.js";
|
|
3
|
+
export function setIndexHelperState(finalUiState, indexWidget) {
|
|
4
|
+
var nextIndexUiState = finalUiState[indexWidget.getIndexId()] || {};
|
|
5
|
+
|
|
6
|
+
if (process.env.NODE_ENV === 'development') {
|
|
7
|
+
checkIndexUiState({
|
|
8
|
+
index: indexWidget,
|
|
9
|
+
indexUiState: nextIndexUiState
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
indexWidget.getHelper().setState(indexWidget.getWidgetSearchParameters(indexWidget.getHelper().state, {
|
|
14
|
+
uiState: nextIndexUiState
|
|
15
|
+
}));
|
|
16
|
+
indexWidget.getWidgets().filter(isIndexWidget).forEach(function (widget) {
|
|
17
|
+
return setIndexHelperState(finalUiState, widget);
|
|
18
|
+
});
|
|
19
|
+
}
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
declare
|
|
2
|
-
export
|
|
1
|
+
declare type ToArray<T> = T extends unknown[] ? T : T[];
|
|
2
|
+
export declare function toArray<T>(value: T): ToArray<T>;
|
|
3
|
+
export {};
|
package/es/lib/utils/toArray.js
CHANGED
package/es/lib/utils/uniq.d.ts
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
declare function uniq<TItem>(array: TItem[]): TItem[];
|
|
2
|
-
export default uniq;
|
|
1
|
+
export declare function uniq<TItem>(array: TItem[]): TItem[];
|
package/es/lib/utils/uniq.js
CHANGED
package/es/lib/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: "4.46.
|
|
1
|
+
declare const _default: "4.46.1";
|
|
2
2
|
export default _default;
|
package/es/lib/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export default '4.46.
|
|
1
|
+
export default '4.46.1';
|
|
@@ -18,7 +18,6 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
|
18
18
|
|
|
19
19
|
import { getInsightsAnonymousUserTokenInternal } from "../helpers/index.js";
|
|
20
20
|
import { warning, noop, getAppIdAndApiKey, find } from "../lib/utils/index.js";
|
|
21
|
-
import connectConfigure from "../connectors/configure/connectConfigure.js";
|
|
22
21
|
export var createInsightsMiddleware = function createInsightsMiddleware(props) {
|
|
23
22
|
var _ref = props || {},
|
|
24
23
|
_insightsClient = _ref.insightsClient,
|
|
@@ -86,31 +85,28 @@ export var createInsightsMiddleware = function createInsightsMiddleware(props) {
|
|
|
86
85
|
appId: appId,
|
|
87
86
|
apiKey: apiKey
|
|
88
87
|
}, insightsInitParams));
|
|
89
|
-
var
|
|
90
|
-
var
|
|
91
|
-
var configureUserToken;
|
|
88
|
+
var initialParameters;
|
|
89
|
+
var helper;
|
|
92
90
|
return {
|
|
93
91
|
onStateChange: function onStateChange() {},
|
|
94
|
-
subscribe: function subscribe() {
|
|
92
|
+
subscribe: function subscribe() {},
|
|
93
|
+
started: function started() {
|
|
95
94
|
insightsClient('addAlgoliaAgent', 'insights-middleware');
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
}
|
|
101
|
-
|
|
95
|
+
helper = instantSearchInstance.helper;
|
|
96
|
+
initialParameters = {
|
|
97
|
+
userToken: helper.state.userToken,
|
|
98
|
+
clickAnalytics: helper.state.clickAnalytics
|
|
99
|
+
};
|
|
100
|
+
helper.overrideStateWithoutTriggeringChangeEvent(_objectSpread(_objectSpread({}, helper.state), {}, {
|
|
101
|
+
clickAnalytics: true
|
|
102
|
+
}));
|
|
103
|
+
instantSearchInstance.scheduleSearch();
|
|
102
104
|
|
|
103
105
|
var setUserTokenToSearch = function setUserTokenToSearch(userToken) {
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
configureUserToken = createWidget({
|
|
109
|
-
searchParameters: {
|
|
110
|
-
userToken: userToken
|
|
111
|
-
}
|
|
112
|
-
});
|
|
113
|
-
instantSearchInstance.addWidgets([configureUserToken]);
|
|
106
|
+
helper.overrideStateWithoutTriggeringChangeEvent(_objectSpread(_objectSpread({}, helper.state), {}, {
|
|
107
|
+
userToken: userToken
|
|
108
|
+
}));
|
|
109
|
+
instantSearchInstance.scheduleSearch();
|
|
114
110
|
};
|
|
115
111
|
|
|
116
112
|
var anonymousUserToken = getInsightsAnonymousUserTokenInternal();
|
|
@@ -138,9 +134,7 @@ export var createInsightsMiddleware = function createInsightsMiddleware(props) {
|
|
|
138
134
|
if (onEvent) {
|
|
139
135
|
onEvent(event, _insightsClient);
|
|
140
136
|
} else if (event.insightsMethod) {
|
|
141
|
-
|
|
142
|
-
// it means there is a configure widget (added above).
|
|
143
|
-
var hasUserToken = Boolean(instantSearchInstance.renderState[instantSearchInstance.indexName].configure.widgetParams.searchParameters.userToken);
|
|
137
|
+
var hasUserToken = Boolean(helper.state.userToken);
|
|
144
138
|
|
|
145
139
|
if (hasUserToken) {
|
|
146
140
|
insightsClient(event.insightsMethod, event.payload);
|
|
@@ -154,10 +148,12 @@ export var createInsightsMiddleware = function createInsightsMiddleware(props) {
|
|
|
154
148
|
},
|
|
155
149
|
unsubscribe: function unsubscribe() {
|
|
156
150
|
insightsClient('onUserTokenChange', undefined);
|
|
157
|
-
instantSearchInstance.removeWidgets([configureClickAnalytics, configureUserToken]);
|
|
158
|
-
configureClickAnalytics = undefined;
|
|
159
|
-
configureUserToken = undefined;
|
|
160
151
|
instantSearchInstance.sendEventToInsights = noop;
|
|
152
|
+
|
|
153
|
+
if (helper && initialParameters) {
|
|
154
|
+
helper.setState(_objectSpread(_objectSpread({}, helper.state), initialParameters));
|
|
155
|
+
instantSearchInstance.scheduleSearch();
|
|
156
|
+
}
|
|
161
157
|
}
|
|
162
158
|
};
|
|
163
159
|
};
|
package/es/types/middleware.d.ts
CHANGED
|
@@ -42,6 +42,5 @@ export declare type IndexWidget = Omit<Widget<IndexWidgetDescription & {
|
|
|
42
42
|
}): SearchParameters;
|
|
43
43
|
refreshUiState(): void;
|
|
44
44
|
};
|
|
45
|
-
export declare function isIndexWidget(widget: Widget | IndexWidget): widget is IndexWidget;
|
|
46
45
|
declare const index: (widgetParams: IndexWidgetParams) => IndexWidget;
|
|
47
46
|
export default index;
|
|
@@ -21,19 +21,16 @@ function _objectWithoutProperties(source, excluded) { if (source == null) return
|
|
|
21
21
|
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; }
|
|
22
22
|
|
|
23
23
|
import algoliasearchHelper from 'algoliasearch-helper';
|
|
24
|
-
import { checkIndexUiState, createDocumentationMessageGenerator, resolveSearchParameters, mergeSearchParameters, warning } from "../../lib/utils/index.js";
|
|
24
|
+
import { checkIndexUiState, createDocumentationMessageGenerator, resolveSearchParameters, mergeSearchParameters, warning, isIndexWidget } from "../../lib/utils/index.js";
|
|
25
25
|
var withUsage = createDocumentationMessageGenerator({
|
|
26
26
|
name: 'index-widget'
|
|
27
27
|
});
|
|
28
|
-
|
|
29
|
-
return widget.$$type === 'ais.index';
|
|
30
|
-
}
|
|
28
|
+
|
|
31
29
|
/**
|
|
32
30
|
* This is the same content as helper._change / setState, but allowing for extra
|
|
33
31
|
* UiState to be synchronized.
|
|
34
32
|
* see: https://github.com/algolia/algoliasearch-helper-js/blob/6b835ffd07742f2d6b314022cce6848f5cfecd4a/src/algoliasearch.helper.js#L1311-L1324
|
|
35
33
|
*/
|
|
36
|
-
|
|
37
34
|
function privateHelperSetState(helper, _ref) {
|
|
38
35
|
var state = _ref.state,
|
|
39
36
|
isPageReset = _ref.isPageReset,
|
|
@@ -312,7 +309,9 @@ var index = function index(widgetParams) {
|
|
|
312
309
|
if (instantSearchInstance.onStateChange) {
|
|
313
310
|
instantSearchInstance.onStateChange({
|
|
314
311
|
uiState: instantSearchInstance.mainIndex.getWidgetUiState({}),
|
|
315
|
-
setUiState:
|
|
312
|
+
setUiState: function setUiState(nextState) {
|
|
313
|
+
return instantSearchInstance.setUiState(nextState, false);
|
|
314
|
+
}
|
|
316
315
|
}); // We don't trigger a search when controlled because it becomes the
|
|
317
316
|
// responsibility of `setUiState`.
|
|
318
317
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "instantsearch.js",
|
|
3
|
-
"version": "4.46.
|
|
3
|
+
"version": "4.46.1",
|
|
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",
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
"@types/google.maps": "^3.45.3",
|
|
60
60
|
"@types/hogan.js": "^3.0.0",
|
|
61
61
|
"@types/qs": "^6.5.3",
|
|
62
|
-
"algoliasearch-helper": "^3.
|
|
62
|
+
"algoliasearch-helper": "^3.11.1",
|
|
63
63
|
"classnames": "^2.2.5",
|
|
64
64
|
"hogan.js": "^3.0.2",
|
|
65
65
|
"htm": "^3.0.0",
|
|
@@ -117,6 +117,7 @@
|
|
|
117
117
|
"eslint": "6.8.0",
|
|
118
118
|
"eslint-config-algolia": "16.0.0",
|
|
119
119
|
"eslint-config-prettier": "6.9.0",
|
|
120
|
+
"eslint-plugin-deprecation": "1.3.2",
|
|
120
121
|
"eslint-plugin-eslint-comments": "3.2.0",
|
|
121
122
|
"eslint-plugin-import": "2.18.2",
|
|
122
123
|
"eslint-plugin-jasmine": "4.1.0",
|
|
@@ -124,7 +125,6 @@
|
|
|
124
125
|
"eslint-plugin-prettier": "3.4.0",
|
|
125
126
|
"eslint-plugin-react": "7.18.0",
|
|
126
127
|
"eslint-plugin-react-hooks": "2.3.0",
|
|
127
|
-
"eslint-plugin-deprecation": "1.3.2",
|
|
128
128
|
"instantsearch-e2e-tests": "algolia/instantsearch-e2e-tests#2.0.2",
|
|
129
129
|
"jest": "27.1.0",
|
|
130
130
|
"jest-diff": "27.1.0",
|
|
@@ -159,11 +159,11 @@
|
|
|
159
159
|
"bundlesize": [
|
|
160
160
|
{
|
|
161
161
|
"path": "./dist/instantsearch.production.min.js",
|
|
162
|
-
"maxSize": "72.
|
|
162
|
+
"maxSize": "72.50 kB"
|
|
163
163
|
},
|
|
164
164
|
{
|
|
165
165
|
"path": "./dist/instantsearch.development.js",
|
|
166
|
-
"maxSize": "155.
|
|
166
|
+
"maxSize": "155.50 kB"
|
|
167
167
|
}
|
|
168
168
|
]
|
|
169
169
|
}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.convertNumericRefinementsToFilters = convertNumericRefinementsToFilters;
|
|
7
|
-
|
|
8
|
-
function convertNumericRefinementsToFilters(state, attribute) {
|
|
9
|
-
if (!state) {
|
|
10
|
-
return null;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
var filtersObj = state.numericRefinements[attribute];
|
|
14
|
-
/*
|
|
15
|
-
filtersObj === {
|
|
16
|
-
"<=": [10],
|
|
17
|
-
"=": [],
|
|
18
|
-
">=": [5]
|
|
19
|
-
}
|
|
20
|
-
*/
|
|
21
|
-
|
|
22
|
-
var filters = [];
|
|
23
|
-
Object.keys(filtersObj).filter(function (operator) {
|
|
24
|
-
return Array.isArray(filtersObj[operator]) && filtersObj[operator].length > 0;
|
|
25
|
-
}).forEach(function (operator) {
|
|
26
|
-
filtersObj[operator].forEach(function (value) {
|
|
27
|
-
filters.push("".concat(attribute).concat(operator).concat(value));
|
|
28
|
-
});
|
|
29
|
-
});
|
|
30
|
-
return filters;
|
|
31
|
-
}
|
package/cjs/lib/utils/escape.js
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* This implementation is taken from Lodash implementation.
|
|
10
|
-
* See: https://github.com/lodash/lodash/blob/4.17.11-npm/escape.js
|
|
11
|
-
*/
|
|
12
|
-
// Used to map characters to HTML entities.
|
|
13
|
-
var htmlEscapes = {
|
|
14
|
-
'&': '&',
|
|
15
|
-
'<': '<',
|
|
16
|
-
'>': '>',
|
|
17
|
-
'"': '"',
|
|
18
|
-
"'": '''
|
|
19
|
-
}; // Used to match HTML entities and HTML characters.
|
|
20
|
-
|
|
21
|
-
var regexUnescapedHtml = /[&<>"']/g;
|
|
22
|
-
var regexHasUnescapedHtml = RegExp(regexUnescapedHtml.source);
|
|
23
|
-
/**
|
|
24
|
-
* Converts the characters "&", "<", ">", '"', and "'" in `string` to their
|
|
25
|
-
* corresponding HTML entities.
|
|
26
|
-
*/
|
|
27
|
-
|
|
28
|
-
function escape(value) {
|
|
29
|
-
return value && regexHasUnescapedHtml.test(value) ? value.replace(regexUnescapedHtml, function (character) {
|
|
30
|
-
return htmlEscapes[character];
|
|
31
|
-
}) : value;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
var _default = escape;
|
|
35
|
-
exports.default = _default;
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = unescape;
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* This implementation is taken from Lodash implementation.
|
|
10
|
-
* See: https://github.com/lodash/lodash/blob/4.17.11-npm/unescape.js
|
|
11
|
-
*/
|
|
12
|
-
// Used to map HTML entities to characters.
|
|
13
|
-
var htmlEscapes = {
|
|
14
|
-
'&': '&',
|
|
15
|
-
'<': '<',
|
|
16
|
-
'>': '>',
|
|
17
|
-
'"': '"',
|
|
18
|
-
''': "'"
|
|
19
|
-
}; // Used to match HTML entities and HTML characters.
|
|
20
|
-
|
|
21
|
-
var regexEscapedHtml = /&(amp|quot|lt|gt|#39);/g;
|
|
22
|
-
var regexHasEscapedHtml = RegExp(regexEscapedHtml.source);
|
|
23
|
-
/**
|
|
24
|
-
* Converts the HTML entities "&", "<", ">", '"', and "'" in `string` to their
|
|
25
|
-
* characters.
|
|
26
|
-
*/
|
|
27
|
-
|
|
28
|
-
function unescape(value) {
|
|
29
|
-
return value && regexHasEscapedHtml.test(value) ? value.replace(regexEscapedHtml, function (character) {
|
|
30
|
-
return htmlEscapes[character];
|
|
31
|
-
}) : value;
|
|
32
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
export function convertNumericRefinementsToFilters(state, attribute) {
|
|
2
|
-
if (!state) {
|
|
3
|
-
return null;
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
var filtersObj = state.numericRefinements[attribute];
|
|
7
|
-
/*
|
|
8
|
-
filtersObj === {
|
|
9
|
-
"<=": [10],
|
|
10
|
-
"=": [],
|
|
11
|
-
">=": [5]
|
|
12
|
-
}
|
|
13
|
-
*/
|
|
14
|
-
|
|
15
|
-
var filters = [];
|
|
16
|
-
Object.keys(filtersObj).filter(function (operator) {
|
|
17
|
-
return Array.isArray(filtersObj[operator]) && filtersObj[operator].length > 0;
|
|
18
|
-
}).forEach(function (operator) {
|
|
19
|
-
filtersObj[operator].forEach(function (value) {
|
|
20
|
-
filters.push("".concat(attribute).concat(operator).concat(value));
|
|
21
|
-
});
|
|
22
|
-
});
|
|
23
|
-
return filters;
|
|
24
|
-
}
|
package/es/lib/utils/escape.js
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This implementation is taken from Lodash implementation.
|
|
3
|
-
* See: https://github.com/lodash/lodash/blob/4.17.11-npm/escape.js
|
|
4
|
-
*/
|
|
5
|
-
// Used to map characters to HTML entities.
|
|
6
|
-
var htmlEscapes = {
|
|
7
|
-
'&': '&',
|
|
8
|
-
'<': '<',
|
|
9
|
-
'>': '>',
|
|
10
|
-
'"': '"',
|
|
11
|
-
"'": '''
|
|
12
|
-
}; // Used to match HTML entities and HTML characters.
|
|
13
|
-
|
|
14
|
-
var regexUnescapedHtml = /[&<>"']/g;
|
|
15
|
-
var regexHasUnescapedHtml = RegExp(regexUnescapedHtml.source);
|
|
16
|
-
/**
|
|
17
|
-
* Converts the characters "&", "<", ">", '"', and "'" in `string` to their
|
|
18
|
-
* corresponding HTML entities.
|
|
19
|
-
*/
|
|
20
|
-
|
|
21
|
-
function escape(value) {
|
|
22
|
-
return value && regexHasUnescapedHtml.test(value) ? value.replace(regexUnescapedHtml, function (character) {
|
|
23
|
-
return htmlEscapes[character];
|
|
24
|
-
}) : value;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export default escape;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This implementation is taken from Lodash implementation.
|
|
3
|
-
* See: https://github.com/lodash/lodash/blob/4.17.11-npm/unescape.js
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* Converts the HTML entities "&", "<", ">", '"', and "'" in `string` to their
|
|
7
|
-
* characters.
|
|
8
|
-
*/
|
|
9
|
-
export default function unescape(value: string): string;
|
package/es/lib/utils/unescape.js
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This implementation is taken from Lodash implementation.
|
|
3
|
-
* See: https://github.com/lodash/lodash/blob/4.17.11-npm/unescape.js
|
|
4
|
-
*/
|
|
5
|
-
// Used to map HTML entities to characters.
|
|
6
|
-
var htmlEscapes = {
|
|
7
|
-
'&': '&',
|
|
8
|
-
'<': '<',
|
|
9
|
-
'>': '>',
|
|
10
|
-
'"': '"',
|
|
11
|
-
''': "'"
|
|
12
|
-
}; // Used to match HTML entities and HTML characters.
|
|
13
|
-
|
|
14
|
-
var regexEscapedHtml = /&(amp|quot|lt|gt|#39);/g;
|
|
15
|
-
var regexHasEscapedHtml = RegExp(regexEscapedHtml.source);
|
|
16
|
-
/**
|
|
17
|
-
* Converts the HTML entities "&", "<", ">", '"', and "'" in `string` to their
|
|
18
|
-
* characters.
|
|
19
|
-
*/
|
|
20
|
-
|
|
21
|
-
export default function unescape(value) {
|
|
22
|
-
return value && regexHasEscapedHtml.test(value) ? value.replace(regexEscapedHtml, function (character) {
|
|
23
|
-
return htmlEscapes[character];
|
|
24
|
-
}) : value;
|
|
25
|
-
}
|