@zeniai/client-epic-state 4.7.99 → 4.8.0

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 (139) hide show
  1. package/lib/commonPayloadTypes/statusPayload.d.ts +4 -0
  2. package/lib/commonStateTypes/fiscalYearHelpers/formatZeniDateFY.d.ts +3 -0
  3. package/lib/commonStateTypes/fiscalYearHelpers/formatZeniDateFY.js +4 -1
  4. package/lib/commonStateTypes/timePeriod.d.ts +9 -2
  5. package/lib/commonStateTypes/timePeriod.js +12 -1
  6. package/lib/commonStateTypes/viewAndReport/viewAndReport.d.ts +1 -1
  7. package/lib/commonStateTypes/viewAndReport/viewAndReport.js +1 -0
  8. package/lib/entity/account/accountPayload.d.ts +1 -1
  9. package/lib/entity/account/accountSelector.d.ts +3 -3
  10. package/lib/entity/account/accountState.d.ts +4 -4
  11. package/lib/entity/account/accountState.js +1 -0
  12. package/lib/entity/account/pickAndMergeForecastAccountReport.d.ts +1 -1
  13. package/lib/entity/accountGroup/accountGroupSelector.d.ts +22 -22
  14. package/lib/entity/accountGroup/accountGroupState.d.ts +1 -1
  15. package/lib/entity/class/classReducer.d.ts +4 -4
  16. package/lib/entity/class/classState.d.ts +2 -2
  17. package/lib/entity/depositAccountTransaction/depositAccountTransaction.d.ts +1 -1
  18. package/lib/entity/forecast/forecastState.d.ts +1 -1
  19. package/lib/entity/jeSchedules/jeSchedulesPayload.d.ts +55 -0
  20. package/lib/entity/jeSchedules/jeSchedulesPayload.js +142 -0
  21. package/lib/entity/jeSchedules/jeSchedulesReducer.d.ts +11 -0
  22. package/lib/entity/jeSchedules/jeSchedulesReducer.js +91 -0
  23. package/lib/entity/jeSchedules/jeSchedulesSelector.d.ts +58 -0
  24. package/lib/entity/jeSchedules/jeSchedulesSelector.js +74 -0
  25. package/lib/entity/jeSchedules/jeSchedulesState.d.ts +61 -0
  26. package/lib/entity/jeSchedules/jeSchedulesState.js +2 -0
  27. package/lib/entity/jeSchedules/jeSchedulesTypes.d.ts +10 -0
  28. package/lib/entity/jeSchedules/jeSchedulesTypes.js +25 -0
  29. package/lib/entity/jeSchedules/updateJESchedulesEpic.d.ts +10 -0
  30. package/lib/entity/jeSchedules/updateJESchedulesEpic.js +65 -0
  31. package/lib/entity/sectionAccountsView/sectionAccountsView.d.ts +1 -1
  32. package/lib/entity/sectionClassesViewV2/sectionClassesView.d.ts +1 -1
  33. package/lib/entity/sectionClassesViewV2/sectionClassesViewReducer.d.ts +2 -2
  34. package/lib/entity/snackbar/snackbarTypes.d.ts +1 -1
  35. package/lib/entity/snackbar/snackbarTypes.js +2 -0
  36. package/lib/entity/tenant/clearAllEpic.d.ts +3 -1
  37. package/lib/entity/tenant/clearAllEpic.js +4 -0
  38. package/lib/entity/transaction/payloadTypes/scheduleTransactionPayload.d.ts +12 -0
  39. package/lib/entity/transaction/payloadTypes/scheduleTransactionPayload.js +37 -0
  40. package/lib/entity/transaction/payloadTypes/transactionPayload.d.ts +3 -3
  41. package/lib/entity/transaction/payloadTypes/transactionPayload.js +1 -1
  42. package/lib/entity/transaction/stateTypes/scheduleTransaction.d.ts +11 -0
  43. package/lib/entity/transaction/stateTypes/scheduleTransaction.js +2 -0
  44. package/lib/entity/transaction/stateTypes/transaction.d.ts +10 -7
  45. package/lib/entity/transaction/stateTypes/transactionType.d.ts +4 -0
  46. package/lib/entity/transaction/stateTypes/transactionType.js +11 -3
  47. package/lib/entity/transaction/transactionReducer.d.ts +7 -0
  48. package/lib/entity/transaction/transactionReducer.js +39 -3
  49. package/lib/entity/transaction/transactionSelector.d.ts +6 -0
  50. package/lib/entity/transaction/transactionSelector.js +19 -0
  51. package/lib/entity/transaction/transactionState.d.ts +3 -0
  52. package/lib/epic.d.ts +77 -67
  53. package/lib/epic.js +11 -1
  54. package/lib/index.d.ts +19 -6
  55. package/lib/index.js +58 -17
  56. package/lib/reducer.d.ts +9 -0
  57. package/lib/reducer.js +9 -0
  58. package/lib/view/accountList/accountListReducer.js +2 -0
  59. package/lib/view/accountList/accountListSelector.d.ts +16 -1
  60. package/lib/view/accountList/accountListSelector.js +33 -4
  61. package/lib/view/accountList/accountListState.d.ts +1 -1
  62. package/lib/view/accountMappingView/accountTypeRecommendation/accountTypeRecommendationPayload.d.ts +1 -1
  63. package/lib/view/billPayCard/billPayCardSelector.d.ts +1 -1
  64. package/lib/view/cardBalance/cardBalanceSelector.d.ts +2 -2
  65. package/lib/view/cashBalance/cashBalanceSelector.d.ts +2 -2
  66. package/lib/view/cashInCashOut/cashInCashOutSelector.d.ts +1 -1
  67. package/lib/view/cashPosition/cashPositionSelector.d.ts +1 -1
  68. package/lib/view/dashboard/dashboardReducer.d.ts +2 -2
  69. package/lib/view/financeStatement/financeStatementReducer.d.ts +1 -1
  70. package/lib/view/globalMerchantView/globalMerchantViewReducer.d.ts +2 -2
  71. package/lib/view/people/changeZeniPersonRolesEpic.d.ts +1 -1
  72. package/lib/view/people/deletePersonEpic.d.ts +1 -1
  73. package/lib/view/people/invitePeopleEpic.d.ts +1 -1
  74. package/lib/view/people/inviteZeniPeopleEpic.d.ts +1 -1
  75. package/lib/view/people/resendInviteEpic.d.ts +1 -1
  76. package/lib/view/reimbursementCard/reimbursementCardSelector.d.ts +1 -1
  77. package/lib/view/reviewCompanyView/reviewCompanyViewState.d.ts +2 -2
  78. package/lib/view/reviewCompanyView/reviewCompanyViewState.js +1 -0
  79. package/lib/view/scheduleView/scheduleDetailView/epics/createNewSchedulesEpic.d.ts +6 -0
  80. package/lib/view/scheduleView/scheduleDetailView/epics/createNewSchedulesEpic.js +28 -0
  81. package/lib/view/scheduleView/scheduleDetailView/epics/fetchScheduleDetailsEpic.d.ts +8 -0
  82. package/lib/view/scheduleView/scheduleDetailView/epics/fetchScheduleDetailsEpic.js +51 -0
  83. package/lib/view/scheduleView/scheduleDetailView/epics/fetchScheduleDetailsPageEpic.d.ts +7 -0
  84. package/lib/view/scheduleView/scheduleDetailView/epics/fetchScheduleDetailsPageEpic.js +16 -0
  85. package/lib/view/scheduleView/scheduleDetailView/epics/initializeScheduleDetailLocalDataEpic.d.ts +6 -0
  86. package/lib/view/scheduleView/scheduleDetailView/epics/initializeScheduleDetailLocalDataEpic.js +32 -0
  87. package/lib/view/scheduleView/scheduleDetailView/epics/saveScheduleDetailsEpic.d.ts +11 -0
  88. package/lib/view/scheduleView/scheduleDetailView/epics/saveScheduleDetailsEpic.js +102 -0
  89. package/lib/view/scheduleView/scheduleDetailView/epics/updateAmountsInScheduleDetailEpic.d.ts +6 -0
  90. package/lib/view/scheduleView/scheduleDetailView/epics/updateAmountsInScheduleDetailEpic.js +29 -0
  91. package/lib/view/scheduleView/scheduleDetailView/scheduleDetailLocalDataHelper.d.ts +18 -0
  92. package/lib/view/scheduleView/scheduleDetailView/scheduleDetailLocalDataHelper.js +185 -0
  93. package/lib/view/scheduleView/scheduleDetailView/scheduleDetailPayload.d.ts +58 -0
  94. package/lib/view/scheduleView/scheduleDetailView/scheduleDetailPayload.js +118 -0
  95. package/lib/view/scheduleView/scheduleDetailView/scheduleDetailReducer.d.ts +50 -0
  96. package/lib/view/scheduleView/scheduleDetailView/scheduleDetailReducer.js +237 -0
  97. package/lib/view/scheduleView/scheduleDetailView/scheduleDetailSelector.d.ts +21 -0
  98. package/lib/view/scheduleView/scheduleDetailView/scheduleDetailSelector.js +67 -0
  99. package/lib/view/scheduleView/scheduleDetailView/scheduleDetailState.d.ts +47 -0
  100. package/lib/view/scheduleView/scheduleDetailView/scheduleDetailState.js +5 -0
  101. package/lib/view/scheduleView/scheduleDetailView/scheduleDetailTypes.d.ts +3 -0
  102. package/lib/view/scheduleView/scheduleDetailView/scheduleDetailTypes.js +14 -0
  103. package/lib/view/scheduleView/scheduleListView/epics/fetchDownloadSchedulesEpic.d.ts +8 -0
  104. package/lib/view/scheduleView/scheduleListView/epics/fetchDownloadSchedulesEpic.js +52 -0
  105. package/lib/view/scheduleView/scheduleListView/epics/fetchScheduleListEpic.d.ts +27 -0
  106. package/lib/view/scheduleView/scheduleListView/epics/fetchScheduleListEpic.js +75 -0
  107. package/lib/view/scheduleView/scheduleListView/epics/fetchSchedulesAccountEpic.d.ts +19 -0
  108. package/lib/view/scheduleView/scheduleListView/epics/fetchSchedulesAccountEpic.js +37 -0
  109. package/lib/view/scheduleView/scheduleListView/scheduleListHelper.d.ts +70 -0
  110. package/lib/view/scheduleView/scheduleListView/scheduleListHelper.js +187 -0
  111. package/lib/view/scheduleView/scheduleListView/scheduleListPayload.d.ts +7 -0
  112. package/lib/view/scheduleView/scheduleListView/scheduleListPayload.js +2 -0
  113. package/lib/view/scheduleView/scheduleListView/scheduleListReducer.d.ts +55 -0
  114. package/lib/view/scheduleView/scheduleListView/scheduleListReducer.js +228 -0
  115. package/lib/view/scheduleView/scheduleListView/scheduleListSelector.d.ts +38 -0
  116. package/lib/view/scheduleView/scheduleListView/scheduleListSelector.js +193 -0
  117. package/lib/view/scheduleView/scheduleListView/scheduleListState.d.ts +29 -0
  118. package/lib/view/scheduleView/scheduleListView/scheduleListState.js +2 -0
  119. package/lib/view/scheduleView/scheduleListView/scheduleListTypes.d.ts +22 -0
  120. package/lib/view/scheduleView/scheduleListView/scheduleListTypes.js +39 -0
  121. package/lib/view/tasksCard/tasksCardSelector.d.ts +1 -1
  122. package/lib/view/topEx/topExSelector.d.ts +1 -1
  123. package/lib/view/transactionDetail/epics/initializeTransactionDetailLocalDataEpic.js +2 -5
  124. package/lib/view/transactionDetail/epics/saveTransactionDetailEpic.js +2 -1
  125. package/lib/view/transactionDetail/epics/transactionDetailEpic.js +3 -2
  126. package/lib/view/transactionDetail/epics/updateTransactionDetailEpic.js +2 -1
  127. package/lib/view/transactionDetail/transactionDetailSelector.js +3 -2
  128. package/lib/view/transactionDetail/transactionDetailState.d.ts +1 -1
  129. package/lib/view/transactionDetail/transactionDetailState.js +3 -16
  130. package/lib/view/transactionList/transactionListByAccountSelector.js +2 -1
  131. package/lib/view/transactionList/transactionListByCategoryTypeSelector.js +2 -1
  132. package/lib/view/transactionList/transactionListByClassSelector.js +2 -1
  133. package/lib/view/transactionList/transactionListByEntitySelector.js +2 -1
  134. package/lib/view/vendorList/vendorListSelector.d.ts +3 -0
  135. package/lib/view/vendorList/vendorListSelector.js +11 -1
  136. package/lib/view/vendorReviewView/vendorGlobalReviewView/vendorGlobalReviewViewState.d.ts +2 -2
  137. package/lib/zeniDayJS.d.ts +1 -0
  138. package/lib/zeniDayJS.js +7 -1
  139. package/package.json +1 -1
@@ -0,0 +1,193 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.getFetchStateForScheduleAccountList = exports.getScheduleListReport = void 0;
7
+ const get_1 = __importDefault(require("lodash/get"));
8
+ const orderBy_1 = __importDefault(require("lodash/orderBy"));
9
+ const accountListSelector_1 = require("../../accountList/accountListSelector");
10
+ const jeSchedulesSelector_1 = require("../../../entity/jeSchedules/jeSchedulesSelector");
11
+ const scheduleListReducer_1 = require("./scheduleListReducer");
12
+ const scheduleListTypes_1 = require("./scheduleListTypes");
13
+ const amount_1 = require("../../../commonStateTypes/amount");
14
+ const scheduleListHelper_1 = require("./scheduleListHelper");
15
+ const sortedJETransactionsView = (jeTransactions, sortKey, sortOrder) => {
16
+ return (0, orderBy_1.default)(jeTransactions, (jeTransaction) => {
17
+ var _a;
18
+ switch (sortKey) {
19
+ case 'transactionDate':
20
+ return jeTransaction.baseTransaction.date.valueOf();
21
+ case 'vendor':
22
+ return jeTransaction.vendor.name.toLowerCase();
23
+ case 'scheduleCategory':
24
+ return jeTransaction.baseTransaction.account.accountName.toLowerCase();
25
+ case 'expenseCategory':
26
+ return jeTransaction.jeDebit.account != null
27
+ ? jeTransaction.jeDebit.account.accountName.toLowerCase()
28
+ : null;
29
+ case 'class':
30
+ return jeTransaction.jeDebit.accountingClass != null
31
+ ? jeTransaction.jeDebit.accountingClass.className.toLowerCase()
32
+ : null;
33
+ case 'amount':
34
+ return jeTransaction.baseTransaction.amount != null
35
+ ? jeTransaction.baseTransaction.amount.amount
36
+ : 0;
37
+ case 'balanceAsOfToday':
38
+ return jeTransaction.balanceAsOfToday != null
39
+ ? jeTransaction.balanceAsOfToday.amount
40
+ : 0;
41
+ case 'memo':
42
+ return jeTransaction.baseTransaction.memo.toLowerCase();
43
+ case 'startMonth':
44
+ return jeTransaction.startDate != null
45
+ ? jeTransaction.startDate.valueOf()
46
+ : null;
47
+ case 'endMonth':
48
+ return jeTransaction.endDate != null
49
+ ? jeTransaction.endDate.valueOf()
50
+ : null;
51
+ case 'months':
52
+ return (_a = jeTransaction.period) !== null && _a !== void 0 ? _a : null;
53
+ case 'transactionType':
54
+ return jeTransaction.baseTransaction.type.toLowerCase();
55
+ case 'status':
56
+ return jeTransaction.status.code.toLowerCase();
57
+ default:
58
+ return jeTransaction.updatedByUser != null
59
+ ? jeTransaction.updatedByUser.firstName.toLowerCase()
60
+ : null;
61
+ }
62
+ }, sortOrder === 'ascending' ? 'asc' : 'desc');
63
+ };
64
+ const getScheduleListReport = (state) => {
65
+ const { scheduleListState, accountListState, accountState } = state;
66
+ const downloadState = scheduleListState.downloadState;
67
+ const key = (0, scheduleListTypes_1.getScheduleListKey)(scheduleListState.currentTab, scheduleListState.selectedCategoryId, scheduleListState.selectedTimeframe);
68
+ const scheduleListRecord = (0, get_1.default)(scheduleListState.byScheduleListKey, key, undefined);
69
+ const allScheduleAccounts = (0, accountListSelector_1.getAccountList)(accountState, accountListState, (0, scheduleListHelper_1.getAccountListKeyForSchedulesTab)(scheduleListState.currentTab));
70
+ let allNestedAccounts = (0, accountListSelector_1.getNestedAccountListHeirarchy)(accountListState, (0, scheduleListHelper_1.getAccountListKeyForSchedulesTab)(scheduleListState.currentTab));
71
+ let allAccounts = allScheduleAccounts.accounts;
72
+ if (scheduleListState.currentTab === 'prepaid_expenses') {
73
+ const filteredList = (0, accountListSelector_1.getFilteredNestedAndAccountListsForLabel)(accountState, accountListState, (0, scheduleListHelper_1.getAccountListKeyForSchedulesTab)(scheduleListState.currentTab), 'prepaid_expenses');
74
+ // Use this list only if there is some account in it.
75
+ if (filteredList.accountList.length > 0) {
76
+ allAccounts = filteredList.accountList;
77
+ allNestedAccounts = filteredList.nestedAccountList;
78
+ }
79
+ }
80
+ if (scheduleListRecord == null) {
81
+ return {
82
+ reportTitle: 'Schedule List',
83
+ version: 1,
84
+ status: undefined,
85
+ jeScheduleOrder: 'descending_transaction_date',
86
+ jeScheduledTransactions: [],
87
+ currentTab: scheduleListState.currentTab,
88
+ currentSubTab: scheduleListState.currentSubTab,
89
+ selectedScheduledId: undefined,
90
+ downloadUIState: downloadState,
91
+ searchText: '',
92
+ selectedCategoryID: scheduleListState.scheduleListLocalData.selectedCategoryID,
93
+ selectedTimeframe: scheduleListState.scheduleListLocalData.selectedTimeframe,
94
+ allSubTabs: scheduleListTypes_1.ALL_SCHEDULES_SUB_TABS.map((subTab) => subTab),
95
+ uiState: scheduleListReducer_1.scheduleListInitialState.uiState,
96
+ scheduleListAccounts: [(0, scheduleListHelper_1.getAllAccountBase)(), ...allAccounts],
97
+ scheduleListNestedAccountHierarchy: [
98
+ (0, scheduleListHelper_1.getAllAccountNested)(),
99
+ ...allNestedAccounts,
100
+ ],
101
+ fetchState: 'Not-Started',
102
+ error: undefined,
103
+ scheduleListLocalData: scheduleListState.scheduleListLocalData,
104
+ allTimeframeTicks: [],
105
+ totalBalanceTimeframeTicks: {
106
+ months: [],
107
+ },
108
+ totalAmount: (0, amount_1.toAmount)(0, '', ''),
109
+ totalRunningBalances: (0, amount_1.toAmount)(0, '', ''),
110
+ };
111
+ }
112
+ else {
113
+ const jeScheduleIds = scheduleListRecord.jeScheduleTransactionKeys;
114
+ const { uiState, selectedScheduleId, fetchState, error } = scheduleListRecord;
115
+ const { sortKey, sortOrder } = uiState;
116
+ const scheduleTransactionsUnsorted = jeScheduleIds
117
+ .map((jeScheduleId) => (0, jeSchedulesSelector_1.getJEScheduledTransactionByJEScheduleKey)(jeScheduleId, state))
118
+ .filter((value) => {
119
+ if (value == null) {
120
+ console.error("Can't have null transaction at this stage!");
121
+ }
122
+ return value != null;
123
+ });
124
+ const currentTabTransactions = (0, orderBy_1.default)(scheduleTransactionsUnsorted, (value) => value.baseTransaction.date.valueOf(), 'desc');
125
+ let jeTransactionsView = [];
126
+ switch (scheduleListState.currentTab) {
127
+ case 'prepaid_expenses':
128
+ switch (scheduleListState.currentSubTab) {
129
+ case 'new':
130
+ jeTransactionsView = currentTabTransactions.filter((tran) => tran.status.code === 'new');
131
+ break;
132
+ case 'ongoing':
133
+ jeTransactionsView = currentTabTransactions.filter((tran) => tran.status.code === 'ongoing');
134
+ break;
135
+ case 'completed':
136
+ jeTransactionsView = currentTabTransactions.filter((tran) => tran.status.code === 'completed');
137
+ break;
138
+ default:
139
+ jeTransactionsView = currentTabTransactions;
140
+ }
141
+ break;
142
+ }
143
+ const loweredSearchText = scheduleListState.searchText.trim().toLowerCase();
144
+ const sortedJETransactionView = sortedJETransactionsView(jeTransactionsView.filter((jeTransaction) => {
145
+ return (jeTransaction.vendor.name
146
+ .toLowerCase()
147
+ .includes(loweredSearchText) === true ||
148
+ jeTransaction.baseTransaction.memo
149
+ .toLowerCase()
150
+ .includes(loweredSearchText) === true);
151
+ }), sortKey, sortOrder);
152
+ const totalBalances = (0, scheduleListHelper_1.getCalculatedScheduleTotals)(jeTransactionsView);
153
+ const allTimeframeTicks = (0, scheduleListHelper_1.getAllTimeframeTicks)(sortedJETransactionView, 2);
154
+ const jeScheduledTransactionWithBalance = [];
155
+ sortedJETransactionView.forEach((jeSchedule) => {
156
+ jeScheduledTransactionWithBalance.push(Object.assign(Object.assign({}, jeSchedule), { coaBalanceByPeriod: (0, scheduleListHelper_1.calculateCOABalanceGroupedByPeriod)(jeSchedule) }));
157
+ });
158
+ const totalBalanceTimeframeTicks = (0, scheduleListHelper_1.calculateTotalBalanceTimeframeTick)(jeScheduledTransactionWithBalance, allTimeframeTicks, 'months');
159
+ return {
160
+ reportTitle: 'Schedule List',
161
+ version: 1,
162
+ status: undefined,
163
+ jeScheduleOrder: 'descending_transaction_date',
164
+ jeScheduledTransactions: jeScheduledTransactionWithBalance,
165
+ currentTab: scheduleListState.currentTab,
166
+ currentSubTab: scheduleListState.currentSubTab,
167
+ selectedScheduledId: selectedScheduleId,
168
+ downloadUIState: downloadState,
169
+ searchText: scheduleListState.searchText,
170
+ selectedCategoryID: scheduleListState.selectedCategoryId,
171
+ selectedTimeframe: scheduleListState.selectedTimeframe,
172
+ allSubTabs: scheduleListTypes_1.ALL_SCHEDULES_SUB_TABS.map((subTab) => subTab),
173
+ uiState,
174
+ scheduleListAccounts: [(0, scheduleListHelper_1.getAllAccountBase)(), ...allAccounts],
175
+ scheduleListNestedAccountHierarchy: [
176
+ (0, scheduleListHelper_1.getAllAccountNested)(),
177
+ ...allNestedAccounts,
178
+ ],
179
+ fetchState,
180
+ error,
181
+ scheduleListLocalData: scheduleListState.scheduleListLocalData,
182
+ totalAmount: totalBalances.totalAmount,
183
+ totalRunningBalances: totalBalances.totalRunningBalances,
184
+ allTimeframeTicks,
185
+ totalBalanceTimeframeTicks,
186
+ };
187
+ }
188
+ };
189
+ exports.getScheduleListReport = getScheduleListReport;
190
+ const getFetchStateForScheduleAccountList = (state, scheduleTab) => {
191
+ return (0, accountListSelector_1.getAccountListFetchState)(state.accountListState, (0, scheduleListHelper_1.getAccountListKeyForSchedulesTab)(scheduleTab));
192
+ };
193
+ exports.getFetchStateForScheduleAccountList = getFetchStateForScheduleAccountList;
@@ -0,0 +1,29 @@
1
+ import { FetchedState, FetchStateAndError, ID } from '../../../commonStateTypes/common';
2
+ import { SortOrder } from '../../../commonStateTypes/selectorTypes/sortOrderTypes';
3
+ import { TimeframeTick } from '../../../commonStateTypes/timeframeTick';
4
+ import { JEScheduleKey, SchedulesTypes } from '../../../entity/jeSchedules/jeSchedulesTypes';
5
+ import { ScheduleListKey, ScheduleSubTabType, ScheduleListSortKey } from './scheduleListTypes';
6
+ export interface ScheduleListUIState {
7
+ sortKey: ScheduleListSortKey;
8
+ sortOrder: SortOrder;
9
+ scrollYOffset: number;
10
+ }
11
+ export interface ScheduleWithListStatus extends FetchedState {
12
+ jeScheduleTransactionKeys: JEScheduleKey[];
13
+ uiState: ScheduleListUIState;
14
+ selectedScheduleId?: ID;
15
+ }
16
+ export interface ScheduleListLocalData {
17
+ selectedCategoryID: ID;
18
+ selectedTimeframe: TimeframeTick;
19
+ }
20
+ export interface ScheduleListViewState {
21
+ byScheduleListKey: Record<ScheduleListKey, ScheduleWithListStatus>;
22
+ downloadState: FetchStateAndError;
23
+ searchText: string;
24
+ currentTab: SchedulesTypes;
25
+ currentSubTab: ScheduleSubTabType;
26
+ selectedCategoryId: ID;
27
+ selectedTimeframe: TimeframeTick;
28
+ scheduleListLocalData: ScheduleListLocalData;
29
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,22 @@
1
+ import { ID } from '../../../commonStateTypes/common';
2
+ import { TimeframeTick } from '../../../commonStateTypes/timeframeTick';
3
+ import { SchedulesTypes } from '../../../entity/jeSchedules/jeSchedulesTypes';
4
+ export declare const ALL_SCHEDULE_LIST_TABS_FILE_TYPES: readonly ["excel"];
5
+ export declare const toScheduleListTabsFileTypeStrict: (v?: string | undefined) => "excel" | undefined;
6
+ export declare type ScheduleListTabsFileType = NonNullable<ReturnType<typeof toScheduleListTabsFileTypeStrict>>;
7
+ export declare const getScheduleListKey: (tab: SchedulesTypes, selectedCategory: ID, selectedTimeframe: TimeframeTick) => `prepaid_expenses-${string}-${string}--${string}` | `fixed_assets-${string}-${string}--${string}` | `accured_expenses-${string}-${string}--${string}` | `deferred_revenue-${string}-${string}--${string}`;
8
+ export declare type ScheduleListKey = ReturnType<typeof getScheduleListKey>;
9
+ export declare const ALL_SCHEDULES_SUB_TABS: readonly ["all", "new", "ongoing", "completed"];
10
+ export declare const toScheduleSubTabType: (v: string) => "all" | "new" | "completed" | "ongoing";
11
+ export declare type ScheduleSubTabType = ReturnType<typeof toScheduleSubTabType>;
12
+ export declare const ALL_SCHEDULES_PAY_SORT_KEYS: readonly ["transactionDate", "vendor", "scheduleCategory", "expenseCategory", "class", "amount", "balanceAsOfToday", "memo", "startMonth", "endMonth", "months", "transactionType", "status", "user"];
13
+ export declare const toScheduleSortKeyType: (v: string) => "status" | "user" | "months" | "amount" | "vendor" | "class" | "memo" | "transactionDate" | "scheduleCategory" | "expenseCategory" | "balanceAsOfToday" | "startMonth" | "endMonth" | "transactionType";
14
+ export declare type ScheduleListSortKey = ReturnType<typeof toScheduleSortKeyType>;
15
+ export interface DownloadJEScheduleTabOptions {
16
+ timezone: string;
17
+ tabsFileType: ScheduleListTabsFileType;
18
+ tabs: SchedulesTypes[];
19
+ categoryId: ID;
20
+ timeframe: TimeframeTick;
21
+ searchText?: string;
22
+ }
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.toScheduleSortKeyType = exports.ALL_SCHEDULES_PAY_SORT_KEYS = exports.toScheduleSubTabType = exports.ALL_SCHEDULES_SUB_TABS = exports.getScheduleListKey = exports.toScheduleListTabsFileTypeStrict = exports.ALL_SCHEDULE_LIST_TABS_FILE_TYPES = void 0;
4
+ const formatZeniDateFY_1 = require("../../../commonStateTypes/fiscalYearHelpers/formatZeniDateFY");
5
+ const stringToUnion_1 = require("../../../commonStateTypes/stringToUnion");
6
+ exports.ALL_SCHEDULE_LIST_TABS_FILE_TYPES = ['excel'];
7
+ const toScheduleListTabsFileTypeStrict = (v) => {
8
+ var _a;
9
+ return (0, stringToUnion_1.stringToUnionStrict)((_a = v === null || v === void 0 ? void 0 : v.toLocaleLowerCase()) !== null && _a !== void 0 ? _a : '', exports.ALL_SCHEDULE_LIST_TABS_FILE_TYPES);
10
+ };
11
+ exports.toScheduleListTabsFileTypeStrict = toScheduleListTabsFileTypeStrict;
12
+ const getScheduleListKey = (tab, selectedCategory, selectedTimeframe) => `${tab}-${selectedCategory}-${selectedTimeframe.startDate.format(formatZeniDateFY_1.DAY_MONTH_YEAR_FORMAT)}--${selectedTimeframe.endDate.format(formatZeniDateFY_1.DAY_MONTH_YEAR_FORMAT)}`;
13
+ exports.getScheduleListKey = getScheduleListKey;
14
+ exports.ALL_SCHEDULES_SUB_TABS = [
15
+ 'all',
16
+ 'new',
17
+ 'ongoing',
18
+ 'completed',
19
+ ];
20
+ const toScheduleSubTabType = (v) => (0, stringToUnion_1.stringToUnion)(v, exports.ALL_SCHEDULES_SUB_TABS);
21
+ exports.toScheduleSubTabType = toScheduleSubTabType;
22
+ exports.ALL_SCHEDULES_PAY_SORT_KEYS = [
23
+ 'transactionDate',
24
+ 'vendor',
25
+ 'scheduleCategory',
26
+ 'expenseCategory',
27
+ 'class',
28
+ 'amount',
29
+ 'balanceAsOfToday',
30
+ 'memo',
31
+ 'startMonth',
32
+ 'endMonth',
33
+ 'months',
34
+ 'transactionType',
35
+ 'status',
36
+ 'user',
37
+ ];
38
+ const toScheduleSortKeyType = (v) => (0, stringToUnion_1.stringToUnion)(v, exports.ALL_SCHEDULES_PAY_SORT_KEYS);
39
+ exports.toScheduleSortKeyType = toScheduleSortKeyType;
@@ -1,6 +1,6 @@
1
1
  import { RootState } from '../../reducer';
2
2
  export declare const getTasksCardReport: (state: RootState) => {
3
- reportId: "cash_balance" | "card_balance" | "operating_expenses" | "operating_expenses_by_classes" | "revenue" | "revenue_by_classes" | "net_burn_or_income" | "net_burn_or_income_story_card" | "net_burn_or_income_by_classes" | "cash_position" | "top_expenses" | "profit_and_loss" | "profit_and_loss_by_classes" | "balance_sheet" | "cash_flow" | "dashboard" | "finance_statement" | "transaction_list_of_account" | "transaction_list_missing_receipt" | "transaction_list_of_account_by_class" | "transaction_detail" | "cash_in_cash_out" | "insights_dashboard" | "company_details" | "class_list" | "account_list" | "account_list_by_type" | "vendor" | "task_card" | "bill_pay" | "reimbursement" | "bill_pay_card" | "reimbursement_card" | "bill_pay_promo_card" | "zeni_accounts" | "charge_cards" | "reimbursement_promo_card" | "onboarding" | "operating_expenses_by_vendor" | "operating_expenses_by_vendor_summary" | "vendors_tab" | "accounts_payable_aging" | "accounts_receivable_aging" | "vendor_global_review";
3
+ reportId: "cash_balance" | "card_balance" | "operating_expenses" | "operating_expenses_by_classes" | "revenue" | "revenue_by_classes" | "net_burn_or_income" | "net_burn_or_income_story_card" | "net_burn_or_income_by_classes" | "cash_position" | "top_expenses" | "profit_and_loss" | "profit_and_loss_by_classes" | "balance_sheet" | "cash_flow" | "dashboard" | "finance_statement" | "transaction_list_of_account" | "transaction_list_missing_receipt" | "transaction_list_of_account_by_class" | "transaction_detail" | "cash_in_cash_out" | "insights_dashboard" | "company_details" | "class_list" | "account_list" | "account_list_by_type" | "vendor" | "task_card" | "bill_pay" | "reimbursement" | "bill_pay_card" | "reimbursement_card" | "bill_pay_promo_card" | "zeni_accounts" | "charge_cards" | "reimbursement_promo_card" | "onboarding" | "operating_expenses_by_vendor" | "operating_expenses_by_vendor_summary" | "vendors_tab" | "accounts_payable_aging" | "accounts_receivable_aging" | "vendor_global_review" | "prepaid_expenses";
4
4
  reportTitle: string;
5
5
  version: string | number | undefined;
6
6
  status: import("../..").Status | undefined;
@@ -5,7 +5,7 @@ import { AccountState } from '../../entity/account/accountState';
5
5
  import { EntityOrder } from '../../commonStateTypes/selectorTypes/selectorTypes';
6
6
  import { TopExReport, TopExTimePeriodWithMetaData } from './topExSelectorTypes';
7
7
  export declare const getTopExpenses: (accountState: AccountState, topExState: TopExState, numberOfExpenses?: number | undefined) => {
8
- reportId: "cash_balance" | "card_balance" | "operating_expenses" | "operating_expenses_by_classes" | "revenue" | "revenue_by_classes" | "net_burn_or_income" | "net_burn_or_income_story_card" | "net_burn_or_income_by_classes" | "cash_position" | "top_expenses" | "profit_and_loss" | "profit_and_loss_by_classes" | "balance_sheet" | "cash_flow" | "dashboard" | "finance_statement" | "transaction_list_of_account" | "transaction_list_missing_receipt" | "transaction_list_of_account_by_class" | "transaction_detail" | "cash_in_cash_out" | "insights_dashboard" | "company_details" | "class_list" | "account_list" | "account_list_by_type" | "vendor" | "task_card" | "bill_pay" | "reimbursement" | "bill_pay_card" | "reimbursement_card" | "bill_pay_promo_card" | "zeni_accounts" | "charge_cards" | "reimbursement_promo_card" | "onboarding" | "operating_expenses_by_vendor" | "operating_expenses_by_vendor_summary" | "vendors_tab" | "accounts_payable_aging" | "accounts_receivable_aging" | "vendor_global_review";
8
+ reportId: "cash_balance" | "card_balance" | "operating_expenses" | "operating_expenses_by_classes" | "revenue" | "revenue_by_classes" | "net_burn_or_income" | "net_burn_or_income_story_card" | "net_burn_or_income_by_classes" | "cash_position" | "top_expenses" | "profit_and_loss" | "profit_and_loss_by_classes" | "balance_sheet" | "cash_flow" | "dashboard" | "finance_statement" | "transaction_list_of_account" | "transaction_list_missing_receipt" | "transaction_list_of_account_by_class" | "transaction_detail" | "cash_in_cash_out" | "insights_dashboard" | "company_details" | "class_list" | "account_list" | "account_list_by_type" | "vendor" | "task_card" | "bill_pay" | "reimbursement" | "bill_pay_card" | "reimbursement_card" | "bill_pay_promo_card" | "zeni_accounts" | "charge_cards" | "reimbursement_promo_card" | "onboarding" | "operating_expenses_by_vendor" | "operating_expenses_by_vendor_summary" | "vendors_tab" | "accounts_payable_aging" | "accounts_receivable_aging" | "vendor_global_review" | "prepaid_expenses";
9
9
  reportTitle: string;
10
10
  version: string | number | undefined;
11
11
  status: import("../..").Status | undefined;
@@ -1,22 +1,19 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
6
3
  exports.initializeTransactionDetailLocalDataEpic = void 0;
7
4
  const rxjs_1 = require("rxjs");
8
- const get_1 = __importDefault(require("lodash/get"));
9
5
  const operators_1 = require("rxjs/operators");
10
6
  const transactionDetailReducer_1 = require("../transactionDetailReducer");
11
7
  const transactionDetailState_1 = require("../transactionDetailState");
12
8
  const transactionDetailLocalDataHelper_1 = require("../transactionDetailLocalDataHelper");
13
9
  const accountListSelector_1 = require("../../accountList/accountListSelector");
10
+ const transactionSelector_1 = require("../../../entity/transaction/transactionSelector");
14
11
  const initializeTransactionDetailLocalDataEpic = (actions$, state$) => actions$.pipe((0, operators_1.filter)(transactionDetailReducer_1.initializeTransactionDetailLocalData.match), (0, operators_1.mergeMap)((action) => {
15
12
  const { transactionId, vendorId } = action.payload;
16
13
  const fetchActions = [];
17
14
  const transactionState = state$.value.transactionState;
18
15
  const key = (0, transactionDetailState_1.getTransactionDetailKey)(transactionId);
19
- const detail = (0, get_1.default)(transactionState.transactionById, key, undefined);
16
+ const detail = (0, transactionSelector_1.getSupportedTransactionById)(transactionState, key);
20
17
  if (detail != null) {
21
18
  const uncategorizedIncomeExpense = (0, accountListSelector_1.getUncategorizedAccounts)(state$.value.accountState, state$.value.accountListState, 'accountList');
22
19
  const localData = (0, transactionDetailLocalDataHelper_1.toTransactionDetailLocalData)(detail, vendorId, uncategorizedIncomeExpense);
@@ -11,6 +11,7 @@ const transactionDetailReducer_1 = require("../transactionDetailReducer");
11
11
  const transactionDetailState_1 = require("../transactionDetailState");
12
12
  const saveTransactionHelper_1 = require("./saveTransactionHelper");
13
13
  const accountListSelector_1 = require("../../accountList/accountListSelector");
14
+ const transactionSelector_1 = require("../../../entity/transaction/transactionSelector");
14
15
  const saveTransactionDetailEpic = (actions$, state$) => actions$.pipe((0, operators_1.filter)(transactionDetailReducer_1.saveTransactionDetail.match), (0, operators_1.mergeMap)((action) => {
15
16
  const transactionId = action.payload.transactionId;
16
17
  const fetchActions = [];
@@ -18,7 +19,7 @@ const saveTransactionDetailEpic = (actions$, state$) => actions$.pipe((0, operat
18
19
  const transactionState = state$.value.transactionState;
19
20
  const key = (0, transactionDetailState_1.getTransactionDetailKey)(transactionId);
20
21
  const detail = (0, get_1.default)(transactionDetailState.transactionDetailById, key, undefined);
21
- const transaction = (0, get_1.default)(transactionState.transactionById, key, undefined);
22
+ const transaction = (0, transactionSelector_1.getSupportedTransactionById)(transactionState, key);
22
23
  if (detail != null && transaction != null) {
23
24
  const uncategorizedIncomeExpense = (0, accountListSelector_1.getUncategorizedAccounts)(state$.value.accountState, state$.value.accountListState, 'accountList');
24
25
  const localData = detail.transactionDetailLocalData;
@@ -21,12 +21,13 @@ const transactionVendorLocalDataHelper_1 = require("../../commonVendorView/trans
21
21
  const vendorPayload_1 = require("../../../entity/vendor/vendorPayload");
22
22
  const transactionType_1 = require("../../../entity/transaction/stateTypes/transactionType");
23
23
  const ownerListReducer_1 = require("../../ownerList/ownerListReducer");
24
+ const transactionSelector_1 = require("../../../entity/transaction/transactionSelector");
24
25
  const fetchTransactionDetailEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(transactionDetailReducer_1.fetchTransactionDetail.match), (0, operators_1.mergeMap)((action) => {
25
26
  const { transactionId, cacheOverride } = action.payload;
26
27
  const detailKey = (0, transactionDetailState_1.getTransactionDetailKey)(transactionId);
27
28
  const transactionActions = [];
28
29
  if (cacheOverride === true) {
29
- const transaction = (0, get_1.default)(state$.value.transactionState.transactionById, detailKey, undefined);
30
+ const transaction = (0, transactionSelector_1.getSupportedTransactionById)(state$.value.transactionState, detailKey);
30
31
  transactionActions.push(...removeCompleteTransaction(transactionId, transaction));
31
32
  }
32
33
  const transactionDetail = (0, get_1.default)(state$.value.transactionDetailState.transactionDetailById, detailKey, undefined);
@@ -123,7 +124,7 @@ function getAllFetchLinkedTransactionDetailActions(transactionPayload, state) {
123
124
  const linkedTransactionFiltered = linkedTransaction.filter((value) => isTransactionDetailInCacheOrFetching(value, state) === false);
124
125
  linkedTransactionFiltered.forEach((transactionDetailToFetch) => fetchLinkedTransactionActions.push((0, transactionDetailReducer_1.fetchTransactionDetail)(transactionDetailToFetch, false)));
125
126
  if (linkedTransactionFiltered.length === 0) {
126
- console.log('Phew all linked transacitons are fetched or there are no linked transactions..');
127
+ console.log('Phew all linked transactions are fetched or there are no linked transactions..');
127
128
  }
128
129
  return fetchLinkedTransactionActions;
129
130
  }
@@ -24,6 +24,7 @@ const recommendationPayload_1 = require("../../../commonPayloadTypes/recommendat
24
24
  const vendorSelector_1 = require("../../../entity/vendor/vendorSelector");
25
25
  const vendorReducer_1 = require("../../../entity/vendor/vendorReducer");
26
26
  const transactionType_1 = require("../../../entity/transaction/stateTypes/transactionType");
27
+ const transactionSelector_1 = require("../../../entity/transaction/transactionSelector");
27
28
  const updateTransactionDetailEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(transactionDetailReducer_1.updateTransactionDetail.match), (0, operators_1.mergeMap)((action) => {
28
29
  const { transactionState, vendorState, transactionDetailState } = state$.value;
29
30
  return zeniAPI
@@ -112,7 +113,7 @@ const updateTransactionDetailEpic = (actions$, state$, zeniAPI) => actions$.pipe
112
113
  exports.updateTransactionDetailEpic = updateTransactionDetailEpic;
113
114
  function preparePayload(transactionState, vendorState, transactionDetailState, transactionId, saveUpdates) {
114
115
  const transactionDetailKey = (0, transactionDetailState_1.getTransactionDetailKey)(transactionId);
115
- const detail = (0, get_1.default)(transactionState.transactionById, transactionDetailKey, undefined);
116
+ const detail = (0, transactionSelector_1.getSupportedTransactionById)(transactionState, transactionDetailKey);
116
117
  const tranDetail = (0, get_1.default)(transactionDetailState.transactionDetailById, transactionDetailKey, undefined);
117
118
  const tranVendorUpdates = tranDetail === null || tranDetail === void 0 ? void 0 : tranDetail.transactionDetailLocalData.vendorUpdates;
118
119
  let vendorUpdates = undefined;
@@ -12,6 +12,7 @@ const classListSelector_1 = require("../classList/classListSelector");
12
12
  const accountListSelector_1 = require("../accountList/accountListSelector");
13
13
  const zeniDayJS_1 = require("../../zeniDayJS");
14
14
  const vendorSelector_1 = require("../../entity/vendor/vendorSelector");
15
+ const transactionSelector_1 = require("../../entity/transaction/transactionSelector");
15
16
  const getTransactionDetail = (state, transactionId, fetchLinkedTransactions = true) => {
16
17
  var _a, _b;
17
18
  const { transactionDetailState, transactionState, vendorState, vendorListState, accountState, classState, classListState, accountListState, } = state;
@@ -21,7 +22,7 @@ const getTransactionDetail = (state, transactionId, fetchLinkedTransactions = tr
21
22
  fetchState: (_a = transactionDetail === null || transactionDetail === void 0 ? void 0 : transactionDetail.fetchState) !== null && _a !== void 0 ? _a : 'Not-Started',
22
23
  error: transactionDetail === null || transactionDetail === void 0 ? void 0 : transactionDetail.error,
23
24
  };
24
- const transaction = (0, get_1.default)(transactionState.transactionById, detailKey);
25
+ const transaction = (0, transactionSelector_1.getSupportedTransactionById)(transactionState, detailKey);
25
26
  let linkedTransactions = [];
26
27
  if ((transactionDetail === null || transactionDetail === void 0 ? void 0 : transactionDetail.fetchState) === 'Completed' && transaction != null) {
27
28
  // IMPORTANT: filtering out unsupported linked transactions
@@ -42,7 +43,7 @@ const getTransactionDetail = (state, transactionId, fetchLinkedTransactions = tr
42
43
  linkedTransactions = linkedTransactionDetails
43
44
  .map((linkedTranDetail) => {
44
45
  const key = (0, transactionDetailState_1.getTransactionDetailKey)(linkedTranDetail.transactionId); // eslint-disable-line @typescript-eslint/no-non-null-assertion
45
- return transactionState.transactionById[key];
46
+ return (0, transactionSelector_1.getSupportedTransactionById)(transactionState, key);
46
47
  })
47
48
  .filter((value) => {
48
49
  if (value == null) {
@@ -8,7 +8,7 @@ import { Transaction, TransactionID } from '../../entity/transaction/stateTypes/
8
8
  import { VendorBase } from '../../entity/vendor/vendorState';
9
9
  import { EntityRecommendationKey } from '../recommendation/recommendationState';
10
10
  import { TransactionDetailLocalData } from './transactionDetailTypes';
11
- export declare const getTransactionDetailKey: (transactionId: TransactionID) => string;
11
+ export declare const getTransactionDetailKey: (transactionId: TransactionID) => `${string}_expense` | `${string}_invoice` | `${string}_payment` | `${string}_credit_memo` | `${string}_sales_receipt` | `${string}_delayed_credit` | `${string}_delayed_charge` | `${string}_refund` | `${string}_check` | `${string}_bill` | `${string}_bill_payment` | `${string}_bill_payment_check` | `${string}_bill_payment_credit_card` | `${string}_vendor_credit` | `${string}_credit_card_credit` | `${string}_transfer` | `${string}_credit_card_payment` | `${string}_deposit` | `${string}_journal_entry`;
12
12
  export declare type TransactionDetailKey = ReturnType<typeof getTransactionDetailKey>;
13
13
  export declare function getAllLinkedTransactions(transaction: Transaction): TransactionID[];
14
14
  export interface SupportedTransactionDetail extends FetchedState {
@@ -1,23 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.initialSupportedTransactionDetail = exports.getAllLinkedTransactions = exports.getTransactionDetailKey = void 0;
4
- const getTransactionDetailKey = (transactionId) => `${getActualTransactionID(transactionId.id)}_${transactionId.type}`;
4
+ // This transaction key only extracts the third party ID and uses that
5
+ // for the ID
6
+ const getTransactionDetailKey = (transactionId) => `${transactionId.id}_${transactionId.type}`;
5
7
  exports.getTransactionDetailKey = getTransactionDetailKey;
6
- /**
7
- * Returns actual QBO transaction ID.
8
- * @param zeniGeneratedId zeni transaciton Id in the form of tran_<uuid>:<qbo_id>
9
- * @returns retruns the actual QBO transaction Id.
10
- * @note in case if the given transaction id itself is QBO id, the it just passes it back.
11
- */
12
- const getActualTransactionID = (zeniGeneratedId) => {
13
- const splittedIds = zeniGeneratedId.trim().split(':');
14
- if (splittedIds.length === 1) {
15
- return splittedIds[0];
16
- }
17
- else {
18
- return splittedIds[1];
19
- }
20
- };
21
8
  function getAllLinkedTransactions(transaction) {
22
9
  var _a, _b;
23
10
  const result = [];
@@ -10,6 +10,7 @@ const orderBy_1 = __importDefault(require("lodash/orderBy"));
10
10
  const parallelFetchAccountTransactionListEpic_1 = require("./parallelFetchAccountTransactionListEpic");
11
11
  const reduceTransactionListFetchState_1 = require("./reduceTransactionListFetchState");
12
12
  const transactionListState_1 = require("./transactionListState");
13
+ const transactionSelector_1 = require("../../entity/transaction/transactionSelector");
13
14
  const getTransactionListByAccount = (transactionState, transactionListState, accountId, accountType, timeframe, filterByTimePeriod) => {
14
15
  const timePeriods = (0, parallelFetchAccountTransactionListEpic_1.splitPeriod)(filterByTimePeriod); // Note: Split by months.
15
16
  const accountTransactions = timePeriods
@@ -27,7 +28,7 @@ const getTransactionListByAccount = (transactionState, transactionListState, acc
27
28
  if ((0, reduceTransactionListFetchState_1.isAnyFetchCompleted)(accountTransactions)) {
28
29
  const allTransactionIDs = (0, flatMap_1.default)(accountTransactions, (value) => value.transactionIDs);
29
30
  const transactionsUnsorted = allTransactionIDs
30
- .map((transactionId) => transactionState.transactionById[transactionId])
31
+ .map((transactionId) => (0, transactionSelector_1.getSupportedTransactionById)(transactionState, transactionId))
31
32
  .filter((value) => {
32
33
  if (value == null) {
33
34
  console.error("Can't have null transaction at this stage!");
@@ -10,6 +10,7 @@ const flatMap_1 = __importDefault(require("lodash/flatMap"));
10
10
  const transactionListState_1 = require("./transactionListState");
11
11
  const reduceTransactionListFetchState_1 = require("./reduceTransactionListFetchState");
12
12
  const parallelFetchAccountTransactionListEpic_1 = require("./parallelFetchAccountTransactionListEpic");
13
+ const transactionSelector_1 = require("../../entity/transaction/transactionSelector");
13
14
  const getTransactionsListByCategoryType = (transactionState, transactionListState, filterByTimePeriod, timeframe, transactionCategoryType) => {
14
15
  const timePeriods = (0, parallelFetchAccountTransactionListEpic_1.splitPeriod)(filterByTimePeriod); // Note: Split by months.
15
16
  const categoryTransactions = timePeriods
@@ -24,7 +25,7 @@ const getTransactionsListByCategoryType = (transactionState, transactionListStat
24
25
  if ((0, reduceTransactionListFetchState_1.isAnyFetchCompleted)(categoryTransactions)) {
25
26
  const allTransactionIDs = (0, flatMap_1.default)(categoryTransactions, (value) => value.transactionIDs);
26
27
  const transactionsUnsorted = allTransactionIDs
27
- .map((transactionId) => transactionState.transactionById[transactionId])
28
+ .map((transactionId) => (0, transactionSelector_1.getSupportedTransactionById)(transactionState, transactionId))
28
29
  .filter((value) => {
29
30
  if (value == null) {
30
31
  console.error("Can't have null transaction at this stage!");
@@ -10,6 +10,7 @@ const orderBy_1 = __importDefault(require("lodash/orderBy"));
10
10
  const parallelFetchAccountTransactionListEpic_1 = require("./parallelFetchAccountTransactionListEpic");
11
11
  const reduceTransactionListFetchState_1 = require("./reduceTransactionListFetchState");
12
12
  const transactionListState_1 = require("./transactionListState");
13
+ const transactionSelector_1 = require("../../entity/transaction/transactionSelector");
13
14
  const getTransactionListByClass = (transactionState, transactionListState, accountId, accountType, classId, timeframe, filterByTimePeriod) => {
14
15
  const timePeriods = (0, parallelFetchAccountTransactionListEpic_1.splitPeriod)(filterByTimePeriod); // Note: Split by months.
15
16
  const accountTransactions = timePeriods
@@ -27,7 +28,7 @@ const getTransactionListByClass = (transactionState, transactionListState, accou
27
28
  if ((0, reduceTransactionListFetchState_1.isAnyFetchCompleted)(accountTransactions)) {
28
29
  const allTransactionIDs = (0, flatMap_1.default)(accountTransactions, (value) => value.transactionIDs);
29
30
  const transactionsUnsorted = allTransactionIDs
30
- .map((transactionId) => transactionState.transactionById[transactionId])
31
+ .map((transactionId) => (0, transactionSelector_1.getSupportedTransactionById)(transactionState, transactionId))
31
32
  .filter((value) => {
32
33
  if (value == null) {
33
34
  console.error("Can't have null transaction at this stage!");
@@ -11,6 +11,7 @@ const timeframeTick_1 = require("../../commonStateTypes/timeframeTick");
11
11
  const parallelFetchAccountTransactionListEpic_1 = require("./parallelFetchAccountTransactionListEpic");
12
12
  const reduceTransactionListFetchState_1 = require("./reduceTransactionListFetchState");
13
13
  const transactionListState_1 = require("./transactionListState");
14
+ const transactionSelector_1 = require("../../entity/transaction/transactionSelector");
14
15
  const getTransactionListByEntity = (transactionState, transactionListState, filterByTimePeriod, entity) => {
15
16
  const timePeriods = (0, parallelFetchAccountTransactionListEpic_1.splitPeriod)((0, timeframeTick_1.toTimePeriod)(filterByTimePeriod)); // Note: Split by months.
16
17
  const entityTransactions = timePeriods
@@ -25,7 +26,7 @@ const getTransactionListByEntity = (transactionState, transactionListState, filt
25
26
  if ((0, reduceTransactionListFetchState_1.isAnyFetchCompleted)(entityTransactions)) {
26
27
  const allTransactionIDs = (0, flatMap_1.default)(entityTransactions, (value) => value.transactionIDs);
27
28
  const transactionsUnsorted = allTransactionIDs
28
- .map((transactionId) => transactionState.transactionById[transactionId])
29
+ .map((transactionId) => (0, transactionSelector_1.getSupportedTransactionById)(transactionState, transactionId))
29
30
  .filter((value) => {
30
31
  if (value == null) {
31
32
  console.error("Can't have null transaction at this stage!");
@@ -8,6 +8,9 @@ import { Vendor } from '../../entity/vendor/vendorState';
8
8
  import { RootState } from '../../reducer';
9
9
  import { ZeniDate } from '../../zeniDayJS';
10
10
  import { VendorListViewSortKey, VendorListViewYTDSpendSortKey, VendorViewUIState } from './vendorListState';
11
+ export declare const toVendorReportIDType: (v: string) => "operating_expenses_by_vendor" | "vendors_tab" | "prepaid_expenses";
12
+ export declare const toVendorReportIDTypeStrict: (v?: string | undefined) => "operating_expenses_by_vendor" | "vendors_tab" | "prepaid_expenses" | undefined;
13
+ export declare type VendorReportIDType = ReturnType<typeof toVendorReportIDType>;
11
14
  export interface VendorListSelectorView extends SelectorView {
12
15
  vendors: VendorListView[];
13
16
  uiState: VendorViewUIState;
@@ -1,10 +1,20 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isVendorsTabVisible = exports.isColumnYTDSpend = exports.getVendorList = void 0;
3
+ exports.isVendorsTabVisible = exports.isColumnYTDSpend = exports.getVendorList = exports.toVendorReportIDTypeStrict = exports.toVendorReportIDType = void 0;
4
4
  const accountSelector_1 = require("../../entity/account/accountSelector");
5
5
  const classSelector_1 = require("../../entity/class/classSelector");
6
6
  const userSelector_1 = require("../../entity/user/userSelector");
7
7
  const vendorSelector_1 = require("../../entity/vendor/vendorSelector");
8
+ const stringToUnion_1 = require("../../commonStateTypes/stringToUnion");
9
+ const ALL_VENDOR_REPORT_ID_TYPES = [
10
+ 'operating_expenses_by_vendor',
11
+ 'vendors_tab',
12
+ 'prepaid_expenses',
13
+ ];
14
+ const toVendorReportIDType = (v) => (0, stringToUnion_1.stringToUnion)(v, ALL_VENDOR_REPORT_ID_TYPES);
15
+ exports.toVendorReportIDType = toVendorReportIDType;
16
+ const toVendorReportIDTypeStrict = (v) => (0, stringToUnion_1.stringToUnionStrict)(v !== null && v !== void 0 ? v : '', ALL_VENDOR_REPORT_ID_TYPES);
17
+ exports.toVendorReportIDTypeStrict = toVendorReportIDTypeStrict;
8
18
  const getVendorList = (state, view) => {
9
19
  var _a;
10
20
  const { vendorListState, vendorState, accountState, classState, userState } = state;
@@ -3,8 +3,8 @@ import { SortOrder } from '../../../commonStateTypes/selectorTypes/sortOrderType
3
3
  import { PageToken } from '../../../commonStateTypes/viewAndReport/viewAndReport';
4
4
  import { RecommendedNonExistingGlobalMerchant } from '../vendorFirstReviewView/vendorFirstReviewViewState';
5
5
  export declare const VENDOR_GLOBAL_REVIEW_COLUMN_SORT_KEYS: readonly ["tenants", "vendors", "updatedFrom", "recommended"];
6
- export declare const toVendorGlobalReviewColumnSortKeyType: (v: string) => "vendors" | "tenants" | "updatedFrom" | "recommended";
7
- export declare const toVendorGlobalReviewColumnSortKeyTypeStrict: (v: string) => "vendors" | "tenants" | "updatedFrom" | "recommended" | undefined;
6
+ export declare const toVendorGlobalReviewColumnSortKeyType: (v: string) => "vendors" | "recommended" | "tenants" | "updatedFrom";
7
+ export declare const toVendorGlobalReviewColumnSortKeyTypeStrict: (v: string) => "vendors" | "recommended" | "tenants" | "updatedFrom" | undefined;
8
8
  export declare type VendorGlobalReviewViewColumnSortKey = ReturnType<typeof toVendorGlobalReviewColumnSortKeyType>;
9
9
  export interface VendorGlobalReviewViewUIState {
10
10
  searchText: string;
@@ -24,6 +24,7 @@ export declare function date(dateStringISO: string, format?: string): ZeniDate;
24
24
  export declare function dateInUTC(dateStringISO: string): ZeniDate;
25
25
  export declare function dateLocal(dateStringISO: string): ZeniDate;
26
26
  export declare function dateNow(): ZeniDate;
27
+ export declare function dateFromYearMonthDate(year: number, month: number, day?: number): ZeniDate;
27
28
  export declare function getBusinessDayOfDate(date: ZeniDate): number;
28
29
  export declare function setLocalTimezone(timezone: string): void;
29
30
  export declare function getLocalTimezone(): string;