let getState: GetStateFunction export function configHelper (store: {getState: GetStateFunction}): void { getState = store.getState } export function getSelectedBatch (): IAppOrderBatch { const orderBatchState = getState().libOrderBatch return orderBatchState.selectedBatch } export function getSelectedBatchItem (): [IAppBatchItem | undefined, IAppBatchItem | undefined] { const orderBatchState = getState().libOrderBatch const selectedItemKey = orderBatchState.selectedItemKey const selectedSetItemKey = orderBatchState.selectedSetItemKey const selectedBatch = orderBatchState.selectedBatch const selectedItem = selectedBatch?.items.find(item => item.key === selectedItemKey) const selectedSetItem = selectedItem?.setItems?.find(setItem => setItem.key === selectedSetItemKey) return [selectedItem, selectedSetItem] }