@zerocarbon/erp-config-sdk 1.0.12 → 1.0.14

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 CHANGED
@@ -186,6 +186,7 @@ interface Pagination {
186
186
  }
187
187
  type BusinessTravelEmission = StrapiItem<BusinessTravelEmissionAttributes>;
188
188
  type TransportationEmission = StrapiItem<TransportationEmissionAttributes>;
189
+ type EmissionData$3 = StrapiItem<EmissionsDataAttributes>;
189
190
  type VehicleEmission = StrapiItem<VehicleEmissionAttributes>;
190
191
  interface ProcessedScope3Data {
191
192
  name: string;
@@ -207,6 +208,10 @@ interface BaseRequest {
207
208
  month?: number;
208
209
  plant?: string;
209
210
  }
211
+ interface EmissionData$2 {
212
+ value: number;
213
+ bills: number;
214
+ }
210
215
  interface Emissions$j {
211
216
  scope1: number;
212
217
  scope2: number;
@@ -324,7 +329,7 @@ interface CarbonIntensityResponse {
324
329
  units: Record<string, string>;
325
330
  calculations: Calculations$1;
326
331
  }
327
- interface ErrorResponse {
332
+ interface ErrorResponse$1 {
328
333
  success: false;
329
334
  message: string;
330
335
  data?: {
@@ -341,7 +346,7 @@ interface ErrorResponse {
341
346
  error?: string;
342
347
  }
343
348
  type IndustryType = "steel" | "pharma" | "chemical" | "aluminium" | "alloy" | "textile" | "automobile" | "aviation" | "shipping" | "food_beverages" | "hospitality" | "logistics" | "manufacturing" | "metal_energy" | "packaging" | "petrochemical" | "real_estate" | "telecommunication" | "utilities";
344
- type ApiResponse<T = CarbonIntensityResponse> = T | ErrorResponse;
349
+ type ApiResponse<T = CarbonIntensityResponse> = T | ErrorResponse$1;
345
350
  interface FormData {
346
351
  industryType: IndustryType;
347
352
  year: number;
@@ -881,9 +886,21 @@ interface UtilitiesResponse extends BaseResponse {
881
886
  };
882
887
  }
883
888
  type DetailedCarbonIntensityResponse = SteelResponse | PharmaResponse | ChemicalResponse | AluminiumResponse | AlloyResponse | TextileResponse | AutomobileResponse | AviationResponse | ShippingResponse | FoodBeveragesResponse | HospitalityResponse | LogisticsResponse | ManufacturingResponse | MetalEnergyResponse | PackagingResponse | PetrochemicalResponse | RealEstateResponse | TelecommunicationResponse | UtilitiesResponse;
889
+ interface ErrorResponse {
890
+ success: false;
891
+ message: string;
892
+ data?: {
893
+ year?: number;
894
+ month?: number | null;
895
+ plant?: string | null;
896
+ billsFound?: BillsAnalyzed;
897
+ };
898
+ error?: string;
899
+ }
884
900
  declare function hasIntensities(response: any): response is DetailedCarbonIntensityResponse;
885
901
  declare const INTENSITY_FIELD_LABELS: Record<string, string>;
886
902
 
903
+ declare const getUserNameScopeConfig: <T = any>(scopeKey: "scope1" | "scope2" | "scope3" | "waterManagement", username?: string, defaultScope?: T) => T;
887
904
  declare const INDUSTRIES_CONFIG: {
888
905
  [key: string]: {
889
906
  scope1: Scope[];
@@ -899,7 +916,6 @@ declare const INDUSTRIES_CONFIG: {
899
916
  };
900
917
  };
901
918
  };
902
- declare const getUserNameWaterManagementConfig: (username?: string, defaultWaterManagement?: any) => any;
903
919
  declare const getIndustryConfig$1: (industry: string, username?: string) => {
904
920
  scope1: Scope[];
905
921
  scope2: Scope[];
@@ -950,27 +966,39 @@ type Scope3Item$2 = {
950
966
  subProducts: Emissions$i;
951
967
  desc: string;
952
968
  };
953
-
954
- /**
955
- * Format emission values to handle small numbers properly while keeping UI clean
956
- */
957
- declare const formatEmissionValue: (value: number, options?: {
958
- unit?: string;
959
- showUnit?: boolean;
960
- forceDecimals?: number;
961
- }) => string;
962
- /**
963
- * Format emission values specifically for monthly display (show small values properly)
964
- */
965
- declare const formatMonthlyEmission: (value: number) => string;
966
- /**
967
- * Format percentage values
968
- */
969
- declare const formatPercentage: (value: number) => string;
969
+ type BackendScope = Omit<Scope, 'icon'> & {
970
+ icon?: string;
971
+ };
972
+ type BackendScope3Item = Omit<Scope3Item$2, 'icon'> & {
973
+ icon?: string;
974
+ };
975
+ type BackendIndustryConfig = {
976
+ scope1: BackendScope[];
977
+ scope2: BackendScope[];
978
+ scope3: BackendScope3Item[];
979
+ additionalScopes?: {
980
+ [key: string]: Array<{
981
+ type: "scope1" | "scope2" | "scope3";
982
+ route: string;
983
+ name: string;
984
+ scope: BackendScope | BackendScope3Item;
985
+ }>;
986
+ };
987
+ };
988
+ type AllConfigurations = {
989
+ industries: {
990
+ [key: string]: BackendIndustryConfig;
991
+ };
992
+ userConfigs: {
993
+ [key: string]: any;
994
+ };
995
+ };
970
996
  /**
971
- * Format large emission values for KPI cards
997
+ * Get all configurations for backend consumption without React icons
998
+ * This function returns all industry configurations and user configurations
999
+ * in a format that can be safely consumed by backend applications
972
1000
  */
973
- declare const formatKPIEmission: (value: number) => string;
1001
+ declare function getAllConfig(): AllConfigurations;
974
1002
 
975
1003
  interface BillFilterOptions {
976
1004
  category?: string;
@@ -1020,6 +1048,27 @@ declare const sanitizeNumber: (value: any) => number;
1020
1048
  declare const cleanValue: (value: any) => string;
1021
1049
  declare const createBillManager: (bills: Bill[], matchingConfig?: BillMatchingConfig) => BillManager;
1022
1050
 
1051
+ /**
1052
+ * Format emission values to handle small numbers properly while keeping UI clean
1053
+ */
1054
+ declare const formatEmissionValue: (value: number, options?: {
1055
+ unit?: string;
1056
+ showUnit?: boolean;
1057
+ forceDecimals?: number;
1058
+ }) => string;
1059
+ /**
1060
+ * Format emission values specifically for monthly display (show small values properly)
1061
+ */
1062
+ declare const formatMonthlyEmission: (value: number) => string;
1063
+ /**
1064
+ * Format percentage values
1065
+ */
1066
+ declare const formatPercentage: (value: number) => string;
1067
+ /**
1068
+ * Format large emission values for KPI cards
1069
+ */
1070
+ declare const formatKPIEmission: (value: number) => string;
1071
+
1023
1072
  interface EmissionSource {
1024
1073
  id: string;
1025
1074
  itemName: string;
@@ -2402,9 +2451,6 @@ type Scope3Item$1 = {
2402
2451
  desc: string;
2403
2452
  };
2404
2453
  declare const ALL_SCOPES_3_CEMENT: Scope3Item$1[];
2405
- declare const getUserNameScope1Config: (username?: string, defaultScope1?: any[]) => any[];
2406
- declare const getUserNameScope2Config: (username?: string, defaultScope2?: any[]) => any[];
2407
- declare const getUserNameScope3Config: (username?: string, defaultScope3?: Scope3Item$1[]) => Scope3Item$1[];
2408
2454
  declare const FUEL_PRODUCTS: {
2409
2455
  name: string;
2410
2456
  unit: string;
@@ -3836,9 +3882,6 @@ declare const index_WATER_USAGE_PRODUCTS: typeof WATER_USAGE_PRODUCTS;
3836
3882
  declare const index_WELDING_PRODUCTS_GAS_LAB: typeof WELDING_PRODUCTS_GAS_LAB;
3837
3883
  declare const index_getEndpointConfig: typeof getEndpointConfig;
3838
3884
  declare const index_getIndustryConfig: typeof getIndustryConfig;
3839
- declare const index_getUserNameScope1Config: typeof getUserNameScope1Config;
3840
- declare const index_getUserNameScope2Config: typeof getUserNameScope2Config;
3841
- declare const index_getUserNameScope3Config: typeof getUserNameScope3Config;
3842
3885
  declare namespace index {
3843
3886
  export {
3844
3887
  index_ALLSCOPES_ALLOY as ALLSCOPES_ALLOY,
@@ -4002,11 +4045,8 @@ declare namespace index {
4002
4045
  index_WELDING_PRODUCTS_GAS_LAB as WELDING_PRODUCTS_GAS_LAB,
4003
4046
  index_getEndpointConfig as getEndpointConfig,
4004
4047
  index_getIndustryConfig as getIndustryConfig,
4005
- index_getUserNameScope1Config as getUserNameScope1Config,
4006
- index_getUserNameScope2Config as getUserNameScope2Config,
4007
- index_getUserNameScope3Config as getUserNameScope3Config,
4008
4048
  };
4009
4049
  }
4010
4050
 
4011
- 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, getApiIndustryType, getAvailableFieldsForIndustry, getIndustryConfig$1 as getIndustryConfig, getIndustryFieldConfig, getIntensityFormulas, getPlantNameConfig, getScope3ConfigByName, getUserNameWaterManagementConfig, hasIntensities, isUIFeatureEnabled, mapIndustryToApiType, sanitizeNumber, supportsIntensityCalculations, validateCarbonIntensityData };
4012
- export type { AlloyRequest, AlloyResponse, AluminiumRequest, AluminiumResponse, ApiEndpointConfig, ApiResponse, AutomobileRequest, AutomobileResponse, AviationRequest, AviationResponse, BaseRequest, BaseResponse, Bill, BillCalculationConfig, BillFilterOptions, BillMatchingConfig, BusinessTravelEmission, BusinessTravelEmissionAttributes, BusinessTravelEmissionsResponse, CarbonIntensityRequest, CarbonIntensityResponse, ChemicalRequest, ChemicalResponse, DetailedCarbonIntensityResponse, EditableItem, 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, ScopeConfig, ScopeProduct, ShippingRequest, ShippingResponse, SteelRequest, SteelResponse, StrapiItem, StrapiResponse, TelecommunicationRequest, TelecommunicationResponse, TextileRequest, TextileResponse, TransportationEmission, TransportationEmissionAttributes, TransportationEmissionsResponse, UserData, UtilitiesRequest, UtilitiesResponse, ValidationError, VehicleEmission, VehicleEmissionAttributes, VehicleEmissionsResponse };
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 };