fix(BOOK-453): avoid linkConnection invalid * fix(BOOK-453): avoid linkConnection invalid * test * test * test * Merge master
30 lines
901 B
TypeScript
30 lines
901 B
TypeScript
import { AccountPageEnum } from "../../../types/accountPageEnum"
|
|
|
|
import type { AccountPageRefs } from "../../../types/accountPage"
|
|
import type { System } from "../schemas/system"
|
|
|
|
export function getConnections({ account_page }: AccountPageRefs) {
|
|
const connections: System["system"][] = [account_page.system]
|
|
|
|
if (account_page.content) {
|
|
account_page.content.forEach((block) => {
|
|
switch (block.__typename) {
|
|
case AccountPageEnum.ContentStack.blocks.ShortCuts: {
|
|
if (block.shortcuts.shortcuts.length) {
|
|
connections.push(...block.shortcuts.shortcuts.filter((c) => !!c))
|
|
}
|
|
break
|
|
}
|
|
case AccountPageEnum.ContentStack.blocks.DynamicContent: {
|
|
if (block.dynamic_content.link) {
|
|
connections.push(block.dynamic_content.link)
|
|
}
|
|
break
|
|
}
|
|
}
|
|
})
|
|
}
|
|
|
|
return connections
|
|
}
|