diff --git a/lib/PrivilegedDonorContacts/ContactsContainer.test.js b/lib/PrivilegedDonorContacts/ContactsContainer.test.js index 3679b4e1..2e30cc03 100644 --- a/lib/PrivilegedDonorContacts/ContactsContainer.test.js +++ b/lib/PrivilegedDonorContacts/ContactsContainer.test.js @@ -81,7 +81,7 @@ const renderComponent = (props = {}) => (render( , )); -describe('DonorsContainer', () => { +describe('ContactsContainer', () => { beforeEach(() => { useCategories.mockClear().mockReturnValue({ donors: [], diff --git a/lib/PrivilegedDonorContacts/constants.js b/lib/PrivilegedDonorContacts/constants.js index e90647c6..8964d7d0 100644 --- a/lib/PrivilegedDonorContacts/constants.js +++ b/lib/PrivilegedDonorContacts/constants.js @@ -1,30 +1,51 @@ import { FormattedMessage } from 'react-intl'; export const PRIVILEGED_CONTACT_URL = 'privileged-contacts'; + +const COLUMN_NAMES = { + categories: 'categories', + email: 'email', + name: 'name', + notes: 'notes', + phone: 'phone', + status: 'status', + unassignContact: 'unassignContact', +}; + +const { + categories, + email, + name, + notes, + phone, + status, + unassignContact, +} = COLUMN_NAMES; + export const defaultVisibleColumns = [ - 'name', - 'categories', - 'email', - 'phone', - 'status', - 'notes', + name, + categories, + email, + phone, + status, + notes, ]; export const defaultColumnMapping = { - categories: , - email: , - name: , - notes: , - phone: , - status: , - unassignContact: null, + [categories]: , + [email]: , + [name]: , + [notes]: , + [phone]: , + [status]: , + [unassignContact]: null, }; export const sortableColumns = defaultVisibleColumns; export const defaultContainerVisibleColumns = [ ...defaultVisibleColumns, - 'unassignContact', + unassignContact, ]; export const alignRowProps = { alignLastColToEnd: true }; diff --git a/lib/PrivilegedDonorContacts/hooks/constants.js b/lib/PrivilegedDonorContacts/hooks/constants.js deleted file mode 100644 index edb0190c..00000000 --- a/lib/PrivilegedDonorContacts/hooks/constants.js +++ /dev/null @@ -1,2 +0,0 @@ -export const DEFAULT_DATA = []; -export const PRIVILEGED_CONTACTS_API = 'organizations-storage/privileged-contacts'; diff --git a/lib/PrivilegedDonorContacts/hooks/useFetchPrivilegedContacts/useFetchPrivilegedContacts.js b/lib/PrivilegedDonorContacts/hooks/useFetchPrivilegedContacts/useFetchPrivilegedContacts.js index 4dfcddca..d24230c2 100644 --- a/lib/PrivilegedDonorContacts/hooks/useFetchPrivilegedContacts/useFetchPrivilegedContacts.js +++ b/lib/PrivilegedDonorContacts/hooks/useFetchPrivilegedContacts/useFetchPrivilegedContacts.js @@ -5,11 +5,10 @@ import { useOkapiKy, } from '@folio/stripes/core'; +import { PRIVILEGED_CONTACTS_API } from '../../../constants'; import { batchRequest } from '../../../utils'; -import { - DEFAULT_DATA, - PRIVILEGED_CONTACTS_API, -} from '../constants'; + +const DEFAULT_DATA = []; export const useFetchPrivilegedContacts = (privilegedContactIds = DEFAULT_DATA, options = {}) => { const ky = useOkapiKy(); diff --git a/lib/constants/api.js b/lib/constants/api.js index 75d0dd7a..eed5e6da 100644 --- a/lib/constants/api.js +++ b/lib/constants/api.js @@ -3,6 +3,7 @@ export const ACQUISITIONS_UNITS_API = 'acquisitions-units/units'; export const ACQUISITIONS_UNIT_MEMBERSHIPS_API = 'acquisitions-units/memberships'; export const BATCH_GROUPS_API = 'batch-groups'; export const BUDGETS_API = 'finance/budgets'; +export const CATEGORIES_API = 'organizations-storage/categories'; export const CONFIG_API = 'configurations/entries'; export const CONTRIBUTOR_NAME_TYPES_API = 'contributor-name-types'; export const EXCHANGE_RATE_API = 'finance/exchange-rate'; @@ -19,6 +20,7 @@ export const MATERIAL_TYPE_API = 'material-types'; export const ORDERS_API = 'orders/composite-orders'; export const ORDER_PIECES_API = 'orders/pieces'; export const PREFIXES_API = 'orders/configuration/prefixes'; +export const PRIVILEGED_CONTACTS_API = 'organizations-storage/privileged-contacts'; export const REQUESTS_API = 'circulation/requests'; export const SUFFIXES_API = 'orders/configuration/suffixes'; export const TAGS_API = 'tags'; diff --git a/lib/hooks/useCategories/constants.js b/lib/hooks/useCategories/constants.js deleted file mode 100644 index 7cf581d9..00000000 --- a/lib/hooks/useCategories/constants.js +++ /dev/null @@ -1 +0,0 @@ -export const CATEGORIES_API = 'organizations-storage/categories'; diff --git a/lib/hooks/useCategories/useCategories.js b/lib/hooks/useCategories/useCategories.js index 79e8de91..81c93c84 100644 --- a/lib/hooks/useCategories/useCategories.js +++ b/lib/hooks/useCategories/useCategories.js @@ -5,8 +5,10 @@ import { useOkapiKy, } from '@folio/stripes/core'; -import { LIMIT_MAX } from '../../constants'; -import { CATEGORIES_API } from './constants'; +import { + CATEGORIES_API, + LIMIT_MAX, +} from '../../constants'; import { useTranslatedCategories } from '../useTranslatedCategories'; const DEFAULT_DATA = [];