@zeniai/client-epic-state 5.1.62-betaRD2 → 5.1.62-betaRD3
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/transaction/payloadTypes/scheduleTransactionPayload.d.ts +2 -0
- package/lib/entity/transaction/payloadTypes/scheduleTransactionPayload.js +2 -0
- package/lib/entity/transaction/stateTypes/scheduleTransaction.d.ts +2 -0
- package/lib/epic.d.ts +2 -2
- package/lib/epic.js +2 -2
- package/lib/esm/entity/transaction/payloadTypes/scheduleTransactionPayload.js +2 -0
- package/lib/esm/epic.js +2 -2
- package/lib/esm/index.js +1 -1
- package/lib/esm/view/expenseAutomationView/epics/jeSchedule/newSchedule/saveNewScheduleEpic.js +5 -5
- package/lib/esm/view/expenseAutomationView/epics/jeSchedule/newSchedule/searchTransactionsForNewScheduleEpic.js +29 -7
- package/lib/esm/view/expenseAutomationView/helpers/newScheduleLocalDataHelper.js +3 -15
- package/lib/esm/view/expenseAutomationView/selectors/jeNewScheduleViewSelector.js +4 -6
- package/lib/index.d.ts +1 -1
- package/lib/index.js +4 -4
- package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/saveNewScheduleEpic.js +4 -4
- package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/searchTransactionsForNewScheduleEpic.d.ts +2 -2
- package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/searchTransactionsForNewScheduleEpic.js +28 -6
- package/lib/view/expenseAutomationView/helpers/newScheduleLocalDataHelper.d.ts +3 -10
- package/lib/view/expenseAutomationView/helpers/newScheduleLocalDataHelper.js +4 -17
- package/lib/view/expenseAutomationView/reducers/jeSchedulesViewReducer.d.ts +1 -1
- package/lib/view/expenseAutomationView/selectorTypes/jeNewScheduleViewSelectorTypes.d.ts +3 -4
- package/lib/view/expenseAutomationView/selectors/jeNewScheduleViewSelector.js +3 -5
- package/lib/view/expenseAutomationView/types/jeSchedulesViewState.d.ts +3 -4
- package/package.json +1 -1
- package/lib/entity/transaction/scheduleTransactionHelper.d.ts +0 -15
- package/lib/entity/transaction/scheduleTransactionHelper.js +0 -43
- package/lib/esm/entity/transaction/scheduleTransactionHelper.js +0 -39
|
@@ -12,5 +12,7 @@ export interface ScheduleTransactionPayload extends TransactionIDPayload, Omit<A
|
|
|
12
12
|
labels?: string[];
|
|
13
13
|
sync_token?: number;
|
|
14
14
|
transaction_description?: string | null;
|
|
15
|
+
vendor_id?: string | null;
|
|
16
|
+
vendor_name?: string | null;
|
|
15
17
|
}
|
|
16
18
|
export declare const toScheduleTransaction: (payload: ScheduleTransactionPayload, currency_code: string, currency_symbol: string) => ScheduleTransaction;
|
|
@@ -33,6 +33,8 @@ const toScheduleTransaction = (payload, currency_code, currency_symbol) => {
|
|
|
33
33
|
currencySymbol: currency_symbol,
|
|
34
34
|
},
|
|
35
35
|
description: payload.transaction_description ?? undefined,
|
|
36
|
+
vendorId: payload.vendor_id ?? undefined,
|
|
37
|
+
vendorName: payload.vendor_name ?? undefined,
|
|
36
38
|
};
|
|
37
39
|
};
|
|
38
40
|
exports.toScheduleTransaction = toScheduleTransaction;
|
package/lib/epic.d.ts
CHANGED
|
@@ -119,10 +119,10 @@ import { ActionType as UpdateCompanyTaskManagerViewFiltersActionType } from './v
|
|
|
119
119
|
import { ActionType as CompanyManagementSavePendingUpdatesActionType } from './view/companyView/epic/companyManagementSavePendingUpdates';
|
|
120
120
|
import { ActionType as CompanyManagementSaveUpdatesActionType } from './view/companyView/epic/companyManagementSaveUpdatesEpic';
|
|
121
121
|
import { ActionType as CreateCompanyOfficersActionType } from './view/companyView/epic/companyPassport/createCompanyOfficersEpic';
|
|
122
|
-
import { ActionType as DisableAccountingProjectsActionType } from './view/companyView/epic/companyPassport/projects/disableAccountingProjectsEpic';
|
|
123
122
|
import { ActionType as DismissCapitalizationOnboardingActionType } from './view/companyView/epic/companyPassport/dismissCapitalizationOnboardingEpic';
|
|
124
|
-
import { ActionType as EnableAccountingProjectsActionType } from './view/companyView/epic/companyPassport/projects/enableAccountingProjectsEpic';
|
|
125
123
|
import { ActionType as FetchCompanyPassportViewActionType } from './view/companyView/epic/companyPassport/fetchCompanyPassportViewEpic';
|
|
124
|
+
import { ActionType as DisableAccountingProjectsActionType } from './view/companyView/epic/companyPassport/projects/disableAccountingProjectsEpic';
|
|
125
|
+
import { ActionType as EnableAccountingProjectsActionType } from './view/companyView/epic/companyPassport/projects/enableAccountingProjectsEpic';
|
|
126
126
|
import { ActionType as ResumeEnableAccountingProjectsActionType } from './view/companyView/epic/companyPassport/projects/resumeEnableAccountingProjectsEpic';
|
|
127
127
|
import { ActionType as SaveCompanyPassportDetailsActionType } from './view/companyView/epic/companyPassport/saveCompanyPassportDetailsEpic';
|
|
128
128
|
import { ActionType as UpdateAccountingClassesEnabledActionType } from './view/companyView/epic/companyPassport/updateAccountingClassesEnabledEpic';
|
package/lib/epic.js
CHANGED
|
@@ -128,10 +128,10 @@ const updateCompanyTaskManagerViewFiltersEpic_1 = require("./view/companyTaskMan
|
|
|
128
128
|
const companyManagementSavePendingUpdates_1 = require("./view/companyView/epic/companyManagementSavePendingUpdates");
|
|
129
129
|
const companyManagementSaveUpdatesEpic_1 = require("./view/companyView/epic/companyManagementSaveUpdatesEpic");
|
|
130
130
|
const createCompanyOfficersEpic_1 = require("./view/companyView/epic/companyPassport/createCompanyOfficersEpic");
|
|
131
|
-
const disableAccountingProjectsEpic_1 = require("./view/companyView/epic/companyPassport/projects/disableAccountingProjectsEpic");
|
|
132
131
|
const dismissCapitalizationOnboardingEpic_1 = require("./view/companyView/epic/companyPassport/dismissCapitalizationOnboardingEpic");
|
|
133
|
-
const enableAccountingProjectsEpic_1 = require("./view/companyView/epic/companyPassport/projects/enableAccountingProjectsEpic");
|
|
134
132
|
const fetchCompanyPassportViewEpic_1 = require("./view/companyView/epic/companyPassport/fetchCompanyPassportViewEpic");
|
|
133
|
+
const disableAccountingProjectsEpic_1 = require("./view/companyView/epic/companyPassport/projects/disableAccountingProjectsEpic");
|
|
134
|
+
const enableAccountingProjectsEpic_1 = require("./view/companyView/epic/companyPassport/projects/enableAccountingProjectsEpic");
|
|
135
135
|
const resumeEnableAccountingProjectsEpic_1 = require("./view/companyView/epic/companyPassport/projects/resumeEnableAccountingProjectsEpic");
|
|
136
136
|
const saveCompanyPassportDetailsEpic_1 = require("./view/companyView/epic/companyPassport/saveCompanyPassportDetailsEpic");
|
|
137
137
|
const updateAccountingClassesEnabledEpic_1 = require("./view/companyView/epic/companyPassport/updateAccountingClassesEnabledEpic");
|
|
@@ -30,5 +30,7 @@ export const toScheduleTransaction = (payload, currency_code, currency_symbol) =
|
|
|
30
30
|
currencySymbol: currency_symbol,
|
|
31
31
|
},
|
|
32
32
|
description: payload.transaction_description ?? undefined,
|
|
33
|
+
vendorId: payload.vendor_id ?? undefined,
|
|
34
|
+
vendorName: payload.vendor_name ?? undefined,
|
|
33
35
|
};
|
|
34
36
|
};
|
package/lib/esm/epic.js
CHANGED
|
@@ -126,10 +126,10 @@ import { updateCompanyTaskManagerViewFiltersEpic, } from './view/companyTaskMana
|
|
|
126
126
|
import { companyManagementSavePendingUpdatesEpic, } from './view/companyView/epic/companyManagementSavePendingUpdates';
|
|
127
127
|
import { companyManagementSaveUpdatesEpic, } from './view/companyView/epic/companyManagementSaveUpdatesEpic';
|
|
128
128
|
import { createCompanyOfficersEpic, } from './view/companyView/epic/companyPassport/createCompanyOfficersEpic';
|
|
129
|
-
import { disableAccountingProjectsEpic, } from './view/companyView/epic/companyPassport/projects/disableAccountingProjectsEpic';
|
|
130
129
|
import { dismissCapitalizationOnboardingEpic, } from './view/companyView/epic/companyPassport/dismissCapitalizationOnboardingEpic';
|
|
131
|
-
import { enableAccountingProjectsEpic, } from './view/companyView/epic/companyPassport/projects/enableAccountingProjectsEpic';
|
|
132
130
|
import { fetchCompanyPassportViewEpic, } from './view/companyView/epic/companyPassport/fetchCompanyPassportViewEpic';
|
|
131
|
+
import { disableAccountingProjectsEpic, } from './view/companyView/epic/companyPassport/projects/disableAccountingProjectsEpic';
|
|
132
|
+
import { enableAccountingProjectsEpic, } from './view/companyView/epic/companyPassport/projects/enableAccountingProjectsEpic';
|
|
133
133
|
import { resumeEnableAccountingProjectsEpic, } from './view/companyView/epic/companyPassport/projects/resumeEnableAccountingProjectsEpic';
|
|
134
134
|
import { saveCompanyPassportDetailsEpic, } from './view/companyView/epic/companyPassport/saveCompanyPassportDetailsEpic';
|
|
135
135
|
import { updateAccountingClassesEnabledEpic, } from './view/companyView/epic/companyPassport/updateAccountingClassesEnabledEpic';
|
package/lib/esm/index.js
CHANGED
|
@@ -152,7 +152,7 @@ import { fetchCompanyMonthEndReportHistoricData, fetchCompanyMonthEndReportHisto
|
|
|
152
152
|
import { getCompanyMonthEndReportHistoricData, getCompanyMonthEndReportSelectorView, } from './view/companyMonthEndReportView/companyMonthEndReportViewSelector';
|
|
153
153
|
import { fetchCockpitContext, fetchCompanyTaskManagerView, fetchTaskManagerMetrics, updateCompanyTaskManagerViewFilters, } from './view/companyTaskManagerView/companyTaskManagerViewReducer';
|
|
154
154
|
import { getCompanyTaskManagerView, } from './view/companyTaskManagerView/companyTaskManagerViewSelector';
|
|
155
|
-
import { clearCompanyView, companyManagementSaveUpdates, companyPassportClearDataInLocalStore, companyPassportSaveDataInLocalStore, deleteCompanyOfficerInLocalStore, dismissCapitalizationOnboarding, fetchAllCockpitViews, fetchCompanyManagementView, fetchCompanyPassportView, fetchCompanyPortfolioView, fetchManagementView, fetchOnboardingView, fetchParentSubsidiaryManagementView, fetchPortfolioView, fetchSubscriptionView, fetchZeniUsers, saveCompanyPassportDetails, saveIndustryAndIncDateInCompanyPassportLocalStore, updateAccountingClassesEnabled,
|
|
155
|
+
import { clearCompanyView, clearQboProjectsReconnectRequest, companyManagementSaveUpdates, companyPassportClearDataInLocalStore, companyPassportSaveDataInLocalStore, deleteCompanyOfficerInLocalStore, disableAccountingProjects, dismissCapitalizationOnboarding, enableAccountingProjects, fetchAllCockpitViews, fetchCompanyManagementView, fetchCompanyPassportView, fetchCompanyPortfolioView, fetchManagementView, fetchOnboardingView, fetchParentSubsidiaryManagementView, fetchPortfolioView, fetchSubscriptionView, fetchZeniUsers, resumeEnableAccountingProjects, saveCompanyPassportDetails, saveIndustryAndIncDateInCompanyPassportLocalStore, updateAccountingClassesEnabled, updateCapitalizationAccountThreshold, updateCompanyDownloadState, updateCompanyManagementUIState, updateCompanyPassportLocalStoreData, updateCompanyPortfolioUIState, } from './view/companyView/companyViewReducer';
|
|
156
156
|
import { canSendMonthEndEmailReport, shouldEnableCalendarPickerForLastReportSent, } from './view/companyView/helpers/cockpitHelpers';
|
|
157
157
|
import { getParentSubsidiaryManagementView } from './view/companyView/parentSubsidiaryView/parentSubsidiaryViewSelector';
|
|
158
158
|
import { getAddonListZeniSku, getCompanyManagementView, getPlanListZeniSku, } from './view/companyView/selector/companyManagementViewSelector';
|
package/lib/esm/view/expenseAutomationView/epics/jeSchedule/newSchedule/saveNewScheduleEpic.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { from } from 'rxjs';
|
|
2
2
|
import { catchError, filter, mergeMap } from 'rxjs/operators';
|
|
3
3
|
import { updateJESchedules, updateJESchedulesDetails, } from '../../../../../entity/jeSchedules/jeSchedulesReducer';
|
|
4
|
+
import { getJEScheduleTransactionKey } from '../../../../../entity/jeSchedules/jeSchedulesTypes';
|
|
4
5
|
import { openSnackbar } from '../../../../../entity/snackbar/snackbarReducer';
|
|
5
|
-
import {
|
|
6
|
+
import { getScheduleTransactionById } from '../../../../../entity/transaction/transactionSelector';
|
|
6
7
|
import { createZeniAPIStatus, isSuccessResponse, } from '../../../../../responsePayload';
|
|
7
8
|
import { prepareNewSchedulePayload, } from '../../../helpers/newScheduleLocalDataHelper';
|
|
8
9
|
import { resetNewScheduleLocalData, saveNewSchedule, saveNewScheduleFailure, saveNewScheduleSuccess, } from '../../../reducers/jeSchedulesViewReducer';
|
|
9
10
|
const FAILURE_REASON_MESSAGES = {
|
|
10
|
-
multi_line_not_supported: 'This transaction has multiple lines and cannot be scheduled yet.',
|
|
11
11
|
missing_third_party_id: 'This transaction is missing a QuickBooks reference and cannot be scheduled.',
|
|
12
12
|
missing_vendor: 'Select a vendor before saving this schedule.',
|
|
13
13
|
};
|
|
@@ -16,9 +16,9 @@ export const saveNewScheduleEpic = (actions$, state$, zeniAPI) => actions$.pipe(
|
|
|
16
16
|
const state = state$.value;
|
|
17
17
|
const localData = state.expenseAutomationJESchedulesViewState.newSchedule
|
|
18
18
|
.newScheduleState[scheduleType];
|
|
19
|
-
const
|
|
20
|
-
const transaction =
|
|
21
|
-
?
|
|
19
|
+
const { selectedBaseTransactionId } = localData;
|
|
20
|
+
const transaction = selectedBaseTransactionId != null
|
|
21
|
+
? getScheduleTransactionById(state.transactionState, getJEScheduleTransactionKey(selectedBaseTransactionId))
|
|
22
22
|
: undefined;
|
|
23
23
|
if (transaction == null) {
|
|
24
24
|
return from([
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { EMPTY, from, merge, of } from 'rxjs';
|
|
2
2
|
import { catchError, debounceTime, filter, mergeMap, switchMap, } from 'rxjs/operators';
|
|
3
|
-
import {
|
|
3
|
+
import { getJEScheduleTransactionKey } from '../../../../../entity/jeSchedules/jeSchedulesTypes';
|
|
4
|
+
import { toTransactionType } from '../../../../../entity/transaction/stateTypes/transactionType';
|
|
5
|
+
import { updateScheduleTransactions } from '../../../../../entity/transaction/transactionReducer';
|
|
4
6
|
import { createZeniAPIStatus, isSuccessResponse, } from '../../../../../responsePayload';
|
|
5
7
|
import { searchTransactionsForNewSchedule, searchTransactionsForNewScheduleFailure, searchTransactionsForNewScheduleSuccess, } from '../../../reducers/jeSchedulesViewReducer';
|
|
6
8
|
import { MIN_NEW_SCHEDULE_SEARCH_LENGTH } from '../../../types/jeSchedulesViewState';
|
|
@@ -25,12 +27,32 @@ export const searchTransactionsForNewScheduleEpic = (actions$, _state$, zeniAPI)
|
|
|
25
27
|
.pipe(mergeMap((response) => {
|
|
26
28
|
if (isSuccessResponse(response) && response.data != null) {
|
|
27
29
|
const { transactions } = response.data;
|
|
28
|
-
const
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
30
|
+
const transactionsPerCurrency = {};
|
|
31
|
+
transactions.forEach((transaction) => {
|
|
32
|
+
const { currency_code, currency_symbol } = transaction;
|
|
33
|
+
const existing = transactionsPerCurrency[currency_code];
|
|
34
|
+
transactionsPerCurrency[currency_code] =
|
|
35
|
+
existing != null
|
|
36
|
+
? {
|
|
37
|
+
currencySymbol: existing.currencySymbol,
|
|
38
|
+
transactions: [...existing.transactions, transaction],
|
|
39
|
+
}
|
|
40
|
+
: {
|
|
41
|
+
currencySymbol: currency_symbol,
|
|
42
|
+
transactions: [transaction],
|
|
43
|
+
};
|
|
44
|
+
});
|
|
45
|
+
const actionsOut = Object.keys(transactionsPerCurrency).map((currencyCode) => {
|
|
46
|
+
const perCurrency = transactionsPerCurrency[currencyCode];
|
|
47
|
+
return updateScheduleTransactions(perCurrency.transactions, currencyCode, perCurrency.currencySymbol, 'merge');
|
|
48
|
+
});
|
|
49
|
+
actionsOut.push(searchTransactionsForNewScheduleSuccess({
|
|
50
|
+
searchResults: transactions.map((transaction) => getJEScheduleTransactionKey({
|
|
51
|
+
id: transaction.transaction_id,
|
|
52
|
+
type: toTransactionType(transaction.transaction_type),
|
|
53
|
+
lineId: transaction.line_id,
|
|
54
|
+
})),
|
|
55
|
+
}));
|
|
34
56
|
return from(actionsOut);
|
|
35
57
|
}
|
|
36
58
|
return of(searchTransactionsForNewScheduleFailure({
|
|
@@ -2,7 +2,6 @@ import { toAmount } from '../../../commonStateTypes/amount';
|
|
|
2
2
|
import { DEFAULT_DATE_FORMAT } from '../../../commonStateTypes/fiscalYearHelpers/formatZeniDateFY';
|
|
3
3
|
import { MONTH_YEAR_FORMAT } from '../../../commonStateTypes/fiscalYearHelpers/formatZeniDateFY';
|
|
4
4
|
import { LAST_SCHEDULE_DAY_OF_MONTH } from '../../../commonStateTypes/timePeriod';
|
|
5
|
-
import { mapSupportedTransactionLineToScheduleTransaction } from '../../../entity/transaction/scheduleTransactionHelper';
|
|
6
5
|
import { getPostingDateAndStatusForIndex } from '../../scheduleView/scheduleDetailView/scheduleDetailLocalDataHelper';
|
|
7
6
|
import { mapScheduleTransactionToBaseScheduleTransactionPayload, } from '../../scheduleView/scheduleDetailView/scheduleDetailPayload';
|
|
8
7
|
const getNewScheduleMemo = (vendorName, schedulePostingDate, currentPeriod, totalPeriod, assetId) => {
|
|
@@ -53,13 +52,6 @@ export const computeNewScheduleJeDetails = (localData, totalAmount, vendorName)
|
|
|
53
52
|
}
|
|
54
53
|
return newJeDetails;
|
|
55
54
|
};
|
|
56
|
-
/**
|
|
57
|
-
* Whether a Base Transaction search result can be selected for a new
|
|
58
|
-
* schedule this round — restricted to single-line transactions since the
|
|
59
|
-
* search/list endpoint's `lines` may not reflect the transaction's full line
|
|
60
|
-
* set, and there is no line-picker UI yet.
|
|
61
|
-
*/
|
|
62
|
-
export const isSupportedTransactionSelectableForNewSchedule = (transaction) => transaction.totalLinesCount === 1 && transaction.lines?.length === 1;
|
|
63
55
|
const mapNewJeDetailsToScheduledJournalEntryPayload = (jeScheduleDetails) => jeScheduleDetails.map((journalEntry) => ({
|
|
64
56
|
status: {
|
|
65
57
|
code: journalEntry.postingStatus,
|
|
@@ -89,15 +81,11 @@ const mapNewJeDetailsToScheduledJournalEntryPayload = (jeScheduleDetails) => jeS
|
|
|
89
81
|
* transaction/line plus what the user filled into the form).
|
|
90
82
|
*/
|
|
91
83
|
export const prepareNewSchedulePayload = (transaction, localData, scheduleType) => {
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
firstLine == null) {
|
|
95
|
-
return { ok: false, reason: 'multi_line_not_supported' };
|
|
96
|
-
}
|
|
97
|
-
const scheduleTransaction = mapSupportedTransactionLineToScheduleTransaction(transaction, firstLine.id);
|
|
98
|
-
if (scheduleTransaction == null) {
|
|
84
|
+
if (transaction.thirdPartyTransactionId == null ||
|
|
85
|
+
transaction.thirdPartyTransactionId === '') {
|
|
99
86
|
return { ok: false, reason: 'missing_third_party_id' };
|
|
100
87
|
}
|
|
88
|
+
const scheduleTransaction = transaction;
|
|
101
89
|
const vendorId = localData.selectedVendor?.id ?? transaction.vendorId ?? '';
|
|
102
90
|
const vendorName = localData.selectedVendor?.name ?? transaction.vendorName ?? '';
|
|
103
91
|
if (vendorId === '' || vendorName === '') {
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { getAccountIdsForTypes } from '../../../entity/account/accountSelector';
|
|
2
|
-
import {
|
|
2
|
+
import { getScheduleTransactionById } from '../../../entity/transaction/transactionSelector';
|
|
3
3
|
import { getAccountIdsForLabel, getAccountList, getNestedAccountListHierarchy, } from '../../accountList/accountListSelector';
|
|
4
4
|
import { getClassList, getNestedClassListHierarchy, } from '../../classList/classListSelector';
|
|
5
5
|
import { getAccountsTypesForScheduleDetails } from '../../scheduleView/scheduleDetailView/scheduleDetailLocalDataHelper';
|
|
6
6
|
import { filterNestedAccountHierarchyById } from '../../scheduleView/scheduleDetailView/scheduleDetailSelector';
|
|
7
7
|
import { getAccountLabelForScheduleType, getAccountsTypesForScheduleEpics, } from '../../scheduleView/scheduleListView/scheduleListHelper';
|
|
8
|
-
import { isSupportedTransactionSelectableForNewSchedule } from '../helpers/newScheduleLocalDataHelper';
|
|
9
8
|
/**
|
|
10
9
|
* The Base Transaction search is shared across schedule types (one search
|
|
11
10
|
* box, not one per prepaid_expenses/fixed_assets) — split out from
|
|
@@ -14,12 +13,11 @@ import { isSupportedTransactionSelectableForNewSchedule } from '../helpers/newSc
|
|
|
14
13
|
*/
|
|
15
14
|
export const getNewScheduleSearchTransactionsView = (state) => {
|
|
16
15
|
const { searchTransactions } = state.expenseAutomationJESchedulesViewState.newSchedule;
|
|
17
|
-
const searchTransactionsResults =
|
|
16
|
+
const searchTransactionsResults = searchTransactions.searchResults
|
|
17
|
+
.map((key) => getScheduleTransactionById(state.transactionState, key))
|
|
18
|
+
.filter((transaction) => transaction != null);
|
|
18
19
|
return {
|
|
19
20
|
searchTransactionsResults,
|
|
20
|
-
selectableBaseTransactionIds: searchTransactionsResults
|
|
21
|
-
.filter(isSupportedTransactionSelectableForNewSchedule)
|
|
22
|
-
.map((transaction) => transaction.id),
|
|
23
21
|
searchTransactionsFetchState: {
|
|
24
22
|
fetchState: searchTransactions.fetchState,
|
|
25
23
|
error: searchTransactions.error,
|
package/lib/index.d.ts
CHANGED
|
@@ -250,7 +250,7 @@ import { AuditSummaryData, CompanyMonthEndReportData, CompanyMonthReportTemplate
|
|
|
250
250
|
import { fetchCockpitContext, fetchCompanyTaskManagerView, fetchTaskManagerMetrics, updateCompanyTaskManagerViewFilters } from './view/companyTaskManagerView/companyTaskManagerViewReducer';
|
|
251
251
|
import { CompanyTaskManagerSelectorView, TaskWithCompanyDetail, getCompanyTaskManagerView } from './view/companyTaskManagerView/companyTaskManagerViewSelector';
|
|
252
252
|
import { CompanyTaskManagerViewUIState, TaskManagerMetrics } from './view/companyTaskManagerView/companyTaskManagerViewState';
|
|
253
|
-
import { clearCompanyView, companyManagementSaveUpdates, companyPassportClearDataInLocalStore, companyPassportSaveDataInLocalStore, deleteCompanyOfficerInLocalStore, dismissCapitalizationOnboarding, fetchAllCockpitViews, fetchCompanyManagementView, fetchCompanyPassportView, fetchCompanyPortfolioView, fetchManagementView, fetchOnboardingView, fetchParentSubsidiaryManagementView, fetchPortfolioView, fetchSubscriptionView, fetchZeniUsers, saveCompanyPassportDetails, saveIndustryAndIncDateInCompanyPassportLocalStore, updateAccountingClassesEnabled,
|
|
253
|
+
import { clearCompanyView, clearQboProjectsReconnectRequest, companyManagementSaveUpdates, companyPassportClearDataInLocalStore, companyPassportSaveDataInLocalStore, deleteCompanyOfficerInLocalStore, disableAccountingProjects, dismissCapitalizationOnboarding, enableAccountingProjects, fetchAllCockpitViews, fetchCompanyManagementView, fetchCompanyPassportView, fetchCompanyPortfolioView, fetchManagementView, fetchOnboardingView, fetchParentSubsidiaryManagementView, fetchPortfolioView, fetchSubscriptionView, fetchZeniUsers, resumeEnableAccountingProjects, saveCompanyPassportDetails, saveIndustryAndIncDateInCompanyPassportLocalStore, updateAccountingClassesEnabled, updateCapitalizationAccountThreshold, updateCompanyDownloadState, updateCompanyManagementUIState, updateCompanyPassportLocalStoreData, updateCompanyPortfolioUIState } from './view/companyView/companyViewReducer';
|
|
254
254
|
import { FilterCategoryValueType, canSendMonthEndEmailReport, shouldEnableCalendarPickerForLastReportSent } from './view/companyView/helpers/cockpitHelpers';
|
|
255
255
|
import { getParentSubsidiaryManagementView } from './view/companyView/parentSubsidiaryView/parentSubsidiaryViewSelector';
|
|
256
256
|
import { CompanyManagementView, CompanyWithUpdateStatusView, getAddonListZeniSku, getCompanyManagementView, getPlanListZeniSku } from './view/companyView/selector/companyManagementViewSelector';
|
package/lib/index.js
CHANGED
|
@@ -703,11 +703,14 @@ const companyTaskManagerViewSelector_1 = require("./view/companyTaskManagerView/
|
|
|
703
703
|
Object.defineProperty(exports, "getCompanyTaskManagerView", { enumerable: true, get: function () { return companyTaskManagerViewSelector_1.getCompanyTaskManagerView; } });
|
|
704
704
|
const companyViewReducer_1 = require("./view/companyView/companyViewReducer");
|
|
705
705
|
Object.defineProperty(exports, "clearCompanyView", { enumerable: true, get: function () { return companyViewReducer_1.clearCompanyView; } });
|
|
706
|
+
Object.defineProperty(exports, "clearQboProjectsReconnectRequest", { enumerable: true, get: function () { return companyViewReducer_1.clearQboProjectsReconnectRequest; } });
|
|
706
707
|
Object.defineProperty(exports, "companyManagementSaveUpdates", { enumerable: true, get: function () { return companyViewReducer_1.companyManagementSaveUpdates; } });
|
|
707
708
|
Object.defineProperty(exports, "companyPassportClearDataInLocalStore", { enumerable: true, get: function () { return companyViewReducer_1.companyPassportClearDataInLocalStore; } });
|
|
708
709
|
Object.defineProperty(exports, "companyPassportSaveDataInLocalStore", { enumerable: true, get: function () { return companyViewReducer_1.companyPassportSaveDataInLocalStore; } });
|
|
709
710
|
Object.defineProperty(exports, "deleteCompanyOfficerInLocalStore", { enumerable: true, get: function () { return companyViewReducer_1.deleteCompanyOfficerInLocalStore; } });
|
|
711
|
+
Object.defineProperty(exports, "disableAccountingProjects", { enumerable: true, get: function () { return companyViewReducer_1.disableAccountingProjects; } });
|
|
710
712
|
Object.defineProperty(exports, "dismissCapitalizationOnboarding", { enumerable: true, get: function () { return companyViewReducer_1.dismissCapitalizationOnboarding; } });
|
|
713
|
+
Object.defineProperty(exports, "enableAccountingProjects", { enumerable: true, get: function () { return companyViewReducer_1.enableAccountingProjects; } });
|
|
711
714
|
Object.defineProperty(exports, "fetchAllCockpitViews", { enumerable: true, get: function () { return companyViewReducer_1.fetchAllCockpitViews; } });
|
|
712
715
|
Object.defineProperty(exports, "fetchCompanyManagementView", { enumerable: true, get: function () { return companyViewReducer_1.fetchCompanyManagementView; } });
|
|
713
716
|
Object.defineProperty(exports, "fetchCompanyPassportView", { enumerable: true, get: function () { return companyViewReducer_1.fetchCompanyPassportView; } });
|
|
@@ -718,13 +721,10 @@ Object.defineProperty(exports, "fetchParentSubsidiaryManagementView", { enumerab
|
|
|
718
721
|
Object.defineProperty(exports, "fetchPortfolioView", { enumerable: true, get: function () { return companyViewReducer_1.fetchPortfolioView; } });
|
|
719
722
|
Object.defineProperty(exports, "fetchSubscriptionView", { enumerable: true, get: function () { return companyViewReducer_1.fetchSubscriptionView; } });
|
|
720
723
|
Object.defineProperty(exports, "fetchZeniUsers", { enumerable: true, get: function () { return companyViewReducer_1.fetchZeniUsers; } });
|
|
724
|
+
Object.defineProperty(exports, "resumeEnableAccountingProjects", { enumerable: true, get: function () { return companyViewReducer_1.resumeEnableAccountingProjects; } });
|
|
721
725
|
Object.defineProperty(exports, "saveCompanyPassportDetails", { enumerable: true, get: function () { return companyViewReducer_1.saveCompanyPassportDetails; } });
|
|
722
726
|
Object.defineProperty(exports, "saveIndustryAndIncDateInCompanyPassportLocalStore", { enumerable: true, get: function () { return companyViewReducer_1.saveIndustryAndIncDateInCompanyPassportLocalStore; } });
|
|
723
727
|
Object.defineProperty(exports, "updateAccountingClassesEnabled", { enumerable: true, get: function () { return companyViewReducer_1.updateAccountingClassesEnabled; } });
|
|
724
|
-
Object.defineProperty(exports, "enableAccountingProjects", { enumerable: true, get: function () { return companyViewReducer_1.enableAccountingProjects; } });
|
|
725
|
-
Object.defineProperty(exports, "resumeEnableAccountingProjects", { enumerable: true, get: function () { return companyViewReducer_1.resumeEnableAccountingProjects; } });
|
|
726
|
-
Object.defineProperty(exports, "disableAccountingProjects", { enumerable: true, get: function () { return companyViewReducer_1.disableAccountingProjects; } });
|
|
727
|
-
Object.defineProperty(exports, "clearQboProjectsReconnectRequest", { enumerable: true, get: function () { return companyViewReducer_1.clearQboProjectsReconnectRequest; } });
|
|
728
728
|
Object.defineProperty(exports, "updateCapitalizationAccountThreshold", { enumerable: true, get: function () { return companyViewReducer_1.updateCapitalizationAccountThreshold; } });
|
|
729
729
|
Object.defineProperty(exports, "updateCompanyDownloadState", { enumerable: true, get: function () { return companyViewReducer_1.updateCompanyDownloadState; } });
|
|
730
730
|
Object.defineProperty(exports, "updateCompanyManagementUIState", { enumerable: true, get: function () { return companyViewReducer_1.updateCompanyManagementUIState; } });
|
|
@@ -4,13 +4,13 @@ exports.saveNewScheduleEpic = void 0;
|
|
|
4
4
|
const rxjs_1 = require("rxjs");
|
|
5
5
|
const operators_1 = require("rxjs/operators");
|
|
6
6
|
const jeSchedulesReducer_1 = require("../../../../../entity/jeSchedules/jeSchedulesReducer");
|
|
7
|
+
const jeSchedulesTypes_1 = require("../../../../../entity/jeSchedules/jeSchedulesTypes");
|
|
7
8
|
const snackbarReducer_1 = require("../../../../../entity/snackbar/snackbarReducer");
|
|
8
9
|
const transactionSelector_1 = require("../../../../../entity/transaction/transactionSelector");
|
|
9
10
|
const responsePayload_1 = require("../../../../../responsePayload");
|
|
10
11
|
const newScheduleLocalDataHelper_1 = require("../../../helpers/newScheduleLocalDataHelper");
|
|
11
12
|
const jeSchedulesViewReducer_1 = require("../../../reducers/jeSchedulesViewReducer");
|
|
12
13
|
const FAILURE_REASON_MESSAGES = {
|
|
13
|
-
multi_line_not_supported: 'This transaction has multiple lines and cannot be scheduled yet.',
|
|
14
14
|
missing_third_party_id: 'This transaction is missing a QuickBooks reference and cannot be scheduled.',
|
|
15
15
|
missing_vendor: 'Select a vendor before saving this schedule.',
|
|
16
16
|
};
|
|
@@ -19,9 +19,9 @@ const saveNewScheduleEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, ope
|
|
|
19
19
|
const state = state$.value;
|
|
20
20
|
const localData = state.expenseAutomationJESchedulesViewState.newSchedule
|
|
21
21
|
.newScheduleState[scheduleType];
|
|
22
|
-
const
|
|
23
|
-
const transaction =
|
|
24
|
-
? (0, transactionSelector_1.
|
|
22
|
+
const { selectedBaseTransactionId } = localData;
|
|
23
|
+
const transaction = selectedBaseTransactionId != null
|
|
24
|
+
? (0, transactionSelector_1.getScheduleTransactionById)(state.transactionState, (0, jeSchedulesTypes_1.getJEScheduleTransactionKey)(selectedBaseTransactionId))
|
|
25
25
|
: undefined;
|
|
26
26
|
if (transaction == null) {
|
|
27
27
|
return (0, rxjs_1.from)([
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { ActionsObservable, StateObservable } from 'redux-observable';
|
|
2
2
|
import { Observable } from 'rxjs';
|
|
3
|
-
import {
|
|
3
|
+
import { updateScheduleTransactions } from '../../../../../entity/transaction/transactionReducer';
|
|
4
4
|
import { RootState } from '../../../../../reducer';
|
|
5
5
|
import { ZeniAPI } from '../../../../../zeniAPI';
|
|
6
6
|
import { searchTransactionsForNewSchedule, searchTransactionsForNewScheduleFailure, searchTransactionsForNewScheduleSuccess } from '../../../reducers/jeSchedulesViewReducer';
|
|
7
|
-
export type ActionType = ReturnType<typeof searchTransactionsForNewSchedule> | ReturnType<typeof searchTransactionsForNewScheduleSuccess> | ReturnType<typeof searchTransactionsForNewScheduleFailure> | ReturnType<typeof
|
|
7
|
+
export type ActionType = ReturnType<typeof searchTransactionsForNewSchedule> | ReturnType<typeof searchTransactionsForNewScheduleSuccess> | ReturnType<typeof searchTransactionsForNewScheduleFailure> | ReturnType<typeof updateScheduleTransactions>;
|
|
8
8
|
export declare const searchTransactionsForNewScheduleEpic: (actions$: ActionsObservable<ActionType>, _state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
|
|
@@ -3,6 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.searchTransactionsForNewScheduleEpic = void 0;
|
|
4
4
|
const rxjs_1 = require("rxjs");
|
|
5
5
|
const operators_1 = require("rxjs/operators");
|
|
6
|
+
const jeSchedulesTypes_1 = require("../../../../../entity/jeSchedules/jeSchedulesTypes");
|
|
7
|
+
const transactionType_1 = require("../../../../../entity/transaction/stateTypes/transactionType");
|
|
6
8
|
const transactionReducer_1 = require("../../../../../entity/transaction/transactionReducer");
|
|
7
9
|
const responsePayload_1 = require("../../../../../responsePayload");
|
|
8
10
|
const jeSchedulesViewReducer_1 = require("../../../reducers/jeSchedulesViewReducer");
|
|
@@ -28,12 +30,32 @@ const searchTransactionsForNewScheduleEpic = (actions$, _state$, zeniAPI) => {
|
|
|
28
30
|
.pipe((0, operators_1.mergeMap)((response) => {
|
|
29
31
|
if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
|
|
30
32
|
const { transactions } = response.data;
|
|
31
|
-
const
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
33
|
+
const transactionsPerCurrency = {};
|
|
34
|
+
transactions.forEach((transaction) => {
|
|
35
|
+
const { currency_code, currency_symbol } = transaction;
|
|
36
|
+
const existing = transactionsPerCurrency[currency_code];
|
|
37
|
+
transactionsPerCurrency[currency_code] =
|
|
38
|
+
existing != null
|
|
39
|
+
? {
|
|
40
|
+
currencySymbol: existing.currencySymbol,
|
|
41
|
+
transactions: [...existing.transactions, transaction],
|
|
42
|
+
}
|
|
43
|
+
: {
|
|
44
|
+
currencySymbol: currency_symbol,
|
|
45
|
+
transactions: [transaction],
|
|
46
|
+
};
|
|
47
|
+
});
|
|
48
|
+
const actionsOut = Object.keys(transactionsPerCurrency).map((currencyCode) => {
|
|
49
|
+
const perCurrency = transactionsPerCurrency[currencyCode];
|
|
50
|
+
return (0, transactionReducer_1.updateScheduleTransactions)(perCurrency.transactions, currencyCode, perCurrency.currencySymbol, 'merge');
|
|
51
|
+
});
|
|
52
|
+
actionsOut.push((0, jeSchedulesViewReducer_1.searchTransactionsForNewScheduleSuccess)({
|
|
53
|
+
searchResults: transactions.map((transaction) => (0, jeSchedulesTypes_1.getJEScheduleTransactionKey)({
|
|
54
|
+
id: transaction.transaction_id,
|
|
55
|
+
type: (0, transactionType_1.toTransactionType)(transaction.transaction_type),
|
|
56
|
+
lineId: transaction.line_id,
|
|
57
|
+
})),
|
|
58
|
+
}));
|
|
37
59
|
return (0, rxjs_1.from)(actionsOut);
|
|
38
60
|
}
|
|
39
61
|
return (0, rxjs_1.of)((0, jeSchedulesViewReducer_1.searchTransactionsForNewScheduleFailure)({
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Amount } from '../../../commonStateTypes/amount';
|
|
2
2
|
import { ScheduleTypes } from '../../../entity/jeSchedules/jeSchedulesTypes';
|
|
3
|
-
import {
|
|
3
|
+
import { ScheduleTransaction } from '../../../entity/transaction/stateTypes/scheduleTransaction';
|
|
4
4
|
import { JESchedulePayload, SaveJESchedulePayload } from '../../scheduleView/scheduleDetailView/scheduleDetailPayload';
|
|
5
5
|
import { NewJeDetailLocalData, NewScheduleLocalData, NewScheduleLocalDataFixedAssets } from '../types/jeSchedulesViewState';
|
|
6
6
|
/**
|
|
@@ -12,18 +12,11 @@ import { NewJeDetailLocalData, NewScheduleLocalData, NewScheduleLocalDataFixedAs
|
|
|
12
12
|
* the last row.
|
|
13
13
|
*/
|
|
14
14
|
export declare const computeNewScheduleJeDetails: (localData: NewScheduleLocalData | NewScheduleLocalDataFixedAssets, totalAmount: Amount, vendorName: string) => NewJeDetailLocalData[];
|
|
15
|
-
/**
|
|
16
|
-
* Whether a Base Transaction search result can be selected for a new
|
|
17
|
-
* schedule this round — restricted to single-line transactions since the
|
|
18
|
-
* search/list endpoint's `lines` may not reflect the transaction's full line
|
|
19
|
-
* set, and there is no line-picker UI yet.
|
|
20
|
-
*/
|
|
21
|
-
export declare const isSupportedTransactionSelectableForNewSchedule: (transaction: SupportedTransaction) => boolean;
|
|
22
15
|
export interface NewSchedulePayload {
|
|
23
16
|
je_schedules: JESchedulePayload[];
|
|
24
17
|
scheduled_journal_entries: SaveJESchedulePayload[];
|
|
25
18
|
}
|
|
26
|
-
export type PrepareNewSchedulePayloadFailureReason = 'missing_third_party_id' | 'missing_vendor'
|
|
19
|
+
export type PrepareNewSchedulePayloadFailureReason = 'missing_third_party_id' | 'missing_vendor';
|
|
27
20
|
export type PrepareNewSchedulePayloadResult = {
|
|
28
21
|
ok: true;
|
|
29
22
|
payload: NewSchedulePayload;
|
|
@@ -40,4 +33,4 @@ export type PrepareNewSchedulePayloadResult = {
|
|
|
40
33
|
* history, so this reads only from data already in hand (the selected
|
|
41
34
|
* transaction/line plus what the user filled into the form).
|
|
42
35
|
*/
|
|
43
|
-
export declare const prepareNewSchedulePayload: (transaction:
|
|
36
|
+
export declare const prepareNewSchedulePayload: (transaction: ScheduleTransaction, localData: NewScheduleLocalData | NewScheduleLocalDataFixedAssets, scheduleType: ScheduleTypes) => PrepareNewSchedulePayloadResult;
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.prepareNewSchedulePayload = exports.
|
|
3
|
+
exports.prepareNewSchedulePayload = exports.computeNewScheduleJeDetails = void 0;
|
|
4
4
|
const amount_1 = require("../../../commonStateTypes/amount");
|
|
5
5
|
const formatZeniDateFY_1 = require("../../../commonStateTypes/fiscalYearHelpers/formatZeniDateFY");
|
|
6
6
|
const formatZeniDateFY_2 = require("../../../commonStateTypes/fiscalYearHelpers/formatZeniDateFY");
|
|
7
7
|
const timePeriod_1 = require("../../../commonStateTypes/timePeriod");
|
|
8
|
-
const scheduleTransactionHelper_1 = require("../../../entity/transaction/scheduleTransactionHelper");
|
|
9
8
|
const scheduleDetailLocalDataHelper_1 = require("../../scheduleView/scheduleDetailView/scheduleDetailLocalDataHelper");
|
|
10
9
|
const scheduleDetailPayload_1 = require("../../scheduleView/scheduleDetailView/scheduleDetailPayload");
|
|
11
10
|
const getNewScheduleMemo = (vendorName, schedulePostingDate, currentPeriod, totalPeriod, assetId) => {
|
|
@@ -57,14 +56,6 @@ const computeNewScheduleJeDetails = (localData, totalAmount, vendorName) => {
|
|
|
57
56
|
return newJeDetails;
|
|
58
57
|
};
|
|
59
58
|
exports.computeNewScheduleJeDetails = computeNewScheduleJeDetails;
|
|
60
|
-
/**
|
|
61
|
-
* Whether a Base Transaction search result can be selected for a new
|
|
62
|
-
* schedule this round — restricted to single-line transactions since the
|
|
63
|
-
* search/list endpoint's `lines` may not reflect the transaction's full line
|
|
64
|
-
* set, and there is no line-picker UI yet.
|
|
65
|
-
*/
|
|
66
|
-
const isSupportedTransactionSelectableForNewSchedule = (transaction) => transaction.totalLinesCount === 1 && transaction.lines?.length === 1;
|
|
67
|
-
exports.isSupportedTransactionSelectableForNewSchedule = isSupportedTransactionSelectableForNewSchedule;
|
|
68
59
|
const mapNewJeDetailsToScheduledJournalEntryPayload = (jeScheduleDetails) => jeScheduleDetails.map((journalEntry) => ({
|
|
69
60
|
status: {
|
|
70
61
|
code: journalEntry.postingStatus,
|
|
@@ -94,15 +85,11 @@ const mapNewJeDetailsToScheduledJournalEntryPayload = (jeScheduleDetails) => jeS
|
|
|
94
85
|
* transaction/line plus what the user filled into the form).
|
|
95
86
|
*/
|
|
96
87
|
const prepareNewSchedulePayload = (transaction, localData, scheduleType) => {
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
firstLine == null) {
|
|
100
|
-
return { ok: false, reason: 'multi_line_not_supported' };
|
|
101
|
-
}
|
|
102
|
-
const scheduleTransaction = (0, scheduleTransactionHelper_1.mapSupportedTransactionLineToScheduleTransaction)(transaction, firstLine.id);
|
|
103
|
-
if (scheduleTransaction == null) {
|
|
88
|
+
if (transaction.thirdPartyTransactionId == null ||
|
|
89
|
+
transaction.thirdPartyTransactionId === '') {
|
|
104
90
|
return { ok: false, reason: 'missing_third_party_id' };
|
|
105
91
|
}
|
|
92
|
+
const scheduleTransaction = transaction;
|
|
106
93
|
const vendorId = localData.selectedVendor?.id ?? transaction.vendorId ?? '';
|
|
107
94
|
const vendorName = localData.selectedVendor?.name ?? transaction.vendorName ?? '';
|
|
108
95
|
if (vendorId === '' || vendorName === '') {
|
|
@@ -76,7 +76,7 @@ export declare const clearExpenseAutomationJESchedulesView: import("@reduxjs/too
|
|
|
76
76
|
}, "expenseAutomationJESchedulesView/searchTransactionsForNewSchedule", never, never>, searchTransactionsForNewScheduleFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
77
77
|
status: ZeniAPIStatus;
|
|
78
78
|
}, "expenseAutomationJESchedulesView/searchTransactionsForNewScheduleFailure">, searchTransactionsForNewScheduleSuccess: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
79
|
-
searchResults:
|
|
79
|
+
searchResults: JEScheduleTransactionKey[];
|
|
80
80
|
}, "expenseAutomationJESchedulesView/searchTransactionsForNewScheduleSuccess">, toggleJECreatedGroupCollapsed: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"expenseAutomationJESchedulesView/toggleJECreatedGroupCollapsed">, toggleJEPendingGroupCollapsed: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"expenseAutomationJESchedulesView/toggleJEPendingGroupCollapsed">, updateAccountSettingsListForAccountTypes: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
81
81
|
accountPayload: AccountMetadataPayload[];
|
|
82
82
|
}, "expenseAutomationJESchedulesView/updateAccountSettingsListForAccountTypes">, updateAccountSettingsListForAccountTypesFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
import { NestedAccountHierarchyForReport } from '../../../commonStateTypes/accountView/nestedAccountID';
|
|
2
2
|
import { NestedClassHierarchyForReport } from '../../../commonStateTypes/classesView/nestedClassID';
|
|
3
|
-
import { FetchStateAndError
|
|
3
|
+
import { FetchStateAndError } from '../../../commonStateTypes/common';
|
|
4
4
|
import { SelectorView } from '../../../commonStateTypes/viewAndReport/viewAndReport';
|
|
5
5
|
import { AccountBase } from '../../../entity/account/accountState';
|
|
6
6
|
import { ClassBase } from '../../../entity/class/classState';
|
|
7
7
|
import { ScheduleTypes } from '../../../entity/jeSchedules/jeSchedulesTypes';
|
|
8
|
-
import {
|
|
8
|
+
import { ScheduleTransaction } from '../../../entity/transaction/stateTypes/scheduleTransaction';
|
|
9
9
|
import { NewScheduleLocalData, NewScheduleLocalDataFixedAssets } from '../types/jeSchedulesViewState';
|
|
10
10
|
export interface NewScheduleSearchTransactionsView {
|
|
11
11
|
searchTransactionsFetchState: FetchStateAndError;
|
|
12
|
-
searchTransactionsResults:
|
|
13
|
-
selectableBaseTransactionIds: ID[];
|
|
12
|
+
searchTransactionsResults: ScheduleTransaction[];
|
|
14
13
|
searchTransactionsString?: string;
|
|
15
14
|
}
|
|
16
15
|
export interface NewScheduleView extends SelectorView, NewScheduleSearchTransactionsView {
|
|
@@ -8,7 +8,6 @@ const classListSelector_1 = require("../../classList/classListSelector");
|
|
|
8
8
|
const scheduleDetailLocalDataHelper_1 = require("../../scheduleView/scheduleDetailView/scheduleDetailLocalDataHelper");
|
|
9
9
|
const scheduleDetailSelector_1 = require("../../scheduleView/scheduleDetailView/scheduleDetailSelector");
|
|
10
10
|
const scheduleListHelper_1 = require("../../scheduleView/scheduleListView/scheduleListHelper");
|
|
11
|
-
const newScheduleLocalDataHelper_1 = require("../helpers/newScheduleLocalDataHelper");
|
|
12
11
|
/**
|
|
13
12
|
* The Base Transaction search is shared across schedule types (one search
|
|
14
13
|
* box, not one per prepaid_expenses/fixed_assets) — split out from
|
|
@@ -17,12 +16,11 @@ const newScheduleLocalDataHelper_1 = require("../helpers/newScheduleLocalDataHel
|
|
|
17
16
|
*/
|
|
18
17
|
const getNewScheduleSearchTransactionsView = (state) => {
|
|
19
18
|
const { searchTransactions } = state.expenseAutomationJESchedulesViewState.newSchedule;
|
|
20
|
-
const searchTransactionsResults =
|
|
19
|
+
const searchTransactionsResults = searchTransactions.searchResults
|
|
20
|
+
.map((key) => (0, transactionSelector_1.getScheduleTransactionById)(state.transactionState, key))
|
|
21
|
+
.filter((transaction) => transaction != null);
|
|
21
22
|
return {
|
|
22
23
|
searchTransactionsResults,
|
|
23
|
-
selectableBaseTransactionIds: searchTransactionsResults
|
|
24
|
-
.filter(newScheduleLocalDataHelper_1.isSupportedTransactionSelectableForNewSchedule)
|
|
25
|
-
.map((transaction) => transaction.id),
|
|
26
24
|
searchTransactionsFetchState: {
|
|
27
25
|
fetchState: searchTransactions.fetchState,
|
|
28
26
|
error: searchTransactions.error,
|
|
@@ -5,8 +5,7 @@ import { Recommendation } from '../../../commonStateTypes/recommendationBase';
|
|
|
5
5
|
import { SortOrder } from '../../../commonStateTypes/selectorTypes/sortOrderTypes';
|
|
6
6
|
import { MonthYearPeriodId, ScheduleDaysOfMonth } from '../../../commonStateTypes/timePeriod';
|
|
7
7
|
import { AccountBase } from '../../../entity/account/accountState';
|
|
8
|
-
import { JEScheduleTransactionKey, ScheduleJournalEntryStatusCodeType, ScheduleTypes } from '../../../entity/jeSchedules/jeSchedulesTypes';
|
|
9
|
-
import { TransactionID } from '../../../entity/transaction/stateTypes/transaction';
|
|
8
|
+
import { JEScheduleTransactionKey, ScheduleJournalEntryStatusCodeType, ScheduleTransactionID, ScheduleTypes } from '../../../entity/jeSchedules/jeSchedulesTypes';
|
|
10
9
|
import { VendorBase } from '../../../entity/vendor/vendorState';
|
|
11
10
|
import { ZeniDate } from '../../../zeniDayJS';
|
|
12
11
|
import { JETransactionLink } from '../../scheduleView/scheduleDetailView/scheduleDetailState';
|
|
@@ -62,7 +61,7 @@ export interface NewScheduleLocalData {
|
|
|
62
61
|
scheduleType: ScheduleTypes;
|
|
63
62
|
lastDayOfMonth?: boolean;
|
|
64
63
|
selectedAccount?: ID;
|
|
65
|
-
selectedBaseTransactionId?:
|
|
64
|
+
selectedBaseTransactionId?: ScheduleTransactionID;
|
|
66
65
|
selectedClass?: ID;
|
|
67
66
|
selectedDate?: ZeniDate;
|
|
68
67
|
selectedDayOfMonth?: ScheduleDaysOfMonth;
|
|
@@ -75,7 +74,7 @@ export interface NewScheduleLocalDataFixedAssets extends NewScheduleLocalData {
|
|
|
75
74
|
selectedAccumulatedDepreciationCategory?: ID;
|
|
76
75
|
}
|
|
77
76
|
export interface SearchTransactionsState extends FetchStateAndError {
|
|
78
|
-
searchResults:
|
|
77
|
+
searchResults: JEScheduleTransactionKey[];
|
|
79
78
|
searchString?: string;
|
|
80
79
|
}
|
|
81
80
|
export declare const MIN_NEW_SCHEDULE_SEARCH_LENGTH = 2;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zeniai/client-epic-state",
|
|
3
|
-
"version": "5.1.62-
|
|
3
|
+
"version": "5.1.62-betaRD3",
|
|
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",
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { ID } from '../../commonStateTypes/common';
|
|
2
|
-
import { ScheduleTransaction } from './stateTypes/scheduleTransaction';
|
|
3
|
-
import { Line, TransactionWithAccountAndClassLine } from './stateTypes/transactionLine';
|
|
4
|
-
import { SupportedTransaction } from './transactionState';
|
|
5
|
-
export declare function hasAccountAndClassDetail(line: Line): line is TransactionWithAccountAndClassLine;
|
|
6
|
-
/**
|
|
7
|
-
* Builds a ScheduleTransaction directly from a Base Transaction search result
|
|
8
|
-
* (SupportedTransaction) and the chosen line, for schedule types where the
|
|
9
|
-
* user selects a transaction the search endpoint already returned — as
|
|
10
|
-
* opposed to the legacy flow's ScheduleTransaction, which only ever arrives
|
|
11
|
-
* via a GET /1.0/schedules/:id round trip. transaction.qboId stands in for
|
|
12
|
-
* thirdPartyTransactionId since this search endpoint doesn't send a field by
|
|
13
|
-
* that name, but qbo_id is the same identifier.
|
|
14
|
-
*/
|
|
15
|
-
export declare function mapSupportedTransactionLineToScheduleTransaction(transaction: SupportedTransaction, lineId: ID): ScheduleTransaction | undefined;
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.hasAccountAndClassDetail = hasAccountAndClassDetail;
|
|
4
|
-
exports.mapSupportedTransactionLineToScheduleTransaction = mapSupportedTransactionLineToScheduleTransaction;
|
|
5
|
-
function hasAccountAndClassDetail(line) {
|
|
6
|
-
return 'account' in line;
|
|
7
|
-
}
|
|
8
|
-
/**
|
|
9
|
-
* Builds a ScheduleTransaction directly from a Base Transaction search result
|
|
10
|
-
* (SupportedTransaction) and the chosen line, for schedule types where the
|
|
11
|
-
* user selects a transaction the search endpoint already returned — as
|
|
12
|
-
* opposed to the legacy flow's ScheduleTransaction, which only ever arrives
|
|
13
|
-
* via a GET /1.0/schedules/:id round trip. transaction.qboId stands in for
|
|
14
|
-
* thirdPartyTransactionId since this search endpoint doesn't send a field by
|
|
15
|
-
* that name, but qbo_id is the same identifier.
|
|
16
|
-
*/
|
|
17
|
-
function mapSupportedTransactionLineToScheduleTransaction(transaction, lineId) {
|
|
18
|
-
if (transaction.qboId == null || transaction.qboId === '') {
|
|
19
|
-
return undefined;
|
|
20
|
-
}
|
|
21
|
-
const line = transaction.lines?.find((candidate) => candidate.id === lineId);
|
|
22
|
-
if (line == null || !hasAccountAndClassDetail(line)) {
|
|
23
|
-
return undefined;
|
|
24
|
-
}
|
|
25
|
-
return {
|
|
26
|
-
id: transaction.id,
|
|
27
|
-
type: transaction.type,
|
|
28
|
-
typeOfTransaction: 'schedule',
|
|
29
|
-
typeName: transaction.typeName,
|
|
30
|
-
date: transaction.date,
|
|
31
|
-
memo: transaction.memo,
|
|
32
|
-
description: transaction.description,
|
|
33
|
-
lineId: line.id,
|
|
34
|
-
thirdPartyTransactionId: transaction.qboId,
|
|
35
|
-
account: line.account,
|
|
36
|
-
classBase: line.class,
|
|
37
|
-
amount: line.amount,
|
|
38
|
-
currency: {
|
|
39
|
-
currencyCode: line.amount.currencyCode,
|
|
40
|
-
currencySymbol: line.amount.currencySymbol,
|
|
41
|
-
},
|
|
42
|
-
};
|
|
43
|
-
}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
export function hasAccountAndClassDetail(line) {
|
|
2
|
-
return 'account' in line;
|
|
3
|
-
}
|
|
4
|
-
/**
|
|
5
|
-
* Builds a ScheduleTransaction directly from a Base Transaction search result
|
|
6
|
-
* (SupportedTransaction) and the chosen line, for schedule types where the
|
|
7
|
-
* user selects a transaction the search endpoint already returned — as
|
|
8
|
-
* opposed to the legacy flow's ScheduleTransaction, which only ever arrives
|
|
9
|
-
* via a GET /1.0/schedules/:id round trip. transaction.qboId stands in for
|
|
10
|
-
* thirdPartyTransactionId since this search endpoint doesn't send a field by
|
|
11
|
-
* that name, but qbo_id is the same identifier.
|
|
12
|
-
*/
|
|
13
|
-
export function mapSupportedTransactionLineToScheduleTransaction(transaction, lineId) {
|
|
14
|
-
if (transaction.qboId == null || transaction.qboId === '') {
|
|
15
|
-
return undefined;
|
|
16
|
-
}
|
|
17
|
-
const line = transaction.lines?.find((candidate) => candidate.id === lineId);
|
|
18
|
-
if (line == null || !hasAccountAndClassDetail(line)) {
|
|
19
|
-
return undefined;
|
|
20
|
-
}
|
|
21
|
-
return {
|
|
22
|
-
id: transaction.id,
|
|
23
|
-
type: transaction.type,
|
|
24
|
-
typeOfTransaction: 'schedule',
|
|
25
|
-
typeName: transaction.typeName,
|
|
26
|
-
date: transaction.date,
|
|
27
|
-
memo: transaction.memo,
|
|
28
|
-
description: transaction.description,
|
|
29
|
-
lineId: line.id,
|
|
30
|
-
thirdPartyTransactionId: transaction.qboId,
|
|
31
|
-
account: line.account,
|
|
32
|
-
classBase: line.class,
|
|
33
|
-
amount: line.amount,
|
|
34
|
-
currency: {
|
|
35
|
-
currencyCode: line.amount.currencyCode,
|
|
36
|
-
currencySymbol: line.amount.currencySymbol,
|
|
37
|
-
},
|
|
38
|
-
};
|
|
39
|
-
}
|