@zerocarbon/erp-config-sdk 1.0.32 → 1.0.34
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 +30 -3
- package/dist/index.esm.js +87 -3
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +89 -2
- package/dist/index.js.map +1 -1
- package/package.json +4 -2
package/dist/index.js
CHANGED
|
@@ -38892,7 +38892,7 @@ class BillManager {
|
|
|
38892
38892
|
return matchingBills;
|
|
38893
38893
|
}
|
|
38894
38894
|
// Create a bill object with proper calculation
|
|
38895
|
-
createBill(userId, category, activityData, emissionItem, year, month, scope, industry = "cement", vendorConfig, massData, plantId) {
|
|
38895
|
+
createBill(userId, category, activityData, emissionItem, year, month, scope, industry = "cement", vendorConfig, massData, plantId, options = {}) {
|
|
38896
38896
|
const calculationConfig = this.getCalculationConfig(industry, scope, category);
|
|
38897
38897
|
const amountCalculated = this.calculateEmissions(activityData, emissionItem.emissionFactor, calculationConfig, massData);
|
|
38898
38898
|
const multiplicationFactor = this.getMultiplicationFactor(emissionItem.emissionFactor, calculationConfig);
|
|
@@ -38909,8 +38909,12 @@ class BillManager {
|
|
|
38909
38909
|
nestedSubCategory: emissionItem.item,
|
|
38910
38910
|
amountCalculated: amountCalculated,
|
|
38911
38911
|
multiplicationFactor: multiplicationFactor,
|
|
38912
|
+
billAmount: sanitizeNumber(options.billAmount),
|
|
38912
38913
|
massData: massData,
|
|
38913
|
-
config:
|
|
38914
|
+
config: {
|
|
38915
|
+
...(vendorConfig || {}),
|
|
38916
|
+
...(options.config || {}),
|
|
38917
|
+
},
|
|
38914
38918
|
};
|
|
38915
38919
|
}
|
|
38916
38920
|
// Get calculation configuration for specific context
|
|
@@ -39087,6 +39091,7 @@ const formatKPIEmission = (value) => {
|
|
|
39087
39091
|
}
|
|
39088
39092
|
};
|
|
39089
39093
|
|
|
39094
|
+
const sumBillAmounts = (bills) => bills.reduce((sum, bill) => sum + sanitizeNumber(bill.billAmount), 0);
|
|
39090
39095
|
class EmissionSourceGenerator {
|
|
39091
39096
|
constructor(billManager) {
|
|
39092
39097
|
this.billManager = billManager;
|
|
@@ -39110,6 +39115,7 @@ class EmissionSourceGenerator {
|
|
|
39110
39115
|
});
|
|
39111
39116
|
const totalEmissions = matchingBills.reduce((sum, bill) => sum + sanitizeNumber(bill.amountCalculated), 0);
|
|
39112
39117
|
const totalActivityData = matchingBills.reduce((sum, bill) => sum + sanitizeNumber(bill.amount), 0);
|
|
39118
|
+
const totalBillAmount = sumBillAmounts(matchingBills);
|
|
39113
39119
|
sources.push({
|
|
39114
39120
|
id: sourceId,
|
|
39115
39121
|
itemName: subProduct.name,
|
|
@@ -39120,6 +39126,7 @@ class EmissionSourceGenerator {
|
|
|
39120
39126
|
totalEmissions,
|
|
39121
39127
|
amount: totalActivityData.toString(),
|
|
39122
39128
|
activityData: totalActivityData,
|
|
39129
|
+
billAmount: totalBillAmount,
|
|
39123
39130
|
isEditing: false,
|
|
39124
39131
|
bill: matchingBills[0],
|
|
39125
39132
|
scope: scopeConfig.scope || "scope1",
|
|
@@ -39145,6 +39152,7 @@ class EmissionSourceGenerator {
|
|
|
39145
39152
|
const matchingBills = this.billManager.findBillsForEmissionItem(apiItem, scopeConfig.name, year, monthNumber, scopeConfig.scope || "scope3");
|
|
39146
39153
|
const totalEmissions = matchingBills.reduce((sum, bill) => sum + sanitizeNumber(bill.amountCalculated), 0);
|
|
39147
39154
|
const totalActivityData = matchingBills.reduce((sum, bill) => sum + sanitizeNumber(bill.amount), 0);
|
|
39155
|
+
const totalBillAmount = sumBillAmounts(matchingBills);
|
|
39148
39156
|
sources.push({
|
|
39149
39157
|
id: sourceId,
|
|
39150
39158
|
itemName: apiItem.item,
|
|
@@ -39155,6 +39163,7 @@ class EmissionSourceGenerator {
|
|
|
39155
39163
|
totalEmissions,
|
|
39156
39164
|
amount: totalActivityData.toString(),
|
|
39157
39165
|
activityData: totalActivityData,
|
|
39166
|
+
billAmount: totalBillAmount,
|
|
39158
39167
|
isEditing: false,
|
|
39159
39168
|
bill: matchingBills[0],
|
|
39160
39169
|
scope: scopeConfig.scope || "scope3",
|
|
@@ -39187,6 +39196,7 @@ class EmissionSourceGenerator {
|
|
|
39187
39196
|
});
|
|
39188
39197
|
const totalEmissions = matchingBills.reduce((sum, bill) => sum + sanitizeNumber(bill.amountCalculated), 0);
|
|
39189
39198
|
const totalActivityData = matchingBills.reduce((sum, bill) => sum + sanitizeNumber(bill.amount), 0);
|
|
39199
|
+
const totalBillAmount = sumBillAmounts(matchingBills);
|
|
39190
39200
|
sources.push({
|
|
39191
39201
|
id: sourceId,
|
|
39192
39202
|
itemName: item.item,
|
|
@@ -39197,6 +39207,7 @@ class EmissionSourceGenerator {
|
|
|
39197
39207
|
totalEmissions,
|
|
39198
39208
|
amount: totalActivityData.toString(),
|
|
39199
39209
|
activityData: totalActivityData,
|
|
39210
|
+
billAmount: totalBillAmount,
|
|
39200
39211
|
isEditing: false,
|
|
39201
39212
|
bill: matchingBills[0],
|
|
39202
39213
|
scope: scopeConfig.scope || "scope3",
|
|
@@ -43522,6 +43533,79 @@ const isUIFeatureEnabled = (featureConstant, username) => {
|
|
|
43522
43533
|
],
|
|
43523
43534
|
});
|
|
43524
43535
|
|
|
43536
|
+
const WATER_MANAGEMENT_CATEGORIES = [
|
|
43537
|
+
{
|
|
43538
|
+
key: "water-consumption",
|
|
43539
|
+
label: "Water Consumption",
|
|
43540
|
+
sourceSheet: "Water Consumption",
|
|
43541
|
+
items: [
|
|
43542
|
+
{ key: "total-water-withdrawal", label: "Total water withdrawal", unit: "m³", fieldType: "number", acceptsBillAmount: true, acceptsSupportingDocs: true, aliases: ["water withdrawal", "total withdrawal"] },
|
|
43543
|
+
{ key: "groundwater-withdrawal", label: "Groundwater withdrawal", unit: "m³", fieldType: "number", acceptsBillAmount: true, acceptsSupportingDocs: true, aliases: ["ground water withdrawal", "borewell water"] },
|
|
43544
|
+
{ key: "municipal-water-consumption", label: "Municipal water consumption", unit: "m³", fieldType: "number", acceptsBillAmount: true, acceptsSupportingDocs: true, aliases: ["municipal water", "third party water"] },
|
|
43545
|
+
{ key: "surface-water-consumption", label: "Surface water consumption", unit: "m³", fieldType: "number", acceptsBillAmount: true, acceptsSupportingDocs: true, aliases: ["surface water"] },
|
|
43546
|
+
{ key: "rainwater-harvested", label: "Rainwater harvested", unit: "m³", fieldType: "number", acceptsBillAmount: true, acceptsSupportingDocs: true, aliases: ["rain water harvested", "rainwater harvesting"] },
|
|
43547
|
+
{ key: "total-water-consumed", label: "Total water consumed", unit: "m³", fieldType: "number", acceptsBillAmount: true, acceptsSupportingDocs: true, aliases: ["water consumed", "water consumption"] },
|
|
43548
|
+
],
|
|
43549
|
+
},
|
|
43550
|
+
{
|
|
43551
|
+
key: "water-discharge",
|
|
43552
|
+
label: "Water Discharge",
|
|
43553
|
+
sourceSheet: "Water Discharge",
|
|
43554
|
+
items: [
|
|
43555
|
+
{ key: "wastewater-generated", label: "Wastewater generated", unit: "m³", fieldType: "number", acceptsBillAmount: true, acceptsSupportingDocs: true, aliases: ["waste water generated", "effluent generated"] },
|
|
43556
|
+
{ key: "wastewater-treated", label: "Wastewater treated", unit: "m³", fieldType: "number", acceptsBillAmount: true, acceptsSupportingDocs: true, aliases: ["waste water treated", "treated effluent"] },
|
|
43557
|
+
{ key: "wastewater-discharged", label: "Wastewater discharged", unit: "m³", fieldType: "number", acceptsBillAmount: true, acceptsSupportingDocs: true, aliases: ["waste water discharged", "effluent discharged"] },
|
|
43558
|
+
],
|
|
43559
|
+
},
|
|
43560
|
+
{
|
|
43561
|
+
key: "water-circularity",
|
|
43562
|
+
label: "Water Circularity",
|
|
43563
|
+
sourceSheet: "Water Circularity",
|
|
43564
|
+
items: [
|
|
43565
|
+
{ key: "water-recycled-reused", label: "Water recycled/reused", unit: "m³", fieldType: "number", acceptsBillAmount: true, acceptsSupportingDocs: true, aliases: ["recycled water", "reused water"] },
|
|
43566
|
+
{ key: "water-reuse-rate", label: "Water reuse rate", unit: "%", fieldType: "percentage", acceptsBillAmount: false, acceptsSupportingDocs: true },
|
|
43567
|
+
{ key: "rainwater-harvesting-contribution", label: "Rainwater harvesting contribution", unit: "%", fieldType: "percentage", acceptsBillAmount: false, acceptsSupportingDocs: true },
|
|
43568
|
+
],
|
|
43569
|
+
},
|
|
43570
|
+
{
|
|
43571
|
+
key: "water-intensity-metrics",
|
|
43572
|
+
label: "Water Intensity Metrics",
|
|
43573
|
+
sourceSheet: "Water Intensity Metrics",
|
|
43574
|
+
items: [
|
|
43575
|
+
{ key: "water-consumption-per-tonne-product", label: "Water consumption per tonne of product", unit: "m³/t", fieldType: "number", acceptsBillAmount: false, acceptsSupportingDocs: true },
|
|
43576
|
+
{ key: "water-consumption-per-unit-produced", label: "Water consumption per unit produced", unit: "m³/unit", fieldType: "number", acceptsBillAmount: false, acceptsSupportingDocs: true },
|
|
43577
|
+
{ key: "water-consumption-per-crore-revenue", label: "Water consumption per ₹ crore revenue", unit: "m³/₹ crore", fieldType: "number", acceptsBillAmount: false, acceptsSupportingDocs: true },
|
|
43578
|
+
],
|
|
43579
|
+
},
|
|
43580
|
+
{
|
|
43581
|
+
key: "water-risk-stewardship",
|
|
43582
|
+
label: "Water Risk and Stewardship",
|
|
43583
|
+
sourceSheet: "Water Risk and Stewardship",
|
|
43584
|
+
items: [
|
|
43585
|
+
{ key: "sites-water-stressed-regions", label: "Sites located in water-stressed regions", unit: "Number/%", fieldType: "composite", acceptsBillAmount: false, acceptsSupportingDocs: true },
|
|
43586
|
+
{ key: "water-risk-assessment-conducted", label: "Water risk assessment conducted", unit: "Yes/No", fieldType: "boolean", acceptsBillAmount: false, acceptsSupportingDocs: true },
|
|
43587
|
+
{ key: "water-reduction-target", label: "Water reduction target", unit: "%", fieldType: "percentage", acceptsBillAmount: false, acceptsSupportingDocs: true },
|
|
43588
|
+
{ key: "water-stewardship-programme", label: "Water stewardship programme", unit: "Yes/No", fieldType: "boolean", acceptsBillAmount: false, acceptsSupportingDocs: true },
|
|
43589
|
+
{ key: "watershed-restoration-initiatives", label: "Watershed restoration initiatives", unit: "Yes/No", fieldType: "boolean", acceptsBillAmount: false, acceptsSupportingDocs: true },
|
|
43590
|
+
{ key: "community-water-projects", label: "Community water projects", unit: "Number/Investment", fieldType: "composite", acceptsBillAmount: true, acceptsSupportingDocs: true },
|
|
43591
|
+
],
|
|
43592
|
+
},
|
|
43593
|
+
{
|
|
43594
|
+
key: "compliance-governance",
|
|
43595
|
+
label: "Compliance and Governance",
|
|
43596
|
+
sourceSheet: "SheetCompliance and Governance6",
|
|
43597
|
+
items: [
|
|
43598
|
+
{ key: "water-permits-available", label: "Water permits available", unit: "Yes/No", fieldType: "boolean", acceptsBillAmount: false, acceptsSupportingDocs: true },
|
|
43599
|
+
{ key: "water-environmental-violations", label: "Water-related environmental violations", unit: "Number", fieldType: "number", acceptsBillAmount: false, acceptsSupportingDocs: true },
|
|
43600
|
+
{ key: "water-related-fines", label: "Water-related fines", unit: "₹", fieldType: "currency", acceptsBillAmount: true, acceptsSupportingDocs: true },
|
|
43601
|
+
{ key: "board-oversight-water-issues", label: "Board oversight of water issues", unit: "Yes/No", fieldType: "boolean", acceptsBillAmount: false, acceptsSupportingDocs: true },
|
|
43602
|
+
{ key: "water-management-policy", label: "Water management policy", unit: "Yes/No", fieldType: "boolean", acceptsBillAmount: false, acceptsSupportingDocs: true },
|
|
43603
|
+
],
|
|
43604
|
+
},
|
|
43605
|
+
];
|
|
43606
|
+
const WATER_MANAGEMENT_CATEGORY_KEYS = WATER_MANAGEMENT_CATEGORIES.map((category) => category.key);
|
|
43607
|
+
const WATER_MANAGEMENT_ITEM_KEYS = WATER_MANAGEMENT_CATEGORIES.flatMap((category) => category.items.map((item) => item.key));
|
|
43608
|
+
|
|
43525
43609
|
const ELECTRIC_PRODUCTS = [
|
|
43526
43610
|
// Scope 1 - Direct Emissions
|
|
43527
43611
|
{
|
|
@@ -45234,6 +45318,9 @@ exports.INTENSITY_FIELD_LABELS = INTENSITY_FIELD_LABELS;
|
|
|
45234
45318
|
exports.ISO_CATEGORIES_PACKAGING = ISO_CATEGORIES_PACKAGING;
|
|
45235
45319
|
exports.Industries = index;
|
|
45236
45320
|
exports.UI_FEATURES = UI_FEATURES;
|
|
45321
|
+
exports.WATER_MANAGEMENT_CATEGORIES = WATER_MANAGEMENT_CATEGORIES;
|
|
45322
|
+
exports.WATER_MANAGEMENT_CATEGORY_KEYS = WATER_MANAGEMENT_CATEGORY_KEYS;
|
|
45323
|
+
exports.WATER_MANAGEMENT_ITEM_KEYS = WATER_MANAGEMENT_ITEM_KEYS;
|
|
45237
45324
|
exports.WATER_PRODUCTS = WATER_PRODUCTS$2;
|
|
45238
45325
|
exports.addItemForUser = addItemForUser;
|
|
45239
45326
|
exports.buildBulkBillAgentFinalizerPrompt = buildBulkBillAgentFinalizerPrompt;
|