@zeniai/client-epic-state 4.13.80 → 4.13.81

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
  }
@@ -9,7 +9,7 @@ const classListReducer_1 = require("../../../classList/classListReducer");
9
9
  const timePeriod_1 = require("../../../../commonStateTypes/timePeriod");
10
10
  const fetchTransactionCategorizationViewEpic = (actions$, state$) => actions$.pipe((0, operators_1.filter)(transactionsViewReducer_1.fetchTransactionCategorizationView.match), (0, operators_1.mergeMap)((action) => {
11
11
  var _a;
12
- const { selectedTab, cacheOverride, keepExistingListItems, pageToken, period, refreshViewInBackground, searchString, resetListItems, } = action.payload;
12
+ const { selectedTab, cacheOverride, keepExistingListItems, pageToken, period, refreshViewInBackground, searchString, } = action.payload;
13
13
  const updateActions = [];
14
14
  const { expenseAutomationTransactionsViewState } = state$.value;
15
15
  const { fetchState, transactionIdsBySelectedPeriod } = expenseAutomationTransactionsViewState[selectedTab];
@@ -31,7 +31,7 @@ const fetchTransactionCategorizationViewEpic = (actions$, state$) => actions$.pi
31
31
  if (cacheOverride === true ||
32
32
  fetchState === 'Not-Started' ||
33
33
  transactionIds.length === 0) {
34
- updateActions.push((0, transactionsViewReducer_1.fetchTransactionCategorization)(selectedTab, period, cacheOverride, keepExistingListItems, searchString, pageToken, refreshViewInBackground, resetListItems));
34
+ updateActions.push((0, transactionsViewReducer_1.fetchTransactionCategorization)(selectedTab, period, cacheOverride, keepExistingListItems, searchString, pageToken, refreshViewInBackground));
35
35
  }
36
36
  return (0, rxjs_1.from)(updateActions);
37
37
  }));
@@ -10,23 +10,18 @@ const transactionCategorizationLocalDataHelper_1 = require("../../helpers/transa
10
10
  const initializeTransactionCategorizationViewLocalDataEpic = (actions$, state$) => actions$.pipe((0, operators_1.filter)(transactionsViewReducer_1.initializeTransactionCategorizationViewLocalData.match), (0, operators_1.mergeMap)((action) => {
11
11
  const { transactionIds, selectedPeriod, keepExistingListItems, selectedTab, pageToken, totalCount, refreshViewInBackground, } = action.payload;
12
12
  const fetchActions = [];
13
- const { transactionState, expenseAutomationTransactionsViewState, expenseAutomationViewState, } = state$.value;
14
- const { selectedTransactionCategorizationTab } = expenseAutomationViewState;
15
- const { transactionReviewLocalDataById } = expenseAutomationTransactionsViewState[selectedTransactionCategorizationTab];
16
- const transactionLocalData = Object.assign({}, transactionReviewLocalDataById);
13
+ const { transactionState } = state$.value;
14
+ const transactionLocalData = {};
17
15
  const transactions = (0, transactionSelector_1.getSupportedTransactionsByIds)(transactionState, transactionIds);
18
16
  transactions.forEach((transaction) => {
19
- var _a, _b, _c, _d;
20
- const newTransactionsLocalData = (0, transactionCategorizationLocalDataHelper_1.toTransactionDetailLocalData)(transaction);
21
17
  if (transactionLocalData[transaction.id] == null) {
22
- transactionLocalData[transaction.id] = Object.assign(Object.assign({}, transactionsViewState_1.initialSupportedTransactionCategorization), { transactionId: transaction.id, transactionReviewLocalData: Object.assign(Object.assign({}, newTransactionsLocalData), { sortedLineItems: (_b = (_a = transaction.lines) === null || _a === void 0 ? void 0 : _a.map((line) => line.id)) !== null && _b !== void 0 ? _b : [] }) });
18
+ transactionLocalData[transaction.id] = Object.assign(Object.assign({}, transactionsViewState_1.initialSupportedTransactionCategorization), { transactionId: transaction.id, transactionReviewLocalData: Object.assign({}, (0, transactionCategorizationLocalDataHelper_1.toTransactionDetailLocalData)(transaction)) });
23
19
  }
24
20
  else {
25
21
  transactionLocalData[transaction.id] = {
26
22
  transactionId: transaction.id,
27
23
  transactionReviewLocalData: Object.assign(Object.assign({}, transactionLocalData[transaction.id]
28
- .transactionReviewLocalData), Object.assign(Object.assign({}, newTransactionsLocalData), { lineItemById: Object.assign(Object.assign({}, transactionLocalData[transaction.id]
29
- .transactionReviewLocalData.lineItemById), newTransactionsLocalData.lineItemById), sortedLineItems: transactionLocalData[transaction.id].transactionReviewLocalData.sortedLineItems.concat((_d = (_c = transaction.lines) === null || _c === void 0 ? void 0 : _c.map((line) => line.id)) !== null && _d !== void 0 ? _d : []) })),
24
+ .transactionReviewLocalData), (0, transactionCategorizationLocalDataHelper_1.toTransactionDetailLocalData)(transaction)),
30
25
  };
31
26
  }
32
27
  });
@@ -49,7 +49,6 @@ const expenseAutomationFluxAnalysisView = (0, toolkit_1.createSlice)({
49
49
  draft.fetchState = 'In-Progress';
50
50
  draft.error = undefined;
51
51
  }
52
- // Reset list when we change the sort order and fetch list again
53
52
  if (resetListItems === true) {
54
53
  draft.operatingExpenseIdsBySelectedPeriod[(0, timePeriod_1.toMonthYearPeriodId)(monthAndYear)] = [];
55
54
  draft.reviewOperatingExpensesIds = [];
@@ -13,7 +13,7 @@ import { UpdateTransactionCategorization } from '../payload/transactionCategoriz
13
13
  import { RecommendationByLineId, TransactionID } from '../../../entity/transaction/stateTypes/transaction';
14
14
  export declare const initialTransactionTabViewState: TransactionsTabViewState;
15
15
  export declare const initialState: TransactionsViewState;
16
- export declare const fetchTransactionCategorization: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[selectedTab: "review" | "autoCategorized", period: TimePeriod, cacheOverride?: any, keepExistingListItems?: any, searchString?: string | undefined, pageToken?: PageToken | undefined, refreshViewInBackground?: any, resetListItems?: boolean | undefined], {
16
+ export declare const fetchTransactionCategorization: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[selectedTab: "review" | "autoCategorized", period: TimePeriod, cacheOverride?: any, keepExistingListItems?: any, searchString?: string | undefined, pageToken?: PageToken | undefined, refreshViewInBackground?: any], {
17
17
  selectedTab: "review" | "autoCategorized";
18
18
  period: TimePeriod;
19
19
  searchString: string | undefined;
@@ -21,7 +21,6 @@ export declare const fetchTransactionCategorization: import("@reduxjs/toolkit").
21
21
  pageToken: PageToken | undefined;
22
22
  cacheOverride: any;
23
23
  refreshViewInBackground: any;
24
- resetListItems: boolean | undefined;
25
24
  }, string, never, never>, updateTransactionCategorizationUIState: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
26
25
  selectedTab: TransactionsTab;
27
26
  uiState: Partial<TransactionsViewUIState>;
@@ -90,7 +89,7 @@ export declare const fetchTransactionCategorization: import("@reduxjs/toolkit").
90
89
  status: ZeniAPIStatus;
91
90
  selectedTab: TransactionsTab;
92
91
  refreshViewInBackground?: boolean | undefined;
93
- }, string>, fetchTransactionCategorizationView: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[selectedTab: "review" | "autoCategorized", period: TimePeriod, cacheOverride?: any, keepExistingListItems?: any, searchString?: string | undefined, pageToken?: PageToken | undefined, refreshViewInBackground?: any, resetListItems?: any], {
92
+ }, string>, fetchTransactionCategorizationView: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[selectedTab: "review" | "autoCategorized", period: TimePeriod, cacheOverride?: any, keepExistingListItems?: any, searchString?: string | undefined, pageToken?: PageToken | undefined, refreshViewInBackground?: any], {
94
93
  selectedTab: "review" | "autoCategorized";
95
94
  period: TimePeriod;
96
95
  searchString: string | undefined;
@@ -98,7 +97,6 @@ export declare const fetchTransactionCategorization: import("@reduxjs/toolkit").
98
97
  pageToken: PageToken | undefined;
99
98
  cacheOverride: any;
100
99
  refreshViewInBackground: any;
101
- resetListItems: any;
102
100
  }, string, never, never>, updateSelectedCheckboxTransactionIds: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
103
101
  selectedTab: TransactionsTab;
104
102
  transactionIds: ID[];
@@ -53,7 +53,7 @@ const expenseAutomationTransactionsView = (0, toolkit_1.createSlice)({
53
53
  reducers: {
54
54
  fetchTransactionCategorizationView: {
55
55
  prepare(selectedTab, period, cacheOverride = false, keepExistingListItems = false, searchString, // when this is defined the output should go to search result IDs
56
- pageToken, refreshViewInBackground = false, resetListItems = false) {
56
+ pageToken, refreshViewInBackground = false) {
57
57
  return {
58
58
  payload: {
59
59
  selectedTab,
@@ -63,7 +63,6 @@ const expenseAutomationTransactionsView = (0, toolkit_1.createSlice)({
63
63
  pageToken,
64
64
  cacheOverride,
65
65
  refreshViewInBackground,
66
- resetListItems,
67
66
  },
68
67
  };
69
68
  },
@@ -73,7 +72,9 @@ const expenseAutomationTransactionsView = (0, toolkit_1.createSlice)({
73
72
  },
74
73
  fetchTransactionCategorization: {
75
74
  reducer(draft, action) {
76
- const { refreshViewInBackground, resetListItems, selectedTab, pageToken, searchString, period, } = action.payload;
75
+ var _a, _b;
76
+ const { refreshViewInBackground } = action.payload;
77
+ const selectedTab = action.payload.selectedTab;
77
78
  if (refreshViewInBackground === true) {
78
79
  draft[selectedTab].refreshStatus = {
79
80
  fetchState: 'In-Progress',
@@ -85,36 +86,20 @@ const expenseAutomationTransactionsView = (0, toolkit_1.createSlice)({
85
86
  draft[selectedTab].error = undefined;
86
87
  }
87
88
  // Note: Need to reset scroll position whenever a new fetch happens, except when fetching through scroll
88
- if (pageToken == null) {
89
+ if (action.payload.pageToken == null) {
89
90
  // Page Token is null in each fetch except when fetching through scroll
90
91
  draft[selectedTab].uiState.scrollPosition = {
91
92
  scrollTop: 0,
92
93
  scrollLeft: undefined,
93
94
  };
94
95
  }
95
- draft[selectedTab].uiState.pageToken = pageToken !== null && pageToken !== void 0 ? pageToken : null;
96
- draft[selectedTab].uiState.searchString = searchString !== null && searchString !== void 0 ? searchString : '';
96
+ draft[selectedTab].uiState.pageToken = (_a = action.payload.pageToken) !== null && _a !== void 0 ? _a : null;
97
+ draft[selectedTab].uiState.searchString =
98
+ (_b = action.payload.searchString) !== null && _b !== void 0 ? _b : '';
97
99
  draft[selectedTab].error = undefined;
98
- // Reset list when we change the sort order and fetch list again
99
- if (resetListItems === true) {
100
- const monthYearPeriod = {
101
- month: period.start.month,
102
- year: period.start.year,
103
- };
104
- const transactionIdsBySelectedPeriod = draft[selectedTab].transactionIdsBySelectedPeriod[(0, timePeriod_1.toMonthYearPeriodId)(monthYearPeriod)];
105
- transactionIdsBySelectedPeriod.forEach((transactionId) => {
106
- delete draft[selectedTab].transactionReviewLocalDataById[transactionId];
107
- });
108
- draft[selectedTab].selectedCheckBoxTransactionIds = draft[selectedTab].selectedCheckBoxTransactionIds.filter((selectedCheckBoxTransactionId) => transactionIdsBySelectedPeriod.includes(selectedCheckBoxTransactionId));
109
- draft[selectedTab].transactionIdsBySelectedPeriod[(0, timePeriod_1.toMonthYearPeriodId)(monthYearPeriod)] = [];
110
- draft[selectedTab].refreshStatus = {
111
- fetchState: 'Not-Started',
112
- error: undefined,
113
- };
114
- }
115
100
  },
116
101
  prepare(selectedTab, period, cacheOverride = false, keepExistingListItems = false, searchString, // when this is defined the output should go to search result IDs
117
- pageToken, refreshViewInBackground = false, resetListItems) {
102
+ pageToken, refreshViewInBackground = false) {
118
103
  return {
119
104
  payload: {
120
105
  selectedTab,
@@ -124,7 +109,6 @@ const expenseAutomationTransactionsView = (0, toolkit_1.createSlice)({
124
109
  pageToken,
125
110
  cacheOverride,
126
111
  refreshViewInBackground,
127
- resetListItems,
128
112
  },
129
113
  };
130
114
  },
@@ -57,8 +57,6 @@ function getExpenseAutomationFluxAnalysisView(state) {
57
57
  });
58
58
  }
59
59
  });
60
- const isReviewCompleted = fetchStateAndError.fetchState === 'Completed' &&
61
- operatingExpensesView.filter((operatingExpense) => operatingExpense.status === 'Pending Review').length === 0;
62
60
  return {
63
61
  fetchStatus: fetchStateAndError,
64
62
  operatingExpensesView,
@@ -66,9 +64,8 @@ function getExpenseAutomationFluxAnalysisView(state) {
66
64
  reviewOperatingExpensesIds,
67
65
  uiState,
68
66
  refreshStatus,
69
- completionStatus: (fetchStateAndError.fetchState === 'Completed' &&
70
- operatingExpensesView.length === 0) ||
71
- isReviewCompleted
67
+ completionStatus: operatingExpensesView.length === 0 &&
68
+ fetchStateAndError.fetchState === 'Completed'
72
69
  ? 'complete'
73
70
  : 'incomplete',
74
71
  };
@@ -58,7 +58,6 @@ export interface TransactionCategorizationLineItemData extends TransactionLineBa
58
58
  }
59
59
  export interface TransactionReviewLocalData {
60
60
  lineItemById: Record<ID, TransactionCategorizationLineItemData>;
61
- sortedLineItems: ID[];
62
61
  vendor?: VendorBase;
63
62
  memo?: string;
64
63
  vendorDetails?: {
@@ -24,6 +24,5 @@ exports.initialSupportedTransactionCategorization = {
24
24
  transactionId: undefined,
25
25
  transactionReviewLocalData: {
26
26
  lineItemById: {},
27
- sortedLineItems: [],
28
27
  },
29
28
  };
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.81",
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",