@zeniai/client-epic-state 5.2.7-betaRD1 → 5.2.8

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 (151) hide show
  1. package/lib/entity/invoicing/invoicingCommonPayload.d.ts +22 -0
  2. package/lib/entity/invoicing/invoicingCommonPayload.js +51 -10
  3. package/lib/entity/jeSchedules/jeScheduleHelper.d.ts +0 -1
  4. package/lib/entity/jeSchedules/jeScheduleHelper.js +0 -7
  5. package/lib/entity/jeSchedules/jeSchedulesPayload.d.ts +1 -66
  6. package/lib/entity/jeSchedules/jeSchedulesPayload.js +0 -135
  7. package/lib/entity/jeSchedules/jeSchedulesReducer.d.ts +2 -4
  8. package/lib/entity/jeSchedules/jeSchedulesReducer.js +2 -30
  9. package/lib/entity/jeSchedules/jeSchedulesSelector.d.ts +2 -11
  10. package/lib/entity/jeSchedules/jeSchedulesSelector.js +3 -38
  11. package/lib/entity/jeSchedules/jeSchedulesState.d.ts +1 -79
  12. package/lib/entity/jeSchedules/jeSchedulesTypes.d.ts +1 -24
  13. package/lib/entity/jeSchedules/jeSchedulesTypes.js +1 -88
  14. package/lib/entity/snackbar/snackbarTypes.d.ts +1 -1
  15. package/lib/entity/snackbar/snackbarTypes.js +0 -3
  16. package/lib/entity/transaction/payloadTypes/scheduleTransactionPayload.d.ts +0 -2
  17. package/lib/entity/transaction/payloadTypes/scheduleTransactionPayload.js +0 -2
  18. package/lib/entity/transaction/stateTypes/scheduleTransaction.d.ts +0 -2
  19. package/lib/epic.d.ts +1 -9
  20. package/lib/epic.js +0 -16
  21. package/lib/esm/entity/invoicing/invoicingCommonPayload.js +51 -10
  22. package/lib/esm/entity/jeSchedules/jeScheduleHelper.js +0 -6
  23. package/lib/esm/entity/jeSchedules/jeSchedulesPayload.js +1 -135
  24. package/lib/esm/entity/jeSchedules/jeSchedulesReducer.js +2 -30
  25. package/lib/esm/entity/jeSchedules/jeSchedulesSelector.js +2 -36
  26. package/lib/esm/entity/jeSchedules/jeSchedulesTypes.js +0 -78
  27. package/lib/esm/entity/snackbar/snackbarTypes.js +0 -3
  28. package/lib/esm/entity/transaction/payloadTypes/scheduleTransactionPayload.js +0 -2
  29. package/lib/esm/epic.js +0 -16
  30. package/lib/esm/index.js +8 -14
  31. package/lib/esm/view/accountList/accountListReducer.js +0 -1
  32. package/lib/esm/view/expenseAutomationView/epics/common/fetchAllExpenseAutomationTabsEpic.js +3 -6
  33. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulesEpic.js +5 -41
  34. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/ignoreRecommendedJeScheduleEpic.js +2 -14
  35. package/lib/esm/view/expenseAutomationView/payload/jeSchedulesPayload.js +0 -55
  36. package/lib/esm/view/expenseAutomationView/reducers/jeSchedulesViewReducer.js +29 -306
  37. package/lib/esm/view/expenseAutomationView/selectors/jeSchedulesViewSelector.js +22 -294
  38. package/lib/esm/view/expenseAutomationView/types/jeSchedulesViewState.js +6 -5
  39. package/lib/esm/view/invoicing/editInvoicingCatalogItemDetailView/editInvoicingCatalogItemDetailViewSelector.js +2 -1
  40. package/lib/esm/view/invoicing/invoicingConfigView/invoicingConfigViewSelector.js +2 -0
  41. package/lib/esm/view/invoicing/invoicingQboView/epics/fetchInvoicingAccountingPickersEpic.js +10 -5
  42. package/lib/esm/view/invoicing/invoicingQboView/invoicingQboViewSelector.js +27 -3
  43. package/lib/esm/view/invoicing/settingsView/settingsViewSelector.js +7 -3
  44. package/lib/esm/view/scheduleView/scheduleListView/epics/fetchAccruedScheduleListEpic.js +1 -1
  45. package/lib/esm/view/scheduleView/scheduleListView/epics/fetchDownloadSchedulesEpic.js +2 -7
  46. package/lib/esm/view/scheduleView/scheduleListView/scheduleListReducer.js +3 -5
  47. package/lib/index.d.ts +12 -17
  48. package/lib/index.js +47 -91
  49. package/lib/view/accountList/accountListReducer.js +0 -1
  50. package/lib/view/accountList/accountListState.d.ts +1 -1
  51. package/lib/view/expenseAutomationView/epics/common/fetchAllExpenseAutomationTabsEpic.js +3 -6
  52. package/lib/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulesEpic.d.ts +2 -3
  53. package/lib/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulesEpic.js +3 -39
  54. package/lib/view/expenseAutomationView/epics/jeSchedule/ignoreRecommendedJeScheduleEpic.js +2 -14
  55. package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.d.ts +1 -1
  56. package/lib/view/expenseAutomationView/payload/jeSchedulesPayload.d.ts +3 -72
  57. package/lib/view/expenseAutomationView/payload/jeSchedulesPayload.js +1 -58
  58. package/lib/view/expenseAutomationView/reducers/jeSchedulesViewReducer.d.ts +12 -91
  59. package/lib/view/expenseAutomationView/reducers/jeSchedulesViewReducer.js +29 -308
  60. package/lib/view/expenseAutomationView/reducers/missingReceiptsViewReducer.d.ts +1 -1
  61. package/lib/view/expenseAutomationView/reducers/transactionsViewReducer.d.ts +2 -2
  62. package/lib/view/expenseAutomationView/selectorTypes/jeSchedulesSelectorTypes.d.ts +7 -36
  63. package/lib/view/expenseAutomationView/selectors/jeSchedulesViewSelector.d.ts +0 -34
  64. package/lib/view/expenseAutomationView/selectors/jeSchedulesViewSelector.js +21 -302
  65. package/lib/view/expenseAutomationView/types/completedSubTab.d.ts +1 -1
  66. package/lib/view/expenseAutomationView/types/jeSchedulesViewState.d.ts +8 -82
  67. package/lib/view/expenseAutomationView/types/jeSchedulesViewState.js +8 -8
  68. package/lib/view/expenseAutomationView/types/reconciliationViewState.d.ts +1 -1
  69. package/lib/view/invoicing/editInvoicingCatalogItemDetailView/editInvoicingCatalogItemDetailViewSelector.d.ts +5 -0
  70. package/lib/view/invoicing/editInvoicingCatalogItemDetailView/editInvoicingCatalogItemDetailViewSelector.js +1 -0
  71. package/lib/view/invoicing/invoicingConfigView/invoicingConfigViewSelector.d.ts +1 -0
  72. package/lib/view/invoicing/invoicingConfigView/invoicingConfigViewSelector.js +2 -0
  73. package/lib/view/invoicing/invoicingQboView/epics/fetchInvoicingAccountingPickersEpic.js +10 -5
  74. package/lib/view/invoicing/invoicingQboView/invoicingQboViewSelector.d.ts +9 -1
  75. package/lib/view/invoicing/invoicingQboView/invoicingQboViewSelector.js +30 -4
  76. package/lib/view/invoicing/settingsView/settingsViewSelector.d.ts +11 -4
  77. package/lib/view/invoicing/settingsView/settingsViewSelector.js +7 -3
  78. package/lib/view/scheduleView/scheduleListView/epics/fetchAccruedScheduleListEpic.js +1 -1
  79. package/lib/view/scheduleView/scheduleListView/epics/fetchDownloadSchedulesEpic.js +2 -7
  80. package/lib/view/scheduleView/scheduleListView/scheduleListReducer.d.ts +2 -4
  81. package/lib/view/scheduleView/scheduleListView/scheduleListReducer.js +3 -5
  82. package/package.json +1 -1
  83. package/lib/commonStateTypes/selectorTypes/pickAndMergeForecastSection.d.ts +0 -0
  84. package/lib/commonStateTypes/selectorTypes/pickAndMergeForecastSection.js +0 -1
  85. package/lib/entity/invoicing/coupon/couponConstants.d.ts +0 -11
  86. package/lib/entity/invoicing/coupon/couponConstants.js +0 -29
  87. package/lib/esm/commonStateTypes/selectorTypes/pickAndMergeForecastSection.js +0 -1
  88. package/lib/esm/entity/invoicing/coupon/couponConstants.js +0 -26
  89. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/fetchOneTimeAccrualEpic.js +0 -45
  90. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/newSchedule/createOneTimeAccrualEpic.js +0 -81
  91. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/newSchedule/initializeNewScheduleEpic.js +0 -25
  92. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/newSchedule/saveNewScheduleEpic.js +0 -110
  93. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/newSchedule/searchTransactionsForNewScheduleEpic.js +0 -79
  94. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/oneTimeAccrualActionsEpic.js +0 -139
  95. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/revertJeScheduleEpic.js +0 -106
  96. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/switchJESchedulesTabEpic.js +0 -22
  97. package/lib/esm/view/expenseAutomationView/helpers/newScheduleLocalDataHelper.js +0 -140
  98. package/lib/esm/view/expenseAutomationView/selectorTypes/jeNewScheduleViewSelectorTypes.js +0 -1
  99. package/lib/esm/view/expenseAutomationView/selectors/jeNewScheduleViewSelector.js +0 -106
  100. package/lib/esm/view/invoicing/invoicingQboView/epics/fetchInvoicingQboAccountsEpic.js +0 -25
  101. package/lib/esm/view/invoicing/invoicingQboView/epics/fetchInvoicingQboClassesEpic.js +0 -15
  102. package/lib/esm/view/spendManagement/treasury/treasurySetUp/epic/updateTreasuryPromoIntroClosedByOutsideClickEpic.js +0 -18
  103. package/lib/esm/view/spendManagement/treasury/treasurySetUp/epic/updateTreasuryPromoRemindMeLaterClickedEpic.js +0 -18
  104. package/lib/esm/view/spendManagement/treasury/treasurySetUp/epic/updateTreasuryVideoViewedEpic.js +0 -18
  105. package/lib/esm/view/zeniAccountsPromoCard/zeniAccountsPromoCardEpic.js +0 -16
  106. package/lib/esm/view/zeniAccountsPromoCard/zeniAccountsPromoCardPayload.js +0 -1
  107. package/lib/esm/view/zeniAccountsPromoCard/zeniAccountsPromoCardReducer.js +0 -60
  108. package/lib/esm/view/zeniAccountsPromoCard/zeniAccountsPromoCardSelector.js +0 -12
  109. package/lib/esm/view/zeniAccountsPromoCard/zeniAccountsPromoCardState.js +0 -1
  110. package/lib/view/expenseAutomationView/epics/jeSchedule/fetchOneTimeAccrualEpic.d.ts +0 -20
  111. package/lib/view/expenseAutomationView/epics/jeSchedule/fetchOneTimeAccrualEpic.js +0 -49
  112. package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/createOneTimeAccrualEpic.d.ts +0 -8
  113. package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/createOneTimeAccrualEpic.js +0 -85
  114. package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/initializeNewScheduleEpic.d.ts +0 -8
  115. package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/initializeNewScheduleEpic.js +0 -29
  116. package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/saveNewScheduleEpic.d.ts +0 -45
  117. package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/saveNewScheduleEpic.js +0 -114
  118. package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/searchTransactionsForNewScheduleEpic.d.ts +0 -8
  119. package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/searchTransactionsForNewScheduleEpic.js +0 -83
  120. package/lib/view/expenseAutomationView/epics/jeSchedule/oneTimeAccrualActionsEpic.d.ts +0 -12
  121. package/lib/view/expenseAutomationView/epics/jeSchedule/oneTimeAccrualActionsEpic.js +0 -146
  122. package/lib/view/expenseAutomationView/epics/jeSchedule/revertJeScheduleEpic.d.ts +0 -64
  123. package/lib/view/expenseAutomationView/epics/jeSchedule/revertJeScheduleEpic.js +0 -110
  124. package/lib/view/expenseAutomationView/epics/jeSchedule/switchJESchedulesTabEpic.d.ts +0 -6
  125. package/lib/view/expenseAutomationView/epics/jeSchedule/switchJESchedulesTabEpic.js +0 -26
  126. package/lib/view/expenseAutomationView/helpers/newScheduleLocalDataHelper.d.ts +0 -36
  127. package/lib/view/expenseAutomationView/helpers/newScheduleLocalDataHelper.js +0 -145
  128. package/lib/view/expenseAutomationView/selectorTypes/jeNewScheduleViewSelectorTypes.d.ts +0 -42
  129. package/lib/view/expenseAutomationView/selectorTypes/jeNewScheduleViewSelectorTypes.js +0 -2
  130. package/lib/view/expenseAutomationView/selectors/jeNewScheduleViewSelector.d.ts +0 -21
  131. package/lib/view/expenseAutomationView/selectors/jeNewScheduleViewSelector.js +0 -112
  132. package/lib/view/invoicing/invoicingQboView/epics/fetchInvoicingQboAccountsEpic.d.ts +0 -6
  133. package/lib/view/invoicing/invoicingQboView/epics/fetchInvoicingQboAccountsEpic.js +0 -29
  134. package/lib/view/invoicing/invoicingQboView/epics/fetchInvoicingQboClassesEpic.d.ts +0 -6
  135. package/lib/view/invoicing/invoicingQboView/epics/fetchInvoicingQboClassesEpic.js +0 -19
  136. package/lib/view/spendManagement/treasury/treasurySetUp/epic/updateTreasuryPromoIntroClosedByOutsideClickEpic.d.ts +0 -8
  137. package/lib/view/spendManagement/treasury/treasurySetUp/epic/updateTreasuryPromoIntroClosedByOutsideClickEpic.js +0 -22
  138. package/lib/view/spendManagement/treasury/treasurySetUp/epic/updateTreasuryPromoRemindMeLaterClickedEpic.d.ts +0 -8
  139. package/lib/view/spendManagement/treasury/treasurySetUp/epic/updateTreasuryPromoRemindMeLaterClickedEpic.js +0 -22
  140. package/lib/view/spendManagement/treasury/treasurySetUp/epic/updateTreasuryVideoViewedEpic.d.ts +0 -8
  141. package/lib/view/spendManagement/treasury/treasurySetUp/epic/updateTreasuryVideoViewedEpic.js +0 -22
  142. package/lib/view/zeniAccountsPromoCard/zeniAccountsPromoCardEpic.d.ts +0 -13
  143. package/lib/view/zeniAccountsPromoCard/zeniAccountsPromoCardEpic.js +0 -20
  144. package/lib/view/zeniAccountsPromoCard/zeniAccountsPromoCardPayload.d.ts +0 -11
  145. package/lib/view/zeniAccountsPromoCard/zeniAccountsPromoCardPayload.js +0 -2
  146. package/lib/view/zeniAccountsPromoCard/zeniAccountsPromoCardReducer.d.ts +0 -7
  147. package/lib/view/zeniAccountsPromoCard/zeniAccountsPromoCardReducer.js +0 -64
  148. package/lib/view/zeniAccountsPromoCard/zeniAccountsPromoCardSelector.d.ts +0 -12
  149. package/lib/view/zeniAccountsPromoCard/zeniAccountsPromoCardSelector.js +0 -15
  150. package/lib/view/zeniAccountsPromoCard/zeniAccountsPromoCardState.d.ts +0 -9
  151. package/lib/view/zeniAccountsPromoCard/zeniAccountsPromoCardState.js +0 -2
@@ -88,12 +88,34 @@ export interface InvoicingStripeAccountPayload {
88
88
  export declare const INVOICING_QBO_CUSTOMER_MATCHING_MODES: readonly ["link_existing", "always_create"];
89
89
  export type InvoicingQboCustomerMatchingMode = (typeof INVOICING_QBO_CUSTOMER_MATCHING_MODES)[number];
90
90
  export declare function toInvoicingQboCustomerMatchingMode(value: string): InvoicingQboCustomerMatchingMode;
91
+ /**
92
+ * A mapped account as the newer settings payload returns it: the platform id,
93
+ * plus hydrated fields the client only displays.
94
+ */
95
+ export interface InvoicingQboMappedAccountPayload {
96
+ account_id?: string | null;
97
+ account_name?: string | null;
98
+ fully_qualified_name?: string | null;
99
+ qbo_id?: string | null;
100
+ }
101
+ /**
102
+ * Account mappings arrive in two shapes. The original sends a bare id per slot
103
+ * (`deposit_account_id`); the newer one sends an object holding the platform id
104
+ * (`deposit_account: {account_id}`). Both are declared because a tenant can be
105
+ * served either depending on when its backend rolled, and a page that understands
106
+ * only one renders an empty picker over data that exists.
107
+ */
91
108
  export interface InvoicingQboAccountMappingsPayload {
109
+ default_income_account?: InvoicingQboMappedAccountPayload | null;
92
110
  default_income_account_id?: string | null;
111
+ deposit_account?: InvoicingQboMappedAccountPayload | null;
93
112
  deposit_account_id?: string | null;
94
113
  deposit_account_overrides?: Record<string, string> | null;
114
+ discounts_account?: InvoicingQboMappedAccountPayload | null;
95
115
  discounts_account_id?: string | null;
116
+ rounding_account?: InvoicingQboMappedAccountPayload | null;
96
117
  rounding_account_id?: string | null;
118
+ write_off_account?: InvoicingQboMappedAccountPayload | null;
97
119
  write_off_account_id?: string | null;
98
120
  }
99
121
  /**
@@ -153,6 +153,23 @@ function toInvoicingQboCustomerMatchingMode(value) {
153
153
  throw new Error(`Unknown InvoicingQboCustomerMatchingMode: ${value}`);
154
154
  }
155
155
  }
156
+ /**
157
+ * The id for one mapping slot, from whichever shape the backend sent. The object
158
+ * form wins when present; a blank id in either is treated as unset so the picker
159
+ * shows its placeholder rather than selecting nothing.
160
+ */
161
+ function readInvoicingQboMappedAccountId(mappedAccount, legacyAccountId) {
162
+ // `qbo_id` first: the pickers key their options on the QuickBooks id, so an
163
+ // internal `account_id` would not select anything even when it is the same
164
+ // account. Both are read because the mapping arrives either way depending on
165
+ // how it was saved.
166
+ const candidates = [
167
+ mappedAccount?.qbo_id,
168
+ mappedAccount?.account_id,
169
+ legacyAccountId,
170
+ ];
171
+ return candidates.find((candidate) => candidate != null && candidate !== '');
172
+ }
156
173
  /**
157
174
  * Read one account-mapping dropdown value by its config `code` (the codes in
158
175
  * `qbo_account_mapping_kind_options` match the `account_mappings` field names).
@@ -160,15 +177,15 @@ function toInvoicingQboCustomerMatchingMode(value) {
160
177
  function getInvoicingQboAccountMappingId(accountMappings, code) {
161
178
  switch (code) {
162
179
  case 'deposit_account_id':
163
- return accountMappings?.deposit_account_id ?? undefined;
180
+ return readInvoicingQboMappedAccountId(accountMappings?.deposit_account, accountMappings?.deposit_account_id);
164
181
  case 'default_income_account_id':
165
- return accountMappings?.default_income_account_id ?? undefined;
182
+ return readInvoicingQboMappedAccountId(accountMappings?.default_income_account, accountMappings?.default_income_account_id);
166
183
  case 'discounts_account_id':
167
- return accountMappings?.discounts_account_id ?? undefined;
184
+ return readInvoicingQboMappedAccountId(accountMappings?.discounts_account, accountMappings?.discounts_account_id);
168
185
  case 'rounding_account_id':
169
- return accountMappings?.rounding_account_id ?? undefined;
186
+ return readInvoicingQboMappedAccountId(accountMappings?.rounding_account, accountMappings?.rounding_account_id);
170
187
  case 'write_off_account_id':
171
- return accountMappings?.write_off_account_id ?? undefined;
188
+ return readInvoicingQboMappedAccountId(accountMappings?.write_off_account, accountMappings?.write_off_account_id);
172
189
  default:
173
190
  return undefined;
174
191
  }
@@ -178,18 +195,42 @@ function getInvoicingQboAccountMappingId(accountMappings, code) {
178
195
  * `code` set to `accountId`. Unknown codes leave the mappings unchanged.
179
196
  */
180
197
  function withInvoicingQboAccountMappingId(accountMappings, code, accountId) {
198
+ // Both slots are written together. Setting only the bare id would leave the
199
+ // object shape behind, and the reader prefers it — so the selection just made
200
+ // would read back as whatever was mapped before. The object is dropped rather
201
+ // than rebuilt: only the id is known here, not the name that came with it.
181
202
  const base = accountMappings ?? {};
182
203
  switch (code) {
183
204
  case 'deposit_account_id':
184
- return { ...base, deposit_account_id: accountId };
205
+ return {
206
+ ...base,
207
+ deposit_account: undefined,
208
+ deposit_account_id: accountId,
209
+ };
185
210
  case 'default_income_account_id':
186
- return { ...base, default_income_account_id: accountId };
211
+ return {
212
+ ...base,
213
+ default_income_account: undefined,
214
+ default_income_account_id: accountId,
215
+ };
187
216
  case 'discounts_account_id':
188
- return { ...base, discounts_account_id: accountId };
217
+ return {
218
+ ...base,
219
+ discounts_account: undefined,
220
+ discounts_account_id: accountId,
221
+ };
189
222
  case 'rounding_account_id':
190
- return { ...base, rounding_account_id: accountId };
223
+ return {
224
+ ...base,
225
+ rounding_account: undefined,
226
+ rounding_account_id: accountId,
227
+ };
191
228
  case 'write_off_account_id':
192
- return { ...base, write_off_account_id: accountId };
229
+ return {
230
+ ...base,
231
+ write_off_account: undefined,
232
+ write_off_account_id: accountId,
233
+ };
193
234
  default:
194
235
  return base;
195
236
  }
@@ -1,3 +1,2 @@
1
1
  import { ID } from '../../commonStateTypes/common';
2
2
  export declare function generateJEScheduleKey(jeScheduleId: ID, jeScheduleType: string): `${string}_${string}`;
3
- export declare function generateJEOneTimeAccrualKey(accrualId: ID): `${string}_one_time_accrual`;
@@ -1,13 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.generateJEScheduleKey = generateJEScheduleKey;
4
- exports.generateJEOneTimeAccrualKey = generateJEOneTimeAccrualKey;
5
4
  function generateJEScheduleKey(jeScheduleId, jeScheduleType) {
6
5
  return `${jeScheduleId}_${jeScheduleType}`;
7
6
  }
8
- // Suffixed rather than using the bare Mongo _id so the key is a distinct type from
9
- // JEScheduleKey / JEScheduleTransactionKey and the three cannot be passed interchangeably.
10
- // The unsuffixed id stays on the entity as `accrualId` for callers that need it.
11
- function generateJEOneTimeAccrualKey(accrualId) {
12
- return `${accrualId}_one_time_accrual`;
13
- }
@@ -7,7 +7,7 @@ import { TransactionIDPayload } from '../transaction/payloadTypes/transactionIDP
7
7
  import { TransactionCategory } from '../transaction/stateTypes/transactionType';
8
8
  import { UserPayload } from '../user/userPayload';
9
9
  import { VendorPayload } from '../vendor/vendorPayload';
10
- import { JEAccruedScheduledTransactionState, JEOneTimeAccrualState, JEScheduledTransactionState, ScheduledJournalEntryState } from './jeSchedulesState';
10
+ import { JEAccruedScheduledTransactionState, JEScheduledTransactionState, ScheduledJournalEntryState } from './jeSchedulesState';
11
11
  import { JEScheduleKey, JEScheduleTransactionKey } from './jeSchedulesTypes';
12
12
  export interface JEScheduleOtherAttributesPayload {
13
13
  asset_id?: string | null;
@@ -72,13 +72,9 @@ export interface JEScheduledTransactionPayload {
72
72
  updated_by: UserPayload;
73
73
  vendor: VendorPayload;
74
74
  ai_summaries?: JEScheduleAISummariesPayload;
75
- confidence_score?: number | null;
76
- create_time?: string | null;
77
75
  created_by?: UserPayload;
78
76
  end_date?: string | null;
79
- posted_count?: number | null;
80
77
  recommendations?: JEScheduleRecommendationsPayload;
81
- recurring_amount?: number | null;
82
78
  updated_at?: string | null;
83
79
  }
84
80
  export interface JEAccruedScheduledTransactionPayload extends Omit<JEScheduledTransactionPayload, 'base_transaction' | 'je_schedule_id' | 'je_schedule_type'> {
@@ -88,66 +84,6 @@ export interface JEAccruedScheduledTransactionPayload extends Omit<JEScheduledTr
88
84
  memo: string;
89
85
  recurring_amount: number;
90
86
  }
91
- /**
92
- * The frozen vendor profile the Cron used to decide an accrual, so the detail page can show its
93
- * reasoning even after the live profile is rebuilt. Present on agent/Cron rows ONLY — a human-created
94
- * accrual carries none, which is why every consumer has to treat it as absent rather than empty.
95
- */
96
- export interface JEOneTimeAccrualProfileSnapshotPayload {
97
- billing_pattern?: {
98
- avg_amount?: number | null;
99
- billing_lag_days?: number | null;
100
- consistency_score?: number | null;
101
- frequency?: string | null;
102
- last_bill_amount?: number | null;
103
- last_bill_date?: string | null;
104
- months_of_history?: number | null;
105
- typical_bill_day?: number | null;
106
- } | null;
107
- monthly_totals?: Record<string, number> | null;
108
- sorted_months?: string[] | null;
109
- }
110
- /** The JE the AI originally suggested, frozen at draft time for suggested-vs-posted comparison. */
111
- export interface JEOneTimeAccrualAiSuggestionPayload {
112
- estimated_amount?: number | null;
113
- je_credit_account_id?: ID | null;
114
- je_credit_account_name?: string | null;
115
- je_debit_account_id?: ID | null;
116
- je_debit_account_name?: string | null;
117
- memo?: string | null;
118
- }
119
- export interface JEOneTimeAccrualPayload {
120
- _id: ID;
121
- estimated_amount: number;
122
- origin: string;
123
- service_month: string;
124
- status: string;
125
- vendor_id: ID;
126
- vendor_name: string;
127
- actual_post_date?: string | null;
128
- actual_reversal_post_date?: string | null;
129
- ai_suggestion?: JEOneTimeAccrualAiSuggestionPayload | null;
130
- automation_tier?: string | null;
131
- created_by_user?: UserPayload | null;
132
- currency?: string | null;
133
- expected_reversal_date?: string | null;
134
- je_credit_account_id?: ID | null;
135
- je_credit_account_name?: string | null;
136
- je_credit_accounting_class_id?: ID | null;
137
- je_credit_accounting_class_name?: string | null;
138
- je_debit_account_id?: ID | null;
139
- je_debit_account_name?: string | null;
140
- je_debit_accounting_class_id?: ID | null;
141
- je_debit_accounting_class_name?: string | null;
142
- memo?: string | null;
143
- posting_date?: string | null;
144
- profile_snapshot?: JEOneTimeAccrualProfileSnapshotPayload | null;
145
- reversal_policy?: string | null;
146
- reversal_transaction_id?: ID | null;
147
- reversal_trigger?: string | null;
148
- transaction_id?: ID | null;
149
- transaction_integration_id?: ID | null;
150
- }
151
87
  export interface ScheduledJournalEntryPayload {
152
88
  actual_post_date: string | null;
153
89
  create_time: string | null;
@@ -178,4 +114,3 @@ export declare function getJEScheduleTransactionDetailKeyPayload(payload: Schedu
178
114
  export declare function getJEScheduleKey(payload: JEAccruedScheduledTransactionPayload): JEScheduleKey;
179
115
  export declare function toJEScheduledTransaction(payload: JEScheduledTransactionPayload): JEScheduledTransactionState;
180
116
  export declare function toJEAccruedScheduledTransaction(payload: JEAccruedScheduledTransactionPayload): JEAccruedScheduledTransactionState;
181
- export declare function toJEOneTimeAccrual(payload: JEOneTimeAccrualPayload): JEOneTimeAccrualState;
@@ -8,15 +8,12 @@ exports.getJEScheduleTransactionDetailKeyPayload = getJEScheduleTransactionDetai
8
8
  exports.getJEScheduleKey = getJEScheduleKey;
9
9
  exports.toJEScheduledTransaction = toJEScheduledTransaction;
10
10
  exports.toJEAccruedScheduledTransaction = toJEAccruedScheduledTransaction;
11
- exports.toJEOneTimeAccrual = toJEOneTimeAccrual;
12
11
  const amount_1 = require("../../commonStateTypes/amount");
13
12
  const timePeriod_1 = require("../../commonStateTypes/timePeriod");
14
13
  const zeniDayJS_1 = require("../../zeniDayJS");
15
- const zeniUrl_1 = require("../../zeniUrl");
16
14
  const transactionIDPayload_1 = require("../transaction/payloadTypes/transactionIDPayload");
17
15
  const jeScheduleHelper_1 = require("./jeScheduleHelper");
18
16
  const jeSchedulesTypes_1 = require("./jeSchedulesTypes");
19
- const USD_CURRENCY_CODE = 'USD';
20
17
  function toScheduledJournalEntryState(payload, currency_code, currency_symbol) {
21
18
  return {
22
19
  status: {
@@ -261,18 +258,9 @@ function toJEScheduledTransaction(payload) {
261
258
  startDate: payload.start_date != null ? (0, zeniDayJS_1.date)(payload.start_date) : undefined,
262
259
  endDate: payload.end_date != null ? (0, zeniDayJS_1.date)(payload.end_date) : undefined,
263
260
  period: payload.period != null ? Number(payload.period) : undefined,
264
- recurringAmount: payload.recurring_amount != null
265
- ? {
266
- amount: payload.recurring_amount,
267
- currencyCode: payload.currency_code,
268
- currencySymbol: payload.currency_symbol,
269
- }
270
- : undefined,
271
- postedCount: payload.posted_count ?? undefined,
272
261
  updatedByUserID: payload.updated_by.user_id,
273
262
  balanceAsOfToday: payload.balance ?? undefined,
274
263
  updatedAt: payload.updated_at != null ? (0, zeniDayJS_1.date)(payload.updated_at) : undefined,
275
- createTime: payload.create_time != null ? (0, zeniDayJS_1.date)(payload.create_time) : undefined,
276
264
  jeCredit: {
277
265
  accountId: payload.je_credit_account_id ?? undefined,
278
266
  accountingClassId: payload.je_credit_accounting_class_id ?? undefined,
@@ -297,7 +285,6 @@ function toJEScheduledTransaction(payload) {
297
285
  : {},
298
286
  scheduledJournalEntry: [],
299
287
  aiSummaries: toJEScheduleAISummaries(payload.ai_summaries),
300
- confidenceScore: payload.confidence_score ?? undefined,
301
288
  createdByUserID: payload.created_by?.user_id ?? undefined,
302
289
  recommendations: toJEScheduleRecommendations(payload.recommendations),
303
290
  };
@@ -355,125 +342,3 @@ function toJEAccruedScheduledTransaction(payload) {
355
342
  jeScheduleType: (0, jeSchedulesTypes_1.toScheduleTypesTypeStrict)(payload.je_schedule_type),
356
343
  };
357
344
  }
358
- /**
359
- * Reads the months in the order the snapshot gives them rather than deriving a range: a vendor that
360
- * skipped a month has no entry for it, so filling gaps would invent history that was never billed.
361
- */
362
- function toJEOneTimeAccrualMonthlyTotals(snapshot, currencyCode) {
363
- const monthlyTotals = snapshot.monthly_totals;
364
- if (monthlyTotals == null) {
365
- return [];
366
- }
367
- const months = snapshot.sorted_months ?? Object.keys(monthlyTotals).sort();
368
- return months
369
- .filter((month) => monthlyTotals[month] != null)
370
- .map((month) => ({
371
- month,
372
- amount: toOneTimeAccrualAmount(monthlyTotals[month], currencyCode),
373
- }));
374
- }
375
- function toJEOneTimeAccrualProfileSnapshot(payload, currencyCode) {
376
- if (payload == null) {
377
- return undefined;
378
- }
379
- const billingPattern = payload.billing_pattern;
380
- return {
381
- monthlyTotals: toJEOneTimeAccrualMonthlyTotals(payload, currencyCode),
382
- billingPattern: billingPattern != null
383
- ? {
384
- frequency: billingPattern.frequency ?? undefined,
385
- monthsOfHistory: billingPattern.months_of_history ?? undefined,
386
- consistencyScore: billingPattern.consistency_score ?? undefined,
387
- billingLagDays: billingPattern.billing_lag_days ?? undefined,
388
- typicalBillDay: billingPattern.typical_bill_day ?? undefined,
389
- avgAmount: billingPattern.avg_amount != null
390
- ? toOneTimeAccrualAmount(billingPattern.avg_amount, currencyCode)
391
- : undefined,
392
- lastBillAmount: billingPattern.last_bill_amount != null
393
- ? toOneTimeAccrualAmount(billingPattern.last_bill_amount, currencyCode)
394
- : undefined,
395
- lastBillDate: billingPattern.last_bill_date != null
396
- ? (0, zeniDayJS_1.date)(billingPattern.last_bill_date)
397
- : undefined,
398
- }
399
- : undefined,
400
- };
401
- }
402
- function toJEOneTimeAccrualAiSuggestion(payload, currencyCode) {
403
- if (payload == null) {
404
- return undefined;
405
- }
406
- return {
407
- memo: payload.memo ?? undefined,
408
- jeDebitAccountName: payload.je_debit_account_name ?? undefined,
409
- jeCreditAccountName: payload.je_credit_account_name ?? undefined,
410
- estimatedAmount: payload.estimated_amount != null
411
- ? toOneTimeAccrualAmount(payload.estimated_amount, currencyCode)
412
- : undefined,
413
- };
414
- }
415
- function toJEOneTimeAccrual(payload) {
416
- return {
417
- accrualId: payload._id,
418
- vendorId: payload.vendor_id,
419
- vendorName: payload.vendor_name,
420
- serviceMonth: payload.service_month,
421
- accrualStatus: (0, jeSchedulesTypes_1.toOneTimeAccrualStatusCodeType)(payload.status),
422
- origin: (0, jeSchedulesTypes_1.toOneTimeAccrualOriginType)(payload.origin),
423
- automationTier: payload.automation_tier != null
424
- ? (0, jeSchedulesTypes_1.toOneTimeAccrualAutomationTierType)(payload.automation_tier)
425
- : undefined,
426
- estimatedAmount: toOneTimeAccrualAmount(payload.estimated_amount, payload.currency),
427
- memo: payload.memo ?? '',
428
- profileSnapshot: toJEOneTimeAccrualProfileSnapshot(payload.profile_snapshot, payload.currency),
429
- aiSuggestion: toJEOneTimeAccrualAiSuggestion(payload.ai_suggestion, payload.currency),
430
- // Exclusive by contract: a scheduled row reverses on expectedReversalDate and bills never
431
- // drive it, so the two never need reconciling. Defaulting to on_bill_match matches the
432
- // create path's default when the field is absent on an older document.
433
- reversalPolicy: (0, jeSchedulesTypes_1.toOneTimeAccrualReversalPolicyType)(payload.reversal_policy ?? 'on_bill_match'),
434
- reversalTrigger: (0, jeSchedulesTypes_1.toOneTimeAccrualReversalTriggerType)(payload.reversal_trigger ?? undefined),
435
- expectedReversalDate: payload.expected_reversal_date != null
436
- ? (0, zeniDayJS_1.date)(payload.expected_reversal_date)
437
- : undefined,
438
- postingDate: payload.posting_date != null ? (0, zeniDayJS_1.date)(payload.posting_date) : undefined,
439
- actualPostDate: payload.actual_post_date != null
440
- ? (0, zeniDayJS_1.date)(payload.actual_post_date)
441
- : undefined,
442
- actualReversalPostDate: payload.actual_reversal_post_date != null
443
- ? (0, zeniDayJS_1.date)(payload.actual_reversal_post_date)
444
- : undefined,
445
- jeDebitAccountId: payload.je_debit_account_id ?? undefined,
446
- jeDebitAccountName: payload.je_debit_account_name ?? undefined,
447
- jeDebitAccountingClassId: payload.je_debit_accounting_class_id ?? undefined,
448
- jeDebitAccountingClassName: payload.je_debit_accounting_class_name ?? undefined,
449
- jeCreditAccountId: payload.je_credit_account_id ?? undefined,
450
- jeCreditAccountName: payload.je_credit_account_name ?? undefined,
451
- jeCreditAccountingClassId: payload.je_credit_accounting_class_id ?? undefined,
452
- jeCreditAccountingClassName: payload.je_credit_accounting_class_name ?? undefined,
453
- transactionId: payload.transaction_id ?? undefined,
454
- transactionIntegrationId: payload.transaction_integration_id ?? undefined,
455
- reversalTransactionId: payload.reversal_transaction_id ?? undefined,
456
- createdBy: toJEOneTimeAccrualCreator(payload.created_by_user),
457
- };
458
- }
459
- // The accrual wire format carries a currency CODE but no symbol, so the symbol has to be derived.
460
- // Only USD has a known glyph today (the create path is USD-only); anything else falls back to the
461
- // code, which reads correctly as "EUR 1,200" rather than silently rendering a wrong "$".
462
- function toOneTimeAccrualAmount(amount, currencyCode) {
463
- const code = currencyCode ?? USD_CURRENCY_CODE;
464
- return (0, amount_1.toAmount)(amount, code, code === USD_CURRENCY_CODE ? '$' : code);
465
- }
466
- function toJEOneTimeAccrualCreator(payload) {
467
- if (payload == null) {
468
- return undefined;
469
- }
470
- return {
471
- userId: payload.user_id,
472
- email: payload.email ?? undefined,
473
- firstName: payload.first_name ?? undefined,
474
- lastName: payload.last_name ?? undefined,
475
- photo: payload.photo?.original != null
476
- ? (0, zeniUrl_1.toZeniUrl)(payload.photo.original)
477
- : undefined,
478
- };
479
- }
@@ -1,5 +1,5 @@
1
1
  import { UpdateType } from '../../commonStateTypes/common';
2
- import { JEAccruedScheduledTransactionPayload, JEOneTimeAccrualPayload, JEScheduledTransactionPayload, ScheduledJournalEntryPayload } from './jeSchedulesPayload';
2
+ import { JEAccruedScheduledTransactionPayload, JEScheduledTransactionPayload, ScheduledJournalEntryPayload } from './jeSchedulesPayload';
3
3
  import { JESchedulesState } from './jeSchedulesState';
4
4
  export declare const initialState: JESchedulesState;
5
5
  export declare const updateJESchedules: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[jeSchedulesTransactionsPayload: JEScheduledTransactionPayload[]], {
@@ -22,8 +22,6 @@ export declare const updateJESchedules: import("@reduxjs/toolkit").ActionCreator
22
22
  jeScheduleTransactionKey: `${string}_expense_${string}` | `${string}_check_${string}` | `${string}_invoice_${string}` | `${string}_payment_${string}` | `${string}_credit_memo_${string}` | `${string}_sales_receipt_${string}` | `${string}_delayed_credit_${string}` | `${string}_delayed_charge_${string}` | `${string}_refund_${string}` | `${string}_bill_${string}` | `${string}_bill_payment_${string}` | `${string}_bill_payment_check_${string}` | `${string}_bill_payment_credit_card_${string}` | `${string}_vendor_credit_${string}` | `${string}_credit_card_credit_${string}` | `${string}_transfer_${string}` | `${string}_credit_card_payment_${string}` | `${string}_deposit_${string}` | `${string}_journal_entry_${string}`;
23
23
  }, "jeSchedules/deleteJESchedulesDetails", never, never>, deleteAccruedJESchedulesDetails: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[JEScheduleKey: `${string}_${string}`], {
24
24
  JEScheduleKey: `${string}_${string}`;
25
- }, "jeSchedules/deleteAccruedJESchedulesDetails", never, never>, clearAllAccruedJESchedules: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"jeSchedules/clearAllAccruedJESchedules">, clearAllJEScheduleTransactions: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"jeSchedules/clearAllJEScheduleTransactions">, updateJEOneTimeAccruals: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[jeOneTimeAccrualsPayload: JEOneTimeAccrualPayload[]], {
26
- jeOneTimeAccrualsPayload: JEOneTimeAccrualPayload[];
27
- }, "jeSchedules/updateJEOneTimeAccruals", never, never>;
25
+ }, "jeSchedules/deleteAccruedJESchedulesDetails", never, never>;
28
26
  declare const _default: import("redux").Reducer<JESchedulesState>;
29
27
  export default _default;
@@ -4,16 +4,14 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  var _a;
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.updateJEOneTimeAccruals = exports.clearAllJEScheduleTransactions = exports.clearAllAccruedJESchedules = exports.deleteAccruedJESchedulesDetails = exports.deleteJESchedulesDetails = exports.updateAccruedJESchedulesDetails = exports.updateJESchedulesDetails = exports.updateAccruedJEScheduledTransaction = exports.updateJEScheduledTransaction = exports.updateAccruedJESchedules = exports.updateJESchedules = exports.initialState = void 0;
7
+ exports.deleteAccruedJESchedulesDetails = exports.deleteJESchedulesDetails = exports.updateAccruedJESchedulesDetails = exports.updateJESchedulesDetails = exports.updateAccruedJEScheduledTransaction = exports.updateJEScheduledTransaction = exports.updateAccruedJESchedules = exports.updateJESchedules = exports.initialState = void 0;
8
8
  const toolkit_1 = require("@reduxjs/toolkit");
9
9
  const assignWith_1 = __importDefault(require("lodash/assignWith"));
10
10
  const rootActions_1 = require("../../rootActions");
11
- const jeScheduleHelper_1 = require("./jeScheduleHelper");
12
11
  const jeSchedulesPayload_1 = require("./jeSchedulesPayload");
13
12
  exports.initialState = {
14
13
  schedulesByTransactionKey: {},
15
14
  schedulesByAccruedJEScheduleKey: {},
16
- oneTimeAccrualsByKey: {},
17
15
  };
18
16
  const jeSchedules = (0, toolkit_1.createSlice)({
19
17
  name: 'jeSchedules',
@@ -118,41 +116,15 @@ const jeSchedules = (0, toolkit_1.createSlice)({
118
116
  delete draft.schedulesByAccruedJEScheduleKey[JEScheduleKey];
119
117
  },
120
118
  },
121
- // Writes directly, unlike updateAccruedJESchedules / updateJESchedules, which are no-op
122
- // actions whose only job is to trigger the entity fan-out epic that fetches vendors,
123
- // accounts, classes and users. An accrual denormalizes all of those as names on the document,
124
- // so there is nothing to fan out to.
125
- updateJEOneTimeAccruals: {
126
- prepare(jeOneTimeAccrualsPayload) {
127
- return {
128
- payload: {
129
- jeOneTimeAccrualsPayload,
130
- },
131
- };
132
- },
133
- reducer(draft, action) {
134
- action.payload.jeOneTimeAccrualsPayload.forEach((accrualPayload) => {
135
- const accrual = (0, jeSchedulesPayload_1.toJEOneTimeAccrual)(accrualPayload);
136
- draft.oneTimeAccrualsByKey[(0, jeScheduleHelper_1.generateJEOneTimeAccrualKey)(accrual.accrualId)] = accrual;
137
- });
138
- },
139
- },
140
- clearAllJEScheduleTransactions(draft) {
141
- draft.schedulesByTransactionKey = {};
142
- },
143
- clearAllAccruedJESchedules(draft) {
144
- draft.schedulesByAccruedJEScheduleKey = {};
145
- },
146
119
  },
147
120
  extraReducers: (builder) => {
148
121
  builder.addCase(rootActions_1.clearAll, (draft) => {
149
122
  draft.schedulesByAccruedJEScheduleKey = {};
150
123
  draft.schedulesByTransactionKey = {};
151
- draft.oneTimeAccrualsByKey = {};
152
124
  });
153
125
  },
154
126
  });
155
- _a = jeSchedules.actions, exports.updateJESchedules = _a.updateJESchedules, exports.updateAccruedJESchedules = _a.updateAccruedJESchedules, exports.updateJEScheduledTransaction = _a.updateJEScheduledTransaction, exports.updateAccruedJEScheduledTransaction = _a.updateAccruedJEScheduledTransaction, exports.updateJESchedulesDetails = _a.updateJESchedulesDetails, exports.updateAccruedJESchedulesDetails = _a.updateAccruedJESchedulesDetails, exports.deleteJESchedulesDetails = _a.deleteJESchedulesDetails, exports.deleteAccruedJESchedulesDetails = _a.deleteAccruedJESchedulesDetails, exports.clearAllAccruedJESchedules = _a.clearAllAccruedJESchedules, exports.clearAllJEScheduleTransactions = _a.clearAllJEScheduleTransactions, exports.updateJEOneTimeAccruals = _a.updateJEOneTimeAccruals;
127
+ _a = jeSchedules.actions, exports.updateJESchedules = _a.updateJESchedules, exports.updateAccruedJESchedules = _a.updateAccruedJESchedules, exports.updateJEScheduledTransaction = _a.updateJEScheduledTransaction, exports.updateAccruedJEScheduledTransaction = _a.updateAccruedJEScheduledTransaction, exports.updateJESchedulesDetails = _a.updateJESchedulesDetails, exports.updateAccruedJESchedulesDetails = _a.updateAccruedJESchedulesDetails, exports.deleteJESchedulesDetails = _a.deleteJESchedulesDetails, exports.deleteAccruedJESchedulesDetails = _a.deleteAccruedJESchedulesDetails;
156
128
  exports.default = jeSchedules.reducer;
157
129
  /**
158
130
  * Helper functions
@@ -9,8 +9,8 @@ import { ScheduleTransaction } from '../transaction/stateTypes/scheduleTransacti
9
9
  import { TransactionID } from '../transaction/stateTypes/transactionID';
10
10
  import { User } from '../user/userState';
11
11
  import { Vendor } from '../vendor/vendorState';
12
- import { JEOneTimeAccrualState, JEScheduleAISummaries, JEScheduleOtherAttributes, JEScheduleRecommendations, JESchedulesState, ScheduleJournalStatusCode, ScheduleStatus } from './jeSchedulesState';
13
- import { JEOneTimeAccrualKey, JEScheduleKey, JEScheduleTransactionKey, JournalEntryErrorCodeType, ScheduleTypes } from './jeSchedulesTypes';
12
+ import { JEScheduleAISummaries, JEScheduleOtherAttributes, JEScheduleRecommendations, ScheduleJournalStatusCode, ScheduleStatus } from './jeSchedulesState';
13
+ import { JEScheduleKey, JEScheduleTransactionKey, JournalEntryErrorCodeType, ScheduleTypes } from './jeSchedulesTypes';
14
14
  export interface ScheduledJournalEntry {
15
15
  error: JournalEntryErrorCodeType[];
16
16
  expectedPostDate: ZeniDate;
@@ -55,17 +55,13 @@ export interface JEScheduledTransaction {
55
55
  accountingClass?: Class;
56
56
  };
57
57
  jeScheduleTransactionKey: JEScheduleTransactionKey;
58
- lifecycleTotal: number;
59
58
  otherAttributes: JEScheduleOtherAttributes;
60
- postedCount: number;
61
59
  scheduledJournalEntry: ScheduledJournalEntry[];
62
60
  status: ScheduleStatus;
63
61
  vendor: Vendor;
64
62
  aiSummaries?: JEScheduleAISummaries;
65
63
  balanceAsOfToday?: Amount;
66
- confidenceScore?: number;
67
64
  createdByUser?: User;
68
- createTime?: ZeniDate;
69
65
  dayOfPostingDate?: ScheduleDaysOfMonth;
70
66
  endDate?: ZeniDate;
71
67
  jeScheduleId?: ID;
@@ -73,14 +69,9 @@ export interface JEScheduledTransaction {
73
69
  lastDayOfMonth?: boolean;
74
70
  period?: number;
75
71
  recommendations?: JEScheduleRecommendations;
76
- recurringAmount?: Amount;
77
72
  startDate?: ZeniDate;
78
73
  updatedAt?: ZeniDate;
79
74
  updatedByUser?: User;
80
75
  }
81
- export interface JEOneTimeAccrual extends JEOneTimeAccrualState {
82
- jeOneTimeAccrualKey: JEOneTimeAccrualKey;
83
- }
84
- export declare const getJEOneTimeAccrualByKey: (jeOneTimeAccrualKey: JEOneTimeAccrualKey, jeSchedulesState: JESchedulesState) => JEOneTimeAccrual | undefined;
85
76
  export declare const getJEAccruedScheduleByJEScheduleKey: (JEScheduleKey: JEScheduleKey, state: RootState) => JEAccruedSchedule | undefined;
86
77
  export declare const getJEScheduledTransactionByJEScheduleTransactionKey: (jeScheduleTransactionKey: JEScheduleTransactionKey, state: RootState) => JEScheduledTransaction;
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.getJEScheduledTransactionByJEScheduleTransactionKey = exports.getJEAccruedScheduleByJEScheduleKey = exports.getJEOneTimeAccrualByKey = void 0;
6
+ exports.getJEScheduledTransactionByJEScheduleTransactionKey = exports.getJEAccruedScheduleByJEScheduleKey = void 0;
7
7
  const get_1 = __importDefault(require("lodash/get"));
8
8
  const amount_1 = require("../../commonStateTypes/amount");
9
9
  const accountSelector_1 = require("../account/accountSelector");
@@ -11,35 +11,18 @@ const classSelector_1 = require("../class/classSelector");
11
11
  const transactionSelector_1 = require("../transaction/transactionSelector");
12
12
  const userSelector_1 = require("../user/userSelector");
13
13
  const vendorSelector_1 = require("../vendor/vendorSelector");
14
- // Takes the slice, not RootState: an accrual denormalizes its vendor, account and class names, so
15
- // unlike getJEAccruedScheduleByJEScheduleKey this joins nothing.
16
- //
17
- // Spreads the stored entity rather than rebuilding it field by field. That is deliberate — the
18
- // accrued joiner listed every field explicitly and silently dropped jeScheduleType, which made a
19
- // whole tab render empty while its reducer test still passed. A spread cannot lose a field.
20
- const getJEOneTimeAccrualByKey = (jeOneTimeAccrualKey, jeSchedulesState) => {
21
- const accrual = (0, get_1.default)(jeSchedulesState.oneTimeAccrualsByKey, jeOneTimeAccrualKey);
22
- if (accrual == null) {
23
- return undefined;
24
- }
25
- return { ...accrual, jeOneTimeAccrualKey };
26
- };
27
- exports.getJEOneTimeAccrualByKey = getJEOneTimeAccrualByKey;
28
14
  const getJEAccruedScheduleByJEScheduleKey = (JEScheduleKey, state) => {
29
15
  const { jeSchedulesState, vendorState, accountState, userState, classState } = state;
30
16
  const JEAccruedScheduleState = (0, get_1.default)(jeSchedulesState.schedulesByAccruedJEScheduleKey, JEScheduleKey);
31
17
  if (JEAccruedScheduleState == null) {
32
18
  return undefined;
33
19
  }
34
- const { period, updatedByUserID: updatedBy, createdByUserID: createdBy, vendorId, jeCredit, jeDebit, currencyCode, currencySymbol, balanceAsOfToday, startDate, endDate, status, updatedAt, jeScheduleId, scheduledJournalEntry, dayOfPostingDate: postingDate, lastDayOfMonth, memo, recurringAmount, createTime, otherAttributes, jeScheduleType, } = JEAccruedScheduleState;
20
+ const { period, updatedByUserID: updatedBy, vendorId, jeCredit, jeDebit, currencyCode, currencySymbol, balanceAsOfToday, startDate, endDate, status, updatedAt, jeScheduleId, scheduledJournalEntry, dayOfPostingDate: postingDate, lastDayOfMonth, memo, recurringAmount, createTime, otherAttributes, } = JEAccruedScheduleState;
35
21
  const vendorDetails = (0, vendorSelector_1.getVendorByVendorId)(vendorState, vendorId);
36
22
  if (vendorDetails == null) {
37
23
  throw new Error(`Vendor with ${vendorId} doesn't exist`);
38
24
  }
39
25
  const userDetails = updatedBy != null ? (0, userSelector_1.getUserByUserId)(userState, updatedBy) : undefined;
40
- // Resolved the same way the prepaid / fixed joiner does. Without it every accrued row rendered a
41
- // hyphen under "Created by", even though the payload carries created_by.
42
- const createdByUserDetails = createdBy != null ? (0, userSelector_1.getUserByUserId)(userState, createdBy) : undefined;
43
26
  const accountCredit = jeCredit.accountId != null
44
27
  ? (0, accountSelector_1.getAccountBase)(accountState, jeCredit.accountId, 'account_list')
45
28
  : undefined;
@@ -58,19 +41,14 @@ const getJEAccruedScheduleByJEScheduleKey = (JEScheduleKey, state) => {
58
41
  reportId: 'class_list',
59
42
  })
60
43
  : undefined;
61
- const postedCount = scheduledJournalEntry.filter((sje) => sje.status.code === 'posted' || sje.status.code === 'recorded').length;
62
- const lifecycleTotal = period ?? scheduledJournalEntry.length;
63
44
  return {
64
45
  jeScheduleId,
65
46
  otherAttributes,
66
47
  vendor: vendorDetails,
67
48
  updatedByUser: userDetails,
68
- createdByUser: createdByUserDetails,
69
49
  updatedAt,
70
50
  currencyCode,
71
51
  currencySymbol,
72
- lifecycleTotal,
73
- postedCount,
74
52
  jeCredit: {
75
53
  accountingClass: classCredit,
76
54
  account: accountCredit,
@@ -88,7 +66,6 @@ const getJEAccruedScheduleByJEScheduleKey = (JEScheduleKey, state) => {
88
66
  memo,
89
67
  createTime,
90
68
  recurringAmount,
91
- jeScheduleType,
92
69
  jeAccruedScheduleKey: JEScheduleKey,
93
70
  balanceAsOfToday: balanceAsOfToday != null
94
71
  ? (0, amount_1.toAmount)(balanceAsOfToday, currencyCode, currencySymbol)
@@ -100,7 +77,7 @@ exports.getJEAccruedScheduleByJEScheduleKey = getJEAccruedScheduleByJEScheduleKe
100
77
  const getJEScheduledTransactionByJEScheduleTransactionKey = (jeScheduleTransactionKey, state) => {
101
78
  const { jeSchedulesState, vendorState, accountState, userState, classState, transactionState, } = state;
102
79
  const jeScheduleTransactionState = (0, get_1.default)(jeSchedulesState.schedulesByTransactionKey, jeScheduleTransactionKey);
103
- const { period, updatedByUserID: updatedBy, createdByUserID: createdBy, createTime, vendorId, jeCredit, jeDebit, currencyCode, currencySymbol, balanceAsOfToday, baseTransaction, startDate, endDate, status, updatedAt, jeScheduleId, scheduledJournalEntry, dayOfPostingDate: postingDate, lastDayOfMonth, otherAttributes, jeScheduleType, aiSummaries, confidenceScore, recommendations, recurringAmount, postedCount: postedCountFromServer, } = jeScheduleTransactionState;
80
+ const { period, updatedByUserID: updatedBy, createdByUserID: createdBy, vendorId, jeCredit, jeDebit, currencyCode, currencySymbol, balanceAsOfToday, baseTransaction, startDate, endDate, status, updatedAt, jeScheduleId, scheduledJournalEntry, dayOfPostingDate: postingDate, lastDayOfMonth, otherAttributes, jeScheduleType, aiSummaries, recommendations, } = jeScheduleTransactionState;
104
81
  const vendorDetails = (0, vendorSelector_1.getVendorByVendorId)(vendorState, vendorId);
105
82
  if (vendorDetails == null) {
106
83
  throw new Error(`Vendor with ${vendorId} doesn't exist`);
@@ -129,24 +106,14 @@ const getJEScheduledTransactionByJEScheduleTransactionKey = (jeScheduleTransacti
129
106
  reportId: 'class_list',
130
107
  })
131
108
  : undefined;
132
- // The expense-automation response carries no scheduled journal entries for these rows, so the
133
- // filter below counts an empty array and every schedule reported 0 posted. Prefer the count the
134
- // server derives, and keep the filter for callers that do have entries (the detail page, and
135
- // failed postings, which come with theirs).
136
- const postedCount = postedCountFromServer ??
137
- scheduledJournalEntry.filter((sje) => sje.status.code === 'posted' || sje.status.code === 'recorded').length;
138
- const lifecycleTotal = period ?? scheduledJournalEntry.length;
139
109
  return {
140
110
  jeScheduleId,
141
111
  jeScheduleType,
142
- recurringAmount,
143
112
  jeScheduleTransactionKey: jeScheduleTransactionKey,
144
113
  vendor: vendorDetails,
145
114
  updatedByUser: userDetails,
146
115
  updatedAt: updatedAt,
147
116
  period,
148
- lifecycleTotal,
149
- postedCount,
150
117
  balanceAsOfToday: balanceAsOfToday != null
151
118
  ? (0, amount_1.toAmount)(balanceAsOfToday, currencyCode, currencySymbol)
152
119
  : undefined,
@@ -169,9 +136,7 @@ const getJEScheduledTransactionByJEScheduleTransactionKey = (jeScheduleTransacti
169
136
  },
170
137
  scheduledJournalEntry,
171
138
  aiSummaries,
172
- confidenceScore,
173
139
  createdByUser: createdByUserDetails,
174
- createTime,
175
140
  recommendations,
176
141
  };
177
142
  };