@burdenoff/microfe-movethewheels 2026.827.1 → 2026.828.1

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.
@@ -2,23 +2,25 @@ import { Calendar as e } from "../node_modules/lucide-react/dist/esm/icons/calen
2
2
  import { ChevronLeft as t } from "../node_modules/lucide-react/dist/esm/icons/chevron-left.js";
3
3
  import { ChevronRight as n } from "../node_modules/lucide-react/dist/esm/icons/chevron-right.js";
4
4
  import { Clock as r } from "../node_modules/lucide-react/dist/esm/icons/clock.js";
5
- import { Download as ee } from "../node_modules/lucide-react/dist/esm/icons/download.js";
6
- import { FileChartColumnIncreasing as i } from "../node_modules/lucide-react/dist/esm/icons/file-chart-column-increasing.js";
7
- import { Filter as te } from "../node_modules/lucide-react/dist/esm/icons/filter.js";
8
- import { Plus as a } from "../node_modules/lucide-react/dist/esm/icons/plus.js";
9
- import { useAnalytics as o } from "../hooks/useAnalytics.js";
10
- import { useReports as s } from "../hooks/useReports.js";
11
- import { Badge as c, Button as l, Card as u, CardContent as d, CardHeader as f, CardTitle as p, Select as m, SelectContent as h, SelectItem as g, SelectTrigger as _, SelectValue as v, Skeleton as y } from "../components/ui.js";
12
- import { PageLayout as b } from "../components/PageLayout.js";
13
- import { VolumeBar as x } from "../components/charts/VolumeBar.js";
5
+ import { Download as i } from "../node_modules/lucide-react/dist/esm/icons/download.js";
6
+ import { FileChartColumnIncreasing as a } from "../node_modules/lucide-react/dist/esm/icons/file-chart-column-increasing.js";
7
+ import { Filter as o } from "../node_modules/lucide-react/dist/esm/icons/filter.js";
8
+ import { Plus as s } from "../node_modules/lucide-react/dist/esm/icons/plus.js";
9
+ import { useAnalytics as ee } from "../hooks/useAnalytics.js";
10
+ import { useReports as c } from "../hooks/useReports.js";
11
+ import { Badge as l, Button as u, Card as d, CardContent as f, CardHeader as p, CardTitle as m, Select as te, SelectContent as ne, SelectItem as re, SelectTrigger as ie, SelectValue as ae, Skeleton as oe } from "../components/ui.js";
12
+ import { PageLayout as h } from "../components/PageLayout.js";
13
+ import { VolumeBar as g } from "../components/charts/VolumeBar.js";
14
14
  import "../components/charts/index.js";
15
- import { formatDate as S } from "../utils/formatters.js";
16
- import { downloadFile as C, downloadJson as ne, recordToCsv as re, slugifyForFilename as ie } from "../utils/download.js";
17
- import { useState as w } from "react";
18
- import { jsx as T, jsxs as E } from "react/jsx-runtime";
19
- import { EmphasisPanel as D, IllustratedEmptyState as O, PagePurpose as k } from "@burdenoff/fe-libs/ui";
15
+ import { formatDate as _ } from "../utils/formatters.js";
16
+ import { UpcomingDemandPanel as v } from "../components/UpcomingDemandPanel.js";
17
+ import { useDemandForecast as y } from "../hooks/useDemandForecast.js";
18
+ import { downloadFile as b, downloadJson as x, recordToCsv as se, slugifyForFilename as ce } from "../utils/download.js";
19
+ import { useState as S } from "react";
20
+ import { jsx as C, jsxs as w } from "react/jsx-runtime";
21
+ import { EmphasisPanel as T, IllustratedEmptyState as E, PagePurpose as D } from "@burdenoff/fe-libs/ui";
20
22
  //#region src/movethewheels/pages/ReportsPage.tsx
21
- var A = [
23
+ var O = [
22
24
  {
23
25
  value: "operations",
24
26
  label: "Operations Summary"
@@ -39,21 +41,21 @@ var A = [
39
41
  value: "inventory",
40
42
  label: "Inventory Status"
41
43
  }
42
- ], j = 10;
43
- function M() {
44
- let [M, N] = w(0), { reports: P, hasMore: F, isLoading: I, error: L, refetch: R, createReport: z, generateReport: B } = s({
45
- limit: j,
46
- offset: M * j
47
- }), { analytics: V } = o(), H = V.trends.dailyOrders.slice(-7), [U, W] = w("operations"), [G, K] = w(null), [q, J] = w(!1), [Y, X] = w(null), Z = (e) => A.find((t) => t.value === e)?.label ?? e, Q = async (e) => {
44
+ ], k = 10;
45
+ function A() {
46
+ let [A, j] = S(0), { reports: M, hasMore: N, isLoading: P, error: F, refetch: I, createReport: L, generateReport: le } = c({
47
+ limit: k,
48
+ offset: A * k
49
+ }), { analytics: R } = ee(), z = R.trends.dailyOrders.slice(-7), { laneForecast: B, customerForecast: V, laneVariance: H, customerVariance: U, isLoading: W, error: ue, refetch: de } = y(4, 8), [G, fe] = S("operations"), [pe, K] = S(null), [q, J] = S(!1), [Y, X] = S(null), Z = (e) => O.find((t) => t.value === e)?.label ?? e, Q = async (e) => {
48
50
  J(!0), X(null);
49
51
  let t = {
50
- name: `${Z(U)}${e ? " (Scheduled)" : ""}`,
51
- type: U,
52
- description: `${Z(U)} generated from live operational data`,
52
+ name: `${Z(G)}${e ? " (Scheduled)" : ""}`,
53
+ type: G,
54
+ description: `${Z(G)} generated from live operational data`,
53
55
  ...e ? { schedule: e } : {}
54
56
  };
55
57
  try {
56
- await z(t), X({
58
+ await L(t), X({
57
59
  tone: "success",
58
60
  text: e ? "Scheduled report created." : "Report created."
59
61
  });
@@ -65,11 +67,11 @@ function M() {
65
67
  } finally {
66
68
  J(!1);
67
69
  }
68
- }, ae = async (e) => {
70
+ }, me = async (e) => {
69
71
  K(e), X(null);
70
72
  try {
71
- let t = await B(e), n = `${ie(t.report.name)}-${t.generatedAt.slice(0, 10)}`, r = re(t.result ?? null);
72
- r ? C(`${n}.csv`, r, "text/csv") : ne(`${n}.json`, t), X({
73
+ let t = await le(e), n = `${ce(t.report.name)}-${t.generatedAt.slice(0, 10)}`, r = se(t.result ?? null);
74
+ r ? b(`${n}.csv`, r, "text/csv") : x(`${n}.json`, t), X({
73
75
  tone: "success",
74
76
  text: "Report generated and downloaded."
75
77
  });
@@ -81,208 +83,217 @@ function M() {
81
83
  } finally {
82
84
  K(null);
83
85
  }
84
- }, $ = P.filter((e) => e.schedule);
85
- return /* @__PURE__ */ E(b, {
86
+ }, $ = M.filter((e) => e.schedule);
87
+ return /* @__PURE__ */ w(h, {
86
88
  title: "Reports",
87
89
  subtitle: "Generate and schedule reports",
88
- icon: /* @__PURE__ */ T(i, { size: 24 }),
89
- headerActions: /* @__PURE__ */ E("div", {
90
+ icon: /* @__PURE__ */ C(a, { size: 24 }),
91
+ headerActions: /* @__PURE__ */ w("div", {
90
92
  className: "flex gap-2",
91
- children: [/* @__PURE__ */ E(m, {
92
- value: U,
93
- onValueChange: W,
94
- children: [/* @__PURE__ */ T(_, {
93
+ children: [/* @__PURE__ */ w(te, {
94
+ value: G,
95
+ onValueChange: fe,
96
+ children: [/* @__PURE__ */ C(ie, {
95
97
  className: "w-[190px]",
96
- children: /* @__PURE__ */ T(v, {})
97
- }), /* @__PURE__ */ T(h, { children: A.map((e) => /* @__PURE__ */ T(g, {
98
+ children: /* @__PURE__ */ C(ae, {})
99
+ }), /* @__PURE__ */ C(ne, { children: O.map((e) => /* @__PURE__ */ C(re, {
98
100
  value: e.value,
99
101
  children: e.label
100
102
  }, e.value)) })]
101
- }), /* @__PURE__ */ E(l, {
103
+ }), /* @__PURE__ */ w(u, {
102
104
  onClick: () => void Q(),
103
105
  disabled: q,
104
- children: [/* @__PURE__ */ T(a, { size: 16 }), " Create Report"]
106
+ children: [/* @__PURE__ */ C(s, { size: 16 }), " Create Report"]
105
107
  })]
106
108
  }),
107
109
  children: [
108
- /* @__PURE__ */ T(k, {
109
- icon: /* @__PURE__ */ T(i, { size: 18 }),
110
+ /* @__PURE__ */ C(D, {
111
+ icon: /* @__PURE__ */ C(a, { size: 18 }),
110
112
  children: "Turn your operational data into shareable summaries. Generate one-off reports on orders, finance, fleet, customers or inventory, or schedule them to land in inboxes automatically — so stakeholders always have the latest numbers without logging in."
111
113
  }),
112
- Y && /* @__PURE__ */ T("div", {
114
+ Y && /* @__PURE__ */ C("div", {
113
115
  role: "status",
114
116
  className: `rounded-lg p-3 text-sm ${Y.tone === "success" ? "bg-status-success-bg-subtle text-status-success-text" : "bg-status-error-bg-subtle text-status-error-text"}`,
115
117
  children: Y.text
116
118
  }),
117
- /* @__PURE__ */ E("div", {
119
+ /* @__PURE__ */ w("div", {
118
120
  className: "grid grid-cols-1 lg:grid-cols-3 gap-6",
119
- children: [/* @__PURE__ */ E("div", {
121
+ children: [/* @__PURE__ */ w("div", {
120
122
  className: "lg:col-span-2 space-y-4",
121
123
  children: [
122
- /* @__PURE__ */ T("h3", {
124
+ /* @__PURE__ */ C("h3", {
123
125
  className: "font-semibold",
124
126
  children: "Available Reports"
125
127
  }),
126
- I ? /* @__PURE__ */ T("div", {
128
+ P ? /* @__PURE__ */ C("div", {
127
129
  className: "space-y-3",
128
- children: Array.from({ length: 3 }).map((e, t) => /* @__PURE__ */ T(y, { className: "h-20 w-full rounded-lg" }, t))
129
- }) : L ? /* @__PURE__ */ T(u, {
130
+ children: Array.from({ length: 3 }).map((e, t) => /* @__PURE__ */ C(oe, { className: "h-20 w-full rounded-lg" }, t))
131
+ }) : F ? /* @__PURE__ */ C(d, {
130
132
  className: "border-status-error-border",
131
- children: /* @__PURE__ */ E(d, {
133
+ children: /* @__PURE__ */ w(f, {
132
134
  className: "p-6 text-center space-y-3",
133
135
  children: [
134
- /* @__PURE__ */ T("p", {
136
+ /* @__PURE__ */ C("p", {
135
137
  className: "text-status-error-text font-medium",
136
138
  children: "Couldn't load reports"
137
139
  }),
138
- /* @__PURE__ */ T("p", {
140
+ /* @__PURE__ */ C("p", {
139
141
  className: "text-sm text-text-secondary",
140
- children: L.message
142
+ children: F.message
141
143
  }),
142
- /* @__PURE__ */ T(l, {
144
+ /* @__PURE__ */ C(u, {
143
145
  variant: "outline",
144
- onClick: R,
146
+ onClick: I,
145
147
  children: "Retry"
146
148
  })
147
149
  ]
148
150
  })
149
- }) : P.length === 0 ? /* @__PURE__ */ T(u, { children: /* @__PURE__ */ T(d, {
151
+ }) : M.length === 0 ? /* @__PURE__ */ C(d, { children: /* @__PURE__ */ C(f, {
150
152
  className: "p-0",
151
- children: /* @__PURE__ */ T(O, {
153
+ children: /* @__PURE__ */ C(E, {
152
154
  illustration: "empty-data",
153
155
  title: "No reports yet",
154
156
  description: "Create your first report to turn live operational data into a shareable summary.",
155
- action: /* @__PURE__ */ E(l, {
157
+ action: /* @__PURE__ */ w(u, {
156
158
  onClick: () => void Q(),
157
159
  disabled: q,
158
- children: [/* @__PURE__ */ T(a, {
160
+ children: [/* @__PURE__ */ C(s, {
159
161
  size: 16,
160
162
  className: "mr-1.5"
161
163
  }), " Create Report"]
162
164
  })
163
165
  })
164
- }) }) : P.map((e) => /* @__PURE__ */ T(u, { children: /* @__PURE__ */ T(d, {
166
+ }) }) : M.map((e) => /* @__PURE__ */ C(d, { children: /* @__PURE__ */ C(f, {
165
167
  className: "p-4",
166
- children: /* @__PURE__ */ E("div", {
168
+ children: /* @__PURE__ */ w("div", {
167
169
  className: "flex items-center justify-between",
168
- children: [/* @__PURE__ */ E("div", {
170
+ children: [/* @__PURE__ */ w("div", {
169
171
  className: "flex items-center gap-3",
170
- children: [/* @__PURE__ */ T("div", {
172
+ children: [/* @__PURE__ */ C("div", {
171
173
  className: "w-10 h-10 rounded-lg bg-action-primary-bg/10 flex items-center justify-center",
172
- children: /* @__PURE__ */ T(i, {
174
+ children: /* @__PURE__ */ C(a, {
173
175
  size: 20,
174
176
  className: "text-primary"
175
177
  })
176
- }), /* @__PURE__ */ E("div", { children: [/* @__PURE__ */ T("p", {
178
+ }), /* @__PURE__ */ w("div", { children: [/* @__PURE__ */ C("p", {
177
179
  className: "font-medium",
178
180
  children: e.name
179
- }), /* @__PURE__ */ T("p", {
181
+ }), /* @__PURE__ */ C("p", {
180
182
  className: "text-sm text-text-secondary",
181
183
  children: e.description ?? Z(e.type)
182
184
  })] })]
183
- }), /* @__PURE__ */ E("div", {
185
+ }), /* @__PURE__ */ w("div", {
184
186
  className: "flex items-center gap-3",
185
- children: [/* @__PURE__ */ E("div", {
187
+ children: [/* @__PURE__ */ w("div", {
186
188
  className: "text-right",
187
- children: [/* @__PURE__ */ T(c, {
189
+ children: [/* @__PURE__ */ C(l, {
188
190
  variant: "outline",
189
191
  children: e.schedule ?? "On demand"
190
- }), e.lastGenerated && /* @__PURE__ */ E("p", {
192
+ }), e.lastGenerated && /* @__PURE__ */ w("p", {
191
193
  className: "text-xs text-text-secondary mt-1",
192
- children: ["Last: ", S(new Date(e.lastGenerated), "short")]
194
+ children: ["Last: ", _(new Date(e.lastGenerated), "short")]
193
195
  })]
194
- }), /* @__PURE__ */ T(l, {
196
+ }), /* @__PURE__ */ C(u, {
195
197
  variant: "outline",
196
198
  size: "sm",
197
199
  "aria-label": `Generate ${e.name}`,
198
- disabled: G === e.id,
199
- onClick: () => void ae(e.id),
200
- children: /* @__PURE__ */ T(ee, { size: 14 })
200
+ disabled: pe === e.id,
201
+ onClick: () => void me(e.id),
202
+ children: /* @__PURE__ */ C(i, { size: 14 })
201
203
  })]
202
204
  })]
203
205
  })
204
206
  }) }, e.id)),
205
- !I && !L && (P.length > 0 || M > 0) && /* @__PURE__ */ E("div", {
207
+ !P && !F && (M.length > 0 || A > 0) && /* @__PURE__ */ w("div", {
206
208
  className: "flex flex-wrap items-center justify-between gap-3 pt-1",
207
- children: [/* @__PURE__ */ E("span", {
209
+ children: [/* @__PURE__ */ w("span", {
208
210
  className: "text-sm text-text-secondary",
209
211
  children: [
210
212
  "Showing ",
211
- P.length === 0 ? 0 : M * j + 1,
213
+ M.length === 0 ? 0 : A * k + 1,
212
214
  " to",
213
215
  " ",
214
- M * j + P.length
216
+ A * k + M.length
215
217
  ]
216
- }), /* @__PURE__ */ E("div", {
218
+ }), /* @__PURE__ */ w("div", {
217
219
  className: "flex items-center gap-1",
218
220
  children: [
219
- /* @__PURE__ */ T(l, {
221
+ /* @__PURE__ */ C(u, {
220
222
  variant: "outline",
221
223
  size: "icon",
222
224
  className: "h-8 w-8",
223
225
  "aria-label": "Previous page",
224
- onClick: () => N((e) => Math.max(0, e - 1)),
225
- disabled: M === 0,
226
- children: /* @__PURE__ */ T(t, { className: "h-4 w-4" })
226
+ onClick: () => j((e) => Math.max(0, e - 1)),
227
+ disabled: A === 0,
228
+ children: /* @__PURE__ */ C(t, { className: "h-4 w-4" })
227
229
  }),
228
- /* @__PURE__ */ E("span", {
230
+ /* @__PURE__ */ w("span", {
229
231
  className: "px-3 text-sm",
230
- children: ["Page ", M + 1]
232
+ children: ["Page ", A + 1]
231
233
  }),
232
- /* @__PURE__ */ T(l, {
234
+ /* @__PURE__ */ C(u, {
233
235
  variant: "outline",
234
236
  size: "icon",
235
237
  className: "h-8 w-8",
236
238
  "aria-label": "Next page",
237
- onClick: () => N((e) => e + 1),
238
- disabled: !F,
239
- children: /* @__PURE__ */ T(n, { className: "h-4 w-4" })
239
+ onClick: () => j((e) => e + 1),
240
+ disabled: !N,
241
+ children: /* @__PURE__ */ C(n, { className: "h-4 w-4" })
240
242
  })
241
243
  ]
242
244
  })]
243
245
  })
244
246
  ]
245
- }), /* @__PURE__ */ E("div", {
247
+ }), /* @__PURE__ */ w("div", {
246
248
  className: "space-y-6",
247
249
  children: [
248
- /* @__PURE__ */ E(u, { children: [/* @__PURE__ */ T(f, { children: /* @__PURE__ */ T(p, {
250
+ /* @__PURE__ */ C(v, {
251
+ laneForecast: B,
252
+ customerForecast: V,
253
+ laneVariance: H,
254
+ customerVariance: U,
255
+ isLoading: W,
256
+ error: ue,
257
+ onRetry: de
258
+ }),
259
+ /* @__PURE__ */ w(d, { children: [/* @__PURE__ */ C(p, { children: /* @__PURE__ */ C(m, {
249
260
  className: "text-base",
250
261
  children: "Data preview"
251
- }) }), /* @__PURE__ */ E(d, { children: [/* @__PURE__ */ T("p", {
262
+ }) }), /* @__PURE__ */ w(f, { children: [/* @__PURE__ */ C("p", {
252
263
  className: "mb-2 text-xs text-text-secondary",
253
264
  children: "Order volume · last 7 days"
254
- }), /* @__PURE__ */ T(x, {
265
+ }), /* @__PURE__ */ C(g, {
255
266
  xKey: "date",
256
267
  height: 160,
257
268
  showLegend: !1,
258
- data: H,
269
+ data: z,
259
270
  series: [{
260
271
  dataKey: "orders",
261
272
  name: "Orders"
262
273
  }],
263
274
  emptyMessage: "No order data to preview yet"
264
275
  })] })] }),
265
- /* @__PURE__ */ E(D, {
276
+ /* @__PURE__ */ w(T, {
266
277
  className: "space-y-3",
267
278
  children: [
268
- /* @__PURE__ */ E("h2", {
279
+ /* @__PURE__ */ w("h2", {
269
280
  className: "flex items-center gap-2 text-base font-semibold text-text-primary",
270
- children: [/* @__PURE__ */ T(r, { size: 18 }), " Scheduled Reports"]
281
+ children: [/* @__PURE__ */ C(r, { size: 18 }), " Scheduled Reports"]
271
282
  }),
272
- $.length === 0 ? /* @__PURE__ */ T("p", {
283
+ $.length === 0 ? /* @__PURE__ */ C("p", {
273
284
  className: "text-sm text-text-secondary",
274
285
  children: "No scheduled reports yet. Schedule one to have it generated automatically."
275
- }) : $.map((e) => /* @__PURE__ */ E("div", {
286
+ }) : $.map((e) => /* @__PURE__ */ w("div", {
276
287
  className: "p-3 border border-border-seam rounded-lg",
277
- children: [/* @__PURE__ */ T("p", {
288
+ children: [/* @__PURE__ */ C("p", {
278
289
  className: "font-medium",
279
290
  children: e.name
280
- }), /* @__PURE__ */ E("p", {
291
+ }), /* @__PURE__ */ w("p", {
281
292
  className: "text-sm text-text-secondary",
282
293
  children: ["Schedule: ", e.schedule]
283
294
  })]
284
295
  }, e.id)),
285
- /* @__PURE__ */ T(l, {
296
+ /* @__PURE__ */ C(u, {
286
297
  variant: "outline",
287
298
  className: "w-full",
288
299
  disabled: q,
@@ -291,20 +302,20 @@ function M() {
291
302
  })
292
303
  ]
293
304
  }),
294
- /* @__PURE__ */ E(u, { children: [/* @__PURE__ */ T(f, { children: /* @__PURE__ */ T(p, { children: "Quick Actions" }) }), /* @__PURE__ */ E(d, {
305
+ /* @__PURE__ */ w(d, { children: [/* @__PURE__ */ C(p, { children: /* @__PURE__ */ C(m, { children: "Quick Actions" }) }), /* @__PURE__ */ w(f, {
295
306
  className: "space-y-2",
296
- children: [/* @__PURE__ */ E(l, {
307
+ children: [/* @__PURE__ */ w(u, {
297
308
  variant: "outline",
298
309
  className: "w-full justify-start",
299
310
  disabled: q,
300
311
  onClick: () => void Q("weekly"),
301
- children: [/* @__PURE__ */ T(e, { size: 16 }), " Schedule Report"]
302
- }), /* @__PURE__ */ E(l, {
312
+ children: [/* @__PURE__ */ C(e, { size: 16 }), " Schedule Report"]
313
+ }), /* @__PURE__ */ w(u, {
303
314
  variant: "outline",
304
315
  className: "w-full justify-start",
305
316
  disabled: q,
306
317
  onClick: () => void Q(),
307
- children: [/* @__PURE__ */ T(te, { size: 16 }), " Custom Report"]
318
+ children: [/* @__PURE__ */ C(o, { size: 16 }), " Custom Report"]
308
319
  })]
309
320
  })] })
310
321
  ]
@@ -314,4 +325,4 @@ function M() {
314
325
  });
315
326
  }
316
327
  //#endregion
317
- export { M as default };
328
+ export { A as default };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@burdenoff/microfe-movethewheels",
3
- "version": "2026.827.1",
3
+ "version": "2026.828.1",
4
4
  "description": "Burdenoff MoveTheWheels Microfrontend - Logistics & Supply Chain Management Platform",
5
5
  "type": "module",
6
6
  "files": [
@@ -37,7 +37,7 @@
37
37
  "build-storybook": "storybook build",
38
38
  "test:storybook": "test-storybook",
39
39
  "schema:pull": "graphql-codegen --project schema-wspace && graphql-codegen --project schema-global",
40
- "codegen": "graphql-codegen --project wspace && graphql-codegen --project global",
40
+ "codegen": "graphql-codegen --project wspace",
41
41
  "codegen:all": "bun run schema:pull && bun run codegen",
42
42
  "switch:status": "bun scripts/deps-mode.ts status",
43
43
  "switch:remote": "bun scripts/deps-mode.ts remote",
@@ -1,6 +1,4 @@
1
- import { useCallback, useMemo, useState } from 'react';
2
- import { useMoveTheWheels } from '../providers/MoveTheWheelsProvider';
3
- import { executeGraphQL } from '../utils/graphqlClient';
1
+ import { useCallback, useState } from 'react';
4
2
 
5
3
  export interface ImportExportResult {
6
4
  success: boolean;
@@ -8,26 +6,6 @@ export interface ImportExportResult {
8
6
  payload?: Record<string, unknown> | null;
9
7
  }
10
8
 
11
- const EXPORT_DATA_MUTATION = `
12
- mutation MovethewheelsExportData($input: MovethewheelsExportDataInput!) {
13
- exportData(input: $input) {
14
- success
15
- message
16
- payload
17
- }
18
- }
19
- `;
20
-
21
- const IMPORT_DATA_MUTATION = `
22
- mutation MovethewheelsImportData($input: MovethewheelsImportDataInput!) {
23
- importData(input: $input) {
24
- success
25
- message
26
- payload
27
- }
28
- }
29
- `;
30
-
31
9
  interface UseImportExportResult {
32
10
  exportData: (resource: string, format?: string) => Promise<ImportExportResult>;
33
11
  importData: (resource: string, payload: Record<string, unknown>) => Promise<ImportExportResult>;
@@ -35,66 +13,52 @@ interface UseImportExportResult {
35
13
  error: Error | null;
36
14
  }
37
15
 
16
+ /**
17
+ * Import/export surface withdrawn from wspace-movethewheels-svc by migration
18
+ * 20260707000001_movethewheels_reuse_cleanup. The service now exposes
19
+ * `exportMtwEntities` (async job, returns MtwExportJob) but no import
20
+ * counterpart, so the old synchronous exportData/importData mutations are no
21
+ * longer resolvable. This hook keeps the same contract for consumers but
22
+ * rejects calls with a clear message until a replacement import/export flow is
23
+ * designed. The original operations are preserved in
24
+ * src/operations/wspace/movethewheels/mutations/marketplace-reports.withdrawn.graphql.
25
+ */
38
26
  export function useImportExport(): UseImportExportResult {
39
- const { apiGatewayUrl, authToken, workspaceToken, workspaceId, tenantId, currentUser } =
40
- useMoveTheWheels();
41
27
  const [isBusy, setIsBusy] = useState(false);
42
28
  const [error, setError] = useState<Error | null>(null);
43
29
 
44
- const graphQLOptions = useMemo(
45
- () => ({
46
- apiGatewayUrl,
47
- authToken,
48
- workspaceToken,
49
- workspaceId,
50
- tenantId,
51
- actorId: currentUser?.id,
52
- }),
53
- [apiGatewayUrl, authToken, workspaceToken, workspaceId, tenantId, currentUser?.id]
54
- );
30
+ const withBusy = useCallback(async <T>(fn: () => Promise<T>): Promise<T> => {
31
+ setIsBusy(true);
32
+ setError(null);
33
+ try {
34
+ return await fn();
35
+ } catch (err) {
36
+ const normalized = err instanceof Error ? err : new Error('Import/export failed');
37
+ setError(normalized);
38
+ throw normalized;
39
+ } finally {
40
+ setIsBusy(false);
41
+ }
42
+ }, []);
55
43
 
56
44
  const exportData = useCallback(
57
- async (resource: string, format?: string): Promise<ImportExportResult> => {
58
- setIsBusy(true);
59
- setError(null);
60
- try {
61
- const data = await executeGraphQL<{ exportData: ImportExportResult }>(
62
- graphQLOptions,
63
- EXPORT_DATA_MUTATION,
64
- { input: { resource, format } }
45
+ async (resource: string, _format?: string): Promise<ImportExportResult> =>
46
+ withBusy(async () => {
47
+ throw new Error(
48
+ `Export for "${resource}" is not available: the import/export surface was withdrawn from the service.`
65
49
  );
66
- return data.exportData;
67
- } catch (fetchError) {
68
- const normalized = fetchError instanceof Error ? fetchError : new Error('Export failed');
69
- setError(normalized);
70
- throw normalized;
71
- } finally {
72
- setIsBusy(false);
73
- }
74
- },
75
- [graphQLOptions]
50
+ }),
51
+ [withBusy]
76
52
  );
77
53
 
78
54
  const importData = useCallback(
79
- async (resource: string, payload: Record<string, unknown>): Promise<ImportExportResult> => {
80
- setIsBusy(true);
81
- setError(null);
82
- try {
83
- const data = await executeGraphQL<{ importData: ImportExportResult }>(
84
- graphQLOptions,
85
- IMPORT_DATA_MUTATION,
86
- { input: { resource, payload } }
55
+ async (resource: string, _payload: Record<string, unknown>): Promise<ImportExportResult> =>
56
+ withBusy(async () => {
57
+ throw new Error(
58
+ `Import for "${resource}" is not available: the import surface was withdrawn from the service.`
87
59
  );
88
- return data.importData;
89
- } catch (fetchError) {
90
- const normalized = fetchError instanceof Error ? fetchError : new Error('Import failed');
91
- setError(normalized);
92
- throw normalized;
93
- } finally {
94
- setIsBusy(false);
95
- }
96
- },
97
- [graphQLOptions]
60
+ }),
61
+ [withBusy]
98
62
  );
99
63
 
100
64
  return { exportData, importData, isBusy, error };