@yext/search-core
Version:
Typescript Networking Library for the Yext Search API
23 lines • 1.44 kB
JavaScript
import { createDirectAnswer } from './createDirectAnswer';
import { createFacets } from './createFacets';
import { createLocationBias } from './createLocationBias';
import { createSpellCheck } from './createSpellCheck';
import { createVerticalResults } from './createVerticalResults';
export function createVerticalSearchResponse(data) {
var _a, _b, _c;
return {
verticalResults: createVerticalResults(data.response),
queryId: data.response.queryId,
directAnswer: data.response.directAnswer && createDirectAnswer(data.response.directAnswer),
searchIntents: data.response.searchIntents,
facets: createFacets(data.response.facets),
spellCheck: data.response.spellCheck && createSpellCheck(data.response.spellCheck),
locationBias: data.response.locationBias && createLocationBias(data.response.locationBias),
allResultsForVertical: data.response.allResultsForVertical
&& createVerticalSearchResponse({ response: data.response.allResultsForVertical }),
alternativeVerticals: (_b = (_a = data.response.alternativeVerticals) === null || _a === void 0 ? void 0 : _a.modules) === null || _b === void 0 ? void 0 : _b.map(createVerticalResults),
uuid: (_c = data.meta) === null || _c === void 0 ? void 0 : _c.uuid,
queryRulesActionsData: data.response.queryRulesActionsData
};
}
//# sourceMappingURL=createVerticalSearchResponse.js.map