@zeniai/client-epic-state 5.1.96 → 5.1.97-betaAK0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/entity/invoicing/invoicingCommonPayload.d.ts +21 -0
- package/lib/entity/invoicing/invoicingCommonPayload.js +25 -0
- package/lib/epic.d.ts +1 -5
- package/lib/epic.js +1 -5
- package/lib/esm/entity/invoicing/invoicingCommonPayload.js +22 -0
- package/lib/esm/epic.js +1 -5
- package/lib/esm/index.js +17 -20
- package/lib/esm/reducer.js +0 -3
- package/lib/esm/view/dashboard/dashboardEpic.js +0 -20
- package/lib/esm/view/dashboard/dashboardReducer.js +1 -13
- package/lib/esm/view/dashboard/dashboardSelector.js +2 -7
- package/lib/esm/view/invoicing/couponView/couponViewSelector.js +9 -3
- 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 +2 -1
- package/lib/esm/view/invoicing/createCreditNote/createCreditNoteSelector.js +4 -2
- package/lib/esm/view/invoicing/editInvoicingCatalogItemDetailView/editInvoicingCatalogItemDetailViewPayload.js +1 -1
- package/lib/esm/view/invoicing/editInvoicingCatalogItemDetailView/editInvoicingCatalogItemDetailViewSelector.js +8 -5
- package/lib/esm/view/invoicing/editInvoicingCatalogItemDetailView/invoicingCatalogItemFormConfig.js +4 -20
- package/lib/esm/view/invoicing/editInvoicingCouponDetailView/editInvoicingCouponDetailViewSelector.js +7 -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/editInvoicingSubscriptionDetailViewPayload.js +14 -4
- package/lib/esm/view/invoicing/editInvoicingSubscriptionDetailView/invoicingSubscriptionFormConfig.js +56 -1
- package/lib/esm/view/invoicing/invoiceList/invoiceListSelector.js +8 -3
- package/lib/esm/view/invoicing/invoiceList/invoiceListState.js +0 -9
- package/lib/esm/view/invoicing/invoicingCatalogItemDetailView/invoicingCatalogItemDetailViewSelector.js +6 -0
- package/lib/esm/view/invoicing/invoicingConfigView/invoicingConfigViewReducer.js +31 -1
- package/lib/esm/view/invoicing/invoicingConfigView/invoicingConfigViewSelector.js +9 -0
- package/lib/esm/view/invoicing/invoicingCreditNoteListView/invoicingCreditNoteListViewSelector.js +8 -3
- package/lib/esm/view/invoicing/invoicingCreditNoteListView/invoicingCreditNoteListViewState.js +0 -9
- 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 +8 -3
- package/lib/esm/view/invoicing/invoicingSubscriptionListView/invoicingSubscriptionListViewState.js +0 -9
- package/lib/esm/view/invoicing/invoicingTabHelper.js +25 -0
- package/lib/esm/view/invoicing/invoicingTransactionListView/invoicingTransactionListViewSelector.js +8 -3
- package/lib/esm/view/invoicing/invoicingTransactionListView/invoicingTransactionListViewState.js +1 -9
- package/lib/esm/view/invoicing/issueCreditNote/issueCreditNoteFormConfig.js +1 -8
- package/lib/esm/view/invoicing/issueCreditNote/issueCreditNotePayload.js +3 -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 +27 -6
- package/lib/esm/view/invoicing/settingsView/settingsViewSelector.js +0 -1
- package/lib/esm/view/spendManagement/treasury/treasurySetUp/treasurySetupViewReducer.js +1 -67
- package/lib/index.d.ts +18 -23
- package/lib/index.js +42 -65
- package/lib/reducer.d.ts +0 -3
- package/lib/reducer.js +0 -3
- package/lib/view/dashboard/dashboardEpic.d.ts +1 -3
- package/lib/view/dashboard/dashboardEpic.js +0 -20
- package/lib/view/dashboard/dashboardReducer.d.ts +1 -1
- package/lib/view/dashboard/dashboardReducer.js +2 -14
- package/lib/view/dashboard/dashboardSelector.d.ts +0 -1
- package/lib/view/dashboard/dashboardSelector.js +2 -7
- package/lib/view/dashboard/dashboardState.d.ts +0 -1
- package/lib/view/invoicing/couponView/couponViewSelector.d.ts +3 -1
- package/lib/view/invoicing/couponView/couponViewSelector.js +8 -2
- 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 +2 -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/editInvoicingCatalogItemDetailViewPayload.js +1 -1
- package/lib/view/invoicing/editInvoicingCatalogItemDetailView/editInvoicingCatalogItemDetailViewSelector.d.ts +12 -4
- package/lib/view/invoicing/editInvoicingCatalogItemDetailView/editInvoicingCatalogItemDetailViewSelector.js +7 -4
- package/lib/view/invoicing/editInvoicingCatalogItemDetailView/invoicingCatalogItemFormConfig.d.ts +4 -7
- package/lib/view/invoicing/editInvoicingCatalogItemDetailView/invoicingCatalogItemFormConfig.js +5 -21
- package/lib/view/invoicing/editInvoicingCouponDetailView/editInvoicingCouponDetailViewSelector.d.ts +4 -5
- package/lib/view/invoicing/editInvoicingCouponDetailView/editInvoicingCouponDetailViewSelector.js +7 -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/editInvoicingSubscriptionDetailViewPayload.d.ts +4 -0
- package/lib/view/invoicing/editInvoicingSubscriptionDetailView/editInvoicingSubscriptionDetailViewPayload.js +13 -3
- package/lib/view/invoicing/editInvoicingSubscriptionDetailView/editInvoicingSubscriptionDetailViewState.d.ts +17 -0
- package/lib/view/invoicing/editInvoicingSubscriptionDetailView/invoicingSubscriptionFormConfig.d.ts +22 -0
- package/lib/view/invoicing/editInvoicingSubscriptionDetailView/invoicingSubscriptionFormConfig.js +60 -2
- package/lib/view/invoicing/invoiceList/invoiceListSelector.d.ts +3 -1
- package/lib/view/invoicing/invoiceList/invoiceListSelector.js +7 -2
- package/lib/view/invoicing/invoiceList/invoiceListState.d.ts +0 -7
- package/lib/view/invoicing/invoiceList/invoiceListState.js +1 -10
- package/lib/view/invoicing/invoicingCatalogItemDetailView/invoicingCatalogItemDetailViewSelector.d.ts +13 -1
- package/lib/view/invoicing/invoicingCatalogItemDetailView/invoicingCatalogItemDetailViewSelector.js +6 -0
- package/lib/view/invoicing/invoicingConfigView/invoicingConfigViewPayload.d.ts +15 -1
- package/lib/view/invoicing/invoicingConfigView/invoicingConfigViewReducer.d.ts +1 -1
- package/lib/view/invoicing/invoicingConfigView/invoicingConfigViewReducer.js +30 -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 +20 -1
- package/lib/view/invoicing/invoicingCreditNoteListView/invoicingCreditNoteListViewSelector.d.ts +3 -1
- package/lib/view/invoicing/invoicingCreditNoteListView/invoicingCreditNoteListViewSelector.js +7 -2
- package/lib/view/invoicing/invoicingCreditNoteListView/invoicingCreditNoteListViewState.d.ts +0 -7
- package/lib/view/invoicing/invoicingCreditNoteListView/invoicingCreditNoteListViewState.js +1 -10
- 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 +3 -1
- package/lib/view/invoicing/invoicingSubscriptionListView/invoicingSubscriptionListViewSelector.js +7 -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 +28 -0
- package/lib/view/invoicing/invoicingTransactionListView/invoicingTransactionListViewReducer.d.ts +1 -1
- package/lib/view/invoicing/invoicingTransactionListView/invoicingTransactionListViewSelector.d.ts +3 -0
- package/lib/view/invoicing/invoicingTransactionListView/invoicingTransactionListViewSelector.js +7 -2
- package/lib/view/invoicing/invoicingTransactionListView/invoicingTransactionListViewState.d.ts +2 -9
- package/lib/view/invoicing/invoicingTransactionListView/invoicingTransactionListViewState.js +2 -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 +3 -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 +27 -6
- package/lib/view/invoicing/settingsView/settingsViewSelector.d.ts +0 -2
- package/lib/view/invoicing/settingsView/settingsViewSelector.js +0 -1
- package/lib/view/spendManagement/treasury/treasurySetUp/treasurySetupViewReducer.d.ts +1 -1
- package/lib/view/spendManagement/treasury/treasurySetUp/treasurySetupViewReducer.js +2 -68
- package/lib/view/spendManagement/treasury/treasurySetUp/treasurySetupViewState.d.ts +0 -3
- 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/esm/view/spendManagement/treasury/treasurySetUp/epic/updateTreasuryPromoIntroClosedByOutsideClickEpic.js +0 -18
- package/lib/esm/view/spendManagement/treasury/treasurySetUp/epic/updateTreasuryPromoRemindMeLaterClickedEpic.js +0 -18
- package/lib/esm/view/spendManagement/treasury/treasurySetUp/epic/updateTreasuryVideoViewedEpic.js +0 -18
- package/lib/esm/view/zeniAccountsPromoCard/zeniAccountsPromoCardEpic.js +0 -16
- package/lib/esm/view/zeniAccountsPromoCard/zeniAccountsPromoCardPayload.js +0 -1
- package/lib/esm/view/zeniAccountsPromoCard/zeniAccountsPromoCardReducer.js +0 -60
- package/lib/esm/view/zeniAccountsPromoCard/zeniAccountsPromoCardSelector.js +0 -12
- package/lib/esm/view/zeniAccountsPromoCard/zeniAccountsPromoCardState.js +0 -1
- package/lib/view/spendManagement/treasury/treasurySetUp/epic/updateTreasuryPromoIntroClosedByOutsideClickEpic.d.ts +0 -8
- package/lib/view/spendManagement/treasury/treasurySetUp/epic/updateTreasuryPromoIntroClosedByOutsideClickEpic.js +0 -22
- package/lib/view/spendManagement/treasury/treasurySetUp/epic/updateTreasuryPromoRemindMeLaterClickedEpic.d.ts +0 -8
- package/lib/view/spendManagement/treasury/treasurySetUp/epic/updateTreasuryPromoRemindMeLaterClickedEpic.js +0 -22
- package/lib/view/spendManagement/treasury/treasurySetUp/epic/updateTreasuryVideoViewedEpic.d.ts +0 -8
- package/lib/view/spendManagement/treasury/treasurySetUp/epic/updateTreasuryVideoViewedEpic.js +0 -22
- package/lib/view/zeniAccountsPromoCard/zeniAccountsPromoCardEpic.d.ts +0 -13
- package/lib/view/zeniAccountsPromoCard/zeniAccountsPromoCardEpic.js +0 -20
- package/lib/view/zeniAccountsPromoCard/zeniAccountsPromoCardPayload.d.ts +0 -11
- package/lib/view/zeniAccountsPromoCard/zeniAccountsPromoCardPayload.js +0 -2
- package/lib/view/zeniAccountsPromoCard/zeniAccountsPromoCardReducer.d.ts +0 -7
- package/lib/view/zeniAccountsPromoCard/zeniAccountsPromoCardReducer.js +0 -64
- package/lib/view/zeniAccountsPromoCard/zeniAccountsPromoCardSelector.d.ts +0 -12
- package/lib/view/zeniAccountsPromoCard/zeniAccountsPromoCardSelector.js +0 -15
- package/lib/view/zeniAccountsPromoCard/zeniAccountsPromoCardState.d.ts +0 -9
- package/lib/view/zeniAccountsPromoCard/zeniAccountsPromoCardState.js +0 -2
|
@@ -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: '',
|
|
@@ -7,5 +7,9 @@ export type SaveInvoicingSubscriptionResponse = ZeniAPIResponse<InvoicingSubscri
|
|
|
7
7
|
* Build the create/update subscription request body from the form draft. The
|
|
8
8
|
* shipping address is sent as an object (captured via the shared Address
|
|
9
9
|
* screen); the backend persists it — same pattern as the customer save flow.
|
|
10
|
+
*
|
|
11
|
+
* `remaining_billing_cycles` is omitted when the user left the field empty, so
|
|
12
|
+
* the backend applies the plan's own `billing_cycles` (or renews forever when
|
|
13
|
+
* the plan sets no limit) rather than being pinned to a value the form invented.
|
|
10
14
|
*/
|
|
11
15
|
export declare const localDataToSaveInvoicingSubscriptionPayload: (localData: InvoicingSubscriptionFormLocalData, shippingAddress?: AddressUpdatableInfo) => Record<string, unknown>;
|
|
@@ -7,6 +7,10 @@ const invoicingSubscriptionFormConfig_1 = require("./invoicingSubscriptionFormCo
|
|
|
7
7
|
* Build the create/update subscription request body from the form draft. The
|
|
8
8
|
* shipping address is sent as an object (captured via the shared Address
|
|
9
9
|
* screen); the backend persists it — same pattern as the customer save flow.
|
|
10
|
+
*
|
|
11
|
+
* `remaining_billing_cycles` is omitted when the user left the field empty, so
|
|
12
|
+
* the backend applies the plan's own `billing_cycles` (or renews forever when
|
|
13
|
+
* the plan sets no limit) rather than being pinned to a value the form invented.
|
|
10
14
|
*/
|
|
11
15
|
const localDataToSaveInvoicingSubscriptionPayload = (localData, shippingAddress) => {
|
|
12
16
|
const frequency = (0, invoicingSubscriptionFormConfig_1.billingFrequencyToPeriod)(localData.billingFrequency);
|
|
@@ -14,32 +18,38 @@ const localDataToSaveInvoicingSubscriptionPayload = (localData, shippingAddress)
|
|
|
14
18
|
{
|
|
15
19
|
item_price_code: localData.planPriceCode,
|
|
16
20
|
item_type: 'plan',
|
|
17
|
-
quantity:
|
|
21
|
+
quantity: (0, invoicingSubscriptionFormConfig_1.toInvoicingSubscriptionQuantity)(localData.planQuantity),
|
|
18
22
|
},
|
|
19
23
|
...localData.addonPriceCodes.map((priceCode) => ({
|
|
20
24
|
item_price_code: priceCode,
|
|
21
25
|
item_type: 'addon',
|
|
22
|
-
quantity:
|
|
26
|
+
quantity: (0, invoicingSubscriptionFormConfig_1.toInvoicingSubscriptionQuantity)(localData.addonQuantities[priceCode]),
|
|
23
27
|
})),
|
|
24
28
|
...localData.chargePriceCodes.map((priceCode) => ({
|
|
25
29
|
item_price_code: priceCode,
|
|
26
30
|
item_type: 'charge',
|
|
27
|
-
quantity:
|
|
31
|
+
quantity: (0, invoicingSubscriptionFormConfig_1.toInvoicingSubscriptionQuantity)(localData.chargeQuantities[priceCode]),
|
|
28
32
|
})),
|
|
29
33
|
];
|
|
30
34
|
const setupFee = localData.setupFee?.amount;
|
|
31
35
|
const poNumber = localData.poNumber.trim();
|
|
32
36
|
const trialEnd = localData.trialEnd.trim();
|
|
37
|
+
const startedAt = localData.startedAt.trim();
|
|
38
|
+
const remainingBillingCycles = (0, invoicingSubscriptionFormConfig_1.toInvoicingSubscriptionBillingCycles)(localData.remainingBillingCycles);
|
|
33
39
|
return {
|
|
34
40
|
auto_collection: localData.autoCollection ? 'on' : 'off',
|
|
35
41
|
billing_period: frequency.period,
|
|
36
42
|
billing_period_unit: frequency.unit,
|
|
37
43
|
currency_code: localData.preferredCurrencyCode,
|
|
38
44
|
customer_id: localData.customerId,
|
|
45
|
+
started_at: startedAt !== '' ? startedAt : (0, invoicingSubscriptionFormConfig_1.invoicingSubscriptionTodayIso)(),
|
|
39
46
|
subscription_items: items,
|
|
40
47
|
...(setupFee != null ? { setup_fee: setupFee } : {}),
|
|
41
48
|
...(poNumber !== '' ? { po_number: poNumber } : {}),
|
|
42
49
|
...(trialEnd !== '' ? { trial_end: trialEnd } : {}),
|
|
50
|
+
...(remainingBillingCycles != null
|
|
51
|
+
? { remaining_billing_cycles: remainingBillingCycles }
|
|
52
|
+
: {}),
|
|
43
53
|
...(localData.couponId !== '' ? { coupon_ids: [localData.couponId] } : {}),
|
|
44
54
|
...(shippingAddress != null
|
|
45
55
|
? { shipping_address: (0, addressViewPayload_1.toAddressUpdatableInfoPayload)(shippingAddress) }
|
|
@@ -9,15 +9,32 @@ import { FetchedState, ID } from '../../../commonStateTypes/common';
|
|
|
9
9
|
*/
|
|
10
10
|
export interface InvoicingSubscriptionFormLocalData {
|
|
11
11
|
addonPriceCodes: string[];
|
|
12
|
+
/**
|
|
13
|
+
* Per-add-on quantity, keyed by item price code. Only the codes currently in
|
|
14
|
+
* `addonPriceCodes` are read when the save payload is built, so a code left
|
|
15
|
+
* behind by a deselect is inert; a missing key bills as 1.
|
|
16
|
+
*/
|
|
17
|
+
addonQuantities: Record<string, number>;
|
|
12
18
|
autoCollection: boolean;
|
|
13
19
|
billingFrequency: string;
|
|
14
20
|
chargePriceCodes: string[];
|
|
21
|
+
/** Per-charge quantity, keyed by item price code. See `addonQuantities`. */
|
|
22
|
+
chargeQuantities: Record<string, number>;
|
|
15
23
|
couponId: string;
|
|
16
24
|
customerId: string;
|
|
17
25
|
planPriceCode: string;
|
|
18
26
|
planQuantity: number;
|
|
19
27
|
poNumber: string;
|
|
20
28
|
preferredCurrencyCode: string;
|
|
29
|
+
/**
|
|
30
|
+
* Number of paid billing cycles including the first invoice, held as a string
|
|
31
|
+
* so an empty field stays distinguishable from a real 0. Empty means "no
|
|
32
|
+
* limit set here" — the payload omits it and the backend falls back to the
|
|
33
|
+
* plan's `billing_cycles` (renewing forever when the plan has no limit).
|
|
34
|
+
*/
|
|
35
|
+
remainingBillingCycles: string;
|
|
36
|
+
/** `YYYY-MM-DD`. Empty falls back to today when the payload is built. */
|
|
37
|
+
startedAt: string;
|
|
21
38
|
trialEnd: string;
|
|
22
39
|
/** Unset until the user enters one, so an explicit 0 stays distinguishable. */
|
|
23
40
|
setupFee?: Amount;
|
package/lib/view/invoicing/editInvoicingSubscriptionDetailView/invoicingSubscriptionFormConfig.d.ts
CHANGED
|
@@ -15,6 +15,28 @@ export declare const billingFrequencyToPeriod: (value: string) => {
|
|
|
15
15
|
};
|
|
16
16
|
/** Map an existing subscription's period/unit back to a billing-frequency value. */
|
|
17
17
|
export declare const periodToBillingFrequency: (period?: number, unit?: string) => string;
|
|
18
|
+
/**
|
|
19
|
+
* Today as `YYYY-MM-DD`, the default subscription start date. Goes through
|
|
20
|
+
* dayjs (not `toISOString`, which is UTC) so a user in a UTC+ timezone late in
|
|
21
|
+
* their day gets their own calendar date rather than yesterday's.
|
|
22
|
+
*/
|
|
23
|
+
export declare const invoicingSubscriptionTodayIso: () => string;
|
|
24
|
+
/**
|
|
25
|
+
* Clamp a subscription-item quantity to the minimum the API accepts. Shared by
|
|
26
|
+
* the plan, add-on and charge items so none of them can bill a 0 or a fraction.
|
|
27
|
+
*/
|
|
28
|
+
export declare const toInvoicingSubscriptionQuantity: (quantity?: number) => number;
|
|
29
|
+
/**
|
|
30
|
+
* Parse the billing-cycles field into what the API should receive, or
|
|
31
|
+
* `undefined` when the field is empty or unparseable (the payload then omits it
|
|
32
|
+
* so the backend applies the plan's own limit).
|
|
33
|
+
*
|
|
34
|
+
* Deliberately NOT `toInvoicingSubscriptionQuantity`: `0` is a real
|
|
35
|
+
* remaining-cycles value on a subscription serving its last paid term, and edit
|
|
36
|
+
* drafts seed it straight off the entity. Clamping it up to `1` would turn a
|
|
37
|
+
* no-op save of a non-renewing subscription into a one-cycle extension.
|
|
38
|
+
*/
|
|
39
|
+
export declare const toInvoicingSubscriptionBillingCycles: (remainingBillingCycles: string) => number | undefined;
|
|
18
40
|
export declare const initialInvoicingSubscriptionFormLocalData: InvoicingSubscriptionFormLocalData;
|
|
19
41
|
/** Seed the form draft from an existing subscription entity (edit mode). */
|
|
20
42
|
export declare const entityToInvoicingSubscriptionFormLocalData: (subscription?: InvoicingSubscription) => InvoicingSubscriptionFormLocalData;
|
package/lib/view/invoicing/editInvoicingSubscriptionDetailView/invoicingSubscriptionFormConfig.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.entityToInvoicingSubscriptionFormLocalData = exports.initialInvoicingSubscriptionFormLocalData = exports.periodToBillingFrequency = exports.billingFrequencyToPeriod = exports.INVOICING_SUBSCRIPTION_BILLING_FREQUENCY_VALUES = exports.INVOICING_SUBSCRIPTION_SHIPPING_ADDRESS_TYPE = void 0;
|
|
3
|
+
exports.entityToInvoicingSubscriptionFormLocalData = exports.initialInvoicingSubscriptionFormLocalData = exports.toInvoicingSubscriptionBillingCycles = exports.toInvoicingSubscriptionQuantity = exports.invoicingSubscriptionTodayIso = exports.periodToBillingFrequency = exports.billingFrequencyToPeriod = exports.INVOICING_SUBSCRIPTION_BILLING_FREQUENCY_VALUES = exports.INVOICING_SUBSCRIPTION_SHIPPING_ADDRESS_TYPE = void 0;
|
|
4
|
+
const zeniDayJS_1 = require("../../../zeniDayJS");
|
|
4
5
|
/** `AddressType` key used when the subscription form opens the shared Address screen. */
|
|
5
6
|
exports.INVOICING_SUBSCRIPTION_SHIPPING_ADDRESS_TYPE = 'invoicing_subscription_shipping_address';
|
|
6
7
|
/**
|
|
@@ -38,17 +39,66 @@ const subscriptionItemPriceCodes = (subscription, itemType) => subscription?.sub
|
|
|
38
39
|
?.filter((item) => item.itemType === itemType)
|
|
39
40
|
.map((item) => item.itemPriceCode)
|
|
40
41
|
.filter((code) => code != null && code !== '') ?? [];
|
|
42
|
+
const subscriptionItemQuantities = (subscription, itemType) => {
|
|
43
|
+
const quantities = {};
|
|
44
|
+
subscription?.subscriptionItems
|
|
45
|
+
?.filter((item) => item.itemType === itemType)
|
|
46
|
+
.forEach((item) => {
|
|
47
|
+
if (item.itemPriceCode != null && item.itemPriceCode !== '') {
|
|
48
|
+
quantities[item.itemPriceCode] = (0, exports.toInvoicingSubscriptionQuantity)(item.quantity);
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
return quantities;
|
|
52
|
+
};
|
|
53
|
+
/**
|
|
54
|
+
* Today as `YYYY-MM-DD`, the default subscription start date. Goes through
|
|
55
|
+
* dayjs (not `toISOString`, which is UTC) so a user in a UTC+ timezone late in
|
|
56
|
+
* their day gets their own calendar date rather than yesterday's.
|
|
57
|
+
*/
|
|
58
|
+
const invoicingSubscriptionTodayIso = () => (0, zeniDayJS_1.dateNow)().format('YYYY-MM-DD');
|
|
59
|
+
exports.invoicingSubscriptionTodayIso = invoicingSubscriptionTodayIso;
|
|
60
|
+
/**
|
|
61
|
+
* Clamp a subscription-item quantity to the minimum the API accepts. Shared by
|
|
62
|
+
* the plan, add-on and charge items so none of them can bill a 0 or a fraction.
|
|
63
|
+
*/
|
|
64
|
+
const toInvoicingSubscriptionQuantity = (quantity) => {
|
|
65
|
+
const whole = Math.floor(Number(quantity));
|
|
66
|
+
return Number.isFinite(whole) && whole > 0 ? whole : 1;
|
|
67
|
+
};
|
|
68
|
+
exports.toInvoicingSubscriptionQuantity = toInvoicingSubscriptionQuantity;
|
|
69
|
+
/**
|
|
70
|
+
* Parse the billing-cycles field into what the API should receive, or
|
|
71
|
+
* `undefined` when the field is empty or unparseable (the payload then omits it
|
|
72
|
+
* so the backend applies the plan's own limit).
|
|
73
|
+
*
|
|
74
|
+
* Deliberately NOT `toInvoicingSubscriptionQuantity`: `0` is a real
|
|
75
|
+
* remaining-cycles value on a subscription serving its last paid term, and edit
|
|
76
|
+
* drafts seed it straight off the entity. Clamping it up to `1` would turn a
|
|
77
|
+
* no-op save of a non-renewing subscription into a one-cycle extension.
|
|
78
|
+
*/
|
|
79
|
+
const toInvoicingSubscriptionBillingCycles = (remainingBillingCycles) => {
|
|
80
|
+
if (remainingBillingCycles.trim() === '') {
|
|
81
|
+
return undefined;
|
|
82
|
+
}
|
|
83
|
+
const whole = Math.floor(Number(remainingBillingCycles));
|
|
84
|
+
return Number.isFinite(whole) && whole >= 0 ? whole : undefined;
|
|
85
|
+
};
|
|
86
|
+
exports.toInvoicingSubscriptionBillingCycles = toInvoicingSubscriptionBillingCycles;
|
|
41
87
|
exports.initialInvoicingSubscriptionFormLocalData = {
|
|
42
88
|
addonPriceCodes: [],
|
|
89
|
+
addonQuantities: {},
|
|
43
90
|
autoCollection: true,
|
|
44
91
|
billingFrequency: 'monthly',
|
|
45
92
|
chargePriceCodes: [],
|
|
93
|
+
chargeQuantities: {},
|
|
46
94
|
couponId: '',
|
|
47
95
|
customerId: '',
|
|
48
96
|
planPriceCode: '',
|
|
49
97
|
planQuantity: 1,
|
|
50
98
|
poNumber: '',
|
|
51
99
|
preferredCurrencyCode: 'USD',
|
|
100
|
+
remainingBillingCycles: '',
|
|
101
|
+
startedAt: '',
|
|
52
102
|
trialEnd: '',
|
|
53
103
|
};
|
|
54
104
|
/** Seed the form draft from an existing subscription entity (edit mode). */
|
|
@@ -59,18 +109,26 @@ const entityToInvoicingSubscriptionFormLocalData = (subscription) => {
|
|
|
59
109
|
const planItem = subscription.subscriptionItems?.find((item) => item.itemType === 'plan');
|
|
60
110
|
return {
|
|
61
111
|
addonPriceCodes: subscriptionItemPriceCodes(subscription, 'addon'),
|
|
112
|
+
addonQuantities: subscriptionItemQuantities(subscription, 'addon'),
|
|
62
113
|
autoCollection: (subscription.autoCollection ?? 'on') === 'on',
|
|
63
114
|
billingFrequency: (0, exports.periodToBillingFrequency)(subscription.billingPeriod, subscription.billingPeriodUnit),
|
|
64
115
|
chargePriceCodes: subscriptionItemPriceCodes(subscription, 'charge'),
|
|
116
|
+
chargeQuantities: subscriptionItemQuantities(subscription, 'charge'),
|
|
65
117
|
couponId: subscription.coupons?.[0]?.couponCode ??
|
|
66
118
|
subscription.coupons?.[0]?.couponID ??
|
|
67
119
|
'',
|
|
68
120
|
customerId: subscription.customerID ?? '',
|
|
69
121
|
planPriceCode: subscriptionItemPriceCodes(subscription, 'plan')[0] ?? '',
|
|
70
|
-
planQuantity: planItem?.quantity
|
|
122
|
+
planQuantity: (0, exports.toInvoicingSubscriptionQuantity)(planItem?.quantity),
|
|
71
123
|
poNumber: subscription.poNumber ?? '',
|
|
72
124
|
preferredCurrencyCode: subscription.currencyCode ?? 'USD',
|
|
125
|
+
remainingBillingCycles: subscription.remainingBillingCycles != null
|
|
126
|
+
? String(subscription.remainingBillingCycles)
|
|
127
|
+
: '',
|
|
73
128
|
setupFee: subscription.setupFee,
|
|
129
|
+
startedAt: subscription.startedAt != null
|
|
130
|
+
? subscription.startedAt.format('YYYY-MM-DD')
|
|
131
|
+
: '',
|
|
74
132
|
trialEnd: subscription.trialEnd != null
|
|
75
133
|
? subscription.trialEnd.format('YYYY-MM-DD')
|
|
76
134
|
: '',
|
|
@@ -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,7 +10,7 @@ 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
|
+
exports.getInvoiceListView = (0, toolkit_1.createSelector)((state) => state.invoicingInvoiceState, (state) => state.invoicingInvoiceListState, (state) => state.invoicingConfigViewState.invoiceStatusOptions, (invoiceState, listViewState, statusOptions) => {
|
|
13
14
|
const activeTabState = listViewState.invoiceByTab[listViewState.activeTab];
|
|
14
15
|
return {
|
|
15
16
|
activeTab: listViewState.activeTab,
|
|
@@ -22,7 +23,11 @@ exports.getInvoiceListView = (0, toolkit_1.createSelector)((state) => state.invo
|
|
|
22
23
|
kpis: listViewState.kpis,
|
|
23
24
|
kpisFetchState: listViewState.kpisFetchState,
|
|
24
25
|
nextCursor: activeTabState.nextCursor,
|
|
25
|
-
|
|
26
|
+
statusOptions,
|
|
27
|
+
tabIds: (0, invoicingTabHelper_1.invoicingTabIdsFromConfig)({
|
|
28
|
+
allTabIds: invoiceListState_1.ALL_INVOICING_INVOICE_TAB_IDS,
|
|
29
|
+
statusOptions,
|
|
30
|
+
}),
|
|
26
31
|
fetchState: activeTabState.fetchState,
|
|
27
32
|
error: activeTabState.error,
|
|
28
33
|
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;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.makeInvoiceByTab = exports.makeInvoiceTabState = exports.
|
|
3
|
+
exports.makeInvoiceByTab = 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,
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { ID } from '../../../commonStateTypes/common';
|
|
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
4
|
import { InvoicingPlan } from '../../../entity/invoicing/plan/planState';
|
|
4
5
|
import { RootState } from '../../../reducer';
|
|
5
6
|
import { InvoicingCatalogItemKind } from './invoicingCatalogItemDetailViewState';
|
|
@@ -7,8 +8,19 @@ import { InvoicingCatalogItemKind } from './invoicingCatalogItemDetailViewState'
|
|
|
7
8
|
* Read-only view for the catalog item (plan or product) detail page. One screen
|
|
8
9
|
* serves both kinds, so the bundled view carries the resolved `plan` or
|
|
9
10
|
* `product` (whichever the `kind` denotes) + the shared fetch state.
|
|
11
|
+
*
|
|
12
|
+
* The lifecycle/tier option sets and `configFetchState` are folded in from the
|
|
13
|
+
* config slice rather than left for the screen to select itself, so the page
|
|
14
|
+
* wires one selector and CES stays the only place that knows which slice each
|
|
15
|
+
* option set lives in. `configFetchState` is named apart from the view's own
|
|
16
|
+
* `fetchState` because they track different requests — the screen gates a config
|
|
17
|
+
* refetch on the former while rendering off the latter.
|
|
10
18
|
*/
|
|
11
19
|
export interface InvoicingCatalogItemDetailView extends SelectorView {
|
|
20
|
+
catalogItemLifecycleActionOptions: InvoicingCatalogLifecycleActionOption<InvoicingCatalogItemLifecycleAction>[];
|
|
21
|
+
catalogProductLifecycleActionOptions: InvoicingCatalogLifecycleActionOption<InvoicingCatalogProductLifecycleAction>[];
|
|
22
|
+
configFetchState: FetchState;
|
|
23
|
+
catalogTierTypeOptionsByPricingModel?: InvoicingNamedOptionsByKey;
|
|
12
24
|
plan?: InvoicingPlan;
|
|
13
25
|
}
|
|
14
26
|
export declare const getInvoicingCatalogItemDetail: (state: RootState, _kind: InvoicingCatalogItemKind, id: ID) => InvoicingCatalogItemDetailView;
|
package/lib/view/invoicing/invoicingCatalogItemDetailView/invoicingCatalogItemDetailViewSelector.js
CHANGED
|
@@ -2,9 +2,15 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getInvoicingCatalogItemDetail = void 0;
|
|
4
4
|
const planSelector_1 = require("../../../entity/invoicing/plan/planSelector");
|
|
5
|
+
const invoicingConfigViewSelector_1 = require("../invoicingConfigView/invoicingConfigViewSelector");
|
|
5
6
|
const getInvoicingCatalogItemDetail = (state, _kind, id) => {
|
|
6
7
|
const { error, fetchState } = state.invoicingCatalogItemDetailViewState;
|
|
8
|
+
const { catalogItemLifecycleActionOptions, catalogProductLifecycleActionOptions, catalogTierTypeOptionsByPricingModel, fetchState: configFetchState, } = (0, invoicingConfigViewSelector_1.getInvoicingConfigView)(state);
|
|
7
9
|
return {
|
|
10
|
+
catalogItemLifecycleActionOptions,
|
|
11
|
+
catalogProductLifecycleActionOptions,
|
|
12
|
+
catalogTierTypeOptionsByPricingModel,
|
|
13
|
+
configFetchState,
|
|
8
14
|
plan: (0, planSelector_1.getInvoicingPlanById)(state.invoicingPlanState, id),
|
|
9
15
|
fetchState,
|
|
10
16
|
error,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AuditLogEntityRouteOptionWire, AuditLogListSortFieldOptionWire, AuditLogSourceLabelOptionWire, InvoicingCatalogLifecycleActionOptionWire, InvoicingDunningActionOption, InvoicingNamedOptionWire, InvoicingQboAccountMappingKindOptionWire, InvoicingSubscriptionEditFieldOptionWire, InvoicingSubscriptionLifecycleActionOptionWire } from '../../../entity/invoicing/invoicingCommonPayload';
|
|
1
|
+
import { AuditLogEntityRouteOptionWire, AuditLogListSortFieldOptionWire, AuditLogSourceLabelOptionWire, InvoicingCatalogLifecycleActionOptionWire, InvoicingDunningActionOption, InvoicingNamedOptionWire, InvoicingNamedOptionsByKeyWire, InvoicingQboAccountMappingKindOptionWire, InvoicingSubscriptionEditFieldOptionWire, InvoicingSubscriptionLifecycleActionOptionWire } from '../../../entity/invoicing/invoicingCommonPayload';
|
|
2
2
|
import { ZeniAPIResponse } from '../../../responsePayload';
|
|
3
3
|
/**
|
|
4
4
|
* Wire payload of the invoicing config API (GET/PUT `/1.0/config`). Follows
|
|
@@ -23,14 +23,25 @@ export interface InvoicingConfigPayload {
|
|
|
23
23
|
subscription_metadata_edit_allowed_from_statuses: string[];
|
|
24
24
|
auto_collection_options?: InvoicingNamedOptionWire[];
|
|
25
25
|
billing_period_unit_options?: InvoicingNamedOptionWire[];
|
|
26
|
+
card_status_options?: InvoicingNamedOptionWire[];
|
|
27
|
+
catalog_item_status_options?: InvoicingNamedOptionWire[];
|
|
28
|
+
catalog_item_type_options?: InvoicingNamedOptionWire[];
|
|
29
|
+
catalog_tier_type_options_by_pricing_model?: InvoicingNamedOptionsByKeyWire;
|
|
26
30
|
catalog_trial_end_action_options?: InvoicingNamedOptionWire[];
|
|
27
31
|
catalog_trial_unit_options?: InvoicingNamedOptionWire[];
|
|
28
32
|
created_at?: string | null;
|
|
33
|
+
credit_note_reason_code_options?: InvoicingNamedOptionWire[];
|
|
34
|
+
credit_note_status_options?: InvoicingNamedOptionWire[];
|
|
35
|
+
credit_note_type_options?: InvoicingNamedOptionWire[];
|
|
36
|
+
customer_status_options?: InvoicingNamedOptionWire[];
|
|
29
37
|
customer_type_options?: InvoicingNamedOptionWire[];
|
|
30
38
|
date_format_options?: InvoicingNamedOptionWire[];
|
|
31
39
|
discount_apply_on_options?: InvoicingNamedOptionWire[];
|
|
32
40
|
discount_duration_type_options?: InvoicingNamedOptionWire[];
|
|
41
|
+
discount_status_options?: InvoicingNamedOptionWire[];
|
|
33
42
|
discount_type_options?: InvoicingNamedOptionWire[];
|
|
43
|
+
dunning_case_status_options?: InvoicingNamedOptionWire[];
|
|
44
|
+
invoice_status_options?: InvoicingNamedOptionWire[];
|
|
34
45
|
invoicing_tos_acceptance_ip?: string | null;
|
|
35
46
|
invoicing_tos_acceptance_time?: string | null;
|
|
36
47
|
invoicing_tos_acceptance_user_agent?: string | null;
|
|
@@ -42,7 +53,10 @@ export interface InvoicingConfigPayload {
|
|
|
42
53
|
qbo_account_mapping_kind_options?: InvoicingQboAccountMappingKindOptionWire[];
|
|
43
54
|
qbo_customer_matching_options?: InvoicingNamedOptionWire[];
|
|
44
55
|
qbo_sync_status_options?: InvoicingNamedOptionWire[];
|
|
56
|
+
subscription_status_options?: InvoicingNamedOptionWire[];
|
|
45
57
|
taxability_options?: InvoicingNamedOptionWire[];
|
|
58
|
+
transaction_status_options?: InvoicingNamedOptionWire[];
|
|
59
|
+
transaction_type_options?: InvoicingNamedOptionWire[];
|
|
46
60
|
updated_at?: string | null;
|
|
47
61
|
}
|
|
48
62
|
export type InvoicingConfigResponse = ZeniAPIResponse<InvoicingConfigPayload>;
|
|
@@ -2,7 +2,7 @@ import { ZeniAPIStatus } from '../../../responsePayload';
|
|
|
2
2
|
import { InvoicingConfigPayload } from './invoicingConfigViewPayload';
|
|
3
3
|
import { InvoicingConfigViewState } from './invoicingConfigViewState';
|
|
4
4
|
export declare const initialState: InvoicingConfigViewState;
|
|
5
|
-
export declare function mapInvoicingConfigPayloadToState(payload: InvoicingConfigPayload): Pick<InvoicingConfigViewState, 'auditLogEntityRouteOptions' | 'auditLogListSortFieldOptions' | 'auditLogSourceLabels' | 'autoCollectionOptions' | 'billingPeriodUnitOptions' | 'catalogTrialEndActionOptions' | 'catalogTrialUnitOptions' | 'customerTypeOptions' | 'dateFormatOptions' | 'discountApplyOnOptions' | 'discountDurationTypeOptions' | 'discountTypeOptions' | 'manualPaymentMethodOptions' | 'netTermDayOptions' | 'paymentGatewayOptions' | 'taxabilityOptions' | 'createdAt' | 'updatedAt' | 'dunningScheduleActionOptions' | 'subscriptionLifecycleActionOptions' | 'subscriptionCommercialEditAllowedFromStatuses' | 'subscriptionMetadataEditAllowedFromStatuses' | 'subscriptionEditFieldOptions' | 'subscriptionCancelTimingOptions' | 'subscriptionChangeOptionOptions' | 'catalogItemLifecycleActionOptions' | 'catalogProductLifecycleActionOptions' | 'discountLifecycleActionOptions' | 'qboAccountMappingKindOptions' | 'qboCustomerMatchingOptions' | 'qboSyncStatusOptions' | 'isInvoicingEnabled' | 'isInvoicingTosAccepted' | 'invoicingTosAcceptanceIp' | 'invoicingTosAcceptanceTime' | 'invoicingTosAcceptanceUserAgent' | 'invoicingTosAcceptanceUserId' | 'isInvoicingSettingsSeeded'>;
|
|
5
|
+
export declare function mapInvoicingConfigPayloadToState(payload: InvoicingConfigPayload): Pick<InvoicingConfigViewState, 'auditLogEntityRouteOptions' | 'auditLogListSortFieldOptions' | 'auditLogSourceLabels' | 'autoCollectionOptions' | 'billingPeriodUnitOptions' | 'catalogTierTypeOptionsByPricingModel' | 'catalogTrialEndActionOptions' | 'catalogTrialUnitOptions' | 'customerTypeOptions' | 'dateFormatOptions' | 'discountApplyOnOptions' | 'discountDurationTypeOptions' | 'discountTypeOptions' | 'manualPaymentMethodOptions' | 'netTermDayOptions' | 'paymentGatewayOptions' | 'taxabilityOptions' | 'cardStatusOptions' | 'catalogItemStatusOptions' | 'catalogItemTypeOptions' | 'creditNoteReasonCodeOptions' | 'creditNoteStatusOptions' | 'creditNoteTypeOptions' | 'customerStatusOptions' | 'discountStatusOptions' | 'dunningCaseStatusOptions' | 'invoiceStatusOptions' | 'subscriptionStatusOptions' | 'transactionStatusOptions' | 'transactionTypeOptions' | 'createdAt' | 'updatedAt' | 'dunningScheduleActionOptions' | 'subscriptionLifecycleActionOptions' | 'subscriptionCommercialEditAllowedFromStatuses' | 'subscriptionMetadataEditAllowedFromStatuses' | 'subscriptionEditFieldOptions' | 'subscriptionCancelTimingOptions' | 'subscriptionChangeOptionOptions' | 'catalogItemLifecycleActionOptions' | 'catalogProductLifecycleActionOptions' | 'discountLifecycleActionOptions' | 'qboAccountMappingKindOptions' | 'qboCustomerMatchingOptions' | 'qboSyncStatusOptions' | 'isInvoicingEnabled' | 'isInvoicingTosAccepted' | 'invoicingTosAcceptanceIp' | 'invoicingTosAcceptanceTime' | 'invoicingTosAcceptanceUserAgent' | 'invoicingTosAcceptanceUserId' | 'isInvoicingSettingsSeeded'>;
|
|
6
6
|
export declare const fetchInvoicingConfig: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[payload?: {
|
|
7
7
|
cacheOverride?: boolean;
|
|
8
8
|
} | undefined], {
|
|
@@ -15,6 +15,7 @@ exports.initialState = {
|
|
|
15
15
|
auditLogSourceLabels: [],
|
|
16
16
|
autoCollectionOptions: [],
|
|
17
17
|
billingPeriodUnitOptions: [],
|
|
18
|
+
catalogTierTypeOptionsByPricingModel: undefined,
|
|
18
19
|
catalogTrialEndActionOptions: [],
|
|
19
20
|
catalogTrialUnitOptions: [],
|
|
20
21
|
customerTypeOptions: [],
|
|
@@ -27,6 +28,19 @@ exports.initialState = {
|
|
|
27
28
|
netTermDayOptions: [],
|
|
28
29
|
paymentGatewayOptions: [],
|
|
29
30
|
taxabilityOptions: [],
|
|
31
|
+
cardStatusOptions: [],
|
|
32
|
+
catalogItemStatusOptions: [],
|
|
33
|
+
catalogItemTypeOptions: [],
|
|
34
|
+
creditNoteReasonCodeOptions: [],
|
|
35
|
+
creditNoteStatusOptions: [],
|
|
36
|
+
creditNoteTypeOptions: [],
|
|
37
|
+
customerStatusOptions: [],
|
|
38
|
+
discountStatusOptions: [],
|
|
39
|
+
dunningCaseStatusOptions: [],
|
|
40
|
+
invoiceStatusOptions: [],
|
|
41
|
+
subscriptionStatusOptions: [],
|
|
42
|
+
transactionStatusOptions: [],
|
|
43
|
+
transactionTypeOptions: [],
|
|
30
44
|
enableFetchState: { fetchState: 'Not-Started', error: undefined },
|
|
31
45
|
subscriptionLifecycleActionOptions: [],
|
|
32
46
|
subscriptionCommercialEditAllowedFromStatuses: [],
|
|
@@ -66,6 +80,9 @@ function mapInvoicingConfigPayloadToState(payload) {
|
|
|
66
80
|
})),
|
|
67
81
|
autoCollectionOptions: (payload.auto_collection_options ?? []).map(invoicingCommonPayload_1.toInvoicingNamedOption),
|
|
68
82
|
billingPeriodUnitOptions: (payload.billing_period_unit_options ?? []).map(invoicingCommonPayload_1.toInvoicingNamedOption),
|
|
83
|
+
catalogTierTypeOptionsByPricingModel: payload.catalog_tier_type_options_by_pricing_model != null
|
|
84
|
+
? (0, invoicingCommonPayload_1.toInvoicingNamedOptionsByKey)(payload.catalog_tier_type_options_by_pricing_model)
|
|
85
|
+
: undefined,
|
|
69
86
|
catalogTrialEndActionOptions: (payload.catalog_trial_end_action_options ?? []).map(invoicingCommonPayload_1.toInvoicingNamedOption),
|
|
70
87
|
catalogTrialUnitOptions: (payload.catalog_trial_unit_options ?? []).map(invoicingCommonPayload_1.toInvoicingNamedOption),
|
|
71
88
|
customerTypeOptions: (payload.customer_type_options ?? []).map(invoicingCommonPayload_1.toInvoicingNamedOption),
|
|
@@ -77,6 +94,19 @@ function mapInvoicingConfigPayloadToState(payload) {
|
|
|
77
94
|
netTermDayOptions: (payload.net_term_day_options ?? []).map(invoicingCommonPayload_1.toInvoicingNamedOption),
|
|
78
95
|
paymentGatewayOptions: (payload.payment_gateway_options ?? []).map(invoicingCommonPayload_1.toInvoicingNamedOption),
|
|
79
96
|
taxabilityOptions: (payload.taxability_options ?? []).map(invoicingCommonPayload_1.toInvoicingNamedOption),
|
|
97
|
+
cardStatusOptions: (payload.card_status_options ?? []).map(invoicingCommonPayload_1.toInvoicingNamedOption),
|
|
98
|
+
catalogItemStatusOptions: (payload.catalog_item_status_options ?? []).map(invoicingCommonPayload_1.toInvoicingNamedOption),
|
|
99
|
+
catalogItemTypeOptions: (payload.catalog_item_type_options ?? []).map(invoicingCommonPayload_1.toInvoicingNamedOption),
|
|
100
|
+
creditNoteReasonCodeOptions: (payload.credit_note_reason_code_options ?? []).map(invoicingCommonPayload_1.toInvoicingNamedOption),
|
|
101
|
+
creditNoteStatusOptions: (payload.credit_note_status_options ?? []).map(invoicingCommonPayload_1.toInvoicingNamedOption),
|
|
102
|
+
creditNoteTypeOptions: (payload.credit_note_type_options ?? []).map(invoicingCommonPayload_1.toInvoicingNamedOption),
|
|
103
|
+
customerStatusOptions: (payload.customer_status_options ?? []).map(invoicingCommonPayload_1.toInvoicingNamedOption),
|
|
104
|
+
discountStatusOptions: (payload.discount_status_options ?? []).map(invoicingCommonPayload_1.toInvoicingNamedOption),
|
|
105
|
+
dunningCaseStatusOptions: (payload.dunning_case_status_options ?? []).map(invoicingCommonPayload_1.toInvoicingNamedOption),
|
|
106
|
+
invoiceStatusOptions: (payload.invoice_status_options ?? []).map(invoicingCommonPayload_1.toInvoicingNamedOption),
|
|
107
|
+
subscriptionStatusOptions: (payload.subscription_status_options ?? []).map(invoicingCommonPayload_1.toInvoicingNamedOption),
|
|
108
|
+
transactionStatusOptions: (payload.transaction_status_options ?? []).map(invoicingCommonPayload_1.toInvoicingNamedOption),
|
|
109
|
+
transactionTypeOptions: (payload.transaction_type_options ?? []).map(invoicingCommonPayload_1.toInvoicingNamedOption),
|
|
80
110
|
createdAt: payload.created_at ?? undefined,
|
|
81
111
|
updatedAt: payload.updated_at ?? undefined,
|
|
82
112
|
dunningScheduleActionOptions: payload.dunning_schedule_action_options.map((option) => ({
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { FetchStateAndError } from '../../../commonStateTypes/common';
|
|
1
|
+
import { FetchState, FetchStateAndError } from '../../../commonStateTypes/common';
|
|
2
2
|
import { RootState } from '../../../reducer';
|
|
3
3
|
import { InvoicingOnboardingStatus } from './invoicingConfigViewPayload';
|
|
4
4
|
import { InvoicingConfigViewState } from './invoicingConfigViewState';
|
|
@@ -16,3 +16,21 @@ export interface InvoicingConfigView extends Omit<InvoicingConfigViewState, 'acc
|
|
|
16
16
|
status?: InvoicingOnboardingStatus;
|
|
17
17
|
}
|
|
18
18
|
export declare const getInvoicingConfigView: (state: RootState) => InvoicingConfigView;
|
|
19
|
+
/**
|
|
20
|
+
* The onboarding/route gate's slice of the config: whether invoicing is routed to
|
|
21
|
+
* the promo, the settings step or the live module, plus the two action fetch
|
|
22
|
+
* states those surfaces render against.
|
|
23
|
+
*
|
|
24
|
+
* Exists so the drawers, the invoicing route gate and the promo screen have a
|
|
25
|
+
* concern-scoped view to read instead of reaching into
|
|
26
|
+
* {@link getInvoicingConfigView} — they are nav and routing, not pages, so there
|
|
27
|
+
* is no page-level view for them to use. The whole config shape stays out of
|
|
28
|
+
* their props either way.
|
|
29
|
+
*/
|
|
30
|
+
export interface InvoicingOnboardingGateView {
|
|
31
|
+
acceptTermsState: FetchStateAndError;
|
|
32
|
+
enableState: FetchStateAndError;
|
|
33
|
+
fetchState: FetchState;
|
|
34
|
+
status?: InvoicingOnboardingStatus;
|
|
35
|
+
}
|
|
36
|
+
export declare const getInvoicingOnboardingGateView: (state: RootState) => InvoicingOnboardingGateView;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getInvoicingConfigView = void 0;
|
|
3
|
+
exports.getInvoicingOnboardingGateView = exports.getInvoicingConfigView = void 0;
|
|
4
4
|
const invoicingConfigViewPayload_1 = require("./invoicingConfigViewPayload");
|
|
5
5
|
const getInvoicingConfigView = (state) => {
|
|
6
6
|
const { acceptTermsFetchState, enableFetchState, ...configState } = state.invoicingConfigViewState;
|
|
@@ -12,3 +12,13 @@ const getInvoicingConfigView = (state) => {
|
|
|
12
12
|
};
|
|
13
13
|
};
|
|
14
14
|
exports.getInvoicingConfigView = getInvoicingConfigView;
|
|
15
|
+
const getInvoicingOnboardingGateView = (state) => {
|
|
16
|
+
const { acceptTermsFetchState, enableFetchState, fetchState } = state.invoicingConfigViewState;
|
|
17
|
+
return {
|
|
18
|
+
acceptTermsState: acceptTermsFetchState,
|
|
19
|
+
enableState: enableFetchState,
|
|
20
|
+
fetchState,
|
|
21
|
+
status: (0, invoicingConfigViewPayload_1.deriveInvoicingOnboardingStatus)(state.invoicingConfigViewState.isInvoicingTosAccepted, state.invoicingConfigViewState.isInvoicingEnabled),
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
exports.getInvoicingOnboardingGateView = getInvoicingOnboardingGateView;
|