@zeniai/client-epic-state 5.1.85-betaRD3 → 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/aiCfo/aiCfoState.d.ts +2 -2
- package/lib/entity/customerSatisfaction/customerSatisfactionReducer.d.ts +1 -1
- package/lib/entity/customerSatisfaction/customerSatisfactionReducer.js +2 -6
- package/lib/entity/jeSchedules/jeScheduleHelper.d.ts +0 -2
- package/lib/entity/jeSchedules/jeScheduleHelper.js +0 -7
- package/lib/entity/jeSchedules/jeSchedulesPayload.d.ts +1 -34
- package/lib/entity/jeSchedules/jeSchedulesPayload.js +0 -68
- package/lib/entity/jeSchedules/jeSchedulesReducer.d.ts +2 -4
- package/lib/entity/jeSchedules/jeSchedulesReducer.js +2 -24
- package/lib/entity/jeSchedules/jeSchedulesSelector.d.ts +2 -10
- package/lib/entity/jeSchedules/jeSchedulesSelector.js +3 -28
- package/lib/entity/jeSchedules/jeSchedulesState.d.ts +1 -41
- package/lib/entity/jeSchedules/jeSchedulesTypes.d.ts +1 -12
- package/lib/entity/jeSchedules/jeSchedulesTypes.js +1 -40
- package/lib/entity/snackbar/snackbarTypes.d.ts +1 -1
- package/lib/entity/snackbar/snackbarTypes.js +0 -29
- package/lib/entity/transaction/payloadTypes/scheduleTransactionPayload.d.ts +0 -2
- package/lib/entity/transaction/payloadTypes/scheduleTransactionPayload.js +0 -2
- package/lib/entity/transaction/stateTypes/scheduleTransaction.d.ts +0 -2
- package/lib/epic.d.ts +1 -5
- package/lib/epic.js +1 -5
- package/lib/esm/entity/customerSatisfaction/customerSatisfactionReducer.js +1 -4
- package/lib/esm/entity/jeSchedules/jeScheduleHelper.js +0 -6
- package/lib/esm/entity/jeSchedules/jeSchedulesPayload.js +1 -68
- package/lib/esm/entity/jeSchedules/jeSchedulesReducer.js +2 -24
- package/lib/esm/entity/jeSchedules/jeSchedulesSelector.js +2 -26
- package/lib/esm/entity/jeSchedules/jeSchedulesTypes.js +0 -34
- package/lib/esm/entity/snackbar/snackbarTypes.js +0 -29
- package/lib/esm/entity/transaction/payloadTypes/scheduleTransactionPayload.js +0 -2
- package/lib/esm/epic.js +1 -5
- package/lib/esm/index.js +5 -11
- package/lib/esm/view/companyHealthMetricView/companyHealthMetricConfigReducer.js +1 -4
- package/lib/esm/view/expenseAutomationView/epics/common/fetchAllExpenseAutomationTabsEpic.js +3 -6
- package/lib/esm/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulesEpic.js +3 -34
- package/lib/esm/view/expenseAutomationView/reducers/jeSchedulesViewReducer.js +28 -163
- package/lib/esm/view/expenseAutomationView/selectors/jeSchedulesViewSelector.js +22 -260
- package/lib/esm/view/expenseAutomationView/types/jeSchedulesViewState.js +6 -5
- 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 +13 -18
- package/lib/index.js +50 -76
- package/lib/view/companyHealthMetricView/companyHealthMetricConfigReducer.d.ts +1 -1
- package/lib/view/companyHealthMetricView/companyHealthMetricConfigReducer.js +2 -5
- package/lib/view/expenseAutomationView/epics/common/fetchAllExpenseAutomationTabsEpic.js +3 -6
- package/lib/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulesEpic.d.ts +2 -2
- package/lib/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulesEpic.js +1 -32
- package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.d.ts +1 -1
- package/lib/view/expenseAutomationView/payload/jeSchedulesPayload.d.ts +1 -8
- package/lib/view/expenseAutomationView/reducers/jeSchedulesViewReducer.d.ts +10 -45
- package/lib/view/expenseAutomationView/reducers/jeSchedulesViewReducer.js +28 -164
- package/lib/view/expenseAutomationView/reducers/missingReceiptsViewReducer.d.ts +1 -1
- package/lib/view/expenseAutomationView/reducers/transactionsViewReducer.d.ts +2 -2
- package/lib/view/expenseAutomationView/selectorTypes/jeSchedulesSelectorTypes.d.ts +8 -34
- package/lib/view/expenseAutomationView/selectors/jeSchedulesViewSelector.d.ts +1 -10
- package/lib/view/expenseAutomationView/selectors/jeSchedulesViewSelector.js +21 -266
- package/lib/view/expenseAutomationView/types/completedSubTab.d.ts +1 -1
- package/lib/view/expenseAutomationView/types/jeSchedulesViewState.d.ts +8 -59
- package/lib/view/expenseAutomationView/types/jeSchedulesViewState.js +8 -8
- 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
- package/lib/esm/view/expenseAutomationView/epics/jeSchedule/newSchedule/initializeNewScheduleEpic.js +0 -21
- package/lib/esm/view/expenseAutomationView/epics/jeSchedule/newSchedule/saveNewScheduleEpic.js +0 -110
- package/lib/esm/view/expenseAutomationView/epics/jeSchedule/newSchedule/searchTransactionsForNewScheduleEpic.js +0 -73
- package/lib/esm/view/expenseAutomationView/epics/jeSchedule/switchJESchedulesTabEpic.js +0 -22
- package/lib/esm/view/expenseAutomationView/helpers/newScheduleLocalDataHelper.js +0 -140
- package/lib/esm/view/expenseAutomationView/selectorTypes/jeNewScheduleViewSelectorTypes.js +0 -1
- package/lib/esm/view/expenseAutomationView/selectors/jeNewScheduleViewSelector.js +0 -70
- package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/initializeNewScheduleEpic.d.ts +0 -8
- package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/initializeNewScheduleEpic.js +0 -25
- package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/saveNewScheduleEpic.d.ts +0 -45
- package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/saveNewScheduleEpic.js +0 -114
- package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/searchTransactionsForNewScheduleEpic.d.ts +0 -8
- package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/searchTransactionsForNewScheduleEpic.js +0 -77
- package/lib/view/expenseAutomationView/epics/jeSchedule/switchJESchedulesTabEpic.d.ts +0 -6
- package/lib/view/expenseAutomationView/epics/jeSchedule/switchJESchedulesTabEpic.js +0 -26
- package/lib/view/expenseAutomationView/helpers/newScheduleLocalDataHelper.d.ts +0 -36
- package/lib/view/expenseAutomationView/helpers/newScheduleLocalDataHelper.js +0 -145
- package/lib/view/expenseAutomationView/selectorTypes/jeNewScheduleViewSelectorTypes.d.ts +0 -25
- package/lib/view/expenseAutomationView/selectorTypes/jeNewScheduleViewSelectorTypes.js +0 -2
- package/lib/view/expenseAutomationView/selectors/jeNewScheduleViewSelector.d.ts +0 -10
- package/lib/view/expenseAutomationView/selectors/jeNewScheduleViewSelector.js +0 -75
|
@@ -16,8 +16,9 @@ const JE_SCHEDULE_SORT_KEYS = [
|
|
|
16
16
|
'memo',
|
|
17
17
|
];
|
|
18
18
|
export const toJEScheduleSortKey = (v) => stringToUnion(v, JE_SCHEDULE_SORT_KEYS);
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
19
|
+
const JE_SCHEDULE_MAIN_TABS = [
|
|
20
|
+
'pending_review',
|
|
21
|
+
'ongoing',
|
|
22
|
+
'completed',
|
|
23
|
+
];
|
|
24
|
+
export const toJEScheduleMainTab = (v) => stringToUnion(v, JE_SCHEDULE_MAIN_TABS);
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { of } from 'rxjs';
|
|
2
2
|
import { catchError, filter, mergeMap } from 'rxjs/operators';
|
|
3
3
|
import { updateInvoicingCreditNotes } from '../../../entity/invoicing/creditNote/creditNoteReducer';
|
|
4
|
-
import { openSnackbar } from '../../../entity/snackbar/snackbarReducer';
|
|
5
4
|
import { createZeniAPIStatus, isSuccessResponse } from '../../../responsePayload';
|
|
6
5
|
import { localDataToCreateCreditNotePayload, } from './createCreditNotePayload';
|
|
7
6
|
import { createCreditNoteFailure, createCreditNoteSuccess, submitCreateCreditNote, } from './createCreditNoteReducer';
|
|
@@ -16,28 +15,9 @@ export const createCreditNoteEpic = (actions$, state$, zeniAPI) => actions$.pipe
|
|
|
16
15
|
return [
|
|
17
16
|
updateInvoicingCreditNotes([response.data], 'merge'),
|
|
18
17
|
createCreditNoteSuccess({ creditNoteId: response.data.id }),
|
|
19
|
-
openSnackbar({
|
|
20
|
-
messageSection: 'invoicing_credit_note_saved',
|
|
21
|
-
messageText: 'success',
|
|
22
|
-
type: 'success',
|
|
23
|
-
}),
|
|
24
18
|
];
|
|
25
19
|
}
|
|
26
|
-
return
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
messageSection: 'invoicing_credit_note_saved',
|
|
30
|
-
messageText: 'failed',
|
|
31
|
-
type: 'error',
|
|
32
|
-
}),
|
|
33
|
-
]);
|
|
34
|
-
}), catchError((error) => from([
|
|
35
|
-
createCreditNoteFailure(createZeniAPIStatus('Unexpected Error', 'Create credit note REST API call errored out ' +
|
|
36
|
-
JSON.stringify(error))),
|
|
37
|
-
openSnackbar({
|
|
38
|
-
messageSection: 'invoicing_credit_note_saved',
|
|
39
|
-
messageText: 'failed',
|
|
40
|
-
type: 'error',
|
|
41
|
-
}),
|
|
42
|
-
])));
|
|
20
|
+
return of(createCreditNoteFailure(response.status));
|
|
21
|
+
}), catchError((error) => of(createCreditNoteFailure(createZeniAPIStatus('Unexpected Error', 'Create credit note REST API call errored out ' +
|
|
22
|
+
JSON.stringify(error))))));
|
|
43
23
|
}));
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { of } from 'rxjs';
|
|
2
2
|
import { catchError, filter, mergeMap } from 'rxjs/operators';
|
|
3
3
|
import { updateAddresses } from '../../../entity/address/addressReducer';
|
|
4
4
|
import { extractInvoicingInvoiceAddresses } from '../../../entity/invoicing/invoice/invoicePayload';
|
|
5
5
|
import { updateInvoices } from '../../../entity/invoicing/invoice/invoiceReducer';
|
|
6
|
-
import { openSnackbar } from '../../../entity/snackbar/snackbarReducer';
|
|
7
6
|
import { createZeniAPIStatus, isSuccessResponse } from '../../../responsePayload';
|
|
8
7
|
import { addInvoiceToList } from '../invoiceList/invoiceListReducer';
|
|
9
8
|
import { createInvoice, createInvoiceFailure, createInvoiceSuccess, } from './createInvoiceReducer';
|
|
@@ -23,28 +22,9 @@ export const createInvoiceEpic = (actions$, _state$, zeniAPI) => actions$.pipe(f
|
|
|
23
22
|
status: response.data.status,
|
|
24
23
|
}),
|
|
25
24
|
createInvoiceSuccess({ invoiceId: response.data.id }),
|
|
26
|
-
openSnackbar({
|
|
27
|
-
messageSection: 'invoicing_invoice_saved',
|
|
28
|
-
messageText: 'success',
|
|
29
|
-
type: 'success',
|
|
30
|
-
}),
|
|
31
25
|
];
|
|
32
26
|
}
|
|
33
|
-
return
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
messageSection: 'invoicing_invoice_saved',
|
|
37
|
-
messageText: 'failed',
|
|
38
|
-
type: 'error',
|
|
39
|
-
}),
|
|
40
|
-
]);
|
|
41
|
-
}), catchError((error) => from([
|
|
42
|
-
createInvoiceFailure(createZeniAPIStatus('Unexpected Error', 'Create invoice REST API call errored out ' +
|
|
43
|
-
JSON.stringify(error))),
|
|
44
|
-
openSnackbar({
|
|
45
|
-
messageSection: 'invoicing_invoice_saved',
|
|
46
|
-
messageText: 'failed',
|
|
47
|
-
type: 'error',
|
|
48
|
-
}),
|
|
49
|
-
])));
|
|
27
|
+
return of(createInvoiceFailure(response.status));
|
|
28
|
+
}), catchError((error) => of(createInvoiceFailure(createZeniAPIStatus('Unexpected Error', 'Create invoice REST API call errored out ' +
|
|
29
|
+
JSON.stringify(error))))));
|
|
50
30
|
}));
|
|
@@ -1,52 +1,25 @@
|
|
|
1
|
-
import { getAddressByAddressId } from '../../../entity/address/addressSelector';
|
|
2
1
|
import { getInvoicingCatalogListView, getInvoicingCatalogPrices, } from '../invoicingCatalogListView/invoicingCatalogListViewSelector';
|
|
3
2
|
import { getInvoicingCustomerListView } from '../invoicingCustomerListView/invoicingCustomerListViewSelector';
|
|
4
3
|
import { getInvoicingSettings } from '../settingsView/settingsViewSelector';
|
|
5
|
-
/**
|
|
6
|
-
* Display name for a customer option: company, else the full name, else the
|
|
7
|
-
* email, else the raw id.
|
|
8
|
-
*/
|
|
9
|
-
const customerDisplayName = (customer) => {
|
|
10
|
-
const fullName = [customer.firstName, customer.lastName]
|
|
11
|
-
.filter((part) => part != null && part.trim() !== '')
|
|
12
|
-
.join(' ')
|
|
13
|
-
.trim();
|
|
14
|
-
const company = customer.company?.trim() ?? '';
|
|
15
|
-
const email = customer.email?.trim() ?? '';
|
|
16
|
-
return company !== ''
|
|
17
|
-
? company
|
|
18
|
-
: fullName !== ''
|
|
19
|
-
? fullName
|
|
20
|
-
: email !== ''
|
|
21
|
-
? email
|
|
22
|
-
: customer.id;
|
|
23
|
-
};
|
|
24
4
|
/**
|
|
25
5
|
* Single bundled view for the create-invoice screen — web-ui consumes only this.
|
|
26
6
|
* Carries the form draft (`localData`), the option sources the form needs
|
|
27
|
-
* (
|
|
28
|
-
*
|
|
29
|
-
*
|
|
7
|
+
* (customers, catalog plans/products, settings), the create-invoice fetch
|
|
8
|
+
* state/error, and the id of the invoice last created (`savedInvoiceId`, to
|
|
9
|
+
* navigate on success). Returns raw entity lists; the screen maps them to its
|
|
10
|
+
* option shapes.
|
|
30
11
|
*/
|
|
31
12
|
export const getCreateInvoiceFormView = (state) => {
|
|
32
13
|
const createInvoiceState = state.invoicingCreateInvoiceState;
|
|
33
14
|
const catalogListView = getInvoicingCatalogListView(state);
|
|
15
|
+
const plans = getInvoicingCatalogPrices(catalogListView.plans);
|
|
34
16
|
return {
|
|
35
|
-
customers: getInvoicingCustomerListView(state).customers
|
|
36
|
-
billingAddress: customer.billingAddressId != null
|
|
37
|
-
? getAddressByAddressId(state.addressState, customer.billingAddressId)
|
|
38
|
-
: undefined,
|
|
39
|
-
email: customer.email,
|
|
40
|
-
id: customer.id,
|
|
41
|
-
name: customerDisplayName(customer),
|
|
42
|
-
})),
|
|
17
|
+
customers: getInvoicingCustomerListView(state).customers,
|
|
43
18
|
localData: createInvoiceState.formDraft,
|
|
44
|
-
planNames:
|
|
45
|
-
.
|
|
46
|
-
.
|
|
47
|
-
|
|
48
|
-
subFamilyName: subFamily.name ?? '',
|
|
49
|
-
}))),
|
|
19
|
+
planNames: plans
|
|
20
|
+
.map((plan) => plan.name ?? '')
|
|
21
|
+
.filter((name) => name !== ''),
|
|
22
|
+
plans,
|
|
50
23
|
products: getInvoicingCatalogPrices(catalogListView.products),
|
|
51
24
|
savedInvoiceId: createInvoiceState.createdInvoiceId,
|
|
52
25
|
settings: getInvoicingSettings(state),
|
|
@@ -1,28 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { of } from 'rxjs';
|
|
2
2
|
import { catchError, filter, mergeMap } from 'rxjs/operators';
|
|
3
3
|
import { updateInvoicingCoupons } from '../../../entity/invoicing/coupon/couponReducer';
|
|
4
|
-
import { openSnackbar } from '../../../entity/snackbar/snackbarReducer';
|
|
5
4
|
import { createZeniAPIStatus, isSuccessResponse } from '../../../responsePayload';
|
|
6
5
|
import { runInvoicingDiscountAction, runInvoicingDiscountActionFailure, runInvoicingDiscountActionSuccess, } from './discountActionReducer';
|
|
7
|
-
/** Snackbar copy per action kind; unlisted kinds run without one. */
|
|
8
|
-
const SNACKBAR_SECTION_BY_KIND = {
|
|
9
|
-
archive: 'invoicing_discount_archive',
|
|
10
|
-
delete: 'invoicing_discount_delete',
|
|
11
|
-
unarchive: 'invoicing_discount_unarchive',
|
|
12
|
-
};
|
|
13
6
|
export const runInvoicingDiscountActionEpic = (actions$, _state$, zeniAPI) => actions$.pipe(filter(runInvoicingDiscountAction.match), mergeMap((action) => {
|
|
14
7
|
const { action: kind, id } = action.payload;
|
|
15
8
|
const requestBody = { action: kind };
|
|
16
|
-
const snackbarSection = SNACKBAR_SECTION_BY_KIND[kind];
|
|
17
|
-
const snackbar = (messageText) => snackbarSection == null
|
|
18
|
-
? []
|
|
19
|
-
: [
|
|
20
|
-
openSnackbar({
|
|
21
|
-
messageSection: snackbarSection,
|
|
22
|
-
messageText,
|
|
23
|
-
type: messageText === 'success' ? 'success' : 'error',
|
|
24
|
-
}),
|
|
25
|
-
];
|
|
26
9
|
const apiUrl = `${zeniAPI.apiEndPoints.invoicingMicroServiceBaseUrl}/1.0/discounts/${encodeURIComponent(id)}/actions`;
|
|
27
10
|
return zeniAPI
|
|
28
11
|
.postAndGetJSON(apiUrl, requestBody)
|
|
@@ -31,22 +14,15 @@ export const runInvoicingDiscountActionEpic = (actions$, _state$, zeniAPI) => ac
|
|
|
31
14
|
return [
|
|
32
15
|
updateInvoicingCoupons([response.data], 'merge'),
|
|
33
16
|
runInvoicingDiscountActionSuccess({ id }),
|
|
34
|
-
...snackbar('success'),
|
|
35
17
|
];
|
|
36
18
|
}
|
|
37
|
-
return
|
|
38
|
-
|
|
39
|
-
error: response.status,
|
|
40
|
-
id,
|
|
41
|
-
}),
|
|
42
|
-
...snackbar('failed'),
|
|
43
|
-
]);
|
|
44
|
-
}), catchError((error) => from([
|
|
45
|
-
runInvoicingDiscountActionFailure({
|
|
46
|
-
error: createZeniAPIStatus('Unexpected Error', 'Discount action REST API call errored out ' +
|
|
47
|
-
JSON.stringify(error)),
|
|
19
|
+
return of(runInvoicingDiscountActionFailure({
|
|
20
|
+
error: response.status,
|
|
48
21
|
id,
|
|
49
|
-
})
|
|
50
|
-
|
|
51
|
-
|
|
22
|
+
}));
|
|
23
|
+
}), catchError((error) => of(runInvoicingDiscountActionFailure({
|
|
24
|
+
error: createZeniAPIStatus('Unexpected Error', 'Discount action REST API call errored out ' +
|
|
25
|
+
JSON.stringify(error)),
|
|
26
|
+
id,
|
|
27
|
+
}))));
|
|
52
28
|
}));
|
|
@@ -1,29 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { of } from 'rxjs';
|
|
2
2
|
import { catchError, filter, mergeMap } from 'rxjs/operators';
|
|
3
3
|
import { updateInvoicingDunningCases } from '../../../entity/invoicing/dunningCase/dunningCaseReducer';
|
|
4
|
-
import { openSnackbar } from '../../../entity/snackbar/snackbarReducer';
|
|
5
4
|
import { createZeniAPIStatus, isSuccessResponse } from '../../../responsePayload';
|
|
6
5
|
import { runInvoicingDunningAction, runInvoicingDunningActionFailure, runInvoicingDunningActionSuccess, } from './dunningActionReducer';
|
|
7
|
-
/**
|
|
8
|
-
* Snackbar copy is per action kind; anything not listed here runs without one.
|
|
9
|
-
*/
|
|
10
|
-
const SNACKBAR_SECTION_BY_KIND = {
|
|
11
|
-
cancel: 'invoicing_dunning_cancel',
|
|
12
|
-
resolve: 'invoicing_dunning_case_resolved',
|
|
13
|
-
retry: 'invoicing_dunning_retry',
|
|
14
|
-
};
|
|
15
6
|
export const runInvoicingDunningActionEpic = (actions$, _state$, zeniAPI) => actions$.pipe(filter(runInvoicingDunningAction.match), mergeMap((action) => {
|
|
16
7
|
const { action: kind, body, id } = action.payload;
|
|
17
|
-
const snackbarSection = SNACKBAR_SECTION_BY_KIND[kind];
|
|
18
|
-
const snackbar = (messageText) => snackbarSection == null
|
|
19
|
-
? []
|
|
20
|
-
: [
|
|
21
|
-
openSnackbar({
|
|
22
|
-
messageSection: snackbarSection,
|
|
23
|
-
messageText,
|
|
24
|
-
type: messageText === 'success' ? 'success' : 'error',
|
|
25
|
-
}),
|
|
26
|
-
];
|
|
27
8
|
const apiUrl = `${zeniAPI.apiEndPoints.invoicingMicroServiceBaseUrl}/1.0/dunning/${encodeURIComponent(id)}/${kind}`;
|
|
28
9
|
return zeniAPI
|
|
29
10
|
.postAndGetJSON(apiUrl, (body ?? {}))
|
|
@@ -32,22 +13,15 @@ export const runInvoicingDunningActionEpic = (actions$, _state$, zeniAPI) => act
|
|
|
32
13
|
return [
|
|
33
14
|
updateInvoicingDunningCases([response.data], 'merge'),
|
|
34
15
|
runInvoicingDunningActionSuccess({ id }),
|
|
35
|
-
...snackbar('success'),
|
|
36
16
|
];
|
|
37
17
|
}
|
|
38
|
-
return
|
|
39
|
-
|
|
40
|
-
error: response.status,
|
|
41
|
-
id,
|
|
42
|
-
}),
|
|
43
|
-
...snackbar('failed'),
|
|
44
|
-
]);
|
|
45
|
-
}), catchError((error) => from([
|
|
46
|
-
runInvoicingDunningActionFailure({
|
|
47
|
-
error: createZeniAPIStatus('Unexpected Error', 'Dunning action REST API call errored out ' +
|
|
48
|
-
JSON.stringify(error)),
|
|
18
|
+
return of(runInvoicingDunningActionFailure({
|
|
19
|
+
error: response.status,
|
|
49
20
|
id,
|
|
50
|
-
})
|
|
51
|
-
|
|
52
|
-
|
|
21
|
+
}));
|
|
22
|
+
}), catchError((error) => of(runInvoicingDunningActionFailure({
|
|
23
|
+
error: createZeniAPIStatus('Unexpected Error', 'Dunning action REST API call errored out ' +
|
|
24
|
+
JSON.stringify(error)),
|
|
25
|
+
id,
|
|
26
|
+
}))));
|
|
53
27
|
}));
|
package/lib/esm/view/invoicing/editInvoicingCatalogItemDetailView/catalogDetailEditPayload.js
CHANGED
|
@@ -116,21 +116,17 @@ export const catalogDetailEditValuesToSavePayload = (values, itemType = 'plan',
|
|
|
116
116
|
export const createSubFamilyFormToPayload = (itemId, itemType, values) => {
|
|
117
117
|
const name = values.name.trim();
|
|
118
118
|
const priceCode = trimOrUndefined(values.priceCode) ?? toProductCode(name);
|
|
119
|
-
const tiered = isTieredCatalogPricingModel(values.pricingModel);
|
|
120
119
|
const payload = {
|
|
121
120
|
currency_code: 'USD',
|
|
122
121
|
free_quantity: Number(values.freeQuantity) || 0,
|
|
123
122
|
is_taxable: true,
|
|
124
123
|
item_id: itemId,
|
|
125
124
|
name,
|
|
126
|
-
price:
|
|
125
|
+
price: values.priceDollars?.amount ?? 0,
|
|
127
126
|
price_code: priceCode,
|
|
128
127
|
pricing_model: values.pricingModel || 'flat_fee',
|
|
129
128
|
show_description_in_invoices: true,
|
|
130
129
|
};
|
|
131
|
-
if (tiered) {
|
|
132
|
-
payload.tiers = (values.tiers ?? []).map(tierToPayload);
|
|
133
|
-
}
|
|
134
130
|
const description = trimOrUndefined(values.description);
|
|
135
131
|
if (description != null) {
|
|
136
132
|
payload.description = description;
|
package/lib/esm/view/invoicing/editInvoicingCatalogItemDetailView/saveInvoicingCatalogItemEpic.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { forkJoin,
|
|
1
|
+
import { forkJoin, of } from 'rxjs';
|
|
2
2
|
import { catchError, filter, mergeMap } from 'rxjs/operators';
|
|
3
3
|
import { mergeInvoicingPlanSubFamily, updateInvoicingPlans, } from '../../../entity/invoicing/plan/planReducer';
|
|
4
4
|
import { updateInvoicingProducts } from '../../../entity/invoicing/product/productReducer';
|
|
5
|
-
import { openSnackbar } from '../../../entity/snackbar/snackbarReducer';
|
|
6
5
|
import { createZeniAPIStatus, isSuccessResponse } from '../../../responsePayload';
|
|
7
6
|
import { addInvoicingCatalogItem } from '../invoicingCatalogListView/invoicingCatalogListViewReducer';
|
|
8
7
|
import { localDataToSaveInvoicingCatalogItemPayload, } from './editInvoicingCatalogItemDetailViewPayload';
|
|
@@ -39,14 +38,7 @@ export const saveInvoicingCatalogItemEpic = (actions$, state$, zeniAPI) => actio
|
|
|
39
38
|
const failedProductResponse = productResponses.find((productResponse) => !isSuccessResponse(productResponse) ||
|
|
40
39
|
productResponse.data == null);
|
|
41
40
|
if (failedProductResponse != null) {
|
|
42
|
-
return
|
|
43
|
-
submitInvoicingCatalogItemFormFailure(failedProductResponse.status),
|
|
44
|
-
openSnackbar({
|
|
45
|
-
messageSection: 'invoicing_catalog_item_saved',
|
|
46
|
-
messageText: 'failed',
|
|
47
|
-
type: 'error',
|
|
48
|
-
}),
|
|
49
|
-
]);
|
|
41
|
+
return of(submitInvoicingCatalogItemFormFailure(failedProductResponse.status));
|
|
50
42
|
}
|
|
51
43
|
const savedProducts = productResponses.flatMap((productResponse) => productResponse.data != null ? [productResponse.data] : []);
|
|
52
44
|
const resultActions = [
|
|
@@ -73,11 +65,6 @@ export const saveInvoicingCatalogItemEpic = (actions$, state$, zeniAPI) => actio
|
|
|
73
65
|
: 'plan';
|
|
74
66
|
resultActions.push(addInvoicingCatalogItem({ id: savedItem.id, type: itemType }));
|
|
75
67
|
}
|
|
76
|
-
resultActions.push(openSnackbar({
|
|
77
|
-
messageSection: 'invoicing_catalog_item_saved',
|
|
78
|
-
messageText: 'success',
|
|
79
|
-
type: 'success',
|
|
80
|
-
}));
|
|
81
68
|
return resultActions;
|
|
82
69
|
};
|
|
83
70
|
const productUpdates = saveInvoicingCatalogItem.match(action)
|
|
@@ -88,21 +75,7 @@ export const saveInvoicingCatalogItemEpic = (actions$, state$, zeniAPI) => actio
|
|
|
88
75
|
}
|
|
89
76
|
return forkJoin(productUpdates.map((productUpdate) => zeniAPI.putAndGetJSON(`${baseUrl}/catalog/products/${encodeURIComponent(productUpdate.id)}`, productUpdate.data))).pipe(mergeMap(completeSave));
|
|
90
77
|
}
|
|
91
|
-
return
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
messageSection: 'invoicing_catalog_item_saved',
|
|
95
|
-
messageText: 'failed',
|
|
96
|
-
type: 'error',
|
|
97
|
-
}),
|
|
98
|
-
]);
|
|
99
|
-
}), catchError((error) => from([
|
|
100
|
-
submitInvoicingCatalogItemFormFailure(createZeniAPIStatus('Unexpected Error', 'Save catalog item REST API call errored out ' +
|
|
101
|
-
JSON.stringify(error))),
|
|
102
|
-
openSnackbar({
|
|
103
|
-
messageSection: 'invoicing_catalog_item_saved',
|
|
104
|
-
messageText: 'failed',
|
|
105
|
-
type: 'error',
|
|
106
|
-
}),
|
|
107
|
-
])));
|
|
78
|
+
return of(submitInvoicingCatalogItemFormFailure(response.status));
|
|
79
|
+
}), catchError((error) => of(submitInvoicingCatalogItemFormFailure(createZeniAPIStatus('Unexpected Error', 'Save catalog item REST API call errored out ' +
|
|
80
|
+
JSON.stringify(error))))));
|
|
108
81
|
}));
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { of } from 'rxjs';
|
|
2
2
|
import { catchError, filter, mergeMap } from 'rxjs/operators';
|
|
3
3
|
import { updateInvoicingCoupons } from '../../../entity/invoicing/coupon/couponReducer';
|
|
4
|
-
import { openSnackbar } from '../../../entity/snackbar/snackbarReducer';
|
|
5
4
|
import { createZeniAPIStatus, isSuccessResponse } from '../../../responsePayload';
|
|
6
5
|
import { addInvoicingCouponToList } from '../couponView/couponViewReducer';
|
|
7
6
|
import { localDataToSaveInvoicingCouponPayload, } from './editInvoicingCouponDetailViewPayload';
|
|
@@ -44,27 +43,8 @@ export const saveInvoicingCouponEpic = (actions$, state$, zeniAPI) => actions$.p
|
|
|
44
43
|
status: couponPayload.status,
|
|
45
44
|
}));
|
|
46
45
|
}
|
|
47
|
-
resultActions.push(openSnackbar({
|
|
48
|
-
messageSection: 'invoicing_coupon_saved',
|
|
49
|
-
messageText: 'success',
|
|
50
|
-
type: 'success',
|
|
51
|
-
}));
|
|
52
46
|
return resultActions;
|
|
53
47
|
}
|
|
54
|
-
return
|
|
55
|
-
|
|
56
|
-
openSnackbar({
|
|
57
|
-
messageSection: 'invoicing_coupon_saved',
|
|
58
|
-
messageText: 'failed',
|
|
59
|
-
type: 'error',
|
|
60
|
-
}),
|
|
61
|
-
]);
|
|
62
|
-
}), catchError((error) => from([
|
|
63
|
-
submitInvoicingCouponFormFailure(createZeniAPIStatus('Unexpected Error', 'Save coupon REST API call errored out ' + JSON.stringify(error))),
|
|
64
|
-
openSnackbar({
|
|
65
|
-
messageSection: 'invoicing_coupon_saved',
|
|
66
|
-
messageText: 'failed',
|
|
67
|
-
type: 'error',
|
|
68
|
-
}),
|
|
69
|
-
])));
|
|
48
|
+
return of(submitInvoicingCouponFormFailure(response.status));
|
|
49
|
+
}), catchError((error) => of(submitInvoicingCouponFormFailure(createZeniAPIStatus('Unexpected Error', 'Save coupon REST API call errored out ' + JSON.stringify(error))))));
|
|
70
50
|
}));
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { of } from 'rxjs';
|
|
2
2
|
import { catchError, filter, mergeMap } from 'rxjs/operators';
|
|
3
3
|
import { updateAddresses } from '../../../entity/address/addressReducer';
|
|
4
4
|
import { extractInvoicingCustomerAddresses } from '../../../entity/invoicing/invoicingCustomer/invoicingCustomerPayload';
|
|
5
5
|
import { updateInvoicingCustomers } from '../../../entity/invoicing/invoicingCustomer/invoicingCustomerReducer';
|
|
6
|
-
import { openSnackbar } from '../../../entity/snackbar/snackbarReducer';
|
|
7
6
|
import { createZeniAPIStatus, isSuccessResponse } from '../../../responsePayload';
|
|
8
7
|
import { resetNewAddressDataInLocalStore } from '../../addressView/addressViewReducer';
|
|
9
8
|
import { addInvoicingCustomerToList } from '../invoicingCustomerListView/invoicingCustomerListViewReducer';
|
|
@@ -46,28 +45,9 @@ export const saveInvoicingCustomerEpic = (actions$, state$, zeniAPI) => actions$
|
|
|
46
45
|
status: response.data.status,
|
|
47
46
|
}));
|
|
48
47
|
}
|
|
49
|
-
resultActions.push(openSnackbar({
|
|
50
|
-
messageSection: 'invoicing_customer_saved',
|
|
51
|
-
messageText: 'success',
|
|
52
|
-
type: 'success',
|
|
53
|
-
}));
|
|
54
48
|
return resultActions;
|
|
55
49
|
}
|
|
56
|
-
return
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
messageSection: 'invoicing_customer_saved',
|
|
60
|
-
messageText: 'failed',
|
|
61
|
-
type: 'error',
|
|
62
|
-
}),
|
|
63
|
-
]);
|
|
64
|
-
}), catchError((error) => from([
|
|
65
|
-
submitInvoicingCustomerFormFailure(createZeniAPIStatus('Unexpected Error', 'Save customer REST API call errored out ' +
|
|
66
|
-
JSON.stringify(error))),
|
|
67
|
-
openSnackbar({
|
|
68
|
-
messageSection: 'invoicing_customer_saved',
|
|
69
|
-
messageText: 'failed',
|
|
70
|
-
type: 'error',
|
|
71
|
-
}),
|
|
72
|
-
])));
|
|
50
|
+
return of(submitInvoicingCustomerFormFailure(response.status));
|
|
51
|
+
}), catchError((error) => of(submitInvoicingCustomerFormFailure(createZeniAPIStatus('Unexpected Error', 'Save customer REST API call errored out ' +
|
|
52
|
+
JSON.stringify(error))))));
|
|
73
53
|
}));
|
package/lib/esm/view/invoicing/editInvoicingSubscriptionDetailView/saveInvoicingSubscriptionEpic.js
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { of } from 'rxjs';
|
|
2
2
|
import { catchError, filter, mergeMap } from 'rxjs/operators';
|
|
3
3
|
import { updateAddresses } from '../../../entity/address/addressReducer';
|
|
4
4
|
import { extractInvoicingSubscriptionAddresses } from '../../../entity/invoicing/invoicingSubscription/invoicingSubscriptionPayload';
|
|
5
5
|
import { updateInvoicingSubscriptions } from '../../../entity/invoicing/invoicingSubscription/invoicingSubscriptionReducer';
|
|
6
|
-
import { openSnackbar } from '../../../entity/snackbar/snackbarReducer';
|
|
7
6
|
import { createZeniAPIStatus, isSuccessResponse } from '../../../responsePayload';
|
|
8
7
|
import { resetNewAddressDataInLocalStore } from '../../addressView/addressViewReducer';
|
|
9
8
|
import { addInvoicingSubscriptionToList } from '../invoicingSubscriptionListView/invoicingSubscriptionListViewReducer';
|
|
@@ -39,14 +38,7 @@ export const saveInvoicingSubscriptionEpic = (actions$, state$, zeniAPI) => acti
|
|
|
39
38
|
: zeniAPI.postAndGetJSON(`${baseUrl}/subscriptions`, { ...data });
|
|
40
39
|
return request$.pipe(mergeMap((response) => {
|
|
41
40
|
if (!isSuccessResponse(response) || response.data == null) {
|
|
42
|
-
return [
|
|
43
|
-
submitInvoicingSubscriptionFormFailure(response.status),
|
|
44
|
-
openSnackbar({
|
|
45
|
-
messageSection: 'invoicing_subscription_saved',
|
|
46
|
-
messageText: 'failed',
|
|
47
|
-
type: 'error',
|
|
48
|
-
}),
|
|
49
|
-
];
|
|
41
|
+
return [submitInvoicingSubscriptionFormFailure(response.status)];
|
|
50
42
|
}
|
|
51
43
|
const saved = response.data;
|
|
52
44
|
const couponChanged = id != null &&
|
|
@@ -86,19 +78,7 @@ export const saveInvoicingSubscriptionEpic = (actions$, state$, zeniAPI) => acti
|
|
|
86
78
|
status: saved.status,
|
|
87
79
|
}));
|
|
88
80
|
}
|
|
89
|
-
resultActions.push(openSnackbar({
|
|
90
|
-
messageSection: 'invoicing_subscription_saved',
|
|
91
|
-
messageText: 'success',
|
|
92
|
-
type: 'success',
|
|
93
|
-
}));
|
|
94
81
|
return resultActions;
|
|
95
|
-
}), catchError((error) =>
|
|
96
|
-
|
|
97
|
-
JSON.stringify(error))),
|
|
98
|
-
openSnackbar({
|
|
99
|
-
messageSection: 'invoicing_subscription_saved',
|
|
100
|
-
messageText: 'failed',
|
|
101
|
-
type: 'error',
|
|
102
|
-
}),
|
|
103
|
-
])));
|
|
82
|
+
}), catchError((error) => of(submitInvoicingSubscriptionFormFailure(createZeniAPIStatus('Unexpected Error', 'Save subscription REST API call errored out ' +
|
|
83
|
+
JSON.stringify(error))))));
|
|
104
84
|
}));
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { EMPTY,
|
|
1
|
+
import { EMPTY, of } from 'rxjs';
|
|
2
2
|
import { catchError, filter, map, mergeMap } from 'rxjs/operators';
|
|
3
3
|
import { updateAddresses } from '../../../entity/address/addressReducer';
|
|
4
4
|
import { extractInvoicingSubscriptionAddresses, } from '../../../entity/invoicing/invoicingSubscription/invoicingSubscriptionPayload';
|
|
5
5
|
import { updateInvoicingSubscriptions } from '../../../entity/invoicing/invoicingSubscription/invoicingSubscriptionReducer';
|
|
6
|
-
import { openSnackbar } from '../../../entity/snackbar/snackbarReducer';
|
|
7
6
|
import { createZeniAPIStatus, isSuccessResponse, } from '../../../responsePayload';
|
|
8
7
|
import { resetNewAddressDataInLocalStore } from '../../addressView/addressViewReducer';
|
|
9
8
|
import { submitInvoicingSubscriptionFormFailure, submitInvoicingSubscriptionFormSuccess, syncInvoicingSubscriptionCoupons, } from './editInvoicingSubscriptionDetailViewReducer';
|
|
@@ -40,14 +39,7 @@ export const syncInvoicingSubscriptionCouponsEpic = (actions$, _state$, zeniAPI)
|
|
|
40
39
|
: couponMutation$(zeniAPI, baseUrl, subscriptionId, 'remove-coupon', prev);
|
|
41
40
|
return removeStep$.pipe(mergeMap((removeResult) => {
|
|
42
41
|
if (!removeResult.success) {
|
|
43
|
-
return
|
|
44
|
-
submitInvoicingSubscriptionFormFailure(failureStatus(removeResult)),
|
|
45
|
-
openSnackbar({
|
|
46
|
-
messageSection: 'invoicing_subscription_saved',
|
|
47
|
-
messageText: 'failed',
|
|
48
|
-
type: 'error',
|
|
49
|
-
}),
|
|
50
|
-
]);
|
|
42
|
+
return of(submitInvoicingSubscriptionFormFailure(failureStatus(removeResult)));
|
|
51
43
|
}
|
|
52
44
|
const applyStep$ = next === ''
|
|
53
45
|
? of({
|
|
@@ -59,11 +51,6 @@ export const syncInvoicingSubscriptionCouponsEpic = (actions$, _state$, zeniAPI)
|
|
|
59
51
|
if (!applyResult.success) {
|
|
60
52
|
return [
|
|
61
53
|
submitInvoicingSubscriptionFormFailure(failureStatus(applyResult)),
|
|
62
|
-
openSnackbar({
|
|
63
|
-
messageSection: 'invoicing_subscription_saved',
|
|
64
|
-
messageText: 'failed',
|
|
65
|
-
type: 'error',
|
|
66
|
-
}),
|
|
67
54
|
];
|
|
68
55
|
}
|
|
69
56
|
const couponUpdated = applyResult.payload ?? removeResult.payload;
|
|
@@ -71,11 +58,7 @@ export const syncInvoicingSubscriptionCouponsEpic = (actions$, _state$, zeniAPI)
|
|
|
71
58
|
if (couponUpdated != null) {
|
|
72
59
|
resultActions.push(updateInvoicingSubscriptions([couponUpdated], 'merge'), updateAddresses(extractInvoicingSubscriptionAddresses([couponUpdated])));
|
|
73
60
|
}
|
|
74
|
-
resultActions.push(submitInvoicingSubscriptionFormSuccess({ subscriptionId }), resetNewAddressDataInLocalStore(INVOICING_SUBSCRIPTION_SHIPPING_ADDRESS_TYPE)
|
|
75
|
-
messageSection: 'invoicing_subscription_saved',
|
|
76
|
-
messageText: 'success',
|
|
77
|
-
type: 'success',
|
|
78
|
-
}));
|
|
61
|
+
resultActions.push(submitInvoicingSubscriptionFormSuccess({ subscriptionId }), resetNewAddressDataInLocalStore(INVOICING_SUBSCRIPTION_SHIPPING_ADDRESS_TYPE));
|
|
79
62
|
return resultActions;
|
|
80
63
|
}));
|
|
81
64
|
}));
|