@zerocarbon/erp-config-sdk 1.0.14 → 1.0.15
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/dist/index.d.ts +76 -16
- package/dist/index.esm.js +129 -5
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +131 -4
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -966,32 +966,72 @@ type Scope3Item$2 = {
|
|
|
966
966
|
subProducts: Emissions$i;
|
|
967
967
|
desc: string;
|
|
968
968
|
};
|
|
969
|
-
type
|
|
969
|
+
type BackendProduct = {
|
|
970
|
+
name: string;
|
|
971
|
+
unit: string;
|
|
972
|
+
type: string;
|
|
973
|
+
calorificValue: number;
|
|
974
|
+
emissionFactor: number;
|
|
975
|
+
energyConversionFactor?: number;
|
|
976
|
+
};
|
|
977
|
+
type BackendEmissionItem = {
|
|
978
|
+
item: string;
|
|
979
|
+
emissionFactor: number;
|
|
980
|
+
unit: string;
|
|
981
|
+
};
|
|
982
|
+
type BackendEquipmentCategory = {
|
|
983
|
+
category: string;
|
|
984
|
+
items: BackendEmissionItem[];
|
|
985
|
+
};
|
|
986
|
+
type BackendEmissions = BackendEquipmentCategory[];
|
|
987
|
+
type BackendScope = {
|
|
988
|
+
name: string;
|
|
970
989
|
icon?: string;
|
|
990
|
+
scope: string;
|
|
991
|
+
unit: string;
|
|
992
|
+
subProducts: BackendProduct[];
|
|
993
|
+
desc: string;
|
|
994
|
+
group?: string;
|
|
995
|
+
className?: string;
|
|
971
996
|
};
|
|
972
|
-
type BackendScope3Item =
|
|
997
|
+
type BackendScope3Item = {
|
|
998
|
+
name: string;
|
|
999
|
+
displayName: string;
|
|
973
1000
|
icon?: string;
|
|
1001
|
+
scope: string;
|
|
1002
|
+
unit: string;
|
|
1003
|
+
subProducts: BackendEmissions;
|
|
1004
|
+
desc: string;
|
|
1005
|
+
};
|
|
1006
|
+
type BackendAdditionalScopeItem = {
|
|
1007
|
+
type: "scope1" | "scope2" | "scope3";
|
|
1008
|
+
route: string;
|
|
1009
|
+
name: string;
|
|
1010
|
+
scope: BackendScope | BackendScope3Item;
|
|
974
1011
|
};
|
|
975
1012
|
type BackendIndustryConfig = {
|
|
976
1013
|
scope1: BackendScope[];
|
|
977
1014
|
scope2: BackendScope[];
|
|
978
1015
|
scope3: BackendScope3Item[];
|
|
979
1016
|
additionalScopes?: {
|
|
980
|
-
[key: string]:
|
|
981
|
-
type: "scope1" | "scope2" | "scope3";
|
|
982
|
-
route: string;
|
|
983
|
-
name: string;
|
|
984
|
-
scope: BackendScope | BackendScope3Item;
|
|
985
|
-
}>;
|
|
1017
|
+
[key: string]: BackendAdditionalScopeItem[];
|
|
986
1018
|
};
|
|
987
1019
|
};
|
|
1020
|
+
type BackendUserConfig = {
|
|
1021
|
+
scope1?: BackendScope[];
|
|
1022
|
+
scope2?: BackendScope[];
|
|
1023
|
+
scope3?: BackendScope3Item[];
|
|
1024
|
+
waterManagement?: BackendScope;
|
|
1025
|
+
};
|
|
1026
|
+
type BackendUserConfigs = {
|
|
1027
|
+
[username: string]: BackendUserConfig;
|
|
1028
|
+
};
|
|
1029
|
+
type BackendIndustries = {
|
|
1030
|
+
[industryName: string]: BackendIndustryConfig;
|
|
1031
|
+
};
|
|
988
1032
|
type AllConfigurations = {
|
|
989
|
-
industries:
|
|
990
|
-
|
|
991
|
-
};
|
|
992
|
-
userConfigs: {
|
|
993
|
-
[key: string]: any;
|
|
994
|
-
};
|
|
1033
|
+
industries: BackendIndustries;
|
|
1034
|
+
userConfigs: BackendUserConfigs;
|
|
995
1035
|
};
|
|
996
1036
|
/**
|
|
997
1037
|
* Get all configurations for backend consumption without React icons
|
|
@@ -999,6 +1039,26 @@ type AllConfigurations = {
|
|
|
999
1039
|
* in a format that can be safely consumed by backend applications
|
|
1000
1040
|
*/
|
|
1001
1041
|
declare function getAllConfig(): AllConfigurations;
|
|
1042
|
+
/**
|
|
1043
|
+
* Get user-specific backend configuration by username
|
|
1044
|
+
* @param username - The username to get configuration for
|
|
1045
|
+
* @returns Backend-compatible user configuration or undefined if not found
|
|
1046
|
+
*/
|
|
1047
|
+
declare function getUserNameBackendConfig(username: string): BackendUserConfig | undefined;
|
|
1048
|
+
/**
|
|
1049
|
+
* Get industry-specific backend configuration by industry name
|
|
1050
|
+
* @param industryName - The industry name to get configuration for
|
|
1051
|
+
* @returns Backend-compatible industry configuration or undefined if not found
|
|
1052
|
+
*/
|
|
1053
|
+
declare function getIndustryBackendConfig(industryName: string): BackendIndustryConfig | undefined;
|
|
1054
|
+
/**
|
|
1055
|
+
* Get combined industry and user configuration for backend consumption
|
|
1056
|
+
* This applies user-specific overrides to industry configuration when available
|
|
1057
|
+
* @param industryName - The industry name
|
|
1058
|
+
* @param username - Optional username for user-specific customizations
|
|
1059
|
+
* @returns Backend-compatible combined configuration
|
|
1060
|
+
*/
|
|
1061
|
+
declare function getCombinedBackendConfig(industryName: string, username?: string): BackendIndustryConfig | undefined;
|
|
1002
1062
|
|
|
1003
1063
|
interface BillFilterOptions {
|
|
1004
1064
|
category?: string;
|
|
@@ -4048,5 +4108,5 @@ declare namespace index {
|
|
|
4048
4108
|
};
|
|
4049
4109
|
}
|
|
4050
4110
|
|
|
4051
|
-
export { API_ENDPOINTS, API_SCOPE3_CEMENT_CONFIG, BILL_CALCULATION_CONFIGS, BillManager, CCTS_ALLSCOPES_CEMENT, CCTS_CALCINATION_PRODUCTS, CCTS_ELECTRICITY_PRODUCTS, CCTS_FIRE_EXTINGUISHER_PRODUCTS, CCTS_FUEL_COMBUSTION_PRODUCTS, CCTS_LPG_PRODUCTS, CCTS_MINING_OPERATIONS_PRODUCTS, CCTS_ONSITE_POWER_PRODUCTS, CCTS_PURCHASED_ELECTRICITY, CCTS_REFRIGERANTS, CCTS_SCOPE1_CEMENT, CCTS_SCOPE2_CEMENT, CCTS_SF6_PRODUCTS, CCTS_TABLE_COLUMNS, DEFAULT_BILL_MATCHING_CONFIG, EmissionSourceGenerator, FRONTEND_INDUSTRY_CONFIGS, HTTP_STATUS, INDUSTRIES_CONFIG, INDUSTRY_MAPPING, INDUSTRY_SPECIFIC_FIELDS, INTENSITY_FIELD_LABELS, ISO_CATEGORIES_PACKAGING, index as Industries, UI_FEATURES, WATER_PRODUCTS, calculateCCTSEmission, calculateIntensityMetrics, categorizeApiItem, cleanValue, createBillManager, createCapitalizedMonthMapping, createEmissionSourceGenerator, createMonthMapping, debugCarbonIntensityMapping, extractCarbonIntensityData, formatEmissionValue, formatIntensityValue, formatKPIEmission, formatMonthlyEmission, formatPercentage, getAllConfig, getApiIndustryType, getAvailableFieldsForIndustry, getIndustryConfig$1 as getIndustryConfig, getIndustryFieldConfig, getIntensityFormulas, getPlantNameConfig, getScope3ConfigByName, getUserNameScopeConfig, hasIntensities, isUIFeatureEnabled, mapIndustryToApiType, sanitizeNumber, supportsIntensityCalculations, validateCarbonIntensityData };
|
|
4052
|
-
export type { AllConfigurations, AlloyRequest, AlloyResponse, AluminiumRequest, AluminiumResponse, ApiEndpointConfig, ApiResponse, AutomobileRequest, AutomobileResponse, AviationRequest, AviationResponse, BackendIndustryConfig, BackendScope, BackendScope3Item, BaseRequest, BaseResponse, Bill, BillCalculationConfig, BillFilterOptions, BillMatchingConfig, BusinessTravelEmission, BusinessTravelEmissionAttributes, BusinessTravelEmissionsResponse, BillsAnalyzed$1 as CarbonIntensityBillsAnalyzed, Calculations$1 as CarbonIntensityCalculations, EmissionData$2 as CarbonIntensityEmissionData, ErrorResponse$1 as CarbonIntensityErrorResponse, CarbonIntensityRequest, CarbonIntensityResponse, ChemicalRequest, ChemicalResponse, DetailedCarbonIntensityResponse, EditableItem, EmissionData$3 as EmissionData, EmissionSource, Emissions$j as Emissions, EmissionsDataAttributes, EmissionsDataResponse, FieldConfig, FoodBeveragesRequest, FoodBeveragesResponse, FormData, FormValidationResult, FrontendIndustryConfig, HospitalityRequest, HospitalityResponse, IndustryConfig, EmissionData as IndustryEmissionData, IndustryFieldConfig, IndustryFieldSection, ProductionData as IndustryProductionData, IndustryType, IntensityCalculation, IntensityValue, LogisticsRequest, LogisticsResponse, ManufacturingRequest, ManufacturingResponse, Meta, MetalEnergyRequest, MetalEnergyResponse, PackagingRequest, PackagingResponse, Pagination, PetrochemicalRequest, PetrochemicalResponse, PharmaRequest, PharmaResponse, PlantNameConfig, ProcessedEmissionCategory, ProcessedEmissionItem, ProcessedScope3Data, RealEstateRequest, RealEstateResponse, BillsAnalyzed as ResponseBillsAnalyzed, Calculations as ResponseCalculations, EmissionData$1 as ResponseEmissionData, ErrorResponse as ResponseErrorResponse, ScopeConfig, ScopeProduct, ShippingRequest, ShippingResponse, SteelRequest, SteelResponse, StrapiItem, StrapiResponse, TelecommunicationRequest, TelecommunicationResponse, TextileRequest, TextileResponse, TransportationEmission, TransportationEmissionAttributes, TransportationEmissionsResponse, UserData, UtilitiesRequest, UtilitiesResponse, ValidationError, VehicleEmission, VehicleEmissionAttributes, VehicleEmissionsResponse };
|
|
4111
|
+
export { API_ENDPOINTS, API_SCOPE3_CEMENT_CONFIG, BILL_CALCULATION_CONFIGS, BillManager, CCTS_ALLSCOPES_CEMENT, CCTS_CALCINATION_PRODUCTS, CCTS_ELECTRICITY_PRODUCTS, CCTS_FIRE_EXTINGUISHER_PRODUCTS, CCTS_FUEL_COMBUSTION_PRODUCTS, CCTS_LPG_PRODUCTS, CCTS_MINING_OPERATIONS_PRODUCTS, CCTS_ONSITE_POWER_PRODUCTS, CCTS_PURCHASED_ELECTRICITY, CCTS_REFRIGERANTS, CCTS_SCOPE1_CEMENT, CCTS_SCOPE2_CEMENT, CCTS_SF6_PRODUCTS, CCTS_TABLE_COLUMNS, DEFAULT_BILL_MATCHING_CONFIG, EmissionSourceGenerator, FRONTEND_INDUSTRY_CONFIGS, HTTP_STATUS, INDUSTRIES_CONFIG, INDUSTRY_MAPPING, INDUSTRY_SPECIFIC_FIELDS, INTENSITY_FIELD_LABELS, ISO_CATEGORIES_PACKAGING, index as Industries, UI_FEATURES, WATER_PRODUCTS, calculateCCTSEmission, calculateIntensityMetrics, categorizeApiItem, cleanValue, createBillManager, createCapitalizedMonthMapping, createEmissionSourceGenerator, createMonthMapping, debugCarbonIntensityMapping, extractCarbonIntensityData, formatEmissionValue, formatIntensityValue, formatKPIEmission, formatMonthlyEmission, formatPercentage, getAllConfig, getApiIndustryType, getAvailableFieldsForIndustry, getCombinedBackendConfig, getIndustryBackendConfig, getIndustryConfig$1 as getIndustryConfig, getIndustryFieldConfig, getIntensityFormulas, getPlantNameConfig, getScope3ConfigByName, getUserNameBackendConfig, getUserNameScopeConfig, hasIntensities, isUIFeatureEnabled, mapIndustryToApiType, sanitizeNumber, supportsIntensityCalculations, validateCarbonIntensityData };
|
|
4112
|
+
export type { AllConfigurations, AlloyRequest, AlloyResponse, AluminiumRequest, AluminiumResponse, ApiEndpointConfig, ApiResponse, AutomobileRequest, AutomobileResponse, AviationRequest, AviationResponse, BackendAdditionalScopeItem, BackendEmissionItem, BackendEmissions, BackendEquipmentCategory, BackendIndustries, BackendIndustryConfig, BackendProduct, BackendScope, BackendScope3Item, BackendUserConfig, BackendUserConfigs, BaseRequest, BaseResponse, Bill, BillCalculationConfig, BillFilterOptions, BillMatchingConfig, BusinessTravelEmission, BusinessTravelEmissionAttributes, BusinessTravelEmissionsResponse, BillsAnalyzed$1 as CarbonIntensityBillsAnalyzed, Calculations$1 as CarbonIntensityCalculations, EmissionData$2 as CarbonIntensityEmissionData, ErrorResponse$1 as CarbonIntensityErrorResponse, CarbonIntensityRequest, CarbonIntensityResponse, ChemicalRequest, ChemicalResponse, DetailedCarbonIntensityResponse, EditableItem, EmissionData$3 as EmissionData, EmissionSource, Emissions$j as Emissions, EmissionsDataAttributes, EmissionsDataResponse, FieldConfig, FoodBeveragesRequest, FoodBeveragesResponse, FormData, FormValidationResult, FrontendIndustryConfig, HospitalityRequest, HospitalityResponse, IndustryConfig, EmissionData as IndustryEmissionData, IndustryFieldConfig, IndustryFieldSection, ProductionData as IndustryProductionData, IndustryType, IntensityCalculation, IntensityValue, LogisticsRequest, LogisticsResponse, ManufacturingRequest, ManufacturingResponse, Meta, MetalEnergyRequest, MetalEnergyResponse, PackagingRequest, PackagingResponse, Pagination, PetrochemicalRequest, PetrochemicalResponse, PharmaRequest, PharmaResponse, PlantNameConfig, ProcessedEmissionCategory, ProcessedEmissionItem, ProcessedScope3Data, RealEstateRequest, RealEstateResponse, BillsAnalyzed as ResponseBillsAnalyzed, Calculations as ResponseCalculations, EmissionData$1 as ResponseEmissionData, ErrorResponse as ResponseErrorResponse, ScopeConfig, ScopeProduct, ShippingRequest, ShippingResponse, SteelRequest, SteelResponse, StrapiItem, StrapiResponse, TelecommunicationRequest, TelecommunicationResponse, TextileRequest, TextileResponse, TransportationEmission, TransportationEmissionAttributes, TransportationEmissionsResponse, UserData, UtilitiesRequest, UtilitiesResponse, ValidationError, VehicleEmission, VehicleEmissionAttributes, VehicleEmissionsResponse };
|
package/dist/index.esm.js
CHANGED
|
@@ -34572,7 +34572,8 @@ function transformScopeToBackend(scope) {
|
|
|
34572
34572
|
const { icon, ...rest } = scope;
|
|
34573
34573
|
return {
|
|
34574
34574
|
...rest,
|
|
34575
|
-
icon: ((_a = scope.icon) === null || _a === void 0 ? void 0 : _a.name) || undefined // Extract icon name if available
|
|
34575
|
+
icon: ((_a = scope.icon) === null || _a === void 0 ? void 0 : _a.name) || undefined, // Extract icon name if available
|
|
34576
|
+
subProducts: rest.subProducts.map(transformProductToBackend)
|
|
34576
34577
|
};
|
|
34577
34578
|
}
|
|
34578
34579
|
// Transform a scope3 item to be backend-compatible by removing React icons
|
|
@@ -34581,7 +34582,8 @@ function transformScope3ToBackend(scope3) {
|
|
|
34581
34582
|
const { icon, ...rest } = scope3;
|
|
34582
34583
|
return {
|
|
34583
34584
|
...rest,
|
|
34584
|
-
icon: ((_a = scope3.icon) === null || _a === void 0 ? void 0 : _a.name) || undefined // Extract icon name if available
|
|
34585
|
+
icon: ((_a = scope3.icon) === null || _a === void 0 ? void 0 : _a.name) || undefined, // Extract icon name if available
|
|
34586
|
+
subProducts: transformEmissionsToBackend(rest.subProducts)
|
|
34585
34587
|
};
|
|
34586
34588
|
}
|
|
34587
34589
|
// Transform an industry config to be backend-compatible
|
|
@@ -34595,7 +34597,9 @@ function transformIndustryConfigToBackend(config) {
|
|
|
34595
34597
|
result.additionalScopes = {};
|
|
34596
34598
|
for (const [key, scopes] of Object.entries(config.additionalScopes)) {
|
|
34597
34599
|
result.additionalScopes[key] = scopes.map(item => ({
|
|
34598
|
-
|
|
34600
|
+
type: item.type,
|
|
34601
|
+
route: item.route,
|
|
34602
|
+
name: item.name,
|
|
34599
34603
|
scope: item.type === 'scope3'
|
|
34600
34604
|
? transformScope3ToBackend(item.scope)
|
|
34601
34605
|
: transformScopeToBackend(item.scope)
|
|
@@ -34604,6 +34608,59 @@ function transformIndustryConfigToBackend(config) {
|
|
|
34604
34608
|
}
|
|
34605
34609
|
return result;
|
|
34606
34610
|
}
|
|
34611
|
+
// Transform product to backend-compatible format
|
|
34612
|
+
function transformProductToBackend(product) {
|
|
34613
|
+
return {
|
|
34614
|
+
name: product.name,
|
|
34615
|
+
unit: product.unit,
|
|
34616
|
+
type: product.type,
|
|
34617
|
+
calorificValue: product.calorificValue,
|
|
34618
|
+
emissionFactor: product.emissionFactor,
|
|
34619
|
+
energyConversionFactor: product.energyConversionFactor
|
|
34620
|
+
};
|
|
34621
|
+
}
|
|
34622
|
+
// Transform emission item to backend-compatible format
|
|
34623
|
+
function transformEmissionItemToBackend(item) {
|
|
34624
|
+
return {
|
|
34625
|
+
item: item.item,
|
|
34626
|
+
emissionFactor: item.emissionFactor,
|
|
34627
|
+
unit: item.unit
|
|
34628
|
+
};
|
|
34629
|
+
}
|
|
34630
|
+
// Transform equipment category to backend-compatible format
|
|
34631
|
+
function transformEquipmentCategoryToBackend(category) {
|
|
34632
|
+
return {
|
|
34633
|
+
category: category.category,
|
|
34634
|
+
items: category.items.map(transformEmissionItemToBackend)
|
|
34635
|
+
};
|
|
34636
|
+
}
|
|
34637
|
+
// Transform emissions array to backend-compatible format
|
|
34638
|
+
function transformEmissionsToBackend(emissions) {
|
|
34639
|
+
return emissions.map(transformEquipmentCategoryToBackend);
|
|
34640
|
+
}
|
|
34641
|
+
// Transform user config to backend-compatible format
|
|
34642
|
+
function transformUserConfigToBackend(userConfig) {
|
|
34643
|
+
const result = {};
|
|
34644
|
+
if (userConfig.scope1) {
|
|
34645
|
+
result.scope1 = Array.isArray(userConfig.scope1)
|
|
34646
|
+
? userConfig.scope1.map(transformScopeToBackend)
|
|
34647
|
+
: [transformScopeToBackend(userConfig.scope1)];
|
|
34648
|
+
}
|
|
34649
|
+
if (userConfig.scope2) {
|
|
34650
|
+
result.scope2 = Array.isArray(userConfig.scope2)
|
|
34651
|
+
? userConfig.scope2.map(transformScopeToBackend)
|
|
34652
|
+
: [transformScopeToBackend(userConfig.scope2)];
|
|
34653
|
+
}
|
|
34654
|
+
if (userConfig.scope3) {
|
|
34655
|
+
result.scope3 = Array.isArray(userConfig.scope3)
|
|
34656
|
+
? userConfig.scope3.map(transformScope3ToBackend)
|
|
34657
|
+
: [transformScope3ToBackend(userConfig.scope3)];
|
|
34658
|
+
}
|
|
34659
|
+
if (userConfig.waterManagement) {
|
|
34660
|
+
result.waterManagement = transformScopeToBackend(userConfig.waterManagement);
|
|
34661
|
+
}
|
|
34662
|
+
return result;
|
|
34663
|
+
}
|
|
34607
34664
|
/**
|
|
34608
34665
|
* Get all configurations for backend consumption without React icons
|
|
34609
34666
|
* This function returns all industry configurations and user configurations
|
|
@@ -34615,10 +34672,77 @@ function getAllConfig() {
|
|
|
34615
34672
|
for (const [industryName, config] of Object.entries(INDUSTRIES_CONFIG)) {
|
|
34616
34673
|
industries[industryName] = transformIndustryConfigToBackend(config);
|
|
34617
34674
|
}
|
|
34675
|
+
// Transform user configs to be backend-compatible
|
|
34676
|
+
const userConfigs = {};
|
|
34677
|
+
for (const [username, config] of Object.entries(USER_CONFIGS)) {
|
|
34678
|
+
userConfigs[username] = transformUserConfigToBackend(config);
|
|
34679
|
+
}
|
|
34618
34680
|
return {
|
|
34619
34681
|
industries,
|
|
34620
|
-
userConfigs
|
|
34682
|
+
userConfigs
|
|
34683
|
+
};
|
|
34684
|
+
}
|
|
34685
|
+
/**
|
|
34686
|
+
* Get user-specific backend configuration by username
|
|
34687
|
+
* @param username - The username to get configuration for
|
|
34688
|
+
* @returns Backend-compatible user configuration or undefined if not found
|
|
34689
|
+
*/
|
|
34690
|
+
function getUserNameBackendConfig(username) {
|
|
34691
|
+
const normalizedUsername = username.toLowerCase().trim();
|
|
34692
|
+
const userConfig = USER_CONFIGS[normalizedUsername];
|
|
34693
|
+
if (!userConfig) {
|
|
34694
|
+
return undefined;
|
|
34695
|
+
}
|
|
34696
|
+
return transformUserConfigToBackend(userConfig);
|
|
34697
|
+
}
|
|
34698
|
+
/**
|
|
34699
|
+
* Get industry-specific backend configuration by industry name
|
|
34700
|
+
* @param industryName - The industry name to get configuration for
|
|
34701
|
+
* @returns Backend-compatible industry configuration or undefined if not found
|
|
34702
|
+
*/
|
|
34703
|
+
function getIndustryBackendConfig(industryName) {
|
|
34704
|
+
const config = INDUSTRIES_CONFIG[industryName];
|
|
34705
|
+
if (!config) {
|
|
34706
|
+
return undefined;
|
|
34707
|
+
}
|
|
34708
|
+
return transformIndustryConfigToBackend(config);
|
|
34709
|
+
}
|
|
34710
|
+
/**
|
|
34711
|
+
* Get combined industry and user configuration for backend consumption
|
|
34712
|
+
* This applies user-specific overrides to industry configuration when available
|
|
34713
|
+
* @param industryName - The industry name
|
|
34714
|
+
* @param username - Optional username for user-specific customizations
|
|
34715
|
+
* @returns Backend-compatible combined configuration
|
|
34716
|
+
*/
|
|
34717
|
+
function getCombinedBackendConfig(industryName, username) {
|
|
34718
|
+
const industryConfig = getIndustryBackendConfig(industryName);
|
|
34719
|
+
if (!industryConfig) {
|
|
34720
|
+
return undefined;
|
|
34721
|
+
}
|
|
34722
|
+
if (!username) {
|
|
34723
|
+
return industryConfig;
|
|
34724
|
+
}
|
|
34725
|
+
const userConfig = getUserNameBackendConfig(username);
|
|
34726
|
+
if (!userConfig) {
|
|
34727
|
+
return industryConfig;
|
|
34728
|
+
}
|
|
34729
|
+
// Merge user config with industry config (user overrides industry)
|
|
34730
|
+
const combined = {
|
|
34731
|
+
scope1: userConfig.scope1 || industryConfig.scope1,
|
|
34732
|
+
scope2: userConfig.scope2 || industryConfig.scope2,
|
|
34733
|
+
scope3: userConfig.scope3 || industryConfig.scope3,
|
|
34734
|
+
additionalScopes: industryConfig.additionalScopes
|
|
34621
34735
|
};
|
|
34736
|
+
// Add user-specific water management if available
|
|
34737
|
+
if (userConfig.waterManagement && combined.additionalScopes) {
|
|
34738
|
+
combined.additionalScopes.waterManagement = [{
|
|
34739
|
+
type: "scope1",
|
|
34740
|
+
route: "/manage/water",
|
|
34741
|
+
name: "Water Management",
|
|
34742
|
+
scope: userConfig.waterManagement
|
|
34743
|
+
}];
|
|
34744
|
+
}
|
|
34745
|
+
return combined;
|
|
34622
34746
|
}
|
|
34623
34747
|
|
|
34624
34748
|
// Default calculation configurations
|
|
@@ -40611,5 +40735,5 @@ var index = /*#__PURE__*/Object.freeze({
|
|
|
40611
40735
|
getIndustryConfig: getIndustryConfig$1
|
|
40612
40736
|
});
|
|
40613
40737
|
|
|
40614
|
-
export { API_ENDPOINTS, API_SCOPE3_CEMENT_CONFIG, BILL_CALCULATION_CONFIGS, BillManager, CCTS_ALLSCOPES_CEMENT, CCTS_CALCINATION_PRODUCTS, CCTS_ELECTRICITY_PRODUCTS, CCTS_FIRE_EXTINGUISHER_PRODUCTS, CCTS_FUEL_COMBUSTION_PRODUCTS, CCTS_LPG_PRODUCTS, CCTS_MINING_OPERATIONS_PRODUCTS, CCTS_ONSITE_POWER_PRODUCTS, CCTS_PURCHASED_ELECTRICITY, CCTS_REFRIGERANTS, CCTS_SCOPE1_CEMENT, CCTS_SCOPE2_CEMENT, CCTS_SF6_PRODUCTS, CCTS_TABLE_COLUMNS, DEFAULT_BILL_MATCHING_CONFIG, EmissionSourceGenerator, FRONTEND_INDUSTRY_CONFIGS, HTTP_STATUS, INDUSTRIES_CONFIG, INDUSTRY_MAPPING, INDUSTRY_SPECIFIC_FIELDS, INTENSITY_FIELD_LABELS, ISO_CATEGORIES_PACKAGING, index as Industries, UI_FEATURES, WATER_PRODUCTS, calculateCCTSEmission, calculateIntensityMetrics, categorizeApiItem, cleanValue, createBillManager, createCapitalizedMonthMapping, createEmissionSourceGenerator, createMonthMapping, debugCarbonIntensityMapping, extractCarbonIntensityData, formatEmissionValue, formatIntensityValue, formatKPIEmission, formatMonthlyEmission, formatPercentage, getAllConfig, getApiIndustryType, getAvailableFieldsForIndustry, getIndustryConfig, getIndustryFieldConfig, getIntensityFormulas, getPlantNameConfig, getScope3ConfigByName, getUserNameScopeConfig, hasIntensities, isUIFeatureEnabled, mapIndustryToApiType, sanitizeNumber, supportsIntensityCalculations, validateCarbonIntensityData };
|
|
40738
|
+
export { API_ENDPOINTS, API_SCOPE3_CEMENT_CONFIG, BILL_CALCULATION_CONFIGS, BillManager, CCTS_ALLSCOPES_CEMENT, CCTS_CALCINATION_PRODUCTS, CCTS_ELECTRICITY_PRODUCTS, CCTS_FIRE_EXTINGUISHER_PRODUCTS, CCTS_FUEL_COMBUSTION_PRODUCTS, CCTS_LPG_PRODUCTS, CCTS_MINING_OPERATIONS_PRODUCTS, CCTS_ONSITE_POWER_PRODUCTS, CCTS_PURCHASED_ELECTRICITY, CCTS_REFRIGERANTS, CCTS_SCOPE1_CEMENT, CCTS_SCOPE2_CEMENT, CCTS_SF6_PRODUCTS, CCTS_TABLE_COLUMNS, DEFAULT_BILL_MATCHING_CONFIG, EmissionSourceGenerator, FRONTEND_INDUSTRY_CONFIGS, HTTP_STATUS, INDUSTRIES_CONFIG, INDUSTRY_MAPPING, INDUSTRY_SPECIFIC_FIELDS, INTENSITY_FIELD_LABELS, ISO_CATEGORIES_PACKAGING, index as Industries, UI_FEATURES, WATER_PRODUCTS, calculateCCTSEmission, calculateIntensityMetrics, categorizeApiItem, cleanValue, createBillManager, createCapitalizedMonthMapping, createEmissionSourceGenerator, createMonthMapping, debugCarbonIntensityMapping, extractCarbonIntensityData, formatEmissionValue, formatIntensityValue, formatKPIEmission, formatMonthlyEmission, formatPercentage, getAllConfig, getApiIndustryType, getAvailableFieldsForIndustry, getCombinedBackendConfig, getIndustryBackendConfig, getIndustryConfig, getIndustryFieldConfig, getIntensityFormulas, getPlantNameConfig, getScope3ConfigByName, getUserNameBackendConfig, getUserNameScopeConfig, hasIntensities, isUIFeatureEnabled, mapIndustryToApiType, sanitizeNumber, supportsIntensityCalculations, validateCarbonIntensityData };
|
|
40615
40739
|
//# sourceMappingURL=index.esm.js.map
|