@zeniai/client-epic-state 5.0.74 → 5.0.76

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 (158) hide show
  1. package/lib/coreEpics.js +1 -1
  2. package/lib/entity/account/accountSelector.d.ts +1 -27
  3. package/lib/entity/account/accountSelector.js +1 -47
  4. package/lib/entity/account/accountState.d.ts +1 -6
  5. package/lib/entity/account/accountState.js +4 -11
  6. package/lib/entity/account/subAccountSelector.d.ts +1 -1
  7. package/lib/entity/aiAccountantCustomer/aiAccountantCustomerPayload.js +3 -1
  8. package/lib/entity/aiAccountantCustomer/aiAccountantCustomerReducer.js +2 -1
  9. package/lib/entity/aiAccountantCustomer/aiAccountantCustomerSelector.d.ts +1 -1
  10. package/lib/entity/chargeCard/chargeCardReducer.d.ts +2 -19
  11. package/lib/entity/chargeCard/chargeCardReducer.js +2 -35
  12. package/lib/entity/chargeCardTransaction/chargeCardTransactionReducer.d.ts +1 -14
  13. package/lib/entity/chargeCardTransaction/chargeCardTransactionReducer.js +2 -36
  14. package/lib/entity/class/classSelector.d.ts +0 -35
  15. package/lib/entity/class/classSelector.js +0 -50
  16. package/lib/entity/sectionProjectView/sectionProjectViewReducer.d.ts +1 -1
  17. package/lib/entity/sectionProjectView/sectionProjectViewSelector.js +1 -1
  18. package/lib/entity/tenant/SessionManager.js +3 -6
  19. package/lib/entity/tenant/clearAllEpic.d.ts +2 -2
  20. package/lib/entity/tenant/clearAllEpic.js +2 -2
  21. package/lib/entity/tenant/epic/saveAPIKeyConnectionEpic.js +2 -6
  22. package/lib/entity/tenant/epic/saveOAuthConnectionEpic.js +2 -6
  23. package/lib/entity/tenant/tenantReducer.js +1 -6
  24. package/lib/entity/transaction/payloadTypes/transactionLinePayload.js +1 -3
  25. package/lib/epic.d.ts +9 -9
  26. package/lib/epic.js +10 -10
  27. package/lib/esm/coreEpics.js +1 -1
  28. package/lib/esm/entity/account/accountSelector.js +1 -46
  29. package/lib/esm/entity/account/accountState.js +1 -7
  30. package/lib/esm/entity/aiAccountantCustomer/aiAccountantCustomerPayload.js +3 -1
  31. package/lib/esm/entity/aiAccountantCustomer/aiAccountantCustomerReducer.js +2 -1
  32. package/lib/esm/entity/chargeCard/chargeCardReducer.js +1 -34
  33. package/lib/esm/entity/chargeCardTransaction/chargeCardTransactionReducer.js +1 -35
  34. package/lib/esm/entity/class/classSelector.js +0 -48
  35. package/lib/esm/entity/sectionProjectView/sectionProjectViewSelector.js +1 -1
  36. package/lib/esm/entity/tenant/SessionManager.js +1 -4
  37. package/lib/esm/entity/tenant/clearAllEpic.js +2 -2
  38. package/lib/esm/entity/tenant/epic/saveAPIKeyConnectionEpic.js +2 -6
  39. package/lib/esm/entity/tenant/epic/saveOAuthConnectionEpic.js +2 -6
  40. package/lib/esm/entity/tenant/tenantReducer.js +1 -6
  41. package/lib/esm/entity/transaction/payloadTypes/transactionLinePayload.js +1 -3
  42. package/lib/esm/epic.js +10 -10
  43. package/lib/esm/index.js +16 -26
  44. package/lib/esm/reducer.js +2 -2
  45. package/lib/esm/view/aiAccountantView/epics/fetchAiAccountantCustomersEpic.js +5 -2
  46. package/lib/esm/view/aiAccountantView/epics/fetchAiAccountantJobsEpic.js +5 -2
  47. package/lib/esm/view/aiAccountantView/epics/triggerAiAccountantJobEpic.js +1 -4
  48. package/lib/esm/view/companyHealthMetricView/companyHealthMetricViewSelector.js +1 -1
  49. package/lib/esm/view/companyTaskManagerView/companyTaskManagerViewSelector.js +1 -1
  50. package/lib/esm/view/companyTaskManagerView/epics/fetchTaskManagerMetricsEpic.js +1 -1
  51. package/lib/esm/view/companyView/helpers/cockpitHelpers.js +1 -1
  52. package/lib/esm/view/companyView/selector/companyManagementViewSelector.js +1 -1
  53. package/lib/esm/view/companyView/selector/companyPortfolioViewSelector.js +1 -1
  54. package/lib/esm/view/expenseAutomationView/epics/missingReceipts/fetchBulkUploadBatchesEpic.js +2 -2
  55. package/lib/esm/view/expenseAutomationView/epics/missingReceipts/fetchCompletedTransactionsEpic.js +1 -2
  56. package/lib/esm/view/expenseAutomationView/epics/missingReceipts/restoreBulkUploadAutomatchingOnMountEpic.js +6 -8
  57. package/lib/esm/view/expenseAutomationView/epics/missingReceipts/searchTransactionsForManualMatchEpic.js +1 -7
  58. package/lib/esm/view/expenseAutomationView/epics/transactionCategorization/fetchTransactionCategorizationEpic.js +1 -11
  59. package/lib/esm/view/expenseAutomationView/reducers/missingReceiptsViewReducer.js +1 -2
  60. package/lib/esm/view/expenseAutomationView/reducers/transactionsViewReducer.js +1 -137
  61. package/lib/esm/view/expenseAutomationView/selectors/transactionCategorizationSelector.js +13 -89
  62. package/lib/esm/view/expenseAutomationView/types/missingReceiptsViewState.js +2 -0
  63. package/lib/esm/view/financeStatement/financeStatementSelector.js +1 -1
  64. package/lib/esm/view/spendManagement/chargeCards/cashbackDetail/cashbackDetailReducer.js +2 -3
  65. package/lib/esm/view/spendManagement/chargeCards/chargeCardConfig/chargeCardConfigReducer.js +2 -3
  66. package/lib/esm/view/spendManagement/chargeCards/chargeCardDetail/chargeCardDetailReducer.js +18 -55
  67. package/lib/esm/view/spendManagement/chargeCards/chargeCardDetail/fetchChargeCardDetailEpic.js +2 -16
  68. package/lib/esm/view/spendManagement/chargeCards/chargeCardDetail/fetchChargeCardDetailPageEpic.js +4 -5
  69. package/lib/esm/view/spendManagement/chargeCards/chargeCardList/chargeCardListReducer.js +9 -26
  70. package/lib/esm/view/spendManagement/chargeCards/chargeCardList/fetchChargeCardListPageEpic.js +6 -9
  71. package/lib/esm/view/spendManagement/chargeCards/chargeCardPaymentHistory/chargeCardPaymentHistoryReducer.js +2 -3
  72. package/lib/esm/view/spendManagement/chargeCards/chargeCardPaymentHistory/fetchChargeCardPaymentPageEpic.js +1 -1
  73. package/lib/esm/view/spendManagement/chargeCards/chargeCardRepaymentDetail/chargeCardRepaymentDetailReducer.js +3 -7
  74. package/lib/esm/view/spendManagement/spendManagementFilterHelpers.js +2 -4
  75. package/lib/esm/view/subscriptionView/subscriptionViewSelector.js +1 -1
  76. package/lib/esm/view/taskManager/cannedResponsesView/epics/fetchCannedResponsesEpic.js +1 -1
  77. package/lib/esm/view/taskManager/cannedResponsesView/epics/saveCannedResponseEpic.js +1 -1
  78. package/lib/esm/view/taskManager/taskDetailView/epics/unsnoozeTaskEpic.js +1 -1
  79. package/lib/esm/view/taskManager/taskListView/taskListReducer.js +1 -1
  80. package/lib/esm/view/transactionDetail/transactionDetailSelector.js +1 -7
  81. package/lib/index.d.ts +19 -25
  82. package/lib/index.js +58 -81
  83. package/lib/reducer.d.ts +2 -2
  84. package/lib/reducer.js +2 -2
  85. package/lib/view/aiAccountantView/aiAccountantViewPayload.d.ts +2 -2
  86. package/lib/view/aiAccountantView/aiAccountantViewReducer.d.ts +1 -1
  87. package/lib/view/aiAccountantView/epics/fetchAiAccountantCustomersEpic.js +5 -2
  88. package/lib/view/aiAccountantView/epics/fetchAiAccountantJobsEpic.js +5 -2
  89. package/lib/view/aiAccountantView/epics/triggerAiAccountantJobEpic.js +1 -4
  90. package/lib/view/companyHealthMetricView/companyHealthMetricViewSelector.js +1 -1
  91. package/lib/view/companyTaskManagerView/companyTaskManagerViewSelector.d.ts +1 -1
  92. package/lib/view/companyTaskManagerView/companyTaskManagerViewSelector.js +1 -1
  93. package/lib/view/companyView/helpers/cockpitHelpers.js +1 -1
  94. package/lib/view/companyView/selector/companyManagementViewSelector.js +1 -1
  95. package/lib/view/companyView/selector/companyPortfolioViewSelector.js +1 -1
  96. package/lib/view/companyView/types/cockpitTypes.d.ts +1 -1
  97. package/lib/view/expenseAutomationView/epics/missingReceipts/fetchBulkUploadBatchesEpic.js +2 -2
  98. package/lib/view/expenseAutomationView/epics/missingReceipts/fetchCompletedTransactionsEpic.js +1 -2
  99. package/lib/view/expenseAutomationView/epics/missingReceipts/restoreBulkUploadAutomatchingOnMountEpic.js +6 -8
  100. package/lib/view/expenseAutomationView/epics/missingReceipts/searchTransactionsForManualMatchEpic.js +1 -7
  101. package/lib/view/expenseAutomationView/epics/transactionCategorization/fetchTransactionCategorizationEpic.d.ts +2 -2
  102. package/lib/view/expenseAutomationView/epics/transactionCategorization/fetchTransactionCategorizationEpic.js +0 -10
  103. package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.d.ts +1 -1
  104. package/lib/view/expenseAutomationView/payload/transactionCategorizationPayload.d.ts +0 -21
  105. package/lib/view/expenseAutomationView/reducers/missingReceiptsViewReducer.d.ts +1 -2
  106. package/lib/view/expenseAutomationView/reducers/missingReceiptsViewReducer.js +1 -2
  107. package/lib/view/expenseAutomationView/reducers/transactionsViewReducer.d.ts +4 -14
  108. package/lib/view/expenseAutomationView/reducers/transactionsViewReducer.js +2 -138
  109. package/lib/view/expenseAutomationView/selectorTypes/missingReceiptsSelectorTypes.d.ts +1 -2
  110. package/lib/view/expenseAutomationView/selectorTypes/transactionsViewSelectorTypes.d.ts +0 -14
  111. package/lib/view/expenseAutomationView/selectors/transactionCategorizationSelector.d.ts +1 -4
  112. package/lib/view/expenseAutomationView/selectors/transactionCategorizationSelector.js +13 -91
  113. package/lib/view/expenseAutomationView/types/missingReceiptsViewState.d.ts +2 -1
  114. package/lib/view/expenseAutomationView/types/missingReceiptsViewState.js +4 -1
  115. package/lib/view/expenseAutomationView/types/transactionsViewState.d.ts +2 -43
  116. package/lib/view/financeStatement/financeStatementSelector.js +1 -1
  117. package/lib/view/profitAndLossProjectView/profitAndLossProjectViewSelectorTypes.d.ts +1 -1
  118. package/lib/view/spendManagement/billPay/billList/billListState.d.ts +1 -1
  119. package/lib/view/spendManagement/chargeCards/cashbackDetail/cashbackDetailReducer.d.ts +1 -3
  120. package/lib/view/spendManagement/chargeCards/cashbackDetail/cashbackDetailReducer.js +2 -3
  121. package/lib/view/spendManagement/chargeCards/chargeCardConfig/chargeCardConfigReducer.d.ts +1 -3
  122. package/lib/view/spendManagement/chargeCards/chargeCardConfig/chargeCardConfigReducer.js +2 -3
  123. package/lib/view/spendManagement/chargeCards/chargeCardDetail/chargeCardDetailReducer.js +18 -55
  124. package/lib/view/spendManagement/chargeCards/chargeCardDetail/fetchChargeCardDetailEpic.js +2 -16
  125. package/lib/view/spendManagement/chargeCards/chargeCardDetail/fetchChargeCardDetailPageEpic.js +4 -5
  126. package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardListReducer.d.ts +3 -18
  127. package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardListReducer.js +10 -27
  128. package/lib/view/spendManagement/chargeCards/chargeCardList/fetchChargeCardListPageEpic.js +6 -9
  129. package/lib/view/spendManagement/chargeCards/chargeCardPaymentHistory/chargeCardPaymentHistory.d.ts +1 -1
  130. package/lib/view/spendManagement/chargeCards/chargeCardPaymentHistory/chargeCardPaymentHistoryReducer.d.ts +1 -3
  131. package/lib/view/spendManagement/chargeCards/chargeCardPaymentHistory/chargeCardPaymentHistoryReducer.js +2 -3
  132. package/lib/view/spendManagement/chargeCards/chargeCardPaymentHistory/fetchChargeCardPaymentPageEpic.js +1 -1
  133. package/lib/view/spendManagement/chargeCards/chargeCardRepaymentDetail/chargeCardRepaymentDetailReducer.d.ts +1 -3
  134. package/lib/view/spendManagement/chargeCards/chargeCardRepaymentDetail/chargeCardRepaymentDetailReducer.js +3 -7
  135. package/lib/view/spendManagement/reimbursement/remiListView/remiListState.d.ts +1 -1
  136. package/lib/view/spendManagement/spendManagementFilterHelpers.d.ts +3 -12
  137. package/lib/view/spendManagement/spendManagementFilterHelpers.js +2 -4
  138. package/lib/view/subscriptionView/subscriptionViewSelector.js +1 -1
  139. package/lib/view/taskManager/taskListView/taskList.d.ts +1 -1
  140. package/lib/view/taskManager/taskListView/taskListReducer.js +1 -1
  141. package/lib/view/transactionDetail/transactionDetailSelector.js +1 -7
  142. package/lib/view/zeniOAuthView/zeniOAuthSelector.d.ts +1 -1
  143. package/package.json +4 -9
  144. package/lib/commonStateTypes/cacheOverrideFetchReducer.d.ts +0 -17
  145. package/lib/commonStateTypes/cacheOverrideFetchReducer.js +0 -20
  146. package/lib/commonStateTypes/filterPrimitives.d.ts +0 -23
  147. package/lib/commonStateTypes/filterPrimitives.js +0 -21
  148. package/lib/commonStateTypes/pusherActions.d.ts +0 -11
  149. package/lib/commonStateTypes/pusherActions.js +0 -6
  150. package/lib/esm/commonStateTypes/cacheOverrideFetchReducer.js +0 -16
  151. package/lib/esm/commonStateTypes/filterPrimitives.js +0 -20
  152. package/lib/esm/commonStateTypes/pusherActions.js +0 -3
  153. package/lib/esm/view/expenseAutomationView/transactionFilterHelpers.js +0 -258
  154. package/lib/esm/view/expenseAutomationView/types/completedSubTab.js +0 -17
  155. package/lib/view/expenseAutomationView/transactionFilterHelpers.d.ts +0 -66
  156. package/lib/view/expenseAutomationView/transactionFilterHelpers.js +0 -262
  157. package/lib/view/expenseAutomationView/types/completedSubTab.d.ts +0 -10
  158. package/lib/view/expenseAutomationView/types/completedSubTab.js +0 -21
@@ -63,13 +63,7 @@ const getTransactionDetail = (state, transactionId, fetchLinkedTransactions = tr
63
63
  const isAccountingClassesEnabled = (0, tenantSelector_1.getIsAccountingClassesEnabled)(state);
64
64
  const classList = isAccountingClassesEnabled
65
65
  ? (0, classListSelector_1.getClassList)(classState, classListState)
66
- : {
67
- classes: [],
68
- nestedClassHierarchy: [],
69
- fetchState: 'Completed',
70
- error: undefined,
71
- version: 0,
72
- };
66
+ : { classes: [], nestedClassHierarchy: [], fetchState: 'Completed', error: undefined, version: 0 };
73
67
  const isAccountingProjectsEnabled = (0, tenantSelector_1.getIsAccountingProjectsEnabled)(state);
74
68
  const projectList = isAccountingProjectsEnabled
75
69
  ? (0, projectListSelector_1.getProjectList)(projectState, projectListState)
@@ -1,5 +1,5 @@
1
- import { FetchState } from '../../commonStateTypes/common';
2
1
  import { RootState } from '../../reducer';
2
+ import { FetchState } from '../../commonStateTypes/common';
3
3
  export declare const getZeniOAuthApproveFetchState: (state: RootState) => FetchState;
4
4
  export declare const getZeniOAuthApproveRedirectUrl: (state: RootState) => string | undefined;
5
5
  export declare const getZeniOAuthApproveError: (state: RootState) => string | null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zeniai/client-epic-state",
3
- "version": "5.0.74",
3
+ "version": "5.0.76",
4
4
  "description": "Shared module between Web & Mobile containing required abstractions for state management, async network communication. ",
5
5
  "main": "lib/index.js",
6
6
  "module": "lib/esm/index.js",
@@ -106,17 +106,12 @@
106
106
  "scripts": {
107
107
  "clean": "rimraf lib",
108
108
  "test:typecheck": "echo 'Typechecking test files...' && NODE_OPTIONS=--max-old-space-size=4096 time tsc -p tsconfig.typecheck.json",
109
- "test:typecheck-modified-files": "chmod +x ./scripts/tsc-modified-files.sh && ./scripts/tsc-modified-files.sh master tsconfig.typecheck.json",
110
- "test": "pnpm lint-modified-files && pnpm test:typecheck-modified-files && vitest run --typecheck",
111
- "lint": "eslint . --ext .js,.jsx,.ts,.tsx --max-warnings 0 --fix",
112
- "lint-modified-files": "chmod +x ./scripts/lint-modified-files.sh && ./scripts/lint-modified-files.sh",
113
- "lint:fix-modified-files": "chmod +x ./scripts/lint-modified-files.sh && LINT_FIX=true ./scripts/lint-modified-files.sh",
114
- "tsc-modified-files": "chmod +x ./scripts/tsc-modified-files.sh && ./scripts/tsc-modified-files.sh",
115
- "typecheck": "tsc --noEmit",
109
+ "test": "pnpm test:typecheck && vitest run --typecheck",
110
+ "lint": "eslint . --ext .js,.jsx,.ts,.tsx --fix",
116
111
  "find-dead-code": "ts-prune | grep -v '(used in module)'",
117
112
  "find-unused-exports": "ts-unused-exports ./tsconfig.json",
118
113
  "circular-dependency": "npx madge --circular --extensions ts ./src",
119
- "build": "concurrently --kill-others-on-fail --handle-input \"echo 'TypeScript build in progress...' && time tsc && echo 'ESM build...' && tsc -p tsconfig.esm.json\" \"echo 'Running tests and typecheck (incl. lint-modified-files)...' && pnpm test\" && rimraf \"lib/**/__mocks__\" \"lib/**/__testHelpers__\"",
114
+ "build": "concurrently --kill-others-on-fail --handle-input \"echo 'Running ESLint...' && eslint . --ext .js,.jsx,.ts,.tsx\" \"echo 'TypeScript build in progress...' && time tsc && echo 'ESM build...' && tsc -p tsconfig.esm.json\" \"echo 'Running tests and typecheck...' && pnpm test\" && rimraf \"lib/**/__mocks__\" \"lib/**/__testHelpers__\"",
120
115
  "only-build": "eslint . --ext .js,.jsx,.ts,.tsx && time tsc && tsc -p tsconfig.esm.json && rimraf \"lib/**/__mocks__\" \"lib/**/__testHelpers__\"",
121
116
  "only-build-dev": "eslint . --ext .js,.jsx,.ts,.tsx && time tsc -p tsconfig.dev.json && tsc -p tsconfig.esm.dev.json && rimraf \"lib/**/__mocks__\" \"lib/**/__testHelpers__\"",
122
117
  "format": "prettier --write --ignore-unknown \"src/**/*\" && pnpm lint",
@@ -1,17 +0,0 @@
1
- import { Draft, PayloadAction } from '@reduxjs/toolkit';
2
- /**
3
- * Factory for `fetchXxx` reducers that support Pusher-driven silent refresh.
4
- * When `cacheOverride=true`, fetchState and error are left untouched so the
5
- * UI doesn't flash a skeleton. When `false`, `applyTo` runs the normal
6
- * 'In-Progress' transition.
7
- */
8
- export declare const createCacheOverrideFetchReducer: <TState>(applyTo: (draft: Draft<TState>) => void) => {
9
- prepare: (cacheOverride?: boolean) => {
10
- payload: {
11
- cacheOverride: boolean;
12
- };
13
- };
14
- reducer: (draft: Draft<TState>, action: PayloadAction<{
15
- cacheOverride: boolean;
16
- }>) => void;
17
- };
@@ -1,20 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createCacheOverrideFetchReducer = void 0;
4
- /**
5
- * Factory for `fetchXxx` reducers that support Pusher-driven silent refresh.
6
- * When `cacheOverride=true`, fetchState and error are left untouched so the
7
- * UI doesn't flash a skeleton. When `false`, `applyTo` runs the normal
8
- * 'In-Progress' transition.
9
- */
10
- const createCacheOverrideFetchReducer = (applyTo) => ({
11
- reducer(draft, action) {
12
- if (action.payload.cacheOverride !== true) {
13
- applyTo(draft);
14
- }
15
- },
16
- prepare(cacheOverride = false) {
17
- return { payload: { cacheOverride } };
18
- },
19
- });
20
- exports.createCacheOverrideFetchReducer = createCacheOverrideFetchReducer;
@@ -1,23 +0,0 @@
1
- /**
2
- * Shared filter primitives — used by both Transaction Categorization and
3
- * Spend Management filter pipelines.
4
- *
5
- * These types are deliberately decoupled from any specific feature group:
6
- *
7
- * - `CategoryCombinationOperator` is how a `categories[]` array combines
8
- * (`AND` ⇒ every category must match; `OR` ⇒ any category matches).
9
- * - `FilterCategoryType` is the input-type tag a filter category uses to
10
- * pick its value-picker UI (text autocomplete, user picker, date range,
11
- * number range, plain dropdown).
12
- *
13
- * They used to be redeclared locally in both `transactionFilterHelpers.ts`
14
- * and `spendManagementFilterHelpers.ts` to keep the feature groups
15
- * independent. Centralising them here is consistent with Route B (which
16
- * separated the *matching pipelines*, not the *shared primitive types*) and
17
- * removes the maintenance trap of two identical type definitions drifting
18
- * apart over time.
19
- */
20
- /** How `categories[]` combines: AND requires every category to match, OR requires any. */
21
- export type CategoryCombinationOperator = 'AND' | 'OR';
22
- /** Input-type tag a filter category uses to pick its value-picker UI. */
23
- export type FilterCategoryType = 'searchAutocomplete' | 'user' | 'dateRange' | 'numberRange' | 'dropdown';
@@ -1,21 +0,0 @@
1
- "use strict";
2
- /**
3
- * Shared filter primitives — used by both Transaction Categorization and
4
- * Spend Management filter pipelines.
5
- *
6
- * These types are deliberately decoupled from any specific feature group:
7
- *
8
- * - `CategoryCombinationOperator` is how a `categories[]` array combines
9
- * (`AND` ⇒ every category must match; `OR` ⇒ any category matches).
10
- * - `FilterCategoryType` is the input-type tag a filter category uses to
11
- * pick its value-picker UI (text autocomplete, user picker, date range,
12
- * number range, plain dropdown).
13
- *
14
- * They used to be redeclared locally in both `transactionFilterHelpers.ts`
15
- * and `spendManagementFilterHelpers.ts` to keep the feature groups
16
- * independent. Centralising them here is consistent with Route B (which
17
- * separated the *matching pipelines*, not the *shared primitive types*) and
18
- * removes the maintenance trap of two identical type definitions drifting
19
- * apart over time.
20
- */
21
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,11 +0,0 @@
1
- import { ChargeCardTransactionPayload } from '../entity/chargeCardTransaction/chargeCardTransactionPayload';
2
- import { ID } from './common';
3
- export declare const addChargeCardTransactionFromPusher: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
4
- cardId: ID;
5
- transaction: ChargeCardTransactionPayload;
6
- }, string>;
7
- export declare const addDeclinedChargeCardTransactionFromPusher: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
8
- cardId: ID;
9
- transaction: ChargeCardTransactionPayload;
10
- declineReason?: string;
11
- }, string>;
@@ -1,6 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.addDeclinedChargeCardTransactionFromPusher = exports.addChargeCardTransactionFromPusher = void 0;
4
- const toolkit_1 = require("@reduxjs/toolkit");
5
- exports.addChargeCardTransactionFromPusher = (0, toolkit_1.createAction)('chargeCardDetail/addChargeCardTransactionFromPusher');
6
- exports.addDeclinedChargeCardTransactionFromPusher = (0, toolkit_1.createAction)('chargeCardDetail/addDeclinedChargeCardTransactionFromPusher');
@@ -1,16 +0,0 @@
1
- /**
2
- * Factory for `fetchXxx` reducers that support Pusher-driven silent refresh.
3
- * When `cacheOverride=true`, fetchState and error are left untouched so the
4
- * UI doesn't flash a skeleton. When `false`, `applyTo` runs the normal
5
- * 'In-Progress' transition.
6
- */
7
- export const createCacheOverrideFetchReducer = (applyTo) => ({
8
- reducer(draft, action) {
9
- if (action.payload.cacheOverride !== true) {
10
- applyTo(draft);
11
- }
12
- },
13
- prepare(cacheOverride = false) {
14
- return { payload: { cacheOverride } };
15
- },
16
- });
@@ -1,20 +0,0 @@
1
- /**
2
- * Shared filter primitives — used by both Transaction Categorization and
3
- * Spend Management filter pipelines.
4
- *
5
- * These types are deliberately decoupled from any specific feature group:
6
- *
7
- * - `CategoryCombinationOperator` is how a `categories[]` array combines
8
- * (`AND` ⇒ every category must match; `OR` ⇒ any category matches).
9
- * - `FilterCategoryType` is the input-type tag a filter category uses to
10
- * pick its value-picker UI (text autocomplete, user picker, date range,
11
- * number range, plain dropdown).
12
- *
13
- * They used to be redeclared locally in both `transactionFilterHelpers.ts`
14
- * and `spendManagementFilterHelpers.ts` to keep the feature groups
15
- * independent. Centralising them here is consistent with Route B (which
16
- * separated the *matching pipelines*, not the *shared primitive types*) and
17
- * removes the maintenance trap of two identical type definitions drifting
18
- * apart over time.
19
- */
20
- export {};
@@ -1,3 +0,0 @@
1
- import { createAction } from '@reduxjs/toolkit';
2
- export const addChargeCardTransactionFromPusher = createAction('chargeCardDetail/addChargeCardTransactionFromPusher');
3
- export const addDeclinedChargeCardTransactionFromPusher = createAction('chargeCardDetail/addDeclinedChargeCardTransactionFromPusher');
@@ -1,258 +0,0 @@
1
- /**
2
- * Narrowing type-guard for "has a non-empty string here". Used in place of
3
- * raw `if (foo)` truthiness checks on `string | null | undefined` values so
4
- * the `@typescript-eslint/strict-boolean-expressions` lint stays clean —
5
- * empty strings should explicitly fall through to the next candidate
6
- * (vendorName → customerName → localData.vendor.name → ...) rather than
7
- * being implicitly coerced to falsy.
8
- */
9
- const isNonEmptyString = (s) => s != null && s !== '';
10
- /**
11
- * First line item in UI order. `lineItemById` is a Record whose iteration
12
- * order is not guaranteed to match what the user sees; `sortedLineItems`
13
- * is the canonical ordering used by the categorization list/detail views.
14
- */
15
- const getFirstLineItemFromReviewLocalData = (localData) => {
16
- const { sortedLineItems, lineItemById } = localData;
17
- if (sortedLineItems.length > 0) {
18
- return lineItemById[sortedLineItems[0]];
19
- }
20
- const lineItems = Object.values(lineItemById);
21
- return lineItems.length > 0 ? lineItems[0] : undefined;
22
- };
23
- export const TRANSACTION_FILTER_CATEGORIES = [
24
- { value: 'payment_account_name', type: 'dropdown' },
25
- { value: 'payment_account_type', type: 'dropdown' },
26
- { value: 'payee', type: 'searchAutocomplete' },
27
- { value: 'category', type: 'dropdown' },
28
- { value: 'class', type: 'dropdown' },
29
- { value: 'amount', type: 'numberRange' },
30
- ];
31
- /**
32
- * Resolve the comparable value for a transaction against a given filter field.
33
- * Returns undefined when the transaction doesn't carry the field — callers
34
- * decide whether absence counts as a match (for 'not_equal' it does).
35
- */
36
- const getCategoryValueForTransaction = (key, transaction) => {
37
- switch (key) {
38
- case 'amount': {
39
- // Prefer transactionLocalData line items (sum). Fall back to lines on
40
- // the transaction itself. Final fallback: transaction-level amount.
41
- const localDataForAmount = transaction.transactionLocalData?.transactionReviewLocalData;
42
- if (localDataForAmount?.lineItemById) {
43
- const lineItems = Object.values(localDataForAmount.lineItemById);
44
- if (lineItems.length > 0) {
45
- return lineItems.reduce((sum, lineItem) => sum + (lineItem.amount?.amount ?? 0), 0);
46
- }
47
- }
48
- if (transaction.transaction.lines &&
49
- transaction.transaction.lines.length > 0) {
50
- return transaction.transaction.lines.reduce((sum, line) => sum + (line.amount?.amount ?? 0), 0);
51
- }
52
- return transaction.amount.amount;
53
- }
54
- case 'payee': {
55
- if (isNonEmptyString(transaction.vendorName)) {
56
- return transaction.vendorName;
57
- }
58
- if (isNonEmptyString(transaction.customerName)) {
59
- return transaction.customerName;
60
- }
61
- const localData = transaction.transactionLocalData?.transactionReviewLocalData;
62
- const vendorName = localData?.vendor?.name;
63
- if (isNonEmptyString(vendorName)) {
64
- return vendorName;
65
- }
66
- const customerName = localData?.customer?.name;
67
- if (isNonEmptyString(customerName)) {
68
- return customerName;
69
- }
70
- return undefined;
71
- }
72
- case 'payment_account_name': {
73
- // Match what TransactionCategorizationListRow renders for the cell.
74
- return transaction.transaction.account?.accountName;
75
- }
76
- case 'payment_account_type': {
77
- // Raw `paymentType` enum ("credit_card" / "check" / "cash"). Dropdown
78
- // option values use the same enum; row uses `paymentTypeName` for the
79
- // human label.
80
- return transaction.transaction.paymentType;
81
- }
82
- case 'category': {
83
- const localDataForCategory = transaction.transactionLocalData?.transactionReviewLocalData;
84
- if (localDataForCategory != null) {
85
- const firstLineItem = getFirstLineItemFromReviewLocalData(localDataForCategory);
86
- const accountId = firstLineItem?.account?.accountId;
87
- if (isNonEmptyString(accountId)) {
88
- return accountId;
89
- }
90
- const qboId = firstLineItem?.account?.qboId;
91
- if (isNonEmptyString(qboId)) {
92
- return qboId;
93
- }
94
- const accountName = firstLineItem?.account?.accountName;
95
- if (isNonEmptyString(accountName)) {
96
- return accountName;
97
- }
98
- }
99
- const firstLineForCategory = transaction.transaction.lines?.[0];
100
- if (firstLineForCategory?.type ===
101
- 'transaction_with_account_and_class_line' ||
102
- firstLineForCategory?.type ===
103
- 'transaction_with_product_or_service_line' ||
104
- firstLineForCategory?.type === 'journal_entry_transaction_line') {
105
- const account = firstLineForCategory.account;
106
- return account?.accountId ?? account?.qboId ?? account?.accountName;
107
- }
108
- return undefined;
109
- }
110
- case 'class': {
111
- const localDataForClass = transaction.transactionLocalData?.transactionReviewLocalData;
112
- if (localDataForClass != null) {
113
- const firstLineItemForClass = getFirstLineItemFromReviewLocalData(localDataForClass);
114
- const classId = firstLineItemForClass?.class?.classId;
115
- if (isNonEmptyString(classId)) {
116
- return classId;
117
- }
118
- const qboId = firstLineItemForClass?.class?.qboId;
119
- if (isNonEmptyString(qboId)) {
120
- return qboId;
121
- }
122
- const className = firstLineItemForClass?.class?.className;
123
- if (isNonEmptyString(className)) {
124
- return className;
125
- }
126
- }
127
- const firstLineForClass = transaction.transaction.lines?.[0];
128
- if (firstLineForClass?.type === 'transaction_with_account_and_class_line' ||
129
- firstLineForClass?.type ===
130
- 'transaction_with_product_or_service_line' ||
131
- firstLineForClass?.type === 'journal_entry_transaction_line') {
132
- const classData = firstLineForClass.class;
133
- return classData?.classId ?? classData?.qboId ?? classData?.className;
134
- }
135
- return undefined;
136
- }
137
- default:
138
- return undefined;
139
- }
140
- };
141
- /**
142
- * TC-only amount matcher. Supports all five operators TC defines, including
143
- * the legacy "1000<->5000" range-string form (kept for backward compatibility
144
- * with persisted filter state that may still contain that encoding).
145
- *
146
- * The `'equal' | 'not_equal'` branch matches if `amount` equals ANY of the
147
- * configured values (consistent with how non-amount filters interpret a
148
- * multi-value `values` array). `.some()` over the values array also makes
149
- * the empty-values case behave correctly — empty array → `matched = false`
150
- * — though in practice `applyTransactionFilters` strips empty-values
151
- * categories before they reach this matcher. The trailing
152
- * `op === 'not_equal' ? !matched : matched` line inverts for `not_equal`.
153
- */
154
- const matchAmount = (amount, category) => {
155
- const op = category.matchingOperator;
156
- const values = category.values;
157
- let matched = false;
158
- if (op === 'in_between') {
159
- if (values.length >= 2) {
160
- const min = Number(values[0]);
161
- const max = Number(values[1]);
162
- matched = amount >= min && amount <= max;
163
- }
164
- }
165
- else if (op === 'less_than') {
166
- if (values.length >= 1) {
167
- matched = amount < Number(values[0]);
168
- }
169
- }
170
- else if (op === 'greater_than') {
171
- if (values.length >= 1) {
172
- matched = amount > Number(values[0]);
173
- }
174
- }
175
- else if (op === 'equal' || op === 'not_equal') {
176
- matched = values.some((v) => {
177
- const s = String(v);
178
- // Backward compatibility: legacy "low<->high" range-string form
179
- // persisted under `matchingOperator: 'equal'`.
180
- if (s.includes('<->')) {
181
- const parts = s.split('<->');
182
- return (amount >= Number(parts[0] ?? '') && amount <= Number(parts[1] ?? ''));
183
- }
184
- return amount === Number(v);
185
- });
186
- }
187
- return op === 'not_equal' ? !matched : matched;
188
- };
189
- const transactionMatchesCategory = (transaction, category) => {
190
- const value = getCategoryValueForTransaction(category.field, transaction);
191
- if (value == null) {
192
- // Absent-value semantics — pinning these down explicitly so the
193
- // asymmetry isn't surprising:
194
- //
195
- // not_equal: a missing value IS NOT EQUAL to any candidate, so the
196
- // transaction matches the filter (passes through).
197
- // equal: a missing value is not equal to any candidate, so the
198
- // transaction does NOT match (filtered out).
199
- // less_than / greater_than: SQL-style three-valued logic — comparing
200
- // against a missing value is "unknown", which we treat as
201
- // "does not match" (filtered out). A user setting
202
- // "amount < $1000" probably wants transactions with a
203
- // concrete amount that satisfies the bound, not rows
204
- // where the amount can't be determined.
205
- // in_between: same as the single-sided comparators — missing values
206
- // are filtered out.
207
- //
208
- // Only the `not_equal` branch returns `true` here; everything else
209
- // falls through to the `false` below.
210
- return category.matchingOperator === 'not_equal';
211
- }
212
- if (category.field === 'amount') {
213
- return matchAmount(Number(value), category);
214
- }
215
- const valueStr = value.toString();
216
- const valueInList = category.values.some((v) => v.toString() === valueStr);
217
- return category.matchingOperator === 'not_equal' ? !valueInList : valueInList;
218
- };
219
- /**
220
- * TC-only equivalent of `applyAdvancedFiltersOnList`. Filters a list of
221
- * `TransactionView` items against a `TransactionFilters` object using the
222
- * AND/OR combination semantics from `categoryCombinationOperator`.
223
- *
224
- * Independent of `view/spendManagement` — keeps the TC filter pipeline cleanly
225
- * inside the Expense Automation feature group.
226
- */
227
- export const applyTransactionFilters = (transactions, filters) => {
228
- if (filters?.categories == null || filters.categories.length === 0) {
229
- return transactions;
230
- }
231
- // Mirrors the predicate used by `getTransactionAppliedFiltersCount` on the
232
- // webc side. A half-filled category — e.g. `in_between` with only the
233
- // `min` typed — would otherwise survive the filter pass and produce zero
234
- // matches because `Number("")` collapses to `0`, artificially emptying
235
- // the list while editing. Skipping such categories keeps the filtered
236
- // view stable while the user finishes typing.
237
- const activeCategories = filters.categories.filter((c) => {
238
- if (c.field == null || c.values.length === 0) {
239
- return false;
240
- }
241
- if (c.field === 'amount' && c.matchingOperator === 'in_between') {
242
- return (c.values.length >= 2 &&
243
- String(c.values[0] ?? '').trim() !== '' &&
244
- String(c.values[1] ?? '').trim() !== '');
245
- }
246
- return String(c.values[0] ?? '').trim() !== '';
247
- });
248
- if (activeCategories.length === 0) {
249
- return transactions;
250
- }
251
- const op = filters.categoryCombinationOperator;
252
- return transactions.filter((txn) => {
253
- if (op === 'AND') {
254
- return activeCategories.every((cat) => transactionMatchesCategory(txn, cat));
255
- }
256
- return activeCategories.some((cat) => transactionMatchesCategory(txn, cat));
257
- });
258
- };
@@ -1,17 +0,0 @@
1
- import { stringToUnion } from '../../../commonStateTypes/stringToUnion';
2
- /**
3
- * Sub-tabs that can appear under any "Completed" tab in the Expense Automation
4
- * surface (Transaction Categorization Completed and Missing Receipts Completed
5
- * both use this exact union). Forwarded verbatim to listing APIs as `sub_tab`
6
- * / `match_type`. `'all'` preserves parent-tab semantics on the backend.
7
- */
8
- const COMPLETED_SUB_TABS = ['all', 'ai_accountant', 'manual'];
9
- export const toCompletedSubTab = (v) => stringToUnion(v.trim().toLowerCase(), COMPLETED_SUB_TABS);
10
- /**
11
- * "No sub-tab filter" sentinel — single source of truth for the default
12
- * value of {@link CompletedSubTab}. Use this constant in initial slice
13
- * state and at any call site that needs to fall back to the parent-tab
14
- * listing semantics (review tab requests, manual-search overrides, etc.)
15
- * so a future rename of the union doesn't require chasing literals.
16
- */
17
- export const DEFAULT_COMPLETED_SUB_TAB = 'all';
@@ -1,66 +0,0 @@
1
- /**
2
- * Filter machinery for the Transaction Categorization feature inside
3
- * Expense Automation. Intentionally self-contained — does NOT import anything
4
- * from `view/spendManagement/*`, because Transaction Categorization is not a
5
- * Spend Management product. Shared primitives
6
- * (`CategoryCombinationOperator`, `FilterCategoryType`) come from
7
- * `commonStateTypes/filterPrimitives`, which both feature groups consume.
8
- */
9
- import { Amount } from '../../commonStateTypes/amount';
10
- import { ID } from '../../commonStateTypes/common';
11
- import { CategoryCombinationOperator, FilterCategoryType } from '../../commonStateTypes/filterPrimitives';
12
- import { TransactionType } from '../../entity/transaction/stateTypes/transactionType';
13
- import { SupportedTransactionWithCOT } from '../../entity/transaction/transactionState';
14
- import { ZeniDate } from '../../zeniDayJS';
15
- import { TransactionReviewLocalDataSelectorView } from './selectorTypes/transactionsViewSelectorTypes';
16
- /**
17
- * Re-exported here so the CES barrel can pull TC's primitives from the
18
- * Expense Automation surface without reaching into `commonStateTypes`
19
- * directly — keeps the barrel's existing import topology stable.
20
- */
21
- export type { CategoryCombinationOperator, FilterCategoryType };
22
- export type TransactionFilterEntityType = 'transaction_categorization' | 'customer' | 'vendor' | 'merchant';
23
- export type TransactionFilterCategoryField = 'payment_account_name' | 'payment_account_type' | 'payee' | 'category' | 'class' | 'amount';
24
- export interface TransactionFilterCategoryDropdownOption {
25
- value: TransactionFilterCategoryField;
26
- multiple?: boolean;
27
- type?: FilterCategoryType;
28
- }
29
- export declare const TRANSACTION_FILTER_CATEGORIES: TransactionFilterCategoryDropdownOption[];
30
- /** Amount filter operators for transaction_categorization. */
31
- export type TransactionFilterAmountMatchingOperator = 'equal' | 'not_equal' | 'less_than' | 'greater_than' | 'in_between';
32
- export interface TransactionFilterCategory {
33
- field: TransactionFilterCategoryField;
34
- matchingOperator: TransactionFilterAmountMatchingOperator;
35
- values: (string | number)[];
36
- valuesCombinationOperator: 'ANY';
37
- }
38
- export interface TransactionFilters {
39
- categories: TransactionFilterCategory[];
40
- categoryCombinationOperator: CategoryCombinationOperator;
41
- }
42
- export interface TransactionView {
43
- amount: Amount;
44
- createTime: ZeniDate;
45
- date: ZeniDate;
46
- description: string;
47
- id: ID;
48
- memo: string;
49
- transaction: SupportedTransactionWithCOT;
50
- type: TransactionType;
51
- customerId?: ID;
52
- customerName?: string;
53
- transactionLocalData?: TransactionReviewLocalDataSelectorView;
54
- typeName?: string;
55
- vendorId?: ID;
56
- vendorName?: string;
57
- }
58
- /**
59
- * TC-only equivalent of `applyAdvancedFiltersOnList`. Filters a list of
60
- * `TransactionView` items against a `TransactionFilters` object using the
61
- * AND/OR combination semantics from `categoryCombinationOperator`.
62
- *
63
- * Independent of `view/spendManagement` — keeps the TC filter pipeline cleanly
64
- * inside the Expense Automation feature group.
65
- */
66
- export declare const applyTransactionFilters: (transactions: TransactionView[], filters?: TransactionFilters) => TransactionView[];