@zerocarbon/erp-config-sdk 1.0.33 → 1.0.35
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 +37 -3
- package/dist/index.esm.js +100 -5
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +102 -4
- package/dist/index.js.map +1 -1
- package/package.json +3 -2
package/dist/index.d.ts
CHANGED
|
@@ -110,6 +110,7 @@ type VehicleEmissionsResponse = StrapiResponse<VehicleEmissionAttributes>;
|
|
|
110
110
|
interface ProcessedEmissionItem {
|
|
111
111
|
id: string;
|
|
112
112
|
item: string;
|
|
113
|
+
materialCode?: string;
|
|
113
114
|
category: string;
|
|
114
115
|
subCategory?: string;
|
|
115
116
|
mode?: string;
|
|
@@ -153,6 +154,7 @@ interface Bill {
|
|
|
153
154
|
_id?: string;
|
|
154
155
|
user?: string;
|
|
155
156
|
plant?: string;
|
|
157
|
+
plantCode?: string;
|
|
156
158
|
category: string;
|
|
157
159
|
year: number;
|
|
158
160
|
month: number;
|
|
@@ -1050,6 +1052,7 @@ type IndustryConfigWithRCO = IndustryConfig & {
|
|
|
1050
1052
|
declare const getIndustryConfig$1: (industry: string, username?: string) => IndustryConfigWithRCO;
|
|
1051
1053
|
type Product = {
|
|
1052
1054
|
name: string;
|
|
1055
|
+
materialCode?: string;
|
|
1053
1056
|
unit: string;
|
|
1054
1057
|
type: string;
|
|
1055
1058
|
calorificValue: number;
|
|
@@ -1068,6 +1071,7 @@ type Scope = {
|
|
|
1068
1071
|
};
|
|
1069
1072
|
type EmissionItem$k = {
|
|
1070
1073
|
item: string;
|
|
1074
|
+
materialCode?: string;
|
|
1071
1075
|
emissionFactor: number;
|
|
1072
1076
|
unit: string;
|
|
1073
1077
|
};
|
|
@@ -1087,6 +1091,7 @@ type Scope3Item$2 = {
|
|
|
1087
1091
|
};
|
|
1088
1092
|
type BackendProduct = {
|
|
1089
1093
|
name: string;
|
|
1094
|
+
materialCode?: string;
|
|
1090
1095
|
unit: string;
|
|
1091
1096
|
type: string;
|
|
1092
1097
|
calorificValue: number;
|
|
@@ -1095,6 +1100,7 @@ type BackendProduct = {
|
|
|
1095
1100
|
};
|
|
1096
1101
|
type BackendEmissionItem = {
|
|
1097
1102
|
item: string;
|
|
1103
|
+
materialCode?: string;
|
|
1098
1104
|
emissionFactor: number;
|
|
1099
1105
|
unit: string;
|
|
1100
1106
|
};
|
|
@@ -1188,6 +1194,7 @@ interface BillFilterOptions {
|
|
|
1188
1194
|
subCategory?: string;
|
|
1189
1195
|
nestedSubCategory?: string;
|
|
1190
1196
|
plant?: string;
|
|
1197
|
+
plantCode?: string;
|
|
1191
1198
|
}
|
|
1192
1199
|
interface BillCalculationConfig {
|
|
1193
1200
|
industry: string;
|
|
@@ -1256,6 +1263,7 @@ declare const formatKPIEmission: (value: number) => string;
|
|
|
1256
1263
|
interface EmissionSource {
|
|
1257
1264
|
id: string;
|
|
1258
1265
|
itemName: string;
|
|
1266
|
+
materialCode?: string;
|
|
1259
1267
|
category: string;
|
|
1260
1268
|
subcategory: string;
|
|
1261
1269
|
emissionFactor: number;
|
|
@@ -1273,6 +1281,7 @@ interface EmissionSource {
|
|
|
1273
1281
|
}
|
|
1274
1282
|
interface ScopeProduct {
|
|
1275
1283
|
name: string;
|
|
1284
|
+
materialCode?: string;
|
|
1276
1285
|
displayName?: string;
|
|
1277
1286
|
type?: string;
|
|
1278
1287
|
unit?: string;
|
|
@@ -1280,6 +1289,7 @@ interface ScopeProduct {
|
|
|
1280
1289
|
emissionFactor?: number;
|
|
1281
1290
|
items?: Array<{
|
|
1282
1291
|
item: string;
|
|
1292
|
+
materialCode?: string;
|
|
1283
1293
|
emissionFactor: number;
|
|
1284
1294
|
unit: string;
|
|
1285
1295
|
requiresMassData?: boolean;
|
|
@@ -1320,11 +1330,12 @@ declare const getApiIndustryType: (erpIndustry: string) => IndustryType;
|
|
|
1320
1330
|
|
|
1321
1331
|
declare const normalizeConfigText: (value: unknown) => string;
|
|
1322
1332
|
declare const normalizeConfigKeyText: (value: unknown) => string;
|
|
1323
|
-
declare const buildUserConfigItemKey: ({ scope, category, subCategory, itemName, }: {
|
|
1333
|
+
declare const buildUserConfigItemKey: ({ scope, category, subCategory, itemName, materialCode, }: {
|
|
1324
1334
|
scope?: unknown;
|
|
1325
1335
|
category?: unknown;
|
|
1326
1336
|
subCategory?: unknown;
|
|
1327
1337
|
itemName?: unknown;
|
|
1338
|
+
materialCode?: unknown;
|
|
1328
1339
|
}) => string;
|
|
1329
1340
|
declare const sameUserConfigText: (left: unknown, right: unknown) => boolean;
|
|
1330
1341
|
|
|
@@ -1352,6 +1363,7 @@ type UserConfigItem = {
|
|
|
1352
1363
|
category: string;
|
|
1353
1364
|
subCategory: string;
|
|
1354
1365
|
itemName: string;
|
|
1366
|
+
materialCode?: string;
|
|
1355
1367
|
unit: string;
|
|
1356
1368
|
emissionFactor: number;
|
|
1357
1369
|
emissionFactorSource?: {
|
|
@@ -1368,6 +1380,8 @@ type UserConfigItem = {
|
|
|
1368
1380
|
baseEmissionFactor?: number;
|
|
1369
1381
|
overrideKind?: "custom-item" | "sdk-emission-factor" | string;
|
|
1370
1382
|
isOverride?: boolean;
|
|
1383
|
+
sourceSystem?: string;
|
|
1384
|
+
sourceUnit?: string;
|
|
1371
1385
|
source?: string;
|
|
1372
1386
|
};
|
|
1373
1387
|
type UserEmissionFactorResolution = Partial<UserConfigItem> & {
|
|
@@ -2041,6 +2055,26 @@ declare const UI_FEATURES: {
|
|
|
2041
2055
|
*/
|
|
2042
2056
|
declare const isUIFeatureEnabled: (featureConstant: string, username?: string) => boolean;
|
|
2043
2057
|
|
|
2058
|
+
type WaterFieldType = "number" | "currency" | "percentage" | "boolean" | "composite" | "text";
|
|
2059
|
+
type WaterMetricItem = {
|
|
2060
|
+
key: string;
|
|
2061
|
+
label: string;
|
|
2062
|
+
unit: string;
|
|
2063
|
+
fieldType: WaterFieldType;
|
|
2064
|
+
acceptsBillAmount: boolean;
|
|
2065
|
+
acceptsSupportingDocs: boolean;
|
|
2066
|
+
aliases?: string[];
|
|
2067
|
+
};
|
|
2068
|
+
type WaterMetricCategory = {
|
|
2069
|
+
key: string;
|
|
2070
|
+
label: string;
|
|
2071
|
+
sourceSheet: string;
|
|
2072
|
+
items: WaterMetricItem[];
|
|
2073
|
+
};
|
|
2074
|
+
declare const WATER_MANAGEMENT_CATEGORIES: WaterMetricCategory[];
|
|
2075
|
+
declare const WATER_MANAGEMENT_CATEGORY_KEYS: string[];
|
|
2076
|
+
declare const WATER_MANAGEMENT_ITEM_KEYS: string[];
|
|
2077
|
+
|
|
2044
2078
|
declare const ELECTRIC_PRODUCTS$5: {
|
|
2045
2079
|
name: string;
|
|
2046
2080
|
unit: string;
|
|
@@ -6545,5 +6579,5 @@ declare namespace index {
|
|
|
6545
6579
|
};
|
|
6546
6580
|
}
|
|
6547
6581
|
|
|
6548
|
-
export { ALL_SCOPES_3_RCO, API_ENDPOINTS, API_SCOPE3_CEMENT_CONFIG, BILL_CALCULATION_CONFIGS, BULK_BILL_AGENT_PROFILES, 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$5 as WATER_PRODUCTS, addItemForUser, buildBulkBillAgentFinalizerPrompt, buildBulkBillAgentPromptConfig, buildBulkBillAgentRouterPrompt, buildBulkBillAgentSystemPrompt, buildBulkBillAgentWorkerPrompt, buildUserConfigItemKey, calculateCCTSEmission, calculateIntensityMetrics, categorizeApiItem, cleanValue, createBillManager, createCapitalizedMonthMapping, createEmissionSourceGenerator, createMonthMapping, debugCarbonIntensityMapping, extractBulkBillAgentProfileCandidates, extractCarbonIntensityData, formatEmissionValue, formatIntensityValue, formatKPIEmission, formatMonthlyEmission, formatPercentage, getAllConfig, getApiIndustryType, getAvailableFieldsForIndustry, getBulkBillAgentProfile, getBulkBillAgentProfilesForMappingContext, getCombinedBackendConfig, getIndustryBackendConfig, getIndustryConfig$1 as getIndustryConfig, getIndustryFieldConfig, getIntensityFormulas, getItemsForUser, getPlantNameConfig, getPrimaryBulkBillAgentProfile, getRCOConfigByName, getScope3ConfigByName, getUserNameBackendConfig, getUserNameScopeConfig, hasIntensities, isUIFeatureEnabled, listBulkBillAgentProfiles, mapIndustryToApiType, mergeUserItemsIntoIndustryConfig, normalizeConfigKeyText, normalizeConfigText, resolveEmissionFactorsForUser, sameUserConfigText, sanitizeNumber, scoreBulkBillAgentProfile, supportsIntensityCalculations, updateItemEmissionFactorForUser, updateSdkItemEmissionFactorForUser, validateCarbonIntensityData };
|
|
6549
|
-
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, BulkBillAgentAllowedItem, BulkBillAgentMappingContext, BulkBillAgentProfile, BulkBillAgentProfileCandidate, BulkBillAgentProfileExtractionInput, BulkBillAgentProfileGroup, BulkBillAgentProfileId, BulkBillAgentProfilePage, BulkBillAgentPromptConfig, BulkBillAgentWorkerPromptInput, BusinessTravelEmission, BusinessTravelEmissionAttributes, BusinessTravelEmissionsResponse, BillsAnalyzed$1 as CarbonIntensityBillsAnalyzed, Calculations$1 as CarbonIntensityCalculations, EmissionData$2 as CarbonIntensityEmissionData, ErrorResponse$1 as CarbonIntensityErrorResponse, CarbonIntensityRequest, CarbonIntensityResponse, ChemicalRequest, ChemicalResponse, CreateBillOptions, DetailedCarbonIntensityResponse, EditableItem, EmissionData$3 as EmissionData, EmissionSource, Emissions$j as Emissions, EmissionsDataAttributes, EmissionsDataResponse, FieldConfig, FoodBeveragesRequest, FoodBeveragesResponse, FormData, FormValidationResult, FrontendIndustryConfig, HospitalityRequest, HospitalityResponse, IndustryConfig$1 as 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, UserConfigApiClient, UserConfigItem, UserData, UserEmissionFactorApprovalResponse, UserEmissionFactorResolution, UtilitiesRequest, UtilitiesResponse, ValidationError, VehicleEmission, VehicleEmissionAttributes, VehicleEmissionsResponse };
|
|
6582
|
+
export { ALL_SCOPES_3_RCO, API_ENDPOINTS, API_SCOPE3_CEMENT_CONFIG, BILL_CALCULATION_CONFIGS, BULK_BILL_AGENT_PROFILES, 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_MANAGEMENT_CATEGORIES, WATER_MANAGEMENT_CATEGORY_KEYS, WATER_MANAGEMENT_ITEM_KEYS, WATER_PRODUCTS$5 as WATER_PRODUCTS, addItemForUser, buildBulkBillAgentFinalizerPrompt, buildBulkBillAgentPromptConfig, buildBulkBillAgentRouterPrompt, buildBulkBillAgentSystemPrompt, buildBulkBillAgentWorkerPrompt, buildUserConfigItemKey, calculateCCTSEmission, calculateIntensityMetrics, categorizeApiItem, cleanValue, createBillManager, createCapitalizedMonthMapping, createEmissionSourceGenerator, createMonthMapping, debugCarbonIntensityMapping, extractBulkBillAgentProfileCandidates, extractCarbonIntensityData, formatEmissionValue, formatIntensityValue, formatKPIEmission, formatMonthlyEmission, formatPercentage, getAllConfig, getApiIndustryType, getAvailableFieldsForIndustry, getBulkBillAgentProfile, getBulkBillAgentProfilesForMappingContext, getCombinedBackendConfig, getIndustryBackendConfig, getIndustryConfig$1 as getIndustryConfig, getIndustryFieldConfig, getIntensityFormulas, getItemsForUser, getPlantNameConfig, getPrimaryBulkBillAgentProfile, getRCOConfigByName, getScope3ConfigByName, getUserNameBackendConfig, getUserNameScopeConfig, hasIntensities, isUIFeatureEnabled, listBulkBillAgentProfiles, mapIndustryToApiType, mergeUserItemsIntoIndustryConfig, normalizeConfigKeyText, normalizeConfigText, resolveEmissionFactorsForUser, sameUserConfigText, sanitizeNumber, scoreBulkBillAgentProfile, supportsIntensityCalculations, updateItemEmissionFactorForUser, updateSdkItemEmissionFactorForUser, validateCarbonIntensityData };
|
|
6583
|
+
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, BulkBillAgentAllowedItem, BulkBillAgentMappingContext, BulkBillAgentProfile, BulkBillAgentProfileCandidate, BulkBillAgentProfileExtractionInput, BulkBillAgentProfileGroup, BulkBillAgentProfileId, BulkBillAgentProfilePage, BulkBillAgentPromptConfig, BulkBillAgentWorkerPromptInput, BusinessTravelEmission, BusinessTravelEmissionAttributes, BusinessTravelEmissionsResponse, BillsAnalyzed$1 as CarbonIntensityBillsAnalyzed, Calculations$1 as CarbonIntensityCalculations, EmissionData$2 as CarbonIntensityEmissionData, ErrorResponse$1 as CarbonIntensityErrorResponse, CarbonIntensityRequest, CarbonIntensityResponse, ChemicalRequest, ChemicalResponse, CreateBillOptions, DetailedCarbonIntensityResponse, EditableItem, EmissionData$3 as EmissionData, EmissionSource, Emissions$j as Emissions, EmissionsDataAttributes, EmissionsDataResponse, FieldConfig, FoodBeveragesRequest, FoodBeveragesResponse, FormData, FormValidationResult, FrontendIndustryConfig, HospitalityRequest, HospitalityResponse, IndustryConfig$1 as 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, UserConfigApiClient, UserConfigItem, UserData, UserEmissionFactorApprovalResponse, UserEmissionFactorResolution, UtilitiesRequest, UtilitiesResponse, ValidationError, VehicleEmission, VehicleEmissionAttributes, VehicleEmissionsResponse, WaterFieldType, WaterMetricCategory, WaterMetricItem };
|
package/dist/index.esm.js
CHANGED
|
@@ -38644,6 +38644,7 @@ function transformIndustryConfigToBackend(config) {
|
|
|
38644
38644
|
function transformProductToBackend(product) {
|
|
38645
38645
|
return {
|
|
38646
38646
|
name: product.name,
|
|
38647
|
+
materialCode: product.materialCode,
|
|
38647
38648
|
unit: product.unit,
|
|
38648
38649
|
type: product.type,
|
|
38649
38650
|
calorificValue: product.calorificValue,
|
|
@@ -38655,6 +38656,7 @@ function transformProductToBackend(product) {
|
|
|
38655
38656
|
function transformEmissionItemToBackend(item) {
|
|
38656
38657
|
return {
|
|
38657
38658
|
item: item.item,
|
|
38659
|
+
materialCode: item.materialCode,
|
|
38658
38660
|
emissionFactor: item.emissionFactor,
|
|
38659
38661
|
unit: item.unit
|
|
38660
38662
|
};
|
|
@@ -38844,6 +38846,7 @@ class BillManager {
|
|
|
38844
38846
|
this.matchField(bill.subCategory, options.subCategory, "subCategory");
|
|
38845
38847
|
const matchesNestedSubCategory = !options.nestedSubCategory ||
|
|
38846
38848
|
this.matchField(bill.nestedSubCategory, options.nestedSubCategory, "nestedSubCategory");
|
|
38849
|
+
const matchesPlantCode = !options.plantCode || bill.plantCode === options.plantCode;
|
|
38847
38850
|
const matchesPlant = !options.plant || bill.plant === options.plant;
|
|
38848
38851
|
return (matchesCategory &&
|
|
38849
38852
|
matchesYear &&
|
|
@@ -38851,6 +38854,7 @@ class BillManager {
|
|
|
38851
38854
|
matchesType &&
|
|
38852
38855
|
matchesSubCategory &&
|
|
38853
38856
|
matchesNestedSubCategory &&
|
|
38857
|
+
matchesPlantCode &&
|
|
38854
38858
|
matchesPlant);
|
|
38855
38859
|
});
|
|
38856
38860
|
}
|
|
@@ -38884,7 +38888,7 @@ class BillManager {
|
|
|
38884
38888
|
bill.nestedSubCategory === emissionItem.item &&
|
|
38885
38889
|
bill.subCategory ===
|
|
38886
38890
|
(emissionItem.subCategory || emissionItem.category) &&
|
|
38887
|
-
(!plantId || bill.plant === plantId) // Filter by plant if provided
|
|
38891
|
+
(!plantId || bill.plant === plantId || bill.plantCode === plantId) // Filter by plant if provided
|
|
38888
38892
|
);
|
|
38889
38893
|
// NO fallback matching - each emission item should have its own unique bill
|
|
38890
38894
|
return matchingBills;
|
|
@@ -39117,6 +39121,7 @@ class EmissionSourceGenerator {
|
|
|
39117
39121
|
sources.push({
|
|
39118
39122
|
id: sourceId,
|
|
39119
39123
|
itemName: subProduct.name,
|
|
39124
|
+
materialCode: subProduct.materialCode,
|
|
39120
39125
|
category: scopeConfig.name,
|
|
39121
39126
|
subcategory: subProduct.type || "N/A",
|
|
39122
39127
|
emissionFactor: subProduct.emissionFactor || 0,
|
|
@@ -39154,6 +39159,7 @@ class EmissionSourceGenerator {
|
|
|
39154
39159
|
sources.push({
|
|
39155
39160
|
id: sourceId,
|
|
39156
39161
|
itemName: apiItem.item,
|
|
39162
|
+
materialCode: apiItem.materialCode,
|
|
39157
39163
|
category: scopeConfig.name,
|
|
39158
39164
|
subcategory: apiItem.subCategory || apiItem.category,
|
|
39159
39165
|
emissionFactor: apiItem.emissionFactor,
|
|
@@ -39198,6 +39204,7 @@ class EmissionSourceGenerator {
|
|
|
39198
39204
|
sources.push({
|
|
39199
39205
|
id: sourceId,
|
|
39200
39206
|
itemName: item.item,
|
|
39207
|
+
materialCode: item.materialCode,
|
|
39201
39208
|
category: subProduct.name || scopeConfig.name,
|
|
39202
39209
|
subcategory: item.item,
|
|
39203
39210
|
emissionFactor: item.emissionFactor,
|
|
@@ -39296,7 +39303,15 @@ const normalizeConfigKeyText = (value) => normalizeConfigText(value)
|
|
|
39296
39303
|
.toLowerCase()
|
|
39297
39304
|
.replace(/[^a-z0-9]+/g, " ")
|
|
39298
39305
|
.trim();
|
|
39299
|
-
const buildUserConfigItemKey = ({ scope, category, subCategory, itemName, }) => [
|
|
39306
|
+
const buildUserConfigItemKey = ({ scope, category, subCategory, itemName, materialCode, }) => [
|
|
39307
|
+
scope,
|
|
39308
|
+
category,
|
|
39309
|
+
subCategory,
|
|
39310
|
+
itemName,
|
|
39311
|
+
...(materialCode ? [materialCode] : []),
|
|
39312
|
+
]
|
|
39313
|
+
.map(normalizeConfigKeyText)
|
|
39314
|
+
.join("|");
|
|
39300
39315
|
const sameUserConfigText = (left, right) => normalizeConfigKeyText(left) === normalizeConfigKeyText(right);
|
|
39301
39316
|
|
|
39302
39317
|
const itemMeta = (item) => ({
|
|
@@ -39306,14 +39321,20 @@ const itemMeta = (item) => ({
|
|
|
39306
39321
|
isCompanyOverride: item.source === "sdk-override" || item.isOverride,
|
|
39307
39322
|
baseEmissionFactor: item.baseEmissionFactor,
|
|
39308
39323
|
overrideKind: item.overrideKind,
|
|
39324
|
+
materialCode: item.materialCode,
|
|
39325
|
+
sourceSystem: item.sourceSystem,
|
|
39326
|
+
sourceUnit: item.sourceUnit,
|
|
39309
39327
|
});
|
|
39328
|
+
const sameMaterialIdentity = (entry, item) => item.materialCode
|
|
39329
|
+
? sameUserConfigText(entry.materialCode, item.materialCode)
|
|
39330
|
+
: !entry.materialCode;
|
|
39310
39331
|
const applyScope3Item = (config, item) => {
|
|
39311
39332
|
var _a;
|
|
39312
39333
|
const scope = config.scope3.find((entry) => sameUserConfigText(entry.name, item.category));
|
|
39313
39334
|
const group = scope === null || scope === void 0 ? void 0 : scope.subProducts.find((entry) => sameUserConfigText(entry.category, item.subCategory));
|
|
39314
39335
|
if (!group)
|
|
39315
39336
|
return;
|
|
39316
|
-
const existing = group.items.find((entry) => sameUserConfigText(entry.item, item.itemName));
|
|
39337
|
+
const existing = group.items.find((entry) => sameUserConfigText(entry.item, item.itemName) && sameMaterialIdentity(entry, item));
|
|
39317
39338
|
if (existing) {
|
|
39318
39339
|
Object.assign(existing, {
|
|
39319
39340
|
emissionFactor: item.emissionFactor,
|
|
@@ -39337,7 +39358,8 @@ const applyFlatItem = (config, item) => {
|
|
|
39337
39358
|
if (!scope)
|
|
39338
39359
|
return;
|
|
39339
39360
|
const existing = scope.subProducts.find((entry) => sameUserConfigText(entry.name, item.itemName) &&
|
|
39340
|
-
sameUserConfigText(entry.type, item.subCategory)
|
|
39361
|
+
sameUserConfigText(entry.type, item.subCategory) &&
|
|
39362
|
+
sameMaterialIdentity(entry, item));
|
|
39341
39363
|
if (existing) {
|
|
39342
39364
|
Object.assign(existing, {
|
|
39343
39365
|
emissionFactor: item.emissionFactor,
|
|
@@ -43531,6 +43553,79 @@ const isUIFeatureEnabled = (featureConstant, username) => {
|
|
|
43531
43553
|
],
|
|
43532
43554
|
});
|
|
43533
43555
|
|
|
43556
|
+
const WATER_MANAGEMENT_CATEGORIES = [
|
|
43557
|
+
{
|
|
43558
|
+
key: "water-consumption",
|
|
43559
|
+
label: "Water Consumption",
|
|
43560
|
+
sourceSheet: "Water Consumption",
|
|
43561
|
+
items: [
|
|
43562
|
+
{ key: "total-water-withdrawal", label: "Total water withdrawal", unit: "m³", fieldType: "number", acceptsBillAmount: true, acceptsSupportingDocs: true, aliases: ["water withdrawal", "total withdrawal"] },
|
|
43563
|
+
{ key: "groundwater-withdrawal", label: "Groundwater withdrawal", unit: "m³", fieldType: "number", acceptsBillAmount: true, acceptsSupportingDocs: true, aliases: ["ground water withdrawal", "borewell water"] },
|
|
43564
|
+
{ key: "municipal-water-consumption", label: "Municipal water consumption", unit: "m³", fieldType: "number", acceptsBillAmount: true, acceptsSupportingDocs: true, aliases: ["municipal water", "third party water"] },
|
|
43565
|
+
{ key: "surface-water-consumption", label: "Surface water consumption", unit: "m³", fieldType: "number", acceptsBillAmount: true, acceptsSupportingDocs: true, aliases: ["surface water"] },
|
|
43566
|
+
{ key: "rainwater-harvested", label: "Rainwater harvested", unit: "m³", fieldType: "number", acceptsBillAmount: true, acceptsSupportingDocs: true, aliases: ["rain water harvested", "rainwater harvesting"] },
|
|
43567
|
+
{ key: "total-water-consumed", label: "Total water consumed", unit: "m³", fieldType: "number", acceptsBillAmount: true, acceptsSupportingDocs: true, aliases: ["water consumed", "water consumption"] },
|
|
43568
|
+
],
|
|
43569
|
+
},
|
|
43570
|
+
{
|
|
43571
|
+
key: "water-discharge",
|
|
43572
|
+
label: "Water Discharge",
|
|
43573
|
+
sourceSheet: "Water Discharge",
|
|
43574
|
+
items: [
|
|
43575
|
+
{ key: "wastewater-generated", label: "Wastewater generated", unit: "m³", fieldType: "number", acceptsBillAmount: true, acceptsSupportingDocs: true, aliases: ["waste water generated", "effluent generated"] },
|
|
43576
|
+
{ key: "wastewater-treated", label: "Wastewater treated", unit: "m³", fieldType: "number", acceptsBillAmount: true, acceptsSupportingDocs: true, aliases: ["waste water treated", "treated effluent"] },
|
|
43577
|
+
{ key: "wastewater-discharged", label: "Wastewater discharged", unit: "m³", fieldType: "number", acceptsBillAmount: true, acceptsSupportingDocs: true, aliases: ["waste water discharged", "effluent discharged"] },
|
|
43578
|
+
],
|
|
43579
|
+
},
|
|
43580
|
+
{
|
|
43581
|
+
key: "water-circularity",
|
|
43582
|
+
label: "Water Circularity",
|
|
43583
|
+
sourceSheet: "Water Circularity",
|
|
43584
|
+
items: [
|
|
43585
|
+
{ key: "water-recycled-reused", label: "Water recycled/reused", unit: "m³", fieldType: "number", acceptsBillAmount: true, acceptsSupportingDocs: true, aliases: ["recycled water", "reused water"] },
|
|
43586
|
+
{ key: "water-reuse-rate", label: "Water reuse rate", unit: "%", fieldType: "percentage", acceptsBillAmount: false, acceptsSupportingDocs: true },
|
|
43587
|
+
{ key: "rainwater-harvesting-contribution", label: "Rainwater harvesting contribution", unit: "%", fieldType: "percentage", acceptsBillAmount: false, acceptsSupportingDocs: true },
|
|
43588
|
+
],
|
|
43589
|
+
},
|
|
43590
|
+
{
|
|
43591
|
+
key: "water-intensity-metrics",
|
|
43592
|
+
label: "Water Intensity Metrics",
|
|
43593
|
+
sourceSheet: "Water Intensity Metrics",
|
|
43594
|
+
items: [
|
|
43595
|
+
{ key: "water-consumption-per-tonne-product", label: "Water consumption per tonne of product", unit: "m³/t", fieldType: "number", acceptsBillAmount: false, acceptsSupportingDocs: true },
|
|
43596
|
+
{ key: "water-consumption-per-unit-produced", label: "Water consumption per unit produced", unit: "m³/unit", fieldType: "number", acceptsBillAmount: false, acceptsSupportingDocs: true },
|
|
43597
|
+
{ key: "water-consumption-per-crore-revenue", label: "Water consumption per ₹ crore revenue", unit: "m³/₹ crore", fieldType: "number", acceptsBillAmount: false, acceptsSupportingDocs: true },
|
|
43598
|
+
],
|
|
43599
|
+
},
|
|
43600
|
+
{
|
|
43601
|
+
key: "water-risk-stewardship",
|
|
43602
|
+
label: "Water Risk and Stewardship",
|
|
43603
|
+
sourceSheet: "Water Risk and Stewardship",
|
|
43604
|
+
items: [
|
|
43605
|
+
{ key: "sites-water-stressed-regions", label: "Sites located in water-stressed regions", unit: "Number/%", fieldType: "composite", acceptsBillAmount: false, acceptsSupportingDocs: true },
|
|
43606
|
+
{ key: "water-risk-assessment-conducted", label: "Water risk assessment conducted", unit: "Yes/No", fieldType: "boolean", acceptsBillAmount: false, acceptsSupportingDocs: true },
|
|
43607
|
+
{ key: "water-reduction-target", label: "Water reduction target", unit: "%", fieldType: "percentage", acceptsBillAmount: false, acceptsSupportingDocs: true },
|
|
43608
|
+
{ key: "water-stewardship-programme", label: "Water stewardship programme", unit: "Yes/No", fieldType: "boolean", acceptsBillAmount: false, acceptsSupportingDocs: true },
|
|
43609
|
+
{ key: "watershed-restoration-initiatives", label: "Watershed restoration initiatives", unit: "Yes/No", fieldType: "boolean", acceptsBillAmount: false, acceptsSupportingDocs: true },
|
|
43610
|
+
{ key: "community-water-projects", label: "Community water projects", unit: "Number/Investment", fieldType: "composite", acceptsBillAmount: true, acceptsSupportingDocs: true },
|
|
43611
|
+
],
|
|
43612
|
+
},
|
|
43613
|
+
{
|
|
43614
|
+
key: "compliance-governance",
|
|
43615
|
+
label: "Compliance and Governance",
|
|
43616
|
+
sourceSheet: "SheetCompliance and Governance6",
|
|
43617
|
+
items: [
|
|
43618
|
+
{ key: "water-permits-available", label: "Water permits available", unit: "Yes/No", fieldType: "boolean", acceptsBillAmount: false, acceptsSupportingDocs: true },
|
|
43619
|
+
{ key: "water-environmental-violations", label: "Water-related environmental violations", unit: "Number", fieldType: "number", acceptsBillAmount: false, acceptsSupportingDocs: true },
|
|
43620
|
+
{ key: "water-related-fines", label: "Water-related fines", unit: "₹", fieldType: "currency", acceptsBillAmount: true, acceptsSupportingDocs: true },
|
|
43621
|
+
{ key: "board-oversight-water-issues", label: "Board oversight of water issues", unit: "Yes/No", fieldType: "boolean", acceptsBillAmount: false, acceptsSupportingDocs: true },
|
|
43622
|
+
{ key: "water-management-policy", label: "Water management policy", unit: "Yes/No", fieldType: "boolean", acceptsBillAmount: false, acceptsSupportingDocs: true },
|
|
43623
|
+
],
|
|
43624
|
+
},
|
|
43625
|
+
];
|
|
43626
|
+
const WATER_MANAGEMENT_CATEGORY_KEYS = WATER_MANAGEMENT_CATEGORIES.map((category) => category.key);
|
|
43627
|
+
const WATER_MANAGEMENT_ITEM_KEYS = WATER_MANAGEMENT_CATEGORIES.flatMap((category) => category.items.map((item) => item.key));
|
|
43628
|
+
|
|
43534
43629
|
const ELECTRIC_PRODUCTS = [
|
|
43535
43630
|
// Scope 1 - Direct Emissions
|
|
43536
43631
|
{
|
|
@@ -45212,5 +45307,5 @@ var index = /*#__PURE__*/Object.freeze({
|
|
|
45212
45307
|
getRCOConfigByName: getRCOConfigByName
|
|
45213
45308
|
});
|
|
45214
45309
|
|
|
45215
|
-
export { ALL_SCOPES_3_RCO, API_ENDPOINTS, API_SCOPE3_CEMENT_CONFIG, BILL_CALCULATION_CONFIGS, BULK_BILL_AGENT_PROFILES, 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$2 as WATER_PRODUCTS, addItemForUser, buildBulkBillAgentFinalizerPrompt, buildBulkBillAgentPromptConfig, buildBulkBillAgentRouterPrompt, buildBulkBillAgentSystemPrompt, buildBulkBillAgentWorkerPrompt, buildUserConfigItemKey, calculateCCTSEmission, calculateIntensityMetrics, categorizeApiItem, cleanValue, createBillManager, createCapitalizedMonthMapping, createEmissionSourceGenerator, createMonthMapping, debugCarbonIntensityMapping, extractBulkBillAgentProfileCandidates, extractCarbonIntensityData, formatEmissionValue, formatIntensityValue, formatKPIEmission, formatMonthlyEmission, formatPercentage, getAllConfig, getApiIndustryType, getAvailableFieldsForIndustry, getBulkBillAgentProfile, getBulkBillAgentProfilesForMappingContext, getCombinedBackendConfig, getIndustryBackendConfig, getIndustryConfig, getIndustryFieldConfig, getIntensityFormulas, getItemsForUser, getPlantNameConfig, getPrimaryBulkBillAgentProfile, getRCOConfigByName, getScope3ConfigByName, getUserNameBackendConfig, getUserNameScopeConfig, hasIntensities, isUIFeatureEnabled, listBulkBillAgentProfiles, mapIndustryToApiType, mergeUserItemsIntoIndustryConfig, normalizeConfigKeyText, normalizeConfigText, resolveEmissionFactorsForUser, sameUserConfigText, sanitizeNumber, scoreBulkBillAgentProfile, supportsIntensityCalculations, updateItemEmissionFactorForUser, updateSdkItemEmissionFactorForUser, validateCarbonIntensityData };
|
|
45310
|
+
export { ALL_SCOPES_3_RCO, API_ENDPOINTS, API_SCOPE3_CEMENT_CONFIG, BILL_CALCULATION_CONFIGS, BULK_BILL_AGENT_PROFILES, 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_MANAGEMENT_CATEGORIES, WATER_MANAGEMENT_CATEGORY_KEYS, WATER_MANAGEMENT_ITEM_KEYS, WATER_PRODUCTS$2 as WATER_PRODUCTS, addItemForUser, buildBulkBillAgentFinalizerPrompt, buildBulkBillAgentPromptConfig, buildBulkBillAgentRouterPrompt, buildBulkBillAgentSystemPrompt, buildBulkBillAgentWorkerPrompt, buildUserConfigItemKey, calculateCCTSEmission, calculateIntensityMetrics, categorizeApiItem, cleanValue, createBillManager, createCapitalizedMonthMapping, createEmissionSourceGenerator, createMonthMapping, debugCarbonIntensityMapping, extractBulkBillAgentProfileCandidates, extractCarbonIntensityData, formatEmissionValue, formatIntensityValue, formatKPIEmission, formatMonthlyEmission, formatPercentage, getAllConfig, getApiIndustryType, getAvailableFieldsForIndustry, getBulkBillAgentProfile, getBulkBillAgentProfilesForMappingContext, getCombinedBackendConfig, getIndustryBackendConfig, getIndustryConfig, getIndustryFieldConfig, getIntensityFormulas, getItemsForUser, getPlantNameConfig, getPrimaryBulkBillAgentProfile, getRCOConfigByName, getScope3ConfigByName, getUserNameBackendConfig, getUserNameScopeConfig, hasIntensities, isUIFeatureEnabled, listBulkBillAgentProfiles, mapIndustryToApiType, mergeUserItemsIntoIndustryConfig, normalizeConfigKeyText, normalizeConfigText, resolveEmissionFactorsForUser, sameUserConfigText, sanitizeNumber, scoreBulkBillAgentProfile, supportsIntensityCalculations, updateItemEmissionFactorForUser, updateSdkItemEmissionFactorForUser, validateCarbonIntensityData };
|
|
45216
45311
|
//# sourceMappingURL=index.esm.js.map
|