@zeniai/client-epic-state 4.19.99-betaAD07 → 4.19.99-betaAK1

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.
Files changed (40) hide show
  1. package/lib/entity/jeSchedules/jeSchedulesPayload.d.ts +6 -9
  2. package/lib/entity/jeSchedules/jeSchedulesPayload.js +2 -36
  3. package/lib/entity/jeSchedules/jeSchedulesSelector.d.ts +2 -4
  4. package/lib/entity/jeSchedules/jeSchedulesSelector.js +2 -5
  5. package/lib/entity/jeSchedules/jeSchedulesState.d.ts +2 -26
  6. package/lib/entity/transaction/payloadTypes/scheduleTransactionPayload.d.ts +1 -4
  7. package/lib/entity/transaction/payloadTypes/scheduleTransactionPayload.js +0 -1
  8. package/lib/entity/transaction/stateTypes/scheduleTransaction.d.ts +0 -1
  9. package/lib/esm/entity/jeSchedules/jeSchedulesPayload.js +2 -36
  10. package/lib/esm/entity/jeSchedules/jeSchedulesSelector.js +2 -5
  11. package/lib/esm/entity/transaction/payloadTypes/scheduleTransactionPayload.js +0 -1
  12. package/lib/esm/view/expenseAutomationView/expenseAutomationViewSelector.js +1 -0
  13. package/lib/esm/view/expenseAutomationView/selectors/fluxAnalysisViewSelector.js +2 -10
  14. package/lib/esm/view/expenseAutomationView/selectors/jeSchedulesViewSelector.js +3 -13
  15. package/lib/esm/view/expenseAutomationView/selectors/missingReceiptsSelector.js +3 -11
  16. package/lib/esm/view/expenseAutomationView/selectors/reconciliationViewSelector.js +9 -22
  17. package/lib/esm/view/expenseAutomationView/selectors/transactionCategorizationSelector.js +6 -12
  18. package/lib/esm/view/expenseAutomationView/types/jeSchedulesViewState.js +0 -1
  19. package/lib/esm/view/profitAndLossClassesView/profitAndLossClassesByClassHorizontalSelector.js +8 -3
  20. package/lib/esm/view/profitAndLossClassesView/profitAndLossHorizontalEnrichment.js +59 -140
  21. package/lib/index.d.ts +3 -3
  22. package/lib/tsconfig.typecheck.tsbuildinfo +1 -1
  23. package/lib/view/aiCfoView/aiCfoViewPayload.d.ts +1 -1
  24. package/lib/view/aiCfoView/aiCfoViewReducer.d.ts +1 -1
  25. package/lib/view/aiCfoView/aiCfoViewSelector.d.ts +1 -1
  26. package/lib/view/aiCfoView/aiCfoViewState.d.ts +4 -1
  27. package/lib/view/expenseAutomationView/expenseAutomationViewSelector.js +1 -0
  28. package/lib/view/expenseAutomationView/selectors/fluxAnalysisViewSelector.js +2 -10
  29. package/lib/view/expenseAutomationView/selectors/jeSchedulesViewSelector.js +3 -13
  30. package/lib/view/expenseAutomationView/selectors/missingReceiptsSelector.js +3 -11
  31. package/lib/view/expenseAutomationView/selectors/reconciliationViewSelector.js +9 -22
  32. package/lib/view/expenseAutomationView/selectors/transactionCategorizationSelector.js +5 -11
  33. package/lib/view/expenseAutomationView/types/jeSchedulesViewState.d.ts +1 -1
  34. package/lib/view/expenseAutomationView/types/jeSchedulesViewState.js +0 -1
  35. package/lib/view/profitAndLossClassesView/profitAndLossClassesByClassHorizontalSelector.js +8 -3
  36. package/lib/view/profitAndLossClassesView/profitAndLossHorizontalEnrichment.js +59 -140
  37. package/package.json +1 -1
  38. package/lib/common/aiCfo/aiCfoSuggestedQuestionsPageContext.d.ts +0 -19
  39. package/lib/common/aiCfo/aiCfoSuggestedQuestionsPageContext.js +0 -2
  40. package/lib/esm/common/aiCfo/aiCfoSuggestedQuestionsPageContext.js +0 -1
@@ -25,28 +25,26 @@ export interface JEScheduleAISummariesPayload {
25
25
  debit_accounting_class?: JEScheduleAISummaryFieldPayload;
26
26
  period?: JEScheduleAISummaryFieldPayload;
27
27
  posting_date?: JEScheduleAISummaryFieldPayload;
28
- schedule_type?: JEScheduleAISummaryFieldPayload;
29
28
  }
30
29
  export interface JEScheduleRecommendationsPayload {
30
+ amortization_days?: number | null;
31
+ amortization_months_estimate?: number | null;
31
32
  credit_account_confidence?: number;
33
+ credit_account_id?: string | null;
34
+ credit_accounting_class_id?: string | null;
32
35
  credit_class_confidence?: number;
33
36
  debit_account_confidence?: number;
37
+ debit_account_id?: string | null;
38
+ debit_accounting_class_id?: string | null;
34
39
  debit_class_confidence?: number;
35
40
  end_date?: string | null;
36
- je_credit_account_id?: string | null;
37
- je_credit_accounting_class_id?: string | null;
38
- je_debit_account_id?: string | null;
39
- je_debit_accounting_class_id?: string | null;
40
41
  je_schedule_type?: string | null;
41
- je_schedule_type_confidence?: number;
42
42
  period?: number | null;
43
43
  period_confidence?: number;
44
44
  posting_date?: string | null;
45
- posting_date_confidence?: number;
46
45
  similar_transactions?: unknown[];
47
46
  start_date?: string | null;
48
47
  starting_month?: string | null;
49
- starting_month_confidence?: number;
50
48
  }
51
49
  export interface JEScheduledTransactionPayload {
52
50
  balance: number | null;
@@ -71,7 +69,6 @@ export interface JEScheduledTransactionPayload {
71
69
  updated_by: UserPayload;
72
70
  vendor: VendorPayload;
73
71
  ai_summaries?: JEScheduleAISummariesPayload;
74
- created_by?: UserPayload;
75
72
  end_date?: string | null;
76
73
  recommendations?: JEScheduleRecommendationsPayload;
77
74
  updated_at?: string | null;
@@ -146,7 +146,7 @@ function toJEScheduleOtherAttributes(payload) {
146
146
  assetId: payload.asset_id ?? undefined,
147
147
  };
148
148
  }
149
- function toJEScheduleAISummaries(payload) {
149
+ function toJEScheduleAIRecommendations(payload) {
150
150
  if (payload == null) {
151
151
  return undefined;
152
152
  }
@@ -187,40 +187,8 @@ function toJEScheduleAISummaries(payload) {
187
187
  reasoning: payload.posting_date.reasoning,
188
188
  };
189
189
  }
190
- if (payload.schedule_type != null) {
191
- result.scheduleType = {
192
- confidence: payload.schedule_type.confidence,
193
- reasoning: payload.schedule_type.reasoning,
194
- };
195
- }
196
190
  return Object.keys(result).length > 0 ? result : undefined;
197
191
  }
198
- function toJEScheduleRecommendations(payload) {
199
- if (payload == null) {
200
- return undefined;
201
- }
202
- return {
203
- creditAccountConfidence: payload.credit_account_confidence,
204
- creditClassConfidence: payload.credit_class_confidence,
205
- debitAccountConfidence: payload.debit_account_confidence,
206
- debitClassConfidence: payload.debit_class_confidence,
207
- endDate: payload.end_date ?? undefined,
208
- jeCreditAccountId: payload.je_credit_account_id ?? undefined,
209
- jeCreditAccountingClassId: payload.je_credit_accounting_class_id ?? undefined,
210
- jeDebitAccountId: payload.je_debit_account_id ?? undefined,
211
- jeDebitAccountingClassId: payload.je_debit_accounting_class_id ?? undefined,
212
- jeScheduleType: payload.je_schedule_type ?? undefined,
213
- jeScheduleTypeConfidence: payload.je_schedule_type_confidence,
214
- period: payload.period ?? undefined,
215
- periodConfidence: payload.period_confidence,
216
- postingDate: payload.posting_date ?? undefined,
217
- postingDateConfidence: payload.posting_date_confidence,
218
- similarTransactions: payload.similar_transactions,
219
- startDate: payload.start_date ?? undefined,
220
- startingMonth: payload.starting_month ?? undefined,
221
- startingMonthConfidence: payload.starting_month_confidence,
222
- };
223
- }
224
192
  function toJEScheduledTransaction(payload) {
225
193
  return {
226
194
  jeScheduleId: payload.je_schedule_id ?? undefined,
@@ -265,9 +233,7 @@ function toJEScheduledTransaction(payload) {
265
233
  ? toJEScheduleOtherAttributes(payload.other_attributes)
266
234
  : {},
267
235
  scheduledJournalEntry: [],
268
- aiSummaries: toJEScheduleAISummaries(payload.ai_summaries),
269
- createdByUserID: payload.created_by?.user_id ?? undefined,
270
- recommendations: toJEScheduleRecommendations(payload.recommendations),
236
+ aiRecommendations: toJEScheduleAIRecommendations(payload.ai_summaries),
271
237
  };
272
238
  }
273
239
  function toJEAccruedScheduledTransaction(payload) {
@@ -9,7 +9,7 @@ import { ScheduleTransaction } from '../transaction/stateTypes/scheduleTransacti
9
9
  import { TransactionID } from '../transaction/stateTypes/transaction';
10
10
  import { User } from '../user/userState';
11
11
  import { Vendor } from '../vendor/vendorState';
12
- import { JEScheduleAISummaries, JEScheduleOtherAttributes, JEScheduleRecommendations, ScheduleJournalStatusCode, ScheduleStatus } from './jeSchedulesState';
12
+ import { JEScheduleAIRecommendations, JEScheduleOtherAttributes, ScheduleJournalStatusCode, ScheduleStatus } from './jeSchedulesState';
13
13
  import { JEScheduleKey, JEScheduleTransactionKey, JournalEntryErrorCodeType, ScheduleTypes } from './jeSchedulesTypes';
14
14
  export interface ScheduledJournalEntry {
15
15
  error: JournalEntryErrorCodeType[];
@@ -59,16 +59,14 @@ export interface JEScheduledTransaction {
59
59
  scheduledJournalEntry: ScheduledJournalEntry[];
60
60
  status: ScheduleStatus;
61
61
  vendor: Vendor;
62
- aiSummaries?: JEScheduleAISummaries;
62
+ aiRecommendations?: JEScheduleAIRecommendations;
63
63
  balanceAsOfToday?: Amount;
64
- createdByUser?: User;
65
64
  dayOfPostingDate?: ScheduleDaysOfMonth;
66
65
  endDate?: ZeniDate;
67
66
  jeScheduleId?: ID;
68
67
  jeScheduleType?: ScheduleTypes;
69
68
  lastDayOfMonth?: boolean;
70
69
  period?: number;
71
- recommendations?: JEScheduleRecommendations;
72
70
  startDate?: ZeniDate;
73
71
  updatedAt?: ZeniDate;
74
72
  updatedByUser?: User;
@@ -77,13 +77,12 @@ exports.getJEAccruedScheduleByJEScheduleKey = getJEAccruedScheduleByJEScheduleKe
77
77
  const getJEScheduledTransactionByJEScheduleTransactionKey = (jeScheduleTransactionKey, state) => {
78
78
  const { jeSchedulesState, vendorState, accountState, userState, classState, transactionState, } = state;
79
79
  const jeScheduleTransactionState = (0, get_1.default)(jeSchedulesState.schedulesByTransactionKey, jeScheduleTransactionKey);
80
- const { period, updatedByUserID: updatedBy, createdByUserID: createdBy, vendorId, jeCredit, jeDebit, currencyCode, currencySymbol, balanceAsOfToday, baseTransaction, startDate, endDate, status, updatedAt, jeScheduleId, scheduledJournalEntry, dayOfPostingDate: postingDate, lastDayOfMonth, otherAttributes, jeScheduleType, aiSummaries, recommendations, } = jeScheduleTransactionState;
80
+ const { period, updatedByUserID: updatedBy, vendorId, jeCredit, jeDebit, currencyCode, currencySymbol, balanceAsOfToday, baseTransaction, startDate, endDate, status, updatedAt, jeScheduleId, scheduledJournalEntry, dayOfPostingDate: postingDate, lastDayOfMonth, otherAttributes, jeScheduleType, aiRecommendations, } = jeScheduleTransactionState;
81
81
  const vendorDetails = (0, vendorSelector_1.getVendorByVendorId)(vendorState, vendorId);
82
82
  if (vendorDetails == null) {
83
83
  throw new Error(`Vendor with ${vendorId} doesn't exist`);
84
84
  }
85
85
  const userDetails = updatedBy != null ? (0, userSelector_1.getUserByUserId)(userState, updatedBy) : undefined;
86
- const createdByUserDetails = createdBy != null ? (0, userSelector_1.getUserByUserId)(userState, createdBy) : undefined;
87
86
  const baseTransactionObject = (0, transactionSelector_1.getScheduleTransactionById)(transactionState, baseTransaction);
88
87
  if (baseTransactionObject == null) {
89
88
  throw Error('Base Schedule transaction cannot be null');
@@ -135,9 +134,7 @@ const getJEScheduledTransactionByJEScheduleTransactionKey = (jeScheduleTransacti
135
134
  account: accountDebit,
136
135
  },
137
136
  scheduledJournalEntry,
138
- aiSummaries,
139
- createdByUser: createdByUserDetails,
140
- recommendations,
137
+ aiRecommendations,
141
138
  };
142
139
  };
143
140
  exports.getJEScheduledTransactionByJEScheduleTransactionKey = getJEScheduledTransactionByJEScheduleTransactionKey;
@@ -16,35 +16,13 @@ export interface JEScheduleFieldRecommendation {
16
16
  confidence: number;
17
17
  reasoning: string;
18
18
  }
19
- export interface JEScheduleAISummaries {
19
+ export interface JEScheduleAIRecommendations {
20
20
  creditAccount?: JEScheduleFieldRecommendation;
21
21
  creditClass?: JEScheduleFieldRecommendation;
22
22
  debitAccount?: JEScheduleFieldRecommendation;
23
23
  debitClass?: JEScheduleFieldRecommendation;
24
24
  period?: JEScheduleFieldRecommendation;
25
25
  postingDate?: JEScheduleFieldRecommendation;
26
- scheduleType?: JEScheduleFieldRecommendation;
27
- }
28
- export interface JEScheduleRecommendations {
29
- creditAccountConfidence?: number;
30
- creditClassConfidence?: number;
31
- debitAccountConfidence?: number;
32
- debitClassConfidence?: number;
33
- endDate?: string;
34
- jeCreditAccountId?: string;
35
- jeCreditAccountingClassId?: string;
36
- jeDebitAccountId?: string;
37
- jeDebitAccountingClassId?: string;
38
- jeScheduleType?: string;
39
- jeScheduleTypeConfidence?: number;
40
- period?: number;
41
- periodConfidence?: number;
42
- postingDate?: string;
43
- postingDateConfidence?: number;
44
- similarTransactions?: unknown[];
45
- startDate?: string;
46
- startingMonth?: string;
47
- startingMonthConfidence?: number;
48
26
  }
49
27
  export interface JEScheduleOtherAttributes {
50
28
  assetId?: string;
@@ -90,16 +68,14 @@ export interface JEScheduledTransactionState {
90
68
  scheduledJournalEntry: ScheduledJournalEntryState[];
91
69
  status: ScheduleStatus;
92
70
  vendorId: ID;
93
- aiSummaries?: JEScheduleAISummaries;
71
+ aiRecommendations?: JEScheduleAIRecommendations;
94
72
  balanceAsOfToday?: number;
95
- createdByUserID?: ID;
96
73
  dayOfPostingDate?: ScheduleDaysOfMonth;
97
74
  endDate?: ZeniDate;
98
75
  jeScheduleId?: ID;
99
76
  jeScheduleType?: ScheduleTypes;
100
77
  lastDayOfMonth?: boolean;
101
78
  period?: number;
102
- recommendations?: JEScheduleRecommendations;
103
79
  startDate?: ZeniDate;
104
80
  updatedAt?: ZeniDate;
105
81
  updatedByUserID?: ID;
@@ -2,15 +2,12 @@ import { AccountBasePayload } from '../../account/accountPayload';
2
2
  import { ClassBasePayload } from '../../class/classPayload';
3
3
  import { ScheduleTransaction } from '../stateTypes/scheduleTransaction';
4
4
  import { TransactionIDPayload } from './transactionIDPayload';
5
- export interface ScheduleTransactionPayload extends TransactionIDPayload, Omit<AccountBasePayload, 'qbo_id' | 'labels'>, Omit<ClassBasePayload, 'qbo_id' | 'labels'> {
5
+ export interface ScheduleTransactionPayload extends TransactionIDPayload, Omit<AccountBasePayload, 'qbo_id'>, Omit<ClassBasePayload, 'qbo_id' | 'labels'> {
6
6
  line_id: string;
7
7
  third_party_transaction_id: string;
8
8
  total_amount: number;
9
9
  transaction_date: string;
10
10
  transaction_memo: string;
11
11
  transaction_type_name: string;
12
- labels?: string[];
13
- sync_token?: number;
14
- transaction_description?: string | null;
15
12
  }
16
13
  export declare const toScheduleTransaction: (payload: ScheduleTransactionPayload, currency_code: string, currency_symbol: string) => ScheduleTransaction;
@@ -32,7 +32,6 @@ const toScheduleTransaction = (payload, currency_code, currency_symbol) => {
32
32
  currencyCode: currency_code,
33
33
  currencySymbol: currency_symbol,
34
34
  },
35
- description: payload.transaction_description ?? undefined,
36
35
  };
37
36
  };
38
37
  exports.toScheduleTransaction = toScheduleTransaction;
@@ -9,5 +9,4 @@ export interface ScheduleTransaction extends BaseTransaction {
9
9
  lineId: ID;
10
10
  thirdPartyTransactionId: ID;
11
11
  classBase?: ClassBase;
12
- description?: string;
13
12
  }
@@ -136,7 +136,7 @@ function toJEScheduleOtherAttributes(payload) {
136
136
  assetId: payload.asset_id ?? undefined,
137
137
  };
138
138
  }
139
- function toJEScheduleAISummaries(payload) {
139
+ function toJEScheduleAIRecommendations(payload) {
140
140
  if (payload == null) {
141
141
  return undefined;
142
142
  }
@@ -177,40 +177,8 @@ function toJEScheduleAISummaries(payload) {
177
177
  reasoning: payload.posting_date.reasoning,
178
178
  };
179
179
  }
180
- if (payload.schedule_type != null) {
181
- result.scheduleType = {
182
- confidence: payload.schedule_type.confidence,
183
- reasoning: payload.schedule_type.reasoning,
184
- };
185
- }
186
180
  return Object.keys(result).length > 0 ? result : undefined;
187
181
  }
188
- function toJEScheduleRecommendations(payload) {
189
- if (payload == null) {
190
- return undefined;
191
- }
192
- return {
193
- creditAccountConfidence: payload.credit_account_confidence,
194
- creditClassConfidence: payload.credit_class_confidence,
195
- debitAccountConfidence: payload.debit_account_confidence,
196
- debitClassConfidence: payload.debit_class_confidence,
197
- endDate: payload.end_date ?? undefined,
198
- jeCreditAccountId: payload.je_credit_account_id ?? undefined,
199
- jeCreditAccountingClassId: payload.je_credit_accounting_class_id ?? undefined,
200
- jeDebitAccountId: payload.je_debit_account_id ?? undefined,
201
- jeDebitAccountingClassId: payload.je_debit_accounting_class_id ?? undefined,
202
- jeScheduleType: payload.je_schedule_type ?? undefined,
203
- jeScheduleTypeConfidence: payload.je_schedule_type_confidence,
204
- period: payload.period ?? undefined,
205
- periodConfidence: payload.period_confidence,
206
- postingDate: payload.posting_date ?? undefined,
207
- postingDateConfidence: payload.posting_date_confidence,
208
- similarTransactions: payload.similar_transactions,
209
- startDate: payload.start_date ?? undefined,
210
- startingMonth: payload.starting_month ?? undefined,
211
- startingMonthConfidence: payload.starting_month_confidence,
212
- };
213
- }
214
182
  export function toJEScheduledTransaction(payload) {
215
183
  return {
216
184
  jeScheduleId: payload.je_schedule_id ?? undefined,
@@ -255,9 +223,7 @@ export function toJEScheduledTransaction(payload) {
255
223
  ? toJEScheduleOtherAttributes(payload.other_attributes)
256
224
  : {},
257
225
  scheduledJournalEntry: [],
258
- aiSummaries: toJEScheduleAISummaries(payload.ai_summaries),
259
- createdByUserID: payload.created_by?.user_id ?? undefined,
260
- recommendations: toJEScheduleRecommendations(payload.recommendations),
226
+ aiRecommendations: toJEScheduleAIRecommendations(payload.ai_summaries),
261
227
  };
262
228
  }
263
229
  export function toJEAccruedScheduledTransaction(payload) {
@@ -70,13 +70,12 @@ export const getJEAccruedScheduleByJEScheduleKey = (JEScheduleKey, state) => {
70
70
  export const getJEScheduledTransactionByJEScheduleTransactionKey = (jeScheduleTransactionKey, state) => {
71
71
  const { jeSchedulesState, vendorState, accountState, userState, classState, transactionState, } = state;
72
72
  const jeScheduleTransactionState = recordGet(jeSchedulesState.schedulesByTransactionKey, jeScheduleTransactionKey);
73
- const { period, updatedByUserID: updatedBy, createdByUserID: createdBy, vendorId, jeCredit, jeDebit, currencyCode, currencySymbol, balanceAsOfToday, baseTransaction, startDate, endDate, status, updatedAt, jeScheduleId, scheduledJournalEntry, dayOfPostingDate: postingDate, lastDayOfMonth, otherAttributes, jeScheduleType, aiSummaries, recommendations, } = jeScheduleTransactionState;
73
+ const { period, updatedByUserID: updatedBy, vendorId, jeCredit, jeDebit, currencyCode, currencySymbol, balanceAsOfToday, baseTransaction, startDate, endDate, status, updatedAt, jeScheduleId, scheduledJournalEntry, dayOfPostingDate: postingDate, lastDayOfMonth, otherAttributes, jeScheduleType, aiRecommendations, } = jeScheduleTransactionState;
74
74
  const vendorDetails = getVendorByVendorId(vendorState, vendorId);
75
75
  if (vendorDetails == null) {
76
76
  throw new Error(`Vendor with ${vendorId} doesn't exist`);
77
77
  }
78
78
  const userDetails = updatedBy != null ? getUserByUserId(userState, updatedBy) : undefined;
79
- const createdByUserDetails = createdBy != null ? getUserByUserId(userState, createdBy) : undefined;
80
79
  const baseTransactionObject = getScheduleTransactionById(transactionState, baseTransaction);
81
80
  if (baseTransactionObject == null) {
82
81
  throw Error('Base Schedule transaction cannot be null');
@@ -128,8 +127,6 @@ export const getJEScheduledTransactionByJEScheduleTransactionKey = (jeScheduleTr
128
127
  account: accountDebit,
129
128
  },
130
129
  scheduledJournalEntry,
131
- aiSummaries,
132
- createdByUser: createdByUserDetails,
133
- recommendations,
130
+ aiRecommendations,
134
131
  };
135
132
  };
@@ -29,6 +29,5 @@ export const toScheduleTransaction = (payload, currency_code, currency_symbol) =
29
29
  currencyCode: currency_code,
30
30
  currencySymbol: currency_symbol,
31
31
  },
32
- description: payload.transaction_description ?? undefined,
33
32
  };
34
33
  };
@@ -91,6 +91,7 @@ export function getExpenseAutomationView(state) {
91
91
  const fetchStateVariables = [
92
92
  expenseAutomationMissingReceiptsViewState,
93
93
  expenseAutomationJESchedulesViewState,
94
+ monthEndCloseChecksView,
94
95
  expenseAutomationTransactionsView,
95
96
  expenseAutomationReconciliationViewState,
96
97
  ];
@@ -1,4 +1,3 @@
1
- import { reduceAnyFetchState } from '../../../commonStateTypes/reduceFetchState';
2
1
  import { toMonthYearPeriodId } from '../../../commonStateTypes/timePeriod';
3
2
  import { getAccountBase } from '../../../entity/account/accountSelector';
4
3
  import { getClassById } from '../../../entity/class/classSelector';
@@ -7,7 +6,7 @@ import { getUserByUserId } from '../../../entity/user/userSelector';
7
6
  import { getVendorByVendorId } from '../../../entity/vendor/vendorSelector';
8
7
  import { getAllSteps } from '../selectorTypes/expenseAutomationViewSelectorTypes';
9
8
  export function getExpenseAutomationFluxAnalysisView(state) {
10
- const { expenseAutomationFluxAnalysisViewState, monthEndCloseChecksState, monthEndCloseChecksViewState, } = state;
9
+ const { expenseAutomationFluxAnalysisViewState, monthEndCloseChecksState } = state;
11
10
  const { fetchState, error, refreshStatus, uiState, reviewOperatingExpenseIdsByPeriod, selectedSectionIdsByPeriod, groupsBySelectedPeriod, fluxAnalysisEntities, bulkReviewStatus, currency, totalBalancesAndVariance, } = expenseAutomationFluxAnalysisViewState;
12
11
  const fetchStateAndError = {
13
12
  fetchState,
@@ -92,17 +91,10 @@ export function getExpenseAutomationFluxAnalysisView(state) {
92
91
  },
93
92
  };
94
93
  const completionStatus = fluxCompletionStatus != null ? fluxCompletionStatus : 'incomplete';
95
- const monthEndFetchState = monthYearPeriodId != null
96
- ? (monthEndCloseChecksViewState.monthEndCloseChecksViewByTenantId[currentTenant.tenantId]?.[monthYearPeriodId] ?? { fetchState: 'Not-Started', error: undefined })
97
- : { fetchState: 'Not-Started', error: undefined };
98
- const reducedFetchStatus = reduceAnyFetchState([
99
- fetchStateAndError,
100
- monthEndFetchState,
101
- ]);
102
94
  return {
103
95
  sections,
104
96
  totalBalancesAndVariance,
105
- fetchStatus: reducedFetchStatus,
97
+ fetchStatus: fetchStateAndError,
106
98
  bulkReviewStatus,
107
99
  reviewOperatingExpensesIds,
108
100
  selectedSectionIds,
@@ -1,6 +1,5 @@
1
1
  import omit from 'lodash/omit';
2
2
  import orderBy from 'lodash/orderBy';
3
- import { reduceAnyFetchState } from '../../../commonStateTypes/reduceFetchState';
4
3
  import { toMonthYearPeriodId } from '../../../commonStateTypes/timePeriod';
5
4
  import { getAccountIdsForTypes } from '../../../entity/account/accountSelector';
6
5
  import { getJEScheduledTransactionByJEScheduleTransactionKey, } from '../../../entity/jeSchedules/jeSchedulesSelector';
@@ -20,8 +19,6 @@ function getJEScheduleSortAccessor(sortKey) {
20
19
  return (s) => s.jeDebit.account?.accountName?.toLowerCase();
21
20
  case 'class':
22
21
  return (s) => s.jeDebit.accountingClass?.className?.toLowerCase();
23
- case 'depCategory':
24
- return (s) => s.jeCredit.account?.accountName?.toLowerCase();
25
22
  case 'scheduleCategory':
26
23
  return (s) => s.jeScheduleType;
27
24
  case 'startMonth':
@@ -53,7 +50,7 @@ function sortJEScheduledTransactions(transactions, sortKey, sortOrder) {
53
50
  export function getExpenseAutomationJESchedulesView(state) {
54
51
  const jeScheduledTransaction = [];
55
52
  const failedJeScheduledTransaction = [];
56
- const { accountState, accountListState, classState, classListState, expenseAutomationJESchedulesViewState, expenseAutomationViewState, monthEndCloseChecksState, monthEndCloseChecksViewState, } = state;
53
+ const { accountState, accountListState, classState, classListState, expenseAutomationJESchedulesViewState, expenseAutomationViewState, monthEndCloseChecksState, } = state;
57
54
  const { jeScheduleTransactionKeysByPeriod, failedJeScheduleTransactionKeysByPeriod, jeScheduleLocalDataById, postStatusById, ignoreStatusById, uiState, error, fetchState, refreshStatus, } = expenseAutomationJESchedulesViewState;
58
55
  const accountSettingsView = getJEAccountSettingsView(state);
59
56
  const currentTenant = getCurrentTenant(state);
@@ -119,13 +116,6 @@ export function getExpenseAutomationJESchedulesView(state) {
119
116
  : [];
120
117
  const jeCompletionStatus = allSteps.find((step) => step.step === 'je_schedules')?.completionStatus;
121
118
  const completionStatus = jeCompletionStatus != null ? jeCompletionStatus : 'incomplete';
122
- const monthEndFetchState = monthYearPeriodId != null
123
- ? (monthEndCloseChecksViewState.monthEndCloseChecksViewByTenantId[currentTenant.tenantId]?.[monthYearPeriodId] ?? { fetchState: 'Not-Started', error: undefined })
124
- : { fetchState: 'Not-Started', error: undefined };
125
- const reducedFetchStatus = reduceAnyFetchState([
126
- { fetchState, error },
127
- monthEndFetchState,
128
- ]);
129
119
  return {
130
120
  uncategorizedAccounts,
131
121
  allDepreciationAccountList: filteredDepAccounts,
@@ -141,10 +131,10 @@ export function getExpenseAutomationJESchedulesView(state) {
141
131
  accountSettingsView,
142
132
  postStatusById: postStatusById,
143
133
  ignoreStatusById: ignoreStatusById,
144
- fetchState: reducedFetchStatus.fetchState,
134
+ fetchState: fetchState,
145
135
  jeScheduleLocalDataById: jeScheduleLocalDataById,
146
136
  uiState: uiState,
147
- error: reducedFetchStatus.error,
137
+ error: error,
148
138
  refreshStatus,
149
139
  completionStatus,
150
140
  };
@@ -1,5 +1,4 @@
1
1
  import orderBy from 'lodash/orderBy';
2
- import { reduceAnyFetchState } from '../../../commonStateTypes/reduceFetchState';
3
2
  import { toMonthYearPeriodId } from '../../../commonStateTypes/timePeriod';
4
3
  import { getCurrentTenant } from '../../../entity/tenant/tenantSelector';
5
4
  import { getSupportedTransactionById, getSupportedTransactionsByIds, } from '../../../entity/transaction/transactionSelector';
@@ -8,7 +7,7 @@ import { getCompletedTransactionsCacheKey } from '../reducers/missingReceiptsVie
8
7
  import { getAllSteps } from '../selectorTypes/expenseAutomationViewSelectorTypes';
9
8
  import { isUnmatchedTabFileStatus, } from '../types/missingReceiptsViewState';
10
9
  export function getExpenseAutomationMissingReceiptsView(state) {
11
- const { expenseAutomationMissingReceiptsViewState, expenseAutomationViewState, transactionState, monthEndCloseChecksState, monthEndCloseChecksViewState, } = state;
10
+ const { expenseAutomationMissingReceiptsViewState, expenseAutomationViewState, transactionState, monthEndCloseChecksState, } = state;
12
11
  const currentTenant = getCurrentTenant(state);
13
12
  const { selectedPeriodByTenantId } = expenseAutomationViewState;
14
13
  const selectedPeriod = selectedPeriodByTenantId[currentTenant.tenantId];
@@ -176,16 +175,9 @@ export function getExpenseAutomationMissingReceiptsView(state) {
176
175
  vendorLogo: result.vendorLogo ?? transaction?.logo?.href,
177
176
  };
178
177
  });
179
- const monthEndFetchState = monthYearPeriodId != null
180
- ? (monthEndCloseChecksViewState.monthEndCloseChecksViewByTenantId[currentTenant.tenantId]?.[monthYearPeriodId] ?? { fetchState: 'Not-Started', error: undefined })
181
- : { fetchState: 'Not-Started', error: undefined };
182
- const reducedFetchStatus = reduceAnyFetchState([
183
- { fetchState, error },
184
- monthEndFetchState,
185
- ]);
186
178
  return {
187
- fetchState: reducedFetchStatus.fetchState,
188
- error: reducedFetchStatus.error,
179
+ fetchState,
180
+ error,
189
181
  uploadReceiptStatusById,
190
182
  uiState,
191
183
  refreshStatus,
@@ -13,7 +13,7 @@ import { getAccountList, getNestedAccountListHierarchy, } from '../../accountLis
13
13
  import { getClassList, getNestedClassListHierarchy, } from '../../classList/classListSelector';
14
14
  import { initialActionFetchState, initialReconciliationTabsState, initialState, } from '../reducers/reconciliationViewReducer';
15
15
  import { getAllSteps } from '../selectorTypes/expenseAutomationViewSelectorTypes';
16
- export const getExpenseAutomationReconciliationView = createSelector((state) => state, (state) => getCurrentTenant(state), (state) => state.expenseAutomationReconciliationViewState, (state) => state.expenseAutomationViewState, (state) => state.plaidAccountViewState, (state) => state.accountListState, (state) => state.accountState, (state) => state.classListState, (state) => state.classState, (state) => state.monthEndCloseChecksState, (state) => state.vendorState, (state) => state.monthEndCloseChecksViewState, (state, currentTenant, reconciliationViewState, expenseAutomationViewState, plaidAccountViewState, accountListState, accountState, classListState, classState, monthEndCloseChecksState, vendorState, monthEndCloseChecksViewState) => {
16
+ export const getExpenseAutomationReconciliationView = createSelector((state) => state, (state) => getCurrentTenant(state), (state) => state.expenseAutomationReconciliationViewState, (state) => state.expenseAutomationViewState, (state) => state.plaidAccountViewState, (state) => state.accountListState, (state) => state.accountState, (state) => state.classListState, (state) => state.classState, (state) => state.monthEndCloseChecksState, (state) => state.vendorState, (state, currentTenant, reconciliationViewState, expenseAutomationViewState, plaidAccountViewState, accountListState, accountState, classListState, classState, monthEndCloseChecksState, vendorState) => {
17
17
  const { selectedPeriodByTenantId } = expenseAutomationViewState;
18
18
  const reconcileTabUiState = reconciliationViewState.reconTabsState.reconcile.uiState;
19
19
  const reviewTabUiState = reconciliationViewState.reconTabsState.review.uiState;
@@ -35,13 +35,6 @@ export const getExpenseAutomationReconciliationView = createSelector((state) =>
35
35
  }
36
36
  return acc;
37
37
  }, []);
38
- const monthYearPeriodId = selectedPeriod != null ? toMonthYearPeriodId(selectedPeriod) : null;
39
- const monthEndFetchState = monthYearPeriodId != null
40
- ? (monthEndCloseChecksViewState.monthEndCloseChecksViewByTenantId[currentTenant.tenantId]?.[monthYearPeriodId] ?? {
41
- fetchState: 'Not-Started',
42
- error: undefined,
43
- })
44
- : { fetchState: 'Not-Started', error: undefined };
45
38
  if (accountReconForMonthYearPeriod == null) {
46
39
  return {
47
40
  bankAccounts: [],
@@ -51,13 +44,10 @@ export const getExpenseAutomationReconciliationView = createSelector((state) =>
51
44
  classListNestedAccountHierarchy: [],
52
45
  allAccountList: [],
53
46
  allClassList: [],
54
- fetchStatus: reduceAnyFetchState([
55
- {
56
- fetchState: reconciliationViewState.fetchState,
57
- error: reconciliationViewState.error,
58
- },
59
- monthEndFetchState,
60
- ]),
47
+ fetchStatus: {
48
+ fetchState: reconciliationViewState.fetchState,
49
+ error: reconciliationViewState.error,
50
+ },
61
51
  plaidConnectionDetails: plaidAccountViewState['expense_automation_reconcile']
62
52
  .plaidConnectionDetails,
63
53
  completionStatus: 'incomplete',
@@ -280,13 +270,10 @@ export const getExpenseAutomationReconciliationView = createSelector((state) =>
280
270
  bankAccounts: uniqueBankAccounts,
281
271
  creditCards: uniqueCreditCards,
282
272
  accountReconciliationsByAccountID: reconList,
283
- fetchStatus: reduceAnyFetchState([
284
- {
285
- fetchState: reconciliationViewState.fetchState,
286
- error: reconciliationViewState.error,
287
- },
288
- monthEndFetchState,
289
- ]),
273
+ fetchStatus: {
274
+ fetchState: reconciliationViewState.fetchState,
275
+ error: reconciliationViewState.error,
276
+ },
290
277
  plaidConnectionDetails: plaidAccountViewState['expense_automation_reconcile']
291
278
  .plaidConnectionDetails,
292
279
  reconciliationTabsState: reconciliationViewState.reconTabsState,
@@ -1,5 +1,5 @@
1
1
  import omit from 'lodash/omit';
2
- import { reduceAllFetchState, reduceAnyFetchState, } from '../../../commonStateTypes/reduceFetchState';
2
+ import { reduceAllFetchState } from '../../../commonStateTypes/reduceFetchState';
3
3
  import { toMonthYearPeriodId } from '../../../commonStateTypes/timePeriod';
4
4
  import { getCurrentTenant } from '../../../entity/tenant/tenantSelector';
5
5
  import { getTransactionWithCOT } from '../../../entity/transaction/transactionHelper';
@@ -8,7 +8,7 @@ import { getAccountList, getNestedAccountListHierarchy, getUncategorizedAccounts
8
8
  import { getClassList, getNestedClassListHierarchy, } from '../../classList/classListSelector';
9
9
  import { getAllSteps } from '../selectorTypes/expenseAutomationViewSelectorTypes';
10
10
  export function getExpenseAutomationTransactionView(state) {
11
- const { accountState, classState, classListState, accountListState, expenseAutomationTransactionsViewState, expenseAutomationViewState, transactionState, monthEndCloseChecksState, monthEndCloseChecksViewState, } = state;
11
+ const { accountState, classState, classListState, accountListState, expenseAutomationTransactionsViewState, expenseAutomationViewState, transactionState, monthEndCloseChecksState, } = state;
12
12
  const { selectedTransactionCategorizationTab } = expenseAutomationTransactionsViewState;
13
13
  const { uiState, refreshStatus, saveStatus, markAsNotMiscategorizedStatus, transactionIdsBySelectedPeriod, transactionReviewLocalDataById, selectedCheckBoxTransactionIds, transactionIdsWithUnsavedData, uploadReceiptStatusById, selectedTransactionId, selectedTransactionLineId, } = expenseAutomationTransactionsViewState.transactionCategorizationView[selectedTransactionCategorizationTab];
14
14
  const uncategorizedIncomeExpense = getUncategorizedAccounts(accountState, accountListState, 'accountList');
@@ -41,16 +41,10 @@ export function getExpenseAutomationTransactionView(state) {
41
41
  .filter((transaction) => transaction != null);
42
42
  const transactions = getSupportedTransactionsByIds(transactionState, transactionIds);
43
43
  const transactionsWithCOT = transactions.map((transaction) => getTransactionWithCOT(transaction));
44
- const monthEndFetchState = monthYearPeriodId != null
45
- ? (monthEndCloseChecksViewState.monthEndCloseChecksViewByTenantId[currentTenant.tenantId]?.[monthYearPeriodId] ?? { fetchState: 'Not-Started', error: undefined })
46
- : { fetchState: 'Not-Started', error: undefined };
47
- const fetchStatus = reduceAnyFetchState([
48
- reduceAllFetchState([
49
- accountList,
50
- classList,
51
- expenseAutomationTransactionsViewState.transactionCategorizationView[selectedTransactionCategorizationTab],
52
- ]),
53
- monthEndFetchState,
44
+ const fetchStatus = reduceAllFetchState([
45
+ accountList,
46
+ classList,
47
+ expenseAutomationTransactionsViewState.transactionCategorizationView[selectedTransactionCategorizationTab],
54
48
  ]);
55
49
  const totalCountByReview = expenseAutomationTransactionsViewState.transactionCategorizationView.review
56
50
  .uiState.totalCount;
@@ -3,7 +3,6 @@ const JE_SCHEDULE_SORT_KEYS = [
3
3
  'vendor',
4
4
  'category',
5
5
  'class',
6
- 'depCategory',
7
6
  'scheduleCategory',
8
7
  'startMonth',
9
8
  'type',
@@ -49,11 +49,16 @@ export const getProfitAndLossClassesHorizontalView = (filter, accountState, clas
49
49
  const calculatedSections = {};
50
50
  let reportCurrency = defaultCustomerCurrency;
51
51
  if (fetchState.fetchState === 'Completed' && selectedPeriod != null) {
52
+ // Get section reports using existing selector infrastructure
53
+ const sectionReports = {};
54
+ HORIZONTAL_PANDL_SECTION_IDS.forEach((sectionId) => {
55
+ sectionReports[sectionId] = getSectionClassesViewReport(accountState, classState, sectionsState, { reportId, sectionId }, filter);
56
+ });
52
57
  reportCurrency =
53
58
  profitAndLossClassesViewState.currency ?? defaultCustomerCurrency;
54
- // Fetch each section and pivot class→account to account→class in one pass
59
+ // Pivot each section from class→account to account→class
55
60
  HORIZONTAL_PANDL_SECTION_IDS.forEach((sectionId) => {
56
- const sectionReport = getSectionClassesViewReport(accountState, classState, sectionsState, { reportId, sectionId }, filter);
61
+ const sectionReport = sectionReports[sectionId];
57
62
  if (sectionReport != null) {
58
63
  sections[sectionId] = pivotSectionToHorizontal(sectionReport, classColumns, SECTION_TITLES[sectionId] ?? sectionId, reportCurrency);
59
64
  }
@@ -256,7 +261,7 @@ function sumBalancesInSlice(balances) {
256
261
  if (balances.length === 0) {
257
262
  return 0;
258
263
  }
259
- const summed = getSummationFreeRangeTotalBalance(balances);
264
+ const summed = getSummationFreeRangeTotalBalance([...balances]);
260
265
  return summed?.balance.amount ?? 0;
261
266
  }
262
267
  /**