@zeniai/client-epic-state 5.1.83-betaRD1 → 5.1.83-betaRD2
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/jeScheduleHelper.d.ts +2 -0
- package/lib/entity/jeSchedules/jeScheduleHelper.js +7 -0
- package/lib/entity/jeSchedules/jeSchedulesPayload.d.ts +32 -1
- package/lib/entity/jeSchedules/jeSchedulesPayload.js +66 -0
- package/lib/entity/jeSchedules/jeSchedulesReducer.d.ts +4 -2
- package/lib/entity/jeSchedules/jeSchedulesReducer.js +26 -2
- package/lib/entity/jeSchedules/jeSchedulesSelector.d.ts +6 -2
- package/lib/entity/jeSchedules/jeSchedulesSelector.js +15 -1
- package/lib/entity/jeSchedules/jeSchedulesState.d.ts +39 -1
- package/lib/entity/jeSchedules/jeSchedulesTypes.d.ts +12 -1
- package/lib/entity/jeSchedules/jeSchedulesTypes.js +40 -1
- package/lib/entity/tenant/clearAllEpic.d.ts +2 -2
- package/lib/entity/tenant/clearAllEpic.js +1 -0
- package/lib/esm/entity/jeSchedules/jeScheduleHelper.js +6 -0
- package/lib/esm/entity/jeSchedules/jeSchedulesPayload.js +66 -1
- package/lib/esm/entity/jeSchedules/jeSchedulesReducer.js +26 -2
- package/lib/esm/entity/jeSchedules/jeSchedulesSelector.js +13 -0
- package/lib/esm/entity/jeSchedules/jeSchedulesTypes.js +34 -0
- package/lib/esm/entity/tenant/clearAllEpic.js +2 -1
- package/lib/esm/index.js +1 -1
- package/lib/esm/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulesEpic.js +9 -1
- package/lib/esm/view/expenseAutomationView/reducers/jeSchedulesViewReducer.js +7 -1
- package/lib/esm/view/expenseAutomationView/selectors/jeSchedulesViewSelector.js +120 -19
- package/lib/index.d.ts +4 -4
- package/lib/index.js +2 -1
- package/lib/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulesEpic.d.ts +2 -2
- package/lib/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulesEpic.js +8 -0
- package/lib/view/expenseAutomationView/payload/jeSchedulesPayload.d.ts +2 -1
- package/lib/view/expenseAutomationView/reducers/jeSchedulesViewReducer.d.ts +2 -1
- package/lib/view/expenseAutomationView/reducers/jeSchedulesViewReducer.js +7 -1
- package/lib/view/expenseAutomationView/reducers/missingReceiptsViewReducer.d.ts +1 -1
- package/lib/view/expenseAutomationView/reducers/transactionsViewReducer.d.ts +2 -2
- package/lib/view/expenseAutomationView/selectors/jeSchedulesViewSelector.d.ts +8 -2
- package/lib/view/expenseAutomationView/selectors/jeSchedulesViewSelector.js +123 -18
- package/lib/view/expenseAutomationView/types/completedSubTab.d.ts +1 -1
- package/lib/view/expenseAutomationView/types/jeSchedulesViewState.d.ts +2 -1
- package/package.json +1 -1
|
@@ -1,2 +1,4 @@
|
|
|
1
|
+
import { ID } from '../../commonStateTypes/common';
|
|
1
2
|
import { JEAccruedScheduledTransactionPayload } from './jeSchedulesPayload';
|
|
2
3
|
export declare function generateJEScheduleKey(payload: JEAccruedScheduledTransactionPayload): `${string}_${string}`;
|
|
4
|
+
export declare function generateJEOneTimeAccrualKey(accrualId: ID): `${string}_one_time_accrual`;
|
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.generateJEScheduleKey = generateJEScheduleKey;
|
|
4
|
+
exports.generateJEOneTimeAccrualKey = generateJEOneTimeAccrualKey;
|
|
4
5
|
function generateJEScheduleKey(payload) {
|
|
5
6
|
return `${payload.je_schedule_id}_${payload.je_schedule_type}`;
|
|
6
7
|
}
|
|
8
|
+
// Suffixed rather than using the bare Mongo _id so the key is a distinct type from
|
|
9
|
+
// JEScheduleKey / JEScheduleTransactionKey and the three cannot be passed interchangeably.
|
|
10
|
+
// The unsuffixed id stays on the entity as `accrualId` for callers that need it.
|
|
11
|
+
function generateJEOneTimeAccrualKey(accrualId) {
|
|
12
|
+
return `${accrualId}_one_time_accrual`;
|
|
13
|
+
}
|
|
@@ -7,7 +7,7 @@ import { TransactionIDPayload } from '../transaction/payloadTypes/transactionIDP
|
|
|
7
7
|
import { TransactionCategory } from '../transaction/stateTypes/transactionType';
|
|
8
8
|
import { UserPayload } from '../user/userPayload';
|
|
9
9
|
import { VendorPayload } from '../vendor/vendorPayload';
|
|
10
|
-
import { JEAccruedScheduledTransactionState, JEScheduledTransactionState, ScheduledJournalEntryState } from './jeSchedulesState';
|
|
10
|
+
import { JEAccruedScheduledTransactionState, JEOneTimeAccrualState, JEScheduledTransactionState, ScheduledJournalEntryState } from './jeSchedulesState';
|
|
11
11
|
import { JEScheduleKey, JEScheduleTransactionKey } from './jeSchedulesTypes';
|
|
12
12
|
export interface JEScheduleOtherAttributesPayload {
|
|
13
13
|
asset_id?: string | null;
|
|
@@ -86,6 +86,36 @@ export interface JEAccruedScheduledTransactionPayload extends Omit<JEScheduledTr
|
|
|
86
86
|
memo: string;
|
|
87
87
|
recurring_amount: number;
|
|
88
88
|
}
|
|
89
|
+
export interface JEOneTimeAccrualPayload {
|
|
90
|
+
_id: ID;
|
|
91
|
+
estimated_amount: number;
|
|
92
|
+
origin: string;
|
|
93
|
+
service_month: string;
|
|
94
|
+
status: string;
|
|
95
|
+
vendor_id: ID;
|
|
96
|
+
vendor_name: string;
|
|
97
|
+
actual_post_date?: string | null;
|
|
98
|
+
actual_reversal_post_date?: string | null;
|
|
99
|
+
automation_tier?: string | null;
|
|
100
|
+
created_by_user?: UserPayload | null;
|
|
101
|
+
currency?: string | null;
|
|
102
|
+
expected_reversal_date?: string | null;
|
|
103
|
+
je_credit_account_id?: ID | null;
|
|
104
|
+
je_credit_account_name?: string | null;
|
|
105
|
+
je_credit_accounting_class_id?: ID | null;
|
|
106
|
+
je_credit_accounting_class_name?: string | null;
|
|
107
|
+
je_debit_account_id?: ID | null;
|
|
108
|
+
je_debit_account_name?: string | null;
|
|
109
|
+
je_debit_accounting_class_id?: ID | null;
|
|
110
|
+
je_debit_accounting_class_name?: string | null;
|
|
111
|
+
memo?: string | null;
|
|
112
|
+
posting_date?: string | null;
|
|
113
|
+
reversal_policy?: string | null;
|
|
114
|
+
reversal_transaction_id?: ID | null;
|
|
115
|
+
reversal_trigger?: string | null;
|
|
116
|
+
transaction_id?: ID | null;
|
|
117
|
+
transaction_integration_id?: ID | null;
|
|
118
|
+
}
|
|
89
119
|
export interface ScheduledJournalEntryPayload {
|
|
90
120
|
actual_post_date: string | null;
|
|
91
121
|
create_time: string | null;
|
|
@@ -116,3 +146,4 @@ export declare function getJEScheduleTransactionDetailKeyPayload(payload: Schedu
|
|
|
116
146
|
export declare function getJEScheduleKey(payload: JEAccruedScheduledTransactionPayload): JEScheduleKey;
|
|
117
147
|
export declare function toJEScheduledTransaction(payload: JEScheduledTransactionPayload): JEScheduledTransactionState;
|
|
118
148
|
export declare function toJEAccruedScheduledTransaction(payload: JEAccruedScheduledTransactionPayload): JEAccruedScheduledTransactionState;
|
|
149
|
+
export declare function toJEOneTimeAccrual(payload: JEOneTimeAccrualPayload): JEOneTimeAccrualState;
|
|
@@ -8,12 +8,15 @@ exports.getJEScheduleTransactionDetailKeyPayload = getJEScheduleTransactionDetai
|
|
|
8
8
|
exports.getJEScheduleKey = getJEScheduleKey;
|
|
9
9
|
exports.toJEScheduledTransaction = toJEScheduledTransaction;
|
|
10
10
|
exports.toJEAccruedScheduledTransaction = toJEAccruedScheduledTransaction;
|
|
11
|
+
exports.toJEOneTimeAccrual = toJEOneTimeAccrual;
|
|
11
12
|
const amount_1 = require("../../commonStateTypes/amount");
|
|
12
13
|
const timePeriod_1 = require("../../commonStateTypes/timePeriod");
|
|
13
14
|
const zeniDayJS_1 = require("../../zeniDayJS");
|
|
15
|
+
const zeniUrl_1 = require("../../zeniUrl");
|
|
14
16
|
const transactionIDPayload_1 = require("../transaction/payloadTypes/transactionIDPayload");
|
|
15
17
|
const jeScheduleHelper_1 = require("./jeScheduleHelper");
|
|
16
18
|
const jeSchedulesTypes_1 = require("./jeSchedulesTypes");
|
|
19
|
+
const USD_CURRENCY_CODE = 'USD';
|
|
17
20
|
function toScheduledJournalEntryState(payload, currency_code, currency_symbol) {
|
|
18
21
|
return {
|
|
19
22
|
status: {
|
|
@@ -344,3 +347,66 @@ function toJEAccruedScheduledTransaction(payload) {
|
|
|
344
347
|
jeScheduleType: (0, jeSchedulesTypes_1.toScheduleTypesTypeStrict)(payload.je_schedule_type),
|
|
345
348
|
};
|
|
346
349
|
}
|
|
350
|
+
function toJEOneTimeAccrual(payload) {
|
|
351
|
+
return {
|
|
352
|
+
accrualId: payload._id,
|
|
353
|
+
vendorId: payload.vendor_id,
|
|
354
|
+
vendorName: payload.vendor_name,
|
|
355
|
+
serviceMonth: payload.service_month,
|
|
356
|
+
accrualStatus: (0, jeSchedulesTypes_1.toOneTimeAccrualStatusCodeType)(payload.status),
|
|
357
|
+
origin: (0, jeSchedulesTypes_1.toOneTimeAccrualOriginType)(payload.origin),
|
|
358
|
+
automationTier: payload.automation_tier != null
|
|
359
|
+
? (0, jeSchedulesTypes_1.toOneTimeAccrualAutomationTierType)(payload.automation_tier)
|
|
360
|
+
: undefined,
|
|
361
|
+
estimatedAmount: toOneTimeAccrualAmount(payload.estimated_amount, payload.currency),
|
|
362
|
+
memo: payload.memo ?? '',
|
|
363
|
+
// Exclusive by contract: a scheduled row reverses on expectedReversalDate and bills never
|
|
364
|
+
// drive it, so the two never need reconciling. Defaulting to on_bill_match matches the
|
|
365
|
+
// create path's default when the field is absent on an older document.
|
|
366
|
+
reversalPolicy: (0, jeSchedulesTypes_1.toOneTimeAccrualReversalPolicyType)(payload.reversal_policy ?? 'on_bill_match'),
|
|
367
|
+
reversalTrigger: (0, jeSchedulesTypes_1.toOneTimeAccrualReversalTriggerType)(payload.reversal_trigger ?? undefined),
|
|
368
|
+
expectedReversalDate: payload.expected_reversal_date != null
|
|
369
|
+
? (0, zeniDayJS_1.date)(payload.expected_reversal_date)
|
|
370
|
+
: undefined,
|
|
371
|
+
postingDate: payload.posting_date != null ? (0, zeniDayJS_1.date)(payload.posting_date) : undefined,
|
|
372
|
+
actualPostDate: payload.actual_post_date != null
|
|
373
|
+
? (0, zeniDayJS_1.date)(payload.actual_post_date)
|
|
374
|
+
: undefined,
|
|
375
|
+
actualReversalPostDate: payload.actual_reversal_post_date != null
|
|
376
|
+
? (0, zeniDayJS_1.date)(payload.actual_reversal_post_date)
|
|
377
|
+
: undefined,
|
|
378
|
+
jeDebitAccountId: payload.je_debit_account_id ?? undefined,
|
|
379
|
+
jeDebitAccountName: payload.je_debit_account_name ?? undefined,
|
|
380
|
+
jeDebitAccountingClassId: payload.je_debit_accounting_class_id ?? undefined,
|
|
381
|
+
jeDebitAccountingClassName: payload.je_debit_accounting_class_name ?? undefined,
|
|
382
|
+
jeCreditAccountId: payload.je_credit_account_id ?? undefined,
|
|
383
|
+
jeCreditAccountName: payload.je_credit_account_name ?? undefined,
|
|
384
|
+
jeCreditAccountingClassId: payload.je_credit_accounting_class_id ?? undefined,
|
|
385
|
+
jeCreditAccountingClassName: payload.je_credit_accounting_class_name ?? undefined,
|
|
386
|
+
transactionId: payload.transaction_id ?? undefined,
|
|
387
|
+
transactionIntegrationId: payload.transaction_integration_id ?? undefined,
|
|
388
|
+
reversalTransactionId: payload.reversal_transaction_id ?? undefined,
|
|
389
|
+
createdBy: toJEOneTimeAccrualCreator(payload.created_by_user),
|
|
390
|
+
};
|
|
391
|
+
}
|
|
392
|
+
// The accrual wire format carries a currency CODE but no symbol, so the symbol has to be derived.
|
|
393
|
+
// Only USD has a known glyph today (the create path is USD-only); anything else falls back to the
|
|
394
|
+
// code, which reads correctly as "EUR 1,200" rather than silently rendering a wrong "$".
|
|
395
|
+
function toOneTimeAccrualAmount(amount, currencyCode) {
|
|
396
|
+
const code = currencyCode ?? USD_CURRENCY_CODE;
|
|
397
|
+
return (0, amount_1.toAmount)(amount, code, code === USD_CURRENCY_CODE ? '$' : code);
|
|
398
|
+
}
|
|
399
|
+
function toJEOneTimeAccrualCreator(payload) {
|
|
400
|
+
if (payload == null) {
|
|
401
|
+
return undefined;
|
|
402
|
+
}
|
|
403
|
+
return {
|
|
404
|
+
userId: payload.user_id,
|
|
405
|
+
email: payload.email ?? undefined,
|
|
406
|
+
firstName: payload.first_name ?? undefined,
|
|
407
|
+
lastName: payload.last_name ?? undefined,
|
|
408
|
+
photo: payload.photo?.original != null
|
|
409
|
+
? (0, zeniUrl_1.toZeniUrl)(payload.photo.original)
|
|
410
|
+
: undefined,
|
|
411
|
+
};
|
|
412
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { UpdateType } from '../../commonStateTypes/common';
|
|
2
|
-
import { JEAccruedScheduledTransactionPayload, JEScheduledTransactionPayload, ScheduledJournalEntryPayload } from './jeSchedulesPayload';
|
|
2
|
+
import { JEAccruedScheduledTransactionPayload, JEOneTimeAccrualPayload, JEScheduledTransactionPayload, ScheduledJournalEntryPayload } from './jeSchedulesPayload';
|
|
3
3
|
import { JESchedulesState } from './jeSchedulesState';
|
|
4
4
|
export declare const initialState: JESchedulesState;
|
|
5
5
|
export declare const updateJESchedules: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[jeSchedulesTransactionsPayload: JEScheduledTransactionPayload[]], {
|
|
@@ -22,6 +22,8 @@ export declare const updateJESchedules: import("@reduxjs/toolkit").ActionCreator
|
|
|
22
22
|
jeScheduleTransactionKey: `${string}_bill_${string}` | `${string}_expense_${string}` | `${string}_check_${string}` | `${string}_refund_${string}` | `${string}_invoice_${string}` | `${string}_payment_${string}` | `${string}_credit_memo_${string}` | `${string}_sales_receipt_${string}` | `${string}_delayed_credit_${string}` | `${string}_delayed_charge_${string}` | `${string}_bill_payment_${string}` | `${string}_bill_payment_check_${string}` | `${string}_bill_payment_credit_card_${string}` | `${string}_vendor_credit_${string}` | `${string}_credit_card_credit_${string}` | `${string}_transfer_${string}` | `${string}_credit_card_payment_${string}` | `${string}_deposit_${string}` | `${string}_journal_entry_${string}`;
|
|
23
23
|
}, "jeSchedules/deleteJESchedulesDetails", never, never>, deleteAccruedJESchedulesDetails: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[JEScheduleKey: `${string}_${string}`], {
|
|
24
24
|
JEScheduleKey: `${string}_${string}`;
|
|
25
|
-
}, "jeSchedules/deleteAccruedJESchedulesDetails", never, never>, clearAllAccruedJESchedules: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"jeSchedules/clearAllAccruedJESchedules">, clearAllJEScheduleTransactions: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"jeSchedules/clearAllJEScheduleTransactions"
|
|
25
|
+
}, "jeSchedules/deleteAccruedJESchedulesDetails", never, never>, clearAllAccruedJESchedules: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"jeSchedules/clearAllAccruedJESchedules">, clearAllJEScheduleTransactions: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"jeSchedules/clearAllJEScheduleTransactions">, updateJEOneTimeAccruals: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[jeOneTimeAccrualsPayload: JEOneTimeAccrualPayload[]], {
|
|
26
|
+
jeOneTimeAccrualsPayload: JEOneTimeAccrualPayload[];
|
|
27
|
+
}, "jeSchedules/updateJEOneTimeAccruals", never, never>, clearAllJEOneTimeAccruals: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"jeSchedules/clearAllJEOneTimeAccruals">;
|
|
26
28
|
declare const _default: import("redux").Reducer<JESchedulesState>;
|
|
27
29
|
export default _default;
|
|
@@ -4,13 +4,15 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
var _a;
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.clearAllJEScheduleTransactions = exports.clearAllAccruedJESchedules = exports.deleteAccruedJESchedulesDetails = exports.deleteJESchedulesDetails = exports.updateAccruedJESchedulesDetails = exports.updateJESchedulesDetails = exports.updateAccruedJEScheduledTransaction = exports.updateJEScheduledTransaction = exports.updateAccruedJESchedules = exports.updateJESchedules = exports.initialState = void 0;
|
|
7
|
+
exports.clearAllJEOneTimeAccruals = exports.updateJEOneTimeAccruals = exports.clearAllJEScheduleTransactions = exports.clearAllAccruedJESchedules = exports.deleteAccruedJESchedulesDetails = exports.deleteJESchedulesDetails = exports.updateAccruedJESchedulesDetails = exports.updateJESchedulesDetails = exports.updateAccruedJEScheduledTransaction = exports.updateJEScheduledTransaction = exports.updateAccruedJESchedules = exports.updateJESchedules = exports.initialState = void 0;
|
|
8
8
|
const toolkit_1 = require("@reduxjs/toolkit");
|
|
9
9
|
const assignWith_1 = __importDefault(require("lodash/assignWith"));
|
|
10
|
+
const jeScheduleHelper_1 = require("./jeScheduleHelper");
|
|
10
11
|
const jeSchedulesPayload_1 = require("./jeSchedulesPayload");
|
|
11
12
|
exports.initialState = {
|
|
12
13
|
schedulesByTransactionKey: {},
|
|
13
14
|
schedulesByAccruedJEScheduleKey: {},
|
|
15
|
+
oneTimeAccrualsByKey: {},
|
|
14
16
|
};
|
|
15
17
|
const jeSchedules = (0, toolkit_1.createSlice)({
|
|
16
18
|
name: 'jeSchedules',
|
|
@@ -115,15 +117,37 @@ const jeSchedules = (0, toolkit_1.createSlice)({
|
|
|
115
117
|
delete draft.schedulesByAccruedJEScheduleKey[JEScheduleKey];
|
|
116
118
|
},
|
|
117
119
|
},
|
|
120
|
+
// Writes directly, unlike updateAccruedJESchedules / updateJESchedules, which are no-op
|
|
121
|
+
// actions whose only job is to trigger the entity fan-out epic that fetches vendors,
|
|
122
|
+
// accounts, classes and users. An accrual denormalizes all of those as names on the document,
|
|
123
|
+
// so there is nothing to fan out to.
|
|
124
|
+
updateJEOneTimeAccruals: {
|
|
125
|
+
prepare(jeOneTimeAccrualsPayload) {
|
|
126
|
+
return {
|
|
127
|
+
payload: {
|
|
128
|
+
jeOneTimeAccrualsPayload,
|
|
129
|
+
},
|
|
130
|
+
};
|
|
131
|
+
},
|
|
132
|
+
reducer(draft, action) {
|
|
133
|
+
action.payload.jeOneTimeAccrualsPayload.forEach((accrualPayload) => {
|
|
134
|
+
const accrual = (0, jeSchedulesPayload_1.toJEOneTimeAccrual)(accrualPayload);
|
|
135
|
+
draft.oneTimeAccrualsByKey[(0, jeScheduleHelper_1.generateJEOneTimeAccrualKey)(accrual.accrualId)] = accrual;
|
|
136
|
+
});
|
|
137
|
+
},
|
|
138
|
+
},
|
|
118
139
|
clearAllJEScheduleTransactions(draft) {
|
|
119
140
|
draft.schedulesByTransactionKey = {};
|
|
120
141
|
},
|
|
121
142
|
clearAllAccruedJESchedules(draft) {
|
|
122
143
|
draft.schedulesByAccruedJEScheduleKey = {};
|
|
123
144
|
},
|
|
145
|
+
clearAllJEOneTimeAccruals(draft) {
|
|
146
|
+
draft.oneTimeAccrualsByKey = {};
|
|
147
|
+
},
|
|
124
148
|
},
|
|
125
149
|
});
|
|
126
|
-
_a = jeSchedules.actions, exports.updateJESchedules = _a.updateJESchedules, exports.updateAccruedJESchedules = _a.updateAccruedJESchedules, exports.updateJEScheduledTransaction = _a.updateJEScheduledTransaction, exports.updateAccruedJEScheduledTransaction = _a.updateAccruedJEScheduledTransaction, exports.updateJESchedulesDetails = _a.updateJESchedulesDetails, exports.updateAccruedJESchedulesDetails = _a.updateAccruedJESchedulesDetails, exports.deleteJESchedulesDetails = _a.deleteJESchedulesDetails, exports.deleteAccruedJESchedulesDetails = _a.deleteAccruedJESchedulesDetails, exports.clearAllAccruedJESchedules = _a.clearAllAccruedJESchedules, exports.clearAllJEScheduleTransactions = _a.clearAllJEScheduleTransactions;
|
|
150
|
+
_a = jeSchedules.actions, exports.updateJESchedules = _a.updateJESchedules, exports.updateAccruedJESchedules = _a.updateAccruedJESchedules, exports.updateJEScheduledTransaction = _a.updateJEScheduledTransaction, exports.updateAccruedJEScheduledTransaction = _a.updateAccruedJEScheduledTransaction, exports.updateJESchedulesDetails = _a.updateJESchedulesDetails, exports.updateAccruedJESchedulesDetails = _a.updateAccruedJESchedulesDetails, exports.deleteJESchedulesDetails = _a.deleteJESchedulesDetails, exports.deleteAccruedJESchedulesDetails = _a.deleteAccruedJESchedulesDetails, exports.clearAllAccruedJESchedules = _a.clearAllAccruedJESchedules, exports.clearAllJEScheduleTransactions = _a.clearAllJEScheduleTransactions, exports.updateJEOneTimeAccruals = _a.updateJEOneTimeAccruals, exports.clearAllJEOneTimeAccruals = _a.clearAllJEOneTimeAccruals;
|
|
127
151
|
exports.default = jeSchedules.reducer;
|
|
128
152
|
/**
|
|
129
153
|
* Helper functions
|
|
@@ -9,8 +9,8 @@ import { ScheduleTransaction } from '../transaction/stateTypes/scheduleTransacti
|
|
|
9
9
|
import { TransactionID } from '../transaction/stateTypes/transaction';
|
|
10
10
|
import { User } from '../user/userState';
|
|
11
11
|
import { Vendor } from '../vendor/vendorState';
|
|
12
|
-
import { JEScheduleAISummaries, JEScheduleOtherAttributes, JEScheduleRecommendations, ScheduleJournalStatusCode, ScheduleStatus } from './jeSchedulesState';
|
|
13
|
-
import { JEScheduleKey, JEScheduleTransactionKey, JournalEntryErrorCodeType, ScheduleTypes } from './jeSchedulesTypes';
|
|
12
|
+
import { JEOneTimeAccrualState, JEScheduleAISummaries, JEScheduleOtherAttributes, JEScheduleRecommendations, JESchedulesState, ScheduleJournalStatusCode, ScheduleStatus } from './jeSchedulesState';
|
|
13
|
+
import { JEOneTimeAccrualKey, JEScheduleKey, JEScheduleTransactionKey, JournalEntryErrorCodeType, ScheduleTypes } from './jeSchedulesTypes';
|
|
14
14
|
export interface ScheduledJournalEntry {
|
|
15
15
|
error: JournalEntryErrorCodeType[];
|
|
16
16
|
expectedPostDate: ZeniDate;
|
|
@@ -77,5 +77,9 @@ export interface JEScheduledTransaction {
|
|
|
77
77
|
updatedAt?: ZeniDate;
|
|
78
78
|
updatedByUser?: User;
|
|
79
79
|
}
|
|
80
|
+
export interface JEOneTimeAccrual extends JEOneTimeAccrualState {
|
|
81
|
+
jeOneTimeAccrualKey: JEOneTimeAccrualKey;
|
|
82
|
+
}
|
|
83
|
+
export declare const getJEOneTimeAccrualByKey: (jeOneTimeAccrualKey: JEOneTimeAccrualKey, jeSchedulesState: JESchedulesState) => JEOneTimeAccrual | undefined;
|
|
80
84
|
export declare const getJEAccruedScheduleByJEScheduleKey: (JEScheduleKey: JEScheduleKey, state: RootState) => JEAccruedSchedule | undefined;
|
|
81
85
|
export declare const getJEScheduledTransactionByJEScheduleTransactionKey: (jeScheduleTransactionKey: JEScheduleTransactionKey, state: RootState) => JEScheduledTransaction;
|
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.getJEScheduledTransactionByJEScheduleTransactionKey = exports.getJEAccruedScheduleByJEScheduleKey = void 0;
|
|
6
|
+
exports.getJEScheduledTransactionByJEScheduleTransactionKey = exports.getJEAccruedScheduleByJEScheduleKey = exports.getJEOneTimeAccrualByKey = void 0;
|
|
7
7
|
const get_1 = __importDefault(require("lodash/get"));
|
|
8
8
|
const amount_1 = require("../../commonStateTypes/amount");
|
|
9
9
|
const accountSelector_1 = require("../account/accountSelector");
|
|
@@ -11,6 +11,20 @@ const classSelector_1 = require("../class/classSelector");
|
|
|
11
11
|
const transactionSelector_1 = require("../transaction/transactionSelector");
|
|
12
12
|
const userSelector_1 = require("../user/userSelector");
|
|
13
13
|
const vendorSelector_1 = require("../vendor/vendorSelector");
|
|
14
|
+
// Takes the slice, not RootState: an accrual denormalizes its vendor, account and class names, so
|
|
15
|
+
// unlike getJEAccruedScheduleByJEScheduleKey this joins nothing.
|
|
16
|
+
//
|
|
17
|
+
// Spreads the stored entity rather than rebuilding it field by field. That is deliberate — the
|
|
18
|
+
// accrued joiner listed every field explicitly and silently dropped jeScheduleType, which made a
|
|
19
|
+
// whole tab render empty while its reducer test still passed. A spread cannot lose a field.
|
|
20
|
+
const getJEOneTimeAccrualByKey = (jeOneTimeAccrualKey, jeSchedulesState) => {
|
|
21
|
+
const accrual = (0, get_1.default)(jeSchedulesState.oneTimeAccrualsByKey, jeOneTimeAccrualKey);
|
|
22
|
+
if (accrual == null) {
|
|
23
|
+
return undefined;
|
|
24
|
+
}
|
|
25
|
+
return { ...accrual, jeOneTimeAccrualKey };
|
|
26
|
+
};
|
|
27
|
+
exports.getJEOneTimeAccrualByKey = getJEOneTimeAccrualByKey;
|
|
14
28
|
const getJEAccruedScheduleByJEScheduleKey = (JEScheduleKey, state) => {
|
|
15
29
|
const { jeSchedulesState, vendorState, accountState, userState, classState } = state;
|
|
16
30
|
const JEAccruedScheduleState = (0, get_1.default)(jeSchedulesState.schedulesByAccruedJEScheduleKey, JEScheduleKey);
|
|
@@ -2,8 +2,9 @@ import { Amount } from '../../commonStateTypes/amount';
|
|
|
2
2
|
import { ID } from '../../commonStateTypes/common';
|
|
3
3
|
import { ScheduleDaysOfMonth } from '../../commonStateTypes/timePeriod';
|
|
4
4
|
import { ZeniDate } from '../../zeniDayJS';
|
|
5
|
+
import { ZeniUrl as Url } from '../../zeniUrl';
|
|
5
6
|
import { TransactionID } from '../transaction/stateTypes/transaction';
|
|
6
|
-
import { JEScheduleKey, JEScheduleTransactionKey, JournalEntryErrorCodeType, ScheduleJournalEntryStatusCodeType, ScheduleStatusCodeType, ScheduleTypes } from './jeSchedulesTypes';
|
|
7
|
+
import { JEOneTimeAccrualKey, JEScheduleKey, JEScheduleTransactionKey, JournalEntryErrorCodeType, OneTimeAccrualAutomationTierType, OneTimeAccrualOriginType, OneTimeAccrualReversalPolicyType, OneTimeAccrualReversalTriggerType, OneTimeAccrualStatusCodeType, ScheduleJournalEntryStatusCodeType, ScheduleStatusCodeType, ScheduleTypes } from './jeSchedulesTypes';
|
|
7
8
|
export interface ScheduleStatus {
|
|
8
9
|
code: ScheduleStatusCodeType;
|
|
9
10
|
label: string;
|
|
@@ -114,7 +115,44 @@ export interface JEAccruedScheduledTransactionState extends Omit<JEScheduledTran
|
|
|
114
115
|
memo: string;
|
|
115
116
|
recurringAmount: Amount;
|
|
116
117
|
}
|
|
118
|
+
export interface JEOneTimeAccrualCreator {
|
|
119
|
+
userId: ID;
|
|
120
|
+
email?: string;
|
|
121
|
+
firstName?: string;
|
|
122
|
+
lastName?: string;
|
|
123
|
+
photo?: Url;
|
|
124
|
+
}
|
|
125
|
+
export interface JEOneTimeAccrualState {
|
|
126
|
+
accrualId: ID;
|
|
127
|
+
accrualStatus: OneTimeAccrualStatusCodeType;
|
|
128
|
+
estimatedAmount: Amount;
|
|
129
|
+
memo: string;
|
|
130
|
+
origin: OneTimeAccrualOriginType;
|
|
131
|
+
reversalPolicy: OneTimeAccrualReversalPolicyType;
|
|
132
|
+
serviceMonth: string;
|
|
133
|
+
vendorId: ID;
|
|
134
|
+
vendorName: string;
|
|
135
|
+
actualPostDate?: ZeniDate;
|
|
136
|
+
actualReversalPostDate?: ZeniDate;
|
|
137
|
+
automationTier?: OneTimeAccrualAutomationTierType;
|
|
138
|
+
createdBy?: JEOneTimeAccrualCreator;
|
|
139
|
+
expectedReversalDate?: ZeniDate;
|
|
140
|
+
jeCreditAccountId?: ID;
|
|
141
|
+
jeCreditAccountingClassId?: ID;
|
|
142
|
+
jeCreditAccountingClassName?: string;
|
|
143
|
+
jeCreditAccountName?: string;
|
|
144
|
+
jeDebitAccountId?: ID;
|
|
145
|
+
jeDebitAccountingClassId?: ID;
|
|
146
|
+
jeDebitAccountingClassName?: string;
|
|
147
|
+
jeDebitAccountName?: string;
|
|
148
|
+
postingDate?: ZeniDate;
|
|
149
|
+
reversalTransactionId?: ID;
|
|
150
|
+
reversalTrigger?: OneTimeAccrualReversalTriggerType;
|
|
151
|
+
transactionId?: ID;
|
|
152
|
+
transactionIntegrationId?: ID;
|
|
153
|
+
}
|
|
117
154
|
export interface JESchedulesState {
|
|
155
|
+
oneTimeAccrualsByKey: Record<JEOneTimeAccrualKey, JEOneTimeAccrualState>;
|
|
118
156
|
schedulesByAccruedJEScheduleKey: Record<JEScheduleKey, JEAccruedScheduledTransactionState>;
|
|
119
157
|
schedulesByTransactionKey: Record<JEScheduleTransactionKey, JEScheduledTransactionState>;
|
|
120
158
|
}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { TransactionID } from '../transaction/stateTypes/transaction';
|
|
2
|
-
import { generateJEScheduleKey } from './jeScheduleHelper';
|
|
2
|
+
import { generateJEOneTimeAccrualKey, generateJEScheduleKey } from './jeScheduleHelper';
|
|
3
3
|
export interface ScheduleTransactionID extends TransactionID {
|
|
4
4
|
lineId: string;
|
|
5
5
|
}
|
|
6
6
|
export declare const getJEScheduleTransactionKey: (scheduleTransactionId: ScheduleTransactionID) => `${string}_bill_${string}` | `${string}_expense_${string}` | `${string}_check_${string}` | `${string}_refund_${string}` | `${string}_invoice_${string}` | `${string}_payment_${string}` | `${string}_credit_memo_${string}` | `${string}_sales_receipt_${string}` | `${string}_delayed_credit_${string}` | `${string}_delayed_charge_${string}` | `${string}_bill_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}`;
|
|
7
7
|
export type JEScheduleTransactionKey = ReturnType<typeof getJEScheduleTransactionKey>;
|
|
8
8
|
export type JEScheduleKey = ReturnType<typeof generateJEScheduleKey>;
|
|
9
|
+
export type JEOneTimeAccrualKey = ReturnType<typeof generateJEOneTimeAccrualKey>;
|
|
9
10
|
export declare const ALL_SCHEDULES_TYPES: readonly ["prepaid_expenses", "fixed_assets", "accrued_expenses", "deferred_revenue"];
|
|
10
11
|
export declare const toScheduleTypesType: (v: string) => "prepaid_expenses" | "fixed_assets" | "accrued_expenses" | "deferred_revenue";
|
|
11
12
|
export type ScheduleTypes = ReturnType<typeof toScheduleTypesType>;
|
|
@@ -14,5 +15,15 @@ export declare const toScheduleJournalEntryStatusCodeType: (v: string) => "pendi
|
|
|
14
15
|
export type ScheduleJournalEntryStatusCodeType = ReturnType<typeof toScheduleJournalEntryStatusCodeType>;
|
|
15
16
|
export declare const toScheduleStatusCodeType: (v: string) => "completed" | "draft" | "new" | "ongoing" | "marked_as_completed";
|
|
16
17
|
export type ScheduleStatusCodeType = ReturnType<typeof toScheduleStatusCodeType>;
|
|
18
|
+
export declare const toOneTimeAccrualStatusCodeType: (v: string) => "draft" | "posted" | "posting" | "posting_blocked" | "reversing" | "reversed";
|
|
19
|
+
export type OneTimeAccrualStatusCodeType = ReturnType<typeof toOneTimeAccrualStatusCodeType>;
|
|
20
|
+
export declare const toOneTimeAccrualOriginType: (v: string) => "agent" | "human";
|
|
21
|
+
export type OneTimeAccrualOriginType = ReturnType<typeof toOneTimeAccrualOriginType>;
|
|
22
|
+
export declare const toOneTimeAccrualAutomationTierType: (v: string) => "auto" | "draft" | "manual";
|
|
23
|
+
export type OneTimeAccrualAutomationTierType = ReturnType<typeof toOneTimeAccrualAutomationTierType>;
|
|
24
|
+
export declare const toOneTimeAccrualReversalPolicyType: (v: string) => "on_bill_match" | "scheduled_date";
|
|
25
|
+
export type OneTimeAccrualReversalPolicyType = ReturnType<typeof toOneTimeAccrualReversalPolicyType>;
|
|
26
|
+
export declare const toOneTimeAccrualReversalTriggerType: (v?: string) => "scheduled_date" | "bill_match" | "manual_reverse" | undefined;
|
|
27
|
+
export type OneTimeAccrualReversalTriggerType = ReturnType<typeof toOneTimeAccrualReversalTriggerType>;
|
|
17
28
|
export declare const toJournalEntryErrorCodeType: (v: string) => "vendor_deleted" | "debit_category_deleted" | "credit_category_deleted" | "qbo_error" | "qbo_authorization_error" | "qbo_invalid_company_status_error" | "qbo_book_close_date_error";
|
|
18
29
|
export type JournalEntryErrorCodeType = ReturnType<typeof toJournalEntryErrorCodeType>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.toJournalEntryErrorCodeType = exports.toScheduleStatusCodeType = exports.toScheduleJournalEntryStatusCodeType = exports.toScheduleTypesTypeStrict = exports.toScheduleTypesType = exports.ALL_SCHEDULES_TYPES = exports.getJEScheduleTransactionKey = void 0;
|
|
3
|
+
exports.toJournalEntryErrorCodeType = exports.toOneTimeAccrualReversalTriggerType = exports.toOneTimeAccrualReversalPolicyType = exports.toOneTimeAccrualAutomationTierType = exports.toOneTimeAccrualOriginType = exports.toOneTimeAccrualStatusCodeType = exports.toScheduleStatusCodeType = exports.toScheduleJournalEntryStatusCodeType = exports.toScheduleTypesTypeStrict = exports.toScheduleTypesType = exports.ALL_SCHEDULES_TYPES = exports.getJEScheduleTransactionKey = void 0;
|
|
4
4
|
const stringToUnion_1 = require("../../commonStateTypes/stringToUnion");
|
|
5
5
|
const getJEScheduleTransactionKey = (scheduleTransactionId) => `${scheduleTransactionId.id}_${scheduleTransactionId.type}_${scheduleTransactionId.lineId}`;
|
|
6
6
|
exports.getJEScheduleTransactionKey = getJEScheduleTransactionKey;
|
|
@@ -32,6 +32,45 @@ const SCHEDULE_STATUS_CODE = [
|
|
|
32
32
|
];
|
|
33
33
|
const toScheduleStatusCodeType = (v) => (0, stringToUnion_1.stringToUnion)(v, SCHEDULE_STATUS_CODE);
|
|
34
34
|
exports.toScheduleStatusCodeType = toScheduleStatusCodeType;
|
|
35
|
+
// One-time accruals come from agent-je's Mongo `accruals` collection, not the JE schedule
|
|
36
|
+
// datastore, so they carry their own status vocabulary rather than SCHEDULE_STATUS_CODE.
|
|
37
|
+
// `posting` and `reversing` are transient claims held while a JE posts.
|
|
38
|
+
const ONE_TIME_ACCRUAL_STATUS_CODE = [
|
|
39
|
+
'draft',
|
|
40
|
+
'posting',
|
|
41
|
+
'posted',
|
|
42
|
+
'posting_blocked',
|
|
43
|
+
'reversing',
|
|
44
|
+
'reversed',
|
|
45
|
+
];
|
|
46
|
+
const toOneTimeAccrualStatusCodeType = (v) => (0, stringToUnion_1.stringToUnion)(v, ONE_TIME_ACCRUAL_STATUS_CODE);
|
|
47
|
+
exports.toOneTimeAccrualStatusCodeType = toOneTimeAccrualStatusCodeType;
|
|
48
|
+
// Who created the accrual. This — not the creator's email — is the authoritative
|
|
49
|
+
// AI-vs-manual signal for the Method column.
|
|
50
|
+
const ONE_TIME_ACCRUAL_ORIGIN = ['agent', 'human'];
|
|
51
|
+
const toOneTimeAccrualOriginType = (v) => (0, stringToUnion_1.stringToUnion)(v, ONE_TIME_ACCRUAL_ORIGIN);
|
|
52
|
+
exports.toOneTimeAccrualOriginType = toOneTimeAccrualOriginType;
|
|
53
|
+
const ONE_TIME_ACCRUAL_AUTOMATION_TIER = ['manual', 'draft', 'auto'];
|
|
54
|
+
const toOneTimeAccrualAutomationTierType = (v) => (0, stringToUnion_1.stringToUnion)(v, ONE_TIME_ACCRUAL_AUTOMATION_TIER);
|
|
55
|
+
exports.toOneTimeAccrualAutomationTierType = toOneTimeAccrualAutomationTierType;
|
|
56
|
+
// How the accrual is allowed to reverse. The two are exclusive: a scheduled row reverses on
|
|
57
|
+
// expectedReversalDate and bills never drive it; an on_bill_match row reverses only when a bill
|
|
58
|
+
// is matched, which is why its lifecycle reads "Reverses on match" rather than showing a date.
|
|
59
|
+
const ONE_TIME_ACCRUAL_REVERSAL_POLICY = [
|
|
60
|
+
'on_bill_match',
|
|
61
|
+
'scheduled_date',
|
|
62
|
+
];
|
|
63
|
+
const toOneTimeAccrualReversalPolicyType = (v) => (0, stringToUnion_1.stringToUnion)(v, ONE_TIME_ACCRUAL_REVERSAL_POLICY);
|
|
64
|
+
exports.toOneTimeAccrualReversalPolicyType = toOneTimeAccrualReversalPolicyType;
|
|
65
|
+
// What actually caused a reverse. Distinct from a *revert*, which soft-deletes the row and
|
|
66
|
+
// never sets this.
|
|
67
|
+
const ONE_TIME_ACCRUAL_REVERSAL_TRIGGER = [
|
|
68
|
+
'bill_match',
|
|
69
|
+
'scheduled_date',
|
|
70
|
+
'manual_reverse',
|
|
71
|
+
];
|
|
72
|
+
const toOneTimeAccrualReversalTriggerType = (v) => (0, stringToUnion_1.stringToUnionStrict)(v ?? '', ONE_TIME_ACCRUAL_REVERSAL_TRIGGER);
|
|
73
|
+
exports.toOneTimeAccrualReversalTriggerType = toOneTimeAccrualReversalTriggerType;
|
|
35
74
|
const JOURNAL_ENTRY_ERROR_CODE = [
|
|
36
75
|
'vendor_deleted',
|
|
37
76
|
'debit_category_deleted',
|
|
@@ -242,7 +242,7 @@ import { clearAllInvoicingSubscriptions } from '../invoicing/invoicingSubscripti
|
|
|
242
242
|
import { clearAllInvoicingTransactions } from '../invoicing/invoicingTransaction/invoicingTransactionReducer';
|
|
243
243
|
import { clearAllInvoicingPlans } from '../invoicing/plan/planReducer';
|
|
244
244
|
import { clearAllInvoicingProducts } from '../invoicing/product/productReducer';
|
|
245
|
-
import { clearAllAccruedJESchedules, clearAllJEScheduleTransactions } from '../jeSchedules/jeSchedulesReducer';
|
|
245
|
+
import { clearAllAccruedJESchedules, clearAllJEOneTimeAccruals, clearAllJEScheduleTransactions } from '../jeSchedules/jeSchedulesReducer';
|
|
246
246
|
import { clearAllMerchants } from '../merchant/merchantReducer';
|
|
247
247
|
import { clearAllOnboardingCustomersInfo } from '../onboardingCustomer/onboardingCustomerReducer';
|
|
248
248
|
import { clearAllPaymentAccounts } from '../paymentAccount/paymentAccountReducer';
|
|
@@ -268,7 +268,7 @@ import { clearAllVendors } from '../vendor/vendorReducer';
|
|
|
268
268
|
import { clearAllVendorExpenseTrends } from '../vendorExpense/vendorExpenseReducer';
|
|
269
269
|
import { clearAll } from './tenantReducer';
|
|
270
270
|
type clearActionTypeForViews = ReturnType<typeof clearAccountList> | ReturnType<typeof clearAccountMappingView> | ReturnType<typeof clearActivityHistory> | ReturnType<typeof clearActivityRealTimeApproval> | ReturnType<typeof clearAddressView> | ReturnType<typeof clearAiAccountantView> | ReturnType<typeof clearAllAiAccountantCustomers> | ReturnType<typeof clearAiCfoView> | ReturnType<typeof clearAllClasses> | ReturnType<typeof clearAllProjects> | ReturnType<typeof clearAllMonthEndCloseChecksView> | ReturnType<typeof clearApAging> | ReturnType<typeof clearApAgingDetail> | ReturnType<typeof clearArAging> | ReturnType<typeof clearArAgingDetail> | ReturnType<typeof clearAuthenticationView> | ReturnType<typeof clearAutoTransferRules> | ReturnType<typeof clearBalanceSheet> | ReturnType<typeof clearBankAccountView> | ReturnType<typeof clearBillDetailView> | ReturnType<typeof clearBillList> | ReturnType<typeof clearBillPayBulkActionView> | ReturnType<typeof clearBillPayCard> | ReturnType<typeof clearBillPayConfig> | ReturnType<typeof clearBillPayReview> | ReturnType<typeof clearBillPaySetupApproverView> | ReturnType<typeof clearBillPaySetupView> | ReturnType<typeof clearCardBalance> | ReturnType<typeof clearCardPaymentView> | ReturnType<typeof clearCardPolicyDetail> | ReturnType<typeof clearCardPolicyList> | ReturnType<typeof clearCardUserOnboarding> | ReturnType<typeof clearCashbackDetail> | ReturnType<typeof clearCashBalance> | ReturnType<typeof clearCashFlow> | ReturnType<typeof clearCashInCashOut> | ReturnType<typeof clearCashPosition> | ReturnType<typeof clearChargeCardConfig> | ReturnType<typeof clearChargeCardDetail> | ReturnType<typeof clearChargeCardList> | ReturnType<typeof clearChargeCardRepaymentDetail> | ReturnType<typeof clearChargeCardSetupView> | ReturnType<typeof clearChargeCardStatementList> | ReturnType<typeof clearCheckDeposit> | ReturnType<typeof clearCompanyConfigView> | ReturnType<typeof clearCompanyHealthMetric> | ReturnType<typeof clearCompanyHealthMetricView> | ReturnType<typeof clearCompanyMonthEndReportView> | ReturnType<typeof clearCompanyTaskManagerView> | ReturnType<typeof clearCompanyView> | ReturnType<typeof clearCreateCardPolicy> | ReturnType<typeof clearCreateTransferEntry> | ReturnType<typeof clearAllCreditAgent> | ReturnType<typeof clearCreditAgentView> | ReturnType<typeof clearDashboard> | ReturnType<typeof clearDashboardLayout> | ReturnType<typeof clearDepositAccountDetail> | ReturnType<typeof clearDepositAccountList> | ReturnType<typeof clearDepositAccountTransactionList> | ReturnType<typeof clearEditBillViewDetail> | ReturnType<typeof clearEditRemiViewDetail> | ReturnType<typeof clearAllEntityAutoCompleteResults> | ReturnType<typeof clearExpenseAutomationFluxAnalysisView> | ReturnType<typeof clearExpenseAutomationJESchedulesView> | ReturnType<typeof clearExpenseAutomationMissingReceiptsView> | ReturnType<typeof clearExpenseAutomationReconciliationView> | ReturnType<typeof clearExpenseAutomationTransactionsView> | ReturnType<typeof clearExpenseAutomationView> | ReturnType<typeof clearExpressPayView> | ReturnType<typeof clearFeatureNotificationView> | ReturnType<typeof clearFileViewList> | ReturnType<typeof clearFinanceStatement> | ReturnType<typeof clearForecastList> | ReturnType<typeof clearGlobalMerchantAutoCompleteResults> | ReturnType<typeof clearGlobalMerchantView> | ReturnType<typeof clearInsightsCard> | ReturnType<typeof clearInternationalWire> | ReturnType<typeof clearInternationalVerificationView> | ReturnType<typeof clearAllInvoiceDetail> | ReturnType<typeof clearInvoiceList> | ReturnType<typeof resetCreateInvoice> | ReturnType<typeof resetRecordPayment> | ReturnType<typeof resetIssueCreditNote> | ReturnType<typeof resetCreateCreditNote> | ReturnType<typeof clearInvoicingOverview> | ReturnType<typeof clearInvoicingAuditView> | ReturnType<typeof resetEditInvoicingCatalogItemDetailView> | ReturnType<typeof resetEditInvoicingCouponDetailView> | ReturnType<typeof clearInvoicingCouponDetailView> | ReturnType<typeof resetEditInvoicingCustomerDetailView> | ReturnType<typeof resetEditInvoicingSubscriptionDetailView> | ReturnType<typeof clearAllInvoicingCatalogActions> | ReturnType<typeof clearAllInvoicingDataImportActions> | ReturnType<typeof clearInvoicingDataImportView> | ReturnType<typeof clearAllInvoicingDiscountActions> | ReturnType<typeof clearAllInvoicingInvoiceActions> | ReturnType<typeof clearAllInvoicingSubscriptionActions> | ReturnType<typeof clearAllInvoicingDunningActions> | ReturnType<typeof clearAllInvoicingPaymentActions> | ReturnType<typeof resetSaveInvoicingSettings> | ReturnType<typeof clearInvoicingCatalogItemDetailView> | ReturnType<typeof clearInvoicingCatalogListView> | ReturnType<typeof clearInvoicingCouponView> | ReturnType<typeof clearInvoicingCreditNoteDetailView> | ReturnType<typeof clearInvoicingCreditNoteListView> | ReturnType<typeof clearInvoicingCustomerDetailView> | ReturnType<typeof clearInvoicingCustomerListView> | ReturnType<typeof resetInvoicingCustomerPaymentMethod> | ReturnType<typeof resetPromotionalCreditAction> | ReturnType<typeof clearInvoicingDunningCaseDetailView> | ReturnType<typeof clearInvoicingDunningCaseListView> | ReturnType<typeof clearInvoicingConfig> | ReturnType<typeof clearInvoicingQboView> | ReturnType<typeof clearInvoicingSettings> | ReturnType<typeof clearInvoicingSubscriptionDetailView> | ReturnType<typeof clearInvoicingSubscriptionListView> | ReturnType<typeof clearInvoicingTransactionDetailView> | ReturnType<typeof clearInvoicingTransactionListView> | ReturnType<typeof clearIssueChargeCard> | ReturnType<typeof clearMerchantList> | ReturnType<typeof clearNetBurnOrIncome> | ReturnType<typeof clearNetBurnOrIncomeClassesView> | ReturnType<typeof clearNetBurnOrIncomeProjectView> | ReturnType<typeof clearNetBurnOrIncomeStoryCard> | ReturnType<typeof clearNotificationView> | ReturnType<typeof clearOnboardingCockpitView> | ReturnType<typeof clearOnboardingCustomerView> | ReturnType<typeof clearOpEx> | ReturnType<typeof clearOpExByVendor> | ReturnType<typeof clearOpExClassesView> | ReturnType<typeof clearOpExProjectView> | ReturnType<typeof clearOwnerList> | ReturnType<typeof clearPaymentAccountList> | ReturnType<typeof clearPeople> | ReturnType<typeof clearAggregatedReport> | ReturnType<typeof clearPreviousBills> | ReturnType<typeof clearProfitAndLoss> | ReturnType<typeof clearProfitAndLossClassesView> | ReturnType<typeof clearProfitAndLossProjectView> | ReturnType<typeof clearProjectList> | ReturnType<typeof clearRecommendation> | ReturnType<typeof clearReferrals> | ReturnType<typeof clearReimbursementCard> | ReturnType<typeof clearReimbursementConfig> | ReturnType<typeof clearRemiBulkActionView> | ReturnType<typeof clearRemiDetailView> | ReturnType<typeof clearRemiList> | ReturnType<typeof clearRemiSetupApproverView> | ReturnType<typeof clearRemiSetupView> | ReturnType<typeof clearReportUIOption> | ReturnType<typeof clearRevenue> | ReturnType<typeof clearRevenueClassesView> | ReturnType<typeof clearRevenueProjectView> | ReturnType<typeof clearReviewCompany> | ReturnType<typeof clearScheduleDetailView> | ReturnType<typeof clearScheduleAccruedDetailView> | ReturnType<typeof clearScheduleList> | ReturnType<typeof clearSettingsView> | ReturnType<typeof clearSetupView> | ReturnType<typeof clearPlaidAccountView> | ReturnType<typeof clearSubscriptionView> | ReturnType<typeof clearTagView> | ReturnType<typeof clearTaskDetail> | ReturnType<typeof clearTaskGroupTemplatesView> | ReturnType<typeof clearTaskGroupView> | ReturnType<typeof clearTaskList> | ReturnType<typeof clearTasksCard> | ReturnType<typeof clearTopEx> | ReturnType<typeof clearTransactionDetail> | ReturnType<typeof clearTransactionList> | ReturnType<typeof clearTransferDetail> | ReturnType<typeof clearTreasuryOverviewDetail> | ReturnType<typeof clearTreasurySetupView> | ReturnType<typeof clearTreasuryStatementList> | ReturnType<typeof clearTreasuryTaxLetterList> | ReturnType<typeof clearTreasuryTransferMoney> | ReturnType<typeof clearTrendData> | ReturnType<typeof clearTrendWithTransactions> | ReturnType<typeof clearTwoFactorAuthentication> | ReturnType<typeof clearUserFinancialAccount> | ReturnType<typeof clearUserListView> | ReturnType<typeof clearUserRoleConfigView> | ReturnType<typeof clearVendorGlobalReviewView> | ReturnType<typeof clearVendorReviewView> | ReturnType<typeof clearVendorTypeList> | ReturnType<typeof clearVendor1099TypeList> | ReturnType<typeof clearVendorView> | ReturnType<typeof clearVendorsFiling1099List> | ReturnType<typeof clearVendorsList> | ReturnType<typeof clearVendorsTabVendorView> | ReturnType<typeof clearWiseRedirectStatus> | ReturnType<typeof clearZeniAccStatementList> | ReturnType<typeof clearZeniAccountList> | ReturnType<typeof clearZeniAccountSetupView> | ReturnType<typeof clearZeniAccountsConfig> | ReturnType<typeof clearZeniAccountsPromoCard> | ReturnType<typeof clearZeniOAuthView>;
|
|
271
|
-
type clearActionTypeForEntities = ReturnType<typeof clearAiCfo> | ReturnType<typeof clearAllAccountGroups> | ReturnType<typeof clearAllAccountRecon> | ReturnType<typeof clearAllAccountingSummary> | ReturnType<typeof clearAllAccounts> | ReturnType<typeof clearAllAddresses> | ReturnType<typeof clearAllApprovalRules> | ReturnType<typeof clearAllBankAccounts> | ReturnType<typeof clearAllBillTransactions> | ReturnType<typeof clearAllCardPayments> | ReturnType<typeof clearAllChargeCardRepayments> | ReturnType<typeof clearAllChargeCardTransactions> | ReturnType<typeof clearAllChargeCards> | ReturnType<typeof clearAllCompanies> | ReturnType<typeof clearAllConnectedAccounts> | ReturnType<typeof clearAllCurrencies> | ReturnType<typeof clearAllCustomerIncomeTrend> | ReturnType<typeof clearAllCustomers> | ReturnType<typeof clearAllDepositAccounts> | ReturnType<typeof clearAllEntities> | ReturnType<typeof clearAllEntityApprovalStatus> | ReturnType<typeof clearAllFiles> | ReturnType<typeof clearAllForecasts> | ReturnType<typeof clearAllGlobalMerchants> | ReturnType<typeof clearAllInsights> | ReturnType<typeof clearAllInvoices> | ReturnType<typeof clearAllInvoicingCoupons> | ReturnType<typeof clearAllInvoicingCreditNotes> | ReturnType<typeof clearAllInvoicingCustomers> | ReturnType<typeof clearAllInvoicingDunningCases> | ReturnType<typeof clearAllInvoicingPlans> | ReturnType<typeof clearAllInvoicingProducts> | ReturnType<typeof clearAllInvoicingSubscriptions> | ReturnType<typeof clearAllInvoicingTransactions> | ReturnType<typeof clearAllAccruedJESchedules> | ReturnType<typeof clearAllJEScheduleTransactions> | ReturnType<typeof clearAllMerchants> | ReturnType<typeof clearAllMonthEndCloseChecks> | ReturnType<typeof clearAllNotificationPreferencesView> | ReturnType<typeof clearAllNotificationRegistry> | ReturnType<typeof clearAllNotifications> | ReturnType<typeof clearAllOnboardingCustomersInfo> | ReturnType<typeof clearAllPaymentAccounts> | ReturnType<typeof clearAllPaymentInstruments> | ReturnType<typeof clearAllRecurringBills> | ReturnType<typeof clearAllReimbursements> | ReturnType<typeof clearAllSectionsAccountsView> | ReturnType<typeof clearAllSectionsClassesViewV2> | ReturnType<typeof clearAllSectionsProjectView> | ReturnType<typeof clearAllSubscriptionAddOns> | ReturnType<typeof clearAllSubscriptionCoupons> | ReturnType<typeof clearAllSubscriptionPlans> | ReturnType<typeof clearAllSubscriptionSummary> | ReturnType<typeof clearAllSubscriptions> | ReturnType<typeof clearAllTags> | ReturnType<typeof clearAllTaskGroups> | ReturnType<typeof clearAllTaskGroupTemplates> | ReturnType<typeof clearAllTaskSummary> | ReturnType<typeof clearAllTasks> | ReturnType<typeof clearAllToastNotifications> | ReturnType<typeof clearAllTransactions> | ReturnType<typeof clearAllUserRoles> | ReturnType<typeof clearAllUsers> | ReturnType<typeof clearAllVendorExpenseTrends> | ReturnType<typeof clearAllVendors> | ReturnType<typeof clearCannedResponses> | ReturnType<typeof clearCardPolicy> | ReturnType<typeof clearClassList> | ReturnType<typeof clearContacts> | ReturnType<typeof clearCountryList> | ReturnType<typeof clearDepositAccountTransaction> | ReturnType<typeof clearSnackbar>;
|
|
271
|
+
type clearActionTypeForEntities = ReturnType<typeof clearAiCfo> | ReturnType<typeof clearAllAccountGroups> | ReturnType<typeof clearAllAccountRecon> | ReturnType<typeof clearAllAccountingSummary> | ReturnType<typeof clearAllAccounts> | ReturnType<typeof clearAllAddresses> | ReturnType<typeof clearAllApprovalRules> | ReturnType<typeof clearAllBankAccounts> | ReturnType<typeof clearAllBillTransactions> | ReturnType<typeof clearAllCardPayments> | ReturnType<typeof clearAllChargeCardRepayments> | ReturnType<typeof clearAllChargeCardTransactions> | ReturnType<typeof clearAllChargeCards> | ReturnType<typeof clearAllCompanies> | ReturnType<typeof clearAllConnectedAccounts> | ReturnType<typeof clearAllCurrencies> | ReturnType<typeof clearAllCustomerIncomeTrend> | ReturnType<typeof clearAllCustomers> | ReturnType<typeof clearAllDepositAccounts> | ReturnType<typeof clearAllEntities> | ReturnType<typeof clearAllEntityApprovalStatus> | ReturnType<typeof clearAllFiles> | ReturnType<typeof clearAllForecasts> | ReturnType<typeof clearAllGlobalMerchants> | ReturnType<typeof clearAllInsights> | ReturnType<typeof clearAllInvoices> | ReturnType<typeof clearAllInvoicingCoupons> | ReturnType<typeof clearAllInvoicingCreditNotes> | ReturnType<typeof clearAllInvoicingCustomers> | ReturnType<typeof clearAllInvoicingDunningCases> | ReturnType<typeof clearAllInvoicingPlans> | ReturnType<typeof clearAllInvoicingProducts> | ReturnType<typeof clearAllInvoicingSubscriptions> | ReturnType<typeof clearAllInvoicingTransactions> | ReturnType<typeof clearAllAccruedJESchedules> | ReturnType<typeof clearAllJEOneTimeAccruals> | ReturnType<typeof clearAllJEScheduleTransactions> | ReturnType<typeof clearAllMerchants> | ReturnType<typeof clearAllMonthEndCloseChecks> | ReturnType<typeof clearAllNotificationPreferencesView> | ReturnType<typeof clearAllNotificationRegistry> | ReturnType<typeof clearAllNotifications> | ReturnType<typeof clearAllOnboardingCustomersInfo> | ReturnType<typeof clearAllPaymentAccounts> | ReturnType<typeof clearAllPaymentInstruments> | ReturnType<typeof clearAllRecurringBills> | ReturnType<typeof clearAllReimbursements> | ReturnType<typeof clearAllSectionsAccountsView> | ReturnType<typeof clearAllSectionsClassesViewV2> | ReturnType<typeof clearAllSectionsProjectView> | ReturnType<typeof clearAllSubscriptionAddOns> | ReturnType<typeof clearAllSubscriptionCoupons> | ReturnType<typeof clearAllSubscriptionPlans> | ReturnType<typeof clearAllSubscriptionSummary> | ReturnType<typeof clearAllSubscriptions> | ReturnType<typeof clearAllTags> | ReturnType<typeof clearAllTaskGroups> | ReturnType<typeof clearAllTaskGroupTemplates> | ReturnType<typeof clearAllTaskSummary> | ReturnType<typeof clearAllTasks> | ReturnType<typeof clearAllToastNotifications> | ReturnType<typeof clearAllTransactions> | ReturnType<typeof clearAllUserRoles> | ReturnType<typeof clearAllUsers> | ReturnType<typeof clearAllVendorExpenseTrends> | ReturnType<typeof clearAllVendors> | ReturnType<typeof clearCannedResponses> | ReturnType<typeof clearCardPolicy> | ReturnType<typeof clearClassList> | ReturnType<typeof clearContacts> | ReturnType<typeof clearCountryList> | ReturnType<typeof clearDepositAccountTransaction> | ReturnType<typeof clearSnackbar>;
|
|
272
272
|
export type ActionType = clearActionTypeForViews | clearActionTypeForEntities | ReturnType<typeof clearAll>;
|
|
273
273
|
export declare const clearAllEpic: (actions$: ActionsObservable<ActionType>) => import("rxjs").Observable<ActionType>;
|
|
274
274
|
export {};
|
|
@@ -510,6 +510,7 @@ const clearAllEpic = (actions$) => actions$.pipe((0, operators_1.filter)(tenantR
|
|
|
510
510
|
(0, productReducer_1.clearAllInvoicingProducts)(),
|
|
511
511
|
(0, invoicingSubscriptionReducer_1.clearAllInvoicingSubscriptions)(),
|
|
512
512
|
(0, invoicingTransactionReducer_1.clearAllInvoicingTransactions)(),
|
|
513
|
+
(0, jeSchedulesReducer_1.clearAllJEOneTimeAccruals)(),
|
|
513
514
|
(0, jeSchedulesReducer_1.clearAllJEScheduleTransactions)(),
|
|
514
515
|
(0, merchantReducer_1.clearAllMerchants)(),
|
|
515
516
|
(0, monthEndCloseChecksReducer_1.clearAllMonthEndCloseChecks)(),
|
|
@@ -1,3 +1,9 @@
|
|
|
1
1
|
export function generateJEScheduleKey(payload) {
|
|
2
2
|
return `${payload.je_schedule_id}_${payload.je_schedule_type}`;
|
|
3
3
|
}
|
|
4
|
+
// Suffixed rather than using the bare Mongo _id so the key is a distinct type from
|
|
5
|
+
// JEScheduleKey / JEScheduleTransactionKey and the three cannot be passed interchangeably.
|
|
6
|
+
// The unsuffixed id stays on the entity as `accrualId` for callers that need it.
|
|
7
|
+
export function generateJEOneTimeAccrualKey(accrualId) {
|
|
8
|
+
return `${accrualId}_one_time_accrual`;
|
|
9
|
+
}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { toAmount } from '../../commonStateTypes/amount';
|
|
2
2
|
import { LAST_SCHEDULE_DAY_OF_MONTH, MAX_SCHEDULE_DAY_OF_MONTH, MIN_SCHEDULE_DAY_OF_MONTH, toScheduleDaysOfMonth, } from '../../commonStateTypes/timePeriod';
|
|
3
3
|
import { date } from '../../zeniDayJS';
|
|
4
|
+
import { toZeniUrl } from '../../zeniUrl';
|
|
4
5
|
import { toTransactionID, } from '../transaction/payloadTypes/transactionIDPayload';
|
|
5
6
|
import { generateJEScheduleKey } from './jeScheduleHelper';
|
|
6
|
-
import { getJEScheduleTransactionKey, toJournalEntryErrorCodeType, toScheduleJournalEntryStatusCodeType, toScheduleStatusCodeType, toScheduleTypesTypeStrict, } from './jeSchedulesTypes';
|
|
7
|
+
import { getJEScheduleTransactionKey, toJournalEntryErrorCodeType, toOneTimeAccrualAutomationTierType, toOneTimeAccrualOriginType, toOneTimeAccrualReversalPolicyType, toOneTimeAccrualReversalTriggerType, toOneTimeAccrualStatusCodeType, toScheduleJournalEntryStatusCodeType, toScheduleStatusCodeType, toScheduleTypesTypeStrict, } from './jeSchedulesTypes';
|
|
8
|
+
const USD_CURRENCY_CODE = 'USD';
|
|
7
9
|
export function toScheduledJournalEntryState(payload, currency_code, currency_symbol) {
|
|
8
10
|
return {
|
|
9
11
|
status: {
|
|
@@ -334,3 +336,66 @@ export function toJEAccruedScheduledTransaction(payload) {
|
|
|
334
336
|
jeScheduleType: toScheduleTypesTypeStrict(payload.je_schedule_type),
|
|
335
337
|
};
|
|
336
338
|
}
|
|
339
|
+
export function toJEOneTimeAccrual(payload) {
|
|
340
|
+
return {
|
|
341
|
+
accrualId: payload._id,
|
|
342
|
+
vendorId: payload.vendor_id,
|
|
343
|
+
vendorName: payload.vendor_name,
|
|
344
|
+
serviceMonth: payload.service_month,
|
|
345
|
+
accrualStatus: toOneTimeAccrualStatusCodeType(payload.status),
|
|
346
|
+
origin: toOneTimeAccrualOriginType(payload.origin),
|
|
347
|
+
automationTier: payload.automation_tier != null
|
|
348
|
+
? toOneTimeAccrualAutomationTierType(payload.automation_tier)
|
|
349
|
+
: undefined,
|
|
350
|
+
estimatedAmount: toOneTimeAccrualAmount(payload.estimated_amount, payload.currency),
|
|
351
|
+
memo: payload.memo ?? '',
|
|
352
|
+
// Exclusive by contract: a scheduled row reverses on expectedReversalDate and bills never
|
|
353
|
+
// drive it, so the two never need reconciling. Defaulting to on_bill_match matches the
|
|
354
|
+
// create path's default when the field is absent on an older document.
|
|
355
|
+
reversalPolicy: toOneTimeAccrualReversalPolicyType(payload.reversal_policy ?? 'on_bill_match'),
|
|
356
|
+
reversalTrigger: toOneTimeAccrualReversalTriggerType(payload.reversal_trigger ?? undefined),
|
|
357
|
+
expectedReversalDate: payload.expected_reversal_date != null
|
|
358
|
+
? date(payload.expected_reversal_date)
|
|
359
|
+
: undefined,
|
|
360
|
+
postingDate: payload.posting_date != null ? date(payload.posting_date) : undefined,
|
|
361
|
+
actualPostDate: payload.actual_post_date != null
|
|
362
|
+
? date(payload.actual_post_date)
|
|
363
|
+
: undefined,
|
|
364
|
+
actualReversalPostDate: payload.actual_reversal_post_date != null
|
|
365
|
+
? date(payload.actual_reversal_post_date)
|
|
366
|
+
: undefined,
|
|
367
|
+
jeDebitAccountId: payload.je_debit_account_id ?? undefined,
|
|
368
|
+
jeDebitAccountName: payload.je_debit_account_name ?? undefined,
|
|
369
|
+
jeDebitAccountingClassId: payload.je_debit_accounting_class_id ?? undefined,
|
|
370
|
+
jeDebitAccountingClassName: payload.je_debit_accounting_class_name ?? undefined,
|
|
371
|
+
jeCreditAccountId: payload.je_credit_account_id ?? undefined,
|
|
372
|
+
jeCreditAccountName: payload.je_credit_account_name ?? undefined,
|
|
373
|
+
jeCreditAccountingClassId: payload.je_credit_accounting_class_id ?? undefined,
|
|
374
|
+
jeCreditAccountingClassName: payload.je_credit_accounting_class_name ?? undefined,
|
|
375
|
+
transactionId: payload.transaction_id ?? undefined,
|
|
376
|
+
transactionIntegrationId: payload.transaction_integration_id ?? undefined,
|
|
377
|
+
reversalTransactionId: payload.reversal_transaction_id ?? undefined,
|
|
378
|
+
createdBy: toJEOneTimeAccrualCreator(payload.created_by_user),
|
|
379
|
+
};
|
|
380
|
+
}
|
|
381
|
+
// The accrual wire format carries a currency CODE but no symbol, so the symbol has to be derived.
|
|
382
|
+
// Only USD has a known glyph today (the create path is USD-only); anything else falls back to the
|
|
383
|
+
// code, which reads correctly as "EUR 1,200" rather than silently rendering a wrong "$".
|
|
384
|
+
function toOneTimeAccrualAmount(amount, currencyCode) {
|
|
385
|
+
const code = currencyCode ?? USD_CURRENCY_CODE;
|
|
386
|
+
return toAmount(amount, code, code === USD_CURRENCY_CODE ? '$' : code);
|
|
387
|
+
}
|
|
388
|
+
function toJEOneTimeAccrualCreator(payload) {
|
|
389
|
+
if (payload == null) {
|
|
390
|
+
return undefined;
|
|
391
|
+
}
|
|
392
|
+
return {
|
|
393
|
+
userId: payload.user_id,
|
|
394
|
+
email: payload.email ?? undefined,
|
|
395
|
+
firstName: payload.first_name ?? undefined,
|
|
396
|
+
lastName: payload.last_name ?? undefined,
|
|
397
|
+
photo: payload.photo?.original != null
|
|
398
|
+
? toZeniUrl(payload.photo.original)
|
|
399
|
+
: undefined,
|
|
400
|
+
};
|
|
401
|
+
}
|