@zeniai/client-epic-state 5.1.86 → 5.1.88-betaRD0

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 (180) hide show
  1. package/lib/entity/aiCfo/aiCfoPayload.d.ts +7 -0
  2. package/lib/entity/aiCfo/aiCfoReducer.d.ts +3 -2
  3. package/lib/entity/aiCfo/aiCfoReducer.js +25 -2
  4. package/lib/entity/aiCfo/aiCfoState.d.ts +9 -2
  5. package/lib/entity/customerSatisfaction/customerSatisfactionReducer.d.ts +1 -1
  6. package/lib/entity/customerSatisfaction/customerSatisfactionReducer.js +6 -2
  7. package/lib/entity/jeSchedules/jeScheduleHelper.d.ts +2 -0
  8. package/lib/entity/jeSchedules/jeScheduleHelper.js +7 -0
  9. package/lib/entity/jeSchedules/jeSchedulesPayload.d.ts +34 -1
  10. package/lib/entity/jeSchedules/jeSchedulesPayload.js +68 -0
  11. package/lib/entity/jeSchedules/jeSchedulesReducer.d.ts +4 -2
  12. package/lib/entity/jeSchedules/jeSchedulesReducer.js +24 -2
  13. package/lib/entity/jeSchedules/jeSchedulesSelector.d.ts +10 -2
  14. package/lib/entity/jeSchedules/jeSchedulesSelector.js +28 -3
  15. package/lib/entity/jeSchedules/jeSchedulesState.d.ts +41 -1
  16. package/lib/entity/jeSchedules/jeSchedulesTypes.d.ts +12 -1
  17. package/lib/entity/jeSchedules/jeSchedulesTypes.js +40 -1
  18. package/lib/entity/snackbar/snackbarTypes.d.ts +1 -1
  19. package/lib/entity/snackbar/snackbarTypes.js +29 -0
  20. package/lib/entity/transaction/payloadTypes/scheduleTransactionPayload.d.ts +2 -0
  21. package/lib/entity/transaction/payloadTypes/scheduleTransactionPayload.js +2 -0
  22. package/lib/entity/transaction/stateTypes/scheduleTransaction.d.ts +2 -0
  23. package/lib/epic.d.ts +6 -1
  24. package/lib/epic.js +8 -1
  25. package/lib/esm/entity/aiCfo/aiCfoReducer.js +23 -1
  26. package/lib/esm/entity/customerSatisfaction/customerSatisfactionReducer.js +4 -1
  27. package/lib/esm/entity/jeSchedules/jeScheduleHelper.js +6 -0
  28. package/lib/esm/entity/jeSchedules/jeSchedulesPayload.js +68 -1
  29. package/lib/esm/entity/jeSchedules/jeSchedulesReducer.js +24 -2
  30. package/lib/esm/entity/jeSchedules/jeSchedulesSelector.js +26 -2
  31. package/lib/esm/entity/jeSchedules/jeSchedulesTypes.js +34 -0
  32. package/lib/esm/entity/snackbar/snackbarTypes.js +29 -0
  33. package/lib/esm/entity/transaction/payloadTypes/scheduleTransactionPayload.js +2 -0
  34. package/lib/esm/epic.js +8 -1
  35. package/lib/esm/index.js +14 -8
  36. package/lib/esm/view/companyHealthMetricView/companyHealthMetricConfigReducer.js +4 -1
  37. package/lib/esm/view/expenseAutomationView/epics/common/fetchAllExpenseAutomationTabsEpic.js +6 -3
  38. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulesEpic.js +34 -3
  39. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/newSchedule/createOneTimeAccrualEpic.js +81 -0
  40. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/newSchedule/initializeNewScheduleEpic.js +21 -0
  41. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/newSchedule/saveNewScheduleEpic.js +110 -0
  42. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/newSchedule/searchTransactionsForNewScheduleEpic.js +73 -0
  43. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/switchJESchedulesTabEpic.js +22 -0
  44. package/lib/esm/view/expenseAutomationView/helpers/newScheduleLocalDataHelper.js +140 -0
  45. package/lib/esm/view/expenseAutomationView/payload/jeSchedulesPayload.js +55 -0
  46. package/lib/esm/view/expenseAutomationView/reducers/jeSchedulesViewReducer.js +187 -28
  47. package/lib/esm/view/expenseAutomationView/selectorTypes/jeNewScheduleViewSelectorTypes.js +1 -0
  48. package/lib/esm/view/expenseAutomationView/selectors/jeNewScheduleViewSelector.js +102 -0
  49. package/lib/esm/view/expenseAutomationView/selectors/jeSchedulesViewSelector.js +260 -22
  50. package/lib/esm/view/expenseAutomationView/types/jeSchedulesViewState.js +5 -6
  51. package/lib/esm/view/invoicing/createCreditNote/createCreditNoteEpic.js +24 -4
  52. package/lib/esm/view/invoicing/createInvoice/createInvoiceEpic.js +24 -4
  53. package/lib/esm/view/invoicing/createInvoice/createInvoiceSelector.js +37 -10
  54. package/lib/esm/view/invoicing/discountAction/discountActionEpic.js +33 -9
  55. package/lib/esm/view/invoicing/dunningAction/dunningActionEpic.js +35 -9
  56. package/lib/esm/view/invoicing/editInvoicingCatalogItemDetailView/catalogDetailEditPayload.js +5 -1
  57. package/lib/esm/view/invoicing/editInvoicingCatalogItemDetailView/saveInvoicingCatalogItemEpic.js +32 -5
  58. package/lib/esm/view/invoicing/editInvoicingCouponDetailView/saveInvoicingCouponEpic.js +23 -3
  59. package/lib/esm/view/invoicing/editInvoicingCustomerDetailView/saveInvoicingCustomerEpic.js +24 -4
  60. package/lib/esm/view/invoicing/editInvoicingSubscriptionDetailView/saveInvoicingSubscriptionEpic.js +24 -4
  61. package/lib/esm/view/invoicing/editInvoicingSubscriptionDetailView/syncInvoicingSubscriptionCouponsEpic.js +20 -3
  62. package/lib/esm/view/invoicing/invoiceAction/invoiceActionEpic.js +60 -17
  63. package/lib/esm/view/invoicing/invoicingConfigView/invoicingConfigViewReducer.js +30 -0
  64. package/lib/esm/view/invoicing/invoicingConfigView/invoicingConfigViewSelector.js +4 -29
  65. package/lib/esm/view/invoicing/invoicingDunningCaseDetailView/fetchInvoicingDunningEmailPreviewEpic.js +26 -0
  66. package/lib/esm/view/invoicing/invoicingDunningCaseDetailView/fetchInvoicingDunningEmailPreviewPageEpic.js +16 -0
  67. package/lib/esm/view/invoicing/invoicingDunningCaseDetailView/invoicingDunningCaseDetailViewPayload.js +9 -1
  68. package/lib/esm/view/invoicing/invoicingDunningCaseDetailView/invoicingDunningCaseDetailViewReducer.js +50 -1
  69. package/lib/esm/view/invoicing/invoicingDunningCaseDetailView/invoicingDunningCaseDetailViewSelector.js +14 -1
  70. package/lib/esm/view/invoicing/invoicingQboView/epics/retryInvoicingQboSyncTaskEpic.js +29 -10
  71. package/lib/esm/view/invoicing/invoicingQboView/epics/startInvoicingQboBackfillEpic.js +28 -5
  72. package/lib/esm/view/invoicing/issueCreditNote/issueCreditNoteEpic.js +24 -4
  73. package/lib/esm/view/invoicing/issueCreditNote/issueCreditNoteSelector.js +22 -14
  74. package/lib/esm/view/invoicing/recordPayment/recordPaymentEpic.js +46 -7
  75. package/lib/esm/view/invoicing/settingsView/settingsViewEpics.js +26 -8
  76. package/lib/esm/view/invoicing/settingsView/settingsViewReducer.js +1 -1
  77. package/lib/esm/view/invoicing/settingsView/settingsViewSelector.js +4 -1
  78. package/lib/esm/view/invoicing/subscriptionAction/subscriptionActionEpic.js +41 -9
  79. package/lib/esm/view/vendorFiling1099/vendorFiling1099UploadDetails/vendorFiling1099UploadDetailsReducer.js +4 -1
  80. package/lib/esm/view/vendorTabView/vendorTabViewReducer.js +4 -1
  81. package/lib/index.d.ts +23 -17
  82. package/lib/index.js +84 -50
  83. package/lib/view/companyHealthMetricView/companyHealthMetricConfigReducer.d.ts +1 -1
  84. package/lib/view/companyHealthMetricView/companyHealthMetricConfigReducer.js +5 -2
  85. package/lib/view/expenseAutomationView/epics/common/fetchAllExpenseAutomationTabsEpic.js +6 -3
  86. package/lib/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulesEpic.d.ts +2 -2
  87. package/lib/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulesEpic.js +32 -1
  88. package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/createOneTimeAccrualEpic.d.ts +8 -0
  89. package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/createOneTimeAccrualEpic.js +85 -0
  90. package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/initializeNewScheduleEpic.d.ts +8 -0
  91. package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/initializeNewScheduleEpic.js +25 -0
  92. package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/saveNewScheduleEpic.d.ts +45 -0
  93. package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/saveNewScheduleEpic.js +114 -0
  94. package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/searchTransactionsForNewScheduleEpic.d.ts +8 -0
  95. package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/searchTransactionsForNewScheduleEpic.js +77 -0
  96. package/lib/view/expenseAutomationView/epics/jeSchedule/switchJESchedulesTabEpic.d.ts +6 -0
  97. package/lib/view/expenseAutomationView/epics/jeSchedule/switchJESchedulesTabEpic.js +26 -0
  98. package/lib/view/expenseAutomationView/helpers/newScheduleLocalDataHelper.d.ts +36 -0
  99. package/lib/view/expenseAutomationView/helpers/newScheduleLocalDataHelper.js +145 -0
  100. package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.d.ts +1 -1
  101. package/lib/view/expenseAutomationView/payload/jeSchedulesPayload.d.ts +44 -2
  102. package/lib/view/expenseAutomationView/payload/jeSchedulesPayload.js +58 -1
  103. package/lib/view/expenseAutomationView/reducers/jeSchedulesViewReducer.d.ts +49 -10
  104. package/lib/view/expenseAutomationView/reducers/jeSchedulesViewReducer.js +189 -28
  105. package/lib/view/expenseAutomationView/reducers/missingReceiptsViewReducer.d.ts +1 -1
  106. package/lib/view/expenseAutomationView/reducers/transactionsViewReducer.d.ts +2 -2
  107. package/lib/view/expenseAutomationView/selectorTypes/jeNewScheduleViewSelectorTypes.d.ts +40 -0
  108. package/lib/view/expenseAutomationView/selectorTypes/jeNewScheduleViewSelectorTypes.js +2 -0
  109. package/lib/view/expenseAutomationView/selectorTypes/jeSchedulesSelectorTypes.d.ts +34 -8
  110. package/lib/view/expenseAutomationView/selectors/jeNewScheduleViewSelector.d.ts +20 -0
  111. package/lib/view/expenseAutomationView/selectors/jeNewScheduleViewSelector.js +108 -0
  112. package/lib/view/expenseAutomationView/selectors/jeSchedulesViewSelector.d.ts +10 -1
  113. package/lib/view/expenseAutomationView/selectors/jeSchedulesViewSelector.js +266 -21
  114. package/lib/view/expenseAutomationView/types/completedSubTab.d.ts +1 -1
  115. package/lib/view/expenseAutomationView/types/jeSchedulesViewState.d.ts +79 -8
  116. package/lib/view/expenseAutomationView/types/jeSchedulesViewState.js +8 -8
  117. package/lib/view/invoicing/createCreditNote/createCreditNoteEpic.d.ts +2 -1
  118. package/lib/view/invoicing/createCreditNote/createCreditNoteEpic.js +23 -3
  119. package/lib/view/invoicing/createInvoice/createInvoiceEpic.d.ts +2 -1
  120. package/lib/view/invoicing/createInvoice/createInvoiceEpic.js +23 -3
  121. package/lib/view/invoicing/createInvoice/createInvoiceSelector.d.ts +22 -8
  122. package/lib/view/invoicing/createInvoice/createInvoiceSelector.js +37 -10
  123. package/lib/view/invoicing/discountAction/discountActionEpic.d.ts +2 -1
  124. package/lib/view/invoicing/discountAction/discountActionEpic.js +32 -8
  125. package/lib/view/invoicing/dunningAction/dunningActionEpic.d.ts +2 -1
  126. package/lib/view/invoicing/dunningAction/dunningActionEpic.js +34 -8
  127. package/lib/view/invoicing/editInvoicingCatalogItemDetailView/catalogDetailEditPayload.d.ts +3 -1
  128. package/lib/view/invoicing/editInvoicingCatalogItemDetailView/catalogDetailEditPayload.js +5 -1
  129. package/lib/view/invoicing/editInvoicingCatalogItemDetailView/saveInvoicingCatalogItemEpic.d.ts +2 -1
  130. package/lib/view/invoicing/editInvoicingCatalogItemDetailView/saveInvoicingCatalogItemEpic.js +31 -4
  131. package/lib/view/invoicing/editInvoicingCouponDetailView/saveInvoicingCouponEpic.d.ts +2 -1
  132. package/lib/view/invoicing/editInvoicingCouponDetailView/saveInvoicingCouponEpic.js +22 -2
  133. package/lib/view/invoicing/editInvoicingCustomerDetailView/saveInvoicingCustomerEpic.d.ts +2 -1
  134. package/lib/view/invoicing/editInvoicingCustomerDetailView/saveInvoicingCustomerEpic.js +23 -3
  135. package/lib/view/invoicing/editInvoicingSubscriptionDetailView/saveInvoicingSubscriptionEpic.d.ts +2 -1
  136. package/lib/view/invoicing/editInvoicingSubscriptionDetailView/saveInvoicingSubscriptionEpic.js +23 -3
  137. package/lib/view/invoicing/editInvoicingSubscriptionDetailView/syncInvoicingSubscriptionCouponsEpic.d.ts +2 -1
  138. package/lib/view/invoicing/editInvoicingSubscriptionDetailView/syncInvoicingSubscriptionCouponsEpic.js +19 -2
  139. package/lib/view/invoicing/invoiceAction/invoiceActionEpic.d.ts +2 -1
  140. package/lib/view/invoicing/invoiceAction/invoiceActionEpic.js +59 -16
  141. package/lib/view/invoicing/invoicingConfigView/invoicingConfigViewPayload.d.ts +13 -0
  142. package/lib/view/invoicing/invoicingConfigView/invoicingConfigViewReducer.d.ts +1 -1
  143. package/lib/view/invoicing/invoicingConfigView/invoicingConfigViewReducer.js +30 -0
  144. package/lib/view/invoicing/invoicingConfigView/invoicingConfigViewSelector.d.ts +11 -31
  145. package/lib/view/invoicing/invoicingConfigView/invoicingConfigViewSelector.js +4 -29
  146. package/lib/view/invoicing/invoicingConfigView/invoicingConfigViewState.d.ts +15 -0
  147. package/lib/view/invoicing/invoicingDunningCaseDetailView/fetchInvoicingDunningEmailPreviewEpic.d.ts +7 -0
  148. package/lib/view/invoicing/invoicingDunningCaseDetailView/fetchInvoicingDunningEmailPreviewEpic.js +30 -0
  149. package/lib/view/invoicing/invoicingDunningCaseDetailView/fetchInvoicingDunningEmailPreviewPageEpic.d.ts +6 -0
  150. package/lib/view/invoicing/invoicingDunningCaseDetailView/fetchInvoicingDunningEmailPreviewPageEpic.js +20 -0
  151. package/lib/view/invoicing/invoicingDunningCaseDetailView/invoicingDunningCaseDetailViewEpics.d.ts +2 -2
  152. package/lib/view/invoicing/invoicingDunningCaseDetailView/invoicingDunningCaseDetailViewPayload.d.ts +12 -0
  153. package/lib/view/invoicing/invoicingDunningCaseDetailView/invoicingDunningCaseDetailViewPayload.js +11 -0
  154. package/lib/view/invoicing/invoicingDunningCaseDetailView/invoicingDunningCaseDetailViewReducer.d.ts +21 -4
  155. package/lib/view/invoicing/invoicingDunningCaseDetailView/invoicingDunningCaseDetailViewReducer.js +51 -2
  156. package/lib/view/invoicing/invoicingDunningCaseDetailView/invoicingDunningCaseDetailViewSelector.d.ts +3 -0
  157. package/lib/view/invoicing/invoicingDunningCaseDetailView/invoicingDunningCaseDetailViewSelector.js +16 -2
  158. package/lib/view/invoicing/invoicingDunningCaseDetailView/invoicingDunningCaseDetailViewState.d.ts +13 -0
  159. package/lib/view/invoicing/invoicingQboView/epics/invoicingQboViewActionType.d.ts +2 -1
  160. package/lib/view/invoicing/invoicingQboView/epics/retryInvoicingQboSyncTaskEpic.js +28 -9
  161. package/lib/view/invoicing/invoicingQboView/epics/startInvoicingQboBackfillEpic.js +27 -4
  162. package/lib/view/invoicing/issueCreditNote/issueCreditNoteEpic.d.ts +2 -1
  163. package/lib/view/invoicing/issueCreditNote/issueCreditNoteEpic.js +23 -3
  164. package/lib/view/invoicing/issueCreditNote/issueCreditNoteSelector.d.ts +24 -7
  165. package/lib/view/invoicing/issueCreditNote/issueCreditNoteSelector.js +23 -16
  166. package/lib/view/invoicing/recordPayment/recordPaymentEpic.d.ts +2 -1
  167. package/lib/view/invoicing/recordPayment/recordPaymentEpic.js +45 -6
  168. package/lib/view/invoicing/settingsView/settingsViewEpics.d.ts +2 -1
  169. package/lib/view/invoicing/settingsView/settingsViewEpics.js +25 -7
  170. package/lib/view/invoicing/settingsView/settingsViewReducer.d.ts +10 -1
  171. package/lib/view/invoicing/settingsView/settingsViewReducer.js +1 -1
  172. package/lib/view/invoicing/settingsView/settingsViewSelector.d.ts +4 -2
  173. package/lib/view/invoicing/settingsView/settingsViewSelector.js +4 -1
  174. package/lib/view/invoicing/subscriptionAction/subscriptionActionEpic.d.ts +2 -1
  175. package/lib/view/invoicing/subscriptionAction/subscriptionActionEpic.js +40 -8
  176. package/lib/view/vendorFiling1099/vendorFiling1099UploadDetails/vendorFiling1099UploadDetailsReducer.d.ts +1 -1
  177. package/lib/view/vendorFiling1099/vendorFiling1099UploadDetails/vendorFiling1099UploadDetailsReducer.js +5 -2
  178. package/lib/view/vendorTabView/vendorTabViewReducer.d.ts +1 -1
  179. package/lib/view/vendorTabView/vendorTabViewReducer.js +5 -2
  180. package/package.json +1 -1
@@ -1,3 +1,4 @@
1
+ import { ID } from '../../commonStateTypes/common';
1
2
  import { ZeniAPIResponse } from '../../responsePayload';
2
3
  export interface TableVisualizationPayload {
3
4
  columns: string[];
@@ -101,10 +102,16 @@ export interface AiCfoAnswerPayload {
101
102
  artifact?: string | null;
102
103
  artifact_host_url?: string | null;
103
104
  artifact_title?: string | null;
105
+ exports?: AiCfoExportPayload[] | null;
104
106
  follow_up_questions?: string[];
105
107
  suggested_reply?: string | null;
106
108
  table?: AiCfoVisualizationPayload | null;
107
109
  }
110
+ export interface AiCfoExportPayload {
111
+ export_id: ID;
112
+ name: string;
113
+ size_bytes: number | null;
114
+ }
108
115
  export interface ChatSessionPayload {
109
116
  chat_session_id: string;
110
117
  chat_session_summary: string | null;
@@ -1,10 +1,11 @@
1
1
  import { ID } from '../../commonStateTypes/common';
2
2
  import { ZeniDate } from '../../zeniDayJS';
3
- import { AiCfoAnswerPayload, AiCfoVisualizationPayload, ChatSessionPayload, MessagePayload } from './aiCfoPayload';
4
- import { AiCfoState, AiCfoVisualization, FileAttachmentMetadata, SyntheticAiCfoAnswerKind } from './aiCfoState';
3
+ import { AiCfoAnswerPayload, AiCfoExportPayload, AiCfoVisualizationPayload, ChatSessionPayload, MessagePayload } from './aiCfoPayload';
4
+ import { AiCfoExport, AiCfoState, AiCfoVisualization, FileAttachmentMetadata, SyntheticAiCfoAnswerKind } from './aiCfoState';
5
5
  import type { CardPolicyUploadSource, CardPolicyWizardPlan } from './aiCfoState';
6
6
  export declare const initialAiCfoState: AiCfoState;
7
7
  export declare const toAiCfoVisualization: (visualization: AiCfoVisualizationPayload) => AiCfoVisualization | undefined;
8
+ export declare const toAiCfoExports: (payload: AiCfoExportPayload[] | null | undefined) => AiCfoExport[] | undefined;
8
9
  export declare const setNewSession: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
9
10
  chatSessionId: ID;
10
11
  createdAt: ZeniDate;
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  var _a;
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.clearSyntheticAiCfoAnswers = exports.removeSyntheticAiCfoAnswer = exports.updateSyntheticAiCfoAnswer = exports.appendSyntheticAiCfoAnswer = exports.updateAiCfoAnswerCardPolicyWizardPlan = exports.deleteQuestion = exports.clearAiCfo = exports.addQuestionPayload = exports.upsertOrAddQuestionAnswerPayload = exports.upsertAnswerPayload = exports.setChatHistory = exports.setSessions = exports.clearSession = exports.setNewSession = exports.toAiCfoVisualization = exports.initialAiCfoState = void 0;
4
+ exports.clearSyntheticAiCfoAnswers = exports.removeSyntheticAiCfoAnswer = exports.updateSyntheticAiCfoAnswer = exports.appendSyntheticAiCfoAnswer = exports.updateAiCfoAnswerCardPolicyWizardPlan = exports.deleteQuestion = exports.clearAiCfo = exports.addQuestionPayload = exports.upsertOrAddQuestionAnswerPayload = exports.upsertAnswerPayload = exports.setChatHistory = exports.setSessions = exports.clearSession = exports.setNewSession = exports.toAiCfoExports = exports.toAiCfoVisualization = exports.initialAiCfoState = void 0;
5
5
  const toolkit_1 = require("@reduxjs/toolkit");
6
6
  const rootActions_1 = require("../../rootActions");
7
7
  const zeniDayJS_1 = require("../../zeniDayJS");
@@ -121,6 +121,7 @@ function chatHistoryToQA(history) {
121
121
  artifact: parsedAgentMessage.artifact ?? undefined,
122
122
  artifactTitle: parsedAgentMessage.artifact_title ?? undefined,
123
123
  artifactHostUrl: parsedAgentMessage.artifact_host_url ?? undefined,
124
+ exports: (0, exports.toAiCfoExports)(parsedAgentMessage.exports),
124
125
  },
125
126
  createdAt: (0, zeniDayJS_1.date)(agentMessage.created_at),
126
127
  };
@@ -311,6 +312,27 @@ const toCardPolicyInitialData = (payload) => {
311
312
  wizardPlan: toCardPolicyWizardPlan(payload.wizard_plan),
312
313
  };
313
314
  };
315
+ // Drops entries missing id or name (broken download path); returns undefined, not [], so the field stays absent.
316
+ const toAiCfoExports = (payload) => {
317
+ if (!Array.isArray(payload)) {
318
+ return undefined;
319
+ }
320
+ const mapped = payload.flatMap((entry) => {
321
+ // Falsy, not `== null`: an empty string would reach the UI as a blank, failing button.
322
+ if (!entry?.export_id || !entry?.name) {
323
+ return [];
324
+ }
325
+ return [
326
+ {
327
+ exportId: entry.export_id,
328
+ name: entry.name,
329
+ sizeBytes: entry.size_bytes ?? undefined,
330
+ },
331
+ ];
332
+ });
333
+ return mapped.length > 0 ? mapped : undefined;
334
+ };
335
+ exports.toAiCfoExports = toAiCfoExports;
314
336
  const toAiCfoVisualizationData = (data) => {
315
337
  if ('x' in data && 'y' in data) {
316
338
  // Normalize y to always be an array
@@ -353,7 +375,7 @@ const toAiCfoVisualizationData = (data) => {
353
375
  };
354
376
  };
355
377
  const toResponseBlockType = (answer, userId) => {
356
- const { metadata, state, type, text, visualization, table, follow_up_questions, suggested_reply, assumptions, insights, summarized_title, artifact, artifact_title, artifact_host_url, } = answer;
378
+ const { metadata, state, type, text, visualization, table, follow_up_questions, suggested_reply, assumptions, insights, summarized_title, artifact, artifact_title, artifact_host_url, exports, } = answer;
357
379
  const { chat_session_id, message_id, timestamp, chain_of_thought_action_steps: chainOfThoughtActionSteps = [], } = metadata;
358
380
  return {
359
381
  messageId: message_id,
@@ -375,6 +397,7 @@ const toResponseBlockType = (answer, userId) => {
375
397
  artifact: artifact ?? undefined,
376
398
  artifactTitle: artifact_title ?? undefined,
377
399
  artifactHostUrl: artifact_host_url ?? undefined,
400
+ exports: (0, exports.toAiCfoExports)(exports),
378
401
  },
379
402
  createdAt: (0, zeniDayJS_1.date)(timestamp),
380
403
  };
@@ -140,9 +140,9 @@ export interface AiCfoVisualization {
140
140
  data: TableVisualization | ChartVisualization | InteractiveFormVisualization;
141
141
  type: AiCfoVisualizationType;
142
142
  }
143
- export declare const toMessageSender: (v: string) => "user" | "agent";
143
+ export declare const toMessageSender: (v: string) => "agent" | "user";
144
144
  export declare const toMessageType: (v: string) => "plain_text" | "json";
145
- export declare const toMessageSenderStrict: (v: string) => "user" | "agent" | undefined;
145
+ export declare const toMessageSenderStrict: (v: string) => "agent" | "user" | undefined;
146
146
  export declare const toMessageTypeStrict: (v: string) => "plain_text" | "json" | undefined;
147
147
  export type MessageSender = ReturnType<typeof toMessageSender>;
148
148
  export type MessageType = ReturnType<typeof toMessageType>;
@@ -154,6 +154,12 @@ export interface ResponseBlockBase {
154
154
  state: AiCfoAnswerStateType;
155
155
  userId: ID;
156
156
  }
157
+ /** A downloadable spreadsheet attached to one answer. See AiCfoExportPayload. */
158
+ export interface AiCfoExport {
159
+ exportId: ID;
160
+ name: string;
161
+ sizeBytes?: number;
162
+ }
157
163
  export interface AnswerContentBlockBase {
158
164
  assumptions: string;
159
165
  chainOfThoughtActionSteps: string[];
@@ -163,6 +169,7 @@ export interface AnswerContentBlockBase {
163
169
  artifact?: string;
164
170
  artifactHostUrl?: string;
165
171
  artifactTitle?: string;
172
+ exports?: AiCfoExport[];
166
173
  suggestedReply?: string;
167
174
  summarizedTitle?: string;
168
175
  table?: AiCfoVisualization;
@@ -1,7 +1,7 @@
1
1
  import { CustomerSatisfactionPayload } from './customerSatisfactionPayload';
2
2
  import { CustomerSatisfactionState } from './customerSatisfactionState';
3
3
  export declare const initialState: CustomerSatisfactionState;
4
- export declare const updateCustomerSatisfaction: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
4
+ export declare const clearAllCustomerSatisfaction: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"customerSatisfaction/clearAllCustomerSatisfaction">, updateCustomerSatisfaction: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
5
5
  payload: CustomerSatisfactionPayload[];
6
6
  }, "customerSatisfaction/updateCustomerSatisfaction">;
7
7
  declare const _default: import("redux").Reducer<CustomerSatisfactionState>;
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
+ var _a;
2
3
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.updateCustomerSatisfaction = exports.initialState = void 0;
4
+ exports.updateCustomerSatisfaction = exports.clearAllCustomerSatisfaction = exports.initialState = void 0;
4
5
  const toolkit_1 = require("@reduxjs/toolkit");
5
6
  const rootActions_1 = require("../../rootActions");
6
7
  const customerSatisfactionReducerHelpers_1 = require("./customerSatisfactionReducerHelpers");
@@ -18,10 +19,13 @@ const customerSatisfaction = (0, toolkit_1.createSlice)({
18
19
  draft.customerSatisfactionByCompanyId[newRecord.companyId] = newRecord;
19
20
  });
20
21
  },
22
+ clearAllCustomerSatisfaction() {
23
+ return exports.initialState;
24
+ },
21
25
  },
22
26
  extraReducers: (builder) => {
23
27
  builder.addCase(rootActions_1.clearAll, () => exports.initialState);
24
28
  },
25
29
  });
26
- exports.updateCustomerSatisfaction = customerSatisfaction.actions.updateCustomerSatisfaction;
30
+ _a = customerSatisfaction.actions, exports.clearAllCustomerSatisfaction = _a.clearAllCustomerSatisfaction, exports.updateCustomerSatisfaction = _a.updateCustomerSatisfaction;
27
31
  exports.default = customerSatisfaction.reducer;
@@ -1,2 +1,4 @@
1
+ import { ID } from '../../commonStateTypes/common';
1
2
  import { JEAccruedScheduledTransactionPayload } from './jeSchedulesPayload';
2
3
  export declare function generateJEScheduleKey(payload: JEAccruedScheduledTransactionPayload): `${string}_${string}`;
4
+ export declare function generateJEOneTimeAccrualKey(accrualId: ID): `${string}_one_time_accrual`;
@@ -1,6 +1,13 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.generateJEScheduleKey = generateJEScheduleKey;
4
+ exports.generateJEOneTimeAccrualKey = generateJEOneTimeAccrualKey;
4
5
  function generateJEScheduleKey(payload) {
5
6
  return `${payload.je_schedule_id}_${payload.je_schedule_type}`;
6
7
  }
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, JEScheduledTransactionState, ScheduledJournalEntryState } from './jeSchedulesState';
10
+ import { JEAccruedScheduledTransactionState, JEOneTimeAccrualState, JEScheduledTransactionState, ScheduledJournalEntryState } from './jeSchedulesState';
11
11
  import { JEScheduleKey, JEScheduleTransactionKey } from './jeSchedulesTypes';
12
12
  export interface JEScheduleOtherAttributesPayload {
13
13
  asset_id?: string | null;
@@ -72,6 +72,8 @@ 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;
75
77
  created_by?: UserPayload;
76
78
  end_date?: string | null;
77
79
  recommendations?: JEScheduleRecommendationsPayload;
@@ -84,6 +86,36 @@ export interface JEAccruedScheduledTransactionPayload extends Omit<JEScheduledTr
84
86
  memo: string;
85
87
  recurring_amount: number;
86
88
  }
89
+ export interface JEOneTimeAccrualPayload {
90
+ _id: ID;
91
+ estimated_amount: number;
92
+ origin: string;
93
+ service_month: string;
94
+ status: string;
95
+ vendor_id: ID;
96
+ vendor_name: string;
97
+ actual_post_date?: string | null;
98
+ actual_reversal_post_date?: string | null;
99
+ automation_tier?: string | null;
100
+ created_by_user?: UserPayload | null;
101
+ currency?: string | null;
102
+ expected_reversal_date?: string | null;
103
+ je_credit_account_id?: ID | null;
104
+ je_credit_account_name?: string | null;
105
+ je_credit_accounting_class_id?: ID | null;
106
+ je_credit_accounting_class_name?: string | null;
107
+ je_debit_account_id?: ID | null;
108
+ je_debit_account_name?: string | null;
109
+ je_debit_accounting_class_id?: ID | null;
110
+ je_debit_accounting_class_name?: string | null;
111
+ memo?: string | null;
112
+ posting_date?: string | null;
113
+ reversal_policy?: string | null;
114
+ reversal_transaction_id?: ID | null;
115
+ reversal_trigger?: string | null;
116
+ transaction_id?: ID | null;
117
+ transaction_integration_id?: ID | null;
118
+ }
87
119
  export interface ScheduledJournalEntryPayload {
88
120
  actual_post_date: string | null;
89
121
  create_time: string | null;
@@ -114,3 +146,4 @@ export declare function getJEScheduleTransactionDetailKeyPayload(payload: Schedu
114
146
  export declare function getJEScheduleKey(payload: JEAccruedScheduledTransactionPayload): JEScheduleKey;
115
147
  export declare function toJEScheduledTransaction(payload: JEScheduledTransactionPayload): JEScheduledTransactionState;
116
148
  export declare function toJEAccruedScheduledTransaction(payload: JEAccruedScheduledTransactionPayload): JEAccruedScheduledTransactionState;
149
+ export declare function toJEOneTimeAccrual(payload: JEOneTimeAccrualPayload): JEOneTimeAccrualState;
@@ -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: {
@@ -261,6 +264,7 @@ function toJEScheduledTransaction(payload) {
261
264
  updatedByUserID: payload.updated_by.user_id,
262
265
  balanceAsOfToday: payload.balance ?? undefined,
263
266
  updatedAt: payload.updated_at != null ? (0, zeniDayJS_1.date)(payload.updated_at) : undefined,
267
+ createTime: payload.create_time != null ? (0, zeniDayJS_1.date)(payload.create_time) : undefined,
264
268
  jeCredit: {
265
269
  accountId: payload.je_credit_account_id ?? undefined,
266
270
  accountingClassId: payload.je_credit_accounting_class_id ?? undefined,
@@ -285,6 +289,7 @@ function toJEScheduledTransaction(payload) {
285
289
  : {},
286
290
  scheduledJournalEntry: [],
287
291
  aiSummaries: toJEScheduleAISummaries(payload.ai_summaries),
292
+ confidenceScore: payload.confidence_score ?? undefined,
288
293
  createdByUserID: payload.created_by?.user_id ?? undefined,
289
294
  recommendations: toJEScheduleRecommendations(payload.recommendations),
290
295
  };
@@ -342,3 +347,66 @@ function toJEAccruedScheduledTransaction(payload) {
342
347
  jeScheduleType: (0, jeSchedulesTypes_1.toScheduleTypesTypeStrict)(payload.je_schedule_type),
343
348
  };
344
349
  }
350
+ function toJEOneTimeAccrual(payload) {
351
+ return {
352
+ accrualId: payload._id,
353
+ vendorId: payload.vendor_id,
354
+ vendorName: payload.vendor_name,
355
+ serviceMonth: payload.service_month,
356
+ accrualStatus: (0, jeSchedulesTypes_1.toOneTimeAccrualStatusCodeType)(payload.status),
357
+ origin: (0, jeSchedulesTypes_1.toOneTimeAccrualOriginType)(payload.origin),
358
+ automationTier: payload.automation_tier != null
359
+ ? (0, jeSchedulesTypes_1.toOneTimeAccrualAutomationTierType)(payload.automation_tier)
360
+ : undefined,
361
+ estimatedAmount: toOneTimeAccrualAmount(payload.estimated_amount, payload.currency),
362
+ memo: payload.memo ?? '',
363
+ // Exclusive by contract: a scheduled row reverses on expectedReversalDate and bills never
364
+ // drive it, so the two never need reconciling. Defaulting to on_bill_match matches the
365
+ // create path's default when the field is absent on an older document.
366
+ reversalPolicy: (0, jeSchedulesTypes_1.toOneTimeAccrualReversalPolicyType)(payload.reversal_policy ?? 'on_bill_match'),
367
+ reversalTrigger: (0, jeSchedulesTypes_1.toOneTimeAccrualReversalTriggerType)(payload.reversal_trigger ?? undefined),
368
+ expectedReversalDate: payload.expected_reversal_date != null
369
+ ? (0, zeniDayJS_1.date)(payload.expected_reversal_date)
370
+ : undefined,
371
+ postingDate: payload.posting_date != null ? (0, zeniDayJS_1.date)(payload.posting_date) : undefined,
372
+ actualPostDate: payload.actual_post_date != null
373
+ ? (0, zeniDayJS_1.date)(payload.actual_post_date)
374
+ : undefined,
375
+ actualReversalPostDate: payload.actual_reversal_post_date != null
376
+ ? (0, zeniDayJS_1.date)(payload.actual_reversal_post_date)
377
+ : undefined,
378
+ jeDebitAccountId: payload.je_debit_account_id ?? undefined,
379
+ jeDebitAccountName: payload.je_debit_account_name ?? undefined,
380
+ jeDebitAccountingClassId: payload.je_debit_accounting_class_id ?? undefined,
381
+ jeDebitAccountingClassName: payload.je_debit_accounting_class_name ?? undefined,
382
+ jeCreditAccountId: payload.je_credit_account_id ?? undefined,
383
+ jeCreditAccountName: payload.je_credit_account_name ?? undefined,
384
+ jeCreditAccountingClassId: payload.je_credit_accounting_class_id ?? undefined,
385
+ jeCreditAccountingClassName: payload.je_credit_accounting_class_name ?? undefined,
386
+ transactionId: payload.transaction_id ?? undefined,
387
+ transactionIntegrationId: payload.transaction_integration_id ?? undefined,
388
+ reversalTransactionId: payload.reversal_transaction_id ?? undefined,
389
+ createdBy: toJEOneTimeAccrualCreator(payload.created_by_user),
390
+ };
391
+ }
392
+ // The accrual wire format carries a currency CODE but no symbol, so the symbol has to be derived.
393
+ // Only USD has a known glyph today (the create path is USD-only); anything else falls back to the
394
+ // code, which reads correctly as "EUR 1,200" rather than silently rendering a wrong "$".
395
+ function toOneTimeAccrualAmount(amount, currencyCode) {
396
+ const code = currencyCode ?? USD_CURRENCY_CODE;
397
+ return (0, amount_1.toAmount)(amount, code, code === USD_CURRENCY_CODE ? '$' : code);
398
+ }
399
+ function toJEOneTimeAccrualCreator(payload) {
400
+ if (payload == null) {
401
+ return undefined;
402
+ }
403
+ return {
404
+ userId: payload.user_id,
405
+ email: payload.email ?? undefined,
406
+ firstName: payload.first_name ?? undefined,
407
+ lastName: payload.last_name ?? undefined,
408
+ photo: payload.photo?.original != null
409
+ ? (0, zeniUrl_1.toZeniUrl)(payload.photo.original)
410
+ : undefined,
411
+ };
412
+ }
@@ -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}_refund_${string}` | `${string}_invoice_${string}` | `${string}_payment_${string}` | `${string}_credit_memo_${string}` | `${string}_sales_receipt_${string}` | `${string}_delayed_credit_${string}` | `${string}_delayed_charge_${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">;
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.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.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,6 +118,25 @@ 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
+ },
119
140
  clearAllJEScheduleTransactions(draft) {
120
141
  draft.schedulesByTransactionKey = {};
121
142
  },
@@ -127,10 +148,11 @@ const jeSchedules = (0, toolkit_1.createSlice)({
127
148
  builder.addCase(rootActions_1.clearAll, (draft) => {
128
149
  draft.schedulesByAccruedJEScheduleKey = {};
129
150
  draft.schedulesByTransactionKey = {};
151
+ draft.oneTimeAccrualsByKey = {};
130
152
  });
131
153
  },
132
154
  });
133
- _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;
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;
134
156
  exports.default = jeSchedules.reducer;
135
157
  /**
136
158
  * Helper functions
@@ -9,8 +9,8 @@ import { ScheduleTransaction } from '../transaction/stateTypes/scheduleTransacti
9
9
  import { TransactionID } from '../transaction/stateTypes/transaction';
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;
@@ -73,5 +77,9 @@ export interface JEScheduledTransaction {
73
77
  updatedAt?: ZeniDate;
74
78
  updatedByUser?: User;
75
79
  }
80
+ export interface JEOneTimeAccrual extends JEOneTimeAccrualState {
81
+ jeOneTimeAccrualKey: JEOneTimeAccrualKey;
82
+ }
83
+ export declare const getJEOneTimeAccrualByKey: (jeOneTimeAccrualKey: JEOneTimeAccrualKey, jeSchedulesState: JESchedulesState) => JEOneTimeAccrual | undefined;
76
84
  export declare const getJEAccruedScheduleByJEScheduleKey: (JEScheduleKey: JEScheduleKey, state: RootState) => JEAccruedSchedule | undefined;
77
85
  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,13 +11,27 @@ 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, 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`);
@@ -41,6 +55,8 @@ const getJEAccruedScheduleByJEScheduleKey = (JEScheduleKey, state) => {
41
55
  reportId: 'class_list',
42
56
  })
43
57
  : undefined;
58
+ const postedCount = scheduledJournalEntry.filter((sje) => sje.status.code === 'posted' || sje.status.code === 'recorded').length;
59
+ const lifecycleTotal = period ?? scheduledJournalEntry.length;
44
60
  return {
45
61
  jeScheduleId,
46
62
  otherAttributes,
@@ -49,6 +65,8 @@ const getJEAccruedScheduleByJEScheduleKey = (JEScheduleKey, state) => {
49
65
  updatedAt,
50
66
  currencyCode,
51
67
  currencySymbol,
68
+ lifecycleTotal,
69
+ postedCount,
52
70
  jeCredit: {
53
71
  accountingClass: classCredit,
54
72
  account: accountCredit,
@@ -66,6 +84,7 @@ const getJEAccruedScheduleByJEScheduleKey = (JEScheduleKey, state) => {
66
84
  memo,
67
85
  createTime,
68
86
  recurringAmount,
87
+ jeScheduleType,
69
88
  jeAccruedScheduleKey: JEScheduleKey,
70
89
  balanceAsOfToday: balanceAsOfToday != null
71
90
  ? (0, amount_1.toAmount)(balanceAsOfToday, currencyCode, currencySymbol)
@@ -77,7 +96,7 @@ exports.getJEAccruedScheduleByJEScheduleKey = getJEAccruedScheduleByJEScheduleKe
77
96
  const getJEScheduledTransactionByJEScheduleTransactionKey = (jeScheduleTransactionKey, state) => {
78
97
  const { jeSchedulesState, vendorState, accountState, userState, classState, transactionState, } = state;
79
98
  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;
99
+ 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, } = jeScheduleTransactionState;
81
100
  const vendorDetails = (0, vendorSelector_1.getVendorByVendorId)(vendorState, vendorId);
82
101
  if (vendorDetails == null) {
83
102
  throw new Error(`Vendor with ${vendorId} doesn't exist`);
@@ -106,6 +125,8 @@ const getJEScheduledTransactionByJEScheduleTransactionKey = (jeScheduleTransacti
106
125
  reportId: 'class_list',
107
126
  })
108
127
  : undefined;
128
+ const postedCount = scheduledJournalEntry.filter((sje) => sje.status.code === 'posted' || sje.status.code === 'recorded').length;
129
+ const lifecycleTotal = period ?? scheduledJournalEntry.length;
109
130
  return {
110
131
  jeScheduleId,
111
132
  jeScheduleType,
@@ -114,6 +135,8 @@ const getJEScheduledTransactionByJEScheduleTransactionKey = (jeScheduleTransacti
114
135
  updatedByUser: userDetails,
115
136
  updatedAt: updatedAt,
116
137
  period,
138
+ lifecycleTotal,
139
+ postedCount,
117
140
  balanceAsOfToday: balanceAsOfToday != null
118
141
  ? (0, amount_1.toAmount)(balanceAsOfToday, currencyCode, currencySymbol)
119
142
  : undefined,
@@ -136,7 +159,9 @@ const getJEScheduledTransactionByJEScheduleTransactionKey = (jeScheduleTransacti
136
159
  },
137
160
  scheduledJournalEntry,
138
161
  aiSummaries,
162
+ confidenceScore,
139
163
  createdByUser: createdByUserDetails,
164
+ createTime,
140
165
  recommendations,
141
166
  };
142
167
  };
@@ -2,8 +2,9 @@ import { Amount } from '../../commonStateTypes/amount';
2
2
  import { ID } from '../../commonStateTypes/common';
3
3
  import { ScheduleDaysOfMonth } from '../../commonStateTypes/timePeriod';
4
4
  import { ZeniDate } from '../../zeniDayJS';
5
+ import { ZeniUrl as Url } from '../../zeniUrl';
5
6
  import { TransactionID } from '../transaction/stateTypes/transaction';
6
- import { JEScheduleKey, JEScheduleTransactionKey, JournalEntryErrorCodeType, ScheduleJournalEntryStatusCodeType, ScheduleStatusCodeType, ScheduleTypes } from './jeSchedulesTypes';
7
+ import { JEOneTimeAccrualKey, JEScheduleKey, JEScheduleTransactionKey, JournalEntryErrorCodeType, OneTimeAccrualAutomationTierType, OneTimeAccrualOriginType, OneTimeAccrualReversalPolicyType, OneTimeAccrualReversalTriggerType, OneTimeAccrualStatusCodeType, ScheduleJournalEntryStatusCodeType, ScheduleStatusCodeType, ScheduleTypes } from './jeSchedulesTypes';
7
8
  export interface ScheduleStatus {
8
9
  code: ScheduleStatusCodeType;
9
10
  label: string;
@@ -94,7 +95,9 @@ export interface JEScheduledTransactionState {
94
95
  vendorId: ID;
95
96
  aiSummaries?: JEScheduleAISummaries;
96
97
  balanceAsOfToday?: number;
98
+ confidenceScore?: number;
97
99
  createdByUserID?: ID;
100
+ createTime?: ZeniDate;
98
101
  dayOfPostingDate?: ScheduleDaysOfMonth;
99
102
  endDate?: ZeniDate;
100
103
  jeScheduleId?: ID;
@@ -112,7 +115,44 @@ export interface JEAccruedScheduledTransactionState extends Omit<JEScheduledTran
112
115
  memo: string;
113
116
  recurringAmount: Amount;
114
117
  }
118
+ export interface JEOneTimeAccrualCreator {
119
+ userId: ID;
120
+ email?: string;
121
+ firstName?: string;
122
+ lastName?: string;
123
+ photo?: Url;
124
+ }
125
+ export interface JEOneTimeAccrualState {
126
+ accrualId: ID;
127
+ accrualStatus: OneTimeAccrualStatusCodeType;
128
+ estimatedAmount: Amount;
129
+ memo: string;
130
+ origin: OneTimeAccrualOriginType;
131
+ reversalPolicy: OneTimeAccrualReversalPolicyType;
132
+ serviceMonth: string;
133
+ vendorId: ID;
134
+ vendorName: string;
135
+ actualPostDate?: ZeniDate;
136
+ actualReversalPostDate?: ZeniDate;
137
+ automationTier?: OneTimeAccrualAutomationTierType;
138
+ createdBy?: JEOneTimeAccrualCreator;
139
+ expectedReversalDate?: ZeniDate;
140
+ jeCreditAccountId?: ID;
141
+ jeCreditAccountingClassId?: ID;
142
+ jeCreditAccountingClassName?: string;
143
+ jeCreditAccountName?: string;
144
+ jeDebitAccountId?: ID;
145
+ jeDebitAccountingClassId?: ID;
146
+ jeDebitAccountingClassName?: string;
147
+ jeDebitAccountName?: string;
148
+ postingDate?: ZeniDate;
149
+ reversalTransactionId?: ID;
150
+ reversalTrigger?: OneTimeAccrualReversalTriggerType;
151
+ transactionId?: ID;
152
+ transactionIntegrationId?: ID;
153
+ }
115
154
  export interface JESchedulesState {
155
+ oneTimeAccrualsByKey: Record<JEOneTimeAccrualKey, JEOneTimeAccrualState>;
116
156
  schedulesByAccruedJEScheduleKey: Record<JEScheduleKey, JEAccruedScheduledTransactionState>;
117
157
  schedulesByTransactionKey: Record<JEScheduleTransactionKey, JEScheduledTransactionState>;
118
158
  }