@burdenoff/microfe-healthybowl 2026.625.1 → 2026.625.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/HealthyBowlRoot.js +78 -77
- package/dist/healthybowl/HealthyBowlRoot.js.map +1 -1
- package/dist/healthybowl/components/ConfirmDialog.js +40 -0
- package/dist/healthybowl/components/ConfirmDialog.js.map +1 -0
- package/dist/healthybowl/components/index.js +1 -0
- package/dist/healthybowl/pages/compliance/ComplianceAuditsPage.js +242 -241
- package/dist/healthybowl/pages/compliance/ComplianceAuditsPage.js.map +1 -1
- package/dist/healthybowl/pages/compliance/ComplianceDocumentsPage.js +189 -188
- package/dist/healthybowl/pages/compliance/ComplianceDocumentsPage.js.map +1 -1
- package/dist/healthybowl/pages/compliance/OrganicCertificationPage.js +158 -157
- package/dist/healthybowl/pages/compliance/OrganicCertificationPage.js.map +1 -1
- package/dist/healthybowl/pages/consultant/FarmerAdvisorsPage.js +160 -159
- package/dist/healthybowl/pages/consultant/FarmerAdvisorsPage.js.map +1 -1
- package/dist/healthybowl/pages/crops/CropDetailsPage.js +41 -40
- package/dist/healthybowl/pages/crops/CropDetailsPage.js.map +1 -1
- package/dist/healthybowl/pages/crops/CropsPage.js +176 -175
- package/dist/healthybowl/pages/crops/CropsPage.js.map +1 -1
- package/dist/healthybowl/pages/crops/FieldDetailsPage.js +257 -257
- package/dist/healthybowl/pages/crops/FieldDetailsPage.js.map +1 -1
- package/dist/healthybowl/pages/crops/HarvestDetailsPage.js +353 -352
- package/dist/healthybowl/pages/crops/HarvestDetailsPage.js.map +1 -1
- package/dist/healthybowl/pages/crops/PlanningDetailsPage.js +303 -302
- package/dist/healthybowl/pages/crops/PlanningDetailsPage.js.map +1 -1
- package/dist/healthybowl/pages/financial/BudgetManagementPage.js +58 -57
- package/dist/healthybowl/pages/financial/BudgetManagementPage.js.map +1 -1
- package/dist/healthybowl/pages/financial/FinancierAccessPage.js +20 -19
- package/dist/healthybowl/pages/financial/FinancierAccessPage.js.map +1 -1
- package/dist/healthybowl/pages/financial/InvoiceManagementPage.js +78 -77
- package/dist/healthybowl/pages/financial/InvoiceManagementPage.js.map +1 -1
- package/dist/healthybowl/pages/financial/TransactionsPage.js +276 -275
- package/dist/healthybowl/pages/financial/TransactionsPage.js.map +1 -1
- package/dist/healthybowl/pages/livestock/AnimalDetailsPage.js +484 -471
- package/dist/healthybowl/pages/livestock/AnimalDetailsPage.js.map +1 -1
- package/dist/healthybowl/pages/livestock/AnimalRegistryPage.js +388 -372
- package/dist/healthybowl/pages/livestock/AnimalRegistryPage.js.map +1 -1
- package/dist/healthybowl/pages/livestock/BreedingManagementPage.js +351 -338
- package/dist/healthybowl/pages/livestock/BreedingManagementPage.js.map +1 -1
- package/dist/healthybowl/pages/livestock/FeedManagementPage.js +301 -293
- package/dist/healthybowl/pages/livestock/FeedManagementPage.js.map +1 -1
- package/dist/healthybowl/pages/livestock/HealthRecordsPage.js +406 -390
- package/dist/healthybowl/pages/livestock/HealthRecordsPage.js.map +1 -1
- package/dist/healthybowl/pages/livestock/LivestockDashboardPage.js +123 -115
- package/dist/healthybowl/pages/livestock/LivestockDashboardPage.js.map +1 -1
- package/dist/healthybowl/pages/livestock/ProductionTrackingPage.js +325 -309
- package/dist/healthybowl/pages/livestock/ProductionTrackingPage.js.map +1 -1
- package/dist/healthybowl/pages/livestock/VaccinationSchedulePage.js +370 -355
- package/dist/healthybowl/pages/livestock/VaccinationSchedulePage.js.map +1 -1
- package/dist/healthybowl/pages/marketplace/MarketplacePage.js +113 -112
- package/dist/healthybowl/pages/marketplace/MarketplacePage.js.map +1 -1
- package/dist/healthybowl/pages/marketplace/OrdersPage.js +76 -75
- package/dist/healthybowl/pages/marketplace/OrdersPage.js.map +1 -1
- package/dist/healthybowl/pages/network/CohortsPage.js +96 -95
- package/dist/healthybowl/pages/network/CohortsPage.js.map +1 -1
- package/dist/healthybowl/pages/network/EventsPage.js +201 -200
- package/dist/healthybowl/pages/network/EventsPage.js.map +1 -1
- package/dist/healthybowl/pages/pest-management/PestIssuesPage.js +175 -174
- package/dist/healthybowl/pages/pest-management/PestIssuesPage.js.map +1 -1
- package/dist/healthybowl/pages/pest-management/TreatmentLibraryPage.js +188 -187
- package/dist/healthybowl/pages/pest-management/TreatmentLibraryPage.js.map +1 -1
- package/dist/healthybowl/pages/production/RecipeManagementPage.js +216 -215
- package/dist/healthybowl/pages/production/RecipeManagementPage.js.map +1 -1
- package/dist/healthybowl/pages/soil/SoilTestsPage.js +160 -159
- package/dist/healthybowl/pages/soil/SoilTestsPage.js.map +1 -1
- package/dist/healthybowl/pages/traceability/BatchTrackingPage.js +22 -21
- package/dist/healthybowl/pages/traceability/BatchTrackingPage.js.map +1 -1
- package/dist/utils/nativeBridge.js +2 -2
- package/package.json +1 -1
|
@@ -1,192 +1,193 @@
|
|
|
1
1
|
import { HealthyBowlProvider as e } from "./context/HealthyBowlContext.js";
|
|
2
2
|
import { normalizeBasePath as t } from "./utils/helpers.js";
|
|
3
3
|
import { ErrorBoundary as n } from "./components/ErrorBoundary.js";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
4
|
+
import { ConfirmProvider as r } from "./components/ConfirmDialog.js";
|
|
5
|
+
import { HealthyBowlRoutes as i } from "./HealthyBowlRoutes.js";
|
|
6
|
+
import { useCallback as a, useEffect as o } from "react";
|
|
7
|
+
import { useI18n as s } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
|
|
8
|
+
import { Banknote as c, BarChart3 as l, Bug as u, Cloud as d, DollarSign as f, Factory as p, FlaskConical as m, Home as h, Landmark as g, Package as _, PawPrint as v, ScanLine as y, ShieldCheck as b, ShoppingCart as x, Stethoscope as S, Tractor as C, UserCheck as w, Users as T, Wheat as E } from "lucide-react";
|
|
9
|
+
import { jsx as D } from "react/jsx-runtime";
|
|
10
|
+
import { FeatureFlagProvider as O } from "@burdenoff/fe-libs/shared/feature-flags";
|
|
10
11
|
//#region src/healthybowl/HealthyBowlRoot.tsx
|
|
11
|
-
var
|
|
12
|
-
let { registerNavItems:
|
|
13
|
-
let n =
|
|
12
|
+
var k = (k) => {
|
|
13
|
+
let { registerNavItems: A, registerFooterItems: j, basePath: M = "/" } = k, { t: N } = s(), P = a((e, t) => {
|
|
14
|
+
let n = N(e);
|
|
14
15
|
return n === e ? t : n;
|
|
15
|
-
}, [
|
|
16
|
-
return
|
|
17
|
-
if (
|
|
16
|
+
}, [N]), F = (e, t) => (e.endsWith("/") ? e.slice(0, -1) : e) + (t.startsWith("/") ? t : `/${t}`);
|
|
17
|
+
return o(() => {
|
|
18
|
+
if (A) return A([
|
|
18
19
|
{
|
|
19
20
|
id: "healthybowl-dashboard",
|
|
20
|
-
label:
|
|
21
|
-
path: t(
|
|
22
|
-
icon: /* @__PURE__ */
|
|
21
|
+
label: P("healthybowl.nav.dashboard", "Dashboard"),
|
|
22
|
+
path: t(M),
|
|
23
|
+
icon: /* @__PURE__ */ D(h, { size: 20 }),
|
|
23
24
|
order: 1,
|
|
24
25
|
group: "main"
|
|
25
26
|
},
|
|
26
27
|
{
|
|
27
28
|
id: "healthybowl-farm",
|
|
28
|
-
label:
|
|
29
|
-
path:
|
|
30
|
-
icon: /* @__PURE__ */
|
|
29
|
+
label: P("healthybowl.nav.farm", "My Farm"),
|
|
30
|
+
path: F(M, "farm"),
|
|
31
|
+
icon: /* @__PURE__ */ D(C, { size: 20 }),
|
|
31
32
|
order: 2,
|
|
32
33
|
group: "main"
|
|
33
34
|
},
|
|
34
35
|
{
|
|
35
36
|
id: "healthybowl-crops",
|
|
36
|
-
label:
|
|
37
|
-
path:
|
|
38
|
-
icon: /* @__PURE__ */ E
|
|
37
|
+
label: P("healthybowl.nav.crops", "Crops"),
|
|
38
|
+
path: F(M, "crops"),
|
|
39
|
+
icon: /* @__PURE__ */ D(E, { size: 20 }),
|
|
39
40
|
order: 10,
|
|
40
41
|
group: "farming"
|
|
41
42
|
},
|
|
42
43
|
{
|
|
43
44
|
id: "healthybowl-livestock",
|
|
44
|
-
label:
|
|
45
|
-
path:
|
|
46
|
-
icon: /* @__PURE__ */
|
|
45
|
+
label: P("healthybowl.nav.livestock", "Livestock"),
|
|
46
|
+
path: F(M, "livestock"),
|
|
47
|
+
icon: /* @__PURE__ */ D(v, { size: 20 }),
|
|
47
48
|
order: 11,
|
|
48
49
|
group: "farming"
|
|
49
50
|
},
|
|
50
51
|
{
|
|
51
52
|
id: "healthybowl-weather",
|
|
52
|
-
label:
|
|
53
|
-
path:
|
|
54
|
-
icon: /* @__PURE__ */
|
|
53
|
+
label: P("healthybowl.nav.weather", "Weather"),
|
|
54
|
+
path: F(M, "weather"),
|
|
55
|
+
icon: /* @__PURE__ */ D(d, { size: 20 }),
|
|
55
56
|
order: 12,
|
|
56
57
|
group: "farming"
|
|
57
58
|
},
|
|
58
59
|
{
|
|
59
60
|
id: "healthybowl-soil",
|
|
60
|
-
label:
|
|
61
|
-
path:
|
|
62
|
-
icon: /* @__PURE__ */
|
|
61
|
+
label: P("healthybowl.nav.soilHealth", "Soil Health"),
|
|
62
|
+
path: F(M, "soil"),
|
|
63
|
+
icon: /* @__PURE__ */ D(m, { size: 20 }),
|
|
63
64
|
order: 13,
|
|
64
65
|
group: "farming"
|
|
65
66
|
},
|
|
66
67
|
{
|
|
67
68
|
id: "healthybowl-pest",
|
|
68
|
-
label:
|
|
69
|
-
path:
|
|
70
|
-
icon: /* @__PURE__ */
|
|
69
|
+
label: P("healthybowl.nav.pestManagement", "Pest Management"),
|
|
70
|
+
path: F(M, "pest-management"),
|
|
71
|
+
icon: /* @__PURE__ */ D(u, { size: 20 }),
|
|
71
72
|
order: 14,
|
|
72
73
|
group: "farming"
|
|
73
74
|
},
|
|
74
75
|
{
|
|
75
76
|
id: "healthybowl-production",
|
|
76
|
-
label:
|
|
77
|
-
path:
|
|
78
|
-
icon: /* @__PURE__ */
|
|
77
|
+
label: P("healthybowl.nav.production", "Production"),
|
|
78
|
+
path: F(M, "production"),
|
|
79
|
+
icon: /* @__PURE__ */ D(p, { size: 20 }),
|
|
79
80
|
order: 20,
|
|
80
81
|
group: "business"
|
|
81
82
|
},
|
|
82
83
|
{
|
|
83
84
|
id: "healthybowl-products",
|
|
84
|
-
label:
|
|
85
|
-
path:
|
|
86
|
-
icon: /* @__PURE__ */
|
|
85
|
+
label: P("healthybowl.nav.products", "Products"),
|
|
86
|
+
path: F(M, "products"),
|
|
87
|
+
icon: /* @__PURE__ */ D(_, { size: 20 }),
|
|
87
88
|
order: 21,
|
|
88
89
|
group: "business"
|
|
89
90
|
},
|
|
90
91
|
{
|
|
91
92
|
id: "healthybowl-marketplace",
|
|
92
|
-
label:
|
|
93
|
-
path:
|
|
94
|
-
icon: /* @__PURE__ */
|
|
93
|
+
label: P("healthybowl.nav.marketplace", "Marketplace"),
|
|
94
|
+
path: F(M, "marketplace"),
|
|
95
|
+
icon: /* @__PURE__ */ D(x, { size: 20 }),
|
|
95
96
|
order: 22,
|
|
96
97
|
group: "business"
|
|
97
98
|
},
|
|
98
99
|
{
|
|
99
100
|
id: "healthybowl-financial",
|
|
100
|
-
label:
|
|
101
|
-
path:
|
|
102
|
-
icon: /* @__PURE__ */
|
|
101
|
+
label: P("healthybowl.nav.financial", "Financial"),
|
|
102
|
+
path: F(M, "financial"),
|
|
103
|
+
icon: /* @__PURE__ */ D(f, { size: 20 }),
|
|
103
104
|
order: 23,
|
|
104
105
|
group: "business"
|
|
105
106
|
},
|
|
106
107
|
{
|
|
107
108
|
id: "healthybowl-financier",
|
|
108
|
-
label:
|
|
109
|
-
path:
|
|
110
|
-
icon: /* @__PURE__ */
|
|
109
|
+
label: P("healthybowl.nav.financier", "Financier"),
|
|
110
|
+
path: F(M, "financier"),
|
|
111
|
+
icon: /* @__PURE__ */ D(c, { size: 20 }),
|
|
111
112
|
order: 24,
|
|
112
113
|
group: "business"
|
|
113
114
|
},
|
|
114
115
|
{
|
|
115
116
|
id: "healthybowl-compliance",
|
|
116
|
-
label:
|
|
117
|
-
path:
|
|
118
|
-
icon: /* @__PURE__ */
|
|
117
|
+
label: P("healthybowl.nav.compliance", "Compliance"),
|
|
118
|
+
path: F(M, "compliance"),
|
|
119
|
+
icon: /* @__PURE__ */ D(b, { size: 20 }),
|
|
119
120
|
order: 30,
|
|
120
121
|
group: "compliance"
|
|
121
122
|
},
|
|
122
123
|
{
|
|
123
124
|
id: "healthybowl-traceability",
|
|
124
|
-
label:
|
|
125
|
-
path:
|
|
126
|
-
icon: /* @__PURE__ */
|
|
125
|
+
label: P("healthybowl.nav.traceability", "Traceability"),
|
|
126
|
+
path: F(M, "traceability"),
|
|
127
|
+
icon: /* @__PURE__ */ D(y, { size: 20 }),
|
|
127
128
|
order: 31,
|
|
128
129
|
group: "compliance"
|
|
129
130
|
},
|
|
130
131
|
{
|
|
131
132
|
id: "healthybowl-schemes",
|
|
132
|
-
label:
|
|
133
|
-
path:
|
|
134
|
-
icon: /* @__PURE__ */
|
|
133
|
+
label: P("healthybowl.nav.governmentSchemes", "Gov. Schemes"),
|
|
134
|
+
path: F(M, "government-schemes"),
|
|
135
|
+
icon: /* @__PURE__ */ D(g, { size: 20 }),
|
|
135
136
|
order: 40,
|
|
136
137
|
group: "support"
|
|
137
138
|
},
|
|
138
139
|
{
|
|
139
140
|
id: "healthybowl-network",
|
|
140
|
-
label:
|
|
141
|
-
path:
|
|
142
|
-
icon: /* @__PURE__ */
|
|
141
|
+
label: P("healthybowl.nav.network", "Network"),
|
|
142
|
+
path: F(M, "network"),
|
|
143
|
+
icon: /* @__PURE__ */ D(T, { size: 20 }),
|
|
143
144
|
order: 41,
|
|
144
145
|
group: "support"
|
|
145
146
|
},
|
|
146
147
|
{
|
|
147
148
|
id: "healthybowl-analytics",
|
|
148
|
-
label:
|
|
149
|
-
path:
|
|
150
|
-
icon: /* @__PURE__ */
|
|
149
|
+
label: P("healthybowl.nav.analytics", "Analytics"),
|
|
150
|
+
path: F(M, "analytics"),
|
|
151
|
+
icon: /* @__PURE__ */ D(l, { size: 20 }),
|
|
151
152
|
order: 42,
|
|
152
153
|
group: "support"
|
|
153
154
|
},
|
|
154
155
|
{
|
|
155
156
|
id: "healthybowl-advisors",
|
|
156
|
-
label:
|
|
157
|
-
path:
|
|
158
|
-
icon: /* @__PURE__ */
|
|
157
|
+
label: P("healthybowl.nav.advisors", "My Advisors"),
|
|
158
|
+
path: F(M, "advisors"),
|
|
159
|
+
icon: /* @__PURE__ */ D(w, { size: 20 }),
|
|
159
160
|
order: 43,
|
|
160
161
|
group: "support"
|
|
161
162
|
},
|
|
162
163
|
{
|
|
163
164
|
id: "healthybowl-consultant",
|
|
164
|
-
label:
|
|
165
|
-
path:
|
|
166
|
-
icon: /* @__PURE__ */
|
|
165
|
+
label: P("healthybowl.nav.consultant", "Consultant"),
|
|
166
|
+
path: F(M, "consultant"),
|
|
167
|
+
icon: /* @__PURE__ */ D(S, { size: 20 }),
|
|
167
168
|
order: 44,
|
|
168
169
|
group: "support"
|
|
169
170
|
}
|
|
170
171
|
]);
|
|
171
|
-
}, [
|
|
172
|
-
if (
|
|
172
|
+
}, [A, M]), o(() => {
|
|
173
|
+
if (j) return j([{
|
|
173
174
|
id: "healthybowl-status",
|
|
174
|
-
label:
|
|
175
|
+
label: P("healthybowl.footer.ready", "HealthyBowl Ready"),
|
|
175
176
|
type: "status",
|
|
176
177
|
order: 10,
|
|
177
178
|
section: "left"
|
|
178
179
|
}]);
|
|
179
|
-
}, [
|
|
180
|
+
}, [j]), /* @__PURE__ */ D(O, {
|
|
180
181
|
workspaceId: null,
|
|
181
182
|
gateway: "global",
|
|
182
183
|
defaultEnabled: !0,
|
|
183
|
-
children: /* @__PURE__ */
|
|
184
|
-
...
|
|
185
|
-
children: /* @__PURE__ */
|
|
184
|
+
children: /* @__PURE__ */ D(e, {
|
|
185
|
+
...k,
|
|
186
|
+
children: /* @__PURE__ */ D(n, { children: /* @__PURE__ */ D(r, { children: /* @__PURE__ */ D(i, {}) }) })
|
|
186
187
|
})
|
|
187
188
|
});
|
|
188
189
|
};
|
|
189
190
|
//#endregion
|
|
190
|
-
export {
|
|
191
|
+
export { k as HealthyBowlRoot };
|
|
191
192
|
|
|
192
193
|
//# sourceMappingURL=HealthyBowlRoot.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HealthyBowlRoot.js","names":[],"sources":["../../src/healthybowl/HealthyBowlRoot.tsx"],"sourcesContent":["/**\n * HealthyBowl Root Component\n * @module healthybowl\n */\n\nimport type { FC } from 'react';\nimport { useCallback, useEffect } from 'react';\nimport { useI18n } from '@burdenoff/fe-libs/shared/providers/shell/I18nProvider';\nimport {\n Home,\n Tractor,\n Wheat,\n PawPrint,\n Cloud,\n ShoppingCart,\n DollarSign,\n BarChart3,\n FlaskConical,\n Bug,\n Factory,\n Package,\n ScanLine,\n ShieldCheck,\n Landmark,\n Banknote,\n Stethoscope,\n UserCheck,\n Users,\n} from 'lucide-react';\nimport { HealthyBowlProvider } from './context/HealthyBowlContext';\nimport { FeatureFlagProvider } from '@burdenoff/fe-libs/shared/feature-flags';\nimport { HealthyBowlRoutes } from './HealthyBowlRoutes';\nimport { ErrorBoundary } from './components/ErrorBoundary';\nimport { normalizeBasePath } from './utils/helpers';\nimport type { HealthyBowlRootProps, NavItem } from './types';\n\nexport const HealthyBowlRoot: FC<HealthyBowlRootProps> = (props) => {\n const { registerNavItems, registerFooterItems, basePath = '/' } = props;\n const { t: translate } = useI18n();\n const t = useCallback(\n (key: string, fallback: string): string => {\n const value = translate(key);\n return value === key ? fallback : value;\n },\n [translate]\n );\n\n // Helper to join paths correctly\n const joinPath = (base: string, path: string): string => {\n const cleanBase = base.endsWith('/') ? base.slice(0, -1) : base;\n const cleanPath = path.startsWith('/') ? path : `/${path}`;\n return cleanBase + cleanPath;\n };\n\n // Register navigation items with shell on mount\n useEffect(() => {\n if (!registerNavItems) return;\n\n const navItems: NavItem[] = [\n // Dashboard\n {\n id: 'healthybowl-dashboard',\n label: t('healthybowl.nav.dashboard', 'Dashboard'),\n // The product index IS the dashboard. Normalize a trailing slash like\n // every sibling item (joinPath) so active-state highlighting matches if\n // the host ever passes '/healthybowl/'.\n path: normalizeBasePath(basePath),\n icon: <Home size={20} />,\n order: 1,\n group: 'main',\n },\n\n // My Farm\n {\n id: 'healthybowl-farm',\n label: t('healthybowl.nav.farm', 'My Farm'),\n path: joinPath(basePath, 'farm'),\n icon: <Tractor size={20} />,\n order: 2,\n group: 'main',\n },\n\n // Crops\n {\n id: 'healthybowl-crops',\n label: t('healthybowl.nav.crops', 'Crops'),\n path: joinPath(basePath, 'crops'),\n icon: <Wheat size={20} />,\n order: 10,\n group: 'farming',\n },\n\n // Livestock\n {\n id: 'healthybowl-livestock',\n label: t('healthybowl.nav.livestock', 'Livestock'),\n path: joinPath(basePath, 'livestock'),\n icon: <PawPrint size={20} />,\n order: 11,\n group: 'farming',\n },\n\n // Weather\n {\n id: 'healthybowl-weather',\n label: t('healthybowl.nav.weather', 'Weather'),\n path: joinPath(basePath, 'weather'),\n icon: <Cloud size={20} />,\n order: 12,\n group: 'farming',\n },\n\n // Soil Health\n {\n id: 'healthybowl-soil',\n label: t('healthybowl.nav.soilHealth', 'Soil Health'),\n path: joinPath(basePath, 'soil'),\n icon: <FlaskConical size={20} />,\n order: 13,\n group: 'farming',\n },\n\n // Pest Management\n {\n id: 'healthybowl-pest',\n label: t('healthybowl.nav.pestManagement', 'Pest Management'),\n path: joinPath(basePath, 'pest-management'),\n icon: <Bug size={20} />,\n order: 14,\n group: 'farming',\n },\n\n // Production\n {\n id: 'healthybowl-production',\n label: t('healthybowl.nav.production', 'Production'),\n path: joinPath(basePath, 'production'),\n icon: <Factory size={20} />,\n order: 20,\n group: 'business',\n },\n\n // Products\n {\n id: 'healthybowl-products',\n label: t('healthybowl.nav.products', 'Products'),\n path: joinPath(basePath, 'products'),\n icon: <Package size={20} />,\n order: 21,\n group: 'business',\n },\n\n // Marketplace\n {\n id: 'healthybowl-marketplace',\n label: t('healthybowl.nav.marketplace', 'Marketplace'),\n path: joinPath(basePath, 'marketplace'),\n icon: <ShoppingCart size={20} />,\n order: 22,\n group: 'business',\n },\n\n // Financial\n {\n id: 'healthybowl-financial',\n label: t('healthybowl.nav.financial', 'Financial'),\n path: joinPath(basePath, 'financial'),\n icon: <DollarSign size={20} />,\n order: 23,\n group: 'business',\n },\n\n // Financier portfolio (B2B2C bridge)\n {\n id: 'healthybowl-financier',\n label: t('healthybowl.nav.financier', 'Financier'),\n path: joinPath(basePath, 'financier'),\n icon: <Banknote size={20} />,\n order: 24,\n group: 'business',\n },\n\n // Compliance\n {\n id: 'healthybowl-compliance',\n label: t('healthybowl.nav.compliance', 'Compliance'),\n path: joinPath(basePath, 'compliance'),\n icon: <ShieldCheck size={20} />,\n order: 30,\n group: 'compliance',\n },\n\n // Traceability\n {\n id: 'healthybowl-traceability',\n label: t('healthybowl.nav.traceability', 'Traceability'),\n path: joinPath(basePath, 'traceability'),\n icon: <ScanLine size={20} />,\n order: 31,\n group: 'compliance',\n },\n\n // Government Schemes\n {\n id: 'healthybowl-schemes',\n label: t('healthybowl.nav.governmentSchemes', 'Gov. Schemes'),\n path: joinPath(basePath, 'government-schemes'),\n icon: <Landmark size={20} />,\n order: 40,\n group: 'support',\n },\n\n // Network\n {\n id: 'healthybowl-network',\n label: t('healthybowl.nav.network', 'Network'),\n path: joinPath(basePath, 'network'),\n icon: <Users size={20} />,\n order: 41,\n group: 'support',\n },\n\n // Analytics\n {\n id: 'healthybowl-analytics',\n label: t('healthybowl.nav.analytics', 'Analytics'),\n path: joinPath(basePath, 'analytics'),\n icon: <BarChart3 size={20} />,\n order: 42,\n group: 'support',\n },\n\n // My Advisors (UC-16 — farmer side)\n {\n id: 'healthybowl-advisors',\n label: t('healthybowl.nav.advisors', 'My Advisors'),\n path: joinPath(basePath, 'advisors'),\n icon: <UserCheck size={20} />,\n order: 43,\n group: 'support',\n },\n\n // Consultant portfolio (UC-16 — consultant side)\n {\n id: 'healthybowl-consultant',\n label: t('healthybowl.nav.consultant', 'Consultant'),\n path: joinPath(basePath, 'consultant'),\n icon: <Stethoscope size={20} />,\n order: 44,\n group: 'support',\n },\n ];\n\n // All sections are reachable. Marketplace (UC-08), Network (UC-12) and\n // Traceability (UC-11) render real read data + their real create flows\n // (createMarketplaceProduct / createCommunityPost / createTraceBatch); the\n // few genuinely-unbacked actions (checkout, booking, QR resolution) show\n // honest \"not available yet\" states in-page rather than hiding the section.\n const cleanup = registerNavItems(navItems);\n return cleanup;\n }, [registerNavItems, basePath]);\n\n // Register footer items\n useEffect(() => {\n if (!registerFooterItems) return;\n\n const footerItems = [\n {\n id: 'healthybowl-status',\n label: t('healthybowl.footer.ready', 'HealthyBowl Ready'),\n type: 'status' as const,\n order: 10,\n section: 'left' as const,\n },\n ];\n\n const cleanup = registerFooterItems(footerItems);\n return cleanup;\n }, [registerFooterItems]);\n\n return (\n <FeatureFlagProvider workspaceId={null} gateway=\"global\" defaultEnabled={true}>\n <HealthyBowlProvider {...props}>\n <ErrorBoundary>\n <HealthyBowlRoutes />\n </ErrorBoundary>\n </HealthyBowlProvider>\n </FeatureFlagProvider>\n );\n};\n"],"mappings":";;;;;;;;;;AAoCA,IAAa,KAA6C,MAAU;CAClE,IAAM,EAAE,qBAAkB,wBAAqB,cAAW,QAAQ,GAC5D,EAAE,GAAG,MAAc,GAAS,EAC5B,IAAI,GACP,GAAa,MAA6B;EACzC,IAAM,IAAQ,EAAU,EAAI;AAC5B,SAAO,MAAU,IAAM,IAAW;IAEpC,CAAC,EAAU,CACZ,EAGK,KAAY,GAAc,OACZ,EAAK,SAAS,IAAI,GAAG,EAAK,MAAM,GAAG,GAAG,GAAG,MACzC,EAAK,WAAW,IAAI,GAAG,IAAO,IAAI;AAsOtD,QAjOA,QAAgB;AACT,QA2ML,QADgB,EAxMY;GAE1B;IACE,IAAI;IACJ,OAAO,EAAE,6BAA6B,YAAY;IAIlD,MAAM,EAAkB,EAAS;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IAAI;IACJ,OAAO,EAAE,6BAA6B,YAAY;IAClD,MAAM,EAAS,GAAU,YAAY;IACrC,MAAM,kBAAC,GAAD,EAAW,MAAM,IAAM,CAAA;IAC7B,OAAO;IACP,OAAO;IACR;GAGD;IACE,IAAI;IACJ,OAAO,EAAE,4BAA4B,cAAc;IACnD,MAAM,EAAS,GAAU,WAAW;IACpC,MAAM,kBAAC,GAAD,EAAW,MAAM,IAAM,CAAA;IAC7B,OAAO;IACP,OAAO;IACR;GAGD;IACE,IAAI;IACJ,OAAO,EAAE,8BAA8B,aAAa;IACpD,MAAM,EAAS,GAAU,aAAa;IACtC,MAAM,kBAAC,GAAD,EAAa,MAAM,IAAM,CAAA;IAC/B,OAAO;IACP,OAAO;IACR;GACF,CAOyC;IAEzC,CAAC,GAAkB,EAAS,CAAC,EAGhC,QAAgB;AACT,QAaL,QADgB,EAVI,CAClB;GACE,IAAI;GACJ,OAAO,EAAE,4BAA4B,oBAAoB;GACzD,MAAM;GACN,OAAO;GACP,SAAS;GACV,CACF,CAE+C;IAE/C,CAAC,EAAoB,CAAC,EAGvB,kBAAC,GAAD;EAAqB,aAAa;EAAM,SAAQ;EAAS,gBAAgB;YACvE,kBAAC,GAAD;GAAqB,GAAI;aACvB,kBAAC,GAAD,EAAA,UACE,kBAAC,GAAD,EAAqB,CAAA,EACP,CAAA;GACI,CAAA;EACF,CAAA"}
|
|
1
|
+
{"version":3,"file":"HealthyBowlRoot.js","names":[],"sources":["../../src/healthybowl/HealthyBowlRoot.tsx"],"sourcesContent":["/**\n * HealthyBowl Root Component\n * @module healthybowl\n */\n\nimport type { FC } from 'react';\nimport { useCallback, useEffect } from 'react';\nimport { useI18n } from '@burdenoff/fe-libs/shared/providers/shell/I18nProvider';\nimport {\n Home,\n Tractor,\n Wheat,\n PawPrint,\n Cloud,\n ShoppingCart,\n DollarSign,\n BarChart3,\n FlaskConical,\n Bug,\n Factory,\n Package,\n ScanLine,\n ShieldCheck,\n Landmark,\n Banknote,\n Stethoscope,\n UserCheck,\n Users,\n} from 'lucide-react';\nimport { HealthyBowlProvider } from './context/HealthyBowlContext';\nimport { FeatureFlagProvider } from '@burdenoff/fe-libs/shared/feature-flags';\nimport { HealthyBowlRoutes } from './HealthyBowlRoutes';\nimport { ErrorBoundary } from './components/ErrorBoundary';\nimport { ConfirmProvider } from './components/ConfirmDialog';\nimport { normalizeBasePath } from './utils/helpers';\nimport type { HealthyBowlRootProps, NavItem } from './types';\n\nexport const HealthyBowlRoot: FC<HealthyBowlRootProps> = (props) => {\n const { registerNavItems, registerFooterItems, basePath = '/' } = props;\n const { t: translate } = useI18n();\n const t = useCallback(\n (key: string, fallback: string): string => {\n const value = translate(key);\n return value === key ? fallback : value;\n },\n [translate]\n );\n\n // Helper to join paths correctly\n const joinPath = (base: string, path: string): string => {\n const cleanBase = base.endsWith('/') ? base.slice(0, -1) : base;\n const cleanPath = path.startsWith('/') ? path : `/${path}`;\n return cleanBase + cleanPath;\n };\n\n // Register navigation items with shell on mount\n useEffect(() => {\n if (!registerNavItems) return;\n\n const navItems: NavItem[] = [\n // Dashboard\n {\n id: 'healthybowl-dashboard',\n label: t('healthybowl.nav.dashboard', 'Dashboard'),\n // The product index IS the dashboard. Normalize a trailing slash like\n // every sibling item (joinPath) so active-state highlighting matches if\n // the host ever passes '/healthybowl/'.\n path: normalizeBasePath(basePath),\n icon: <Home size={20} />,\n order: 1,\n group: 'main',\n },\n\n // My Farm\n {\n id: 'healthybowl-farm',\n label: t('healthybowl.nav.farm', 'My Farm'),\n path: joinPath(basePath, 'farm'),\n icon: <Tractor size={20} />,\n order: 2,\n group: 'main',\n },\n\n // Crops\n {\n id: 'healthybowl-crops',\n label: t('healthybowl.nav.crops', 'Crops'),\n path: joinPath(basePath, 'crops'),\n icon: <Wheat size={20} />,\n order: 10,\n group: 'farming',\n },\n\n // Livestock\n {\n id: 'healthybowl-livestock',\n label: t('healthybowl.nav.livestock', 'Livestock'),\n path: joinPath(basePath, 'livestock'),\n icon: <PawPrint size={20} />,\n order: 11,\n group: 'farming',\n },\n\n // Weather\n {\n id: 'healthybowl-weather',\n label: t('healthybowl.nav.weather', 'Weather'),\n path: joinPath(basePath, 'weather'),\n icon: <Cloud size={20} />,\n order: 12,\n group: 'farming',\n },\n\n // Soil Health\n {\n id: 'healthybowl-soil',\n label: t('healthybowl.nav.soilHealth', 'Soil Health'),\n path: joinPath(basePath, 'soil'),\n icon: <FlaskConical size={20} />,\n order: 13,\n group: 'farming',\n },\n\n // Pest Management\n {\n id: 'healthybowl-pest',\n label: t('healthybowl.nav.pestManagement', 'Pest Management'),\n path: joinPath(basePath, 'pest-management'),\n icon: <Bug size={20} />,\n order: 14,\n group: 'farming',\n },\n\n // Production\n {\n id: 'healthybowl-production',\n label: t('healthybowl.nav.production', 'Production'),\n path: joinPath(basePath, 'production'),\n icon: <Factory size={20} />,\n order: 20,\n group: 'business',\n },\n\n // Products\n {\n id: 'healthybowl-products',\n label: t('healthybowl.nav.products', 'Products'),\n path: joinPath(basePath, 'products'),\n icon: <Package size={20} />,\n order: 21,\n group: 'business',\n },\n\n // Marketplace\n {\n id: 'healthybowl-marketplace',\n label: t('healthybowl.nav.marketplace', 'Marketplace'),\n path: joinPath(basePath, 'marketplace'),\n icon: <ShoppingCart size={20} />,\n order: 22,\n group: 'business',\n },\n\n // Financial\n {\n id: 'healthybowl-financial',\n label: t('healthybowl.nav.financial', 'Financial'),\n path: joinPath(basePath, 'financial'),\n icon: <DollarSign size={20} />,\n order: 23,\n group: 'business',\n },\n\n // Financier portfolio (B2B2C bridge)\n {\n id: 'healthybowl-financier',\n label: t('healthybowl.nav.financier', 'Financier'),\n path: joinPath(basePath, 'financier'),\n icon: <Banknote size={20} />,\n order: 24,\n group: 'business',\n },\n\n // Compliance\n {\n id: 'healthybowl-compliance',\n label: t('healthybowl.nav.compliance', 'Compliance'),\n path: joinPath(basePath, 'compliance'),\n icon: <ShieldCheck size={20} />,\n order: 30,\n group: 'compliance',\n },\n\n // Traceability\n {\n id: 'healthybowl-traceability',\n label: t('healthybowl.nav.traceability', 'Traceability'),\n path: joinPath(basePath, 'traceability'),\n icon: <ScanLine size={20} />,\n order: 31,\n group: 'compliance',\n },\n\n // Government Schemes\n {\n id: 'healthybowl-schemes',\n label: t('healthybowl.nav.governmentSchemes', 'Gov. Schemes'),\n path: joinPath(basePath, 'government-schemes'),\n icon: <Landmark size={20} />,\n order: 40,\n group: 'support',\n },\n\n // Network\n {\n id: 'healthybowl-network',\n label: t('healthybowl.nav.network', 'Network'),\n path: joinPath(basePath, 'network'),\n icon: <Users size={20} />,\n order: 41,\n group: 'support',\n },\n\n // Analytics\n {\n id: 'healthybowl-analytics',\n label: t('healthybowl.nav.analytics', 'Analytics'),\n path: joinPath(basePath, 'analytics'),\n icon: <BarChart3 size={20} />,\n order: 42,\n group: 'support',\n },\n\n // My Advisors (UC-16 — farmer side)\n {\n id: 'healthybowl-advisors',\n label: t('healthybowl.nav.advisors', 'My Advisors'),\n path: joinPath(basePath, 'advisors'),\n icon: <UserCheck size={20} />,\n order: 43,\n group: 'support',\n },\n\n // Consultant portfolio (UC-16 — consultant side)\n {\n id: 'healthybowl-consultant',\n label: t('healthybowl.nav.consultant', 'Consultant'),\n path: joinPath(basePath, 'consultant'),\n icon: <Stethoscope size={20} />,\n order: 44,\n group: 'support',\n },\n ];\n\n // All sections are reachable. Marketplace (UC-08), Network (UC-12) and\n // Traceability (UC-11) render real read data + their real create flows\n // (createMarketplaceProduct / createCommunityPost / createTraceBatch); the\n // few genuinely-unbacked actions (checkout, booking, QR resolution) show\n // honest \"not available yet\" states in-page rather than hiding the section.\n const cleanup = registerNavItems(navItems);\n return cleanup;\n }, [registerNavItems, basePath]);\n\n // Register footer items\n useEffect(() => {\n if (!registerFooterItems) return;\n\n const footerItems = [\n {\n id: 'healthybowl-status',\n label: t('healthybowl.footer.ready', 'HealthyBowl Ready'),\n type: 'status' as const,\n order: 10,\n section: 'left' as const,\n },\n ];\n\n const cleanup = registerFooterItems(footerItems);\n return cleanup;\n }, [registerFooterItems]);\n\n return (\n <FeatureFlagProvider workspaceId={null} gateway=\"global\" defaultEnabled={true}>\n <HealthyBowlProvider {...props}>\n <ErrorBoundary>\n <ConfirmProvider>\n <HealthyBowlRoutes />\n </ConfirmProvider>\n </ErrorBoundary>\n </HealthyBowlProvider>\n </FeatureFlagProvider>\n );\n};\n"],"mappings":";;;;;;;;;;;AAqCA,IAAa,KAA6C,MAAU;CAClE,IAAM,EAAE,qBAAkB,wBAAqB,cAAW,QAAQ,GAC5D,EAAE,GAAG,MAAc,GAAS,EAC5B,IAAI,GACP,GAAa,MAA6B;EACzC,IAAM,IAAQ,EAAU,EAAI;AAC5B,SAAO,MAAU,IAAM,IAAW;IAEpC,CAAC,EAAU,CACZ,EAGK,KAAY,GAAc,OACZ,EAAK,SAAS,IAAI,GAAG,EAAK,MAAM,GAAG,GAAG,GAAG,MACzC,EAAK,WAAW,IAAI,GAAG,IAAO,IAAI;AAsOtD,QAjOA,QAAgB;AACT,QA2ML,QADgB,EAxMY;GAE1B;IACE,IAAI;IACJ,OAAO,EAAE,6BAA6B,YAAY;IAIlD,MAAM,EAAkB,EAAS;IACjC,MAAM,kBAAC,GAAD,EAAM,MAAM,IAAM,CAAA;IACxB,OAAO;IACP,OAAO;IACR;GAGD;IACE,IAAI;IACJ,OAAO,EAAE,wBAAwB,UAAU;IAC3C,MAAM,EAAS,GAAU,OAAO;IAChC,MAAM,kBAAC,GAAD,EAAS,MAAM,IAAM,CAAA;IAC3B,OAAO;IACP,OAAO;IACR;GAGD;IACE,IAAI;IACJ,OAAO,EAAE,yBAAyB,QAAQ;IAC1C,MAAM,EAAS,GAAU,QAAQ;IACjC,MAAM,kBAAC,GAAD,EAAO,MAAM,IAAM,CAAA;IACzB,OAAO;IACP,OAAO;IACR;GAGD;IACE,IAAI;IACJ,OAAO,EAAE,6BAA6B,YAAY;IAClD,MAAM,EAAS,GAAU,YAAY;IACrC,MAAM,kBAAC,GAAD,EAAU,MAAM,IAAM,C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;AACT,QAaL,QADgB,EAVI,CAClB;GACE,IAAI;GACJ,OAAO,EAAE,4BAA4B,oBAAoB;GACzD,MAAM;GACN,OAAO;GACP,SAAS;GACV,CACF,CAE+C;IAE/C,CAAC,EAAoB,CAAC,EAGvB,kBAAC,GAAD;EAAqB,aAAa;EAAM,SAAQ;EAAS,gBAAgB;YACvE,kBAAC,GAAD;GAAqB,GAAI;aACvB,kBAAC,GAAD,EAAA,UACE,kBAAC,GAAD,EAAA,UACE,kBAAC,GAAD,EAAqB,CAAA,EACL,CAAA,EACJ,CAAA;GACI,CAAA;EACF,CAAA"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { createContext as e, use as t, useCallback as n, useRef as r, useState as i } from "react";
|
|
2
|
+
import { useI18n as a } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
|
|
3
|
+
import { jsx as o, jsxs as s } from "react/jsx-runtime";
|
|
4
|
+
import { AlertDialog as c, AlertDialogAction as l, AlertDialogCancel as u, AlertDialogContent as d, AlertDialogDescription as f, AlertDialogFooter as p, AlertDialogHeader as m, AlertDialogTitle as h, buttonVariants as g } from "@burdenoff/fe-libs/ui";
|
|
5
|
+
//#region src/healthybowl/components/ConfirmDialog.tsx
|
|
6
|
+
var _ = e(null);
|
|
7
|
+
function v({ children: e }) {
|
|
8
|
+
let { t } = a(), [v, y] = i(!1), [b, x] = i(null), S = r(null), C = n((e) => {
|
|
9
|
+
let t = S.current;
|
|
10
|
+
S.current = null, y(!1), t?.(e);
|
|
11
|
+
}, []), w = n((e) => (S.current?.(!1), x(e), y(!0), new Promise((e) => {
|
|
12
|
+
S.current = e;
|
|
13
|
+
})), []), T = n((e) => {
|
|
14
|
+
e || C(!1);
|
|
15
|
+
}, [C]);
|
|
16
|
+
return /* @__PURE__ */ s(_.Provider, {
|
|
17
|
+
value: w,
|
|
18
|
+
children: [e, /* @__PURE__ */ o(c, {
|
|
19
|
+
open: v,
|
|
20
|
+
onOpenChange: T,
|
|
21
|
+
children: /* @__PURE__ */ s(d, { children: [/* @__PURE__ */ s(m, { children: [/* @__PURE__ */ o(h, { children: b?.title ?? t("healthybowl.common.confirm.title", "Are you sure?") }), b?.message ? /* @__PURE__ */ o(f, { children: b.message }) : null] }), /* @__PURE__ */ s(p, { children: [/* @__PURE__ */ o(u, {
|
|
22
|
+
onClick: () => C(!1),
|
|
23
|
+
children: b?.cancelButtonTitle ?? t("healthybowl.common.cancel", "Cancel")
|
|
24
|
+
}), /* @__PURE__ */ o(l, {
|
|
25
|
+
onClick: () => C(!0),
|
|
26
|
+
className: b?.destructive === !1 ? void 0 : g({ variant: "destructive" }),
|
|
27
|
+
children: b?.okButtonTitle ?? t("healthybowl.common.confirm", "Confirm")
|
|
28
|
+
})] })] })
|
|
29
|
+
})]
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
function y() {
|
|
33
|
+
let e = t(_);
|
|
34
|
+
if (!e) throw Error("useConfirm must be used within a ConfirmProvider");
|
|
35
|
+
return e;
|
|
36
|
+
}
|
|
37
|
+
//#endregion
|
|
38
|
+
export { v as ConfirmProvider, y as useConfirm };
|
|
39
|
+
|
|
40
|
+
//# sourceMappingURL=ConfirmDialog.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ConfirmDialog.js","names":[],"sources":["../../../src/healthybowl/components/ConfirmDialog.tsx"],"sourcesContent":["/**\n * Confirm dialog helper for the HealthyBowl MFE.\n *\n * Replaces the unthemed, automation-blocking `window.confirm` / `nativeConfirm`\n * delete prompts with the Boff `AlertDialog`. `ConfirmProvider` is mounted once\n * in `HealthyBowlRoot`; pages call the promise-based `useConfirm()` hook so the\n * existing imperative flow (`if (!(await confirm(...))) return;`) is preserved:\n *\n * const confirm = useConfirm();\n * const ok = await confirm({ title, message, okButtonTitle, cancelButtonTitle });\n * if (!ok) return;\n *\n * The input shape mirrors fe-libs `ConfirmOptions` ({ title, message,\n * okButtonTitle, cancelButtonTitle }) so existing `nativeConfirm` call sites need\n * only swap the function name.\n */\n\nimport { createContext, use, useCallback, useRef, useState, type ReactNode } from 'react';\nimport { useI18n } from '@burdenoff/fe-libs/shared/providers/shell/I18nProvider';\nimport {\n AlertDialog,\n AlertDialogAction,\n AlertDialogCancel,\n AlertDialogContent,\n AlertDialogDescription,\n AlertDialogFooter,\n AlertDialogHeader,\n AlertDialogTitle,\n buttonVariants,\n} from '@burdenoff/fe-libs/ui';\n\nexport interface ConfirmInput {\n /** Heading. Defaults to \"Are you sure?\". */\n title?: string;\n /** Body text describing the consequence. */\n message: string;\n /** Confirm button label. Defaults to \"Confirm\". */\n okButtonTitle?: string;\n /** Cancel button label. Defaults to \"Cancel\". */\n cancelButtonTitle?: string;\n /**\n * Style the confirm button as destructive. Defaults to `true` because this\n * helper replaces delete confirmations; pass `false` for a neutral confirm.\n */\n destructive?: boolean;\n}\n\ntype ConfirmFn = (input: ConfirmInput) => Promise<boolean>;\n\nconst ConfirmContext = createContext<ConfirmFn | null>(null);\n\nexport function ConfirmProvider({ children }: { children: ReactNode }) {\n const { t } = useI18n();\n const [open, setOpen] = useState(false);\n const [pending, setPending] = useState<ConfirmInput | null>(null);\n const resolverRef = useRef<((value: boolean) => void) | null>(null);\n\n // Idempotent: resolve at most once per confirm() call, then close.\n const settle = useCallback((result: boolean) => {\n const resolve = resolverRef.current;\n resolverRef.current = null;\n setOpen(false);\n resolve?.(result);\n }, []);\n\n const confirm = useCallback<ConfirmFn>((input) => {\n // A new request supersedes any in-flight one (resolve the old as cancelled).\n resolverRef.current?.(false);\n setPending(input);\n setOpen(true);\n return new Promise<boolean>((resolve) => {\n resolverRef.current = resolve;\n });\n }, []);\n\n const onOpenChange = useCallback(\n (next: boolean) => {\n // Esc / overlay dismissal resolves as cancelled.\n if (!next) settle(false);\n },\n [settle]\n );\n\n return (\n <ConfirmContext.Provider value={confirm}>\n {children}\n <AlertDialog open={open} onOpenChange={onOpenChange}>\n <AlertDialogContent>\n <AlertDialogHeader>\n <AlertDialogTitle>\n {pending?.title ?? t('healthybowl.common.confirm.title', 'Are you sure?')}\n </AlertDialogTitle>\n {pending?.message ? <AlertDialogDescription>{pending.message}</AlertDialogDescription> : null}\n </AlertDialogHeader>\n <AlertDialogFooter>\n <AlertDialogCancel onClick={() => settle(false)}>\n {pending?.cancelButtonTitle ?? t('healthybowl.common.cancel', 'Cancel')}\n </AlertDialogCancel>\n <AlertDialogAction\n onClick={() => settle(true)}\n className={pending?.destructive === false ? undefined : buttonVariants({ variant: 'destructive' })}\n >\n {pending?.okButtonTitle ?? t('healthybowl.common.confirm', 'Confirm')}\n </AlertDialogAction>\n </AlertDialogFooter>\n </AlertDialogContent>\n </AlertDialog>\n </ConfirmContext.Provider>\n );\n}\n\nexport function useConfirm(): ConfirmFn {\n const ctx = use(ConfirmContext);\n if (!ctx) {\n throw new Error('useConfirm must be used within a ConfirmProvider');\n }\n return ctx;\n}\n"],"mappings":";;;;;AAiDA,IAAM,IAAiB,EAAgC,KAAK;AAE5D,SAAgB,EAAgB,EAAE,eAAqC;CACrE,IAAM,EAAE,MAAM,GAAS,EACjB,CAAC,GAAM,KAAW,EAAS,GAAM,EACjC,CAAC,GAAS,KAAc,EAA8B,KAAK,EAC3D,IAAc,EAA0C,KAAK,EAG7D,IAAS,GAAa,MAAoB;EAC9C,IAAM,IAAU,EAAY;AAG5B,EAFA,EAAY,UAAU,MACtB,EAAQ,GAAM,EACd,IAAU,EAAO;IAChB,EAAE,CAAC,EAEA,IAAU,GAAwB,OAEtC,EAAY,UAAU,GAAM,EAC5B,EAAW,EAAM,EACjB,EAAQ,GAAK,EACN,IAAI,SAAkB,MAAY;AACvC,IAAY,UAAU;GACtB,GACD,EAAE,CAAC,EAEA,IAAe,GAClB,MAAkB;AAEjB,EAAK,KAAM,EAAO,GAAM;IAE1B,CAAC,EAAO,CACT;AAED,QACE,kBAAC,EAAe,UAAhB;EAAyB,OAAO;YAAhC,CACG,GACD,kBAAC,GAAD;GAAmB;GAAoB;aACrC,kBAAC,GAAD,EAAA,UA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