@zeniai/client-epic-state 5.0.69-betaML31 → 5.0.69-betaML4

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.
Files changed (96) hide show
  1. package/lib/commonStateTypes/viewAndReport/viewAndReport.d.ts +2 -2
  2. package/lib/commonStateTypes/viewAndReport/viewAndReport.js +2 -0
  3. package/lib/entity/account/accountSelector.d.ts +9 -0
  4. package/lib/entity/account/accountSelector.js +14 -1
  5. package/lib/entity/account/accountState.d.ts +1 -1
  6. package/lib/entity/accountGroup/accountGroupState.d.ts +1 -1
  7. package/lib/entity/class/classReducer.d.ts +4 -4
  8. package/lib/entity/class/classState.d.ts +1 -1
  9. package/lib/entity/forecast/forecastState.d.ts +1 -1
  10. package/lib/entity/sectionAccountsView/sectionAccountsView.d.ts +1 -1
  11. package/lib/entity/sectionClassesViewV2/sectionClassesView.d.ts +1 -1
  12. package/lib/entity/sectionClassesViewV2/sectionClassesViewReducer.d.ts +2 -2
  13. package/lib/entity/sectionProjectView/sectionProjectView.d.ts +1 -1
  14. package/lib/entity/sectionProjectView/sectionProjectViewReducer.d.ts +2 -2
  15. package/lib/entity/snackbar/snackbarTypes.d.ts +1 -1
  16. package/lib/entity/snackbar/snackbarTypes.js +1 -0
  17. package/lib/entity/transaction/payloadTypes/transactionPayload.d.ts +4 -0
  18. package/lib/entity/transaction/payloadTypes/transactionPayload.js +20 -58
  19. package/lib/entity/transaction/stateTypes/transaction.d.ts +3 -0
  20. package/lib/epic.d.ts +3 -2
  21. package/lib/epic.js +3 -2
  22. package/lib/esm/commonStateTypes/viewAndReport/viewAndReport.js +2 -0
  23. package/lib/esm/entity/account/accountSelector.js +11 -0
  24. package/lib/esm/entity/snackbar/snackbarTypes.js +1 -0
  25. package/lib/esm/entity/transaction/payloadTypes/transactionPayload.js +20 -58
  26. package/lib/esm/epic.js +3 -2
  27. package/lib/esm/index.js +9 -8
  28. package/lib/esm/reducer.js +3 -0
  29. package/lib/esm/view/createTransferEntry/createTransferEntryReducer.js +56 -0
  30. package/lib/esm/view/createTransferEntry/createTransferEntrySelector.js +64 -0
  31. package/lib/esm/view/createTransferEntry/createTransferEntryState.js +17 -0
  32. package/lib/esm/view/createTransferEntry/epics/createTransferEntryEpic.js +112 -0
  33. package/lib/esm/view/createTransferEntry/epics/fetchTransferAccountsEpic.js +36 -0
  34. package/lib/esm/view/expenseAutomationView/epics/transactionCategorization/fetchTransactionCategorizationViewEpic.js +8 -0
  35. package/lib/esm/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.js +1 -21
  36. package/lib/esm/view/expenseAutomationView/reducers/transactionsViewReducer.js +26 -117
  37. package/lib/esm/view/expenseAutomationView/selectors/transactionCategorizationSelector.js +9 -59
  38. package/lib/esm/view/recommendation/recommendationHelper.js +0 -29
  39. package/lib/esm/view/recommendation/recommendationReducer.js +1 -36
  40. package/lib/esm/view/transactionDetail/epics/transactionDetailEpic.js +14 -2
  41. package/lib/esm/view/transactionDetail/transactionDetailReducer.js +8 -122
  42. package/lib/esm/view/transactionDetail/transactionDetailSelector.js +6 -23
  43. package/lib/index.d.ts +9 -9
  44. package/lib/index.js +43 -36
  45. package/lib/reducer.d.ts +3 -0
  46. package/lib/reducer.js +3 -0
  47. package/lib/view/auditReportView/auditReportViewState.d.ts +1 -1
  48. package/lib/view/billPayCard/billPayCardSelector.d.ts +1 -1
  49. package/lib/view/cardBalance/cardBalanceSelector.d.ts +1 -1
  50. package/lib/view/cashBalance/cashBalanceSelector.d.ts +1 -1
  51. package/lib/view/cashInCashOut/cashInCashOutSelector.d.ts +1 -1
  52. package/lib/view/cashPosition/cashPositionSelector.d.ts +1 -1
  53. package/lib/view/createTransferEntry/createTransferEntryReducer.d.ts +32 -0
  54. package/lib/view/createTransferEntry/createTransferEntryReducer.js +60 -0
  55. package/lib/view/createTransferEntry/createTransferEntrySelector.d.ts +39 -0
  56. package/lib/view/createTransferEntry/createTransferEntrySelector.js +69 -0
  57. package/lib/view/createTransferEntry/createTransferEntryState.d.ts +30 -0
  58. package/lib/view/createTransferEntry/createTransferEntryState.js +20 -0
  59. package/lib/view/createTransferEntry/epics/createTransferEntryEpic.d.ts +11 -0
  60. package/lib/view/createTransferEntry/epics/createTransferEntryEpic.js +116 -0
  61. package/lib/view/createTransferEntry/epics/fetchTransferAccountsEpic.d.ts +14 -0
  62. package/lib/view/createTransferEntry/epics/fetchTransferAccountsEpic.js +40 -0
  63. package/lib/view/dashboard/dashboardReducer.d.ts +2 -2
  64. package/lib/view/expenseAutomationView/epics/transactionCategorization/fetchTransactionCategorizationViewEpic.d.ts +2 -1
  65. package/lib/view/expenseAutomationView/epics/transactionCategorization/fetchTransactionCategorizationViewEpic.js +8 -0
  66. package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.d.ts +1 -2
  67. package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.js +2 -23
  68. package/lib/view/expenseAutomationView/reducers/transactionsViewReducer.d.ts +4 -15
  69. package/lib/view/expenseAutomationView/reducers/transactionsViewReducer.js +26 -117
  70. package/lib/view/expenseAutomationView/selectorTypes/transactionsViewSelectorTypes.d.ts +4 -3
  71. package/lib/view/expenseAutomationView/selectors/transactionCategorizationSelector.d.ts +1 -3
  72. package/lib/view/expenseAutomationView/selectors/transactionCategorizationSelector.js +11 -61
  73. package/lib/view/expenseAutomationView/types/transactionsViewState.d.ts +0 -1
  74. package/lib/view/financeStatement/financeStatementReducer.d.ts +1 -1
  75. package/lib/view/globalMerchantView/globalMerchantViewReducer.d.ts +2 -2
  76. package/lib/view/recommendation/recommendationHelper.d.ts +0 -9
  77. package/lib/view/recommendation/recommendationHelper.js +1 -31
  78. package/lib/view/recommendation/recommendationReducer.d.ts +1 -18
  79. package/lib/view/recommendation/recommendationReducer.js +2 -37
  80. package/lib/view/reimbursementCard/reimbursementCardSelector.d.ts +1 -1
  81. package/lib/view/reportsResync/reportsResyncReducer.d.ts +2 -2
  82. package/lib/view/tasksCard/tasksCardSelector.d.ts +1 -1
  83. package/lib/view/topEx/topExSelector.d.ts +1 -1
  84. package/lib/view/transactionDetail/epics/transactionDetailEpic.d.ts +2 -1
  85. package/lib/view/transactionDetail/epics/transactionDetailEpic.js +14 -2
  86. package/lib/view/transactionDetail/transactionDetailPayload.d.ts +1 -1
  87. package/lib/view/transactionDetail/transactionDetailReducer.d.ts +3 -12
  88. package/lib/view/transactionDetail/transactionDetailReducer.js +9 -123
  89. package/lib/view/transactionDetail/transactionDetailSelector.d.ts +6 -3
  90. package/lib/view/transactionDetail/transactionDetailSelector.js +7 -25
  91. package/lib/view/transactionDetail/transactionDetailTypes.d.ts +0 -1
  92. package/package.json +1 -1
  93. package/lib/esm/view/recommendation/fetchEntityRecommendationsForLineUpdateEpic.js +0 -83
  94. package/lib/tsconfig.typecheck.tsbuildinfo +0 -1
  95. package/lib/view/recommendation/fetchEntityRecommendationsForLineUpdateEpic.d.ts +0 -9
  96. package/lib/view/recommendation/fetchEntityRecommendationsForLineUpdateEpic.js +0 -87
@@ -0,0 +1,32 @@
1
+ import { ID } from '../../commonStateTypes/common';
2
+ import { TransactionID } from '../../entity/transaction/stateTypes/transaction';
3
+ import { TransactionType } from '../../entity/transaction/stateTypes/transactionType';
4
+ import { CreateTransferEntryState, TransferAccountsFetchType } from './createTransferEntryState';
5
+ export declare const initialState: CreateTransferEntryState;
6
+ export declare const fetchAccountsForTransferFlow: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
7
+ kind: TransferAccountsFetchType;
8
+ }, "createTransferEntry/fetchAccountsForTransferFlow">, updateAccountsForTransferFlow: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
9
+ accountIds: ID[];
10
+ kind: TransferAccountsFetchType;
11
+ }, "createTransferEntry/updateAccountsForTransferFlow">, updateAccountsForTransferFlowFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
12
+ kind: TransferAccountsFetchType;
13
+ }, "createTransferEntry/updateAccountsForTransferFlowFailure">, createTransferEntry: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[payload: {
14
+ creditAccountIntegrationId: string;
15
+ debitAccountIntegrationId: string;
16
+ memo: string;
17
+ sourceTransactionType: TransactionType;
18
+ transactionId: ID;
19
+ transactionType: TransactionType;
20
+ }], {
21
+ creditAccountIntegrationId: string;
22
+ debitAccountIntegrationId: string;
23
+ memo: string;
24
+ sourceTransactionType: TransactionType;
25
+ transactionId: ID;
26
+ transactionType: TransactionType;
27
+ }, "createTransferEntry/createTransferEntry", never, never>, createTransferEntrySuccess: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"createTransferEntry/createTransferEntrySuccess">, createTransferEntryFailure: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"createTransferEntry/createTransferEntryFailure">, resetCreateTransferEntryStatus: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"createTransferEntry/resetCreateTransferEntryStatus">, createTransferEntryReplacedTransaction: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[previousTransactionId: TransactionID, newTransactionId: TransactionID], {
28
+ newTransactionId: TransactionID;
29
+ previousTransactionId: TransactionID;
30
+ }, "createTransferEntry/createTransferEntryReplacedTransaction", never, never>, clearTransferEntryRouteReplacement: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"createTransferEntry/clearTransferEntryRouteReplacement">;
31
+ declare const _default: import("redux").Reducer<CreateTransferEntryState>;
32
+ export default _default;
@@ -0,0 +1,60 @@
1
+ "use strict";
2
+ var _a;
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.clearTransferEntryRouteReplacement = exports.createTransferEntryReplacedTransaction = exports.resetCreateTransferEntryStatus = exports.createTransferEntryFailure = exports.createTransferEntrySuccess = exports.createTransferEntry = exports.updateAccountsForTransferFlowFailure = exports.updateAccountsForTransferFlow = exports.fetchAccountsForTransferFlow = exports.initialState = void 0;
5
+ const toolkit_1 = require("@reduxjs/toolkit");
6
+ const createTransferEntryState_1 = require("./createTransferEntryState");
7
+ exports.initialState = createTransferEntryState_1.initialCreateTransferEntryState;
8
+ const createTransferEntrySlice = (0, toolkit_1.createSlice)({
9
+ name: 'createTransferEntry',
10
+ initialState: exports.initialState,
11
+ reducers: {
12
+ fetchAccountsForTransferFlow(draft, action) {
13
+ draft.transferAccountsByType[action.payload.kind].fetchState =
14
+ 'In-Progress';
15
+ },
16
+ updateAccountsForTransferFlow(draft, action) {
17
+ const slice = draft.transferAccountsByType[action.payload.kind];
18
+ slice.fetchState = 'Completed';
19
+ slice.accountIds = action.payload.accountIds;
20
+ },
21
+ updateAccountsForTransferFlowFailure(draft, action) {
22
+ draft.transferAccountsByType[action.payload.kind].fetchState = 'Error';
23
+ },
24
+ createTransferEntry: {
25
+ prepare(payload) {
26
+ return { payload };
27
+ },
28
+ reducer(draft) {
29
+ draft.createTransferEntryStatus = 'In-Progress';
30
+ },
31
+ },
32
+ createTransferEntrySuccess(draft) {
33
+ draft.createTransferEntryStatus = 'Completed';
34
+ },
35
+ createTransferEntryFailure(draft) {
36
+ draft.createTransferEntryStatus = 'Error';
37
+ },
38
+ resetCreateTransferEntryStatus(draft) {
39
+ draft.createTransferEntryStatus = 'Not-Started';
40
+ },
41
+ createTransferEntryReplacedTransaction: {
42
+ prepare(previousTransactionId, newTransactionId) {
43
+ return { payload: { newTransactionId, previousTransactionId } };
44
+ },
45
+ reducer(draft, action) {
46
+ draft.lastTransferEntryReplacement = action.payload;
47
+ },
48
+ },
49
+ /**
50
+ * One-shot acknowledgement: the host has consumed the route-replacement
51
+ * signal and navigated to the new transaction url, so we can drop the
52
+ * record. Re-dispatching is idempotent.
53
+ */
54
+ clearTransferEntryRouteReplacement(draft) {
55
+ draft.lastTransferEntryReplacement = undefined;
56
+ },
57
+ },
58
+ });
59
+ _a = createTransferEntrySlice.actions, exports.fetchAccountsForTransferFlow = _a.fetchAccountsForTransferFlow, exports.updateAccountsForTransferFlow = _a.updateAccountsForTransferFlow, exports.updateAccountsForTransferFlowFailure = _a.updateAccountsForTransferFlowFailure, exports.createTransferEntry = _a.createTransferEntry, exports.createTransferEntrySuccess = _a.createTransferEntrySuccess, exports.createTransferEntryFailure = _a.createTransferEntryFailure, exports.resetCreateTransferEntryStatus = _a.resetCreateTransferEntryStatus, exports.createTransferEntryReplacedTransaction = _a.createTransferEntryReplacedTransaction, exports.clearTransferEntryRouteReplacement = _a.clearTransferEntryRouteReplacement;
60
+ exports.default = createTransferEntrySlice.reducer;
@@ -0,0 +1,39 @@
1
+ import { AccountBase } from '../../entity/account/accountState';
2
+ import { RootState } from '../../reducer';
3
+ import { TransferEntryRouteReplacement } from './createTransferEntryState';
4
+ export declare function getCreateTransferEntryStatus(state: RootState): import("../..").FetchState;
5
+ export declare function getLastTransferEntryReplacement(state: RootState): TransferEntryRouteReplacement | undefined;
6
+ /**
7
+ * Shared resolver for the credit/debit dropdowns in the transfer drawer.
8
+ *
9
+ * Resolution policy (intentional):
10
+ * 1. Prefer the dedicated API fetch results (`transferEntryEligible` for the
11
+ * debit pool, `creditCardOnlyEligible` for the credit-card-payment credit
12
+ * pool).
13
+ * 2. If the dedicated fetch returns an empty list while the COA is loaded,
14
+ * fall back to the COA: the full account list for `transferEntryEligible`,
15
+ * and COA accounts filtered to `credit_card` for `creditCardOnlyEligible`.
16
+ * This keeps the dropdown populated for older tenants where the dedicated
17
+ * endpoints haven't been backfilled yet.
18
+ *
19
+ * Intent — what this selector deliberately does NOT do:
20
+ * - Does NOT distinguish "fetch in-flight" / "fetch errored" / "fetch returned
21
+ * empty" — all three collapse to the COA fallback. The product preference
22
+ * is "always show something selectable" over "show a spinner that may never
23
+ * resolve". Loading/error UI belongs in the view layer; if you need a
24
+ * spinner, observe the `fetchState` on `transferAccountsByType[kind]`
25
+ * separately rather than changing the resolution policy here.
26
+ * - Does NOT enforce "API result is authoritative even if empty" — a tenant
27
+ * whose dedicated endpoint is correctly returning `[]` (e.g. no eligible
28
+ * transfer destinations) will still see the COA. That trade-off is
29
+ * accepted because the alternative blocks the user from picking anything;
30
+ * the backend distinguishes "no result" from "endpoint not implemented" by
31
+ * surfacing an error response, which the view layer handles separately.
32
+ *
33
+ * Memoized with reselect so consuming view-models don't recompute on every
34
+ * unrelated state change.
35
+ */
36
+ export declare const getResolvedTransferAccounts: (state: RootState) => {
37
+ creditCardTransferAccountsList: AccountBase[];
38
+ transferAccountsList: AccountBase[];
39
+ };
@@ -0,0 +1,69 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getResolvedTransferAccounts = void 0;
4
+ exports.getCreateTransferEntryStatus = getCreateTransferEntryStatus;
5
+ exports.getLastTransferEntryReplacement = getLastTransferEntryReplacement;
6
+ const toolkit_1 = require("@reduxjs/toolkit");
7
+ const accountSelector_1 = require("../../entity/account/accountSelector");
8
+ const accountListSelector_1 = require("../accountList/accountListSelector");
9
+ function getCreateTransferEntryStatus(state) {
10
+ return state.createTransferEntryState.createTransferEntryStatus;
11
+ }
12
+ function getLastTransferEntryReplacement(state) {
13
+ return state.createTransferEntryState.lastTransferEntryReplacement;
14
+ }
15
+ /**
16
+ * Shared resolver for the credit/debit dropdowns in the transfer drawer.
17
+ *
18
+ * Resolution policy (intentional):
19
+ * 1. Prefer the dedicated API fetch results (`transferEntryEligible` for the
20
+ * debit pool, `creditCardOnlyEligible` for the credit-card-payment credit
21
+ * pool).
22
+ * 2. If the dedicated fetch returns an empty list while the COA is loaded,
23
+ * fall back to the COA: the full account list for `transferEntryEligible`,
24
+ * and COA accounts filtered to `credit_card` for `creditCardOnlyEligible`.
25
+ * This keeps the dropdown populated for older tenants where the dedicated
26
+ * endpoints haven't been backfilled yet.
27
+ *
28
+ * Intent — what this selector deliberately does NOT do:
29
+ * - Does NOT distinguish "fetch in-flight" / "fetch errored" / "fetch returned
30
+ * empty" — all three collapse to the COA fallback. The product preference
31
+ * is "always show something selectable" over "show a spinner that may never
32
+ * resolve". Loading/error UI belongs in the view layer; if you need a
33
+ * spinner, observe the `fetchState` on `transferAccountsByType[kind]`
34
+ * separately rather than changing the resolution policy here.
35
+ * - Does NOT enforce "API result is authoritative even if empty" — a tenant
36
+ * whose dedicated endpoint is correctly returning `[]` (e.g. no eligible
37
+ * transfer destinations) will still see the COA. That trade-off is
38
+ * accepted because the alternative blocks the user from picking anything;
39
+ * the backend distinguishes "no result" from "endpoint not implemented" by
40
+ * surfacing an error response, which the view layer handles separately.
41
+ *
42
+ * Memoized with reselect so consuming view-models don't recompute on every
43
+ * unrelated state change.
44
+ */
45
+ exports.getResolvedTransferAccounts = (0, toolkit_1.createSelector)([
46
+ (state) => state.accountState,
47
+ (state) => state.accountListState,
48
+ (state) => state.createTransferEntryState.transferAccountsByType
49
+ .transferEntryEligible.accountIds,
50
+ (state) => state.createTransferEntryState.transferAccountsByType
51
+ .creditCardOnlyEligible.accountIds,
52
+ ], (accountState, accountListState, transferEligibleIds, creditCardOnlyIds) => {
53
+ const accountList = (0, accountListSelector_1.getAccountList)(accountState, accountListState, 'accountList');
54
+ const transferEligibleFromApi = transferEligibleIds
55
+ .map((id) => (0, accountSelector_1.getAccountBaseForTransferAccounts)(accountState, id))
56
+ .filter((account) => account != null);
57
+ const coaFallbackAllAccounts = accountList.accounts
58
+ .map((a) => (0, accountSelector_1.getAccountBase)(accountState, a.accountId, 'account_list'))
59
+ .filter((account) => account != null);
60
+ const transferAccountsList = transferEligibleFromApi.length > 0
61
+ ? transferEligibleFromApi
62
+ : coaFallbackAllAccounts;
63
+ const creditCardFromApi = creditCardOnlyIds
64
+ .map((id) => (0, accountSelector_1.getAccountBaseForCreditCardTransferAccounts)(accountState, id))
65
+ .filter((account) => account != null);
66
+ const coaFallbackCreditCards = coaFallbackAllAccounts.filter((a) => a.accountType === 'credit_card');
67
+ const creditCardTransferAccountsList = creditCardFromApi.length > 0 ? creditCardFromApi : coaFallbackCreditCards;
68
+ return { creditCardTransferAccountsList, transferAccountsList };
69
+ });
@@ -0,0 +1,30 @@
1
+ import { FetchState, ID } from '../../commonStateTypes/common';
2
+ import { TransactionID } from '../../entity/transaction/stateTypes/transaction';
3
+ /** Which pool `fetchAccountsForTransferFlow` / transfer-flow epic should load. */
4
+ export declare const TRANSFER_ACCOUNTS_FETCH_TYPE: readonly ["transferEntryEligible", "creditCardOnlyEligible"];
5
+ export type TransferAccountsFetchType = (typeof TRANSFER_ACCOUNTS_FETCH_TYPE)[number];
6
+ export interface TransferAccountsState {
7
+ accountIds: ID[];
8
+ fetchState: FetchState;
9
+ }
10
+ export type TransferEntryRouteReplacement = {
11
+ newTransactionId: TransactionID;
12
+ previousTransactionId: TransactionID;
13
+ };
14
+ export interface CreateTransferEntryState {
15
+ createTransferEntryStatus: FetchState;
16
+ /**
17
+ * Set when create-transfer returns a new transaction id (the source expense
18
+ * has been replaced by a new transfer/credit-card-payment row). The host
19
+ * navigates to the new url and then dispatches
20
+ * `clearTransferEntryRouteReplacement` to clear this one-shot signal.
21
+ */
22
+ lastTransferEntryReplacement: TransferEntryRouteReplacement | undefined;
23
+ /**
24
+ * Per-type fetch state + account-id list for the dropdowns shown in the
25
+ * transfer drawer (eligible accounts for `transfer`, credit-card-only
26
+ * accounts for `credit_card_payment`).
27
+ */
28
+ transferAccountsByType: Record<TransferAccountsFetchType, TransferAccountsState>;
29
+ }
30
+ export declare const initialCreateTransferEntryState: CreateTransferEntryState;
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.initialCreateTransferEntryState = exports.TRANSFER_ACCOUNTS_FETCH_TYPE = void 0;
4
+ /** Which pool `fetchAccountsForTransferFlow` / transfer-flow epic should load. */
5
+ exports.TRANSFER_ACCOUNTS_FETCH_TYPE = [
6
+ 'transferEntryEligible',
7
+ 'creditCardOnlyEligible',
8
+ ];
9
+ const initialTransferAccountsState = {
10
+ accountIds: [],
11
+ fetchState: 'Not-Started',
12
+ };
13
+ exports.initialCreateTransferEntryState = {
14
+ createTransferEntryStatus: 'Not-Started',
15
+ lastTransferEntryReplacement: undefined,
16
+ transferAccountsByType: {
17
+ transferEntryEligible: initialTransferAccountsState,
18
+ creditCardOnlyEligible: initialTransferAccountsState,
19
+ },
20
+ };
@@ -0,0 +1,11 @@
1
+ import { ActionsObservable, StateObservable } from 'redux-observable';
2
+ import { Observable } from 'rxjs';
3
+ import { openSnackbar } from '../../../entity/snackbar/snackbarReducer';
4
+ import { removeTransaction, updateTransaction } from '../../../entity/transaction/transactionReducer';
5
+ import { RootState } from '../../../reducer';
6
+ import { ZeniAPI } from '../../../zeniAPI';
7
+ import { removeTransactionFromAllTabs } from '../../expenseAutomationView/reducers/transactionsViewReducer';
8
+ import { initializeTransactionDetailLocalData, removeTransactionDetail } from '../../transactionDetail/transactionDetailReducer';
9
+ import { clearTransferEntryRouteReplacement, createTransferEntry, createTransferEntryFailure, createTransferEntryReplacedTransaction, createTransferEntrySuccess, resetCreateTransferEntryStatus } from '../createTransferEntryReducer';
10
+ export type ActionType = ReturnType<typeof openSnackbar> | ReturnType<typeof createTransferEntry> | ReturnType<typeof createTransferEntrySuccess> | ReturnType<typeof createTransferEntryFailure> | ReturnType<typeof removeTransactionFromAllTabs> | ReturnType<typeof resetCreateTransferEntryStatus> | ReturnType<typeof createTransferEntryReplacedTransaction> | ReturnType<typeof clearTransferEntryRouteReplacement> | ReturnType<typeof updateTransaction> | ReturnType<typeof initializeTransactionDetailLocalData> | ReturnType<typeof removeTransaction> | ReturnType<typeof removeTransactionDetail>;
11
+ export declare const createTransferEntryEpic: (actions$: ActionsObservable<ActionType>, _state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
@@ -0,0 +1,116 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createTransferEntryEpic = void 0;
4
+ const rxjs_1 = require("rxjs");
5
+ const operators_1 = require("rxjs/operators");
6
+ const snackbarReducer_1 = require("../../../entity/snackbar/snackbarReducer");
7
+ const transactionIDPayload_1 = require("../../../entity/transaction/payloadTypes/transactionIDPayload");
8
+ const transactionReducer_1 = require("../../../entity/transaction/transactionReducer");
9
+ const responsePayload_1 = require("../../../responsePayload");
10
+ const transactionsViewReducer_1 = require("../../expenseAutomationView/reducers/transactionsViewReducer");
11
+ const transactionDetailReducer_1 = require("../../transactionDetail/transactionDetailReducer");
12
+ const transactionDetailState_1 = require("../../transactionDetail/transactionDetailState");
13
+ const createTransferEntryReducer_1 = require("../createTransferEntryReducer");
14
+ // ─── Pure helpers ────────────────────────────────────────────────────────────
15
+ function transactionIdsAreEqual(a, b) {
16
+ return a.id === b.id && a.type === b.type;
17
+ }
18
+ const successSnackbar = () => (0, snackbarReducer_1.openSnackbar)({
19
+ messageSection: 'create_transfer_entry',
20
+ messageText: 'success',
21
+ type: 'success',
22
+ });
23
+ const failureSnackbar = () => (0, snackbarReducer_1.openSnackbar)({
24
+ messageSection: 'create_transfer_entry',
25
+ messageText: 'failed',
26
+ type: 'error',
27
+ });
28
+ function buildFailureActions() {
29
+ return [(0, createTransferEntryReducer_1.createTransferEntryFailure)(), failureSnackbar()];
30
+ }
31
+ function buildSuccessSideEffects(sourceTransactionId) {
32
+ return [
33
+ (0, createTransferEntryReducer_1.createTransferEntrySuccess)(),
34
+ (0, transactionsViewReducer_1.removeTransactionFromAllTabs)(sourceTransactionId),
35
+ successSnackbar(),
36
+ ];
37
+ }
38
+ function buildPreviousTransactionCleanupActions(previousTransactionId) {
39
+ return [
40
+ (0, transactionReducer_1.removeTransaction)((0, transactionDetailState_1.getTransactionDetailKey)(previousTransactionId)),
41
+ (0, transactionDetailReducer_1.removeTransactionDetail)(previousTransactionId),
42
+ (0, createTransferEntryReducer_1.clearTransferEntryRouteReplacement)(),
43
+ ];
44
+ }
45
+ /**
46
+ * Emits `resetCreateTransferEntryStatus()` (and, on the replacement path, the
47
+ * follow-up cleanup actions) one scheduler tick after the success actions.
48
+ *
49
+ * Why the `timer(0)` (and not synchronous emission):
50
+ * On the replacement path the host (web-app-ui) watches
51
+ * `lastTransferEntryReplacement`, navigates to the new transaction url, and
52
+ * then sees `clearTransferEntryRouteReplacement` clear the signal. If we
53
+ * dispatched the cleanup actions in the same tick as
54
+ * `createTransferEntryReplacedTransaction`, redux subscribers would observe
55
+ * `lastTransferEntryReplacement` flicker on then off in a single render, and
56
+ * the old transaction's state (which the still-mounted detail view may be
57
+ * reading) would be torn down before the host has had a chance to start
58
+ * navigating. Deferring by one microtask gives the host exactly one render
59
+ * pass to react before we tear down the previous transaction.
60
+ */
61
+ function delayedResetAndPreviousCleanup(previousTransactionId) {
62
+ return (0, rxjs_1.timer)(0).pipe((0, operators_1.mergeMap)(() => {
63
+ const actions = [(0, createTransferEntryReducer_1.resetCreateTransferEntryStatus)()];
64
+ if (previousTransactionId != null) {
65
+ actions.push(...buildPreviousTransactionCleanupActions(previousTransactionId));
66
+ }
67
+ return (0, rxjs_1.from)(actions);
68
+ }));
69
+ }
70
+ // ─── Success-path branches ───────────────────────────────────────────────────
71
+ function handleSuccessWithoutTransactionBody(transactionId) {
72
+ return (0, rxjs_1.concat)((0, rxjs_1.from)(buildSuccessSideEffects(transactionId)), delayedResetAndPreviousCleanup(undefined));
73
+ }
74
+ function handleSuccessWithTransactionBody(transactionPayload, vendorPayload, previousTransactionId, sourceTransactionId) {
75
+ const newTransactionId = (0, transactionIDPayload_1.toTransactionID)(transactionPayload);
76
+ const replaced = !transactionIdsAreEqual(previousTransactionId, newTransactionId);
77
+ const immediate = [
78
+ (0, transactionReducer_1.updateTransaction)((0, transactionDetailState_1.getTransactionDetailKey)(newTransactionId), transactionPayload),
79
+ (0, transactionDetailReducer_1.initializeTransactionDetailLocalData)({
80
+ transactionId: newTransactionId,
81
+ vendorId: vendorPayload?.[0]?.vendor_id,
82
+ }),
83
+ ...buildSuccessSideEffects(sourceTransactionId),
84
+ ];
85
+ if (replaced) {
86
+ immediate.push((0, createTransferEntryReducer_1.createTransferEntryReplacedTransaction)(previousTransactionId, newTransactionId));
87
+ }
88
+ return (0, rxjs_1.concat)((0, rxjs_1.from)(immediate), delayedResetAndPreviousCleanup(replaced ? previousTransactionId : undefined));
89
+ }
90
+ // ─── Top-level epic ──────────────────────────────────────────────────────────
91
+ const CREATE_TRANSFER_ENTRY_URL = `https://dev.api.zeni.ai/version/accounting/komal/1.0/transactions/transaction-type-update`;
92
+ const createTransferEntryEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(createTransferEntryReducer_1.createTransferEntry.match), (0, operators_1.mergeMap)((action) => {
93
+ const { transactionId, creditAccountIntegrationId, debitAccountIntegrationId, memo, transactionType, sourceTransactionType, } = action.payload;
94
+ const previousTransactionId = {
95
+ id: transactionId,
96
+ type: sourceTransactionType,
97
+ };
98
+ return zeniAPI
99
+ .postAndGetJSON(CREATE_TRANSFER_ENTRY_URL, {
100
+ transaction_type: transactionType,
101
+ transaction_id: transactionId,
102
+ to_account_integration_id: creditAccountIntegrationId,
103
+ from_account_integration_id: debitAccountIntegrationId,
104
+ memo,
105
+ })
106
+ .pipe((0, operators_1.mergeMap)((response) => {
107
+ if (!(0, responsePayload_1.isSuccessResponse)(response)) {
108
+ return (0, rxjs_1.from)(buildFailureActions());
109
+ }
110
+ if (response.data?.transaction != null) {
111
+ return handleSuccessWithTransactionBody(response.data.transaction, response.data.vendors, previousTransactionId, transactionId);
112
+ }
113
+ return handleSuccessWithoutTransactionBody(transactionId);
114
+ }), (0, operators_1.catchError)(() => (0, rxjs_1.from)(buildFailureActions())));
115
+ }));
116
+ exports.createTransferEntryEpic = createTransferEntryEpic;
@@ -0,0 +1,14 @@
1
+ import { ActionsObservable, StateObservable } from 'redux-observable';
2
+ import { Observable } from 'rxjs';
3
+ import { updateAccounts } from '../../../entity/account/accountReducer';
4
+ import { RootState } from '../../../reducer';
5
+ import { ZeniAPI } from '../../../zeniAPI';
6
+ import { fetchAccountsForTransferFlow, updateAccountsForTransferFlow, updateAccountsForTransferFlowFailure } from '../createTransferEntryReducer';
7
+ export type ActionType = ReturnType<typeof fetchAccountsForTransferFlow> | ReturnType<typeof updateAccountsForTransferFlow> | ReturnType<typeof updateAccountsForTransferFlowFailure> | ReturnType<typeof updateAccounts>;
8
+ /**
9
+ * Pools fetched concurrently: `groupBy(kind)` keeps `transferEntryEligible`
10
+ * and `creditCardOnlyEligible` in their own streams so a back-to-back dispatch
11
+ * of both does not cancel the first. Within a single type, a fresh dispatch
12
+ * supersedes any in-flight request (per-group `switchMap`).
13
+ */
14
+ export declare const fetchTransferAccountsEpic: (actions$: ActionsObservable<ActionType>, _state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.fetchTransferAccountsEpic = void 0;
4
+ const rxjs_1 = require("rxjs");
5
+ const operators_1 = require("rxjs/operators");
6
+ const accountReducer_1 = require("../../../entity/account/accountReducer");
7
+ const responsePayload_1 = require("../../../responsePayload");
8
+ const createTransferEntryReducer_1 = require("../createTransferEntryReducer");
9
+ const REPORT_ID_BY_TYPE = {
10
+ transferEntryEligible: 'transfer_accounts',
11
+ creditCardOnlyEligible: 'credit_card_transfer_accounts',
12
+ };
13
+ const QUERY_BY_TYPE = {
14
+ transferEntryEligible: { is_only_include_transfer_accounts: true },
15
+ creditCardOnlyEligible: { is_include_only_credit_card_accounts: true },
16
+ };
17
+ /**
18
+ * Pools fetched concurrently: `groupBy(kind)` keeps `transferEntryEligible`
19
+ * and `creditCardOnlyEligible` in their own streams so a back-to-back dispatch
20
+ * of both does not cancel the first. Within a single type, a fresh dispatch
21
+ * supersedes any in-flight request (per-group `switchMap`).
22
+ */
23
+ const fetchTransferAccountsEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(createTransferEntryReducer_1.fetchAccountsForTransferFlow.match), (0, operators_1.groupBy)((action) => action.payload.kind), (0, operators_1.mergeMap)((group$) => group$.pipe((0, operators_1.switchMap)((action) => {
24
+ const { kind } = action.payload;
25
+ const queryValue = QUERY_BY_TYPE[kind];
26
+ const reportId = REPORT_ID_BY_TYPE[kind];
27
+ const url = `https://dev.api.zeni.ai/version/accounting/komal/1.0/accounts?query=${encodeURIComponent(JSON.stringify(queryValue))}`;
28
+ return zeniAPI.getJSON(url).pipe((0, operators_1.mergeMap)((response) => {
29
+ if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
30
+ const accountIds = response.data.accounts.map((account) => account.account_id);
31
+ const actions = [
32
+ (0, accountReducer_1.updateAccounts)(response.data.accounts, reportId),
33
+ (0, createTransferEntryReducer_1.updateAccountsForTransferFlow)({ accountIds, kind }),
34
+ ];
35
+ return (0, rxjs_1.of)(...actions);
36
+ }
37
+ return (0, rxjs_1.of)((0, createTransferEntryReducer_1.updateAccountsForTransferFlowFailure)({ kind }));
38
+ }), (0, operators_1.catchError)(() => (0, rxjs_1.of)((0, createTransferEntryReducer_1.updateAccountsForTransferFlowFailure)({ kind }))));
39
+ }))));
40
+ exports.fetchTransferAccountsEpic = fetchTransferAccountsEpic;
@@ -1,12 +1,12 @@
1
1
  import { DashboardState } from './dashboardState';
2
2
  export declare const initialState: DashboardState;
3
- export declare const fetchDashboard: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[userId: string, companyId: string, tenantId: string, fetchFullReport?: any, cacheOverride?: any, excludeResources?: ("cash_balance" | "card_balance" | "expense_automation_card" | "operating_expenses" | "operating_expenses_by_classes" | "revenue" | "revenue_by_classes" | "net_burn_or_income" | "net_burn_or_income_story_card" | "net_burn_or_income_by_classes" | "cash_position" | "top_expenses" | "profit_and_loss" | "profit_and_loss_by_classes" | "profit_and_loss_by_projects" | "balance_sheet" | "cash_flow" | "dashboard" | "finance_statement" | "transaction_list_of_account" | "transaction_list_missing_receipt" | "transaction_list_of_account_by_class" | "transaction_list_of_account_by_project" | "transaction_detail" | "cash_in_cash_out" | "insights_dashboard" | "company_details" | "class_list" | "account_list" | "account_list_by_type" | "vendor" | "task_card" | "bill_pay" | "reimbursement" | "bill_pay_card" | "reimbursement_card" | "bill_pay_promo_card" | "zeni_accounts" | "zeni_accounts_promo_card" | "zeni_treasury" | "charge_cards" | "other_connection" | "reimbursement_promo_card" | "onboarding" | "operating_expenses_by_vendor" | "operating_expenses_by_vendor_summary" | "vendors_tab" | "accounts_payable_aging" | "accounts_receivable_aging" | "vendor_global_review" | "prepaid_expenses" | "fixed_assets" | "notification" | "rewards_card" | "billing" | "flux_analysis_operating_expense" | "account_reconciliation" | "zeni_credit_promo_card" | "treasury_promo_card" | "excluded_account_reconciliation")[] | undefined], {
3
+ export declare const fetchDashboard: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[userId: string, companyId: string, tenantId: string, fetchFullReport?: any, cacheOverride?: any, excludeResources?: ("cash_balance" | "card_balance" | "expense_automation_card" | "operating_expenses" | "operating_expenses_by_classes" | "revenue" | "revenue_by_classes" | "net_burn_or_income" | "net_burn_or_income_story_card" | "net_burn_or_income_by_classes" | "cash_position" | "top_expenses" | "profit_and_loss" | "profit_and_loss_by_classes" | "profit_and_loss_by_projects" | "balance_sheet" | "cash_flow" | "dashboard" | "finance_statement" | "transaction_list_of_account" | "transaction_list_missing_receipt" | "transaction_list_of_account_by_class" | "transaction_list_of_account_by_project" | "transaction_detail" | "cash_in_cash_out" | "insights_dashboard" | "company_details" | "class_list" | "account_list" | "account_list_by_type" | "vendor" | "task_card" | "bill_pay" | "reimbursement" | "bill_pay_card" | "reimbursement_card" | "bill_pay_promo_card" | "zeni_accounts" | "zeni_accounts_promo_card" | "zeni_treasury" | "charge_cards" | "other_connection" | "reimbursement_promo_card" | "onboarding" | "operating_expenses_by_vendor" | "operating_expenses_by_vendor_summary" | "vendors_tab" | "accounts_payable_aging" | "accounts_receivable_aging" | "vendor_global_review" | "prepaid_expenses" | "fixed_assets" | "notification" | "rewards_card" | "billing" | "flux_analysis_operating_expense" | "account_reconciliation" | "zeni_credit_promo_card" | "treasury_promo_card" | "excluded_account_reconciliation" | "transfer_accounts" | "credit_card_transfer_accounts")[] | undefined], {
4
4
  userId: string;
5
5
  companyId: string;
6
6
  tenantId: string;
7
7
  fetchFullReport: any;
8
8
  cacheOverride: any;
9
- excludeResources: ("cash_balance" | "card_balance" | "expense_automation_card" | "operating_expenses" | "operating_expenses_by_classes" | "revenue" | "revenue_by_classes" | "net_burn_or_income" | "net_burn_or_income_story_card" | "net_burn_or_income_by_classes" | "cash_position" | "top_expenses" | "profit_and_loss" | "profit_and_loss_by_classes" | "profit_and_loss_by_projects" | "balance_sheet" | "cash_flow" | "dashboard" | "finance_statement" | "transaction_list_of_account" | "transaction_list_missing_receipt" | "transaction_list_of_account_by_class" | "transaction_list_of_account_by_project" | "transaction_detail" | "cash_in_cash_out" | "insights_dashboard" | "company_details" | "class_list" | "account_list" | "account_list_by_type" | "vendor" | "task_card" | "bill_pay" | "reimbursement" | "bill_pay_card" | "reimbursement_card" | "bill_pay_promo_card" | "zeni_accounts" | "zeni_accounts_promo_card" | "zeni_treasury" | "charge_cards" | "other_connection" | "reimbursement_promo_card" | "onboarding" | "operating_expenses_by_vendor" | "operating_expenses_by_vendor_summary" | "vendors_tab" | "accounts_payable_aging" | "accounts_receivable_aging" | "vendor_global_review" | "prepaid_expenses" | "fixed_assets" | "notification" | "rewards_card" | "billing" | "flux_analysis_operating_expense" | "account_reconciliation" | "zeni_credit_promo_card" | "treasury_promo_card" | "excluded_account_reconciliation")[];
9
+ excludeResources: ("cash_balance" | "card_balance" | "expense_automation_card" | "operating_expenses" | "operating_expenses_by_classes" | "revenue" | "revenue_by_classes" | "net_burn_or_income" | "net_burn_or_income_story_card" | "net_burn_or_income_by_classes" | "cash_position" | "top_expenses" | "profit_and_loss" | "profit_and_loss_by_classes" | "profit_and_loss_by_projects" | "balance_sheet" | "cash_flow" | "dashboard" | "finance_statement" | "transaction_list_of_account" | "transaction_list_missing_receipt" | "transaction_list_of_account_by_class" | "transaction_list_of_account_by_project" | "transaction_detail" | "cash_in_cash_out" | "insights_dashboard" | "company_details" | "class_list" | "account_list" | "account_list_by_type" | "vendor" | "task_card" | "bill_pay" | "reimbursement" | "bill_pay_card" | "reimbursement_card" | "bill_pay_promo_card" | "zeni_accounts" | "zeni_accounts_promo_card" | "zeni_treasury" | "charge_cards" | "other_connection" | "reimbursement_promo_card" | "onboarding" | "operating_expenses_by_vendor" | "operating_expenses_by_vendor_summary" | "vendors_tab" | "accounts_payable_aging" | "accounts_receivable_aging" | "vendor_global_review" | "prepaid_expenses" | "fixed_assets" | "notification" | "rewards_card" | "billing" | "flux_analysis_operating_expense" | "account_reconciliation" | "zeni_credit_promo_card" | "treasury_promo_card" | "excluded_account_reconciliation" | "transfer_accounts" | "credit_card_transfer_accounts")[];
10
10
  }, "dashboard/fetchDashboard", never, never>, updateTreasuryVideoClosed: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"dashboard/updateTreasuryVideoClosed">, clearDashboard: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"dashboard/clearDashboard">;
11
11
  declare const _default: import("redux").Reducer<DashboardState>;
12
12
  export default _default;
@@ -3,8 +3,9 @@ import { Observable } from 'rxjs';
3
3
  import { RootState } from '../../../../reducer';
4
4
  import { fetchAccountList } from '../../../accountList/accountListReducer';
5
5
  import { fetchClassList } from '../../../classList/classListReducer';
6
+ import { fetchAccountsForTransferFlow } from '../../../createTransferEntry/createTransferEntryReducer';
6
7
  import { fetchOwnerList } from '../../../ownerList/ownerListReducer';
7
8
  import { fetchProjectList } from '../../../projectList/projectListReducer';
8
9
  import { fetchTransactionCategorization, fetchTransactionCategorizationView } from '../../reducers/transactionsViewReducer';
9
- export type ActionType = ReturnType<typeof fetchTransactionCategorizationView> | ReturnType<typeof fetchTransactionCategorization> | ReturnType<typeof fetchAccountList> | ReturnType<typeof fetchClassList> | ReturnType<typeof fetchOwnerList> | ReturnType<typeof fetchProjectList>;
10
+ export type ActionType = ReturnType<typeof fetchTransactionCategorizationView> | ReturnType<typeof fetchTransactionCategorization> | ReturnType<typeof fetchAccountList> | ReturnType<typeof fetchClassList> | ReturnType<typeof fetchOwnerList> | ReturnType<typeof fetchAccountsForTransferFlow> | ReturnType<typeof fetchProjectList>;
10
11
  export declare const fetchTransactionCategorizationViewEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>) => Observable<ActionType>;
@@ -7,6 +7,7 @@ const timePeriod_1 = require("../../../../commonStateTypes/timePeriod");
7
7
  const tenantSelector_1 = require("../../../../entity/tenant/tenantSelector");
8
8
  const accountListReducer_1 = require("../../../accountList/accountListReducer");
9
9
  const classListReducer_1 = require("../../../classList/classListReducer");
10
+ const createTransferEntryReducer_1 = require("../../../createTransferEntry/createTransferEntryReducer");
10
11
  const ownerListReducer_1 = require("../../../ownerList/ownerListReducer");
11
12
  const projectListReducer_1 = require("../../../projectList/projectListReducer");
12
13
  const transactionsViewReducer_1 = require("../../reducers/transactionsViewReducer");
@@ -26,6 +27,13 @@ const fetchTransactionCategorizationViewEpic = (actions$, state$) => actions$.pi
26
27
  accountList.fetchState === 'Not-Started') {
27
28
  updateActions.push((0, accountListReducer_1.fetchAccountList)('accountList', true));
28
29
  }
30
+ const { transferEntryEligible, creditCardOnlyEligible } = state$.value.createTransferEntryState.transferAccountsByType;
31
+ if (transferEntryEligible.fetchState === 'Not-Started') {
32
+ updateActions.push((0, createTransferEntryReducer_1.fetchAccountsForTransferFlow)({ kind: 'transferEntryEligible' }));
33
+ }
34
+ if (creditCardOnlyEligible.fetchState === 'Not-Started') {
35
+ updateActions.push((0, createTransferEntryReducer_1.fetchAccountsForTransferFlow)({ kind: 'creditCardOnlyEligible' }));
36
+ }
29
37
  const classList = state$.value.classListState;
30
38
  if (classList.hasValidState() === false &&
31
39
  classList.fetchState === 'Not-Started') {
@@ -27,7 +27,6 @@ export declare const removeTransactionFromTabView: (tabView: TransactionsTabView
27
27
  */
28
28
  export declare const filterAutoTabLineItems: (tabView: TransactionsTabViewState, transactionId: ID, updatedTransaction: SupportedTransactionWithCOT) => void;
29
29
  export declare const MAX_SELECTION_LIMIT = 5;
30
- export declare const shouldAutoSelectAndAdd: (transaction: SupportedTransactionWithCOT, localData: TransactionReviewLocalData, selectedCheckBoxTransactionIds: ID[], uncategorizedAccounts: UncategorizedAccounts, isUncategorizedExpenseCategoryEnabled?: boolean, isAccountingClassesEnabled?: boolean) => boolean;
31
30
  export declare const toTransactionDetailLocalData: (transaction: SupportedTransactionWithCOT, selectedTab: TransactionsTab, lineItemsByTransactionIds: string[], uncategorizedIncomeExpense: UncategorizedAccounts, isUncategorizedExpenseCategoryEnabled?: boolean) => TransactionReviewLocalData;
32
31
  export declare const toSetAllLineItemsToCategoryClass: (draft: TransactionsTabViewState, transaction: SupportedTransactionWithCOT, transactionId: ID, transactionLineId: ID, transactionDetailLocalData: TransactionReviewLocalData, updatedItem: "category" | "class" | "project", uncategorizedAccounts: UncategorizedAccounts, selectedTab: TransactionsTab, vendorId?: ID, customerId?: ID, selectedAccount?: AccountBase, selectedClassBase?: ClassBase, selectedProjectBase?: ProjectBase, isUncategorizedExpenseCategoryEnabled?: boolean, isAccountingClassesEnabled?: boolean) => {
33
32
  localData: TransactionReviewLocalData;
@@ -39,7 +38,7 @@ export declare const getLineItemsByTransactionsIdsFromResponse: (transactions: S
39
38
  export declare const getLineItemsByTransactionIdsFromLocalData: (transactionLocalData: TransactionReviewLocalDataSelectorView[], selectedTab: TransactionsTab) => Record<ID, string[]>;
40
39
  export declare const mergeTabSpecificLineItems: (currentTabSpecificLineItems: TabSpecificLineItems, selectedTab: TransactionsTab, newLineItems: TabSpecificLineItems) => TabSpecificLineItems;
41
40
  export declare const getSnackbarMessageForTransactionReview: (updatedCount: number, failedCount: number, categorizedCount: number) => {
42
- messageSection: "common" | "transactionDetails_updatingPastTransactions" | "transactionDetails_transactionUpdated" | "cockpit_month_end_email_sent" | "cockpit_month_end_email_save" | "cockpit_month_end_email_attachment_upload" | "je_bill_link" | "je_posted" | "audit_score_updated" | "people_invite_people" | "people_invite_multiple_people" | "people_delete_person" | "people_update_person" | "reimbursement_updated" | "reimbursement_deleted" | "reimbursement_cancelled_deleted" | "reimbursement_cancelled" | "reimbursement_approved" | "reimbursement_rejected" | "reimbursement_sent_for_approval" | "account_added" | "business_verification_save" | "business_verification_submit" | "business_verification_from_bills_submit" | "plaid_connection" | "unlink_deposit_account" | "reimbursement_setup" | "reimbursement_approval_create" | "reimbursement_duplicate_approval_create" | "reimbursement_approval_update" | "reimbursement_duplicate_approval_update" | "reimbursement_approval_delete" | "reimbursement_create_mileage" | "reimbursement_update_mileage" | "reimbursement_accept_term" | "reimbursement_accept_employee_term" | "reimbursement_bulk_submit" | "reimbursement_bulk_processed" | "bill_pay_setup" | "zeni_accounts_setup" | "bill_pay_approval_create" | "bill_pay_duplicate_approval_create" | "bill_pay_approval_update" | "bill_pay_duplicate_approval_update" | "bill_pay_approval_delete" | "bill_pay_updated" | "bill_pay_deleted" | "bill_pay_cancelled_deleted" | "bill_pay_cancelled" | "bill_pay_approved" | "real_time_approver_added" | "bill_pay_rejected" | "bill_pay_sent_for_approval" | "bill_pay_accept_term" | "bill_pay_bulk_submit" | "bill_pay_bulk_processed" | "bill_pay_refund" | "bill_pay_retry" | "bill_pay_marked_as_paid" | "zeni_account_accept_term" | "update_vendor" | "data_refresh_update" | "delete_bank_account" | "create_bank_account" | "create_bank_account_ach" | "create_bank_account_wire" | "create_bank_account_international" | "transfer_money" | "update_zeni_account_nickname" | "create_checking_account" | "deposit_check" | "create_vendor" | "onboarding_customer_view" | "onboarding_customer_view_complete" | "onboarding_customer_identity_verification_save" | "onboarding_customer_identity_verification_submit" | "onboarding_customer_business_verification_save" | "onboarding_customer_business_verification_submit" | "retry_bank_account_connection" | "dashboard_invite_sent" | "onboarding_info_saved" | "approve_original_merchant" | "approve_global_merchant" | "reject_global_merchant" | "create_global_merchant" | "fetch_global_merchant_no_recommendation" | "save_vendor_renamed" | "save_vendor_sent_for_review" | "save_vendor_marked_as_employee" | "save_vendor_marked_as_local_contractor" | "charge_card_setup" | "charge_card_accept_term" | "charge_card_receipt_upload" | "charge_card_resend_invite" | "charge_card_revoke_invite" | "charge_card_update_limit" | "charge_cards_update_limit" | "close_charge_card" | "lock_charge_card" | "lock_charge_card_card_user" | "lock_charge_cards" | "unlock_charge_card" | "unlock_charge_card_card_user" | "unlock_charge_cards" | "close_charge_cards" | "revoke_invite_charge_cards" | "charge_card_express_interest" | "create_schedule" | "save_schedule" | "delete_schedule" | "ignore_schedule" | "save_task_detail" | "fetch_task_detail" | "delete_task" | "archive_task" | "snooze_task" | "unsnooze_task" | "create_tag" | "delete_tag" | "update_charge_card" | "update_charge_card_name" | "update_charge_card_name_card_user" | "issue_charge_card" | "issue_charge_cards" | "notification_settings_saved" | "referral_invite_sent" | "notification_mark_as_read" | "mark_as_complete_schedule" | "cancel_journal_entry" | "settings_accounting_accounts_updated" | "create_card_setup" | "confirm_card_setup" | "add_card_payment_source" | "fetch_payment_sources" | "task_assigned_toast_notification" | "task_due_tomorrow_toast_notification" | "task_deleted_toast_notification" | "task_archived_toast_notification" | "task_overdue_toast_notification" | "task_overdue_toast_notification_creator" | "task_notification_count" | "task_activities_toast_notification" | "task_created_toast_notification" | "task_group_creation_success" | "task_group_deletion_success" | "task_group_update_success" | "primary_funding_account_updated" | "task_time_spent_validation" | "missing_receipts_attachment" | "flux_analysis_unreviewed" | "flux_analysis_reviewed" | "receipt_match" | "receipts_upload" | "receipts_bulk_match" | "billing_address_view" | "express_pay_submit" | "exclude_transaction" | "reconcile" | "save_reconcile_for_later" | "recon_transaction_categorize" | "recon_transaction_match" | "update_debit_card_pin_attempt" | "set_debit_card_pin" | "ai_cfo_create_session_and_submit" | "ai_cfo_chat_session_deleted" | "charge_card_auto_pay_enable" | "charge_card_auto_pay_disable" | "treasury_setup" | "treasury_accept_term" | "treasury_transfer_money" | "treasury_transfer_money_failed" | "auto_transfer_rule_create" | "auto_transfer_rule_update" | "auto_transfer_rule_delete" | "auto_transfer_rule_pause" | "auto_transfer_rule_resume" | "treasury_update_portfolio_allocation" | "send_email_magic_link_to_user" | "complete_profile_done" | "reports_resync" | "invalid_phone_number" | "transactions_categorized_updated_failed" | "transaction_categorized_updated_failed" | "transactionsCategorized_transactionsUpdated" | "transactionsCategorized_transactionUpdated" | "transactionCategorized_transactionsUpdated" | "transactionCategorized_transactionUpdated" | "transactionsCategorized_transactionsFailed" | "transactionsCategorized_transactionFailed" | "transactionCategorized_transactionsFailed" | "transactionCategorized_transactionFailed" | "transactionsUpdated_transactionsFailed" | "transactionsUpdated_transactionFailed" | "transactionUpdated_transactionsFailed" | "transactionUpdated_transactionFailed" | "transactionsCategorized_transactionsUpdated_transactionsFailed" | "transactionsCategorized_transactionsUpdated_transactionFailed" | "transactionsCategorized_transactionUpdated_transactionsFailed" | "transactionCategorized_transactionsUpdated_transactionsFailed" | "transactionsCategorized_transactionUpdated_transactionFailed" | "transactionCategorized_transactionsUpdated_transactionFailed" | "transactionCategorized_transactionUpdated_transactionsFailed" | "transactionCategorized_transactionUpdated_transactionFailed" | "accounting_classes_enabled_update" | "account_excluded_from_reconciliation" | "account_included_in_reconciliation" | "ai_accountant_trigger_job" | "oauth_consent_approve" | "oauth_consent_invalid_request" | "credit_agent_update_profile" | "credit_agent_save_macro" | "credit_agent_schedule_cron";
41
+ messageSection: "common" | "transactionDetails_updatingPastTransactions" | "transactionDetails_transactionUpdated" | "cockpit_month_end_email_sent" | "cockpit_month_end_email_save" | "cockpit_month_end_email_attachment_upload" | "je_bill_link" | "je_posted" | "audit_score_updated" | "people_invite_people" | "people_invite_multiple_people" | "people_delete_person" | "people_update_person" | "reimbursement_updated" | "reimbursement_deleted" | "reimbursement_cancelled_deleted" | "reimbursement_cancelled" | "reimbursement_approved" | "reimbursement_rejected" | "reimbursement_sent_for_approval" | "account_added" | "business_verification_save" | "business_verification_submit" | "business_verification_from_bills_submit" | "plaid_connection" | "unlink_deposit_account" | "reimbursement_setup" | "reimbursement_approval_create" | "reimbursement_duplicate_approval_create" | "reimbursement_approval_update" | "reimbursement_duplicate_approval_update" | "reimbursement_approval_delete" | "reimbursement_create_mileage" | "reimbursement_update_mileage" | "reimbursement_accept_term" | "reimbursement_accept_employee_term" | "reimbursement_bulk_submit" | "reimbursement_bulk_processed" | "bill_pay_setup" | "zeni_accounts_setup" | "bill_pay_approval_create" | "bill_pay_duplicate_approval_create" | "bill_pay_approval_update" | "bill_pay_duplicate_approval_update" | "bill_pay_approval_delete" | "bill_pay_updated" | "bill_pay_deleted" | "bill_pay_cancelled_deleted" | "bill_pay_cancelled" | "bill_pay_approved" | "real_time_approver_added" | "bill_pay_rejected" | "bill_pay_sent_for_approval" | "bill_pay_accept_term" | "bill_pay_bulk_submit" | "bill_pay_bulk_processed" | "bill_pay_refund" | "bill_pay_retry" | "bill_pay_marked_as_paid" | "zeni_account_accept_term" | "update_vendor" | "data_refresh_update" | "delete_bank_account" | "create_bank_account" | "create_bank_account_ach" | "create_bank_account_wire" | "create_bank_account_international" | "transfer_money" | "update_zeni_account_nickname" | "create_checking_account" | "deposit_check" | "create_vendor" | "onboarding_customer_view" | "onboarding_customer_view_complete" | "onboarding_customer_identity_verification_save" | "onboarding_customer_identity_verification_submit" | "onboarding_customer_business_verification_save" | "onboarding_customer_business_verification_submit" | "retry_bank_account_connection" | "dashboard_invite_sent" | "onboarding_info_saved" | "approve_original_merchant" | "approve_global_merchant" | "reject_global_merchant" | "create_global_merchant" | "fetch_global_merchant_no_recommendation" | "save_vendor_renamed" | "save_vendor_sent_for_review" | "save_vendor_marked_as_employee" | "save_vendor_marked_as_local_contractor" | "charge_card_setup" | "charge_card_accept_term" | "charge_card_receipt_upload" | "charge_card_resend_invite" | "charge_card_revoke_invite" | "charge_card_update_limit" | "charge_cards_update_limit" | "close_charge_card" | "lock_charge_card" | "lock_charge_card_card_user" | "lock_charge_cards" | "unlock_charge_card" | "unlock_charge_card_card_user" | "unlock_charge_cards" | "close_charge_cards" | "revoke_invite_charge_cards" | "charge_card_express_interest" | "create_schedule" | "save_schedule" | "delete_schedule" | "ignore_schedule" | "save_task_detail" | "fetch_task_detail" | "delete_task" | "archive_task" | "snooze_task" | "unsnooze_task" | "create_tag" | "delete_tag" | "update_charge_card" | "update_charge_card_name" | "update_charge_card_name_card_user" | "issue_charge_card" | "issue_charge_cards" | "notification_settings_saved" | "referral_invite_sent" | "notification_mark_as_read" | "mark_as_complete_schedule" | "cancel_journal_entry" | "settings_accounting_accounts_updated" | "create_card_setup" | "confirm_card_setup" | "add_card_payment_source" | "fetch_payment_sources" | "task_assigned_toast_notification" | "task_due_tomorrow_toast_notification" | "task_deleted_toast_notification" | "task_archived_toast_notification" | "task_overdue_toast_notification" | "task_overdue_toast_notification_creator" | "task_notification_count" | "task_activities_toast_notification" | "task_created_toast_notification" | "task_group_creation_success" | "task_group_deletion_success" | "task_group_update_success" | "primary_funding_account_updated" | "task_time_spent_validation" | "missing_receipts_attachment" | "flux_analysis_unreviewed" | "flux_analysis_reviewed" | "receipt_match" | "receipts_upload" | "receipts_bulk_match" | "billing_address_view" | "express_pay_submit" | "exclude_transaction" | "reconcile" | "save_reconcile_for_later" | "recon_transaction_categorize" | "recon_transaction_match" | "update_debit_card_pin_attempt" | "set_debit_card_pin" | "ai_cfo_create_session_and_submit" | "ai_cfo_chat_session_deleted" | "charge_card_auto_pay_enable" | "charge_card_auto_pay_disable" | "treasury_setup" | "treasury_accept_term" | "treasury_transfer_money" | "treasury_transfer_money_failed" | "auto_transfer_rule_create" | "auto_transfer_rule_update" | "auto_transfer_rule_delete" | "auto_transfer_rule_pause" | "auto_transfer_rule_resume" | "treasury_update_portfolio_allocation" | "send_email_magic_link_to_user" | "complete_profile_done" | "create_transfer_entry" | "reports_resync" | "invalid_phone_number" | "transactions_categorized_updated_failed" | "transaction_categorized_updated_failed" | "transactionsCategorized_transactionsUpdated" | "transactionsCategorized_transactionUpdated" | "transactionCategorized_transactionsUpdated" | "transactionCategorized_transactionUpdated" | "transactionsCategorized_transactionsFailed" | "transactionsCategorized_transactionFailed" | "transactionCategorized_transactionsFailed" | "transactionCategorized_transactionFailed" | "transactionsUpdated_transactionsFailed" | "transactionsUpdated_transactionFailed" | "transactionUpdated_transactionsFailed" | "transactionUpdated_transactionFailed" | "transactionsCategorized_transactionsUpdated_transactionsFailed" | "transactionsCategorized_transactionsUpdated_transactionFailed" | "transactionsCategorized_transactionUpdated_transactionsFailed" | "transactionCategorized_transactionsUpdated_transactionsFailed" | "transactionsCategorized_transactionUpdated_transactionFailed" | "transactionCategorized_transactionsUpdated_transactionFailed" | "transactionCategorized_transactionUpdated_transactionsFailed" | "transactionCategorized_transactionUpdated_transactionFailed" | "accounting_classes_enabled_update" | "account_excluded_from_reconciliation" | "account_included_in_reconciliation" | "ai_accountant_trigger_job" | "oauth_consent_approve" | "oauth_consent_invalid_request" | "credit_agent_update_profile" | "credit_agent_save_macro" | "credit_agent_schedule_cron";
43
42
  messageText: "notification" | "failed" | "success";
44
43
  type: "error" | "success" | "info";
45
44
  variables: {
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.hasTransactionLocalDataChanges = exports.isAnyItemWithUncategorizedExpenseAccount = exports.getSnackbarMessageForTransactionReview = exports.mergeTabSpecificLineItems = exports.getLineItemsByTransactionIdsFromLocalData = exports.getLineItemsByTransactionsIdsFromResponse = exports.checkIfAllLineItemsAreCategoryClassFilled = exports.setEntityRecommendationForLineIdInLocalData = exports.toSetAllLineItemsToCategoryClass = exports.toTransactionDetailLocalData = exports.shouldAutoSelectAndAdd = exports.MAX_SELECTION_LIMIT = exports.filterAutoTabLineItems = exports.removeTransactionFromTabView = exports.getPendingReviewLineIdsFromTransaction = void 0;
3
+ exports.hasTransactionLocalDataChanges = exports.isAnyItemWithUncategorizedExpenseAccount = exports.getSnackbarMessageForTransactionReview = exports.mergeTabSpecificLineItems = exports.getLineItemsByTransactionIdsFromLocalData = exports.getLineItemsByTransactionsIdsFromResponse = exports.checkIfAllLineItemsAreCategoryClassFilled = exports.setEntityRecommendationForLineIdInLocalData = exports.toSetAllLineItemsToCategoryClass = exports.toTransactionDetailLocalData = exports.MAX_SELECTION_LIMIT = exports.filterAutoTabLineItems = exports.removeTransactionFromTabView = exports.getPendingReviewLineIdsFromTransaction = void 0;
4
4
  const vendorTransaction_1 = require("../../../entity/transaction/stateTypes/vendorTransaction");
5
5
  const transactionDetailLocalDataHelper_1 = require("../../transactionDetail/transactionDetailLocalDataHelper");
6
6
  const transactionDetailLocalDataHelper_2 = require("../../transactionDetail/transactionDetailLocalDataHelper");
@@ -65,23 +65,6 @@ const filterAutoTabLineItems = (tabView, transactionId, updatedTransaction) => {
65
65
  };
66
66
  exports.filterAutoTabLineItems = filterAutoTabLineItems;
67
67
  exports.MAX_SELECTION_LIMIT = 5;
68
- // Returns true when the transaction should be auto-added to the
69
- // selectedCheckBoxTransactionIds list after a categorization-related
70
- // state mutation: all line items are filled, the selection limit has
71
- // not been hit, and the id isn't already in the list. Consolidates the
72
- // triplet that was inlined at four sites (updateSelectedCustomer/Vendor,
73
- // setAllItemsToCategoryClassInLocalDataForCategorization, and
74
- // setEntityRecommendationForLineIdInLocalData below).
75
- const shouldAutoSelectAndAdd = (transaction, localData, selectedCheckBoxTransactionIds, uncategorizedAccounts, isUncategorizedExpenseCategoryEnabled, isAccountingClassesEnabled) => {
76
- if (selectedCheckBoxTransactionIds.includes(transaction.id)) {
77
- return false;
78
- }
79
- if (selectedCheckBoxTransactionIds.length >= exports.MAX_SELECTION_LIMIT) {
80
- return false;
81
- }
82
- return (0, exports.checkIfAllLineItemsAreCategoryClassFilled)(transaction, localData, uncategorizedAccounts, isUncategorizedExpenseCategoryEnabled, isAccountingClassesEnabled);
83
- };
84
- exports.shouldAutoSelectAndAdd = shouldAutoSelectAndAdd;
85
68
  const toTransactionDetailLocalData = (transaction, selectedTab, lineItemsByTransactionIds, uncategorizedIncomeExpense, isUncategorizedExpenseCategoryEnabled) => {
86
69
  const transactionLocal = {
87
70
  ...transactionsViewState_1.initialSupportedTransactionCategorization.transactionReviewLocalData,
@@ -569,14 +552,10 @@ const setEntityRecommendationForLineIdInLocalData = (draft, transaction, transac
569
552
  selectedEntity: transactionDetailLocalData.selectedEntity,
570
553
  tabSpecificLineItems: transactionDetailLocalData.tabSpecificLineItems,
571
554
  };
572
- // Auto-uncheck if not all line items are filled (the row's
573
- // category/class became stale after the entity update). Otherwise
574
- // route through shouldAutoSelectAndAdd so the MAX_SELECTION_LIMIT
575
- // gate is consistently applied across all auto-add sites.
576
555
  if (!(0, exports.checkIfAllLineItemsAreCategoryClassFilled)(transaction, newLocalData, uncategorizedAccounts, isUncategorizedExpenseCategoryEnabled, isAccountingClassesEnabled)) {
577
556
  selectedCheckBoxTransactionIds = selectedCheckBoxTransactionIds.filter((id) => id !== transaction.id);
578
557
  }
579
- else if ((0, exports.shouldAutoSelectAndAdd)(transaction, newLocalData, selectedCheckBoxTransactionIds, uncategorizedAccounts, isUncategorizedExpenseCategoryEnabled, isAccountingClassesEnabled)) {
558
+ else if (selectedCheckBoxTransactionIds.includes(transaction.id) === false) {
580
559
  selectedCheckBoxTransactionIds.push(transaction.id);
581
560
  }
582
561
  draft.selectedCheckBoxTransactionIds = selectedCheckBoxTransactionIds;