@zeniai/client-epic-state 5.1.77-betaAK1 → 5.1.77-betaAK2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/esm/view/invoicing/createCreditNote/createCreditNoteFormConfig.js +0 -2
- package/lib/esm/view/invoicing/createCreditNote/createCreditNotePayload.js +1 -1
- package/lib/esm/view/invoicing/editInvoicingCatalogItemDetailView/catalogDetailEditPayload.js +4 -5
- package/lib/esm/view/invoicing/editInvoicingCatalogItemDetailView/editInvoicingCatalogItemDetailViewPayload.js +10 -10
- package/lib/esm/view/invoicing/editInvoicingCatalogItemDetailView/invoicingCatalogItemFormConfig.js +7 -10
- package/lib/esm/view/invoicing/editInvoicingCouponDetailView/editInvoicingCouponDetailViewPayload.js +1 -1
- package/lib/esm/view/invoicing/editInvoicingCouponDetailView/editInvoicingCouponDetailViewState.js +1 -3
- package/lib/esm/view/invoicing/editInvoicingSubscriptionDetailView/editInvoicingSubscriptionDetailViewPayload.js +2 -4
- package/lib/esm/view/invoicing/editInvoicingSubscriptionDetailView/invoicingSubscriptionFormConfig.js +1 -4
- package/lib/esm/view/invoicing/recordPayment/recordPaymentFormConfig.js +0 -2
- package/lib/esm/view/invoicing/recordPayment/recordPaymentPayload.js +2 -2
- package/lib/tsconfig.mocks.tsbuildinfo +1 -0
- package/lib/tsconfig.typecheck.tsbuildinfo +1 -0
- package/lib/view/invoicing/createCreditNote/createCreditNoteFormConfig.js +0 -2
- package/lib/view/invoicing/createCreditNote/createCreditNotePayload.js +1 -1
- package/lib/view/invoicing/createCreditNote/createCreditNoteState.d.ts +2 -1
- package/lib/view/invoicing/editInvoicingCatalogItemDetailView/catalogDetailEditPayload.d.ts +1 -1
- package/lib/view/invoicing/editInvoicingCatalogItemDetailView/catalogDetailEditPayload.js +4 -5
- package/lib/view/invoicing/editInvoicingCatalogItemDetailView/editInvoicingCatalogItemDetailViewPayload.js +10 -10
- package/lib/view/invoicing/editInvoicingCatalogItemDetailView/editInvoicingCatalogItemDetailViewState.d.ts +9 -5
- package/lib/view/invoicing/editInvoicingCatalogItemDetailView/invoicingCatalogItemFormConfig.js +7 -10
- package/lib/view/invoicing/editInvoicingCouponDetailView/editInvoicingCouponDetailViewPayload.js +1 -1
- package/lib/view/invoicing/editInvoicingCouponDetailView/editInvoicingCouponDetailViewState.d.ts +2 -1
- package/lib/view/invoicing/editInvoicingCouponDetailView/editInvoicingCouponDetailViewState.js +1 -3
- package/lib/view/invoicing/editInvoicingSubscriptionDetailView/editInvoicingSubscriptionDetailViewPayload.js +2 -4
- package/lib/view/invoicing/editInvoicingSubscriptionDetailView/editInvoicingSubscriptionDetailViewState.d.ts +2 -1
- package/lib/view/invoicing/editInvoicingSubscriptionDetailView/invoicingSubscriptionFormConfig.js +1 -4
- package/lib/view/invoicing/recordPayment/recordPaymentFormConfig.js +0 -2
- package/lib/view/invoicing/recordPayment/recordPaymentPayload.js +2 -2
- package/lib/view/invoicing/recordPayment/recordPaymentState.d.ts +2 -1
- package/package.json +1 -1
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
import { toAmount } from '../../../commonStateTypes/amount';
|
|
2
1
|
export const initialCreateCreditNoteFormLocalData = () => ({
|
|
3
2
|
customerId: '',
|
|
4
3
|
lineItems: [
|
|
5
4
|
{
|
|
6
5
|
description: '',
|
|
7
6
|
quantity: '1',
|
|
8
|
-
unitAmount: toAmount(0, 'USD', '$'),
|
|
9
7
|
},
|
|
10
8
|
],
|
|
11
9
|
reasonCode: '',
|
|
@@ -2,7 +2,7 @@ export const localDataToCreateCreditNotePayload = (localData) => {
|
|
|
2
2
|
const lineItems = localData.lineItems
|
|
3
3
|
.map((lineItem) => {
|
|
4
4
|
const quantity = Math.round(Number.parseFloat(lineItem.quantity));
|
|
5
|
-
const unitAmount = lineItem.unitAmount
|
|
5
|
+
const unitAmount = lineItem.unitAmount?.amount ?? 0;
|
|
6
6
|
return {
|
|
7
7
|
description: lineItem.description.trim(),
|
|
8
8
|
quantity,
|
package/lib/esm/view/invoicing/editInvoicingCatalogItemDetailView/catalogDetailEditPayload.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { toAmount } from '../../../commonStateTypes/amount';
|
|
2
1
|
import { invoicingProductToCatalogItemFormSubFamily, isTieredCatalogPricingModel, } from './invoicingCatalogItemFormConfig';
|
|
3
2
|
const trimOrUndefined = (value) => value.trim() !== '' ? value.trim() : undefined;
|
|
4
3
|
const trimOrNull = (value) => value.trim() !== '' ? value.trim() : null;
|
|
@@ -32,7 +31,7 @@ const tierToPayload = (tier) => ({
|
|
|
32
31
|
package_size: hasValue(tier.packageSize)
|
|
33
32
|
? Number(tier.packageSize)
|
|
34
33
|
: undefined,
|
|
35
|
-
price: tier.price
|
|
34
|
+
price: tier.price?.amount ?? 0,
|
|
36
35
|
pricing_type: tier.pricingType,
|
|
37
36
|
starting_unit: Number(tier.startingUnit) || 1,
|
|
38
37
|
});
|
|
@@ -46,7 +45,7 @@ const subFamilyToProductUpdate = (subFamily, itemType) => {
|
|
|
46
45
|
is_taxable: subFamily.isTaxable,
|
|
47
46
|
period: hasValue(subFamily.period) ? Number(subFamily.period) : null,
|
|
48
47
|
period_unit: hasValue(subFamily.period) ? subFamily.periodUnit : null,
|
|
49
|
-
price: tiered ? 0 : subFamily.priceDollars
|
|
48
|
+
price: tiered ? 0 : (subFamily.priceDollars?.amount ?? 0),
|
|
50
49
|
pricing_model: subFamily.pricingModel,
|
|
51
50
|
show_description_in_quotes: subFamily.showDescriptionInQuotes,
|
|
52
51
|
tiers: tiered ? subFamily.tiers.map(tierToPayload) : [],
|
|
@@ -123,7 +122,7 @@ export const createSubFamilyFormToPayload = (itemId, itemType, values) => {
|
|
|
123
122
|
is_taxable: true,
|
|
124
123
|
item_id: itemId,
|
|
125
124
|
name,
|
|
126
|
-
price: values.priceDollars
|
|
125
|
+
price: values.priceDollars?.amount ?? 0,
|
|
127
126
|
price_code: priceCode,
|
|
128
127
|
pricing_model: values.pricingModel || 'flat_fee',
|
|
129
128
|
show_description_in_invoices: true,
|
|
@@ -162,7 +161,7 @@ export const productToCreateSubFamilyFormValues = (product) => ({
|
|
|
162
161
|
period: product?.period != null ? String(product.period) : '1',
|
|
163
162
|
periodUnit: product?.periodUnit ?? 'month',
|
|
164
163
|
priceCode: '',
|
|
165
|
-
priceDollars: product?.price
|
|
164
|
+
priceDollars: product?.price,
|
|
166
165
|
pricingModel: product?.pricingModel ?? 'flat_fee',
|
|
167
166
|
prorationType: product?.prorationType ?? 'site_default',
|
|
168
167
|
trialEndAction: product?.trialEndAction ?? 'site_default',
|
|
@@ -7,16 +7,16 @@ const toProductCode = (value) => value
|
|
|
7
7
|
.toLowerCase()
|
|
8
8
|
.replace(/[^a-z0-9]+/g, '-')
|
|
9
9
|
.replace(/^-|-$/g, '');
|
|
10
|
-
const buildAccountingDetail = (
|
|
10
|
+
const buildAccountingDetail = (subFamily) => {
|
|
11
11
|
const detail = {};
|
|
12
|
-
if (
|
|
13
|
-
detail.sku =
|
|
12
|
+
if (subFamily.sku.trim() !== '') {
|
|
13
|
+
detail.sku = subFamily.sku.trim();
|
|
14
14
|
}
|
|
15
|
-
if (
|
|
16
|
-
detail.accounting_code =
|
|
15
|
+
if (subFamily.accountingCode.trim() !== '') {
|
|
16
|
+
detail.accounting_code = subFamily.accountingCode.trim();
|
|
17
17
|
}
|
|
18
|
-
if (
|
|
19
|
-
detail.accounting_category_1 =
|
|
18
|
+
if (subFamily.accountingCategory.trim() !== '') {
|
|
19
|
+
detail.accounting_category_1 = subFamily.accountingCategory.trim();
|
|
20
20
|
}
|
|
21
21
|
return Object.keys(detail).length > 0 ? detail : undefined;
|
|
22
22
|
};
|
|
@@ -30,7 +30,7 @@ const buildSubFamilyPayload = (localData, subFamily, clearEmptyValues) => {
|
|
|
30
30
|
free_quantity: Number(subFamily.freeQuantity) || 0,
|
|
31
31
|
is_taxable: subFamily.isTaxable,
|
|
32
32
|
name,
|
|
33
|
-
price: tiered ? 0 : subFamily.priceDollars
|
|
33
|
+
price: tiered ? 0 : (subFamily.priceDollars?.amount ?? 0),
|
|
34
34
|
price_code: priceCode,
|
|
35
35
|
pricing_model: subFamily.pricingModel,
|
|
36
36
|
show_description_in_invoices: subFamily.showDescriptionInInvoices,
|
|
@@ -69,12 +69,12 @@ const buildSubFamilyPayload = (localData, subFamily, clearEmptyValues) => {
|
|
|
69
69
|
payload.tiers = subFamily.tiers.map((tier) => ({
|
|
70
70
|
ending_unit: tier.endingUnit.trim() !== '' ? Number(tier.endingUnit) : undefined,
|
|
71
71
|
package_size: tier.packageSize.trim() !== '' ? Number(tier.packageSize) : undefined,
|
|
72
|
-
price: tier.price
|
|
72
|
+
price: tier.price?.amount ?? 0,
|
|
73
73
|
pricing_type: tier.pricingType,
|
|
74
74
|
starting_unit: Number(tier.startingUnit) || 1,
|
|
75
75
|
}));
|
|
76
76
|
}
|
|
77
|
-
const accountingDetail = buildAccountingDetail(
|
|
77
|
+
const accountingDetail = buildAccountingDetail(subFamily);
|
|
78
78
|
if (accountingDetail != null) {
|
|
79
79
|
payload.accounting_detail = accountingDetail;
|
|
80
80
|
}
|
package/lib/esm/view/invoicing/editInvoicingCatalogItemDetailView/invoicingCatalogItemFormConfig.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { toAmount } from '../../../commonStateTypes/amount';
|
|
2
1
|
/**
|
|
3
2
|
* Canonical value sets for the catalog item form. CES owns the values;
|
|
4
3
|
* web-components maps each value to a localized label.
|
|
@@ -45,11 +44,12 @@ export const isTieredCatalogPricingModel = (model) => ['tiered', 'volume', 'stai
|
|
|
45
44
|
export const blankInvoicingCatalogTier = (startingUnit = '1') => ({
|
|
46
45
|
endingUnit: '',
|
|
47
46
|
packageSize: '',
|
|
48
|
-
price: toAmount(0, 'USD', '$'),
|
|
49
47
|
pricingType: 'per_unit',
|
|
50
48
|
startingUnit,
|
|
51
49
|
});
|
|
52
50
|
export const blankInvoicingCatalogSubFamily = () => ({
|
|
51
|
+
accountingCategory: '',
|
|
52
|
+
accountingCode: '',
|
|
53
53
|
billingCycles: '',
|
|
54
54
|
description: '',
|
|
55
55
|
freeQuantity: '0',
|
|
@@ -59,12 +59,12 @@ export const blankInvoicingCatalogSubFamily = () => ({
|
|
|
59
59
|
name: '',
|
|
60
60
|
period: '1',
|
|
61
61
|
periodUnit: 'month',
|
|
62
|
-
priceDollars: toAmount(0, 'USD', '$'),
|
|
63
62
|
priceCode: '',
|
|
64
63
|
pricingModel: 'flat_fee',
|
|
65
64
|
prorationType: 'site_default',
|
|
66
65
|
showDescriptionInInvoices: true,
|
|
67
66
|
showDescriptionInQuotes: true,
|
|
67
|
+
sku: '',
|
|
68
68
|
tiers: [blankInvoicingCatalogTier('1')],
|
|
69
69
|
trialEndAction: 'site_default',
|
|
70
70
|
trialPeriod: '',
|
|
@@ -77,7 +77,10 @@ export const invoicingProductToCatalogItemFormSubFamily = (product) => {
|
|
|
77
77
|
}
|
|
78
78
|
return {
|
|
79
79
|
...base,
|
|
80
|
+
accountingCategory: product.accountingDetail?.accountingCategory1 ?? '',
|
|
81
|
+
accountingCode: product.accountingDetail?.accountingCode ?? '',
|
|
80
82
|
billingCycles: product.billingCycles != null ? String(product.billingCycles) : '',
|
|
83
|
+
sku: product.accountingDetail?.sku ?? '',
|
|
81
84
|
description: product.description ?? '',
|
|
82
85
|
freeQuantity: product.freeQuantity != null ? String(product.freeQuantity) : '0',
|
|
83
86
|
id: product.id,
|
|
@@ -86,7 +89,7 @@ export const invoicingProductToCatalogItemFormSubFamily = (product) => {
|
|
|
86
89
|
name: product.name ?? '',
|
|
87
90
|
period: product.period != null ? String(product.period) : '1',
|
|
88
91
|
periodUnit: product.periodUnit ?? 'month',
|
|
89
|
-
priceDollars: product.price
|
|
92
|
+
priceDollars: product.price,
|
|
90
93
|
priceCode: product.priceCode ?? '',
|
|
91
94
|
pricingModel: product.pricingModel ?? 'flat_fee',
|
|
92
95
|
prorationType: product.prorationType ?? 'site_default',
|
|
@@ -107,8 +110,6 @@ export const invoicingProductToCatalogItemFormSubFamily = (product) => {
|
|
|
107
110
|
};
|
|
108
111
|
};
|
|
109
112
|
export const initialInvoicingCatalogItemFormLocalData = {
|
|
110
|
-
accountingCategory: '',
|
|
111
|
-
accountingCode: '',
|
|
112
113
|
applicableItems: [],
|
|
113
114
|
catalogType: 'plan',
|
|
114
115
|
description: '',
|
|
@@ -116,7 +117,6 @@ export const initialInvoicingCatalogItemFormLocalData = {
|
|
|
116
117
|
itemApplicability: 'all',
|
|
117
118
|
name: '',
|
|
118
119
|
productCode: '',
|
|
119
|
-
sku: '',
|
|
120
120
|
subFamilies: [blankInvoicingCatalogSubFamily()],
|
|
121
121
|
unit: '',
|
|
122
122
|
};
|
|
@@ -137,8 +137,6 @@ export const entityToInvoicingCatalogItemFormLocalData = (item) => {
|
|
|
137
137
|
? 'addon'
|
|
138
138
|
: 'plan';
|
|
139
139
|
return {
|
|
140
|
-
accountingCategory: plan.subFamilies?.[0]?.accountingDetail?.accountingCategory1 ?? '',
|
|
141
|
-
accountingCode: plan.subFamilies?.[0]?.accountingDetail?.accountingCode ?? '',
|
|
142
140
|
applicableItems: item.applicableItems ?? [],
|
|
143
141
|
catalogType,
|
|
144
142
|
description: item.description ?? '',
|
|
@@ -146,7 +144,6 @@ export const entityToInvoicingCatalogItemFormLocalData = (item) => {
|
|
|
146
144
|
itemApplicability: item.itemApplicability ?? 'all',
|
|
147
145
|
name: item.name ?? '',
|
|
148
146
|
productCode: item.productCode ?? '',
|
|
149
|
-
sku: plan.subFamilies?.[0]?.accountingDetail?.sku ?? '',
|
|
150
147
|
subFamilies: plan?.subFamilies != null && plan.subFamilies.length > 0
|
|
151
148
|
? plan.subFamilies.map(invoicingProductToCatalogItemFormSubFamily)
|
|
152
149
|
: [invoicingProductToCatalogItemFormSubFamily()],
|
package/lib/esm/view/invoicing/editInvoicingCouponDetailView/editInvoicingCouponDetailViewPayload.js
CHANGED
|
@@ -22,7 +22,7 @@ export const localDataToSaveInvoicingCouponPayload = (localData, isCreate) => {
|
|
|
22
22
|
data.discount_percentage = Number(localData.discountPercentage);
|
|
23
23
|
}
|
|
24
24
|
if (localData.discountType === 'fixed_amount') {
|
|
25
|
-
if (localData.discountAmount
|
|
25
|
+
if (localData.discountAmount != null) {
|
|
26
26
|
data.discount_amount = localData.discountAmount.amount;
|
|
27
27
|
}
|
|
28
28
|
data.currency_code = 'USD';
|
package/lib/esm/view/invoicing/editInvoicingCouponDetailView/editInvoicingCouponDetailViewState.js
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
import { toAmount } from '../../../commonStateTypes/amount';
|
|
2
1
|
export const initialInvoicingCouponFormLocalData = {
|
|
3
2
|
applyOn: 'invoice_amount',
|
|
4
3
|
couponCode: '',
|
|
5
4
|
couponId: '',
|
|
6
|
-
discountAmount: toAmount(0, 'USD', '$'),
|
|
7
5
|
discountPercentage: '',
|
|
8
6
|
discountQuantity: '',
|
|
9
7
|
discountType: 'percentage',
|
|
@@ -26,7 +24,7 @@ export const entityToInvoicingCouponFormLocalData = (coupon) => {
|
|
|
26
24
|
applyOn: coupon.applyOn ?? 'invoice_amount',
|
|
27
25
|
couponCode: coupon.couponCode ?? '',
|
|
28
26
|
couponId: coupon.id ?? '',
|
|
29
|
-
discountAmount: coupon.discountAmount
|
|
27
|
+
discountAmount: coupon.discountAmount,
|
|
30
28
|
discountPercentage: coupon.discountPercentage != null
|
|
31
29
|
? String(coupon.discountPercentage)
|
|
32
30
|
: '',
|
|
@@ -24,7 +24,7 @@ export const localDataToSaveInvoicingSubscriptionPayload = (localData, shippingA
|
|
|
24
24
|
quantity: 1,
|
|
25
25
|
})),
|
|
26
26
|
];
|
|
27
|
-
const setupFee = localData.setupFee
|
|
27
|
+
const setupFee = localData.setupFee?.amount;
|
|
28
28
|
const poNumber = localData.poNumber.trim();
|
|
29
29
|
const trialEnd = localData.trialEnd.trim();
|
|
30
30
|
return {
|
|
@@ -34,9 +34,7 @@ export const localDataToSaveInvoicingSubscriptionPayload = (localData, shippingA
|
|
|
34
34
|
currency_code: localData.preferredCurrencyCode,
|
|
35
35
|
customer_id: localData.customerId,
|
|
36
36
|
subscription_items: items,
|
|
37
|
-
...(
|
|
38
|
-
? { setup_fee: setupFee }
|
|
39
|
-
: {}),
|
|
37
|
+
...(setupFee != null ? { setup_fee: setupFee } : {}),
|
|
40
38
|
...(poNumber !== '' ? { po_number: poNumber } : {}),
|
|
41
39
|
...(trialEnd !== '' ? { trial_end: trialEnd } : {}),
|
|
42
40
|
...(localData.couponId !== '' ? { coupon_ids: [localData.couponId] } : {}),
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { toAmount } from '../../../commonStateTypes/amount';
|
|
2
1
|
/** `AddressType` key used when the subscription form opens the shared Address screen. */
|
|
3
2
|
export const INVOICING_SUBSCRIPTION_SHIPPING_ADDRESS_TYPE = 'invoicing_subscription_shipping_address';
|
|
4
3
|
/**
|
|
@@ -45,7 +44,6 @@ export const initialInvoicingSubscriptionFormLocalData = {
|
|
|
45
44
|
planQuantity: 1,
|
|
46
45
|
poNumber: '',
|
|
47
46
|
preferredCurrencyCode: 'USD',
|
|
48
|
-
setupFee: toAmount(0, 'USD', '$'),
|
|
49
47
|
trialEnd: '',
|
|
50
48
|
};
|
|
51
49
|
/** Seed the form draft from an existing subscription entity (edit mode). */
|
|
@@ -67,8 +65,7 @@ export const entityToInvoicingSubscriptionFormLocalData = (subscription) => {
|
|
|
67
65
|
planQuantity: planItem?.quantity ?? 1,
|
|
68
66
|
poNumber: subscription.poNumber ?? '',
|
|
69
67
|
preferredCurrencyCode: subscription.currencyCode ?? 'USD',
|
|
70
|
-
setupFee: subscription.setupFee
|
|
71
|
-
toAmount(0, subscription.currencyCode ?? 'USD', '$'),
|
|
68
|
+
setupFee: subscription.setupFee,
|
|
72
69
|
trialEnd: subscription.trialEnd != null
|
|
73
70
|
? subscription.trialEnd.format('YYYY-MM-DD')
|
|
74
71
|
: '',
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { toAmount } from '../../../commonStateTypes/amount';
|
|
2
1
|
/**
|
|
3
2
|
* Canonical value sets for the Record Payment form. CES owns the values;
|
|
4
3
|
* web-components maps each value to a localized label.
|
|
@@ -26,7 +25,6 @@ export const INVOICING_PAYMENT_GATEWAY_VALUES = [
|
|
|
26
25
|
'other',
|
|
27
26
|
];
|
|
28
27
|
export const initialRecordPaymentFormLocalData = {
|
|
29
|
-
amount: toAmount(0, 'USD', '$'),
|
|
30
28
|
comment: '',
|
|
31
29
|
customerId: '',
|
|
32
30
|
date: '',
|
|
@@ -12,7 +12,7 @@ export const localDataToInvoiceRecordPaymentBody = (localData) => {
|
|
|
12
12
|
const date = localData.date.trim();
|
|
13
13
|
const referenceNumber = trimOrUndefined(localData.referenceNumber);
|
|
14
14
|
return {
|
|
15
|
-
amount: localData.amount
|
|
15
|
+
amount: localData.amount?.amount ?? 0,
|
|
16
16
|
payment_method: localData.paymentMethod,
|
|
17
17
|
...(gateway != null ? { gateway } : {}),
|
|
18
18
|
...(date !== '' ? { date } : {}),
|
|
@@ -25,7 +25,7 @@ export const localDataToInvoiceRecordPaymentBody = (localData) => {
|
|
|
25
25
|
* and the linked invoice into `linked_invoices`. Currency is locked to USD.
|
|
26
26
|
*/
|
|
27
27
|
export const localDataToRecordPaymentPayload = (localData) => {
|
|
28
|
-
const amount = localData.amount
|
|
28
|
+
const amount = localData.amount?.amount ?? 0;
|
|
29
29
|
const gateway = trimOrUndefined(localData.gateway);
|
|
30
30
|
const date = localData.date.trim();
|
|
31
31
|
const transactionId = trimOrUndefined(localData.transactionId);
|