This commit is contained in:
Alan Mosko
2023-01-17 11:29:10 -03:00
parent c398aa3ca4
commit 05dd53e2ce
12 changed files with 217 additions and 106 deletions

View File

@@ -7,7 +7,14 @@ import { getStream, getUrlFromDirectPath, toReadable } from './messages-media'
export const parseCatalogNode = (node: BinaryNode) => {
const catalogNode = getBinaryNodeChild(node, 'product_catalog')
const products = getBinaryNodeChildren(catalogNode, 'product').map(parseProductNode)
return { products }
const paging = getBinaryNodeChild(catalogNode, 'paging')
return {
products,
nextPageCursor: paging
? getBinaryNodeChildString(paging, 'after')
: undefined
}
}
export const parseCollectionsNode = (node: BinaryNode) => {