@zeniai/client-epic-state 5.2.11-beta0ND → 5.2.11-betaAM2

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 (191) hide show
  1. package/lib/entity/invoicing/invoicingCommonPayload.d.ts +29 -27
  2. package/lib/entity/invoicing/invoicingCommonPayload.js +75 -37
  3. package/lib/entity/invoicing/product/productPayload.d.ts +0 -10
  4. package/lib/entity/invoicing/product/productPayload.js +2 -14
  5. package/lib/entity/jeSchedules/jeScheduleHelper.d.ts +1 -0
  6. package/lib/entity/jeSchedules/jeScheduleHelper.js +7 -0
  7. package/lib/entity/jeSchedules/jeSchedulesPayload.d.ts +97 -1
  8. package/lib/entity/jeSchedules/jeSchedulesPayload.js +209 -0
  9. package/lib/entity/jeSchedules/jeSchedulesReducer.d.ts +4 -2
  10. package/lib/entity/jeSchedules/jeSchedulesReducer.js +30 -2
  11. package/lib/entity/jeSchedules/jeSchedulesSelector.d.ts +11 -2
  12. package/lib/entity/jeSchedules/jeSchedulesSelector.js +38 -3
  13. package/lib/entity/jeSchedules/jeSchedulesState.d.ts +140 -1
  14. package/lib/entity/jeSchedules/jeSchedulesTypes.d.ts +24 -1
  15. package/lib/entity/jeSchedules/jeSchedulesTypes.js +88 -1
  16. package/lib/entity/snackbar/snackbarTypes.d.ts +1 -1
  17. package/lib/entity/snackbar/snackbarTypes.js +3 -0
  18. package/lib/entity/transaction/payloadTypes/scheduleTransactionPayload.d.ts +2 -0
  19. package/lib/entity/transaction/payloadTypes/scheduleTransactionPayload.js +2 -0
  20. package/lib/entity/transaction/stateTypes/scheduleTransaction.d.ts +2 -0
  21. package/lib/epic.d.ts +15 -3
  22. package/lib/epic.js +31 -12
  23. package/lib/esm/entity/invoicing/invoicingCommonPayload.js +73 -33
  24. package/lib/esm/entity/invoicing/product/productPayload.js +2 -14
  25. package/lib/esm/entity/jeSchedules/jeScheduleHelper.js +6 -0
  26. package/lib/esm/entity/jeSchedules/jeSchedulesPayload.js +209 -1
  27. package/lib/esm/entity/jeSchedules/jeSchedulesReducer.js +30 -2
  28. package/lib/esm/entity/jeSchedules/jeSchedulesSelector.js +36 -2
  29. package/lib/esm/entity/jeSchedules/jeSchedulesTypes.js +78 -0
  30. package/lib/esm/entity/snackbar/snackbarTypes.js +3 -0
  31. package/lib/esm/entity/transaction/payloadTypes/scheduleTransactionPayload.js +2 -0
  32. package/lib/esm/epic.js +27 -8
  33. package/lib/esm/index.js +23 -14
  34. package/lib/esm/reducer.js +3 -0
  35. package/lib/esm/view/expenseAutomationView/epics/actualMatching/fetchActualMatchingEpic.js +46 -0
  36. package/lib/esm/view/expenseAutomationView/epics/actualMatching/fetchActualMatchingPageEpic.js +7 -0
  37. package/lib/esm/view/expenseAutomationView/epics/actualMatching/matchAndReverseAccrualsEpic.js +50 -0
  38. package/lib/esm/view/expenseAutomationView/epics/actualMatching/searchMatchAccrualsEpic.js +44 -0
  39. package/lib/esm/view/expenseAutomationView/epics/actualMatching/searchMatchTransactionsEpic.js +44 -0
  40. package/lib/esm/view/expenseAutomationView/epics/common/fetchAllExpenseAutomationTabsEpic.js +30 -10
  41. package/lib/esm/view/expenseAutomationView/epics/common/refreshExpenseAutomationCurrentTabEpic.js +9 -1
  42. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulePageEpic.js +9 -1
  43. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulesEpic.js +41 -5
  44. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/fetchOneTimeAccrualEpic.js +45 -0
  45. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/ignoreRecommendedJeScheduleEpic.js +14 -2
  46. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/newSchedule/createOneTimeAccrualEpic.js +104 -0
  47. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/newSchedule/initializeNewScheduleEpic.js +25 -0
  48. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/newSchedule/saveNewScheduleEpic.js +136 -0
  49. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/newSchedule/searchTransactionsForNewScheduleEpic.js +79 -0
  50. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/oneTimeAccrualActionsEpic.js +180 -0
  51. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/revertJeScheduleEpic.js +111 -0
  52. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/switchJESchedulesTabEpic.js +33 -0
  53. package/lib/esm/view/expenseAutomationView/expenseAutomationViewSelector.js +22 -7
  54. package/lib/esm/view/expenseAutomationView/helpers/newScheduleLocalDataHelper.js +140 -0
  55. package/lib/esm/view/expenseAutomationView/payload/actualMatchingPayload.js +35 -0
  56. package/lib/esm/view/expenseAutomationView/payload/jeSchedulesPayload.js +55 -0
  57. package/lib/esm/view/expenseAutomationView/reducers/actualMatchingViewReducer.js +260 -0
  58. package/lib/esm/view/expenseAutomationView/reducers/jeSchedulesViewReducer.js +319 -29
  59. package/lib/esm/view/expenseAutomationView/selectorTypes/jeNewScheduleViewSelectorTypes.js +1 -0
  60. package/lib/esm/view/expenseAutomationView/selectors/actualMatchingViewSelector.js +162 -0
  61. package/lib/esm/view/expenseAutomationView/selectors/jeAccountSettingsViewSelector.js +1 -0
  62. package/lib/esm/view/expenseAutomationView/selectors/jeNewScheduleViewSelector.js +106 -0
  63. package/lib/esm/view/expenseAutomationView/selectors/jeSchedulesViewSelector.js +297 -22
  64. package/lib/esm/view/expenseAutomationView/types/actualMatchingViewState.js +22 -0
  65. package/lib/esm/view/expenseAutomationView/types/jeSchedulesViewState.js +8 -5
  66. package/lib/esm/view/invoicing/editInvoicingCatalogItemDetailView/editInvoicingCatalogItemDetailViewPayload.js +9 -25
  67. package/lib/esm/view/invoicing/editInvoicingCatalogItemDetailView/saveInvoicingCatalogItemEpic.js +1 -6
  68. package/lib/esm/view/invoicing/invoicingQboView/invoicingQboViewSelector.js +0 -40
  69. package/lib/esm/view/invoicing/settingsView/settingsViewEpics.js +92 -0
  70. package/lib/esm/view/invoicing/settingsView/settingsViewReducer.js +1 -25
  71. package/lib/esm/view/invoicing/settingsView/settingsViewSelector.js +0 -41
  72. package/lib/esm/view/recommendation/recommendationReducer.js +1 -16
  73. package/lib/esm/view/scheduleView/scheduleListView/epics/fetchAccruedScheduleListEpic.js +1 -1
  74. package/lib/esm/view/scheduleView/scheduleListView/epics/fetchDownloadSchedulesEpic.js +7 -2
  75. package/lib/esm/view/scheduleView/scheduleListView/scheduleListReducer.js +5 -3
  76. package/lib/index.d.ts +29 -22
  77. package/lib/index.js +116 -56
  78. package/lib/reducer.d.ts +1 -0
  79. package/lib/reducer.js +3 -0
  80. package/lib/rootStateTypes.d.ts +2 -0
  81. package/lib/view/expenseAutomationView/epics/actualMatching/fetchActualMatchingEpic.d.ts +9 -0
  82. package/lib/view/expenseAutomationView/epics/actualMatching/fetchActualMatchingEpic.js +50 -0
  83. package/lib/view/expenseAutomationView/epics/actualMatching/fetchActualMatchingPageEpic.d.ts +5 -0
  84. package/lib/view/expenseAutomationView/epics/actualMatching/fetchActualMatchingPageEpic.js +11 -0
  85. package/lib/view/expenseAutomationView/epics/actualMatching/matchAndReverseAccrualsEpic.d.ts +8 -0
  86. package/lib/view/expenseAutomationView/epics/actualMatching/matchAndReverseAccrualsEpic.js +54 -0
  87. package/lib/view/expenseAutomationView/epics/actualMatching/searchMatchAccrualsEpic.d.ts +8 -0
  88. package/lib/view/expenseAutomationView/epics/actualMatching/searchMatchAccrualsEpic.js +48 -0
  89. package/lib/view/expenseAutomationView/epics/actualMatching/searchMatchTransactionsEpic.d.ts +8 -0
  90. package/lib/view/expenseAutomationView/epics/actualMatching/searchMatchTransactionsEpic.js +48 -0
  91. package/lib/view/expenseAutomationView/epics/common/fetchAllExpenseAutomationTabsEpic.d.ts +2 -1
  92. package/lib/view/expenseAutomationView/epics/common/fetchAllExpenseAutomationTabsEpic.js +30 -10
  93. package/lib/view/expenseAutomationView/epics/common/refreshExpenseAutomationCurrentTabEpic.d.ts +2 -1
  94. package/lib/view/expenseAutomationView/epics/common/refreshExpenseAutomationCurrentTabEpic.js +9 -1
  95. package/lib/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulePageEpic.js +9 -1
  96. package/lib/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulesEpic.d.ts +3 -2
  97. package/lib/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulesEpic.js +39 -3
  98. package/lib/view/expenseAutomationView/epics/jeSchedule/fetchOneTimeAccrualEpic.d.ts +21 -0
  99. package/lib/view/expenseAutomationView/epics/jeSchedule/fetchOneTimeAccrualEpic.js +49 -0
  100. package/lib/view/expenseAutomationView/epics/jeSchedule/ignoreRecommendedJeScheduleEpic.js +14 -2
  101. package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/createOneTimeAccrualEpic.d.ts +9 -0
  102. package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/createOneTimeAccrualEpic.js +108 -0
  103. package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/initializeNewScheduleEpic.d.ts +8 -0
  104. package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/initializeNewScheduleEpic.js +29 -0
  105. package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/saveNewScheduleEpic.d.ts +9 -0
  106. package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/saveNewScheduleEpic.js +140 -0
  107. package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/searchTransactionsForNewScheduleEpic.d.ts +8 -0
  108. package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/searchTransactionsForNewScheduleEpic.js +83 -0
  109. package/lib/view/expenseAutomationView/epics/jeSchedule/oneTimeAccrualActionsEpic.d.ts +13 -0
  110. package/lib/view/expenseAutomationView/epics/jeSchedule/oneTimeAccrualActionsEpic.js +187 -0
  111. package/lib/view/expenseAutomationView/epics/jeSchedule/revertJeScheduleEpic.d.ts +65 -0
  112. package/lib/view/expenseAutomationView/epics/jeSchedule/revertJeScheduleEpic.js +115 -0
  113. package/lib/view/expenseAutomationView/epics/jeSchedule/switchJESchedulesTabEpic.d.ts +7 -0
  114. package/lib/view/expenseAutomationView/epics/jeSchedule/switchJESchedulesTabEpic.js +37 -0
  115. package/lib/view/expenseAutomationView/expenseAutomationViewSelector.js +22 -7
  116. package/lib/view/expenseAutomationView/helpers/newScheduleLocalDataHelper.d.ts +36 -0
  117. package/lib/view/expenseAutomationView/helpers/newScheduleLocalDataHelper.js +145 -0
  118. package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.d.ts +1 -1
  119. package/lib/view/expenseAutomationView/payload/actualMatchingPayload.d.ts +66 -0
  120. package/lib/view/expenseAutomationView/payload/actualMatchingPayload.js +40 -0
  121. package/lib/view/expenseAutomationView/payload/jeSchedulesPayload.d.ts +86 -3
  122. package/lib/view/expenseAutomationView/payload/jeSchedulesPayload.js +58 -1
  123. package/lib/view/expenseAutomationView/reducers/actualMatchingViewReducer.d.ts +53 -0
  124. package/lib/view/expenseAutomationView/reducers/actualMatchingViewReducer.js +264 -0
  125. package/lib/view/expenseAutomationView/reducers/jeSchedulesViewReducer.d.ts +93 -12
  126. package/lib/view/expenseAutomationView/reducers/jeSchedulesViewReducer.js +321 -29
  127. package/lib/view/expenseAutomationView/reducers/missingReceiptsViewReducer.d.ts +1 -1
  128. package/lib/view/expenseAutomationView/reducers/transactionsViewReducer.d.ts +2 -2
  129. package/lib/view/expenseAutomationView/selectorTypes/actualMatchingViewSelectorTypes.d.ts +58 -0
  130. package/lib/view/expenseAutomationView/selectorTypes/expenseAutomationViewSelectorTypes.d.ts +2 -0
  131. package/lib/view/expenseAutomationView/selectorTypes/jeAccountSettingsViewSelectorTypes.d.ts +1 -0
  132. package/lib/view/expenseAutomationView/selectorTypes/jeNewScheduleViewSelectorTypes.d.ts +42 -0
  133. package/lib/view/expenseAutomationView/selectorTypes/jeNewScheduleViewSelectorTypes.js +2 -0
  134. package/lib/view/expenseAutomationView/selectorTypes/jeSchedulesSelectorTypes.d.ts +36 -7
  135. package/lib/view/expenseAutomationView/selectors/actualMatchingViewSelector.d.ts +9 -0
  136. package/lib/view/expenseAutomationView/selectors/actualMatchingViewSelector.js +172 -0
  137. package/lib/view/expenseAutomationView/selectors/jeAccountSettingsViewSelector.js +1 -0
  138. package/lib/view/expenseAutomationView/selectors/jeNewScheduleViewSelector.d.ts +21 -0
  139. package/lib/view/expenseAutomationView/selectors/jeNewScheduleViewSelector.js +112 -0
  140. package/lib/view/expenseAutomationView/selectors/jeSchedulesViewSelector.d.ts +34 -0
  141. package/lib/view/expenseAutomationView/selectors/jeSchedulesViewSelector.js +305 -21
  142. package/lib/view/expenseAutomationView/types/actualMatchingViewState.d.ts +76 -0
  143. package/lib/view/expenseAutomationView/types/actualMatchingViewState.js +27 -0
  144. package/lib/view/expenseAutomationView/types/completedSubTab.d.ts +1 -1
  145. package/lib/view/expenseAutomationView/types/jeSchedulesViewState.d.ts +83 -8
  146. package/lib/view/expenseAutomationView/types/jeSchedulesViewState.js +11 -7
  147. package/lib/view/expenseAutomationView/types/reconciliationViewState.d.ts +2 -2
  148. package/lib/view/invoicing/editInvoicingCatalogItemDetailView/editInvoicingCatalogItemDetailViewPayload.d.ts +1 -12
  149. package/lib/view/invoicing/editInvoicingCatalogItemDetailView/editInvoicingCatalogItemDetailViewPayload.js +9 -25
  150. package/lib/view/invoicing/editInvoicingCatalogItemDetailView/saveInvoicingCatalogItemEpic.js +1 -6
  151. package/lib/view/invoicing/invoicingQboView/invoicingQboViewSelector.d.ts +1 -10
  152. package/lib/view/invoicing/invoicingQboView/invoicingQboViewSelector.js +1 -43
  153. package/lib/view/invoicing/settingsView/settingsViewEpics.d.ts +12 -0
  154. package/lib/view/invoicing/settingsView/settingsViewEpics.js +99 -0
  155. package/lib/view/invoicing/settingsView/settingsViewReducer.d.ts +1 -4
  156. package/lib/view/invoicing/settingsView/settingsViewReducer.js +2 -26
  157. package/lib/view/invoicing/settingsView/settingsViewSelector.d.ts +0 -35
  158. package/lib/view/invoicing/settingsView/settingsViewSelector.js +1 -43
  159. package/lib/view/invoicing/settingsView/settingsViewState.d.ts +0 -8
  160. package/lib/view/recommendation/recommendationPayload.d.ts +0 -34
  161. package/lib/view/recommendation/recommendationReducer.d.ts +1 -2
  162. package/lib/view/recommendation/recommendationReducer.js +2 -17
  163. package/lib/view/scheduleView/scheduleListView/epics/fetchAccruedScheduleListEpic.js +1 -1
  164. package/lib/view/scheduleView/scheduleListView/epics/fetchDownloadSchedulesEpic.js +7 -2
  165. package/lib/view/scheduleView/scheduleListView/scheduleListReducer.d.ts +4 -2
  166. package/lib/view/scheduleView/scheduleListView/scheduleListReducer.js +5 -3
  167. package/package.json +1 -1
  168. package/lib/esm/view/invoicing/settingsView/epics/connectInvoicingStripeEpic.js +0 -27
  169. package/lib/esm/view/invoicing/settingsView/epics/disconnectInvoicingStripeEpic.js +0 -19
  170. package/lib/esm/view/invoicing/settingsView/epics/fetchInvoicingSettingsEpic.js +0 -19
  171. package/lib/esm/view/invoicing/settingsView/epics/saveInvoicingSettingsEpic.js +0 -39
  172. package/lib/esm/view/invoicing/settingsView/epics/submitInvoicingQboSettingsEpic.js +0 -25
  173. package/lib/esm/view/invoicing/settingsView/invoicingQboSettingsFormConfig.js +0 -48
  174. package/lib/esm/view/recommendation/submitRecommendationFeedbackEpic.js +0 -52
  175. package/lib/view/invoicing/settingsView/epics/connectInvoicingStripeEpic.d.ts +0 -6
  176. package/lib/view/invoicing/settingsView/epics/connectInvoicingStripeEpic.js +0 -31
  177. package/lib/view/invoicing/settingsView/epics/disconnectInvoicingStripeEpic.d.ts +0 -6
  178. package/lib/view/invoicing/settingsView/epics/disconnectInvoicingStripeEpic.js +0 -23
  179. package/lib/view/invoicing/settingsView/epics/fetchInvoicingSettingsEpic.d.ts +0 -6
  180. package/lib/view/invoicing/settingsView/epics/fetchInvoicingSettingsEpic.js +0 -23
  181. package/lib/view/invoicing/settingsView/epics/saveInvoicingSettingsEpic.d.ts +0 -6
  182. package/lib/view/invoicing/settingsView/epics/saveInvoicingSettingsEpic.js +0 -43
  183. package/lib/view/invoicing/settingsView/epics/settingsViewActionType.d.ts +0 -5
  184. package/lib/view/invoicing/settingsView/epics/submitInvoicingQboSettingsEpic.d.ts +0 -11
  185. package/lib/view/invoicing/settingsView/epics/submitInvoicingQboSettingsEpic.js +0 -29
  186. package/lib/view/invoicing/settingsView/invoicingQboSettingsFormConfig.d.ts +0 -34
  187. package/lib/view/invoicing/settingsView/invoicingQboSettingsFormConfig.js +0 -53
  188. package/lib/view/recommendation/submitRecommendationFeedbackEpic.d.ts +0 -7
  189. package/lib/view/recommendation/submitRecommendationFeedbackEpic.js +0 -56
  190. /package/lib/esm/view/{invoicing/settingsView/epics/settingsViewActionType.js → expenseAutomationView/selectorTypes/actualMatchingViewSelectorTypes.js} +0 -0
  191. /package/lib/view/{invoicing/settingsView/epics/settingsViewActionType.js → expenseAutomationView/selectorTypes/actualMatchingViewSelectorTypes.js} +0 -0
@@ -8,12 +8,15 @@ exports.getJEScheduleTransactionDetailKeyPayload = getJEScheduleTransactionDetai
8
8
  exports.getJEScheduleKey = getJEScheduleKey;
9
9
  exports.toJEScheduledTransaction = toJEScheduledTransaction;
10
10
  exports.toJEAccruedScheduledTransaction = toJEAccruedScheduledTransaction;
11
+ exports.toJEOneTimeAccrual = toJEOneTimeAccrual;
11
12
  const amount_1 = require("../../commonStateTypes/amount");
12
13
  const timePeriod_1 = require("../../commonStateTypes/timePeriod");
13
14
  const zeniDayJS_1 = require("../../zeniDayJS");
15
+ const zeniUrl_1 = require("../../zeniUrl");
14
16
  const transactionIDPayload_1 = require("../transaction/payloadTypes/transactionIDPayload");
15
17
  const jeScheduleHelper_1 = require("./jeScheduleHelper");
16
18
  const jeSchedulesTypes_1 = require("./jeSchedulesTypes");
19
+ const USD_CURRENCY_CODE = 'USD';
17
20
  function toScheduledJournalEntryState(payload, currency_code, currency_symbol) {
18
21
  return {
19
22
  status: {
@@ -212,6 +215,43 @@ function toJEScheduleAISummaries(payload) {
212
215
  : undefined,
213
216
  };
214
217
  }
218
+ if (payload.starting_month != null) {
219
+ result.startingMonth = {
220
+ confidence: payload.starting_month.confidence,
221
+ reasoning: payload.starting_month.reasoning,
222
+ cot: Array.isArray(payload.starting_month.cot)
223
+ ? payload.starting_month.cot
224
+ : undefined,
225
+ };
226
+ }
227
+ if (payload.end_date != null) {
228
+ result.endDate = {
229
+ confidence: payload.end_date.confidence,
230
+ reasoning: payload.end_date.reasoning,
231
+ cot: Array.isArray(payload.end_date.cot)
232
+ ? payload.end_date.cot
233
+ : undefined,
234
+ };
235
+ }
236
+ if (payload.posting_start_date != null) {
237
+ result.postingStartDate = {
238
+ confidence: payload.posting_start_date.confidence,
239
+ reasoning: payload.posting_start_date.reasoning,
240
+ cot: Array.isArray(payload.posting_start_date.cot)
241
+ ? payload.posting_start_date.cot
242
+ : undefined,
243
+ };
244
+ }
245
+ if (payload.schedule_summary != null) {
246
+ result.scheduleSummary = {
247
+ confidence: payload.schedule_summary.confidence,
248
+ reasoning: payload.schedule_summary.reasoning,
249
+ reasoningLong: payload.schedule_summary.reasoning_long,
250
+ cot: Array.isArray(payload.schedule_summary.cot)
251
+ ? payload.schedule_summary.cot
252
+ : undefined,
253
+ };
254
+ }
215
255
  return Object.keys(result).length > 0 ? result : undefined;
216
256
  }
217
257
  function toJEScheduleRecommendations(payload) {
@@ -258,9 +298,18 @@ function toJEScheduledTransaction(payload) {
258
298
  startDate: payload.start_date != null ? (0, zeniDayJS_1.date)(payload.start_date) : undefined,
259
299
  endDate: payload.end_date != null ? (0, zeniDayJS_1.date)(payload.end_date) : undefined,
260
300
  period: payload.period != null ? Number(payload.period) : undefined,
301
+ recurringAmount: payload.recurring_amount != null
302
+ ? {
303
+ amount: payload.recurring_amount,
304
+ currencyCode: payload.currency_code,
305
+ currencySymbol: payload.currency_symbol,
306
+ }
307
+ : undefined,
308
+ postedCount: payload.posted_count ?? undefined,
261
309
  updatedByUserID: payload.updated_by.user_id,
262
310
  balanceAsOfToday: payload.balance ?? undefined,
263
311
  updatedAt: payload.updated_at != null ? (0, zeniDayJS_1.date)(payload.updated_at) : undefined,
312
+ createTime: payload.create_time != null ? (0, zeniDayJS_1.date)(payload.create_time) : undefined,
264
313
  jeCredit: {
265
314
  accountId: payload.je_credit_account_id ?? undefined,
266
315
  accountingClassId: payload.je_credit_accounting_class_id ?? undefined,
@@ -285,6 +334,7 @@ function toJEScheduledTransaction(payload) {
285
334
  : {},
286
335
  scheduledJournalEntry: [],
287
336
  aiSummaries: toJEScheduleAISummaries(payload.ai_summaries),
337
+ confidenceScore: payload.confidence_score ?? undefined,
288
338
  createdByUserID: payload.created_by?.user_id ?? undefined,
289
339
  recommendations: toJEScheduleRecommendations(payload.recommendations),
290
340
  };
@@ -316,6 +366,9 @@ function toJEAccruedScheduledTransaction(payload) {
316
366
  endDate: payload.end_date != null ? (0, zeniDayJS_1.date)(payload.end_date) : undefined,
317
367
  period: payload.period != null ? Number(payload.period) : undefined,
318
368
  updatedByUserID: payload.updated_by.user_id,
369
+ // The accrued joiner resolves createdByUserID into the "Created by" cell. Without this the
370
+ // payload's created_by was dropped here and every accrued row rendered a hyphen.
371
+ createdByUserID: payload.created_by?.user_id ?? undefined,
319
372
  balanceAsOfToday: payload.balance ?? undefined,
320
373
  updatedAt: payload.updated_at != null ? (0, zeniDayJS_1.date)(payload.updated_at) : undefined,
321
374
  jeCredit: {
@@ -342,3 +395,159 @@ function toJEAccruedScheduledTransaction(payload) {
342
395
  jeScheduleType: (0, jeSchedulesTypes_1.toScheduleTypesTypeStrict)(payload.je_schedule_type),
343
396
  };
344
397
  }
398
+ /**
399
+ * Reads the months in the order the snapshot gives them rather than deriving a range: a vendor that
400
+ * skipped a month has no entry for it, so filling gaps would invent history that was never billed.
401
+ */
402
+ function toJEOneTimeAccrualMonthlyTotals(snapshot, currencyCode) {
403
+ const monthlyTotals = snapshot.monthly_totals;
404
+ if (monthlyTotals == null) {
405
+ return [];
406
+ }
407
+ const months = snapshot.sorted_months ?? Object.keys(monthlyTotals).sort();
408
+ return months
409
+ .filter((month) => monthlyTotals[month] != null)
410
+ .map((month) => ({
411
+ month,
412
+ amount: toOneTimeAccrualAmount(monthlyTotals[month], currencyCode),
413
+ }));
414
+ }
415
+ function toJEOneTimeAccrualProfileSnapshot(payload, currencyCode) {
416
+ if (payload == null) {
417
+ return undefined;
418
+ }
419
+ const billingPattern = payload.billing_pattern;
420
+ return {
421
+ monthlyTotals: toJEOneTimeAccrualMonthlyTotals(payload, currencyCode),
422
+ billingPattern: billingPattern != null
423
+ ? {
424
+ frequency: billingPattern.frequency ?? undefined,
425
+ monthsOfHistory: billingPattern.months_of_history ?? undefined,
426
+ consistencyScore: billingPattern.consistency_score ?? undefined,
427
+ billingLagDays: billingPattern.billing_lag_days ?? undefined,
428
+ typicalBillDay: billingPattern.typical_bill_day ?? undefined,
429
+ avgAmount: billingPattern.avg_amount != null
430
+ ? toOneTimeAccrualAmount(billingPattern.avg_amount, currencyCode)
431
+ : undefined,
432
+ lastBillAmount: billingPattern.last_bill_amount != null
433
+ ? toOneTimeAccrualAmount(billingPattern.last_bill_amount, currencyCode)
434
+ : undefined,
435
+ lastBillDate: billingPattern.last_bill_date != null
436
+ ? (0, zeniDayJS_1.date)(billingPattern.last_bill_date)
437
+ : undefined,
438
+ }
439
+ : undefined,
440
+ };
441
+ }
442
+ function toJEOneTimeAccrualAiSuggestion(payload, currencyCode) {
443
+ if (payload == null) {
444
+ return undefined;
445
+ }
446
+ return {
447
+ memo: payload.memo ?? undefined,
448
+ jeDebitAccountName: payload.je_debit_account_name ?? undefined,
449
+ jeCreditAccountName: payload.je_credit_account_name ?? undefined,
450
+ estimatedAmount: payload.estimated_amount != null
451
+ ? toOneTimeAccrualAmount(payload.estimated_amount, currencyCode)
452
+ : undefined,
453
+ };
454
+ }
455
+ function toJEOneTimeAccrualCleared(payload, currencyCode) {
456
+ if (payload == null) {
457
+ return undefined;
458
+ }
459
+ return {
460
+ matchedTransactionIntegrationId: payload.matched_transaction_integration_id ?? undefined,
461
+ matchedTransactionId: payload.matched_transaction_id ?? undefined,
462
+ matchedTransactionType: payload.matched_transaction_type ?? undefined,
463
+ matchedLineId: payload.matched_line_id ?? undefined,
464
+ consumedLineIds: payload.consumed_line_ids ?? undefined,
465
+ matchedAmount: payload.matched_amount != null
466
+ ? toOneTimeAccrualAmount(payload.matched_amount, currencyCode)
467
+ : undefined,
468
+ reversedAt: payload.reversed_at != null ? (0, zeniDayJS_1.date)(payload.reversed_at) : undefined,
469
+ matchTier: payload.match_tier ?? undefined,
470
+ matchShape: payload.match_shape ?? undefined,
471
+ };
472
+ }
473
+ function toJEOneTimeAccrualMatchSuggestion(payload, currencyCode) {
474
+ if (payload == null) {
475
+ return undefined;
476
+ }
477
+ return {
478
+ resolution: payload.resolution ?? undefined,
479
+ matchedTransactionIntegrationId: payload.matched_transaction_integration_id ?? undefined,
480
+ matchedTransactionId: payload.matched_transaction_id ?? undefined,
481
+ matchedTransactionType: payload.matched_transaction_type ?? undefined,
482
+ matchedAmount: payload.matched_amount != null
483
+ ? toOneTimeAccrualAmount(payload.matched_amount, currencyCode)
484
+ : undefined,
485
+ };
486
+ }
487
+ function toJEOneTimeAccrual(payload) {
488
+ return {
489
+ accrualId: payload._id,
490
+ vendorId: payload.vendor_id,
491
+ vendorName: payload.vendor_name,
492
+ serviceMonth: payload.service_month,
493
+ accrualStatus: (0, jeSchedulesTypes_1.toOneTimeAccrualStatusCodeType)(payload.status),
494
+ origin: (0, jeSchedulesTypes_1.toOneTimeAccrualOriginType)(payload.origin),
495
+ automationTier: payload.automation_tier != null
496
+ ? (0, jeSchedulesTypes_1.toOneTimeAccrualAutomationTierType)(payload.automation_tier)
497
+ : undefined,
498
+ estimatedAmount: toOneTimeAccrualAmount(payload.estimated_amount, payload.currency),
499
+ memo: payload.memo ?? '',
500
+ profileSnapshot: toJEOneTimeAccrualProfileSnapshot(payload.profile_snapshot, payload.currency),
501
+ aiSuggestion: toJEOneTimeAccrualAiSuggestion(payload.ai_suggestion, payload.currency),
502
+ cleared: toJEOneTimeAccrualCleared(payload.cleared, payload.currency),
503
+ matchSuggestion: toJEOneTimeAccrualMatchSuggestion(payload.match_suggestion, payload.currency),
504
+ // Exclusive by contract: a scheduled row reverses on expectedReversalDate and bills never
505
+ // drive it, so the two never need reconciling. Defaulting to on_bill_match matches the
506
+ // create path's default when the field is absent on an older document.
507
+ reversalPolicy: (0, jeSchedulesTypes_1.toOneTimeAccrualReversalPolicyType)(payload.reversal_policy ?? 'on_bill_match'),
508
+ reversalTrigger: (0, jeSchedulesTypes_1.toOneTimeAccrualReversalTriggerType)(payload.reversal_trigger ?? undefined),
509
+ expectedReversalDate: payload.expected_reversal_date != null
510
+ ? (0, zeniDayJS_1.date)(payload.expected_reversal_date)
511
+ : undefined,
512
+ postingDate: payload.posting_date != null ? (0, zeniDayJS_1.date)(payload.posting_date) : undefined,
513
+ actualPostDate: payload.actual_post_date != null
514
+ ? (0, zeniDayJS_1.date)(payload.actual_post_date)
515
+ : undefined,
516
+ actualReversalPostDate: payload.actual_reversal_post_date != null
517
+ ? (0, zeniDayJS_1.date)(payload.actual_reversal_post_date)
518
+ : undefined,
519
+ jeDebitAccountId: payload.je_debit_account_id ?? undefined,
520
+ jeDebitAccountName: payload.je_debit_account_name ?? undefined,
521
+ jeDebitAccountingClassId: payload.je_debit_accounting_class_id ?? undefined,
522
+ jeDebitAccountingClassName: payload.je_debit_accounting_class_name ?? undefined,
523
+ jeCreditAccountId: payload.je_credit_account_id ?? undefined,
524
+ jeCreditAccountName: payload.je_credit_account_name ?? undefined,
525
+ jeCreditAccountingClassId: payload.je_credit_accounting_class_id ?? undefined,
526
+ jeCreditAccountingClassName: payload.je_credit_accounting_class_name ?? undefined,
527
+ transactionId: payload.transaction_id ?? undefined,
528
+ transactionIntegrationId: payload.transaction_integration_id ?? undefined,
529
+ reversalTransactionId: payload.reversal_transaction_id ?? undefined,
530
+ createdBy: toJEOneTimeAccrualCreator(payload.created_by_user),
531
+ };
532
+ }
533
+ // The accrual wire format carries a currency CODE but no symbol, so the symbol has to be derived.
534
+ // Only USD has a known glyph today (the create path is USD-only); anything else falls back to the
535
+ // code, which reads correctly as "EUR 1,200" rather than silently rendering a wrong "$".
536
+ function toOneTimeAccrualAmount(amount, currencyCode) {
537
+ const code = currencyCode ?? USD_CURRENCY_CODE;
538
+ return (0, amount_1.toAmount)(amount, code, code === USD_CURRENCY_CODE ? '$' : code);
539
+ }
540
+ function toJEOneTimeAccrualCreator(payload) {
541
+ if (payload == null) {
542
+ return undefined;
543
+ }
544
+ return {
545
+ userId: payload.user_id,
546
+ email: payload.email ?? undefined,
547
+ firstName: payload.first_name ?? undefined,
548
+ lastName: payload.last_name ?? undefined,
549
+ photo: payload.photo?.original != null
550
+ ? (0, zeniUrl_1.toZeniUrl)(payload.photo.original)
551
+ : undefined,
552
+ };
553
+ }
@@ -1,5 +1,5 @@
1
1
  import { UpdateType } from '../../commonStateTypes/common';
2
- import { JEAccruedScheduledTransactionPayload, JEScheduledTransactionPayload, ScheduledJournalEntryPayload } from './jeSchedulesPayload';
2
+ import { JEAccruedScheduledTransactionPayload, JEOneTimeAccrualPayload, 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,6 +22,8 @@ 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>;
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>;
26
28
  declare const _default: import("redux").Reducer<JESchedulesState>;
27
29
  export default _default;
@@ -4,14 +4,16 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  var _a;
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.deleteAccruedJESchedulesDetails = exports.deleteJESchedulesDetails = exports.updateAccruedJESchedulesDetails = exports.updateJESchedulesDetails = exports.updateAccruedJEScheduledTransaction = exports.updateJEScheduledTransaction = exports.updateAccruedJESchedules = exports.updateJESchedules = exports.initialState = void 0;
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;
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");
11
12
  const jeSchedulesPayload_1 = require("./jeSchedulesPayload");
12
13
  exports.initialState = {
13
14
  schedulesByTransactionKey: {},
14
15
  schedulesByAccruedJEScheduleKey: {},
16
+ oneTimeAccrualsByKey: {},
15
17
  };
16
18
  const jeSchedules = (0, toolkit_1.createSlice)({
17
19
  name: 'jeSchedules',
@@ -116,15 +118,41 @@ const jeSchedules = (0, toolkit_1.createSlice)({
116
118
  delete draft.schedulesByAccruedJEScheduleKey[JEScheduleKey];
117
119
  },
118
120
  },
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
+ },
119
146
  },
120
147
  extraReducers: (builder) => {
121
148
  builder.addCase(rootActions_1.clearAll, (draft) => {
122
149
  draft.schedulesByAccruedJEScheduleKey = {};
123
150
  draft.schedulesByTransactionKey = {};
151
+ draft.oneTimeAccrualsByKey = {};
124
152
  });
125
153
  },
126
154
  });
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;
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;
128
156
  exports.default = jeSchedules.reducer;
129
157
  /**
130
158
  * 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 { JEScheduleAISummaries, JEScheduleOtherAttributes, JEScheduleRecommendations, ScheduleJournalStatusCode, ScheduleStatus } from './jeSchedulesState';
13
- import { JEScheduleKey, JEScheduleTransactionKey, JournalEntryErrorCodeType, ScheduleTypes } from './jeSchedulesTypes';
12
+ import { JEOneTimeAccrualState, JEScheduleAISummaries, JEScheduleOtherAttributes, JEScheduleRecommendations, JESchedulesState, ScheduleJournalStatusCode, ScheduleStatus } from './jeSchedulesState';
13
+ import { JEOneTimeAccrualKey, JEScheduleKey, JEScheduleTransactionKey, JournalEntryErrorCodeType, ScheduleTypes } from './jeSchedulesTypes';
14
14
  export interface ScheduledJournalEntry {
15
15
  error: JournalEntryErrorCodeType[];
16
16
  expectedPostDate: ZeniDate;
@@ -55,13 +55,17 @@ export interface JEScheduledTransaction {
55
55
  accountingClass?: Class;
56
56
  };
57
57
  jeScheduleTransactionKey: JEScheduleTransactionKey;
58
+ lifecycleTotal: number;
58
59
  otherAttributes: JEScheduleOtherAttributes;
60
+ postedCount: number;
59
61
  scheduledJournalEntry: ScheduledJournalEntry[];
60
62
  status: ScheduleStatus;
61
63
  vendor: Vendor;
62
64
  aiSummaries?: JEScheduleAISummaries;
63
65
  balanceAsOfToday?: Amount;
66
+ confidenceScore?: number;
64
67
  createdByUser?: User;
68
+ createTime?: ZeniDate;
65
69
  dayOfPostingDate?: ScheduleDaysOfMonth;
66
70
  endDate?: ZeniDate;
67
71
  jeScheduleId?: ID;
@@ -69,9 +73,14 @@ export interface JEScheduledTransaction {
69
73
  lastDayOfMonth?: boolean;
70
74
  period?: number;
71
75
  recommendations?: JEScheduleRecommendations;
76
+ recurringAmount?: Amount;
72
77
  startDate?: ZeniDate;
73
78
  updatedAt?: ZeniDate;
74
79
  updatedByUser?: User;
75
80
  }
81
+ export interface JEOneTimeAccrual extends JEOneTimeAccrualState {
82
+ jeOneTimeAccrualKey: JEOneTimeAccrualKey;
83
+ }
84
+ export declare const getJEOneTimeAccrualByKey: (jeOneTimeAccrualKey: JEOneTimeAccrualKey, jeSchedulesState: JESchedulesState) => JEOneTimeAccrual | undefined;
76
85
  export declare const getJEAccruedScheduleByJEScheduleKey: (JEScheduleKey: JEScheduleKey, state: RootState) => JEAccruedSchedule | undefined;
77
86
  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 = void 0;
6
+ exports.getJEScheduledTransactionByJEScheduleTransactionKey = exports.getJEAccruedScheduleByJEScheduleKey = exports.getJEOneTimeAccrualByKey = 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,18 +11,35 @@ 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;
14
28
  const getJEAccruedScheduleByJEScheduleKey = (JEScheduleKey, state) => {
15
29
  const { jeSchedulesState, vendorState, accountState, userState, classState } = state;
16
30
  const JEAccruedScheduleState = (0, get_1.default)(jeSchedulesState.schedulesByAccruedJEScheduleKey, JEScheduleKey);
17
31
  if (JEAccruedScheduleState == null) {
18
32
  return undefined;
19
33
  }
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;
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;
21
35
  const vendorDetails = (0, vendorSelector_1.getVendorByVendorId)(vendorState, vendorId);
22
36
  if (vendorDetails == null) {
23
37
  throw new Error(`Vendor with ${vendorId} doesn't exist`);
24
38
  }
25
39
  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;
26
43
  const accountCredit = jeCredit.accountId != null
27
44
  ? (0, accountSelector_1.getAccountBase)(accountState, jeCredit.accountId, 'account_list')
28
45
  : undefined;
@@ -41,14 +58,19 @@ const getJEAccruedScheduleByJEScheduleKey = (JEScheduleKey, state) => {
41
58
  reportId: 'class_list',
42
59
  })
43
60
  : undefined;
61
+ const postedCount = scheduledJournalEntry.filter((sje) => sje.status.code === 'posted' || sje.status.code === 'recorded').length;
62
+ const lifecycleTotal = period ?? scheduledJournalEntry.length;
44
63
  return {
45
64
  jeScheduleId,
46
65
  otherAttributes,
47
66
  vendor: vendorDetails,
48
67
  updatedByUser: userDetails,
68
+ createdByUser: createdByUserDetails,
49
69
  updatedAt,
50
70
  currencyCode,
51
71
  currencySymbol,
72
+ lifecycleTotal,
73
+ postedCount,
52
74
  jeCredit: {
53
75
  accountingClass: classCredit,
54
76
  account: accountCredit,
@@ -66,6 +88,7 @@ const getJEAccruedScheduleByJEScheduleKey = (JEScheduleKey, state) => {
66
88
  memo,
67
89
  createTime,
68
90
  recurringAmount,
91
+ jeScheduleType,
69
92
  jeAccruedScheduleKey: JEScheduleKey,
70
93
  balanceAsOfToday: balanceAsOfToday != null
71
94
  ? (0, amount_1.toAmount)(balanceAsOfToday, currencyCode, currencySymbol)
@@ -77,7 +100,7 @@ exports.getJEAccruedScheduleByJEScheduleKey = getJEAccruedScheduleByJEScheduleKe
77
100
  const getJEScheduledTransactionByJEScheduleTransactionKey = (jeScheduleTransactionKey, state) => {
78
101
  const { jeSchedulesState, vendorState, accountState, userState, classState, transactionState, } = state;
79
102
  const jeScheduleTransactionState = (0, get_1.default)(jeSchedulesState.schedulesByTransactionKey, jeScheduleTransactionKey);
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;
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;
81
104
  const vendorDetails = (0, vendorSelector_1.getVendorByVendorId)(vendorState, vendorId);
82
105
  if (vendorDetails == null) {
83
106
  throw new Error(`Vendor with ${vendorId} doesn't exist`);
@@ -106,14 +129,24 @@ const getJEScheduledTransactionByJEScheduleTransactionKey = (jeScheduleTransacti
106
129
  reportId: 'class_list',
107
130
  })
108
131
  : 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;
109
139
  return {
110
140
  jeScheduleId,
111
141
  jeScheduleType,
142
+ recurringAmount,
112
143
  jeScheduleTransactionKey: jeScheduleTransactionKey,
113
144
  vendor: vendorDetails,
114
145
  updatedByUser: userDetails,
115
146
  updatedAt: updatedAt,
116
147
  period,
148
+ lifecycleTotal,
149
+ postedCount,
117
150
  balanceAsOfToday: balanceAsOfToday != null
118
151
  ? (0, amount_1.toAmount)(balanceAsOfToday, currencyCode, currencySymbol)
119
152
  : undefined,
@@ -136,7 +169,9 @@ const getJEScheduledTransactionByJEScheduleTransactionKey = (jeScheduleTransacti
136
169
  },
137
170
  scheduledJournalEntry,
138
171
  aiSummaries,
172
+ confidenceScore,
139
173
  createdByUser: createdByUserDetails,
174
+ createTime,
140
175
  recommendations,
141
176
  };
142
177
  };