@zeniai/client-epic-state 5.1.85 → 5.1.86
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/customerSatisfaction/customerSatisfactionReducer.d.ts +1 -1
- package/lib/entity/customerSatisfaction/customerSatisfactionReducer.js +2 -6
- package/lib/entity/snackbar/snackbarTypes.d.ts +1 -1
- package/lib/entity/snackbar/snackbarTypes.js +0 -29
- package/lib/esm/entity/customerSatisfaction/customerSatisfactionReducer.js +1 -4
- package/lib/esm/entity/snackbar/snackbarTypes.js +0 -29
- package/lib/esm/index.js +1 -1
- package/lib/esm/view/companyHealthMetricView/companyHealthMetricConfigReducer.js +1 -4
- package/lib/esm/view/invoicing/createCreditNote/createCreditNoteEpic.js +4 -24
- package/lib/esm/view/invoicing/createInvoice/createInvoiceEpic.js +4 -24
- package/lib/esm/view/invoicing/createInvoice/createInvoiceSelector.js +10 -37
- package/lib/esm/view/invoicing/discountAction/discountActionEpic.js +9 -33
- package/lib/esm/view/invoicing/dunningAction/dunningActionEpic.js +9 -35
- package/lib/esm/view/invoicing/editInvoicingCatalogItemDetailView/catalogDetailEditPayload.js +1 -5
- package/lib/esm/view/invoicing/editInvoicingCatalogItemDetailView/saveInvoicingCatalogItemEpic.js +5 -32
- package/lib/esm/view/invoicing/editInvoicingCouponDetailView/saveInvoicingCouponEpic.js +3 -23
- package/lib/esm/view/invoicing/editInvoicingCustomerDetailView/saveInvoicingCustomerEpic.js +4 -24
- package/lib/esm/view/invoicing/editInvoicingSubscriptionDetailView/saveInvoicingSubscriptionEpic.js +4 -24
- package/lib/esm/view/invoicing/editInvoicingSubscriptionDetailView/syncInvoicingSubscriptionCouponsEpic.js +3 -20
- package/lib/esm/view/invoicing/invoiceAction/invoiceActionEpic.js +17 -60
- package/lib/esm/view/invoicing/invoicingConfigView/invoicingConfigViewReducer.js +0 -30
- package/lib/esm/view/invoicing/invoicingConfigView/invoicingConfigViewSelector.js +29 -4
- package/lib/esm/view/invoicing/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 +3 -4
- package/lib/index.js +8 -7
- package/lib/view/companyHealthMetricView/companyHealthMetricConfigReducer.d.ts +1 -1
- package/lib/view/companyHealthMetricView/companyHealthMetricConfigReducer.js +2 -5
- package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.d.ts +1 -1
- package/lib/view/invoicing/createCreditNote/createCreditNoteEpic.d.ts +1 -2
- package/lib/view/invoicing/createCreditNote/createCreditNoteEpic.js +3 -23
- package/lib/view/invoicing/createInvoice/createInvoiceEpic.d.ts +1 -2
- package/lib/view/invoicing/createInvoice/createInvoiceEpic.js +3 -23
- package/lib/view/invoicing/createInvoice/createInvoiceSelector.d.ts +8 -22
- package/lib/view/invoicing/createInvoice/createInvoiceSelector.js +10 -37
- package/lib/view/invoicing/discountAction/discountActionEpic.d.ts +1 -2
- package/lib/view/invoicing/discountAction/discountActionEpic.js +8 -32
- package/lib/view/invoicing/dunningAction/dunningActionEpic.d.ts +1 -2
- package/lib/view/invoicing/dunningAction/dunningActionEpic.js +8 -34
- package/lib/view/invoicing/editInvoicingCatalogItemDetailView/catalogDetailEditPayload.d.ts +1 -3
- package/lib/view/invoicing/editInvoicingCatalogItemDetailView/catalogDetailEditPayload.js +1 -5
- package/lib/view/invoicing/editInvoicingCatalogItemDetailView/saveInvoicingCatalogItemEpic.d.ts +1 -2
- package/lib/view/invoicing/editInvoicingCatalogItemDetailView/saveInvoicingCatalogItemEpic.js +4 -31
- package/lib/view/invoicing/editInvoicingCouponDetailView/saveInvoicingCouponEpic.d.ts +1 -2
- package/lib/view/invoicing/editInvoicingCouponDetailView/saveInvoicingCouponEpic.js +2 -22
- package/lib/view/invoicing/editInvoicingCustomerDetailView/saveInvoicingCustomerEpic.d.ts +1 -2
- package/lib/view/invoicing/editInvoicingCustomerDetailView/saveInvoicingCustomerEpic.js +3 -23
- package/lib/view/invoicing/editInvoicingSubscriptionDetailView/saveInvoicingSubscriptionEpic.d.ts +1 -2
- package/lib/view/invoicing/editInvoicingSubscriptionDetailView/saveInvoicingSubscriptionEpic.js +3 -23
- package/lib/view/invoicing/editInvoicingSubscriptionDetailView/syncInvoicingSubscriptionCouponsEpic.d.ts +1 -2
- package/lib/view/invoicing/editInvoicingSubscriptionDetailView/syncInvoicingSubscriptionCouponsEpic.js +2 -19
- package/lib/view/invoicing/invoiceAction/invoiceActionEpic.d.ts +1 -2
- package/lib/view/invoicing/invoiceAction/invoiceActionEpic.js +16 -59
- package/lib/view/invoicing/invoicingConfigView/invoicingConfigViewPayload.d.ts +0 -13
- package/lib/view/invoicing/invoicingConfigView/invoicingConfigViewReducer.d.ts +1 -1
- package/lib/view/invoicing/invoicingConfigView/invoicingConfigViewReducer.js +0 -30
- package/lib/view/invoicing/invoicingConfigView/invoicingConfigViewSelector.d.ts +31 -11
- package/lib/view/invoicing/invoicingConfigView/invoicingConfigViewSelector.js +29 -4
- package/lib/view/invoicing/invoicingConfigView/invoicingConfigViewState.d.ts +0 -15
- package/lib/view/invoicing/invoicingQboView/epics/invoicingQboViewActionType.d.ts +1 -2
- package/lib/view/invoicing/invoicingQboView/epics/retryInvoicingQboSyncTaskEpic.js +9 -28
- package/lib/view/invoicing/invoicingQboView/epics/startInvoicingQboBackfillEpic.js +4 -27
- package/lib/view/invoicing/issueCreditNote/issueCreditNoteEpic.d.ts +1 -2
- package/lib/view/invoicing/issueCreditNote/issueCreditNoteEpic.js +3 -23
- package/lib/view/invoicing/issueCreditNote/issueCreditNoteSelector.d.ts +7 -24
- package/lib/view/invoicing/issueCreditNote/issueCreditNoteSelector.js +16 -23
- package/lib/view/invoicing/recordPayment/recordPaymentEpic.d.ts +1 -2
- package/lib/view/invoicing/recordPayment/recordPaymentEpic.js +6 -45
- package/lib/view/invoicing/settingsView/settingsViewEpics.d.ts +1 -2
- package/lib/view/invoicing/settingsView/settingsViewEpics.js +7 -25
- package/lib/view/invoicing/settingsView/settingsViewReducer.d.ts +1 -10
- package/lib/view/invoicing/settingsView/settingsViewReducer.js +1 -1
- package/lib/view/invoicing/settingsView/settingsViewSelector.d.ts +2 -4
- package/lib/view/invoicing/settingsView/settingsViewSelector.js +1 -4
- package/lib/view/invoicing/subscriptionAction/subscriptionActionEpic.d.ts +1 -2
- package/lib/view/invoicing/subscriptionAction/subscriptionActionEpic.js +8 -40
- package/lib/view/vendorFiling1099/vendorFiling1099UploadDetails/vendorFiling1099UploadDetailsReducer.d.ts +1 -1
- package/lib/view/vendorFiling1099/vendorFiling1099UploadDetails/vendorFiling1099UploadDetailsReducer.js +2 -5
- package/lib/view/vendorTabView/vendorTabViewReducer.d.ts +1 -1
- package/lib/view/vendorTabView/vendorTabViewReducer.js +2 -5
- package/package.json +1 -1
|
@@ -4,28 +4,11 @@ exports.runInvoicingDiscountActionEpic = 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");
|
|
8
7
|
const responsePayload_1 = require("../../../responsePayload");
|
|
9
8
|
const discountActionReducer_1 = require("./discountActionReducer");
|
|
10
|
-
/** Snackbar copy per action kind; unlisted kinds run without one. */
|
|
11
|
-
const SNACKBAR_SECTION_BY_KIND = {
|
|
12
|
-
archive: 'invoicing_discount_archive',
|
|
13
|
-
delete: 'invoicing_discount_delete',
|
|
14
|
-
unarchive: 'invoicing_discount_unarchive',
|
|
15
|
-
};
|
|
16
9
|
const runInvoicingDiscountActionEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(discountActionReducer_1.runInvoicingDiscountAction.match), (0, operators_1.mergeMap)((action) => {
|
|
17
10
|
const { action: kind, id } = action.payload;
|
|
18
11
|
const requestBody = { action: kind };
|
|
19
|
-
const snackbarSection = SNACKBAR_SECTION_BY_KIND[kind];
|
|
20
|
-
const snackbar = (messageText) => snackbarSection == null
|
|
21
|
-
? []
|
|
22
|
-
: [
|
|
23
|
-
(0, snackbarReducer_1.openSnackbar)({
|
|
24
|
-
messageSection: snackbarSection,
|
|
25
|
-
messageText,
|
|
26
|
-
type: messageText === 'success' ? 'success' : 'error',
|
|
27
|
-
}),
|
|
28
|
-
];
|
|
29
12
|
const apiUrl = `${zeniAPI.apiEndPoints.invoicingMicroServiceBaseUrl}/1.0/discounts/${encodeURIComponent(id)}/actions`;
|
|
30
13
|
return zeniAPI
|
|
31
14
|
.postAndGetJSON(apiUrl, requestBody)
|
|
@@ -34,23 +17,16 @@ const runInvoicingDiscountActionEpic = (actions$, _state$, zeniAPI) => actions$.
|
|
|
34
17
|
return [
|
|
35
18
|
(0, couponReducer_1.updateInvoicingCoupons)([response.data], 'merge'),
|
|
36
19
|
(0, discountActionReducer_1.runInvoicingDiscountActionSuccess)({ id }),
|
|
37
|
-
...snackbar('success'),
|
|
38
20
|
];
|
|
39
21
|
}
|
|
40
|
-
return (0, rxjs_1.
|
|
41
|
-
|
|
42
|
-
error: response.status,
|
|
43
|
-
id,
|
|
44
|
-
}),
|
|
45
|
-
...snackbar('failed'),
|
|
46
|
-
]);
|
|
47
|
-
}), (0, operators_1.catchError)((error) => (0, rxjs_1.from)([
|
|
48
|
-
(0, discountActionReducer_1.runInvoicingDiscountActionFailure)({
|
|
49
|
-
error: (0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Discount action REST API call errored out ' +
|
|
50
|
-
JSON.stringify(error)),
|
|
22
|
+
return (0, rxjs_1.of)((0, discountActionReducer_1.runInvoicingDiscountActionFailure)({
|
|
23
|
+
error: response.status,
|
|
51
24
|
id,
|
|
52
|
-
})
|
|
53
|
-
|
|
54
|
-
|
|
25
|
+
}));
|
|
26
|
+
}), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, discountActionReducer_1.runInvoicingDiscountActionFailure)({
|
|
27
|
+
error: (0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Discount action REST API call errored out ' +
|
|
28
|
+
JSON.stringify(error)),
|
|
29
|
+
id,
|
|
30
|
+
}))));
|
|
55
31
|
}));
|
|
56
32
|
exports.runInvoicingDiscountActionEpic = runInvoicingDiscountActionEpic;
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { ActionsObservable, StateObservable } from 'redux-observable';
|
|
2
2
|
import { Observable } from 'rxjs';
|
|
3
3
|
import { updateInvoicingDunningCases } from '../../../entity/invoicing/dunningCase/dunningCaseReducer';
|
|
4
|
-
import { openSnackbar } from '../../../entity/snackbar/snackbarReducer';
|
|
5
4
|
import { RootState } from '../../../reducer';
|
|
6
5
|
import { ZeniAPI } from '../../../zeniAPI';
|
|
7
6
|
import { runInvoicingDunningAction, runInvoicingDunningActionFailure, runInvoicingDunningActionSuccess } from './dunningActionReducer';
|
|
8
|
-
export type ActionType = ReturnType<typeof runInvoicingDunningAction> | ReturnType<typeof runInvoicingDunningActionSuccess> | ReturnType<typeof runInvoicingDunningActionFailure> | ReturnType<typeof updateInvoicingDunningCases
|
|
7
|
+
export type ActionType = ReturnType<typeof runInvoicingDunningAction> | ReturnType<typeof runInvoicingDunningActionSuccess> | ReturnType<typeof runInvoicingDunningActionFailure> | ReturnType<typeof updateInvoicingDunningCases>;
|
|
9
8
|
export declare const runInvoicingDunningActionEpic: (actions$: ActionsObservable<ActionType>, _state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
|
|
@@ -4,29 +4,10 @@ exports.runInvoicingDunningActionEpic = void 0;
|
|
|
4
4
|
const rxjs_1 = require("rxjs");
|
|
5
5
|
const operators_1 = require("rxjs/operators");
|
|
6
6
|
const dunningCaseReducer_1 = require("../../../entity/invoicing/dunningCase/dunningCaseReducer");
|
|
7
|
-
const snackbarReducer_1 = require("../../../entity/snackbar/snackbarReducer");
|
|
8
7
|
const responsePayload_1 = require("../../../responsePayload");
|
|
9
8
|
const dunningActionReducer_1 = require("./dunningActionReducer");
|
|
10
|
-
/**
|
|
11
|
-
* Snackbar copy is per action kind; anything not listed here runs without one.
|
|
12
|
-
*/
|
|
13
|
-
const SNACKBAR_SECTION_BY_KIND = {
|
|
14
|
-
cancel: 'invoicing_dunning_cancel',
|
|
15
|
-
resolve: 'invoicing_dunning_case_resolved',
|
|
16
|
-
retry: 'invoicing_dunning_retry',
|
|
17
|
-
};
|
|
18
9
|
const runInvoicingDunningActionEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(dunningActionReducer_1.runInvoicingDunningAction.match), (0, operators_1.mergeMap)((action) => {
|
|
19
10
|
const { action: kind, body, id } = action.payload;
|
|
20
|
-
const snackbarSection = SNACKBAR_SECTION_BY_KIND[kind];
|
|
21
|
-
const snackbar = (messageText) => snackbarSection == null
|
|
22
|
-
? []
|
|
23
|
-
: [
|
|
24
|
-
(0, snackbarReducer_1.openSnackbar)({
|
|
25
|
-
messageSection: snackbarSection,
|
|
26
|
-
messageText,
|
|
27
|
-
type: messageText === 'success' ? 'success' : 'error',
|
|
28
|
-
}),
|
|
29
|
-
];
|
|
30
11
|
const apiUrl = `${zeniAPI.apiEndPoints.invoicingMicroServiceBaseUrl}/1.0/dunning/${encodeURIComponent(id)}/${kind}`;
|
|
31
12
|
return zeniAPI
|
|
32
13
|
.postAndGetJSON(apiUrl, (body ?? {}))
|
|
@@ -35,23 +16,16 @@ const runInvoicingDunningActionEpic = (actions$, _state$, zeniAPI) => actions$.p
|
|
|
35
16
|
return [
|
|
36
17
|
(0, dunningCaseReducer_1.updateInvoicingDunningCases)([response.data], 'merge'),
|
|
37
18
|
(0, dunningActionReducer_1.runInvoicingDunningActionSuccess)({ id }),
|
|
38
|
-
...snackbar('success'),
|
|
39
19
|
];
|
|
40
20
|
}
|
|
41
|
-
return (0, rxjs_1.
|
|
42
|
-
|
|
43
|
-
error: response.status,
|
|
44
|
-
id,
|
|
45
|
-
}),
|
|
46
|
-
...snackbar('failed'),
|
|
47
|
-
]);
|
|
48
|
-
}), (0, operators_1.catchError)((error) => (0, rxjs_1.from)([
|
|
49
|
-
(0, dunningActionReducer_1.runInvoicingDunningActionFailure)({
|
|
50
|
-
error: (0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Dunning action REST API call errored out ' +
|
|
51
|
-
JSON.stringify(error)),
|
|
21
|
+
return (0, rxjs_1.of)((0, dunningActionReducer_1.runInvoicingDunningActionFailure)({
|
|
22
|
+
error: response.status,
|
|
52
23
|
id,
|
|
53
|
-
})
|
|
54
|
-
|
|
55
|
-
|
|
24
|
+
}));
|
|
25
|
+
}), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, dunningActionReducer_1.runInvoicingDunningActionFailure)({
|
|
26
|
+
error: (0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Dunning action REST API call errored out ' +
|
|
27
|
+
JSON.stringify(error)),
|
|
28
|
+
id,
|
|
29
|
+
}))));
|
|
56
30
|
}));
|
|
57
31
|
exports.runInvoicingDunningActionEpic = runInvoicingDunningActionEpic;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Amount } from '../../../commonStateTypes/amount';
|
|
2
2
|
import type { InvoicingPlan } from '../../../entity/invoicing/plan/planState';
|
|
3
3
|
import type { InvoicingProduct } from '../../../entity/invoicing/product/productState';
|
|
4
|
-
import type { InvoicingCatalogItemFormSubFamily
|
|
4
|
+
import type { InvoicingCatalogItemFormSubFamily } from './editInvoicingCatalogItemDetailViewState';
|
|
5
5
|
export type CatalogDetailSubFamilyEditValues = InvoicingCatalogItemFormSubFamily;
|
|
6
6
|
export interface CatalogDetailEditValues {
|
|
7
7
|
applicableItems: string[];
|
|
@@ -46,8 +46,6 @@ export interface CreateSubFamilyFormValues {
|
|
|
46
46
|
trialPeriod: string;
|
|
47
47
|
trialPeriodUnit: string;
|
|
48
48
|
priceDollars?: Amount;
|
|
49
|
-
/** Only sent for the tiered pricing models, which price per tier. */
|
|
50
|
-
tiers?: InvoicingCatalogItemFormTier[];
|
|
51
49
|
}
|
|
52
50
|
/** Build POST /catalog/products body for Create sub-family. */
|
|
53
51
|
export declare const createSubFamilyFormToPayload: (itemId: string, itemType: string, values: CreateSubFamilyFormValues) => Record<string, unknown>;
|
|
@@ -121,21 +121,17 @@ exports.catalogDetailEditValuesToSavePayload = catalogDetailEditValuesToSavePayl
|
|
|
121
121
|
const createSubFamilyFormToPayload = (itemId, itemType, values) => {
|
|
122
122
|
const name = values.name.trim();
|
|
123
123
|
const priceCode = trimOrUndefined(values.priceCode) ?? toProductCode(name);
|
|
124
|
-
const tiered = (0, invoicingCatalogItemFormConfig_1.isTieredCatalogPricingModel)(values.pricingModel);
|
|
125
124
|
const payload = {
|
|
126
125
|
currency_code: 'USD',
|
|
127
126
|
free_quantity: Number(values.freeQuantity) || 0,
|
|
128
127
|
is_taxable: true,
|
|
129
128
|
item_id: itemId,
|
|
130
129
|
name,
|
|
131
|
-
price:
|
|
130
|
+
price: values.priceDollars?.amount ?? 0,
|
|
132
131
|
price_code: priceCode,
|
|
133
132
|
pricing_model: values.pricingModel || 'flat_fee',
|
|
134
133
|
show_description_in_invoices: true,
|
|
135
134
|
};
|
|
136
|
-
if (tiered) {
|
|
137
|
-
payload.tiers = (values.tiers ?? []).map(tierToPayload);
|
|
138
|
-
}
|
|
139
135
|
const description = trimOrUndefined(values.description);
|
|
140
136
|
if (description != null) {
|
|
141
137
|
payload.description = description;
|
package/lib/view/invoicing/editInvoicingCatalogItemDetailView/saveInvoicingCatalogItemEpic.d.ts
CHANGED
|
@@ -2,10 +2,9 @@ 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';
|
|
6
5
|
import { RootState } from '../../../reducer';
|
|
7
6
|
import { ZeniAPI } from '../../../zeniAPI';
|
|
8
7
|
import { addInvoicingCatalogItem } from '../invoicingCatalogListView/invoicingCatalogListViewReducer';
|
|
9
8
|
import { saveInvoicingCatalogItem, submitInvoicingCatalogItemForm, submitInvoicingCatalogItemFormFailure, submitInvoicingCatalogItemFormSuccess } from './editInvoicingCatalogItemDetailViewReducer';
|
|
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
|
|
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>;
|
|
11
10
|
export declare const saveInvoicingCatalogItemEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
|
package/lib/view/invoicing/editInvoicingCatalogItemDetailView/saveInvoicingCatalogItemEpic.js
CHANGED
|
@@ -5,7 +5,6 @@ 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");
|
|
9
8
|
const responsePayload_1 = require("../../../responsePayload");
|
|
10
9
|
const invoicingCatalogListViewReducer_1 = require("../invoicingCatalogListView/invoicingCatalogListViewReducer");
|
|
11
10
|
const editInvoicingCatalogItemDetailViewPayload_1 = require("./editInvoicingCatalogItemDetailViewPayload");
|
|
@@ -42,14 +41,7 @@ const saveInvoicingCatalogItemEpic = (actions$, state$, zeniAPI) => actions$.pip
|
|
|
42
41
|
const failedProductResponse = productResponses.find((productResponse) => !(0, responsePayload_1.isSuccessResponse)(productResponse) ||
|
|
43
42
|
productResponse.data == null);
|
|
44
43
|
if (failedProductResponse != null) {
|
|
45
|
-
return (0, rxjs_1.
|
|
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
|
-
]);
|
|
44
|
+
return (0, rxjs_1.of)((0, editInvoicingCatalogItemDetailViewReducer_1.submitInvoicingCatalogItemFormFailure)(failedProductResponse.status));
|
|
53
45
|
}
|
|
54
46
|
const savedProducts = productResponses.flatMap((productResponse) => productResponse.data != null ? [productResponse.data] : []);
|
|
55
47
|
const resultActions = [
|
|
@@ -76,11 +68,6 @@ const saveInvoicingCatalogItemEpic = (actions$, state$, zeniAPI) => actions$.pip
|
|
|
76
68
|
: 'plan';
|
|
77
69
|
resultActions.push((0, invoicingCatalogListViewReducer_1.addInvoicingCatalogItem)({ id: savedItem.id, type: itemType }));
|
|
78
70
|
}
|
|
79
|
-
resultActions.push((0, snackbarReducer_1.openSnackbar)({
|
|
80
|
-
messageSection: 'invoicing_catalog_item_saved',
|
|
81
|
-
messageText: 'success',
|
|
82
|
-
type: 'success',
|
|
83
|
-
}));
|
|
84
71
|
return resultActions;
|
|
85
72
|
};
|
|
86
73
|
const productUpdates = editInvoicingCatalogItemDetailViewReducer_1.saveInvoicingCatalogItem.match(action)
|
|
@@ -91,22 +78,8 @@ const saveInvoicingCatalogItemEpic = (actions$, state$, zeniAPI) => actions$.pip
|
|
|
91
78
|
}
|
|
92
79
|
return (0, rxjs_1.forkJoin)(productUpdates.map((productUpdate) => zeniAPI.putAndGetJSON(`${baseUrl}/catalog/products/${encodeURIComponent(productUpdate.id)}`, productUpdate.data))).pipe((0, operators_1.mergeMap)(completeSave));
|
|
93
80
|
}
|
|
94
|
-
return (0, rxjs_1.
|
|
95
|
-
|
|
96
|
-
|
|
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
|
-
])));
|
|
81
|
+
return (0, rxjs_1.of)((0, editInvoicingCatalogItemDetailViewReducer_1.submitInvoicingCatalogItemFormFailure)(response.status));
|
|
82
|
+
}), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, editInvoicingCatalogItemDetailViewReducer_1.submitInvoicingCatalogItemFormFailure)((0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Save catalog item REST API call errored out ' +
|
|
83
|
+
JSON.stringify(error))))));
|
|
111
84
|
}));
|
|
112
85
|
exports.saveInvoicingCatalogItemEpic = saveInvoicingCatalogItemEpic;
|
|
@@ -1,10 +1,9 @@
|
|
|
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';
|
|
5
4
|
import { RootState } from '../../../reducer';
|
|
6
5
|
import { ZeniAPI } from '../../../zeniAPI';
|
|
7
6
|
import { addInvoicingCouponToList } from '../couponView/couponViewReducer';
|
|
8
7
|
import { saveInvoicingCoupon, submitInvoicingCouponForm, submitInvoicingCouponFormFailure, submitInvoicingCouponFormSuccess } from './editInvoicingCouponDetailViewReducer';
|
|
9
|
-
export type ActionType = ReturnType<typeof submitInvoicingCouponForm> | ReturnType<typeof saveInvoicingCoupon> | ReturnType<typeof submitInvoicingCouponFormSuccess> | ReturnType<typeof submitInvoicingCouponFormFailure> | ReturnType<typeof updateInvoicingCoupons> | ReturnType<typeof addInvoicingCouponToList
|
|
8
|
+
export type ActionType = ReturnType<typeof submitInvoicingCouponForm> | ReturnType<typeof saveInvoicingCoupon> | ReturnType<typeof submitInvoicingCouponFormSuccess> | ReturnType<typeof submitInvoicingCouponFormFailure> | ReturnType<typeof updateInvoicingCoupons> | ReturnType<typeof addInvoicingCouponToList>;
|
|
10
9
|
export declare const saveInvoicingCouponEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
|
|
@@ -4,7 +4,6 @@ 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");
|
|
8
7
|
const responsePayload_1 = require("../../../responsePayload");
|
|
9
8
|
const couponViewReducer_1 = require("../couponView/couponViewReducer");
|
|
10
9
|
const editInvoicingCouponDetailViewPayload_1 = require("./editInvoicingCouponDetailViewPayload");
|
|
@@ -47,28 +46,9 @@ const saveInvoicingCouponEpic = (actions$, state$, zeniAPI) => actions$.pipe((0,
|
|
|
47
46
|
status: couponPayload.status,
|
|
48
47
|
}));
|
|
49
48
|
}
|
|
50
|
-
resultActions.push((0, snackbarReducer_1.openSnackbar)({
|
|
51
|
-
messageSection: 'invoicing_coupon_saved',
|
|
52
|
-
messageText: 'success',
|
|
53
|
-
type: 'success',
|
|
54
|
-
}));
|
|
55
49
|
return resultActions;
|
|
56
50
|
}
|
|
57
|
-
return (0, rxjs_1.
|
|
58
|
-
|
|
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
|
-
])));
|
|
51
|
+
return (0, rxjs_1.of)((0, editInvoicingCouponDetailViewReducer_1.submitInvoicingCouponFormFailure)(response.status));
|
|
52
|
+
}), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, editInvoicingCouponDetailViewReducer_1.submitInvoicingCouponFormFailure)((0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Save coupon REST API call errored out ' + JSON.stringify(error))))));
|
|
73
53
|
}));
|
|
74
54
|
exports.saveInvoicingCouponEpic = saveInvoicingCouponEpic;
|
|
@@ -2,11 +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 { updateInvoicingCustomers } from '../../../entity/invoicing/invoicingCustomer/invoicingCustomerReducer';
|
|
5
|
-
import { openSnackbar } from '../../../entity/snackbar/snackbarReducer';
|
|
6
5
|
import { RootState } from '../../../reducer';
|
|
7
6
|
import { ZeniAPI } from '../../../zeniAPI';
|
|
8
7
|
import { resetNewAddressDataInLocalStore } from '../../addressView/addressViewReducer';
|
|
9
8
|
import { addInvoicingCustomerToList } from '../invoicingCustomerListView/invoicingCustomerListViewReducer';
|
|
10
9
|
import { submitInvoicingCustomerForm, submitInvoicingCustomerFormFailure, submitInvoicingCustomerFormSuccess } from './editInvoicingCustomerDetailViewReducer';
|
|
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
|
|
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>;
|
|
12
11
|
export declare const saveInvoicingCustomerEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
|
|
@@ -6,7 +6,6 @@ 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");
|
|
10
9
|
const responsePayload_1 = require("../../../responsePayload");
|
|
11
10
|
const addressViewReducer_1 = require("../../addressView/addressViewReducer");
|
|
12
11
|
const invoicingCustomerListViewReducer_1 = require("../invoicingCustomerListView/invoicingCustomerListViewReducer");
|
|
@@ -49,29 +48,10 @@ const saveInvoicingCustomerEpic = (actions$, state$, zeniAPI) => actions$.pipe((
|
|
|
49
48
|
status: response.data.status,
|
|
50
49
|
}));
|
|
51
50
|
}
|
|
52
|
-
resultActions.push((0, snackbarReducer_1.openSnackbar)({
|
|
53
|
-
messageSection: 'invoicing_customer_saved',
|
|
54
|
-
messageText: 'success',
|
|
55
|
-
type: 'success',
|
|
56
|
-
}));
|
|
57
51
|
return resultActions;
|
|
58
52
|
}
|
|
59
|
-
return (0, rxjs_1.
|
|
60
|
-
|
|
61
|
-
|
|
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
|
-
])));
|
|
53
|
+
return (0, rxjs_1.of)((0, editInvoicingCustomerDetailViewReducer_1.submitInvoicingCustomerFormFailure)(response.status));
|
|
54
|
+
}), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, editInvoicingCustomerDetailViewReducer_1.submitInvoicingCustomerFormFailure)((0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Save customer REST API call errored out ' +
|
|
55
|
+
JSON.stringify(error))))));
|
|
76
56
|
}));
|
|
77
57
|
exports.saveInvoicingCustomerEpic = saveInvoicingCustomerEpic;
|
package/lib/view/invoicing/editInvoicingSubscriptionDetailView/saveInvoicingSubscriptionEpic.d.ts
CHANGED
|
@@ -2,11 +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 { updateInvoicingSubscriptions } from '../../../entity/invoicing/invoicingSubscription/invoicingSubscriptionReducer';
|
|
5
|
-
import { openSnackbar } from '../../../entity/snackbar/snackbarReducer';
|
|
6
5
|
import { RootState } from '../../../reducer';
|
|
7
6
|
import { ZeniAPI } from '../../../zeniAPI';
|
|
8
7
|
import { resetNewAddressDataInLocalStore } from '../../addressView/addressViewReducer';
|
|
9
8
|
import { addInvoicingSubscriptionToList } from '../invoicingSubscriptionListView/invoicingSubscriptionListViewReducer';
|
|
10
9
|
import { submitInvoicingSubscriptionForm, submitInvoicingSubscriptionFormFailure, submitInvoicingSubscriptionFormSuccess, syncInvoicingSubscriptionCoupons } from './editInvoicingSubscriptionDetailViewReducer';
|
|
11
|
-
export type ActionType = ReturnType<typeof submitInvoicingSubscriptionForm> | ReturnType<typeof submitInvoicingSubscriptionFormSuccess> | ReturnType<typeof submitInvoicingSubscriptionFormFailure> | ReturnType<typeof syncInvoicingSubscriptionCoupons> | ReturnType<typeof resetNewAddressDataInLocalStore> | ReturnType<typeof updateAddresses> | ReturnType<typeof updateInvoicingSubscriptions> | ReturnType<typeof addInvoicingSubscriptionToList
|
|
10
|
+
export type ActionType = ReturnType<typeof submitInvoicingSubscriptionForm> | ReturnType<typeof submitInvoicingSubscriptionFormSuccess> | ReturnType<typeof submitInvoicingSubscriptionFormFailure> | ReturnType<typeof syncInvoicingSubscriptionCoupons> | ReturnType<typeof resetNewAddressDataInLocalStore> | ReturnType<typeof updateAddresses> | ReturnType<typeof updateInvoicingSubscriptions> | ReturnType<typeof addInvoicingSubscriptionToList>;
|
|
12
11
|
export declare const saveInvoicingSubscriptionEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
|
package/lib/view/invoicing/editInvoicingSubscriptionDetailView/saveInvoicingSubscriptionEpic.js
CHANGED
|
@@ -6,7 +6,6 @@ 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");
|
|
10
9
|
const responsePayload_1 = require("../../../responsePayload");
|
|
11
10
|
const addressViewReducer_1 = require("../../addressView/addressViewReducer");
|
|
12
11
|
const invoicingSubscriptionListViewReducer_1 = require("../invoicingSubscriptionListView/invoicingSubscriptionListViewReducer");
|
|
@@ -42,14 +41,7 @@ const saveInvoicingSubscriptionEpic = (actions$, state$, zeniAPI) => actions$.pi
|
|
|
42
41
|
: zeniAPI.postAndGetJSON(`${baseUrl}/subscriptions`, { ...data });
|
|
43
42
|
return request$.pipe((0, operators_1.mergeMap)((response) => {
|
|
44
43
|
if (!(0, responsePayload_1.isSuccessResponse)(response) || response.data == null) {
|
|
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
|
-
];
|
|
44
|
+
return [(0, editInvoicingSubscriptionDetailViewReducer_1.submitInvoicingSubscriptionFormFailure)(response.status)];
|
|
53
45
|
}
|
|
54
46
|
const saved = response.data;
|
|
55
47
|
const couponChanged = id != null &&
|
|
@@ -89,20 +81,8 @@ const saveInvoicingSubscriptionEpic = (actions$, state$, zeniAPI) => actions$.pi
|
|
|
89
81
|
status: saved.status,
|
|
90
82
|
}));
|
|
91
83
|
}
|
|
92
|
-
resultActions.push((0, snackbarReducer_1.openSnackbar)({
|
|
93
|
-
messageSection: 'invoicing_subscription_saved',
|
|
94
|
-
messageText: 'success',
|
|
95
|
-
type: 'success',
|
|
96
|
-
}));
|
|
97
84
|
return resultActions;
|
|
98
|
-
}), (0, operators_1.catchError)((error) => (0, rxjs_1.
|
|
99
|
-
|
|
100
|
-
JSON.stringify(error))),
|
|
101
|
-
(0, snackbarReducer_1.openSnackbar)({
|
|
102
|
-
messageSection: 'invoicing_subscription_saved',
|
|
103
|
-
messageText: 'failed',
|
|
104
|
-
type: 'error',
|
|
105
|
-
}),
|
|
106
|
-
])));
|
|
85
|
+
}), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, editInvoicingSubscriptionDetailViewReducer_1.submitInvoicingSubscriptionFormFailure)((0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Save subscription REST API call errored out ' +
|
|
86
|
+
JSON.stringify(error))))));
|
|
107
87
|
}));
|
|
108
88
|
exports.saveInvoicingSubscriptionEpic = saveInvoicingSubscriptionEpic;
|
|
@@ -2,12 +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 { updateInvoicingSubscriptions } from '../../../entity/invoicing/invoicingSubscription/invoicingSubscriptionReducer';
|
|
5
|
-
import { openSnackbar } from '../../../entity/snackbar/snackbarReducer';
|
|
6
5
|
import { RootState } from '../../../reducer';
|
|
7
6
|
import { ZeniAPI } from '../../../zeniAPI';
|
|
8
7
|
import { resetNewAddressDataInLocalStore } from '../../addressView/addressViewReducer';
|
|
9
8
|
import { submitInvoicingSubscriptionFormFailure, submitInvoicingSubscriptionFormSuccess, syncInvoicingSubscriptionCoupons } from './editInvoicingSubscriptionDetailViewReducer';
|
|
10
|
-
export type ActionType = ReturnType<typeof syncInvoicingSubscriptionCoupons> | ReturnType<typeof submitInvoicingSubscriptionFormSuccess> | ReturnType<typeof submitInvoicingSubscriptionFormFailure> | ReturnType<typeof resetNewAddressDataInLocalStore> | ReturnType<typeof updateAddresses> | ReturnType<typeof updateInvoicingSubscriptions
|
|
9
|
+
export type ActionType = ReturnType<typeof syncInvoicingSubscriptionCoupons> | ReturnType<typeof submitInvoicingSubscriptionFormSuccess> | ReturnType<typeof submitInvoicingSubscriptionFormFailure> | ReturnType<typeof resetNewAddressDataInLocalStore> | ReturnType<typeof updateAddresses> | ReturnType<typeof updateInvoicingSubscriptions>;
|
|
11
10
|
/**
|
|
12
11
|
* After a commercial PUT, sync coupon attach/detach via dedicated endpoints
|
|
13
12
|
* (PUT does not replace coupons). Runs remove-then-apply; on success finishes
|
|
@@ -6,7 +6,6 @@ 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");
|
|
10
9
|
const responsePayload_1 = require("../../../responsePayload");
|
|
11
10
|
const addressViewReducer_1 = require("../../addressView/addressViewReducer");
|
|
12
11
|
const editInvoicingSubscriptionDetailViewReducer_1 = require("./editInvoicingSubscriptionDetailViewReducer");
|
|
@@ -43,14 +42,7 @@ const syncInvoicingSubscriptionCouponsEpic = (actions$, _state$, zeniAPI) => act
|
|
|
43
42
|
: couponMutation$(zeniAPI, baseUrl, subscriptionId, 'remove-coupon', prev);
|
|
44
43
|
return removeStep$.pipe((0, operators_1.mergeMap)((removeResult) => {
|
|
45
44
|
if (!removeResult.success) {
|
|
46
|
-
return (0, rxjs_1.
|
|
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
|
-
]);
|
|
45
|
+
return (0, rxjs_1.of)((0, editInvoicingSubscriptionDetailViewReducer_1.submitInvoicingSubscriptionFormFailure)(failureStatus(removeResult)));
|
|
54
46
|
}
|
|
55
47
|
const applyStep$ = next === ''
|
|
56
48
|
? (0, rxjs_1.of)({
|
|
@@ -62,11 +54,6 @@ const syncInvoicingSubscriptionCouponsEpic = (actions$, _state$, zeniAPI) => act
|
|
|
62
54
|
if (!applyResult.success) {
|
|
63
55
|
return [
|
|
64
56
|
(0, editInvoicingSubscriptionDetailViewReducer_1.submitInvoicingSubscriptionFormFailure)(failureStatus(applyResult)),
|
|
65
|
-
(0, snackbarReducer_1.openSnackbar)({
|
|
66
|
-
messageSection: 'invoicing_subscription_saved',
|
|
67
|
-
messageText: 'failed',
|
|
68
|
-
type: 'error',
|
|
69
|
-
}),
|
|
70
57
|
];
|
|
71
58
|
}
|
|
72
59
|
const couponUpdated = applyResult.payload ?? removeResult.payload;
|
|
@@ -74,11 +61,7 @@ const syncInvoicingSubscriptionCouponsEpic = (actions$, _state$, zeniAPI) => act
|
|
|
74
61
|
if (couponUpdated != null) {
|
|
75
62
|
resultActions.push((0, invoicingSubscriptionReducer_1.updateInvoicingSubscriptions)([couponUpdated], 'merge'), (0, addressReducer_1.updateAddresses)((0, invoicingSubscriptionPayload_1.extractInvoicingSubscriptionAddresses)([couponUpdated])));
|
|
76
63
|
}
|
|
77
|
-
resultActions.push((0, editInvoicingSubscriptionDetailViewReducer_1.submitInvoicingSubscriptionFormSuccess)({ subscriptionId }), (0, addressViewReducer_1.resetNewAddressDataInLocalStore)(invoicingSubscriptionFormConfig_1.INVOICING_SUBSCRIPTION_SHIPPING_ADDRESS_TYPE)
|
|
78
|
-
messageSection: 'invoicing_subscription_saved',
|
|
79
|
-
messageText: 'success',
|
|
80
|
-
type: 'success',
|
|
81
|
-
}));
|
|
64
|
+
resultActions.push((0, editInvoicingSubscriptionDetailViewReducer_1.submitInvoicingSubscriptionFormSuccess)({ subscriptionId }), (0, addressViewReducer_1.resetNewAddressDataInLocalStore)(invoicingSubscriptionFormConfig_1.INVOICING_SUBSCRIPTION_SHIPPING_ADDRESS_TYPE));
|
|
82
65
|
return resultActions;
|
|
83
66
|
}));
|
|
84
67
|
}));
|
|
@@ -2,10 +2,9 @@ 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';
|
|
6
5
|
import { RootState } from '../../../reducer';
|
|
7
6
|
import { ZeniAPI } from '../../../zeniAPI';
|
|
8
7
|
import { runInvoicingInvoiceAction, runInvoicingInvoiceActionFailure, runInvoicingInvoiceActionSuccess, updateInvoicingInvoice } from './invoiceActionReducer';
|
|
9
|
-
export type ActionType = ReturnType<typeof runInvoicingInvoiceAction> | ReturnType<typeof runInvoicingInvoiceActionSuccess> | ReturnType<typeof runInvoicingInvoiceActionFailure> | ReturnType<typeof updateInvoicingInvoice> | ReturnType<typeof updateAddresses> | ReturnType<typeof updateInvoices
|
|
8
|
+
export type ActionType = ReturnType<typeof runInvoicingInvoiceAction> | ReturnType<typeof runInvoicingInvoiceActionSuccess> | ReturnType<typeof runInvoicingInvoiceActionFailure> | ReturnType<typeof updateInvoicingInvoice> | ReturnType<typeof updateAddresses> | ReturnType<typeof updateInvoices>;
|
|
10
9
|
export declare const runInvoicingInvoiceActionEpic: (actions$: ActionsObservable<ActionType>, _state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
|
|
11
10
|
export declare const updateInvoicingInvoiceEpic: (actions$: ActionsObservable<ActionType>, _state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
|
|
@@ -6,28 +6,11 @@ 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");
|
|
10
9
|
const responsePayload_1 = require("../../../responsePayload");
|
|
11
10
|
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
|
-
};
|
|
18
11
|
const runInvoicingInvoiceActionEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)((action) => invoiceActionReducer_1.runInvoicingInvoiceAction.match(action) &&
|
|
19
12
|
action.payload.action !== 'issue-credit-note'), (0, operators_1.mergeMap)((action) => {
|
|
20
13
|
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
|
-
];
|
|
31
14
|
const apiUrl = `${zeniAPI.apiEndPoints.invoicingMicroServiceBaseUrl}/1.0/invoices/${encodeURIComponent(invoiceId)}/${kind}`;
|
|
32
15
|
return zeniAPI
|
|
33
16
|
.postAndGetJSON(apiUrl, (body ?? {}))
|
|
@@ -37,24 +20,17 @@ const runInvoicingInvoiceActionEpic = (actions$, _state$, zeniAPI) => actions$.p
|
|
|
37
20
|
(0, invoiceReducer_1.updateInvoices)([response.data], 'merge'),
|
|
38
21
|
(0, addressReducer_1.updateAddresses)((0, invoicePayload_1.extractInvoicingInvoiceAddresses)([response.data])),
|
|
39
22
|
(0, invoiceActionReducer_1.runInvoicingInvoiceActionSuccess)({ invoiceId }),
|
|
40
|
-
...snackbar('success'),
|
|
41
23
|
];
|
|
42
24
|
}
|
|
43
|
-
return (0, rxjs_1.
|
|
44
|
-
|
|
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)),
|
|
25
|
+
return (0, rxjs_1.of)((0, invoiceActionReducer_1.runInvoicingInvoiceActionFailure)({
|
|
26
|
+
error: response.status,
|
|
54
27
|
invoiceId,
|
|
55
|
-
})
|
|
56
|
-
|
|
57
|
-
|
|
28
|
+
}));
|
|
29
|
+
}), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, invoiceActionReducer_1.runInvoicingInvoiceActionFailure)({
|
|
30
|
+
error: (0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Invoice action REST API call errored out ' +
|
|
31
|
+
JSON.stringify(error)),
|
|
32
|
+
invoiceId,
|
|
33
|
+
}))));
|
|
58
34
|
}));
|
|
59
35
|
exports.runInvoicingInvoiceActionEpic = runInvoicingInvoiceActionEpic;
|
|
60
36
|
const updateInvoicingInvoiceEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(invoiceActionReducer_1.updateInvoicingInvoice.match), (0, operators_1.mergeMap)((action) => {
|
|
@@ -68,35 +44,16 @@ const updateInvoicingInvoiceEpic = (actions$, _state$, zeniAPI) => actions$.pipe
|
|
|
68
44
|
(0, invoiceReducer_1.updateInvoices)([response.data], 'merge'),
|
|
69
45
|
(0, addressReducer_1.updateAddresses)((0, invoicePayload_1.extractInvoicingInvoiceAddresses)([response.data])),
|
|
70
46
|
(0, invoiceActionReducer_1.runInvoicingInvoiceActionSuccess)({ invoiceId }),
|
|
71
|
-
(0, snackbarReducer_1.openSnackbar)({
|
|
72
|
-
messageSection: 'invoicing_invoice_saved',
|
|
73
|
-
messageText: 'success',
|
|
74
|
-
type: 'success',
|
|
75
|
-
}),
|
|
76
47
|
];
|
|
77
48
|
}
|
|
78
|
-
return (0, rxjs_1.
|
|
79
|
-
|
|
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)),
|
|
49
|
+
return (0, rxjs_1.of)((0, invoiceActionReducer_1.runInvoicingInvoiceActionFailure)({
|
|
50
|
+
error: response.status,
|
|
93
51
|
invoiceId,
|
|
94
|
-
})
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
])));
|
|
52
|
+
}));
|
|
53
|
+
}), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, invoiceActionReducer_1.runInvoicingInvoiceActionFailure)({
|
|
54
|
+
error: (0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Invoice update REST API call errored out ' +
|
|
55
|
+
JSON.stringify(error)),
|
|
56
|
+
invoiceId,
|
|
57
|
+
}))));
|
|
101
58
|
}));
|
|
102
59
|
exports.updateInvoicingInvoiceEpic = updateInvoicingInvoiceEpic;
|