@zeniai/client-epic-state 4.15.41 → 4.15.43

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 (235) hide show
  1. package/README.md +1 -19
  2. package/lib/commonPayloadTypes/recommendationPayload.d.ts +0 -1
  3. package/lib/commonStateTypes/common.d.ts +1 -1
  4. package/lib/commonStateTypes/fiscalYearHelpers/getFYMonths.d.ts +2 -2
  5. package/lib/commonStateTypes/fiscalYearHelpers/getFYQuarterAndYear.d.ts +2 -2
  6. package/lib/commonStateTypes/timePeriod.d.ts +7 -7
  7. package/lib/commonStateTypes/timePeriod.js +2 -2
  8. package/lib/commonStateTypes/viewAndReport/agingReportStateTypes.d.ts +1 -1
  9. package/lib/commonStateTypes/viewAndReport/agingReportStateTypes.js +1 -1
  10. package/lib/commonStateTypes/viewAndReport/viewAndReport.d.ts +2 -2
  11. package/lib/commonStateTypes/viewAndReport/viewAndReport.js +0 -1
  12. package/lib/configureStore.js +1 -2
  13. package/lib/entity/account/accountSelector.d.ts +3 -3
  14. package/lib/entity/account/accountState.d.ts +1 -1
  15. package/lib/entity/account/pickAndMergeForecastAccountReport.d.ts +1 -1
  16. package/lib/entity/accountGroup/accountGroupSelector.d.ts +22 -22
  17. package/lib/entity/accountGroup/accountGroupState.d.ts +1 -1
  18. package/lib/entity/approvalRule/approvalRuleState.d.ts +2 -2
  19. package/lib/entity/billPay/billTransaction/billTransactionState.d.ts +4 -4
  20. package/lib/entity/chargeCard/chargeCard.d.ts +1 -1
  21. package/lib/entity/chargeCardTransaction/chargeCardTransaction.d.ts +1 -1
  22. package/lib/entity/class/classReducer.d.ts +4 -4
  23. package/lib/entity/class/classState.d.ts +1 -1
  24. package/lib/entity/company/companyReducer.js +1 -0
  25. package/lib/entity/customer/customerPayload.d.ts +1 -1
  26. package/lib/entity/customer/customerPayload.js +6 -16
  27. package/lib/entity/depositAccountTransaction/depositAccountTransaction.d.ts +1 -1
  28. package/lib/entity/entityApprovalStatus/entityApprovalStatusState.d.ts +2 -2
  29. package/lib/entity/file/fileState.d.ts +3 -3
  30. package/lib/entity/forecast/forecastState.d.ts +1 -1
  31. package/lib/entity/jeSchedules/jeSchedulesReducer.d.ts +2 -2
  32. package/lib/entity/jeSchedules/jeSchedulesTypes.d.ts +2 -2
  33. package/lib/entity/notification/types/notificationTypes.d.ts +2 -2
  34. package/lib/entity/sectionAccountsView/sectionAccountsView.d.ts +1 -1
  35. package/lib/entity/sectionClassesViewV2/sectionClassesView.d.ts +1 -1
  36. package/lib/entity/sectionClassesViewV2/sectionClassesViewReducer.d.ts +2 -2
  37. package/lib/entity/snackbar/snackbarTypes.d.ts +2 -2
  38. package/lib/entity/snackbar/snackbarTypes.js +0 -4
  39. package/lib/entity/task/taskState.d.ts +3 -3
  40. package/lib/entity/tenant/clearAllEpic.d.ts +2 -4
  41. package/lib/entity/tenant/clearAllEpic.js +0 -4
  42. package/lib/entity/tenant/tenantReducer.d.ts +2 -2
  43. package/lib/entity/tenant/tenantReducer.js +1 -0
  44. package/lib/entity/transaction/payloadTypes/customerTransactionPayload.d.ts +1 -1
  45. package/lib/entity/transaction/payloadTypes/customerTransactionPayload.js +2 -1
  46. package/lib/entity/transaction/payloadTypes/transactionPayload.d.ts +0 -2
  47. package/lib/entity/transaction/payloadTypes/transactionPayload.js +6 -9
  48. package/lib/entity/transaction/payloadTypes/vendorTransactionPayload.d.ts +1 -9
  49. package/lib/entity/transaction/payloadTypes/vendorTransactionPayload.js +2 -24
  50. package/lib/entity/transaction/stateTypes/attachment.d.ts +2 -2
  51. package/lib/entity/transaction/stateTypes/transaction.d.ts +1 -3
  52. package/lib/entity/transaction/stateTypes/transactionType.d.ts +1 -1
  53. package/lib/entity/transaction/stateTypes/transactionType.js +1 -1
  54. package/lib/entity/transaction/stateTypes/vendorTransaction.d.ts +0 -5
  55. package/lib/entity/transaction/stateTypes/vendorTransaction.js +1 -5
  56. package/lib/entity/transaction/toSupportedTransaction.js +1 -6
  57. package/lib/entity/transaction/transactionReducer.d.ts +0 -17
  58. package/lib/entity/transaction/transactionReducer.js +2 -47
  59. package/lib/entity/transaction/transactionSelector.d.ts +0 -2
  60. package/lib/entity/transaction/transactionSelector.js +0 -5
  61. package/lib/entity/transaction/transactionState.d.ts +4 -6
  62. package/lib/entity/vendorExpense/vendorExpenseReducer.js +1 -0
  63. package/lib/entity/vendorExpense/vendorExpenseSelector.d.ts +2 -2
  64. package/lib/epic.d.ts +1 -6
  65. package/lib/epic.js +1 -6
  66. package/lib/index.d.ts +12 -20
  67. package/lib/index.js +27 -56
  68. package/lib/init.d.ts +1 -2
  69. package/lib/init.js +2 -9
  70. package/lib/reducer.d.ts +1 -7
  71. package/lib/reducer.js +0 -6
  72. package/lib/view/accountList/accountListReducer.js +3 -1
  73. package/lib/view/accountMappingView/accountMappingReducer.js +1 -0
  74. package/lib/view/apAgingView/apAgingDetail/apAgingDetailReducer.js +2 -1
  75. package/lib/view/auditReportView/auditReportViewReducer.d.ts +2 -2
  76. package/lib/view/auditReportView/auditReportViewState.d.ts +2 -2
  77. package/lib/view/balanceSheet/balanceSheetReducer.js +6 -1
  78. package/lib/view/bankAccountView/bankAccountViewReducer.js +1 -0
  79. package/lib/view/billPayCard/billPayCardSelector.d.ts +2 -2
  80. package/lib/view/cardBalance/cardBalanceSelector.d.ts +3 -3
  81. package/lib/view/cashBalance/cashBalanceSelector.d.ts +3 -3
  82. package/lib/view/cashFlow/cashFlowReducer.js +4 -1
  83. package/lib/view/cashInCashOut/cashInCashOutSelector.d.ts +2 -2
  84. package/lib/view/cashPosition/cashPositionReducer.js +1 -0
  85. package/lib/view/cashPosition/cashPositionSelector.d.ts +2 -2
  86. package/lib/view/common/reportsHelpers.d.ts +1 -1
  87. package/lib/view/commonVendorView/transactionVendorView/epics/saveTransactionVendorEpic.js +0 -7
  88. package/lib/view/commonVendorView/vendorView/epics/fetchAndUpdateVendorRecommendationsEpic.js +3 -1
  89. package/lib/view/commonVendorView/vendorsTabVendorView/vendorsTabVendorViewReducer.d.ts +2 -2
  90. package/lib/view/companyTaskManagerView/companyTaskManagerViewReducer.d.ts +2 -2
  91. package/lib/view/companyView/companyViewReducer.d.ts +1 -1
  92. package/lib/view/companyView/companyViewReducer.js +10 -1
  93. package/lib/view/companyView/types/cockpitTypes.d.ts +3 -3
  94. package/lib/view/companyView/types/companyPassport/companyUsersLocalData.d.ts +1 -1
  95. package/lib/view/dashboard/dashboardEpic.js +2 -0
  96. package/lib/view/dashboard/dashboardReducer.d.ts +2 -2
  97. package/lib/view/expenseAutomationView/epics/common/fetchAllExpenseAutomationTabsEpic.d.ts +1 -2
  98. package/lib/view/expenseAutomationView/epics/common/fetchAllExpenseAutomationTabsEpic.js +10 -24
  99. package/lib/view/expenseAutomationView/epics/common/refreshExpenseAutomationCurrentTabEpic.d.ts +1 -2
  100. package/lib/view/expenseAutomationView/epics/common/refreshExpenseAutomationCurrentTabEpic.js +0 -14
  101. package/lib/view/expenseAutomationView/epics/transactionCategorization/updateTransactionCategorizationEpic.js +7 -30
  102. package/lib/view/expenseAutomationView/expenseAutomationViewReducer.d.ts +2 -2
  103. package/lib/view/expenseAutomationView/expenseAutomationViewReducer.js +5 -1
  104. package/lib/view/expenseAutomationView/expenseAutomationViewSelector.js +2 -17
  105. package/lib/view/expenseAutomationView/expenseAutomationViewState.d.ts +2 -2
  106. package/lib/view/expenseAutomationView/expenseAutomationViewState.js +1 -1
  107. package/lib/view/expenseAutomationView/helpers/saveTransactionHelper.js +42 -98
  108. package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.d.ts +1 -1
  109. package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.js +10 -86
  110. package/lib/view/expenseAutomationView/reducers/jeSchedulesViewReducer.d.ts +11 -11
  111. package/lib/view/expenseAutomationView/reducers/transactionsViewReducer.d.ts +1 -12
  112. package/lib/view/expenseAutomationView/reducers/transactionsViewReducer.js +7 -66
  113. package/lib/view/expenseAutomationView/selectorTypes/expenseAutomationViewSelectorTypes.d.ts +0 -2
  114. package/lib/view/expenseAutomationView/selectorTypes/expenseAutomationViewSelectorTypes.js +1 -1
  115. package/lib/view/expenseAutomationView/selectors/jeSchedulesViewSelector.js +2 -5
  116. package/lib/view/expenseAutomationView/types/fluxAnalysisViewState.d.ts +1 -1
  117. package/lib/view/expenseAutomationView/types/missingReceiptsViewState.d.ts +1 -1
  118. package/lib/view/expenseAutomationView/types/transactionsViewState.d.ts +2 -12
  119. package/lib/view/financeStatement/financeStatementReducer.d.ts +1 -1
  120. package/lib/view/financeStatement/financeStatementReducer.js +4 -1
  121. package/lib/view/globalMerchantView/globalMerchantViewReducer.d.ts +4 -4
  122. package/lib/view/netBurnOrIncome/netBurnOrIncomeReducer.js +10 -3
  123. package/lib/view/netBurnOrIncomeClassesView/netBurnOrIncomeClassesViewReducer.js +6 -1
  124. package/lib/view/netBurnOrIncomeStoryCard/netBurnOrIncomeStoryCardReducer.js +1 -0
  125. package/lib/view/netBurnOrIncomeStoryCard/netBurnOrIncomeStoryCardState.d.ts +1 -1
  126. package/lib/view/notificationView/notificationViewReducer.d.ts +8 -8
  127. package/lib/view/notificationView/notificationViewState.d.ts +2 -2
  128. package/lib/view/onboardingView/cockpitView/onboardingCockpitViewReducer.js +3 -0
  129. package/lib/view/onboardingView/customerView/onboardingCustomerViewReducer.d.ts +2 -2
  130. package/lib/view/opEx/opExForTimeFrameEpic.js +1 -1
  131. package/lib/view/opEx/opExReducer.js +14 -4
  132. package/lib/view/opExByVendor/opExByVendorReducer.js +3 -1
  133. package/lib/view/opExByVendor/opExByVendorState.d.ts +1 -1
  134. package/lib/view/opExClassesView/opExClassesViewReducer.js +6 -1
  135. package/lib/view/people/fetchPeopleEpic.js +3 -1
  136. package/lib/view/people/invitePeopleEpic.js +3 -1
  137. package/lib/view/people/inviteZeniPeopleEpic.js +3 -1
  138. package/lib/view/people/peopleReducer.js +1 -0
  139. package/lib/view/people/peopleSaveUpdatesEpic.js +1 -1
  140. package/lib/view/profitAndLoss/profitAndLossReducer.js +6 -1
  141. package/lib/view/profitAndLossClassesView/profitAndLossClassesViewReducer.js +6 -1
  142. package/lib/view/recommendation/recommendationReducer.js +4 -1
  143. package/lib/view/referralView/referralState.d.ts +1 -1
  144. package/lib/view/reimbursementCard/reimbursementCardSelector.d.ts +2 -2
  145. package/lib/view/reportUIOptions/reportUIOptionsReducer.d.ts +8 -8
  146. package/lib/view/reportUIOptions/updateReportUIOptionThisPeriodEpic.js +3 -1
  147. package/lib/view/revenue/revenueReducer.js +10 -3
  148. package/lib/view/revenueClassesView/revenueClassesViewReducer.js +6 -1
  149. package/lib/view/scheduleView/scheduleAccruedDetailView/LinkBillExpenseView/linkBillExpense.d.ts +1 -1
  150. package/lib/view/scheduleView/scheduleDetailView/scheduleDetailReducer.d.ts +4 -4
  151. package/lib/view/scheduleView/scheduleListView/scheduleListTypes.d.ts +2 -2
  152. package/lib/view/settingsView/settingsViewReducer.js +1 -0
  153. package/lib/view/settingsView/settingsViewState.d.ts +1 -1
  154. package/lib/view/spendManagement/billPay/billList/billListReducer.d.ts +1 -1
  155. package/lib/view/spendManagement/billPay/billList/billListReducer.js +1 -0
  156. package/lib/view/spendManagement/billPay/billList/billListState.d.ts +2 -2
  157. package/lib/view/spendManagement/billPay/billPayConfig/billPayConfigState.d.ts +1 -1
  158. package/lib/view/spendManagement/billPay/billPayConfig/billPayConfigState.js +6 -0
  159. package/lib/view/spendManagement/billPay/billsBulkActionView/billsBulkActionViewReducer.d.ts +2 -2
  160. package/lib/view/spendManagement/billPay/billsBulkActionView/epics/validateBillsBulkActionEpic.ts.js +3 -4
  161. package/lib/view/spendManagement/billPay/editBillView/epics/fetchBillAndInitializeLocalStoreEpic.js +3 -1
  162. package/lib/view/spendManagement/chargeCards/chargeCardDetail/chargeCardDetail.d.ts +2 -2
  163. package/lib/view/spendManagement/commonHistoryView/commonHistory.d.ts +1 -1
  164. package/lib/view/spendManagement/commonSetup/setupViewReducer.d.ts +7 -7
  165. package/lib/view/spendManagement/commonSetup/setupViewState.d.ts +1 -1
  166. package/lib/view/spendManagement/plaidAccount/epic/plaidConnection/establishPlaidConnectionEpic.js +3 -11
  167. package/lib/view/spendManagement/plaidAccount/plaidAccountViewReducer.d.ts +10 -11
  168. package/lib/view/spendManagement/plaidAccount/plaidAccountViewReducer.js +1 -3
  169. package/lib/view/spendManagement/plaidAccount/plaidAccountViewState.d.ts +1 -1
  170. package/lib/view/spendManagement/reimbursement/editRemiView/epics/fetchRecommendationsAndUpdateMerchantRecommendationsEpic.js +6 -2
  171. package/lib/view/spendManagement/reimbursement/editRemiView/epics/fetchRemiAndInitializeLocalStoreEpic.js +3 -1
  172. package/lib/view/spendManagement/reimbursement/remiListView/remiListReducer.d.ts +1 -1
  173. package/lib/view/spendManagement/reimbursement/remiListView/remiListReducer.js +1 -0
  174. package/lib/view/spendManagement/reimbursement/remiListView/remiListState.d.ts +4 -4
  175. package/lib/view/spendManagement/reimbursement/remisBulkActionView/remisBulkActionViewReducer.d.ts +2 -2
  176. package/lib/view/subscriptionView/subscriptionViewReducer.js +1 -0
  177. package/lib/view/subscriptionView/types/subscriptionTypes.js +1 -0
  178. package/lib/view/taskManager/taskListView/epics/dragNDropTasksEpic.js +3 -1
  179. package/lib/view/taskManager/taskListView/taskList.d.ts +3 -3
  180. package/lib/view/taskManager/taskListView/taskListSelector.d.ts +1 -1
  181. package/lib/view/tasksCard/fetchTasksCardEpic.js +2 -1
  182. package/lib/view/tasksCard/tasksCardSelector.d.ts +2 -2
  183. package/lib/view/tasksCard/tasksCardSelector.js +1 -1
  184. package/lib/view/topEx/topExSelector.d.ts +3 -3
  185. package/lib/view/transactionDetail/epics/saveTransactionHelper.js +52 -45
  186. package/lib/view/transactionDetail/epics/updateTransactionDetailEpic.js +4 -22
  187. package/lib/view/transactionDetail/transactionDetailLocalDataHelper.js +13 -66
  188. package/lib/view/transactionDetail/transactionDetailReducer.d.ts +4 -13
  189. package/lib/view/transactionDetail/transactionDetailReducer.js +21 -51
  190. package/lib/view/transactionDetail/transactionDetailState.d.ts +2 -3
  191. package/lib/view/transactionDetail/transactionDetailTypes.d.ts +0 -8
  192. package/lib/view/transactionList/transactionListByEntitySelector.js +2 -0
  193. package/lib/view/transactionList/transactionListReducer.js +6 -4
  194. package/lib/view/trendWithTransactions/trendWithTransactionsReducer.js +1 -0
  195. package/lib/view/userFinancialAccount/userFinancialAccountReducer.js +3 -1
  196. package/lib/view/vendorFiling1099/vendorFiling1099List/vendorFiling1099ListState.d.ts +1 -1
  197. package/lib/view/vendorReviewView/vendorFirstReviewView/vendorFirstReviewViewState.d.ts +1 -1
  198. package/lib/view/vendorReviewView/vendorGlobalReviewView/vendorGlobalReviewViewState.d.ts +1 -1
  199. package/lib/zeniAPI.d.ts +0 -1
  200. package/lib/zeniUrl.d.ts +1 -1
  201. package/package.json +12 -13
  202. package/lib/entity/accountRecon/accountReconPayload.d.ts +0 -70
  203. package/lib/entity/accountRecon/accountReconPayload.js +0 -125
  204. package/lib/entity/accountRecon/accountReconReducer.d.ts +0 -16
  205. package/lib/entity/accountRecon/accountReconReducer.js +0 -71
  206. package/lib/entity/accountRecon/accountReconSelector.d.ts +0 -28
  207. package/lib/entity/accountRecon/accountReconSelector.js +0 -44
  208. package/lib/entity/accountRecon/accountReconState.d.ts +0 -70
  209. package/lib/entity/accountRecon/accountReconState.js +0 -28
  210. package/lib/entity/transaction/payloadTypes/reconciliationTransactionPayloads.d.ts +0 -35
  211. package/lib/entity/transaction/payloadTypes/reconciliationTransactionPayloads.js +0 -53
  212. package/lib/entity/transaction/stateTypes/reconciliationTransaction.d.ts +0 -32
  213. package/lib/entity/transaction/stateTypes/reconciliationTransaction.js +0 -10
  214. package/lib/view/expenseAutomationView/epics/accountRecon/fetchReconciliationViewEpic.d.ts +0 -15
  215. package/lib/view/expenseAutomationView/epics/accountRecon/fetchReconciliationViewEpic.js +0 -118
  216. package/lib/view/expenseAutomationView/epics/accountRecon/initialiseLocalDataForSelectedAccountIdEpic.d.ts +0 -10
  217. package/lib/view/expenseAutomationView/epics/accountRecon/initialiseLocalDataForSelectedAccountIdEpic.js +0 -49
  218. package/lib/view/expenseAutomationView/epics/accountRecon/saveReconciliationDetailEpic.d.ts +0 -14
  219. package/lib/view/expenseAutomationView/epics/accountRecon/saveReconciliationDetailEpic.js +0 -169
  220. package/lib/view/expenseAutomationView/epics/accountRecon/saveReconciliationReviewEpic.d.ts +0 -9
  221. package/lib/view/expenseAutomationView/epics/accountRecon/saveReconciliationReviewEpic.js +0 -154
  222. package/lib/view/expenseAutomationView/epics/accountRecon/updateReconcileTabLocalDataEpic.d.ts +0 -6
  223. package/lib/view/expenseAutomationView/epics/accountRecon/updateReconcileTabLocalDataEpic.js +0 -110
  224. package/lib/view/expenseAutomationView/helpers/reconciliationHelpers.d.ts +0 -7
  225. package/lib/view/expenseAutomationView/helpers/reconciliationHelpers.js +0 -18
  226. package/lib/view/expenseAutomationView/payload/reconciliationPayload.d.ts +0 -28
  227. package/lib/view/expenseAutomationView/payload/reconciliationPayload.js +0 -51
  228. package/lib/view/expenseAutomationView/reducers/reconciliationViewReducer.d.ts +0 -66
  229. package/lib/view/expenseAutomationView/reducers/reconciliationViewReducer.js +0 -384
  230. package/lib/view/expenseAutomationView/selectorTypes/reconciliationViewSelectorTypes.d.ts +0 -51
  231. package/lib/view/expenseAutomationView/selectorTypes/reconciliationViewSelectorTypes.js +0 -7
  232. package/lib/view/expenseAutomationView/selectors/reconciliationViewSelector.d.ts +0 -5
  233. package/lib/view/expenseAutomationView/selectors/reconciliationViewSelector.js +0 -254
  234. package/lib/view/expenseAutomationView/types/reconciliationViewState.d.ts +0 -103
  235. package/lib/view/expenseAutomationView/types/reconciliationViewState.js +0 -37
@@ -35,7 +35,6 @@ export interface TransactionDetailLineItemData extends TransactionLineBase {
35
35
  recommendations?: Recommendation[];
36
36
  isCategoryMiscategorized: boolean;
37
37
  isClassMiscategorized: boolean;
38
- selectedEntityLine?: Entity;
39
38
  }
40
39
  export interface TransactionDetailLocalData {
41
40
  memo?: string;
@@ -45,13 +44,6 @@ export interface TransactionDetailLocalData {
45
44
  name: string;
46
45
  qboId: ID;
47
46
  };
48
- customerDetails?: {
49
- id: ID;
50
- name: string;
51
- qboId: ID;
52
- };
53
- selectedEntity?: Entity;
54
- customerUpdates?: TransactionVendorUpdates;
55
47
  vendorUpdates?: TransactionVendorUpdates;
56
48
  updatePreviousTransactionsWithUpdatedVendor?: boolean;
57
49
  isVendorUpdateAllChecked: boolean;
@@ -25,6 +25,7 @@ const getTransactionListByEntity = (transactionState, transactionListState, filt
25
25
  .filter((eTransaction) => eTransaction != null);
26
26
  const fetchState = (0, reduceTransactionListFetchState_1.reduceFetchState)(entityTransactions);
27
27
  let transactions = [];
28
+ // eslint-disable-next-line @typescript-eslint/strict-boolean-expressions
28
29
  if ((0, reduceTransactionListFetchState_1.isAnyFetchCompleted)(entityTransactions)) {
29
30
  const allTransactionIDs = (0, flatMap_1.default)(entityTransactions, (value) => value.transactionIDs);
30
31
  const transactionsUnsorted = allTransactionIDs
@@ -74,6 +75,7 @@ const getTransactionListByEntityForSinglePeriod = (state, entity, numberOfQuarte
74
75
  .filter((eTransaction) => eTransaction != null);
75
76
  const fetchState = (0, reduceTransactionListFetchState_1.reduceFetchState)(entityTransactions);
76
77
  let transactions = [];
78
+ // eslint-disable-next-line @typescript-eslint/strict-boolean-expressions
77
79
  if ((0, reduceTransactionListFetchState_1.isAnyFetchCompleted)(entityTransactions)) {
78
80
  const allTransactionIDs = (0, flatMap_1.default)(entityTransactions, (value) => value.transactionIDs);
79
81
  const transactionsUnsorted = allTransactionIDs
@@ -303,8 +303,9 @@ exports.default = transactionList.reducer;
303
303
  function doUpdateTransactionListByAccount(draft, payload) {
304
304
  const transactionIDs = payload.account.transactions.map((transactionPaylod) => transactionPaylod.transaction_id);
305
305
  const account = (0, accountPayload_1.mapAccountBasePayloadToAccountBase)(payload.account);
306
- const start = (0, timePeriod_1.toAbsoluteDay)(payload.query.start_date);
307
- const end = (0, timePeriod_1.toAbsoluteDay)(payload.query.end_date);
306
+ const start = (0, timePeriod_1.toAbsoluteDay)(payload.query.start_date); // eslint-disable-line @typescript-eslint/no-non-null-assertion
307
+ const end = (0, timePeriod_1.toAbsoluteDay)(payload.query.end_date); // eslint-disable-line @typescript-eslint/no-non-null-assertion
308
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
308
309
  const key = (0, transactionListState_1.getAcTranKey)(account.accountId, account.accountType, {
309
310
  start,
310
311
  end,
@@ -324,8 +325,9 @@ function doUpdateTransactionListByClass(draft, payload) {
324
325
  const transactionIDs = payload.account.transactions.map((transactionPaylod) => transactionPaylod.transaction_id);
325
326
  const account = (0, accountPayload_1.mapAccountBasePayloadToAccountBase)(payload.account);
326
327
  const classId = payload.query.accounting_class_id;
327
- const start = (0, timePeriod_1.toAbsoluteDay)(payload.query.start_date);
328
- const end = (0, timePeriod_1.toAbsoluteDay)(payload.query.end_date);
328
+ const start = (0, timePeriod_1.toAbsoluteDay)(payload.query.start_date); // eslint-disable-line @typescript-eslint/no-non-null-assertion
329
+ const end = (0, timePeriod_1.toAbsoluteDay)(payload.query.end_date); // eslint-disable-line @typescript-eslint/no-non-null-assertion
330
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
329
331
  const key = (0, transactionListState_1.getClassAcTranKey)(account.accountId, account.accountType, classId, {
330
332
  start,
331
333
  end,
@@ -48,6 +48,7 @@ const trendWithTransactions = (0, toolkit_1.createSlice)({
48
48
  },
49
49
  },
50
50
  clearTrendWithTransactions: {
51
+ // eslint-disable-next-line @typescript-eslint/no-inferrable-types
51
52
  prepare(keepUiState = true) {
52
53
  return { payload: { keepUiState } };
53
54
  },
@@ -11,7 +11,9 @@ const userFinancialAccount = (0, toolkit_1.createSlice)({
11
11
  initialState: exports.initialState,
12
12
  reducers: {
13
13
  fetchUserFinancialAccount: {
14
- reducer(draft, action) {
14
+ reducer(draft,
15
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
16
+ action) {
15
17
  const { userId } = action.payload;
16
18
  draft.financialAccountByUserId[userId] = {
17
19
  hasValidState() {
@@ -20,7 +20,7 @@ export interface VendorFiling1099ListQuery {
20
20
  sortOrder: SortOrder;
21
21
  sortKey: VendorFiling1099ListViewSortKey;
22
22
  }
23
- declare const toVendorFiling1099ListViewSortKey: (v: string) => "status" | "w9" | "legal_name" | "total" | "tax_classification" | "filing1099type";
23
+ declare const toVendorFiling1099ListViewSortKey: (v: string) => "total" | "status" | "w9" | "legal_name" | "tax_classification" | "filing1099type";
24
24
  export type VendorFiling1099ListViewSortKey = ReturnType<typeof toVendorFiling1099ListViewSortKey>;
25
25
  export type Type1099Download = 'nec' | 'misc' | 'int';
26
26
  export {};
@@ -12,7 +12,7 @@ export interface FirstReviewPageCurrentSelectionByColumn {
12
12
  rename: boolean;
13
13
  customMerchant: boolean;
14
14
  }
15
- export declare const toVendorFirstReviewViewColumnKeyType: (v: string) => "vendor" | "status" | "action" | "retain" | "updateTo" | "ytd" | "viewTenantInvoice";
15
+ export declare const toVendorFirstReviewViewColumnKeyType: (v: string) => "action" | "status" | "vendor" | "retain" | "updateTo" | "ytd" | "viewTenantInvoice";
16
16
  export type VendorFirstReviewViewColumnKey = ReturnType<typeof toVendorFirstReviewViewColumnKeyType>;
17
17
  export interface RecommendedNonExistingGlobalMerchant extends Omit<GlobalMerchant, 'globalMerchantId'> {
18
18
  globalMerchantId?: ID;
@@ -3,7 +3,7 @@ import { SortOrder } from '../../../commonStateTypes/selectorTypes/sortOrderType
3
3
  import { PageToken } from '../../../commonStateTypes/viewAndReport/viewAndReport';
4
4
  import { GlobalVendorReviewRowCurrentSelection } from '../common/state/commonTypes';
5
5
  import { RecommendedNonExistingGlobalMerchant } from '../vendorFirstReviewView/vendorFirstReviewViewState';
6
- export declare const toVendorGlobalReviewColumnSortKeyType: (v: string) => "tenants" | "recommended" | "originalVendor" | "requestedVendor";
6
+ export declare const toVendorGlobalReviewColumnSortKeyType: (v: string) => "tenants" | "originalVendor" | "recommended" | "requestedVendor";
7
7
  export type VendorGlobalReviewViewColumnSortKey = ReturnType<typeof toVendorGlobalReviewColumnSortKeyType>;
8
8
  export interface GlobalReviewPageCurrentSelectionByColumn {
9
9
  requested: boolean;
package/lib/zeniAPI.d.ts CHANGED
@@ -18,7 +18,6 @@ export interface RESTAPIEndpoints {
18
18
  readonly cardMicroServiceBaseUrl: string;
19
19
  readonly taskMicroServiceBaseUrl: string;
20
20
  readonly notificationMicroServiceBaseUrl: string;
21
- readonly reconciliationMicroServiceBaseUrl: string;
22
21
  }
23
22
  export interface ZeniAPI<ResponseType = FetchResponse> {
24
23
  readonly apiEndPoints: RESTAPIEndpoints;
package/lib/zeniUrl.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import parseUrl from 'url-parse';
2
- export declare function toZeniUrl(urlString: string, parseQueryString?: boolean): parseUrl<Record<string, string | undefined>> | parseUrl<string>;
2
+ export declare function toZeniUrl(urlString: string, parseQueryString?: boolean): parseUrl<string> | parseUrl<Record<string, string | undefined>>;
3
3
  export declare function toZeniUrlWithoutBaseURL(urlString: string): parseUrl<string>;
4
4
  type ZeniUrl = ReturnType<typeof toZeniUrl>;
5
5
  export { ZeniUrl };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zeniai/client-epic-state",
3
- "version": "4.15.41",
3
+ "version": "4.15.43",
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,29 +25,30 @@
25
25
  },
26
26
  "homepage": "https://github.com/zeni-ai/client-epic-state#readme",
27
27
  "devDependencies": {
28
- "@eslint/eslintrc": "^3.3.1",
29
- "@eslint/js": "^9.24.0",
30
28
  "@liveblocks/client": "^2.23.0",
31
29
  "@trivago/prettier-plugin-sort-imports": "^5.2.2",
30
+ "@types/chai": "^5.0.1",
31
+ "@types/jest": "^29.5.14",
32
32
  "@types/lodash": "^4.17.16",
33
33
  "@types/node": "^20.17.23",
34
34
  "@types/url-parse": "^1.4.11",
35
35
  "@typescript-eslint/eslint-plugin": "^8.26.0",
36
36
  "@typescript-eslint/parser": "^8.26.0",
37
- "c8": "^10.1.3",
37
+ "chai": "^4.5.0",
38
+ "chai-better-shallow-deep-equal": "^1.1.1",
38
39
  "concurrently": "^9.1.2",
39
- "eslint": "^9.24.0",
40
+ "eslint": "^8.57.1",
40
41
  "eslint-config-prettier": "^10.0.2",
41
42
  "eslint-plugin-prettier": "^5.2.3",
42
43
  "eslint-plugin-unused-imports": "^4.1.4",
43
- "globals": "^16.0.0",
44
+ "jest": "^29.7.0",
44
45
  "prettier": "^3.5.3",
45
46
  "prettier-plugin-import-sort": "^0.0.7",
46
47
  "rimraf": "^6.0.1",
48
+ "ts-jest": "^29.2.6",
47
49
  "ts-prune": "^0.10.3",
48
50
  "ts-unused-exports": "^11.0.1",
49
- "typescript": "^5.7.3",
50
- "vitest": "^3.1.2"
51
+ "typescript": "^5.7.3"
51
52
  },
52
53
  "dependencies": {
53
54
  "@redux-devtools/extension": "^3.3.0",
@@ -76,18 +77,16 @@
76
77
  "@babel/traverse": ">=7.23.2",
77
78
  "cross-spawn": ">=7.0.5",
78
79
  "@babel/runtime": ">=7.26.10",
79
- "@babel/helpers": ">=7.26.10",
80
- "minimatch": ">=10.0.1",
81
- "minimatch@3.1.2": "3.1.2"
80
+ "@babel/helpers": ">=7.26.10"
82
81
  },
83
82
  "scripts": {
84
83
  "clean": "rimraf lib",
85
- "test": "vitest run",
84
+ "test": "jest --config jest.config.json --detectOpenHandles",
86
85
  "lint": "eslint . --ext .js,.jsx,.ts,.tsx --fix",
87
86
  "find-dead-code": "ts-prune | grep -v '(used in module)'",
88
87
  "find-unused-exports": "ts-unused-exports ./tsconfig.json",
89
88
  "circular-dependency": "npx madge --circular --extensions ts ./src",
90
- "build": "concurrently --kill-others-on-fail \"eslint . --ext .js,.jsx,.ts,.tsx\" \"tsc\" \"vitest run\" && rimraf \"lib/**/__mocks__\" \"lib/**/__testHelpers__\"",
89
+ "build": "concurrently --kill-others-on-fail \"eslint . --ext .js,.jsx,.ts,.tsx\" \"tsc\" \"jest --config jest.config.json\" && rimraf \"lib/**/__mocks__\" \"lib/**/__testHelpers__\"",
91
90
  "only-build": "concurrently --kill-others-on-fail \"eslint . --ext .js,.jsx,.ts,.tsx\" \"tsc\" && rimraf \"lib/**/__mocks__\" \"lib/**/__testHelpers__\"",
92
91
  "format": "prettier --write --ignore-unknown \"src/**/*\"",
93
92
  "format-watch": "(git diff --name-only --diff-filter=ACM && git ls-files --others --exclude-standard) | grep -E '\\.(ts|tsx)$' | xargs prettier --write",
@@ -1,70 +0,0 @@
1
- import { StatusCodeWithLabelPayload } from '../../commonPayloadTypes/statusPayload';
2
- import { CurrencyPayload } from '../../commonPayloadTypes/v2/viewAndReportPayloadv2';
3
- import { ID } from '../../commonStateTypes/common';
4
- import { MatchedTransactionPayload } from '../transaction/payloadTypes/reconciliationTransactionPayloads';
5
- import { AccountReconciliationData, RecommendedReviewTransaction, TransactionsToReview } from './accountReconState';
6
- export interface ReconciliationDataPayload {
7
- reconciliation_id: string | null;
8
- account_id: ID;
9
- transactions: ReconcileReviewTransactionsPayload;
10
- bank_status: StatusCodeWithLabelPayload;
11
- currency: CurrencyPayload;
12
- start_date: string;
13
- end_date: string;
14
- reconciliation_status: StatusCodeWithLabelPayload | null;
15
- variance: number | null;
16
- bank_balance: number | null;
17
- cleared_balance: number | null;
18
- initial_cleared_balance: number | null;
19
- error_message: string | null;
20
- source: string | null;
21
- created_at: string | null;
22
- updated_at: string | null;
23
- payment_account_updated_at: string | null;
24
- user_id: ID | null;
25
- retry_count: number | null;
26
- }
27
- export interface RecommendedReviewTransactionPayload {
28
- transaction_date: string;
29
- amount: number;
30
- transaction_memo: string;
31
- confidence_score: number;
32
- recommendation_reasons: string[];
33
- transaction_id?: string | null;
34
- transaction_type?: string;
35
- account_id?: ID | null;
36
- account_name?: string | null;
37
- class_id?: ID | null;
38
- class_name?: string | null;
39
- merchant_id?: ID | null;
40
- merchant_name?: string | null;
41
- merchant_type?: string | null;
42
- book_transaction_id?: string | null;
43
- }
44
- interface RecommendedActionPayload {
45
- recommended_actions: string;
46
- recommended_action_description: string;
47
- recommended_transactions: RecommendedReviewTransactionPayload[];
48
- }
49
- export interface TransactionsToReviewPayload {
50
- amount: number;
51
- transaction_direction: string;
52
- transaction_memo: string;
53
- recommended_action: RecommendedActionPayload;
54
- status: string;
55
- transaction_date: string;
56
- transaction_id: string;
57
- merchant_id?: ID | null;
58
- merchant_name?: string | null;
59
- merchant_type?: string | null;
60
- }
61
- export interface ReconcileReviewTransactionsPayload {
62
- reconcile: MatchedTransactionPayload[];
63
- review: TransactionsToReviewPayload[];
64
- }
65
- export declare const toTransactionsToReview: (payload: TransactionsToReviewPayload, currencyPayload: CurrencyPayload) => TransactionsToReview;
66
- export declare const toTransactionsToReviewPayload: (payload: TransactionsToReview) => TransactionsToReviewPayload;
67
- export declare const toAccountReconciliationData: (payload: ReconciliationDataPayload) => AccountReconciliationData;
68
- export declare const toRecommendedReviewTransaction: (payload: RecommendedReviewTransactionPayload, currencyPayload: CurrencyPayload) => RecommendedReviewTransaction;
69
- export declare const toRecommendedReviewTransactionPayload: (payload: RecommendedReviewTransaction) => RecommendedReviewTransactionPayload;
70
- export {};
@@ -1,125 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.toRecommendedReviewTransactionPayload = exports.toRecommendedReviewTransaction = exports.toAccountReconciliationData = exports.toTransactionsToReviewPayload = exports.toTransactionsToReview = void 0;
4
- const amount_1 = require("../../commonStateTypes/amount");
5
- const formatZeniDateFY_1 = require("../../commonStateTypes/fiscalYearHelpers/formatZeniDateFY");
6
- const zeniDayJS_1 = require("../../zeniDayJS");
7
- const reconciliationTransaction_1 = require("../transaction/stateTypes/reconciliationTransaction");
8
- const accountReconState_1 = require("./accountReconState");
9
- const toTransactionsToReview = (payload, currencyPayload) => {
10
- var _a, _b;
11
- return {
12
- transactionId: payload.transaction_id,
13
- transactionDirection: (0, reconciliationTransaction_1.toTransactionDirectionType)(payload.transaction_direction),
14
- amount: {
15
- amount: payload.amount,
16
- currencyCode: currencyPayload.currency_code,
17
- currencySymbol: currencyPayload.currency_symbol,
18
- },
19
- status: payload.status,
20
- transactionDate: (0, zeniDayJS_1.date)(payload.transaction_date),
21
- memo: payload.transaction_memo,
22
- merchantId: (_a = payload.merchant_id) !== null && _a !== void 0 ? _a : undefined,
23
- merchantName: (_b = payload.merchant_name) !== null && _b !== void 0 ? _b : undefined,
24
- merchantType: payload.merchant_type != null
25
- ? (0, reconciliationTransaction_1.toMerchantType)(payload.merchant_type)
26
- : undefined,
27
- recommendedAction: {
28
- action: (0, accountReconState_1.toRecommendedActionCodeType)(payload.recommended_action.recommended_actions),
29
- reason: payload.recommended_action.recommended_action_description,
30
- recommendedTransactions: payload.recommended_action.recommended_transactions.map((transaction) => (0, exports.toRecommendedReviewTransaction)(transaction, currencyPayload)),
31
- },
32
- };
33
- };
34
- exports.toTransactionsToReview = toTransactionsToReview;
35
- const toTransactionsToReviewPayload = (payload) => {
36
- return {
37
- transaction_id: payload.transactionId,
38
- transaction_direction: (0, reconciliationTransaction_1.toTransactionDirectionType)(payload.transactionDirection),
39
- amount: payload.amount.amount,
40
- status: payload.status,
41
- transaction_date: payload.transactionDate.format(formatZeniDateFY_1.DEFAULT_DATE_FORMAT),
42
- transaction_memo: payload.memo,
43
- recommended_action: {
44
- recommended_actions: (0, accountReconState_1.toRecommendedActionCodeType)(payload.recommendedAction.action),
45
- recommended_action_description: payload.recommendedAction.reason,
46
- recommended_transactions: payload.recommendedAction.recommendedTransactions.map((transaction) => (0, exports.toRecommendedReviewTransactionPayload)(transaction)),
47
- },
48
- };
49
- };
50
- exports.toTransactionsToReviewPayload = toTransactionsToReviewPayload;
51
- const toAccountReconciliationData = (payload) => {
52
- var _a, _b;
53
- const variance = payload.bank_balance != null && payload.cleared_balance != null
54
- ? (0, amount_1.toAmount)(payload.cleared_balance - payload.bank_balance, payload.currency.currency_code, payload.currency.currency_symbol)
55
- : undefined;
56
- const variancePercentage = variance != null && payload.bank_balance != null
57
- ? (variance.amount / payload.bank_balance) * 100
58
- : undefined;
59
- return {
60
- reconciliationId: (_a = payload.reconciliation_id) !== null && _a !== void 0 ? _a : undefined,
61
- accountId: payload.account_id,
62
- reconciliationStatus: payload.reconciliation_status
63
- ? {
64
- code: (0, accountReconState_1.toReconciliationStatusCodeType)(payload.reconciliation_status.code),
65
- label: payload.reconciliation_status.label,
66
- }
67
- : undefined,
68
- currency: {
69
- currencyCode: payload.currency.currency_code,
70
- currencySymbol: payload.currency.currency_symbol,
71
- },
72
- transactionsToReview: payload.transactions.review.map((transaction) => (0, exports.toTransactionsToReview)(transaction, payload.currency)),
73
- transactionsToReconcile: payload.transactions.reconcile.map((transaction) => transaction.transaction_id),
74
- userId: (_b = payload.user_id) !== null && _b !== void 0 ? _b : undefined,
75
- variance: variance,
76
- variancePercentage: variancePercentage,
77
- bankBalance: payload.bank_balance != null
78
- ? (0, amount_1.toAmount)(payload.bank_balance, payload.currency.currency_code, payload.currency.currency_symbol)
79
- : undefined,
80
- clearedBalance: payload.cleared_balance != null
81
- ? (0, amount_1.toAmount)(payload.cleared_balance, payload.currency.currency_code, payload.currency.currency_symbol)
82
- : undefined,
83
- initialClearedBalance: payload.initial_cleared_balance != null
84
- ? (0, amount_1.toAmount)(payload.initial_cleared_balance, payload.currency.currency_code, payload.currency.currency_symbol)
85
- : undefined,
86
- startDate: (0, zeniDayJS_1.date)(payload.start_date),
87
- endDate: (0, zeniDayJS_1.date)(payload.end_date),
88
- accountUpdatedAt: payload.payment_account_updated_at != null
89
- ? (0, zeniDayJS_1.date)(payload.payment_account_updated_at)
90
- : undefined,
91
- };
92
- };
93
- exports.toAccountReconciliationData = toAccountReconciliationData;
94
- const toRecommendedReviewTransaction = (payload, currencyPayload) => {
95
- var _a, _b, _c, _d, _e, _f, _g;
96
- return {
97
- transactionId: (_a = payload.transaction_id) !== null && _a !== void 0 ? _a : undefined,
98
- merchantId: (_b = payload.merchant_id) !== null && _b !== void 0 ? _b : undefined,
99
- merchantName: (_c = payload.merchant_name) !== null && _c !== void 0 ? _c : undefined,
100
- merchantType: payload.merchant_type != null
101
- ? (0, reconciliationTransaction_1.toMerchantType)(payload.merchant_type)
102
- : undefined,
103
- classId: (_d = payload.class_id) !== null && _d !== void 0 ? _d : undefined,
104
- accountId: (_e = payload.account_id) !== null && _e !== void 0 ? _e : undefined,
105
- date: (0, zeniDayJS_1.date)(payload.transaction_date),
106
- amount: (0, amount_1.toAmount)(payload.amount, currencyPayload.currency_code, currencyPayload.currency_symbol),
107
- memo: (_f = payload.transaction_memo) !== null && _f !== void 0 ? _f : undefined,
108
- confidenceScore: payload.confidence_score,
109
- recommendedReasons: payload.recommendation_reasons,
110
- bookTransactionId: (_g = payload.book_transaction_id) !== null && _g !== void 0 ? _g : undefined,
111
- };
112
- };
113
- exports.toRecommendedReviewTransaction = toRecommendedReviewTransaction;
114
- const toRecommendedReviewTransactionPayload = (payload) => {
115
- return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ transaction_date: payload.date.format(formatZeniDateFY_1.DEFAULT_DATE_FORMAT), confidence_score: payload.confidenceScore, transaction_memo: payload.memo, recommendation_reasons: payload.recommendedReasons, amount: payload.amount.amount }, (payload.transactionId != null
116
- ? { transaction_id: payload.transactionId }
117
- : {})), (payload.merchantId != null ? { merchant_id: payload.merchantId } : {})), (payload.merchantName != null
118
- ? { merchant_name: payload.merchantName }
119
- : {})), (payload.merchantType != null
120
- ? { merchant_type: (0, reconciliationTransaction_1.toMerchantType)(payload.merchantType) }
121
- : {})), (payload.classId != null ? { class_id: payload.classId } : {})), (payload.accountId != null ? { account_id: payload.accountId } : {})), (payload.bookTransactionId != null
122
- ? { book_transaction_id: payload.bookTransactionId }
123
- : {}));
124
- };
125
- exports.toRecommendedReviewTransactionPayload = toRecommendedReviewTransactionPayload;
@@ -1,16 +0,0 @@
1
- import { MonthYearPeriod } from '../../commonStateTypes/timePeriod';
2
- import { ReconciliationDataPayload } from './accountReconPayload';
3
- import { AccountReconState } from './accountReconState';
4
- export declare const initialState: AccountReconState;
5
- export declare const updateAccountRecon: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[selectedPeriod: MonthYearPeriod, accountReconDataPayload: ReconciliationDataPayload[]], {
6
- selectedPeriod: MonthYearPeriod;
7
- accountReconDataPayload: ReconciliationDataPayload[];
8
- }, "accountRecon/updateAccountRecon", never, never>, excludeReconReviewTransaction: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[accountReconKey: string, excludedTransactionId: string], {
9
- accountReconKey: string;
10
- excludedTransactionId: string;
11
- }, "accountRecon/excludeReconReviewTransaction", never, never>, clearAllAccountRecon: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"accountRecon/clearAllAccountRecon">, addTransactionToReconcileList: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[accountReconKey: string, transactionId: string], {
12
- accountReconKey: string;
13
- transactionId: string;
14
- }, "accountRecon/addTransactionToReconcileList", never, never>;
15
- declare const _default: import("redux").Reducer<AccountReconState>;
16
- export default _default;
@@ -1,71 +0,0 @@
1
- "use strict";
2
- var _a;
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.addTransactionToReconcileList = exports.clearAllAccountRecon = exports.excludeReconReviewTransaction = exports.updateAccountRecon = exports.initialState = void 0;
5
- const toolkit_1 = require("@reduxjs/toolkit");
6
- const accountReconPayload_1 = require("./accountReconPayload");
7
- const accountReconState_1 = require("./accountReconState");
8
- exports.initialState = {
9
- accountReconByAccountReconKey: {},
10
- };
11
- const accountRecon = (0, toolkit_1.createSlice)({
12
- name: 'accountRecon',
13
- initialState: exports.initialState,
14
- reducers: {
15
- updateAccountRecon: {
16
- prepare(selectedPeriod, accountReconDataPayload) {
17
- return {
18
- payload: {
19
- selectedPeriod,
20
- accountReconDataPayload,
21
- },
22
- };
23
- },
24
- reducer(draft, action) {
25
- doUpdateAccountRecon(draft, action.payload.selectedPeriod, action.payload.accountReconDataPayload);
26
- },
27
- },
28
- excludeReconReviewTransaction: {
29
- prepare(accountReconKey, excludedTransactionId) {
30
- return {
31
- payload: {
32
- accountReconKey,
33
- excludedTransactionId,
34
- },
35
- };
36
- },
37
- reducer(draft, action) {
38
- const { accountReconKey, excludedTransactionId } = action.payload;
39
- draft.accountReconByAccountReconKey[accountReconKey] = Object.assign(Object.assign({}, draft.accountReconByAccountReconKey[accountReconKey]), { transactionsToReview: draft.accountReconByAccountReconKey[accountReconKey].transactionsToReview.filter((txn) => txn.transactionId !== excludedTransactionId) });
40
- },
41
- },
42
- addTransactionToReconcileList: {
43
- prepare(accountReconKey, transactionId) {
44
- return {
45
- payload: {
46
- accountReconKey,
47
- transactionId,
48
- },
49
- };
50
- },
51
- reducer(draft, action) {
52
- const { accountReconKey, transactionId } = action.payload;
53
- draft.accountReconByAccountReconKey[accountReconKey] = Object.assign(Object.assign({}, draft.accountReconByAccountReconKey[accountReconKey]), { transactionsToReconcile: [
54
- ...draft.accountReconByAccountReconKey[accountReconKey]
55
- .transactionsToReconcile,
56
- transactionId,
57
- ] });
58
- },
59
- },
60
- clearAllAccountRecon(draft) {
61
- Object.assign(draft, exports.initialState);
62
- },
63
- },
64
- });
65
- _a = accountRecon.actions, exports.updateAccountRecon = _a.updateAccountRecon, exports.excludeReconReviewTransaction = _a.excludeReconReviewTransaction, exports.clearAllAccountRecon = _a.clearAllAccountRecon, exports.addTransactionToReconcileList = _a.addTransactionToReconcileList;
66
- exports.default = accountRecon.reducer;
67
- const doUpdateAccountRecon = (draft, selectedPeriod, accountReconDataPayload) => {
68
- accountReconDataPayload.forEach((accountReconData) => {
69
- draft.accountReconByAccountReconKey[(0, accountReconState_1.toAccountReconKey)(accountReconData.account_id, selectedPeriod)] = (0, accountReconPayload_1.toAccountReconciliationData)(accountReconData);
70
- });
71
- };
@@ -1,28 +0,0 @@
1
- import { Amount, Currency } from '../../commonStateTypes/amount';
2
- import { ID } from '../../commonStateTypes/common';
3
- import { MonthYearPeriod } from '../../commonStateTypes/timePeriod';
4
- import { RootState } from '../../reducer';
5
- import { ZeniDate } from '../../zeniDayJS';
6
- import { AccountBase } from '../account/accountState';
7
- import { MatchedTransaction } from '../transaction/stateTypes/reconciliationTransaction';
8
- import { User } from '../user/userState';
9
- import { ReconciliationStatusCodeType, TransactionsToReview } from './accountReconState';
10
- export interface AccountReconciliationEntity {
11
- account: AccountBase;
12
- transactionsToReview: TransactionsToReview[];
13
- transactionsToReconcile: MatchedTransaction[];
14
- currency: Currency;
15
- reconciliationId?: ID;
16
- user?: User;
17
- balance?: Amount;
18
- clearedBalance?: Amount;
19
- initialClearedBalance?: Amount;
20
- variance?: Amount;
21
- variancePercentage?: number;
22
- reconciliationStatus?: {
23
- code: ReconciliationStatusCodeType;
24
- label: string;
25
- };
26
- accountUpdatedAt?: ZeniDate;
27
- }
28
- export declare const getAccountReconByAccountIdAndSelectedPeriod: (state: RootState, accountId: ID, selectedPeriod: MonthYearPeriod) => AccountReconciliationEntity | undefined;
@@ -1,44 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getAccountReconByAccountIdAndSelectedPeriod = void 0;
4
- const toolkit_1 = require("@reduxjs/toolkit");
5
- const accountSelector_1 = require("../account/accountSelector");
6
- const transactionSelector_1 = require("../transaction/transactionSelector");
7
- const userSelector_1 = require("../user/userSelector");
8
- const accountReconState_1 = require("./accountReconState");
9
- exports.getAccountReconByAccountIdAndSelectedPeriod = (0, toolkit_1.createSelector)((state) => state.accountState, (state) => state.userState, (state) => state.transactionState, (state) => state.accountReconState, (_state, accountId) => accountId, (_state, _accountId, selectedPeriod) => selectedPeriod, (accountState, userState, transactionState, accountReconState, accountId, selectedPeriod) => {
10
- const accountReconKey = (0, accountReconState_1.toAccountReconKey)(accountId, selectedPeriod);
11
- const accountRecon = accountReconState.accountReconByAccountReconKey[accountReconKey];
12
- if (accountRecon == null) {
13
- return undefined;
14
- }
15
- const account = (0, accountSelector_1.getAccountBase)(accountState, accountRecon.accountId, 'account_reconciliation');
16
- if (!account) {
17
- throw new Error(`Account not found for: ${accountRecon.accountId}`);
18
- }
19
- const user = accountRecon.userId != null
20
- ? (0, userSelector_1.getUserByUserId)(userState, accountRecon.userId)
21
- : undefined;
22
- const transactionsToReconcile = accountRecon.transactionsToReconcile.map((transactionId) => {
23
- const matchedTransaction = (0, transactionSelector_1.getMatchedTransactionById)(transactionState, transactionId);
24
- if (!matchedTransaction) {
25
- throw new Error(`Transaction not found for: ${transactionId}`);
26
- }
27
- return matchedTransaction;
28
- });
29
- return {
30
- account,
31
- currency: accountRecon.currency,
32
- balance: accountRecon.bankBalance,
33
- variance: accountRecon.variance,
34
- clearedBalance: accountRecon.clearedBalance,
35
- initialClearedBalance: accountRecon.initialClearedBalance,
36
- reconciliationId: accountRecon.reconciliationId,
37
- user,
38
- transactionsToReview: accountRecon.transactionsToReview,
39
- transactionsToReconcile,
40
- reconciliationStatus: accountRecon.reconciliationStatus,
41
- variancePercentage: accountRecon.variancePercentage,
42
- accountUpdatedAt: accountRecon.accountUpdatedAt,
43
- };
44
- });
@@ -1,70 +0,0 @@
1
- import { Amount, Currency } from '../../commonStateTypes/amount';
2
- import { ID } from '../../commonStateTypes/common';
3
- import { MonthYearPeriod } from '../../commonStateTypes/timePeriod';
4
- import { ZeniDate } from '../../zeniDayJS';
5
- import { MerchantType, TransactionDirectionType } from '../transaction/stateTypes/reconciliationTransaction';
6
- import { TransactionType } from '../transaction/stateTypes/transactionType';
7
- export declare const toRecommendedActionCodeType: (v: string) => "record_expense" | "record_deposit" | "record_transfer" | "record_bill_payment" | "record_cc_payment" | "record_cc_credit";
8
- export type RecommendedActionCodeType = ReturnType<typeof toRecommendedActionCodeType>;
9
- export declare const toReconciliationStatusCodeType: (v: string) => "failed" | "completed" | "pending" | "in_progress";
10
- export type ReconciliationStatusCodeType = ReturnType<typeof toReconciliationStatusCodeType>;
11
- export declare const toBankStatusCodeType: (v: string) => "connected" | "not_connected" | "reconnect";
12
- export type BankStatusCodeType = ReturnType<typeof toBankStatusCodeType>;
13
- export declare const toAccountReconKey: (accountId: ID, selectedPeriod: MonthYearPeriod) => string;
14
- export type AccountReconKey = ReturnType<typeof toAccountReconKey>;
15
- export interface AccountReconState {
16
- accountReconByAccountReconKey: Record<AccountReconKey, AccountReconciliationData>;
17
- }
18
- export interface AccountReconciliationData {
19
- accountId: ID;
20
- startDate: ZeniDate;
21
- endDate: ZeniDate;
22
- transactionsToReview: TransactionsToReview[];
23
- transactionsToReconcile: ID[];
24
- currency: Currency;
25
- reconciliationId?: ID;
26
- variance?: Amount;
27
- variancePercentage?: number;
28
- bankBalance?: Amount;
29
- clearedBalance?: Amount;
30
- initialClearedBalance?: Amount;
31
- userId?: ID;
32
- reconciliationStatus?: {
33
- code: ReconciliationStatusCodeType;
34
- label: string;
35
- };
36
- accountUpdatedAt?: ZeniDate;
37
- }
38
- export interface TransactionsToReview {
39
- transactionId: ID;
40
- amount: Amount;
41
- status: string;
42
- transactionDate: ZeniDate;
43
- memo: string;
44
- transactionDirection: TransactionDirectionType;
45
- recommendedAction: RecommendedAction;
46
- merchantId?: ID;
47
- merchantName?: string;
48
- merchantType?: MerchantType;
49
- }
50
- export interface RecommendedAction {
51
- action: RecommendedActionCodeType;
52
- reason: string;
53
- recommendedTransactions: RecommendedReviewTransaction[];
54
- }
55
- export interface RecommendedReviewTransaction {
56
- confidenceScore: number;
57
- recommendedReasons: string[];
58
- date: ZeniDate;
59
- memo: string;
60
- amount: Amount;
61
- transactionId?: ID;
62
- bookTransactionId?: ID;
63
- transactionType?: TransactionType;
64
- typeName?: string;
65
- accountId?: ID;
66
- merchantId?: ID;
67
- merchantName?: string;
68
- merchantType?: MerchantType;
69
- classId?: ID;
70
- }