@zeniai/client-epic-state 4.19.96-betaSS2 → 4.19.97-betaRR0

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 (146) hide show
  1. package/lib/commonStateTypes/animations.d.ts +1 -1
  2. package/lib/entity/aiCfo/aiCfoSelector.d.ts +2 -1
  3. package/lib/entity/billPay/billTransaction/billTransactionState.d.ts +2 -2
  4. package/lib/entity/jeSchedules/jeSchedulesPayload.d.ts +0 -38
  5. package/lib/entity/jeSchedules/jeSchedulesPayload.js +0 -78
  6. package/lib/entity/jeSchedules/jeSchedulesSelector.d.ts +1 -4
  7. package/lib/entity/jeSchedules/jeSchedulesSelector.js +1 -5
  8. package/lib/entity/jeSchedules/jeSchedulesState.d.ts +0 -37
  9. package/lib/entity/tenant/tenantPayload.d.ts +0 -1
  10. package/lib/entity/tenant/tenantReducer.js +0 -1
  11. package/lib/entity/tenant/tenantSelector.d.ts +0 -1
  12. package/lib/entity/tenant/tenantSelector.js +1 -9
  13. package/lib/entity/tenant/tenantState.d.ts +0 -1
  14. package/lib/entity/transaction/payloadTypes/scheduleTransactionPayload.d.ts +1 -4
  15. package/lib/entity/transaction/payloadTypes/scheduleTransactionPayload.js +0 -1
  16. package/lib/entity/transaction/payloadTypes/transactionPayload.d.ts +0 -3
  17. package/lib/entity/transaction/payloadTypes/transactionPayload.js +0 -11
  18. package/lib/entity/transaction/stateTypes/scheduleTransaction.d.ts +0 -1
  19. package/lib/entity/transaction/stateTypes/transaction.d.ts +0 -3
  20. package/lib/entity/transaction/stateTypes/transactionLine.d.ts +1 -1
  21. package/lib/epic.d.ts +6 -2
  22. package/lib/epic.js +6 -2
  23. package/lib/esm/entity/jeSchedules/jeSchedulesPayload.js +0 -78
  24. package/lib/esm/entity/jeSchedules/jeSchedulesSelector.js +1 -5
  25. package/lib/esm/entity/tenant/tenantReducer.js +0 -1
  26. package/lib/esm/entity/tenant/tenantSelector.js +0 -7
  27. package/lib/esm/entity/transaction/payloadTypes/scheduleTransactionPayload.js +0 -1
  28. package/lib/esm/entity/transaction/payloadTypes/transactionPayload.js +0 -11
  29. package/lib/esm/epic.js +6 -2
  30. package/lib/esm/index.js +12 -10
  31. package/lib/esm/reducer.js +3 -0
  32. package/lib/esm/view/aiCfoView/aiCfoViewReducer.js +1 -82
  33. package/lib/esm/view/aiCfoView/aiCfoViewSelector.js +2 -8
  34. package/lib/esm/view/classList/fetchClassListEpic.js +2 -9
  35. package/lib/esm/view/commonVendorView/vendorView/vendorViewSelector.js +5 -15
  36. package/lib/esm/view/commonVendorView/vendorsTabVendorView/vendorsTabVendorViewSelector.js +2 -6
  37. package/lib/esm/view/expenseAutomationView/expenseAutomationViewSelector.js +1 -0
  38. package/lib/esm/view/expenseAutomationView/helpers/saveTransactionHelper.js +2 -2
  39. package/lib/esm/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.js +2 -2
  40. package/lib/esm/view/expenseAutomationView/reducers/jeSchedulesViewReducer.js +1 -17
  41. package/lib/esm/view/expenseAutomationView/selectors/fluxAnalysisViewSelector.js +2 -10
  42. package/lib/esm/view/expenseAutomationView/selectors/jeSchedulesViewSelector.js +6 -61
  43. package/lib/esm/view/expenseAutomationView/selectors/missingReceiptsSelector.js +4 -12
  44. package/lib/esm/view/expenseAutomationView/selectors/reconciliationViewSelector.js +9 -22
  45. package/lib/esm/view/expenseAutomationView/selectors/transactionCategorizationSelector.js +6 -12
  46. package/lib/esm/view/expenseAutomationView/types/jeSchedulesViewState.js +1 -17
  47. package/lib/esm/view/spendManagement/billPay/billList/billListSelector.js +0 -10
  48. package/lib/esm/view/spendManagement/billPay/billList/billListState.js +0 -1
  49. package/lib/esm/view/spendManagement/billPay/billPayReview/billPayReviewSelector.js +3 -7
  50. package/lib/esm/view/spendManagement/billPay/billPaySetupApproverView/billPaySetupApproverViewSelector.js +5 -5
  51. package/lib/esm/view/spendManagement/billPay/billPaySetupApproverView/epic/fetchBillPayApproversDetailsEpic.js +2 -7
  52. package/lib/esm/view/spendManagement/billPay/editBillView/editBillViewSelector.js +6 -13
  53. package/lib/esm/view/spendManagement/chargeCards/cardsOnboarding/cardsOnboardingDataRequests.js +58 -0
  54. package/lib/esm/view/spendManagement/chargeCards/cardsOnboarding/cardsOnboardingPayload.js +1 -0
  55. package/lib/esm/view/spendManagement/chargeCards/cardsOnboarding/cardsOnboardingReducer.js +103 -0
  56. package/lib/esm/view/spendManagement/chargeCards/cardsOnboarding/cardsOnboardingSelector.js +63 -0
  57. package/lib/esm/view/spendManagement/chargeCards/cardsOnboarding/cardsOnboardingState.js +5 -0
  58. package/lib/esm/view/spendManagement/chargeCards/cardsOnboarding/createAllAiRecommendedCardsEpic.js +62 -0
  59. package/lib/esm/view/spendManagement/chargeCards/cardsOnboarding/fetchAiCardRecommendationEpic.js +4 -0
  60. package/lib/esm/view/spendManagement/chargeCards/cardsOnboarding/fetchChainOfThoughtsForAiCardRecommendationEpic.js +4 -0
  61. package/lib/esm/view/spendManagement/chargeCards/cardsOnboarding/startAiCardAgentDrawerDataLoadEpic.js +10 -0
  62. package/lib/esm/view/spendManagement/chargeCards/chargeCardList/chargeCardList.js +0 -1
  63. package/lib/esm/view/spendManagement/chargeCards/chargeCardList/chargeCardListReducer.js +14 -1
  64. package/lib/esm/view/spendManagement/chargeCards/chargeCardList/chargeCardListSelector.js +0 -2
  65. package/lib/esm/view/spendManagement/chargeCards/chargeCardList/fetchCardsOnboardingPageEpic.js +36 -0
  66. package/lib/esm/view/spendManagement/reimbursement/editRemiView/editRemiViewSelector.js +4 -7
  67. package/lib/esm/view/spendManagement/reimbursement/remiListView/remiListSelector.js +0 -12
  68. package/lib/esm/view/spendManagement/reimbursement/remiListView/remiListState.js +0 -1
  69. package/lib/esm/view/taskManager/taskDetailView/taskDetailSelector.js +2 -2
  70. package/lib/esm/view/transactionDetail/epics/saveTransactionHelper.js +2 -2
  71. package/lib/esm/view/transactionDetail/transactionDetailLocalDataHelper.js +14 -16
  72. package/lib/index.d.ts +16 -15
  73. package/lib/index.js +45 -42
  74. package/lib/reducer.d.ts +3 -0
  75. package/lib/reducer.js +3 -0
  76. package/lib/view/aiCfoView/aiCfoViewPayload.d.ts +0 -7
  77. package/lib/view/aiCfoView/aiCfoViewReducer.d.ts +1 -15
  78. package/lib/view/aiCfoView/aiCfoViewReducer.js +2 -83
  79. package/lib/view/aiCfoView/aiCfoViewSelector.d.ts +1 -4
  80. package/lib/view/aiCfoView/aiCfoViewSelector.js +2 -9
  81. package/lib/view/aiCfoView/aiCfoViewState.d.ts +1 -18
  82. package/lib/view/auditReportView/auditReportViewState.d.ts +1 -1
  83. package/lib/view/classList/fetchClassListEpic.d.ts +1 -1
  84. package/lib/view/classList/fetchClassListEpic.js +1 -8
  85. package/lib/view/commonVendorView/vendorView/vendorViewSelector.d.ts +0 -1
  86. package/lib/view/commonVendorView/vendorView/vendorViewSelector.js +5 -15
  87. package/lib/view/commonVendorView/vendorsTabVendorView/vendorsTabVendorViewSelector.d.ts +0 -1
  88. package/lib/view/commonVendorView/vendorsTabVendorView/vendorsTabVendorViewSelector.js +2 -6
  89. package/lib/view/expenseAutomationView/expenseAutomationViewSelector.js +1 -0
  90. package/lib/view/expenseAutomationView/helpers/saveTransactionHelper.js +2 -2
  91. package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.js +2 -2
  92. package/lib/view/expenseAutomationView/reducers/jeSchedulesViewReducer.d.ts +2 -2
  93. package/lib/view/expenseAutomationView/reducers/jeSchedulesViewReducer.js +2 -18
  94. package/lib/view/expenseAutomationView/selectorTypes/jeSchedulesSelectorTypes.d.ts +0 -2
  95. package/lib/view/expenseAutomationView/selectors/fluxAnalysisViewSelector.js +2 -10
  96. package/lib/view/expenseAutomationView/selectors/jeSchedulesViewSelector.js +6 -61
  97. package/lib/view/expenseAutomationView/selectors/missingReceiptsSelector.js +4 -12
  98. package/lib/view/expenseAutomationView/selectors/reconciliationViewSelector.js +9 -22
  99. package/lib/view/expenseAutomationView/selectors/transactionCategorizationSelector.js +5 -11
  100. package/lib/view/expenseAutomationView/types/jeSchedulesViewState.d.ts +0 -5
  101. package/lib/view/expenseAutomationView/types/jeSchedulesViewState.js +0 -19
  102. package/lib/view/scheduleView/scheduleListView/scheduleListTypes.d.ts +1 -1
  103. package/lib/view/spendManagement/billPay/billList/billListSelector.js +0 -10
  104. package/lib/view/spendManagement/billPay/billList/billListState.d.ts +1 -1
  105. package/lib/view/spendManagement/billPay/billList/billListState.js +0 -1
  106. package/lib/view/spendManagement/billPay/billPayReview/billPayReviewSelector.js +3 -7
  107. package/lib/view/spendManagement/billPay/billPaySetupApproverView/billPaySetupApproverViewSelector.js +5 -5
  108. package/lib/view/spendManagement/billPay/billPaySetupApproverView/epic/fetchBillPayApproversDetailsEpic.js +2 -7
  109. package/lib/view/spendManagement/billPay/editBillView/editBillViewSelector.js +6 -13
  110. package/lib/view/spendManagement/chargeCards/cardsOnboarding/cardsOnboardingDataRequests.d.ts +7 -0
  111. package/lib/view/spendManagement/chargeCards/cardsOnboarding/cardsOnboardingDataRequests.js +62 -0
  112. package/lib/view/spendManagement/chargeCards/cardsOnboarding/cardsOnboardingPayload.d.ts +34 -0
  113. package/lib/view/spendManagement/chargeCards/cardsOnboarding/cardsOnboardingPayload.js +2 -0
  114. package/lib/view/spendManagement/chargeCards/cardsOnboarding/cardsOnboardingReducer.d.ts +7 -0
  115. package/lib/view/spendManagement/chargeCards/cardsOnboarding/cardsOnboardingReducer.js +107 -0
  116. package/lib/view/spendManagement/chargeCards/cardsOnboarding/cardsOnboardingSelector.d.ts +16 -0
  117. package/lib/view/spendManagement/chargeCards/cardsOnboarding/cardsOnboardingSelector.js +67 -0
  118. package/lib/view/spendManagement/chargeCards/cardsOnboarding/cardsOnboardingState.d.ts +63 -0
  119. package/lib/view/spendManagement/chargeCards/cardsOnboarding/cardsOnboardingState.js +8 -0
  120. package/lib/view/spendManagement/chargeCards/cardsOnboarding/createAllAiRecommendedCardsEpic.d.ts +20 -0
  121. package/lib/view/spendManagement/chargeCards/cardsOnboarding/createAllAiRecommendedCardsEpic.js +66 -0
  122. package/lib/view/spendManagement/chargeCards/cardsOnboarding/fetchAiCardRecommendationEpic.d.ts +8 -0
  123. package/lib/view/spendManagement/chargeCards/cardsOnboarding/fetchAiCardRecommendationEpic.js +8 -0
  124. package/lib/view/spendManagement/chargeCards/cardsOnboarding/fetchChainOfThoughtsForAiCardRecommendationEpic.d.ts +13 -0
  125. package/lib/view/spendManagement/chargeCards/cardsOnboarding/fetchChainOfThoughtsForAiCardRecommendationEpic.js +8 -0
  126. package/lib/view/spendManagement/chargeCards/cardsOnboarding/startAiCardAgentDrawerDataLoadEpic.d.ts +13 -0
  127. package/lib/view/spendManagement/chargeCards/cardsOnboarding/startAiCardAgentDrawerDataLoadEpic.js +14 -0
  128. package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardList.d.ts +1 -1
  129. package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardList.js +0 -1
  130. package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardListReducer.d.ts +4 -1
  131. package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardListReducer.js +15 -2
  132. package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardListSelector.js +0 -2
  133. package/lib/view/spendManagement/chargeCards/chargeCardList/fetchCardsOnboardingPageEpic.d.ts +12 -0
  134. package/lib/view/spendManagement/chargeCards/chargeCardList/fetchCardsOnboardingPageEpic.js +40 -0
  135. package/lib/view/spendManagement/reimbursement/editRemiView/editRemiViewSelector.js +3 -6
  136. package/lib/view/spendManagement/reimbursement/remiListView/remiListSelector.d.ts +0 -1
  137. package/lib/view/spendManagement/reimbursement/remiListView/remiListSelector.js +0 -12
  138. package/lib/view/spendManagement/reimbursement/remiListView/remiListState.d.ts +1 -1
  139. package/lib/view/spendManagement/reimbursement/remiListView/remiListState.js +0 -1
  140. package/lib/view/taskManager/taskDetailView/taskDetailSelector.js +2 -2
  141. package/lib/view/transactionDetail/epics/saveTransactionHelper.js +2 -2
  142. package/lib/view/transactionDetail/transactionDetailLocalDataHelper.js +14 -16
  143. package/package.json +1 -1
  144. package/lib/esm/view/aiCfoView/epics/fetchSuggestedQuestionsEpic.js +0 -29
  145. package/lib/view/aiCfoView/epics/fetchSuggestedQuestionsEpic.d.ts +0 -8
  146. package/lib/view/aiCfoView/epics/fetchSuggestedQuestionsEpic.js +0 -33
@@ -5,8 +5,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.getExpenseAutomationJESchedulesView = getExpenseAutomationJESchedulesView;
7
7
  const omit_1 = __importDefault(require("lodash/omit"));
8
- const orderBy_1 = __importDefault(require("lodash/orderBy"));
9
- const reduceFetchState_1 = require("../../../commonStateTypes/reduceFetchState");
10
8
  const timePeriod_1 = require("../../../commonStateTypes/timePeriod");
11
9
  const accountSelector_1 = require("../../../entity/account/accountSelector");
12
10
  const jeSchedulesSelector_1 = require("../../../entity/jeSchedules/jeSchedulesSelector");
@@ -18,46 +16,10 @@ const scheduleDetailSelector_1 = require("../../scheduleView/scheduleDetailView/
18
16
  const scheduleListHelper_1 = require("../../scheduleView/scheduleListView/scheduleListHelper");
19
17
  const expenseAutomationViewSelectorTypes_1 = require("../selectorTypes/expenseAutomationViewSelectorTypes");
20
18
  const jeAccountSettingsViewSelector_1 = require("./jeAccountSettingsViewSelector");
21
- function getJEScheduleSortAccessor(sortKey) {
22
- switch (sortKey) {
23
- case 'vendor':
24
- return (s) => s.vendor.name?.toLowerCase();
25
- case 'category':
26
- return (s) => s.jeDebit.account?.accountName?.toLowerCase();
27
- case 'class':
28
- return (s) => s.jeDebit.accountingClass?.className?.toLowerCase();
29
- case 'scheduleCategory':
30
- return (s) => s.jeScheduleType;
31
- case 'startMonth':
32
- return (s) => s.startDate?.valueOf();
33
- case 'type':
34
- return (s) => s.baseTransaction.typeOfTransaction;
35
- case 'amortizationPeriod':
36
- return (s) => s.period;
37
- case 'jePostingDate':
38
- return (s) => s.dayOfPostingDate;
39
- case 'remainingMonths':
40
- return (s) => s.period;
41
- case 'runningBalance':
42
- return (s) => s.balanceAsOfToday?.amount;
43
- case 'totalAmount':
44
- return (s) => s.baseTransaction.amount.amount;
45
- case 'transactionDate':
46
- return (s) => s.baseTransaction.date.valueOf();
47
- case 'memo':
48
- return (s) => s.baseTransaction.memo?.toLowerCase();
49
- default:
50
- return (s) => s.startDate?.valueOf();
51
- }
52
- }
53
- function sortJEScheduledTransactions(transactions, sortKey, sortOrder) {
54
- const accessor = getJEScheduleSortAccessor(sortKey);
55
- return (0, orderBy_1.default)(transactions, [accessor], [sortOrder === 'ascending' ? 'asc' : 'desc']);
56
- }
57
19
  function getExpenseAutomationJESchedulesView(state) {
58
20
  const jeScheduledTransaction = [];
59
21
  const failedJeScheduledTransaction = [];
60
- const { accountState, accountListState, classState, classListState, expenseAutomationJESchedulesViewState, expenseAutomationViewState, monthEndCloseChecksState, monthEndCloseChecksViewState, } = state;
22
+ const { accountState, accountListState, classState, classListState, expenseAutomationJESchedulesViewState, expenseAutomationViewState, monthEndCloseChecksState, } = state;
61
23
  const { jeScheduleTransactionKeysByPeriod, failedJeScheduleTransactionKeysByPeriod, jeScheduleLocalDataById, postStatusById, ignoreStatusById, uiState, error, fetchState, refreshStatus, } = expenseAutomationJESchedulesViewState;
62
24
  const accountSettingsView = (0, jeAccountSettingsViewSelector_1.getJEAccountSettingsView)(state);
63
25
  const currentTenant = (0, tenantSelector_1.getCurrentTenant)(state);
@@ -103,33 +65,18 @@ function getExpenseAutomationJESchedulesView(state) {
103
65
  const jeScheduleDetails = (0, jeSchedulesSelector_1.getJEScheduledTransactionByJEScheduleTransactionKey)(jeScheduleKey, state);
104
66
  failedJeScheduledTransaction.push(jeScheduleDetails);
105
67
  });
106
- const { sortKey, sortOrder } = uiState;
107
- const draftSchedules = sortJEScheduledTransactions(jeScheduledTransaction.filter((schedule) => schedule.status.code === 'draft'), sortKey, sortOrder);
108
- const ongoingSchedules = sortJEScheduledTransactions(jeScheduledTransaction.filter((schedule) => schedule.status.code === 'ongoing'), sortKey, sortOrder);
109
- const completedSchedules = sortJEScheduledTransactions(jeScheduledTransaction.filter((schedule) => schedule.status.code === 'completed' ||
110
- schedule.status.code === 'marked_as_completed'), sortKey, sortOrder);
111
- const unsortedResolveSchedules = [];
68
+ const draftSchedules = jeScheduledTransaction.filter((schedule) => schedule.status.code === 'draft');
69
+ const resolveSchedules = [];
112
70
  failedJeScheduledTransaction.forEach((schedule) => {
113
71
  schedule.scheduledJournalEntry.forEach((journalEntry) => {
114
- unsortedResolveSchedules.push({
115
- ...schedule,
116
- scheduledJournalEntry: journalEntry,
117
- });
72
+ resolveSchedules.push({ ...schedule, scheduledJournalEntry: journalEntry });
118
73
  });
119
74
  });
120
- const resolveSchedules = sortJEScheduledTransactions(unsortedResolveSchedules, sortKey, sortOrder);
121
75
  const allSteps = monthYearPeriodId != null
122
76
  ? (0, expenseAutomationViewSelectorTypes_1.getAllSteps)(monthEndCloseChecksState, monthYearPeriodId, currentTenant.tenantId)
123
77
  : [];
124
78
  const jeCompletionStatus = allSteps.find((step) => step.step === 'je_schedules')?.completionStatus;
125
79
  const completionStatus = jeCompletionStatus != null ? jeCompletionStatus : 'incomplete';
126
- const monthEndFetchState = monthYearPeriodId != null
127
- ? (monthEndCloseChecksViewState.monthEndCloseChecksViewByTenantId[currentTenant.tenantId]?.[monthYearPeriodId] ?? { fetchState: 'Not-Started', error: undefined })
128
- : { fetchState: 'Not-Started', error: undefined };
129
- const reducedFetchStatus = (0, reduceFetchState_1.reduceAnyFetchState)([
130
- { fetchState, error },
131
- monthEndFetchState,
132
- ]);
133
80
  return {
134
81
  uncategorizedAccounts,
135
82
  allDepreciationAccountList: filteredDepAccounts,
@@ -138,17 +85,15 @@ function getExpenseAutomationJESchedulesView(state) {
138
85
  allAccountList: filteredAccounts,
139
86
  accountListNestedAccountHierarchy,
140
87
  allClassList: allClasses,
141
- completedSchedules,
142
88
  draftSchedules,
143
- ongoingSchedules,
144
89
  resolveSchedules: resolveSchedules,
145
90
  accountSettingsView,
146
91
  postStatusById: postStatusById,
147
92
  ignoreStatusById: ignoreStatusById,
148
- fetchState: reducedFetchStatus.fetchState,
93
+ fetchState: fetchState,
149
94
  jeScheduleLocalDataById: jeScheduleLocalDataById,
150
95
  uiState: uiState,
151
- error: reducedFetchStatus.error,
96
+ error: error,
152
97
  refreshStatus,
153
98
  completionStatus,
154
99
  };
@@ -5,7 +5,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.getExpenseAutomationMissingReceiptsView = getExpenseAutomationMissingReceiptsView;
7
7
  const orderBy_1 = __importDefault(require("lodash/orderBy"));
8
- const reduceFetchState_1 = require("../../../commonStateTypes/reduceFetchState");
9
8
  const timePeriod_1 = require("../../../commonStateTypes/timePeriod");
10
9
  const tenantSelector_1 = require("../../../entity/tenant/tenantSelector");
11
10
  const transactionSelector_1 = require("../../../entity/transaction/transactionSelector");
@@ -14,7 +13,7 @@ const missingReceiptsViewReducer_1 = require("../reducers/missingReceiptsViewRed
14
13
  const expenseAutomationViewSelectorTypes_1 = require("../selectorTypes/expenseAutomationViewSelectorTypes");
15
14
  const missingReceiptsViewState_1 = require("../types/missingReceiptsViewState");
16
15
  function getExpenseAutomationMissingReceiptsView(state) {
17
- const { expenseAutomationMissingReceiptsViewState, expenseAutomationViewState, transactionState, monthEndCloseChecksState, monthEndCloseChecksViewState, } = state;
16
+ const { expenseAutomationMissingReceiptsViewState, expenseAutomationViewState, transactionState, monthEndCloseChecksState, } = state;
18
17
  const currentTenant = (0, tenantSelector_1.getCurrentTenant)(state);
19
18
  const { selectedPeriodByTenantId } = expenseAutomationViewState;
20
19
  const selectedPeriod = selectedPeriodByTenantId[currentTenant.tenantId];
@@ -43,7 +42,7 @@ function getExpenseAutomationMissingReceiptsView(state) {
43
42
  transaction.lines.length > 0 &&
44
43
  transaction.lines[0]
45
44
  ?.class != null
46
- ? transaction.lines[0].class?.className.toLowerCase()
45
+ ? transaction.lines[0].class.className.toLowerCase()
47
46
  : null;
48
47
  case 'vendor':
49
48
  default:
@@ -182,16 +181,9 @@ function getExpenseAutomationMissingReceiptsView(state) {
182
181
  vendorLogo: result.vendorLogo ?? transaction?.logo?.href,
183
182
  };
184
183
  });
185
- const monthEndFetchState = monthYearPeriodId != null
186
- ? (monthEndCloseChecksViewState.monthEndCloseChecksViewByTenantId[currentTenant.tenantId]?.[monthYearPeriodId] ?? { fetchState: 'Not-Started', error: undefined })
187
- : { fetchState: 'Not-Started', error: undefined };
188
- const reducedFetchStatus = (0, reduceFetchState_1.reduceAnyFetchState)([
189
- { fetchState, error },
190
- monthEndFetchState,
191
- ]);
192
184
  return {
193
- fetchState: reducedFetchStatus.fetchState,
194
- error: reducedFetchStatus.error,
185
+ fetchState,
186
+ error,
195
187
  uploadReceiptStatusById,
196
188
  uiState,
197
189
  refreshStatus,
@@ -19,7 +19,7 @@ const accountListSelector_1 = require("../../accountList/accountListSelector");
19
19
  const classListSelector_1 = require("../../classList/classListSelector");
20
20
  const reconciliationViewReducer_1 = require("../reducers/reconciliationViewReducer");
21
21
  const expenseAutomationViewSelectorTypes_1 = require("../selectorTypes/expenseAutomationViewSelectorTypes");
22
- exports.getExpenseAutomationReconciliationView = (0, toolkit_1.createSelector)((state) => state, (state) => (0, tenantSelector_1.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) => {
22
+ exports.getExpenseAutomationReconciliationView = (0, toolkit_1.createSelector)((state) => state, (state) => (0, tenantSelector_1.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) => {
23
23
  const { selectedPeriodByTenantId } = expenseAutomationViewState;
24
24
  const reconcileTabUiState = reconciliationViewState.reconTabsState.reconcile.uiState;
25
25
  const reviewTabUiState = reconciliationViewState.reconTabsState.review.uiState;
@@ -41,13 +41,6 @@ exports.getExpenseAutomationReconciliationView = (0, toolkit_1.createSelector)((
41
41
  }
42
42
  return acc;
43
43
  }, []);
44
- const monthYearPeriodId = selectedPeriod != null ? (0, timePeriod_1.toMonthYearPeriodId)(selectedPeriod) : null;
45
- const monthEndFetchState = monthYearPeriodId != null
46
- ? (monthEndCloseChecksViewState.monthEndCloseChecksViewByTenantId[currentTenant.tenantId]?.[monthYearPeriodId] ?? {
47
- fetchState: 'Not-Started',
48
- error: undefined,
49
- })
50
- : { fetchState: 'Not-Started', error: undefined };
51
44
  if (accountReconForMonthYearPeriod == null) {
52
45
  return {
53
46
  bankAccounts: [],
@@ -57,13 +50,10 @@ exports.getExpenseAutomationReconciliationView = (0, toolkit_1.createSelector)((
57
50
  classListNestedAccountHierarchy: [],
58
51
  allAccountList: [],
59
52
  allClassList: [],
60
- fetchStatus: (0, reduceFetchState_1.reduceAnyFetchState)([
61
- {
62
- fetchState: reconciliationViewState.fetchState,
63
- error: reconciliationViewState.error,
64
- },
65
- monthEndFetchState,
66
- ]),
53
+ fetchStatus: {
54
+ fetchState: reconciliationViewState.fetchState,
55
+ error: reconciliationViewState.error,
56
+ },
67
57
  plaidConnectionDetails: plaidAccountViewState['expense_automation_reconcile']
68
58
  .plaidConnectionDetails,
69
59
  completionStatus: 'incomplete',
@@ -286,13 +276,10 @@ exports.getExpenseAutomationReconciliationView = (0, toolkit_1.createSelector)((
286
276
  bankAccounts: uniqueBankAccounts,
287
277
  creditCards: uniqueCreditCards,
288
278
  accountReconciliationsByAccountID: reconList,
289
- fetchStatus: (0, reduceFetchState_1.reduceAnyFetchState)([
290
- {
291
- fetchState: reconciliationViewState.fetchState,
292
- error: reconciliationViewState.error,
293
- },
294
- monthEndFetchState,
295
- ]),
279
+ fetchStatus: {
280
+ fetchState: reconciliationViewState.fetchState,
281
+ error: reconciliationViewState.error,
282
+ },
296
283
  plaidConnectionDetails: plaidAccountViewState['expense_automation_reconcile']
297
284
  .plaidConnectionDetails,
298
285
  reconciliationTabsState: reconciliationViewState.reconTabsState,
@@ -14,7 +14,7 @@ const accountListSelector_1 = require("../../accountList/accountListSelector");
14
14
  const classListSelector_1 = require("../../classList/classListSelector");
15
15
  const expenseAutomationViewSelectorTypes_1 = require("../selectorTypes/expenseAutomationViewSelectorTypes");
16
16
  function getExpenseAutomationTransactionView(state) {
17
- const { accountState, classState, classListState, accountListState, expenseAutomationTransactionsViewState, expenseAutomationViewState, transactionState, monthEndCloseChecksState, monthEndCloseChecksViewState, } = state;
17
+ const { accountState, classState, classListState, accountListState, expenseAutomationTransactionsViewState, expenseAutomationViewState, transactionState, monthEndCloseChecksState, } = state;
18
18
  const { selectedTransactionCategorizationTab } = expenseAutomationTransactionsViewState;
19
19
  const { uiState, refreshStatus, saveStatus, markAsNotMiscategorizedStatus, transactionIdsBySelectedPeriod, transactionReviewLocalDataById, selectedCheckBoxTransactionIds, transactionIdsWithUnsavedData, uploadReceiptStatusById, selectedTransactionId, selectedTransactionLineId, } = expenseAutomationTransactionsViewState.transactionCategorizationView[selectedTransactionCategorizationTab];
20
20
  const uncategorizedIncomeExpense = (0, accountListSelector_1.getUncategorizedAccounts)(accountState, accountListState, 'accountList');
@@ -47,16 +47,10 @@ function getExpenseAutomationTransactionView(state) {
47
47
  .filter((transaction) => transaction != null);
48
48
  const transactions = (0, transactionSelector_1.getSupportedTransactionsByIds)(transactionState, transactionIds);
49
49
  const transactionsWithCOT = transactions.map((transaction) => (0, transactionHelper_1.getTransactionWithCOT)(transaction));
50
- const monthEndFetchState = monthYearPeriodId != null
51
- ? (monthEndCloseChecksViewState.monthEndCloseChecksViewByTenantId[currentTenant.tenantId]?.[monthYearPeriodId] ?? { fetchState: 'Not-Started', error: undefined })
52
- : { fetchState: 'Not-Started', error: undefined };
53
- const fetchStatus = (0, reduceFetchState_1.reduceAnyFetchState)([
54
- (0, reduceFetchState_1.reduceAllFetchState)([
55
- accountList,
56
- classList,
57
- expenseAutomationTransactionsViewState.transactionCategorizationView[selectedTransactionCategorizationTab],
58
- ]),
59
- monthEndFetchState,
50
+ const fetchStatus = (0, reduceFetchState_1.reduceAllFetchState)([
51
+ accountList,
52
+ classList,
53
+ expenseAutomationTransactionsViewState.transactionCategorizationView[selectedTransactionCategorizationTab],
60
54
  ]);
61
55
  const totalCountByReview = expenseAutomationTransactionsViewState.transactionCategorizationView.review
62
56
  .uiState.totalCount;
@@ -1,21 +1,16 @@
1
1
  import { NestedAccountHierarchyForReport } from '../../../commonStateTypes/accountView/nestedAccountID';
2
2
  import { FetchStateAndError, FetchedState, ID } from '../../../commonStateTypes/common';
3
3
  import { Recommendation } from '../../../commonStateTypes/recommendationBase';
4
- import { SortOrder } from '../../../commonStateTypes/selectorTypes/sortOrderTypes';
5
4
  import { MonthYearPeriodId } from '../../../commonStateTypes/timePeriod';
6
5
  import { AccountBase } from '../../../entity/account/accountState';
7
6
  import { JEScheduleTransactionKey, ScheduleTypes } from '../../../entity/jeSchedules/jeSchedulesTypes';
8
7
  import { VendorBase } from '../../../entity/vendor/vendorState';
9
- export declare const toJEScheduleSortKey: (v: string) => "vendor" | "type" | "category" | "class" | "memo" | "transactionDate" | "totalAmount" | "runningBalance" | "scheduleCategory" | "startMonth" | "amortizationPeriod" | "jePostingDate" | "remainingMonths";
10
- export type JEScheduleSortKey = ReturnType<typeof toJEScheduleSortKey>;
11
8
  export interface JESchedulesViewUIState {
12
9
  scrollPosition: {
13
10
  scrollTop: number;
14
11
  scrollLeft?: number;
15
12
  } | undefined;
16
13
  searchString: string;
17
- sortKey: JEScheduleSortKey;
18
- sortOrder: SortOrder;
19
14
  totalCount: number;
20
15
  limit?: number;
21
16
  }
@@ -1,21 +1,2 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.toJEScheduleSortKey = void 0;
4
- const stringToUnion_1 = require("../../../commonStateTypes/stringToUnion");
5
- const JE_SCHEDULE_SORT_KEYS = [
6
- 'vendor',
7
- 'category',
8
- 'class',
9
- 'scheduleCategory',
10
- 'startMonth',
11
- 'type',
12
- 'amortizationPeriod',
13
- 'jePostingDate',
14
- 'remainingMonths',
15
- 'runningBalance',
16
- 'totalAmount',
17
- 'transactionDate',
18
- 'memo',
19
- ];
20
- const toJEScheduleSortKey = (v) => (0, stringToUnion_1.stringToUnion)(v, JE_SCHEDULE_SORT_KEYS);
21
- exports.toJEScheduleSortKey = toJEScheduleSortKey;
@@ -7,7 +7,7 @@ export declare const getScheduleListKey: (selectedCategory: ID, selectedTimefram
7
7
  export type ScheduleListKey = ReturnType<typeof getScheduleListKey>;
8
8
  export declare const toScheduleSubTabType: (v: string) => "completed" | "new" | "ongoing" | "all";
9
9
  export type ScheduleSubTabType = ReturnType<typeof toScheduleSubTabType>;
10
- declare const toScheduleSortKeyType: (v: string) => "months" | "amount" | "vendor" | "status" | "user" | "createTime" | "class" | "memo" | "balanceAsOfToday" | "transactionDate" | "transactionType" | "assetId" | "scheduleCategory" | "startMonth" | "accruedExpenseCategory" | "expenseCategory" | "accumulatedDepreciationCategory" | "endMonth";
10
+ declare const toScheduleSortKeyType: (v: string) => "months" | "amount" | "vendor" | "status" | "user" | "createTime" | "class" | "memo" | "balanceAsOfToday" | "transactionDate" | "transactionType" | "assetId" | "accruedExpenseCategory" | "scheduleCategory" | "expenseCategory" | "accumulatedDepreciationCategory" | "startMonth" | "endMonth";
11
11
  export declare type ScheduleListSortKey = ReturnType<typeof toScheduleSortKeyType>;
12
12
  export interface DownloadJEScheduleTabOptions {
13
13
  categoryId: ID;
@@ -424,14 +424,6 @@ const getBillListOnSort = (sortKey, sortOrder, currentTab, transactions) => {
424
424
  transactionsWithNoSortKeyValue.push(transaction);
425
425
  }
426
426
  break;
427
- case 'invoiceNumber':
428
- if (transaction.documentId != null) {
429
- transactionsWithSortKeyValue.push(transaction);
430
- }
431
- else {
432
- transactionsWithNoSortKeyValue.push(transaction);
433
- }
434
- break;
435
427
  case 'dueDate':
436
428
  if (currentTab === 'draft') {
437
429
  if (Boolean(transaction.dueDate) === true) {
@@ -534,8 +526,6 @@ const getBillListOnSort = (sortKey, sortOrder, currentTab, transactions) => {
534
526
  return transaction.totalAmountInUSD?.amount ?? 0;
535
527
  case 'paymentMethod':
536
528
  return transaction.billPayInfo.billPaymentMethodType.name;
537
- case 'invoiceNumber':
538
- return transaction.documentId;
539
529
  }
540
530
  }, getColumnWiseSortOrder(sortOrder));
541
531
  return [
@@ -37,7 +37,7 @@ declare const toBillTabType: (v: string) => "paid" | "pending_approval" | "sched
37
37
  export type BillTab = ReturnType<typeof toBillTabType>;
38
38
  declare const toBillsSubTabType: (v: string) => "rejected" | "failed" | "ach" | "wire" | "cancelled" | "deleted" | "overdue" | "all" | "awaiting_approval" | "awaiting_my_approval" | "offline";
39
39
  export type BillsSubTabType = ReturnType<typeof toBillsSubTabType>;
40
- declare const toBillPaySortKeyType: (v: string) => "amount" | "status" | "name" | "dueDate" | "paymentMethod" | "invoiceNumber" | "invoiceDate";
40
+ declare const toBillPaySortKeyType: (v: string) => "amount" | "status" | "name" | "dueDate" | "paymentMethod" | "invoiceDate";
41
41
  export declare type BillPayViewSortKey = ReturnType<typeof toBillPaySortKeyType>;
42
42
  export interface BillPayFilters {
43
43
  categories: BillPayFilterCategory[];
@@ -47,7 +47,6 @@ const ALL_BILL_PAY_SORT_KEYS = [
47
47
  'invoiceDate',
48
48
  'name',
49
49
  'paymentMethod',
50
- 'invoiceNumber',
51
50
  ];
52
51
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
53
52
  const toBillPaySortKeyType = (v) => (0, stringToUnion_1.stringToUnion)(v, ALL_BILL_PAY_SORT_KEYS);
@@ -9,7 +9,6 @@ const reduceFetchState_1 = require("../../../../commonStateTypes/reduceFetchStat
9
9
  const contactSelector_1 = require("../../../../entity/billPay/contact/contactSelector");
10
10
  const paymentAccountSelector_1 = require("../../../../entity/paymentAccount/paymentAccountSelector");
11
11
  const vendorSelector_1 = require("../../../../entity/vendor/vendorSelector");
12
- const tenantSelector_1 = require("../../../../entity/tenant/tenantSelector");
13
12
  const accountListSelector_1 = require("../../../accountList/accountListSelector");
14
13
  const setupViewSelector_1 = require("../../commonSetup/setupViewSelector");
15
14
  const depositAccountListSelector_1 = require("../../zeniAccounts/depositAccountList/depositAccountListSelector");
@@ -81,14 +80,11 @@ const getReviewPageBillDetail = (state, billId) => {
81
80
  }
82
81
  }
83
82
  if (sourceBillDetail != null) {
84
- const fetchStateList = [
83
+ sourceBillDetailFetchState = (0, reduceFetchState_1.reduceFetchState)([
85
84
  sourceBillDetail.fetchStatus,
86
85
  accountListState.byReportId['billPayAccountList'],
87
- ];
88
- if ((0, tenantSelector_1.getIsAccountingClassesEnabled)(state)) {
89
- fetchStateList.push(classListState);
90
- }
91
- sourceBillDetailFetchState = (0, reduceFetchState_1.reduceFetchState)(fetchStateList).fetchState;
86
+ classListState,
87
+ ]).fetchState;
92
88
  }
93
89
  }
94
90
  else {
@@ -9,7 +9,6 @@ const cloneDeep_1 = __importDefault(require("lodash/cloneDeep"));
9
9
  const reduceFetchState_1 = require("../../../../commonStateTypes/reduceFetchState");
10
10
  const approvalRuleSelector_1 = require("../../../../entity/approvalRule/approvalRuleSelector");
11
11
  const classSelector_1 = require("../../../../entity/class/classSelector");
12
- const tenantSelector_1 = require("../../../../entity/tenant/tenantSelector");
13
12
  const userSelector_1 = require("../../../../entity/user/userSelector");
14
13
  const userRoleSelector_1 = require("../../../../entity/userRole/userRoleSelector");
15
14
  exports.getBillPaySetupApproverView = (0, toolkit_1.createSelector)((state) => state.billPaySetupApproverViewState, (state) => state.approvalRuleState, (state) => state.userState, (billPaySetupApproverViewState, approvalRuleState, userState) => {
@@ -51,7 +50,7 @@ exports.getBillPaySetupApproverView = (0, toolkit_1.createSelector)((state) => s
51
50
  newApprovalRuleId,
52
51
  };
53
52
  });
54
- exports.getBillPaySetupApproverUpdateDataView = (0, toolkit_1.createSelector)((state) => state.billPaySetupApproverViewState, (state) => state.approvalRuleState, (state) => state.userState, (state) => state.classState, (state) => state.classListState, (state) => state.userRoleState, (state) => (0, tenantSelector_1.getIsAccountingClassesEnabled)(state), (billPaySetupApproverViewState, approvalRuleState, userState, classState, classListState, userRoleState, isAccountingClassesEnabled) => {
53
+ exports.getBillPaySetupApproverUpdateDataView = (0, toolkit_1.createSelector)((state) => state.billPaySetupApproverViewState, (state) => state.approvalRuleState, (state) => state.userState, (state) => state.classState, (state) => state.classListState, (state) => state.userRoleState, (billPaySetupApproverViewState, approvalRuleState, userState, classState, classListState, userRoleState) => {
55
54
  const { affectedEntityIds, approvalRuleIds, approverListState, billPaySetupApproverViewUpdateData, fetchState, error, listeningToPusherEvent, } = billPaySetupApproverViewState;
56
55
  const { approverIds, attributes } = approverListState;
57
56
  const allApprovalRules = (0, approvalRuleSelector_1.getApprovalRulesByIds)(approvalRuleState, approvalRuleIds);
@@ -99,9 +98,10 @@ exports.getBillPaySetupApproverUpdateDataView = (0, toolkit_1.createSelector)((s
99
98
  allAttributes,
100
99
  filteredAttributes,
101
100
  billPaySetupApproverViewUpdateData,
102
- approverListFetchStatus: isAccountingClassesEnabled
103
- ? (0, reduceFetchState_1.reduceAllFetchState)([approverListState.fetchStatus, classListState])
104
- : approverListState.fetchStatus,
101
+ approverListFetchStatus: (0, reduceFetchState_1.reduceAllFetchState)([
102
+ approverListState.fetchStatus,
103
+ classListState,
104
+ ]),
105
105
  fetchState,
106
106
  allAccountingClasses,
107
107
  error,
@@ -3,28 +3,23 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.fetchBillPayApproversDetailsEpic = void 0;
4
4
  const rxjs_1 = require("rxjs");
5
5
  const operators_1 = require("rxjs/operators");
6
- const tenantSelector_1 = require("../../../../../entity/tenant/tenantSelector");
7
6
  const classListReducer_1 = require("../../../../classList/classListReducer");
8
7
  const billPaySetupApproverViewReducer_1 = require("../billPaySetupApproverViewReducer");
9
8
  const fetchBillPayApproversDetailsEpic = (actions$, state$) => actions$.pipe((0, operators_1.filter)(billPaySetupApproverViewReducer_1.fetchBillPayApproversDetails.match), (0, operators_1.mergeMap)((action) => {
10
9
  const { cacheOverride, includeUserRoles } = action.payload;
11
10
  const { billPaySetupApproverViewState, classListState } = state$.value;
12
11
  const { approverListState } = billPaySetupApproverViewState;
13
- const isAccountingClassesEnabled = (0, tenantSelector_1.getIsAccountingClassesEnabled)(state$.value);
14
12
  const actions = [];
15
13
  if (cacheOverride === true) {
16
14
  actions.push((0, billPaySetupApproverViewReducer_1.fetchBillPayApproversList)(cacheOverride, includeUserRoles));
17
- if (isAccountingClassesEnabled) {
18
- actions.push((0, classListReducer_1.fetchClassList)());
19
- }
15
+ actions.push((0, classListReducer_1.fetchClassList)());
20
16
  }
21
17
  else {
22
18
  if (billPaySetupApproverViewState.hasValidState() === false &&
23
19
  approverListState.fetchStatus.fetchState !== 'In-Progress') {
24
20
  actions.push((0, billPaySetupApproverViewReducer_1.fetchBillPayApproversList)(true, includeUserRoles));
25
21
  }
26
- if (isAccountingClassesEnabled &&
27
- classListState.hasValidState() === false &&
22
+ if (classListState.hasValidState() === false &&
28
23
  classListState.fetchState !== 'In-Progress') {
29
24
  actions.push((0, classListReducer_1.fetchClassList)());
30
25
  }
@@ -33,7 +33,6 @@ const billPayConfigPayload_1 = require("../billPayConfig/billPayConfigPayload");
33
33
  const billPayConfigSelector_1 = require("../billPayConfig/billPayConfigSelector");
34
34
  const billPayConfigState_1 = require("../billPayConfig/billPayConfigState");
35
35
  const billPayReviewSelector_1 = require("../billPayReview/billPayReviewSelector");
36
- const tenantSelector_1 = require("../../../../entity/tenant/tenantSelector");
37
36
  const billPaySetupApproverViewSelector_1 = require("../billPaySetupApproverView/billPaySetupApproverViewSelector");
38
37
  const previousBillsSelector_1 = require("../previousBills/previousBillsSelector");
39
38
  const getEditBillDetail = (state, isVendorRecommendationFeatureEnabled, isZeniAccountsEnabled, billId) => {
@@ -182,15 +181,12 @@ const getEditBillDetail = (state, isVendorRecommendationFeatureEnabled, isZeniAc
182
181
  isCancelled = sourceBillDetail.billDetailLocalData.isCancelled;
183
182
  billStage = billPayInfo?.stage.code ?? 'draft';
184
183
  if (billViewState != null) {
185
- const fetchStateList = [
184
+ fetchState = (0, reduceFetchState_1.reduceFetchState)([
186
185
  sourceBillDetail.fetchStatus,
187
186
  accountListState.byReportId.billPayAccountList,
187
+ classListState,
188
188
  billPaySetupApproverViewState,
189
- ];
190
- if ((0, tenantSelector_1.getIsAccountingClassesEnabled)(state)) {
191
- fetchStateList.push(classListState);
192
- }
193
- fetchState = (0, reduceFetchState_1.reduceFetchState)(fetchStateList).fetchState;
189
+ ]).fetchState;
194
190
  deleteStatus = billViewState.deleteStatus;
195
191
  billActivities = (0, billDetailViewSelector_1.getBillActivities)(state, billId, billPayInfo?.stage.code);
196
192
  }
@@ -204,14 +200,11 @@ const getEditBillDetail = (state, isVendorRecommendationFeatureEnabled, isZeniAc
204
200
  }
205
201
  }
206
202
  else {
207
- const newBillFetchStateList = [
203
+ fetchState = (0, reduceFetchState_1.reduceFetchState)([
208
204
  accountListState.byReportId.billPayAccountList,
205
+ classListState,
209
206
  billPaySetupApproverViewState,
210
- ];
211
- if ((0, tenantSelector_1.getIsAccountingClassesEnabled)(state)) {
212
- newBillFetchStateList.push(classListState);
213
- }
214
- fetchState = (0, reduceFetchState_1.reduceFetchState)(newBillFetchStateList).fetchState;
207
+ ]).fetchState;
215
208
  }
216
209
  if (sourceBillDetail != null && fetchState == 'Completed') {
217
210
  const updatedRecord = sourceBillDetail.billDetailLocalData;
@@ -0,0 +1,7 @@
1
+ import { Observable } from 'rxjs';
2
+ import { ZeniAPI } from '../../../../zeniAPI';
3
+ import { updateAiCardRecommendation, updateAiCardRecommendationFailure, updateChainOfThoughts, updateChainOfThoughtsFailure } from './cardsOnboardingReducer';
4
+ export type ChainOfThoughtsRequestAction = ReturnType<typeof updateChainOfThoughts> | ReturnType<typeof updateChainOfThoughtsFailure>;
5
+ export type AiCardRecommendationRequestAction = ReturnType<typeof updateAiCardRecommendation> | ReturnType<typeof updateAiCardRecommendationFailure>;
6
+ export declare function requestChainOfThoughtsForAiCardRecommendation$(zeniAPI: ZeniAPI): Observable<ChainOfThoughtsRequestAction>;
7
+ export declare function requestAiCardRecommendation$(zeniAPI: ZeniAPI): Observable<AiCardRecommendationRequestAction>;
@@ -0,0 +1,62 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.requestChainOfThoughtsForAiCardRecommendation$ = requestChainOfThoughtsForAiCardRecommendation$;
4
+ exports.requestAiCardRecommendation$ = requestAiCardRecommendation$;
5
+ const rxjs_1 = require("rxjs");
6
+ const operators_1 = require("rxjs/operators");
7
+ const responsePayload_1 = require("../../../../responsePayload");
8
+ const cardsOnboardingReducer_1 = require("./cardsOnboardingReducer");
9
+ function isBareChainOfThoughtsPayload(value) {
10
+ if (value == null || typeof value !== 'object') {
11
+ return false;
12
+ }
13
+ const o = value;
14
+ return (typeof o.analyzing === 'string' &&
15
+ typeof o.thinking === 'string' &&
16
+ typeof o.thought_process === 'string');
17
+ }
18
+ function isBareAiCardRecommendationPayload(value) {
19
+ if (value == null || typeof value !== 'object') {
20
+ return false;
21
+ }
22
+ const o = value;
23
+ const pc = o.projected_coverage;
24
+ return (Array.isArray(o.vendor_cards) &&
25
+ Array.isArray(o.dept_cards) &&
26
+ typeof o.card_recommendation_pre_text === 'string' &&
27
+ (typeof pc === 'string' || typeof pc === 'number'));
28
+ }
29
+ function requestChainOfThoughtsForAiCardRecommendation$(zeniAPI) {
30
+ const url = `${zeniAPI.apiEndPoints.cardMicroServiceBaseUrl}/1.0/chain-of-thoughts-for-ai-card-recommendation`;
31
+ return zeniAPI.getJSON(url).pipe((0, operators_1.mergeMap)((response) => {
32
+ if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
33
+ return (0, rxjs_1.of)((0, cardsOnboardingReducer_1.updateChainOfThoughts)(response.data));
34
+ }
35
+ if (isBareChainOfThoughtsPayload(response)) {
36
+ return (0, rxjs_1.of)((0, cardsOnboardingReducer_1.updateChainOfThoughts)(response));
37
+ }
38
+ if ('status' in response && response.status != null) {
39
+ return (0, rxjs_1.of)((0, cardsOnboardingReducer_1.updateChainOfThoughtsFailure)(response.status));
40
+ }
41
+ return (0, rxjs_1.of)((0, cardsOnboardingReducer_1.updateChainOfThoughtsFailure)((0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Fetch chain of thoughts for AI card recommendation returned an invalid payload')));
42
+ }), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, cardsOnboardingReducer_1.updateChainOfThoughtsFailure)((0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Fetch chain of thoughts for AI card recommendation REST API call errored out' +
43
+ JSON.stringify(error))))));
44
+ }
45
+ function requestAiCardRecommendation$(zeniAPI) {
46
+ const url = `${zeniAPI.apiEndPoints.cardMicroServiceBaseUrl}/1.0/ai-card-recommendation`;
47
+ return zeniAPI
48
+ .getJSON(url)
49
+ .pipe((0, operators_1.mergeMap)((response) => {
50
+ if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
51
+ return (0, rxjs_1.of)((0, cardsOnboardingReducer_1.updateAiCardRecommendation)(response.data));
52
+ }
53
+ if (isBareAiCardRecommendationPayload(response)) {
54
+ return (0, rxjs_1.of)((0, cardsOnboardingReducer_1.updateAiCardRecommendation)(response));
55
+ }
56
+ if ('status' in response && response.status != null) {
57
+ return (0, rxjs_1.of)((0, cardsOnboardingReducer_1.updateAiCardRecommendationFailure)(response.status));
58
+ }
59
+ return (0, rxjs_1.of)((0, cardsOnboardingReducer_1.updateAiCardRecommendationFailure)((0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Fetch AI card recommendation returned an invalid payload')));
60
+ }), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, cardsOnboardingReducer_1.updateAiCardRecommendationFailure)((0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Fetch AI card recommendation REST API call errored out' +
61
+ JSON.stringify(error))))));
62
+ }
@@ -0,0 +1,34 @@
1
+ import { ID } from '../../../../commonStateTypes/common';
2
+ import { ZeniAPIResponse } from '../../../../responsePayload';
3
+ export interface ChainOfThoughtsPayload {
4
+ analyzing: string;
5
+ thinking: string;
6
+ thought_process: string;
7
+ }
8
+ export type FetchChainOfThoughtsResponse = ZeniAPIResponse<ChainOfThoughtsPayload>;
9
+ export interface AiCardRecommendationCardItemPayload {
10
+ credit_limit: number;
11
+ name: string;
12
+ owner_id: string;
13
+ }
14
+ export interface AiCardRecommendationPayload {
15
+ card_recommendation_pre_text: string;
16
+ dept_cards: AiCardRecommendationCardItemPayload[];
17
+ projected_coverage: string | number;
18
+ vendor_cards: AiCardRecommendationCardItemPayload[];
19
+ }
20
+ export type FetchAiCardRecommendationResponse = ZeniAPIResponse<AiCardRecommendationPayload>;
21
+ /** Edited rows from the AI recommendation UI → POST `/1.0/cards` (see `createAllAiRecommendedCardsEpic`). */
22
+ export interface CreateAiRecommendedCardDraft {
23
+ /** Maps to API `card_name` (recommendation `name`). */
24
+ card_name: string;
25
+ /** Maps to `card_holder_user_ids: [owner_id]`. */
26
+ owner_id: ID;
27
+ /** Maps to API `purchase_limit` (recommendation `credit_limit`). */
28
+ purchase_limit: number;
29
+ card_type?: string;
30
+ currency_code?: string;
31
+ purchase_limit_frequency?: {
32
+ code: string;
33
+ };
34
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,7 @@
1
+ import { ZeniAPIStatus } from '../../../../responsePayload';
2
+ import { AiCardRecommendationPayload, ChainOfThoughtsPayload, CreateAiRecommendedCardDraft } from './cardsOnboardingPayload';
3
+ import { CardsOnboardingState, ChainOfThoughtsRevealPhase } from './cardsOnboardingState';
4
+ export declare const initialState: CardsOnboardingState;
5
+ export declare const startAiCardAgentDrawerDataLoad: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"cardsOnboarding/startAiCardAgentDrawerDataLoad">, fetchChainOfThoughtsForAiCardRecommendation: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"cardsOnboarding/fetchChainOfThoughtsForAiCardRecommendation">, updateChainOfThoughts: import("@reduxjs/toolkit").ActionCreatorWithPayload<ChainOfThoughtsPayload, "cardsOnboarding/updateChainOfThoughts">, updateChainOfThoughtsFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<ZeniAPIStatus<Record<string, unknown>>, "cardsOnboarding/updateChainOfThoughtsFailure">, setChainOfThoughtsRevealPhase: import("@reduxjs/toolkit").ActionCreatorWithPayload<ChainOfThoughtsRevealPhase, "cardsOnboarding/setChainOfThoughtsRevealPhase">, fetchAiCardRecommendation: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"cardsOnboarding/fetchAiCardRecommendation">, updateAiCardRecommendation: import("@reduxjs/toolkit").ActionCreatorWithPayload<AiCardRecommendationPayload, "cardsOnboarding/updateAiCardRecommendation">, updateAiCardRecommendationFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<ZeniAPIStatus<Record<string, unknown>>, "cardsOnboarding/updateAiCardRecommendationFailure">, createAllAiRecommendedCards: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[cards: CreateAiRecommendedCardDraft[]], CreateAiRecommendedCardDraft[], "cardsOnboarding/createAllAiRecommendedCards", never, never>, createAllAiRecommendedCardsSucceeded: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"cardsOnboarding/createAllAiRecommendedCardsSucceeded">, createAllAiRecommendedCardsFailed: import("@reduxjs/toolkit").ActionCreatorWithPayload<ZeniAPIStatus<Record<string, unknown>>, "cardsOnboarding/createAllAiRecommendedCardsFailed">, clearCardsOnboarding: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"cardsOnboarding/clearCardsOnboarding">;
6
+ declare const _default: import("redux").Reducer<CardsOnboardingState>;
7
+ export default _default;