@zeniai/client-epic-state 5.2.62-beta0KB → 5.2.62-beta0MM
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/actualMatching/actualMatchingReducer.d.ts +3 -1
- package/lib/entity/actualMatching/actualMatchingReducer.js +11 -2
- package/lib/entity/jeSchedules/jeSchedulesPayload.d.ts +1 -0
- package/lib/entity/jeSchedules/jeSchedulesPayload.js +1 -0
- package/lib/entity/jeSchedules/jeSchedulesState.d.ts +1 -0
- package/lib/entity/snackbar/snackbarTypes.d.ts +1 -1
- package/lib/entity/snackbar/snackbarTypes.js +1 -1
- package/lib/entity/transaction/stateTypes/paymentType.d.ts +2 -2
- package/lib/entity/transaction/stateTypes/paymentType.js +1 -9
- package/lib/epic.d.ts +2 -4
- package/lib/epic.js +2 -6
- package/lib/esm/entity/actualMatching/actualMatchingReducer.js +9 -1
- package/lib/esm/entity/jeSchedules/jeSchedulesPayload.js +1 -0
- package/lib/esm/entity/snackbar/snackbarTypes.js +1 -1
- package/lib/esm/entity/transaction/stateTypes/paymentType.js +1 -9
- package/lib/esm/epic.js +2 -6
- package/lib/esm/index.js +7 -10
- package/lib/esm/view/expenseAutomationView/epics/jeSchedule/actualMatching/ignoreActualMatchingSuggestionEpic.js +50 -0
- package/lib/esm/view/expenseAutomationView/epics/jeSchedule/actualMatching/matchAndReverseAccrualsEpic.js +7 -3
- package/lib/esm/view/expenseAutomationView/epics/jeSchedule/actualMatching/searchMatchTransactionsEpic.js +2 -23
- package/lib/esm/view/expenseAutomationView/reducers/actualMatchingViewReducer.js +66 -35
- package/lib/esm/view/expenseAutomationView/selectors/actualMatchingViewSelector.js +60 -64
- package/lib/esm/view/expenseAutomationView/types/actualMatchingViewState.js +15 -0
- package/lib/esm/view/spendManagement/billPay/editBillView/editBillViewSelector.js +30 -4
- package/lib/esm/view/transactionDetail/transactionDetailReducer.js +1 -174
- package/lib/index.d.ts +8 -12
- package/lib/index.js +57 -70
- package/lib/view/expenseAutomationView/epics/jeSchedule/actualMatching/ignoreActualMatchingSuggestionEpic.d.ts +10 -0
- package/lib/view/expenseAutomationView/epics/jeSchedule/actualMatching/ignoreActualMatchingSuggestionEpic.js +54 -0
- package/lib/view/expenseAutomationView/epics/jeSchedule/actualMatching/matchAndReverseAccrualsEpic.js +7 -3
- package/lib/view/expenseAutomationView/epics/jeSchedule/actualMatching/searchMatchTransactionsEpic.js +1 -22
- package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.d.ts +1 -1
- package/lib/view/expenseAutomationView/payload/actualMatchingPayload.d.ts +12 -1
- package/lib/view/expenseAutomationView/reducers/actualMatchingViewReducer.d.ts +16 -8
- package/lib/view/expenseAutomationView/reducers/actualMatchingViewReducer.js +67 -36
- package/lib/view/expenseAutomationView/selectorTypes/actualMatchingViewSelectorTypes.d.ts +20 -8
- package/lib/view/expenseAutomationView/selectors/actualMatchingViewSelector.d.ts +7 -4
- package/lib/view/expenseAutomationView/selectors/actualMatchingViewSelector.js +63 -64
- package/lib/view/expenseAutomationView/types/actualMatchingViewState.d.ts +20 -4
- package/lib/view/expenseAutomationView/types/actualMatchingViewState.js +18 -1
- package/lib/view/spendManagement/billPay/editBillView/editBillViewSelector.d.ts +1 -1
- package/lib/view/spendManagement/billPay/editBillView/editBillViewSelector.js +30 -4
- package/lib/view/transactionDetail/transactionDetailReducer.d.ts +1 -37
- package/lib/view/transactionDetail/transactionDetailReducer.js +2 -176
- package/lib/view/transactionDetail/transactionDetailState.d.ts +0 -12
- package/package.json +1 -1
- package/lib/entity/transaction/stateTypes/printStatus.d.ts +0 -4
- package/lib/entity/transaction/stateTypes/printStatus.js +0 -15
- package/lib/esm/entity/transaction/stateTypes/printStatus.js +0 -11
- package/lib/esm/view/transactionDetail/createTransaction/createTransactionLocalDataHelper.js +0 -133
- package/lib/esm/view/transactionDetail/createTransaction/createTransactionPayload.js +0 -114
- package/lib/esm/view/transactionDetail/createTransaction/createTransactionSelector.js +0 -41
- package/lib/esm/view/transactionDetail/createTransaction/createTransactionState.js +0 -11
- package/lib/esm/view/transactionDetail/createTransaction/epics/createTransactionEpic.js +0 -58
- package/lib/esm/view/transactionDetail/createTransaction/epics/fetchVendorRecommendationsForCreateTransactionEpic.js +0 -55
- package/lib/esm/view/transactionDetail/createTransaction/epics/initializeCreateTransactionLocalDataEpic.js +0 -14
- package/lib/view/transactionDetail/createTransaction/createTransactionLocalDataHelper.d.ts +0 -51
- package/lib/view/transactionDetail/createTransaction/createTransactionLocalDataHelper.js +0 -148
- package/lib/view/transactionDetail/createTransaction/createTransactionPayload.d.ts +0 -82
- package/lib/view/transactionDetail/createTransaction/createTransactionPayload.js +0 -118
- package/lib/view/transactionDetail/createTransaction/createTransactionSelector.d.ts +0 -40
- package/lib/view/transactionDetail/createTransaction/createTransactionSelector.js +0 -48
- package/lib/view/transactionDetail/createTransaction/createTransactionState.d.ts +0 -81
- package/lib/view/transactionDetail/createTransaction/createTransactionState.js +0 -14
- package/lib/view/transactionDetail/createTransaction/epics/createTransactionEpic.d.ts +0 -9
- package/lib/view/transactionDetail/createTransaction/epics/createTransactionEpic.js +0 -62
- package/lib/view/transactionDetail/createTransaction/epics/fetchVendorRecommendationsForCreateTransactionEpic.d.ts +0 -20
- package/lib/view/transactionDetail/createTransaction/epics/fetchVendorRecommendationsForCreateTransactionEpic.js +0 -59
- package/lib/view/transactionDetail/createTransaction/epics/initializeCreateTransactionLocalDataEpic.d.ts +0 -12
- package/lib/view/transactionDetail/createTransaction/epics/initializeCreateTransactionLocalDataEpic.js +0 -18
|
@@ -4,13 +4,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
var _a;
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.
|
|
8
|
-
exports.fetchVendorRecommendationsForCreateTransaction = exports.clearRecommendationsForCreateTransactionLines = exports.setRecommendationsForCreateTransactionLines = exports.createTransactionSuccessOrFailure = void 0;
|
|
7
|
+
exports.toggleSplitEditMode = exports.deleteSplitLine = exports.addSplitLine = exports.setIsVendorUpdateAllChecked = exports.updateVendorBulkRecommendationsFetchStatus = exports.updateLatestSelectedEntity = exports.resetAllLineItemsToVendor = exports.updateVendorToAllLineItems = exports.updateLocalDataWithTransactionsUpdateWithVendorCheckbox = exports.resetSelectedCustomer = exports.resetVendor = exports.updateSelectedCustomer = exports.updateSelectedVendor = exports.removeEntityRecommendationForLineIdForTransactionDetail = exports.markCategoryClassRecommendationsFailureForTransactionDetail = exports.markCategoryClassRecommendationsCompletedForTransactionDetail = exports.markCategoryClassRecommendationsInProgressForTransactionDetail = exports.setEntityRecommendationForLineIdsForTransactionDetail = exports.setAllLineItemsLocalDataIsUpdateAllChecked = exports.setAllLineItemsToCategoryClassInLocalData = exports.resetLineItemsCategoryClassInLocalData = exports.clearTransactionDetailLocalData = exports.saveTransactionDetailLocalData = exports.initializeTransactionDetailLocalData = exports.saveTransactionDetail = exports.updateTransactionStateIfUpdateActionNotAllowed = exports.updateStatusConsolidatedSaveTransactionDetail = exports.updateStatusForTransactionNotMiscategorizedUpdate = exports.deleteTransactionAttachmentSuccess = exports.deleteTransactionAttachmentFailure = exports.deleteTransactionAttachment = exports.markTransactionAsNotMiscategorized = exports.clearTransactionDetailSaveStatus = exports.updateTransactionDetailSaveStatus = exports.updateTransactionDetail = exports.uploadMissingAttachmentSuccess = exports.removeTransactionDetail = exports.updateTransactionDetailFetchState = exports.fetchTransactionDetail = exports.downloadAccountingProviderAttachmentFailure = exports.downloadAccountingProviderAttachmentSuccess = exports.downloadAccountingProviderAttachment = exports.initialState = void 0;
|
|
9
8
|
const toolkit_1 = require("@reduxjs/toolkit");
|
|
10
9
|
const get_1 = __importDefault(require("lodash/get"));
|
|
11
10
|
const entity_1 = require("../../entity/genericEntity/entity");
|
|
12
11
|
const rootActions_1 = require("../../rootActions");
|
|
13
|
-
const createTransactionLocalDataHelper_1 = require("./createTransaction/createTransactionLocalDataHelper");
|
|
14
12
|
const transactionDetailLocalDataHelper_1 = require("./transactionDetailLocalDataHelper");
|
|
15
13
|
const transactionDetailState_1 = require("./transactionDetailState");
|
|
16
14
|
exports.initialState = {
|
|
@@ -19,10 +17,6 @@ exports.initialState = {
|
|
|
19
17
|
fetchState: 'Not-Started',
|
|
20
18
|
attachmentDataByID: {},
|
|
21
19
|
},
|
|
22
|
-
createTransactionsState: {
|
|
23
|
-
createStatus: { fetchState: 'Not-Started' },
|
|
24
|
-
newTransactionState: (0, createTransactionLocalDataHelper_1.getInitialCreateTransactionLocalDataByType)(),
|
|
25
|
-
},
|
|
26
20
|
};
|
|
27
21
|
const transactionDetail = (0, toolkit_1.createSlice)({
|
|
28
22
|
name: 'transactionDetail',
|
|
@@ -842,174 +836,6 @@ const transactionDetail = (0, toolkit_1.createSlice)({
|
|
|
842
836
|
};
|
|
843
837
|
},
|
|
844
838
|
},
|
|
845
|
-
// ---------------------------------------------------------------------------------
|
|
846
|
-
// Create Transaction
|
|
847
|
-
//
|
|
848
|
-
// These live on the transactionDetail slice rather than in createTransaction/ because a
|
|
849
|
-
// createSlice owns exactly one state object, and createTransactionsState is nested inside
|
|
850
|
-
// TransactionDetailState. The derivation itself stays in the folder -- each body below
|
|
851
|
-
// delegates to createTransactionLocalDataHelper.ts.
|
|
852
|
-
//
|
|
853
|
-
// They need no clearAll case of their own: the slice already resets to initialState on
|
|
854
|
-
// tenant switch, and createTransactionsState is part of it.
|
|
855
|
-
// ---------------------------------------------------------------------------------
|
|
856
|
-
/** Trigger only -- initializeCreateTransactionLocalDataEpic does the seeding. */
|
|
857
|
-
initializeCreateTransactionLocalData: {
|
|
858
|
-
reducer(
|
|
859
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
860
|
-
_draft,
|
|
861
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
862
|
-
_action) {
|
|
863
|
-
// no-op
|
|
864
|
-
},
|
|
865
|
-
prepare(transactionType) {
|
|
866
|
-
return { payload: { transactionType } };
|
|
867
|
-
},
|
|
868
|
-
},
|
|
869
|
-
updateCreateTransactionLocalData: {
|
|
870
|
-
reducer(draft, action) {
|
|
871
|
-
const { transactionType, localData } = action.payload;
|
|
872
|
-
const current = draft.createTransactionsState.newTransactionState[transactionType];
|
|
873
|
-
draft.createTransactionsState.newTransactionState[transactionType] =
|
|
874
|
-
(0, createTransactionLocalDataHelper_1.mergeCreateTransactionLocalData)(current, localData);
|
|
875
|
-
},
|
|
876
|
-
prepare(transactionType, localData) {
|
|
877
|
-
return { payload: { transactionType, localData } };
|
|
878
|
-
},
|
|
879
|
-
},
|
|
880
|
-
updateCreateTransactionLineLocalData: {
|
|
881
|
-
reducer(draft, action) {
|
|
882
|
-
const { transactionType, lineId, lineUpdates } = action.payload;
|
|
883
|
-
const current = draft.createTransactionsState.newTransactionState[transactionType];
|
|
884
|
-
current.lines = (0, createTransactionLocalDataHelper_1.updateCreateTransactionLine)(current.lines, lineId, lineUpdates);
|
|
885
|
-
},
|
|
886
|
-
prepare(transactionType, lineId, lineUpdates) {
|
|
887
|
-
return { payload: { transactionType, lineId, lineUpdates } };
|
|
888
|
-
},
|
|
889
|
-
},
|
|
890
|
-
/**
|
|
891
|
-
* `line` is supplied by the caller rather than built here, so a row added after a vendor is
|
|
892
|
-
* already chosen can arrive pre-populated from the cached recommendations instead of blank.
|
|
893
|
-
*/
|
|
894
|
-
addCreateTransactionLine: {
|
|
895
|
-
reducer(draft, action) {
|
|
896
|
-
const { transactionType, line } = action.payload;
|
|
897
|
-
draft.createTransactionsState.newTransactionState[transactionType].lines.push({
|
|
898
|
-
...line,
|
|
899
|
-
id: (0, createTransactionLocalDataHelper_1.nextCreateTransactionLineId)(),
|
|
900
|
-
});
|
|
901
|
-
},
|
|
902
|
-
prepare(transactionType, line) {
|
|
903
|
-
return { payload: { transactionType, line } };
|
|
904
|
-
},
|
|
905
|
-
},
|
|
906
|
-
removeCreateTransactionLine: {
|
|
907
|
-
reducer(draft, action) {
|
|
908
|
-
const { transactionType, lineId } = action.payload;
|
|
909
|
-
const current = draft.createTransactionsState.newTransactionState[transactionType];
|
|
910
|
-
current.lines = current.lines.filter((line) => line.id !== lineId);
|
|
911
|
-
},
|
|
912
|
-
prepare(transactionType, lineId) {
|
|
913
|
-
return { payload: { transactionType, lineId } };
|
|
914
|
-
},
|
|
915
|
-
},
|
|
916
|
-
/**
|
|
917
|
-
* Restores the blank working copy AND re-seeds it, so reopening Create starts from a fresh
|
|
918
|
-
* form rather than the previous transaction's values.
|
|
919
|
-
*/
|
|
920
|
-
resetCreateTransactionLocalData: {
|
|
921
|
-
reducer(draft, action) {
|
|
922
|
-
const { transactionType } = action.payload;
|
|
923
|
-
draft.createTransactionsState.newTransactionState[transactionType] =
|
|
924
|
-
(0, createTransactionLocalDataHelper_1.getSeededCreateTransactionLocalData)(transactionType);
|
|
925
|
-
draft.createTransactionsState.createStatus = {
|
|
926
|
-
fetchState: 'Not-Started',
|
|
927
|
-
};
|
|
928
|
-
draft.createTransactionsState.createdTransactionId = undefined;
|
|
929
|
-
},
|
|
930
|
-
prepare(transactionType) {
|
|
931
|
-
return { payload: { transactionType } };
|
|
932
|
-
},
|
|
933
|
-
},
|
|
934
|
-
/** Submit trigger -- createTransactionEpic builds the payload from localData. */
|
|
935
|
-
createTransaction: {
|
|
936
|
-
reducer(draft,
|
|
937
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
938
|
-
_action) {
|
|
939
|
-
draft.createTransactionsState.createStatus = {
|
|
940
|
-
fetchState: 'In-Progress',
|
|
941
|
-
};
|
|
942
|
-
draft.createTransactionsState.createdTransactionId = undefined;
|
|
943
|
-
},
|
|
944
|
-
prepare(transactionType) {
|
|
945
|
-
return { payload: { transactionType } };
|
|
946
|
-
},
|
|
947
|
-
},
|
|
948
|
-
/**
|
|
949
|
-
* Trigger only -- fetchVendorRecommendationsForCreateTransactionEpic does the work.
|
|
950
|
-
* A null entity means the vendor was cleared.
|
|
951
|
-
*/
|
|
952
|
-
fetchVendorRecommendationsForCreateTransaction: {
|
|
953
|
-
reducer(
|
|
954
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
955
|
-
_draft,
|
|
956
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
957
|
-
_action) {
|
|
958
|
-
// no-op
|
|
959
|
-
},
|
|
960
|
-
prepare(transactionType, lineIds, entity) {
|
|
961
|
-
return { payload: { transactionType, lineIds, entity } };
|
|
962
|
-
},
|
|
963
|
-
},
|
|
964
|
-
/**
|
|
965
|
-
* Writes a vendor's recommendations into the named lines. `lineIds` is explicit rather than
|
|
966
|
-
* "all lines" because a journal entry recommends per line, from that line's own entity.
|
|
967
|
-
*/
|
|
968
|
-
setRecommendationsForCreateTransactionLines: {
|
|
969
|
-
reducer(draft, action) {
|
|
970
|
-
const { transactionType, lineIds, recommendations, isAccountingClassesEnabled, } = action.payload;
|
|
971
|
-
const current = draft.createTransactionsState.newTransactionState[transactionType];
|
|
972
|
-
current.lines = current.lines.map((line) => lineIds.includes(line.id)
|
|
973
|
-
? (0, createTransactionLocalDataHelper_1.applyRecommendationsToCreateTransactionLine)(line, recommendations, isAccountingClassesEnabled)
|
|
974
|
-
: line);
|
|
975
|
-
},
|
|
976
|
-
prepare(transactionType, lineIds, recommendations, isAccountingClassesEnabled) {
|
|
977
|
-
return {
|
|
978
|
-
payload: {
|
|
979
|
-
transactionType,
|
|
980
|
-
lineIds,
|
|
981
|
-
recommendations,
|
|
982
|
-
isAccountingClassesEnabled,
|
|
983
|
-
},
|
|
984
|
-
};
|
|
985
|
-
},
|
|
986
|
-
},
|
|
987
|
-
/** Vendor cleared: drop the dropdown group and undo only what the prefill wrote. */
|
|
988
|
-
clearRecommendationsForCreateTransactionLines: {
|
|
989
|
-
reducer(draft, action) {
|
|
990
|
-
const { transactionType, lineIds } = action.payload;
|
|
991
|
-
const current = draft.createTransactionsState.newTransactionState[transactionType];
|
|
992
|
-
current.lines = current.lines.map((line) => lineIds.includes(line.id)
|
|
993
|
-
? (0, createTransactionLocalDataHelper_1.clearRecommendationsFromCreateTransactionLine)(line)
|
|
994
|
-
: line);
|
|
995
|
-
},
|
|
996
|
-
prepare(transactionType, lineIds) {
|
|
997
|
-
return { payload: { transactionType, lineIds } };
|
|
998
|
-
},
|
|
999
|
-
},
|
|
1000
|
-
createTransactionSuccessOrFailure: {
|
|
1001
|
-
reducer(draft, action) {
|
|
1002
|
-
const { fetchState, error, createdTransactionId } = action.payload;
|
|
1003
|
-
draft.createTransactionsState.createStatus = { fetchState, error };
|
|
1004
|
-
if (createdTransactionId != null) {
|
|
1005
|
-
draft.createTransactionsState.createdTransactionId =
|
|
1006
|
-
createdTransactionId;
|
|
1007
|
-
}
|
|
1008
|
-
},
|
|
1009
|
-
prepare(fetchState, createdTransactionId, error) {
|
|
1010
|
-
return { payload: { fetchState, createdTransactionId, error } };
|
|
1011
|
-
},
|
|
1012
|
-
},
|
|
1013
839
|
},
|
|
1014
840
|
extraReducers: (builder) => {
|
|
1015
841
|
builder.addCase(rootActions_1.clearAll, (draft) => {
|
|
@@ -1017,7 +843,7 @@ const transactionDetail = (0, toolkit_1.createSlice)({
|
|
|
1017
843
|
});
|
|
1018
844
|
},
|
|
1019
845
|
});
|
|
1020
|
-
_a = transactionDetail.actions, exports.downloadAccountingProviderAttachment = _a.downloadAccountingProviderAttachment, exports.downloadAccountingProviderAttachmentSuccess = _a.downloadAccountingProviderAttachmentSuccess, exports.downloadAccountingProviderAttachmentFailure = _a.downloadAccountingProviderAttachmentFailure, exports.fetchTransactionDetail = _a.fetchTransactionDetail, exports.updateTransactionDetailFetchState = _a.updateTransactionDetailFetchState, exports.removeTransactionDetail = _a.removeTransactionDetail, exports.uploadMissingAttachmentSuccess = _a.uploadMissingAttachmentSuccess, exports.updateTransactionDetail = _a.updateTransactionDetail, exports.updateTransactionDetailSaveStatus = _a.updateTransactionDetailSaveStatus, exports.clearTransactionDetailSaveStatus = _a.clearTransactionDetailSaveStatus, exports.markTransactionAsNotMiscategorized = _a.markTransactionAsNotMiscategorized, exports.deleteTransactionAttachment = _a.deleteTransactionAttachment, exports.deleteTransactionAttachmentFailure = _a.deleteTransactionAttachmentFailure, exports.deleteTransactionAttachmentSuccess = _a.deleteTransactionAttachmentSuccess, exports.updateStatusForTransactionNotMiscategorizedUpdate = _a.updateStatusForTransactionNotMiscategorizedUpdate, exports.updateStatusConsolidatedSaveTransactionDetail = _a.updateStatusConsolidatedSaveTransactionDetail, exports.updateTransactionStateIfUpdateActionNotAllowed = _a.updateTransactionStateIfUpdateActionNotAllowed, exports.saveTransactionDetail = _a.saveTransactionDetail, exports.initializeTransactionDetailLocalData = _a.initializeTransactionDetailLocalData, exports.saveTransactionDetailLocalData = _a.saveTransactionDetailLocalData, exports.clearTransactionDetailLocalData = _a.clearTransactionDetailLocalData, exports.resetLineItemsCategoryClassInLocalData = _a.resetLineItemsCategoryClassInLocalData, exports.setAllLineItemsToCategoryClassInLocalData = _a.setAllLineItemsToCategoryClassInLocalData, exports.setAllLineItemsLocalDataIsUpdateAllChecked = _a.setAllLineItemsLocalDataIsUpdateAllChecked, exports.setEntityRecommendationForLineIdsForTransactionDetail = _a.setEntityRecommendationForLineIdsForTransactionDetail, exports.markCategoryClassRecommendationsInProgressForTransactionDetail = _a.markCategoryClassRecommendationsInProgressForTransactionDetail, exports.markCategoryClassRecommendationsCompletedForTransactionDetail = _a.markCategoryClassRecommendationsCompletedForTransactionDetail, exports.markCategoryClassRecommendationsFailureForTransactionDetail = _a.markCategoryClassRecommendationsFailureForTransactionDetail, exports.removeEntityRecommendationForLineIdForTransactionDetail = _a.removeEntityRecommendationForLineIdForTransactionDetail, exports.updateSelectedVendor = _a.updateSelectedVendor, exports.updateSelectedCustomer = _a.updateSelectedCustomer, exports.resetVendor = _a.resetVendor, exports.resetSelectedCustomer = _a.resetSelectedCustomer, exports.updateLocalDataWithTransactionsUpdateWithVendorCheckbox = _a.updateLocalDataWithTransactionsUpdateWithVendorCheckbox, exports.updateVendorToAllLineItems = _a.updateVendorToAllLineItems, exports.resetAllLineItemsToVendor = _a.resetAllLineItemsToVendor, exports.updateLatestSelectedEntity = _a.updateLatestSelectedEntity, exports.updateVendorBulkRecommendationsFetchStatus = _a.updateVendorBulkRecommendationsFetchStatus, exports.setIsVendorUpdateAllChecked = _a.setIsVendorUpdateAllChecked, exports.addSplitLine = _a.addSplitLine, exports.deleteSplitLine = _a.deleteSplitLine, exports.toggleSplitEditMode = _a.toggleSplitEditMode
|
|
846
|
+
_a = transactionDetail.actions, exports.downloadAccountingProviderAttachment = _a.downloadAccountingProviderAttachment, exports.downloadAccountingProviderAttachmentSuccess = _a.downloadAccountingProviderAttachmentSuccess, exports.downloadAccountingProviderAttachmentFailure = _a.downloadAccountingProviderAttachmentFailure, exports.fetchTransactionDetail = _a.fetchTransactionDetail, exports.updateTransactionDetailFetchState = _a.updateTransactionDetailFetchState, exports.removeTransactionDetail = _a.removeTransactionDetail, exports.uploadMissingAttachmentSuccess = _a.uploadMissingAttachmentSuccess, exports.updateTransactionDetail = _a.updateTransactionDetail, exports.updateTransactionDetailSaveStatus = _a.updateTransactionDetailSaveStatus, exports.clearTransactionDetailSaveStatus = _a.clearTransactionDetailSaveStatus, exports.markTransactionAsNotMiscategorized = _a.markTransactionAsNotMiscategorized, exports.deleteTransactionAttachment = _a.deleteTransactionAttachment, exports.deleteTransactionAttachmentFailure = _a.deleteTransactionAttachmentFailure, exports.deleteTransactionAttachmentSuccess = _a.deleteTransactionAttachmentSuccess, exports.updateStatusForTransactionNotMiscategorizedUpdate = _a.updateStatusForTransactionNotMiscategorizedUpdate, exports.updateStatusConsolidatedSaveTransactionDetail = _a.updateStatusConsolidatedSaveTransactionDetail, exports.updateTransactionStateIfUpdateActionNotAllowed = _a.updateTransactionStateIfUpdateActionNotAllowed, exports.saveTransactionDetail = _a.saveTransactionDetail, exports.initializeTransactionDetailLocalData = _a.initializeTransactionDetailLocalData, exports.saveTransactionDetailLocalData = _a.saveTransactionDetailLocalData, exports.clearTransactionDetailLocalData = _a.clearTransactionDetailLocalData, exports.resetLineItemsCategoryClassInLocalData = _a.resetLineItemsCategoryClassInLocalData, exports.setAllLineItemsToCategoryClassInLocalData = _a.setAllLineItemsToCategoryClassInLocalData, exports.setAllLineItemsLocalDataIsUpdateAllChecked = _a.setAllLineItemsLocalDataIsUpdateAllChecked, exports.setEntityRecommendationForLineIdsForTransactionDetail = _a.setEntityRecommendationForLineIdsForTransactionDetail, exports.markCategoryClassRecommendationsInProgressForTransactionDetail = _a.markCategoryClassRecommendationsInProgressForTransactionDetail, exports.markCategoryClassRecommendationsCompletedForTransactionDetail = _a.markCategoryClassRecommendationsCompletedForTransactionDetail, exports.markCategoryClassRecommendationsFailureForTransactionDetail = _a.markCategoryClassRecommendationsFailureForTransactionDetail, exports.removeEntityRecommendationForLineIdForTransactionDetail = _a.removeEntityRecommendationForLineIdForTransactionDetail, exports.updateSelectedVendor = _a.updateSelectedVendor, exports.updateSelectedCustomer = _a.updateSelectedCustomer, exports.resetVendor = _a.resetVendor, exports.resetSelectedCustomer = _a.resetSelectedCustomer, exports.updateLocalDataWithTransactionsUpdateWithVendorCheckbox = _a.updateLocalDataWithTransactionsUpdateWithVendorCheckbox, exports.updateVendorToAllLineItems = _a.updateVendorToAllLineItems, exports.resetAllLineItemsToVendor = _a.resetAllLineItemsToVendor, exports.updateLatestSelectedEntity = _a.updateLatestSelectedEntity, exports.updateVendorBulkRecommendationsFetchStatus = _a.updateVendorBulkRecommendationsFetchStatus, exports.setIsVendorUpdateAllChecked = _a.setIsVendorUpdateAllChecked, exports.addSplitLine = _a.addSplitLine, exports.deleteSplitLine = _a.deleteSplitLine, exports.toggleSplitEditMode = _a.toggleSplitEditMode;
|
|
1021
847
|
exports.default = transactionDetail.reducer;
|
|
1022
848
|
function getUpdatedEntityLocalData(detail, updates, entity, resetRecommendations, type) {
|
|
1023
849
|
const key = type === 'customer' ? 'customerUpdates' : 'vendorUpdates';
|
|
@@ -11,7 +11,6 @@ import { TransactionID } from '../../entity/transaction/stateTypes/transactionID
|
|
|
11
11
|
import { TransactionCategory } from '../../entity/transaction/stateTypes/transactionType';
|
|
12
12
|
import { VendorBase } from '../../entity/vendor/vendorState';
|
|
13
13
|
import { EntityRecommendationKey } from '../recommendation/recommendationState';
|
|
14
|
-
import { CreateTransactionLocalDataByType } from './createTransaction/createTransactionState';
|
|
15
14
|
import { TransactionDetailLineItemData, TransactionDetailLocalData } from './transactionDetailTypes';
|
|
16
15
|
export declare const getTransactionDetailKey: (transactionId: TransactionID) => `${string}_expense` | `${string}_check` | `${string}_invoice` | `${string}_payment` | `${string}_credit_memo` | `${string}_sales_receipt` | `${string}_delayed_credit` | `${string}_delayed_charge` | `${string}_refund` | `${string}_bill` | `${string}_bill_payment` | `${string}_bill_payment_check` | `${string}_bill_payment_credit_card` | `${string}_vendor_credit` | `${string}_credit_card_credit` | `${string}_transfer` | `${string}_credit_card_payment` | `${string}_deposit` | `${string}_journal_entry`;
|
|
17
16
|
export type TransactionDetailKey = ReturnType<typeof getTransactionDetailKey>;
|
|
@@ -45,22 +44,11 @@ interface AccountingProviderAttachment {
|
|
|
45
44
|
fetchState: FetchStateAndError;
|
|
46
45
|
}
|
|
47
46
|
export declare const initialSupportedTransactionDetail: SupportedTransactionDetail;
|
|
48
|
-
export interface CreateTransactionsState {
|
|
49
|
-
createStatus: FetchStateAndError;
|
|
50
|
-
/**
|
|
51
|
-
* Keyed by type so switching type in the Create dropdown does not clobber a draft the user
|
|
52
|
-
* already started on another type.
|
|
53
|
-
*/
|
|
54
|
-
newTransactionState: CreateTransactionLocalDataByType;
|
|
55
|
-
/** Set on a successful create, so the page can navigate to the new transaction. */
|
|
56
|
-
createdTransactionId?: TransactionID;
|
|
57
|
-
}
|
|
58
47
|
export interface TransactionDetailState {
|
|
59
48
|
accountingProviderAttachment: {
|
|
60
49
|
attachmentDataByID: Record<ID, ArrayBuffer>;
|
|
61
50
|
fetchState: FetchState;
|
|
62
51
|
};
|
|
63
|
-
createTransactionsState: CreateTransactionsState;
|
|
64
52
|
transactionDetailById: Record<TransactionDetailKey, SupportedTransactionDetail | undefined>;
|
|
65
53
|
}
|
|
66
54
|
export interface TransactionLineUpdates {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zeniai/client-epic-state",
|
|
3
|
-
"version": "5.2.62-
|
|
3
|
+
"version": "5.2.62-beta0MM",
|
|
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,4 +0,0 @@
|
|
|
1
|
-
declare const toPrintStatusInternal: (v: string) => "NotSet" | "NeedToPrint" | "PrintComplete";
|
|
2
|
-
export declare const toPrintStatus: (v?: string) => "NotSet" | "NeedToPrint" | "PrintComplete" | undefined;
|
|
3
|
-
export type PrintStatus = ReturnType<typeof toPrintStatusInternal>;
|
|
4
|
-
export {};
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.toPrintStatus = void 0;
|
|
4
|
-
const stringToUnion_1 = require("../../../commonStateTypes/stringToUnion");
|
|
5
|
-
// QBO's PrintStatus on a Purchase/Check. Sent only by the Create Transaction form for
|
|
6
|
-
// transaction_type: check -- qbo_purchase.py rejects print_status on any other payment_type.
|
|
7
|
-
const ALL_PRINT_STATUSES = [
|
|
8
|
-
'NotSet',
|
|
9
|
-
'NeedToPrint',
|
|
10
|
-
'PrintComplete',
|
|
11
|
-
];
|
|
12
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
13
|
-
const toPrintStatusInternal = (v) => (0, stringToUnion_1.stringToUnion)(v, ALL_PRINT_STATUSES);
|
|
14
|
-
const toPrintStatus = (v) => (0, stringToUnion_1.stringToUnionStrict)(v ?? '', ALL_PRINT_STATUSES);
|
|
15
|
-
exports.toPrintStatus = toPrintStatus;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { stringToUnion, stringToUnionStrict, } from '../../../commonStateTypes/stringToUnion';
|
|
2
|
-
// QBO's PrintStatus on a Purchase/Check. Sent only by the Create Transaction form for
|
|
3
|
-
// transaction_type: check -- qbo_purchase.py rejects print_status on any other payment_type.
|
|
4
|
-
const ALL_PRINT_STATUSES = [
|
|
5
|
-
'NotSet',
|
|
6
|
-
'NeedToPrint',
|
|
7
|
-
'PrintComplete',
|
|
8
|
-
];
|
|
9
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
10
|
-
const toPrintStatusInternal = (v) => stringToUnion(v, ALL_PRINT_STATUSES);
|
|
11
|
-
export const toPrintStatus = (v) => stringToUnionStrict(v ?? '', ALL_PRINT_STATUSES);
|
package/lib/esm/view/transactionDetail/createTransaction/createTransactionLocalDataHelper.js
DELETED
|
@@ -1,133 +0,0 @@
|
|
|
1
|
-
import { dateNow } from '../../../zeniDayJS';
|
|
2
|
-
import { ALL_CREATABLE_TRANSACTION_TYPES, } from './createTransactionState';
|
|
3
|
-
/**
|
|
4
|
-
* Monotonic counter for line row keys. These never leave the client -- the payload builder
|
|
5
|
-
* drops them -- so a counter is enough, and it keeps reducer tests deterministic in a way
|
|
6
|
-
* randomUUID would not.
|
|
7
|
-
*/
|
|
8
|
-
let lineIdCounter = 0;
|
|
9
|
-
export const nextCreateTransactionLineId = () => `create-transaction-line-${lineIdCounter++}`;
|
|
10
|
-
/** Test-only: makes line ids predictable from the start of each case. */
|
|
11
|
-
export const resetCreateTransactionLineIdCounter = () => {
|
|
12
|
-
lineIdCounter = 0;
|
|
13
|
-
};
|
|
14
|
-
export const createEmptyCreateTransactionLine = (postingType) => ({
|
|
15
|
-
id: nextCreateTransactionLineId(),
|
|
16
|
-
postingType,
|
|
17
|
-
});
|
|
18
|
-
/**
|
|
19
|
-
* The lines a freshly-opened form starts with. A journal entry is invalid with fewer than one
|
|
20
|
-
* debit and one credit, so it opens with both rather than making the user add the second row.
|
|
21
|
-
* Transfer has no lines at all.
|
|
22
|
-
*/
|
|
23
|
-
export const getDefaultCreateTransactionLines = (transactionType) => {
|
|
24
|
-
if (transactionType === 'transfer') {
|
|
25
|
-
return [];
|
|
26
|
-
}
|
|
27
|
-
if (transactionType === 'journal_entry') {
|
|
28
|
-
return [
|
|
29
|
-
createEmptyCreateTransactionLine('debit'),
|
|
30
|
-
createEmptyCreateTransactionLine('credit'),
|
|
31
|
-
];
|
|
32
|
-
}
|
|
33
|
-
return [createEmptyCreateTransactionLine()];
|
|
34
|
-
};
|
|
35
|
-
/**
|
|
36
|
-
* A blank working copy for one type. Note this does NOT seed the date -- the reducer's initial
|
|
37
|
-
* state has to stay a pure constant so `clearAll` restores something stable. The date is seeded
|
|
38
|
-
* by initializeCreateTransactionLocalDataEpic, which runs when the form opens.
|
|
39
|
-
*/
|
|
40
|
-
export const getEmptyCreateTransactionLocalData = (transactionType) => ({
|
|
41
|
-
lines: [],
|
|
42
|
-
transactionType,
|
|
43
|
-
});
|
|
44
|
-
export const getInitialCreateTransactionLocalDataByType = () => ALL_CREATABLE_TRANSACTION_TYPES.reduce((acc, transactionType) => {
|
|
45
|
-
acc[transactionType] =
|
|
46
|
-
getEmptyCreateTransactionLocalData(transactionType);
|
|
47
|
-
return acc;
|
|
48
|
-
}, {});
|
|
49
|
-
/**
|
|
50
|
-
* What the form opens with: a blank copy plus today's date, the default line set, and the one
|
|
51
|
-
* payment_type the backend insists on for a check (qbo_purchase.py raises without it).
|
|
52
|
-
*/
|
|
53
|
-
export const getSeededCreateTransactionLocalData = (transactionType) => ({
|
|
54
|
-
...getEmptyCreateTransactionLocalData(transactionType),
|
|
55
|
-
lines: getDefaultCreateTransactionLines(transactionType),
|
|
56
|
-
paymentType: transactionType === 'check' ? 'check' : undefined,
|
|
57
|
-
transactionDate: dateNow(),
|
|
58
|
-
});
|
|
59
|
-
/**
|
|
60
|
-
* Merges a partial edit into the working copy. Lines are replaced wholesale when present --
|
|
61
|
-
* a partial line array would silently truncate the form.
|
|
62
|
-
*/
|
|
63
|
-
export const mergeCreateTransactionLocalData = (current, update) => ({
|
|
64
|
-
...current,
|
|
65
|
-
...update,
|
|
66
|
-
lines: update.lines ?? current.lines,
|
|
67
|
-
// The type is keyed by the slice, never edited through a merge.
|
|
68
|
-
transactionType: current.transactionType,
|
|
69
|
-
});
|
|
70
|
-
export const updateCreateTransactionLine = (lines, lineId, update) => lines.map((line) => line.id === lineId ? { ...line, ...update, id: line.id } : line);
|
|
71
|
-
/**
|
|
72
|
-
* Recommendation -> RecommendationWithCOT. Chain-of-thought and recommendation feedback both
|
|
73
|
-
* need an existing transaction, so cot/reasoning are empty here by design; the dropdown only
|
|
74
|
-
* needs the entities to build its "Recommended" group.
|
|
75
|
-
*/
|
|
76
|
-
export const toRecommendationsWithCOT = (recommendations) => recommendations.map((recommendation) => ({
|
|
77
|
-
account: recommendation.account != null
|
|
78
|
-
? { ...recommendation.account, cot: [], reasoning: '' }
|
|
79
|
-
: undefined,
|
|
80
|
-
class: recommendation.class != null
|
|
81
|
-
? { ...recommendation.class, cot: [], reasoning: '' }
|
|
82
|
-
: undefined,
|
|
83
|
-
vendor: recommendation.vendor != null
|
|
84
|
-
? { ...recommendation.vendor, cot: [], reasoning: '' }
|
|
85
|
-
: undefined,
|
|
86
|
-
}));
|
|
87
|
-
/**
|
|
88
|
-
* Applies a vendor's recommendations to one line: always refreshes the dropdown's "Recommended"
|
|
89
|
-
* group, but only prefills account/class when the field is still empty. Anything the user
|
|
90
|
-
* picked wins -- this follows the transaction-categorization helper, which prefills, rather
|
|
91
|
-
* than the detail-page helper, which only suggests.
|
|
92
|
-
*/
|
|
93
|
-
export const applyRecommendationsToCreateTransactionLine = (line, recommendations, isAccountingClassesEnabled) => {
|
|
94
|
-
const top = recommendations[0];
|
|
95
|
-
const updated = {
|
|
96
|
-
...line,
|
|
97
|
-
recommendationsWithCOT: toRecommendationsWithCOT(recommendations),
|
|
98
|
-
};
|
|
99
|
-
if (line.accountQboId == null && top?.account?.qboId != null) {
|
|
100
|
-
updated.accountQboId = top.account.qboId;
|
|
101
|
-
updated.accountName = top.account.accountName;
|
|
102
|
-
updated.isAccountPreFilled = true;
|
|
103
|
-
}
|
|
104
|
-
if (isAccountingClassesEnabled &&
|
|
105
|
-
line.classId == null &&
|
|
106
|
-
top?.class?.classId != null) {
|
|
107
|
-
updated.classId = top.class.classId;
|
|
108
|
-
updated.isClassPreFilled = true;
|
|
109
|
-
}
|
|
110
|
-
return updated;
|
|
111
|
-
};
|
|
112
|
-
/**
|
|
113
|
-
* Undoes a prefill when the vendor is cleared. Only the fields the prefill wrote are removed --
|
|
114
|
-
* the per-field flags are what make the user's own choices distinguishable from ours, which is
|
|
115
|
-
* why they are not a single line-level boolean: a hand-picked account alongside a prefilled
|
|
116
|
-
* class is an ordinary state, and clearing must not take the account with it.
|
|
117
|
-
*/
|
|
118
|
-
export const clearRecommendationsFromCreateTransactionLine = (line) => {
|
|
119
|
-
const cleared = {
|
|
120
|
-
...line,
|
|
121
|
-
recommendationsWithCOT: undefined,
|
|
122
|
-
};
|
|
123
|
-
if (line.isAccountPreFilled === true) {
|
|
124
|
-
cleared.accountQboId = undefined;
|
|
125
|
-
cleared.accountName = undefined;
|
|
126
|
-
cleared.isAccountPreFilled = undefined;
|
|
127
|
-
}
|
|
128
|
-
if (line.isClassPreFilled === true) {
|
|
129
|
-
cleared.classId = undefined;
|
|
130
|
-
cleared.isClassPreFilled = undefined;
|
|
131
|
-
}
|
|
132
|
-
return cleared;
|
|
133
|
-
};
|
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
import { DEFAULT_DATE_FORMAT } from '../../../commonStateTypes/timePeriod';
|
|
2
|
-
import { getAccountBase } from '../../../entity/account/accountSelector';
|
|
3
|
-
import { getVendorByVendorId } from '../../../entity/vendor/vendorSelector';
|
|
4
|
-
const toRemitToAddressPayload = (address) => {
|
|
5
|
-
if (address == null) {
|
|
6
|
-
return undefined;
|
|
7
|
-
}
|
|
8
|
-
return {
|
|
9
|
-
line1: address.line1,
|
|
10
|
-
city: address.city,
|
|
11
|
-
state: address.state,
|
|
12
|
-
postal_code: address.postalCode,
|
|
13
|
-
country: address.country,
|
|
14
|
-
};
|
|
15
|
-
};
|
|
16
|
-
const toLinePayload = (line, transactionType) => {
|
|
17
|
-
const lineDetail = {};
|
|
18
|
-
if (line.accountQboId != null) {
|
|
19
|
-
lineDetail.account = {
|
|
20
|
-
qbo_id: line.accountQboId,
|
|
21
|
-
account_name: line.accountName,
|
|
22
|
-
};
|
|
23
|
-
}
|
|
24
|
-
// An empty object is what the confirmed payloads send when no class is chosen; sending the
|
|
25
|
-
// key with a qbo_id only once one is picked.
|
|
26
|
-
lineDetail.class = line.classId != null ? { qbo_id: line.classId } : {};
|
|
27
|
-
if (transactionType === 'journal_entry') {
|
|
28
|
-
lineDetail.posting_type = line.postingType;
|
|
29
|
-
if (line.vendorQboId != null) {
|
|
30
|
-
lineDetail.vendor = { qbo_id: line.vendorQboId };
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
return {
|
|
34
|
-
// The backend rejects a bool here, so this is always coerced to a number.
|
|
35
|
-
amount: line.amount?.amount ?? 0,
|
|
36
|
-
line_description: line.lineDescription,
|
|
37
|
-
line_detail_type: transactionType === 'journal_entry'
|
|
38
|
-
? 'journal_entry_line_detail'
|
|
39
|
-
: 'account_based_expense_line_detail',
|
|
40
|
-
line_detail: lineDetail,
|
|
41
|
-
};
|
|
42
|
-
};
|
|
43
|
-
/** Resolves a Zeni account id to the QBO id the endpoint expects. */
|
|
44
|
-
const toQboAccountId = (state, accountId) => {
|
|
45
|
-
if (accountId == null) {
|
|
46
|
-
return undefined;
|
|
47
|
-
}
|
|
48
|
-
return (getAccountBase(state.accountState, accountId, 'account_list')?.qboId ??
|
|
49
|
-
accountId);
|
|
50
|
-
};
|
|
51
|
-
/** Resolves a Zeni vendor id to its QBO id -- `vendor_id` on the wire is a QBO id. */
|
|
52
|
-
const toQboVendorId = (state, vendorId) => {
|
|
53
|
-
if (vendorId == null) {
|
|
54
|
-
return undefined;
|
|
55
|
-
}
|
|
56
|
-
return getVendorByVendorId(state.vendorState, vendorId)?.qboId ?? vendorId;
|
|
57
|
-
};
|
|
58
|
-
/**
|
|
59
|
-
* Builds the request body for one transaction type. One branch per type rather than a shared
|
|
60
|
-
* body with optional keys, because the types genuinely diverge -- transfer carries no lines at
|
|
61
|
-
* all, and journal_entry carries no header account.
|
|
62
|
-
*/
|
|
63
|
-
export const prepareCreateTransactionPayload = (state, localData) => {
|
|
64
|
-
const { transactionType } = localData;
|
|
65
|
-
const base = {
|
|
66
|
-
transaction_type: transactionType,
|
|
67
|
-
transaction_date: localData.transactionDate?.format(DEFAULT_DATE_FORMAT) ?? '',
|
|
68
|
-
transaction_memo: localData.transactionMemo,
|
|
69
|
-
};
|
|
70
|
-
if (transactionType === 'transfer') {
|
|
71
|
-
return {
|
|
72
|
-
...base,
|
|
73
|
-
from_account_id: toQboAccountId(state, localData.fromAccountId),
|
|
74
|
-
to_account_id: toQboAccountId(state, localData.toAccountId),
|
|
75
|
-
total_amount: localData.totalAmount?.amount ?? 0,
|
|
76
|
-
};
|
|
77
|
-
}
|
|
78
|
-
const lines = localData.lines.map((line) => toLinePayload(line, transactionType));
|
|
79
|
-
if (transactionType === 'journal_entry') {
|
|
80
|
-
return {
|
|
81
|
-
...base,
|
|
82
|
-
document_id: localData.documentId,
|
|
83
|
-
lines,
|
|
84
|
-
};
|
|
85
|
-
}
|
|
86
|
-
const purchaseBase = {
|
|
87
|
-
...base,
|
|
88
|
-
payment_type: localData.paymentType,
|
|
89
|
-
qbo_account_id: toQboAccountId(state, localData.qboAccountId),
|
|
90
|
-
vendor_id: toQboVendorId(state, localData.vendorId),
|
|
91
|
-
lines,
|
|
92
|
-
};
|
|
93
|
-
if (transactionType === 'check') {
|
|
94
|
-
return {
|
|
95
|
-
...purchaseBase,
|
|
96
|
-
document_number: localData.documentNumber,
|
|
97
|
-
print_status: localData.printStatus,
|
|
98
|
-
remit_to_address: toRemitToAddressPayload(localData.remitToAddress),
|
|
99
|
-
};
|
|
100
|
-
}
|
|
101
|
-
if (transactionType === 'credit_card_credit') {
|
|
102
|
-
// credit_card_credit is not in the backend's SUPPORTED_TRANSACTION_WRITE_TYPES. QBO models
|
|
103
|
-
// it as a Purchase with Credit: true and qbo_purchase.py already honours is_credit for
|
|
104
|
-
// card payment types, so this sends `expense` + is_credit rather than a type the validator
|
|
105
|
-
// rejects outright. Confirm with backend before enabling the menu item.
|
|
106
|
-
return {
|
|
107
|
-
...purchaseBase,
|
|
108
|
-
transaction_type: 'expense',
|
|
109
|
-
is_credit: true,
|
|
110
|
-
document_number: localData.documentNumber,
|
|
111
|
-
};
|
|
112
|
-
}
|
|
113
|
-
return purchaseBase;
|
|
114
|
-
};
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { getNestedAccountListHierarchy } from '../../accountList/accountListSelector';
|
|
2
|
-
import { getNestedClassListHierarchy } from '../../classList/classListSelector';
|
|
3
|
-
import { getResolvedTransferAccounts } from '../../createTransferEntry/createTransferEntrySelector';
|
|
4
|
-
import { getRecommendationsForEntity } from '../../recommendation/recommendationSelector';
|
|
5
|
-
export const getCreateTransactionLocalData = (state, transactionType) => state.transactionDetailState.createTransactionsState.newTransactionState[transactionType];
|
|
6
|
-
export const getCreateTransactionStatus = (state) => state.transactionDetailState.createTransactionsState.createStatus;
|
|
7
|
-
/**
|
|
8
|
-
* The vendor recommendations backing the category/class dropdowns on the create page.
|
|
9
|
-
*
|
|
10
|
-
* No new state field is needed for this: getRecommendationsForEntity already returns
|
|
11
|
-
* fetchState alongside recommendations, so composing it here is enough for the page to show a
|
|
12
|
-
* line skeleton and hold Save while a fetch is in flight.
|
|
13
|
-
*/
|
|
14
|
-
export const getCreateTransactionVendorRecommendations = (state, vendorQboId) => {
|
|
15
|
-
if (vendorQboId == null || vendorQboId === '') {
|
|
16
|
-
return { fetchState: 'Not-Started' };
|
|
17
|
-
}
|
|
18
|
-
const view = getRecommendationsForEntity(state, vendorQboId, 'vendor');
|
|
19
|
-
return {
|
|
20
|
-
fetchState: view.fetchState,
|
|
21
|
-
recommendations: view.recommendations,
|
|
22
|
-
};
|
|
23
|
-
};
|
|
24
|
-
export const getCreateTransactionView = (state, transactionType) => {
|
|
25
|
-
const { accountListState, classListState, transactionDetailState, vendorState, } = state;
|
|
26
|
-
const { createTransactionsState } = transactionDetailState;
|
|
27
|
-
return {
|
|
28
|
-
transactionType,
|
|
29
|
-
localData: createTransactionsState.newTransactionState[transactionType],
|
|
30
|
-
createStatus: createTransactionsState.createStatus,
|
|
31
|
-
createdTransactionId: createTransactionsState.createdTransactionId,
|
|
32
|
-
vendorList: Object.values(vendorState.vendorByID),
|
|
33
|
-
accountListNestedAccountHierarchy: getNestedAccountListHierarchy(accountListState, 'accountList'),
|
|
34
|
-
classListNestedAccountHierarchy: getNestedClassListHierarchy(classListState),
|
|
35
|
-
transferAccountsList: transactionType === 'transfer'
|
|
36
|
-
? getResolvedTransferAccounts(state).transferAccountsList
|
|
37
|
-
: [],
|
|
38
|
-
fetchState: createTransactionsState.createStatus.fetchState,
|
|
39
|
-
error: createTransactionsState.createStatus.error,
|
|
40
|
-
};
|
|
41
|
-
};
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The transaction types the Create Transaction flow can originate. A narrow subset of
|
|
3
|
-
* TransactionType -- everything else is read-only and arrives via sync.
|
|
4
|
-
*/
|
|
5
|
-
export const ALL_CREATABLE_TRANSACTION_TYPES = [
|
|
6
|
-
'expense',
|
|
7
|
-
'check',
|
|
8
|
-
'credit_card_credit',
|
|
9
|
-
'transfer',
|
|
10
|
-
'journal_entry',
|
|
11
|
-
];
|