@zeniai/client-epic-state 4.14.77 → 4.14.79

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (80) hide show
  1. package/lib/entity/depositAccountTransaction/depositAccountTransaction.d.ts +1 -0
  2. package/lib/entity/depositAccountTransaction/depositAccountTransactionPayload.d.ts +1 -0
  3. package/lib/entity/depositAccountTransaction/depositAccountTransactionPayload.js +1 -0
  4. package/lib/entity/snackbar/snackbarTypes.d.ts +1 -1
  5. package/lib/entity/snackbar/snackbarTypes.js +1 -0
  6. package/lib/entity/tenant/clearAllEpic.d.ts +2 -1
  7. package/lib/entity/tenant/clearAllEpic.js +2 -0
  8. package/lib/entity/tenant/tenantPayload.d.ts +1 -0
  9. package/lib/entity/userRole/userRolePayload.d.ts +1 -0
  10. package/lib/entity/userRole/userRolePayload.js +3 -0
  11. package/lib/entity/userRole/userRoleType.d.ts +2 -2
  12. package/lib/entity/userRole/userRoleType.js +6 -7
  13. package/lib/epic.d.ts +7 -1
  14. package/lib/epic.js +7 -1
  15. package/lib/index.d.ts +19 -15
  16. package/lib/index.js +40 -29
  17. package/lib/init.js +1 -1
  18. package/lib/reducer.d.ts +3 -0
  19. package/lib/reducer.js +3 -0
  20. package/lib/view/accountMappingView/accountMappingTypeHelper.d.ts +17 -0
  21. package/lib/view/accountMappingView/accountMappingTypeHelper.js +2 -0
  22. package/lib/view/addressView/__mocks__/json/createCompanyUserAddressSuccess.json +1 -0
  23. package/lib/view/bankAccountView/bankAccountViewState.d.ts +1 -1
  24. package/lib/view/bankAccountView/epic/createBankAccountEpic.d.ts +2 -1
  25. package/lib/view/bankAccountView/epic/createBankAccountEpic.js +18 -4
  26. package/lib/view/bankAccountView/epic/createInternationalBankAccountEpic.js +4 -2
  27. package/lib/view/commonVendorView/transactionVendorView/epics/saveTransactionVendorEpic.d.ts +2 -1
  28. package/lib/view/commonVendorView/transactionVendorView/epics/saveTransactionVendorEpic.js +43 -15
  29. package/lib/view/commonVendorView/vendorView/epics/saveVendorEpic.d.ts +2 -1
  30. package/lib/view/commonVendorView/vendorView/epics/saveVendorEpic.js +49 -24
  31. package/lib/view/commonVendorView/vendorView/vendorViewPayload.js +2 -2
  32. package/lib/view/commonVendorView/vendorView/vendorViewReducer.d.ts +5 -2
  33. package/lib/view/commonVendorView/vendorView/vendorViewReducer.js +30 -3
  34. package/lib/view/expenseAutomationView/epics/jeSchedule/accountSettings/fetchAccountSettingsListForAccountTypesEpic.d.ts +8 -0
  35. package/lib/view/expenseAutomationView/epics/jeSchedule/accountSettings/fetchAccountSettingsListForAccountTypesEpic.js +41 -0
  36. package/lib/view/expenseAutomationView/epics/jeSchedule/accountSettings/fetchRecommendationForAccountSettingsEpic.d.ts +7 -0
  37. package/lib/view/expenseAutomationView/epics/jeSchedule/accountSettings/fetchRecommendationForAccountSettingsEpic.js +27 -0
  38. package/lib/view/expenseAutomationView/epics/jeSchedule/accountSettings/initializeAccountSettingsViewEpic.d.ts +4 -0
  39. package/lib/view/expenseAutomationView/epics/jeSchedule/accountSettings/initializeAccountSettingsViewEpic.js +13 -0
  40. package/lib/view/expenseAutomationView/epics/jeSchedule/accountSettings/saveAccountSettingsViewEpic.d.ts +8 -0
  41. package/lib/view/expenseAutomationView/epics/jeSchedule/accountSettings/saveAccountSettingsViewEpic.js +50 -0
  42. package/lib/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulePageEpic.d.ts +2 -2
  43. package/lib/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulePageEpic.js +1 -0
  44. package/lib/view/expenseAutomationView/epics/transactionCategorization/fetchTransactionCategorizationViewEpic.d.ts +2 -1
  45. package/lib/view/expenseAutomationView/epics/transactionCategorization/fetchTransactionCategorizationViewEpic.js +6 -0
  46. package/lib/view/expenseAutomationView/helpers/jeAccountSettingHelper.d.ts +3 -0
  47. package/lib/view/expenseAutomationView/helpers/jeAccountSettingHelper.js +50 -0
  48. package/lib/view/expenseAutomationView/reducers/jeSchedulesViewReducer.d.ts +19 -6
  49. package/lib/view/expenseAutomationView/reducers/jeSchedulesViewReducer.js +153 -2
  50. package/lib/view/expenseAutomationView/reducers/transactionsViewReducer.d.ts +5 -1
  51. package/lib/view/expenseAutomationView/reducers/transactionsViewReducer.js +10 -2
  52. package/lib/view/expenseAutomationView/selectorTypes/jeAccountSettingsViewSelectorTypes.d.ts +19 -0
  53. package/lib/view/expenseAutomationView/selectorTypes/jeAccountSettingsViewSelectorTypes.js +2 -0
  54. package/lib/view/expenseAutomationView/selectorTypes/jeSchedulesSelectorTypes.d.ts +2 -0
  55. package/lib/view/expenseAutomationView/selectorTypes/transactionsViewSelectorTypes.d.ts +2 -0
  56. package/lib/view/expenseAutomationView/selectors/jeAccountSettingsViewSelector.d.ts +3 -0
  57. package/lib/view/expenseAutomationView/selectors/jeAccountSettingsViewSelector.js +41 -0
  58. package/lib/view/expenseAutomationView/selectors/jeSchedulesViewSelector.js +3 -0
  59. package/lib/view/expenseAutomationView/selectors/transactionCategorizationSelector.js +3 -1
  60. package/lib/view/expenseAutomationView/types/jeSchedulesViewState.d.ts +27 -0
  61. package/lib/view/expenseAutomationView/types/transactionsViewState.d.ts +2 -0
  62. package/lib/view/people/helpers/updateManagersListOnRoleChange.js +3 -2
  63. package/lib/view/people/peoplePayload.d.ts +1 -0
  64. package/lib/view/spendManagement/billPay/editBillView/epics/saveBillDetailEpic.d.ts +7 -1
  65. package/lib/view/spendManagement/billPay/editBillView/epics/saveBillDetailEpic.js +3 -2
  66. package/lib/view/spendManagement/billPay/internationalWire/epics/createInternationalPaymentInstrumentEpic.js +4 -2
  67. package/lib/view/spendManagement/reimbursement/remiListView/remiListSelector.d.ts +1 -1
  68. package/lib/view/spendManagement/reimbursement/remiListView/remiListSelector.js +6 -3
  69. package/lib/view/spendManagement/zeniAccounts/depositAccountTransactionList/depositAccountTransactionListSelector.js +1 -1
  70. package/lib/view/spendManagement/zeniAccounts/expressPay/epics/fetchExpressPayInitialDetailsEpic.d.ts +10 -0
  71. package/lib/view/spendManagement/zeniAccounts/expressPay/epics/fetchExpressPayInitialDetailsEpic.js +46 -0
  72. package/lib/view/spendManagement/zeniAccounts/expressPay/epics/submitExpressPayEpic.d.ts +8 -0
  73. package/lib/view/spendManagement/zeniAccounts/expressPay/epics/submitExpressPayEpic.js +67 -0
  74. package/lib/view/spendManagement/zeniAccounts/expressPay/expressPayReducer.d.ts +15 -0
  75. package/lib/view/spendManagement/zeniAccounts/expressPay/expressPayReducer.js +61 -0
  76. package/lib/view/spendManagement/zeniAccounts/expressPay/expressPaySelector.d.ts +27 -0
  77. package/lib/view/spendManagement/zeniAccounts/expressPay/expressPaySelector.js +85 -0
  78. package/lib/view/spendManagement/zeniAccounts/expressPay/expressPayState.d.ts +19 -0
  79. package/lib/view/spendManagement/zeniAccounts/expressPay/expressPayState.js +2 -0
  80. package/package.json +2 -2
@@ -16,7 +16,7 @@ function getExpenseAutomationTransactionView(state) {
16
16
  var _a;
17
17
  const { accountState, classState, classListState, accountListState, expenseAutomationTransactionsViewState, expenseAutomationViewState, transactionState, monthEndCloseChecksState, } = state;
18
18
  const { selectedTransactionCategorizationTab } = expenseAutomationTransactionsViewState;
19
- const { uiState, refreshStatus, saveStatus, markAsNotMiscategorizedStatus, transactionIdsBySelectedPeriod, transactionReviewLocalDataById, selectedCheckBoxTransactionIds, } = expenseAutomationTransactionsViewState.transactionCategorizationView[selectedTransactionCategorizationTab];
19
+ const { uiState, refreshStatus, saveStatus, markAsNotMiscategorizedStatus, transactionIdsBySelectedPeriod, transactionReviewLocalDataById, selectedCheckBoxTransactionIds, selectedTransactionId, selectedTransactionLineId, } = expenseAutomationTransactionsViewState.transactionCategorizationView[selectedTransactionCategorizationTab];
20
20
  const uncategorizedIncomeExpense = (0, accountListSelector_1.getUncategorizedAccounts)(accountState, accountListState, 'accountList');
21
21
  const accountList = (0, accountListSelector_1.getAccountList)(accountState, accountListState, 'accountList');
22
22
  const classList = (0, classListSelector_1.getClassList)(classState, classListState);
@@ -104,5 +104,7 @@ function getExpenseAutomationTransactionView(state) {
104
104
  completionStatus,
105
105
  totalCountByTab,
106
106
  fetchStateByTransactionTabs: fetchStateByTab,
107
+ selectedTransactionId,
108
+ selectedTransactionLineId,
107
109
  };
108
110
  }
@@ -1,5 +1,8 @@
1
+ import { NestedAccountHierarchyForReport } from '../../../commonStateTypes/accountView/nestedAccountID';
1
2
  import { FetchStateAndError, FetchedState, ID } from '../../../commonStateTypes/common';
3
+ import { Recommendation } from '../../../commonStateTypes/recommendationBase';
2
4
  import { MonthYearPeriodId } from '../../../commonStateTypes/timePeriod';
5
+ import { AccountBase } from '../../../entity/account/accountState';
3
6
  import { JEScheduleTransactionKey, ScheduleTypes } from '../../../entity/jeSchedules/jeSchedulesTypes';
4
7
  import { VendorBase } from '../../../entity/vendor/vendorState';
5
8
  export interface JESchedulesViewUIState {
@@ -24,8 +27,32 @@ export interface JESchedulesViewState extends FetchedState {
24
27
  jeScheduleTransactionKeysByPeriod: Record<MonthYearPeriodId, JEScheduleTransactionKey[]>;
25
28
  failedJeScheduleTransactionKeysByPeriod: Record<MonthYearPeriodId, JEScheduleTransactionKey[]>;
26
29
  jeScheduleLocalDataById: Record<ID, JEScheduleLocalData>;
30
+ accountSettings: AccountSettingsState;
27
31
  postStatusById: Record<ID, FetchStateAndError>;
28
32
  ignoreStatusById: Record<JEScheduleTransactionKey, FetchStateAndError>;
29
33
  refreshStatus: FetchStateAndError;
30
34
  uiState: JESchedulesViewUIState;
31
35
  }
36
+ export interface AccountSettingsLocalData {
37
+ selectedFixedAssetsAccountIds: ID[];
38
+ selectedPrepaidExpensesAccountIds: ID[];
39
+ selectedAccruedExpensesAccountIds: ID[];
40
+ previousPrepaidExpensesAccount: AccountBase[];
41
+ previousFixedAssetsAccount: AccountBase[];
42
+ previousAccruedExpensesAccount: AccountBase[];
43
+ }
44
+ export interface AccountSettingsState {
45
+ localData: AccountSettingsLocalData;
46
+ accountListFetchState: FetchStateAndError;
47
+ recommendationFetchState: FetchStateAndError;
48
+ updateFetchState: FetchStateAndError;
49
+ prepaidExpensesAccountIdList: ID[];
50
+ prepaidExpensesNestedAccountListHierarchy: NestedAccountHierarchyForReport[];
51
+ prepaidExpensesRecommendations: Recommendation[];
52
+ fixedAssetsAccountIdList: ID[];
53
+ fixedAssetsNestedAccountListHierarchy: NestedAccountHierarchyForReport[];
54
+ fixedAssetsRecommendations: Recommendation[];
55
+ accruedExpensesAccountIdList: ID[];
56
+ accruedExpensesNestedAccountListHierarchy: NestedAccountHierarchyForReport[];
57
+ accruedExpensesRecommendations: Recommendation[];
58
+ }
@@ -84,6 +84,8 @@ export interface TransactionsTabViewState extends FetchedState {
84
84
  markAsNotMiscategorizedStatus: FetchStateAndError;
85
85
  refreshStatus: FetchStateAndError;
86
86
  uiState: TransactionsViewUIState;
87
+ selectedTransactionId?: ID;
88
+ selectedTransactionLineId?: ID;
87
89
  }
88
90
  export type TransactionsViewState = {
89
91
  selectedTransactionCategorizationTab: TransactionsTab;
@@ -3,9 +3,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.updateManagersListOnRoleChange = void 0;
4
4
  const userListViewReducer_1 = require("../../userListView/userListViewReducer");
5
5
  const updateManagersListOnRoleChange = (actions, userRoles, isZeniTenant) => {
6
- const { is_admin, is_bookkeeping_admin, is_bookkeeping_user, user_id, is_invite_accepted, is_reimbursements_user, is_zeni, } = userRoles;
6
+ const { is_admin, is_bookkeeping_admin, is_bookkeeping_user, user_id, is_invite_accepted, is_reimbursements_user, is_zeni, is_zeni_support_user, } = userRoles;
7
7
  if (is_invite_accepted && (!is_zeni || Boolean(isZeniTenant))) {
8
- if (is_admin ||
8
+ if (is_zeni_support_user ||
9
+ is_admin ||
9
10
  is_bookkeeping_admin ||
10
11
  is_bookkeeping_user ||
11
12
  is_reimbursements_user) {
@@ -7,6 +7,7 @@ export interface PeoplePayload {
7
7
  }
8
8
  export interface PeopleUpdatePayload {
9
9
  is_admin: boolean;
10
+ is_zeni_support_user: boolean;
10
11
  is_bookkeeping_admin: boolean;
11
12
  is_banker: boolean;
12
13
  is_investor_or_banker: boolean;
@@ -10,12 +10,18 @@ import { openSnackbar } from '../../../../../entity/snackbar/snackbarReducer';
10
10
  import { TransactionWithAccountAndClassLinePayload } from '../../../../../entity/transaction/payloadTypes/transactionLinePayload';
11
11
  import { RootState } from '../../../../../reducer';
12
12
  import { ZeniAPI } from '../../../../../zeniAPI';
13
- import { BillPaymentConfigCodeType, BillPaymentSubConfigCodeType } from '../../billPayConfig/billPayConfigState';
13
+ import { BillPayConfig, BillPaymentConfigCodeType, BillPaymentSubConfigCodeType } from '../../billPayConfig/billPayConfigState';
14
14
  import { saveBillDetail, saveBillSuccessOrFailure } from '../editBillViewReducer';
15
15
  import { EditBillDetail } from '../editBillViewState';
16
16
  export type ActionType = ReturnType<typeof saveBillDetail> | ReturnType<typeof updateBillTransaction> | ReturnType<typeof openSnackbar> | ReturnType<typeof saveBillSuccessOrFailure> | ReturnType<typeof updateRecurringBillConfigs> | ReturnType<typeof updateRecurringBills>;
17
17
  export declare const saveBillDetailEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => import("rxjs").Observable<ActionType>;
18
18
  export declare function prepareSaveBillPayload(accountState: AccountState, billTransactionState: BillTransactionState, paymentAccountState: PaymentAccountState, recurringBillState: RecurringBillState, billDetail: EditBillDetail, billStageCode: BillStageCodeType, isForMarkAsPaid: boolean, isApproverMarkingAsPaid: boolean): Partial<SaveBillPayload>;
19
+ export declare const getBillPaymentMethodTypePayload: (paymentType?: BillPayConfig) => BillPaymentMethodTypePayload;
20
+ interface BillPaymentMethodTypePayload {
21
+ code: BillPaymentConfigCodeType | null;
22
+ name: string;
23
+ sub_code: BillPaymentSubConfigCodeType | null;
24
+ }
19
25
  interface SaveBillPayload {
20
26
  vendor_id: string;
21
27
  vendor_name?: string | null;
@@ -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.saveBillDetailEpic = void 0;
6
+ exports.getBillPaymentMethodTypePayload = exports.saveBillDetailEpic = void 0;
7
7
  exports.prepareSaveBillPayload = prepareSaveBillPayload;
8
8
  const get_1 = __importDefault(require("lodash/get"));
9
9
  const rxjs_1 = require("rxjs");
@@ -134,7 +134,7 @@ function prepareSaveBillPayload(accountState, billTransactionState, paymentAccou
134
134
  to_account_vendor_email: (_9 = billDetail.billDetailLocalData.toAccountVendorEmail) !== null && _9 !== void 0 ? _9 : null,
135
135
  is_collect_to_account_info_from_vendor_contact: billDetail.billDetailLocalData.isCollectToAccountInfoFromVendorContact,
136
136
  is_cancelled: false,
137
- bill_payment_method_type: getBillPaymentMethodTypePayload((_10 = billDetail.billDetailLocalData.paymentDetailsSection) === null || _10 === void 0 ? void 0 : _10.paymentType),
137
+ bill_payment_method_type: (0, exports.getBillPaymentMethodTypePayload)((_10 = billDetail.billDetailLocalData.paymentDetailsSection) === null || _10 === void 0 ? void 0 : _10.paymentType),
138
138
  international_transfer_fee_bearer_payment_method: ((_12 = (_11 = billDetail.billDetailLocalData.paymentDetailsSection) === null || _11 === void 0 ? void 0 : _11.paymentType) === null || _12 === void 0 ? void 0 : _12.method.includes('international')) === true &&
139
139
  ((_13 = billDetail.billDetailLocalData.vendor) === null || _13 === void 0 ? void 0 : _13.vendorCurrencyCode) === 'USD'
140
140
  ? ((_14 = billDetail.billDetailLocalData.paymentDetailsSection
@@ -240,6 +240,7 @@ const getBillPaymentMethodTypePayload = (paymentType) => {
240
240
  : null,
241
241
  };
242
242
  };
243
+ exports.getBillPaymentMethodTypePayload = getBillPaymentMethodTypePayload;
243
244
  const getPaymentDate = (billDetailLocalData) => {
244
245
  var _a, _b, _c, _d, _e, _f, _g, _h;
245
246
  const isPaymentOutsideZeni = (0, helpers_1.isPaymentMethodOutsideZeni)((_b = (_a = billDetailLocalData.paymentDetailsSection) === null || _a === void 0 ? void 0 : _a.paymentType) === null || _b === void 0 ? void 0 : _b.method);
@@ -24,7 +24,8 @@ const createPaymentInstrumentEpic = (actions$, state$, zeniAPI) => actions$.pipe
24
24
  fetchState: 'Completed',
25
25
  }));
26
26
  if (bankAccountContext === 'vendor' ||
27
- bankAccountContext === 'billDetail') {
27
+ bankAccountContext === 'billDetail' ||
28
+ bankAccountContext === 'express-pay') {
28
29
  bankAccountActions.push((0, vendorViewReducer_1.updatePaymentInstrumentsInVendorView)({
29
30
  paymentInstrumentIds: [
30
31
  (_b = response.data.payment_instruments[0]
@@ -71,7 +72,8 @@ const createPaymentInstrumentEpic = (actions$, state$, zeniAPI) => actions$.pipe
71
72
  ],
72
73
  }));
73
74
  if (bankAccountContext === 'vendor' ||
74
- bankAccountContext === 'billDetail') {
75
+ bankAccountContext === 'billDetail' ||
76
+ bankAccountContext === 'express-pay') {
75
77
  bankAccountActions.push((0, vendorViewReducer_1.updatePaymentInstrumentsInVendorView)({
76
78
  paymentInstrumentIds: [
77
79
  (_h = (_g = response.data) === null || _g === void 0 ? void 0 : _g.payment_instruments[0].zeni_payment_instrument_id) !== null && _h !== void 0 ? _h : '',
@@ -46,4 +46,4 @@ export interface ReimbursementView extends Reimbursement {
46
46
  export declare const getRemiList: (state: RootState, currentTimePeriod: TimePeriod, isBulkActionFeatureEnabled: boolean) => RemiListReport;
47
47
  export declare const getApproversOrRejectors: (reimbursement: Reimbursement, entityApprovalStatusState: EntityApprovalStatusState, userState: UserState) => Approvers;
48
48
  export declare const getRemiListOnSort: (sortKey: ReimbursementViewSortKey, sortOrder: SortOrder, currentTab: RemiTabType, reimbursements: ReimbursementView[]) => ReimbursementView[];
49
- export declare const getAllowedBulkActions: (selectedTab: RemiTabType, selectedSubTab: RemiSubTabType, isAllAwaitingMyApproval: boolean, isFirstBillProcessing: boolean) => BulkOperationType[];
49
+ export declare const getAllowedBulkActions: (selectedTab: RemiTabType, selectedSubTab: RemiSubTabType, isAllAwaitingMyApproval: boolean, isFirstBillProcessing: boolean, hasReimbursementFromOthers: boolean) => BulkOperationType[];
@@ -112,9 +112,10 @@ const getRemiList = (state, currentTimePeriod, isBulkActionFeatureEnabled) => {
112
112
  });
113
113
  const allBulkRemisAwaitingMyApproval = (0, difference_1.default)(remisSelectedForBulkAction, pendingApprovalTransactionIDs)
114
114
  .length === 0;
115
+ const hasReimbursementFromOthers = reimbursementsDetailed.some((remi) => remi.createdBy !== loggedInUserId);
115
116
  const allowedBulkActions = isBulkActionAllowed
116
117
  ? (0, exports.getAllowedBulkActions)(remiListState.currentTab, remiListState.currentSubTab, allBulkRemisAwaitingMyApproval, (firstRemiInBulkList === null || firstRemiInBulkList === void 0 ? void 0 : firstRemiInBulkList.reimbursementInfo.billPaymentStatus.code) ===
117
- 'processing')
118
+ 'processing', hasReimbursementFromOthers)
118
119
  : [];
119
120
  remiListBulkActionInfo = {
120
121
  isBulkActionAllowed,
@@ -510,10 +511,12 @@ const isRemiSelectableForBulkAction = (reimbursement, selectedTab, firstSelectab
510
511
  }
511
512
  return result;
512
513
  };
513
- const getAllowedBulkActions = (selectedTab, selectedSubTab, isAllAwaitingMyApproval, isFirstBillProcessing) => {
514
+ const getAllowedBulkActions = (selectedTab, selectedSubTab, isAllAwaitingMyApproval, isFirstBillProcessing, hasReimbursementFromOthers) => {
514
515
  switch (selectedTab) {
515
516
  case 'draft':
516
- return ['send_for_approval', 'delete'];
517
+ return hasReimbursementFromOthers
518
+ ? ['delete']
519
+ : ['send_for_approval', 'delete'];
517
520
  case 'pending_approval': {
518
521
  switch (selectedSubTab) {
519
522
  case 'all':
@@ -12,7 +12,7 @@ const getDepositAccountTransactionList = (state, depositAccountId, transactionsC
12
12
  const transactionsByDeposit = depositAccountTransactionListState.byDepositId[depositAccountId];
13
13
  const transactionIds = (_a = transactionsByDeposit === null || transactionsByDeposit === void 0 ? void 0 : transactionsByDeposit.transactions) !== null && _a !== void 0 ? _a : [];
14
14
  const transactionsUnsorted = (0, depositAccountTransactionSelector_1.getDepositAccountTransactionByIds)(depositAccountTransactionState, transactionIds);
15
- const transactions = (0, orderBy_1.default)(transactionsUnsorted, (value) => value.createTime.valueOf(), 'desc');
15
+ const transactions = (0, orderBy_1.default)(transactionsUnsorted, (value) => value.transactionDate.valueOf(), 'desc');
16
16
  return {
17
17
  transactions: transactionsCount != null
18
18
  ? transactions.slice(0, transactionsCount)
@@ -0,0 +1,10 @@
1
+ import { ActionsObservable, StateObservable } from 'redux-observable';
2
+ import { Observable } from 'rxjs';
3
+ import { RootState } from '../../../../../reducer';
4
+ import { fetchVendorTypeList } from '../../../../vendorTypeList/vendorTypeListReducer';
5
+ import { fetchBillPayConfig } from '../../../billPay/billPayConfig/billPayConfigReducer';
6
+ import { fetchDepositAccountList } from '../../depositAccountList/depositAccountListReducer';
7
+ import { fetchPaymentAccountList } from '../../paymentAccountList/paymentAccountListReducer';
8
+ import { fetchExpressPayInitialDetails, updateExpressPayFetchState } from '../expressPayReducer';
9
+ export type ActionType = ReturnType<typeof fetchExpressPayInitialDetails> | ReturnType<typeof fetchBillPayConfig> | ReturnType<typeof fetchVendorTypeList> | ReturnType<typeof fetchDepositAccountList> | ReturnType<typeof fetchPaymentAccountList> | ReturnType<typeof updateExpressPayFetchState>;
10
+ export declare const fetchExpressPayInitialDetailsEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>) => Observable<ActionType>;
@@ -0,0 +1,46 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.fetchExpressPayInitialDetailsEpic = void 0;
4
+ const rxjs_1 = require("rxjs");
5
+ const operators_1 = require("rxjs/operators");
6
+ const vendorTypeListReducer_1 = require("../../../../vendorTypeList/vendorTypeListReducer");
7
+ const billPayConfigReducer_1 = require("../../../billPay/billPayConfig/billPayConfigReducer");
8
+ const depositAccountListReducer_1 = require("../../depositAccountList/depositAccountListReducer");
9
+ const paymentAccountListReducer_1 = require("../../paymentAccountList/paymentAccountListReducer");
10
+ const expressPayReducer_1 = require("../expressPayReducer");
11
+ const fetchExpressPayInitialDetailsEpic = (actions$, state$) => actions$.pipe((0, operators_1.filter)(expressPayReducer_1.fetchExpressPayInitialDetails.match), (0, operators_1.mergeMap)((action) => {
12
+ const { cacheOverride, isInternationalWireEnabled } = action.payload;
13
+ const state = state$.value;
14
+ const fetchActions = [];
15
+ if (cacheOverride === true) {
16
+ fetchActions.push((0, vendorTypeListReducer_1.fetchVendorTypeList)());
17
+ fetchActions.push((0, billPayConfigReducer_1.fetchBillPayConfig)(isInternationalWireEnabled));
18
+ fetchActions.push((0, depositAccountListReducer_1.fetchDepositAccountList)());
19
+ fetchActions.push((0, paymentAccountListReducer_1.fetchPaymentAccountList)());
20
+ fetchActions.push((0, expressPayReducer_1.updateExpressPayFetchState)());
21
+ }
22
+ else {
23
+ if (state.vendorTypeListState.hasValidState() === false &&
24
+ state.vendorTypeListState.fetchState !== 'In-Progress') {
25
+ fetchActions.push((0, vendorTypeListReducer_1.fetchVendorTypeList)());
26
+ }
27
+ const billPayConfigFetchState = state.billPayConfigState.fetchState;
28
+ if (billPayConfigFetchState !== 'Completed' &&
29
+ billPayConfigFetchState !== 'In-Progress') {
30
+ fetchActions.push((0, billPayConfigReducer_1.fetchBillPayConfig)(isInternationalWireEnabled));
31
+ }
32
+ const depositAccounts = state.depositAccountListState;
33
+ if (depositAccounts.fetchState !== 'In-Progress' &&
34
+ depositAccounts.fetchState !== 'Completed') {
35
+ fetchActions.push((0, depositAccountListReducer_1.fetchDepositAccountList)());
36
+ }
37
+ const paymentAccounts = state.paymentAccountListState;
38
+ if (paymentAccounts.fetchState !== 'In-Progress' &&
39
+ paymentAccounts.fetchState !== 'Completed') {
40
+ fetchActions.push((0, paymentAccountListReducer_1.fetchPaymentAccountList)());
41
+ }
42
+ fetchActions.push((0, expressPayReducer_1.updateExpressPayFetchState)());
43
+ }
44
+ return (0, rxjs_1.concat)((0, rxjs_1.from)(fetchActions));
45
+ }));
46
+ exports.fetchExpressPayInitialDetailsEpic = fetchExpressPayInitialDetailsEpic;
@@ -0,0 +1,8 @@
1
+ import { ActionsObservable, StateObservable } from 'redux-observable';
2
+ import { Observable } from 'rxjs';
3
+ import { openSnackbar } from '../../../../../entity/snackbar/snackbarReducer';
4
+ import { RootState } from '../../../../../reducer';
5
+ import { ZeniAPI } from '../../../../../zeniAPI';
6
+ import { submitExpressPay, updateExpressPaySubmissionStatus } from '../expressPayReducer';
7
+ export type ActionType = ReturnType<typeof submitExpressPay> | ReturnType<typeof updateExpressPaySubmissionStatus> | ReturnType<typeof openSnackbar>;
8
+ export declare const submitExpressPayEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
@@ -0,0 +1,67 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.submitExpressPayEpic = 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 saveBillDetailEpic_1 = require("../../../billPay/editBillView/epics/saveBillDetailEpic");
9
+ const expressPayReducer_1 = require("../expressPayReducer");
10
+ const submitExpressPayEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(expressPayReducer_1.submitExpressPay.match), (0, operators_1.switchMap)(() => {
11
+ const { expressPayState } = state$.value;
12
+ const localData = expressPayState.formLocalData;
13
+ if (localData != null) {
14
+ return zeniAPI
15
+ .postAndGetJSON(`${zeniAPI.apiEndPoints.bankingMicroServiceBaseUrl}/1.0/transactions/express-pay`, toExpressPayPayload(localData))
16
+ .pipe((0, operators_1.mergeMap)((response) => {
17
+ const actions = [];
18
+ if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
19
+ actions.push((0, expressPayReducer_1.updateExpressPaySubmissionStatus)({
20
+ fetchState: 'Completed',
21
+ error: undefined,
22
+ }));
23
+ actions.push((0, snackbarReducer_1.openSnackbar)({
24
+ messageSection: 'express_pay_submit',
25
+ messageText: 'success',
26
+ type: 'success',
27
+ }));
28
+ }
29
+ else {
30
+ actions.push((0, expressPayReducer_1.updateExpressPaySubmissionStatus)({
31
+ fetchState: 'Error',
32
+ error: response.status,
33
+ }));
34
+ actions.push((0, snackbarReducer_1.openSnackbar)({
35
+ messageSection: 'express_pay_submit',
36
+ messageText: 'failed',
37
+ type: 'error',
38
+ }));
39
+ }
40
+ return (0, rxjs_1.from)(actions);
41
+ }), (0, operators_1.catchError)((error) => {
42
+ return (0, rxjs_1.of)((0, expressPayReducer_1.updateExpressPaySubmissionStatus)({
43
+ fetchState: 'Error',
44
+ error: (0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Submit express pay REST API call errored out' +
45
+ JSON.stringify(error)),
46
+ }));
47
+ }));
48
+ }
49
+ else {
50
+ return (0, rxjs_1.from)([]);
51
+ }
52
+ }));
53
+ exports.submitExpressPayEpic = submitExpressPayEpic;
54
+ const toExpressPayPayload = (localData) => {
55
+ var _a;
56
+ const paymentMethodType = (0, saveBillDetailEpic_1.getBillPaymentMethodTypePayload)(localData.paymentType);
57
+ return {
58
+ to_bank_account_id: localData.paymentToAccountId,
59
+ vendor_id: localData.vendorId,
60
+ amount: localData.amount.amount,
61
+ payment_method_type: paymentMethodType.code,
62
+ payment_method_sub_type: paymentMethodType.sub_code,
63
+ source_deposit_account_id: (_a = localData.withdrawFrom) === null || _a === void 0 ? void 0 : _a.id,
64
+ payment_date: localData.paymentDate.format('YYYY-MM-DD'),
65
+ file_id: localData.receiptFileId,
66
+ };
67
+ };
@@ -0,0 +1,15 @@
1
+ import { FetchState } from '../../../../commonStateTypes/common';
2
+ import { ZeniAPIStatus } from '../../../../responsePayload';
3
+ import { ExpressPayFormLocalData, ExpressPayState } from './expressPayState';
4
+ export declare const initialState: ExpressPayState;
5
+ export declare const fetchExpressPayInitialDetails: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[cacheOverride: boolean, isInternationalWireEnabled: boolean], {
6
+ cacheOverride: boolean;
7
+ isInternationalWireEnabled: boolean;
8
+ }, "expressPay/fetchExpressPayInitialDetails", never, never>, updateExpressPayFetchState: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"expressPay/updateExpressPayFetchState">, updateExpressPayFormLocalData: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
9
+ localData: ExpressPayFormLocalData;
10
+ }, "expressPay/updateExpressPayFormLocalData">, submitExpressPay: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"expressPay/submitExpressPay">, updateExpressPaySubmissionStatus: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
11
+ fetchState: FetchState;
12
+ error?: ZeniAPIStatus;
13
+ }, "expressPay/updateExpressPaySubmissionStatus">, resetExpressPayLocalData: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"expressPay/resetExpressPayLocalData">, clearExpressPayView: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"expressPay/clearExpressPayView">;
14
+ declare const _default: import("redux").Reducer<ExpressPayState>;
15
+ export default _default;
@@ -0,0 +1,61 @@
1
+ "use strict";
2
+ var _a;
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.clearExpressPayView = exports.resetExpressPayLocalData = exports.updateExpressPaySubmissionStatus = exports.submitExpressPay = exports.updateExpressPayFormLocalData = exports.updateExpressPayFetchState = exports.fetchExpressPayInitialDetails = exports.initialState = void 0;
5
+ const toolkit_1 = require("@reduxjs/toolkit");
6
+ const zeniDayJS_1 = require("../../../../zeniDayJS");
7
+ exports.initialState = {
8
+ formLocalData: {
9
+ amount: {
10
+ amount: 0,
11
+ currencyCode: 'USD',
12
+ currencySymbol: '$',
13
+ },
14
+ paymentDate: (0, zeniDayJS_1.dateNow)(),
15
+ },
16
+ fetchState: 'Not-Started',
17
+ expressPaySubmitStatus: { fetchState: 'Not-Started' },
18
+ };
19
+ const expressPay = (0, toolkit_1.createSlice)({
20
+ name: 'expressPay',
21
+ initialState: exports.initialState,
22
+ reducers: {
23
+ fetchExpressPayInitialDetails: {
24
+ reducer(draft) {
25
+ draft.fetchState = 'In-Progress';
26
+ },
27
+ prepare(cacheOverride, isInternationalWireEnabled) {
28
+ return {
29
+ payload: {
30
+ cacheOverride,
31
+ isInternationalWireEnabled,
32
+ },
33
+ };
34
+ },
35
+ },
36
+ updateExpressPayFetchState(draft) {
37
+ draft.fetchState = 'Completed';
38
+ draft.error = undefined;
39
+ },
40
+ updateExpressPayFormLocalData(draft, action) {
41
+ draft.formLocalData = action.payload.localData;
42
+ },
43
+ submitExpressPay(draft) {
44
+ draft.expressPaySubmitStatus.fetchState = 'In-Progress';
45
+ draft.expressPaySubmitStatus.error = undefined;
46
+ },
47
+ updateExpressPaySubmissionStatus(draft, action) {
48
+ const { fetchState, error } = action.payload;
49
+ draft.expressPaySubmitStatus.fetchState = fetchState;
50
+ draft.expressPaySubmitStatus.error = error;
51
+ },
52
+ resetExpressPayLocalData(draft) {
53
+ draft.formLocalData = exports.initialState.formLocalData;
54
+ },
55
+ clearExpressPayView(draft) {
56
+ Object.assign(draft, exports.initialState);
57
+ },
58
+ },
59
+ });
60
+ _a = expressPay.actions, exports.fetchExpressPayInitialDetails = _a.fetchExpressPayInitialDetails, exports.updateExpressPayFetchState = _a.updateExpressPayFetchState, exports.updateExpressPayFormLocalData = _a.updateExpressPayFormLocalData, exports.submitExpressPay = _a.submitExpressPay, exports.updateExpressPaySubmissionStatus = _a.updateExpressPaySubmissionStatus, exports.resetExpressPayLocalData = _a.resetExpressPayLocalData, exports.clearExpressPayView = _a.clearExpressPayView;
61
+ exports.default = expressPay.reducer;
@@ -0,0 +1,27 @@
1
+ import { AllowedValueWithCode } from '../../../../commonStateTypes/allowedValue';
2
+ import { FetchState, FetchStateAndError, ID } from '../../../../commonStateTypes/common';
3
+ import { SelectorView } from '../../../../commonStateTypes/viewAndReport/viewAndReport';
4
+ import { File } from '../../../../entity/file/fileState';
5
+ import { RootState } from '../../../../reducer';
6
+ import { VendorViewSelectorView } from '../../../commonVendorView/vendorView/vendorViewSelector';
7
+ import { VendorType } from '../../../vendorTypeList/vendorTypeListPayload';
8
+ import { BillPayConfig } from '../../billPay/billPayConfig/billPayConfigState';
9
+ import { PaymentDetailsSectionView, PaymentToOption } from '../../billPay/editBillView/editBillViewSelector';
10
+ import { FundingAccount } from '../../commonSetup/setupViewSelector';
11
+ import { ExpressPayFormLocalData } from './expressPayState';
12
+ export interface ExpressPayView extends SelectorView {
13
+ vendorViewDetails: VendorViewSelectorView;
14
+ vendorTypeList: VendorType[];
15
+ expressPayLocalData?: ExpressPayFormLocalData;
16
+ paymentDetails?: PaymentDetailsSectionView;
17
+ paymentToOptions: PaymentToOption[];
18
+ allPaymentMethods: BillPayConfig[];
19
+ withdrawFromList: FundingAccount[];
20
+ receiptFile?: File;
21
+ internationalWireOnboardingStatus?: AllowedValueWithCode;
22
+ deleteFileStatusById: Record<ID, FetchStateAndError | undefined>;
23
+ updateFileStatusById: Record<ID, FetchStateAndError | undefined>;
24
+ vendorSaveStatus: FetchState;
25
+ submitStatus: FetchState;
26
+ }
27
+ export declare const getExpressPayView: (state: RootState) => ExpressPayView;
@@ -0,0 +1,85 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getExpressPayView = void 0;
4
+ const reduceFetchState_1 = require("../../../../commonStateTypes/reduceFetchState");
5
+ const bankAccountSelector_1 = require("../../../../entity/bankAccount/bankAccountSelector");
6
+ const fileSelector_1 = require("../../../../entity/file/fileSelector");
7
+ const paymentInstrumentSelector_1 = require("../../../../entity/paymentInstrument/paymentInstrumentSelector");
8
+ const vendorViewSelector_1 = require("../../../commonVendorView/vendorView/vendorViewSelector");
9
+ const getCompanyView_1 = require("../../../companyView/selectorHelpers/getCompanyView");
10
+ const fileViewSelector_1 = require("../../../fileView/fileViewSelector");
11
+ const editBillViewSelector_1 = require("../../billPay/editBillView/editBillViewSelector");
12
+ const setupViewSelector_1 = require("../../commonSetup/setupViewSelector");
13
+ const depositAccountListSelector_1 = require("../depositAccountList/depositAccountListSelector");
14
+ const getExpressPayView = (state) => {
15
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
16
+ const deleteFileStatusById = {};
17
+ const updateFileStatusById = {};
18
+ const { tenantState, expressPayState, vendorTypeListState, bankAccountState, paymentInstrumentState, billPayConfigState, vendorViewState, depositAccountState, depositAccountListState, paymentAccountListState, } = state;
19
+ const { currentTenantId } = tenantState;
20
+ const companyId = currentTenantId != null
21
+ ? (_b = (_a = tenantState.tenantsById) === null || _a === void 0 ? void 0 : _a[currentTenantId]) === null || _b === void 0 ? void 0 : _b.companyId
22
+ : undefined;
23
+ const companyView = (0, getCompanyView_1.getCompanyView)(state, companyId !== null && companyId !== void 0 ? companyId : '', []);
24
+ const vendorTypeList = vendorTypeListState.vendorTypes;
25
+ const allPaymentMethods = (0, editBillViewSelector_1.getBillPayConfigList)(billPayConfigState);
26
+ const vendorId = (_c = expressPayState.formLocalData) === null || _c === void 0 ? void 0 : _c.vendorId;
27
+ const vendorViewDetails = (0, vendorViewSelector_1.getVendorView)(state, vendorId);
28
+ const vendorLocalData = vendorId != null
29
+ ? (_d = vendorViewDetails.editVendorState) === null || _d === void 0 ? void 0 : _d.vendorDetailLocalData
30
+ : (_e = vendorViewDetails.newVendorState) === null || _e === void 0 ? void 0 : _e.vendorDetailLocalData;
31
+ const vendorSaveStatus = vendorId != null && ((_f = vendorViewState.editVendorStateById) === null || _f === void 0 ? void 0 : _f[vendorId]) != null
32
+ ? vendorViewState.editVendorStateById[vendorId].saveStatus.fetchState
33
+ : (_g = vendorViewState.newVendorState) === null || _g === void 0 ? void 0 : _g.saveStatus.fetchState;
34
+ const vendorBankAccounts = (0, bankAccountSelector_1.getBankAccountsByBankAccountIds)(bankAccountState, (_h = vendorLocalData === null || vendorLocalData === void 0 ? void 0 : vendorLocalData.bankAccountIds) !== null && _h !== void 0 ? _h : []);
35
+ const vendorPaymentInstruments = (0, paymentInstrumentSelector_1.getPaymentInstrumentsByIds)(paymentInstrumentState, (_j = vendorLocalData === null || vendorLocalData === void 0 ? void 0 : vendorLocalData.paymentInstrumentIds) !== null && _j !== void 0 ? _j : []);
36
+ const paymentToOptions = [
37
+ ...vendorBankAccounts.map((acc) => (0, editBillViewSelector_1.toPaymentToOption)(acc)),
38
+ ...vendorPaymentInstruments.map((pi) => (0, editBillViewSelector_1.toPaymentToOption)(pi)),
39
+ ];
40
+ const allDepositAccounts = (0, depositAccountListSelector_1.getAllDepostAccounts)(depositAccountState, depositAccountListState).depositAccounts;
41
+ const withdrawFromList = (0, setupViewSelector_1.getAllFundingAccounts)(allDepositAccounts, [], paymentAccountListState.paymentAccountBalanceFetchStatus);
42
+ const internationalWireOnboardingStatus = companyView === null || companyView === void 0 ? void 0 : companyView.company.company.companyBillPayInfo.internationalWireOnboardingStatus;
43
+ const fileId = (_k = expressPayState.formLocalData) === null || _k === void 0 ? void 0 : _k.receiptFileId;
44
+ let receiptFile;
45
+ if (fileId != null) {
46
+ deleteFileStatusById[fileId] = (0, fileViewSelector_1.getFileDeleteStatusById)(state, fileId);
47
+ updateFileStatusById[fileId] = (0, fileViewSelector_1.getFileUpdateNameStatusById)(state, fileId);
48
+ receiptFile = (0, fileSelector_1.getFileByFileId)(state.fileState, fileId);
49
+ }
50
+ const fetchState = (0, reduceFetchState_1.reduceFetchState)([
51
+ {
52
+ fetchState: vendorTypeListState.fetchState,
53
+ error: vendorTypeListState.error,
54
+ },
55
+ {
56
+ fetchState: billPayConfigState.fetchState,
57
+ error: billPayConfigState.error,
58
+ },
59
+ {
60
+ fetchState: depositAccountListState.fetchState,
61
+ error: depositAccountListState.error,
62
+ },
63
+ {
64
+ fetchState: paymentAccountListState.fetchState,
65
+ error: paymentAccountListState.error,
66
+ },
67
+ ]);
68
+ return {
69
+ vendorViewDetails,
70
+ vendorTypeList,
71
+ paymentToOptions,
72
+ allPaymentMethods,
73
+ withdrawFromList,
74
+ internationalWireOnboardingStatus,
75
+ expressPayLocalData: expressPayState.formLocalData,
76
+ receiptFile,
77
+ deleteFileStatusById,
78
+ updateFileStatusById,
79
+ vendorSaveStatus,
80
+ submitStatus: expressPayState.expressPaySubmitStatus.fetchState,
81
+ fetchState: fetchState.fetchState,
82
+ error: fetchState.error,
83
+ };
84
+ };
85
+ exports.getExpressPayView = getExpressPayView;
@@ -0,0 +1,19 @@
1
+ import { Amount } from '../../../../commonStateTypes/amount';
2
+ import { FetchStateAndError, ID } from '../../../../commonStateTypes/common';
3
+ import { ZeniDate } from '../../../../zeniDayJS';
4
+ import { BillPayConfig } from '../../billPay/billPayConfig/billPayConfigState';
5
+ import { FundingAccount } from '../../commonSetup/setupViewSelector';
6
+ export interface ExpressPayState extends FetchStateAndError {
7
+ expressPayId?: ID;
8
+ formLocalData?: ExpressPayFormLocalData;
9
+ expressPaySubmitStatus: FetchStateAndError;
10
+ }
11
+ export interface ExpressPayFormLocalData {
12
+ vendorId?: ID;
13
+ withdrawFrom?: FundingAccount;
14
+ paymentToAccountId?: ID;
15
+ paymentType?: BillPayConfig;
16
+ amount: Amount;
17
+ paymentDate: ZeniDate;
18
+ receiptFileId?: ID;
19
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zeniai/client-epic-state",
3
- "version": "4.14.77",
3
+ "version": "4.14.79",
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
  "types": "lib/index.d.ts",
@@ -25,7 +25,7 @@
25
25
  },
26
26
  "homepage": "https://github.com/zeni-ai/client-epic-state#readme",
27
27
  "devDependencies": {
28
- "@liveblocks/client": "^2.20.0",
28
+ "@liveblocks/client": "^2.22.1",
29
29
  "@trivago/prettier-plugin-sort-imports": "^5.2.2",
30
30
  "@types/chai": "^5.0.1",
31
31
  "@types/jest": "^29.5.14",