@zeniai/client-epic-state 5.1.88 → 5.1.90
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/aiCfo/aiCfoPayload.d.ts +0 -7
- package/lib/entity/aiCfo/aiCfoReducer.d.ts +2 -3
- package/lib/entity/aiCfo/aiCfoReducer.js +2 -25
- package/lib/entity/aiCfo/aiCfoState.d.ts +0 -7
- package/lib/entity/customerSatisfaction/customerSatisfactionReducer.d.ts +1 -1
- package/lib/entity/customerSatisfaction/customerSatisfactionReducer.js +2 -6
- package/lib/entity/snackbar/snackbarTypes.d.ts +1 -1
- package/lib/entity/snackbar/snackbarTypes.js +0 -29
- package/lib/epic.js +1 -3
- package/lib/esm/entity/aiCfo/aiCfoReducer.js +1 -23
- package/lib/esm/entity/customerSatisfaction/customerSatisfactionReducer.js +1 -4
- package/lib/esm/entity/snackbar/snackbarTypes.js +0 -29
- package/lib/esm/epic.js +1 -3
- package/lib/esm/index.js +4 -4
- package/lib/esm/view/companyHealthMetricView/companyHealthMetricConfigReducer.js +1 -4
- package/lib/esm/view/invoicing/createCreditNote/createCreditNoteEpic.js +4 -24
- package/lib/esm/view/invoicing/createInvoice/createInvoiceEpic.js +4 -24
- package/lib/esm/view/invoicing/createInvoice/createInvoiceSelector.js +10 -37
- package/lib/esm/view/invoicing/discountAction/discountActionEpic.js +9 -33
- package/lib/esm/view/invoicing/dunningAction/dunningActionEpic.js +9 -35
- package/lib/esm/view/invoicing/editInvoicingCatalogItemDetailView/catalogDetailEditPayload.js +1 -5
- package/lib/esm/view/invoicing/editInvoicingCatalogItemDetailView/saveInvoicingCatalogItemEpic.js +5 -32
- package/lib/esm/view/invoicing/editInvoicingCouponDetailView/saveInvoicingCouponEpic.js +3 -23
- package/lib/esm/view/invoicing/editInvoicingCustomerDetailView/saveInvoicingCustomerEpic.js +4 -24
- package/lib/esm/view/invoicing/editInvoicingSubscriptionDetailView/saveInvoicingSubscriptionEpic.js +4 -24
- package/lib/esm/view/invoicing/editInvoicingSubscriptionDetailView/syncInvoicingSubscriptionCouponsEpic.js +3 -20
- package/lib/esm/view/invoicing/invoiceAction/invoiceActionEpic.js +17 -60
- package/lib/esm/view/invoicing/invoicingConfigView/invoicingConfigViewReducer.js +0 -30
- package/lib/esm/view/invoicing/invoicingConfigView/invoicingConfigViewSelector.js +29 -4
- package/lib/esm/view/invoicing/invoicingDunningCaseDetailView/invoicingDunningCaseDetailViewPayload.js +1 -9
- package/lib/esm/view/invoicing/invoicingDunningCaseDetailView/invoicingDunningCaseDetailViewReducer.js +1 -50
- package/lib/esm/view/invoicing/invoicingDunningCaseDetailView/invoicingDunningCaseDetailViewSelector.js +1 -14
- package/lib/esm/view/invoicing/invoicingQboView/epics/retryInvoicingQboSyncTaskEpic.js +10 -29
- package/lib/esm/view/invoicing/invoicingQboView/epics/startInvoicingQboBackfillEpic.js +5 -28
- package/lib/esm/view/invoicing/issueCreditNote/issueCreditNoteEpic.js +4 -24
- package/lib/esm/view/invoicing/issueCreditNote/issueCreditNoteSelector.js +14 -22
- package/lib/esm/view/invoicing/recordPayment/recordPaymentEpic.js +7 -46
- package/lib/esm/view/invoicing/settingsView/settingsViewEpics.js +8 -26
- package/lib/esm/view/invoicing/settingsView/settingsViewReducer.js +1 -1
- package/lib/esm/view/invoicing/settingsView/settingsViewSelector.js +1 -4
- package/lib/esm/view/invoicing/subscriptionAction/subscriptionActionEpic.js +9 -41
- package/lib/esm/view/vendorFiling1099/vendorFiling1099UploadDetails/vendorFiling1099UploadDetailsReducer.js +1 -4
- package/lib/esm/view/vendorTabView/vendorTabViewReducer.js +1 -4
- package/lib/index.d.ts +7 -9
- package/lib/index.js +9 -12
- package/lib/view/companyHealthMetricView/companyHealthMetricConfigReducer.d.ts +1 -1
- package/lib/view/companyHealthMetricView/companyHealthMetricConfigReducer.js +2 -5
- package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.d.ts +1 -1
- package/lib/view/invoicing/createCreditNote/createCreditNoteEpic.d.ts +1 -2
- package/lib/view/invoicing/createCreditNote/createCreditNoteEpic.js +3 -23
- package/lib/view/invoicing/createInvoice/createInvoiceEpic.d.ts +1 -2
- package/lib/view/invoicing/createInvoice/createInvoiceEpic.js +3 -23
- package/lib/view/invoicing/createInvoice/createInvoiceSelector.d.ts +8 -22
- package/lib/view/invoicing/createInvoice/createInvoiceSelector.js +10 -37
- package/lib/view/invoicing/discountAction/discountActionEpic.d.ts +1 -2
- package/lib/view/invoicing/discountAction/discountActionEpic.js +8 -32
- package/lib/view/invoicing/dunningAction/dunningActionEpic.d.ts +1 -2
- package/lib/view/invoicing/dunningAction/dunningActionEpic.js +8 -34
- package/lib/view/invoicing/editInvoicingCatalogItemDetailView/catalogDetailEditPayload.d.ts +1 -3
- package/lib/view/invoicing/editInvoicingCatalogItemDetailView/catalogDetailEditPayload.js +1 -5
- package/lib/view/invoicing/editInvoicingCatalogItemDetailView/saveInvoicingCatalogItemEpic.d.ts +1 -2
- package/lib/view/invoicing/editInvoicingCatalogItemDetailView/saveInvoicingCatalogItemEpic.js +4 -31
- package/lib/view/invoicing/editInvoicingCouponDetailView/saveInvoicingCouponEpic.d.ts +1 -2
- package/lib/view/invoicing/editInvoicingCouponDetailView/saveInvoicingCouponEpic.js +2 -22
- package/lib/view/invoicing/editInvoicingCustomerDetailView/saveInvoicingCustomerEpic.d.ts +1 -2
- package/lib/view/invoicing/editInvoicingCustomerDetailView/saveInvoicingCustomerEpic.js +3 -23
- package/lib/view/invoicing/editInvoicingSubscriptionDetailView/saveInvoicingSubscriptionEpic.d.ts +1 -2
- package/lib/view/invoicing/editInvoicingSubscriptionDetailView/saveInvoicingSubscriptionEpic.js +3 -23
- package/lib/view/invoicing/editInvoicingSubscriptionDetailView/syncInvoicingSubscriptionCouponsEpic.d.ts +1 -2
- package/lib/view/invoicing/editInvoicingSubscriptionDetailView/syncInvoicingSubscriptionCouponsEpic.js +2 -19
- package/lib/view/invoicing/invoiceAction/invoiceActionEpic.d.ts +1 -2
- package/lib/view/invoicing/invoiceAction/invoiceActionEpic.js +16 -59
- package/lib/view/invoicing/invoicingConfigView/invoicingConfigViewPayload.d.ts +0 -13
- package/lib/view/invoicing/invoicingConfigView/invoicingConfigViewReducer.d.ts +1 -1
- package/lib/view/invoicing/invoicingConfigView/invoicingConfigViewReducer.js +0 -30
- package/lib/view/invoicing/invoicingConfigView/invoicingConfigViewSelector.d.ts +31 -11
- package/lib/view/invoicing/invoicingConfigView/invoicingConfigViewSelector.js +29 -4
- package/lib/view/invoicing/invoicingConfigView/invoicingConfigViewState.d.ts +0 -15
- package/lib/view/invoicing/invoicingDunningCaseDetailView/invoicingDunningCaseDetailViewEpics.d.ts +2 -2
- package/lib/view/invoicing/invoicingDunningCaseDetailView/invoicingDunningCaseDetailViewPayload.d.ts +0 -12
- package/lib/view/invoicing/invoicingDunningCaseDetailView/invoicingDunningCaseDetailViewPayload.js +0 -11
- package/lib/view/invoicing/invoicingDunningCaseDetailView/invoicingDunningCaseDetailViewReducer.d.ts +4 -21
- package/lib/view/invoicing/invoicingDunningCaseDetailView/invoicingDunningCaseDetailViewReducer.js +2 -51
- package/lib/view/invoicing/invoicingDunningCaseDetailView/invoicingDunningCaseDetailViewSelector.d.ts +0 -3
- package/lib/view/invoicing/invoicingDunningCaseDetailView/invoicingDunningCaseDetailViewSelector.js +2 -16
- package/lib/view/invoicing/invoicingDunningCaseDetailView/invoicingDunningCaseDetailViewState.d.ts +0 -13
- package/lib/view/invoicing/invoicingQboView/epics/invoicingQboViewActionType.d.ts +1 -2
- package/lib/view/invoicing/invoicingQboView/epics/retryInvoicingQboSyncTaskEpic.js +9 -28
- package/lib/view/invoicing/invoicingQboView/epics/startInvoicingQboBackfillEpic.js +4 -27
- package/lib/view/invoicing/issueCreditNote/issueCreditNoteEpic.d.ts +1 -2
- package/lib/view/invoicing/issueCreditNote/issueCreditNoteEpic.js +3 -23
- package/lib/view/invoicing/issueCreditNote/issueCreditNoteSelector.d.ts +7 -24
- package/lib/view/invoicing/issueCreditNote/issueCreditNoteSelector.js +16 -23
- package/lib/view/invoicing/recordPayment/recordPaymentEpic.d.ts +1 -2
- package/lib/view/invoicing/recordPayment/recordPaymentEpic.js +6 -45
- package/lib/view/invoicing/settingsView/settingsViewEpics.d.ts +1 -2
- package/lib/view/invoicing/settingsView/settingsViewEpics.js +7 -25
- package/lib/view/invoicing/settingsView/settingsViewReducer.d.ts +1 -10
- package/lib/view/invoicing/settingsView/settingsViewReducer.js +1 -1
- package/lib/view/invoicing/settingsView/settingsViewSelector.d.ts +2 -4
- package/lib/view/invoicing/settingsView/settingsViewSelector.js +1 -4
- package/lib/view/invoicing/subscriptionAction/subscriptionActionEpic.d.ts +1 -2
- package/lib/view/invoicing/subscriptionAction/subscriptionActionEpic.js +8 -40
- package/lib/view/vendorFiling1099/vendorFiling1099UploadDetails/vendorFiling1099UploadDetailsReducer.d.ts +1 -1
- package/lib/view/vendorFiling1099/vendorFiling1099UploadDetails/vendorFiling1099UploadDetailsReducer.js +2 -5
- package/lib/view/vendorTabView/vendorTabViewReducer.d.ts +1 -1
- package/lib/view/vendorTabView/vendorTabViewReducer.js +2 -5
- package/package.json +1 -1
- package/lib/esm/view/invoicing/invoicingDunningCaseDetailView/fetchInvoicingDunningEmailPreviewEpic.js +0 -26
- package/lib/esm/view/invoicing/invoicingDunningCaseDetailView/fetchInvoicingDunningEmailPreviewPageEpic.js +0 -16
- package/lib/view/invoicing/invoicingDunningCaseDetailView/fetchInvoicingDunningEmailPreviewEpic.d.ts +0 -7
- package/lib/view/invoicing/invoicingDunningCaseDetailView/fetchInvoicingDunningEmailPreviewEpic.js +0 -30
- package/lib/view/invoicing/invoicingDunningCaseDetailView/fetchInvoicingDunningEmailPreviewPageEpic.d.ts +0 -6
- package/lib/view/invoicing/invoicingDunningCaseDetailView/fetchInvoicingDunningEmailPreviewPageEpic.js +0 -20
|
@@ -2,7 +2,6 @@ import { FetchStateAndError, ID } from '../../../commonStateTypes/common';
|
|
|
2
2
|
import { SelectorView } from '../../../commonStateTypes/viewAndReport/viewAndReport';
|
|
3
3
|
import { InvoicingDunningCase } from '../../../entity/invoicing/dunningCase/dunningCaseState';
|
|
4
4
|
import { RootState } from '../../../reducer';
|
|
5
|
-
import { InvoicingDunningEmailPreviewState } from './invoicingDunningCaseDetailViewState';
|
|
6
5
|
/**
|
|
7
6
|
* Read-only view for the dunning case detail page: the dunning case entity + its
|
|
8
7
|
* fetch state, plus the per-case action run-state (pause/resume/retry) folded in
|
|
@@ -10,9 +9,7 @@ import { InvoicingDunningEmailPreviewState } from './invoicingDunningCaseDetailV
|
|
|
10
9
|
*/
|
|
11
10
|
export interface InvoicingDunningCaseDetailView extends SelectorView {
|
|
12
11
|
actionState: FetchStateAndError;
|
|
13
|
-
emailPreview: InvoicingDunningEmailPreviewState;
|
|
14
12
|
dunningCase?: InvoicingDunningCase;
|
|
15
13
|
}
|
|
16
14
|
export declare const getInvoicingDunningCaseById: (state: RootState, id: string) => InvoicingDunningCase | undefined;
|
|
17
15
|
export declare const getInvoicingDunningCaseDetail: (state: RootState, invoicingDunningCaseID: ID) => InvoicingDunningCaseDetailView;
|
|
18
|
-
export declare const getInvoicingDunningEmailPreview: (state: RootState, invoicingDunningCaseID: ID) => InvoicingDunningEmailPreviewState;
|
package/lib/view/invoicing/invoicingDunningCaseDetailView/invoicingDunningCaseDetailViewSelector.js
CHANGED
|
@@ -1,32 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.getInvoicingDunningCaseDetail = exports.getInvoicingDunningCaseById = void 0;
|
|
4
4
|
const dunningCaseSelector_1 = require("../../../entity/invoicing/dunningCase/dunningCaseSelector");
|
|
5
5
|
const dunningActionSelector_1 = require("../dunningAction/dunningActionSelector");
|
|
6
|
-
const EMAIL_PREVIEW_NOT_STARTED = {
|
|
7
|
-
error: undefined,
|
|
8
|
-
fetchState: 'Not-Started',
|
|
9
|
-
preview: undefined,
|
|
10
|
-
};
|
|
11
6
|
const getInvoicingDunningCaseById = (state, id) => (0, dunningCaseSelector_1.getInvoicingDunningCaseById)(state.invoicingDunningCaseState, id);
|
|
12
7
|
exports.getInvoicingDunningCaseById = getInvoicingDunningCaseById;
|
|
13
8
|
const getInvoicingDunningCaseDetail = (state, invoicingDunningCaseID) => {
|
|
14
|
-
const {
|
|
9
|
+
const { error, fetchState } = state.invoicingDunningCaseDetailViewState;
|
|
15
10
|
return {
|
|
16
11
|
actionState: (0, dunningActionSelector_1.getInvoicingDunningActionState)(invoicingDunningCaseID)(state),
|
|
17
12
|
dunningCase: (0, exports.getInvoicingDunningCaseById)(state, invoicingDunningCaseID),
|
|
18
|
-
emailPreview: id === invoicingDunningCaseID ? emailPreview : EMAIL_PREVIEW_NOT_STARTED,
|
|
19
13
|
fetchState,
|
|
20
14
|
error,
|
|
21
15
|
version: 1.0,
|
|
22
16
|
};
|
|
23
17
|
};
|
|
24
18
|
exports.getInvoicingDunningCaseDetail = getInvoicingDunningCaseDetail;
|
|
25
|
-
const getInvoicingDunningEmailPreview = (state, invoicingDunningCaseID) => {
|
|
26
|
-
const detailState = state.invoicingDunningCaseDetailViewState;
|
|
27
|
-
if (detailState.id !== invoicingDunningCaseID) {
|
|
28
|
-
return EMAIL_PREVIEW_NOT_STARTED;
|
|
29
|
-
}
|
|
30
|
-
return detailState.emailPreview;
|
|
31
|
-
};
|
|
32
|
-
exports.getInvoicingDunningEmailPreview = getInvoicingDunningEmailPreview;
|
package/lib/view/invoicing/invoicingDunningCaseDetailView/invoicingDunningCaseDetailViewState.d.ts
CHANGED
|
@@ -1,17 +1,4 @@
|
|
|
1
1
|
import { FetchStateAndError, ID } from '../../../commonStateTypes/common';
|
|
2
|
-
export interface InvoicingDunningEmailPreview {
|
|
3
|
-
body: string;
|
|
4
|
-
bodyToken: string;
|
|
5
|
-
cc: string;
|
|
6
|
-
renderedHtmlTemplate: string;
|
|
7
|
-
subject: string;
|
|
8
|
-
subjectToken: string;
|
|
9
|
-
to: string;
|
|
10
|
-
}
|
|
11
|
-
export interface InvoicingDunningEmailPreviewState extends FetchStateAndError {
|
|
12
|
-
preview?: InvoicingDunningEmailPreview;
|
|
13
|
-
}
|
|
14
2
|
export interface InvoicingDunningCaseDetailViewState extends FetchStateAndError {
|
|
15
|
-
emailPreview: InvoicingDunningEmailPreviewState;
|
|
16
3
|
id?: ID;
|
|
17
4
|
}
|
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
import { openSnackbar } from '../../../../entity/snackbar/snackbarReducer';
|
|
2
1
|
import { fetchInvoicingQboAccounts, fetchInvoicingQboClasses, fetchInvoicingQboConnection, fetchInvoicingQboSyncHealth, retryInvoicingQboSyncTask, retryInvoicingQboSyncTaskFailure, retryInvoicingQboSyncTaskSuccess, startInvoicingQboBackfill, startInvoicingQboBackfillFailure, startInvoicingQboBackfillSuccess, updateInvoicingQboAccounts, updateInvoicingQboAccountsFailure, updateInvoicingQboClasses, updateInvoicingQboClassesFailure, updateInvoicingQboConnection, updateInvoicingQboConnectionFailure, updateInvoicingQboSyncHealth, updateInvoicingQboSyncHealthFailure } from '../invoicingQboViewReducer';
|
|
3
|
-
export type InvoicingQboViewActionType = ReturnType<typeof
|
|
2
|
+
export type InvoicingQboViewActionType = ReturnType<typeof fetchInvoicingQboConnection> | ReturnType<typeof updateInvoicingQboConnection> | ReturnType<typeof updateInvoicingQboConnectionFailure> | ReturnType<typeof fetchInvoicingQboAccounts> | ReturnType<typeof updateInvoicingQboAccounts> | ReturnType<typeof updateInvoicingQboAccountsFailure> | ReturnType<typeof fetchInvoicingQboClasses> | ReturnType<typeof updateInvoicingQboClasses> | ReturnType<typeof updateInvoicingQboClassesFailure> | ReturnType<typeof fetchInvoicingQboSyncHealth> | ReturnType<typeof updateInvoicingQboSyncHealth> | ReturnType<typeof updateInvoicingQboSyncHealthFailure> | ReturnType<typeof retryInvoicingQboSyncTask> | ReturnType<typeof retryInvoicingQboSyncTaskSuccess> | ReturnType<typeof retryInvoicingQboSyncTaskFailure> | ReturnType<typeof startInvoicingQboBackfill> | ReturnType<typeof startInvoicingQboBackfillSuccess> | ReturnType<typeof startInvoicingQboBackfillFailure>;
|
|
@@ -3,7 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.retryInvoicingQboSyncTaskEpic = void 0;
|
|
4
4
|
const rxjs_1 = require("rxjs");
|
|
5
5
|
const operators_1 = require("rxjs/operators");
|
|
6
|
-
const snackbarReducer_1 = require("../../../../entity/snackbar/snackbarReducer");
|
|
7
6
|
const responsePayload_1 = require("../../../../responsePayload");
|
|
8
7
|
const invoicingQboViewReducer_1 = require("../invoicingQboViewReducer");
|
|
9
8
|
const retryInvoicingQboSyncTaskEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(invoicingQboViewReducer_1.retryInvoicingQboSyncTask.match), (0, operators_1.mergeMap)((action) => {
|
|
@@ -16,34 +15,16 @@ const retryInvoicingQboSyncTaskEpic = (actions$, _state$, zeniAPI) => actions$.p
|
|
|
16
15
|
return (0, rxjs_1.of)((0, invoicingQboViewReducer_1.retryInvoicingQboSyncTaskSuccess)({
|
|
17
16
|
status: response.data?.status ?? '',
|
|
18
17
|
taskId: response.data?.task_id ?? taskId,
|
|
19
|
-
}), (0, invoicingQboViewReducer_1.fetchInvoicingQboSyncHealth)()
|
|
20
|
-
messageSection: 'invoicing_qbo_sync_health_retry',
|
|
21
|
-
messageText: 'success',
|
|
22
|
-
type: 'success',
|
|
23
|
-
}));
|
|
18
|
+
}), (0, invoicingQboViewReducer_1.fetchInvoicingQboSyncHealth)());
|
|
24
19
|
}
|
|
25
|
-
return (0, rxjs_1.
|
|
26
|
-
|
|
27
|
-
status: response.status,
|
|
28
|
-
taskId,
|
|
29
|
-
}),
|
|
30
|
-
(0, snackbarReducer_1.openSnackbar)({
|
|
31
|
-
messageSection: 'invoicing_qbo_sync_health_retry',
|
|
32
|
-
messageText: 'failed',
|
|
33
|
-
type: 'error',
|
|
34
|
-
}),
|
|
35
|
-
]);
|
|
36
|
-
}), (0, operators_1.catchError)((error) => (0, rxjs_1.from)([
|
|
37
|
-
(0, invoicingQboViewReducer_1.retryInvoicingQboSyncTaskFailure)({
|
|
38
|
-
status: (0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Retry QBO sync task REST API call errored out ' +
|
|
39
|
-
JSON.stringify(error)),
|
|
20
|
+
return (0, rxjs_1.of)((0, invoicingQboViewReducer_1.retryInvoicingQboSyncTaskFailure)({
|
|
21
|
+
status: response.status,
|
|
40
22
|
taskId,
|
|
41
|
-
})
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
])));
|
|
23
|
+
}));
|
|
24
|
+
}), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, invoicingQboViewReducer_1.retryInvoicingQboSyncTaskFailure)({
|
|
25
|
+
status: (0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Retry QBO sync task REST API call errored out ' +
|
|
26
|
+
JSON.stringify(error)),
|
|
27
|
+
taskId,
|
|
28
|
+
}))));
|
|
48
29
|
}));
|
|
49
30
|
exports.retryInvoicingQboSyncTaskEpic = retryInvoicingQboSyncTaskEpic;
|
|
@@ -3,7 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.startInvoicingQboBackfillEpic = void 0;
|
|
4
4
|
const rxjs_1 = require("rxjs");
|
|
5
5
|
const operators_1 = require("rxjs/operators");
|
|
6
|
-
const snackbarReducer_1 = require("../../../../entity/snackbar/snackbarReducer");
|
|
7
6
|
const responsePayload_1 = require("../../../../responsePayload");
|
|
8
7
|
const invoicingQboViewReducer_1 = require("../invoicingQboViewReducer");
|
|
9
8
|
const startInvoicingQboBackfillEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(invoicingQboViewReducer_1.startInvoicingQboBackfill.match), (0, operators_1.switchMap)((action) => {
|
|
@@ -14,32 +13,10 @@ const startInvoicingQboBackfillEpic = (actions$, _state$, zeniAPI) => actions$.p
|
|
|
14
13
|
})
|
|
15
14
|
.pipe((0, operators_1.mergeMap)((response) => {
|
|
16
15
|
if ((0, responsePayload_1.isSuccessResponse)(response)) {
|
|
17
|
-
return (0, rxjs_1.
|
|
18
|
-
(0, invoicingQboViewReducer_1.startInvoicingQboBackfillSuccess)(),
|
|
19
|
-
(0, invoicingQboViewReducer_1.fetchInvoicingQboSyncHealth)(),
|
|
20
|
-
(0, snackbarReducer_1.openSnackbar)({
|
|
21
|
-
messageSection: 'invoicing_qbo_backfill',
|
|
22
|
-
messageText: 'success',
|
|
23
|
-
type: 'success',
|
|
24
|
-
}),
|
|
25
|
-
]);
|
|
16
|
+
return (0, rxjs_1.of)((0, invoicingQboViewReducer_1.startInvoicingQboBackfillSuccess)(), (0, invoicingQboViewReducer_1.fetchInvoicingQboSyncHealth)());
|
|
26
17
|
}
|
|
27
|
-
return (0, rxjs_1.
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
messageSection: 'invoicing_qbo_backfill',
|
|
31
|
-
messageText: 'failed',
|
|
32
|
-
type: 'error',
|
|
33
|
-
}),
|
|
34
|
-
]);
|
|
35
|
-
}), (0, operators_1.catchError)((error) => (0, rxjs_1.from)([
|
|
36
|
-
(0, invoicingQboViewReducer_1.startInvoicingQboBackfillFailure)((0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Start QBO backfill REST API call errored out ' +
|
|
37
|
-
JSON.stringify(error))),
|
|
38
|
-
(0, snackbarReducer_1.openSnackbar)({
|
|
39
|
-
messageSection: 'invoicing_qbo_backfill',
|
|
40
|
-
messageText: 'failed',
|
|
41
|
-
type: 'error',
|
|
42
|
-
}),
|
|
43
|
-
])));
|
|
18
|
+
return (0, rxjs_1.of)((0, invoicingQboViewReducer_1.startInvoicingQboBackfillFailure)(response.status));
|
|
19
|
+
}), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, invoicingQboViewReducer_1.startInvoicingQboBackfillFailure)((0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Start QBO backfill REST API call errored out ' +
|
|
20
|
+
JSON.stringify(error))))));
|
|
44
21
|
}));
|
|
45
22
|
exports.startInvoicingQboBackfillEpic = startInvoicingQboBackfillEpic;
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { ActionsObservable, StateObservable } from 'redux-observable';
|
|
2
2
|
import { Observable } from 'rxjs';
|
|
3
3
|
import { updateInvoicingCreditNotes } from '../../../entity/invoicing/creditNote/creditNoteReducer';
|
|
4
|
-
import { openSnackbar } from '../../../entity/snackbar/snackbarReducer';
|
|
5
4
|
import { RootState } from '../../../reducer';
|
|
6
5
|
import { ZeniAPI } from '../../../zeniAPI';
|
|
7
6
|
import { fetchInvoiceDetail } from '../invoiceDetail/invoiceDetailReducer';
|
|
8
7
|
import { issueCreditNoteFailure, issueCreditNoteSuccess, submitIssueCreditNote } from './issueCreditNoteReducer';
|
|
9
|
-
export type ActionType = ReturnType<typeof submitIssueCreditNote> | ReturnType<typeof issueCreditNoteSuccess> | ReturnType<typeof issueCreditNoteFailure> | ReturnType<typeof updateInvoicingCreditNotes> | ReturnType<typeof fetchInvoiceDetail
|
|
8
|
+
export type ActionType = ReturnType<typeof submitIssueCreditNote> | ReturnType<typeof issueCreditNoteSuccess> | ReturnType<typeof issueCreditNoteFailure> | ReturnType<typeof updateInvoicingCreditNotes> | ReturnType<typeof fetchInvoiceDetail>;
|
|
10
9
|
export declare const issueCreditNoteEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
|
|
@@ -4,7 +4,6 @@ exports.issueCreditNoteEpic = void 0;
|
|
|
4
4
|
const rxjs_1 = require("rxjs");
|
|
5
5
|
const operators_1 = require("rxjs/operators");
|
|
6
6
|
const creditNoteReducer_1 = require("../../../entity/invoicing/creditNote/creditNoteReducer");
|
|
7
|
-
const snackbarReducer_1 = require("../../../entity/snackbar/snackbarReducer");
|
|
8
7
|
const responsePayload_1 = require("../../../responsePayload");
|
|
9
8
|
const invoiceDetailReducer_1 = require("../invoiceDetail/invoiceDetailReducer");
|
|
10
9
|
const issueCreditNotePayload_1 = require("./issueCreditNotePayload");
|
|
@@ -22,29 +21,10 @@ const issueCreditNoteEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, ope
|
|
|
22
21
|
(0, creditNoteReducer_1.updateInvoicingCreditNotes)([response.data], 'merge'),
|
|
23
22
|
(0, invoiceDetailReducer_1.fetchInvoiceDetail)({ invoiceId }),
|
|
24
23
|
(0, issueCreditNoteReducer_1.issueCreditNoteSuccess)({ creditNoteId: response.data.id }),
|
|
25
|
-
(0, snackbarReducer_1.openSnackbar)({
|
|
26
|
-
messageSection: 'invoicing_credit_note_saved',
|
|
27
|
-
messageText: 'success',
|
|
28
|
-
type: 'success',
|
|
29
|
-
}),
|
|
30
24
|
];
|
|
31
25
|
}
|
|
32
|
-
return (0, rxjs_1.
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
messageSection: 'invoicing_credit_note_saved',
|
|
36
|
-
messageText: 'failed',
|
|
37
|
-
type: 'error',
|
|
38
|
-
}),
|
|
39
|
-
]);
|
|
40
|
-
}), (0, operators_1.catchError)((error) => (0, rxjs_1.from)([
|
|
41
|
-
(0, issueCreditNoteReducer_1.issueCreditNoteFailure)((0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Issue credit note REST API call errored out ' +
|
|
42
|
-
JSON.stringify(error))),
|
|
43
|
-
(0, snackbarReducer_1.openSnackbar)({
|
|
44
|
-
messageSection: 'invoicing_credit_note_saved',
|
|
45
|
-
messageText: 'failed',
|
|
46
|
-
type: 'error',
|
|
47
|
-
}),
|
|
48
|
-
])));
|
|
26
|
+
return (0, rxjs_1.of)((0, issueCreditNoteReducer_1.issueCreditNoteFailure)(response.status));
|
|
27
|
+
}), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, issueCreditNoteReducer_1.issueCreditNoteFailure)((0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Issue credit note REST API call errored out ' +
|
|
28
|
+
JSON.stringify(error))))));
|
|
49
29
|
}));
|
|
50
30
|
exports.issueCreditNoteEpic = issueCreditNoteEpic;
|
|
@@ -1,30 +1,13 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ID } from '../../../commonStateTypes/common';
|
|
2
2
|
import { SelectorView } from '../../../commonStateTypes/viewAndReport/viewAndReport';
|
|
3
|
-
import { InvoicingInvoice } from '../../../entity/invoicing/invoice/invoiceState';
|
|
4
3
|
import { RootState } from '../../../reducer';
|
|
5
4
|
import { IssueCreditNoteFormLocalData } from './issueCreditNoteState';
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
*/
|
|
12
|
-
export interface IssueCreditNoteView extends SelectorView {
|
|
13
|
-
/**
|
|
14
|
-
* True once the invoice has loaded and the draft for *this* invoice has line
|
|
15
|
-
* items to credit.
|
|
16
|
-
*/
|
|
17
|
-
isPageReady: boolean;
|
|
5
|
+
export interface InvoicingIssueCreditNoteView extends SelectorView {
|
|
6
|
+
issuedCreditNoteId?: ID;
|
|
7
|
+
}
|
|
8
|
+
export declare const getIssueCreditNoteView: (state: RootState) => InvoicingIssueCreditNoteView;
|
|
9
|
+
export interface IssueCreditNoteFormView extends SelectorView {
|
|
18
10
|
localData: IssueCreditNoteFormLocalData;
|
|
19
11
|
reasonCodeValues: string[];
|
|
20
|
-
submitState: FetchStateAndError;
|
|
21
|
-
invoice?: InvoicingInvoice;
|
|
22
|
-
issuedCreditNoteId?: ID;
|
|
23
12
|
}
|
|
24
|
-
|
|
25
|
-
* The draft is a single global slice, so a draft seeded for a previously opened
|
|
26
|
-
* invoice can still be in state when another invoice's screen mounts. Anything
|
|
27
|
-
* that would render that stale draft next to this invoice is dropped until the
|
|
28
|
-
* screen re-seeds it for `invoiceId`.
|
|
29
|
-
*/
|
|
30
|
-
export declare const getIssueCreditNoteView: (state: RootState, invoiceId: ID) => IssueCreditNoteView;
|
|
13
|
+
export declare const getIssueCreditNoteFormView: (state: RootState) => IssueCreditNoteFormView;
|
|
@@ -1,32 +1,25 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getIssueCreditNoteView = void 0;
|
|
4
|
-
const invoiceDetailSelector_1 = require("../invoiceDetail/invoiceDetailSelector");
|
|
3
|
+
exports.getIssueCreditNoteFormView = exports.getIssueCreditNoteView = void 0;
|
|
5
4
|
const issueCreditNoteFormConfig_1 = require("./issueCreditNoteFormConfig");
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
* invoice can still be in state when another invoice's screen mounts. Anything
|
|
9
|
-
* that would render that stale draft next to this invoice is dropped until the
|
|
10
|
-
* screen re-seeds it for `invoiceId`.
|
|
11
|
-
*/
|
|
12
|
-
const getIssueCreditNoteView = (state, invoiceId) => {
|
|
13
|
-
const invoiceView = (0, invoiceDetailSelector_1.getInvoiceDetail)(state, invoiceId);
|
|
14
|
-
const { draft, error, fetchState, issuedCreditNoteId } = state.invoicingIssueCreditNoteState;
|
|
15
|
-
const isDraftForInvoice = draft.invoiceId === invoiceId;
|
|
5
|
+
const getIssueCreditNoteView = (state) => {
|
|
6
|
+
const { error, fetchState, issuedCreditNoteId } = state.invoicingIssueCreditNoteState;
|
|
16
7
|
return {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
isDraftForInvoice &&
|
|
20
|
-
draft.lineItems.length > 0,
|
|
8
|
+
error,
|
|
9
|
+
fetchState,
|
|
21
10
|
issuedCreditNoteId,
|
|
22
|
-
localData: isDraftForInvoice
|
|
23
|
-
? draft
|
|
24
|
-
: (0, issueCreditNoteFormConfig_1.initialIssueCreditNoteFormLocalData)(invoiceId),
|
|
25
|
-
reasonCodeValues: [...issueCreditNoteFormConfig_1.INVOICING_CREDIT_NOTE_REASON_CODES],
|
|
26
|
-
submitState: { error, fetchState },
|
|
27
|
-
error: invoiceView.error,
|
|
28
|
-
fetchState: invoiceView.fetchState,
|
|
29
11
|
version: 1.0,
|
|
30
12
|
};
|
|
31
13
|
};
|
|
32
14
|
exports.getIssueCreditNoteView = getIssueCreditNoteView;
|
|
15
|
+
const getIssueCreditNoteFormView = (state) => {
|
|
16
|
+
const { draft, error, fetchState } = state.invoicingIssueCreditNoteState;
|
|
17
|
+
return {
|
|
18
|
+
localData: draft,
|
|
19
|
+
reasonCodeValues: [...issueCreditNoteFormConfig_1.INVOICING_CREDIT_NOTE_REASON_CODES],
|
|
20
|
+
error,
|
|
21
|
+
fetchState,
|
|
22
|
+
version: 1.0,
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
exports.getIssueCreditNoteFormView = getIssueCreditNoteFormView;
|
|
@@ -2,11 +2,10 @@ import { ActionsObservable, StateObservable } from 'redux-observable';
|
|
|
2
2
|
import { Observable } from 'rxjs';
|
|
3
3
|
import { updateInvoices } from '../../../entity/invoicing/invoice/invoiceReducer';
|
|
4
4
|
import { updateInvoicingTransactions } from '../../../entity/invoicing/invoicingTransaction/invoicingTransactionReducer';
|
|
5
|
-
import { openSnackbar } from '../../../entity/snackbar/snackbarReducer';
|
|
6
5
|
import { RootState } from '../../../reducer';
|
|
7
6
|
import { ZeniAPI } from '../../../zeniAPI';
|
|
8
7
|
import { fetchInvoiceDetail } from '../invoiceDetail/invoiceDetailReducer';
|
|
9
8
|
import { addInvoicingTransactionToList } from '../invoicingTransactionListView/invoicingTransactionListViewReducer';
|
|
10
9
|
import { recordPaymentFailure, recordPaymentSuccess, submitRecordPayment } from './recordPaymentReducer';
|
|
11
|
-
export type ActionType = ReturnType<typeof submitRecordPayment> | ReturnType<typeof recordPaymentSuccess> | ReturnType<typeof recordPaymentFailure> | ReturnType<typeof updateInvoicingTransactions> | ReturnType<typeof addInvoicingTransactionToList> | ReturnType<typeof updateInvoices> | ReturnType<typeof fetchInvoiceDetail
|
|
10
|
+
export type ActionType = ReturnType<typeof submitRecordPayment> | ReturnType<typeof recordPaymentSuccess> | ReturnType<typeof recordPaymentFailure> | ReturnType<typeof updateInvoicingTransactions> | ReturnType<typeof addInvoicingTransactionToList> | ReturnType<typeof updateInvoices> | ReturnType<typeof fetchInvoiceDetail>;
|
|
12
11
|
export declare const recordPaymentEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
|
|
@@ -5,7 +5,6 @@ const rxjs_1 = require("rxjs");
|
|
|
5
5
|
const operators_1 = require("rxjs/operators");
|
|
6
6
|
const invoiceReducer_1 = require("../../../entity/invoicing/invoice/invoiceReducer");
|
|
7
7
|
const invoicingTransactionReducer_1 = require("../../../entity/invoicing/invoicingTransaction/invoicingTransactionReducer");
|
|
8
|
-
const snackbarReducer_1 = require("../../../entity/snackbar/snackbarReducer");
|
|
9
8
|
const responsePayload_1 = require("../../../responsePayload");
|
|
10
9
|
const invoiceDetailReducer_1 = require("../invoiceDetail/invoiceDetailReducer");
|
|
11
10
|
const invoicingTransactionListViewReducer_1 = require("../invoicingTransactionListView/invoicingTransactionListViewReducer");
|
|
@@ -30,30 +29,11 @@ const recordPaymentEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, opera
|
|
|
30
29
|
(0, invoiceReducer_1.updateInvoices)([response.data], 'merge'),
|
|
31
30
|
(0, invoiceDetailReducer_1.fetchInvoiceDetail)({ invoiceId }),
|
|
32
31
|
(0, recordPaymentReducer_1.recordPaymentSuccess)({ invoiceId }),
|
|
33
|
-
(0, snackbarReducer_1.openSnackbar)({
|
|
34
|
-
messageSection: 'invoicing_payment_recorded',
|
|
35
|
-
messageText: 'success',
|
|
36
|
-
type: 'success',
|
|
37
|
-
}),
|
|
38
32
|
];
|
|
39
33
|
}
|
|
40
|
-
return (0, rxjs_1.
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
messageSection: 'invoicing_payment_recorded',
|
|
44
|
-
messageText: 'failed',
|
|
45
|
-
type: 'error',
|
|
46
|
-
}),
|
|
47
|
-
]);
|
|
48
|
-
}), (0, operators_1.catchError)((error) => (0, rxjs_1.from)([
|
|
49
|
-
(0, recordPaymentReducer_1.recordPaymentFailure)((0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Record payment REST API call errored out ' +
|
|
50
|
-
JSON.stringify(error))),
|
|
51
|
-
(0, snackbarReducer_1.openSnackbar)({
|
|
52
|
-
messageSection: 'invoicing_payment_recorded',
|
|
53
|
-
messageText: 'failed',
|
|
54
|
-
type: 'error',
|
|
55
|
-
}),
|
|
56
|
-
])));
|
|
34
|
+
return (0, rxjs_1.of)((0, recordPaymentReducer_1.recordPaymentFailure)(response.status));
|
|
35
|
+
}), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, recordPaymentReducer_1.recordPaymentFailure)((0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Record payment REST API call errored out ' +
|
|
36
|
+
JSON.stringify(error))))));
|
|
57
37
|
}
|
|
58
38
|
const apiUrl = `${zeniAPI.apiEndPoints.invoicingMicroServiceBaseUrl}/1.0/payments`;
|
|
59
39
|
const data = (0, recordPaymentPayload_1.localDataToRecordPaymentPayload)(draft);
|
|
@@ -72,29 +52,10 @@ const recordPaymentEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, opera
|
|
|
72
52
|
if (linkedInvoiceId != null) {
|
|
73
53
|
successActions.push((0, invoiceDetailReducer_1.fetchInvoiceDetail)({ invoiceId: linkedInvoiceId }));
|
|
74
54
|
}
|
|
75
|
-
successActions.push((0, snackbarReducer_1.openSnackbar)({
|
|
76
|
-
messageSection: 'invoicing_payment_recorded',
|
|
77
|
-
messageText: 'success',
|
|
78
|
-
type: 'success',
|
|
79
|
-
}));
|
|
80
55
|
return successActions;
|
|
81
56
|
}
|
|
82
|
-
return (0, rxjs_1.
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
messageSection: 'invoicing_payment_recorded',
|
|
86
|
-
messageText: 'failed',
|
|
87
|
-
type: 'error',
|
|
88
|
-
}),
|
|
89
|
-
]);
|
|
90
|
-
}), (0, operators_1.catchError)((error) => (0, rxjs_1.from)([
|
|
91
|
-
(0, recordPaymentReducer_1.recordPaymentFailure)((0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Record payment REST API call errored out ' +
|
|
92
|
-
JSON.stringify(error))),
|
|
93
|
-
(0, snackbarReducer_1.openSnackbar)({
|
|
94
|
-
messageSection: 'invoicing_payment_recorded',
|
|
95
|
-
messageText: 'failed',
|
|
96
|
-
type: 'error',
|
|
97
|
-
}),
|
|
98
|
-
])));
|
|
57
|
+
return (0, rxjs_1.of)((0, recordPaymentReducer_1.recordPaymentFailure)(response.status));
|
|
58
|
+
}), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, recordPaymentReducer_1.recordPaymentFailure)((0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Record payment REST API call errored out ' +
|
|
59
|
+
JSON.stringify(error))))));
|
|
99
60
|
}));
|
|
100
61
|
exports.recordPaymentEpic = recordPaymentEpic;
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { ActionsObservable, StateObservable } from 'redux-observable';
|
|
2
2
|
import { Observable } from 'rxjs';
|
|
3
3
|
import { updateAddresses } from '../../../entity/address/addressReducer';
|
|
4
|
-
import { openSnackbar } from '../../../entity/snackbar/snackbarReducer';
|
|
5
4
|
import { RootState } from '../../../reducer';
|
|
6
5
|
import { ZeniAPI } from '../../../zeniAPI';
|
|
7
6
|
import { connectInvoicingStripe, disconnectInvoicingStripe, fetchInvoicingSettings, invoicingStripeConnectionFailure, saveInvoicingSettings, saveInvoicingSettingsFailure, saveInvoicingSettingsSuccess, updateInvoicingSettings, updateInvoicingSettingsFailure, updateInvoicingStripeConnection } from './settingsViewReducer';
|
|
8
|
-
export type ActionType = ReturnType<typeof fetchInvoicingSettings> | ReturnType<typeof updateInvoicingSettings> | ReturnType<typeof updateInvoicingSettingsFailure> | ReturnType<typeof saveInvoicingSettings> | ReturnType<typeof saveInvoicingSettingsSuccess> | ReturnType<typeof saveInvoicingSettingsFailure> | ReturnType<typeof connectInvoicingStripe> | ReturnType<typeof disconnectInvoicingStripe> | ReturnType<typeof updateInvoicingStripeConnection> | ReturnType<typeof invoicingStripeConnectionFailure> | ReturnType<typeof updateAddresses
|
|
7
|
+
export type ActionType = ReturnType<typeof fetchInvoicingSettings> | ReturnType<typeof updateInvoicingSettings> | ReturnType<typeof updateInvoicingSettingsFailure> | ReturnType<typeof saveInvoicingSettings> | ReturnType<typeof saveInvoicingSettingsSuccess> | ReturnType<typeof saveInvoicingSettingsFailure> | ReturnType<typeof connectInvoicingStripe> | ReturnType<typeof disconnectInvoicingStripe> | ReturnType<typeof updateInvoicingStripeConnection> | ReturnType<typeof invoicingStripeConnectionFailure> | ReturnType<typeof updateAddresses>;
|
|
9
8
|
export declare const fetchInvoicingSettingsEpic: (actions$: ActionsObservable<ActionType>, _state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
|
|
10
9
|
export declare const connectInvoicingStripeEpic: (actions$: ActionsObservable<ActionType>, _state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
|
|
11
10
|
export declare const disconnectInvoicingStripeEpic: (actions$: ActionsObservable<ActionType>, _state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
|
|
@@ -4,7 +4,6 @@ exports.saveInvoicingSettingsEpic = exports.disconnectInvoicingStripeEpic = expo
|
|
|
4
4
|
const rxjs_1 = require("rxjs");
|
|
5
5
|
const operators_1 = require("rxjs/operators");
|
|
6
6
|
const addressReducer_1 = require("../../../entity/address/addressReducer");
|
|
7
|
-
const snackbarReducer_1 = require("../../../entity/snackbar/snackbarReducer");
|
|
8
7
|
const responsePayload_1 = require("../../../responsePayload");
|
|
9
8
|
const settingsViewReducer_1 = require("./settingsViewReducer");
|
|
10
9
|
const fetchInvoicingSettingsEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(settingsViewReducer_1.fetchInvoicingSettings.match), (0, operators_1.switchMap)(() => {
|
|
@@ -64,33 +63,16 @@ const disconnectInvoicingStripeEpic = (actions$, _state$, zeniAPI) => actions$.p
|
|
|
64
63
|
exports.disconnectInvoicingStripeEpic = disconnectInvoicingStripeEpic;
|
|
65
64
|
const saveInvoicingSettingsEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(settingsViewReducer_1.saveInvoicingSettings.match), (0, operators_1.mergeMap)((action) => {
|
|
66
65
|
const apiUrl = `${zeniAPI.apiEndPoints.invoicingMicroServiceBaseUrl}/1.0/settings`;
|
|
67
|
-
const { settings, snackbarSection } = action.payload;
|
|
68
|
-
const snackbar = (messageText) => snackbarSection == null
|
|
69
|
-
? []
|
|
70
|
-
: [
|
|
71
|
-
(0, snackbarReducer_1.openSnackbar)({
|
|
72
|
-
messageSection: snackbarSection,
|
|
73
|
-
messageText,
|
|
74
|
-
type: messageText === 'success' ? 'success' : 'error',
|
|
75
|
-
}),
|
|
76
|
-
];
|
|
77
66
|
return zeniAPI
|
|
78
|
-
.putAndGetJSON(apiUrl, {
|
|
67
|
+
.putAndGetJSON(apiUrl, {
|
|
68
|
+
...action.payload,
|
|
69
|
+
})
|
|
79
70
|
.pipe((0, operators_1.switchMap)((response) => {
|
|
80
71
|
if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
|
|
81
|
-
return (0, rxjs_1.
|
|
82
|
-
(0, settingsViewReducer_1.saveInvoicingSettingsSuccess)(response.data),
|
|
83
|
-
...snackbar('success'),
|
|
84
|
-
]);
|
|
72
|
+
return (0, rxjs_1.of)((0, settingsViewReducer_1.saveInvoicingSettingsSuccess)(response.data));
|
|
85
73
|
}
|
|
86
|
-
return (0, rxjs_1.
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
]);
|
|
90
|
-
}), (0, operators_1.catchError)((error) => (0, rxjs_1.from)([
|
|
91
|
-
(0, settingsViewReducer_1.saveInvoicingSettingsFailure)((0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Save settings REST API call errored out ' +
|
|
92
|
-
JSON.stringify(error))),
|
|
93
|
-
...snackbar('failed'),
|
|
94
|
-
])));
|
|
74
|
+
return (0, rxjs_1.of)((0, settingsViewReducer_1.saveInvoicingSettingsFailure)(response.status));
|
|
75
|
+
}), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, settingsViewReducer_1.saveInvoicingSettingsFailure)((0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Save settings REST API call errored out ' +
|
|
76
|
+
JSON.stringify(error))))));
|
|
95
77
|
}));
|
|
96
78
|
exports.saveInvoicingSettingsEpic = saveInvoicingSettingsEpic;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { InvoicingSettingsPayload } from '../../../entity/invoicing/invoicingCommonPayload';
|
|
2
|
-
import { SnackbarMessageSections } from '../../../entity/snackbar/snackbarTypes';
|
|
3
2
|
import { ZeniAPIStatus } from '../../../responsePayload';
|
|
4
3
|
import { InvoicingBrandingFormLocalData } from './invoicingBrandingFormConfig';
|
|
5
4
|
import { StripeConnectCredentials } from './settingsViewPayload';
|
|
@@ -8,16 +7,8 @@ export interface InvoicingStripeConnectionUpdate {
|
|
|
8
7
|
stripe_connected: boolean;
|
|
9
8
|
publishable_key?: string;
|
|
10
9
|
}
|
|
11
|
-
/**
|
|
12
|
-
* `settings` is the request body; `snackbarSection` only picks which snackbar the
|
|
13
|
-
* epic raises, so it is deliberately kept out of the payload sent to the API.
|
|
14
|
-
*/
|
|
15
|
-
export interface SaveInvoicingSettingsPayload {
|
|
16
|
-
settings: Partial<InvoicingSettingsPayload>;
|
|
17
|
-
snackbarSection?: SnackbarMessageSections;
|
|
18
|
-
}
|
|
19
10
|
export declare const initialState: InvoicingSettingsViewState;
|
|
20
|
-
export declare const fetchInvoicingSettings: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"invoicingSettingsView/fetchInvoicingSettings">, updateInvoicingSettings: import("@reduxjs/toolkit").ActionCreatorWithPayload<InvoicingSettingsPayload, "invoicingSettingsView/updateInvoicingSettings">, updateInvoicingSettingsFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<ZeniAPIStatus<Record<string, unknown>>, "invoicingSettingsView/updateInvoicingSettingsFailure">, saveInvoicingSettings: import("@reduxjs/toolkit").ActionCreatorWithPayload<
|
|
11
|
+
export declare const fetchInvoicingSettings: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"invoicingSettingsView/fetchInvoicingSettings">, updateInvoicingSettings: import("@reduxjs/toolkit").ActionCreatorWithPayload<InvoicingSettingsPayload, "invoicingSettingsView/updateInvoicingSettings">, updateInvoicingSettingsFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<ZeniAPIStatus<Record<string, unknown>>, "invoicingSettingsView/updateInvoicingSettingsFailure">, saveInvoicingSettings: import("@reduxjs/toolkit").ActionCreatorWithPayload<Partial<InvoicingSettingsPayload>, "invoicingSettingsView/saveInvoicingSettings">, saveInvoicingSettingsSuccess: import("@reduxjs/toolkit").ActionCreatorWithPayload<InvoicingSettingsPayload, "invoicingSettingsView/saveInvoicingSettingsSuccess">, saveInvoicingSettingsFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<ZeniAPIStatus<Record<string, unknown>>, "invoicingSettingsView/saveInvoicingSettingsFailure">, resetSaveInvoicingSettings: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"invoicingSettingsView/resetSaveInvoicingSettings">, updateInvoicingBrandingFormDraft: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
21
12
|
localData: InvoicingBrandingFormLocalData;
|
|
22
13
|
}, "invoicingSettingsView/updateInvoicingBrandingFormDraft">, submitInvoicingBrandingForm: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"invoicingSettingsView/submitInvoicingBrandingForm">, resetInvoicingBrandingFormDraft: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"invoicingSettingsView/resetInvoicingBrandingFormDraft">, connectInvoicingStripe: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[credentials: StripeConnectCredentials], StripeConnectCredentials, "invoicingSettingsView/connectInvoicingStripe", never, never>, disconnectInvoicingStripe: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"invoicingSettingsView/disconnectInvoicingStripe">, updateInvoicingStripeConnection: import("@reduxjs/toolkit").ActionCreatorWithPayload<InvoicingStripeConnectionUpdate, "invoicingSettingsView/updateInvoicingStripeConnection">, invoicingStripeConnectionFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<ZeniAPIStatus<Record<string, unknown>>, "invoicingSettingsView/invoicingStripeConnectionFailure">, clearInvoicingSettings: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"invoicingSettingsView/clearInvoicingSettings">;
|
|
23
14
|
declare const _default: import("redux").Reducer<InvoicingSettingsViewState>;
|
|
@@ -34,7 +34,7 @@ const settingsView = (0, toolkit_1.createSlice)({
|
|
|
34
34
|
saveInvoicingSettings(draft, action) {
|
|
35
35
|
draft.saveFetchState = { fetchState: 'In-Progress', error: undefined };
|
|
36
36
|
if (draft.settings != null) {
|
|
37
|
-
draft.settings = { ...draft.settings, ...action.payload
|
|
37
|
+
draft.settings = { ...draft.settings, ...action.payload };
|
|
38
38
|
}
|
|
39
39
|
},
|
|
40
40
|
saveInvoicingSettingsSuccess(draft, action) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { FetchState, FetchStateAndError } from '../../../commonStateTypes/common';
|
|
2
|
-
import {
|
|
2
|
+
import { InvoicingSettingsPayload } from '../../../entity/invoicing/invoicingCommonPayload';
|
|
3
3
|
import { RootState } from '../../../reducer';
|
|
4
4
|
import { ZeniAPIStatus } from '../../../responsePayload';
|
|
5
5
|
import { InvoicingBrandingFormLocalData } from './invoicingBrandingFormConfig';
|
|
@@ -28,7 +28,6 @@ export interface InvoicingSettingsView {
|
|
|
28
28
|
*/
|
|
29
29
|
export declare const getInvoicingSettingsView: (state: RootState) => InvoicingSettingsView;
|
|
30
30
|
export interface InvoicingBrandingFormView {
|
|
31
|
-
dateFormatOptions: InvoicingNamedOption[];
|
|
32
31
|
localData: InvoicingBrandingFormLocalData;
|
|
33
32
|
saveState: FetchStateAndError;
|
|
34
33
|
addressLabel?: string;
|
|
@@ -38,7 +37,6 @@ export interface InvoicingBrandingFormView {
|
|
|
38
37
|
* Bundled view for the branding settings form: the draft `localData` (seeded
|
|
39
38
|
* from the existing settings until the user edits), the business-address label
|
|
40
39
|
* (from the shared Address screen, seeded on load from `address_id`), the raw
|
|
41
|
-
* settings (for the logo/preview)
|
|
42
|
-
* save fetch state.
|
|
40
|
+
* settings (for the logo/preview) and the save fetch state.
|
|
43
41
|
*/
|
|
44
42
|
export declare const getInvoicingBrandingFormView: (state: RootState) => InvoicingBrandingFormView;
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getInvoicingBrandingFormView = exports.getInvoicingSettingsView = exports.getInvoicingSettingsFetchState = exports.getInvoicingSettings = void 0;
|
|
4
4
|
const addressViewSelector_1 = require("../../addressView/addressViewSelector");
|
|
5
|
-
const invoicingConfigViewSelector_1 = require("../invoicingConfigView/invoicingConfigViewSelector");
|
|
6
5
|
const invoicingBrandingFormConfig_1 = require("./invoicingBrandingFormConfig");
|
|
7
6
|
/**
|
|
8
7
|
* Shared primitive: the raw invoicing settings. Consumed internally by other
|
|
@@ -40,8 +39,7 @@ exports.getInvoicingSettingsView = getInvoicingSettingsView;
|
|
|
40
39
|
* Bundled view for the branding settings form: the draft `localData` (seeded
|
|
41
40
|
* from the existing settings until the user edits), the business-address label
|
|
42
41
|
* (from the shared Address screen, seeded on load from `address_id`), the raw
|
|
43
|
-
* settings (for the logo/preview)
|
|
44
|
-
* save fetch state.
|
|
42
|
+
* settings (for the logo/preview) and the save fetch state.
|
|
45
43
|
*/
|
|
46
44
|
const getInvoicingBrandingFormView = (state) => {
|
|
47
45
|
const { brandingDraft, saveFetchState, settings } = state.invoicingSettingsViewState;
|
|
@@ -51,7 +49,6 @@ const getInvoicingBrandingFormView = (state) => {
|
|
|
51
49
|
: undefined;
|
|
52
50
|
return {
|
|
53
51
|
addressLabel,
|
|
54
|
-
dateFormatOptions: (0, invoicingConfigViewSelector_1.getInvoicingConfigView)(state).dateFormatOptions,
|
|
55
52
|
localData: brandingDraft ?? (0, invoicingBrandingFormConfig_1.entityToInvoicingBrandingFormLocalData)(settings),
|
|
56
53
|
saveState: saveFetchState,
|
|
57
54
|
settings,
|
|
@@ -2,9 +2,8 @@ import { ActionsObservable, StateObservable } from 'redux-observable';
|
|
|
2
2
|
import { Observable } from 'rxjs';
|
|
3
3
|
import { updateAddresses } from '../../../entity/address/addressReducer';
|
|
4
4
|
import { updateInvoicingSubscriptions } from '../../../entity/invoicing/invoicingSubscription/invoicingSubscriptionReducer';
|
|
5
|
-
import { openSnackbar } from '../../../entity/snackbar/snackbarReducer';
|
|
6
5
|
import { RootState } from '../../../reducer';
|
|
7
6
|
import { ZeniAPI } from '../../../zeniAPI';
|
|
8
7
|
import { runInvoicingSubscriptionAction, runInvoicingSubscriptionActionFailure, runInvoicingSubscriptionActionSuccess } from './subscriptionActionReducer';
|
|
9
|
-
export type ActionType = ReturnType<typeof runInvoicingSubscriptionAction> | ReturnType<typeof runInvoicingSubscriptionActionSuccess> | ReturnType<typeof runInvoicingSubscriptionActionFailure> | ReturnType<typeof updateAddresses> | ReturnType<typeof updateInvoicingSubscriptions
|
|
8
|
+
export type ActionType = ReturnType<typeof runInvoicingSubscriptionAction> | ReturnType<typeof runInvoicingSubscriptionActionSuccess> | ReturnType<typeof runInvoicingSubscriptionActionFailure> | ReturnType<typeof updateAddresses> | ReturnType<typeof updateInvoicingSubscriptions>;
|
|
10
9
|
export declare const runInvoicingSubscriptionActionEpic: (actions$: ActionsObservable<ActionType>, _state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
|