@zeniai/client-epic-state 5.0.36-betaRR03 → 5.0.36-betaRR04

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 (58) hide show
  1. package/lib/entity/task/taskPayload.js +2 -2
  2. package/lib/entity/task/taskState.d.ts +5 -1
  3. package/lib/entity/task/taskState.js +6 -1
  4. package/lib/entity/tenant/clearAllEpic.d.ts +2 -1
  5. package/lib/entity/tenant/clearAllEpic.js +2 -0
  6. package/lib/entity/tenant/epic/deleteConnectionEpic.d.ts +19 -0
  7. package/lib/entity/tenant/epic/deleteConnectionEpic.js +29 -0
  8. package/lib/entity/tenant/epic/saveAPIKeyConnectionEpic.d.ts +19 -0
  9. package/lib/entity/tenant/epic/saveAPIKeyConnectionEpic.js +31 -0
  10. package/lib/entity/tenant/epic/saveOAuthConnectionEpic.d.ts +19 -0
  11. package/lib/entity/tenant/epic/saveOAuthConnectionEpic.js +33 -0
  12. package/lib/entity/tenant/tenantPayload.d.ts +1 -0
  13. package/lib/entity/tenant/tenantReducer.d.ts +59 -1
  14. package/lib/entity/tenant/tenantReducer.js +139 -4
  15. package/lib/entity/tenant/tenantState.d.ts +7 -0
  16. package/lib/epic.d.ts +3 -1
  17. package/lib/epic.js +6 -1
  18. package/lib/esm/entity/task/taskPayload.js +3 -3
  19. package/lib/esm/entity/task/taskState.js +3 -0
  20. package/lib/esm/entity/tenant/clearAllEpic.js +2 -0
  21. package/lib/esm/entity/tenant/epic/deleteConnectionEpic.js +25 -0
  22. package/lib/esm/entity/tenant/epic/saveAPIKeyConnectionEpic.js +27 -0
  23. package/lib/esm/entity/tenant/epic/saveOAuthConnectionEpic.js +29 -0
  24. package/lib/esm/entity/tenant/tenantReducer.js +135 -2
  25. package/lib/esm/epic.js +6 -1
  26. package/lib/esm/index.js +8 -5
  27. package/lib/esm/reducer.js +3 -0
  28. package/lib/esm/view/common/recurringViewHelper.js +0 -9
  29. package/lib/esm/view/featureNotificationView/epics/fetchRegisteredInterestsEpic.js +23 -0
  30. package/lib/esm/view/featureNotificationView/epics/notifyMeForFeatureEpic.js +25 -0
  31. package/lib/esm/view/featureNotificationView/featureNotificationViewPayload.js +11 -0
  32. package/lib/esm/view/featureNotificationView/featureNotificationViewReducer.js +106 -0
  33. package/lib/esm/view/featureNotificationView/featureNotificationViewSelector.js +4 -0
  34. package/lib/esm/view/featureNotificationView/featureNotificationViewState.js +1 -0
  35. package/lib/esm/view/taskManager/taskDetailView/taskDetailSelector.js +7 -0
  36. package/lib/index.d.ts +9 -5
  37. package/lib/index.js +47 -33
  38. package/lib/reducer.d.ts +3 -0
  39. package/lib/reducer.js +3 -0
  40. package/lib/tsconfig.typecheck.tsbuildinfo +1 -1
  41. package/lib/view/common/recurringViewHelper.d.ts +0 -4
  42. package/lib/view/common/recurringViewHelper.js +1 -12
  43. package/lib/view/featureNotificationView/epics/fetchRegisteredInterestsEpic.d.ts +16 -0
  44. package/lib/view/featureNotificationView/epics/fetchRegisteredInterestsEpic.js +27 -0
  45. package/lib/view/featureNotificationView/epics/notifyMeForFeatureEpic.d.ts +14 -0
  46. package/lib/view/featureNotificationView/epics/notifyMeForFeatureEpic.js +29 -0
  47. package/lib/view/featureNotificationView/featureNotificationViewPayload.d.ts +23 -0
  48. package/lib/view/featureNotificationView/featureNotificationViewPayload.js +15 -0
  49. package/lib/view/featureNotificationView/featureNotificationViewReducer.d.ts +19 -0
  50. package/lib/view/featureNotificationView/featureNotificationViewReducer.js +110 -0
  51. package/lib/view/featureNotificationView/featureNotificationViewSelector.d.ts +6 -0
  52. package/lib/view/featureNotificationView/featureNotificationViewSelector.js +11 -0
  53. package/lib/view/featureNotificationView/featureNotificationViewState.d.ts +26 -0
  54. package/lib/view/featureNotificationView/featureNotificationViewState.js +2 -0
  55. package/lib/view/taskManager/taskDetailView/taskDetail.d.ts +2 -2
  56. package/lib/view/taskManager/taskDetailView/taskDetailSelector.d.ts +1 -0
  57. package/lib/view/taskManager/taskDetailView/taskDetailSelector.js +7 -0
  58. package/package.json +1 -1
@@ -34,8 +34,8 @@ const mapTaskPayloadToTask = (payload) => ({
34
34
  : undefined,
35
35
  recurringDaysOfWeek: payload.recurring_days_of_week != null
36
36
  ? payload.recurring_days_of_week
37
- .map(recurringViewHelper_1.toDayOfWeekStrict)
38
- .filter((v) => v != null)
37
+ .map(taskState_1.toDayOfWeekStrict)
38
+ .filter((week) => week != null)
39
39
  : undefined,
40
40
  recurringStartDate: payload.recurring_start_date != null
41
41
  ? (0, zeniDayJS_1.date)(payload.recurring_start_date)
@@ -1,5 +1,5 @@
1
1
  import { ID } from '../../commonStateTypes/common';
2
- import { DayOfWeek, RecurringFrequencyType } from '../../view/common/recurringViewHelper';
2
+ import { RecurringFrequencyType } from '../../view/common/recurringViewHelper';
3
3
  import { ZeniDate } from '../../zeniDayJS';
4
4
  export interface Task {
5
5
  assignees: ID[];
@@ -54,3 +54,7 @@ export interface TaskType {
54
54
  code: TaskCodeType;
55
55
  name: string;
56
56
  }
57
+ export declare const ALL_WEEK_DAYS: readonly ["mon", "tue", "wed", "thu", "fri"];
58
+ export declare const toDayOfWeek: (v: string) => "mon" | "tue" | "wed" | "thu" | "fri";
59
+ export declare const toDayOfWeekStrict: (v: string) => "mon" | "tue" | "wed" | "thu" | "fri" | undefined;
60
+ export type DayOfWeek = NonNullable<ReturnType<typeof toDayOfWeek>>;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.toTaskCodeType = exports.toTaskStatusCodeType = exports.ALL_TASK_STATUS_CODE = exports.toPriorityCodeTypeStrict = exports.toPriorityCodeType = exports.ALL_PRIORITY_CODE = void 0;
3
+ exports.toDayOfWeekStrict = exports.toDayOfWeek = exports.ALL_WEEK_DAYS = exports.toTaskCodeType = exports.toTaskStatusCodeType = exports.ALL_TASK_STATUS_CODE = exports.toPriorityCodeTypeStrict = exports.toPriorityCodeType = exports.ALL_PRIORITY_CODE = void 0;
4
4
  const stringToUnion_1 = require("../../commonStateTypes/stringToUnion");
5
5
  exports.ALL_PRIORITY_CODE = [
6
6
  'urgent',
@@ -25,3 +25,8 @@ exports.toTaskStatusCodeType = toTaskStatusCodeType;
25
25
  const ALL_TASK_CODE_TYPE = ['one_time', 'recurring'];
26
26
  const toTaskCodeType = (v) => (0, stringToUnion_1.stringToUnion)(v, ALL_TASK_CODE_TYPE);
27
27
  exports.toTaskCodeType = toTaskCodeType;
28
+ exports.ALL_WEEK_DAYS = ['mon', 'tue', 'wed', 'thu', 'fri'];
29
+ const toDayOfWeek = (v) => (0, stringToUnion_1.stringToUnion)(v, exports.ALL_WEEK_DAYS);
30
+ exports.toDayOfWeek = toDayOfWeek;
31
+ const toDayOfWeekStrict = (v) => (0, stringToUnion_1.stringToUnionStrict)(v, exports.ALL_WEEK_DAYS);
32
+ exports.toDayOfWeekStrict = toDayOfWeekStrict;
@@ -47,6 +47,7 @@ import { clearExpenseAutomationJESchedulesView } from '../../view/expenseAutomat
47
47
  import { clearExpenseAutomationMissingReceiptsView } from '../../view/expenseAutomationView/reducers/missingReceiptsViewReducer';
48
48
  import { clearExpenseAutomationReconciliationView } from '../../view/expenseAutomationView/reducers/reconciliationViewReducer';
49
49
  import { clearExpenseAutomationTransactionsView } from '../../view/expenseAutomationView/reducers/transactionsViewReducer';
50
+ import { clearFeatureNotificationView } from '../../view/featureNotificationView/featureNotificationViewReducer';
50
51
  import { clearFileViewList } from '../../view/fileView/fileViewReducer';
51
52
  import { clearFinanceStatement } from '../../view/financeStatement/financeStatementReducer';
52
53
  import { clearForecastList } from '../../view/forecastList/forecastListReducer';
@@ -205,7 +206,7 @@ import { clearAllUserRoles } from '../userRole/userRoleReducer';
205
206
  import { clearAllVendors } from '../vendor/vendorReducer';
206
207
  import { clearAllVendorExpenseTrends } from '../vendorExpense/vendorExpenseReducer';
207
208
  import { clearAll } from './tenantReducer';
208
- 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 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 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 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>;
209
+ 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 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 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>;
209
210
  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>;
210
211
  export type ActionType = clearActionTypeForViews | clearActionTypeForEntities | ReturnType<typeof clearAll>;
211
212
  export declare const clearAllEpic: (actions$: ActionsObservable<ActionType>) => import("rxjs").Observable<ActionType>;
@@ -51,6 +51,7 @@ const jeSchedulesViewReducer_1 = require("../../view/expenseAutomationView/reduc
51
51
  const missingReceiptsViewReducer_1 = require("../../view/expenseAutomationView/reducers/missingReceiptsViewReducer");
52
52
  const reconciliationViewReducer_1 = require("../../view/expenseAutomationView/reducers/reconciliationViewReducer");
53
53
  const transactionsViewReducer_1 = require("../../view/expenseAutomationView/reducers/transactionsViewReducer");
54
+ const featureNotificationViewReducer_1 = require("../../view/featureNotificationView/featureNotificationViewReducer");
54
55
  const fileViewReducer_1 = require("../../view/fileView/fileViewReducer");
55
56
  const financeStatementReducer_1 = require("../../view/financeStatement/financeStatementReducer");
56
57
  const forecastListReducer_1 = require("../../view/forecastList/forecastListReducer");
@@ -276,6 +277,7 @@ const clearAllEpic = (actions$) => actions$.pipe((0, operators_1.filter)(tenantR
276
277
  (0, transactionsViewReducer_1.clearExpenseAutomationTransactionsView)(),
277
278
  (0, expenseAutomationViewReducer_1.clearExpenseAutomationView)(),
278
279
  (0, expressPayReducer_1.clearExpressPayView)(),
280
+ (0, featureNotificationViewReducer_1.clearFeatureNotificationView)(),
279
281
  (0, fileViewReducer_1.clearFileViewList)(),
280
282
  (0, financeStatementReducer_1.clearFinanceStatement)(),
281
283
  (0, forecastListReducer_1.clearForecastList)(),
@@ -0,0 +1,19 @@
1
+ import { ActionsObservable, StateObservable } from 'redux-observable';
2
+ import { RootState } from '../../../reducer';
3
+ import { ZeniAPI } from '../../../zeniAPI';
4
+ import { deleteConnection, deleteConnectionFailure, deleteConnectionSuccess } from '../tenantReducer';
5
+ export type ActionType = ReturnType<typeof deleteConnection> | ReturnType<typeof deleteConnectionSuccess> | ReturnType<typeof deleteConnectionFailure>;
6
+ export declare const deleteConnectionEpic: (actions$: ActionsObservable<ActionType>, _: StateObservable<RootState>, zeniAPI: ZeniAPI) => import("rxjs").Observable<{
7
+ payload: {
8
+ tenantId: string;
9
+ connectionId: string;
10
+ connectionType: "revenue";
11
+ };
12
+ type: "tenant/deleteConnectionSuccess";
13
+ } | {
14
+ payload: {
15
+ tenantId: string;
16
+ status: import("../../../responsePayload").ZeniAPIStatus<Record<string, unknown>>;
17
+ };
18
+ type: "tenant/deleteConnectionFailure";
19
+ }>;
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.deleteConnectionEpic = void 0;
4
+ const rxjs_1 = require("rxjs");
5
+ const operators_1 = require("rxjs/operators");
6
+ const responsePayload_1 = require("../../../responsePayload");
7
+ const tenantReducer_1 = require("../tenantReducer");
8
+ const deleteConnectionEpic = (actions$, _, zeniAPI) => actions$.pipe((0, operators_1.filter)(tenantReducer_1.deleteConnection.match), (0, operators_1.switchMap)((action) => zeniAPI
9
+ .deleteAndGetJSON(`${zeniAPI.apiEndPoints.tenantMicroServiceBaseUrl}/1.0/connections/${action.payload.connectionId}`, undefined, Object.assign({ 'zeni-tenant-id': action.payload.tenantId }))
10
+ .pipe((0, operators_1.mergeMap)((response) => {
11
+ if ((0, responsePayload_1.isSuccessStatus)(response)) {
12
+ return (0, rxjs_1.from)([
13
+ (0, tenantReducer_1.deleteConnectionSuccess)(action.payload.tenantId, action.payload.connectionId, action.payload.connectionType),
14
+ ]);
15
+ }
16
+ const status = response.status ??
17
+ (0, responsePayload_1.createZeniAPIStatus)('Failed to delete connection. Please try again.');
18
+ return (0, rxjs_1.from)([
19
+ (0, tenantReducer_1.deleteConnectionFailure)(action.payload.tenantId, status),
20
+ ]);
21
+ }), (0, operators_1.catchError)((error) => {
22
+ const message = error instanceof Error
23
+ ? error.message
24
+ : 'Unexpected error deleting connection.';
25
+ return (0, rxjs_1.from)([
26
+ (0, tenantReducer_1.deleteConnectionFailure)(action.payload.tenantId, (0, responsePayload_1.createZeniAPIStatus)(message)),
27
+ ]);
28
+ }))));
29
+ exports.deleteConnectionEpic = deleteConnectionEpic;
@@ -0,0 +1,19 @@
1
+ import { ActionsObservable, StateObservable } from 'redux-observable';
2
+ import { RootState } from '../../../reducer';
3
+ import { ZeniAPI } from '../../../zeniAPI';
4
+ import { saveAPIKeyConnection, saveAPIKeyConnectionFailure, saveAPIKeyConnectionSuccess } from '../tenantReducer';
5
+ export type ActionType = ReturnType<typeof saveAPIKeyConnection> | ReturnType<typeof saveAPIKeyConnectionSuccess> | ReturnType<typeof saveAPIKeyConnectionFailure>;
6
+ export declare const saveAPIKeyConnectionEpic: (actions$: ActionsObservable<ActionType>, _: StateObservable<RootState>, zeniAPI: ZeniAPI) => import("rxjs").Observable<{
7
+ payload: {
8
+ tenantId: string;
9
+ connectionType: "revenue";
10
+ connectionPayload: import("../tenantPayload").ConnectionDataPayload;
11
+ };
12
+ type: "tenant/saveAPIKeyConnectionSuccess";
13
+ } | {
14
+ payload: {
15
+ tenantId: string;
16
+ status: import("../../../responsePayload").ZeniAPIStatus<Record<string, unknown>>;
17
+ };
18
+ type: "tenant/saveAPIKeyConnectionFailure";
19
+ }>;
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.saveAPIKeyConnectionEpic = void 0;
4
+ const rxjs_1 = require("rxjs");
5
+ const operators_1 = require("rxjs/operators");
6
+ const responsePayload_1 = require("../../../responsePayload");
7
+ const tenantReducer_1 = require("../tenantReducer");
8
+ const saveAPIKeyConnectionEpic = (actions$, _, zeniAPI) => actions$.pipe((0, operators_1.filter)(tenantReducer_1.saveAPIKeyConnection.match), (0, operators_1.switchMap)((action) => zeniAPI
9
+ .putAndGetJSON(`${zeniAPI.apiEndPoints.tenantMicroServiceBaseUrl}/1.0/connections/${action.payload.connectionId}`, {
10
+ api_key: action.payload.credentials.api_key,
11
+ connection_name: action.payload.connectionName,
12
+ connection_type: action.payload.connectionType,
13
+ site: action.payload.credentials.site,
14
+ }, Object.assign({ 'zeni-tenant-id': action.payload.tenantId }))
15
+ .pipe((0, operators_1.mergeMap)((response) => {
16
+ if ((0, responsePayload_1.isSuccessResponse)(response)) {
17
+ return (0, rxjs_1.from)([
18
+ (0, tenantReducer_1.saveAPIKeyConnectionSuccess)(action.payload.tenantId, action.payload.connectionType, response.data // eslint-disable-line @typescript-eslint/no-non-null-assertion
19
+ ),
20
+ ]);
21
+ }
22
+ const status = response.status ??
23
+ (0, responsePayload_1.createZeniAPIStatus)('Failed to save connection. Please try again.');
24
+ return (0, rxjs_1.from)([(0, tenantReducer_1.saveAPIKeyConnectionFailure)(action.payload.tenantId, status)]);
25
+ }), (0, operators_1.catchError)((error) => {
26
+ const message = error instanceof Error ? error.message : 'Unexpected error saving connection.';
27
+ return (0, rxjs_1.from)([
28
+ (0, tenantReducer_1.saveAPIKeyConnectionFailure)(action.payload.tenantId, (0, responsePayload_1.createZeniAPIStatus)(message)),
29
+ ]);
30
+ }))));
31
+ exports.saveAPIKeyConnectionEpic = saveAPIKeyConnectionEpic;
@@ -0,0 +1,19 @@
1
+ import { ActionsObservable, StateObservable } from 'redux-observable';
2
+ import { RootState } from '../../../reducer';
3
+ import { ZeniAPI } from '../../../zeniAPI';
4
+ import { saveOAuthConnection, saveOAuthConnectionFailure, saveOAuthConnectionSuccess } from '../tenantReducer';
5
+ export type ActionType = ReturnType<typeof saveOAuthConnection> | ReturnType<typeof saveOAuthConnectionSuccess> | ReturnType<typeof saveOAuthConnectionFailure>;
6
+ export declare const saveOAuthConnectionEpic: (actions$: ActionsObservable<ActionType>, _: StateObservable<RootState>, zeniAPI: ZeniAPI) => import("rxjs").Observable<{
7
+ payload: {
8
+ tenantId: string;
9
+ connectionType: "revenue";
10
+ connectionPayload: import("../tenantPayload").ConnectionDataPayload;
11
+ };
12
+ type: "tenant/saveOAuthConnectionSuccess";
13
+ } | {
14
+ payload: {
15
+ tenantId: string;
16
+ status: import("../../../responsePayload").ZeniAPIStatus<Record<string, unknown>>;
17
+ };
18
+ type: "tenant/saveOAuthConnectionFailure";
19
+ }>;
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.saveOAuthConnectionEpic = void 0;
4
+ const rxjs_1 = require("rxjs");
5
+ const operators_1 = require("rxjs/operators");
6
+ const responsePayload_1 = require("../../../responsePayload");
7
+ const tenantReducer_1 = require("../tenantReducer");
8
+ const saveOAuthConnectionEpic = (actions$, _, zeniAPI) => actions$.pipe((0, operators_1.filter)(tenantReducer_1.saveOAuthConnection.match), (0, operators_1.switchMap)((action) => zeniAPI
9
+ .putAndGetJSON(`${zeniAPI.apiEndPoints.tenantMicroServiceBaseUrl}/1.0/connections/${action.payload.connectionId}`, {
10
+ authorization_code: action.payload.credentials.authorization_code,
11
+ client_id: action.payload.credentials.client_id,
12
+ client_secret: action.payload.credentials.client_secret,
13
+ connection_name: action.payload.connectionName,
14
+ connection_type: action.payload.connectionType,
15
+ redirect_uri: action.payload.credentials.redirect_uri,
16
+ }, Object.assign({ 'zeni-tenant-id': action.payload.tenantId }))
17
+ .pipe((0, operators_1.mergeMap)((response) => {
18
+ if ((0, responsePayload_1.isSuccessResponse)(response)) {
19
+ return (0, rxjs_1.from)([
20
+ (0, tenantReducer_1.saveOAuthConnectionSuccess)(action.payload.tenantId, action.payload.connectionType, response.data // eslint-disable-line @typescript-eslint/no-non-null-assertion
21
+ ),
22
+ ]);
23
+ }
24
+ const status = response.status ??
25
+ (0, responsePayload_1.createZeniAPIStatus)('Failed to save connection. Please try again.');
26
+ return (0, rxjs_1.from)([(0, tenantReducer_1.saveOAuthConnectionFailure)(action.payload.tenantId, status)]);
27
+ }), (0, operators_1.catchError)((error) => {
28
+ const message = error instanceof Error ? error.message : 'Unexpected error saving connection.';
29
+ return (0, rxjs_1.from)([
30
+ (0, tenantReducer_1.saveOAuthConnectionFailure)(action.payload.tenantId, (0, responsePayload_1.createZeniAPIStatus)(message)),
31
+ ]);
32
+ }))));
33
+ exports.saveOAuthConnectionEpic = saveOAuthConnectionEpic;
@@ -140,6 +140,7 @@ interface ConnectionsPayload {
140
140
  connections: {
141
141
  accounting: ConnectionDataPayload[];
142
142
  payments: ConnectionDataPayload[];
143
+ revenue?: ConnectionDataPayload[];
143
144
  };
144
145
  }
145
146
  interface ConnectionWithMetaPayload {
@@ -13,6 +13,10 @@ export interface DoSignInPayload {
13
13
  redirectUri: ZeniUrl;
14
14
  sourceUri: ZeniUrl;
15
15
  }
16
+ export declare const toExternalIntegrationType: (v: string) => "revenue";
17
+ export type ExternalIntegrationType = ReturnType<typeof toExternalIntegrationType>;
18
+ export declare const toExternalSupportedTool: (v: string) => "chargebee" | "hubspot";
19
+ export type ExternalSupportedTool = ReturnType<typeof toExternalSupportedTool>;
16
20
  export declare const initialState: TenantState;
17
21
  export declare const updateTenants: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[tenants: TenantPayload[], userTenantPayload?: TenantUserPayload | undefined, tenantUpdated?: any], {
18
22
  tenants: TenantPayload[];
@@ -80,7 +84,60 @@ export declare const updateTenants: import("@reduxjs/toolkit").ActionCreatorWith
80
84
  }, "tenant/fetchExternalConnectionsFailure", never, never>, fetchExternalConnectionsSuccess: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[tenantId: string, externalConnections: ConnectionsPayload], {
81
85
  tenantId: string;
82
86
  externalConnections: ConnectionsPayload;
83
- }, "tenant/fetchExternalConnectionsSuccess", never, never>, clearAll: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[keepTenantCompanyState?: boolean | undefined], {
87
+ }, "tenant/fetchExternalConnectionsSuccess", never, never>, saveAPIKeyConnection: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[tenantId: string, connectionId: string, connectionType: "revenue", connectionName: "chargebee" | "hubspot", credentials: {
88
+ api_key: string;
89
+ site: string;
90
+ }], {
91
+ tenantId: string;
92
+ connectionId: string;
93
+ connectionType: "revenue";
94
+ connectionName: "chargebee" | "hubspot";
95
+ credentials: {
96
+ api_key: string;
97
+ site: string;
98
+ };
99
+ }, "tenant/saveAPIKeyConnection", never, never>, saveAPIKeyConnectionSuccess: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[tenantId: string, connectionType: "revenue", connectionPayload: ConnectionDataPayload], {
100
+ tenantId: string;
101
+ connectionType: "revenue";
102
+ connectionPayload: ConnectionDataPayload;
103
+ }, "tenant/saveAPIKeyConnectionSuccess", never, never>, saveAPIKeyConnectionFailure: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[tenantId: string, status: ZeniAPIStatus<Record<string, unknown>>], {
104
+ tenantId: string;
105
+ status: ZeniAPIStatus<Record<string, unknown>>;
106
+ }, "tenant/saveAPIKeyConnectionFailure", never, never>, saveOAuthConnection: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[tenantId: string, connectionId: string, connectionType: "revenue", connectionName: "chargebee" | "hubspot", credentials: {
107
+ authorization_code: string;
108
+ client_id: string;
109
+ client_secret: string;
110
+ redirect_uri: string;
111
+ }], {
112
+ tenantId: string;
113
+ connectionId: string;
114
+ connectionType: "revenue";
115
+ connectionName: "chargebee" | "hubspot";
116
+ credentials: {
117
+ authorization_code: string;
118
+ client_id: string;
119
+ client_secret: string;
120
+ redirect_uri: string;
121
+ };
122
+ }, "tenant/saveOAuthConnection", never, never>, saveOAuthConnectionSuccess: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[tenantId: string, connectionType: "revenue", connectionPayload: ConnectionDataPayload], {
123
+ tenantId: string;
124
+ connectionType: "revenue";
125
+ connectionPayload: ConnectionDataPayload;
126
+ }, "tenant/saveOAuthConnectionSuccess", never, never>, saveOAuthConnectionFailure: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[tenantId: string, status: ZeniAPIStatus<Record<string, unknown>>], {
127
+ tenantId: string;
128
+ status: ZeniAPIStatus<Record<string, unknown>>;
129
+ }, "tenant/saveOAuthConnectionFailure", never, never>, deleteConnection: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[tenantId: string, connectionId: string, connectionType: "revenue"], {
130
+ tenantId: string;
131
+ connectionId: string;
132
+ connectionType: "revenue";
133
+ }, "tenant/deleteConnection", never, never>, deleteConnectionSuccess: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[tenantId: string, connectionId: string, connectionType: "revenue"], {
134
+ tenantId: string;
135
+ connectionId: string;
136
+ connectionType: "revenue";
137
+ }, "tenant/deleteConnectionSuccess", never, never>, deleteConnectionFailure: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[tenantId: string, status: ZeniAPIStatus<Record<string, unknown>>], {
138
+ tenantId: string;
139
+ status: ZeniAPIStatus<Record<string, unknown>>;
140
+ }, "tenant/deleteConnectionFailure", never, never>, clearAll: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[keepTenantCompanyState?: boolean | undefined], {
84
141
  keepTenantCompanyState: boolean;
85
142
  }, "tenant/clearAll", never, never>, fetchSubscriptionSummaryForTenant: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[tenantId: string], {
86
143
  tenantId: string;
@@ -128,5 +185,6 @@ export declare const toRoleResource: (payload: RoleResourcePayload) => RoleResou
128
185
  export declare function mapConnectionsPayloadToState(connectionsPayload: ConnectionsPayload): {
129
186
  accounting: Connection[];
130
187
  payments: Connection[];
188
+ revenue: Connection[];
131
189
  };
132
190
  export declare const toConnection: (payload: ConnectionDataPayload) => Connection;
@@ -4,19 +4,26 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  var _a;
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.resendVerifyDeviceOTPSuccess = exports.resendVerifyDeviceOTP = exports.verifyDeviceWithTwoFAFailure = exports.verifyDeviceWithTwoFASuccess = exports.verifyDeviceWithTwoFA = exports.updateTenantMasterTOSInfo = exports.updateTenantAccountingClassesEnabled = exports.trigger2FA = exports.resetSignInState = exports.updateTreasuryVideoViewedForLoggedInUser = exports.updateReferViewedForLoggedInUser = exports.updateTenantReimbursementInfo = exports.removeOnboardingTenant = exports.updateOnboardingTenants = exports.updateSubscriptionSummaryForTenantFailure = exports.updateSubscriptionSummaryForTenantSuccess = exports.fetchSubscriptionSummaryForTenant = exports.clearAll = exports.fetchExternalConnectionsSuccess = exports.fetchExternalConnectionsFailure = exports.saveExternalConnectionFailure = exports.saveExternalConnectionSuccess = exports.saveExternalConnection = exports.fetchExternalConnections = exports.updateLoggedInUser = exports.sessionHeartbeatFailure = exports.sessionHeartbeatSuccess = exports.sendSessionHeartbeat = exports.signOutSuccess = exports.doSignOut = exports.updateSignInState = exports.sendEmailMagicLinkToUserFailure = exports.sendEmailMagicLinkToUserSuccess = exports.sendEmailMagicLinkToUser = exports.magicLinkSignInFailure = exports.magicLinkSignInSuccess = exports.doMagicLinkSignIn = exports.doSignIn = exports.updateExcludedResourcesFailure = exports.updateExcludedResourcesSuccess = exports.fetchExcludedResources = exports.updateCurrentTenant = exports.updateTenantFailure = exports.updateTenantSuccess = exports.fetchActiveTenant = exports.updateTenantsFailure = exports.updateTenantsSuccess = exports.fetchAllTenants = exports.updateTenants = exports.initialState = void 0;
8
- exports.toConnection = exports.toRoleResource = exports.resendVerifyDeviceOTPFailure = void 0;
7
+ exports.updateTenantReimbursementInfo = exports.removeOnboardingTenant = exports.updateOnboardingTenants = exports.updateSubscriptionSummaryForTenantFailure = exports.updateSubscriptionSummaryForTenantSuccess = exports.fetchSubscriptionSummaryForTenant = exports.clearAll = exports.deleteConnectionFailure = exports.deleteConnectionSuccess = exports.deleteConnection = exports.saveOAuthConnectionFailure = exports.saveOAuthConnectionSuccess = exports.saveOAuthConnection = exports.saveAPIKeyConnectionFailure = exports.saveAPIKeyConnectionSuccess = exports.saveAPIKeyConnection = exports.fetchExternalConnectionsSuccess = exports.fetchExternalConnectionsFailure = exports.saveExternalConnectionFailure = exports.saveExternalConnectionSuccess = exports.saveExternalConnection = exports.fetchExternalConnections = exports.updateLoggedInUser = exports.sessionHeartbeatFailure = exports.sessionHeartbeatSuccess = exports.sendSessionHeartbeat = exports.signOutSuccess = exports.doSignOut = exports.updateSignInState = exports.sendEmailMagicLinkToUserFailure = exports.sendEmailMagicLinkToUserSuccess = exports.sendEmailMagicLinkToUser = exports.magicLinkSignInFailure = exports.magicLinkSignInSuccess = exports.doMagicLinkSignIn = exports.doSignIn = exports.updateExcludedResourcesFailure = exports.updateExcludedResourcesSuccess = exports.fetchExcludedResources = exports.updateCurrentTenant = exports.updateTenantFailure = exports.updateTenantSuccess = exports.fetchActiveTenant = exports.updateTenantsFailure = exports.updateTenantsSuccess = exports.fetchAllTenants = exports.updateTenants = exports.initialState = exports.toExternalSupportedTool = exports.toExternalIntegrationType = void 0;
8
+ exports.toConnection = exports.toRoleResource = exports.resendVerifyDeviceOTPFailure = exports.resendVerifyDeviceOTPSuccess = exports.resendVerifyDeviceOTP = exports.verifyDeviceWithTwoFAFailure = exports.verifyDeviceWithTwoFASuccess = exports.verifyDeviceWithTwoFA = exports.updateTenantMasterTOSInfo = exports.updateTenantAccountingClassesEnabled = exports.trigger2FA = exports.resetSignInState = exports.updateTreasuryVideoViewedForLoggedInUser = exports.updateReferViewedForLoggedInUser = void 0;
9
9
  exports.mapConnectionsPayloadToState = mapConnectionsPayloadToState;
10
10
  const toolkit_1 = require("@reduxjs/toolkit");
11
11
  const js_base64_1 = require("js-base64");
12
12
  const assignWith_1 = __importDefault(require("lodash/assignWith"));
13
13
  const urlPayload_1 = require("../../commonPayloadTypes/urlPayload");
14
+ const stringToUnion_1 = require("../../commonStateTypes/stringToUnion");
14
15
  const timePeriod_1 = require("../../commonStateTypes/timePeriod");
15
16
  const netBurnOrIncomeStoryCardSelectorTypes_1 = require("../../view/netBurnOrIncomeStoryCard/netBurnOrIncomeStoryCardSelectorTypes");
16
17
  const netBurnOrIncomeStoryCardState_1 = require("../../view/netBurnOrIncomeStoryCard/netBurnOrIncomeStoryCardState");
17
18
  const zeniDayJS_1 = require("../../zeniDayJS");
18
19
  const subscriptionSummaryReducer_1 = require("../subscription/subscriptionSummary/subscriptionSummaryReducer");
19
20
  const userRolePayload_1 = require("../userRole/userRolePayload");
21
+ const EXTERNAL_INTEGRATION_TYPES = ['revenue'];
22
+ const toExternalIntegrationType = (v) => (0, stringToUnion_1.stringToUnion)(v, EXTERNAL_INTEGRATION_TYPES);
23
+ exports.toExternalIntegrationType = toExternalIntegrationType;
24
+ const EXTERNAL_SUPPORTED_TOOLS = ['chargebee', 'hubspot'];
25
+ const toExternalSupportedTool = (v) => (0, stringToUnion_1.stringToUnion)(v, EXTERNAL_SUPPORTED_TOOLS);
26
+ exports.toExternalSupportedTool = toExternalSupportedTool;
20
27
  exports.initialState = {
21
28
  fetchState: 'Not-Started',
22
29
  error: undefined,
@@ -341,7 +348,11 @@ const tenant = (0, toolkit_1.createSlice)({
341
348
  fetchState: 'In-Progress',
342
349
  accounting: [],
343
350
  payments: [],
351
+ revenue: [],
344
352
  saveConnectionState: 'Not-Started',
353
+ saveAPIKeyConnectionState: 'Not-Started',
354
+ saveOAuthConnectionState: 'Not-Started',
355
+ deleteConnectionState: 'Not-Started',
345
356
  error: undefined,
346
357
  };
347
358
  },
@@ -351,12 +362,16 @@ const tenant = (0, toolkit_1.createSlice)({
351
362
  return { payload: { tenantId, externalConnections } };
352
363
  },
353
364
  reducer(draft, action) {
354
- const { accounting, payments } = mapConnectionsPayloadToState(action.payload.externalConnections);
365
+ const { accounting, payments, revenue } = mapConnectionsPayloadToState(action.payload.externalConnections);
355
366
  draft.externalConnectionsByTenant[action.payload.tenantId] = {
356
367
  fetchState: 'Completed',
357
368
  accounting,
358
369
  payments,
370
+ revenue,
359
371
  saveConnectionState: 'Completed',
372
+ saveAPIKeyConnectionState: 'Not-Started',
373
+ saveOAuthConnectionState: 'Not-Started',
374
+ deleteConnectionState: 'Not-Started',
360
375
  error: undefined,
361
376
  };
362
377
  },
@@ -371,7 +386,11 @@ const tenant = (0, toolkit_1.createSlice)({
371
386
  fetchState: 'Error',
372
387
  accounting: [],
373
388
  payments: [],
389
+ revenue: [],
374
390
  saveConnectionState: 'Error',
391
+ saveAPIKeyConnectionState: 'Not-Started',
392
+ saveOAuthConnectionState: 'Not-Started',
393
+ deleteConnectionState: 'Not-Started',
375
394
  error: status,
376
395
  };
377
396
  },
@@ -417,6 +436,121 @@ const tenant = (0, toolkit_1.createSlice)({
417
436
  });
418
437
  },
419
438
  },
439
+ saveAPIKeyConnection: {
440
+ prepare(tenantId, connectionId, connectionType, connectionName, credentials) {
441
+ return { payload: { tenantId, connectionId, connectionType, connectionName, credentials } };
442
+ },
443
+ reducer(draft, action) {
444
+ const existing = draft.externalConnectionsByTenant[action.payload.tenantId];
445
+ if (existing != null) {
446
+ existing.saveAPIKeyConnectionState = 'In-Progress';
447
+ existing.saveAPIKeyConnectionError = undefined;
448
+ }
449
+ },
450
+ },
451
+ saveAPIKeyConnectionSuccess: {
452
+ prepare(tenantId, connectionType, connectionPayload) {
453
+ return { payload: { tenantId, connectionType, connectionPayload } };
454
+ },
455
+ reducer(draft, action) {
456
+ const existing = draft.externalConnectionsByTenant[action.payload.tenantId];
457
+ if (existing != null) {
458
+ existing.saveAPIKeyConnectionState = 'Completed';
459
+ existing[action.payload.connectionType] = [(0, exports.toConnection)(action.payload.connectionPayload)];
460
+ existing.saveAPIKeyConnectionError = undefined;
461
+ }
462
+ },
463
+ },
464
+ saveAPIKeyConnectionFailure: {
465
+ prepare(tenantId, status) {
466
+ return { payload: { tenantId, status } };
467
+ },
468
+ reducer(draft, action) {
469
+ const existing = draft.externalConnectionsByTenant[action.payload.tenantId];
470
+ if (existing != null) {
471
+ existing.saveAPIKeyConnectionState = 'Error';
472
+ existing.saveAPIKeyConnectionError = action.payload.status;
473
+ }
474
+ },
475
+ },
476
+ saveOAuthConnection: {
477
+ prepare(tenantId, connectionId, connectionType, connectionName, credentials) {
478
+ return { payload: { tenantId, connectionId, connectionType, connectionName, credentials } };
479
+ },
480
+ reducer(draft, action) {
481
+ const existing = draft.externalConnectionsByTenant[action.payload.tenantId];
482
+ if (existing != null) {
483
+ existing.saveOAuthConnectionState = 'In-Progress';
484
+ existing.saveOAuthConnectionError = undefined;
485
+ }
486
+ },
487
+ },
488
+ saveOAuthConnectionSuccess: {
489
+ prepare(tenantId, connectionType, connectionPayload) {
490
+ return { payload: { tenantId, connectionType, connectionPayload } };
491
+ },
492
+ reducer(draft, action) {
493
+ const existing = draft.externalConnectionsByTenant[action.payload.tenantId];
494
+ if (existing != null) {
495
+ existing.saveOAuthConnectionState = 'Completed';
496
+ existing[action.payload.connectionType] = [(0, exports.toConnection)(action.payload.connectionPayload)];
497
+ existing.saveOAuthConnectionError = undefined;
498
+ }
499
+ },
500
+ },
501
+ saveOAuthConnectionFailure: {
502
+ prepare(tenantId, status) {
503
+ return { payload: { tenantId, status } };
504
+ },
505
+ reducer(draft, action) {
506
+ const existing = draft.externalConnectionsByTenant[action.payload.tenantId];
507
+ if (existing != null) {
508
+ existing.saveOAuthConnectionState = 'Error';
509
+ existing.saveOAuthConnectionError = action.payload.status;
510
+ }
511
+ },
512
+ },
513
+ deleteConnection: {
514
+ prepare(tenantId, connectionId, connectionType) {
515
+ return { payload: { tenantId, connectionId, connectionType } };
516
+ },
517
+ reducer(draft, action) {
518
+ const existing = draft.externalConnectionsByTenant[action.payload.tenantId];
519
+ if (existing != null) {
520
+ existing.deleteConnectionState = 'In-Progress';
521
+ existing.deleteConnectionError = undefined;
522
+ }
523
+ },
524
+ },
525
+ deleteConnectionSuccess: {
526
+ prepare(tenantId, connectionId, connectionType) {
527
+ return { payload: { tenantId, connectionId, connectionType } };
528
+ },
529
+ reducer(draft, action) {
530
+ const existing = draft.externalConnectionsByTenant[action.payload.tenantId];
531
+ if (existing != null) {
532
+ existing.deleteConnectionState = 'Completed';
533
+ existing.deleteConnectionError = undefined;
534
+ const arr = existing[action.payload.connectionType];
535
+ const idx = arr.findIndex((c) => c.connectionId === action.payload.connectionId);
536
+ if (idx !== -1) {
537
+ arr[idx] = { ...arr[idx], isValid: false };
538
+ }
539
+ }
540
+ },
541
+ },
542
+ deleteConnectionFailure: {
543
+ prepare(tenantId, status) {
544
+ return { payload: { tenantId, status } };
545
+ },
546
+ reducer(draft, action) {
547
+ const existing = draft.externalConnectionsByTenant[action.payload.tenantId];
548
+ if (existing != null) {
549
+ existing.deleteConnectionState = 'Error';
550
+ existing.deleteConnectionError = action.payload.status;
551
+ }
552
+ },
553
+ },
420
554
  doSignOut(draft) {
421
555
  draft.fetchState = 'Not-Started';
422
556
  draft.signInState = 'Not-Started';
@@ -564,7 +698,7 @@ const tenant = (0, toolkit_1.createSlice)({
564
698
  },
565
699
  },
566
700
  });
567
- _a = tenant.actions, exports.updateTenants = _a.updateTenants, exports.fetchAllTenants = _a.fetchAllTenants, exports.updateTenantsSuccess = _a.updateTenantsSuccess, exports.updateTenantsFailure = _a.updateTenantsFailure, exports.fetchActiveTenant = _a.fetchActiveTenant, exports.updateTenantSuccess = _a.updateTenantSuccess, exports.updateTenantFailure = _a.updateTenantFailure, exports.updateCurrentTenant = _a.updateCurrentTenant, exports.fetchExcludedResources = _a.fetchExcludedResources, exports.updateExcludedResourcesSuccess = _a.updateExcludedResourcesSuccess, exports.updateExcludedResourcesFailure = _a.updateExcludedResourcesFailure, exports.doSignIn = _a.doSignIn, exports.doMagicLinkSignIn = _a.doMagicLinkSignIn, exports.magicLinkSignInSuccess = _a.magicLinkSignInSuccess, exports.magicLinkSignInFailure = _a.magicLinkSignInFailure, exports.sendEmailMagicLinkToUser = _a.sendEmailMagicLinkToUser, exports.sendEmailMagicLinkToUserSuccess = _a.sendEmailMagicLinkToUserSuccess, exports.sendEmailMagicLinkToUserFailure = _a.sendEmailMagicLinkToUserFailure, exports.updateSignInState = _a.updateSignInState, exports.doSignOut = _a.doSignOut, exports.signOutSuccess = _a.signOutSuccess, exports.sendSessionHeartbeat = _a.sendSessionHeartbeat, exports.sessionHeartbeatSuccess = _a.sessionHeartbeatSuccess, exports.sessionHeartbeatFailure = _a.sessionHeartbeatFailure, exports.updateLoggedInUser = _a.updateLoggedInUser, exports.fetchExternalConnections = _a.fetchExternalConnections, exports.saveExternalConnection = _a.saveExternalConnection, exports.saveExternalConnectionSuccess = _a.saveExternalConnectionSuccess, exports.saveExternalConnectionFailure = _a.saveExternalConnectionFailure, exports.fetchExternalConnectionsFailure = _a.fetchExternalConnectionsFailure, exports.fetchExternalConnectionsSuccess = _a.fetchExternalConnectionsSuccess, exports.clearAll = _a.clearAll, exports.fetchSubscriptionSummaryForTenant = _a.fetchSubscriptionSummaryForTenant, exports.updateSubscriptionSummaryForTenantSuccess = _a.updateSubscriptionSummaryForTenantSuccess, exports.updateSubscriptionSummaryForTenantFailure = _a.updateSubscriptionSummaryForTenantFailure, exports.updateOnboardingTenants = _a.updateOnboardingTenants, exports.removeOnboardingTenant = _a.removeOnboardingTenant, exports.updateTenantReimbursementInfo = _a.updateTenantReimbursementInfo, exports.updateReferViewedForLoggedInUser = _a.updateReferViewedForLoggedInUser, exports.updateTreasuryVideoViewedForLoggedInUser = _a.updateTreasuryVideoViewedForLoggedInUser, exports.resetSignInState = _a.resetSignInState, exports.trigger2FA = _a.trigger2FA, exports.updateTenantAccountingClassesEnabled = _a.updateTenantAccountingClassesEnabled, exports.updateTenantMasterTOSInfo = _a.updateTenantMasterTOSInfo, exports.verifyDeviceWithTwoFA = _a.verifyDeviceWithTwoFA, exports.verifyDeviceWithTwoFASuccess = _a.verifyDeviceWithTwoFASuccess, exports.verifyDeviceWithTwoFAFailure = _a.verifyDeviceWithTwoFAFailure, exports.resendVerifyDeviceOTP = _a.resendVerifyDeviceOTP, exports.resendVerifyDeviceOTPSuccess = _a.resendVerifyDeviceOTPSuccess, exports.resendVerifyDeviceOTPFailure = _a.resendVerifyDeviceOTPFailure;
701
+ _a = tenant.actions, exports.updateTenants = _a.updateTenants, exports.fetchAllTenants = _a.fetchAllTenants, exports.updateTenantsSuccess = _a.updateTenantsSuccess, exports.updateTenantsFailure = _a.updateTenantsFailure, exports.fetchActiveTenant = _a.fetchActiveTenant, exports.updateTenantSuccess = _a.updateTenantSuccess, exports.updateTenantFailure = _a.updateTenantFailure, exports.updateCurrentTenant = _a.updateCurrentTenant, exports.fetchExcludedResources = _a.fetchExcludedResources, exports.updateExcludedResourcesSuccess = _a.updateExcludedResourcesSuccess, exports.updateExcludedResourcesFailure = _a.updateExcludedResourcesFailure, exports.doSignIn = _a.doSignIn, exports.doMagicLinkSignIn = _a.doMagicLinkSignIn, exports.magicLinkSignInSuccess = _a.magicLinkSignInSuccess, exports.magicLinkSignInFailure = _a.magicLinkSignInFailure, exports.sendEmailMagicLinkToUser = _a.sendEmailMagicLinkToUser, exports.sendEmailMagicLinkToUserSuccess = _a.sendEmailMagicLinkToUserSuccess, exports.sendEmailMagicLinkToUserFailure = _a.sendEmailMagicLinkToUserFailure, exports.updateSignInState = _a.updateSignInState, exports.doSignOut = _a.doSignOut, exports.signOutSuccess = _a.signOutSuccess, exports.sendSessionHeartbeat = _a.sendSessionHeartbeat, exports.sessionHeartbeatSuccess = _a.sessionHeartbeatSuccess, exports.sessionHeartbeatFailure = _a.sessionHeartbeatFailure, exports.updateLoggedInUser = _a.updateLoggedInUser, exports.fetchExternalConnections = _a.fetchExternalConnections, exports.saveExternalConnection = _a.saveExternalConnection, exports.saveExternalConnectionSuccess = _a.saveExternalConnectionSuccess, exports.saveExternalConnectionFailure = _a.saveExternalConnectionFailure, exports.fetchExternalConnectionsFailure = _a.fetchExternalConnectionsFailure, exports.fetchExternalConnectionsSuccess = _a.fetchExternalConnectionsSuccess, exports.saveAPIKeyConnection = _a.saveAPIKeyConnection, exports.saveAPIKeyConnectionSuccess = _a.saveAPIKeyConnectionSuccess, exports.saveAPIKeyConnectionFailure = _a.saveAPIKeyConnectionFailure, exports.saveOAuthConnection = _a.saveOAuthConnection, exports.saveOAuthConnectionSuccess = _a.saveOAuthConnectionSuccess, exports.saveOAuthConnectionFailure = _a.saveOAuthConnectionFailure, exports.deleteConnection = _a.deleteConnection, exports.deleteConnectionSuccess = _a.deleteConnectionSuccess, exports.deleteConnectionFailure = _a.deleteConnectionFailure, exports.clearAll = _a.clearAll, exports.fetchSubscriptionSummaryForTenant = _a.fetchSubscriptionSummaryForTenant, exports.updateSubscriptionSummaryForTenantSuccess = _a.updateSubscriptionSummaryForTenantSuccess, exports.updateSubscriptionSummaryForTenantFailure = _a.updateSubscriptionSummaryForTenantFailure, exports.updateOnboardingTenants = _a.updateOnboardingTenants, exports.removeOnboardingTenant = _a.removeOnboardingTenant, exports.updateTenantReimbursementInfo = _a.updateTenantReimbursementInfo, exports.updateReferViewedForLoggedInUser = _a.updateReferViewedForLoggedInUser, exports.updateTreasuryVideoViewedForLoggedInUser = _a.updateTreasuryVideoViewedForLoggedInUser, exports.resetSignInState = _a.resetSignInState, exports.trigger2FA = _a.trigger2FA, exports.updateTenantAccountingClassesEnabled = _a.updateTenantAccountingClassesEnabled, exports.updateTenantMasterTOSInfo = _a.updateTenantMasterTOSInfo, exports.verifyDeviceWithTwoFA = _a.verifyDeviceWithTwoFA, exports.verifyDeviceWithTwoFASuccess = _a.verifyDeviceWithTwoFASuccess, exports.verifyDeviceWithTwoFAFailure = _a.verifyDeviceWithTwoFAFailure, exports.resendVerifyDeviceOTP = _a.resendVerifyDeviceOTP, exports.resendVerifyDeviceOTPSuccess = _a.resendVerifyDeviceOTPSuccess, exports.resendVerifyDeviceOTPFailure = _a.resendVerifyDeviceOTPFailure;
568
702
  exports.default = tenant.reducer;
569
703
  /**
570
704
  * Converts tenants payload to Tenant and User State
@@ -693,6 +827,7 @@ function mapConnectionsPayloadToState(connectionsPayload) {
693
827
  return {
694
828
  accounting: connections.accounting.map((payload) => (0, exports.toConnection)(payload)),
695
829
  payments: connections.payments.map((payload) => (0, exports.toConnection)(payload)),
830
+ revenue: (connections.revenue ?? []).map((payload) => (0, exports.toConnection)(payload)),
696
831
  };
697
832
  }
698
833
  const toConnection = (payload) => ({
@@ -12,10 +12,17 @@ import { UserRoleType } from '../userRole/userRoleType';
12
12
  import { AuthProvider } from './tenantReducer';
13
13
  export interface TenantExternalConnections {
14
14
  accounting: Connection[];
15
+ deleteConnectionState: FetchState;
15
16
  fetchState: FetchState;
16
17
  payments: Connection[];
18
+ revenue: Connection[];
19
+ saveAPIKeyConnectionState: FetchState;
17
20
  saveConnectionState: FetchState;
21
+ saveOAuthConnectionState: FetchState;
22
+ deleteConnectionError?: ZeniAPIStatus;
18
23
  error?: ZeniAPIStatus;
24
+ saveAPIKeyConnectionError?: ZeniAPIStatus;
25
+ saveOAuthConnectionError?: ZeniAPIStatus;
19
26
  }
20
27
  export interface TenantState extends FetchedState {
21
28
  accountLocked: boolean;