@zeniai/client-epic-state 5.2.11-betaRD4 → 5.2.11-betaRD6
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.
- package/lib/entity/jeSchedules/jeSchedulesPayload.d.ts +1 -0
- package/lib/entity/jeSchedules/jeSchedulesPayload.js +1 -0
- package/lib/entity/jeSchedules/jeSchedulesState.d.ts +21 -2
- package/lib/esm/entity/jeSchedules/jeSchedulesPayload.js +1 -0
- package/lib/esm/view/expenseAutomationView/epics/jeSchedule/oneTimeAccrualActionsEpic.js +27 -8
- package/lib/esm/view/expenseAutomationView/reducers/jeSchedulesViewReducer.js +7 -2
- package/lib/index.d.ts +2 -2
- package/lib/view/expenseAutomationView/epics/jeSchedule/oneTimeAccrualActionsEpic.js +26 -7
- package/lib/view/expenseAutomationView/payload/jeSchedulesPayload.d.ts +14 -0
- package/lib/view/expenseAutomationView/reducers/jeSchedulesViewReducer.d.ts +3 -1
- package/lib/view/expenseAutomationView/reducers/jeSchedulesViewReducer.js +7 -2
- package/package.json +1 -1
|
@@ -21,6 +21,7 @@ export interface JEScheduleAISummaryFieldPayload {
|
|
|
21
21
|
}
|
|
22
22
|
/** The whole-recommendation summary. Carries narrative only -- no predicted value, no confidence. */
|
|
23
23
|
export interface JEScheduleSummaryPayload {
|
|
24
|
+
confidence?: number;
|
|
24
25
|
cot?: string[];
|
|
25
26
|
reasoning?: string;
|
|
26
27
|
reasoning_long?: string;
|
|
@@ -244,6 +244,7 @@ function toJEScheduleAISummaries(payload) {
|
|
|
244
244
|
}
|
|
245
245
|
if (payload.schedule_summary != null) {
|
|
246
246
|
result.scheduleSummary = {
|
|
247
|
+
confidence: payload.schedule_summary.confidence,
|
|
247
248
|
reasoning: payload.schedule_summary.reasoning,
|
|
248
249
|
reasoningLong: payload.schedule_summary.reasoning_long,
|
|
249
250
|
cot: Array.isArray(payload.schedule_summary.cot)
|
|
@@ -22,10 +22,13 @@ export interface JEScheduleFieldRecommendation {
|
|
|
22
22
|
/**
|
|
23
23
|
* The agent's summary of the whole recommendation, as opposed to one field of it.
|
|
24
24
|
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
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.
|
|
27
29
|
*/
|
|
28
30
|
export interface JEScheduleSummary {
|
|
31
|
+
confidence?: number;
|
|
29
32
|
cot?: string[];
|
|
30
33
|
reasoning?: string;
|
|
31
34
|
reasoningLong?: string;
|
|
@@ -132,6 +135,22 @@ export interface JEAccruedScheduledTransactionState extends Omit<JEScheduledTran
|
|
|
132
135
|
memo: string;
|
|
133
136
|
recurringAmount: Amount;
|
|
134
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
|
+
reversalPolicy?: OneTimeAccrualReversalPolicyType;
|
|
153
|
+
}
|
|
135
154
|
export interface JEOneTimeAccrualCreator {
|
|
136
155
|
userId: ID;
|
|
137
156
|
email?: string;
|
|
@@ -233,6 +233,7 @@ function toJEScheduleAISummaries(payload) {
|
|
|
233
233
|
}
|
|
234
234
|
if (payload.schedule_summary != null) {
|
|
235
235
|
result.scheduleSummary = {
|
|
236
|
+
confidence: payload.schedule_summary.confidence,
|
|
236
237
|
reasoning: payload.schedule_summary.reasoning,
|
|
237
238
|
reasoningLong: payload.schedule_summary.reasoning_long,
|
|
238
239
|
cot: Array.isArray(payload.schedule_summary.cot)
|
|
@@ -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,40 @@ 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
|
-
|
|
56
|
-
|
|
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
|
+
const reversalPolicy = edits?.reversalPolicy ?? accrual?.reversalPolicy;
|
|
67
|
+
const expectedReversalDate = edits?.expectedReversalDate ?? accrual?.expectedReversalDate;
|
|
68
|
+
const debitClassId = edits?.jeDebitAccountingClassId ?? accrual?.jeDebitAccountingClassId;
|
|
69
|
+
const debitClassName = edits?.jeDebitAccountingClassName ??
|
|
70
|
+
accrual?.jeDebitAccountingClassName;
|
|
63
71
|
const payload = {
|
|
64
72
|
amount,
|
|
65
|
-
memo: accrual
|
|
66
|
-
je_debit_account_id:
|
|
67
|
-
je_credit_account_id:
|
|
73
|
+
memo: edits?.memo ?? accrual?.memo ?? '',
|
|
74
|
+
je_debit_account_id: debitAccountId,
|
|
75
|
+
je_credit_account_id: creditAccountId,
|
|
76
|
+
...(debitClassId != null ? { je_debit_accounting_class_id: debitClassId } : {}),
|
|
77
|
+
...(debitClassName != null
|
|
78
|
+
? { je_debit_accounting_class_name: debitClassName }
|
|
79
|
+
: {}),
|
|
80
|
+
...(reversalPolicy != null ? { reversal_policy: reversalPolicy } : {}),
|
|
81
|
+
// Only meaningful for the scheduled-date policy; agent-je derives it for on_bill_match.
|
|
82
|
+
...(reversalPolicy === 'scheduled_date' && expectedReversalDate != null
|
|
83
|
+
? {
|
|
84
|
+
expected_reversal_date: expectedReversalDate.format(DEFAULT_DATE_FORMAT),
|
|
85
|
+
}
|
|
86
|
+
: {}),
|
|
68
87
|
};
|
|
69
88
|
return zeniAPI
|
|
70
89
|
.putAndGetJSON(`${zeniAPI.apiEndPoints.accountMicroServiceBaseUrl}/1.0/accruals/${accrualId}`, { ...payload })
|
|
@@ -80,7 +99,7 @@ export const promoteOneTimeAccrualEpic = (actions$, state$, zeniAPI) => actions$
|
|
|
80
99
|
variables: [
|
|
81
100
|
{
|
|
82
101
|
variableName: '_vendor_name_',
|
|
83
|
-
variableValue: accrual
|
|
102
|
+
variableValue: accrual?.vendorName ?? '',
|
|
84
103
|
},
|
|
85
104
|
],
|
|
86
105
|
}),
|
|
@@ -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, JEOneTimeAccrualMonthlyTotal, JEOneTimeAccrualProfileSnapshot, JEScheduleAISummaries, JEScheduleFieldRecommendation, JEScheduleSummary } from './entity/jeSchedules/jeSchedulesState';
|
|
111
|
+
import { JEOneTimeAccrualAiSuggestion, JEOneTimeAccrualBillingPattern, 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';
|
|
@@ -940,7 +940,7 @@ export { fetchApAgingDetail, AgingReportInvoice, ApAgingDetail, getApAgingDetail
|
|
|
940
940
|
export { LinkBillExpenseKey };
|
|
941
941
|
export { clearExpenseAutomationJEScheduleLocalData, clearExpenseAutomationJESchedulesView, clearJeSearchTransactionsForNewSchedule, fetchExpenseAutomationJESchedulesPage, ignoreExpenseAutomationJESchedule, initializeJeAccountSettingsView, initializeJeNewSchedule, initializeJeScheduleLocalData, removeJeScheduleTransactionKey, resetJeNewScheduleLocalData, retryExpenseAutomationJESchedule, saveJeNewSchedule, saveJeNewScheduleFailure, saveJeNewScheduleSuccess, searchJeTransactionsForNewSchedule, searchJeTransactionsForNewScheduleFailure, searchJeTransactionsForNewScheduleSuccess, updateExpenseAutomationJESchedulesUIState, updateJeNewScheduleLocalData, updateJeScheduleLocalDataById, updateJeScheduleTransactionKeys, };
|
|
942
942
|
export { createNewSchedulesAccrued, deleteScheduleAccruedDetail, cancelScheduleAccruedJournalEntry, fetchScheduleAccruedDetails, fetchScheduleAccruedDetailsPage, resetJEAccruedLinkInLocalData, saveScheduleAccruedDetails, updateAmountsInScheduleAccruedDetail, updatedJEAccruedLinkWithRecommendedLocalData, updatedJELinkInLocalDataAccruedExpenses, fetchRecommendedTransactionRowIndex, clearSelectedJELinkRowIndex, updateLinkBillExpenseLocalData, updateScheduleAccruedDetailsLocalData, updateSelectedJEAccruedScheduleKey, resetSelectedJEAccruedScheduleKey, resetAccruedDetailNewScheduleState, };
|
|
943
|
-
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, 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, };
|
|
943
|
+
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, 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, };
|
|
944
944
|
export { GlobalMerchant, GlobalMerchantBase, TenantMerchant };
|
|
945
945
|
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, };
|
|
946
946
|
export { fetchGlobalMerchantRecommendation, createGlobalMerchant, updateCreateGlobalMerchantLocalData, clearGlobalMerchantView, getGlobalMerchantView, GlobalMerchantViewSelectorView, GlobalMerchantViewState, NewGlobalMerchantData, NewGlobalMerchantCurrentSelection, };
|
|
@@ -53,21 +53,40 @@ 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
|
-
|
|
59
|
-
|
|
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
|
+
const reversalPolicy = edits?.reversalPolicy ?? accrual?.reversalPolicy;
|
|
70
|
+
const expectedReversalDate = edits?.expectedReversalDate ?? accrual?.expectedReversalDate;
|
|
71
|
+
const debitClassId = edits?.jeDebitAccountingClassId ?? accrual?.jeDebitAccountingClassId;
|
|
72
|
+
const debitClassName = edits?.jeDebitAccountingClassName ??
|
|
73
|
+
accrual?.jeDebitAccountingClassName;
|
|
66
74
|
const payload = {
|
|
67
75
|
amount,
|
|
68
|
-
memo: accrual
|
|
69
|
-
je_debit_account_id:
|
|
70
|
-
je_credit_account_id:
|
|
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
|
+
...(reversalPolicy != null ? { reversal_policy: reversalPolicy } : {}),
|
|
84
|
+
// Only meaningful for the scheduled-date policy; agent-je derives it for on_bill_match.
|
|
85
|
+
...(reversalPolicy === 'scheduled_date' && expectedReversalDate != null
|
|
86
|
+
? {
|
|
87
|
+
expected_reversal_date: expectedReversalDate.format(timePeriod_1.DEFAULT_DATE_FORMAT),
|
|
88
|
+
}
|
|
89
|
+
: {}),
|
|
71
90
|
};
|
|
72
91
|
return zeniAPI
|
|
73
92
|
.putAndGetJSON(`${zeniAPI.apiEndPoints.accountMicroServiceBaseUrl}/1.0/accruals/${accrualId}`, { ...payload })
|
|
@@ -83,7 +102,7 @@ const promoteOneTimeAccrualEpic = (actions$, state$, zeniAPI) => actions$.pipe((
|
|
|
83
102
|
variables: [
|
|
84
103
|
{
|
|
85
104
|
variableName: '_vendor_name_',
|
|
86
|
-
variableValue: accrual
|
|
105
|
+
variableValue: accrual?.vendorName ?? '',
|
|
87
106
|
},
|
|
88
107
|
],
|
|
89
108
|
}),
|
|
@@ -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
|
+
reversal_policy?: string;
|
|
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] = {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zeniai/client-epic-state",
|
|
3
|
-
"version": "5.2.11-
|
|
3
|
+
"version": "5.2.11-betaRD6",
|
|
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",
|