@zeniai/client-epic-state 5.0.78 → 5.0.79
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/commonStateTypes/cacheOverrideFetchReducer.d.ts +17 -0
- package/lib/commonStateTypes/cacheOverrideFetchReducer.js +20 -0
- package/lib/commonStateTypes/filterPrimitives.d.ts +23 -0
- package/lib/commonStateTypes/filterPrimitives.js +21 -0
- package/lib/commonStateTypes/pusherActions.d.ts +11 -0
- package/lib/commonStateTypes/pusherActions.js +6 -0
- package/lib/coreEpics.js +1 -1
- package/lib/entity/account/accountSelector.d.ts +27 -1
- package/lib/entity/account/accountSelector.js +47 -1
- package/lib/entity/account/accountState.d.ts +6 -1
- package/lib/entity/account/accountState.js +11 -4
- package/lib/entity/account/subAccountSelector.d.ts +1 -1
- package/lib/entity/aiAccountantCustomer/aiAccountantCustomerPayload.js +1 -3
- package/lib/entity/aiAccountantCustomer/aiAccountantCustomerReducer.js +1 -2
- package/lib/entity/aiAccountantCustomer/aiAccountantCustomerSelector.d.ts +1 -1
- package/lib/entity/chargeCard/chargeCardReducer.d.ts +19 -2
- package/lib/entity/chargeCard/chargeCardReducer.js +35 -2
- package/lib/entity/chargeCardTransaction/chargeCardTransactionReducer.d.ts +14 -1
- package/lib/entity/chargeCardTransaction/chargeCardTransactionReducer.js +36 -2
- package/lib/entity/class/classSelector.d.ts +35 -0
- package/lib/entity/class/classSelector.js +50 -0
- package/lib/entity/sectionProjectView/sectionProjectViewReducer.d.ts +1 -1
- package/lib/entity/sectionProjectView/sectionProjectViewSelector.js +1 -1
- package/lib/entity/tenant/SessionManager.js +6 -3
- package/lib/entity/tenant/clearAllEpic.d.ts +2 -2
- package/lib/entity/tenant/clearAllEpic.js +2 -2
- package/lib/entity/tenant/epic/saveAPIKeyConnectionEpic.js +6 -2
- package/lib/entity/tenant/epic/saveOAuthConnectionEpic.js +6 -2
- package/lib/entity/tenant/tenantReducer.js +6 -1
- package/lib/entity/transaction/payloadTypes/transactionLinePayload.js +3 -1
- package/lib/epic.d.ts +11 -11
- package/lib/epic.js +12 -12
- package/lib/esm/commonStateTypes/cacheOverrideFetchReducer.js +16 -0
- package/lib/esm/commonStateTypes/filterPrimitives.js +20 -0
- package/lib/esm/commonStateTypes/pusherActions.js +3 -0
- package/lib/esm/coreEpics.js +1 -1
- package/lib/esm/entity/account/accountSelector.js +46 -1
- package/lib/esm/entity/account/accountState.js +7 -1
- package/lib/esm/entity/aiAccountantCustomer/aiAccountantCustomerPayload.js +1 -3
- package/lib/esm/entity/aiAccountantCustomer/aiAccountantCustomerReducer.js +1 -2
- package/lib/esm/entity/chargeCard/chargeCardReducer.js +34 -1
- package/lib/esm/entity/chargeCardTransaction/chargeCardTransactionReducer.js +35 -1
- package/lib/esm/entity/class/classSelector.js +48 -0
- package/lib/esm/entity/sectionProjectView/sectionProjectViewSelector.js +1 -1
- package/lib/esm/entity/tenant/SessionManager.js +4 -1
- package/lib/esm/entity/tenant/clearAllEpic.js +2 -2
- package/lib/esm/entity/tenant/epic/saveAPIKeyConnectionEpic.js +6 -2
- package/lib/esm/entity/tenant/epic/saveOAuthConnectionEpic.js +6 -2
- package/lib/esm/entity/tenant/tenantReducer.js +6 -1
- package/lib/esm/entity/transaction/payloadTypes/transactionLinePayload.js +3 -1
- package/lib/esm/epic.js +12 -12
- package/lib/esm/index.js +31 -21
- package/lib/esm/reducer.js +2 -2
- package/lib/esm/view/aiAccountantView/epics/fetchAiAccountantCustomersEpic.js +2 -5
- package/lib/esm/view/aiAccountantView/epics/fetchAiAccountantJobsEpic.js +2 -5
- package/lib/esm/view/aiAccountantView/epics/triggerAiAccountantJobEpic.js +4 -1
- package/lib/esm/view/companyHealthMetricView/companyHealthMetricViewSelector.js +1 -1
- package/lib/esm/view/companyTaskManagerView/companyTaskManagerViewSelector.js +1 -1
- package/lib/esm/view/companyTaskManagerView/epics/fetchTaskManagerMetricsEpic.js +1 -1
- package/lib/esm/view/companyView/helpers/cockpitHelpers.js +1 -1
- package/lib/esm/view/companyView/selector/companyManagementViewSelector.js +1 -1
- package/lib/esm/view/companyView/selector/companyPortfolioViewSelector.js +1 -1
- package/lib/esm/view/creditAgentView/creditAgentViewReducer.js +1 -16
- package/lib/esm/view/expenseAutomationView/epics/missingReceipts/fetchBulkUploadBatchesEpic.js +2 -2
- package/lib/esm/view/expenseAutomationView/epics/missingReceipts/fetchCompletedTransactionsEpic.js +2 -1
- package/lib/esm/view/expenseAutomationView/epics/missingReceipts/restoreBulkUploadAutomatchingOnMountEpic.js +8 -6
- package/lib/esm/view/expenseAutomationView/epics/missingReceipts/searchTransactionsForManualMatchEpic.js +7 -1
- package/lib/esm/view/expenseAutomationView/epics/transactionCategorization/fetchTransactionCategorizationEpic.js +11 -1
- package/lib/esm/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.js +21 -1
- package/lib/esm/view/expenseAutomationView/reducers/missingReceiptsViewReducer.js +2 -1
- package/lib/esm/view/expenseAutomationView/reducers/transactionsViewReducer.js +253 -14
- package/lib/esm/view/expenseAutomationView/selectors/transactionCategorizationSelector.js +147 -13
- package/lib/esm/view/expenseAutomationView/transactionFilterHelpers.js +258 -0
- package/lib/esm/view/expenseAutomationView/types/completedSubTab.js +17 -0
- package/lib/esm/view/expenseAutomationView/types/missingReceiptsViewState.js +0 -2
- package/lib/esm/view/financeStatement/financeStatementSelector.js +1 -1
- package/lib/esm/view/recommendation/fetchEntityRecommendationsForLineUpdateEpic.js +87 -0
- package/lib/esm/view/recommendation/recommendationHelper.js +29 -0
- package/lib/esm/view/recommendation/recommendationReducer.js +26 -1
- package/lib/esm/view/spendManagement/chargeCards/cashbackDetail/cashbackDetailReducer.js +3 -2
- package/lib/esm/view/spendManagement/chargeCards/chargeCardConfig/chargeCardConfigReducer.js +3 -2
- package/lib/esm/view/spendManagement/chargeCards/chargeCardDetail/chargeCardDetailReducer.js +55 -18
- package/lib/esm/view/spendManagement/chargeCards/chargeCardDetail/fetchChargeCardDetailEpic.js +16 -2
- package/lib/esm/view/spendManagement/chargeCards/chargeCardDetail/fetchChargeCardDetailPageEpic.js +5 -4
- package/lib/esm/view/spendManagement/chargeCards/chargeCardList/chargeCardListReducer.js +26 -9
- package/lib/esm/view/spendManagement/chargeCards/chargeCardList/fetchChargeCardListPageEpic.js +9 -6
- package/lib/esm/view/spendManagement/chargeCards/chargeCardPaymentHistory/chargeCardPaymentHistoryReducer.js +3 -2
- package/lib/esm/view/spendManagement/chargeCards/chargeCardPaymentHistory/fetchChargeCardPaymentPageEpic.js +1 -1
- package/lib/esm/view/spendManagement/chargeCards/chargeCardRepaymentDetail/chargeCardRepaymentDetailReducer.js +7 -3
- package/lib/esm/view/spendManagement/commonHistoryView/commonHistoryPayload.js +8 -3
- package/lib/esm/view/spendManagement/commonHistoryView/commonHistoryReducer.js +3 -2
- package/lib/esm/view/spendManagement/commonHistoryView/fetchEntityHistoryEpic.js +2 -0
- package/lib/esm/view/spendManagement/spendManagementFilterHelpers.js +4 -2
- package/lib/esm/view/subscriptionView/subscriptionViewSelector.js +1 -1
- package/lib/esm/view/taskManager/cannedResponsesView/epics/fetchCannedResponsesEpic.js +1 -1
- package/lib/esm/view/taskManager/cannedResponsesView/epics/saveCannedResponseEpic.js +1 -1
- package/lib/esm/view/taskManager/taskDetailView/epics/unsnoozeTaskEpic.js +1 -1
- package/lib/esm/view/taskManager/taskListView/taskListReducer.js +1 -1
- package/lib/esm/view/transactionDetail/transactionDetailReducer.js +121 -6
- package/lib/esm/view/transactionDetail/transactionDetailSelector.js +29 -1
- package/lib/index.d.ts +31 -24
- package/lib/index.js +84 -60
- package/lib/reducer.d.ts +2 -2
- package/lib/reducer.js +2 -2
- package/lib/view/aiAccountantView/aiAccountantViewPayload.d.ts +2 -2
- package/lib/view/aiAccountantView/aiAccountantViewReducer.d.ts +1 -1
- package/lib/view/aiAccountantView/epics/fetchAiAccountantCustomersEpic.js +2 -5
- package/lib/view/aiAccountantView/epics/fetchAiAccountantJobsEpic.js +2 -5
- package/lib/view/aiAccountantView/epics/triggerAiAccountantJobEpic.js +4 -1
- package/lib/view/companyHealthMetricView/companyHealthMetricViewSelector.js +1 -1
- package/lib/view/companyTaskManagerView/companyTaskManagerViewSelector.d.ts +1 -1
- package/lib/view/companyTaskManagerView/companyTaskManagerViewSelector.js +1 -1
- package/lib/view/companyView/helpers/cockpitHelpers.js +1 -1
- package/lib/view/companyView/selector/companyManagementViewSelector.js +1 -1
- package/lib/view/companyView/selector/companyPortfolioViewSelector.js +1 -1
- package/lib/view/companyView/types/cockpitTypes.d.ts +1 -1
- package/lib/view/creditAgentView/creditAgentViewPayload.d.ts +0 -3
- package/lib/view/creditAgentView/creditAgentViewReducer.d.ts +1 -1
- package/lib/view/creditAgentView/creditAgentViewReducer.js +2 -17
- package/lib/view/creditAgentView/creditAgentViewState.d.ts +0 -5
- package/lib/view/expenseAutomationView/epics/missingReceipts/fetchBulkUploadBatchesEpic.js +2 -2
- package/lib/view/expenseAutomationView/epics/missingReceipts/fetchCompletedTransactionsEpic.js +2 -1
- package/lib/view/expenseAutomationView/epics/missingReceipts/restoreBulkUploadAutomatchingOnMountEpic.js +8 -6
- package/lib/view/expenseAutomationView/epics/missingReceipts/searchTransactionsForManualMatchEpic.js +7 -1
- package/lib/view/expenseAutomationView/epics/transactionCategorization/fetchTransactionCategorizationEpic.d.ts +2 -2
- package/lib/view/expenseAutomationView/epics/transactionCategorization/fetchTransactionCategorizationEpic.js +10 -0
- package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.d.ts +2 -1
- package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.js +23 -2
- package/lib/view/expenseAutomationView/payload/transactionCategorizationPayload.d.ts +21 -0
- package/lib/view/expenseAutomationView/reducers/missingReceiptsViewReducer.d.ts +2 -1
- package/lib/view/expenseAutomationView/reducers/missingReceiptsViewReducer.js +2 -1
- package/lib/view/expenseAutomationView/reducers/transactionsViewReducer.d.ts +28 -5
- package/lib/view/expenseAutomationView/reducers/transactionsViewReducer.js +253 -14
- package/lib/view/expenseAutomationView/selectorTypes/missingReceiptsSelectorTypes.d.ts +2 -1
- package/lib/view/expenseAutomationView/selectorTypes/transactionsViewSelectorTypes.d.ts +16 -0
- package/lib/view/expenseAutomationView/selectors/transactionCategorizationSelector.d.ts +7 -1
- package/lib/view/expenseAutomationView/selectors/transactionCategorizationSelector.js +150 -13
- package/lib/view/expenseAutomationView/transactionFilterHelpers.d.ts +66 -0
- package/lib/view/expenseAutomationView/transactionFilterHelpers.js +262 -0
- package/lib/view/expenseAutomationView/types/completedSubTab.d.ts +10 -0
- package/lib/view/expenseAutomationView/types/completedSubTab.js +21 -0
- package/lib/view/expenseAutomationView/types/missingReceiptsViewState.d.ts +1 -2
- package/lib/view/expenseAutomationView/types/missingReceiptsViewState.js +1 -4
- package/lib/view/expenseAutomationView/types/transactionsViewState.d.ts +44 -2
- package/lib/view/financeStatement/financeStatementSelector.js +1 -1
- package/lib/view/profitAndLossProjectView/profitAndLossProjectViewSelectorTypes.d.ts +1 -1
- package/lib/view/recommendation/fetchEntityRecommendationsForLineUpdateEpic.d.ts +9 -0
- package/lib/view/recommendation/fetchEntityRecommendationsForLineUpdateEpic.js +91 -0
- package/lib/view/recommendation/recommendationHelper.d.ts +9 -0
- package/lib/view/recommendation/recommendationHelper.js +31 -1
- package/lib/view/recommendation/recommendationReducer.d.ts +20 -1
- package/lib/view/recommendation/recommendationReducer.js +27 -2
- package/lib/view/spendManagement/billPay/billList/billListState.d.ts +1 -1
- package/lib/view/spendManagement/chargeCards/cashbackDetail/cashbackDetailReducer.d.ts +3 -1
- package/lib/view/spendManagement/chargeCards/cashbackDetail/cashbackDetailReducer.js +3 -2
- package/lib/view/spendManagement/chargeCards/chargeCardConfig/chargeCardConfigReducer.d.ts +3 -1
- package/lib/view/spendManagement/chargeCards/chargeCardConfig/chargeCardConfigReducer.js +3 -2
- package/lib/view/spendManagement/chargeCards/chargeCardDetail/chargeCardDetailReducer.js +55 -18
- package/lib/view/spendManagement/chargeCards/chargeCardDetail/fetchChargeCardDetailEpic.js +16 -2
- package/lib/view/spendManagement/chargeCards/chargeCardDetail/fetchChargeCardDetailPageEpic.js +5 -4
- package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardListReducer.d.ts +18 -3
- package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardListReducer.js +27 -10
- package/lib/view/spendManagement/chargeCards/chargeCardList/fetchChargeCardListPageEpic.js +9 -6
- package/lib/view/spendManagement/chargeCards/chargeCardPaymentHistory/chargeCardPaymentHistory.d.ts +1 -1
- package/lib/view/spendManagement/chargeCards/chargeCardPaymentHistory/chargeCardPaymentHistoryReducer.d.ts +3 -1
- package/lib/view/spendManagement/chargeCards/chargeCardPaymentHistory/chargeCardPaymentHistoryReducer.js +3 -2
- package/lib/view/spendManagement/chargeCards/chargeCardPaymentHistory/fetchChargeCardPaymentPageEpic.js +1 -1
- package/lib/view/spendManagement/chargeCards/chargeCardRepaymentDetail/chargeCardRepaymentDetailReducer.d.ts +3 -1
- package/lib/view/spendManagement/chargeCards/chargeCardRepaymentDetail/chargeCardRepaymentDetailReducer.js +7 -3
- package/lib/view/spendManagement/commonHistoryView/commonHistoryPayload.d.ts +1 -1
- package/lib/view/spendManagement/commonHistoryView/commonHistoryPayload.js +7 -2
- package/lib/view/spendManagement/commonHistoryView/commonHistoryReducer.d.ts +1 -0
- package/lib/view/spendManagement/commonHistoryView/commonHistoryReducer.js +3 -2
- package/lib/view/spendManagement/commonHistoryView/fetchEntityHistoryEpic.js +2 -0
- package/lib/view/spendManagement/reimbursement/remiListView/remiListState.d.ts +1 -1
- package/lib/view/spendManagement/spendManagementFilterHelpers.d.ts +12 -3
- package/lib/view/spendManagement/spendManagementFilterHelpers.js +4 -2
- package/lib/view/subscriptionView/subscriptionViewSelector.js +1 -1
- package/lib/view/taskManager/taskListView/taskList.d.ts +1 -1
- package/lib/view/taskManager/taskListView/taskListReducer.js +1 -1
- package/lib/view/transactionDetail/transactionDetailReducer.d.ts +11 -1
- package/lib/view/transactionDetail/transactionDetailReducer.js +122 -7
- package/lib/view/transactionDetail/transactionDetailSelector.d.ts +2 -0
- package/lib/view/transactionDetail/transactionDetailSelector.js +31 -2
- package/lib/view/transactionDetail/transactionDetailTypes.d.ts +1 -0
- package/lib/view/zeniOAuthView/zeniOAuthSelector.d.ts +1 -1
- package/package.json +9 -4
- package/lib/esm/view/creditAgentView/epics/fetchCreditAgentAccessEpic.js +0 -13
- package/lib/view/creditAgentView/epics/fetchCreditAgentAccessEpic.d.ts +0 -11
- package/lib/view/creditAgentView/epics/fetchCreditAgentAccessEpic.js +0 -17
|
@@ -4,7 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
var _a;
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.setIsVendorUpdateAllChecked = exports.updateVendorBulkRecommendationsFetchStatus = exports.updateLatestSelectedEntity = exports.resetAllLineItemsToVendor = exports.updateVendorToAllLineItems = exports.updateLocalDataWithTransactionsUpdateWithVendorCheckbox = exports.resetSelectedCustomer = exports.resetVendor = exports.updateSelectedCustomer = exports.updateSelectedVendor = exports.removeEntityRecommendationForLineIdForTransactionDetail = 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.clearTransactionDetail = exports.removeTransactionDetail = exports.updateTransactionDetailFetchState = exports.fetchTransactionDetail = exports.downloadAccountingProviderAttachmentFailure = exports.downloadAccountingProviderAttachmentSuccess = exports.downloadAccountingProviderAttachment = exports.initialState = void 0;
|
|
7
|
+
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.clearTransactionDetail = exports.removeTransactionDetail = exports.updateTransactionDetailFetchState = exports.fetchTransactionDetail = exports.downloadAccountingProviderAttachmentFailure = exports.downloadAccountingProviderAttachmentSuccess = exports.downloadAccountingProviderAttachment = exports.initialState = void 0;
|
|
8
8
|
const toolkit_1 = require("@reduxjs/toolkit");
|
|
9
9
|
const get_1 = __importDefault(require("lodash/get"));
|
|
10
10
|
const entity_1 = require("../../entity/genericEntity/entity");
|
|
@@ -245,12 +245,34 @@ const transactionDetail = (0, toolkit_1.createSlice)({
|
|
|
245
245
|
saveTransactionDetailLocalData(draft, action) {
|
|
246
246
|
const key = (0, transactionDetailState_1.getTransactionDetailKey)(action.payload.transactionId);
|
|
247
247
|
const detail = (0, get_1.default)(draft.transactionDetailById, key, undefined);
|
|
248
|
-
if (detail
|
|
249
|
-
|
|
250
|
-
...detail,
|
|
251
|
-
transactionDetailLocalData: action.payload.transactionLocalData,
|
|
252
|
-
};
|
|
248
|
+
if (detail == null) {
|
|
249
|
+
return;
|
|
253
250
|
}
|
|
251
|
+
const incoming = action.payload.transactionLocalData;
|
|
252
|
+
const prevById = detail.transactionDetailLocalData.lineItemById;
|
|
253
|
+
// Per-line `categoryClassRecommendationsFetchState` is owned by the
|
|
254
|
+
// recommendation epic/reducers (markInProgress / markCompleted /
|
|
255
|
+
// markFailure / setEntityRecommendationForLineIdsForTransactionDetail).
|
|
256
|
+
// Callers that rebuild `transactionLocalData` from a UI snapshot will
|
|
257
|
+
// typically have an out-of-date copy of this field (e.g. payee-change
|
|
258
|
+
// captures the snapshot before the epic's start arm runs and would
|
|
259
|
+
// otherwise clobber In-Progress back to undefined). Treat the field as
|
|
260
|
+
// sticky: only let the caller override it when they explicitly set it.
|
|
261
|
+
const mergedLineItemById = {};
|
|
262
|
+
Object.entries(incoming.lineItemById ?? {}).forEach(([lineId, line]) => {
|
|
263
|
+
mergedLineItemById[lineId] = {
|
|
264
|
+
...line,
|
|
265
|
+
categoryClassRecommendationsFetchState: line.categoryClassRecommendationsFetchState ??
|
|
266
|
+
prevById?.[lineId]?.categoryClassRecommendationsFetchState,
|
|
267
|
+
};
|
|
268
|
+
});
|
|
269
|
+
draft.transactionDetailById[key] = {
|
|
270
|
+
...detail,
|
|
271
|
+
transactionDetailLocalData: {
|
|
272
|
+
...incoming,
|
|
273
|
+
lineItemById: mergedLineItemById,
|
|
274
|
+
},
|
|
275
|
+
};
|
|
254
276
|
},
|
|
255
277
|
saveTransactionDetail(draft, action) {
|
|
256
278
|
const key = (0, transactionDetailState_1.getTransactionDetailKey)(action.payload.transactionId);
|
|
@@ -372,6 +394,21 @@ const transactionDetail = (0, toolkit_1.createSlice)({
|
|
|
372
394
|
const detail = (0, get_1.default)(draft.transactionDetailById, key, undefined);
|
|
373
395
|
if (detail != null) {
|
|
374
396
|
const newLocalData = (0, transactionDetailLocalDataHelper_1.setEntityRecommendationForLineIdInLocalData)(transaction, detail.transactionDetailLocalData, action.payload.entity, lineIds, uncategorizedIncomeExpense, recommendationWithCOTByLineId);
|
|
397
|
+
// Release the per-line fetch flag for every line this fetch
|
|
398
|
+
// covered so the inline skeleton resolves and the page-level
|
|
399
|
+
// Save button can re-enable.
|
|
400
|
+
lineIds.forEach((lineId) => {
|
|
401
|
+
const lineItem = newLocalData.lineItemById[lineId];
|
|
402
|
+
if (lineItem != null) {
|
|
403
|
+
newLocalData.lineItemById[lineId] = {
|
|
404
|
+
...lineItem,
|
|
405
|
+
categoryClassRecommendationsFetchState: {
|
|
406
|
+
fetchState: 'Completed',
|
|
407
|
+
error: undefined,
|
|
408
|
+
},
|
|
409
|
+
};
|
|
410
|
+
}
|
|
411
|
+
});
|
|
375
412
|
draft.transactionDetailById[key] = {
|
|
376
413
|
...detail,
|
|
377
414
|
transactionDetailLocalData: newLocalData,
|
|
@@ -392,6 +429,84 @@ const transactionDetail = (0, toolkit_1.createSlice)({
|
|
|
392
429
|
};
|
|
393
430
|
},
|
|
394
431
|
},
|
|
432
|
+
// Start arm of the line-update recommendations fetch for the detail
|
|
433
|
+
// page. Flips covered lines to In-Progress; detail page has no
|
|
434
|
+
// checkbox, so no auto-uncheck side effect.
|
|
435
|
+
markCategoryClassRecommendationsInProgressForTransactionDetail: {
|
|
436
|
+
reducer(draft, action) {
|
|
437
|
+
const { transactionId, lineIds } = action.payload;
|
|
438
|
+
const key = (0, transactionDetailState_1.getTransactionDetailKey)(transactionId);
|
|
439
|
+
const detail = (0, get_1.default)(draft.transactionDetailById, key, undefined);
|
|
440
|
+
if (detail != null) {
|
|
441
|
+
lineIds.forEach((lineId) => {
|
|
442
|
+
const lineItem = detail.transactionDetailLocalData.lineItemById[lineId];
|
|
443
|
+
if (lineItem != null) {
|
|
444
|
+
detail.transactionDetailLocalData.lineItemById[lineId] = {
|
|
445
|
+
...lineItem,
|
|
446
|
+
categoryClassRecommendationsFetchState: {
|
|
447
|
+
fetchState: 'In-Progress',
|
|
448
|
+
error: undefined,
|
|
449
|
+
},
|
|
450
|
+
};
|
|
451
|
+
}
|
|
452
|
+
});
|
|
453
|
+
}
|
|
454
|
+
},
|
|
455
|
+
prepare(transactionId, lineIds) {
|
|
456
|
+
return { payload: { transactionId, lineIds } };
|
|
457
|
+
},
|
|
458
|
+
},
|
|
459
|
+
// Completed arm. Used when the HTTP call succeeded but the server
|
|
460
|
+
// returned no per-line recommendations — still need to release the
|
|
461
|
+
// In-Progress flag.
|
|
462
|
+
markCategoryClassRecommendationsCompletedForTransactionDetail: {
|
|
463
|
+
reducer(draft, action) {
|
|
464
|
+
const { transactionId, lineIds } = action.payload;
|
|
465
|
+
const key = (0, transactionDetailState_1.getTransactionDetailKey)(transactionId);
|
|
466
|
+
const detail = (0, get_1.default)(draft.transactionDetailById, key, undefined);
|
|
467
|
+
if (detail != null) {
|
|
468
|
+
lineIds.forEach((lineId) => {
|
|
469
|
+
const lineItem = detail.transactionDetailLocalData.lineItemById[lineId];
|
|
470
|
+
if (lineItem != null) {
|
|
471
|
+
detail.transactionDetailLocalData.lineItemById[lineId] = {
|
|
472
|
+
...lineItem,
|
|
473
|
+
categoryClassRecommendationsFetchState: {
|
|
474
|
+
fetchState: 'Completed',
|
|
475
|
+
error: undefined,
|
|
476
|
+
},
|
|
477
|
+
};
|
|
478
|
+
}
|
|
479
|
+
});
|
|
480
|
+
}
|
|
481
|
+
},
|
|
482
|
+
prepare(transactionId, lineIds) {
|
|
483
|
+
return { payload: { transactionId, lineIds } };
|
|
484
|
+
},
|
|
485
|
+
},
|
|
486
|
+
markCategoryClassRecommendationsFailureForTransactionDetail: {
|
|
487
|
+
reducer(draft, action) {
|
|
488
|
+
const { transactionId, lineIds, error } = action.payload;
|
|
489
|
+
const key = (0, transactionDetailState_1.getTransactionDetailKey)(transactionId);
|
|
490
|
+
const detail = (0, get_1.default)(draft.transactionDetailById, key, undefined);
|
|
491
|
+
if (detail != null) {
|
|
492
|
+
lineIds.forEach((lineId) => {
|
|
493
|
+
const lineItem = detail.transactionDetailLocalData.lineItemById[lineId];
|
|
494
|
+
if (lineItem != null) {
|
|
495
|
+
detail.transactionDetailLocalData.lineItemById[lineId] = {
|
|
496
|
+
...lineItem,
|
|
497
|
+
categoryClassRecommendationsFetchState: {
|
|
498
|
+
fetchState: 'Error',
|
|
499
|
+
error,
|
|
500
|
+
},
|
|
501
|
+
};
|
|
502
|
+
}
|
|
503
|
+
});
|
|
504
|
+
}
|
|
505
|
+
},
|
|
506
|
+
prepare(transactionId, lineIds, error) {
|
|
507
|
+
return { payload: { transactionId, lineIds, error } };
|
|
508
|
+
},
|
|
509
|
+
},
|
|
395
510
|
removeEntityRecommendationForLineIdForTransactionDetail: {
|
|
396
511
|
reducer(draft, action) {
|
|
397
512
|
const { transaction, lineId } = action.payload;
|
|
@@ -663,7 +778,7 @@ const transactionDetail = (0, toolkit_1.createSlice)({
|
|
|
663
778
|
},
|
|
664
779
|
},
|
|
665
780
|
});
|
|
666
|
-
_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.clearTransactionDetail = _a.clearTransactionDetail, 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.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;
|
|
781
|
+
_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.clearTransactionDetail = _a.clearTransactionDetail, 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;
|
|
667
782
|
exports.default = transactionDetail.reducer;
|
|
668
783
|
function getUpdatedEntityLocalData(detail, updates, entity, resetRecommendations, type) {
|
|
669
784
|
const key = type === 'customer' ? 'customerUpdates' : 'vendorUpdates';
|
|
@@ -18,6 +18,7 @@ export interface TransactionDetailReport extends SelectorView {
|
|
|
18
18
|
classHierarchyList: NestedClassHierarchyForReport[];
|
|
19
19
|
classList: ClassListSelectorView;
|
|
20
20
|
deleteStatusByAttachmentName: Record<string, FetchStateAndError>;
|
|
21
|
+
hasInFlightCategoryClassRecommendations: boolean;
|
|
21
22
|
isAccountingClassesEnabled: boolean;
|
|
22
23
|
isAccountingProjectsEnabled: boolean;
|
|
23
24
|
linkedTransactions: SupportedTransactionWithCOT[];
|
|
@@ -30,6 +31,7 @@ export interface TransactionDetailReport extends SelectorView {
|
|
|
30
31
|
export interface VendorDetailsView extends SelectorView {
|
|
31
32
|
vendors: Vendor[];
|
|
32
33
|
}
|
|
34
|
+
export declare const getDetailInFlightRecommendations: (state: RootState, transactionId: TransactionID) => boolean;
|
|
33
35
|
export declare const getTransactionDetail: (state: RootState, transactionId: TransactionID, fetchLinkedTransactions?: boolean) => TransactionDetailReport;
|
|
34
36
|
export declare function getTransactionDetailForTransaction(rootState: RootState, transactionId: TransactionID): TransactionDetailReport | undefined;
|
|
35
37
|
export declare const getInitialUpdatablePeriodsForTransactionRecommendations: (companyIncorporationDate?: ZeniDate, bookCloseDate?: ZeniDate) => {
|
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.getInitialUpdatablePeriodsForTransactionRecommendations = exports.getTransactionDetail = void 0;
|
|
6
|
+
exports.getInitialUpdatablePeriodsForTransactionRecommendations = exports.getTransactionDetail = exports.getDetailInFlightRecommendations = void 0;
|
|
7
7
|
exports.getTransactionDetailForTransaction = getTransactionDetailForTransaction;
|
|
8
8
|
const get_1 = __importDefault(require("lodash/get"));
|
|
9
9
|
const reduceFetchState_1 = require("../../commonStateTypes/reduceFetchState");
|
|
@@ -17,6 +17,27 @@ const accountListSelector_1 = require("../accountList/accountListSelector");
|
|
|
17
17
|
const classListSelector_1 = require("../classList/classListSelector");
|
|
18
18
|
const projectListSelector_1 = require("../projectList/projectListSelector");
|
|
19
19
|
const transactionDetailState_1 = require("./transactionDetailState");
|
|
20
|
+
// "Any line on this transaction is fetching category/class recommendations?"
|
|
21
|
+
// Inlined as a plain function because the upstream selector
|
|
22
|
+
// `getTransactionDetail` is also un-memoized and the iteration is O(lines)
|
|
23
|
+
// — typically <10. Exported standalone so consumers that only need the
|
|
24
|
+
// flag (e.g. footer save-disable) can avoid materializing the whole
|
|
25
|
+
// detail report.
|
|
26
|
+
const getDetailInFlightRecommendations = (state, transactionId) => {
|
|
27
|
+
const detailKey = (0, transactionDetailState_1.getTransactionDetailKey)(transactionId);
|
|
28
|
+
const detail = (0, get_1.default)(state.transactionDetailState.transactionDetailById, detailKey, undefined);
|
|
29
|
+
if (detail == null) {
|
|
30
|
+
return false;
|
|
31
|
+
}
|
|
32
|
+
for (const lineItem of Object.values(detail.transactionDetailLocalData.lineItemById)) {
|
|
33
|
+
if (lineItem.categoryClassRecommendationsFetchState?.fetchState ===
|
|
34
|
+
'In-Progress') {
|
|
35
|
+
return true;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
return false;
|
|
39
|
+
};
|
|
40
|
+
exports.getDetailInFlightRecommendations = getDetailInFlightRecommendations;
|
|
20
41
|
const getTransactionDetail = (state, transactionId, fetchLinkedTransactions = true) => {
|
|
21
42
|
const { transactionDetailState, transactionState, vendorState, vendorListState, accountState, classState, classListState, accountListState, projectState, projectListState, } = state;
|
|
22
43
|
const detailKey = (0, transactionDetailState_1.getTransactionDetailKey)(transactionId);
|
|
@@ -63,7 +84,13 @@ const getTransactionDetail = (state, transactionId, fetchLinkedTransactions = tr
|
|
|
63
84
|
const isAccountingClassesEnabled = (0, tenantSelector_1.getIsAccountingClassesEnabled)(state);
|
|
64
85
|
const classList = isAccountingClassesEnabled
|
|
65
86
|
? (0, classListSelector_1.getClassList)(classState, classListState)
|
|
66
|
-
: {
|
|
87
|
+
: {
|
|
88
|
+
classes: [],
|
|
89
|
+
nestedClassHierarchy: [],
|
|
90
|
+
fetchState: 'Completed',
|
|
91
|
+
error: undefined,
|
|
92
|
+
version: 0,
|
|
93
|
+
};
|
|
67
94
|
const isAccountingProjectsEnabled = (0, tenantSelector_1.getIsAccountingProjectsEnabled)(state);
|
|
68
95
|
const projectList = isAccountingProjectsEnabled
|
|
69
96
|
? (0, projectListSelector_1.getProjectList)(projectState, projectListState)
|
|
@@ -79,6 +106,7 @@ const getTransactionDetail = (state, transactionId, fetchLinkedTransactions = tr
|
|
|
79
106
|
: [];
|
|
80
107
|
const transactionDetailAnyUpdateStatus = reduceUpdateFetchStates(transactionDetail);
|
|
81
108
|
const vendors = (0, vendorSelector_1.getVendorsByVendorIds)(vendorState, vendorListState.vendorIds);
|
|
109
|
+
const hasInFlightCategoryClassRecommendations = (0, exports.getDetailInFlightRecommendations)(state, transactionId);
|
|
82
110
|
return {
|
|
83
111
|
reportId: 'transaction_detail',
|
|
84
112
|
reportTitle: 'Transaction Detail',
|
|
@@ -94,6 +122,7 @@ const getTransactionDetail = (state, transactionId, fetchLinkedTransactions = tr
|
|
|
94
122
|
classHierarchyList,
|
|
95
123
|
accountsHierarchyList,
|
|
96
124
|
classList: classList,
|
|
125
|
+
hasInFlightCategoryClassRecommendations,
|
|
97
126
|
isAccountingClassesEnabled,
|
|
98
127
|
isAccountingProjectsEnabled,
|
|
99
128
|
projectList,
|
|
@@ -14,6 +14,7 @@ export interface TransactionDetailLineItemData extends TransactionLineBase {
|
|
|
14
14
|
isClassMiscategorized: boolean;
|
|
15
15
|
account?: AccountBase;
|
|
16
16
|
billable?: BillableStatus;
|
|
17
|
+
categoryClassRecommendationsFetchState?: FetchStateAndError;
|
|
17
18
|
class?: ClassBase;
|
|
18
19
|
customer?: CustomerBase;
|
|
19
20
|
isCategoryUpdateSelected?: boolean;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { RootState } from '../../reducer';
|
|
2
1
|
import { FetchState } from '../../commonStateTypes/common';
|
|
2
|
+
import { RootState } from '../../reducer';
|
|
3
3
|
export declare const getZeniOAuthApproveFetchState: (state: RootState) => FetchState;
|
|
4
4
|
export declare const getZeniOAuthApproveRedirectUrl: (state: RootState) => string | undefined;
|
|
5
5
|
export declare const getZeniOAuthApproveError: (state: RootState) => string | null;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zeniai/client-epic-state",
|
|
3
|
-
"version": "5.0.
|
|
3
|
+
"version": "5.0.79",
|
|
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",
|
|
@@ -106,12 +106,17 @@
|
|
|
106
106
|
"scripts": {
|
|
107
107
|
"clean": "rimraf lib",
|
|
108
108
|
"test:typecheck": "echo 'Typechecking test files...' && NODE_OPTIONS=--max-old-space-size=4096 time tsc -p tsconfig.typecheck.json",
|
|
109
|
-
"test": "
|
|
110
|
-
"
|
|
109
|
+
"test:typecheck-modified-files": "chmod +x ./scripts/tsc-modified-files.sh && ./scripts/tsc-modified-files.sh master tsconfig.typecheck.json",
|
|
110
|
+
"test": "pnpm lint-modified-files && pnpm test:typecheck-modified-files && vitest run --typecheck",
|
|
111
|
+
"lint": "eslint . --ext .js,.jsx,.ts,.tsx --max-warnings 0 --fix",
|
|
112
|
+
"lint-modified-files": "chmod +x ./scripts/lint-modified-files.sh && ./scripts/lint-modified-files.sh",
|
|
113
|
+
"lint:fix-modified-files": "chmod +x ./scripts/lint-modified-files.sh && LINT_FIX=true ./scripts/lint-modified-files.sh",
|
|
114
|
+
"tsc-modified-files": "chmod +x ./scripts/tsc-modified-files.sh && ./scripts/tsc-modified-files.sh",
|
|
115
|
+
"typecheck": "tsc --noEmit",
|
|
111
116
|
"find-dead-code": "ts-prune | grep -v '(used in module)'",
|
|
112
117
|
"find-unused-exports": "ts-unused-exports ./tsconfig.json",
|
|
113
118
|
"circular-dependency": "npx madge --circular --extensions ts ./src",
|
|
114
|
-
"build": "concurrently --kill-others-on-fail --handle-input \"echo '
|
|
119
|
+
"build": "concurrently --kill-others-on-fail --handle-input \"echo 'TypeScript build in progress...' && time tsc && echo 'ESM build...' && tsc -p tsconfig.esm.json\" \"echo 'Running tests and typecheck (incl. lint-modified-files)...' && pnpm test\" && rimraf \"lib/**/__mocks__\" \"lib/**/__testHelpers__\"",
|
|
115
120
|
"only-build": "eslint . --ext .js,.jsx,.ts,.tsx && time tsc && tsc -p tsconfig.esm.json && rimraf \"lib/**/__mocks__\" \"lib/**/__testHelpers__\"",
|
|
116
121
|
"only-build-dev": "eslint . --ext .js,.jsx,.ts,.tsx && time tsc -p tsconfig.dev.json && tsc -p tsconfig.esm.dev.json && rimraf \"lib/**/__mocks__\" \"lib/**/__testHelpers__\"",
|
|
117
122
|
"format": "prettier --write --ignore-unknown \"src/**/*\" && pnpm lint",
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { of } from 'rxjs';
|
|
2
|
-
import { catchError, filter, switchMap } from 'rxjs/operators';
|
|
3
|
-
import { createZeniAPIStatus, isSuccessResponse } from '../../../responsePayload';
|
|
4
|
-
import { fetchCreditAgentAccess, fetchCreditAgentAccessFailure, fetchCreditAgentAccessSuccess, } from '../creditAgentViewReducer';
|
|
5
|
-
export const fetchCreditAgentAccessEpic = (actions$, _state$, zeniAPI) => actions$.pipe(filter(fetchCreditAgentAccess.match), switchMap(() => {
|
|
6
|
-
const url = `${zeniAPI.apiEndPoints.cardMicroServiceBaseUrl}/1.0/cockpit/cards-cockpit-access`;
|
|
7
|
-
return zeniAPI.getJSON(url).pipe(switchMap((response) => {
|
|
8
|
-
if (isSuccessResponse(response) && response.data != null) {
|
|
9
|
-
return of(fetchCreditAgentAccessSuccess(response.data.is_allowed === true));
|
|
10
|
-
}
|
|
11
|
-
return of(fetchCreditAgentAccessFailure(response.status));
|
|
12
|
-
}), catchError((error) => of(fetchCreditAgentAccessFailure(createZeniAPIStatus('Unexpected error', 'REST API call errored out: ' + JSON.stringify(error))))));
|
|
13
|
-
}));
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { ActionsObservable } from 'redux-observable';
|
|
2
|
-
import { ZeniAPI } from '../../../zeniAPI';
|
|
3
|
-
import { fetchCreditAgentAccess, fetchCreditAgentAccessFailure, fetchCreditAgentAccessSuccess } from '../creditAgentViewReducer';
|
|
4
|
-
export type ActionType = ReturnType<typeof fetchCreditAgentAccess> | ReturnType<typeof fetchCreditAgentAccessSuccess> | ReturnType<typeof fetchCreditAgentAccessFailure>;
|
|
5
|
-
export declare const fetchCreditAgentAccessEpic: (actions$: ActionsObservable<ActionType>, _state$: unknown, zeniAPI: ZeniAPI) => import("rxjs").Observable<{
|
|
6
|
-
payload: boolean;
|
|
7
|
-
type: "creditAgentView/fetchCreditAgentAccessSuccess";
|
|
8
|
-
} | {
|
|
9
|
-
payload: import("../../../responsePayload").ZeniAPIStatus<Record<string, unknown>>;
|
|
10
|
-
type: "creditAgentView/fetchCreditAgentAccessFailure";
|
|
11
|
-
}>;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.fetchCreditAgentAccessEpic = void 0;
|
|
4
|
-
const rxjs_1 = require("rxjs");
|
|
5
|
-
const operators_1 = require("rxjs/operators");
|
|
6
|
-
const responsePayload_1 = require("../../../responsePayload");
|
|
7
|
-
const creditAgentViewReducer_1 = require("../creditAgentViewReducer");
|
|
8
|
-
const fetchCreditAgentAccessEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(creditAgentViewReducer_1.fetchCreditAgentAccess.match), (0, operators_1.switchMap)(() => {
|
|
9
|
-
const url = `${zeniAPI.apiEndPoints.cardMicroServiceBaseUrl}/1.0/cockpit/cards-cockpit-access`;
|
|
10
|
-
return zeniAPI.getJSON(url).pipe((0, operators_1.switchMap)((response) => {
|
|
11
|
-
if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
|
|
12
|
-
return (0, rxjs_1.of)((0, creditAgentViewReducer_1.fetchCreditAgentAccessSuccess)(response.data.is_allowed === true));
|
|
13
|
-
}
|
|
14
|
-
return (0, rxjs_1.of)((0, creditAgentViewReducer_1.fetchCreditAgentAccessFailure)(response.status));
|
|
15
|
-
}), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, creditAgentViewReducer_1.fetchCreditAgentAccessFailure)((0, responsePayload_1.createZeniAPIStatus)('Unexpected error', 'REST API call errored out: ' + JSON.stringify(error))))));
|
|
16
|
-
}));
|
|
17
|
-
exports.fetchCreditAgentAccessEpic = fetchCreditAgentAccessEpic;
|