@zeniai/client-epic-state 5.0.65-betaML2 → 5.0.65-betaRR2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/common/aiCfo/aiCfoSuggestedQuestionsPageContext.d.ts +1 -1
- package/lib/entity/aiCfo/aiCfoPayload.d.ts +168 -1
- package/lib/entity/aiCfo/aiCfoReducer.js +186 -2
- package/lib/entity/aiCfo/aiCfoState.d.ts +164 -4
- package/lib/entity/aiCfo/aiCfoState.js +10 -1
- package/lib/entity/cardPolicy/cardPolicyPayload.d.ts +171 -0
- package/lib/entity/cardPolicy/cardPolicyPayload.js +112 -0
- package/lib/entity/cardPolicy/cardPolicyReducer.d.ts +13 -0
- package/lib/entity/cardPolicy/cardPolicyReducer.js +203 -0
- package/lib/entity/cardPolicy/cardPolicySelector.d.ts +28 -0
- package/lib/entity/cardPolicy/cardPolicySelector.js +86 -0
- package/lib/entity/cardPolicy/cardPolicyState.d.ts +162 -0
- package/lib/entity/cardPolicy/cardPolicyState.js +14 -0
- package/lib/entity/cardPolicy/extractPolicyDocumentEpic.d.ts +18 -0
- package/lib/entity/cardPolicy/extractPolicyDocumentEpic.js +54 -0
- package/lib/entity/cardPolicy/fetchCardPolicyVendorOptionsEpic.d.ts +26 -0
- package/lib/entity/cardPolicy/fetchCardPolicyVendorOptionsEpic.js +47 -0
- package/lib/entity/jeSchedules/jeSchedulesTypes.d.ts +1 -1
- package/lib/entity/monthEndCloseChecks/monthEndCloseChecksState.d.ts +1 -1
- package/lib/entity/tenant/clearAllEpic.d.ts +6 -2
- package/lib/entity/tenant/clearAllEpic.js +8 -0
- package/lib/epic.d.ts +9 -2
- package/lib/epic.js +9 -2
- package/lib/esm/entity/aiCfo/aiCfoReducer.js +187 -3
- package/lib/esm/entity/aiCfo/aiCfoState.js +7 -0
- package/lib/esm/entity/cardPolicy/cardPolicyPayload.js +101 -0
- package/lib/esm/entity/cardPolicy/cardPolicyReducer.js +199 -0
- package/lib/esm/entity/cardPolicy/cardPolicySelector.js +66 -0
- package/lib/esm/entity/cardPolicy/cardPolicyState.js +9 -0
- package/lib/esm/entity/cardPolicy/extractPolicyDocumentEpic.js +50 -0
- package/lib/esm/entity/cardPolicy/fetchCardPolicyVendorOptionsEpic.js +43 -0
- package/lib/esm/entity/tenant/clearAllEpic.js +8 -0
- package/lib/esm/epic.js +9 -2
- package/lib/esm/index.js +21 -7
- package/lib/esm/reducer.js +12 -0
- package/lib/esm/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.js +1 -21
- package/lib/esm/view/expenseAutomationView/reducers/transactionsViewReducer.js +14 -117
- package/lib/esm/view/expenseAutomationView/selectors/transactionCategorizationSelector.js +0 -28
- package/lib/esm/view/recommendation/recommendationHelper.js +0 -29
- package/lib/esm/view/recommendation/recommendationReducer.js +1 -36
- package/lib/esm/view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/cardPolicyDetailReducer.js +70 -0
- package/lib/esm/view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/cardPolicyDetailSelector.js +22 -0
- package/lib/esm/view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/cardPolicyDetailState.js +1 -0
- package/lib/esm/view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/fetchCardPolicyDetailEpic.js +44 -0
- package/lib/esm/view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/updateCardPolicyEpic.js +49 -0
- package/lib/esm/view/spendManagement/chargeCards/cardPolicy/cardPolicyList/archiveCardPolicyEpic.js +42 -0
- package/lib/esm/view/spendManagement/chargeCards/cardPolicy/cardPolicyList/cardPolicyListReducer.js +72 -0
- package/lib/esm/view/spendManagement/chargeCards/cardPolicy/cardPolicyList/cardPolicyListSelector.js +21 -0
- package/lib/esm/view/spendManagement/chargeCards/cardPolicy/cardPolicyList/cardPolicyListState.js +1 -0
- package/lib/esm/view/spendManagement/chargeCards/cardPolicy/cardPolicyList/fetchCardPolicyListEpic.js +46 -0
- package/lib/esm/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/createCardPolicyReducer.js +50 -0
- package/lib/esm/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/createCardPolicySelector.js +6 -0
- package/lib/esm/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/createCardPolicyState.js +1 -0
- package/lib/esm/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/createCardPolicyTemplateEpic.js +34 -0
- package/lib/esm/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/fetchCardPolicyMccCategoriesEpic.js +17 -0
- package/lib/esm/view/transactionDetail/transactionDetailReducer.js +1 -110
- package/lib/esm/view/transactionDetail/transactionDetailSelector.js +0 -22
- package/lib/index.d.ts +20 -8
- package/lib/index.js +119 -35
- package/lib/reducer.d.ts +12 -0
- package/lib/reducer.js +12 -0
- package/lib/view/companyHealthMetricView/companyHealthMetricViewSelector.d.ts +1 -1
- package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.d.ts +0 -1
- package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.js +2 -23
- package/lib/view/expenseAutomationView/reducers/transactionsViewReducer.d.ts +1 -14
- package/lib/view/expenseAutomationView/reducers/transactionsViewReducer.js +14 -117
- package/lib/view/expenseAutomationView/selectorTypes/transactionsViewSelectorTypes.d.ts +0 -2
- package/lib/view/expenseAutomationView/selectors/transactionCategorizationSelector.d.ts +0 -3
- package/lib/view/expenseAutomationView/selectors/transactionCategorizationSelector.js +0 -29
- package/lib/view/expenseAutomationView/types/jeSchedulesViewState.d.ts +1 -1
- package/lib/view/expenseAutomationView/types/missingReceiptsViewState.d.ts +2 -2
- package/lib/view/expenseAutomationView/types/transactionsViewState.d.ts +1 -2
- package/lib/view/onboardingView/cockpitView/types/onboardingCockpitViewTypes.d.ts +1 -1
- package/lib/view/people/peopleTypes.d.ts +1 -1
- package/lib/view/recommendation/recommendationHelper.d.ts +0 -9
- package/lib/view/recommendation/recommendationHelper.js +1 -31
- package/lib/view/recommendation/recommendationReducer.d.ts +1 -18
- package/lib/view/recommendation/recommendationReducer.js +2 -37
- package/lib/view/scheduleView/scheduleListView/scheduleListTypes.d.ts +1 -1
- package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/cardPolicyDetailReducer.d.ts +14 -0
- package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/cardPolicyDetailReducer.js +74 -0
- package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/cardPolicyDetailSelector.d.ts +21 -0
- package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/cardPolicyDetailSelector.js +28 -0
- package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/cardPolicyDetailState.d.ts +25 -0
- package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/cardPolicyDetailState.js +2 -0
- package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/fetchCardPolicyDetailEpic.d.ts +19 -0
- package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/fetchCardPolicyDetailEpic.js +48 -0
- package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/updateCardPolicyEpic.d.ts +18 -0
- package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/updateCardPolicyEpic.js +53 -0
- package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyList/archiveCardPolicyEpic.d.ts +16 -0
- package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyList/archiveCardPolicyEpic.js +46 -0
- package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyList/cardPolicyListReducer.d.ts +15 -0
- package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyList/cardPolicyListReducer.js +76 -0
- package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyList/cardPolicyListSelector.d.ts +21 -0
- package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyList/cardPolicyListSelector.js +27 -0
- package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyList/cardPolicyListState.d.ts +19 -0
- package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyList/cardPolicyListState.js +2 -0
- package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyList/fetchCardPolicyListEpic.d.ts +19 -0
- package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyList/fetchCardPolicyListEpic.js +50 -0
- package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/createCardPolicyReducer.d.ts +12 -0
- package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/createCardPolicyReducer.js +54 -0
- package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/createCardPolicySelector.d.ts +4 -0
- package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/createCardPolicySelector.js +10 -0
- package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/createCardPolicyState.d.ts +15 -0
- package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/createCardPolicyState.js +2 -0
- package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/createCardPolicyTemplateEpic.d.ts +8 -0
- package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/createCardPolicyTemplateEpic.js +38 -0
- package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/fetchCardPolicyMccCategoriesEpic.d.ts +15 -0
- package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/fetchCardPolicyMccCategoriesEpic.js +21 -0
- package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardList.d.ts +1 -1
- package/lib/view/taskManager/taskListView/taskListReducer.d.ts +1 -1
- package/lib/view/transactionDetail/transactionDetailReducer.d.ts +1 -11
- package/lib/view/transactionDetail/transactionDetailReducer.js +2 -111
- package/lib/view/transactionDetail/transactionDetailSelector.d.ts +0 -2
- package/lib/view/transactionDetail/transactionDetailSelector.js +1 -24
- package/lib/view/transactionDetail/transactionDetailTypes.d.ts +0 -1
- package/package.json +1 -1
- package/lib/esm/view/recommendation/fetchEntityRecommendationsForLineUpdateEpic.js +0 -88
- package/lib/tsconfig.typecheck.tsbuildinfo +0 -1
- package/lib/view/recommendation/fetchEntityRecommendationsForLineUpdateEpic.d.ts +0 -9
- package/lib/view/recommendation/fetchEntityRecommendationsForLineUpdateEpic.js +0 -92
package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyList/fetchCardPolicyListEpic.d.ts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { ActionsObservable, StateObservable } from 'redux-observable';
|
|
2
|
+
import { Observable } from 'rxjs';
|
|
3
|
+
import { updateCardPolicyStats, updateCardPolicyTemplates } from '../../../../../entity/cardPolicy/cardPolicyReducer';
|
|
4
|
+
import { RootState } from '../../../../../reducer';
|
|
5
|
+
import { ZeniAPI } from '../../../../../zeniAPI';
|
|
6
|
+
import { fetchCardPolicyList, updateCardPolicyListFetchStatus } from './cardPolicyListReducer';
|
|
7
|
+
export type ActionType = ReturnType<typeof fetchCardPolicyList> | ReturnType<typeof updateCardPolicyTemplates> | ReturnType<typeof updateCardPolicyStats> | ReturnType<typeof updateCardPolicyListFetchStatus>;
|
|
8
|
+
/**
|
|
9
|
+
* `GET /cards/1.0/policy-templates`. On success the response carries
|
|
10
|
+
* both the tenant-wide `stats` block and a `templates[]` array whose
|
|
11
|
+
* rows are wrapped in `{data: {cards_applied, template}}` (the same
|
|
12
|
+
* envelope the create endpoint returns). We split the result into
|
|
13
|
+
* three actions:
|
|
14
|
+
*
|
|
15
|
+
* 1. `updateCardPolicyTemplates` — full replace of the entity map.
|
|
16
|
+
* 2. `updateCardPolicyStats` — entity-level cached stats.
|
|
17
|
+
* 3. `updateCardPolicyListFetchStatus` — view lifecycle + ordered IDs.
|
|
18
|
+
*/
|
|
19
|
+
export declare const fetchCardPolicyListEpic: (actions$: ActionsObservable<ActionType>, _state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
|
package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyList/fetchCardPolicyListEpic.js
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.fetchCardPolicyListEpic = void 0;
|
|
4
|
+
const rxjs_1 = require("rxjs");
|
|
5
|
+
const operators_1 = require("rxjs/operators");
|
|
6
|
+
const cardPolicyPayload_1 = require("../../../../../entity/cardPolicy/cardPolicyPayload");
|
|
7
|
+
const cardPolicyReducer_1 = require("../../../../../entity/cardPolicy/cardPolicyReducer");
|
|
8
|
+
const responsePayload_1 = require("../../../../../responsePayload");
|
|
9
|
+
const cardPolicyListReducer_1 = require("./cardPolicyListReducer");
|
|
10
|
+
/**
|
|
11
|
+
* `GET /cards/1.0/policy-templates`. On success the response carries
|
|
12
|
+
* both the tenant-wide `stats` block and a `templates[]` array whose
|
|
13
|
+
* rows are wrapped in `{data: {cards_applied, template}}` (the same
|
|
14
|
+
* envelope the create endpoint returns). We split the result into
|
|
15
|
+
* three actions:
|
|
16
|
+
*
|
|
17
|
+
* 1. `updateCardPolicyTemplates` — full replace of the entity map.
|
|
18
|
+
* 2. `updateCardPolicyStats` — entity-level cached stats.
|
|
19
|
+
* 3. `updateCardPolicyListFetchStatus` — view lifecycle + ordered IDs.
|
|
20
|
+
*/
|
|
21
|
+
const fetchCardPolicyListEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(cardPolicyListReducer_1.fetchCardPolicyList.match), (0, operators_1.mergeMap)(() => {
|
|
22
|
+
return zeniAPI
|
|
23
|
+
.getJSON(`${zeniAPI.apiEndPoints.cardMicroServiceBaseUrl}/1.0/policy-templates`)
|
|
24
|
+
.pipe((0, operators_1.mergeMap)((response) => {
|
|
25
|
+
if ((0, responsePayload_1.isSuccessStatus)(response) && response.data != null) {
|
|
26
|
+
const templates = (0, cardPolicyPayload_1.toCardPolicyTemplateList)(response.data);
|
|
27
|
+
const stats = (0, cardPolicyPayload_1.toCardPolicyStats)(response.data.stats);
|
|
28
|
+
const actions = [
|
|
29
|
+
(0, cardPolicyReducer_1.updateCardPolicyTemplates)(templates),
|
|
30
|
+
(0, cardPolicyReducer_1.updateCardPolicyStats)(stats),
|
|
31
|
+
(0, cardPolicyListReducer_1.updateCardPolicyListFetchStatus)({
|
|
32
|
+
fetchState: 'Completed',
|
|
33
|
+
templateIds: templates.map((t) => t.templateId),
|
|
34
|
+
}),
|
|
35
|
+
];
|
|
36
|
+
return (0, rxjs_1.from)(actions);
|
|
37
|
+
}
|
|
38
|
+
else {
|
|
39
|
+
return (0, rxjs_1.of)((0, cardPolicyListReducer_1.updateCardPolicyListFetchStatus)({
|
|
40
|
+
fetchState: 'Error',
|
|
41
|
+
error: response.status,
|
|
42
|
+
}));
|
|
43
|
+
}
|
|
44
|
+
}), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, cardPolicyListReducer_1.updateCardPolicyListFetchStatus)({
|
|
45
|
+
fetchState: 'Error',
|
|
46
|
+
error: (0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Fetch card-policy list REST API call errored out' +
|
|
47
|
+
JSON.stringify(error)),
|
|
48
|
+
}))));
|
|
49
|
+
}));
|
|
50
|
+
exports.fetchCardPolicyListEpic = fetchCardPolicyListEpic;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { FetchState, ID } from '../../../../../commonStateTypes/common';
|
|
2
|
+
import { CreateCardPolicyTemplateRequest } from '../../../../../entity/cardPolicy/cardPolicyPayload';
|
|
3
|
+
import { ZeniAPIStatus } from '../../../../../responsePayload';
|
|
4
|
+
import { CreateCardPolicyState } from './createCardPolicyState';
|
|
5
|
+
export declare const initialState: CreateCardPolicyState;
|
|
6
|
+
export declare const createCardPolicyTemplate: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[request: CreateCardPolicyTemplateRequest], CreateCardPolicyTemplateRequest, "createCardPolicy/createCardPolicyTemplate", never, never>, updateCreateCardPolicyTemplateRequestState: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
7
|
+
fetchState: FetchState;
|
|
8
|
+
error?: ZeniAPIStatus;
|
|
9
|
+
templateId?: ID;
|
|
10
|
+
}, "createCardPolicy/updateCreateCardPolicyTemplateRequestState">, clearCreateCardPolicy: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"createCardPolicy/clearCreateCardPolicy">;
|
|
11
|
+
declare const _default: import("redux").Reducer<CreateCardPolicyState>;
|
|
12
|
+
export default _default;
|
package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/createCardPolicyReducer.js
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var _a;
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.clearCreateCardPolicy = exports.updateCreateCardPolicyTemplateRequestState = exports.createCardPolicyTemplate = exports.initialState = void 0;
|
|
5
|
+
const toolkit_1 = require("@reduxjs/toolkit");
|
|
6
|
+
exports.initialState = {
|
|
7
|
+
createCardPolicyTemplateRequestState: {
|
|
8
|
+
fetchState: 'Not-Started',
|
|
9
|
+
error: undefined,
|
|
10
|
+
},
|
|
11
|
+
lastCreatedCardPolicyTemplateId: undefined,
|
|
12
|
+
};
|
|
13
|
+
const createCardPolicy = (0, toolkit_1.createSlice)({
|
|
14
|
+
name: 'createCardPolicy',
|
|
15
|
+
initialState: exports.initialState,
|
|
16
|
+
reducers: {
|
|
17
|
+
/**
|
|
18
|
+
* Kick off the `POST /cards/1.0/policy-templates` request. Setting
|
|
19
|
+
* the request state to `In-Progress` synchronously here matches how
|
|
20
|
+
* every other "create" slice in this repo wires its kickoff
|
|
21
|
+
* (see `issueChargeCards`, `fetchChargeCardConfig`, etc.).
|
|
22
|
+
*
|
|
23
|
+
* The accompanying epic listens for this action, performs the POST,
|
|
24
|
+
* dispatches `updateCreatedCardPolicyTemplate` on the entity slice,
|
|
25
|
+
* and dispatches `updateCreateCardPolicyTemplateRequestState` here to
|
|
26
|
+
* flip the lifecycle to `Completed` or `Error`.
|
|
27
|
+
*/
|
|
28
|
+
createCardPolicyTemplate: {
|
|
29
|
+
reducer(draft,
|
|
30
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
31
|
+
_action) {
|
|
32
|
+
draft.createCardPolicyTemplateRequestState.fetchState = 'In-Progress';
|
|
33
|
+
draft.createCardPolicyTemplateRequestState.error = undefined;
|
|
34
|
+
draft.lastCreatedCardPolicyTemplateId = undefined;
|
|
35
|
+
},
|
|
36
|
+
prepare(request) {
|
|
37
|
+
return { payload: request };
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
updateCreateCardPolicyTemplateRequestState(draft, action) {
|
|
41
|
+
draft.createCardPolicyTemplateRequestState.fetchState =
|
|
42
|
+
action.payload.fetchState;
|
|
43
|
+
draft.createCardPolicyTemplateRequestState.error = action.payload.error;
|
|
44
|
+
if (action.payload.templateId != null) {
|
|
45
|
+
draft.lastCreatedCardPolicyTemplateId = action.payload.templateId;
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
clearCreateCardPolicy(draft) {
|
|
49
|
+
Object.assign(draft, exports.initialState);
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
});
|
|
53
|
+
_a = createCardPolicy.actions, exports.createCardPolicyTemplate = _a.createCardPolicyTemplate, exports.updateCreateCardPolicyTemplateRequestState = _a.updateCreateCardPolicyTemplateRequestState, exports.clearCreateCardPolicy = _a.clearCreateCardPolicy;
|
|
54
|
+
exports.default = createCardPolicy.reducer;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { FetchStateAndError, ID } from '../../../../../commonStateTypes/common';
|
|
2
|
+
import { CreateCardPolicyState } from './createCardPolicyState';
|
|
3
|
+
export declare function getCreateCardPolicyTemplateRequestState(state: CreateCardPolicyState): FetchStateAndError;
|
|
4
|
+
export declare function getLastCreatedCardPolicyTemplateId(state: CreateCardPolicyState): ID | undefined;
|
package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/createCardPolicySelector.js
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getCreateCardPolicyTemplateRequestState = getCreateCardPolicyTemplateRequestState;
|
|
4
|
+
exports.getLastCreatedCardPolicyTemplateId = getLastCreatedCardPolicyTemplateId;
|
|
5
|
+
function getCreateCardPolicyTemplateRequestState(state) {
|
|
6
|
+
return state.createCardPolicyTemplateRequestState;
|
|
7
|
+
}
|
|
8
|
+
function getLastCreatedCardPolicyTemplateId(state) {
|
|
9
|
+
return state.lastCreatedCardPolicyTemplateId;
|
|
10
|
+
}
|
package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/createCardPolicyState.d.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { FetchStateAndError, ID } from '../../../../../commonStateTypes/common';
|
|
2
|
+
/**
|
|
3
|
+
* View-side scaffolding for the manual Card Policy "create" flow.
|
|
4
|
+
*
|
|
5
|
+
* Mirrors `issueChargeCard` in spirit — kicks off a one-shot POST and
|
|
6
|
+
* tracks the request lifecycle. List + edit lifecycles live in sibling
|
|
7
|
+
* slices (`cardPolicyList`, `cardPolicyDetail`); MCC categories used by
|
|
8
|
+
* the create form live on the entity slice (shared with the AI-CFO flow)
|
|
9
|
+
* and are fetched via the co-located `fetchCardPolicyMccCategoriesEpic`.
|
|
10
|
+
*/
|
|
11
|
+
export interface CreateCardPolicyState {
|
|
12
|
+
createCardPolicyTemplateRequestState: FetchStateAndError;
|
|
13
|
+
/** `templateId` of the most recently created template — populated on success. */
|
|
14
|
+
lastCreatedCardPolicyTemplateId?: ID;
|
|
15
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ActionsObservable, StateObservable } from 'redux-observable';
|
|
2
|
+
import { Observable } from 'rxjs';
|
|
3
|
+
import { updateCreatedCardPolicyTemplate } from '../../../../../entity/cardPolicy/cardPolicyReducer';
|
|
4
|
+
import { RootState } from '../../../../../reducer';
|
|
5
|
+
import { ZeniAPI } from '../../../../../zeniAPI';
|
|
6
|
+
import { createCardPolicyTemplate, updateCreateCardPolicyTemplateRequestState } from './createCardPolicyReducer';
|
|
7
|
+
export type ActionType = ReturnType<typeof createCardPolicyTemplate> | ReturnType<typeof updateCreatedCardPolicyTemplate> | ReturnType<typeof updateCreateCardPolicyTemplateRequestState>;
|
|
8
|
+
export declare const createCardPolicyTemplateEpic: (actions$: ActionsObservable<ActionType>, _state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createCardPolicyTemplateEpic = void 0;
|
|
4
|
+
const rxjs_1 = require("rxjs");
|
|
5
|
+
const operators_1 = require("rxjs/operators");
|
|
6
|
+
const cardPolicyReducer_1 = require("../../../../../entity/cardPolicy/cardPolicyReducer");
|
|
7
|
+
const cardPolicyPayload_1 = require("../../../../../entity/cardPolicy/cardPolicyPayload");
|
|
8
|
+
const responsePayload_1 = require("../../../../../responsePayload");
|
|
9
|
+
const createCardPolicyReducer_1 = require("./createCardPolicyReducer");
|
|
10
|
+
const createCardPolicyTemplateEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(createCardPolicyReducer_1.createCardPolicyTemplate.match), (0, operators_1.mergeMap)((action) => {
|
|
11
|
+
const body = (0, cardPolicyPayload_1.toCreateCardPolicyTemplateRequestBody)(action.payload);
|
|
12
|
+
return zeniAPI
|
|
13
|
+
.postAndGetJSON(`${zeniAPI.apiEndPoints.cardMicroServiceBaseUrl}/1.0/policy-templates`, body)
|
|
14
|
+
.pipe((0, operators_1.mergeMap)((response) => {
|
|
15
|
+
if ((0, responsePayload_1.isSuccessStatus)(response) && response.data != null) {
|
|
16
|
+
const { template } = response.data;
|
|
17
|
+
const actions = [
|
|
18
|
+
(0, cardPolicyReducer_1.updateCreatedCardPolicyTemplate)(template),
|
|
19
|
+
(0, createCardPolicyReducer_1.updateCreateCardPolicyTemplateRequestState)({
|
|
20
|
+
fetchState: 'Completed',
|
|
21
|
+
templateId: template.template_id,
|
|
22
|
+
}),
|
|
23
|
+
];
|
|
24
|
+
return (0, rxjs_1.from)(actions);
|
|
25
|
+
}
|
|
26
|
+
else {
|
|
27
|
+
return (0, rxjs_1.of)((0, createCardPolicyReducer_1.updateCreateCardPolicyTemplateRequestState)({
|
|
28
|
+
fetchState: 'Error',
|
|
29
|
+
error: response.status,
|
|
30
|
+
}));
|
|
31
|
+
}
|
|
32
|
+
}), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, createCardPolicyReducer_1.updateCreateCardPolicyTemplateRequestState)({
|
|
33
|
+
fetchState: 'Error',
|
|
34
|
+
error: (0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Create card-policy template REST API call errored out' +
|
|
35
|
+
JSON.stringify(error)),
|
|
36
|
+
}))));
|
|
37
|
+
}));
|
|
38
|
+
exports.createCardPolicyTemplateEpic = createCardPolicyTemplateEpic;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ActionsObservable, StateObservable } from 'redux-observable';
|
|
2
|
+
import { Observable } from 'rxjs';
|
|
3
|
+
import { fetchCardPolicyMccCategories, updateCardPolicyMccCategories, updateCardPolicyMccCategoriesFailure } from '../../../../../entity/cardPolicy/cardPolicyReducer';
|
|
4
|
+
import { RootState } from '../../../../../reducer';
|
|
5
|
+
import { ZeniAPI } from '../../../../../zeniAPI';
|
|
6
|
+
/**
|
|
7
|
+
* MCC categories are reference data shared between the manual create
|
|
8
|
+
* flow and the AI-CFO `card_policy` form. The slice fields live on the
|
|
9
|
+
* `entity/cardPolicy` slice (so any consumer can read them without
|
|
10
|
+
* re-fetching); only the fetch lifecycle lives in `createCardPolicy/`
|
|
11
|
+
* because the manual create page is currently the only producer of the
|
|
12
|
+
* `fetchCardPolicyMccCategories` action.
|
|
13
|
+
*/
|
|
14
|
+
export type ActionType = ReturnType<typeof fetchCardPolicyMccCategories> | ReturnType<typeof updateCardPolicyMccCategories> | ReturnType<typeof updateCardPolicyMccCategoriesFailure>;
|
|
15
|
+
export declare const fetchCardPolicyMccCategoriesEpic: (actions$: ActionsObservable<ActionType>, _state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.fetchCardPolicyMccCategoriesEpic = void 0;
|
|
4
|
+
const rxjs_1 = require("rxjs");
|
|
5
|
+
const operators_1 = require("rxjs/operators");
|
|
6
|
+
const cardPolicyReducer_1 = require("../../../../../entity/cardPolicy/cardPolicyReducer");
|
|
7
|
+
const responsePayload_1 = require("../../../../../responsePayload");
|
|
8
|
+
const fetchCardPolicyMccCategoriesEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(cardPolicyReducer_1.fetchCardPolicyMccCategories.match), (0, operators_1.mergeMap)(() => {
|
|
9
|
+
return zeniAPI
|
|
10
|
+
.getJSON(`${zeniAPI.apiEndPoints.cardMicroServiceBaseUrl}/1.0/cards/mcc-codes`)
|
|
11
|
+
.pipe((0, operators_1.mergeMap)((response) => {
|
|
12
|
+
if ((0, responsePayload_1.isSuccessStatus)(response) && response.data != null) {
|
|
13
|
+
return (0, rxjs_1.from)([(0, cardPolicyReducer_1.updateCardPolicyMccCategories)(response.data)]);
|
|
14
|
+
}
|
|
15
|
+
else {
|
|
16
|
+
return (0, rxjs_1.of)((0, cardPolicyReducer_1.updateCardPolicyMccCategoriesFailure)(response.status));
|
|
17
|
+
}
|
|
18
|
+
}), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, cardPolicyReducer_1.updateCardPolicyMccCategoriesFailure)((0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Fetch card policy MCC categories REST API call errored out' +
|
|
19
|
+
JSON.stringify(error))))));
|
|
20
|
+
}));
|
|
21
|
+
exports.fetchCardPolicyMccCategoriesEpic = fetchCardPolicyMccCategoriesEpic;
|
|
@@ -61,7 +61,7 @@ export declare const initialCreditAcc: CreditAccount;
|
|
|
61
61
|
export declare const initialDebitCardSummaries: DebitCardSummaries;
|
|
62
62
|
export declare const initialResendRevokeCardInvite: ResendRevokeCardInvite;
|
|
63
63
|
export declare const initialCreditAccountRepayment: CreditAccountRepayment;
|
|
64
|
-
export declare const toChargeCardSortKeyType: (v: string) => "status" | "
|
|
64
|
+
export declare const toChargeCardSortKeyType: (v: string) => "status" | "department" | "cardName" | "owner" | "accountType" | "limit" | "cardType" | "utilisation";
|
|
65
65
|
export declare type ChargeCardViewSortKey = ReturnType<typeof toChargeCardSortKeyType>;
|
|
66
66
|
export declare const ALL_CASHBACK_SORT_KEYS: readonly ["month", "cashback"];
|
|
67
67
|
export declare const toCashbackSortKeyType: (v: string) => "month" | "cashback";
|
|
@@ -14,7 +14,7 @@ export declare const fetchTaskListPage: import("@reduxjs/toolkit").ActionCreator
|
|
|
14
14
|
archived?: TaskPayload[];
|
|
15
15
|
deleted?: TaskPayload[];
|
|
16
16
|
snoozed?: TaskPayload[];
|
|
17
|
-
}, "taskList/updateTaskList">, updateTaskListTab: import("@reduxjs/toolkit").ActionCreatorWithPayload<"deleted" | "
|
|
17
|
+
}, "taskList/updateTaskList">, updateTaskListTab: import("@reduxjs/toolkit").ActionCreatorWithPayload<"deleted" | "archived" | "live" | "snoozed", "taskList/updateTaskListTab">, updateTaskListFetchStatus: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
18
18
|
fetchState: FetchState;
|
|
19
19
|
error?: ZeniAPIStatus;
|
|
20
20
|
}, "taskList/updateTaskListFetchStatus">, updateTaskListSearchText: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
@@ -115,17 +115,7 @@ export declare const downloadAccountingProviderAttachment: import("@reduxjs/tool
|
|
|
115
115
|
amount: number;
|
|
116
116
|
recommendationWithCOTByLineId: RecommendationWithCOTByLineId;
|
|
117
117
|
uncategorizedIncomeExpense: UncategorizedAccounts;
|
|
118
|
-
}, "transactionDetail/setEntityRecommendationForLineIdsForTransactionDetail", never, never>,
|
|
119
|
-
transactionId: TransactionID;
|
|
120
|
-
lineIds: string[];
|
|
121
|
-
}, "transactionDetail/markCategoryClassRecommendationsInProgressForTransactionDetail", never, never>, markCategoryClassRecommendationsCompletedForTransactionDetail: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[transactionId: TransactionID, lineIds: string[]], {
|
|
122
|
-
transactionId: TransactionID;
|
|
123
|
-
lineIds: string[];
|
|
124
|
-
}, "transactionDetail/markCategoryClassRecommendationsCompletedForTransactionDetail", never, never>, markCategoryClassRecommendationsFailureForTransactionDetail: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[transactionId: TransactionID, lineIds: string[], error: ZeniAPIStatus<Record<string, unknown>>], {
|
|
125
|
-
transactionId: TransactionID;
|
|
126
|
-
lineIds: string[];
|
|
127
|
-
error: ZeniAPIStatus<Record<string, unknown>>;
|
|
128
|
-
}, "transactionDetail/markCategoryClassRecommendationsFailureForTransactionDetail", never, never>, removeEntityRecommendationForLineIdForTransactionDetail: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[transactionId: TransactionID, transaction: SupportedTransaction, lineId: string], {
|
|
118
|
+
}, "transactionDetail/setEntityRecommendationForLineIdsForTransactionDetail", never, never>, removeEntityRecommendationForLineIdForTransactionDetail: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[transactionId: TransactionID, transaction: SupportedTransaction, lineId: string], {
|
|
129
119
|
transactionId: TransactionID;
|
|
130
120
|
transaction: SupportedTransaction;
|
|
131
121
|
lineId: string;
|
|
@@ -4,7 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
var _a;
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.setIsVendorUpdateAllChecked = exports.updateVendorBulkRecommendationsFetchStatus = exports.updateLatestSelectedEntity = exports.resetAllLineItemsToVendor = exports.updateVendorToAllLineItems = exports.updateLocalDataWithTransactionsUpdateWithVendorCheckbox = exports.resetSelectedCustomer = exports.resetVendor = exports.updateSelectedCustomer = exports.updateSelectedVendor = exports.removeEntityRecommendationForLineIdForTransactionDetail = exports.
|
|
7
|
+
exports.setIsVendorUpdateAllChecked = exports.updateVendorBulkRecommendationsFetchStatus = exports.updateLatestSelectedEntity = exports.resetAllLineItemsToVendor = exports.updateVendorToAllLineItems = exports.updateLocalDataWithTransactionsUpdateWithVendorCheckbox = exports.resetSelectedCustomer = exports.resetVendor = exports.updateSelectedCustomer = exports.updateSelectedVendor = exports.removeEntityRecommendationForLineIdForTransactionDetail = exports.setEntityRecommendationForLineIdsForTransactionDetail = exports.setAllLineItemsLocalDataIsUpdateAllChecked = exports.setAllLineItemsToCategoryClassInLocalData = exports.resetLineItemsCategoryClassInLocalData = exports.clearTransactionDetailLocalData = exports.saveTransactionDetailLocalData = exports.initializeTransactionDetailLocalData = exports.saveTransactionDetail = exports.updateTransactionStateIfUpdateActionNotAllowed = exports.updateStatusConsolidatedSaveTransactionDetail = exports.updateStatusForTransactionNotMiscategorizedUpdate = exports.deleteTransactionAttachmentSuccess = exports.deleteTransactionAttachmentFailure = exports.deleteTransactionAttachment = exports.markTransactionAsNotMiscategorized = exports.clearTransactionDetailSaveStatus = exports.updateTransactionDetailSaveStatus = exports.updateTransactionDetail = exports.uploadMissingAttachmentSuccess = exports.clearTransactionDetail = exports.removeTransactionDetail = exports.updateTransactionDetailFetchState = exports.fetchTransactionDetail = exports.downloadAccountingProviderAttachmentFailure = exports.downloadAccountingProviderAttachmentSuccess = exports.downloadAccountingProviderAttachment = exports.initialState = void 0;
|
|
8
8
|
const toolkit_1 = require("@reduxjs/toolkit");
|
|
9
9
|
const get_1 = __importDefault(require("lodash/get"));
|
|
10
10
|
const entity_1 = require("../../entity/genericEntity/entity");
|
|
@@ -372,21 +372,6 @@ const transactionDetail = (0, toolkit_1.createSlice)({
|
|
|
372
372
|
const detail = (0, get_1.default)(draft.transactionDetailById, key, undefined);
|
|
373
373
|
if (detail != null) {
|
|
374
374
|
const newLocalData = (0, transactionDetailLocalDataHelper_1.setEntityRecommendationForLineIdInLocalData)(transaction, detail.transactionDetailLocalData, action.payload.entity, lineIds, uncategorizedIncomeExpense, recommendationWithCOTByLineId);
|
|
375
|
-
// Release the per-line fetch flag for every line this fetch
|
|
376
|
-
// covered so the inline skeleton resolves and the page-level
|
|
377
|
-
// Save button can re-enable.
|
|
378
|
-
lineIds.forEach((lineId) => {
|
|
379
|
-
const lineItem = newLocalData.lineItemById[lineId];
|
|
380
|
-
if (lineItem != null) {
|
|
381
|
-
newLocalData.lineItemById[lineId] = {
|
|
382
|
-
...lineItem,
|
|
383
|
-
categoryClassRecommendationsFetchState: {
|
|
384
|
-
fetchState: 'Completed',
|
|
385
|
-
error: undefined,
|
|
386
|
-
},
|
|
387
|
-
};
|
|
388
|
-
}
|
|
389
|
-
});
|
|
390
375
|
draft.transactionDetailById[key] = {
|
|
391
376
|
...detail,
|
|
392
377
|
transactionDetailLocalData: newLocalData,
|
|
@@ -407,100 +392,6 @@ const transactionDetail = (0, toolkit_1.createSlice)({
|
|
|
407
392
|
};
|
|
408
393
|
},
|
|
409
394
|
},
|
|
410
|
-
// Start arm of the line-update recommendations fetch for the detail
|
|
411
|
-
// page. Flips covered lines to In-Progress; detail page has no
|
|
412
|
-
// checkbox, so no auto-uncheck side effect.
|
|
413
|
-
markCategoryClassRecommendationsInProgressForTransactionDetail: {
|
|
414
|
-
reducer(draft, action) {
|
|
415
|
-
const { transactionId, lineIds } = action.payload;
|
|
416
|
-
const key = (0, transactionDetailState_1.getTransactionDetailKey)(transactionId);
|
|
417
|
-
const detail = (0, get_1.default)(draft.transactionDetailById, key, undefined);
|
|
418
|
-
// TEMP-LOG[JE-skeleton]: reducer entry — confirms the action reached
|
|
419
|
-
// the slice and shows whether incoming lineIds match the redux keys.
|
|
420
|
-
// eslint-disable-next-line no-console
|
|
421
|
-
console.log('[JE-skeleton][reducer] markInProgress detail', {
|
|
422
|
-
transactionId,
|
|
423
|
-
incomingLineIds: lineIds,
|
|
424
|
-
existingLineItemKeys: detail != null
|
|
425
|
-
? Object.keys(detail.transactionDetailLocalData.lineItemById)
|
|
426
|
-
: null,
|
|
427
|
-
matched: detail != null
|
|
428
|
-
? lineIds.filter((id) => detail.transactionDetailLocalData.lineItemById[id] != null)
|
|
429
|
-
: [],
|
|
430
|
-
missed: detail != null
|
|
431
|
-
? lineIds.filter((id) => detail.transactionDetailLocalData.lineItemById[id] == null)
|
|
432
|
-
: lineIds,
|
|
433
|
-
});
|
|
434
|
-
if (detail != null) {
|
|
435
|
-
lineIds.forEach((lineId) => {
|
|
436
|
-
const lineItem = detail.transactionDetailLocalData.lineItemById[lineId];
|
|
437
|
-
if (lineItem != null) {
|
|
438
|
-
detail.transactionDetailLocalData.lineItemById[lineId] = {
|
|
439
|
-
...lineItem,
|
|
440
|
-
categoryClassRecommendationsFetchState: {
|
|
441
|
-
fetchState: 'In-Progress',
|
|
442
|
-
error: undefined,
|
|
443
|
-
},
|
|
444
|
-
};
|
|
445
|
-
}
|
|
446
|
-
});
|
|
447
|
-
}
|
|
448
|
-
},
|
|
449
|
-
prepare(transactionId, lineIds) {
|
|
450
|
-
return { payload: { transactionId, lineIds } };
|
|
451
|
-
},
|
|
452
|
-
},
|
|
453
|
-
// Completed arm. Used when the HTTP call succeeded but the server
|
|
454
|
-
// returned no per-line recommendations — still need to release the
|
|
455
|
-
// In-Progress flag.
|
|
456
|
-
markCategoryClassRecommendationsCompletedForTransactionDetail: {
|
|
457
|
-
reducer(draft, action) {
|
|
458
|
-
const { transactionId, lineIds } = action.payload;
|
|
459
|
-
const key = (0, transactionDetailState_1.getTransactionDetailKey)(transactionId);
|
|
460
|
-
const detail = (0, get_1.default)(draft.transactionDetailById, key, undefined);
|
|
461
|
-
if (detail != null) {
|
|
462
|
-
lineIds.forEach((lineId) => {
|
|
463
|
-
const lineItem = detail.transactionDetailLocalData.lineItemById[lineId];
|
|
464
|
-
if (lineItem != null) {
|
|
465
|
-
detail.transactionDetailLocalData.lineItemById[lineId] = {
|
|
466
|
-
...lineItem,
|
|
467
|
-
categoryClassRecommendationsFetchState: {
|
|
468
|
-
fetchState: 'Completed',
|
|
469
|
-
error: undefined,
|
|
470
|
-
},
|
|
471
|
-
};
|
|
472
|
-
}
|
|
473
|
-
});
|
|
474
|
-
}
|
|
475
|
-
},
|
|
476
|
-
prepare(transactionId, lineIds) {
|
|
477
|
-
return { payload: { transactionId, lineIds } };
|
|
478
|
-
},
|
|
479
|
-
},
|
|
480
|
-
markCategoryClassRecommendationsFailureForTransactionDetail: {
|
|
481
|
-
reducer(draft, action) {
|
|
482
|
-
const { transactionId, lineIds, error } = action.payload;
|
|
483
|
-
const key = (0, transactionDetailState_1.getTransactionDetailKey)(transactionId);
|
|
484
|
-
const detail = (0, get_1.default)(draft.transactionDetailById, key, undefined);
|
|
485
|
-
if (detail != null) {
|
|
486
|
-
lineIds.forEach((lineId) => {
|
|
487
|
-
const lineItem = detail.transactionDetailLocalData.lineItemById[lineId];
|
|
488
|
-
if (lineItem != null) {
|
|
489
|
-
detail.transactionDetailLocalData.lineItemById[lineId] = {
|
|
490
|
-
...lineItem,
|
|
491
|
-
categoryClassRecommendationsFetchState: {
|
|
492
|
-
fetchState: 'Error',
|
|
493
|
-
error,
|
|
494
|
-
},
|
|
495
|
-
};
|
|
496
|
-
}
|
|
497
|
-
});
|
|
498
|
-
}
|
|
499
|
-
},
|
|
500
|
-
prepare(transactionId, lineIds, error) {
|
|
501
|
-
return { payload: { transactionId, lineIds, error } };
|
|
502
|
-
},
|
|
503
|
-
},
|
|
504
395
|
removeEntityRecommendationForLineIdForTransactionDetail: {
|
|
505
396
|
reducer(draft, action) {
|
|
506
397
|
const { transaction, lineId } = action.payload;
|
|
@@ -772,7 +663,7 @@ const transactionDetail = (0, toolkit_1.createSlice)({
|
|
|
772
663
|
},
|
|
773
664
|
},
|
|
774
665
|
});
|
|
775
|
-
_a = transactionDetail.actions, exports.downloadAccountingProviderAttachment = _a.downloadAccountingProviderAttachment, exports.downloadAccountingProviderAttachmentSuccess = _a.downloadAccountingProviderAttachmentSuccess, exports.downloadAccountingProviderAttachmentFailure = _a.downloadAccountingProviderAttachmentFailure, exports.fetchTransactionDetail = _a.fetchTransactionDetail, exports.updateTransactionDetailFetchState = _a.updateTransactionDetailFetchState, exports.removeTransactionDetail = _a.removeTransactionDetail, exports.clearTransactionDetail = _a.clearTransactionDetail, exports.uploadMissingAttachmentSuccess = _a.uploadMissingAttachmentSuccess, exports.updateTransactionDetail = _a.updateTransactionDetail, exports.updateTransactionDetailSaveStatus = _a.updateTransactionDetailSaveStatus, exports.clearTransactionDetailSaveStatus = _a.clearTransactionDetailSaveStatus, exports.markTransactionAsNotMiscategorized = _a.markTransactionAsNotMiscategorized, exports.deleteTransactionAttachment = _a.deleteTransactionAttachment, exports.deleteTransactionAttachmentFailure = _a.deleteTransactionAttachmentFailure, exports.deleteTransactionAttachmentSuccess = _a.deleteTransactionAttachmentSuccess, exports.updateStatusForTransactionNotMiscategorizedUpdate = _a.updateStatusForTransactionNotMiscategorizedUpdate, exports.updateStatusConsolidatedSaveTransactionDetail = _a.updateStatusConsolidatedSaveTransactionDetail, exports.updateTransactionStateIfUpdateActionNotAllowed = _a.updateTransactionStateIfUpdateActionNotAllowed, exports.saveTransactionDetail = _a.saveTransactionDetail, exports.initializeTransactionDetailLocalData = _a.initializeTransactionDetailLocalData, exports.saveTransactionDetailLocalData = _a.saveTransactionDetailLocalData, exports.clearTransactionDetailLocalData = _a.clearTransactionDetailLocalData, exports.resetLineItemsCategoryClassInLocalData = _a.resetLineItemsCategoryClassInLocalData, exports.setAllLineItemsToCategoryClassInLocalData = _a.setAllLineItemsToCategoryClassInLocalData, exports.setAllLineItemsLocalDataIsUpdateAllChecked = _a.setAllLineItemsLocalDataIsUpdateAllChecked, exports.setEntityRecommendationForLineIdsForTransactionDetail = _a.setEntityRecommendationForLineIdsForTransactionDetail, exports.
|
|
666
|
+
_a = transactionDetail.actions, exports.downloadAccountingProviderAttachment = _a.downloadAccountingProviderAttachment, exports.downloadAccountingProviderAttachmentSuccess = _a.downloadAccountingProviderAttachmentSuccess, exports.downloadAccountingProviderAttachmentFailure = _a.downloadAccountingProviderAttachmentFailure, exports.fetchTransactionDetail = _a.fetchTransactionDetail, exports.updateTransactionDetailFetchState = _a.updateTransactionDetailFetchState, exports.removeTransactionDetail = _a.removeTransactionDetail, exports.clearTransactionDetail = _a.clearTransactionDetail, exports.uploadMissingAttachmentSuccess = _a.uploadMissingAttachmentSuccess, exports.updateTransactionDetail = _a.updateTransactionDetail, exports.updateTransactionDetailSaveStatus = _a.updateTransactionDetailSaveStatus, exports.clearTransactionDetailSaveStatus = _a.clearTransactionDetailSaveStatus, exports.markTransactionAsNotMiscategorized = _a.markTransactionAsNotMiscategorized, exports.deleteTransactionAttachment = _a.deleteTransactionAttachment, exports.deleteTransactionAttachmentFailure = _a.deleteTransactionAttachmentFailure, exports.deleteTransactionAttachmentSuccess = _a.deleteTransactionAttachmentSuccess, exports.updateStatusForTransactionNotMiscategorizedUpdate = _a.updateStatusForTransactionNotMiscategorizedUpdate, exports.updateStatusConsolidatedSaveTransactionDetail = _a.updateStatusConsolidatedSaveTransactionDetail, exports.updateTransactionStateIfUpdateActionNotAllowed = _a.updateTransactionStateIfUpdateActionNotAllowed, exports.saveTransactionDetail = _a.saveTransactionDetail, exports.initializeTransactionDetailLocalData = _a.initializeTransactionDetailLocalData, exports.saveTransactionDetailLocalData = _a.saveTransactionDetailLocalData, exports.clearTransactionDetailLocalData = _a.clearTransactionDetailLocalData, exports.resetLineItemsCategoryClassInLocalData = _a.resetLineItemsCategoryClassInLocalData, exports.setAllLineItemsToCategoryClassInLocalData = _a.setAllLineItemsToCategoryClassInLocalData, exports.setAllLineItemsLocalDataIsUpdateAllChecked = _a.setAllLineItemsLocalDataIsUpdateAllChecked, exports.setEntityRecommendationForLineIdsForTransactionDetail = _a.setEntityRecommendationForLineIdsForTransactionDetail, exports.removeEntityRecommendationForLineIdForTransactionDetail = _a.removeEntityRecommendationForLineIdForTransactionDetail, exports.updateSelectedVendor = _a.updateSelectedVendor, exports.updateSelectedCustomer = _a.updateSelectedCustomer, exports.resetVendor = _a.resetVendor, exports.resetSelectedCustomer = _a.resetSelectedCustomer, exports.updateLocalDataWithTransactionsUpdateWithVendorCheckbox = _a.updateLocalDataWithTransactionsUpdateWithVendorCheckbox, exports.updateVendorToAllLineItems = _a.updateVendorToAllLineItems, exports.resetAllLineItemsToVendor = _a.resetAllLineItemsToVendor, exports.updateLatestSelectedEntity = _a.updateLatestSelectedEntity, exports.updateVendorBulkRecommendationsFetchStatus = _a.updateVendorBulkRecommendationsFetchStatus, exports.setIsVendorUpdateAllChecked = _a.setIsVendorUpdateAllChecked;
|
|
776
667
|
exports.default = transactionDetail.reducer;
|
|
777
668
|
function getUpdatedEntityLocalData(detail, updates, entity, resetRecommendations, type) {
|
|
778
669
|
const key = type === 'customer' ? 'customerUpdates' : 'vendorUpdates';
|
|
@@ -18,7 +18,6 @@ export interface TransactionDetailReport extends SelectorView {
|
|
|
18
18
|
classHierarchyList: NestedClassHierarchyForReport[];
|
|
19
19
|
classList: ClassListSelectorView;
|
|
20
20
|
deleteStatusByAttachmentName: Record<string, FetchStateAndError>;
|
|
21
|
-
hasInFlightCategoryClassRecommendations: boolean;
|
|
22
21
|
isAccountingClassesEnabled: boolean;
|
|
23
22
|
isAccountingProjectsEnabled: boolean;
|
|
24
23
|
linkedTransactions: SupportedTransactionWithCOT[];
|
|
@@ -31,7 +30,6 @@ export interface TransactionDetailReport extends SelectorView {
|
|
|
31
30
|
export interface VendorDetailsView extends SelectorView {
|
|
32
31
|
vendors: Vendor[];
|
|
33
32
|
}
|
|
34
|
-
export declare const getDetailInFlightRecommendations: (state: RootState, transactionId: TransactionID) => boolean;
|
|
35
33
|
export declare const getTransactionDetail: (state: RootState, transactionId: TransactionID, fetchLinkedTransactions?: boolean) => TransactionDetailReport;
|
|
36
34
|
export declare function getTransactionDetailForTransaction(rootState: RootState, transactionId: TransactionID): TransactionDetailReport | undefined;
|
|
37
35
|
export declare const getInitialUpdatablePeriodsForTransactionRecommendations: (companyIncorporationDate?: ZeniDate, bookCloseDate?: ZeniDate) => {
|
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.getInitialUpdatablePeriodsForTransactionRecommendations = exports.getTransactionDetail =
|
|
6
|
+
exports.getInitialUpdatablePeriodsForTransactionRecommendations = exports.getTransactionDetail = void 0;
|
|
7
7
|
exports.getTransactionDetailForTransaction = getTransactionDetailForTransaction;
|
|
8
8
|
const get_1 = __importDefault(require("lodash/get"));
|
|
9
9
|
const reduceFetchState_1 = require("../../commonStateTypes/reduceFetchState");
|
|
@@ -17,27 +17,6 @@ const accountListSelector_1 = require("../accountList/accountListSelector");
|
|
|
17
17
|
const classListSelector_1 = require("../classList/classListSelector");
|
|
18
18
|
const projectListSelector_1 = require("../projectList/projectListSelector");
|
|
19
19
|
const transactionDetailState_1 = require("./transactionDetailState");
|
|
20
|
-
// "Any line on this transaction is fetching category/class recommendations?"
|
|
21
|
-
// Inlined as a plain function because the upstream selector
|
|
22
|
-
// `getTransactionDetail` is also un-memoized and the iteration is O(lines)
|
|
23
|
-
// — typically <10. Exported standalone so consumers that only need the
|
|
24
|
-
// flag (e.g. footer save-disable) can avoid materializing the whole
|
|
25
|
-
// detail report.
|
|
26
|
-
const getDetailInFlightRecommendations = (state, transactionId) => {
|
|
27
|
-
const detailKey = (0, transactionDetailState_1.getTransactionDetailKey)(transactionId);
|
|
28
|
-
const detail = (0, get_1.default)(state.transactionDetailState.transactionDetailById, detailKey, undefined);
|
|
29
|
-
if (detail == null) {
|
|
30
|
-
return false;
|
|
31
|
-
}
|
|
32
|
-
for (const lineItem of Object.values(detail.transactionDetailLocalData.lineItemById)) {
|
|
33
|
-
if (lineItem.categoryClassRecommendationsFetchState?.fetchState ===
|
|
34
|
-
'In-Progress') {
|
|
35
|
-
return true;
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
return false;
|
|
39
|
-
};
|
|
40
|
-
exports.getDetailInFlightRecommendations = getDetailInFlightRecommendations;
|
|
41
20
|
const getTransactionDetail = (state, transactionId, fetchLinkedTransactions = true) => {
|
|
42
21
|
const { transactionDetailState, transactionState, vendorState, vendorListState, accountState, classState, classListState, accountListState, projectState, projectListState, } = state;
|
|
43
22
|
const detailKey = (0, transactionDetailState_1.getTransactionDetailKey)(transactionId);
|
|
@@ -100,7 +79,6 @@ const getTransactionDetail = (state, transactionId, fetchLinkedTransactions = tr
|
|
|
100
79
|
: [];
|
|
101
80
|
const transactionDetailAnyUpdateStatus = reduceUpdateFetchStates(transactionDetail);
|
|
102
81
|
const vendors = (0, vendorSelector_1.getVendorsByVendorIds)(vendorState, vendorListState.vendorIds);
|
|
103
|
-
const hasInFlightCategoryClassRecommendations = (0, exports.getDetailInFlightRecommendations)(state, transactionId);
|
|
104
82
|
return {
|
|
105
83
|
reportId: 'transaction_detail',
|
|
106
84
|
reportTitle: 'Transaction Detail',
|
|
@@ -116,7 +94,6 @@ const getTransactionDetail = (state, transactionId, fetchLinkedTransactions = tr
|
|
|
116
94
|
classHierarchyList,
|
|
117
95
|
accountsHierarchyList,
|
|
118
96
|
classList: classList,
|
|
119
|
-
hasInFlightCategoryClassRecommendations,
|
|
120
97
|
isAccountingClassesEnabled,
|
|
121
98
|
isAccountingProjectsEnabled,
|
|
122
99
|
projectList,
|
|
@@ -14,7 +14,6 @@ export interface TransactionDetailLineItemData extends TransactionLineBase {
|
|
|
14
14
|
isClassMiscategorized: boolean;
|
|
15
15
|
account?: AccountBase;
|
|
16
16
|
billable?: BillableStatus;
|
|
17
|
-
categoryClassRecommendationsFetchState?: FetchStateAndError;
|
|
18
17
|
class?: ClassBase;
|
|
19
18
|
customer?: CustomerBase;
|
|
20
19
|
isCategoryUpdateSelected?: boolean;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zeniai/client-epic-state",
|
|
3
|
-
"version": "5.0.65-
|
|
3
|
+
"version": "5.0.65-betaRR2",
|
|
4
4
|
"description": "Shared module between Web & Mobile containing required abstractions for state management, async network communication. ",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "lib/esm/index.js",
|