Skip to content

Commit

Permalink
Merge pull request #1729 from techmatters/CHI-1434-move_redux_constants
Browse files Browse the repository at this point in the history
Chi 1434 move redux constants
  • Loading branch information
stephenhand authored Oct 18, 2023
2 parents d870d5f + 61d8012 commit 92e3208
Show file tree
Hide file tree
Showing 79 changed files with 217 additions and 168 deletions.
3 changes: 2 additions & 1 deletion plugin-hrm-form/src/HrmFormPlugin.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import { FlexPlugin, loadCSS } from '@twilio/flex-plugin';

import './styles/global-overrides.css';

import reducers, { namespace } from './states';
import reducers from './states';
import HrmTheme, { overrides } from './styles/HrmTheme';
import { initLocalization } from './utils/pluginHelpers';
import * as Providers from './utils/setUpProviders';
Expand All @@ -46,6 +46,7 @@ import { setUpCounselorToolkits } from './components/toolkits/setUpCounselorTool
import { setupConferenceComponents, setUpConferenceActions } from './conference';
import { setUpTransferActions } from './transfer/setUpTransferActions';
import { playNotification } from './notifications/playNotification';
import { namespace } from './states/storeNamespaces';

const PLUGIN_NAME = 'HrmFormPlugin';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ import { changeRoute } from '../../states/routing/actions';
import { updateDraft } from '../../states/contacts/existingContacts';
import { completeTask } from '../../services/formSubmissionHelpers';
import CallTypeButtons from '../../components/callTypeButtons';
import { namespace, contactFormsBase, connectedCaseBase, configurationBase } from '../../states';
import { updateContactInHrmAsyncAction } from '../../states/contacts/saveContact';
import { configurationBase, connectedCaseBase, contactFormsBase, namespace } from '../../states/storeNamespaces';

jest.mock('../../states/conferencing', () => ({}));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import { DeepPartial } from 'redux';
import { Dispatch } from 'react';

import { csamReportBase, namespace, RootState, routingBase } from '../../../states';
import { RootState } from '../../../states';
import { AppRoutes } from '../../../states/routing/types';
import { CSAMPage, existingContactCSAMApi, newContactCSAMApi } from '../../../components/CSAMReport/csamReportApi';
import {
Expand All @@ -39,6 +39,7 @@ import { CSAMReportEntry } from '../../../types/types';
import { reportToIWF, selfReportToIWF } from '../../../services/ServerlessService';
import { acknowledgeCSAMReport, createCSAMReport } from '../../../services/CSAMReportService';
import { addExternalReportEntry } from '../../../states/csam-report/existingContactExternalReport';
import { csamReportBase, namespace, routingBase } from '../../../states/storeNamespaces';

jest.mock('../../../services/ServerlessService', () => ({
reportToIWF: jest.fn(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ import { DefinitionVersionId, loadDefinition, useFetchDefinitions } from 'hrm-fo

import { mockPartialConfiguration } from '../../mockGetConfig';
import { AddOfflineContactButton } from '../../../components/OfflineContact';
import { namespace, routingBase, configurationBase } from '../../../states';
import { rerenderAgentDesktop } from '../../../rerenderView';
import { createContact } from '../../../services/ContactService';
import { Contact } from '../../../types/types';
import { configurationBase, namespace, routingBase } from '../../../states/storeNamespaces';

let v1;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import configureMockStore from 'redux-mock-store';
import { DefinitionVersionId, loadDefinition, useFetchDefinitions } from 'hrm-form-definitions';

import { mockGetDefinitionsResponse } from '../../mockGetConfig';
import { configurationBase, connectedCaseBase, contactFormsBase, namespace, RootState } from '../../../states';
import { RootState } from '../../../states';
import AddEditCaseItem, { AddEditCaseItemProps } from '../../../components/case/AddEditCaseItem';
import { getDefinitionVersions } from '../../../hrmConfig';
import { CustomITask } from '../../../types/types';
Expand All @@ -34,6 +34,7 @@ import { householdSectionApi } from '../../../states/case/sections/household';
import { changeRoute } from '../../../states/routing/actions';
import { ReferralLookupStatus } from '../../../states/contacts/resourceReferral';
import { VALID_EMPTY_CONTACT } from '../../testContacts';
import { configurationBase, connectedCaseBase, contactFormsBase, namespace } from '../../../states/storeNamespaces';

// eslint-disable-next-line react-hooks/rules-of-hooks
const { mockFetchImplementation, mockReset, buildBaseURL } = useFetchDefinitions();
Expand Down
16 changes: 8 additions & 8 deletions plugin-hrm-form/src/___tests__/components/case/Case.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,19 +27,19 @@ import { DefinitionVersionId, loadDefinition, useFetchDefinitions } from 'hrm-fo

import { mockGetDefinitionsResponse, mockPartialConfiguration } from '../../mockGetConfig';
import Case from '../../../components/case';
import {
namespace,
configurationBase,
contactFormsBase,
connectedCaseBase,
routingBase,
RootState,
} from '../../../states';
import { RootState } from '../../../states';
import { getDefinitionVersions } from '../../../hrmConfig';
import { Contact, StandaloneITask } from '../../../types/types';
import { LOAD_CONTACT_ACTION } from '../../../states/contacts/existingContacts';
import { VALID_EMPTY_CONTACT } from '../../testContacts';
import { RecursivePartial } from '../../RecursivePartial';
import {
configurationBase,
connectedCaseBase,
contactFormsBase,
namespace,
routingBase,
} from '../../../states/storeNamespaces';

jest.mock('../../../services/CaseService', () => ({ getActivities: jest.fn(() => []), cancelCase: jest.fn() }));
jest.mock('../../../permissions', () => ({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,18 @@ import configureMockStore from 'redux-mock-store';

import { mockGetDefinitionsResponse } from '../../mockGetConfig';
import CaseHome, { CaseHomeProps } from '../../../components/case/CaseHome';
import { configurationBase, connectedCaseBase, contactFormsBase, namespace, routingBase } from '../../../states';
import { HouseholdEntry, PerpetratorEntry, StandaloneITask } from '../../../types/types';
import { CaseDetails } from '../../../states/case/types';
import { getDefinitionVersions } from '../../../hrmConfig';
import { CaseItemAction, NewCaseSubroutes } from '../../../states/routing/types';
import { VALID_EMPTY_CONTACT } from '../../testContacts';
import {
configurationBase,
connectedCaseBase,
contactFormsBase,
namespace,
routingBase,
} from '../../../states/storeNamespaces';

// eslint-disable-next-line react-hooks/rules-of-hooks
const { mockFetchImplementation, mockReset, buildBaseURL } = useFetchDefinitions();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@ import configureMockStore from 'redux-mock-store';
import { DefinitionVersion, DefinitionVersionId, loadDefinition, useFetchDefinitions } from 'hrm-form-definitions';

import { mockGetDefinitionsResponse } from '../../mockGetConfig';
import { configurationBase, connectedCaseBase, contactFormsBase, namespace } from '../../../states';
import EditCaseSummary, { EditCaseSummaryProps } from '../../../components/case/EditCaseSummary';
import { getDefinitionVersions } from '../../../hrmConfig';
import { StandaloneITask } from '../../../types/types';
import { AppRoutes } from '../../../states/routing/types';
import { changeRoute } from '../../../states/routing/actions';
import { configurationBase, connectedCaseBase, contactFormsBase, namespace } from '../../../states/storeNamespaces';

// eslint-disable-next-line react-hooks/rules-of-hooks
const { mockFetchImplementation, mockReset, buildBaseURL } = useFetchDefinitions();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ import { StorelessThemeProvider } from '@twilio/flex-ui';
import { DefinitionVersion, DefinitionVersionId, loadDefinition, useFetchDefinitions } from 'hrm-form-definitions';

import { mockGetDefinitionsResponse } from '../../mockGetConfig';
import { configurationBase, connectedCaseBase, contactFormsBase, namespace } from '../../../states';
import ViewCaseItem, { ViewCaseItemProps } from '../../../components/case/ViewCaseItem';
import { getDefinitionVersions } from '../../../hrmConfig';
import { StandaloneITask } from '../../../types/types';
import { CaseItemAction, NewCaseSubroutes } from '../../../states/routing/types';
import { householdSectionApi } from '../../../states/case/sections/household';
import { configurationBase, connectedCaseBase, contactFormsBase, namespace } from '../../../states/storeNamespaces';

// eslint-disable-next-line react-hooks/rules-of-hooks
const { mockFetchImplementation, mockReset, buildBaseURL } = useFetchDefinitions();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,9 @@ import ViewContact from '../../../components/case/ViewContact';
import { ContactDetailsSections } from '../../../components/common/ContactDetails';
import { getDefinitionVersions } from '../../../hrmConfig';
import { Contact } from '../../../types/types';
import { connectedCaseBase, contactFormsBase, csamReportBase, RootState } from '../../../states';
import { RootState } from '../../../states';
import { DetailsContext, TOGGLE_DETAIL_EXPANDED_ACTION } from '../../../states/contacts/contactDetails';
import { connectedCaseBase, contactFormsBase, csamReportBase } from '../../../states/storeNamespaces';

jest.mock('@twilio/flex-ui', () => ({
...jest.requireActual('@twilio/flex-ui'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ import { DefinitionVersionId, loadDefinition, useFetchDefinitions } from 'hrm-fo

import { mockGetDefinitionsResponse } from '../../mockGetConfig';
import CaseList from '../../../components/caseList';
import { caseListBase, configurationBase, namespace } from '../../../states';
import { listCases } from '../../../services/CaseService';
import { getDefinitionVersions } from '../../../hrmConfig';
import { CaseListState } from '../../../states/caseList/reducer';
Expand All @@ -38,6 +37,7 @@ import {
} from '../../../states/caseList/listContent';
import { caseListSettingsInitialState } from '../../../states/caseList/settings';
import { Case, ContactRawJson, Contact } from '../../../types/types';
import { caseListBase, configurationBase, namespace } from '../../../states/storeNamespaces';

// eslint-disable-next-line react-hooks/rules-of-hooks
const { mockFetchImplementation, mockReset, buildBaseURL } = useFetchDefinitions();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ import { DefinitionVersionId, loadDefinition, useFetchDefinitions } from 'hrm-fo

import IssueCategorizationSectionForm from '../../../components/contact/IssueCategorizationSectionForm';
import { ToggleViewButton } from '../../../styles/HrmStyles';
import { namespace, contactFormsBase } from '../../../states';
import { setCategoriesGridView } from '../../../states/contacts/existingContacts';
import { forExistingContact } from '../../../states/contacts/issueCategorizationStateApi';
import { getAseloFeatureFlags } from '../../../hrmConfig';
import { VALID_EMPTY_CONTACT } from '../../testContacts';
import { FeatureFlags } from '../../../types/types';
import { contactFormsBase, namespace } from '../../../states/storeNamespaces';

jest.mock('../../../components/CSAMReport/CSAMReportFormDefinition');
jest.mock('../../../hrmConfig');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ import ContactDetails from '../../components/search/ContactDetails';
import { channelTypes } from '../../states/DomainConstants';
import { getDefinitionVersions } from '../../hrmConfig';
import { DetailsContext } from '../../states/contacts/contactDetails';
import { csamReportBase } from '../../states';
import { Contact } from '../../types/types';
import { csamReportBase } from '../../states/storeNamespaces';

jest.mock('@twilio/flex-ui', () => ({
...jest.requireActual('@twilio/flex-ui'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ import ContactHeader from '../../components/search/ContactPreview/ContactHeader'
import TagsAndCounselor from '../../components/search/TagsAndCounselor';
import { getDefinitionVersions } from '../../hrmConfig';
import { Contact } from '../../types/types';
import { configurationBase, namespace, RootState } from '../../states';
import { RootState } from '../../states';
import { configurationBase, namespace } from '../../states/storeNamespaces';

// eslint-disable-next-line react-hooks/rules-of-hooks
const { mockFetchImplementation, mockReset, buildBaseURL } = useFetchDefinitions();
Expand Down
2 changes: 1 addition & 1 deletion plugin-hrm-form/src/___tests__/search/Search.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import { SearchPages } from '../../states/search/types';
import { channelTypes } from '../../states/DomainConstants';
import { getDefinitionVersions } from '../../hrmConfig';
import { DetailsContext } from '../../states/contacts/contactDetails';
import { csamReportBase } from '../../states';
import { csamReportBase } from '../../states/storeNamespaces';

// eslint-disable-next-line react-hooks/rules-of-hooks
const { mockFetchImplementation, mockReset, buildBaseURL } = useFetchDefinitions();
Expand Down
8 changes: 7 additions & 1 deletion plugin-hrm-form/src/___tests__/search/SearchResults.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,14 @@ import HrmTheme from '../../styles/HrmTheme';
import { mockGetDefinitionsResponse } from '../mockGetConfig';
import { SearchPages } from '../../states/search/types';
import SearchResults from '../../components/search/SearchResults';
import { configurationBase, searchContactsBase, connectedCaseBase, contactFormsBase, namespace } from '../../states';
import { getDefinitionVersions } from '../../hrmConfig';
import {
configurationBase,
connectedCaseBase,
contactFormsBase,
namespace,
searchContactsBase,
} from '../../states/storeNamespaces';

jest.mock('../../permissions', () => ({
getPermissionsForCase: jest.fn(() => ({
Expand Down
4 changes: 2 additions & 2 deletions plugin-hrm-form/src/___tests__/states/case/reducer.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ import * as GeneralActions from '../../../states/actions';
import { Case } from '../../../types/types';
import { REMOVE_CONTACT_STATE } from '../../../states/types';
import { CaseState } from '../../../states/case/types';
import { configurationBase, connectedCaseBase, namespace, RootState } from '../../../states';
import { RootState } from '../../../states';
import { getAvailableCaseStatusTransitions } from '../../../states/case/caseStatus';
import { ConfigurationState } from '../../../states/configuration/reducer';
import { updateCaseAsyncAction } from '../../../states/case/saveCase';
import { configurationBase, connectedCaseBase, namespace } from '../../../states/storeNamespaces';

const task = { taskSid: 'task1' };
const stubRootState = { [configurationBase]: { definitionVersions: {} } } as RootState['plugin-hrm-form'];
Expand Down
3 changes: 2 additions & 1 deletion plugin-hrm-form/src/___tests__/states/case/saveCase.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,12 @@ import {
saveCaseReducer,
updateCaseAsyncAction,
} from '../../../states/case/saveCase';
import { configurationBase, connectedCaseBase, RootState } from '../../../states';
import { RootState } from '../../../states';
import { saveCaseState, reduce } from '../../../states/case/reducer';
import { updateCase, createCase } from '../../../services/CaseService';
import { connectToCase } from '../../../services/ContactService';
import { ReferralLookupStatus } from '../../../states/contacts/resourceReferral';
import { configurationBase, connectedCaseBase } from '../../../states/storeNamespaces';

jest.mock('../../../services/CaseService');
jest.mock('../../../services/ContactService');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,11 @@
*/

import { forExistingContact } from '../../../states/contacts/issueCategorizationStateApi';
import { contactFormsBase, namespace, RootState } from '../../../states';
import { RootState } from '../../../states';
import { toggleSubcategory } from '../../../states/contacts/categories';
import * as existingContactActions from '../../../states/contacts/existingContacts';
import { RecursivePartial } from '../../RecursivePartial';
import { contactFormsBase, namespace } from '../../../states/storeNamespaces';

describe('forExistingCategory', () => {
const MOCK_CONTACT_ID = 'mock contact';
Expand Down
2 changes: 1 addition & 1 deletion plugin-hrm-form/src/___tests__/utils/setUpActions.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@
/* eslint-disable camelcase */
import { ITask, ChatOrchestrator, Manager } from '@twilio/flex-ui';

import { namespace } from '../../states';
import { REMOVE_CONTACT_STATE } from '../../states/types';
import { FeatureFlags } from '../../types/types';
import { afterCompleteTask, excludeDeactivateConversationOrchestration } from '../../utils/setUpActions';
import { namespace } from '../../states/storeNamespaces';

const taskSid = 'THIS IS THE TASK SID!';

Expand Down
2 changes: 1 addition & 1 deletion plugin-hrm-form/src/___tests__/utils/transfer.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ import each from 'jest-each';
import * as TransferHelpers from '../../utils/transfer';
import { transferModes, transferStatuses } from '../../states/DomainConstants';
import { acceptTask, createTask } from '../helpers';
import { conferencingBase, namespace } from '../../states';
import * as callStatus from '../../states/conferencing/callStatus';
import { conferencingBase, namespace } from '../../states/storeNamespaces';

const members = new Map();
members.set('some_40identity', { source: { sid: 'member1' } });
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import debounce from 'lodash/debounce';
import { connect } from 'react-redux';

import CannedResponses from '../../CannedResponses';
import { conversationsBase, namespace, RootState } from '../../../states';
import { RootState } from '../../../states';
import {
MessageSendStatus,
newSendMessageeAsyncAction,
Expand All @@ -41,6 +41,7 @@ import {
ButtonContainer,
SendMessageButton,
} from './styles';
import { conversationsBase, namespace } from '../../../states/storeNamespaces';

/**
* The following CSS attributtes should be set in here
Expand Down
3 changes: 2 additions & 1 deletion plugin-hrm-form/src/components/CSAMReport/CSAMReport.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,14 @@ import { connect, ConnectedProps } from 'react-redux';
import CSAMReportStatusScreen from './CSAMReportStatusScreen';
import CSAMReportCounsellorForm from './CSAMReportCounsellorForm';
import { CenterContent, CSAMReportContainer, CSAMReportLayout } from '../../styles/CSAMReport';
import { configurationBase, namespace, RootState } from '../../states';
import { RootState } from '../../states';
import { CSAMPage, CSAMReportApi } from './csamReportApi';
import * as t from '../../states/contacts/actions';
import { isChildTaskEntry, isCounsellorTaskEntry } from '../../states/csam-report/types';
import CSAMReportTypePickerForm from './CSAMReportTypePicker';
import CSAMReportChildForm from './CSAMReportChildForm';
import { getHrmConfig, getTemplateStrings } from '../../hrmConfig';
import { configurationBase, namespace } from '../../states/storeNamespaces';

type OwnProps = {
api: CSAMReportApi;
Expand Down
3 changes: 2 additions & 1 deletion plugin-hrm-form/src/components/CSAMReport/csamReportApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import { Dispatch } from 'react';

import * as CSAMAction from '../../states/csam-report/actions';
import { csamReportBase, namespace, RootState, routingBase } from '../../states';
import { RootState } from '../../states';
import { changeRoute } from '../../states/routing/actions';
import { AppRoutes } from '../../states/routing/types';
import { CSAMReportEntry } from '../../types/types';
Expand All @@ -34,6 +34,7 @@ import { addExternalReportEntry } from '../../states/csam-report/existingContact
import { acknowledgeCSAMReport, createCSAMReport } from '../../services/CSAMReportService';
import { reportToIWF, selfReportToIWF } from '../../services/ServerlessService';
import { newCSAMReportActionForContact } from '../../states/csam-report/actions';
import { csamReportBase, namespace, routingBase } from '../../states/storeNamespaces';

export enum CSAMPage {
ReportTypePicker = 'report-type-picker',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,10 @@ import { ConferenceNotifications } from '../../../conference/setUpConferenceActi
import { conferenceApi } from '../../../services/ServerlessService';
import PhoneInputDialog from './PhoneInputDialog';
import { StyledConferenceButtonWrapper, StyledConferenceButton } from './styles';
import { conferencingBase, namespace, RootState } from '../../../states';
import { RootState } from '../../../states';
import { setCallStatusAction, setIsDialogOpenAction, setPhoneNumberAction } from '../../../states/conferencing';
import { CallStatus, isCallStatusLoading } from '../../../states/conferencing/callStatus';
import { conferencingBase, namespace } from '../../../states/storeNamespaces';

type Props = TaskContextProps;

Expand Down
Loading

0 comments on commit 92e3208

Please sign in to comment.