@zerocarbon/erp-config-sdk 1.0.0
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/README.md +197 -0
- package/dist/index.d.ts +3997 -0
- package/dist/index.esm.js +40265 -0
- package/dist/index.esm.js.map +1 -0
- package/dist/index.js +40318 -0
- package/dist/index.js.map +1 -0
- package/package.json +81 -0
package/README.md
ADDED
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
# Zero Carbon ERP Config SDK
|
|
2
|
+
|
|
3
|
+
A comprehensive TypeScript SDK providing emission configurations and calculation utilities for carbon footprint tracking across 24+ industries.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install erp-config-sdk
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Features
|
|
12
|
+
|
|
13
|
+
- 24+ Industry-specific emission configurations
|
|
14
|
+
- Type-safe emission data structures
|
|
15
|
+
- Carbon intensity calculations
|
|
16
|
+
- Emission source generators
|
|
17
|
+
- Industry mapping utilities
|
|
18
|
+
- React Icons integration
|
|
19
|
+
- UI feature configurations
|
|
20
|
+
|
|
21
|
+
## Industries Supported
|
|
22
|
+
|
|
23
|
+
- Alloy Manufacturing
|
|
24
|
+
- Aluminum Production
|
|
25
|
+
- Automobile/Automotive
|
|
26
|
+
- Aviation
|
|
27
|
+
- Banking & Financial Services
|
|
28
|
+
- Cement Production
|
|
29
|
+
- Chemical Manufacturing
|
|
30
|
+
- Construction
|
|
31
|
+
- Food & Beverage
|
|
32
|
+
- Information Technology
|
|
33
|
+
- Leather & Textiles
|
|
34
|
+
- Logistics & Transportation
|
|
35
|
+
- Manufacturing
|
|
36
|
+
- Metal Processing
|
|
37
|
+
- Oil & Gas/Petrochemicals
|
|
38
|
+
- Packaging
|
|
39
|
+
- Pharmaceuticals
|
|
40
|
+
- Pulp & Paper
|
|
41
|
+
- Real Estate
|
|
42
|
+
- Shipping & Maritime
|
|
43
|
+
- Steel Production
|
|
44
|
+
- Telecommunications
|
|
45
|
+
- Textile Manufacturing
|
|
46
|
+
- Utilities & Energy
|
|
47
|
+
|
|
48
|
+
## Basic Usage
|
|
49
|
+
|
|
50
|
+
```typescript
|
|
51
|
+
import {
|
|
52
|
+
getIndustryConfig,
|
|
53
|
+
EmissionData,
|
|
54
|
+
IndustryConfig,
|
|
55
|
+
calculateEmissionFootprint,
|
|
56
|
+
getIndustryFromCompanyName
|
|
57
|
+
} from '@zerocarbon/erp-config-sdk';
|
|
58
|
+
|
|
59
|
+
// Get configuration for a specific industry
|
|
60
|
+
const automobileConfig = getIndustryConfig('automobile');
|
|
61
|
+
|
|
62
|
+
// Get industry mapping from company name
|
|
63
|
+
const industry = getIndustryFromCompanyName('Tesla Motors');
|
|
64
|
+
|
|
65
|
+
// Type-safe emission data
|
|
66
|
+
const emissionData: EmissionData = {
|
|
67
|
+
scope1: 1200,
|
|
68
|
+
scope2: 800,
|
|
69
|
+
scope3: 2400,
|
|
70
|
+
total: 4400
|
|
71
|
+
};
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
## Industry Configuration Structure
|
|
75
|
+
|
|
76
|
+
Each industry provides:
|
|
77
|
+
|
|
78
|
+
- **Scope 1 Emissions**: Direct emissions from company operations
|
|
79
|
+
- **Scope 2 Emissions**: Indirect emissions from purchased energy
|
|
80
|
+
- **Scope 3 Emissions**: Indirect emissions from value chain activities
|
|
81
|
+
- **UI Features**: Icon mappings and display configurations
|
|
82
|
+
- **API Endpoints**: Integration points for emission calculations
|
|
83
|
+
|
|
84
|
+
## Advanced Usage
|
|
85
|
+
|
|
86
|
+
### Custom Emission Calculations
|
|
87
|
+
|
|
88
|
+
```typescript
|
|
89
|
+
import {
|
|
90
|
+
formatEmissions,
|
|
91
|
+
generateEmissionSources,
|
|
92
|
+
BUSINESS_TRAVEL,
|
|
93
|
+
PURCHASED_ELECTRICITY_PRODUCTS
|
|
94
|
+
} from '@zerocarbon/erp-config-sdk';
|
|
95
|
+
|
|
96
|
+
// Format emission values
|
|
97
|
+
const formatted = formatEmissions(1234.567); // "1,234.57"
|
|
98
|
+
|
|
99
|
+
// Generate emission sources for a category
|
|
100
|
+
const sources = generateEmissionSources('SCOPE_1');
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
### React Integration
|
|
104
|
+
|
|
105
|
+
```typescript
|
|
106
|
+
import { FaIndustry } from 'react-icons/fa';
|
|
107
|
+
import { getUIFeatures } from '@zerocarbon/erp-config-sdk';
|
|
108
|
+
|
|
109
|
+
const features = getUIFeatures('manufacturing');
|
|
110
|
+
const Icon = features.icon || FaIndustry;
|
|
111
|
+
|
|
112
|
+
function IndustryCard() {
|
|
113
|
+
return (
|
|
114
|
+
<div>
|
|
115
|
+
<Icon size={24} />
|
|
116
|
+
<span>{features.title}</span>
|
|
117
|
+
</div>
|
|
118
|
+
);
|
|
119
|
+
}
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
## Types
|
|
123
|
+
|
|
124
|
+
The SDK exports comprehensive TypeScript types:
|
|
125
|
+
|
|
126
|
+
```typescript
|
|
127
|
+
// Core emission types
|
|
128
|
+
import type {
|
|
129
|
+
EmissionData,
|
|
130
|
+
EmissionSource,
|
|
131
|
+
ProcessedEmissionItem,
|
|
132
|
+
IndustryConfig,
|
|
133
|
+
CarbonIntensityData,
|
|
134
|
+
BillsAnalyzed,
|
|
135
|
+
Calculations
|
|
136
|
+
} from '@zerocarbon/erp-config-sdk';
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
## API
|
|
140
|
+
|
|
141
|
+
### Industry Configuration Functions
|
|
142
|
+
|
|
143
|
+
- `getIndustryConfig(industry: string): IndustryConfig` - Get complete industry configuration
|
|
144
|
+
- `getIndustryFromCompanyName(name: string): string` - Map company name to industry
|
|
145
|
+
|
|
146
|
+
### Emission Utilities
|
|
147
|
+
|
|
148
|
+
- `formatEmissions(value: number): string` - Format emission values for display
|
|
149
|
+
- `generateEmissionSources(scope: string): EmissionSource[]` - Generate emission sources
|
|
150
|
+
- `calculateEmissionFootprint(data: EmissionData): number` - Calculate total footprint
|
|
151
|
+
|
|
152
|
+
### Helper Functions
|
|
153
|
+
|
|
154
|
+
- `getUIFeatures(industry: string)` - Get UI configurations for industry
|
|
155
|
+
- `getBillManager()` - Access bill management utilities
|
|
156
|
+
- `getCarbonIntensityData()` - Access carbon intensity calculations
|
|
157
|
+
|
|
158
|
+
## Dependencies
|
|
159
|
+
|
|
160
|
+
- **React Icons**: For industry-specific icons
|
|
161
|
+
- **TypeScript**: Full type safety and IntelliSense support
|
|
162
|
+
|
|
163
|
+
## Peer Dependencies
|
|
164
|
+
|
|
165
|
+
```json
|
|
166
|
+
{
|
|
167
|
+
"react-icons": "^4.0.0"
|
|
168
|
+
}
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
## Development
|
|
172
|
+
|
|
173
|
+
```bash
|
|
174
|
+
# Install dependencies
|
|
175
|
+
npm install
|
|
176
|
+
|
|
177
|
+
# Build the SDK
|
|
178
|
+
npm run build
|
|
179
|
+
|
|
180
|
+
# Run linting
|
|
181
|
+
npm run lint
|
|
182
|
+
|
|
183
|
+
# Run type checking
|
|
184
|
+
npm run type-check
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
## License
|
|
188
|
+
|
|
189
|
+
MIT
|
|
190
|
+
|
|
191
|
+
## Contributing
|
|
192
|
+
|
|
193
|
+
Contributions are welcome! Please ensure all changes include appropriate TypeScript types and maintain backward compatibility.
|
|
194
|
+
|
|
195
|
+
## Support
|
|
196
|
+
|
|
197
|
+
For questions or issues, please contact the Zero Carbon ERP team.
|