@zeniai/client-epic-state 4.19.90 → 4.19.91-beta1ND

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 (54) hide show
  1. package/lib/commonStateTypes/reduceFetchState.d.ts +9 -0
  2. package/lib/commonStateTypes/reduceFetchState.js +26 -0
  3. package/lib/entity/chargeCardTransaction/chargeCardTransaction.d.ts +1 -1
  4. package/lib/entity/jeSchedules/jeSchedulesPayload.d.ts +1 -1
  5. package/lib/entity/jeSchedules/jeSchedulesPayload.js +10 -5
  6. package/lib/entity/jeSchedules/jeSchedulesReducer.d.ts +2 -2
  7. package/lib/entity/jeSchedules/jeSchedulesReducer.js +2 -2
  8. package/lib/entity/jeSchedules/jeSchedulesState.d.ts +1 -2
  9. package/lib/entity/jeSchedules/jeSchedulesTypes.d.ts +7 -3
  10. package/lib/entity/jeSchedules/jeSchedulesTypes.js +3 -1
  11. package/lib/entity/reimbursement/reimbursementPayload.d.ts +1 -1
  12. package/lib/entity/reimbursement/reimbursementPayload.js +1 -1
  13. package/lib/entity/transaction/transactionReducer.js +3 -2
  14. package/lib/entity/transaction/transactionSelector.d.ts +2 -2
  15. package/lib/entity/transaction/transactionState.d.ts +3 -2
  16. package/lib/esm/commonStateTypes/reduceFetchState.js +25 -0
  17. package/lib/esm/entity/jeSchedules/jeSchedulesPayload.js +10 -5
  18. package/lib/esm/entity/jeSchedules/jeSchedulesReducer.js +3 -3
  19. package/lib/esm/entity/jeSchedules/jeSchedulesTypes.js +1 -0
  20. package/lib/esm/entity/reimbursement/reimbursementPayload.js +1 -1
  21. package/lib/esm/entity/transaction/transactionReducer.js +3 -2
  22. package/lib/esm/index.js +7 -6
  23. package/lib/esm/view/expenseAutomationView/reducers/jeSchedulesViewReducer.js +4 -12
  24. package/lib/esm/view/financeStatement/financeStatementReducer.js +11 -8
  25. package/lib/esm/view/financeStatement/financeStatementSelector.js +10 -5
  26. package/lib/esm/view/profitAndLossClassesView/profitAndLossClassesByClassHorizontalSelector.js +276 -0
  27. package/lib/esm/view/profitAndLossClassesView/profitAndLossClassesByClassHorizontalSelectorTypes.js +1 -0
  28. package/lib/esm/view/profitAndLossClassesView/profitAndLossClassesViewReducer.js +6 -1
  29. package/lib/esm/view/profitAndLossClassesView/profitAndLossClassesViewSelector.js +2 -29
  30. package/lib/esm/view/profitAndLossClassesView/profitAndLossForTimeframeClassesViewEpic.js +7 -5
  31. package/lib/esm/view/scheduleView/scheduleDetailView/epics/fetchScheduleDetailsEpic.js +2 -7
  32. package/lib/esm/view/scheduleView/scheduleListView/scheduleListReducer.js +2 -7
  33. package/lib/index.d.ts +9 -7
  34. package/lib/index.js +30 -25
  35. package/lib/tsconfig.typecheck.tsbuildinfo +1 -1
  36. package/lib/view/expenseAutomationView/reducers/jeSchedulesViewReducer.d.ts +11 -11
  37. package/lib/view/expenseAutomationView/reducers/jeSchedulesViewReducer.js +3 -11
  38. package/lib/view/financeStatement/financeStatementReducer.js +11 -8
  39. package/lib/view/financeStatement/financeStatementSelector.d.ts +2 -0
  40. package/lib/view/financeStatement/financeStatementSelector.js +10 -5
  41. package/lib/view/profitAndLossClassesView/profitAndLossClassesByClassHorizontalSelector.d.ts +13 -0
  42. package/lib/view/profitAndLossClassesView/profitAndLossClassesByClassHorizontalSelector.js +280 -0
  43. package/lib/view/profitAndLossClassesView/profitAndLossClassesByClassHorizontalSelectorTypes.d.ts +57 -0
  44. package/lib/view/profitAndLossClassesView/profitAndLossClassesByClassHorizontalSelectorTypes.js +2 -0
  45. package/lib/view/profitAndLossClassesView/profitAndLossClassesViewReducer.d.ts +4 -2
  46. package/lib/view/profitAndLossClassesView/profitAndLossClassesViewReducer.js +7 -2
  47. package/lib/view/profitAndLossClassesView/profitAndLossClassesViewSelector.js +2 -29
  48. package/lib/view/profitAndLossClassesView/profitAndLossClassesViewState.d.ts +4 -0
  49. package/lib/view/profitAndLossClassesView/profitAndLossForTimeframeClassesViewEpic.js +7 -5
  50. package/lib/view/scheduleView/scheduleDetailView/epics/fetchScheduleDetailsEpic.js +2 -7
  51. package/lib/view/scheduleView/scheduleDetailView/scheduleDetailReducer.d.ts +4 -4
  52. package/lib/view/scheduleView/scheduleListView/scheduleListReducer.js +1 -6
  53. package/lib/view/scheduleView/scheduleListView/scheduleListTypes.d.ts +1 -1
  54. package/package.json +2 -2
@@ -11,6 +11,15 @@ export declare const isAllFetchCompleted: (fetchStateList: FetchStateAndError[])
11
11
  * @return single fetchStateWithError
12
12
  */
13
13
  export declare function reduceFetchState(fetchStateList: FetchStateAndError[]): FetchStateAndError;
14
+ /**
15
+ * Combine multiple independent fetches (e.g. month / quarter / year for one report).
16
+ * In-Progress if any fetch is in progress; Completed only when all complete; Error if
17
+ * any failed once nothing is still in progress.
18
+ *
19
+ * Differs from {@link reduceFetchState} (requires all In-Progress for that state) and
20
+ * from {@link reduceAllFetchState} (Error only when every fetch failed).
21
+ */
22
+ export declare function reduceFetchStateParallelTimeframes(fetchStateList: FetchStateAndError[]): FetchStateAndError;
14
23
  /**
15
24
  * Reduces list of fetch state to boolean
16
25
  * @param fetchStateList list of fetch states
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.reduceAnyCompletedFetchState = exports.reduceAllFetchState = exports.reduceAnyFetchState = exports.isAnyFetchCompleted = exports.isAnyFetchInProgress = exports.isAllFetchCompleted = void 0;
4
4
  exports.reduceFetchState = reduceFetchState;
5
+ exports.reduceFetchStateParallelTimeframes = reduceFetchStateParallelTimeframes;
5
6
  /**
6
7
  * Reduces list of fetch state to boolean
7
8
  * @param fetchStateList list of fetch states
@@ -55,6 +56,31 @@ function reduceFetchState(fetchStateList) {
55
56
  error,
56
57
  };
57
58
  }
59
+ /**
60
+ * Combine multiple independent fetches (e.g. month / quarter / year for one report).
61
+ * In-Progress if any fetch is in progress; Completed only when all complete; Error if
62
+ * any failed once nothing is still in progress.
63
+ *
64
+ * Differs from {@link reduceFetchState} (requires all In-Progress for that state) and
65
+ * from {@link reduceAllFetchState} (Error only when every fetch failed).
66
+ */
67
+ function reduceFetchStateParallelTimeframes(fetchStateList) {
68
+ const isAnyProgress = fetchStateList.some((s) => s.fetchState === 'In-Progress');
69
+ const isAllCompleted = fetchStateList.every((s) => s.fetchState === 'Completed');
70
+ const isAnyError = fetchStateList.some((s) => s.fetchState === 'Error');
71
+ const error = reduceError(fetchStateList);
72
+ let fetchState = 'Not-Started';
73
+ if (isAnyProgress) {
74
+ fetchState = 'In-Progress';
75
+ }
76
+ else if (isAllCompleted) {
77
+ fetchState = 'Completed';
78
+ }
79
+ else if (isAnyError) {
80
+ fetchState = 'Error';
81
+ }
82
+ return { fetchState, error };
83
+ }
58
84
  /**
59
85
  * Reduces list of fetch state to boolean
60
86
  * @param fetchStateList list of fetch states
@@ -36,6 +36,6 @@ export interface ChargeCardTransactionState {
36
36
  }
37
37
  export declare const toCardTransactionTypeCode: (v: string) => "expense" | "credit_card_credit" | "transfer" | "purchase";
38
38
  export type ChargeCardTransactionTypeCode = ReturnType<typeof toCardTransactionTypeCode>;
39
- export declare const toCardTransactionStatusCode: (v: string) => "paid" | "authorized" | "canceled" | "declined";
39
+ export declare const toCardTransactionStatusCode: (v: string) => "paid" | "canceled" | "authorized" | "declined";
40
40
  export type ChargeCardTransactionStatusCode = ReturnType<typeof toCardTransactionStatusCode>;
41
41
  export {};
@@ -71,7 +71,7 @@ export declare function toScheduledJournalEntryState(payload: ScheduledJournalEn
71
71
  export declare function toJEAccountPayload(payload: JEScheduledTransactionPayload | JEAccruedScheduledTransactionPayload, type: TransactionCategory): AccountPayload | undefined;
72
72
  export declare function toJEAccruedAccountPayload(payload: JEScheduledTransactionPayload | JEAccruedScheduledTransactionPayload, type: TransactionCategory): AccountPayload | undefined;
73
73
  export declare function toJEClassPayload(payload: JEScheduledTransactionPayload | JEAccruedScheduledTransactionPayload, type: TransactionCategory): ClassBasePayload | undefined;
74
- export declare function getTransactionDetailKeyPayload(payload: ScheduleTransactionPayload): JEScheduleTransactionKey;
74
+ export declare function getJEScheduleTransactionDetailKeyPayload(payload: ScheduleTransactionPayload): JEScheduleTransactionKey;
75
75
  export declare function getJEScheduleKey(payload: JEAccruedScheduledTransactionPayload): JEScheduleKey;
76
76
  export declare function toJEScheduledTransaction(payload: JEScheduledTransactionPayload): JEScheduledTransactionState;
77
77
  export declare function toJEAccruedScheduledTransaction(payload: JEAccruedScheduledTransactionPayload): JEAccruedScheduledTransactionState;
@@ -4,13 +4,12 @@ exports.toScheduledJournalEntryState = toScheduledJournalEntryState;
4
4
  exports.toJEAccountPayload = toJEAccountPayload;
5
5
  exports.toJEAccruedAccountPayload = toJEAccruedAccountPayload;
6
6
  exports.toJEClassPayload = toJEClassPayload;
7
- exports.getTransactionDetailKeyPayload = getTransactionDetailKeyPayload;
7
+ exports.getJEScheduleTransactionDetailKeyPayload = getJEScheduleTransactionDetailKeyPayload;
8
8
  exports.getJEScheduleKey = getJEScheduleKey;
9
9
  exports.toJEScheduledTransaction = toJEScheduledTransaction;
10
10
  exports.toJEAccruedScheduledTransaction = toJEAccruedScheduledTransaction;
11
11
  const amount_1 = require("../../commonStateTypes/amount");
12
12
  const timePeriod_1 = require("../../commonStateTypes/timePeriod");
13
- const transactionDetailState_1 = require("../../view/transactionDetail/transactionDetailState");
14
13
  const zeniDayJS_1 = require("../../zeniDayJS");
15
14
  const transactionIDPayload_1 = require("../transaction/payloadTypes/transactionIDPayload");
16
15
  const jeScheduleHelper_1 = require("./jeScheduleHelper");
@@ -132,9 +131,12 @@ function toJEClassPayload(payload, type) {
132
131
  : undefined;
133
132
  }
134
133
  }
135
- function getTransactionDetailKeyPayload(payload) {
134
+ function getJEScheduleTransactionDetailKeyPayload(payload) {
136
135
  const transactionId = (0, transactionIDPayload_1.toTransactionID)(payload);
137
- return (0, transactionDetailState_1.getZeniTransactionDetailKey)(transactionId);
136
+ return (0, jeSchedulesTypes_1.getJEScheduleTransactionKey)({
137
+ ...transactionId,
138
+ lineId: payload.line_id,
139
+ });
138
140
  }
139
141
  function getJEScheduleKey(payload) {
140
142
  return (0, jeScheduleHelper_1.generateJEScheduleKey)(payload);
@@ -155,7 +157,10 @@ function toJEScheduledTransaction(payload) {
155
157
  label: payload.status.label,
156
158
  },
157
159
  vendorId: payload.vendor.vendor_id,
158
- baseTransaction: getTransactionDetailKeyPayload(payload.base_transaction),
160
+ baseTransaction: (0, jeSchedulesTypes_1.getJEScheduleTransactionKey)({
161
+ ...(0, transactionIDPayload_1.toTransactionID)(payload.base_transaction),
162
+ lineId: payload.base_transaction.line_id,
163
+ }),
159
164
  startDate: payload.start_date != null ? (0, zeniDayJS_1.date)(payload.start_date) : undefined,
160
165
  endDate: payload.end_date != null ? (0, zeniDayJS_1.date)(payload.end_date) : undefined,
161
166
  period: payload.period != null ? Number(payload.period) : undefined,
@@ -18,8 +18,8 @@ export declare const updateJESchedules: import("@reduxjs/toolkit").ActionCreator
18
18
  jeSchedulesPayload: JEAccruedScheduledTransactionPayload[];
19
19
  scheduledJEntriesPayload: ScheduledJournalEntryPayload[] | undefined;
20
20
  updateType: UpdateType;
21
- }, "jeSchedules/updateAccruedJESchedulesDetails", never, never>, deleteJESchedulesDetails: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[jeScheduleTransactionKey: `${string}_bill` | `${string}_expense` | `${string}_check` | `${string}_refund` | `${string}_invoice` | `${string}_payment` | `${string}_credit_memo` | `${string}_sales_receipt` | `${string}_delayed_credit` | `${string}_delayed_charge` | `${string}_bill_payment` | `${string}_bill_payment_check` | `${string}_bill_payment_credit_card` | `${string}_vendor_credit` | `${string}_credit_card_credit` | `${string}_transfer` | `${string}_credit_card_payment` | `${string}_deposit` | `${string}_journal_entry`], {
22
- jeScheduleTransactionKey: `${string}_bill` | `${string}_expense` | `${string}_check` | `${string}_refund` | `${string}_invoice` | `${string}_payment` | `${string}_credit_memo` | `${string}_sales_receipt` | `${string}_delayed_credit` | `${string}_delayed_charge` | `${string}_bill_payment` | `${string}_bill_payment_check` | `${string}_bill_payment_credit_card` | `${string}_vendor_credit` | `${string}_credit_card_credit` | `${string}_transfer` | `${string}_credit_card_payment` | `${string}_deposit` | `${string}_journal_entry`;
21
+ }, "jeSchedules/updateAccruedJESchedulesDetails", never, never>, deleteJESchedulesDetails: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[jeScheduleTransactionKey: `${string}_bill_${string}` | `${string}_expense_${string}` | `${string}_check_${string}` | `${string}_refund_${string}` | `${string}_invoice_${string}` | `${string}_payment_${string}` | `${string}_credit_memo_${string}` | `${string}_sales_receipt_${string}` | `${string}_delayed_credit_${string}` | `${string}_delayed_charge_${string}` | `${string}_bill_payment_${string}` | `${string}_bill_payment_check_${string}` | `${string}_bill_payment_credit_card_${string}` | `${string}_vendor_credit_${string}` | `${string}_credit_card_credit_${string}` | `${string}_transfer_${string}` | `${string}_credit_card_payment_${string}` | `${string}_deposit_${string}` | `${string}_journal_entry_${string}`], {
22
+ jeScheduleTransactionKey: `${string}_bill_${string}` | `${string}_expense_${string}` | `${string}_check_${string}` | `${string}_refund_${string}` | `${string}_invoice_${string}` | `${string}_payment_${string}` | `${string}_credit_memo_${string}` | `${string}_sales_receipt_${string}` | `${string}_delayed_credit_${string}` | `${string}_delayed_charge_${string}` | `${string}_bill_payment_${string}` | `${string}_bill_payment_check_${string}` | `${string}_bill_payment_credit_card_${string}` | `${string}_vendor_credit_${string}` | `${string}_credit_card_credit_${string}` | `${string}_transfer_${string}` | `${string}_credit_card_payment_${string}` | `${string}_deposit_${string}` | `${string}_journal_entry_${string}`;
23
23
  }, "jeSchedules/deleteJESchedulesDetails", never, never>, deleteAccruedJESchedulesDetails: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[JEScheduleKey: `${string}_${string}`], {
24
24
  JEScheduleKey: `${string}_${string}`;
25
25
  }, "jeSchedules/deleteAccruedJESchedulesDetails", never, never>, clearAllAccruedJESchedules: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"jeSchedules/clearAllAccruedJESchedules">, clearAllJEScheduleTransactions: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"jeSchedules/clearAllJEScheduleTransactions">;
@@ -42,7 +42,7 @@ const jeSchedules = (0, toolkit_1.createSlice)({
42
42
  },
43
43
  updateJEScheduledTransaction: (draft, action) => {
44
44
  action.payload.jeSchedulesTransactionsPayload.forEach((schedule) => {
45
- doUpdateJEScheduledTransaction(draft.schedulesByTransactionKey, (0, jeSchedulesPayload_1.getTransactionDetailKeyPayload)(schedule.base_transaction), schedule, 'merge');
45
+ doUpdateJEScheduledTransaction(draft.schedulesByTransactionKey, (0, jeSchedulesPayload_1.getJEScheduleTransactionDetailKeyPayload)(schedule.base_transaction), schedule, 'merge');
46
46
  });
47
47
  },
48
48
  updateAccruedJEScheduledTransaction: (draft, action) => {
@@ -84,7 +84,7 @@ const jeSchedules = (0, toolkit_1.createSlice)({
84
84
  if (jeSchedulesPayload.length > 0) {
85
85
  jeSchedulesPayload.forEach((jeSchedulePayload) => {
86
86
  const transactionKey = jeSchedulePayload.base_transaction;
87
- doUpdateScheduledDetailTransaction(draft.schedulesByTransactionKey, (0, jeSchedulesPayload_1.getTransactionDetailKeyPayload)(transactionKey), jeSchedulePayload, action.payload.scheduledJEntriesPayload ?? [], updateType);
87
+ doUpdateScheduledDetailTransaction(draft.schedulesByTransactionKey, (0, jeSchedulesPayload_1.getJEScheduleTransactionDetailKeyPayload)(transactionKey), jeSchedulePayload, action.payload.scheduledJEntriesPayload ?? [], updateType);
88
88
  });
89
89
  }
90
90
  },
@@ -1,7 +1,6 @@
1
1
  import { Amount } from '../../commonStateTypes/amount';
2
2
  import { ID } from '../../commonStateTypes/common';
3
3
  import { ScheduleDaysOfMonth } from '../../commonStateTypes/timePeriod';
4
- import { TransactionDetailKey } from '../../view/transactionDetail/transactionDetailState';
5
4
  import { ZeniDate } from '../../zeniDayJS';
6
5
  import { TransactionID } from '../transaction/stateTypes/transaction';
7
6
  import { JEScheduleKey, JEScheduleTransactionKey, JournalEntryErrorCodeType, ScheduleJournalEntryStatusCodeType, ScheduleStatusCodeType, ScheduleTypes } from './jeSchedulesTypes';
@@ -42,7 +41,7 @@ export interface ScheduledJournalEntryState {
42
41
  updateTime?: ZeniDate;
43
42
  }
44
43
  export interface JEScheduledTransactionState {
45
- baseTransaction: TransactionDetailKey;
44
+ baseTransaction: JEScheduleTransactionKey;
46
45
  currencyCode: string;
47
46
  currencySymbol: string;
48
47
  jeCredit: {
@@ -1,12 +1,16 @@
1
- import { getZeniTransactionDetailKey } from '../../view/transactionDetail/transactionDetailState';
1
+ import { TransactionID } from '../transaction/stateTypes/transaction';
2
2
  import { generateJEScheduleKey } from './jeScheduleHelper';
3
- export type JEScheduleTransactionKey = ReturnType<typeof getZeniTransactionDetailKey>;
3
+ export interface ScheduleTransactionID extends TransactionID {
4
+ lineId: string;
5
+ }
6
+ export declare const getJEScheduleTransactionKey: (scheduleTransactionId: ScheduleTransactionID) => `${string}_bill_${string}` | `${string}_expense_${string}` | `${string}_check_${string}` | `${string}_refund_${string}` | `${string}_invoice_${string}` | `${string}_payment_${string}` | `${string}_credit_memo_${string}` | `${string}_sales_receipt_${string}` | `${string}_delayed_credit_${string}` | `${string}_delayed_charge_${string}` | `${string}_bill_payment_${string}` | `${string}_bill_payment_check_${string}` | `${string}_bill_payment_credit_card_${string}` | `${string}_vendor_credit_${string}` | `${string}_credit_card_credit_${string}` | `${string}_transfer_${string}` | `${string}_credit_card_payment_${string}` | `${string}_deposit_${string}` | `${string}_journal_entry_${string}`;
7
+ export type JEScheduleTransactionKey = ReturnType<typeof getJEScheduleTransactionKey>;
4
8
  export type JEScheduleKey = ReturnType<typeof generateJEScheduleKey>;
5
9
  export declare const ALL_SCHEDULES_TYPES: readonly ["prepaid_expenses", "fixed_assets", "accrued_expenses", "deferred_revenue"];
6
10
  export declare const toScheduleTypesType: (v: string) => "prepaid_expenses" | "fixed_assets" | "accrued_expenses" | "deferred_revenue";
7
11
  export type ScheduleTypes = ReturnType<typeof toScheduleTypesType>;
8
12
  export declare const toScheduleTypesTypeStrict: (v?: string) => "prepaid_expenses" | "fixed_assets" | "accrued_expenses" | "deferred_revenue" | undefined;
9
- export declare const toScheduleJournalEntryStatusCodeType: (v: string) => "pending" | "posted" | "canceled" | "unknown" | "recorded";
13
+ export declare const toScheduleJournalEntryStatusCodeType: (v: string) => "pending" | "posted" | "unknown" | "canceled" | "recorded";
10
14
  export type ScheduleJournalEntryStatusCodeType = ReturnType<typeof toScheduleJournalEntryStatusCodeType>;
11
15
  export declare const toScheduleStatusCodeType: (v: string) => "draft" | "completed" | "new" | "ongoing" | "marked_as_completed";
12
16
  export type ScheduleStatusCodeType = ReturnType<typeof toScheduleStatusCodeType>;
@@ -1,7 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.toJournalEntryErrorCodeType = exports.toScheduleStatusCodeType = exports.toScheduleJournalEntryStatusCodeType = exports.toScheduleTypesTypeStrict = exports.toScheduleTypesType = exports.ALL_SCHEDULES_TYPES = void 0;
3
+ exports.toJournalEntryErrorCodeType = exports.toScheduleStatusCodeType = exports.toScheduleJournalEntryStatusCodeType = exports.toScheduleTypesTypeStrict = exports.toScheduleTypesType = exports.ALL_SCHEDULES_TYPES = exports.getJEScheduleTransactionKey = void 0;
4
4
  const stringToUnion_1 = require("../../commonStateTypes/stringToUnion");
5
+ const getJEScheduleTransactionKey = (scheduleTransactionId) => `${scheduleTransactionId.id}_${scheduleTransactionId.type}_${scheduleTransactionId.lineId}`;
6
+ exports.getJEScheduleTransactionKey = getJEScheduleTransactionKey;
5
7
  exports.ALL_SCHEDULES_TYPES = [
6
8
  'prepaid_expenses',
7
9
  'fixed_assets',
@@ -1,9 +1,9 @@
1
1
  import { URLPayload } from '../../commonPayloadTypes/urlPayload';
2
2
  import { SegregatedReimbursementLineWithRecommendation } from '../../view/spendManagement/reimbursement/editRemiView/editRemiViewState';
3
3
  import { AccountBasePayload } from '../account/accountPayload';
4
- import { CustomerBasePayload } from '../customer/customerPayload';
5
4
  import { BillAccountPayload, BillPaymentMethodPayload, BillPaymentStatusPayload, BillStagePayload, BillStatusPayload, BulkOperationDetailPayload, DeletionInfoPayload } from '../billPay/billTransaction/billTransactionPayload';
6
5
  import { ClassBasePayload } from '../class/classPayload';
6
+ import { CustomerBasePayload } from '../customer/customerPayload';
7
7
  import { MerchantBasePayload } from '../merchant/merchantPayload';
8
8
  import { AttachmentPayload } from '../transaction/payloadTypes/attachmentPayload';
9
9
  import { LineDetail, Reimbursement, ReimbursementTypeCode } from './reimbursementState';
@@ -6,9 +6,9 @@ const amount_1 = require("../../commonStateTypes/amount");
6
6
  const stringToUnion_1 = require("../../commonStateTypes/stringToUnion");
7
7
  const zeniDayJS_1 = require("../../zeniDayJS");
8
8
  const accountPayload_1 = require("../account/accountPayload");
9
- const customerPayload_1 = require("../customer/customerPayload");
10
9
  const billTransactionPayload_1 = require("../billPay/billTransaction/billTransactionPayload");
11
10
  const classPayload_1 = require("../class/classPayload");
11
+ const customerPayload_1 = require("../customer/customerPayload");
12
12
  const merchantPayload_1 = require("../merchant/merchantPayload");
13
13
  const attachmentPayload_1 = require("../transaction/payloadTypes/attachmentPayload");
14
14
  const ALL_REIMBURSEMENT_TRANSACTION_TYPE = ['reimbursement'];
@@ -7,7 +7,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
7
7
  exports.clearAllTransactions = exports.updateTransactionIsMiscategorized = exports.removeTransactionAttachment = exports.removeTransactionCategorization = exports.removeTransaction = exports.updateMultipleReconcileTransactions = exports.updateReconcileTransactions = exports.updateScheduleTransactions = exports.updateTransaction = exports.updateTransactions = exports.initialState = void 0;
8
8
  const toolkit_1 = require("@reduxjs/toolkit");
9
9
  const assignWith_1 = __importDefault(require("lodash/assignWith"));
10
- const transactionDetailState_1 = require("../../view/transactionDetail/transactionDetailState");
10
+ const jeSchedulesTypes_1 = require("../jeSchedules/jeSchedulesTypes");
11
11
  const reconciliationTransactionPayloads_1 = require("./payloadTypes/reconciliationTransactionPayloads");
12
12
  const scheduleTransactionPayload_1 = require("./payloadTypes/scheduleTransactionPayload");
13
13
  const transactionType_1 = require("./stateTypes/transactionType");
@@ -75,9 +75,10 @@ const transaction = (0, toolkit_1.createSlice)({
75
75
  updateScheduleTransactions: {
76
76
  reducer(draft, action) {
77
77
  action.payload.transactionsPayload.forEach((value) => {
78
- const id = (0, transactionDetailState_1.getZeniTransactionDetailKey)({
78
+ const id = (0, jeSchedulesTypes_1.getJEScheduleTransactionKey)({
79
79
  id: value.transaction_id,
80
80
  type: (0, transactionType_1.toTransactionType)(value.transaction_type),
81
+ lineId: value.line_id,
81
82
  });
82
83
  doUpdateScheduleTransaction(draft.scheduleTransactionById, id, value, action.payload.currencyCode, action.payload.currencySymbol, action.meta.updateType);
83
84
  });
@@ -1,9 +1,9 @@
1
1
  import { ID } from '../../commonStateTypes/common';
2
- import { TransactionDetailKey } from '../../view/transactionDetail/transactionDetailState';
2
+ import { JEScheduleTransactionKey } from '../jeSchedules/jeSchedulesTypes';
3
3
  import { MatchedTransaction } from './stateTypes/reconciliationTransaction';
4
4
  import { ScheduleTransaction } from './stateTypes/scheduleTransaction';
5
5
  import { SupportedTransaction, TransactionState } from './transactionState';
6
- export declare function getScheduleTransactionById(transactionState: TransactionState, transactionId: TransactionDetailKey): ScheduleTransaction | undefined;
6
+ export declare function getScheduleTransactionById(transactionState: TransactionState, transactionId: JEScheduleTransactionKey): ScheduleTransaction | undefined;
7
7
  export declare function getSupportedTransactionById(transactionState: TransactionState, transactionId: ID): SupportedTransaction | undefined;
8
8
  export declare function getSupportedTransactionsByIds(transactionState: TransactionState, transactionIds: ID[]): SupportedTransaction[];
9
9
  export declare function getMatchedTransactionById(transactionState: TransactionState, transactionId: ID): MatchedTransaction | undefined;
@@ -1,5 +1,6 @@
1
1
  import { ID } from '../../commonStateTypes/common';
2
- import { TransactionDetailKey, ZeniTransactionDetailKey } from '../../view/transactionDetail/transactionDetailState';
2
+ import { TransactionDetailKey } from '../../view/transactionDetail/transactionDetailState';
3
+ import { JEScheduleTransactionKey } from '../jeSchedules/jeSchedulesTypes';
3
4
  import { CustomerTransactionPayload } from './payloadTypes/customerTransactionPayload';
4
5
  import { TransactionPayload } from './payloadTypes/transactionPayload';
5
6
  import { VendorTransactionPayload, VendorTransactionWithCustomerPayload } from './payloadTypes/vendorTransactionPayload';
@@ -14,6 +15,6 @@ export type SupportedTransactionPayload = TransactionPayload | CustomerTransacti
14
15
  export type AllSupportedTransactions = SupportedTransaction | undefined;
15
16
  export interface TransactionState {
16
17
  reconcileTransactionById: Record<ID, MatchedTransaction>;
17
- scheduleTransactionById: Record<ZeniTransactionDetailKey, ScheduleTransaction>;
18
+ scheduleTransactionById: Record<JEScheduleTransactionKey, ScheduleTransaction>;
18
19
  transactionById: Record<ID | TransactionDetailKey, SupportedTransaction | undefined>;
19
20
  }
@@ -50,6 +50,31 @@ export function reduceFetchState(fetchStateList) {
50
50
  error,
51
51
  };
52
52
  }
53
+ /**
54
+ * Combine multiple independent fetches (e.g. month / quarter / year for one report).
55
+ * In-Progress if any fetch is in progress; Completed only when all complete; Error if
56
+ * any failed once nothing is still in progress.
57
+ *
58
+ * Differs from {@link reduceFetchState} (requires all In-Progress for that state) and
59
+ * from {@link reduceAllFetchState} (Error only when every fetch failed).
60
+ */
61
+ export function reduceFetchStateParallelTimeframes(fetchStateList) {
62
+ const isAnyProgress = fetchStateList.some((s) => s.fetchState === 'In-Progress');
63
+ const isAllCompleted = fetchStateList.every((s) => s.fetchState === 'Completed');
64
+ const isAnyError = fetchStateList.some((s) => s.fetchState === 'Error');
65
+ const error = reduceError(fetchStateList);
66
+ let fetchState = 'Not-Started';
67
+ if (isAnyProgress) {
68
+ fetchState = 'In-Progress';
69
+ }
70
+ else if (isAllCompleted) {
71
+ fetchState = 'Completed';
72
+ }
73
+ else if (isAnyError) {
74
+ fetchState = 'Error';
75
+ }
76
+ return { fetchState, error };
77
+ }
53
78
  /**
54
79
  * Reduces list of fetch state to boolean
55
80
  * @param fetchStateList list of fetch states
@@ -1,10 +1,9 @@
1
1
  import { toAmount } from '../../commonStateTypes/amount';
2
2
  import { LAST_SCHEDULE_DAY_OF_MONTH, MAX_SCHEDULE_DAY_OF_MONTH, MIN_SCHEDULE_DAY_OF_MONTH, toScheduleDaysOfMonth, } from '../../commonStateTypes/timePeriod';
3
- import { getZeniTransactionDetailKey } from '../../view/transactionDetail/transactionDetailState';
4
3
  import { date } from '../../zeniDayJS';
5
4
  import { toTransactionID, } from '../transaction/payloadTypes/transactionIDPayload';
6
5
  import { generateJEScheduleKey } from './jeScheduleHelper';
7
- import { toJournalEntryErrorCodeType, toScheduleJournalEntryStatusCodeType, toScheduleStatusCodeType, toScheduleTypesTypeStrict, } from './jeSchedulesTypes';
6
+ import { getJEScheduleTransactionKey, toJournalEntryErrorCodeType, toScheduleJournalEntryStatusCodeType, toScheduleStatusCodeType, toScheduleTypesTypeStrict, } from './jeSchedulesTypes';
8
7
  export function toScheduledJournalEntryState(payload, currency_code, currency_symbol) {
9
8
  return {
10
9
  status: {
@@ -122,9 +121,12 @@ export function toJEClassPayload(payload, type) {
122
121
  : undefined;
123
122
  }
124
123
  }
125
- export function getTransactionDetailKeyPayload(payload) {
124
+ export function getJEScheduleTransactionDetailKeyPayload(payload) {
126
125
  const transactionId = toTransactionID(payload);
127
- return getZeniTransactionDetailKey(transactionId);
126
+ return getJEScheduleTransactionKey({
127
+ ...transactionId,
128
+ lineId: payload.line_id,
129
+ });
128
130
  }
129
131
  export function getJEScheduleKey(payload) {
130
132
  return generateJEScheduleKey(payload);
@@ -145,7 +147,10 @@ export function toJEScheduledTransaction(payload) {
145
147
  label: payload.status.label,
146
148
  },
147
149
  vendorId: payload.vendor.vendor_id,
148
- baseTransaction: getTransactionDetailKeyPayload(payload.base_transaction),
150
+ baseTransaction: getJEScheduleTransactionKey({
151
+ ...toTransactionID(payload.base_transaction),
152
+ lineId: payload.base_transaction.line_id,
153
+ }),
149
154
  startDate: payload.start_date != null ? date(payload.start_date) : undefined,
150
155
  endDate: payload.end_date != null ? date(payload.end_date) : undefined,
151
156
  period: payload.period != null ? Number(payload.period) : undefined,
@@ -1,6 +1,6 @@
1
1
  import { createSlice } from '@reduxjs/toolkit';
2
2
  import assignWith from 'lodash/assignWith';
3
- import { getJEScheduleKey, getTransactionDetailKeyPayload, toJEAccruedScheduledTransaction, toJEScheduledTransaction, toScheduledJournalEntryState, } from './jeSchedulesPayload';
3
+ import { getJEScheduleKey, getJEScheduleTransactionDetailKeyPayload, toJEAccruedScheduledTransaction, toJEScheduledTransaction, toScheduledJournalEntryState, } from './jeSchedulesPayload';
4
4
  export const initialState = {
5
5
  schedulesByTransactionKey: {},
6
6
  schedulesByAccruedJEScheduleKey: {},
@@ -35,7 +35,7 @@ const jeSchedules = createSlice({
35
35
  },
36
36
  updateJEScheduledTransaction: (draft, action) => {
37
37
  action.payload.jeSchedulesTransactionsPayload.forEach((schedule) => {
38
- doUpdateJEScheduledTransaction(draft.schedulesByTransactionKey, getTransactionDetailKeyPayload(schedule.base_transaction), schedule, 'merge');
38
+ doUpdateJEScheduledTransaction(draft.schedulesByTransactionKey, getJEScheduleTransactionDetailKeyPayload(schedule.base_transaction), schedule, 'merge');
39
39
  });
40
40
  },
41
41
  updateAccruedJEScheduledTransaction: (draft, action) => {
@@ -77,7 +77,7 @@ const jeSchedules = createSlice({
77
77
  if (jeSchedulesPayload.length > 0) {
78
78
  jeSchedulesPayload.forEach((jeSchedulePayload) => {
79
79
  const transactionKey = jeSchedulePayload.base_transaction;
80
- doUpdateScheduledDetailTransaction(draft.schedulesByTransactionKey, getTransactionDetailKeyPayload(transactionKey), jeSchedulePayload, action.payload.scheduledJEntriesPayload ?? [], updateType);
80
+ doUpdateScheduledDetailTransaction(draft.schedulesByTransactionKey, getJEScheduleTransactionDetailKeyPayload(transactionKey), jeSchedulePayload, action.payload.scheduledJEntriesPayload ?? [], updateType);
81
81
  });
82
82
  }
83
83
  },
@@ -1,4 +1,5 @@
1
1
  import { stringToUnion, stringToUnionStrict, } from '../../commonStateTypes/stringToUnion';
2
+ export const getJEScheduleTransactionKey = (scheduleTransactionId) => `${scheduleTransactionId.id}_${scheduleTransactionId.type}_${scheduleTransactionId.lineId}`;
2
3
  export const ALL_SCHEDULES_TYPES = [
3
4
  'prepaid_expenses',
4
5
  'fixed_assets',
@@ -3,9 +3,9 @@ import { toAmount } from '../../commonStateTypes/amount';
3
3
  import { stringToUnion } from '../../commonStateTypes/stringToUnion';
4
4
  import { date, dateNow } from '../../zeniDayJS';
5
5
  import { mapAccountBasePayloadToAccountBase, toAccountPayload, } from '../account/accountPayload';
6
- import { toCustomerBase, toCustomerBasePayload, } from '../customer/customerPayload';
7
6
  import { toBillPaymentMethod, toBillPaymentStatus, toBillStage, toBillStatus, toBulkProcessingDetail, toDeletionInfo, } from '../billPay/billTransaction/billTransactionPayload';
8
7
  import { mapClassBasePayloadToClassBase, toClassBasePayload, } from '../class/classPayload';
8
+ import { toCustomerBase, toCustomerBasePayload, } from '../customer/customerPayload';
9
9
  import { mapMerchantBasePayloadToMerchantBase, toMerchantBasePayload, } from '../merchant/merchantPayload';
10
10
  import { toAttachment, } from '../transaction/payloadTypes/attachmentPayload';
11
11
  const ALL_REIMBURSEMENT_TRANSACTION_TYPE = ['reimbursement'];
@@ -1,6 +1,6 @@
1
1
  import { createSlice } from '@reduxjs/toolkit';
2
2
  import assignWith from 'lodash/assignWith';
3
- import { getZeniTransactionDetailKey, } from '../../view/transactionDetail/transactionDetailState';
3
+ import { getJEScheduleTransactionKey, } from '../jeSchedules/jeSchedulesTypes';
4
4
  import { toMatchedTransaction, } from './payloadTypes/reconciliationTransactionPayloads';
5
5
  import { toScheduleTransaction, } from './payloadTypes/scheduleTransactionPayload';
6
6
  import { toTransactionType } from './stateTypes/transactionType';
@@ -68,9 +68,10 @@ const transaction = createSlice({
68
68
  updateScheduleTransactions: {
69
69
  reducer(draft, action) {
70
70
  action.payload.transactionsPayload.forEach((value) => {
71
- const id = getZeniTransactionDetailKey({
71
+ const id = getJEScheduleTransactionKey({
72
72
  id: value.transaction_id,
73
73
  type: toTransactionType(value.transaction_type),
74
+ lineId: value.line_id,
74
75
  });
75
76
  doUpdateScheduleTransaction(draft.scheduleTransactionById, id, value, action.payload.currencyCode, action.payload.currencySymbol, action.meta.updateType);
76
77
  });
package/lib/esm/index.js CHANGED
@@ -14,7 +14,7 @@ import { getActualPeriodOfFY, getActualPeriodOfFYQtr, } from './commonStateTypes
14
14
  import { getFYMonths } from './commonStateTypes/fiscalYearHelpers/getFYMonths';
15
15
  import { getFYQuarterAndYear, getLastMonthOfFYQuarter, getLastMonthOfFYYear, } from './commonStateTypes/fiscalYearHelpers/getFYQuarterAndYear';
16
16
  import { getStartOfAndEndOfTimeframeForFY } from './commonStateTypes/fiscalYearHelpers/getStartOfAndEndOfTimeframeFY';
17
- import { isAllFetchCompleted, isAnyFetchInProgress, reduceAllFetchState, reduceAnyCompletedFetchState, reduceAnyFetchState, reduceFetchState, } from './commonStateTypes/reduceFetchState';
17
+ import { isAllFetchCompleted, isAnyFetchInProgress, reduceAllFetchState, reduceAnyCompletedFetchState, reduceAnyFetchState, reduceFetchState, reduceFetchStateParallelTimeframes, } from './commonStateTypes/reduceFetchState';
18
18
  import { toReimbursementTypeCode } from './commonStateTypes/reimbursementTypeCode';
19
19
  import { stringToUnion, stringToUnionStrict, } from './commonStateTypes/stringToUnion';
20
20
  import { SCHEDULE_DAYS_OF_MONTH, convertToPeriod, toAbsoluteDay, toMonth, toMonthStrict, toMonthYearPeriodId, toQuarter, toQuarterStrict, toScheduleDaysOfMonth, } from './commonStateTypes/timePeriod';
@@ -50,7 +50,7 @@ import { getForecast } from './entity/forecast/forecastSelector';
50
50
  import { toEntityType, } from './entity/genericEntity/entity';
51
51
  import { clearAllEntities, updateEntities, } from './entity/genericEntity/entityReducer';
52
52
  import { getEntityByEntityIDs } from './entity/genericEntity/entitySelector';
53
- import { ALL_SCHEDULES_TYPES, toScheduleTypesType, toScheduleTypesTypeStrict, } from './entity/jeSchedules/jeSchedulesTypes';
53
+ import { ALL_SCHEDULES_TYPES, getJEScheduleTransactionKey, toScheduleTypesType, toScheduleTypesTypeStrict, } from './entity/jeSchedules/jeSchedulesTypes';
54
54
  import { ALL_MONTH_END_CLOSE_CHECKS_FREQUENCY, } from './entity/monthEndCloseChecks/monthEndCloseChecksState';
55
55
  import { updateCommentsNotifications, updateCommentsNotificationsStatuses, } from './entity/notification/notificationReducer';
56
56
  import { toNotificationModeStrict, } from './entity/notification/types/notificationTypes';
@@ -217,7 +217,8 @@ import { changeZeniPersonRoles, deletePerson, fetchAllPeopleRequiredViews, fetch
217
217
  import { getPeople, getPeopleLocalData } from './view/people/peopleSelector';
218
218
  import { fetchProfitAndLoss, fetchProfitAndLossForTimeframe, resetProfitAndLossNodeCollapseState, updateProfitAndLossUIState, } from './view/profitAndLoss/profitAndLossReducer';
219
219
  import { getPandLReportFetchState, getProfitAndLossReport, } from './view/profitAndLoss/profitAndLossSelector';
220
- import { fetchProfitAndLossClassesView, resetProfitAndLossClassesNodeCollapseState, updateAccountViewMode as updateProfitAndLossAccountViewMode, updateClassesToFilterOut as updateProfitAndLossClassesToFilterOut, updateProfitAndLossClassesViewUIState, } from './view/profitAndLossClassesView/profitAndLossClassesViewReducer';
220
+ import { fetchProfitAndLossClassesView, resetProfitAndLossClassesNodeCollapseState, updateAccountViewMode as updateProfitAndLossAccountViewMode, updateClassesToFilterOut as updateProfitAndLossClassesToFilterOut, updateClassViewLayout, updateProfitAndLossClassesViewUIState, } from './view/profitAndLossClassesView/profitAndLossClassesViewReducer';
221
+ import { getProfitAndLossClassesHorizontalView } from './view/profitAndLossClassesView/profitAndLossClassesByClassHorizontalSelector';
221
222
  import { getProfitAndLossClassesView } from './view/profitAndLossClassesView/profitAndLossClassesViewSelector';
222
223
  import { isPandLReportViewCalculatedSectionID, isPandLReportViewSectionID, } from './view/profitAndLossClassesView/profitAndLossClassesViewSelectorTypes';
223
224
  import { fetchEntityRecommendationsByTransactionId, fetchRecommendationByEntityId, fetchRecommendationByEntityName, } from './view/recommendation/recommendationReducer';
@@ -451,7 +452,7 @@ export { fetchDashboard, getDashboard, updateTreasuryVideoClosed, };
451
452
  export { updateDashboardLayout };
452
453
  export { getPandLWithForecast, } from './view/profitAndLoss/pAndLWithForecast/pAndLWithForecastSelector';
453
454
  export { fetchProfitAndLoss, resetProfitAndLossNodeCollapseState, updateProfitAndLossUIState, getProfitAndLossReport, getPandLReportFetchState, fetchProfitAndLossForTimeframe, };
454
- export { fetchProfitAndLossClassesView, updateProfitAndLossClassesToFilterOut, resetProfitAndLossClassesNodeCollapseState, updateProfitAndLossClassesViewUIState, updateProfitAndLossAccountViewMode, getProfitAndLossClassesView, isPandLReportViewCalculatedSectionID, isPandLReportViewSectionID, };
455
+ export { fetchProfitAndLossClassesView, updateProfitAndLossClassesToFilterOut, resetProfitAndLossClassesNodeCollapseState, updateProfitAndLossClassesViewUIState, updateProfitAndLossAccountViewMode, updateClassViewLayout, getProfitAndLossClassesView, getProfitAndLossClassesHorizontalView, isPandLReportViewCalculatedSectionID, isPandLReportViewSectionID, };
455
456
  export { getAccountingProviderAttachment };
456
457
  export { fetchUserListByType, getUserList };
457
458
  export { fetchAllPeopleRequiredViews, fetchPeoplePage, fetchPeople, deletePerson, resendInvite, changeZeniPersonRoles, invitePeople, inviteZeniPeople, updatePeopleUIState, peopleSaveUpdates, resetUpdateErrorMessage, peopleSaveDataInLocalStore, peopleClearDataInLocalStore, getPeople, getPeopleLocalData, initializeEditPerson, };
@@ -543,7 +544,7 @@ export { saveRealTimeApproval, updateIsEditModeRealTimeApprovals, };
543
544
  export { deleteRemi, fetchRemiDetail, cancelAndDeleteRemi, approveOrRejectRemi, clearRemiDetailView, fetchDuplicateReimbursement, clearDuplicateReimbursementDetail, removeDuplicateReimbursementByLineId, };
544
545
  export { getEditRemiDetail, };
545
546
  export { fetchEditRemiDetailPage, fetchRecommendationsAndUpdateMerchantRecommendations, fetchRemiAndInitializeLocalStore, initializeRemiToLocalStore, saveRemiUpdatesToLocalStore, fetchCurrencyConversionValue, discardRemiUpdatesInLocalStore, removeFileFromRemiUpdatesInLocalStore, saveRemiDetail, saveRemiSuccessOrFailure, parseReceiptsToRemi, clearEditRemiViewDetail, updateAddRemiAutoFields, updateUploadFetchState, updateTentativeMerchantNames, clearTentativeMerchantName, updateReimbursementType, updateHomeCurrencyConversion, clearAddRemiAutoFields, };
546
- export { reduceFetchState, reduceAnyFetchState, reduceAllFetchState, reduceAnyCompletedFetchState, isAnyFetchInProgress, isAllFetchCompleted, ALL_FILE_TYPES, toFileTypeStrict, };
547
+ export { reduceFetchState, reduceFetchStateParallelTimeframes, reduceAnyFetchState, reduceAllFetchState, reduceAnyCompletedFetchState, isAnyFetchInProgress, isAllFetchCompleted, ALL_FILE_TYPES, toFileTypeStrict, };
547
548
  export { getNextNthWorkingDay, getPreviousNthWorkingDay, isHolidayToday, filterDays, getYearsList, isHoliday, holidaysFormatted, PAYMENT_BUSINESS_DAYS, };
548
549
  export { fetchCompanyOnboardingView, fetchQBOConnectionPool, updateQBOConnectionPoolExternalConnection, fetchOnboardingCompletedCompanies, saveOnboardingCustomerCompletedStatus, toProductType, toProductTypeStrict, getOnboardingCockpitView, getNewOnboardingCustomerView, getOnboardingEmailGroup, initializeOnboardingCustomerViewUpdateData, clearOnboardingCustomerViewUpdateData, saveOnboardingCustomerViewUpdateData, updateOnboardingCustomerListUIState, updateCustomerCreationStatus, updateStatusAfterOnboardingCompleted, saveOnboardingCustomerViewUpdates, saveOnboardingCustomerNotes, saveOnboardingCustomerDataInLocalStore, updateOnboardingCustomerDataInLocalStore, resetNewOnboardedCustomerId, sendOnboardingCustomerViewInvite, retryBankAccountConnectionForOnboarding, };
549
550
  export { getTransactionsListByCategoryType, getTransactionListUIStateByCategoryType, };
@@ -578,7 +579,7 @@ export { fetchApAging, getApAgingReport, updateApAgingUIState, };
578
579
  export { fetchApAgingDetail, getApAgingDetailForVendor, updateApAgingDetailUIState, };
579
580
  export { clearExpenseAutomationJEScheduleLocalData, clearExpenseAutomationJESchedulesView, fetchExpenseAutomationJESchedulesPage, ignoreExpenseAutomationJESchedule, initializeJeAccountSettingsView, initializeJeScheduleLocalData, removeJeScheduleTransactionKey, retryExpenseAutomationJESchedule, updateJeScheduleLocalDataById, updateJeScheduleTransactionKeys, };
580
581
  export { createNewSchedulesAccrued, deleteScheduleAccruedDetail, cancelScheduleAccruedJournalEntry, fetchScheduleAccruedDetails, fetchScheduleAccruedDetailsPage, resetJEAccruedLinkInLocalData, saveScheduleAccruedDetails, updateAmountsInScheduleAccruedDetail, updatedJEAccruedLinkWithRecommendedLocalData, updatedJELinkInLocalDataAccruedExpenses, fetchRecommendedTransactionRowIndex, clearSelectedJELinkRowIndex, updateLinkBillExpenseLocalData, updateScheduleAccruedDetailsLocalData, updateSelectedJEAccruedScheduleKey, resetSelectedJEAccruedScheduleKey, resetAccruedDetailNewScheduleState, };
581
- export { ALL_SCHEDULES_TYPES, getScheduleListReport, getAccruedScheduleListReport, fetchScheduleList, fetchAccruedScheduleList, fetchDownloadSchedules, fetchSchedulesAccount, updateScheduleListLocalData, getFetchStateForScheduleAccountList, toScheduleTypesType, toScheduleTypesTypeStrict, toScheduleListTabsFileTypeStrict, toScheduleSubTabType, updateScheduleListSubTab, updateScheduleListSearchText, updateScheduleListScrollState, updateScheduleListSortState, updateSelectedJEScheduleKey, fetchScheduleDetails, getScheduleDetailsView, getAccruedScheduleDetailsView, fetchScheduleDetailsPage, saveScheduleDetails, deleteScheduleDetail, createNewSchedules, updateScheduleDetailsLocalData, updateScheduleListDownloadState, updateAccruedJEScheduleAccruedByListKey, updatedSelectedJELinkRowIndex, getQBOUrlForLink, getThirdPartyIDFromQBOURL, updatedJELinkInLocalData, updateAmountsInScheduleDetail, resetJELinkInLocalData, updatedJELinkWithRecommendedLocalData, getFetchStateForScheduleListByType, getDefaultSelectedTimeframeForScheduleType, markAsCompleteScheduleDetail, resetMarkAsCompleteStatus, fetchVendorTabView, updateVendorTabViewTab, getVendorTabView, };
582
+ export { getJEScheduleTransactionKey, ALL_SCHEDULES_TYPES, getScheduleListReport, getAccruedScheduleListReport, fetchScheduleList, fetchAccruedScheduleList, fetchDownloadSchedules, fetchSchedulesAccount, updateScheduleListLocalData, getFetchStateForScheduleAccountList, toScheduleTypesType, toScheduleTypesTypeStrict, toScheduleListTabsFileTypeStrict, toScheduleSubTabType, updateScheduleListSubTab, updateScheduleListSearchText, updateScheduleListScrollState, updateScheduleListSortState, updateSelectedJEScheduleKey, fetchScheduleDetails, getScheduleDetailsView, getAccruedScheduleDetailsView, fetchScheduleDetailsPage, saveScheduleDetails, deleteScheduleDetail, createNewSchedules, updateScheduleDetailsLocalData, updateScheduleListDownloadState, updateAccruedJEScheduleAccruedByListKey, updatedSelectedJELinkRowIndex, getQBOUrlForLink, getThirdPartyIDFromQBOURL, updatedJELinkInLocalData, updateAmountsInScheduleDetail, resetJELinkInLocalData, updatedJELinkWithRecommendedLocalData, getFetchStateForScheduleListByType, getDefaultSelectedTimeframeForScheduleType, markAsCompleteScheduleDetail, resetMarkAsCompleteStatus, fetchVendorTabView, updateVendorTabViewTab, getVendorTabView, };
582
583
  export { toVendorFirstReviewViewColumnKeyType, getGlobalMerchantAutoCompleteResults, getVendorFirstReviewView, getVendorFirstReviewAttachmentView, fetchVendorFirstReviewView, fetchVendorFirstReviewAttachments, updateVendorFirstReviewViewScrollYOffset, resetVendorFirstReviewLocalData, updateVendorFirstReviewViewPageToken, clearRecentlySavedErroredVendorData, saveVendorFirstReviewView, updateVendorFirstReviewViewLocalData, updateVendorFirstReviewSortUiState, fetchGlobalMerchantAutoCompleteView, clearGlobalMerchantAutoCompleteResults, updateReviewVendorDetailLocalData, saveVendorDetailsView, getVendorDetailSelectorView, };
583
584
  export { fetchGlobalMerchantRecommendation, createGlobalMerchant, updateCreateGlobalMerchantLocalData, clearGlobalMerchantView, getGlobalMerchantView, };
584
585
  export { approveVendorGlobalReview, rejectVendorGlobalReview, fetchVendorGlobalReviewView, updateSelectedGlobalMerchant, updateVendorGlobalReviewViewUIState, getVendorGlobalReviewView, getTenantMerchantByMerchantId, toVendorGlobalReviewColumnSortKeyType, updateVendorGlobalReviewViewLocalData, };
@@ -2,10 +2,8 @@ import { createSlice } from '@reduxjs/toolkit';
2
2
  import { geNestedAccountIDHierarchyForReport } from '../../../commonStateTypes/accountView/getNestedAccountIDHierarchyForReport';
3
3
  import { toMonthYearPeriodId, } from '../../../commonStateTypes/timePeriod';
4
4
  import { mapAccountBasePayloadToAccountBase, mapAccountMetadataPayloadToAccountMetadata, } from '../../../entity/account/accountPayload';
5
- import { getTransactionDetailKeyPayload, } from '../../../entity/jeSchedules/jeSchedulesPayload';
6
- import { toTransactionID } from '../../../entity/transaction/payloadTypes/transactionIDPayload';
5
+ import { getJEScheduleTransactionDetailKeyPayload, } from '../../../entity/jeSchedules/jeSchedulesPayload';
7
6
  import { mapAccountTypeRecommendationPayloadToAccountRecommendationByType, } from '../../accountMappingView/accountTypeRecommendation/accountTypeRecommendationPayload';
8
- import { getZeniTransactionDetailKey } from '../../transactionDetail/transactionDetailState';
9
7
  export const accountSettingsInitialState = {
10
8
  localData: {
11
9
  selectedPrepaidExpensesAccountIds: [],
@@ -99,14 +97,8 @@ const expenseAutomationJESchedulesView = createSlice({
99
97
  },
100
98
  fetchJeSchedulesSuccess(draft, action) {
101
99
  const { jeSchedules, selectedPeriod, failedJeSchedules, refreshViewInBackground, } = action.payload;
102
- const jeScheduleTransactionKeys = jeSchedules.map((schedules) => {
103
- const transactionID = toTransactionID(schedules.base_transaction);
104
- return getZeniTransactionDetailKey(transactionID);
105
- });
106
- const failedJeScheduleTransactionKeys = failedJeSchedules.map((schedules) => {
107
- const transactionID = toTransactionID(schedules.base_transaction);
108
- return getZeniTransactionDetailKey(transactionID);
109
- });
100
+ const jeScheduleTransactionKeys = jeSchedules.map((schedules) => getJEScheduleTransactionDetailKeyPayload(schedules.base_transaction));
101
+ const failedJeScheduleTransactionKeys = failedJeSchedules.map((schedules) => getJEScheduleTransactionDetailKeyPayload(schedules.base_transaction));
110
102
  if (refreshViewInBackground === true &&
111
103
  draft.refreshStatus.fetchState === 'In-Progress') {
112
104
  draft.refreshStatus = { fetchState: 'Completed', error: undefined };
@@ -272,7 +264,7 @@ const expenseAutomationJESchedulesView = createSlice({
272
264
  return {
273
265
  payload: {
274
266
  jeScheduleTransactionKeys: [
275
- ...jeSchedules.map((jeSchedule) => getTransactionDetailKeyPayload(jeSchedule.base_transaction)),
267
+ ...jeSchedules.map((jeSchedule) => getJEScheduleTransactionDetailKeyPayload(jeSchedule.base_transaction)),
276
268
  ],
277
269
  },
278
270
  };
@@ -44,19 +44,20 @@ const financeStatement = createSlice({
44
44
  updateFinanceStatementThisPeriod(draft, action) {
45
45
  const { firstMonthOfFY, coaBalances, maxNumOfPeriodsToHighlight } = action.payload;
46
46
  const { timeframe, selectedCOABalancesRange } = draft;
47
- if (coaBalances.length > 0) {
48
- const prevThisPeriod = extractThisPeriod(action.payload.firstMonthOfFY, timeframe, selectedCOABalancesRange, coaBalances);
47
+ const safeCoaBalances = coaBalances != null ? coaBalances : [];
48
+ if (safeCoaBalances.length > 0) {
49
+ const prevThisPeriod = extractThisPeriod(action.payload.firstMonthOfFY, timeframe, selectedCOABalancesRange, safeCoaBalances);
49
50
  if (prevThisPeriod != null) {
50
51
  const selectedCoaBalancesRangeWithThisPeriod = {
51
52
  ...selectedCOABalancesRange,
52
53
  thisPeriod: prevThisPeriod,
53
54
  };
54
- const newThisPeriod = getMatchingThisPeriod(action.payload.firstMonthOfFY, timeframe, action.payload.thisPeriod, coaBalances);
55
+ const newThisPeriod = getMatchingThisPeriod(action.payload.firstMonthOfFY, timeframe, action.payload.thisPeriod, safeCoaBalances);
55
56
  if (newThisPeriod != null) {
56
57
  const selectionRanges = getSelectedAndHighlightedRangesForThisPeriod({
57
58
  firstMonthOfFY,
58
59
  thisPeriod: newThisPeriod,
59
- coaBalances,
60
+ coaBalances: safeCoaBalances,
60
61
  timeframe,
61
62
  maxNumOfPeriodsToSelect: maxNumOfPeriodsToHighlight,
62
63
  currentSelection: {
@@ -75,7 +76,9 @@ const financeStatement = createSlice({
75
76
  draft.selectedReportId = action.payload;
76
77
  },
77
78
  updateFinanceStatementAdditionalBalancesSelection(draft, action) {
78
- const { firstMonthOfFY, additionalBalances, coaBalances, maxNumOfPeriodsToHighlight, } = action.payload;
79
+ const { firstMonthOfFY, additionalBalances: additionalBalancesPayload, coaBalances, maxNumOfPeriodsToHighlight, } = action.payload;
80
+ const safeCoaBalances = coaBalances != null ? coaBalances : [];
81
+ const additionalBalances = additionalBalancesPayload ?? [];
79
82
  let tempAdditionalBalances = [...additionalBalances];
80
83
  if (additionalBalances.includes('this_period_vs_last_period') ||
81
84
  additionalBalances.includes('this_period_vs_last_period_percent')) {
@@ -91,8 +94,8 @@ const financeStatement = createSlice({
91
94
  draft.isAdditionalBalancesShown =
92
95
  additionalBalances.length != 0 ? true : false;
93
96
  const { timeframe, selectedCOABalancesRange } = draft;
94
- if (coaBalances.length > 0) {
95
- const thisPeriod = extractThisPeriod(action.payload.firstMonthOfFY, timeframe, selectedCOABalancesRange, coaBalances);
97
+ if (safeCoaBalances.length > 0) {
98
+ const thisPeriod = extractThisPeriod(action.payload.firstMonthOfFY, timeframe, selectedCOABalancesRange, safeCoaBalances);
96
99
  if (thisPeriod != null) {
97
100
  const selectedCoaBalancesRangeWithThisPeriod = {
98
101
  ...selectedCOABalancesRange,
@@ -101,7 +104,7 @@ const financeStatement = createSlice({
101
104
  const selectionRanges = getSelectedAndHighlightedRangesForThisPeriod({
102
105
  firstMonthOfFY,
103
106
  thisPeriod: thisPeriod,
104
- coaBalances,
107
+ coaBalances: safeCoaBalances,
105
108
  timeframe,
106
109
  maxNumOfPeriodsToHighlight: maxNumOfPeriodsToHighlight,
107
110
  currentSelection: {