@zeniai/client-epic-state 5.1.68 → 5.1.69-betaAK0
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/esm/view/spendManagement/billPay/billDetailView/billDetailViewSelector.js +8 -2
- package/lib/esm/view/spendManagement/helpers.js +12 -0
- package/lib/esm/view/spendManagement/reimbursement/editRemiView/epics/fetchEditRemiDetailPageEpic.js +0 -12
- package/lib/esm/view/spendManagement/reimbursement/remiDetailView/remiDetailViewSelector.js +4 -2
- 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 +21 -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/lib/view/spendManagement/billPay/billDetailView/billDetailViewSelector.d.ts +1 -0
- package/lib/view/spendManagement/billPay/billDetailView/billDetailViewSelector.js +7 -1
- package/lib/view/spendManagement/helpers.d.ts +1 -0
- package/lib/view/spendManagement/helpers.js +14 -1
- package/lib/view/spendManagement/reimbursement/editRemiView/epics/fetchEditRemiDetailPageEpic.d.ts +1 -2
- package/lib/view/spendManagement/reimbursement/editRemiView/epics/fetchEditRemiDetailPageEpic.js +0 -12
- package/lib/view/spendManagement/reimbursement/remiDetailView/remiDetailViewSelector.d.ts +1 -0
- package/lib/view/spendManagement/reimbursement/remiDetailView/remiDetailViewSelector.js +3 -1
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { FetchStateAndError,
|
|
1
|
+
import { FetchStateAndError, ID } from '../../../commonStateTypes/common';
|
|
2
2
|
import { InvoicingInvoiceKPIs } from '../../../entity/invoicing/invoice/invoiceState';
|
|
3
3
|
import { InvoicingListCounts } from '../../../entity/invoicing/invoicingCommonPayload';
|
|
4
4
|
import { InvoicingListSort } from '../invoicingApiHelper';
|
|
@@ -18,19 +18,33 @@ export interface InvoiceListFilters {
|
|
|
18
18
|
dateFrom?: string;
|
|
19
19
|
dateTo?: string;
|
|
20
20
|
search?: string;
|
|
21
|
-
status?: string;
|
|
22
21
|
subscriptionId?: ID;
|
|
23
22
|
}
|
|
24
|
-
|
|
23
|
+
/**
|
|
24
|
+
* Per-tab cache slice. Each status tab is a separate server query (the backend
|
|
25
|
+
* filters by `status`), so its loaded ids, pagination cursor and fetch state are
|
|
26
|
+
* cached independently. Mirrors the transaction-list per-tab cache pattern.
|
|
27
|
+
*/
|
|
28
|
+
export interface InvoiceTabState extends FetchStateAndError {
|
|
29
|
+
ids: ID[];
|
|
30
|
+
nextCursor: string | null;
|
|
31
|
+
}
|
|
32
|
+
export type InvoiceIdsByTab = Record<InvoicingInvoiceTabId, InvoiceTabState>;
|
|
33
|
+
export interface InvoiceListState {
|
|
34
|
+
/** Selected status tab (CES-owned so it persists across page revisits). */
|
|
35
|
+
activeTab: InvoicingInvoiceTabId;
|
|
36
|
+
/** Per-tab cached ids + cursor + fetch state. */
|
|
37
|
+
byTab: InvoiceIdsByTab;
|
|
38
|
+
/** Tab-independent list counts. */
|
|
25
39
|
counts: InvoicingListCounts;
|
|
26
40
|
countsFetchState: FetchStateAndError;
|
|
41
|
+
/** Base query shared across tabs (search / customer / subscription / dates). */
|
|
27
42
|
filters: InvoiceListFilters;
|
|
28
|
-
/** Ordered invoice IDs for the current list view. */
|
|
29
|
-
invoiceIds: ID[];
|
|
30
43
|
kpisFetchState: FetchStateAndError;
|
|
31
|
-
/**
|
|
32
|
-
nextCursor: string | null;
|
|
44
|
+
/** Tab-independent money KPIs. */
|
|
33
45
|
kpis?: InvoicingInvoiceKPIs;
|
|
34
46
|
/** Active server-side sort (undefined = backend default order). */
|
|
35
47
|
sort?: InvoicingListSort;
|
|
36
48
|
}
|
|
49
|
+
export declare const makeInvoiceTabState: () => InvoiceTabState;
|
|
50
|
+
export declare const makeInvoiceIdsByTab: () => InvoiceIdsByTab;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.INVOICING_INVOICE_TABS = exports.toInvoicingInvoiceTabId = exports.ALL_INVOICING_INVOICE_TAB_IDS = void 0;
|
|
3
|
+
exports.makeInvoiceIdsByTab = exports.makeInvoiceTabState = exports.INVOICING_INVOICE_TABS = exports.toInvoicingInvoiceTabId = exports.ALL_INVOICING_INVOICE_TAB_IDS = void 0;
|
|
4
4
|
const stringToUnion_1 = require("../../../commonStateTypes/stringToUnion");
|
|
5
5
|
exports.ALL_INVOICING_INVOICE_TAB_IDS = [
|
|
6
6
|
'all',
|
|
@@ -21,3 +21,15 @@ exports.toInvoicingInvoiceTabId = toInvoicingInvoiceTabId;
|
|
|
21
21
|
exports.INVOICING_INVOICE_TABS = [
|
|
22
22
|
...exports.ALL_INVOICING_INVOICE_TAB_IDS,
|
|
23
23
|
];
|
|
24
|
+
const makeInvoiceTabState = () => ({
|
|
25
|
+
ids: [],
|
|
26
|
+
nextCursor: null,
|
|
27
|
+
fetchState: 'Not-Started',
|
|
28
|
+
error: undefined,
|
|
29
|
+
});
|
|
30
|
+
exports.makeInvoiceTabState = makeInvoiceTabState;
|
|
31
|
+
const makeInvoiceIdsByTab = () => exports.ALL_INVOICING_INVOICE_TAB_IDS.reduce((acc, tabId) => {
|
|
32
|
+
acc[tabId] = (0, exports.makeInvoiceTabState)();
|
|
33
|
+
return acc;
|
|
34
|
+
}, {});
|
|
35
|
+
exports.makeInvoiceIdsByTab = makeInvoiceIdsByTab;
|
package/lib/view/invoicing/invoicingCreditNoteListView/epics/fetchInvoicingCreditNoteListEpic.js
CHANGED
|
@@ -9,9 +9,6 @@ const invoicingApiHelper_1 = require("../../invoicingApiHelper");
|
|
|
9
9
|
const invoicingCreditNoteListViewReducer_1 = require("../invoicingCreditNoteListViewReducer");
|
|
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.customerId != null) {
|
|
16
13
|
params.set('customer_id', filters.customerId);
|
|
17
14
|
}
|
package/lib/view/invoicing/invoicingCreditNoteListView/invoicingCreditNoteListViewReducer.d.ts
CHANGED
|
@@ -26,6 +26,6 @@ export declare const fetchInvoicingCreditNoteList: import("@reduxjs/toolkit").Ac
|
|
|
26
26
|
ids: ID[];
|
|
27
27
|
keepExistingListItems: boolean;
|
|
28
28
|
nextCursor: string | null;
|
|
29
|
-
}, "invoicingCreditNoteListView/updateInvoicingCreditNoteList">, updateInvoicingCreditNoteListFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<ZeniAPIStatus<Record<string, unknown>>, "invoicingCreditNoteListView/updateInvoicingCreditNoteListFailure">, fetchInvoicingCreditNoteCounts: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"invoicingCreditNoteListView/fetchInvoicingCreditNoteCounts">, updateInvoicingCreditNoteCounts: import("@reduxjs/toolkit").ActionCreatorWithPayload<InvoicingListCounts, "invoicingCreditNoteListView/updateInvoicingCreditNoteCounts">, updateInvoicingCreditNoteCountsFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<ZeniAPIStatus<Record<string, unknown>>, "invoicingCreditNoteListView/updateInvoicingCreditNoteCountsFailure">, updateInvoicingCreditNoteFilters: import("@reduxjs/toolkit").ActionCreatorWithPayload<InvoicingCreditNoteFilters, "invoicingCreditNoteListView/updateInvoicingCreditNoteFilters">, clearInvoicingCreditNoteListView: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"invoicingCreditNoteListView/clearInvoicingCreditNoteListView">;
|
|
29
|
+
}, "invoicingCreditNoteListView/updateInvoicingCreditNoteList">, updateInvoicingCreditNoteListFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<ZeniAPIStatus<Record<string, unknown>>, "invoicingCreditNoteListView/updateInvoicingCreditNoteListFailure">, fetchInvoicingCreditNoteCounts: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"invoicingCreditNoteListView/fetchInvoicingCreditNoteCounts">, updateInvoicingCreditNoteCounts: import("@reduxjs/toolkit").ActionCreatorWithPayload<InvoicingListCounts, "invoicingCreditNoteListView/updateInvoicingCreditNoteCounts">, updateInvoicingCreditNoteCountsFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<ZeniAPIStatus<Record<string, unknown>>, "invoicingCreditNoteListView/updateInvoicingCreditNoteCountsFailure">, updateInvoicingCreditNoteFilters: import("@reduxjs/toolkit").ActionCreatorWithPayload<InvoicingCreditNoteFilters, "invoicingCreditNoteListView/updateInvoicingCreditNoteFilters">, setInvoicingCreditNoteActiveTab: import("@reduxjs/toolkit").ActionCreatorWithPayload<"adjusted" | "refunded" | "refund_due" | "voided" | "all", "invoicingCreditNoteListView/setInvoicingCreditNoteActiveTab">, clearInvoicingCreditNoteListView: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"invoicingCreditNoteListView/clearInvoicingCreditNoteListView">;
|
|
30
30
|
declare const _default: import("redux").Reducer<InvoicingCreditNoteListViewState>;
|
|
31
31
|
export default _default;
|
package/lib/view/invoicing/invoicingCreditNoteListView/invoicingCreditNoteListViewReducer.js
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var _a;
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.clearInvoicingCreditNoteListView = exports.updateInvoicingCreditNoteFilters = exports.updateInvoicingCreditNoteCountsFailure = exports.updateInvoicingCreditNoteCounts = exports.fetchInvoicingCreditNoteCounts = exports.updateInvoicingCreditNoteListFailure = exports.updateInvoicingCreditNoteList = exports.fetchInvoicingCreditNoteListPage = exports.fetchInvoicingCreditNoteList = exports.initialState = void 0;
|
|
4
|
+
exports.clearInvoicingCreditNoteListView = exports.setInvoicingCreditNoteActiveTab = exports.updateInvoicingCreditNoteFilters = exports.updateInvoicingCreditNoteCountsFailure = exports.updateInvoicingCreditNoteCounts = exports.fetchInvoicingCreditNoteCounts = exports.updateInvoicingCreditNoteListFailure = exports.updateInvoicingCreditNoteList = exports.fetchInvoicingCreditNoteListPage = exports.fetchInvoicingCreditNoteList = 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 invoicingCreditNoteListView = (0, toolkit_1.createSlice)({
|
|
|
84
85
|
updateInvoicingCreditNoteFilters(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
|
+
setInvoicingCreditNoteActiveTab(draft, action) {
|
|
91
|
+
draft.activeTab = action.payload;
|
|
92
|
+
},
|
|
87
93
|
clearInvoicingCreditNoteListView(draft) {
|
|
88
94
|
Object.assign(draft, exports.initialState);
|
|
89
95
|
},
|
|
90
96
|
},
|
|
91
97
|
});
|
|
92
|
-
_a = invoicingCreditNoteListView.actions, exports.fetchInvoicingCreditNoteList = _a.fetchInvoicingCreditNoteList, exports.fetchInvoicingCreditNoteListPage = _a.fetchInvoicingCreditNoteListPage, exports.updateInvoicingCreditNoteList = _a.updateInvoicingCreditNoteList, exports.updateInvoicingCreditNoteListFailure = _a.updateInvoicingCreditNoteListFailure, exports.fetchInvoicingCreditNoteCounts = _a.fetchInvoicingCreditNoteCounts, exports.updateInvoicingCreditNoteCounts = _a.updateInvoicingCreditNoteCounts, exports.updateInvoicingCreditNoteCountsFailure = _a.updateInvoicingCreditNoteCountsFailure, exports.updateInvoicingCreditNoteFilters = _a.updateInvoicingCreditNoteFilters, exports.clearInvoicingCreditNoteListView = _a.clearInvoicingCreditNoteListView;
|
|
98
|
+
_a = invoicingCreditNoteListView.actions, exports.fetchInvoicingCreditNoteList = _a.fetchInvoicingCreditNoteList, exports.fetchInvoicingCreditNoteListPage = _a.fetchInvoicingCreditNoteListPage, exports.updateInvoicingCreditNoteList = _a.updateInvoicingCreditNoteList, exports.updateInvoicingCreditNoteListFailure = _a.updateInvoicingCreditNoteListFailure, exports.fetchInvoicingCreditNoteCounts = _a.fetchInvoicingCreditNoteCounts, exports.updateInvoicingCreditNoteCounts = _a.updateInvoicingCreditNoteCounts, exports.updateInvoicingCreditNoteCountsFailure = _a.updateInvoicingCreditNoteCountsFailure, exports.updateInvoicingCreditNoteFilters = _a.updateInvoicingCreditNoteFilters, exports.setInvoicingCreditNoteActiveTab = _a.setInvoicingCreditNoteActiveTab, exports.clearInvoicingCreditNoteListView = _a.clearInvoicingCreditNoteListView;
|
|
93
99
|
exports.default = invoicingCreditNoteListView.reducer;
|
package/lib/view/invoicing/invoicingCreditNoteListView/invoicingCreditNoteListViewSelector.d.ts
CHANGED
|
@@ -6,6 +6,7 @@ import { RootState } from '../../../reducer';
|
|
|
6
6
|
import { InvoicingListSort } from '../invoicingApiHelper';
|
|
7
7
|
import { InvoicingCreditNoteColumnConfig, InvoicingCreditNoteFilters, InvoicingCreditNoteTabId } from './invoicingCreditNoteListViewState';
|
|
8
8
|
export interface InvoicingCreditNoteListView extends SelectorView {
|
|
9
|
+
activeTab: InvoicingCreditNoteTabId;
|
|
9
10
|
columns: InvoicingCreditNoteColumnConfig[];
|
|
10
11
|
count: InvoicingListCounts;
|
|
11
12
|
countsFetchState: FetchStateAndError;
|
package/lib/view/invoicing/invoicingCreditNoteListView/invoicingCreditNoteListViewSelector.js
CHANGED
|
@@ -9,16 +9,26 @@ const invoicingCreditNoteListViewState_1 = require("./invoicingCreditNoteListVie
|
|
|
9
9
|
* object) keep referential identity until the credit-note entity slice or the
|
|
10
10
|
* list-view slice actually change.
|
|
11
11
|
*/
|
|
12
|
-
exports.getInvoicingCreditNoteListView = (0, toolkit_1.createSelector)((state) => state.invoicingCreditNoteState, (state) => state.invoicingCreditNoteListViewState, (creditNoteState, listViewState) =>
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
12
|
+
exports.getInvoicingCreditNoteListView = (0, toolkit_1.createSelector)((state) => state.invoicingCreditNoteState, (state) => state.invoicingCreditNoteListViewState, (creditNoteState, listViewState) => {
|
|
13
|
+
const { activeTab } = listViewState;
|
|
14
|
+
const allCreditNotes = (0, creditNoteSelector_1.getInvoicingCreditNotesByIds)(creditNoteState, 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 creditNotes = activeTab === 'all'
|
|
18
|
+
? allCreditNotes
|
|
19
|
+
: allCreditNotes.filter((creditNote) => creditNote.status === activeTab);
|
|
20
|
+
return {
|
|
21
|
+
activeTab,
|
|
22
|
+
columns: invoicingCreditNoteListViewState_1.INVOICING_CREDIT_NOTE_COLUMNS,
|
|
23
|
+
creditNotes,
|
|
24
|
+
count: listViewState.counts,
|
|
25
|
+
countsFetchState: listViewState.countsFetchState,
|
|
26
|
+
filters: listViewState.filters,
|
|
27
|
+
nextCursor: listViewState.nextCursor,
|
|
28
|
+
tabIds: invoicingCreditNoteListViewState_1.INVOICING_CREDIT_NOTE_TABS,
|
|
29
|
+
fetchState: listViewState.fetchState,
|
|
30
|
+
error: listViewState.error,
|
|
31
|
+
sort: listViewState.sort,
|
|
32
|
+
version: 1.0,
|
|
33
|
+
};
|
|
34
|
+
});
|
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.byTab[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.
|
|
19
|
+
invoices: (0, invoiceSelector_1.getInvoicesByIds)(state.invoicingInvoiceState, state.invoicingInvoiceListState.byTab[state.invoicingInvoiceListState.activeTab].ids),
|
|
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
|
+
});
|