@zeniai/client-epic-state 4.15.22 → 4.15.24

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 (127) hide show
  1. package/lib/commonStateTypes/timePeriod.d.ts +1 -1
  2. package/lib/commonStateTypes/timePeriod.js +2 -2
  3. package/lib/commonStateTypes/viewAndReport/viewAndReport.d.ts +2 -2
  4. package/lib/commonStateTypes/viewAndReport/viewAndReport.js +0 -1
  5. package/lib/configureStore.js +1 -2
  6. package/lib/entity/account/accountState.d.ts +1 -1
  7. package/lib/entity/accountGroup/accountGroupState.d.ts +1 -1
  8. package/lib/entity/class/classReducer.d.ts +4 -4
  9. package/lib/entity/class/classState.d.ts +1 -1
  10. package/lib/entity/customer/customerPayload.d.ts +1 -1
  11. package/lib/entity/customer/customerPayload.js +6 -16
  12. package/lib/entity/forecast/forecastState.d.ts +1 -1
  13. package/lib/entity/sectionAccountsView/sectionAccountsView.d.ts +1 -1
  14. package/lib/entity/sectionClassesViewV2/sectionClassesView.d.ts +1 -1
  15. package/lib/entity/sectionClassesViewV2/sectionClassesViewReducer.d.ts +2 -2
  16. package/lib/entity/snackbar/snackbarTypes.d.ts +1 -1
  17. package/lib/entity/snackbar/snackbarTypes.js +0 -4
  18. package/lib/entity/task/taskState.d.ts +1 -1
  19. package/lib/entity/tenant/clearAllEpic.d.ts +2 -4
  20. package/lib/entity/tenant/clearAllEpic.js +0 -4
  21. package/lib/entity/tenant/tenantReducer.d.ts +1 -1
  22. package/lib/entity/tenant/tenantReducer.js +2 -7
  23. package/lib/entity/transaction/payloadTypes/customerTransactionPayload.d.ts +1 -1
  24. package/lib/entity/transaction/payloadTypes/customerTransactionPayload.js +2 -1
  25. package/lib/entity/transaction/payloadTypes/transactionPayload.d.ts +0 -2
  26. package/lib/entity/transaction/payloadTypes/transactionPayload.js +3 -7
  27. package/lib/entity/transaction/payloadTypes/vendorTransactionPayload.d.ts +1 -9
  28. package/lib/entity/transaction/payloadTypes/vendorTransactionPayload.js +2 -23
  29. package/lib/entity/transaction/stateTypes/transaction.d.ts +1 -3
  30. package/lib/entity/transaction/stateTypes/transactionType.d.ts +1 -1
  31. package/lib/entity/transaction/stateTypes/transactionType.js +0 -1
  32. package/lib/entity/transaction/stateTypes/vendorTransaction.d.ts +0 -5
  33. package/lib/entity/transaction/stateTypes/vendorTransaction.js +1 -5
  34. package/lib/entity/transaction/toSupportedTransaction.js +1 -6
  35. package/lib/entity/transaction/transactionReducer.d.ts +0 -17
  36. package/lib/entity/transaction/transactionReducer.js +2 -47
  37. package/lib/entity/transaction/transactionSelector.d.ts +0 -2
  38. package/lib/entity/transaction/transactionSelector.js +0 -5
  39. package/lib/entity/transaction/transactionState.d.ts +4 -6
  40. package/lib/entity/vendorExpense/vendorExpenseSelector.d.ts +2 -2
  41. package/lib/epic.d.ts +1 -6
  42. package/lib/epic.js +1 -6
  43. package/lib/index.d.ts +8 -16
  44. package/lib/index.js +28 -52
  45. package/lib/reducer.d.ts +1 -7
  46. package/lib/reducer.js +0 -6
  47. package/lib/view/auditReportView/auditReportViewState.d.ts +1 -1
  48. package/lib/view/billPayCard/billPayCardSelector.d.ts +1 -1
  49. package/lib/view/cardBalance/cardBalanceSelector.d.ts +1 -1
  50. package/lib/view/cashBalance/cashBalanceSelector.d.ts +1 -1
  51. package/lib/view/cashInCashOut/cashInCashOutSelector.d.ts +1 -1
  52. package/lib/view/cashPosition/cashPositionSelector.d.ts +1 -1
  53. package/lib/view/commonVendorView/vendorsTabVendorView/vendorsTabVendorViewReducer.d.ts +2 -2
  54. package/lib/view/dashboard/dashboardReducer.d.ts +2 -2
  55. package/lib/view/expenseAutomationView/epics/common/fetchAllExpenseAutomationTabsEpic.d.ts +1 -2
  56. package/lib/view/expenseAutomationView/epics/common/fetchAllExpenseAutomationTabsEpic.js +10 -24
  57. package/lib/view/expenseAutomationView/epics/common/refreshExpenseAutomationCurrentTabEpic.d.ts +1 -2
  58. package/lib/view/expenseAutomationView/epics/common/refreshExpenseAutomationCurrentTabEpic.js +0 -14
  59. package/lib/view/expenseAutomationView/epics/transactionCategorization/updateTransactionCategorizationEpic.js +4 -20
  60. package/lib/view/expenseAutomationView/expenseAutomationViewReducer.d.ts +2 -2
  61. package/lib/view/expenseAutomationView/expenseAutomationViewSelector.js +2 -17
  62. package/lib/view/expenseAutomationView/expenseAutomationViewState.d.ts +2 -2
  63. package/lib/view/expenseAutomationView/expenseAutomationViewState.js +1 -1
  64. package/lib/view/expenseAutomationView/helpers/saveTransactionHelper.js +30 -81
  65. package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.d.ts +1 -1
  66. package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.js +10 -54
  67. package/lib/view/expenseAutomationView/reducers/transactionsViewReducer.d.ts +1 -2
  68. package/lib/view/expenseAutomationView/reducers/transactionsViewReducer.js +4 -5
  69. package/lib/view/expenseAutomationView/selectorTypes/expenseAutomationViewSelectorTypes.d.ts +0 -2
  70. package/lib/view/expenseAutomationView/selectorTypes/expenseAutomationViewSelectorTypes.js +1 -1
  71. package/lib/view/expenseAutomationView/types/transactionsViewState.d.ts +0 -8
  72. package/lib/view/financeStatement/financeStatementReducer.d.ts +1 -1
  73. package/lib/view/globalMerchantView/globalMerchantViewReducer.d.ts +2 -2
  74. package/lib/view/opExByVendor/fetchOpExByVendorReportForTimeframeEpic.js +4 -3
  75. package/lib/view/opExByVendor/opExByVendorReducer.d.ts +4 -1
  76. package/lib/view/opExByVendor/opExByVendorReducer.js +11 -3
  77. package/lib/view/reimbursementCard/reimbursementCardSelector.d.ts +1 -1
  78. package/lib/view/scheduleView/scheduleListView/scheduleListTypes.d.ts +1 -1
  79. package/lib/view/spendManagement/billPay/billsBulkActionView/epics/validateBillsBulkActionEpic.ts.js +3 -4
  80. package/lib/view/spendManagement/plaidAccount/epic/plaidConnection/establishPlaidConnectionEpic.js +3 -11
  81. package/lib/view/spendManagement/plaidAccount/plaidAccountViewReducer.d.ts +1 -2
  82. package/lib/view/spendManagement/plaidAccount/plaidAccountViewReducer.js +1 -3
  83. package/lib/view/spendManagement/plaidAccount/plaidAccountViewState.d.ts +1 -1
  84. package/lib/view/tasksCard/tasksCardSelector.d.ts +1 -1
  85. package/lib/view/topEx/topExSelector.d.ts +1 -1
  86. package/lib/view/transactionDetail/epics/saveTransactionHelper.js +4 -13
  87. package/lib/view/transactionDetail/epics/updateTransactionDetailEpic.js +3 -16
  88. package/lib/view/transactionDetail/transactionDetailLocalDataHelper.js +5 -22
  89. package/lib/view/transactionDetail/transactionDetailState.d.ts +0 -1
  90. package/lib/view/transactionDetail/transactionDetailTypes.d.ts +0 -6
  91. package/lib/view/vendorReviewView/vendorGlobalReviewView/vendorGlobalReviewViewState.d.ts +1 -1
  92. package/lib/zeniAPI.d.ts +0 -1
  93. package/package.json +1 -2
  94. package/lib/entity/accountRecon/accountReconPayload.d.ts +0 -70
  95. package/lib/entity/accountRecon/accountReconPayload.js +0 -125
  96. package/lib/entity/accountRecon/accountReconReducer.d.ts +0 -16
  97. package/lib/entity/accountRecon/accountReconReducer.js +0 -71
  98. package/lib/entity/accountRecon/accountReconSelector.d.ts +0 -28
  99. package/lib/entity/accountRecon/accountReconSelector.js +0 -44
  100. package/lib/entity/accountRecon/accountReconState.d.ts +0 -70
  101. package/lib/entity/accountRecon/accountReconState.js +0 -28
  102. package/lib/entity/transaction/payloadTypes/reconciliationTransactionPayloads.d.ts +0 -35
  103. package/lib/entity/transaction/payloadTypes/reconciliationTransactionPayloads.js +0 -53
  104. package/lib/entity/transaction/stateTypes/reconciliationTransaction.d.ts +0 -32
  105. package/lib/entity/transaction/stateTypes/reconciliationTransaction.js +0 -10
  106. package/lib/view/expenseAutomationView/epics/accountRecon/fetchReconciliationViewEpic.d.ts +0 -15
  107. package/lib/view/expenseAutomationView/epics/accountRecon/fetchReconciliationViewEpic.js +0 -118
  108. package/lib/view/expenseAutomationView/epics/accountRecon/initialiseLocalDataForSelectedAccountIdEpic.d.ts +0 -10
  109. package/lib/view/expenseAutomationView/epics/accountRecon/initialiseLocalDataForSelectedAccountIdEpic.js +0 -49
  110. package/lib/view/expenseAutomationView/epics/accountRecon/saveReconciliationDetailEpic.d.ts +0 -14
  111. package/lib/view/expenseAutomationView/epics/accountRecon/saveReconciliationDetailEpic.js +0 -169
  112. package/lib/view/expenseAutomationView/epics/accountRecon/saveReconciliationReviewEpic.d.ts +0 -9
  113. package/lib/view/expenseAutomationView/epics/accountRecon/saveReconciliationReviewEpic.js +0 -154
  114. package/lib/view/expenseAutomationView/epics/accountRecon/updateReconcileTabLocalDataEpic.d.ts +0 -6
  115. package/lib/view/expenseAutomationView/epics/accountRecon/updateReconcileTabLocalDataEpic.js +0 -110
  116. package/lib/view/expenseAutomationView/helpers/reconciliationHelpers.d.ts +0 -7
  117. package/lib/view/expenseAutomationView/helpers/reconciliationHelpers.js +0 -18
  118. package/lib/view/expenseAutomationView/payload/reconciliationPayload.d.ts +0 -25
  119. package/lib/view/expenseAutomationView/payload/reconciliationPayload.js +0 -51
  120. package/lib/view/expenseAutomationView/reducers/reconciliationViewReducer.d.ts +0 -66
  121. package/lib/view/expenseAutomationView/reducers/reconciliationViewReducer.js +0 -375
  122. package/lib/view/expenseAutomationView/selectorTypes/reconciliationViewSelectorTypes.d.ts +0 -50
  123. package/lib/view/expenseAutomationView/selectorTypes/reconciliationViewSelectorTypes.js +0 -7
  124. package/lib/view/expenseAutomationView/selectors/reconciliationViewSelector.d.ts +0 -5
  125. package/lib/view/expenseAutomationView/selectors/reconciliationViewSelector.js +0 -249
  126. package/lib/view/expenseAutomationView/types/reconciliationViewState.d.ts +0 -102
  127. package/lib/view/expenseAutomationView/types/reconciliationViewState.js +0 -38
@@ -126,7 +126,6 @@ function preparePayload(transactionState, vendorState, transactionDetailState, t
126
126
  const detail = (0, transactionSelector_1.getSupportedTransactionById)(transactionState, transactionDetailKey);
127
127
  const tranDetail = (0, get_1.default)(transactionDetailState.transactionDetailById, transactionDetailKey, undefined);
128
128
  const tranVendorUpdates = tranDetail === null || tranDetail === void 0 ? void 0 : tranDetail.transactionDetailLocalData.vendorUpdates;
129
- const tranCustomerUpdates = tranDetail === null || tranDetail === void 0 ? void 0 : tranDetail.transactionDetailLocalData.customerUpdates;
130
129
  let vendorUpdates = undefined;
131
130
  if ((tranVendorUpdates === null || tranVendorUpdates === void 0 ? void 0 : tranVendorUpdates.qboId) != null) {
132
131
  const vendor = (0, vendorSelector_1.getVendorByVendorId)(vendorState, tranVendorUpdates.qboId);
@@ -143,15 +142,8 @@ function preparePayload(transactionState, vendorState, transactionDetailState, t
143
142
  };
144
143
  }
145
144
  }
146
- let customerUpdates = undefined;
147
- if ((tranCustomerUpdates === null || tranCustomerUpdates === void 0 ? void 0 : tranCustomerUpdates.qboId) != null) {
148
- customerUpdates = {
149
- id: tranCustomerUpdates.qboId,
150
- name: tranCustomerUpdates.name,
151
- };
152
- }
153
145
  if (detail != null) {
154
- const transUpdates = toTransactionUpdatePayload(saveUpdates.updates, detail, vendorUpdates, customerUpdates);
146
+ const transUpdates = toTransactionUpdatePayload(saveUpdates.updates, detail, vendorUpdates);
155
147
  const entityUpdates = toEntityUpdatePayload(saveUpdates.entityRelatedUpdates);
156
148
  return {
157
149
  entity_related_updates: entityUpdates,
@@ -161,7 +153,7 @@ function preparePayload(transactionState, vendorState, transactionDetailState, t
161
153
  }
162
154
  return undefined;
163
155
  }
164
- const toTransactionUpdatePayload = (updates, detail, vendorUpdates, customerUpdates) => {
156
+ const toTransactionUpdatePayload = (updates, detail, vendorUpdates) => {
165
157
  var _a, _b;
166
158
  const transaction = Object.assign({}, detail);
167
159
  transaction.memo = (_a = updates.memo) !== null && _a !== void 0 ? _a : '';
@@ -205,12 +197,7 @@ const toTransactionUpdatePayload = (updates, detail, vendorUpdates, customerUpda
205
197
  return (0, customerTransactionPayload_1.toCustomerTransactionPayload)(transaction);
206
198
  }
207
199
  else if ((0, vendorTransaction_1.isVendorTransaction)(transaction)) {
208
- if ((0, vendorTransaction_1.isVendorTransactionWithCustomer)(transaction)) {
209
- return (0, vendorTransactionPayload_1.toVendorTransactionWithCustomerPayload)(transaction, vendorUpdates, customerUpdates);
210
- }
211
- else {
212
- return (0, vendorTransactionPayload_1.toVendorTransactionPayload)(transaction, vendorUpdates);
213
- }
200
+ return (0, vendorTransactionPayload_1.toVendorTransactionPayload)(transaction, vendorUpdates);
214
201
  }
215
202
  else if ((0, otherTransaction_1.isTransferTransaction)(transaction)) {
216
203
  return (0, otherTransactionPayload_1.toTransferTransactionPayload)(transaction);
@@ -6,9 +6,8 @@ const customerTransaction_1 = require("../../entity/transaction/stateTypes/custo
6
6
  const vendorTransaction_1 = require("../../entity/transaction/stateTypes/vendorTransaction");
7
7
  const transactionDetailState_1 = require("./transactionDetailState");
8
8
  const toTransactionDetailLocalData = (transaction, vendorId, uncategorizedIncomeExpense) => {
9
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
9
+ var _a, _b, _c, _d, _e, _f, _g;
10
10
  const transactionLocal = Object.assign({}, transactionDetailState_1.initialSupportedTransactionDetail.transactionDetailLocalData);
11
- const customerId = transaction.customerId;
12
11
  transactionLocal.memo = transaction.memo;
13
12
  transactionLocal.vendorUpdates =
14
13
  (0, vendorTransaction_1.isVendorTransaction)(transaction) && vendorId != null
@@ -18,28 +17,12 @@ const toTransactionDetailLocalData = (transaction, vendorId, uncategorizedIncome
18
17
  qboId: (_c = transaction.vendor) === null || _c === void 0 ? void 0 : _c.id,
19
18
  }
20
19
  : undefined;
21
- transactionLocal.customerUpdates =
22
- (0, customerTransaction_1.isCustomerTransaction)(transaction) && customerId != null
23
- ? {
24
- id: customerId,
25
- name: (_e = (_d = transaction.customer) === null || _d === void 0 ? void 0 : _d.name) !== null && _e !== void 0 ? _e : '',
26
- qboId: (_g = (_f = transaction.customer) === null || _f === void 0 ? void 0 : _f.id) !== null && _g !== void 0 ? _g : '',
27
- }
28
- : undefined;
29
20
  transactionLocal.vendorDetails =
30
21
  (0, vendorTransaction_1.isVendorTransaction)(transaction) && vendorId != null
31
22
  ? {
32
23
  id: vendorId,
33
- qboId: (_j = (_h = transaction.vendor) === null || _h === void 0 ? void 0 : _h.id) !== null && _j !== void 0 ? _j : '',
34
- name: (_l = (_k = transaction.vendor) === null || _k === void 0 ? void 0 : _k.name) !== null && _l !== void 0 ? _l : '',
35
- }
36
- : undefined;
37
- transactionLocal.customerDetails =
38
- (0, customerTransaction_1.isCustomerTransaction)(transaction) && customerId != null
39
- ? {
40
- id: customerId,
41
- qboId: (_o = (_m = transaction.customer) === null || _m === void 0 ? void 0 : _m.id) !== null && _o !== void 0 ? _o : '',
42
- name: (_q = (_p = transaction.customer) === null || _p === void 0 ? void 0 : _p.name) !== null && _q !== void 0 ? _q : '',
24
+ qboId: (_e = (_d = transaction.vendor) === null || _d === void 0 ? void 0 : _d.id) !== null && _e !== void 0 ? _e : '',
25
+ name: (_g = (_f = transaction.vendor) === null || _f === void 0 ? void 0 : _f.name) !== null && _g !== void 0 ? _g : '',
43
26
  }
44
27
  : undefined;
45
28
  transactionLocal.lineItemById =
@@ -678,12 +661,12 @@ const toSetAllLineItemsToVendor = (transaction, transactionDetailLocalData, enti
678
661
  ? toVendorBaseFromLineEntity(entity)
679
662
  : undefined;
680
663
  if (line.type === 'transaction_with_product_or_service_line') {
681
- const lineRecord = Object.assign(Object.assign({}, transactionDetailLocalData.lineItemById[lineId]), { vendor: record.vendor, customer: record.customer });
664
+ const lineRecord = Object.assign(Object.assign({}, transactionDetailLocalData.lineItemById[lineId]), { vendor: record.vendor });
682
665
  record.item = lineRecord.item;
683
666
  record.lineDetailType = lineRecord.lineDetailType;
684
667
  }
685
668
  if (line.type === 'journal_entry_transaction_line') {
686
- const lineRecord = Object.assign(Object.assign({}, transactionDetailLocalData.lineItemById[lineId]), { vendor: record.vendor, customer: record.customer });
669
+ const lineRecord = Object.assign(Object.assign({}, transactionDetailLocalData.lineItemById[lineId]), { vendor: record.vendor });
687
670
  record.lineTransactionType = lineRecord.lineTransactionType;
688
671
  record.postingType = lineRecord.postingType;
689
672
  record.postingTypeName = lineRecord.postingTypeName;
@@ -59,7 +59,6 @@ export interface TransactionUpdates {
59
59
  memo?: string;
60
60
  updatesByLineId: Record<ID, TransactionLineUpdates>;
61
61
  vendorId?: ID;
62
- customerId?: ID;
63
62
  }
64
63
  export interface EntityRelatedRecommendationUpdates {
65
64
  entityId: ID;
@@ -44,12 +44,6 @@ export interface TransactionDetailLocalData {
44
44
  name: string;
45
45
  qboId: ID;
46
46
  };
47
- customerDetails?: {
48
- id: ID;
49
- name: string;
50
- qboId: ID;
51
- };
52
- customerUpdates?: TransactionVendorUpdates;
53
47
  vendorUpdates?: TransactionVendorUpdates;
54
48
  updatePreviousTransactionsWithUpdatedVendor?: boolean;
55
49
  isVendorUpdateAllChecked: boolean;
@@ -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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zeniai/client-epic-state",
3
- "version": "4.15.22",
3
+ "version": "4.15.24",
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",
@@ -85,7 +85,6 @@
85
85
  "lint": "eslint . --ext .js,.jsx,.ts,.tsx --fix",
86
86
  "find-dead-code": "ts-prune | grep -v '(used in module)'",
87
87
  "find-unused-exports": "ts-unused-exports ./tsconfig.json",
88
- "circular-dependency": "npx madge --circular --extensions ts ./src",
89
88
  "build": "concurrently --kill-others-on-fail \"eslint . --ext .js,.jsx,.ts,.tsx\" \"tsc\" \"jest --config jest.config.json\" && rimraf \"lib/**/__mocks__\" \"lib/**/__testHelpers__\"",
90
89
  "only-build": "concurrently --kill-others-on-fail \"eslint . --ext .js,.jsx,.ts,.tsx\" \"tsc\" && rimraf \"lib/**/__mocks__\" \"lib/**/__testHelpers__\"",
91
90
  "format": "prettier --write --ignore-unknown \"src/**/*\"",
@@ -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
- books_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
- booksTransactionId: (_g = payload.books_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.booksTransactionId != null
122
- ? { books_transaction_id: payload.booksTransactionId }
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
- booksTransactionId?: ID;
63
- transactionType?: TransactionType;
64
- typeName?: string;
65
- accountId?: ID;
66
- merchantId?: ID;
67
- merchantName?: string;
68
- merchantType?: MerchantType;
69
- classId?: ID;
70
- }
@@ -1,28 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.toAccountReconKey = exports.toBankStatusCodeType = 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 BANK_STATUS_CODE = ['connected', 'not_connected', 'reconnect'];
25
- const toBankStatusCodeType = (v) => (0, stringToUnion_1.stringToUnion)(v, BANK_STATUS_CODE);
26
- exports.toBankStatusCodeType = toBankStatusCodeType;
27
- const toAccountReconKey = (accountId, selectedPeriod) => `${accountId}-${(0, timePeriod_1.toMonthYearPeriodId)(selectedPeriod)}`;
28
- exports.toAccountReconKey = toAccountReconKey;