(id, lang, pageMap)
| 46 | export const productMap = Object.assign({}, internalProducts, externalProducts) |
| 47 | |
| 48 | function getPage(id, lang, pageMap) { |
| 49 | const productId = id.split('/')[0] |
| 50 | const product = productMap[productId] |
| 51 | const href = removeFPTFromPath(path.posix.join('/', lang, product.versions[0], id)) |
| 52 | const page = pageMap[href] |
| 53 | if (!page) { |
| 54 | throw new Error( |
| 55 | `Unable to find a page by the href '${href}'. Review your 'childGroups' frontmatter maybe.` |
| 56 | ) |
| 57 | } |
| 58 | // Return only the props needed for the ProductSelectionCard, since |
| 59 | // that's the only place this is ever used. |
| 60 | return { |
| 61 | id, |
| 62 | name: page.shortTitle || page.title, |
| 63 | href: href.replace(`/${lang}/`, '/'), |
| 64 | versions: page.applicableVersions, |
| 65 | } |
| 66 | } |
| 67 | |
| 68 | export function getProductGroups(pageMap, lang) { |
| 69 | return data.childGroups.map((group) => { |
no test coverage detected