@zeniai/client-epic-state 5.2.11-betaAM1 → 5.2.11-betaAM3

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.
@@ -19,14 +19,25 @@ export interface JEScheduleAISummaryFieldPayload {
19
19
  cot?: string[];
20
20
  predicted_value?: number | string;
21
21
  }
22
+ /** The whole-recommendation summary. Carries narrative only -- no predicted value, no confidence. */
23
+ export interface JEScheduleSummaryPayload {
24
+ confidence?: number;
25
+ cot?: string[];
26
+ reasoning?: string;
27
+ reasoning_long?: string;
28
+ }
22
29
  export interface JEScheduleAISummariesPayload {
23
30
  credit_account?: JEScheduleAISummaryFieldPayload;
24
31
  credit_accounting_class?: JEScheduleAISummaryFieldPayload;
25
32
  debit_account?: JEScheduleAISummaryFieldPayload;
26
33
  debit_accounting_class?: JEScheduleAISummaryFieldPayload;
34
+ end_date?: JEScheduleAISummaryFieldPayload;
27
35
  period?: JEScheduleAISummaryFieldPayload;
28
36
  posting_date?: JEScheduleAISummaryFieldPayload;
37
+ posting_start_date?: JEScheduleAISummaryFieldPayload;
38
+ schedule_summary?: JEScheduleSummaryPayload;
29
39
  schedule_type?: JEScheduleAISummaryFieldPayload;
40
+ starting_month?: JEScheduleAISummaryFieldPayload;
30
41
  }
31
42
  export interface JEScheduleRecommendationsPayload {
32
43
  credit_account_confidence?: number;
@@ -215,6 +215,43 @@ function toJEScheduleAISummaries(payload) {
215
215
  : undefined,
216
216
  };
217
217
  }
218
+ if (payload.starting_month != null) {
219
+ result.startingMonth = {
220
+ confidence: payload.starting_month.confidence,
221
+ reasoning: payload.starting_month.reasoning,
222
+ cot: Array.isArray(payload.starting_month.cot)
223
+ ? payload.starting_month.cot
224
+ : undefined,
225
+ };
226
+ }
227
+ if (payload.end_date != null) {
228
+ result.endDate = {
229
+ confidence: payload.end_date.confidence,
230
+ reasoning: payload.end_date.reasoning,
231
+ cot: Array.isArray(payload.end_date.cot)
232
+ ? payload.end_date.cot
233
+ : undefined,
234
+ };
235
+ }
236
+ if (payload.posting_start_date != null) {
237
+ result.postingStartDate = {
238
+ confidence: payload.posting_start_date.confidence,
239
+ reasoning: payload.posting_start_date.reasoning,
240
+ cot: Array.isArray(payload.posting_start_date.cot)
241
+ ? payload.posting_start_date.cot
242
+ : undefined,
243
+ };
244
+ }
245
+ if (payload.schedule_summary != null) {
246
+ result.scheduleSummary = {
247
+ confidence: payload.schedule_summary.confidence,
248
+ reasoning: payload.schedule_summary.reasoning,
249
+ reasoningLong: payload.schedule_summary.reasoning_long,
250
+ cot: Array.isArray(payload.schedule_summary.cot)
251
+ ? payload.schedule_summary.cot
252
+ : undefined,
253
+ };
254
+ }
218
255
  return Object.keys(result).length > 0 ? result : undefined;
219
256
  }
220
257
  function toJEScheduleRecommendations(payload) {
@@ -19,14 +19,32 @@ export interface JEScheduleFieldRecommendation {
19
19
  reasoning: string;
20
20
  cot?: string[];
21
21
  }
22
+ /**
23
+ * The agent's summary of the whole recommendation, as opposed to one field of it.
24
+ *
25
+ * `confidence` is mapped but not yet produced: the schedule's own `confidence_score` column arrives
26
+ * null on every agent-written schedule, and agent-je's ScheduleSummary currently carries narrative
27
+ * only. Whichever of the two the backend starts populating, the UI picks it up without a change
28
+ * here -- and until one of them does, the popover shows no confidence rather than a made-up one.
29
+ */
30
+ export interface JEScheduleSummary {
31
+ confidence?: number;
32
+ cot?: string[];
33
+ reasoning?: string;
34
+ reasoningLong?: string;
35
+ }
22
36
  export interface JEScheduleAISummaries {
23
37
  creditAccount?: JEScheduleFieldRecommendation;
24
38
  creditClass?: JEScheduleFieldRecommendation;
25
39
  debitAccount?: JEScheduleFieldRecommendation;
26
40
  debitClass?: JEScheduleFieldRecommendation;
41
+ endDate?: JEScheduleFieldRecommendation;
27
42
  period?: JEScheduleFieldRecommendation;
28
43
  postingDate?: JEScheduleFieldRecommendation;
44
+ postingStartDate?: JEScheduleFieldRecommendation;
45
+ scheduleSummary?: JEScheduleSummary;
29
46
  scheduleType?: JEScheduleFieldRecommendation;
47
+ startingMonth?: JEScheduleFieldRecommendation;
30
48
  }
31
49
  export interface JEScheduleRecommendations {
32
50
  creditAccountConfidence?: number;
@@ -117,6 +135,27 @@ export interface JEAccruedScheduledTransactionState extends Omit<JEScheduledTran
117
135
  memo: string;
118
136
  recurringAmount: Amount;
119
137
  }
138
+ /**
139
+ * What a human can change on a draft accrual before posting it.
140
+ *
141
+ * Deliberately not the whole accrual: posting date is derived server-side from the service month,
142
+ * and vendor / service month are identity -- agent-je rejects a promote whose body disagrees with
143
+ * the stored draft on either.
144
+ */
145
+ export interface OneTimeAccrualEdits {
146
+ expectedReversalDate?: ZeniDate;
147
+ jeCreditAccountId?: ID;
148
+ jeDebitAccountId?: ID;
149
+ jeDebitAccountingClassId?: ID;
150
+ jeDebitAccountingClassName?: string;
151
+ memo?: string;
152
+ /**
153
+ * The Auto Reversal toggle, modelled as the same boolean the New form and the create payload use
154
+ * rather than a policy string: `reverse_next_month` alone decides the policy server-side, and
155
+ * sending both would be two sources of truth for one control.
156
+ */
157
+ reverseNextMonth?: boolean;
158
+ }
120
159
  export interface JEOneTimeAccrualCreator {
121
160
  userId: ID;
122
161
  email?: string;
@@ -204,6 +204,43 @@ function toJEScheduleAISummaries(payload) {
204
204
  : undefined,
205
205
  };
206
206
  }
207
+ if (payload.starting_month != null) {
208
+ result.startingMonth = {
209
+ confidence: payload.starting_month.confidence,
210
+ reasoning: payload.starting_month.reasoning,
211
+ cot: Array.isArray(payload.starting_month.cot)
212
+ ? payload.starting_month.cot
213
+ : undefined,
214
+ };
215
+ }
216
+ if (payload.end_date != null) {
217
+ result.endDate = {
218
+ confidence: payload.end_date.confidence,
219
+ reasoning: payload.end_date.reasoning,
220
+ cot: Array.isArray(payload.end_date.cot)
221
+ ? payload.end_date.cot
222
+ : undefined,
223
+ };
224
+ }
225
+ if (payload.posting_start_date != null) {
226
+ result.postingStartDate = {
227
+ confidence: payload.posting_start_date.confidence,
228
+ reasoning: payload.posting_start_date.reasoning,
229
+ cot: Array.isArray(payload.posting_start_date.cot)
230
+ ? payload.posting_start_date.cot
231
+ : undefined,
232
+ };
233
+ }
234
+ if (payload.schedule_summary != null) {
235
+ result.scheduleSummary = {
236
+ confidence: payload.schedule_summary.confidence,
237
+ reasoning: payload.schedule_summary.reasoning,
238
+ reasoningLong: payload.schedule_summary.reasoning_long,
239
+ cot: Array.isArray(payload.schedule_summary.cot)
240
+ ? payload.schedule_summary.cot
241
+ : undefined,
242
+ };
243
+ }
207
244
  return Object.keys(result).length > 0 ? result : undefined;
208
245
  }
209
246
  function toJEScheduleRecommendations(payload) {
@@ -1,6 +1,6 @@
1
1
  import { from, merge } from 'rxjs';
2
2
  import { catchError, filter, mergeMap, takeUntil } from 'rxjs/operators';
3
- import { convertToPeriod, toAbsoluteDay, } from '../../../../commonStateTypes/timePeriod';
3
+ import { DEFAULT_DATE_FORMAT, convertToPeriod, toAbsoluteDay, } from '../../../../commonStateTypes/timePeriod';
4
4
  import { generateJEOneTimeAccrualKey } from '../../../../entity/jeSchedules/jeScheduleHelper';
5
5
  import { updateJEOneTimeAccruals } from '../../../../entity/jeSchedules/jeSchedulesReducer';
6
6
  import { getJEOneTimeAccrualByKey } from '../../../../entity/jeSchedules/jeSchedulesSelector';
@@ -50,21 +50,44 @@ messageSection, accrualId, message, status) {
50
50
  }
51
51
  export const promoteOneTimeAccrualEpic = (actions$, state$, zeniAPI) => actions$.pipe(filter(promoteOneTimeAccrual.match), mergeMap((action) => {
52
52
  const state = state$.value;
53
- const { accrualId, amount } = action.payload;
53
+ const { accrualId, amount, edits } = action.payload;
54
54
  const accrual = getJEOneTimeAccrualByKey(generateJEOneTimeAccrualKey(accrualId), state.jeSchedulesState);
55
- if (accrual?.jeDebitAccountId == null ||
56
- accrual.jeCreditAccountId == null) {
55
+ // An edited value wins; anything untouched falls back to the stored draft, which is what the
56
+ // list's inline Post sends.
57
+ const debitAccountId = edits?.jeDebitAccountId ?? accrual?.jeDebitAccountId;
58
+ const creditAccountId = edits?.jeCreditAccountId ?? accrual?.jeCreditAccountId;
59
+ if (debitAccountId == null || creditAccountId == null) {
57
60
  // Promote posts a journal entry, so it cannot proceed without both sides of it.
58
61
  return from(failureActions('save_schedule', accrualId, 'This accrual is missing an expense or liability account.'));
59
62
  }
60
63
  // vendor_id, vendor_name and service_month are deliberately absent: promote takes them from
61
64
  // the stored draft and ignores them in the body, so sending them would imply a reassignment
62
65
  // that never happens.
66
+ // Untouched falls back to the stored policy, so posting without editing cannot silently
67
+ // flip a scheduled reversal to on-bill-match.
68
+ const reverseNextMonth = edits?.reverseNextMonth ??
69
+ accrual?.reversalPolicy === 'scheduled_date';
70
+ const expectedReversalDate = edits?.expectedReversalDate ?? accrual?.expectedReversalDate;
71
+ const debitClassId = edits?.jeDebitAccountingClassId ?? accrual?.jeDebitAccountingClassId;
72
+ const debitClassName = edits?.jeDebitAccountingClassName ??
73
+ accrual?.jeDebitAccountingClassName;
63
74
  const payload = {
64
75
  amount,
65
- memo: accrual.memo,
66
- je_debit_account_id: accrual.jeDebitAccountId,
67
- je_credit_account_id: accrual.jeCreditAccountId,
76
+ memo: edits?.memo ?? accrual?.memo ?? '',
77
+ je_debit_account_id: debitAccountId,
78
+ je_credit_account_id: creditAccountId,
79
+ ...(debitClassId != null ? { je_debit_accounting_class_id: debitClassId } : {}),
80
+ ...(debitClassName != null
81
+ ? { je_debit_accounting_class_name: debitClassName }
82
+ : {}),
83
+ // Mirrors the create payload: reverse_next_month alone decides the policy, and the date is
84
+ // only meaningful when it is true -- agent-je derives the reversal from the bill otherwise.
85
+ reverse_next_month: reverseNextMonth,
86
+ ...(reverseNextMonth && expectedReversalDate != null
87
+ ? {
88
+ expected_reversal_date: expectedReversalDate.format(DEFAULT_DATE_FORMAT),
89
+ }
90
+ : {}),
68
91
  };
69
92
  return zeniAPI
70
93
  .putAndGetJSON(`${zeniAPI.apiEndPoints.accountMicroServiceBaseUrl}/1.0/accruals/${accrualId}`, { ...payload })
@@ -80,7 +103,7 @@ export const promoteOneTimeAccrualEpic = (actions$, state$, zeniAPI) => actions$
80
103
  variables: [
81
104
  {
82
105
  variableName: '_vendor_name_',
83
- variableValue: accrual.vendorName,
106
+ variableValue: accrual?.vendorName ?? '',
84
107
  },
85
108
  ],
86
109
  }),
@@ -18,12 +18,17 @@ export function toActualMatchingTransactionSearchResult(payload) {
18
18
  transactionDate: payload.transaction_date,
19
19
  accountId: payload.account_id ?? undefined,
20
20
  accountName: payload.account_name ?? undefined,
21
+ accountDescription: payload.account_description ?? undefined,
22
+ accountingClassId: payload.accounting_class_id ?? undefined,
23
+ accountingClassName: payload.accounting_class_name ?? undefined,
21
24
  currencyCode,
22
25
  currencySymbol: payload.currency_symbol ??
23
26
  (currencyCode === DEFAULT_CURRENCY_CODE
24
27
  ? DEFAULT_CURRENCY_SYMBOL
25
28
  : currencyCode),
26
29
  transactionMemo: payload.transaction_memo ?? undefined,
30
+ transactionDescription: payload.transaction_description ?? undefined,
31
+ transactionTypeName: payload.transaction_type_name ?? undefined,
27
32
  };
28
33
  }
29
34
  export function toMatchAndReverseResult(payload) {
@@ -574,9 +574,14 @@ const expenseAutomationJESchedulesView = createSlice({
574
574
  error: action.payload.status,
575
575
  };
576
576
  },
577
+ /**
578
+ * Promote applies the body and posts in one step, so it carries whatever the user edited on the
579
+ * detail page. `edits` is absent when nothing was changed -- the epic then falls back to the
580
+ * stored accrual, which is what the list's inline Post does.
581
+ */
577
582
  promoteOneTimeAccrual: {
578
- prepare(accrualId, amount) {
579
- return { payload: { accrualId, amount } };
583
+ prepare(accrualId, amount, edits) {
584
+ return { payload: { accrualId, amount, edits } };
580
585
  },
581
586
  reducer(draft, action) {
582
587
  draft.oneTimeAccrualActionStatusById[action.payload.accrualId] = {
package/lib/index.d.ts CHANGED
@@ -108,7 +108,7 @@ import { TrendChangeType } from './entity/insights/insightPayload';
108
108
  import { Insight } from './entity/insights/insightState';
109
109
  import { InsightSummary } from './entity/insights/insightSummary';
110
110
  import { JEAccruedSchedule, JEOneTimeAccrual, JEScheduledTransaction, ScheduledJournalEntry } from './entity/jeSchedules/jeSchedulesSelector';
111
- import { JEOneTimeAccrualAiSuggestion, JEOneTimeAccrualBillingPattern, JEOneTimeAccrualCleared, JEOneTimeAccrualMatchSuggestion, JEOneTimeAccrualMonthlyTotal, JEOneTimeAccrualProfileSnapshot, JEScheduleAISummaries, JEScheduleFieldRecommendation } from './entity/jeSchedules/jeSchedulesState';
111
+ import { JEOneTimeAccrualAiSuggestion, JEOneTimeAccrualBillingPattern, JEOneTimeAccrualCleared, JEOneTimeAccrualMatchSuggestion, JEOneTimeAccrualMonthlyTotal, JEOneTimeAccrualProfileSnapshot, JEScheduleAISummaries, JEScheduleFieldRecommendation, JEScheduleSummary, OneTimeAccrualEdits } from './entity/jeSchedules/jeSchedulesState';
112
112
  import { ALL_JE_SCHEDULE_IGNORE_REASONS, ALL_JE_SCHEDULE_REVERT_REASONS, ALL_ONE_TIME_ACCRUAL_IGNORE_REASONS, ALL_ONE_TIME_ACCRUAL_REVERT_REASONS, ALL_SCHEDULES_TYPES, JEOneTimeAccrualKey, JEScheduleIgnoreReasonType, JEScheduleKey, JEScheduleRevertReasonType, JEScheduleTransactionKey, JournalEntryErrorCodeType, OneTimeAccrualIgnoreReasonType, OneTimeAccrualRevertReasonType, ScheduleJournalEntryStatusCodeType, ScheduleStatusCodeType, ScheduleTransactionID, ScheduleTypes, getJEScheduleTransactionKey, toScheduleTypesType, toScheduleTypesTypeStrict } from './entity/jeSchedules/jeSchedulesTypes';
113
113
  import { Merchant } from './entity/merchant/merchant';
114
114
  import { ALL_MONTH_END_CLOSE_CHECKS_FREQUENCY, MonthCloseCheckMetrics, MonthCloseCheckProgressJson, MonthEndAuditSummary, MonthEndCloseCheck, MonthEndCloseCheckFrequency } from './entity/monthEndCloseChecks/monthEndCloseChecksState';
@@ -944,7 +944,7 @@ export { LinkBillExpenseKey };
944
944
  export { clearExpenseAutomationJEScheduleLocalData, clearExpenseAutomationJESchedulesView, clearJeSearchTransactionsForNewSchedule, fetchExpenseAutomationJESchedulesPage, ignoreExpenseAutomationJESchedule, initializeJeAccountSettingsView, initializeJeNewSchedule, initializeJeScheduleLocalData, removeJeScheduleTransactionKey, resetJeNewScheduleLocalData, retryExpenseAutomationJESchedule, saveJeNewSchedule, saveJeNewScheduleFailure, saveJeNewScheduleSuccess, searchJeTransactionsForNewSchedule, searchJeTransactionsForNewScheduleFailure, searchJeTransactionsForNewScheduleSuccess, updateExpenseAutomationJESchedulesUIState, updateJeNewScheduleLocalData, updateJeScheduleLocalDataById, updateJeScheduleTransactionKeys, };
945
945
  export { clearExpenseAutomationActualMatchingView, closeMatchNewModal, clearMatchNewModal, fetchExpenseAutomationActualMatching, fetchExpenseAutomationActualMatchingPage, matchAndReverseAccruals, openMatchNewModal, searchMatchAccruals, searchMatchTransactions, updateExpenseAutomationActualMatchingUIState, };
946
946
  export { createNewSchedulesAccrued, deleteScheduleAccruedDetail, cancelScheduleAccruedJournalEntry, fetchScheduleAccruedDetails, fetchScheduleAccruedDetailsPage, resetJEAccruedLinkInLocalData, saveScheduleAccruedDetails, updateAmountsInScheduleAccruedDetail, updatedJEAccruedLinkWithRecommendedLocalData, updatedJELinkInLocalDataAccruedExpenses, fetchRecommendedTransactionRowIndex, clearSelectedJELinkRowIndex, updateLinkBillExpenseLocalData, updateScheduleAccruedDetailsLocalData, updateSelectedJEAccruedScheduleKey, resetSelectedJEAccruedScheduleKey, resetAccruedDetailNewScheduleState, };
947
- export { JEScheduleKey, JEScheduleTransactionKey, ScheduleTransactionID, getJEScheduleTransactionKey, ALL_JE_SCHEDULE_IGNORE_REASONS, ALL_JE_SCHEDULE_REVERT_REASONS, ALL_ONE_TIME_ACCRUAL_IGNORE_REASONS, ALL_ONE_TIME_ACCRUAL_REVERT_REASONS, ALL_SCHEDULES_TYPES, JEScheduledTransaction, JEAccruedSchedule, JEOneTimeAccrual, JEOneTimeAccrualAiSuggestion, JEOneTimeAccrualBillingPattern, JEOneTimeAccrualCleared, JEOneTimeAccrualMatchSuggestion, JEOneTimeAccrualMonthlyTotal, JEOneTimeAccrualProfileSnapshot, JEOneTimeAccrualKey, JEScheduleAISummaries, JEScheduleFieldRecommendation, ScheduleTypes, ScheduleJournalEntryStatusCodeType, ScheduleListReport, ScheduleAccruedListReport, getScheduleListReport, getAccruedScheduleListReport, ScheduleSubTabType, ScheduleListSortKey, fetchScheduleList, fetchAccruedScheduleList, fetchDownloadSchedules, fetchSchedulesAccount, updateScheduleListLocalData, getFetchStateForScheduleAccountList, toScheduleTypesType, toScheduleTypesTypeStrict, toScheduleListTabsFileTypeStrict, ScheduleListLocalData, ScheduleDetailsLocalDataFixedAssets, ScheduleDetailsLocalDataAccruedExpenses, ScheduleDetailsView, ScheduleAccruedDetailsView, LinkBillExpenseView, LinkBillExpenseLocalData, JEScheduleDetailsLocalData, ScheduleDetailsLocalData, toScheduleSubTabType, ScheduleStatusCodeType, JEScheduleIgnoreReasonType, JEScheduleRevertReasonType, JournalEntryErrorCodeType, OneTimeAccrualIgnoreReasonType, OneTimeAccrualRevertReasonType, ScheduleTransaction, updateScheduleListSubTab, updateScheduleListSearchText, updateScheduleListScrollState, updateScheduleListSortState, ScheduleDetailSortKey, ScheduledJournalEntry, updateSelectedJEScheduleKey, fetchScheduleDetails, getScheduleDetailsView, getAccruedScheduleDetailsView, fetchScheduleDetailsPage, saveScheduleDetails, deleteScheduleDetail, createNewSchedules, updateScheduleDetailsLocalData, JETransactionLink, updateScheduleListDownloadState, updateAccruedJEScheduleAccruedByListKey, DownloadJEScheduleTabOptions, updatedSelectedJELinkRowIndex, ScheduleListTabsFileType, getQBOUrlForLink, getThirdPartyIDFromQBOURL, updatedJELinkInLocalData, updateAmountsInScheduleDetail, ScheduleDetailUIState, resetJELinkInLocalData, JEScheduledTransactionWithBalance, JEScheduleWithBalance, JELinkType, updatedJELinkWithRecommendedLocalData, getFetchStateForScheduleListByType, getDefaultSelectedTimeframeForScheduleType, markAsCompleteScheduleDetail, resetMarkAsCompleteStatus, fetchVendorTabView, updateVendorTabViewTab, VendorTabViewTabType, getVendorTabView, VendorTabViewSelectorView, };
947
+ export { JEScheduleKey, JEScheduleTransactionKey, ScheduleTransactionID, getJEScheduleTransactionKey, ALL_JE_SCHEDULE_IGNORE_REASONS, ALL_JE_SCHEDULE_REVERT_REASONS, ALL_ONE_TIME_ACCRUAL_IGNORE_REASONS, ALL_ONE_TIME_ACCRUAL_REVERT_REASONS, ALL_SCHEDULES_TYPES, JEScheduledTransaction, JEAccruedSchedule, JEOneTimeAccrual, OneTimeAccrualEdits, JEOneTimeAccrualAiSuggestion, JEOneTimeAccrualBillingPattern, JEOneTimeAccrualCleared, JEOneTimeAccrualMatchSuggestion, JEOneTimeAccrualMonthlyTotal, JEOneTimeAccrualProfileSnapshot, JEOneTimeAccrualKey, JEScheduleAISummaries, JEScheduleFieldRecommendation, JEScheduleSummary, ScheduleTypes, ScheduleJournalEntryStatusCodeType, ScheduleListReport, ScheduleAccruedListReport, getScheduleListReport, getAccruedScheduleListReport, ScheduleSubTabType, ScheduleListSortKey, fetchScheduleList, fetchAccruedScheduleList, fetchDownloadSchedules, fetchSchedulesAccount, updateScheduleListLocalData, getFetchStateForScheduleAccountList, toScheduleTypesType, toScheduleTypesTypeStrict, toScheduleListTabsFileTypeStrict, ScheduleListLocalData, ScheduleDetailsLocalDataFixedAssets, ScheduleDetailsLocalDataAccruedExpenses, ScheduleDetailsView, ScheduleAccruedDetailsView, LinkBillExpenseView, LinkBillExpenseLocalData, JEScheduleDetailsLocalData, ScheduleDetailsLocalData, toScheduleSubTabType, ScheduleStatusCodeType, JEScheduleIgnoreReasonType, JEScheduleRevertReasonType, JournalEntryErrorCodeType, OneTimeAccrualIgnoreReasonType, OneTimeAccrualRevertReasonType, ScheduleTransaction, updateScheduleListSubTab, updateScheduleListSearchText, updateScheduleListScrollState, updateScheduleListSortState, ScheduleDetailSortKey, ScheduledJournalEntry, updateSelectedJEScheduleKey, fetchScheduleDetails, getScheduleDetailsView, getAccruedScheduleDetailsView, fetchScheduleDetailsPage, saveScheduleDetails, deleteScheduleDetail, createNewSchedules, updateScheduleDetailsLocalData, JETransactionLink, updateScheduleListDownloadState, updateAccruedJEScheduleAccruedByListKey, DownloadJEScheduleTabOptions, updatedSelectedJELinkRowIndex, ScheduleListTabsFileType, getQBOUrlForLink, getThirdPartyIDFromQBOURL, updatedJELinkInLocalData, updateAmountsInScheduleDetail, ScheduleDetailUIState, resetJELinkInLocalData, JEScheduledTransactionWithBalance, JEScheduleWithBalance, JELinkType, updatedJELinkWithRecommendedLocalData, getFetchStateForScheduleListByType, getDefaultSelectedTimeframeForScheduleType, markAsCompleteScheduleDetail, resetMarkAsCompleteStatus, fetchVendorTabView, updateVendorTabViewTab, VendorTabViewTabType, getVendorTabView, VendorTabViewSelectorView, };
948
948
  export { GlobalMerchant, GlobalMerchantBase, TenantMerchant };
949
949
  export { ReviewStatus, VendorTransactionAttachment, VendorTransactionAttachmentPayload, VendorFirstReviewViewSelectorView, VendorFirstReviewViewLocalData, VendorFirstReviewSelectorView, VendorFirstReviewSelectorAttachmentView, VendorFirstReviewViewUIState, VendorFirstReviewViewColumnKey, GlobalMerchantAutoCompleteView, VendorReviewRowCurrentSelection, toVendorFirstReviewViewColumnKeyType, RecommendedNonExistingGlobalMerchant, getGlobalMerchantAutoCompleteResults, VendorReviewRecommendationViewState, GlobalMerchantType, getVendorFirstReviewView, getVendorFirstReviewAttachmentView, fetchVendorFirstReviewView, fetchVendorFirstReviewAttachments, updateVendorFirstReviewViewScrollYOffset, resetVendorFirstReviewLocalData, updateVendorFirstReviewViewPageToken, clearRecentlySavedErroredVendorData, saveVendorFirstReviewView, updateVendorFirstReviewViewLocalData, updateVendorFirstReviewSortUiState, fetchGlobalMerchantAutoCompleteView, clearGlobalMerchantAutoCompleteResults, GlobalVendorReviewRowCurrentSelection, FirstReviewPageCurrentSelectionByColumn, updateReviewVendorDetailLocalData, saveVendorDetailsView, getVendorDetailSelectorView, FirstReviewVendorDetailSelectorView, VendorViewLocalData, };
950
950
  export { fetchGlobalMerchantRecommendation, createGlobalMerchant, updateCreateGlobalMerchantLocalData, clearGlobalMerchantView, getGlobalMerchantView, GlobalMerchantViewSelectorView, GlobalMerchantViewState, NewGlobalMerchantData, NewGlobalMerchantCurrentSelection, };
@@ -53,21 +53,44 @@ messageSection, accrualId, message, status) {
53
53
  }
54
54
  const promoteOneTimeAccrualEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(jeSchedulesViewReducer_1.promoteOneTimeAccrual.match), (0, operators_1.mergeMap)((action) => {
55
55
  const state = state$.value;
56
- const { accrualId, amount } = action.payload;
56
+ const { accrualId, amount, edits } = action.payload;
57
57
  const accrual = (0, jeSchedulesSelector_1.getJEOneTimeAccrualByKey)((0, jeScheduleHelper_1.generateJEOneTimeAccrualKey)(accrualId), state.jeSchedulesState);
58
- if (accrual?.jeDebitAccountId == null ||
59
- accrual.jeCreditAccountId == null) {
58
+ // An edited value wins; anything untouched falls back to the stored draft, which is what the
59
+ // list's inline Post sends.
60
+ const debitAccountId = edits?.jeDebitAccountId ?? accrual?.jeDebitAccountId;
61
+ const creditAccountId = edits?.jeCreditAccountId ?? accrual?.jeCreditAccountId;
62
+ if (debitAccountId == null || creditAccountId == null) {
60
63
  // Promote posts a journal entry, so it cannot proceed without both sides of it.
61
64
  return (0, rxjs_1.from)(failureActions('save_schedule', accrualId, 'This accrual is missing an expense or liability account.'));
62
65
  }
63
66
  // vendor_id, vendor_name and service_month are deliberately absent: promote takes them from
64
67
  // the stored draft and ignores them in the body, so sending them would imply a reassignment
65
68
  // that never happens.
69
+ // Untouched falls back to the stored policy, so posting without editing cannot silently
70
+ // flip a scheduled reversal to on-bill-match.
71
+ const reverseNextMonth = edits?.reverseNextMonth ??
72
+ accrual?.reversalPolicy === 'scheduled_date';
73
+ const expectedReversalDate = edits?.expectedReversalDate ?? accrual?.expectedReversalDate;
74
+ const debitClassId = edits?.jeDebitAccountingClassId ?? accrual?.jeDebitAccountingClassId;
75
+ const debitClassName = edits?.jeDebitAccountingClassName ??
76
+ accrual?.jeDebitAccountingClassName;
66
77
  const payload = {
67
78
  amount,
68
- memo: accrual.memo,
69
- je_debit_account_id: accrual.jeDebitAccountId,
70
- je_credit_account_id: accrual.jeCreditAccountId,
79
+ memo: edits?.memo ?? accrual?.memo ?? '',
80
+ je_debit_account_id: debitAccountId,
81
+ je_credit_account_id: creditAccountId,
82
+ ...(debitClassId != null ? { je_debit_accounting_class_id: debitClassId } : {}),
83
+ ...(debitClassName != null
84
+ ? { je_debit_accounting_class_name: debitClassName }
85
+ : {}),
86
+ // Mirrors the create payload: reverse_next_month alone decides the policy, and the date is
87
+ // only meaningful when it is true -- agent-je derives the reversal from the bill otherwise.
88
+ reverse_next_month: reverseNextMonth,
89
+ ...(reverseNextMonth && expectedReversalDate != null
90
+ ? {
91
+ expected_reversal_date: expectedReversalDate.format(timePeriod_1.DEFAULT_DATE_FORMAT),
92
+ }
93
+ : {}),
71
94
  };
72
95
  return zeniAPI
73
96
  .putAndGetJSON(`${zeniAPI.apiEndPoints.accountMicroServiceBaseUrl}/1.0/accruals/${accrualId}`, { ...payload })
@@ -83,7 +106,7 @@ const promoteOneTimeAccrualEpic = (actions$, state$, zeniAPI) => actions$.pipe((
83
106
  variables: [
84
107
  {
85
108
  variableName: '_vendor_name_',
86
- variableValue: accrual.vendorName,
109
+ variableValue: accrual?.vendorName ?? '',
87
110
  },
88
111
  ],
89
112
  }),
@@ -30,11 +30,16 @@ export interface MatchTransactionSearchResultPayload {
30
30
  transaction_id: ID;
31
31
  transaction_integration_id: string;
32
32
  transaction_type: string;
33
+ account_description?: string | null;
33
34
  account_id?: ID | null;
34
35
  account_name?: string | null;
36
+ accounting_class_id?: ID | null;
37
+ accounting_class_name?: string | null;
35
38
  currency_code?: string | null;
36
39
  currency_symbol?: string | null;
40
+ transaction_description?: string | null;
37
41
  transaction_memo?: string | null;
42
+ transaction_type_name?: string | null;
38
43
  vendor_id?: ID | null;
39
44
  vendor_name?: string | null;
40
45
  }
@@ -23,12 +23,17 @@ function toActualMatchingTransactionSearchResult(payload) {
23
23
  transactionDate: payload.transaction_date,
24
24
  accountId: payload.account_id ?? undefined,
25
25
  accountName: payload.account_name ?? undefined,
26
+ accountDescription: payload.account_description ?? undefined,
27
+ accountingClassId: payload.accounting_class_id ?? undefined,
28
+ accountingClassName: payload.accounting_class_name ?? undefined,
26
29
  currencyCode,
27
30
  currencySymbol: payload.currency_symbol ??
28
31
  (currencyCode === DEFAULT_CURRENCY_CODE
29
32
  ? DEFAULT_CURRENCY_SYMBOL
30
33
  : currencyCode),
31
34
  transactionMemo: payload.transaction_memo ?? undefined,
35
+ transactionDescription: payload.transaction_description ?? undefined,
36
+ transactionTypeName: payload.transaction_type_name ?? undefined,
32
37
  };
33
38
  }
34
39
  function toMatchAndReverseResult(payload) {
@@ -52,11 +52,25 @@ export type CreateOneTimeAccrualResponse = ZeniAPIResponse<{
52
52
  * treats them as immutable and takes them from the existing draft, so sending them would imply a
53
53
  * reassignment the API silently ignores.
54
54
  */
55
+ /**
56
+ * The body agent-je's `promote_draft` reads. Promote is the only write path for a draft accrual --
57
+ * it applies the body and posts the JE in one step -- so every field a human can edit on the detail
58
+ * page travels here.
59
+ *
60
+ * `posting_date` is absent on purpose: agent-je derives it from the accrual's service month and
61
+ * ignores any value sent for it.
62
+ */
55
63
  export interface PromoteOneTimeAccrualPayload {
56
64
  amount: number;
57
65
  je_credit_account_id: ID;
58
66
  je_debit_account_id: ID;
59
67
  memo: string;
68
+ expected_reversal_date?: string;
69
+ je_credit_accounting_class_id?: ID;
70
+ je_credit_accounting_class_name?: string;
71
+ je_debit_accounting_class_id?: ID;
72
+ je_debit_accounting_class_name?: string;
73
+ reverse_next_month?: boolean;
60
74
  }
61
75
  /**
62
76
  * Ignore body. `scope` is deliberately absent — the API returns 400 if it is sent, which is why the
@@ -3,6 +3,7 @@ import { MonthYearPeriod, TimePeriod } from '../../../commonStateTypes/timePerio
3
3
  import { AccountMetadataPayload } from '../../../entity/account/accountPayload';
4
4
  import { JEAccruedScheduledTransactionPayload, JEOneTimeAccrualPayload, JEScheduledTransactionPayload } from '../../../entity/jeSchedules/jeSchedulesPayload';
5
5
  import { JEScheduleKey, JEScheduleTransactionKey, ScheduleTypes } from '../../../entity/jeSchedules/jeSchedulesTypes';
6
+ import { OneTimeAccrualEdits } from '../../../entity/jeSchedules/jeSchedulesState';
6
7
  import { ZeniAPIStatus } from '../../../responsePayload';
7
8
  import { AccountTypeRecommendationPayload } from '../../accountMappingView/accountTypeRecommendation/accountTypeRecommendationPayload';
8
9
  import { AccountSettingsLocalData, AccountSettingsState, JEPageTab, JEScheduleLocalData, JESchedulesViewState, JESchedulesViewUIState, NewOneTimeAccrualLocalData, NewScheduleLocalData, NewScheduleLocalDataFixedAssets, SearchTransactionsState } from '../types/jeSchedulesViewState';
@@ -24,9 +25,10 @@ export declare const clearExpenseAutomationJESchedulesView: import("@reduxjs/too
24
25
  status: ZeniAPIStatus;
25
26
  }, "expenseAutomationJESchedulesView/oneTimeAccrualActionFailure">, oneTimeAccrualActionSuccess: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
26
27
  accrualId: ID;
27
- }, "expenseAutomationJESchedulesView/oneTimeAccrualActionSuccess">, promoteOneTimeAccrual: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[accrualId: string, amount: number], {
28
+ }, "expenseAutomationJESchedulesView/oneTimeAccrualActionSuccess">, promoteOneTimeAccrual: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[accrualId: string, amount: number, edits?: OneTimeAccrualEdits | undefined], {
28
29
  accrualId: string;
29
30
  amount: number;
31
+ edits: OneTimeAccrualEdits | undefined;
30
32
  }, "expenseAutomationJESchedulesView/promoteOneTimeAccrual", never, never>, revertJeSchedule: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[jeScheduleId: string, jeScheduleTransactionKey: `${string}_${string}` | `${string}_expense_${string}` | `${string}_check_${string}` | `${string}_invoice_${string}` | `${string}_payment_${string}` | `${string}_credit_memo_${string}` | `${string}_sales_receipt_${string}` | `${string}_delayed_credit_${string}` | `${string}_delayed_charge_${string}` | `${string}_refund_${string}` | `${string}_bill_${string}` | `${string}_bill_payment_${string}` | `${string}_bill_payment_check_${string}` | `${string}_bill_payment_credit_card_${string}` | `${string}_vendor_credit_${string}` | `${string}_credit_card_credit_${string}` | `${string}_transfer_${string}` | `${string}_credit_card_payment_${string}` | `${string}_deposit_${string}` | `${string}_journal_entry_${string}`, scheduleType: "prepaid_expenses" | "fixed_assets" | "accrued_expenses" | "deferred_revenue", reason: "duplicate" | "amount_off" | "wrong_period" | "created_by_mistake" | "other_revert", note?: string | undefined], {
31
33
  jeScheduleId: string;
32
34
  jeScheduleTransactionKey: `${string}_${string}` | `${string}_expense_${string}` | `${string}_check_${string}` | `${string}_invoice_${string}` | `${string}_payment_${string}` | `${string}_credit_memo_${string}` | `${string}_sales_receipt_${string}` | `${string}_delayed_credit_${string}` | `${string}_delayed_charge_${string}` | `${string}_refund_${string}` | `${string}_bill_${string}` | `${string}_bill_payment_${string}` | `${string}_bill_payment_check_${string}` | `${string}_bill_payment_credit_card_${string}` | `${string}_vendor_credit_${string}` | `${string}_credit_card_credit_${string}` | `${string}_transfer_${string}` | `${string}_credit_card_payment_${string}` | `${string}_deposit_${string}` | `${string}_journal_entry_${string}`;
@@ -580,9 +580,14 @@ const expenseAutomationJESchedulesView = (0, toolkit_1.createSlice)({
580
580
  error: action.payload.status,
581
581
  };
582
582
  },
583
+ /**
584
+ * Promote applies the body and posts in one step, so it carries whatever the user edited on the
585
+ * detail page. `edits` is absent when nothing was changed -- the epic then falls back to the
586
+ * stored accrual, which is what the list's inline Post does.
587
+ */
583
588
  promoteOneTimeAccrual: {
584
- prepare(accrualId, amount) {
585
- return { payload: { accrualId, amount } };
589
+ prepare(accrualId, amount, edits) {
590
+ return { payload: { accrualId, amount, edits } };
586
591
  },
587
592
  reducer(draft, action) {
588
593
  draft.oneTimeAccrualActionStatusById[action.payload.accrualId] = {
@@ -32,9 +32,14 @@ export interface ActualMatchingTransactionSearchResult {
32
32
  transactionIntegrationId: string;
33
33
  transactionType: string;
34
34
  vendorName: string;
35
+ accountDescription?: string;
35
36
  accountId?: ID;
37
+ accountingClassId?: ID;
38
+ accountingClassName?: string;
36
39
  accountName?: string;
40
+ transactionDescription?: string;
37
41
  transactionMemo?: string;
42
+ transactionTypeName?: string;
38
43
  vendorId?: ID;
39
44
  }
40
45
  export interface MatchAndReverseResult {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zeniai/client-epic-state",
3
- "version": "5.2.11-betaAM1",
3
+ "version": "5.2.11-betaAM3",
4
4
  "description": "Shared module between Web & Mobile containing required abstractions for state management, async network communication. ",
5
5
  "main": "lib/index.js",
6
6
  "module": "lib/esm/index.js",