@zeniai/client-epic-state 5.1.61 → 5.1.62-betaRD1

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 (131) hide show
  1. package/lib/coreEpics.js +3 -2
  2. package/lib/entity/chargeCard/chargeCard.d.ts +1 -1
  3. package/lib/entity/jeSchedules/jeSchedulesPayload.d.ts +2 -0
  4. package/lib/entity/jeSchedules/jeSchedulesPayload.js +2 -0
  5. package/lib/entity/jeSchedules/jeSchedulesSelector.d.ts +4 -0
  6. package/lib/entity/jeSchedules/jeSchedulesSelector.js +11 -1
  7. package/lib/entity/jeSchedules/jeSchedulesState.d.ts +2 -0
  8. package/lib/entity/notificationRegistry/notificationRegistryPayload.d.ts +18 -0
  9. package/lib/entity/notificationRegistry/notificationRegistryPayload.js +28 -0
  10. package/lib/entity/notificationRegistry/notificationRegistryReducer.d.ts +10 -0
  11. package/lib/entity/notificationRegistry/notificationRegistryReducer.js +50 -0
  12. package/lib/entity/notificationRegistry/notificationRegistrySelector.d.ts +2 -0
  13. package/lib/entity/notificationRegistry/notificationRegistrySelector.js +10 -0
  14. package/lib/entity/notificationRegistry/notificationRegistryState.d.ts +32 -0
  15. package/lib/entity/notificationRegistry/notificationRegistryState.js +10 -0
  16. package/lib/entity/snackbar/snackbarTypes.d.ts +1 -1
  17. package/lib/entity/snackbar/snackbarTypes.js +3 -0
  18. package/lib/entity/tenant/clearAllEpic.d.ts +3 -1
  19. package/lib/entity/tenant/clearAllEpic.js +4 -0
  20. package/lib/entity/tenant/tenantReducer.d.ts +4 -1
  21. package/lib/entity/tenant/tenantReducer.js +8 -2
  22. package/lib/entity/tenant/tenantSelector.d.ts +1 -0
  23. package/lib/entity/tenant/tenantSelector.js +4 -0
  24. package/lib/entity/transaction/scheduleTransactionHelper.d.ts +15 -0
  25. package/lib/entity/transaction/scheduleTransactionHelper.js +43 -0
  26. package/lib/epic.d.ts +9 -1
  27. package/lib/epic.js +9 -1
  28. package/lib/esm/coreEpics.js +3 -2
  29. package/lib/esm/entity/jeSchedules/jeSchedulesPayload.js +2 -0
  30. package/lib/esm/entity/jeSchedules/jeSchedulesSelector.js +11 -1
  31. package/lib/esm/entity/notificationRegistry/notificationRegistryPayload.js +24 -0
  32. package/lib/esm/entity/notificationRegistry/notificationRegistryReducer.js +46 -0
  33. package/lib/esm/entity/notificationRegistry/notificationRegistrySelector.js +6 -0
  34. package/lib/esm/entity/notificationRegistry/notificationRegistryState.js +5 -0
  35. package/lib/esm/entity/snackbar/snackbarTypes.js +3 -0
  36. package/lib/esm/entity/tenant/clearAllEpic.js +4 -0
  37. package/lib/esm/entity/tenant/tenantReducer.js +7 -1
  38. package/lib/esm/entity/tenant/tenantSelector.js +3 -0
  39. package/lib/esm/entity/transaction/scheduleTransactionHelper.js +39 -0
  40. package/lib/esm/epic.js +9 -1
  41. package/lib/esm/index.js +14 -6
  42. package/lib/esm/reducer.js +6 -0
  43. package/lib/esm/view/companyView/companyViewReducer.js +68 -1
  44. package/lib/esm/view/companyView/epic/companyPassport/dismissCapitalizationOnboardingEpic.js +2 -1
  45. package/lib/esm/view/companyView/epic/companyPassport/projects/disableAccountingProjectsEpic.js +56 -0
  46. package/lib/esm/view/companyView/epic/companyPassport/projects/enableAccountingProjectsEpic.js +37 -0
  47. package/lib/esm/view/companyView/epic/companyPassport/projects/resumeEnableAccountingProjectsEpic.js +73 -0
  48. package/lib/esm/view/companyView/epic/companyPassport/updateAccountingClassesEnabledEpic.js +2 -1
  49. package/lib/esm/view/companyView/epic/companyPassport/updateCapitalizationAccountThresholdEpic.js +2 -1
  50. package/lib/esm/view/companyView/types/companyPassport/companyPassportViewState.js +5 -0
  51. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulesEpic.js +15 -2
  52. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/newSchedule/initializeNewScheduleEpic.js +21 -0
  53. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/newSchedule/saveNewScheduleEpic.js +110 -0
  54. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/newSchedule/searchTransactionsForNewScheduleEpic.js +44 -0
  55. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/switchJESchedulesTabEpic.js +22 -0
  56. package/lib/esm/view/expenseAutomationView/helpers/newScheduleLocalDataHelper.js +152 -0
  57. package/lib/esm/view/expenseAutomationView/reducers/jeSchedulesViewReducer.js +126 -6
  58. package/lib/esm/view/expenseAutomationView/selectorTypes/jeNewScheduleViewSelectorTypes.js +1 -0
  59. package/lib/esm/view/expenseAutomationView/selectors/jeNewScheduleViewSelector.js +71 -0
  60. package/lib/esm/view/expenseAutomationView/selectors/jeSchedulesViewSelector.js +65 -11
  61. package/lib/esm/view/expenseAutomationView/types/jeSchedulesViewState.js +3 -6
  62. package/lib/esm/view/notificationPreferencesView/epics/saveNotificationPreferencesEpic.js +116 -0
  63. package/lib/esm/view/notificationPreferencesView/notificationPreferencesEndpoint.js +5 -0
  64. package/lib/esm/view/notificationPreferencesView/notificationPreferencesViewPayload.js +36 -0
  65. package/lib/esm/view/notificationPreferencesView/notificationPreferencesViewReducer.js +222 -0
  66. package/lib/esm/view/notificationPreferencesView/notificationPreferencesViewSelector.js +25 -0
  67. package/lib/esm/view/notificationPreferencesView/notificationPreferencesViewState.js +4 -0
  68. package/lib/esm/view/settingsView/epic/fetchNotificationSettingsEpic.js +34 -2
  69. package/lib/esm/view/settingsView/epic/saveNotificationSettingsEpic.js +2 -1
  70. package/lib/esm/view/settingsView/settingsViewHelpers.js +3 -2
  71. package/lib/index.d.ts +17 -8
  72. package/lib/index.js +85 -47
  73. package/lib/reducer.d.ts +6 -0
  74. package/lib/reducer.js +6 -0
  75. package/lib/view/common/recurringViewHelper.d.ts +2 -2
  76. package/lib/view/companyView/companyViewReducer.d.ts +9 -1
  77. package/lib/view/companyView/companyViewReducer.js +70 -3
  78. package/lib/view/companyView/epic/companyPassport/dismissCapitalizationOnboardingEpic.js +2 -1
  79. package/lib/view/companyView/epic/companyPassport/projects/disableAccountingProjectsEpic.d.ts +10 -0
  80. package/lib/view/companyView/epic/companyPassport/projects/disableAccountingProjectsEpic.js +60 -0
  81. package/lib/view/companyView/epic/companyPassport/projects/enableAccountingProjectsEpic.d.ts +11 -0
  82. package/lib/view/companyView/epic/companyPassport/projects/enableAccountingProjectsEpic.js +41 -0
  83. package/lib/view/companyView/epic/companyPassport/projects/resumeEnableAccountingProjectsEpic.d.ts +13 -0
  84. package/lib/view/companyView/epic/companyPassport/projects/resumeEnableAccountingProjectsEpic.js +77 -0
  85. package/lib/view/companyView/epic/companyPassport/updateAccountingClassesEnabledEpic.js +2 -1
  86. package/lib/view/companyView/epic/companyPassport/updateCapitalizationAccountThresholdEpic.js +2 -1
  87. package/lib/view/companyView/types/companyPassport/companyPassportViewState.d.ts +2 -0
  88. package/lib/view/companyView/types/companyPassport/companyPassportViewState.js +5 -0
  89. package/lib/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulesEpic.js +14 -1
  90. package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/initializeNewScheduleEpic.d.ts +8 -0
  91. package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/initializeNewScheduleEpic.js +25 -0
  92. package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/saveNewScheduleEpic.d.ts +45 -0
  93. package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/saveNewScheduleEpic.js +114 -0
  94. package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/searchTransactionsForNewScheduleEpic.d.ts +8 -0
  95. package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/searchTransactionsForNewScheduleEpic.js +48 -0
  96. package/lib/view/expenseAutomationView/epics/jeSchedule/switchJESchedulesTabEpic.d.ts +6 -0
  97. package/lib/view/expenseAutomationView/epics/jeSchedule/switchJESchedulesTabEpic.js +26 -0
  98. package/lib/view/expenseAutomationView/helpers/newScheduleLocalDataHelper.d.ts +43 -0
  99. package/lib/view/expenseAutomationView/helpers/newScheduleLocalDataHelper.js +158 -0
  100. package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.d.ts +1 -1
  101. package/lib/view/expenseAutomationView/payload/jeSchedulesPayload.d.ts +1 -0
  102. package/lib/view/expenseAutomationView/reducers/jeSchedulesViewReducer.d.ts +36 -8
  103. package/lib/view/expenseAutomationView/reducers/jeSchedulesViewReducer.js +128 -7
  104. package/lib/view/expenseAutomationView/selectorTypes/jeNewScheduleViewSelectorTypes.d.ts +25 -0
  105. package/lib/view/expenseAutomationView/selectorTypes/jeNewScheduleViewSelectorTypes.js +2 -0
  106. package/lib/view/expenseAutomationView/selectorTypes/jeSchedulesSelectorTypes.d.ts +29 -4
  107. package/lib/view/expenseAutomationView/selectors/jeNewScheduleViewSelector.d.ts +10 -0
  108. package/lib/view/expenseAutomationView/selectors/jeNewScheduleViewSelector.js +76 -0
  109. package/lib/view/expenseAutomationView/selectors/jeSchedulesViewSelector.js +65 -11
  110. package/lib/view/expenseAutomationView/types/jeSchedulesViewState.d.ts +53 -6
  111. package/lib/view/expenseAutomationView/types/jeSchedulesViewState.js +5 -8
  112. package/lib/view/notificationPreferencesView/epics/saveNotificationPreferencesEpic.d.ts +40 -0
  113. package/lib/view/notificationPreferencesView/epics/saveNotificationPreferencesEpic.js +120 -0
  114. package/lib/view/notificationPreferencesView/notificationPreferencesEndpoint.d.ts +2 -0
  115. package/lib/view/notificationPreferencesView/notificationPreferencesEndpoint.js +9 -0
  116. package/lib/view/notificationPreferencesView/notificationPreferencesViewPayload.d.ts +7 -0
  117. package/lib/view/notificationPreferencesView/notificationPreferencesViewPayload.js +41 -0
  118. package/lib/view/notificationPreferencesView/notificationPreferencesViewReducer.d.ts +30 -0
  119. package/lib/view/notificationPreferencesView/notificationPreferencesViewReducer.js +226 -0
  120. package/lib/view/notificationPreferencesView/notificationPreferencesViewSelector.d.ts +7 -0
  121. package/lib/view/notificationPreferencesView/notificationPreferencesViewSelector.js +32 -0
  122. package/lib/view/notificationPreferencesView/notificationPreferencesViewState.d.ts +14 -0
  123. package/lib/view/notificationPreferencesView/notificationPreferencesViewState.js +8 -0
  124. package/lib/view/settingsView/epic/fetchNotificationSettingsEpic.d.ts +9 -1
  125. package/lib/view/settingsView/epic/fetchNotificationSettingsEpic.js +34 -2
  126. package/lib/view/settingsView/epic/saveNotificationSettingsEpic.js +2 -1
  127. package/lib/view/settingsView/settingsViewHelpers.d.ts +1 -1
  128. package/lib/view/settingsView/settingsViewHelpers.js +3 -2
  129. package/lib/view/settingsView/settingsViewPayload.d.ts +4 -0
  130. package/lib/view/settingsView/settingsViewState.d.ts +1 -1
  131. package/package.json +1 -1
package/lib/reducer.d.ts CHANGED
@@ -45,6 +45,7 @@ import { JESchedulesState } from './entity/jeSchedules/jeSchedulesState';
45
45
  import { MerchantState } from './entity/merchant/merchant';
46
46
  import { MonthEndCloseChecksState } from './entity/monthEndCloseChecks/monthEndCloseChecksState';
47
47
  import { NotificationState } from './entity/notification/notificationState';
48
+ import { NotificationRegistryState } from './entity/notificationRegistry/notificationRegistryState';
48
49
  import { OnboardingCustomerState } from './entity/onboardingCustomer/onboardingCustomerState';
49
50
  import { PaymentAccountState } from './entity/paymentAccount/paymentAccountState';
50
51
  import { PaymentInstrumentState } from './entity/paymentInstrument/paymentInstrument';
@@ -166,6 +167,7 @@ import { MonthEndCloseChecksViewState } from './view/monthEndCloseChecksView/mon
166
167
  import { NetBurnOrIncomeWithForecastState } from './view/netBurnOrIncome/netBurnOrIncomeState';
167
168
  import { NetBurnOrIncomeClassesViewState } from './view/netBurnOrIncomeClassesView/netBurnOrIncomeClassesViewState';
168
169
  import { NetBurnOrIncomeStoryCardState } from './view/netBurnOrIncomeStoryCard/netBurnOrIncomeStoryCardState';
170
+ import { NotificationPreferencesViewState } from './view/notificationPreferencesView/notificationPreferencesViewState';
169
171
  import { NotificationViewState } from './view/notificationView/notificationViewState';
170
172
  import { OnboardingCockpitViewState } from './view/onboardingView/cockpitView/onboardingCockpitViewState';
171
173
  import { OnboardingCustomerViewState } from './view/onboardingView/customerView/onboardingCustomerViewState';
@@ -478,6 +480,8 @@ type ViewsState = {
478
480
  netBurnOrIncomeClassesViewState: NetBurnOrIncomeClassesViewState;
479
481
  netBurnOrIncomeState: NetBurnOrIncomeWithForecastState;
480
482
  netBurnOrIncomeStoryCardState: NetBurnOrIncomeStoryCardState;
483
+ notificationPreferencesViewState: NotificationPreferencesViewState;
484
+ notificationRegistryState: NotificationRegistryState;
481
485
  notificationViewState: NotificationViewState;
482
486
  onboardingCockpitViewState: OnboardingCockpitViewState;
483
487
  onboardingCustomerViewState: OnboardingCustomerViewState;
@@ -680,6 +684,8 @@ declare const reducers: import("redux").Reducer<import("redux").CombinedState<{
680
684
  netBurnOrIncomeClassesViewState: NetBurnOrIncomeClassesViewState;
681
685
  netBurnOrIncomeState: NetBurnOrIncomeWithForecastState;
682
686
  netBurnOrIncomeStoryCardState: NetBurnOrIncomeStoryCardState;
687
+ notificationPreferencesViewState: NotificationPreferencesViewState;
688
+ notificationRegistryState: NotificationRegistryState;
683
689
  notificationViewState: NotificationViewState;
684
690
  onboardingCockpitViewState: OnboardingCockpitViewState;
685
691
  onboardingCustomerViewState: OnboardingCustomerViewState;
package/lib/reducer.js CHANGED
@@ -85,6 +85,7 @@ const jeSchedulesReducer_1 = __importStar(require("./entity/jeSchedules/jeSchedu
85
85
  const merchantReducer_1 = __importStar(require("./entity/merchant/merchantReducer"));
86
86
  const monthEndCloseChecksReducer_1 = __importStar(require("./entity/monthEndCloseChecks/monthEndCloseChecksReducer"));
87
87
  const notificationReducer_1 = __importStar(require("./entity/notification/notificationReducer"));
88
+ const notificationRegistryReducer_1 = __importStar(require("./entity/notificationRegistry/notificationRegistryReducer"));
88
89
  const onboardingCustomerReducer_1 = __importStar(require("./entity/onboardingCustomer/onboardingCustomerReducer"));
89
90
  const paymentAccountReducer_1 = __importStar(require("./entity/paymentAccount/paymentAccountReducer"));
90
91
  const paymentInstrumentReducer_1 = __importStar(require("./entity/paymentInstrument/paymentInstrumentReducer"));
@@ -207,6 +208,7 @@ const monthEndCloseChecksViewReducer_1 = __importStar(require("./view/monthEndCl
207
208
  const netBurnOrIncomeReducer_1 = __importStar(require("./view/netBurnOrIncome/netBurnOrIncomeReducer"));
208
209
  const netBurnOrIncomeClassesViewReducer_1 = __importStar(require("./view/netBurnOrIncomeClassesView/netBurnOrIncomeClassesViewReducer"));
209
210
  const netBurnOrIncomeStoryCardReducer_1 = __importStar(require("./view/netBurnOrIncomeStoryCard/netBurnOrIncomeStoryCardReducer"));
211
+ const notificationPreferencesViewReducer_1 = __importStar(require("./view/notificationPreferencesView/notificationPreferencesViewReducer"));
210
212
  const notificationViewReducer_1 = __importStar(require("./view/notificationView/notificationViewReducer"));
211
213
  const onboardingCockpitViewReducer_1 = __importStar(require("./view/onboardingView/cockpitView/onboardingCockpitViewReducer"));
212
214
  const onboardingCustomerViewReducer_1 = __importStar(require("./view/onboardingView/customerView/onboardingCustomerViewReducer"));
@@ -520,6 +522,8 @@ const initialViewsState = {
520
522
  netBurnOrIncomeClassesViewState: netBurnOrIncomeClassesViewReducer_1.initialState,
521
523
  netBurnOrIncomeState: netBurnOrIncomeReducer_1.initialState,
522
524
  netBurnOrIncomeStoryCardState: netBurnOrIncomeStoryCardReducer_1.initialState,
525
+ notificationPreferencesViewState: notificationPreferencesViewReducer_1.initialState,
526
+ notificationRegistryState: notificationRegistryReducer_1.initialState,
523
527
  notificationViewState: notificationViewReducer_1.initialState,
524
528
  onboardingCockpitViewState: onboardingCockpitViewReducer_1.initialState,
525
529
  onboardingCustomerViewState: onboardingCustomerViewReducer_1.initialState,
@@ -807,6 +811,8 @@ const viewReducers = {
807
811
  netBurnOrIncomeClassesViewState: netBurnOrIncomeClassesViewReducer_1.default,
808
812
  netBurnOrIncomeState: netBurnOrIncomeReducer_1.default,
809
813
  netBurnOrIncomeStoryCardState: netBurnOrIncomeStoryCardReducer_1.default,
814
+ notificationPreferencesViewState: notificationPreferencesViewReducer_1.default,
815
+ notificationRegistryState: notificationRegistryReducer_1.default,
810
816
  notificationViewState: notificationViewReducer_1.default,
811
817
  onboardingCockpitViewState: onboardingCockpitViewReducer_1.default,
812
818
  onboardingCustomerViewState: onboardingCustomerViewReducer_1.default,
@@ -1,6 +1,6 @@
1
1
  import { ZeniDate } from '../../zeniDayJS';
2
- export declare const toRecurringFrequency: (v: string) => "weekly" | "biweekly" | "monthly" | "quarterly" | "daily" | "semi_weekly";
3
- export declare const toRecurringFrequencyStrict: (v?: string) => "weekly" | "biweekly" | "monthly" | "quarterly" | "daily" | "semi_weekly" | undefined;
2
+ export declare const toRecurringFrequency: (v: string) => "daily" | "weekly" | "biweekly" | "monthly" | "quarterly" | "semi_weekly";
3
+ export declare const toRecurringFrequencyStrict: (v?: string) => "daily" | "weekly" | "biweekly" | "monthly" | "quarterly" | "semi_weekly" | undefined;
4
4
  export type RecurringFrequencyType = NonNullable<ReturnType<typeof toRecurringFrequency>>;
5
5
  export declare const SEMI_WEEKLY_REQUIRED_DAYS_COUNT = 2;
6
6
  declare const toRecurringDatePickerOptions: (v: string) => "date" | "recurringCount";
@@ -68,7 +68,15 @@ export declare const fetchCompanyPassportView: import("@reduxjs/toolkit").Action
68
68
  enabled: boolean;
69
69
  }, "companyView/updateAccountingClassesEnabled", never, never>, updateAccountingClassesEnabledSuccess: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"companyView/updateAccountingClassesEnabledSuccess">, updateAccountingClassesEnabledFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
70
70
  status: ZeniAPIStatus;
71
- }, "companyView/updateAccountingClassesEnabledFailure">, updateCapitalizationAccountThreshold: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[companyId: string, accountId: string, threshold: number | null, dismissOnboardingForAccount?: boolean | undefined, allOverrides?: Record<string, number> | null | undefined], {
71
+ }, "companyView/updateAccountingClassesEnabledFailure">, enableAccountingProjects: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[companyId: string], {
72
+ companyId: string;
73
+ }, "companyView/enableAccountingProjects", never, never>, resumeEnableAccountingProjects: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[companyId: string], {
74
+ companyId: string;
75
+ }, "companyView/resumeEnableAccountingProjects", never, never>, disableAccountingProjects: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[companyId: string], {
76
+ companyId: string;
77
+ }, "companyView/disableAccountingProjects", never, never>, updateAccountingProjectsEnabledSuccess: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"companyView/updateAccountingProjectsEnabledSuccess">, updateAccountingProjectsEnabledFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
78
+ status: ZeniAPIStatus;
79
+ }, "companyView/updateAccountingProjectsEnabledFailure">, requestQboProjectsReconnect: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"companyView/requestQboProjectsReconnect">, clearQboProjectsReconnectRequest: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"companyView/clearQboProjectsReconnectRequest">, updateCapitalizationAccountThreshold: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[companyId: string, accountId: string, threshold: number | null, dismissOnboardingForAccount?: boolean | undefined, allOverrides?: Record<string, number> | null | undefined], {
72
80
  companyId: string;
73
81
  accountId: string;
74
82
  threshold: number | null;
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  var _a;
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.updateParentSubsidiaryViewOnFailure = exports.updateParentSubsidiaryView = exports.fetchParentSubsidiaryManagementView = exports.saveCompanyPassportDetails = exports.saveIndustryAndIncDateInCompanyPassportLocalStore = exports.updateCompanyPassportLocalStoreData = exports.companyPassportCreateCompanyOfficersFailure = exports.companyPassportCreateCompanyOfficersSuccess = exports.companyPassportCreateCompanyOfficers = exports.companyPassportUpdateCompanyOfficerFailure = exports.companyPassportUpdateCompanyOfficerSuccess = exports.companyPassportUpdateCompanyOfficer = exports.companyPassportUpdatePrimaryContactFailure = exports.companyPassportUpdatePrimaryContactSuccess = exports.companyPassportUpdatePrimaryContact = exports.dismissCapitalizationOnboarding = exports.updateCapitalizationAccountThresholdFailure = exports.updateCapitalizationAccountThresholdSuccess = exports.updateCapitalizationAccountThreshold = exports.updateAccountingClassesEnabledFailure = exports.updateAccountingClassesEnabledSuccess = exports.updateAccountingClassesEnabled = exports.companyPassportUpdateCompanyDetailsFailure = exports.companyPassportUpdateCompanyDetailsSuccess = exports.companyPassportUpdateCompanyDetails = exports.companyPassportClearDataInLocalStore = exports.deleteCompanyOfficerInLocalStore = exports.companyPassportSaveDataInLocalStore = exports.updateCompanyManagementUIState = exports.updateCompanyPortfolioUIState = exports.clearCompanyView = exports.updateZeniUsersOnFailure = exports.updateZeniUsersOnSuccess = exports.fetchZeniUsers = exports.fetchCompanyPortfolioView = exports.updateCompanyViewOnFailure = exports.updateCompanyViewOnSuccess = exports.companyManagementSaveUpdatesFailure = exports.companyManagementSaveUpdatesSuccess = exports.companyManagementDiscardUpdates = exports.companyManagementSavePendingUpdates = exports.companyManagementSaveUpdates = exports.fetchCompanyManagementView = exports.fetchPortfolioView = exports.fetchSubscriptionView = exports.fetchManagementView = exports.fetchOnboardingView = exports.fetchAllCockpitViews = exports.fetchCompanyPassportView = exports.initialState = void 0;
5
- exports.updateMetaDataOnSendMonthEndReport = exports.updateCompanyMetaDataOnFailure = exports.updateCompanyMetaDataOnSuccess = exports.fetchCompanyMetaData = exports.updateCompanyDownloadState = void 0;
4
+ exports.companyPassportCreateCompanyOfficersSuccess = exports.companyPassportCreateCompanyOfficers = exports.companyPassportUpdateCompanyOfficerFailure = exports.companyPassportUpdateCompanyOfficerSuccess = exports.companyPassportUpdateCompanyOfficer = exports.companyPassportUpdatePrimaryContactFailure = exports.companyPassportUpdatePrimaryContactSuccess = exports.companyPassportUpdatePrimaryContact = exports.dismissCapitalizationOnboarding = exports.updateCapitalizationAccountThresholdFailure = exports.updateCapitalizationAccountThresholdSuccess = exports.updateCapitalizationAccountThreshold = exports.clearQboProjectsReconnectRequest = exports.requestQboProjectsReconnect = exports.updateAccountingProjectsEnabledFailure = exports.updateAccountingProjectsEnabledSuccess = exports.disableAccountingProjects = exports.resumeEnableAccountingProjects = exports.enableAccountingProjects = exports.updateAccountingClassesEnabledFailure = exports.updateAccountingClassesEnabledSuccess = exports.updateAccountingClassesEnabled = exports.companyPassportUpdateCompanyDetailsFailure = exports.companyPassportUpdateCompanyDetailsSuccess = exports.companyPassportUpdateCompanyDetails = exports.companyPassportClearDataInLocalStore = exports.deleteCompanyOfficerInLocalStore = exports.companyPassportSaveDataInLocalStore = exports.updateCompanyManagementUIState = exports.updateCompanyPortfolioUIState = exports.clearCompanyView = exports.updateZeniUsersOnFailure = exports.updateZeniUsersOnSuccess = exports.fetchZeniUsers = exports.fetchCompanyPortfolioView = exports.updateCompanyViewOnFailure = exports.updateCompanyViewOnSuccess = exports.companyManagementSaveUpdatesFailure = exports.companyManagementSaveUpdatesSuccess = exports.companyManagementDiscardUpdates = exports.companyManagementSavePendingUpdates = exports.companyManagementSaveUpdates = exports.fetchCompanyManagementView = exports.fetchPortfolioView = exports.fetchSubscriptionView = exports.fetchManagementView = exports.fetchOnboardingView = exports.fetchAllCockpitViews = exports.fetchCompanyPassportView = exports.initialState = void 0;
5
+ exports.updateMetaDataOnSendMonthEndReport = exports.updateCompanyMetaDataOnFailure = exports.updateCompanyMetaDataOnSuccess = exports.fetchCompanyMetaData = exports.updateCompanyDownloadState = exports.updateParentSubsidiaryViewOnFailure = exports.updateParentSubsidiaryView = exports.fetchParentSubsidiaryManagementView = exports.saveCompanyPassportDetails = exports.saveIndustryAndIncDateInCompanyPassportLocalStore = exports.updateCompanyPassportLocalStoreData = exports.companyPassportCreateCompanyOfficersFailure = void 0;
6
6
  const toolkit_1 = require("@reduxjs/toolkit");
7
7
  const parentSubsidiaryViewState_1 = require("./parentSubsidiaryView/parentSubsidiaryViewState");
8
8
  const companyManagementViewState_1 = require("./types/companyManagementViewState");
@@ -314,6 +314,73 @@ const companyView = (0, toolkit_1.createSlice)({
314
314
  error: action.payload.status,
315
315
  };
316
316
  },
317
+ enableAccountingProjects: {
318
+ reducer(draft,
319
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
320
+ _action) {
321
+ draft.passportView.accountingProjectsUpdateStatus = {
322
+ fetchState: 'In-Progress',
323
+ error: undefined,
324
+ };
325
+ draft.passportView.needsQboProjectsReconnect = false;
326
+ },
327
+ prepare(companyId) {
328
+ return { payload: { companyId } };
329
+ },
330
+ },
331
+ resumeEnableAccountingProjects: {
332
+ reducer(draft,
333
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
334
+ _action) {
335
+ draft.passportView.accountingProjectsUpdateStatus = {
336
+ fetchState: 'In-Progress',
337
+ error: undefined,
338
+ };
339
+ draft.passportView.needsQboProjectsReconnect = false;
340
+ },
341
+ prepare(companyId) {
342
+ return { payload: { companyId } };
343
+ },
344
+ },
345
+ disableAccountingProjects: {
346
+ reducer(draft,
347
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
348
+ _action) {
349
+ draft.passportView.accountingProjectsUpdateStatus = {
350
+ fetchState: 'In-Progress',
351
+ error: undefined,
352
+ };
353
+ draft.passportView.needsQboProjectsReconnect = false;
354
+ },
355
+ prepare(companyId) {
356
+ return { payload: { companyId } };
357
+ },
358
+ },
359
+ updateAccountingProjectsEnabledSuccess(draft) {
360
+ draft.passportView.accountingProjectsUpdateStatus = {
361
+ fetchState: 'Completed',
362
+ error: undefined,
363
+ };
364
+ draft.passportView.needsQboProjectsReconnect = false;
365
+ },
366
+ updateAccountingProjectsEnabledFailure(draft, action) {
367
+ draft.passportView.accountingProjectsUpdateStatus = {
368
+ fetchState: 'Error',
369
+ error: action.payload.status,
370
+ };
371
+ draft.passportView.needsQboProjectsReconnect = false;
372
+ },
373
+ requestQboProjectsReconnect(draft) {
374
+ draft.passportView.needsQboProjectsReconnect = true;
375
+ // Keep In-Progress so the Projects toggle stays locked through OAuth.
376
+ draft.passportView.accountingProjectsUpdateStatus = {
377
+ fetchState: 'In-Progress',
378
+ error: undefined,
379
+ };
380
+ },
381
+ clearQboProjectsReconnectRequest(draft) {
382
+ draft.passportView.needsQboProjectsReconnect = false;
383
+ },
317
384
  updateCapitalizationAccountThreshold: {
318
385
  prepare(companyId, accountId, threshold, dismissOnboardingForAccount, allOverrides) {
319
386
  return {
@@ -632,5 +699,5 @@ const companyView = (0, toolkit_1.createSlice)({
632
699
  },
633
700
  },
634
701
  });
635
- _a = companyView.actions, exports.fetchCompanyPassportView = _a.fetchCompanyPassportView, exports.fetchAllCockpitViews = _a.fetchAllCockpitViews, exports.fetchOnboardingView = _a.fetchOnboardingView, exports.fetchManagementView = _a.fetchManagementView, exports.fetchSubscriptionView = _a.fetchSubscriptionView, exports.fetchPortfolioView = _a.fetchPortfolioView, exports.fetchCompanyManagementView = _a.fetchCompanyManagementView, exports.companyManagementSaveUpdates = _a.companyManagementSaveUpdates, exports.companyManagementSavePendingUpdates = _a.companyManagementSavePendingUpdates, exports.companyManagementDiscardUpdates = _a.companyManagementDiscardUpdates, exports.companyManagementSaveUpdatesSuccess = _a.companyManagementSaveUpdatesSuccess, exports.companyManagementSaveUpdatesFailure = _a.companyManagementSaveUpdatesFailure, exports.updateCompanyViewOnSuccess = _a.updateCompanyViewOnSuccess, exports.updateCompanyViewOnFailure = _a.updateCompanyViewOnFailure, exports.fetchCompanyPortfolioView = _a.fetchCompanyPortfolioView, exports.fetchZeniUsers = _a.fetchZeniUsers, exports.updateZeniUsersOnSuccess = _a.updateZeniUsersOnSuccess, exports.updateZeniUsersOnFailure = _a.updateZeniUsersOnFailure, exports.clearCompanyView = _a.clearCompanyView, exports.updateCompanyPortfolioUIState = _a.updateCompanyPortfolioUIState, exports.updateCompanyManagementUIState = _a.updateCompanyManagementUIState, exports.companyPassportSaveDataInLocalStore = _a.companyPassportSaveDataInLocalStore, exports.deleteCompanyOfficerInLocalStore = _a.deleteCompanyOfficerInLocalStore, exports.companyPassportClearDataInLocalStore = _a.companyPassportClearDataInLocalStore, exports.companyPassportUpdateCompanyDetails = _a.companyPassportUpdateCompanyDetails, exports.companyPassportUpdateCompanyDetailsSuccess = _a.companyPassportUpdateCompanyDetailsSuccess, exports.companyPassportUpdateCompanyDetailsFailure = _a.companyPassportUpdateCompanyDetailsFailure, exports.updateAccountingClassesEnabled = _a.updateAccountingClassesEnabled, exports.updateAccountingClassesEnabledSuccess = _a.updateAccountingClassesEnabledSuccess, exports.updateAccountingClassesEnabledFailure = _a.updateAccountingClassesEnabledFailure, exports.updateCapitalizationAccountThreshold = _a.updateCapitalizationAccountThreshold, exports.updateCapitalizationAccountThresholdSuccess = _a.updateCapitalizationAccountThresholdSuccess, exports.updateCapitalizationAccountThresholdFailure = _a.updateCapitalizationAccountThresholdFailure, exports.dismissCapitalizationOnboarding = _a.dismissCapitalizationOnboarding, exports.companyPassportUpdatePrimaryContact = _a.companyPassportUpdatePrimaryContact, exports.companyPassportUpdatePrimaryContactSuccess = _a.companyPassportUpdatePrimaryContactSuccess, exports.companyPassportUpdatePrimaryContactFailure = _a.companyPassportUpdatePrimaryContactFailure, exports.companyPassportUpdateCompanyOfficer = _a.companyPassportUpdateCompanyOfficer, exports.companyPassportUpdateCompanyOfficerSuccess = _a.companyPassportUpdateCompanyOfficerSuccess, exports.companyPassportUpdateCompanyOfficerFailure = _a.companyPassportUpdateCompanyOfficerFailure, exports.companyPassportCreateCompanyOfficers = _a.companyPassportCreateCompanyOfficers, exports.companyPassportCreateCompanyOfficersSuccess = _a.companyPassportCreateCompanyOfficersSuccess, exports.companyPassportCreateCompanyOfficersFailure = _a.companyPassportCreateCompanyOfficersFailure, exports.updateCompanyPassportLocalStoreData = _a.updateCompanyPassportLocalStoreData, exports.saveIndustryAndIncDateInCompanyPassportLocalStore = _a.saveIndustryAndIncDateInCompanyPassportLocalStore, exports.saveCompanyPassportDetails = _a.saveCompanyPassportDetails, exports.fetchParentSubsidiaryManagementView = _a.fetchParentSubsidiaryManagementView, exports.updateParentSubsidiaryView = _a.updateParentSubsidiaryView, exports.updateParentSubsidiaryViewOnFailure = _a.updateParentSubsidiaryViewOnFailure, exports.updateCompanyDownloadState = _a.updateCompanyDownloadState, exports.fetchCompanyMetaData = _a.fetchCompanyMetaData, exports.updateCompanyMetaDataOnSuccess = _a.updateCompanyMetaDataOnSuccess, exports.updateCompanyMetaDataOnFailure = _a.updateCompanyMetaDataOnFailure, exports.updateMetaDataOnSendMonthEndReport = _a.updateMetaDataOnSendMonthEndReport;
702
+ _a = companyView.actions, exports.fetchCompanyPassportView = _a.fetchCompanyPassportView, exports.fetchAllCockpitViews = _a.fetchAllCockpitViews, exports.fetchOnboardingView = _a.fetchOnboardingView, exports.fetchManagementView = _a.fetchManagementView, exports.fetchSubscriptionView = _a.fetchSubscriptionView, exports.fetchPortfolioView = _a.fetchPortfolioView, exports.fetchCompanyManagementView = _a.fetchCompanyManagementView, exports.companyManagementSaveUpdates = _a.companyManagementSaveUpdates, exports.companyManagementSavePendingUpdates = _a.companyManagementSavePendingUpdates, exports.companyManagementDiscardUpdates = _a.companyManagementDiscardUpdates, exports.companyManagementSaveUpdatesSuccess = _a.companyManagementSaveUpdatesSuccess, exports.companyManagementSaveUpdatesFailure = _a.companyManagementSaveUpdatesFailure, exports.updateCompanyViewOnSuccess = _a.updateCompanyViewOnSuccess, exports.updateCompanyViewOnFailure = _a.updateCompanyViewOnFailure, exports.fetchCompanyPortfolioView = _a.fetchCompanyPortfolioView, exports.fetchZeniUsers = _a.fetchZeniUsers, exports.updateZeniUsersOnSuccess = _a.updateZeniUsersOnSuccess, exports.updateZeniUsersOnFailure = _a.updateZeniUsersOnFailure, exports.clearCompanyView = _a.clearCompanyView, exports.updateCompanyPortfolioUIState = _a.updateCompanyPortfolioUIState, exports.updateCompanyManagementUIState = _a.updateCompanyManagementUIState, exports.companyPassportSaveDataInLocalStore = _a.companyPassportSaveDataInLocalStore, exports.deleteCompanyOfficerInLocalStore = _a.deleteCompanyOfficerInLocalStore, exports.companyPassportClearDataInLocalStore = _a.companyPassportClearDataInLocalStore, exports.companyPassportUpdateCompanyDetails = _a.companyPassportUpdateCompanyDetails, exports.companyPassportUpdateCompanyDetailsSuccess = _a.companyPassportUpdateCompanyDetailsSuccess, exports.companyPassportUpdateCompanyDetailsFailure = _a.companyPassportUpdateCompanyDetailsFailure, exports.updateAccountingClassesEnabled = _a.updateAccountingClassesEnabled, exports.updateAccountingClassesEnabledSuccess = _a.updateAccountingClassesEnabledSuccess, exports.updateAccountingClassesEnabledFailure = _a.updateAccountingClassesEnabledFailure, exports.enableAccountingProjects = _a.enableAccountingProjects, exports.resumeEnableAccountingProjects = _a.resumeEnableAccountingProjects, exports.disableAccountingProjects = _a.disableAccountingProjects, exports.updateAccountingProjectsEnabledSuccess = _a.updateAccountingProjectsEnabledSuccess, exports.updateAccountingProjectsEnabledFailure = _a.updateAccountingProjectsEnabledFailure, exports.requestQboProjectsReconnect = _a.requestQboProjectsReconnect, exports.clearQboProjectsReconnectRequest = _a.clearQboProjectsReconnectRequest, exports.updateCapitalizationAccountThreshold = _a.updateCapitalizationAccountThreshold, exports.updateCapitalizationAccountThresholdSuccess = _a.updateCapitalizationAccountThresholdSuccess, exports.updateCapitalizationAccountThresholdFailure = _a.updateCapitalizationAccountThresholdFailure, exports.dismissCapitalizationOnboarding = _a.dismissCapitalizationOnboarding, exports.companyPassportUpdatePrimaryContact = _a.companyPassportUpdatePrimaryContact, exports.companyPassportUpdatePrimaryContactSuccess = _a.companyPassportUpdatePrimaryContactSuccess, exports.companyPassportUpdatePrimaryContactFailure = _a.companyPassportUpdatePrimaryContactFailure, exports.companyPassportUpdateCompanyOfficer = _a.companyPassportUpdateCompanyOfficer, exports.companyPassportUpdateCompanyOfficerSuccess = _a.companyPassportUpdateCompanyOfficerSuccess, exports.companyPassportUpdateCompanyOfficerFailure = _a.companyPassportUpdateCompanyOfficerFailure, exports.companyPassportCreateCompanyOfficers = _a.companyPassportCreateCompanyOfficers, exports.companyPassportCreateCompanyOfficersSuccess = _a.companyPassportCreateCompanyOfficersSuccess, exports.companyPassportCreateCompanyOfficersFailure = _a.companyPassportCreateCompanyOfficersFailure, exports.updateCompanyPassportLocalStoreData = _a.updateCompanyPassportLocalStoreData, exports.saveIndustryAndIncDateInCompanyPassportLocalStore = _a.saveIndustryAndIncDateInCompanyPassportLocalStore, exports.saveCompanyPassportDetails = _a.saveCompanyPassportDetails, exports.fetchParentSubsidiaryManagementView = _a.fetchParentSubsidiaryManagementView, exports.updateParentSubsidiaryView = _a.updateParentSubsidiaryView, exports.updateParentSubsidiaryViewOnFailure = _a.updateParentSubsidiaryViewOnFailure, exports.updateCompanyDownloadState = _a.updateCompanyDownloadState, exports.fetchCompanyMetaData = _a.fetchCompanyMetaData, exports.updateCompanyMetaDataOnSuccess = _a.updateCompanyMetaDataOnSuccess, exports.updateCompanyMetaDataOnFailure = _a.updateCompanyMetaDataOnFailure, exports.updateMetaDataOnSendMonthEndReport = _a.updateMetaDataOnSendMonthEndReport;
636
703
  exports.default = companyView.reducer;
@@ -4,11 +4,12 @@ exports.dismissCapitalizationOnboardingEpic = void 0;
4
4
  const rxjs_1 = require("rxjs");
5
5
  const operators_1 = require("rxjs/operators");
6
6
  const tenantReducer_1 = require("../../../../entity/tenant/tenantReducer");
7
+ const tenantSelector_1 = require("../../../../entity/tenant/tenantSelector");
7
8
  const responsePayload_1 = require("../../../../responsePayload");
8
9
  const companyViewReducer_1 = require("../../companyViewReducer");
9
10
  const dismissCapitalizationOnboardingEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(companyViewReducer_1.dismissCapitalizationOnboarding.match), (0, operators_1.switchMap)((action) => {
10
11
  const { companyId, accountId } = action.payload;
11
- const tenantId = Object.values(state$.value.tenantState.tenantsById).find((t) => t.companyId === companyId)?.tenantId;
12
+ const tenantId = (0, tenantSelector_1.getTenantIdByCompanyId)(state$.value.tenantState, companyId);
12
13
  const body = {
13
14
  capitalization_onboarding_dismissed_accounts: { [accountId]: true },
14
15
  };
@@ -0,0 +1,10 @@
1
+ import { ActionsObservable, StateObservable } from 'redux-observable';
2
+ import { Observable } from 'rxjs';
3
+ import { updateCompanies } from '../../../../../entity/company/companyReducer';
4
+ import { openSnackbar } from '../../../../../entity/snackbar/snackbarReducer';
5
+ import { updateTenantAccountingProjectsEnabled } from '../../../../../entity/tenant/tenantReducer';
6
+ import { RootState } from '../../../../../reducer';
7
+ import { ZeniAPI } from '../../../../../zeniAPI';
8
+ import { disableAccountingProjects, updateAccountingProjectsEnabledFailure, updateAccountingProjectsEnabledSuccess } from '../../../companyViewReducer';
9
+ export type ActionType = ReturnType<typeof disableAccountingProjects> | ReturnType<typeof updateCompanies> | ReturnType<typeof updateTenantAccountingProjectsEnabled> | ReturnType<typeof updateAccountingProjectsEnabledSuccess> | ReturnType<typeof updateAccountingProjectsEnabledFailure> | ReturnType<typeof openSnackbar>;
10
+ export declare const disableAccountingProjectsEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
@@ -0,0 +1,60 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.disableAccountingProjectsEpic = void 0;
4
+ const rxjs_1 = require("rxjs");
5
+ const operators_1 = require("rxjs/operators");
6
+ const companyReducer_1 = require("../../../../../entity/company/companyReducer");
7
+ const snackbarReducer_1 = require("../../../../../entity/snackbar/snackbarReducer");
8
+ const tenantReducer_1 = require("../../../../../entity/tenant/tenantReducer");
9
+ const tenantSelector_1 = require("../../../../../entity/tenant/tenantSelector");
10
+ const responsePayload_1 = require("../../../../../responsePayload");
11
+ const companyViewReducer_1 = require("../../../companyViewReducer");
12
+ const disableAccountingProjectsEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(companyViewReducer_1.disableAccountingProjects.match), (0, operators_1.switchMap)((action) => {
13
+ const { companyId } = action.payload;
14
+ const tenantId = (0, tenantSelector_1.getTenantIdByCompanyId)(state$.value.tenantState, companyId);
15
+ return zeniAPI
16
+ .putAndGetJSON(`${zeniAPI.apiEndPoints.tenantMicroServiceBaseUrl}/1.0/companies/${companyId}`, { is_accounting_projects_enabled: false })
17
+ .pipe((0, operators_1.mergeMap)((response) => {
18
+ const companies = response.data?.companies ?? [];
19
+ if ((0, responsePayload_1.isSuccessResponse)(response) && companies.length > 0) {
20
+ const actions = [
21
+ (0, companyReducer_1.updateCompanies)({
22
+ payload: companies,
23
+ schema: {},
24
+ }),
25
+ ];
26
+ if (tenantId != null) {
27
+ actions.push((0, tenantReducer_1.updateTenantAccountingProjectsEnabled)({
28
+ enabled: false,
29
+ tenantId,
30
+ }));
31
+ }
32
+ actions.push((0, companyViewReducer_1.updateAccountingProjectsEnabledSuccess)());
33
+ actions.push((0, snackbarReducer_1.openSnackbar)({
34
+ messageSection: 'accounting_projects_enabled_update',
35
+ messageText: 'success',
36
+ type: 'success',
37
+ }));
38
+ return (0, rxjs_1.from)(actions);
39
+ }
40
+ return (0, rxjs_1.from)([
41
+ (0, companyViewReducer_1.updateAccountingProjectsEnabledFailure)({
42
+ status: response.status,
43
+ }),
44
+ (0, snackbarReducer_1.openSnackbar)({
45
+ messageSection: 'accounting_projects_enabled_update',
46
+ messageText: 'failed',
47
+ type: 'error',
48
+ }),
49
+ ]);
50
+ }), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, companyViewReducer_1.updateAccountingProjectsEnabledFailure)({
51
+ status: (0, responsePayload_1.createZeniAPIStatus)('Unexpected error', `Update Accounting Projects Enabled errored out - ${error instanceof Error
52
+ ? error.message
53
+ : JSON.stringify(error)}`),
54
+ }), (0, snackbarReducer_1.openSnackbar)({
55
+ messageSection: 'accounting_projects_enabled_update',
56
+ messageText: 'failed',
57
+ type: 'error',
58
+ }))));
59
+ }));
60
+ exports.disableAccountingProjectsEpic = disableAccountingProjectsEpic;
@@ -0,0 +1,11 @@
1
+ import { ActionsObservable, StateObservable } from 'redux-observable';
2
+ import { Observable } from 'rxjs';
3
+ import { openSnackbar } from '../../../../../entity/snackbar/snackbarReducer';
4
+ import { RootState } from '../../../../../reducer';
5
+ import { ZeniAPI } from '../../../../../zeniAPI';
6
+ import { enableAccountingProjects, requestQboProjectsReconnect, resumeEnableAccountingProjects, updateAccountingProjectsEnabledFailure } from '../../../companyViewReducer';
7
+ export interface AccountingProviderProjectAuthorizationStatusResponse {
8
+ is_accounting_provider_project_apis_authorized: boolean;
9
+ }
10
+ export type ActionType = ReturnType<typeof enableAccountingProjects> | ReturnType<typeof requestQboProjectsReconnect> | ReturnType<typeof resumeEnableAccountingProjects> | ReturnType<typeof updateAccountingProjectsEnabledFailure> | ReturnType<typeof openSnackbar>;
11
+ export declare const enableAccountingProjectsEpic: (actions$: ActionsObservable<ActionType>, _state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.enableAccountingProjectsEpic = void 0;
4
+ const rxjs_1 = require("rxjs");
5
+ const operators_1 = require("rxjs/operators");
6
+ const snackbarReducer_1 = require("../../../../../entity/snackbar/snackbarReducer");
7
+ const responsePayload_1 = require("../../../../../responsePayload");
8
+ const companyViewReducer_1 = require("../../../companyViewReducer");
9
+ const enableAccountingProjectsEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(companyViewReducer_1.enableAccountingProjects.match), (0, operators_1.switchMap)((action) => {
10
+ const { companyId } = action.payload;
11
+ return zeniAPI
12
+ .getJSON(`${zeniAPI.apiEndPoints.accountMicroServiceBaseUrl}/1.0/accounting_provider_project_authorization_status`)
13
+ .pipe((0, operators_1.mergeMap)((response) => {
14
+ if (!(0, responsePayload_1.isSuccessResponse)(response) || response.data == null) {
15
+ return (0, rxjs_1.from)([
16
+ (0, companyViewReducer_1.updateAccountingProjectsEnabledFailure)({
17
+ status: response.status,
18
+ }),
19
+ (0, snackbarReducer_1.openSnackbar)({
20
+ messageSection: 'accounting_projects_enabled_update',
21
+ messageText: 'failed',
22
+ type: 'error',
23
+ }),
24
+ ]);
25
+ }
26
+ if (response.data.is_accounting_provider_project_apis_authorized !==
27
+ true) {
28
+ return (0, rxjs_1.from)([(0, companyViewReducer_1.requestQboProjectsReconnect)()]);
29
+ }
30
+ return (0, rxjs_1.from)([(0, companyViewReducer_1.resumeEnableAccountingProjects)(companyId)]);
31
+ }), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, companyViewReducer_1.updateAccountingProjectsEnabledFailure)({
32
+ status: (0, responsePayload_1.createZeniAPIStatus)('Unexpected error', `Accounting provider project authorization status errored out - ${error instanceof Error
33
+ ? error.message
34
+ : JSON.stringify(error)}`),
35
+ }), (0, snackbarReducer_1.openSnackbar)({
36
+ messageSection: 'accounting_projects_enabled_update',
37
+ messageText: 'failed',
38
+ type: 'error',
39
+ }))));
40
+ }));
41
+ exports.enableAccountingProjectsEpic = enableAccountingProjectsEpic;
@@ -0,0 +1,13 @@
1
+ import { ActionsObservable, StateObservable } from 'redux-observable';
2
+ import { Observable } from 'rxjs';
3
+ import { openSnackbar } from '../../../../../entity/snackbar/snackbarReducer';
4
+ import { updateTenantAccountingProjectsEnabled } from '../../../../../entity/tenant/tenantReducer';
5
+ import { RootState } from '../../../../../reducer';
6
+ import { ZeniAPI } from '../../../../../zeniAPI';
7
+ import { resumeEnableAccountingProjects, updateAccountingProjectsEnabledFailure, updateAccountingProjectsEnabledSuccess } from '../../../companyViewReducer';
8
+ export interface AccountingProviderProjectEnablementStatusResponse {
9
+ is_accounting_projects_enabled: boolean;
10
+ is_accounting_provider_project_apis_enabled: boolean;
11
+ }
12
+ export type ActionType = ReturnType<typeof resumeEnableAccountingProjects> | ReturnType<typeof updateTenantAccountingProjectsEnabled> | ReturnType<typeof updateAccountingProjectsEnabledSuccess> | ReturnType<typeof updateAccountingProjectsEnabledFailure> | ReturnType<typeof openSnackbar>;
13
+ export declare const resumeEnableAccountingProjectsEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
@@ -0,0 +1,77 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.resumeEnableAccountingProjectsEpic = void 0;
4
+ const rxjs_1 = require("rxjs");
5
+ const operators_1 = require("rxjs/operators");
6
+ const snackbarReducer_1 = require("../../../../../entity/snackbar/snackbarReducer");
7
+ const tenantReducer_1 = require("../../../../../entity/tenant/tenantReducer");
8
+ const tenantSelector_1 = require("../../../../../entity/tenant/tenantSelector");
9
+ const responsePayload_1 = require("../../../../../responsePayload");
10
+ const companyViewReducer_1 = require("../../../companyViewReducer");
11
+ const resumeEnableAccountingProjectsEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(companyViewReducer_1.resumeEnableAccountingProjects.match), (0, operators_1.switchMap)((action) => {
12
+ const { companyId } = action.payload;
13
+ const tenantId = (0, tenantSelector_1.getTenantIdByCompanyId)(state$.value.tenantState, companyId);
14
+ if (tenantId == null) {
15
+ return (0, rxjs_1.from)([
16
+ (0, companyViewReducer_1.updateAccountingProjectsEnabledFailure)({
17
+ status: (0, responsePayload_1.createZeniAPIStatus)('Unexpected error', 'Tenant not found for company'),
18
+ }),
19
+ (0, snackbarReducer_1.openSnackbar)({
20
+ messageSection: 'accounting_projects_enabled_update',
21
+ messageText: 'failed',
22
+ type: 'error',
23
+ }),
24
+ ]);
25
+ }
26
+ return zeniAPI
27
+ .putAndGetJSON(`${zeniAPI.apiEndPoints.accountMicroServiceBaseUrl}/1.0/accounting_provider_project_enablement_status`)
28
+ .pipe((0, operators_1.mergeMap)((response) => {
29
+ if (!(0, responsePayload_1.isSuccessResponse)(response) || response.data == null) {
30
+ return (0, rxjs_1.from)([
31
+ (0, companyViewReducer_1.updateAccountingProjectsEnabledFailure)({
32
+ status: response.status,
33
+ }),
34
+ (0, snackbarReducer_1.openSnackbar)({
35
+ messageSection: 'accounting_projects_enabled_update',
36
+ messageText: 'failed',
37
+ type: 'error',
38
+ }),
39
+ ]);
40
+ }
41
+ if (response.data.is_accounting_provider_project_apis_enabled !==
42
+ true ||
43
+ response.data.is_accounting_projects_enabled !== true) {
44
+ return (0, rxjs_1.from)([
45
+ (0, companyViewReducer_1.updateAccountingProjectsEnabledFailure)({
46
+ status: (0, responsePayload_1.createZeniAPIStatus)('Projects not enabled in QBO', 'Please enable projects in QBO before enabling in the Zeni dashboard!'),
47
+ }),
48
+ (0, snackbarReducer_1.openSnackbar)({
49
+ messageSection: 'accounting_projects_qbo_not_enabled',
50
+ messageText: 'failed',
51
+ type: 'error',
52
+ }),
53
+ ]);
54
+ }
55
+ return (0, rxjs_1.from)([
56
+ (0, tenantReducer_1.updateTenantAccountingProjectsEnabled)({
57
+ enabled: true,
58
+ tenantId,
59
+ }),
60
+ (0, companyViewReducer_1.updateAccountingProjectsEnabledSuccess)(),
61
+ (0, snackbarReducer_1.openSnackbar)({
62
+ messageSection: 'accounting_projects_enabled_update',
63
+ messageText: 'success',
64
+ type: 'success',
65
+ }),
66
+ ]);
67
+ }), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, companyViewReducer_1.updateAccountingProjectsEnabledFailure)({
68
+ status: (0, responsePayload_1.createZeniAPIStatus)('Unexpected error', `Accounting provider project enablement status errored out - ${error instanceof Error
69
+ ? error.message
70
+ : JSON.stringify(error)}`),
71
+ }), (0, snackbarReducer_1.openSnackbar)({
72
+ messageSection: 'accounting_projects_enabled_update',
73
+ messageText: 'failed',
74
+ type: 'error',
75
+ }))));
76
+ }));
77
+ exports.resumeEnableAccountingProjectsEpic = resumeEnableAccountingProjectsEpic;
@@ -6,11 +6,12 @@ const operators_1 = require("rxjs/operators");
6
6
  const companyReducer_1 = require("../../../../entity/company/companyReducer");
7
7
  const snackbarReducer_1 = require("../../../../entity/snackbar/snackbarReducer");
8
8
  const tenantReducer_1 = require("../../../../entity/tenant/tenantReducer");
9
+ const tenantSelector_1 = require("../../../../entity/tenant/tenantSelector");
9
10
  const responsePayload_1 = require("../../../../responsePayload");
10
11
  const companyViewReducer_1 = require("../../companyViewReducer");
11
12
  const updateAccountingClassesEnabledEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(companyViewReducer_1.updateAccountingClassesEnabled.match), (0, operators_1.switchMap)((action) => {
12
13
  const { companyId, enabled } = action.payload;
13
- const tenantId = Object.values(state$.value.tenantState.tenantsById).find((t) => t.companyId === companyId)?.tenantId;
14
+ const tenantId = (0, tenantSelector_1.getTenantIdByCompanyId)(state$.value.tenantState, companyId);
14
15
  return zeniAPI
15
16
  .putAndGetJSON(`${zeniAPI.apiEndPoints.tenantMicroServiceBaseUrl}/1.0/companies/${companyId}`, { is_accounting_classes_enabled: enabled })
16
17
  .pipe((0, operators_1.mergeMap)((response) => {
@@ -6,11 +6,12 @@ const operators_1 = require("rxjs/operators");
6
6
  const companyReducer_1 = require("../../../../entity/company/companyReducer");
7
7
  const snackbarReducer_1 = require("../../../../entity/snackbar/snackbarReducer");
8
8
  const tenantReducer_1 = require("../../../../entity/tenant/tenantReducer");
9
+ const tenantSelector_1 = require("../../../../entity/tenant/tenantSelector");
9
10
  const responsePayload_1 = require("../../../../responsePayload");
10
11
  const companyViewReducer_1 = require("../../companyViewReducer");
11
12
  const updateCapitalizationAccountThresholdEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(companyViewReducer_1.updateCapitalizationAccountThreshold.match), (0, operators_1.switchMap)((action) => {
12
13
  const { companyId, accountId, threshold, dismissOnboardingForAccount, allOverrides, } = action.payload;
13
- const tenantId = Object.values(state$.value.tenantState.tenantsById).find((t) => t.companyId === companyId)?.tenantId;
14
+ const tenantId = (0, tenantSelector_1.getTenantIdByCompanyId)(state$.value.tenantState, companyId);
14
15
  let finalOverrides;
15
16
  if (allOverrides !== undefined) {
16
17
  finalOverrides = allOverrides ?? {};
@@ -5,6 +5,7 @@ import { CompanyOfficerLocalData, CompanyOfficerType, PrimaryContactLocalData }
5
5
  export type UpdateActionType = 'company_update' | 'user_create' | 'user_update';
6
6
  export interface CompanyPassportViewState extends CommonState, FetchedState {
7
7
  accountingClassesUpdateStatus: FetchStateAndError;
8
+ accountingProjectsUpdateStatus: FetchStateAndError;
8
9
  capitalizationThresholdUpdateStatus: FetchStateAndError;
9
10
  companyDetails: {
10
11
  updateStatus: FetchStateAndError;
@@ -14,6 +15,7 @@ export interface CompanyPassportViewState extends CommonState, FetchedState {
14
15
  updateStatus: FetchStateAndError;
15
16
  localData?: CompanyOfficerLocalData;
16
17
  }>;
18
+ needsQboProjectsReconnect: boolean;
17
19
  primaryContact: {
18
20
  updateStatus: FetchStateAndError;
19
21
  localData?: PrimaryContactLocalData;
@@ -8,10 +8,15 @@ exports.initialCompanyPassportView = {
8
8
  fetchState: 'Not-Started',
9
9
  error: undefined,
10
10
  },
11
+ accountingProjectsUpdateStatus: {
12
+ fetchState: 'Not-Started',
13
+ error: undefined,
14
+ },
11
15
  capitalizationThresholdUpdateStatus: {
12
16
  fetchState: 'Not-Started',
13
17
  error: undefined,
14
18
  },
19
+ needsQboProjectsReconnect: false,
15
20
  companyDetails: {
16
21
  localData: undefined,
17
22
  updateStatus: {
@@ -3,10 +3,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.fetchJeSchedulesEpic = void 0;
4
4
  const rxjs_1 = require("rxjs");
5
5
  const operators_1 = require("rxjs/operators");
6
+ const formatZeniDateFY_1 = require("../../../../commonStateTypes/fiscalYearHelpers/formatZeniDateFY");
6
7
  const timePeriod_1 = require("../../../../commonStateTypes/timePeriod");
7
8
  const jeSchedulesReducer_1 = require("../../../../entity/jeSchedules/jeSchedulesReducer");
8
9
  const tenantSelector_1 = require("../../../../entity/tenant/tenantSelector");
9
10
  const responsePayload_1 = require("../../../../responsePayload");
11
+ const zeniDayJS_1 = require("../../../../zeniDayJS");
10
12
  const jeSchedulesViewReducer_1 = require("../../reducers/jeSchedulesViewReducer");
11
13
  const fetchJeSchedulesEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(jeSchedulesViewReducer_1.fetchJeSchedules.match), (0, operators_1.mergeMap)((action) => {
12
14
  const state = state$.value;
@@ -14,9 +16,20 @@ const fetchJeSchedulesEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, op
14
16
  const { period, refreshViewInBackground } = action.payload;
15
17
  const currentTenant = (0, tenantSelector_1.getCurrentTenant)(state);
16
18
  const selectedPeriod = selectedPeriodByTenantId[currentTenant.tenantId];
19
+ const isClosePeriodTab = state.expenseAutomationJESchedulesViewState.uiState.selectedPageTab ===
20
+ 'schedules';
21
+ const existingEndDate = (0, timePeriod_1.toAbsoluteDay)((0, zeniDayJS_1.date)((0, timePeriod_1.toString)(period.start))
22
+ .subtract(1, 'month')
23
+ .endOf('month')
24
+ .format(formatZeniDateFY_1.DEFAULT_DATE_FORMAT));
17
25
  const queryParam = {
18
26
  start_date: (0, timePeriod_1.toString)(period.start),
19
- end_date: (0, timePeriod_1.toString)(period.end),
27
+ end_date: isClosePeriodTab || existingEndDate == null
28
+ ? (0, timePeriod_1.toString)(period.end)
29
+ : (0, timePeriod_1.toString)(existingEndDate),
30
+ ...(isClosePeriodTab
31
+ ? { close_period_start_date: (0, timePeriod_1.toString)(period.start) }
32
+ : {}),
20
33
  };
21
34
  return zeniAPI
22
35
  .getJSON(`${zeniAPI.apiEndPoints.accountMicroServiceBaseUrl}/1.0/expenses_automation/je_schedules?query=${encodeURIComponent(JSON.stringify(queryParam))}`)
@@ -0,0 +1,8 @@
1
+ import { ActionsObservable, StateObservable } from 'redux-observable';
2
+ import { Observable } from 'rxjs';
3
+ import { RootState } from '../../../../../reducer';
4
+ import { fetchAccountList } from '../../../../accountList/accountListReducer';
5
+ import { fetchClassList } from '../../../../classList/classListReducer';
6
+ import { clearSearchTransactionsForNewSchedule, initializeNewSchedule, resetNewScheduleLocalData } from '../../../reducers/jeSchedulesViewReducer';
7
+ export type ActionType = ReturnType<typeof clearSearchTransactionsForNewSchedule> | ReturnType<typeof fetchAccountList> | ReturnType<typeof fetchClassList> | ReturnType<typeof initializeNewSchedule> | ReturnType<typeof resetNewScheduleLocalData>;
8
+ export declare const initializeNewScheduleEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>) => Observable<ActionType>;
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.initializeNewScheduleEpic = void 0;
4
+ const rxjs_1 = require("rxjs");
5
+ const operators_1 = require("rxjs/operators");
6
+ const accountListReducer_1 = require("../../../../accountList/accountListReducer");
7
+ const classListReducer_1 = require("../../../../classList/classListReducer");
8
+ const scheduleListHelper_1 = require("../../../../scheduleView/scheduleListView/scheduleListHelper");
9
+ const jeSchedulesViewReducer_1 = require("../../../reducers/jeSchedulesViewReducer");
10
+ const initializeNewScheduleEpic = (actions$, state$) => actions$.pipe((0, operators_1.filter)(jeSchedulesViewReducer_1.initializeNewSchedule.match), (0, operators_1.mergeMap)((action) => {
11
+ const newScheduleActions = [];
12
+ const accountType = (0, scheduleListHelper_1.getAccountsTypesForScheduleEpics)();
13
+ const { accountListState, classListState } = state$.value;
14
+ if (accountListState.byReportId[accountType.accountListKey]?.fetchState ===
15
+ 'Not-Started') {
16
+ newScheduleActions.push((0, accountListReducer_1.fetchAccountList)(accountType.accountListKey, true, false, false, false, accountType.allowedAccountList));
17
+ }
18
+ if (classListState.fetchState === 'Not-Started') {
19
+ newScheduleActions.push((0, classListReducer_1.fetchClassList)());
20
+ }
21
+ newScheduleActions.push((0, jeSchedulesViewReducer_1.resetNewScheduleLocalData)({ scheduleType: action.payload.scheduleType }));
22
+ newScheduleActions.push((0, jeSchedulesViewReducer_1.clearSearchTransactionsForNewSchedule)());
23
+ return (0, rxjs_1.from)(newScheduleActions);
24
+ }));
25
+ exports.initializeNewScheduleEpic = initializeNewScheduleEpic;