import * as React from 'react'; import get from 'lodash/get'; import ErrorBoundary from '@wcpos/components/src/error-boundary'; import Suspense from '@wcpos/components/src/suspense'; import Table, { CellRenderer, TableProps } from '@wcpos/components/src/table'; import Text from '@wcpos/components/src/text'; import { Actions } from '../cells/actions'; import { FeeAndShippingTotal } from '../cells/fee-and-shipping-total'; import { FeeName } from '../cells/fee-name'; import { FeePrice } from '../cells/fee-price'; type FeeLine = import('@wcpos/database').OrderDocument['fee_lines'][number]; type RenderItem = TableProps['renderItem']; const cells = { actions: Actions, name: FeeName, price: FeePrice, subtotal: () => null, total: FeeAndShippingTotal, }; /** * */ export const FeeLineRow = ({ uuid, item, index, target }) => { /** * */ const cellRenderer = React.useCallback>( ({ item, column, index, cellWidth }) => { const Cell = get(cells, column.key); if (Cell) { return ( ); } if (item[column.key]) { return {String(item[column.key])}; } return null; }, [uuid] ); return ; };