instantsearch.js 4.41.0 → 4.41.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 +11 -0
- package/cjs/lib/InstantSearch.js +3 -4
- package/cjs/lib/utils/createSendEventForHits.js +10 -3
- package/cjs/lib/version.js +1 -1
- package/dist/instantsearch.development.d.ts +11 -9
- package/dist/instantsearch.development.js +15 -9
- package/dist/instantsearch.development.js.map +1 -1
- package/dist/instantsearch.production.d.ts +11 -9
- package/dist/instantsearch.production.min.d.ts +11 -9
- package/dist/instantsearch.production.min.js +2 -2
- package/dist/instantsearch.production.min.js.map +1 -1
- package/es/lib/InstantSearch.d.ts +10 -9
- package/es/lib/InstantSearch.js +3 -4
- package/es/lib/utils/createSendEventForHits.js +10 -3
- package/es/lib/version.d.ts +1 -1
- package/es/lib/version.js +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,14 @@
|
|
|
1
|
+
## [4.41.1](https://github.com/algolia/instantsearch.js/compare/v4.41.0...v4.41.1) (2022-06-14)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* **insights:** don't send view event if search is stalled ([#5058](https://github.com/algolia/instantsearch.js/issues/5058)) ([1686dfb](https://github.com/algolia/instantsearch.js/commit/1686dfb096cfce062e268feda7956e3b160bf2da)), closes [/github.com/algolia/instantsearch.js/blob/99f6fe1dc51e4815e5b9efcfb30e3e2f3127e763/src/lib/utils/createSendEventForHits.ts#L168](https://github.com//github.com/algolia/instantsearch.js/blob/99f6fe1dc51e4815e5b9efcfb30e3e2f3127e763/src/lib/utils/createSendEventForHits.ts/issues/L168) [/github.com/algolia/instantsearch.js/blob/55313e4ea4105b777f3f102e9f48a7e440496d25/src/middlewares/createInsightsMiddleware.ts#L144](https://github.com//github.com/algolia/instantsearch.js/blob/55313e4ea4105b777f3f102e9f48a7e440496d25/src/middlewares/createInsightsMiddleware.ts/issues/L144)
|
|
7
|
+
* **types:** avoid inferring UiState type from initialUiState ([#5061](https://github.com/algolia/instantsearch.js/issues/5061)) ([80ca07e](https://github.com/algolia/instantsearch.js/commit/80ca07e29064357343ee997be94ef10beadba637)), closes [/github.com/Microsoft/TypeScript/issues/14829#issuecomment-504042546](https://github.com//github.com/Microsoft/TypeScript/issues/14829/issues/issuecomment-504042546) [#5060](https://github.com/algolia/instantsearch.js/issues/5060)
|
|
8
|
+
* **types:** make all usages of UiState in InstantSearch generic ([#5060](https://github.com/algolia/instantsearch.js/issues/5060)) ([2b9e76b](https://github.com/algolia/instantsearch.js/commit/2b9e76b568fb4d4cc5bd49c384ee583d84d6f39a))
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
1
12
|
# [4.41.0](https://github.com/algolia/instantsearch.js/compare/v4.40.6...v4.41.0) (2022-06-01)
|
|
2
13
|
|
|
3
14
|
|
package/cjs/lib/InstantSearch.js
CHANGED
|
@@ -61,10 +61,9 @@ var withUsage = (0, _index2.createDocumentationMessageGenerator)({
|
|
|
61
61
|
|
|
62
62
|
function defaultCreateURL() {
|
|
63
63
|
return '#';
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
*/
|
|
64
|
+
} // this purposely breaks typescript's type inference to ensure it's not used
|
|
65
|
+
// as it's used for a default parameter for example
|
|
66
|
+
// source: https://github.com/Microsoft/TypeScript/issues/14829#issuecomment-504042546
|
|
68
67
|
|
|
69
68
|
|
|
70
69
|
/**
|
|
@@ -25,7 +25,8 @@ var buildPayloads = function buildPayloads(_ref) {
|
|
|
25
25
|
var index = _ref.index,
|
|
26
26
|
widgetType = _ref.widgetType,
|
|
27
27
|
methodName = _ref.methodName,
|
|
28
|
-
args = _ref.args
|
|
28
|
+
args = _ref.args,
|
|
29
|
+
isSearchStalled = _ref.isSearchStalled;
|
|
29
30
|
|
|
30
31
|
// when there's only one argument, that means it's custom
|
|
31
32
|
if (args.length === 1 && _typeof(args[0]) === 'object') {
|
|
@@ -72,6 +73,10 @@ var buildPayloads = function buildPayloads(_ref) {
|
|
|
72
73
|
});
|
|
73
74
|
|
|
74
75
|
if (eventType === 'view') {
|
|
76
|
+
if (isSearchStalled) {
|
|
77
|
+
return [];
|
|
78
|
+
}
|
|
79
|
+
|
|
75
80
|
return hitsChunks.map(function (batch, i) {
|
|
76
81
|
return {
|
|
77
82
|
insightsMethod: 'viewedObjectIDs',
|
|
@@ -142,7 +147,8 @@ function createSendEventForHits(_ref2) {
|
|
|
142
147
|
widgetType: widgetType,
|
|
143
148
|
index: index,
|
|
144
149
|
methodName: 'sendEvent',
|
|
145
|
-
args: args
|
|
150
|
+
args: args,
|
|
151
|
+
isSearchStalled: instantSearchInstance._isSearchStalled
|
|
146
152
|
});
|
|
147
153
|
payloads.forEach(function (payload) {
|
|
148
154
|
return instantSearchInstance.sendEventToInsights(payload);
|
|
@@ -165,7 +171,8 @@ function createBindEventForHits(_ref3) {
|
|
|
165
171
|
widgetType: widgetType,
|
|
166
172
|
index: index,
|
|
167
173
|
methodName: 'bindEvent',
|
|
168
|
-
args: args
|
|
174
|
+
args: args,
|
|
175
|
+
isSearchStalled: false
|
|
169
176
|
});
|
|
170
177
|
return payloads.length ? "data-insights-event=".concat((0, _serializer.serializePayload)(payloads)) : '';
|
|
171
178
|
};
|
package/cjs/lib/version.js
CHANGED
|
@@ -2286,7 +2286,7 @@ declare class InstantSearch<TUiState extends UiState = UiState, TRouteState = TU
|
|
|
2286
2286
|
client: InstantSearchOptions['searchClient'];
|
|
2287
2287
|
indexName: string;
|
|
2288
2288
|
insightsClient: InsightsClient | null;
|
|
2289
|
-
onStateChange: InstantSearchOptions['onStateChange'] | null;
|
|
2289
|
+
onStateChange: InstantSearchOptions<TUiState>['onStateChange'] | null;
|
|
2290
2290
|
helper: AlgoliaSearchHelper | null;
|
|
2291
2291
|
mainHelper: AlgoliaSearchHelper | null;
|
|
2292
2292
|
mainIndex: IndexWidget;
|
|
@@ -2296,9 +2296,9 @@ declare class InstantSearch<TUiState extends UiState = UiState, TRouteState = TU
|
|
|
2296
2296
|
_stalledSearchDelay: number;
|
|
2297
2297
|
_searchStalledTimer: any;
|
|
2298
2298
|
_isSearchStalled: boolean;
|
|
2299
|
-
_initialUiState:
|
|
2299
|
+
_initialUiState: TUiState;
|
|
2300
2300
|
_initialResults: InitialResults | null;
|
|
2301
|
-
_createURL: CreateURL<
|
|
2301
|
+
_createURL: CreateURL<TUiState>;
|
|
2302
2302
|
_searchFunction?: InstantSearchOptions['searchFunction'];
|
|
2303
2303
|
_mainHelperSearch?: AlgoliaSearchHelper['search'];
|
|
2304
2304
|
middleware: Array<{
|
|
@@ -2368,13 +2368,13 @@ declare class InstantSearch<TUiState extends UiState = UiState, TRouteState = TU
|
|
|
2368
2368
|
cancel(): void;
|
|
2369
2369
|
};
|
|
2370
2370
|
scheduleStalledRender(): void;
|
|
2371
|
-
setUiState(uiState:
|
|
2372
|
-
getUiState():
|
|
2371
|
+
setUiState(uiState: TUiState | ((previousUiState: TUiState) => TUiState)): void;
|
|
2372
|
+
getUiState(): TUiState;
|
|
2373
2373
|
onInternalStateChange: ((...args: any[]) => void) & {
|
|
2374
2374
|
wait(): Promise<void>;
|
|
2375
2375
|
cancel(): void;
|
|
2376
2376
|
};
|
|
2377
|
-
createURL(nextState?:
|
|
2377
|
+
createURL(nextState?: TUiState): string;
|
|
2378
2378
|
refresh(): void;
|
|
2379
2379
|
}
|
|
2380
2380
|
|
|
@@ -2466,8 +2466,8 @@ declare type InstantSearchOptions<TUiState extends UiState = UiState, TRouteStat
|
|
|
2466
2466
|
* become in charge of updating the UI state with the `setUiState` function.
|
|
2467
2467
|
*/
|
|
2468
2468
|
onStateChange?: (params: {
|
|
2469
|
-
uiState:
|
|
2470
|
-
setUiState(uiState:
|
|
2469
|
+
uiState: TUiState;
|
|
2470
|
+
setUiState(uiState: TUiState | ((previousUiState: TUiState) => TUiState)): void;
|
|
2471
2471
|
}) => void;
|
|
2472
2472
|
/**
|
|
2473
2473
|
* Injects a `uiState` to the `instantsearch` instance. You can use this option
|
|
@@ -2475,7 +2475,7 @@ declare type InstantSearchOptions<TUiState extends UiState = UiState, TRouteStat
|
|
|
2475
2475
|
* for the first search. To unconditionally pass additional parameters to the
|
|
2476
2476
|
* Algolia API, take a look at the `configure` widget.
|
|
2477
2477
|
*/
|
|
2478
|
-
initialUiState?: TUiState
|
|
2478
|
+
initialUiState?: NoInfer<TUiState>;
|
|
2479
2479
|
/**
|
|
2480
2480
|
* Time before a search is considered stalled. The default is 200ms
|
|
2481
2481
|
*/
|
|
@@ -2779,6 +2779,8 @@ declare namespace middlewares {
|
|
|
2779
2779
|
}
|
|
2780
2780
|
}
|
|
2781
2781
|
|
|
2782
|
+
declare type NoInfer<T> = [T][T extends any ? 0 : never];
|
|
2783
|
+
|
|
2782
2784
|
declare const numericMenu: NumericMenuWidget;
|
|
2783
2785
|
|
|
2784
2786
|
declare type NumericMenuComponentCSSClasses = ComponentCSSClasses<NumericMenuCSSClasses>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! InstantSearch.js 4.41.
|
|
1
|
+
/*! InstantSearch.js 4.41.1 | © Algolia, Inc. and contributors; MIT License | https://github.com/algolia/instantsearch.js */
|
|
2
2
|
(function (global, factory) {
|
|
3
3
|
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
|
|
4
4
|
typeof define === 'function' && define.amd ? define(factory) :
|
|
@@ -7692,7 +7692,8 @@
|
|
|
7692
7692
|
var index = _ref.index,
|
|
7693
7693
|
widgetType = _ref.widgetType,
|
|
7694
7694
|
methodName = _ref.methodName,
|
|
7695
|
-
args = _ref.args
|
|
7695
|
+
args = _ref.args,
|
|
7696
|
+
isSearchStalled = _ref.isSearchStalled;
|
|
7696
7697
|
|
|
7697
7698
|
// when there's only one argument, that means it's custom
|
|
7698
7699
|
if (args.length === 1 && _typeof(args[0]) === 'object') {
|
|
@@ -7735,6 +7736,10 @@
|
|
|
7735
7736
|
});
|
|
7736
7737
|
|
|
7737
7738
|
if (eventType === 'view') {
|
|
7739
|
+
if (isSearchStalled) {
|
|
7740
|
+
return [];
|
|
7741
|
+
}
|
|
7742
|
+
|
|
7738
7743
|
return hitsChunks.map(function (batch, i) {
|
|
7739
7744
|
return {
|
|
7740
7745
|
insightsMethod: 'viewedObjectIDs',
|
|
@@ -7803,7 +7808,8 @@
|
|
|
7803
7808
|
widgetType: widgetType,
|
|
7804
7809
|
index: index,
|
|
7805
7810
|
methodName: 'sendEvent',
|
|
7806
|
-
args: args
|
|
7811
|
+
args: args,
|
|
7812
|
+
isSearchStalled: instantSearchInstance._isSearchStalled
|
|
7807
7813
|
});
|
|
7808
7814
|
payloads.forEach(function (payload) {
|
|
7809
7815
|
return instantSearchInstance.sendEventToInsights(payload);
|
|
@@ -7825,7 +7831,8 @@
|
|
|
7825
7831
|
widgetType: widgetType,
|
|
7826
7832
|
index: index,
|
|
7827
7833
|
methodName: 'bindEvent',
|
|
7828
|
-
args: args
|
|
7834
|
+
args: args,
|
|
7835
|
+
isSearchStalled: false
|
|
7829
7836
|
});
|
|
7830
7837
|
return payloads.length ? "data-insights-event=".concat(serializePayload(payloads)) : '';
|
|
7831
7838
|
};
|
|
@@ -8536,7 +8543,7 @@
|
|
|
8536
8543
|
instantSearchInstance.renderState = _objectSpread2(_objectSpread2({}, instantSearchInstance.renderState), {}, _defineProperty({}, parentIndexName, _objectSpread2(_objectSpread2({}, instantSearchInstance.renderState[parentIndexName]), renderState)));
|
|
8537
8544
|
}
|
|
8538
8545
|
|
|
8539
|
-
var version$1 = '4.41.
|
|
8546
|
+
var version$1 = '4.41.1';
|
|
8540
8547
|
|
|
8541
8548
|
var NAMESPACE = 'ais';
|
|
8542
8549
|
var component = function component(componentName) {
|
|
@@ -10026,10 +10033,9 @@
|
|
|
10026
10033
|
|
|
10027
10034
|
function defaultCreateURL() {
|
|
10028
10035
|
return '#';
|
|
10029
|
-
}
|
|
10030
|
-
|
|
10031
|
-
|
|
10032
|
-
*/
|
|
10036
|
+
} // this purposely breaks typescript's type inference to ensure it's not used
|
|
10037
|
+
// as it's used for a default parameter for example
|
|
10038
|
+
// source: https://github.com/Microsoft/TypeScript/issues/14829#issuecomment-504042546
|
|
10033
10039
|
|
|
10034
10040
|
|
|
10035
10041
|
/**
|