@zeniai/client-epic-state 5.0.83 → 5.0.84-beta24RJ
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 +1 -140
- package/lib/entity/aiCfo/aiCfoReducer.d.ts +2 -23
- package/lib/entity/aiCfo/aiCfoReducer.js +4 -332
- package/lib/entity/aiCfo/aiCfoSelector.d.ts +1 -13
- package/lib/entity/aiCfo/aiCfoSelector.js +1 -28
- package/lib/entity/aiCfo/aiCfoState.d.ts +4 -225
- package/lib/entity/aiCfo/aiCfoState.js +1 -30
- package/lib/entity/jeSchedules/jeSchedulesPayload.d.ts +1 -0
- package/lib/entity/jeSchedules/jeSchedulesPayload.js +7 -0
- package/lib/entity/jeSchedules/jeSchedulesState.d.ts +1 -0
- package/lib/entity/jeSchedules/jeSchedulesTypes.d.ts +1 -1
- package/lib/entity/monthEndCloseChecks/monthEndCloseChecksState.d.ts +1 -1
- package/lib/entity/snackbar/snackbarTypes.d.ts +1 -1
- package/lib/entity/snackbar/snackbarTypes.js +0 -3
- package/lib/entity/tenant/clearAllEpic.d.ts +2 -6
- package/lib/entity/tenant/clearAllEpic.js +0 -8
- package/lib/epic.d.ts +1 -11
- package/lib/epic.js +1 -11
- package/lib/esm/entity/aiCfo/aiCfoReducer.js +4 -332
- package/lib/esm/entity/aiCfo/aiCfoSelector.js +1 -26
- package/lib/esm/entity/aiCfo/aiCfoState.js +0 -27
- package/lib/esm/entity/jeSchedules/jeSchedulesPayload.js +7 -0
- package/lib/esm/entity/snackbar/snackbarTypes.js +0 -3
- package/lib/esm/entity/tenant/clearAllEpic.js +0 -8
- package/lib/esm/epic.js +1 -11
- package/lib/esm/index.js +7 -22
- package/lib/esm/reducer.js +0 -12
- package/lib/esm/view/aiCfoView/aiCfoViewReducer.js +3 -6
- package/lib/esm/view/aiCfoView/epics/createSessionAndSubmitEpic.js +2 -5
- package/lib/esm/view/aiCfoView/epics/createSessionEpic.js +1 -2
- package/lib/esm/view/aiCfoView/epics/fetchSuggestedQuestionsEpic.js +2 -12
- package/lib/esm/view/spendManagement/chargeCards/chargeCardList/chargeCardListSelector.js +0 -25
- package/lib/esm/view/spendManagement/chargeCards/issueChargeCard/issueChargeCardEpic.js +2 -2
- package/lib/esm/view/spendManagement/chargeCards/issueChargeCard/issueChargeCardReducer.js +4 -16
- package/lib/esm/view/spendManagement/chargeCards/issueChargeCard/issueChargeCardSelector.js +0 -38
- package/lib/index.d.ts +7 -20
- package/lib/index.js +10 -125
- package/lib/reducer.d.ts +0 -12
- package/lib/reducer.js +0 -12
- package/lib/view/aiCfoView/aiCfoViewReducer.d.ts +2 -11
- package/lib/view/aiCfoView/aiCfoViewReducer.js +3 -6
- package/lib/view/aiCfoView/epics/createSessionAndSubmitEpic.js +2 -5
- package/lib/view/aiCfoView/epics/createSessionEpic.js +1 -2
- package/lib/view/aiCfoView/epics/fetchSuggestedQuestionsEpic.d.ts +1 -8
- package/lib/view/aiCfoView/epics/fetchSuggestedQuestionsEpic.js +2 -12
- package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.d.ts +1 -1
- package/lib/view/expenseAutomationView/types/reconciliationViewState.d.ts +1 -1
- package/lib/view/people/peopleTypes.d.ts +1 -1
- package/lib/view/scheduleView/scheduleListView/scheduleListTypes.d.ts +1 -1
- package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardList.d.ts +1 -1
- package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardListSelector.d.ts +0 -14
- package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardListSelector.js +1 -27
- package/lib/view/spendManagement/chargeCards/issueChargeCard/issueChargeCardEpic.d.ts +2 -2
- package/lib/view/spendManagement/chargeCards/issueChargeCard/issueChargeCardEpic.js +1 -1
- package/lib/view/spendManagement/chargeCards/issueChargeCard/issueChargeCardReducer.d.ts +1 -5
- package/lib/view/spendManagement/chargeCards/issueChargeCard/issueChargeCardReducer.js +5 -17
- package/lib/view/spendManagement/chargeCards/issueChargeCard/issueChargeCardSelector.d.ts +0 -27
- package/lib/view/spendManagement/chargeCards/issueChargeCard/issueChargeCardSelector.js +1 -43
- package/lib/view/spendManagement/chargeCards/issueChargeCard/issueChargeCardState.d.ts +0 -2
- package/lib/view/taskManager/taskListView/taskListReducer.d.ts +1 -1
- package/package.json +1 -1
- package/lib/entity/cardPolicy/cardPolicyPayload.d.ts +0 -277
- package/lib/entity/cardPolicy/cardPolicyPayload.js +0 -143
- package/lib/entity/cardPolicy/cardPolicyReducer.d.ts +0 -19
- package/lib/entity/cardPolicy/cardPolicyReducer.js +0 -265
- package/lib/entity/cardPolicy/cardPolicySelector.d.ts +0 -32
- package/lib/entity/cardPolicy/cardPolicySelector.js +0 -103
- package/lib/entity/cardPolicy/cardPolicyState.d.ts +0 -205
- package/lib/entity/cardPolicy/cardPolicyState.js +0 -14
- package/lib/entity/cardPolicy/extractPolicyDocumentEpic.d.ts +0 -18
- package/lib/entity/cardPolicy/extractPolicyDocumentEpic.js +0 -68
- package/lib/entity/cardPolicy/fetchCardPolicyVendorOptionsEpic.d.ts +0 -26
- package/lib/entity/cardPolicy/fetchCardPolicyVendorOptionsEpic.js +0 -47
- package/lib/entity/cardPolicy/policyDocumentExtractionToRecommendationBridgeEpic.d.ts +0 -25
- package/lib/entity/cardPolicy/policyDocumentExtractionToRecommendationBridgeEpic.js +0 -39
- package/lib/entity/cardPolicy/policyRecommendationFromUploadEpic.d.ts +0 -23
- package/lib/entity/cardPolicy/policyRecommendationFromUploadEpic.js +0 -111
- package/lib/esm/entity/cardPolicy/cardPolicyPayload.js +0 -130
- package/lib/esm/entity/cardPolicy/cardPolicyReducer.js +0 -261
- package/lib/esm/entity/cardPolicy/cardPolicySelector.js +0 -79
- package/lib/esm/entity/cardPolicy/cardPolicyState.js +0 -9
- package/lib/esm/entity/cardPolicy/extractPolicyDocumentEpic.js +0 -64
- package/lib/esm/entity/cardPolicy/fetchCardPolicyVendorOptionsEpic.js +0 -43
- package/lib/esm/entity/cardPolicy/policyDocumentExtractionToRecommendationBridgeEpic.js +0 -35
- package/lib/esm/entity/cardPolicy/policyRecommendationFromUploadEpic.js +0 -107
- package/lib/esm/view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/cardPolicyDetailReducer.js +0 -70
- package/lib/esm/view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/cardPolicyDetailSelector.js +0 -22
- package/lib/esm/view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/cardPolicyDetailState.js +0 -1
- package/lib/esm/view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/fetchCardPolicyDetailEpic.js +0 -56
- package/lib/esm/view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/updateCardPolicyEpic.js +0 -49
- package/lib/esm/view/spendManagement/chargeCards/cardPolicy/cardPolicyList/archiveCardPolicyEpic.js +0 -42
- package/lib/esm/view/spendManagement/chargeCards/cardPolicy/cardPolicyList/cardPolicyListReducer.js +0 -72
- package/lib/esm/view/spendManagement/chargeCards/cardPolicy/cardPolicyList/cardPolicyListSelector.js +0 -21
- package/lib/esm/view/spendManagement/chargeCards/cardPolicy/cardPolicyList/cardPolicyListState.js +0 -1
- package/lib/esm/view/spendManagement/chargeCards/cardPolicy/cardPolicyList/fetchCardPolicyListEpic.js +0 -56
- package/lib/esm/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/createCardPolicyReducer.js +0 -62
- package/lib/esm/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/createCardPolicySelector.js +0 -39
- package/lib/esm/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/createCardPolicyState.js +0 -1
- package/lib/esm/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/createCardPolicyTemplateEpic.js +0 -53
- package/lib/esm/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/fetchCardPolicyMccCategoriesEpic.js +0 -25
- package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/cardPolicyDetailReducer.d.ts +0 -14
- package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/cardPolicyDetailReducer.js +0 -74
- package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/cardPolicyDetailSelector.d.ts +0 -21
- package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/cardPolicyDetailSelector.js +0 -28
- package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/cardPolicyDetailState.d.ts +0 -25
- package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/cardPolicyDetailState.js +0 -2
- package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/fetchCardPolicyDetailEpic.d.ts +0 -19
- package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/fetchCardPolicyDetailEpic.js +0 -60
- package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/updateCardPolicyEpic.d.ts +0 -18
- package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/updateCardPolicyEpic.js +0 -53
- package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyList/archiveCardPolicyEpic.d.ts +0 -16
- package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyList/archiveCardPolicyEpic.js +0 -46
- package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyList/cardPolicyListReducer.d.ts +0 -15
- package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyList/cardPolicyListReducer.js +0 -76
- package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyList/cardPolicyListSelector.d.ts +0 -21
- package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyList/cardPolicyListSelector.js +0 -27
- package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyList/cardPolicyListState.d.ts +0 -19
- package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyList/cardPolicyListState.js +0 -2
- package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyList/fetchCardPolicyListEpic.d.ts +0 -19
- package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyList/fetchCardPolicyListEpic.js +0 -60
- package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/createCardPolicyReducer.d.ts +0 -13
- package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/createCardPolicyReducer.js +0 -66
- package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/createCardPolicySelector.d.ts +0 -32
- package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/createCardPolicySelector.js +0 -46
- package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/createCardPolicyState.d.ts +0 -45
- package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/createCardPolicyState.js +0 -2
- package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/createCardPolicyTemplateEpic.d.ts +0 -25
- package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/createCardPolicyTemplateEpic.js +0 -57
- package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/fetchCardPolicyMccCategoriesEpic.d.ts +0 -15
- package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/fetchCardPolicyMccCategoriesEpic.js +0 -29
package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/createCardPolicyReducer.js
DELETED
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var _a;
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.clearCreateCardPolicy = exports.updateCreateCardPolicyTemplateRequestState = exports.createCardPolicyTemplates = 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
|
-
lastCreatedCardPolicyTemplateIds: [],
|
|
12
|
-
lastCreateCardPolicyTemplateErrors: [],
|
|
13
|
-
};
|
|
14
|
-
const createCardPolicy = (0, toolkit_1.createSlice)({
|
|
15
|
-
name: 'createCardPolicy',
|
|
16
|
-
initialState: exports.initialState,
|
|
17
|
-
reducers: {
|
|
18
|
-
/**
|
|
19
|
-
* Kick off the bulk `POST /cards/1.0/policy-templates` request.
|
|
20
|
-
* Single-create callers pass a length-1 `templates` array; AI CFO
|
|
21
|
-
* multi-policy callers pass N entries in one round-trip. Setting the
|
|
22
|
-
* request state to `In-Progress` synchronously here matches how every
|
|
23
|
-
* other "create" slice in this repo wires its kickoff (see
|
|
24
|
-
* `issueChargeCards`, `fetchChargeCardConfig`, etc.).
|
|
25
|
-
*
|
|
26
|
-
* The accompanying epic listens for this action, performs the POST,
|
|
27
|
-
* dispatches one `updateCreatedCardPolicyTemplate` on the entity
|
|
28
|
-
* slice per row returned in `templates_created`, and dispatches
|
|
29
|
-
* `updateCreateCardPolicyTemplateRequestState` here to flip the
|
|
30
|
-
* lifecycle to `Completed` (with the created ids + any per-item
|
|
31
|
-
* errors) or `Error` (transport-level failure).
|
|
32
|
-
*/
|
|
33
|
-
createCardPolicyTemplates: {
|
|
34
|
-
reducer(draft, action) {
|
|
35
|
-
draft.createCardPolicyTemplateRequestState.fetchState = 'In-Progress';
|
|
36
|
-
draft.createCardPolicyTemplateRequestState.error = undefined;
|
|
37
|
-
draft.lastCreatedCardPolicyTemplateIds = [];
|
|
38
|
-
draft.lastCreateCardPolicyTemplateErrors = [];
|
|
39
|
-
// Mirror `lastIssueSourceChatSessionId` on the cards side: the list
|
|
40
|
-
// screen and AI CFO drawer both consult this to decide whether the
|
|
41
|
-
// in-flight create belongs to the active AI CFO conversation.
|
|
42
|
-
draft.lastCreateCardPolicySourceChatSessionId =
|
|
43
|
-
action.payload.sourceChatSessionId;
|
|
44
|
-
},
|
|
45
|
-
prepare(request) {
|
|
46
|
-
return { payload: request };
|
|
47
|
-
},
|
|
48
|
-
},
|
|
49
|
-
updateCreateCardPolicyTemplateRequestState(draft, action) {
|
|
50
|
-
draft.createCardPolicyTemplateRequestState.fetchState =
|
|
51
|
-
action.payload.fetchState;
|
|
52
|
-
draft.createCardPolicyTemplateRequestState.error = action.payload.error;
|
|
53
|
-
if (action.payload.templateIds != null) {
|
|
54
|
-
draft.lastCreatedCardPolicyTemplateIds = action.payload.templateIds;
|
|
55
|
-
}
|
|
56
|
-
if (action.payload.perItemErrors != null) {
|
|
57
|
-
draft.lastCreateCardPolicyTemplateErrors = action.payload.perItemErrors;
|
|
58
|
-
}
|
|
59
|
-
},
|
|
60
|
-
clearCreateCardPolicy(draft) {
|
|
61
|
-
Object.assign(draft, exports.initialState);
|
|
62
|
-
},
|
|
63
|
-
},
|
|
64
|
-
});
|
|
65
|
-
_a = createCardPolicy.actions, exports.createCardPolicyTemplates = _a.createCardPolicyTemplates, exports.updateCreateCardPolicyTemplateRequestState = _a.updateCreateCardPolicyTemplateRequestState, exports.clearCreateCardPolicy = _a.clearCreateCardPolicy;
|
|
66
|
-
exports.default = createCardPolicy.reducer;
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { FetchStateAndError, ID } from '../../../../../commonStateTypes/common';
|
|
2
|
-
import { BulkCreateCardPolicyTemplateError } from '../../../../../entity/cardPolicy/cardPolicyPayload';
|
|
3
|
-
import { CreateCardPolicyState } from './createCardPolicyState';
|
|
4
|
-
export declare function getCreateCardPolicyTemplateRequestState(state: CreateCardPolicyState): FetchStateAndError;
|
|
5
|
-
/**
|
|
6
|
-
* All template ids created by the most recent successful bulk submit
|
|
7
|
-
* (in BE return order). Empty array before any submit or after
|
|
8
|
-
* `clearCreateCardPolicy`. Multi-policy AI CFO submit reads this; the
|
|
9
|
-
* single-policy `getLastCreatedCardPolicyTemplateId` selector below is a
|
|
10
|
-
* convenience for the manual-create routing flow.
|
|
11
|
-
*/
|
|
12
|
-
export declare function getLastCreatedCardPolicyTemplateIds(state: CreateCardPolicyState): ID[];
|
|
13
|
-
/**
|
|
14
|
-
* Convenience selector returning the first id of the most recent submit
|
|
15
|
-
* — kept ergonomic for the single-create page's "navigate to detail on
|
|
16
|
-
* success" logic, which only ever creates one template. Returns
|
|
17
|
-
* `undefined` when no submit has succeeded or when the list is empty.
|
|
18
|
-
*/
|
|
19
|
-
export declare function getLastCreatedCardPolicyTemplateId(state: CreateCardPolicyState): ID | undefined;
|
|
20
|
-
/**
|
|
21
|
-
* Per-item errors returned by the bulk POST when one or more templates
|
|
22
|
-
* failed to persist. Empty on full success; populated on partial success
|
|
23
|
-
* so the UI can render a "N of M created" banner alongside the navigate /
|
|
24
|
-
* close behaviour driven by the lifecycle selector.
|
|
25
|
-
*/
|
|
26
|
-
export declare function getLastCreateCardPolicyTemplateErrors(state: CreateCardPolicyState): BulkCreateCardPolicyTemplateError[];
|
|
27
|
-
/**
|
|
28
|
-
* Chat session id that triggered the most recent bulk create — used by the
|
|
29
|
-
* card policy list screen and the AI CFO drawer to scope "creating…" and
|
|
30
|
-
* "created" placeholders to the active conversation.
|
|
31
|
-
*/
|
|
32
|
-
export declare function getLastCreateCardPolicySourceChatSessionId(state: CreateCardPolicyState): ID | undefined;
|
package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/createCardPolicySelector.js
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getCreateCardPolicyTemplateRequestState = getCreateCardPolicyTemplateRequestState;
|
|
4
|
-
exports.getLastCreatedCardPolicyTemplateIds = getLastCreatedCardPolicyTemplateIds;
|
|
5
|
-
exports.getLastCreatedCardPolicyTemplateId = getLastCreatedCardPolicyTemplateId;
|
|
6
|
-
exports.getLastCreateCardPolicyTemplateErrors = getLastCreateCardPolicyTemplateErrors;
|
|
7
|
-
exports.getLastCreateCardPolicySourceChatSessionId = getLastCreateCardPolicySourceChatSessionId;
|
|
8
|
-
function getCreateCardPolicyTemplateRequestState(state) {
|
|
9
|
-
return state.createCardPolicyTemplateRequestState;
|
|
10
|
-
}
|
|
11
|
-
/**
|
|
12
|
-
* All template ids created by the most recent successful bulk submit
|
|
13
|
-
* (in BE return order). Empty array before any submit or after
|
|
14
|
-
* `clearCreateCardPolicy`. Multi-policy AI CFO submit reads this; the
|
|
15
|
-
* single-policy `getLastCreatedCardPolicyTemplateId` selector below is a
|
|
16
|
-
* convenience for the manual-create routing flow.
|
|
17
|
-
*/
|
|
18
|
-
function getLastCreatedCardPolicyTemplateIds(state) {
|
|
19
|
-
return state.lastCreatedCardPolicyTemplateIds;
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* Convenience selector returning the first id of the most recent submit
|
|
23
|
-
* — kept ergonomic for the single-create page's "navigate to detail on
|
|
24
|
-
* success" logic, which only ever creates one template. Returns
|
|
25
|
-
* `undefined` when no submit has succeeded or when the list is empty.
|
|
26
|
-
*/
|
|
27
|
-
function getLastCreatedCardPolicyTemplateId(state) {
|
|
28
|
-
return state.lastCreatedCardPolicyTemplateIds[0];
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* Per-item errors returned by the bulk POST when one or more templates
|
|
32
|
-
* failed to persist. Empty on full success; populated on partial success
|
|
33
|
-
* so the UI can render a "N of M created" banner alongside the navigate /
|
|
34
|
-
* close behaviour driven by the lifecycle selector.
|
|
35
|
-
*/
|
|
36
|
-
function getLastCreateCardPolicyTemplateErrors(state) {
|
|
37
|
-
return state.lastCreateCardPolicyTemplateErrors;
|
|
38
|
-
}
|
|
39
|
-
/**
|
|
40
|
-
* Chat session id that triggered the most recent bulk create — used by the
|
|
41
|
-
* card policy list screen and the AI CFO drawer to scope "creating…" and
|
|
42
|
-
* "created" placeholders to the active conversation.
|
|
43
|
-
*/
|
|
44
|
-
function getLastCreateCardPolicySourceChatSessionId(state) {
|
|
45
|
-
return state.lastCreateCardPolicySourceChatSessionId;
|
|
46
|
-
}
|
package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/createCardPolicyState.d.ts
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { FetchStateAndError, ID } from '../../../../../commonStateTypes/common';
|
|
2
|
-
import { BulkCreateCardPolicyTemplateError } from '../../../../../entity/cardPolicy/cardPolicyPayload';
|
|
3
|
-
/**
|
|
4
|
-
* View-side scaffolding for the Card Policy "create" flow.
|
|
5
|
-
*
|
|
6
|
-
* `POST /cards/1.0/policy-templates` is now a bulk endpoint — both the
|
|
7
|
-
* manual create page and the AI CFO submit pass an array of templates
|
|
8
|
-
* (single-element today; multi-element when AI CFO multi-policy review
|
|
9
|
-
* lands). The slice tracks one request lifecycle for the whole submit
|
|
10
|
-
* and captures the per-template ids + errors on success.
|
|
11
|
-
*
|
|
12
|
-
* List + edit lifecycles live in sibling slices (`cardPolicyList`,
|
|
13
|
-
* `cardPolicyDetail`); MCC categories used by the create form live on
|
|
14
|
-
* the entity slice (shared with the AI-CFO flow) and are fetched via the
|
|
15
|
-
* co-located `fetchCardPolicyMccCategoriesEpic`.
|
|
16
|
-
*/
|
|
17
|
-
export interface CreateCardPolicyState {
|
|
18
|
-
createCardPolicyTemplateRequestState: FetchStateAndError;
|
|
19
|
-
/**
|
|
20
|
-
* Per-item failures returned alongside `templates_created` on the bulk
|
|
21
|
-
* response. Empty on full success; populated on partial success so the
|
|
22
|
-
* UI can render a "N of M created" banner. Cleared when a new submit
|
|
23
|
-
* starts and by `clearCreateCardPolicy`.
|
|
24
|
-
*/
|
|
25
|
-
lastCreateCardPolicyTemplateErrors: BulkCreateCardPolicyTemplateError[];
|
|
26
|
-
/**
|
|
27
|
-
* `templateId`s of the templates created by the most recent successful
|
|
28
|
-
* bulk submit, in the order they were returned by the BE. Empty when no
|
|
29
|
-
* submit has succeeded yet or after `clearCreateCardPolicy`.
|
|
30
|
-
*
|
|
31
|
-
* For the single-policy case this holds exactly one id; the
|
|
32
|
-
* `getLastCreatedCardPolicyTemplateId` selector returns `[0]` for
|
|
33
|
-
* ergonomic single-create routing.
|
|
34
|
-
*/
|
|
35
|
-
lastCreatedCardPolicyTemplateIds: ID[];
|
|
36
|
-
/**
|
|
37
|
-
* Chat session id from `sourceChatSessionId` on the most recent
|
|
38
|
-
* `createCardPolicyTemplates` dispatch — i.e. the AI CFO conversation
|
|
39
|
-
* that triggered the bulk create. Lets the policy list and AI CFO
|
|
40
|
-
* drawer correlate an in-flight create back to its originating session.
|
|
41
|
-
* `undefined` when the most recent submit came from the manual create
|
|
42
|
-
* screen (which omits `sourceChatSessionId`).
|
|
43
|
-
*/
|
|
44
|
-
lastCreateCardPolicySourceChatSessionId?: ID;
|
|
45
|
-
}
|
|
@@ -1,25 +0,0 @@
|
|
|
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 { createCardPolicyTemplates, updateCreateCardPolicyTemplateRequestState } from './createCardPolicyReducer';
|
|
7
|
-
export type ActionType = ReturnType<typeof createCardPolicyTemplates> | ReturnType<typeof updateCreatedCardPolicyTemplate> | ReturnType<typeof updateCreateCardPolicyTemplateRequestState>;
|
|
8
|
-
/**
|
|
9
|
-
* `POST /cards/1.0/policy-templates` (bulk). Builds the bulk wire body
|
|
10
|
-
* from the camelCased action payload, sends one round-trip, and on
|
|
11
|
-
* success fans out:
|
|
12
|
-
* - one `updateCreatedCardPolicyTemplate` on the entity slice per row
|
|
13
|
-
* in `templates_created` (so the entity store is hydrated with every
|
|
14
|
-
* created template), and
|
|
15
|
-
* - one `updateCreateCardPolicyTemplateRequestState` with the ordered
|
|
16
|
-
* id list + per-item errors so the view can render partial-success
|
|
17
|
-
* UX without re-touching the wire types.
|
|
18
|
-
*
|
|
19
|
-
* Partial success (`errors.length > 0` with at least one template
|
|
20
|
-
* created) is still treated as `Completed` — the lifecycle is binary
|
|
21
|
-
* and the per-item errors live on the slice for the UI to inspect.
|
|
22
|
-
* Hard failures (non-success `status` or thrown errors) map to `Error`
|
|
23
|
-
* the same way they did pre-bulk.
|
|
24
|
-
*/
|
|
25
|
-
export declare const createCardPolicyTemplatesEpic: (actions$: ActionsObservable<ActionType>, _state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createCardPolicyTemplatesEpic = 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
|
-
/**
|
|
11
|
-
* `POST /cards/1.0/policy-templates` (bulk). Builds the bulk wire body
|
|
12
|
-
* from the camelCased action payload, sends one round-trip, and on
|
|
13
|
-
* success fans out:
|
|
14
|
-
* - one `updateCreatedCardPolicyTemplate` on the entity slice per row
|
|
15
|
-
* in `templates_created` (so the entity store is hydrated with every
|
|
16
|
-
* created template), and
|
|
17
|
-
* - one `updateCreateCardPolicyTemplateRequestState` with the ordered
|
|
18
|
-
* id list + per-item errors so the view can render partial-success
|
|
19
|
-
* UX without re-touching the wire types.
|
|
20
|
-
*
|
|
21
|
-
* Partial success (`errors.length > 0` with at least one template
|
|
22
|
-
* created) is still treated as `Completed` — the lifecycle is binary
|
|
23
|
-
* and the per-item errors live on the slice for the UI to inspect.
|
|
24
|
-
* Hard failures (non-success `status` or thrown errors) map to `Error`
|
|
25
|
-
* the same way they did pre-bulk.
|
|
26
|
-
*/
|
|
27
|
-
const createCardPolicyTemplatesEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(createCardPolicyReducer_1.createCardPolicyTemplates.match), (0, operators_1.mergeMap)((action) => {
|
|
28
|
-
const body = (0, cardPolicyPayload_1.toCreateCardPolicyTemplatesRequestBody)(action.payload);
|
|
29
|
-
return zeniAPI
|
|
30
|
-
.postAndGetJSON(`${zeniAPI.apiEndPoints.cardMicroServiceBaseUrl}/1.0/policy-templates`, body)
|
|
31
|
-
.pipe((0, operators_1.mergeMap)((response) => {
|
|
32
|
-
if ((0, responsePayload_1.isSuccessStatus)(response) && response.data != null) {
|
|
33
|
-
const { templates_created, errors } = response.data;
|
|
34
|
-
const createdTemplates = templates_created.map((row) => row.template);
|
|
35
|
-
const actions = [
|
|
36
|
-
...createdTemplates.map((template) => (0, cardPolicyReducer_1.updateCreatedCardPolicyTemplate)(template)),
|
|
37
|
-
(0, createCardPolicyReducer_1.updateCreateCardPolicyTemplateRequestState)({
|
|
38
|
-
fetchState: 'Completed',
|
|
39
|
-
perItemErrors: (errors ?? []).map(cardPolicyPayload_1.toBulkCreateCardPolicyTemplateError),
|
|
40
|
-
templateIds: createdTemplates.map((template) => template.template_id),
|
|
41
|
-
}),
|
|
42
|
-
];
|
|
43
|
-
return (0, rxjs_1.from)(actions);
|
|
44
|
-
}
|
|
45
|
-
else {
|
|
46
|
-
return (0, rxjs_1.of)((0, createCardPolicyReducer_1.updateCreateCardPolicyTemplateRequestState)({
|
|
47
|
-
fetchState: 'Error',
|
|
48
|
-
error: response.status,
|
|
49
|
-
}));
|
|
50
|
-
}
|
|
51
|
-
}), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, createCardPolicyReducer_1.updateCreateCardPolicyTemplateRequestState)({
|
|
52
|
-
fetchState: 'Error',
|
|
53
|
-
error: (0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Create card-policy templates REST API call errored out' +
|
|
54
|
-
JSON.stringify(error)),
|
|
55
|
-
}))));
|
|
56
|
-
}));
|
|
57
|
-
exports.createCardPolicyTemplatesEpic = createCardPolicyTemplatesEpic;
|
|
@@ -1,15 +0,0 @@
|
|
|
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>;
|
|
@@ -1,29 +0,0 @@
|
|
|
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),
|
|
9
|
-
// `exhaustMap` (rather than `mergeMap`) so a duplicate
|
|
10
|
-
// `fetchCardPolicyMccCategories` dispatched while the previous one
|
|
11
|
-
// is still in flight is dropped instead of producing a second HTTP
|
|
12
|
-
// request. Both the Create and Edit policy screens dispatch this
|
|
13
|
-
// on mount, and React 18 StrictMode invokes their mount effect
|
|
14
|
-
// twice with a stale `mccCategoriesFetchState` closure — without
|
|
15
|
-
// `exhaustMap` that yields two `/cards/mcc-codes` calls.
|
|
16
|
-
(0, operators_1.exhaustMap)(() => {
|
|
17
|
-
return zeniAPI
|
|
18
|
-
.getJSON(`${zeniAPI.apiEndPoints.cardMicroServiceBaseUrl}/1.0/cards/mcc-codes`)
|
|
19
|
-
.pipe((0, operators_1.mergeMap)((response) => {
|
|
20
|
-
if ((0, responsePayload_1.isSuccessStatus)(response) && response.data != null) {
|
|
21
|
-
return (0, rxjs_1.from)([(0, cardPolicyReducer_1.updateCardPolicyMccCategories)(response.data)]);
|
|
22
|
-
}
|
|
23
|
-
else {
|
|
24
|
-
return (0, rxjs_1.of)((0, cardPolicyReducer_1.updateCardPolicyMccCategoriesFailure)(response.status));
|
|
25
|
-
}
|
|
26
|
-
}), (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' +
|
|
27
|
-
JSON.stringify(error))))));
|
|
28
|
-
}));
|
|
29
|
-
exports.fetchCardPolicyMccCategoriesEpic = fetchCardPolicyMccCategoriesEpic;
|