@zeniai/client-epic-state 5.1.98 → 5.1.99
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/entity/invoicing/invoicingCommonPayload.d.ts +12 -0
- package/lib/entity/invoicing/invoicingCommonPayload.js +18 -0
- package/lib/entity/invoicing/invoicingTransaction/invoicingTransactionPayload.d.ts +1 -1
- package/lib/esm/entity/invoicing/invoicingCommonPayload.js +16 -0
- package/lib/esm/index.js +12 -11
- package/lib/esm/view/invoicing/auditView/auditViewSelector.js +4 -0
- package/lib/esm/view/invoicing/couponView/couponViewSelector.js +18 -8
- package/lib/esm/view/invoicing/couponView/couponViewState.js +0 -9
- package/lib/esm/view/invoicing/createCreditNote/createCreditNoteFormConfig.js +1 -0
- package/lib/esm/view/invoicing/createCreditNote/createCreditNotePayload.js +4 -1
- package/lib/esm/view/invoicing/createCreditNote/createCreditNoteSelector.js +4 -2
- package/lib/esm/view/invoicing/editInvoicingCatalogItemDetailView/editInvoicingCatalogItemDetailViewSelector.js +7 -6
- package/lib/esm/view/invoicing/editInvoicingCatalogItemDetailView/invoicingCatalogItemFormConfig.js +3 -19
- package/lib/esm/view/invoicing/editInvoicingCouponDetailView/editInvoicingCouponDetailViewSelector.js +10 -5
- package/lib/esm/view/invoicing/editInvoicingCustomerDetailView/editInvoicingCustomerDetailViewSelector.js +6 -4
- package/lib/esm/view/invoicing/editInvoicingCustomerDetailView/invoicingCustomerFormConfig.js +0 -17
- package/lib/esm/view/invoicing/editInvoicingSubscriptionDetailView/editInvoicingSubscriptionDetailViewSelector.js +5 -0
- package/lib/esm/view/invoicing/invoiceList/fetchInvoiceListPageEpic.js +2 -1
- package/lib/esm/view/invoicing/invoiceList/invoiceListReducer.js +18 -17
- package/lib/esm/view/invoicing/invoiceList/invoiceListSelector.js +12 -4
- package/lib/esm/view/invoicing/invoiceList/invoiceListState.js +13 -9
- package/lib/esm/view/invoicing/invoicingCatalogItemDetailView/invoicingCatalogItemDetailViewSelector.js +5 -1
- package/lib/esm/view/invoicing/invoicingCatalogListView/invoicingCatalogListViewSelector.js +2 -1
- package/lib/esm/view/invoicing/invoicingConfigView/invoicingConfigViewReducer.js +26 -0
- package/lib/esm/view/invoicing/invoicingConfigView/invoicingConfigViewSelector.js +9 -0
- package/lib/esm/view/invoicing/invoicingCreditNoteListView/invoicingCreditNoteListViewSelector.js +9 -3
- package/lib/esm/view/invoicing/invoicingCreditNoteListView/invoicingCreditNoteListViewState.js +0 -9
- package/lib/esm/view/invoicing/invoicingCustomerDetailView/fetchInvoicingCustomerDetailPageEpic.js +2 -2
- package/lib/esm/view/invoicing/invoicingCustomerDetailView/invoicingCustomerDetailViewSelector.js +1 -1
- package/lib/esm/view/invoicing/invoicingCustomerListView/invoicingCustomerListViewSelector.js +9 -3
- package/lib/esm/view/invoicing/invoicingCustomerListView/invoicingCustomerListViewState.js +0 -9
- package/lib/esm/view/invoicing/invoicingDunningCaseListView/invoicingDunningCaseListViewSelector.js +8 -3
- package/lib/esm/view/invoicing/invoicingDunningCaseListView/invoicingDunningCaseListViewState.js +1 -9
- package/lib/esm/view/invoicing/invoicingSubscriptionListView/invoicingSubscriptionListViewSelector.js +11 -3
- package/lib/esm/view/invoicing/invoicingSubscriptionListView/invoicingSubscriptionListViewState.js +0 -9
- package/lib/esm/view/invoicing/invoicingTabHelper.js +27 -0
- package/lib/esm/view/invoicing/invoicingTransactionListView/epics/fetchInvoicingTransactionListPageEpic.js +2 -1
- package/lib/esm/view/invoicing/invoicingTransactionListView/invoicingTransactionListViewReducer.js +5 -5
- package/lib/esm/view/invoicing/invoicingTransactionListView/invoicingTransactionListViewSelector.js +12 -4
- package/lib/esm/view/invoicing/invoicingTransactionListView/invoicingTransactionListViewState.js +11 -9
- package/lib/esm/view/invoicing/issueCreditNote/issueCreditNoteFormConfig.js +1 -8
- package/lib/esm/view/invoicing/issueCreditNote/issueCreditNotePayload.js +5 -1
- package/lib/esm/view/invoicing/issueCreditNote/issueCreditNoteSelector.js +5 -2
- package/lib/esm/view/invoicing/recordPayment/recordPaymentFormConfig.js +0 -26
- package/lib/esm/view/invoicing/recordPayment/recordPaymentSelector.js +26 -6
- package/lib/esm/view/invoicing/settingsView/settingsViewSelector.js +7 -1
- package/lib/index.d.ts +13 -12
- package/lib/index.js +9 -24
- package/lib/view/invoicing/auditView/auditViewSelector.d.ts +4 -0
- package/lib/view/invoicing/auditView/auditViewSelector.js +4 -0
- package/lib/view/invoicing/couponView/couponViewSelector.d.ts +5 -1
- package/lib/view/invoicing/couponView/couponViewSelector.js +17 -7
- package/lib/view/invoicing/couponView/couponViewState.d.ts +0 -7
- package/lib/view/invoicing/couponView/couponViewState.js +1 -10
- package/lib/view/invoicing/createCreditNote/createCreditNoteFormConfig.js +1 -0
- package/lib/view/invoicing/createCreditNote/createCreditNotePayload.js +4 -1
- package/lib/view/invoicing/createCreditNote/createCreditNoteSelector.d.ts +3 -1
- package/lib/view/invoicing/createCreditNote/createCreditNoteSelector.js +4 -2
- package/lib/view/invoicing/createCreditNote/createCreditNoteState.d.ts +6 -0
- package/lib/view/invoicing/editInvoicingCatalogItemDetailView/editInvoicingCatalogItemDetailViewSelector.d.ts +5 -5
- package/lib/view/invoicing/editInvoicingCatalogItemDetailView/editInvoicingCatalogItemDetailViewSelector.js +6 -5
- package/lib/view/invoicing/editInvoicingCatalogItemDetailView/invoicingCatalogItemFormConfig.d.ts +3 -6
- package/lib/view/invoicing/editInvoicingCatalogItemDetailView/invoicingCatalogItemFormConfig.js +4 -20
- package/lib/view/invoicing/editInvoicingCouponDetailView/editInvoicingCouponDetailViewSelector.d.ts +9 -7
- package/lib/view/invoicing/editInvoicingCouponDetailView/editInvoicingCouponDetailViewSelector.js +10 -5
- package/lib/view/invoicing/editInvoicingCustomerDetailView/editInvoicingCustomerDetailViewSelector.d.ts +4 -3
- package/lib/view/invoicing/editInvoicingCustomerDetailView/editInvoicingCustomerDetailViewSelector.js +5 -3
- package/lib/view/invoicing/editInvoicingCustomerDetailView/invoicingCustomerFormConfig.d.ts +0 -8
- package/lib/view/invoicing/editInvoicingCustomerDetailView/invoicingCustomerFormConfig.js +1 -18
- package/lib/view/invoicing/editInvoicingSubscriptionDetailView/editInvoicingSubscriptionDetailViewSelector.d.ts +5 -0
- package/lib/view/invoicing/editInvoicingSubscriptionDetailView/editInvoicingSubscriptionDetailViewSelector.js +5 -0
- package/lib/view/invoicing/invoiceList/fetchInvoiceListPageEpic.js +2 -1
- package/lib/view/invoicing/invoiceList/invoiceListReducer.js +17 -16
- package/lib/view/invoicing/invoiceList/invoiceListSelector.d.ts +3 -1
- package/lib/view/invoicing/invoiceList/invoiceListSelector.js +11 -3
- package/lib/view/invoicing/invoiceList/invoiceListState.d.ts +13 -9
- package/lib/view/invoicing/invoiceList/invoiceListState.js +15 -10
- package/lib/view/invoicing/invoicingCatalogItemDetailView/invoicingCatalogItemDetailViewSelector.d.ts +9 -1
- package/lib/view/invoicing/invoicingCatalogItemDetailView/invoicingCatalogItemDetailViewSelector.js +5 -1
- package/lib/view/invoicing/invoicingCatalogListView/invoicingCatalogListViewSelector.d.ts +3 -1
- package/lib/view/invoicing/invoicingCatalogListView/invoicingCatalogListViewSelector.js +2 -1
- package/lib/view/invoicing/invoicingConfigView/invoicingConfigViewPayload.d.ts +13 -0
- package/lib/view/invoicing/invoicingConfigView/invoicingConfigViewReducer.d.ts +1 -1
- package/lib/view/invoicing/invoicingConfigView/invoicingConfigViewReducer.js +26 -0
- package/lib/view/invoicing/invoicingConfigView/invoicingConfigViewSelector.d.ts +19 -1
- package/lib/view/invoicing/invoicingConfigView/invoicingConfigViewSelector.js +11 -1
- package/lib/view/invoicing/invoicingConfigView/invoicingConfigViewState.d.ts +13 -0
- package/lib/view/invoicing/invoicingCreditNoteListView/invoicingCreditNoteListViewSelector.d.ts +8 -1
- package/lib/view/invoicing/invoicingCreditNoteListView/invoicingCreditNoteListViewSelector.js +8 -2
- package/lib/view/invoicing/invoicingCreditNoteListView/invoicingCreditNoteListViewState.d.ts +0 -7
- package/lib/view/invoicing/invoicingCreditNoteListView/invoicingCreditNoteListViewState.js +1 -10
- package/lib/view/invoicing/invoicingCustomerDetailView/fetchInvoicingCustomerDetailPageEpic.js +2 -2
- package/lib/view/invoicing/invoicingCustomerDetailView/invoicingCustomerDetailViewSelector.js +1 -1
- package/lib/view/invoicing/invoicingCustomerListView/invoicingCustomerListViewSelector.d.ts +3 -1
- package/lib/view/invoicing/invoicingCustomerListView/invoicingCustomerListViewSelector.js +8 -2
- package/lib/view/invoicing/invoicingCustomerListView/invoicingCustomerListViewState.d.ts +0 -7
- package/lib/view/invoicing/invoicingCustomerListView/invoicingCustomerListViewState.js +1 -10
- package/lib/view/invoicing/invoicingDunningCaseListView/invoicingDunningCaseListViewReducer.d.ts +1 -1
- package/lib/view/invoicing/invoicingDunningCaseListView/invoicingDunningCaseListViewSelector.d.ts +3 -1
- package/lib/view/invoicing/invoicingDunningCaseListView/invoicingDunningCaseListViewSelector.js +7 -2
- package/lib/view/invoicing/invoicingDunningCaseListView/invoicingDunningCaseListViewState.d.ts +2 -9
- package/lib/view/invoicing/invoicingDunningCaseListView/invoicingDunningCaseListViewState.js +2 -10
- package/lib/view/invoicing/invoicingSubscriptionListView/invoicingSubscriptionListViewSelector.d.ts +7 -1
- package/lib/view/invoicing/invoicingSubscriptionListView/invoicingSubscriptionListViewSelector.js +10 -2
- package/lib/view/invoicing/invoicingSubscriptionListView/invoicingSubscriptionListViewState.d.ts +0 -7
- package/lib/view/invoicing/invoicingSubscriptionListView/invoicingSubscriptionListViewState.js +1 -10
- package/lib/view/invoicing/invoicingTabHelper.d.ts +27 -0
- package/lib/view/invoicing/invoicingTabHelper.js +30 -0
- 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 +4 -4
- package/lib/view/invoicing/invoicingTransactionListView/invoicingTransactionListViewSelector.d.ts +8 -0
- package/lib/view/invoicing/invoicingTransactionListView/invoicingTransactionListViewSelector.js +11 -3
- package/lib/view/invoicing/invoicingTransactionListView/invoicingTransactionListViewState.d.ts +10 -10
- package/lib/view/invoicing/invoicingTransactionListView/invoicingTransactionListViewState.js +13 -10
- package/lib/view/invoicing/issueCreditNote/issueCreditNoteFormConfig.d.ts +0 -2
- package/lib/view/invoicing/issueCreditNote/issueCreditNoteFormConfig.js +2 -9
- package/lib/view/invoicing/issueCreditNote/issueCreditNotePayload.d.ts +2 -2
- package/lib/view/invoicing/issueCreditNote/issueCreditNotePayload.js +5 -1
- package/lib/view/invoicing/issueCreditNote/issueCreditNoteSelector.d.ts +3 -1
- package/lib/view/invoicing/issueCreditNote/issueCreditNoteSelector.js +4 -1
- package/lib/view/invoicing/issueCreditNote/issueCreditNoteState.d.ts +6 -0
- package/lib/view/invoicing/recordPayment/recordPaymentFormConfig.d.ts +0 -6
- package/lib/view/invoicing/recordPayment/recordPaymentFormConfig.js +1 -27
- package/lib/view/invoicing/recordPayment/recordPaymentSelector.d.ts +3 -2
- package/lib/view/invoicing/recordPayment/recordPaymentSelector.js +26 -6
- package/lib/view/invoicing/settingsView/settingsViewSelector.d.ts +11 -1
- package/lib/view/invoicing/settingsView/settingsViewSelector.js +7 -1
- package/package.json +1 -1
- package/lib/entity/invoicing/coupon/couponConstants.d.ts +0 -11
- package/lib/entity/invoicing/coupon/couponConstants.js +0 -29
- package/lib/esm/entity/invoicing/coupon/couponConstants.js +0 -26
package/lib/view/invoicing/invoicingSubscriptionListView/invoicingSubscriptionListViewState.d.ts
CHANGED
|
@@ -25,13 +25,6 @@ export declare const INVOICING_SUBSCRIPTION_COLUMNS: InvoicingSubscriptionColumn
|
|
|
25
25
|
export declare const ALL_INVOICING_SUBSCRIPTION_TAB_IDS: readonly ["all", "active", "in_trial", "future", "non_renewing", "paused", "cancelled"];
|
|
26
26
|
export declare const toInvoicingSubscriptionTabId: (v: string) => "cancelled" | "active" | "future" | "in_trial" | "non_renewing" | "paused" | "all";
|
|
27
27
|
export type InvoicingSubscriptionTabId = ReturnType<typeof toInvoicingSubscriptionTabId>;
|
|
28
|
-
/**
|
|
29
|
-
* Ordered filter-tab id set owned by CES so the subscription-list tabs live next
|
|
30
|
-
* to the model rather than being hardcoded in web-components. Tab labels and the
|
|
31
|
-
* per-tab count lookup stay in the view layer; this only carries the id set and
|
|
32
|
-
* display order.
|
|
33
|
-
*/
|
|
34
|
-
export declare const INVOICING_SUBSCRIPTION_TABS: InvoicingSubscriptionTabId[];
|
|
35
28
|
export interface InvoicingSubscriptionListViewState extends FetchedState {
|
|
36
29
|
/** Selected status tab (CES-owned so it persists across page revisits). */
|
|
37
30
|
activeTab: InvoicingSubscriptionTabId;
|
package/lib/view/invoicing/invoicingSubscriptionListView/invoicingSubscriptionListViewState.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.toInvoicingSubscriptionTabId = exports.ALL_INVOICING_SUBSCRIPTION_TAB_IDS = exports.INVOICING_SUBSCRIPTION_COLUMNS = exports.toInvoicingSubscriptionSortKey = exports.ALL_INVOICING_SUBSCRIPTION_SORT_KEYS = void 0;
|
|
4
4
|
const stringToUnion_1 = require("../../../commonStateTypes/stringToUnion");
|
|
5
5
|
exports.ALL_INVOICING_SUBSCRIPTION_SORT_KEYS = [
|
|
6
6
|
'subscription',
|
|
@@ -37,12 +37,3 @@ exports.ALL_INVOICING_SUBSCRIPTION_TAB_IDS = [
|
|
|
37
37
|
];
|
|
38
38
|
const toInvoicingSubscriptionTabId = (v) => (0, stringToUnion_1.stringToUnion)(v, exports.ALL_INVOICING_SUBSCRIPTION_TAB_IDS);
|
|
39
39
|
exports.toInvoicingSubscriptionTabId = toInvoicingSubscriptionTabId;
|
|
40
|
-
/**
|
|
41
|
-
* Ordered filter-tab id set owned by CES so the subscription-list tabs live next
|
|
42
|
-
* to the model rather than being hardcoded in web-components. Tab labels and the
|
|
43
|
-
* per-tab count lookup stay in the view layer; this only carries the id set and
|
|
44
|
-
* display order.
|
|
45
|
-
*/
|
|
46
|
-
exports.INVOICING_SUBSCRIPTION_TABS = [
|
|
47
|
-
...exports.ALL_INVOICING_SUBSCRIPTION_TAB_IDS,
|
|
48
|
-
];
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { InvoicingNamedOption } from '../../entity/invoicing/invoicingCommonPayload';
|
|
2
|
+
export interface InvoicingTabIdsFromConfigParams<TabId extends string> {
|
|
3
|
+
/**
|
|
4
|
+
* The `as const` id set that backs the tab-id union. Used as the fallback
|
|
5
|
+
* before config lands, so the tabs are never empty on first paint.
|
|
6
|
+
*/
|
|
7
|
+
allTabIds: readonly TabId[];
|
|
8
|
+
/** The config status/type list that decides membership and order. */
|
|
9
|
+
statusOptions: InvoicingNamedOption[] | undefined;
|
|
10
|
+
/**
|
|
11
|
+
* FE-derived tabs that are not backend statuses and so never appear in config
|
|
12
|
+
* (the customer list's `trial` / `at_risk`, the discount list's `inactive`).
|
|
13
|
+
* Appended after the config-driven ids, preserving today's display order.
|
|
14
|
+
*/
|
|
15
|
+
localTabIds?: readonly TabId[];
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Build a list's filter-tab ids from the config option list rather than a
|
|
19
|
+
* hardcoded array, so adding a status backend-side widens the tabs.
|
|
20
|
+
*
|
|
21
|
+
* `all` always leads and is never taken from config. Codes config sends that the
|
|
22
|
+
* tab-id union does not know still render: the union types state, the per-tab
|
|
23
|
+
* cache and URL parsing, but it is a frontend snapshot of a backend enum, and
|
|
24
|
+
* dropping unknown codes would silently hide a status the backend already has —
|
|
25
|
+
* the exact drift this is meant to end.
|
|
26
|
+
*/
|
|
27
|
+
export declare function invoicingTabIdsFromConfig<TabId extends string>({ allTabIds, localTabIds, statusOptions, }: InvoicingTabIdsFromConfigParams<TabId>): TabId[];
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.invoicingTabIdsFromConfig = invoicingTabIdsFromConfig;
|
|
4
|
+
const invoicingCommonPayload_1 = require("../../entity/invoicing/invoicingCommonPayload");
|
|
5
|
+
/** Every list's leading "show everything" tab; FE-owned, never a backend status. */
|
|
6
|
+
const ALL_TAB_ID = 'all';
|
|
7
|
+
/**
|
|
8
|
+
* Build a list's filter-tab ids from the config option list rather than a
|
|
9
|
+
* hardcoded array, so adding a status backend-side widens the tabs.
|
|
10
|
+
*
|
|
11
|
+
* `all` always leads and is never taken from config. Codes config sends that the
|
|
12
|
+
* tab-id union does not know still render: the union types state, the per-tab
|
|
13
|
+
* cache and URL parsing, but it is a frontend snapshot of a backend enum, and
|
|
14
|
+
* dropping unknown codes would silently hide a status the backend already has —
|
|
15
|
+
* the exact drift this is meant to end.
|
|
16
|
+
*/
|
|
17
|
+
function invoicingTabIdsFromConfig({ allTabIds, localTabIds = [], statusOptions, }) {
|
|
18
|
+
// Nullish as well as empty: a partial test state or a draft persisted before
|
|
19
|
+
// these lists existed can leave it undefined.
|
|
20
|
+
if (statusOptions == null || statusOptions.length === 0) {
|
|
21
|
+
return [...allTabIds];
|
|
22
|
+
}
|
|
23
|
+
const configTabIds = (0, invoicingCommonPayload_1.invoicingOptionCodes)(statusOptions)
|
|
24
|
+
.filter((code) => code !== ALL_TAB_ID)
|
|
25
|
+
// A config code outside the union is still a valid tab at runtime — the
|
|
26
|
+
// caches key off the string — so it is admitted rather than dropped.
|
|
27
|
+
.map((code) => code);
|
|
28
|
+
const ordered = [ALL_TAB_ID, ...configTabIds, ...localTabIds];
|
|
29
|
+
return Array.from(new Set(ordered));
|
|
30
|
+
}
|
|
@@ -4,6 +4,7 @@ exports.fetchInvoicingTransactionListPageEpic = void 0;
|
|
|
4
4
|
const rxjs_1 = require("rxjs");
|
|
5
5
|
const operators_1 = require("rxjs/operators");
|
|
6
6
|
const invoicingTransactionListViewReducer_1 = require("../invoicingTransactionListViewReducer");
|
|
7
|
+
const invoicingTransactionListViewState_1 = require("../invoicingTransactionListViewState");
|
|
7
8
|
/**
|
|
8
9
|
* Fetch unless the endpoint is already loaded or in flight — or always when the
|
|
9
10
|
* caller forces a refresh via `cacheOverride` (e.g. on a filter/sort change).
|
|
@@ -19,7 +20,7 @@ const shouldFetch = (fetchStateAndError, cacheOverride) => cacheOverride ||
|
|
|
19
20
|
const fetchInvoicingTransactionListPageEpic = (actions$, state$) => actions$.pipe((0, operators_1.filter)(invoicingTransactionListViewReducer_1.fetchInvoicingTransactionListPage.match), (0, operators_1.mergeMap)((action) => {
|
|
20
21
|
const { cacheOverride, filters, sort } = action.payload;
|
|
21
22
|
const state = state$.value.invoicingTransactionListViewState;
|
|
22
|
-
const activeTabState = state.byTab[state.activeTab];
|
|
23
|
+
const activeTabState = state.byTab[state.activeTab] ?? (0, invoicingTransactionListViewState_1.makeInvoicingTransactionTabState)();
|
|
23
24
|
const pageActions = [];
|
|
24
25
|
if (shouldFetch({ fetchState: activeTabState.fetchState, error: activeTabState.error }, cacheOverride)) {
|
|
25
26
|
pageActions.push((0, invoicingTransactionListViewReducer_1.fetchInvoicingTransactionList)({ filters, sort }));
|
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">, 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">;
|
|
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" | "excess_transfer", "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;
|
package/lib/view/invoicing/invoicingTransactionListView/invoicingTransactionListViewReducer.js
CHANGED
|
@@ -26,7 +26,7 @@ const invoicingTransactionListView = (0, toolkit_1.createSlice)({
|
|
|
26
26
|
reducers: {
|
|
27
27
|
fetchInvoicingTransactionList: {
|
|
28
28
|
reducer(draft, action) {
|
|
29
|
-
const tab = draft.byTab
|
|
29
|
+
const tab = (0, invoicingTransactionListViewState_1.invoicingTransactionTabStateFor)(draft.byTab, draft.activeTab);
|
|
30
30
|
if (!action.payload.keepExistingListItems) {
|
|
31
31
|
tab.ids = [];
|
|
32
32
|
tab.nextCursor = null;
|
|
@@ -69,7 +69,7 @@ const invoicingTransactionListView = (0, toolkit_1.createSlice)({
|
|
|
69
69
|
},
|
|
70
70
|
},
|
|
71
71
|
updateInvoicingTransactionList(draft, action) {
|
|
72
|
-
const tab = draft.byTab
|
|
72
|
+
const tab = (0, invoicingTransactionListViewState_1.invoicingTransactionTabStateFor)(draft.byTab, draft.activeTab);
|
|
73
73
|
tab.ids = action.payload.keepExistingListItems
|
|
74
74
|
? [...new Set([...tab.ids, ...action.payload.ids])]
|
|
75
75
|
: action.payload.ids;
|
|
@@ -78,7 +78,7 @@ const invoicingTransactionListView = (0, toolkit_1.createSlice)({
|
|
|
78
78
|
tab.error = undefined;
|
|
79
79
|
},
|
|
80
80
|
updateInvoicingTransactionListFailure(draft, action) {
|
|
81
|
-
const tab = draft.byTab
|
|
81
|
+
const tab = (0, invoicingTransactionListViewState_1.invoicingTransactionTabStateFor)(draft.byTab, draft.activeTab);
|
|
82
82
|
tab.fetchState = 'Error';
|
|
83
83
|
tab.error = action.payload;
|
|
84
84
|
},
|
|
@@ -98,7 +98,7 @@ const invoicingTransactionListView = (0, toolkit_1.createSlice)({
|
|
|
98
98
|
addInvoicingTransactionToList(draft, action) {
|
|
99
99
|
const id = action.payload;
|
|
100
100
|
const prependTo = (tabId) => {
|
|
101
|
-
const tab = draft.byTab
|
|
101
|
+
const tab = (0, invoicingTransactionListViewState_1.invoicingTransactionTabStateFor)(draft.byTab, tabId);
|
|
102
102
|
if (!tab.ids.includes(id)) {
|
|
103
103
|
tab.ids = [id, ...tab.ids];
|
|
104
104
|
}
|
package/lib/view/invoicing/invoicingTransactionListView/invoicingTransactionListViewSelector.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { SelectorView } from '../../../commonStateTypes/viewAndReport/viewAndReport';
|
|
2
|
+
import { InvoicingNamedOption } from '../../../entity/invoicing/invoicingCommonPayload';
|
|
2
3
|
import { InvoicingTransaction } from '../../../entity/invoicing/invoicingTransaction/invoicingTransactionState';
|
|
3
4
|
import { RootState } from '../../../reducer';
|
|
4
5
|
import { InvoicingListSort } from '../invoicingApiHelper';
|
|
@@ -8,8 +9,15 @@ export interface InvoicingTransactionListView extends SelectorView {
|
|
|
8
9
|
columns: InvoicingTransactionColumnConfig[];
|
|
9
10
|
filters: InvoicingTransactionFilters;
|
|
10
11
|
nextCursor: string | null;
|
|
12
|
+
/**
|
|
13
|
+
* Config lists this page labels from. Tabs on this list are transaction
|
|
14
|
+
* *types*, while row badges show transaction *status*, so both are exposed —
|
|
15
|
+
* conflating them left status badges with no names to resolve against.
|
|
16
|
+
*/
|
|
17
|
+
statusOptions: InvoicingNamedOption[];
|
|
11
18
|
tabIds: InvoicingTransactionTabId[];
|
|
12
19
|
transactions: InvoicingTransaction[];
|
|
20
|
+
typeOptions: InvoicingNamedOption[];
|
|
13
21
|
sort?: InvoicingListSort;
|
|
14
22
|
}
|
|
15
23
|
/**
|
package/lib/view/invoicing/invoicingTransactionListView/invoicingTransactionListViewSelector.js
CHANGED
|
@@ -3,14 +3,16 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.getInvoicingTransactionListView = void 0;
|
|
4
4
|
const toolkit_1 = require("@reduxjs/toolkit");
|
|
5
5
|
const invoicingTransactionSelector_1 = require("../../../entity/invoicing/invoicingTransaction/invoicingTransactionSelector");
|
|
6
|
+
const invoicingTabHelper_1 = require("../invoicingTabHelper");
|
|
6
7
|
const invoicingTransactionListViewState_1 = require("./invoicingTransactionListViewState");
|
|
7
8
|
/**
|
|
8
9
|
* Memoized so the denormalized `transactions` array (and the wrapping view
|
|
9
10
|
* object) keep referential identity until the transaction entity slice or the
|
|
10
11
|
* list-view slice actually change.
|
|
11
12
|
*/
|
|
12
|
-
exports.getInvoicingTransactionListView = (0, toolkit_1.createSelector)((state) => state.invoicingTransactionState, (state) => state.invoicingTransactionListViewState, (transactionState, listViewState) => {
|
|
13
|
-
const activeTabState = listViewState.byTab[listViewState.activeTab]
|
|
13
|
+
exports.getInvoicingTransactionListView = (0, toolkit_1.createSelector)((state) => state.invoicingTransactionState, (state) => state.invoicingTransactionListViewState, (state) => state.invoicingConfigViewState.transactionTypeOptions, (state) => state.invoicingConfigViewState.transactionStatusOptions, (transactionState, listViewState, typeOptions, statusOptions) => {
|
|
14
|
+
const activeTabState = listViewState.byTab[listViewState.activeTab] ??
|
|
15
|
+
(0, invoicingTransactionListViewState_1.makeInvoicingTransactionTabState)();
|
|
14
16
|
return {
|
|
15
17
|
activeTab: listViewState.activeTab,
|
|
16
18
|
columns: invoicingTransactionListViewState_1.INVOICING_TRANSACTION_COLUMNS,
|
|
@@ -19,7 +21,13 @@ exports.getInvoicingTransactionListView = (0, toolkit_1.createSelector)((state)
|
|
|
19
21
|
nextCursor: activeTabState.nextCursor,
|
|
20
22
|
fetchState: activeTabState.fetchState,
|
|
21
23
|
error: activeTabState.error,
|
|
22
|
-
|
|
24
|
+
statusOptions,
|
|
25
|
+
typeOptions,
|
|
26
|
+
// Tabs are types on this list, so the type list drives membership.
|
|
27
|
+
tabIds: (0, invoicingTabHelper_1.invoicingTabIdsFromConfig)({
|
|
28
|
+
allTabIds: invoicingTransactionListViewState_1.ALL_INVOICING_TRANSACTION_TAB_IDS,
|
|
29
|
+
statusOptions: typeOptions,
|
|
30
|
+
}),
|
|
23
31
|
sort: listViewState.sort,
|
|
24
32
|
version: 1.0,
|
|
25
33
|
};
|
package/lib/view/invoicing/invoicingTransactionListView/invoicingTransactionListViewState.d.ts
CHANGED
|
@@ -20,16 +20,9 @@ export interface InvoicingTransactionColumnConfig {
|
|
|
20
20
|
sortable: boolean;
|
|
21
21
|
}
|
|
22
22
|
export declare const INVOICING_TRANSACTION_COLUMNS: InvoicingTransactionColumnConfig[];
|
|
23
|
-
export declare const ALL_INVOICING_TRANSACTION_TAB_IDS: readonly ["all", "payment", "refund", "authorization", "payment_reversal"];
|
|
24
|
-
export declare const toInvoicingTransactionTabId: (v: string) => "refund" | "payment" | "all" | "authorization" | "payment_reversal";
|
|
23
|
+
export declare const ALL_INVOICING_TRANSACTION_TAB_IDS: readonly ["all", "payment", "refund", "authorization", "payment_reversal", "excess_transfer"];
|
|
24
|
+
export declare const toInvoicingTransactionTabId: (v: string) => "refund" | "payment" | "all" | "authorization" | "payment_reversal" | "excess_transfer";
|
|
25
25
|
export type InvoicingTransactionTabId = ReturnType<typeof toInvoicingTransactionTabId>;
|
|
26
|
-
/**
|
|
27
|
-
* Ordered filter-tab id set owned by CES so the transaction-list tabs live next
|
|
28
|
-
* to the model rather than being hardcoded in web-components. Tab labels and the
|
|
29
|
-
* per-tab count lookup stay in the view layer; this only carries the id set and
|
|
30
|
-
* display order.
|
|
31
|
-
*/
|
|
32
|
-
export declare const INVOICING_TRANSACTION_TABS: InvoicingTransactionTabId[];
|
|
33
26
|
/**
|
|
34
27
|
* Per-tab cache slice. Each `type` tab is a separate server query (the backend
|
|
35
28
|
* filters by `type`), so its loaded ids, pagination cursor and fetch state are
|
|
@@ -39,7 +32,12 @@ export interface InvoicingTransactionTabState extends FetchStateAndError {
|
|
|
39
32
|
ids: ID[];
|
|
40
33
|
nextCursor: string | null;
|
|
41
34
|
}
|
|
42
|
-
|
|
35
|
+
/**
|
|
36
|
+
* Per-tab cache. `Partial` because the tab set comes from `/1.0/config`: a type
|
|
37
|
+
* the backend added that this build's tab-id union does not know still renders a
|
|
38
|
+
* tab, and its entry is created on first use rather than pre-seeded.
|
|
39
|
+
*/
|
|
40
|
+
export type InvoicingTransactionIdsByTab = Partial<Record<InvoicingTransactionTabId, InvoicingTransactionTabState>>;
|
|
43
41
|
export interface InvoicingTransactionListViewState {
|
|
44
42
|
/** Selected type tab (CES-owned so it persists across page revisits). */
|
|
45
43
|
activeTab: InvoicingTransactionTabId;
|
|
@@ -51,4 +49,6 @@ export interface InvoicingTransactionListViewState {
|
|
|
51
49
|
sort?: InvoicingListSort;
|
|
52
50
|
}
|
|
53
51
|
export declare const makeInvoicingTransactionTabState: () => InvoicingTransactionTabState;
|
|
52
|
+
/** The cache entry for a tab, created on first use. */
|
|
53
|
+
export declare const invoicingTransactionTabStateFor: (byTab: InvoicingTransactionIdsByTab, tabId: InvoicingTransactionTabId) => InvoicingTransactionTabState;
|
|
54
54
|
export declare const makeInvoicingTransactionIdsByTab: () => InvoicingTransactionIdsByTab;
|
package/lib/view/invoicing/invoicingTransactionListView/invoicingTransactionListViewState.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.makeInvoicingTransactionIdsByTab = exports.
|
|
3
|
+
exports.makeInvoicingTransactionIdsByTab = exports.invoicingTransactionTabStateFor = exports.makeInvoicingTransactionTabState = exports.toInvoicingTransactionTabId = exports.ALL_INVOICING_TRANSACTION_TAB_IDS = exports.INVOICING_TRANSACTION_COLUMNS = exports.toInvoicingTransactionSortKey = exports.ALL_INVOICING_TRANSACTION_SORT_KEYS = void 0;
|
|
4
4
|
const stringToUnion_1 = require("../../../commonStateTypes/stringToUnion");
|
|
5
5
|
exports.ALL_INVOICING_TRANSACTION_SORT_KEYS = [
|
|
6
6
|
'transaction',
|
|
@@ -30,18 +30,10 @@ exports.ALL_INVOICING_TRANSACTION_TAB_IDS = [
|
|
|
30
30
|
'refund',
|
|
31
31
|
'authorization',
|
|
32
32
|
'payment_reversal',
|
|
33
|
+
'excess_transfer',
|
|
33
34
|
];
|
|
34
35
|
const toInvoicingTransactionTabId = (v) => (0, stringToUnion_1.stringToUnion)(v, exports.ALL_INVOICING_TRANSACTION_TAB_IDS);
|
|
35
36
|
exports.toInvoicingTransactionTabId = toInvoicingTransactionTabId;
|
|
36
|
-
/**
|
|
37
|
-
* Ordered filter-tab id set owned by CES so the transaction-list tabs live next
|
|
38
|
-
* to the model rather than being hardcoded in web-components. Tab labels and the
|
|
39
|
-
* per-tab count lookup stay in the view layer; this only carries the id set and
|
|
40
|
-
* display order.
|
|
41
|
-
*/
|
|
42
|
-
exports.INVOICING_TRANSACTION_TABS = [
|
|
43
|
-
...exports.ALL_INVOICING_TRANSACTION_TAB_IDS,
|
|
44
|
-
];
|
|
45
37
|
const makeInvoicingTransactionTabState = () => ({
|
|
46
38
|
ids: [],
|
|
47
39
|
nextCursor: null,
|
|
@@ -49,6 +41,17 @@ const makeInvoicingTransactionTabState = () => ({
|
|
|
49
41
|
error: undefined,
|
|
50
42
|
});
|
|
51
43
|
exports.makeInvoicingTransactionTabState = makeInvoicingTransactionTabState;
|
|
44
|
+
/** The cache entry for a tab, created on first use. */
|
|
45
|
+
const invoicingTransactionTabStateFor = (byTab, tabId) => {
|
|
46
|
+
const existing = byTab[tabId];
|
|
47
|
+
if (existing != null) {
|
|
48
|
+
return existing;
|
|
49
|
+
}
|
|
50
|
+
const created = (0, exports.makeInvoicingTransactionTabState)();
|
|
51
|
+
byTab[tabId] = created;
|
|
52
|
+
return created;
|
|
53
|
+
};
|
|
54
|
+
exports.invoicingTransactionTabStateFor = invoicingTransactionTabStateFor;
|
|
52
55
|
const makeInvoicingTransactionIdsByTab = () => exports.ALL_INVOICING_TRANSACTION_TAB_IDS.reduce((acc, tabId) => {
|
|
53
56
|
acc[tabId] = (0, exports.makeInvoicingTransactionTabState)();
|
|
54
57
|
return acc;
|
|
@@ -1,4 +1,2 @@
|
|
|
1
1
|
import { IssueCreditNoteFormLocalData } from './issueCreditNoteState';
|
|
2
|
-
export declare const INVOICING_CREDIT_NOTE_REASON_CODES: readonly ["service_credit", "billing_error", "duplicate_charge", "pricing_correction", "goodwill", "other"];
|
|
3
|
-
export type InvoicingCreditNoteReasonCode = (typeof INVOICING_CREDIT_NOTE_REASON_CODES)[number];
|
|
4
2
|
export declare const initialIssueCreditNoteFormLocalData: (invoiceId?: string) => IssueCreditNoteFormLocalData;
|
|
@@ -1,17 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.initialIssueCreditNoteFormLocalData =
|
|
4
|
-
exports.INVOICING_CREDIT_NOTE_REASON_CODES = [
|
|
5
|
-
'service_credit',
|
|
6
|
-
'billing_error',
|
|
7
|
-
'duplicate_charge',
|
|
8
|
-
'pricing_correction',
|
|
9
|
-
'goodwill',
|
|
10
|
-
'other',
|
|
11
|
-
];
|
|
3
|
+
exports.initialIssueCreditNoteFormLocalData = void 0;
|
|
12
4
|
const initialIssueCreditNoteFormLocalData = (invoiceId = '') => ({
|
|
13
5
|
invoiceId,
|
|
14
6
|
lineItems: [],
|
|
15
7
|
reasonCode: '',
|
|
8
|
+
type: '',
|
|
16
9
|
});
|
|
17
10
|
exports.initialIssueCreditNoteFormLocalData = initialIssueCreditNoteFormLocalData;
|
|
@@ -13,16 +13,16 @@ export interface IssueCreditNoteLineItemRequest {
|
|
|
13
13
|
}
|
|
14
14
|
export interface IssueCreditNoteRequest {
|
|
15
15
|
line_items: IssueCreditNoteLineItemRequest[];
|
|
16
|
-
type: 'adjustment';
|
|
17
16
|
reason_code?: string;
|
|
17
|
+
type?: string;
|
|
18
18
|
}
|
|
19
19
|
export type IssueCreditNoteResponse = ZeniAPIResponse<InvoicingCreditNotePayload>;
|
|
20
20
|
export type CreateCreditNoteRequest = {
|
|
21
21
|
customer_id: string;
|
|
22
22
|
line_items: IssueCreditNoteLineItemRequest[];
|
|
23
|
-
type: 'adjustment';
|
|
24
23
|
reason_code?: string;
|
|
25
24
|
reference_invoice_id?: string;
|
|
25
|
+
type?: string;
|
|
26
26
|
};
|
|
27
27
|
export type CreateCreditNoteResponse = ZeniAPIResponse<InvoicingCreditNotePayload>;
|
|
28
28
|
export declare const computeIssueCreditNoteTotal: (lineItems: IssueCreditNoteLineItemDraft[]) => number;
|
|
@@ -27,16 +27,20 @@ const localDataToIssueCreditNotePayload = (localData) => {
|
|
|
27
27
|
};
|
|
28
28
|
});
|
|
29
29
|
const reasonCode = localData.reasonCode.trim();
|
|
30
|
+
// Optional-chained: a draft persisted before this field existed has no
|
|
31
|
+
// `type`, and the draft survives navigation.
|
|
32
|
+
const type = localData.type?.trim() ?? '';
|
|
30
33
|
return {
|
|
31
34
|
line_items: lineItems,
|
|
32
|
-
type: 'adjustment',
|
|
33
35
|
...(reasonCode !== '' ? { reason_code: reasonCode } : {}),
|
|
36
|
+
...(type !== '' ? { type } : {}),
|
|
34
37
|
};
|
|
35
38
|
};
|
|
36
39
|
exports.localDataToIssueCreditNotePayload = localDataToIssueCreditNotePayload;
|
|
37
40
|
const initializeIssueCreditNoteDraftFromInvoice = (invoice) => ({
|
|
38
41
|
invoiceId: invoice.id,
|
|
39
42
|
reasonCode: '',
|
|
43
|
+
type: '',
|
|
40
44
|
lineItems: (invoice.lineItems ?? []).map((lineItem) => ({
|
|
41
45
|
description: lineItem.description,
|
|
42
46
|
id: lineItem.id,
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { FetchStateAndError, ID } from '../../../commonStateTypes/common';
|
|
2
2
|
import { SelectorView } from '../../../commonStateTypes/viewAndReport/viewAndReport';
|
|
3
3
|
import { InvoicingInvoice } from '../../../entity/invoicing/invoice/invoiceState';
|
|
4
|
+
import { InvoicingNamedOption } from '../../../entity/invoicing/invoicingCommonPayload';
|
|
4
5
|
import { RootState } from '../../../reducer';
|
|
5
6
|
import { IssueCreditNoteFormLocalData } from './issueCreditNoteState';
|
|
6
7
|
/**
|
|
@@ -16,8 +17,9 @@ export interface IssueCreditNoteView extends SelectorView {
|
|
|
16
17
|
*/
|
|
17
18
|
isPageReady: boolean;
|
|
18
19
|
localData: IssueCreditNoteFormLocalData;
|
|
19
|
-
|
|
20
|
+
reasonCodeOptions: InvoicingNamedOption[];
|
|
20
21
|
submitState: FetchStateAndError;
|
|
22
|
+
typeOptions: InvoicingNamedOption[];
|
|
21
23
|
invoice?: InvoicingInvoice;
|
|
22
24
|
issuedCreditNoteId?: ID;
|
|
23
25
|
}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getIssueCreditNoteView = void 0;
|
|
4
4
|
const invoiceDetailSelector_1 = require("../invoiceDetail/invoiceDetailSelector");
|
|
5
|
+
const invoicingConfigViewSelector_1 = require("../invoicingConfigView/invoicingConfigViewSelector");
|
|
5
6
|
const issueCreditNoteFormConfig_1 = require("./issueCreditNoteFormConfig");
|
|
6
7
|
/**
|
|
7
8
|
* The draft is a single global slice, so a draft seeded for a previously opened
|
|
@@ -13,6 +14,7 @@ const getIssueCreditNoteView = (state, invoiceId) => {
|
|
|
13
14
|
const invoiceView = (0, invoiceDetailSelector_1.getInvoiceDetail)(state, invoiceId);
|
|
14
15
|
const { draft, error, fetchState, issuedCreditNoteId } = state.invoicingIssueCreditNoteState;
|
|
15
16
|
const isDraftForInvoice = draft.invoiceId === invoiceId;
|
|
17
|
+
const { creditNoteReasonCodeOptions, creditNoteTypeOptions } = (0, invoicingConfigViewSelector_1.getInvoicingConfigView)(state);
|
|
16
18
|
return {
|
|
17
19
|
invoice: invoiceView.invoice,
|
|
18
20
|
isPageReady: invoiceView.fetchState === 'Completed' &&
|
|
@@ -22,8 +24,9 @@ const getIssueCreditNoteView = (state, invoiceId) => {
|
|
|
22
24
|
localData: isDraftForInvoice
|
|
23
25
|
? draft
|
|
24
26
|
: (0, issueCreditNoteFormConfig_1.initialIssueCreditNoteFormLocalData)(invoiceId),
|
|
25
|
-
|
|
27
|
+
reasonCodeOptions: creditNoteReasonCodeOptions,
|
|
26
28
|
submitState: { error, fetchState },
|
|
29
|
+
typeOptions: creditNoteTypeOptions,
|
|
27
30
|
error: invoiceView.error,
|
|
28
31
|
fetchState: invoiceView.fetchState,
|
|
29
32
|
version: 1.0,
|
|
@@ -13,6 +13,12 @@ export interface IssueCreditNoteFormLocalData {
|
|
|
13
13
|
invoiceId: ID;
|
|
14
14
|
lineItems: IssueCreditNoteLineItemDraft[];
|
|
15
15
|
reasonCode: string;
|
|
16
|
+
/**
|
|
17
|
+
* Credit-note type code from `credit_note_type_options`. Empty until the user
|
|
18
|
+
* picks one; the payload then omits it and lets the backend default, rather
|
|
19
|
+
* than the client asserting `adjustment` for every credit note as it used to.
|
|
20
|
+
*/
|
|
21
|
+
type: string;
|
|
16
22
|
}
|
|
17
23
|
export interface IssueCreditNoteState extends FetchedState {
|
|
18
24
|
draft: IssueCreditNoteFormLocalData;
|
|
@@ -1,8 +1,2 @@
|
|
|
1
1
|
import { RecordPaymentFormLocalData } from './recordPaymentState';
|
|
2
|
-
/**
|
|
3
|
-
* Canonical value sets for the Record Payment form. CES owns the values;
|
|
4
|
-
* web-components maps each value to a localized label.
|
|
5
|
-
*/
|
|
6
|
-
export declare const INVOICING_PAYMENT_METHOD_VALUES: readonly ["card", "cash", "check", "bank_transfer", "direct_debit", "paypal_express_checkout", "apple_pay", "google_pay", "ach_credit", "sepa_credit", "other"];
|
|
7
|
-
export declare const INVOICING_PAYMENT_GATEWAY_VALUES: readonly ["stripe", "chargebee", "braintree", "paypal", "adyen", "razorpay", "other"];
|
|
8
2
|
export declare const initialRecordPaymentFormLocalData: RecordPaymentFormLocalData;
|
|
@@ -1,32 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.initialRecordPaymentFormLocalData =
|
|
4
|
-
/**
|
|
5
|
-
* Canonical value sets for the Record Payment form. CES owns the values;
|
|
6
|
-
* web-components maps each value to a localized label.
|
|
7
|
-
*/
|
|
8
|
-
exports.INVOICING_PAYMENT_METHOD_VALUES = [
|
|
9
|
-
'card',
|
|
10
|
-
'cash',
|
|
11
|
-
'check',
|
|
12
|
-
'bank_transfer',
|
|
13
|
-
'direct_debit',
|
|
14
|
-
'paypal_express_checkout',
|
|
15
|
-
'apple_pay',
|
|
16
|
-
'google_pay',
|
|
17
|
-
'ach_credit',
|
|
18
|
-
'sepa_credit',
|
|
19
|
-
'other',
|
|
20
|
-
];
|
|
21
|
-
exports.INVOICING_PAYMENT_GATEWAY_VALUES = [
|
|
22
|
-
'stripe',
|
|
23
|
-
'chargebee',
|
|
24
|
-
'braintree',
|
|
25
|
-
'paypal',
|
|
26
|
-
'adyen',
|
|
27
|
-
'razorpay',
|
|
28
|
-
'other',
|
|
29
|
-
];
|
|
3
|
+
exports.initialRecordPaymentFormLocalData = void 0;
|
|
30
4
|
exports.initialRecordPaymentFormLocalData = {
|
|
31
5
|
comment: '',
|
|
32
6
|
customerId: '',
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ID } from '../../../commonStateTypes/common';
|
|
2
2
|
import { SelectorView } from '../../../commonStateTypes/viewAndReport/viewAndReport';
|
|
3
|
+
import { InvoicingNamedOption } from '../../../entity/invoicing/invoicingCommonPayload';
|
|
3
4
|
import { RootState } from '../../../reducer';
|
|
4
5
|
import { RecordPaymentFormLocalData } from './recordPaymentState';
|
|
5
6
|
export interface InvoicingRecordPaymentView extends SelectorView {
|
|
@@ -16,9 +17,9 @@ export declare const getRecordPaymentView: (state: RootState) => InvoicingRecord
|
|
|
16
17
|
* CES-owned payment-method / gateway value sets, and the submit fetch state.
|
|
17
18
|
*/
|
|
18
19
|
export interface RecordPaymentFormView extends SelectorView {
|
|
19
|
-
|
|
20
|
+
gatewayOptions: InvoicingNamedOption[];
|
|
20
21
|
localData: RecordPaymentFormLocalData;
|
|
21
|
-
|
|
22
|
+
paymentMethodOptions: InvoicingNamedOption[];
|
|
22
23
|
contextInvoiceId?: ID;
|
|
23
24
|
}
|
|
24
25
|
export declare const getRecordPaymentFormView: (state: RootState) => RecordPaymentFormView;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getRecordPaymentInvoiceOptions = exports.getRecordPaymentFormView = exports.getRecordPaymentView = void 0;
|
|
4
|
+
const invoicingCommonPayload_1 = require("../../../entity/invoicing/invoicingCommonPayload");
|
|
4
5
|
const invoiceListSelector_1 = require("../invoiceList/invoiceListSelector");
|
|
5
|
-
const
|
|
6
|
+
const invoicingConfigViewSelector_1 = require("../invoicingConfigView/invoicingConfigViewSelector");
|
|
6
7
|
/**
|
|
7
8
|
* Single bundled view for the record-payment submit lifecycle — carries the
|
|
8
9
|
* submit fetch state/error and the ids produced on success.
|
|
@@ -20,22 +21,40 @@ const getRecordPaymentView = (state) => {
|
|
|
20
21
|
exports.getRecordPaymentView = getRecordPaymentView;
|
|
21
22
|
const getRecordPaymentFormView = (state) => {
|
|
22
23
|
const { contextInvoiceId, error, fetchState, newPaymentDraft } = state.invoicingRecordPaymentState;
|
|
24
|
+
const { manualPaymentMethodOptions, paymentGatewayOptions } = (0, invoicingConfigViewSelector_1.getInvoicingConfigView)(state);
|
|
23
25
|
return {
|
|
24
26
|
contextInvoiceId,
|
|
25
|
-
|
|
27
|
+
gatewayOptions: paymentGatewayOptions,
|
|
26
28
|
localData: newPaymentDraft,
|
|
27
|
-
|
|
29
|
+
paymentMethodOptions: manualPaymentMethodOptions,
|
|
28
30
|
fetchState,
|
|
29
31
|
error,
|
|
30
32
|
version: 1.0,
|
|
31
33
|
};
|
|
32
34
|
};
|
|
33
35
|
exports.getRecordPaymentFormView = getRecordPaymentFormView;
|
|
34
|
-
|
|
36
|
+
/**
|
|
37
|
+
* Statuses that leave nothing to collect. Kept FE-local and expressed as an
|
|
38
|
+
* exclusion so that "unpaid" is derived from the config status list rather than
|
|
39
|
+
* an allowlist: a status the backend adds later counts as collectable and shows
|
|
40
|
+
* up in the picker instead of silently disappearing from it.
|
|
41
|
+
*/
|
|
42
|
+
const SETTLED_INVOICE_STATUSES = new Set([
|
|
43
|
+
'paid',
|
|
44
|
+
'voided',
|
|
45
|
+
]);
|
|
46
|
+
/** Fallback while `/1.0/config` has not landed, so the picker is never empty. */
|
|
47
|
+
const FALLBACK_UNPAID_INVOICE_STATUSES = [
|
|
35
48
|
'not_paid',
|
|
36
49
|
'partially_paid',
|
|
37
50
|
'payment_due',
|
|
38
|
-
]
|
|
51
|
+
];
|
|
52
|
+
const unpaidInvoiceStatuses = (invoiceStatusOptions) => {
|
|
53
|
+
if (invoiceStatusOptions.length === 0) {
|
|
54
|
+
return new Set(FALLBACK_UNPAID_INVOICE_STATUSES);
|
|
55
|
+
}
|
|
56
|
+
return new Set((0, invoicingCommonPayload_1.invoicingOptionCodes)(invoiceStatusOptions).filter((code) => !SETTLED_INVOICE_STATUSES.has(code)));
|
|
57
|
+
};
|
|
39
58
|
const getRecordPaymentInvoiceOptions = (state, customerId) => {
|
|
40
59
|
if (customerId === '') {
|
|
41
60
|
return [];
|
|
@@ -44,8 +63,9 @@ const getRecordPaymentInvoiceOptions = (state, customerId) => {
|
|
|
44
63
|
if (listView.filters.customerId !== customerId) {
|
|
45
64
|
return [];
|
|
46
65
|
}
|
|
66
|
+
const collectableStatuses = unpaidInvoiceStatuses((0, invoicingConfigViewSelector_1.getInvoicingConfigView)(state).invoiceStatusOptions);
|
|
47
67
|
return listView.invoices
|
|
48
|
-
.filter((invoice) =>
|
|
68
|
+
.filter((invoice) => collectableStatuses.has(invoice.status))
|
|
49
69
|
.filter((invoice) => (invoice.amountDue?.amount ?? 0) > 0)
|
|
50
70
|
.map((invoice) => ({
|
|
51
71
|
amountDue: invoice.amountDue?.amount ?? 0,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { FetchState, FetchStateAndError } from '../../../commonStateTypes/common';
|
|
2
|
-
import { InvoicingNamedOption, InvoicingQboAccountMappingKindOption, InvoicingSettingsPayload } from '../../../entity/invoicing/invoicingCommonPayload';
|
|
2
|
+
import { InvoicingDunningActionOption, InvoicingNamedOption, InvoicingQboAccountMappingKindOption, InvoicingSettingsPayload } from '../../../entity/invoicing/invoicingCommonPayload';
|
|
3
3
|
import { RootState } from '../../../reducer';
|
|
4
4
|
import { ZeniAPIStatus } from '../../../responsePayload';
|
|
5
5
|
import { InvoicingBrandingFormLocalData } from './invoicingBrandingFormConfig';
|
|
@@ -46,10 +46,20 @@ export interface InvoicingEnablePrerequisites {
|
|
|
46
46
|
export declare function deriveInvoicingEnablePrerequisites(settings: InvoicingSettingsPayload | undefined, isQboConnected: boolean, qboAccountMappingKindOptions: InvoicingQboAccountMappingKindOption[]): InvoicingEnablePrerequisites;
|
|
47
47
|
export interface InvoicingSettingsHubView {
|
|
48
48
|
canEnableInvoicing: boolean;
|
|
49
|
+
/**
|
|
50
|
+
* Config-owned lists and fetch state the settings hub renders, folded in so the
|
|
51
|
+
* screen reads this view instead of `getInvoicingConfigView`.
|
|
52
|
+
*/
|
|
53
|
+
configFetchState: FetchState;
|
|
54
|
+
dunningScheduleActionOptions: InvoicingDunningActionOption[];
|
|
49
55
|
isEnablingInvoicing: boolean;
|
|
50
56
|
isQboConfigured: boolean;
|
|
51
57
|
isStripeConnected: boolean;
|
|
58
|
+
qboAccountMappingKindOptions: InvoicingQboAccountMappingKindOption[];
|
|
59
|
+
qboCustomerMatchingOptions: InvoicingNamedOption[];
|
|
60
|
+
qboSyncStatusOptions: InvoicingNamedOption[];
|
|
52
61
|
status: string | undefined;
|
|
62
|
+
configError?: ZeniAPIStatus;
|
|
53
63
|
}
|
|
54
64
|
/**
|
|
55
65
|
* The settings hub's composite of everything it derives from the store: whether
|
|
@@ -79,11 +79,17 @@ function deriveInvoicingEnablePrerequisites(settings, isQboConnected, qboAccount
|
|
|
79
79
|
* and QBO slices read here are only fetched once a settings screen is mounted.
|
|
80
80
|
*/
|
|
81
81
|
const getInvoicingSettingsHubView = (state) => {
|
|
82
|
-
const { enableState, qboAccountMappingKindOptions, status } = (0, invoicingConfigViewSelector_1.getInvoicingConfigView)(state);
|
|
82
|
+
const { dunningScheduleActionOptions, enableState, error: configError, fetchState: configFetchState, qboAccountMappingKindOptions, qboCustomerMatchingOptions, qboSyncStatusOptions, status, } = (0, invoicingConfigViewSelector_1.getInvoicingConfigView)(state);
|
|
83
83
|
const { canEnable, isQboConfigured, isStripeConnected } = deriveInvoicingEnablePrerequisites(state.invoicingSettingsViewState.settings, state.invoicingQboViewState.connection?.connected === true, qboAccountMappingKindOptions);
|
|
84
84
|
return {
|
|
85
85
|
canEnableInvoicing: status === 'settings' && canEnable,
|
|
86
|
+
configError,
|
|
87
|
+
configFetchState,
|
|
88
|
+
dunningScheduleActionOptions,
|
|
86
89
|
isEnablingInvoicing: enableState.fetchState === 'In-Progress',
|
|
90
|
+
qboAccountMappingKindOptions,
|
|
91
|
+
qboCustomerMatchingOptions,
|
|
92
|
+
qboSyncStatusOptions,
|
|
87
93
|
isQboConfigured,
|
|
88
94
|
isStripeConnected,
|
|
89
95
|
status,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zeniai/client-epic-state",
|
|
3
|
-
"version": "5.1.
|
|
3
|
+
"version": "5.1.99",
|
|
4
4
|
"description": "Shared module between Web & Mobile containing required abstractions for state management, async network communication. ",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "lib/esm/index.js",
|