@zeniai/client-epic-state 5.1.95 → 5.1.96-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 +9 -0
- package/lib/entity/invoicing/invoicingCommonPayload.js +7 -0
- package/lib/esm/entity/invoicing/invoicingCommonPayload.js +6 -0
- package/lib/esm/index.js +2 -2
- package/lib/esm/view/invoicing/editInvoicingCatalogItemDetailView/editInvoicingCatalogItemDetailViewSelector.js +2 -0
- package/lib/esm/view/invoicing/editInvoicingSubscriptionDetailView/editInvoicingSubscriptionDetailViewPayload.js +16 -4
- package/lib/esm/view/invoicing/editInvoicingSubscriptionDetailView/invoicingSubscriptionFormConfig.js +34 -1
- package/lib/esm/view/invoicing/invoicingCatalogItemDetailView/invoicingCatalogItemDetailViewSelector.js +6 -0
- package/lib/esm/view/invoicing/invoicingConfigView/invoicingConfigViewReducer.js +5 -1
- package/lib/index.d.ts +3 -3
- package/lib/index.js +10 -7
- package/lib/tsconfig.typecheck.tsbuildinfo +1 -0
- package/lib/view/invoicing/editInvoicingCatalogItemDetailView/editInvoicingCatalogItemDetailViewSelector.d.ts +8 -0
- package/lib/view/invoicing/editInvoicingCatalogItemDetailView/editInvoicingCatalogItemDetailViewSelector.js +2 -0
- package/lib/view/invoicing/editInvoicingSubscriptionDetailView/editInvoicingSubscriptionDetailViewPayload.d.ts +4 -0
- package/lib/view/invoicing/editInvoicingSubscriptionDetailView/editInvoicingSubscriptionDetailViewPayload.js +15 -3
- package/lib/view/invoicing/editInvoicingSubscriptionDetailView/editInvoicingSubscriptionDetailViewState.d.ts +17 -0
- package/lib/view/invoicing/editInvoicingSubscriptionDetailView/invoicingSubscriptionFormConfig.d.ts +7 -0
- package/lib/view/invoicing/editInvoicingSubscriptionDetailView/invoicingSubscriptionFormConfig.js +37 -2
- 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 +2 -1
- package/lib/view/invoicing/invoicingConfigView/invoicingConfigViewReducer.d.ts +1 -1
- package/lib/view/invoicing/invoicingConfigView/invoicingConfigViewReducer.js +4 -0
- package/lib/view/invoicing/invoicingConfigView/invoicingConfigViewState.d.ts +7 -1
- package/package.json +1 -1
|
@@ -1,5 +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
4
|
import { InvoicingPlan } from '../../../entity/invoicing/plan/planState';
|
|
4
5
|
import { RootState } from '../../../reducer';
|
|
5
6
|
import { InvoicingCatalogItemKind } from '../invoicingCatalogItemDetailView/invoicingCatalogItemDetailViewState';
|
|
@@ -38,6 +39,13 @@ export interface InvoicingCatalogItemFormView extends SelectorView {
|
|
|
38
39
|
trialEndActionValues: readonly string[];
|
|
39
40
|
trialUnitValues: readonly string[];
|
|
40
41
|
typeValues: readonly string[];
|
|
42
|
+
/**
|
|
43
|
+
* Backend tier-type choices per pricing model. Folded in here rather than left
|
|
44
|
+
* for the screen to pull off `getInvoicingConfigView` itself, so the form wires
|
|
45
|
+
* one selector and CES stays the only place that knows which slice each option
|
|
46
|
+
* set lives in.
|
|
47
|
+
*/
|
|
48
|
+
catalogTierTypeOptionsByPricingModel?: InvoicingNamedOptionsByKey;
|
|
41
49
|
kind?: InvoicingCatalogItemKind;
|
|
42
50
|
plan?: InvoicingPlan;
|
|
43
51
|
savedItemId?: ID;
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.getInvoicingCatalogItemFormView = exports.getInvoicingApplicableCatalogItemOptions = exports.getSavedInvoicingCatalogItemKind = exports.getSavedInvoicingCatalogItemId = exports.getEditInvoicingCatalogItemDetailViewState = void 0;
|
|
4
4
|
const toolkit_1 = require("@reduxjs/toolkit");
|
|
5
5
|
const planSelector_1 = require("../../../entity/invoicing/plan/planSelector");
|
|
6
|
+
const invoicingConfigViewSelector_1 = require("../invoicingConfigView/invoicingConfigViewSelector");
|
|
6
7
|
const invoicingCatalogItemFormConfig_1 = require("./invoicingCatalogItemFormConfig");
|
|
7
8
|
const getEditInvoicingCatalogItemDetailViewState = (state) => ({
|
|
8
9
|
fetchState: state.editInvoicingCatalogItemDetailViewState.fetchState,
|
|
@@ -65,6 +66,7 @@ const getInvoicingCatalogItemFormView = (state, id) => {
|
|
|
65
66
|
trialEndActionValues: invoicingCatalogItemFormConfig_1.INVOICING_CATALOG_TRIAL_END_ACTION_VALUES,
|
|
66
67
|
trialUnitValues: invoicingCatalogItemFormConfig_1.INVOICING_CATALOG_TRIAL_UNIT_VALUES,
|
|
67
68
|
typeValues: invoicingCatalogItemFormConfig_1.INVOICING_CATALOG_TYPE_VALUES,
|
|
69
|
+
catalogTierTypeOptionsByPricingModel: (0, invoicingConfigViewSelector_1.getInvoicingConfigView)(state).catalogTierTypeOptionsByPricingModel,
|
|
68
70
|
kind,
|
|
69
71
|
plan,
|
|
70
72
|
savedItemId,
|
|
@@ -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,40 @@ 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 = localData.remainingBillingCycles.trim();
|
|
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 !== ''
|
|
51
|
+
? {
|
|
52
|
+
remaining_billing_cycles: (0, invoicingSubscriptionFormConfig_1.toInvoicingSubscriptionQuantity)(Number(remainingBillingCycles)),
|
|
53
|
+
}
|
|
54
|
+
: {}),
|
|
43
55
|
...(localData.couponId !== '' ? { coupon_ids: [localData.couponId] } : {}),
|
|
44
56
|
...(shippingAddress != null
|
|
45
57
|
? { 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,13 @@ 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
|
+
/** Today as `YYYY-MM-DD`, the default subscription start date. */
|
|
19
|
+
export declare const invoicingSubscriptionTodayIso: () => string;
|
|
20
|
+
/**
|
|
21
|
+
* Clamp a subscription-item quantity to the minimum the API accepts. Shared by
|
|
22
|
+
* the plan, add-on and charge items so none of them can bill a 0 or a fraction.
|
|
23
|
+
*/
|
|
24
|
+
export declare const toInvoicingSubscriptionQuantity: (quantity?: number) => number;
|
|
18
25
|
export declare const initialInvoicingSubscriptionFormLocalData: InvoicingSubscriptionFormLocalData;
|
|
19
26
|
/** Seed the form draft from an existing subscription entity (edit mode). */
|
|
20
27
|
export declare const entityToInvoicingSubscriptionFormLocalData: (subscription?: InvoicingSubscription) => InvoicingSubscriptionFormLocalData;
|
package/lib/view/invoicing/editInvoicingSubscriptionDetailView/invoicingSubscriptionFormConfig.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
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.toInvoicingSubscriptionQuantity = exports.invoicingSubscriptionTodayIso = exports.periodToBillingFrequency = exports.billingFrequencyToPeriod = exports.INVOICING_SUBSCRIPTION_BILLING_FREQUENCY_VALUES = exports.INVOICING_SUBSCRIPTION_SHIPPING_ADDRESS_TYPE = void 0;
|
|
4
4
|
/** `AddressType` key used when the subscription form opens the shared Address screen. */
|
|
5
5
|
exports.INVOICING_SUBSCRIPTION_SHIPPING_ADDRESS_TYPE = 'invoicing_subscription_shipping_address';
|
|
6
6
|
/**
|
|
@@ -38,17 +38,44 @@ const subscriptionItemPriceCodes = (subscription, itemType) => subscription?.sub
|
|
|
38
38
|
?.filter((item) => item.itemType === itemType)
|
|
39
39
|
.map((item) => item.itemPriceCode)
|
|
40
40
|
.filter((code) => code != null && code !== '') ?? [];
|
|
41
|
+
const subscriptionItemQuantities = (subscription, itemType) => {
|
|
42
|
+
const quantities = {};
|
|
43
|
+
subscription?.subscriptionItems
|
|
44
|
+
?.filter((item) => item.itemType === itemType)
|
|
45
|
+
.forEach((item) => {
|
|
46
|
+
if (item.itemPriceCode != null && item.itemPriceCode !== '') {
|
|
47
|
+
quantities[item.itemPriceCode] = (0, exports.toInvoicingSubscriptionQuantity)(item.quantity);
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
return quantities;
|
|
51
|
+
};
|
|
52
|
+
/** Today as `YYYY-MM-DD`, the default subscription start date. */
|
|
53
|
+
const invoicingSubscriptionTodayIso = () => new Date().toISOString().slice(0, 10);
|
|
54
|
+
exports.invoicingSubscriptionTodayIso = invoicingSubscriptionTodayIso;
|
|
55
|
+
/**
|
|
56
|
+
* Clamp a subscription-item quantity to the minimum the API accepts. Shared by
|
|
57
|
+
* the plan, add-on and charge items so none of them can bill a 0 or a fraction.
|
|
58
|
+
*/
|
|
59
|
+
const toInvoicingSubscriptionQuantity = (quantity) => {
|
|
60
|
+
const whole = Math.floor(Number(quantity));
|
|
61
|
+
return Number.isFinite(whole) && whole > 0 ? whole : 1;
|
|
62
|
+
};
|
|
63
|
+
exports.toInvoicingSubscriptionQuantity = toInvoicingSubscriptionQuantity;
|
|
41
64
|
exports.initialInvoicingSubscriptionFormLocalData = {
|
|
42
65
|
addonPriceCodes: [],
|
|
66
|
+
addonQuantities: {},
|
|
43
67
|
autoCollection: true,
|
|
44
68
|
billingFrequency: 'monthly',
|
|
45
69
|
chargePriceCodes: [],
|
|
70
|
+
chargeQuantities: {},
|
|
46
71
|
couponId: '',
|
|
47
72
|
customerId: '',
|
|
48
73
|
planPriceCode: '',
|
|
49
74
|
planQuantity: 1,
|
|
50
75
|
poNumber: '',
|
|
51
76
|
preferredCurrencyCode: 'USD',
|
|
77
|
+
remainingBillingCycles: '',
|
|
78
|
+
startedAt: '',
|
|
52
79
|
trialEnd: '',
|
|
53
80
|
};
|
|
54
81
|
/** Seed the form draft from an existing subscription entity (edit mode). */
|
|
@@ -59,18 +86,26 @@ const entityToInvoicingSubscriptionFormLocalData = (subscription) => {
|
|
|
59
86
|
const planItem = subscription.subscriptionItems?.find((item) => item.itemType === 'plan');
|
|
60
87
|
return {
|
|
61
88
|
addonPriceCodes: subscriptionItemPriceCodes(subscription, 'addon'),
|
|
89
|
+
addonQuantities: subscriptionItemQuantities(subscription, 'addon'),
|
|
62
90
|
autoCollection: (subscription.autoCollection ?? 'on') === 'on',
|
|
63
91
|
billingFrequency: (0, exports.periodToBillingFrequency)(subscription.billingPeriod, subscription.billingPeriodUnit),
|
|
64
92
|
chargePriceCodes: subscriptionItemPriceCodes(subscription, 'charge'),
|
|
93
|
+
chargeQuantities: subscriptionItemQuantities(subscription, 'charge'),
|
|
65
94
|
couponId: subscription.coupons?.[0]?.couponCode ??
|
|
66
95
|
subscription.coupons?.[0]?.couponID ??
|
|
67
96
|
'',
|
|
68
97
|
customerId: subscription.customerID ?? '',
|
|
69
98
|
planPriceCode: subscriptionItemPriceCodes(subscription, 'plan')[0] ?? '',
|
|
70
|
-
planQuantity: planItem?.quantity
|
|
99
|
+
planQuantity: (0, exports.toInvoicingSubscriptionQuantity)(planItem?.quantity),
|
|
71
100
|
poNumber: subscription.poNumber ?? '',
|
|
72
101
|
preferredCurrencyCode: subscription.currencyCode ?? 'USD',
|
|
102
|
+
remainingBillingCycles: subscription.remainingBillingCycles != null
|
|
103
|
+
? String(subscription.remainingBillingCycles)
|
|
104
|
+
: '',
|
|
73
105
|
setupFee: subscription.setupFee,
|
|
106
|
+
startedAt: subscription.startedAt != null
|
|
107
|
+
? subscription.startedAt.format('YYYY-MM-DD')
|
|
108
|
+
: '',
|
|
74
109
|
trialEnd: subscription.trialEnd != null
|
|
75
110
|
? subscription.trialEnd.format('YYYY-MM-DD')
|
|
76
111
|
: '',
|
|
@@ -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,6 +23,7 @@ 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
|
+
catalog_tier_type_options_by_pricing_model?: InvoicingNamedOptionsByKeyWire;
|
|
26
27
|
catalog_trial_end_action_options?: InvoicingNamedOptionWire[];
|
|
27
28
|
catalog_trial_unit_options?: InvoicingNamedOptionWire[];
|
|
28
29
|
created_at?: string | null;
|
|
@@ -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' | '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: [],
|
|
@@ -66,6 +67,9 @@ function mapInvoicingConfigPayloadToState(payload) {
|
|
|
66
67
|
})),
|
|
67
68
|
autoCollectionOptions: (payload.auto_collection_options ?? []).map(invoicingCommonPayload_1.toInvoicingNamedOption),
|
|
68
69
|
billingPeriodUnitOptions: (payload.billing_period_unit_options ?? []).map(invoicingCommonPayload_1.toInvoicingNamedOption),
|
|
70
|
+
catalogTierTypeOptionsByPricingModel: payload.catalog_tier_type_options_by_pricing_model != null
|
|
71
|
+
? (0, invoicingCommonPayload_1.toInvoicingNamedOptionsByKey)(payload.catalog_tier_type_options_by_pricing_model)
|
|
72
|
+
: undefined,
|
|
69
73
|
catalogTrialEndActionOptions: (payload.catalog_trial_end_action_options ?? []).map(invoicingCommonPayload_1.toInvoicingNamedOption),
|
|
70
74
|
catalogTrialUnitOptions: (payload.catalog_trial_unit_options ?? []).map(invoicingCommonPayload_1.toInvoicingNamedOption),
|
|
71
75
|
customerTypeOptions: (payload.customer_type_options ?? []).map(invoicingCommonPayload_1.toInvoicingNamedOption),
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { FetchStateAndError, FetchedState } from '../../../commonStateTypes/common';
|
|
2
|
-
import type { AuditLogEntityRouteOption, AuditLogListSortFieldOption, AuditLogSourceLabelOption, InvoicingCatalogItemLifecycleAction, InvoicingCatalogLifecycleActionOption, InvoicingCatalogProductLifecycleAction, InvoicingDiscountLifecycleActionOption, InvoicingNamedOption, InvoicingQboAccountMappingKindOption, InvoicingSubscriptionEditFieldOption, InvoicingSubscriptionLifecycleActionOption } from '../../../entity/invoicing/invoicingCommonPayload';
|
|
2
|
+
import type { AuditLogEntityRouteOption, AuditLogListSortFieldOption, AuditLogSourceLabelOption, InvoicingCatalogItemLifecycleAction, InvoicingCatalogLifecycleActionOption, InvoicingCatalogProductLifecycleAction, InvoicingDiscountLifecycleActionOption, InvoicingNamedOption, InvoicingNamedOptionsByKey, InvoicingQboAccountMappingKindOption, InvoicingSubscriptionEditFieldOption, InvoicingSubscriptionLifecycleActionOption } from '../../../entity/invoicing/invoicingCommonPayload';
|
|
3
3
|
import { InvoicingDunningActionOption } from '../../../entity/invoicing/invoicingCommonPayload';
|
|
4
4
|
export interface InvoicingConfigViewState extends FetchedState {
|
|
5
5
|
acceptTermsFetchState: FetchStateAndError;
|
|
@@ -33,6 +33,12 @@ export interface InvoicingConfigViewState extends FetchedState {
|
|
|
33
33
|
subscriptionLifecycleActionOptions: InvoicingSubscriptionLifecycleActionOption[];
|
|
34
34
|
subscriptionMetadataEditAllowedFromStatuses: string[];
|
|
35
35
|
taxabilityOptions: InvoicingNamedOption[];
|
|
36
|
+
/**
|
|
37
|
+
* Allowed tier `Type` options per pricing model. `undefined` means the config
|
|
38
|
+
* has not been loaded yet — consumers disable the tier editor rather than
|
|
39
|
+
* falling back to a hardcoded model-to-type map.
|
|
40
|
+
*/
|
|
41
|
+
catalogTierTypeOptionsByPricingModel?: InvoicingNamedOptionsByKey;
|
|
36
42
|
createdAt?: string;
|
|
37
43
|
invoicingTosAcceptanceIp?: string;
|
|
38
44
|
invoicingTosAcceptanceTime?: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zeniai/client-epic-state",
|
|
3
|
-
"version": "5.1.
|
|
3
|
+
"version": "5.1.96-betaAK0",
|
|
4
4
|
"description": "Shared module between Web & Mobile containing required abstractions for state management, async network communication. ",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "lib/esm/index.js",
|