@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
|
@@ -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 { CreateCreditNoteFormLocalData } from './createCreditNoteState';
|
|
5
6
|
export interface InvoicingCreateCreditNoteView extends SelectorView {
|
|
@@ -8,6 +9,7 @@ export interface InvoicingCreateCreditNoteView extends SelectorView {
|
|
|
8
9
|
export declare const getCreateCreditNoteView: (state: RootState) => InvoicingCreateCreditNoteView;
|
|
9
10
|
export interface CreateCreditNoteFormView extends SelectorView {
|
|
10
11
|
localData: CreateCreditNoteFormLocalData;
|
|
11
|
-
|
|
12
|
+
reasonCodeOptions: InvoicingNamedOption[];
|
|
13
|
+
typeOptions: InvoicingNamedOption[];
|
|
12
14
|
}
|
|
13
15
|
export declare const getCreateCreditNoteFormView: (state: RootState) => CreateCreditNoteFormView;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getCreateCreditNoteFormView = exports.getCreateCreditNoteView = void 0;
|
|
4
|
-
const
|
|
4
|
+
const invoicingConfigViewSelector_1 = require("../invoicingConfigView/invoicingConfigViewSelector");
|
|
5
5
|
const getCreateCreditNoteView = (state) => {
|
|
6
6
|
const { createdCreditNoteId, error, fetchState } = state.invoicingCreateCreditNoteState;
|
|
7
7
|
return {
|
|
@@ -14,9 +14,11 @@ const getCreateCreditNoteView = (state) => {
|
|
|
14
14
|
exports.getCreateCreditNoteView = getCreateCreditNoteView;
|
|
15
15
|
const getCreateCreditNoteFormView = (state) => {
|
|
16
16
|
const { draft, error, fetchState } = state.invoicingCreateCreditNoteState;
|
|
17
|
+
const { creditNoteReasonCodeOptions, creditNoteTypeOptions } = (0, invoicingConfigViewSelector_1.getInvoicingConfigView)(state);
|
|
17
18
|
return {
|
|
18
19
|
localData: draft,
|
|
19
|
-
|
|
20
|
+
reasonCodeOptions: creditNoteReasonCodeOptions,
|
|
21
|
+
typeOptions: creditNoteTypeOptions,
|
|
20
22
|
error,
|
|
21
23
|
fetchState,
|
|
22
24
|
version: 1.0,
|
|
@@ -11,6 +11,12 @@ export interface CreateCreditNoteFormLocalData {
|
|
|
11
11
|
lineItems: CreateCreditNoteLineItemDraft[];
|
|
12
12
|
reasonCode: string;
|
|
13
13
|
referenceInvoiceId: string;
|
|
14
|
+
/**
|
|
15
|
+
* Credit-note type code from `credit_note_type_options`. Empty until the user
|
|
16
|
+
* picks one; the payload then omits it and lets the backend default, rather
|
|
17
|
+
* than the client asserting `adjustment` for every credit note as it used to.
|
|
18
|
+
*/
|
|
19
|
+
type: string;
|
|
14
20
|
}
|
|
15
21
|
export interface CreateCreditNoteState extends FetchedState {
|
|
16
22
|
draft: CreateCreditNoteFormLocalData;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { FetchStateAndError, ID } from '../../../commonStateTypes/common';
|
|
2
2
|
import { SelectorView } from '../../../commonStateTypes/viewAndReport/viewAndReport';
|
|
3
|
-
import { InvoicingNamedOptionsByKey } from '../../../entity/invoicing/invoicingCommonPayload';
|
|
3
|
+
import { InvoicingNamedOption, InvoicingNamedOptionsByKey } from '../../../entity/invoicing/invoicingCommonPayload';
|
|
4
4
|
import { InvoicingPlan } from '../../../entity/invoicing/plan/planState';
|
|
5
5
|
import { RootState } from '../../../reducer';
|
|
6
6
|
import { InvoicingCatalogItemKind } from '../invoicingCatalogItemDetailView/invoicingCatalogItemDetailViewState';
|
|
@@ -32,13 +32,13 @@ export interface InvoicingCatalogItemFormView extends SelectorView {
|
|
|
32
32
|
applicableItemOptions: ApplicableCatalogItemOption[];
|
|
33
33
|
localData: InvoicingCatalogItemFormLocalData;
|
|
34
34
|
mode: 'create' | 'edit';
|
|
35
|
-
|
|
35
|
+
periodUnitOptions: InvoicingNamedOption[];
|
|
36
36
|
pricingModelValues: readonly string[];
|
|
37
37
|
prorationValues: readonly string[];
|
|
38
38
|
tierTypeValues: readonly string[];
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
39
|
+
trialEndActionOptions: InvoicingNamedOption[];
|
|
40
|
+
trialUnitOptions: InvoicingNamedOption[];
|
|
41
|
+
typeOptions: InvoicingNamedOption[];
|
|
42
42
|
/**
|
|
43
43
|
* Backend tier-type choices per pricing model. Folded in here rather than left
|
|
44
44
|
* for the screen to pull off `getInvoicingConfigView` itself, so the form wires
|
|
@@ -54,19 +54,20 @@ const getInvoicingCatalogItemFormView = (state, id) => {
|
|
|
54
54
|
const applicableItemOptions = id != null
|
|
55
55
|
? allApplicableItemOptions.filter((option) => option.id !== id)
|
|
56
56
|
: allApplicableItemOptions;
|
|
57
|
+
const { billingPeriodUnitOptions, catalogItemTypeOptions, catalogTierTypeOptionsByPricingModel, catalogTrialEndActionOptions, catalogTrialUnitOptions, } = (0, invoicingConfigViewSelector_1.getInvoicingConfigView)(state);
|
|
57
58
|
return {
|
|
58
59
|
applicabilityValues: invoicingCatalogItemFormConfig_1.INVOICING_CATALOG_APPLICABILITY_VALUES,
|
|
59
60
|
applicableItemOptions,
|
|
60
61
|
localData,
|
|
61
62
|
mode: id != null ? 'edit' : 'create',
|
|
62
|
-
|
|
63
|
+
periodUnitOptions: billingPeriodUnitOptions,
|
|
63
64
|
pricingModelValues: invoicingCatalogItemFormConfig_1.INVOICING_CATALOG_PRICING_MODEL_VALUES,
|
|
64
65
|
prorationValues: invoicingCatalogItemFormConfig_1.INVOICING_CATALOG_PRORATION_VALUES,
|
|
65
66
|
tierTypeValues: invoicingCatalogItemFormConfig_1.INVOICING_CATALOG_TIER_TYPE_VALUES,
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
catalogTierTypeOptionsByPricingModel
|
|
67
|
+
trialEndActionOptions: catalogTrialEndActionOptions,
|
|
68
|
+
trialUnitOptions: catalogTrialUnitOptions,
|
|
69
|
+
typeOptions: catalogItemTypeOptions,
|
|
70
|
+
catalogTierTypeOptionsByPricingModel,
|
|
70
71
|
kind,
|
|
71
72
|
plan,
|
|
72
73
|
savedItemId,
|
package/lib/view/invoicing/editInvoicingCatalogItemDetailView/invoicingCatalogItemFormConfig.d.ts
CHANGED
|
@@ -2,15 +2,12 @@ import { InvoicingPlan } from '../../../entity/invoicing/plan/planState';
|
|
|
2
2
|
import { InvoicingProduct } from '../../../entity/invoicing/product/productState';
|
|
3
3
|
import { InvoicingCatalogItemFormLocalData, InvoicingCatalogItemFormSubFamily, InvoicingCatalogItemFormTier } from './editInvoicingCatalogItemDetailViewState';
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
6
|
-
*
|
|
5
|
+
* Value sets the catalog item form still owns locally: the backend has no enum
|
|
6
|
+
* for pricing model, tier type, proration or applicability yet, so these stay
|
|
7
|
+
* here until it does. Everything else on this form comes from `/1.0/config`.
|
|
7
8
|
*/
|
|
8
|
-
export declare const INVOICING_CATALOG_TYPE_VALUES: readonly ["plan", "addon", "charge"];
|
|
9
|
-
export declare const INVOICING_CATALOG_PERIOD_UNIT_VALUES: readonly ["day", "week", "month", "year"];
|
|
10
9
|
export declare const INVOICING_CATALOG_PRICING_MODEL_VALUES: readonly ["flat_fee", "per_unit", "tiered", "volume", "stairstep"];
|
|
11
10
|
export declare const INVOICING_CATALOG_TIER_TYPE_VALUES: readonly ["per_unit", "flat_fee", "package"];
|
|
12
|
-
export declare const INVOICING_CATALOG_TRIAL_UNIT_VALUES: readonly ["day", "month"];
|
|
13
|
-
export declare const INVOICING_CATALOG_TRIAL_END_ACTION_VALUES: readonly ["site_default", "activate_subscription", "cancel_subscription"];
|
|
14
11
|
export declare const INVOICING_CATALOG_PRORATION_VALUES: readonly ["site_default", "partial_term", "full_term"];
|
|
15
12
|
export declare const INVOICING_CATALOG_APPLICABILITY_VALUES: readonly ["all", "restricted"];
|
|
16
13
|
export declare const isTieredCatalogPricingModel: (model: string) => boolean;
|
package/lib/view/invoicing/editInvoicingCatalogItemDetailView/invoicingCatalogItemFormConfig.js
CHANGED
|
@@ -1,21 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.entityToInvoicingCatalogItemFormLocalData = exports.initialInvoicingCatalogItemFormLocalData = exports.invoicingProductToCatalogItemFormSubFamily = exports.blankInvoicingCatalogSubFamily = exports.blankInvoicingCatalogTier = exports.isTieredCatalogPricingModel = exports.INVOICING_CATALOG_APPLICABILITY_VALUES = exports.INVOICING_CATALOG_PRORATION_VALUES = exports.
|
|
3
|
+
exports.entityToInvoicingCatalogItemFormLocalData = exports.initialInvoicingCatalogItemFormLocalData = exports.invoicingProductToCatalogItemFormSubFamily = exports.blankInvoicingCatalogSubFamily = exports.blankInvoicingCatalogTier = exports.isTieredCatalogPricingModel = exports.INVOICING_CATALOG_APPLICABILITY_VALUES = exports.INVOICING_CATALOG_PRORATION_VALUES = exports.INVOICING_CATALOG_TIER_TYPE_VALUES = exports.INVOICING_CATALOG_PRICING_MODEL_VALUES = void 0;
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
6
|
-
*
|
|
5
|
+
* Value sets the catalog item form still owns locally: the backend has no enum
|
|
6
|
+
* for pricing model, tier type, proration or applicability yet, so these stay
|
|
7
|
+
* here until it does. Everything else on this form comes from `/1.0/config`.
|
|
7
8
|
*/
|
|
8
|
-
exports.INVOICING_CATALOG_TYPE_VALUES = [
|
|
9
|
-
'plan',
|
|
10
|
-
'addon',
|
|
11
|
-
'charge',
|
|
12
|
-
];
|
|
13
|
-
exports.INVOICING_CATALOG_PERIOD_UNIT_VALUES = [
|
|
14
|
-
'day',
|
|
15
|
-
'week',
|
|
16
|
-
'month',
|
|
17
|
-
'year',
|
|
18
|
-
];
|
|
19
9
|
exports.INVOICING_CATALOG_PRICING_MODEL_VALUES = [
|
|
20
10
|
'flat_fee',
|
|
21
11
|
'per_unit',
|
|
@@ -28,12 +18,6 @@ exports.INVOICING_CATALOG_TIER_TYPE_VALUES = [
|
|
|
28
18
|
'flat_fee',
|
|
29
19
|
'package',
|
|
30
20
|
];
|
|
31
|
-
exports.INVOICING_CATALOG_TRIAL_UNIT_VALUES = ['day', 'month'];
|
|
32
|
-
exports.INVOICING_CATALOG_TRIAL_END_ACTION_VALUES = [
|
|
33
|
-
'site_default',
|
|
34
|
-
'activate_subscription',
|
|
35
|
-
'cancel_subscription',
|
|
36
|
-
];
|
|
37
21
|
exports.INVOICING_CATALOG_PRORATION_VALUES = [
|
|
38
22
|
'site_default',
|
|
39
23
|
'partial_term',
|
package/lib/view/invoicing/editInvoicingCouponDetailView/editInvoicingCouponDetailViewSelector.d.ts
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
import { ID } from '../../../commonStateTypes/common';
|
|
1
|
+
import { FetchState, ID } from '../../../commonStateTypes/common';
|
|
2
2
|
import { SelectorView } from '../../../commonStateTypes/viewAndReport/viewAndReport';
|
|
3
|
-
import { InvoicingCouponApplyOn, InvoicingCouponDurationType, InvoicingCouponPeriodUnit, InvoicingDiscountType } from '../../../entity/invoicing/coupon/couponPayload';
|
|
4
3
|
import { InvoicingCoupon } from '../../../entity/invoicing/coupon/couponState';
|
|
5
|
-
import { InvoicingFormOption } from '../../../entity/invoicing/invoicingCommonPayload';
|
|
4
|
+
import { InvoicingDiscountLifecycleActionOption, InvoicingFormOption } from '../../../entity/invoicing/invoicingCommonPayload';
|
|
6
5
|
import { RootState } from '../../../reducer';
|
|
7
6
|
import { InvoicingCouponFormLocalData } from './editInvoicingCouponDetailViewState';
|
|
8
7
|
export interface EditInvoicingCouponDetailView extends SelectorView {
|
|
8
|
+
/** Config-owned; folded in so the screen reads one selector. */
|
|
9
|
+
configFetchState: FetchState;
|
|
10
|
+
discountLifecycleActionOptions: InvoicingDiscountLifecycleActionOption[];
|
|
9
11
|
coupon?: InvoicingCoupon;
|
|
10
12
|
savedCouponId?: ID;
|
|
11
13
|
}
|
|
@@ -16,12 +18,12 @@ export interface EditInvoicingCouponDetailView extends SelectorView {
|
|
|
16
18
|
*/
|
|
17
19
|
export declare const getEditInvoicingCouponDetailViewState: (state: RootState, couponId?: ID) => EditInvoicingCouponDetailView;
|
|
18
20
|
export interface InvoicingCouponFormView extends EditInvoicingCouponDetailView {
|
|
19
|
-
applyOnOptions:
|
|
20
|
-
discountTypeOptions:
|
|
21
|
-
durationTypeOptions:
|
|
21
|
+
applyOnOptions: InvoicingFormOption[];
|
|
22
|
+
discountTypeOptions: InvoicingFormOption[];
|
|
23
|
+
durationTypeOptions: InvoicingFormOption[];
|
|
22
24
|
localData: InvoicingCouponFormLocalData;
|
|
23
25
|
mode: 'create' | 'edit';
|
|
24
|
-
periodUnitOptions:
|
|
26
|
+
periodUnitOptions: InvoicingFormOption[];
|
|
25
27
|
}
|
|
26
28
|
/**
|
|
27
29
|
* Bundled view for the discount form screen: the edit view (save state + the
|
package/lib/view/invoicing/editInvoicingCouponDetailView/editInvoicingCouponDetailViewSelector.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getInvoicingCouponFormView = exports.getEditInvoicingCouponDetailViewState = void 0;
|
|
4
|
-
const couponConstants_1 = require("../../../entity/invoicing/coupon/couponConstants");
|
|
5
4
|
const couponSelector_1 = require("../../../entity/invoicing/coupon/couponSelector");
|
|
5
|
+
const invoicingCommonPayload_1 = require("../../../entity/invoicing/invoicingCommonPayload");
|
|
6
|
+
const invoicingConfigViewSelector_1 = require("../invoicingConfigView/invoicingConfigViewSelector");
|
|
6
7
|
const editInvoicingCouponDetailViewState_1 = require("./editInvoicingCouponDetailViewState");
|
|
7
8
|
/**
|
|
8
9
|
* Bundled view for the discount create/edit form: the save fetch state/error,
|
|
@@ -11,7 +12,10 @@ const editInvoicingCouponDetailViewState_1 = require("./editInvoicingCouponDetai
|
|
|
11
12
|
*/
|
|
12
13
|
const getEditInvoicingCouponDetailViewState = (state, couponId) => {
|
|
13
14
|
const { error, fetchState, savedCouponId } = state.editInvoicingCouponDetailViewState;
|
|
15
|
+
const { discountLifecycleActionOptions, fetchState: configFetchState } = (0, invoicingConfigViewSelector_1.getInvoicingConfigView)(state);
|
|
14
16
|
return {
|
|
17
|
+
configFetchState,
|
|
18
|
+
discountLifecycleActionOptions,
|
|
15
19
|
coupon: couponId != null
|
|
16
20
|
? (0, couponSelector_1.getInvoicingCouponById)(state.invoicingCouponState, couponId)
|
|
17
21
|
: undefined,
|
|
@@ -35,14 +39,15 @@ const getInvoicingCouponFormView = (state, couponId) => {
|
|
|
35
39
|
? (editDraftById[couponId] ??
|
|
36
40
|
(0, editInvoicingCouponDetailViewState_1.entityToInvoicingCouponFormLocalData)(base.coupon))
|
|
37
41
|
: newCouponDraft;
|
|
42
|
+
const { billingPeriodUnitOptions, discountApplyOnOptions, discountDurationTypeOptions, discountTypeOptions, } = (0, invoicingConfigViewSelector_1.getInvoicingConfigView)(state);
|
|
38
43
|
return {
|
|
39
44
|
...base,
|
|
40
|
-
applyOnOptions:
|
|
41
|
-
discountTypeOptions:
|
|
42
|
-
durationTypeOptions:
|
|
45
|
+
applyOnOptions: discountApplyOnOptions.map(invoicingCommonPayload_1.toInvoicingFormOption),
|
|
46
|
+
discountTypeOptions: discountTypeOptions.map(invoicingCommonPayload_1.toInvoicingFormOption),
|
|
47
|
+
durationTypeOptions: discountDurationTypeOptions.map(invoicingCommonPayload_1.toInvoicingFormOption),
|
|
43
48
|
localData,
|
|
44
49
|
mode: couponId != null ? 'edit' : 'create',
|
|
45
|
-
periodUnitOptions:
|
|
50
|
+
periodUnitOptions: billingPeriodUnitOptions.map(invoicingCommonPayload_1.toInvoicingFormOption),
|
|
46
51
|
};
|
|
47
52
|
};
|
|
48
53
|
exports.getInvoicingCouponFormView = getInvoicingCouponFormView;
|
|
@@ -1,13 +1,14 @@
|
|
|
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 { InvoicingCustomerFormLocalData } from './editInvoicingCustomerDetailViewState';
|
|
5
6
|
export interface InvoicingCustomerFormView extends SelectorView {
|
|
6
|
-
|
|
7
|
+
customerTypeOptions: InvoicingNamedOption[];
|
|
7
8
|
localData: InvoicingCustomerFormLocalData;
|
|
8
9
|
mode: 'create' | 'edit';
|
|
9
|
-
|
|
10
|
-
|
|
10
|
+
netTermDayOptions: InvoicingNamedOption[];
|
|
11
|
+
taxabilityOptions: InvoicingNamedOption[];
|
|
11
12
|
billingAddressId?: ID;
|
|
12
13
|
billingAddressLabel?: string;
|
|
13
14
|
savedCustomerId?: ID;
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.getInvoicingCustomerFormView = void 0;
|
|
4
4
|
const invoicingCustomerSelector_1 = require("../../../entity/invoicing/invoicingCustomer/invoicingCustomerSelector");
|
|
5
5
|
const addressViewSelector_1 = require("../../addressView/addressViewSelector");
|
|
6
|
+
const invoicingConfigViewSelector_1 = require("../invoicingConfigView/invoicingConfigViewSelector");
|
|
6
7
|
const invoicingCustomerFormConfig_1 = require("./invoicingCustomerFormConfig");
|
|
7
8
|
/**
|
|
8
9
|
* Bundled view for the customer create/edit form. Exposes the draft `localData`
|
|
@@ -29,12 +30,13 @@ const getInvoicingCustomerFormView = (state, invoicingCustomerID) => {
|
|
|
29
30
|
const billingAddressLabel = newAddress?.addressToCreate != null
|
|
30
31
|
? (0, addressViewSelector_1.getFormattedAddress)(newAddress.addressToCreate)
|
|
31
32
|
: undefined;
|
|
33
|
+
const { customerTypeOptions, netTermDayOptions, taxabilityOptions } = (0, invoicingConfigViewSelector_1.getInvoicingConfigView)(state);
|
|
32
34
|
return {
|
|
33
|
-
|
|
35
|
+
customerTypeOptions,
|
|
34
36
|
localData,
|
|
35
37
|
mode,
|
|
36
|
-
|
|
37
|
-
|
|
38
|
+
netTermDayOptions,
|
|
39
|
+
taxabilityOptions,
|
|
38
40
|
billingAddressId,
|
|
39
41
|
billingAddressLabel,
|
|
40
42
|
savedCustomerId,
|
|
@@ -2,14 +2,6 @@ import { InvoicingCustomer } from '../../../entity/invoicing/invoicingCustomer/i
|
|
|
2
2
|
import { InvoicingCustomerFormLocalData } from './editInvoicingCustomerDetailViewState';
|
|
3
3
|
/** `AddressType` key used when the customer form opens the shared Address screen. */
|
|
4
4
|
export declare const INVOICING_CUSTOMER_BILLING_ADDRESS_TYPE: "invoicing_customer_billing_address";
|
|
5
|
-
/**
|
|
6
|
-
* Canonical option value sets for the customer form. CES owns the values;
|
|
7
|
-
* web-components maps each value to a localized label (same split as the
|
|
8
|
-
* invoicing list column/tab config).
|
|
9
|
-
*/
|
|
10
|
-
export declare const INVOICING_CUSTOMER_TYPE_VALUES: readonly ["business", "residential"];
|
|
11
|
-
export declare const INVOICING_TAXABILITY_VALUES: readonly ["taxable", "exempt"];
|
|
12
|
-
export declare const INVOICING_NET_TERM_DAY_VALUES: readonly ["0", "15", "30", "45", "60"];
|
|
13
5
|
export declare const initialInvoicingCustomerFormLocalData: InvoicingCustomerFormLocalData;
|
|
14
6
|
/** Seed the form draft from an existing customer entity (edit mode). */
|
|
15
7
|
export declare const entityToInvoicingCustomerFormLocalData: (customer?: InvoicingCustomer) => InvoicingCustomerFormLocalData;
|
|
@@ -1,25 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.entityToInvoicingCustomerFormLocalData = exports.initialInvoicingCustomerFormLocalData = exports.
|
|
3
|
+
exports.entityToInvoicingCustomerFormLocalData = exports.initialInvoicingCustomerFormLocalData = exports.INVOICING_CUSTOMER_BILLING_ADDRESS_TYPE = void 0;
|
|
4
4
|
/** `AddressType` key used when the customer form opens the shared Address screen. */
|
|
5
5
|
exports.INVOICING_CUSTOMER_BILLING_ADDRESS_TYPE = 'invoicing_customer_billing_address';
|
|
6
|
-
/**
|
|
7
|
-
* Canonical option value sets for the customer form. CES owns the values;
|
|
8
|
-
* web-components maps each value to a localized label (same split as the
|
|
9
|
-
* invoicing list column/tab config).
|
|
10
|
-
*/
|
|
11
|
-
exports.INVOICING_CUSTOMER_TYPE_VALUES = [
|
|
12
|
-
'business',
|
|
13
|
-
'residential',
|
|
14
|
-
];
|
|
15
|
-
exports.INVOICING_TAXABILITY_VALUES = ['taxable', 'exempt'];
|
|
16
|
-
exports.INVOICING_NET_TERM_DAY_VALUES = [
|
|
17
|
-
'0',
|
|
18
|
-
'15',
|
|
19
|
-
'30',
|
|
20
|
-
'45',
|
|
21
|
-
'60',
|
|
22
|
-
];
|
|
23
6
|
exports.initialInvoicingCustomerFormLocalData = {
|
|
24
7
|
autoCollection: true,
|
|
25
8
|
company: '',
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ID } from '../../../commonStateTypes/common';
|
|
2
2
|
import { SelectorView } from '../../../commonStateTypes/viewAndReport/viewAndReport';
|
|
3
3
|
import { InvoicingCoupon } from '../../../entity/invoicing/coupon/couponState';
|
|
4
|
+
import { InvoicingSubscriptionLifecycleActionOption } from '../../../entity/invoicing/invoicingCommonPayload';
|
|
4
5
|
import { InvoicingCustomer } from '../../../entity/invoicing/invoicingCustomer/invoicingCustomerState';
|
|
5
6
|
import { InvoicingSubscription } from '../../../entity/invoicing/invoicingSubscription/invoicingSubscriptionState';
|
|
6
7
|
import { InvoicingProduct } from '../../../entity/invoicing/product/productState';
|
|
@@ -13,6 +14,10 @@ import { InvoicingSubscriptionFormLocalData } from './editInvoicingSubscriptionD
|
|
|
13
14
|
* prefill the form.
|
|
14
15
|
*/
|
|
15
16
|
export interface EditInvoicingSubscriptionDetailView extends SelectorView {
|
|
17
|
+
/** Config-owned; folded in so the screen reads one selector. */
|
|
18
|
+
subscriptionCommercialEditAllowedFromStatuses: string[];
|
|
19
|
+
subscriptionLifecycleActionOptions: InvoicingSubscriptionLifecycleActionOption[];
|
|
20
|
+
subscriptionMetadataEditAllowedFromStatuses: string[];
|
|
16
21
|
savedSubscriptionId?: ID;
|
|
17
22
|
subscription?: InvoicingSubscription;
|
|
18
23
|
}
|
|
@@ -5,11 +5,16 @@ const invoicingSubscriptionSelector_1 = require("../../../entity/invoicing/invoi
|
|
|
5
5
|
const addressViewSelector_1 = require("../../addressView/addressViewSelector");
|
|
6
6
|
const couponViewSelector_1 = require("../couponView/couponViewSelector");
|
|
7
7
|
const invoicingCatalogListViewSelector_1 = require("../invoicingCatalogListView/invoicingCatalogListViewSelector");
|
|
8
|
+
const invoicingConfigViewSelector_1 = require("../invoicingConfigView/invoicingConfigViewSelector");
|
|
8
9
|
const invoicingCustomerListViewSelector_1 = require("../invoicingCustomerListView/invoicingCustomerListViewSelector");
|
|
9
10
|
const invoicingSubscriptionFormConfig_1 = require("./invoicingSubscriptionFormConfig");
|
|
10
11
|
const getEditInvoicingSubscriptionDetailViewState = (state, invoicingSubscriptionID) => {
|
|
11
12
|
const { error, fetchState, savedSubscriptionId } = state.editInvoicingSubscriptionDetailViewState;
|
|
13
|
+
const { subscriptionCommercialEditAllowedFromStatuses, subscriptionLifecycleActionOptions, subscriptionMetadataEditAllowedFromStatuses, } = (0, invoicingConfigViewSelector_1.getInvoicingConfigView)(state);
|
|
12
14
|
return {
|
|
15
|
+
subscriptionCommercialEditAllowedFromStatuses,
|
|
16
|
+
subscriptionLifecycleActionOptions,
|
|
17
|
+
subscriptionMetadataEditAllowedFromStatuses,
|
|
13
18
|
subscription: invoicingSubscriptionID != null
|
|
14
19
|
? (0, invoicingSubscriptionSelector_1.getInvoicingSubscriptionById)(state.invoicingSubscriptionState, invoicingSubscriptionID)
|
|
15
20
|
: undefined,
|
|
@@ -4,6 +4,7 @@ exports.fetchInvoiceListPageEpic = void 0;
|
|
|
4
4
|
const rxjs_1 = require("rxjs");
|
|
5
5
|
const operators_1 = require("rxjs/operators");
|
|
6
6
|
const invoiceListReducer_1 = require("./invoiceListReducer");
|
|
7
|
+
const invoiceListState_1 = require("./invoiceListState");
|
|
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 fetchInvoiceListPageEpic = (actions$, state$) => actions$.pipe((0, operators_1.filter)(invoiceListReducer_1.fetchInvoiceListPage.match), (0, operators_1.mergeMap)((action) => {
|
|
20
21
|
const { cacheOverride, filters, sort } = action.payload;
|
|
21
22
|
const state = state$.value.invoicingInvoiceListState;
|
|
22
|
-
const activeTabState = state.invoiceByTab[state.activeTab];
|
|
23
|
+
const activeTabState = state.invoiceByTab[state.activeTab] ?? (0, invoiceListState_1.makeInvoiceTabState)();
|
|
23
24
|
const pageActions = [];
|
|
24
25
|
if (shouldFetch({ fetchState: activeTabState.fetchState, error: activeTabState.error }, cacheOverride)) {
|
|
25
26
|
pageActions.push((0, invoiceListReducer_1.fetchInvoiceList)({ filters, sort }));
|
|
@@ -20,13 +20,17 @@ const sameInvoiceListQuery = (a, b) => a.filters.customerId === b.filters.custom
|
|
|
20
20
|
a.sort?.dir === b.sort?.dir;
|
|
21
21
|
exports.sameInvoiceListQuery = sameInvoiceListQuery;
|
|
22
22
|
/**
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
23
|
+
* The status tab a newly created invoice belongs in — always its own status.
|
|
24
|
+
*
|
|
25
|
+
* This used to gate on `ALL_INVOICING_INVOICE_TAB_IDS`, which left a status the
|
|
26
|
+
* config added but this build's union does not know getting its count
|
|
27
|
+
* incremented while the id landed only in `all`: the tab rendered with a
|
|
28
|
+
* non-zero count and an empty list until a refetch. Per-tab cache entries are
|
|
29
|
+
* created on demand now, so every status is a valid key and the add path agrees
|
|
30
|
+
* with the count path. A status with no rendered tab just caches an entry nobody
|
|
31
|
+
* reads.
|
|
26
32
|
*/
|
|
27
|
-
const statusToTabId = (status) =>
|
|
28
|
-
? status
|
|
29
|
-
: undefined;
|
|
33
|
+
const statusToTabId = (status) => status;
|
|
30
34
|
exports.initialState = {
|
|
31
35
|
activeTab: 'all',
|
|
32
36
|
invoiceByTab: (0, invoiceListState_1.makeInvoiceByTab)(),
|
|
@@ -42,7 +46,7 @@ const invoiceList = (0, toolkit_1.createSlice)({
|
|
|
42
46
|
reducers: {
|
|
43
47
|
fetchInvoiceList: {
|
|
44
48
|
reducer(draft, action) {
|
|
45
|
-
const tab = draft.invoiceByTab
|
|
49
|
+
const tab = (0, invoiceListState_1.invoiceTabStateFor)(draft.invoiceByTab, draft.activeTab);
|
|
46
50
|
if (!action.payload.keepExistingListItems) {
|
|
47
51
|
tab.invoiceIds = [];
|
|
48
52
|
tab.nextCursor = null;
|
|
@@ -85,7 +89,7 @@ const invoiceList = (0, toolkit_1.createSlice)({
|
|
|
85
89
|
},
|
|
86
90
|
},
|
|
87
91
|
updateInvoiceList(draft, action) {
|
|
88
|
-
const tab = draft.invoiceByTab
|
|
92
|
+
const tab = (0, invoiceListState_1.invoiceTabStateFor)(draft.invoiceByTab, draft.activeTab);
|
|
89
93
|
const newIds = action.payload.invoices.map((invoice) => invoice.id);
|
|
90
94
|
tab.invoiceIds = action.payload.keepExistingListItems
|
|
91
95
|
? [...new Set([...tab.invoiceIds, ...newIds])]
|
|
@@ -95,7 +99,7 @@ const invoiceList = (0, toolkit_1.createSlice)({
|
|
|
95
99
|
tab.error = undefined;
|
|
96
100
|
},
|
|
97
101
|
updateInvoiceListFailure(draft, action) {
|
|
98
|
-
const tab = draft.invoiceByTab
|
|
102
|
+
const tab = (0, invoiceListState_1.invoiceTabStateFor)(draft.invoiceByTab, draft.activeTab);
|
|
99
103
|
tab.fetchState = 'Error';
|
|
100
104
|
tab.error = action.payload;
|
|
101
105
|
},
|
|
@@ -141,17 +145,14 @@ const invoiceList = (0, toolkit_1.createSlice)({
|
|
|
141
145
|
// are left untouched and refetched lazily.
|
|
142
146
|
addInvoiceToList(draft, action) {
|
|
143
147
|
const { id, status } = action.payload;
|
|
144
|
-
const allTab = draft.invoiceByTab
|
|
148
|
+
const allTab = (0, invoiceListState_1.invoiceTabStateFor)(draft.invoiceByTab, 'all');
|
|
145
149
|
if (allTab.invoiceIds.includes(id)) {
|
|
146
150
|
return;
|
|
147
151
|
}
|
|
148
152
|
allTab.invoiceIds = [id, ...allTab.invoiceIds];
|
|
149
|
-
const statusTab = statusToTabId(status);
|
|
150
|
-
if (statusTab
|
|
151
|
-
|
|
152
|
-
if (!tab.invoiceIds.includes(id)) {
|
|
153
|
-
tab.invoiceIds = [id, ...tab.invoiceIds];
|
|
154
|
-
}
|
|
153
|
+
const statusTab = (0, invoiceListState_1.invoiceTabStateFor)(draft.invoiceByTab, statusToTabId(status));
|
|
154
|
+
if (!statusTab.invoiceIds.includes(id)) {
|
|
155
|
+
statusTab.invoiceIds = [id, ...statusTab.invoiceIds];
|
|
155
156
|
}
|
|
156
157
|
draft.counts.all += 1;
|
|
157
158
|
draft.counts[status] = (draft.counts[status] ?? 0) + 1;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { FetchStateAndError } from '../../../commonStateTypes/common';
|
|
2
2
|
import { SelectorView } from '../../../commonStateTypes/viewAndReport/viewAndReport';
|
|
3
3
|
import { InvoicingInvoice, InvoicingInvoiceKPIs } from '../../../entity/invoicing/invoice/invoiceState';
|
|
4
|
-
import { InvoicingListCounts } from '../../../entity/invoicing/invoicingCommonPayload';
|
|
4
|
+
import { InvoicingListCounts, InvoicingNamedOption } from '../../../entity/invoicing/invoicingCommonPayload';
|
|
5
5
|
import { RootState } from '../../../reducer';
|
|
6
6
|
import { InvoiceListFilters, InvoicingInvoiceTabId } from './invoiceListState';
|
|
7
7
|
export interface InvoiceListView extends SelectorView {
|
|
@@ -12,6 +12,8 @@ export interface InvoiceListView extends SelectorView {
|
|
|
12
12
|
invoices: InvoicingInvoice[];
|
|
13
13
|
kpisFetchState: FetchStateAndError;
|
|
14
14
|
nextCursor: string | null;
|
|
15
|
+
/** Config status list; the page labels tabs and row badges from it. */
|
|
16
|
+
statusOptions: InvoicingNamedOption[];
|
|
15
17
|
tabIds: InvoicingInvoiceTabId[];
|
|
16
18
|
kpis?: InvoicingInvoiceKPIs;
|
|
17
19
|
}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getInvoiceListView = void 0;
|
|
4
4
|
const toolkit_1 = require("@reduxjs/toolkit");
|
|
5
|
+
const invoicingTabHelper_1 = require("../invoicingTabHelper");
|
|
5
6
|
const invoiceListState_1 = require("./invoiceListState");
|
|
6
7
|
/**
|
|
7
8
|
* Bundled read view for the invoices list page: the denormalized invoice rows
|
|
@@ -9,8 +10,11 @@ const invoiceListState_1 = require("./invoiceListState");
|
|
|
9
10
|
* array (and the wrapping view object) keep referential identity until the
|
|
10
11
|
* invoice entity slice or the list-view slice actually change.
|
|
11
12
|
*/
|
|
12
|
-
exports.getInvoiceListView = (0, toolkit_1.createSelector)((state) => state.invoicingInvoiceState, (state) => state.invoicingInvoiceListState, (invoiceState, listViewState) => {
|
|
13
|
-
|
|
13
|
+
exports.getInvoiceListView = (0, toolkit_1.createSelector)((state) => state.invoicingInvoiceState, (state) => state.invoicingInvoiceListState, (state) => state.invoicingConfigViewState.invoiceStatusOptions, (invoiceState, listViewState, statusOptions) => {
|
|
14
|
+
// Config-driven tabs: a status this build's union does not know has no
|
|
15
|
+
// cache entry until it is fetched, so default rather than crash.
|
|
16
|
+
const activeTabState = listViewState.invoiceByTab[listViewState.activeTab] ??
|
|
17
|
+
(0, invoiceListState_1.makeInvoiceTabState)();
|
|
14
18
|
return {
|
|
15
19
|
activeTab: listViewState.activeTab,
|
|
16
20
|
invoices: activeTabState.invoiceIds
|
|
@@ -22,7 +26,11 @@ exports.getInvoiceListView = (0, toolkit_1.createSelector)((state) => state.invo
|
|
|
22
26
|
kpis: listViewState.kpis,
|
|
23
27
|
kpisFetchState: listViewState.kpisFetchState,
|
|
24
28
|
nextCursor: activeTabState.nextCursor,
|
|
25
|
-
|
|
29
|
+
statusOptions,
|
|
30
|
+
tabIds: (0, invoicingTabHelper_1.invoicingTabIdsFromConfig)({
|
|
31
|
+
allTabIds: invoiceListState_1.ALL_INVOICING_INVOICE_TAB_IDS,
|
|
32
|
+
statusOptions,
|
|
33
|
+
}),
|
|
26
34
|
fetchState: activeTabState.fetchState,
|
|
27
35
|
error: activeTabState.error,
|
|
28
36
|
version: 1.0,
|
|
@@ -5,13 +5,6 @@ import { InvoicingListSort } from '../invoicingApiHelper';
|
|
|
5
5
|
export declare const ALL_INVOICING_INVOICE_TAB_IDS: readonly ["all", "paid", "partially_paid", "payment_due", "not_paid", "voided"];
|
|
6
6
|
export declare const toInvoicingInvoiceTabId: (v: string) => "paid" | "voided" | "partially_paid" | "payment_due" | "not_paid" | "all";
|
|
7
7
|
export type InvoicingInvoiceTabId = ReturnType<typeof toInvoicingInvoiceTabId>;
|
|
8
|
-
/**
|
|
9
|
-
* Ordered filter-tab id set owned by CES so the invoice-list tabs live next to
|
|
10
|
-
* the model rather than being hardcoded in web-components. Tab labels and the
|
|
11
|
-
* per-tab count lookup stay in the view layer; this only carries the id set and
|
|
12
|
-
* display order.
|
|
13
|
-
*/
|
|
14
|
-
export declare const INVOICING_INVOICE_TABS: InvoicingInvoiceTabId[];
|
|
15
8
|
/** Filters that drive the invoice list query (mirrors the Invoices hooks). */
|
|
16
9
|
export interface InvoiceListFilters {
|
|
17
10
|
customerId?: ID;
|
|
@@ -38,7 +31,13 @@ export interface InvoiceListState {
|
|
|
38
31
|
/** Base query shared across tabs (search / customer / subscription / dates). */
|
|
39
32
|
filters: InvoiceListFilters;
|
|
40
33
|
/** Per-tab cached invoice ids + cursor + fetch state. */
|
|
41
|
-
|
|
34
|
+
/**
|
|
35
|
+
* Per-tab cache. `Partial` because the tab set comes from `/1.0/config`: a
|
|
36
|
+
* status the backend added that this build's tab-id union does not know still
|
|
37
|
+
* renders a tab, and its cache entry is created on first use rather than
|
|
38
|
+
* pre-seeded. Readers must default a missing entry.
|
|
39
|
+
*/
|
|
40
|
+
invoiceByTab: Partial<Record<InvoicingInvoiceTabId, InvoiceTabState>>;
|
|
42
41
|
kpisFetchState: FetchStateAndError;
|
|
43
42
|
/** Tab-independent money KPIs. */
|
|
44
43
|
kpis?: InvoicingInvoiceKPIs;
|
|
@@ -46,4 +45,9 @@ export interface InvoiceListState {
|
|
|
46
45
|
sort?: InvoicingListSort;
|
|
47
46
|
}
|
|
48
47
|
export declare const makeInvoiceTabState: () => InvoiceTabState;
|
|
49
|
-
|
|
48
|
+
/**
|
|
49
|
+
* The cache entry for a tab, created on first use. The tab set is config-driven,
|
|
50
|
+
* so a status this build's union does not know still needs somewhere to cache.
|
|
51
|
+
*/
|
|
52
|
+
export declare const invoiceTabStateFor: (invoiceByTab: Partial<Record<InvoicingInvoiceTabId, InvoiceTabState>>, tabId: InvoicingInvoiceTabId) => InvoiceTabState;
|
|
53
|
+
export declare const makeInvoiceByTab: () => Partial<Record<InvoicingInvoiceTabId, InvoiceTabState>>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.makeInvoiceByTab = exports.
|
|
3
|
+
exports.makeInvoiceByTab = exports.invoiceTabStateFor = exports.makeInvoiceTabState = 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',
|
|
@@ -12,15 +12,6 @@ exports.ALL_INVOICING_INVOICE_TAB_IDS = [
|
|
|
12
12
|
];
|
|
13
13
|
const toInvoicingInvoiceTabId = (v) => (0, stringToUnion_1.stringToUnion)(v, exports.ALL_INVOICING_INVOICE_TAB_IDS);
|
|
14
14
|
exports.toInvoicingInvoiceTabId = toInvoicingInvoiceTabId;
|
|
15
|
-
/**
|
|
16
|
-
* Ordered filter-tab id set owned by CES so the invoice-list tabs live next to
|
|
17
|
-
* the model rather than being hardcoded in web-components. Tab labels and the
|
|
18
|
-
* per-tab count lookup stay in the view layer; this only carries the id set and
|
|
19
|
-
* display order.
|
|
20
|
-
*/
|
|
21
|
-
exports.INVOICING_INVOICE_TABS = [
|
|
22
|
-
...exports.ALL_INVOICING_INVOICE_TAB_IDS,
|
|
23
|
-
];
|
|
24
15
|
const makeInvoiceTabState = () => ({
|
|
25
16
|
invoiceIds: [],
|
|
26
17
|
nextCursor: null,
|
|
@@ -28,6 +19,20 @@ const makeInvoiceTabState = () => ({
|
|
|
28
19
|
error: undefined,
|
|
29
20
|
});
|
|
30
21
|
exports.makeInvoiceTabState = makeInvoiceTabState;
|
|
22
|
+
/**
|
|
23
|
+
* The cache entry for a tab, created on first use. The tab set is config-driven,
|
|
24
|
+
* so a status this build's union does not know still needs somewhere to cache.
|
|
25
|
+
*/
|
|
26
|
+
const invoiceTabStateFor = (invoiceByTab, tabId) => {
|
|
27
|
+
const existing = invoiceByTab[tabId];
|
|
28
|
+
if (existing != null) {
|
|
29
|
+
return existing;
|
|
30
|
+
}
|
|
31
|
+
const created = (0, exports.makeInvoiceTabState)();
|
|
32
|
+
invoiceByTab[tabId] = created;
|
|
33
|
+
return created;
|
|
34
|
+
};
|
|
35
|
+
exports.invoiceTabStateFor = invoiceTabStateFor;
|
|
31
36
|
const makeInvoiceByTab = () => exports.ALL_INVOICING_INVOICE_TAB_IDS.reduce((acc, tabId) => {
|
|
32
37
|
acc[tabId] = (0, exports.makeInvoiceTabState)();
|
|
33
38
|
return acc;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { FetchState, ID } from '../../../commonStateTypes/common';
|
|
2
2
|
import { SelectorView } from '../../../commonStateTypes/viewAndReport/viewAndReport';
|
|
3
|
-
import { InvoicingCatalogItemLifecycleAction, InvoicingCatalogLifecycleActionOption, InvoicingCatalogProductLifecycleAction, InvoicingNamedOptionsByKey } from '../../../entity/invoicing/invoicingCommonPayload';
|
|
3
|
+
import { InvoicingCatalogItemLifecycleAction, InvoicingCatalogLifecycleActionOption, InvoicingCatalogProductLifecycleAction, InvoicingNamedOption, InvoicingNamedOptionsByKey } from '../../../entity/invoicing/invoicingCommonPayload';
|
|
4
4
|
import { InvoicingPlan } from '../../../entity/invoicing/plan/planState';
|
|
5
5
|
import { RootState } from '../../../reducer';
|
|
6
6
|
import { InvoicingCatalogItemKind } from './invoicingCatalogItemDetailViewState';
|
|
@@ -20,6 +20,14 @@ export interface InvoicingCatalogItemDetailView extends SelectorView {
|
|
|
20
20
|
catalogItemLifecycleActionOptions: InvoicingCatalogLifecycleActionOption<InvoicingCatalogItemLifecycleAction>[];
|
|
21
21
|
catalogProductLifecycleActionOptions: InvoicingCatalogLifecycleActionOption<InvoicingCatalogProductLifecycleAction>[];
|
|
22
22
|
configFetchState: FetchState;
|
|
23
|
+
/**
|
|
24
|
+
* Config option lists the detail page's inline pricing editor renders, so the
|
|
25
|
+
* screen reads them off this view instead of `getInvoicingConfigView`.
|
|
26
|
+
*/
|
|
27
|
+
periodUnitOptions: InvoicingNamedOption[];
|
|
28
|
+
trialEndActionOptions: InvoicingNamedOption[];
|
|
29
|
+
trialUnitOptions: InvoicingNamedOption[];
|
|
30
|
+
typeOptions: InvoicingNamedOption[];
|
|
23
31
|
catalogTierTypeOptionsByPricingModel?: InvoicingNamedOptionsByKey;
|
|
24
32
|
plan?: InvoicingPlan;
|
|
25
33
|
}
|