@zeniai/client-epic-state 5.2.10-betaRD1 → 5.2.11

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 (145) hide show
  1. package/lib/entity/jeSchedules/jeScheduleHelper.d.ts +0 -1
  2. package/lib/entity/jeSchedules/jeScheduleHelper.js +0 -7
  3. package/lib/entity/jeSchedules/jeSchedulesPayload.d.ts +1 -66
  4. package/lib/entity/jeSchedules/jeSchedulesPayload.js +0 -135
  5. package/lib/entity/jeSchedules/jeSchedulesReducer.d.ts +2 -4
  6. package/lib/entity/jeSchedules/jeSchedulesReducer.js +2 -30
  7. package/lib/entity/jeSchedules/jeSchedulesSelector.d.ts +2 -11
  8. package/lib/entity/jeSchedules/jeSchedulesSelector.js +3 -38
  9. package/lib/entity/jeSchedules/jeSchedulesState.d.ts +1 -79
  10. package/lib/entity/jeSchedules/jeSchedulesTypes.d.ts +1 -24
  11. package/lib/entity/jeSchedules/jeSchedulesTypes.js +1 -88
  12. package/lib/entity/snackbar/snackbarTypes.d.ts +1 -1
  13. package/lib/entity/snackbar/snackbarTypes.js +0 -3
  14. package/lib/entity/transaction/payloadTypes/scheduleTransactionPayload.d.ts +0 -2
  15. package/lib/entity/transaction/payloadTypes/scheduleTransactionPayload.js +0 -2
  16. package/lib/entity/transaction/stateTypes/scheduleTransaction.d.ts +0 -2
  17. package/lib/epic.d.ts +1 -9
  18. package/lib/epic.js +0 -16
  19. package/lib/esm/entity/jeSchedules/jeScheduleHelper.js +0 -6
  20. package/lib/esm/entity/jeSchedules/jeSchedulesPayload.js +1 -135
  21. package/lib/esm/entity/jeSchedules/jeSchedulesReducer.js +2 -30
  22. package/lib/esm/entity/jeSchedules/jeSchedulesSelector.js +2 -36
  23. package/lib/esm/entity/jeSchedules/jeSchedulesTypes.js +0 -78
  24. package/lib/esm/entity/snackbar/snackbarTypes.js +0 -3
  25. package/lib/esm/entity/transaction/payloadTypes/scheduleTransactionPayload.js +0 -2
  26. package/lib/esm/epic.js +0 -16
  27. package/lib/esm/index.js +8 -14
  28. package/lib/esm/view/companyMonthEndReportView/companyMonthEndReportViewReducer.js +6 -2
  29. package/lib/esm/view/companyMonthEndReportView/companyMonthEndReportViewState.js +4 -0
  30. package/lib/esm/view/companyMonthEndReportView/epics/saveCompanyMonthEndReportEpic.js +10 -6
  31. package/lib/esm/view/companyMonthEndReportView/epics/sendCompanyMonthEndReportEpic.js +9 -5
  32. package/lib/esm/view/companyMonthEndReportView/monthEndTemplateData.js +32 -0
  33. package/lib/esm/view/expenseAutomationView/epics/common/fetchAllExpenseAutomationTabsEpic.js +3 -6
  34. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulesEpic.js +5 -41
  35. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/ignoreRecommendedJeScheduleEpic.js +2 -14
  36. package/lib/esm/view/expenseAutomationView/payload/jeSchedulesPayload.js +0 -55
  37. package/lib/esm/view/expenseAutomationView/reducers/jeSchedulesViewReducer.js +29 -306
  38. package/lib/esm/view/expenseAutomationView/selectors/jeSchedulesViewSelector.js +22 -294
  39. package/lib/esm/view/expenseAutomationView/types/jeSchedulesViewState.js +6 -5
  40. package/lib/esm/view/scheduleView/scheduleListView/epics/fetchAccruedScheduleListEpic.js +1 -1
  41. package/lib/esm/view/scheduleView/scheduleListView/epics/fetchDownloadSchedulesEpic.js +2 -7
  42. package/lib/esm/view/scheduleView/scheduleListView/scheduleListReducer.js +3 -5
  43. package/lib/index.d.ts +14 -18
  44. package/lib/index.js +47 -91
  45. package/lib/view/companyMonthEndReportView/companyMonthEndReportViewPayload.d.ts +8 -0
  46. package/lib/view/companyMonthEndReportView/companyMonthEndReportViewReducer.d.ts +6 -2
  47. package/lib/view/companyMonthEndReportView/companyMonthEndReportViewReducer.js +6 -2
  48. package/lib/view/companyMonthEndReportView/companyMonthEndReportViewState.d.ts +2 -0
  49. package/lib/view/companyMonthEndReportView/companyMonthEndReportViewState.js +4 -0
  50. package/lib/view/companyMonthEndReportView/epics/saveCompanyMonthEndReportEpic.js +10 -6
  51. package/lib/view/companyMonthEndReportView/epics/sendCompanyMonthEndReportEpic.js +9 -5
  52. package/lib/view/companyMonthEndReportView/monthEndTemplateData.d.ts +16 -0
  53. package/lib/view/companyMonthEndReportView/monthEndTemplateData.js +36 -0
  54. package/lib/view/expenseAutomationView/epics/common/fetchAllExpenseAutomationTabsEpic.js +3 -6
  55. package/lib/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulesEpic.d.ts +2 -3
  56. package/lib/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulesEpic.js +3 -39
  57. package/lib/view/expenseAutomationView/epics/jeSchedule/ignoreRecommendedJeScheduleEpic.js +2 -14
  58. package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.d.ts +1 -1
  59. package/lib/view/expenseAutomationView/payload/jeSchedulesPayload.d.ts +3 -72
  60. package/lib/view/expenseAutomationView/payload/jeSchedulesPayload.js +1 -58
  61. package/lib/view/expenseAutomationView/reducers/jeSchedulesViewReducer.d.ts +12 -91
  62. package/lib/view/expenseAutomationView/reducers/jeSchedulesViewReducer.js +29 -308
  63. package/lib/view/expenseAutomationView/reducers/missingReceiptsViewReducer.d.ts +1 -1
  64. package/lib/view/expenseAutomationView/reducers/transactionsViewReducer.d.ts +2 -2
  65. package/lib/view/expenseAutomationView/selectorTypes/jeSchedulesSelectorTypes.d.ts +7 -36
  66. package/lib/view/expenseAutomationView/selectors/jeSchedulesViewSelector.d.ts +0 -34
  67. package/lib/view/expenseAutomationView/selectors/jeSchedulesViewSelector.js +21 -302
  68. package/lib/view/expenseAutomationView/types/completedSubTab.d.ts +1 -1
  69. package/lib/view/expenseAutomationView/types/jeSchedulesViewState.d.ts +8 -82
  70. package/lib/view/expenseAutomationView/types/jeSchedulesViewState.js +8 -8
  71. package/lib/view/expenseAutomationView/types/reconciliationViewState.d.ts +1 -1
  72. package/lib/view/scheduleView/scheduleListView/epics/fetchAccruedScheduleListEpic.js +1 -1
  73. package/lib/view/scheduleView/scheduleListView/epics/fetchDownloadSchedulesEpic.js +2 -7
  74. package/lib/view/scheduleView/scheduleListView/scheduleListReducer.d.ts +2 -4
  75. package/lib/view/scheduleView/scheduleListView/scheduleListReducer.js +3 -5
  76. package/package.json +1 -1
  77. package/lib/commonStateTypes/selectorTypes/pickAndMergeForecastSection.d.ts +0 -0
  78. package/lib/commonStateTypes/selectorTypes/pickAndMergeForecastSection.js +0 -1
  79. package/lib/entity/invoicing/coupon/couponConstants.d.ts +0 -11
  80. package/lib/entity/invoicing/coupon/couponConstants.js +0 -29
  81. package/lib/esm/commonStateTypes/selectorTypes/pickAndMergeForecastSection.js +0 -1
  82. package/lib/esm/entity/invoicing/coupon/couponConstants.js +0 -26
  83. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/fetchOneTimeAccrualEpic.js +0 -45
  84. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/newSchedule/createOneTimeAccrualEpic.js +0 -99
  85. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/newSchedule/initializeNewScheduleEpic.js +0 -25
  86. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/newSchedule/saveNewScheduleEpic.js +0 -110
  87. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/newSchedule/searchTransactionsForNewScheduleEpic.js +0 -79
  88. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/oneTimeAccrualActionsEpic.js +0 -139
  89. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/revertJeScheduleEpic.js +0 -106
  90. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/switchJESchedulesTabEpic.js +0 -22
  91. package/lib/esm/view/expenseAutomationView/helpers/newScheduleLocalDataHelper.js +0 -140
  92. package/lib/esm/view/expenseAutomationView/selectorTypes/jeNewScheduleViewSelectorTypes.js +0 -1
  93. package/lib/esm/view/expenseAutomationView/selectors/jeNewScheduleViewSelector.js +0 -106
  94. package/lib/esm/view/invoicing/invoicingQboView/epics/fetchInvoicingQboAccountsEpic.js +0 -25
  95. package/lib/esm/view/invoicing/invoicingQboView/epics/fetchInvoicingQboClassesEpic.js +0 -15
  96. package/lib/esm/view/spendManagement/treasury/treasurySetUp/epic/updateTreasuryPromoIntroClosedByOutsideClickEpic.js +0 -18
  97. package/lib/esm/view/spendManagement/treasury/treasurySetUp/epic/updateTreasuryPromoRemindMeLaterClickedEpic.js +0 -18
  98. package/lib/esm/view/spendManagement/treasury/treasurySetUp/epic/updateTreasuryVideoViewedEpic.js +0 -18
  99. package/lib/esm/view/zeniAccountsPromoCard/zeniAccountsPromoCardEpic.js +0 -16
  100. package/lib/esm/view/zeniAccountsPromoCard/zeniAccountsPromoCardPayload.js +0 -1
  101. package/lib/esm/view/zeniAccountsPromoCard/zeniAccountsPromoCardReducer.js +0 -60
  102. package/lib/esm/view/zeniAccountsPromoCard/zeniAccountsPromoCardSelector.js +0 -12
  103. package/lib/esm/view/zeniAccountsPromoCard/zeniAccountsPromoCardState.js +0 -1
  104. package/lib/view/expenseAutomationView/epics/jeSchedule/fetchOneTimeAccrualEpic.d.ts +0 -20
  105. package/lib/view/expenseAutomationView/epics/jeSchedule/fetchOneTimeAccrualEpic.js +0 -49
  106. package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/createOneTimeAccrualEpic.d.ts +0 -8
  107. package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/createOneTimeAccrualEpic.js +0 -103
  108. package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/initializeNewScheduleEpic.d.ts +0 -8
  109. package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/initializeNewScheduleEpic.js +0 -29
  110. package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/saveNewScheduleEpic.d.ts +0 -45
  111. package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/saveNewScheduleEpic.js +0 -114
  112. package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/searchTransactionsForNewScheduleEpic.d.ts +0 -8
  113. package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/searchTransactionsForNewScheduleEpic.js +0 -83
  114. package/lib/view/expenseAutomationView/epics/jeSchedule/oneTimeAccrualActionsEpic.d.ts +0 -12
  115. package/lib/view/expenseAutomationView/epics/jeSchedule/oneTimeAccrualActionsEpic.js +0 -146
  116. package/lib/view/expenseAutomationView/epics/jeSchedule/revertJeScheduleEpic.d.ts +0 -64
  117. package/lib/view/expenseAutomationView/epics/jeSchedule/revertJeScheduleEpic.js +0 -110
  118. package/lib/view/expenseAutomationView/epics/jeSchedule/switchJESchedulesTabEpic.d.ts +0 -6
  119. package/lib/view/expenseAutomationView/epics/jeSchedule/switchJESchedulesTabEpic.js +0 -26
  120. package/lib/view/expenseAutomationView/helpers/newScheduleLocalDataHelper.d.ts +0 -36
  121. package/lib/view/expenseAutomationView/helpers/newScheduleLocalDataHelper.js +0 -145
  122. package/lib/view/expenseAutomationView/selectorTypes/jeNewScheduleViewSelectorTypes.d.ts +0 -42
  123. package/lib/view/expenseAutomationView/selectorTypes/jeNewScheduleViewSelectorTypes.js +0 -2
  124. package/lib/view/expenseAutomationView/selectors/jeNewScheduleViewSelector.d.ts +0 -21
  125. package/lib/view/expenseAutomationView/selectors/jeNewScheduleViewSelector.js +0 -112
  126. package/lib/view/invoicing/invoicingQboView/epics/fetchInvoicingQboAccountsEpic.d.ts +0 -6
  127. package/lib/view/invoicing/invoicingQboView/epics/fetchInvoicingQboAccountsEpic.js +0 -29
  128. package/lib/view/invoicing/invoicingQboView/epics/fetchInvoicingQboClassesEpic.d.ts +0 -6
  129. package/lib/view/invoicing/invoicingQboView/epics/fetchInvoicingQboClassesEpic.js +0 -19
  130. package/lib/view/spendManagement/treasury/treasurySetUp/epic/updateTreasuryPromoIntroClosedByOutsideClickEpic.d.ts +0 -8
  131. package/lib/view/spendManagement/treasury/treasurySetUp/epic/updateTreasuryPromoIntroClosedByOutsideClickEpic.js +0 -22
  132. package/lib/view/spendManagement/treasury/treasurySetUp/epic/updateTreasuryPromoRemindMeLaterClickedEpic.d.ts +0 -8
  133. package/lib/view/spendManagement/treasury/treasurySetUp/epic/updateTreasuryPromoRemindMeLaterClickedEpic.js +0 -22
  134. package/lib/view/spendManagement/treasury/treasurySetUp/epic/updateTreasuryVideoViewedEpic.d.ts +0 -8
  135. package/lib/view/spendManagement/treasury/treasurySetUp/epic/updateTreasuryVideoViewedEpic.js +0 -22
  136. package/lib/view/zeniAccountsPromoCard/zeniAccountsPromoCardEpic.d.ts +0 -13
  137. package/lib/view/zeniAccountsPromoCard/zeniAccountsPromoCardEpic.js +0 -20
  138. package/lib/view/zeniAccountsPromoCard/zeniAccountsPromoCardPayload.d.ts +0 -11
  139. package/lib/view/zeniAccountsPromoCard/zeniAccountsPromoCardPayload.js +0 -2
  140. package/lib/view/zeniAccountsPromoCard/zeniAccountsPromoCardReducer.d.ts +0 -7
  141. package/lib/view/zeniAccountsPromoCard/zeniAccountsPromoCardReducer.js +0 -64
  142. package/lib/view/zeniAccountsPromoCard/zeniAccountsPromoCardSelector.d.ts +0 -12
  143. package/lib/view/zeniAccountsPromoCard/zeniAccountsPromoCardSelector.js +0 -15
  144. package/lib/view/zeniAccountsPromoCard/zeniAccountsPromoCardState.d.ts +0 -9
  145. package/lib/view/zeniAccountsPromoCard/zeniAccountsPromoCardState.js +0 -2
@@ -1,6 +1,12 @@
1
1
  import { AttachmentFilePayload } from '../../entity/file/filePayload';
2
2
  import { ZeniAPIResponse } from '../../responsePayload';
3
3
  export type MonthEndTemplateData = Record<string, unknown>;
4
+ /**
5
+ * The AI CFO insight fields a controller can edit before the month-end email
6
+ * is sent. Keys are the `agent_insights_*` merge vars the email template
7
+ * renders from, so this object is merged straight into `template_data`.
8
+ */
9
+ export type AgentInsightEdits = Record<`agent_insights_${string}`, string>;
4
10
  export interface CompanyMonthEndReportViewPayload {
5
11
  files: AttachmentFilePayload[];
6
12
  html: string | null;
@@ -9,6 +15,8 @@ export interface CompanyMonthEndReportViewPayload {
9
15
  template_data: MonthEndTemplateData;
10
16
  tenant_receiver_email_list: string[];
11
17
  zeni_requests_data: string[];
18
+ agent_insights_edited_at?: string | null;
19
+ agent_insights_edited_by?: string | null;
12
20
  draft_user_id?: string;
13
21
  last_month_end_email_draft_saved_at?: string;
14
22
  zeni_requests_html?: string;
@@ -1,7 +1,7 @@
1
1
  import { FetchState, FetchStateAndError, ID } from '../../commonStateTypes/common';
2
2
  import { ZeniAPIStatus } from '../../responsePayload';
3
3
  import { ZeniDate } from '../../zeniDayJS';
4
- import { CompanyMonthEndHistoricReportPayload, CompanyMonthEndReportHistoricDatesPayload, CompanyMonthEndReportTemplatesPayload, CompanyMonthEndReportViewPayload } from './companyMonthEndReportViewPayload';
4
+ import { AgentInsightEdits, CompanyMonthEndHistoricReportPayload, CompanyMonthEndReportHistoricDatesPayload, CompanyMonthEndReportTemplatesPayload, CompanyMonthEndReportViewPayload } from './companyMonthEndReportViewPayload';
5
5
  import { AuditSummaryData, CompanyMonthEndReportData, CompanyMonthEndReportViewState, CompanyMonthReportTemplates } from './companyMonthEndReportViewState';
6
6
  export declare const initialState: CompanyMonthEndReportViewState;
7
7
  export declare const initialCompanyMonthEndReportData: CompanyMonthEndReportData;
@@ -35,7 +35,10 @@ export declare const fetchImproveUsingZeniGPT: import("@reduxjs/toolkit").Action
35
35
  companyId: string;
36
36
  fileId: string | undefined;
37
37
  tenantId: string | undefined;
38
- }, "reviewCompanyView/sendCompanyMonthEndReport", never, never>, saveCompanyMonthEndReport: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[recipientEmailList: any, companyId: string, subject: string, isPreview: boolean, fileId?: string | undefined, zeniRequestsHtml?: string | undefined, tenantId?: string | undefined], {
38
+ }, "reviewCompanyView/sendCompanyMonthEndReport", never, never>, saveCompanyMonthEndReport: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[recipientEmailList: any, companyId: string, subject: string, isPreview: boolean, fileId?: string | undefined, zeniRequestsHtml?: string | undefined, options?: {
39
+ agentInsightEdits?: AgentInsightEdits;
40
+ tenantId?: ID;
41
+ } | undefined], {
39
42
  recipientEmailList: any;
40
43
  companyId: string;
41
44
  subject: string;
@@ -43,6 +46,7 @@ export declare const fetchImproveUsingZeniGPT: import("@reduxjs/toolkit").Action
43
46
  fileId: string | undefined;
44
47
  zeniRequestsHtml: string | undefined;
45
48
  tenantId: string | undefined;
49
+ agentInsightEdits: AgentInsightEdits | undefined;
46
50
  }, "reviewCompanyView/saveCompanyMonthEndReport", never, never>, updateStatusForSendCompanyMonthEndReport: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[companyId: string, status: FetchState, error?: ZeniAPIStatus<Record<string, unknown>> | undefined], {
47
51
  companyId: string;
48
52
  status: FetchState;
@@ -99,7 +99,10 @@ const companyMonthEndReportView = (0, toolkit_1.createSlice)({
99
99
  },
100
100
  },
101
101
  saveCompanyMonthEndReport: {
102
- prepare(recipientEmailList, companyId, subject, isPreview, fileId, zeniRequestsHtml, tenantId) {
102
+ // The trailing pair is an object, not two more positional optionals: both
103
+ // are optional and neither is a distinct type, so a swapped call would
104
+ // compile silently.
105
+ prepare(recipientEmailList, companyId, subject, isPreview, fileId, zeniRequestsHtml, options) {
103
106
  return {
104
107
  payload: {
105
108
  recipientEmailList,
@@ -108,7 +111,8 @@ const companyMonthEndReportView = (0, toolkit_1.createSlice)({
108
111
  isPreview,
109
112
  fileId,
110
113
  zeniRequestsHtml,
111
- tenantId,
114
+ tenantId: options?.tenantId,
115
+ agentInsightEdits: options?.agentInsightEdits,
112
116
  },
113
117
  };
114
118
  },
@@ -5,6 +5,8 @@ import { AuditSummary } from '../reviewCompanyView/reviewCompanyViewState';
5
5
  import { CompanyMonthEndHistoricReportPayload, CompanyMonthEndReportViewPayload, MonthEndTemplateData } from './companyMonthEndReportViewPayload';
6
6
  export interface CompanyMonthEndReportData {
7
7
  recipientEmailList: string[];
8
+ agentInsightsEditedAt?: ZeniDate;
9
+ agentInsightsEditedBy?: string;
8
10
  attachmentFile?: AttachmentFile;
9
11
  concatenatedHtml?: string;
10
12
  draftUserId?: string;
@@ -23,6 +23,10 @@ const toCompanyMonthEndReportData = (data) => {
23
23
  : undefined,
24
24
  draftUserId: data.draft_user_id,
25
25
  zeniRequestsData: data.zeni_requests_data ?? [],
26
+ agentInsightsEditedBy: data.agent_insights_edited_by ?? undefined,
27
+ agentInsightsEditedAt: data.agent_insights_edited_at != null
28
+ ? (0, zeniDayJS_1.date)(data.agent_insights_edited_at)
29
+ : undefined,
26
30
  };
27
31
  };
28
32
  exports.toCompanyMonthEndReportData = toCompanyMonthEndReportData;
@@ -9,9 +9,10 @@ const fileSelector_1 = require("../../../entity/file/fileSelector");
9
9
  const snackbarReducer_1 = require("../../../entity/snackbar/snackbarReducer");
10
10
  const responsePayload_1 = require("../../../responsePayload");
11
11
  const zeniDayJS_1 = require("../../../zeniDayJS");
12
+ const monthEndTemplateData_1 = require("../monthEndTemplateData");
12
13
  const companyMonthEndReportViewReducer_1 = require("../companyMonthEndReportViewReducer");
13
14
  const saveCompanyMonthEndReportEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(companyMonthEndReportViewReducer_1.saveCompanyMonthEndReport.match), (0, operators_1.mergeMap)((action) => {
14
- const { companyId, recipientEmailList, subject, isPreview, fileId, zeniRequestsHtml, tenantId, } = action.payload;
15
+ const { agentInsightEdits, companyId, recipientEmailList, subject, isPreview, fileId, zeniRequestsHtml, tenantId, } = action.payload;
15
16
  const state = state$.value;
16
17
  const company = state.companyState.companiesById[companyId];
17
18
  const companyName = state.companyState.companiesById[companyId].companyInfo.name;
@@ -30,15 +31,18 @@ const saveCompanyMonthEndReportEpic = (actions$, state$, zeniAPI) => actions$.pi
30
31
  }
31
32
  }
32
33
  const payload = {
33
- template_data: {
34
- ...state.companyMonthEndReportViewState.monthEndReportDataByCompanyId[companyId].companyMonthEndReportData.templateData,
35
- subject,
36
- },
34
+ template_data: (0, monthEndTemplateData_1.buildMonthEndTemplateData)(state.companyMonthEndReportViewState.monthEndReportDataByCompanyId[companyId].companyMonthEndReportData.templateData, subject, agentInsightEdits),
37
35
  recipient_email_list: recipientEmailList,
38
36
  tenant_receiver_email_list: state.companyMonthEndReportViewState.monthEndReportDataByCompanyId[companyId].companyMonthEndReportData.tenantReceiverEmailList,
39
37
  last_report_sent_business_day: lastReportSentBusinessDay,
40
38
  last_report_sent_date: lastReportSentDate.format(timePeriod_1.DEFAULT_DATE_FORMAT),
41
- zeni_requests_html: zeniRequestsHtml,
39
+ // Three-way, because the server distinguishes all three: an empty string means the user
40
+ // cleared the box and is sent as an explicit null, a value is sent as-is, and undefined
41
+ // means this save was not about Zeni Requests at all — the key is omitted so the draft's
42
+ // existing text is left alone.
43
+ ...(zeniRequestsHtml !== undefined && {
44
+ zeni_requests_html: zeniRequestsHtml === '' ? null : zeniRequestsHtml,
45
+ }),
42
46
  files: filePayload,
43
47
  };
44
48
  const query = { is_preview: isPreview };
@@ -10,6 +10,7 @@ const snackbarReducer_1 = require("../../../entity/snackbar/snackbarReducer");
10
10
  const responsePayload_1 = require("../../../responsePayload");
11
11
  const zeniDayJS_1 = require("../../../zeniDayJS");
12
12
  const companyViewReducer_1 = require("../../companyView/companyViewReducer");
13
+ const monthEndTemplateData_1 = require("../monthEndTemplateData");
13
14
  const companyMonthEndReportViewReducer_1 = require("../companyMonthEndReportViewReducer");
14
15
  const sendCompanyMonthEndReportEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(companyMonthEndReportViewReducer_1.sendCompanyMonthEndReport.match), (0, operators_1.mergeMap)((action) => {
15
16
  const { companyId, fileId, tenantId } = action.payload;
@@ -34,15 +35,18 @@ const sendCompanyMonthEndReportEpic = (actions$, state$, zeniAPI) => actions$.pi
34
35
  }
35
36
  }
36
37
  const payload = {
37
- template_data: {
38
- ...state.companyMonthEndReportViewState.monthEndReportDataByCompanyId[companyId].companyMonthEndReportData.templateData,
39
- subject,
40
- },
38
+ template_data: (0, monthEndTemplateData_1.buildMonthEndTemplateData)(state.companyMonthEndReportViewState.monthEndReportDataByCompanyId[companyId].companyMonthEndReportData.templateData, subject),
41
39
  recipient_email_list: recipientEmailList,
42
40
  tenant_receiver_email_list: state.companyMonthEndReportViewState.monthEndReportDataByCompanyId[companyId].companyMonthEndReportData.tenantReceiverEmailList,
43
41
  last_report_sent_business_day: lastReportSentBusinessDay,
44
42
  last_report_sent_date: lastReportSentDate.format(timePeriod_1.DEFAULT_DATE_FORMAT),
45
- zeni_requests_html: zeniRequestsHtml,
43
+ // Three-way, because the server distinguishes all three: an empty string means the user
44
+ // cleared the box and is sent as an explicit null, a value is sent as-is, and undefined
45
+ // means this save was not about Zeni Requests at all — the key is omitted so the draft's
46
+ // existing text is left alone.
47
+ ...(zeniRequestsHtml !== undefined && {
48
+ zeni_requests_html: zeniRequestsHtml === '' ? null : zeniRequestsHtml,
49
+ }),
46
50
  files: filePayload,
47
51
  };
48
52
  return zeniAPI
@@ -0,0 +1,16 @@
1
+ import { AgentInsightEdits, MonthEndTemplateData } from './companyMonthEndReportViewPayload';
2
+ /**
3
+ * The AI CFO (V2) month-end email renders its subject line from this merge var
4
+ * rather than from the generic `subject` key, so a subject typed in the cockpit
5
+ * has to be written here too or the sent email keeps the AI's original subject.
6
+ */
7
+ export declare const AGENT_INSIGHTS_SUBJECT_KEY = "agent_insights_subject";
8
+ /**
9
+ * Build the `template_data` sent to the month-end email endpoint.
10
+ *
11
+ * Controller edits to the AI-generated insight fields are merged over the
12
+ * template data held in the store. The server sanitizes and persists whichever
13
+ * `agent_insights_*` keys are present, and the send path renders from the
14
+ * persisted draft — so only a save (`is_preview: false`) makes an edit stick.
15
+ */
16
+ export declare const buildMonthEndTemplateData: (templateData: MonthEndTemplateData | undefined, subject: string | undefined, agentInsightEdits?: AgentInsightEdits) => MonthEndTemplateData;
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.buildMonthEndTemplateData = exports.AGENT_INSIGHTS_SUBJECT_KEY = void 0;
4
+ /**
5
+ * The AI CFO (V2) month-end email renders its subject line from this merge var
6
+ * rather than from the generic `subject` key, so a subject typed in the cockpit
7
+ * has to be written here too or the sent email keeps the AI's original subject.
8
+ */
9
+ exports.AGENT_INSIGHTS_SUBJECT_KEY = 'agent_insights_subject';
10
+ /**
11
+ * Build the `template_data` sent to the month-end email endpoint.
12
+ *
13
+ * Controller edits to the AI-generated insight fields are merged over the
14
+ * template data held in the store. The server sanitizes and persists whichever
15
+ * `agent_insights_*` keys are present, and the send path renders from the
16
+ * persisted draft — so only a save (`is_preview: false`) makes an edit stick.
17
+ */
18
+ const buildMonthEndTemplateData = (templateData, subject, agentInsightEdits) => {
19
+ const merged = {
20
+ ...templateData,
21
+ ...agentInsightEdits,
22
+ subject,
23
+ };
24
+ // Only for AI CFO drafts (the key is absent on legacy ones), never over an
25
+ // explicit edit to the field itself, and never with an empty value — on send
26
+ // the subject comes from store state and can be absent, which must not blank
27
+ // the AI's subject line.
28
+ if (exports.AGENT_INSIGHTS_SUBJECT_KEY in merged &&
29
+ agentInsightEdits?.[exports.AGENT_INSIGHTS_SUBJECT_KEY] == null &&
30
+ subject != null &&
31
+ subject !== '') {
32
+ merged[exports.AGENT_INSIGHTS_SUBJECT_KEY] = subject;
33
+ }
34
+ return merged;
35
+ };
36
+ exports.buildMonthEndTemplateData = buildMonthEndTemplateData;
@@ -11,7 +11,6 @@ const jeSchedulesViewReducer_1 = require("../../reducers/jeSchedulesViewReducer"
11
11
  const missingReceiptsViewReducer_1 = require("../../reducers/missingReceiptsViewReducer");
12
12
  const reconciliationViewReducer_1 = require("../../reducers/reconciliationViewReducer");
13
13
  const transactionsViewReducer_1 = require("../../reducers/transactionsViewReducer");
14
- const jeSchedulesViewState_1 = require("../../types/jeSchedulesViewState");
15
14
  const fetchAllExpenseAutomationTabsEpic = (actions$, state$) => actions$.pipe((0, operators_1.filter)(expenseAutomationViewReducer_1.fetchAllExpenseAutomationTabs.match), (0, operators_1.switchMap)((action) => {
16
15
  const { cacheOverride, refreshViewInBackground } = action.payload;
17
16
  const state = state$.value;
@@ -63,16 +62,14 @@ const fetchAllExpenseAutomationTabsEpic = (actions$, state$) => actions$.pipe((0
63
62
  state.expenseAutomationFluxAnalysisViewState.groupsBySelectedPeriod[monthYearPeriodId] == null)) {
64
63
  fetchActions.push((0, fluxAnalysisViewReducer_1.fetchFluxAnalysisView)(selectedPeriod, cacheOverride, refreshViewInBackground, null));
65
64
  }
66
- // The two JE tabs cache separately, so only the tab actually being shown decides whether a
67
- // fetch is still needed.
68
- const jeSchedulesPeriodTabKey = (0, jeSchedulesViewState_1.getJESchedulePeriodTabKey)(state.expenseAutomationJESchedulesViewState.uiState.selectedPageTab, monthYearPeriodId);
69
65
  if (state.expenseAutomationJESchedulesViewState.fetchState !==
70
66
  'In-Progress' &&
71
67
  (!state.expenseAutomationJESchedulesViewState.hasValidState() ||
72
68
  state.expenseAutomationJESchedulesViewState
73
- .jeScheduleTransactionKeysByPeriodAndTab[jeSchedulesPeriodTabKey] == null ||
69
+ .jeScheduleTransactionKeysByPeriod[monthYearPeriodId] == null ||
74
70
  state.expenseAutomationJESchedulesViewState
75
- .failedJeScheduleTransactionKeysByPeriodAndTab[jeSchedulesPeriodTabKey] == null)) {
71
+ .failedJeScheduleTransactionKeysByPeriod[monthYearPeriodId] ==
72
+ null)) {
76
73
  fetchActions.push((0, jeSchedulesViewReducer_1.fetchJeSchedulesPage)({ start: timePeriodStart, end: timePeriodEnd }, cacheOverride));
77
74
  }
78
75
  if (state.expenseAutomationReconciliationViewState.fetchState !==
@@ -1,9 +1,8 @@
1
1
  import { ActionsObservable, StateObservable } from 'redux-observable';
2
2
  import { Observable } from 'rxjs';
3
- import { updateAccruedJESchedules, updateAccruedJESchedulesDetails, updateJEOneTimeAccruals, updateJESchedules, updateJESchedulesDetails } from '../../../../entity/jeSchedules/jeSchedulesReducer';
3
+ import { updateJESchedules, updateJESchedulesDetails } from '../../../../entity/jeSchedules/jeSchedulesReducer';
4
4
  import { RootState } from '../../../../rootStateTypes';
5
- import { clearAll } from '../../../../rootActions';
6
5
  import { ZeniAPI } from '../../../../zeniAPI';
7
6
  import { fetchJeSchedules, fetchJeSchedulesFailure, fetchJeSchedulesSuccess, initializeJeScheduleLocalData } from '../../reducers/jeSchedulesViewReducer';
8
- export type ActionType = ReturnType<typeof clearAll> | ReturnType<typeof fetchJeSchedules> | ReturnType<typeof fetchJeSchedulesFailure> | ReturnType<typeof fetchJeSchedulesSuccess> | ReturnType<typeof initializeJeScheduleLocalData> | ReturnType<typeof updateAccruedJESchedules> | ReturnType<typeof updateAccruedJESchedulesDetails> | ReturnType<typeof updateJEOneTimeAccruals> | ReturnType<typeof updateJESchedules> | ReturnType<typeof updateJESchedulesDetails>;
7
+ export type ActionType = ReturnType<typeof fetchJeSchedules> | ReturnType<typeof fetchJeSchedulesFailure> | ReturnType<typeof fetchJeSchedulesSuccess> | ReturnType<typeof initializeJeScheduleLocalData> | ReturnType<typeof updateJESchedules> | ReturnType<typeof updateJESchedulesDetails>;
9
8
  export declare const fetchJeSchedulesEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
@@ -4,12 +4,9 @@ exports.fetchJeSchedulesEpic = void 0;
4
4
  const rxjs_1 = require("rxjs");
5
5
  const operators_1 = require("rxjs/operators");
6
6
  const timePeriod_1 = require("../../../../commonStateTypes/timePeriod");
7
- const timePeriod_2 = require("../../../../commonStateTypes/timePeriod");
8
7
  const jeSchedulesReducer_1 = require("../../../../entity/jeSchedules/jeSchedulesReducer");
9
8
  const tenantSelector_1 = require("../../../../entity/tenant/tenantSelector");
10
9
  const responsePayload_1 = require("../../../../responsePayload");
11
- const rootActions_1 = require("../../../../rootActions");
12
- const zeniDayJS_1 = require("../../../../zeniDayJS");
13
10
  const jeSchedulesViewReducer_1 = require("../../reducers/jeSchedulesViewReducer");
14
11
  const fetchJeSchedulesEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(jeSchedulesViewReducer_1.fetchJeSchedules.match), (0, operators_1.mergeMap)((action) => {
15
12
  const state = state$.value;
@@ -17,54 +14,27 @@ const fetchJeSchedulesEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, op
17
14
  const { period, refreshViewInBackground } = action.payload;
18
15
  const currentTenant = (0, tenantSelector_1.getCurrentTenant)(state);
19
16
  const selectedPeriod = selectedPeriodByTenantId[currentTenant.tenantId];
20
- const { selectedPageTab } = state.expenseAutomationJESchedulesViewState.uiState;
21
- const isClosePeriodTab = selectedPageTab === 'schedules';
22
- const existingEndDate = (0, timePeriod_2.toAbsoluteDay)((0, zeniDayJS_1.date)((0, timePeriod_2.toString)(period.start))
23
- .subtract(1, 'month')
24
- .endOf('month')
25
- .format(timePeriod_1.DEFAULT_DATE_FORMAT));
26
17
  const queryParam = {
27
- start_date: (0, timePeriod_2.toString)(period.start),
28
- end_date: isClosePeriodTab || existingEndDate == null
29
- ? (0, timePeriod_2.toString)(period.end)
30
- : (0, timePeriod_2.toString)(existingEndDate),
31
- include_accrued: true,
32
- ...(isClosePeriodTab
33
- ? { close_period_start_date: (0, timePeriod_2.toString)(period.start) }
34
- : {}),
18
+ start_date: (0, timePeriod_1.toString)(period.start),
19
+ end_date: (0, timePeriod_1.toString)(period.end),
35
20
  };
36
21
  return zeniAPI
37
22
  .getJSON(`${zeniAPI.apiEndPoints.accountMicroServiceBaseUrl}/1.0/expenses_automation/je_schedules?query=${encodeURIComponent(JSON.stringify(queryParam))}`)
38
23
  .pipe((0, operators_1.mergeMap)((response) => {
39
24
  if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
40
25
  const updateActions = [];
41
- const accruedJeSchedules = response.data.accrued_je_schedules?.je_schedules ?? [];
42
- const oneTimeAccruals = response.data.one_time_accruals ?? [];
43
26
  updateActions.push((0, jeSchedulesReducer_1.updateJESchedules)([
44
27
  ...response.data.je_schedules,
45
28
  ...response.data.failed_je_postings.je_schedules,
46
29
  ]), (0, jeSchedulesReducer_1.updateJESchedulesDetails)([...response.data.failed_je_postings.je_schedules], response.data.failed_je_postings.scheduled_journal_entries), (0, jeSchedulesViewReducer_1.initializeJeScheduleLocalData)([
47
30
  ...response.data.failed_je_postings.je_schedules,
48
31
  ]));
49
- if (accruedJeSchedules.length > 0) {
50
- updateActions.push((0, jeSchedulesReducer_1.updateAccruedJESchedules)(accruedJeSchedules), (0, jeSchedulesReducer_1.updateAccruedJESchedulesDetails)(accruedJeSchedules, response.data.accrued_je_schedules
51
- ?.scheduled_journal_entries));
52
- }
53
- if (oneTimeAccruals.length > 0) {
54
- // Single action, unlike the accrued pair above: this one writes the entity
55
- // directly because an accrual denormalizes its vendor, accounts and classes, so
56
- // there is no fan-out fetch to trigger.
57
- updateActions.push((0, jeSchedulesReducer_1.updateJEOneTimeAccruals)(oneTimeAccruals));
58
- }
59
32
  updateActions.push((0, jeSchedulesViewReducer_1.fetchJeSchedulesSuccess)({
60
33
  jeSchedules: [...response.data.je_schedules],
61
34
  failedJeSchedules: [
62
35
  ...response.data.failed_je_postings.je_schedules,
63
36
  ],
64
- accruedJeSchedules: accruedJeSchedules,
65
- oneTimeAccruals: oneTimeAccruals,
66
37
  selectedPeriod: selectedPeriod,
67
- selectedPageTab: selectedPageTab,
68
38
  refreshViewInBackground: refreshViewInBackground,
69
39
  }));
70
40
  return (0, rxjs_1.from)(updateActions);
@@ -73,18 +43,12 @@ const fetchJeSchedulesEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, op
73
43
  return (0, rxjs_1.of)((0, jeSchedulesViewReducer_1.fetchJeSchedulesFailure)({
74
44
  status: response.status,
75
45
  selectedPeriod,
76
- selectedPageTab,
77
46
  }));
78
47
  }
79
48
  }), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, jeSchedulesViewReducer_1.fetchJeSchedulesFailure)({
80
49
  status: (0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'fetch JE schedules REST API call errored out' +
81
50
  JSON.stringify(error)),
82
51
  selectedPeriod,
83
- selectedPageTab,
84
- }))),
85
- // A tenant switch clears the store while this request is still in flight. Without this
86
- // the old tenant's rows are written back into the freshly cleared store and stay on
87
- // screen under the new tenant until a manual refresh.
88
- (0, operators_1.takeUntil)(actions$.pipe((0, operators_1.filter)(rootActions_1.clearAll.match))));
52
+ }))));
89
53
  }));
90
54
  exports.fetchJeSchedulesEpic = fetchJeSchedulesEpic;
@@ -14,25 +14,13 @@ const jeSchedulesViewReducer_1 = require("../../reducers/jeSchedulesViewReducer"
14
14
  const ignoreRecommendedJeScheduleEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(jeSchedulesViewReducer_1.ignoreRecommendedJeSchedule.match), (0, operators_1.mergeMap)((action) => {
15
15
  const state = state$.value;
16
16
  const { expenseAutomationViewState: { selectedPeriodByTenantId }, } = state;
17
- const { scheduleType, jeScheduleTransactionKey, reason, note } = action.payload;
17
+ const { scheduleType, jeScheduleTransactionKey } = action.payload;
18
18
  const currentTenant = (0, tenantSelector_1.getCurrentTenant)(state);
19
19
  const selectedPeriod = selectedPeriodByTenantId[currentTenant.tenantId];
20
20
  const actions = [];
21
21
  const jeScheduleTransactionState = (0, jeSchedulesSelector_1.getJEScheduledTransactionByJEScheduleTransactionKey)(jeScheduleTransactionKey, state);
22
- const ignorePayload = (0, jeSchedulesPayload_1.prepareIgnoreSchedulePayload)(scheduleType, jeScheduleTransactionState, state);
23
- // The gateway reads reason/note from je_schedules[0].feedback and nowhere else, and rejects
24
- // anything but those two keys inside it — `action` is stamped server-side.
25
22
  const payload = {
26
- ...ignorePayload,
27
- je_schedules: ignorePayload.je_schedules.map((schedule, index) => index === 0
28
- ? {
29
- ...schedule,
30
- feedback: {
31
- reason,
32
- ...(note != null && note !== '' ? { note } : {}),
33
- },
34
- }
35
- : schedule),
23
+ ...(0, jeSchedulesPayload_1.prepareIgnoreSchedulePayload)(scheduleType, jeScheduleTransactionState, state),
36
24
  };
37
25
  const queryParam = {
38
26
  je_schedule_type: scheduleType,
@@ -39,7 +39,7 @@ export declare const getLineItemsByTransactionsIdsFromResponse: (transactions: S
39
39
  export declare const getLineItemsByTransactionIdsFromLocalData: (transactionLocalData: TransactionReviewLocalDataSelectorView[], selectedTab: TransactionsTab) => Record<ID, string[]>;
40
40
  export declare const mergeTabSpecificLineItems: (currentTabSpecificLineItems: TabSpecificLineItems, selectedTab: TransactionsTab, newLineItems: TabSpecificLineItems) => TabSpecificLineItems;
41
41
  export declare const getSnackbarMessageForTransactionReview: (updatedCount: number, failedCount: number, categorizedCount: number) => {
42
- messageSection: "common" | "transactionDetails_updatingPastTransactions" | "transactionDetails_transactionUpdated" | "cockpit_month_end_email_sent" | "cockpit_month_end_email_save" | "cockpit_month_end_email_attachment_upload" | "je_bill_link" | "je_posted" | "audit_score_updated" | "people_invite_people" | "people_invite_multiple_people" | "people_delete_person" | "people_update_person" | "reimbursement_updated" | "reimbursement_deleted" | "reimbursement_cancelled_deleted" | "reimbursement_cancelled" | "reimbursement_approved" | "reimbursement_rejected" | "reimbursement_sent_for_approval" | "account_added" | "business_verification_save" | "business_verification_submit" | "business_verification_from_bills_submit" | "plaid_connection" | "unlink_deposit_account" | "reimbursement_setup" | "reimbursement_approval_create" | "reimbursement_duplicate_approval_create" | "reimbursement_approval_update" | "reimbursement_duplicate_approval_update" | "reimbursement_approval_delete" | "reimbursement_approval_reorder" | "reimbursement_create_mileage" | "reimbursement_update_mileage" | "reimbursement_accept_term" | "reimbursement_accept_employee_term" | "reimbursement_bulk_submit" | "reimbursement_bulk_processed" | "bill_pay_setup" | "zeni_accounts_setup" | "bill_pay_approval_create" | "bill_pay_duplicate_approval_create" | "bill_pay_approval_update" | "bill_pay_duplicate_approval_update" | "bill_pay_approval_delete" | "bill_pay_approval_reorder" | "bill_pay_updated" | "bill_pay_deleted" | "bill_pay_cancelled_deleted" | "bill_pay_cancelled" | "bill_pay_approved" | "real_time_approver_added" | "bill_pay_rejected" | "bill_pay_sent_for_approval" | "bill_pay_accept_term" | "bill_pay_bulk_submit" | "bill_pay_bulk_processed" | "bill_pay_refund" | "bill_pay_retry" | "bill_pay_marked_as_paid" | "zeni_account_accept_term" | "update_vendor" | "data_refresh_update" | "delete_bank_account" | "create_bank_account" | "create_bank_account_ach" | "create_bank_account_wire" | "create_bank_account_international" | "transfer_money" | "update_zeni_account_nickname" | "create_checking_account" | "deposit_check" | "create_vendor" | "onboarding_customer_view" | "onboarding_customer_view_complete" | "onboarding_customer_identity_verification_save" | "onboarding_customer_identity_verification_submit" | "onboarding_customer_business_verification_save" | "onboarding_customer_business_verification_submit" | "retry_bank_account_connection" | "dashboard_invite_sent" | "onboarding_info_saved" | "approve_original_merchant" | "approve_global_merchant" | "reject_global_merchant" | "create_global_merchant" | "fetch_global_merchant_no_recommendation" | "save_vendor_renamed" | "save_vendor_sent_for_review" | "save_vendor_marked_as_employee" | "save_vendor_marked_as_local_contractor" | "charge_card_setup" | "charge_card_accept_term" | "charge_card_receipt_upload" | "charge_card_resend_invite" | "charge_card_revoke_invite" | "card_policy_created" | "card_policy_updated" | "card_policy_deleted" | "charge_card_update_limit" | "charge_cards_update_limit" | "close_charge_card" | "lock_charge_card" | "lock_charge_card_card_user" | "lock_charge_cards" | "unlock_charge_card" | "unlock_charge_card_card_user" | "unlock_charge_cards" | "close_charge_cards" | "revoke_invite_charge_cards" | "charge_card_express_interest" | "create_schedule" | "save_schedule" | "delete_schedule" | "ignore_schedule" | "revert_schedule" | "ignore_accrual" | "revert_accrual" | "save_task_detail" | "fetch_task_detail" | "delete_task" | "archive_task" | "snooze_task" | "unsnooze_task" | "create_tag" | "delete_tag" | "update_charge_card" | "update_charge_card_name" | "update_charge_card_name_card_user" | "issue_charge_card" | "issue_charge_cards" | "notification_settings_saved" | "referral_invite_sent" | "notification_mark_as_read" | "mark_as_complete_schedule" | "cancel_journal_entry" | "settings_accounting_accounts_updated" | "create_card_setup" | "confirm_card_setup" | "add_card_payment_source" | "fetch_payment_sources" | "task_assigned_toast_notification" | "task_due_tomorrow_toast_notification" | "task_deleted_toast_notification" | "task_archived_toast_notification" | "task_overdue_toast_notification" | "task_overdue_toast_notification_creator" | "task_notification_count" | "task_activities_toast_notification" | "task_created_toast_notification" | "task_group_creation_success" | "task_group_deletion_success" | "task_group_update_success" | "primary_funding_account_updated" | "task_time_spent_validation" | "missing_receipts_attachment" | "flux_analysis_unreviewed" | "flux_analysis_reviewed" | "receipt_match" | "receipts_upload" | "receipts_bulk_match" | "billing_address_view" | "express_pay_submit" | "exclude_transaction" | "reconcile" | "save_reconcile_for_later" | "recon_transaction_categorize" | "recon_transaction_match" | "update_debit_card_pin_attempt" | "set_debit_card_pin" | "ai_cfo_create_session_and_submit" | "ai_cfo_chat_session_deleted" | "charge_card_auto_pay_enable" | "charge_card_auto_pay_disable" | "treasury_setup" | "treasury_accept_term" | "treasury_transfer_money" | "treasury_transfer_money_failed" | "auto_transfer_rule_create" | "auto_transfer_rule_update" | "auto_transfer_rule_delete" | "auto_transfer_rule_pause" | "auto_transfer_rule_resume" | "treasury_update_portfolio_allocation" | "send_email_magic_link_to_user" | "complete_profile_done" | "create_transfer_entry" | "reports_resync" | "invalid_phone_number" | "transactions_categorized_updated_failed" | "transaction_categorized_updated_failed" | "transactionsCategorized_transactionsUpdated" | "transactionsCategorized_transactionUpdated" | "transactionCategorized_transactionsUpdated" | "transactionCategorized_transactionUpdated" | "transactionsCategorized_transactionsFailed" | "transactionsCategorized_transactionFailed" | "transactionCategorized_transactionsFailed" | "transactionCategorized_transactionFailed" | "transactionsUpdated_transactionsFailed" | "transactionsUpdated_transactionFailed" | "transactionUpdated_transactionsFailed" | "transactionUpdated_transactionFailed" | "transactionsCategorized_transactionsUpdated_transactionsFailed" | "transactionsCategorized_transactionsUpdated_transactionFailed" | "transactionsCategorized_transactionUpdated_transactionsFailed" | "transactionCategorized_transactionsUpdated_transactionsFailed" | "transactionsCategorized_transactionUpdated_transactionFailed" | "transactionCategorized_transactionsUpdated_transactionFailed" | "transactionCategorized_transactionUpdated_transactionsFailed" | "transactionCategorized_transactionUpdated_transactionFailed" | "accounting_classes_enabled_update" | "accounting_projects_enabled_update" | "accounting_projects_qbo_not_enabled" | "capitalization_threshold_update" | "account_excluded_from_reconciliation" | "account_included_in_reconciliation" | "confirm_statement_mapping" | "statement_parsing_in_progress" | "statement_parsing_complete" | "ai_accountant_trigger_job" | "oauth_consent_approve" | "oauth_consent_invalid_request" | "credit_agent_update_profile" | "credit_agent_save_macro" | "credit_agent_schedule_cron" | "create_sub_task" | "qbo_connection_already_linked" | "qbo_connection_failed" | "accounting_projects_qbo_reconnect_failed" | "product_services_update" | "qbo_realm_id_update" | "invoicing_dunning_case_resolved" | "invoicing_dunning_retry" | "invoicing_dunning_cancel" | "invoicing_dunning_settings_save" | "invoicing_qbo_backfill" | "invoicing_qbo_sync_health_retry" | "invoicing_qbo_settings_save" | "invoicing_branding_save" | "invoicing_discount_archive" | "invoicing_discount_unarchive" | "invoicing_discount_delete" | "invoicing_invoice_reminder_sent" | "invoicing_invoice_regenerated" | "invoicing_invoice_voided" | "invoicing_catalog_item_saved" | "invoicing_customer_saved" | "invoicing_subscription_saved" | "invoicing_coupon_saved" | "invoicing_invoice_saved" | "invoicing_credit_note_saved" | "invoicing_payment_recorded" | "invoicing_subscription_activated" | "invoicing_subscription_cancellation_removed" | "invoicing_subscription_cancelled" | "invoicing_subscription_non_renewing" | "invoicing_subscription_paused" | "invoicing_subscription_reactivated" | "invoicing_subscription_resumed" | "invoicing_subscription_term_end_changed";
42
+ messageSection: "common" | "transactionDetails_updatingPastTransactions" | "transactionDetails_transactionUpdated" | "cockpit_month_end_email_sent" | "cockpit_month_end_email_save" | "cockpit_month_end_email_attachment_upload" | "je_bill_link" | "je_posted" | "audit_score_updated" | "people_invite_people" | "people_invite_multiple_people" | "people_delete_person" | "people_update_person" | "reimbursement_updated" | "reimbursement_deleted" | "reimbursement_cancelled_deleted" | "reimbursement_cancelled" | "reimbursement_approved" | "reimbursement_rejected" | "reimbursement_sent_for_approval" | "account_added" | "business_verification_save" | "business_verification_submit" | "business_verification_from_bills_submit" | "plaid_connection" | "unlink_deposit_account" | "reimbursement_setup" | "reimbursement_approval_create" | "reimbursement_duplicate_approval_create" | "reimbursement_approval_update" | "reimbursement_duplicate_approval_update" | "reimbursement_approval_delete" | "reimbursement_approval_reorder" | "reimbursement_create_mileage" | "reimbursement_update_mileage" | "reimbursement_accept_term" | "reimbursement_accept_employee_term" | "reimbursement_bulk_submit" | "reimbursement_bulk_processed" | "bill_pay_setup" | "zeni_accounts_setup" | "bill_pay_approval_create" | "bill_pay_duplicate_approval_create" | "bill_pay_approval_update" | "bill_pay_duplicate_approval_update" | "bill_pay_approval_delete" | "bill_pay_approval_reorder" | "bill_pay_updated" | "bill_pay_deleted" | "bill_pay_cancelled_deleted" | "bill_pay_cancelled" | "bill_pay_approved" | "real_time_approver_added" | "bill_pay_rejected" | "bill_pay_sent_for_approval" | "bill_pay_accept_term" | "bill_pay_bulk_submit" | "bill_pay_bulk_processed" | "bill_pay_refund" | "bill_pay_retry" | "bill_pay_marked_as_paid" | "zeni_account_accept_term" | "update_vendor" | "data_refresh_update" | "delete_bank_account" | "create_bank_account" | "create_bank_account_ach" | "create_bank_account_wire" | "create_bank_account_international" | "transfer_money" | "update_zeni_account_nickname" | "create_checking_account" | "deposit_check" | "create_vendor" | "onboarding_customer_view" | "onboarding_customer_view_complete" | "onboarding_customer_identity_verification_save" | "onboarding_customer_identity_verification_submit" | "onboarding_customer_business_verification_save" | "onboarding_customer_business_verification_submit" | "retry_bank_account_connection" | "dashboard_invite_sent" | "onboarding_info_saved" | "approve_original_merchant" | "approve_global_merchant" | "reject_global_merchant" | "create_global_merchant" | "fetch_global_merchant_no_recommendation" | "save_vendor_renamed" | "save_vendor_sent_for_review" | "save_vendor_marked_as_employee" | "save_vendor_marked_as_local_contractor" | "charge_card_setup" | "charge_card_accept_term" | "charge_card_receipt_upload" | "charge_card_resend_invite" | "charge_card_revoke_invite" | "card_policy_created" | "card_policy_updated" | "card_policy_deleted" | "charge_card_update_limit" | "charge_cards_update_limit" | "close_charge_card" | "lock_charge_card" | "lock_charge_card_card_user" | "lock_charge_cards" | "unlock_charge_card" | "unlock_charge_card_card_user" | "unlock_charge_cards" | "close_charge_cards" | "revoke_invite_charge_cards" | "charge_card_express_interest" | "create_schedule" | "save_schedule" | "delete_schedule" | "ignore_schedule" | "save_task_detail" | "fetch_task_detail" | "delete_task" | "archive_task" | "snooze_task" | "unsnooze_task" | "create_tag" | "delete_tag" | "update_charge_card" | "update_charge_card_name" | "update_charge_card_name_card_user" | "issue_charge_card" | "issue_charge_cards" | "notification_settings_saved" | "referral_invite_sent" | "notification_mark_as_read" | "mark_as_complete_schedule" | "cancel_journal_entry" | "settings_accounting_accounts_updated" | "create_card_setup" | "confirm_card_setup" | "add_card_payment_source" | "fetch_payment_sources" | "task_assigned_toast_notification" | "task_due_tomorrow_toast_notification" | "task_deleted_toast_notification" | "task_archived_toast_notification" | "task_overdue_toast_notification" | "task_overdue_toast_notification_creator" | "task_notification_count" | "task_activities_toast_notification" | "task_created_toast_notification" | "task_group_creation_success" | "task_group_deletion_success" | "task_group_update_success" | "primary_funding_account_updated" | "task_time_spent_validation" | "missing_receipts_attachment" | "flux_analysis_unreviewed" | "flux_analysis_reviewed" | "receipt_match" | "receipts_upload" | "receipts_bulk_match" | "billing_address_view" | "express_pay_submit" | "exclude_transaction" | "reconcile" | "save_reconcile_for_later" | "recon_transaction_categorize" | "recon_transaction_match" | "update_debit_card_pin_attempt" | "set_debit_card_pin" | "ai_cfo_create_session_and_submit" | "ai_cfo_chat_session_deleted" | "charge_card_auto_pay_enable" | "charge_card_auto_pay_disable" | "treasury_setup" | "treasury_accept_term" | "treasury_transfer_money" | "treasury_transfer_money_failed" | "auto_transfer_rule_create" | "auto_transfer_rule_update" | "auto_transfer_rule_delete" | "auto_transfer_rule_pause" | "auto_transfer_rule_resume" | "treasury_update_portfolio_allocation" | "send_email_magic_link_to_user" | "complete_profile_done" | "create_transfer_entry" | "reports_resync" | "invalid_phone_number" | "transactions_categorized_updated_failed" | "transaction_categorized_updated_failed" | "transactionsCategorized_transactionsUpdated" | "transactionsCategorized_transactionUpdated" | "transactionCategorized_transactionsUpdated" | "transactionCategorized_transactionUpdated" | "transactionsCategorized_transactionsFailed" | "transactionsCategorized_transactionFailed" | "transactionCategorized_transactionsFailed" | "transactionCategorized_transactionFailed" | "transactionsUpdated_transactionsFailed" | "transactionsUpdated_transactionFailed" | "transactionUpdated_transactionsFailed" | "transactionUpdated_transactionFailed" | "transactionsCategorized_transactionsUpdated_transactionsFailed" | "transactionsCategorized_transactionsUpdated_transactionFailed" | "transactionsCategorized_transactionUpdated_transactionsFailed" | "transactionCategorized_transactionsUpdated_transactionsFailed" | "transactionsCategorized_transactionUpdated_transactionFailed" | "transactionCategorized_transactionsUpdated_transactionFailed" | "transactionCategorized_transactionUpdated_transactionsFailed" | "transactionCategorized_transactionUpdated_transactionFailed" | "accounting_classes_enabled_update" | "accounting_projects_enabled_update" | "accounting_projects_qbo_not_enabled" | "capitalization_threshold_update" | "account_excluded_from_reconciliation" | "account_included_in_reconciliation" | "confirm_statement_mapping" | "statement_parsing_in_progress" | "statement_parsing_complete" | "ai_accountant_trigger_job" | "oauth_consent_approve" | "oauth_consent_invalid_request" | "credit_agent_update_profile" | "credit_agent_save_macro" | "credit_agent_schedule_cron" | "create_sub_task" | "qbo_connection_already_linked" | "qbo_connection_failed" | "accounting_projects_qbo_reconnect_failed" | "product_services_update" | "qbo_realm_id_update" | "invoicing_dunning_case_resolved" | "invoicing_dunning_retry" | "invoicing_dunning_cancel" | "invoicing_dunning_settings_save" | "invoicing_qbo_backfill" | "invoicing_qbo_sync_health_retry" | "invoicing_qbo_settings_save" | "invoicing_branding_save" | "invoicing_discount_archive" | "invoicing_discount_unarchive" | "invoicing_discount_delete" | "invoicing_invoice_reminder_sent" | "invoicing_invoice_regenerated" | "invoicing_invoice_voided" | "invoicing_catalog_item_saved" | "invoicing_customer_saved" | "invoicing_subscription_saved" | "invoicing_coupon_saved" | "invoicing_invoice_saved" | "invoicing_credit_note_saved" | "invoicing_payment_recorded" | "invoicing_subscription_activated" | "invoicing_subscription_cancellation_removed" | "invoicing_subscription_cancelled" | "invoicing_subscription_non_renewing" | "invoicing_subscription_paused" | "invoicing_subscription_reactivated" | "invoicing_subscription_resumed" | "invoicing_subscription_term_end_changed";
43
43
  messageText: "notification" | "failed" | "success";
44
44
  type: "error" | "success" | "info";
45
45
  variables: {
@@ -1,17 +1,13 @@
1
- import { ID } from '../../../commonStateTypes/common';
2
- import { JEAccruedScheduledTransactionPayload, JEOneTimeAccrualPayload, JEScheduledTransactionPayload, ScheduledJournalEntryPayload } from '../../../entity/jeSchedules/jeSchedulesPayload';
1
+ import { JEScheduledTransactionPayload, ScheduledJournalEntryPayload } from '../../../entity/jeSchedules/jeSchedulesPayload';
3
2
  import { JEScheduledTransaction } from '../../../entity/jeSchedules/jeSchedulesSelector';
4
- import { OneTimeAccrualIgnoreReasonType, OneTimeAccrualRevertReasonType, ScheduleTypes } from '../../../entity/jeSchedules/jeSchedulesTypes';
3
+ import { ScheduleTypes } from '../../../entity/jeSchedules/jeSchedulesTypes';
5
4
  import { ZeniAPIResponse } from '../../../responsePayload';
6
5
  import { RootState } from '../../../rootStateTypes';
7
- import { ZeniDate } from '../../../zeniDayJS';
8
6
  import { JESchedulePayload, SaveJESchedulePayload } from '../../scheduleView/scheduleDetailView/scheduleDetailPayload';
9
- import { JEScheduleLocalData, NewOneTimeAccrualLocalData } from '../types/jeSchedulesViewState';
7
+ import { JEScheduleLocalData } from '../types/jeSchedulesViewState';
10
8
  export interface ExpenseAutomationJESchedulesQueryPayload {
11
9
  end_date: string;
12
- include_accrued: boolean;
13
10
  start_date: string;
14
- close_period_start_date?: string;
15
11
  }
16
12
  interface ExpenseAutomationJESchedulesPayload {
17
13
  failed_je_postings: {
@@ -19,73 +15,8 @@ interface ExpenseAutomationJESchedulesPayload {
19
15
  scheduled_journal_entries: ScheduledJournalEntryPayload[];
20
16
  };
21
17
  je_schedules: JEScheduledTransactionPayload[];
22
- accrued_je_schedules?: {
23
- je_schedules: JEAccruedScheduledTransactionPayload[];
24
- scheduled_journal_entries?: ScheduledJournalEntryPayload[];
25
- };
26
- one_time_accruals?: JEOneTimeAccrualPayload[];
27
18
  }
28
19
  export type ExpenseAutomationJESchedulesResponse = ZeniAPIResponse<ExpenseAutomationJESchedulesPayload>;
29
- export interface CreateOneTimeAccrualPayload {
30
- amount: number;
31
- je_credit_account_id: ID;
32
- je_debit_account_id: ID;
33
- memo: string;
34
- service_month: string;
35
- vendor_id: ID;
36
- vendor_name: string;
37
- expected_reversal_date?: string;
38
- je_credit_account_name?: string;
39
- je_credit_accounting_class_id?: ID;
40
- je_credit_accounting_class_name?: string;
41
- je_debit_account_name?: string;
42
- je_debit_accounting_class_id?: ID;
43
- je_debit_accounting_class_name?: string;
44
- reversal_policy?: string;
45
- reverse_next_month?: boolean;
46
- }
47
- export type CreateOneTimeAccrualResponse = ZeniAPIResponse<{
48
- accrual: JEOneTimeAccrualPayload;
49
- }>;
50
- /**
51
- * Promote body. `vendor_id`, `vendor_name` and `service_month` are deliberately absent: promote
52
- * treats them as immutable and takes them from the existing draft, so sending them would imply a
53
- * reassignment the API silently ignores.
54
- */
55
- export interface PromoteOneTimeAccrualPayload {
56
- amount: number;
57
- je_credit_account_id: ID;
58
- je_debit_account_id: ID;
59
- memo: string;
60
- }
61
- /**
62
- * Ignore body. `scope` is deliberately absent — the API returns 400 if it is sent, which is why the
63
- * design's "Apply to" selector cannot be built yet.
64
- */
65
- /**
66
- * Revert deletes the accrual's journal entry in QBO and soft-deletes the row. `scope` is rejected
67
- * with a 400, exactly as on ignore.
68
- */
69
- export interface RevertOneTimeAccrualPayload {
70
- reason: OneTimeAccrualRevertReasonType;
71
- note?: string;
72
- }
73
- export interface IgnoreOneTimeAccrualPayload {
74
- reason: OneTimeAccrualIgnoreReasonType;
75
- note?: string;
76
- }
77
- /**
78
- * The credit line is the accrued liability, which always sits on the balance sheet — the
79
- * recurring accrued path resolves the same class the same way (see
80
- * prepareNewScheduleAccruedDetailPayload). Omitted rather than sent empty when the tenant has
81
- * no balance_sheet class, since the API treats the field as optional.
82
- */
83
- export declare const prepareCreateOneTimeAccrualPayload: (state: RootState, localData: NewOneTimeAccrualLocalData) => CreateOneTimeAccrualPayload;
84
- /**
85
- * The API defaults this to the 1st of the month after service_month. We send it explicitly so the
86
- * date the form promised the user is the date that gets stored.
87
- */
88
- export declare const getExpectedReversalDate: (serviceMonth: ZeniDate) => ZeniDate;
89
20
  export interface IgnoreDraftJESchedulePayload {
90
21
  je_schedules: JEScheduledTransactionPayload[];
91
22
  scheduled_journal_entries: SaveJESchedulePayload[];
@@ -1,65 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.preparePayloadForRetryPosting = exports.prepareIgnoreSchedulePayload = exports.getExpectedReversalDate = exports.prepareCreateOneTimeAccrualPayload = void 0;
3
+ exports.preparePayloadForRetryPosting = exports.prepareIgnoreSchedulePayload = void 0;
4
4
  const timePeriod_1 = require("../../../commonStateTypes/timePeriod");
5
- const classListSelector_1 = require("../../classList/classListSelector");
6
5
  const scheduleDetailPayload_1 = require("../../scheduleView/scheduleDetailView/scheduleDetailPayload");
7
- const BALANCE_SHEET_CLASS_LABEL = 'balance_sheet';
8
- const SERVICE_MONTH_FORMAT = 'YYYY-MM';
9
- /**
10
- * The credit line is the accrued liability, which always sits on the balance sheet — the
11
- * recurring accrued path resolves the same class the same way (see
12
- * prepareNewScheduleAccruedDetailPayload). Omitted rather than sent empty when the tenant has
13
- * no balance_sheet class, since the API treats the field as optional.
14
- */
15
- const prepareCreateOneTimeAccrualPayload = (state, localData) => {
16
- const { classListState, classState } = state;
17
- const balanceSheetClass = (0, classListSelector_1.getClassList)(classState, classListState).classes.find((accountingClass) => accountingClass.labels?.includes(BALANCE_SHEET_CLASS_LABEL) === true);
18
- // reverse_next_month alone decides reversal_policy server-side, so reversal_policy is
19
- // deliberately not sent — the API documents it only as an alternate way to say on_bill_match,
20
- // and sending both would be two sources of truth for one toggle.
21
- const reversalFields = localData.reverseNextMonth
22
- ? {
23
- reverse_next_month: true,
24
- expected_reversal_date: (0, exports.getExpectedReversalDate)(localData.serviceMonth).format(timePeriod_1.DEFAULT_DATE_FORMAT),
25
- }
26
- : { reverse_next_month: false };
27
- return {
28
- vendor_id: localData.vendorId,
29
- vendor_name: localData.vendorName,
30
- service_month: localData.serviceMonth.format(SERVICE_MONTH_FORMAT),
31
- amount: localData.amount,
32
- memo: localData.memo,
33
- je_debit_account_id: localData.debitAccountId,
34
- je_credit_account_id: localData.creditAccountId,
35
- ...(localData.debitAccountName != null
36
- ? { je_debit_account_name: localData.debitAccountName }
37
- : {}),
38
- ...(localData.creditAccountName != null
39
- ? { je_credit_account_name: localData.creditAccountName }
40
- : {}),
41
- ...(localData.debitClassId != null
42
- ? { je_debit_accounting_class_id: localData.debitClassId }
43
- : {}),
44
- ...(localData.debitClassName != null
45
- ? { je_debit_accounting_class_name: localData.debitClassName }
46
- : {}),
47
- ...(balanceSheetClass != null
48
- ? {
49
- je_credit_accounting_class_id: balanceSheetClass.classId,
50
- je_credit_accounting_class_name: balanceSheetClass.className,
51
- }
52
- : {}),
53
- ...reversalFields,
54
- };
55
- };
56
- exports.prepareCreateOneTimeAccrualPayload = prepareCreateOneTimeAccrualPayload;
57
- /**
58
- * The API defaults this to the 1st of the month after service_month. We send it explicitly so the
59
- * date the form promised the user is the date that gets stored.
60
- */
61
- const getExpectedReversalDate = (serviceMonth) => serviceMonth.add(1, 'month').startOf('month');
62
- exports.getExpectedReversalDate = getExpectedReversalDate;
63
6
  const prepareIgnoreSchedulePayload = (scheduleType, jeScheduleTransaction, state) => {
64
7
  const { vendorState } = state;
65
8
  const { vendor, currencyCode, currencySymbol, baseTransaction, status, balanceAsOfToday, period, startDate, endDate, jeCredit, jeDebit, } = jeScheduleTransaction;