@zeniai/client-epic-state 5.0.84-betaAK1 → 5.0.84-betaAK3

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 (40) hide show
  1. package/lib/commonStateTypes/amount.d.ts +1 -1
  2. package/lib/commonStateTypes/amount.js +1 -2
  3. package/lib/commonStateTypes/workingDayHelper.d.ts +3 -5
  4. package/lib/commonStateTypes/workingDayHelper.js +1 -4
  5. package/lib/entity/tenant/clearAllEpic.d.ts +3 -1
  6. package/lib/entity/tenant/clearAllEpic.js +4 -0
  7. package/lib/esm/commonStateTypes/amount.js +1 -2
  8. package/lib/esm/commonStateTypes/workingDayHelper.js +1 -4
  9. package/lib/esm/entity/tenant/clearAllEpic.js +4 -0
  10. package/lib/esm/view/spendManagement/autotransferRules/autoTransferRulesSelector.js +4 -5
  11. package/lib/esm/view/spendManagement/cashManagement/autoSweepFlow/autoSweepFlowPayload.js +4 -0
  12. package/lib/esm/view/spendManagement/cashManagement/autoSweepFlow/autoSweepFlowReducer.js +1 -0
  13. package/lib/esm/view/spendManagement/cashManagement/autoSweepFlow/autoSweepFlowState.js +2 -1
  14. package/lib/esm/view/spendManagement/cashManagement/autoSweepFlow/epics/fetchCashManagementSettingsEpic.js +22 -22
  15. package/lib/esm/view/spendManagement/cashManagement/autoSweepFlow/epics/saveAutoSweepSettingsEpic.js +7 -7
  16. package/lib/esm/view/spendManagement/cashManagement/cashManagementOverview/cashManagementOverviewPayload.js +6 -2
  17. package/lib/esm/view/spendManagement/cashManagement/cashManagementOverview/cashManagementOverviewReducer.js +5 -10
  18. package/lib/esm/view/spendManagement/cashManagement/cashManagementOverview/cashManagementOverviewSelector.js +13 -1
  19. package/lib/esm/view/spendManagement/cashManagement/cashManagementOverview/epics/fetchCashManagementBannerEpic.js +16 -17
  20. package/lib/esm/view/spendManagement/cashManagement/cashManagementOverview/epics/fetchCashManagementOverviewPageEpic.js +3 -0
  21. package/lib/index.d.ts +2 -1
  22. package/lib/view/spendManagement/autotransferRules/autoTransferRulesSelector.js +4 -5
  23. package/lib/view/spendManagement/autotransferRules/autoTransferRulesState.d.ts +1 -0
  24. package/lib/view/spendManagement/cashManagement/autoSweepFlow/autoSweepFlowPayload.d.ts +3 -0
  25. package/lib/view/spendManagement/cashManagement/autoSweepFlow/autoSweepFlowPayload.js +4 -0
  26. package/lib/view/spendManagement/cashManagement/autoSweepFlow/autoSweepFlowReducer.js +1 -0
  27. package/lib/view/spendManagement/cashManagement/autoSweepFlow/autoSweepFlowState.d.ts +2 -0
  28. package/lib/view/spendManagement/cashManagement/autoSweepFlow/autoSweepFlowState.js +2 -1
  29. package/lib/view/spendManagement/cashManagement/autoSweepFlow/epics/fetchCashManagementSettingsEpic.d.ts +0 -3
  30. package/lib/view/spendManagement/cashManagement/autoSweepFlow/epics/fetchCashManagementSettingsEpic.js +22 -22
  31. package/lib/view/spendManagement/cashManagement/autoSweepFlow/epics/saveAutoSweepSettingsEpic.js +7 -7
  32. package/lib/view/spendManagement/cashManagement/cashManagementOverview/cashManagementOverviewPayload.js +6 -2
  33. package/lib/view/spendManagement/cashManagement/cashManagementOverview/cashManagementOverviewReducer.js +5 -10
  34. package/lib/view/spendManagement/cashManagement/cashManagementOverview/cashManagementOverviewSelector.js +13 -1
  35. package/lib/view/spendManagement/cashManagement/cashManagementOverview/cashManagementOverviewState.d.ts +6 -2
  36. package/lib/view/spendManagement/cashManagement/cashManagementOverview/epics/fetchCashManagementBannerEpic.d.ts +0 -9
  37. package/lib/view/spendManagement/cashManagement/cashManagementOverview/epics/fetchCashManagementBannerEpic.js +16 -17
  38. package/lib/view/spendManagement/cashManagement/cashManagementOverview/epics/fetchCashManagementOverviewPageEpic.js +3 -0
  39. package/lib/zeniAPI.d.ts +1 -0
  40. package/package.json +1 -1
@@ -5,6 +5,6 @@ export interface Currency {
5
5
  export interface Amount extends Currency {
6
6
  amount: number;
7
7
  }
8
- export declare const toAmount: (amount: number, currency_code: string, currency_symbol?: string) => Amount;
8
+ export declare const toAmount: (amount: number, currency_code: string, currency_symbol: string) => Amount;
9
9
  export declare const toAmountWC: (amount: number, currency: Currency) => Amount;
10
10
  export declare const zeroAmount: (currencyCode?: string, currencySymbol?: string) => Amount;
@@ -1,11 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.zeroAmount = exports.toAmountWC = exports.toAmount = void 0;
4
- const CURRENCY_SYMBOL_USD = '$';
5
4
  const toAmount = (amount, currency_code, currency_symbol) => ({
6
5
  amount: amount,
7
6
  currencyCode: currency_code,
8
- currencySymbol: currency_symbol ?? CURRENCY_SYMBOL_USD,
7
+ currencySymbol: currency_symbol,
9
8
  });
10
9
  exports.toAmount = toAmount;
11
10
  /* to amount with currency */
@@ -4,17 +4,15 @@ export declare const startDate = "2000-01-01";
4
4
  export declare const endDate = "2070-12-31";
5
5
  export declare const PAYMENT_BUSINESS_DAYS = 4;
6
6
  export declare const holidaysFormatted: string[];
7
+ export type NextTransferFrequency = 'daily' | 'weekly' | 'biweekly' | 'monthly';
7
8
  /**
8
9
  * Returns the next scheduled transfer date for a recurring transfer/sweep,
9
10
  * given a frequency cadence. Advances by the cadence and then skips past
10
11
  * weekends and US holidays. Used by both:
11
12
  * - `<ReviewAutoTransferRuleDrawer>` (web-c) for the display "next transfer"
12
- * - `saveAutoSweepSettingsEpic` for the `first_transfer_date` PUT payload
13
- *
14
- * Unknown frequencies fall through to "today" (subject to the weekend/holiday
15
- * shift), matching the prior behavior of the web-c helper.
13
+ * - `saveAutoSweepSettingsEpic` for the `first_run_date` PUT payload
16
14
  */
17
- export declare const getNextTransferDate: (frequency: string | undefined) => ZeniDate;
15
+ export declare const getNextTransferDate: (frequency: NextTransferFrequency) => ZeniDate;
18
16
  export declare const getNextNthWorkingDay: (date: Date, filterDaysIndex: number[], numberOfWorkingDays: number) => Date;
19
17
  export declare const getPreviousNthWorkingDay: (date: Date, filterDaysIndex: number[], numberOfWorkingDays: number) => Date;
20
18
  export declare const isHolidayToday: (filterDaysIndex: number[]) => boolean;
@@ -21,10 +21,7 @@ exports.holidaysFormatted = holidays.map((holiday) => (0, zeniDayJS_1.date)(holi
21
21
  * given a frequency cadence. Advances by the cadence and then skips past
22
22
  * weekends and US holidays. Used by both:
23
23
  * - `<ReviewAutoTransferRuleDrawer>` (web-c) for the display "next transfer"
24
- * - `saveAutoSweepSettingsEpic` for the `first_transfer_date` PUT payload
25
- *
26
- * Unknown frequencies fall through to "today" (subject to the weekend/holiday
27
- * shift), matching the prior behavior of the web-c helper.
24
+ * - `saveAutoSweepSettingsEpic` for the `first_run_date` PUT payload
28
25
  */
29
26
  const getNextTransferDate = (frequency) => {
30
27
  const date = new Date();
@@ -84,6 +84,8 @@ import { clearScheduleDetailView } from '../../view/scheduleView/scheduleDetailV
84
84
  import { clearScheduleList } from '../../view/scheduleView/scheduleListView/scheduleListReducer';
85
85
  import { clearSettingsView } from '../../view/settingsView/settingsViewReducer';
86
86
  import { clearAutoTransferRules } from '../../view/spendManagement/autotransferRules/autoTransferRulesReducer';
87
+ import { clearAutoSweepFlow } from '../../view/spendManagement/cashManagement/autoSweepFlow/autoSweepFlowReducer';
88
+ import { clearCashManagementOverview } from '../../view/spendManagement/cashManagement/cashManagementOverview/cashManagementOverviewReducer';
87
89
  import { clearBillDetailView } from '../../view/spendManagement/billPay/billDetailView/billDetailViewReducer';
88
90
  import { clearBillList } from '../../view/spendManagement/billPay/billList/billListReducer';
89
91
  import { clearBillPayConfig } from '../../view/spendManagement/billPay/billPayConfig/billPayConfigReducer';
@@ -210,7 +212,7 @@ import { clearAllUserRoles } from '../userRole/userRoleReducer';
210
212
  import { clearAllVendors } from '../vendor/vendorReducer';
211
213
  import { clearAllVendorExpenseTrends } from '../vendorExpense/vendorExpenseReducer';
212
214
  import { clearAll } from './tenantReducer';
213
- type clearActionTypeForViews = ReturnType<typeof clearAccountList> | ReturnType<typeof clearAccountMappingView> | ReturnType<typeof clearActivityHistory> | ReturnType<typeof clearActivityRealTimeApproval> | ReturnType<typeof clearAddressView> | ReturnType<typeof clearAiAccountantView> | ReturnType<typeof clearAllAiAccountantCustomers> | ReturnType<typeof clearAiCfoView> | ReturnType<typeof clearAllClasses> | ReturnType<typeof clearAllProjects> | ReturnType<typeof clearAllMonthEndCloseChecksView> | ReturnType<typeof clearApAging> | ReturnType<typeof clearApAgingDetail> | ReturnType<typeof clearArAging> | ReturnType<typeof clearArAgingDetail> | ReturnType<typeof clearAuthenticationView> | ReturnType<typeof clearAutoTransferRules> | ReturnType<typeof clearBalanceSheet> | ReturnType<typeof clearBankAccountView> | ReturnType<typeof clearBillDetailView> | ReturnType<typeof clearBillList> | ReturnType<typeof clearBillPayBulkActionView> | ReturnType<typeof clearBillPayCard> | ReturnType<typeof clearBillPayConfig> | ReturnType<typeof clearBillPayReview> | ReturnType<typeof clearBillPaySetupApproverView> | ReturnType<typeof clearBillPaySetupView> | ReturnType<typeof clearCardBalance> | ReturnType<typeof clearCardPaymentView> | ReturnType<typeof clearCardUserOnboarding> | ReturnType<typeof clearCashbackDetail> | ReturnType<typeof clearCashBalance> | ReturnType<typeof clearCashFlow> | ReturnType<typeof clearCashInCashOut> | ReturnType<typeof clearCashPosition> | ReturnType<typeof clearChargeCardConfig> | ReturnType<typeof clearChargeCardDetail> | ReturnType<typeof clearChargeCardList> | ReturnType<typeof clearChargeCardRepaymentDetail> | ReturnType<typeof clearChargeCardSetupView> | ReturnType<typeof clearChargeCardStatementList> | ReturnType<typeof clearCheckDeposit> | ReturnType<typeof clearCompanyConfigView> | ReturnType<typeof clearCompanyHealthMetric> | ReturnType<typeof clearCompanyHealthMetricView> | ReturnType<typeof clearCompanyMonthEndReportView> | ReturnType<typeof clearCompanyTaskManagerView> | ReturnType<typeof clearCompanyView> | ReturnType<typeof clearCreateTransferEntry> | ReturnType<typeof clearAllCreditAgent> | ReturnType<typeof clearCreditAgentView> | ReturnType<typeof clearDashboard> | ReturnType<typeof clearDashboardLayout> | ReturnType<typeof clearDepositAccountDetail> | ReturnType<typeof clearDepositAccountList> | ReturnType<typeof clearDepositAccountTransactionList> | ReturnType<typeof clearEditBillViewDetail> | ReturnType<typeof clearEditRemiViewDetail> | ReturnType<typeof clearAllEntityAutoCompleteResults> | ReturnType<typeof clearExpenseAutomationFluxAnalysisView> | ReturnType<typeof clearExpenseAutomationJESchedulesView> | ReturnType<typeof clearExpenseAutomationMissingReceiptsView> | ReturnType<typeof clearExpenseAutomationReconciliationView> | ReturnType<typeof clearExpenseAutomationTransactionsView> | ReturnType<typeof clearExpenseAutomationView> | ReturnType<typeof clearExpressPayView> | ReturnType<typeof clearFeatureNotificationView> | ReturnType<typeof clearFileViewList> | ReturnType<typeof clearFinanceStatement> | ReturnType<typeof clearForecastList> | ReturnType<typeof clearGlobalMerchantAutoCompleteResults> | ReturnType<typeof clearGlobalMerchantView> | ReturnType<typeof clearInsightsCard> | ReturnType<typeof clearInternationalWire> | ReturnType<typeof clearInternationalVerificationView> | ReturnType<typeof clearIssueChargeCard> | ReturnType<typeof clearMerchantList> | ReturnType<typeof clearNetBurnOrIncome> | ReturnType<typeof clearNetBurnOrIncomeClassesView> | ReturnType<typeof clearNetBurnOrIncomeStoryCard> | ReturnType<typeof clearNotificationView> | ReturnType<typeof clearOnboardingCockpitView> | ReturnType<typeof clearOnboardingCustomerView> | ReturnType<typeof clearOpEx> | ReturnType<typeof clearOpExByVendor> | ReturnType<typeof clearOpExClassesView> | ReturnType<typeof clearOwnerList> | ReturnType<typeof clearPaymentAccountList> | ReturnType<typeof clearPeople> | ReturnType<typeof clearAggregatedReport> | ReturnType<typeof clearPreviousBills> | ReturnType<typeof clearProfitAndLoss> | ReturnType<typeof clearProfitAndLossClassesView> | ReturnType<typeof clearProfitAndLossProjectView> | ReturnType<typeof clearProjectList> | ReturnType<typeof clearRecommendation> | ReturnType<typeof clearReferrals> | ReturnType<typeof clearReimbursementCard> | ReturnType<typeof clearReimbursementConfig> | ReturnType<typeof clearRemiBulkActionView> | ReturnType<typeof clearRemiDetailView> | ReturnType<typeof clearRemiList> | ReturnType<typeof clearRemiSetupApproverView> | ReturnType<typeof clearRemiSetupView> | ReturnType<typeof clearReportUIOption> | ReturnType<typeof clearRevenue> | ReturnType<typeof clearRevenueClassesView> | ReturnType<typeof clearReviewCompany> | ReturnType<typeof clearScheduleDetailView> | ReturnType<typeof clearScheduleAccruedDetailView> | ReturnType<typeof clearScheduleList> | ReturnType<typeof clearSettingsView> | ReturnType<typeof clearSetupView> | ReturnType<typeof clearPlaidAccountView> | ReturnType<typeof clearSubscriptionView> | ReturnType<typeof clearTagView> | ReturnType<typeof clearTaskDetail> | ReturnType<typeof clearTaskGroupTemplatesView> | ReturnType<typeof clearTaskGroupView> | ReturnType<typeof clearTaskList> | ReturnType<typeof clearTasksCard> | ReturnType<typeof clearTopEx> | ReturnType<typeof clearTransactionDetail> | ReturnType<typeof clearTransactionList> | ReturnType<typeof clearTransferDetail> | ReturnType<typeof clearTreasuryOverviewDetail> | ReturnType<typeof clearTreasurySetupView> | ReturnType<typeof clearTreasuryStatementList> | ReturnType<typeof clearTreasuryTaxLetterList> | ReturnType<typeof clearTreasuryTransferMoney> | ReturnType<typeof clearTrendData> | ReturnType<typeof clearTrendWithTransactions> | ReturnType<typeof clearTwoFactorAuthentication> | ReturnType<typeof clearUserFinancialAccount> | ReturnType<typeof clearUserListView> | ReturnType<typeof clearUserRoleConfigView> | ReturnType<typeof clearVendorGlobalReviewView> | ReturnType<typeof clearVendorReviewView> | ReturnType<typeof clearVendorTypeList> | ReturnType<typeof clearVendor1099TypeList> | ReturnType<typeof clearVendorView> | ReturnType<typeof clearVendorsFiling1099List> | ReturnType<typeof clearVendorsList> | ReturnType<typeof clearVendorsTabVendorView> | ReturnType<typeof clearWiseRedirectStatus> | ReturnType<typeof clearZeniAccStatementList> | ReturnType<typeof clearZeniAccountList> | ReturnType<typeof clearZeniAccountSetupView> | ReturnType<typeof clearZeniAccountsConfig> | ReturnType<typeof clearZeniAccountsPromoCard> | ReturnType<typeof clearZeniOAuthView>;
215
+ type clearActionTypeForViews = ReturnType<typeof clearAccountList> | ReturnType<typeof clearAccountMappingView> | ReturnType<typeof clearActivityHistory> | ReturnType<typeof clearActivityRealTimeApproval> | ReturnType<typeof clearAddressView> | ReturnType<typeof clearAiAccountantView> | ReturnType<typeof clearAllAiAccountantCustomers> | ReturnType<typeof clearAiCfoView> | ReturnType<typeof clearAllClasses> | ReturnType<typeof clearAllProjects> | ReturnType<typeof clearAllMonthEndCloseChecksView> | ReturnType<typeof clearApAging> | ReturnType<typeof clearApAgingDetail> | ReturnType<typeof clearArAging> | ReturnType<typeof clearArAgingDetail> | ReturnType<typeof clearAuthenticationView> | ReturnType<typeof clearAutoSweepFlow> | ReturnType<typeof clearAutoTransferRules> | ReturnType<typeof clearBalanceSheet> | ReturnType<typeof clearBankAccountView> | ReturnType<typeof clearBillDetailView> | ReturnType<typeof clearBillList> | ReturnType<typeof clearBillPayBulkActionView> | ReturnType<typeof clearBillPayCard> | ReturnType<typeof clearBillPayConfig> | ReturnType<typeof clearBillPayReview> | ReturnType<typeof clearBillPaySetupApproverView> | ReturnType<typeof clearBillPaySetupView> | ReturnType<typeof clearCardBalance> | ReturnType<typeof clearCardPaymentView> | ReturnType<typeof clearCardUserOnboarding> | ReturnType<typeof clearCashbackDetail> | ReturnType<typeof clearCashBalance> | ReturnType<typeof clearCashFlow> | ReturnType<typeof clearCashInCashOut> | ReturnType<typeof clearCashManagementOverview> | ReturnType<typeof clearCashPosition> | ReturnType<typeof clearChargeCardConfig> | ReturnType<typeof clearChargeCardDetail> | ReturnType<typeof clearChargeCardList> | ReturnType<typeof clearChargeCardRepaymentDetail> | ReturnType<typeof clearChargeCardSetupView> | ReturnType<typeof clearChargeCardStatementList> | ReturnType<typeof clearCheckDeposit> | ReturnType<typeof clearCompanyConfigView> | ReturnType<typeof clearCompanyHealthMetric> | ReturnType<typeof clearCompanyHealthMetricView> | ReturnType<typeof clearCompanyMonthEndReportView> | ReturnType<typeof clearCompanyTaskManagerView> | ReturnType<typeof clearCompanyView> | ReturnType<typeof clearCreateTransferEntry> | ReturnType<typeof clearAllCreditAgent> | ReturnType<typeof clearCreditAgentView> | ReturnType<typeof clearDashboard> | ReturnType<typeof clearDashboardLayout> | ReturnType<typeof clearDepositAccountDetail> | ReturnType<typeof clearDepositAccountList> | ReturnType<typeof clearDepositAccountTransactionList> | ReturnType<typeof clearEditBillViewDetail> | ReturnType<typeof clearEditRemiViewDetail> | ReturnType<typeof clearAllEntityAutoCompleteResults> | ReturnType<typeof clearExpenseAutomationFluxAnalysisView> | ReturnType<typeof clearExpenseAutomationJESchedulesView> | ReturnType<typeof clearExpenseAutomationMissingReceiptsView> | ReturnType<typeof clearExpenseAutomationReconciliationView> | ReturnType<typeof clearExpenseAutomationTransactionsView> | ReturnType<typeof clearExpenseAutomationView> | ReturnType<typeof clearExpressPayView> | ReturnType<typeof clearFeatureNotificationView> | ReturnType<typeof clearFileViewList> | ReturnType<typeof clearFinanceStatement> | ReturnType<typeof clearForecastList> | ReturnType<typeof clearGlobalMerchantAutoCompleteResults> | ReturnType<typeof clearGlobalMerchantView> | ReturnType<typeof clearInsightsCard> | ReturnType<typeof clearInternationalWire> | ReturnType<typeof clearInternationalVerificationView> | ReturnType<typeof clearIssueChargeCard> | ReturnType<typeof clearMerchantList> | ReturnType<typeof clearNetBurnOrIncome> | ReturnType<typeof clearNetBurnOrIncomeClassesView> | ReturnType<typeof clearNetBurnOrIncomeStoryCard> | ReturnType<typeof clearNotificationView> | ReturnType<typeof clearOnboardingCockpitView> | ReturnType<typeof clearOnboardingCustomerView> | ReturnType<typeof clearOpEx> | ReturnType<typeof clearOpExByVendor> | ReturnType<typeof clearOpExClassesView> | ReturnType<typeof clearOwnerList> | ReturnType<typeof clearPaymentAccountList> | ReturnType<typeof clearPeople> | ReturnType<typeof clearAggregatedReport> | ReturnType<typeof clearPreviousBills> | ReturnType<typeof clearProfitAndLoss> | ReturnType<typeof clearProfitAndLossClassesView> | ReturnType<typeof clearProfitAndLossProjectView> | ReturnType<typeof clearProjectList> | ReturnType<typeof clearRecommendation> | ReturnType<typeof clearReferrals> | ReturnType<typeof clearReimbursementCard> | ReturnType<typeof clearReimbursementConfig> | ReturnType<typeof clearRemiBulkActionView> | ReturnType<typeof clearRemiDetailView> | ReturnType<typeof clearRemiList> | ReturnType<typeof clearRemiSetupApproverView> | ReturnType<typeof clearRemiSetupView> | ReturnType<typeof clearReportUIOption> | ReturnType<typeof clearRevenue> | ReturnType<typeof clearRevenueClassesView> | ReturnType<typeof clearReviewCompany> | ReturnType<typeof clearScheduleDetailView> | ReturnType<typeof clearScheduleAccruedDetailView> | ReturnType<typeof clearScheduleList> | ReturnType<typeof clearSettingsView> | ReturnType<typeof clearSetupView> | ReturnType<typeof clearPlaidAccountView> | ReturnType<typeof clearSubscriptionView> | ReturnType<typeof clearTagView> | ReturnType<typeof clearTaskDetail> | ReturnType<typeof clearTaskGroupTemplatesView> | ReturnType<typeof clearTaskGroupView> | ReturnType<typeof clearTaskList> | ReturnType<typeof clearTasksCard> | ReturnType<typeof clearTopEx> | ReturnType<typeof clearTransactionDetail> | ReturnType<typeof clearTransactionList> | ReturnType<typeof clearTransferDetail> | ReturnType<typeof clearTreasuryOverviewDetail> | ReturnType<typeof clearTreasurySetupView> | ReturnType<typeof clearTreasuryStatementList> | ReturnType<typeof clearTreasuryTaxLetterList> | ReturnType<typeof clearTreasuryTransferMoney> | ReturnType<typeof clearTrendData> | ReturnType<typeof clearTrendWithTransactions> | ReturnType<typeof clearTwoFactorAuthentication> | ReturnType<typeof clearUserFinancialAccount> | ReturnType<typeof clearUserListView> | ReturnType<typeof clearUserRoleConfigView> | ReturnType<typeof clearVendorGlobalReviewView> | ReturnType<typeof clearVendorReviewView> | ReturnType<typeof clearVendorTypeList> | ReturnType<typeof clearVendor1099TypeList> | ReturnType<typeof clearVendorView> | ReturnType<typeof clearVendorsFiling1099List> | ReturnType<typeof clearVendorsList> | ReturnType<typeof clearVendorsTabVendorView> | ReturnType<typeof clearWiseRedirectStatus> | ReturnType<typeof clearZeniAccStatementList> | ReturnType<typeof clearZeniAccountList> | ReturnType<typeof clearZeniAccountSetupView> | ReturnType<typeof clearZeniAccountsConfig> | ReturnType<typeof clearZeniAccountsPromoCard> | ReturnType<typeof clearZeniOAuthView>;
214
216
  type clearActionTypeForEntities = ReturnType<typeof clearAiCfo> | ReturnType<typeof clearAllAccountGroups> | ReturnType<typeof clearAllAccountRecon> | ReturnType<typeof clearAllAccountingSummary> | ReturnType<typeof clearAllAccounts> | ReturnType<typeof clearAllAddresses> | ReturnType<typeof clearAllApprovalRules> | ReturnType<typeof clearAllBankAccounts> | ReturnType<typeof clearAllBillTransactions> | ReturnType<typeof clearAllCardPayments> | ReturnType<typeof clearAllChargeCardRepayments> | ReturnType<typeof clearAllChargeCardTransactions> | ReturnType<typeof clearAllChargeCards> | ReturnType<typeof clearAllCompanies> | ReturnType<typeof clearAllConnectedAccounts> | ReturnType<typeof clearAllCurrencies> | ReturnType<typeof clearAllCustomerIncomeTrend> | ReturnType<typeof clearAllCustomers> | ReturnType<typeof clearAllDepositAccounts> | ReturnType<typeof clearAllEntities> | ReturnType<typeof clearAllEntityApprovalStatus> | ReturnType<typeof clearAllFiles> | ReturnType<typeof clearAllForecasts> | ReturnType<typeof clearAllGlobalMerchants> | ReturnType<typeof clearAllInsights> | ReturnType<typeof clearAllAccruedJESchedules> | ReturnType<typeof clearAllJEScheduleTransactions> | ReturnType<typeof clearAllMerchants> | ReturnType<typeof clearAllMonthEndCloseChecks> | ReturnType<typeof clearAllNotifications> | ReturnType<typeof clearAllOnboardingCustomersInfo> | ReturnType<typeof clearAllPaymentAccounts> | ReturnType<typeof clearAllPaymentInstruments> | ReturnType<typeof clearAllRecurringBills> | ReturnType<typeof clearAllReimbursements> | ReturnType<typeof clearAllSectionsAccountsView> | ReturnType<typeof clearAllSectionsClassesViewV2> | ReturnType<typeof clearAllSectionsProjectView> | ReturnType<typeof clearAllSubscriptionAddOns> | ReturnType<typeof clearAllSubscriptionCoupons> | ReturnType<typeof clearAllSubscriptionPlans> | ReturnType<typeof clearAllSubscriptionSummary> | ReturnType<typeof clearAllSubscriptions> | ReturnType<typeof clearAllTags> | ReturnType<typeof clearAllTaskGroups> | ReturnType<typeof clearAllTaskGroupTemplates> | ReturnType<typeof clearAllTaskSummary> | ReturnType<typeof clearAllTasks> | ReturnType<typeof clearAllToastNotifications> | ReturnType<typeof clearAllTransactions> | ReturnType<typeof clearAllUserRoles> | ReturnType<typeof clearAllUsers> | ReturnType<typeof clearAllVendorExpenseTrends> | ReturnType<typeof clearAllVendors> | ReturnType<typeof clearCannedResponses> | ReturnType<typeof clearClassList> | ReturnType<typeof clearContacts> | ReturnType<typeof clearCountryList> | ReturnType<typeof clearDepositAccountTransaction> | ReturnType<typeof clearSnackbar>;
215
217
  export type ActionType = clearActionTypeForViews | clearActionTypeForEntities | ReturnType<typeof clearAll>;
216
218
  export declare const clearAllEpic: (actions$: ActionsObservable<ActionType>) => import("rxjs").Observable<ActionType>;
@@ -88,6 +88,8 @@ const scheduleDetailReducer_1 = require("../../view/scheduleView/scheduleDetailV
88
88
  const scheduleListReducer_1 = require("../../view/scheduleView/scheduleListView/scheduleListReducer");
89
89
  const settingsViewReducer_1 = require("../../view/settingsView/settingsViewReducer");
90
90
  const autoTransferRulesReducer_1 = require("../../view/spendManagement/autotransferRules/autoTransferRulesReducer");
91
+ const autoSweepFlowReducer_1 = require("../../view/spendManagement/cashManagement/autoSweepFlow/autoSweepFlowReducer");
92
+ const cashManagementOverviewReducer_1 = require("../../view/spendManagement/cashManagement/cashManagementOverview/cashManagementOverviewReducer");
91
93
  const billDetailViewReducer_1 = require("../../view/spendManagement/billPay/billDetailView/billDetailViewReducer");
92
94
  const billListReducer_1 = require("../../view/spendManagement/billPay/billList/billListReducer");
93
95
  const billPayConfigReducer_1 = require("../../view/spendManagement/billPay/billPayConfig/billPayConfigReducer");
@@ -234,6 +236,7 @@ const clearAllEpic = (actions$) => actions$.pipe((0, operators_1.filter)(tenantR
234
236
  (0, arAgingReducer_1.clearArAging)(),
235
237
  (0, arAgingDetailReducer_1.clearArAgingDetail)(),
236
238
  (0, authenticationViewReducer_1.clearAuthenticationView)(),
239
+ (0, autoSweepFlowReducer_1.clearAutoSweepFlow)(),
237
240
  (0, autoTransferRulesReducer_1.clearAutoTransferRules)(),
238
241
  (0, balanceSheetReducer_1.clearBalanceSheet)(),
239
242
  (0, bankAccountViewReducer_1.clearBankAccountView)(),
@@ -252,6 +255,7 @@ const clearAllEpic = (actions$) => actions$.pipe((0, operators_1.filter)(tenantR
252
255
  (0, cashBalanceReducer_1.clearCashBalance)(),
253
256
  (0, cashFlowReducer_1.clearCashFlow)(),
254
257
  (0, cashInCashOutReducer_1.clearCashInCashOut)(),
258
+ (0, cashManagementOverviewReducer_1.clearCashManagementOverview)(),
255
259
  (0, cashPositionReducer_1.clearCashPosition)(),
256
260
  (0, chargeCardConfigReducer_1.clearChargeCardConfig)(),
257
261
  (0, chargeCardDetailReducer_1.clearChargeCardDetail)(),
@@ -1,8 +1,7 @@
1
- const CURRENCY_SYMBOL_USD = '$';
2
1
  export const toAmount = (amount, currency_code, currency_symbol) => ({
3
2
  amount: amount,
4
3
  currencyCode: currency_code,
5
- currencySymbol: currency_symbol ?? CURRENCY_SYMBOL_USD,
4
+ currencySymbol: currency_symbol,
6
5
  });
7
6
  /* to amount with currency */
8
7
  export const toAmountWC = (amount, currency) => toAmount(amount, currency.currencyCode, currency.currencySymbol);
@@ -15,10 +15,7 @@ export const holidaysFormatted = holidays.map((holiday) => zeniDate(holiday.toDa
15
15
  * given a frequency cadence. Advances by the cadence and then skips past
16
16
  * weekends and US holidays. Used by both:
17
17
  * - `<ReviewAutoTransferRuleDrawer>` (web-c) for the display "next transfer"
18
- * - `saveAutoSweepSettingsEpic` for the `first_transfer_date` PUT payload
19
- *
20
- * Unknown frequencies fall through to "today" (subject to the weekend/holiday
21
- * shift), matching the prior behavior of the web-c helper.
18
+ * - `saveAutoSweepSettingsEpic` for the `first_run_date` PUT payload
22
19
  */
23
20
  export const getNextTransferDate = (frequency) => {
24
21
  const date = new Date();
@@ -85,6 +85,8 @@ import { clearScheduleDetailView } from '../../view/scheduleView/scheduleDetailV
85
85
  import { clearScheduleList } from '../../view/scheduleView/scheduleListView/scheduleListReducer';
86
86
  import { clearSettingsView } from '../../view/settingsView/settingsViewReducer';
87
87
  import { clearAutoTransferRules } from '../../view/spendManagement/autotransferRules/autoTransferRulesReducer';
88
+ import { clearAutoSweepFlow } from '../../view/spendManagement/cashManagement/autoSweepFlow/autoSweepFlowReducer';
89
+ import { clearCashManagementOverview } from '../../view/spendManagement/cashManagement/cashManagementOverview/cashManagementOverviewReducer';
88
90
  import { clearBillDetailView } from '../../view/spendManagement/billPay/billDetailView/billDetailViewReducer';
89
91
  import { clearBillList } from '../../view/spendManagement/billPay/billList/billListReducer';
90
92
  import { clearBillPayConfig } from '../../view/spendManagement/billPay/billPayConfig/billPayConfigReducer';
@@ -231,6 +233,7 @@ export const clearAllEpic = (actions$) => actions$.pipe(filter(clearAll.match),
231
233
  clearArAging(),
232
234
  clearArAgingDetail(),
233
235
  clearAuthenticationView(),
236
+ clearAutoSweepFlow(),
234
237
  clearAutoTransferRules(),
235
238
  clearBalanceSheet(),
236
239
  clearBankAccountView(),
@@ -249,6 +252,7 @@ export const clearAllEpic = (actions$) => actions$.pipe(filter(clearAll.match),
249
252
  clearCashBalance(),
250
253
  clearCashFlow(),
251
254
  clearCashInCashOut(),
255
+ clearCashManagementOverview(),
252
256
  clearCashPosition(),
253
257
  clearChargeCardConfig(),
254
258
  clearChargeCardDetail(),
@@ -5,13 +5,11 @@ import { getAllFundingAccounts, mapDepositAccToFundingAccount, } from '../common
5
5
  import { getAllDepositAccounts } from '../zeniAccounts/depositAccountList/depositAccountListSelector';
6
6
  import { getAllPaymentAccounts } from '../zeniAccounts/paymentAccountList/paymentAccountListSelector';
7
7
  const buildCashManagementRule = (autoSweepFlowState, depositAccountState, treasuryDetailState) => {
8
- const { settingsId, bufferAmount, frequency, memo, primaryFundingAccountId } = autoSweepFlowState;
9
- if (settingsId == null) {
8
+ const { settingsId, bufferAmount, frequency, memo, primaryFundingAccountId, nextTransferDate } = autoSweepFlowState;
9
+ if (settingsId == null || primaryFundingAccountId == null) {
10
10
  return undefined;
11
11
  }
12
- const depositAccount = primaryFundingAccountId != null
13
- ? getDepositAccountByDepositAccountId(depositAccountState, primaryFundingAccountId)
14
- : undefined;
12
+ const depositAccount = getDepositAccountByDepositAccountId(depositAccountState, primaryFundingAccountId);
15
13
  return {
16
14
  bufferAmount,
17
15
  frequency,
@@ -21,6 +19,7 @@ const buildCashManagementRule = (autoSweepFlowState, depositAccountState, treasu
21
19
  ? mapDepositAccToFundingAccount(depositAccount)
22
20
  : undefined,
23
21
  treasurySummary: treasuryDetailState.accountSummary,
22
+ nextTransferDate,
24
23
  };
25
24
  };
26
25
  export const getAutoTransferRules = (state) => {
@@ -1,5 +1,6 @@
1
1
  import { toAmount } from '../../../../commonStateTypes/amount';
2
2
  import { getNextTransferDate } from '../../../../commonStateTypes/workingDayHelper';
3
+ import { date } from '../../../../zeniDayJS';
3
4
  import { toAutoSweepFrequency, } from './autoSweepFlowState';
4
5
  export const toSaveAutoSweepSettingsBody = (state) => ({
5
6
  first_run_date: getNextTransferDate(state.frequency).format('YYYY-MM-DD'),
@@ -21,6 +22,9 @@ export const toAutoSweepFlowStatePatch = (payload) => {
21
22
  return {
22
23
  bufferAmount: toAmount(payload.minimum_buffer_usd, currencyCode ?? 'USD', currencySymbol ?? '$'),
23
24
  frequency: toAutoSweepFrequency(payload.frequency) ?? 'weekly',
25
+ nextTransferDate: payload.next_transfer_date != null && payload.next_transfer_date !== ''
26
+ ? date(payload.next_transfer_date)
27
+ : undefined,
24
28
  primaryFundingAccountId: payload.source_bank_account.deposit_account_id ?? undefined,
25
29
  settingsId: payload.cash_management_settings_id ?? undefined,
26
30
  };
@@ -22,6 +22,7 @@ const autoSweepFlow = createSlice({
22
22
  const patch = toAutoSweepFlowStatePatch(action.payload.data);
23
23
  draft.bufferAmount = patch.bufferAmount;
24
24
  draft.frequency = patch.frequency;
25
+ draft.nextTransferDate = patch.nextTransferDate;
25
26
  draft.primaryFundingAccountId = patch.primaryFundingAccountId;
26
27
  draft.settingsId = patch.settingsId;
27
28
  draft.fetchState = 'Completed';
@@ -35,10 +35,11 @@ export const bufferAmountToRisk = (amount) => {
35
35
  return match != null ? match[0] : 'moderate';
36
36
  };
37
37
  export const initialAutoSweepFlowState = {
38
- bufferAmount: toAmount(10000, 'USD'),
38
+ bufferAmount: toAmount(10000, 'USD', '$'),
39
39
  frequency: 'weekly',
40
40
  memo: '',
41
41
  saveStatus: { fetchState: 'Not-Started', error: undefined },
42
+ nextTransferDate: undefined,
42
43
  primaryFundingAccountId: undefined,
43
44
  settingsId: undefined,
44
45
  fetchState: 'Not-Started',
@@ -8,27 +8,27 @@ import { fetchCashManagementSettings, updateCashManagementSettings, updateCashMa
8
8
  * with the server's existing settings (frequency, minimum buffer, settings
9
9
  * id). Called from the cash management overview page-fetch epic alongside
10
10
  * the other top-level fetches.
11
- *
12
- * TODO: switch the endpoint to a base URL constant once the prod endpoint
13
- * lands; right now this hits the dev environment directly.
14
11
  */
15
- export const fetchCashManagementSettingsEpic = (actions$, _state$, zeniAPI) => actions$.pipe(filter(fetchCashManagementSettings.match), switchMap(() => zeniAPI
16
- .getJSON(`https://dev.api.zeni.ai/cash-management-agent/1.0/cash-management/settings`)
17
- .pipe(mergeMap((response) => {
18
- if (isSuccessResponse(response) && response.data != null) {
19
- return of(
20
- // Publish the source deposit account into the shared entity
21
- // bucket so the selector can hydrate the full `FundingAccount`
22
- // from `getDepositAccountByDepositAccountId` rather than the
23
- // auto-sweep slice holding a duplicate copy.
24
- updateDepositAccounts([response.data.source_bank_account]), updateCashManagementSettings({ data: response.data }));
25
- }
26
- return of(updateCashManagementSettingsFetchStatus({
12
+ export const fetchCashManagementSettingsEpic = (actions$, _state$, zeniAPI) => actions$.pipe(filter(fetchCashManagementSettings.match), switchMap(() => {
13
+ const endpoint = `${zeniAPI.apiEndPoints.cashManagementAgentBaseUrl}/1.0/cash-management/settings`;
14
+ return zeniAPI
15
+ .getJSON(endpoint)
16
+ .pipe(mergeMap((response) => {
17
+ if (isSuccessResponse(response) && response.data != null) {
18
+ return of(
19
+ // Publish the source deposit account into the shared entity
20
+ // bucket so the selector can hydrate the full `FundingAccount`
21
+ // from `getDepositAccountByDepositAccountId` rather than the
22
+ // auto-sweep slice holding a duplicate copy.
23
+ updateDepositAccounts([response.data.source_bank_account]), updateCashManagementSettings({ data: response.data }));
24
+ }
25
+ return of(updateCashManagementSettingsFetchStatus({
26
+ fetchState: 'Error',
27
+ error: response.status,
28
+ }));
29
+ }), catchError((error) => of(updateCashManagementSettingsFetchStatus({
27
30
  fetchState: 'Error',
28
- error: response.status,
29
- }));
30
- }), catchError((error) => of(updateCashManagementSettingsFetchStatus({
31
- fetchState: 'Error',
32
- error: createZeniAPIStatus('Unexpected Error', 'Fetch cash management settings REST API call errored out' +
33
- JSON.stringify(error)),
34
- }))))));
31
+ error: createZeniAPIStatus('Unexpected Error', 'Fetch cash management settings REST API call errored out: ' +
32
+ (error?.message ?? String(error))),
33
+ }))));
34
+ }));
@@ -3,8 +3,8 @@ import { catchError, filter, mergeMap, switchMap } from 'rxjs/operators';
3
3
  import { createZeniAPIStatus, isSuccessResponse, } from '../../../../../responsePayload';
4
4
  import { toSaveAutoSweepSettingsBody, } from '../autoSweepFlowPayload';
5
5
  import { saveAutoSweepSettings, updateAutoSweepSettingsFetchStatus, } from '../autoSweepFlowReducer';
6
- const SETTINGS_ENDPOINT = 'https://dev.api.zeni.ai/cash-management-agent/1.0/cash-management/settings';
7
6
  export const saveAutoSweepSettingsEpic = (actions$, state$, zeniAPI) => actions$.pipe(filter(saveAutoSweepSettings.match), switchMap(() => {
7
+ const endpoint = `${zeniAPI.apiEndPoints.cashManagementAgentBaseUrl}/1.0/cash-management/settings`;
8
8
  const { bufferAmount, frequency, memo, settingsId } = state$.value.autoSweepFlowState;
9
9
  const payload = toSaveAutoSweepSettingsBody({
10
10
  bufferAmount,
@@ -14,19 +14,19 @@ export const saveAutoSweepSettingsEpic = (actions$, state$, zeniAPI) => actions$
14
14
  // First-time setup (no settings id from the GET yet) → POST a new
15
15
  // record. Subsequent edits update the existing one via PUT.
16
16
  const request$ = settingsId == null
17
- ? zeniAPI.postAndGetJSON(SETTINGS_ENDPOINT, payload)
18
- : zeniAPI.putAndGetJSON(SETTINGS_ENDPOINT, payload);
17
+ ? zeniAPI.postAndGetJSON(endpoint, payload)
18
+ : zeniAPI.putAndGetJSON(endpoint, payload);
19
19
  return request$.pipe(mergeMap((response) => {
20
- if (isSuccessResponse(response)) {
20
+ if (isSuccessResponse(response) && response.data != null) {
21
21
  return of(updateAutoSweepSettingsFetchStatus({ fetchState: 'Completed' }));
22
22
  }
23
23
  return of(updateAutoSweepSettingsFetchStatus({
24
24
  fetchState: 'Error',
25
- error: response.status,
25
+ error: response?.status,
26
26
  }));
27
27
  }), catchError((error) => of(updateAutoSweepSettingsFetchStatus({
28
28
  fetchState: 'Error',
29
- error: createZeniAPIStatus('Unexpected Error', 'Save auto-sweep settings REST API call errored out' +
30
- JSON.stringify(error)),
29
+ error: createZeniAPIStatus('Unexpected Error', 'Save auto-sweep settings REST API call errored out: ' +
30
+ (error?.message ?? String(error))),
31
31
  }))));
32
32
  }));
@@ -3,10 +3,14 @@ import { date as zeniDate } from '../../../../zeniDayJS';
3
3
  // ---------------------------------------------------------------------------
4
4
  // Converters
5
5
  // ---------------------------------------------------------------------------
6
+ // The cash agent payload reports `currency_code` only; the v1 surface is
7
+ // USD-only, so we pair it with the canonical `$` symbol here. If the agent
8
+ // grows multi-currency support, this is the single place to widen.
9
+ const CASH_AGENT_CURRENCY_SYMBOL = '$';
6
10
  export const toUpcomingPaymentEvent = (event) => ({
7
11
  accountId: event.account_id,
8
12
  accountType: event.account_type,
9
- amount: toAmount(event.amount_usd, event.currency_code),
13
+ amount: toAmount(event.amount_usd, event.currency_code, CASH_AGENT_CURRENCY_SYMBOL),
10
14
  label: event.label,
11
15
  paymentDate: zeniDate(event.payment_date),
12
16
  });
@@ -18,7 +22,7 @@ export const toUpcomingPaymentEvent = (event) => ({
18
22
  * state type a plain `ID` (string) without losing information.
19
23
  */
20
24
  const toCashManagementMovement = (payload) => ({
21
- amount: toAmount(payload.amount, payload.currency_code),
25
+ amount: toAmount(payload.amount, payload.currency_code, CASH_AGENT_CURRENCY_SYMBOL),
22
26
  destinationBankAccountId: payload.destination_bank_account_id ?? '',
23
27
  destinationBankAccountType: payload.destination_bank_account_type,
24
28
  reasoning: payload.reasoning,
@@ -3,11 +3,6 @@ import { toCashManagementBannerData, } from './cashManagementOverviewPayload';
3
3
  import { initialCashManagementBannerState, } from './cashManagementOverviewState';
4
4
  export const initialState = {
5
5
  banner: initialCashManagementBannerState,
6
- fetchState: 'Not-Started',
7
- error: undefined,
8
- hasValidState() {
9
- return this.fetchState == 'Completed';
10
- },
11
6
  };
12
7
  const cashManagementOverview = createSlice({
13
8
  name: 'cashManagementOverview',
@@ -20,11 +15,11 @@ const cashManagementOverview = createSlice({
20
15
  },
21
16
  },
22
17
  fetchCashManagementBanner(draft) {
23
- draft.banner = {
24
- ...initialCashManagementBannerState,
25
- fetchState: 'In-Progress',
26
- error: undefined,
27
- };
18
+ // Keep `draft.banner.data` so the projection chart renders the last
19
+ // good payload while the refetch is in flight, instead of flickering
20
+ // to the empty/skeleton state on every page revisit.
21
+ draft.banner.fetchState = 'In-Progress';
22
+ draft.banner.error = undefined;
28
23
  },
29
24
  updateCashManagementBanner(draft, action) {
30
25
  draft.banner = {
@@ -101,7 +101,19 @@ const buildProjectionData = (cashBalance, inflowEvents, outflowEvents) => {
101
101
  date: e.paymentDate,
102
102
  isInflow: false,
103
103
  })),
104
- ].sort((a, b) => a.date.valueOf() - b.date.valueOf());
104
+ ].sort((a, b) => {
105
+ const diff = a.date.valueOf() - b.date.valueOf();
106
+ if (diff !== 0) {
107
+ return diff;
108
+ }
109
+ // Same-day tie-breaker: apply outflows before inflows so the projection
110
+ // shows the worst-case low first, then the recovery — matches the
111
+ // "show me the dip" framing on the cash management overview.
112
+ if (a.isInflow === b.isInflow) {
113
+ return 0;
114
+ }
115
+ return a.isInflow ? 1 : -1;
116
+ });
105
117
  let balance = cashBalance;
106
118
  const points = [{ balance, date: 'Today' }];
107
119
  events.forEach((event) => {
@@ -7,22 +7,21 @@ import { fetchCashManagementBanner, updateCashManagementBanner, updateCashManage
7
7
  * the banner state — `inflows[]`, `outflows[]`, and `money_movements[]` all
8
8
  * live there, so consumers can read them directly without an entity-bucket
9
9
  * lookup.
10
- *
11
- * TODO: switch the endpoint to a base URL constant once the prod endpoint
12
- * lands; right now this hits the dev environment directly.
13
10
  */
14
- export const fetchCashManagementBannerEpic = (actions$, _state$, zeniAPI) => actions$.pipe(filter(fetchCashManagementBanner.match), switchMap(() => zeniAPI
15
- .getJSON(`https://dev.api.zeni.ai/cash-management-agent/1.0/cash-agent/recommend?horizon_days=30`)
16
- .pipe(mergeMap((response) => {
17
- if (isSuccessResponse(response) && response.data != null) {
18
- return of(updateCashManagementBanner({ data: response.data }));
19
- }
20
- return of(updateCashManagementBannerFetchStatus({
11
+ const DEFAULT_RECOMMEND_HORIZON_DAYS = 30;
12
+ export const fetchCashManagementBannerEpic = (actions$, _state$, zeniAPI) => actions$.pipe(filter(fetchCashManagementBanner.match), switchMap(() => {
13
+ const endpoint = `${zeniAPI.apiEndPoints.cashManagementAgentBaseUrl}/1.0/cash-agent/recommend?horizon_days=${DEFAULT_RECOMMEND_HORIZON_DAYS}`;
14
+ return zeniAPI.getJSON(endpoint).pipe(mergeMap((response) => {
15
+ if (isSuccessResponse(response) && response.data != null) {
16
+ return of(updateCashManagementBanner({ data: response.data }));
17
+ }
18
+ return of(updateCashManagementBannerFetchStatus({
19
+ fetchState: 'Error',
20
+ error: response.status,
21
+ }));
22
+ }), catchError((error) => of(updateCashManagementBannerFetchStatus({
21
23
  fetchState: 'Error',
22
- error: response.status,
23
- }));
24
- }), catchError((error) => of(updateCashManagementBannerFetchStatus({
25
- fetchState: 'Error',
26
- error: createZeniAPIStatus('Unexpected Error', 'Fetch cash management banner REST API call errored out' +
27
- JSON.stringify(error)),
28
- }))))));
24
+ error: createZeniAPIStatus('Unexpected Error', 'Fetch cash management banner REST API call errored out: ' +
25
+ (error?.message ?? String(error))),
26
+ }))));
27
+ }));
@@ -18,6 +18,9 @@ export const fetchCashManagementOverviewPageEpic = (actions$, state$) => actions
18
18
  treasuryDetailState.fetchState !== 'In-Progress') {
19
19
  pageActions.push(fetchTreasuryOverviewDetail(false));
20
20
  }
21
+ // zeniAccountListState has no top-level fetchState to dedup against
22
+ // (only `newCheckingAccount.fetchState`), and the downstream epic is
23
+ // cheap. Always re-dispatch so the summary stays fresh on page entry.
21
24
  pageActions.push(fetchZeniAccountList(false));
22
25
  const banner = state.cashManagementOverviewState.banner;
23
26
  if (banner.fetchState !== 'Completed' &&
package/lib/index.d.ts CHANGED
@@ -943,5 +943,6 @@ export { getAutoSweepFlow } from './view/spendManagement/cashManagement/autoSwee
943
943
  export type { AutoSweepFlowFormData, AutoSweepFlowSelectorView, } from './view/spendManagement/cashManagement/autoSweepFlow/autoSweepFlowSelector';
944
944
  export { RISK_BUFFER_AMOUNT, bufferAmountToRisk, } from './view/spendManagement/cashManagement/autoSweepFlow/autoSweepFlowState';
945
945
  export type { AutoSweepFlowState, AutoSweepFrequency, RiskLevel, } from './view/spendManagement/cashManagement/autoSweepFlow/autoSweepFlowState';
946
- export { CashManagementOverviewBannerSelectorView, CashManagementOverviewSelectorView, CashProjectionPoint, getCashManagementOverview, getCashManagementOverviewBanner, } from './view/spendManagement/cashManagement/cashManagementOverview/cashManagementOverviewSelector';
946
+ export { getCashManagementOverview, getCashManagementOverviewBanner, } from './view/spendManagement/cashManagement/cashManagementOverview/cashManagementOverviewSelector';
947
+ export type { CashManagementOverviewBannerSelectorView, CashManagementOverviewSelectorView, CashProjectionPoint, } from './view/spendManagement/cashManagement/cashManagementOverview/cashManagementOverviewSelector';
947
948
  export type { UpcomingPaymentEvent, UpcomingPaymentEventAccountType, } from './view/spendManagement/cashManagement/cashManagementOverview/cashManagementOverviewState';
@@ -11,13 +11,11 @@ const setupViewSelector_1 = require("../commonSetup/setupViewSelector");
11
11
  const depositAccountListSelector_1 = require("../zeniAccounts/depositAccountList/depositAccountListSelector");
12
12
  const paymentAccountListSelector_1 = require("../zeniAccounts/paymentAccountList/paymentAccountListSelector");
13
13
  const buildCashManagementRule = (autoSweepFlowState, depositAccountState, treasuryDetailState) => {
14
- const { settingsId, bufferAmount, frequency, memo, primaryFundingAccountId } = autoSweepFlowState;
15
- if (settingsId == null) {
14
+ const { settingsId, bufferAmount, frequency, memo, primaryFundingAccountId, nextTransferDate } = autoSweepFlowState;
15
+ if (settingsId == null || primaryFundingAccountId == null) {
16
16
  return undefined;
17
17
  }
18
- const depositAccount = primaryFundingAccountId != null
19
- ? (0, depositAccountSelector_1.getDepositAccountByDepositAccountId)(depositAccountState, primaryFundingAccountId)
20
- : undefined;
18
+ const depositAccount = (0, depositAccountSelector_1.getDepositAccountByDepositAccountId)(depositAccountState, primaryFundingAccountId);
21
19
  return {
22
20
  bufferAmount,
23
21
  frequency,
@@ -27,6 +25,7 @@ const buildCashManagementRule = (autoSweepFlowState, depositAccountState, treasu
27
25
  ? (0, setupViewSelector_1.mapDepositAccToFundingAccount)(depositAccount)
28
26
  : undefined,
29
27
  treasurySummary: treasuryDetailState.accountSummary,
28
+ nextTransferDate,
30
29
  };
31
30
  };
32
31
  const getAutoTransferRules = (state) => {
@@ -45,6 +45,7 @@ export interface CashManagementRule {
45
45
  frequency: AutoSweepFrequency;
46
46
  memo: string;
47
47
  settingsId: ID;
48
+ nextTransferDate?: ZeniDate;
48
49
  primaryFundingAccount?: FundingAccount;
49
50
  treasurySummary?: TreasurySummaryWithBalance;
50
51
  }
@@ -2,6 +2,7 @@ import { Amount } from '../../../../commonStateTypes/amount';
2
2
  import { ID } from '../../../../commonStateTypes/common';
3
3
  import { DepositAccountPayload } from '../../../../entity/depositAccount/depositAccountPayload';
4
4
  import { ZeniAPIResponse } from '../../../../responsePayload';
5
+ import { ZeniDate } from '../../../../zeniDayJS';
5
6
  import { AutoSweepFlowState, AutoSweepFrequency } from './autoSweepFlowState';
6
7
  /**
7
8
  * Body sent to `PUT /cash-management/settings`. Field names match the
@@ -26,6 +27,7 @@ export interface CashManagementSettingsPayload {
26
27
  cash_management_settings_id: string | null;
27
28
  frequency: string;
28
29
  minimum_buffer_usd: number;
30
+ next_transfer_date: string;
29
31
  source_bank_account: DepositAccountPayload;
30
32
  }
31
33
  export type CashManagementSettingsResponse = ZeniAPIResponse<CashManagementSettingsPayload>;
@@ -40,6 +42,7 @@ export type CashManagementSettingsResponse = ZeniAPIResponse<CashManagementSetti
40
42
  export declare const toAutoSweepFlowStatePatch: (payload: CashManagementSettingsPayload) => {
41
43
  bufferAmount: Amount;
42
44
  frequency: AutoSweepFrequency;
45
+ nextTransferDate?: ZeniDate;
43
46
  primaryFundingAccountId?: ID;
44
47
  settingsId?: ID;
45
48
  };
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.toAutoSweepFlowStatePatch = exports.toSaveAutoSweepSettingsBody = void 0;
4
4
  const amount_1 = require("../../../../commonStateTypes/amount");
5
5
  const workingDayHelper_1 = require("../../../../commonStateTypes/workingDayHelper");
6
+ const zeniDayJS_1 = require("../../../../zeniDayJS");
6
7
  const autoSweepFlowState_1 = require("./autoSweepFlowState");
7
8
  const toSaveAutoSweepSettingsBody = (state) => ({
8
9
  first_run_date: (0, workingDayHelper_1.getNextTransferDate)(state.frequency).format('YYYY-MM-DD'),
@@ -25,6 +26,9 @@ const toAutoSweepFlowStatePatch = (payload) => {
25
26
  return {
26
27
  bufferAmount: (0, amount_1.toAmount)(payload.minimum_buffer_usd, currencyCode ?? 'USD', currencySymbol ?? '$'),
27
28
  frequency: (0, autoSweepFlowState_1.toAutoSweepFrequency)(payload.frequency) ?? 'weekly',
29
+ nextTransferDate: payload.next_transfer_date != null && payload.next_transfer_date !== ''
30
+ ? (0, zeniDayJS_1.date)(payload.next_transfer_date)
31
+ : undefined,
28
32
  primaryFundingAccountId: payload.source_bank_account.deposit_account_id ?? undefined,
29
33
  settingsId: payload.cash_management_settings_id ?? undefined,
30
34
  };
@@ -26,6 +26,7 @@ const autoSweepFlow = (0, toolkit_1.createSlice)({
26
26
  const patch = (0, autoSweepFlowPayload_1.toAutoSweepFlowStatePatch)(action.payload.data);
27
27
  draft.bufferAmount = patch.bufferAmount;
28
28
  draft.frequency = patch.frequency;
29
+ draft.nextTransferDate = patch.nextTransferDate;
29
30
  draft.primaryFundingAccountId = patch.primaryFundingAccountId;
30
31
  draft.settingsId = patch.settingsId;
31
32
  draft.fetchState = 'Completed';
@@ -1,5 +1,6 @@
1
1
  import { Amount } from '../../../../commonStateTypes/amount';
2
2
  import { FetchStateAndError, ID } from '../../../../commonStateTypes/common';
3
+ import { ZeniDate } from '../../../../zeniDayJS';
3
4
  /**
4
5
  * Cadence at which the auto-sweep transfer fires. Lowercase to match the
5
6
  * cash-management settings API contract (and the `SweepFrequency` literal
@@ -29,6 +30,7 @@ export interface AutoSweepFlowState extends FetchStateAndError {
29
30
  frequency: AutoSweepFrequency;
30
31
  memo: string;
31
32
  saveStatus: FetchStateAndError;
33
+ nextTransferDate?: ZeniDate;
32
34
  primaryFundingAccountId?: ID;
33
35
  settingsId?: ID;
34
36
  }
@@ -41,10 +41,11 @@ const bufferAmountToRisk = (amount) => {
41
41
  };
42
42
  exports.bufferAmountToRisk = bufferAmountToRisk;
43
43
  exports.initialAutoSweepFlowState = {
44
- bufferAmount: (0, amount_1.toAmount)(10000, 'USD'),
44
+ bufferAmount: (0, amount_1.toAmount)(10000, 'USD', '$'),
45
45
  frequency: 'weekly',
46
46
  memo: '',
47
47
  saveStatus: { fetchState: 'Not-Started', error: undefined },
48
+ nextTransferDate: undefined,
48
49
  primaryFundingAccountId: undefined,
49
50
  settingsId: undefined,
50
51
  fetchState: 'Not-Started',
@@ -10,8 +10,5 @@ export type ActionType = ReturnType<typeof fetchCashManagementSettings> | Return
10
10
  * with the server's existing settings (frequency, minimum buffer, settings
11
11
  * id). Called from the cash management overview page-fetch epic alongside
12
12
  * the other top-level fetches.
13
- *
14
- * TODO: switch the endpoint to a base URL constant once the prod endpoint
15
- * lands; right now this hits the dev environment directly.
16
13
  */
17
14
  export declare const fetchCashManagementSettingsEpic: (actions$: ActionsObservable<ActionType>, _state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
@@ -11,28 +11,28 @@ const autoSweepFlowReducer_1 = require("../autoSweepFlowReducer");
11
11
  * with the server's existing settings (frequency, minimum buffer, settings
12
12
  * id). Called from the cash management overview page-fetch epic alongside
13
13
  * the other top-level fetches.
14
- *
15
- * TODO: switch the endpoint to a base URL constant once the prod endpoint
16
- * lands; right now this hits the dev environment directly.
17
14
  */
18
- const fetchCashManagementSettingsEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(autoSweepFlowReducer_1.fetchCashManagementSettings.match), (0, operators_1.switchMap)(() => zeniAPI
19
- .getJSON(`https://dev.api.zeni.ai/cash-management-agent/1.0/cash-management/settings`)
20
- .pipe((0, operators_1.mergeMap)((response) => {
21
- if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
22
- return (0, rxjs_1.of)(
23
- // Publish the source deposit account into the shared entity
24
- // bucket so the selector can hydrate the full `FundingAccount`
25
- // from `getDepositAccountByDepositAccountId` rather than the
26
- // auto-sweep slice holding a duplicate copy.
27
- (0, depositAccountReducer_1.updateDepositAccounts)([response.data.source_bank_account]), (0, autoSweepFlowReducer_1.updateCashManagementSettings)({ data: response.data }));
28
- }
29
- return (0, rxjs_1.of)((0, autoSweepFlowReducer_1.updateCashManagementSettingsFetchStatus)({
15
+ const fetchCashManagementSettingsEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(autoSweepFlowReducer_1.fetchCashManagementSettings.match), (0, operators_1.switchMap)(() => {
16
+ const endpoint = `${zeniAPI.apiEndPoints.cashManagementAgentBaseUrl}/1.0/cash-management/settings`;
17
+ return zeniAPI
18
+ .getJSON(endpoint)
19
+ .pipe((0, operators_1.mergeMap)((response) => {
20
+ if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
21
+ return (0, rxjs_1.of)(
22
+ // Publish the source deposit account into the shared entity
23
+ // bucket so the selector can hydrate the full `FundingAccount`
24
+ // from `getDepositAccountByDepositAccountId` rather than the
25
+ // auto-sweep slice holding a duplicate copy.
26
+ (0, depositAccountReducer_1.updateDepositAccounts)([response.data.source_bank_account]), (0, autoSweepFlowReducer_1.updateCashManagementSettings)({ data: response.data }));
27
+ }
28
+ return (0, rxjs_1.of)((0, autoSweepFlowReducer_1.updateCashManagementSettingsFetchStatus)({
29
+ fetchState: 'Error',
30
+ error: response.status,
31
+ }));
32
+ }), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, autoSweepFlowReducer_1.updateCashManagementSettingsFetchStatus)({
30
33
  fetchState: 'Error',
31
- error: response.status,
32
- }));
33
- }), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, autoSweepFlowReducer_1.updateCashManagementSettingsFetchStatus)({
34
- fetchState: 'Error',
35
- error: (0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Fetch cash management settings REST API call errored out' +
36
- JSON.stringify(error)),
37
- }))))));
34
+ error: (0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Fetch cash management settings REST API call errored out: ' +
35
+ (error?.message ?? String(error))),
36
+ }))));
37
+ }));
38
38
  exports.fetchCashManagementSettingsEpic = fetchCashManagementSettingsEpic;
@@ -6,8 +6,8 @@ const operators_1 = require("rxjs/operators");
6
6
  const responsePayload_1 = require("../../../../../responsePayload");
7
7
  const autoSweepFlowPayload_1 = require("../autoSweepFlowPayload");
8
8
  const autoSweepFlowReducer_1 = require("../autoSweepFlowReducer");
9
- const SETTINGS_ENDPOINT = 'https://dev.api.zeni.ai/cash-management-agent/1.0/cash-management/settings';
10
9
  const saveAutoSweepSettingsEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(autoSweepFlowReducer_1.saveAutoSweepSettings.match), (0, operators_1.switchMap)(() => {
10
+ const endpoint = `${zeniAPI.apiEndPoints.cashManagementAgentBaseUrl}/1.0/cash-management/settings`;
11
11
  const { bufferAmount, frequency, memo, settingsId } = state$.value.autoSweepFlowState;
12
12
  const payload = (0, autoSweepFlowPayload_1.toSaveAutoSweepSettingsBody)({
13
13
  bufferAmount,
@@ -17,20 +17,20 @@ const saveAutoSweepSettingsEpic = (actions$, state$, zeniAPI) => actions$.pipe((
17
17
  // First-time setup (no settings id from the GET yet) → POST a new
18
18
  // record. Subsequent edits update the existing one via PUT.
19
19
  const request$ = settingsId == null
20
- ? zeniAPI.postAndGetJSON(SETTINGS_ENDPOINT, payload)
21
- : zeniAPI.putAndGetJSON(SETTINGS_ENDPOINT, payload);
20
+ ? zeniAPI.postAndGetJSON(endpoint, payload)
21
+ : zeniAPI.putAndGetJSON(endpoint, payload);
22
22
  return request$.pipe((0, operators_1.mergeMap)((response) => {
23
- if ((0, responsePayload_1.isSuccessResponse)(response)) {
23
+ if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
24
24
  return (0, rxjs_1.of)((0, autoSweepFlowReducer_1.updateAutoSweepSettingsFetchStatus)({ fetchState: 'Completed' }));
25
25
  }
26
26
  return (0, rxjs_1.of)((0, autoSweepFlowReducer_1.updateAutoSweepSettingsFetchStatus)({
27
27
  fetchState: 'Error',
28
- error: response.status,
28
+ error: response?.status,
29
29
  }));
30
30
  }), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, autoSweepFlowReducer_1.updateAutoSweepSettingsFetchStatus)({
31
31
  fetchState: 'Error',
32
- error: (0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Save auto-sweep settings REST API call errored out' +
33
- JSON.stringify(error)),
32
+ error: (0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Save auto-sweep settings REST API call errored out: ' +
33
+ (error?.message ?? String(error))),
34
34
  }))));
35
35
  }));
36
36
  exports.saveAutoSweepSettingsEpic = saveAutoSweepSettingsEpic;
@@ -6,10 +6,14 @@ const zeniDayJS_1 = require("../../../../zeniDayJS");
6
6
  // ---------------------------------------------------------------------------
7
7
  // Converters
8
8
  // ---------------------------------------------------------------------------
9
+ // The cash agent payload reports `currency_code` only; the v1 surface is
10
+ // USD-only, so we pair it with the canonical `$` symbol here. If the agent
11
+ // grows multi-currency support, this is the single place to widen.
12
+ const CASH_AGENT_CURRENCY_SYMBOL = '$';
9
13
  const toUpcomingPaymentEvent = (event) => ({
10
14
  accountId: event.account_id,
11
15
  accountType: event.account_type,
12
- amount: (0, amount_1.toAmount)(event.amount_usd, event.currency_code),
16
+ amount: (0, amount_1.toAmount)(event.amount_usd, event.currency_code, CASH_AGENT_CURRENCY_SYMBOL),
13
17
  label: event.label,
14
18
  paymentDate: (0, zeniDayJS_1.date)(event.payment_date),
15
19
  });
@@ -22,7 +26,7 @@ exports.toUpcomingPaymentEvent = toUpcomingPaymentEvent;
22
26
  * state type a plain `ID` (string) without losing information.
23
27
  */
24
28
  const toCashManagementMovement = (payload) => ({
25
- amount: (0, amount_1.toAmount)(payload.amount, payload.currency_code),
29
+ amount: (0, amount_1.toAmount)(payload.amount, payload.currency_code, CASH_AGENT_CURRENCY_SYMBOL),
26
30
  destinationBankAccountId: payload.destination_bank_account_id ?? '',
27
31
  destinationBankAccountType: payload.destination_bank_account_type,
28
32
  reasoning: payload.reasoning,
@@ -7,11 +7,6 @@ const cashManagementOverviewPayload_1 = require("./cashManagementOverviewPayload
7
7
  const cashManagementOverviewState_1 = require("./cashManagementOverviewState");
8
8
  exports.initialState = {
9
9
  banner: cashManagementOverviewState_1.initialCashManagementBannerState,
10
- fetchState: 'Not-Started',
11
- error: undefined,
12
- hasValidState() {
13
- return this.fetchState == 'Completed';
14
- },
15
10
  };
16
11
  const cashManagementOverview = (0, toolkit_1.createSlice)({
17
12
  name: 'cashManagementOverview',
@@ -24,11 +19,11 @@ const cashManagementOverview = (0, toolkit_1.createSlice)({
24
19
  },
25
20
  },
26
21
  fetchCashManagementBanner(draft) {
27
- draft.banner = {
28
- ...cashManagementOverviewState_1.initialCashManagementBannerState,
29
- fetchState: 'In-Progress',
30
- error: undefined,
31
- };
22
+ // Keep `draft.banner.data` so the projection chart renders the last
23
+ // good payload while the refetch is in flight, instead of flickering
24
+ // to the empty/skeleton state on every page revisit.
25
+ draft.banner.fetchState = 'In-Progress';
26
+ draft.banner.error = undefined;
32
27
  },
33
28
  updateCashManagementBanner(draft, action) {
34
29
  draft.banner = {
@@ -106,7 +106,19 @@ const buildProjectionData = (cashBalance, inflowEvents, outflowEvents) => {
106
106
  date: e.paymentDate,
107
107
  isInflow: false,
108
108
  })),
109
- ].sort((a, b) => a.date.valueOf() - b.date.valueOf());
109
+ ].sort((a, b) => {
110
+ const diff = a.date.valueOf() - b.date.valueOf();
111
+ if (diff !== 0) {
112
+ return diff;
113
+ }
114
+ // Same-day tie-breaker: apply outflows before inflows so the projection
115
+ // shows the worst-case low first, then the recovery — matches the
116
+ // "show me the dip" framing on the cash management overview.
117
+ if (a.isInflow === b.isInflow) {
118
+ return 0;
119
+ }
120
+ return a.isInflow ? 1 : -1;
121
+ });
110
122
  let balance = cashBalance;
111
123
  const points = [{ balance, date: 'Today' }];
112
124
  events.forEach((event) => {
@@ -1,5 +1,5 @@
1
1
  import { Amount } from '../../../../commonStateTypes/amount';
2
- import { FetchStateAndError, FetchedState, ID } from '../../../../commonStateTypes/common';
2
+ import { FetchStateAndError, ID } from '../../../../commonStateTypes/common';
3
3
  import { ZeniDate } from '../../../../zeniDayJS';
4
4
  /**
5
5
  * Bank account types the cash agent reports against. Kept as a string union so
@@ -65,7 +65,11 @@ export interface CashManagementBannerData {
65
65
  export interface CashManagementBannerState extends FetchStateAndError {
66
66
  data?: CashManagementBannerData;
67
67
  }
68
- export interface CashManagementOverviewState extends FetchedState {
68
+ /**
69
+ * The slice's effective fetch state is the banner's — consumers should query
70
+ * `banner.fetchState` rather than a duplicate top-level field.
71
+ */
72
+ export interface CashManagementOverviewState {
69
73
  banner: CashManagementBannerState;
70
74
  }
71
75
  export declare const initialCashManagementBannerState: CashManagementBannerState;
@@ -4,13 +4,4 @@ import { RootState } from '../../../../../reducer';
4
4
  import { ZeniAPI } from '../../../../../zeniAPI';
5
5
  import { fetchCashManagementBanner, updateCashManagementBanner, updateCashManagementBannerFetchStatus } from '../cashManagementOverviewReducer';
6
6
  export type ActionType = ReturnType<typeof fetchCashManagementBanner> | ReturnType<typeof updateCashManagementBanner> | ReturnType<typeof updateCashManagementBannerFetchStatus>;
7
- /**
8
- * Hits the cash agent's recommend endpoint and stores the full response on
9
- * the banner state — `inflows[]`, `outflows[]`, and `money_movements[]` all
10
- * live there, so consumers can read them directly without an entity-bucket
11
- * lookup.
12
- *
13
- * TODO: switch the endpoint to a base URL constant once the prod endpoint
14
- * lands; right now this hits the dev environment directly.
15
- */
16
7
  export declare const fetchCashManagementBannerEpic: (actions$: ActionsObservable<ActionType>, _state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
@@ -10,23 +10,22 @@ const cashManagementOverviewReducer_1 = require("../cashManagementOverviewReduce
10
10
  * the banner state — `inflows[]`, `outflows[]`, and `money_movements[]` all
11
11
  * live there, so consumers can read them directly without an entity-bucket
12
12
  * lookup.
13
- *
14
- * TODO: switch the endpoint to a base URL constant once the prod endpoint
15
- * lands; right now this hits the dev environment directly.
16
13
  */
17
- const fetchCashManagementBannerEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(cashManagementOverviewReducer_1.fetchCashManagementBanner.match), (0, operators_1.switchMap)(() => zeniAPI
18
- .getJSON(`https://dev.api.zeni.ai/cash-management-agent/1.0/cash-agent/recommend?horizon_days=30`)
19
- .pipe((0, operators_1.mergeMap)((response) => {
20
- if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
21
- return (0, rxjs_1.of)((0, cashManagementOverviewReducer_1.updateCashManagementBanner)({ data: response.data }));
22
- }
23
- return (0, rxjs_1.of)((0, cashManagementOverviewReducer_1.updateCashManagementBannerFetchStatus)({
14
+ const DEFAULT_RECOMMEND_HORIZON_DAYS = 30;
15
+ const fetchCashManagementBannerEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(cashManagementOverviewReducer_1.fetchCashManagementBanner.match), (0, operators_1.switchMap)(() => {
16
+ const endpoint = `${zeniAPI.apiEndPoints.cashManagementAgentBaseUrl}/1.0/cash-agent/recommend?horizon_days=${DEFAULT_RECOMMEND_HORIZON_DAYS}`;
17
+ return zeniAPI.getJSON(endpoint).pipe((0, operators_1.mergeMap)((response) => {
18
+ if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
19
+ return (0, rxjs_1.of)((0, cashManagementOverviewReducer_1.updateCashManagementBanner)({ data: response.data }));
20
+ }
21
+ return (0, rxjs_1.of)((0, cashManagementOverviewReducer_1.updateCashManagementBannerFetchStatus)({
22
+ fetchState: 'Error',
23
+ error: response.status,
24
+ }));
25
+ }), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, cashManagementOverviewReducer_1.updateCashManagementBannerFetchStatus)({
24
26
  fetchState: 'Error',
25
- error: response.status,
26
- }));
27
- }), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, cashManagementOverviewReducer_1.updateCashManagementBannerFetchStatus)({
28
- fetchState: 'Error',
29
- error: (0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Fetch cash management banner REST API call errored out' +
30
- JSON.stringify(error)),
31
- }))))));
27
+ error: (0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Fetch cash management banner REST API call errored out: ' +
28
+ (error?.message ?? String(error))),
29
+ }))));
30
+ }));
32
31
  exports.fetchCashManagementBannerEpic = fetchCashManagementBannerEpic;
@@ -21,6 +21,9 @@ const fetchCashManagementOverviewPageEpic = (actions$, state$) => actions$.pipe(
21
21
  treasuryDetailState.fetchState !== 'In-Progress') {
22
22
  pageActions.push((0, treasuryDetailReducer_1.fetchTreasuryOverviewDetail)(false));
23
23
  }
24
+ // zeniAccountListState has no top-level fetchState to dedup against
25
+ // (only `newCheckingAccount.fetchState`), and the downstream epic is
26
+ // cheap. Always re-dispatch so the summary stays fresh on page entry.
24
27
  pageActions.push((0, zeniAccountListReducer_1.fetchZeniAccountList)(false));
25
28
  const banner = state.cashManagementOverviewState.banner;
26
29
  if (banner.fetchState !== 'Completed' &&
package/lib/zeniAPI.d.ts CHANGED
@@ -10,6 +10,7 @@ export interface RESTAPIEndpoints {
10
10
  readonly authMicroServiceBaseUrl: string;
11
11
  readonly bankingMicroServiceBaseUrl: string;
12
12
  readonly cardMicroServiceBaseUrl: string;
13
+ readonly cashManagementAgentBaseUrl: string;
13
14
  readonly communicationAgentMicroServiceBaseUrl: string;
14
15
  readonly documentAIMicroServiceBaseUrl: string;
15
16
  readonly fileMicroServiceBaseUrl: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zeniai/client-epic-state",
3
- "version": "5.0.84-betaAK1",
3
+ "version": "5.0.84-betaAK3",
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",