@zeniai/client-epic-state 5.1.43 → 5.1.44

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.
@@ -95,12 +95,12 @@ const expenseAutomationReconciliationView = createSlice({
95
95
  }
96
96
  }
97
97
  else {
98
- // reset the selected tab to "review" when visiing detail page and we are not refreshing in Background
98
+ // Visiting an account detail page selects it and opens review; background
99
+ // refresh (e.g. statement Pusher) must not change navigation selection.
99
100
  if (action.payload.refreshViewInBackground !== true) {
100
101
  draft.selectedTab = 'review';
102
+ draft.selectedAccountId = action.payload.accountId;
101
103
  }
102
- // select the account for which we are fetching
103
- draft.selectedAccountId = action.payload.accountId;
104
104
  const accountReconciliationRecords = draft.accountReconciliationRecordsBySelectedPeriod[toMonthYearPeriodId(action.payload.selectedPeriod)];
105
105
  const { transactionFetchState } = accountReconciliationRecords.reconciliationByAccountID[action.payload.accountId];
106
106
  if (transactionFetchState.fetchState !== 'Completed' ||
@@ -517,21 +517,33 @@ const expenseAutomationReconciliationView = createSlice({
517
517
  },
518
518
  parseStatementSuccess: (draft, action) => {
519
519
  const { accountId, selectedPeriod } = action.payload;
520
- draft.accountReconciliationRecordsBySelectedPeriod[toMonthYearPeriodId(selectedPeriod)].reconciliationByAccountID[accountId].statementParseStatus = {
520
+ const accountRecon = draft.accountReconciliationRecordsBySelectedPeriod[toMonthYearPeriodId(selectedPeriod)]?.reconciliationByAccountID[accountId];
521
+ if (accountRecon == null) {
522
+ return;
523
+ }
524
+ accountRecon.statementParseStatus = {
521
525
  fetchState: 'Completed',
522
526
  error: undefined,
523
527
  };
524
- draft.accountReconciliationRecordsBySelectedPeriod[toMonthYearPeriodId(selectedPeriod)].reconciliationByAccountID[accountId].statementParseInProgress = false;
525
- draft.accountReconciliationRecordsBySelectedPeriod[toMonthYearPeriodId(selectedPeriod)].reconciliationByAccountID[accountId].statementProcessingFailed = false;
528
+ accountRecon.statementParseInProgress = false;
529
+ accountRecon.statementProcessingFailed = false;
530
+ // Stop elapsed-time step simulation; keep dismissed flag so the
531
+ // app-level completion snackbar can still fire.
532
+ accountRecon.statementProcessingStartedAtMs = undefined;
533
+ accountRecon.statementProcessingTotalDurationSeconds = undefined;
526
534
  },
527
535
  parseStatementFailure: (draft, action) => {
528
536
  const { accountId, selectedPeriod } = action.payload;
529
- draft.accountReconciliationRecordsBySelectedPeriod[toMonthYearPeriodId(selectedPeriod)].reconciliationByAccountID[accountId].statementParseStatus = {
537
+ const accountRecon = draft.accountReconciliationRecordsBySelectedPeriod[toMonthYearPeriodId(selectedPeriod)]?.reconciliationByAccountID[accountId];
538
+ if (accountRecon == null) {
539
+ return;
540
+ }
541
+ accountRecon.statementParseStatus = {
530
542
  fetchState: 'Error',
531
543
  error: action.payload.error,
532
544
  };
533
- draft.accountReconciliationRecordsBySelectedPeriod[toMonthYearPeriodId(selectedPeriod)].reconciliationByAccountID[accountId].statementParseInProgress = false;
534
- draft.accountReconciliationRecordsBySelectedPeriod[toMonthYearPeriodId(selectedPeriod)].reconciliationByAccountID[accountId].statementProcessingFailed = true;
545
+ accountRecon.statementParseInProgress = false;
546
+ accountRecon.statementProcessingFailed = true;
535
547
  },
536
548
  reparseStatement: (draft, action) => {
537
549
  const { accountId, selectedPeriod } = action.payload;
@@ -100,12 +100,12 @@ const expenseAutomationReconciliationView = (0, toolkit_1.createSlice)({
100
100
  }
101
101
  }
102
102
  else {
103
- // reset the selected tab to "review" when visiing detail page and we are not refreshing in Background
103
+ // Visiting an account detail page selects it and opens review; background
104
+ // refresh (e.g. statement Pusher) must not change navigation selection.
104
105
  if (action.payload.refreshViewInBackground !== true) {
105
106
  draft.selectedTab = 'review';
107
+ draft.selectedAccountId = action.payload.accountId;
106
108
  }
107
- // select the account for which we are fetching
108
- draft.selectedAccountId = action.payload.accountId;
109
109
  const accountReconciliationRecords = draft.accountReconciliationRecordsBySelectedPeriod[(0, timePeriod_1.toMonthYearPeriodId)(action.payload.selectedPeriod)];
110
110
  const { transactionFetchState } = accountReconciliationRecords.reconciliationByAccountID[action.payload.accountId];
111
111
  if (transactionFetchState.fetchState !== 'Completed' ||
@@ -522,21 +522,33 @@ const expenseAutomationReconciliationView = (0, toolkit_1.createSlice)({
522
522
  },
523
523
  parseStatementSuccess: (draft, action) => {
524
524
  const { accountId, selectedPeriod } = action.payload;
525
- draft.accountReconciliationRecordsBySelectedPeriod[(0, timePeriod_1.toMonthYearPeriodId)(selectedPeriod)].reconciliationByAccountID[accountId].statementParseStatus = {
525
+ const accountRecon = draft.accountReconciliationRecordsBySelectedPeriod[(0, timePeriod_1.toMonthYearPeriodId)(selectedPeriod)]?.reconciliationByAccountID[accountId];
526
+ if (accountRecon == null) {
527
+ return;
528
+ }
529
+ accountRecon.statementParseStatus = {
526
530
  fetchState: 'Completed',
527
531
  error: undefined,
528
532
  };
529
- draft.accountReconciliationRecordsBySelectedPeriod[(0, timePeriod_1.toMonthYearPeriodId)(selectedPeriod)].reconciliationByAccountID[accountId].statementParseInProgress = false;
530
- draft.accountReconciliationRecordsBySelectedPeriod[(0, timePeriod_1.toMonthYearPeriodId)(selectedPeriod)].reconciliationByAccountID[accountId].statementProcessingFailed = false;
533
+ accountRecon.statementParseInProgress = false;
534
+ accountRecon.statementProcessingFailed = false;
535
+ // Stop elapsed-time step simulation; keep dismissed flag so the
536
+ // app-level completion snackbar can still fire.
537
+ accountRecon.statementProcessingStartedAtMs = undefined;
538
+ accountRecon.statementProcessingTotalDurationSeconds = undefined;
531
539
  },
532
540
  parseStatementFailure: (draft, action) => {
533
541
  const { accountId, selectedPeriod } = action.payload;
534
- draft.accountReconciliationRecordsBySelectedPeriod[(0, timePeriod_1.toMonthYearPeriodId)(selectedPeriod)].reconciliationByAccountID[accountId].statementParseStatus = {
542
+ const accountRecon = draft.accountReconciliationRecordsBySelectedPeriod[(0, timePeriod_1.toMonthYearPeriodId)(selectedPeriod)]?.reconciliationByAccountID[accountId];
543
+ if (accountRecon == null) {
544
+ return;
545
+ }
546
+ accountRecon.statementParseStatus = {
535
547
  fetchState: 'Error',
536
548
  error: action.payload.error,
537
549
  };
538
- draft.accountReconciliationRecordsBySelectedPeriod[(0, timePeriod_1.toMonthYearPeriodId)(selectedPeriod)].reconciliationByAccountID[accountId].statementParseInProgress = false;
539
- draft.accountReconciliationRecordsBySelectedPeriod[(0, timePeriod_1.toMonthYearPeriodId)(selectedPeriod)].reconciliationByAccountID[accountId].statementProcessingFailed = true;
550
+ accountRecon.statementParseInProgress = false;
551
+ accountRecon.statementProcessingFailed = true;
540
552
  },
541
553
  reparseStatement: (draft, action) => {
542
554
  const { accountId, selectedPeriod } = action.payload;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zeniai/client-epic-state",
3
- "version": "5.1.43",
3
+ "version": "5.1.44",
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",