@zeniai/client-epic-state 4.13.80 → 4.13.82

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.
@@ -85,10 +85,6 @@ const saveVendorEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operator
85
85
  amount: 0,
86
86
  currencyCode: vendorCurrencyCode,
87
87
  currencySymbol: vendorCurrencySymbol,
88
- }, recipientAmount: {
89
- amount: 0,
90
- currencyCode: vendorCurrencyCode,
91
- currencySymbol: vendorCurrencySymbol,
92
88
  }, id: '1', lineDescription: '', platformLineDetailType: 'account_based_expense_line_detail', type: 'transaction_with_account_and_class_line', billable: 'not_billable', isCategoryMiscategorized: false, isClassMiscategorized: false }, editBillViewState_1.defaultRecommendationStateObj);
93
89
  }
94
90
  }
@@ -7,8 +7,10 @@ const userSelector_1 = require("../../../entity/user/userSelector");
7
7
  const vendorSelector_1 = require("../../../entity/vendor/vendorSelector");
8
8
  const tenantSelector_1 = require("../../../entity/tenant/tenantSelector");
9
9
  const timePeriod_1 = require("../../../commonStateTypes/timePeriod");
10
+ const expenseAutomationViewSelectorTypes_1 = require("../selectorTypes/expenseAutomationViewSelectorTypes");
10
11
  function getExpenseAutomationFluxAnalysisView(state) {
11
- const { expenseAutomationFluxAnalysisViewState } = state;
12
+ var _a;
13
+ const { expenseAutomationFluxAnalysisViewState, monthEndCloseChecksState } = state;
12
14
  const { fetchState, error, refreshStatus, uiState, reviewOperatingExpensesIds, reviewStatusById, fluxAnalysisEntities, operatingExpenseIdsBySelectedPeriod, bulkReviewStatus, } = expenseAutomationFluxAnalysisViewState;
13
15
  const fetchStateAndError = {
14
16
  fetchState,
@@ -28,6 +30,10 @@ function getExpenseAutomationFluxAnalysisView(state) {
28
30
  operatingExpenses.push(fluxEntity);
29
31
  }
30
32
  });
33
+ const allSteps = monthYearPeriodId != null
34
+ ? (0, expenseAutomationViewSelectorTypes_1.getAllSteps)(monthEndCloseChecksState, monthYearPeriodId, currentTenant.tenantId)
35
+ : [];
36
+ const fluxCompletionStatus = (_a = allSteps.find((step) => step.step === 'flux_analysis')) === null || _a === void 0 ? void 0 : _a.completionStatus;
31
37
  const operatingExpensesView = [];
32
38
  operatingExpenses.forEach((operatingExpense) => {
33
39
  const vendor = (0, vendorSelector_1.getVendorByVendorId)(state.vendorState, operatingExpense.vendorId);
@@ -57,8 +63,16 @@ function getExpenseAutomationFluxAnalysisView(state) {
57
63
  });
58
64
  }
59
65
  });
60
- const isReviewCompleted = fetchStateAndError.fetchState === 'Completed' &&
61
- operatingExpensesView.filter((operatingExpense) => operatingExpense.status === 'Pending Review').length === 0;
66
+ const allOperatingExpensesReviewed = operatingExpensesView.filter((operatingExpense) => operatingExpense.status === 'Pending Review').length === 0;
67
+ const isFetchStateCompleted = fetchStateAndError.fetchState === 'Completed';
68
+ // If all operating expenses are fetched and reviewed, then the bulk review status should be 'complete'
69
+ // If there are no operating expenses (after fetch state is completed), then the bulk review status should be 'complete'
70
+ // If the flux analysis is complete and all operating expenses are reviewed (in our state), then the bulk review status should be 'complete'
71
+ const completionStatus = (isFetchStateCompleted && allOperatingExpensesReviewed) ||
72
+ (isFetchStateCompleted && operatingExpensesView.length === 0) ||
73
+ (fluxCompletionStatus === 'complete' && allOperatingExpensesReviewed)
74
+ ? 'complete'
75
+ : 'incomplete';
62
76
  return {
63
77
  fetchStatus: fetchStateAndError,
64
78
  operatingExpensesView,
@@ -66,11 +80,7 @@ function getExpenseAutomationFluxAnalysisView(state) {
66
80
  reviewOperatingExpensesIds,
67
81
  uiState,
68
82
  refreshStatus,
69
- completionStatus: (fetchStateAndError.fetchState === 'Completed' &&
70
- operatingExpensesView.length === 0) ||
71
- isReviewCompleted
72
- ? 'complete'
73
- : 'incomplete',
83
+ completionStatus,
74
84
  };
75
85
  }
76
86
  exports.getExpenseAutomationFluxAnalysisView = getExpenseAutomationFluxAnalysisView;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zeniai/client-epic-state",
3
- "version": "4.13.80",
3
+ "version": "4.13.82",
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
  "types": "lib/index.d.ts",