@zeniai/client-epic-state 5.2.31 → 5.2.32-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/epic.d.ts +6 -6
- package/lib/epic.js +7 -8
- package/lib/esm/epic.js +6 -7
- package/lib/esm/index.js +9 -10
- package/lib/esm/reducer.js +12 -12
- package/lib/esm/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulesEpic.js +29 -11
- package/lib/esm/view/invoicing/customerPaymentMethod/customerPaymentMethodEpic.js +1 -1
- package/lib/esm/view/invoicing/editInvoicingCatalogItemDetailView/editInvoicingCatalogItemDetailViewPayload.js +1 -1
- package/lib/esm/view/invoicing/editInvoicingCatalogItemDetailView/editInvoicingCatalogItemDetailViewReducer.js +1 -24
- package/lib/esm/view/invoicing/editInvoicingCatalogItemDetailView/editInvoicingCatalogItemDetailViewSelector.js +10 -36
- package/lib/esm/view/invoicing/editInvoicingCatalogItemDetailView/invoicingCatalogSubFamilyEpics.js +2 -21
- package/lib/esm/view/invoicing/editInvoicingCatalogItemDetailView/saveInvoicingCatalogItemEpic.js +11 -33
- package/lib/esm/view/invoicing/editInvoicingCouponDetailView/editInvoicingCouponDetailViewSelector.js +9 -1
- package/lib/esm/view/invoicing/editInvoicingCustomerDetailView/editInvoicingCustomerDetailViewSelector.js +2 -0
- package/lib/esm/view/invoicing/editInvoicingCustomerDetailView/initializeInvoicingCustomerAddressEpic.js +1 -1
- package/lib/esm/view/invoicing/editInvoicingSubscriptionDetailView/editInvoicingSubscriptionDetailViewSelector.js +15 -0
- package/lib/esm/view/invoicing/editInvoicingSubscriptionDetailView/fetchInvoicingSubscriptionFormPageEpic.js +1 -1
- package/lib/esm/view/invoicing/editInvoicingSubscriptionDetailView/initializeInvoicingSubscriptionAddressEpic.js +1 -1
- package/lib/esm/view/invoicing/{invoicingCatalogItemDetailView/invoicingCatalogItemDetailViewEpics.js → invoicingCatalogItemRecordView/invoicingCatalogItemRecordViewEpics.js} +1 -1
- package/lib/esm/view/invoicing/{invoicingCatalogItemDetailView/invoicingCatalogItemDetailViewReducer.js → invoicingCatalogItemRecordView/invoicingCatalogItemRecordViewReducer.js} +4 -4
- package/lib/esm/view/invoicing/{invoicingCatalogItemDetailView/invoicingCatalogItemDetailViewSelector.js → invoicingCatalogItemRecordView/invoicingCatalogItemRecordViewSelector.js} +2 -4
- package/lib/esm/view/invoicing/{invoicingCouponDetailView → invoicingCouponRecordView}/fetchInvoicingCouponDetailEpic.js +1 -1
- package/lib/esm/view/invoicing/{invoicingCouponDetailView/invoicingCouponDetailViewReducer.js → invoicingCouponRecordView/invoicingCouponRecordViewReducer.js} +4 -4
- package/lib/esm/view/invoicing/{invoicingCouponDetailView/invoicingCouponDetailViewSelector.js → invoicingCouponRecordView/invoicingCouponRecordViewSelector.js} +2 -2
- package/lib/esm/view/invoicing/{invoicingCustomerDetailView → invoicingCustomerRecordView}/fetchInvoicingCustomerDetailEpic.js +1 -1
- package/lib/esm/view/invoicing/{invoicingCustomerDetailView → invoicingCustomerRecordView}/fetchInvoicingCustomerDetailPageEpic.js +2 -2
- package/lib/esm/view/invoicing/{invoicingCustomerDetailView/invoicingCustomerDetailViewReducer.js → invoicingCustomerRecordView/invoicingCustomerRecordViewReducer.js} +4 -4
- package/lib/esm/view/invoicing/{invoicingCustomerDetailView/invoicingCustomerDetailViewSelector.js → invoicingCustomerRecordView/invoicingCustomerRecordViewSelector.js} +3 -3
- package/lib/esm/view/invoicing/{invoicingSubscriptionDetailView/invoicingSubscriptionDetailViewEpics.js → invoicingSubscriptionRecordView/invoicingSubscriptionRecordViewEpics.js} +1 -1
- package/lib/esm/view/invoicing/{invoicingSubscriptionDetailView/invoicingSubscriptionDetailViewReducer.js → invoicingSubscriptionRecordView/invoicingSubscriptionRecordViewReducer.js} +4 -4
- package/lib/esm/view/invoicing/{invoicingSubscriptionDetailView/invoicingSubscriptionDetailViewSelector.js → invoicingSubscriptionRecordView/invoicingSubscriptionRecordViewSelector.js} +2 -2
- package/lib/esm/view/invoicing/promotionalCreditAction/promotionalCreditActionEpic.js +1 -1
- package/lib/index.d.ts +15 -17
- package/lib/index.js +23 -32
- package/lib/reducer.d.ts +4 -4
- package/lib/reducer.js +12 -12
- package/lib/rootStateTypes.d.ts +8 -8
- package/lib/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulesEpic.js +29 -11
- package/lib/view/invoicing/createInvoice/createInvoiceSelector.d.ts +2 -2
- package/lib/view/invoicing/customerPaymentMethod/customerPaymentMethodEpic.d.ts +1 -1
- package/lib/view/invoicing/customerPaymentMethod/customerPaymentMethodEpic.js +2 -2
- package/lib/view/invoicing/editInvoicingCatalogItemDetailView/editInvoicingCatalogItemDetailViewPayload.d.ts +1 -1
- package/lib/view/invoicing/editInvoicingCatalogItemDetailView/editInvoicingCatalogItemDetailViewPayload.js +1 -1
- package/lib/view/invoicing/editInvoicingCatalogItemDetailView/editInvoicingCatalogItemDetailViewReducer.d.ts +3 -19
- package/lib/view/invoicing/editInvoicingCatalogItemDetailView/editInvoicingCatalogItemDetailViewReducer.js +2 -25
- package/lib/view/invoicing/editInvoicingCatalogItemDetailView/editInvoicingCatalogItemDetailViewSelector.d.ts +11 -11
- package/lib/view/invoicing/editInvoicingCatalogItemDetailView/editInvoicingCatalogItemDetailViewSelector.js +11 -38
- package/lib/view/invoicing/editInvoicingCatalogItemDetailView/editInvoicingCatalogItemDetailViewState.d.ts +4 -27
- package/lib/view/invoicing/editInvoicingCatalogItemDetailView/invoicingCatalogSubFamilyEpics.d.ts +2 -3
- package/lib/view/invoicing/editInvoicingCatalogItemDetailView/invoicingCatalogSubFamilyEpics.js +2 -22
- package/lib/view/invoicing/editInvoicingCatalogItemDetailView/saveInvoicingCatalogItemEpic.d.ts +2 -2
- package/lib/view/invoicing/editInvoicingCatalogItemDetailView/saveInvoicingCatalogItemEpic.js +9 -31
- package/lib/view/invoicing/editInvoicingCouponDetailView/editInvoicingCouponDetailViewSelector.d.ts +12 -1
- package/lib/view/invoicing/editInvoicingCouponDetailView/editInvoicingCouponDetailViewSelector.js +9 -1
- package/lib/view/invoicing/editInvoicingCustomerDetailView/editInvoicingCustomerDetailViewSelector.d.ts +8 -0
- package/lib/view/invoicing/editInvoicingCustomerDetailView/editInvoicingCustomerDetailViewSelector.js +2 -0
- package/lib/view/invoicing/editInvoicingCustomerDetailView/initializeInvoicingCustomerAddressEpic.d.ts +1 -1
- package/lib/view/invoicing/editInvoicingCustomerDetailView/initializeInvoicingCustomerAddressEpic.js +2 -2
- package/lib/view/invoicing/editInvoicingSubscriptionDetailView/editInvoicingSubscriptionDetailViewSelector.d.ts +11 -2
- package/lib/view/invoicing/editInvoicingSubscriptionDetailView/editInvoicingSubscriptionDetailViewSelector.js +15 -0
- package/lib/view/invoicing/editInvoicingSubscriptionDetailView/fetchInvoicingSubscriptionFormPageEpic.d.ts +1 -1
- package/lib/view/invoicing/editInvoicingSubscriptionDetailView/fetchInvoicingSubscriptionFormPageEpic.js +2 -2
- package/lib/view/invoicing/editInvoicingSubscriptionDetailView/initializeInvoicingSubscriptionAddressEpic.d.ts +1 -1
- package/lib/view/invoicing/editInvoicingSubscriptionDetailView/initializeInvoicingSubscriptionAddressEpic.js +2 -2
- package/lib/view/invoicing/{invoicingCatalogItemDetailView/invoicingCatalogItemDetailViewEpics.d.ts → invoicingCatalogItemRecordView/invoicingCatalogItemRecordViewEpics.d.ts} +1 -1
- package/lib/view/invoicing/{invoicingCatalogItemDetailView/invoicingCatalogItemDetailViewEpics.js → invoicingCatalogItemRecordView/invoicingCatalogItemRecordViewEpics.js} +5 -5
- package/lib/view/invoicing/{invoicingCatalogItemDetailView/invoicingCatalogItemDetailViewReducer.d.ts → invoicingCatalogItemRecordView/invoicingCatalogItemRecordViewReducer.d.ts} +5 -5
- package/lib/view/invoicing/{invoicingCatalogItemDetailView/invoicingCatalogItemDetailViewReducer.js → invoicingCatalogItemRecordView/invoicingCatalogItemRecordViewReducer.js} +4 -4
- package/lib/view/invoicing/{invoicingCatalogItemDetailView/invoicingCatalogItemDetailViewSelector.d.ts → invoicingCatalogItemRecordView/invoicingCatalogItemRecordViewSelector.d.ts} +3 -5
- package/lib/view/invoicing/{invoicingCatalogItemDetailView/invoicingCatalogItemDetailViewSelector.js → invoicingCatalogItemRecordView/invoicingCatalogItemRecordViewSelector.js} +4 -6
- package/lib/view/invoicing/{invoicingCatalogItemDetailView/invoicingCatalogItemDetailViewState.d.ts → invoicingCatalogItemRecordView/invoicingCatalogItemRecordViewState.d.ts} +1 -1
- package/lib/view/invoicing/{invoicingCouponDetailView → invoicingCouponRecordView}/fetchInvoicingCouponDetailEpic.d.ts +1 -1
- package/lib/view/invoicing/{invoicingCouponDetailView → invoicingCouponRecordView}/fetchInvoicingCouponDetailEpic.js +5 -5
- package/lib/view/invoicing/{invoicingCouponDetailView/invoicingCouponDetailViewReducer.d.ts → invoicingCouponRecordView/invoicingCouponRecordViewReducer.d.ts} +6 -6
- package/lib/view/invoicing/{invoicingCouponDetailView/invoicingCouponDetailViewReducer.js → invoicingCouponRecordView/invoicingCouponRecordViewReducer.js} +4 -4
- package/lib/view/invoicing/{invoicingCouponDetailView/invoicingCouponDetailViewSelector.d.ts → invoicingCouponRecordView/invoicingCouponRecordViewSelector.d.ts} +2 -2
- package/lib/view/invoicing/{invoicingCouponDetailView/invoicingCouponDetailViewSelector.js → invoicingCouponRecordView/invoicingCouponRecordViewSelector.js} +4 -4
- package/lib/view/invoicing/{invoicingCouponDetailView/invoicingCouponDetailViewState.d.ts → invoicingCouponRecordView/invoicingCouponRecordViewState.d.ts} +1 -1
- package/lib/view/invoicing/{invoicingCustomerDetailView → invoicingCustomerRecordView}/fetchInvoicingCustomerDetailEpic.d.ts +1 -1
- package/lib/view/invoicing/{invoicingCustomerDetailView → invoicingCustomerRecordView}/fetchInvoicingCustomerDetailEpic.js +5 -5
- package/lib/view/invoicing/{invoicingCustomerDetailView → invoicingCustomerRecordView}/fetchInvoicingCustomerDetailPageEpic.d.ts +1 -1
- package/lib/view/invoicing/{invoicingCustomerDetailView → invoicingCustomerRecordView}/fetchInvoicingCustomerDetailPageEpic.js +4 -4
- package/lib/view/invoicing/{invoicingCustomerDetailView/invoicingCustomerDetailViewReducer.d.ts → invoicingCustomerRecordView/invoicingCustomerRecordViewReducer.d.ts} +7 -7
- package/lib/view/invoicing/{invoicingCustomerDetailView/invoicingCustomerDetailViewReducer.js → invoicingCustomerRecordView/invoicingCustomerRecordViewReducer.js} +4 -4
- package/lib/view/invoicing/{invoicingCustomerDetailView/invoicingCustomerDetailViewSelector.d.ts → invoicingCustomerRecordView/invoicingCustomerRecordViewSelector.d.ts} +2 -2
- package/lib/view/invoicing/{invoicingCustomerDetailView/invoicingCustomerDetailViewSelector.js → invoicingCustomerRecordView/invoicingCustomerRecordViewSelector.js} +5 -5
- package/lib/view/invoicing/{invoicingCustomerDetailView/invoicingCustomerDetailViewState.d.ts → invoicingCustomerRecordView/invoicingCustomerRecordViewState.d.ts} +1 -1
- package/lib/view/invoicing/{invoicingSubscriptionDetailView/invoicingSubscriptionDetailViewEpics.d.ts → invoicingSubscriptionRecordView/invoicingSubscriptionRecordViewEpics.d.ts} +1 -1
- package/lib/view/invoicing/{invoicingSubscriptionDetailView/invoicingSubscriptionDetailViewEpics.js → invoicingSubscriptionRecordView/invoicingSubscriptionRecordViewEpics.js} +5 -5
- package/lib/view/invoicing/{invoicingSubscriptionDetailView/invoicingSubscriptionDetailViewReducer.d.ts → invoicingSubscriptionRecordView/invoicingSubscriptionRecordViewReducer.d.ts} +5 -5
- package/lib/view/invoicing/{invoicingSubscriptionDetailView/invoicingSubscriptionDetailViewReducer.js → invoicingSubscriptionRecordView/invoicingSubscriptionRecordViewReducer.js} +4 -4
- package/lib/view/invoicing/{invoicingSubscriptionDetailView/invoicingSubscriptionDetailViewSelector.d.ts → invoicingSubscriptionRecordView/invoicingSubscriptionRecordViewSelector.d.ts} +2 -2
- package/lib/view/invoicing/{invoicingSubscriptionDetailView/invoicingSubscriptionDetailViewSelector.js → invoicingSubscriptionRecordView/invoicingSubscriptionRecordViewSelector.js} +4 -4
- package/lib/view/invoicing/{invoicingSubscriptionDetailView/invoicingSubscriptionDetailViewState.d.ts → invoicingSubscriptionRecordView/invoicingSubscriptionRecordViewState.d.ts} +1 -1
- package/lib/view/invoicing/promotionalCreditAction/promotionalCreditActionEpic.d.ts +1 -1
- package/lib/view/invoicing/promotionalCreditAction/promotionalCreditActionEpic.js +2 -2
- package/package.json +71 -38
- package/lib/esm/view/invoicing/editInvoicingCatalogItemDetailView/catalogDetailEditPayload.js +0 -191
- package/lib/view/invoicing/editInvoicingCatalogItemDetailView/catalogDetailEditPayload.d.ts +0 -46
- package/lib/view/invoicing/editInvoicingCatalogItemDetailView/catalogDetailEditPayload.js +0 -198
- /package/lib/esm/view/invoicing/{invoicingCatalogItemDetailView/invoicingCatalogItemDetailViewPayload.js → invoicingCatalogItemRecordView/invoicingCatalogItemRecordViewPayload.js} +0 -0
- /package/lib/esm/view/invoicing/{invoicingCatalogItemDetailView/invoicingCatalogItemDetailViewState.js → invoicingCatalogItemRecordView/invoicingCatalogItemRecordViewState.js} +0 -0
- /package/lib/esm/view/invoicing/{invoicingCouponDetailView/invoicingCouponDetailViewPayload.js → invoicingCouponRecordView/invoicingCouponRecordViewPayload.js} +0 -0
- /package/lib/esm/view/invoicing/{invoicingCouponDetailView/invoicingCouponDetailViewState.js → invoicingCouponRecordView/invoicingCouponRecordViewState.js} +0 -0
- /package/lib/esm/view/invoicing/{invoicingCustomerDetailView/invoicingCustomerDetailViewPayload.js → invoicingCustomerRecordView/invoicingCustomerRecordViewPayload.js} +0 -0
- /package/lib/esm/view/invoicing/{invoicingCustomerDetailView/invoicingCustomerDetailViewState.js → invoicingCustomerRecordView/invoicingCustomerRecordViewState.js} +0 -0
- /package/lib/esm/view/invoicing/{invoicingSubscriptionDetailView/invoicingSubscriptionDetailViewPayload.js → invoicingSubscriptionRecordView/invoicingSubscriptionRecordViewPayload.js} +0 -0
- /package/lib/esm/view/invoicing/{invoicingSubscriptionDetailView/invoicingSubscriptionDetailViewState.js → invoicingSubscriptionRecordView/invoicingSubscriptionRecordViewState.js} +0 -0
- /package/lib/view/invoicing/{invoicingCatalogItemDetailView/invoicingCatalogItemDetailViewPayload.d.ts → invoicingCatalogItemRecordView/invoicingCatalogItemRecordViewPayload.d.ts} +0 -0
- /package/lib/view/invoicing/{invoicingCatalogItemDetailView/invoicingCatalogItemDetailViewPayload.js → invoicingCatalogItemRecordView/invoicingCatalogItemRecordViewPayload.js} +0 -0
- /package/lib/view/invoicing/{invoicingCatalogItemDetailView/invoicingCatalogItemDetailViewState.js → invoicingCatalogItemRecordView/invoicingCatalogItemRecordViewState.js} +0 -0
- /package/lib/view/invoicing/{invoicingCouponDetailView/invoicingCouponDetailViewPayload.d.ts → invoicingCouponRecordView/invoicingCouponRecordViewPayload.d.ts} +0 -0
- /package/lib/view/invoicing/{invoicingCouponDetailView/invoicingCouponDetailViewPayload.js → invoicingCouponRecordView/invoicingCouponRecordViewPayload.js} +0 -0
- /package/lib/view/invoicing/{invoicingCouponDetailView/invoicingCouponDetailViewState.js → invoicingCouponRecordView/invoicingCouponRecordViewState.js} +0 -0
- /package/lib/view/invoicing/{invoicingCustomerDetailView/invoicingCustomerDetailViewPayload.d.ts → invoicingCustomerRecordView/invoicingCustomerRecordViewPayload.d.ts} +0 -0
- /package/lib/view/invoicing/{invoicingCustomerDetailView/invoicingCustomerDetailViewPayload.js → invoicingCustomerRecordView/invoicingCustomerRecordViewPayload.js} +0 -0
- /package/lib/view/invoicing/{invoicingCustomerDetailView/invoicingCustomerDetailViewState.js → invoicingCustomerRecordView/invoicingCustomerRecordViewState.js} +0 -0
- /package/lib/view/invoicing/{invoicingSubscriptionDetailView/invoicingSubscriptionDetailViewPayload.d.ts → invoicingSubscriptionRecordView/invoicingSubscriptionRecordViewPayload.d.ts} +0 -0
- /package/lib/view/invoicing/{invoicingSubscriptionDetailView/invoicingSubscriptionDetailViewPayload.js → invoicingSubscriptionRecordView/invoicingSubscriptionRecordViewPayload.js} +0 -0
- /package/lib/view/invoicing/{invoicingSubscriptionDetailView/invoicingSubscriptionDetailViewState.js → invoicingSubscriptionRecordView/invoicingSubscriptionRecordViewState.js} +0 -0
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.getInvoicingSubscriptionRecord = exports.getInvoicingSubscriptionById = void 0;
|
|
4
4
|
const invoicingSubscriptionSelector_1 = require("../../../entity/invoicing/invoicingSubscription/invoicingSubscriptionSelector");
|
|
5
5
|
const invoicingConfigViewSelector_1 = require("../invoicingConfigView/invoicingConfigViewSelector");
|
|
6
6
|
const subscriptionActionSelector_1 = require("../subscriptionAction/subscriptionActionSelector");
|
|
7
7
|
const getInvoicingSubscriptionById = (state, id) => (0, invoicingSubscriptionSelector_1.getInvoicingSubscriptionById)(state.invoicingSubscriptionState, id);
|
|
8
8
|
exports.getInvoicingSubscriptionById = getInvoicingSubscriptionById;
|
|
9
|
-
const
|
|
10
|
-
const { error, fetchState } = state.
|
|
9
|
+
const getInvoicingSubscriptionRecord = (state, invoicingSubscriptionID) => {
|
|
10
|
+
const { error, fetchState } = state.invoicingSubscriptionRecordViewState;
|
|
11
11
|
return {
|
|
12
12
|
fieldHelp: (0, invoicingConfigViewSelector_1.invoicingFieldHelpForGroup)(state, 'subscription'),
|
|
13
13
|
cancelReasonCodeOptions: (0, invoicingConfigViewSelector_1.getInvoicingConfigView)(state).subscriptionCancelReasonCodeOptions,
|
|
@@ -18,4 +18,4 @@ const getInvoicingSubscriptionDetail = (state, invoicingSubscriptionID) => {
|
|
|
18
18
|
version: 1.0,
|
|
19
19
|
};
|
|
20
20
|
};
|
|
21
|
-
exports.
|
|
21
|
+
exports.getInvoicingSubscriptionRecord = getInvoicingSubscriptionRecord;
|
|
@@ -2,7 +2,7 @@ import { ActionsObservable, StateObservable } from 'redux-observable';
|
|
|
2
2
|
import { Observable } from 'rxjs';
|
|
3
3
|
import { RootState } from '../../../rootStateTypes';
|
|
4
4
|
import { ZeniAPI } from '../../../zeniAPI';
|
|
5
|
-
import { fetchInvoicingCustomerDetail } from '../
|
|
5
|
+
import { fetchInvoicingCustomerDetail } from '../invoicingCustomerRecordView/invoicingCustomerRecordViewReducer';
|
|
6
6
|
import { addPromotionalCreditsFailure, addPromotionalCreditsSuccess, submitAddPromotionalCredits } from './promotionalCreditActionReducer';
|
|
7
7
|
export type ActionType = ReturnType<typeof submitAddPromotionalCredits> | ReturnType<typeof addPromotionalCreditsSuccess> | ReturnType<typeof addPromotionalCreditsFailure> | ReturnType<typeof fetchInvoicingCustomerDetail>;
|
|
8
8
|
export declare const addPromotionalCreditsEpic: (actions$: ActionsObservable<ActionType>, _state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
|
|
@@ -4,7 +4,7 @@ exports.addPromotionalCreditsEpic = void 0;
|
|
|
4
4
|
const rxjs_1 = require("rxjs");
|
|
5
5
|
const operators_1 = require("rxjs/operators");
|
|
6
6
|
const responsePayload_1 = require("../../../responsePayload");
|
|
7
|
-
const
|
|
7
|
+
const invoicingCustomerRecordViewReducer_1 = require("../invoicingCustomerRecordView/invoicingCustomerRecordViewReducer");
|
|
8
8
|
const promotionalCreditActionReducer_1 = require("./promotionalCreditActionReducer");
|
|
9
9
|
const addPromotionalCreditsEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(promotionalCreditActionReducer_1.submitAddPromotionalCredits.match), (0, operators_1.mergeMap)((action) => {
|
|
10
10
|
const { amount, currencyCode, customerId, description } = action.payload;
|
|
@@ -19,7 +19,7 @@ const addPromotionalCreditsEpic = (actions$, _state$, zeniAPI) => actions$.pipe(
|
|
|
19
19
|
if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
|
|
20
20
|
return [
|
|
21
21
|
(0, promotionalCreditActionReducer_1.addPromotionalCreditsSuccess)(),
|
|
22
|
-
(0,
|
|
22
|
+
(0, invoicingCustomerRecordViewReducer_1.fetchInvoicingCustomerDetail)({ id: customerId }),
|
|
23
23
|
];
|
|
24
24
|
}
|
|
25
25
|
return (0, rxjs_1.of)((0, promotionalCreditActionReducer_1.addPromotionalCreditsFailure)(response.status));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zeniai/client-epic-state",
|
|
3
|
-
"version": "5.2.
|
|
3
|
+
"version": "5.2.32-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",
|
|
@@ -33,6 +33,44 @@
|
|
|
33
33
|
"require": "./lib/view/*.js"
|
|
34
34
|
}
|
|
35
35
|
},
|
|
36
|
+
"scripts": {
|
|
37
|
+
"clean": "rimraf lib",
|
|
38
|
+
"test:typecheck": "echo 'Typechecking test files...' && NODE_OPTIONS=--max-old-space-size=4096 time tsc -p tsconfig.typecheck.json",
|
|
39
|
+
"test:typecheck-modified-files": "chmod +x ./scripts/tsc-modified-files.sh && SINCE_DAYS=30 ./scripts/tsc-modified-files.sh master tsconfig.typecheck.json",
|
|
40
|
+
"test:typecheck-mocks": "echo 'Typechecking mock files...' && NODE_OPTIONS=--max-old-space-size=4096 time tsc -p tsconfig.mocks.json",
|
|
41
|
+
"test:typecheck-mocks-modified-files": "chmod +x ./scripts/tsc-modified-files.sh && SINCE_DAYS=30 ./scripts/tsc-modified-files.sh master tsconfig.mocks.json",
|
|
42
|
+
"test": "pnpm lint-modified-files && pnpm test:typecheck-modified-files && pnpm test:typecheck-mocks-modified-files && vitest run --typecheck",
|
|
43
|
+
"test:full": "pnpm test:typecheck-modified-files && pnpm test:typecheck-mocks-modified-files && vitest run --typecheck",
|
|
44
|
+
"lint": "eslint . --ext .js,.jsx,.ts,.tsx --max-warnings 0 --fix",
|
|
45
|
+
"lint-modified-files": "chmod +x ./scripts/lint-modified-files.sh && ./scripts/lint-modified-files.sh",
|
|
46
|
+
"lint:fix-modified-files": "chmod +x ./scripts/lint-modified-files.sh && LINT_FIX=true ./scripts/lint-modified-files.sh",
|
|
47
|
+
"tsc-modified-files": "chmod +x ./scripts/tsc-modified-files.sh && ./scripts/tsc-modified-files.sh",
|
|
48
|
+
"typecheck": "tsc --noEmit",
|
|
49
|
+
"circular-dependency": "madge --circular --extensions ts ./src",
|
|
50
|
+
"circular-dependency-modified-files": "chmod +x ./scripts/circular-dependency-modified-files.sh && ./scripts/circular-dependency-modified-files.sh",
|
|
51
|
+
"build": "chmod +x ./scripts/run_build.sh && ./scripts/run_build.sh && rimraf \"lib/**/__mocks__\" \"lib/**/__testHelpers__\"",
|
|
52
|
+
"only-build": "eslint . --ext .js,.jsx,.ts,.tsx && time tsc && tsc -p tsconfig.esm.json && rimraf \"lib/**/__mocks__\" \"lib/**/__testHelpers__\"",
|
|
53
|
+
"only-build-dev": "eslint . --ext .js,.jsx,.ts,.tsx && time tsc -p tsconfig.dev.json && tsc -p tsconfig.esm.dev.json && rimraf \"lib/**/__mocks__\" \"lib/**/__testHelpers__\"",
|
|
54
|
+
"format": "prettier --write --ignore-unknown \"src/**/*\" && pnpm lint",
|
|
55
|
+
"format-watch": "bash ./scripts/run-format-watch.sh",
|
|
56
|
+
"check-version": "node ./scripts/check_version.js",
|
|
57
|
+
"prepublishOnly": "chmod +x ./scripts/branch_validation.sh && ./scripts/branch_validation.sh && pnpm update-slack-group-topic && pnpm run check-version && pnpm clean && pnpm build",
|
|
58
|
+
"version": "git add -A src",
|
|
59
|
+
"postversion": "git push && git push --tags",
|
|
60
|
+
"check-dependencies": "node ./scripts/check_dependencies.js",
|
|
61
|
+
"clean-overrides": "node ./scripts/clean_overrides.js",
|
|
62
|
+
"create-or-update-release-branch": "chmod +x ./scripts/create_or_update_release_branch.sh && ./scripts/create_or_update_release_branch.sh",
|
|
63
|
+
"bump-versions-master": "chmod +x ./scripts/bump_versions_master.sh && ./scripts/bump_versions_master.sh",
|
|
64
|
+
"bump-versions-beta": "chmod +x ./scripts/bump_versions_beta.sh && ./scripts/bump_versions_beta.sh",
|
|
65
|
+
"bump-update-web-app-cockpit-beta": "chmod +x ./scripts/bump_and_update_web_app_ui_beta.sh && ./scripts/bump_and_update_web_app_ui_beta.sh",
|
|
66
|
+
"send-release-notes": "chmod +x ./scripts/send_release_notes.sh && ./scripts/send_release_notes.sh",
|
|
67
|
+
"update-slack-group-topic": "chmod +x ./scripts/update-slack-group-topic.sh && ./scripts/update-slack-group-topic.sh",
|
|
68
|
+
"build-beta-and-copy": "chmod +x ./scripts/build_and_copy.sh && ./scripts/build_and_copy.sh",
|
|
69
|
+
"pr-approvals-update": "chmod +x ./scripts/pr_approvals.sh && ./scripts/pr_approvals.sh",
|
|
70
|
+
"raise-pr-automation": "chmod +x ./scripts/raise_pr_automation.sh && ./scripts/raise_pr_automation.sh",
|
|
71
|
+
"test:file": "bash ./scripts/test-file.sh",
|
|
72
|
+
"find-unused-code": "knip"
|
|
73
|
+
},
|
|
36
74
|
"files": [
|
|
37
75
|
"lib/**/*"
|
|
38
76
|
],
|
|
@@ -100,41 +138,36 @@
|
|
|
100
138
|
"dayjs": "^1.10.7",
|
|
101
139
|
"url-parse": "^1.5.10"
|
|
102
140
|
},
|
|
103
|
-
"
|
|
104
|
-
"
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
"build-beta-and-copy": "chmod +x ./scripts/build_and_copy.sh && ./scripts/build_and_copy.sh",
|
|
135
|
-
"pr-approvals-update": "chmod +x ./scripts/pr_approvals.sh && ./scripts/pr_approvals.sh",
|
|
136
|
-
"raise-pr-automation": "chmod +x ./scripts/raise_pr_automation.sh && ./scripts/raise_pr_automation.sh",
|
|
137
|
-
"test:file": "bash ./scripts/test-file.sh",
|
|
138
|
-
"find-unused-code": "knip"
|
|
141
|
+
"pnpm": {
|
|
142
|
+
"overrides": {
|
|
143
|
+
"@babel/core": ">=7.29.6",
|
|
144
|
+
"@babel/helpers": ">=7.26.10",
|
|
145
|
+
"@babel/runtime": ">=7.26.10",
|
|
146
|
+
"@babel/traverse": ">=7.23.2",
|
|
147
|
+
"@eslint/eslintrc>ajv": ">=6.14.0 <7",
|
|
148
|
+
"@eslint/plugin-kit": ">=0.3.4",
|
|
149
|
+
"@modelcontextprotocol/sdk": ">=1.25.2",
|
|
150
|
+
"ajv": ">=8.18.0",
|
|
151
|
+
"body-parser": ">=2.2.1",
|
|
152
|
+
"brace-expansion": ">=5.0.9",
|
|
153
|
+
"cross-spawn": ">=7.0.5",
|
|
154
|
+
"esbuild": ">=0.28.1",
|
|
155
|
+
"eslint>ajv": ">=6.14.0 <7",
|
|
156
|
+
"flatted": ">=3.4.2",
|
|
157
|
+
"glob": ">=11.1.0",
|
|
158
|
+
"hono": ">=4.11.4",
|
|
159
|
+
"immutable": ">=4.3.9 <5",
|
|
160
|
+
"js-yaml": ">=4.3.1 <5",
|
|
161
|
+
"minimatch": ">=10.2.3",
|
|
162
|
+
"nanoid": ">=3.3.17 <4",
|
|
163
|
+
"picomatch": ">=4.0.4",
|
|
164
|
+
"postcss": ">=8.5.18",
|
|
165
|
+
"qs": "^6.14.1",
|
|
166
|
+
"rollup": ">=4.59.0",
|
|
167
|
+
"shell-quote": ">=1.9.0",
|
|
168
|
+
"tough-cookie": "=4.1.3",
|
|
169
|
+
"vite": ">=7.3.5 <8",
|
|
170
|
+
"yaml": ">=2.9.0"
|
|
171
|
+
}
|
|
139
172
|
}
|
|
140
|
-
}
|
|
173
|
+
}
|
package/lib/esm/view/invoicing/editInvoicingCatalogItemDetailView/catalogDetailEditPayload.js
DELETED
|
@@ -1,191 +0,0 @@
|
|
|
1
|
-
import { buildAccountingDetail, } from './editInvoicingCatalogItemDetailViewPayload';
|
|
2
|
-
import { invoicingProductToCatalogItemFormSubFamily, isTieredCatalogPricingModel, } from './invoicingCatalogItemFormConfig';
|
|
3
|
-
const trimOrUndefined = (value) => value.trim() !== '' ? value.trim() : undefined;
|
|
4
|
-
const trimOrNull = (value) => value.trim() !== '' ? value.trim() : null;
|
|
5
|
-
const hasValue = (value) => String(value ?? '').trim() !== '';
|
|
6
|
-
const toProductCode = (value) => value
|
|
7
|
-
.trim()
|
|
8
|
-
.toLowerCase()
|
|
9
|
-
.replace(/[^a-z0-9]+/g, '-')
|
|
10
|
-
.replace(/^-|-$/g, '');
|
|
11
|
-
const subFamilyToEditValues = (subFamily) => invoicingProductToCatalogItemFormSubFamily(subFamily);
|
|
12
|
-
/** Build default inline-edit form values from a loaded catalog item. */
|
|
13
|
-
export const planToCatalogDetailEditValues = (plan) => ({
|
|
14
|
-
applicableItems: plan.applicableItems ?? [],
|
|
15
|
-
description: plan.description ?? '',
|
|
16
|
-
enabledForCheckout: plan.enabledForCheckout ?? true,
|
|
17
|
-
enabledInPortal: plan.enabledInPortal ?? true,
|
|
18
|
-
giftClaimRedirectUrl: plan.giftClaimRedirectUrl ?? '',
|
|
19
|
-
includedInMrr: plan.includedInMrr ?? true,
|
|
20
|
-
isGiftable: plan.isGiftable ?? false,
|
|
21
|
-
isShippable: plan.isShippable ?? false,
|
|
22
|
-
itemApplicability: plan.itemApplicability ?? 'all',
|
|
23
|
-
metered: plan.metered ?? false,
|
|
24
|
-
name: plan.name ?? '',
|
|
25
|
-
productCode: plan.productCode ?? '',
|
|
26
|
-
subFamilies: (plan.subFamilies ?? []).map(subFamilyToEditValues),
|
|
27
|
-
unit: plan.unit ?? '',
|
|
28
|
-
usageCalculation: plan.usageCalculation ?? 'sum_of_usages',
|
|
29
|
-
});
|
|
30
|
-
const tierToPayload = (tier) => ({
|
|
31
|
-
ending_unit: hasValue(tier.endingUnit) ? Number(tier.endingUnit) : undefined,
|
|
32
|
-
package_size: hasValue(tier.packageSize)
|
|
33
|
-
? Number(tier.packageSize)
|
|
34
|
-
: undefined,
|
|
35
|
-
price: tier.price?.amount ?? 0,
|
|
36
|
-
pricing_type: tier.pricingType,
|
|
37
|
-
starting_unit: Number(tier.startingUnit) || 1,
|
|
38
|
-
});
|
|
39
|
-
const subFamilyToProductUpdate = (subFamily, itemType, lookup) => {
|
|
40
|
-
const tiered = isTieredCatalogPricingModel(subFamily.pricingModel);
|
|
41
|
-
const data = {
|
|
42
|
-
billing_cycles: hasValue(subFamily.billingCycles)
|
|
43
|
-
? Number(subFamily.billingCycles)
|
|
44
|
-
: null,
|
|
45
|
-
free_quantity: Number(subFamily.freeQuantity) || 0,
|
|
46
|
-
is_taxable: subFamily.isTaxable,
|
|
47
|
-
period: hasValue(subFamily.period) ? Number(subFamily.period) : null,
|
|
48
|
-
period_unit: hasValue(subFamily.period) ? subFamily.periodUnit : null,
|
|
49
|
-
price: tiered ? 0 : (subFamily.priceDollars?.amount ?? 0),
|
|
50
|
-
pricing_model: subFamily.pricingModel,
|
|
51
|
-
show_description_in_quotes: subFamily.showDescriptionInQuotes,
|
|
52
|
-
tiers: tiered ? subFamily.tiers.map(tierToPayload) : [],
|
|
53
|
-
trial_end_action: hasValue(subFamily.trialPeriod)
|
|
54
|
-
? subFamily.trialEndAction
|
|
55
|
-
: null,
|
|
56
|
-
trial_period: hasValue(subFamily.trialPeriod)
|
|
57
|
-
? Number(subFamily.trialPeriod)
|
|
58
|
-
: null,
|
|
59
|
-
trial_period_unit: hasValue(subFamily.trialPeriod)
|
|
60
|
-
? subFamily.trialPeriodUnit
|
|
61
|
-
: null,
|
|
62
|
-
};
|
|
63
|
-
if (itemType === 'addon') {
|
|
64
|
-
data.proration_type = subFamily.prorationType;
|
|
65
|
-
}
|
|
66
|
-
// `null` rather than omitted when empty: an absent key on an update reads as
|
|
67
|
-
// "leave it alone", so a cleared account or class could never be saved.
|
|
68
|
-
data.accounting_detail = buildAccountingDetail(subFamily, lookup) ?? null;
|
|
69
|
-
return { data, id: subFamily.id };
|
|
70
|
-
};
|
|
71
|
-
export const catalogDetailEditValuesToSavePayload = (values, lookup, itemType = 'plan', originalSubFamilies) => {
|
|
72
|
-
const planData = {
|
|
73
|
-
applicable_items: values.itemApplicability === 'restricted' ? values.applicableItems : [],
|
|
74
|
-
enabled_for_checkout: values.enabledForCheckout,
|
|
75
|
-
enabled_in_portal: values.enabledInPortal,
|
|
76
|
-
gift_claim_redirect_url: trimOrNull(values.giftClaimRedirectUrl),
|
|
77
|
-
included_in_mrr: values.includedInMrr,
|
|
78
|
-
is_giftable: values.isGiftable,
|
|
79
|
-
is_shippable: values.isShippable,
|
|
80
|
-
item_applicability: values.itemApplicability,
|
|
81
|
-
metered: values.metered,
|
|
82
|
-
name: trimOrUndefined(values.name),
|
|
83
|
-
product_code: trimOrUndefined(values.productCode) ?? toProductCode(values.name),
|
|
84
|
-
sub_family_details: values.subFamilies.map((subFamily) => ({
|
|
85
|
-
description: trimOrNull(subFamily.description),
|
|
86
|
-
id: subFamily.id,
|
|
87
|
-
invoice_notes: trimOrNull(subFamily.invoiceNotes),
|
|
88
|
-
name: subFamily.name.trim(),
|
|
89
|
-
price_code: trimOrUndefined(subFamily.priceCode) ?? toProductCode(subFamily.name),
|
|
90
|
-
show_description_in_invoices: subFamily.showDescriptionInInvoices,
|
|
91
|
-
})),
|
|
92
|
-
usage_calculation: values.metered ? values.usageCalculation : null,
|
|
93
|
-
};
|
|
94
|
-
const description = trimOrUndefined(values.description);
|
|
95
|
-
if (description != null) {
|
|
96
|
-
planData.description = description;
|
|
97
|
-
}
|
|
98
|
-
const unit = trimOrUndefined(values.unit);
|
|
99
|
-
if (unit != null) {
|
|
100
|
-
planData.unit = unit;
|
|
101
|
-
}
|
|
102
|
-
const productUpdates = values.subFamilies.flatMap((subFamily) => {
|
|
103
|
-
const update = subFamilyToProductUpdate(subFamily, itemType, lookup);
|
|
104
|
-
const original = originalSubFamilies?.find((product) => product.id === subFamily.id);
|
|
105
|
-
if (original == null) {
|
|
106
|
-
return [update];
|
|
107
|
-
}
|
|
108
|
-
const originalUpdate = subFamilyToProductUpdate(subFamilyToEditValues(original), itemType, lookup);
|
|
109
|
-
const changedData = Object.fromEntries(Object.entries(update.data).filter(([key, value]) => JSON.stringify(value) !== JSON.stringify(originalUpdate.data[key])));
|
|
110
|
-
return Object.keys(changedData).length > 0
|
|
111
|
-
? [{ data: changedData, id: update.id }]
|
|
112
|
-
: [];
|
|
113
|
-
});
|
|
114
|
-
return {
|
|
115
|
-
planData,
|
|
116
|
-
productUpdates,
|
|
117
|
-
};
|
|
118
|
-
};
|
|
119
|
-
/** Build POST /catalog/products body for Create sub-family. */
|
|
120
|
-
export const createSubFamilyFormToPayload = (itemId, itemType, values, lookup) => {
|
|
121
|
-
const name = values.name.trim();
|
|
122
|
-
const priceCode = trimOrUndefined(values.priceCode) ?? toProductCode(name);
|
|
123
|
-
const tiered = isTieredCatalogPricingModel(values.pricingModel);
|
|
124
|
-
const payload = {
|
|
125
|
-
currency_code: 'USD',
|
|
126
|
-
free_quantity: Number(values.freeQuantity) || 0,
|
|
127
|
-
is_taxable: values.isTaxable,
|
|
128
|
-
item_id: itemId,
|
|
129
|
-
name,
|
|
130
|
-
price: tiered ? 0 : (values.priceDollars?.amount ?? 0),
|
|
131
|
-
price_code: priceCode,
|
|
132
|
-
pricing_model: values.pricingModel || 'flat_fee',
|
|
133
|
-
show_description_in_invoices: values.showDescriptionInInvoices,
|
|
134
|
-
show_description_in_quotes: values.showDescriptionInQuotes,
|
|
135
|
-
};
|
|
136
|
-
// The same accounting body the item payload sends, so a price point created
|
|
137
|
-
// from the dialog carries the account and class the form would have given it.
|
|
138
|
-
const accountingDetail = buildAccountingDetail(values, lookup);
|
|
139
|
-
if (accountingDetail != null) {
|
|
140
|
-
payload.accounting_detail = accountingDetail;
|
|
141
|
-
}
|
|
142
|
-
if (tiered) {
|
|
143
|
-
payload.tiers = (values.tiers ?? []).map(tierToPayload);
|
|
144
|
-
}
|
|
145
|
-
const description = trimOrUndefined(values.description);
|
|
146
|
-
if (description != null) {
|
|
147
|
-
payload.description = description;
|
|
148
|
-
}
|
|
149
|
-
const invoiceNotes = trimOrUndefined(values.invoiceNotes);
|
|
150
|
-
if (invoiceNotes != null) {
|
|
151
|
-
payload.invoice_notes = invoiceNotes;
|
|
152
|
-
}
|
|
153
|
-
if (itemType === 'plan' || itemType === 'addon') {
|
|
154
|
-
payload.period = Number(values.period) || 1;
|
|
155
|
-
payload.period_unit = values.periodUnit || 'month';
|
|
156
|
-
}
|
|
157
|
-
if (values.trialPeriod.trim() !== '') {
|
|
158
|
-
payload.trial_period = Number(values.trialPeriod);
|
|
159
|
-
payload.trial_period_unit = values.trialPeriodUnit || 'day';
|
|
160
|
-
payload.trial_end_action = values.trialEndAction || 'site_default';
|
|
161
|
-
}
|
|
162
|
-
if (values.billingCycles.trim() !== '') {
|
|
163
|
-
payload.billing_cycles = Number(values.billingCycles);
|
|
164
|
-
}
|
|
165
|
-
if (itemType === 'addon' && values.prorationType) {
|
|
166
|
-
payload.proration_type = values.prorationType;
|
|
167
|
-
}
|
|
168
|
-
return payload;
|
|
169
|
-
};
|
|
170
|
-
export const productToCreateSubFamilyFormValues = (product) => ({
|
|
171
|
-
accountingCategory: product?.accountingDetail?.accountingCategory1 ?? '',
|
|
172
|
-
accountingCode: product?.accountingDetail?.accountingCode ?? '',
|
|
173
|
-
billingCycles: product?.billingCycles != null ? String(product.billingCycles) : '',
|
|
174
|
-
description: product?.description ?? '',
|
|
175
|
-
freeQuantity: product?.freeQuantity != null ? String(product.freeQuantity) : '0',
|
|
176
|
-
invoiceNotes: product?.invoiceNotes ?? '',
|
|
177
|
-
isTaxable: product?.isTaxable ?? true,
|
|
178
|
-
name: product?.name != null ? `${product.name} (copy)` : '',
|
|
179
|
-
period: product?.period != null ? String(product.period) : '1',
|
|
180
|
-
periodUnit: product?.periodUnit ?? 'month',
|
|
181
|
-
priceCode: '',
|
|
182
|
-
priceDollars: product?.price,
|
|
183
|
-
pricingModel: product?.pricingModel ?? 'flat_fee',
|
|
184
|
-
prorationType: product?.prorationType ?? 'site_default',
|
|
185
|
-
showDescriptionInInvoices: product?.showDescriptionInInvoices ?? true,
|
|
186
|
-
showDescriptionInQuotes: product?.showDescriptionInQuotes ?? false,
|
|
187
|
-
sku: product?.accountingDetail?.sku ?? '',
|
|
188
|
-
trialEndAction: product?.trialEndAction ?? 'site_default',
|
|
189
|
-
trialPeriod: product?.trialPeriod != null ? String(product.trialPeriod) : '',
|
|
190
|
-
trialPeriodUnit: product?.trialPeriodUnit ?? 'day',
|
|
191
|
-
});
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import { Amount } from '../../../commonStateTypes/amount';
|
|
2
|
-
import type { InvoicingPlan } from '../../../entity/invoicing/plan/planState';
|
|
3
|
-
import type { InvoicingProduct } from '../../../entity/invoicing/product/productState';
|
|
4
|
-
import { type InvoicingCatalogAccountingLookup } from './editInvoicingCatalogItemDetailViewPayload';
|
|
5
|
-
import type { CatalogDetailEditValues, InvoicingCatalogItemFormTier } from './editInvoicingCatalogItemDetailViewState';
|
|
6
|
-
export type { CatalogDetailEditValues } from './editInvoicingCatalogItemDetailViewState';
|
|
7
|
-
export interface CatalogDetailProductUpdate {
|
|
8
|
-
data: Record<string, unknown>;
|
|
9
|
-
id: string;
|
|
10
|
-
}
|
|
11
|
-
export interface CatalogDetailSavePayload {
|
|
12
|
-
planData: Record<string, unknown>;
|
|
13
|
-
productUpdates: CatalogDetailProductUpdate[];
|
|
14
|
-
}
|
|
15
|
-
/** Build default inline-edit form values from a loaded catalog item. */
|
|
16
|
-
export declare const planToCatalogDetailEditValues: (plan: InvoicingPlan) => CatalogDetailEditValues;
|
|
17
|
-
export declare const catalogDetailEditValuesToSavePayload: (values: CatalogDetailEditValues, lookup: InvoicingCatalogAccountingLookup, itemType?: string, originalSubFamilies?: readonly InvoicingProduct[]) => CatalogDetailSavePayload;
|
|
18
|
-
export interface CreateSubFamilyFormValues {
|
|
19
|
-
/** The QuickBooks class id the price point posts to. */
|
|
20
|
-
accountingCategory: string;
|
|
21
|
-
/** The QuickBooks income account id the price point posts to. */
|
|
22
|
-
accountingCode: string;
|
|
23
|
-
billingCycles: string;
|
|
24
|
-
description: string;
|
|
25
|
-
freeQuantity: string;
|
|
26
|
-
invoiceNotes: string;
|
|
27
|
-
isTaxable: boolean;
|
|
28
|
-
name: string;
|
|
29
|
-
period: string;
|
|
30
|
-
periodUnit: string;
|
|
31
|
-
priceCode: string;
|
|
32
|
-
pricingModel: string;
|
|
33
|
-
prorationType: string;
|
|
34
|
-
showDescriptionInInvoices: boolean;
|
|
35
|
-
showDescriptionInQuotes: boolean;
|
|
36
|
-
sku: string;
|
|
37
|
-
trialEndAction: string;
|
|
38
|
-
trialPeriod: string;
|
|
39
|
-
trialPeriodUnit: string;
|
|
40
|
-
priceDollars?: Amount;
|
|
41
|
-
/** Only sent for the tiered pricing models, which price per tier. */
|
|
42
|
-
tiers?: InvoicingCatalogItemFormTier[];
|
|
43
|
-
}
|
|
44
|
-
/** Build POST /catalog/products body for Create sub-family. */
|
|
45
|
-
export declare const createSubFamilyFormToPayload: (itemId: string, itemType: string, values: CreateSubFamilyFormValues, lookup: InvoicingCatalogAccountingLookup) => Record<string, unknown>;
|
|
46
|
-
export declare const productToCreateSubFamilyFormValues: (product?: InvoicingProduct) => CreateSubFamilyFormValues;
|
|
@@ -1,198 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.productToCreateSubFamilyFormValues = exports.createSubFamilyFormToPayload = exports.catalogDetailEditValuesToSavePayload = exports.planToCatalogDetailEditValues = void 0;
|
|
4
|
-
const editInvoicingCatalogItemDetailViewPayload_1 = require("./editInvoicingCatalogItemDetailViewPayload");
|
|
5
|
-
const invoicingCatalogItemFormConfig_1 = require("./invoicingCatalogItemFormConfig");
|
|
6
|
-
const trimOrUndefined = (value) => value.trim() !== '' ? value.trim() : undefined;
|
|
7
|
-
const trimOrNull = (value) => value.trim() !== '' ? value.trim() : null;
|
|
8
|
-
const hasValue = (value) => String(value ?? '').trim() !== '';
|
|
9
|
-
const toProductCode = (value) => value
|
|
10
|
-
.trim()
|
|
11
|
-
.toLowerCase()
|
|
12
|
-
.replace(/[^a-z0-9]+/g, '-')
|
|
13
|
-
.replace(/^-|-$/g, '');
|
|
14
|
-
const subFamilyToEditValues = (subFamily) => (0, invoicingCatalogItemFormConfig_1.invoicingProductToCatalogItemFormSubFamily)(subFamily);
|
|
15
|
-
/** Build default inline-edit form values from a loaded catalog item. */
|
|
16
|
-
const planToCatalogDetailEditValues = (plan) => ({
|
|
17
|
-
applicableItems: plan.applicableItems ?? [],
|
|
18
|
-
description: plan.description ?? '',
|
|
19
|
-
enabledForCheckout: plan.enabledForCheckout ?? true,
|
|
20
|
-
enabledInPortal: plan.enabledInPortal ?? true,
|
|
21
|
-
giftClaimRedirectUrl: plan.giftClaimRedirectUrl ?? '',
|
|
22
|
-
includedInMrr: plan.includedInMrr ?? true,
|
|
23
|
-
isGiftable: plan.isGiftable ?? false,
|
|
24
|
-
isShippable: plan.isShippable ?? false,
|
|
25
|
-
itemApplicability: plan.itemApplicability ?? 'all',
|
|
26
|
-
metered: plan.metered ?? false,
|
|
27
|
-
name: plan.name ?? '',
|
|
28
|
-
productCode: plan.productCode ?? '',
|
|
29
|
-
subFamilies: (plan.subFamilies ?? []).map(subFamilyToEditValues),
|
|
30
|
-
unit: plan.unit ?? '',
|
|
31
|
-
usageCalculation: plan.usageCalculation ?? 'sum_of_usages',
|
|
32
|
-
});
|
|
33
|
-
exports.planToCatalogDetailEditValues = planToCatalogDetailEditValues;
|
|
34
|
-
const tierToPayload = (tier) => ({
|
|
35
|
-
ending_unit: hasValue(tier.endingUnit) ? Number(tier.endingUnit) : undefined,
|
|
36
|
-
package_size: hasValue(tier.packageSize)
|
|
37
|
-
? Number(tier.packageSize)
|
|
38
|
-
: undefined,
|
|
39
|
-
price: tier.price?.amount ?? 0,
|
|
40
|
-
pricing_type: tier.pricingType,
|
|
41
|
-
starting_unit: Number(tier.startingUnit) || 1,
|
|
42
|
-
});
|
|
43
|
-
const subFamilyToProductUpdate = (subFamily, itemType, lookup) => {
|
|
44
|
-
const tiered = (0, invoicingCatalogItemFormConfig_1.isTieredCatalogPricingModel)(subFamily.pricingModel);
|
|
45
|
-
const data = {
|
|
46
|
-
billing_cycles: hasValue(subFamily.billingCycles)
|
|
47
|
-
? Number(subFamily.billingCycles)
|
|
48
|
-
: null,
|
|
49
|
-
free_quantity: Number(subFamily.freeQuantity) || 0,
|
|
50
|
-
is_taxable: subFamily.isTaxable,
|
|
51
|
-
period: hasValue(subFamily.period) ? Number(subFamily.period) : null,
|
|
52
|
-
period_unit: hasValue(subFamily.period) ? subFamily.periodUnit : null,
|
|
53
|
-
price: tiered ? 0 : (subFamily.priceDollars?.amount ?? 0),
|
|
54
|
-
pricing_model: subFamily.pricingModel,
|
|
55
|
-
show_description_in_quotes: subFamily.showDescriptionInQuotes,
|
|
56
|
-
tiers: tiered ? subFamily.tiers.map(tierToPayload) : [],
|
|
57
|
-
trial_end_action: hasValue(subFamily.trialPeriod)
|
|
58
|
-
? subFamily.trialEndAction
|
|
59
|
-
: null,
|
|
60
|
-
trial_period: hasValue(subFamily.trialPeriod)
|
|
61
|
-
? Number(subFamily.trialPeriod)
|
|
62
|
-
: null,
|
|
63
|
-
trial_period_unit: hasValue(subFamily.trialPeriod)
|
|
64
|
-
? subFamily.trialPeriodUnit
|
|
65
|
-
: null,
|
|
66
|
-
};
|
|
67
|
-
if (itemType === 'addon') {
|
|
68
|
-
data.proration_type = subFamily.prorationType;
|
|
69
|
-
}
|
|
70
|
-
// `null` rather than omitted when empty: an absent key on an update reads as
|
|
71
|
-
// "leave it alone", so a cleared account or class could never be saved.
|
|
72
|
-
data.accounting_detail = (0, editInvoicingCatalogItemDetailViewPayload_1.buildAccountingDetail)(subFamily, lookup) ?? null;
|
|
73
|
-
return { data, id: subFamily.id };
|
|
74
|
-
};
|
|
75
|
-
const catalogDetailEditValuesToSavePayload = (values, lookup, itemType = 'plan', originalSubFamilies) => {
|
|
76
|
-
const planData = {
|
|
77
|
-
applicable_items: values.itemApplicability === 'restricted' ? values.applicableItems : [],
|
|
78
|
-
enabled_for_checkout: values.enabledForCheckout,
|
|
79
|
-
enabled_in_portal: values.enabledInPortal,
|
|
80
|
-
gift_claim_redirect_url: trimOrNull(values.giftClaimRedirectUrl),
|
|
81
|
-
included_in_mrr: values.includedInMrr,
|
|
82
|
-
is_giftable: values.isGiftable,
|
|
83
|
-
is_shippable: values.isShippable,
|
|
84
|
-
item_applicability: values.itemApplicability,
|
|
85
|
-
metered: values.metered,
|
|
86
|
-
name: trimOrUndefined(values.name),
|
|
87
|
-
product_code: trimOrUndefined(values.productCode) ?? toProductCode(values.name),
|
|
88
|
-
sub_family_details: values.subFamilies.map((subFamily) => ({
|
|
89
|
-
description: trimOrNull(subFamily.description),
|
|
90
|
-
id: subFamily.id,
|
|
91
|
-
invoice_notes: trimOrNull(subFamily.invoiceNotes),
|
|
92
|
-
name: subFamily.name.trim(),
|
|
93
|
-
price_code: trimOrUndefined(subFamily.priceCode) ?? toProductCode(subFamily.name),
|
|
94
|
-
show_description_in_invoices: subFamily.showDescriptionInInvoices,
|
|
95
|
-
})),
|
|
96
|
-
usage_calculation: values.metered ? values.usageCalculation : null,
|
|
97
|
-
};
|
|
98
|
-
const description = trimOrUndefined(values.description);
|
|
99
|
-
if (description != null) {
|
|
100
|
-
planData.description = description;
|
|
101
|
-
}
|
|
102
|
-
const unit = trimOrUndefined(values.unit);
|
|
103
|
-
if (unit != null) {
|
|
104
|
-
planData.unit = unit;
|
|
105
|
-
}
|
|
106
|
-
const productUpdates = values.subFamilies.flatMap((subFamily) => {
|
|
107
|
-
const update = subFamilyToProductUpdate(subFamily, itemType, lookup);
|
|
108
|
-
const original = originalSubFamilies?.find((product) => product.id === subFamily.id);
|
|
109
|
-
if (original == null) {
|
|
110
|
-
return [update];
|
|
111
|
-
}
|
|
112
|
-
const originalUpdate = subFamilyToProductUpdate(subFamilyToEditValues(original), itemType, lookup);
|
|
113
|
-
const changedData = Object.fromEntries(Object.entries(update.data).filter(([key, value]) => JSON.stringify(value) !== JSON.stringify(originalUpdate.data[key])));
|
|
114
|
-
return Object.keys(changedData).length > 0
|
|
115
|
-
? [{ data: changedData, id: update.id }]
|
|
116
|
-
: [];
|
|
117
|
-
});
|
|
118
|
-
return {
|
|
119
|
-
planData,
|
|
120
|
-
productUpdates,
|
|
121
|
-
};
|
|
122
|
-
};
|
|
123
|
-
exports.catalogDetailEditValuesToSavePayload = catalogDetailEditValuesToSavePayload;
|
|
124
|
-
/** Build POST /catalog/products body for Create sub-family. */
|
|
125
|
-
const createSubFamilyFormToPayload = (itemId, itemType, values, lookup) => {
|
|
126
|
-
const name = values.name.trim();
|
|
127
|
-
const priceCode = trimOrUndefined(values.priceCode) ?? toProductCode(name);
|
|
128
|
-
const tiered = (0, invoicingCatalogItemFormConfig_1.isTieredCatalogPricingModel)(values.pricingModel);
|
|
129
|
-
const payload = {
|
|
130
|
-
currency_code: 'USD',
|
|
131
|
-
free_quantity: Number(values.freeQuantity) || 0,
|
|
132
|
-
is_taxable: values.isTaxable,
|
|
133
|
-
item_id: itemId,
|
|
134
|
-
name,
|
|
135
|
-
price: tiered ? 0 : (values.priceDollars?.amount ?? 0),
|
|
136
|
-
price_code: priceCode,
|
|
137
|
-
pricing_model: values.pricingModel || 'flat_fee',
|
|
138
|
-
show_description_in_invoices: values.showDescriptionInInvoices,
|
|
139
|
-
show_description_in_quotes: values.showDescriptionInQuotes,
|
|
140
|
-
};
|
|
141
|
-
// The same accounting body the item payload sends, so a price point created
|
|
142
|
-
// from the dialog carries the account and class the form would have given it.
|
|
143
|
-
const accountingDetail = (0, editInvoicingCatalogItemDetailViewPayload_1.buildAccountingDetail)(values, lookup);
|
|
144
|
-
if (accountingDetail != null) {
|
|
145
|
-
payload.accounting_detail = accountingDetail;
|
|
146
|
-
}
|
|
147
|
-
if (tiered) {
|
|
148
|
-
payload.tiers = (values.tiers ?? []).map(tierToPayload);
|
|
149
|
-
}
|
|
150
|
-
const description = trimOrUndefined(values.description);
|
|
151
|
-
if (description != null) {
|
|
152
|
-
payload.description = description;
|
|
153
|
-
}
|
|
154
|
-
const invoiceNotes = trimOrUndefined(values.invoiceNotes);
|
|
155
|
-
if (invoiceNotes != null) {
|
|
156
|
-
payload.invoice_notes = invoiceNotes;
|
|
157
|
-
}
|
|
158
|
-
if (itemType === 'plan' || itemType === 'addon') {
|
|
159
|
-
payload.period = Number(values.period) || 1;
|
|
160
|
-
payload.period_unit = values.periodUnit || 'month';
|
|
161
|
-
}
|
|
162
|
-
if (values.trialPeriod.trim() !== '') {
|
|
163
|
-
payload.trial_period = Number(values.trialPeriod);
|
|
164
|
-
payload.trial_period_unit = values.trialPeriodUnit || 'day';
|
|
165
|
-
payload.trial_end_action = values.trialEndAction || 'site_default';
|
|
166
|
-
}
|
|
167
|
-
if (values.billingCycles.trim() !== '') {
|
|
168
|
-
payload.billing_cycles = Number(values.billingCycles);
|
|
169
|
-
}
|
|
170
|
-
if (itemType === 'addon' && values.prorationType) {
|
|
171
|
-
payload.proration_type = values.prorationType;
|
|
172
|
-
}
|
|
173
|
-
return payload;
|
|
174
|
-
};
|
|
175
|
-
exports.createSubFamilyFormToPayload = createSubFamilyFormToPayload;
|
|
176
|
-
const productToCreateSubFamilyFormValues = (product) => ({
|
|
177
|
-
accountingCategory: product?.accountingDetail?.accountingCategory1 ?? '',
|
|
178
|
-
accountingCode: product?.accountingDetail?.accountingCode ?? '',
|
|
179
|
-
billingCycles: product?.billingCycles != null ? String(product.billingCycles) : '',
|
|
180
|
-
description: product?.description ?? '',
|
|
181
|
-
freeQuantity: product?.freeQuantity != null ? String(product.freeQuantity) : '0',
|
|
182
|
-
invoiceNotes: product?.invoiceNotes ?? '',
|
|
183
|
-
isTaxable: product?.isTaxable ?? true,
|
|
184
|
-
name: product?.name != null ? `${product.name} (copy)` : '',
|
|
185
|
-
period: product?.period != null ? String(product.period) : '1',
|
|
186
|
-
periodUnit: product?.periodUnit ?? 'month',
|
|
187
|
-
priceCode: '',
|
|
188
|
-
priceDollars: product?.price,
|
|
189
|
-
pricingModel: product?.pricingModel ?? 'flat_fee',
|
|
190
|
-
prorationType: product?.prorationType ?? 'site_default',
|
|
191
|
-
showDescriptionInInvoices: product?.showDescriptionInInvoices ?? true,
|
|
192
|
-
showDescriptionInQuotes: product?.showDescriptionInQuotes ?? false,
|
|
193
|
-
sku: product?.accountingDetail?.sku ?? '',
|
|
194
|
-
trialEndAction: product?.trialEndAction ?? 'site_default',
|
|
195
|
-
trialPeriod: product?.trialPeriod != null ? String(product.trialPeriod) : '',
|
|
196
|
-
trialPeriodUnit: product?.trialPeriodUnit ?? 'day',
|
|
197
|
-
});
|
|
198
|
-
exports.productToCreateSubFamilyFormValues = productToCreateSubFamilyFormValues;
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|