@zerocarbon/erp-config-sdk 1.0.1 → 1.0.3

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
@@ -1255,6 +1255,13 @@ declare const UI_FEATURES: {
1255
1255
  readonly INTEGRATION_FEATURES: "advanced.integrationFeatures";
1256
1256
  };
1257
1257
  };
1258
+ /**
1259
+ * Helper function to get feature value using the constant paths
1260
+ * @param featureConstant - Use UI_FEATURES constants (e.g., UI_FEATURES.DASHBOARD_CARDS.GHG_INTENSITY)
1261
+ * @param username - The username to check
1262
+ * @returns boolean - true if feature is enabled, false if disabled
1263
+ */
1264
+ declare const isUIFeatureEnabled: (featureConstant: string, username?: string) => boolean;
1258
1265
 
1259
1266
  type FieldType = "text" | "number" | "dropdown" | "multiDropdown" | "country";
1260
1267
  interface FieldOption {
@@ -1681,6 +1688,106 @@ declare const CCTS_TABLE_COLUMNS: {
1681
1688
  }[];
1682
1689
  declare const calculateCCTSEmission: (bill: any) => number;
1683
1690
 
1691
+ declare const WATER_PRODUCTS: {
1692
+ name: string;
1693
+ unit: string;
1694
+ type: string;
1695
+ calorificValue: number;
1696
+ emissionFactor: number;
1697
+ }[];
1698
+ declare const SCOPE1_PACKAGING: {
1699
+ name: string;
1700
+ icon: react_icons_lib.IconType;
1701
+ scope: string;
1702
+ unit: string;
1703
+ subProducts: {
1704
+ name: string;
1705
+ unit: string;
1706
+ type: string;
1707
+ calorificValue: number;
1708
+ emissionFactor: number;
1709
+ }[];
1710
+ desc: string;
1711
+ }[];
1712
+ declare const SCOPE2_PACKAGING: {
1713
+ name: string;
1714
+ icon: react_icons_lib.IconType;
1715
+ scope: string;
1716
+ unit: string;
1717
+ subProducts: {
1718
+ name: string;
1719
+ unit: string;
1720
+ type: string;
1721
+ renewable: boolean;
1722
+ calorificValue: number;
1723
+ emissionFactor: number;
1724
+ }[];
1725
+ desc: string;
1726
+ }[];
1727
+ declare const ALLSCOPES_PACKAGING: {
1728
+ name: string;
1729
+ icon: react_icons_lib.IconType;
1730
+ scope: string;
1731
+ unit: string;
1732
+ subProducts: {
1733
+ name: string;
1734
+ unit: string;
1735
+ type: string;
1736
+ calorificValue: number;
1737
+ emissionFactor: number;
1738
+ }[];
1739
+ desc: string;
1740
+ }[];
1741
+ declare const EMPLOYEE_COMMUTING_EMISSIONS: {
1742
+ category: string;
1743
+ items: {
1744
+ item: string;
1745
+ emissionFactor: number;
1746
+ unit: string;
1747
+ }[];
1748
+ }[];
1749
+ declare const WATER_CONSUMPTION_EMISSIONS: {
1750
+ category: string;
1751
+ items: {
1752
+ item: string;
1753
+ emissionFactor: number;
1754
+ unit: string;
1755
+ }[];
1756
+ }[];
1757
+ declare const ALL_SCOPES_3_PACKAGING: {
1758
+ name: string;
1759
+ displayName: string;
1760
+ icon: react_icons_lib.IconType;
1761
+ scope: string;
1762
+ unit: string;
1763
+ subProducts: {
1764
+ category: string;
1765
+ items: {
1766
+ item: string;
1767
+ emissionFactor: number;
1768
+ unit: string;
1769
+ }[];
1770
+ }[];
1771
+ desc: string;
1772
+ }[];
1773
+ declare const ISO_CATEGORIES_PACKAGING: {
1774
+ name: string;
1775
+ displayName: string;
1776
+ type: string;
1777
+ icon: react_icons_lib.IconType;
1778
+ scope: string;
1779
+ unit: string;
1780
+ desc: string;
1781
+ subProducts: {
1782
+ category: string;
1783
+ items: {
1784
+ item: string;
1785
+ unit: string;
1786
+ emissionFactor: number;
1787
+ }[];
1788
+ }[];
1789
+ }[];
1790
+
1684
1791
  declare const SCOPE1_ALLOY: {
1685
1792
  name: string;
1686
1793
  icon: react_icons_lib.IconType;
@@ -2958,99 +3065,6 @@ declare const ALL_SCOPES_3_METAL: {
2958
3065
  desc: string;
2959
3066
  }[];
2960
3067
 
2961
- declare const SCOPE1_PACKAGING: {
2962
- name: string;
2963
- icon: react_icons_lib.IconType;
2964
- scope: string;
2965
- unit: string;
2966
- subProducts: {
2967
- name: string;
2968
- unit: string;
2969
- type: string;
2970
- calorificValue: number;
2971
- emissionFactor: number;
2972
- }[];
2973
- desc: string;
2974
- }[];
2975
- declare const SCOPE2_PACKAGING: {
2976
- name: string;
2977
- icon: react_icons_lib.IconType;
2978
- scope: string;
2979
- unit: string;
2980
- subProducts: {
2981
- name: string;
2982
- unit: string;
2983
- type: string;
2984
- renewable: boolean;
2985
- calorificValue: number;
2986
- emissionFactor: number;
2987
- }[];
2988
- desc: string;
2989
- }[];
2990
- declare const ALLSCOPES_PACKAGING: {
2991
- name: string;
2992
- icon: react_icons_lib.IconType;
2993
- scope: string;
2994
- unit: string;
2995
- subProducts: {
2996
- name: string;
2997
- unit: string;
2998
- type: string;
2999
- calorificValue: number;
3000
- emissionFactor: number;
3001
- }[];
3002
- desc: string;
3003
- }[];
3004
- declare const EMPLOYEE_COMMUTING_EMISSIONS: {
3005
- category: string;
3006
- items: {
3007
- item: string;
3008
- emissionFactor: number;
3009
- unit: string;
3010
- }[];
3011
- }[];
3012
- declare const WATER_CONSUMPTION_EMISSIONS: {
3013
- category: string;
3014
- items: {
3015
- item: string;
3016
- emissionFactor: number;
3017
- unit: string;
3018
- }[];
3019
- }[];
3020
- declare const ALL_SCOPES_3_PACKAGING: {
3021
- name: string;
3022
- displayName: string;
3023
- icon: react_icons_lib.IconType;
3024
- scope: string;
3025
- unit: string;
3026
- subProducts: {
3027
- category: string;
3028
- items: {
3029
- item: string;
3030
- emissionFactor: number;
3031
- unit: string;
3032
- }[];
3033
- }[];
3034
- desc: string;
3035
- }[];
3036
- declare const ISO_CATEGORIES_PACKAGING: {
3037
- name: string;
3038
- displayName: string;
3039
- type: string;
3040
- icon: react_icons_lib.IconType;
3041
- scope: string;
3042
- unit: string;
3043
- desc: string;
3044
- subProducts: {
3045
- category: string;
3046
- items: {
3047
- item: string;
3048
- unit: string;
3049
- emissionFactor: number;
3050
- }[];
3051
- }[];
3052
- }[];
3053
-
3054
3068
  declare const SCOPE1_PETRO_CHEMICAL: {
3055
3069
  name: string;
3056
3070
  icon: react_icons_lib.IconType;
@@ -3993,5 +4007,5 @@ declare namespace index {
3993
4007
  };
3994
4008
  }
3995
4009
 
3996
- export { API_ENDPOINTS, API_SCOPE3_CEMENT_CONFIG, CARBON_INTENSITY_FIELD_MAPPINGS, 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, EmissionSourceGenerator, FRONTEND_INDUSTRY_CONFIGS, HTTP_STATUS, INDUSTRIES_CONFIG, INDUSTRY_MAPPING, INDUSTRY_SPECIFIC_FIELDS, INTENSITY_FIELD_LABELS, index as Industries, UI_FEATURES, calculateCCTSEmission, calculateIntensityMetrics, categorizeApiItem, createCapitalizedMonthMapping, createEmissionSourceGenerator, createMonthMapping, debugCarbonIntensityMapping, extractCarbonIntensityData, formatEmissionValue, formatIntensityValue, formatKPIEmission, formatMonthlyEmission, formatPercentage, getApiIndustryType, getAvailableFieldsForIndustry, getIndustryConfig$1 as getIndustryConfig, getIndustryFieldConfig, getIntensityFormulas, getNestedValue, getPlantNameConfig, getScope3ConfigByName, getUserNameWaterManagementConfig, hasIntensities, mapIndustryToApiType, supportsIntensityCalculations, validateCarbonIntensityData };
4010
+ export { API_ENDPOINTS, API_SCOPE3_CEMENT_CONFIG, CARBON_INTENSITY_FIELD_MAPPINGS, 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, 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, createCapitalizedMonthMapping, createEmissionSourceGenerator, createMonthMapping, debugCarbonIntensityMapping, extractCarbonIntensityData, formatEmissionValue, formatIntensityValue, formatKPIEmission, formatMonthlyEmission, formatPercentage, getApiIndustryType, getAvailableFieldsForIndustry, getIndustryConfig$1 as getIndustryConfig, getIndustryFieldConfig, getIntensityFormulas, getNestedValue, getPlantNameConfig, getScope3ConfigByName, getUserNameWaterManagementConfig, hasIntensities, isUIFeatureEnabled, mapIndustryToApiType, supportsIntensityCalculations, validateCarbonIntensityData };
3997
4011
  export type { AlloyRequest, AlloyResponse, AluminiumRequest, AluminiumResponse, ApiEndpointConfig, ApiResponse, AutomobileRequest, AutomobileResponse, AviationRequest, AviationResponse, BaseRequest, BaseResponse, Bill, BusinessTravelEmission, BusinessTravelEmissionAttributes, BusinessTravelEmissionsResponse, CarbonIntensityApiMapping, CarbonIntensityRequest, CarbonIntensityResponse, ChemicalRequest, ChemicalResponse, DetailedCarbonIntensityResponse, EditableItem, EmissionSource, Emissions$j as Emissions, EmissionsDataAttributes, EmissionsDataResponse, FieldConfig, FieldOption, FieldType, FoodBeveragesRequest, FoodBeveragesResponse, FormData, FormValidationResult, HospitalityRequest, HospitalityResponse, IndustryFieldConfig, IndustryFieldSection, IndustryType, IntensityCalculation, IntensityValue, LogisticsRequest, LogisticsResponse, ManufacturingRequest, ManufacturingResponse, Meta, MetalEnergyRequest, MetalEnergyResponse, PackagingRequest, PackagingResponse, Pagination, PetrochemicalRequest, PetrochemicalResponse, PharmaRequest, PharmaResponse, PlantNameConfig, ProcessedEmissionCategory, ProcessedEmissionItem, ProcessedScope3Data, ProductionData, RealEstateRequest, RealEstateResponse, 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
@@ -9030,7 +9030,7 @@ const WATER_MANAGEMENT_GAS_LAB = {
9030
9030
  desc: "Water withdrawal, consumption, and discharge tracking for gas lab operations",
9031
9031
  };
9032
9032
 
9033
- const WATER_PRODUCTS = [
9033
+ const WATER_PRODUCTS$1 = [
9034
9034
  // Water Withdrawal by Source
9035
9035
  {
9036
9036
  name: "Surface Water",
@@ -11197,7 +11197,7 @@ const WATER_MANAGEMENT_SCOPE = {
11197
11197
  icon: GiElectric,
11198
11198
  scope: "other",
11199
11199
  unit: "kilolitres",
11200
- subProducts: WATER_PRODUCTS,
11200
+ subProducts: WATER_PRODUCTS$1,
11201
11201
  desc: "Water withdrawal, consumption, and discharge tracking",
11202
11202
  };
11203
11203
  // Helper function to clean values
@@ -20774,6 +20774,65 @@ const FIRE_EXTINGUISHER_PRODUCTS$8 = [
20774
20774
  emissionFactor: 1,
20775
20775
  },
20776
20776
  ];
20777
+ // WATER PRODUCTS
20778
+ const WATER_PRODUCTS = [
20779
+ {
20780
+ name: "Discharged to Surface Water",
20781
+ unit: "m^3",
20782
+ type: "direct",
20783
+ calorificValue: 1,
20784
+ emissionFactor: 0,
20785
+ },
20786
+ {
20787
+ name: "Ground Water",
20788
+ unit: "m^3",
20789
+ type: "direct",
20790
+ calorificValue: 1,
20791
+ emissionFactor: 0,
20792
+ },
20793
+ {
20794
+ name: "Rain Water",
20795
+ unit: "m^3",
20796
+ type: "direct",
20797
+ calorificValue: 1,
20798
+ emissionFactor: 0,
20799
+ },
20800
+ {
20801
+ name: "Municipal Water",
20802
+ unit: "m^3",
20803
+ type: "direct",
20804
+ calorificValue: 1,
20805
+ emissionFactor: 0,
20806
+ },
20807
+ {
20808
+ name: "Tanker Water",
20809
+ unit: "m^3",
20810
+ type: "direct",
20811
+ calorificValue: 1,
20812
+ emissionFactor: 0,
20813
+ },
20814
+ {
20815
+ name: "Recycled Water",
20816
+ unit: "m^3",
20817
+ type: "direct",
20818
+ calorificValue: 1,
20819
+ emissionFactor: 0,
20820
+ },
20821
+ {
20822
+ name: "Surface Water",
20823
+ unit: "m^3",
20824
+ type: "direct",
20825
+ calorificValue: 1,
20826
+ emissionFactor: 0,
20827
+ },
20828
+ {
20829
+ name: "Desalinated Water",
20830
+ unit: "m^3",
20831
+ type: "direct",
20832
+ calorificValue: 1,
20833
+ emissionFactor: 0,
20834
+ },
20835
+ ];
20777
20836
  const FUEL_COMBUSTION_PRODUCTS$6 = [
20778
20837
  {
20779
20838
  name: "Diesel",
@@ -35008,17 +35067,23 @@ const UI_FEATURES = {
35008
35067
  INTEGRATION_FEATURES: "advanced.integrationFeatures",
35009
35068
  },
35010
35069
  };
35070
+ // ==================== DEFAULT CONFIGURATION ====================
35071
+ // All features are enabled by default
35072
+ const DEFAULT_FEATURES = {};
35011
35073
  // Auto-populate all features as true by default
35012
35074
  const populateDefaults = (obj, prefix = "") => {
35013
35075
  for (const [key, value] of Object.entries(obj)) {
35014
35076
  if (typeof value === "object" && value !== null) {
35015
35077
  populateDefaults(value, prefix ? `${prefix}.${key}` : key);
35016
35078
  }
35079
+ else if (typeof value === "string") {
35080
+ DEFAULT_FEATURES[value] = true;
35081
+ }
35017
35082
  }
35018
35083
  };
35019
35084
  populateDefaults(UI_FEATURES);
35020
35085
  // ==================== USER-SPECIFIC OVERRIDES ====================
35021
- ({
35086
+ const USER_OVERRIDES = {
35022
35087
  // Example: Gas Lab user with specific features disabled
35023
35088
  "gas lab": {
35024
35089
  [UI_FEATURES.DASHBOARD_CARDS.GHG_INTENSITY]: false,
@@ -35043,7 +35108,40 @@ populateDefaults(UI_FEATURES);
35043
35108
  [UI_FEATURES.ADVANCED.CUSTOM_REPORTS]: false,
35044
35109
  [UI_FEATURES.ADVANCED.API_ACCESS]: false,
35045
35110
  [UI_FEATURES.GRI.BLOCKCHAIN_PUBLISHING]: false,
35046
- }});
35111
+ },
35112
+ // Example: Admin user with all features enabled (explicitly showing override pattern)
35113
+ admin: {
35114
+ // All features remain true (default), but you could override specific ones to false if needed
35115
+ },
35116
+ };
35117
+ // ==================== UTILITY FUNCTIONS ====================
35118
+ /**
35119
+ * Check if a specific feature is enabled for a user
35120
+ * @param featurePath - The dot notation path to the feature (e.g., 'dashboard.cards.ghgIntensity')
35121
+ * @param username - The username to check (case-insensitive)
35122
+ * @returns boolean - true if feature is enabled, false if disabled
35123
+ */
35124
+ const isFeatureEnabled = (featurePath, username) => {
35125
+ var _a, _b, _c;
35126
+ if (!username) {
35127
+ return (_a = DEFAULT_FEATURES[featurePath]) !== null && _a !== void 0 ? _a : true;
35128
+ }
35129
+ const normalizedUsername = username.toLowerCase().trim();
35130
+ const userOverrides = USER_OVERRIDES[normalizedUsername];
35131
+ if (userOverrides && userOverrides.hasOwnProperty(featurePath)) {
35132
+ return (_b = userOverrides[featurePath]) !== null && _b !== void 0 ? _b : true;
35133
+ }
35134
+ return (_c = DEFAULT_FEATURES[featurePath]) !== null && _c !== void 0 ? _c : true;
35135
+ };
35136
+ /**
35137
+ * Helper function to get feature value using the constant paths
35138
+ * @param featureConstant - Use UI_FEATURES constants (e.g., UI_FEATURES.DASHBOARD_CARDS.GHG_INTENSITY)
35139
+ * @param username - The username to check
35140
+ * @returns boolean - true if feature is enabled, false if disabled
35141
+ */
35142
+ const isUIFeatureEnabled = (featureConstant, username) => {
35143
+ return isFeatureEnabled(featureConstant, username);
35144
+ };
35047
35145
  // ==================== FEATURE GROUPS FOR EASY ACCESS ====================
35048
35146
  ({
35049
35147
  DASHBOARD: [
@@ -40261,5 +40359,5 @@ var index = /*#__PURE__*/Object.freeze({
40261
40359
  getUserNameScope3Config: getUserNameScope3Config
40262
40360
  });
40263
40361
 
40264
- export { API_ENDPOINTS, API_SCOPE3_CEMENT_CONFIG, CARBON_INTENSITY_FIELD_MAPPINGS, 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, EmissionSourceGenerator, FRONTEND_INDUSTRY_CONFIGS, HTTP_STATUS, INDUSTRIES_CONFIG, INDUSTRY_MAPPING, INDUSTRY_SPECIFIC_FIELDS, INTENSITY_FIELD_LABELS, index as Industries, UI_FEATURES, calculateCCTSEmission, calculateIntensityMetrics, categorizeApiItem, createCapitalizedMonthMapping, createEmissionSourceGenerator, createMonthMapping, debugCarbonIntensityMapping, extractCarbonIntensityData, formatEmissionValue, formatIntensityValue, formatKPIEmission, formatMonthlyEmission, formatPercentage, getApiIndustryType, getAvailableFieldsForIndustry, getIndustryConfig, getIndustryFieldConfig, getIntensityFormulas, getNestedValue, getPlantNameConfig, getScope3ConfigByName, getUserNameWaterManagementConfig, hasIntensities, mapIndustryToApiType, supportsIntensityCalculations, validateCarbonIntensityData };
40362
+ export { API_ENDPOINTS, API_SCOPE3_CEMENT_CONFIG, CARBON_INTENSITY_FIELD_MAPPINGS, 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, 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, createCapitalizedMonthMapping, createEmissionSourceGenerator, createMonthMapping, debugCarbonIntensityMapping, extractCarbonIntensityData, formatEmissionValue, formatIntensityValue, formatKPIEmission, formatMonthlyEmission, formatPercentage, getApiIndustryType, getAvailableFieldsForIndustry, getIndustryConfig, getIndustryFieldConfig, getIntensityFormulas, getNestedValue, getPlantNameConfig, getScope3ConfigByName, getUserNameWaterManagementConfig, hasIntensities, isUIFeatureEnabled, mapIndustryToApiType, supportsIntensityCalculations, validateCarbonIntensityData };
40265
40363
  //# sourceMappingURL=index.esm.js.map