@zeniai/client-epic-state 5.2.11-betaRD1 → 5.2.12
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.
- package/lib/entity/invoicing/invoicingCommonPayload.d.ts +27 -29
- package/lib/entity/invoicing/invoicingCommonPayload.js +37 -75
- package/lib/entity/invoicing/product/productPayload.d.ts +10 -0
- package/lib/entity/invoicing/product/productPayload.js +14 -2
- package/lib/entity/jeSchedules/jeScheduleHelper.d.ts +0 -1
- package/lib/entity/jeSchedules/jeScheduleHelper.js +0 -7
- package/lib/entity/jeSchedules/jeSchedulesPayload.d.ts +1 -66
- package/lib/entity/jeSchedules/jeSchedulesPayload.js +0 -135
- package/lib/entity/jeSchedules/jeSchedulesReducer.d.ts +2 -4
- package/lib/entity/jeSchedules/jeSchedulesReducer.js +2 -30
- package/lib/entity/jeSchedules/jeSchedulesSelector.d.ts +2 -11
- package/lib/entity/jeSchedules/jeSchedulesSelector.js +3 -38
- package/lib/entity/jeSchedules/jeSchedulesState.d.ts +1 -79
- package/lib/entity/jeSchedules/jeSchedulesTypes.d.ts +1 -24
- package/lib/entity/jeSchedules/jeSchedulesTypes.js +1 -88
- package/lib/entity/snackbar/snackbarTypes.d.ts +1 -1
- package/lib/entity/snackbar/snackbarTypes.js +0 -3
- package/lib/entity/transaction/payloadTypes/scheduleTransactionPayload.d.ts +0 -2
- package/lib/entity/transaction/payloadTypes/scheduleTransactionPayload.js +0 -2
- package/lib/entity/transaction/stateTypes/scheduleTransaction.d.ts +0 -2
- package/lib/epic.d.ts +2 -10
- package/lib/epic.js +10 -21
- package/lib/esm/entity/invoicing/invoicingCommonPayload.js +33 -73
- package/lib/esm/entity/invoicing/product/productPayload.js +14 -2
- package/lib/esm/entity/jeSchedules/jeScheduleHelper.js +0 -6
- package/lib/esm/entity/jeSchedules/jeSchedulesPayload.js +1 -135
- package/lib/esm/entity/jeSchedules/jeSchedulesReducer.js +2 -30
- package/lib/esm/entity/jeSchedules/jeSchedulesSelector.js +2 -36
- package/lib/esm/entity/jeSchedules/jeSchedulesTypes.js +0 -78
- package/lib/esm/entity/snackbar/snackbarTypes.js +0 -3
- package/lib/esm/entity/transaction/payloadTypes/scheduleTransactionPayload.js +0 -2
- package/lib/esm/epic.js +6 -17
- package/lib/esm/index.js +13 -18
- package/lib/esm/view/expenseAutomationView/epics/common/fetchAllExpenseAutomationTabsEpic.js +3 -6
- package/lib/esm/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulesEpic.js +5 -41
- package/lib/esm/view/expenseAutomationView/epics/jeSchedule/ignoreRecommendedJeScheduleEpic.js +2 -14
- package/lib/esm/view/expenseAutomationView/payload/jeSchedulesPayload.js +0 -55
- package/lib/esm/view/expenseAutomationView/reducers/jeSchedulesViewReducer.js +29 -306
- package/lib/esm/view/expenseAutomationView/selectors/jeSchedulesViewSelector.js +22 -294
- package/lib/esm/view/expenseAutomationView/types/jeSchedulesViewState.js +6 -5
- package/lib/esm/view/invoicing/editInvoicingCatalogItemDetailView/editInvoicingCatalogItemDetailViewPayload.js +25 -9
- package/lib/esm/view/invoicing/editInvoicingCatalogItemDetailView/saveInvoicingCatalogItemEpic.js +6 -1
- package/lib/esm/view/invoicing/invoicingQboView/invoicingQboViewSelector.js +40 -0
- package/lib/esm/view/invoicing/settingsView/epics/connectInvoicingStripeEpic.js +27 -0
- package/lib/esm/view/invoicing/settingsView/epics/disconnectInvoicingStripeEpic.js +19 -0
- package/lib/esm/view/invoicing/settingsView/epics/fetchInvoicingSettingsEpic.js +19 -0
- package/lib/esm/view/invoicing/settingsView/epics/saveInvoicingSettingsEpic.js +39 -0
- package/lib/esm/view/invoicing/settingsView/epics/submitInvoicingQboSettingsEpic.js +25 -0
- package/lib/esm/view/invoicing/settingsView/invoicingQboSettingsFormConfig.js +48 -0
- package/lib/esm/view/invoicing/settingsView/settingsViewReducer.js +25 -1
- package/lib/esm/view/invoicing/settingsView/settingsViewSelector.js +41 -0
- package/lib/esm/view/scheduleView/scheduleListView/epics/fetchAccruedScheduleListEpic.js +1 -1
- package/lib/esm/view/scheduleView/scheduleListView/epics/fetchDownloadSchedulesEpic.js +2 -7
- package/lib/esm/view/scheduleView/scheduleListView/scheduleListReducer.js +3 -5
- package/lib/index.d.ts +19 -22
- package/lib/index.js +59 -96
- package/lib/view/expenseAutomationView/epics/common/fetchAllExpenseAutomationTabsEpic.js +3 -6
- package/lib/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulesEpic.d.ts +2 -3
- package/lib/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulesEpic.js +3 -39
- package/lib/view/expenseAutomationView/epics/jeSchedule/ignoreRecommendedJeScheduleEpic.js +2 -14
- package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.d.ts +1 -1
- package/lib/view/expenseAutomationView/payload/jeSchedulesPayload.d.ts +3 -72
- package/lib/view/expenseAutomationView/payload/jeSchedulesPayload.js +1 -58
- package/lib/view/expenseAutomationView/reducers/jeSchedulesViewReducer.d.ts +12 -91
- package/lib/view/expenseAutomationView/reducers/jeSchedulesViewReducer.js +29 -308
- package/lib/view/expenseAutomationView/reducers/missingReceiptsViewReducer.d.ts +1 -1
- package/lib/view/expenseAutomationView/reducers/transactionsViewReducer.d.ts +2 -2
- package/lib/view/expenseAutomationView/selectorTypes/jeSchedulesSelectorTypes.d.ts +7 -36
- package/lib/view/expenseAutomationView/selectors/jeSchedulesViewSelector.d.ts +0 -34
- package/lib/view/expenseAutomationView/selectors/jeSchedulesViewSelector.js +21 -302
- package/lib/view/expenseAutomationView/types/completedSubTab.d.ts +1 -1
- package/lib/view/expenseAutomationView/types/jeSchedulesViewState.d.ts +8 -82
- package/lib/view/expenseAutomationView/types/jeSchedulesViewState.js +8 -8
- package/lib/view/expenseAutomationView/types/reconciliationViewState.d.ts +2 -2
- package/lib/view/invoicing/editInvoicingCatalogItemDetailView/editInvoicingCatalogItemDetailViewPayload.d.ts +12 -1
- package/lib/view/invoicing/editInvoicingCatalogItemDetailView/editInvoicingCatalogItemDetailViewPayload.js +25 -9
- package/lib/view/invoicing/editInvoicingCatalogItemDetailView/saveInvoicingCatalogItemEpic.js +6 -1
- package/lib/view/invoicing/invoicingQboView/invoicingQboViewSelector.d.ts +10 -1
- package/lib/view/invoicing/invoicingQboView/invoicingQboViewSelector.js +43 -1
- package/lib/view/invoicing/settingsView/epics/connectInvoicingStripeEpic.d.ts +6 -0
- package/lib/view/invoicing/settingsView/epics/connectInvoicingStripeEpic.js +31 -0
- package/lib/view/invoicing/settingsView/epics/disconnectInvoicingStripeEpic.d.ts +6 -0
- package/lib/view/invoicing/settingsView/epics/disconnectInvoicingStripeEpic.js +23 -0
- package/lib/view/invoicing/settingsView/epics/fetchInvoicingSettingsEpic.d.ts +6 -0
- package/lib/view/invoicing/settingsView/epics/fetchInvoicingSettingsEpic.js +23 -0
- package/lib/view/invoicing/settingsView/epics/saveInvoicingSettingsEpic.d.ts +6 -0
- package/lib/view/invoicing/settingsView/epics/saveInvoicingSettingsEpic.js +43 -0
- package/lib/view/invoicing/settingsView/epics/settingsViewActionType.d.ts +5 -0
- package/lib/view/invoicing/settingsView/epics/submitInvoicingQboSettingsEpic.d.ts +11 -0
- package/lib/view/invoicing/settingsView/epics/submitInvoicingQboSettingsEpic.js +29 -0
- package/lib/view/invoicing/settingsView/invoicingQboSettingsFormConfig.d.ts +34 -0
- package/lib/view/invoicing/settingsView/invoicingQboSettingsFormConfig.js +53 -0
- package/lib/view/invoicing/settingsView/settingsViewReducer.d.ts +4 -1
- package/lib/view/invoicing/settingsView/settingsViewReducer.js +26 -2
- package/lib/view/invoicing/settingsView/settingsViewSelector.d.ts +35 -0
- package/lib/view/invoicing/settingsView/settingsViewSelector.js +43 -1
- package/lib/view/invoicing/settingsView/settingsViewState.d.ts +8 -0
- package/lib/view/scheduleView/scheduleListView/epics/fetchAccruedScheduleListEpic.js +1 -1
- package/lib/view/scheduleView/scheduleListView/epics/fetchDownloadSchedulesEpic.js +2 -7
- package/lib/view/scheduleView/scheduleListView/scheduleListReducer.d.ts +2 -4
- package/lib/view/scheduleView/scheduleListView/scheduleListReducer.js +3 -5
- package/package.json +1 -1
- package/lib/commonStateTypes/selectorTypes/pickAndMergeForecastSection.d.ts +0 -0
- package/lib/commonStateTypes/selectorTypes/pickAndMergeForecastSection.js +0 -1
- package/lib/entity/invoicing/coupon/couponConstants.d.ts +0 -11
- package/lib/entity/invoicing/coupon/couponConstants.js +0 -29
- package/lib/esm/commonStateTypes/selectorTypes/pickAndMergeForecastSection.js +0 -1
- package/lib/esm/entity/invoicing/coupon/couponConstants.js +0 -26
- package/lib/esm/view/expenseAutomationView/epics/jeSchedule/fetchOneTimeAccrualEpic.js +0 -45
- package/lib/esm/view/expenseAutomationView/epics/jeSchedule/newSchedule/createOneTimeAccrualEpic.js +0 -99
- package/lib/esm/view/expenseAutomationView/epics/jeSchedule/newSchedule/initializeNewScheduleEpic.js +0 -25
- package/lib/esm/view/expenseAutomationView/epics/jeSchedule/newSchedule/saveNewScheduleEpic.js +0 -110
- package/lib/esm/view/expenseAutomationView/epics/jeSchedule/newSchedule/searchTransactionsForNewScheduleEpic.js +0 -79
- package/lib/esm/view/expenseAutomationView/epics/jeSchedule/oneTimeAccrualActionsEpic.js +0 -139
- package/lib/esm/view/expenseAutomationView/epics/jeSchedule/revertJeScheduleEpic.js +0 -106
- package/lib/esm/view/expenseAutomationView/epics/jeSchedule/switchJESchedulesTabEpic.js +0 -22
- package/lib/esm/view/expenseAutomationView/helpers/newScheduleLocalDataHelper.js +0 -140
- package/lib/esm/view/expenseAutomationView/selectors/jeNewScheduleViewSelector.js +0 -106
- package/lib/esm/view/invoicing/invoicingQboView/epics/fetchInvoicingQboAccountsEpic.js +0 -25
- package/lib/esm/view/invoicing/invoicingQboView/epics/fetchInvoicingQboClassesEpic.js +0 -15
- package/lib/esm/view/invoicing/settingsView/settingsViewEpics.js +0 -92
- package/lib/esm/view/spendManagement/treasury/treasurySetUp/epic/updateTreasuryPromoIntroClosedByOutsideClickEpic.js +0 -18
- package/lib/esm/view/spendManagement/treasury/treasurySetUp/epic/updateTreasuryPromoRemindMeLaterClickedEpic.js +0 -18
- package/lib/esm/view/spendManagement/treasury/treasurySetUp/epic/updateTreasuryVideoViewedEpic.js +0 -18
- package/lib/esm/view/zeniAccountsPromoCard/zeniAccountsPromoCardEpic.js +0 -16
- package/lib/esm/view/zeniAccountsPromoCard/zeniAccountsPromoCardPayload.js +0 -1
- package/lib/esm/view/zeniAccountsPromoCard/zeniAccountsPromoCardReducer.js +0 -60
- package/lib/esm/view/zeniAccountsPromoCard/zeniAccountsPromoCardSelector.js +0 -12
- package/lib/esm/view/zeniAccountsPromoCard/zeniAccountsPromoCardState.js +0 -1
- package/lib/view/expenseAutomationView/epics/jeSchedule/fetchOneTimeAccrualEpic.d.ts +0 -20
- package/lib/view/expenseAutomationView/epics/jeSchedule/fetchOneTimeAccrualEpic.js +0 -49
- package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/createOneTimeAccrualEpic.d.ts +0 -8
- package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/createOneTimeAccrualEpic.js +0 -103
- package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/initializeNewScheduleEpic.d.ts +0 -8
- package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/initializeNewScheduleEpic.js +0 -29
- package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/saveNewScheduleEpic.d.ts +0 -45
- package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/saveNewScheduleEpic.js +0 -114
- package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/searchTransactionsForNewScheduleEpic.d.ts +0 -8
- package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/searchTransactionsForNewScheduleEpic.js +0 -83
- package/lib/view/expenseAutomationView/epics/jeSchedule/oneTimeAccrualActionsEpic.d.ts +0 -12
- package/lib/view/expenseAutomationView/epics/jeSchedule/oneTimeAccrualActionsEpic.js +0 -146
- package/lib/view/expenseAutomationView/epics/jeSchedule/revertJeScheduleEpic.d.ts +0 -64
- package/lib/view/expenseAutomationView/epics/jeSchedule/revertJeScheduleEpic.js +0 -110
- package/lib/view/expenseAutomationView/epics/jeSchedule/switchJESchedulesTabEpic.d.ts +0 -6
- package/lib/view/expenseAutomationView/epics/jeSchedule/switchJESchedulesTabEpic.js +0 -26
- package/lib/view/expenseAutomationView/helpers/newScheduleLocalDataHelper.d.ts +0 -36
- package/lib/view/expenseAutomationView/helpers/newScheduleLocalDataHelper.js +0 -145
- package/lib/view/expenseAutomationView/selectorTypes/jeNewScheduleViewSelectorTypes.d.ts +0 -42
- package/lib/view/expenseAutomationView/selectors/jeNewScheduleViewSelector.d.ts +0 -21
- package/lib/view/expenseAutomationView/selectors/jeNewScheduleViewSelector.js +0 -112
- package/lib/view/invoicing/invoicingQboView/epics/fetchInvoicingQboAccountsEpic.d.ts +0 -6
- package/lib/view/invoicing/invoicingQboView/epics/fetchInvoicingQboAccountsEpic.js +0 -29
- package/lib/view/invoicing/invoicingQboView/epics/fetchInvoicingQboClassesEpic.d.ts +0 -6
- package/lib/view/invoicing/invoicingQboView/epics/fetchInvoicingQboClassesEpic.js +0 -19
- package/lib/view/invoicing/settingsView/settingsViewEpics.d.ts +0 -12
- package/lib/view/invoicing/settingsView/settingsViewEpics.js +0 -99
- package/lib/view/spendManagement/treasury/treasurySetUp/epic/updateTreasuryPromoIntroClosedByOutsideClickEpic.d.ts +0 -8
- package/lib/view/spendManagement/treasury/treasurySetUp/epic/updateTreasuryPromoIntroClosedByOutsideClickEpic.js +0 -22
- package/lib/view/spendManagement/treasury/treasurySetUp/epic/updateTreasuryPromoRemindMeLaterClickedEpic.d.ts +0 -8
- package/lib/view/spendManagement/treasury/treasurySetUp/epic/updateTreasuryPromoRemindMeLaterClickedEpic.js +0 -22
- package/lib/view/spendManagement/treasury/treasurySetUp/epic/updateTreasuryVideoViewedEpic.d.ts +0 -8
- package/lib/view/spendManagement/treasury/treasurySetUp/epic/updateTreasuryVideoViewedEpic.js +0 -22
- package/lib/view/zeniAccountsPromoCard/zeniAccountsPromoCardEpic.d.ts +0 -13
- package/lib/view/zeniAccountsPromoCard/zeniAccountsPromoCardEpic.js +0 -20
- package/lib/view/zeniAccountsPromoCard/zeniAccountsPromoCardPayload.d.ts +0 -11
- package/lib/view/zeniAccountsPromoCard/zeniAccountsPromoCardPayload.js +0 -2
- package/lib/view/zeniAccountsPromoCard/zeniAccountsPromoCardReducer.d.ts +0 -7
- package/lib/view/zeniAccountsPromoCard/zeniAccountsPromoCardReducer.js +0 -64
- package/lib/view/zeniAccountsPromoCard/zeniAccountsPromoCardSelector.d.ts +0 -12
- package/lib/view/zeniAccountsPromoCard/zeniAccountsPromoCardSelector.js +0 -15
- package/lib/view/zeniAccountsPromoCard/zeniAccountsPromoCardState.d.ts +0 -9
- package/lib/view/zeniAccountsPromoCard/zeniAccountsPromoCardState.js +0 -2
- /package/lib/esm/view/{expenseAutomationView/selectorTypes/jeNewScheduleViewSelectorTypes.js → invoicing/settingsView/epics/settingsViewActionType.js} +0 -0
- /package/lib/view/{expenseAutomationView/selectorTypes/jeNewScheduleViewSelectorTypes.js → invoicing/settingsView/epics/settingsViewActionType.js} +0 -0
|
@@ -1,8 +1,12 @@
|
|
|
1
|
+
import { NestedAccountHierarchyForReport } from '../../../commonStateTypes/accountView/nestedAccountID';
|
|
1
2
|
import { FetchState, FetchStateAndError } from '../../../commonStateTypes/common';
|
|
2
3
|
import { InvoicingDunningActionOption, InvoicingNamedOption, InvoicingQboAccountMappingKindOption, InvoicingSettingsPayload } from '../../../entity/invoicing/invoicingCommonPayload';
|
|
3
4
|
import { ZeniAPIStatus } from '../../../responsePayload';
|
|
4
5
|
import { RootState } from '../../../rootStateTypes';
|
|
6
|
+
import { InvoicingQboConnection, InvoicingQboSyncHealth } from '../invoicingQboView/invoicingQboViewPayload';
|
|
7
|
+
import { InvoicingAccountingOption } from '../invoicingQboView/invoicingQboViewSelector';
|
|
5
8
|
import { InvoicingBrandingFormLocalData } from './invoicingBrandingFormConfig';
|
|
9
|
+
import { InvoicingQboSettingsLocalData } from './invoicingQboSettingsFormConfig';
|
|
6
10
|
/**
|
|
7
11
|
* Shared primitive: the raw invoicing settings. Consumed internally by other
|
|
8
12
|
* CES selectors (create-invoice, customer-detail, overview) and by non-settings
|
|
@@ -83,6 +87,37 @@ export interface InvoicingSettingsHubView {
|
|
|
83
87
|
* and QBO slices read here are only fetched once a settings screen is mounted.
|
|
84
88
|
*/
|
|
85
89
|
export declare const getInvoicingSettingsHubView: (state: RootState) => InvoicingSettingsHubView;
|
|
90
|
+
export interface InvoicingQboSettingsFormView {
|
|
91
|
+
accountMappingKindOptions: InvoicingQboAccountMappingKindOption[];
|
|
92
|
+
/** Accounts for the mapping dropdowns, narrowed per kind by the page. */
|
|
93
|
+
accounts: InvoicingAccountingOption[];
|
|
94
|
+
backfillState: FetchStateAndError;
|
|
95
|
+
/** So the screen can fetch only what is missing, without reading the slices. */
|
|
96
|
+
configFetchState: FetchState;
|
|
97
|
+
customerMatchingOptions: InvoicingNamedOption[];
|
|
98
|
+
isLoading: boolean;
|
|
99
|
+
/** The persisted sync toggle — the backfill guard checks that, not the draft. */
|
|
100
|
+
isSyncEnabledSaved: boolean;
|
|
101
|
+
/** The draft the page edits, seeded from the settings response. */
|
|
102
|
+
localData: InvoicingQboSettingsLocalData;
|
|
103
|
+
nestedAccountHierarchy: NestedAccountHierarchyForReport[];
|
|
104
|
+
retryFetchStateByTaskId: Record<string, FetchStateAndError>;
|
|
105
|
+
saveState: FetchStateAndError;
|
|
106
|
+
settingsFetchState: FetchState;
|
|
107
|
+
syncStatusOptions: InvoicingNamedOption[];
|
|
108
|
+
connection?: InvoicingQboConnection;
|
|
109
|
+
syncHealth?: InvoicingQboSyncHealth;
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Bundled view for the QBO configuration page: the draft it edits, the accounts
|
|
113
|
+
* and option lists its dropdowns render, the connection and sync health it
|
|
114
|
+
* reports, and the fetch states that decide between skeleton, form and error.
|
|
115
|
+
*
|
|
116
|
+
* `localData` is the draft once the user has edited, and the settings response
|
|
117
|
+
* before that — so the page has one field to read and CES owns when it becomes
|
|
118
|
+
* available, rather than the page copying settings into local state.
|
|
119
|
+
*/
|
|
120
|
+
export declare const getInvoicingQboSettingsFormView: (state: RootState) => InvoicingQboSettingsFormView;
|
|
86
121
|
export interface InvoicingBrandingFormView {
|
|
87
122
|
dateFormatOptions: InvoicingNamedOption[];
|
|
88
123
|
localData: InvoicingBrandingFormLocalData;
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getInvoicingBrandingFormView = exports.getInvoicingSettingsHubView = exports.getInvoicingSettingsView = exports.getInvoicingSettingsFetchState = exports.getInvoicingSettings = void 0;
|
|
3
|
+
exports.getInvoicingBrandingFormView = exports.getInvoicingQboSettingsFormView = exports.getInvoicingSettingsHubView = exports.getInvoicingSettingsView = exports.getInvoicingSettingsFetchState = exports.getInvoicingSettings = void 0;
|
|
4
4
|
exports.deriveInvoicingEnablePrerequisites = deriveInvoicingEnablePrerequisites;
|
|
5
5
|
const invoicingCommonPayload_1 = require("../../../entity/invoicing/invoicingCommonPayload");
|
|
6
6
|
const addressViewSelector_1 = require("../../addressView/addressViewSelector");
|
|
7
7
|
const invoicingConfigViewSelector_1 = require("../invoicingConfigView/invoicingConfigViewSelector");
|
|
8
|
+
const invoicingQboViewSelector_1 = require("../invoicingQboView/invoicingQboViewSelector");
|
|
8
9
|
const invoicingBrandingFormConfig_1 = require("./invoicingBrandingFormConfig");
|
|
10
|
+
const invoicingQboSettingsFormConfig_1 = require("./invoicingQboSettingsFormConfig");
|
|
9
11
|
/**
|
|
10
12
|
* Shared primitive: the raw invoicing settings. Consumed internally by other
|
|
11
13
|
* CES selectors (create-invoice, customer-detail, overview) and by non-settings
|
|
@@ -100,6 +102,46 @@ const getInvoicingSettingsHubView = (state) => {
|
|
|
100
102
|
};
|
|
101
103
|
};
|
|
102
104
|
exports.getInvoicingSettingsHubView = getInvoicingSettingsHubView;
|
|
105
|
+
/**
|
|
106
|
+
* Bundled view for the QBO configuration page: the draft it edits, the accounts
|
|
107
|
+
* and option lists its dropdowns render, the connection and sync health it
|
|
108
|
+
* reports, and the fetch states that decide between skeleton, form and error.
|
|
109
|
+
*
|
|
110
|
+
* `localData` is the draft once the user has edited, and the settings response
|
|
111
|
+
* before that — so the page has one field to read and CES owns when it becomes
|
|
112
|
+
* available, rather than the page copying settings into local state.
|
|
113
|
+
*/
|
|
114
|
+
const getInvoicingQboSettingsFormView = (state) => {
|
|
115
|
+
const { error, fetchState, qboDraft, saveFetchState, settings } = state.invoicingSettingsViewState;
|
|
116
|
+
const { fetchState: configFetchState, qboAccountMappingKindOptions, qboCustomerMatchingOptions, qboSyncStatusOptions, } = (0, invoicingConfigViewSelector_1.getInvoicingConfigView)(state);
|
|
117
|
+
const qboView = (0, invoicingQboViewSelector_1.getInvoicingQboView)(state);
|
|
118
|
+
return {
|
|
119
|
+
accountMappingKindOptions: qboAccountMappingKindOptions,
|
|
120
|
+
accounts: qboView.accounts,
|
|
121
|
+
backfillState: qboView.backfillState,
|
|
122
|
+
connection: qboView.connection,
|
|
123
|
+
configFetchState,
|
|
124
|
+
customerMatchingOptions: qboCustomerMatchingOptions,
|
|
125
|
+
// The dropdowns cannot be built before both the settings and the accounts
|
|
126
|
+
// land, so the page waits on either rather than rendering empty pickers.
|
|
127
|
+
isLoading: fetchState === 'Not-Started' ||
|
|
128
|
+
fetchState === 'In-Progress' ||
|
|
129
|
+
(0, invoicingQboViewSelector_1.isInvoicingAccountingPickerDataLoading)(state),
|
|
130
|
+
isSyncEnabledSaved: settings?.qbo?.enabled === true,
|
|
131
|
+
// Seeded in the reducer when the settings response lands, so this is a plain
|
|
132
|
+
// read rather than a second place that decides what the page starts from.
|
|
133
|
+
localData: qboDraft ?? invoicingQboSettingsFormConfig_1.initialInvoicingQboSettingsLocalData,
|
|
134
|
+
nestedAccountHierarchy: qboView.nestedAccountHierarchy,
|
|
135
|
+
retryFetchStateByTaskId: qboView.retryFetchStateByTaskId,
|
|
136
|
+
saveState: saveFetchState.fetchState === 'Not-Started' && error != null
|
|
137
|
+
? { fetchState, error }
|
|
138
|
+
: saveFetchState,
|
|
139
|
+
settingsFetchState: fetchState,
|
|
140
|
+
syncHealth: qboView.syncHealth,
|
|
141
|
+
syncStatusOptions: qboSyncStatusOptions,
|
|
142
|
+
};
|
|
143
|
+
};
|
|
144
|
+
exports.getInvoicingQboSettingsFormView = getInvoicingQboSettingsFormView;
|
|
103
145
|
/**
|
|
104
146
|
* Bundled view for the branding settings form: the draft `localData` (seeded
|
|
105
147
|
* from the existing settings until the user edits), the business-address label
|
|
@@ -1,9 +1,17 @@
|
|
|
1
1
|
import { FetchStateAndError, FetchedState } from '../../../commonStateTypes/common';
|
|
2
2
|
import { InvoicingSettingsPayload } from '../../../entity/invoicing/invoicingCommonPayload';
|
|
3
3
|
import { InvoicingBrandingFormLocalData } from './invoicingBrandingFormConfig';
|
|
4
|
+
import { InvoicingQboSettingsLocalData } from './invoicingQboSettingsFormConfig';
|
|
4
5
|
export interface InvoicingSettingsViewState extends FetchedState {
|
|
5
6
|
saveFetchState: FetchStateAndError;
|
|
6
7
|
stripeFetchState: FetchStateAndError;
|
|
7
8
|
brandingDraft?: InvoicingBrandingFormLocalData;
|
|
9
|
+
/**
|
|
10
|
+
* In-progress QBO settings edits. Held here rather than in the page so a
|
|
11
|
+
* selection cannot be lost between the change and the save, and so a
|
|
12
|
+
* half-finished edit survives navigating away. Undefined until first edited,
|
|
13
|
+
* which is what makes the server's settings the fallback.
|
|
14
|
+
*/
|
|
15
|
+
qboDraft?: InvoicingQboSettingsLocalData;
|
|
8
16
|
settings?: InvoicingSettingsPayload;
|
|
9
17
|
}
|
|
@@ -33,7 +33,7 @@ const fetchAccruedScheduleListEpic = (actions$, state$, zeniAPI) => actions$.pip
|
|
|
33
33
|
je_schedule_type: scheduleType,
|
|
34
34
|
sort_by: 'transaction_date',
|
|
35
35
|
sort_order: 'desc',
|
|
36
|
-
filter:
|
|
36
|
+
filter: 'all',
|
|
37
37
|
};
|
|
38
38
|
return zeniAPI
|
|
39
39
|
.getJSON(`${zeniAPI.apiEndPoints.accountMicroServiceBaseUrl}/1.0/schedules?query=${encodeURIComponent(JSON.stringify(queryParam))}`)
|
|
@@ -10,14 +10,9 @@ const responsePayload_1 = require("../../../../responsePayload");
|
|
|
10
10
|
const scheduleListReducer_1 = require("../scheduleListReducer");
|
|
11
11
|
const scheduleListTypes_1 = require("../scheduleListTypes");
|
|
12
12
|
const fetchDownloadSchedulesEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(scheduleListReducer_1.fetchDownloadSchedules.match), (0, operators_1.mergeMap)((action) => {
|
|
13
|
-
const { scheduleType, downloadCategories
|
|
13
|
+
const { scheduleType, downloadCategories } = action.payload;
|
|
14
14
|
const scheduleListState = state$.value.scheduleListState;
|
|
15
15
|
// if parameters are provided, use those. else go to localdata
|
|
16
|
-
// Accrued is deliberately not served here. Its rows come back in a different shape, this
|
|
17
|
-
// epic writes them through updateJESchedules (the prepaid / fixed mapper), and
|
|
18
|
-
// doUpdateScheduleList never flips downloadState for accrued -- so a request would store the
|
|
19
|
-
// wrong data and then never report completion. Accrued downloads go through
|
|
20
|
-
// fetchAccruedScheduleList, which owns that shape end to end.
|
|
21
16
|
let scheduleState;
|
|
22
17
|
if (scheduleType !== 'accrued_expenses') {
|
|
23
18
|
scheduleState = (0, scheduleListReducer_1.getState)(scheduleListState, scheduleType);
|
|
@@ -42,7 +37,7 @@ const fetchDownloadSchedulesEpic = (actions$, state$, zeniAPI) => actions$.pipe(
|
|
|
42
37
|
base_txn_account_ids: downloadCategories,
|
|
43
38
|
sort_by: 'transaction_date',
|
|
44
39
|
sort_order: 'desc',
|
|
45
|
-
filter:
|
|
40
|
+
filter: 'all',
|
|
46
41
|
};
|
|
47
42
|
return zeniAPI
|
|
48
43
|
.getJSON(`${zeniAPI.apiEndPoints.accountMicroServiceBaseUrl}/1.0/schedules/download?query=${encodeURIComponent(JSON.stringify(queryParam))}`)
|
|
@@ -16,7 +16,7 @@ export declare const initialState: ScheduleListViewState;
|
|
|
16
16
|
export declare const fetchDownloadSchedules: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[scheduleType: "prepaid_expenses" | "fixed_assets" | "accrued_expenses" | "deferred_revenue", timeframeAndCategory: {
|
|
17
17
|
selectedCategoryId: ID;
|
|
18
18
|
selectedTimeframe: TimeframeTick;
|
|
19
|
-
}, downloadCategories: string[],
|
|
19
|
+
}, downloadCategories: string[], cacheOverride?: any], {
|
|
20
20
|
timeframeAndCategory: {
|
|
21
21
|
selectedCategoryId: ID;
|
|
22
22
|
selectedTimeframe: TimeframeTick;
|
|
@@ -24,18 +24,16 @@ export declare const fetchDownloadSchedules: import("@reduxjs/toolkit").ActionCr
|
|
|
24
24
|
scheduleType: "prepaid_expenses" | "fixed_assets" | "accrued_expenses" | "deferred_revenue";
|
|
25
25
|
cacheOverride: any;
|
|
26
26
|
downloadCategories: string[];
|
|
27
|
-
statusFilter: "completed" | "new" | "ongoing" | "all";
|
|
28
27
|
}, "scheduleListView/fetchDownloadSchedules", never, never>, fetchAccruedScheduleList: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[scheduleType: "prepaid_expenses" | "fixed_assets" | "accrued_expenses" | "deferred_revenue", timeframeAndCategory?: {
|
|
29
28
|
selectedCategoryId: ID;
|
|
30
29
|
selectedTimeframe: TimeframeTick;
|
|
31
|
-
} | undefined, cacheOverride?: any
|
|
30
|
+
} | undefined, cacheOverride?: any], {
|
|
32
31
|
timeframeAndCategory: {
|
|
33
32
|
selectedCategoryId: ID;
|
|
34
33
|
selectedTimeframe: TimeframeTick;
|
|
35
34
|
} | undefined;
|
|
36
35
|
scheduleType: "prepaid_expenses" | "fixed_assets" | "accrued_expenses" | "deferred_revenue";
|
|
37
36
|
cacheOverride: any;
|
|
38
|
-
statusFilter: "completed" | "new" | "ongoing" | "all";
|
|
39
37
|
}, "scheduleListView/fetchAccruedScheduleList", never, never>, fetchScheduleList: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[scheduleType: "prepaid_expenses" | "fixed_assets" | "accrued_expenses" | "deferred_revenue", timeframeAndCategory?: {
|
|
40
38
|
selectedCategoryId: ID;
|
|
41
39
|
selectedTimeframe: TimeframeTick;
|
|
@@ -90,8 +90,8 @@ const scheduleListView = (0, toolkit_1.createSlice)({
|
|
|
90
90
|
reducers: {
|
|
91
91
|
fetchDownloadSchedules: {
|
|
92
92
|
reducer(draft, action) {
|
|
93
|
-
// Accrued is not downloaded through this action -- see fetchDownloadSchedulesEpic for why.
|
|
94
93
|
if (action.payload.scheduleType !== 'accrued_expenses') {
|
|
94
|
+
//if condition added for type narrowing
|
|
95
95
|
const state = getState(draft, action.payload.scheduleType);
|
|
96
96
|
const selectedTimeframe = action.payload.timeframeAndCategory.selectedTimeframe;
|
|
97
97
|
const selectedCategoryId = action.payload.timeframeAndCategory.selectedCategoryId;
|
|
@@ -115,14 +115,13 @@ const scheduleListView = (0, toolkit_1.createSlice)({
|
|
|
115
115
|
updateState(draft, action.payload.scheduleType, state);
|
|
116
116
|
}
|
|
117
117
|
},
|
|
118
|
-
prepare(scheduleType, timeframeAndCategory, downloadCategories,
|
|
118
|
+
prepare(scheduleType, timeframeAndCategory, downloadCategories, cacheOverride = false) {
|
|
119
119
|
return {
|
|
120
120
|
payload: {
|
|
121
121
|
timeframeAndCategory,
|
|
122
122
|
scheduleType,
|
|
123
123
|
cacheOverride,
|
|
124
124
|
downloadCategories,
|
|
125
|
-
statusFilter,
|
|
126
125
|
},
|
|
127
126
|
};
|
|
128
127
|
},
|
|
@@ -158,13 +157,12 @@ const scheduleListView = (0, toolkit_1.createSlice)({
|
|
|
158
157
|
updateState(draft, action.payload.scheduleType, state);
|
|
159
158
|
}
|
|
160
159
|
},
|
|
161
|
-
prepare(scheduleType, timeframeAndCategory, cacheOverride = false
|
|
160
|
+
prepare(scheduleType, timeframeAndCategory, cacheOverride = false) {
|
|
162
161
|
return {
|
|
163
162
|
payload: {
|
|
164
163
|
timeframeAndCategory,
|
|
165
164
|
scheduleType,
|
|
166
165
|
cacheOverride,
|
|
167
|
-
statusFilter,
|
|
168
166
|
},
|
|
169
167
|
};
|
|
170
168
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zeniai/client-epic-state",
|
|
3
|
-
"version": "5.2.
|
|
3
|
+
"version": "5.2.12",
|
|
4
4
|
"description": "Shared module between Web & Mobile containing required abstractions for state management, async network communication. ",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "lib/esm/index.js",
|
|
File without changes
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { InvoicingFormOption } from '../invoicingCommonPayload';
|
|
2
|
-
import { InvoicingCouponApplyOn, InvoicingCouponDurationType, InvoicingCouponPeriodUnit, InvoicingDiscountType } from './couponPayload';
|
|
3
|
-
/**
|
|
4
|
-
* Coupon form select options. Single source of truth (CES-owned) for the value
|
|
5
|
-
* sets that back the coupon's string-union domain fields; surfaced to the form
|
|
6
|
-
* via `getInvoicingCouponFormView` so web-components need not hardcode them.
|
|
7
|
-
*/
|
|
8
|
-
export declare const INVOICING_DISCOUNT_TYPE_OPTIONS: readonly InvoicingFormOption<InvoicingDiscountType>[];
|
|
9
|
-
export declare const INVOICING_COUPON_DURATION_TYPE_OPTIONS: readonly InvoicingFormOption<InvoicingCouponDurationType>[];
|
|
10
|
-
export declare const INVOICING_COUPON_PERIOD_UNIT_OPTIONS: readonly InvoicingFormOption<InvoicingCouponPeriodUnit>[];
|
|
11
|
-
export declare const INVOICING_COUPON_APPLY_ON_OPTIONS: readonly InvoicingFormOption<InvoicingCouponApplyOn>[];
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.INVOICING_COUPON_APPLY_ON_OPTIONS = exports.INVOICING_COUPON_PERIOD_UNIT_OPTIONS = exports.INVOICING_COUPON_DURATION_TYPE_OPTIONS = exports.INVOICING_DISCOUNT_TYPE_OPTIONS = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* Coupon form select options. Single source of truth (CES-owned) for the value
|
|
6
|
-
* sets that back the coupon's string-union domain fields; surfaced to the form
|
|
7
|
-
* via `getInvoicingCouponFormView` so web-components need not hardcode them.
|
|
8
|
-
*/
|
|
9
|
-
exports.INVOICING_DISCOUNT_TYPE_OPTIONS = [
|
|
10
|
-
{ label: 'Percentage', value: 'percentage' },
|
|
11
|
-
{ label: 'Fixed amount', value: 'fixed_amount' },
|
|
12
|
-
{ label: 'Offer quantity', value: 'offer_quantity' },
|
|
13
|
-
];
|
|
14
|
-
exports.INVOICING_COUPON_DURATION_TYPE_OPTIONS = [
|
|
15
|
-
{ label: 'One time', value: 'one_time' },
|
|
16
|
-
{ label: 'Forever', value: 'forever' },
|
|
17
|
-
{ label: 'Limited period', value: 'limited_period' },
|
|
18
|
-
];
|
|
19
|
-
exports.INVOICING_COUPON_PERIOD_UNIT_OPTIONS = [
|
|
20
|
-
{ label: 'Day', value: 'day' },
|
|
21
|
-
{ label: 'Week', value: 'week' },
|
|
22
|
-
{ label: 'Month', value: 'month' },
|
|
23
|
-
{ label: 'Year', value: 'year' },
|
|
24
|
-
];
|
|
25
|
-
exports.INVOICING_COUPON_APPLY_ON_OPTIONS = [
|
|
26
|
-
{ label: 'Invoice amount', value: 'invoice_amount' },
|
|
27
|
-
{ label: 'Each specified item', value: 'each_specified_item' },
|
|
28
|
-
{ label: 'Specified items total', value: 'specified_items_total' },
|
|
29
|
-
];
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Coupon form select options. Single source of truth (CES-owned) for the value
|
|
3
|
-
* sets that back the coupon's string-union domain fields; surfaced to the form
|
|
4
|
-
* via `getInvoicingCouponFormView` so web-components need not hardcode them.
|
|
5
|
-
*/
|
|
6
|
-
export const INVOICING_DISCOUNT_TYPE_OPTIONS = [
|
|
7
|
-
{ label: 'Percentage', value: 'percentage' },
|
|
8
|
-
{ label: 'Fixed amount', value: 'fixed_amount' },
|
|
9
|
-
{ label: 'Offer quantity', value: 'offer_quantity' },
|
|
10
|
-
];
|
|
11
|
-
export const INVOICING_COUPON_DURATION_TYPE_OPTIONS = [
|
|
12
|
-
{ label: 'One time', value: 'one_time' },
|
|
13
|
-
{ label: 'Forever', value: 'forever' },
|
|
14
|
-
{ label: 'Limited period', value: 'limited_period' },
|
|
15
|
-
];
|
|
16
|
-
export const INVOICING_COUPON_PERIOD_UNIT_OPTIONS = [
|
|
17
|
-
{ label: 'Day', value: 'day' },
|
|
18
|
-
{ label: 'Week', value: 'week' },
|
|
19
|
-
{ label: 'Month', value: 'month' },
|
|
20
|
-
{ label: 'Year', value: 'year' },
|
|
21
|
-
];
|
|
22
|
-
export const INVOICING_COUPON_APPLY_ON_OPTIONS = [
|
|
23
|
-
{ label: 'Invoice amount', value: 'invoice_amount' },
|
|
24
|
-
{ label: 'Each specified item', value: 'each_specified_item' },
|
|
25
|
-
{ label: 'Specified items total', value: 'specified_items_total' },
|
|
26
|
-
];
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { from } from 'rxjs';
|
|
2
|
-
import { catchError, filter, mergeMap, takeUntil } from 'rxjs/operators';
|
|
3
|
-
import { updateJEOneTimeAccruals } from '../../../../entity/jeSchedules/jeSchedulesReducer';
|
|
4
|
-
import { createZeniAPIStatus, isSuccessResponse, } from '../../../../responsePayload';
|
|
5
|
-
import { clearAll } from '../../../../rootActions';
|
|
6
|
-
import { fetchOneTimeAccrual, fetchOneTimeAccrualFailure, fetchOneTimeAccrualSuccess, } from '../../reducers/jeSchedulesViewReducer';
|
|
7
|
-
/**
|
|
8
|
-
* Read one accrual by id so its detail page can render from a URL alone.
|
|
9
|
-
*
|
|
10
|
-
* Every other row on this page arrives with the JE Schedules list, and the accrual detail page used
|
|
11
|
-
* to render only from what that list had already put in the store -- so opening its URL directly, on
|
|
12
|
-
* a refresh or a shared link, had nothing to render and showed not-found. This is the read that
|
|
13
|
-
* makes the URL self-sufficient.
|
|
14
|
-
*
|
|
15
|
-
* The response is the same `{accrual}` envelope promote / ignore / revert return, and it goes through
|
|
16
|
-
* the same `updateJEOneTimeAccruals`, so a page loaded cold holds exactly the entity a page reached
|
|
17
|
-
* through the list holds.
|
|
18
|
-
*/
|
|
19
|
-
export const fetchOneTimeAccrualEpic = (actions$, _state$, zeniAPI) => actions$.pipe(filter(fetchOneTimeAccrual.match), mergeMap((action) => {
|
|
20
|
-
const { accrualId } = action.payload;
|
|
21
|
-
return zeniAPI
|
|
22
|
-
.getJSON(`${zeniAPI.apiEndPoints.accountMicroServiceBaseUrl}/1.0/accruals/${accrualId}`)
|
|
23
|
-
.pipe(mergeMap((response) => {
|
|
24
|
-
if (isSuccessResponse(response) && response.data != null) {
|
|
25
|
-
return from([
|
|
26
|
-
updateJEOneTimeAccruals([response.data.accrual]),
|
|
27
|
-
fetchOneTimeAccrualSuccess({ accrualId }),
|
|
28
|
-
]);
|
|
29
|
-
}
|
|
30
|
-
// A deleted or ignored accrual answers 404 here, the same as an id that never existed.
|
|
31
|
-
// Both end as an error state the page turns into not-found, rather than a spinner that
|
|
32
|
-
// never resolves.
|
|
33
|
-
return from([
|
|
34
|
-
fetchOneTimeAccrualFailure({ accrualId, status: response.status }),
|
|
35
|
-
]);
|
|
36
|
-
}), catchError((error) => from([
|
|
37
|
-
fetchOneTimeAccrualFailure({
|
|
38
|
-
accrualId,
|
|
39
|
-
status: createZeniAPIStatus('Unexpected Error', `Fetch one-time accrual REST API call errored out ${JSON.stringify(error)}`),
|
|
40
|
-
}),
|
|
41
|
-
])),
|
|
42
|
-
// A tenant switch clears the store while this request is in flight. Without this the old
|
|
43
|
-
// tenant's accrual is written back into the freshly cleared store.
|
|
44
|
-
takeUntil(actions$.pipe(filter(clearAll.match))));
|
|
45
|
-
}));
|
package/lib/esm/view/expenseAutomationView/epics/jeSchedule/newSchedule/createOneTimeAccrualEpic.js
DELETED
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
import { from } from 'rxjs';
|
|
2
|
-
import { catchError, filter, mergeMap } from 'rxjs/operators';
|
|
3
|
-
import { convertToPeriod, toAbsoluteDay, } from '../../../../../commonStateTypes/timePeriod';
|
|
4
|
-
import { updateJEOneTimeAccruals } from '../../../../../entity/jeSchedules/jeSchedulesReducer';
|
|
5
|
-
import { openSnackbar } from '../../../../../entity/snackbar/snackbarReducer';
|
|
6
|
-
import { getCurrentTenant } from '../../../../../entity/tenant/tenantSelector';
|
|
7
|
-
import { createZeniAPIStatus, isSuccessResponse, } from '../../../../../responsePayload';
|
|
8
|
-
import { prepareCreateOneTimeAccrualPayload, } from '../../../payload/jeSchedulesPayload';
|
|
9
|
-
import { createOneTimeAccrual, createOneTimeAccrualFailure, createOneTimeAccrualSuccess, fetchJeSchedules, } from '../../../reducers/jeSchedulesViewReducer';
|
|
10
|
-
export const createOneTimeAccrualEpic = (actions$, state$, zeniAPI) => actions$.pipe(filter(createOneTimeAccrual.match), mergeMap((action) => {
|
|
11
|
-
const state = state$.value;
|
|
12
|
-
const { localData } = action.payload;
|
|
13
|
-
/*
|
|
14
|
-
* Idempotency for the create. agent-je dedupes on this: the same key again returns the
|
|
15
|
-
* existing accrual rather than posting a second JE to QBO.
|
|
16
|
-
*
|
|
17
|
-
* Body `request_id` rather than the `Idempotency-Key` header the API doc prefers, on Mohit's
|
|
18
|
-
* call (2026-08-24). The header cannot reach the service from a browser -- common's
|
|
19
|
-
* Access-Control-Allow-Headers does not list it, so cross-origin preflight rejects the
|
|
20
|
-
* request. Same meaning either way; the header simply wins when both are sent.
|
|
21
|
-
*
|
|
22
|
-
* Minted here, per create action, and deliberately not held in local data or the form: a new
|
|
23
|
-
* Save must produce a new key, and only a retry of *this* request may reuse one. Nothing
|
|
24
|
-
* retries today -- if a retry operator is ever added below, it has to sit inside this
|
|
25
|
-
* mergeMap so the key is not re-minted, or the guarantee is silently lost.
|
|
26
|
-
*/
|
|
27
|
-
const requestId = crypto.randomUUID();
|
|
28
|
-
const payload = {
|
|
29
|
-
...prepareCreateOneTimeAccrualPayload(state, localData),
|
|
30
|
-
request_id: requestId,
|
|
31
|
-
};
|
|
32
|
-
// convertToPeriod destructures, so an unset period would throw here and take the epic
|
|
33
|
-
// subscription down for the whole session — a missed refresh is the cheaper failure.
|
|
34
|
-
const selectedMonthYear = state.expenseAutomationViewState.selectedPeriodByTenantId[getCurrentTenant(state).tenantId];
|
|
35
|
-
const selectedPeriod = selectedMonthYear != null
|
|
36
|
-
? convertToPeriod(selectedMonthYear)
|
|
37
|
-
: undefined;
|
|
38
|
-
const periodStart = selectedPeriod != null
|
|
39
|
-
? toAbsoluteDay(selectedPeriod.start)
|
|
40
|
-
: undefined;
|
|
41
|
-
const periodEnd = selectedPeriod != null ? toAbsoluteDay(selectedPeriod.end) : undefined;
|
|
42
|
-
return zeniAPI
|
|
43
|
-
.postAndGetJSON(`${zeniAPI.apiEndPoints.accountMicroServiceBaseUrl}/1.0/accruals`, payload)
|
|
44
|
-
.pipe(mergeMap((response) => {
|
|
45
|
-
if (isSuccessResponse(response) && response.data != null) {
|
|
46
|
-
const successActions = [
|
|
47
|
-
updateJEOneTimeAccruals([response.data.accrual]),
|
|
48
|
-
createOneTimeAccrualSuccess(),
|
|
49
|
-
openSnackbar({
|
|
50
|
-
messageSection: 'create_schedule',
|
|
51
|
-
messageText: 'success',
|
|
52
|
-
type: 'success',
|
|
53
|
-
variables: [
|
|
54
|
-
{
|
|
55
|
-
variableName: '_vendor_name_',
|
|
56
|
-
variableValue: localData.vendorName,
|
|
57
|
-
},
|
|
58
|
-
],
|
|
59
|
-
}),
|
|
60
|
-
];
|
|
61
|
-
// The tab buckets (jeScheduleOneTimeAccrualKeysByPeriodAndTab) are rebuilt wholesale
|
|
62
|
-
// per fetch, and the backend decides whether a freshly posted accrual belongs to
|
|
63
|
-
// Review or Existing — so refetch rather than guess which bucket to insert into.
|
|
64
|
-
if (periodStart != null && periodEnd != null) {
|
|
65
|
-
successActions.push(fetchJeSchedules({ start: periodStart, end: periodEnd }, true));
|
|
66
|
-
}
|
|
67
|
-
return from(successActions);
|
|
68
|
-
}
|
|
69
|
-
return from([
|
|
70
|
-
createOneTimeAccrualFailure({ status: response.status }),
|
|
71
|
-
openSnackbar({
|
|
72
|
-
messageSection: 'create_schedule',
|
|
73
|
-
messageText: 'failed',
|
|
74
|
-
type: 'error',
|
|
75
|
-
variables: [
|
|
76
|
-
{
|
|
77
|
-
variableName: '_api-error_',
|
|
78
|
-
variableValue: response.status.message,
|
|
79
|
-
},
|
|
80
|
-
],
|
|
81
|
-
}),
|
|
82
|
-
]);
|
|
83
|
-
}), catchError((error) => from([
|
|
84
|
-
openSnackbar({
|
|
85
|
-
messageSection: 'create_schedule',
|
|
86
|
-
messageText: 'failed',
|
|
87
|
-
type: 'error',
|
|
88
|
-
variables: [
|
|
89
|
-
{
|
|
90
|
-
variableName: '_api-error_',
|
|
91
|
-
variableValue: JSON.stringify(error),
|
|
92
|
-
},
|
|
93
|
-
],
|
|
94
|
-
}),
|
|
95
|
-
createOneTimeAccrualFailure({
|
|
96
|
-
status: createZeniAPIStatus('Unexpected Error', `Create One Time Accrual REST API call errored out ${JSON.stringify(error)}`),
|
|
97
|
-
}),
|
|
98
|
-
])));
|
|
99
|
-
}));
|
package/lib/esm/view/expenseAutomationView/epics/jeSchedule/newSchedule/initializeNewScheduleEpic.js
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { from } from 'rxjs';
|
|
2
|
-
import { filter, mergeMap } from 'rxjs/operators';
|
|
3
|
-
import { fetchAccountList } from '../../../../accountList/accountListReducer';
|
|
4
|
-
import { fetchClassList } from '../../../../classList/classListReducer';
|
|
5
|
-
import { getAccountsTypesForScheduleEpics } from '../../../../scheduleView/scheduleListView/scheduleListHelper';
|
|
6
|
-
import { clearSearchTransactionsForNewSchedule, initializeNewSchedule, resetNewScheduleLocalData, } from '../../../reducers/jeSchedulesViewReducer';
|
|
7
|
-
export const initializeNewScheduleEpic = (actions$, state$) => actions$.pipe(filter(initializeNewSchedule.match), mergeMap((action) => {
|
|
8
|
-
const newScheduleActions = [];
|
|
9
|
-
const accountType = getAccountsTypesForScheduleEpics();
|
|
10
|
-
const { accountListState, classListState } = state$.value;
|
|
11
|
-
if (accountListState.byReportId[accountType.accountListKey]?.fetchState ===
|
|
12
|
-
'Not-Started') {
|
|
13
|
-
newScheduleActions.push(fetchAccountList(accountType.accountListKey, true, false, false, false, accountType.allowedAccountList));
|
|
14
|
-
}
|
|
15
|
-
if (classListState.fetchState === 'Not-Started') {
|
|
16
|
-
newScheduleActions.push(fetchClassList());
|
|
17
|
-
}
|
|
18
|
-
// The account and class fetches above are idempotent (both guard on 'Not-Started'), so they
|
|
19
|
-
// can run on every open. Clearing what the user entered cannot, so it is opt-in.
|
|
20
|
-
if (action.payload.shouldResetEnteredData) {
|
|
21
|
-
newScheduleActions.push(resetNewScheduleLocalData({ scheduleType: action.payload.scheduleType }));
|
|
22
|
-
newScheduleActions.push(clearSearchTransactionsForNewSchedule());
|
|
23
|
-
}
|
|
24
|
-
return from(newScheduleActions);
|
|
25
|
-
}));
|
package/lib/esm/view/expenseAutomationView/epics/jeSchedule/newSchedule/saveNewScheduleEpic.js
DELETED
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
import { from } from 'rxjs';
|
|
2
|
-
import { catchError, filter, mergeMap } from 'rxjs/operators';
|
|
3
|
-
import { updateJESchedules, updateJESchedulesDetails, } from '../../../../../entity/jeSchedules/jeSchedulesReducer';
|
|
4
|
-
import { getJEScheduleTransactionKey } from '../../../../../entity/jeSchedules/jeSchedulesTypes';
|
|
5
|
-
import { openSnackbar } from '../../../../../entity/snackbar/snackbarReducer';
|
|
6
|
-
import { getScheduleTransactionById } from '../../../../../entity/transaction/transactionSelector';
|
|
7
|
-
import { createZeniAPIStatus, isSuccessResponse, } from '../../../../../responsePayload';
|
|
8
|
-
import { prepareNewSchedulePayload, } from '../../../helpers/newScheduleLocalDataHelper';
|
|
9
|
-
import { resetNewScheduleLocalData, saveNewSchedule, saveNewScheduleFailure, saveNewScheduleSuccess, } from '../../../reducers/jeSchedulesViewReducer';
|
|
10
|
-
const FAILURE_REASON_MESSAGES = {
|
|
11
|
-
missing_third_party_id: 'This transaction is missing a QuickBooks reference and cannot be scheduled.',
|
|
12
|
-
missing_vendor: 'Select a vendor before saving this schedule.',
|
|
13
|
-
};
|
|
14
|
-
export const saveNewScheduleEpic = (actions$, state$, zeniAPI) => actions$.pipe(filter(saveNewSchedule.match), mergeMap((action) => {
|
|
15
|
-
const { scheduleType } = action.payload;
|
|
16
|
-
const state = state$.value;
|
|
17
|
-
const localData = state.expenseAutomationJESchedulesViewState.newSchedule
|
|
18
|
-
.newScheduleState[scheduleType];
|
|
19
|
-
const { selectedBaseTransactionId } = localData;
|
|
20
|
-
const transaction = selectedBaseTransactionId != null
|
|
21
|
-
? getScheduleTransactionById(state.transactionState, getJEScheduleTransactionKey(selectedBaseTransactionId))
|
|
22
|
-
: undefined;
|
|
23
|
-
if (transaction == null) {
|
|
24
|
-
return from([
|
|
25
|
-
saveNewScheduleFailure({
|
|
26
|
-
status: createZeniAPIStatus('Unexpected Error', 'No base transaction selected for this schedule.'),
|
|
27
|
-
}),
|
|
28
|
-
openSnackbar({
|
|
29
|
-
messageSection: 'create_schedule',
|
|
30
|
-
messageText: 'failed',
|
|
31
|
-
type: 'error',
|
|
32
|
-
variables: [
|
|
33
|
-
{
|
|
34
|
-
variableName: '_api-error_',
|
|
35
|
-
variableValue: 'No base transaction selected.',
|
|
36
|
-
},
|
|
37
|
-
],
|
|
38
|
-
}),
|
|
39
|
-
]);
|
|
40
|
-
}
|
|
41
|
-
const result = prepareNewSchedulePayload(transaction, localData, scheduleType);
|
|
42
|
-
if (!result.ok) {
|
|
43
|
-
const message = FAILURE_REASON_MESSAGES[result.reason];
|
|
44
|
-
return from([
|
|
45
|
-
saveNewScheduleFailure({
|
|
46
|
-
status: createZeniAPIStatus('Unexpected Error', message),
|
|
47
|
-
}),
|
|
48
|
-
openSnackbar({
|
|
49
|
-
messageSection: 'create_schedule',
|
|
50
|
-
messageText: 'failed',
|
|
51
|
-
type: 'error',
|
|
52
|
-
variables: [{ variableName: '_api-error_', variableValue: message }],
|
|
53
|
-
}),
|
|
54
|
-
]);
|
|
55
|
-
}
|
|
56
|
-
const vendorName = localData.selectedVendor?.name ?? transaction.vendorName ?? '';
|
|
57
|
-
const queryParam = {
|
|
58
|
-
je_schedule_type: scheduleType,
|
|
59
|
-
};
|
|
60
|
-
const payload = { ...result.payload };
|
|
61
|
-
return zeniAPI
|
|
62
|
-
.postAndGetJSON(`${zeniAPI.apiEndPoints.accountMicroServiceBaseUrl}/1.0/schedules?query=${encodeURIComponent(JSON.stringify(queryParam))}`, payload)
|
|
63
|
-
.pipe(mergeMap((response) => {
|
|
64
|
-
if (isSuccessResponse(response) && response.data != null) {
|
|
65
|
-
return from([
|
|
66
|
-
updateJESchedules(response.data.je_schedules),
|
|
67
|
-
updateJESchedulesDetails(response.data.je_schedules, response.data.scheduled_journal_entries),
|
|
68
|
-
resetNewScheduleLocalData({ scheduleType }),
|
|
69
|
-
saveNewScheduleSuccess(),
|
|
70
|
-
openSnackbar({
|
|
71
|
-
messageSection: 'create_schedule',
|
|
72
|
-
messageText: 'success',
|
|
73
|
-
type: 'success',
|
|
74
|
-
variables: [
|
|
75
|
-
{ variableName: '_vendor_name_', variableValue: vendorName },
|
|
76
|
-
],
|
|
77
|
-
}),
|
|
78
|
-
]);
|
|
79
|
-
}
|
|
80
|
-
return from([
|
|
81
|
-
saveNewScheduleFailure({ status: response.status }),
|
|
82
|
-
openSnackbar({
|
|
83
|
-
messageSection: 'create_schedule',
|
|
84
|
-
messageText: 'failed',
|
|
85
|
-
type: 'error',
|
|
86
|
-
variables: [
|
|
87
|
-
{
|
|
88
|
-
variableName: '_api-error_',
|
|
89
|
-
variableValue: response.status.message,
|
|
90
|
-
},
|
|
91
|
-
],
|
|
92
|
-
}),
|
|
93
|
-
]);
|
|
94
|
-
}), catchError((error) => from([
|
|
95
|
-
openSnackbar({
|
|
96
|
-
messageSection: 'create_schedule',
|
|
97
|
-
messageText: 'failed',
|
|
98
|
-
type: 'error',
|
|
99
|
-
variables: [
|
|
100
|
-
{
|
|
101
|
-
variableName: '_api-error_',
|
|
102
|
-
variableValue: JSON.stringify(error),
|
|
103
|
-
},
|
|
104
|
-
],
|
|
105
|
-
}),
|
|
106
|
-
saveNewScheduleFailure({
|
|
107
|
-
status: createZeniAPIStatus('Unexpected Error', `Save New Schedule REST API call errored out ${JSON.stringify(error)}`),
|
|
108
|
-
}),
|
|
109
|
-
])));
|
|
110
|
-
}));
|