@elastic/search-ui
Advanced tools
Comparing version 1.19.1 to 1.20.0
@@ -47,7 +47,12 @@ "use strict"; | ||
expect(helpers_1.mockPlugin.subscribe).toBeCalledWith({ | ||
currentPage: 1, | ||
documentId: "park_great-smoky-mountains", | ||
filters: [], | ||
origin: "autocomplete", | ||
position: 0, | ||
query: "search terms", | ||
resultsPerPage: 20, | ||
sort: undefined, | ||
tags: ["test"], | ||
totalResults: 0, | ||
type: "ResultSelected" | ||
@@ -54,0 +59,0 @@ }); |
@@ -40,10 +40,15 @@ "use strict"; | ||
expect(helpers_1.mockPlugin.subscribe).toBeCalledWith({ | ||
currentPage: 1, | ||
documentId: "park_great-smoky-mountains", | ||
filters: [], | ||
origin: "results", | ||
position: 0, | ||
query: "search terms", | ||
resultsPerPage: 20, | ||
sort: undefined, | ||
tags: ["test"], | ||
type: "ResultSelected" | ||
type: "ResultSelected", | ||
totalResults: 1000 | ||
}); | ||
}); | ||
}); |
@@ -136,3 +136,5 @@ "use strict"; | ||
query: "test", | ||
tags: [] | ||
tags: [], | ||
filters: [], | ||
totalResults: 0 | ||
}; | ||
@@ -139,0 +141,0 @@ events.emit(event); |
@@ -425,4 +425,8 @@ "use strict"; | ||
expect(helpers_1.mockPlugin.subscribe).toBeCalledWith({ | ||
currentPage: 1, | ||
query: "test", | ||
resultsPerPage: 20, | ||
sort: undefined, | ||
totalResults: 1000, | ||
filters: [], | ||
type: "SearchQuery" | ||
@@ -429,0 +433,0 @@ }); |
@@ -17,3 +17,3 @@ "use strict"; | ||
} | ||
const { autocompletedResultsRequestId, searchTerm, autocompletedResults } = this.state; | ||
const { autocompletedResultsRequestId, searchTerm, autocompletedResults, current, resultsPerPage, totalResults, filters, sort } = this.state; | ||
const resultIndex = autocompletedResults.findIndex((result) => result._meta.id === documentId); | ||
@@ -36,5 +36,10 @@ const result = autocompletedResults[resultIndex]; | ||
origin: "autocomplete", | ||
tags | ||
tags, | ||
totalResults, | ||
filters, | ||
sort, | ||
currentPage: current, | ||
resultsPerPage: resultsPerPage | ||
}); | ||
} | ||
exports.default = trackAutocompleteClickThrough; |
@@ -16,3 +16,3 @@ "use strict"; | ||
console.log("Search UI: Action", "trackClickThrough", ...arguments); | ||
const { requestId, searchTerm, results, current, resultsPerPage } = this.state; | ||
const { requestId, searchTerm, results, current, resultsPerPage, totalResults, filters, sort } = this.state; | ||
const resultIndexOnPage = results.findIndex((result) => result._meta.id === documentId); | ||
@@ -35,7 +35,12 @@ const result = results[resultIndexOnPage]; | ||
query: searchTerm, | ||
origin: "results", | ||
position: resultIndexOnPage, | ||
origin: "results", | ||
tags | ||
tags, | ||
totalResults, | ||
filters, | ||
sort, | ||
currentPage: current, | ||
resultsPerPage: resultsPerPage | ||
}); | ||
} | ||
exports.default = trackClickThrough; |
@@ -211,3 +211,7 @@ "use strict"; | ||
type: "SearchQuery", | ||
filters: this.state.filters, | ||
query: this.state.searchTerm, | ||
sort: requestState.sort, | ||
currentPage: requestState.current, | ||
resultsPerPage: requestState.resultsPerPage, | ||
totalResults: totalResults | ||
@@ -214,0 +218,0 @@ }); |
@@ -168,6 +168,10 @@ import { SearchDriverActions } from ".."; | ||
} | ||
interface SearchQueryEvent extends BaseEvent { | ||
export interface SearchQueryEvent extends BaseEvent { | ||
type: "SearchQuery"; | ||
filters: Filter[]; | ||
query: string; | ||
totalResults: number; | ||
sort?: SortOption[]; | ||
currentPage?: number; | ||
resultsPerPage?: number; | ||
} | ||
@@ -180,5 +184,4 @@ interface AutocompleteSuggestionSelectedEvent extends BaseEvent { | ||
} | ||
interface ResultSelectedEvent extends BaseEvent { | ||
export interface ResultSelectedEvent extends Omit<SearchQueryEvent, "type"> { | ||
type: "ResultSelected"; | ||
query: string; | ||
documentId: string; | ||
@@ -185,0 +188,0 @@ position: number; |
@@ -45,7 +45,12 @@ import { getAutocompleteClickCalls, setupDriver, mockPlugin } from "../../test/helpers"; | ||
expect(mockPlugin.subscribe).toBeCalledWith({ | ||
currentPage: 1, | ||
documentId: "park_great-smoky-mountains", | ||
filters: [], | ||
origin: "autocomplete", | ||
position: 0, | ||
query: "search terms", | ||
resultsPerPage: 20, | ||
sort: undefined, | ||
tags: ["test"], | ||
totalResults: 0, | ||
type: "ResultSelected" | ||
@@ -52,0 +57,0 @@ }); |
@@ -38,10 +38,15 @@ import { getClickCalls, setupDriver, mockPlugin } from "../../test/helpers"; | ||
expect(mockPlugin.subscribe).toBeCalledWith({ | ||
currentPage: 1, | ||
documentId: "park_great-smoky-mountains", | ||
filters: [], | ||
origin: "results", | ||
position: 0, | ||
query: "search terms", | ||
resultsPerPage: 20, | ||
sort: undefined, | ||
tags: ["test"], | ||
type: "ResultSelected" | ||
type: "ResultSelected", | ||
totalResults: 1000 | ||
}); | ||
}); | ||
}); |
@@ -131,3 +131,5 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
query: "test", | ||
tags: [] | ||
tags: [], | ||
filters: [], | ||
totalResults: 0 | ||
}; | ||
@@ -134,0 +136,0 @@ events.emit(event); |
@@ -401,4 +401,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
expect(mockPlugin.subscribe).toBeCalledWith({ | ||
currentPage: 1, | ||
query: "test", | ||
resultsPerPage: 20, | ||
sort: undefined, | ||
totalResults: 1000, | ||
filters: [], | ||
type: "SearchQuery" | ||
@@ -405,0 +409,0 @@ }); |
@@ -15,3 +15,3 @@ /** | ||
} | ||
const { autocompletedResultsRequestId, searchTerm, autocompletedResults } = this.state; | ||
const { autocompletedResultsRequestId, searchTerm, autocompletedResults, current, resultsPerPage, totalResults, filters, sort } = this.state; | ||
const resultIndex = autocompletedResults.findIndex((result) => result._meta.id === documentId); | ||
@@ -34,4 +34,9 @@ const result = autocompletedResults[resultIndex]; | ||
origin: "autocomplete", | ||
tags | ||
tags, | ||
totalResults, | ||
filters, | ||
sort, | ||
currentPage: current, | ||
resultsPerPage: resultsPerPage | ||
}); | ||
} |
@@ -14,3 +14,3 @@ /** | ||
console.log("Search UI: Action", "trackClickThrough", ...arguments); | ||
const { requestId, searchTerm, results, current, resultsPerPage } = this.state; | ||
const { requestId, searchTerm, results, current, resultsPerPage, totalResults, filters, sort } = this.state; | ||
const resultIndexOnPage = results.findIndex((result) => result._meta.id === documentId); | ||
@@ -33,6 +33,11 @@ const result = results[resultIndexOnPage]; | ||
query: searchTerm, | ||
origin: "results", | ||
position: resultIndexOnPage, | ||
origin: "results", | ||
tags | ||
tags, | ||
totalResults, | ||
filters, | ||
sort, | ||
currentPage: current, | ||
resultsPerPage: resultsPerPage | ||
}); | ||
} |
@@ -186,3 +186,7 @@ var __rest = (this && this.__rest) || function (s, e) { | ||
type: "SearchQuery", | ||
filters: this.state.filters, | ||
query: this.state.searchTerm, | ||
sort: requestState.sort, | ||
currentPage: requestState.current, | ||
resultsPerPage: requestState.resultsPerPage, | ||
totalResults: totalResults | ||
@@ -189,0 +193,0 @@ }); |
@@ -168,6 +168,10 @@ import { SearchDriverActions } from ".."; | ||
} | ||
interface SearchQueryEvent extends BaseEvent { | ||
export interface SearchQueryEvent extends BaseEvent { | ||
type: "SearchQuery"; | ||
filters: Filter[]; | ||
query: string; | ||
totalResults: number; | ||
sort?: SortOption[]; | ||
currentPage?: number; | ||
resultsPerPage?: number; | ||
} | ||
@@ -180,5 +184,4 @@ interface AutocompleteSuggestionSelectedEvent extends BaseEvent { | ||
} | ||
interface ResultSelectedEvent extends BaseEvent { | ||
export interface ResultSelectedEvent extends Omit<SearchQueryEvent, "type"> { | ||
type: "ResultSelected"; | ||
query: string; | ||
documentId: string; | ||
@@ -185,0 +188,0 @@ position: number; |
{ | ||
"name": "@elastic/search-ui", | ||
"version": "1.19.1", | ||
"version": "1.20.0", | ||
"description": "A Headless Search UI library", | ||
@@ -48,3 +48,3 @@ "license": "Apache-2.0", | ||
}, | ||
"gitHead": "979b89a369b08aaaa043f551b23eda1ea51ed39f" | ||
"gitHead": "4078c5d7f15dd0fae335254a1930bdfb7d201673" | ||
} |
440078
10615