@zeniai/client-epic-state 5.1.91 → 5.1.93
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/company/companyPayload.d.ts +0 -4
- package/lib/entity/company/companyPayload.js +8 -18
- package/lib/entity/company/companyStateTypes.d.ts +0 -4
- 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 -31
- package/lib/entity/tenant/tenantReducer.d.ts +1 -5
- package/lib/entity/tenant/tenantReducer.js +2 -21
- package/lib/epic.d.ts +1 -3
- package/lib/epic.js +1 -5
- package/lib/esm/entity/aiCfo/aiCfoReducer.js +1 -23
- package/lib/esm/entity/company/companyPayload.js +8 -18
- package/lib/esm/entity/customerSatisfaction/customerSatisfactionReducer.js +1 -4
- package/lib/esm/entity/snackbar/snackbarTypes.js +0 -31
- package/lib/esm/entity/tenant/tenantReducer.js +1 -20
- package/lib/esm/epic.js +1 -5
- package/lib/esm/index.js +7 -8
- package/lib/esm/view/companyHealthMetricView/companyHealthMetricConfigReducer.js +1 -4
- package/lib/esm/view/companyView/companyViewReducer.js +1 -58
- package/lib/esm/view/companyView/selector/companyManagementViewSelector.js +0 -52
- package/lib/esm/view/companyView/types/cockpitTypes.js +1 -13
- package/lib/esm/view/companyView/types/companyManagementViewState.js +0 -2
- 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 +10 -14
- package/lib/index.js +50 -61
- package/lib/view/companyHealthMetricView/companyHealthMetricConfigReducer.d.ts +1 -1
- package/lib/view/companyHealthMetricView/companyHealthMetricConfigReducer.js +2 -5
- package/lib/view/companyView/companyViewReducer.d.ts +1 -22
- package/lib/view/companyView/companyViewReducer.js +3 -60
- package/lib/view/companyView/selector/companyManagementViewSelector.d.ts +0 -3
- package/lib/view/companyView/selector/companyManagementViewSelector.js +0 -55
- package/lib/view/companyView/types/cockpitTypes.d.ts +3 -7
- package/lib/view/companyView/types/cockpitTypes.js +1 -15
- package/lib/view/companyView/types/companyManagementViewState.d.ts +0 -2
- package/lib/view/companyView/types/companyManagementViewState.js +0 -2
- 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 +2 -2
- package/lib/esm/view/companyView/epic/updateCompanyProductServicesEpic.js +0 -91
- package/lib/esm/view/companyView/epic/updateCompanyQboRealmIdEpic.js +0 -58
- package/lib/esm/view/invoicing/invoicingDunningCaseDetailView/fetchInvoicingDunningEmailPreviewEpic.js +0 -26
- package/lib/esm/view/invoicing/invoicingDunningCaseDetailView/fetchInvoicingDunningEmailPreviewPageEpic.js +0 -16
- package/lib/view/companyView/epic/updateCompanyProductServicesEpic.d.ts +0 -10
- package/lib/view/companyView/epic/updateCompanyProductServicesEpic.js +0 -95
- package/lib/view/companyView/epic/updateCompanyQboRealmIdEpic.d.ts +0 -8
- package/lib/view/companyView/epic/updateCompanyQboRealmIdEpic.js +0 -62
- 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
package/lib/esm/view/invoicing/editInvoicingCatalogItemDetailView/saveInvoicingCatalogItemEpic.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { forkJoin,
|
|
1
|
+
import { forkJoin, of } from 'rxjs';
|
|
2
2
|
import { catchError, filter, mergeMap } from 'rxjs/operators';
|
|
3
3
|
import { mergeInvoicingPlanSubFamily, updateInvoicingPlans, } from '../../../entity/invoicing/plan/planReducer';
|
|
4
4
|
import { updateInvoicingProducts } from '../../../entity/invoicing/product/productReducer';
|
|
5
|
-
import { openSnackbar } from '../../../entity/snackbar/snackbarReducer';
|
|
6
5
|
import { createZeniAPIStatus, isSuccessResponse } from '../../../responsePayload';
|
|
7
6
|
import { addInvoicingCatalogItem } from '../invoicingCatalogListView/invoicingCatalogListViewReducer';
|
|
8
7
|
import { localDataToSaveInvoicingCatalogItemPayload, } from './editInvoicingCatalogItemDetailViewPayload';
|
|
@@ -39,14 +38,7 @@ export const saveInvoicingCatalogItemEpic = (actions$, state$, zeniAPI) => actio
|
|
|
39
38
|
const failedProductResponse = productResponses.find((productResponse) => !isSuccessResponse(productResponse) ||
|
|
40
39
|
productResponse.data == null);
|
|
41
40
|
if (failedProductResponse != null) {
|
|
42
|
-
return
|
|
43
|
-
submitInvoicingCatalogItemFormFailure(failedProductResponse.status),
|
|
44
|
-
openSnackbar({
|
|
45
|
-
messageSection: 'invoicing_catalog_item_saved',
|
|
46
|
-
messageText: 'failed',
|
|
47
|
-
type: 'error',
|
|
48
|
-
}),
|
|
49
|
-
]);
|
|
41
|
+
return of(submitInvoicingCatalogItemFormFailure(failedProductResponse.status));
|
|
50
42
|
}
|
|
51
43
|
const savedProducts = productResponses.flatMap((productResponse) => productResponse.data != null ? [productResponse.data] : []);
|
|
52
44
|
const resultActions = [
|
|
@@ -73,11 +65,6 @@ export const saveInvoicingCatalogItemEpic = (actions$, state$, zeniAPI) => actio
|
|
|
73
65
|
: 'plan';
|
|
74
66
|
resultActions.push(addInvoicingCatalogItem({ id: savedItem.id, type: itemType }));
|
|
75
67
|
}
|
|
76
|
-
resultActions.push(openSnackbar({
|
|
77
|
-
messageSection: 'invoicing_catalog_item_saved',
|
|
78
|
-
messageText: 'success',
|
|
79
|
-
type: 'success',
|
|
80
|
-
}));
|
|
81
68
|
return resultActions;
|
|
82
69
|
};
|
|
83
70
|
const productUpdates = saveInvoicingCatalogItem.match(action)
|
|
@@ -88,21 +75,7 @@ export const saveInvoicingCatalogItemEpic = (actions$, state$, zeniAPI) => actio
|
|
|
88
75
|
}
|
|
89
76
|
return forkJoin(productUpdates.map((productUpdate) => zeniAPI.putAndGetJSON(`${baseUrl}/catalog/products/${encodeURIComponent(productUpdate.id)}`, productUpdate.data))).pipe(mergeMap(completeSave));
|
|
90
77
|
}
|
|
91
|
-
return
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
messageSection: 'invoicing_catalog_item_saved',
|
|
95
|
-
messageText: 'failed',
|
|
96
|
-
type: 'error',
|
|
97
|
-
}),
|
|
98
|
-
]);
|
|
99
|
-
}), catchError((error) => from([
|
|
100
|
-
submitInvoicingCatalogItemFormFailure(createZeniAPIStatus('Unexpected Error', 'Save catalog item REST API call errored out ' +
|
|
101
|
-
JSON.stringify(error))),
|
|
102
|
-
openSnackbar({
|
|
103
|
-
messageSection: 'invoicing_catalog_item_saved',
|
|
104
|
-
messageText: 'failed',
|
|
105
|
-
type: 'error',
|
|
106
|
-
}),
|
|
107
|
-
])));
|
|
78
|
+
return of(submitInvoicingCatalogItemFormFailure(response.status));
|
|
79
|
+
}), catchError((error) => of(submitInvoicingCatalogItemFormFailure(createZeniAPIStatus('Unexpected Error', 'Save catalog item REST API call errored out ' +
|
|
80
|
+
JSON.stringify(error))))));
|
|
108
81
|
}));
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { of } from 'rxjs';
|
|
2
2
|
import { catchError, filter, mergeMap } from 'rxjs/operators';
|
|
3
3
|
import { updateInvoicingCoupons } from '../../../entity/invoicing/coupon/couponReducer';
|
|
4
|
-
import { openSnackbar } from '../../../entity/snackbar/snackbarReducer';
|
|
5
4
|
import { createZeniAPIStatus, isSuccessResponse } from '../../../responsePayload';
|
|
6
5
|
import { addInvoicingCouponToList } from '../couponView/couponViewReducer';
|
|
7
6
|
import { localDataToSaveInvoicingCouponPayload, } from './editInvoicingCouponDetailViewPayload';
|
|
@@ -44,27 +43,8 @@ export const saveInvoicingCouponEpic = (actions$, state$, zeniAPI) => actions$.p
|
|
|
44
43
|
status: couponPayload.status,
|
|
45
44
|
}));
|
|
46
45
|
}
|
|
47
|
-
resultActions.push(openSnackbar({
|
|
48
|
-
messageSection: 'invoicing_coupon_saved',
|
|
49
|
-
messageText: 'success',
|
|
50
|
-
type: 'success',
|
|
51
|
-
}));
|
|
52
46
|
return resultActions;
|
|
53
47
|
}
|
|
54
|
-
return
|
|
55
|
-
|
|
56
|
-
openSnackbar({
|
|
57
|
-
messageSection: 'invoicing_coupon_saved',
|
|
58
|
-
messageText: 'failed',
|
|
59
|
-
type: 'error',
|
|
60
|
-
}),
|
|
61
|
-
]);
|
|
62
|
-
}), catchError((error) => from([
|
|
63
|
-
submitInvoicingCouponFormFailure(createZeniAPIStatus('Unexpected Error', 'Save coupon REST API call errored out ' + JSON.stringify(error))),
|
|
64
|
-
openSnackbar({
|
|
65
|
-
messageSection: 'invoicing_coupon_saved',
|
|
66
|
-
messageText: 'failed',
|
|
67
|
-
type: 'error',
|
|
68
|
-
}),
|
|
69
|
-
])));
|
|
48
|
+
return of(submitInvoicingCouponFormFailure(response.status));
|
|
49
|
+
}), catchError((error) => of(submitInvoicingCouponFormFailure(createZeniAPIStatus('Unexpected Error', 'Save coupon REST API call errored out ' + JSON.stringify(error))))));
|
|
70
50
|
}));
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { of } from 'rxjs';
|
|
2
2
|
import { catchError, filter, mergeMap } from 'rxjs/operators';
|
|
3
3
|
import { updateAddresses } from '../../../entity/address/addressReducer';
|
|
4
4
|
import { extractInvoicingCustomerAddresses } from '../../../entity/invoicing/invoicingCustomer/invoicingCustomerPayload';
|
|
5
5
|
import { updateInvoicingCustomers } from '../../../entity/invoicing/invoicingCustomer/invoicingCustomerReducer';
|
|
6
|
-
import { openSnackbar } from '../../../entity/snackbar/snackbarReducer';
|
|
7
6
|
import { createZeniAPIStatus, isSuccessResponse } from '../../../responsePayload';
|
|
8
7
|
import { resetNewAddressDataInLocalStore } from '../../addressView/addressViewReducer';
|
|
9
8
|
import { addInvoicingCustomerToList } from '../invoicingCustomerListView/invoicingCustomerListViewReducer';
|
|
@@ -46,28 +45,9 @@ export const saveInvoicingCustomerEpic = (actions$, state$, zeniAPI) => actions$
|
|
|
46
45
|
status: response.data.status,
|
|
47
46
|
}));
|
|
48
47
|
}
|
|
49
|
-
resultActions.push(openSnackbar({
|
|
50
|
-
messageSection: 'invoicing_customer_saved',
|
|
51
|
-
messageText: 'success',
|
|
52
|
-
type: 'success',
|
|
53
|
-
}));
|
|
54
48
|
return resultActions;
|
|
55
49
|
}
|
|
56
|
-
return
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
messageSection: 'invoicing_customer_saved',
|
|
60
|
-
messageText: 'failed',
|
|
61
|
-
type: 'error',
|
|
62
|
-
}),
|
|
63
|
-
]);
|
|
64
|
-
}), catchError((error) => from([
|
|
65
|
-
submitInvoicingCustomerFormFailure(createZeniAPIStatus('Unexpected Error', 'Save customer REST API call errored out ' +
|
|
66
|
-
JSON.stringify(error))),
|
|
67
|
-
openSnackbar({
|
|
68
|
-
messageSection: 'invoicing_customer_saved',
|
|
69
|
-
messageText: 'failed',
|
|
70
|
-
type: 'error',
|
|
71
|
-
}),
|
|
72
|
-
])));
|
|
50
|
+
return of(submitInvoicingCustomerFormFailure(response.status));
|
|
51
|
+
}), catchError((error) => of(submitInvoicingCustomerFormFailure(createZeniAPIStatus('Unexpected Error', 'Save customer REST API call errored out ' +
|
|
52
|
+
JSON.stringify(error))))));
|
|
73
53
|
}));
|
package/lib/esm/view/invoicing/editInvoicingSubscriptionDetailView/saveInvoicingSubscriptionEpic.js
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { of } from 'rxjs';
|
|
2
2
|
import { catchError, filter, mergeMap } from 'rxjs/operators';
|
|
3
3
|
import { updateAddresses } from '../../../entity/address/addressReducer';
|
|
4
4
|
import { extractInvoicingSubscriptionAddresses } from '../../../entity/invoicing/invoicingSubscription/invoicingSubscriptionPayload';
|
|
5
5
|
import { updateInvoicingSubscriptions } from '../../../entity/invoicing/invoicingSubscription/invoicingSubscriptionReducer';
|
|
6
|
-
import { openSnackbar } from '../../../entity/snackbar/snackbarReducer';
|
|
7
6
|
import { createZeniAPIStatus, isSuccessResponse } from '../../../responsePayload';
|
|
8
7
|
import { resetNewAddressDataInLocalStore } from '../../addressView/addressViewReducer';
|
|
9
8
|
import { addInvoicingSubscriptionToList } from '../invoicingSubscriptionListView/invoicingSubscriptionListViewReducer';
|
|
@@ -39,14 +38,7 @@ export const saveInvoicingSubscriptionEpic = (actions$, state$, zeniAPI) => acti
|
|
|
39
38
|
: zeniAPI.postAndGetJSON(`${baseUrl}/subscriptions`, { ...data });
|
|
40
39
|
return request$.pipe(mergeMap((response) => {
|
|
41
40
|
if (!isSuccessResponse(response) || response.data == null) {
|
|
42
|
-
return [
|
|
43
|
-
submitInvoicingSubscriptionFormFailure(response.status),
|
|
44
|
-
openSnackbar({
|
|
45
|
-
messageSection: 'invoicing_subscription_saved',
|
|
46
|
-
messageText: 'failed',
|
|
47
|
-
type: 'error',
|
|
48
|
-
}),
|
|
49
|
-
];
|
|
41
|
+
return [submitInvoicingSubscriptionFormFailure(response.status)];
|
|
50
42
|
}
|
|
51
43
|
const saved = response.data;
|
|
52
44
|
const couponChanged = id != null &&
|
|
@@ -86,19 +78,7 @@ export const saveInvoicingSubscriptionEpic = (actions$, state$, zeniAPI) => acti
|
|
|
86
78
|
status: saved.status,
|
|
87
79
|
}));
|
|
88
80
|
}
|
|
89
|
-
resultActions.push(openSnackbar({
|
|
90
|
-
messageSection: 'invoicing_subscription_saved',
|
|
91
|
-
messageText: 'success',
|
|
92
|
-
type: 'success',
|
|
93
|
-
}));
|
|
94
81
|
return resultActions;
|
|
95
|
-
}), catchError((error) =>
|
|
96
|
-
|
|
97
|
-
JSON.stringify(error))),
|
|
98
|
-
openSnackbar({
|
|
99
|
-
messageSection: 'invoicing_subscription_saved',
|
|
100
|
-
messageText: 'failed',
|
|
101
|
-
type: 'error',
|
|
102
|
-
}),
|
|
103
|
-
])));
|
|
82
|
+
}), catchError((error) => of(submitInvoicingSubscriptionFormFailure(createZeniAPIStatus('Unexpected Error', 'Save subscription REST API call errored out ' +
|
|
83
|
+
JSON.stringify(error))))));
|
|
104
84
|
}));
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { EMPTY,
|
|
1
|
+
import { EMPTY, of } from 'rxjs';
|
|
2
2
|
import { catchError, filter, map, mergeMap } from 'rxjs/operators';
|
|
3
3
|
import { updateAddresses } from '../../../entity/address/addressReducer';
|
|
4
4
|
import { extractInvoicingSubscriptionAddresses, } from '../../../entity/invoicing/invoicingSubscription/invoicingSubscriptionPayload';
|
|
5
5
|
import { updateInvoicingSubscriptions } from '../../../entity/invoicing/invoicingSubscription/invoicingSubscriptionReducer';
|
|
6
|
-
import { openSnackbar } from '../../../entity/snackbar/snackbarReducer';
|
|
7
6
|
import { createZeniAPIStatus, isSuccessResponse, } from '../../../responsePayload';
|
|
8
7
|
import { resetNewAddressDataInLocalStore } from '../../addressView/addressViewReducer';
|
|
9
8
|
import { submitInvoicingSubscriptionFormFailure, submitInvoicingSubscriptionFormSuccess, syncInvoicingSubscriptionCoupons, } from './editInvoicingSubscriptionDetailViewReducer';
|
|
@@ -40,14 +39,7 @@ export const syncInvoicingSubscriptionCouponsEpic = (actions$, _state$, zeniAPI)
|
|
|
40
39
|
: couponMutation$(zeniAPI, baseUrl, subscriptionId, 'remove-coupon', prev);
|
|
41
40
|
return removeStep$.pipe(mergeMap((removeResult) => {
|
|
42
41
|
if (!removeResult.success) {
|
|
43
|
-
return
|
|
44
|
-
submitInvoicingSubscriptionFormFailure(failureStatus(removeResult)),
|
|
45
|
-
openSnackbar({
|
|
46
|
-
messageSection: 'invoicing_subscription_saved',
|
|
47
|
-
messageText: 'failed',
|
|
48
|
-
type: 'error',
|
|
49
|
-
}),
|
|
50
|
-
]);
|
|
42
|
+
return of(submitInvoicingSubscriptionFormFailure(failureStatus(removeResult)));
|
|
51
43
|
}
|
|
52
44
|
const applyStep$ = next === ''
|
|
53
45
|
? of({
|
|
@@ -59,11 +51,6 @@ export const syncInvoicingSubscriptionCouponsEpic = (actions$, _state$, zeniAPI)
|
|
|
59
51
|
if (!applyResult.success) {
|
|
60
52
|
return [
|
|
61
53
|
submitInvoicingSubscriptionFormFailure(failureStatus(applyResult)),
|
|
62
|
-
openSnackbar({
|
|
63
|
-
messageSection: 'invoicing_subscription_saved',
|
|
64
|
-
messageText: 'failed',
|
|
65
|
-
type: 'error',
|
|
66
|
-
}),
|
|
67
54
|
];
|
|
68
55
|
}
|
|
69
56
|
const couponUpdated = applyResult.payload ?? removeResult.payload;
|
|
@@ -71,11 +58,7 @@ export const syncInvoicingSubscriptionCouponsEpic = (actions$, _state$, zeniAPI)
|
|
|
71
58
|
if (couponUpdated != null) {
|
|
72
59
|
resultActions.push(updateInvoicingSubscriptions([couponUpdated], 'merge'), updateAddresses(extractInvoicingSubscriptionAddresses([couponUpdated])));
|
|
73
60
|
}
|
|
74
|
-
resultActions.push(submitInvoicingSubscriptionFormSuccess({ subscriptionId }), resetNewAddressDataInLocalStore(INVOICING_SUBSCRIPTION_SHIPPING_ADDRESS_TYPE)
|
|
75
|
-
messageSection: 'invoicing_subscription_saved',
|
|
76
|
-
messageText: 'success',
|
|
77
|
-
type: 'success',
|
|
78
|
-
}));
|
|
61
|
+
resultActions.push(submitInvoicingSubscriptionFormSuccess({ subscriptionId }), resetNewAddressDataInLocalStore(INVOICING_SUBSCRIPTION_SHIPPING_ADDRESS_TYPE));
|
|
79
62
|
return resultActions;
|
|
80
63
|
}));
|
|
81
64
|
}));
|
|
@@ -1,30 +1,13 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { of } from 'rxjs';
|
|
2
2
|
import { catchError, filter, mergeMap } from 'rxjs/operators';
|
|
3
3
|
import { updateAddresses } from '../../../entity/address/addressReducer';
|
|
4
4
|
import { extractInvoicingInvoiceAddresses } from '../../../entity/invoicing/invoice/invoicePayload';
|
|
5
5
|
import { updateInvoices } from '../../../entity/invoicing/invoice/invoiceReducer';
|
|
6
|
-
import { openSnackbar } from '../../../entity/snackbar/snackbarReducer';
|
|
7
6
|
import { createZeniAPIStatus, isSuccessResponse } from '../../../responsePayload';
|
|
8
7
|
import { runInvoicingInvoiceAction, runInvoicingInvoiceActionFailure, runInvoicingInvoiceActionSuccess, updateInvoicingInvoice, } from './invoiceActionReducer';
|
|
9
|
-
/** Snackbar copy per action kind; unlisted kinds run without one. */
|
|
10
|
-
const SNACKBAR_SECTION_BY_KIND = {
|
|
11
|
-
regenerate: 'invoicing_invoice_regenerated',
|
|
12
|
-
'send-reminder': 'invoicing_invoice_reminder_sent',
|
|
13
|
-
void: 'invoicing_invoice_voided',
|
|
14
|
-
};
|
|
15
8
|
export const runInvoicingInvoiceActionEpic = (actions$, _state$, zeniAPI) => actions$.pipe(filter((action) => runInvoicingInvoiceAction.match(action) &&
|
|
16
9
|
action.payload.action !== 'issue-credit-note'), mergeMap((action) => {
|
|
17
10
|
const { action: kind, body, invoiceId } = action.payload;
|
|
18
|
-
const snackbarSection = SNACKBAR_SECTION_BY_KIND[kind];
|
|
19
|
-
const snackbar = (messageText) => snackbarSection == null
|
|
20
|
-
? []
|
|
21
|
-
: [
|
|
22
|
-
openSnackbar({
|
|
23
|
-
messageSection: snackbarSection,
|
|
24
|
-
messageText,
|
|
25
|
-
type: messageText === 'success' ? 'success' : 'error',
|
|
26
|
-
}),
|
|
27
|
-
];
|
|
28
11
|
const apiUrl = `${zeniAPI.apiEndPoints.invoicingMicroServiceBaseUrl}/1.0/invoices/${encodeURIComponent(invoiceId)}/${kind}`;
|
|
29
12
|
return zeniAPI
|
|
30
13
|
.postAndGetJSON(apiUrl, (body ?? {}))
|
|
@@ -34,24 +17,17 @@ export const runInvoicingInvoiceActionEpic = (actions$, _state$, zeniAPI) => act
|
|
|
34
17
|
updateInvoices([response.data], 'merge'),
|
|
35
18
|
updateAddresses(extractInvoicingInvoiceAddresses([response.data])),
|
|
36
19
|
runInvoicingInvoiceActionSuccess({ invoiceId }),
|
|
37
|
-
...snackbar('success'),
|
|
38
20
|
];
|
|
39
21
|
}
|
|
40
|
-
return
|
|
41
|
-
|
|
42
|
-
error: response.status,
|
|
43
|
-
invoiceId,
|
|
44
|
-
}),
|
|
45
|
-
...snackbar('failed'),
|
|
46
|
-
]);
|
|
47
|
-
}), catchError((error) => from([
|
|
48
|
-
runInvoicingInvoiceActionFailure({
|
|
49
|
-
error: createZeniAPIStatus('Unexpected Error', 'Invoice action REST API call errored out ' +
|
|
50
|
-
JSON.stringify(error)),
|
|
22
|
+
return of(runInvoicingInvoiceActionFailure({
|
|
23
|
+
error: response.status,
|
|
51
24
|
invoiceId,
|
|
52
|
-
})
|
|
53
|
-
|
|
54
|
-
|
|
25
|
+
}));
|
|
26
|
+
}), catchError((error) => of(runInvoicingInvoiceActionFailure({
|
|
27
|
+
error: createZeniAPIStatus('Unexpected Error', 'Invoice action REST API call errored out ' +
|
|
28
|
+
JSON.stringify(error)),
|
|
29
|
+
invoiceId,
|
|
30
|
+
}))));
|
|
55
31
|
}));
|
|
56
32
|
export const updateInvoicingInvoiceEpic = (actions$, _state$, zeniAPI) => actions$.pipe(filter(updateInvoicingInvoice.match), mergeMap((action) => {
|
|
57
33
|
const { data, invoiceId } = action.payload;
|
|
@@ -64,34 +40,15 @@ export const updateInvoicingInvoiceEpic = (actions$, _state$, zeniAPI) => action
|
|
|
64
40
|
updateInvoices([response.data], 'merge'),
|
|
65
41
|
updateAddresses(extractInvoicingInvoiceAddresses([response.data])),
|
|
66
42
|
runInvoicingInvoiceActionSuccess({ invoiceId }),
|
|
67
|
-
openSnackbar({
|
|
68
|
-
messageSection: 'invoicing_invoice_saved',
|
|
69
|
-
messageText: 'success',
|
|
70
|
-
type: 'success',
|
|
71
|
-
}),
|
|
72
43
|
];
|
|
73
44
|
}
|
|
74
|
-
return
|
|
75
|
-
|
|
76
|
-
error: response.status,
|
|
77
|
-
invoiceId,
|
|
78
|
-
}),
|
|
79
|
-
openSnackbar({
|
|
80
|
-
messageSection: 'invoicing_invoice_saved',
|
|
81
|
-
messageText: 'failed',
|
|
82
|
-
type: 'error',
|
|
83
|
-
}),
|
|
84
|
-
]);
|
|
85
|
-
}), catchError((error) => from([
|
|
86
|
-
runInvoicingInvoiceActionFailure({
|
|
87
|
-
error: createZeniAPIStatus('Unexpected Error', 'Invoice update REST API call errored out ' +
|
|
88
|
-
JSON.stringify(error)),
|
|
45
|
+
return of(runInvoicingInvoiceActionFailure({
|
|
46
|
+
error: response.status,
|
|
89
47
|
invoiceId,
|
|
90
|
-
})
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
])));
|
|
48
|
+
}));
|
|
49
|
+
}), catchError((error) => of(runInvoicingInvoiceActionFailure({
|
|
50
|
+
error: createZeniAPIStatus('Unexpected Error', 'Invoice update REST API call errored out ' +
|
|
51
|
+
JSON.stringify(error)),
|
|
52
|
+
invoiceId,
|
|
53
|
+
}))));
|
|
97
54
|
}));
|
|
@@ -8,20 +8,7 @@ export const initialState = {
|
|
|
8
8
|
auditLogEntityRouteOptions: [],
|
|
9
9
|
auditLogListSortFieldOptions: [],
|
|
10
10
|
auditLogSourceLabels: [],
|
|
11
|
-
autoCollectionOptions: [],
|
|
12
|
-
billingPeriodUnitOptions: [],
|
|
13
|
-
catalogTrialEndActionOptions: [],
|
|
14
|
-
catalogTrialUnitOptions: [],
|
|
15
|
-
customerTypeOptions: [],
|
|
16
|
-
dateFormatOptions: [],
|
|
17
|
-
discountApplyOnOptions: [],
|
|
18
|
-
discountDurationTypeOptions: [],
|
|
19
|
-
discountTypeOptions: [],
|
|
20
11
|
dunningScheduleActionOptions: [],
|
|
21
|
-
manualPaymentMethodOptions: [],
|
|
22
|
-
netTermDayOptions: [],
|
|
23
|
-
paymentGatewayOptions: [],
|
|
24
|
-
taxabilityOptions: [],
|
|
25
12
|
enableFetchState: { fetchState: 'Not-Started', error: undefined },
|
|
26
13
|
subscriptionLifecycleActionOptions: [],
|
|
27
14
|
subscriptionCommercialEditAllowedFromStatuses: [],
|
|
@@ -42,8 +29,6 @@ export const initialState = {
|
|
|
42
29
|
invoicingTosAcceptanceUserAgent: undefined,
|
|
43
30
|
invoicingTosAcceptanceUserId: undefined,
|
|
44
31
|
isInvoicingSettingsSeeded: undefined,
|
|
45
|
-
createdAt: undefined,
|
|
46
|
-
updatedAt: undefined,
|
|
47
32
|
hasValidState() {
|
|
48
33
|
return (this.fetchState === 'Completed' && this.isInvoicingTosAccepted != null);
|
|
49
34
|
},
|
|
@@ -59,21 +44,6 @@ export function mapInvoicingConfigPayloadToState(payload) {
|
|
|
59
44
|
code: option.code,
|
|
60
45
|
name: option.name,
|
|
61
46
|
})),
|
|
62
|
-
autoCollectionOptions: (payload.auto_collection_options ?? []).map(toInvoicingNamedOption),
|
|
63
|
-
billingPeriodUnitOptions: (payload.billing_period_unit_options ?? []).map(toInvoicingNamedOption),
|
|
64
|
-
catalogTrialEndActionOptions: (payload.catalog_trial_end_action_options ?? []).map(toInvoicingNamedOption),
|
|
65
|
-
catalogTrialUnitOptions: (payload.catalog_trial_unit_options ?? []).map(toInvoicingNamedOption),
|
|
66
|
-
customerTypeOptions: (payload.customer_type_options ?? []).map(toInvoicingNamedOption),
|
|
67
|
-
dateFormatOptions: (payload.date_format_options ?? []).map(toInvoicingNamedOption),
|
|
68
|
-
discountApplyOnOptions: (payload.discount_apply_on_options ?? []).map(toInvoicingNamedOption),
|
|
69
|
-
discountDurationTypeOptions: (payload.discount_duration_type_options ?? []).map(toInvoicingNamedOption),
|
|
70
|
-
discountTypeOptions: (payload.discount_type_options ?? []).map(toInvoicingNamedOption),
|
|
71
|
-
manualPaymentMethodOptions: (payload.manual_payment_method_options ?? []).map(toInvoicingNamedOption),
|
|
72
|
-
netTermDayOptions: (payload.net_term_day_options ?? []).map(toInvoicingNamedOption),
|
|
73
|
-
paymentGatewayOptions: (payload.payment_gateway_options ?? []).map(toInvoicingNamedOption),
|
|
74
|
-
taxabilityOptions: (payload.taxability_options ?? []).map(toInvoicingNamedOption),
|
|
75
|
-
createdAt: payload.created_at ?? undefined,
|
|
76
|
-
updatedAt: payload.updated_at ?? undefined,
|
|
77
47
|
dunningScheduleActionOptions: payload.dunning_schedule_action_options.map((option) => ({
|
|
78
48
|
code: toInvoicingDunningAction(option.code),
|
|
79
49
|
name: option.name,
|
|
@@ -1,10 +1,35 @@
|
|
|
1
1
|
import { deriveInvoicingOnboardingStatus, } from './invoicingConfigViewPayload';
|
|
2
|
+
/**
|
|
3
|
+
* Single bundled view for the invoicing config — consumers read only this.
|
|
4
|
+
* Carries the config flags, the derived onboarding `status` used for route
|
|
5
|
+
* gating, the config fetch (`fetchState`/`error`), and the accept-terms /
|
|
6
|
+
* enable action fetch states.
|
|
7
|
+
*/
|
|
2
8
|
export const getInvoicingConfigView = (state) => {
|
|
3
|
-
const
|
|
9
|
+
const configState = state.invoicingConfigViewState;
|
|
4
10
|
return {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
11
|
+
acceptTermsState: configState.acceptTermsFetchState,
|
|
12
|
+
auditLogEntityRouteOptions: configState.auditLogEntityRouteOptions,
|
|
13
|
+
auditLogListSortFieldOptions: configState.auditLogListSortFieldOptions,
|
|
14
|
+
auditLogSourceLabels: configState.auditLogSourceLabels,
|
|
15
|
+
dunningScheduleActionOptions: configState.dunningScheduleActionOptions,
|
|
16
|
+
enableState: configState.enableFetchState,
|
|
17
|
+
subscriptionLifecycleActionOptions: configState.subscriptionLifecycleActionOptions,
|
|
18
|
+
subscriptionCommercialEditAllowedFromStatuses: configState.subscriptionCommercialEditAllowedFromStatuses,
|
|
19
|
+
subscriptionMetadataEditAllowedFromStatuses: configState.subscriptionMetadataEditAllowedFromStatuses,
|
|
20
|
+
subscriptionEditFieldOptions: configState.subscriptionEditFieldOptions,
|
|
21
|
+
subscriptionCancelTimingOptions: configState.subscriptionCancelTimingOptions,
|
|
22
|
+
subscriptionChangeOptionOptions: configState.subscriptionChangeOptionOptions,
|
|
23
|
+
catalogItemLifecycleActionOptions: configState.catalogItemLifecycleActionOptions,
|
|
24
|
+
catalogProductLifecycleActionOptions: configState.catalogProductLifecycleActionOptions,
|
|
25
|
+
discountLifecycleActionOptions: configState.discountLifecycleActionOptions,
|
|
26
|
+
qboAccountMappingKindOptions: configState.qboAccountMappingKindOptions,
|
|
27
|
+
qboCustomerMatchingOptions: configState.qboCustomerMatchingOptions,
|
|
28
|
+
qboSyncStatusOptions: configState.qboSyncStatusOptions,
|
|
29
|
+
error: configState.error,
|
|
30
|
+
fetchState: configState.fetchState,
|
|
31
|
+
isInvoicingEnabled: configState.isInvoicingEnabled,
|
|
32
|
+
isInvoicingTosAccepted: configState.isInvoicingTosAccepted,
|
|
8
33
|
status: deriveInvoicingOnboardingStatus(configState.isInvoicingTosAccepted, configState.isInvoicingEnabled),
|
|
9
34
|
};
|
|
10
35
|
};
|
|
@@ -1,9 +1 @@
|
|
|
1
|
-
export
|
|
2
|
-
body: payload.body,
|
|
3
|
-
bodyToken: payload.body_token,
|
|
4
|
-
cc: payload.cc,
|
|
5
|
-
renderedHtmlTemplate: payload.rendered_html_template,
|
|
6
|
-
subject: payload.subject,
|
|
7
|
-
subjectToken: payload.subject_token,
|
|
8
|
-
to: payload.to,
|
|
9
|
-
});
|
|
1
|
+
export {};
|
|
@@ -1,14 +1,8 @@
|
|
|
1
1
|
import { createSlice } from '@reduxjs/toolkit';
|
|
2
2
|
import { clearAll } from '../../../rootActions';
|
|
3
|
-
export const initialEmailPreviewState = {
|
|
4
|
-
fetchState: 'Not-Started',
|
|
5
|
-
error: undefined,
|
|
6
|
-
preview: undefined,
|
|
7
|
-
};
|
|
8
3
|
export const initialState = {
|
|
9
4
|
fetchState: 'Not-Started',
|
|
10
5
|
error: undefined,
|
|
11
|
-
emailPreview: initialEmailPreviewState,
|
|
12
6
|
id: undefined,
|
|
13
7
|
};
|
|
14
8
|
const invoicingDunningCaseDetailView = createSlice({
|
|
@@ -16,38 +10,10 @@ const invoicingDunningCaseDetailView = createSlice({
|
|
|
16
10
|
initialState,
|
|
17
11
|
reducers: {
|
|
18
12
|
fetchInvoicingDunningCaseDetail(draft, action) {
|
|
19
|
-
if (draft.id !== action.payload.id) {
|
|
20
|
-
draft.emailPreview = { ...initialEmailPreviewState };
|
|
21
|
-
}
|
|
22
13
|
draft.id = action.payload.id;
|
|
23
14
|
draft.fetchState = 'In-Progress';
|
|
24
15
|
draft.error = undefined;
|
|
25
16
|
},
|
|
26
|
-
fetchInvoicingDunningEmailPreview(draft, action) {
|
|
27
|
-
if (draft.id !== action.payload.id) {
|
|
28
|
-
return;
|
|
29
|
-
}
|
|
30
|
-
draft.emailPreview.fetchState = 'In-Progress';
|
|
31
|
-
draft.emailPreview.error = undefined;
|
|
32
|
-
},
|
|
33
|
-
fetchInvoicingDunningEmailPreviewPage: {
|
|
34
|
-
reducer() {
|
|
35
|
-
// Cache-aware orchestrator trigger only.
|
|
36
|
-
},
|
|
37
|
-
prepare(payload) {
|
|
38
|
-
return {
|
|
39
|
-
payload: {
|
|
40
|
-
cacheOverride: payload.cacheOverride ?? false,
|
|
41
|
-
id: payload.id,
|
|
42
|
-
},
|
|
43
|
-
};
|
|
44
|
-
},
|
|
45
|
-
},
|
|
46
|
-
invalidateInvoicingDunningEmailPreview(draft, action) {
|
|
47
|
-
if (draft.id === action.payload.id) {
|
|
48
|
-
draft.emailPreview = { ...initialEmailPreviewState };
|
|
49
|
-
}
|
|
50
|
-
},
|
|
51
17
|
updateInvoicingDunningCaseDetail(draft, action) {
|
|
52
18
|
draft.id = action.payload.id;
|
|
53
19
|
draft.fetchState = 'Completed';
|
|
@@ -57,21 +23,6 @@ const invoicingDunningCaseDetailView = createSlice({
|
|
|
57
23
|
draft.fetchState = 'Error';
|
|
58
24
|
draft.error = action.payload;
|
|
59
25
|
},
|
|
60
|
-
updateInvoicingDunningEmailPreview(draft, action) {
|
|
61
|
-
if (draft.id === action.payload.id) {
|
|
62
|
-
draft.emailPreview = {
|
|
63
|
-
error: undefined,
|
|
64
|
-
fetchState: 'Completed',
|
|
65
|
-
preview: action.payload.preview,
|
|
66
|
-
};
|
|
67
|
-
}
|
|
68
|
-
},
|
|
69
|
-
updateInvoicingDunningEmailPreviewFailure(draft, action) {
|
|
70
|
-
if (draft.id === action.payload.id) {
|
|
71
|
-
draft.emailPreview.fetchState = 'Error';
|
|
72
|
-
draft.emailPreview.error = action.payload.status;
|
|
73
|
-
}
|
|
74
|
-
},
|
|
75
26
|
clearInvoicingDunningCaseDetailView(draft) {
|
|
76
27
|
Object.assign(draft, initialState);
|
|
77
28
|
},
|
|
@@ -82,5 +33,5 @@ const invoicingDunningCaseDetailView = createSlice({
|
|
|
82
33
|
});
|
|
83
34
|
},
|
|
84
35
|
});
|
|
85
|
-
export const {
|
|
36
|
+
export const { fetchInvoicingDunningCaseDetail, updateInvoicingDunningCaseDetail, updateInvoicingDunningCaseDetailFailure, clearInvoicingDunningCaseDetailView, } = invoicingDunningCaseDetailView.actions;
|
|
86
37
|
export default invoicingDunningCaseDetailView.reducer;
|
|
@@ -1,26 +1,13 @@
|
|
|
1
1
|
import { getInvoicingDunningCaseById as getInvoicingDunningCaseByIdFromState } from '../../../entity/invoicing/dunningCase/dunningCaseSelector';
|
|
2
2
|
import { getInvoicingDunningActionState } from '../dunningAction/dunningActionSelector';
|
|
3
|
-
const EMAIL_PREVIEW_NOT_STARTED = {
|
|
4
|
-
error: undefined,
|
|
5
|
-
fetchState: 'Not-Started',
|
|
6
|
-
preview: undefined,
|
|
7
|
-
};
|
|
8
3
|
export const getInvoicingDunningCaseById = (state, id) => getInvoicingDunningCaseByIdFromState(state.invoicingDunningCaseState, id);
|
|
9
4
|
export const getInvoicingDunningCaseDetail = (state, invoicingDunningCaseID) => {
|
|
10
|
-
const {
|
|
5
|
+
const { error, fetchState } = state.invoicingDunningCaseDetailViewState;
|
|
11
6
|
return {
|
|
12
7
|
actionState: getInvoicingDunningActionState(invoicingDunningCaseID)(state),
|
|
13
8
|
dunningCase: getInvoicingDunningCaseById(state, invoicingDunningCaseID),
|
|
14
|
-
emailPreview: id === invoicingDunningCaseID ? emailPreview : EMAIL_PREVIEW_NOT_STARTED,
|
|
15
9
|
fetchState,
|
|
16
10
|
error,
|
|
17
11
|
version: 1.0,
|
|
18
12
|
};
|
|
19
13
|
};
|
|
20
|
-
export const getInvoicingDunningEmailPreview = (state, invoicingDunningCaseID) => {
|
|
21
|
-
const detailState = state.invoicingDunningCaseDetailViewState;
|
|
22
|
-
if (detailState.id !== invoicingDunningCaseID) {
|
|
23
|
-
return EMAIL_PREVIEW_NOT_STARTED;
|
|
24
|
-
}
|
|
25
|
-
return detailState.emailPreview;
|
|
26
|
-
};
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { of } from 'rxjs';
|
|
2
2
|
import { catchError, filter, mergeMap } from 'rxjs/operators';
|
|
3
|
-
import { openSnackbar } from '../../../../entity/snackbar/snackbarReducer';
|
|
4
3
|
import { createZeniAPIStatus, isSuccessResponse, } from '../../../../responsePayload';
|
|
5
4
|
import { fetchInvoicingQboSyncHealth, retryInvoicingQboSyncTask, retryInvoicingQboSyncTaskFailure, retryInvoicingQboSyncTaskSuccess, } from '../invoicingQboViewReducer';
|
|
6
5
|
export const retryInvoicingQboSyncTaskEpic = (actions$, _state$, zeniAPI) => actions$.pipe(filter(retryInvoicingQboSyncTask.match), mergeMap((action) => {
|
|
@@ -13,33 +12,15 @@ export const retryInvoicingQboSyncTaskEpic = (actions$, _state$, zeniAPI) => act
|
|
|
13
12
|
return of(retryInvoicingQboSyncTaskSuccess({
|
|
14
13
|
status: response.data?.status ?? '',
|
|
15
14
|
taskId: response.data?.task_id ?? taskId,
|
|
16
|
-
}), fetchInvoicingQboSyncHealth()
|
|
17
|
-
messageSection: 'invoicing_qbo_sync_health_retry',
|
|
18
|
-
messageText: 'success',
|
|
19
|
-
type: 'success',
|
|
20
|
-
}));
|
|
15
|
+
}), fetchInvoicingQboSyncHealth());
|
|
21
16
|
}
|
|
22
|
-
return
|
|
23
|
-
|
|
24
|
-
status: response.status,
|
|
25
|
-
taskId,
|
|
26
|
-
}),
|
|
27
|
-
openSnackbar({
|
|
28
|
-
messageSection: 'invoicing_qbo_sync_health_retry',
|
|
29
|
-
messageText: 'failed',
|
|
30
|
-
type: 'error',
|
|
31
|
-
}),
|
|
32
|
-
]);
|
|
33
|
-
}), catchError((error) => from([
|
|
34
|
-
retryInvoicingQboSyncTaskFailure({
|
|
35
|
-
status: createZeniAPIStatus('Unexpected Error', 'Retry QBO sync task REST API call errored out ' +
|
|
36
|
-
JSON.stringify(error)),
|
|
17
|
+
return of(retryInvoicingQboSyncTaskFailure({
|
|
18
|
+
status: response.status,
|
|
37
19
|
taskId,
|
|
38
|
-
})
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
])));
|
|
20
|
+
}));
|
|
21
|
+
}), catchError((error) => of(retryInvoicingQboSyncTaskFailure({
|
|
22
|
+
status: createZeniAPIStatus('Unexpected Error', 'Retry QBO sync task REST API call errored out ' +
|
|
23
|
+
JSON.stringify(error)),
|
|
24
|
+
taskId,
|
|
25
|
+
}))));
|
|
45
26
|
}));
|