@zeniai/client-epic-state 5.1.52-beta0RD → 5.1.52

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 (74) hide show
  1. package/lib/commonStateTypes/amount.d.ts +1 -0
  2. package/lib/commonStateTypes/amount.js +9 -1
  3. package/lib/commonStateTypes/workingDayHelper.d.ts +4 -3
  4. package/lib/commonStateTypes/workingDayHelper.js +4 -3
  5. package/lib/entity/aiCfo/aiCfoPayload.d.ts +0 -1
  6. package/lib/entity/aiCfo/aiCfoReducer.js +1 -3
  7. package/lib/entity/aiCfo/aiCfoState.d.ts +0 -1
  8. package/lib/entity/tenant/clearAllEpic.d.ts +3 -1
  9. package/lib/entity/tenant/clearAllEpic.js +4 -0
  10. package/lib/epic.d.ts +7 -1
  11. package/lib/epic.js +7 -1
  12. package/lib/esm/commonStateTypes/amount.js +7 -0
  13. package/lib/esm/commonStateTypes/workingDayHelper.js +4 -3
  14. package/lib/esm/entity/aiCfo/aiCfoReducer.js +1 -3
  15. package/lib/esm/entity/tenant/clearAllEpic.js +4 -0
  16. package/lib/esm/epic.js +7 -1
  17. package/lib/esm/index.js +5 -0
  18. package/lib/esm/reducer.js +6 -0
  19. package/lib/esm/view/recommendation/fetchEntityRecommendationsForLineUpdateEpic.js +8 -18
  20. package/lib/esm/view/spendManagement/autotransferRules/autoTransferRulesSelector.js +22 -2
  21. package/lib/esm/view/spendManagement/cashManagement/autoSweepFlow/autoSweepFlowPayload.js +29 -0
  22. package/lib/esm/view/spendManagement/cashManagement/autoSweepFlow/autoSweepFlowReducer.js +78 -0
  23. package/lib/esm/view/spendManagement/cashManagement/autoSweepFlow/autoSweepFlowSelector.js +49 -0
  24. package/lib/esm/view/spendManagement/cashManagement/autoSweepFlow/autoSweepFlowState.js +47 -0
  25. package/lib/esm/view/spendManagement/cashManagement/autoSweepFlow/epics/fetchCashManagementSettingsEpic.js +32 -0
  26. package/lib/esm/view/spendManagement/cashManagement/autoSweepFlow/epics/saveAutoSweepSettingsEpic.js +32 -0
  27. package/lib/esm/view/spendManagement/cashManagement/cashManagementOverview/cashManagementOverviewPayload.js +54 -0
  28. package/lib/esm/view/spendManagement/cashManagement/cashManagementOverview/cashManagementOverviewReducer.js +92 -0
  29. package/lib/esm/view/spendManagement/cashManagement/cashManagementOverview/cashManagementOverviewSelector.js +212 -0
  30. package/lib/esm/view/spendManagement/cashManagement/cashManagementOverview/cashManagementOverviewState.js +10 -0
  31. package/lib/esm/view/spendManagement/cashManagement/cashManagementOverview/epics/fetchCashManagementBannerEpic.js +23 -0
  32. package/lib/esm/view/spendManagement/cashManagement/cashManagementOverview/epics/fetchCashManagementOverviewPageEpic.js +36 -0
  33. package/lib/esm/view/spendManagement/cashManagement/cashManagementOverview/epics/fetchCashManagementRecommendationEpic.js +27 -0
  34. package/lib/esm/view/spendManagement/cashManagement/cashManagementOverview/epics/fetchRecentTransferEpic.js +28 -0
  35. package/lib/index.d.ts +10 -1
  36. package/lib/index.js +20 -1
  37. package/lib/reducer.d.ts +6 -0
  38. package/lib/reducer.js +6 -0
  39. package/lib/view/recommendation/fetchEntityRecommendationsForLineUpdateEpic.d.ts +2 -2
  40. package/lib/view/recommendation/fetchEntityRecommendationsForLineUpdateEpic.js +7 -17
  41. package/lib/view/recommendation/recommendationReducer.d.ts +0 -1
  42. package/lib/view/spendManagement/autotransferRules/autoTransferRulesSelector.d.ts +8 -1
  43. package/lib/view/spendManagement/autotransferRules/autoTransferRulesSelector.js +21 -1
  44. package/lib/view/spendManagement/autotransferRules/autoTransferRulesState.d.ts +22 -0
  45. package/lib/view/spendManagement/cashManagement/autoSweepFlow/autoSweepFlowPayload.d.ts +47 -0
  46. package/lib/view/spendManagement/cashManagement/autoSweepFlow/autoSweepFlowPayload.js +34 -0
  47. package/lib/view/spendManagement/cashManagement/autoSweepFlow/autoSweepFlowReducer.d.ts +23 -0
  48. package/lib/view/spendManagement/cashManagement/autoSweepFlow/autoSweepFlowReducer.js +82 -0
  49. package/lib/view/spendManagement/cashManagement/autoSweepFlow/autoSweepFlowSelector.d.ts +40 -0
  50. package/lib/view/spendManagement/cashManagement/autoSweepFlow/autoSweepFlowSelector.js +53 -0
  51. package/lib/view/spendManagement/cashManagement/autoSweepFlow/autoSweepFlowState.d.ts +37 -0
  52. package/lib/view/spendManagement/cashManagement/autoSweepFlow/autoSweepFlowState.js +53 -0
  53. package/lib/view/spendManagement/cashManagement/autoSweepFlow/epics/fetchCashManagementSettingsEpic.d.ts +14 -0
  54. package/lib/view/spendManagement/cashManagement/autoSweepFlow/epics/fetchCashManagementSettingsEpic.js +36 -0
  55. package/lib/view/spendManagement/cashManagement/autoSweepFlow/epics/saveAutoSweepSettingsEpic.d.ts +7 -0
  56. package/lib/view/spendManagement/cashManagement/autoSweepFlow/epics/saveAutoSweepSettingsEpic.js +36 -0
  57. package/lib/view/spendManagement/cashManagement/cashManagementOverview/cashManagementOverviewPayload.d.ts +56 -0
  58. package/lib/view/spendManagement/cashManagement/cashManagementOverview/cashManagementOverviewPayload.js +60 -0
  59. package/lib/view/spendManagement/cashManagement/cashManagementOverview/cashManagementOverviewReducer.d.ts +22 -0
  60. package/lib/view/spendManagement/cashManagement/cashManagementOverview/cashManagementOverviewReducer.js +96 -0
  61. package/lib/view/spendManagement/cashManagement/cashManagementOverview/cashManagementOverviewSelector.d.ts +59 -0
  62. package/lib/view/spendManagement/cashManagement/cashManagementOverview/cashManagementOverviewSelector.js +217 -0
  63. package/lib/view/spendManagement/cashManagement/cashManagementOverview/cashManagementOverviewState.d.ts +122 -0
  64. package/lib/view/spendManagement/cashManagement/cashManagementOverview/cashManagementOverviewState.js +13 -0
  65. package/lib/view/spendManagement/cashManagement/cashManagementOverview/epics/fetchCashManagementBannerEpic.d.ts +7 -0
  66. package/lib/view/spendManagement/cashManagement/cashManagementOverview/epics/fetchCashManagementBannerEpic.js +27 -0
  67. package/lib/view/spendManagement/cashManagement/cashManagementOverview/epics/fetchCashManagementOverviewPageEpic.d.ts +9 -0
  68. package/lib/view/spendManagement/cashManagement/cashManagementOverview/epics/fetchCashManagementOverviewPageEpic.js +40 -0
  69. package/lib/view/spendManagement/cashManagement/cashManagementOverview/epics/fetchCashManagementRecommendationEpic.d.ts +7 -0
  70. package/lib/view/spendManagement/cashManagement/cashManagementOverview/epics/fetchCashManagementRecommendationEpic.js +31 -0
  71. package/lib/view/spendManagement/cashManagement/cashManagementOverview/epics/fetchRecentTransferEpic.d.ts +15 -0
  72. package/lib/view/spendManagement/cashManagement/cashManagementOverview/epics/fetchRecentTransferEpic.js +32 -0
  73. package/lib/zeniAPI.d.ts +1 -0
  74. package/package.json +1 -1
@@ -41,16 +41,6 @@ const fetchEntityRecommendationsForLineUpdateEpic = (actions$, state$, zeniAPI)
41
41
  const payload = action.payload;
42
42
  const { transactionId, transaction, lineIds } = payload.transactionDetails;
43
43
  const { entity, amount, isFetchCOT, isUncategorizedExpenseCategoryEnabled, } = payload;
44
- // The vendor "Update all lines" popup on the detail page watches
45
- // its own transaction-level fetch status, separate from the
46
- // per-line statuses below — surface completion/failure there too
47
- // when this fetch was triggered by that bulk action, or the popup
48
- // hangs until its own 60s timeout regardless of how this request
49
- // resolves.
50
- const isBulkDetailFetch = payload.flowType === 'detail' && payload.isBulkFetch === true;
51
- const emitWithBulkStatus = (primaryAction, bulkAction) => isBulkDetailFetch && bulkAction != null
52
- ? (0, rxjs_1.of)(primaryAction, bulkAction)
53
- : (0, rxjs_1.of)(primaryAction);
54
44
  // Synchronously emit the start arm so the per-line skeleton +
55
45
  // row uncheck happen before the HTTP request begins. The
56
46
  // discriminated-union payload narrows `payload.selectedTab` to
@@ -64,9 +54,9 @@ const fetchEntityRecommendationsForLineUpdateEpic = (actions$, state$, zeniAPI)
64
54
  .getJSON(url)
65
55
  .pipe((0, operators_1.mergeMap)((response) => {
66
56
  if (!(0, responsePayload_1.isSuccessResponse)(response) || response.data == null) {
67
- return emitWithBulkStatus(payload.flowType === 'categorization'
57
+ return (0, rxjs_1.of)(payload.flowType === 'categorization'
68
58
  ? (0, transactionsViewReducer_1.markCategoryClassRecommendationsFailureForCategorization)(payload.selectedTab, transactionId, lineIds, response.status)
69
- : (0, transactionDetailReducer_1.markCategoryClassRecommendationsFailureForTransactionDetail)(transactionId, lineIds, response.status), (0, transactionDetailReducer_1.updateVendorBulkRecommendationsFetchStatus)(transactionId, 'Error', response.status));
59
+ : (0, transactionDetailReducer_1.markCategoryClassRecommendationsFailureForTransactionDetail)(transactionId, lineIds, response.status));
70
60
  }
71
61
  const recommendationWithCOTByLineId = (0, recommendationHelper_1.getRecommendationByLineIdWithCOTFromRecommendationPayloadWithCOT)(response.data.recommendations, lineIds);
72
62
  // HTTP 200 with no per-line recommendations: NOT an error.
@@ -74,9 +64,9 @@ const fetchEntityRecommendationsForLineUpdateEpic = (actions$, state$, zeniAPI)
74
64
  // downstream UI can treat this as "we tried, nothing to
75
65
  // apply".
76
66
  if (recommendationWithCOTByLineId == null) {
77
- return emitWithBulkStatus(payload.flowType === 'categorization'
67
+ return (0, rxjs_1.of)(payload.flowType === 'categorization'
78
68
  ? (0, transactionsViewReducer_1.markCategoryClassRecommendationsCompletedForCategorization)(payload.selectedTab, transactionId, lineIds)
79
- : (0, transactionDetailReducer_1.markCategoryClassRecommendationsCompletedForTransactionDetail)(transactionId, lineIds), (0, transactionDetailReducer_1.updateVendorBulkRecommendationsFetchStatus)(transactionId, 'Completed'));
69
+ : (0, transactionDetailReducer_1.markCategoryClassRecommendationsCompletedForTransactionDetail)(transactionId, lineIds));
80
70
  }
81
71
  const transactionWithCOT = isFetchCOT === true
82
72
  ? (0, transactionHelper_1.getTransactionWithCOTFromRecommendations)(transaction, recommendationWithCOTByLineId)
@@ -85,16 +75,16 @@ const fetchEntityRecommendationsForLineUpdateEpic = (actions$, state$, zeniAPI)
85
75
  if (payload.flowType === 'categorization') {
86
76
  return (0, rxjs_1.of)((0, transactionsViewReducer_1.setEntityRecommendationForLineIdsForCategorization)(payload.selectedTab, transactionId, transactionWithCOT, lineIds, entity, amount, recommendationWithCOTByLineId, uncategorizedIncomeExpense, isUncategorizedExpenseCategoryEnabled, (0, tenantSelector_1.getIsAccountingClassesEnabled)(state$.value)));
87
77
  }
88
- return emitWithBulkStatus((0, transactionDetailReducer_1.setEntityRecommendationForLineIdsForTransactionDetail)(transactionId, transactionWithCOT, lineIds, entity, amount, recommendationWithCOTByLineId, uncategorizedIncomeExpense), (0, transactionDetailReducer_1.updateVendorBulkRecommendationsFetchStatus)(transactionId, 'Completed'));
78
+ return (0, rxjs_1.of)((0, transactionDetailReducer_1.setEntityRecommendationForLineIdsForTransactionDetail)(transactionId, transactionWithCOT, lineIds, entity, amount, recommendationWithCOTByLineId, uncategorizedIncomeExpense));
89
79
  }), (0, operators_1.catchError)((error) => {
90
80
  const errorMessage = 'fetchEntityRecommendationsForLineUpdate failed: ' +
91
81
  (error instanceof Error
92
82
  ? error.message
93
83
  : JSON.stringify(error));
94
84
  const status = (0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', errorMessage);
95
- return emitWithBulkStatus(payload.flowType === 'categorization'
85
+ return (0, rxjs_1.of)(payload.flowType === 'categorization'
96
86
  ? (0, transactionsViewReducer_1.markCategoryClassRecommendationsFailureForCategorization)(payload.selectedTab, transactionId, lineIds, status)
97
- : (0, transactionDetailReducer_1.markCategoryClassRecommendationsFailureForTransactionDetail)(transactionId, lineIds, status), (0, transactionDetailReducer_1.updateVendorBulkRecommendationsFetchStatus)(transactionId, 'Error', status));
87
+ : (0, transactionDetailReducer_1.markCategoryClassRecommendationsFailureForTransactionDetail)(transactionId, lineIds, status));
98
88
  }));
99
89
  return (0, rxjs_1.concat)((0, rxjs_1.of)(startAction), httpStream$);
100
90
  }))));
@@ -15,7 +15,6 @@ type FetchEntityRecommendationsForLineUpdateCommonPayload = {
15
15
  transaction: SupportedTransaction;
16
16
  transactionId: TransactionID;
17
17
  };
18
- isBulkFetch?: boolean;
19
18
  isFetchCOT?: boolean;
20
19
  isUncategorizedExpenseCategoryEnabled?: boolean;
21
20
  };
@@ -6,7 +6,7 @@ import { FundingAccount } from '../commonSetup/setupViewSelector';
6
6
  import { TreasuryAccount } from '../treasury/treasuryTransferMoney/treasuryTransferMoneyState';
7
7
  import { ReviewTransferDetail } from '../zeniAccounts/transferDetail/transferDetailState';
8
8
  import { AutoTransferRuleLocalData } from './autoTransferRulesPayload';
9
- import { AutoTransferRule } from './autoTransferRulesState';
9
+ import { AutoTransferRule, CashManagementRule } from './autoTransferRulesState';
10
10
  export interface AutoTransferRulesSelectorView extends SelectorView {
11
11
  autoTransferReviewDetail: ReviewTransferDetail;
12
12
  createRuleFetchState: FetchStateAndError;
@@ -17,6 +17,13 @@ export interface AutoTransferRulesSelectorView extends SelectorView {
17
17
  transferMoneyParties: FundingAccount[];
18
18
  transferMoneyPartiesFetchState: FetchState;
19
19
  treasuryAccount: TreasuryAccount;
20
+ /**
21
+ * The user's saved auto-sweep cash-management config, surfaced here so the
22
+ * rules list page can render it alongside the auto-transfer rules.
23
+ * `undefined` when the user hasn't saved auto-sweep settings yet
24
+ * (i.e. `autoSweepFlowState.settingsId == null`).
25
+ */
26
+ cashManagementRule?: CashManagementRule;
20
27
  ruleHistory?: Record<string, CommonHistoryView>;
21
28
  }
22
29
  export declare const getAutoTransferRules: (state: RootState) => AutoTransferRulesSelectorView;
@@ -6,11 +6,30 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.getAutoTransferRuleHistory = exports.getAutoTransferRuleById = exports.getAutoTransferRules = void 0;
7
7
  const get_1 = __importDefault(require("lodash/get"));
8
8
  const reduceFetchState_1 = require("../../../commonStateTypes/reduceFetchState");
9
+ const depositAccountSelector_1 = require("../../../entity/depositAccount/depositAccountSelector");
9
10
  const setupViewSelector_1 = require("../commonSetup/setupViewSelector");
10
11
  const depositAccountListSelector_1 = require("../zeniAccounts/depositAccountList/depositAccountListSelector");
11
12
  const paymentAccountListSelector_1 = require("../zeniAccounts/paymentAccountList/paymentAccountListSelector");
13
+ const buildCashManagementRule = (autoSweepFlowState, depositAccountState, treasuryDetailState) => {
14
+ const { settingsId, bufferAmount, frequency, memo, primaryFundingAccountId, nextTransferDate, } = autoSweepFlowState;
15
+ if (settingsId == null || primaryFundingAccountId == null) {
16
+ return undefined;
17
+ }
18
+ const depositAccount = (0, depositAccountSelector_1.getDepositAccountByDepositAccountId)(depositAccountState, primaryFundingAccountId);
19
+ return {
20
+ bufferAmount,
21
+ frequency,
22
+ memo,
23
+ settingsId,
24
+ primaryFundingAccount: depositAccount != null
25
+ ? (0, setupViewSelector_1.mapDepositAccToFundingAccount)(depositAccount)
26
+ : undefined,
27
+ treasurySummary: treasuryDetailState.accountSummary,
28
+ nextTransferDate,
29
+ };
30
+ };
12
31
  const getAutoTransferRules = (state) => {
13
- const { autotransferRulesState, depositAccountState, paymentAccountState, depositAccountListState, paymentAccountListState, treasuryDetailState, } = state;
32
+ const { autotransferRulesState, autoSweepFlowState, depositAccountState, paymentAccountState, depositAccountListState, paymentAccountListState, treasuryDetailState, } = state;
14
33
  const { rules, error, historyByRuleId, ruleUpdateLocalData, ruleUpdateStatusById, ruleDeleteStatusById, createRuleFetchState, autoTransferReviewDetail, } = autotransferRulesState;
15
34
  const depositAccountsView = (0, depositAccountListSelector_1.getAllDepositAccounts)(depositAccountState, depositAccountListState);
16
35
  const paymentAccountsView = (0, paymentAccountListSelector_1.getAllPaymentAccounts)(paymentAccountState, paymentAccountListState);
@@ -45,6 +64,7 @@ const getAutoTransferRules = (state) => {
45
64
  transferMoneyParties,
46
65
  transferMoneyPartiesFetchState,
47
66
  createRuleFetchState,
67
+ cashManagementRule: buildCashManagementRule(autoSweepFlowState, depositAccountState, treasuryDetailState),
48
68
  fetchState,
49
69
  error,
50
70
  version: 0,
@@ -1,6 +1,10 @@
1
+ import { Amount } from '../../../commonStateTypes/amount';
1
2
  import { FetchStateAndError, FetchedState, ID } from '../../../commonStateTypes/common';
2
3
  import { ZeniDate } from '../../../zeniDayJS';
4
+ import { AutoSweepFrequency } from '../cashManagement/autoSweepFlow/autoSweepFlowState';
3
5
  import { CommonHistoryView } from '../commonHistoryView/commonHistory';
6
+ import { FundingAccount } from '../commonSetup/setupViewSelector';
7
+ import { TreasurySummaryWithBalance } from '../treasury/treasuryList/treasuryDetailState';
4
8
  import { ReviewTransferDetail } from '../zeniAccounts/transferDetail/transferDetailState';
5
9
  import { AutoTransferRuleFrequency, AutoTransferRuleLocalData, AutoTransferRuleType } from './autoTransferRulesPayload';
6
10
  export interface AutoTransferRule {
@@ -27,6 +31,24 @@ export interface DestinationBankAccountMetadata {
27
31
  accountType: string;
28
32
  percentage: number;
29
33
  }
34
+ /**
35
+ * Render-ready view of the user's auto-sweep cash-management config,
36
+ * surfaced alongside `AutoTransferRule[]` in `AutoTransferRulesSelectorView`.
37
+ * Kept as a distinct shape (not folded into `AutoTransferRule`) so the rules
38
+ * list can special-case its rendering without polluting the rule type union.
39
+ *
40
+ * Present only when `autoSweepFlowState.settingsId` is set — i.e. the user
41
+ * has saved their auto-sweep settings at least once.
42
+ */
43
+ export interface CashManagementRule {
44
+ bufferAmount: Amount;
45
+ frequency: AutoSweepFrequency;
46
+ memo: string;
47
+ settingsId: ID;
48
+ nextTransferDate?: ZeniDate;
49
+ primaryFundingAccount?: FundingAccount;
50
+ treasurySummary?: TreasurySummaryWithBalance;
51
+ }
30
52
  export interface AutoTransferRulesState extends FetchedState {
31
53
  autoTransferReviewDetail: ReviewTransferDetail;
32
54
  createRuleFetchState: FetchStateAndError;
@@ -0,0 +1,47 @@
1
+ import { Amount } from '../../../../commonStateTypes/amount';
2
+ import { ID } from '../../../../commonStateTypes/common';
3
+ import { DepositAccountPayload } from '../../../../entity/depositAccount/depositAccountPayload';
4
+ import { ZeniAPIResponse } from '../../../../responsePayload';
5
+ import { ZeniDate } from '../../../../zeniDayJS';
6
+ import { AutoSweepFlowState, AutoSweepFrequency } from './autoSweepFlowState';
7
+ /**
8
+ * Body sent to `PUT /cash-management/settings`. Field names match the
9
+ * cash-management-agent contract; `minimum_buffer_usd` is a plain number
10
+ * (the slice tracks the canonical `Amount` value).
11
+ */
12
+ export type SaveAutoSweepSettingsBody = {
13
+ frequency: string;
14
+ memo: string;
15
+ minimum_buffer_usd: number;
16
+ };
17
+ export type SaveAutoSweepSettingsResponse = ZeniAPIResponse<unknown>;
18
+ export declare const toSaveAutoSweepSettingsBody: (state: Pick<AutoSweepFlowState, "bufferAmount" | "frequency" | "memo">) => SaveAutoSweepSettingsBody;
19
+ /**
20
+ * `source_bank_account` on the cash-management settings response matches the
21
+ * shared `DepositAccountPayload` shape, so the fetch epic dispatches it into
22
+ * the deposit-account entity bucket and the auto-sweep slice only keeps the
23
+ * id. The selector hydrates the full `FundingAccount` on read.
24
+ */
25
+ export interface CashManagementSettingsPayload {
26
+ cash_management_settings_id: string | null;
27
+ frequency: string;
28
+ minimum_buffer_usd: number;
29
+ next_run_date: string;
30
+ source_bank_account: DepositAccountPayload;
31
+ }
32
+ export type CashManagementSettingsResponse = ZeniAPIResponse<CashManagementSettingsPayload>;
33
+ /**
34
+ * Map a `GET /cash-management/settings` payload into the slice's writable
35
+ * fields. Defensive on the frequency (string-from-the-wire → union via
36
+ * `toAutoSweepFrequency`, falling back to `'weekly'` if the server returns
37
+ * something we don't model yet). Only the source account *id* is stored
38
+ * here — the full deposit-account payload is published to the entity bucket
39
+ * by the fetch epic.
40
+ */
41
+ export declare const toAutoSweepFlowStatePatch: (payload: CashManagementSettingsPayload) => {
42
+ bufferAmount: Amount;
43
+ frequency: AutoSweepFrequency;
44
+ nextTransferDate?: ZeniDate;
45
+ primaryFundingAccountId?: ID;
46
+ settingsId?: ID;
47
+ };
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.toAutoSweepFlowStatePatch = exports.toSaveAutoSweepSettingsBody = void 0;
4
+ const amount_1 = require("../../../../commonStateTypes/amount");
5
+ const zeniDayJS_1 = require("../../../../zeniDayJS");
6
+ const autoSweepFlowState_1 = require("./autoSweepFlowState");
7
+ const toSaveAutoSweepSettingsBody = (state) => ({
8
+ frequency: state.frequency,
9
+ memo: state.memo,
10
+ minimum_buffer_usd: state.bufferAmount.amount,
11
+ });
12
+ exports.toSaveAutoSweepSettingsBody = toSaveAutoSweepSettingsBody;
13
+ /**
14
+ * Map a `GET /cash-management/settings` payload into the slice's writable
15
+ * fields. Defensive on the frequency (string-from-the-wire → union via
16
+ * `toAutoSweepFrequency`, falling back to `'weekly'` if the server returns
17
+ * something we don't model yet). Only the source account *id* is stored
18
+ * here — the full deposit-account payload is published to the entity bucket
19
+ * by the fetch epic.
20
+ */
21
+ const toAutoSweepFlowStatePatch = (payload) => {
22
+ const currencyCode = payload.source_bank_account.balances?.currency_code;
23
+ const currencySymbol = payload.source_bank_account.balances?.currency_symbol;
24
+ return {
25
+ bufferAmount: (0, amount_1.toAmount)(payload.minimum_buffer_usd, currencyCode ?? 'USD', currencySymbol ?? '$'),
26
+ frequency: (0, autoSweepFlowState_1.toAutoSweepFrequency)(payload.frequency) ?? 'weekly',
27
+ nextTransferDate: payload.next_run_date != null && payload.next_run_date !== ''
28
+ ? (0, zeniDayJS_1.date)(payload.next_run_date)
29
+ : undefined,
30
+ primaryFundingAccountId: payload.source_bank_account.deposit_account_id ?? undefined,
31
+ settingsId: payload.cash_management_settings_id ?? undefined,
32
+ };
33
+ };
34
+ exports.toAutoSweepFlowStatePatch = toAutoSweepFlowStatePatch;
@@ -0,0 +1,23 @@
1
+ import { Amount } from '../../../../commonStateTypes/amount';
2
+ import { FetchState } from '../../../../commonStateTypes/common';
3
+ import { ZeniAPIStatus } from '../../../../responsePayload';
4
+ import { CashManagementSettingsPayload } from './autoSweepFlowPayload';
5
+ import { AutoSweepFlowState, AutoSweepFrequency } from './autoSweepFlowState';
6
+ export declare const initialState: AutoSweepFlowState;
7
+ export declare const fetchCashManagementSettings: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"autoSweepFlow/fetchCashManagementSettings">, updateCashManagementSettings: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
8
+ data: CashManagementSettingsPayload;
9
+ }, "autoSweepFlow/updateCashManagementSettings">, updateCashManagementSettingsFetchStatus: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
10
+ fetchState: FetchState;
11
+ error?: ZeniAPIStatus;
12
+ }, "autoSweepFlow/updateCashManagementSettingsFetchStatus">, updateAutoSweepRisk: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
13
+ bufferAmount: Amount;
14
+ }, "autoSweepFlow/updateAutoSweepRisk">, updateAutoSweepDraft: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
15
+ bufferAmount: Amount;
16
+ frequency: AutoSweepFrequency;
17
+ memo: string;
18
+ }, "autoSweepFlow/updateAutoSweepDraft">, saveAutoSweepSettings: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"autoSweepFlow/saveAutoSweepSettings">, updateAutoSweepSettingsFetchStatus: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
19
+ fetchState: FetchState;
20
+ error?: ZeniAPIStatus;
21
+ }, "autoSweepFlow/updateAutoSweepSettingsFetchStatus">, clearAutoSweepFlow: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"autoSweepFlow/clearAutoSweepFlow">;
22
+ declare const _default: import("redux").Reducer<AutoSweepFlowState>;
23
+ export default _default;
@@ -0,0 +1,82 @@
1
+ "use strict";
2
+ var _a;
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.clearAutoSweepFlow = exports.updateAutoSweepSettingsFetchStatus = exports.saveAutoSweepSettings = exports.updateAutoSweepDraft = exports.updateAutoSweepRisk = exports.updateCashManagementSettingsFetchStatus = exports.updateCashManagementSettings = exports.fetchCashManagementSettings = exports.initialState = void 0;
5
+ const toolkit_1 = require("@reduxjs/toolkit");
6
+ const autoSweepFlowPayload_1 = require("./autoSweepFlowPayload");
7
+ const autoSweepFlowState_1 = require("./autoSweepFlowState");
8
+ exports.initialState = autoSweepFlowState_1.initialAutoSweepFlowState;
9
+ const autoSweepFlow = (0, toolkit_1.createSlice)({
10
+ name: 'autoSweepFlow',
11
+ initialState: exports.initialState,
12
+ reducers: {
13
+ /**
14
+ * Kicks off `GET /cash-management/settings`. Flips the top-level
15
+ * fetchState to `In-Progress`; the fetch epic picks this up.
16
+ */
17
+ fetchCashManagementSettings(draft) {
18
+ draft.fetchState = 'In-Progress';
19
+ draft.error = undefined;
20
+ },
21
+ /**
22
+ * Hydrates the form fields with the server-side settings (and stashes
23
+ * the settings id for subsequent saves). Marks the GET as `Completed`.
24
+ */
25
+ updateCashManagementSettings(draft, action) {
26
+ const patch = (0, autoSweepFlowPayload_1.toAutoSweepFlowStatePatch)(action.payload.data);
27
+ draft.bufferAmount = patch.bufferAmount;
28
+ draft.frequency = patch.frequency;
29
+ draft.nextTransferDate = patch.nextTransferDate;
30
+ draft.primaryFundingAccountId = patch.primaryFundingAccountId;
31
+ draft.settingsId = patch.settingsId;
32
+ draft.fetchState = 'Completed';
33
+ draft.error = undefined;
34
+ },
35
+ updateCashManagementSettingsFetchStatus(draft, action) {
36
+ draft.fetchState = action.payload.fetchState;
37
+ draft.error = action.payload.error;
38
+ },
39
+ /**
40
+ * Live-update the buffer (risk band) as the user toggles the risk picker
41
+ * on the setup page, without staging frequency/memo. The selector derives
42
+ * the risk-adjusted sweep amount off `bufferAmount`, so dispatching this on
43
+ * every risk change keeps the setup and review screens in sync.
44
+ */
45
+ updateAutoSweepRisk(draft, action) {
46
+ draft.bufferAmount = action.payload.bufferAmount;
47
+ },
48
+ /**
49
+ * Stage the in-flight form values without submitting them — fired from
50
+ * the setup→review transition so other selectors (and devtools) can see
51
+ * what the user is about to confirm. Leaves `saveStatus` untouched; the
52
+ * actual PUT only kicks off when the user clicks "Confirm Sweep" via
53
+ * `saveAutoSweepSettings`.
54
+ */
55
+ updateAutoSweepDraft(draft, action) {
56
+ draft.bufferAmount = action.payload.bufferAmount;
57
+ draft.frequency = action.payload.frequency;
58
+ draft.memo = action.payload.memo;
59
+ },
60
+ /**
61
+ * Trigger the PUT for the auto-sweep settings already staged via
62
+ * `updateAutoSweepDraft`. Carries no payload — flips `saveStatus` to
63
+ * `In-Progress` and the save epic reads `bufferAmount` / `frequency` /
64
+ * `memo` straight from the slice. Callers must ensure those fields
65
+ * reflect the user's latest input before dispatching.
66
+ */
67
+ saveAutoSweepSettings(draft) {
68
+ draft.saveStatus = { fetchState: 'In-Progress', error: undefined };
69
+ },
70
+ updateAutoSweepSettingsFetchStatus(draft, action) {
71
+ draft.saveStatus = {
72
+ fetchState: action.payload.fetchState,
73
+ error: action.payload.error,
74
+ };
75
+ },
76
+ clearAutoSweepFlow() {
77
+ return autoSweepFlowState_1.initialAutoSweepFlowState;
78
+ },
79
+ },
80
+ });
81
+ _a = autoSweepFlow.actions, exports.fetchCashManagementSettings = _a.fetchCashManagementSettings, exports.updateCashManagementSettings = _a.updateCashManagementSettings, exports.updateCashManagementSettingsFetchStatus = _a.updateCashManagementSettingsFetchStatus, exports.updateAutoSweepRisk = _a.updateAutoSweepRisk, exports.updateAutoSweepDraft = _a.updateAutoSweepDraft, exports.saveAutoSweepSettings = _a.saveAutoSweepSettings, exports.updateAutoSweepSettingsFetchStatus = _a.updateAutoSweepSettingsFetchStatus, exports.clearAutoSweepFlow = _a.clearAutoSweepFlow;
82
+ exports.default = autoSweepFlow.reducer;
@@ -0,0 +1,40 @@
1
+ import { Amount } from '../../../../commonStateTypes/amount';
2
+ import { FetchStateAndError, ID } from '../../../../commonStateTypes/common';
3
+ import { SelectorView } from '../../../../commonStateTypes/viewAndReport/viewAndReport';
4
+ import { RootState } from '../../../../reducer';
5
+ import { FundingAccount } from '../../commonSetup/setupViewSelector';
6
+ import { TreasurySummaryWithBalance } from '../../treasury/treasuryList/treasuryDetailState';
7
+ import { AutoSweepFrequency, RiskLevel } from './autoSweepFlowState';
8
+ /**
9
+ * The editable form state behind `<AutoSweepSetupPage>`. Kept as a nested
10
+ * object on the selector view so the screen can pass it through as a single
11
+ * unit and the rest of the view (server-derived data + statuses) stays
12
+ * separate from "what the user is currently editing".
13
+ */
14
+ export interface AutoSweepFlowFormData {
15
+ bufferAmount: Amount;
16
+ frequency: AutoSweepFrequency;
17
+ memo: string;
18
+ /** Derived from `bufferAmount` — the matching preset risk level, falling
19
+ * back to `'moderate'` for custom server-side values. */
20
+ risk: RiskLevel;
21
+ }
22
+ export interface AutoSweepFlowSelectorView extends SelectorView {
23
+ formData: AutoSweepFlowFormData;
24
+ saveStatus: FetchStateAndError;
25
+ /**
26
+ * Recommended sweep amount. Sourced from the cash management banner
27
+ * (the first money_movements[0].movements[0].amount returned by the
28
+ * agent's `/recommend` endpoint). Defaults to zero when the agent
29
+ * hasn't returned a movement yet.
30
+ */
31
+ sweepAmount: Amount;
32
+ /** Resolved from `primaryFundingAccountId` against the deposit-account
33
+ * entity bucket. `undefined` until the GET fetch publishes the account. */
34
+ primaryFundingAccount?: FundingAccount;
35
+ settingsId?: ID;
36
+ /** Treasury account summary used by the setup / review flow to render the
37
+ * destination column. Mirrors `getTreasuryDetail().accountSummary`. */
38
+ treasurySummary?: TreasurySummaryWithBalance;
39
+ }
40
+ export declare const getAutoSweepFlow: (state: RootState) => AutoSweepFlowSelectorView;
@@ -0,0 +1,53 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getAutoSweepFlow = void 0;
4
+ const depositAccountSelector_1 = require("../../../../entity/depositAccount/depositAccountSelector");
5
+ const setupViewSelector_1 = require("../../commonSetup/setupViewSelector");
6
+ const treasuryDetailSelector_1 = require("../../treasury/treasuryList/treasuryDetailSelector");
7
+ const cashManagementOverviewSelector_1 = require("../cashManagementOverview/cashManagementOverviewSelector");
8
+ const autoSweepFlowState_1 = require("./autoSweepFlowState");
9
+ /**
10
+ * Risk band the agent's recommended sweep amount is computed against. The
11
+ * `sweepAmount` returned by the banner assumes this buffer, so the selector
12
+ * adjusts the displayed sweep by the delta between the user's selected band
13
+ * and this default.
14
+ */
15
+ const DEFAULT_RISK_LEVEL = 'moderate';
16
+ const getAutoSweepFlow = (state) => {
17
+ const { bufferAmount, frequency, memo, saveStatus, settingsId, primaryFundingAccountId, fetchState, error, } = state.autoSweepFlowState;
18
+ const depositAccount = primaryFundingAccountId != null
19
+ ? (0, depositAccountSelector_1.getDepositAccountByDepositAccountId)(state.depositAccountState, primaryFundingAccountId)
20
+ : undefined;
21
+ const risk = (0, autoSweepFlowState_1.bufferAmountToRisk)(bufferAmount.amount);
22
+ // The banner's recommended sweep assumes the default buffer band; shift it
23
+ // by the delta between the default buffer and the user's selected band so a
24
+ // tighter buffer (higher risk → smaller buffer) sweeps more and a looser
25
+ // buffer (lower risk → larger buffer) sweeps less. Clamp at zero so a buffer
26
+ // larger than the available surplus never yields a negative sweep.
27
+ const baseSweepAmount = (0, cashManagementOverviewSelector_1.getCashManagementOverviewBanner)(state).amount;
28
+ const sweepAmount = {
29
+ ...baseSweepAmount,
30
+ amount: Math.max(0, baseSweepAmount.amount +
31
+ autoSweepFlowState_1.RISK_BUFFER_AMOUNT[DEFAULT_RISK_LEVEL] -
32
+ autoSweepFlowState_1.RISK_BUFFER_AMOUNT[risk]),
33
+ };
34
+ return {
35
+ fetchState,
36
+ error,
37
+ formData: {
38
+ bufferAmount,
39
+ frequency,
40
+ memo,
41
+ risk,
42
+ },
43
+ primaryFundingAccount: depositAccount != null
44
+ ? (0, setupViewSelector_1.mapDepositAccToFundingAccount)(depositAccount)
45
+ : undefined,
46
+ saveStatus,
47
+ settingsId,
48
+ sweepAmount,
49
+ treasurySummary: (0, treasuryDetailSelector_1.getTreasuryDetail)(state).accountSummary,
50
+ version: 0,
51
+ };
52
+ };
53
+ exports.getAutoSweepFlow = getAutoSweepFlow;
@@ -0,0 +1,37 @@
1
+ import { Amount } from '../../../../commonStateTypes/amount';
2
+ import { FetchStateAndError, ID } from '../../../../commonStateTypes/common';
3
+ import { ZeniDate } from '../../../../zeniDayJS';
4
+ /**
5
+ * Cadence at which the auto-sweep transfer fires. Lowercase to match the
6
+ * cash-management settings API contract (and the `SweepFrequency` literal
7
+ * already used by `<AutoSweepSetupPage>` in web-components).
8
+ */
9
+ export declare const ALL_AUTO_SWEEP_FREQUENCIES: readonly ["daily", "weekly", "biweekly", "monthly"];
10
+ export declare const toAutoSweepFrequency: (v?: string) => "weekly" | "biweekly" | "monthly" | "daily";
11
+ export type AutoSweepFrequency = NonNullable<ReturnType<typeof toAutoSweepFrequency>>;
12
+ /**
13
+ * Risk presets the auto-sweep setup form exposes. Each level maps to a
14
+ * canonical minimum-buffer amount (USD). Selecting a level in the UI is
15
+ * shorthand for choosing that buffer.
16
+ */
17
+ export declare const ALL_AUTO_SWEEP_RISK_LEVELS: readonly ["low", "moderate", "high"];
18
+ export declare const toAutoSweepRiskLevel: (v?: string) => "high" | "low" | "moderate";
19
+ export type RiskLevel = NonNullable<ReturnType<typeof toAutoSweepRiskLevel>>;
20
+ export declare const RISK_BUFFER_AMOUNT: Record<RiskLevel, number>;
21
+ /**
22
+ * Maps a buffer amount back onto the closest preset risk level. Falls back
23
+ * to `'moderate'` when the amount doesn't match a known preset (e.g. the
24
+ * server returned a custom value). The dropdown in `<AutoSweepSetupPage>`
25
+ * uses this so it can pre-select the user's existing band on edit.
26
+ */
27
+ export declare const bufferAmountToRisk: (amount: number) => RiskLevel;
28
+ export interface AutoSweepFlowState extends FetchStateAndError {
29
+ bufferAmount: Amount;
30
+ frequency: AutoSweepFrequency;
31
+ memo: string;
32
+ saveStatus: FetchStateAndError;
33
+ nextTransferDate?: ZeniDate;
34
+ primaryFundingAccountId?: ID;
35
+ settingsId?: ID;
36
+ }
37
+ export declare const initialAutoSweepFlowState: AutoSweepFlowState;
@@ -0,0 +1,53 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.initialAutoSweepFlowState = exports.bufferAmountToRisk = exports.RISK_BUFFER_AMOUNT = exports.toAutoSweepRiskLevel = exports.ALL_AUTO_SWEEP_RISK_LEVELS = exports.toAutoSweepFrequency = exports.ALL_AUTO_SWEEP_FREQUENCIES = void 0;
4
+ const amount_1 = require("../../../../commonStateTypes/amount");
5
+ const stringToUnion_1 = require("../../../../commonStateTypes/stringToUnion");
6
+ /**
7
+ * Cadence at which the auto-sweep transfer fires. Lowercase to match the
8
+ * cash-management settings API contract (and the `SweepFrequency` literal
9
+ * already used by `<AutoSweepSetupPage>` in web-components).
10
+ */
11
+ exports.ALL_AUTO_SWEEP_FREQUENCIES = [
12
+ 'daily',
13
+ 'weekly',
14
+ 'biweekly',
15
+ 'monthly',
16
+ ];
17
+ const toAutoSweepFrequency = (v) => (0, stringToUnion_1.stringToUnion)(v ?? '', exports.ALL_AUTO_SWEEP_FREQUENCIES);
18
+ exports.toAutoSweepFrequency = toAutoSweepFrequency;
19
+ /**
20
+ * Risk presets the auto-sweep setup form exposes. Each level maps to a
21
+ * canonical minimum-buffer amount (USD). Selecting a level in the UI is
22
+ * shorthand for choosing that buffer.
23
+ */
24
+ exports.ALL_AUTO_SWEEP_RISK_LEVELS = ['low', 'moderate', 'high'];
25
+ const toAutoSweepRiskLevel = (v) => (0, stringToUnion_1.stringToUnion)(v ?? '', exports.ALL_AUTO_SWEEP_RISK_LEVELS);
26
+ exports.toAutoSweepRiskLevel = toAutoSweepRiskLevel;
27
+ exports.RISK_BUFFER_AMOUNT = {
28
+ low: 15000,
29
+ moderate: 10000,
30
+ high: 5000,
31
+ };
32
+ /**
33
+ * Maps a buffer amount back onto the closest preset risk level. Falls back
34
+ * to `'moderate'` when the amount doesn't match a known preset (e.g. the
35
+ * server returned a custom value). The dropdown in `<AutoSweepSetupPage>`
36
+ * uses this so it can pre-select the user's existing band on edit.
37
+ */
38
+ const bufferAmountToRisk = (amount) => {
39
+ const match = Object.entries(exports.RISK_BUFFER_AMOUNT).find(([, presetAmount]) => presetAmount === amount);
40
+ return match != null ? match[0] : 'moderate';
41
+ };
42
+ exports.bufferAmountToRisk = bufferAmountToRisk;
43
+ exports.initialAutoSweepFlowState = {
44
+ bufferAmount: (0, amount_1.toAmount)(10000, 'USD', '$'),
45
+ frequency: 'weekly',
46
+ memo: '',
47
+ saveStatus: { fetchState: 'Not-Started', error: undefined },
48
+ nextTransferDate: undefined,
49
+ primaryFundingAccountId: undefined,
50
+ settingsId: undefined,
51
+ fetchState: 'Not-Started',
52
+ error: undefined,
53
+ };
@@ -0,0 +1,14 @@
1
+ import { ActionsObservable, StateObservable } from 'redux-observable';
2
+ import { Observable } from 'rxjs';
3
+ import { updateDepositAccounts } from '../../../../../entity/depositAccount/depositAccountReducer';
4
+ import { RootState } from '../../../../../reducer';
5
+ import { ZeniAPI } from '../../../../../zeniAPI';
6
+ import { fetchCashManagementSettings, updateCashManagementSettings, updateCashManagementSettingsFetchStatus } from '../autoSweepFlowReducer';
7
+ export type ActionType = ReturnType<typeof fetchCashManagementSettings> | ReturnType<typeof updateCashManagementSettings> | ReturnType<typeof updateCashManagementSettingsFetchStatus> | ReturnType<typeof updateDepositAccounts>;
8
+ /**
9
+ * Hits `GET /cash-management/settings` and hydrates the auto-sweep slice
10
+ * with the server's existing settings (frequency, minimum buffer, settings
11
+ * id). Called from the cash management overview page-fetch epic alongside
12
+ * the other top-level fetches.
13
+ */
14
+ export declare const fetchCashManagementSettingsEpic: (actions$: ActionsObservable<ActionType>, _state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.fetchCashManagementSettingsEpic = void 0;
4
+ const rxjs_1 = require("rxjs");
5
+ const operators_1 = require("rxjs/operators");
6
+ const depositAccountReducer_1 = require("../../../../../entity/depositAccount/depositAccountReducer");
7
+ const responsePayload_1 = require("../../../../../responsePayload");
8
+ const autoSweepFlowReducer_1 = require("../autoSweepFlowReducer");
9
+ /**
10
+ * Hits `GET /cash-management/settings` and hydrates the auto-sweep slice
11
+ * with the server's existing settings (frequency, minimum buffer, settings
12
+ * id). Called from the cash management overview page-fetch epic alongside
13
+ * the other top-level fetches.
14
+ */
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.getJSON(endpoint).pipe((0, operators_1.mergeMap)((response) => {
18
+ if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
19
+ return (0, rxjs_1.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
+ (0, depositAccountReducer_1.updateDepositAccounts)([response.data.source_bank_account]), (0, autoSweepFlowReducer_1.updateCashManagementSettings)({ data: response.data }));
25
+ }
26
+ return (0, rxjs_1.of)((0, autoSweepFlowReducer_1.updateCashManagementSettingsFetchStatus)({
27
+ fetchState: 'Error',
28
+ error: response.status,
29
+ }));
30
+ }), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, autoSweepFlowReducer_1.updateCashManagementSettingsFetchStatus)({
31
+ fetchState: 'Error',
32
+ error: (0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Fetch cash management settings REST API call errored out: ' +
33
+ (error?.message ?? String(error))),
34
+ }))));
35
+ }));
36
+ exports.fetchCashManagementSettingsEpic = fetchCashManagementSettingsEpic;
@@ -0,0 +1,7 @@
1
+ import { ActionsObservable, StateObservable } from 'redux-observable';
2
+ import { Observable } from 'rxjs';
3
+ import { RootState } from '../../../../../reducer';
4
+ import { ZeniAPI } from '../../../../../zeniAPI';
5
+ import { saveAutoSweepSettings, updateAutoSweepSettingsFetchStatus } from '../autoSweepFlowReducer';
6
+ export type ActionType = ReturnType<typeof saveAutoSweepSettings> | ReturnType<typeof updateAutoSweepSettingsFetchStatus>;
7
+ export declare const saveAutoSweepSettingsEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;