@zeniai/client-epic-state 4.20.3-betaJK1 → 4.20.3-betaJK2

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.
@@ -456,29 +456,7 @@ const expenseAutomationReconciliationView = (0, toolkit_1.createSlice)({
456
456
  if (!draft.excludedAccountIDs.includes(account.account_id)) {
457
457
  draft.excludedAccountIDs.push(account.account_id);
458
458
  }
459
- draft.excludedAccountExclusionInfo[account.account_id] = {
460
- bankBalance: account.bank_balance != null
461
- ? {
462
- amount: account.bank_balance,
463
- currencyCode: account.currency_code ?? 'USD',
464
- currencySymbol: account.currency_symbol ?? '$',
465
- }
466
- : undefined,
467
- clearedBalance: account.cleared_balance != null
468
- ? {
469
- amount: account.cleared_balance,
470
- currencyCode: account.currency_code ?? 'USD',
471
- currencySymbol: account.currency_symbol ?? '$',
472
- }
473
- : undefined,
474
- variance: account.variance != null
475
- ? {
476
- amount: account.variance,
477
- currencyCode: account.currency_code ?? 'USD',
478
- currencySymbol: account.currency_symbol ?? '$',
479
- }
480
- : undefined,
481
- };
459
+ updateExcludedAccountExclusionInfo(draft, account);
482
460
  const monthYearPeriodId = (0, timePeriod_1.toMonthYearPeriodId)(selectedPeriod);
483
461
  if (draft.accountReconciliationRecordsBySelectedPeriod[monthYearPeriodId]
484
462
  ?.accountIDs != null) {
@@ -521,17 +499,8 @@ const expenseAutomationReconciliationView = (0, toolkit_1.createSlice)({
521
499
  if (!accountReconciliationRecords.accountIDs.includes(accountId)) {
522
500
  accountReconciliationRecords.accountIDs.push(accountId);
523
501
  }
524
- accountReconciliationRecords.reconciliationByAccountID[accountId] = {
525
- accountId,
526
- reconciliationId: reconciliation.reconciliation_id ?? undefined,
527
- transactionFetchState: { fetchState: 'Not-Started', error: undefined },
528
- refreshStatus: { fetchState: 'Not-Started', error: undefined },
529
- statementDeleteStatus: { fetchState: 'Not-Started', error: undefined },
530
- statementUploadStatus: { fetchState: 'Not-Started', error: undefined },
531
- statementUpdateStatus: { fetchState: 'Not-Started', error: undefined },
532
- statementParseInProgress: reconciliation.bank_status.code === 'parsing',
533
- localData: {},
534
- };
502
+ // put this in a function
503
+ updateReconciliationByAccountIDOnIncludeAccount(draft, accountId, reconciliation, monthYearPeriodId);
535
504
  }
536
505
  draft.accountConnectionStatusByAccountID[accountId] = {
537
506
  status: (0, accountReconState_1.toBankStatusCodeType)(reconciliation.bank_status.code),
@@ -668,3 +637,41 @@ function updateReconciliationByAccountID(draft, accounts, selectedPeriod, accoun
668
637
  };
669
638
  }
670
639
  }
640
+ const updateExcludedAccountExclusionInfo = (draft, account) => {
641
+ draft.excludedAccountExclusionInfo[account.account_id] = {
642
+ bankBalance: account.bank_balance != null
643
+ ? {
644
+ amount: account.bank_balance,
645
+ currencyCode: account.currency_code ?? 'USD',
646
+ currencySymbol: account.currency_symbol ?? '$',
647
+ }
648
+ : undefined,
649
+ clearedBalance: account.cleared_balance != null
650
+ ? {
651
+ amount: account.cleared_balance,
652
+ currencyCode: account.currency_code ?? 'USD',
653
+ currencySymbol: account.currency_symbol ?? '$',
654
+ }
655
+ : undefined,
656
+ variance: account.variance != null
657
+ ? {
658
+ amount: account.variance,
659
+ currencyCode: account.currency_code ?? 'USD',
660
+ currencySymbol: account.currency_symbol ?? '$',
661
+ }
662
+ : undefined,
663
+ };
664
+ };
665
+ const updateReconciliationByAccountIDOnIncludeAccount = (draft, accountId, reconciliation, monthYearPeriodId) => {
666
+ draft.accountReconciliationRecordsBySelectedPeriod[monthYearPeriodId].reconciliationByAccountID[accountId] = {
667
+ accountId,
668
+ reconciliationId: reconciliation.reconciliation_id ?? undefined,
669
+ transactionFetchState: { fetchState: 'Not-Started', error: undefined },
670
+ refreshStatus: { fetchState: 'Not-Started', error: undefined },
671
+ statementDeleteStatus: { fetchState: 'Not-Started', error: undefined },
672
+ statementUploadStatus: { fetchState: 'Not-Started', error: undefined },
673
+ statementUpdateStatus: { fetchState: 'Not-Started', error: undefined },
674
+ statementParseInProgress: reconciliation.bank_status.code === 'parsing',
675
+ localData: {},
676
+ };
677
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zeniai/client-epic-state",
3
- "version": "4.20.3-betaJK1",
3
+ "version": "4.20.3-betaJK2",
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",