@zeniai/client-epic-state 5.0.71-betaVR3 → 5.0.72

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 (138) hide show
  1. package/lib/coreEpics.js +1 -1
  2. package/lib/entity/account/accountSelector.d.ts +1 -1
  3. package/lib/entity/account/accountState.d.ts +1 -1
  4. package/lib/entity/account/subAccountSelector.d.ts +1 -1
  5. package/lib/entity/aiAccountantCustomer/aiAccountantCustomerPayload.js +3 -1
  6. package/lib/entity/aiAccountantCustomer/aiAccountantCustomerReducer.js +2 -1
  7. package/lib/entity/aiAccountantCustomer/aiAccountantCustomerSelector.d.ts +1 -1
  8. package/lib/entity/chargeCard/chargeCardReducer.d.ts +2 -19
  9. package/lib/entity/chargeCard/chargeCardReducer.js +2 -35
  10. package/lib/entity/chargeCardTransaction/chargeCardTransactionReducer.d.ts +1 -14
  11. package/lib/entity/chargeCardTransaction/chargeCardTransactionReducer.js +2 -36
  12. package/lib/entity/sectionProjectView/sectionProjectViewReducer.d.ts +1 -1
  13. package/lib/entity/sectionProjectView/sectionProjectViewSelector.js +1 -1
  14. package/lib/entity/tenant/SessionManager.js +3 -6
  15. package/lib/entity/tenant/clearAllEpic.d.ts +2 -2
  16. package/lib/entity/tenant/clearAllEpic.js +2 -2
  17. package/lib/entity/tenant/epic/saveAPIKeyConnectionEpic.js +2 -6
  18. package/lib/entity/tenant/epic/saveOAuthConnectionEpic.js +2 -6
  19. package/lib/entity/tenant/tenantReducer.js +1 -6
  20. package/lib/entity/transaction/payloadTypes/transactionLinePayload.js +1 -3
  21. package/lib/epic.d.ts +10 -12
  22. package/lib/epic.js +11 -13
  23. package/lib/esm/coreEpics.js +1 -1
  24. package/lib/esm/entity/aiAccountantCustomer/aiAccountantCustomerPayload.js +3 -1
  25. package/lib/esm/entity/aiAccountantCustomer/aiAccountantCustomerReducer.js +2 -1
  26. package/lib/esm/entity/chargeCard/chargeCardReducer.js +1 -34
  27. package/lib/esm/entity/chargeCardTransaction/chargeCardTransactionReducer.js +1 -35
  28. package/lib/esm/entity/sectionProjectView/sectionProjectViewSelector.js +1 -1
  29. package/lib/esm/entity/tenant/SessionManager.js +1 -4
  30. package/lib/esm/entity/tenant/clearAllEpic.js +2 -2
  31. package/lib/esm/entity/tenant/epic/saveAPIKeyConnectionEpic.js +2 -6
  32. package/lib/esm/entity/tenant/epic/saveOAuthConnectionEpic.js +2 -6
  33. package/lib/esm/entity/tenant/tenantReducer.js +1 -6
  34. package/lib/esm/entity/transaction/payloadTypes/transactionLinePayload.js +1 -3
  35. package/lib/esm/epic.js +11 -13
  36. package/lib/esm/index.js +15 -19
  37. package/lib/esm/reducer.js +2 -2
  38. package/lib/esm/view/aiAccountantView/epics/fetchAiAccountantCustomersEpic.js +5 -2
  39. package/lib/esm/view/aiAccountantView/epics/fetchAiAccountantJobsEpic.js +5 -2
  40. package/lib/esm/view/aiAccountantView/epics/triggerAiAccountantJobEpic.js +1 -4
  41. package/lib/esm/view/companyTaskManagerView/companyTaskManagerViewSelector.js +1 -1
  42. package/lib/esm/view/companyTaskManagerView/epics/fetchTaskManagerMetricsEpic.js +1 -1
  43. package/lib/esm/view/expenseAutomationView/epics/missingReceipts/fetchBulkUploadBatchesEpic.js +2 -2
  44. package/lib/esm/view/expenseAutomationView/epics/missingReceipts/fetchCompletedTransactionsEpic.js +1 -2
  45. package/lib/esm/view/expenseAutomationView/epics/missingReceipts/fetchMultipleBatchDetailsEpic.js +5 -21
  46. package/lib/esm/view/expenseAutomationView/epics/missingReceipts/restoreBulkUploadAutomatchingOnMountEpic.js +6 -8
  47. package/lib/esm/view/expenseAutomationView/epics/missingReceipts/searchTransactionsForManualMatchEpic.js +1 -7
  48. package/lib/esm/view/expenseAutomationView/epics/missingReceipts/watchBulkUploadBatchStatusEpic.js +9 -13
  49. package/lib/esm/view/expenseAutomationView/epics/transactionCategorization/fetchTransactionCategorizationEpic.js +1 -11
  50. package/lib/esm/view/expenseAutomationView/reducers/missingReceiptsViewReducer.js +2 -81
  51. package/lib/esm/view/expenseAutomationView/reducers/transactionsViewReducer.js +1 -127
  52. package/lib/esm/view/expenseAutomationView/selectors/missingReceiptsSelector.js +0 -2
  53. package/lib/esm/view/expenseAutomationView/selectors/transactionCategorizationSelector.js +1 -20
  54. package/lib/esm/view/expenseAutomationView/types/missingReceiptsViewState.js +2 -0
  55. package/lib/esm/view/financeStatement/financeStatementSelector.js +1 -1
  56. package/lib/esm/view/spendManagement/chargeCards/cashbackDetail/cashbackDetailReducer.js +2 -3
  57. package/lib/esm/view/spendManagement/chargeCards/chargeCardConfig/chargeCardConfigReducer.js +2 -3
  58. package/lib/esm/view/spendManagement/chargeCards/chargeCardDetail/chargeCardDetailReducer.js +18 -55
  59. package/lib/esm/view/spendManagement/chargeCards/chargeCardDetail/fetchChargeCardDetailEpic.js +2 -16
  60. package/lib/esm/view/spendManagement/chargeCards/chargeCardDetail/fetchChargeCardDetailPageEpic.js +4 -5
  61. package/lib/esm/view/spendManagement/chargeCards/chargeCardList/chargeCardListReducer.js +9 -26
  62. package/lib/esm/view/spendManagement/chargeCards/chargeCardList/fetchChargeCardListPageEpic.js +6 -9
  63. package/lib/esm/view/spendManagement/chargeCards/chargeCardPaymentHistory/chargeCardPaymentHistoryReducer.js +2 -3
  64. package/lib/esm/view/spendManagement/chargeCards/chargeCardPaymentHistory/fetchChargeCardPaymentPageEpic.js +1 -1
  65. package/lib/esm/view/spendManagement/chargeCards/chargeCardRepaymentDetail/chargeCardRepaymentDetailReducer.js +3 -7
  66. package/lib/esm/view/taskManager/cannedResponsesView/epics/fetchCannedResponsesEpic.js +1 -1
  67. package/lib/esm/view/taskManager/cannedResponsesView/epics/saveCannedResponseEpic.js +1 -1
  68. package/lib/esm/view/taskManager/taskDetailView/epics/unsnoozeTaskEpic.js +1 -1
  69. package/lib/esm/view/transactionDetail/transactionDetailSelector.js +1 -7
  70. package/lib/index.d.ts +16 -20
  71. package/lib/index.js +58 -75
  72. package/lib/reducer.d.ts +2 -2
  73. package/lib/reducer.js +2 -2
  74. package/lib/tsconfig.typecheck.tsbuildinfo +1 -0
  75. package/lib/view/aiAccountantView/aiAccountantViewPayload.d.ts +2 -2
  76. package/lib/view/aiAccountantView/aiAccountantViewReducer.d.ts +1 -1
  77. package/lib/view/aiAccountantView/epics/fetchAiAccountantCustomersEpic.js +5 -2
  78. package/lib/view/aiAccountantView/epics/fetchAiAccountantJobsEpic.js +5 -2
  79. package/lib/view/aiAccountantView/epics/triggerAiAccountantJobEpic.js +1 -4
  80. package/lib/view/companyTaskManagerView/companyTaskManagerViewSelector.d.ts +1 -1
  81. package/lib/view/companyTaskManagerView/companyTaskManagerViewSelector.js +1 -1
  82. package/lib/view/expenseAutomationView/epics/missingReceipts/fetchBulkUploadBatchesEpic.js +2 -2
  83. package/lib/view/expenseAutomationView/epics/missingReceipts/fetchCompletedTransactionsEpic.js +1 -2
  84. package/lib/view/expenseAutomationView/epics/missingReceipts/fetchMultipleBatchDetailsEpic.js +5 -21
  85. package/lib/view/expenseAutomationView/epics/missingReceipts/restoreBulkUploadAutomatchingOnMountEpic.js +6 -8
  86. package/lib/view/expenseAutomationView/epics/missingReceipts/searchTransactionsForManualMatchEpic.js +1 -7
  87. package/lib/view/expenseAutomationView/epics/missingReceipts/watchBulkUploadBatchStatusEpic.d.ts +5 -11
  88. package/lib/view/expenseAutomationView/epics/missingReceipts/watchBulkUploadBatchStatusEpic.js +8 -12
  89. package/lib/view/expenseAutomationView/epics/transactionCategorization/fetchTransactionCategorizationEpic.d.ts +2 -2
  90. package/lib/view/expenseAutomationView/epics/transactionCategorization/fetchTransactionCategorizationEpic.js +0 -10
  91. package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.d.ts +1 -1
  92. package/lib/view/expenseAutomationView/payload/transactionCategorizationPayload.d.ts +0 -21
  93. package/lib/view/expenseAutomationView/reducers/missingReceiptsViewReducer.d.ts +2 -15
  94. package/lib/view/expenseAutomationView/reducers/missingReceiptsViewReducer.js +3 -83
  95. package/lib/view/expenseAutomationView/reducers/transactionsViewReducer.d.ts +3 -9
  96. package/lib/view/expenseAutomationView/reducers/transactionsViewReducer.js +2 -128
  97. package/lib/view/expenseAutomationView/selectorTypes/missingReceiptsSelectorTypes.d.ts +1 -14
  98. package/lib/view/expenseAutomationView/selectorTypes/transactionsViewSelectorTypes.d.ts +0 -14
  99. package/lib/view/expenseAutomationView/selectors/missingReceiptsSelector.js +0 -2
  100. package/lib/view/expenseAutomationView/selectors/transactionCategorizationSelector.js +1 -20
  101. package/lib/view/expenseAutomationView/types/missingReceiptsViewState.d.ts +2 -20
  102. package/lib/view/expenseAutomationView/types/missingReceiptsViewState.js +4 -1
  103. package/lib/view/expenseAutomationView/types/transactionsViewState.d.ts +2 -41
  104. package/lib/view/financeStatement/financeStatementSelector.js +1 -1
  105. package/lib/view/profitAndLossProjectView/profitAndLossProjectViewSelectorTypes.d.ts +1 -1
  106. package/lib/view/spendManagement/chargeCards/cashbackDetail/cashbackDetailReducer.d.ts +1 -3
  107. package/lib/view/spendManagement/chargeCards/cashbackDetail/cashbackDetailReducer.js +2 -3
  108. package/lib/view/spendManagement/chargeCards/chargeCardConfig/chargeCardConfigReducer.d.ts +1 -3
  109. package/lib/view/spendManagement/chargeCards/chargeCardConfig/chargeCardConfigReducer.js +2 -3
  110. package/lib/view/spendManagement/chargeCards/chargeCardDetail/chargeCardDetailReducer.js +18 -55
  111. package/lib/view/spendManagement/chargeCards/chargeCardDetail/fetchChargeCardDetailEpic.js +2 -16
  112. package/lib/view/spendManagement/chargeCards/chargeCardDetail/fetchChargeCardDetailPageEpic.js +4 -5
  113. package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardListReducer.d.ts +3 -18
  114. package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardListReducer.js +10 -27
  115. package/lib/view/spendManagement/chargeCards/chargeCardList/fetchChargeCardListPageEpic.js +6 -9
  116. package/lib/view/spendManagement/chargeCards/chargeCardPaymentHistory/chargeCardPaymentHistoryReducer.d.ts +1 -3
  117. package/lib/view/spendManagement/chargeCards/chargeCardPaymentHistory/chargeCardPaymentHistoryReducer.js +2 -3
  118. package/lib/view/spendManagement/chargeCards/chargeCardPaymentHistory/fetchChargeCardPaymentPageEpic.js +1 -1
  119. package/lib/view/spendManagement/chargeCards/chargeCardRepaymentDetail/chargeCardRepaymentDetailReducer.d.ts +1 -3
  120. package/lib/view/spendManagement/chargeCards/chargeCardRepaymentDetail/chargeCardRepaymentDetailReducer.js +3 -7
  121. package/lib/view/transactionDetail/transactionDetailSelector.js +1 -7
  122. package/lib/view/zeniOAuthView/zeniOAuthSelector.d.ts +1 -1
  123. package/package.json +4 -9
  124. package/lib/commonStateTypes/cacheOverrideFetchReducer.d.ts +0 -17
  125. package/lib/commonStateTypes/cacheOverrideFetchReducer.js +0 -20
  126. package/lib/commonStateTypes/pusherActions.d.ts +0 -11
  127. package/lib/commonStateTypes/pusherActions.js +0 -6
  128. package/lib/esm/commonStateTypes/cacheOverrideFetchReducer.js +0 -16
  129. package/lib/esm/commonStateTypes/pusherActions.js +0 -3
  130. package/lib/esm/view/expenseAutomationView/epics/missingReceipts/refreshBatchDetailsForBatchIdEpic.js +0 -52
  131. package/lib/esm/view/expenseAutomationView/epics/missingReceipts/syncTabsAfterAutomatchEpic.js +0 -53
  132. package/lib/esm/view/expenseAutomationView/types/completedSubTab.js +0 -17
  133. package/lib/view/expenseAutomationView/epics/missingReceipts/refreshBatchDetailsForBatchIdEpic.d.ts +0 -18
  134. package/lib/view/expenseAutomationView/epics/missingReceipts/refreshBatchDetailsForBatchIdEpic.js +0 -56
  135. package/lib/view/expenseAutomationView/epics/missingReceipts/syncTabsAfterAutomatchEpic.d.ts +0 -28
  136. package/lib/view/expenseAutomationView/epics/missingReceipts/syncTabsAfterAutomatchEpic.js +0 -57
  137. package/lib/view/expenseAutomationView/types/completedSubTab.d.ts +0 -10
  138. package/lib/view/expenseAutomationView/types/completedSubTab.js +0 -21
@@ -39,6 +39,8 @@ const BULK_UPLOAD_RESULTS_TABS = ['completed', 'unmatched'];
39
39
  export const toBulkUploadResultsTab = (v) => stringToUnion(v.trim().toLowerCase(), BULK_UPLOAD_RESULTS_TABS);
40
40
  const MISSING_RECEIPTS_TABS = ['missing', 'completed', 'unmatched'];
41
41
  export const toMissingReceiptsTab = (v) => stringToUnion(v.trim().toLowerCase(), MISSING_RECEIPTS_TABS);
42
+ const COMPLETED_SUB_TABS = ['all', 'ai_accountant', 'manual'];
43
+ export const toCompletedSubTab = (v) => stringToUnion(v.trim().toLowerCase(), COMPLETED_SUB_TABS);
42
44
  const MATCH_SOURCES = ['ai', 'manual'];
43
45
  export const toMatchSource = (v) => stringToUnion(v.trim().toLowerCase(), MATCH_SOURCES);
44
46
  const BULK_UPLOAD_SORT_KEYS = [
@@ -2,7 +2,6 @@ import { createSelector } from '@reduxjs/toolkit';
2
2
  import { stripCompareAdditionalBalanceTypes } from '../../commonStateTypes/coaBalance/coaBalanceType';
3
3
  import { newBalancesFilter, newBalancesFilterForDateRange, } from '../../commonStateTypes/coaBalance/coaBalancesFilter';
4
4
  import { newBalancesFilterClassesView } from '../../commonStateTypes/coaBalance/coaBalancesFilterClassesView';
5
- import { newBalancesFilterProjectView } from '../../commonStateTypes/coaBalance/coaBalancesFilterProjectView';
6
5
  import { getNumberOfPeriods, } from '../../commonStateTypes/dataAvailable';
7
6
  import { reduceAnyCompletedFetchState } from '../../commonStateTypes/reduceFetchState';
8
7
  import { toTimeframeTick, } from '../../commonStateTypes/timeframeTick';
@@ -10,6 +9,7 @@ import { extractThisPeriod } from '../../commonStateTypes/viewAndReport/thisPeri
10
9
  import { getBalanceSheet } from '../balanceSheet/balanceSheetSelector';
11
10
  import { getCashFlow } from '../cashFlow/cashFlowSelector';
12
11
  import { getProfitAndLossReport, } from '../profitAndLoss/profitAndLossSelector';
12
+ import { newBalancesFilterProjectView } from '../../commonStateTypes/coaBalance/coaBalancesFilterProjectView';
13
13
  import { getProfitAndLossClassesHorizontalView } from '../profitAndLossClassesView/profitAndLossClassesByClassHorizontalSelector';
14
14
  import { getProfitAndLossClassesView } from '../profitAndLossClassesView/profitAndLossClassesViewSelector';
15
15
  import { getProfitAndLossProjectView } from '../profitAndLossProjectView/profitAndLossProjectViewSelector';
@@ -1,7 +1,6 @@
1
1
  import { createSlice } from '@reduxjs/toolkit';
2
2
  import { mapCurrencyPayloadToCurrency } from '../../../../commonPayloadTypes/v2/viewAndReportPayloadv2';
3
3
  import { toAmount } from '../../../../commonStateTypes/amount';
4
- import { createCacheOverrideFetchReducer } from '../../../../commonStateTypes/cacheOverrideFetchReducer';
5
4
  import { initialCashbackAnalytics, } from './cashbackDetailState';
6
5
  export const initialState = {
7
6
  fetchState: 'Not-Started',
@@ -28,10 +27,10 @@ const cashbackDetail = createSlice({
28
27
  name: 'cashbackDetail',
29
28
  initialState,
30
29
  reducers: {
31
- fetchCashbackDetail: createCacheOverrideFetchReducer((draft) => {
30
+ fetchCashbackDetail(draft) {
32
31
  draft.fetchState = 'In-Progress';
33
32
  draft.error = undefined;
34
- }),
33
+ },
35
34
  updateCashbackDetail(draft, action) {
36
35
  draft.cashbackByPeriod = toCashbackByPeriod(action.payload);
37
36
  draft.cashbackSummary = toCashbackSummary(action.payload);
@@ -1,6 +1,5 @@
1
1
  import { createSlice } from '@reduxjs/toolkit';
2
2
  import { toAmount } from '../../../../commonStateTypes/amount';
3
- import { createCacheOverrideFetchReducer } from '../../../../commonStateTypes/cacheOverrideFetchReducer';
4
3
  import { toCreditLimitFrequencyCodeType } from '../../../../entity/chargeCard/chargeCard';
5
4
  import { toCreditTerm, toRePaymentInfo, } from './chargeCardConfigPayload';
6
5
  export const initialState = {
@@ -31,10 +30,10 @@ const chargeCardConfig = createSlice({
31
30
  name: 'chargeCardConfig',
32
31
  initialState,
33
32
  reducers: {
34
- fetchChargeCardConfig: createCacheOverrideFetchReducer((draft) => {
33
+ fetchChargeCardConfig(draft) {
35
34
  draft.fetchState = 'In-Progress';
36
35
  draft.error = undefined;
37
- }),
36
+ },
38
37
  updateChargeCardConfig(draft, action) {
39
38
  const { payload } = action;
40
39
  draft.creditLimitFrequency =
@@ -1,6 +1,5 @@
1
1
  import { createSlice } from '@reduxjs/toolkit';
2
2
  import { mapSortOrderPayloadToSortOrder, } from '../../../../commonPayloadTypes/sortOrderPayload';
3
- import { addChargeCardTransactionFromPusher, addDeclinedChargeCardTransactionFromPusher, } from '../../../../commonStateTypes/pusherActions';
4
3
  import { toAttachment, } from '../../../../entity/transaction/payloadTypes/attachmentPayload';
5
4
  import { emptyChargeCardDetail, mapChargeCardTransactionStatisticsPayloadToChargeCardTransactionStatistics, toChargeCardTransactionSortKeyType, } from './chargeCardDetail';
6
5
  export const initialState = {
@@ -65,30 +64,19 @@ const chargeCardDetail = createSlice({
65
64
  },
66
65
  fetchChargeCardTransactionList: {
67
66
  reducer(draft, action) {
68
- const { chargeCardId, pageToken, pageTokenType, cacheOverride } = action.payload;
67
+ const { chargeCardId, pageToken, pageTokenType } = action.payload;
69
68
  const existingCardDetail = draft.detailById[chargeCardId] ?? emptyChargeCardDetail;
70
- const existingUi = existingCardDetail.transactionList.uiState;
71
- // cacheOverride=true (Pusher): preserve fetchState, error, and scroll
72
- // to avoid skeleton flash. Normal fetches reset as before.
73
69
  draft.detailById[chargeCardId] = {
74
70
  ...existingCardDetail,
75
71
  transactionList: {
76
72
  ...existingCardDetail.transactionList,
77
- fetchState: cacheOverride
78
- ? existingCardDetail.transactionList.fetchState
79
- : 'In-Progress',
80
- error: cacheOverride
81
- ? existingCardDetail.transactionList.error
82
- : undefined,
73
+ fetchState: 'In-Progress',
74
+ error: undefined,
83
75
  uiState: {
84
- ...existingUi,
85
- // Preserve scroll on silent refresh so users aren't snapped
86
- // away from their reading position.
87
- scrollYOffset: cacheOverride
88
- ? existingUi.scrollYOffset
89
- : existingUi.pageToken === null
90
- ? 0
91
- : existingUi.scrollYOffset,
76
+ ...existingCardDetail.transactionList.uiState,
77
+ scrollYOffset: existingCardDetail.transactionList.uiState.pageToken === null
78
+ ? 0
79
+ : existingCardDetail.transactionList.uiState.scrollYOffset,
92
80
  pageToken: pageToken,
93
81
  pageTokenType: pageTokenType,
94
82
  },
@@ -105,24 +93,18 @@ const chargeCardDetail = createSlice({
105
93
  const { chargeCardId, data, cacheOverride } = action.payload;
106
94
  const existingCardDetail = draft.detailById[chargeCardId] ?? emptyChargeCardDetail;
107
95
  const newTransactionIds = data.transactions.map((tran) => tran.transaction_id);
108
- const existingIds = existingCardDetail.transactionList.transactionIds;
109
- // cacheOverride (Pusher): refresh page 1 but keep page 2+ IDs.
110
- // Normal pagination: append new page, deduped.
111
- const newIdSet = new Set(newTransactionIds);
112
- const mergedTransactionIds = cacheOverride
113
- ? [
114
- ...newTransactionIds,
115
- ...existingIds.filter((id) => !newIdSet.has(id)),
116
- ]
117
- : [
118
- ...existingIds,
119
- ...newTransactionIds.filter((id) => !existingIds.includes(id)),
120
- ];
121
96
  draft.detailById[chargeCardId] = {
122
97
  ...existingCardDetail,
123
98
  transactionList: {
124
99
  ...existingCardDetail.transactionList,
125
- transactionIds: mergedTransactionIds,
100
+ transactionIds: [
101
+ ...new Set([
102
+ ...(cacheOverride
103
+ ? []
104
+ : existingCardDetail.transactionList.transactionIds),
105
+ ...newTransactionIds,
106
+ ]),
107
+ ],
126
108
  fetchState: 'Completed',
127
109
  error: undefined,
128
110
  uiState: {
@@ -134,12 +116,9 @@ const chargeCardDetail = createSlice({
134
116
  limit: data.query.limit,
135
117
  pageToken: data.query.page_token,
136
118
  pageTokenType: data.query.page_token_type,
137
- // Preserve scroll on silent refresh; reset on user-triggered first page.
138
- scrollYOffset: cacheOverride
139
- ? existingCardDetail.transactionList.uiState.scrollYOffset
140
- : existingCardDetail.transactionList.uiState.pageToken === null
141
- ? 0
142
- : existingCardDetail.transactionList.uiState.scrollYOffset,
119
+ scrollYOffset: existingCardDetail.transactionList.uiState.pageToken === null
120
+ ? 0
121
+ : existingCardDetail.transactionList.uiState.scrollYOffset,
143
122
  },
144
123
  },
145
124
  };
@@ -653,22 +632,6 @@ const chargeCardDetail = createSlice({
653
632
  Object.assign(draft, initialState);
654
633
  },
655
634
  },
656
- extraReducers: (builder) => {
657
- const prependTransaction = (draft, cardId, txId) => {
658
- const detail = draft.detailById[cardId];
659
- if (detail != null &&
660
- !detail.transactionList.transactionIds.includes(txId)) {
661
- detail.transactionList.transactionIds.unshift(txId);
662
- }
663
- };
664
- builder
665
- .addCase(addChargeCardTransactionFromPusher, (draft, action) => {
666
- prependTransaction(draft, action.payload.cardId, action.payload.transaction.transaction_id);
667
- })
668
- .addCase(addDeclinedChargeCardTransactionFromPusher, (draft, action) => {
669
- prependTransaction(draft, action.payload.cardId, action.payload.transaction.transaction_id);
670
- });
671
- },
672
635
  });
673
636
  export const { fetchChargeCardDetailPage, fetchChargeCardDetail, updateChargeCardDetailFetchState, fetchChargeCardTransactionList, updateChargeCardDetailUIState, updateChargeCardTransactionList, updateChargeCardTransactionUploadReceiptsFetchStatus, fetchChargeCardTransactionAttachments, updateChargeCardTransactionIsViewReceiptClicked, updateChargeCardTransactionAttachmentsFailure, updatePhysicalChargeCardAttemptSuccessOrFailure, updatePhysicalChargeCardAttempt, updateDebitCardPinAttempt, updateDebitCardPinAttemptSuccessOrFailure, updateChargeCardTransactionReceiptsShowTickFetchStatus, updateChargeCardTransactionAttachmentsInCardDetail, updateChargeCardTransactionListFailure, updateChargeCardDetail, startCVVActivationWait, completeCVVActivationWait, startDebitCardSetPinWait, completeDebitCardSetPinWait, updateChargeCardDetailUpdateStatus, updateChargeCardSpendLimit, updateChargeCardSpendLimitSuccessOrFailure, updateChargeCardName, updateChargeCardNameSuccessOrFailure, lockChargeCard, lockChargeCardSuccessOrFailure, unlockChargeCard, unlockChargeCardSuccessOrFailure, closeChargeCard, closeChargeCardSuccessOrFailure, fetchDepositAccountLimit, updateDepositAccountLimitFetchStatus, fetchChargeCardTransactionStatistics, updateChargeCardTransactionStatistics, updateChargeCardTransactionStatisticsFetchState, fetchChargeCardsRecurringExpenses, updateChargeCardsRecurringExpenses, updateChargeCardsRecurringExpensesFetchState, sendOtpCardHolder, resendOtpCardHolder, sendOtpCardHolderSuccess, sendOtpCardHolderFailure, verifyOtpCardHolder, verifyOtpCardHolderSuccess, verifyOtpCardHolderFailure, clearChargeCardDetail, } = chargeCardDetail.actions;
674
637
  export default chargeCardDetail.reducer;
@@ -13,24 +13,13 @@ export const fetchChargeCardDetailEpic = (actions$, state$, zeniAPI) => actions$
13
13
  const chargeCardAction = [];
14
14
  const state = state$.value;
15
15
  const chargeCardDetail = recordGet(state.chargeCardDetailState.detailById, chargeCardId, undefined);
16
- // Skip if a user-triggered fetch is already in-flight (not applicable
17
- // to cacheOverride/Pusher refreshes, which always proceed).
18
16
  if (cacheOverride === true ||
19
17
  chargeCardDetail == null ||
20
18
  chargeCardDetail.fetchState !== 'In-Progress') {
21
- // Silent refresh: preserve fetchState to avoid skeleton flash.
22
- // Discriminate via fetchState (not null-check) because the reducer
23
- // always creates an entry before the epic runs.
24
- const isSilentRefresh = cacheOverride === true &&
25
- chargeCardDetail != null &&
26
- chargeCardDetail.fetchState !== 'Not-Started';
27
19
  chargeCardAction.push(updateChargeCardDetailFetchState({
28
20
  chargeCardId,
29
- isRefreshingViewInBackground: isSilentRefresh,
30
- fetchState: isSilentRefresh
31
- ? chargeCardDetail.fetchState
32
- : 'In-Progress',
33
- error: isSilentRefresh ? chargeCardDetail.error : undefined,
21
+ isRefreshingViewInBackground: cacheOverride,
22
+ fetchState: 'In-Progress',
34
23
  }));
35
24
  const query = {
36
25
  is_include_card_activation_events: true,
@@ -48,8 +37,6 @@ export const fetchChargeCardDetailEpic = (actions$, state$, zeniAPI) => actions$
48
37
  }));
49
38
  }
50
39
  else {
51
- // Surface errors even on silent refresh so the user
52
- // knows data is stale (follow-up: consider toast instead).
53
40
  return of(updateChargeCardDetailFetchState({
54
41
  chargeCardId,
55
42
  fetchState: 'Error',
@@ -58,7 +45,6 @@ export const fetchChargeCardDetailEpic = (actions$, state$, zeniAPI) => actions$
58
45
  }));
59
46
  }
60
47
  }), catchError((error) => {
61
- // Surface network failures even on silent refresh.
62
48
  return of(updateChargeCardDetailFetchState({
63
49
  chargeCardId,
64
50
  fetchState: 'Error',
@@ -15,16 +15,15 @@ export const fetchChargeCardDetailPageEpic = (actions$, state$) => actions$.pipe
15
15
  ? exsitingChargeCardDetail.transactionList.uiState.pageTokenType
16
16
  : null;
17
17
  if (cacheOverride === true) {
18
- // Forward cacheOverride to all sub-fetches to prevent skeleton flash.
19
18
  chargeCardTransactionListAction.push(fetchChargeCardDetail(chargeCardId, cacheOverride));
20
19
  //latest transactions need to be fetched hence removing pageToken and pageTokenType
21
- chargeCardTransactionListAction.push(fetchChargeCardTransactionList(chargeCardId, null, null, true));
22
- chargeCardTransactionListAction.push(fetchChargeCardConfig(true));
20
+ chargeCardTransactionListAction.push(fetchChargeCardTransactionList(chargeCardId, null, null));
21
+ chargeCardTransactionListAction.push(fetchChargeCardConfig());
23
22
  if (doFetchCreditAccounts && isCreditCardEnabled) {
24
- chargeCardTransactionListAction.push(fetchCreditAccount(true));
23
+ chargeCardTransactionListAction.push(fetchCreditAccount());
25
24
  }
26
25
  if (doFetchCreditAccounts && isCreditCardEnabled) {
27
- chargeCardTransactionListAction.push(fetchCreditAccountRepayment(true));
26
+ chargeCardTransactionListAction.push(fetchCreditAccountRepayment());
28
27
  }
29
28
  }
30
29
  else {
@@ -1,6 +1,5 @@
1
1
  import { createSlice } from '@reduxjs/toolkit';
2
2
  import { toAmount } from '../../../../commonStateTypes/amount';
3
- import { createCacheOverrideFetchReducer } from '../../../../commonStateTypes/cacheOverrideFetchReducer';
4
3
  import { date } from '../../../../zeniDayJS';
5
4
  import { initialCreditAcc, initialCreditAccountRepayment, initialDebitCardSummaries, initialResendRevokeCardInvite, toCreditAccountStatusType, } from './chargeCardList';
6
5
  export const initialState = {
@@ -44,10 +43,6 @@ export const initialState = {
44
43
  revokeCardInvite: initialResendRevokeCardInvite,
45
44
  creditAccountRepayment: initialCreditAccountRepayment,
46
45
  };
47
- // Silent-Pusher-refresh contract: when cacheOverride=true, fetch reducers
48
- // leave fetchState and error unchanged so the list page's reduceFetchState
49
- // selector stays 'Completed' and doesn't flash ChargeCardListLoading.
50
- // See createCacheOverrideFetchReducer for details.
51
46
  const chargeCardList = createSlice({
52
47
  name: 'chargeCardList',
53
48
  initialState,
@@ -67,10 +62,10 @@ const chargeCardList = createSlice({
67
62
  };
68
63
  },
69
64
  },
70
- fetchCreditAccountRepayment: createCacheOverrideFetchReducer((draft) => {
65
+ fetchCreditAccountRepayment(draft) {
71
66
  draft.creditAccountRepayment.fetchState = 'In-Progress';
72
67
  draft.creditAccountRepayment.error = undefined;
73
- }),
68
+ },
74
69
  updateCreditAccountRepaymentAmountAndDate(draft, action) {
75
70
  draft.creditAccountRepayment.initiatedRepayments = action.payload.amount;
76
71
  draft.creditAccountRepayment.initiatedRepaymentDate = action.payload.date;
@@ -88,10 +83,10 @@ const chargeCardList = createSlice({
88
83
  updateRowActionCardId(draft, action) {
89
84
  draft.rowActionCardId = action.payload;
90
85
  },
91
- fetchCreditAccount: createCacheOverrideFetchReducer((draft) => {
86
+ fetchCreditAccount(draft) {
92
87
  draft.creditAccount.fetchState = 'In-Progress';
93
88
  draft.creditAccount.error = undefined;
94
- }),
89
+ },
95
90
  updateCreditAccount(draft, action) {
96
91
  if (action.payload.length > 0) {
97
92
  draft.creditAccount = toCreditAccount(action.payload[0]);
@@ -104,10 +99,10 @@ const chargeCardList = createSlice({
104
99
  error: action.payload,
105
100
  };
106
101
  },
107
- fetchDebitCardSummary: createCacheOverrideFetchReducer((draft) => {
102
+ fetchDebitCardSummary(draft) {
108
103
  draft.debitCardSummaries.fetchState = 'In-Progress';
109
104
  draft.debitCardSummaries.error = undefined;
110
- }),
105
+ },
111
106
  updateDebitCardSummary(draft, action) {
112
107
  draft.debitCardSummaries = toDebitCardSummaries(action.payload);
113
108
  },
@@ -118,10 +113,10 @@ const chargeCardList = createSlice({
118
113
  error: action.payload,
119
114
  };
120
115
  },
121
- fetchChargeCardList: createCacheOverrideFetchReducer((draft) => {
116
+ fetchChargeCardList(draft) {
122
117
  draft.fetchState = 'In-Progress';
123
118
  draft.error = undefined;
124
- }),
119
+ },
125
120
  updateChargeCardList(draft, action) {
126
121
  const { cards, unassigned_credit } = action.payload.chargeCardListPayload;
127
122
  const newCard = cards.map((card) => card.card_id);
@@ -157,18 +152,6 @@ const chargeCardList = createSlice({
157
152
  draft.uiState.scrollYOffset = action.payload.uiState.scrollYOffset;
158
153
  }
159
154
  },
160
- updateCreditAccountBalanceFromPusher(draft, action) {
161
- const { currencyCode, currencySymbol } = action.payload;
162
- const amt = (v) => v !== undefined ? toAmount(v, currencyCode, currencySymbol) : undefined;
163
- draft.creditAccount.available =
164
- amt(action.payload.available) ?? draft.creditAccount.available;
165
- draft.creditAccount.balance =
166
- amt(action.payload.balance) ?? draft.creditAccount.balance;
167
- draft.creditAccount.hold =
168
- amt(action.payload.hold) ?? draft.creditAccount.hold;
169
- draft.creditAccount.cashback =
170
- amt(action.payload.cashback) ?? draft.creditAccount.cashback;
171
- },
172
155
  clearChargeCardList(draft) {
173
156
  Object.assign(draft, initialState);
174
157
  },
@@ -324,7 +307,7 @@ const chargeCardList = createSlice({
324
307
  },
325
308
  },
326
309
  });
327
- export const { fetchChargeCardListPage, fetchCreditAccountRepayment, updateCreditAccountRepayment, updateCreditAccountRepaymentFailure, updateCreditAccountRepaymentAmountAndDate, updateRowActionCardId, fetchCreditAccount, updateCreditAccount, updateCreditAccountFailure, fetchDebitCardSummary, updateDebitCardSummary, updateDebitCardSummaryFailure, fetchChargeCardList, updateChargeCardList, updateChargeCardListFailure, updateSearchText, updateBulkActionCardIds, updateChargeCardListUIState, updateCreditAccountBalanceFromPusher, clearChargeCardList, resendCardInvite, resendCardInviteSuccess, resendCardInviteFailure, revokeCardInvite, revokeCardInviteSuccess, revokeCardInviteFailure, updateChargeCardsSpendLimit, updateChargeCardsSpendLimitSuccessOrFailure, lockChargeCards, lockChargeCardsSuccessOrFailure, unlockChargeCards, unlockChargeCardsSuccessOrFailure, closeChargeCards, closeChargeCardsSuccessOrFailure, revokeChargeCardsInvite, revokeChargeCardsInviteSuccessOrFailure, } = chargeCardList.actions;
310
+ export const { fetchChargeCardListPage, fetchCreditAccountRepayment, updateCreditAccountRepayment, updateCreditAccountRepaymentFailure, updateCreditAccountRepaymentAmountAndDate, updateRowActionCardId, fetchCreditAccount, updateCreditAccount, updateCreditAccountFailure, fetchDebitCardSummary, updateDebitCardSummary, updateDebitCardSummaryFailure, fetchChargeCardList, updateChargeCardList, updateChargeCardListFailure, updateSearchText, updateBulkActionCardIds, updateChargeCardListUIState, clearChargeCardList, resendCardInvite, resendCardInviteSuccess, resendCardInviteFailure, revokeCardInvite, revokeCardInviteSuccess, revokeCardInviteFailure, updateChargeCardsSpendLimit, updateChargeCardsSpendLimitSuccessOrFailure, lockChargeCards, lockChargeCardsSuccessOrFailure, unlockChargeCards, unlockChargeCardsSuccessOrFailure, closeChargeCards, closeChargeCardsSuccessOrFailure, revokeChargeCardsInvite, revokeChargeCardsInviteSuccessOrFailure, } = chargeCardList.actions;
328
311
  export default chargeCardList.reducer;
329
312
  // helper
330
313
  const toCreditAccount = (payload) => ({
@@ -14,21 +14,18 @@ export const fetchChargeCardListPageEpic = (actions$, state$) => actions$.pipe(f
14
14
  const state = state$.value;
15
15
  const cashbackDetailState = state.cashbackDetailState;
16
16
  if (cacheOverride === true) {
17
- // Forward cacheOverride to all sub-fetches to prevent skeleton flash.
18
17
  if (doFetchCreditAccountsDebitSummaryAndCashback === true) {
19
18
  if (isCreditCardEnabled) {
20
- chargeCardListPageAction.push(fetchCreditAccount(true));
21
- chargeCardListPageAction.push(fetchCreditAccountRepayment(true));
19
+ chargeCardListPageAction.push(fetchCreditAccount());
20
+ chargeCardListPageAction.push(fetchCreditAccountRepayment());
22
21
  }
23
22
  if (isDebitCardEnabled) {
24
- chargeCardListPageAction.push(fetchDebitCardSummary(true));
23
+ chargeCardListPageAction.push(fetchDebitCardSummary());
25
24
  }
26
- chargeCardListPageAction.push(fetchCashbackDetail(true));
25
+ chargeCardListPageAction.push(fetchCashbackDetail());
27
26
  }
28
- chargeCardListPageAction.push(fetchChargeCardList(true));
29
- // Config participates in the list page's reduceFetchState — needs cacheOverride.
30
- chargeCardListPageAction.push(fetchChargeCardConfig(true));
31
- // These don't participate in the list page's reduceFetchState.
27
+ chargeCardListPageAction.push(fetchChargeCardList());
28
+ chargeCardListPageAction.push(fetchChargeCardConfig());
32
29
  chargeCardListPageAction.push(fetchUserListByType('cardHolderCandidate', true));
33
30
  chargeCardListPageAction.push(fetchUserListByType('cardAdmin', true));
34
31
  chargeCardListPageAction.push(fetchClassList());
@@ -1,5 +1,4 @@
1
1
  import { createSlice } from '@reduxjs/toolkit';
2
- import { createCacheOverrideFetchReducer } from '../../../../commonStateTypes/cacheOverrideFetchReducer';
3
2
  import { initialChargeCardPaymentHistoryState, } from './chargeCardPaymentHistory';
4
3
  export const initialState = initialChargeCardPaymentHistoryState;
5
4
  const chargeCardPaymentHistory = createSlice({
@@ -18,10 +17,10 @@ const chargeCardPaymentHistory = createSlice({
18
17
  };
19
18
  },
20
19
  },
21
- fetchChargeCardPaymentHistory: createCacheOverrideFetchReducer((draft) => {
20
+ fetchChargeCardPaymentHistory(draft) {
22
21
  draft.fetchState = 'In-Progress';
23
22
  draft.error = undefined;
24
- }),
23
+ },
25
24
  updateChargeCardPaymentHistory(draft, action) {
26
25
  const payload = action.payload;
27
26
  draft.creditAccountId = payload.credit_account_id;
@@ -8,7 +8,7 @@ export const fetchChargeCardPaymentPageEpic = (actions$, state$) => actions$.pip
8
8
  const state = state$.value;
9
9
  const chargeCardPaymentHistoryState = state.chargeCardPaymentHistoryState;
10
10
  if (cacheOverride === true) {
11
- chargeCardPaymentPageActions.push(fetchChargeCardPaymentHistory(true));
11
+ chargeCardPaymentPageActions.push(fetchChargeCardPaymentHistory());
12
12
  }
13
13
  else {
14
14
  if (chargeCardPaymentHistoryState.fetchState !== 'Completed' &&
@@ -1,5 +1,4 @@
1
1
  import { createSlice } from '@reduxjs/toolkit';
2
- import { createCacheOverrideFetchReducer } from '../../../../commonStateTypes/cacheOverrideFetchReducer';
3
2
  export const initialState = {
4
3
  localData: {
5
4
  amount: {
@@ -18,12 +17,9 @@ const chargeCardRepaymentDetail = createSlice({
18
17
  name: 'chargeCardRepaymentDetail',
19
18
  initialState,
20
19
  reducers: {
21
- // No-op reducer — fetchState is managed by the Pay flow reducers.
22
- // Uses createCacheOverrideFetchReducer for API consistency with the
23
- // silent-refresh family (cacheOverride flag at dispatch site).
24
- fetchChargeCardRepaymentDetail: createCacheOverrideFetchReducer(() => {
25
- // do nothing
26
- }),
20
+ fetchChargeCardRepaymentDetail() {
21
+ //do nothing
22
+ },
27
23
  updateChargeCardRepaymentLocalStore(draft, action) {
28
24
  draft.localData = action.payload;
29
25
  },
@@ -1,5 +1,5 @@
1
1
  import { of } from 'rxjs';
2
- import { catchError, filter, mergeMap, switchMap } from 'rxjs/operators';
2
+ import { catchError, filter, switchMap, mergeMap } from 'rxjs/operators';
3
3
  import { createZeniAPIStatus, isSuccessResponse, } from '../../../../responsePayload';
4
4
  import { mapCannedResponsePayloadToCannedResponse, } from '../cannedResponsesPayload';
5
5
  import { fetchCannedResponses, updateCannedResponses, updateCannedResponsesFetchStatus, } from '../cannedResponsesReducer';
@@ -1,5 +1,5 @@
1
1
  import { of } from 'rxjs';
2
- import { catchError, filter, mergeMap, switchMap } from 'rxjs/operators';
2
+ import { catchError, filter, switchMap, mergeMap } from 'rxjs/operators';
3
3
  import { createZeniAPIStatus, isSuccessResponse, } from '../../../../responsePayload';
4
4
  import { fetchCannedResponses, saveCannedResponse, saveCannedResponseFailure, saveCannedResponseSuccess, } from '../cannedResponsesReducer';
5
5
  export const saveCannedResponseEpic = (actions$, _state$, zeniAPI) => actions$.pipe(filter(saveCannedResponse.match), switchMap((action) => {
@@ -4,7 +4,7 @@ import { openSnackbar } from '../../../../entity/snackbar/snackbarReducer';
4
4
  import { updateTasks } from '../../../../entity/task/taskReducer';
5
5
  import { createZeniAPIStatus, isSuccessResponse, } from '../../../../responsePayload';
6
6
  import { fetchTaskList, removeTaskFromList, } from '../../taskListView/taskListReducer';
7
- import { snoozeTaskSuccessOrFailure, unsnoozeTask } from '../taskDetailReducer';
7
+ import { snoozeTaskSuccessOrFailure, unsnoozeTask, } from '../taskDetailReducer';
8
8
  export const unsnoozeTaskEpic = (actions$, _state$, zeniAPI) => actions$.pipe(filter(unsnoozeTask.match), mergeMap((action) => handleUnsnoozeTask(action.payload.taskId, zeniAPI)));
9
9
  const handleUnsnoozeTask = (taskId, zeniAPI) => {
10
10
  const unsnoozeTaskApi$ = zeniAPI.deleteAndGetJSON(`${zeniAPI.apiEndPoints.taskMicroServiceBaseUrl}/1.0/task-manager/tasks/${taskId}/snooze`);
@@ -56,13 +56,7 @@ export const getTransactionDetail = (state, transactionId, fetchLinkedTransactio
56
56
  const isAccountingClassesEnabled = getIsAccountingClassesEnabled(state);
57
57
  const classList = isAccountingClassesEnabled
58
58
  ? getClassList(classState, classListState)
59
- : {
60
- classes: [],
61
- nestedClassHierarchy: [],
62
- fetchState: 'Completed',
63
- error: undefined,
64
- version: 0,
65
- };
59
+ : { classes: [], nestedClassHierarchy: [], fetchState: 'Completed', error: undefined, version: 0 };
66
60
  const isAccountingProjectsEnabled = getIsAccountingProjectsEnabled(state);
67
61
  const projectList = isAccountingProjectsEnabled
68
62
  ? getProjectList(projectState, projectListState)