@zeniai/client-epic-state 5.1.86 → 5.1.87
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/entity/aiCfo/aiCfoPayload.d.ts +7 -0
- package/lib/entity/aiCfo/aiCfoReducer.d.ts +3 -2
- package/lib/entity/aiCfo/aiCfoReducer.js +25 -2
- package/lib/entity/aiCfo/aiCfoState.d.ts +7 -0
- package/lib/entity/customerSatisfaction/customerSatisfactionReducer.d.ts +1 -1
- package/lib/entity/customerSatisfaction/customerSatisfactionReducer.js +6 -2
- package/lib/entity/snackbar/snackbarTypes.d.ts +1 -1
- package/lib/entity/snackbar/snackbarTypes.js +29 -0
- package/lib/esm/entity/aiCfo/aiCfoReducer.js +23 -1
- package/lib/esm/entity/customerSatisfaction/customerSatisfactionReducer.js +4 -1
- package/lib/esm/entity/snackbar/snackbarTypes.js +29 -0
- package/lib/esm/index.js +2 -2
- package/lib/esm/view/companyHealthMetricView/companyHealthMetricConfigReducer.js +4 -1
- package/lib/esm/view/invoicing/createCreditNote/createCreditNoteEpic.js +24 -4
- package/lib/esm/view/invoicing/createInvoice/createInvoiceEpic.js +24 -4
- package/lib/esm/view/invoicing/createInvoice/createInvoiceSelector.js +37 -10
- package/lib/esm/view/invoicing/discountAction/discountActionEpic.js +33 -9
- package/lib/esm/view/invoicing/dunningAction/dunningActionEpic.js +35 -9
- package/lib/esm/view/invoicing/editInvoicingCatalogItemDetailView/catalogDetailEditPayload.js +5 -1
- package/lib/esm/view/invoicing/editInvoicingCatalogItemDetailView/saveInvoicingCatalogItemEpic.js +32 -5
- package/lib/esm/view/invoicing/editInvoicingCouponDetailView/saveInvoicingCouponEpic.js +23 -3
- package/lib/esm/view/invoicing/editInvoicingCustomerDetailView/saveInvoicingCustomerEpic.js +24 -4
- package/lib/esm/view/invoicing/editInvoicingSubscriptionDetailView/saveInvoicingSubscriptionEpic.js +24 -4
- package/lib/esm/view/invoicing/editInvoicingSubscriptionDetailView/syncInvoicingSubscriptionCouponsEpic.js +20 -3
- package/lib/esm/view/invoicing/invoiceAction/invoiceActionEpic.js +60 -17
- package/lib/esm/view/invoicing/invoicingConfigView/invoicingConfigViewReducer.js +30 -0
- package/lib/esm/view/invoicing/invoicingConfigView/invoicingConfigViewSelector.js +4 -29
- package/lib/esm/view/invoicing/invoicingQboView/epics/retryInvoicingQboSyncTaskEpic.js +29 -10
- package/lib/esm/view/invoicing/invoicingQboView/epics/startInvoicingQboBackfillEpic.js +28 -5
- package/lib/esm/view/invoicing/issueCreditNote/issueCreditNoteEpic.js +24 -4
- package/lib/esm/view/invoicing/issueCreditNote/issueCreditNoteSelector.js +22 -14
- package/lib/esm/view/invoicing/recordPayment/recordPaymentEpic.js +46 -7
- package/lib/esm/view/invoicing/settingsView/settingsViewEpics.js +26 -8
- package/lib/esm/view/invoicing/settingsView/settingsViewReducer.js +1 -1
- package/lib/esm/view/invoicing/settingsView/settingsViewSelector.js +4 -1
- package/lib/esm/view/invoicing/subscriptionAction/subscriptionActionEpic.js +41 -9
- package/lib/esm/view/vendorFiling1099/vendorFiling1099UploadDetails/vendorFiling1099UploadDetailsReducer.js +4 -1
- package/lib/esm/view/vendorTabView/vendorTabViewReducer.js +4 -1
- package/lib/index.d.ts +6 -5
- package/lib/index.js +7 -7
- package/lib/view/companyHealthMetricView/companyHealthMetricConfigReducer.d.ts +1 -1
- package/lib/view/companyHealthMetricView/companyHealthMetricConfigReducer.js +5 -2
- package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.d.ts +1 -1
- package/lib/view/invoicing/createCreditNote/createCreditNoteEpic.d.ts +2 -1
- package/lib/view/invoicing/createCreditNote/createCreditNoteEpic.js +23 -3
- package/lib/view/invoicing/createInvoice/createInvoiceEpic.d.ts +2 -1
- package/lib/view/invoicing/createInvoice/createInvoiceEpic.js +23 -3
- package/lib/view/invoicing/createInvoice/createInvoiceSelector.d.ts +22 -8
- package/lib/view/invoicing/createInvoice/createInvoiceSelector.js +37 -10
- package/lib/view/invoicing/discountAction/discountActionEpic.d.ts +2 -1
- package/lib/view/invoicing/discountAction/discountActionEpic.js +32 -8
- package/lib/view/invoicing/dunningAction/dunningActionEpic.d.ts +2 -1
- package/lib/view/invoicing/dunningAction/dunningActionEpic.js +34 -8
- package/lib/view/invoicing/editInvoicingCatalogItemDetailView/catalogDetailEditPayload.d.ts +3 -1
- package/lib/view/invoicing/editInvoicingCatalogItemDetailView/catalogDetailEditPayload.js +5 -1
- package/lib/view/invoicing/editInvoicingCatalogItemDetailView/saveInvoicingCatalogItemEpic.d.ts +2 -1
- package/lib/view/invoicing/editInvoicingCatalogItemDetailView/saveInvoicingCatalogItemEpic.js +31 -4
- package/lib/view/invoicing/editInvoicingCouponDetailView/saveInvoicingCouponEpic.d.ts +2 -1
- package/lib/view/invoicing/editInvoicingCouponDetailView/saveInvoicingCouponEpic.js +22 -2
- package/lib/view/invoicing/editInvoicingCustomerDetailView/saveInvoicingCustomerEpic.d.ts +2 -1
- package/lib/view/invoicing/editInvoicingCustomerDetailView/saveInvoicingCustomerEpic.js +23 -3
- package/lib/view/invoicing/editInvoicingSubscriptionDetailView/saveInvoicingSubscriptionEpic.d.ts +2 -1
- package/lib/view/invoicing/editInvoicingSubscriptionDetailView/saveInvoicingSubscriptionEpic.js +23 -3
- package/lib/view/invoicing/editInvoicingSubscriptionDetailView/syncInvoicingSubscriptionCouponsEpic.d.ts +2 -1
- package/lib/view/invoicing/editInvoicingSubscriptionDetailView/syncInvoicingSubscriptionCouponsEpic.js +19 -2
- package/lib/view/invoicing/invoiceAction/invoiceActionEpic.d.ts +2 -1
- package/lib/view/invoicing/invoiceAction/invoiceActionEpic.js +59 -16
- package/lib/view/invoicing/invoicingConfigView/invoicingConfigViewPayload.d.ts +13 -0
- package/lib/view/invoicing/invoicingConfigView/invoicingConfigViewReducer.d.ts +1 -1
- package/lib/view/invoicing/invoicingConfigView/invoicingConfigViewReducer.js +30 -0
- package/lib/view/invoicing/invoicingConfigView/invoicingConfigViewSelector.d.ts +11 -31
- package/lib/view/invoicing/invoicingConfigView/invoicingConfigViewSelector.js +4 -29
- package/lib/view/invoicing/invoicingConfigView/invoicingConfigViewState.d.ts +15 -0
- package/lib/view/invoicing/invoicingQboView/epics/invoicingQboViewActionType.d.ts +2 -1
- package/lib/view/invoicing/invoicingQboView/epics/retryInvoicingQboSyncTaskEpic.js +28 -9
- package/lib/view/invoicing/invoicingQboView/epics/startInvoicingQboBackfillEpic.js +27 -4
- package/lib/view/invoicing/issueCreditNote/issueCreditNoteEpic.d.ts +2 -1
- package/lib/view/invoicing/issueCreditNote/issueCreditNoteEpic.js +23 -3
- package/lib/view/invoicing/issueCreditNote/issueCreditNoteSelector.d.ts +24 -7
- package/lib/view/invoicing/issueCreditNote/issueCreditNoteSelector.js +23 -16
- package/lib/view/invoicing/recordPayment/recordPaymentEpic.d.ts +2 -1
- package/lib/view/invoicing/recordPayment/recordPaymentEpic.js +45 -6
- package/lib/view/invoicing/settingsView/settingsViewEpics.d.ts +2 -1
- package/lib/view/invoicing/settingsView/settingsViewEpics.js +25 -7
- package/lib/view/invoicing/settingsView/settingsViewReducer.d.ts +10 -1
- package/lib/view/invoicing/settingsView/settingsViewReducer.js +1 -1
- package/lib/view/invoicing/settingsView/settingsViewSelector.d.ts +4 -2
- package/lib/view/invoicing/settingsView/settingsViewSelector.js +4 -1
- package/lib/view/invoicing/subscriptionAction/subscriptionActionEpic.d.ts +2 -1
- package/lib/view/invoicing/subscriptionAction/subscriptionActionEpic.js +40 -8
- package/lib/view/vendorFiling1099/vendorFiling1099UploadDetails/vendorFiling1099UploadDetailsReducer.d.ts +1 -1
- package/lib/view/vendorFiling1099/vendorFiling1099UploadDetails/vendorFiling1099UploadDetailsReducer.js +5 -2
- package/lib/view/vendorTabView/vendorTabViewReducer.d.ts +1 -1
- package/lib/view/vendorTabView/vendorTabViewReducer.js +5 -2
- package/package.json +1 -1
- package/lib/__testHelpers__/apiFailure.json +0 -6
- package/lib/entity/vendor/__mocks__/vendorMock.d.ts +0 -7
- package/lib/entity/vendor/__mocks__/vendorMock.js +0 -311
- package/lib/entity/vendor/__mocks__/vendorStateMocks.d.ts +0 -8
- package/lib/entity/vendor/__mocks__/vendorStateMocks.js +0 -415
- package/lib/view/accountMappingView/__mocks__/accountMappingSelectorMock.d.ts +0 -11
- package/lib/view/accountMappingView/__mocks__/accountMappingSelectorMock.js +0 -4659
- package/lib/view/addressView/__mocks__/addressViewMocks.d.ts +0 -35
- package/lib/view/addressView/__mocks__/addressViewMocks.js +0 -239
- package/lib/view/addressView/__mocks__/json/createAddressResponse.json +0 -23
- package/lib/view/addressView/__mocks__/json/createCompanyAddressSuccess.json +0 -258
- package/lib/view/addressView/__mocks__/json/createCompanyUserAddressSuccess.json +0 -418
- package/lib/view/addressView/__mocks__/json/fetchAddressResponse.json +0 -24
- package/lib/view/addressView/__mocks__/json/updateAddressResponse.json +0 -24
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { ActionsObservable, StateObservable } from 'redux-observable';
|
|
2
2
|
import { Observable } from 'rxjs';
|
|
3
3
|
import { updateInvoicingCreditNotes } from '../../../entity/invoicing/creditNote/creditNoteReducer';
|
|
4
|
+
import { openSnackbar } from '../../../entity/snackbar/snackbarReducer';
|
|
4
5
|
import { RootState } from '../../../reducer';
|
|
5
6
|
import { ZeniAPI } from '../../../zeniAPI';
|
|
6
7
|
import { createCreditNoteFailure, createCreditNoteSuccess, submitCreateCreditNote } from './createCreditNoteReducer';
|
|
7
|
-
export type ActionType = ReturnType<typeof submitCreateCreditNote> | ReturnType<typeof createCreditNoteSuccess> | ReturnType<typeof createCreditNoteFailure> | ReturnType<typeof updateInvoicingCreditNotes>;
|
|
8
|
+
export type ActionType = ReturnType<typeof submitCreateCreditNote> | ReturnType<typeof createCreditNoteSuccess> | ReturnType<typeof createCreditNoteFailure> | ReturnType<typeof updateInvoicingCreditNotes> | ReturnType<typeof openSnackbar>;
|
|
8
9
|
export declare const createCreditNoteEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
|
|
@@ -4,6 +4,7 @@ exports.createCreditNoteEpic = void 0;
|
|
|
4
4
|
const rxjs_1 = require("rxjs");
|
|
5
5
|
const operators_1 = require("rxjs/operators");
|
|
6
6
|
const creditNoteReducer_1 = require("../../../entity/invoicing/creditNote/creditNoteReducer");
|
|
7
|
+
const snackbarReducer_1 = require("../../../entity/snackbar/snackbarReducer");
|
|
7
8
|
const responsePayload_1 = require("../../../responsePayload");
|
|
8
9
|
const createCreditNotePayload_1 = require("./createCreditNotePayload");
|
|
9
10
|
const createCreditNoteReducer_1 = require("./createCreditNoteReducer");
|
|
@@ -18,10 +19,29 @@ const createCreditNoteEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, op
|
|
|
18
19
|
return [
|
|
19
20
|
(0, creditNoteReducer_1.updateInvoicingCreditNotes)([response.data], 'merge'),
|
|
20
21
|
(0, createCreditNoteReducer_1.createCreditNoteSuccess)({ creditNoteId: response.data.id }),
|
|
22
|
+
(0, snackbarReducer_1.openSnackbar)({
|
|
23
|
+
messageSection: 'invoicing_credit_note_saved',
|
|
24
|
+
messageText: 'success',
|
|
25
|
+
type: 'success',
|
|
26
|
+
}),
|
|
21
27
|
];
|
|
22
28
|
}
|
|
23
|
-
return (0, rxjs_1.
|
|
24
|
-
|
|
25
|
-
|
|
29
|
+
return (0, rxjs_1.from)([
|
|
30
|
+
(0, createCreditNoteReducer_1.createCreditNoteFailure)(response.status),
|
|
31
|
+
(0, snackbarReducer_1.openSnackbar)({
|
|
32
|
+
messageSection: 'invoicing_credit_note_saved',
|
|
33
|
+
messageText: 'failed',
|
|
34
|
+
type: 'error',
|
|
35
|
+
}),
|
|
36
|
+
]);
|
|
37
|
+
}), (0, operators_1.catchError)((error) => (0, rxjs_1.from)([
|
|
38
|
+
(0, createCreditNoteReducer_1.createCreditNoteFailure)((0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Create credit note REST API call errored out ' +
|
|
39
|
+
JSON.stringify(error))),
|
|
40
|
+
(0, snackbarReducer_1.openSnackbar)({
|
|
41
|
+
messageSection: 'invoicing_credit_note_saved',
|
|
42
|
+
messageText: 'failed',
|
|
43
|
+
type: 'error',
|
|
44
|
+
}),
|
|
45
|
+
])));
|
|
26
46
|
}));
|
|
27
47
|
exports.createCreditNoteEpic = createCreditNoteEpic;
|
|
@@ -2,9 +2,10 @@ import { ActionsObservable, StateObservable } from 'redux-observable';
|
|
|
2
2
|
import { Observable } from 'rxjs';
|
|
3
3
|
import { updateAddresses } from '../../../entity/address/addressReducer';
|
|
4
4
|
import { updateInvoices } from '../../../entity/invoicing/invoice/invoiceReducer';
|
|
5
|
+
import { openSnackbar } from '../../../entity/snackbar/snackbarReducer';
|
|
5
6
|
import { RootState } from '../../../reducer';
|
|
6
7
|
import { ZeniAPI } from '../../../zeniAPI';
|
|
7
8
|
import { addInvoiceToList } from '../invoiceList/invoiceListReducer';
|
|
8
9
|
import { createInvoice, createInvoiceFailure, createInvoiceSuccess } from './createInvoiceReducer';
|
|
9
|
-
export type ActionType = ReturnType<typeof createInvoice> | ReturnType<typeof createInvoiceSuccess> | ReturnType<typeof createInvoiceFailure> | ReturnType<typeof updateAddresses> | ReturnType<typeof updateInvoices> | ReturnType<typeof addInvoiceToList>;
|
|
10
|
+
export type ActionType = ReturnType<typeof createInvoice> | ReturnType<typeof createInvoiceSuccess> | ReturnType<typeof createInvoiceFailure> | ReturnType<typeof updateAddresses> | ReturnType<typeof updateInvoices> | ReturnType<typeof addInvoiceToList> | ReturnType<typeof openSnackbar>;
|
|
10
11
|
export declare const createInvoiceEpic: (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 invoicePayload_1 = require("../../../entity/invoicing/invoice/invoicePayload");
|
|
8
8
|
const invoiceReducer_1 = require("../../../entity/invoicing/invoice/invoiceReducer");
|
|
9
|
+
const snackbarReducer_1 = require("../../../entity/snackbar/snackbarReducer");
|
|
9
10
|
const responsePayload_1 = require("../../../responsePayload");
|
|
10
11
|
const invoiceListReducer_1 = require("../invoiceList/invoiceListReducer");
|
|
11
12
|
const createInvoiceReducer_1 = require("./createInvoiceReducer");
|
|
@@ -25,10 +26,29 @@ const createInvoiceEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, oper
|
|
|
25
26
|
status: response.data.status,
|
|
26
27
|
}),
|
|
27
28
|
(0, createInvoiceReducer_1.createInvoiceSuccess)({ invoiceId: response.data.id }),
|
|
29
|
+
(0, snackbarReducer_1.openSnackbar)({
|
|
30
|
+
messageSection: 'invoicing_invoice_saved',
|
|
31
|
+
messageText: 'success',
|
|
32
|
+
type: 'success',
|
|
33
|
+
}),
|
|
28
34
|
];
|
|
29
35
|
}
|
|
30
|
-
return (0, rxjs_1.
|
|
31
|
-
|
|
32
|
-
|
|
36
|
+
return (0, rxjs_1.from)([
|
|
37
|
+
(0, createInvoiceReducer_1.createInvoiceFailure)(response.status),
|
|
38
|
+
(0, snackbarReducer_1.openSnackbar)({
|
|
39
|
+
messageSection: 'invoicing_invoice_saved',
|
|
40
|
+
messageText: 'failed',
|
|
41
|
+
type: 'error',
|
|
42
|
+
}),
|
|
43
|
+
]);
|
|
44
|
+
}), (0, operators_1.catchError)((error) => (0, rxjs_1.from)([
|
|
45
|
+
(0, createInvoiceReducer_1.createInvoiceFailure)((0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Create invoice REST API call errored out ' +
|
|
46
|
+
JSON.stringify(error))),
|
|
47
|
+
(0, snackbarReducer_1.openSnackbar)({
|
|
48
|
+
messageSection: 'invoicing_invoice_saved',
|
|
49
|
+
messageText: 'failed',
|
|
50
|
+
type: 'error',
|
|
51
|
+
}),
|
|
52
|
+
])));
|
|
33
53
|
}));
|
|
34
54
|
exports.createInvoiceEpic = createInvoiceEpic;
|
|
@@ -1,15 +1,30 @@
|
|
|
1
1
|
import { ID } from '../../../commonStateTypes/common';
|
|
2
2
|
import { SelectorView } from '../../../commonStateTypes/viewAndReport/viewAndReport';
|
|
3
|
+
import { Address } from '../../../entity/address/addressState';
|
|
3
4
|
import { InvoicingSettingsPayload } from '../../../entity/invoicing/invoicingCommonPayload';
|
|
4
|
-
import { InvoicingCustomer } from '../../../entity/invoicing/invoicingCustomer/invoicingCustomerState';
|
|
5
5
|
import { InvoicingProduct } from '../../../entity/invoicing/product/productState';
|
|
6
6
|
import { RootState } from '../../../reducer';
|
|
7
7
|
import { InvoicingCreateInvoiceFormLocalData } from './createInvoiceState';
|
|
8
|
+
/**
|
|
9
|
+
* One catalog plan price, split into its two naming parts so consumers can
|
|
10
|
+
* compose the label themselves (the plan family name and the sub-family/price
|
|
11
|
+
* name are separate columns in the catalog).
|
|
12
|
+
*/
|
|
13
|
+
export interface InvoicingPlanNameOption {
|
|
14
|
+
planName: string;
|
|
15
|
+
subFamilyName: string;
|
|
16
|
+
}
|
|
17
|
+
/** One customer row of the create-invoice customer picker. */
|
|
18
|
+
export interface InvoicingCreateInvoiceCustomerOption {
|
|
19
|
+
id: ID;
|
|
20
|
+
name: string;
|
|
21
|
+
billingAddress?: Address;
|
|
22
|
+
email?: string;
|
|
23
|
+
}
|
|
8
24
|
export interface CreateInvoiceFormView extends SelectorView {
|
|
9
|
-
customers:
|
|
25
|
+
customers: InvoicingCreateInvoiceCustomerOption[];
|
|
10
26
|
localData: InvoicingCreateInvoiceFormLocalData;
|
|
11
|
-
planNames:
|
|
12
|
-
plans: InvoicingProduct[];
|
|
27
|
+
planNames: InvoicingPlanNameOption[];
|
|
13
28
|
products: InvoicingProduct[];
|
|
14
29
|
savedInvoiceId?: ID;
|
|
15
30
|
settings?: InvoicingSettingsPayload;
|
|
@@ -17,9 +32,8 @@ export interface CreateInvoiceFormView extends SelectorView {
|
|
|
17
32
|
/**
|
|
18
33
|
* Single bundled view for the create-invoice screen — web-ui consumes only this.
|
|
19
34
|
* Carries the form draft (`localData`), the option sources the form needs
|
|
20
|
-
* (
|
|
21
|
-
* state/error, and the id of the invoice last created
|
|
22
|
-
* navigate on success).
|
|
23
|
-
* option shapes.
|
|
35
|
+
* (customer picker rows, catalog plan names, products, settings), the
|
|
36
|
+
* create-invoice fetch state/error, and the id of the invoice last created
|
|
37
|
+
* (`savedInvoiceId`, to navigate on success).
|
|
24
38
|
*/
|
|
25
39
|
export declare const getCreateInvoiceFormView: (state: RootState) => CreateInvoiceFormView;
|
|
@@ -1,28 +1,55 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getCreateInvoiceFormView = void 0;
|
|
4
|
+
const addressSelector_1 = require("../../../entity/address/addressSelector");
|
|
4
5
|
const invoicingCatalogListViewSelector_1 = require("../invoicingCatalogListView/invoicingCatalogListViewSelector");
|
|
5
6
|
const invoicingCustomerListViewSelector_1 = require("../invoicingCustomerListView/invoicingCustomerListViewSelector");
|
|
6
7
|
const settingsViewSelector_1 = require("../settingsView/settingsViewSelector");
|
|
8
|
+
/**
|
|
9
|
+
* Display name for a customer option: company, else the full name, else the
|
|
10
|
+
* email, else the raw id.
|
|
11
|
+
*/
|
|
12
|
+
const customerDisplayName = (customer) => {
|
|
13
|
+
const fullName = [customer.firstName, customer.lastName]
|
|
14
|
+
.filter((part) => part != null && part.trim() !== '')
|
|
15
|
+
.join(' ')
|
|
16
|
+
.trim();
|
|
17
|
+
const company = customer.company?.trim() ?? '';
|
|
18
|
+
const email = customer.email?.trim() ?? '';
|
|
19
|
+
return company !== ''
|
|
20
|
+
? company
|
|
21
|
+
: fullName !== ''
|
|
22
|
+
? fullName
|
|
23
|
+
: email !== ''
|
|
24
|
+
? email
|
|
25
|
+
: customer.id;
|
|
26
|
+
};
|
|
7
27
|
/**
|
|
8
28
|
* Single bundled view for the create-invoice screen — web-ui consumes only this.
|
|
9
29
|
* Carries the form draft (`localData`), the option sources the form needs
|
|
10
|
-
* (
|
|
11
|
-
* state/error, and the id of the invoice last created
|
|
12
|
-
* navigate on success).
|
|
13
|
-
* option shapes.
|
|
30
|
+
* (customer picker rows, catalog plan names, products, settings), the
|
|
31
|
+
* create-invoice fetch state/error, and the id of the invoice last created
|
|
32
|
+
* (`savedInvoiceId`, to navigate on success).
|
|
14
33
|
*/
|
|
15
34
|
const getCreateInvoiceFormView = (state) => {
|
|
16
35
|
const createInvoiceState = state.invoicingCreateInvoiceState;
|
|
17
36
|
const catalogListView = (0, invoicingCatalogListViewSelector_1.getInvoicingCatalogListView)(state);
|
|
18
|
-
const plans = (0, invoicingCatalogListViewSelector_1.getInvoicingCatalogPrices)(catalogListView.plans);
|
|
19
37
|
return {
|
|
20
|
-
customers: (0, invoicingCustomerListViewSelector_1.getInvoicingCustomerListView)(state).customers
|
|
38
|
+
customers: (0, invoicingCustomerListViewSelector_1.getInvoicingCustomerListView)(state).customers.map((customer) => ({
|
|
39
|
+
billingAddress: customer.billingAddressId != null
|
|
40
|
+
? (0, addressSelector_1.getAddressByAddressId)(state.addressState, customer.billingAddressId)
|
|
41
|
+
: undefined,
|
|
42
|
+
email: customer.email,
|
|
43
|
+
id: customer.id,
|
|
44
|
+
name: customerDisplayName(customer),
|
|
45
|
+
})),
|
|
21
46
|
localData: createInvoiceState.formDraft,
|
|
22
|
-
planNames: plans
|
|
23
|
-
.
|
|
24
|
-
.
|
|
25
|
-
|
|
47
|
+
planNames: catalogListView.plans.flatMap((plan) => (plan.subFamilies ?? [])
|
|
48
|
+
.filter((subFamily) => (subFamily.name ?? '') !== '')
|
|
49
|
+
.map((subFamily) => ({
|
|
50
|
+
planName: plan.name ?? '',
|
|
51
|
+
subFamilyName: subFamily.name ?? '',
|
|
52
|
+
}))),
|
|
26
53
|
products: (0, invoicingCatalogListViewSelector_1.getInvoicingCatalogPrices)(catalogListView.products),
|
|
27
54
|
savedInvoiceId: createInvoiceState.createdInvoiceId,
|
|
28
55
|
settings: (0, settingsViewSelector_1.getInvoicingSettings)(state),
|
|
@@ -1,8 +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';
|
|
4
5
|
import { RootState } from '../../../reducer';
|
|
5
6
|
import { ZeniAPI } from '../../../zeniAPI';
|
|
6
7
|
import { runInvoicingDiscountAction, runInvoicingDiscountActionFailure, runInvoicingDiscountActionSuccess } from './discountActionReducer';
|
|
7
|
-
export type ActionType = ReturnType<typeof runInvoicingDiscountAction> | ReturnType<typeof runInvoicingDiscountActionSuccess> | ReturnType<typeof runInvoicingDiscountActionFailure> | ReturnType<typeof updateInvoicingCoupons>;
|
|
8
|
+
export type ActionType = ReturnType<typeof runInvoicingDiscountAction> | ReturnType<typeof runInvoicingDiscountActionSuccess> | ReturnType<typeof runInvoicingDiscountActionFailure> | ReturnType<typeof updateInvoicingCoupons> | ReturnType<typeof openSnackbar>;
|
|
8
9
|
export declare const runInvoicingDiscountActionEpic: (actions$: ActionsObservable<ActionType>, _state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
|
|
@@ -4,11 +4,28 @@ 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");
|
|
7
8
|
const responsePayload_1 = require("../../../responsePayload");
|
|
8
9
|
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
|
+
};
|
|
9
16
|
const runInvoicingDiscountActionEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(discountActionReducer_1.runInvoicingDiscountAction.match), (0, operators_1.mergeMap)((action) => {
|
|
10
17
|
const { action: kind, id } = action.payload;
|
|
11
18
|
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
|
+
];
|
|
12
29
|
const apiUrl = `${zeniAPI.apiEndPoints.invoicingMicroServiceBaseUrl}/1.0/discounts/${encodeURIComponent(id)}/actions`;
|
|
13
30
|
return zeniAPI
|
|
14
31
|
.postAndGetJSON(apiUrl, requestBody)
|
|
@@ -17,16 +34,23 @@ const runInvoicingDiscountActionEpic = (actions$, _state$, zeniAPI) => actions$.
|
|
|
17
34
|
return [
|
|
18
35
|
(0, couponReducer_1.updateInvoicingCoupons)([response.data], 'merge'),
|
|
19
36
|
(0, discountActionReducer_1.runInvoicingDiscountActionSuccess)({ id }),
|
|
37
|
+
...snackbar('success'),
|
|
20
38
|
];
|
|
21
39
|
}
|
|
22
|
-
return (0, rxjs_1.
|
|
23
|
-
|
|
40
|
+
return (0, rxjs_1.from)([
|
|
41
|
+
(0, discountActionReducer_1.runInvoicingDiscountActionFailure)({
|
|
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)),
|
|
24
51
|
id,
|
|
25
|
-
})
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
JSON.stringify(error)),
|
|
29
|
-
id,
|
|
30
|
-
}))));
|
|
52
|
+
}),
|
|
53
|
+
...snackbar('failed'),
|
|
54
|
+
])));
|
|
31
55
|
}));
|
|
32
56
|
exports.runInvoicingDiscountActionEpic = runInvoicingDiscountActionEpic;
|
|
@@ -1,8 +1,9 @@
|
|
|
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';
|
|
4
5
|
import { RootState } from '../../../reducer';
|
|
5
6
|
import { ZeniAPI } from '../../../zeniAPI';
|
|
6
7
|
import { runInvoicingDunningAction, runInvoicingDunningActionFailure, runInvoicingDunningActionSuccess } from './dunningActionReducer';
|
|
7
|
-
export type ActionType = ReturnType<typeof runInvoicingDunningAction> | ReturnType<typeof runInvoicingDunningActionSuccess> | ReturnType<typeof runInvoicingDunningActionFailure> | ReturnType<typeof updateInvoicingDunningCases>;
|
|
8
|
+
export type ActionType = ReturnType<typeof runInvoicingDunningAction> | ReturnType<typeof runInvoicingDunningActionSuccess> | ReturnType<typeof runInvoicingDunningActionFailure> | ReturnType<typeof updateInvoicingDunningCases> | ReturnType<typeof openSnackbar>;
|
|
8
9
|
export declare const runInvoicingDunningActionEpic: (actions$: ActionsObservable<ActionType>, _state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
|
|
@@ -4,10 +4,29 @@ 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");
|
|
7
8
|
const responsePayload_1 = require("../../../responsePayload");
|
|
8
9
|
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
|
+
};
|
|
9
18
|
const runInvoicingDunningActionEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(dunningActionReducer_1.runInvoicingDunningAction.match), (0, operators_1.mergeMap)((action) => {
|
|
10
19
|
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
|
+
];
|
|
11
30
|
const apiUrl = `${zeniAPI.apiEndPoints.invoicingMicroServiceBaseUrl}/1.0/dunning/${encodeURIComponent(id)}/${kind}`;
|
|
12
31
|
return zeniAPI
|
|
13
32
|
.postAndGetJSON(apiUrl, (body ?? {}))
|
|
@@ -16,16 +35,23 @@ const runInvoicingDunningActionEpic = (actions$, _state$, zeniAPI) => actions$.p
|
|
|
16
35
|
return [
|
|
17
36
|
(0, dunningCaseReducer_1.updateInvoicingDunningCases)([response.data], 'merge'),
|
|
18
37
|
(0, dunningActionReducer_1.runInvoicingDunningActionSuccess)({ id }),
|
|
38
|
+
...snackbar('success'),
|
|
19
39
|
];
|
|
20
40
|
}
|
|
21
|
-
return (0, rxjs_1.
|
|
22
|
-
|
|
41
|
+
return (0, rxjs_1.from)([
|
|
42
|
+
(0, dunningActionReducer_1.runInvoicingDunningActionFailure)({
|
|
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)),
|
|
23
52
|
id,
|
|
24
|
-
})
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
JSON.stringify(error)),
|
|
28
|
-
id,
|
|
29
|
-
}))));
|
|
53
|
+
}),
|
|
54
|
+
...snackbar('failed'),
|
|
55
|
+
])));
|
|
30
56
|
}));
|
|
31
57
|
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 } from './editInvoicingCatalogItemDetailViewState';
|
|
4
|
+
import type { InvoicingCatalogItemFormSubFamily, InvoicingCatalogItemFormTier } from './editInvoicingCatalogItemDetailViewState';
|
|
5
5
|
export type CatalogDetailSubFamilyEditValues = InvoicingCatalogItemFormSubFamily;
|
|
6
6
|
export interface CatalogDetailEditValues {
|
|
7
7
|
applicableItems: string[];
|
|
@@ -46,6 +46,8 @@ 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[];
|
|
49
51
|
}
|
|
50
52
|
/** Build POST /catalog/products body for Create sub-family. */
|
|
51
53
|
export declare const createSubFamilyFormToPayload: (itemId: string, itemType: string, values: CreateSubFamilyFormValues) => Record<string, unknown>;
|
|
@@ -121,17 +121,21 @@ 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);
|
|
124
125
|
const payload = {
|
|
125
126
|
currency_code: 'USD',
|
|
126
127
|
free_quantity: Number(values.freeQuantity) || 0,
|
|
127
128
|
is_taxable: true,
|
|
128
129
|
item_id: itemId,
|
|
129
130
|
name,
|
|
130
|
-
price: values.priceDollars?.amount ?? 0,
|
|
131
|
+
price: tiered ? 0 : (values.priceDollars?.amount ?? 0),
|
|
131
132
|
price_code: priceCode,
|
|
132
133
|
pricing_model: values.pricingModel || 'flat_fee',
|
|
133
134
|
show_description_in_invoices: true,
|
|
134
135
|
};
|
|
136
|
+
if (tiered) {
|
|
137
|
+
payload.tiers = (values.tiers ?? []).map(tierToPayload);
|
|
138
|
+
}
|
|
135
139
|
const description = trimOrUndefined(values.description);
|
|
136
140
|
if (description != null) {
|
|
137
141
|
payload.description = description;
|
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;
|
package/lib/view/invoicing/editInvoicingSubscriptionDetailView/saveInvoicingSubscriptionEpic.d.ts
CHANGED
|
@@ -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 { updateInvoicingSubscriptions } from '../../../entity/invoicing/invoicingSubscription/invoicingSubscriptionReducer';
|
|
5
|
+
import { openSnackbar } from '../../../entity/snackbar/snackbarReducer';
|
|
5
6
|
import { RootState } from '../../../reducer';
|
|
6
7
|
import { ZeniAPI } from '../../../zeniAPI';
|
|
7
8
|
import { resetNewAddressDataInLocalStore } from '../../addressView/addressViewReducer';
|
|
8
9
|
import { addInvoicingSubscriptionToList } from '../invoicingSubscriptionListView/invoicingSubscriptionListViewReducer';
|
|
9
10
|
import { submitInvoicingSubscriptionForm, submitInvoicingSubscriptionFormFailure, submitInvoicingSubscriptionFormSuccess, syncInvoicingSubscriptionCoupons } from './editInvoicingSubscriptionDetailViewReducer';
|
|
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>;
|
|
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> | ReturnType<typeof openSnackbar>;
|
|
11
12
|
export declare const saveInvoicingSubscriptionEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
|