@zeniai/client-epic-state 5.2.13-beta0ND → 5.2.13-betaAK1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. package/lib/epic.d.ts +1 -2
  2. package/lib/epic.js +0 -2
  3. package/lib/esm/epic.js +0 -2
  4. package/lib/esm/index.js +8 -7
  5. package/lib/esm/view/expenseAutomationView/epics/accountRecon/confirmStatementMappingEpic.js +23 -7
  6. package/lib/esm/view/expenseAutomationView/epics/accountRecon/updateCombinedStatementInfoEpic.js +1 -1
  7. package/lib/esm/view/expenseAutomationView/payload/reconciliationPayload.js +1 -1
  8. package/lib/esm/view/expenseAutomationView/reducers/reconciliationViewReducer.js +5 -0
  9. package/lib/esm/view/expenseAutomationView/selectors/reconciliationViewSelector.js +33 -2
  10. package/lib/esm/view/invoicing/editInvoicingCatalogItemDetailView/catalogDetailEditPayload.js +24 -7
  11. package/lib/esm/view/invoicing/editInvoicingCatalogItemDetailView/editInvoicingCatalogItemDetailViewPayload.js +1 -1
  12. package/lib/esm/view/invoicing/editInvoicingCatalogItemDetailView/editInvoicingCatalogItemDetailViewReducer.js +8 -1
  13. package/lib/esm/view/invoicing/editInvoicingCatalogItemDetailView/editInvoicingCatalogItemDetailViewSelector.js +42 -8
  14. package/lib/esm/view/invoicing/editInvoicingCatalogItemDetailView/invoicingCatalogSubFamilyEpics.js +8 -2
  15. package/lib/esm/view/invoicing/editInvoicingCatalogItemDetailView/saveInvoicingCatalogItemEpic.js +19 -10
  16. package/lib/esm/view/invoicing/invoicingCatalogItemDetailView/invoicingCatalogItemDetailViewSelector.js +2 -0
  17. package/lib/esm/view/invoicing/invoicingQboView/epics/fetchInvoicingAccountingPickersEpic.js +0 -1
  18. package/lib/esm/view/invoicing/invoicingQboView/invoicingQboViewSelector.js +15 -36
  19. package/lib/esm/view/recommendation/recommendationReducer.js +1 -13
  20. package/lib/index.d.ts +12 -11
  21. package/lib/index.js +33 -30
  22. package/lib/view/expenseAutomationView/epics/accountRecon/confirmStatementMappingEpic.js +23 -7
  23. package/lib/view/expenseAutomationView/epics/accountRecon/updateCombinedStatementInfoEpic.js +1 -1
  24. package/lib/view/expenseAutomationView/payload/reconciliationPayload.d.ts +8 -3
  25. package/lib/view/expenseAutomationView/payload/reconciliationPayload.js +1 -1
  26. package/lib/view/expenseAutomationView/reducers/reconciliationViewReducer.js +5 -0
  27. package/lib/view/expenseAutomationView/selectors/reconciliationViewSelector.d.ts +3 -1
  28. package/lib/view/expenseAutomationView/selectors/reconciliationViewSelector.js +34 -2
  29. package/lib/view/expenseAutomationView/types/reconciliationViewState.d.ts +6 -0
  30. package/lib/view/invoicing/editInvoicingCatalogItemDetailView/catalogDetailEditPayload.d.ts +13 -21
  31. package/lib/view/invoicing/editInvoicingCatalogItemDetailView/catalogDetailEditPayload.js +24 -7
  32. package/lib/view/invoicing/editInvoicingCatalogItemDetailView/editInvoicingCatalogItemDetailViewPayload.d.ts +7 -0
  33. package/lib/view/invoicing/editInvoicingCatalogItemDetailView/editInvoicingCatalogItemDetailViewPayload.js +4 -3
  34. package/lib/view/invoicing/editInvoicingCatalogItemDetailView/editInvoicingCatalogItemDetailViewReducer.d.ts +18 -9
  35. package/lib/view/invoicing/editInvoicingCatalogItemDetailView/editInvoicingCatalogItemDetailViewReducer.js +9 -2
  36. package/lib/view/invoicing/editInvoicingCatalogItemDetailView/editInvoicingCatalogItemDetailViewSelector.d.ts +15 -5
  37. package/lib/view/invoicing/editInvoicingCatalogItemDetailView/editInvoicingCatalogItemDetailViewSelector.js +43 -8
  38. package/lib/view/invoicing/editInvoicingCatalogItemDetailView/editInvoicingCatalogItemDetailViewState.d.ts +24 -0
  39. package/lib/view/invoicing/editInvoicingCatalogItemDetailView/invoicingCatalogSubFamilyEpics.d.ts +1 -1
  40. package/lib/view/invoicing/editInvoicingCatalogItemDetailView/invoicingCatalogSubFamilyEpics.js +8 -2
  41. package/lib/view/invoicing/editInvoicingCatalogItemDetailView/saveInvoicingCatalogItemEpic.js +18 -9
  42. package/lib/view/invoicing/invoicingCatalogItemDetailView/invoicingCatalogItemDetailViewSelector.d.ts +6 -0
  43. package/lib/view/invoicing/invoicingCatalogItemDetailView/invoicingCatalogItemDetailViewSelector.js +2 -0
  44. package/lib/view/invoicing/invoicingQboView/epics/fetchInvoicingAccountingPickersEpic.js +0 -1
  45. package/lib/view/invoicing/invoicingQboView/invoicingQboViewSelector.d.ts +12 -13
  46. package/lib/view/invoicing/invoicingQboView/invoicingQboViewSelector.js +16 -38
  47. package/lib/view/recommendation/recommendationPayload.d.ts +0 -34
  48. package/lib/view/recommendation/recommendationReducer.d.ts +1 -2
  49. package/lib/view/recommendation/recommendationReducer.js +2 -14
  50. package/package.json +71 -38
  51. package/lib/esm/view/recommendation/submitRecommendationFeedbackEpic.js +0 -52
  52. package/lib/view/recommendation/submitRecommendationFeedbackEpic.d.ts +0 -7
  53. package/lib/view/recommendation/submitRecommendationFeedbackEpic.js +0 -56
@@ -1,7 +1,7 @@
1
1
  import { NestedAccountHierarchyForReport } from '../../../commonStateTypes/accountView/nestedAccountID';
2
2
  import { NestedClassHierarchyForReport } from '../../../commonStateTypes/classesView/nestedClassID';
3
3
  import { FetchStateAndError } from '../../../commonStateTypes/common';
4
- import { AccountBase, AccountType } from '../../../entity/account/accountState';
4
+ import { AccountBase } from '../../../entity/account/accountState';
5
5
  import { ClassBase } from '../../../entity/class/classState';
6
6
  import { RootState } from '../../../rootStateTypes';
7
7
  import { InvoicingQboConnection, InvoicingQboSyncHealth } from './invoicingQboViewPayload';
@@ -16,11 +16,6 @@ export declare const isInvoicingQboConnected: (state: RootState) => boolean;
16
16
  export declare const isInvoicingAccountingPickerDataLoading: (state: RootState) => boolean;
17
17
  /** The QBO connection fetch on its own, without building the bundled view. */
18
18
  export declare const getInvoicingQboConnectionFetchState: (state: RootState) => FetchStateAndError;
19
- /**
20
- * Account types that can back invoicing revenue. Named here so screens ask for
21
- * "income accounts" rather than repeating the accounting service's vocabulary.
22
- */
23
- export declare const INVOICING_INCOME_ACCOUNT_TYPES: readonly AccountType[];
24
19
  /**
25
20
  * The account behind a picker value. The pickers submit the QuickBooks id, so
26
21
  * that is what callers hold; the payload builders need the whole entity to send
@@ -29,6 +24,17 @@ export declare const INVOICING_INCOME_ACCOUNT_TYPES: readonly AccountType[];
29
24
  export declare const invoicingQboAccountByQboId: (state: RootState, qboId: string | undefined) => AccountBase | undefined;
30
25
  /** The class behind a picker value, for the same reason as the account above. */
31
26
  export declare const invoicingQboClassByQboId: (state: RootState, qboId: string | undefined) => ClassBase | undefined;
27
+ /**
28
+ * The resolver every catalog and settings payload builder needs: a picked
29
+ * QuickBooks id turned back into the account or class record the request body
30
+ * carries. Memoized so callers get one stable object rather than a fresh pair of
31
+ * closures per store change, which in `mapStateToProps` would re-render on every
32
+ * unrelated action.
33
+ */
34
+ export declare const getInvoicingCatalogAccountingLookup: (state: RootState) => {
35
+ accountByQboId: (qboId: string) => AccountBase | undefined;
36
+ classByQboId: (qboId: string) => ClassBase | undefined;
37
+ };
32
38
  /** An account or class as the invoicing pickers render and submit it. */
33
39
  export interface InvoicingAccountingOption {
34
40
  id: string;
@@ -60,13 +66,6 @@ export interface InvoicingQboView {
60
66
  * required would post a mapping QuickBooks rejects.
61
67
  */
62
68
  export declare const invoicingAccountsForQboAccountTypes: (accounts: InvoicingAccountingOption[], accountTypes: string) => InvoicingAccountingOption[];
63
- /**
64
- * The account tree narrowed to the given account types. The tree itself carries
65
- * no account type, so the flat account list supplies that and the matching
66
- * `qboId`s are kept — which is why callers that only need "income accounts, as a
67
- * tree" do not have to hold a second flat list to filter with.
68
- */
69
- export declare const invoicingAccountHierarchyForTypes: (state: RootState, accountTypes: readonly AccountType[]) => NestedAccountHierarchyForReport[];
70
69
  /**
71
70
  * Single bundled view for the QBO integration settings screen — the
72
71
  * connection, the account and class options, sync health, and the fetch/action
@@ -1,11 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getInvoicingQboView = exports.invoicingAccountHierarchyForTypes = exports.invoicingAccountsForQboAccountTypes = exports.invoicingQboClassByQboId = exports.invoicingQboAccountByQboId = exports.INVOICING_INCOME_ACCOUNT_TYPES = exports.getInvoicingQboConnectionFetchState = exports.isInvoicingAccountingPickerDataLoading = exports.isInvoicingQboConnected = exports.INVOICING_ACCOUNT_LIST_KEY = void 0;
3
+ exports.getInvoicingQboView = exports.invoicingAccountsForQboAccountTypes = exports.getInvoicingCatalogAccountingLookup = exports.invoicingQboClassByQboId = exports.invoicingQboAccountByQboId = exports.getInvoicingQboConnectionFetchState = exports.isInvoicingAccountingPickerDataLoading = exports.isInvoicingQboConnected = exports.INVOICING_ACCOUNT_LIST_KEY = void 0;
4
+ const toolkit_1 = require("@reduxjs/toolkit");
4
5
  const accountListSelector_1 = require("../../accountList/accountListSelector");
5
6
  const classListSelector_1 = require("../../classList/classListSelector");
6
7
  // The shared bucket, fetched with the same arguments as the other consumers so
7
- // whichever screen loads first satisfies the rest. Invoicing narrows to income
8
- // accounts when it builds its options, so it does not need its own copy.
8
+ // whichever screen loads first satisfies the rest. Invoicing renders the same
9
+ // accounts they do, so it does not need its own copy.
9
10
  exports.INVOICING_ACCOUNT_LIST_KEY = 'accountList';
10
11
  /** Whether QBO is connected, without building the option lists to find out. */
11
12
  const isInvoicingQboConnected = (state) => state.invoicingQboViewState.connection?.connected === true;
@@ -35,14 +36,6 @@ exports.isInvoicingAccountingPickerDataLoading = isInvoicingAccountingPickerData
35
36
  /** The QBO connection fetch on its own, without building the bundled view. */
36
37
  const getInvoicingQboConnectionFetchState = (state) => state.invoicingQboViewState.connectionFetchState;
37
38
  exports.getInvoicingQboConnectionFetchState = getInvoicingQboConnectionFetchState;
38
- /**
39
- * Account types that can back invoicing revenue. Named here so screens ask for
40
- * "income accounts" rather than repeating the accounting service's vocabulary.
41
- */
42
- exports.INVOICING_INCOME_ACCOUNT_TYPES = [
43
- 'income',
44
- 'other_income',
45
- ];
46
39
  /**
47
40
  * The account behind a picker value. The pickers submit the QuickBooks id, so
48
41
  * that is what callers hold; the payload builders need the whole entity to send
@@ -85,6 +78,17 @@ const invoicingQboClassByQboId = (state, qboId) => {
85
78
  }
86
79
  };
87
80
  exports.invoicingQboClassByQboId = invoicingQboClassByQboId;
81
+ /**
82
+ * The resolver every catalog and settings payload builder needs: a picked
83
+ * QuickBooks id turned back into the account or class record the request body
84
+ * carries. Memoized so callers get one stable object rather than a fresh pair of
85
+ * closures per store change, which in `mapStateToProps` would re-render on every
86
+ * unrelated action.
87
+ */
88
+ exports.getInvoicingCatalogAccountingLookup = (0, toolkit_1.createSelector)((state) => state, (state) => ({
89
+ accountByQboId: (qboId) => (0, exports.invoicingQboAccountByQboId)(state, qboId),
90
+ classByQboId: (qboId) => (0, exports.invoicingQboClassByQboId)(state, qboId),
91
+ }));
88
92
  /**
89
93
  * Accounts and classes as the invoicing pickers need them. Both come from the
90
94
  * shared accounting-service lists, so whatever another screen already loaded
@@ -92,17 +96,12 @@ exports.invoicingQboClassByQboId = invoicingQboClassByQboId;
92
96
  * API stores; an account without one cannot be posted, so it is dropped rather
93
97
  * than offered.
94
98
  */
95
- const invoicingAccountingOptions = (state, accountTypes) => {
99
+ const invoicingAccountingOptions = (state) => {
96
100
  const { accounts } = (0, accountListSelector_1.getAccountList)(state.accountState, state.accountListState, exports.INVOICING_ACCOUNT_LIST_KEY);
97
101
  return accounts.flatMap((account) => {
98
102
  if (account.qboId == null || account.isDeleted === true) {
99
103
  return [];
100
104
  }
101
- if (accountTypes != null &&
102
- (account.accountType == null ||
103
- !accountTypes.includes(account.accountType))) {
104
- return [];
105
- }
106
105
  return [
107
106
  {
108
107
  id: String(account.qboId),
@@ -160,27 +159,6 @@ const invoicingAccountingClassOptions = (state) => {
160
159
  },
161
160
  ]);
162
161
  };
163
- /**
164
- * The account tree narrowed to the given account types. The tree itself carries
165
- * no account type, so the flat account list supplies that and the matching
166
- * `qboId`s are kept — which is why callers that only need "income accounts, as a
167
- * tree" do not have to hold a second flat list to filter with.
168
- */
169
- const invoicingAccountHierarchyForTypes = (state, accountTypes) => {
170
- const allowedQboIds = new Set(invoicingAccountingOptions(state, accountTypes).map((account) => account.id));
171
- const keepMatching = (nodes) => nodes.flatMap((node) => {
172
- const children = keepMatching(node.children);
173
- const isMatch = node.qboId != null && allowedQboIds.has(String(node.qboId));
174
- // A parent that is not itself a match is still kept when it holds one, so
175
- // the tree's shape survives the filter.
176
- if (!isMatch && children.length === 0) {
177
- return [];
178
- }
179
- return [{ ...node, children }];
180
- });
181
- return keepMatching((0, accountListSelector_1.getNestedAccountListHierarchy)(state.accountListState, exports.INVOICING_ACCOUNT_LIST_KEY));
182
- };
183
- exports.invoicingAccountHierarchyForTypes = invoicingAccountHierarchyForTypes;
184
162
  /**
185
163
  * Single bundled view for the QBO integration settings screen — the
186
164
  * connection, the account and class options, sync health, and the fetch/action
@@ -12,38 +12,4 @@ interface FetchRecommendationPayloadWithCOT {
12
12
  recommendations: RecommendationPayloadWithCOT[];
13
13
  }
14
14
  export type FetchRecommendationResponseWithCOT = ZeniAPIResponse<FetchRecommendationPayloadWithCOT>;
15
- export type RecommendationFeedbackDimension = 'vendor' | 'category' | 'class';
16
- export type RecommendationFeedbackSource = 'primary' | 'alternate' | 'shadow' | 'qbo';
17
- export type RecommendationFeedbackOutcome = 'accepted' | 'override_ranked' | 'override_outside' | 'retracted';
18
- export interface RecommendationFeedbackValue {
19
- name: string;
20
- id?: string | null;
21
- integrationId?: string | null;
22
- }
23
- export interface ShownRecommendationForFeedback {
24
- rank: number;
25
- source: RecommendationFeedbackSource;
26
- value: RecommendationFeedbackValue;
27
- confidence?: number | null;
28
- cot?: string[];
29
- reasoning?: string | null;
30
- }
31
- export interface SubmitRecommendationFeedbackPayload {
32
- dimension: RecommendationFeedbackDimension;
33
- outcome: RecommendationFeedbackOutcome;
34
- selected: RecommendationFeedbackValue & {
35
- isNewEntity?: boolean;
36
- };
37
- transactionId: string;
38
- features?: Record<string, unknown> | null;
39
- lineId?: string | null;
40
- matchedRank?: number | null;
41
- matchedSource?: RecommendationFeedbackSource | null;
42
- reasonText?: string | null;
43
- recommendationSetId?: string | null;
44
- retractsFeedbackId?: string | null;
45
- shownRecommendations?: ShownRecommendationForFeedback[];
46
- skipped?: boolean;
47
- topPickSource?: RecommendationFeedbackSource | null;
48
- }
49
15
  export {};
@@ -5,7 +5,6 @@ import { TransactionID } from '../../entity/transaction/stateTypes/transactionID
5
5
  import { SupportedTransaction } from '../../entity/transaction/transactionState';
6
6
  import { ZeniAPIStatus } from '../../responsePayload';
7
7
  import { TransactionsTab } from '../expenseAutomationView/types/transactionsViewState';
8
- import { SubmitRecommendationFeedbackPayload } from './recommendationPayload';
9
8
  import { EntityRecommendationState } from './recommendationState';
10
9
  export type RecommendationLineUpdateFlowType = 'categorization' | 'detail';
11
10
  type FetchEntityRecommendationsForLineUpdateCommonPayload = {
@@ -58,6 +57,6 @@ export declare const fetchEntityRecommendationsByTransactionId: import("@reduxjs
58
57
  }, "recommendation/updateRecommendationForEntityFailure">, indicateReadyToInitializeRecommendation: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[entityIdOrName: string, entityType: EntityType], {
59
58
  entityIdOrName: string;
60
59
  entityType: EntityType;
61
- }, "recommendation/indicateReadyToInitializeRecommendation", never, never>, submitRecommendationFeedback: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[args: SubmitRecommendationFeedbackPayload], SubmitRecommendationFeedbackPayload, "recommendation/submitRecommendationFeedback", never, never>;
60
+ }, "recommendation/indicateReadyToInitializeRecommendation", never, never>;
62
61
  declare const _default: import("redux").Reducer<EntityRecommendationState>;
63
62
  export default _default;
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  var _a;
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.submitRecommendationFeedback = exports.indicateReadyToInitializeRecommendation = exports.updateRecommendationForEntityFailure = exports.updateRecommendationForEntity = exports.fetchRecommendationByEntityId = exports.fetchRecommendationByEntityName = exports.fetchEntityRecommendationsForLineUpdate = exports.fetchEntityRecommendationsByTransactionId = exports.initialState = void 0;
4
+ exports.indicateReadyToInitializeRecommendation = exports.updateRecommendationForEntityFailure = exports.updateRecommendationForEntity = exports.fetchRecommendationByEntityId = exports.fetchRecommendationByEntityName = exports.fetchEntityRecommendationsForLineUpdate = exports.fetchEntityRecommendationsByTransactionId = exports.initialState = void 0;
5
5
  const toolkit_1 = require("@reduxjs/toolkit");
6
6
  const rootActions_1 = require("../../rootActions");
7
7
  const recommendationState_1 = require("./recommendationState");
@@ -135,18 +135,6 @@ const recommendation = (0, toolkit_1.createSlice)({
135
135
  };
136
136
  },
137
137
  },
138
- // Fire-and-forget human feedback on a recommendation (accept, ranked
139
- // override or outside override). Handled by submitRecommendationFeedbackEpic
140
- // which POSTs to the accounting recommendation-feedback endpoint. No state
141
- // mutation: the categorization UX must not depend on the feedback round-trip.
142
- submitRecommendationFeedback: {
143
- reducer() {
144
- // Fire-and-forget: no state mutation; the epic performs the POST.
145
- },
146
- prepare(args) {
147
- return { payload: args };
148
- },
149
- },
150
138
  },
151
139
  extraReducers: (builder) => {
152
140
  builder.addCase(rootActions_1.clearAll, (draft) => {
@@ -154,7 +142,7 @@ const recommendation = (0, toolkit_1.createSlice)({
154
142
  });
155
143
  },
156
144
  });
157
- _a = recommendation.actions, exports.fetchEntityRecommendationsByTransactionId = _a.fetchEntityRecommendationsByTransactionId, exports.fetchEntityRecommendationsForLineUpdate = _a.fetchEntityRecommendationsForLineUpdate, exports.fetchRecommendationByEntityName = _a.fetchRecommendationByEntityName, exports.fetchRecommendationByEntityId = _a.fetchRecommendationByEntityId, exports.updateRecommendationForEntity = _a.updateRecommendationForEntity, exports.updateRecommendationForEntityFailure = _a.updateRecommendationForEntityFailure, exports.indicateReadyToInitializeRecommendation = _a.indicateReadyToInitializeRecommendation, exports.submitRecommendationFeedback = _a.submitRecommendationFeedback;
145
+ _a = recommendation.actions, exports.fetchEntityRecommendationsByTransactionId = _a.fetchEntityRecommendationsByTransactionId, exports.fetchEntityRecommendationsForLineUpdate = _a.fetchEntityRecommendationsForLineUpdate, exports.fetchRecommendationByEntityName = _a.fetchRecommendationByEntityName, exports.fetchRecommendationByEntityId = _a.fetchRecommendationByEntityId, exports.updateRecommendationForEntity = _a.updateRecommendationForEntity, exports.updateRecommendationForEntityFailure = _a.updateRecommendationForEntityFailure, exports.indicateReadyToInitializeRecommendation = _a.indicateReadyToInitializeRecommendation;
158
146
  exports.default = recommendation.reducer;
159
147
  const doUpdateRecommendationForEntity = (draft, entityId, entityType, payload) => {
160
148
  const key = (0, recommendationState_1.getEntityRecommendationKey)(entityType, entityId);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zeniai/client-epic-state",
3
- "version": "5.2.13-beta0ND",
3
+ "version": "5.2.13-betaAK1",
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",
@@ -33,6 +33,44 @@
33
33
  "require": "./lib/view/*.js"
34
34
  }
35
35
  },
36
+ "scripts": {
37
+ "clean": "rimraf lib",
38
+ "test:typecheck": "echo 'Typechecking test files...' && NODE_OPTIONS=--max-old-space-size=4096 time tsc -p tsconfig.typecheck.json",
39
+ "test:typecheck-modified-files": "chmod +x ./scripts/tsc-modified-files.sh && SINCE_DAYS=30 ./scripts/tsc-modified-files.sh master tsconfig.typecheck.json",
40
+ "test:typecheck-mocks": "echo 'Typechecking mock files...' && NODE_OPTIONS=--max-old-space-size=4096 time tsc -p tsconfig.mocks.json",
41
+ "test:typecheck-mocks-modified-files": "chmod +x ./scripts/tsc-modified-files.sh && SINCE_DAYS=30 ./scripts/tsc-modified-files.sh master tsconfig.mocks.json",
42
+ "test": "pnpm lint-modified-files && pnpm test:typecheck-modified-files && pnpm test:typecheck-mocks-modified-files && vitest run --typecheck",
43
+ "test:full": "pnpm test:typecheck-modified-files && pnpm test:typecheck-mocks-modified-files && vitest run --typecheck",
44
+ "lint": "eslint . --ext .js,.jsx,.ts,.tsx --max-warnings 0 --fix",
45
+ "lint-modified-files": "chmod +x ./scripts/lint-modified-files.sh && ./scripts/lint-modified-files.sh",
46
+ "lint:fix-modified-files": "chmod +x ./scripts/lint-modified-files.sh && LINT_FIX=true ./scripts/lint-modified-files.sh",
47
+ "tsc-modified-files": "chmod +x ./scripts/tsc-modified-files.sh && ./scripts/tsc-modified-files.sh",
48
+ "typecheck": "tsc --noEmit",
49
+ "circular-dependency": "madge --circular --extensions ts ./src",
50
+ "circular-dependency-modified-files": "chmod +x ./scripts/circular-dependency-modified-files.sh && ./scripts/circular-dependency-modified-files.sh",
51
+ "build": "chmod +x ./scripts/run_build.sh && ./scripts/run_build.sh && rimraf \"lib/**/__mocks__\" \"lib/**/__testHelpers__\"",
52
+ "only-build": "eslint . --ext .js,.jsx,.ts,.tsx && time tsc && tsc -p tsconfig.esm.json && rimraf \"lib/**/__mocks__\" \"lib/**/__testHelpers__\"",
53
+ "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__\"",
54
+ "format": "prettier --write --ignore-unknown \"src/**/*\" && pnpm lint",
55
+ "format-watch": "bash ./scripts/run-format-watch.sh",
56
+ "check-version": "node ./scripts/check_version.js",
57
+ "prepublishOnly": "chmod +x ./scripts/branch_validation.sh && ./scripts/branch_validation.sh && pnpm update-slack-group-topic && pnpm run check-version && pnpm clean && pnpm build",
58
+ "version": "git add -A src",
59
+ "postversion": "git push && git push --tags",
60
+ "check-dependencies": "node ./scripts/check_dependencies.js",
61
+ "clean-overrides": "node ./scripts/clean_overrides.js",
62
+ "create-or-update-release-branch": "chmod +x ./scripts/create_or_update_release_branch.sh && ./scripts/create_or_update_release_branch.sh",
63
+ "bump-versions-master": "chmod +x ./scripts/bump_versions_master.sh && ./scripts/bump_versions_master.sh",
64
+ "bump-versions-beta": "chmod +x ./scripts/bump_versions_beta.sh && ./scripts/bump_versions_beta.sh",
65
+ "bump-update-web-app-cockpit-beta": "chmod +x ./scripts/bump_and_update_web_app_ui_beta.sh && ./scripts/bump_and_update_web_app_ui_beta.sh",
66
+ "send-release-notes": "chmod +x ./scripts/send_release_notes.sh && ./scripts/send_release_notes.sh",
67
+ "update-slack-group-topic": "chmod +x ./scripts/update-slack-group-topic.sh && ./scripts/update-slack-group-topic.sh",
68
+ "build-beta-and-copy": "chmod +x ./scripts/build_and_copy.sh && ./scripts/build_and_copy.sh",
69
+ "pr-approvals-update": "chmod +x ./scripts/pr_approvals.sh && ./scripts/pr_approvals.sh",
70
+ "raise-pr-automation": "chmod +x ./scripts/raise_pr_automation.sh && ./scripts/raise_pr_automation.sh",
71
+ "test:file": "bash ./scripts/test-file.sh",
72
+ "find-unused-code": "knip"
73
+ },
36
74
  "files": [
37
75
  "lib/**/*"
38
76
  ],
@@ -100,41 +138,36 @@
100
138
  "dayjs": "^1.10.7",
101
139
  "url-parse": "^1.5.10"
102
140
  },
103
- "scripts": {
104
- "clean": "rimraf lib",
105
- "test:typecheck": "echo 'Typechecking test files...' && NODE_OPTIONS=--max-old-space-size=4096 time tsc -p tsconfig.typecheck.json",
106
- "test:typecheck-modified-files": "chmod +x ./scripts/tsc-modified-files.sh && SINCE_DAYS=30 ./scripts/tsc-modified-files.sh master tsconfig.typecheck.json",
107
- "test:typecheck-mocks": "echo 'Typechecking mock files...' && NODE_OPTIONS=--max-old-space-size=4096 time tsc -p tsconfig.mocks.json",
108
- "test:typecheck-mocks-modified-files": "chmod +x ./scripts/tsc-modified-files.sh && SINCE_DAYS=30 ./scripts/tsc-modified-files.sh master tsconfig.mocks.json",
109
- "test": "pnpm lint-modified-files && pnpm test:typecheck-modified-files && pnpm test:typecheck-mocks-modified-files && vitest run --typecheck",
110
- "test:full": "pnpm test:typecheck-modified-files && pnpm test:typecheck-mocks-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",
116
- "circular-dependency": "madge --circular --extensions ts ./src",
117
- "circular-dependency-modified-files": "chmod +x ./scripts/circular-dependency-modified-files.sh && ./scripts/circular-dependency-modified-files.sh",
118
- "build": "chmod +x ./scripts/run_build.sh && ./scripts/run_build.sh && rimraf \"lib/**/__mocks__\" \"lib/**/__testHelpers__\"",
119
- "only-build": "eslint . --ext .js,.jsx,.ts,.tsx && time tsc && tsc -p tsconfig.esm.json && rimraf \"lib/**/__mocks__\" \"lib/**/__testHelpers__\"",
120
- "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__\"",
121
- "format": "prettier --write --ignore-unknown \"src/**/*\" && pnpm lint",
122
- "format-watch": "bash ./scripts/run-format-watch.sh",
123
- "check-version": "node ./scripts/check_version.js",
124
- "version": "git add -A src",
125
- "postversion": "git push && git push --tags",
126
- "check-dependencies": "node ./scripts/check_dependencies.js",
127
- "clean-overrides": "node ./scripts/clean_overrides.js",
128
- "create-or-update-release-branch": "chmod +x ./scripts/create_or_update_release_branch.sh && ./scripts/create_or_update_release_branch.sh",
129
- "bump-versions-master": "chmod +x ./scripts/bump_versions_master.sh && ./scripts/bump_versions_master.sh",
130
- "bump-versions-beta": "chmod +x ./scripts/bump_versions_beta.sh && ./scripts/bump_versions_beta.sh",
131
- "bump-update-web-app-cockpit-beta": "chmod +x ./scripts/bump_and_update_web_app_ui_beta.sh && ./scripts/bump_and_update_web_app_ui_beta.sh",
132
- "send-release-notes": "chmod +x ./scripts/send_release_notes.sh && ./scripts/send_release_notes.sh",
133
- "update-slack-group-topic": "chmod +x ./scripts/update-slack-group-topic.sh && ./scripts/update-slack-group-topic.sh",
134
- "build-beta-and-copy": "chmod +x ./scripts/build_and_copy.sh && ./scripts/build_and_copy.sh",
135
- "pr-approvals-update": "chmod +x ./scripts/pr_approvals.sh && ./scripts/pr_approvals.sh",
136
- "raise-pr-automation": "chmod +x ./scripts/raise_pr_automation.sh && ./scripts/raise_pr_automation.sh",
137
- "test:file": "bash ./scripts/test-file.sh",
138
- "find-unused-code": "knip"
141
+ "pnpm": {
142
+ "overrides": {
143
+ "@babel/core": ">=7.29.6",
144
+ "@babel/helpers": ">=7.26.10",
145
+ "@babel/runtime": ">=7.26.10",
146
+ "@babel/traverse": ">=7.23.2",
147
+ "@eslint/eslintrc>ajv": ">=6.14.0 <7",
148
+ "@eslint/plugin-kit": ">=0.3.4",
149
+ "@modelcontextprotocol/sdk": ">=1.25.2",
150
+ "ajv": ">=8.18.0",
151
+ "body-parser": ">=2.2.1",
152
+ "brace-expansion": ">=5.0.9",
153
+ "cross-spawn": ">=7.0.5",
154
+ "esbuild": ">=0.28.1",
155
+ "eslint>ajv": ">=6.14.0 <7",
156
+ "flatted": ">=3.4.2",
157
+ "glob": ">=11.1.0",
158
+ "hono": ">=4.11.4",
159
+ "immutable": ">=4.3.9 <5",
160
+ "js-yaml": ">=4.3.1 <5",
161
+ "minimatch": ">=10.2.3",
162
+ "nanoid": ">=3.3.17 <4",
163
+ "picomatch": ">=4.0.4",
164
+ "postcss": ">=8.5.18",
165
+ "qs": "^6.14.1",
166
+ "rollup": ">=4.59.0",
167
+ "shell-quote": ">=1.9.0",
168
+ "tough-cookie": "=4.1.3",
169
+ "vite": ">=7.3.5 <8",
170
+ "yaml": ">=2.9.0"
171
+ }
139
172
  }
140
- }
173
+ }
@@ -1,52 +0,0 @@
1
- import { EMPTY } from 'rxjs';
2
- import { catchError, filter, mergeMap } from 'rxjs/operators';
3
- import { isSuccessStatus } from '../../responsePayload';
4
- import { submitRecommendationFeedback } from './recommendationReducer';
5
- const toRequestBody = (payload) => ({
6
- line_id: payload.lineId ?? null,
7
- dimension: payload.dimension,
8
- recommendation_set_id: payload.recommendationSetId ?? null,
9
- top_pick_source: payload.topPickSource ?? null,
10
- shown_recommendations: (payload.shownRecommendations ?? []).map((recommendation) => ({
11
- source: recommendation.source,
12
- rank: recommendation.rank,
13
- value: {
14
- name: recommendation.value.name,
15
- id: recommendation.value.id ?? null,
16
- integration_id: recommendation.value.integrationId ?? null,
17
- },
18
- confidence: recommendation.confidence ?? null,
19
- reasoning: recommendation.reasoning ?? null,
20
- cot: recommendation.cot ?? [],
21
- })),
22
- selected: {
23
- name: payload.selected.name,
24
- id: payload.selected.id ?? null,
25
- integration_id: payload.selected.integrationId ?? null,
26
- is_new_entity: payload.selected.isNewEntity ?? false,
27
- },
28
- matched_source: payload.matchedSource ?? null,
29
- matched_rank: payload.matchedRank ?? null,
30
- outcome: payload.outcome,
31
- reason_text: payload.reasonText ?? null,
32
- skipped: payload.skipped ?? false,
33
- retracts_feedback_id: payload.retractsFeedbackId ?? null,
34
- features: payload.features ?? null,
35
- });
36
- // Fire-and-forget: the epic never re-emits an action. Feedback delivery is a
37
- // side-effect that must not disrupt the categorization UX, so both the
38
- // success and error paths complete silently (errors are logged for debugging).
39
- export const submitRecommendationFeedbackEpic = (actions$, _state$, zeniAPI) => actions$.pipe(filter(submitRecommendationFeedback.match), mergeMap((action) => {
40
- const { transactionId } = action.payload;
41
- return zeniAPI
42
- .postAndGetJSON(`${zeniAPI.apiEndPoints.accountMicroServiceBaseUrl}/1.0/transactions/${transactionId}/recommendation-feedback`, toRequestBody(action.payload))
43
- .pipe(mergeMap((response) => {
44
- if (!isSuccessStatus(response)) {
45
- console.error('submitRecommendationFeedbackEpic: recommendation feedback was not recorded', response.status);
46
- }
47
- return EMPTY;
48
- }), catchError((error) => {
49
- console.error('submitRecommendationFeedbackEpic: failed to submit recommendation feedback', error);
50
- return EMPTY;
51
- }));
52
- }));
@@ -1,7 +0,0 @@
1
- import { ActionsObservable, StateObservable } from 'redux-observable';
2
- import { Observable } from 'rxjs';
3
- import { RootState } from '../../reducer';
4
- import { ZeniAPI } from '../../zeniAPI';
5
- import { submitRecommendationFeedback } from './recommendationReducer';
6
- export type ActionType = ReturnType<typeof submitRecommendationFeedback>;
7
- export declare const submitRecommendationFeedbackEpic: (actions$: ActionsObservable<ActionType>, _state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
@@ -1,56 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.submitRecommendationFeedbackEpic = void 0;
4
- const rxjs_1 = require("rxjs");
5
- const operators_1 = require("rxjs/operators");
6
- const responsePayload_1 = require("../../responsePayload");
7
- const recommendationReducer_1 = require("./recommendationReducer");
8
- const toRequestBody = (payload) => ({
9
- line_id: payload.lineId ?? null,
10
- dimension: payload.dimension,
11
- recommendation_set_id: payload.recommendationSetId ?? null,
12
- top_pick_source: payload.topPickSource ?? null,
13
- shown_recommendations: (payload.shownRecommendations ?? []).map((recommendation) => ({
14
- source: recommendation.source,
15
- rank: recommendation.rank,
16
- value: {
17
- name: recommendation.value.name,
18
- id: recommendation.value.id ?? null,
19
- integration_id: recommendation.value.integrationId ?? null,
20
- },
21
- confidence: recommendation.confidence ?? null,
22
- reasoning: recommendation.reasoning ?? null,
23
- cot: recommendation.cot ?? [],
24
- })),
25
- selected: {
26
- name: payload.selected.name,
27
- id: payload.selected.id ?? null,
28
- integration_id: payload.selected.integrationId ?? null,
29
- is_new_entity: payload.selected.isNewEntity ?? false,
30
- },
31
- matched_source: payload.matchedSource ?? null,
32
- matched_rank: payload.matchedRank ?? null,
33
- outcome: payload.outcome,
34
- reason_text: payload.reasonText ?? null,
35
- skipped: payload.skipped ?? false,
36
- retracts_feedback_id: payload.retractsFeedbackId ?? null,
37
- features: payload.features ?? null,
38
- });
39
- // Fire-and-forget: the epic never re-emits an action. Feedback delivery is a
40
- // side-effect that must not disrupt the categorization UX, so both the
41
- // success and error paths complete silently (errors are logged for debugging).
42
- const submitRecommendationFeedbackEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(recommendationReducer_1.submitRecommendationFeedback.match), (0, operators_1.mergeMap)((action) => {
43
- const { transactionId } = action.payload;
44
- return zeniAPI
45
- .postAndGetJSON(`${zeniAPI.apiEndPoints.accountMicroServiceBaseUrl}/1.0/transactions/${transactionId}/recommendation-feedback`, toRequestBody(action.payload))
46
- .pipe((0, operators_1.mergeMap)((response) => {
47
- if (!(0, responsePayload_1.isSuccessStatus)(response)) {
48
- console.error('submitRecommendationFeedbackEpic: recommendation feedback was not recorded', response.status);
49
- }
50
- return rxjs_1.EMPTY;
51
- }), (0, operators_1.catchError)((error) => {
52
- console.error('submitRecommendationFeedbackEpic: failed to submit recommendation feedback', error);
53
- return rxjs_1.EMPTY;
54
- }));
55
- }));
56
- exports.submitRecommendationFeedbackEpic = submitRecommendationFeedbackEpic;