@burdenoff/microfe-healthybowl 2026.904.21 → 2026.904.22
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/components/assistant/AssistantChatArea.js +7 -9
- package/dist/components/assistant/AssistantChatArea.js.map +1 -1
- package/dist/healthybowl/HealthyBowlRoot.js +56 -57
- package/dist/healthybowl/HealthyBowlRoot.js.map +1 -1
- package/dist/healthybowl/HealthyBowlRoutes.js +36 -48
- package/dist/healthybowl/HealthyBowlRoutes.js.map +1 -1
- package/dist/healthybowl/components/CreateFarmTaskButton.js.map +1 -1
- package/dist/healthybowl/components/PageLayout.js +10 -11
- package/dist/healthybowl/components/PageLayout.js.map +1 -1
- package/dist/healthybowl/context/HealthyBowlContext.js +7 -7
- package/dist/healthybowl/context/HealthyBowlContext.js.map +1 -1
- package/dist/healthybowl/hooks/useHealthyBowlCompliance.js +141 -157
- package/dist/healthybowl/hooks/useHealthyBowlCompliance.js.map +1 -1
- package/dist/healthybowl/hooks/useHealthyBowlData.js +0 -18
- package/dist/healthybowl/hooks/useHealthyBowlData.js.map +1 -1
- package/dist/healthybowl/hooks/useHealthyBowlDistribution.js +37 -52
- package/dist/healthybowl/hooks/useHealthyBowlDistribution.js.map +1 -1
- package/dist/healthybowl/hooks/useHealthyBowlLivestockDepth.js +78 -135
- package/dist/healthybowl/hooks/useHealthyBowlLivestockDepth.js.map +1 -1
- package/dist/healthybowl/hooks/useIrrigationAutomation.js +1 -1
- package/dist/healthybowl/hooks/useIrrigationAutomation.js.map +1 -1
- package/dist/healthybowl/hooks/useSuccessionPlanning.js +1 -1
- package/dist/healthybowl/hooks/useSuccessionPlanning.js.map +1 -1
- package/dist/healthybowl/hooks/useWeatherIntelligence.js +1 -1
- package/dist/healthybowl/hooks/useWeatherIntelligence.js.map +1 -1
- package/dist/healthybowl/offline/OfflineStatusPill.js +21 -40
- package/dist/healthybowl/offline/OfflineStatusPill.js.map +1 -1
- package/dist/healthybowl/offline/OfflineSyncProvider.js +130 -153
- package/dist/healthybowl/offline/OfflineSyncProvider.js.map +1 -1
- package/dist/healthybowl/offline/graphql.js.map +1 -1
- package/dist/healthybowl/offline/store.js +1 -1
- package/dist/healthybowl/offline/syncEngine.js +1 -2
- package/dist/healthybowl/offline/syncEngine.js.map +1 -1
- package/dist/healthybowl/offline/types.js.map +1 -1
- package/dist/healthybowl/pages/GettingStartedPage.js +0 -1
- package/dist/healthybowl/pages/GettingStartedPage.js.map +1 -1
- package/dist/healthybowl/pages/analytics/InsightsPage.js +2 -2
- package/dist/healthybowl/pages/analytics/InsightsPage.js.map +1 -1
- package/dist/healthybowl/pages/analytics/ReportsPage.js +99 -136
- package/dist/healthybowl/pages/analytics/ReportsPage.js.map +1 -1
- package/dist/healthybowl/pages/compliance/ComplianceOverviewPage.js +162 -204
- package/dist/healthybowl/pages/compliance/ComplianceOverviewPage.js.map +1 -1
- package/dist/healthybowl/pages/compliance/IcsGroupDetailPage.js +178 -196
- package/dist/healthybowl/pages/compliance/IcsGroupDetailPage.js.map +1 -1
- package/dist/healthybowl/pages/compliance/IcsGrowerDetailPage.js +141 -142
- package/dist/healthybowl/pages/compliance/IcsGrowerDetailPage.js.map +1 -1
- package/dist/healthybowl/pages/crops/CropFieldsPage.js +0 -2
- package/dist/healthybowl/pages/crops/CropFieldsPage.js.map +1 -1
- package/dist/healthybowl/pages/crops/CropHarvestPage.js +272 -316
- package/dist/healthybowl/pages/crops/CropHarvestPage.js.map +1 -1
- package/dist/healthybowl/pages/crops/CropPlanningPage.js +0 -6
- package/dist/healthybowl/pages/crops/CropPlanningPage.js.map +1 -1
- package/dist/healthybowl/pages/crops/FieldDetailsPage.js +846 -871
- package/dist/healthybowl/pages/crops/FieldDetailsPage.js.map +1 -1
- package/dist/healthybowl/pages/crops/HarvestDetailsPage.js +334 -376
- package/dist/healthybowl/pages/crops/HarvestDetailsPage.js.map +1 -1
- package/dist/healthybowl/pages/distribution/CsaPlanDetailPage.js +188 -415
- package/dist/healthybowl/pages/distribution/CsaPlanDetailPage.js.map +1 -1
- package/dist/healthybowl/pages/distribution/labels.js +2 -10
- package/dist/healthybowl/pages/distribution/labels.js.map +1 -1
- package/dist/healthybowl/pages/farm/FarmProfilePage.js +0 -1
- package/dist/healthybowl/pages/farm/FarmProfilePage.js.map +1 -1
- package/dist/healthybowl/pages/field-capture/CaptureObservationForm.js +8 -8
- package/dist/healthybowl/pages/fields/FieldMapPage.js +0 -2
- package/dist/healthybowl/pages/fields/FieldMapPage.js.map +1 -1
- package/dist/healthybowl/pages/financial/FinancialReportsPage.js +107 -92
- package/dist/healthybowl/pages/financial/FinancialReportsPage.js.map +1 -1
- package/dist/healthybowl/pages/government-schemes/ApplicationTrackingPage.js +188 -228
- package/dist/healthybowl/pages/government-schemes/ApplicationTrackingPage.js.map +1 -1
- package/dist/healthybowl/pages/government-schemes/SchemeDetailsPage.js +191 -261
- package/dist/healthybowl/pages/government-schemes/SchemeDetailsPage.js.map +1 -1
- package/dist/healthybowl/pages/inputs-insurance/InputsInsuranceOverviewPage.js +14 -14
- package/dist/healthybowl/pages/inputs-insurance/InputsInsuranceOverviewPage.js.map +1 -1
- package/dist/healthybowl/pages/irrigation/IrrigationPage.js +307 -338
- package/dist/healthybowl/pages/irrigation/IrrigationPage.js.map +1 -1
- package/dist/healthybowl/pages/livestock/AnimalDepthFormModal.js +102 -126
- package/dist/healthybowl/pages/livestock/AnimalDepthFormModal.js.map +1 -1
- package/dist/healthybowl/pages/livestock/AnimalDepthPage.js +215 -257
- package/dist/healthybowl/pages/livestock/AnimalDepthPage.js.map +1 -1
- package/dist/healthybowl/pages/livestock/GrazingPage.js +0 -1
- package/dist/healthybowl/pages/livestock/GrazingPage.js.map +1 -1
- package/dist/healthybowl/pages/livestock/HerdDepthPage.js +0 -4
- package/dist/healthybowl/pages/livestock/HerdDepthPage.js.map +1 -1
- package/dist/healthybowl/pages/livestock/grazing/RecordGrazingMoveModal.js +9 -8
- package/dist/healthybowl/pages/livestock/grazing/RecordGrazingMoveModal.js.map +1 -1
- package/dist/healthybowl/pages/network/ExpertsPage.js +419 -520
- package/dist/healthybowl/pages/network/ExpertsPage.js.map +1 -1
- package/dist/healthybowl/pages/weather/WeatherAlertHistoryPage.js +130 -129
- package/dist/healthybowl/pages/weather/WeatherAlertHistoryPage.js.map +1 -1
- package/dist/healthybowl/pages/weather/WeatherSettingsPage.js +237 -285
- package/dist/healthybowl/pages/weather/WeatherSettingsPage.js.map +1 -1
- package/dist/healthybowl/utils/plantingCapacity.js +10 -10
- package/dist/healthybowl/utils/plantingCapacity.js.map +1 -1
- package/dist/node_modules/fast-equals/dist/es/index.js +86 -74
- package/dist/node_modules/fast-equals/dist/es/index.js.map +1 -1
- package/dist/services/assistantApi.js +30 -59
- package/dist/services/assistantApi.js.map +1 -1
- package/dist/utils/pageContext.js +1 -15
- package/dist/utils/pageContext.js.map +1 -1
- package/package.json +1 -1
- package/dist/healthybowl/hooks/useAgronomyDecisions.js +0 -79
- package/dist/healthybowl/hooks/useAgronomyDecisions.js.map +0 -1
- package/dist/healthybowl/hooks/useAnalyticsReports.js +0 -173
- package/dist/healthybowl/hooks/useAnalyticsReports.js.map +0 -1
- package/dist/healthybowl/hooks/useComplianceExports.js +0 -74
- package/dist/healthybowl/hooks/useComplianceExports.js.map +0 -1
- package/dist/healthybowl/hooks/useConsultationPayments.js +0 -59
- package/dist/healthybowl/hooks/useConsultationPayments.js.map +0 -1
- package/dist/healthybowl/hooks/usePlantingEstimate.js +0 -88
- package/dist/healthybowl/hooks/usePlantingEstimate.js.map +0 -1
- package/dist/healthybowl/offline/HeaderOfflinePill.js +0 -28
- package/dist/healthybowl/offline/HeaderOfflinePill.js.map +0 -1
- package/dist/healthybowl/offline/captureCache.js +0 -30
- package/dist/healthybowl/offline/captureCache.js.map +0 -1
- package/dist/healthybowl/offline/headerSlot.js +0 -24
- package/dist/healthybowl/offline/headerSlot.js.map +0 -1
- package/dist/healthybowl/pages/ai/AiDecisionsPage.js +0 -287
- package/dist/healthybowl/pages/ai/AiDecisionsPage.js.map +0 -1
- package/dist/healthybowl/pages/compliance/ResidueTestsPage.js +0 -291
- package/dist/healthybowl/pages/compliance/ResidueTestsPage.js.map +0 -1
- package/dist/healthybowl/pages/compliance/SubstanceRulesPage.js +0 -300
- package/dist/healthybowl/pages/compliance/SubstanceRulesPage.js.map +0 -1
- package/dist/healthybowl/pages/compliance/substanceRuleForm.js +0 -135
- package/dist/healthybowl/pages/compliance/substanceRuleForm.js.map +0 -1
- package/dist/healthybowl/pages/government-schemes/schemeApplicationTransitions.js +0 -49
- package/dist/healthybowl/pages/government-schemes/schemeApplicationTransitions.js.map +0 -1
- package/dist/healthybowl/pages/government-schemes/schemeDocumentSlots.js +0 -48
- package/dist/healthybowl/pages/government-schemes/schemeDocumentSlots.js.map +0 -1
- package/dist/healthybowl/pages/government-schemes/useSchemeApplicationTransition.js +0 -54
- package/dist/healthybowl/pages/government-schemes/useSchemeApplicationTransition.js.map +0 -1
- package/dist/healthybowl/pages/livestock/PedigreeTree.js +0 -154
- package/dist/healthybowl/pages/livestock/PedigreeTree.js.map +0 -1
- package/dist/healthybowl/pages/livestock/eidTagInput.js +0 -39
- package/dist/healthybowl/pages/livestock/eidTagInput.js.map +0 -1
- package/dist/healthybowl/pages/livestock/pedigreeLayout.js +0 -68
- package/dist/healthybowl/pages/livestock/pedigreeLayout.js.map +0 -1
- package/dist/healthybowl/pages/weather/alertDelivery.js +0 -105
- package/dist/healthybowl/pages/weather/alertDelivery.js.map +0 -1
- package/dist/healthybowl/utils/icsInspection.js +0 -18
- package/dist/healthybowl/utils/icsInspection.js.map +0 -1
|
@@ -3,7 +3,7 @@ import { useCallback as t, useMemo as ee } from "react";
|
|
|
3
3
|
import { gql as n } from "@apollo/client";
|
|
4
4
|
import { useMutation as r, useQuery as i } from "@apollo/client/react";
|
|
5
5
|
//#region src/healthybowl/hooks/useHealthyBowlDistribution.ts
|
|
6
|
-
var te = "00000000-0000-0000-0000-000000000001", a = "\n id\n name\n description\n frequency\n price\n currency\n boxSize\n contents { \n productId\n productName\n quantity\n unit\n }\n deliveryDayOfWeek\n startDate\n endDate\n capacity\n status\n recurringBillingPlanId\n billingSyncStatus\n billingSyncError\n activeMemberCount\n pausedMemberCount\n assignedMemberCount\n capacityRemaining\n capacityUtilisationPct\n atCapacity\n capacityReason\n createdAt\n", o = "\n id\n csaPlanId\n csaPlanName\n memberUserId\n memberName\n memberEmail\n memberPhone\n deliveryAddress\n lat\n lng\n fulfilmentMode\n pickupLocationId\n pickupLocationName\n status\n startDate\n nextDeliveryDate\n pausedUntil\n cycleCount\n billingAccountId\n billingSyncStatus\n billingSyncError\n createdAt\n", s = "\n id\n csaMembershipId\n csaPlanId\n memberName\n cycleNumber\n scheduledDate\n status\n orderId\n billingOrderId\n
|
|
6
|
+
var te = "00000000-0000-0000-0000-000000000001", a = "\n id\n name\n description\n frequency\n price\n currency\n boxSize\n contents { \n productId\n productName\n quantity\n unit\n }\n deliveryDayOfWeek\n startDate\n endDate\n capacity\n status\n recurringBillingPlanId\n billingSyncStatus\n billingSyncError\n activeMemberCount\n pausedMemberCount\n assignedMemberCount\n capacityRemaining\n capacityUtilisationPct\n atCapacity\n capacityReason\n createdAt\n", o = "\n id\n csaPlanId\n csaPlanName\n memberUserId\n memberName\n memberEmail\n memberPhone\n deliveryAddress\n lat\n lng\n fulfilmentMode\n pickupLocationId\n pickupLocationName\n status\n startDate\n nextDeliveryDate\n pausedUntil\n cycleCount\n billingAccountId\n billingSyncStatus\n billingSyncError\n createdAt\n", s = "\n id\n csaMembershipId\n csaPlanId\n memberName\n cycleNumber\n scheduledDate\n status\n orderId\n billingOrderId\n billingSyncStatus\n billingSyncError\n workflowRunId\n notificationSentAt\n deliveredAt\n lat\n lng\n deliveryAddress\n notes\n", c = "\n id\n orderId\n orderNumber\n buyerName\n buyerContact\n buyerUserId\n productId\n productName\n quantityKg\n pricePerKg\n appliedTierId\n priceSource\n totalAmount\n fulfilmentStatus\n expectedDeliveryDate\n orderDate\n notes\n", l = "\n id\n productName\n productId\n minQuantityKg\n pricePerKg\n createdAt\n", u = "\n id\n sequence\n csaDeliveryId\n label\n address\n lat\n lng\n status\n memberName\n notificationSentAt\n arrivedAt\n notes\n", d = `
|
|
7
7
|
id
|
|
8
8
|
name
|
|
9
9
|
routeDate
|
|
@@ -23,15 +23,15 @@ var te = "00000000-0000-0000-0000-000000000001", a = "\n id\n name\n descript
|
|
|
23
23
|
query GetHealthyBowlChannelOrders($context: ContextInput!, $channel: String, $limit: Int, $offset: Int) {
|
|
24
24
|
getHealthyBowlChannelOrders(context: $context, channel: $channel, limit: $limit, offset: $offset) { ${f} }
|
|
25
25
|
}
|
|
26
|
-
`,
|
|
26
|
+
`, ie = n`
|
|
27
27
|
query GetHealthyBowlCsaPlans($context: ContextInput!, $status: String) {
|
|
28
28
|
getHealthyBowlCsaPlans(context: $context, status: $status) { ${a} }
|
|
29
29
|
}
|
|
30
|
-
`,
|
|
30
|
+
`, p = n`
|
|
31
31
|
query GetHealthyBowlCsaPlan($context: ContextInput!, $id: ID!) {
|
|
32
32
|
getHealthyBowlCsaPlan(context: $context, id: $id) { ${a} }
|
|
33
33
|
}
|
|
34
|
-
`,
|
|
34
|
+
`, m = n`
|
|
35
35
|
query GetHealthyBowlCsaMemberships(
|
|
36
36
|
$context: ContextInput!
|
|
37
37
|
$csaPlanId: ID
|
|
@@ -47,21 +47,7 @@ var te = "00000000-0000-0000-0000-000000000001", a = "\n id\n name\n descript
|
|
|
47
47
|
offset: $offset
|
|
48
48
|
) { ${o} }
|
|
49
49
|
}
|
|
50
|
-
`,
|
|
51
|
-
query GetHealthyBowlCsaDeliveries(
|
|
52
|
-
$context: ContextInput!
|
|
53
|
-
$csaMembershipId: ID
|
|
54
|
-
$limit: Int
|
|
55
|
-
$offset: Int
|
|
56
|
-
) {
|
|
57
|
-
getHealthyBowlCsaDeliveries(
|
|
58
|
-
context: $context
|
|
59
|
-
csaMembershipId: $csaMembershipId
|
|
60
|
-
limit: $limit
|
|
61
|
-
offset: $offset
|
|
62
|
-
) { ${s} }
|
|
63
|
-
}
|
|
64
|
-
`, ie = n`
|
|
50
|
+
`, h = n`
|
|
65
51
|
query GetHealthyBowlWholesaleOrders($context: ContextInput!, $fulfilmentStatus: String, $limit: Int, $offset: Int) {
|
|
66
52
|
getHealthyBowlWholesaleOrders(
|
|
67
53
|
context: $context
|
|
@@ -70,7 +56,7 @@ var te = "00000000-0000-0000-0000-000000000001", a = "\n id\n name\n descript
|
|
|
70
56
|
offset: $offset
|
|
71
57
|
) { ${c} }
|
|
72
58
|
}
|
|
73
|
-
`,
|
|
59
|
+
`, g = n`
|
|
74
60
|
query GetHealthyBowlDeliveryRoutes($context: ContextInput!, $fromDate: String, $toDate: String) {
|
|
75
61
|
getHealthyBowlDeliveryRoutes(context: $context, fromDate: $fromDate, toDate: $toDate) { ${d} }
|
|
76
62
|
}
|
|
@@ -78,51 +64,51 @@ var te = "00000000-0000-0000-0000-000000000001", a = "\n id\n name\n descript
|
|
|
78
64
|
query GetHealthyBowlDeliveryRoute($context: ContextInput!, $id: ID!) {
|
|
79
65
|
getHealthyBowlDeliveryRoute(context: $context, id: $id) { ${d} }
|
|
80
66
|
}
|
|
81
|
-
`,
|
|
67
|
+
`, ae = n`
|
|
82
68
|
mutation CreateHealthyBowlCsaPlan($input: CreateHealthyBowlCsaPlanInput!) {
|
|
83
69
|
createHealthyBowlCsaPlan(input: $input) { ${a} }
|
|
84
70
|
}
|
|
85
|
-
`,
|
|
71
|
+
`, oe = n`
|
|
86
72
|
mutation UpdateHealthyBowlCsaPlan($input: UpdateHealthyBowlCsaPlanInput!) {
|
|
87
73
|
updateHealthyBowlCsaPlan(input: $input) { ${a} }
|
|
88
74
|
}
|
|
89
|
-
`,
|
|
75
|
+
`, se = n`
|
|
90
76
|
mutation DeleteHealthyBowlCsaPlan($id: ID!, $context: ContextInput!) {
|
|
91
77
|
deleteHealthyBowlCsaPlan(id: $id, context: $context)
|
|
92
78
|
}
|
|
93
|
-
`,
|
|
79
|
+
`, ce = n`
|
|
94
80
|
mutation EnrollHealthyBowlCsaMember($input: EnrollHealthyBowlCsaMemberInput!) {
|
|
95
81
|
enrollHealthyBowlCsaMember(input: $input) { ${o} }
|
|
96
82
|
}
|
|
97
|
-
`,
|
|
83
|
+
`, le = n`
|
|
98
84
|
mutation UpdateHealthyBowlCsaMembership($input: UpdateHealthyBowlCsaMembershipInput!) {
|
|
99
85
|
updateHealthyBowlCsaMembership(input: $input) { ${o} }
|
|
100
86
|
}
|
|
101
|
-
`,
|
|
87
|
+
`, ue = n`
|
|
102
88
|
mutation CancelHealthyBowlCsaMembership($id: ID!, $context: ContextInput!) {
|
|
103
89
|
cancelHealthyBowlCsaMembership(id: $id, context: $context) { ${o} }
|
|
104
90
|
}
|
|
105
|
-
`,
|
|
91
|
+
`, de = n`
|
|
106
92
|
mutation RenewHealthyBowlCsaMembership($input: RenewHealthyBowlCsaMembershipInput!) {
|
|
107
93
|
renewHealthyBowlCsaMembership(input: $input) { ${o} }
|
|
108
94
|
}
|
|
109
|
-
`,
|
|
95
|
+
`, fe = n`
|
|
110
96
|
mutation RetryHealthyBowlCsaBilling($csaDeliveryId: ID!, $context: ContextInput!) {
|
|
111
97
|
retryHealthyBowlCsaBilling(csaDeliveryId: $csaDeliveryId, context: $context) { ${s} }
|
|
112
98
|
}
|
|
113
|
-
`,
|
|
99
|
+
`, v = n`
|
|
114
100
|
mutation UpdateHealthyBowlCsaDelivery($input: UpdateHealthyBowlCsaDeliveryInput!) {
|
|
115
101
|
updateHealthyBowlCsaDelivery(input: $input) { ${s} }
|
|
116
102
|
}
|
|
117
|
-
`,
|
|
103
|
+
`, y = n`
|
|
118
104
|
mutation CreateHealthyBowlWholesaleOrder($input: CreateHealthyBowlWholesaleOrderInput!) {
|
|
119
105
|
createHealthyBowlWholesaleOrder(input: $input) { ${c} }
|
|
120
106
|
}
|
|
121
|
-
`,
|
|
107
|
+
`, b = n`
|
|
122
108
|
mutation UpdateHealthyBowlWholesaleOrder($input: UpdateHealthyBowlWholesaleOrderInput!) {
|
|
123
109
|
updateHealthyBowlWholesaleOrder(input: $input) { ${c} }
|
|
124
110
|
}
|
|
125
|
-
`,
|
|
111
|
+
`, pe = n`
|
|
126
112
|
mutation DeleteHealthyBowlWholesaleOrder($id: ID!, $context: ContextInput!) {
|
|
127
113
|
deleteHealthyBowlWholesaleOrder(id: $id, context: $context)
|
|
128
114
|
}
|
|
@@ -130,69 +116,69 @@ var te = "00000000-0000-0000-0000-000000000001", a = "\n id\n name\n descript
|
|
|
130
116
|
query GetHealthyBowlWholesalePriceTiers($context: ContextInput!, $productName: String!) {
|
|
131
117
|
getHealthyBowlWholesalePriceTiers(context: $context, productName: $productName) { ${l} }
|
|
132
118
|
}
|
|
133
|
-
`,
|
|
119
|
+
`, me = n`
|
|
134
120
|
mutation SetHealthyBowlWholesalePriceTiers($input: SetHealthyBowlWholesalePriceTiersInput!) {
|
|
135
121
|
setHealthyBowlWholesalePriceTiers(input: $input) { ${l} }
|
|
136
122
|
}
|
|
137
|
-
`,
|
|
123
|
+
`, he = n`
|
|
138
124
|
mutation GenerateHealthyBowlDeliveryRoute($input: GenerateHealthyBowlDeliveryRouteInput!) {
|
|
139
125
|
generateHealthyBowlDeliveryRoute(input: $input) { ${d} }
|
|
140
126
|
}
|
|
141
|
-
`,
|
|
127
|
+
`, ge = n`
|
|
142
128
|
mutation UpdateHealthyBowlDeliveryStop($input: UpdateHealthyBowlDeliveryStopInput!) {
|
|
143
129
|
updateHealthyBowlDeliveryStop(input: $input) { ${u} }
|
|
144
130
|
}
|
|
145
|
-
`,
|
|
131
|
+
`, _e = n`
|
|
146
132
|
mutation DeleteHealthyBowlDeliveryRoute($id: ID!, $context: ContextInput!) {
|
|
147
133
|
deleteHealthyBowlDeliveryRoute(id: $id, context: $context)
|
|
148
134
|
}
|
|
149
|
-
`,
|
|
135
|
+
`, ve = n`
|
|
150
136
|
mutation DispatchHealthyBowlDeliveryRoute($id: ID!, $context: ContextInput!) {
|
|
151
137
|
dispatchHealthyBowlDeliveryRoute(id: $id, context: $context) { ${d} }
|
|
152
138
|
}
|
|
153
139
|
`;
|
|
154
140
|
function S(n = {}) {
|
|
155
|
-
let { workspaceId: a } = e(), o = a || te, s = ee(() => ({ workspaceId: o }), [o]), c = n.summary === !0, l = n.channelOrders === !0, u = n.plans === !0, d = n.wholesale === !0, f = n.wholesaleTiers === !0 && !!n.wholesaleTiersProduct, S = n.routes === !0,
|
|
141
|
+
let { workspaceId: a } = e(), o = a || te, s = ee(() => ({ workspaceId: o }), [o]), c = n.summary === !0, l = n.channelOrders === !0, u = n.plans === !0, d = n.wholesale === !0, f = n.wholesaleTiers === !0 && !!n.wholesaleTiersProduct, S = n.routes === !0, ye = n.channel ?? null, be = n.plansStatus ?? null, xe = n.wholesaleStatus ?? null, Se = n.wholesaleTiersProduct ?? null, Ce = n.routesRange?.fromDate ?? null, we = n.routesRange?.toDate ?? null, C = i(ne, {
|
|
156
142
|
variables: { context: s },
|
|
157
143
|
fetchPolicy: "cache-and-network",
|
|
158
144
|
skip: !c
|
|
159
145
|
}), w = i(re, {
|
|
160
146
|
variables: {
|
|
161
147
|
context: s,
|
|
162
|
-
channel:
|
|
148
|
+
channel: ye,
|
|
163
149
|
limit: 100,
|
|
164
150
|
offset: 0
|
|
165
151
|
},
|
|
166
152
|
fetchPolicy: "cache-and-network",
|
|
167
153
|
skip: !l
|
|
168
|
-
}), T = i(
|
|
154
|
+
}), T = i(ie, {
|
|
169
155
|
variables: {
|
|
170
156
|
context: s,
|
|
171
|
-
status:
|
|
157
|
+
status: be
|
|
172
158
|
},
|
|
173
159
|
fetchPolicy: "cache-and-network",
|
|
174
160
|
skip: !u
|
|
175
|
-
}), E = i(
|
|
161
|
+
}), E = i(h, {
|
|
176
162
|
variables: {
|
|
177
163
|
context: s,
|
|
178
|
-
fulfilmentStatus:
|
|
164
|
+
fulfilmentStatus: xe,
|
|
179
165
|
limit: 100,
|
|
180
166
|
offset: 0
|
|
181
167
|
},
|
|
182
168
|
fetchPolicy: "cache-and-network",
|
|
183
169
|
skip: !d
|
|
184
|
-
}), D = i(
|
|
170
|
+
}), D = i(g, {
|
|
185
171
|
variables: {
|
|
186
172
|
context: s,
|
|
187
|
-
fromDate:
|
|
188
|
-
toDate:
|
|
173
|
+
fromDate: Ce,
|
|
174
|
+
toDate: we
|
|
189
175
|
},
|
|
190
176
|
fetchPolicy: "cache-and-network",
|
|
191
177
|
skip: !S
|
|
192
178
|
}), O = i(x, {
|
|
193
179
|
variables: {
|
|
194
180
|
context: s,
|
|
195
|
-
productName:
|
|
181
|
+
productName: Se ?? ""
|
|
196
182
|
},
|
|
197
183
|
fetchPolicy: "cache-and-network",
|
|
198
184
|
skip: !f
|
|
@@ -212,7 +198,7 @@ function S(n = {}) {
|
|
|
212
198
|
M,
|
|
213
199
|
N,
|
|
214
200
|
P
|
|
215
|
-
]), [I] = r(
|
|
201
|
+
]), [I] = r(ae), [L] = r(oe), [R] = r(se), [z] = r(ce), [B] = r(le), [V] = r(ue), [H] = r(de), [U] = r(fe), [W] = r(v), [G] = r(y), [K] = r(b), [q] = r(pe), [J] = r(me), [Y] = r(he), [X] = r(ge), [Z] = r(_e), [Q] = r(ve), $ = t((e) => ({
|
|
216
202
|
...e,
|
|
217
203
|
context: s
|
|
218
204
|
}), [s]);
|
|
@@ -421,9 +407,8 @@ function S(n = {}) {
|
|
|
421
407
|
F
|
|
422
408
|
]),
|
|
423
409
|
documents: {
|
|
424
|
-
GET_CSA_PLAN:
|
|
425
|
-
GET_CSA_MEMBERSHIPS:
|
|
426
|
-
GET_CSA_DELIVERIES: g,
|
|
410
|
+
GET_CSA_PLAN: p,
|
|
411
|
+
GET_CSA_MEMBERSHIPS: m,
|
|
427
412
|
GET_DELIVERY_ROUTE: _,
|
|
428
413
|
GET_WHOLESALE_PRICE_TIERS: x
|
|
429
414
|
},
|
|
@@ -431,6 +416,6 @@ function S(n = {}) {
|
|
|
431
416
|
};
|
|
432
417
|
}
|
|
433
418
|
//#endregion
|
|
434
|
-
export {
|
|
419
|
+
export { m as GET_CSA_MEMBERSHIPS, p as GET_CSA_PLAN, _ as GET_DELIVERY_ROUTE, x as GET_WHOLESALE_PRICE_TIERS, S as useHealthyBowlDistribution };
|
|
435
420
|
|
|
436
421
|
//# sourceMappingURL=useHealthyBowlDistribution.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useHealthyBowlDistribution.js","names":[],"sources":["../../../src/healthybowl/hooks/useHealthyBowlDistribution.ts"],"sourcesContent":["/**\n * Distribution & Sales Channels — data hook.\n * Roadmap 12 · BOFF-2884 · gap H-4.\n *\n * CSA subscription boxes, wholesale bulk orders, and delivery-route planning, plus a\n * per-Order `channel` tag. Documents are declared inline with `gql` (not as\n * `src/operations/wspace/*.graphql`) because codegen validates operations against the\n * committed `graphql/wspace.graphql` snapshot, which can't know about these fields until\n * the subgraph is live in the supergraph — the same escape hatch `useHealthyBowlWithdrawal`\n * uses. Types mirror `wspace-healthybowl-svc/src/modules/healthybowl/schema/distribution.gql`.\n *\n * Reads use `cache-and-network`; every write throws on error then refetches the reads it\n * invalidates. Pages opt into only the reads they render (all default off) so a page never\n * fires a query it doesn't use.\n */\n\nimport { useCallback, useMemo } from 'react';\nimport { gql } from '@apollo/client';\nimport { useMutation, useQuery } from '@apollo/client/react';\nimport { useHealthyBowl } from '../context/HealthyBowlContext';\n\nconst FALLBACK_WORKSPACE_ID = '00000000-0000-0000-0000-000000000001';\n\n// ── types (mirror distribution.gql) ───────────────────────────────────────────\n\nexport type CsaFrequency = 'WEEKLY' | 'BIWEEKLY' | 'MONTHLY';\nexport type CsaBoxSize = 'SMALL' | 'MEDIUM' | 'LARGE';\nexport type CsaPlanStatus = 'ACTIVE' | 'PAUSED' | 'ARCHIVED';\nexport type CsaMembershipStatus = 'ACTIVE' | 'PAUSED' | 'CANCELLED';\nexport type CsaDeliveryStatus = 'SCHEDULED' | 'PACKED' | 'DISPATCHED' | 'DELIVERED' | 'SKIPPED';\nexport type WholesaleFulfilmentStatus = 'CONFIRMED' | 'PACKING' | 'FULFILLED' | 'CANCELLED';\nexport type DeliveryRouteStatus = 'PLANNED' | 'IN_PROGRESS' | 'COMPLETED' | 'CANCELLED';\nexport type DeliveryStopStatus = 'PENDING' | 'ARRIVED' | 'DELIVERED' | 'FAILED';\nexport type BillingSyncStatus = 'PENDING' | 'SYNCED' | 'FAILED';\n\n/** JSON scalar (delivery address). The backend stores a structured object but a string is possible. */\nexport type DeliveryAddress = Record<string, unknown> | string | null;\n\nexport interface CsaBoxItem {\n productId: string | null;\n productName: string;\n quantity: number;\n unit: string;\n}\n\n/** Why capacityRemaining / capacityUtilisationPct are null. Null when they are not. */\nexport type CsaCapacityReason = 'NO_CAPACITY_SET' | 'CAPACITY_ZERO';\n\nexport interface CsaPlan {\n id: string;\n name: string;\n description: string | null;\n frequency: string;\n price: number;\n currency: string;\n boxSize: string;\n contents: CsaBoxItem[];\n deliveryDayOfWeek: number;\n startDate: string;\n endDate: string | null;\n /** Null = uncapped. */\n capacity: number | null;\n status: string;\n recurringBillingPlanId: string | null;\n billingSyncStatus: string;\n billingSyncError: string | null;\n /** Members with status ACTIVE — who is collecting this cycle. */\n activeMemberCount: number;\n /** Members with status PAUSED — still holding their place on the plan (BOFF-6088). */\n pausedMemberCount: number;\n /** ACTIVE + PAUSED — the figure `capacity` is enforced against at enrolment. */\n assignedMemberCount: number;\n /** Null = uncapped (NOT zero). Negative = genuinely over-subscribed; do not clamp. */\n capacityRemaining: number | null;\n capacityUtilisationPct: number | null;\n atCapacity: boolean;\n capacityReason: CsaCapacityReason | null;\n createdAt: string;\n}\n\nexport interface CsaMembership {\n id: string;\n csaPlanId: string;\n csaPlanName: string;\n memberUserId: string | null;\n memberName: string;\n memberEmail: string | null;\n memberPhone: string | null;\n deliveryAddress: DeliveryAddress;\n lat: number | null;\n lng: number | null;\n /** HOME_DELIVERY | PICKUP — derived from whether pickupLocationId is set (BOFF-5978). */\n fulfilmentMode?: string;\n /** The stand this member collects from. Null = home delivery. */\n pickupLocationId?: string | null;\n /** Read live off the location, so correcting the stand's name corrects it everywhere at once. */\n pickupLocationName?: string | null;\n status: string;\n startDate: string;\n nextDeliveryDate: string | null;\n pausedUntil: string | null;\n cycleCount: number;\n billingAccountId: string | null;\n billingSyncStatus: string;\n billingSyncError: string | null;\n createdAt: string;\n}\n\nexport interface CsaDelivery {\n id: string;\n csaMembershipId: string;\n csaPlanId: string;\n memberName: string;\n cycleNumber: number;\n scheduledDate: string;\n status: string;\n orderId: string | null;\n billingOrderId: string | null;\n /** Lower-case mirror of the linked Order's payment state; never written from this UI. */\n paymentStatus: string | null;\n /** Gateway-verified reference, null until the linked Order settles. */\n paymentReference: string | null;\n paidAt: string | null;\n billingSyncStatus: string;\n billingSyncError: string | null;\n workflowRunId: string | null;\n notificationSentAt: string | null;\n deliveredAt: string | null;\n lat: number | null;\n lng: number | null;\n deliveryAddress: DeliveryAddress;\n notes: string | null;\n}\n\nexport interface WholesaleOrder {\n id: string;\n orderId: string;\n orderNumber: string;\n buyerName: string;\n buyerContact: string | null;\n buyerUserId: string | null;\n productId: string | null;\n productName: string;\n quantityKg: number;\n pricePerKg: number;\n appliedTierId: string | null;\n priceSource: string;\n totalAmount: number;\n fulfilmentStatus: string;\n expectedDeliveryDate: string | null;\n orderDate: string;\n notes: string | null;\n}\n\nexport interface WholesalePriceTier {\n id: string;\n productName: string;\n productId: string | null;\n minQuantityKg: number;\n pricePerKg: number;\n createdAt: string;\n}\n\nexport interface DeliveryStop {\n id: string;\n sequence: number;\n csaDeliveryId: string | null;\n label: string;\n address: string | null;\n lat: number;\n lng: number;\n status: string;\n memberName: string | null;\n notificationSentAt: string | null;\n arrivedAt: string | null;\n notes: string | null;\n}\n\nexport interface DeliveryRoute {\n id: string;\n name: string;\n routeDate: string;\n status: string;\n driverName: string | null;\n startLat: number | null;\n startLng: number | null;\n stopCount: number;\n totalDistanceKm: number | null;\n dispatchedAt: string | null;\n stops: DeliveryStop[];\n}\n\nexport interface ChannelBreakdown {\n channel: string;\n orderCount: number;\n revenue: number;\n}\n\nexport interface DistributionSummary {\n channels: ChannelBreakdown[];\n activeCsaPlans: number;\n activeCsaMembers: number;\n weeklyBoxes: number;\n upcomingDeliveries: number;\n wholesaleAccounts: number;\n openWholesaleOrders: number;\n routesThisWeek: number;\n stopsThisWeek: number;\n}\n\nexport interface DistributionOrderItem {\n id: string;\n productId: string;\n productName: string;\n quantity: number;\n price: number;\n unit: string;\n seller: string;\n}\n\nexport interface DistributionOrder {\n id: string;\n orderNumber: string;\n date: string;\n items: DistributionOrderItem[];\n subtotal: number;\n tax: number;\n shipping: number;\n total: number;\n status: string;\n paymentStatus: string;\n deliveryDate: string | null;\n channel: string;\n}\n\ninterface HbContext {\n workspaceId: string;\n}\n\n// ── field fragments ───────────────────────────────────────────────────────────\n\nconst CSA_BOX_ITEM_FIELDS = `\n productId\n productName\n quantity\n unit\n`;\n\nconst CSA_PLAN_FIELDS = `\n id\n name\n description\n frequency\n price\n currency\n boxSize\n contents { ${CSA_BOX_ITEM_FIELDS} }\n deliveryDayOfWeek\n startDate\n endDate\n capacity\n status\n recurringBillingPlanId\n billingSyncStatus\n billingSyncError\n activeMemberCount\n pausedMemberCount\n assignedMemberCount\n capacityRemaining\n capacityUtilisationPct\n atCapacity\n capacityReason\n createdAt\n`;\n\nconst CSA_MEMBERSHIP_FIELDS = `\n id\n csaPlanId\n csaPlanName\n memberUserId\n memberName\n memberEmail\n memberPhone\n deliveryAddress\n lat\n lng\n fulfilmentMode\n pickupLocationId\n pickupLocationName\n status\n startDate\n nextDeliveryDate\n pausedUntil\n cycleCount\n billingAccountId\n billingSyncStatus\n billingSyncError\n createdAt\n`;\n\nconst CSA_DELIVERY_FIELDS = `\n id\n csaMembershipId\n csaPlanId\n memberName\n cycleNumber\n scheduledDate\n status\n orderId\n billingOrderId\n paymentStatus\n paymentReference\n paidAt\n billingSyncStatus\n billingSyncError\n workflowRunId\n notificationSentAt\n deliveredAt\n lat\n lng\n deliveryAddress\n notes\n`;\n\nconst WHOLESALE_FIELDS = `\n id\n orderId\n orderNumber\n buyerName\n buyerContact\n buyerUserId\n productId\n productName\n quantityKg\n pricePerKg\n appliedTierId\n priceSource\n totalAmount\n fulfilmentStatus\n expectedDeliveryDate\n orderDate\n notes\n`;\n\nconst WHOLESALE_TIER_FIELDS = `\n id\n productName\n productId\n minQuantityKg\n pricePerKg\n createdAt\n`;\n\nconst STOP_FIELDS = `\n id\n sequence\n csaDeliveryId\n label\n address\n lat\n lng\n status\n memberName\n notificationSentAt\n arrivedAt\n notes\n`;\n\nconst ROUTE_FIELDS = `\n id\n name\n routeDate\n status\n driverName\n startLat\n startLng\n stopCount\n totalDistanceKm\n dispatchedAt\n stops { ${STOP_FIELDS} }\n`;\n\nconst ORDER_FIELDS = `\n id\n orderNumber\n date\n items { id productId productName quantity price unit seller }\n subtotal\n tax\n shipping\n total\n status\n paymentStatus\n deliveryDate\n channel\n`;\n\nconst SUMMARY_FIELDS = `\n channels { channel orderCount revenue }\n activeCsaPlans\n activeCsaMembers\n weeklyBoxes\n upcomingDeliveries\n wholesaleAccounts\n openWholesaleOrders\n routesThisWeek\n stopsThisWeek\n`;\n\n// ── documents ───────────────────────────────────────────────────────────────\n\nconst GET_SUMMARY = gql`\n query GetHealthyBowlDistributionSummary($context: ContextInput!) {\n getHealthyBowlDistributionSummary(context: $context) { ${SUMMARY_FIELDS} }\n }\n`;\n\nconst GET_CHANNEL_ORDERS = gql`\n query GetHealthyBowlChannelOrders($context: ContextInput!, $channel: String, $limit: Int, $offset: Int) {\n getHealthyBowlChannelOrders(context: $context, channel: $channel, limit: $limit, offset: $offset) { ${ORDER_FIELDS} }\n }\n`;\n\nconst GET_CSA_PLANS = gql`\n query GetHealthyBowlCsaPlans($context: ContextInput!, $status: String) {\n getHealthyBowlCsaPlans(context: $context, status: $status) { ${CSA_PLAN_FIELDS} }\n }\n`;\n\nconst GET_CSA_PLAN = gql`\n query GetHealthyBowlCsaPlan($context: ContextInput!, $id: ID!) {\n getHealthyBowlCsaPlan(context: $context, id: $id) { ${CSA_PLAN_FIELDS} }\n }\n`;\n\nconst GET_CSA_MEMBERSHIPS = gql`\n query GetHealthyBowlCsaMemberships(\n $context: ContextInput!\n $csaPlanId: ID\n $status: String\n $limit: Int\n $offset: Int\n ) {\n getHealthyBowlCsaMemberships(\n context: $context\n csaPlanId: $csaPlanId\n status: $status\n limit: $limit\n offset: $offset\n ) { ${CSA_MEMBERSHIP_FIELDS} }\n }\n`;\n\nconst GET_CSA_DELIVERIES = gql`\n query GetHealthyBowlCsaDeliveries(\n $context: ContextInput!\n $csaMembershipId: ID\n $limit: Int\n $offset: Int\n ) {\n getHealthyBowlCsaDeliveries(\n context: $context\n csaMembershipId: $csaMembershipId\n limit: $limit\n offset: $offset\n ) { ${CSA_DELIVERY_FIELDS} }\n }\n`;\n\nconst GET_WHOLESALE_ORDERS = gql`\n query GetHealthyBowlWholesaleOrders($context: ContextInput!, $fulfilmentStatus: String, $limit: Int, $offset: Int) {\n getHealthyBowlWholesaleOrders(\n context: $context\n fulfilmentStatus: $fulfilmentStatus\n limit: $limit\n offset: $offset\n ) { ${WHOLESALE_FIELDS} }\n }\n`;\n\nconst GET_DELIVERY_ROUTES = gql`\n query GetHealthyBowlDeliveryRoutes($context: ContextInput!, $fromDate: String, $toDate: String) {\n getHealthyBowlDeliveryRoutes(context: $context, fromDate: $fromDate, toDate: $toDate) { ${ROUTE_FIELDS} }\n }\n`;\n\nconst GET_DELIVERY_ROUTE = gql`\n query GetHealthyBowlDeliveryRoute($context: ContextInput!, $id: ID!) {\n getHealthyBowlDeliveryRoute(context: $context, id: $id) { ${ROUTE_FIELDS} }\n }\n`;\n\nconst CREATE_CSA_PLAN = gql`\n mutation CreateHealthyBowlCsaPlan($input: CreateHealthyBowlCsaPlanInput!) {\n createHealthyBowlCsaPlan(input: $input) { ${CSA_PLAN_FIELDS} }\n }\n`;\nconst UPDATE_CSA_PLAN = gql`\n mutation UpdateHealthyBowlCsaPlan($input: UpdateHealthyBowlCsaPlanInput!) {\n updateHealthyBowlCsaPlan(input: $input) { ${CSA_PLAN_FIELDS} }\n }\n`;\nconst DELETE_CSA_PLAN = gql`\n mutation DeleteHealthyBowlCsaPlan($id: ID!, $context: ContextInput!) {\n deleteHealthyBowlCsaPlan(id: $id, context: $context)\n }\n`;\nconst ENROLL_CSA_MEMBER = gql`\n mutation EnrollHealthyBowlCsaMember($input: EnrollHealthyBowlCsaMemberInput!) {\n enrollHealthyBowlCsaMember(input: $input) { ${CSA_MEMBERSHIP_FIELDS} }\n }\n`;\nconst UPDATE_CSA_MEMBERSHIP = gql`\n mutation UpdateHealthyBowlCsaMembership($input: UpdateHealthyBowlCsaMembershipInput!) {\n updateHealthyBowlCsaMembership(input: $input) { ${CSA_MEMBERSHIP_FIELDS} }\n }\n`;\nconst CANCEL_CSA_MEMBERSHIP = gql`\n mutation CancelHealthyBowlCsaMembership($id: ID!, $context: ContextInput!) {\n cancelHealthyBowlCsaMembership(id: $id, context: $context) { ${CSA_MEMBERSHIP_FIELDS} }\n }\n`;\nconst RENEW_CSA_MEMBERSHIP = gql`\n mutation RenewHealthyBowlCsaMembership($input: RenewHealthyBowlCsaMembershipInput!) {\n renewHealthyBowlCsaMembership(input: $input) { ${CSA_MEMBERSHIP_FIELDS} }\n }\n`;\nconst RETRY_CSA_BILLING = gql`\n mutation RetryHealthyBowlCsaBilling($csaDeliveryId: ID!, $context: ContextInput!) {\n retryHealthyBowlCsaBilling(csaDeliveryId: $csaDeliveryId, context: $context) { ${CSA_DELIVERY_FIELDS} }\n }\n`;\nconst UPDATE_CSA_DELIVERY = gql`\n mutation UpdateHealthyBowlCsaDelivery($input: UpdateHealthyBowlCsaDeliveryInput!) {\n updateHealthyBowlCsaDelivery(input: $input) { ${CSA_DELIVERY_FIELDS} }\n }\n`;\nconst CREATE_WHOLESALE_ORDER = gql`\n mutation CreateHealthyBowlWholesaleOrder($input: CreateHealthyBowlWholesaleOrderInput!) {\n createHealthyBowlWholesaleOrder(input: $input) { ${WHOLESALE_FIELDS} }\n }\n`;\nconst UPDATE_WHOLESALE_ORDER = gql`\n mutation UpdateHealthyBowlWholesaleOrder($input: UpdateHealthyBowlWholesaleOrderInput!) {\n updateHealthyBowlWholesaleOrder(input: $input) { ${WHOLESALE_FIELDS} }\n }\n`;\nconst DELETE_WHOLESALE_ORDER = gql`\n mutation DeleteHealthyBowlWholesaleOrder($id: ID!, $context: ContextInput!) {\n deleteHealthyBowlWholesaleOrder(id: $id, context: $context)\n }\n`;\nconst GET_WHOLESALE_PRICE_TIERS = gql`\n query GetHealthyBowlWholesalePriceTiers($context: ContextInput!, $productName: String!) {\n getHealthyBowlWholesalePriceTiers(context: $context, productName: $productName) { ${WHOLESALE_TIER_FIELDS} }\n }\n`;\nconst SET_WHOLESALE_PRICE_TIERS = gql`\n mutation SetHealthyBowlWholesalePriceTiers($input: SetHealthyBowlWholesalePriceTiersInput!) {\n setHealthyBowlWholesalePriceTiers(input: $input) { ${WHOLESALE_TIER_FIELDS} }\n }\n`;\nconst GENERATE_DELIVERY_ROUTE = gql`\n mutation GenerateHealthyBowlDeliveryRoute($input: GenerateHealthyBowlDeliveryRouteInput!) {\n generateHealthyBowlDeliveryRoute(input: $input) { ${ROUTE_FIELDS} }\n }\n`;\nconst UPDATE_DELIVERY_STOP = gql`\n mutation UpdateHealthyBowlDeliveryStop($input: UpdateHealthyBowlDeliveryStopInput!) {\n updateHealthyBowlDeliveryStop(input: $input) { ${STOP_FIELDS} }\n }\n`;\nconst DELETE_DELIVERY_ROUTE = gql`\n mutation DeleteHealthyBowlDeliveryRoute($id: ID!, $context: ContextInput!) {\n deleteHealthyBowlDeliveryRoute(id: $id, context: $context)\n }\n`;\nconst DISPATCH_DELIVERY_ROUTE = gql`\n mutation DispatchHealthyBowlDeliveryRoute($id: ID!, $context: ContextInput!) {\n dispatchHealthyBowlDeliveryRoute(id: $id, context: $context) { ${ROUTE_FIELDS} }\n }\n`;\n\n// ── hook ───────────────────────────────────────────────────────────────────\n\nexport interface UseDistributionOptions {\n /** Fetch the dashboard summary (KPI cards + per-channel breakdown). */\n summary?: boolean;\n /** Fetch the channel-filtered order list. */\n channelOrders?: boolean;\n /** Channel filter for the order list: null/undefined = all channels. */\n channel?: string | null;\n /** Fetch the CSA subscription plans list. */\n plans?: boolean;\n /** Optional status filter for the CSA plans list (ACTIVE | PAUSED | ARCHIVED). */\n plansStatus?: string | null;\n /** Fetch the wholesale orders list. */\n wholesale?: boolean;\n /** Optional fulfilment-status filter for the wholesale list. */\n wholesaleStatus?: string | null;\n /** Fetch the price-tier ladder for one product (requires wholesaleTiersProduct). */\n wholesaleTiers?: boolean;\n /** Product whose ladder `wholesaleTiers` fetches. */\n wholesaleTiersProduct?: string | null;\n /** Fetch the delivery-routes list. */\n routes?: boolean;\n /** Optional inclusive ISO date range for the routes list. */\n routesRange?: { fromDate: string; toDate: string } | null;\n}\n\nexport function useHealthyBowlDistribution(options: UseDistributionOptions = {}) {\n const { workspaceId } = useHealthyBowl();\n const effectiveWorkspaceId = workspaceId || FALLBACK_WORKSPACE_ID;\n const ctx = useMemo<HbContext>(() => ({ workspaceId: effectiveWorkspaceId }), [effectiveWorkspaceId]);\n\n const enableSummary = options.summary === true;\n const enableChannelOrders = options.channelOrders === true;\n const enablePlans = options.plans === true;\n const enableWholesale = options.wholesale === true;\n const enableWholesaleTiers = options.wholesaleTiers === true && !!options.wholesaleTiersProduct;\n const enableRoutes = options.routes === true;\n\n const channel = options.channel ?? null;\n const plansStatus = options.plansStatus ?? null;\n const wholesaleStatus = options.wholesaleStatus ?? null;\n const wholesaleTiersProduct = options.wholesaleTiersProduct ?? null;\n const routesFromDate = options.routesRange?.fromDate ?? null;\n const routesToDate = options.routesRange?.toDate ?? null;\n\n const summaryQuery = useQuery<{ getHealthyBowlDistributionSummary: DistributionSummary }, { context: HbContext }>(\n GET_SUMMARY,\n { variables: { context: ctx }, fetchPolicy: 'cache-and-network', skip: !enableSummary }\n );\n\n const channelOrdersQuery = useQuery<\n { getHealthyBowlChannelOrders: DistributionOrder[] },\n { context: HbContext; channel: string | null; limit: number; offset: number }\n >(GET_CHANNEL_ORDERS, {\n variables: { context: ctx, channel, limit: 100, offset: 0 },\n fetchPolicy: 'cache-and-network',\n skip: !enableChannelOrders,\n });\n\n const plansQuery = useQuery<{ getHealthyBowlCsaPlans: CsaPlan[] }, { context: HbContext; status: string | null }>(\n GET_CSA_PLANS,\n {\n variables: { context: ctx, status: plansStatus },\n fetchPolicy: 'cache-and-network',\n skip: !enablePlans,\n }\n );\n\n const wholesaleQuery = useQuery<\n { getHealthyBowlWholesaleOrders: WholesaleOrder[] },\n { context: HbContext; fulfilmentStatus: string | null; limit: number; offset: number }\n >(GET_WHOLESALE_ORDERS, {\n variables: { context: ctx, fulfilmentStatus: wholesaleStatus, limit: 100, offset: 0 },\n fetchPolicy: 'cache-and-network',\n skip: !enableWholesale,\n });\n\n const routesQuery = useQuery<\n { getHealthyBowlDeliveryRoutes: DeliveryRoute[] },\n { context: HbContext; fromDate: string | null; toDate: string | null }\n >(GET_DELIVERY_ROUTES, {\n variables: { context: ctx, fromDate: routesFromDate, toDate: routesToDate },\n fetchPolicy: 'cache-and-network',\n skip: !enableRoutes,\n });\n\n const wholesaleTiersQuery = useQuery<\n { getHealthyBowlWholesalePriceTiers: WholesalePriceTier[] },\n { context: HbContext; productName: string }\n >(GET_WHOLESALE_PRICE_TIERS, {\n variables: { context: ctx, productName: wholesaleTiersProduct ?? '' },\n fetchPolicy: 'cache-and-network',\n skip: !enableWholesaleTiers,\n });\n\n const refetchSummary = summaryQuery.refetch;\n const refetchChannelOrders = channelOrdersQuery.refetch;\n const refetchPlans = plansQuery.refetch;\n const refetchWholesale = wholesaleQuery.refetch;\n const refetchWholesaleTiers = wholesaleTiersQuery.refetch;\n const refetchRoutes = routesQuery.refetch;\n\n /** Refetch only the reads this page enabled, so a write never fires a skipped query. */\n const reconcileReads = useCallback(async () => {\n const runners: Array<Promise<unknown>> = [];\n if (enableSummary) runners.push(refetchSummary().catch(() => undefined));\n if (enableChannelOrders) runners.push(refetchChannelOrders().catch(() => undefined));\n if (enablePlans) runners.push(refetchPlans().catch(() => undefined));\n if (enableWholesale) runners.push(refetchWholesale().catch(() => undefined));\n if (enableWholesaleTiers) runners.push(refetchWholesaleTiers().catch(() => undefined));\n if (enableRoutes) runners.push(refetchRoutes().catch(() => undefined));\n await Promise.all(runners);\n }, [\n enableSummary,\n enableChannelOrders,\n enablePlans,\n enableWholesale,\n enableWholesaleTiers,\n enableRoutes,\n refetchSummary,\n refetchChannelOrders,\n refetchPlans,\n refetchWholesale,\n refetchWholesaleTiers,\n refetchRoutes,\n ]);\n\n const [createPlanMutation] = useMutation<{ createHealthyBowlCsaPlan: CsaPlan }, { input: Record<string, unknown> }>(\n CREATE_CSA_PLAN\n );\n const [updatePlanMutation] = useMutation<{ updateHealthyBowlCsaPlan: CsaPlan }, { input: Record<string, unknown> }>(\n UPDATE_CSA_PLAN\n );\n const [deletePlanMutation] = useMutation<{ deleteHealthyBowlCsaPlan: boolean }, { id: string; context: HbContext }>(\n DELETE_CSA_PLAN\n );\n const [enrollMemberMutation] = useMutation<\n { enrollHealthyBowlCsaMember: CsaMembership },\n { input: Record<string, unknown> }\n >(ENROLL_CSA_MEMBER);\n const [updateMembershipMutation] = useMutation<\n { updateHealthyBowlCsaMembership: CsaMembership },\n { input: Record<string, unknown> }\n >(UPDATE_CSA_MEMBERSHIP);\n const [cancelMembershipMutation] = useMutation<\n { cancelHealthyBowlCsaMembership: CsaMembership },\n { id: string; context: HbContext }\n >(CANCEL_CSA_MEMBERSHIP);\n const [renewMembershipMutation] = useMutation<\n { renewHealthyBowlCsaMembership: CsaMembership },\n { input: Record<string, unknown> }\n >(RENEW_CSA_MEMBERSHIP);\n const [retryBillingMutation] = useMutation<\n { retryHealthyBowlCsaBilling: CsaDelivery },\n { csaDeliveryId: string; context: HbContext }\n >(RETRY_CSA_BILLING);\n const [updateDeliveryMutation] = useMutation<\n { updateHealthyBowlCsaDelivery: CsaDelivery },\n { input: Record<string, unknown> }\n >(UPDATE_CSA_DELIVERY);\n const [createWholesaleMutation] = useMutation<\n { createHealthyBowlWholesaleOrder: WholesaleOrder },\n { input: Record<string, unknown> }\n >(CREATE_WHOLESALE_ORDER);\n const [updateWholesaleMutation] = useMutation<\n { updateHealthyBowlWholesaleOrder: WholesaleOrder },\n { input: Record<string, unknown> }\n >(UPDATE_WHOLESALE_ORDER);\n const [deleteWholesaleMutation] = useMutation<\n { deleteHealthyBowlWholesaleOrder: boolean },\n { id: string; context: HbContext }\n >(DELETE_WHOLESALE_ORDER);\n const [setWholesaleTiersMutation] = useMutation<\n { setHealthyBowlWholesalePriceTiers: WholesalePriceTier[] },\n { input: Record<string, unknown> }\n >(SET_WHOLESALE_PRICE_TIERS);\n const [generateRouteMutation] = useMutation<\n { generateHealthyBowlDeliveryRoute: DeliveryRoute },\n { input: Record<string, unknown> }\n >(GENERATE_DELIVERY_ROUTE);\n const [updateStopMutation] = useMutation<\n { updateHealthyBowlDeliveryStop: DeliveryStop },\n { input: Record<string, unknown> }\n >(UPDATE_DELIVERY_STOP);\n const [deleteRouteMutation] = useMutation<\n { deleteHealthyBowlDeliveryRoute: boolean },\n { id: string; context: HbContext }\n >(DELETE_DELIVERY_ROUTE);\n const [dispatchRouteMutation] = useMutation<\n { dispatchHealthyBowlDeliveryRoute: DeliveryRoute },\n { id: string; context: HbContext }\n >(DISPATCH_DELIVERY_ROUTE);\n\n const withCtx = useCallback((input: Record<string, unknown>) => ({ ...input, context: ctx }), [ctx]);\n\n return {\n summary: summaryQuery.data?.getHealthyBowlDistributionSummary ?? null,\n channelOrders: channelOrdersQuery.data?.getHealthyBowlChannelOrders ?? [],\n plans: plansQuery.data?.getHealthyBowlCsaPlans ?? [],\n wholesaleOrders: wholesaleQuery.data?.getHealthyBowlWholesaleOrders ?? [],\n wholesaleTiers: wholesaleTiersQuery.data?.getHealthyBowlWholesalePriceTiers ?? [],\n routes: routesQuery.data?.getHealthyBowlDeliveryRoutes ?? [],\n\n loading: {\n summary: summaryQuery.loading,\n channelOrders: channelOrdersQuery.loading,\n plans: plansQuery.loading,\n wholesale: wholesaleQuery.loading,\n wholesaleTiers: wholesaleTiersQuery.loading,\n routes: routesQuery.loading,\n },\n errors: {\n summary: summaryQuery.error,\n channelOrders: channelOrdersQuery.error,\n plans: plansQuery.error,\n wholesale: wholesaleQuery.error,\n wholesaleTiers: wholesaleTiersQuery.error,\n routes: routesQuery.error,\n },\n\n refetchSummary,\n refetchChannelOrders,\n refetchPlans,\n refetchWholesale,\n refetchWholesaleTiers,\n refetchRoutes,\n refetchAll: reconcileReads,\n\n // ── CSA plans ────────────────────────────────────────────────────────────\n createPlan: useCallback(\n async (input: Record<string, unknown>): Promise<CsaPlan | null> => {\n const res = await createPlanMutation({ variables: { input: withCtx(input) } });\n if (res.error) throw res.error;\n await reconcileReads();\n return res.data?.createHealthyBowlCsaPlan ?? null;\n },\n [createPlanMutation, withCtx, reconcileReads]\n ),\n updatePlan: useCallback(\n async (input: Record<string, unknown>): Promise<CsaPlan | null> => {\n const res = await updatePlanMutation({ variables: { input: withCtx(input) } });\n if (res.error) throw res.error;\n await reconcileReads();\n return res.data?.updateHealthyBowlCsaPlan ?? null;\n },\n [updatePlanMutation, withCtx, reconcileReads]\n ),\n deletePlan: useCallback(\n async (id: string): Promise<void> => {\n const res = await deletePlanMutation({ variables: { id, context: ctx } });\n if (res.error) throw res.error;\n await reconcileReads();\n },\n [deletePlanMutation, ctx, reconcileReads]\n ),\n\n // ── CSA memberships ──────────────────────────────────────────────────────\n enrollMember: useCallback(\n async (input: Record<string, unknown>): Promise<CsaMembership | null> => {\n const res = await enrollMemberMutation({ variables: { input: withCtx(input) } });\n if (res.error) throw res.error;\n await reconcileReads();\n return res.data?.enrollHealthyBowlCsaMember ?? null;\n },\n [enrollMemberMutation, withCtx, reconcileReads]\n ),\n updateMembership: useCallback(\n async (input: Record<string, unknown>): Promise<CsaMembership | null> => {\n const res = await updateMembershipMutation({ variables: { input: withCtx(input) } });\n if (res.error) throw res.error;\n await reconcileReads();\n return res.data?.updateHealthyBowlCsaMembership ?? null;\n },\n [updateMembershipMutation, withCtx, reconcileReads]\n ),\n cancelMembership: useCallback(\n async (id: string): Promise<CsaMembership | null> => {\n const res = await cancelMembershipMutation({ variables: { id, context: ctx } });\n if (res.error) throw res.error;\n await reconcileReads();\n return res.data?.cancelHealthyBowlCsaMembership ?? null;\n },\n [cancelMembershipMutation, ctx, reconcileReads]\n ),\n renewMembership: useCallback(\n async (id: string): Promise<CsaMembership | null> => {\n const res = await renewMembershipMutation({ variables: { input: { id, context: ctx } } });\n if (res.error) throw res.error;\n await reconcileReads();\n return res.data?.renewHealthyBowlCsaMembership ?? null;\n },\n [renewMembershipMutation, ctx, reconcileReads]\n ),\n\n // ── CSA deliveries ───────────────────────────────────────────────────────\n retryBilling: useCallback(\n async (csaDeliveryId: string): Promise<CsaDelivery | null> => {\n const res = await retryBillingMutation({ variables: { csaDeliveryId, context: ctx } });\n if (res.error) throw res.error;\n await reconcileReads();\n return res.data?.retryHealthyBowlCsaBilling ?? null;\n },\n [retryBillingMutation, ctx, reconcileReads]\n ),\n updateDelivery: useCallback(\n async (input: Record<string, unknown>): Promise<CsaDelivery | null> => {\n const res = await updateDeliveryMutation({ variables: { input: withCtx(input) } });\n if (res.error) throw res.error;\n await reconcileReads();\n return res.data?.updateHealthyBowlCsaDelivery ?? null;\n },\n [updateDeliveryMutation, withCtx, reconcileReads]\n ),\n\n // ── Wholesale orders ─────────────────────────────────────────────────────\n createWholesaleOrder: useCallback(\n async (input: Record<string, unknown>): Promise<WholesaleOrder | null> => {\n const res = await createWholesaleMutation({ variables: { input: withCtx(input) } });\n if (res.error) throw res.error;\n await reconcileReads();\n return res.data?.createHealthyBowlWholesaleOrder ?? null;\n },\n [createWholesaleMutation, withCtx, reconcileReads]\n ),\n updateWholesaleOrder: useCallback(\n async (input: Record<string, unknown>): Promise<WholesaleOrder | null> => {\n const res = await updateWholesaleMutation({ variables: { input: withCtx(input) } });\n if (res.error) throw res.error;\n await reconcileReads();\n return res.data?.updateHealthyBowlWholesaleOrder ?? null;\n },\n [updateWholesaleMutation, withCtx, reconcileReads]\n ),\n deleteWholesaleOrder: useCallback(\n async (id: string): Promise<void> => {\n const res = await deleteWholesaleMutation({ variables: { id, context: ctx } });\n if (res.error) throw res.error;\n await reconcileReads();\n },\n [deleteWholesaleMutation, ctx, reconcileReads]\n ),\n setWholesalePriceTiers: useCallback(\n async (input: Record<string, unknown>): Promise<WholesalePriceTier[]> => {\n const res = await setWholesaleTiersMutation({ variables: { input: withCtx(input) } });\n if (res.error) throw res.error;\n await reconcileReads();\n return res.data?.setHealthyBowlWholesalePriceTiers ?? [];\n },\n [setWholesaleTiersMutation, withCtx, reconcileReads]\n ),\n\n // ── Delivery routes ──────────────────────────────────────────────────────\n generateRoute: useCallback(\n async (input: Record<string, unknown>): Promise<DeliveryRoute | null> => {\n const res = await generateRouteMutation({ variables: { input: withCtx(input) } });\n if (res.error) throw res.error;\n await reconcileReads();\n return res.data?.generateHealthyBowlDeliveryRoute ?? null;\n },\n [generateRouteMutation, withCtx, reconcileReads]\n ),\n updateStop: useCallback(\n async (input: Record<string, unknown>): Promise<DeliveryStop | null> => {\n const res = await updateStopMutation({ variables: { input: withCtx(input) } });\n if (res.error) throw res.error;\n await reconcileReads();\n return res.data?.updateHealthyBowlDeliveryStop ?? null;\n },\n [updateStopMutation, withCtx, reconcileReads]\n ),\n deleteRoute: useCallback(\n async (id: string): Promise<void> => {\n const res = await deleteRouteMutation({ variables: { id, context: ctx } });\n if (res.error) throw res.error;\n await reconcileReads();\n },\n [deleteRouteMutation, ctx, reconcileReads]\n ),\n dispatchRoute: useCallback(\n async (id: string): Promise<DeliveryRoute | null> => {\n const res = await dispatchRouteMutation({ variables: { id, context: ctx } });\n if (res.error) throw res.error;\n await reconcileReads();\n return res.data?.dispatchHealthyBowlDeliveryRoute ?? null;\n },\n [dispatchRouteMutation, ctx, reconcileReads]\n ),\n\n documents: { GET_CSA_PLAN, GET_CSA_MEMBERSHIPS, GET_CSA_DELIVERIES, GET_DELIVERY_ROUTE, GET_WHOLESALE_PRICE_TIERS },\n context: ctx,\n };\n}\n\nexport { GET_CSA_PLAN, GET_CSA_MEMBERSHIPS, GET_CSA_DELIVERIES, GET_DELIVERY_ROUTE, GET_WHOLESALE_PRICE_TIERS };\n\nexport interface CsaPlanData {\n getHealthyBowlCsaPlan: CsaPlan;\n}\nexport interface CsaMembershipsData {\n getHealthyBowlCsaMemberships: CsaMembership[];\n}\nexport interface CsaDeliveriesData {\n getHealthyBowlCsaDeliveries: CsaDelivery[];\n}\nexport interface DeliveryRouteData {\n getHealthyBowlDeliveryRoute: DeliveryRoute;\n}\n"],"mappings":";;;;;AAqBA,IAAM,KAAwB,wCAmOxB,IAAkB,sbA2BlB,IAAwB,mVAyBxB,IAAsB,yTAwBtB,IAAmB,2PAoBnB,IAAwB,oFASxB,IAAc,+IAed,IAAe;;;;;;;;;;;YAWT,EAAY;GAGlB,IAAe,kMA6Bf,KAAc,CAAG;;6DAEsC,0MAAe;;GAItE,KAAqB,CAAG;;0GAE4E,EAAa;;GAIjH,IAAgB,CAAG;;mEAE0C,EAAgB;;GAI7E,IAAe,CAAG;;0DAEkC,EAAgB;;GAIpE,IAAsB,CAAG;;;;;;;;;;;;;;UAcrB,EAAsB;;GAI1B,IAAqB,CAAG;;;;;;;;;;;;UAYpB,EAAoB;;GAIxB,KAAuB,CAAG;;;;;;;UAOtB,EAAiB;;GAIrB,KAAsB,CAAG;;8FAE+D,EAAa;;GAIrG,IAAqB,CAAG;;gEAEkC,EAAa;;GAIvE,KAAkB,CAAG;;gDAEqB,EAAgB;;GAG1D,KAAkB,CAAG;;gDAEqB,EAAgB;;GAG1D,KAAkB,CAAG;;;;GAKrB,KAAoB,CAAG;;kDAEqB,EAAsB;;GAGlE,KAAwB,CAAG;;sDAEqB,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K;EAAc,CAC3C;EACA,eAAe,EACb,OAAO,MAA8C;GACnD,IAAM,IAAM,MAAM,EAAsB,EAAE,WAAW;IAAE;IAAI,SAAS;GAAI,EAAE,CAAC;GAC3E,IAAI,EAAI,OAAO,MAAM,EAAI;GAEzB,OADA,MAAM,EAAe,GACd,EAAI,MAAM,oCAAoC;EACvD,GACA;GAAC;GAAuB;GAAK;EAAc,CAC7C;EAEA,WAAW;GAAE;GAAc;GAAqB;GAAoB;GAAoB;EAA0B;EAClH,SAAS;CACX;AACF"}
|
|
1
|
+
{"version":3,"file":"useHealthyBowlDistribution.js","names":[],"sources":["../../../src/healthybowl/hooks/useHealthyBowlDistribution.ts"],"sourcesContent":["/**\n * Distribution & Sales Channels — data hook.\n * Roadmap 12 · BOFF-2884 · gap H-4.\n *\n * CSA subscription boxes, wholesale bulk orders, and delivery-route planning, plus a\n * per-Order `channel` tag. Documents are declared inline with `gql` (not as\n * `src/operations/wspace/*.graphql`) because codegen validates operations against the\n * committed `graphql/wspace.graphql` snapshot, which can't know about these fields until\n * the subgraph is live in the supergraph — the same escape hatch `useHealthyBowlWithdrawal`\n * uses. Types mirror `wspace-healthybowl-svc/src/modules/healthybowl/schema/distribution.gql`.\n *\n * Reads use `cache-and-network`; every write throws on error then refetches the reads it\n * invalidates. Pages opt into only the reads they render (all default off) so a page never\n * fires a query it doesn't use.\n */\n\nimport { useCallback, useMemo } from 'react';\nimport { gql } from '@apollo/client';\nimport { useMutation, useQuery } from '@apollo/client/react';\nimport { useHealthyBowl } from '../context/HealthyBowlContext';\n\nconst FALLBACK_WORKSPACE_ID = '00000000-0000-0000-0000-000000000001';\n\n// ── types (mirror distribution.gql) ───────────────────────────────────────────\n\nexport type CsaFrequency = 'WEEKLY' | 'BIWEEKLY' | 'MONTHLY';\nexport type CsaBoxSize = 'SMALL' | 'MEDIUM' | 'LARGE';\nexport type CsaPlanStatus = 'ACTIVE' | 'PAUSED' | 'ARCHIVED';\nexport type CsaMembershipStatus = 'ACTIVE' | 'PAUSED' | 'CANCELLED';\nexport type CsaDeliveryStatus = 'SCHEDULED' | 'PACKED' | 'DISPATCHED' | 'DELIVERED' | 'SKIPPED';\nexport type WholesaleFulfilmentStatus = 'CONFIRMED' | 'PACKING' | 'FULFILLED' | 'CANCELLED';\nexport type DeliveryRouteStatus = 'PLANNED' | 'IN_PROGRESS' | 'COMPLETED' | 'CANCELLED';\nexport type DeliveryStopStatus = 'PENDING' | 'ARRIVED' | 'DELIVERED' | 'FAILED';\nexport type BillingSyncStatus = 'PENDING' | 'SYNCED' | 'FAILED';\n\n/** JSON scalar (delivery address). The backend stores a structured object but a string is possible. */\nexport type DeliveryAddress = Record<string, unknown> | string | null;\n\nexport interface CsaBoxItem {\n productId: string | null;\n productName: string;\n quantity: number;\n unit: string;\n}\n\n/** Why capacityRemaining / capacityUtilisationPct are null. Null when they are not. */\nexport type CsaCapacityReason = 'NO_CAPACITY_SET' | 'CAPACITY_ZERO';\n\nexport interface CsaPlan {\n id: string;\n name: string;\n description: string | null;\n frequency: string;\n price: number;\n currency: string;\n boxSize: string;\n contents: CsaBoxItem[];\n deliveryDayOfWeek: number;\n startDate: string;\n endDate: string | null;\n /** Null = uncapped. */\n capacity: number | null;\n status: string;\n recurringBillingPlanId: string | null;\n billingSyncStatus: string;\n billingSyncError: string | null;\n /** Members with status ACTIVE — who is collecting this cycle. */\n activeMemberCount: number;\n /** Members with status PAUSED — still holding their place on the plan (BOFF-6088). */\n pausedMemberCount: number;\n /** ACTIVE + PAUSED — the figure `capacity` is enforced against at enrolment. */\n assignedMemberCount: number;\n /** Null = uncapped (NOT zero). Negative = genuinely over-subscribed; do not clamp. */\n capacityRemaining: number | null;\n capacityUtilisationPct: number | null;\n atCapacity: boolean;\n capacityReason: CsaCapacityReason | null;\n createdAt: string;\n}\n\nexport interface CsaMembership {\n id: string;\n csaPlanId: string;\n csaPlanName: string;\n memberUserId: string | null;\n memberName: string;\n memberEmail: string | null;\n memberPhone: string | null;\n deliveryAddress: DeliveryAddress;\n lat: number | null;\n lng: number | null;\n /** HOME_DELIVERY | PICKUP — derived from whether pickupLocationId is set (BOFF-5978). */\n fulfilmentMode?: string;\n /** The stand this member collects from. Null = home delivery. */\n pickupLocationId?: string | null;\n /** Read live off the location, so correcting the stand's name corrects it everywhere at once. */\n pickupLocationName?: string | null;\n status: string;\n startDate: string;\n nextDeliveryDate: string | null;\n pausedUntil: string | null;\n cycleCount: number;\n billingAccountId: string | null;\n billingSyncStatus: string;\n billingSyncError: string | null;\n createdAt: string;\n}\n\nexport interface CsaDelivery {\n id: string;\n csaMembershipId: string;\n csaPlanId: string;\n memberName: string;\n cycleNumber: number;\n scheduledDate: string;\n status: string;\n orderId: string | null;\n billingOrderId: string | null;\n billingSyncStatus: string;\n billingSyncError: string | null;\n workflowRunId: string | null;\n notificationSentAt: string | null;\n deliveredAt: string | null;\n lat: number | null;\n lng: number | null;\n deliveryAddress: DeliveryAddress;\n notes: string | null;\n}\n\nexport interface WholesaleOrder {\n id: string;\n orderId: string;\n orderNumber: string;\n buyerName: string;\n buyerContact: string | null;\n buyerUserId: string | null;\n productId: string | null;\n productName: string;\n quantityKg: number;\n pricePerKg: number;\n appliedTierId: string | null;\n priceSource: string;\n totalAmount: number;\n fulfilmentStatus: string;\n expectedDeliveryDate: string | null;\n orderDate: string;\n notes: string | null;\n}\n\nexport interface WholesalePriceTier {\n id: string;\n productName: string;\n productId: string | null;\n minQuantityKg: number;\n pricePerKg: number;\n createdAt: string;\n}\n\nexport interface DeliveryStop {\n id: string;\n sequence: number;\n csaDeliveryId: string | null;\n label: string;\n address: string | null;\n lat: number;\n lng: number;\n status: string;\n memberName: string | null;\n notificationSentAt: string | null;\n arrivedAt: string | null;\n notes: string | null;\n}\n\nexport interface DeliveryRoute {\n id: string;\n name: string;\n routeDate: string;\n status: string;\n driverName: string | null;\n startLat: number | null;\n startLng: number | null;\n stopCount: number;\n totalDistanceKm: number | null;\n dispatchedAt: string | null;\n stops: DeliveryStop[];\n}\n\nexport interface ChannelBreakdown {\n channel: string;\n orderCount: number;\n revenue: number;\n}\n\nexport interface DistributionSummary {\n channels: ChannelBreakdown[];\n activeCsaPlans: number;\n activeCsaMembers: number;\n weeklyBoxes: number;\n upcomingDeliveries: number;\n wholesaleAccounts: number;\n openWholesaleOrders: number;\n routesThisWeek: number;\n stopsThisWeek: number;\n}\n\nexport interface DistributionOrderItem {\n id: string;\n productId: string;\n productName: string;\n quantity: number;\n price: number;\n unit: string;\n seller: string;\n}\n\nexport interface DistributionOrder {\n id: string;\n orderNumber: string;\n date: string;\n items: DistributionOrderItem[];\n subtotal: number;\n tax: number;\n shipping: number;\n total: number;\n status: string;\n paymentStatus: string;\n deliveryDate: string | null;\n channel: string;\n}\n\ninterface HbContext {\n workspaceId: string;\n}\n\n// ── field fragments ───────────────────────────────────────────────────────────\n\nconst CSA_BOX_ITEM_FIELDS = `\n productId\n productName\n quantity\n unit\n`;\n\nconst CSA_PLAN_FIELDS = `\n id\n name\n description\n frequency\n price\n currency\n boxSize\n contents { ${CSA_BOX_ITEM_FIELDS} }\n deliveryDayOfWeek\n startDate\n endDate\n capacity\n status\n recurringBillingPlanId\n billingSyncStatus\n billingSyncError\n activeMemberCount\n pausedMemberCount\n assignedMemberCount\n capacityRemaining\n capacityUtilisationPct\n atCapacity\n capacityReason\n createdAt\n`;\n\nconst CSA_MEMBERSHIP_FIELDS = `\n id\n csaPlanId\n csaPlanName\n memberUserId\n memberName\n memberEmail\n memberPhone\n deliveryAddress\n lat\n lng\n fulfilmentMode\n pickupLocationId\n pickupLocationName\n status\n startDate\n nextDeliveryDate\n pausedUntil\n cycleCount\n billingAccountId\n billingSyncStatus\n billingSyncError\n createdAt\n`;\n\nconst CSA_DELIVERY_FIELDS = `\n id\n csaMembershipId\n csaPlanId\n memberName\n cycleNumber\n scheduledDate\n status\n orderId\n billingOrderId\n billingSyncStatus\n billingSyncError\n workflowRunId\n notificationSentAt\n deliveredAt\n lat\n lng\n deliveryAddress\n notes\n`;\n\nconst WHOLESALE_FIELDS = `\n id\n orderId\n orderNumber\n buyerName\n buyerContact\n buyerUserId\n productId\n productName\n quantityKg\n pricePerKg\n appliedTierId\n priceSource\n totalAmount\n fulfilmentStatus\n expectedDeliveryDate\n orderDate\n notes\n`;\n\nconst WHOLESALE_TIER_FIELDS = `\n id\n productName\n productId\n minQuantityKg\n pricePerKg\n createdAt\n`;\n\nconst STOP_FIELDS = `\n id\n sequence\n csaDeliveryId\n label\n address\n lat\n lng\n status\n memberName\n notificationSentAt\n arrivedAt\n notes\n`;\n\nconst ROUTE_FIELDS = `\n id\n name\n routeDate\n status\n driverName\n startLat\n startLng\n stopCount\n totalDistanceKm\n dispatchedAt\n stops { ${STOP_FIELDS} }\n`;\n\nconst ORDER_FIELDS = `\n id\n orderNumber\n date\n items { id productId productName quantity price unit seller }\n subtotal\n tax\n shipping\n total\n status\n paymentStatus\n deliveryDate\n channel\n`;\n\nconst SUMMARY_FIELDS = `\n channels { channel orderCount revenue }\n activeCsaPlans\n activeCsaMembers\n weeklyBoxes\n upcomingDeliveries\n wholesaleAccounts\n openWholesaleOrders\n routesThisWeek\n stopsThisWeek\n`;\n\n// ── documents ───────────────────────────────────────────────────────────────\n\nconst GET_SUMMARY = gql`\n query GetHealthyBowlDistributionSummary($context: ContextInput!) {\n getHealthyBowlDistributionSummary(context: $context) { ${SUMMARY_FIELDS} }\n }\n`;\n\nconst GET_CHANNEL_ORDERS = gql`\n query GetHealthyBowlChannelOrders($context: ContextInput!, $channel: String, $limit: Int, $offset: Int) {\n getHealthyBowlChannelOrders(context: $context, channel: $channel, limit: $limit, offset: $offset) { ${ORDER_FIELDS} }\n }\n`;\n\nconst GET_CSA_PLANS = gql`\n query GetHealthyBowlCsaPlans($context: ContextInput!, $status: String) {\n getHealthyBowlCsaPlans(context: $context, status: $status) { ${CSA_PLAN_FIELDS} }\n }\n`;\n\nconst GET_CSA_PLAN = gql`\n query GetHealthyBowlCsaPlan($context: ContextInput!, $id: ID!) {\n getHealthyBowlCsaPlan(context: $context, id: $id) { ${CSA_PLAN_FIELDS} }\n }\n`;\n\nconst GET_CSA_MEMBERSHIPS = gql`\n query GetHealthyBowlCsaMemberships(\n $context: ContextInput!\n $csaPlanId: ID\n $status: String\n $limit: Int\n $offset: Int\n ) {\n getHealthyBowlCsaMemberships(\n context: $context\n csaPlanId: $csaPlanId\n status: $status\n limit: $limit\n offset: $offset\n ) { ${CSA_MEMBERSHIP_FIELDS} }\n }\n`;\n\nconst GET_WHOLESALE_ORDERS = gql`\n query GetHealthyBowlWholesaleOrders($context: ContextInput!, $fulfilmentStatus: String, $limit: Int, $offset: Int) {\n getHealthyBowlWholesaleOrders(\n context: $context\n fulfilmentStatus: $fulfilmentStatus\n limit: $limit\n offset: $offset\n ) { ${WHOLESALE_FIELDS} }\n }\n`;\n\nconst GET_DELIVERY_ROUTES = gql`\n query GetHealthyBowlDeliveryRoutes($context: ContextInput!, $fromDate: String, $toDate: String) {\n getHealthyBowlDeliveryRoutes(context: $context, fromDate: $fromDate, toDate: $toDate) { ${ROUTE_FIELDS} }\n }\n`;\n\nconst GET_DELIVERY_ROUTE = gql`\n query GetHealthyBowlDeliveryRoute($context: ContextInput!, $id: ID!) {\n getHealthyBowlDeliveryRoute(context: $context, id: $id) { ${ROUTE_FIELDS} }\n }\n`;\n\nconst CREATE_CSA_PLAN = gql`\n mutation CreateHealthyBowlCsaPlan($input: CreateHealthyBowlCsaPlanInput!) {\n createHealthyBowlCsaPlan(input: $input) { ${CSA_PLAN_FIELDS} }\n }\n`;\nconst UPDATE_CSA_PLAN = gql`\n mutation UpdateHealthyBowlCsaPlan($input: UpdateHealthyBowlCsaPlanInput!) {\n updateHealthyBowlCsaPlan(input: $input) { ${CSA_PLAN_FIELDS} }\n }\n`;\nconst DELETE_CSA_PLAN = gql`\n mutation DeleteHealthyBowlCsaPlan($id: ID!, $context: ContextInput!) {\n deleteHealthyBowlCsaPlan(id: $id, context: $context)\n }\n`;\nconst ENROLL_CSA_MEMBER = gql`\n mutation EnrollHealthyBowlCsaMember($input: EnrollHealthyBowlCsaMemberInput!) {\n enrollHealthyBowlCsaMember(input: $input) { ${CSA_MEMBERSHIP_FIELDS} }\n }\n`;\nconst UPDATE_CSA_MEMBERSHIP = gql`\n mutation UpdateHealthyBowlCsaMembership($input: UpdateHealthyBowlCsaMembershipInput!) {\n updateHealthyBowlCsaMembership(input: $input) { ${CSA_MEMBERSHIP_FIELDS} }\n }\n`;\nconst CANCEL_CSA_MEMBERSHIP = gql`\n mutation CancelHealthyBowlCsaMembership($id: ID!, $context: ContextInput!) {\n cancelHealthyBowlCsaMembership(id: $id, context: $context) { ${CSA_MEMBERSHIP_FIELDS} }\n }\n`;\nconst RENEW_CSA_MEMBERSHIP = gql`\n mutation RenewHealthyBowlCsaMembership($input: RenewHealthyBowlCsaMembershipInput!) {\n renewHealthyBowlCsaMembership(input: $input) { ${CSA_MEMBERSHIP_FIELDS} }\n }\n`;\nconst RETRY_CSA_BILLING = gql`\n mutation RetryHealthyBowlCsaBilling($csaDeliveryId: ID!, $context: ContextInput!) {\n retryHealthyBowlCsaBilling(csaDeliveryId: $csaDeliveryId, context: $context) { ${CSA_DELIVERY_FIELDS} }\n }\n`;\nconst UPDATE_CSA_DELIVERY = gql`\n mutation UpdateHealthyBowlCsaDelivery($input: UpdateHealthyBowlCsaDeliveryInput!) {\n updateHealthyBowlCsaDelivery(input: $input) { ${CSA_DELIVERY_FIELDS} }\n }\n`;\nconst CREATE_WHOLESALE_ORDER = gql`\n mutation CreateHealthyBowlWholesaleOrder($input: CreateHealthyBowlWholesaleOrderInput!) {\n createHealthyBowlWholesaleOrder(input: $input) { ${WHOLESALE_FIELDS} }\n }\n`;\nconst UPDATE_WHOLESALE_ORDER = gql`\n mutation UpdateHealthyBowlWholesaleOrder($input: UpdateHealthyBowlWholesaleOrderInput!) {\n updateHealthyBowlWholesaleOrder(input: $input) { ${WHOLESALE_FIELDS} }\n }\n`;\nconst DELETE_WHOLESALE_ORDER = gql`\n mutation DeleteHealthyBowlWholesaleOrder($id: ID!, $context: ContextInput!) {\n deleteHealthyBowlWholesaleOrder(id: $id, context: $context)\n }\n`;\nconst GET_WHOLESALE_PRICE_TIERS = gql`\n query GetHealthyBowlWholesalePriceTiers($context: ContextInput!, $productName: String!) {\n getHealthyBowlWholesalePriceTiers(context: $context, productName: $productName) { ${WHOLESALE_TIER_FIELDS} }\n }\n`;\nconst SET_WHOLESALE_PRICE_TIERS = gql`\n mutation SetHealthyBowlWholesalePriceTiers($input: SetHealthyBowlWholesalePriceTiersInput!) {\n setHealthyBowlWholesalePriceTiers(input: $input) { ${WHOLESALE_TIER_FIELDS} }\n }\n`;\nconst GENERATE_DELIVERY_ROUTE = gql`\n mutation GenerateHealthyBowlDeliveryRoute($input: GenerateHealthyBowlDeliveryRouteInput!) {\n generateHealthyBowlDeliveryRoute(input: $input) { ${ROUTE_FIELDS} }\n }\n`;\nconst UPDATE_DELIVERY_STOP = gql`\n mutation UpdateHealthyBowlDeliveryStop($input: UpdateHealthyBowlDeliveryStopInput!) {\n updateHealthyBowlDeliveryStop(input: $input) { ${STOP_FIELDS} }\n }\n`;\nconst DELETE_DELIVERY_ROUTE = gql`\n mutation DeleteHealthyBowlDeliveryRoute($id: ID!, $context: ContextInput!) {\n deleteHealthyBowlDeliveryRoute(id: $id, context: $context)\n }\n`;\nconst DISPATCH_DELIVERY_ROUTE = gql`\n mutation DispatchHealthyBowlDeliveryRoute($id: ID!, $context: ContextInput!) {\n dispatchHealthyBowlDeliveryRoute(id: $id, context: $context) { ${ROUTE_FIELDS} }\n }\n`;\n\n// ── hook ───────────────────────────────────────────────────────────────────\n\nexport interface UseDistributionOptions {\n /** Fetch the dashboard summary (KPI cards + per-channel breakdown). */\n summary?: boolean;\n /** Fetch the channel-filtered order list. */\n channelOrders?: boolean;\n /** Channel filter for the order list: null/undefined = all channels. */\n channel?: string | null;\n /** Fetch the CSA subscription plans list. */\n plans?: boolean;\n /** Optional status filter for the CSA plans list (ACTIVE | PAUSED | ARCHIVED). */\n plansStatus?: string | null;\n /** Fetch the wholesale orders list. */\n wholesale?: boolean;\n /** Optional fulfilment-status filter for the wholesale list. */\n wholesaleStatus?: string | null;\n /** Fetch the price-tier ladder for one product (requires wholesaleTiersProduct). */\n wholesaleTiers?: boolean;\n /** Product whose ladder `wholesaleTiers` fetches. */\n wholesaleTiersProduct?: string | null;\n /** Fetch the delivery-routes list. */\n routes?: boolean;\n /** Optional inclusive ISO date range for the routes list. */\n routesRange?: { fromDate: string; toDate: string } | null;\n}\n\nexport function useHealthyBowlDistribution(options: UseDistributionOptions = {}) {\n const { workspaceId } = useHealthyBowl();\n const effectiveWorkspaceId = workspaceId || FALLBACK_WORKSPACE_ID;\n const ctx = useMemo<HbContext>(() => ({ workspaceId: effectiveWorkspaceId }), [effectiveWorkspaceId]);\n\n const enableSummary = options.summary === true;\n const enableChannelOrders = options.channelOrders === true;\n const enablePlans = options.plans === true;\n const enableWholesale = options.wholesale === true;\n const enableWholesaleTiers = options.wholesaleTiers === true && !!options.wholesaleTiersProduct;\n const enableRoutes = options.routes === true;\n\n const channel = options.channel ?? null;\n const plansStatus = options.plansStatus ?? null;\n const wholesaleStatus = options.wholesaleStatus ?? null;\n const wholesaleTiersProduct = options.wholesaleTiersProduct ?? null;\n const routesFromDate = options.routesRange?.fromDate ?? null;\n const routesToDate = options.routesRange?.toDate ?? null;\n\n const summaryQuery = useQuery<{ getHealthyBowlDistributionSummary: DistributionSummary }, { context: HbContext }>(\n GET_SUMMARY,\n { variables: { context: ctx }, fetchPolicy: 'cache-and-network', skip: !enableSummary }\n );\n\n const channelOrdersQuery = useQuery<\n { getHealthyBowlChannelOrders: DistributionOrder[] },\n { context: HbContext; channel: string | null; limit: number; offset: number }\n >(GET_CHANNEL_ORDERS, {\n variables: { context: ctx, channel, limit: 100, offset: 0 },\n fetchPolicy: 'cache-and-network',\n skip: !enableChannelOrders,\n });\n\n const plansQuery = useQuery<{ getHealthyBowlCsaPlans: CsaPlan[] }, { context: HbContext; status: string | null }>(\n GET_CSA_PLANS,\n {\n variables: { context: ctx, status: plansStatus },\n fetchPolicy: 'cache-and-network',\n skip: !enablePlans,\n }\n );\n\n const wholesaleQuery = useQuery<\n { getHealthyBowlWholesaleOrders: WholesaleOrder[] },\n { context: HbContext; fulfilmentStatus: string | null; limit: number; offset: number }\n >(GET_WHOLESALE_ORDERS, {\n variables: { context: ctx, fulfilmentStatus: wholesaleStatus, limit: 100, offset: 0 },\n fetchPolicy: 'cache-and-network',\n skip: !enableWholesale,\n });\n\n const routesQuery = useQuery<\n { getHealthyBowlDeliveryRoutes: DeliveryRoute[] },\n { context: HbContext; fromDate: string | null; toDate: string | null }\n >(GET_DELIVERY_ROUTES, {\n variables: { context: ctx, fromDate: routesFromDate, toDate: routesToDate },\n fetchPolicy: 'cache-and-network',\n skip: !enableRoutes,\n });\n\n const wholesaleTiersQuery = useQuery<\n { getHealthyBowlWholesalePriceTiers: WholesalePriceTier[] },\n { context: HbContext; productName: string }\n >(GET_WHOLESALE_PRICE_TIERS, {\n variables: { context: ctx, productName: wholesaleTiersProduct ?? '' },\n fetchPolicy: 'cache-and-network',\n skip: !enableWholesaleTiers,\n });\n\n const refetchSummary = summaryQuery.refetch;\n const refetchChannelOrders = channelOrdersQuery.refetch;\n const refetchPlans = plansQuery.refetch;\n const refetchWholesale = wholesaleQuery.refetch;\n const refetchWholesaleTiers = wholesaleTiersQuery.refetch;\n const refetchRoutes = routesQuery.refetch;\n\n /** Refetch only the reads this page enabled, so a write never fires a skipped query. */\n const reconcileReads = useCallback(async () => {\n const runners: Array<Promise<unknown>> = [];\n if (enableSummary) runners.push(refetchSummary().catch(() => undefined));\n if (enableChannelOrders) runners.push(refetchChannelOrders().catch(() => undefined));\n if (enablePlans) runners.push(refetchPlans().catch(() => undefined));\n if (enableWholesale) runners.push(refetchWholesale().catch(() => undefined));\n if (enableWholesaleTiers) runners.push(refetchWholesaleTiers().catch(() => undefined));\n if (enableRoutes) runners.push(refetchRoutes().catch(() => undefined));\n await Promise.all(runners);\n }, [\n enableSummary,\n enableChannelOrders,\n enablePlans,\n enableWholesale,\n enableWholesaleTiers,\n enableRoutes,\n refetchSummary,\n refetchChannelOrders,\n refetchPlans,\n refetchWholesale,\n refetchWholesaleTiers,\n refetchRoutes,\n ]);\n\n const [createPlanMutation] = useMutation<{ createHealthyBowlCsaPlan: CsaPlan }, { input: Record<string, unknown> }>(\n CREATE_CSA_PLAN\n );\n const [updatePlanMutation] = useMutation<{ updateHealthyBowlCsaPlan: CsaPlan }, { input: Record<string, unknown> }>(\n UPDATE_CSA_PLAN\n );\n const [deletePlanMutation] = useMutation<{ deleteHealthyBowlCsaPlan: boolean }, { id: string; context: HbContext }>(\n DELETE_CSA_PLAN\n );\n const [enrollMemberMutation] = useMutation<\n { enrollHealthyBowlCsaMember: CsaMembership },\n { input: Record<string, unknown> }\n >(ENROLL_CSA_MEMBER);\n const [updateMembershipMutation] = useMutation<\n { updateHealthyBowlCsaMembership: CsaMembership },\n { input: Record<string, unknown> }\n >(UPDATE_CSA_MEMBERSHIP);\n const [cancelMembershipMutation] = useMutation<\n { cancelHealthyBowlCsaMembership: CsaMembership },\n { id: string; context: HbContext }\n >(CANCEL_CSA_MEMBERSHIP);\n const [renewMembershipMutation] = useMutation<\n { renewHealthyBowlCsaMembership: CsaMembership },\n { input: Record<string, unknown> }\n >(RENEW_CSA_MEMBERSHIP);\n const [retryBillingMutation] = useMutation<\n { retryHealthyBowlCsaBilling: CsaDelivery },\n { csaDeliveryId: string; context: HbContext }\n >(RETRY_CSA_BILLING);\n const [updateDeliveryMutation] = useMutation<\n { updateHealthyBowlCsaDelivery: CsaDelivery },\n { input: Record<string, unknown> }\n >(UPDATE_CSA_DELIVERY);\n const [createWholesaleMutation] = useMutation<\n { createHealthyBowlWholesaleOrder: WholesaleOrder },\n { input: Record<string, unknown> }\n >(CREATE_WHOLESALE_ORDER);\n const [updateWholesaleMutation] = useMutation<\n { updateHealthyBowlWholesaleOrder: WholesaleOrder },\n { input: Record<string, unknown> }\n >(UPDATE_WHOLESALE_ORDER);\n const [deleteWholesaleMutation] = useMutation<\n { deleteHealthyBowlWholesaleOrder: boolean },\n { id: string; context: HbContext }\n >(DELETE_WHOLESALE_ORDER);\n const [setWholesaleTiersMutation] = useMutation<\n { setHealthyBowlWholesalePriceTiers: WholesalePriceTier[] },\n { input: Record<string, unknown> }\n >(SET_WHOLESALE_PRICE_TIERS);\n const [generateRouteMutation] = useMutation<\n { generateHealthyBowlDeliveryRoute: DeliveryRoute },\n { input: Record<string, unknown> }\n >(GENERATE_DELIVERY_ROUTE);\n const [updateStopMutation] = useMutation<\n { updateHealthyBowlDeliveryStop: DeliveryStop },\n { input: Record<string, unknown> }\n >(UPDATE_DELIVERY_STOP);\n const [deleteRouteMutation] = useMutation<\n { deleteHealthyBowlDeliveryRoute: boolean },\n { id: string; context: HbContext }\n >(DELETE_DELIVERY_ROUTE);\n const [dispatchRouteMutation] = useMutation<\n { dispatchHealthyBowlDeliveryRoute: DeliveryRoute },\n { id: string; context: HbContext }\n >(DISPATCH_DELIVERY_ROUTE);\n\n const withCtx = useCallback((input: Record<string, unknown>) => ({ ...input, context: ctx }), [ctx]);\n\n return {\n summary: summaryQuery.data?.getHealthyBowlDistributionSummary ?? null,\n channelOrders: channelOrdersQuery.data?.getHealthyBowlChannelOrders ?? [],\n plans: plansQuery.data?.getHealthyBowlCsaPlans ?? [],\n wholesaleOrders: wholesaleQuery.data?.getHealthyBowlWholesaleOrders ?? [],\n wholesaleTiers: wholesaleTiersQuery.data?.getHealthyBowlWholesalePriceTiers ?? [],\n routes: routesQuery.data?.getHealthyBowlDeliveryRoutes ?? [],\n\n loading: {\n summary: summaryQuery.loading,\n channelOrders: channelOrdersQuery.loading,\n plans: plansQuery.loading,\n wholesale: wholesaleQuery.loading,\n wholesaleTiers: wholesaleTiersQuery.loading,\n routes: routesQuery.loading,\n },\n errors: {\n summary: summaryQuery.error,\n channelOrders: channelOrdersQuery.error,\n plans: plansQuery.error,\n wholesale: wholesaleQuery.error,\n wholesaleTiers: wholesaleTiersQuery.error,\n routes: routesQuery.error,\n },\n\n refetchSummary,\n refetchChannelOrders,\n refetchPlans,\n refetchWholesale,\n refetchWholesaleTiers,\n refetchRoutes,\n refetchAll: reconcileReads,\n\n // ── CSA plans ────────────────────────────────────────────────────────────\n createPlan: useCallback(\n async (input: Record<string, unknown>): Promise<CsaPlan | null> => {\n const res = await createPlanMutation({ variables: { input: withCtx(input) } });\n if (res.error) throw res.error;\n await reconcileReads();\n return res.data?.createHealthyBowlCsaPlan ?? null;\n },\n [createPlanMutation, withCtx, reconcileReads]\n ),\n updatePlan: useCallback(\n async (input: Record<string, unknown>): Promise<CsaPlan | null> => {\n const res = await updatePlanMutation({ variables: { input: withCtx(input) } });\n if (res.error) throw res.error;\n await reconcileReads();\n return res.data?.updateHealthyBowlCsaPlan ?? null;\n },\n [updatePlanMutation, withCtx, reconcileReads]\n ),\n deletePlan: useCallback(\n async (id: string): Promise<void> => {\n const res = await deletePlanMutation({ variables: { id, context: ctx } });\n if (res.error) throw res.error;\n await reconcileReads();\n },\n [deletePlanMutation, ctx, reconcileReads]\n ),\n\n // ── CSA memberships ──────────────────────────────────────────────────────\n enrollMember: useCallback(\n async (input: Record<string, unknown>): Promise<CsaMembership | null> => {\n const res = await enrollMemberMutation({ variables: { input: withCtx(input) } });\n if (res.error) throw res.error;\n await reconcileReads();\n return res.data?.enrollHealthyBowlCsaMember ?? null;\n },\n [enrollMemberMutation, withCtx, reconcileReads]\n ),\n updateMembership: useCallback(\n async (input: Record<string, unknown>): Promise<CsaMembership | null> => {\n const res = await updateMembershipMutation({ variables: { input: withCtx(input) } });\n if (res.error) throw res.error;\n await reconcileReads();\n return res.data?.updateHealthyBowlCsaMembership ?? null;\n },\n [updateMembershipMutation, withCtx, reconcileReads]\n ),\n cancelMembership: useCallback(\n async (id: string): Promise<CsaMembership | null> => {\n const res = await cancelMembershipMutation({ variables: { id, context: ctx } });\n if (res.error) throw res.error;\n await reconcileReads();\n return res.data?.cancelHealthyBowlCsaMembership ?? null;\n },\n [cancelMembershipMutation, ctx, reconcileReads]\n ),\n renewMembership: useCallback(\n async (id: string): Promise<CsaMembership | null> => {\n const res = await renewMembershipMutation({ variables: { input: { id, context: ctx } } });\n if (res.error) throw res.error;\n await reconcileReads();\n return res.data?.renewHealthyBowlCsaMembership ?? null;\n },\n [renewMembershipMutation, ctx, reconcileReads]\n ),\n\n // ── CSA deliveries ───────────────────────────────────────────────────────\n retryBilling: useCallback(\n async (csaDeliveryId: string): Promise<CsaDelivery | null> => {\n const res = await retryBillingMutation({ variables: { csaDeliveryId, context: ctx } });\n if (res.error) throw res.error;\n await reconcileReads();\n return res.data?.retryHealthyBowlCsaBilling ?? null;\n },\n [retryBillingMutation, ctx, reconcileReads]\n ),\n updateDelivery: useCallback(\n async (input: Record<string, unknown>): Promise<CsaDelivery | null> => {\n const res = await updateDeliveryMutation({ variables: { input: withCtx(input) } });\n if (res.error) throw res.error;\n await reconcileReads();\n return res.data?.updateHealthyBowlCsaDelivery ?? null;\n },\n [updateDeliveryMutation, withCtx, reconcileReads]\n ),\n\n // ── Wholesale orders ─────────────────────────────────────────────────────\n createWholesaleOrder: useCallback(\n async (input: Record<string, unknown>): Promise<WholesaleOrder | null> => {\n const res = await createWholesaleMutation({ variables: { input: withCtx(input) } });\n if (res.error) throw res.error;\n await reconcileReads();\n return res.data?.createHealthyBowlWholesaleOrder ?? null;\n },\n [createWholesaleMutation, withCtx, reconcileReads]\n ),\n updateWholesaleOrder: useCallback(\n async (input: Record<string, unknown>): Promise<WholesaleOrder | null> => {\n const res = await updateWholesaleMutation({ variables: { input: withCtx(input) } });\n if (res.error) throw res.error;\n await reconcileReads();\n return res.data?.updateHealthyBowlWholesaleOrder ?? null;\n },\n [updateWholesaleMutation, withCtx, reconcileReads]\n ),\n deleteWholesaleOrder: useCallback(\n async (id: string): Promise<void> => {\n const res = await deleteWholesaleMutation({ variables: { id, context: ctx } });\n if (res.error) throw res.error;\n await reconcileReads();\n },\n [deleteWholesaleMutation, ctx, reconcileReads]\n ),\n setWholesalePriceTiers: useCallback(\n async (input: Record<string, unknown>): Promise<WholesalePriceTier[]> => {\n const res = await setWholesaleTiersMutation({ variables: { input: withCtx(input) } });\n if (res.error) throw res.error;\n await reconcileReads();\n return res.data?.setHealthyBowlWholesalePriceTiers ?? [];\n },\n [setWholesaleTiersMutation, withCtx, reconcileReads]\n ),\n\n // ── Delivery routes ──────────────────────────────────────────────────────\n generateRoute: useCallback(\n async (input: Record<string, unknown>): Promise<DeliveryRoute | null> => {\n const res = await generateRouteMutation({ variables: { input: withCtx(input) } });\n if (res.error) throw res.error;\n await reconcileReads();\n return res.data?.generateHealthyBowlDeliveryRoute ?? null;\n },\n [generateRouteMutation, withCtx, reconcileReads]\n ),\n updateStop: useCallback(\n async (input: Record<string, unknown>): Promise<DeliveryStop | null> => {\n const res = await updateStopMutation({ variables: { input: withCtx(input) } });\n if (res.error) throw res.error;\n await reconcileReads();\n return res.data?.updateHealthyBowlDeliveryStop ?? null;\n },\n [updateStopMutation, withCtx, reconcileReads]\n ),\n deleteRoute: useCallback(\n async (id: string): Promise<void> => {\n const res = await deleteRouteMutation({ variables: { id, context: ctx } });\n if (res.error) throw res.error;\n await reconcileReads();\n },\n [deleteRouteMutation, ctx, reconcileReads]\n ),\n dispatchRoute: useCallback(\n async (id: string): Promise<DeliveryRoute | null> => {\n const res = await dispatchRouteMutation({ variables: { id, context: ctx } });\n if (res.error) throw res.error;\n await reconcileReads();\n return res.data?.dispatchHealthyBowlDeliveryRoute ?? null;\n },\n [dispatchRouteMutation, ctx, reconcileReads]\n ),\n\n documents: { GET_CSA_PLAN, GET_CSA_MEMBERSHIPS, GET_DELIVERY_ROUTE, GET_WHOLESALE_PRICE_TIERS },\n context: ctx,\n };\n}\n\nexport { GET_CSA_PLAN, GET_CSA_MEMBERSHIPS, GET_DELIVERY_ROUTE, GET_WHOLESALE_PRICE_TIERS };\n\nexport interface CsaPlanData {\n getHealthyBowlCsaPlan: CsaPlan;\n}\nexport interface CsaMembershipsData {\n getHealthyBowlCsaMemberships: CsaMembership[];\n}\nexport interface DeliveryRouteData {\n getHealthyBowlDeliveryRoute: DeliveryRoute;\n}\n"],"mappings":";;;;;AAqBA,IAAM,KAAwB,wCA8NxB,IAAkB,sbA2BlB,IAAwB,mVAyBxB,IAAsB,0QAqBtB,IAAmB,2PAoBnB,IAAwB,oFASxB,IAAc,+IAed,IAAe;;;;;;;;;;;YAWT,EAAY;GAGlB,IAAe,kMA6Bf,KAAc,CAAG;;6DAEsC,0MAAe;;GAItE,KAAqB,CAAG;;0GAE4E,EAAa;;GAIjH,KAAgB,CAAG;;mEAE0C,EAAgB;;GAI7E,IAAe,CAAG;;0DAEkC,EAAgB;;GAIpE,IAAsB,CAAG;;;;;;;;;;;;;;UAcrB,EAAsB;;GAI1B,IAAuB,CAAG;;;;;;;UAOtB,EAAiB;;GAIrB,IAAsB,CAAG;;8FAE+D,EAAa;;GAIrG,IAAqB,CAAG;;gEAEkC,EAAa;;GAIvE,KAAkB,CAAG;;gDAEqB,EAAgB;;GAG1D,KAAkB,CAAG;;gDAEqB,EAAgB;;GAG1D,KAAkB,CAAG;;;;GAKrB,KAAoB,CAAG;;kDAEqB,EAAsB;;GAGlE,KAAwB,CAAG;;sDAEqB,EAAsB;;GAGtE,KAAwB,CAAG;;mEAEkC,EAAsB;;GAGnF,KAAuB,CAAG;;qDAEqB,EAAsB;;GAGrE,KAAoB,CAAG;;qFAEwD,EAAoB;;GAGnG,IAAsB,CAAG;;oDAEqB,EAAoB;;GAGlE,IAAyB,CAAG;;uDAEqB,EAAiB;;GAGlE,IAAyB,CAAG;;uDAEqB,EAAiB;;GAGlE,KAAyB,CAAG;;;;GAK5B,IAA4B,CAAG;;wFAEmD,EAAsB;;GAGxG,KAA4B,CAAG;;yDAEoB,EAAsB;;GAGzE,KAA0B,CAAG;;wDAEqB,EAAa;;GAG/D,KAAuB,CAAG;;qDAEqB,EAAY;;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