Skip to content

Commit

Permalink
Merge branch 'master' into feat-recommended-for-you
Browse files Browse the repository at this point in the history
  • Loading branch information
raed667 committed Dec 7, 2023
2 parents 071f2a8 + 94b46b5 commit 08f12ee
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 1 deletion.
5 changes: 5 additions & 0 deletions packages/recommend/src/types/TrendingFacetHit.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export type TrendingFacetHit<TObject> = {
readonly _score: number;
readonly facetName: string;
readonly facetValue: TObject;
};
7 changes: 7 additions & 0 deletions packages/recommend/src/types/TrendingFacetsResponse.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { SearchResponse } from '@algolia/client-search';

import { TrendingFacetHit } from './TrendingFacetHit';

export type TrendingFacetsResponse<TObject> = Omit<SearchResponse<TObject>, 'hits'> & {
readonly hits: ReadonlyArray<TrendingFacetHit<TObject>>;
};
10 changes: 9 additions & 1 deletion packages/recommend/src/types/WithRecommendMethods.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,17 @@ import { LookingSimilarQuery } from './LookingSimilarQuery';
import { RecommendationsQuery } from './RecommendationsQuery';
import { RelatedProductsQuery } from './RelatedProductsQuery';
import { TrendingFacetsQuery } from './TrendingFacetsQuery';
import { TrendingFacetsResponse } from './TrendingFacetsResponse';
import { TrendingItemsQuery } from './TrendingItemsQuery';
import { TrendingQuery } from './TrendingQuery';

export type RecommendTrendingFacetsQueriesResponse<TObject> = {
/**
* The list of results.
*/
readonly results: ReadonlyArray<TrendingFacetsResponse<TObject>>;
};

export type RecommendQueriesResponse<TObject> = {
/**
* The list of results.
Expand Down Expand Up @@ -56,7 +64,7 @@ export type WithRecommendMethods<TType> = TType & {
readonly getTrendingFacets: <TObject>(
queries: readonly TrendingFacetsQuery[],
requestOptions?: RequestOptions & SearchOptions
) => Readonly<Promise<RecommendQueriesResponse<TObject>>>;
) => Readonly<Promise<RecommendTrendingFacetsQueriesResponse<TObject>>>;

/**
* Returns Looking Similar
Expand Down
2 changes: 2 additions & 0 deletions packages/recommend/src/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,5 @@ export * from './TrendingQuery';
export * from './WithRecommendMethods';
export * from './LookingSimilarQuery';
export * from './RecommendedForYouQuery';
export * from './TrendingFacetHit';
export * from './TrendingFacetsResponse';

0 comments on commit 08f12ee

Please sign in to comment.