-
Notifications
You must be signed in to change notification settings - Fork 216
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(recommend): add "Looking Similar" model (#1469)
* feat(recommend): add Looking Similar model --------- Co-authored-by: Dhaya <154633+dhayab@users.noreply.github.com>
- Loading branch information
Showing
8 changed files
with
41 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { BaseRecommendClient, LookingSimilarQuery, WithRecommendMethods } from '../types'; | ||
import { getRecommendations } from './getRecommendations'; | ||
|
||
type GetLookingSimilar = ( | ||
base: BaseRecommendClient | ||
) => WithRecommendMethods<BaseRecommendClient>['getLookingSimilar']; | ||
|
||
export const getLookingSimilar: GetLookingSimilar = base => { | ||
return (queries: readonly LookingSimilarQuery[], requestOptions) => { | ||
return getRecommendations(base)( | ||
queries.map(query => ({ | ||
...query, | ||
model: 'looking-similar', | ||
})), | ||
requestOptions | ||
); | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import { RecommendationsQuery } from './RecommendationsQuery'; | ||
|
||
export type LookingSimilarQuery = Omit<RecommendationsQuery, 'model'>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,6 @@ | ||
export type TrendingModel = 'trending-items' | 'trending-facets'; | ||
export type RecommendModel = 'related-products' | 'bought-together' | TrendingModel; | ||
export type RecommendModel = | ||
| 'related-products' | ||
| 'bought-together' | ||
| 'looking-similar' | ||
| TrendingModel; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters