@zeniai/client-epic-state 5.2.11-beta0ND → 5.2.11-betaRD2
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 +29 -27
- package/lib/entity/invoicing/invoicingCommonPayload.js +75 -37
- package/lib/entity/invoicing/product/productPayload.d.ts +0 -10
- package/lib/entity/invoicing/product/productPayload.js +2 -14
- package/lib/entity/jeSchedules/jeScheduleHelper.d.ts +1 -0
- package/lib/entity/jeSchedules/jeScheduleHelper.js +7 -0
- package/lib/entity/jeSchedules/jeSchedulesPayload.d.ts +66 -1
- package/lib/entity/jeSchedules/jeSchedulesPayload.js +135 -0
- package/lib/entity/jeSchedules/jeSchedulesReducer.d.ts +4 -2
- package/lib/entity/jeSchedules/jeSchedulesReducer.js +30 -2
- package/lib/entity/jeSchedules/jeSchedulesSelector.d.ts +11 -2
- package/lib/entity/jeSchedules/jeSchedulesSelector.js +38 -3
- package/lib/entity/jeSchedules/jeSchedulesState.d.ts +79 -1
- package/lib/entity/jeSchedules/jeSchedulesTypes.d.ts +24 -1
- package/lib/entity/jeSchedules/jeSchedulesTypes.js +88 -1
- package/lib/entity/snackbar/snackbarTypes.d.ts +1 -1
- package/lib/entity/snackbar/snackbarTypes.js +3 -0
- package/lib/entity/transaction/payloadTypes/scheduleTransactionPayload.d.ts +2 -0
- package/lib/entity/transaction/payloadTypes/scheduleTransactionPayload.js +2 -0
- package/lib/entity/transaction/stateTypes/scheduleTransaction.d.ts +2 -0
- package/lib/epic.d.ts +10 -3
- package/lib/epic.js +21 -12
- package/lib/esm/entity/invoicing/invoicingCommonPayload.js +73 -33
- package/lib/esm/entity/invoicing/product/productPayload.js +2 -14
- package/lib/esm/entity/jeSchedules/jeScheduleHelper.js +6 -0
- package/lib/esm/entity/jeSchedules/jeSchedulesPayload.js +135 -1
- package/lib/esm/entity/jeSchedules/jeSchedulesReducer.js +30 -2
- package/lib/esm/entity/jeSchedules/jeSchedulesSelector.js +36 -2
- package/lib/esm/entity/jeSchedules/jeSchedulesTypes.js +78 -0
- package/lib/esm/entity/snackbar/snackbarTypes.js +3 -0
- package/lib/esm/entity/transaction/payloadTypes/scheduleTransactionPayload.js +2 -0
- package/lib/esm/epic.js +17 -8
- package/lib/esm/index.js +20 -15
- package/lib/esm/view/expenseAutomationView/epics/common/fetchAllExpenseAutomationTabsEpic.js +6 -3
- package/lib/esm/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulePageEpic.js +9 -1
- package/lib/esm/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulesEpic.js +41 -5
- package/lib/esm/view/expenseAutomationView/epics/jeSchedule/fetchOneTimeAccrualEpic.js +45 -0
- package/lib/esm/view/expenseAutomationView/epics/jeSchedule/ignoreRecommendedJeScheduleEpic.js +14 -2
- package/lib/esm/view/expenseAutomationView/epics/jeSchedule/newSchedule/createOneTimeAccrualEpic.js +99 -0
- package/lib/esm/view/expenseAutomationView/epics/jeSchedule/newSchedule/initializeNewScheduleEpic.js +25 -0
- package/lib/esm/view/expenseAutomationView/epics/jeSchedule/newSchedule/saveNewScheduleEpic.js +110 -0
- package/lib/esm/view/expenseAutomationView/epics/jeSchedule/newSchedule/searchTransactionsForNewScheduleEpic.js +79 -0
- package/lib/esm/view/expenseAutomationView/epics/jeSchedule/oneTimeAccrualActionsEpic.js +139 -0
- package/lib/esm/view/expenseAutomationView/epics/jeSchedule/revertJeScheduleEpic.js +106 -0
- package/lib/esm/view/expenseAutomationView/epics/jeSchedule/switchJESchedulesTabEpic.js +22 -0
- package/lib/esm/view/expenseAutomationView/helpers/newScheduleLocalDataHelper.js +140 -0
- package/lib/esm/view/expenseAutomationView/payload/jeSchedulesPayload.js +55 -0
- package/lib/esm/view/expenseAutomationView/reducers/jeSchedulesViewReducer.js +311 -29
- package/lib/esm/view/expenseAutomationView/selectors/jeAccountSettingsViewSelector.js +1 -0
- package/lib/esm/view/expenseAutomationView/selectors/jeNewScheduleViewSelector.js +106 -0
- package/lib/esm/view/expenseAutomationView/selectors/jeSchedulesViewSelector.js +294 -22
- package/lib/esm/view/expenseAutomationView/types/jeSchedulesViewState.js +5 -6
- package/lib/esm/view/invoicing/editInvoicingCatalogItemDetailView/editInvoicingCatalogItemDetailViewPayload.js +9 -25
- package/lib/esm/view/invoicing/editInvoicingCatalogItemDetailView/saveInvoicingCatalogItemEpic.js +1 -6
- package/lib/esm/view/invoicing/invoicingQboView/invoicingQboViewSelector.js +0 -40
- package/lib/esm/view/invoicing/settingsView/settingsViewEpics.js +92 -0
- package/lib/esm/view/invoicing/settingsView/settingsViewReducer.js +1 -25
- package/lib/esm/view/invoicing/settingsView/settingsViewSelector.js +0 -41
- package/lib/esm/view/recommendation/recommendationReducer.js +1 -16
- package/lib/esm/view/scheduleView/scheduleListView/epics/fetchAccruedScheduleListEpic.js +1 -1
- package/lib/esm/view/scheduleView/scheduleListView/epics/fetchDownloadSchedulesEpic.js +7 -2
- package/lib/esm/view/scheduleView/scheduleListView/scheduleListReducer.js +5 -3
- package/lib/index.d.ts +24 -22
- package/lib/index.js +96 -60
- package/lib/view/expenseAutomationView/epics/common/fetchAllExpenseAutomationTabsEpic.js +6 -3
- package/lib/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulePageEpic.js +9 -1
- package/lib/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulesEpic.d.ts +3 -2
- package/lib/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulesEpic.js +39 -3
- package/lib/view/expenseAutomationView/epics/jeSchedule/fetchOneTimeAccrualEpic.d.ts +20 -0
- package/lib/view/expenseAutomationView/epics/jeSchedule/fetchOneTimeAccrualEpic.js +49 -0
- package/lib/view/expenseAutomationView/epics/jeSchedule/ignoreRecommendedJeScheduleEpic.js +14 -2
- package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/createOneTimeAccrualEpic.d.ts +8 -0
- package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/createOneTimeAccrualEpic.js +103 -0
- package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/initializeNewScheduleEpic.d.ts +8 -0
- package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/initializeNewScheduleEpic.js +29 -0
- package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/saveNewScheduleEpic.d.ts +45 -0
- package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/saveNewScheduleEpic.js +114 -0
- package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/searchTransactionsForNewScheduleEpic.d.ts +8 -0
- package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/searchTransactionsForNewScheduleEpic.js +83 -0
- package/lib/view/expenseAutomationView/epics/jeSchedule/oneTimeAccrualActionsEpic.d.ts +12 -0
- package/lib/view/expenseAutomationView/epics/jeSchedule/oneTimeAccrualActionsEpic.js +146 -0
- package/lib/view/expenseAutomationView/epics/jeSchedule/revertJeScheduleEpic.d.ts +64 -0
- package/lib/view/expenseAutomationView/epics/jeSchedule/revertJeScheduleEpic.js +110 -0
- package/lib/view/expenseAutomationView/epics/jeSchedule/switchJESchedulesTabEpic.d.ts +6 -0
- package/lib/view/expenseAutomationView/epics/jeSchedule/switchJESchedulesTabEpic.js +26 -0
- package/lib/view/expenseAutomationView/helpers/newScheduleLocalDataHelper.d.ts +36 -0
- package/lib/view/expenseAutomationView/helpers/newScheduleLocalDataHelper.js +145 -0
- package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.d.ts +1 -1
- package/lib/view/expenseAutomationView/payload/jeSchedulesPayload.d.ts +72 -3
- package/lib/view/expenseAutomationView/payload/jeSchedulesPayload.js +58 -1
- package/lib/view/expenseAutomationView/reducers/jeSchedulesViewReducer.d.ts +91 -12
- package/lib/view/expenseAutomationView/reducers/jeSchedulesViewReducer.js +313 -29
- 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/jeAccountSettingsViewSelectorTypes.d.ts +1 -0
- package/lib/view/expenseAutomationView/selectorTypes/jeNewScheduleViewSelectorTypes.d.ts +42 -0
- package/lib/view/expenseAutomationView/selectorTypes/jeSchedulesSelectorTypes.d.ts +36 -7
- package/lib/view/expenseAutomationView/selectors/jeAccountSettingsViewSelector.js +1 -0
- package/lib/view/expenseAutomationView/selectors/jeNewScheduleViewSelector.d.ts +21 -0
- package/lib/view/expenseAutomationView/selectors/jeNewScheduleViewSelector.js +112 -0
- package/lib/view/expenseAutomationView/selectors/jeSchedulesViewSelector.d.ts +34 -0
- package/lib/view/expenseAutomationView/selectors/jeSchedulesViewSelector.js +302 -21
- package/lib/view/expenseAutomationView/types/completedSubTab.d.ts +1 -1
- package/lib/view/expenseAutomationView/types/jeSchedulesViewState.d.ts +83 -8
- 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 +1 -12
- package/lib/view/invoicing/editInvoicingCatalogItemDetailView/editInvoicingCatalogItemDetailViewPayload.js +9 -25
- package/lib/view/invoicing/editInvoicingCatalogItemDetailView/saveInvoicingCatalogItemEpic.js +1 -6
- package/lib/view/invoicing/invoicingQboView/invoicingQboViewSelector.d.ts +1 -10
- package/lib/view/invoicing/invoicingQboView/invoicingQboViewSelector.js +1 -43
- package/lib/view/invoicing/settingsView/settingsViewEpics.d.ts +12 -0
- package/lib/view/invoicing/settingsView/settingsViewEpics.js +99 -0
- package/lib/view/invoicing/settingsView/settingsViewReducer.d.ts +1 -4
- package/lib/view/invoicing/settingsView/settingsViewReducer.js +2 -26
- package/lib/view/invoicing/settingsView/settingsViewSelector.d.ts +0 -35
- package/lib/view/invoicing/settingsView/settingsViewSelector.js +1 -43
- package/lib/view/invoicing/settingsView/settingsViewState.d.ts +0 -8
- package/lib/view/recommendation/recommendationPayload.d.ts +0 -34
- package/lib/view/recommendation/recommendationReducer.d.ts +1 -2
- package/lib/view/recommendation/recommendationReducer.js +2 -17
- package/lib/view/scheduleView/scheduleListView/epics/fetchAccruedScheduleListEpic.js +1 -1
- package/lib/view/scheduleView/scheduleListView/epics/fetchDownloadSchedulesEpic.js +7 -2
- package/lib/view/scheduleView/scheduleListView/scheduleListReducer.d.ts +4 -2
- package/lib/view/scheduleView/scheduleListView/scheduleListReducer.js +5 -3
- package/package.json +1 -1
- package/lib/esm/view/invoicing/settingsView/epics/connectInvoicingStripeEpic.js +0 -27
- package/lib/esm/view/invoicing/settingsView/epics/disconnectInvoicingStripeEpic.js +0 -19
- package/lib/esm/view/invoicing/settingsView/epics/fetchInvoicingSettingsEpic.js +0 -19
- package/lib/esm/view/invoicing/settingsView/epics/saveInvoicingSettingsEpic.js +0 -39
- package/lib/esm/view/invoicing/settingsView/epics/submitInvoicingQboSettingsEpic.js +0 -25
- package/lib/esm/view/invoicing/settingsView/invoicingQboSettingsFormConfig.js +0 -48
- package/lib/esm/view/recommendation/submitRecommendationFeedbackEpic.js +0 -52
- package/lib/view/invoicing/settingsView/epics/connectInvoicingStripeEpic.d.ts +0 -6
- package/lib/view/invoicing/settingsView/epics/connectInvoicingStripeEpic.js +0 -31
- package/lib/view/invoicing/settingsView/epics/disconnectInvoicingStripeEpic.d.ts +0 -6
- package/lib/view/invoicing/settingsView/epics/disconnectInvoicingStripeEpic.js +0 -23
- package/lib/view/invoicing/settingsView/epics/fetchInvoicingSettingsEpic.d.ts +0 -6
- package/lib/view/invoicing/settingsView/epics/fetchInvoicingSettingsEpic.js +0 -23
- package/lib/view/invoicing/settingsView/epics/saveInvoicingSettingsEpic.d.ts +0 -6
- package/lib/view/invoicing/settingsView/epics/saveInvoicingSettingsEpic.js +0 -43
- package/lib/view/invoicing/settingsView/epics/settingsViewActionType.d.ts +0 -5
- package/lib/view/invoicing/settingsView/epics/submitInvoicingQboSettingsEpic.d.ts +0 -11
- package/lib/view/invoicing/settingsView/epics/submitInvoicingQboSettingsEpic.js +0 -29
- package/lib/view/invoicing/settingsView/invoicingQboSettingsFormConfig.d.ts +0 -34
- package/lib/view/invoicing/settingsView/invoicingQboSettingsFormConfig.js +0 -53
- package/lib/view/recommendation/submitRecommendationFeedbackEpic.d.ts +0 -7
- package/lib/view/recommendation/submitRecommendationFeedbackEpic.js +0 -56
- /package/lib/esm/view/{invoicing/settingsView/epics/settingsViewActionType.js → expenseAutomationView/selectorTypes/jeNewScheduleViewSelectorTypes.js} +0 -0
- /package/lib/view/{invoicing/settingsView/epics/settingsViewActionType.js → expenseAutomationView/selectorTypes/jeNewScheduleViewSelectorTypes.js} +0 -0
|
@@ -1,12 +1,8 @@
|
|
|
1
|
-
import { NestedAccountHierarchyForReport } from '../../../commonStateTypes/accountView/nestedAccountID';
|
|
2
1
|
import { FetchState, FetchStateAndError } from '../../../commonStateTypes/common';
|
|
3
2
|
import { InvoicingDunningActionOption, InvoicingNamedOption, InvoicingQboAccountMappingKindOption, InvoicingSettingsPayload } from '../../../entity/invoicing/invoicingCommonPayload';
|
|
4
3
|
import { ZeniAPIStatus } from '../../../responsePayload';
|
|
5
4
|
import { RootState } from '../../../rootStateTypes';
|
|
6
|
-
import { InvoicingQboConnection, InvoicingQboSyncHealth } from '../invoicingQboView/invoicingQboViewPayload';
|
|
7
|
-
import { InvoicingAccountingOption } from '../invoicingQboView/invoicingQboViewSelector';
|
|
8
5
|
import { InvoicingBrandingFormLocalData } from './invoicingBrandingFormConfig';
|
|
9
|
-
import { InvoicingQboSettingsLocalData } from './invoicingQboSettingsFormConfig';
|
|
10
6
|
/**
|
|
11
7
|
* Shared primitive: the raw invoicing settings. Consumed internally by other
|
|
12
8
|
* CES selectors (create-invoice, customer-detail, overview) and by non-settings
|
|
@@ -87,37 +83,6 @@ export interface InvoicingSettingsHubView {
|
|
|
87
83
|
* and QBO slices read here are only fetched once a settings screen is mounted.
|
|
88
84
|
*/
|
|
89
85
|
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;
|
|
121
86
|
export interface InvoicingBrandingFormView {
|
|
122
87
|
dateFormatOptions: InvoicingNamedOption[];
|
|
123
88
|
localData: InvoicingBrandingFormLocalData;
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getInvoicingBrandingFormView = exports.
|
|
3
|
+
exports.getInvoicingBrandingFormView = 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");
|
|
9
8
|
const invoicingBrandingFormConfig_1 = require("./invoicingBrandingFormConfig");
|
|
10
|
-
const invoicingQboSettingsFormConfig_1 = require("./invoicingQboSettingsFormConfig");
|
|
11
9
|
/**
|
|
12
10
|
* Shared primitive: the raw invoicing settings. Consumed internally by other
|
|
13
11
|
* CES selectors (create-invoice, customer-detail, overview) and by non-settings
|
|
@@ -102,46 +100,6 @@ const getInvoicingSettingsHubView = (state) => {
|
|
|
102
100
|
};
|
|
103
101
|
};
|
|
104
102
|
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;
|
|
145
103
|
/**
|
|
146
104
|
* Bundled view for the branding settings form: the draft `localData` (seeded
|
|
147
105
|
* from the existing settings until the user edits), the business-address label
|
|
@@ -1,17 +1,9 @@
|
|
|
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';
|
|
5
4
|
export interface InvoicingSettingsViewState extends FetchedState {
|
|
6
5
|
saveFetchState: FetchStateAndError;
|
|
7
6
|
stripeFetchState: FetchStateAndError;
|
|
8
7
|
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;
|
|
16
8
|
settings?: InvoicingSettingsPayload;
|
|
17
9
|
}
|
|
@@ -12,38 +12,4 @@ interface FetchRecommendationPayloadWithCOT {
|
|
|
12
12
|
recommendations: RecommendationPayloadWithCOT[];
|
|
13
13
|
}
|
|
14
14
|
export type FetchRecommendationResponseWithCOT = ZeniAPIResponse<FetchRecommendationPayloadWithCOT>;
|
|
15
|
-
export type RecommendationFeedbackDimension = 'vendor' | 'category' | 'class';
|
|
16
|
-
export type RecommendationFeedbackSource = 'primary' | 'alternate' | 'shadow' | 'qbo';
|
|
17
|
-
export type RecommendationFeedbackOutcome = 'accepted' | 'override_ranked' | 'override_outside' | 'retracted';
|
|
18
|
-
export interface RecommendationFeedbackValue {
|
|
19
|
-
name: string;
|
|
20
|
-
id?: string | null;
|
|
21
|
-
integrationId?: string | null;
|
|
22
|
-
}
|
|
23
|
-
export interface ShownRecommendationForFeedback {
|
|
24
|
-
rank: number;
|
|
25
|
-
source: RecommendationFeedbackSource;
|
|
26
|
-
value: RecommendationFeedbackValue;
|
|
27
|
-
confidence?: number | null;
|
|
28
|
-
cot?: string[];
|
|
29
|
-
reasoning?: string | null;
|
|
30
|
-
}
|
|
31
|
-
export interface SubmitRecommendationFeedbackPayload {
|
|
32
|
-
dimension: RecommendationFeedbackDimension;
|
|
33
|
-
outcome: RecommendationFeedbackOutcome;
|
|
34
|
-
selected: RecommendationFeedbackValue & {
|
|
35
|
-
isNewEntity?: boolean;
|
|
36
|
-
};
|
|
37
|
-
transactionId: string;
|
|
38
|
-
features?: Record<string, unknown> | null;
|
|
39
|
-
lineId?: string | null;
|
|
40
|
-
matchedRank?: number | null;
|
|
41
|
-
matchedSource?: RecommendationFeedbackSource | null;
|
|
42
|
-
reasonText?: string | null;
|
|
43
|
-
recommendationSetId?: string | null;
|
|
44
|
-
retractsFeedbackId?: string | null;
|
|
45
|
-
shownRecommendations?: ShownRecommendationForFeedback[];
|
|
46
|
-
skipped?: boolean;
|
|
47
|
-
topPickSource?: RecommendationFeedbackSource | null;
|
|
48
|
-
}
|
|
49
15
|
export {};
|
|
@@ -5,7 +5,6 @@ import { TransactionID } from '../../entity/transaction/stateTypes/transactionID
|
|
|
5
5
|
import { SupportedTransaction } from '../../entity/transaction/transactionState';
|
|
6
6
|
import { ZeniAPIStatus } from '../../responsePayload';
|
|
7
7
|
import { TransactionsTab } from '../expenseAutomationView/types/transactionsViewState';
|
|
8
|
-
import { SubmitRecommendationFeedbackPayload } from './recommendationPayload';
|
|
9
8
|
import { EntityRecommendationState } from './recommendationState';
|
|
10
9
|
export type RecommendationLineUpdateFlowType = 'categorization' | 'detail';
|
|
11
10
|
type FetchEntityRecommendationsForLineUpdateCommonPayload = {
|
|
@@ -58,6 +57,6 @@ export declare const fetchEntityRecommendationsByTransactionId: import("@reduxjs
|
|
|
58
57
|
}, "recommendation/updateRecommendationForEntityFailure">, indicateReadyToInitializeRecommendation: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[entityIdOrName: string, entityType: EntityType], {
|
|
59
58
|
entityIdOrName: string;
|
|
60
59
|
entityType: EntityType;
|
|
61
|
-
}, "recommendation/indicateReadyToInitializeRecommendation", never, never
|
|
60
|
+
}, "recommendation/indicateReadyToInitializeRecommendation", never, never>;
|
|
62
61
|
declare const _default: import("redux").Reducer<EntityRecommendationState>;
|
|
63
62
|
export default _default;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var _a;
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.
|
|
4
|
+
exports.indicateReadyToInitializeRecommendation = exports.updateRecommendationForEntityFailure = exports.updateRecommendationForEntity = exports.fetchRecommendationByEntityId = exports.fetchRecommendationByEntityName = exports.fetchEntityRecommendationsForLineUpdate = exports.fetchEntityRecommendationsByTransactionId = exports.initialState = void 0;
|
|
5
5
|
const toolkit_1 = require("@reduxjs/toolkit");
|
|
6
6
|
const rootActions_1 = require("../../rootActions");
|
|
7
7
|
const recommendationState_1 = require("./recommendationState");
|
|
@@ -135,21 +135,6 @@ const recommendation = (0, toolkit_1.createSlice)({
|
|
|
135
135
|
};
|
|
136
136
|
},
|
|
137
137
|
},
|
|
138
|
-
clearRecommendation(draft) {
|
|
139
|
-
Object.assign(draft, exports.initialState);
|
|
140
|
-
},
|
|
141
|
-
// Fire-and-forget human feedback on a recommendation (accept, ranked
|
|
142
|
-
// override or outside override). Handled by submitRecommendationFeedbackEpic
|
|
143
|
-
// which POSTs to the accounting recommendation-feedback endpoint. No state
|
|
144
|
-
// mutation: the categorization UX must not depend on the feedback round-trip.
|
|
145
|
-
submitRecommendationFeedback: {
|
|
146
|
-
reducer() {
|
|
147
|
-
// Fire-and-forget: no state mutation; the epic performs the POST.
|
|
148
|
-
},
|
|
149
|
-
prepare(args) {
|
|
150
|
-
return { payload: args };
|
|
151
|
-
},
|
|
152
|
-
},
|
|
153
138
|
},
|
|
154
139
|
extraReducers: (builder) => {
|
|
155
140
|
builder.addCase(rootActions_1.clearAll, (draft) => {
|
|
@@ -157,7 +142,7 @@ const recommendation = (0, toolkit_1.createSlice)({
|
|
|
157
142
|
});
|
|
158
143
|
},
|
|
159
144
|
});
|
|
160
|
-
_a = recommendation.actions, exports.fetchEntityRecommendationsByTransactionId = _a.fetchEntityRecommendationsByTransactionId, exports.fetchEntityRecommendationsForLineUpdate = _a.fetchEntityRecommendationsForLineUpdate, exports.fetchRecommendationByEntityName = _a.fetchRecommendationByEntityName, exports.fetchRecommendationByEntityId = _a.fetchRecommendationByEntityId, exports.updateRecommendationForEntity = _a.updateRecommendationForEntity, exports.updateRecommendationForEntityFailure = _a.updateRecommendationForEntityFailure, exports.indicateReadyToInitializeRecommendation = _a.indicateReadyToInitializeRecommendation
|
|
145
|
+
_a = recommendation.actions, exports.fetchEntityRecommendationsByTransactionId = _a.fetchEntityRecommendationsByTransactionId, exports.fetchEntityRecommendationsForLineUpdate = _a.fetchEntityRecommendationsForLineUpdate, exports.fetchRecommendationByEntityName = _a.fetchRecommendationByEntityName, exports.fetchRecommendationByEntityId = _a.fetchRecommendationByEntityId, exports.updateRecommendationForEntity = _a.updateRecommendationForEntity, exports.updateRecommendationForEntityFailure = _a.updateRecommendationForEntityFailure, exports.indicateReadyToInitializeRecommendation = _a.indicateReadyToInitializeRecommendation;
|
|
161
146
|
exports.default = recommendation.reducer;
|
|
162
147
|
const doUpdateRecommendationForEntity = (draft, entityId, entityType, payload) => {
|
|
163
148
|
const key = (0, recommendationState_1.getEntityRecommendationKey)(entityType, entityId);
|
|
@@ -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: action.payload.statusFilter,
|
|
37
37
|
};
|
|
38
38
|
return zeniAPI
|
|
39
39
|
.getJSON(`${zeniAPI.apiEndPoints.accountMicroServiceBaseUrl}/1.0/schedules?query=${encodeURIComponent(JSON.stringify(queryParam))}`)
|
|
@@ -10,9 +10,14 @@ 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 } = action.payload;
|
|
13
|
+
const { scheduleType, downloadCategories, statusFilter } = 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.
|
|
16
21
|
let scheduleState;
|
|
17
22
|
if (scheduleType !== 'accrued_expenses') {
|
|
18
23
|
scheduleState = (0, scheduleListReducer_1.getState)(scheduleListState, scheduleType);
|
|
@@ -37,7 +42,7 @@ const fetchDownloadSchedulesEpic = (actions$, state$, zeniAPI) => actions$.pipe(
|
|
|
37
42
|
base_txn_account_ids: downloadCategories,
|
|
38
43
|
sort_by: 'transaction_date',
|
|
39
44
|
sort_order: 'desc',
|
|
40
|
-
filter:
|
|
45
|
+
filter: statusFilter,
|
|
41
46
|
};
|
|
42
47
|
return zeniAPI
|
|
43
48
|
.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[], cacheOverride?: any], {
|
|
19
|
+
}, downloadCategories: string[], statusFilter?: "completed" | "new" | "ongoing" | "all" | undefined, cacheOverride?: any], {
|
|
20
20
|
timeframeAndCategory: {
|
|
21
21
|
selectedCategoryId: ID;
|
|
22
22
|
selectedTimeframe: TimeframeTick;
|
|
@@ -24,16 +24,18 @@ 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";
|
|
27
28
|
}, "scheduleListView/fetchDownloadSchedules", never, never>, fetchAccruedScheduleList: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[scheduleType: "prepaid_expenses" | "fixed_assets" | "accrued_expenses" | "deferred_revenue", timeframeAndCategory?: {
|
|
28
29
|
selectedCategoryId: ID;
|
|
29
30
|
selectedTimeframe: TimeframeTick;
|
|
30
|
-
} | undefined, cacheOverride?: any], {
|
|
31
|
+
} | undefined, cacheOverride?: any, statusFilter?: "completed" | "new" | "ongoing" | "all" | undefined], {
|
|
31
32
|
timeframeAndCategory: {
|
|
32
33
|
selectedCategoryId: ID;
|
|
33
34
|
selectedTimeframe: TimeframeTick;
|
|
34
35
|
} | undefined;
|
|
35
36
|
scheduleType: "prepaid_expenses" | "fixed_assets" | "accrued_expenses" | "deferred_revenue";
|
|
36
37
|
cacheOverride: any;
|
|
38
|
+
statusFilter: "completed" | "new" | "ongoing" | "all";
|
|
37
39
|
}, "scheduleListView/fetchAccruedScheduleList", never, never>, fetchScheduleList: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[scheduleType: "prepaid_expenses" | "fixed_assets" | "accrued_expenses" | "deferred_revenue", timeframeAndCategory?: {
|
|
38
40
|
selectedCategoryId: ID;
|
|
39
41
|
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.
|
|
93
94
|
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,13 +115,14 @@ const scheduleListView = (0, toolkit_1.createSlice)({
|
|
|
115
115
|
updateState(draft, action.payload.scheduleType, state);
|
|
116
116
|
}
|
|
117
117
|
},
|
|
118
|
-
prepare(scheduleType, timeframeAndCategory, downloadCategories, cacheOverride = false) {
|
|
118
|
+
prepare(scheduleType, timeframeAndCategory, downloadCategories, statusFilter = 'all', cacheOverride = false) {
|
|
119
119
|
return {
|
|
120
120
|
payload: {
|
|
121
121
|
timeframeAndCategory,
|
|
122
122
|
scheduleType,
|
|
123
123
|
cacheOverride,
|
|
124
124
|
downloadCategories,
|
|
125
|
+
statusFilter,
|
|
125
126
|
},
|
|
126
127
|
};
|
|
127
128
|
},
|
|
@@ -157,12 +158,13 @@ const scheduleListView = (0, toolkit_1.createSlice)({
|
|
|
157
158
|
updateState(draft, action.payload.scheduleType, state);
|
|
158
159
|
}
|
|
159
160
|
},
|
|
160
|
-
prepare(scheduleType, timeframeAndCategory, cacheOverride = false) {
|
|
161
|
+
prepare(scheduleType, timeframeAndCategory, cacheOverride = false, statusFilter = 'all') {
|
|
161
162
|
return {
|
|
162
163
|
payload: {
|
|
163
164
|
timeframeAndCategory,
|
|
164
165
|
scheduleType,
|
|
165
166
|
cacheOverride,
|
|
167
|
+
statusFilter,
|
|
166
168
|
},
|
|
167
169
|
};
|
|
168
170
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zeniai/client-epic-state",
|
|
3
|
-
"version": "5.2.11-
|
|
3
|
+
"version": "5.2.11-betaRD2",
|
|
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",
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { of } from 'rxjs';
|
|
2
|
-
import { catchError, filter, mergeMap, switchMap } from 'rxjs/operators';
|
|
3
|
-
import { createZeniAPIStatus, isSuccessResponse, } from '../../../../responsePayload';
|
|
4
|
-
import { connectInvoicingStripe, fetchInvoicingSettings, invoicingStripeConnectionFailure, updateInvoicingStripeConnection, } from '../settingsViewReducer';
|
|
5
|
-
export const connectInvoicingStripeEpic = (actions$, _state$, zeniAPI) => actions$.pipe(filter(connectInvoicingStripe.match), mergeMap((action) => {
|
|
6
|
-
const apiUrl = `${zeniAPI.apiEndPoints.invoicingMicroServiceBaseUrl}/1.0/settings/stripe-connect/setup`;
|
|
7
|
-
const { api_key, publishable_key, webhook_secret } = action.payload;
|
|
8
|
-
const body = {
|
|
9
|
-
api_key,
|
|
10
|
-
publishable_key,
|
|
11
|
-
...(webhook_secret != null && webhook_secret !== ''
|
|
12
|
-
? { webhook_secret }
|
|
13
|
-
: {}),
|
|
14
|
-
};
|
|
15
|
-
return zeniAPI
|
|
16
|
-
.postAndGetJSON(apiUrl, body)
|
|
17
|
-
.pipe(switchMap((response) => {
|
|
18
|
-
if (isSuccessResponse(response) && response.data != null) {
|
|
19
|
-
return of(updateInvoicingStripeConnection({
|
|
20
|
-
stripe_connected: response.data.stripe_connected,
|
|
21
|
-
publishable_key: response.data.publishable_key,
|
|
22
|
-
}), fetchInvoicingSettings());
|
|
23
|
-
}
|
|
24
|
-
return of(invoicingStripeConnectionFailure(response.status));
|
|
25
|
-
}), catchError((error) => of(invoicingStripeConnectionFailure(createZeniAPIStatus('Unexpected Error', 'Stripe connect setup REST API call errored out ' +
|
|
26
|
-
JSON.stringify(error))))));
|
|
27
|
-
}));
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { of } from 'rxjs';
|
|
2
|
-
import { catchError, filter, mergeMap, switchMap } from 'rxjs/operators';
|
|
3
|
-
import { createZeniAPIStatus, isSuccessResponse, } from '../../../../responsePayload';
|
|
4
|
-
import { disconnectInvoicingStripe, fetchInvoicingSettings, invoicingStripeConnectionFailure, updateInvoicingStripeConnection, } from '../settingsViewReducer';
|
|
5
|
-
export const disconnectInvoicingStripeEpic = (actions$, _state$, zeniAPI) => actions$.pipe(filter(disconnectInvoicingStripe.match), mergeMap(() => {
|
|
6
|
-
const apiUrl = `${zeniAPI.apiEndPoints.invoicingMicroServiceBaseUrl}/1.0/settings/stripe-connect/callback`;
|
|
7
|
-
return zeniAPI
|
|
8
|
-
.deleteAndGetJSON(apiUrl)
|
|
9
|
-
.pipe(switchMap((response) => {
|
|
10
|
-
if (isSuccessResponse(response)) {
|
|
11
|
-
return of(updateInvoicingStripeConnection({
|
|
12
|
-
stripe_connected: false,
|
|
13
|
-
publishable_key: '',
|
|
14
|
-
}), fetchInvoicingSettings());
|
|
15
|
-
}
|
|
16
|
-
return of(invoicingStripeConnectionFailure(response.status));
|
|
17
|
-
}), catchError((error) => of(invoicingStripeConnectionFailure(createZeniAPIStatus('Unexpected Error', 'Stripe disconnect REST API call errored out ' +
|
|
18
|
-
JSON.stringify(error))))));
|
|
19
|
-
}));
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { of } from 'rxjs';
|
|
2
|
-
import { catchError, filter, switchMap } from 'rxjs/operators';
|
|
3
|
-
import { updateAddresses } from '../../../../entity/address/addressReducer';
|
|
4
|
-
import { createZeniAPIStatus, isSuccessResponse, } from '../../../../responsePayload';
|
|
5
|
-
import { fetchInvoicingSettings, updateInvoicingSettings, updateInvoicingSettingsFailure, } from '../settingsViewReducer';
|
|
6
|
-
export const fetchInvoicingSettingsEpic = (actions$, _state$, zeniAPI) => actions$.pipe(filter(fetchInvoicingSettings.match), switchMap(() => {
|
|
7
|
-
const apiUrl = `${zeniAPI.apiEndPoints.invoicingMicroServiceBaseUrl}/1.0/settings`;
|
|
8
|
-
return zeniAPI.getJSON(apiUrl).pipe(switchMap((response) => {
|
|
9
|
-
if (isSuccessResponse(response) && response.data != null) {
|
|
10
|
-
const address = response.data.address;
|
|
11
|
-
return [
|
|
12
|
-
...(address != null ? [updateAddresses([address])] : []),
|
|
13
|
-
updateInvoicingSettings(response.data),
|
|
14
|
-
];
|
|
15
|
-
}
|
|
16
|
-
return of(updateInvoicingSettingsFailure(response.status));
|
|
17
|
-
}), catchError((error) => of(updateInvoicingSettingsFailure(createZeniAPIStatus('Unexpected Error', 'Fetch settings REST API call errored out ' +
|
|
18
|
-
JSON.stringify(error))))));
|
|
19
|
-
}));
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { from } from 'rxjs';
|
|
2
|
-
import { catchError, filter, mergeMap, switchMap } from 'rxjs/operators';
|
|
3
|
-
import { apiErrorSnackbarVariables } from '../../../../entity/snackbar/snackbarApiError';
|
|
4
|
-
import { openSnackbar } from '../../../../entity/snackbar/snackbarReducer';
|
|
5
|
-
import { createZeniAPIStatus, isSuccessResponse, } from '../../../../responsePayload';
|
|
6
|
-
import { saveInvoicingSettings, saveInvoicingSettingsFailure, saveInvoicingSettingsSuccess, } from '../settingsViewReducer';
|
|
7
|
-
export const saveInvoicingSettingsEpic = (actions$, _state$, zeniAPI) => actions$.pipe(filter(saveInvoicingSettings.match), mergeMap((action) => {
|
|
8
|
-
const apiUrl = `${zeniAPI.apiEndPoints.invoicingMicroServiceBaseUrl}/1.0/settings`;
|
|
9
|
-
const { settings, snackbarSection } = action.payload;
|
|
10
|
-
/** `status` surfaces the platform's error text; omit it to keep the generic copy. */
|
|
11
|
-
const snackbar = (messageText, status) => snackbarSection == null
|
|
12
|
-
? []
|
|
13
|
-
: [
|
|
14
|
-
openSnackbar({
|
|
15
|
-
messageSection: snackbarSection,
|
|
16
|
-
messageText,
|
|
17
|
-
type: messageText === 'success' ? 'success' : 'error',
|
|
18
|
-
variables: apiErrorSnackbarVariables(status),
|
|
19
|
-
}),
|
|
20
|
-
];
|
|
21
|
-
return zeniAPI
|
|
22
|
-
.putAndGetJSON(apiUrl, { ...settings })
|
|
23
|
-
.pipe(switchMap((response) => {
|
|
24
|
-
if (isSuccessResponse(response) && response.data != null) {
|
|
25
|
-
return from([
|
|
26
|
-
saveInvoicingSettingsSuccess(response.data),
|
|
27
|
-
...snackbar('success'),
|
|
28
|
-
]);
|
|
29
|
-
}
|
|
30
|
-
return from([
|
|
31
|
-
saveInvoicingSettingsFailure(response.status),
|
|
32
|
-
...snackbar('failed', response.status),
|
|
33
|
-
]);
|
|
34
|
-
}), catchError((error) => from([
|
|
35
|
-
saveInvoicingSettingsFailure(createZeniAPIStatus('Unexpected Error', 'Save settings REST API call errored out ' +
|
|
36
|
-
JSON.stringify(error))),
|
|
37
|
-
...snackbar('failed'),
|
|
38
|
-
])));
|
|
39
|
-
}));
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { EMPTY, of } from 'rxjs';
|
|
2
|
-
import { filter, mergeMap, withLatestFrom } from 'rxjs/operators';
|
|
3
|
-
import { invoicingQboAccountByQboId } from '../../invoicingQboView/invoicingQboViewSelector';
|
|
4
|
-
import { invoicingQboSettingsLocalDataToPayload } from '../invoicingQboSettingsFormConfig';
|
|
5
|
-
import { saveInvoicingSettings, submitInvoicingQboSettings, } from '../settingsViewReducer';
|
|
6
|
-
/**
|
|
7
|
-
* Saves the QBO local data. The screen fires this without a payload — the local
|
|
8
|
-
* data is already in the store, so sending it back through the action would make
|
|
9
|
-
* the page the carrier for state it does not own. Converting to the request body
|
|
10
|
-
* happens here too, keeping the wire shape out of the screen.
|
|
11
|
-
*/
|
|
12
|
-
export const submitInvoicingQboSettingsEpic = (actions$, state$) => actions$.pipe(filter(submitInvoicingQboSettings.match), withLatestFrom(state$), mergeMap(([, state]) => {
|
|
13
|
-
const { qboDraft } = state.invoicingSettingsViewState;
|
|
14
|
-
// No local data means the settings response has not landed, so there is
|
|
15
|
-
// nothing the user could have edited yet.
|
|
16
|
-
if (qboDraft == null) {
|
|
17
|
-
return EMPTY;
|
|
18
|
-
}
|
|
19
|
-
return of(saveInvoicingSettings({
|
|
20
|
-
settings: {
|
|
21
|
-
qbo: invoicingQboSettingsLocalDataToPayload(qboDraft, (accountId) => invoicingQboAccountByQboId(state, accountId)),
|
|
22
|
-
},
|
|
23
|
-
snackbarSection: 'invoicing_qbo_settings_save',
|
|
24
|
-
}));
|
|
25
|
-
}));
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import { getInvoicingQboAccountMappingId, toInvoicingQboAccountMappingSlot, toInvoicingQboAccountMappingsPayload, } from '../../../entity/invoicing/invoicingCommonPayload';
|
|
2
|
-
export const initialInvoicingQboSettingsLocalData = {
|
|
3
|
-
accountIdByMappingCode: {},
|
|
4
|
-
autoCreateItems: false,
|
|
5
|
-
closedPeriodVoidAsCreditMemo: false,
|
|
6
|
-
customerMatching: '',
|
|
7
|
-
isSyncEnabled: false,
|
|
8
|
-
syncStartDate: '',
|
|
9
|
-
trackingCategoriesEnabled: false,
|
|
10
|
-
};
|
|
11
|
-
/** The settings response as the page edits it. */
|
|
12
|
-
export const entityToInvoicingQboSettingsLocalData = (qbo) => {
|
|
13
|
-
const accountMappings = qbo?.account_mappings ?? {};
|
|
14
|
-
const accountIdByMappingCode = {};
|
|
15
|
-
// Keyed by the slot the payload used, which is the config code the page will
|
|
16
|
-
// ask for — the reader tolerates the older `_id` form on the way in.
|
|
17
|
-
Object.keys(accountMappings).forEach((key) => {
|
|
18
|
-
const accountId = getInvoicingQboAccountMappingId(accountMappings, key);
|
|
19
|
-
if (accountId != null) {
|
|
20
|
-
accountIdByMappingCode[toInvoicingQboAccountMappingSlot(key)] = accountId;
|
|
21
|
-
}
|
|
22
|
-
});
|
|
23
|
-
return {
|
|
24
|
-
accountIdByMappingCode,
|
|
25
|
-
autoCreateItems: qbo?.auto_create_items === true,
|
|
26
|
-
closedPeriodVoidAsCreditMemo: qbo?.closed_period_void_as_credit_memo === true,
|
|
27
|
-
customerMatching: qbo?.customer_matching ?? '',
|
|
28
|
-
isSyncEnabled: qbo?.enabled === true,
|
|
29
|
-
syncStartDate: qbo?.sync_start_date ?? '',
|
|
30
|
-
trackingCategoriesEnabled: qbo?.tracking_categories_enabled === true,
|
|
31
|
-
};
|
|
32
|
-
};
|
|
33
|
-
/**
|
|
34
|
-
* The local data as the request body. `accountForId` turns each picked id into
|
|
35
|
-
* the whole account the service stores; it comes from the epic, which is where
|
|
36
|
-
* the account list is in reach.
|
|
37
|
-
*/
|
|
38
|
-
export const invoicingQboSettingsLocalDataToPayload = (localData, accountForId) => {
|
|
39
|
-
return {
|
|
40
|
-
account_mappings: toInvoicingQboAccountMappingsPayload(localData.accountIdByMappingCode, accountForId),
|
|
41
|
-
auto_create_items: localData.autoCreateItems,
|
|
42
|
-
closed_period_void_as_credit_memo: localData.closedPeriodVoidAsCreditMemo,
|
|
43
|
-
customer_matching: localData.customerMatching,
|
|
44
|
-
enabled: localData.isSyncEnabled,
|
|
45
|
-
sync_start_date: localData.syncStartDate !== '' ? localData.syncStartDate : null,
|
|
46
|
-
tracking_categories_enabled: localData.trackingCategoriesEnabled,
|
|
47
|
-
};
|
|
48
|
-
};
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import { EMPTY } from 'rxjs';
|
|
2
|
-
import { catchError, filter, mergeMap } from 'rxjs/operators';
|
|
3
|
-
import { isSuccessStatus } from '../../responsePayload';
|
|
4
|
-
import { submitRecommendationFeedback } from './recommendationReducer';
|
|
5
|
-
const toRequestBody = (payload) => ({
|
|
6
|
-
line_id: payload.lineId ?? null,
|
|
7
|
-
dimension: payload.dimension,
|
|
8
|
-
recommendation_set_id: payload.recommendationSetId ?? null,
|
|
9
|
-
top_pick_source: payload.topPickSource ?? null,
|
|
10
|
-
shown_recommendations: (payload.shownRecommendations ?? []).map((recommendation) => ({
|
|
11
|
-
source: recommendation.source,
|
|
12
|
-
rank: recommendation.rank,
|
|
13
|
-
value: {
|
|
14
|
-
name: recommendation.value.name,
|
|
15
|
-
id: recommendation.value.id ?? null,
|
|
16
|
-
integration_id: recommendation.value.integrationId ?? null,
|
|
17
|
-
},
|
|
18
|
-
confidence: recommendation.confidence ?? null,
|
|
19
|
-
reasoning: recommendation.reasoning ?? null,
|
|
20
|
-
cot: recommendation.cot ?? [],
|
|
21
|
-
})),
|
|
22
|
-
selected: {
|
|
23
|
-
name: payload.selected.name,
|
|
24
|
-
id: payload.selected.id ?? null,
|
|
25
|
-
integration_id: payload.selected.integrationId ?? null,
|
|
26
|
-
is_new_entity: payload.selected.isNewEntity ?? false,
|
|
27
|
-
},
|
|
28
|
-
matched_source: payload.matchedSource ?? null,
|
|
29
|
-
matched_rank: payload.matchedRank ?? null,
|
|
30
|
-
outcome: payload.outcome,
|
|
31
|
-
reason_text: payload.reasonText ?? null,
|
|
32
|
-
skipped: payload.skipped ?? false,
|
|
33
|
-
retracts_feedback_id: payload.retractsFeedbackId ?? null,
|
|
34
|
-
features: payload.features ?? null,
|
|
35
|
-
});
|
|
36
|
-
// Fire-and-forget: the epic never re-emits an action. Feedback delivery is a
|
|
37
|
-
// side-effect that must not disrupt the categorization UX, so both the
|
|
38
|
-
// success and error paths complete silently (errors are logged for debugging).
|
|
39
|
-
export const submitRecommendationFeedbackEpic = (actions$, _state$, zeniAPI) => actions$.pipe(filter(submitRecommendationFeedback.match), mergeMap((action) => {
|
|
40
|
-
const { transactionId } = action.payload;
|
|
41
|
-
return zeniAPI
|
|
42
|
-
.postAndGetJSON(`${zeniAPI.apiEndPoints.accountMicroServiceBaseUrl}/1.0/transactions/${transactionId}/recommendation-feedback`, toRequestBody(action.payload))
|
|
43
|
-
.pipe(mergeMap((response) => {
|
|
44
|
-
if (!isSuccessStatus(response)) {
|
|
45
|
-
console.error('submitRecommendationFeedbackEpic: recommendation feedback was not recorded', response.status);
|
|
46
|
-
}
|
|
47
|
-
return EMPTY;
|
|
48
|
-
}), catchError((error) => {
|
|
49
|
-
console.error('submitRecommendationFeedbackEpic: failed to submit recommendation feedback', error);
|
|
50
|
-
return EMPTY;
|
|
51
|
-
}));
|
|
52
|
-
}));
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { ActionsObservable, StateObservable } from 'redux-observable';
|
|
2
|
-
import { Observable } from 'rxjs';
|
|
3
|
-
import { RootState } from '../../../../rootStateTypes';
|
|
4
|
-
import { ZeniAPI } from '../../../../zeniAPI';
|
|
5
|
-
import { InvoicingSettingsViewActionType } from './settingsViewActionType';
|
|
6
|
-
export declare const connectInvoicingStripeEpic: (actions$: ActionsObservable<InvoicingSettingsViewActionType>, _state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<InvoicingSettingsViewActionType>;
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.connectInvoicingStripeEpic = void 0;
|
|
4
|
-
const rxjs_1 = require("rxjs");
|
|
5
|
-
const operators_1 = require("rxjs/operators");
|
|
6
|
-
const responsePayload_1 = require("../../../../responsePayload");
|
|
7
|
-
const settingsViewReducer_1 = require("../settingsViewReducer");
|
|
8
|
-
const connectInvoicingStripeEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(settingsViewReducer_1.connectInvoicingStripe.match), (0, operators_1.mergeMap)((action) => {
|
|
9
|
-
const apiUrl = `${zeniAPI.apiEndPoints.invoicingMicroServiceBaseUrl}/1.0/settings/stripe-connect/setup`;
|
|
10
|
-
const { api_key, publishable_key, webhook_secret } = action.payload;
|
|
11
|
-
const body = {
|
|
12
|
-
api_key,
|
|
13
|
-
publishable_key,
|
|
14
|
-
...(webhook_secret != null && webhook_secret !== ''
|
|
15
|
-
? { webhook_secret }
|
|
16
|
-
: {}),
|
|
17
|
-
};
|
|
18
|
-
return zeniAPI
|
|
19
|
-
.postAndGetJSON(apiUrl, body)
|
|
20
|
-
.pipe((0, operators_1.switchMap)((response) => {
|
|
21
|
-
if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
|
|
22
|
-
return (0, rxjs_1.of)((0, settingsViewReducer_1.updateInvoicingStripeConnection)({
|
|
23
|
-
stripe_connected: response.data.stripe_connected,
|
|
24
|
-
publishable_key: response.data.publishable_key,
|
|
25
|
-
}), (0, settingsViewReducer_1.fetchInvoicingSettings)());
|
|
26
|
-
}
|
|
27
|
-
return (0, rxjs_1.of)((0, settingsViewReducer_1.invoicingStripeConnectionFailure)(response.status));
|
|
28
|
-
}), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, settingsViewReducer_1.invoicingStripeConnectionFailure)((0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Stripe connect setup REST API call errored out ' +
|
|
29
|
-
JSON.stringify(error))))));
|
|
30
|
-
}));
|
|
31
|
-
exports.connectInvoicingStripeEpic = connectInvoicingStripeEpic;
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { ActionsObservable, StateObservable } from 'redux-observable';
|
|
2
|
-
import { Observable } from 'rxjs';
|
|
3
|
-
import { RootState } from '../../../../rootStateTypes';
|
|
4
|
-
import { ZeniAPI } from '../../../../zeniAPI';
|
|
5
|
-
import { InvoicingSettingsViewActionType } from './settingsViewActionType';
|
|
6
|
-
export declare const disconnectInvoicingStripeEpic: (actions$: ActionsObservable<InvoicingSettingsViewActionType>, _state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<InvoicingSettingsViewActionType>;
|