feat(MED-131): show package analysis elements in comparison modal
This commit is contained in:
@@ -85,6 +85,20 @@ export const listProducts = async ({
|
||||
})
|
||||
}
|
||||
|
||||
export const getAnalysisElementOriginalIds = async (products: HttpTypes.StoreProduct[]) => {
|
||||
return products
|
||||
.flatMap(({ metadata }) => {
|
||||
const value = metadata?.analysisElementOriginalIds;
|
||||
try {
|
||||
return JSON.parse(value as string);
|
||||
} catch (e) {
|
||||
console.error("Failed to parse analysisElementOriginalIds from analysis package, possibly invalid format", e);
|
||||
return [];
|
||||
}
|
||||
})
|
||||
.filter(Boolean) as string[];
|
||||
}
|
||||
|
||||
/**
|
||||
* This will fetch 100 products to the Next.js cache and sort them based on the sortBy parameter.
|
||||
* It will then return the paginated products based on the page and limit parameters.
|
||||
|
||||
Reference in New Issue
Block a user