Skip to content

Commit

Permalink
fix(recommend): in intantsearch.js use Hit instead of AlgoliaHit
Browse files Browse the repository at this point in the history
  • Loading branch information
raed667 committed Jan 22, 2025
1 parent 3d0c6cb commit 5ad000b
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import type {
Unmounter,
UnknownWidgetParams,
RecommendResponse,
AlgoliaHit,
Hit,
} from '../../types';
import type { PlainSearchParameters } from 'algoliasearch-helper';

Expand All @@ -33,7 +33,7 @@ export type FrequentlyBoughtTogetherRenderState<
/**
* The matched recommendations from Algolia API.
*/
items: Array<AlgoliaHit<THit>>;
items: Array<Hit<THit>>;

/**
* Sends an event to the Insights middleware.
Expand Down Expand Up @@ -78,8 +78,8 @@ export type FrequentlyBoughtTogetherConnectorParams<
* Function to transform the items passed to the templates.
*/
transformItems?: TransformItems<
AlgoliaHit<THit>,
{ results: RecommendResponse<AlgoliaHit<THit>> }
Hit<THit>,
{ results: RecommendResponse<Hit<THit>> }
>;
};

Expand Down Expand Up @@ -189,7 +189,7 @@ export default (function connectFrequentlyBoughtTogether<
const transformedItems = transformItems(
itemsWithAbsolutePositionAndQueryID,
{
results: results as RecommendResponse<AlgoliaHit<THit>>,
results: results as RecommendResponse<Hit<THit>>,
}
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import type {
Unmounter,
UnknownWidgetParams,
RecommendResponse,
AlgoliaHit,
Hit,
} from '../../types';
import type { PlainSearchParameters } from 'algoliasearch-helper';

Expand All @@ -33,7 +33,7 @@ export type LookingSimilarRenderState<
/**
* The matched recommendations from the Algolia API.
*/
items: Array<AlgoliaHit<THit>>;
items: Array<Hit<THit>>;
/**
* Sends an event to the Insights middleware.
*/
Expand Down Expand Up @@ -79,8 +79,8 @@ export type LookingSimilarConnectorParams<
* Function to transform the items passed to the templates.
*/
transformItems?: TransformItems<
AlgoliaHit<THit>,
{ results: RecommendResponse<AlgoliaHit<THit>> }
Hit<THit>,
{ results: RecommendResponse<Hit<THit>> }
>;
};

Expand Down Expand Up @@ -191,7 +191,7 @@ export default (function connectLookingSimilar<
const transformedItems = transformItems(
itemsWithAbsolutePositionAndQueryID,
{
results: results as RecommendResponse<AlgoliaHit<THit>>,
results: results as RecommendResponse<Hit<THit>>,
}
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import type {
Unmounter,
UnknownWidgetParams,
RecommendResponse,
AlgoliaHit,
Hit,
} from '../../types';
import type { PlainSearchParameters } from 'algoliasearch-helper';

Expand All @@ -33,7 +33,7 @@ export type RelatedProductsRenderState<
/**
* The matched recommendations from the Algolia API.
*/
items: Array<AlgoliaHit<THit>>;
items: Array<Hit<THit>>;

/**
* Sends an event to the Insights middleware.
Expand Down Expand Up @@ -80,8 +80,8 @@ export type RelatedProductsConnectorParams<
* Function to transform the items passed to the templates.
*/
transformItems?: TransformItems<
AlgoliaHit<THit>,
{ results: RecommendResponse<AlgoliaHit<THit>> }
Hit<THit>,
{ results: RecommendResponse<Hit<THit>> }
>;
};

Expand Down Expand Up @@ -192,7 +192,7 @@ export default (function connectRelatedProducts<
const transformedItems = transformItems(
itemsWithAbsolutePositionAndQueryID,
{
results: results as RecommendResponse<AlgoliaHit<THit>>,
results: results as RecommendResponse<Hit<THit>>,
}
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import type {
Unmounter,
UnknownWidgetParams,
RecommendResponse,
AlgoliaHit,
Hit,
} from '../../types';
import type { PlainSearchParameters } from 'algoliasearch-helper';

Expand All @@ -34,7 +34,7 @@ export type TrendingItemsRenderState<
/**
* The matched recommendations from the Algolia API.
*/
items: Array<AlgoliaHit<THit>>;
items: Array<Hit<THit>>;

/**
* Sends an event to the Insights middleware.
Expand Down Expand Up @@ -92,8 +92,8 @@ export type TrendingItemsConnectorParams<
* Function to transform the items passed to the templates.
*/
transformItems?: TransformItems<
AlgoliaHit<THit>,
{ results: RecommendResponse<AlgoliaHit<THit>> }
Hit<THit>,
{ results: RecommendResponse<Hit<THit>> }
>;
};

Expand Down Expand Up @@ -212,7 +212,7 @@ export default (function connectTrendingItems<
const transformedItems = transformItems(
itemsWithAbsolutePositionAndQueryID,
{
results: results as RecommendResponse<AlgoliaHit<THit>>,
results: results as RecommendResponse<Hit<THit>>,
}
);

Expand Down

0 comments on commit 5ad000b

Please sign in to comment.