@zeniai/client-epic-state 5.2.66 → 5.2.67
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/esm/view/invoicing/createInvoice/createInvoiceEpic.js +9 -1
- package/lib/esm/view/invoicing/editInvoicingCustomerDetailView/editInvoicingCustomerDetailViewReducer.js +5 -1
- package/lib/esm/view/invoicing/editInvoicingSubscriptionDetailView/saveInvoicingSubscriptionEpic.js +5 -1
- package/lib/esm/view/invoicing/invoiceList/invoiceListReducer.js +8 -1
- package/lib/view/invoicing/createInvoice/createInvoiceEpic.d.ts +3 -2
- package/lib/view/invoicing/createInvoice/createInvoiceEpic.js +8 -0
- package/lib/view/invoicing/editInvoicingCustomerDetailView/editInvoicingCustomerDetailViewReducer.d.ts +3 -1
- package/lib/view/invoicing/editInvoicingCustomerDetailView/editInvoicingCustomerDetailViewReducer.js +6 -2
- package/lib/view/invoicing/editInvoicingSubscriptionDetailView/saveInvoicingSubscriptionEpic.d.ts +3 -1
- package/lib/view/invoicing/editInvoicingSubscriptionDetailView/saveInvoicingSubscriptionEpic.js +5 -1
- package/lib/view/invoicing/invoiceList/invoiceListReducer.d.ts +3 -1
- package/lib/view/invoicing/invoiceList/invoiceListReducer.js +9 -2
- package/package.json +1 -1
|
@@ -6,7 +6,8 @@ import { updateInvoices } from '../../../entity/invoicing/invoice/invoiceReducer
|
|
|
6
6
|
import { apiErrorSnackbarVariables } from '../../../entity/snackbar/snackbarApiError';
|
|
7
7
|
import { openSnackbar } from '../../../entity/snackbar/snackbarReducer';
|
|
8
8
|
import { createZeniAPIStatus, isSuccessResponse } from '../../../responsePayload';
|
|
9
|
-
import {
|
|
9
|
+
import { invalidateInvoicingCustomerDetail } from '../editInvoicingCustomerDetailView/editInvoicingCustomerDetailViewReducer';
|
|
10
|
+
import { addInvoiceToList, invalidateInvoiceListForCustomer, } from '../invoiceList/invoiceListReducer';
|
|
10
11
|
import { createInvoice, createInvoiceFailure, createInvoiceSuccess, } from './createInvoiceReducer';
|
|
11
12
|
export const createInvoiceEpic = (actions$, _state$, zeniAPI) => actions$.pipe(filter(createInvoice.match), mergeMap((action) => {
|
|
12
13
|
const apiUrl = `${zeniAPI.apiEndPoints.invoicingMicroServiceBaseUrl}/1.0/invoices`;
|
|
@@ -23,6 +24,13 @@ export const createInvoiceEpic = (actions$, _state$, zeniAPI) => actions$.pipe(f
|
|
|
23
24
|
id: response.data.id,
|
|
24
25
|
status: response.data.status,
|
|
25
26
|
}),
|
|
27
|
+
// The customer's page caches their invoices and totals.
|
|
28
|
+
invalidateInvoicingCustomerDetail({
|
|
29
|
+
id: response.data.customer_id,
|
|
30
|
+
}),
|
|
31
|
+
invalidateInvoiceListForCustomer({
|
|
32
|
+
customerId: response.data.customer_id,
|
|
33
|
+
}),
|
|
26
34
|
createInvoiceSuccess({ invoiceId: response.data.id }),
|
|
27
35
|
openSnackbar({
|
|
28
36
|
messageSection: 'invoicing_invoice_saved',
|
|
@@ -95,6 +95,10 @@ const editInvoicingCustomerDetailView = createSlice({
|
|
|
95
95
|
error: undefined,
|
|
96
96
|
};
|
|
97
97
|
},
|
|
98
|
+
// Makes the page epic refetch a record that changed server-side (e.g. a new subscription).
|
|
99
|
+
invalidateInvoicingCustomerDetail(draft, action) {
|
|
100
|
+
delete draft.recordStateById[action.payload.id];
|
|
101
|
+
},
|
|
98
102
|
fetchInvoicingCustomerDetail(draft, action) {
|
|
99
103
|
draft.recordStateById[action.payload.id] = {
|
|
100
104
|
fetchState: 'In-Progress',
|
|
@@ -198,5 +202,5 @@ const editInvoicingCustomerDetailView = createSlice({
|
|
|
198
202
|
});
|
|
199
203
|
},
|
|
200
204
|
});
|
|
201
|
-
export const { fetchInvoicingPaymentLinkEmailPreview, fetchInvoicingPaymentLinkEmailPreviewPage, updateInvoicingPaymentLinkEmailPreview, updateInvoicingPaymentLinkEmailPreviewFailure, addPromotionalCreditsFailure, addPromotionalCreditsSuccess, fetchInvoicingCustomerDetail, fetchInvoicingCustomerDetailPage, seedInvoicingCustomerFormDraft, updateInvoicingCustomerDetail, resetPromotionalCreditAction, submitAddPromotionalCredits, updateInvoicingCustomerDetailFailure, updateInvoicingCustomerFormDraft, submitInvoicingCustomerForm, submitInvoicingCustomerFormSuccess, submitInvoicingCustomerFormFailure, resetEditInvoicingCustomerDetailView, initializeInvoicingCustomerAddress, claimInvoicingCustomerBillingAddress, } = editInvoicingCustomerDetailView.actions;
|
|
205
|
+
export const { fetchInvoicingPaymentLinkEmailPreview, fetchInvoicingPaymentLinkEmailPreviewPage, updateInvoicingPaymentLinkEmailPreview, updateInvoicingPaymentLinkEmailPreviewFailure, addPromotionalCreditsFailure, addPromotionalCreditsSuccess, fetchInvoicingCustomerDetail, fetchInvoicingCustomerDetailPage, invalidateInvoicingCustomerDetail, seedInvoicingCustomerFormDraft, updateInvoicingCustomerDetail, resetPromotionalCreditAction, submitAddPromotionalCredits, updateInvoicingCustomerDetailFailure, updateInvoicingCustomerFormDraft, submitInvoicingCustomerForm, submitInvoicingCustomerFormSuccess, submitInvoicingCustomerFormFailure, resetEditInvoicingCustomerDetailView, initializeInvoicingCustomerAddress, claimInvoicingCustomerBillingAddress, } = editInvoicingCustomerDetailView.actions;
|
|
202
206
|
export default editInvoicingCustomerDetailView.reducer;
|
package/lib/esm/view/invoicing/editInvoicingSubscriptionDetailView/saveInvoicingSubscriptionEpic.js
CHANGED
|
@@ -7,6 +7,8 @@ import { apiErrorSnackbarVariables } from '../../../entity/snackbar/snackbarApiE
|
|
|
7
7
|
import { openSnackbar } from '../../../entity/snackbar/snackbarReducer';
|
|
8
8
|
import { createZeniAPIStatus, isSuccessResponse } from '../../../responsePayload';
|
|
9
9
|
import { resetNewAddressDataInLocalStore } from '../../addressView/addressViewReducer';
|
|
10
|
+
import { invalidateInvoicingCustomerDetail } from '../editInvoicingCustomerDetailView/editInvoicingCustomerDetailViewReducer';
|
|
11
|
+
import { invalidateInvoiceListForCustomer } from '../invoiceList/invoiceListReducer';
|
|
10
12
|
import { addInvoicingSubscriptionToList } from '../invoicingSubscriptionListView/invoicingSubscriptionListViewReducer';
|
|
11
13
|
import { localDataToSaveInvoicingSubscriptionPayload, } from './editInvoicingSubscriptionDetailViewPayload';
|
|
12
14
|
import { submitInvoicingSubscriptionForm, submitInvoicingSubscriptionFormFailure, submitInvoicingSubscriptionFormSuccess, syncInvoicingSubscriptionCoupons, } from './editInvoicingSubscriptionDetailViewReducer';
|
|
@@ -86,7 +88,9 @@ export const saveInvoicingSubscriptionEpic = (actions$, state$, zeniAPI) => acti
|
|
|
86
88
|
resultActions.push(addInvoicingSubscriptionToList({
|
|
87
89
|
id: saved.id,
|
|
88
90
|
status: saved.status,
|
|
89
|
-
})
|
|
91
|
+
}),
|
|
92
|
+
// The service may bill the first invoice on create.
|
|
93
|
+
invalidateInvoicingCustomerDetail({ id: saved.customer_id }), invalidateInvoiceListForCustomer({ customerId: saved.customer_id }));
|
|
90
94
|
}
|
|
91
95
|
resultActions.push(openSnackbar({
|
|
92
96
|
messageSection: 'invoicing_subscription_saved',
|
|
@@ -124,6 +124,13 @@ const invoiceList = createSlice({
|
|
|
124
124
|
draft.kpisFetchState.fetchState = 'Error';
|
|
125
125
|
draft.kpisFetchState.error = action.payload;
|
|
126
126
|
},
|
|
127
|
+
// Counts are fetched under the same customer filter, so they go stale with the tabs.
|
|
128
|
+
invalidateInvoiceListForCustomer(draft, action) {
|
|
129
|
+
if (draft.filters.customerId === action.payload.customerId) {
|
|
130
|
+
draft.invoiceByTab = makeInvoiceByTab();
|
|
131
|
+
draft.countsFetchState = { fetchState: 'Not-Started', error: undefined };
|
|
132
|
+
}
|
|
133
|
+
},
|
|
127
134
|
updateInvoiceListFilters(draft, action) {
|
|
128
135
|
draft.filters = action.payload;
|
|
129
136
|
},
|
|
@@ -166,5 +173,5 @@ const invoiceList = createSlice({
|
|
|
166
173
|
});
|
|
167
174
|
},
|
|
168
175
|
});
|
|
169
|
-
export const { fetchInvoiceList, fetchInvoiceListPage, updateInvoiceList, updateInvoiceListFailure, fetchInvoiceCounts, updateInvoiceCounts, updateInvoiceCountsFailure, fetchInvoiceKPIs, updateInvoiceKPIs, updateInvoiceKPIsFailure, updateInvoiceListFilters, setInvoiceActiveTab, addInvoiceToList, } = invoiceList.actions;
|
|
176
|
+
export const { fetchInvoiceList, fetchInvoiceListPage, updateInvoiceList, updateInvoiceListFailure, fetchInvoiceCounts, updateInvoiceCounts, updateInvoiceCountsFailure, fetchInvoiceKPIs, updateInvoiceKPIs, updateInvoiceKPIsFailure, updateInvoiceListFilters, setInvoiceActiveTab, addInvoiceToList, invalidateInvoiceListForCustomer, } = invoiceList.actions;
|
|
170
177
|
export default invoiceList.reducer;
|
|
@@ -5,7 +5,8 @@ import { updateInvoices } from '../../../entity/invoicing/invoice/invoiceReducer
|
|
|
5
5
|
import { openSnackbar } from '../../../entity/snackbar/snackbarReducer';
|
|
6
6
|
import { RootState } from '../../../rootStateTypes';
|
|
7
7
|
import { ZeniAPI } from '../../../zeniAPI';
|
|
8
|
-
import {
|
|
8
|
+
import { invalidateInvoicingCustomerDetail } from '../editInvoicingCustomerDetailView/editInvoicingCustomerDetailViewReducer';
|
|
9
|
+
import { addInvoiceToList, invalidateInvoiceListForCustomer } from '../invoiceList/invoiceListReducer';
|
|
9
10
|
import { createInvoice, createInvoiceFailure, createInvoiceSuccess } from './createInvoiceReducer';
|
|
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>;
|
|
11
|
+
export type ActionType = ReturnType<typeof createInvoice> | ReturnType<typeof createInvoiceSuccess> | ReturnType<typeof createInvoiceFailure> | ReturnType<typeof updateAddresses> | ReturnType<typeof updateInvoices> | ReturnType<typeof addInvoiceToList> | ReturnType<typeof invalidateInvoicingCustomerDetail> | ReturnType<typeof invalidateInvoiceListForCustomer> | ReturnType<typeof openSnackbar>;
|
|
11
12
|
export declare const createInvoiceEpic: (actions$: ActionsObservable<ActionType>, _state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
|
|
@@ -9,6 +9,7 @@ const invoiceReducer_1 = require("../../../entity/invoicing/invoice/invoiceReduc
|
|
|
9
9
|
const snackbarApiError_1 = require("../../../entity/snackbar/snackbarApiError");
|
|
10
10
|
const snackbarReducer_1 = require("../../../entity/snackbar/snackbarReducer");
|
|
11
11
|
const responsePayload_1 = require("../../../responsePayload");
|
|
12
|
+
const editInvoicingCustomerDetailViewReducer_1 = require("../editInvoicingCustomerDetailView/editInvoicingCustomerDetailViewReducer");
|
|
12
13
|
const invoiceListReducer_1 = require("../invoiceList/invoiceListReducer");
|
|
13
14
|
const createInvoiceReducer_1 = require("./createInvoiceReducer");
|
|
14
15
|
const createInvoiceEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(createInvoiceReducer_1.createInvoice.match), (0, operators_1.mergeMap)((action) => {
|
|
@@ -26,6 +27,13 @@ const createInvoiceEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, oper
|
|
|
26
27
|
id: response.data.id,
|
|
27
28
|
status: response.data.status,
|
|
28
29
|
}),
|
|
30
|
+
// The customer's page caches their invoices and totals.
|
|
31
|
+
(0, editInvoicingCustomerDetailViewReducer_1.invalidateInvoicingCustomerDetail)({
|
|
32
|
+
id: response.data.customer_id,
|
|
33
|
+
}),
|
|
34
|
+
(0, invoiceListReducer_1.invalidateInvoiceListForCustomer)({
|
|
35
|
+
customerId: response.data.customer_id,
|
|
36
|
+
}),
|
|
29
37
|
(0, createInvoiceReducer_1.createInvoiceSuccess)({ invoiceId: response.data.id }),
|
|
30
38
|
(0, snackbarReducer_1.openSnackbar)({
|
|
31
39
|
messageSection: 'invoicing_invoice_saved',
|
|
@@ -44,7 +44,9 @@ export declare const fetchInvoicingPaymentLinkEmailPreview: import("@reduxjs/too
|
|
|
44
44
|
}], {
|
|
45
45
|
cacheOverride: boolean;
|
|
46
46
|
id: string;
|
|
47
|
-
}, "editInvoicingCustomerDetailView/fetchInvoicingCustomerDetailPage", never, never>,
|
|
47
|
+
}, "editInvoicingCustomerDetailView/fetchInvoicingCustomerDetailPage", never, never>, invalidateInvoicingCustomerDetail: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
48
|
+
id: ID;
|
|
49
|
+
}, "editInvoicingCustomerDetailView/invalidateInvoicingCustomerDetail">, seedInvoicingCustomerFormDraft: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
48
50
|
id: ID;
|
|
49
51
|
localData: InvoicingCustomerFormLocalData;
|
|
50
52
|
}, "editInvoicingCustomerDetailView/seedInvoicingCustomerFormDraft">, updateInvoicingCustomerDetail: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
package/lib/view/invoicing/editInvoicingCustomerDetailView/editInvoicingCustomerDetailViewReducer.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var _a;
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.claimInvoicingCustomerBillingAddress = exports.initializeInvoicingCustomerAddress = exports.resetEditInvoicingCustomerDetailView = exports.submitInvoicingCustomerFormFailure = exports.submitInvoicingCustomerFormSuccess = exports.submitInvoicingCustomerForm = exports.updateInvoicingCustomerFormDraft = exports.updateInvoicingCustomerDetailFailure = exports.submitAddPromotionalCredits = exports.resetPromotionalCreditAction = exports.updateInvoicingCustomerDetail = exports.seedInvoicingCustomerFormDraft = exports.fetchInvoicingCustomerDetailPage = exports.fetchInvoicingCustomerDetail = exports.addPromotionalCreditsSuccess = exports.addPromotionalCreditsFailure = exports.updateInvoicingPaymentLinkEmailPreviewFailure = exports.updateInvoicingPaymentLinkEmailPreview = exports.fetchInvoicingPaymentLinkEmailPreviewPage = exports.fetchInvoicingPaymentLinkEmailPreview = exports.initialState = void 0;
|
|
4
|
+
exports.claimInvoicingCustomerBillingAddress = exports.initializeInvoicingCustomerAddress = exports.resetEditInvoicingCustomerDetailView = exports.submitInvoicingCustomerFormFailure = exports.submitInvoicingCustomerFormSuccess = exports.submitInvoicingCustomerForm = exports.updateInvoicingCustomerFormDraft = exports.updateInvoicingCustomerDetailFailure = exports.submitAddPromotionalCredits = exports.resetPromotionalCreditAction = exports.updateInvoicingCustomerDetail = exports.seedInvoicingCustomerFormDraft = exports.invalidateInvoicingCustomerDetail = exports.fetchInvoicingCustomerDetailPage = exports.fetchInvoicingCustomerDetail = exports.addPromotionalCreditsSuccess = exports.addPromotionalCreditsFailure = exports.updateInvoicingPaymentLinkEmailPreviewFailure = exports.updateInvoicingPaymentLinkEmailPreview = exports.fetchInvoicingPaymentLinkEmailPreviewPage = exports.fetchInvoicingPaymentLinkEmailPreview = exports.initialState = void 0;
|
|
5
5
|
const toolkit_1 = require("@reduxjs/toolkit");
|
|
6
6
|
const rootActions_1 = require("../../../rootActions");
|
|
7
7
|
const invoicingFormDraft_1 = require("../invoicingFormDraft");
|
|
@@ -99,6 +99,10 @@ const editInvoicingCustomerDetailView = (0, toolkit_1.createSlice)({
|
|
|
99
99
|
error: undefined,
|
|
100
100
|
};
|
|
101
101
|
},
|
|
102
|
+
// Makes the page epic refetch a record that changed server-side (e.g. a new subscription).
|
|
103
|
+
invalidateInvoicingCustomerDetail(draft, action) {
|
|
104
|
+
delete draft.recordStateById[action.payload.id];
|
|
105
|
+
},
|
|
102
106
|
fetchInvoicingCustomerDetail(draft, action) {
|
|
103
107
|
draft.recordStateById[action.payload.id] = {
|
|
104
108
|
fetchState: 'In-Progress',
|
|
@@ -202,5 +206,5 @@ const editInvoicingCustomerDetailView = (0, toolkit_1.createSlice)({
|
|
|
202
206
|
});
|
|
203
207
|
},
|
|
204
208
|
});
|
|
205
|
-
_a = editInvoicingCustomerDetailView.actions, exports.fetchInvoicingPaymentLinkEmailPreview = _a.fetchInvoicingPaymentLinkEmailPreview, exports.fetchInvoicingPaymentLinkEmailPreviewPage = _a.fetchInvoicingPaymentLinkEmailPreviewPage, exports.updateInvoicingPaymentLinkEmailPreview = _a.updateInvoicingPaymentLinkEmailPreview, exports.updateInvoicingPaymentLinkEmailPreviewFailure = _a.updateInvoicingPaymentLinkEmailPreviewFailure, exports.addPromotionalCreditsFailure = _a.addPromotionalCreditsFailure, exports.addPromotionalCreditsSuccess = _a.addPromotionalCreditsSuccess, exports.fetchInvoicingCustomerDetail = _a.fetchInvoicingCustomerDetail, exports.fetchInvoicingCustomerDetailPage = _a.fetchInvoicingCustomerDetailPage, exports.seedInvoicingCustomerFormDraft = _a.seedInvoicingCustomerFormDraft, exports.updateInvoicingCustomerDetail = _a.updateInvoicingCustomerDetail, exports.resetPromotionalCreditAction = _a.resetPromotionalCreditAction, exports.submitAddPromotionalCredits = _a.submitAddPromotionalCredits, exports.updateInvoicingCustomerDetailFailure = _a.updateInvoicingCustomerDetailFailure, exports.updateInvoicingCustomerFormDraft = _a.updateInvoicingCustomerFormDraft, exports.submitInvoicingCustomerForm = _a.submitInvoicingCustomerForm, exports.submitInvoicingCustomerFormSuccess = _a.submitInvoicingCustomerFormSuccess, exports.submitInvoicingCustomerFormFailure = _a.submitInvoicingCustomerFormFailure, exports.resetEditInvoicingCustomerDetailView = _a.resetEditInvoicingCustomerDetailView, exports.initializeInvoicingCustomerAddress = _a.initializeInvoicingCustomerAddress, exports.claimInvoicingCustomerBillingAddress = _a.claimInvoicingCustomerBillingAddress;
|
|
209
|
+
_a = editInvoicingCustomerDetailView.actions, exports.fetchInvoicingPaymentLinkEmailPreview = _a.fetchInvoicingPaymentLinkEmailPreview, exports.fetchInvoicingPaymentLinkEmailPreviewPage = _a.fetchInvoicingPaymentLinkEmailPreviewPage, exports.updateInvoicingPaymentLinkEmailPreview = _a.updateInvoicingPaymentLinkEmailPreview, exports.updateInvoicingPaymentLinkEmailPreviewFailure = _a.updateInvoicingPaymentLinkEmailPreviewFailure, exports.addPromotionalCreditsFailure = _a.addPromotionalCreditsFailure, exports.addPromotionalCreditsSuccess = _a.addPromotionalCreditsSuccess, exports.fetchInvoicingCustomerDetail = _a.fetchInvoicingCustomerDetail, exports.fetchInvoicingCustomerDetailPage = _a.fetchInvoicingCustomerDetailPage, exports.invalidateInvoicingCustomerDetail = _a.invalidateInvoicingCustomerDetail, exports.seedInvoicingCustomerFormDraft = _a.seedInvoicingCustomerFormDraft, exports.updateInvoicingCustomerDetail = _a.updateInvoicingCustomerDetail, exports.resetPromotionalCreditAction = _a.resetPromotionalCreditAction, exports.submitAddPromotionalCredits = _a.submitAddPromotionalCredits, exports.updateInvoicingCustomerDetailFailure = _a.updateInvoicingCustomerDetailFailure, exports.updateInvoicingCustomerFormDraft = _a.updateInvoicingCustomerFormDraft, exports.submitInvoicingCustomerForm = _a.submitInvoicingCustomerForm, exports.submitInvoicingCustomerFormSuccess = _a.submitInvoicingCustomerFormSuccess, exports.submitInvoicingCustomerFormFailure = _a.submitInvoicingCustomerFormFailure, exports.resetEditInvoicingCustomerDetailView = _a.resetEditInvoicingCustomerDetailView, exports.initializeInvoicingCustomerAddress = _a.initializeInvoicingCustomerAddress, exports.claimInvoicingCustomerBillingAddress = _a.claimInvoicingCustomerBillingAddress;
|
|
206
210
|
exports.default = editInvoicingCustomerDetailView.reducer;
|
package/lib/view/invoicing/editInvoicingSubscriptionDetailView/saveInvoicingSubscriptionEpic.d.ts
CHANGED
|
@@ -6,7 +6,9 @@ import { openSnackbar } from '../../../entity/snackbar/snackbarReducer';
|
|
|
6
6
|
import { RootState } from '../../../rootStateTypes';
|
|
7
7
|
import { ZeniAPI } from '../../../zeniAPI';
|
|
8
8
|
import { resetNewAddressDataInLocalStore } from '../../addressView/addressViewReducer';
|
|
9
|
+
import { invalidateInvoicingCustomerDetail } from '../editInvoicingCustomerDetailView/editInvoicingCustomerDetailViewReducer';
|
|
10
|
+
import { invalidateInvoiceListForCustomer } from '../invoiceList/invoiceListReducer';
|
|
9
11
|
import { addInvoicingSubscriptionToList } from '../invoicingSubscriptionListView/invoicingSubscriptionListViewReducer';
|
|
10
12
|
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> | ReturnType<typeof openSnackbar>;
|
|
13
|
+
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 invalidateInvoicingCustomerDetail> | ReturnType<typeof invalidateInvoiceListForCustomer> | ReturnType<typeof openSnackbar>;
|
|
12
14
|
export declare const saveInvoicingSubscriptionEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
|
package/lib/view/invoicing/editInvoicingSubscriptionDetailView/saveInvoicingSubscriptionEpic.js
CHANGED
|
@@ -10,6 +10,8 @@ const snackbarApiError_1 = require("../../../entity/snackbar/snackbarApiError");
|
|
|
10
10
|
const snackbarReducer_1 = require("../../../entity/snackbar/snackbarReducer");
|
|
11
11
|
const responsePayload_1 = require("../../../responsePayload");
|
|
12
12
|
const addressViewReducer_1 = require("../../addressView/addressViewReducer");
|
|
13
|
+
const editInvoicingCustomerDetailViewReducer_1 = require("../editInvoicingCustomerDetailView/editInvoicingCustomerDetailViewReducer");
|
|
14
|
+
const invoiceListReducer_1 = require("../invoiceList/invoiceListReducer");
|
|
13
15
|
const invoicingSubscriptionListViewReducer_1 = require("../invoicingSubscriptionListView/invoicingSubscriptionListViewReducer");
|
|
14
16
|
const editInvoicingSubscriptionDetailViewPayload_1 = require("./editInvoicingSubscriptionDetailViewPayload");
|
|
15
17
|
const editInvoicingSubscriptionDetailViewReducer_1 = require("./editInvoicingSubscriptionDetailViewReducer");
|
|
@@ -89,7 +91,9 @@ const saveInvoicingSubscriptionEpic = (actions$, state$, zeniAPI) => actions$.pi
|
|
|
89
91
|
resultActions.push((0, invoicingSubscriptionListViewReducer_1.addInvoicingSubscriptionToList)({
|
|
90
92
|
id: saved.id,
|
|
91
93
|
status: saved.status,
|
|
92
|
-
})
|
|
94
|
+
}),
|
|
95
|
+
// The service may bill the first invoice on create.
|
|
96
|
+
(0, editInvoicingCustomerDetailViewReducer_1.invalidateInvoicingCustomerDetail)({ id: saved.customer_id }), (0, invoiceListReducer_1.invalidateInvoiceListForCustomer)({ customerId: saved.customer_id }));
|
|
93
97
|
}
|
|
94
98
|
resultActions.push((0, snackbarReducer_1.openSnackbar)({
|
|
95
99
|
messageSection: 'invoicing_subscription_saved',
|
|
@@ -45,6 +45,8 @@ export declare const fetchInvoiceList: import("@reduxjs/toolkit").ActionCreatorW
|
|
|
45
45
|
}, "invoicingInvoiceList/updateInvoiceList">, updateInvoiceListFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<ZeniAPIStatus<Record<string, unknown>>, "invoicingInvoiceList/updateInvoiceListFailure">, fetchInvoiceCounts: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"invoicingInvoiceList/fetchInvoiceCounts">, updateInvoiceCounts: import("@reduxjs/toolkit").ActionCreatorWithPayload<InvoicingListCounts, "invoicingInvoiceList/updateInvoiceCounts">, updateInvoiceCountsFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<ZeniAPIStatus<Record<string, unknown>>, "invoicingInvoiceList/updateInvoiceCountsFailure">, fetchInvoiceKPIs: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"invoicingInvoiceList/fetchInvoiceKPIs">, updateInvoiceKPIs: import("@reduxjs/toolkit").ActionCreatorWithPayload<InvoicingInvoiceKPIs, "invoicingInvoiceList/updateInvoiceKPIs">, updateInvoiceKPIsFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<ZeniAPIStatus<Record<string, unknown>>, "invoicingInvoiceList/updateInvoiceKPIsFailure">, updateInvoiceListFilters: import("@reduxjs/toolkit").ActionCreatorWithPayload<InvoiceListFilters, "invoicingInvoiceList/updateInvoiceListFilters">, setInvoiceActiveTab: import("@reduxjs/toolkit").ActionCreatorWithPayload<"paid" | "voided" | "partially_paid" | "payment_due" | "not_paid" | "all", "invoicingInvoiceList/setInvoiceActiveTab">, addInvoiceToList: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
46
46
|
id: ID;
|
|
47
47
|
status: InvoicingInvoiceStatus;
|
|
48
|
-
}, "invoicingInvoiceList/addInvoiceToList"
|
|
48
|
+
}, "invoicingInvoiceList/addInvoiceToList">, invalidateInvoiceListForCustomer: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
49
|
+
customerId: ID;
|
|
50
|
+
}, "invoicingInvoiceList/invalidateInvoiceListForCustomer">;
|
|
49
51
|
declare const _default: import("redux").Reducer<InvoiceListState>;
|
|
50
52
|
export default _default;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var _a;
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.addInvoiceToList = exports.setInvoiceActiveTab = exports.updateInvoiceListFilters = exports.updateInvoiceKPIsFailure = exports.updateInvoiceKPIs = exports.fetchInvoiceKPIs = exports.updateInvoiceCountsFailure = exports.updateInvoiceCounts = exports.fetchInvoiceCounts = exports.updateInvoiceListFailure = exports.updateInvoiceList = exports.fetchInvoiceListPage = exports.fetchInvoiceList = exports.initialState = exports.sameInvoiceListQuery = void 0;
|
|
4
|
+
exports.invalidateInvoiceListForCustomer = exports.addInvoiceToList = exports.setInvoiceActiveTab = exports.updateInvoiceListFilters = exports.updateInvoiceKPIsFailure = exports.updateInvoiceKPIs = exports.fetchInvoiceKPIs = exports.updateInvoiceCountsFailure = exports.updateInvoiceCounts = exports.fetchInvoiceCounts = exports.updateInvoiceListFailure = exports.updateInvoiceList = exports.fetchInvoiceListPage = exports.fetchInvoiceList = exports.initialState = exports.sameInvoiceListQuery = void 0;
|
|
5
5
|
const toolkit_1 = require("@reduxjs/toolkit");
|
|
6
6
|
const rootActions_1 = require("../../../rootActions");
|
|
7
7
|
const invoiceListState_1 = require("./invoiceListState");
|
|
@@ -129,6 +129,13 @@ const invoiceList = (0, toolkit_1.createSlice)({
|
|
|
129
129
|
draft.kpisFetchState.fetchState = 'Error';
|
|
130
130
|
draft.kpisFetchState.error = action.payload;
|
|
131
131
|
},
|
|
132
|
+
// Counts are fetched under the same customer filter, so they go stale with the tabs.
|
|
133
|
+
invalidateInvoiceListForCustomer(draft, action) {
|
|
134
|
+
if (draft.filters.customerId === action.payload.customerId) {
|
|
135
|
+
draft.invoiceByTab = (0, invoiceListState_1.makeInvoiceByTab)();
|
|
136
|
+
draft.countsFetchState = { fetchState: 'Not-Started', error: undefined };
|
|
137
|
+
}
|
|
138
|
+
},
|
|
132
139
|
updateInvoiceListFilters(draft, action) {
|
|
133
140
|
draft.filters = action.payload;
|
|
134
141
|
},
|
|
@@ -171,5 +178,5 @@ const invoiceList = (0, toolkit_1.createSlice)({
|
|
|
171
178
|
});
|
|
172
179
|
},
|
|
173
180
|
});
|
|
174
|
-
_a = invoiceList.actions, exports.fetchInvoiceList = _a.fetchInvoiceList, exports.fetchInvoiceListPage = _a.fetchInvoiceListPage, exports.updateInvoiceList = _a.updateInvoiceList, exports.updateInvoiceListFailure = _a.updateInvoiceListFailure, exports.fetchInvoiceCounts = _a.fetchInvoiceCounts, exports.updateInvoiceCounts = _a.updateInvoiceCounts, exports.updateInvoiceCountsFailure = _a.updateInvoiceCountsFailure, exports.fetchInvoiceKPIs = _a.fetchInvoiceKPIs, exports.updateInvoiceKPIs = _a.updateInvoiceKPIs, exports.updateInvoiceKPIsFailure = _a.updateInvoiceKPIsFailure, exports.updateInvoiceListFilters = _a.updateInvoiceListFilters, exports.setInvoiceActiveTab = _a.setInvoiceActiveTab, exports.addInvoiceToList = _a.addInvoiceToList;
|
|
181
|
+
_a = invoiceList.actions, exports.fetchInvoiceList = _a.fetchInvoiceList, exports.fetchInvoiceListPage = _a.fetchInvoiceListPage, exports.updateInvoiceList = _a.updateInvoiceList, exports.updateInvoiceListFailure = _a.updateInvoiceListFailure, exports.fetchInvoiceCounts = _a.fetchInvoiceCounts, exports.updateInvoiceCounts = _a.updateInvoiceCounts, exports.updateInvoiceCountsFailure = _a.updateInvoiceCountsFailure, exports.fetchInvoiceKPIs = _a.fetchInvoiceKPIs, exports.updateInvoiceKPIs = _a.updateInvoiceKPIs, exports.updateInvoiceKPIsFailure = _a.updateInvoiceKPIsFailure, exports.updateInvoiceListFilters = _a.updateInvoiceListFilters, exports.setInvoiceActiveTab = _a.setInvoiceActiveTab, exports.addInvoiceToList = _a.addInvoiceToList, exports.invalidateInvoiceListForCustomer = _a.invalidateInvoiceListForCustomer;
|
|
175
182
|
exports.default = invoiceList.reducer;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zeniai/client-epic-state",
|
|
3
|
-
"version": "5.2.
|
|
3
|
+
"version": "5.2.67",
|
|
4
4
|
"description": "Shared module between Web & Mobile containing required abstractions for state management, async network communication. ",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "lib/esm/index.js",
|