diff --git a/src/components/interactive-builder/interactive-builder.component.tsx b/src/components/interactive-builder/interactive-builder.component.tsx index 1196c26..d4a3267 100644 --- a/src/components/interactive-builder/interactive-builder.component.tsx +++ b/src/components/interactive-builder/interactive-builder.component.tsx @@ -5,6 +5,7 @@ import { v4 as uuidv4 } from 'uuid'; import { Button, Accordion, AccordionItem, Tile } from '@carbon/react'; import { type DynamicExtensionSlot, type Schema } from '../../types'; import styles from './interactive-builder.scss'; +import { getSubMenuSlotDetails } from '../../helpers'; interface InteractiveBuilderProps { schema: Schema; @@ -133,13 +134,6 @@ const InteractiveBuilder = ({ schema, onSchemaChange }: InteractiveBuilderProps) submenuConfig.add.map((submenuKey) => { const submenuDetails = submenuConfig.configure[submenuKey]; const subMenuSlot = submenuDetails?.slot; - const getSubMenuSlotDetails = (schema, subMenuSlot) => { - const patientChartApp = schema['@openmrs/esm-patient-chart-app']; - if (patientChartApp && patientChartApp.extensionSlots) { - return patientChartApp.extensionSlots[subMenuSlot]; - } - return null; - }; const subMenuSlotDetails = getSubMenuSlotDetails(schema, subMenuSlot); return ( diff --git a/src/helpers.ts b/src/helpers.ts index c44f6cd..0cf4c51 100644 --- a/src/helpers.ts +++ b/src/helpers.ts @@ -5,3 +5,11 @@ export const generateNodeId = (string) => return index === 0 ? word.toLowerCase() : word.toUpperCase(); }) .replace(/\s+/g, ''); + +export const getSubMenuSlotDetails = (schema, subMenuSlot) => { + const patientChartApp = schema['@openmrs/esm-patient-chart-app']; + if (patientChartApp && patientChartApp.extensionSlots) { + return patientChartApp.extensionSlots[subMenuSlot]; + } + return null; +};