@zeniai/client-epic-state 5.0.67-beta0ND → 5.0.67
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/entity/chargeCard/chargeCardReducer.d.ts +2 -19
- package/lib/entity/chargeCard/chargeCardReducer.js +2 -35
- package/lib/entity/chargeCardRepayment/chargeCardRepayment.d.ts +1 -1
- package/lib/entity/chargeCardTransaction/chargeCardTransactionReducer.d.ts +1 -14
- package/lib/entity/chargeCardTransaction/chargeCardTransactionReducer.js +2 -36
- package/lib/entity/creditAgent/creditAgentState.d.ts +1 -1
- package/lib/epic.d.ts +10 -11
- package/lib/epic.js +11 -12
- package/lib/esm/entity/chargeCard/chargeCardReducer.js +1 -34
- package/lib/esm/entity/chargeCardTransaction/chargeCardTransactionReducer.js +1 -35
- package/lib/esm/epic.js +11 -12
- package/lib/esm/index.js +13 -19
- package/lib/esm/reducer.js +2 -8
- package/lib/esm/view/expenseAutomationView/epics/missingReceipts/fetchCompletedTransactionsEpic.js +1 -2
- package/lib/esm/view/expenseAutomationView/epics/missingReceipts/searchTransactionsForManualMatchEpic.js +0 -6
- package/lib/esm/view/expenseAutomationView/epics/transactionCategorization/fetchTransactionCategorizationEpic.js +1 -11
- package/lib/esm/view/expenseAutomationView/reducers/missingReceiptsViewReducer.js +1 -2
- package/lib/esm/view/expenseAutomationView/reducers/transactionsViewReducer.js +1 -127
- package/lib/esm/view/expenseAutomationView/selectors/transactionCategorizationSelector.js +1 -20
- package/lib/esm/view/expenseAutomationView/types/missingReceiptsViewState.js +2 -0
- package/lib/esm/view/scheduleView/scheduleDetailView/epics/fetchScheduleDetailsPageEpic.js +0 -4
- package/lib/esm/view/spendManagement/chargeCards/cashbackDetail/cashbackDetailReducer.js +2 -3
- package/lib/esm/view/spendManagement/chargeCards/chargeCardConfig/chargeCardConfigReducer.js +2 -3
- package/lib/esm/view/spendManagement/chargeCards/chargeCardDetail/chargeCardDetailReducer.js +18 -55
- package/lib/esm/view/spendManagement/chargeCards/chargeCardDetail/fetchChargeCardDetailEpic.js +2 -16
- package/lib/esm/view/spendManagement/chargeCards/chargeCardDetail/fetchChargeCardDetailPageEpic.js +4 -5
- package/lib/esm/view/spendManagement/chargeCards/chargeCardList/chargeCardListReducer.js +9 -28
- package/lib/esm/view/spendManagement/chargeCards/chargeCardList/fetchChargeCardListPageEpic.js +6 -9
- package/lib/esm/view/spendManagement/chargeCards/chargeCardPaymentHistory/chargeCardPaymentHistoryReducer.js +2 -3
- package/lib/esm/view/spendManagement/chargeCards/chargeCardPaymentHistory/fetchChargeCardPaymentPageEpic.js +1 -1
- package/lib/esm/view/spendManagement/chargeCards/chargeCardRepaymentDetail/chargeCardRepaymentDetailReducer.js +3 -7
- package/lib/index.d.ts +15 -22
- package/lib/index.js +58 -77
- package/lib/reducer.d.ts +2 -8
- package/lib/reducer.js +2 -8
- package/lib/view/expenseAutomationView/epics/missingReceipts/fetchCompletedTransactionsEpic.js +1 -2
- package/lib/view/expenseAutomationView/epics/missingReceipts/searchTransactionsForManualMatchEpic.js +0 -6
- package/lib/view/expenseAutomationView/epics/transactionCategorization/fetchTransactionCategorizationEpic.d.ts +2 -2
- package/lib/view/expenseAutomationView/epics/transactionCategorization/fetchTransactionCategorizationEpic.js +0 -10
- package/lib/view/expenseAutomationView/payload/transactionCategorizationPayload.d.ts +0 -21
- package/lib/view/expenseAutomationView/reducers/missingReceiptsViewReducer.d.ts +1 -2
- package/lib/view/expenseAutomationView/reducers/missingReceiptsViewReducer.js +1 -2
- package/lib/view/expenseAutomationView/reducers/transactionsViewReducer.d.ts +2 -8
- package/lib/view/expenseAutomationView/reducers/transactionsViewReducer.js +2 -128
- package/lib/view/expenseAutomationView/selectorTypes/missingReceiptsSelectorTypes.d.ts +1 -2
- package/lib/view/expenseAutomationView/selectorTypes/transactionsViewSelectorTypes.d.ts +0 -14
- package/lib/view/expenseAutomationView/selectors/transactionCategorizationSelector.js +1 -20
- package/lib/view/expenseAutomationView/types/missingReceiptsViewState.d.ts +2 -1
- package/lib/view/expenseAutomationView/types/missingReceiptsViewState.js +4 -1
- package/lib/view/expenseAutomationView/types/transactionsViewState.d.ts +1 -40
- package/lib/view/scheduleView/scheduleDetailView/epics/fetchScheduleDetailsPageEpic.d.ts +1 -2
- package/lib/view/scheduleView/scheduleDetailView/epics/fetchScheduleDetailsPageEpic.js +0 -4
- package/lib/view/spendManagement/chargeCards/cashbackDetail/cashbackDetailReducer.d.ts +1 -3
- package/lib/view/spendManagement/chargeCards/cashbackDetail/cashbackDetailReducer.js +2 -3
- package/lib/view/spendManagement/chargeCards/chargeCardConfig/chargeCardConfigReducer.d.ts +1 -3
- package/lib/view/spendManagement/chargeCards/chargeCardConfig/chargeCardConfigReducer.js +2 -3
- package/lib/view/spendManagement/chargeCards/chargeCardDetail/chargeCardDetailReducer.js +18 -55
- package/lib/view/spendManagement/chargeCards/chargeCardDetail/fetchChargeCardDetailEpic.js +2 -16
- package/lib/view/spendManagement/chargeCards/chargeCardDetail/fetchChargeCardDetailPageEpic.js +4 -5
- package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardListReducer.d.ts +3 -18
- package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardListReducer.js +10 -29
- package/lib/view/spendManagement/chargeCards/chargeCardList/fetchChargeCardListPageEpic.js +6 -9
- package/lib/view/spendManagement/chargeCards/chargeCardPaymentHistory/chargeCardPaymentHistoryReducer.d.ts +1 -3
- package/lib/view/spendManagement/chargeCards/chargeCardPaymentHistory/chargeCardPaymentHistoryReducer.js +2 -3
- package/lib/view/spendManagement/chargeCards/chargeCardPaymentHistory/fetchChargeCardPaymentPageEpic.js +1 -1
- package/lib/view/spendManagement/chargeCards/chargeCardRepaymentDetail/chargeCardRepaymentDetailReducer.d.ts +1 -3
- package/lib/view/spendManagement/chargeCards/chargeCardRepaymentDetail/chargeCardRepaymentDetailReducer.js +3 -7
- package/package.json +1 -1
- package/lib/commonStateTypes/cacheOverrideFetchReducer.d.ts +0 -17
- package/lib/commonStateTypes/cacheOverrideFetchReducer.js +0 -20
- package/lib/commonStateTypes/pusherActions.d.ts +0 -11
- package/lib/commonStateTypes/pusherActions.js +0 -6
- package/lib/entity/scheduleActivityLog/scheduleActivityLogPayload.d.ts +0 -36
- package/lib/entity/scheduleActivityLog/scheduleActivityLogPayload.js +0 -55
- package/lib/entity/scheduleActivityLog/scheduleActivityLogReducer.d.ts +0 -6
- package/lib/entity/scheduleActivityLog/scheduleActivityLogReducer.js +0 -27
- package/lib/entity/scheduleActivityLog/scheduleActivityLogSelector.d.ts +0 -4
- package/lib/entity/scheduleActivityLog/scheduleActivityLogSelector.js +0 -17
- package/lib/entity/scheduleActivityLog/scheduleActivityLogState.d.ts +0 -51
- package/lib/entity/scheduleActivityLog/scheduleActivityLogState.js +0 -23
- package/lib/esm/commonStateTypes/cacheOverrideFetchReducer.js +0 -16
- package/lib/esm/commonStateTypes/pusherActions.js +0 -3
- package/lib/esm/entity/scheduleActivityLog/scheduleActivityLogPayload.js +0 -49
- package/lib/esm/entity/scheduleActivityLog/scheduleActivityLogReducer.js +0 -23
- package/lib/esm/entity/scheduleActivityLog/scheduleActivityLogSelector.js +0 -10
- package/lib/esm/entity/scheduleActivityLog/scheduleActivityLogState.js +0 -19
- package/lib/esm/view/expenseAutomationView/types/completedSubTab.js +0 -17
- package/lib/esm/view/scheduleActivityLogView/fetchScheduleActivityLogEpic.js +0 -43
- package/lib/esm/view/scheduleActivityLogView/scheduleActivityLogViewPayload.js +0 -1
- package/lib/esm/view/scheduleActivityLogView/scheduleActivityLogViewReducer.js +0 -47
- package/lib/esm/view/scheduleActivityLogView/scheduleActivityLogViewSelector.js +0 -33
- package/lib/esm/view/scheduleActivityLogView/scheduleActivityLogViewState.js +0 -1
- package/lib/tsconfig.typecheck.tsbuildinfo +0 -1
- package/lib/view/expenseAutomationView/types/completedSubTab.d.ts +0 -10
- package/lib/view/expenseAutomationView/types/completedSubTab.js +0 -21
- package/lib/view/scheduleActivityLogView/fetchScheduleActivityLogEpic.d.ts +0 -9
- package/lib/view/scheduleActivityLogView/fetchScheduleActivityLogEpic.js +0 -47
- package/lib/view/scheduleActivityLogView/scheduleActivityLogViewPayload.d.ts +0 -8
- package/lib/view/scheduleActivityLogView/scheduleActivityLogViewPayload.js +0 -2
- package/lib/view/scheduleActivityLogView/scheduleActivityLogViewReducer.d.ts +0 -17
- package/lib/view/scheduleActivityLogView/scheduleActivityLogViewReducer.js +0 -51
- package/lib/view/scheduleActivityLogView/scheduleActivityLogViewSelector.d.ts +0 -8
- package/lib/view/scheduleActivityLogView/scheduleActivityLogViewSelector.js +0 -36
- package/lib/view/scheduleActivityLogView/scheduleActivityLogViewState.d.ts +0 -5
- package/lib/view/scheduleActivityLogView/scheduleActivityLogViewState.js +0 -2
|
@@ -3,7 +3,6 @@ var _a;
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
exports.updatePaymentHistoryUIState = exports.updatePaymentHistoryDownloadUIState = exports.updatePaymentHistorySearchText = exports.updatePaymentHistoryFilters = exports.clearChargeCardPaymentHistory = exports.updateChargeCardPaymentHistoryFailure = exports.updateChargeCardPaymentHistory = exports.fetchChargeCardPaymentHistory = exports.fetchChargeCardPaymentPage = exports.addRepaymentToChargeCardPaymentHistory = exports.initialState = void 0;
|
|
5
5
|
const toolkit_1 = require("@reduxjs/toolkit");
|
|
6
|
-
const cacheOverrideFetchReducer_1 = require("../../../../commonStateTypes/cacheOverrideFetchReducer");
|
|
7
6
|
const chargeCardPaymentHistory_1 = require("./chargeCardPaymentHistory");
|
|
8
7
|
exports.initialState = chargeCardPaymentHistory_1.initialChargeCardPaymentHistoryState;
|
|
9
8
|
const chargeCardPaymentHistory = (0, toolkit_1.createSlice)({
|
|
@@ -22,10 +21,10 @@ const chargeCardPaymentHistory = (0, toolkit_1.createSlice)({
|
|
|
22
21
|
};
|
|
23
22
|
},
|
|
24
23
|
},
|
|
25
|
-
fetchChargeCardPaymentHistory
|
|
24
|
+
fetchChargeCardPaymentHistory(draft) {
|
|
26
25
|
draft.fetchState = 'In-Progress';
|
|
27
26
|
draft.error = undefined;
|
|
28
|
-
}
|
|
27
|
+
},
|
|
29
28
|
updateChargeCardPaymentHistory(draft, action) {
|
|
30
29
|
const payload = action.payload;
|
|
31
30
|
draft.creditAccountId = payload.credit_account_id;
|
|
@@ -11,7 +11,7 @@ const fetchChargeCardPaymentPageEpic = (actions$, state$) => actions$.pipe((0, o
|
|
|
11
11
|
const state = state$.value;
|
|
12
12
|
const chargeCardPaymentHistoryState = state.chargeCardPaymentHistoryState;
|
|
13
13
|
if (cacheOverride === true) {
|
|
14
|
-
chargeCardPaymentPageActions.push((0, chargeCardPaymentHistoryReducer_1.fetchChargeCardPaymentHistory)(
|
|
14
|
+
chargeCardPaymentPageActions.push((0, chargeCardPaymentHistoryReducer_1.fetchChargeCardPaymentHistory)());
|
|
15
15
|
}
|
|
16
16
|
else {
|
|
17
17
|
if (chargeCardPaymentHistoryState.fetchState !== 'Completed' &&
|
|
@@ -3,9 +3,7 @@ import { ZeniAPIStatus } from '../../../../responsePayload';
|
|
|
3
3
|
import { FundingAccount } from '../../commonSetup/setupViewSelector';
|
|
4
4
|
import { ChargeCardRepaymentDetailLocalData, ChargeCardRepaymentDetailState } from './chargeCardRepaymentDetailState';
|
|
5
5
|
export declare const initialState: ChargeCardRepaymentDetailState;
|
|
6
|
-
export declare const fetchChargeCardRepaymentDetail: import("@reduxjs/toolkit").
|
|
7
|
-
cacheOverride: boolean;
|
|
8
|
-
}, "chargeCardRepaymentDetail/fetchChargeCardRepaymentDetail", never, never>, initiateChargeCardRepayment: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
6
|
+
export declare const fetchChargeCardRepaymentDetail: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"chargeCardRepaymentDetail/fetchChargeCardRepaymentDetail">, initiateChargeCardRepayment: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
9
7
|
companyId: ID;
|
|
10
8
|
}, "chargeCardRepaymentDetail/initiateChargeCardRepayment">, updateNewAddedChargeCardPaymentAccount: import("@reduxjs/toolkit").ActionCreatorWithPayload<FundingAccount, "chargeCardRepaymentDetail/updateNewAddedChargeCardPaymentAccount">, updateChargeCardRepaymentLocalStore: import("@reduxjs/toolkit").ActionCreatorWithPayload<ChargeCardRepaymentDetailLocalData, "chargeCardRepaymentDetail/updateChargeCardRepaymentLocalStore">, updateChargeCardRepaymentStatus: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
11
9
|
fetchState: FetchState;
|
|
@@ -3,7 +3,6 @@ var _a;
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
exports.clearChargeCardRepaymentDetail = exports.updateChargeCardRepaymentStatus = exports.updateChargeCardRepaymentLocalStore = exports.updateNewAddedChargeCardPaymentAccount = exports.initiateChargeCardRepayment = exports.fetchChargeCardRepaymentDetail = exports.initialState = void 0;
|
|
5
5
|
const toolkit_1 = require("@reduxjs/toolkit");
|
|
6
|
-
const cacheOverrideFetchReducer_1 = require("../../../../commonStateTypes/cacheOverrideFetchReducer");
|
|
7
6
|
exports.initialState = {
|
|
8
7
|
localData: {
|
|
9
8
|
amount: {
|
|
@@ -22,12 +21,9 @@ const chargeCardRepaymentDetail = (0, toolkit_1.createSlice)({
|
|
|
22
21
|
name: 'chargeCardRepaymentDetail',
|
|
23
22
|
initialState: exports.initialState,
|
|
24
23
|
reducers: {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
fetchChargeCardRepaymentDetail: (0, cacheOverrideFetchReducer_1.createCacheOverrideFetchReducer)(() => {
|
|
29
|
-
// do nothing
|
|
30
|
-
}),
|
|
24
|
+
fetchChargeCardRepaymentDetail() {
|
|
25
|
+
//do nothing
|
|
26
|
+
},
|
|
31
27
|
updateChargeCardRepaymentLocalStore(draft, action) {
|
|
32
28
|
draft.localData = action.payload;
|
|
33
29
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zeniai/client-epic-state",
|
|
3
|
-
"version": "5.0.67
|
|
3
|
+
"version": "5.0.67",
|
|
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",
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { PayloadAction, Draft } from '@reduxjs/toolkit';
|
|
2
|
-
/**
|
|
3
|
-
* Factory for `fetchXxx` reducers that support Pusher-driven silent refresh.
|
|
4
|
-
* When `cacheOverride=true`, fetchState and error are left untouched so the
|
|
5
|
-
* UI doesn't flash a skeleton. When `false`, `applyTo` runs the normal
|
|
6
|
-
* 'In-Progress' transition.
|
|
7
|
-
*/
|
|
8
|
-
export declare const createCacheOverrideFetchReducer: <TState>(applyTo: (draft: Draft<TState>) => void) => {
|
|
9
|
-
prepare: (cacheOverride?: boolean) => {
|
|
10
|
-
payload: {
|
|
11
|
-
cacheOverride: boolean;
|
|
12
|
-
};
|
|
13
|
-
};
|
|
14
|
-
reducer: (draft: Draft<TState>, action: PayloadAction<{
|
|
15
|
-
cacheOverride: boolean;
|
|
16
|
-
}>) => void;
|
|
17
|
-
};
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createCacheOverrideFetchReducer = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* Factory for `fetchXxx` reducers that support Pusher-driven silent refresh.
|
|
6
|
-
* When `cacheOverride=true`, fetchState and error are left untouched so the
|
|
7
|
-
* UI doesn't flash a skeleton. When `false`, `applyTo` runs the normal
|
|
8
|
-
* 'In-Progress' transition.
|
|
9
|
-
*/
|
|
10
|
-
const createCacheOverrideFetchReducer = (applyTo) => ({
|
|
11
|
-
reducer(draft, action) {
|
|
12
|
-
if (action.payload.cacheOverride !== true) {
|
|
13
|
-
applyTo(draft);
|
|
14
|
-
}
|
|
15
|
-
},
|
|
16
|
-
prepare(cacheOverride = false) {
|
|
17
|
-
return { payload: { cacheOverride } };
|
|
18
|
-
},
|
|
19
|
-
});
|
|
20
|
-
exports.createCacheOverrideFetchReducer = createCacheOverrideFetchReducer;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { ID } from './common';
|
|
2
|
-
import { ChargeCardTransactionPayload } from '../entity/chargeCardTransaction/chargeCardTransactionPayload';
|
|
3
|
-
export declare const addChargeCardTransactionFromPusher: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
4
|
-
cardId: ID;
|
|
5
|
-
transaction: ChargeCardTransactionPayload;
|
|
6
|
-
}, string>;
|
|
7
|
-
export declare const addDeclinedChargeCardTransactionFromPusher: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
8
|
-
cardId: ID;
|
|
9
|
-
transaction: ChargeCardTransactionPayload;
|
|
10
|
-
declineReason?: string;
|
|
11
|
-
}, string>;
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.addDeclinedChargeCardTransactionFromPusher = exports.addChargeCardTransactionFromPusher = void 0;
|
|
4
|
-
const toolkit_1 = require("@reduxjs/toolkit");
|
|
5
|
-
exports.addChargeCardTransactionFromPusher = (0, toolkit_1.createAction)('chargeCardDetail/addChargeCardTransactionFromPusher');
|
|
6
|
-
exports.addDeclinedChargeCardTransactionFromPusher = (0, toolkit_1.createAction)('chargeCardDetail/addDeclinedChargeCardTransactionFromPusher');
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { AccountBasePayload } from '../account/accountPayload';
|
|
2
|
-
import { ClassBasePayload } from '../class/classPayload';
|
|
3
|
-
import { AISummaryPayload } from '../transaction/payloadTypes/transactionLinePayload';
|
|
4
|
-
import { VendorBasePayload } from '../vendor/vendorPayload';
|
|
5
|
-
import { ScheduleActivityLog, ScheduleActivityLogData } from './scheduleActivityLogState';
|
|
6
|
-
export interface ScheduleActivityLogLinePayload {
|
|
7
|
-
account?: AccountBasePayload;
|
|
8
|
-
accounting_class?: ClassBasePayload;
|
|
9
|
-
line_description?: string;
|
|
10
|
-
schedule_memo?: string;
|
|
11
|
-
transaction_memo?: string;
|
|
12
|
-
vendor?: VendorBasePayload;
|
|
13
|
-
}
|
|
14
|
-
export interface ScheduleActivityLogTransactionPayload {
|
|
15
|
-
line_id: string;
|
|
16
|
-
original_line: ScheduleActivityLogLinePayload;
|
|
17
|
-
updated_line: ScheduleActivityLogLinePayload;
|
|
18
|
-
schedule_id?: string;
|
|
19
|
-
transaction_id?: string;
|
|
20
|
-
}
|
|
21
|
-
export interface ScheduleActivityLogDataPayload {
|
|
22
|
-
transaction: ScheduleActivityLogTransactionPayload;
|
|
23
|
-
ai_summaries?: AISummaryPayload[];
|
|
24
|
-
user_id?: string;
|
|
25
|
-
}
|
|
26
|
-
export interface ScheduleActivityLogPayload {
|
|
27
|
-
correlation_id: string;
|
|
28
|
-
create_time: string;
|
|
29
|
-
data: ScheduleActivityLogDataPayload | null;
|
|
30
|
-
event_type: string;
|
|
31
|
-
processing_time_ms: number;
|
|
32
|
-
status_code: string;
|
|
33
|
-
}
|
|
34
|
-
export declare const toScheduleActivityLogId: (correlationId: string, eventType: string, lineId: string | null | undefined) => string;
|
|
35
|
-
export declare const toScheduleActivityLogData: (data: ScheduleActivityLogDataPayload, correlationId: string) => ScheduleActivityLogData;
|
|
36
|
-
export declare const toScheduleActivityLog: (payload: ScheduleActivityLogPayload) => ScheduleActivityLog;
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.toScheduleActivityLog = exports.toScheduleActivityLogData = exports.toScheduleActivityLogId = void 0;
|
|
4
|
-
const zeniDayJS_1 = require("../../zeniDayJS");
|
|
5
|
-
const accountPayload_1 = require("../account/accountPayload");
|
|
6
|
-
const classPayload_1 = require("../class/classPayload");
|
|
7
|
-
const transactionLinePayload_1 = require("../transaction/payloadTypes/transactionLinePayload");
|
|
8
|
-
const vendorPayload_1 = require("../vendor/vendorPayload");
|
|
9
|
-
const scheduleActivityLogState_1 = require("./scheduleActivityLogState");
|
|
10
|
-
const toScheduleActivityLogId = (correlationId, eventType, lineId) => `${correlationId}-${eventType}-${lineId ?? '1'}`;
|
|
11
|
-
exports.toScheduleActivityLogId = toScheduleActivityLogId;
|
|
12
|
-
const toScheduleActivityLogLine = (line) => {
|
|
13
|
-
const memo = line.schedule_memo ?? line.transaction_memo;
|
|
14
|
-
return {
|
|
15
|
-
account: line.account
|
|
16
|
-
? (0, accountPayload_1.mapAccountBasePayloadToAccountBase)(line.account)
|
|
17
|
-
: undefined,
|
|
18
|
-
class: line.accounting_class
|
|
19
|
-
? (0, classPayload_1.mapClassBasePayloadToClassBase)(line.accounting_class)
|
|
20
|
-
: undefined,
|
|
21
|
-
vendor: line.vendor
|
|
22
|
-
? (0, vendorPayload_1.mapVendorBasePayloadToVendorBase)(line.vendor)
|
|
23
|
-
: undefined,
|
|
24
|
-
memo,
|
|
25
|
-
description: line.line_description,
|
|
26
|
-
};
|
|
27
|
-
};
|
|
28
|
-
const toTransaction = (transaction, correlationId, userId) => {
|
|
29
|
-
return {
|
|
30
|
-
lineId: transaction.line_id,
|
|
31
|
-
originalLine: toScheduleActivityLogLine(transaction.original_line),
|
|
32
|
-
updatedLine: toScheduleActivityLogLine(transaction.updated_line),
|
|
33
|
-
correlationId,
|
|
34
|
-
userId,
|
|
35
|
-
};
|
|
36
|
-
};
|
|
37
|
-
const toScheduleActivityLogData = (data, correlationId) => {
|
|
38
|
-
return {
|
|
39
|
-
aiSummaries: (data.ai_summaries ?? []).map(transactionLinePayload_1.toAISummary),
|
|
40
|
-
transaction: toTransaction(data.transaction, correlationId, data.user_id),
|
|
41
|
-
user: undefined,
|
|
42
|
-
};
|
|
43
|
-
};
|
|
44
|
-
exports.toScheduleActivityLogData = toScheduleActivityLogData;
|
|
45
|
-
const toScheduleActivityLog = (payload) => {
|
|
46
|
-
return {
|
|
47
|
-
id: (0, exports.toScheduleActivityLogId)(payload.correlation_id, payload.event_type, payload.data?.transaction?.line_id),
|
|
48
|
-
data: payload.data != null
|
|
49
|
-
? (0, exports.toScheduleActivityLogData)(payload.data, payload.correlation_id)
|
|
50
|
-
: null,
|
|
51
|
-
eventType: (0, scheduleActivityLogState_1.toScheduleActivityLogEventType)(payload.event_type),
|
|
52
|
-
createTime: (0, zeniDayJS_1.date)(payload.create_time),
|
|
53
|
-
};
|
|
54
|
-
};
|
|
55
|
-
exports.toScheduleActivityLog = toScheduleActivityLog;
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { ScheduleActivityLogPayload } from './scheduleActivityLogPayload';
|
|
2
|
-
import { ScheduleActivityLogState } from './scheduleActivityLogState';
|
|
3
|
-
export declare const initialState: ScheduleActivityLogState;
|
|
4
|
-
export declare const updateScheduleActivityLogs: import("@reduxjs/toolkit").ActionCreatorWithPayload<ScheduleActivityLogPayload[], "scheduleActivityLog/updateScheduleActivityLogs">, clearAllScheduleActivityLogs: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"scheduleActivityLog/clearAllScheduleActivityLogs">;
|
|
5
|
-
declare const _default: import("redux").Reducer<ScheduleActivityLogState>;
|
|
6
|
-
export default _default;
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var _a;
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.clearAllScheduleActivityLogs = exports.updateScheduleActivityLogs = exports.initialState = void 0;
|
|
5
|
-
const toolkit_1 = require("@reduxjs/toolkit");
|
|
6
|
-
const scheduleActivityLogPayload_1 = require("./scheduleActivityLogPayload");
|
|
7
|
-
exports.initialState = {
|
|
8
|
-
scheduleActivityLogById: {},
|
|
9
|
-
};
|
|
10
|
-
const scheduleActivityLog = (0, toolkit_1.createSlice)({
|
|
11
|
-
name: 'scheduleActivityLog',
|
|
12
|
-
initialState: exports.initialState,
|
|
13
|
-
reducers: {
|
|
14
|
-
updateScheduleActivityLogs(draft, action) {
|
|
15
|
-
action.payload.forEach((scheduleActivityLogPayload) => {
|
|
16
|
-
const scheduleActivityLog = (0, scheduleActivityLogPayload_1.toScheduleActivityLog)(scheduleActivityLogPayload);
|
|
17
|
-
draft.scheduleActivityLogById[scheduleActivityLog.id] =
|
|
18
|
-
scheduleActivityLog;
|
|
19
|
-
});
|
|
20
|
-
},
|
|
21
|
-
clearAllScheduleActivityLogs(draft) {
|
|
22
|
-
draft.scheduleActivityLogById = {};
|
|
23
|
-
},
|
|
24
|
-
},
|
|
25
|
-
});
|
|
26
|
-
_a = scheduleActivityLog.actions, exports.updateScheduleActivityLogs = _a.updateScheduleActivityLogs, exports.clearAllScheduleActivityLogs = _a.clearAllScheduleActivityLogs;
|
|
27
|
-
exports.default = scheduleActivityLog.reducer;
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { ID } from '../../commonStateTypes/common';
|
|
2
|
-
import { ScheduleActivityLog, ScheduleActivityLogState } from './scheduleActivityLogState';
|
|
3
|
-
export declare function getScheduleActivityLogsByIds(scheduleActivityLogState: ScheduleActivityLogState, scheduleActivityLogIds: ID[]): ScheduleActivityLog[];
|
|
4
|
-
export declare function getScheduleActivityLogById(scheduleActivityLogState: ScheduleActivityLogState, scheduleActivityLogId: ID): ScheduleActivityLog | undefined;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.getScheduleActivityLogsByIds = getScheduleActivityLogsByIds;
|
|
7
|
-
exports.getScheduleActivityLogById = getScheduleActivityLogById;
|
|
8
|
-
const get_1 = __importDefault(require("lodash/get"));
|
|
9
|
-
function getScheduleActivityLogsByIds(scheduleActivityLogState, scheduleActivityLogIds) {
|
|
10
|
-
const scheduleActivityLogs = scheduleActivityLogIds
|
|
11
|
-
.map((scheduleActivityLogId) => getScheduleActivityLogById(scheduleActivityLogState, scheduleActivityLogId))
|
|
12
|
-
.filter((value) => value != null);
|
|
13
|
-
return scheduleActivityLogs;
|
|
14
|
-
}
|
|
15
|
-
function getScheduleActivityLogById(scheduleActivityLogState, scheduleActivityLogId) {
|
|
16
|
-
return (0, get_1.default)(scheduleActivityLogState.scheduleActivityLogById, scheduleActivityLogId, undefined);
|
|
17
|
-
}
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import { ID } from '../../commonStateTypes/common';
|
|
2
|
-
import { ZeniDate } from '../../zeniDayJS';
|
|
3
|
-
import { AccountBase } from '../account/accountState';
|
|
4
|
-
import { ClassBase } from '../class/classState';
|
|
5
|
-
import { AISummary } from '../transaction/stateTypes/transactionLine';
|
|
6
|
-
import { User } from '../user/userState';
|
|
7
|
-
import { VendorBase } from '../vendor/vendorState';
|
|
8
|
-
/**
|
|
9
|
-
* Phase 1 retains a small placeholder union; Phase 2 will extend with real
|
|
10
|
-
* schedule event types (schedule.created, agent_je.detected, agent_je.drafted,
|
|
11
|
-
* je.posted, schedule.user_update.<field>, etc.) once the backend contract is
|
|
12
|
-
* finalised. Keeping the union narrow lets `toScheduleActivityLogEventType`
|
|
13
|
-
* fall back to the raw string for unknown events without throwing.
|
|
14
|
-
*/
|
|
15
|
-
export declare const ALL_SCHEDULE_ACTIVITY_LOG_EVENT_TYPE: readonly ["schedule.created", "schedule.user_update", "agent_je.detected", "agent_je.eligible", "agent_je.deleted", "agent_je.drafted", "je.posted", "transaction.sync_database"];
|
|
16
|
-
export declare const toScheduleActivityLogEventType: (v: string) => "schedule.created" | "schedule.user_update" | "agent_je.detected" | "agent_je.eligible" | "agent_je.deleted" | "agent_je.drafted" | "je.posted" | "transaction.sync_database";
|
|
17
|
-
export type ScheduleActivityLogEventType = ReturnType<typeof toScheduleActivityLogEventType>;
|
|
18
|
-
/**
|
|
19
|
-
* Per-line snapshot fields the backend may include in original/updated_line.
|
|
20
|
-
* Phase 1 keeps this aligned with the transaction activity log shape so the
|
|
21
|
-
* fetcher and reducer don't need any payload-specific work; Phase 3 will use
|
|
22
|
-
* this structure to render the per-event detail cards.
|
|
23
|
-
*/
|
|
24
|
-
export interface ScheduleActivityLogLine {
|
|
25
|
-
account?: AccountBase;
|
|
26
|
-
class?: ClassBase;
|
|
27
|
-
description?: string;
|
|
28
|
-
memo?: string;
|
|
29
|
-
vendor?: VendorBase;
|
|
30
|
-
}
|
|
31
|
-
export interface ScheduleActivityLogTransaction {
|
|
32
|
-
lineId: ID;
|
|
33
|
-
originalLine: ScheduleActivityLogLine;
|
|
34
|
-
updatedLine: ScheduleActivityLogLine;
|
|
35
|
-
correlationId?: string;
|
|
36
|
-
userId?: string;
|
|
37
|
-
}
|
|
38
|
-
export interface ScheduleActivityLogData {
|
|
39
|
-
aiSummaries: AISummary[];
|
|
40
|
-
transaction: ScheduleActivityLogTransaction;
|
|
41
|
-
user?: User;
|
|
42
|
-
}
|
|
43
|
-
export interface ScheduleActivityLog {
|
|
44
|
-
createTime: ZeniDate;
|
|
45
|
-
data: ScheduleActivityLogData | null;
|
|
46
|
-
eventType: ScheduleActivityLogEventType;
|
|
47
|
-
id: ID;
|
|
48
|
-
}
|
|
49
|
-
export interface ScheduleActivityLogState {
|
|
50
|
-
scheduleActivityLogById: Record<ID, ScheduleActivityLog>;
|
|
51
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.toScheduleActivityLogEventType = exports.ALL_SCHEDULE_ACTIVITY_LOG_EVENT_TYPE = void 0;
|
|
4
|
-
const stringToUnion_1 = require("../../commonStateTypes/stringToUnion");
|
|
5
|
-
/**
|
|
6
|
-
* Phase 1 retains a small placeholder union; Phase 2 will extend with real
|
|
7
|
-
* schedule event types (schedule.created, agent_je.detected, agent_je.drafted,
|
|
8
|
-
* je.posted, schedule.user_update.<field>, etc.) once the backend contract is
|
|
9
|
-
* finalised. Keeping the union narrow lets `toScheduleActivityLogEventType`
|
|
10
|
-
* fall back to the raw string for unknown events without throwing.
|
|
11
|
-
*/
|
|
12
|
-
exports.ALL_SCHEDULE_ACTIVITY_LOG_EVENT_TYPE = [
|
|
13
|
-
'schedule.created',
|
|
14
|
-
'schedule.user_update',
|
|
15
|
-
'agent_je.detected',
|
|
16
|
-
'agent_je.eligible',
|
|
17
|
-
'agent_je.deleted',
|
|
18
|
-
'agent_je.drafted',
|
|
19
|
-
'je.posted',
|
|
20
|
-
'transaction.sync_database',
|
|
21
|
-
];
|
|
22
|
-
const toScheduleActivityLogEventType = (v) => (0, stringToUnion_1.stringToUnion)(v, exports.ALL_SCHEDULE_ACTIVITY_LOG_EVENT_TYPE);
|
|
23
|
-
exports.toScheduleActivityLogEventType = toScheduleActivityLogEventType;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Factory for `fetchXxx` reducers that support Pusher-driven silent refresh.
|
|
3
|
-
* When `cacheOverride=true`, fetchState and error are left untouched so the
|
|
4
|
-
* UI doesn't flash a skeleton. When `false`, `applyTo` runs the normal
|
|
5
|
-
* 'In-Progress' transition.
|
|
6
|
-
*/
|
|
7
|
-
export const createCacheOverrideFetchReducer = (applyTo) => ({
|
|
8
|
-
reducer(draft, action) {
|
|
9
|
-
if (action.payload.cacheOverride !== true) {
|
|
10
|
-
applyTo(draft);
|
|
11
|
-
}
|
|
12
|
-
},
|
|
13
|
-
prepare(cacheOverride = false) {
|
|
14
|
-
return { payload: { cacheOverride } };
|
|
15
|
-
},
|
|
16
|
-
});
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import { createAction } from '@reduxjs/toolkit';
|
|
2
|
-
export const addChargeCardTransactionFromPusher = createAction('chargeCardDetail/addChargeCardTransactionFromPusher');
|
|
3
|
-
export const addDeclinedChargeCardTransactionFromPusher = createAction('chargeCardDetail/addDeclinedChargeCardTransactionFromPusher');
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import { date } from '../../zeniDayJS';
|
|
2
|
-
import { mapAccountBasePayloadToAccountBase, } from '../account/accountPayload';
|
|
3
|
-
import { mapClassBasePayloadToClassBase, } from '../class/classPayload';
|
|
4
|
-
import { toAISummary, } from '../transaction/payloadTypes/transactionLinePayload';
|
|
5
|
-
import { mapVendorBasePayloadToVendorBase, } from '../vendor/vendorPayload';
|
|
6
|
-
import { toScheduleActivityLogEventType, } from './scheduleActivityLogState';
|
|
7
|
-
export const toScheduleActivityLogId = (correlationId, eventType, lineId) => `${correlationId}-${eventType}-${lineId ?? '1'}`;
|
|
8
|
-
const toScheduleActivityLogLine = (line) => {
|
|
9
|
-
const memo = line.schedule_memo ?? line.transaction_memo;
|
|
10
|
-
return {
|
|
11
|
-
account: line.account
|
|
12
|
-
? mapAccountBasePayloadToAccountBase(line.account)
|
|
13
|
-
: undefined,
|
|
14
|
-
class: line.accounting_class
|
|
15
|
-
? mapClassBasePayloadToClassBase(line.accounting_class)
|
|
16
|
-
: undefined,
|
|
17
|
-
vendor: line.vendor
|
|
18
|
-
? mapVendorBasePayloadToVendorBase(line.vendor)
|
|
19
|
-
: undefined,
|
|
20
|
-
memo,
|
|
21
|
-
description: line.line_description,
|
|
22
|
-
};
|
|
23
|
-
};
|
|
24
|
-
const toTransaction = (transaction, correlationId, userId) => {
|
|
25
|
-
return {
|
|
26
|
-
lineId: transaction.line_id,
|
|
27
|
-
originalLine: toScheduleActivityLogLine(transaction.original_line),
|
|
28
|
-
updatedLine: toScheduleActivityLogLine(transaction.updated_line),
|
|
29
|
-
correlationId,
|
|
30
|
-
userId,
|
|
31
|
-
};
|
|
32
|
-
};
|
|
33
|
-
export const toScheduleActivityLogData = (data, correlationId) => {
|
|
34
|
-
return {
|
|
35
|
-
aiSummaries: (data.ai_summaries ?? []).map(toAISummary),
|
|
36
|
-
transaction: toTransaction(data.transaction, correlationId, data.user_id),
|
|
37
|
-
user: undefined,
|
|
38
|
-
};
|
|
39
|
-
};
|
|
40
|
-
export const toScheduleActivityLog = (payload) => {
|
|
41
|
-
return {
|
|
42
|
-
id: toScheduleActivityLogId(payload.correlation_id, payload.event_type, payload.data?.transaction?.line_id),
|
|
43
|
-
data: payload.data != null
|
|
44
|
-
? toScheduleActivityLogData(payload.data, payload.correlation_id)
|
|
45
|
-
: null,
|
|
46
|
-
eventType: toScheduleActivityLogEventType(payload.event_type),
|
|
47
|
-
createTime: date(payload.create_time),
|
|
48
|
-
};
|
|
49
|
-
};
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { createSlice } from '@reduxjs/toolkit';
|
|
2
|
-
import { toScheduleActivityLog, } from './scheduleActivityLogPayload';
|
|
3
|
-
export const initialState = {
|
|
4
|
-
scheduleActivityLogById: {},
|
|
5
|
-
};
|
|
6
|
-
const scheduleActivityLog = createSlice({
|
|
7
|
-
name: 'scheduleActivityLog',
|
|
8
|
-
initialState,
|
|
9
|
-
reducers: {
|
|
10
|
-
updateScheduleActivityLogs(draft, action) {
|
|
11
|
-
action.payload.forEach((scheduleActivityLogPayload) => {
|
|
12
|
-
const scheduleActivityLog = toScheduleActivityLog(scheduleActivityLogPayload);
|
|
13
|
-
draft.scheduleActivityLogById[scheduleActivityLog.id] =
|
|
14
|
-
scheduleActivityLog;
|
|
15
|
-
});
|
|
16
|
-
},
|
|
17
|
-
clearAllScheduleActivityLogs(draft) {
|
|
18
|
-
draft.scheduleActivityLogById = {};
|
|
19
|
-
},
|
|
20
|
-
},
|
|
21
|
-
});
|
|
22
|
-
export const { updateScheduleActivityLogs, clearAllScheduleActivityLogs } = scheduleActivityLog.actions;
|
|
23
|
-
export default scheduleActivityLog.reducer;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import recordGet from 'lodash/get';
|
|
2
|
-
export function getScheduleActivityLogsByIds(scheduleActivityLogState, scheduleActivityLogIds) {
|
|
3
|
-
const scheduleActivityLogs = scheduleActivityLogIds
|
|
4
|
-
.map((scheduleActivityLogId) => getScheduleActivityLogById(scheduleActivityLogState, scheduleActivityLogId))
|
|
5
|
-
.filter((value) => value != null);
|
|
6
|
-
return scheduleActivityLogs;
|
|
7
|
-
}
|
|
8
|
-
export function getScheduleActivityLogById(scheduleActivityLogState, scheduleActivityLogId) {
|
|
9
|
-
return recordGet(scheduleActivityLogState.scheduleActivityLogById, scheduleActivityLogId, undefined);
|
|
10
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { stringToUnion } from '../../commonStateTypes/stringToUnion';
|
|
2
|
-
/**
|
|
3
|
-
* Phase 1 retains a small placeholder union; Phase 2 will extend with real
|
|
4
|
-
* schedule event types (schedule.created, agent_je.detected, agent_je.drafted,
|
|
5
|
-
* je.posted, schedule.user_update.<field>, etc.) once the backend contract is
|
|
6
|
-
* finalised. Keeping the union narrow lets `toScheduleActivityLogEventType`
|
|
7
|
-
* fall back to the raw string for unknown events without throwing.
|
|
8
|
-
*/
|
|
9
|
-
export const ALL_SCHEDULE_ACTIVITY_LOG_EVENT_TYPE = [
|
|
10
|
-
'schedule.created',
|
|
11
|
-
'schedule.user_update',
|
|
12
|
-
'agent_je.detected',
|
|
13
|
-
'agent_je.eligible',
|
|
14
|
-
'agent_je.deleted',
|
|
15
|
-
'agent_je.drafted',
|
|
16
|
-
'je.posted',
|
|
17
|
-
'transaction.sync_database',
|
|
18
|
-
];
|
|
19
|
-
export const toScheduleActivityLogEventType = (v) => stringToUnion(v, ALL_SCHEDULE_ACTIVITY_LOG_EVENT_TYPE);
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { stringToUnion } from '../../../commonStateTypes/stringToUnion';
|
|
2
|
-
/**
|
|
3
|
-
* Sub-tabs that can appear under any "Completed" tab in the Expense Automation
|
|
4
|
-
* surface (Transaction Categorization Completed and Missing Receipts Completed
|
|
5
|
-
* both use this exact union). Forwarded verbatim to listing APIs as `sub_tab`
|
|
6
|
-
* / `match_type`. `'all'` preserves parent-tab semantics on the backend.
|
|
7
|
-
*/
|
|
8
|
-
const COMPLETED_SUB_TABS = ['all', 'ai_accountant', 'manual'];
|
|
9
|
-
export const toCompletedSubTab = (v) => stringToUnion(v.trim().toLowerCase(), COMPLETED_SUB_TABS);
|
|
10
|
-
/**
|
|
11
|
-
* "No sub-tab filter" sentinel — single source of truth for the default
|
|
12
|
-
* value of {@link CompletedSubTab}. Use this constant in initial slice
|
|
13
|
-
* state and at any call site that needs to fall back to the parent-tab
|
|
14
|
-
* listing semantics (review tab requests, manual-search overrides, etc.)
|
|
15
|
-
* so a future rename of the union doesn't require chasing literals.
|
|
16
|
-
*/
|
|
17
|
-
export const DEFAULT_COMPLETED_SUB_TAB = 'all';
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import { from, of } from 'rxjs';
|
|
2
|
-
import { catchError, filter, mergeMap, switchMap } from 'rxjs/operators';
|
|
3
|
-
import { updateScheduleActivityLogs } from '../../entity/scheduleActivityLog/scheduleActivityLogReducer';
|
|
4
|
-
import { updateAllUsers } from '../../entity/user/userReducer';
|
|
5
|
-
import { createZeniAPIStatus, isSuccessResponse } from '../../responsePayload';
|
|
6
|
-
import { fetchScheduleActivityLog, updateScheduleActivityLogViewFetchStatus, updateScheduleActivityLogViewOnSuccess, } from './scheduleActivityLogViewReducer';
|
|
7
|
-
export const fetchScheduleActivityLogEpic = (actions$, _, zeniAPI) => actions$.pipe(filter(fetchScheduleActivityLog.match), switchMap((action) => {
|
|
8
|
-
const { scheduleId } = action.payload;
|
|
9
|
-
return zeniAPI
|
|
10
|
-
.getJSON(`${zeniAPI.apiEndPoints.accountMicroServiceBaseUrl}/1.0/schedules/${scheduleId}/activity`)
|
|
11
|
-
.pipe(mergeMap((response) => {
|
|
12
|
-
if (isSuccessResponse(response) &&
|
|
13
|
-
response.data != null &&
|
|
14
|
-
response.data.activity != null) {
|
|
15
|
-
const updateActions = [];
|
|
16
|
-
if (response.data.users != null &&
|
|
17
|
-
response.data.users.length > 0) {
|
|
18
|
-
updateActions.push(updateAllUsers({
|
|
19
|
-
users: response.data.users,
|
|
20
|
-
updateType: 'merge',
|
|
21
|
-
}));
|
|
22
|
-
}
|
|
23
|
-
updateActions.push(updateScheduleActivityLogs(response.data.activity));
|
|
24
|
-
updateActions.push(updateScheduleActivityLogViewOnSuccess({
|
|
25
|
-
data: response.data.activity,
|
|
26
|
-
scheduleId,
|
|
27
|
-
}));
|
|
28
|
-
return from(updateActions);
|
|
29
|
-
}
|
|
30
|
-
else {
|
|
31
|
-
return of(updateScheduleActivityLogViewFetchStatus({
|
|
32
|
-
fetchState: 'Error',
|
|
33
|
-
error: response.status,
|
|
34
|
-
scheduleId,
|
|
35
|
-
}));
|
|
36
|
-
}
|
|
37
|
-
}), catchError((error) => of(updateScheduleActivityLogViewFetchStatus({
|
|
38
|
-
scheduleId,
|
|
39
|
-
fetchState: 'Error',
|
|
40
|
-
error: createZeniAPIStatus('Unexpected Error', 'fetch schedule activity log REST API call errored out' +
|
|
41
|
-
JSON.stringify(error)),
|
|
42
|
-
}))));
|
|
43
|
-
}));
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { createSlice } from '@reduxjs/toolkit';
|
|
2
|
-
import { toScheduleActivityLogId, } from '../../entity/scheduleActivityLog/scheduleActivityLogPayload';
|
|
3
|
-
export const initialState = {
|
|
4
|
-
scheduleActivityLogIdsByScheduleId: {},
|
|
5
|
-
scheduleActivityLogFetchStateByScheduleId: {},
|
|
6
|
-
};
|
|
7
|
-
const scheduleActivityLogView = createSlice({
|
|
8
|
-
name: 'scheduleActivityLogView',
|
|
9
|
-
initialState,
|
|
10
|
-
reducers: {
|
|
11
|
-
fetchScheduleActivityLog: {
|
|
12
|
-
prepare(scheduleId) {
|
|
13
|
-
return {
|
|
14
|
-
payload: { scheduleId },
|
|
15
|
-
};
|
|
16
|
-
},
|
|
17
|
-
reducer(draft, action) {
|
|
18
|
-
const { scheduleId } = action.payload;
|
|
19
|
-
draft.scheduleActivityLogFetchStateByScheduleId[scheduleId] = {
|
|
20
|
-
fetchState: 'In-Progress',
|
|
21
|
-
error: undefined,
|
|
22
|
-
};
|
|
23
|
-
draft.scheduleActivityLogIdsByScheduleId[scheduleId] = [];
|
|
24
|
-
},
|
|
25
|
-
},
|
|
26
|
-
updateScheduleActivityLogViewOnSuccess(draft, action) {
|
|
27
|
-
const { data, scheduleId } = action.payload;
|
|
28
|
-
draft.scheduleActivityLogFetchStateByScheduleId[scheduleId] = {
|
|
29
|
-
fetchState: 'Completed',
|
|
30
|
-
error: undefined,
|
|
31
|
-
};
|
|
32
|
-
draft.scheduleActivityLogIdsByScheduleId[scheduleId] = data.map((scheduleActivityLog) => toScheduleActivityLogId(scheduleActivityLog.correlation_id, scheduleActivityLog.event_type, scheduleActivityLog.data?.transaction?.line_id));
|
|
33
|
-
},
|
|
34
|
-
updateScheduleActivityLogViewFetchStatus(draft, action) {
|
|
35
|
-
const { fetchState, scheduleId, error } = action.payload;
|
|
36
|
-
draft.scheduleActivityLogFetchStateByScheduleId[scheduleId] = {
|
|
37
|
-
fetchState,
|
|
38
|
-
error,
|
|
39
|
-
};
|
|
40
|
-
},
|
|
41
|
-
clearScheduleActivityLogView(draft) {
|
|
42
|
-
Object.assign(draft, initialState);
|
|
43
|
-
},
|
|
44
|
-
},
|
|
45
|
-
});
|
|
46
|
-
export const { fetchScheduleActivityLog, updateScheduleActivityLogViewOnSuccess, clearScheduleActivityLogView, updateScheduleActivityLogViewFetchStatus, } = scheduleActivityLogView.actions;
|
|
47
|
-
export default scheduleActivityLogView.reducer;
|