@burdenoff/microfe-healthybowl 2026.714.1 → 2026.714.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/healthybowl/HealthyBowlRoutes.js +123 -107
- package/dist/healthybowl/HealthyBowlRoutes.js.map +1 -1
- package/dist/healthybowl/hooks/useOrderPayments.js +87 -0
- package/dist/healthybowl/hooks/useOrderPayments.js.map +1 -0
- package/dist/healthybowl/hooks/useSharedMarket.js +54 -0
- package/dist/healthybowl/hooks/useSharedMarket.js.map +1 -0
- package/dist/healthybowl/pages/marketplace/MarketplacePage.js +484 -432
- package/dist/healthybowl/pages/marketplace/MarketplacePage.js.map +1 -1
- package/dist/healthybowl/pages/marketplace/OrdersPage.js +400 -267
- package/dist/healthybowl/pages/marketplace/OrdersPage.js.map +1 -1
- package/dist/healthybowl/pages/marketplace/SharedMarketView.js +247 -0
- package/dist/healthybowl/pages/marketplace/SharedMarketView.js.map +1 -0
- package/dist/healthybowl/pages/satellite/CropHealthAlertsPage.js +188 -0
- package/dist/healthybowl/pages/satellite/CropHealthAlertsPage.js.map +1 -0
- package/dist/healthybowl/pages/satellite/NdviComparePanel.js +196 -0
- package/dist/healthybowl/pages/satellite/NdviComparePanel.js.map +1 -0
- package/dist/healthybowl/pages/satellite/NdviGridThumbnail.js +44 -0
- package/dist/healthybowl/pages/satellite/NdviGridThumbnail.js.map +1 -0
- package/dist/healthybowl/pages/satellite/NdviHeatmapMap.js +144 -0
- package/dist/healthybowl/pages/satellite/NdviHeatmapMap.js.map +1 -0
- package/dist/healthybowl/pages/satellite/SatelliteCropHealthPage.js +278 -0
- package/dist/healthybowl/pages/satellite/SatelliteCropHealthPage.js.map +1 -0
- package/dist/healthybowl/pages/satellite/SatelliteFieldDetailPage.js +447 -0
- package/dist/healthybowl/pages/satellite/SatelliteFieldDetailPage.js.map +1 -0
- package/dist/healthybowl/pages/satellite/SatelliteSettingsPage.js +252 -0
- package/dist/healthybowl/pages/satellite/SatelliteSettingsPage.js.map +1 -0
- package/dist/healthybowl/pages/satellite/YieldReportPanel.js +236 -0
- package/dist/healthybowl/pages/satellite/YieldReportPanel.js.map +1 -0
- package/dist/healthybowl/pages/satellite/YieldSimulationPanel.js +363 -0
- package/dist/healthybowl/pages/satellite/YieldSimulationPanel.js.map +1 -0
- package/dist/healthybowl/pages/satellite/ndviColors.js +116 -0
- package/dist/healthybowl/pages/satellite/ndviColors.js.map +1 -0
- package/dist/healthybowl/pages/satellite/satelliteApi.js +191 -0
- package/dist/healthybowl/pages/satellite/satelliteApi.js.map +1 -0
- package/dist/healthybowl/pages/satellite/useSatelliteApi.js +15 -0
- package/dist/healthybowl/pages/satellite/useSatelliteApi.js.map +1 -0
- package/dist/node_modules/recharts/es6/cartesian/Scatter.js +368 -0
- package/dist/node_modules/recharts/es6/cartesian/Scatter.js.map +1 -0
- package/dist/node_modules/recharts/es6/cartesian/ZAxis.js +103 -0
- package/dist/node_modules/recharts/es6/cartesian/ZAxis.js.map +1 -0
- package/dist/node_modules/recharts/es6/chart/ComposedChart.js +38 -0
- package/dist/node_modules/recharts/es6/chart/ComposedChart.js.map +1 -0
- package/dist/node_modules/recharts/es6/util/DataUtils.js +12 -2
- package/dist/node_modules/recharts/es6/util/DataUtils.js.map +1 -1
- package/dist/node_modules/recharts/es6/util/ScatterUtils.js +48 -0
- package/dist/node_modules/recharts/es6/util/ScatterUtils.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
import * as e from "@burdenoff/fe-libs/shared/graphql";
|
|
2
|
+
//#region src/healthybowl/pages/satellite/satelliteApi.ts
|
|
3
|
+
var { graphqlFetch: t } = e;
|
|
4
|
+
function n() {
|
|
5
|
+
e.clearGraphqlFetchResponseCache?.();
|
|
6
|
+
}
|
|
7
|
+
var r = class extends Error {
|
|
8
|
+
code;
|
|
9
|
+
constructor(e, t) {
|
|
10
|
+
super(e), this.name = "SatelliteApiError", this.code = t;
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
async function i(e, n, i) {
|
|
14
|
+
let a = await t({
|
|
15
|
+
gateway: "workspace",
|
|
16
|
+
query: n,
|
|
17
|
+
variables: i,
|
|
18
|
+
workspaceToken: !0,
|
|
19
|
+
workspaceId: e,
|
|
20
|
+
suppressGlobalErrorEvent: !0
|
|
21
|
+
}), o = a.errors;
|
|
22
|
+
if (o && o.length > 0) {
|
|
23
|
+
let e = o[0];
|
|
24
|
+
throw new r(e.extensions?.userMessage ?? e.message, e.extensions?.code ?? "INTERNAL_SERVER_ERROR");
|
|
25
|
+
}
|
|
26
|
+
if (!a.data) throw new r("No data returned from the gateway.", "NO_DATA");
|
|
27
|
+
return a.data;
|
|
28
|
+
}
|
|
29
|
+
var a = "\n id fieldId fieldName capturedDate source meanNdvi minNdvi maxNdvi meanEvi\n cloudCoverPct gridRows gridCols healthBand createdAt\n", o = "grid { bbox rows cols cells }", s = "\n id fieldId fieldName readingId capturedDate label severity reason reasonDetail\n centroidLat centroidLng zoneNdvi fieldNdvi deltaPct areaAcres status\n escalatedPestIssueId escalatedActivityId createdAt\n", c = "\n fieldId fieldName meanNdvi healthBand healthLabel trendDelta trendPct\n trendDirection previousNdvi latestDate readingsCount\n", l = "\n id fieldId fieldName cropId cropName variety basis meanNdvi readingsUsed areaAcres\n growthStage estimatedTonnes confidenceLowTonnes confidenceHighTonnes confidenceBand\n confidenceLabel harvestWindowStart harvestWindowLabel yieldPerAcre baselineYieldPerAcre\n deltaVsBaselinePct method trajectory { label monthIndex simulated baseline lower upper }\n name saved createdAt\n", u = "\n id provider providerStatus refreshSchedule fetchNdvi fetchEvi fetchNdmi\n stressSensitivity dataRetentionMonths lastPullAt lastPullFieldCount lastPullSource\n nextPullAt updatedAt\n", d = "\n fieldId fieldName cropName areaAcres unit meanNdvi healthBand healthLabel trendPct\n trendDirection stressedZoneCount maxZoneSeverity estimatedTonnes confidenceBand\n lastReadingDate hasBoundary\n";
|
|
30
|
+
function f(e) {
|
|
31
|
+
let t = { workspaceId: e }, r = (t, n) => i(e, t, n);
|
|
32
|
+
return {
|
|
33
|
+
async getOverview() {
|
|
34
|
+
return (await r(`query Overview($context: ContextInput!) {
|
|
35
|
+
getHealthyBowlCropHealthOverview(context: $context) {
|
|
36
|
+
fields { ${d} }
|
|
37
|
+
farmName monitoredFieldCount fieldsWithBoundaryCount stressedFieldCount
|
|
38
|
+
openStressedZoneCount lastSyncAt
|
|
39
|
+
settings { ${u} }
|
|
40
|
+
}
|
|
41
|
+
}`, { context: t })).getHealthyBowlCropHealthOverview;
|
|
42
|
+
},
|
|
43
|
+
async getFieldCropHealth(e) {
|
|
44
|
+
return (await r(`query FieldHealth($context: ContextInput!, $fieldId: ID!) {
|
|
45
|
+
getHealthyBowlFieldCropHealth(context: $context, fieldId: $fieldId) {
|
|
46
|
+
field { id name areaAcres unit cropName variety farmName location boundary hasBoundary }
|
|
47
|
+
healthScore { ${c} }
|
|
48
|
+
latestReading { ${a} ${o} }
|
|
49
|
+
stressedZones { ${s} }
|
|
50
|
+
timeline { readingId capturedDate meanNdvi source healthBand }
|
|
51
|
+
yieldForecast { ${l} }
|
|
52
|
+
}
|
|
53
|
+
}`, {
|
|
54
|
+
context: t,
|
|
55
|
+
fieldId: e
|
|
56
|
+
})).getHealthyBowlFieldCropHealth;
|
|
57
|
+
},
|
|
58
|
+
async getReading(e) {
|
|
59
|
+
return (await r(`query Reading($context: ContextInput!, $id: ID!) {
|
|
60
|
+
getHealthyBowlNdviReading(context: $context, id: $id) { ${a} ${o} }
|
|
61
|
+
}`, {
|
|
62
|
+
context: t,
|
|
63
|
+
id: e
|
|
64
|
+
})).getHealthyBowlNdviReading;
|
|
65
|
+
},
|
|
66
|
+
async getComparison(e, n, i) {
|
|
67
|
+
return (await r(`query Compare($context: ContextInput!, $fieldId: ID!, $left: ID, $right: ID) {
|
|
68
|
+
getHealthyBowlNdviComparison(context: $context, fieldId: $fieldId, leftReadingId: $left, rightReadingId: $right) {
|
|
69
|
+
fieldId fieldName
|
|
70
|
+
left { ${a} ${o} }
|
|
71
|
+
right { ${a} ${o} }
|
|
72
|
+
deltaNdvi deltaPct trendLabel
|
|
73
|
+
timeline { readingId capturedDate meanNdvi source healthBand }
|
|
74
|
+
}
|
|
75
|
+
}`, {
|
|
76
|
+
context: t,
|
|
77
|
+
fieldId: e,
|
|
78
|
+
left: n ?? null,
|
|
79
|
+
right: i ?? null
|
|
80
|
+
})).getHealthyBowlNdviComparison;
|
|
81
|
+
},
|
|
82
|
+
async getStressedZones(e = {}) {
|
|
83
|
+
return (await r(`query Zones($context: ContextInput!, $fieldId: ID, $status: String, $severity: String) {
|
|
84
|
+
getHealthyBowlStressedZones(context: $context, fieldId: $fieldId, status: $status, severity: $severity) { ${s} }
|
|
85
|
+
}`, {
|
|
86
|
+
context: t,
|
|
87
|
+
fieldId: e.fieldId ?? null,
|
|
88
|
+
status: e.status ?? null,
|
|
89
|
+
severity: e.severity ?? null
|
|
90
|
+
})).getHealthyBowlStressedZones;
|
|
91
|
+
},
|
|
92
|
+
async getYieldForecast(e) {
|
|
93
|
+
return (await r(`query Forecast($context: ContextInput!, $fieldId: ID!) {
|
|
94
|
+
getHealthyBowlYieldForecast(context: $context, fieldId: $fieldId) { ${l} }
|
|
95
|
+
}`, {
|
|
96
|
+
context: t,
|
|
97
|
+
fieldId: e
|
|
98
|
+
})).getHealthyBowlYieldForecast;
|
|
99
|
+
},
|
|
100
|
+
async simulateYield(e) {
|
|
101
|
+
return (await r(`query Simulate($input: HbYieldSimulationInput!) {
|
|
102
|
+
getHealthyBowlYieldSimulation(input: $input) { ${l} }
|
|
103
|
+
}`, { input: {
|
|
104
|
+
context: t,
|
|
105
|
+
...e
|
|
106
|
+
} })).getHealthyBowlYieldSimulation;
|
|
107
|
+
},
|
|
108
|
+
async getYieldScenarios(e) {
|
|
109
|
+
return (await r(`query Scenarios($context: ContextInput!, $fieldId: ID!) {
|
|
110
|
+
getHealthyBowlYieldScenarios(context: $context, fieldId: $fieldId) { ${l} }
|
|
111
|
+
}`, {
|
|
112
|
+
context: t,
|
|
113
|
+
fieldId: e
|
|
114
|
+
})).getHealthyBowlYieldScenarios;
|
|
115
|
+
},
|
|
116
|
+
async getSettings() {
|
|
117
|
+
return (await r(`query Settings($context: ContextInput!) {
|
|
118
|
+
getHealthyBowlSatelliteSettings(context: $context) { ${u} }
|
|
119
|
+
}`, { context: t })).getHealthyBowlSatelliteSettings;
|
|
120
|
+
},
|
|
121
|
+
async refreshNdvi(e, i) {
|
|
122
|
+
let a = await r("mutation Refresh($input: HbRefreshFieldNdviInput!) {\n refreshHealthyBowlFieldNdvi(input: $input) {\n fieldsRefreshed readingsCreated stressedZonesDetected fieldsSkippedNoBoundary lastSyncAt\n }\n }", { input: {
|
|
123
|
+
context: t,
|
|
124
|
+
fieldId: e ?? null,
|
|
125
|
+
backfillReadings: i ?? null
|
|
126
|
+
} });
|
|
127
|
+
return n(), a.refreshHealthyBowlFieldNdvi;
|
|
128
|
+
},
|
|
129
|
+
async acknowledgeZone(e) {
|
|
130
|
+
let i = await r(`mutation Ack($context: ContextInput!, $id: ID!) {
|
|
131
|
+
acknowledgeHealthyBowlStressedZone(context: $context, id: $id) { ${s} }
|
|
132
|
+
}`, {
|
|
133
|
+
context: t,
|
|
134
|
+
id: e
|
|
135
|
+
});
|
|
136
|
+
return n(), i.acknowledgeHealthyBowlStressedZone;
|
|
137
|
+
},
|
|
138
|
+
async resolveZone(e) {
|
|
139
|
+
let i = await r(`mutation Resolve($context: ContextInput!, $id: ID!) {
|
|
140
|
+
resolveHealthyBowlStressedZone(context: $context, id: $id) { ${s} }
|
|
141
|
+
}`, {
|
|
142
|
+
context: t,
|
|
143
|
+
id: e
|
|
144
|
+
});
|
|
145
|
+
return n(), i.resolveHealthyBowlStressedZone;
|
|
146
|
+
},
|
|
147
|
+
async escalateZone(e, i, a) {
|
|
148
|
+
let o = await r(`mutation Escalate($input: HbEscalateStressedZoneInput!) {
|
|
149
|
+
escalateHealthyBowlStressedZone(input: $input) {
|
|
150
|
+
zone { ${s} }
|
|
151
|
+
target pestIssueId activityId
|
|
152
|
+
}
|
|
153
|
+
}`, { input: {
|
|
154
|
+
context: t,
|
|
155
|
+
id: e,
|
|
156
|
+
target: i,
|
|
157
|
+
note: a ?? null
|
|
158
|
+
} });
|
|
159
|
+
return n(), o.escalateHealthyBowlStressedZone;
|
|
160
|
+
},
|
|
161
|
+
async saveScenario(e) {
|
|
162
|
+
let i = await r(`mutation SaveScenario($input: HbSaveYieldScenarioInput!) {
|
|
163
|
+
saveHealthyBowlYieldScenario(input: $input) { ${l} }
|
|
164
|
+
}`, { input: {
|
|
165
|
+
context: t,
|
|
166
|
+
...e
|
|
167
|
+
} });
|
|
168
|
+
return n(), i.saveHealthyBowlYieldScenario;
|
|
169
|
+
},
|
|
170
|
+
async deleteScenario(e) {
|
|
171
|
+
let i = await r("mutation DeleteScenario($context: ContextInput!, $id: ID!) {\n deleteHealthyBowlYieldScenario(context: $context, id: $id)\n }", {
|
|
172
|
+
context: t,
|
|
173
|
+
id: e
|
|
174
|
+
});
|
|
175
|
+
return n(), i.deleteHealthyBowlYieldScenario;
|
|
176
|
+
},
|
|
177
|
+
async updateSettings(e) {
|
|
178
|
+
let i = await r(`mutation UpdateSettings($input: HbUpdateSatelliteSettingsInput!) {
|
|
179
|
+
updateHealthyBowlSatelliteSettings(input: $input) { ${u} }
|
|
180
|
+
}`, { input: {
|
|
181
|
+
context: t,
|
|
182
|
+
...e
|
|
183
|
+
} });
|
|
184
|
+
return n(), i.updateHealthyBowlSatelliteSettings;
|
|
185
|
+
}
|
|
186
|
+
};
|
|
187
|
+
}
|
|
188
|
+
//#endregion
|
|
189
|
+
export { f as createSatelliteApi };
|
|
190
|
+
|
|
191
|
+
//# sourceMappingURL=satelliteApi.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"satelliteApi.js","names":[],"sources":["../../../../src/healthybowl/pages/satellite/satelliteApi.ts"],"sourcesContent":["/**\n * Satellite Crop Health & Yield Forecast — GraphQL API (BOFF-2886).\n *\n * Thin typed wrappers over fe-libs `graphqlFetch` (gateway: 'workspace'), which\n * re-derives auth (bearer + workspace dual-token + context headers) from profile\n * storage on every call. The workspaces public gateway enforces the `@rbac`\n * directives on wspace-healthybowl-svc. After every mutation we clear the fe-libs\n * response cache so an immediate re-read reflects the write (memory: graphqlFetch\n * caches ~15 s). No mocks — this is wired to the live prod/alpha gateway.\n */\nimport * as feGraphql from '@burdenoff/fe-libs/shared/graphql';\n\nconst { graphqlFetch } = feGraphql;\n\n/**\n * Clear the fe-libs graphqlFetch response cache (~15 s TTL) after a mutation so an\n * immediate re-read reflects the write. Accessed defensively via the module\n * namespace so a version-skewed fe-libs that predates the export degrades to a\n * no-op (worst case: a read within 15 s of a write is briefly stale) rather than a\n * build break — the deployed fe-libs (≥2026.713.6) exports it.\n */\nfunction clearGraphqlFetchResponseCache(): void {\n (feGraphql as { clearGraphqlFetchResponseCache?: () => void }).clearGraphqlFetchResponseCache?.();\n}\n\n// ── response types (mirror the svc satellite.gql schema) ──────────────────────\nexport interface NdviGrid {\n bbox: number[]; // [minLng, minLat, maxLng, maxLat]\n rows: number;\n cols: number;\n cells: Array<number | null>;\n}\n\nexport interface NdviReading {\n id: string;\n fieldId: string;\n fieldName: string;\n capturedDate: string;\n source: string;\n meanNdvi: number;\n minNdvi: number;\n maxNdvi: number;\n meanEvi: number | null;\n cloudCoverPct: number | null;\n gridRows: number;\n gridCols: number;\n grid: NdviGrid | null;\n healthBand: string;\n createdAt: string;\n}\n\nexport interface NdviTimelinePoint {\n readingId: string;\n capturedDate: string;\n meanNdvi: number;\n source: string;\n healthBand: string;\n}\n\nexport interface StressedZone {\n id: string;\n fieldId: string;\n fieldName: string;\n readingId: string;\n capturedDate: string;\n label: string;\n severity: string;\n reason: string;\n reasonDetail: string | null;\n centroidLat: number;\n centroidLng: number;\n zoneNdvi: number;\n fieldNdvi: number;\n deltaPct: number;\n areaAcres: number | null;\n status: string;\n escalatedPestIssueId: string | null;\n escalatedActivityId: string | null;\n createdAt: string;\n}\n\nexport interface FieldHealthScore {\n fieldId: string;\n fieldName: string;\n meanNdvi: number;\n healthBand: string;\n healthLabel: string;\n trendDelta: number;\n trendPct: number;\n trendDirection: string;\n previousNdvi: number | null;\n latestDate: string | null;\n readingsCount: number;\n}\n\nexport interface YieldTrajectoryPoint {\n label: string;\n monthIndex: number;\n simulated: number;\n baseline: number;\n lower: number;\n upper: number;\n}\n\nexport interface YieldForecast {\n id: string | null;\n fieldId: string;\n fieldName: string;\n cropId: string | null;\n cropName: string | null;\n variety: string | null;\n basis: string;\n meanNdvi: number;\n readingsUsed: number;\n areaAcres: number;\n growthStage: string | null;\n estimatedTonnes: number;\n confidenceLowTonnes: number;\n confidenceHighTonnes: number;\n confidenceBand: number;\n confidenceLabel: string;\n harvestWindowStart: string | null;\n harvestWindowLabel: string | null;\n yieldPerAcre: number;\n baselineYieldPerAcre: number;\n deltaVsBaselinePct: number | null;\n method: string;\n trajectory: YieldTrajectoryPoint[];\n name: string | null;\n saved: boolean;\n createdAt: string | null;\n}\n\nexport interface FieldFacet {\n id: string;\n name: string;\n areaAcres: number;\n unit: string;\n cropName: string | null;\n variety: string | null;\n farmName: string | null;\n location: string | null;\n boundary: unknown;\n hasBoundary: boolean;\n}\n\nexport interface FieldCropHealth {\n field: FieldFacet;\n healthScore: FieldHealthScore;\n latestReading: NdviReading | null;\n stressedZones: StressedZone[];\n timeline: NdviTimelinePoint[];\n yieldForecast: YieldForecast | null;\n}\n\nexport interface CropHealthFieldSummary {\n fieldId: string;\n fieldName: string;\n cropName: string | null;\n areaAcres: number;\n unit: string;\n meanNdvi: number | null;\n healthBand: string;\n healthLabel: string;\n trendPct: number;\n trendDirection: string;\n stressedZoneCount: number;\n maxZoneSeverity: string | null;\n estimatedTonnes: number | null;\n confidenceBand: number | null;\n lastReadingDate: string | null;\n hasBoundary: boolean;\n}\n\nexport interface SatelliteSettings {\n id: string | null;\n provider: string;\n providerStatus: string;\n refreshSchedule: string;\n fetchNdvi: boolean;\n fetchEvi: boolean;\n fetchNdmi: boolean;\n stressSensitivity: string;\n dataRetentionMonths: number;\n lastPullAt: string | null;\n lastPullFieldCount: number | null;\n lastPullSource: string | null;\n nextPullAt: string | null;\n updatedAt: string | null;\n}\n\nexport interface CropHealthOverview {\n fields: CropHealthFieldSummary[];\n farmName: string | null;\n monitoredFieldCount: number;\n fieldsWithBoundaryCount: number;\n stressedFieldCount: number;\n openStressedZoneCount: number;\n lastSyncAt: string | null;\n settings: SatelliteSettings;\n}\n\nexport interface NdviComparison {\n fieldId: string;\n fieldName: string;\n left: NdviReading | null;\n right: NdviReading | null;\n deltaNdvi: number;\n deltaPct: number;\n trendLabel: string;\n timeline: NdviTimelinePoint[];\n}\n\nexport interface NdviRefreshResult {\n fieldsRefreshed: number;\n readingsCreated: number;\n stressedZonesDetected: number;\n fieldsSkippedNoBoundary: number;\n lastSyncAt: string;\n}\n\nexport interface StressedZoneEscalation {\n zone: StressedZone;\n target: string;\n pestIssueId: string | null;\n activityId: string | null;\n}\n\n// ── transport ─────────────────────────────────────────────────────────────────\nexport class SatelliteApiError extends Error {\n code: string;\n constructor(message: string, code: string) {\n super(message);\n this.name = 'SatelliteApiError';\n this.code = code;\n }\n}\n\ninterface GqlErr {\n message: string;\n extensions?: { code?: string; userMessage?: string };\n}\n\nasync function runGql<T>(workspaceId: string, query: string, variables: Record<string, unknown>): Promise<T> {\n const res = await graphqlFetch<T>({\n gateway: 'workspace',\n query,\n variables,\n workspaceToken: true,\n workspaceId,\n suppressGlobalErrorEvent: true,\n });\n const errs = res.errors as GqlErr[] | undefined;\n if (errs && errs.length > 0) {\n const e = errs[0]!;\n throw new SatelliteApiError(e.extensions?.userMessage ?? e.message, e.extensions?.code ?? 'INTERNAL_SERVER_ERROR');\n }\n if (!res.data) throw new SatelliteApiError('No data returned from the gateway.', 'NO_DATA');\n return res.data;\n}\n\nconst READING_FIELDS = `\n id fieldId fieldName capturedDate source meanNdvi minNdvi maxNdvi meanEvi\n cloudCoverPct gridRows gridCols healthBand createdAt\n`;\nconst GRID_FIELDS = `grid { bbox rows cols cells }`;\nconst ZONE_FIELDS = `\n id fieldId fieldName readingId capturedDate label severity reason reasonDetail\n centroidLat centroidLng zoneNdvi fieldNdvi deltaPct areaAcres status\n escalatedPestIssueId escalatedActivityId createdAt\n`;\nconst SCORE_FIELDS = `\n fieldId fieldName meanNdvi healthBand healthLabel trendDelta trendPct\n trendDirection previousNdvi latestDate readingsCount\n`;\nconst FORECAST_FIELDS = `\n id fieldId fieldName cropId cropName variety basis meanNdvi readingsUsed areaAcres\n growthStage estimatedTonnes confidenceLowTonnes confidenceHighTonnes confidenceBand\n confidenceLabel harvestWindowStart harvestWindowLabel yieldPerAcre baselineYieldPerAcre\n deltaVsBaselinePct method trajectory { label monthIndex simulated baseline lower upper }\n name saved createdAt\n`;\nconst SETTINGS_FIELDS = `\n id provider providerStatus refreshSchedule fetchNdvi fetchEvi fetchNdmi\n stressSensitivity dataRetentionMonths lastPullAt lastPullFieldCount lastPullSource\n nextPullAt updatedAt\n`;\nconst SUMMARY_FIELDS = `\n fieldId fieldName cropName areaAcres unit meanNdvi healthBand healthLabel trendPct\n trendDirection stressedZoneCount maxZoneSeverity estimatedTonnes confidenceBand\n lastReadingDate hasBoundary\n`;\n\n/** All satellite operations, bound to a workspace. Instantiate via `useSatelliteApi()`. */\nexport function createSatelliteApi(workspaceId: string) {\n const ctx = { workspaceId };\n const run = <T>(query: string, variables: Record<string, unknown>) => runGql<T>(workspaceId, query, variables);\n\n return {\n async getOverview(): Promise<CropHealthOverview> {\n const d = await run<{ getHealthyBowlCropHealthOverview: CropHealthOverview }>(\n `query Overview($context: ContextInput!) {\n getHealthyBowlCropHealthOverview(context: $context) {\n fields { ${SUMMARY_FIELDS} }\n farmName monitoredFieldCount fieldsWithBoundaryCount stressedFieldCount\n openStressedZoneCount lastSyncAt\n settings { ${SETTINGS_FIELDS} }\n }\n }`,\n { context: ctx }\n );\n return d.getHealthyBowlCropHealthOverview;\n },\n\n async getFieldCropHealth(fieldId: string): Promise<FieldCropHealth> {\n const d = await run<{ getHealthyBowlFieldCropHealth: FieldCropHealth }>(\n `query FieldHealth($context: ContextInput!, $fieldId: ID!) {\n getHealthyBowlFieldCropHealth(context: $context, fieldId: $fieldId) {\n field { id name areaAcres unit cropName variety farmName location boundary hasBoundary }\n healthScore { ${SCORE_FIELDS} }\n latestReading { ${READING_FIELDS} ${GRID_FIELDS} }\n stressedZones { ${ZONE_FIELDS} }\n timeline { readingId capturedDate meanNdvi source healthBand }\n yieldForecast { ${FORECAST_FIELDS} }\n }\n }`,\n { context: ctx, fieldId }\n );\n return d.getHealthyBowlFieldCropHealth;\n },\n\n async getReading(id: string): Promise<NdviReading | null> {\n const d = await run<{ getHealthyBowlNdviReading: NdviReading | null }>(\n `query Reading($context: ContextInput!, $id: ID!) {\n getHealthyBowlNdviReading(context: $context, id: $id) { ${READING_FIELDS} ${GRID_FIELDS} }\n }`,\n { context: ctx, id }\n );\n return d.getHealthyBowlNdviReading;\n },\n\n async getComparison(fieldId: string, leftReadingId?: string, rightReadingId?: string): Promise<NdviComparison> {\n const d = await run<{ getHealthyBowlNdviComparison: NdviComparison }>(\n `query Compare($context: ContextInput!, $fieldId: ID!, $left: ID, $right: ID) {\n getHealthyBowlNdviComparison(context: $context, fieldId: $fieldId, leftReadingId: $left, rightReadingId: $right) {\n fieldId fieldName\n left { ${READING_FIELDS} ${GRID_FIELDS} }\n right { ${READING_FIELDS} ${GRID_FIELDS} }\n deltaNdvi deltaPct trendLabel\n timeline { readingId capturedDate meanNdvi source healthBand }\n }\n }`,\n { context: ctx, fieldId, left: leftReadingId ?? null, right: rightReadingId ?? null }\n );\n return d.getHealthyBowlNdviComparison;\n },\n\n async getStressedZones(\n opts: { fieldId?: string; status?: string; severity?: string } = {}\n ): Promise<StressedZone[]> {\n const d = await run<{ getHealthyBowlStressedZones: StressedZone[] }>(\n `query Zones($context: ContextInput!, $fieldId: ID, $status: String, $severity: String) {\n getHealthyBowlStressedZones(context: $context, fieldId: $fieldId, status: $status, severity: $severity) { ${ZONE_FIELDS} }\n }`,\n { context: ctx, fieldId: opts.fieldId ?? null, status: opts.status ?? null, severity: opts.severity ?? null }\n );\n return d.getHealthyBowlStressedZones;\n },\n\n async getYieldForecast(fieldId: string): Promise<YieldForecast> {\n const d = await run<{ getHealthyBowlYieldForecast: YieldForecast }>(\n `query Forecast($context: ContextInput!, $fieldId: ID!) {\n getHealthyBowlYieldForecast(context: $context, fieldId: $fieldId) { ${FORECAST_FIELDS} }\n }`,\n { context: ctx, fieldId }\n );\n return d.getHealthyBowlYieldForecast;\n },\n\n async simulateYield(input: {\n fieldId: string;\n irrigationMmPerWeek?: number;\n nitrogenKgPerAcre?: number;\n plantingDate?: string;\n variety?: string;\n plantDensityPerSqM?: number;\n }): Promise<YieldForecast> {\n const d = await run<{ getHealthyBowlYieldSimulation: YieldForecast }>(\n `query Simulate($input: HbYieldSimulationInput!) {\n getHealthyBowlYieldSimulation(input: $input) { ${FORECAST_FIELDS} }\n }`,\n { input: { context: ctx, ...input } }\n );\n return d.getHealthyBowlYieldSimulation;\n },\n\n async getYieldScenarios(fieldId: string): Promise<YieldForecast[]> {\n const d = await run<{ getHealthyBowlYieldScenarios: YieldForecast[] }>(\n `query Scenarios($context: ContextInput!, $fieldId: ID!) {\n getHealthyBowlYieldScenarios(context: $context, fieldId: $fieldId) { ${FORECAST_FIELDS} }\n }`,\n { context: ctx, fieldId }\n );\n return d.getHealthyBowlYieldScenarios;\n },\n\n async getSettings(): Promise<SatelliteSettings> {\n const d = await run<{ getHealthyBowlSatelliteSettings: SatelliteSettings }>(\n `query Settings($context: ContextInput!) {\n getHealthyBowlSatelliteSettings(context: $context) { ${SETTINGS_FIELDS} }\n }`,\n { context: ctx }\n );\n return d.getHealthyBowlSatelliteSettings;\n },\n\n // ── mutations (clear the fe-libs read cache after each) ──────────────────\n async refreshNdvi(fieldId?: string, backfillReadings?: number): Promise<NdviRefreshResult> {\n const d = await run<{ refreshHealthyBowlFieldNdvi: NdviRefreshResult }>(\n `mutation Refresh($input: HbRefreshFieldNdviInput!) {\n refreshHealthyBowlFieldNdvi(input: $input) {\n fieldsRefreshed readingsCreated stressedZonesDetected fieldsSkippedNoBoundary lastSyncAt\n }\n }`,\n { input: { context: ctx, fieldId: fieldId ?? null, backfillReadings: backfillReadings ?? null } }\n );\n clearGraphqlFetchResponseCache();\n return d.refreshHealthyBowlFieldNdvi;\n },\n\n async acknowledgeZone(id: string): Promise<StressedZone> {\n const d = await run<{ acknowledgeHealthyBowlStressedZone: StressedZone }>(\n `mutation Ack($context: ContextInput!, $id: ID!) {\n acknowledgeHealthyBowlStressedZone(context: $context, id: $id) { ${ZONE_FIELDS} }\n }`,\n { context: ctx, id }\n );\n clearGraphqlFetchResponseCache();\n return d.acknowledgeHealthyBowlStressedZone;\n },\n\n async resolveZone(id: string): Promise<StressedZone> {\n const d = await run<{ resolveHealthyBowlStressedZone: StressedZone }>(\n `mutation Resolve($context: ContextInput!, $id: ID!) {\n resolveHealthyBowlStressedZone(context: $context, id: $id) { ${ZONE_FIELDS} }\n }`,\n { context: ctx, id }\n );\n clearGraphqlFetchResponseCache();\n return d.resolveHealthyBowlStressedZone;\n },\n\n async escalateZone(id: string, target: 'PEST' | 'TASK', note?: string): Promise<StressedZoneEscalation> {\n const d = await run<{ escalateHealthyBowlStressedZone: StressedZoneEscalation }>(\n `mutation Escalate($input: HbEscalateStressedZoneInput!) {\n escalateHealthyBowlStressedZone(input: $input) {\n zone { ${ZONE_FIELDS} }\n target pestIssueId activityId\n }\n }`,\n { input: { context: ctx, id, target, note: note ?? null } }\n );\n clearGraphqlFetchResponseCache();\n return d.escalateHealthyBowlStressedZone;\n },\n\n async saveScenario(input: {\n fieldId: string;\n name: string;\n irrigationMmPerWeek?: number;\n nitrogenKgPerAcre?: number;\n plantingDate?: string;\n variety?: string;\n plantDensityPerSqM?: number;\n }): Promise<YieldForecast> {\n const d = await run<{ saveHealthyBowlYieldScenario: YieldForecast }>(\n `mutation SaveScenario($input: HbSaveYieldScenarioInput!) {\n saveHealthyBowlYieldScenario(input: $input) { ${FORECAST_FIELDS} }\n }`,\n { input: { context: ctx, ...input } }\n );\n clearGraphqlFetchResponseCache();\n return d.saveHealthyBowlYieldScenario;\n },\n\n async deleteScenario(id: string): Promise<boolean> {\n const d = await run<{ deleteHealthyBowlYieldScenario: boolean }>(\n `mutation DeleteScenario($context: ContextInput!, $id: ID!) {\n deleteHealthyBowlYieldScenario(context: $context, id: $id)\n }`,\n { context: ctx, id }\n );\n clearGraphqlFetchResponseCache();\n return d.deleteHealthyBowlYieldScenario;\n },\n\n async updateSettings(\n input: Partial<\n Omit<\n SatelliteSettings,\n 'id' | 'providerStatus' | 'lastPullAt' | 'lastPullFieldCount' | 'lastPullSource' | 'nextPullAt' | 'updatedAt'\n >\n >\n ): Promise<SatelliteSettings> {\n const d = await run<{ updateHealthyBowlSatelliteSettings: SatelliteSettings }>(\n `mutation UpdateSettings($input: HbUpdateSatelliteSettingsInput!) {\n updateHealthyBowlSatelliteSettings(input: $input) { ${SETTINGS_FIELDS} }\n }`,\n { input: { context: ctx, ...input } }\n );\n clearGraphqlFetchResponseCache();\n return d.updateHealthyBowlSatelliteSettings;\n },\n };\n}\n\nexport type SatelliteApi = ReturnType<typeof createSatelliteApi>;\n"],"mappings":"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"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { useHealthyBowl as e } from "../../context/HealthyBowlContext.js";
|
|
2
|
+
import { createSatelliteApi as t } from "./satelliteApi.js";
|
|
3
|
+
import { useMemo as n } from "react";
|
|
4
|
+
//#region src/healthybowl/pages/satellite/useSatelliteApi.ts
|
|
5
|
+
function r() {
|
|
6
|
+
let { workspaceId: r } = e();
|
|
7
|
+
return {
|
|
8
|
+
api: n(() => t(r), [r]),
|
|
9
|
+
workspaceId: r
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
//#endregion
|
|
13
|
+
export { r as useSatelliteApi };
|
|
14
|
+
|
|
15
|
+
//# sourceMappingURL=useSatelliteApi.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useSatelliteApi.js","names":[],"sources":["../../../../src/healthybowl/pages/satellite/useSatelliteApi.ts"],"sourcesContent":["import { useMemo } from 'react';\nimport { useHealthyBowl } from '../../context/HealthyBowlContext';\nimport { createSatelliteApi, type SatelliteApi } from './satelliteApi';\n\n/** The satellite API bound to the active workspace. */\nexport function useSatelliteApi(): { api: SatelliteApi; workspaceId: string } {\n const { workspaceId } = useHealthyBowl();\n const api = useMemo(() => createSatelliteApi(workspaceId), [workspaceId]);\n return { api, workspaceId };\n}\n"],"mappings":";;;;AAKA,SAAgB,IAA8D;CAC5E,IAAM,EAAE,mBAAgB,GAAgB;AAExC,QAAO;EAAE,KADG,QAAc,EAAmB,EAAY,EAAE,CAAC,EAAY,CAAC;EAC3D;EAAa"}
|
|
@@ -0,0 +1,368 @@
|
|
|
1
|
+
import { __toESM as e } from "../../../../_virtual/_rolldown/runtime.js";
|
|
2
|
+
import t from "../../../clsx/dist/clsx.js";
|
|
3
|
+
import { require_isFunction as n } from "../../../lodash/isFunction.js";
|
|
4
|
+
import { require_isNil as r } from "../../../lodash/isNil.js";
|
|
5
|
+
import { getLinearRegression as i, interpolateNumber as a, uniqueId as o } from "../util/DataUtils.js";
|
|
6
|
+
import { adaptEventsOfChild as s } from "../util/types.js";
|
|
7
|
+
import { filterProps as c, findAllByType as l } from "../util/ReactUtils.js";
|
|
8
|
+
import { Layer as u } from "../container/Layer.js";
|
|
9
|
+
import { Global as d } from "../util/Global.js";
|
|
10
|
+
import { Cell as f } from "../component/Cell.js";
|
|
11
|
+
import { require_isEqual as p } from "../../../lodash/isEqual.js";
|
|
12
|
+
import { ErrorBar as m } from "./ErrorBar.js";
|
|
13
|
+
import { getCateCoordinateOfLine as h, getValueByDataKey as g } from "../util/ChartUtils.js";
|
|
14
|
+
import { LabelList as _ } from "../component/LabelList.js";
|
|
15
|
+
import { Curve as v } from "../shape/Curve.js";
|
|
16
|
+
import y from "../../../react-smooth/es6/index.js";
|
|
17
|
+
import { ZAxis as b } from "./ZAxis.js";
|
|
18
|
+
import { ScatterSymbol as x } from "../util/ScatterUtils.js";
|
|
19
|
+
import S, { PureComponent as C } from "react";
|
|
20
|
+
//#region node_modules/recharts/es6/cartesian/Scatter.js
|
|
21
|
+
var w = /* @__PURE__ */ e(r()), T = /* @__PURE__ */ e(p()), E = /* @__PURE__ */ e(n());
|
|
22
|
+
function D(e) {
|
|
23
|
+
"@babel/helpers - typeof";
|
|
24
|
+
return D = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(e) {
|
|
25
|
+
return typeof e;
|
|
26
|
+
} : function(e) {
|
|
27
|
+
return e && typeof Symbol == "function" && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e;
|
|
28
|
+
}, D(e);
|
|
29
|
+
}
|
|
30
|
+
function O() {
|
|
31
|
+
return O = Object.assign ? Object.assign.bind() : function(e) {
|
|
32
|
+
for (var t = 1; t < arguments.length; t++) {
|
|
33
|
+
var n = arguments[t];
|
|
34
|
+
for (var r in n) Object.prototype.hasOwnProperty.call(n, r) && (e[r] = n[r]);
|
|
35
|
+
}
|
|
36
|
+
return e;
|
|
37
|
+
}, O.apply(this, arguments);
|
|
38
|
+
}
|
|
39
|
+
function k(e, t) {
|
|
40
|
+
var n = Object.keys(e);
|
|
41
|
+
if (Object.getOwnPropertySymbols) {
|
|
42
|
+
var r = Object.getOwnPropertySymbols(e);
|
|
43
|
+
t && (r = r.filter(function(t) {
|
|
44
|
+
return Object.getOwnPropertyDescriptor(e, t).enumerable;
|
|
45
|
+
})), n.push.apply(n, r);
|
|
46
|
+
}
|
|
47
|
+
return n;
|
|
48
|
+
}
|
|
49
|
+
function A(e) {
|
|
50
|
+
for (var t = 1; t < arguments.length; t++) {
|
|
51
|
+
var n = arguments[t] == null ? {} : arguments[t];
|
|
52
|
+
t % 2 ? k(Object(n), !0).forEach(function(t) {
|
|
53
|
+
V(e, t, n[t]);
|
|
54
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(n)) : k(Object(n)).forEach(function(t) {
|
|
55
|
+
Object.defineProperty(e, t, Object.getOwnPropertyDescriptor(n, t));
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
return e;
|
|
59
|
+
}
|
|
60
|
+
function j(e, t) {
|
|
61
|
+
if (!(e instanceof t)) throw TypeError("Cannot call a class as a function");
|
|
62
|
+
}
|
|
63
|
+
function M(e, t) {
|
|
64
|
+
for (var n = 0; n < t.length; n++) {
|
|
65
|
+
var r = t[n];
|
|
66
|
+
r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object.defineProperty(e, H(r.key), r);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
function N(e, t, n) {
|
|
70
|
+
return t && M(e.prototype, t), n && M(e, n), Object.defineProperty(e, "prototype", { writable: !1 }), e;
|
|
71
|
+
}
|
|
72
|
+
function P(e, t, n) {
|
|
73
|
+
return t = R(t), F(e, L() ? Reflect.construct(t, n || [], R(e).constructor) : t.apply(e, n));
|
|
74
|
+
}
|
|
75
|
+
function F(e, t) {
|
|
76
|
+
if (t && (D(t) === "object" || typeof t == "function")) return t;
|
|
77
|
+
if (t !== void 0) throw TypeError("Derived constructors may only return object or undefined");
|
|
78
|
+
return I(e);
|
|
79
|
+
}
|
|
80
|
+
function I(e) {
|
|
81
|
+
if (e === void 0) throw ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
82
|
+
return e;
|
|
83
|
+
}
|
|
84
|
+
function L() {
|
|
85
|
+
try {
|
|
86
|
+
var e = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
|
|
87
|
+
} catch {}
|
|
88
|
+
return (L = function() {
|
|
89
|
+
return !!e;
|
|
90
|
+
})();
|
|
91
|
+
}
|
|
92
|
+
function R(e) {
|
|
93
|
+
return R = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function(e) {
|
|
94
|
+
return e.__proto__ || Object.getPrototypeOf(e);
|
|
95
|
+
}, R(e);
|
|
96
|
+
}
|
|
97
|
+
function z(e, t) {
|
|
98
|
+
if (typeof t != "function" && t !== null) throw TypeError("Super expression must either be null or a function");
|
|
99
|
+
e.prototype = Object.create(t && t.prototype, { constructor: {
|
|
100
|
+
value: e,
|
|
101
|
+
writable: !0,
|
|
102
|
+
configurable: !0
|
|
103
|
+
} }), Object.defineProperty(e, "prototype", { writable: !1 }), t && B(e, t);
|
|
104
|
+
}
|
|
105
|
+
function B(e, t) {
|
|
106
|
+
return B = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(e, t) {
|
|
107
|
+
return e.__proto__ = t, e;
|
|
108
|
+
}, B(e, t);
|
|
109
|
+
}
|
|
110
|
+
function V(e, t, n) {
|
|
111
|
+
return t = H(t), t in e ? Object.defineProperty(e, t, {
|
|
112
|
+
value: n,
|
|
113
|
+
enumerable: !0,
|
|
114
|
+
configurable: !0,
|
|
115
|
+
writable: !0
|
|
116
|
+
}) : e[t] = n, e;
|
|
117
|
+
}
|
|
118
|
+
function H(e) {
|
|
119
|
+
var t = U(e, "string");
|
|
120
|
+
return D(t) == "symbol" ? t : t + "";
|
|
121
|
+
}
|
|
122
|
+
function U(e, t) {
|
|
123
|
+
if (D(e) != "object" || !e) return e;
|
|
124
|
+
var n = e[Symbol.toPrimitive];
|
|
125
|
+
if (n !== void 0) {
|
|
126
|
+
var r = n.call(e, t || "default");
|
|
127
|
+
if (D(r) != "object") return r;
|
|
128
|
+
throw TypeError("@@toPrimitive must return a primitive value.");
|
|
129
|
+
}
|
|
130
|
+
return (t === "string" ? String : Number)(e);
|
|
131
|
+
}
|
|
132
|
+
var W = /* @__PURE__ */ function(e) {
|
|
133
|
+
function n() {
|
|
134
|
+
var e;
|
|
135
|
+
j(this, n);
|
|
136
|
+
var t = [...arguments];
|
|
137
|
+
return e = P(this, n, [].concat(t)), V(e, "state", { isAnimationFinished: !1 }), V(e, "handleAnimationEnd", function() {
|
|
138
|
+
e.setState({ isAnimationFinished: !0 });
|
|
139
|
+
}), V(e, "handleAnimationStart", function() {
|
|
140
|
+
e.setState({ isAnimationFinished: !1 });
|
|
141
|
+
}), V(e, "id", o("recharts-scatter-")), e;
|
|
142
|
+
}
|
|
143
|
+
return z(n, e), N(n, [
|
|
144
|
+
{
|
|
145
|
+
key: "renderSymbolsStatically",
|
|
146
|
+
value: function(e) {
|
|
147
|
+
var t = this, n = this.props, r = n.shape, i = n.activeShape, a = n.activeIndex, o = c(this.props, !1);
|
|
148
|
+
return e.map(function(e, n) {
|
|
149
|
+
var c = a === n, l = c ? i : r, d = A(A({}, o), e);
|
|
150
|
+
return /* @__PURE__ */ S.createElement(u, O({
|
|
151
|
+
className: "recharts-scatter-symbol",
|
|
152
|
+
key: `symbol-${e?.cx}-${e?.cy}-${e?.size}-${n}`
|
|
153
|
+
}, s(t.props, e, n), { role: "img" }), /* @__PURE__ */ S.createElement(x, O({
|
|
154
|
+
option: l,
|
|
155
|
+
isActive: c,
|
|
156
|
+
key: `symbol-${n}`
|
|
157
|
+
}, d)));
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
},
|
|
161
|
+
{
|
|
162
|
+
key: "renderSymbolsWithAnimation",
|
|
163
|
+
value: function() {
|
|
164
|
+
var e = this, t = this.props, n = t.points, r = t.isAnimationActive, i = t.animationBegin, o = t.animationDuration, s = t.animationEasing, c = t.animationId, l = this.state.prevPoints;
|
|
165
|
+
return /* @__PURE__ */ S.createElement(y, {
|
|
166
|
+
begin: i,
|
|
167
|
+
duration: o,
|
|
168
|
+
isActive: r,
|
|
169
|
+
easing: s,
|
|
170
|
+
from: { t: 0 },
|
|
171
|
+
to: { t: 1 },
|
|
172
|
+
key: `pie-${c}`,
|
|
173
|
+
onAnimationEnd: this.handleAnimationEnd,
|
|
174
|
+
onAnimationStart: this.handleAnimationStart
|
|
175
|
+
}, function(t) {
|
|
176
|
+
var r = t.t, i = n.map(function(e, t) {
|
|
177
|
+
var n = l && l[t];
|
|
178
|
+
if (n) {
|
|
179
|
+
var i = a(n.cx, e.cx), o = a(n.cy, e.cy), s = a(n.size, e.size);
|
|
180
|
+
return A(A({}, e), {}, {
|
|
181
|
+
cx: i(r),
|
|
182
|
+
cy: o(r),
|
|
183
|
+
size: s(r)
|
|
184
|
+
});
|
|
185
|
+
}
|
|
186
|
+
var c = a(0, e.size);
|
|
187
|
+
return A(A({}, e), {}, { size: c(r) });
|
|
188
|
+
});
|
|
189
|
+
return /* @__PURE__ */ S.createElement(u, null, e.renderSymbolsStatically(i));
|
|
190
|
+
});
|
|
191
|
+
}
|
|
192
|
+
},
|
|
193
|
+
{
|
|
194
|
+
key: "renderSymbols",
|
|
195
|
+
value: function() {
|
|
196
|
+
var e = this.props, t = e.points, n = e.isAnimationActive, r = this.state.prevPoints;
|
|
197
|
+
return n && t && t.length && (!r || !(0, T.default)(r, t)) ? this.renderSymbolsWithAnimation() : this.renderSymbolsStatically(t);
|
|
198
|
+
}
|
|
199
|
+
},
|
|
200
|
+
{
|
|
201
|
+
key: "renderErrorBar",
|
|
202
|
+
value: function() {
|
|
203
|
+
if (this.props.isAnimationActive && !this.state.isAnimationFinished) return null;
|
|
204
|
+
var e = this.props, t = e.points, n = e.xAxis, r = e.yAxis, i = e.children, a = l(i, m);
|
|
205
|
+
return a ? a.map(function(e, i) {
|
|
206
|
+
var a = e.props, o = a.direction, s = a.dataKey;
|
|
207
|
+
return /* @__PURE__ */ S.cloneElement(e, {
|
|
208
|
+
key: `${o}-${s}-${t[i]}`,
|
|
209
|
+
data: t,
|
|
210
|
+
xAxis: n,
|
|
211
|
+
yAxis: r,
|
|
212
|
+
layout: o === "x" ? "vertical" : "horizontal",
|
|
213
|
+
dataPointFormatter: function(e, t) {
|
|
214
|
+
return {
|
|
215
|
+
x: e.cx,
|
|
216
|
+
y: e.cy,
|
|
217
|
+
value: o === "x" ? +e.node.x : +e.node.y,
|
|
218
|
+
errorVal: g(e, t)
|
|
219
|
+
};
|
|
220
|
+
}
|
|
221
|
+
});
|
|
222
|
+
}) : null;
|
|
223
|
+
}
|
|
224
|
+
},
|
|
225
|
+
{
|
|
226
|
+
key: "renderLine",
|
|
227
|
+
value: function() {
|
|
228
|
+
var e = this.props, t = e.points, n = e.line, r = e.lineType, a = e.lineJointType, o = c(this.props, !1), s = c(n, !1), l, d;
|
|
229
|
+
if (r === "joint") l = t.map(function(e) {
|
|
230
|
+
return {
|
|
231
|
+
x: e.cx,
|
|
232
|
+
y: e.cy
|
|
233
|
+
};
|
|
234
|
+
});
|
|
235
|
+
else if (r === "fitting") {
|
|
236
|
+
var f = i(t), p = f.xmin, m = f.xmax, h = f.a, g = f.b, _ = function(e) {
|
|
237
|
+
return h * e + g;
|
|
238
|
+
};
|
|
239
|
+
l = [{
|
|
240
|
+
x: p,
|
|
241
|
+
y: _(p)
|
|
242
|
+
}, {
|
|
243
|
+
x: m,
|
|
244
|
+
y: _(m)
|
|
245
|
+
}];
|
|
246
|
+
}
|
|
247
|
+
var y = A(A(A({}, o), {}, {
|
|
248
|
+
fill: "none",
|
|
249
|
+
stroke: o && o.fill
|
|
250
|
+
}, s), {}, { points: l });
|
|
251
|
+
return d = /* @__PURE__ */ S.isValidElement(n) ? /* @__PURE__ */ S.cloneElement(n, y) : (0, E.default)(n) ? n(y) : /* @__PURE__ */ S.createElement(v, O({}, y, { type: a })), /* @__PURE__ */ S.createElement(u, {
|
|
252
|
+
className: "recharts-scatter-line",
|
|
253
|
+
key: "recharts-scatter-line"
|
|
254
|
+
}, d);
|
|
255
|
+
}
|
|
256
|
+
},
|
|
257
|
+
{
|
|
258
|
+
key: "render",
|
|
259
|
+
value: function() {
|
|
260
|
+
var e = this.props, n = e.hide, r = e.points, i = e.line, a = e.className, o = e.xAxis, s = e.yAxis, c = e.left, l = e.top, d = e.width, f = e.height, p = e.id, m = e.isAnimationActive;
|
|
261
|
+
if (n || !r || !r.length) return null;
|
|
262
|
+
var h = this.state.isAnimationFinished, g = t("recharts-scatter", a), v = o && o.allowDataOverflow, y = s && s.allowDataOverflow, b = v || y, x = (0, w.default)(p) ? this.id : p;
|
|
263
|
+
return /* @__PURE__ */ S.createElement(u, {
|
|
264
|
+
className: g,
|
|
265
|
+
clipPath: b ? `url(#clipPath-${x})` : null
|
|
266
|
+
}, v || y ? /* @__PURE__ */ S.createElement("defs", null, /* @__PURE__ */ S.createElement("clipPath", { id: `clipPath-${x}` }, /* @__PURE__ */ S.createElement("rect", {
|
|
267
|
+
x: v ? c : c - d / 2,
|
|
268
|
+
y: y ? l : l - f / 2,
|
|
269
|
+
width: v ? d : d * 2,
|
|
270
|
+
height: y ? f : f * 2
|
|
271
|
+
}))) : null, i && this.renderLine(), this.renderErrorBar(), /* @__PURE__ */ S.createElement(u, { key: "recharts-scatter-symbols" }, this.renderSymbols()), (!m || h) && _.renderCallByParent(this.props, r));
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
], [{
|
|
275
|
+
key: "getDerivedStateFromProps",
|
|
276
|
+
value: function(e, t) {
|
|
277
|
+
return e.animationId === t.prevAnimationId ? e.points === t.curPoints ? null : { curPoints: e.points } : {
|
|
278
|
+
prevAnimationId: e.animationId,
|
|
279
|
+
curPoints: e.points,
|
|
280
|
+
prevPoints: t.curPoints
|
|
281
|
+
};
|
|
282
|
+
}
|
|
283
|
+
}]);
|
|
284
|
+
}(C);
|
|
285
|
+
V(W, "displayName", "Scatter"), V(W, "defaultProps", {
|
|
286
|
+
xAxisId: 0,
|
|
287
|
+
yAxisId: 0,
|
|
288
|
+
zAxisId: 0,
|
|
289
|
+
legendType: "circle",
|
|
290
|
+
lineType: "joint",
|
|
291
|
+
lineJointType: "linear",
|
|
292
|
+
data: [],
|
|
293
|
+
shape: "circle",
|
|
294
|
+
hide: !1,
|
|
295
|
+
isAnimationActive: !d.isSsr,
|
|
296
|
+
animationBegin: 0,
|
|
297
|
+
animationDuration: 400,
|
|
298
|
+
animationEasing: "linear"
|
|
299
|
+
}), V(W, "getComposedData", function(e) {
|
|
300
|
+
var t = e.xAxis, n = e.yAxis, r = e.zAxis, i = e.item, a = e.displayedData, o = e.xAxisTicks, s = e.yAxisTicks, c = e.offset, u = i.props.tooltipType, d = l(i.props.children, f), p = (0, w.default)(t.dataKey) ? i.props.dataKey : t.dataKey, m = (0, w.default)(n.dataKey) ? i.props.dataKey : n.dataKey, _ = r && r.dataKey, v = r ? r.range : b.defaultProps.range, y = v && v[0], x = t.scale.bandwidth ? t.scale.bandwidth() : 0, S = n.scale.bandwidth ? n.scale.bandwidth() : 0;
|
|
301
|
+
return A({ points: a.map(function(e, a) {
|
|
302
|
+
var c = g(e, p), l = g(e, m), f = !(0, w.default)(_) && g(e, _) || "-", v = [{
|
|
303
|
+
name: (0, w.default)(t.dataKey) ? i.props.name : t.name || t.dataKey,
|
|
304
|
+
unit: t.unit || "",
|
|
305
|
+
value: c,
|
|
306
|
+
payload: e,
|
|
307
|
+
dataKey: p,
|
|
308
|
+
type: u
|
|
309
|
+
}, {
|
|
310
|
+
name: (0, w.default)(n.dataKey) ? i.props.name : n.name || n.dataKey,
|
|
311
|
+
unit: n.unit || "",
|
|
312
|
+
value: l,
|
|
313
|
+
payload: e,
|
|
314
|
+
dataKey: m,
|
|
315
|
+
type: u
|
|
316
|
+
}];
|
|
317
|
+
f !== "-" && v.push({
|
|
318
|
+
name: r.name || r.dataKey,
|
|
319
|
+
unit: r.unit || "",
|
|
320
|
+
value: f,
|
|
321
|
+
payload: e,
|
|
322
|
+
dataKey: _,
|
|
323
|
+
type: u
|
|
324
|
+
});
|
|
325
|
+
var b = h({
|
|
326
|
+
axis: t,
|
|
327
|
+
ticks: o,
|
|
328
|
+
bandSize: x,
|
|
329
|
+
entry: e,
|
|
330
|
+
index: a,
|
|
331
|
+
dataKey: p
|
|
332
|
+
}), C = h({
|
|
333
|
+
axis: n,
|
|
334
|
+
ticks: s,
|
|
335
|
+
bandSize: S,
|
|
336
|
+
entry: e,
|
|
337
|
+
index: a,
|
|
338
|
+
dataKey: m
|
|
339
|
+
}), T = f === "-" ? y : r.scale(f), E = Math.sqrt(Math.max(T, 0) / Math.PI);
|
|
340
|
+
return A(A({}, e), {}, {
|
|
341
|
+
cx: b,
|
|
342
|
+
cy: C,
|
|
343
|
+
x: b - E,
|
|
344
|
+
y: C - E,
|
|
345
|
+
xAxis: t,
|
|
346
|
+
yAxis: n,
|
|
347
|
+
zAxis: r,
|
|
348
|
+
width: 2 * E,
|
|
349
|
+
height: 2 * E,
|
|
350
|
+
size: T,
|
|
351
|
+
node: {
|
|
352
|
+
x: c,
|
|
353
|
+
y: l,
|
|
354
|
+
z: f
|
|
355
|
+
},
|
|
356
|
+
tooltipPayload: v,
|
|
357
|
+
tooltipPosition: {
|
|
358
|
+
x: b,
|
|
359
|
+
y: C
|
|
360
|
+
},
|
|
361
|
+
payload: e
|
|
362
|
+
}, d && d[a] && d[a].props);
|
|
363
|
+
}) }, c);
|
|
364
|
+
});
|
|
365
|
+
//#endregion
|
|
366
|
+
export { W as Scatter };
|
|
367
|
+
|
|
368
|
+
//# sourceMappingURL=Scatter.js.map
|