@zeniai/client-epic-state 4.19.77-betaML1 → 4.19.77-betaML99
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/snackbar/snackbarTypes.d.ts +1 -1
- package/lib/entity/snackbar/snackbarTypes.js +0 -1
- package/lib/epic.d.ts +1 -2
- package/lib/epic.js +1 -2
- package/lib/esm/entity/snackbar/snackbarTypes.js +0 -1
- package/lib/esm/epic.js +1 -2
- package/lib/esm/index.js +4 -4
- package/lib/esm/view/accountList/accountListReducer.js +1 -3
- package/lib/esm/view/accountList/accountListSelector.js +0 -8
- package/lib/esm/view/accountList/fetchAccountListEpic.js +10 -20
- package/lib/esm/view/expenseAutomationView/epics/transactionCategorization/fetchTransactionCategorizationViewEpic.js +0 -5
- package/lib/esm/view/expenseAutomationView/reducers/transactionsViewReducer.js +1 -30
- package/lib/esm/view/expenseAutomationView/selectors/transactionCategorizationSelector.js +0 -3
- package/lib/esm/view/taskManager/taskDetailView/taskDetailSelector.js +2 -2
- package/lib/esm/view/transactionDetail/epics/transactionDetailEpic.js +0 -5
- package/lib/esm/view/transactionDetail/transactionDetailSelector.js +0 -2
- package/lib/index.d.ts +4 -4
- package/lib/index.js +30 -35
- package/lib/tsconfig.typecheck.tsbuildinfo +1 -1
- package/lib/view/accountList/accountListReducer.d.ts +1 -2
- package/lib/view/accountList/accountListReducer.js +1 -3
- package/lib/view/accountList/accountListSelector.d.ts +1 -6
- package/lib/view/accountList/accountListSelector.js +1 -10
- package/lib/view/accountList/accountListState.d.ts +1 -1
- package/lib/view/accountList/fetchAccountListEpic.js +10 -20
- package/lib/view/expenseAutomationView/epics/transactionCategorization/fetchTransactionCategorizationViewEpic.js +0 -5
- package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.d.ts +1 -1
- package/lib/view/expenseAutomationView/reducers/transactionsViewReducer.d.ts +1 -17
- package/lib/view/expenseAutomationView/reducers/transactionsViewReducer.js +2 -31
- package/lib/view/expenseAutomationView/selectorTypes/transactionsViewSelectorTypes.d.ts +1 -10
- package/lib/view/expenseAutomationView/selectors/transactionCategorizationSelector.js +0 -3
- package/lib/view/taskManager/taskDetailView/taskDetailSelector.js +2 -2
- package/lib/view/transactionDetail/epics/transactionDetailEpic.js +0 -5
- package/lib/view/transactionDetail/transactionDetailSelector.d.ts +1 -4
- package/lib/view/transactionDetail/transactionDetailSelector.js +0 -2
- package/package.json +1 -1
- package/lib/esm/view/expenseAutomationView/epics/transactionCategorization/convertTransactionTypeEpic.js +0 -78
- package/lib/view/expenseAutomationView/epics/transactionCategorization/convertTransactionTypeEpic.d.ts +0 -38
- package/lib/view/expenseAutomationView/epics/transactionCategorization/convertTransactionTypeEpic.js +0 -82
|
@@ -3,8 +3,7 @@ import { AccountListResponse } from './accountListPayload';
|
|
|
3
3
|
import { AccountList, AccountListKeyType, AccountListState } from './accountListState';
|
|
4
4
|
export declare const initialAccountList: AccountList;
|
|
5
5
|
export declare const initialState: AccountListState;
|
|
6
|
-
export declare const fetchAccountList: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[accountListKey: AccountListKeyType, fetchFullResponse?: any, excludeAccountPayableAccounts?: any, excludeAccountReceivableAccounts?: any, isLimitedCategoryEnabled?: any, filterAccountTypes?: ("cash_position" | "fixed_assets" | "bank" | "credit_card" | "expenses" | "cogs" | "income" | "cash_in" | "cash_out" | "other_income" | "other_expense" | "accounts_receivable" | "other_current_assets" | "other_assets" | "accounts_payable" | "other_current_liabilities" | "long_term_liabilities" | "equity" | "current_liabilities" | "current_assets")[] | undefined, isIncludeDeleted?: boolean | undefined
|
|
7
|
-
query?: Record<string, unknown> | undefined;
|
|
6
|
+
export declare const fetchAccountList: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[accountListKey: AccountListKeyType, fetchFullResponse?: any, excludeAccountPayableAccounts?: any, excludeAccountReceivableAccounts?: any, isLimitedCategoryEnabled?: any, filterAccountTypes?: ("cash_position" | "fixed_assets" | "bank" | "credit_card" | "expenses" | "cogs" | "income" | "cash_in" | "cash_out" | "other_income" | "other_expense" | "accounts_receivable" | "other_current_assets" | "other_assets" | "accounts_payable" | "other_current_liabilities" | "long_term_liabilities" | "equity" | "current_liabilities" | "current_assets")[] | undefined, isIncludeDeleted?: boolean | undefined], {
|
|
8
7
|
isIncludeDeleted?: true | undefined;
|
|
9
8
|
accountListKey: AccountListKeyType;
|
|
10
9
|
fetchFullResponse: any;
|
|
@@ -34,7 +34,6 @@ exports.initialState = {
|
|
|
34
34
|
reimbursementAccountList: exports.initialAccountList,
|
|
35
35
|
schedulesAccountList: exports.initialAccountList,
|
|
36
36
|
billPayAccountList: exports.initialAccountList,
|
|
37
|
-
bankAndCreditCardAccounts: exports.initialAccountList,
|
|
38
37
|
},
|
|
39
38
|
};
|
|
40
39
|
const accountList = (0, toolkit_1.createSlice)({
|
|
@@ -50,7 +49,7 @@ const accountList = (0, toolkit_1.createSlice)({
|
|
|
50
49
|
error: undefined,
|
|
51
50
|
};
|
|
52
51
|
},
|
|
53
|
-
prepare(accountListKey, fetchFullResponse = false, excludeAccountPayableAccounts = false, excludeAccountReceivableAccounts = false, isLimitedCategoryEnabled = false, filterAccountTypes, isIncludeDeleted
|
|
52
|
+
prepare(accountListKey, fetchFullResponse = false, excludeAccountPayableAccounts = false, excludeAccountReceivableAccounts = false, isLimitedCategoryEnabled = false, filterAccountTypes, isIncludeDeleted) {
|
|
54
53
|
return {
|
|
55
54
|
payload: {
|
|
56
55
|
accountListKey,
|
|
@@ -60,7 +59,6 @@ const accountList = (0, toolkit_1.createSlice)({
|
|
|
60
59
|
isLimitedCategoryEnabled,
|
|
61
60
|
filterAccountTypes: filterAccountTypes ?? [],
|
|
62
61
|
...(isIncludeDeleted === true && { isIncludeDeleted }),
|
|
63
|
-
...(query != null && { query }),
|
|
64
62
|
},
|
|
65
63
|
};
|
|
66
64
|
},
|
|
@@ -2,7 +2,7 @@ import { NestedAccountHierarchyForReport } from '../../commonStateTypes/accountV
|
|
|
2
2
|
import { FetchState, ID } from '../../commonStateTypes/common';
|
|
3
3
|
import { SelectorView } from '../../commonStateTypes/viewAndReport/viewAndReport';
|
|
4
4
|
import { AccountBase, AccountLabel, AccountState } from '../../entity/account/accountState';
|
|
5
|
-
import {
|
|
5
|
+
import { AccountListKeyType, AccountListState } from './accountListState';
|
|
6
6
|
export interface AccountListSelectorView extends SelectorView {
|
|
7
7
|
accounts: AccountBase[];
|
|
8
8
|
}
|
|
@@ -28,8 +28,3 @@ export declare const getFilteredNestedAndAccountListsForLabel: (accountState: Ac
|
|
|
28
28
|
nestedAccountList: NestedAccountHierarchyForReport[];
|
|
29
29
|
};
|
|
30
30
|
export declare const getAccountIdsForLabel: (accountListState: AccountListState, accountListKey: AccountListKeyType, accountLabel: AccountLabel) => ID[];
|
|
31
|
-
/**
|
|
32
|
-
* Selector for bank and credit card accounts (e.g. used in the convert transaction type drawer).
|
|
33
|
-
* Fetched once when transaction categorization or transaction detail is loaded; result is cached.
|
|
34
|
-
*/
|
|
35
|
-
export declare const getBankAndCreditCardAccountList: (accountListState: AccountListState) => AccountList;
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.getAccountIdsForLabel = exports.getFilteredNestedAndAccountListsForLabel = exports.getNestedAccountListHierarchy = exports.getUncategorizedAccounts = exports.getAccountListFetchState = exports.getAccountList = void 0;
|
|
4
4
|
const accountSelector_1 = require("../../entity/account/accountSelector");
|
|
5
|
-
const BANK_AND_CREDIT_CARD_ACCOUNTS_KEY = 'bankAndCreditCardAccounts';
|
|
6
5
|
const getAccountList = (accountState, accountListState, accountListKey) => {
|
|
7
6
|
const accListState = accountListState.byReportId[accountListKey];
|
|
8
7
|
return {
|
|
@@ -82,11 +81,3 @@ const getAccountIdsForLabel = (accountListState, accountListKey, accountLabel) =
|
|
|
82
81
|
return [];
|
|
83
82
|
};
|
|
84
83
|
exports.getAccountIdsForLabel = getAccountIdsForLabel;
|
|
85
|
-
/**
|
|
86
|
-
* Selector for bank and credit card accounts (e.g. used in the convert transaction type drawer).
|
|
87
|
-
* Fetched once when transaction categorization or transaction detail is loaded; result is cached.
|
|
88
|
-
*/
|
|
89
|
-
const getBankAndCreditCardAccountList = (accountListState) => {
|
|
90
|
-
return accountListState.byReportId[BANK_AND_CREDIT_CARD_ACCOUNTS_KEY];
|
|
91
|
-
};
|
|
92
|
-
exports.getBankAndCreditCardAccountList = getBankAndCreditCardAccountList;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { NestedAccountHierarchyForReport } from '../../commonStateTypes/accountView/nestedAccountID';
|
|
2
2
|
import { FetchedState, ID } from '../../commonStateTypes/common';
|
|
3
3
|
import { AccountLabel } from '../../entity/account/accountState';
|
|
4
|
-
export type AccountListKeyType = 'accountList' | 'reimbursementAccountList' | 'schedulesAccountList' | 'billPayAccountList'
|
|
4
|
+
export type AccountListKeyType = 'accountList' | 'reimbursementAccountList' | 'schedulesAccountList' | 'billPayAccountList';
|
|
5
5
|
export interface AccountList extends FetchedState {
|
|
6
6
|
accountIds: ID[];
|
|
7
7
|
accountIdsByLabel: Record<AccountLabel, ID[]>;
|
|
@@ -16,36 +16,26 @@ const getAccountTypes = (isLimitedCategoryEnabled, filterAccountTypes) => {
|
|
|
16
16
|
return [];
|
|
17
17
|
};
|
|
18
18
|
const fetchAccountListEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(accountListReducer_1.fetchAccountList.match), (0, operators_1.mergeMap)((action) => {
|
|
19
|
-
const { accountListKey, fetchFullResponse, excludeAccountPayableAccounts, excludeAccountReceivableAccounts, isLimitedCategoryEnabled, filterAccountTypes, isIncludeDeleted,
|
|
20
|
-
const
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
return {
|
|
29
|
-
is_bookkeeping_admin: fetchFullResponse,
|
|
30
|
-
is_exclude_account_payable_accounts: excludeAccountPayableAccounts,
|
|
31
|
-
is_exclude_account_receivable_accounts: excludeAccountReceivableAccounts,
|
|
32
|
-
account_types: accountTypes,
|
|
33
|
-
...(isIncludeDeleted === true && { is_include_deleted: true }),
|
|
34
|
-
};
|
|
35
|
-
})();
|
|
19
|
+
const { accountListKey, fetchFullResponse, excludeAccountPayableAccounts, excludeAccountReceivableAccounts, isLimitedCategoryEnabled, filterAccountTypes, isIncludeDeleted, } = action.payload;
|
|
20
|
+
const accountTypes = getAccountTypes(isLimitedCategoryEnabled, filterAccountTypes);
|
|
21
|
+
const queryValue = {
|
|
22
|
+
is_bookkeeping_admin: fetchFullResponse,
|
|
23
|
+
is_exclude_account_payable_accounts: excludeAccountPayableAccounts,
|
|
24
|
+
is_exclude_account_receivable_accounts: excludeAccountReceivableAccounts,
|
|
25
|
+
account_types: accountTypes,
|
|
26
|
+
...(isIncludeDeleted === true && { is_include_deleted: true }),
|
|
27
|
+
};
|
|
36
28
|
return zeniAPI
|
|
37
29
|
.getJSON(`${zeniAPI.apiEndPoints.accountMicroServiceBaseUrl}/1.0/accounts?query=${encodeURIComponent(JSON.stringify(queryValue))}`)
|
|
38
30
|
.pipe((0, operators_1.mergeMap)((response) => {
|
|
39
31
|
if ((0, responsePayload_1.isSuccessResponse)(response)) {
|
|
40
32
|
const actions = [
|
|
33
|
+
(0, accountReducer_1.updateAccounts)(response.data?.accounts ?? [], 'account_list'),
|
|
41
34
|
(0, accountListReducer_1.updateAccountList)({
|
|
42
35
|
accountListKey,
|
|
43
36
|
accountListResponse: response,
|
|
44
37
|
}),
|
|
45
38
|
];
|
|
46
|
-
if (accountListKey !== 'bankAndCreditCardAccounts') {
|
|
47
|
-
actions.unshift((0, accountReducer_1.updateAccounts)(response.data?.accounts ?? [], 'account_list'));
|
|
48
|
-
}
|
|
49
39
|
return (0, rxjs_1.from)(actions);
|
|
50
40
|
}
|
|
51
41
|
else {
|
|
@@ -24,11 +24,6 @@ const fetchTransactionCategorizationViewEpic = (actions$, state$) => actions$.pi
|
|
|
24
24
|
accountList.fetchState === 'Not-Started') {
|
|
25
25
|
updateActions.push((0, accountListReducer_1.fetchAccountList)('accountList', true));
|
|
26
26
|
}
|
|
27
|
-
const bankAndCreditCardAccounts = state$.value.accountListState.byReportId.bankAndCreditCardAccounts;
|
|
28
|
-
if (bankAndCreditCardAccounts.hasValidState() === false &&
|
|
29
|
-
bankAndCreditCardAccounts.fetchState === 'Not-Started') {
|
|
30
|
-
updateActions.push((0, accountListReducer_1.fetchAccountList)('bankAndCreditCardAccounts'));
|
|
31
|
-
}
|
|
32
27
|
const classList = state$.value.classListState;
|
|
33
28
|
if (classList.hasValidState() === false &&
|
|
34
29
|
classList.fetchState === 'Not-Started') {
|
package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.d.ts
CHANGED
|
@@ -37,7 +37,7 @@ export declare const getLineItemsByTransactionsIdsFromResponse: (transactions: S
|
|
|
37
37
|
export declare const getLineItemsByTransactionIdsFromLocalData: (transactionLocalData: TransactionReviewLocalDataSelectorView[], selectedTab: TransactionsTab) => Record<ID, string[]>;
|
|
38
38
|
export declare const mergeTabSpecificLineItems: (currentTabSpecificLineItems: TabSpecificLineItems, selectedTab: TransactionsTab, newLineItems: TabSpecificLineItems) => TabSpecificLineItems;
|
|
39
39
|
export declare const getSnackbarMessageForTransactionReview: (updatedCount: number, failedCount: number, categorizedCount: number) => {
|
|
40
|
-
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" | "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" | "receipts_upload" | "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" | "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"
|
|
40
|
+
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" | "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" | "receipts_upload" | "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" | "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";
|
|
41
41
|
messageText: "notification" | "success" | "failed";
|
|
42
42
|
type: "error" | "success" | "info";
|
|
43
43
|
variables: {
|
|
@@ -149,23 +149,7 @@ export declare const fetchTransactionCategorization: import("@reduxjs/toolkit").
|
|
|
149
149
|
lineId: ID;
|
|
150
150
|
selectedTab: TransactionsTab;
|
|
151
151
|
transactionId: ID;
|
|
152
|
-
}, "expenseAutomationTransactionsView/updateSelectedTransactionId">,
|
|
153
|
-
selectedPeriod: MonthYearPeriod;
|
|
154
|
-
selectedTab: TransactionsTab;
|
|
155
|
-
transactionIds: ID[];
|
|
156
|
-
}, "expenseAutomationTransactionsView/removeTransactionsFromCategorizationList">, convertTransactionType: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
157
|
-
fromAccountIntegrationId: string;
|
|
158
|
-
selectedPeriod: MonthYearPeriod;
|
|
159
|
-
selectedTab: TransactionsTab;
|
|
160
|
-
toAccountIntegrationId: string;
|
|
161
|
-
transactionId: ID;
|
|
162
|
-
transactionType: "transfer" | "credit_card_payment";
|
|
163
|
-
}, "expenseAutomationTransactionsView/convertTransactionType">, convertTransactionTypeSuccess: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
164
|
-
transactionId: ID;
|
|
165
|
-
}, "expenseAutomationTransactionsView/convertTransactionTypeSuccess">, convertTransactionTypeFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
166
|
-
error: ZeniAPIStatus;
|
|
167
|
-
transactionId: ID;
|
|
168
|
-
}, "expenseAutomationTransactionsView/convertTransactionTypeFailure">, syncTransactionCategorizationFromDetailSave: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[transactionId: TransactionID, updatedTransaction: SupportedTransactionWithCOT, pendingReviewLineIds: string[], uncategorizedIncomeExpense: UncategorizedAccounts, isUncategorizedExpenseCategoryEnabled?: boolean | undefined], {
|
|
152
|
+
}, "expenseAutomationTransactionsView/updateSelectedTransactionId">, syncTransactionCategorizationFromDetailSave: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[transactionId: TransactionID, updatedTransaction: SupportedTransactionWithCOT, pendingReviewLineIds: string[], uncategorizedIncomeExpense: UncategorizedAccounts, isUncategorizedExpenseCategoryEnabled?: boolean | undefined], {
|
|
169
153
|
transactionId: TransactionID;
|
|
170
154
|
updatedTransaction: SupportedTransactionWithCOT;
|
|
171
155
|
pendingReviewLineIds: string[];
|
|
@@ -4,7 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
var _a;
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.backgroundRefetchReviewTab = exports.syncTransactionCategorizationFromDetailSave = exports.
|
|
7
|
+
exports.backgroundRefetchReviewTab = exports.syncTransactionCategorizationFromDetailSave = exports.updateSelectedTransactionId = exports.setEntityRecommendationForLineIdsForCategorization = exports.clearExpenseAutomationTransactionsView = exports.clearExpenseAutomationTransactionsViewPerTabView = exports.updateSelectedCheckboxTransactionIds = exports.fetchTransactionCategorizationView = exports.resetOtherTabsFetchState = exports.fetchTransactionCategorizationSuccess = exports.updateTotalCountForTransactionCategorization = exports.setAllItemsToCategoryClassInLocalDataForCategorization = exports.updateSelectedCustomerForTransaction = exports.updateSelectedVendorForTransaction = exports.updateStatusForTransactionNotMiscategorizedUpdateForCategorization = exports.markTransactionAsNotMiscategorized = exports.updateTransactionCategorizationSaveStatus = exports.updateCurrentSelectedTransactionCategorizationTab = exports.updateTransactionCategorization = exports.saveTransactionCategorization = exports.fetchTransactionCategorizationFailure = exports.saveTransactionCategorizationLocalData = exports.initializeTransactionCategorizationViewLocalData = exports.updateTransactionCategorizationUIState = exports.fetchTransactionCategorization = exports.initialState = exports.initialTransactionTabViewState = void 0;
|
|
8
8
|
const toolkit_1 = require("@reduxjs/toolkit");
|
|
9
9
|
const get_1 = __importDefault(require("lodash/get"));
|
|
10
10
|
const uniq_1 = __importDefault(require("lodash/uniq"));
|
|
@@ -706,35 +706,6 @@ const expenseAutomationTransactionsView = (0, toolkit_1.createSlice)({
|
|
|
706
706
|
clearExpenseAutomationTransactionsView(draft) {
|
|
707
707
|
Object.assign(draft, exports.initialState);
|
|
708
708
|
},
|
|
709
|
-
removeTransactionsFromCategorizationList(draft, action) {
|
|
710
|
-
const { selectedTab, selectedPeriod, transactionIds } = action.payload;
|
|
711
|
-
const periodId = (0, timePeriod_1.toMonthYearPeriodId)(selectedPeriod);
|
|
712
|
-
const tabView = draft.transactionCategorizationView[selectedTab];
|
|
713
|
-
const currentIds = tabView.transactionIdsBySelectedPeriod[periodId] ?? [];
|
|
714
|
-
tabView.transactionIdsBySelectedPeriod[periodId] = currentIds.filter((id) => !transactionIds.includes(id));
|
|
715
|
-
transactionIds.forEach((id) => {
|
|
716
|
-
delete tabView.transactionReviewLocalDataById[id];
|
|
717
|
-
});
|
|
718
|
-
tabView.selectedCheckBoxTransactionIds =
|
|
719
|
-
tabView.selectedCheckBoxTransactionIds.filter((id) => !transactionIds.includes(id));
|
|
720
|
-
tabView.transactionIdsWithUnsavedData =
|
|
721
|
-
tabView.transactionIdsWithUnsavedData.filter((id) => !transactionIds.includes(id));
|
|
722
|
-
},
|
|
723
|
-
convertTransactionType(_draft, _action) {
|
|
724
|
-
// Trigger only; epic performs the API call. No state change.
|
|
725
|
-
void _draft;
|
|
726
|
-
void _action;
|
|
727
|
-
},
|
|
728
|
-
convertTransactionTypeSuccess(_draft, _action) {
|
|
729
|
-
// UI can listen for this to close the convert drawer. No state change.
|
|
730
|
-
void _draft;
|
|
731
|
-
void _action;
|
|
732
|
-
},
|
|
733
|
-
convertTransactionTypeFailure(_draft, _action) {
|
|
734
|
-
// UI can listen for this to show error in the convert drawer. No state change.
|
|
735
|
-
void _draft;
|
|
736
|
-
void _action;
|
|
737
|
-
},
|
|
738
709
|
syncTransactionCategorizationFromDetailSave: {
|
|
739
710
|
prepare(transactionId, updatedTransaction, pendingReviewLineIds, uncategorizedIncomeExpense, isUncategorizedExpenseCategoryEnabled) {
|
|
740
711
|
return {
|
|
@@ -806,5 +777,5 @@ const expenseAutomationTransactionsView = (0, toolkit_1.createSlice)({
|
|
|
806
777
|
},
|
|
807
778
|
},
|
|
808
779
|
});
|
|
809
|
-
_a = expenseAutomationTransactionsView.actions, exports.fetchTransactionCategorization = _a.fetchTransactionCategorization, exports.updateTransactionCategorizationUIState = _a.updateTransactionCategorizationUIState, exports.initializeTransactionCategorizationViewLocalData = _a.initializeTransactionCategorizationViewLocalData, exports.saveTransactionCategorizationLocalData = _a.saveTransactionCategorizationLocalData, exports.fetchTransactionCategorizationFailure = _a.fetchTransactionCategorizationFailure, exports.saveTransactionCategorization = _a.saveTransactionCategorization, exports.updateTransactionCategorization = _a.updateTransactionCategorization, exports.updateCurrentSelectedTransactionCategorizationTab = _a.updateCurrentSelectedTransactionCategorizationTab, exports.updateTransactionCategorizationSaveStatus = _a.updateTransactionCategorizationSaveStatus, exports.markTransactionAsNotMiscategorized = _a.markTransactionAsNotMiscategorized, exports.updateStatusForTransactionNotMiscategorizedUpdateForCategorization = _a.updateStatusForTransactionNotMiscategorizedUpdateForCategorization, exports.updateSelectedVendorForTransaction = _a.updateSelectedVendorForTransaction, exports.updateSelectedCustomerForTransaction = _a.updateSelectedCustomerForTransaction, exports.setAllItemsToCategoryClassInLocalDataForCategorization = _a.setAllItemsToCategoryClassInLocalDataForCategorization, exports.updateTotalCountForTransactionCategorization = _a.updateTotalCountForTransactionCategorization, exports.fetchTransactionCategorizationSuccess = _a.fetchTransactionCategorizationSuccess, exports.resetOtherTabsFetchState = _a.resetOtherTabsFetchState, exports.fetchTransactionCategorizationView = _a.fetchTransactionCategorizationView, exports.updateSelectedCheckboxTransactionIds = _a.updateSelectedCheckboxTransactionIds, exports.clearExpenseAutomationTransactionsViewPerTabView = _a.clearExpenseAutomationTransactionsViewPerTabView, exports.clearExpenseAutomationTransactionsView = _a.clearExpenseAutomationTransactionsView, exports.setEntityRecommendationForLineIdsForCategorization = _a.setEntityRecommendationForLineIdsForCategorization, exports.updateSelectedTransactionId = _a.updateSelectedTransactionId, exports.
|
|
780
|
+
_a = expenseAutomationTransactionsView.actions, exports.fetchTransactionCategorization = _a.fetchTransactionCategorization, exports.updateTransactionCategorizationUIState = _a.updateTransactionCategorizationUIState, exports.initializeTransactionCategorizationViewLocalData = _a.initializeTransactionCategorizationViewLocalData, exports.saveTransactionCategorizationLocalData = _a.saveTransactionCategorizationLocalData, exports.fetchTransactionCategorizationFailure = _a.fetchTransactionCategorizationFailure, exports.saveTransactionCategorization = _a.saveTransactionCategorization, exports.updateTransactionCategorization = _a.updateTransactionCategorization, exports.updateCurrentSelectedTransactionCategorizationTab = _a.updateCurrentSelectedTransactionCategorizationTab, exports.updateTransactionCategorizationSaveStatus = _a.updateTransactionCategorizationSaveStatus, exports.markTransactionAsNotMiscategorized = _a.markTransactionAsNotMiscategorized, exports.updateStatusForTransactionNotMiscategorizedUpdateForCategorization = _a.updateStatusForTransactionNotMiscategorizedUpdateForCategorization, exports.updateSelectedVendorForTransaction = _a.updateSelectedVendorForTransaction, exports.updateSelectedCustomerForTransaction = _a.updateSelectedCustomerForTransaction, exports.setAllItemsToCategoryClassInLocalDataForCategorization = _a.setAllItemsToCategoryClassInLocalDataForCategorization, exports.updateTotalCountForTransactionCategorization = _a.updateTotalCountForTransactionCategorization, exports.fetchTransactionCategorizationSuccess = _a.fetchTransactionCategorizationSuccess, exports.resetOtherTabsFetchState = _a.resetOtherTabsFetchState, exports.fetchTransactionCategorizationView = _a.fetchTransactionCategorizationView, exports.updateSelectedCheckboxTransactionIds = _a.updateSelectedCheckboxTransactionIds, exports.clearExpenseAutomationTransactionsViewPerTabView = _a.clearExpenseAutomationTransactionsViewPerTabView, exports.clearExpenseAutomationTransactionsView = _a.clearExpenseAutomationTransactionsView, exports.setEntityRecommendationForLineIdsForCategorization = _a.setEntityRecommendationForLineIdsForCategorization, exports.updateSelectedTransactionId = _a.updateSelectedTransactionId, exports.syncTransactionCategorizationFromDetailSave = _a.syncTransactionCategorizationFromDetailSave, exports.backgroundRefetchReviewTab = _a.backgroundRefetchReviewTab;
|
|
810
781
|
exports.default = expenseAutomationTransactionsView.reducer;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { NestedAccountHierarchyForReport } from '../../../commonStateTypes/accountView/nestedAccountID';
|
|
2
2
|
import { NestedClassHierarchyForReport } from '../../../commonStateTypes/classesView/nestedClassID';
|
|
3
|
-
import { CompletionStatusType,
|
|
3
|
+
import { CompletionStatusType, FetchStateAndError, ID } from '../../../commonStateTypes/common';
|
|
4
4
|
import { SelectorView } from '../../../commonStateTypes/viewAndReport/viewAndReport';
|
|
5
5
|
import { AccountBase } from '../../../entity/account/accountState';
|
|
6
6
|
import { ClassBase } from '../../../entity/class/classState';
|
|
@@ -11,20 +11,12 @@ export interface TransactionReviewLocalDataSelectorView {
|
|
|
11
11
|
transactionId: ID;
|
|
12
12
|
transactionReviewLocalData: TransactionReviewLocalData;
|
|
13
13
|
}
|
|
14
|
-
/** Debit account fetch for transfer drawer (keyed by transaction id string). */
|
|
15
|
-
export interface TransactionCategorizationDebitAccountInfo {
|
|
16
|
-
fetchState: FetchState;
|
|
17
|
-
accountId?: ID;
|
|
18
|
-
accountName?: string;
|
|
19
|
-
}
|
|
20
14
|
export interface ExpenseAutomationTransactionViewSelector extends SelectorView {
|
|
21
15
|
accountList: AccountBase[];
|
|
22
16
|
accountsHierarchyList: NestedAccountHierarchyForReport[];
|
|
23
17
|
classHierarchyList: NestedClassHierarchyForReport[];
|
|
24
18
|
classList: ClassBase[];
|
|
25
19
|
completionStatus: CompletionStatusType;
|
|
26
|
-
createTransferEntryStatus: FetchState;
|
|
27
|
-
debitAccountInfoByTransactionId: Record<ID, TransactionCategorizationDebitAccountInfo>;
|
|
28
20
|
fetchStateByTransactionTabs: Record<TransactionsTab, FetchStateAndError>;
|
|
29
21
|
markAsNotMiscategorizedStatus: FetchStateAndError;
|
|
30
22
|
refreshStatus: FetchStateAndError;
|
|
@@ -34,7 +26,6 @@ export interface ExpenseAutomationTransactionViewSelector extends SelectorView {
|
|
|
34
26
|
transactionIdsWithUnsavedData: ID[];
|
|
35
27
|
transactionLocalData: TransactionReviewLocalDataSelectorView[];
|
|
36
28
|
transactions: SupportedTransactionWithCOT[];
|
|
37
|
-
transferAccounts: AccountBase[];
|
|
38
29
|
uiState: TransactionsViewUIState;
|
|
39
30
|
uncategorizedAccounts: UncategorizedAccounts;
|
|
40
31
|
selectedTransactionId?: ID;
|
|
@@ -102,8 +102,5 @@ function getExpenseAutomationTransactionView(state) {
|
|
|
102
102
|
fetchStateByTransactionTabs: fetchStateByTab,
|
|
103
103
|
selectedTransactionId,
|
|
104
104
|
selectedTransactionLineId,
|
|
105
|
-
createTransferEntryStatus: 'Not-Started',
|
|
106
|
-
transferAccounts: [],
|
|
107
|
-
debitAccountInfoByTransactionId: {},
|
|
108
105
|
};
|
|
109
106
|
}
|
|
@@ -40,11 +40,6 @@ const fetchTransactionDetailEpic = (actions$, state$, zeniAPI) => actions$.pipe(
|
|
|
40
40
|
accountList.fetchState !== 'In-Progress') {
|
|
41
41
|
transactionActions.push((0, accountListReducer_1.fetchAccountList)('accountList'));
|
|
42
42
|
}
|
|
43
|
-
const bankAndCreditCardAccounts = state$.value.accountListState.byReportId.bankAndCreditCardAccounts;
|
|
44
|
-
if (bankAndCreditCardAccounts.hasValidState() === false &&
|
|
45
|
-
bankAndCreditCardAccounts.fetchState !== 'In-Progress') {
|
|
46
|
-
transactionActions.push((0, accountListReducer_1.fetchAccountList)('bankAndCreditCardAccounts'));
|
|
47
|
-
}
|
|
48
43
|
const classList = state$.value.classListState;
|
|
49
44
|
if (classList.hasValidState() === false &&
|
|
50
45
|
classList.fetchState !== 'In-Progress') {
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { NestedAccountHierarchyForReport } from '../../commonStateTypes/accountView/nestedAccountID';
|
|
2
2
|
import { NestedClassHierarchyForReport } from '../../commonStateTypes/classesView/nestedClassID';
|
|
3
|
-
import {
|
|
3
|
+
import { FetchStateAndError } from '../../commonStateTypes/common';
|
|
4
4
|
import { SelectorView } from '../../commonStateTypes/viewAndReport/viewAndReport';
|
|
5
|
-
import { AccountBase } from '../../entity/account/accountState';
|
|
6
5
|
import { TransactionID } from '../../entity/transaction/stateTypes/transaction';
|
|
7
6
|
import { SupportedTransactionWithCOT } from '../../entity/transaction/transactionState';
|
|
8
7
|
import { Vendor } from '../../entity/vendor/vendorState';
|
|
@@ -17,12 +16,10 @@ export interface TransactionDetailReport extends SelectorView {
|
|
|
17
16
|
allVendors: Vendor[];
|
|
18
17
|
classHierarchyList: NestedClassHierarchyForReport[];
|
|
19
18
|
classList: ClassListSelectorView;
|
|
20
|
-
createTransferEntryStatus: FetchState;
|
|
21
19
|
deleteStatusByAttachmentName: Record<string, FetchStateAndError>;
|
|
22
20
|
linkedTransactions: SupportedTransactionWithCOT[];
|
|
23
21
|
transactionDetailLocalData: TransactionDetailLocalData;
|
|
24
22
|
transactionDetailUpdateStatus: FetchStateAndError;
|
|
25
|
-
transferAccounts: AccountBase[];
|
|
26
23
|
isUpdateNotAllowed?: boolean;
|
|
27
24
|
transaction?: SupportedTransactionWithCOT;
|
|
28
25
|
}
|
|
@@ -83,8 +83,6 @@ const getTransactionDetail = (state, transactionId, fetchLinkedTransactions = tr
|
|
|
83
83
|
transactionDetailState_1.initialSupportedTransactionDetail.transactionDetailLocalData,
|
|
84
84
|
selectedVendor: transactionDetail?.transactionDetailLocalData.vendorUpdates,
|
|
85
85
|
allVendors: vendors,
|
|
86
|
-
createTransferEntryStatus: 'Not-Started',
|
|
87
|
-
transferAccounts: [],
|
|
88
86
|
};
|
|
89
87
|
};
|
|
90
88
|
exports.getTransactionDetail = getTransactionDetail;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zeniai/client-epic-state",
|
|
3
|
-
"version": "4.19.77-
|
|
3
|
+
"version": "4.19.77-betaML99",
|
|
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,78 +0,0 @@
|
|
|
1
|
-
import { from } from 'rxjs';
|
|
2
|
-
import { catchError, filter, mergeMap } from 'rxjs/operators';
|
|
3
|
-
import { openSnackbar } from '../../../../entity/snackbar/snackbarReducer';
|
|
4
|
-
import { createZeniAPIStatus, isSuccessStatus, } from '../../../../responsePayload';
|
|
5
|
-
import { convertTransactionType, convertTransactionTypeFailure, convertTransactionTypeSuccess, removeTransactionsFromCategorizationList, } from '../../reducers/transactionsViewReducer';
|
|
6
|
-
function toConvertTransactionTypePayload(payload) {
|
|
7
|
-
return {
|
|
8
|
-
from_account_integration_id: payload.fromAccountIntegrationId,
|
|
9
|
-
to_account_integration_id: payload.toAccountIntegrationId,
|
|
10
|
-
transaction_id: payload.transactionId,
|
|
11
|
-
transaction_type: payload.transactionType,
|
|
12
|
-
};
|
|
13
|
-
}
|
|
14
|
-
export const convertTransactionTypeEpic = (actions$, _state$, zeniAPI) => actions$.pipe(filter(convertTransactionType.match), mergeMap((action) => {
|
|
15
|
-
const { transactionId, transactionType, toAccountIntegrationId, fromAccountIntegrationId, selectedTab, selectedPeriod, } = action.payload;
|
|
16
|
-
const apiPayload = toConvertTransactionTypePayload({
|
|
17
|
-
transactionId,
|
|
18
|
-
transactionType,
|
|
19
|
-
toAccountIntegrationId,
|
|
20
|
-
fromAccountIntegrationId,
|
|
21
|
-
});
|
|
22
|
-
return zeniAPI
|
|
23
|
-
.putAndGetJSON(`${zeniAPI.apiEndPoints.accountMicroServiceBaseUrl}/1.0/transactions/transaction-type`, apiPayload)
|
|
24
|
-
.pipe(mergeMap((response) => {
|
|
25
|
-
if (isSuccessStatus(response)) {
|
|
26
|
-
return from([
|
|
27
|
-
removeTransactionsFromCategorizationList({
|
|
28
|
-
selectedTab,
|
|
29
|
-
selectedPeriod,
|
|
30
|
-
transactionIds: [transactionId],
|
|
31
|
-
}),
|
|
32
|
-
convertTransactionTypeSuccess({ transactionId }),
|
|
33
|
-
openSnackbar({
|
|
34
|
-
messageSection: 'convert_transaction_type',
|
|
35
|
-
messageText: 'success',
|
|
36
|
-
type: 'success',
|
|
37
|
-
}),
|
|
38
|
-
]);
|
|
39
|
-
}
|
|
40
|
-
const errorStatus = response.status ?? {
|
|
41
|
-
code: 0,
|
|
42
|
-
message: 'Unknown error',
|
|
43
|
-
};
|
|
44
|
-
return from([
|
|
45
|
-
convertTransactionTypeFailure({
|
|
46
|
-
transactionId,
|
|
47
|
-
error: errorStatus,
|
|
48
|
-
}),
|
|
49
|
-
openSnackbar({
|
|
50
|
-
messageSection: 'convert_transaction_type',
|
|
51
|
-
messageText: 'failed',
|
|
52
|
-
type: 'error',
|
|
53
|
-
variables: [
|
|
54
|
-
{
|
|
55
|
-
variableName: 'errorMessage',
|
|
56
|
-
variableValue: errorStatus.message ?? errorStatus.title ?? 'Request failed',
|
|
57
|
-
},
|
|
58
|
-
],
|
|
59
|
-
}),
|
|
60
|
-
]);
|
|
61
|
-
}), catchError((error) => from([
|
|
62
|
-
convertTransactionTypeFailure({
|
|
63
|
-
transactionId,
|
|
64
|
-
error: createZeniAPIStatus('Unexpected Error', `Convert transaction type failed: ${JSON.stringify(error)}`),
|
|
65
|
-
}),
|
|
66
|
-
openSnackbar({
|
|
67
|
-
messageSection: 'convert_transaction_type',
|
|
68
|
-
messageText: 'failed',
|
|
69
|
-
type: 'error',
|
|
70
|
-
variables: [
|
|
71
|
-
{
|
|
72
|
-
variableName: 'errorMessage',
|
|
73
|
-
variableValue: error instanceof Error ? error.message : String(error),
|
|
74
|
-
},
|
|
75
|
-
],
|
|
76
|
-
}),
|
|
77
|
-
])));
|
|
78
|
-
}));
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { ActionsObservable, StateObservable } from 'redux-observable';
|
|
2
|
-
import { ID } from '../../../../commonStateTypes/common';
|
|
3
|
-
import { openSnackbar } from '../../../../entity/snackbar/snackbarReducer';
|
|
4
|
-
import { RootState } from '../../../../reducer';
|
|
5
|
-
import { ZeniAPI } from '../../../../zeniAPI';
|
|
6
|
-
import { convertTransactionType, convertTransactionTypeFailure, convertTransactionTypeSuccess, removeTransactionsFromCategorizationList } from '../../reducers/transactionsViewReducer';
|
|
7
|
-
export type ActionType = ReturnType<typeof convertTransactionType> | ReturnType<typeof convertTransactionTypeSuccess> | ReturnType<typeof convertTransactionTypeFailure> | ReturnType<typeof removeTransactionsFromCategorizationList> | ReturnType<typeof openSnackbar>;
|
|
8
|
-
export declare const convertTransactionTypeEpic: (actions$: ActionsObservable<ActionType>, _state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => import("rxjs").Observable<{
|
|
9
|
-
payload: {
|
|
10
|
-
messageSection: import("../../../..").SnackbarMessageSections;
|
|
11
|
-
messageText: import("../../../..").SnackbarMessageSectionTexts;
|
|
12
|
-
type: import("../../../..").SnackbarMessageType;
|
|
13
|
-
showStatusIcon?: boolean;
|
|
14
|
-
variables?: {
|
|
15
|
-
variableName: string;
|
|
16
|
-
variableValue: string;
|
|
17
|
-
}[];
|
|
18
|
-
};
|
|
19
|
-
type: "snackbar/openSnackbar";
|
|
20
|
-
} | {
|
|
21
|
-
payload: {
|
|
22
|
-
transactionId: ID;
|
|
23
|
-
};
|
|
24
|
-
type: "expenseAutomationTransactionsView/convertTransactionTypeSuccess";
|
|
25
|
-
} | {
|
|
26
|
-
payload: {
|
|
27
|
-
error: import("../../../../responsePayload").ZeniAPIStatus;
|
|
28
|
-
transactionId: ID;
|
|
29
|
-
};
|
|
30
|
-
type: "expenseAutomationTransactionsView/convertTransactionTypeFailure";
|
|
31
|
-
} | {
|
|
32
|
-
payload: {
|
|
33
|
-
selectedPeriod: import("../../../..").MonthYearPeriod;
|
|
34
|
-
selectedTab: import("../../types/transactionsViewState").TransactionsTab;
|
|
35
|
-
transactionIds: ID[];
|
|
36
|
-
};
|
|
37
|
-
type: "expenseAutomationTransactionsView/removeTransactionsFromCategorizationList";
|
|
38
|
-
}>;
|
package/lib/view/expenseAutomationView/epics/transactionCategorization/convertTransactionTypeEpic.js
DELETED
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.convertTransactionTypeEpic = 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 responsePayload_1 = require("../../../../responsePayload");
|
|
8
|
-
const transactionsViewReducer_1 = require("../../reducers/transactionsViewReducer");
|
|
9
|
-
function toConvertTransactionTypePayload(payload) {
|
|
10
|
-
return {
|
|
11
|
-
from_account_integration_id: payload.fromAccountIntegrationId,
|
|
12
|
-
to_account_integration_id: payload.toAccountIntegrationId,
|
|
13
|
-
transaction_id: payload.transactionId,
|
|
14
|
-
transaction_type: payload.transactionType,
|
|
15
|
-
};
|
|
16
|
-
}
|
|
17
|
-
const convertTransactionTypeEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(transactionsViewReducer_1.convertTransactionType.match), (0, operators_1.mergeMap)((action) => {
|
|
18
|
-
const { transactionId, transactionType, toAccountIntegrationId, fromAccountIntegrationId, selectedTab, selectedPeriod, } = action.payload;
|
|
19
|
-
const apiPayload = toConvertTransactionTypePayload({
|
|
20
|
-
transactionId,
|
|
21
|
-
transactionType,
|
|
22
|
-
toAccountIntegrationId,
|
|
23
|
-
fromAccountIntegrationId,
|
|
24
|
-
});
|
|
25
|
-
return zeniAPI
|
|
26
|
-
.putAndGetJSON(`${zeniAPI.apiEndPoints.accountMicroServiceBaseUrl}/1.0/transactions/transaction-type`, apiPayload)
|
|
27
|
-
.pipe((0, operators_1.mergeMap)((response) => {
|
|
28
|
-
if ((0, responsePayload_1.isSuccessStatus)(response)) {
|
|
29
|
-
return (0, rxjs_1.from)([
|
|
30
|
-
(0, transactionsViewReducer_1.removeTransactionsFromCategorizationList)({
|
|
31
|
-
selectedTab,
|
|
32
|
-
selectedPeriod,
|
|
33
|
-
transactionIds: [transactionId],
|
|
34
|
-
}),
|
|
35
|
-
(0, transactionsViewReducer_1.convertTransactionTypeSuccess)({ transactionId }),
|
|
36
|
-
(0, snackbarReducer_1.openSnackbar)({
|
|
37
|
-
messageSection: 'convert_transaction_type',
|
|
38
|
-
messageText: 'success',
|
|
39
|
-
type: 'success',
|
|
40
|
-
}),
|
|
41
|
-
]);
|
|
42
|
-
}
|
|
43
|
-
const errorStatus = response.status ?? {
|
|
44
|
-
code: 0,
|
|
45
|
-
message: 'Unknown error',
|
|
46
|
-
};
|
|
47
|
-
return (0, rxjs_1.from)([
|
|
48
|
-
(0, transactionsViewReducer_1.convertTransactionTypeFailure)({
|
|
49
|
-
transactionId,
|
|
50
|
-
error: errorStatus,
|
|
51
|
-
}),
|
|
52
|
-
(0, snackbarReducer_1.openSnackbar)({
|
|
53
|
-
messageSection: 'convert_transaction_type',
|
|
54
|
-
messageText: 'failed',
|
|
55
|
-
type: 'error',
|
|
56
|
-
variables: [
|
|
57
|
-
{
|
|
58
|
-
variableName: 'errorMessage',
|
|
59
|
-
variableValue: errorStatus.message ?? errorStatus.title ?? 'Request failed',
|
|
60
|
-
},
|
|
61
|
-
],
|
|
62
|
-
}),
|
|
63
|
-
]);
|
|
64
|
-
}), (0, operators_1.catchError)((error) => (0, rxjs_1.from)([
|
|
65
|
-
(0, transactionsViewReducer_1.convertTransactionTypeFailure)({
|
|
66
|
-
transactionId,
|
|
67
|
-
error: (0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', `Convert transaction type failed: ${JSON.stringify(error)}`),
|
|
68
|
-
}),
|
|
69
|
-
(0, snackbarReducer_1.openSnackbar)({
|
|
70
|
-
messageSection: 'convert_transaction_type',
|
|
71
|
-
messageText: 'failed',
|
|
72
|
-
type: 'error',
|
|
73
|
-
variables: [
|
|
74
|
-
{
|
|
75
|
-
variableName: 'errorMessage',
|
|
76
|
-
variableValue: error instanceof Error ? error.message : String(error),
|
|
77
|
-
},
|
|
78
|
-
],
|
|
79
|
-
}),
|
|
80
|
-
])));
|
|
81
|
-
}));
|
|
82
|
-
exports.convertTransactionTypeEpic = convertTransactionTypeEpic;
|