@zeniai/client-epic-state 4.15.52 → 4.15.54

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 (240) 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 +9 -18
  44. package/lib/entity/tenant/tenantSelector.d.ts +0 -2
  45. package/lib/entity/tenant/tenantSelector.js +0 -6
  46. package/lib/entity/tenant/tenantState.d.ts +0 -3
  47. package/lib/entity/transaction/payloadTypes/customerTransactionPayload.d.ts +1 -1
  48. package/lib/entity/transaction/payloadTypes/customerTransactionPayload.js +2 -1
  49. package/lib/entity/transaction/payloadTypes/transactionPayload.d.ts +0 -2
  50. package/lib/entity/transaction/payloadTypes/transactionPayload.js +6 -9
  51. package/lib/entity/transaction/payloadTypes/vendorTransactionPayload.d.ts +1 -9
  52. package/lib/entity/transaction/payloadTypes/vendorTransactionPayload.js +2 -24
  53. package/lib/entity/transaction/stateTypes/attachment.d.ts +2 -2
  54. package/lib/entity/transaction/stateTypes/transaction.d.ts +1 -3
  55. package/lib/entity/transaction/stateTypes/transactionType.d.ts +1 -1
  56. package/lib/entity/transaction/stateTypes/transactionType.js +1 -1
  57. package/lib/entity/transaction/stateTypes/vendorTransaction.d.ts +0 -5
  58. package/lib/entity/transaction/stateTypes/vendorTransaction.js +1 -5
  59. package/lib/entity/transaction/toSupportedTransaction.js +1 -6
  60. package/lib/entity/transaction/transactionReducer.d.ts +0 -17
  61. package/lib/entity/transaction/transactionReducer.js +2 -47
  62. package/lib/entity/transaction/transactionSelector.d.ts +0 -2
  63. package/lib/entity/transaction/transactionSelector.js +0 -5
  64. package/lib/entity/transaction/transactionState.d.ts +4 -6
  65. package/lib/entity/vendorExpense/vendorExpenseReducer.js +1 -0
  66. package/lib/entity/vendorExpense/vendorExpenseSelector.d.ts +2 -2
  67. package/lib/epic.d.ts +1 -6
  68. package/lib/epic.js +1 -6
  69. package/lib/index.d.ts +14 -22
  70. package/lib/index.js +27 -57
  71. package/lib/init.d.ts +1 -2
  72. package/lib/init.js +2 -9
  73. package/lib/reducer.d.ts +1 -7
  74. package/lib/reducer.js +0 -6
  75. package/lib/responsePayload.d.ts +0 -2
  76. package/lib/responsePayload.js +1 -9
  77. package/lib/view/accountList/accountListReducer.js +3 -1
  78. package/lib/view/accountMappingView/accountMappingReducer.js +1 -0
  79. package/lib/view/apAgingView/apAgingDetail/apAgingDetailReducer.js +2 -1
  80. package/lib/view/auditReportView/auditReportViewReducer.d.ts +2 -2
  81. package/lib/view/auditReportView/auditReportViewState.d.ts +2 -2
  82. package/lib/view/balanceSheet/balanceSheetReducer.js +6 -1
  83. package/lib/view/bankAccountView/bankAccountViewReducer.js +1 -0
  84. package/lib/view/billPayCard/billPayCardSelector.d.ts +2 -2
  85. package/lib/view/cardBalance/cardBalanceSelector.d.ts +3 -3
  86. package/lib/view/cashBalance/cashBalanceSelector.d.ts +3 -3
  87. package/lib/view/cashFlow/cashFlowReducer.js +4 -1
  88. package/lib/view/cashInCashOut/cashInCashOutSelector.d.ts +2 -2
  89. package/lib/view/cashPosition/cashPositionReducer.js +1 -0
  90. package/lib/view/cashPosition/cashPositionSelector.d.ts +2 -2
  91. package/lib/view/common/reportsHelpers.d.ts +1 -1
  92. package/lib/view/commonVendorView/transactionVendorView/epics/saveTransactionVendorEpic.js +2 -20
  93. package/lib/view/commonVendorView/vendorView/epics/fetchAndUpdateVendorRecommendationsEpic.js +3 -1
  94. package/lib/view/commonVendorView/vendorsTabVendorView/vendorsTabVendorViewReducer.d.ts +2 -2
  95. package/lib/view/companyTaskManagerView/companyTaskManagerViewReducer.d.ts +2 -2
  96. package/lib/view/companyView/companyViewReducer.d.ts +1 -1
  97. package/lib/view/companyView/companyViewReducer.js +10 -1
  98. package/lib/view/companyView/types/cockpitTypes.d.ts +3 -3
  99. package/lib/view/companyView/types/companyPassport/companyUsersLocalData.d.ts +1 -1
  100. package/lib/view/dashboard/dashboardEpic.js +2 -0
  101. package/lib/view/dashboard/dashboardReducer.d.ts +2 -2
  102. package/lib/view/expenseAutomationView/epics/common/fetchAllExpenseAutomationTabsEpic.d.ts +1 -2
  103. package/lib/view/expenseAutomationView/epics/common/fetchAllExpenseAutomationTabsEpic.js +10 -24
  104. package/lib/view/expenseAutomationView/epics/common/refreshExpenseAutomationCurrentTabEpic.d.ts +1 -2
  105. package/lib/view/expenseAutomationView/epics/common/refreshExpenseAutomationCurrentTabEpic.js +0 -14
  106. package/lib/view/expenseAutomationView/epics/transactionCategorization/updateTransactionCategorizationEpic.js +7 -30
  107. package/lib/view/expenseAutomationView/expenseAutomationViewReducer.d.ts +2 -2
  108. package/lib/view/expenseAutomationView/expenseAutomationViewReducer.js +5 -1
  109. package/lib/view/expenseAutomationView/expenseAutomationViewSelector.js +2 -17
  110. package/lib/view/expenseAutomationView/expenseAutomationViewState.d.ts +2 -2
  111. package/lib/view/expenseAutomationView/expenseAutomationViewState.js +1 -1
  112. package/lib/view/expenseAutomationView/helpers/saveTransactionHelper.js +53 -53
  113. package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.d.ts +1 -1
  114. package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.js +10 -86
  115. package/lib/view/expenseAutomationView/reducers/jeSchedulesViewReducer.d.ts +11 -11
  116. package/lib/view/expenseAutomationView/reducers/transactionsViewReducer.d.ts +1 -12
  117. package/lib/view/expenseAutomationView/reducers/transactionsViewReducer.js +7 -66
  118. package/lib/view/expenseAutomationView/selectorTypes/expenseAutomationViewSelectorTypes.d.ts +0 -2
  119. package/lib/view/expenseAutomationView/selectorTypes/expenseAutomationViewSelectorTypes.js +1 -1
  120. package/lib/view/expenseAutomationView/selectors/jeSchedulesViewSelector.js +2 -5
  121. package/lib/view/expenseAutomationView/types/fluxAnalysisViewState.d.ts +1 -1
  122. package/lib/view/expenseAutomationView/types/missingReceiptsViewState.d.ts +1 -1
  123. package/lib/view/expenseAutomationView/types/transactionsViewState.d.ts +2 -12
  124. package/lib/view/financeStatement/financeStatementReducer.d.ts +1 -1
  125. package/lib/view/financeStatement/financeStatementReducer.js +4 -1
  126. package/lib/view/globalMerchantView/globalMerchantViewReducer.d.ts +4 -4
  127. package/lib/view/netBurnOrIncome/netBurnOrIncomeReducer.js +10 -3
  128. package/lib/view/netBurnOrIncomeClassesView/netBurnOrIncomeClassesViewReducer.js +6 -1
  129. package/lib/view/netBurnOrIncomeStoryCard/netBurnOrIncomeStoryCardReducer.js +1 -0
  130. package/lib/view/netBurnOrIncomeStoryCard/netBurnOrIncomeStoryCardState.d.ts +1 -1
  131. package/lib/view/notificationView/notificationViewReducer.d.ts +8 -8
  132. package/lib/view/notificationView/notificationViewState.d.ts +2 -2
  133. package/lib/view/onboardingView/cockpitView/onboardingCockpitViewReducer.js +3 -0
  134. package/lib/view/onboardingView/customerView/onboardingCustomerViewReducer.d.ts +2 -2
  135. package/lib/view/opEx/opExForTimeFrameEpic.js +1 -1
  136. package/lib/view/opEx/opExReducer.js +14 -4
  137. package/lib/view/opExByVendor/opExByVendorReducer.js +3 -1
  138. package/lib/view/opExByVendor/opExByVendorState.d.ts +1 -1
  139. package/lib/view/opExClassesView/opExClassesViewReducer.js +6 -1
  140. package/lib/view/people/fetchPeopleEpic.js +3 -1
  141. package/lib/view/people/invitePeopleEpic.js +3 -1
  142. package/lib/view/people/inviteZeniPeopleEpic.js +3 -1
  143. package/lib/view/people/peopleReducer.js +1 -0
  144. package/lib/view/people/peopleSaveUpdatesEpic.js +1 -1
  145. package/lib/view/profitAndLoss/profitAndLossReducer.js +6 -1
  146. package/lib/view/profitAndLossClassesView/profitAndLossClassesViewReducer.js +6 -1
  147. package/lib/view/recommendation/recommendationReducer.js +4 -1
  148. package/lib/view/referralView/referralState.d.ts +1 -1
  149. package/lib/view/reimbursementCard/reimbursementCardSelector.d.ts +2 -2
  150. package/lib/view/reportUIOptions/reportUIOptionsReducer.d.ts +8 -8
  151. package/lib/view/reportUIOptions/updateReportUIOptionThisPeriodEpic.js +3 -1
  152. package/lib/view/revenue/revenueReducer.js +10 -3
  153. package/lib/view/revenueClassesView/revenueClassesViewReducer.js +6 -1
  154. package/lib/view/scheduleView/scheduleAccruedDetailView/LinkBillExpenseView/linkBillExpense.d.ts +1 -1
  155. package/lib/view/scheduleView/scheduleDetailView/scheduleDetailReducer.d.ts +4 -4
  156. package/lib/view/scheduleView/scheduleListView/scheduleListTypes.d.ts +2 -2
  157. package/lib/view/settingsView/settingsViewReducer.js +1 -0
  158. package/lib/view/settingsView/settingsViewState.d.ts +1 -1
  159. package/lib/view/spendManagement/billPay/billList/billListReducer.d.ts +1 -1
  160. package/lib/view/spendManagement/billPay/billList/billListReducer.js +1 -0
  161. package/lib/view/spendManagement/billPay/billList/billListState.d.ts +2 -2
  162. package/lib/view/spendManagement/billPay/billPayConfig/billPayConfigState.d.ts +1 -1
  163. package/lib/view/spendManagement/billPay/billPayConfig/billPayConfigState.js +6 -0
  164. package/lib/view/spendManagement/billPay/billsBulkActionView/billsBulkActionViewReducer.d.ts +2 -2
  165. package/lib/view/spendManagement/billPay/billsBulkActionView/epics/validateBillsBulkActionEpic.ts.js +3 -4
  166. package/lib/view/spendManagement/billPay/editBillView/epics/fetchBillAndInitializeLocalStoreEpic.js +3 -1
  167. package/lib/view/spendManagement/chargeCards/chargeCardDetail/chargeCardDetail.d.ts +2 -2
  168. package/lib/view/spendManagement/commonHistoryView/commonHistory.d.ts +1 -1
  169. package/lib/view/spendManagement/commonSetup/setupViewReducer.d.ts +7 -7
  170. package/lib/view/spendManagement/commonSetup/setupViewState.d.ts +1 -1
  171. package/lib/view/spendManagement/plaidAccount/epic/plaidConnection/establishPlaidConnectionEpic.js +3 -11
  172. package/lib/view/spendManagement/plaidAccount/plaidAccountViewReducer.d.ts +10 -11
  173. package/lib/view/spendManagement/plaidAccount/plaidAccountViewReducer.js +1 -3
  174. package/lib/view/spendManagement/plaidAccount/plaidAccountViewState.d.ts +1 -1
  175. package/lib/view/spendManagement/reimbursement/editRemiView/epics/fetchRecommendationsAndUpdateMerchantRecommendationsEpic.js +6 -2
  176. package/lib/view/spendManagement/reimbursement/editRemiView/epics/fetchRemiAndInitializeLocalStoreEpic.js +3 -1
  177. package/lib/view/spendManagement/reimbursement/remiListView/remiListReducer.d.ts +1 -1
  178. package/lib/view/spendManagement/reimbursement/remiListView/remiListReducer.js +1 -0
  179. package/lib/view/spendManagement/reimbursement/remiListView/remiListState.d.ts +4 -4
  180. package/lib/view/spendManagement/reimbursement/remisBulkActionView/remisBulkActionViewReducer.d.ts +2 -2
  181. package/lib/view/subscriptionView/subscriptionViewReducer.js +1 -0
  182. package/lib/view/subscriptionView/types/subscriptionTypes.js +1 -0
  183. package/lib/view/taskManager/taskListView/epics/dragNDropTasksEpic.js +3 -1
  184. package/lib/view/taskManager/taskListView/taskList.d.ts +3 -3
  185. package/lib/view/taskManager/taskListView/taskListSelector.d.ts +1 -1
  186. package/lib/view/tasksCard/fetchTasksCardEpic.js +2 -1
  187. package/lib/view/tasksCard/tasksCardSelector.d.ts +2 -2
  188. package/lib/view/tasksCard/tasksCardSelector.js +1 -1
  189. package/lib/view/topEx/topExSelector.d.ts +3 -3
  190. package/lib/view/transactionDetail/epics/saveTransactionHelper.js +59 -34
  191. package/lib/view/transactionDetail/epics/updateTransactionDetailEpic.js +4 -22
  192. package/lib/view/transactionDetail/transactionDetailLocalDataHelper.js +13 -66
  193. package/lib/view/transactionDetail/transactionDetailReducer.d.ts +4 -13
  194. package/lib/view/transactionDetail/transactionDetailReducer.js +21 -51
  195. package/lib/view/transactionDetail/transactionDetailState.d.ts +2 -3
  196. package/lib/view/transactionDetail/transactionDetailTypes.d.ts +0 -8
  197. package/lib/view/transactionList/transactionListByEntitySelector.js +2 -0
  198. package/lib/view/transactionList/transactionListReducer.js +6 -4
  199. package/lib/view/trendWithTransactions/trendWithTransactionsReducer.js +1 -0
  200. package/lib/view/userFinancialAccount/userFinancialAccountReducer.js +3 -1
  201. package/lib/view/vendorFiling1099/vendorFiling1099List/vendorFiling1099ListState.d.ts +1 -1
  202. package/lib/view/vendorReviewView/vendorFirstReviewView/vendorFirstReviewViewState.d.ts +1 -1
  203. package/lib/view/vendorReviewView/vendorGlobalReviewView/vendorGlobalReviewViewState.d.ts +1 -1
  204. package/lib/zeniAPI.d.ts +0 -1
  205. package/lib/zeniUrl.d.ts +1 -1
  206. package/package.json +13 -14
  207. package/lib/entity/accountRecon/accountReconPayload.d.ts +0 -71
  208. package/lib/entity/accountRecon/accountReconPayload.js +0 -131
  209. package/lib/entity/accountRecon/accountReconReducer.d.ts +0 -16
  210. package/lib/entity/accountRecon/accountReconReducer.js +0 -71
  211. package/lib/entity/accountRecon/accountReconSelector.d.ts +0 -34
  212. package/lib/entity/accountRecon/accountReconSelector.js +0 -47
  213. package/lib/entity/accountRecon/accountReconState.d.ts +0 -76
  214. package/lib/entity/accountRecon/accountReconState.js +0 -35
  215. package/lib/entity/transaction/payloadTypes/reconciliationTransactionPayloads.d.ts +0 -35
  216. package/lib/entity/transaction/payloadTypes/reconciliationTransactionPayloads.js +0 -53
  217. package/lib/entity/transaction/stateTypes/reconciliationTransaction.d.ts +0 -32
  218. package/lib/entity/transaction/stateTypes/reconciliationTransaction.js +0 -10
  219. package/lib/view/expenseAutomationView/epics/accountRecon/fetchReconciliationViewEpic.d.ts +0 -15
  220. package/lib/view/expenseAutomationView/epics/accountRecon/fetchReconciliationViewEpic.js +0 -118
  221. package/lib/view/expenseAutomationView/epics/accountRecon/initialiseLocalDataForSelectedAccountIdEpic.d.ts +0 -10
  222. package/lib/view/expenseAutomationView/epics/accountRecon/initialiseLocalDataForSelectedAccountIdEpic.js +0 -49
  223. package/lib/view/expenseAutomationView/epics/accountRecon/saveReconciliationDetailEpic.d.ts +0 -14
  224. package/lib/view/expenseAutomationView/epics/accountRecon/saveReconciliationDetailEpic.js +0 -178
  225. package/lib/view/expenseAutomationView/epics/accountRecon/saveReconciliationReviewEpic.d.ts +0 -9
  226. package/lib/view/expenseAutomationView/epics/accountRecon/saveReconciliationReviewEpic.js +0 -154
  227. package/lib/view/expenseAutomationView/epics/accountRecon/updateReconcileTabLocalDataEpic.d.ts +0 -6
  228. package/lib/view/expenseAutomationView/epics/accountRecon/updateReconcileTabLocalDataEpic.js +0 -110
  229. package/lib/view/expenseAutomationView/helpers/reconciliationHelpers.d.ts +0 -7
  230. package/lib/view/expenseAutomationView/helpers/reconciliationHelpers.js +0 -18
  231. package/lib/view/expenseAutomationView/payload/reconciliationPayload.d.ts +0 -28
  232. package/lib/view/expenseAutomationView/payload/reconciliationPayload.js +0 -51
  233. package/lib/view/expenseAutomationView/reducers/reconciliationViewReducer.d.ts +0 -66
  234. package/lib/view/expenseAutomationView/reducers/reconciliationViewReducer.js +0 -384
  235. package/lib/view/expenseAutomationView/selectorTypes/reconciliationViewSelectorTypes.d.ts +0 -53
  236. package/lib/view/expenseAutomationView/selectorTypes/reconciliationViewSelectorTypes.js +0 -7
  237. package/lib/view/expenseAutomationView/selectors/reconciliationViewSelector.d.ts +0 -5
  238. package/lib/view/expenseAutomationView/selectors/reconciliationViewSelector.js +0 -278
  239. package/lib/view/expenseAutomationView/types/reconciliationViewState.d.ts +0 -103
  240. package/lib/view/expenseAutomationView/types/reconciliationViewState.js +0 -37
@@ -1,76 +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 toBalanceDataStatusCodeType: (v: string) => "completed" | "in_progress" | "not_found";
12
- export type BalanceDataStatusCodeType = ReturnType<typeof toBalanceDataStatusCodeType>;
13
- export declare const toBankStatusCodeType: (v: string) => "connected" | "not_connected" | "reconnect";
14
- export type BankStatusCodeType = ReturnType<typeof toBankStatusCodeType>;
15
- export declare const toAccountReconKey: (accountId: ID, selectedPeriod: MonthYearPeriod) => string;
16
- export type AccountReconKey = ReturnType<typeof toAccountReconKey>;
17
- export interface AccountReconState {
18
- accountReconByAccountReconKey: Record<AccountReconKey, AccountReconciliationData>;
19
- }
20
- export interface AccountReconciliationData {
21
- accountId: ID;
22
- startDate: ZeniDate;
23
- endDate: ZeniDate;
24
- transactionsToReview: TransactionsToReview[];
25
- transactionsToReconcile: ID[];
26
- currency: Currency;
27
- reconciliationId?: ID;
28
- variance?: Amount;
29
- variancePercentage?: number;
30
- bankBalance?: Amount;
31
- clearedBalance?: Amount;
32
- initialClearedBalance?: Amount;
33
- userId?: ID;
34
- balanceDataStatus?: {
35
- code: BalanceDataStatusCodeType;
36
- label: string;
37
- };
38
- reconciliationStatus?: {
39
- code: ReconciliationStatusCodeType;
40
- label: string;
41
- };
42
- accountUpdatedAt?: ZeniDate;
43
- }
44
- export interface TransactionsToReview {
45
- transactionId: ID;
46
- amount: Amount;
47
- status: string;
48
- transactionDate: ZeniDate;
49
- memo: string;
50
- transactionDirection: TransactionDirectionType;
51
- recommendedAction: RecommendedAction;
52
- merchantId?: ID;
53
- merchantName?: string;
54
- merchantType?: MerchantType;
55
- }
56
- export interface RecommendedAction {
57
- action: RecommendedActionCodeType;
58
- reason: string;
59
- recommendedTransactions: RecommendedReviewTransaction[];
60
- }
61
- export interface RecommendedReviewTransaction {
62
- confidenceScore: number;
63
- recommendedReasons: string[];
64
- date: ZeniDate;
65
- memo: string;
66
- amount: Amount;
67
- transactionId?: ID;
68
- bookTransactionId?: ID;
69
- transactionType?: TransactionType;
70
- typeName?: string;
71
- accountId?: ID;
72
- merchantId?: ID;
73
- merchantName?: string;
74
- merchantType?: MerchantType;
75
- classId?: ID;
76
- }
@@ -1,35 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.toAccountReconKey = exports.toBankStatusCodeType = exports.toBalanceDataStatusCodeType = exports.toReconciliationStatusCodeType = exports.toRecommendedActionCodeType = void 0;
4
- const stringToUnion_1 = require("../../commonStateTypes/stringToUnion");
5
- const timePeriod_1 = require("../../commonStateTypes/timePeriod");
6
- const RECOMMENDED_ACTION_CODE = [
7
- 'record_expense', // Categorize
8
- 'record_deposit', // Categorize // Income - no match
9
- 'record_transfer', // Categorize
10
- 'record_bill_payment', // Match
11
- 'record_cc_payment', // Categorize
12
- 'record_cc_credit', // Categorize
13
- ];
14
- const toRecommendedActionCodeType = (v) => (0, stringToUnion_1.stringToUnion)(v, RECOMMENDED_ACTION_CODE);
15
- exports.toRecommendedActionCodeType = toRecommendedActionCodeType;
16
- const RECONCILIATION_STATUS_CODE = [
17
- 'pending',
18
- 'in_progress',
19
- 'completed',
20
- 'failed',
21
- ];
22
- const toReconciliationStatusCodeType = (v) => (0, stringToUnion_1.stringToUnion)(v, RECONCILIATION_STATUS_CODE);
23
- exports.toReconciliationStatusCodeType = toReconciliationStatusCodeType;
24
- const BALANCE_DATA_STATUS_CODE = [
25
- 'not_found',
26
- 'completed',
27
- 'in_progress',
28
- ];
29
- const toBalanceDataStatusCodeType = (v) => (0, stringToUnion_1.stringToUnion)(v, BALANCE_DATA_STATUS_CODE);
30
- exports.toBalanceDataStatusCodeType = toBalanceDataStatusCodeType;
31
- const BANK_STATUS_CODE = ['connected', 'not_connected', 'reconnect'];
32
- const toBankStatusCodeType = (v) => (0, stringToUnion_1.stringToUnion)(v, BANK_STATUS_CODE);
33
- exports.toBankStatusCodeType = toBankStatusCodeType;
34
- const toAccountReconKey = (accountId, selectedPeriod) => `${accountId}-${(0, timePeriod_1.toMonthYearPeriodId)(selectedPeriod)}`;
35
- exports.toAccountReconKey = toAccountReconKey;
@@ -1,35 +0,0 @@
1
- import { CurrencyPayload } from '../../../commonPayloadTypes/v2/viewAndReportPayloadv2';
2
- import { ID } from '../../../commonStateTypes/common';
3
- import { MatchedTransaction, MatchingBankOrCardTransaction } from '../stateTypes/reconciliationTransaction';
4
- import { TransactionIDPayload } from './transactionIDPayload';
5
- export interface MatchingBankOrCardTransactionPayload {
6
- transaction_id: string;
7
- transaction_date: string;
8
- amount: number;
9
- transaction_memo: string;
10
- transaction_direction: string;
11
- status: string;
12
- }
13
- export interface MatchedTransactionPayload extends TransactionIDPayload {
14
- transaction_date: string;
15
- amount: number;
16
- transaction_memo: string;
17
- is_checked_transaction: boolean;
18
- is_zeni_recommended: boolean;
19
- transaction_direction: string;
20
- matching_bank_or_card_transactions: MatchingBankOrCardTransactionPayload[];
21
- cleared_date?: string | null;
22
- account_id?: ID | null;
23
- account_name?: string | null;
24
- class_id?: ID | null;
25
- class_name?: string | null;
26
- merchant?: {
27
- merchant_id: ID;
28
- merchant_name: string;
29
- merchant_type: string;
30
- } | null;
31
- }
32
- export declare const toMatchedTransaction: (payload: MatchedTransactionPayload, currencyPayload: CurrencyPayload) => MatchedTransaction;
33
- export declare const toMatchingBankOrCardTransaction: (payload: MatchingBankOrCardTransactionPayload, currencyPayload: CurrencyPayload) => MatchingBankOrCardTransaction;
34
- export declare const toMatchingBankOrCardTransactionPayload: (payload: MatchingBankOrCardTransaction) => MatchingBankOrCardTransactionPayload;
35
- export declare const toMatchedTransactionPayload: (payload: MatchedTransaction) => MatchedTransactionPayload;
@@ -1,53 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.toMatchedTransactionPayload = exports.toMatchingBankOrCardTransactionPayload = exports.toMatchingBankOrCardTransaction = exports.toMatchedTransaction = 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("../stateTypes/reconciliationTransaction");
8
- const transactionIDPayload_1 = require("./transactionIDPayload");
9
- const toMatchedTransaction = (payload, currencyPayload) => {
10
- var _a, _b, _c, _d, _e, _f, _g, _h, _j;
11
- return Object.assign(Object.assign({}, (0, transactionIDPayload_1.toTransactionID)(payload)), { isZeniRecommended: payload.is_zeni_recommended, merchantId: (_b = (_a = payload.merchant) === null || _a === void 0 ? void 0 : _a.merchant_id) !== null && _b !== void 0 ? _b : undefined, merchantName: (_d = (_c = payload.merchant) === null || _c === void 0 ? void 0 : _c.merchant_name) !== null && _d !== void 0 ? _d : undefined, merchantType: ((_e = payload.merchant) === null || _e === void 0 ? void 0 : _e.merchant_type) != null
12
- ? (0, reconciliationTransaction_1.toMerchantType)(payload.merchant.merchant_type)
13
- : undefined, classId: (_f = payload.class_id) !== null && _f !== void 0 ? _f : undefined, accountId: (_g = payload.account_id) !== null && _g !== void 0 ? _g : undefined, accountName: (_h = payload.account_name) !== null && _h !== void 0 ? _h : undefined, date: (0, zeniDayJS_1.date)(payload.transaction_date), clearedDate: payload.cleared_date != null ? (0, zeniDayJS_1.date)(payload.cleared_date) : undefined, amount: (0, amount_1.toAmount)(payload.amount, currencyPayload.currency_code, currencyPayload.currency_symbol), transactionDirection: (0, reconciliationTransaction_1.toTransactionDirectionType)(payload.transaction_direction), memo: (_j = payload.transaction_memo) !== null && _j !== void 0 ? _j : undefined, typeOfTransaction: 'matched', isTransactionChecked: payload.is_checked_transaction, matchingBankOrCardTransactions: payload.matching_bank_or_card_transactions.map((t) => (0, exports.toMatchingBankOrCardTransaction)(t, currencyPayload)) });
14
- };
15
- exports.toMatchedTransaction = toMatchedTransaction;
16
- const toMatchingBankOrCardTransaction = (payload, currencyPayload) => {
17
- return {
18
- transactionDate: (0, zeniDayJS_1.date)(payload.transaction_date),
19
- status: payload.status,
20
- id: payload.transaction_id,
21
- amount: (0, amount_1.toAmount)(payload.amount, currencyPayload.currency_code, currencyPayload.currency_symbol),
22
- memo: payload.transaction_memo,
23
- transactionDirection: (0, reconciliationTransaction_1.toTransactionDirectionType)(payload.transaction_direction),
24
- };
25
- };
26
- exports.toMatchingBankOrCardTransaction = toMatchingBankOrCardTransaction;
27
- const toMatchingBankOrCardTransactionPayload = (payload) => {
28
- return {
29
- transaction_date: payload.transactionDate.format(formatZeniDateFY_1.DEFAULT_DATE_FORMAT),
30
- status: payload.status,
31
- transaction_id: payload.id,
32
- amount: payload.amount.amount,
33
- transaction_memo: payload.memo,
34
- transaction_direction: (0, reconciliationTransaction_1.toTransactionDirectionType)(payload.transactionDirection),
35
- };
36
- };
37
- exports.toMatchingBankOrCardTransactionPayload = toMatchingBankOrCardTransactionPayload;
38
- const toMatchedTransactionPayload = (payload) => {
39
- return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, (0, transactionIDPayload_1.toTransactionIDPayload)(payload)), { is_zeni_recommended: payload.isZeniRecommended }), (payload.merchantId != null &&
40
- payload.merchantName != null &&
41
- payload.merchantType != null
42
- ? {
43
- merchant: {
44
- merchant_id: payload.merchantId,
45
- merchant_name: payload.merchantName,
46
- merchant_type: payload.merchantType.toString(),
47
- },
48
- }
49
- : {})), (payload.clearedDate != null
50
- ? { cleared_date: payload.clearedDate.format(formatZeniDateFY_1.DEFAULT_DATE_FORMAT) }
51
- : {})), (payload.classId != null ? { class_id: payload.classId } : {})), (payload.accountName != null ? { account_name: payload.accountName } : {})), (payload.account != null ? { account_id: payload.accountId } : {})), { transaction_date: payload.date.format(formatZeniDateFY_1.DEFAULT_DATE_FORMAT), amount: payload.amount.amount, transaction_memo: payload.memo, is_checked_transaction: payload.isTransactionChecked, transaction_direction: (0, reconciliationTransaction_1.toTransactionDirectionType)(payload.transactionDirection), matching_bank_or_card_transactions: payload.matchingBankOrCardTransactions.map((t) => (0, exports.toMatchingBankOrCardTransactionPayload)(t)) });
52
- };
53
- exports.toMatchedTransactionPayload = toMatchedTransactionPayload;
@@ -1,32 +0,0 @@
1
- import { Amount } from '../../../commonStateTypes/amount';
2
- import { ID } from '../../../commonStateTypes/common';
3
- import { ZeniDate } from '../../../zeniDayJS';
4
- import { BaseTransaction } from './transaction';
5
- export declare const TRANSACTION_DIRECTION: readonly ["payment", "deposit"];
6
- export declare const toTransactionDirectionType: (v: string) => "payment" | "deposit";
7
- export type TransactionDirectionType = ReturnType<typeof toTransactionDirectionType>;
8
- export declare const MERCHANT_TYPE: readonly ["customer", "vendor", "none"];
9
- export declare const toMerchantType: (v: string) => "vendor" | "customer" | "none";
10
- export type MerchantType = ReturnType<typeof toMerchantType>;
11
- export interface MatchedTransaction extends BaseTransaction {
12
- isTransactionChecked: boolean;
13
- matchingBankOrCardTransactions: MatchingBankOrCardTransaction[];
14
- isZeniRecommended: boolean;
15
- transactionDirection: TransactionDirectionType;
16
- clearedDate?: ZeniDate;
17
- merchantId?: ID;
18
- merchantName?: string;
19
- merchantType?: MerchantType;
20
- classId?: ID;
21
- className?: string;
22
- accountId?: ID;
23
- accountName?: string;
24
- }
25
- export interface MatchingBankOrCardTransaction {
26
- id: ID;
27
- transactionDate: ZeniDate;
28
- amount: Amount;
29
- memo: string;
30
- status: string;
31
- transactionDirection: TransactionDirectionType;
32
- }
@@ -1,10 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.toMerchantType = exports.MERCHANT_TYPE = exports.toTransactionDirectionType = exports.TRANSACTION_DIRECTION = void 0;
4
- const stringToUnion_1 = require("../../../commonStateTypes/stringToUnion");
5
- exports.TRANSACTION_DIRECTION = ['payment', 'deposit'];
6
- const toTransactionDirectionType = (v) => (0, stringToUnion_1.stringToUnion)(v, exports.TRANSACTION_DIRECTION);
7
- exports.toTransactionDirectionType = toTransactionDirectionType;
8
- exports.MERCHANT_TYPE = ['customer', 'vendor', 'none'];
9
- const toMerchantType = (v) => (0, stringToUnion_1.stringToUnion)(v, exports.MERCHANT_TYPE);
10
- exports.toMerchantType = toMerchantType;
@@ -1,15 +0,0 @@
1
- import { ActionsObservable, StateObservable } from 'redux-observable';
2
- import { Observable } from 'rxjs';
3
- import { ID } from '../../../../commonStateTypes/common';
4
- import { updateAccounts } from '../../../../entity/account/accountReducer';
5
- import { TransactionsToReviewPayload } from '../../../../entity/accountRecon/accountReconPayload';
6
- import { updateAccountRecon } from '../../../../entity/accountRecon/accountReconReducer';
7
- import { updateMultipleReconcileTransactions } from '../../../../entity/transaction/transactionReducer';
8
- import { updateAllUsers } from '../../../../entity/user/userReducer';
9
- import { RootState } from '../../../../reducer';
10
- import { ZeniAPI } from '../../../../zeniAPI';
11
- import { fetchReconciliation, fetchReconciliationFailure, fetchReconciliationSuccess, initialiseLocalDataForSelectedAccountId, initializeReconciliationReviewTabLocalData, updateReconcileTabLocalData } from '../../reducers/reconciliationViewReducer';
12
- import { ReconciliationReviewTabLocalData } from '../../types/reconciliationViewState';
13
- export type ActionType = ReturnType<typeof fetchReconciliation> | ReturnType<typeof fetchReconciliationFailure> | ReturnType<typeof fetchReconciliationSuccess> | ReturnType<typeof initialiseLocalDataForSelectedAccountId> | ReturnType<typeof initializeReconciliationReviewTabLocalData> | ReturnType<typeof updateAccountRecon> | ReturnType<typeof updateAccounts> | ReturnType<typeof updateAllUsers> | ReturnType<typeof updateMultipleReconcileTransactions> | ReturnType<typeof updateReconcileTabLocalData>;
14
- export declare const fetchReconciliationViewEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
15
- export declare const prepareReviewTabLocalData: (transactionsToReview: TransactionsToReviewPayload[]) => Record<ID, ReconciliationReviewTabLocalData>;
@@ -1,118 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.prepareReviewTabLocalData = exports.fetchReconciliationViewEpic = void 0;
4
- const rxjs_1 = require("rxjs");
5
- const operators_1 = require("rxjs/operators");
6
- const timePeriod_1 = require("../../../../commonStateTypes/timePeriod");
7
- const accountReducer_1 = require("../../../../entity/account/accountReducer");
8
- const accountReconReducer_1 = require("../../../../entity/accountRecon/accountReconReducer");
9
- const accountReconSelector_1 = require("../../../../entity/accountRecon/accountReconSelector");
10
- const tenantSelector_1 = require("../../../../entity/tenant/tenantSelector");
11
- const transactionReducer_1 = require("../../../../entity/transaction/transactionReducer");
12
- const userReducer_1 = require("../../../../entity/user/userReducer");
13
- const responsePayload_1 = require("../../../../responsePayload");
14
- const reconciliationHelpers_1 = require("../../helpers/reconciliationHelpers");
15
- const reconciliationViewReducer_1 = require("../../reducers/reconciliationViewReducer");
16
- const saveReconciliationDetailEpic_1 = require("./saveReconciliationDetailEpic");
17
- const fetchReconciliationViewEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(reconciliationViewReducer_1.fetchReconciliation.match), (0, operators_1.mergeMap)((action) => {
18
- const { accountId, cacheOverride, refreshViewInBackground } = action.payload;
19
- const state = state$.value;
20
- const { expenseAutomationViewState: { selectedPeriodByTenantId }, expenseAutomationReconciliationViewState: { accountReconciliationRecordsBySelectedPeriod: accountReconciliationRecords, }, } = state;
21
- const currentTenant = (0, tenantSelector_1.getCurrentTenant)(state);
22
- const selectedPeriod = selectedPeriodByTenantId[currentTenant.tenantId];
23
- let reconciliationData = undefined;
24
- let reconciliationId = undefined;
25
- if (accountId != null) {
26
- reconciliationData = (0, accountReconSelector_1.getAccountReconByAccountIdAndSelectedPeriod)(state, accountId, selectedPeriod);
27
- reconciliationId = reconciliationData === null || reconciliationData === void 0 ? void 0 : reconciliationData.reconciliationId;
28
- }
29
- let fetchState;
30
- if (accountId != null) {
31
- fetchState =
32
- accountReconciliationRecords[(0, timePeriod_1.toMonthYearPeriodId)(selectedPeriod)]
33
- .reconciliationByAccountID[accountId].transactionFetchState
34
- .fetchState;
35
- }
36
- else {
37
- fetchState = state.expenseAutomationReconciliationViewState.fetchState;
38
- }
39
- if (cacheOverride === true || fetchState !== 'Completed') {
40
- const { start, end } = (0, timePeriod_1.convertToPeriod)(selectedPeriod, true);
41
- const queryParam = {
42
- start_date: start.toString(),
43
- end_date: end.toString(),
44
- };
45
- if (accountId != null) {
46
- queryParam.account_id = accountId;
47
- }
48
- const apiUrl = reconciliationId != null
49
- ? `${zeniAPI.apiEndPoints.reconciliationMicroServiceBaseUrl}/1.0/reconciliation/${reconciliationId}`
50
- : `${zeniAPI.apiEndPoints.reconciliationMicroServiceBaseUrl}/1.0/reconciliation?query=${encodeURIComponent(JSON.stringify(queryParam))}`;
51
- return zeniAPI.getJSON(apiUrl).pipe((0, operators_1.mergeMap)((response) => {
52
- var _a, _b, _c, _d;
53
- if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
54
- const updateActions = [];
55
- updateActions.push((0, accountReducer_1.updateAccounts)(response.data.accounts, 'account_reconciliation'));
56
- updateActions.push((0, userReducer_1.updateAllUsers)({
57
- users: (_a = response.data.users) !== null && _a !== void 0 ? _a : [],
58
- updateType: 'merge',
59
- }));
60
- const allTransactionsPerRecon = (0, reconciliationHelpers_1.getAllReviewTransactionsFromReconcilePayload)(response.data.reconciliation);
61
- updateActions.push((0, transactionReducer_1.updateMultipleReconcileTransactions)(allTransactionsPerRecon, 'merge'));
62
- updateActions.push((0, accountReconReducer_1.updateAccountRecon)(selectedPeriod, response.data.reconciliation));
63
- const reviewTabLocalData = (0, exports.prepareReviewTabLocalData)((_d = (_c = (_b = response.data.reconciliation[0]) === null || _b === void 0 ? void 0 : _b.transactions) === null || _c === void 0 ? void 0 : _c.review) !== null && _d !== void 0 ? _d : []);
64
- if (accountId != null) {
65
- const selectedTransactionIds = (0, saveReconciliationDetailEpic_1.getTransactionIdFromCheckedMatchedTransactionPayload)(response.data.reconciliation[0].transactions.reconcile);
66
- updateActions.push((0, reconciliationViewReducer_1.updateReconcileTabLocalData)({
67
- selectedTransactionIds: selectedTransactionIds,
68
- }));
69
- updateActions.push((0, reconciliationViewReducer_1.initializeReconciliationReviewTabLocalData)(reviewTabLocalData));
70
- }
71
- updateActions.push((0, reconciliationViewReducer_1.fetchReconciliationSuccess)(selectedPeriod, response.data, refreshViewInBackground, accountId));
72
- return (0, rxjs_1.from)(updateActions);
73
- }
74
- else {
75
- return (0, rxjs_1.of)((0, reconciliationViewReducer_1.fetchReconciliationFailure)({
76
- error: response.status,
77
- selectedPeriod,
78
- refreshViewInBackground,
79
- accountId: accountId,
80
- }));
81
- }
82
- }), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, reconciliationViewReducer_1.fetchReconciliationFailure)({
83
- error: (0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', `fetch reconciliation view REST API call errored out ${JSON.stringify(error)}`),
84
- refreshViewInBackground,
85
- selectedPeriod,
86
- accountId: accountId,
87
- }))));
88
- }
89
- else {
90
- const updateActions = [];
91
- if (accountId != null) {
92
- updateActions.push((0, reconciliationViewReducer_1.initialiseLocalDataForSelectedAccountId)());
93
- }
94
- return (0, rxjs_1.from)(updateActions);
95
- }
96
- }));
97
- exports.fetchReconciliationViewEpic = fetchReconciliationViewEpic;
98
- const prepareReviewTabLocalData = (transactionsToReview) => {
99
- return transactionsToReview.reduce((prev, currentTransaction) => {
100
- var _a, _b, _c, _d, _e, _f;
101
- const localData = {
102
- memo: currentTransaction.transaction_memo,
103
- categoryId: (_b = (_a = currentTransaction.recommended_action.recommended_transactions[0]) === null || _a === void 0 ? void 0 : _a.account_id) !== null && _b !== void 0 ? _b : undefined,
104
- classId: (_d = (_c = currentTransaction.recommended_action.recommended_transactions[0]) === null || _c === void 0 ? void 0 : _c.class_id) !== null && _d !== void 0 ? _d : undefined,
105
- vendor: ((_e = currentTransaction.recommended_action.recommended_transactions[0]) === null || _e === void 0 ? void 0 : _e.merchant_id) != null &&
106
- ((_f = currentTransaction.recommended_action.recommended_transactions[0]) === null || _f === void 0 ? void 0 : _f.merchant_name) != null
107
- ? {
108
- id: currentTransaction.recommended_action
109
- .recommended_transactions[0].merchant_id,
110
- name: currentTransaction.recommended_action
111
- .recommended_transactions[0].merchant_name,
112
- }
113
- : undefined,
114
- };
115
- return Object.assign(Object.assign({}, prev), { [currentTransaction.transaction_id]: localData });
116
- }, {});
117
- };
118
- exports.prepareReviewTabLocalData = prepareReviewTabLocalData;
@@ -1,10 +0,0 @@
1
- import { ActionsObservable, StateObservable } from 'redux-observable';
2
- import { Observable } from 'rxjs';
3
- import { ID } from '../../../../commonStateTypes/common';
4
- import { TransactionsToReview } from '../../../../entity/accountRecon/accountReconState';
5
- import { RootState } from '../../../../reducer';
6
- import { initialiseLocalDataForSelectedAccountId, initializeReconciliationReviewTabLocalData, updateReconcileTabLocalData } from '../../reducers/reconciliationViewReducer';
7
- import { ReconciliationReviewTabLocalData } from '../../types/reconciliationViewState';
8
- export type ActionType = ReturnType<typeof initialiseLocalDataForSelectedAccountId> | ReturnType<typeof initializeReconciliationReviewTabLocalData> | ReturnType<typeof updateReconcileTabLocalData>;
9
- export declare const initialiseDataForSelectedAccountIdEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>) => Observable<ActionType>;
10
- export declare const prepareReviewTabLocalData: (transactionsToReview: TransactionsToReview[]) => Record<ID, ReconciliationReviewTabLocalData>;
@@ -1,49 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.prepareReviewTabLocalData = exports.initialiseDataForSelectedAccountIdEpic = void 0;
4
- const rxjs_1 = require("rxjs");
5
- const operators_1 = require("rxjs/operators");
6
- const accountReconSelector_1 = require("../../../../entity/accountRecon/accountReconSelector");
7
- const tenantSelector_1 = require("../../../../entity/tenant/tenantSelector");
8
- const reconciliationViewReducer_1 = require("../../reducers/reconciliationViewReducer");
9
- const initialiseDataForSelectedAccountIdEpic = (actions$, state$) => actions$.pipe((0, operators_1.filter)(reconciliationViewReducer_1.initialiseLocalDataForSelectedAccountId.match), (0, operators_1.mergeMap)(() => {
10
- var _a, _b, _c;
11
- const state = state$.value;
12
- const { expenseAutomationViewState: { selectedPeriodByTenantId }, expenseAutomationReconciliationViewState: { selectedAccountId }, } = state;
13
- const currentTenant = (0, tenantSelector_1.getCurrentTenant)(state);
14
- const selectedPeriod = selectedPeriodByTenantId[currentTenant.tenantId];
15
- const actions = [];
16
- if (selectedAccountId != null) {
17
- const reconEntity = (0, accountReconSelector_1.getAccountReconByAccountIdAndSelectedPeriod)(state, selectedAccountId, selectedPeriod);
18
- const checkedTransactions = (_a = reconEntity === null || reconEntity === void 0 ? void 0 : reconEntity.transactionsToReconcile) === null || _a === void 0 ? void 0 : _a.filter((transaction) => transaction.isTransactionChecked);
19
- const selectedTransactionIds = (_b = checkedTransactions === null || checkedTransactions === void 0 ? void 0 : checkedTransactions.map((transaction) => transaction.id)) !== null && _b !== void 0 ? _b : [];
20
- actions.push((0, reconciliationViewReducer_1.updateReconcileTabLocalData)({
21
- selectedTransactionIds: selectedTransactionIds,
22
- }));
23
- const reviewTabLocalData = (0, exports.prepareReviewTabLocalData)((_c = reconEntity === null || reconEntity === void 0 ? void 0 : reconEntity.transactionsToReview) !== null && _c !== void 0 ? _c : []);
24
- actions.push((0, reconciliationViewReducer_1.initializeReconciliationReviewTabLocalData)(reviewTabLocalData));
25
- }
26
- return (0, rxjs_1.from)(actions);
27
- }));
28
- exports.initialiseDataForSelectedAccountIdEpic = initialiseDataForSelectedAccountIdEpic;
29
- const prepareReviewTabLocalData = (transactionsToReview) => {
30
- return transactionsToReview.reduce((prev, currentTransaction) => {
31
- var _a, _b, _c, _d, _e, _f;
32
- const localData = {
33
- memo: currentTransaction.memo,
34
- categoryId: (_b = (_a = currentTransaction.recommendedAction.recommendedTransactions[0]) === null || _a === void 0 ? void 0 : _a.accountId) !== null && _b !== void 0 ? _b : undefined,
35
- classId: (_d = (_c = currentTransaction.recommendedAction.recommendedTransactions[0]) === null || _c === void 0 ? void 0 : _c.classId) !== null && _d !== void 0 ? _d : undefined,
36
- vendor: ((_e = currentTransaction.recommendedAction.recommendedTransactions[0]) === null || _e === void 0 ? void 0 : _e.merchantId) != null &&
37
- ((_f = currentTransaction.recommendedAction.recommendedTransactions[0]) === null || _f === void 0 ? void 0 : _f.merchantName) != null
38
- ? {
39
- id: currentTransaction.recommendedAction
40
- .recommendedTransactions[0].merchantId,
41
- name: currentTransaction.recommendedAction
42
- .recommendedTransactions[0].merchantName,
43
- }
44
- : undefined,
45
- };
46
- return Object.assign(Object.assign({}, prev), { [currentTransaction.transactionId]: localData });
47
- }, {});
48
- };
49
- exports.prepareReviewTabLocalData = prepareReviewTabLocalData;
@@ -1,14 +0,0 @@
1
- import { ActionsObservable, StateObservable } from 'redux-observable';
2
- import { ID } from '../../../../commonStateTypes/common';
3
- import { excludeReconReviewTransaction, updateAccountRecon } from '../../../../entity/accountRecon/accountReconReducer';
4
- import { openSnackbar } from '../../../../entity/snackbar/snackbarReducer';
5
- import { MatchedTransactionPayload } from '../../../../entity/transaction/payloadTypes/reconciliationTransactionPayloads';
6
- import { updateMultipleReconcileTransactions } from '../../../../entity/transaction/transactionReducer';
7
- import { RootState } from '../../../../reducer';
8
- import { ZeniAPI } from '../../../../zeniAPI';
9
- import { saveReconciliationDetail, saveReconciliationDetailFailure, saveReconciliationDetailSuccess, updateBalancesLocalData, updateReconcileTabLocalData, updateSelectedAccountId } from '../../reducers/reconciliationViewReducer';
10
- import { ReconcileActionType } from '../../types/reconciliationViewState';
11
- export type ActionType = ReturnType<typeof excludeReconReviewTransaction> | ReturnType<typeof openSnackbar> | ReturnType<typeof saveReconciliationDetail> | ReturnType<typeof saveReconciliationDetailFailure> | ReturnType<typeof saveReconciliationDetailSuccess> | ReturnType<typeof updateAccountRecon> | ReturnType<typeof updateBalancesLocalData> | ReturnType<typeof updateMultipleReconcileTransactions> | ReturnType<typeof updateSelectedAccountId> | ReturnType<typeof updateReconcileTabLocalData>;
12
- export declare const saveReconciliationDetailsEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => import("rxjs").Observable<ActionType>;
13
- export declare function createMessageForAction(action: ReconcileActionType): "Excluding Transaction" | "Reconciling" | "Saving for Later";
14
- export declare function getTransactionIdFromCheckedMatchedTransactionPayload(transactions: MatchedTransactionPayload[]): ID[];