@burdenoff/microfe-movethewheels 2026.731.1 → 2026.731.2
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.
|
@@ -32,6 +32,19 @@ function u(e) {
|
|
|
32
32
|
};
|
|
33
33
|
}
|
|
34
34
|
function d(e) {
|
|
35
|
+
return {
|
|
36
|
+
mode: e.mode,
|
|
37
|
+
distanceKm: e.distanceKm,
|
|
38
|
+
weightKg: e.weightKg,
|
|
39
|
+
lengthCm: e.lengthCm,
|
|
40
|
+
widthCm: e.widthCm,
|
|
41
|
+
heightCm: e.heightCm,
|
|
42
|
+
volumeCbm: e.volumeCbm,
|
|
43
|
+
containerType: e.containerType,
|
|
44
|
+
containerCount: e.containerCount
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
function f(e) {
|
|
35
48
|
return {
|
|
36
49
|
id: e.id,
|
|
37
50
|
legNumber: e.legNumber,
|
|
@@ -53,7 +66,7 @@ function d(e) {
|
|
|
53
66
|
currency: e.currency
|
|
54
67
|
};
|
|
55
68
|
}
|
|
56
|
-
function
|
|
69
|
+
function p(e) {
|
|
57
70
|
return {
|
|
58
71
|
id: e.id,
|
|
59
72
|
shipmentNumber: e.shipmentNumber,
|
|
@@ -65,10 +78,10 @@ function f(e) {
|
|
|
65
78
|
origin: e.origin ?? {},
|
|
66
79
|
destination: e.destination ?? {},
|
|
67
80
|
createdAt: e.createdAt,
|
|
68
|
-
legs: (e.legs ?? []).map(
|
|
81
|
+
legs: (e.legs ?? []).map(f)
|
|
69
82
|
};
|
|
70
83
|
}
|
|
71
|
-
function
|
|
84
|
+
function m() {
|
|
72
85
|
let { apiGatewayUrl: t, authToken: n, workspaceToken: r, workspaceId: a, tenantId: o, currentUser: s } = e();
|
|
73
86
|
return i(() => ({
|
|
74
87
|
apiGatewayUrl: t,
|
|
@@ -86,30 +99,30 @@ function p() {
|
|
|
86
99
|
s?.id
|
|
87
100
|
]);
|
|
88
101
|
}
|
|
89
|
-
function
|
|
90
|
-
let e =
|
|
91
|
-
|
|
102
|
+
function h() {
|
|
103
|
+
let e = m(), [i, o] = a([]), [f, h] = a(!1), [g, _] = a(null), v = n(async () => {
|
|
104
|
+
h(!0), _(null);
|
|
92
105
|
try {
|
|
93
106
|
o((await t(e, s, { pagination: {
|
|
94
107
|
limit: 100,
|
|
95
108
|
offset: 0
|
|
96
|
-
} })).shipments.map(
|
|
109
|
+
} })).shipments.map(p));
|
|
97
110
|
} catch (e) {
|
|
98
|
-
|
|
111
|
+
_(e instanceof Error ? e : /* @__PURE__ */ Error("Failed to load multi-modal shipments"));
|
|
99
112
|
} finally {
|
|
100
|
-
|
|
113
|
+
h(!1);
|
|
101
114
|
}
|
|
102
115
|
}, [e]);
|
|
103
116
|
return r(() => {
|
|
104
|
-
|
|
105
|
-
}, [
|
|
117
|
+
v();
|
|
118
|
+
}, [v]), {
|
|
106
119
|
shipments: i,
|
|
107
|
-
isLoading:
|
|
108
|
-
error:
|
|
109
|
-
refetch: () => void
|
|
110
|
-
calculateFreightRate: n(async (n) => (await t(e, c, { input:
|
|
120
|
+
isLoading: f,
|
|
121
|
+
error: g,
|
|
122
|
+
refetch: () => void v(),
|
|
123
|
+
calculateFreightRate: n(async (n) => (await t(e, c, { input: d(n) })).calculateFreightRate, [e]),
|
|
111
124
|
planMultiModalShipment: n(async (n) => {
|
|
112
|
-
let r =
|
|
125
|
+
let r = p((await t(e, l, { input: {
|
|
113
126
|
shipmentNumber: n.shipmentNumber,
|
|
114
127
|
customerId: n.customerId,
|
|
115
128
|
origin: n.origin,
|
|
@@ -121,4 +134,4 @@ function m() {
|
|
|
121
134
|
};
|
|
122
135
|
}
|
|
123
136
|
//#endregion
|
|
124
|
-
export {
|
|
137
|
+
export { h as useMultiModalShipments };
|
package/package.json
CHANGED
|
@@ -188,6 +188,27 @@ function toApiLeg(leg: ShipmentLegDraft) {
|
|
|
188
188
|
};
|
|
189
189
|
}
|
|
190
190
|
|
|
191
|
+
// FreightRateInput (shipment.gql) is intentionally narrower than
|
|
192
|
+
// CreateShipmentLegInput — it has no origin/destination/carrierName, only
|
|
193
|
+
// the fields that actually drive a rate calculation. Sending the full leg
|
|
194
|
+
// shape (as toApiLeg does for planMultiModalShipment/addShipmentLeg) trips
|
|
195
|
+
// GraphQL input-coercion on unknown fields, which the gateway surfaces as a
|
|
196
|
+
// masked "Unexpected error." 500 instead of a validation error — so this
|
|
197
|
+
// mapper must stay in lockstep with FreightRateInput's exact field set.
|
|
198
|
+
function toFreightRateInput(leg: ShipmentLegDraft) {
|
|
199
|
+
return {
|
|
200
|
+
mode: leg.mode,
|
|
201
|
+
distanceKm: leg.distanceKm,
|
|
202
|
+
weightKg: leg.weightKg,
|
|
203
|
+
lengthCm: leg.lengthCm,
|
|
204
|
+
widthCm: leg.widthCm,
|
|
205
|
+
heightCm: leg.heightCm,
|
|
206
|
+
volumeCbm: leg.volumeCbm,
|
|
207
|
+
containerType: leg.containerType,
|
|
208
|
+
containerCount: leg.containerCount,
|
|
209
|
+
};
|
|
210
|
+
}
|
|
211
|
+
|
|
191
212
|
function mapLeg(leg: ApiShipmentLeg): ShipmentLeg {
|
|
192
213
|
return {
|
|
193
214
|
id: leg.id,
|
|
@@ -277,7 +298,7 @@ export function useMultiModalShipments() {
|
|
|
277
298
|
const data = await executeGraphQL<{ calculateFreightRate: FreightRateQuote }>(
|
|
278
299
|
graphQLOptions,
|
|
279
300
|
CALCULATE_FREIGHT_RATE_QUERY,
|
|
280
|
-
{ input:
|
|
301
|
+
{ input: toFreightRateInput(leg) }
|
|
281
302
|
);
|
|
282
303
|
return data.calculateFreightRate;
|
|
283
304
|
},
|