@schandlergarcia/sf-web-components 1.9.31 → 1.9.32
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 +15 -0
- package/data/USAGE.md +81 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -68,6 +68,21 @@ This library includes:
|
|
|
68
68
|
- Filter components
|
|
69
69
|
- Layout components
|
|
70
70
|
|
|
71
|
+
## Sample Data
|
|
72
|
+
|
|
73
|
+
The package includes pre-seeded sample data in the `data/` directory:
|
|
74
|
+
- **Engine Travel Command Center** sample data with real Salesforce field names
|
|
75
|
+
- Dashboard-ready data (map markers, chart data, metrics, etc.)
|
|
76
|
+
- Easy to swap for live data later
|
|
77
|
+
|
|
78
|
+
**Copy to your project:**
|
|
79
|
+
```bash
|
|
80
|
+
# From your webapp directory
|
|
81
|
+
cp node_modules/@schandlergarcia/sf-web-components/data/engine-sample-data.js src/data/
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
See `data/README.md` and `data/USAGE.md` in the package for full documentation.
|
|
85
|
+
|
|
71
86
|
## Utilities
|
|
72
87
|
|
|
73
88
|
```tsx
|
package/data/USAGE.md
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
# Using Sample Data from the Package
|
|
2
|
+
|
|
3
|
+
When you install `@schandlergarcia/sf-web-components`, the sample data is included in the package.
|
|
4
|
+
|
|
5
|
+
## Quick Copy Command
|
|
6
|
+
|
|
7
|
+
From your webapp directory:
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
# Copy sample data to your webapp's src/data directory
|
|
11
|
+
cp node_modules/@schandlergarcia/sf-web-components/data/engine-sample-data.js src/data/
|
|
12
|
+
|
|
13
|
+
# Or use the included copy script
|
|
14
|
+
bash node_modules/@schandlergarcia/sf-web-components/data/copy-to-webapp.sh .
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Manual Copy
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
# Create data directory if it doesn't exist
|
|
21
|
+
mkdir -p src/data
|
|
22
|
+
|
|
23
|
+
# Copy the sample data file
|
|
24
|
+
cp node_modules/@schandlergarcia/sf-web-components/data/engine-sample-data.js src/data/
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Import in Your Components
|
|
28
|
+
|
|
29
|
+
Once copied to `src/data/`, import the data:
|
|
30
|
+
|
|
31
|
+
```javascript
|
|
32
|
+
import {
|
|
33
|
+
MAP_MARKERS,
|
|
34
|
+
MAP_ARCS,
|
|
35
|
+
MAP_OVERLAYS,
|
|
36
|
+
FLIGHT_STATUS_LIST,
|
|
37
|
+
TRAVELER_CARDS,
|
|
38
|
+
DISRUPTION_CARDS,
|
|
39
|
+
EVA_ACTIONS,
|
|
40
|
+
BOOKING_ROWS,
|
|
41
|
+
POLICY_ITEMS,
|
|
42
|
+
DESTINATION_CHART_DATA,
|
|
43
|
+
SPEND_CHART_DATA,
|
|
44
|
+
METRICS,
|
|
45
|
+
} from '@/data/engine-sample-data';
|
|
46
|
+
|
|
47
|
+
// Use in components
|
|
48
|
+
<GeoMap markers={MAP_MARKERS} arcs={MAP_ARCS} overlays={MAP_OVERLAYS} />
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## What's Included
|
|
52
|
+
|
|
53
|
+
See the [README.md](./README.md) for full documentation of available data exports.
|
|
54
|
+
|
|
55
|
+
**Raw Salesforce records:**
|
|
56
|
+
- AIRPORTS, TRAVELERS, TRIPS, FLIGHTS, HOTELS, DISRUPTIONS, BOOKINGS, etc.
|
|
57
|
+
|
|
58
|
+
**Dashboard-ready derivatives:**
|
|
59
|
+
- MAP_MARKERS, MAP_ARCS, FLIGHT_STATUS_LIST, TRAVELER_CARDS, etc.
|
|
60
|
+
|
|
61
|
+
All data uses real Salesforce API field names, making it easy to swap for live data later.
|
|
62
|
+
|
|
63
|
+
## Why Copy Instead of Import Directly?
|
|
64
|
+
|
|
65
|
+
The data file is intentionally designed to be copied to your `src/` directory rather than imported directly from `node_modules` because:
|
|
66
|
+
|
|
67
|
+
1. **Customization** - You can modify the sample data to match your specific use case
|
|
68
|
+
2. **Version control** - Your data lives in your repo, not tied to package updates
|
|
69
|
+
3. **Build optimization** - Some bundlers work better with files in `src/`
|
|
70
|
+
4. **Switching to live data** - When ready, you replace the file with live queries
|
|
71
|
+
|
|
72
|
+
## Switching to Live Data
|
|
73
|
+
|
|
74
|
+
When you're ready to use live Salesforce data:
|
|
75
|
+
|
|
76
|
+
1. Create a new file `src/data/live-data.js`
|
|
77
|
+
2. Query the Salesforce objects (Trip__c, Flight__c, etc.) using GraphQL
|
|
78
|
+
3. Transform the results to match the same shape as the sample data
|
|
79
|
+
4. Update your imports from `engine-sample-data` to `live-data`
|
|
80
|
+
|
|
81
|
+
Your components don't need to change - just the data source!
|
package/package.json
CHANGED