Store action catalogue

Twelve root slices, declared in src/app/store/app.reducers.ts. Six effect classes, registered in EffectsModule.forRoot([…​]) in src/app/app.module.ts.

NgRx 4.1.1 — actions are classes with a readonly type referencing an exported string constant. See state management for the idioms.

Slice summary

Slice Reducer Effects Location

auth

authReducers

AuthEffects

auth/store/

globalSettings

globalSettingsReducers

GlobalSettingsEffects

manage/global-settings/store/

layout

layoutReducer

—

shared/layout/store/

supplier

supplierReducers

SupplierEffects

suppliers/store/supplier/

crm

crmReducers

CrmEffects

crm-tools/store/

utils

utilsReducers

UtilsEffects

shared/utils/store/

calc

calculatorReducers

—

suppliers/supplier/supplier-advances/pending-offer/pending-offer-calculator/store/

marketplace

marketplacesReducer

—

marketplaces/store/

onboarding

onboardingReducer

—

manage/store/

errors

errorsReducer

—

shared/interceptors/

backgroundReports

backgroundReportsReducer

(empty file)

suppliers/store/background-reports/

underwriting

underwritingReducers

UnderwritingEffects

suppliers/supplier/supplier-underwriting/store/

auth

Actions (auth/store/auth.actions.ts):

Type Handled by

TRY_LOGIN

AuthEffects.authLogin — Basic auth against internalApiUrl auth/login

TRY_LOGIN_GOOGLE

AuthEffects.authLoginGoogle — exchanges the Google credential

LOGIN

Reducer (persists to localStorage['currentUser'])
AuthEffects.login (redirect, dispatch: false)

LOGIN_FAILED

Reducer (sets authError) + AuthEffects.loginFailedCleanup (dispatch: false, clears storage)

LOGOUT

Reducer (reset) + AuthEffects.authLogout (dispatch: false, localStorage.clear() and navigate to /login)

CLEAR_AUTH_STATE

Reducer (reset)

HANDLE_AUTH_REDIRECT

Declared; no reducer case or effect

Selectors: selectAuthToken, selectLoggedUserModel, selectLoggedUserLoginKey, isLoggedIn. Helpers: hasCorrectToken, hasCorrectData.

supplier

~70 action types — the largest slice. Grouped:

Identity and loading

SET_SUPPLIER_KEY, SET_SUPPLIERS_QUERY_STRING, UPDATE_SUPPLIER_MODEL, UPDATE_SUPPLIER_DETAILS_MODEL, FETCH_SUPPLIER_DETAILS, FETCH_SUPPLIER_DETAILS_ERROR, UNLOAD_SUPPLIER, UPDATE_SUPPLIER_DETAILS_MODEL_BY_EVA.

Marketplaces

FETCH_SUPPLIER_MARKETPLACES, …_ERROR, FETCH_SUPPLIER_MARKETPLACE, …_SUCCESS, …_ERROR, FETCH_SUPPLIER_MARKETPLACE_DETAILS_PART, …_ERROR, ADD_PAYMENT_GATEWAY.

Partial editing

UPDATE_MODEL_PART, UPDATE_MODEL_PART_SUCCESS, UPDATE_MODEL_PART_ERROR, UPDATE_MODEL_PART_MAPS.

Payment configs

FETCH_SUPPLIER_PAYMENT_CONFIGS, …_ERROR, CREATE_SUPPLIER_PAYMENT_CONFIGS, …_SUCCESS, …_ERROR, UDPATE_SUPPLIER_PAYMENT_CONFIGS (sic), UPDATE_SUPPLIER_PAYMENT_CONFIGS_SUCCESS, …_ERROR, DELETE_SUPPLIER_PAYMENT_CONFIGS, …_SUCCESS, …_ERROR, PC_RESPONSE_SUCCESS, PC_RESPONSE_ERROR, PC_CLEAR_STATUS.

Lifecycle toggles

TOGGLE_HIDE_SUPPLIER, …_SUCCESS, …_ERROR, TOGGLE_SUSPEND_SUPPLIER, …_SUCCESS, …_ERROR, TOGGLE_LOCK_SUPPLIER, …_SUCCESS, …_ERROR (no reducer cases).

Opt-in periods

ADD_OPT_IN_ROW, …_SUCCESS, …_ERROR, ADD_OPT_IN_ROW_CLEAR, DELETE_OPT_IN_ROW, …_SUCCESS, …_ERROR.

Compliance and cards

FETCH_COMPLIANCE_ACTIONS_WITH_FILES, …_ERROR, REQUEST_EFS_CARD, FETCH_CARD_PROVIDERS, …_SUCCESS, …_ERROR, FETCH_SUPPLIER_CARDS, …_SUCCESS, …_ERROR, FETCH_AIRWALLEX_STATUS, …_SUCCESS, …_ERROR, REGISTER_AIRWALLEX_CARDHOLDER, …_SUCCESS, …_ERROR, ISSUE_AIRWALLEX_CARD, …_SUCCESS, …_ERROR.

IssueAirwallexCard carries { supplierKey, formFactor, recipientAddress?, expediteCard? } — the last two are the shipping details for a physical card. See cards.

RegisterAirwallexCardholder carries { supplierKey, loginKey, overwriteMissingDocuments? }. The last one asks the backend to submit the supplier without the compliance documents it has not uploaded yet; the reducer records it in airwallexOverrideRequested so a failed override is never offered again. See submitting with the minimum documents.

Both …_ERROR actions keep the backend message: REGISTER_AIRWALLEX_CARDHOLDER_ERROR stores it in airwallexCardholderBlock and ISSUE_AIRWALLEX_CARD_ERROR in airwallexCardError, both via extractAirwallexError. See surfacing Airwallex failures.

airwallexCardholderBlock is an AirwallexSubmitBlock, built by resolveCardholderBlock from the 400 body:

Field Meaning

message

The verbatim backend message, via extractAirwallexError.

overridable

true only when the body carried can_overwrite: true and the failed request was not already an override. Drives whether the panel offers a resubmit.

missingDocuments

The missing_documents codes the backend named, filtered to non-empty strings; [] when it named none or sent a non-array.

Selectors

selectSupplier, selectSupplierModel, selectLastQueryString, selectSupplierDetails, selectSupplierDetailsError, selectFundingParticulars, selectEfsCardRequested, selectPaymentMethods, selectSupplierBalance, selectSupplierDetailsAndFunding, selectModelPartSaved, selectModelPartErrors, selectSupplierMarketplaces, selectSupplierMarketplacesList, selectSupplierMarketplacesFundings, selectSupplierMarketplacesOptInPeriods, selectSupplierMarketplacesMinFeeOverrides, selectAddOptInProggress (sic), selectAddOptInError, selectCompleteKycDocuments, selectPendingPCStates, selectAvailableCardProviders, selectSupplierCards, selectAirwallexStatus, selectLoadingAirwallexStatus, selectRegisteringAirwallex, selectIssuingAirwallexCard, selectAirwallexCardError, selectAirwallexCardholderError, selectAirwallexCardholderBlock.

Effects

SupplierEffects handles ROUTER_NAVIGATION (fanning out three actions), the aggregate forkJoin, marketplaces, payment configs, compliance, lifecycle toggles, card providers and the Airwallex flows.

See suppliers and cards.

crm

Group Types

Target

SET_TARGET_UUID

Model

ADD_CRM_MODEL, UPDATE_CRM_MODEL, DELETE_CRM_MODEL, CRM_CLEAR_CURRENT_STATE

Fetch

FETCH_CRM_ALL, FETCH_CRM_NOTES, FETCH_CRM_FILES, FETCH_CRM_TASKS, FETCH_CRM_EVENTS, FETCH_CRM_EMAILS, FETCH_CRM_BATCH_EMAILS, FETCH_CRM_PINNED_NOTES, FETCH_CRM_DATA_ERROR

Item status

CRM_ITEM_REQUEST, CRM_ITEM_RESPONSE_SUCCESS, CRM_ITEM_RESPONSE_ERROR, CRM_ITEM_CLEAR_STATUS

Notes

ADD_CRM_NOTE, EDIT_CRM_NOTE, PIN_CRM_NOTE, DELETE_CRM_NOTE

Tasks

ADD_CRM_TASK, EDIT_CRM_TASK, DELETE_CRM_TASK, CRM_BEFORE_TASK_SAVE, CRM_AFTER_TASK_SAVE

Files

ADD_CRM_FILE, DELETE_CRM_FILE

Email

SEND_SINGLE_EMAIL

Sentinel

NO_ACTION

Selectors: selectCrmTargetUuid, selectCrmStateModel, selectCrmItems, selectPendingCrmStates, plus one per stream generated by createTimelineStreamSelector — selectCrmAll, selectCrmNotes, selectCrmFiles, selectCrmTasks, selectCrmEvents, selectCrmEmails, selectCrmBatchEmails, selectCrmPinnedNotes.

CrmEffects also broadcasts TASK_COUNTERS_UPDATE and CRM_OPEN_ALL_TAB on the TableEventsService bus. See CRM.

calc (advance calculator)

A map-of-handlers reducer rather than a switch — add an action with calculatorMap.set(TYPE, handler).

Group Types

Amounts

SET_APPROVED_AMOUNT, SET_NET_DELIVERY_AMOUNT, SET_REQUESTED_AMOUNT, SET_RESERVE_FOR_REPAYMENTS

Periods

SET_FEE, SET_PERIOD_LENGTH, ADD_PERIOD, REMOVE_PERIOD

Risk / defaults

SET_UNDERWRITING_RISK_RATING, SET_DEFAULT_PROGRESSIVE_ADVANCE_SETTINGS, SET_ELIGIBILITY_DATA

Notes

SET_REQUEST_NOTES, SET_UNDERWRITING_NOTES

Terms

SET_GRACE_PERIOD_END_DATE, SET_GRACE_PERIOD_SAVED_END_DATE, SET_NO_REBATE, SET_NO_REBATE_SAVED, SET_RETURN_STRATEGY, SET_RETURN_STRATEGY_SAVED, SET_FORCE_FULL, SET_FORCE_FULL_SAVED, SET_EXPECTED_MONTHLY_EARNINGS, SET_EXPECTED_DURATION

Mode

SET_TO_READONLY, SET_TO_EDITABLE, SET_NEW_OFFER, SET_UW_STATUS

Lifecycle

SET_STATE_FROM_PERSISTED_DATA, CALCULATOR_RESET, CALCULATOR_HARD_RESET (preserves defaultProgressiveAdvanceSettings)

Best-tested slice in the repository (calculator.spec.ts). See advances.

layout

Group Types

Route

LAYOUT_UPDATE — dispatched by AppComponent on NavigationEnd

CRM panel

CRM_PANEL_OPEN, CRM_PANEL_CLOSE, CRM_PANEL_FIX, CRM_PANEL_HIDE

Supplier info panel

SUPPLIER_INFO_OPEN, SUPPLIER_INFO_CLOSE, SUPPLIER_INFO_HIDE

Chrome

SEARCH_BUTTON_SHOW, SEARCH_BUTTON_HIDE, ACTIONS_SHOW, ACTIONS_HIDE

Search engine

CHOOSE_NEW_SEARCH, CHOOSE_OLD_SEARCH

Reducer-only, with route-pattern defaults and localStorage['layoutState'] persistence. See UI composition.

utils

Type Behaviour

FETCH_UTIL_ATTR

UtilsEffects.fetchUtilAttribute — dispatches only if not already loaded, or when payload.refresh is set

SET_UTIL_ATTR

Reducer writes the attribute and persists the whole slice via lscache (24 h)

Attribute → service-method map in the effect: timezones → getTimezones, fundingPeriods → getFundingPeriods, usStates → getUSStates, businessTypes → getUSStates (appears to be a copy-paste bug), countries → getCountries.

Selectors generated per attribute: selectTimezones, selectFundingPeriods, selectUsStates, selectCountries.

globalSettings

Uses a prefixed enum rather than bare constants:

export enum GLOBAL_SETTINGS_ACTION {
  FETCH_ALL         = '[GLOBAL SETTINGS] Fetch All',
  FETCH_ALL_SUCCESS = '[GLOBAL SETTINGS] Fetch All Success',
  UPDATE_CONFIG     = '[GLOBAL SETTINGS] Update Config',
}

Selectors: selectConfigs, selectLoading (in a dedicated global-settings.selectors.ts). GlobalSettingsService is a facade over this slice — call the service, not the slice. See manage.

underwriting

export enum UNDERWRITING_ACTION {
  FETCH_TOOLS         = '[UNDERWRITING] Fetch Tools',
  FETCH_TOOLS_SUCCESS = '[UNDERWRITING] Fetch Tools Success',
  FETCH_TOOLS_FAILED  = '[UNDERWRITING] Fetch Tools Failed',
}

State: { toolsLoaded: boolean, tools: UwToolEntity[] }. Selector: selectUwTools (returns null unless loaded and non-empty). Handled by UnderwritingEffects. See underwriting.

marketplace

Single action SET_POSSIBLE_GATEWAYS; state { possiblePaymentGateways: IPaymentGateway[] }. Map-of-handlers reducer, no effects. See marketplaces.

onboarding

Single action RESET_ALL_FORMS. Map-of-handlers reducer, no effects. See onboarding.

backgroundReports

Single action SET_SUPPLIER_BACKGROUND_REPORT. Reducer registered; the effects file exists but is empty. See background reports.

errors (fetched requests)

Single action FETCH_REQUEST, dispatched by FetchedRequestsInterceptor on every HTTP request. State { cachedRequests: any[] }, capped at REQUESTS_AMOUNT = 50, serialised with JSON.stringify. Debugging aid; visible in Redux DevTools and included in `ErrorLogger’s store dump. See error handling.

Naming conventions

Convention Where

Bare SCREAMING_SNAKE constants

Older slices — auth, supplier, crm, layout, utils, calc, marketplace, onboarding, errors, backgroundReports.

'[FEATURE] Title Case' enum members

Newer slices — globalSettings, underwriting.

X / X_SUCCESS / X_ERROR

The base type is the request, not the result.

Selectors in the actions file

Older slices.

A dedicated *.selectors.ts

globalSettings, underwriting.

Known misspellings that are load-bearing (they are the wire/constant values): UDPATE_SUPPLIER_PAYMENT_CONFIGS, selectAddOptInProggress.

Router integration

StoreRouterConnectingModule emits ROUTER_NAVIGATION. One consumer: SupplierEffects.navigateToSupplier, which walks the activated-route tree for a supplierKey parameter and dispatches SET_SUPPLIER_KEY, SET_TARGET_UUID and FETCH_SUPPLIER_DETAILS.

A meta-reducer, storeDebugger, is registered in StoreModule.forRoot but disabled by a source-level constant.

Mock reducers

For specs: auth-mock.reducers.ts, crm-mock.reducers.ts, supplier-mock.reducers.ts, utils-mock.reducets.ts (sic), marketplace.reducer.mock.ts. See testing.