@burdenoff/microfe-movethewheels 2026.929.3 → 2026.929.4

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.
Files changed (50) hide show
  1. package/dist/generated/wspace-types.d.ts +1547 -64
  2. package/dist/hooks/useCustomers.js +3 -9
  3. package/dist/hooks/useFleet.js +146 -149
  4. package/dist/hooks/useInventory.js +178 -153
  5. package/dist/hooks/useRoutes.js +9 -9
  6. package/dist/hooks/useTracking.js +14 -16
  7. package/dist/movethewheels/hooks/useFleet.d.ts +9 -2
  8. package/dist/movethewheels/hooks/useInventory.d.ts +13 -12
  9. package/dist/movethewheels/hooks/useRoutes.d.ts +4 -1
  10. package/dist/movethewheels/types/index.d.ts +33 -23
  11. package/dist/movethewheels/utils/formatters.d.ts +1 -1
  12. package/dist/pages/CustomerDetailsPage.js +6 -6
  13. package/dist/pages/CustomersPage.js +2 -2
  14. package/dist/pages/DashboardPage.js +1 -1
  15. package/dist/pages/DriverDetailsPage.js +7 -3
  16. package/dist/pages/DriversPage.js +4 -4
  17. package/dist/pages/FleetPage.js +1 -1
  18. package/dist/pages/InventoryPage.js +11 -12
  19. package/dist/pages/LiveTrackingPage.js +4 -4
  20. package/dist/pages/ProductDetailsPage.js +408 -249
  21. package/dist/pages/ProductsPage.js +5 -5
  22. package/dist/pages/RouteDetailsPage.js +8 -10
  23. package/dist/pages/RoutesPage.js +2 -2
  24. package/dist/pages/TrackingPage.js +14 -8
  25. package/dist/pages/WarehouseDetailsPage.js +166 -163
  26. package/dist/pages/WarehousesPage.js +29 -21
  27. package/package.json +1 -1
  28. package/src/generated/wspace-types.ts +1762 -64
  29. package/src/movethewheels/hooks/useCustomers.ts +7 -9
  30. package/src/movethewheels/hooks/useFleet.ts +89 -31
  31. package/src/movethewheels/hooks/useInventory.ts +143 -49
  32. package/src/movethewheels/hooks/useRoutes.ts +36 -16
  33. package/src/movethewheels/hooks/useTracking.ts +23 -15
  34. package/src/movethewheels/pages/CustomerDetailsPage.tsx +14 -8
  35. package/src/movethewheels/pages/CustomersPage.tsx +5 -2
  36. package/src/movethewheels/pages/DashboardPage.tsx +3 -1
  37. package/src/movethewheels/pages/DriverDetailsPage.tsx +13 -3
  38. package/src/movethewheels/pages/DriversPage.tsx +1 -1
  39. package/src/movethewheels/pages/FleetPage.tsx +1 -1
  40. package/src/movethewheels/pages/InventoryPage.tsx +20 -16
  41. package/src/movethewheels/pages/LiveTrackingPage.tsx +6 -4
  42. package/src/movethewheels/pages/ProductDetailsPage.tsx +228 -49
  43. package/src/movethewheels/pages/ProductsPage.tsx +13 -5
  44. package/src/movethewheels/pages/RouteDetailsPage.tsx +16 -8
  45. package/src/movethewheels/pages/RoutesPage.tsx +4 -2
  46. package/src/movethewheels/pages/TrackingPage.tsx +25 -10
  47. package/src/movethewheels/pages/WarehouseDetailsPage.tsx +42 -29
  48. package/src/movethewheels/pages/WarehousesPage.tsx +23 -15
  49. package/src/movethewheels/types/index.ts +36 -24
  50. package/src/movethewheels/utils/formatters.ts +1 -1
@@ -2,24 +2,31 @@ import { useMoveTheWheels as e } from "../providers/MoveTheWheelsProvider.js";
2
2
  import { executeGraphQL as t } from "../utils/graphqlClient.js";
3
3
  import { useCallback as n, useEffect as r, useMemo as i, useState as a } from "react";
4
4
  //#region src/movethewheels/hooks/useInventory.ts
5
- var o = "\n query ListInventoryItems($filter: InventoryFilterInput, $pagination: PaginationInput) {\n inventoryItems(filter: $filter, pagination: $pagination) {\n id\n cargoItemId\n warehouseId\n onHand\n available\n allocated\n damaged\n reorderPoint\n createdAt\n updatedAt\n cargoItem {\n id\n name\n sku\n }\n warehouse {\n id\n name\n code\n }\n }\n inventoryItemsCount(filter: $filter)\n }\n", s = "\n query ListCargoItems($filter: CargoItemFilterInput, $pagination: PaginationInput) {\n cargoItems(filter: $filter, pagination: $pagination) {\n id\n sku\n name\n description\n category\n brand\n dimensions\n weight\n value\n hazardous\n fragile\n temperatureControlled\n createdAt\n updatedAt\n }\n cargoItemsCount(filter: $filter)\n }\n", c = "\n query ListWarehouses($filter: WarehouseFilterInput, $pagination: PaginationInput) {\n warehouses(filter: $filter, pagination: $pagination) {\n id\n name\n code\n type\n address\n status\n contactInfo\n operatingHours\n totalCapacity\n usedCapacity\n createdAt\n }\n warehousesCount(filter: $filter)\n }\n", l = "\n query GetCargoItem($id: ID!) {\n cargoItem(id: $id) {\n id\n sku\n name\n description\n category\n brand\n dimensions\n weight\n value\n hazardous\n fragile\n temperatureControlled\n createdAt\n updatedAt\n }\n }\n", u = "\n query GetWarehouse($id: ID!) {\n warehouse(id: $id) {\n id\n name\n code\n type\n address\n status\n contactInfo\n operatingHours\n totalCapacity\n usedCapacity\n createdAt\n }\n }\n", d = "\n query GetInventoryStats {\n inventoryStats {\n totalOnHand\n totalAvailable\n totalAllocated\n totalDamaged\n lowStockCount\n }\n cargoItemsCount\n warehousesCount\n }\n", f = "\n query ListInventoryTransactions($filter: InventoryFilterInput, $pagination: PaginationInput) {\n inventoryTransactions(filter: $filter, pagination: $pagination) {\n id\n transactionNumber\n type\n quantity\n cargoItemId\n warehouseId\n notes\n referenceType\n referenceId\n createdAt\n }\n }\n", p = "\n mutation CreateCargoItem($input: CreateCargoItemInput!) {\n createCargoItem(input: $input) {\n id\n sku\n name\n description\n category\n brand\n dimensions\n weight\n value\n hazardous\n fragile\n temperatureControlled\n createdAt\n updatedAt\n }\n }\n", m = "\n mutation UpdateCargoItem($id: ID!, $input: UpdateCargoItemInput!) {\n updateCargoItem(id: $id, input: $input) {\n id\n sku\n name\n description\n category\n brand\n dimensions\n weight\n value\n hazardous\n fragile\n temperatureControlled\n createdAt\n updatedAt\n }\n }\n", h = "\n mutation CreateWarehouse($input: CreateWarehouseInput!) {\n createWarehouse(input: $input) {\n id\n name\n code\n type\n address\n status\n contactInfo\n operatingHours\n totalCapacity\n usedCapacity\n createdAt\n }\n }\n", g = "\n mutation DeleteWarehouse($id: ID!) {\n deleteWarehouse(id: $id)\n }\n", _ = "\n mutation UpdateWarehouse($id: ID!, $input: UpdateWarehouseInput!) {\n updateWarehouse(id: $id, input: $input) {\n id\n name\n code\n type\n address\n status\n contactInfo\n operatingHours\n totalCapacity\n usedCapacity\n createdAt\n }\n }\n", v = "\n mutation AdjustInventoryStock($input: AdjustInventoryStockInput!) {\n adjustInventoryStock(input: $input) {\n id\n cargoItemId\n warehouseId\n onHand\n available\n allocated\n damaged\n reorderPoint\n createdAt\n updatedAt\n }\n }\n";
6
- function y(e) {
5
+ var o = "\n query ListInventoryItems($filter: InventoryFilterInput, $pagination: PaginationInput) {\n inventoryItems(filter: $filter, pagination: $pagination) {\n id\n cargoItemId\n warehouseId\n onHand\n available\n allocated\n damaged\n reorderPoint\n createdAt\n updatedAt\n cargoItem {\n id\n name\n sku\n }\n warehouse {\n id\n name\n code\n }\n }\n inventoryItemsCount(filter: $filter)\n }\n", s = "\n query ListCargoItems($filter: CargoItemFilterInput, $pagination: PaginationInput) {\n cargoItems(filter: $filter, pagination: $pagination) {\n id\n sku\n name\n description\n category\n brand\n dimensions\n weight\n value\n hazardous\n fragile\n temperatureControlled\n createdAt\n updatedAt\n }\n cargoItemsCount(filter: $filter)\n }\n", c = "\n query ListWarehouses($filter: WarehouseFilterInput, $pagination: PaginationInput) {\n warehouses(filter: $filter, pagination: $pagination) {\n id\n name\n code\n type\n address\n status\n contactInfo\n operatingHours\n totalCapacity\n usedCapacity\n createdAt\n }\n warehousesCount(filter: $filter)\n }\n", l = "\n query GetCargoItem($id: ID!) {\n cargoItem(id: $id) {\n id\n sku\n name\n description\n category\n brand\n dimensions\n weight\n value\n hazardous\n fragile\n temperatureControlled\n createdAt\n updatedAt\n }\n }\n", u = "\n query GetWarehouse($id: ID!) {\n warehouse(id: $id) {\n id\n name\n code\n type\n address\n status\n contactInfo\n operatingHours\n totalCapacity\n usedCapacity\n createdAt\n }\n }\n", d = "\n query GetInventoryStats {\n inventoryStats {\n totalOnHand\n totalAvailable\n totalAllocated\n totalDamaged\n lowStockCount\n }\n cargoItemsCount\n warehousesCount\n }\n", f = "\n query ListInventoryTransactions($filter: InventoryFilterInput, $pagination: PaginationInput) {\n inventoryTransactions(filter: $filter, pagination: $pagination) {\n id\n transactionNumber\n type\n quantity\n cargoItemId\n warehouseId\n notes\n referenceType\n referenceId\n createdAt\n }\n }\n", p = "\n mutation CreateCargoItem($input: CreateCargoItemInput!) {\n createCargoItem(input: $input) {\n id\n sku\n name\n description\n category\n brand\n dimensions\n weight\n value\n hazardous\n fragile\n temperatureControlled\n createdAt\n updatedAt\n }\n }\n", m = "\n mutation UpdateCargoItem($id: ID!, $input: UpdateCargoItemInput!) {\n updateCargoItem(id: $id, input: $input) {\n id\n sku\n name\n description\n category\n brand\n dimensions\n weight\n value\n hazardous\n fragile\n temperatureControlled\n createdAt\n updatedAt\n }\n }\n", h = "\n mutation DeleteCargoItem($id: ID!) {\n deleteCargoItem(id: $id)\n }\n", g = "\n mutation CreateWarehouse($input: CreateWarehouseInput!) {\n createWarehouse(input: $input) {\n id\n name\n code\n type\n address\n status\n contactInfo\n operatingHours\n totalCapacity\n usedCapacity\n createdAt\n }\n }\n", _ = "\n mutation DeleteWarehouse($id: ID!) {\n deleteWarehouse(id: $id)\n }\n", v = "\n mutation UpdateWarehouse($id: ID!, $input: UpdateWarehouseInput!) {\n updateWarehouse(id: $id, input: $input) {\n id\n name\n code\n type\n address\n status\n contactInfo\n operatingHours\n totalCapacity\n usedCapacity\n createdAt\n }\n }\n", y = "\n mutation AdjustInventoryStock($input: AdjustInventoryStockInput!) {\n adjustInventoryStock(input: $input) {\n id\n cargoItemId\n warehouseId\n onHand\n available\n allocated\n damaged\n reorderPoint\n createdAt\n updatedAt\n }\n }\n", b = "\n mutation TransferInventoryStock($input: TransferInventoryStockInput!) {\n transferInventoryStock(input: $input) {\n source {\n id\n cargoItemId\n warehouseId\n onHand\n available\n allocated\n damaged\n reorderPoint\n createdAt\n updatedAt\n }\n destination {\n id\n cargoItemId\n warehouseId\n onHand\n available\n allocated\n damaged\n reorderPoint\n createdAt\n updatedAt\n }\n }\n }\n";
6
+ function x(e) {
7
+ if (!e) return;
8
+ let t = {};
9
+ for (let n of [
10
+ "length",
11
+ "width",
12
+ "height"
13
+ ]) {
14
+ let r = e[n];
15
+ typeof r == "number" && Number.isFinite(r) && (t[n] = r);
16
+ }
17
+ return typeof e.unit == "string" && e.unit.trim() && (t.unit = e.unit), Object.keys(t).length > 0 ? t : void 0;
18
+ }
19
+ function S(e) {
7
20
  return {
8
21
  id: e.id,
9
22
  sku: e.sku,
10
23
  name: e.name,
11
- description: e.description ?? "",
12
- category: e.category ?? "general",
24
+ description: e.description ?? void 0,
25
+ category: e.category ?? void 0,
13
26
  brand: e.brand ?? void 0,
14
- dimensions: {
15
- length: 0,
16
- width: 0,
17
- height: 0,
18
- unit: "cm",
19
- ...e.dimensions ?? {}
20
- },
21
- weight: e.weight ?? 0,
22
- value: e.value ?? 0,
27
+ dimensions: x(e.dimensions),
28
+ weight: e.weight ?? void 0,
29
+ value: e.value ?? void 0,
23
30
  barcode: void 0,
24
31
  images: [],
25
32
  attributes: [],
@@ -30,41 +37,37 @@ function y(e) {
30
37
  updatedAt: new Date(e.updatedAt)
31
38
  };
32
39
  }
33
- function b(e) {
34
- let t = e.totalCapacity ?? 0, n = e.usedCapacity ?? 0, r = e.operatingHours ?? {}, i = {};
40
+ function C(e) {
41
+ return e ? Object.fromEntries(Object.entries(e).flatMap(([e, t]) => typeof t == "string" && t.trim() ? [[e, t]] : [])) : {};
42
+ }
43
+ function w(e) {
44
+ let t = typeof e.totalCapacity == "number" ? e.totalCapacity : void 0, n = typeof e.usedCapacity == "number" ? e.usedCapacity : void 0, r = e.operatingHours ?? {}, i = {};
35
45
  for (let [e, t] of Object.entries(r)) t && typeof t == "object" && "open" in t && "close" in t ? i[e] = {
36
46
  open: String(t.open),
37
47
  close: String(t.close)
38
48
  } : i[e] = null;
39
- let a = e.contactInfo ?? void 0;
49
+ let a = e.contactInfo ?? void 0, o = t !== void 0 && t > 0 && n !== void 0 ? n / t * 100 : void 0;
40
50
  return {
41
51
  id: e.id,
42
52
  name: e.name,
43
53
  code: e.code,
44
- address: {
45
- street: "",
46
- city: "",
47
- state: "",
48
- postalCode: "",
49
- country: "",
50
- ...e.address ?? {}
51
- },
52
- type: e.type?.toLowerCase() ?? "distribution",
53
- status: e.status ?? "ACTIVE",
54
+ address: C(e.address),
55
+ type: e.type.toLowerCase(),
56
+ status: e.status,
54
57
  capacity: {
55
58
  totalSpace: t,
56
59
  usedSpace: n
57
60
  },
58
61
  operatingHours: i,
59
62
  contactInfo: a ? {
60
- email: a.email ?? void 0,
61
- phone: a.phone ?? void 0
63
+ email: typeof a.email == "string" ? a.email : void 0,
64
+ phone: typeof a.phone == "string" ? a.phone : void 0
62
65
  } : void 0,
63
- utilization: t > 0 ? n / t * 100 : 0,
66
+ utilization: o,
64
67
  createdAt: new Date(e.createdAt)
65
68
  };
66
69
  }
67
- function x(e) {
70
+ function T(e) {
68
71
  return {
69
72
  id: e.id,
70
73
  productId: e.cargoItemId,
@@ -82,7 +85,7 @@ function x(e) {
82
85
  updatedAt: new Date(e.updatedAt)
83
86
  };
84
87
  }
85
- function S() {
88
+ function E() {
86
89
  let { apiGatewayUrl: t, authToken: n, workspaceToken: r, workspaceId: a, tenantId: o, currentUser: s } = e();
87
90
  return i(() => ({
88
91
  apiGatewayUrl: t,
@@ -100,32 +103,32 @@ function S() {
100
103
  s?.id
101
104
  ]);
102
105
  }
103
- function C(e = {}) {
104
- let { filters: l, search: u, limit: d = 10, offset: f = 0 } = e, C = i(() => l, [
106
+ function D(e = {}) {
107
+ let { filters: l, search: u, limit: d = 10, offset: f = 0 } = e, x = i(() => l, [
105
108
  l?.lowStock,
106
109
  l?.productId,
107
110
  l?.search,
108
111
  l?.warehouseId
109
- ]), w = S(), [T, E] = a([]), [D, O] = a([]), [k, A] = a([]), [j, M] = a([]), [N, P] = a(0), [F, I] = a(!1), [L, R] = a(!1), [z, B] = a(null), V = n(async () => {
110
- R(!0), B(null);
112
+ ]), C = E(), [D, O] = a([]), [k, A] = a([]), [j, M] = a([]), [N, P] = a([]), [F, I] = a(0), [L, R] = a(!1), [z, B] = a(!1), [V, H] = a(null), U = n(async () => {
113
+ B(!0), H(null);
111
114
  try {
112
115
  let e = {
113
- warehouseId: C?.warehouseId,
114
- cargoItemId: C?.productId,
115
- search: u || C?.search || void 0,
116
- lowStock: C?.lowStock || void 0
116
+ warehouseId: x?.warehouseId,
117
+ cargoItemId: x?.productId,
118
+ search: u || x?.search || void 0,
119
+ lowStock: x?.lowStock || void 0
117
120
  }, [n, r, i, a] = await Promise.all([
118
- t(w, o, {
121
+ t(C, o, {
119
122
  filter: e,
120
123
  pagination: {
121
124
  limit: d,
122
125
  offset: f
123
126
  }
124
127
  }),
125
- t(w, o, {
128
+ t(C, o, {
126
129
  filter: {
127
- warehouseId: C?.warehouseId,
128
- cargoItemId: C?.productId,
130
+ warehouseId: x?.warehouseId,
131
+ cargoItemId: x?.productId,
129
132
  lowStock: !0
130
133
  },
131
134
  pagination: {
@@ -133,101 +136,123 @@ function C(e = {}) {
133
136
  offset: 0
134
137
  }
135
138
  }),
136
- t(w, s, { pagination: {
139
+ t(C, s, { pagination: {
137
140
  limit: 5,
138
141
  offset: 0
139
142
  } }),
140
- t(w, c, { pagination: {
143
+ t(C, c, { pagination: {
141
144
  limit: 5,
142
145
  offset: 0
143
146
  } })
144
147
  ]);
145
- E(n.inventoryItems.map(x)), O(r.inventoryItems.map(x)), P(n.inventoryItemsCount), I(f + n.inventoryItems.length < n.inventoryItemsCount), A(i.cargoItems.map(y)), M(a.warehouses.map(b));
148
+ O(n.inventoryItems.map(T)), A(r.inventoryItems.map(T)), I(n.inventoryItemsCount), R(f + n.inventoryItems.length < n.inventoryItemsCount), M(i.cargoItems.map(S)), P(a.warehouses.map(w));
146
149
  } catch (e) {
147
- B(e instanceof Error ? e : /* @__PURE__ */ Error("Failed to load inventory data"));
150
+ H(e instanceof Error ? e : /* @__PURE__ */ Error("Failed to load inventory data"));
148
151
  } finally {
149
- R(!1);
152
+ B(!1);
150
153
  }
151
154
  }, [
155
+ x,
152
156
  C,
153
- w,
154
157
  d,
155
158
  f,
156
159
  u
157
160
  ]);
158
161
  r(() => {
159
- V();
160
- }, [V]);
161
- let H = n(() => {
162
- V();
163
- }, [V]), U = n(async (e, n, r) => {
164
- let i = T.find((t) => t.id === e);
162
+ U();
163
+ }, [U]);
164
+ let W = n(() => {
165
+ U();
166
+ }, [U]), G = n(async (e, n, r) => {
167
+ let i = D.find((t) => t.id === e);
165
168
  if (!i) throw Error("Inventory item not found");
166
- let a = x((await t(w, v, { input: {
169
+ let a = T((await t(C, y, { input: {
167
170
  id: e,
168
171
  onHand: i.quantity + n,
169
172
  available: i.availableQuantity + n,
170
173
  allocated: i.reservedQuantity,
171
174
  damaged: i.damagedQuantity
172
175
  } })).adjustInventoryStock);
173
- return E((t) => t.map((t) => t.id === e ? a : t)), a;
174
- }, [w, T]);
176
+ return O((t) => t.map((t) => t.id === e ? a : t)), a;
177
+ }, [C, D]), K = n(async (e, n, r, i) => {
178
+ if (!Number.isInteger(i) || i <= 0) throw Error("Transfer quantity must be a positive whole number.");
179
+ if (e === n) throw Error("Source and destination warehouses must be different.");
180
+ let a = D.find((t) => t.warehouseId === e && t.productId === r);
181
+ if (!a) throw Error("Source inventory not found");
182
+ let o = D.find((e) => e.warehouseId === n && e.productId === r);
183
+ if (!o) throw Error("Destination inventory not found");
184
+ let s = await t(C, b, { input: {
185
+ sourceInventoryItemId: a.id,
186
+ destinationInventoryItemId: o.id,
187
+ quantity: i
188
+ } }), c = T(s.transferInventoryStock.source), l = T(s.transferInventoryStock.destination);
189
+ O((e) => e.map((e) => e.id === c.id ? c : e.id === l.id ? l : e));
190
+ }, [C, D]), q = n(async (e) => {
191
+ let n = S((await t(C, p, { input: {
192
+ name: e.name,
193
+ sku: e.sku,
194
+ description: e.description,
195
+ category: e.category,
196
+ brand: e.brand,
197
+ dimensions: e.dimensions,
198
+ weight: e.weight,
199
+ value: e.value,
200
+ hazardous: e.hazardous,
201
+ fragile: e.fragile,
202
+ temperatureControlled: e.temperatureControlled
203
+ } })).createCargoItem);
204
+ return M((e) => [n, ...e]), n;
205
+ }, [C]), J = n(async (e) => {
206
+ let n = w((await t(C, g, { input: {
207
+ code: e.code,
208
+ name: e.name,
209
+ type: e.type,
210
+ address: e.address,
211
+ status: e.status,
212
+ contactInfo: e.contactInfo,
213
+ totalCapacity: e.totalCapacity,
214
+ usedCapacity: e.usedCapacity
215
+ } })).createWarehouse);
216
+ return P((e) => [n, ...e]), n;
217
+ }, [C]);
175
218
  return {
176
- inventory: T,
177
- lowStockItems: D,
178
- products: k,
179
- warehouses: j,
180
- totalItems: N,
181
- hasMore: F,
182
- isLoading: L,
183
- error: z,
184
- refetch: H,
185
- updateStock: U,
186
- transferStock: n(async (e, t, n, r) => {
187
- let i = T.find((t) => t.warehouseId === e && t.productId === n);
188
- if (!i) throw Error("Source inventory not found");
189
- await U(i.id, -Math.abs(r), "transfer out");
190
- let a = T.find((e) => e.warehouseId === t && e.productId === n);
191
- a && await U(a.id, Math.abs(r), "transfer in");
192
- }, [T, U]),
193
- createProduct: n(async (e) => {
194
- let n = y((await t(w, p, { input: {
195
- name: e.name,
196
- sku: e.sku,
197
- category: e.category,
198
- brand: e.brand,
199
- weight: e.weight
200
- } })).createCargoItem);
201
- return A((e) => [n, ...e]), n;
202
- }, [w]),
203
- createWarehouse: n(async (e) => {
204
- let n = b((await t(w, h, { input: {
205
- code: e.code,
206
- name: e.name,
207
- type: e.type,
208
- address: e.address,
209
- status: e.status,
210
- contactInfo: e.contactInfo,
211
- totalCapacity: e.totalCapacity,
212
- usedCapacity: e.usedCapacity
213
- } })).createWarehouse);
214
- return M((e) => [n, ...e]), n;
215
- }, [w]),
219
+ inventory: D,
220
+ lowStockItems: k,
221
+ products: j,
222
+ warehouses: N,
223
+ totalItems: F,
224
+ hasMore: L,
225
+ isLoading: z,
226
+ error: V,
227
+ refetch: W,
228
+ updateStock: G,
229
+ transferStock: K,
230
+ createProduct: q,
216
231
  updateProduct: n(async (e, n) => {
217
- let r = y((await t(w, m, {
232
+ let r = S((await t(C, m, {
218
233
  id: e,
219
234
  input: {
220
235
  name: n.name,
221
236
  sku: n.sku,
237
+ description: n.description,
222
238
  category: n.category,
223
239
  brand: n.brand,
224
- weight: n.weight
240
+ dimensions: n.dimensions,
241
+ weight: n.weight,
242
+ value: n.value,
243
+ hazardous: n.hazardous,
244
+ fragile: n.fragile,
245
+ temperatureControlled: n.temperatureControlled
225
246
  }
226
247
  })).updateCargoItem);
227
- return A((t) => t.map((t) => t.id === e ? r : t)), r;
228
- }, [w]),
248
+ return M((t) => t.map((t) => t.id === e ? r : t)), r;
249
+ }, [C]),
250
+ deleteProduct: n(async (e) => {
251
+ await t(C, h, { id: e }), M((t) => t.filter((t) => t.id !== e));
252
+ }, [C]),
253
+ createWarehouse: J,
229
254
  updateWarehouse: n(async (e, n) => {
230
- let r = b((await t(w, _, {
255
+ let r = w((await t(C, v, {
231
256
  id: e,
232
257
  input: {
233
258
  code: n.code,
@@ -240,16 +265,16 @@ function C(e = {}) {
240
265
  usedCapacity: n.usedCapacity
241
266
  }
242
267
  })).updateWarehouse);
243
- return M((t) => t.map((t) => t.id === e ? r : t)), r;
244
- }, [w]),
268
+ return P((t) => t.map((t) => t.id === e ? r : t)), r;
269
+ }, [C]),
245
270
  deleteWarehouse: n(async (e) => {
246
- await t(w, g, { id: e }), M((t) => t.filter((t) => t.id !== e));
247
- }, [w])
271
+ await t(C, _, { id: e }), P((t) => t.filter((t) => t.id !== e));
272
+ }, [C])
248
273
  };
249
274
  }
250
- function w(e = {}) {
251
- let { limit: i = 20, offset: o = 0, search: c, category: l } = e, u = S(), [d, f] = a([]), [p, m] = a(0), [h, g] = a(!1), [_, v] = a(!1), [b, x] = a(null), C = n(async () => {
252
- v(!0), x(null);
275
+ function O(e = {}) {
276
+ let { limit: i = 20, offset: o = 0, search: c, category: l } = e, u = E(), [d, f] = a([]), [p, m] = a(0), [h, g] = a(!1), [_, v] = a(!1), [y, b] = a(null), x = n(async () => {
277
+ v(!0), b(null);
253
278
  try {
254
279
  let e = await t(u, s, {
255
280
  filter: {
@@ -261,9 +286,9 @@ function w(e = {}) {
261
286
  offset: o
262
287
  }
263
288
  });
264
- g(o + e.cargoItems.length < e.cargoItemsCount), m(e.cargoItemsCount), f(e.cargoItems.map(y));
289
+ g(o + e.cargoItems.length < e.cargoItemsCount), m(e.cargoItemsCount), f(e.cargoItems.map(S));
265
290
  } catch (e) {
266
- x(e instanceof Error ? e : /* @__PURE__ */ Error("Failed to load products"));
291
+ b(e instanceof Error ? e : /* @__PURE__ */ Error("Failed to load products"));
267
292
  } finally {
268
293
  v(!1);
269
294
  }
@@ -275,19 +300,19 @@ function w(e = {}) {
275
300
  l
276
301
  ]);
277
302
  return r(() => {
278
- C();
279
- }, [C]), {
303
+ x();
304
+ }, [x]), {
280
305
  products: d,
281
306
  totalProducts: p,
282
307
  hasMore: h,
283
308
  isLoading: _,
284
- error: b,
285
- refetch: () => void C()
309
+ error: y,
310
+ refetch: () => void x()
286
311
  };
287
312
  }
288
- var T = "\n query CargoItemStats {\n cargoItemStats {\n total\n specialHandling\n temperatureControlled\n }\n }\n";
289
- function E() {
290
- let e = S(), [n, i] = a({
313
+ var k = "\n query CargoItemStats {\n cargoItemStats {\n total\n specialHandling\n temperatureControlled\n }\n }\n";
314
+ function A() {
315
+ let e = E(), [n, i] = a({
291
316
  total: 0,
292
317
  specialHandling: 0,
293
318
  temperatureControlled: 0
@@ -296,7 +321,7 @@ function E() {
296
321
  (async () => {
297
322
  s(!0), l(null);
298
323
  try {
299
- i((await t(e, T)).cargoItemStats);
324
+ i((await t(e, k)).cargoItemStats);
300
325
  } catch (e) {
301
326
  l(e instanceof Error ? e : /* @__PURE__ */ Error("Failed to load product stats"));
302
327
  } finally {
@@ -309,8 +334,8 @@ function E() {
309
334
  error: c
310
335
  };
311
336
  }
312
- function D(e) {
313
- let i = S(), [o, s] = a(null), [c, u] = a(!1), [d, f] = a(null), p = n(async () => {
337
+ function j(e) {
338
+ let i = E(), [o, s] = a(null), [c, u] = a(!1), [d, f] = a(null), p = n(async () => {
314
339
  if (!e) {
315
340
  s(null);
316
341
  return;
@@ -318,7 +343,7 @@ function D(e) {
318
343
  u(!0), f(null);
319
344
  try {
320
345
  let n = await t(i, l, { id: e });
321
- s(n.cargoItem ? y(n.cargoItem) : null);
346
+ s(n.cargoItem ? S(n.cargoItem) : null);
322
347
  } catch (e) {
323
348
  f(e instanceof Error ? e : /* @__PURE__ */ Error("Failed to load product"));
324
349
  } finally {
@@ -334,9 +359,9 @@ function D(e) {
334
359
  refetch: () => void p()
335
360
  };
336
361
  }
337
- function O(e = {}) {
338
- let { limit: i = 20, offset: o = 0, search: s, status: l } = e, u = S(), [d, f] = a([]), [p, m] = a(0), [h, g] = a(!1), [_, v] = a(!1), [y, x] = a(null), C = n(async () => {
339
- v(!0), x(null);
362
+ function M(e = {}) {
363
+ let { limit: i = 20, offset: o = 0, search: s, status: l } = e, u = E(), [d, f] = a([]), [p, m] = a(0), [h, g] = a(!1), [_, v] = a(!1), [y, b] = a(null), x = n(async () => {
364
+ v(!0), b(null);
340
365
  try {
341
366
  let e = await t(u, c, {
342
367
  filter: {
@@ -348,9 +373,9 @@ function O(e = {}) {
348
373
  offset: o
349
374
  }
350
375
  });
351
- m(e.warehousesCount), g(o + e.warehouses.length < e.warehousesCount), f(e.warehouses.map(b));
376
+ m(e.warehousesCount), g(o + e.warehouses.length < e.warehousesCount), f(e.warehouses.map(w));
352
377
  } catch (e) {
353
- x(e instanceof Error ? e : /* @__PURE__ */ Error("Failed to load warehouses"));
378
+ b(e instanceof Error ? e : /* @__PURE__ */ Error("Failed to load warehouses"));
354
379
  } finally {
355
380
  v(!1);
356
381
  }
@@ -362,19 +387,19 @@ function O(e = {}) {
362
387
  l
363
388
  ]);
364
389
  return r(() => {
365
- C();
366
- }, [C]), {
390
+ x();
391
+ }, [x]), {
367
392
  warehouses: d,
368
393
  totalWarehouses: p,
369
394
  hasMore: h,
370
395
  isLoading: _,
371
396
  error: y,
372
- refetch: () => void C()
397
+ refetch: () => void x()
373
398
  };
374
399
  }
375
- var k = "\n query WarehouseStats {\n warehouseStats {\n total\n active\n avgUtilization\n }\n }\n";
376
- function A() {
377
- let e = S(), [n, i] = a({
400
+ var N = "\n query WarehouseStats {\n warehouseStats {\n total\n active\n avgUtilization\n }\n }\n";
401
+ function P() {
402
+ let e = E(), [n, i] = a({
378
403
  total: 0,
379
404
  active: 0,
380
405
  avgUtilization: 0
@@ -383,7 +408,7 @@ function A() {
383
408
  (async () => {
384
409
  s(!0), l(null);
385
410
  try {
386
- i((await t(e, k)).warehouseStats);
411
+ i((await t(e, N)).warehouseStats);
387
412
  } catch (e) {
388
413
  l(e instanceof Error ? e : /* @__PURE__ */ Error("Failed to load warehouse stats"));
389
414
  } finally {
@@ -396,8 +421,8 @@ function A() {
396
421
  error: c
397
422
  };
398
423
  }
399
- function j(e) {
400
- let i = S(), [o, s] = a(null), [c, l] = a(!1), [d, f] = a(null), p = n(async () => {
424
+ function F(e) {
425
+ let i = E(), [o, s] = a(null), [c, l] = a(!1), [d, f] = a(null), p = n(async () => {
401
426
  if (!e) {
402
427
  s(null);
403
428
  return;
@@ -405,7 +430,7 @@ function j(e) {
405
430
  l(!0), f(null);
406
431
  try {
407
432
  let n = await t(i, u, { id: e });
408
- s(n.warehouse ? b(n.warehouse) : null);
433
+ s(n.warehouse ? w(n.warehouse) : null);
409
434
  } catch (e) {
410
435
  f(e instanceof Error ? e : /* @__PURE__ */ Error("Failed to load warehouse"));
411
436
  } finally {
@@ -422,8 +447,8 @@ function j(e) {
422
447
  reload: p
423
448
  };
424
449
  }
425
- function M() {
426
- let e = S(), [n, i] = a({
450
+ function I() {
451
+ let e = E(), [n, i] = a({
427
452
  totalOnHand: 0,
428
453
  totalAvailable: 0,
429
454
  totalAllocated: 0,
@@ -458,16 +483,16 @@ function M() {
458
483
  error: c
459
484
  };
460
485
  }
461
- var N = "\n query GetCargoItemStockLevels($cargoItemId: ID!, $pagination: PaginationInput) {\n inventoryItems(filter: { cargoItemId: $cargoItemId }, pagination: $pagination) {\n id\n onHand\n available\n allocated\n damaged\n reorderPoint\n warehouse {\n id\n name\n code\n }\n }\n inventoryItemsCount(filter: { cargoItemId: $cargoItemId })\n inventoryStats(filter: { cargoItemId: $cargoItemId }) {\n totalAvailable\n }\n }\n";
462
- function P(e, i = {}) {
463
- let { limit: o = 20, offset: s = 0 } = i, c = S(), [l, u] = a([]), [d, f] = a(0), [p, m] = a(0), [h, g] = a(!1), [_, v] = a(null), y = n(async () => {
486
+ var L = "\n query GetCargoItemStockLevels($cargoItemId: ID!, $pagination: PaginationInput) {\n inventoryItems(filter: { cargoItemId: $cargoItemId }, pagination: $pagination) {\n id\n onHand\n available\n allocated\n damaged\n reorderPoint\n warehouse {\n id\n name\n code\n }\n }\n inventoryItemsCount(filter: { cargoItemId: $cargoItemId })\n inventoryStats(filter: { cargoItemId: $cargoItemId }) {\n totalAvailable\n }\n }\n";
487
+ function R(e, i = {}) {
488
+ let { limit: o = 20, offset: s = 0 } = i, c = E(), [l, u] = a([]), [d, f] = a(0), [p, m] = a(0), [h, g] = a(!1), [_, v] = a(null), y = n(async () => {
464
489
  if (!e) {
465
490
  u([]), f(0), m(0);
466
491
  return;
467
492
  }
468
493
  g(!0), v(null);
469
494
  try {
470
- let n = await t(c, N, {
495
+ let n = await t(c, L, {
471
496
  cargoItemId: e,
472
497
  pagination: {
473
498
  limit: o,
@@ -512,22 +537,22 @@ function P(e, i = {}) {
512
537
  refetch: b
513
538
  };
514
539
  }
515
- var F = [
540
+ var z = [
516
541
  "RECEIPT",
517
542
  "ISSUE",
518
543
  "TRANSFER",
519
544
  "ADJUSTMENT",
520
545
  "RETURN"
521
546
  ];
522
- function I(e) {
547
+ function B(e) {
523
548
  let t = e.toUpperCase();
524
- return F.find((e) => e === t) ?? "ADJUSTMENT";
549
+ return z.find((e) => e === t) ?? "ADJUSTMENT";
525
550
  }
526
- function L(e) {
551
+ function V(e) {
527
552
  return {
528
553
  id: e.id,
529
554
  transactionNumber: e.transactionNumber,
530
- type: I(e.type),
555
+ type: B(e.type),
531
556
  quantity: e.quantity,
532
557
  productId: e.cargoItemId,
533
558
  warehouseId: e.warehouseId,
@@ -537,8 +562,8 @@ function L(e) {
537
562
  createdAt: new Date(e.createdAt)
538
563
  };
539
564
  }
540
- function R(e = {}) {
541
- let { limit: i = 10, productId: o, warehouseId: s } = e, c = S(), [l, u] = a([]), [d, p] = a(!1), [m, h] = a(null), g = n(async () => {
565
+ function H(e = {}) {
566
+ let { limit: i = 10, productId: o, warehouseId: s } = e, c = E(), [l, u] = a([]), [d, p] = a(!1), [m, h] = a(null), g = n(async () => {
542
567
  p(!0), h(null);
543
568
  try {
544
569
  u((await t(c, f, {
@@ -550,7 +575,7 @@ function R(e = {}) {
550
575
  limit: i,
551
576
  offset: 0
552
577
  }
553
- })).inventoryTransactions.map(L));
578
+ })).inventoryTransactions.map(V));
554
579
  } catch (e) {
555
580
  h(e instanceof Error ? e : /* @__PURE__ */ Error("Failed to load inventory transactions"));
556
581
  } finally {
@@ -574,4 +599,4 @@ function R(e = {}) {
574
599
  };
575
600
  }
576
601
  //#endregion
577
- export { C as useInventory, M as useInventoryStats, R as useInventoryTransactions, D as useProduct, E as useProductStats, P as useProductStockLevels, w as useProducts, j as useWarehouse, A as useWarehouseStats, O as useWarehouses };
602
+ export { D as useInventory, I as useInventoryStats, H as useInventoryTransactions, j as useProduct, A as useProductStats, R as useProductStockLevels, O as useProducts, F as useWarehouse, P as useWarehouseStats, M as useWarehouses };
@@ -32,13 +32,13 @@ function m(e) {
32
32
  state: String(i.state ?? n.state ?? ""),
33
33
  postalCode: String(i.postalCode ?? n.postalCode ?? ""),
34
34
  country: String(i.country ?? n.country ?? ""),
35
- latitude: Number(i.latitude ?? n.latitude ?? n.lat ?? 0),
36
- longitude: Number(i.longitude ?? n.longitude ?? n.lng ?? 0)
35
+ latitude: typeof (i.latitude ?? n.latitude ?? n.lat) == "number" ? i.latitude ?? n.latitude ?? n.lat : void 0,
36
+ longitude: typeof (i.longitude ?? n.longitude ?? n.lng) == "number" ? i.longitude ?? n.longitude ?? n.lng : void 0
37
37
  },
38
38
  type: n.type === "pickup" ? "pickup" : "delivery",
39
- scheduledTime: n.scheduledTime ? new Date(String(n.scheduledTime)) : /* @__PURE__ */ new Date(),
39
+ scheduledTime: n.scheduledTime ? new Date(String(n.scheduledTime)) : void 0,
40
40
  actualTime: n.actualTime ? new Date(String(n.actualTime)) : void 0,
41
- duration: Number(n.duration ?? 0),
41
+ duration: typeof n.duration == "number" ? n.duration : void 0,
42
42
  status: n.status ?? "pending",
43
43
  notes: n.notes ? String(n.notes) : void 0
44
44
  };
@@ -48,15 +48,15 @@ function h(e) {
48
48
  return {
49
49
  id: e.id,
50
50
  name: e.name,
51
- driverId: e.driverId ?? "",
52
- vehicleId: e.vehicleId ?? "",
51
+ driverId: e.driverId ?? void 0,
52
+ vehicleId: e.vehicleId ?? void 0,
53
53
  status: f(e.status),
54
54
  stops: m(e.waypoints),
55
55
  distance: e.actualDistance ?? e.estimatedDistance ?? 0,
56
56
  estimatedDuration: e.estimatedDuration ?? 0,
57
57
  fuelCost: e.fuelCost ?? void 0,
58
58
  actualDuration: e.actualDuration ?? void 0,
59
- optimized: (e.estimatedDistance ?? 0) > 0,
59
+ optimized: void 0,
60
60
  createdAt: new Date(e.createdAt)
61
61
  };
62
62
  }
@@ -133,8 +133,8 @@ function _(e = {}) {
133
133
  name: n.name,
134
134
  status: p(n.status),
135
135
  shipmentId: void 0,
136
- vehicleId: n.vehicleId,
137
- driverId: n.driverId,
136
+ vehicleId: Object.prototype.hasOwnProperty.call(n, "vehicleId") ? n.vehicleId ?? null : void 0,
137
+ driverId: Object.prototype.hasOwnProperty.call(n, "driverId") ? n.driverId ?? null : void 0,
138
138
  waypoints: n.stops,
139
139
  estimatedDuration: n.estimatedDuration,
140
140
  fuelCost: n.fuelCost