@zeniai/client-epic-state 4.19.96-beta1ND → 4.19.96-beta3ND
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/commonStateTypes/currencyHelper.d.ts +3 -0
- package/lib/commonStateTypes/currencyHelper.js +6 -1
- package/lib/entity/customer/customerState.d.ts +0 -2
- package/lib/entity/customer/customerState.js +0 -5
- package/lib/esm/commonStateTypes/currencyHelper.js +5 -0
- package/lib/esm/entity/customer/customerState.js +1 -4
- package/lib/esm/index.js +1 -1
- package/lib/esm/view/arAgingView/arAgingReport/arAgingReducer.js +1 -1
- package/lib/esm/view/arAgingView/arAgingReport/arAgingSelector.js +1 -1
- package/lib/esm/view/profitAndLossClassesView/profitAndLossClassesByClassHorizontalSelector.js +10 -15
- package/lib/index.d.ts +2 -1
- package/lib/index.js +2 -2
- package/lib/tsconfig.typecheck.tsbuildinfo +1 -1
- package/lib/view/arAgingView/arAgingReport/arAgingReducer.js +2 -2
- package/lib/view/arAgingView/arAgingReport/arAgingSelector.js +5 -5
- package/lib/view/profitAndLossClassesView/profitAndLossClassesByClassHorizontalSelector.js +10 -15
- package/package.json +1 -1
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isUsdCurrency = void 0;
|
|
3
|
+
exports.defaultCustomerCurrency = exports.isUsdCurrency = void 0;
|
|
4
4
|
const isUsdCurrency = (currencyCode) => {
|
|
5
5
|
return currencyCode === 'USD';
|
|
6
6
|
};
|
|
7
7
|
exports.isUsdCurrency = isUsdCurrency;
|
|
8
|
+
/** Default home-currency fallback when tenant/report currency is unset. */
|
|
9
|
+
exports.defaultCustomerCurrency = {
|
|
10
|
+
currencyCode: 'USD',
|
|
11
|
+
currencySymbol: '$',
|
|
12
|
+
};
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { Currency } from '../../commonStateTypes/amount';
|
|
2
1
|
import { ID } from '../../commonStateTypes/common';
|
|
3
2
|
import { ZeniDate } from '../../zeniDayJS';
|
|
4
3
|
import { ZeniUrl as Url } from '../../zeniUrl';
|
|
@@ -47,4 +46,3 @@ export interface Customer extends CustomerBase {
|
|
|
47
46
|
export interface CustomerState {
|
|
48
47
|
byCustomerId: Record<ID, Customer>;
|
|
49
48
|
}
|
|
50
|
-
export declare const defaultCustomerCurrency: Currency;
|
package/lib/esm/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { isAllowedValueWithCode, isAllowedValueWithID, } from './commonStateTypes/allowedValue';
|
|
2
2
|
import { toAmount } from './commonStateTypes/amount';
|
|
3
|
+
import { defaultCustomerCurrency } from './commonStateTypes/currencyHelper';
|
|
3
4
|
import { getTimeframeTickTag, isIncompleteMonthPresentInTimeframeTick, } from './commonStateTypes/bookCloseDateHelper';
|
|
4
5
|
import { toCOABalanceTimeframe, } from './commonStateTypes/coaBalance/coaBalance';
|
|
5
6
|
import { isCalculatedBalanceType, toCOABalanceType, toCOABalanceTypeStrict, } from './commonStateTypes/coaBalance/coaBalanceType';
|
|
@@ -40,7 +41,6 @@ import { getControllersName, getFirstControllerEmail, getFirstControllerId, } fr
|
|
|
40
41
|
import { getCompanyByCompanyId, getCompanyInfoForAllCockpitCompaniesInState, getControllersForCompany, } from './entity/company/companySelector';
|
|
41
42
|
import { ALL_ACCOUNTING_CONNECTION_CREATION_MODES, isCompanyEligibleForTreasury, } from './entity/company/companyStateTypes';
|
|
42
43
|
import { updateCompaniesHealth, updateCompanyHealth, } from './entity/companyHealthMetric/companyHealthMetricReducer';
|
|
43
|
-
import { defaultCustomerCurrency, } from './entity/customer/customerState';
|
|
44
44
|
import { CustomerIncomeTrend } from './entity/customerIncome/customerIncomeTrend';
|
|
45
45
|
import { getDepositAccountLimitForChargeCardByDepositAccountId } from './entity/depositAccount/depositAccountSelector';
|
|
46
46
|
import { mapAttachmentFilePayloadToFile, mapAttachmentFileToAttachmentFilePayload, mapFilePayloadToFile, removeAttachmentFiles, updateAttachmentFiles, updateFiles, } from './entity/file/fileReducer';
|
|
@@ -3,7 +3,7 @@ import { mapReportPayloadV2ToReportV2 } from '../../../commonPayloadTypes/v2/vie
|
|
|
3
3
|
import { getAgingBalancesKey, toAgingPeriod, } from '../../../commonStateTypes/agingBalance/agingBalance';
|
|
4
4
|
import { getNestedCustomerHierarchy } from '../../../commonStateTypes/customerView/getNestedCustomerHierarchy';
|
|
5
5
|
import { toCustomer } from '../../../entity/customer/customerPayload';
|
|
6
|
-
import { defaultCustomerCurrency } from '../../../
|
|
6
|
+
import { defaultCustomerCurrency } from '../../../commonStateTypes/currencyHelper';
|
|
7
7
|
import { dateNow } from '../../../zeniDayJS';
|
|
8
8
|
import { toArAgingDataByCustomerId, toArAgingTotals, } from './arAgingPayload';
|
|
9
9
|
export const inititalUIState = {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { createSelector } from '@reduxjs/toolkit';
|
|
2
2
|
import orderBy from 'lodash/orderBy';
|
|
3
3
|
import { getAgingBalancesKey, } from '../../../commonStateTypes/agingBalance/agingBalance';
|
|
4
|
+
import { defaultCustomerCurrency } from '../../../commonStateTypes/currencyHelper';
|
|
4
5
|
import { getCustomer } from '../../../entity/customer/customerSelector';
|
|
5
|
-
import { defaultCustomerCurrency, } from '../../../entity/customer/customerState';
|
|
6
6
|
export const getArAgingReport = createSelector((state) => state.arAgingState, (state) => state.customerState, (arAgingState, customerState) => {
|
|
7
7
|
const { reportId, reportTitle, fetchState, uiState, firstMonthOfFY, agingPeriods, } = arAgingState;
|
|
8
8
|
const { searchString, sortOrder, sortKey, selectedDate } = uiState;
|
package/lib/esm/view/profitAndLossClassesView/profitAndLossClassesByClassHorizontalSelector.js
CHANGED
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
import { toAmountWC } from '../../commonStateTypes/amount';
|
|
2
|
+
import { getSummationFreeRangeTotalBalance } from '../../commonStateTypes/coaBalance/additionalBalances/getSummationBalance';
|
|
2
3
|
import { reduceFetchStateParallelTimeframes } from '../../commonStateTypes/reduceFetchState';
|
|
4
|
+
import { defaultCustomerCurrency } from '../../commonStateTypes/currencyHelper';
|
|
3
5
|
import { getSectionClassesViewReport } from '../../entity/sectionClassesViewV2/sectionClassesViewSelector';
|
|
4
|
-
/** If `ProfitAndLossClassesViewState.currency` is unset (e.g. tests). */
|
|
5
|
-
const FALLBACK_REPORT_CURRENCY = {
|
|
6
|
-
currencyCode: 'USD',
|
|
7
|
-
currencySymbol: '$',
|
|
8
|
-
};
|
|
9
6
|
export const profitAndLossHorizontalIdsInOrder = [
|
|
10
7
|
'income',
|
|
11
8
|
'cogs',
|
|
@@ -49,7 +46,7 @@ export const getProfitAndLossClassesHorizontalView = (filter, accountState, clas
|
|
|
49
46
|
const classColumns = buildClassColumns(profitAndLossClassesViewState.classHierarchy, filter.classesToFilterOut);
|
|
50
47
|
const sections = {};
|
|
51
48
|
const calculatedSections = {};
|
|
52
|
-
let reportCurrency =
|
|
49
|
+
let reportCurrency = defaultCustomerCurrency;
|
|
53
50
|
if (fetchState.fetchState === 'Completed' && selectedPeriod != null) {
|
|
54
51
|
// Get section reports using existing selector infrastructure
|
|
55
52
|
const sectionReports = {};
|
|
@@ -57,7 +54,7 @@ export const getProfitAndLossClassesHorizontalView = (filter, accountState, clas
|
|
|
57
54
|
sectionReports[sectionId] = getSectionClassesViewReport(accountState, classState, sectionsState, { reportId, sectionId }, filter);
|
|
58
55
|
});
|
|
59
56
|
reportCurrency =
|
|
60
|
-
profitAndLossClassesViewState.currency ??
|
|
57
|
+
profitAndLossClassesViewState.currency ?? defaultCustomerCurrency;
|
|
61
58
|
// Pivot each section from class→account to account→class
|
|
62
59
|
HORIZONTAL_PANDL_SECTION_IDS.forEach((sectionId) => {
|
|
63
60
|
const sectionReport = sectionReports[sectionId];
|
|
@@ -253,17 +250,15 @@ function collectAccountsFromNestedAccount(nestedAccount, classId, accountMap, de
|
|
|
253
250
|
});
|
|
254
251
|
}
|
|
255
252
|
/**
|
|
256
|
-
* Total amount for the current
|
|
257
|
-
* `
|
|
258
|
-
* multi-period selections and avoids mismatches when `thisPeriod` does not
|
|
259
|
-
* align with a row (e.g. slice fallback) or when several period rows are shown.
|
|
253
|
+
* Total `balance.amount` for the current COA slice (same aggregation as
|
|
254
|
+
* `getSummationFreeRangeTotalBalance`, used for class totals and account rows).
|
|
260
255
|
*/
|
|
261
256
|
function sumBalancesInSlice(balances) {
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
sum += bal.balance?.amount ?? 0;
|
|
257
|
+
if (balances.length === 0) {
|
|
258
|
+
return 0;
|
|
265
259
|
}
|
|
266
|
-
|
|
260
|
+
const summed = getSummationFreeRangeTotalBalance([...balances]);
|
|
261
|
+
return summed?.balance.amount ?? 0;
|
|
267
262
|
}
|
|
268
263
|
/**
|
|
269
264
|
* Compute a calculated section by adding or subtracting two sets of class totals.
|
package/lib/index.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { NestedAccountHierarchyForReport, NestedAccountID, NestedAccountIDHierar
|
|
|
2
2
|
import { AgingBalance, AgingPeriod } from './commonStateTypes/agingBalance/agingBalance';
|
|
3
3
|
import { AllowedValue, AllowedValueWithCode, AllowedValueWithID, isAllowedValueWithCode, isAllowedValueWithID } from './commonStateTypes/allowedValue';
|
|
4
4
|
import { Amount, Currency, toAmount } from './commonStateTypes/amount';
|
|
5
|
+
import { defaultCustomerCurrency } from './commonStateTypes/currencyHelper';
|
|
5
6
|
import { AnimationFileName } from './commonStateTypes/animations';
|
|
6
7
|
import { Balance, BalanceChange } from './commonStateTypes/balance';
|
|
7
8
|
import { BalanceKind, BalancesTimeseries, TrendTimeseries } from './commonStateTypes/balanceTimeseries';
|
|
@@ -70,7 +71,7 @@ import { AdditionalChurnFactor, AdditionalChurnFactors, CompanyHealthMetric, Com
|
|
|
70
71
|
import { ConnectedAccount } from './entity/connectedAccount/connectedAccount';
|
|
71
72
|
import { Country } from './entity/countryList/countryListState';
|
|
72
73
|
import { CountryWithCurrency } from './entity/currency/currency';
|
|
73
|
-
import { Customer, CustomerBase
|
|
74
|
+
import { Customer, CustomerBase } from './entity/customer/customerState';
|
|
74
75
|
import { CustomerIncomeTrend } from './entity/customerIncome/customerIncomeTrend';
|
|
75
76
|
import { CustomerSatisfactionInfo } from './entity/customerSatisfaction/customerSatisfactionSelectorReducerTypes';
|
|
76
77
|
import { CustomerRatingCodeType, TeamRatingCodeType } from './entity/customerSatisfaction/customerSatisfactionState';
|
package/lib/index.js
CHANGED
|
@@ -74,6 +74,8 @@ Object.defineProperty(exports, "isAllowedValueWithCode", { enumerable: true, get
|
|
|
74
74
|
Object.defineProperty(exports, "isAllowedValueWithID", { enumerable: true, get: function () { return allowedValue_1.isAllowedValueWithID; } });
|
|
75
75
|
const amount_1 = require("./commonStateTypes/amount");
|
|
76
76
|
Object.defineProperty(exports, "toAmount", { enumerable: true, get: function () { return amount_1.toAmount; } });
|
|
77
|
+
const currencyHelper_1 = require("./commonStateTypes/currencyHelper");
|
|
78
|
+
Object.defineProperty(exports, "defaultCustomerCurrency", { enumerable: true, get: function () { return currencyHelper_1.defaultCustomerCurrency; } });
|
|
77
79
|
const bookCloseDateHelper_1 = require("./commonStateTypes/bookCloseDateHelper");
|
|
78
80
|
Object.defineProperty(exports, "getTimeframeTickTag", { enumerable: true, get: function () { return bookCloseDateHelper_1.getTimeframeTickTag; } });
|
|
79
81
|
Object.defineProperty(exports, "isIncompleteMonthPresentInTimeframeTick", { enumerable: true, get: function () { return bookCloseDateHelper_1.isIncompleteMonthPresentInTimeframeTick; } });
|
|
@@ -207,8 +209,6 @@ Object.defineProperty(exports, "isCompanyEligibleForTreasury", { enumerable: tru
|
|
|
207
209
|
const companyHealthMetricReducer_1 = require("./entity/companyHealthMetric/companyHealthMetricReducer");
|
|
208
210
|
Object.defineProperty(exports, "updateCompaniesHealth", { enumerable: true, get: function () { return companyHealthMetricReducer_1.updateCompaniesHealth; } });
|
|
209
211
|
Object.defineProperty(exports, "updateCompanyHealth", { enumerable: true, get: function () { return companyHealthMetricReducer_1.updateCompanyHealth; } });
|
|
210
|
-
const customerState_1 = require("./entity/customer/customerState");
|
|
211
|
-
Object.defineProperty(exports, "defaultCustomerCurrency", { enumerable: true, get: function () { return customerState_1.defaultCustomerCurrency; } });
|
|
212
212
|
const customerIncomeTrend_1 = require("./entity/customerIncome/customerIncomeTrend");
|
|
213
213
|
Object.defineProperty(exports, "CustomerIncomeTrend", { enumerable: true, get: function () { return customerIncomeTrend_1.CustomerIncomeTrend; } });
|
|
214
214
|
const depositAccountSelector_1 = require("./entity/depositAccount/depositAccountSelector");
|