Skip to content

Commit 08f12ee

Browse files
committed
Merge branch 'master' into feat-recommended-for-you
2 parents 071f2a8 + 94b46b5 commit 08f12ee

File tree

4 files changed

+23
-1
lines changed

4 files changed

+23
-1
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
export type TrendingFacetHit<TObject> = {
2+
readonly _score: number;
3+
readonly facetName: string;
4+
readonly facetValue: TObject;
5+
};
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import { SearchResponse } from '@algolia/client-search';
2+
3+
import { TrendingFacetHit } from './TrendingFacetHit';
4+
5+
export type TrendingFacetsResponse<TObject> = Omit<SearchResponse<TObject>, 'hits'> & {
6+
readonly hits: ReadonlyArray<TrendingFacetHit<TObject>>;
7+
};

packages/recommend/src/types/WithRecommendMethods.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,17 @@ import { LookingSimilarQuery } from './LookingSimilarQuery';
77
import { RecommendationsQuery } from './RecommendationsQuery';
88
import { RelatedProductsQuery } from './RelatedProductsQuery';
99
import { TrendingFacetsQuery } from './TrendingFacetsQuery';
10+
import { TrendingFacetsResponse } from './TrendingFacetsResponse';
1011
import { TrendingItemsQuery } from './TrendingItemsQuery';
1112
import { TrendingQuery } from './TrendingQuery';
1213

14+
export type RecommendTrendingFacetsQueriesResponse<TObject> = {
15+
/**
16+
* The list of results.
17+
*/
18+
readonly results: ReadonlyArray<TrendingFacetsResponse<TObject>>;
19+
};
20+
1321
export type RecommendQueriesResponse<TObject> = {
1422
/**
1523
* The list of results.
@@ -56,7 +64,7 @@ export type WithRecommendMethods<TType> = TType & {
5664
readonly getTrendingFacets: <TObject>(
5765
queries: readonly TrendingFacetsQuery[],
5866
requestOptions?: RequestOptions & SearchOptions
59-
) => Readonly<Promise<RecommendQueriesResponse<TObject>>>;
67+
) => Readonly<Promise<RecommendTrendingFacetsQueriesResponse<TObject>>>;
6068

6169
/**
6270
* Returns Looking Similar

packages/recommend/src/types/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,5 @@ export * from './TrendingQuery';
1616
export * from './WithRecommendMethods';
1717
export * from './LookingSimilarQuery';
1818
export * from './RecommendedForYouQuery';
19+
export * from './TrendingFacetHit';
20+
export * from './TrendingFacetsResponse';

0 commit comments

Comments
 (0)