@zeniai/client-epic-state 5.2.73 → 5.2.74
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/aiCfo/aiCfoState.d.ts +2 -2
- package/lib/entity/billPay/billTransaction/billTransactionState.d.ts +2 -2
- package/lib/entity/chargeCardTransaction/chargeCardTransaction.d.ts +1 -1
- package/lib/entity/depositAccountTransaction/depositAccountTransaction.d.ts +1 -1
- package/lib/entity/invoicing/{product/productPayload.d.ts → invoicingCatalog/invoicingCatalogPayload.d.ts} +44 -6
- package/lib/entity/invoicing/{product/productPayload.js → invoicingCatalog/invoicingCatalogPayload.js} +50 -6
- package/lib/entity/invoicing/invoicingCatalog/invoicingCatalogReducer.d.ts +12 -0
- package/lib/entity/invoicing/{plan/planReducer.js → invoicingCatalog/invoicingCatalogReducer.js} +20 -21
- package/lib/entity/invoicing/{plan/planSelector.d.ts → invoicingCatalog/invoicingCatalogSelector.d.ts} +5 -6
- package/lib/entity/invoicing/{plan/planSelector.js → invoicingCatalog/invoicingCatalogSelector.js} +12 -12
- package/lib/entity/invoicing/{product/productState.d.ts → invoicingCatalog/invoicingCatalogState.d.ts} +42 -6
- package/lib/entity/jeSchedules/jeSchedulesTypes.d.ts +4 -4
- package/lib/entity/snackbar/snackbarTypes.d.ts +1 -1
- package/lib/entity/snackbar/snackbarTypes.js +1 -0
- package/lib/epic.d.ts +3 -2
- package/lib/epic.js +3 -1
- package/lib/esm/entity/invoicing/{product/productPayload.js → invoicingCatalog/invoicingCatalogPayload.js} +46 -3
- package/lib/esm/entity/invoicing/{plan/planReducer.js → invoicingCatalog/invoicingCatalogReducer.js} +19 -20
- package/lib/esm/entity/invoicing/{plan/planSelector.js → invoicingCatalog/invoicingCatalogSelector.js} +8 -8
- package/lib/esm/entity/snackbar/snackbarTypes.js +1 -0
- package/lib/esm/epic.js +3 -1
- package/lib/esm/index.js +6 -9
- package/lib/esm/reducer.js +4 -7
- package/lib/esm/view/invoicing/createInvoice/createInvoiceEpic.js +9 -1
- package/lib/esm/view/invoicing/createInvoice/createInvoiceSelector.js +1 -1
- package/lib/esm/view/invoicing/editInvoicingCatalogItemDetailView/editInvoicingCatalogItemDetailViewSelector.js +5 -3
- package/lib/esm/view/invoicing/editInvoicingCatalogItemDetailView/fetchInvoicingCatalogItemDetailEpic.js +2 -2
- package/lib/esm/view/invoicing/editInvoicingCatalogItemDetailView/runInvoicingCatalogPlanActionEpic.js +2 -2
- package/lib/esm/view/invoicing/editInvoicingCatalogItemDetailView/runInvoicingCatalogProductActionEpic.js +4 -4
- package/lib/esm/view/invoicing/editInvoicingCatalogItemDetailView/saveInvoicingCatalogItemEpic.js +3 -7
- package/lib/esm/view/invoicing/editInvoicingCatalogItemDetailView/seedInvoicingCatalogItemFormDraftEpic.js +2 -2
- package/lib/esm/view/invoicing/editInvoicingCustomerDetailView/editInvoicingCustomerDetailViewReducer.js +5 -1
- package/lib/esm/view/invoicing/editInvoicingSubscriptionDetailView/editInvoicingSubscriptionDetailViewSelector.js +27 -1
- package/lib/esm/view/invoicing/editInvoicingSubscriptionDetailView/saveInvoicingSubscriptionEpic.js +5 -1
- package/lib/esm/view/invoicing/invoiceList/invoiceListReducer.js +8 -1
- package/lib/esm/view/invoicing/invoicingCatalogListView/epics/fetchInvoicingCatalogPlanListEpic.js +2 -2
- package/lib/esm/view/invoicing/invoicingCatalogListView/epics/fetchInvoicingCatalogProductListEpic.js +2 -2
- package/lib/esm/view/invoicing/invoicingCatalogListView/invoicingCatalogListViewSelector.js +55 -22
- package/lib/esm/view/invoicing/invoicingCatalogListView/invoicingCatalogListViewState.js +1 -20
- package/lib/esm/view/spendManagement/commonSetup/epic/setup/resetKycKybEpic.js +37 -0
- package/lib/esm/view/spendManagement/commonSetup/setupViewReducer.js +21 -1
- package/lib/esm/view/spendManagement/commonSetup/setupViewSelector.js +2 -1
- package/lib/index.d.ts +9 -13
- package/lib/index.js +39 -45
- package/lib/reducer.d.ts +1 -2
- package/lib/reducer.js +4 -7
- package/lib/rootStateTypes.d.ts +3 -5
- package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.d.ts +1 -1
- package/lib/view/expenseAutomationView/reducers/jeSchedulesViewReducer.d.ts +2 -2
- package/lib/view/invoicing/createInvoice/createInvoiceEpic.d.ts +3 -2
- package/lib/view/invoicing/createInvoice/createInvoiceEpic.js +8 -0
- package/lib/view/invoicing/createInvoice/createInvoiceSelector.d.ts +2 -2
- package/lib/view/invoicing/createInvoice/createInvoiceSelector.js +2 -2
- package/lib/view/invoicing/editInvoicingCatalogItemDetailView/editInvoicingCatalogItemDetailViewPayload.d.ts +8 -9
- package/lib/view/invoicing/editInvoicingCatalogItemDetailView/editInvoicingCatalogItemDetailViewSelector.d.ts +2 -2
- package/lib/view/invoicing/editInvoicingCatalogItemDetailView/editInvoicingCatalogItemDetailViewSelector.js +5 -3
- package/lib/view/invoicing/editInvoicingCatalogItemDetailView/fetchInvoicingCatalogItemDetailEpic.d.ts +2 -2
- package/lib/view/invoicing/editInvoicingCatalogItemDetailView/fetchInvoicingCatalogItemDetailEpic.js +2 -2
- package/lib/view/invoicing/editInvoicingCatalogItemDetailView/invoicingCatalogItemFormHelper.d.ts +3 -4
- package/lib/view/invoicing/editInvoicingCatalogItemDetailView/runInvoicingCatalogPlanActionEpic.d.ts +2 -2
- package/lib/view/invoicing/editInvoicingCatalogItemDetailView/runInvoicingCatalogPlanActionEpic.js +2 -2
- package/lib/view/invoicing/editInvoicingCatalogItemDetailView/runInvoicingCatalogProductActionEpic.d.ts +2 -3
- package/lib/view/invoicing/editInvoicingCatalogItemDetailView/runInvoicingCatalogProductActionEpic.js +4 -4
- package/lib/view/invoicing/editInvoicingCatalogItemDetailView/saveInvoicingCatalogItemEpic.d.ts +2 -3
- package/lib/view/invoicing/editInvoicingCatalogItemDetailView/saveInvoicingCatalogItemEpic.js +3 -7
- package/lib/view/invoicing/editInvoicingCatalogItemDetailView/seedInvoicingCatalogItemFormDraftEpic.js +2 -2
- package/lib/view/invoicing/editInvoicingCustomerDetailView/editInvoicingCustomerDetailViewReducer.d.ts +3 -1
- package/lib/view/invoicing/editInvoicingCustomerDetailView/editInvoicingCustomerDetailViewReducer.js +6 -2
- package/lib/view/invoicing/editInvoicingSubscriptionDetailView/editInvoicingSubscriptionDetailViewSelector.d.ts +3 -2
- package/lib/view/invoicing/editInvoicingSubscriptionDetailView/editInvoicingSubscriptionDetailViewSelector.js +29 -2
- package/lib/view/invoicing/editInvoicingSubscriptionDetailView/saveInvoicingSubscriptionEpic.d.ts +3 -1
- package/lib/view/invoicing/editInvoicingSubscriptionDetailView/saveInvoicingSubscriptionEpic.js +5 -1
- package/lib/view/invoicing/invoiceList/invoiceListReducer.d.ts +3 -1
- package/lib/view/invoicing/invoiceList/invoiceListReducer.js +9 -2
- package/lib/view/invoicing/invoicingCatalogListView/epics/fetchInvoicingCatalogListPageEpic.d.ts +2 -2
- package/lib/view/invoicing/invoicingCatalogListView/epics/fetchInvoicingCatalogPlanListEpic.d.ts +2 -2
- package/lib/view/invoicing/invoicingCatalogListView/epics/fetchInvoicingCatalogPlanListEpic.js +2 -2
- package/lib/view/invoicing/invoicingCatalogListView/epics/fetchInvoicingCatalogProductListEpic.d.ts +2 -2
- package/lib/view/invoicing/invoicingCatalogListView/epics/fetchInvoicingCatalogProductListEpic.js +2 -2
- package/lib/view/invoicing/invoicingCatalogListView/invoicingCatalogListViewPayload.d.ts +3 -3
- package/lib/view/invoicing/invoicingCatalogListView/invoicingCatalogListViewSelector.d.ts +33 -15
- package/lib/view/invoicing/invoicingCatalogListView/invoicingCatalogListViewSelector.js +57 -23
- package/lib/view/invoicing/invoicingCatalogListView/invoicingCatalogListViewState.d.ts +0 -15
- package/lib/view/invoicing/invoicingCatalogListView/invoicingCatalogListViewState.js +0 -22
- package/lib/view/invoicing/invoicingDunningCaseListView/invoicingDunningCaseListViewReducer.d.ts +1 -1
- package/lib/view/invoicing/invoicingDunningCaseListView/invoicingDunningCaseListViewState.d.ts +1 -1
- package/lib/view/invoicing/invoicingSubscriptionListView/invoicingSubscriptionListViewReducer.d.ts +1 -1
- package/lib/view/invoicing/invoicingSubscriptionListView/invoicingSubscriptionListViewState.d.ts +1 -1
- package/lib/view/scheduleView/scheduleListView/scheduleListTypes.d.ts +1 -1
- package/lib/view/spendManagement/billPay/billList/billListReducer.d.ts +5 -5
- package/lib/view/spendManagement/billPay/billList/billListState.d.ts +1 -1
- package/lib/view/spendManagement/billPay/editBillView/editBillViewReducer.d.ts +2 -2
- package/lib/view/spendManagement/commonSetup/epic/setup/resetKycKybEpic.d.ts +8 -0
- package/lib/view/spendManagement/commonSetup/epic/setup/resetKycKybEpic.js +41 -0
- package/lib/view/spendManagement/commonSetup/setupViewReducer.d.ts +1 -1
- package/lib/view/spendManagement/commonSetup/setupViewReducer.js +22 -2
- package/lib/view/spendManagement/commonSetup/setupViewSelector.d.ts +1 -0
- package/lib/view/spendManagement/commonSetup/setupViewSelector.js +2 -1
- package/lib/view/spendManagement/commonSetup/setupViewState.d.ts +1 -0
- package/lib/view/spendManagement/reimbursement/editRemiView/editRemiViewReducer.d.ts +2 -2
- package/lib/view/spendManagement/reimbursement/remiListView/remiListReducer.d.ts +5 -5
- package/lib/view/spendManagement/reimbursement/remiListView/remiListState.d.ts +2 -2
- package/package.json +1 -26
- package/lib/entity/invoicing/plan/planPayload.d.ts +0 -40
- package/lib/entity/invoicing/plan/planPayload.js +0 -51
- package/lib/entity/invoicing/plan/planReducer.d.ts +0 -14
- package/lib/entity/invoicing/plan/planState.d.ts +0 -43
- package/lib/entity/invoicing/product/productReducer.d.ts +0 -9
- package/lib/entity/invoicing/product/productReducer.js +0 -50
- package/lib/entity/invoicing/product/productSelector.d.ts +0 -4
- package/lib/entity/invoicing/product/productSelector.js +0 -17
- package/lib/entity/invoicing/product/productState.js +0 -2
- package/lib/esm/entity/invoicing/plan/planPayload.js +0 -47
- package/lib/esm/entity/invoicing/product/productReducer.js +0 -43
- package/lib/esm/entity/invoicing/product/productSelector.js +0 -10
- package/lib/esm/entity/invoicing/product/productState.js +0 -1
- /package/lib/entity/invoicing/{plan/planState.js → invoicingCatalog/invoicingCatalogState.js} +0 -0
- /package/lib/esm/entity/invoicing/{plan/planState.js → invoicingCatalog/invoicingCatalogState.js} +0 -0
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.74",
|
|
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",
|
|
@@ -53,31 +53,6 @@
|
|
|
53
53
|
"url": "https://github.com/zeni-ai/client-epic-state/issues"
|
|
54
54
|
},
|
|
55
55
|
"homepage": "https://github.com/zeni-ai/client-epic-state#readme",
|
|
56
|
-
"devDependencies": {
|
|
57
|
-
"@eslint/js": "^9.24.0",
|
|
58
|
-
"@liveblocks/client": "^2.23.0",
|
|
59
|
-
"@trivago/prettier-plugin-sort-imports": "^5.2.2",
|
|
60
|
-
"@types/big.js": "^6.2.2",
|
|
61
|
-
"@types/lodash": "^4.17.23",
|
|
62
|
-
"@types/node": "^20.19.0",
|
|
63
|
-
"@types/url-parse": "^1.4.11",
|
|
64
|
-
"@typescript-eslint/eslint-plugin": "^8.56.0",
|
|
65
|
-
"@typescript-eslint/parser": "^8.56.0",
|
|
66
|
-
"concurrently": "^9.1.2",
|
|
67
|
-
"eslint": "^9.24.0",
|
|
68
|
-
"eslint-config-prettier": "^10.0.2",
|
|
69
|
-
"eslint-plugin-perfectionist": "^4.15.0",
|
|
70
|
-
"eslint-plugin-unused-imports": "^4.1.4",
|
|
71
|
-
"globals": "^16.0.0",
|
|
72
|
-
"knip": "^6.21.0",
|
|
73
|
-
"madge": "^8.0.0",
|
|
74
|
-
"prettier": "^3.5.3",
|
|
75
|
-
"rimraf": "^6.0.1",
|
|
76
|
-
"semver": "^7.7.1",
|
|
77
|
-
"typescript": "^5.7.3",
|
|
78
|
-
"vite": "^7.3.5",
|
|
79
|
-
"vitest": "^4.1.11"
|
|
80
|
-
},
|
|
81
56
|
"dependencies": {
|
|
82
57
|
"@redux-devtools/extension": "^3.3.0",
|
|
83
58
|
"@reduxjs/toolkit": "^1.6.2",
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { InvoicingPlanTierPayload, InvoicingProductPayload } from '../product/productPayload';
|
|
2
|
-
import { InvoicingPlan } from './planState';
|
|
3
|
-
export interface InvoicingPlanPayload {
|
|
4
|
-
id: string;
|
|
5
|
-
applicable_items?: string[];
|
|
6
|
-
archived_at?: string;
|
|
7
|
-
billing_cycles?: number;
|
|
8
|
-
created_at?: string;
|
|
9
|
-
currency_code?: string;
|
|
10
|
-
currency_symbol?: string;
|
|
11
|
-
description?: string;
|
|
12
|
-
enabled_for_checkout?: boolean;
|
|
13
|
-
enabled_in_portal?: boolean;
|
|
14
|
-
external_id?: string;
|
|
15
|
-
external_name?: string;
|
|
16
|
-
gift_claim_redirect_url?: string;
|
|
17
|
-
included_in_mrr?: boolean;
|
|
18
|
-
is_giftable?: boolean;
|
|
19
|
-
is_shippable?: boolean;
|
|
20
|
-
item_applicability?: string;
|
|
21
|
-
item_family_id?: string;
|
|
22
|
-
item_type?: string;
|
|
23
|
-
metadata?: Record<string, unknown>;
|
|
24
|
-
metered?: boolean;
|
|
25
|
-
name?: string;
|
|
26
|
-
period?: number;
|
|
27
|
-
period_unit?: string;
|
|
28
|
-
price?: number;
|
|
29
|
-
product_code?: string;
|
|
30
|
-
status?: string;
|
|
31
|
-
sub_families?: InvoicingProductPayload[];
|
|
32
|
-
tiers?: InvoicingPlanTierPayload[];
|
|
33
|
-
trial_period?: number;
|
|
34
|
-
trial_period_unit?: string;
|
|
35
|
-
type?: string;
|
|
36
|
-
unit?: string;
|
|
37
|
-
updated_at?: string;
|
|
38
|
-
usage_calculation?: string;
|
|
39
|
-
}
|
|
40
|
-
export declare const mapInvoicingPlanPayloadToState: (payload: InvoicingPlanPayload) => InvoicingPlan;
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.mapInvoicingPlanPayloadToState = void 0;
|
|
4
|
-
const amount_1 = require("../../../commonStateTypes/amount");
|
|
5
|
-
const currencyHelper_1 = require("../../../commonStateTypes/currencyHelper");
|
|
6
|
-
const zeniDayJS_1 = require("../../../zeniDayJS");
|
|
7
|
-
const productPayload_1 = require("../product/productPayload");
|
|
8
|
-
// ── Payload → State mappers (snake_case wire shape → camelCase domain shape) ──
|
|
9
|
-
const mapInvoicingPlanPayloadToState = (payload) => {
|
|
10
|
-
const currencyCode = payload.currency_code ?? currencyHelper_1.defaultCustomerCurrency.currencyCode;
|
|
11
|
-
const currencySymbol = payload.currency_symbol ?? currencyHelper_1.defaultCustomerCurrency.currencySymbol;
|
|
12
|
-
return {
|
|
13
|
-
id: payload.id,
|
|
14
|
-
applicableItems: payload.applicable_items,
|
|
15
|
-
archivedAt: payload.archived_at != null ? (0, zeniDayJS_1.date)(payload.archived_at) : undefined,
|
|
16
|
-
billingCycles: payload.billing_cycles,
|
|
17
|
-
createdAt: payload.created_at != null ? (0, zeniDayJS_1.date)(payload.created_at) : undefined,
|
|
18
|
-
currencyCode: payload.currency_code,
|
|
19
|
-
description: payload.description,
|
|
20
|
-
enabledForCheckout: payload.enabled_for_checkout,
|
|
21
|
-
enabledInPortal: payload.enabled_in_portal,
|
|
22
|
-
externalId: payload.external_id,
|
|
23
|
-
externalName: payload.external_name,
|
|
24
|
-
giftClaimRedirectUrl: payload.gift_claim_redirect_url,
|
|
25
|
-
includedInMrr: payload.included_in_mrr,
|
|
26
|
-
isGiftable: payload.is_giftable,
|
|
27
|
-
isShippable: payload.is_shippable,
|
|
28
|
-
itemApplicability: payload.item_applicability,
|
|
29
|
-
itemFamilyID: payload.item_family_id,
|
|
30
|
-
itemType: payload.item_type,
|
|
31
|
-
metadata: payload.metadata,
|
|
32
|
-
metered: payload.metered,
|
|
33
|
-
name: payload.name,
|
|
34
|
-
period: payload.period,
|
|
35
|
-
periodUnit: payload.period_unit,
|
|
36
|
-
productCode: payload.product_code,
|
|
37
|
-
price: payload.price != null
|
|
38
|
-
? (0, amount_1.toAmount)(payload.price, currencyCode, currencySymbol)
|
|
39
|
-
: undefined,
|
|
40
|
-
subFamilies: payload.sub_families?.map(productPayload_1.mapInvoicingProductPayloadToState),
|
|
41
|
-
status: payload.status,
|
|
42
|
-
tiers: payload.tiers?.map((tier) => (0, productPayload_1.mapInvoicingPlanTierPayloadToState)(tier, currencyCode, currencySymbol)),
|
|
43
|
-
trialPeriod: payload.trial_period,
|
|
44
|
-
trialPeriodUnit: payload.trial_period_unit,
|
|
45
|
-
type: payload.type,
|
|
46
|
-
unit: payload.unit,
|
|
47
|
-
updatedAt: payload.updated_at != null ? (0, zeniDayJS_1.date)(payload.updated_at) : undefined,
|
|
48
|
-
usageCalculation: payload.usage_calculation,
|
|
49
|
-
};
|
|
50
|
-
};
|
|
51
|
-
exports.mapInvoicingPlanPayloadToState = mapInvoicingPlanPayloadToState;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { UpdateType } from '../../../commonStateTypes/common';
|
|
2
|
-
import { InvoicingProductPayload } from '../product/productPayload';
|
|
3
|
-
import { InvoicingProduct } from '../product/productState';
|
|
4
|
-
import { InvoicingPlanPayload } from './planPayload';
|
|
5
|
-
import { InvoicingPlanState } from './planState';
|
|
6
|
-
export declare const initialState: InvoicingPlanState;
|
|
7
|
-
export declare const updateInvoicingPlans: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[payload: InvoicingPlanPayload[], updateType?: UpdateType | undefined], InvoicingPlanPayload[], "invoicingPlan/updateInvoicingPlans", never, {
|
|
8
|
-
updateType: UpdateType;
|
|
9
|
-
}>, mergeInvoicingPlanSubFamily: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[planId: string, subFamilyPayload: InvoicingProductPayload], {
|
|
10
|
-
planId: string;
|
|
11
|
-
subFamily: InvoicingProduct;
|
|
12
|
-
}, "invoicingPlan/mergeInvoicingPlanSubFamily", never, never>, removeInvoicingPlan: import("@reduxjs/toolkit").ActionCreatorWithPayload<string, "invoicingPlan/removeInvoicingPlan">;
|
|
13
|
-
declare const _default: import("redux").Reducer<InvoicingPlanState>;
|
|
14
|
-
export default _default;
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import { Amount } from '../../../commonStateTypes/amount';
|
|
2
|
-
import { ID } from '../../../commonStateTypes/common';
|
|
3
|
-
import { ZeniDate } from '../../../zeniDayJS';
|
|
4
|
-
import { InvoicingPlanTier, InvoicingProduct } from '../product/productState';
|
|
5
|
-
export interface InvoicingPlan {
|
|
6
|
-
id: ID;
|
|
7
|
-
applicableItems?: ID[];
|
|
8
|
-
archivedAt?: ZeniDate;
|
|
9
|
-
billingCycles?: number;
|
|
10
|
-
createdAt?: ZeniDate;
|
|
11
|
-
currencyCode?: string;
|
|
12
|
-
description?: string;
|
|
13
|
-
enabledForCheckout?: boolean;
|
|
14
|
-
enabledInPortal?: boolean;
|
|
15
|
-
externalId?: string;
|
|
16
|
-
externalName?: string;
|
|
17
|
-
giftClaimRedirectUrl?: string;
|
|
18
|
-
includedInMrr?: boolean;
|
|
19
|
-
isGiftable?: boolean;
|
|
20
|
-
isShippable?: boolean;
|
|
21
|
-
itemApplicability?: string;
|
|
22
|
-
itemFamilyID?: ID;
|
|
23
|
-
itemType?: string;
|
|
24
|
-
metadata?: Record<string, unknown>;
|
|
25
|
-
metered?: boolean;
|
|
26
|
-
name?: string;
|
|
27
|
-
period?: number;
|
|
28
|
-
periodUnit?: string;
|
|
29
|
-
price?: Amount;
|
|
30
|
-
productCode?: string;
|
|
31
|
-
status?: string;
|
|
32
|
-
subFamilies?: InvoicingProduct[];
|
|
33
|
-
tiers?: InvoicingPlanTier[];
|
|
34
|
-
trialPeriod?: number;
|
|
35
|
-
trialPeriodUnit?: string;
|
|
36
|
-
type?: string;
|
|
37
|
-
unit?: string;
|
|
38
|
-
updatedAt?: ZeniDate;
|
|
39
|
-
usageCalculation?: string;
|
|
40
|
-
}
|
|
41
|
-
export interface InvoicingPlanState {
|
|
42
|
-
planByID: Record<ID, InvoicingPlan>;
|
|
43
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { UpdateType } from '../../../commonStateTypes/common';
|
|
2
|
-
import { InvoicingProductPayload } from './productPayload';
|
|
3
|
-
import { InvoicingProductState } from './productState';
|
|
4
|
-
export declare const initialState: InvoicingProductState;
|
|
5
|
-
export declare const updateInvoicingProducts: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[payload: InvoicingProductPayload[], updateType?: UpdateType | undefined], InvoicingProductPayload[], "invoicingProduct/updateInvoicingProducts", never, {
|
|
6
|
-
updateType: UpdateType;
|
|
7
|
-
}>, removeInvoicingProduct: import("@reduxjs/toolkit").ActionCreatorWithPayload<string, "invoicingProduct/removeInvoicingProduct">;
|
|
8
|
-
declare const _default: import("redux").Reducer<InvoicingProductState>;
|
|
9
|
-
export default _default;
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
var _a;
|
|
6
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.removeInvoicingProduct = exports.updateInvoicingProducts = exports.initialState = void 0;
|
|
8
|
-
const toolkit_1 = require("@reduxjs/toolkit");
|
|
9
|
-
const assignWith_1 = __importDefault(require("lodash/assignWith"));
|
|
10
|
-
const rootActions_1 = require("../../../rootActions");
|
|
11
|
-
const productPayload_1 = require("./productPayload");
|
|
12
|
-
exports.initialState = { productByID: {} };
|
|
13
|
-
const product = (0, toolkit_1.createSlice)({
|
|
14
|
-
name: 'invoicingProduct',
|
|
15
|
-
initialState: exports.initialState,
|
|
16
|
-
reducers: {
|
|
17
|
-
updateInvoicingProducts: {
|
|
18
|
-
reducer(draft, action) {
|
|
19
|
-
doUpdateInvoicingProducts(draft.productByID, action.payload, action.meta.updateType);
|
|
20
|
-
},
|
|
21
|
-
prepare(payload, updateType = 'replace') {
|
|
22
|
-
return { payload, meta: { updateType } };
|
|
23
|
-
},
|
|
24
|
-
},
|
|
25
|
-
removeInvoicingProduct(draft, action) {
|
|
26
|
-
delete draft.productByID[action.payload];
|
|
27
|
-
},
|
|
28
|
-
},
|
|
29
|
-
extraReducers: (builder) => {
|
|
30
|
-
builder.addCase(rootActions_1.clearAll, (draft) => {
|
|
31
|
-
Object.assign(draft, exports.initialState);
|
|
32
|
-
});
|
|
33
|
-
},
|
|
34
|
-
});
|
|
35
|
-
_a = product.actions, exports.updateInvoicingProducts = _a.updateInvoicingProducts, exports.removeInvoicingProduct = _a.removeInvoicingProduct;
|
|
36
|
-
exports.default = product.reducer;
|
|
37
|
-
/**
|
|
38
|
-
* Helper functions.
|
|
39
|
-
*/
|
|
40
|
-
function doUpdateInvoicingProducts(draft, payload, updateType) {
|
|
41
|
-
payload.forEach((productPayload) => {
|
|
42
|
-
const latestProduct = (0, productPayload_1.mapInvoicingProductPayloadToState)(productPayload);
|
|
43
|
-
if (latestProduct.id in draft && updateType === 'merge') {
|
|
44
|
-
(0, assignWith_1.default)(draft[latestProduct.id], latestProduct, (objValue, srcValue) => (srcValue == null ? objValue : srcValue));
|
|
45
|
-
}
|
|
46
|
-
else {
|
|
47
|
-
draft[latestProduct.id] = latestProduct;
|
|
48
|
-
}
|
|
49
|
-
});
|
|
50
|
-
}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { ID } from '../../../commonStateTypes/common';
|
|
2
|
-
import { InvoicingProduct, InvoicingProductState } from './productState';
|
|
3
|
-
export declare function getInvoicingProductsByIds(productState: InvoicingProductState, ids: ID[]): InvoicingProduct[];
|
|
4
|
-
export declare function getInvoicingProductById(productState: InvoicingProductState, id: ID): InvoicingProduct | undefined;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.getInvoicingProductsByIds = getInvoicingProductsByIds;
|
|
7
|
-
exports.getInvoicingProductById = getInvoicingProductById;
|
|
8
|
-
const get_1 = __importDefault(require("lodash/get"));
|
|
9
|
-
function getInvoicingProductsByIds(productState, ids) {
|
|
10
|
-
const products = ids
|
|
11
|
-
.map((id) => getInvoicingProductById(productState, id))
|
|
12
|
-
.filter((value) => value != null);
|
|
13
|
-
return products;
|
|
14
|
-
}
|
|
15
|
-
function getInvoicingProductById(productState, id) {
|
|
16
|
-
return (0, get_1.default)(productState.productByID, id);
|
|
17
|
-
}
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { toAmount } from '../../../commonStateTypes/amount';
|
|
2
|
-
import { defaultCustomerCurrency } from '../../../commonStateTypes/currencyHelper';
|
|
3
|
-
import { date } from '../../../zeniDayJS';
|
|
4
|
-
import { mapInvoicingPlanTierPayloadToState, mapInvoicingProductPayloadToState, } from '../product/productPayload';
|
|
5
|
-
// ── Payload → State mappers (snake_case wire shape → camelCase domain shape) ──
|
|
6
|
-
export const mapInvoicingPlanPayloadToState = (payload) => {
|
|
7
|
-
const currencyCode = payload.currency_code ?? defaultCustomerCurrency.currencyCode;
|
|
8
|
-
const currencySymbol = payload.currency_symbol ?? defaultCustomerCurrency.currencySymbol;
|
|
9
|
-
return {
|
|
10
|
-
id: payload.id,
|
|
11
|
-
applicableItems: payload.applicable_items,
|
|
12
|
-
archivedAt: payload.archived_at != null ? date(payload.archived_at) : undefined,
|
|
13
|
-
billingCycles: payload.billing_cycles,
|
|
14
|
-
createdAt: payload.created_at != null ? date(payload.created_at) : undefined,
|
|
15
|
-
currencyCode: payload.currency_code,
|
|
16
|
-
description: payload.description,
|
|
17
|
-
enabledForCheckout: payload.enabled_for_checkout,
|
|
18
|
-
enabledInPortal: payload.enabled_in_portal,
|
|
19
|
-
externalId: payload.external_id,
|
|
20
|
-
externalName: payload.external_name,
|
|
21
|
-
giftClaimRedirectUrl: payload.gift_claim_redirect_url,
|
|
22
|
-
includedInMrr: payload.included_in_mrr,
|
|
23
|
-
isGiftable: payload.is_giftable,
|
|
24
|
-
isShippable: payload.is_shippable,
|
|
25
|
-
itemApplicability: payload.item_applicability,
|
|
26
|
-
itemFamilyID: payload.item_family_id,
|
|
27
|
-
itemType: payload.item_type,
|
|
28
|
-
metadata: payload.metadata,
|
|
29
|
-
metered: payload.metered,
|
|
30
|
-
name: payload.name,
|
|
31
|
-
period: payload.period,
|
|
32
|
-
periodUnit: payload.period_unit,
|
|
33
|
-
productCode: payload.product_code,
|
|
34
|
-
price: payload.price != null
|
|
35
|
-
? toAmount(payload.price, currencyCode, currencySymbol)
|
|
36
|
-
: undefined,
|
|
37
|
-
subFamilies: payload.sub_families?.map(mapInvoicingProductPayloadToState),
|
|
38
|
-
status: payload.status,
|
|
39
|
-
tiers: payload.tiers?.map((tier) => mapInvoicingPlanTierPayloadToState(tier, currencyCode, currencySymbol)),
|
|
40
|
-
trialPeriod: payload.trial_period,
|
|
41
|
-
trialPeriodUnit: payload.trial_period_unit,
|
|
42
|
-
type: payload.type,
|
|
43
|
-
unit: payload.unit,
|
|
44
|
-
updatedAt: payload.updated_at != null ? date(payload.updated_at) : undefined,
|
|
45
|
-
usageCalculation: payload.usage_calculation,
|
|
46
|
-
};
|
|
47
|
-
};
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import { createSlice } from '@reduxjs/toolkit';
|
|
2
|
-
import assignWith from 'lodash/assignWith';
|
|
3
|
-
import { clearAll } from '../../../rootActions';
|
|
4
|
-
import { mapInvoicingProductPayloadToState, } from './productPayload';
|
|
5
|
-
export const initialState = { productByID: {} };
|
|
6
|
-
const product = createSlice({
|
|
7
|
-
name: 'invoicingProduct',
|
|
8
|
-
initialState,
|
|
9
|
-
reducers: {
|
|
10
|
-
updateInvoicingProducts: {
|
|
11
|
-
reducer(draft, action) {
|
|
12
|
-
doUpdateInvoicingProducts(draft.productByID, action.payload, action.meta.updateType);
|
|
13
|
-
},
|
|
14
|
-
prepare(payload, updateType = 'replace') {
|
|
15
|
-
return { payload, meta: { updateType } };
|
|
16
|
-
},
|
|
17
|
-
},
|
|
18
|
-
removeInvoicingProduct(draft, action) {
|
|
19
|
-
delete draft.productByID[action.payload];
|
|
20
|
-
},
|
|
21
|
-
},
|
|
22
|
-
extraReducers: (builder) => {
|
|
23
|
-
builder.addCase(clearAll, (draft) => {
|
|
24
|
-
Object.assign(draft, initialState);
|
|
25
|
-
});
|
|
26
|
-
},
|
|
27
|
-
});
|
|
28
|
-
export const { updateInvoicingProducts, removeInvoicingProduct } = product.actions;
|
|
29
|
-
export default product.reducer;
|
|
30
|
-
/**
|
|
31
|
-
* Helper functions.
|
|
32
|
-
*/
|
|
33
|
-
function doUpdateInvoicingProducts(draft, payload, updateType) {
|
|
34
|
-
payload.forEach((productPayload) => {
|
|
35
|
-
const latestProduct = mapInvoicingProductPayloadToState(productPayload);
|
|
36
|
-
if (latestProduct.id in draft && updateType === 'merge') {
|
|
37
|
-
assignWith(draft[latestProduct.id], latestProduct, (objValue, srcValue) => (srcValue == null ? objValue : srcValue));
|
|
38
|
-
}
|
|
39
|
-
else {
|
|
40
|
-
draft[latestProduct.id] = latestProduct;
|
|
41
|
-
}
|
|
42
|
-
});
|
|
43
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import recordGet from 'lodash/get';
|
|
2
|
-
export function getInvoicingProductsByIds(productState, ids) {
|
|
3
|
-
const products = ids
|
|
4
|
-
.map((id) => getInvoicingProductById(productState, id))
|
|
5
|
-
.filter((value) => value != null);
|
|
6
|
-
return products;
|
|
7
|
-
}
|
|
8
|
-
export function getInvoicingProductById(productState, id) {
|
|
9
|
-
return recordGet(productState.productByID, id);
|
|
10
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
/package/lib/entity/invoicing/{plan/planState.js → invoicingCatalog/invoicingCatalogState.js}
RENAMED
|
File without changes
|
/package/lib/esm/entity/invoicing/{plan/planState.js → invoicingCatalog/invoicingCatalogState.js}
RENAMED
|
File without changes
|