@zeniai/client-epic-state 5.1.81-betaAK2 → 5.1.81-betaAK4
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/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/invoicingConfigView/invoicingConfigViewReducer.js +30 -0
- package/lib/esm/view/invoicing/invoicingConfigView/invoicingConfigViewSelector.js +1 -26
- package/lib/esm/view/invoicing/recordPayment/recordPaymentEpic.js +46 -7
- package/lib/esm/view/invoicing/settingsView/settingsViewSelector.js +4 -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/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 +9 -31
- package/lib/view/invoicing/invoicingConfigView/invoicingConfigViewSelector.js +1 -26
- package/lib/view/invoicing/invoicingConfigView/invoicingConfigViewState.d.ts +15 -1
- package/lib/view/invoicing/recordPayment/recordPaymentEpic.d.ts +2 -1
- package/lib/view/invoicing/recordPayment/recordPaymentEpic.js +45 -6
- package/lib/view/invoicing/settingsView/settingsViewSelector.d.ts +4 -2
- package/lib/view/invoicing/settingsView/settingsViewSelector.js +4 -1
- package/package.json +1 -1
- package/lib/tsconfig.mocks.tsbuildinfo +0 -1
package/lib/esm/view/invoicing/editInvoicingCatalogItemDetailView/saveInvoicingCatalogItemEpic.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { forkJoin,
|
|
1
|
+
import { forkJoin, from } 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';
|
|
5
6
|
import { createZeniAPIStatus, isSuccessResponse } from '../../../responsePayload';
|
|
6
7
|
import { addInvoicingCatalogItem } from '../invoicingCatalogListView/invoicingCatalogListViewReducer';
|
|
7
8
|
import { localDataToSaveInvoicingCatalogItemPayload, } from './editInvoicingCatalogItemDetailViewPayload';
|
|
@@ -38,7 +39,14 @@ export const saveInvoicingCatalogItemEpic = (actions$, state$, zeniAPI) => actio
|
|
|
38
39
|
const failedProductResponse = productResponses.find((productResponse) => !isSuccessResponse(productResponse) ||
|
|
39
40
|
productResponse.data == null);
|
|
40
41
|
if (failedProductResponse != null) {
|
|
41
|
-
return
|
|
42
|
+
return from([
|
|
43
|
+
submitInvoicingCatalogItemFormFailure(failedProductResponse.status),
|
|
44
|
+
openSnackbar({
|
|
45
|
+
messageSection: 'invoicing_catalog_item_saved',
|
|
46
|
+
messageText: 'failed',
|
|
47
|
+
type: 'error',
|
|
48
|
+
}),
|
|
49
|
+
]);
|
|
42
50
|
}
|
|
43
51
|
const savedProducts = productResponses.flatMap((productResponse) => productResponse.data != null ? [productResponse.data] : []);
|
|
44
52
|
const resultActions = [
|
|
@@ -65,6 +73,11 @@ export const saveInvoicingCatalogItemEpic = (actions$, state$, zeniAPI) => actio
|
|
|
65
73
|
: 'plan';
|
|
66
74
|
resultActions.push(addInvoicingCatalogItem({ id: savedItem.id, type: itemType }));
|
|
67
75
|
}
|
|
76
|
+
resultActions.push(openSnackbar({
|
|
77
|
+
messageSection: 'invoicing_catalog_item_saved',
|
|
78
|
+
messageText: 'success',
|
|
79
|
+
type: 'success',
|
|
80
|
+
}));
|
|
68
81
|
return resultActions;
|
|
69
82
|
};
|
|
70
83
|
const productUpdates = saveInvoicingCatalogItem.match(action)
|
|
@@ -75,7 +88,21 @@ export const saveInvoicingCatalogItemEpic = (actions$, state$, zeniAPI) => actio
|
|
|
75
88
|
}
|
|
76
89
|
return forkJoin(productUpdates.map((productUpdate) => zeniAPI.putAndGetJSON(`${baseUrl}/catalog/products/${encodeURIComponent(productUpdate.id)}`, productUpdate.data))).pipe(mergeMap(completeSave));
|
|
77
90
|
}
|
|
78
|
-
return
|
|
79
|
-
|
|
80
|
-
|
|
91
|
+
return from([
|
|
92
|
+
submitInvoicingCatalogItemFormFailure(response.status),
|
|
93
|
+
openSnackbar({
|
|
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
|
+
])));
|
|
81
108
|
}));
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { from } 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';
|
|
4
5
|
import { createZeniAPIStatus, isSuccessResponse } from '../../../responsePayload';
|
|
5
6
|
import { addInvoicingCouponToList } from '../couponView/couponViewReducer';
|
|
6
7
|
import { localDataToSaveInvoicingCouponPayload, } from './editInvoicingCouponDetailViewPayload';
|
|
@@ -43,8 +44,27 @@ export const saveInvoicingCouponEpic = (actions$, state$, zeniAPI) => actions$.p
|
|
|
43
44
|
status: couponPayload.status,
|
|
44
45
|
}));
|
|
45
46
|
}
|
|
47
|
+
resultActions.push(openSnackbar({
|
|
48
|
+
messageSection: 'invoicing_coupon_saved',
|
|
49
|
+
messageText: 'success',
|
|
50
|
+
type: 'success',
|
|
51
|
+
}));
|
|
46
52
|
return resultActions;
|
|
47
53
|
}
|
|
48
|
-
return
|
|
49
|
-
|
|
54
|
+
return from([
|
|
55
|
+
submitInvoicingCouponFormFailure(response.status),
|
|
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
|
+
])));
|
|
50
70
|
}));
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { from } 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';
|
|
6
7
|
import { createZeniAPIStatus, isSuccessResponse } from '../../../responsePayload';
|
|
7
8
|
import { resetNewAddressDataInLocalStore } from '../../addressView/addressViewReducer';
|
|
8
9
|
import { addInvoicingCustomerToList } from '../invoicingCustomerListView/invoicingCustomerListViewReducer';
|
|
@@ -45,9 +46,28 @@ export const saveInvoicingCustomerEpic = (actions$, state$, zeniAPI) => actions$
|
|
|
45
46
|
status: response.data.status,
|
|
46
47
|
}));
|
|
47
48
|
}
|
|
49
|
+
resultActions.push(openSnackbar({
|
|
50
|
+
messageSection: 'invoicing_customer_saved',
|
|
51
|
+
messageText: 'success',
|
|
52
|
+
type: 'success',
|
|
53
|
+
}));
|
|
48
54
|
return resultActions;
|
|
49
55
|
}
|
|
50
|
-
return
|
|
51
|
-
|
|
52
|
-
|
|
56
|
+
return from([
|
|
57
|
+
submitInvoicingCustomerFormFailure(response.status),
|
|
58
|
+
openSnackbar({
|
|
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
|
+
])));
|
|
53
73
|
}));
|
package/lib/esm/view/invoicing/editInvoicingSubscriptionDetailView/saveInvoicingSubscriptionEpic.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { from } 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';
|
|
6
7
|
import { createZeniAPIStatus, isSuccessResponse } from '../../../responsePayload';
|
|
7
8
|
import { resetNewAddressDataInLocalStore } from '../../addressView/addressViewReducer';
|
|
8
9
|
import { addInvoicingSubscriptionToList } from '../invoicingSubscriptionListView/invoicingSubscriptionListViewReducer';
|
|
@@ -38,7 +39,14 @@ export const saveInvoicingSubscriptionEpic = (actions$, state$, zeniAPI) => acti
|
|
|
38
39
|
: zeniAPI.postAndGetJSON(`${baseUrl}/subscriptions`, { ...data });
|
|
39
40
|
return request$.pipe(mergeMap((response) => {
|
|
40
41
|
if (!isSuccessResponse(response) || response.data == null) {
|
|
41
|
-
return [
|
|
42
|
+
return [
|
|
43
|
+
submitInvoicingSubscriptionFormFailure(response.status),
|
|
44
|
+
openSnackbar({
|
|
45
|
+
messageSection: 'invoicing_subscription_saved',
|
|
46
|
+
messageText: 'failed',
|
|
47
|
+
type: 'error',
|
|
48
|
+
}),
|
|
49
|
+
];
|
|
42
50
|
}
|
|
43
51
|
const saved = response.data;
|
|
44
52
|
const couponChanged = id != null &&
|
|
@@ -78,7 +86,19 @@ export const saveInvoicingSubscriptionEpic = (actions$, state$, zeniAPI) => acti
|
|
|
78
86
|
status: saved.status,
|
|
79
87
|
}));
|
|
80
88
|
}
|
|
89
|
+
resultActions.push(openSnackbar({
|
|
90
|
+
messageSection: 'invoicing_subscription_saved',
|
|
91
|
+
messageText: 'success',
|
|
92
|
+
type: 'success',
|
|
93
|
+
}));
|
|
81
94
|
return resultActions;
|
|
82
|
-
}), catchError((error) =>
|
|
83
|
-
|
|
95
|
+
}), catchError((error) => from([
|
|
96
|
+
submitInvoicingSubscriptionFormFailure(createZeniAPIStatus('Unexpected Error', 'Save subscription REST API call errored out ' +
|
|
97
|
+
JSON.stringify(error))),
|
|
98
|
+
openSnackbar({
|
|
99
|
+
messageSection: 'invoicing_subscription_saved',
|
|
100
|
+
messageText: 'failed',
|
|
101
|
+
type: 'error',
|
|
102
|
+
}),
|
|
103
|
+
])));
|
|
84
104
|
}));
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { EMPTY, of } from 'rxjs';
|
|
1
|
+
import { EMPTY, from, 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';
|
|
6
7
|
import { createZeniAPIStatus, isSuccessResponse, } from '../../../responsePayload';
|
|
7
8
|
import { resetNewAddressDataInLocalStore } from '../../addressView/addressViewReducer';
|
|
8
9
|
import { submitInvoicingSubscriptionFormFailure, submitInvoicingSubscriptionFormSuccess, syncInvoicingSubscriptionCoupons, } from './editInvoicingSubscriptionDetailViewReducer';
|
|
@@ -39,7 +40,14 @@ export const syncInvoicingSubscriptionCouponsEpic = (actions$, _state$, zeniAPI)
|
|
|
39
40
|
: couponMutation$(zeniAPI, baseUrl, subscriptionId, 'remove-coupon', prev);
|
|
40
41
|
return removeStep$.pipe(mergeMap((removeResult) => {
|
|
41
42
|
if (!removeResult.success) {
|
|
42
|
-
return
|
|
43
|
+
return from([
|
|
44
|
+
submitInvoicingSubscriptionFormFailure(failureStatus(removeResult)),
|
|
45
|
+
openSnackbar({
|
|
46
|
+
messageSection: 'invoicing_subscription_saved',
|
|
47
|
+
messageText: 'failed',
|
|
48
|
+
type: 'error',
|
|
49
|
+
}),
|
|
50
|
+
]);
|
|
43
51
|
}
|
|
44
52
|
const applyStep$ = next === ''
|
|
45
53
|
? of({
|
|
@@ -51,6 +59,11 @@ export const syncInvoicingSubscriptionCouponsEpic = (actions$, _state$, zeniAPI)
|
|
|
51
59
|
if (!applyResult.success) {
|
|
52
60
|
return [
|
|
53
61
|
submitInvoicingSubscriptionFormFailure(failureStatus(applyResult)),
|
|
62
|
+
openSnackbar({
|
|
63
|
+
messageSection: 'invoicing_subscription_saved',
|
|
64
|
+
messageText: 'failed',
|
|
65
|
+
type: 'error',
|
|
66
|
+
}),
|
|
54
67
|
];
|
|
55
68
|
}
|
|
56
69
|
const couponUpdated = applyResult.payload ?? removeResult.payload;
|
|
@@ -58,7 +71,11 @@ export const syncInvoicingSubscriptionCouponsEpic = (actions$, _state$, zeniAPI)
|
|
|
58
71
|
if (couponUpdated != null) {
|
|
59
72
|
resultActions.push(updateInvoicingSubscriptions([couponUpdated], 'merge'), updateAddresses(extractInvoicingSubscriptionAddresses([couponUpdated])));
|
|
60
73
|
}
|
|
61
|
-
resultActions.push(submitInvoicingSubscriptionFormSuccess({ subscriptionId }), resetNewAddressDataInLocalStore(INVOICING_SUBSCRIPTION_SHIPPING_ADDRESS_TYPE)
|
|
74
|
+
resultActions.push(submitInvoicingSubscriptionFormSuccess({ subscriptionId }), resetNewAddressDataInLocalStore(INVOICING_SUBSCRIPTION_SHIPPING_ADDRESS_TYPE), openSnackbar({
|
|
75
|
+
messageSection: 'invoicing_subscription_saved',
|
|
76
|
+
messageText: 'success',
|
|
77
|
+
type: 'success',
|
|
78
|
+
}));
|
|
62
79
|
return resultActions;
|
|
63
80
|
}));
|
|
64
81
|
}));
|
|
@@ -7,7 +7,20 @@ export const initialState = {
|
|
|
7
7
|
auditLogEntityRouteOptions: [],
|
|
8
8
|
auditLogListSortFieldOptions: [],
|
|
9
9
|
auditLogSourceLabels: [],
|
|
10
|
+
autoCollectionOptions: [],
|
|
11
|
+
billingPeriodUnitOptions: [],
|
|
12
|
+
catalogTrialEndActionOptions: [],
|
|
13
|
+
catalogTrialUnitOptions: [],
|
|
14
|
+
customerTypeOptions: [],
|
|
15
|
+
dateFormatOptions: [],
|
|
16
|
+
discountApplyOnOptions: [],
|
|
17
|
+
discountDurationTypeOptions: [],
|
|
18
|
+
discountTypeOptions: [],
|
|
10
19
|
dunningScheduleActionOptions: [],
|
|
20
|
+
manualPaymentMethodOptions: [],
|
|
21
|
+
netTermDayOptions: [],
|
|
22
|
+
paymentGatewayOptions: [],
|
|
23
|
+
taxabilityOptions: [],
|
|
11
24
|
enableFetchState: { fetchState: 'Not-Started', error: undefined },
|
|
12
25
|
subscriptionLifecycleActionOptions: [],
|
|
13
26
|
subscriptionCommercialEditAllowedFromStatuses: [],
|
|
@@ -28,6 +41,8 @@ export const initialState = {
|
|
|
28
41
|
invoicingTosAcceptanceUserAgent: undefined,
|
|
29
42
|
invoicingTosAcceptanceUserId: undefined,
|
|
30
43
|
isInvoicingSettingsSeeded: undefined,
|
|
44
|
+
createdAt: undefined,
|
|
45
|
+
updatedAt: undefined,
|
|
31
46
|
hasValidState() {
|
|
32
47
|
return (this.fetchState === 'Completed' && this.isInvoicingTosAccepted != null);
|
|
33
48
|
},
|
|
@@ -43,6 +58,21 @@ export function mapInvoicingConfigPayloadToState(payload) {
|
|
|
43
58
|
code: option.code,
|
|
44
59
|
name: option.name,
|
|
45
60
|
})),
|
|
61
|
+
autoCollectionOptions: (payload.auto_collection_options ?? []).map(toInvoicingNamedOption),
|
|
62
|
+
billingPeriodUnitOptions: (payload.billing_period_unit_options ?? []).map(toInvoicingNamedOption),
|
|
63
|
+
catalogTrialEndActionOptions: (payload.catalog_trial_end_action_options ?? []).map(toInvoicingNamedOption),
|
|
64
|
+
catalogTrialUnitOptions: (payload.catalog_trial_unit_options ?? []).map(toInvoicingNamedOption),
|
|
65
|
+
customerTypeOptions: (payload.customer_type_options ?? []).map(toInvoicingNamedOption),
|
|
66
|
+
dateFormatOptions: (payload.date_format_options ?? []).map(toInvoicingNamedOption),
|
|
67
|
+
discountApplyOnOptions: (payload.discount_apply_on_options ?? []).map(toInvoicingNamedOption),
|
|
68
|
+
discountDurationTypeOptions: (payload.discount_duration_type_options ?? []).map(toInvoicingNamedOption),
|
|
69
|
+
discountTypeOptions: (payload.discount_type_options ?? []).map(toInvoicingNamedOption),
|
|
70
|
+
manualPaymentMethodOptions: (payload.manual_payment_method_options ?? []).map(toInvoicingNamedOption),
|
|
71
|
+
netTermDayOptions: (payload.net_term_day_options ?? []).map(toInvoicingNamedOption),
|
|
72
|
+
paymentGatewayOptions: (payload.payment_gateway_options ?? []).map(toInvoicingNamedOption),
|
|
73
|
+
taxabilityOptions: (payload.taxability_options ?? []).map(toInvoicingNamedOption),
|
|
74
|
+
createdAt: payload.created_at ?? undefined,
|
|
75
|
+
updatedAt: payload.updated_at ?? undefined,
|
|
46
76
|
dunningScheduleActionOptions: payload.dunning_schedule_action_options.map((option) => ({
|
|
47
77
|
code: toInvoicingDunningAction(option.code),
|
|
48
78
|
name: option.name,
|
|
@@ -1,35 +1,10 @@
|
|
|
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
|
-
*/
|
|
8
2
|
export const getInvoicingConfigView = (state) => {
|
|
9
3
|
const configState = state.invoicingConfigViewState;
|
|
10
4
|
return {
|
|
5
|
+
...configState,
|
|
11
6
|
acceptTermsState: configState.acceptTermsFetchState,
|
|
12
|
-
auditLogEntityRouteOptions: configState.auditLogEntityRouteOptions,
|
|
13
|
-
auditLogListSortFieldOptions: configState.auditLogListSortFieldOptions,
|
|
14
|
-
auditLogSourceLabels: configState.auditLogSourceLabels,
|
|
15
|
-
dunningScheduleActionOptions: configState.dunningScheduleActionOptions,
|
|
16
7
|
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,
|
|
33
8
|
status: deriveInvoicingOnboardingStatus(configState.isInvoicingTosAccepted, configState.isInvoicingEnabled),
|
|
34
9
|
};
|
|
35
10
|
};
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { from } from 'rxjs';
|
|
2
2
|
import { catchError, filter, mergeMap } from 'rxjs/operators';
|
|
3
3
|
import { updateInvoices } from '../../../entity/invoicing/invoice/invoiceReducer';
|
|
4
4
|
import { updateInvoicingTransactions } from '../../../entity/invoicing/invoicingTransaction/invoicingTransactionReducer';
|
|
5
|
+
import { openSnackbar } from '../../../entity/snackbar/snackbarReducer';
|
|
5
6
|
import { createZeniAPIStatus, isSuccessResponse } from '../../../responsePayload';
|
|
6
7
|
import { fetchInvoiceDetail } from '../invoiceDetail/invoiceDetailReducer';
|
|
7
8
|
import { addInvoicingTransactionToList } from '../invoicingTransactionListView/invoicingTransactionListViewReducer';
|
|
@@ -26,11 +27,30 @@ export const recordPaymentEpic = (actions$, state$, zeniAPI) => actions$.pipe(fi
|
|
|
26
27
|
updateInvoices([response.data], 'merge'),
|
|
27
28
|
fetchInvoiceDetail({ invoiceId }),
|
|
28
29
|
recordPaymentSuccess({ invoiceId }),
|
|
30
|
+
openSnackbar({
|
|
31
|
+
messageSection: 'invoicing_payment_recorded',
|
|
32
|
+
messageText: 'success',
|
|
33
|
+
type: 'success',
|
|
34
|
+
}),
|
|
29
35
|
];
|
|
30
36
|
}
|
|
31
|
-
return
|
|
32
|
-
|
|
33
|
-
|
|
37
|
+
return from([
|
|
38
|
+
recordPaymentFailure(response.status),
|
|
39
|
+
openSnackbar({
|
|
40
|
+
messageSection: 'invoicing_payment_recorded',
|
|
41
|
+
messageText: 'failed',
|
|
42
|
+
type: 'error',
|
|
43
|
+
}),
|
|
44
|
+
]);
|
|
45
|
+
}), catchError((error) => from([
|
|
46
|
+
recordPaymentFailure(createZeniAPIStatus('Unexpected Error', 'Record payment REST API call errored out ' +
|
|
47
|
+
JSON.stringify(error))),
|
|
48
|
+
openSnackbar({
|
|
49
|
+
messageSection: 'invoicing_payment_recorded',
|
|
50
|
+
messageText: 'failed',
|
|
51
|
+
type: 'error',
|
|
52
|
+
}),
|
|
53
|
+
])));
|
|
34
54
|
}
|
|
35
55
|
const apiUrl = `${zeniAPI.apiEndPoints.invoicingMicroServiceBaseUrl}/1.0/payments`;
|
|
36
56
|
const data = localDataToRecordPaymentPayload(draft);
|
|
@@ -49,9 +69,28 @@ export const recordPaymentEpic = (actions$, state$, zeniAPI) => actions$.pipe(fi
|
|
|
49
69
|
if (linkedInvoiceId != null) {
|
|
50
70
|
successActions.push(fetchInvoiceDetail({ invoiceId: linkedInvoiceId }));
|
|
51
71
|
}
|
|
72
|
+
successActions.push(openSnackbar({
|
|
73
|
+
messageSection: 'invoicing_payment_recorded',
|
|
74
|
+
messageText: 'success',
|
|
75
|
+
type: 'success',
|
|
76
|
+
}));
|
|
52
77
|
return successActions;
|
|
53
78
|
}
|
|
54
|
-
return
|
|
55
|
-
|
|
56
|
-
|
|
79
|
+
return from([
|
|
80
|
+
recordPaymentFailure(response.status),
|
|
81
|
+
openSnackbar({
|
|
82
|
+
messageSection: 'invoicing_payment_recorded',
|
|
83
|
+
messageText: 'failed',
|
|
84
|
+
type: 'error',
|
|
85
|
+
}),
|
|
86
|
+
]);
|
|
87
|
+
}), catchError((error) => from([
|
|
88
|
+
recordPaymentFailure(createZeniAPIStatus('Unexpected Error', 'Record payment REST API call errored out ' +
|
|
89
|
+
JSON.stringify(error))),
|
|
90
|
+
openSnackbar({
|
|
91
|
+
messageSection: 'invoicing_payment_recorded',
|
|
92
|
+
messageText: 'failed',
|
|
93
|
+
type: 'error',
|
|
94
|
+
}),
|
|
95
|
+
])));
|
|
57
96
|
}));
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { getFormattedAddress } from '../../addressView/addressViewSelector';
|
|
2
|
+
import { getInvoicingConfigView } from '../invoicingConfigView/invoicingConfigViewSelector';
|
|
2
3
|
import { INVOICING_BUSINESS_ADDRESS_TYPE, entityToInvoicingBrandingFormLocalData, } from './invoicingBrandingFormConfig';
|
|
3
4
|
/**
|
|
4
5
|
* Shared primitive: the raw invoicing settings. Consumed internally by other
|
|
@@ -33,7 +34,8 @@ export const getInvoicingSettingsView = (state) => {
|
|
|
33
34
|
* Bundled view for the branding settings form: the draft `localData` (seeded
|
|
34
35
|
* from the existing settings until the user edits), the business-address label
|
|
35
36
|
* (from the shared Address screen, seeded on load from `address_id`), the raw
|
|
36
|
-
* settings (for the logo/preview)
|
|
37
|
+
* settings (for the logo/preview), the backend date-format choices and the
|
|
38
|
+
* save fetch state.
|
|
37
39
|
*/
|
|
38
40
|
export const getInvoicingBrandingFormView = (state) => {
|
|
39
41
|
const { brandingDraft, saveFetchState, settings } = state.invoicingSettingsViewState;
|
|
@@ -43,6 +45,7 @@ export const getInvoicingBrandingFormView = (state) => {
|
|
|
43
45
|
: undefined;
|
|
44
46
|
return {
|
|
45
47
|
addressLabel,
|
|
48
|
+
dateFormatOptions: getInvoicingConfigView(state).dateFormatOptions,
|
|
46
49
|
localData: brandingDraft ?? entityToInvoicingBrandingFormLocalData(settings),
|
|
47
50
|
saveState: saveFetchState,
|
|
48
51
|
settings,
|
package/lib/view/invoicing/editInvoicingCatalogItemDetailView/saveInvoicingCatalogItemEpic.d.ts
CHANGED
|
@@ -2,9 +2,10 @@ import { ActionsObservable, StateObservable } from 'redux-observable';
|
|
|
2
2
|
import { Observable } from 'rxjs';
|
|
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';
|
|
5
6
|
import { RootState } from '../../../reducer';
|
|
6
7
|
import { ZeniAPI } from '../../../zeniAPI';
|
|
7
8
|
import { addInvoicingCatalogItem } from '../invoicingCatalogListView/invoicingCatalogListViewReducer';
|
|
8
9
|
import { saveInvoicingCatalogItem, submitInvoicingCatalogItemForm, submitInvoicingCatalogItemFormFailure, submitInvoicingCatalogItemFormSuccess } from './editInvoicingCatalogItemDetailViewReducer';
|
|
9
|
-
export type ActionType = ReturnType<typeof submitInvoicingCatalogItemForm> | ReturnType<typeof saveInvoicingCatalogItem> | ReturnType<typeof submitInvoicingCatalogItemFormSuccess> | ReturnType<typeof submitInvoicingCatalogItemFormFailure> | ReturnType<typeof updateInvoicingPlans> | ReturnType<typeof updateInvoicingProducts> | ReturnType<typeof mergeInvoicingPlanSubFamily> | ReturnType<typeof addInvoicingCatalogItem>;
|
|
10
|
+
export type ActionType = ReturnType<typeof submitInvoicingCatalogItemForm> | ReturnType<typeof saveInvoicingCatalogItem> | ReturnType<typeof submitInvoicingCatalogItemFormSuccess> | ReturnType<typeof submitInvoicingCatalogItemFormFailure> | ReturnType<typeof updateInvoicingPlans> | ReturnType<typeof updateInvoicingProducts> | ReturnType<typeof mergeInvoicingPlanSubFamily> | ReturnType<typeof addInvoicingCatalogItem> | ReturnType<typeof openSnackbar>;
|
|
10
11
|
export declare const saveInvoicingCatalogItemEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
|
package/lib/view/invoicing/editInvoicingCatalogItemDetailView/saveInvoicingCatalogItemEpic.js
CHANGED
|
@@ -5,6 +5,7 @@ const rxjs_1 = require("rxjs");
|
|
|
5
5
|
const operators_1 = require("rxjs/operators");
|
|
6
6
|
const planReducer_1 = require("../../../entity/invoicing/plan/planReducer");
|
|
7
7
|
const productReducer_1 = require("../../../entity/invoicing/product/productReducer");
|
|
8
|
+
const snackbarReducer_1 = require("../../../entity/snackbar/snackbarReducer");
|
|
8
9
|
const responsePayload_1 = require("../../../responsePayload");
|
|
9
10
|
const invoicingCatalogListViewReducer_1 = require("../invoicingCatalogListView/invoicingCatalogListViewReducer");
|
|
10
11
|
const editInvoicingCatalogItemDetailViewPayload_1 = require("./editInvoicingCatalogItemDetailViewPayload");
|
|
@@ -41,7 +42,14 @@ const saveInvoicingCatalogItemEpic = (actions$, state$, zeniAPI) => actions$.pip
|
|
|
41
42
|
const failedProductResponse = productResponses.find((productResponse) => !(0, responsePayload_1.isSuccessResponse)(productResponse) ||
|
|
42
43
|
productResponse.data == null);
|
|
43
44
|
if (failedProductResponse != null) {
|
|
44
|
-
return (0, rxjs_1.
|
|
45
|
+
return (0, rxjs_1.from)([
|
|
46
|
+
(0, editInvoicingCatalogItemDetailViewReducer_1.submitInvoicingCatalogItemFormFailure)(failedProductResponse.status),
|
|
47
|
+
(0, snackbarReducer_1.openSnackbar)({
|
|
48
|
+
messageSection: 'invoicing_catalog_item_saved',
|
|
49
|
+
messageText: 'failed',
|
|
50
|
+
type: 'error',
|
|
51
|
+
}),
|
|
52
|
+
]);
|
|
45
53
|
}
|
|
46
54
|
const savedProducts = productResponses.flatMap((productResponse) => productResponse.data != null ? [productResponse.data] : []);
|
|
47
55
|
const resultActions = [
|
|
@@ -68,6 +76,11 @@ const saveInvoicingCatalogItemEpic = (actions$, state$, zeniAPI) => actions$.pip
|
|
|
68
76
|
: 'plan';
|
|
69
77
|
resultActions.push((0, invoicingCatalogListViewReducer_1.addInvoicingCatalogItem)({ id: savedItem.id, type: itemType }));
|
|
70
78
|
}
|
|
79
|
+
resultActions.push((0, snackbarReducer_1.openSnackbar)({
|
|
80
|
+
messageSection: 'invoicing_catalog_item_saved',
|
|
81
|
+
messageText: 'success',
|
|
82
|
+
type: 'success',
|
|
83
|
+
}));
|
|
71
84
|
return resultActions;
|
|
72
85
|
};
|
|
73
86
|
const productUpdates = editInvoicingCatalogItemDetailViewReducer_1.saveInvoicingCatalogItem.match(action)
|
|
@@ -78,8 +91,22 @@ const saveInvoicingCatalogItemEpic = (actions$, state$, zeniAPI) => actions$.pip
|
|
|
78
91
|
}
|
|
79
92
|
return (0, rxjs_1.forkJoin)(productUpdates.map((productUpdate) => zeniAPI.putAndGetJSON(`${baseUrl}/catalog/products/${encodeURIComponent(productUpdate.id)}`, productUpdate.data))).pipe((0, operators_1.mergeMap)(completeSave));
|
|
80
93
|
}
|
|
81
|
-
return (0, rxjs_1.
|
|
82
|
-
|
|
83
|
-
|
|
94
|
+
return (0, rxjs_1.from)([
|
|
95
|
+
(0, editInvoicingCatalogItemDetailViewReducer_1.submitInvoicingCatalogItemFormFailure)(response.status),
|
|
96
|
+
(0, snackbarReducer_1.openSnackbar)({
|
|
97
|
+
messageSection: 'invoicing_catalog_item_saved',
|
|
98
|
+
messageText: 'failed',
|
|
99
|
+
type: 'error',
|
|
100
|
+
}),
|
|
101
|
+
]);
|
|
102
|
+
}), (0, operators_1.catchError)((error) => (0, rxjs_1.from)([
|
|
103
|
+
(0, editInvoicingCatalogItemDetailViewReducer_1.submitInvoicingCatalogItemFormFailure)((0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Save catalog item REST API call errored out ' +
|
|
104
|
+
JSON.stringify(error))),
|
|
105
|
+
(0, snackbarReducer_1.openSnackbar)({
|
|
106
|
+
messageSection: 'invoicing_catalog_item_saved',
|
|
107
|
+
messageText: 'failed',
|
|
108
|
+
type: 'error',
|
|
109
|
+
}),
|
|
110
|
+
])));
|
|
84
111
|
}));
|
|
85
112
|
exports.saveInvoicingCatalogItemEpic = saveInvoicingCatalogItemEpic;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { ActionsObservable, StateObservable } from 'redux-observable';
|
|
2
2
|
import { Observable } from 'rxjs';
|
|
3
3
|
import { updateInvoicingCoupons } from '../../../entity/invoicing/coupon/couponReducer';
|
|
4
|
+
import { openSnackbar } from '../../../entity/snackbar/snackbarReducer';
|
|
4
5
|
import { RootState } from '../../../reducer';
|
|
5
6
|
import { ZeniAPI } from '../../../zeniAPI';
|
|
6
7
|
import { addInvoicingCouponToList } from '../couponView/couponViewReducer';
|
|
7
8
|
import { saveInvoicingCoupon, submitInvoicingCouponForm, submitInvoicingCouponFormFailure, submitInvoicingCouponFormSuccess } from './editInvoicingCouponDetailViewReducer';
|
|
8
|
-
export type ActionType = ReturnType<typeof submitInvoicingCouponForm> | ReturnType<typeof saveInvoicingCoupon> | ReturnType<typeof submitInvoicingCouponFormSuccess> | ReturnType<typeof submitInvoicingCouponFormFailure> | ReturnType<typeof updateInvoicingCoupons> | ReturnType<typeof addInvoicingCouponToList>;
|
|
9
|
+
export type ActionType = ReturnType<typeof submitInvoicingCouponForm> | ReturnType<typeof saveInvoicingCoupon> | ReturnType<typeof submitInvoicingCouponFormSuccess> | ReturnType<typeof submitInvoicingCouponFormFailure> | ReturnType<typeof updateInvoicingCoupons> | ReturnType<typeof addInvoicingCouponToList> | ReturnType<typeof openSnackbar>;
|
|
9
10
|
export declare const saveInvoicingCouponEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
|
|
@@ -4,6 +4,7 @@ exports.saveInvoicingCouponEpic = void 0;
|
|
|
4
4
|
const rxjs_1 = require("rxjs");
|
|
5
5
|
const operators_1 = require("rxjs/operators");
|
|
6
6
|
const couponReducer_1 = require("../../../entity/invoicing/coupon/couponReducer");
|
|
7
|
+
const snackbarReducer_1 = require("../../../entity/snackbar/snackbarReducer");
|
|
7
8
|
const responsePayload_1 = require("../../../responsePayload");
|
|
8
9
|
const couponViewReducer_1 = require("../couponView/couponViewReducer");
|
|
9
10
|
const editInvoicingCouponDetailViewPayload_1 = require("./editInvoicingCouponDetailViewPayload");
|
|
@@ -46,9 +47,28 @@ const saveInvoicingCouponEpic = (actions$, state$, zeniAPI) => actions$.pipe((0,
|
|
|
46
47
|
status: couponPayload.status,
|
|
47
48
|
}));
|
|
48
49
|
}
|
|
50
|
+
resultActions.push((0, snackbarReducer_1.openSnackbar)({
|
|
51
|
+
messageSection: 'invoicing_coupon_saved',
|
|
52
|
+
messageText: 'success',
|
|
53
|
+
type: 'success',
|
|
54
|
+
}));
|
|
49
55
|
return resultActions;
|
|
50
56
|
}
|
|
51
|
-
return (0, rxjs_1.
|
|
52
|
-
|
|
57
|
+
return (0, rxjs_1.from)([
|
|
58
|
+
(0, editInvoicingCouponDetailViewReducer_1.submitInvoicingCouponFormFailure)(response.status),
|
|
59
|
+
(0, snackbarReducer_1.openSnackbar)({
|
|
60
|
+
messageSection: 'invoicing_coupon_saved',
|
|
61
|
+
messageText: 'failed',
|
|
62
|
+
type: 'error',
|
|
63
|
+
}),
|
|
64
|
+
]);
|
|
65
|
+
}), (0, operators_1.catchError)((error) => (0, rxjs_1.from)([
|
|
66
|
+
(0, editInvoicingCouponDetailViewReducer_1.submitInvoicingCouponFormFailure)((0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Save coupon REST API call errored out ' + JSON.stringify(error))),
|
|
67
|
+
(0, snackbarReducer_1.openSnackbar)({
|
|
68
|
+
messageSection: 'invoicing_coupon_saved',
|
|
69
|
+
messageText: 'failed',
|
|
70
|
+
type: 'error',
|
|
71
|
+
}),
|
|
72
|
+
])));
|
|
53
73
|
}));
|
|
54
74
|
exports.saveInvoicingCouponEpic = saveInvoicingCouponEpic;
|
|
@@ -2,10 +2,11 @@ import { ActionsObservable, StateObservable } from 'redux-observable';
|
|
|
2
2
|
import { Observable } from 'rxjs';
|
|
3
3
|
import { updateAddresses } from '../../../entity/address/addressReducer';
|
|
4
4
|
import { updateInvoicingCustomers } from '../../../entity/invoicing/invoicingCustomer/invoicingCustomerReducer';
|
|
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 { addInvoicingCustomerToList } from '../invoicingCustomerListView/invoicingCustomerListViewReducer';
|
|
9
10
|
import { submitInvoicingCustomerForm, submitInvoicingCustomerFormFailure, submitInvoicingCustomerFormSuccess } from './editInvoicingCustomerDetailViewReducer';
|
|
10
|
-
export type ActionType = ReturnType<typeof submitInvoicingCustomerForm> | ReturnType<typeof submitInvoicingCustomerFormSuccess> | ReturnType<typeof submitInvoicingCustomerFormFailure> | ReturnType<typeof resetNewAddressDataInLocalStore> | ReturnType<typeof updateAddresses> | ReturnType<typeof updateInvoicingCustomers> | ReturnType<typeof addInvoicingCustomerToList>;
|
|
11
|
+
export type ActionType = ReturnType<typeof submitInvoicingCustomerForm> | ReturnType<typeof submitInvoicingCustomerFormSuccess> | ReturnType<typeof submitInvoicingCustomerFormFailure> | ReturnType<typeof resetNewAddressDataInLocalStore> | ReturnType<typeof updateAddresses> | ReturnType<typeof updateInvoicingCustomers> | ReturnType<typeof addInvoicingCustomerToList> | ReturnType<typeof openSnackbar>;
|
|
11
12
|
export declare const saveInvoicingCustomerEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
|
|
@@ -6,6 +6,7 @@ const operators_1 = require("rxjs/operators");
|
|
|
6
6
|
const addressReducer_1 = require("../../../entity/address/addressReducer");
|
|
7
7
|
const invoicingCustomerPayload_1 = require("../../../entity/invoicing/invoicingCustomer/invoicingCustomerPayload");
|
|
8
8
|
const invoicingCustomerReducer_1 = require("../../../entity/invoicing/invoicingCustomer/invoicingCustomerReducer");
|
|
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 invoicingCustomerListViewReducer_1 = require("../invoicingCustomerListView/invoicingCustomerListViewReducer");
|
|
@@ -48,10 +49,29 @@ const saveInvoicingCustomerEpic = (actions$, state$, zeniAPI) => actions$.pipe((
|
|
|
48
49
|
status: response.data.status,
|
|
49
50
|
}));
|
|
50
51
|
}
|
|
52
|
+
resultActions.push((0, snackbarReducer_1.openSnackbar)({
|
|
53
|
+
messageSection: 'invoicing_customer_saved',
|
|
54
|
+
messageText: 'success',
|
|
55
|
+
type: 'success',
|
|
56
|
+
}));
|
|
51
57
|
return resultActions;
|
|
52
58
|
}
|
|
53
|
-
return (0, rxjs_1.
|
|
54
|
-
|
|
55
|
-
|
|
59
|
+
return (0, rxjs_1.from)([
|
|
60
|
+
(0, editInvoicingCustomerDetailViewReducer_1.submitInvoicingCustomerFormFailure)(response.status),
|
|
61
|
+
(0, snackbarReducer_1.openSnackbar)({
|
|
62
|
+
messageSection: 'invoicing_customer_saved',
|
|
63
|
+
messageText: 'failed',
|
|
64
|
+
type: 'error',
|
|
65
|
+
}),
|
|
66
|
+
]);
|
|
67
|
+
}), (0, operators_1.catchError)((error) => (0, rxjs_1.from)([
|
|
68
|
+
(0, editInvoicingCustomerDetailViewReducer_1.submitInvoicingCustomerFormFailure)((0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Save customer REST API call errored out ' +
|
|
69
|
+
JSON.stringify(error))),
|
|
70
|
+
(0, snackbarReducer_1.openSnackbar)({
|
|
71
|
+
messageSection: 'invoicing_customer_saved',
|
|
72
|
+
messageText: 'failed',
|
|
73
|
+
type: 'error',
|
|
74
|
+
}),
|
|
75
|
+
])));
|
|
56
76
|
}));
|
|
57
77
|
exports.saveInvoicingCustomerEpic = saveInvoicingCustomerEpic;
|