@zeniai/client-epic-state 4.11.58 → 4.11.59
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/cardPayment/cardPaymentPayload.d.ts +2 -2
- package/lib/entity/cardPayment/cardPaymentPayload.js +14 -11
- package/lib/entity/chargeCardTransaction/chargeCardTransaction.d.ts +1 -1
- package/lib/entity/company/companyPayload.d.ts +12 -0
- package/lib/entity/company/companyPayload.js +21 -0
- package/lib/entity/company/companyReducer.d.ts +7 -0
- package/lib/entity/company/companyReducer.js +22 -2
- package/lib/entity/company/companyStateTypes.d.ts +12 -0
- package/lib/entity/depositAccountTransaction/depositAccountTransaction.d.ts +1 -1
- package/lib/entity/paymentAccount/paymentAccountPayload.d.ts +2 -0
- package/lib/entity/paymentAccount/paymentAccountPayload.js +2 -0
- package/lib/entity/paymentAccount/paymentAccountState.d.ts +2 -0
- package/lib/entity/snackbar/snackbarTypes.d.ts +1 -1
- package/lib/entity/snackbar/snackbarTypes.js +1 -0
- package/lib/entity/tenant/epic/fetchAllTenantsEpic.d.ts +3 -3
- package/lib/entity/tenant/epic/fetchAllTenantsEpic.js +16 -3
- package/lib/entity/toastNotification/epic/pushToastNotificationEpic.d.ts +1 -1
- package/lib/index.d.ts +11 -11
- package/lib/index.js +22 -18
- package/lib/view/bankAccountView/epic/createBankAccountEpic.js +5 -3
- package/lib/view/cardPayment/epic/addCardPaymentSourceEpic.d.ts +1 -1
- package/lib/view/cardPayment/epic/confirmCardSetupIntentEpic.d.ts +1 -1
- package/lib/view/cardPayment/epic/createCardSetupIntentEpic.d.ts +1 -1
- package/lib/view/cardPayment/epic/fetchPaymentSourcesEpic.d.ts +1 -1
- package/lib/view/companyView/types/cockpitTypes.d.ts +2 -2
- package/lib/view/onboardingView/customerView/epic/plaidConnection/establishOnboardingPlaidConnectionEpic.js +2 -0
- package/lib/view/people/changeZeniPersonRolesEpic.d.ts +1 -1
- package/lib/view/people/deletePersonEpic.d.ts +1 -1
- package/lib/view/people/invitePeopleEpic.d.ts +1 -1
- package/lib/view/people/inviteZeniPeopleEpic.d.ts +1 -1
- package/lib/view/people/resendInviteEpic.d.ts +1 -1
- package/lib/view/referralView/referralState.d.ts +1 -1
- package/lib/view/reviewCompanyView/reviewCompanyViewSelector.js +45 -41
- package/lib/view/scheduleView/scheduleListView/scheduleListTypes.d.ts +1 -1
- package/lib/view/settingsView/epic/fetchBankConnectionsViewEpic.d.ts +6 -4
- package/lib/view/settingsView/epic/fetchBankConnectionsViewEpic.js +29 -6
- package/lib/view/settingsView/epic/saveNotificationSettingsEpic.d.ts +1 -1
- package/lib/view/settingsView/settingsViewReducer.d.ts +3 -1
- package/lib/view/settingsView/settingsViewReducer.js +11 -2
- package/lib/view/settingsView/settingsViewSelector.d.ts +1 -1
- package/lib/view/settingsView/settingsViewSelector.js +59 -7
- package/lib/view/settingsView/types/settingsViewSelectorTypes.d.ts +10 -2
- package/lib/view/spendManagement/billPay/billPayReview/billPayReviewSelector.js +2 -3
- package/lib/view/spendManagement/billPay/billPaySetupView/billPaySetupViewSelector.js +1 -1
- package/lib/view/spendManagement/billPay/billPaySetupView/epic/billPaySetup/fetchBillPaySetupViewEpic.d.ts +4 -1
- package/lib/view/spendManagement/billPay/billPaySetupView/epic/billPaySetup/fetchBillPaySetupViewEpic.js +16 -4
- package/lib/view/spendManagement/billPay/billsBulkActionView/billsBulkActionViewReducer.js +1 -1
- package/lib/view/spendManagement/billPay/billsBulkActionView/billsBulkActionViewSelector.d.ts +3 -1
- package/lib/view/spendManagement/billPay/billsBulkActionView/billsBulkActionViewSelector.js +20 -3
- package/lib/view/spendManagement/billPay/billsBulkActionView/billsBulkActionViewState.d.ts +4 -1
- package/lib/view/spendManagement/billPay/billsBulkActionView/billsBulkActionViewState.js +18 -1
- package/lib/view/spendManagement/billPay/billsBulkActionView/epics/submitDraftBillsBulkActionEpic.js +25 -6
- package/lib/view/spendManagement/billPay/editBillView/editBillViewSelector.js +15 -12
- package/lib/view/spendManagement/billPay/editBillView/epics/fetchEditBillDetailPageEpic.d.ts +2 -2
- package/lib/view/spendManagement/billPay/editBillView/epics/fetchEditBillDetailPageEpic.js +6 -6
- package/lib/view/spendManagement/billPay/editBillView/epics/initializeBillToLocalStoreEpic.d.ts +1 -2
- package/lib/view/spendManagement/chargeCards/chargeCardSetUp/chargeCardSetUpViewSelector.js +1 -1
- package/lib/view/spendManagement/chargeCards/chargeCardSetUp/epic/fetchChargeCardSetupViewEpic.d.ts +4 -1
- package/lib/view/spendManagement/chargeCards/chargeCardSetUp/epic/fetchChargeCardSetupViewEpic.js +16 -4
- package/lib/view/spendManagement/commonSetup/setupViewSelector.d.ts +4 -0
- package/lib/view/spendManagement/commonSetup/setupViewSelector.js +47 -31
- package/lib/view/spendManagement/plaidAccount/epic/paymentAccounts/updateMappedCashAccountEpic.js +4 -5
- package/lib/view/spendManagement/plaidAccount/epic/paymentAccounts/updatePaymentAccountEpic.js +1 -2
- package/lib/view/spendManagement/plaidAccount/epic/paymentAccounts/updatePaymentAccountStatusEpic.js +1 -2
- package/lib/view/spendManagement/plaidAccount/epic/paymentAccounts/updatePrimaryFundingAccountEpic.d.ts +2 -1
- package/lib/view/spendManagement/plaidAccount/epic/paymentAccounts/updatePrimaryFundingAccountEpic.js +59 -12
- package/lib/view/spendManagement/plaidAccount/epic/plaidConnection/establishPlaidConnectionEpic.d.ts +2 -1
- package/lib/view/spendManagement/plaidAccount/epic/plaidConnection/establishPlaidConnectionEpic.js +52 -16
- package/lib/view/spendManagement/plaidAccount/epic/plaidConnection/getPlaidLinkTokenEpic.js +1 -1
- package/lib/view/spendManagement/plaidAccount/plaidAccountViewReducer.d.ts +21 -27
- package/lib/view/spendManagement/plaidAccount/plaidAccountViewReducer.js +47 -74
- package/lib/view/spendManagement/plaidAccount/plaidAccountViewState.d.ts +3 -8
- package/lib/view/spendManagement/plaidAccount/plaidAccountViewState.js +6 -3
- package/lib/view/spendManagement/reimbursement/remiSetupView/epic/remiSetup/fetchRemiSetupViewEpic.js +6 -19
- package/lib/view/spendManagement/zeniAccounts/zeniAccountList/zeniAccountListSelector.js +2 -2
- package/lib/view/spendManagement/zeniAccounts/zeniAccountSetUp/epic/fetchZeniAccountSetupViewEpic.d.ts +4 -1
- package/lib/view/spendManagement/zeniAccounts/zeniAccountSetUp/epic/fetchZeniAccountSetupViewEpic.js +20 -9
- package/lib/view/spendManagement/zeniAccounts/zeniAccountSetUp/zeniAccountSetupViewSelector.js +1 -1
- package/lib/view/tagView/epics/createTagEpic.d.ts +6 -6
- package/lib/view/tagView/epics/deleteTagEpic.d.ts +6 -6
- package/package.json +2 -2
|
@@ -69,47 +69,51 @@ exports.getReviewCompanySelectorView = (0, toolkit_1.createSelector)((state) =>
|
|
|
69
69
|
}
|
|
70
70
|
});
|
|
71
71
|
const sortOrderValue = (0, sortOrderPayload_1.getSortOrder)(sortOrder);
|
|
72
|
-
const sortedCompaniesWithSortKeyValue = (0, orderBy_1.default)(companiesWithSortKeyValues,
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
72
|
+
const sortedCompaniesWithSortKeyValue = (0, orderBy_1.default)(companiesWithSortKeyValues, sortKey === 'auditScore'
|
|
73
|
+
? ['auditSummary.auditScorePercentage', 'auditSummary.fixesRequired']
|
|
74
|
+
: (company) => {
|
|
75
|
+
var _a;
|
|
76
|
+
const warningCount = (0, exports.getAuditWarningsCount)(company);
|
|
77
|
+
let primarySortValue;
|
|
78
|
+
let secondarySortValue;
|
|
79
|
+
let isSecondarySortApplicable;
|
|
80
|
+
switch (sortKey) {
|
|
81
|
+
case 'notes':
|
|
82
|
+
primarySortValue = (_a = company.note) === null || _a === void 0 ? void 0 : _a.toLowerCase();
|
|
83
|
+
break;
|
|
84
|
+
case 'uncategorized':
|
|
85
|
+
isSecondarySortApplicable = true;
|
|
86
|
+
primarySortValue = company.uncategorizedTransactions.income
|
|
87
|
+
? 1
|
|
88
|
+
: 0;
|
|
89
|
+
secondarySortValue = company.uncategorizedTransactions.expense
|
|
90
|
+
? 1
|
|
91
|
+
: 0;
|
|
92
|
+
break;
|
|
93
|
+
case 'miscategorized':
|
|
94
|
+
isSecondarySortApplicable = true;
|
|
95
|
+
primarySortValue = company.miscategorizedTransactions.income
|
|
96
|
+
? 1
|
|
97
|
+
: 0;
|
|
98
|
+
secondarySortValue = company.miscategorizedTransactions.expense
|
|
99
|
+
? 1
|
|
100
|
+
: 0;
|
|
101
|
+
break;
|
|
102
|
+
case 'warnings':
|
|
103
|
+
primarySortValue = warningCount;
|
|
104
|
+
break;
|
|
105
|
+
case 'reviewVendor':
|
|
106
|
+
primarySortValue = company.isVendorReviewReqiured;
|
|
107
|
+
break;
|
|
108
|
+
case 'companyName':
|
|
109
|
+
default:
|
|
110
|
+
primarySortValue = company.name.toLowerCase();
|
|
111
|
+
break;
|
|
112
|
+
}
|
|
113
|
+
return isSecondarySortApplicable === true
|
|
114
|
+
? [primarySortValue, secondarySortValue]
|
|
115
|
+
: primarySortValue;
|
|
116
|
+
}, [sortOrderValue, sortOrderValue]);
|
|
113
117
|
return {
|
|
114
118
|
companies: [
|
|
115
119
|
...sortedCompaniesWithSortKeyValue,
|
|
@@ -10,7 +10,7 @@ export declare const ALL_SCHEDULES_SUB_TABS: readonly ["all", "new", "ongoing",
|
|
|
10
10
|
export declare const toScheduleSubTabType: (v: string) => "all" | "new" | "completed" | "ongoing";
|
|
11
11
|
export declare type ScheduleSubTabType = ReturnType<typeof toScheduleSubTabType>;
|
|
12
12
|
export declare const ALL_SCHEDULES_PAY_SORT_KEYS: readonly ["transactionDate", "vendor", "scheduleCategory", "expenseCategory", "accumulatedDepreciationCategory", "class", "amount", "balanceAsOfToday", "memo", "startMonth", "endMonth", "months", "transactionType", "status", "assetId", "user"];
|
|
13
|
-
export declare const toScheduleSortKeyType: (v: string) => "status" | "user" | "months" | "amount" | "vendor" | "class" | "memo" | "transactionDate" | "
|
|
13
|
+
export declare const toScheduleSortKeyType: (v: string) => "status" | "user" | "months" | "amount" | "vendor" | "class" | "memo" | "transactionDate" | "transactionType" | "balanceAsOfToday" | "scheduleCategory" | "expenseCategory" | "accumulatedDepreciationCategory" | "startMonth" | "endMonth" | "assetId";
|
|
14
14
|
export declare type ScheduleListSortKey = ReturnType<typeof toScheduleSortKeyType>;
|
|
15
15
|
export interface DownloadJEScheduleTabOptions {
|
|
16
16
|
timezone: string;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import { ActionsObservable } from 'redux-observable';
|
|
1
|
+
import { ActionsObservable, StateObservable } from 'redux-observable';
|
|
2
2
|
import { Observable } from 'rxjs';
|
|
3
|
+
import { RootState } from '../../../reducer';
|
|
3
4
|
import { fetchBankConnectionsView, fetchBankAccountsList } from '../settingsViewReducer';
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
export declare
|
|
5
|
+
import { fetchPaymentAccountList } from '../../spendManagement/zeniAccounts/paymentAccountList/paymentAccountListReducer';
|
|
6
|
+
import { fetchDepositAccountList } from '../../spendManagement/zeniAccounts/depositAccountList/depositAccountListReducer';
|
|
7
|
+
export declare type ActionType = ReturnType<typeof fetchBankConnectionsView> | ReturnType<typeof fetchBankAccountsList> | ReturnType<typeof fetchPaymentAccountList> | ReturnType<typeof fetchDepositAccountList>;
|
|
8
|
+
export declare const fetchBankConnectionsViewEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>) => Observable<ActionType>;
|
|
@@ -4,11 +4,34 @@ exports.fetchBankConnectionsViewEpic = void 0;
|
|
|
4
4
|
const rxjs_1 = require("rxjs");
|
|
5
5
|
const operators_1 = require("rxjs/operators");
|
|
6
6
|
const settingsViewReducer_1 = require("../settingsViewReducer");
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
7
|
+
const paymentAccountListReducer_1 = require("../../spendManagement/zeniAccounts/paymentAccountList/paymentAccountListReducer");
|
|
8
|
+
const depositAccountListReducer_1 = require("../../spendManagement/zeniAccounts/depositAccountList/depositAccountListReducer");
|
|
9
|
+
const fetchBankConnectionsViewEpic = (actions$, state$) => actions$.pipe((0, operators_1.filter)(settingsViewReducer_1.fetchBankConnectionsView.match), (0, operators_1.mergeMap)((action) => {
|
|
10
|
+
const { cacheOverride } = action.payload;
|
|
11
|
+
const bankConnectionActions = [];
|
|
12
|
+
const state = state$.value;
|
|
13
|
+
if (cacheOverride === true) {
|
|
14
|
+
bankConnectionActions.push((0, settingsViewReducer_1.fetchBankAccountsList)());
|
|
15
|
+
bankConnectionActions.push((0, paymentAccountListReducer_1.fetchPaymentAccountList)());
|
|
16
|
+
bankConnectionActions.push((0, depositAccountListReducer_1.fetchDepositAccountList)());
|
|
17
|
+
}
|
|
18
|
+
else {
|
|
19
|
+
const bankAccountsList = state.settingsViewState.bankConnection;
|
|
20
|
+
if (bankAccountsList.fetchState !== 'Completed' &&
|
|
21
|
+
bankAccountsList.fetchState !== 'In-Progress') {
|
|
22
|
+
bankConnectionActions.push((0, settingsViewReducer_1.fetchBankAccountsList)());
|
|
23
|
+
}
|
|
24
|
+
const paymentAccountList = state.paymentAccountListState;
|
|
25
|
+
if (paymentAccountList.hasValidState() === false &&
|
|
26
|
+
paymentAccountList.fetchState !== 'In-Progress') {
|
|
27
|
+
bankConnectionActions.push((0, paymentAccountListReducer_1.fetchPaymentAccountList)());
|
|
28
|
+
}
|
|
29
|
+
const depositAccountList = state.depositAccountListState;
|
|
30
|
+
if (depositAccountList.hasValidState() === false &&
|
|
31
|
+
depositAccountList.fetchState !== 'In-Progress') {
|
|
32
|
+
bankConnectionActions.push((0, depositAccountListReducer_1.fetchDepositAccountList)());
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
return (0, rxjs_1.concat)((0, rxjs_1.from)(bankConnectionActions));
|
|
13
36
|
}));
|
|
14
37
|
exports.fetchBankConnectionsViewEpic = fetchBankConnectionsViewEpic;
|
|
@@ -18,7 +18,7 @@ export declare const saveNotificationSettingsEpic: (actions$: ActionsObservable<
|
|
|
18
18
|
type: string;
|
|
19
19
|
} | {
|
|
20
20
|
payload: {
|
|
21
|
-
messageSection: "reimbursement_setup" | "common" | "transactionDetails_updatingPastTransactions" | "transactionDetails_transactionUpdated" | "cockpit_month_end_email_sent" | "cockpit_month_end_email_save" | "cockpit_month_end_email_attachment_upload" | "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_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" | "
|
|
21
|
+
messageSection: "bill_pay_setup" | "reimbursement_setup" | "charge_card_setup" | "common" | "transactionDetails_updatingPastTransactions" | "transactionDetails_transactionUpdated" | "cockpit_month_end_email_sent" | "cockpit_month_end_email_save" | "cockpit_month_end_email_attachment_upload" | "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_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" | "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" | "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_accept_term" | "create_schedule" | "save_schedule" | "delete_schedule" | "save_task_detail" | "fetch_task_detail" | "delete_task" | "archive_task" | "create_tag" | "delete_tag" | "update_charge_card" | "issue_charge_card" | "notification_settings_saved" | "referral_invite_sent" | "notification_mark_as_read" | "mark_as_complete_schedule" | "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";
|
|
22
22
|
messageText: "failed" | "success" | "notification";
|
|
23
23
|
type: import("../../..").SnackbarMessageType;
|
|
24
24
|
showStatusIcon?: boolean | undefined;
|
|
@@ -11,7 +11,9 @@ export declare const fetchMyProfileView: import("@reduxjs/toolkit").ActionCreato
|
|
|
11
11
|
companyId: string;
|
|
12
12
|
}, string, never, never>, updateMyProfileOnSuccess: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[userId: string], {
|
|
13
13
|
userId: string;
|
|
14
|
-
}, string, never, never>, updateMyProfileOnFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<ZeniAPIStatus<Record<string, unknown>>, string>, fetchBankConnectionsView: import("@reduxjs/toolkit").
|
|
14
|
+
}, string, never, never>, updateMyProfileOnFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<ZeniAPIStatus<Record<string, unknown>>, string>, fetchBankConnectionsView: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[cacheOverride: any], {
|
|
15
|
+
cacheOverride: any;
|
|
16
|
+
}, string, never, never>, fetchBillingAccountsView: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, updateBankConnectionOnSuccess: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
15
17
|
bankAccountIds: ID[];
|
|
16
18
|
}, string>, updateBankConnectionOnFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<ZeniAPIStatus<Record<string, unknown>>, string>, fetchBankAccountsList: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, fetchNotificationSettings: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, updateNotificationSettingsOnSuccess: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[data: NotificationSettingsPayload, loggedInUserEmail: string], {
|
|
17
19
|
data: NotificationSettingsPayload;
|
|
@@ -94,8 +94,17 @@ const settings = (0, toolkit_1.createSlice)({
|
|
|
94
94
|
draft.profile.fetchState = 'Error';
|
|
95
95
|
draft.profile.error = action.payload;
|
|
96
96
|
},
|
|
97
|
-
fetchBankConnectionsView
|
|
98
|
-
|
|
97
|
+
fetchBankConnectionsView: {
|
|
98
|
+
reducer() {
|
|
99
|
+
// do nothing
|
|
100
|
+
},
|
|
101
|
+
prepare(cacheOverride) {
|
|
102
|
+
return {
|
|
103
|
+
payload: {
|
|
104
|
+
cacheOverride,
|
|
105
|
+
},
|
|
106
|
+
};
|
|
107
|
+
},
|
|
99
108
|
},
|
|
100
109
|
fetchBillingAccountsView() {
|
|
101
110
|
// Do nothing.
|
|
@@ -3,7 +3,7 @@ import { FetchStateAndError, ID } from '../../commonStateTypes/common';
|
|
|
3
3
|
import { MyBankConnectionsView, BankConnectionsSetupView, MyProfileSelectorView, NotificationSettingsSelectorView, IntegrationsView, BillingView } from './types/settingsViewSelectorTypes';
|
|
4
4
|
import { NotificationSettings } from './settingsViewState';
|
|
5
5
|
export declare function getApprovalRuleViewDetails(state: RootState): FetchStateAndError;
|
|
6
|
-
export declare function getBankConnectionsSetupViewDetails(state: RootState, companyId: ID): BankConnectionsSetupView;
|
|
6
|
+
export declare function getBankConnectionsSetupViewDetails(state: RootState, companyId: ID, isBillPayEnabled: boolean, isRemiEnabled: boolean, isAccountEnabled: boolean, isCardEnabled: boolean): BankConnectionsSetupView;
|
|
7
7
|
export declare function getBillingAccountsViewDetails(state: RootState, companyId: ID): BillingView;
|
|
8
8
|
export declare function getMyBankConnectionsDetails(state: RootState, userId: ID): MyBankConnectionsView;
|
|
9
9
|
export declare function getIntegrationsView(state: RootState, companyId: ID): IntegrationsView;
|
|
@@ -19,6 +19,8 @@ const reduceFetchState_1 = require("../../commonStateTypes/reduceFetchState");
|
|
|
19
19
|
const companyPassportViewSelector_1 = require("../companyView/selector/companyPassportViewSelector");
|
|
20
20
|
const userFinancialAccountSelector_1 = require("../userFinancialAccount/userFinancialAccountSelector");
|
|
21
21
|
const setupViewSelector_1 = require("../../view/spendManagement/commonSetup/setupViewSelector");
|
|
22
|
+
const depositAccountSelector_1 = require("../../entity/depositAccount/depositAccountSelector");
|
|
23
|
+
const getCompanyView_1 = require("../companyView/selectorHelpers/getCompanyView");
|
|
22
24
|
const cardPaymentViewSelector_1 = require("../cardPayment/cardPaymentViewSelector");
|
|
23
25
|
function getApprovalRuleViewDetails(state) {
|
|
24
26
|
const { billPaySetupApproverViewState, remiSetupApproverViewState } = state;
|
|
@@ -31,18 +33,68 @@ function getApprovalRuleViewDetails(state) {
|
|
|
31
33
|
};
|
|
32
34
|
}
|
|
33
35
|
exports.getApprovalRuleViewDetails = getApprovalRuleViewDetails;
|
|
34
|
-
function getBankConnectionsSetupViewDetails(state, companyId) {
|
|
35
|
-
|
|
36
|
+
function getBankConnectionsSetupViewDetails(state, companyId, isBillPayEnabled, isRemiEnabled, isAccountEnabled, isCardEnabled) {
|
|
37
|
+
var _a, _b, _c, _d, _e, _f;
|
|
38
|
+
const { accountState, settingsViewState, paymentAccountState, depositAccountState, depositAccountListState, paymentAccountListState, } = state;
|
|
36
39
|
const { bankConnection } = settingsViewState;
|
|
37
|
-
const
|
|
38
|
-
|
|
39
|
-
|
|
40
|
+
const { paymentAccountIds } = paymentAccountListState;
|
|
41
|
+
const { accountIds: depositAccountIds } = depositAccountListState;
|
|
42
|
+
const allBankAccounts = bankConnection.fetchState === 'Completed'
|
|
43
|
+
? bankConnection.bankAccountIds
|
|
44
|
+
.map((accountId) => (0, accountSelector_1.getAccountBase)(accountState, accountId, 'bill_pay'))
|
|
45
|
+
.filter((account) => account != null)
|
|
46
|
+
: [];
|
|
47
|
+
const paymentAccounts = paymentAccountListState.hasValidState()
|
|
48
|
+
? (_a = (0, paymentAccountSelector_1.getPaymentAccountsByPaymentAccountIds)(paymentAccountState, paymentAccountIds).filter((account) => account != null)) !== null && _a !== void 0 ? _a : []
|
|
49
|
+
: [];
|
|
50
|
+
const depositAccounts = depositAccountListState.hasValidState()
|
|
51
|
+
? (_b = (0, depositAccountSelector_1.getDepositAccountsByDepositAccountIds)(depositAccountState, depositAccountIds).filter((account) => account != null)) !== null && _b !== void 0 ? _b : []
|
|
52
|
+
: [];
|
|
40
53
|
const fetchState = (0, reduceFetchState_1.reduceAnyFetchState)([
|
|
41
54
|
settingsViewState.bankConnection,
|
|
42
|
-
|
|
55
|
+
paymentAccountListState,
|
|
56
|
+
depositAccountListState,
|
|
43
57
|
]);
|
|
58
|
+
const allFundingAccounts = fetchState.fetchState === 'Completed'
|
|
59
|
+
? (0, setupViewSelector_1.getAllFundingAccounts)(depositAccounts, paymentAccounts, false)
|
|
60
|
+
: [];
|
|
61
|
+
const primaryAccountsProductWise = [];
|
|
62
|
+
if (isBillPayEnabled) {
|
|
63
|
+
primaryAccountsProductWise.push(Object.assign({ productType: 'bill_pay' }, (0, setupViewSelector_1.getCommonSetupViewDetails)(state, companyId, 'bill_pay', 'bill_pay_setup')));
|
|
64
|
+
}
|
|
65
|
+
if (isRemiEnabled) {
|
|
66
|
+
primaryAccountsProductWise.push(Object.assign({ productType: 'reimbursement' }, (0, setupViewSelector_1.getCommonSetupViewDetails)(state, companyId, 'reimbursement', 'reimbursement_setup')));
|
|
67
|
+
}
|
|
68
|
+
if (isAccountEnabled) {
|
|
69
|
+
primaryAccountsProductWise.push(Object.assign({ productType: 'zeni_accounts' }, (0, setupViewSelector_1.getCommonSetupViewDetails)(state, companyId, 'zeni_accounts', 'account_setup')));
|
|
70
|
+
}
|
|
71
|
+
if (isCardEnabled) {
|
|
72
|
+
primaryAccountsProductWise.push(Object.assign({ productType: 'charge_cards' }, (0, setupViewSelector_1.getCommonSetupViewDetails)(state, companyId, 'charge_cards', 'charge_card_setup')));
|
|
73
|
+
}
|
|
74
|
+
const companyView = (0, getCompanyView_1.getCompanyView)(state, companyId, []);
|
|
75
|
+
const billPayPrimaryAccount = (_c = companyView === null || companyView === void 0 ? void 0 : companyView.company.company.companyBillPayInfo.primaryFundingAccount) === null || _c === void 0 ? void 0 : _c.accountId; //companyBillPayInfo
|
|
76
|
+
const remiPrimaryAccount = (_d = companyView === null || companyView === void 0 ? void 0 : companyView.company.company.companyReimbursementInfo.primaryFundingAccount) === null || _d === void 0 ? void 0 : _d.accountId;
|
|
77
|
+
const accountsPrimaryAccount = (_e = companyView === null || companyView === void 0 ? void 0 : companyView.company.company.companyZeniAccountInfo.primaryFundingAccount) === null || _e === void 0 ? void 0 : _e.accountId; //companyZeniAccountInfo
|
|
78
|
+
const chargeCardsPrimaryAccount = (_f = companyView === null || companyView === void 0 ? void 0 : companyView.company.company.companyChargeCardInfo.primaryFundingAccount) === null || _f === void 0 ? void 0 : _f.accountId; //companyChargeCardInfo
|
|
79
|
+
const primaryAccounts = [];
|
|
80
|
+
if (billPayPrimaryAccount != null) {
|
|
81
|
+
primaryAccounts.push(billPayPrimaryAccount);
|
|
82
|
+
}
|
|
83
|
+
if (remiPrimaryAccount != null) {
|
|
84
|
+
primaryAccounts.push(remiPrimaryAccount);
|
|
85
|
+
}
|
|
86
|
+
if (accountsPrimaryAccount != null) {
|
|
87
|
+
primaryAccounts.push(accountsPrimaryAccount);
|
|
88
|
+
}
|
|
89
|
+
if (chargeCardsPrimaryAccount != null) {
|
|
90
|
+
primaryAccounts.push(chargeCardsPrimaryAccount);
|
|
91
|
+
}
|
|
92
|
+
const nonPrimaryPaymentAccounts = paymentAccounts.filter((paymentAcc) => !primaryAccounts.includes(paymentAcc.paymentAccountId));
|
|
44
93
|
return {
|
|
45
|
-
|
|
94
|
+
primaryConnection: primaryAccountsProductWise,
|
|
95
|
+
otherPaymentAccounts: nonPrimaryPaymentAccounts,
|
|
96
|
+
allFundingAccounts,
|
|
97
|
+
allBankAccounts,
|
|
46
98
|
fetchState: fetchState.fetchState,
|
|
47
99
|
};
|
|
48
100
|
}
|
|
@@ -5,11 +5,13 @@ import { PaymentAccount } from '../../../entity/paymentAccount/paymentAccountSta
|
|
|
5
5
|
import { User } from '../../../entity/user/userState';
|
|
6
6
|
import { UserRole } from '../../../entity/userRole/userRoleState';
|
|
7
7
|
import { Person } from '../../people/peopleSelectorTypes';
|
|
8
|
-
import { SetupView } from '../../spendManagement/commonSetup/setupViewSelector';
|
|
8
|
+
import { FundingAccount, SetupView } from '../../spendManagement/commonSetup/setupViewSelector';
|
|
9
9
|
import { UserFinancialAccountSelectorView } from '../../userFinancialAccount/userFinancialAccountSelector';
|
|
10
10
|
import { IntegrationsSettings, NotificationSettings, SettingsViewUIState } from '../settingsViewState';
|
|
11
11
|
import { TenantExternalConnections } from '../../../entity/tenant/tenantState';
|
|
12
12
|
import { Company } from '../../../entity/company/companyStateTypes';
|
|
13
|
+
import { EntityType as SpendManagementEntityType } from '../../../entity/entityApprovalStatus/entityApprovalStatusState';
|
|
14
|
+
import { AccountBase } from '../../../entity/account/accountState';
|
|
13
15
|
import { CardPaymentSelectorView } from '../../cardPayment/cardPaymentViewSelector';
|
|
14
16
|
export interface MyProfileSelectorView extends SelectorView {
|
|
15
17
|
isZeniUser: boolean;
|
|
@@ -29,13 +31,19 @@ export interface MyBankConnectionsView extends UserFinancialAccountSelectorView
|
|
|
29
31
|
paymentAccounts: PaymentAccount[];
|
|
30
32
|
}
|
|
31
33
|
export interface BankConnectionsSetupView extends FetchStateAndError {
|
|
32
|
-
|
|
34
|
+
primaryConnection: ProductWisePrimaryAccount[];
|
|
35
|
+
otherPaymentAccounts: PaymentAccount[];
|
|
36
|
+
allFundingAccounts: FundingAccount[];
|
|
37
|
+
allBankAccounts: AccountBase[];
|
|
33
38
|
}
|
|
34
39
|
export interface BillingView extends FetchStateAndError {
|
|
35
40
|
setupView: SetupView;
|
|
36
41
|
cardPaymentView: CardPaymentSelectorView;
|
|
37
42
|
uiState: SettingsViewUIState;
|
|
38
43
|
}
|
|
44
|
+
export interface ProductWisePrimaryAccount extends SetupView {
|
|
45
|
+
productType: SpendManagementEntityType;
|
|
46
|
+
}
|
|
39
47
|
export interface NotificationSettingsSelectorView extends NotificationSettings {
|
|
40
48
|
allUsers: User[];
|
|
41
49
|
classList: Class[];
|
|
@@ -37,7 +37,7 @@ const getDuplicateBills = (state, billId) => {
|
|
|
37
37
|
exports.getDuplicateBills = getDuplicateBills;
|
|
38
38
|
const getReviewPageBillDetail = (state, billId) => {
|
|
39
39
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y;
|
|
40
|
-
const { accountListState, accountState,
|
|
40
|
+
const { accountListState, accountState, billTransactionState, classListState, editBillDetailViewState, paymentAccountState, vendorState, contactState, billPayConfigState, recurringBillState, depositAccountState, depositAccountListState, paymentAccountListState, } = state;
|
|
41
41
|
const key = (0, billDetailViewState_1.getBillTransactionDetailKey)(billId !== null && billId !== void 0 ? billId : '');
|
|
42
42
|
const sourceBillDetail = billId != null
|
|
43
43
|
? (_a = editBillDetailViewState.editBillStateById) === null || _a === void 0 ? void 0 : _a[key]
|
|
@@ -47,8 +47,7 @@ const getReviewPageBillDetail = (state, billId) => {
|
|
|
47
47
|
let paymentDetailsSection;
|
|
48
48
|
let file;
|
|
49
49
|
let contactDetails = [];
|
|
50
|
-
const primaryPaymentAccount = (0, paymentAccountSelector_1.getPaymentAccountsByPaymentAccountIds)(paymentAccountState,
|
|
51
|
-
.paymentAccountIds);
|
|
50
|
+
const primaryPaymentAccount = (0, paymentAccountSelector_1.getPaymentAccountsByPaymentAccountIds)(paymentAccountState, paymentAccountListState.paymentAccountIds);
|
|
52
51
|
const allDepositAccounts = (0, depositAccountListSelector_1.getAllDepostAccounts)(depositAccountState, depositAccountListState).depositAccounts;
|
|
53
52
|
const withdrawFromList = (0, setupViewSelector_1.getAllFundingAccounts)(allDepositAccounts, primaryPaymentAccount);
|
|
54
53
|
let fetchState = 'Not-Started';
|
|
@@ -4,7 +4,7 @@ exports.getBillPayBusinessVerificationDetails = exports.getBillPaySetupViewDetai
|
|
|
4
4
|
const setupViewSelector_1 = require("../../commonSetup/setupViewSelector");
|
|
5
5
|
const helpers_1 = require("../../helpers");
|
|
6
6
|
function getBillPaySetupViewDetails(state, companyId) {
|
|
7
|
-
const billPaySetupViewDetails = (0, setupViewSelector_1.getCommonSetupViewDetails)(state, companyId, 'bill_pay', '
|
|
7
|
+
const billPaySetupViewDetails = (0, setupViewSelector_1.getCommonSetupViewDetails)(state, companyId, 'bill_pay', 'bill_pay_setup');
|
|
8
8
|
const businessVerificationDetails = getBillPayBusinessVerificationDetails(state, companyId);
|
|
9
9
|
const selectedCompanyOfficer = (0, helpers_1.getSelectedCompanyOfficer)(businessVerificationDetails);
|
|
10
10
|
const { billPaySetupViewState, setupViewState } = state;
|
|
@@ -13,5 +13,8 @@ import { openSnackbar } from '../../../../../../entity/snackbar/snackbarReducer'
|
|
|
13
13
|
import { updateSetupViewLocalStoreData } from '../../../../commonSetup/setupViewReducer';
|
|
14
14
|
import { fetchBillPaySetupView, fetchBillPaySetupViewSuccess, fetchBillPaySetupViewFailure } from '../../billPaySetupViewReducer';
|
|
15
15
|
import { updatePlaidAccountViewAccountDetails } from '../../../../plaidAccount/plaidAccountViewReducer';
|
|
16
|
-
|
|
16
|
+
import { updatePaymentAccountList } from '../../../../zeniAccounts/paymentAccountList/paymentAccountListReducer';
|
|
17
|
+
import { updateDepositAccounts } from '../../../../../../entity/depositAccount/depositAccountReducer';
|
|
18
|
+
import { updateDepositAccountList } from '../../../../zeniAccounts/depositAccountList/depositAccountListReducer';
|
|
19
|
+
export declare type ActionType = ReturnType<typeof fetchBillPaySetupView> | ReturnType<typeof updateAllUsers> | ReturnType<typeof updateUserRoles> | ReturnType<typeof updateCompanies> | ReturnType<typeof updateFiles> | ReturnType<typeof updateAccounts> | ReturnType<typeof updateAddresses> | ReturnType<typeof updatePaymentAccounts> | ReturnType<typeof updatePaymentAccountList> | ReturnType<typeof updateDepositAccounts> | ReturnType<typeof updateDepositAccountList> | ReturnType<typeof updatePlaidAccountViewAccountDetails> | ReturnType<typeof updateSetupViewLocalStoreData> | ReturnType<typeof openSnackbar> | ReturnType<typeof fetchBillPaySetupViewSuccess> | ReturnType<typeof fetchBillPaySetupViewFailure>;
|
|
17
20
|
export declare const fetchBillPaySetupViewEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
|
|
@@ -16,6 +16,9 @@ const snackbarReducer_1 = require("../../../../../../entity/snackbar/snackbarRed
|
|
|
16
16
|
const setupViewReducer_1 = require("../../../../commonSetup/setupViewReducer");
|
|
17
17
|
const billPaySetupViewReducer_1 = require("../../billPaySetupViewReducer");
|
|
18
18
|
const plaidAccountViewReducer_1 = require("../../../../plaidAccount/plaidAccountViewReducer");
|
|
19
|
+
const paymentAccountListReducer_1 = require("../../../../zeniAccounts/paymentAccountList/paymentAccountListReducer");
|
|
20
|
+
const depositAccountReducer_1 = require("../../../../../../entity/depositAccount/depositAccountReducer");
|
|
21
|
+
const depositAccountListReducer_1 = require("../../../../zeniAccounts/depositAccountList/depositAccountListReducer");
|
|
19
22
|
const fetchBillPaySetupViewEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(billPaySetupViewReducer_1.fetchBillPaySetupView.match), (0, operators_1.switchMap)((action) => {
|
|
20
23
|
var _a;
|
|
21
24
|
const { companyId, cacheOverride, refreshViewInBackground } = action.payload;
|
|
@@ -29,9 +32,9 @@ const fetchBillPaySetupViewEpic = (actions$, state$, zeniAPI) => actions$.pipe((
|
|
|
29
32
|
return zeniAPI
|
|
30
33
|
.getJSON(`${zeniAPI.apiEndPoints.tenantMicroServiceBaseUrl}/1.0/companies/${companyId}?query={"view":"bill_pay_setup"}`)
|
|
31
34
|
.pipe((0, operators_1.mergeMap)((response) => {
|
|
35
|
+
var _a, _b, _c;
|
|
32
36
|
if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
|
|
33
37
|
const allBankAccountIds = response.data.accounts.map((account) => account.account_id);
|
|
34
|
-
const paymentAccountIds = response.data.payment_accounts.map((paymentAccount) => paymentAccount.payment_account_id);
|
|
35
38
|
const actions = [
|
|
36
39
|
(0, userReducer_1.updateAllUsers)({ users: response.data.users }),
|
|
37
40
|
(0, userRoleReducer_1.updateUserRoles)(response.data.user_roles),
|
|
@@ -43,10 +46,19 @@ const fetchBillPaySetupViewEpic = (actions$, state$, zeniAPI) => actions$.pipe((
|
|
|
43
46
|
(0, fileReducer_1.updateFiles)({ files: response.data.files }),
|
|
44
47
|
(0, accountReducer_1.updateAccounts)(response.data.accounts, 'bill_pay'),
|
|
45
48
|
(0, paymentAccountReducer_1.updatePaymentAccounts)(response.data.payment_accounts),
|
|
49
|
+
(0, paymentAccountListReducer_1.updatePaymentAccountList)({
|
|
50
|
+
data: response.data.payment_accounts,
|
|
51
|
+
updateType: 'replace',
|
|
52
|
+
}),
|
|
53
|
+
(0, depositAccountReducer_1.updateDepositAccounts)((_a = response.data.deposit_accounts) !== null && _a !== void 0 ? _a : []),
|
|
54
|
+
(0, depositAccountListReducer_1.updateDepositAccountList)({
|
|
55
|
+
data: (_c = (_b = response.data) === null || _b === void 0 ? void 0 : _b.deposit_accounts) !== null && _c !== void 0 ? _c : [],
|
|
56
|
+
updateType: 'replace',
|
|
57
|
+
}),
|
|
46
58
|
(0, setupViewReducer_1.updateSetupViewLocalStoreData)({
|
|
47
59
|
companyId: response.data.companies[0].company_id,
|
|
48
60
|
}),
|
|
49
|
-
(0, plaidAccountViewReducer_1.updatePlaidAccountViewAccountDetails)(allBankAccountIds,
|
|
61
|
+
(0, plaidAccountViewReducer_1.updatePlaidAccountViewAccountDetails)(allBankAccountIds, 'bill_pay_setup'),
|
|
50
62
|
(0, billPaySetupViewReducer_1.fetchBillPaySetupViewSuccess)(),
|
|
51
63
|
];
|
|
52
64
|
return (0, rxjs_1.from)(actions);
|
|
@@ -62,10 +74,10 @@ const fetchBillPaySetupViewEpic = (actions$, state$, zeniAPI) => actions$.pipe((
|
|
|
62
74
|
JSON.stringify(error))))));
|
|
63
75
|
}
|
|
64
76
|
else {
|
|
65
|
-
const { allBankAccountIds
|
|
77
|
+
const { allBankAccountIds } = plaidAccountViewState['spend_management_setup'].accountDetails;
|
|
66
78
|
return (0, rxjs_1.of)((0, setupViewReducer_1.updateSetupViewLocalStoreData)({
|
|
67
79
|
companyId,
|
|
68
|
-
}), (0, plaidAccountViewReducer_1.updatePlaidAccountViewAccountDetails)(allBankAccountIds,
|
|
80
|
+
}), (0, plaidAccountViewReducer_1.updatePlaidAccountViewAccountDetails)(allBankAccountIds, 'bill_pay_setup'), (0, billPaySetupViewReducer_1.fetchBillPaySetupViewSuccess)());
|
|
69
81
|
}
|
|
70
82
|
}));
|
|
71
83
|
exports.fetchBillPaySetupViewEpic = fetchBillPaySetupViewEpic;
|
|
@@ -77,7 +77,7 @@ const billsBulkActionView = (0, toolkit_1.createSlice)({
|
|
|
77
77
|
status,
|
|
78
78
|
error: status !== 'valid' && result.error != null
|
|
79
79
|
? {
|
|
80
|
-
code: result.error.error_code,
|
|
80
|
+
code: (0, billsBulkActionViewState_1.toBulkReviewErrorCode)(result.error.error_code),
|
|
81
81
|
message: result.error.error_message,
|
|
82
82
|
duplicateTransactionIds: (_a = result.error.duplicate_entity_ids) !== null && _a !== void 0 ? _a : [],
|
|
83
83
|
}
|
package/lib/view/spendManagement/billPay/billsBulkActionView/billsBulkActionViewSelector.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { RootState } from '../../../../reducer';
|
|
|
2
2
|
import { FetchState, ID } from '../../../../commonStateTypes/common';
|
|
3
3
|
import { SelectorView } from '../../../../commonStateTypes/viewAndReport/viewAndReport';
|
|
4
4
|
import { Amount } from '../../../../commonStateTypes/amount';
|
|
5
|
-
import { BulkOperationProgress, BulkOperationType, BulkReviewStatusCode } from './billsBulkActionViewState';
|
|
5
|
+
import { BulkOperationProgress, BulkOperationType, BulkReviewErrorCode, BulkReviewStatusCode } from './billsBulkActionViewState';
|
|
6
6
|
import { BillsSubTabType, BillTab } from '../billList/billListState';
|
|
7
7
|
export interface BillForReview {
|
|
8
8
|
transactionId: ID;
|
|
@@ -11,6 +11,7 @@ export interface BillForReview {
|
|
|
11
11
|
isRecurring: boolean;
|
|
12
12
|
amount?: Amount;
|
|
13
13
|
reviewStatus?: BulkReviewStatusCode;
|
|
14
|
+
reviewErrorCode?: BulkReviewErrorCode;
|
|
14
15
|
reviewInfoMessage?: string;
|
|
15
16
|
}
|
|
16
17
|
export interface BillsBulkReviewView extends SelectorView {
|
|
@@ -22,3 +23,4 @@ export interface BillsBulkReviewView extends SelectorView {
|
|
|
22
23
|
}
|
|
23
24
|
export declare const getBillsBulkReviewView: (state: RootState) => BillsBulkReviewView;
|
|
24
25
|
export declare const getBillsBulkOperationProgress: (state: RootState) => BulkOperationProgress;
|
|
26
|
+
export declare const isBillConditionallyValid: (errorCode?: "ERR_INSUFFICIENT_DATA" | "ERR_INVOICE_DATE_OUTSIDE_ACCOUNTING_PERIOD" | "ERR_FUTURE_PAYMENT_DATE_SUPPORTED" | "ERR_POSSIBLE_DUPLICATE_TRANSACTION" | "ERR_INVALID_DATA" | "ERR_PAYMENT_DATE_CURRENT_OR_FUTURE_DATE_SUPPORTED" | "ERR_PHYSICAL_ADDRESS_REQUIRED" | "ERR_START_DATE_GT_END_DATE" | "ERR_RECURRING_PAYMENT_START_DATE_IS_PAST_DATE" | "ERR_INCORRECT_RECURRING_PAYMENT_CYCLE" | "ERR_INCORRECT_FIELD" | "ERR_UPDATE_VENDOR_DETAILS" | "ERR_AMOUNT_ZERO" | undefined) => boolean;
|
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.getBillsBulkOperationProgress = exports.getBillsBulkReviewView = void 0;
|
|
6
|
+
exports.isBillConditionallyValid = exports.getBillsBulkOperationProgress = exports.getBillsBulkReviewView = void 0;
|
|
7
7
|
const get_1 = __importDefault(require("lodash/get"));
|
|
8
8
|
const getBillsBulkReviewView = (state) => {
|
|
9
9
|
const { billTransactionState, billsBulkActionViewState, billListState } = state;
|
|
@@ -26,9 +26,9 @@ const getBillsBulkReviewView = (state) => {
|
|
|
26
26
|
const bulkSubmissionFetchState = billsBulkActionViewState.bulkSubmissionFetchState.fetchState;
|
|
27
27
|
if (bulkReviewFetchState === 'Completed') {
|
|
28
28
|
selectedTransactions = selectedTransactions.map((transaction) => {
|
|
29
|
-
var _a;
|
|
29
|
+
var _a, _b;
|
|
30
30
|
const reviewStateOfBill = billsBulkActionViewState.bulkReviewStateById[transaction.transactionId];
|
|
31
|
-
return Object.assign(Object.assign({}, transaction), { reviewStatus: reviewStateOfBill === null || reviewStateOfBill === void 0 ? void 0 : reviewStateOfBill.
|
|
31
|
+
return Object.assign(Object.assign({}, transaction), { reviewStatus: getBillReviewStatus(reviewStateOfBill), reviewInfoMessage: (_a = reviewStateOfBill === null || reviewStateOfBill === void 0 ? void 0 : reviewStateOfBill.error) === null || _a === void 0 ? void 0 : _a.message, reviewErrorCode: (_b = reviewStateOfBill === null || reviewStateOfBill === void 0 ? void 0 : reviewStateOfBill.error) === null || _b === void 0 ? void 0 : _b.code });
|
|
32
32
|
});
|
|
33
33
|
}
|
|
34
34
|
return {
|
|
@@ -46,3 +46,20 @@ const getBillsBulkOperationProgress = (state) => {
|
|
|
46
46
|
return billsBulkActionViewState.bulkOperationProgress;
|
|
47
47
|
};
|
|
48
48
|
exports.getBillsBulkOperationProgress = getBillsBulkOperationProgress;
|
|
49
|
+
const getBillReviewStatus = (reviewedBill) => {
|
|
50
|
+
var _a;
|
|
51
|
+
if (reviewedBill != null) {
|
|
52
|
+
const errorCode = (_a = reviewedBill.error) === null || _a === void 0 ? void 0 : _a.code;
|
|
53
|
+
return (0, exports.isBillConditionallyValid)(errorCode) ? 'valid' : reviewedBill.status;
|
|
54
|
+
}
|
|
55
|
+
return undefined;
|
|
56
|
+
};
|
|
57
|
+
const isBillConditionallyValid = (errorCode) => {
|
|
58
|
+
const conditionallyValidErrorCodes = [
|
|
59
|
+
'ERR_INVOICE_DATE_OUTSIDE_ACCOUNTING_PERIOD',
|
|
60
|
+
];
|
|
61
|
+
return errorCode != null
|
|
62
|
+
? conditionallyValidErrorCodes.includes(errorCode)
|
|
63
|
+
: false;
|
|
64
|
+
};
|
|
65
|
+
exports.isBillConditionallyValid = isBillConditionallyValid;
|
|
@@ -16,7 +16,7 @@ export interface BulkReviewState {
|
|
|
16
16
|
transactionId: ID;
|
|
17
17
|
status: BulkReviewStatusCode;
|
|
18
18
|
error?: {
|
|
19
|
-
code:
|
|
19
|
+
code: BulkReviewErrorCode;
|
|
20
20
|
message: string;
|
|
21
21
|
duplicateTransactionIds: ID[];
|
|
22
22
|
};
|
|
@@ -26,3 +26,6 @@ export declare type BulkSelectExceptionInfoType = 'bookCloseDateDelete' | 'bookC
|
|
|
26
26
|
export declare const BULK_REVIEW_STATUS_CODES: readonly ["valid", "error", "warning"];
|
|
27
27
|
export declare const toBulkReviewStatusCode: (v: string) => "error" | "valid" | "warning";
|
|
28
28
|
export declare type BulkReviewStatusCode = ReturnType<typeof toBulkReviewStatusCode>;
|
|
29
|
+
export declare const BULK_REVIEW_ERROR_CODES: readonly ["ERR_INSUFFICIENT_DATA", "ERR_INVOICE_DATE_OUTSIDE_ACCOUNTING_PERIOD", "ERR_FUTURE_PAYMENT_DATE_SUPPORTED", "ERR_POSSIBLE_DUPLICATE_TRANSACTION", "ERR_INVALID_DATA", "ERR_PAYMENT_DATE_CURRENT_OR_FUTURE_DATE_SUPPORTED", "ERR_PHYSICAL_ADDRESS_REQUIRED", "ERR_START_DATE_GT_END_DATE", "ERR_RECURRING_PAYMENT_START_DATE_IS_PAST_DATE", "ERR_INCORRECT_RECURRING_PAYMENT_CYCLE", "ERR_INCORRECT_FIELD", "ERR_UPDATE_VENDOR_DETAILS", "ERR_AMOUNT_ZERO"];
|
|
30
|
+
export declare const toBulkReviewErrorCode: (v: string) => "ERR_INSUFFICIENT_DATA" | "ERR_INVOICE_DATE_OUTSIDE_ACCOUNTING_PERIOD" | "ERR_FUTURE_PAYMENT_DATE_SUPPORTED" | "ERR_POSSIBLE_DUPLICATE_TRANSACTION" | "ERR_INVALID_DATA" | "ERR_PAYMENT_DATE_CURRENT_OR_FUTURE_DATE_SUPPORTED" | "ERR_PHYSICAL_ADDRESS_REQUIRED" | "ERR_START_DATE_GT_END_DATE" | "ERR_RECURRING_PAYMENT_START_DATE_IS_PAST_DATE" | "ERR_INCORRECT_RECURRING_PAYMENT_CYCLE" | "ERR_INCORRECT_FIELD" | "ERR_UPDATE_VENDOR_DETAILS" | "ERR_AMOUNT_ZERO";
|
|
31
|
+
export declare type BulkReviewErrorCode = ReturnType<typeof toBulkReviewErrorCode>;
|
|
@@ -1,7 +1,24 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.toBulkReviewStatusCode = exports.BULK_REVIEW_STATUS_CODES = void 0;
|
|
3
|
+
exports.toBulkReviewErrorCode = exports.BULK_REVIEW_ERROR_CODES = exports.toBulkReviewStatusCode = exports.BULK_REVIEW_STATUS_CODES = void 0;
|
|
4
4
|
const stringToUnion_1 = require("../../../../commonStateTypes/stringToUnion");
|
|
5
5
|
exports.BULK_REVIEW_STATUS_CODES = ['valid', 'error', 'warning'];
|
|
6
6
|
const toBulkReviewStatusCode = (v) => (0, stringToUnion_1.stringToUnion)(v, exports.BULK_REVIEW_STATUS_CODES);
|
|
7
7
|
exports.toBulkReviewStatusCode = toBulkReviewStatusCode;
|
|
8
|
+
exports.BULK_REVIEW_ERROR_CODES = [
|
|
9
|
+
'ERR_INSUFFICIENT_DATA',
|
|
10
|
+
'ERR_INVOICE_DATE_OUTSIDE_ACCOUNTING_PERIOD',
|
|
11
|
+
'ERR_FUTURE_PAYMENT_DATE_SUPPORTED',
|
|
12
|
+
'ERR_POSSIBLE_DUPLICATE_TRANSACTION',
|
|
13
|
+
'ERR_INVALID_DATA',
|
|
14
|
+
'ERR_PAYMENT_DATE_CURRENT_OR_FUTURE_DATE_SUPPORTED',
|
|
15
|
+
'ERR_PHYSICAL_ADDRESS_REQUIRED',
|
|
16
|
+
'ERR_START_DATE_GT_END_DATE',
|
|
17
|
+
'ERR_RECURRING_PAYMENT_START_DATE_IS_PAST_DATE',
|
|
18
|
+
'ERR_INCORRECT_RECURRING_PAYMENT_CYCLE',
|
|
19
|
+
'ERR_INCORRECT_FIELD',
|
|
20
|
+
'ERR_UPDATE_VENDOR_DETAILS',
|
|
21
|
+
'ERR_AMOUNT_ZERO',
|
|
22
|
+
];
|
|
23
|
+
const toBulkReviewErrorCode = (v) => (0, stringToUnion_1.stringToUnion)(v, exports.BULK_REVIEW_ERROR_CODES);
|
|
24
|
+
exports.toBulkReviewErrorCode = toBulkReviewErrorCode;
|