@zeniai/client-epic-state 5.0.53-betaML3 → 5.0.53-betaML4

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.
@@ -404,6 +404,17 @@ const expenseAutomationTransactionsView = (0, toolkit_1.createSlice)({
404
404
  const transactionLocalData = (0, get_1.default)(draft.transactionCategorizationView[selectedTab]
405
405
  .transactionReviewLocalDataById, transactionId.id, undefined);
406
406
  if (transactionLocalData != null) {
407
+ // Snapshot the pre-fetch selection. setEntityRecommendationForLineIdInLocalData
408
+ // mutates selectedCheckBoxTransactionIds internally (auto-add when
409
+ // all-filled, auto-remove otherwise) but does not enforce
410
+ // MAX_SELECTION_LIMIT. We restore from this snapshot below and let
411
+ // the reducer-level gate own the selection contract so the cap is
412
+ // honored and the gate mirrors the original auto-add gate from
413
+ // updateSelectedVendor/CustomerForTransaction.
414
+ const selectionBeforeFetch = [
415
+ ...draft.transactionCategorizationView[selectedTab]
416
+ .selectedCheckBoxTransactionIds,
417
+ ];
407
418
  const newLocalData = (0, transactionCategorizationLocalDataHelper_1.setEntityRecommendationForLineIdInLocalData)(draft.transactionCategorizationView[selectedTab], transaction, transactionLocalData.transactionReviewLocalData, entity, lineIds, uncategorizedAccounts, action.payload.recommendationWithCOTByLineId, isUncategorizedExpenseCategoryEnabled, isAccountingClassesEnabled);
408
419
  // Flip the per-line "fetching" flag to Completed for the lines this
409
420
  // fetch covered. Reads as the success arm of the
@@ -424,6 +435,22 @@ const expenseAutomationTransactionsView = (0, toolkit_1.createSlice)({
424
435
  transactionId: transaction.id,
425
436
  transactionReviewLocalData: newLocalData,
426
437
  };
438
+ // Auto-add the transaction to the bulk-save selection now that
439
+ // fresh recs have landed and all required fields are filled. This
440
+ // is the success-arm of the deferral noted in
441
+ // updateSelectedVendor/CustomerForTransaction: their auto-add was
442
+ // suppressed because pre-fetch category/class were stale; we run
443
+ // the same gate here against newLocalData so the checkbox flips
444
+ // on against fresh recs.
445
+ draft.transactionCategorizationView[selectedTab].selectedCheckBoxTransactionIds = selectionBeforeFetch;
446
+ if ((0, transactionCategorizationLocalDataHelper_1.checkIfAllLineItemsAreCategoryClassFilled)(transaction, newLocalData, uncategorizedAccounts, isUncategorizedExpenseCategoryEnabled, isAccountingClassesEnabled) === true &&
447
+ selectionBeforeFetch.length < transactionCategorizationLocalDataHelper_1.MAX_SELECTION_LIMIT &&
448
+ selectionBeforeFetch.includes(transaction.id) === false) {
449
+ draft.transactionCategorizationView[selectedTab].selectedCheckBoxTransactionIds = [
450
+ ...selectionBeforeFetch,
451
+ transaction.id,
452
+ ];
453
+ }
427
454
  // Mark transaction as dirty (autofill happened)
428
455
  if (!draft.transactionCategorizationView[selectedTab].transactionIdsWithUnsavedData.includes(transaction.id)) {
429
456
  draft.transactionCategorizationView[selectedTab].transactionIdsWithUnsavedData = [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zeniai/client-epic-state",
3
- "version": "5.0.53-betaML3",
3
+ "version": "5.0.53-betaML4",
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",