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 |
|---|---|---|---|
|
|
|
|
|
|
|
|
|
|
— |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
— |
|
|
|
— |
|
|
|
— |
|
|
|
— |
|
|
|
(empty file) |
|
|
|
|
|
auth
Actions (auth/store/auth.actions.ts):
| Type | Handled by |
|---|---|
|
|
|
|
|
Reducer (persists to |
|
Reducer (sets |
|
Reducer (reset) + |
|
Reducer (reset) |
|
Declared; no reducer case or effect |
Selectors: selectAuthToken, selectLoggedUserModel,
selectLoggedUserLoginKey, isLoggedIn. Helpers: hasCorrectToken,
hasCorrectData.
See authentication.
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 |
|---|---|
|
The verbatim backend message, via |
|
|
|
The |
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.
crm
| Group | Types |
|---|---|
Target |
|
Model |
|
Fetch |
|
Item status |
|
Notes |
|
Tasks |
|
Files |
|
|
|
Sentinel |
|
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 |
|
Periods |
|
Risk / defaults |
|
Notes |
|
Terms |
|
Mode |
|
Lifecycle |
|
Best-tested slice in the repository (calculator.spec.ts). See
advances.
layout
| Group | Types |
|---|---|
Route |
|
CRM panel |
|
Supplier info panel |
|
Chrome |
|
Search engine |
|
Reducer-only, with route-pattern defaults and localStorage['layoutState']
persistence. See UI composition.
utils
| Type | Behaviour |
|---|---|
|
|
|
Reducer writes the attribute and persists the whole slice via |
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 |
Older slices — |
|
Newer slices — |
|
The base type is the request, not the result. |
Selectors in the actions file |
Older slices. |
A dedicated |
|
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.