@zeniai/client-epic-state 5.1.69 → 5.1.70
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/index.js +7 -7
- package/lib/esm/view/invoicing/couponView/couponViewEpics.js +0 -3
- package/lib/esm/view/invoicing/couponView/couponViewReducer.js +7 -1
- package/lib/esm/view/invoicing/couponView/couponViewSelector.js +27 -14
- package/lib/esm/view/invoicing/invoiceList/fetchInvoiceListEpic.js +7 -5
- package/lib/esm/view/invoicing/invoiceList/fetchInvoiceListPageEpic.js +2 -1
- package/lib/esm/view/invoicing/invoiceList/invoiceListReducer.js +62 -36
- package/lib/esm/view/invoicing/invoiceList/invoiceListSelector.js +19 -15
- package/lib/esm/view/invoicing/invoiceList/invoiceListState.js +10 -0
- package/lib/esm/view/invoicing/invoicingCreditNoteListView/epics/fetchInvoicingCreditNoteListEpic.js +0 -3
- package/lib/esm/view/invoicing/invoicingCreditNoteListView/invoicingCreditNoteListViewReducer.js +7 -1
- package/lib/esm/view/invoicing/invoicingCreditNoteListView/invoicingCreditNoteListViewSelector.js +23 -13
- package/lib/esm/view/invoicing/invoicingCustomerDetailView/fetchInvoicingCustomerDetailPageEpic.js +3 -2
- package/lib/esm/view/invoicing/invoicingCustomerDetailView/invoicingCustomerDetailViewSelector.js +1 -1
- package/lib/esm/view/invoicing/invoicingCustomerListView/epics/fetchInvoicingCustomerListEpic.js +0 -3
- package/lib/esm/view/invoicing/invoicingCustomerListView/invoicingCustomerListViewReducer.js +7 -1
- package/lib/esm/view/invoicing/invoicingCustomerListView/invoicingCustomerListViewSelector.js +25 -12
- package/lib/esm/view/invoicing/invoicingDunningCaseListView/epics/fetchInvoicingDunningCaseListEpic.js +0 -3
- package/lib/esm/view/invoicing/invoicingDunningCaseListView/invoicingDunningCaseListViewReducer.js +7 -1
- package/lib/esm/view/invoicing/invoicingDunningCaseListView/invoicingDunningCaseListViewSelector.js +23 -13
- package/lib/esm/view/invoicing/invoicingSubscriptionListView/epics/fetchInvoicingSubscriptionListEpic.js +0 -3
- package/lib/esm/view/invoicing/invoicingSubscriptionListView/invoicingSubscriptionListViewReducer.js +7 -1
- package/lib/esm/view/invoicing/invoicingSubscriptionListView/invoicingSubscriptionListViewSelector.js +22 -12
- package/lib/esm/view/invoicing/invoicingTransactionListView/epics/fetchInvoicingTransactionListEpic.js +7 -5
- package/lib/esm/view/invoicing/invoicingTransactionListView/epics/fetchInvoicingTransactionListPageEpic.js +2 -1
- package/lib/esm/view/invoicing/invoicingTransactionListView/invoicingTransactionListViewReducer.js +56 -25
- package/lib/esm/view/invoicing/invoicingTransactionListView/invoicingTransactionListViewSelector.js +15 -11
- package/lib/esm/view/invoicing/invoicingTransactionListView/invoicingTransactionListViewState.js +10 -0
- package/lib/index.d.ts +7 -7
- package/lib/index.js +15 -8
- package/lib/view/invoicing/couponView/couponViewEpics.js +0 -3
- package/lib/view/invoicing/couponView/couponViewReducer.d.ts +1 -1
- package/lib/view/invoicing/couponView/couponViewReducer.js +8 -2
- package/lib/view/invoicing/couponView/couponViewSelector.d.ts +1 -0
- package/lib/view/invoicing/couponView/couponViewSelector.js +27 -14
- package/lib/view/invoicing/couponView/couponViewState.d.ts +2 -1
- package/lib/view/invoicing/invoiceList/fetchInvoiceListEpic.d.ts +1 -1
- package/lib/view/invoicing/invoiceList/fetchInvoiceListEpic.js +7 -5
- package/lib/view/invoicing/invoiceList/fetchInvoiceListPageEpic.js +2 -1
- package/lib/view/invoicing/invoiceList/invoiceListReducer.d.ts +5 -4
- package/lib/view/invoicing/invoiceList/invoiceListReducer.js +63 -37
- package/lib/view/invoicing/invoiceList/invoiceListSelector.d.ts +1 -0
- package/lib/view/invoicing/invoiceList/invoiceListSelector.js +19 -15
- package/lib/view/invoicing/invoiceList/invoiceListState.d.ts +20 -7
- package/lib/view/invoicing/invoiceList/invoiceListState.js +13 -1
- package/lib/view/invoicing/invoicingCreditNoteListView/epics/fetchInvoicingCreditNoteListEpic.js +0 -3
- package/lib/view/invoicing/invoicingCreditNoteListView/invoicingCreditNoteListViewReducer.d.ts +1 -1
- package/lib/view/invoicing/invoicingCreditNoteListView/invoicingCreditNoteListViewReducer.js +8 -2
- package/lib/view/invoicing/invoicingCreditNoteListView/invoicingCreditNoteListViewSelector.d.ts +1 -0
- package/lib/view/invoicing/invoicingCreditNoteListView/invoicingCreditNoteListViewSelector.js +23 -13
- package/lib/view/invoicing/invoicingCreditNoteListView/invoicingCreditNoteListViewState.d.ts +2 -1
- package/lib/view/invoicing/invoicingCustomerDetailView/fetchInvoicingCustomerDetailPageEpic.js +3 -2
- package/lib/view/invoicing/invoicingCustomerDetailView/invoicingCustomerDetailViewSelector.js +1 -1
- package/lib/view/invoicing/invoicingCustomerListView/epics/fetchInvoicingCustomerListEpic.js +0 -3
- package/lib/view/invoicing/invoicingCustomerListView/invoicingCustomerListViewReducer.d.ts +1 -1
- package/lib/view/invoicing/invoicingCustomerListView/invoicingCustomerListViewReducer.js +8 -2
- package/lib/view/invoicing/invoicingCustomerListView/invoicingCustomerListViewSelector.d.ts +1 -0
- package/lib/view/invoicing/invoicingCustomerListView/invoicingCustomerListViewSelector.js +25 -12
- package/lib/view/invoicing/invoicingCustomerListView/invoicingCustomerListViewState.d.ts +2 -1
- package/lib/view/invoicing/invoicingDunningCaseListView/epics/fetchInvoicingDunningCaseListEpic.js +0 -3
- package/lib/view/invoicing/invoicingDunningCaseListView/invoicingDunningCaseListViewReducer.d.ts +1 -1
- package/lib/view/invoicing/invoicingDunningCaseListView/invoicingDunningCaseListViewReducer.js +8 -2
- package/lib/view/invoicing/invoicingDunningCaseListView/invoicingDunningCaseListViewSelector.d.ts +1 -0
- package/lib/view/invoicing/invoicingDunningCaseListView/invoicingDunningCaseListViewSelector.js +23 -13
- package/lib/view/invoicing/invoicingDunningCaseListView/invoicingDunningCaseListViewState.d.ts +2 -1
- package/lib/view/invoicing/invoicingSubscriptionListView/epics/fetchInvoicingSubscriptionListEpic.js +0 -3
- package/lib/view/invoicing/invoicingSubscriptionListView/invoicingSubscriptionListViewReducer.d.ts +1 -1
- package/lib/view/invoicing/invoicingSubscriptionListView/invoicingSubscriptionListViewReducer.js +8 -2
- package/lib/view/invoicing/invoicingSubscriptionListView/invoicingSubscriptionListViewSelector.d.ts +1 -0
- package/lib/view/invoicing/invoicingSubscriptionListView/invoicingSubscriptionListViewSelector.js +22 -12
- package/lib/view/invoicing/invoicingSubscriptionListView/invoicingSubscriptionListViewState.d.ts +3 -1
- package/lib/view/invoicing/invoicingTransactionListView/epics/fetchInvoicingTransactionListEpic.d.ts +1 -1
- package/lib/view/invoicing/invoicingTransactionListView/epics/fetchInvoicingTransactionListEpic.js +7 -5
- package/lib/view/invoicing/invoicingTransactionListView/epics/fetchInvoicingTransactionListPageEpic.js +2 -1
- package/lib/view/invoicing/invoicingTransactionListView/invoicingTransactionListViewReducer.d.ts +1 -1
- package/lib/view/invoicing/invoicingTransactionListView/invoicingTransactionListViewReducer.js +57 -26
- package/lib/view/invoicing/invoicingTransactionListView/invoicingTransactionListViewSelector.d.ts +1 -0
- package/lib/view/invoicing/invoicingTransactionListView/invoicingTransactionListViewSelector.js +15 -11
- package/lib/view/invoicing/invoicingTransactionListView/invoicingTransactionListViewState.d.ts +18 -4
- package/lib/view/invoicing/invoicingTransactionListView/invoicingTransactionListViewState.js +13 -1
- package/package.json +1 -1
package/lib/view/invoicing/invoicingCreditNoteListView/invoicingCreditNoteListViewState.d.ts
CHANGED
|
@@ -4,7 +4,6 @@ import { InvoicingListSort } from '../invoicingApiHelper';
|
|
|
4
4
|
export interface InvoicingCreditNoteFilters {
|
|
5
5
|
customerId?: ID;
|
|
6
6
|
search?: string;
|
|
7
|
-
status?: string;
|
|
8
7
|
}
|
|
9
8
|
export declare const ALL_INVOICING_CREDIT_NOTE_SORT_KEYS: readonly ["credit_note", "customer", "date", "type", "status", "reference_invoice", "utilization", "total"];
|
|
10
9
|
export declare const toInvoicingCreditNoteSortKey: (v: string) => "date" | "status" | "type" | "customer" | "total" | "credit_note" | "reference_invoice" | "utilization";
|
|
@@ -32,6 +31,8 @@ export type InvoicingCreditNoteTabId = ReturnType<typeof toInvoicingCreditNoteTa
|
|
|
32
31
|
*/
|
|
33
32
|
export declare const INVOICING_CREDIT_NOTE_TABS: InvoicingCreditNoteTabId[];
|
|
34
33
|
export interface InvoicingCreditNoteListViewState extends FetchedState {
|
|
34
|
+
/** Selected status tab (CES-owned so it persists across page revisits). */
|
|
35
|
+
activeTab: InvoicingCreditNoteTabId;
|
|
35
36
|
counts: InvoicingListCounts;
|
|
36
37
|
countsFetchState: FetchStateAndError;
|
|
37
38
|
filters: InvoicingCreditNoteFilters;
|
package/lib/view/invoicing/invoicingCustomerDetailView/fetchInvoicingCustomerDetailPageEpic.js
CHANGED
|
@@ -23,6 +23,7 @@ const fetchInvoicingCustomerDetailPageEpic = (actions$, state$) => actions$.pipe
|
|
|
23
23
|
const { cacheOverride, id } = action.payload;
|
|
24
24
|
const customerDetail = state$.value.invoicingCustomerDetailViewState.detailById[id];
|
|
25
25
|
const invoiceListState = state$.value.invoicingInvoiceListState;
|
|
26
|
+
const invoiceListTabState = invoiceListState.invoiceByTab[invoiceListState.activeTab];
|
|
26
27
|
const settingsState = state$.value.invoicingSettingsViewState;
|
|
27
28
|
const pageActions = [];
|
|
28
29
|
if (shouldFetch({
|
|
@@ -36,8 +37,8 @@ const fetchInvoicingCustomerDetailPageEpic = (actions$, state$) => actions$.pipe
|
|
|
36
37
|
const invoiceListIsForCustomer = invoiceListState.filters.customerId === id;
|
|
37
38
|
if (!invoiceListIsForCustomer ||
|
|
38
39
|
shouldFetch({
|
|
39
|
-
fetchState:
|
|
40
|
-
error:
|
|
40
|
+
fetchState: invoiceListTabState.fetchState,
|
|
41
|
+
error: invoiceListTabState.error,
|
|
41
42
|
}, cacheOverride)) {
|
|
42
43
|
pageActions.push((0, invoiceListReducer_1.fetchInvoiceList)({ filters: { customerId: id } }));
|
|
43
44
|
}
|
package/lib/view/invoicing/invoicingCustomerDetailView/invoicingCustomerDetailViewSelector.js
CHANGED
|
@@ -16,7 +16,7 @@ const getInvoicingCustomerDetail = (state, invoicingCustomerID) => {
|
|
|
16
16
|
const settings = (0, settingsViewSelector_1.getInvoicingSettings)(state);
|
|
17
17
|
return {
|
|
18
18
|
invoicingCustomer: (0, invoicingCustomerSelector_1.getInvoicingCustomerById)(invoicingCustomerState, invoicingCustomerID),
|
|
19
|
-
invoices: (0, invoiceSelector_1.getInvoicesByIds)(state.invoicingInvoiceState, state.invoicingInvoiceListState.invoiceIds),
|
|
19
|
+
invoices: (0, invoiceSelector_1.getInvoicesByIds)(state.invoicingInvoiceState, state.invoicingInvoiceListState.invoiceByTab[state.invoicingInvoiceListState.activeTab].invoiceIds),
|
|
20
20
|
setupIntent: (0, customerPaymentMethodSelector_1.getInvoicingSetupIntent)(state),
|
|
21
21
|
setupIntentFetchState: (0, customerPaymentMethodSelector_1.getInvoicingSetupIntentFetchState)(state),
|
|
22
22
|
plaidLinkToken: (0, customerPaymentMethodSelector_1.getInvoicingPlaidLinkToken)(state),
|
package/lib/view/invoicing/invoicingCustomerListView/epics/fetchInvoicingCustomerListEpic.js
CHANGED
|
@@ -14,9 +14,6 @@ const buildQuery = (filters, cursor, sort) => {
|
|
|
14
14
|
if (filters.search != null && filters.search.length > 0) {
|
|
15
15
|
params.set('search', filters.search);
|
|
16
16
|
}
|
|
17
|
-
if (filters.status != null && filters.status.length > 0) {
|
|
18
|
-
params.set('status', filters.status);
|
|
19
|
-
}
|
|
20
17
|
params.set('limit', String(invoicingApiHelper_1.INVOICING_LIST_PAGE_SIZE));
|
|
21
18
|
if (cursor != null) {
|
|
22
19
|
params.set('cursor', cursor);
|
|
@@ -26,7 +26,7 @@ export declare const fetchInvoicingCustomerList: import("@reduxjs/toolkit").Acti
|
|
|
26
26
|
ids: ID[];
|
|
27
27
|
keepExistingListItems: boolean;
|
|
28
28
|
nextCursor: string | null;
|
|
29
|
-
}, "invoicingCustomerListView/updateInvoicingCustomerList">, updateInvoicingCustomerListFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<ZeniAPIStatus<Record<string, unknown>>, "invoicingCustomerListView/updateInvoicingCustomerListFailure">, fetchInvoicingCustomerCounts: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"invoicingCustomerListView/fetchInvoicingCustomerCounts">, updateInvoicingCustomerCounts: import("@reduxjs/toolkit").ActionCreatorWithPayload<InvoicingListCounts, "invoicingCustomerListView/updateInvoicingCustomerCounts">, updateInvoicingCustomerCountsFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<ZeniAPIStatus<Record<string, unknown>>, "invoicingCustomerListView/updateInvoicingCustomerCountsFailure">, updateInvoicingCustomerFilters: import("@reduxjs/toolkit").ActionCreatorWithPayload<InvoicingCustomerFilters, "invoicingCustomerListView/updateInvoicingCustomerFilters">, addInvoicingCustomerToList: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
29
|
+
}, "invoicingCustomerListView/updateInvoicingCustomerList">, updateInvoicingCustomerListFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<ZeniAPIStatus<Record<string, unknown>>, "invoicingCustomerListView/updateInvoicingCustomerListFailure">, fetchInvoicingCustomerCounts: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"invoicingCustomerListView/fetchInvoicingCustomerCounts">, updateInvoicingCustomerCounts: import("@reduxjs/toolkit").ActionCreatorWithPayload<InvoicingListCounts, "invoicingCustomerListView/updateInvoicingCustomerCounts">, updateInvoicingCustomerCountsFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<ZeniAPIStatus<Record<string, unknown>>, "invoicingCustomerListView/updateInvoicingCustomerCountsFailure">, updateInvoicingCustomerFilters: import("@reduxjs/toolkit").ActionCreatorWithPayload<InvoicingCustomerFilters, "invoicingCustomerListView/updateInvoicingCustomerFilters">, setInvoicingCustomerActiveTab: import("@reduxjs/toolkit").ActionCreatorWithPayload<"active" | "at_risk" | "trial" | "all", "invoicingCustomerListView/setInvoicingCustomerActiveTab">, addInvoicingCustomerToList: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
30
30
|
id: ID;
|
|
31
31
|
status?: string;
|
|
32
32
|
}, "invoicingCustomerListView/addInvoicingCustomerToList">, clearInvoicingCustomerListView: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"invoicingCustomerListView/clearInvoicingCustomerListView">;
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var _a;
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.clearInvoicingCustomerListView = exports.addInvoicingCustomerToList = exports.updateInvoicingCustomerFilters = exports.updateInvoicingCustomerCountsFailure = exports.updateInvoicingCustomerCounts = exports.fetchInvoicingCustomerCounts = exports.updateInvoicingCustomerListFailure = exports.updateInvoicingCustomerList = exports.fetchInvoicingCustomerListPage = exports.fetchInvoicingCustomerList = exports.initialState = void 0;
|
|
4
|
+
exports.clearInvoicingCustomerListView = exports.addInvoicingCustomerToList = exports.setInvoicingCustomerActiveTab = exports.updateInvoicingCustomerFilters = exports.updateInvoicingCustomerCountsFailure = exports.updateInvoicingCustomerCounts = exports.fetchInvoicingCustomerCounts = exports.updateInvoicingCustomerListFailure = exports.updateInvoicingCustomerList = exports.fetchInvoicingCustomerListPage = exports.fetchInvoicingCustomerList = exports.initialState = void 0;
|
|
5
5
|
const toolkit_1 = require("@reduxjs/toolkit");
|
|
6
6
|
exports.initialState = {
|
|
7
7
|
fetchState: 'Not-Started',
|
|
8
8
|
error: undefined,
|
|
9
|
+
activeTab: 'all',
|
|
9
10
|
ids: [],
|
|
10
11
|
nextCursor: null,
|
|
11
12
|
filters: {},
|
|
@@ -84,6 +85,11 @@ const invoicingCustomerListView = (0, toolkit_1.createSlice)({
|
|
|
84
85
|
updateInvoicingCustomerFilters(draft, action) {
|
|
85
86
|
draft.filters = action.payload;
|
|
86
87
|
},
|
|
88
|
+
// Select a status tab. The list API ignores `status` (returns all statuses),
|
|
89
|
+
// so the selector filters rows to this tab client-side — no refetch needed.
|
|
90
|
+
setInvoicingCustomerActiveTab(draft, action) {
|
|
91
|
+
draft.activeTab = action.payload;
|
|
92
|
+
},
|
|
87
93
|
// Reflect a newly created customer in the cached list + tab counts so the
|
|
88
94
|
// customer page shows the new row without refetching from the server. The
|
|
89
95
|
// per-status count key mirrors the customer `status` value the counts map
|
|
@@ -105,5 +111,5 @@ const invoicingCustomerListView = (0, toolkit_1.createSlice)({
|
|
|
105
111
|
},
|
|
106
112
|
},
|
|
107
113
|
});
|
|
108
|
-
_a = invoicingCustomerListView.actions, exports.fetchInvoicingCustomerList = _a.fetchInvoicingCustomerList, exports.fetchInvoicingCustomerListPage = _a.fetchInvoicingCustomerListPage, exports.updateInvoicingCustomerList = _a.updateInvoicingCustomerList, exports.updateInvoicingCustomerListFailure = _a.updateInvoicingCustomerListFailure, exports.fetchInvoicingCustomerCounts = _a.fetchInvoicingCustomerCounts, exports.updateInvoicingCustomerCounts = _a.updateInvoicingCustomerCounts, exports.updateInvoicingCustomerCountsFailure = _a.updateInvoicingCustomerCountsFailure, exports.updateInvoicingCustomerFilters = _a.updateInvoicingCustomerFilters, exports.addInvoicingCustomerToList = _a.addInvoicingCustomerToList, exports.clearInvoicingCustomerListView = _a.clearInvoicingCustomerListView;
|
|
114
|
+
_a = invoicingCustomerListView.actions, exports.fetchInvoicingCustomerList = _a.fetchInvoicingCustomerList, exports.fetchInvoicingCustomerListPage = _a.fetchInvoicingCustomerListPage, exports.updateInvoicingCustomerList = _a.updateInvoicingCustomerList, exports.updateInvoicingCustomerListFailure = _a.updateInvoicingCustomerListFailure, exports.fetchInvoicingCustomerCounts = _a.fetchInvoicingCustomerCounts, exports.updateInvoicingCustomerCounts = _a.updateInvoicingCustomerCounts, exports.updateInvoicingCustomerCountsFailure = _a.updateInvoicingCustomerCountsFailure, exports.updateInvoicingCustomerFilters = _a.updateInvoicingCustomerFilters, exports.setInvoicingCustomerActiveTab = _a.setInvoicingCustomerActiveTab, exports.addInvoicingCustomerToList = _a.addInvoicingCustomerToList, exports.clearInvoicingCustomerListView = _a.clearInvoicingCustomerListView;
|
|
109
115
|
exports.default = invoicingCustomerListView.reducer;
|
|
@@ -6,6 +6,7 @@ import { RootState } from '../../../reducer';
|
|
|
6
6
|
import { InvoicingListSort } from '../invoicingApiHelper';
|
|
7
7
|
import { InvoicingCustomerColumnConfig, InvoicingCustomerFilters, InvoicingCustomerTabId } from './invoicingCustomerListViewState';
|
|
8
8
|
export interface InvoicingCustomerListView extends SelectorView {
|
|
9
|
+
activeTab: InvoicingCustomerTabId;
|
|
9
10
|
columns: InvoicingCustomerColumnConfig[];
|
|
10
11
|
count: InvoicingListCounts;
|
|
11
12
|
countsFetchState: FetchStateAndError;
|
|
@@ -10,15 +10,28 @@ const invoicingCustomerListViewState_1 = require("./invoicingCustomerListViewSta
|
|
|
10
10
|
* slice actually change. Without this, the connected list page re-rendered on
|
|
11
11
|
* every unrelated redux action because a fresh array was built each call.
|
|
12
12
|
*/
|
|
13
|
-
exports.getInvoicingCustomerListView = (0, toolkit_1.createSelector)((state) => state.invoicingCustomerState, (state) => state.invoicingCustomerListViewState, (customerState, listViewState) =>
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
13
|
+
exports.getInvoicingCustomerListView = (0, toolkit_1.createSelector)((state) => state.invoicingCustomerState, (state) => state.invoicingCustomerListViewState, (customerState, listViewState) => {
|
|
14
|
+
const { activeTab } = listViewState;
|
|
15
|
+
const allCustomers = (0, invoicingCustomerSelector_1.getInvoicingCustomersByIds)(customerState, listViewState.ids);
|
|
16
|
+
// The list API ignores `status`, so it returns every status; filter to the
|
|
17
|
+
// active tab client-side ('all' shows everything, 'at_risk' keys off the
|
|
18
|
+
// `isAtRisk` flag, the rest match the customer `status`).
|
|
19
|
+
const customers = activeTab === 'all'
|
|
20
|
+
? allCustomers
|
|
21
|
+
: activeTab === 'at_risk'
|
|
22
|
+
? allCustomers.filter((customer) => customer.isAtRisk === true)
|
|
23
|
+
: allCustomers.filter((customer) => customer.status === activeTab);
|
|
24
|
+
return {
|
|
25
|
+
activeTab,
|
|
26
|
+
columns: invoicingCustomerListViewState_1.INVOICING_CUSTOMER_COLUMNS,
|
|
27
|
+
customers,
|
|
28
|
+
fetchState: listViewState.fetchState,
|
|
29
|
+
error: listViewState.error,
|
|
30
|
+
nextCursor: listViewState.nextCursor,
|
|
31
|
+
filters: listViewState.filters,
|
|
32
|
+
count: listViewState.counts,
|
|
33
|
+
countsFetchState: listViewState.countsFetchState,
|
|
34
|
+
tabIds: invoicingCustomerListViewState_1.INVOICING_CUSTOMER_TABS,
|
|
35
|
+
sort: listViewState.sort,
|
|
36
|
+
};
|
|
37
|
+
});
|
|
@@ -3,7 +3,6 @@ import { InvoicingListCounts } from '../../../entity/invoicing/invoicingCommonPa
|
|
|
3
3
|
import { InvoicingListSort } from '../invoicingApiHelper';
|
|
4
4
|
export interface InvoicingCustomerFilters {
|
|
5
5
|
search?: string;
|
|
6
|
-
status?: string;
|
|
7
6
|
}
|
|
8
7
|
export declare const ALL_INVOICING_CUSTOMER_SORT_KEYS: readonly ["name", "email", "billingAddress", "cardStatus", "autoCollect", "status"];
|
|
9
8
|
export declare const toInvoicingCustomerSortKey: (v: string) => "status" | "name" | "cardStatus" | "email" | "billingAddress" | "autoCollect";
|
|
@@ -31,6 +30,8 @@ export type InvoicingCustomerTabId = ReturnType<typeof toInvoicingCustomerTabId>
|
|
|
31
30
|
*/
|
|
32
31
|
export declare const INVOICING_CUSTOMER_TABS: InvoicingCustomerTabId[];
|
|
33
32
|
export interface InvoicingCustomerListViewState extends FetchedState {
|
|
33
|
+
/** Selected status tab (CES-owned so it persists across page revisits). */
|
|
34
|
+
activeTab: InvoicingCustomerTabId;
|
|
34
35
|
counts: InvoicingListCounts;
|
|
35
36
|
countsFetchState: FetchStateAndError;
|
|
36
37
|
filters: InvoicingCustomerFilters;
|
package/lib/view/invoicing/invoicingDunningCaseListView/epics/fetchInvoicingDunningCaseListEpic.js
CHANGED
|
@@ -9,9 +9,6 @@ const invoicingApiHelper_1 = require("../../invoicingApiHelper");
|
|
|
9
9
|
const invoicingDunningCaseListViewReducer_1 = require("../invoicingDunningCaseListViewReducer");
|
|
10
10
|
const buildQuery = (filters, cursor, sort) => {
|
|
11
11
|
const params = new URLSearchParams();
|
|
12
|
-
if (filters.status != null && filters.status.length > 0) {
|
|
13
|
-
params.set('status', filters.status);
|
|
14
|
-
}
|
|
15
12
|
if (filters.search != null && filters.search.length > 0) {
|
|
16
13
|
params.set('search', filters.search);
|
|
17
14
|
}
|
package/lib/view/invoicing/invoicingDunningCaseListView/invoicingDunningCaseListViewReducer.d.ts
CHANGED
|
@@ -26,6 +26,6 @@ export declare const fetchInvoicingDunningCaseList: import("@reduxjs/toolkit").A
|
|
|
26
26
|
ids: ID[];
|
|
27
27
|
keepExistingListItems: boolean;
|
|
28
28
|
nextCursor: string | null;
|
|
29
|
-
}, "invoicingDunningCaseListView/updateInvoicingDunningCaseList">, updateInvoicingDunningCaseListFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<ZeniAPIStatus<Record<string, unknown>>, "invoicingDunningCaseListView/updateInvoicingDunningCaseListFailure">, fetchInvoicingDunningCaseCounts: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"invoicingDunningCaseListView/fetchInvoicingDunningCaseCounts">, updateInvoicingDunningCaseCounts: import("@reduxjs/toolkit").ActionCreatorWithPayload<InvoicingListCounts, "invoicingDunningCaseListView/updateInvoicingDunningCaseCounts">, updateInvoicingDunningCaseCountsFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<ZeniAPIStatus<Record<string, unknown>>, "invoicingDunningCaseListView/updateInvoicingDunningCaseCountsFailure">, updateInvoicingDunningCaseFilters: import("@reduxjs/toolkit").ActionCreatorWithPayload<InvoicingDunningCaseFilters, "invoicingDunningCaseListView/updateInvoicingDunningCaseFilters">, clearInvoicingDunningCaseListView: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"invoicingDunningCaseListView/clearInvoicingDunningCaseListView">;
|
|
29
|
+
}, "invoicingDunningCaseListView/updateInvoicingDunningCaseList">, updateInvoicingDunningCaseListFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<ZeniAPIStatus<Record<string, unknown>>, "invoicingDunningCaseListView/updateInvoicingDunningCaseListFailure">, fetchInvoicingDunningCaseCounts: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"invoicingDunningCaseListView/fetchInvoicingDunningCaseCounts">, updateInvoicingDunningCaseCounts: import("@reduxjs/toolkit").ActionCreatorWithPayload<InvoicingListCounts, "invoicingDunningCaseListView/updateInvoicingDunningCaseCounts">, updateInvoicingDunningCaseCountsFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<ZeniAPIStatus<Record<string, unknown>>, "invoicingDunningCaseListView/updateInvoicingDunningCaseCountsFailure">, updateInvoicingDunningCaseFilters: import("@reduxjs/toolkit").ActionCreatorWithPayload<InvoicingDunningCaseFilters, "invoicingDunningCaseListView/updateInvoicingDunningCaseFilters">, setInvoicingDunningCaseActiveTab: import("@reduxjs/toolkit").ActionCreatorWithPayload<"Retrying" | "Scheduled" | "Manual Review" | "Resolved" | "Cancelled" | "all", "invoicingDunningCaseListView/setInvoicingDunningCaseActiveTab">, clearInvoicingDunningCaseListView: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"invoicingDunningCaseListView/clearInvoicingDunningCaseListView">;
|
|
30
30
|
declare const _default: import("redux").Reducer<InvoicingDunningCaseListViewState>;
|
|
31
31
|
export default _default;
|
package/lib/view/invoicing/invoicingDunningCaseListView/invoicingDunningCaseListViewReducer.js
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var _a;
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.clearInvoicingDunningCaseListView = exports.updateInvoicingDunningCaseFilters = exports.updateInvoicingDunningCaseCountsFailure = exports.updateInvoicingDunningCaseCounts = exports.fetchInvoicingDunningCaseCounts = exports.updateInvoicingDunningCaseListFailure = exports.updateInvoicingDunningCaseList = exports.fetchInvoicingDunningCaseListPage = exports.fetchInvoicingDunningCaseList = exports.initialState = void 0;
|
|
4
|
+
exports.clearInvoicingDunningCaseListView = exports.setInvoicingDunningCaseActiveTab = exports.updateInvoicingDunningCaseFilters = exports.updateInvoicingDunningCaseCountsFailure = exports.updateInvoicingDunningCaseCounts = exports.fetchInvoicingDunningCaseCounts = exports.updateInvoicingDunningCaseListFailure = exports.updateInvoicingDunningCaseList = exports.fetchInvoicingDunningCaseListPage = exports.fetchInvoicingDunningCaseList = exports.initialState = void 0;
|
|
5
5
|
const toolkit_1 = require("@reduxjs/toolkit");
|
|
6
6
|
exports.initialState = {
|
|
7
7
|
fetchState: 'Not-Started',
|
|
8
8
|
error: undefined,
|
|
9
|
+
activeTab: 'all',
|
|
9
10
|
ids: [],
|
|
10
11
|
nextCursor: null,
|
|
11
12
|
filters: {},
|
|
@@ -84,10 +85,15 @@ const invoicingDunningCaseListView = (0, toolkit_1.createSlice)({
|
|
|
84
85
|
updateInvoicingDunningCaseFilters(draft, action) {
|
|
85
86
|
draft.filters = action.payload;
|
|
86
87
|
},
|
|
88
|
+
// Select a status tab. The list API ignores `status` (returns all statuses),
|
|
89
|
+
// so the selector filters rows to this tab client-side — no refetch needed.
|
|
90
|
+
setInvoicingDunningCaseActiveTab(draft, action) {
|
|
91
|
+
draft.activeTab = action.payload;
|
|
92
|
+
},
|
|
87
93
|
clearInvoicingDunningCaseListView(draft) {
|
|
88
94
|
Object.assign(draft, exports.initialState);
|
|
89
95
|
},
|
|
90
96
|
},
|
|
91
97
|
});
|
|
92
|
-
_a = invoicingDunningCaseListView.actions, exports.fetchInvoicingDunningCaseList = _a.fetchInvoicingDunningCaseList, exports.fetchInvoicingDunningCaseListPage = _a.fetchInvoicingDunningCaseListPage, exports.updateInvoicingDunningCaseList = _a.updateInvoicingDunningCaseList, exports.updateInvoicingDunningCaseListFailure = _a.updateInvoicingDunningCaseListFailure, exports.fetchInvoicingDunningCaseCounts = _a.fetchInvoicingDunningCaseCounts, exports.updateInvoicingDunningCaseCounts = _a.updateInvoicingDunningCaseCounts, exports.updateInvoicingDunningCaseCountsFailure = _a.updateInvoicingDunningCaseCountsFailure, exports.updateInvoicingDunningCaseFilters = _a.updateInvoicingDunningCaseFilters, exports.clearInvoicingDunningCaseListView = _a.clearInvoicingDunningCaseListView;
|
|
98
|
+
_a = invoicingDunningCaseListView.actions, exports.fetchInvoicingDunningCaseList = _a.fetchInvoicingDunningCaseList, exports.fetchInvoicingDunningCaseListPage = _a.fetchInvoicingDunningCaseListPage, exports.updateInvoicingDunningCaseList = _a.updateInvoicingDunningCaseList, exports.updateInvoicingDunningCaseListFailure = _a.updateInvoicingDunningCaseListFailure, exports.fetchInvoicingDunningCaseCounts = _a.fetchInvoicingDunningCaseCounts, exports.updateInvoicingDunningCaseCounts = _a.updateInvoicingDunningCaseCounts, exports.updateInvoicingDunningCaseCountsFailure = _a.updateInvoicingDunningCaseCountsFailure, exports.updateInvoicingDunningCaseFilters = _a.updateInvoicingDunningCaseFilters, exports.setInvoicingDunningCaseActiveTab = _a.setInvoicingDunningCaseActiveTab, exports.clearInvoicingDunningCaseListView = _a.clearInvoicingDunningCaseListView;
|
|
93
99
|
exports.default = invoicingDunningCaseListView.reducer;
|
package/lib/view/invoicing/invoicingDunningCaseListView/invoicingDunningCaseListViewSelector.d.ts
CHANGED
|
@@ -6,6 +6,7 @@ import { RootState } from '../../../reducer';
|
|
|
6
6
|
import { InvoicingListSort } from '../invoicingApiHelper';
|
|
7
7
|
import { InvoicingDunningCaseColumnConfig, InvoicingDunningCaseFilters, InvoicingDunningCaseTabId } from './invoicingDunningCaseListViewState';
|
|
8
8
|
export interface InvoicingDunningCaseListView extends SelectorView {
|
|
9
|
+
activeTab: InvoicingDunningCaseTabId;
|
|
9
10
|
columns: InvoicingDunningCaseColumnConfig[];
|
|
10
11
|
count: InvoicingListCounts;
|
|
11
12
|
countsFetchState: FetchStateAndError;
|
package/lib/view/invoicing/invoicingDunningCaseListView/invoicingDunningCaseListViewSelector.js
CHANGED
|
@@ -9,16 +9,26 @@ const invoicingDunningCaseListViewState_1 = require("./invoicingDunningCaseListV
|
|
|
9
9
|
* object) keep referential identity until the dunning-case entity slice or the
|
|
10
10
|
* list-view slice actually change.
|
|
11
11
|
*/
|
|
12
|
-
exports.getInvoicingDunningCaseListView = (0, toolkit_1.createSelector)((state) => state.invoicingDunningCaseState, (state) => state.invoicingDunningCaseListViewState, (dunningCaseState, listViewState) =>
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
12
|
+
exports.getInvoicingDunningCaseListView = (0, toolkit_1.createSelector)((state) => state.invoicingDunningCaseState, (state) => state.invoicingDunningCaseListViewState, (dunningCaseState, listViewState) => {
|
|
13
|
+
const { activeTab } = listViewState;
|
|
14
|
+
const allDunningCases = (0, dunningCaseSelector_1.getInvoicingDunningCasesByIds)(dunningCaseState, listViewState.ids);
|
|
15
|
+
// The list API ignores `status`, so it returns every status; filter to the
|
|
16
|
+
// active tab client-side ('all' shows everything).
|
|
17
|
+
const dunningCases = activeTab === 'all'
|
|
18
|
+
? allDunningCases
|
|
19
|
+
: allDunningCases.filter((dunningCase) => dunningCase.status === activeTab);
|
|
20
|
+
return {
|
|
21
|
+
activeTab,
|
|
22
|
+
columns: invoicingDunningCaseListViewState_1.INVOICING_DUNNING_CASE_COLUMNS,
|
|
23
|
+
dunningCases,
|
|
24
|
+
count: listViewState.counts,
|
|
25
|
+
countsFetchState: listViewState.countsFetchState,
|
|
26
|
+
filters: listViewState.filters,
|
|
27
|
+
nextCursor: listViewState.nextCursor,
|
|
28
|
+
fetchState: listViewState.fetchState,
|
|
29
|
+
error: listViewState.error,
|
|
30
|
+
tabIds: invoicingDunningCaseListViewState_1.INVOICING_DUNNING_CASE_TABS,
|
|
31
|
+
sort: listViewState.sort,
|
|
32
|
+
version: 1.0,
|
|
33
|
+
};
|
|
34
|
+
});
|
package/lib/view/invoicing/invoicingDunningCaseListView/invoicingDunningCaseListViewState.d.ts
CHANGED
|
@@ -3,7 +3,6 @@ import { InvoicingListCounts } from '../../../entity/invoicing/invoicingCommonPa
|
|
|
3
3
|
import { InvoicingListSort } from '../invoicingApiHelper';
|
|
4
4
|
export interface InvoicingDunningCaseFilters {
|
|
5
5
|
search?: string;
|
|
6
|
-
status?: string;
|
|
7
6
|
}
|
|
8
7
|
export declare const ALL_INVOICING_DUNNING_CASE_SORT_KEYS: readonly ["customer", "invoice", "attempts", "nextRetry", "daysPastDue", "failureReason", "status", "amount"];
|
|
9
8
|
export declare const toInvoicingDunningCaseSortKey: (v: string) => "amount" | "status" | "invoice" | "customer" | "attempts" | "daysPastDue" | "failureReason" | "nextRetry";
|
|
@@ -31,6 +30,8 @@ export type InvoicingDunningCaseTabId = ReturnType<typeof toInvoicingDunningCase
|
|
|
31
30
|
*/
|
|
32
31
|
export declare const INVOICING_DUNNING_CASE_TABS: InvoicingDunningCaseTabId[];
|
|
33
32
|
export interface InvoicingDunningCaseListViewState extends FetchedState {
|
|
33
|
+
/** Selected status tab (CES-owned so it persists across page revisits). */
|
|
34
|
+
activeTab: InvoicingDunningCaseTabId;
|
|
34
35
|
counts: InvoicingListCounts;
|
|
35
36
|
countsFetchState: FetchStateAndError;
|
|
36
37
|
filters: InvoicingDunningCaseFilters;
|
package/lib/view/invoicing/invoicingSubscriptionListView/epics/fetchInvoicingSubscriptionListEpic.js
CHANGED
|
@@ -11,9 +11,6 @@ const invoicingApiHelper_1 = require("../../invoicingApiHelper");
|
|
|
11
11
|
const invoicingSubscriptionListViewReducer_1 = require("../invoicingSubscriptionListViewReducer");
|
|
12
12
|
const buildQuery = (filters, cursor, sort) => {
|
|
13
13
|
const params = new URLSearchParams();
|
|
14
|
-
if (filters.status != null && filters.status.length > 0) {
|
|
15
|
-
params.set('status', filters.status);
|
|
16
|
-
}
|
|
17
14
|
if (filters.customerId != null) {
|
|
18
15
|
params.set('customer_id', filters.customerId);
|
|
19
16
|
}
|
package/lib/view/invoicing/invoicingSubscriptionListView/invoicingSubscriptionListViewReducer.d.ts
CHANGED
|
@@ -27,7 +27,7 @@ export declare const fetchInvoicingSubscriptionList: import("@reduxjs/toolkit").
|
|
|
27
27
|
ids: ID[];
|
|
28
28
|
keepExistingListItems: boolean;
|
|
29
29
|
nextCursor: string | null;
|
|
30
|
-
}, "invoicingSubscriptionListView/updateInvoicingSubscriptionList">, updateInvoicingSubscriptionListFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<ZeniAPIStatus<Record<string, unknown>>, "invoicingSubscriptionListView/updateInvoicingSubscriptionListFailure">, fetchInvoicingSubscriptionCounts: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"invoicingSubscriptionListView/fetchInvoicingSubscriptionCounts">, updateInvoicingSubscriptionCounts: import("@reduxjs/toolkit").ActionCreatorWithPayload<InvoicingListCounts, "invoicingSubscriptionListView/updateInvoicingSubscriptionCounts">, updateInvoicingSubscriptionCountsFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<ZeniAPIStatus<Record<string, unknown>>, "invoicingSubscriptionListView/updateInvoicingSubscriptionCountsFailure">, updateInvoicingSubscriptionFilters: import("@reduxjs/toolkit").ActionCreatorWithPayload<InvoicingSubscriptionFilters, "invoicingSubscriptionListView/updateInvoicingSubscriptionFilters">, addInvoicingSubscriptionToList: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
30
|
+
}, "invoicingSubscriptionListView/updateInvoicingSubscriptionList">, updateInvoicingSubscriptionListFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<ZeniAPIStatus<Record<string, unknown>>, "invoicingSubscriptionListView/updateInvoicingSubscriptionListFailure">, fetchInvoicingSubscriptionCounts: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"invoicingSubscriptionListView/fetchInvoicingSubscriptionCounts">, updateInvoicingSubscriptionCounts: import("@reduxjs/toolkit").ActionCreatorWithPayload<InvoicingListCounts, "invoicingSubscriptionListView/updateInvoicingSubscriptionCounts">, updateInvoicingSubscriptionCountsFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<ZeniAPIStatus<Record<string, unknown>>, "invoicingSubscriptionListView/updateInvoicingSubscriptionCountsFailure">, updateInvoicingSubscriptionFilters: import("@reduxjs/toolkit").ActionCreatorWithPayload<InvoicingSubscriptionFilters, "invoicingSubscriptionListView/updateInvoicingSubscriptionFilters">, setInvoicingSubscriptionActiveTab: import("@reduxjs/toolkit").ActionCreatorWithPayload<"active" | "cancelled" | "future" | "in_trial" | "non_renewing" | "paused" | "all", "invoicingSubscriptionListView/setInvoicingSubscriptionActiveTab">, addInvoicingSubscriptionToList: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
31
31
|
id: ID;
|
|
32
32
|
status?: InvoicingSubscriptionStatus;
|
|
33
33
|
}, "invoicingSubscriptionListView/addInvoicingSubscriptionToList">, clearInvoicingSubscriptionListView: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"invoicingSubscriptionListView/clearInvoicingSubscriptionListView">;
|
package/lib/view/invoicing/invoicingSubscriptionListView/invoicingSubscriptionListViewReducer.js
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var _a;
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.clearInvoicingSubscriptionListView = exports.addInvoicingSubscriptionToList = exports.updateInvoicingSubscriptionFilters = exports.updateInvoicingSubscriptionCountsFailure = exports.updateInvoicingSubscriptionCounts = exports.fetchInvoicingSubscriptionCounts = exports.updateInvoicingSubscriptionListFailure = exports.updateInvoicingSubscriptionList = exports.fetchInvoicingSubscriptionListPage = exports.fetchInvoicingSubscriptionList = exports.initialState = void 0;
|
|
4
|
+
exports.clearInvoicingSubscriptionListView = exports.addInvoicingSubscriptionToList = exports.setInvoicingSubscriptionActiveTab = exports.updateInvoicingSubscriptionFilters = exports.updateInvoicingSubscriptionCountsFailure = exports.updateInvoicingSubscriptionCounts = exports.fetchInvoicingSubscriptionCounts = exports.updateInvoicingSubscriptionListFailure = exports.updateInvoicingSubscriptionList = exports.fetchInvoicingSubscriptionListPage = exports.fetchInvoicingSubscriptionList = exports.initialState = void 0;
|
|
5
5
|
const toolkit_1 = require("@reduxjs/toolkit");
|
|
6
6
|
exports.initialState = {
|
|
7
7
|
fetchState: 'Not-Started',
|
|
8
8
|
error: undefined,
|
|
9
|
+
activeTab: 'all',
|
|
9
10
|
ids: [],
|
|
10
11
|
nextCursor: null,
|
|
11
12
|
filters: {},
|
|
@@ -84,6 +85,11 @@ const invoicingSubscriptionListView = (0, toolkit_1.createSlice)({
|
|
|
84
85
|
updateInvoicingSubscriptionFilters(draft, action) {
|
|
85
86
|
draft.filters = action.payload;
|
|
86
87
|
},
|
|
88
|
+
// Select a status tab. The list API ignores `status` (returns all statuses),
|
|
89
|
+
// so the selector filters rows to this tab client-side — no refetch needed.
|
|
90
|
+
setInvoicingSubscriptionActiveTab(draft, action) {
|
|
91
|
+
draft.activeTab = action.payload;
|
|
92
|
+
},
|
|
87
93
|
// Reflect a newly created subscription in the cached list + tab counts so the
|
|
88
94
|
// subscription page shows it without refetching from the server. The status
|
|
89
95
|
// doubles as the per-tab count key (tab ids mirror InvoicingSubscriptionStatus).
|
|
@@ -103,5 +109,5 @@ const invoicingSubscriptionListView = (0, toolkit_1.createSlice)({
|
|
|
103
109
|
},
|
|
104
110
|
},
|
|
105
111
|
});
|
|
106
|
-
_a = invoicingSubscriptionListView.actions, exports.fetchInvoicingSubscriptionList = _a.fetchInvoicingSubscriptionList, exports.fetchInvoicingSubscriptionListPage = _a.fetchInvoicingSubscriptionListPage, exports.updateInvoicingSubscriptionList = _a.updateInvoicingSubscriptionList, exports.updateInvoicingSubscriptionListFailure = _a.updateInvoicingSubscriptionListFailure, exports.fetchInvoicingSubscriptionCounts = _a.fetchInvoicingSubscriptionCounts, exports.updateInvoicingSubscriptionCounts = _a.updateInvoicingSubscriptionCounts, exports.updateInvoicingSubscriptionCountsFailure = _a.updateInvoicingSubscriptionCountsFailure, exports.updateInvoicingSubscriptionFilters = _a.updateInvoicingSubscriptionFilters, exports.addInvoicingSubscriptionToList = _a.addInvoicingSubscriptionToList, exports.clearInvoicingSubscriptionListView = _a.clearInvoicingSubscriptionListView;
|
|
112
|
+
_a = invoicingSubscriptionListView.actions, exports.fetchInvoicingSubscriptionList = _a.fetchInvoicingSubscriptionList, exports.fetchInvoicingSubscriptionListPage = _a.fetchInvoicingSubscriptionListPage, exports.updateInvoicingSubscriptionList = _a.updateInvoicingSubscriptionList, exports.updateInvoicingSubscriptionListFailure = _a.updateInvoicingSubscriptionListFailure, exports.fetchInvoicingSubscriptionCounts = _a.fetchInvoicingSubscriptionCounts, exports.updateInvoicingSubscriptionCounts = _a.updateInvoicingSubscriptionCounts, exports.updateInvoicingSubscriptionCountsFailure = _a.updateInvoicingSubscriptionCountsFailure, exports.updateInvoicingSubscriptionFilters = _a.updateInvoicingSubscriptionFilters, exports.setInvoicingSubscriptionActiveTab = _a.setInvoicingSubscriptionActiveTab, exports.addInvoicingSubscriptionToList = _a.addInvoicingSubscriptionToList, exports.clearInvoicingSubscriptionListView = _a.clearInvoicingSubscriptionListView;
|
|
107
113
|
exports.default = invoicingSubscriptionListView.reducer;
|
package/lib/view/invoicing/invoicingSubscriptionListView/invoicingSubscriptionListViewSelector.d.ts
CHANGED
|
@@ -6,6 +6,7 @@ import { RootState } from '../../../reducer';
|
|
|
6
6
|
import { InvoicingListSort } from '../invoicingApiHelper';
|
|
7
7
|
import { InvoicingSubscriptionColumnConfig, InvoicingSubscriptionFilters, InvoicingSubscriptionTabId } from './invoicingSubscriptionListViewState';
|
|
8
8
|
export interface InvoicingSubscriptionListView extends SelectorView {
|
|
9
|
+
activeTab: InvoicingSubscriptionTabId;
|
|
9
10
|
columns: InvoicingSubscriptionColumnConfig[];
|
|
10
11
|
count: InvoicingListCounts;
|
|
11
12
|
countsFetchState: FetchStateAndError;
|
package/lib/view/invoicing/invoicingSubscriptionListView/invoicingSubscriptionListViewSelector.js
CHANGED
|
@@ -11,15 +11,25 @@ const invoicingSubscriptionListViewState_1 = require("./invoicingSubscriptionLis
|
|
|
11
11
|
* re-rendered on every unrelated redux action because a fresh array was built
|
|
12
12
|
* each call.
|
|
13
13
|
*/
|
|
14
|
-
exports.getInvoicingSubscriptionListView = (0, toolkit_1.createSelector)((state) => state.invoicingSubscriptionState, (state) => state.invoicingSubscriptionListViewState, (subscriptionState, listViewState) =>
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
14
|
+
exports.getInvoicingSubscriptionListView = (0, toolkit_1.createSelector)((state) => state.invoicingSubscriptionState, (state) => state.invoicingSubscriptionListViewState, (subscriptionState, listViewState) => {
|
|
15
|
+
const { activeTab } = listViewState;
|
|
16
|
+
const allSubscriptions = (0, invoicingSubscriptionSelector_1.getInvoicingSubscriptionsByIds)(subscriptionState, listViewState.ids);
|
|
17
|
+
// The list API ignores `status`, so it returns every status; filter to the
|
|
18
|
+
// active tab client-side ('all' shows everything).
|
|
19
|
+
const subscriptions = activeTab === 'all'
|
|
20
|
+
? allSubscriptions
|
|
21
|
+
: allSubscriptions.filter((subscription) => subscription.status === activeTab);
|
|
22
|
+
return {
|
|
23
|
+
activeTab,
|
|
24
|
+
columns: invoicingSubscriptionListViewState_1.INVOICING_SUBSCRIPTION_COLUMNS,
|
|
25
|
+
subscriptions,
|
|
26
|
+
fetchState: listViewState.fetchState,
|
|
27
|
+
error: listViewState.error,
|
|
28
|
+
nextCursor: listViewState.nextCursor,
|
|
29
|
+
filters: listViewState.filters,
|
|
30
|
+
count: listViewState.counts,
|
|
31
|
+
countsFetchState: listViewState.countsFetchState,
|
|
32
|
+
tabIds: invoicingSubscriptionListViewState_1.INVOICING_SUBSCRIPTION_TABS,
|
|
33
|
+
sort: listViewState.sort,
|
|
34
|
+
};
|
|
35
|
+
});
|
package/lib/view/invoicing/invoicingSubscriptionListView/invoicingSubscriptionListViewState.d.ts
CHANGED
|
@@ -6,7 +6,6 @@ export interface InvoicingSubscriptionFilters {
|
|
|
6
6
|
search?: string;
|
|
7
7
|
startedFrom?: string;
|
|
8
8
|
startedTo?: string;
|
|
9
|
-
status?: string;
|
|
10
9
|
}
|
|
11
10
|
export declare const ALL_INVOICING_SUBSCRIPTION_SORT_KEYS: readonly ["subscription", "customer", "plan", "product_code", "term_end", "next_billing", "auto_collect", "status", "mrr"];
|
|
12
11
|
export declare const toInvoicingSubscriptionSortKey: (v: string) => "status" | "customer" | "mrr" | "plan" | "subscription" | "product_code" | "term_end" | "next_billing" | "auto_collect";
|
|
@@ -34,9 +33,12 @@ export type InvoicingSubscriptionTabId = ReturnType<typeof toInvoicingSubscripti
|
|
|
34
33
|
*/
|
|
35
34
|
export declare const INVOICING_SUBSCRIPTION_TABS: InvoicingSubscriptionTabId[];
|
|
36
35
|
export interface InvoicingSubscriptionListViewState extends FetchedState {
|
|
36
|
+
/** Selected status tab (CES-owned so it persists across page revisits). */
|
|
37
|
+
activeTab: InvoicingSubscriptionTabId;
|
|
37
38
|
counts: InvoicingListCounts;
|
|
38
39
|
countsFetchState: FetchStateAndError;
|
|
39
40
|
filters: InvoicingSubscriptionFilters;
|
|
41
|
+
/** Full list ids (all statuses); the selector filters by `activeTab`. */
|
|
40
42
|
ids: ID[];
|
|
41
43
|
nextCursor: string | null;
|
|
42
44
|
/** Active server-side sort (undefined = backend default order). */
|
package/lib/view/invoicing/invoicingTransactionListView/epics/fetchInvoicingTransactionListEpic.d.ts
CHANGED
|
@@ -5,4 +5,4 @@ import { RootState } from '../../../../reducer';
|
|
|
5
5
|
import { ZeniAPI } from '../../../../zeniAPI';
|
|
6
6
|
import { fetchInvoicingTransactionList, updateInvoicingTransactionList, updateInvoicingTransactionListFailure } from '../invoicingTransactionListViewReducer';
|
|
7
7
|
export type ActionType = ReturnType<typeof fetchInvoicingTransactionList> | ReturnType<typeof updateInvoicingTransactionList> | ReturnType<typeof updateInvoicingTransactionListFailure> | ReturnType<typeof updateInvoicingTransactions>;
|
|
8
|
-
export declare const fetchInvoicingTransactionListEpic: (actions$: ActionsObservable<ActionType>,
|
|
8
|
+
export declare const fetchInvoicingTransactionListEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
|
package/lib/view/invoicing/invoicingTransactionListView/epics/fetchInvoicingTransactionListEpic.js
CHANGED
|
@@ -7,13 +7,13 @@ const invoicingTransactionReducer_1 = require("../../../../entity/invoicing/invo
|
|
|
7
7
|
const responsePayload_1 = require("../../../../responsePayload");
|
|
8
8
|
const invoicingApiHelper_1 = require("../../invoicingApiHelper");
|
|
9
9
|
const invoicingTransactionListViewReducer_1 = require("../invoicingTransactionListViewReducer");
|
|
10
|
-
const buildQuery = (filters, cursor, sort) => {
|
|
10
|
+
const buildQuery = (filters, type, cursor, sort) => {
|
|
11
11
|
const params = new URLSearchParams();
|
|
12
12
|
if (filters.status != null && filters.status.length > 0) {
|
|
13
13
|
params.set('status', filters.status);
|
|
14
14
|
}
|
|
15
|
-
if (
|
|
16
|
-
params.set('type',
|
|
15
|
+
if (type != null && type.length > 0) {
|
|
16
|
+
params.set('type', type);
|
|
17
17
|
}
|
|
18
18
|
if (filters.customerId != null) {
|
|
19
19
|
params.set('customer_id', filters.customerId);
|
|
@@ -28,9 +28,11 @@ const buildQuery = (filters, cursor, sort) => {
|
|
|
28
28
|
(0, invoicingApiHelper_1.applyListSortParams)(params, sort);
|
|
29
29
|
return params;
|
|
30
30
|
};
|
|
31
|
-
const fetchInvoicingTransactionListEpic = (actions$,
|
|
31
|
+
const fetchInvoicingTransactionListEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(invoicingTransactionListViewReducer_1.fetchInvoicingTransactionList.match), (0, operators_1.switchMap)((action) => {
|
|
32
32
|
const { filters, cursor, keepExistingListItems, sort } = action.payload;
|
|
33
|
-
const
|
|
33
|
+
const { activeTab } = state$.value.invoicingTransactionListViewState;
|
|
34
|
+
const type = activeTab !== 'all' ? activeTab : undefined;
|
|
35
|
+
const apiUrl = (0, invoicingApiHelper_1.withQuery)(`${zeniAPI.apiEndPoints.invoicingMicroServiceBaseUrl}/1.0/payments`, buildQuery(filters, type, cursor, sort));
|
|
34
36
|
return zeniAPI.getJSON(apiUrl).pipe((0, operators_1.switchMap)((response) => {
|
|
35
37
|
if ((0, responsePayload_1.isSuccessResponse)(response)) {
|
|
36
38
|
const items = response.data?.items ?? [];
|
|
@@ -19,8 +19,9 @@ const shouldFetch = (fetchStateAndError, cacheOverride) => cacheOverride ||
|
|
|
19
19
|
const fetchInvoicingTransactionListPageEpic = (actions$, state$) => actions$.pipe((0, operators_1.filter)(invoicingTransactionListViewReducer_1.fetchInvoicingTransactionListPage.match), (0, operators_1.mergeMap)((action) => {
|
|
20
20
|
const { cacheOverride, filters, sort } = action.payload;
|
|
21
21
|
const state = state$.value.invoicingTransactionListViewState;
|
|
22
|
+
const activeTabState = state.byTab[state.activeTab];
|
|
22
23
|
const pageActions = [];
|
|
23
|
-
if (shouldFetch({ fetchState:
|
|
24
|
+
if (shouldFetch({ fetchState: activeTabState.fetchState, error: activeTabState.error }, cacheOverride)) {
|
|
24
25
|
pageActions.push((0, invoicingTransactionListViewReducer_1.fetchInvoicingTransactionList)({ filters, sort }));
|
|
25
26
|
}
|
|
26
27
|
return (0, rxjs_1.concat)((0, rxjs_1.from)(pageActions));
|
package/lib/view/invoicing/invoicingTransactionListView/invoicingTransactionListViewReducer.d.ts
CHANGED
|
@@ -25,6 +25,6 @@ export declare const fetchInvoicingTransactionList: import("@reduxjs/toolkit").A
|
|
|
25
25
|
ids: ID[];
|
|
26
26
|
keepExistingListItems: boolean;
|
|
27
27
|
nextCursor: string | null;
|
|
28
|
-
}, "invoicingTransactionListView/updateInvoicingTransactionList">, updateInvoicingTransactionListFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<ZeniAPIStatus<Record<string, unknown>>, "invoicingTransactionListView/updateInvoicingTransactionListFailure">, updateInvoicingTransactionFilters: import("@reduxjs/toolkit").ActionCreatorWithPayload<InvoicingTransactionFilters, "invoicingTransactionListView/updateInvoicingTransactionFilters">, addInvoicingTransactionToList: import("@reduxjs/toolkit").ActionCreatorWithPayload<string, "invoicingTransactionListView/addInvoicingTransactionToList">, clearInvoicingTransactionListView: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"invoicingTransactionListView/clearInvoicingTransactionListView">;
|
|
28
|
+
}, "invoicingTransactionListView/updateInvoicingTransactionList">, updateInvoicingTransactionListFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<ZeniAPIStatus<Record<string, unknown>>, "invoicingTransactionListView/updateInvoicingTransactionListFailure">, updateInvoicingTransactionFilters: import("@reduxjs/toolkit").ActionCreatorWithPayload<InvoicingTransactionFilters, "invoicingTransactionListView/updateInvoicingTransactionFilters">, setInvoicingTransactionActiveTab: import("@reduxjs/toolkit").ActionCreatorWithPayload<"refund" | "payment" | "all" | "authorization" | "payment_reversal", "invoicingTransactionListView/setInvoicingTransactionActiveTab">, addInvoicingTransactionToList: import("@reduxjs/toolkit").ActionCreatorWithPayload<string, "invoicingTransactionListView/addInvoicingTransactionToList">, clearInvoicingTransactionListView: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"invoicingTransactionListView/clearInvoicingTransactionListView">;
|
|
29
29
|
declare const _default: import("redux").Reducer<InvoicingTransactionListViewState>;
|
|
30
30
|
export default _default;
|