@zeniai/client-epic-state 5.1.86 → 5.1.87
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 +7 -0
- package/lib/entity/aiCfo/aiCfoReducer.d.ts +3 -2
- package/lib/entity/aiCfo/aiCfoReducer.js +25 -2
- package/lib/entity/aiCfo/aiCfoState.d.ts +7 -0
- package/lib/entity/customerSatisfaction/customerSatisfactionReducer.d.ts +1 -1
- package/lib/entity/customerSatisfaction/customerSatisfactionReducer.js +6 -2
- package/lib/entity/snackbar/snackbarTypes.d.ts +1 -1
- package/lib/entity/snackbar/snackbarTypes.js +29 -0
- package/lib/esm/entity/aiCfo/aiCfoReducer.js +23 -1
- package/lib/esm/entity/customerSatisfaction/customerSatisfactionReducer.js +4 -1
- package/lib/esm/entity/snackbar/snackbarTypes.js +29 -0
- package/lib/esm/index.js +2 -2
- package/lib/esm/view/companyHealthMetricView/companyHealthMetricConfigReducer.js +4 -1
- package/lib/esm/view/invoicing/createCreditNote/createCreditNoteEpic.js +24 -4
- package/lib/esm/view/invoicing/createInvoice/createInvoiceEpic.js +24 -4
- package/lib/esm/view/invoicing/createInvoice/createInvoiceSelector.js +37 -10
- package/lib/esm/view/invoicing/discountAction/discountActionEpic.js +33 -9
- package/lib/esm/view/invoicing/dunningAction/dunningActionEpic.js +35 -9
- package/lib/esm/view/invoicing/editInvoicingCatalogItemDetailView/catalogDetailEditPayload.js +5 -1
- package/lib/esm/view/invoicing/editInvoicingCatalogItemDetailView/saveInvoicingCatalogItemEpic.js +32 -5
- package/lib/esm/view/invoicing/editInvoicingCouponDetailView/saveInvoicingCouponEpic.js +23 -3
- package/lib/esm/view/invoicing/editInvoicingCustomerDetailView/saveInvoicingCustomerEpic.js +24 -4
- package/lib/esm/view/invoicing/editInvoicingSubscriptionDetailView/saveInvoicingSubscriptionEpic.js +24 -4
- package/lib/esm/view/invoicing/editInvoicingSubscriptionDetailView/syncInvoicingSubscriptionCouponsEpic.js +20 -3
- package/lib/esm/view/invoicing/invoiceAction/invoiceActionEpic.js +60 -17
- package/lib/esm/view/invoicing/invoicingConfigView/invoicingConfigViewReducer.js +30 -0
- package/lib/esm/view/invoicing/invoicingConfigView/invoicingConfigViewSelector.js +4 -29
- package/lib/esm/view/invoicing/invoicingQboView/epics/retryInvoicingQboSyncTaskEpic.js +29 -10
- package/lib/esm/view/invoicing/invoicingQboView/epics/startInvoicingQboBackfillEpic.js +28 -5
- package/lib/esm/view/invoicing/issueCreditNote/issueCreditNoteEpic.js +24 -4
- package/lib/esm/view/invoicing/issueCreditNote/issueCreditNoteSelector.js +22 -14
- package/lib/esm/view/invoicing/recordPayment/recordPaymentEpic.js +46 -7
- package/lib/esm/view/invoicing/settingsView/settingsViewEpics.js +26 -8
- package/lib/esm/view/invoicing/settingsView/settingsViewReducer.js +1 -1
- package/lib/esm/view/invoicing/settingsView/settingsViewSelector.js +4 -1
- package/lib/esm/view/invoicing/subscriptionAction/subscriptionActionEpic.js +41 -9
- package/lib/esm/view/vendorFiling1099/vendorFiling1099UploadDetails/vendorFiling1099UploadDetailsReducer.js +4 -1
- package/lib/esm/view/vendorTabView/vendorTabViewReducer.js +4 -1
- package/lib/index.d.ts +6 -5
- package/lib/index.js +7 -7
- package/lib/view/companyHealthMetricView/companyHealthMetricConfigReducer.d.ts +1 -1
- package/lib/view/companyHealthMetricView/companyHealthMetricConfigReducer.js +5 -2
- package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.d.ts +1 -1
- package/lib/view/invoicing/createCreditNote/createCreditNoteEpic.d.ts +2 -1
- package/lib/view/invoicing/createCreditNote/createCreditNoteEpic.js +23 -3
- package/lib/view/invoicing/createInvoice/createInvoiceEpic.d.ts +2 -1
- package/lib/view/invoicing/createInvoice/createInvoiceEpic.js +23 -3
- package/lib/view/invoicing/createInvoice/createInvoiceSelector.d.ts +22 -8
- package/lib/view/invoicing/createInvoice/createInvoiceSelector.js +37 -10
- package/lib/view/invoicing/discountAction/discountActionEpic.d.ts +2 -1
- package/lib/view/invoicing/discountAction/discountActionEpic.js +32 -8
- package/lib/view/invoicing/dunningAction/dunningActionEpic.d.ts +2 -1
- package/lib/view/invoicing/dunningAction/dunningActionEpic.js +34 -8
- package/lib/view/invoicing/editInvoicingCatalogItemDetailView/catalogDetailEditPayload.d.ts +3 -1
- package/lib/view/invoicing/editInvoicingCatalogItemDetailView/catalogDetailEditPayload.js +5 -1
- package/lib/view/invoicing/editInvoicingCatalogItemDetailView/saveInvoicingCatalogItemEpic.d.ts +2 -1
- package/lib/view/invoicing/editInvoicingCatalogItemDetailView/saveInvoicingCatalogItemEpic.js +31 -4
- package/lib/view/invoicing/editInvoicingCouponDetailView/saveInvoicingCouponEpic.d.ts +2 -1
- package/lib/view/invoicing/editInvoicingCouponDetailView/saveInvoicingCouponEpic.js +22 -2
- package/lib/view/invoicing/editInvoicingCustomerDetailView/saveInvoicingCustomerEpic.d.ts +2 -1
- package/lib/view/invoicing/editInvoicingCustomerDetailView/saveInvoicingCustomerEpic.js +23 -3
- package/lib/view/invoicing/editInvoicingSubscriptionDetailView/saveInvoicingSubscriptionEpic.d.ts +2 -1
- package/lib/view/invoicing/editInvoicingSubscriptionDetailView/saveInvoicingSubscriptionEpic.js +23 -3
- package/lib/view/invoicing/editInvoicingSubscriptionDetailView/syncInvoicingSubscriptionCouponsEpic.d.ts +2 -1
- package/lib/view/invoicing/editInvoicingSubscriptionDetailView/syncInvoicingSubscriptionCouponsEpic.js +19 -2
- package/lib/view/invoicing/invoiceAction/invoiceActionEpic.d.ts +2 -1
- package/lib/view/invoicing/invoiceAction/invoiceActionEpic.js +59 -16
- package/lib/view/invoicing/invoicingConfigView/invoicingConfigViewPayload.d.ts +13 -0
- package/lib/view/invoicing/invoicingConfigView/invoicingConfigViewReducer.d.ts +1 -1
- package/lib/view/invoicing/invoicingConfigView/invoicingConfigViewReducer.js +30 -0
- package/lib/view/invoicing/invoicingConfigView/invoicingConfigViewSelector.d.ts +11 -31
- package/lib/view/invoicing/invoicingConfigView/invoicingConfigViewSelector.js +4 -29
- package/lib/view/invoicing/invoicingConfigView/invoicingConfigViewState.d.ts +15 -0
- package/lib/view/invoicing/invoicingQboView/epics/invoicingQboViewActionType.d.ts +2 -1
- package/lib/view/invoicing/invoicingQboView/epics/retryInvoicingQboSyncTaskEpic.js +28 -9
- package/lib/view/invoicing/invoicingQboView/epics/startInvoicingQboBackfillEpic.js +27 -4
- package/lib/view/invoicing/issueCreditNote/issueCreditNoteEpic.d.ts +2 -1
- package/lib/view/invoicing/issueCreditNote/issueCreditNoteEpic.js +23 -3
- package/lib/view/invoicing/issueCreditNote/issueCreditNoteSelector.d.ts +24 -7
- package/lib/view/invoicing/issueCreditNote/issueCreditNoteSelector.js +23 -16
- package/lib/view/invoicing/recordPayment/recordPaymentEpic.d.ts +2 -1
- package/lib/view/invoicing/recordPayment/recordPaymentEpic.js +45 -6
- package/lib/view/invoicing/settingsView/settingsViewEpics.d.ts +2 -1
- package/lib/view/invoicing/settingsView/settingsViewEpics.js +25 -7
- package/lib/view/invoicing/settingsView/settingsViewReducer.d.ts +10 -1
- package/lib/view/invoicing/settingsView/settingsViewReducer.js +1 -1
- package/lib/view/invoicing/settingsView/settingsViewSelector.d.ts +4 -2
- package/lib/view/invoicing/settingsView/settingsViewSelector.js +4 -1
- package/lib/view/invoicing/subscriptionAction/subscriptionActionEpic.d.ts +2 -1
- package/lib/view/invoicing/subscriptionAction/subscriptionActionEpic.js +40 -8
- package/lib/view/vendorFiling1099/vendorFiling1099UploadDetails/vendorFiling1099UploadDetailsReducer.d.ts +1 -1
- package/lib/view/vendorFiling1099/vendorFiling1099UploadDetails/vendorFiling1099UploadDetailsReducer.js +5 -2
- package/lib/view/vendorTabView/vendorTabViewReducer.d.ts +1 -1
- package/lib/view/vendorTabView/vendorTabViewReducer.js +5 -2
- package/package.json +1 -1
- package/lib/__testHelpers__/apiFailure.json +0 -6
- package/lib/entity/vendor/__mocks__/vendorMock.d.ts +0 -7
- package/lib/entity/vendor/__mocks__/vendorMock.js +0 -311
- package/lib/entity/vendor/__mocks__/vendorStateMocks.d.ts +0 -8
- package/lib/entity/vendor/__mocks__/vendorStateMocks.js +0 -415
- package/lib/view/accountMappingView/__mocks__/accountMappingSelectorMock.d.ts +0 -11
- package/lib/view/accountMappingView/__mocks__/accountMappingSelectorMock.js +0 -4659
- package/lib/view/addressView/__mocks__/addressViewMocks.d.ts +0 -35
- package/lib/view/addressView/__mocks__/addressViewMocks.js +0 -239
- package/lib/view/addressView/__mocks__/json/createAddressResponse.json +0 -23
- package/lib/view/addressView/__mocks__/json/createCompanyAddressSuccess.json +0 -258
- package/lib/view/addressView/__mocks__/json/createCompanyUserAddressSuccess.json +0 -418
- package/lib/view/addressView/__mocks__/json/fetchAddressResponse.json +0 -24
- package/lib/view/addressView/__mocks__/json/updateAddressResponse.json +0 -24
package/lib/view/invoicing/editInvoicingSubscriptionDetailView/saveInvoicingSubscriptionEpic.js
CHANGED
|
@@ -6,6 +6,7 @@ const operators_1 = require("rxjs/operators");
|
|
|
6
6
|
const addressReducer_1 = require("../../../entity/address/addressReducer");
|
|
7
7
|
const invoicingSubscriptionPayload_1 = require("../../../entity/invoicing/invoicingSubscription/invoicingSubscriptionPayload");
|
|
8
8
|
const invoicingSubscriptionReducer_1 = require("../../../entity/invoicing/invoicingSubscription/invoicingSubscriptionReducer");
|
|
9
|
+
const snackbarReducer_1 = require("../../../entity/snackbar/snackbarReducer");
|
|
9
10
|
const responsePayload_1 = require("../../../responsePayload");
|
|
10
11
|
const addressViewReducer_1 = require("../../addressView/addressViewReducer");
|
|
11
12
|
const invoicingSubscriptionListViewReducer_1 = require("../invoicingSubscriptionListView/invoicingSubscriptionListViewReducer");
|
|
@@ -41,7 +42,14 @@ const saveInvoicingSubscriptionEpic = (actions$, state$, zeniAPI) => actions$.pi
|
|
|
41
42
|
: zeniAPI.postAndGetJSON(`${baseUrl}/subscriptions`, { ...data });
|
|
42
43
|
return request$.pipe((0, operators_1.mergeMap)((response) => {
|
|
43
44
|
if (!(0, responsePayload_1.isSuccessResponse)(response) || response.data == null) {
|
|
44
|
-
return [
|
|
45
|
+
return [
|
|
46
|
+
(0, editInvoicingSubscriptionDetailViewReducer_1.submitInvoicingSubscriptionFormFailure)(response.status),
|
|
47
|
+
(0, snackbarReducer_1.openSnackbar)({
|
|
48
|
+
messageSection: 'invoicing_subscription_saved',
|
|
49
|
+
messageText: 'failed',
|
|
50
|
+
type: 'error',
|
|
51
|
+
}),
|
|
52
|
+
];
|
|
45
53
|
}
|
|
46
54
|
const saved = response.data;
|
|
47
55
|
const couponChanged = id != null &&
|
|
@@ -81,8 +89,20 @@ const saveInvoicingSubscriptionEpic = (actions$, state$, zeniAPI) => actions$.pi
|
|
|
81
89
|
status: saved.status,
|
|
82
90
|
}));
|
|
83
91
|
}
|
|
92
|
+
resultActions.push((0, snackbarReducer_1.openSnackbar)({
|
|
93
|
+
messageSection: 'invoicing_subscription_saved',
|
|
94
|
+
messageText: 'success',
|
|
95
|
+
type: 'success',
|
|
96
|
+
}));
|
|
84
97
|
return resultActions;
|
|
85
|
-
}), (0, operators_1.catchError)((error) => (0, rxjs_1.
|
|
86
|
-
|
|
98
|
+
}), (0, operators_1.catchError)((error) => (0, rxjs_1.from)([
|
|
99
|
+
(0, editInvoicingSubscriptionDetailViewReducer_1.submitInvoicingSubscriptionFormFailure)((0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Save subscription REST API call errored out ' +
|
|
100
|
+
JSON.stringify(error))),
|
|
101
|
+
(0, snackbarReducer_1.openSnackbar)({
|
|
102
|
+
messageSection: 'invoicing_subscription_saved',
|
|
103
|
+
messageText: 'failed',
|
|
104
|
+
type: 'error',
|
|
105
|
+
}),
|
|
106
|
+
])));
|
|
87
107
|
}));
|
|
88
108
|
exports.saveInvoicingSubscriptionEpic = saveInvoicingSubscriptionEpic;
|
|
@@ -2,11 +2,12 @@ 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';
|
|
5
6
|
import { RootState } from '../../../reducer';
|
|
6
7
|
import { ZeniAPI } from '../../../zeniAPI';
|
|
7
8
|
import { resetNewAddressDataInLocalStore } from '../../addressView/addressViewReducer';
|
|
8
9
|
import { submitInvoicingSubscriptionFormFailure, submitInvoicingSubscriptionFormSuccess, syncInvoicingSubscriptionCoupons } from './editInvoicingSubscriptionDetailViewReducer';
|
|
9
|
-
export type ActionType = ReturnType<typeof syncInvoicingSubscriptionCoupons> | ReturnType<typeof submitInvoicingSubscriptionFormSuccess> | ReturnType<typeof submitInvoicingSubscriptionFormFailure> | ReturnType<typeof resetNewAddressDataInLocalStore> | ReturnType<typeof updateAddresses> | ReturnType<typeof updateInvoicingSubscriptions>;
|
|
10
|
+
export type ActionType = ReturnType<typeof syncInvoicingSubscriptionCoupons> | ReturnType<typeof submitInvoicingSubscriptionFormSuccess> | ReturnType<typeof submitInvoicingSubscriptionFormFailure> | ReturnType<typeof resetNewAddressDataInLocalStore> | ReturnType<typeof updateAddresses> | ReturnType<typeof updateInvoicingSubscriptions> | ReturnType<typeof openSnackbar>;
|
|
10
11
|
/**
|
|
11
12
|
* After a commercial PUT, sync coupon attach/detach via dedicated endpoints
|
|
12
13
|
* (PUT does not replace coupons). Runs remove-then-apply; on success finishes
|
|
@@ -6,6 +6,7 @@ const operators_1 = require("rxjs/operators");
|
|
|
6
6
|
const addressReducer_1 = require("../../../entity/address/addressReducer");
|
|
7
7
|
const invoicingSubscriptionPayload_1 = require("../../../entity/invoicing/invoicingSubscription/invoicingSubscriptionPayload");
|
|
8
8
|
const invoicingSubscriptionReducer_1 = require("../../../entity/invoicing/invoicingSubscription/invoicingSubscriptionReducer");
|
|
9
|
+
const snackbarReducer_1 = require("../../../entity/snackbar/snackbarReducer");
|
|
9
10
|
const responsePayload_1 = require("../../../responsePayload");
|
|
10
11
|
const addressViewReducer_1 = require("../../addressView/addressViewReducer");
|
|
11
12
|
const editInvoicingSubscriptionDetailViewReducer_1 = require("./editInvoicingSubscriptionDetailViewReducer");
|
|
@@ -42,7 +43,14 @@ const syncInvoicingSubscriptionCouponsEpic = (actions$, _state$, zeniAPI) => act
|
|
|
42
43
|
: couponMutation$(zeniAPI, baseUrl, subscriptionId, 'remove-coupon', prev);
|
|
43
44
|
return removeStep$.pipe((0, operators_1.mergeMap)((removeResult) => {
|
|
44
45
|
if (!removeResult.success) {
|
|
45
|
-
return (0, rxjs_1.
|
|
46
|
+
return (0, rxjs_1.from)([
|
|
47
|
+
(0, editInvoicingSubscriptionDetailViewReducer_1.submitInvoicingSubscriptionFormFailure)(failureStatus(removeResult)),
|
|
48
|
+
(0, snackbarReducer_1.openSnackbar)({
|
|
49
|
+
messageSection: 'invoicing_subscription_saved',
|
|
50
|
+
messageText: 'failed',
|
|
51
|
+
type: 'error',
|
|
52
|
+
}),
|
|
53
|
+
]);
|
|
46
54
|
}
|
|
47
55
|
const applyStep$ = next === ''
|
|
48
56
|
? (0, rxjs_1.of)({
|
|
@@ -54,6 +62,11 @@ const syncInvoicingSubscriptionCouponsEpic = (actions$, _state$, zeniAPI) => act
|
|
|
54
62
|
if (!applyResult.success) {
|
|
55
63
|
return [
|
|
56
64
|
(0, editInvoicingSubscriptionDetailViewReducer_1.submitInvoicingSubscriptionFormFailure)(failureStatus(applyResult)),
|
|
65
|
+
(0, snackbarReducer_1.openSnackbar)({
|
|
66
|
+
messageSection: 'invoicing_subscription_saved',
|
|
67
|
+
messageText: 'failed',
|
|
68
|
+
type: 'error',
|
|
69
|
+
}),
|
|
57
70
|
];
|
|
58
71
|
}
|
|
59
72
|
const couponUpdated = applyResult.payload ?? removeResult.payload;
|
|
@@ -61,7 +74,11 @@ const syncInvoicingSubscriptionCouponsEpic = (actions$, _state$, zeniAPI) => act
|
|
|
61
74
|
if (couponUpdated != null) {
|
|
62
75
|
resultActions.push((0, invoicingSubscriptionReducer_1.updateInvoicingSubscriptions)([couponUpdated], 'merge'), (0, addressReducer_1.updateAddresses)((0, invoicingSubscriptionPayload_1.extractInvoicingSubscriptionAddresses)([couponUpdated])));
|
|
63
76
|
}
|
|
64
|
-
resultActions.push((0, editInvoicingSubscriptionDetailViewReducer_1.submitInvoicingSubscriptionFormSuccess)({ subscriptionId }), (0, addressViewReducer_1.resetNewAddressDataInLocalStore)(invoicingSubscriptionFormConfig_1.INVOICING_SUBSCRIPTION_SHIPPING_ADDRESS_TYPE))
|
|
77
|
+
resultActions.push((0, editInvoicingSubscriptionDetailViewReducer_1.submitInvoicingSubscriptionFormSuccess)({ subscriptionId }), (0, addressViewReducer_1.resetNewAddressDataInLocalStore)(invoicingSubscriptionFormConfig_1.INVOICING_SUBSCRIPTION_SHIPPING_ADDRESS_TYPE), (0, snackbarReducer_1.openSnackbar)({
|
|
78
|
+
messageSection: 'invoicing_subscription_saved',
|
|
79
|
+
messageText: 'success',
|
|
80
|
+
type: 'success',
|
|
81
|
+
}));
|
|
65
82
|
return resultActions;
|
|
66
83
|
}));
|
|
67
84
|
}));
|
|
@@ -2,9 +2,10 @@ import { ActionsObservable, StateObservable } from 'redux-observable';
|
|
|
2
2
|
import { Observable } from 'rxjs';
|
|
3
3
|
import { updateAddresses } from '../../../entity/address/addressReducer';
|
|
4
4
|
import { updateInvoices } from '../../../entity/invoicing/invoice/invoiceReducer';
|
|
5
|
+
import { openSnackbar } from '../../../entity/snackbar/snackbarReducer';
|
|
5
6
|
import { RootState } from '../../../reducer';
|
|
6
7
|
import { ZeniAPI } from '../../../zeniAPI';
|
|
7
8
|
import { runInvoicingInvoiceAction, runInvoicingInvoiceActionFailure, runInvoicingInvoiceActionSuccess, updateInvoicingInvoice } from './invoiceActionReducer';
|
|
8
|
-
export type ActionType = ReturnType<typeof runInvoicingInvoiceAction> | ReturnType<typeof runInvoicingInvoiceActionSuccess> | ReturnType<typeof runInvoicingInvoiceActionFailure> | ReturnType<typeof updateInvoicingInvoice> | ReturnType<typeof updateAddresses> | ReturnType<typeof updateInvoices>;
|
|
9
|
+
export type ActionType = ReturnType<typeof runInvoicingInvoiceAction> | ReturnType<typeof runInvoicingInvoiceActionSuccess> | ReturnType<typeof runInvoicingInvoiceActionFailure> | ReturnType<typeof updateInvoicingInvoice> | ReturnType<typeof updateAddresses> | ReturnType<typeof updateInvoices> | ReturnType<typeof openSnackbar>;
|
|
9
10
|
export declare const runInvoicingInvoiceActionEpic: (actions$: ActionsObservable<ActionType>, _state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
|
|
10
11
|
export declare const updateInvoicingInvoiceEpic: (actions$: ActionsObservable<ActionType>, _state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
|
|
@@ -6,11 +6,28 @@ const operators_1 = require("rxjs/operators");
|
|
|
6
6
|
const addressReducer_1 = require("../../../entity/address/addressReducer");
|
|
7
7
|
const invoicePayload_1 = require("../../../entity/invoicing/invoice/invoicePayload");
|
|
8
8
|
const invoiceReducer_1 = require("../../../entity/invoicing/invoice/invoiceReducer");
|
|
9
|
+
const snackbarReducer_1 = require("../../../entity/snackbar/snackbarReducer");
|
|
9
10
|
const responsePayload_1 = require("../../../responsePayload");
|
|
10
11
|
const invoiceActionReducer_1 = require("./invoiceActionReducer");
|
|
12
|
+
/** Snackbar copy per action kind; unlisted kinds run without one. */
|
|
13
|
+
const SNACKBAR_SECTION_BY_KIND = {
|
|
14
|
+
regenerate: 'invoicing_invoice_regenerated',
|
|
15
|
+
'send-reminder': 'invoicing_invoice_reminder_sent',
|
|
16
|
+
void: 'invoicing_invoice_voided',
|
|
17
|
+
};
|
|
11
18
|
const runInvoicingInvoiceActionEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)((action) => invoiceActionReducer_1.runInvoicingInvoiceAction.match(action) &&
|
|
12
19
|
action.payload.action !== 'issue-credit-note'), (0, operators_1.mergeMap)((action) => {
|
|
13
20
|
const { action: kind, body, invoiceId } = action.payload;
|
|
21
|
+
const snackbarSection = SNACKBAR_SECTION_BY_KIND[kind];
|
|
22
|
+
const snackbar = (messageText) => snackbarSection == null
|
|
23
|
+
? []
|
|
24
|
+
: [
|
|
25
|
+
(0, snackbarReducer_1.openSnackbar)({
|
|
26
|
+
messageSection: snackbarSection,
|
|
27
|
+
messageText,
|
|
28
|
+
type: messageText === 'success' ? 'success' : 'error',
|
|
29
|
+
}),
|
|
30
|
+
];
|
|
14
31
|
const apiUrl = `${zeniAPI.apiEndPoints.invoicingMicroServiceBaseUrl}/1.0/invoices/${encodeURIComponent(invoiceId)}/${kind}`;
|
|
15
32
|
return zeniAPI
|
|
16
33
|
.postAndGetJSON(apiUrl, (body ?? {}))
|
|
@@ -20,17 +37,24 @@ const runInvoicingInvoiceActionEpic = (actions$, _state$, zeniAPI) => actions$.p
|
|
|
20
37
|
(0, invoiceReducer_1.updateInvoices)([response.data], 'merge'),
|
|
21
38
|
(0, addressReducer_1.updateAddresses)((0, invoicePayload_1.extractInvoicingInvoiceAddresses)([response.data])),
|
|
22
39
|
(0, invoiceActionReducer_1.runInvoicingInvoiceActionSuccess)({ invoiceId }),
|
|
40
|
+
...snackbar('success'),
|
|
23
41
|
];
|
|
24
42
|
}
|
|
25
|
-
return (0, rxjs_1.
|
|
26
|
-
|
|
43
|
+
return (0, rxjs_1.from)([
|
|
44
|
+
(0, invoiceActionReducer_1.runInvoicingInvoiceActionFailure)({
|
|
45
|
+
error: response.status,
|
|
46
|
+
invoiceId,
|
|
47
|
+
}),
|
|
48
|
+
...snackbar('failed'),
|
|
49
|
+
]);
|
|
50
|
+
}), (0, operators_1.catchError)((error) => (0, rxjs_1.from)([
|
|
51
|
+
(0, invoiceActionReducer_1.runInvoicingInvoiceActionFailure)({
|
|
52
|
+
error: (0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Invoice action REST API call errored out ' +
|
|
53
|
+
JSON.stringify(error)),
|
|
27
54
|
invoiceId,
|
|
28
|
-
})
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
JSON.stringify(error)),
|
|
32
|
-
invoiceId,
|
|
33
|
-
}))));
|
|
55
|
+
}),
|
|
56
|
+
...snackbar('failed'),
|
|
57
|
+
])));
|
|
34
58
|
}));
|
|
35
59
|
exports.runInvoicingInvoiceActionEpic = runInvoicingInvoiceActionEpic;
|
|
36
60
|
const updateInvoicingInvoiceEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(invoiceActionReducer_1.updateInvoicingInvoice.match), (0, operators_1.mergeMap)((action) => {
|
|
@@ -44,16 +68,35 @@ const updateInvoicingInvoiceEpic = (actions$, _state$, zeniAPI) => actions$.pipe
|
|
|
44
68
|
(0, invoiceReducer_1.updateInvoices)([response.data], 'merge'),
|
|
45
69
|
(0, addressReducer_1.updateAddresses)((0, invoicePayload_1.extractInvoicingInvoiceAddresses)([response.data])),
|
|
46
70
|
(0, invoiceActionReducer_1.runInvoicingInvoiceActionSuccess)({ invoiceId }),
|
|
71
|
+
(0, snackbarReducer_1.openSnackbar)({
|
|
72
|
+
messageSection: 'invoicing_invoice_saved',
|
|
73
|
+
messageText: 'success',
|
|
74
|
+
type: 'success',
|
|
75
|
+
}),
|
|
47
76
|
];
|
|
48
77
|
}
|
|
49
|
-
return (0, rxjs_1.
|
|
50
|
-
|
|
78
|
+
return (0, rxjs_1.from)([
|
|
79
|
+
(0, invoiceActionReducer_1.runInvoicingInvoiceActionFailure)({
|
|
80
|
+
error: response.status,
|
|
81
|
+
invoiceId,
|
|
82
|
+
}),
|
|
83
|
+
(0, snackbarReducer_1.openSnackbar)({
|
|
84
|
+
messageSection: 'invoicing_invoice_saved',
|
|
85
|
+
messageText: 'failed',
|
|
86
|
+
type: 'error',
|
|
87
|
+
}),
|
|
88
|
+
]);
|
|
89
|
+
}), (0, operators_1.catchError)((error) => (0, rxjs_1.from)([
|
|
90
|
+
(0, invoiceActionReducer_1.runInvoicingInvoiceActionFailure)({
|
|
91
|
+
error: (0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Invoice update REST API call errored out ' +
|
|
92
|
+
JSON.stringify(error)),
|
|
51
93
|
invoiceId,
|
|
52
|
-
})
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
94
|
+
}),
|
|
95
|
+
(0, snackbarReducer_1.openSnackbar)({
|
|
96
|
+
messageSection: 'invoicing_invoice_saved',
|
|
97
|
+
messageText: 'failed',
|
|
98
|
+
type: 'error',
|
|
99
|
+
}),
|
|
100
|
+
])));
|
|
58
101
|
}));
|
|
59
102
|
exports.updateInvoicingInvoiceEpic = updateInvoicingInvoiceEpic;
|
|
@@ -21,15 +21,28 @@ export interface InvoicingConfigPayload {
|
|
|
21
21
|
subscription_edit_field_options: InvoicingSubscriptionEditFieldOptionWire[];
|
|
22
22
|
subscription_lifecycle_action_options: InvoicingSubscriptionLifecycleActionOptionWire[];
|
|
23
23
|
subscription_metadata_edit_allowed_from_statuses: string[];
|
|
24
|
+
auto_collection_options?: InvoicingNamedOptionWire[];
|
|
25
|
+
billing_period_unit_options?: InvoicingNamedOptionWire[];
|
|
26
|
+
catalog_trial_end_action_options?: InvoicingNamedOptionWire[];
|
|
27
|
+
catalog_trial_unit_options?: InvoicingNamedOptionWire[];
|
|
24
28
|
created_at?: string | null;
|
|
29
|
+
customer_type_options?: InvoicingNamedOptionWire[];
|
|
30
|
+
date_format_options?: InvoicingNamedOptionWire[];
|
|
31
|
+
discount_apply_on_options?: InvoicingNamedOptionWire[];
|
|
32
|
+
discount_duration_type_options?: InvoicingNamedOptionWire[];
|
|
33
|
+
discount_type_options?: InvoicingNamedOptionWire[];
|
|
25
34
|
invoicing_tos_acceptance_ip?: string | null;
|
|
26
35
|
invoicing_tos_acceptance_time?: string | null;
|
|
27
36
|
invoicing_tos_acceptance_user_agent?: string | null;
|
|
28
37
|
invoicing_tos_acceptance_user_id?: string | null;
|
|
29
38
|
is_invoicing_settings_seeded?: boolean;
|
|
39
|
+
manual_payment_method_options?: InvoicingNamedOptionWire[];
|
|
40
|
+
net_term_day_options?: InvoicingNamedOptionWire[];
|
|
41
|
+
payment_gateway_options?: InvoicingNamedOptionWire[];
|
|
30
42
|
qbo_account_mapping_kind_options?: InvoicingQboAccountMappingKindOptionWire[];
|
|
31
43
|
qbo_customer_matching_options?: InvoicingNamedOptionWire[];
|
|
32
44
|
qbo_sync_status_options?: InvoicingNamedOptionWire[];
|
|
45
|
+
taxability_options?: InvoicingNamedOptionWire[];
|
|
33
46
|
updated_at?: string | null;
|
|
34
47
|
}
|
|
35
48
|
export type InvoicingConfigResponse = ZeniAPIResponse<InvoicingConfigPayload>;
|
|
@@ -2,7 +2,7 @@ import { ZeniAPIStatus } from '../../../responsePayload';
|
|
|
2
2
|
import { InvoicingConfigPayload } from './invoicingConfigViewPayload';
|
|
3
3
|
import { InvoicingConfigViewState } from './invoicingConfigViewState';
|
|
4
4
|
export declare const initialState: InvoicingConfigViewState;
|
|
5
|
-
export declare function mapInvoicingConfigPayloadToState(payload: InvoicingConfigPayload): Pick<InvoicingConfigViewState, 'auditLogEntityRouteOptions' | 'auditLogListSortFieldOptions' | 'auditLogSourceLabels' | 'dunningScheduleActionOptions' | 'subscriptionLifecycleActionOptions' | 'subscriptionCommercialEditAllowedFromStatuses' | 'subscriptionMetadataEditAllowedFromStatuses' | 'subscriptionEditFieldOptions' | 'subscriptionCancelTimingOptions' | 'subscriptionChangeOptionOptions' | 'catalogItemLifecycleActionOptions' | 'catalogProductLifecycleActionOptions' | 'discountLifecycleActionOptions' | 'qboAccountMappingKindOptions' | 'qboCustomerMatchingOptions' | 'qboSyncStatusOptions' | 'isInvoicingEnabled' | 'isInvoicingTosAccepted' | 'invoicingTosAcceptanceIp' | 'invoicingTosAcceptanceTime' | 'invoicingTosAcceptanceUserAgent' | 'invoicingTosAcceptanceUserId' | 'isInvoicingSettingsSeeded'>;
|
|
5
|
+
export declare function mapInvoicingConfigPayloadToState(payload: InvoicingConfigPayload): Pick<InvoicingConfigViewState, 'auditLogEntityRouteOptions' | 'auditLogListSortFieldOptions' | 'auditLogSourceLabels' | 'autoCollectionOptions' | 'billingPeriodUnitOptions' | 'catalogTrialEndActionOptions' | 'catalogTrialUnitOptions' | 'customerTypeOptions' | 'dateFormatOptions' | 'discountApplyOnOptions' | 'discountDurationTypeOptions' | 'discountTypeOptions' | 'manualPaymentMethodOptions' | 'netTermDayOptions' | 'paymentGatewayOptions' | 'taxabilityOptions' | 'createdAt' | 'updatedAt' | 'dunningScheduleActionOptions' | 'subscriptionLifecycleActionOptions' | 'subscriptionCommercialEditAllowedFromStatuses' | 'subscriptionMetadataEditAllowedFromStatuses' | 'subscriptionEditFieldOptions' | 'subscriptionCancelTimingOptions' | 'subscriptionChangeOptionOptions' | 'catalogItemLifecycleActionOptions' | 'catalogProductLifecycleActionOptions' | 'discountLifecycleActionOptions' | 'qboAccountMappingKindOptions' | 'qboCustomerMatchingOptions' | 'qboSyncStatusOptions' | 'isInvoicingEnabled' | 'isInvoicingTosAccepted' | 'invoicingTosAcceptanceIp' | 'invoicingTosAcceptanceTime' | 'invoicingTosAcceptanceUserAgent' | 'invoicingTosAcceptanceUserId' | 'isInvoicingSettingsSeeded'>;
|
|
6
6
|
export declare const fetchInvoicingConfig: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[payload?: {
|
|
7
7
|
cacheOverride?: boolean;
|
|
8
8
|
} | undefined], {
|
|
@@ -13,7 +13,20 @@ exports.initialState = {
|
|
|
13
13
|
auditLogEntityRouteOptions: [],
|
|
14
14
|
auditLogListSortFieldOptions: [],
|
|
15
15
|
auditLogSourceLabels: [],
|
|
16
|
+
autoCollectionOptions: [],
|
|
17
|
+
billingPeriodUnitOptions: [],
|
|
18
|
+
catalogTrialEndActionOptions: [],
|
|
19
|
+
catalogTrialUnitOptions: [],
|
|
20
|
+
customerTypeOptions: [],
|
|
21
|
+
dateFormatOptions: [],
|
|
22
|
+
discountApplyOnOptions: [],
|
|
23
|
+
discountDurationTypeOptions: [],
|
|
24
|
+
discountTypeOptions: [],
|
|
16
25
|
dunningScheduleActionOptions: [],
|
|
26
|
+
manualPaymentMethodOptions: [],
|
|
27
|
+
netTermDayOptions: [],
|
|
28
|
+
paymentGatewayOptions: [],
|
|
29
|
+
taxabilityOptions: [],
|
|
17
30
|
enableFetchState: { fetchState: 'Not-Started', error: undefined },
|
|
18
31
|
subscriptionLifecycleActionOptions: [],
|
|
19
32
|
subscriptionCommercialEditAllowedFromStatuses: [],
|
|
@@ -34,6 +47,8 @@ exports.initialState = {
|
|
|
34
47
|
invoicingTosAcceptanceUserAgent: undefined,
|
|
35
48
|
invoicingTosAcceptanceUserId: undefined,
|
|
36
49
|
isInvoicingSettingsSeeded: undefined,
|
|
50
|
+
createdAt: undefined,
|
|
51
|
+
updatedAt: undefined,
|
|
37
52
|
hasValidState() {
|
|
38
53
|
return (this.fetchState === 'Completed' && this.isInvoicingTosAccepted != null);
|
|
39
54
|
},
|
|
@@ -49,6 +64,21 @@ function mapInvoicingConfigPayloadToState(payload) {
|
|
|
49
64
|
code: option.code,
|
|
50
65
|
name: option.name,
|
|
51
66
|
})),
|
|
67
|
+
autoCollectionOptions: (payload.auto_collection_options ?? []).map(invoicingCommonPayload_1.toInvoicingNamedOption),
|
|
68
|
+
billingPeriodUnitOptions: (payload.billing_period_unit_options ?? []).map(invoicingCommonPayload_1.toInvoicingNamedOption),
|
|
69
|
+
catalogTrialEndActionOptions: (payload.catalog_trial_end_action_options ?? []).map(invoicingCommonPayload_1.toInvoicingNamedOption),
|
|
70
|
+
catalogTrialUnitOptions: (payload.catalog_trial_unit_options ?? []).map(invoicingCommonPayload_1.toInvoicingNamedOption),
|
|
71
|
+
customerTypeOptions: (payload.customer_type_options ?? []).map(invoicingCommonPayload_1.toInvoicingNamedOption),
|
|
72
|
+
dateFormatOptions: (payload.date_format_options ?? []).map(invoicingCommonPayload_1.toInvoicingNamedOption),
|
|
73
|
+
discountApplyOnOptions: (payload.discount_apply_on_options ?? []).map(invoicingCommonPayload_1.toInvoicingNamedOption),
|
|
74
|
+
discountDurationTypeOptions: (payload.discount_duration_type_options ?? []).map(invoicingCommonPayload_1.toInvoicingNamedOption),
|
|
75
|
+
discountTypeOptions: (payload.discount_type_options ?? []).map(invoicingCommonPayload_1.toInvoicingNamedOption),
|
|
76
|
+
manualPaymentMethodOptions: (payload.manual_payment_method_options ?? []).map(invoicingCommonPayload_1.toInvoicingNamedOption),
|
|
77
|
+
netTermDayOptions: (payload.net_term_day_options ?? []).map(invoicingCommonPayload_1.toInvoicingNamedOption),
|
|
78
|
+
paymentGatewayOptions: (payload.payment_gateway_options ?? []).map(invoicingCommonPayload_1.toInvoicingNamedOption),
|
|
79
|
+
taxabilityOptions: (payload.taxability_options ?? []).map(invoicingCommonPayload_1.toInvoicingNamedOption),
|
|
80
|
+
createdAt: payload.created_at ?? undefined,
|
|
81
|
+
updatedAt: payload.updated_at ?? undefined,
|
|
52
82
|
dunningScheduleActionOptions: payload.dunning_schedule_action_options.map((option) => ({
|
|
53
83
|
code: (0, invoicingCommonPayload_1.toInvoicingDunningAction)(option.code),
|
|
54
84
|
name: option.name,
|
|
@@ -1,38 +1,18 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { InvoicingDunningActionOption } from '../../../entity/invoicing/invoicingCommonPayload';
|
|
3
|
-
import type { AuditLogEntityRouteOption, AuditLogListSortFieldOption, AuditLogSourceLabelOption, InvoicingCatalogItemLifecycleAction, InvoicingCatalogLifecycleActionOption, InvoicingCatalogProductLifecycleAction, InvoicingDiscountLifecycleActionOption, InvoicingNamedOption, InvoicingQboAccountMappingKindOption, InvoicingSubscriptionEditFieldOption, InvoicingSubscriptionLifecycleActionOption } from '../../../entity/invoicing/invoicingCommonPayload';
|
|
1
|
+
import { FetchStateAndError } from '../../../commonStateTypes/common';
|
|
4
2
|
import { RootState } from '../../../reducer';
|
|
5
|
-
import { ZeniAPIStatus } from '../../../responsePayload';
|
|
6
3
|
import { InvoicingOnboardingStatus } from './invoicingConfigViewPayload';
|
|
7
|
-
|
|
4
|
+
import { InvoicingConfigViewState } from './invoicingConfigViewState';
|
|
5
|
+
/**
|
|
6
|
+
* The whole config state plus what only the view layer needs: the derived
|
|
7
|
+
* onboarding `status` and the shorter names consumers use for the two action
|
|
8
|
+
* fetch states. Extending the state means every field the config API grows
|
|
9
|
+
* reaches consumers without touching this selector; the two internal
|
|
10
|
+
* `*FetchState` fields and the state's own validity predicate are omitted so
|
|
11
|
+
* each piece of data has exactly one public name.
|
|
12
|
+
*/
|
|
13
|
+
export interface InvoicingConfigView extends Omit<InvoicingConfigViewState, 'acceptTermsFetchState' | 'enableFetchState' | 'hasValidState'> {
|
|
8
14
|
acceptTermsState: FetchStateAndError;
|
|
9
|
-
auditLogEntityRouteOptions: AuditLogEntityRouteOption[];
|
|
10
|
-
auditLogListSortFieldOptions: AuditLogListSortFieldOption[];
|
|
11
|
-
auditLogSourceLabels: AuditLogSourceLabelOption[];
|
|
12
|
-
catalogItemLifecycleActionOptions: InvoicingCatalogLifecycleActionOption<InvoicingCatalogItemLifecycleAction>[];
|
|
13
|
-
catalogProductLifecycleActionOptions: InvoicingCatalogLifecycleActionOption<InvoicingCatalogProductLifecycleAction>[];
|
|
14
|
-
discountLifecycleActionOptions: InvoicingDiscountLifecycleActionOption[];
|
|
15
|
-
dunningScheduleActionOptions: InvoicingDunningActionOption[];
|
|
16
15
|
enableState: FetchStateAndError;
|
|
17
|
-
fetchState: FetchState;
|
|
18
|
-
qboAccountMappingKindOptions: InvoicingQboAccountMappingKindOption[];
|
|
19
|
-
qboCustomerMatchingOptions: InvoicingNamedOption[];
|
|
20
|
-
qboSyncStatusOptions: InvoicingNamedOption[];
|
|
21
|
-
subscriptionCancelTimingOptions: InvoicingNamedOption[];
|
|
22
|
-
subscriptionChangeOptionOptions: InvoicingNamedOption[];
|
|
23
|
-
subscriptionCommercialEditAllowedFromStatuses: string[];
|
|
24
|
-
subscriptionEditFieldOptions: InvoicingSubscriptionEditFieldOption[];
|
|
25
|
-
subscriptionLifecycleActionOptions: InvoicingSubscriptionLifecycleActionOption[];
|
|
26
|
-
subscriptionMetadataEditAllowedFromStatuses: string[];
|
|
27
|
-
error?: ZeniAPIStatus;
|
|
28
|
-
isInvoicingEnabled?: boolean;
|
|
29
|
-
isInvoicingTosAccepted?: boolean;
|
|
30
16
|
status?: InvoicingOnboardingStatus;
|
|
31
17
|
}
|
|
32
|
-
/**
|
|
33
|
-
* Single bundled view for the invoicing config — consumers read only this.
|
|
34
|
-
* Carries the config flags, the derived onboarding `status` used for route
|
|
35
|
-
* gating, the config fetch (`fetchState`/`error`), and the accept-terms /
|
|
36
|
-
* enable action fetch states.
|
|
37
|
-
*/
|
|
38
18
|
export declare const getInvoicingConfigView: (state: RootState) => InvoicingConfigView;
|
|
@@ -2,37 +2,12 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getInvoicingConfigView = void 0;
|
|
4
4
|
const invoicingConfigViewPayload_1 = require("./invoicingConfigViewPayload");
|
|
5
|
-
/**
|
|
6
|
-
* Single bundled view for the invoicing config — consumers read only this.
|
|
7
|
-
* Carries the config flags, the derived onboarding `status` used for route
|
|
8
|
-
* gating, the config fetch (`fetchState`/`error`), and the accept-terms /
|
|
9
|
-
* enable action fetch states.
|
|
10
|
-
*/
|
|
11
5
|
const getInvoicingConfigView = (state) => {
|
|
12
|
-
const configState = state.invoicingConfigViewState;
|
|
6
|
+
const { acceptTermsFetchState, enableFetchState, ...configState } = state.invoicingConfigViewState;
|
|
13
7
|
return {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
auditLogSourceLabels: configState.auditLogSourceLabels,
|
|
18
|
-
dunningScheduleActionOptions: configState.dunningScheduleActionOptions,
|
|
19
|
-
enableState: configState.enableFetchState,
|
|
20
|
-
subscriptionLifecycleActionOptions: configState.subscriptionLifecycleActionOptions,
|
|
21
|
-
subscriptionCommercialEditAllowedFromStatuses: configState.subscriptionCommercialEditAllowedFromStatuses,
|
|
22
|
-
subscriptionMetadataEditAllowedFromStatuses: configState.subscriptionMetadataEditAllowedFromStatuses,
|
|
23
|
-
subscriptionEditFieldOptions: configState.subscriptionEditFieldOptions,
|
|
24
|
-
subscriptionCancelTimingOptions: configState.subscriptionCancelTimingOptions,
|
|
25
|
-
subscriptionChangeOptionOptions: configState.subscriptionChangeOptionOptions,
|
|
26
|
-
catalogItemLifecycleActionOptions: configState.catalogItemLifecycleActionOptions,
|
|
27
|
-
catalogProductLifecycleActionOptions: configState.catalogProductLifecycleActionOptions,
|
|
28
|
-
discountLifecycleActionOptions: configState.discountLifecycleActionOptions,
|
|
29
|
-
qboAccountMappingKindOptions: configState.qboAccountMappingKindOptions,
|
|
30
|
-
qboCustomerMatchingOptions: configState.qboCustomerMatchingOptions,
|
|
31
|
-
qboSyncStatusOptions: configState.qboSyncStatusOptions,
|
|
32
|
-
error: configState.error,
|
|
33
|
-
fetchState: configState.fetchState,
|
|
34
|
-
isInvoicingEnabled: configState.isInvoicingEnabled,
|
|
35
|
-
isInvoicingTosAccepted: configState.isInvoicingTosAccepted,
|
|
8
|
+
...configState,
|
|
9
|
+
acceptTermsState: acceptTermsFetchState,
|
|
10
|
+
enableState: enableFetchState,
|
|
36
11
|
status: (0, invoicingConfigViewPayload_1.deriveInvoicingOnboardingStatus)(configState.isInvoicingTosAccepted, configState.isInvoicingEnabled),
|
|
37
12
|
};
|
|
38
13
|
};
|
|
@@ -6,11 +6,23 @@ export interface InvoicingConfigViewState extends FetchedState {
|
|
|
6
6
|
auditLogEntityRouteOptions: AuditLogEntityRouteOption[];
|
|
7
7
|
auditLogListSortFieldOptions: AuditLogListSortFieldOption[];
|
|
8
8
|
auditLogSourceLabels: AuditLogSourceLabelOption[];
|
|
9
|
+
autoCollectionOptions: InvoicingNamedOption[];
|
|
10
|
+
billingPeriodUnitOptions: InvoicingNamedOption[];
|
|
9
11
|
catalogItemLifecycleActionOptions: InvoicingCatalogLifecycleActionOption<InvoicingCatalogItemLifecycleAction>[];
|
|
10
12
|
catalogProductLifecycleActionOptions: InvoicingCatalogLifecycleActionOption<InvoicingCatalogProductLifecycleAction>[];
|
|
13
|
+
catalogTrialEndActionOptions: InvoicingNamedOption[];
|
|
14
|
+
catalogTrialUnitOptions: InvoicingNamedOption[];
|
|
15
|
+
customerTypeOptions: InvoicingNamedOption[];
|
|
16
|
+
dateFormatOptions: InvoicingNamedOption[];
|
|
17
|
+
discountApplyOnOptions: InvoicingNamedOption[];
|
|
18
|
+
discountDurationTypeOptions: InvoicingNamedOption[];
|
|
11
19
|
discountLifecycleActionOptions: InvoicingDiscountLifecycleActionOption[];
|
|
20
|
+
discountTypeOptions: InvoicingNamedOption[];
|
|
12
21
|
dunningScheduleActionOptions: InvoicingDunningActionOption[];
|
|
13
22
|
enableFetchState: FetchStateAndError;
|
|
23
|
+
manualPaymentMethodOptions: InvoicingNamedOption[];
|
|
24
|
+
netTermDayOptions: InvoicingNamedOption[];
|
|
25
|
+
paymentGatewayOptions: InvoicingNamedOption[];
|
|
14
26
|
qboAccountMappingKindOptions: InvoicingQboAccountMappingKindOption[];
|
|
15
27
|
qboCustomerMatchingOptions: InvoicingNamedOption[];
|
|
16
28
|
qboSyncStatusOptions: InvoicingNamedOption[];
|
|
@@ -20,6 +32,8 @@ export interface InvoicingConfigViewState extends FetchedState {
|
|
|
20
32
|
subscriptionEditFieldOptions: InvoicingSubscriptionEditFieldOption[];
|
|
21
33
|
subscriptionLifecycleActionOptions: InvoicingSubscriptionLifecycleActionOption[];
|
|
22
34
|
subscriptionMetadataEditAllowedFromStatuses: string[];
|
|
35
|
+
taxabilityOptions: InvoicingNamedOption[];
|
|
36
|
+
createdAt?: string;
|
|
23
37
|
invoicingTosAcceptanceIp?: string;
|
|
24
38
|
invoicingTosAcceptanceTime?: string;
|
|
25
39
|
invoicingTosAcceptanceUserAgent?: string;
|
|
@@ -28,4 +42,5 @@ export interface InvoicingConfigViewState extends FetchedState {
|
|
|
28
42
|
isInvoicingEnabled?: boolean;
|
|
29
43
|
isInvoicingSettingsSeeded?: boolean;
|
|
30
44
|
isInvoicingTosAccepted?: boolean;
|
|
45
|
+
updatedAt?: string;
|
|
31
46
|
}
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
+
import { openSnackbar } from '../../../../entity/snackbar/snackbarReducer';
|
|
1
2
|
import { fetchInvoicingQboAccounts, fetchInvoicingQboClasses, fetchInvoicingQboConnection, fetchInvoicingQboSyncHealth, retryInvoicingQboSyncTask, retryInvoicingQboSyncTaskFailure, retryInvoicingQboSyncTaskSuccess, startInvoicingQboBackfill, startInvoicingQboBackfillFailure, startInvoicingQboBackfillSuccess, updateInvoicingQboAccounts, updateInvoicingQboAccountsFailure, updateInvoicingQboClasses, updateInvoicingQboClassesFailure, updateInvoicingQboConnection, updateInvoicingQboConnectionFailure, updateInvoicingQboSyncHealth, updateInvoicingQboSyncHealthFailure } from '../invoicingQboViewReducer';
|
|
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
|
+
export type InvoicingQboViewActionType = ReturnType<typeof openSnackbar> | 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,6 +3,7 @@ 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");
|
|
6
7
|
const responsePayload_1 = require("../../../../responsePayload");
|
|
7
8
|
const invoicingQboViewReducer_1 = require("../invoicingQboViewReducer");
|
|
8
9
|
const retryInvoicingQboSyncTaskEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(invoicingQboViewReducer_1.retryInvoicingQboSyncTask.match), (0, operators_1.mergeMap)((action) => {
|
|
@@ -15,16 +16,34 @@ const retryInvoicingQboSyncTaskEpic = (actions$, _state$, zeniAPI) => actions$.p
|
|
|
15
16
|
return (0, rxjs_1.of)((0, invoicingQboViewReducer_1.retryInvoicingQboSyncTaskSuccess)({
|
|
16
17
|
status: response.data?.status ?? '',
|
|
17
18
|
taskId: response.data?.task_id ?? taskId,
|
|
18
|
-
}), (0, invoicingQboViewReducer_1.fetchInvoicingQboSyncHealth)())
|
|
19
|
+
}), (0, invoicingQboViewReducer_1.fetchInvoicingQboSyncHealth)(), (0, snackbarReducer_1.openSnackbar)({
|
|
20
|
+
messageSection: 'invoicing_qbo_sync_health_retry',
|
|
21
|
+
messageText: 'success',
|
|
22
|
+
type: 'success',
|
|
23
|
+
}));
|
|
19
24
|
}
|
|
20
|
-
return (0, rxjs_1.
|
|
21
|
-
|
|
25
|
+
return (0, rxjs_1.from)([
|
|
26
|
+
(0, invoicingQboViewReducer_1.retryInvoicingQboSyncTaskFailure)({
|
|
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)),
|
|
22
40
|
taskId,
|
|
23
|
-
})
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
41
|
+
}),
|
|
42
|
+
(0, snackbarReducer_1.openSnackbar)({
|
|
43
|
+
messageSection: 'invoicing_qbo_sync_health_retry',
|
|
44
|
+
messageText: 'failed',
|
|
45
|
+
type: 'error',
|
|
46
|
+
}),
|
|
47
|
+
])));
|
|
29
48
|
}));
|
|
30
49
|
exports.retryInvoicingQboSyncTaskEpic = retryInvoicingQboSyncTaskEpic;
|
|
@@ -3,6 +3,7 @@ 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");
|
|
6
7
|
const responsePayload_1 = require("../../../../responsePayload");
|
|
7
8
|
const invoicingQboViewReducer_1 = require("../invoicingQboViewReducer");
|
|
8
9
|
const startInvoicingQboBackfillEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(invoicingQboViewReducer_1.startInvoicingQboBackfill.match), (0, operators_1.switchMap)((action) => {
|
|
@@ -13,10 +14,32 @@ const startInvoicingQboBackfillEpic = (actions$, _state$, zeniAPI) => actions$.p
|
|
|
13
14
|
})
|
|
14
15
|
.pipe((0, operators_1.mergeMap)((response) => {
|
|
15
16
|
if ((0, responsePayload_1.isSuccessResponse)(response)) {
|
|
16
|
-
return (0, rxjs_1.
|
|
17
|
+
return (0, rxjs_1.from)([
|
|
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
|
+
]);
|
|
17
26
|
}
|
|
18
|
-
return (0, rxjs_1.
|
|
19
|
-
|
|
20
|
-
|
|
27
|
+
return (0, rxjs_1.from)([
|
|
28
|
+
(0, invoicingQboViewReducer_1.startInvoicingQboBackfillFailure)(response.status),
|
|
29
|
+
(0, snackbarReducer_1.openSnackbar)({
|
|
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
|
+
])));
|
|
21
44
|
}));
|
|
22
45
|
exports.startInvoicingQboBackfillEpic = startInvoicingQboBackfillEpic;
|
|
@@ -1,9 +1,10 @@
|
|
|
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';
|
|
4
5
|
import { RootState } from '../../../reducer';
|
|
5
6
|
import { ZeniAPI } from '../../../zeniAPI';
|
|
6
7
|
import { fetchInvoiceDetail } from '../invoiceDetail/invoiceDetailReducer';
|
|
7
8
|
import { issueCreditNoteFailure, issueCreditNoteSuccess, submitIssueCreditNote } from './issueCreditNoteReducer';
|
|
8
|
-
export type ActionType = ReturnType<typeof submitIssueCreditNote> | ReturnType<typeof issueCreditNoteSuccess> | ReturnType<typeof issueCreditNoteFailure> | ReturnType<typeof updateInvoicingCreditNotes> | ReturnType<typeof fetchInvoiceDetail>;
|
|
9
|
+
export type ActionType = ReturnType<typeof submitIssueCreditNote> | ReturnType<typeof issueCreditNoteSuccess> | ReturnType<typeof issueCreditNoteFailure> | ReturnType<typeof updateInvoicingCreditNotes> | ReturnType<typeof fetchInvoiceDetail> | ReturnType<typeof openSnackbar>;
|
|
9
10
|
export declare const issueCreditNoteEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
|
|
@@ -4,6 +4,7 @@ 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");
|
|
7
8
|
const responsePayload_1 = require("../../../responsePayload");
|
|
8
9
|
const invoiceDetailReducer_1 = require("../invoiceDetail/invoiceDetailReducer");
|
|
9
10
|
const issueCreditNotePayload_1 = require("./issueCreditNotePayload");
|
|
@@ -21,10 +22,29 @@ const issueCreditNoteEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, ope
|
|
|
21
22
|
(0, creditNoteReducer_1.updateInvoicingCreditNotes)([response.data], 'merge'),
|
|
22
23
|
(0, invoiceDetailReducer_1.fetchInvoiceDetail)({ invoiceId }),
|
|
23
24
|
(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
|
+
}),
|
|
24
30
|
];
|
|
25
31
|
}
|
|
26
|
-
return (0, rxjs_1.
|
|
27
|
-
|
|
28
|
-
|
|
32
|
+
return (0, rxjs_1.from)([
|
|
33
|
+
(0, issueCreditNoteReducer_1.issueCreditNoteFailure)(response.status),
|
|
34
|
+
(0, snackbarReducer_1.openSnackbar)({
|
|
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
|
+
])));
|
|
29
49
|
}));
|
|
30
50
|
exports.issueCreditNoteEpic = issueCreditNoteEpic;
|