@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.
@@ -452,29 +452,7 @@ const expenseAutomationReconciliationView = createSlice({
452
452
  if (!draft.excludedAccountIDs.includes(account.account_id)) {
453
453
  draft.excludedAccountIDs.push(account.account_id);
454
454
  }
455
- draft.excludedAccountExclusionInfo[account.account_id] = {
456
- bankBalance: account.bank_balance != null
457
- ? {
458
- amount: account.bank_balance,
459
- currencyCode: account.currency_code ?? 'USD',
460
- currencySymbol: account.currency_symbol ?? '$',
461
- }
462
- : undefined,
463
- clearedBalance: account.cleared_balance != null
464
- ? {
465
- amount: account.cleared_balance,
466
- currencyCode: account.currency_code ?? 'USD',
467
- currencySymbol: account.currency_symbol ?? '$',
468
- }
469
- : undefined,
470
- variance: account.variance != null
471
- ? {
472
- amount: account.variance,
473
- currencyCode: account.currency_code ?? 'USD',
474
- currencySymbol: account.currency_symbol ?? '$',
475
- }
476
- : undefined,
477
- };
455
+ updateExcludedAccountExclusionInfo(draft, account);
478
456
  const monthYearPeriodId = toMonthYearPeriodId(selectedPeriod);
479
457
  if (draft.accountReconciliationRecordsBySelectedPeriod[monthYearPeriodId]
480
458
  ?.accountIDs != null) {
@@ -517,17 +495,8 @@ const expenseAutomationReconciliationView = createSlice({
517
495
  if (!accountReconciliationRecords.accountIDs.includes(accountId)) {
518
496
  accountReconciliationRecords.accountIDs.push(accountId);
519
497
  }
520
- accountReconciliationRecords.reconciliationByAccountID[accountId] = {
521
- accountId,
522
- reconciliationId: reconciliation.reconciliation_id ?? undefined,
523
- transactionFetchState: { fetchState: 'Not-Started', error: undefined },
524
- refreshStatus: { fetchState: 'Not-Started', error: undefined },
525
- statementDeleteStatus: { fetchState: 'Not-Started', error: undefined },
526
- statementUploadStatus: { fetchState: 'Not-Started', error: undefined },
527
- statementUpdateStatus: { fetchState: 'Not-Started', error: undefined },
528
- statementParseInProgress: reconciliation.bank_status.code === 'parsing',
529
- localData: {},
530
- };
498
+ // put this in a function
499
+ updateReconciliationByAccountIDOnIncludeAccount(draft, accountId, reconciliation, monthYearPeriodId);
531
500
  }
532
501
  draft.accountConnectionStatusByAccountID[accountId] = {
533
502
  status: toBankStatusCodeType(reconciliation.bank_status.code),
@@ -664,3 +633,41 @@ function updateReconciliationByAccountID(draft, accounts, selectedPeriod, accoun
664
633
  };
665
634
  }
666
635
  }
636
+ const updateExcludedAccountExclusionInfo = (draft, account) => {
637
+ draft.excludedAccountExclusionInfo[account.account_id] = {
638
+ bankBalance: account.bank_balance != null
639
+ ? {
640
+ amount: account.bank_balance,
641
+ currencyCode: account.currency_code ?? 'USD',
642
+ currencySymbol: account.currency_symbol ?? '$',
643
+ }
644
+ : undefined,
645
+ clearedBalance: account.cleared_balance != null
646
+ ? {
647
+ amount: account.cleared_balance,
648
+ currencyCode: account.currency_code ?? 'USD',
649
+ currencySymbol: account.currency_symbol ?? '$',
650
+ }
651
+ : undefined,
652
+ variance: account.variance != null
653
+ ? {
654
+ amount: account.variance,
655
+ currencyCode: account.currency_code ?? 'USD',
656
+ currencySymbol: account.currency_symbol ?? '$',
657
+ }
658
+ : undefined,
659
+ };
660
+ };
661
+ const updateReconciliationByAccountIDOnIncludeAccount = (draft, accountId, reconciliation, monthYearPeriodId) => {
662
+ draft.accountReconciliationRecordsBySelectedPeriod[monthYearPeriodId].reconciliationByAccountID[accountId] = {
663
+ accountId,
664
+ reconciliationId: reconciliation.reconciliation_id ?? undefined,
665
+ transactionFetchState: { fetchState: 'Not-Started', error: undefined },
666
+ refreshStatus: { fetchState: 'Not-Started', error: undefined },
667
+ statementDeleteStatus: { fetchState: 'Not-Started', error: undefined },
668
+ statementUploadStatus: { fetchState: 'Not-Started', error: undefined },
669
+ statementUpdateStatus: { fetchState: 'Not-Started', error: undefined },
670
+ statementParseInProgress: reconciliation.bank_status.code === 'parsing',
671
+ localData: {},
672
+ };
673
+ };