@burdenoff/microfe-movethewheels 2026.1108.3 → 2026.1108.5

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.
@@ -1,6 +1,10 @@
1
1
  import { resolveGraphqlUrl as e } from "./graphqlClient.js";
2
2
  //#region src/movethewheels/utils/carrierIntegrations.ts
3
- var t = [
3
+ var t = new Set(["GEOTAB"]);
4
+ function n(e) {
5
+ return t.has(e);
6
+ }
7
+ var r = [
4
8
  {
5
9
  id: "PROJECT44",
6
10
  label: "project44"
@@ -13,22 +17,24 @@ var t = [
13
17
  id: "DESCARTES",
14
18
  label: "Descartes"
15
19
  }
16
- ], n = ["Motive", "Geotab"], r = [
20
+ ], i = [
17
21
  "ACTIVE",
18
22
  "PAUSED",
19
23
  "DISABLED"
20
24
  ];
21
- function i(e) {
25
+ function a(e) {
22
26
  switch (e) {
23
27
  case "GENERIC_WEBHOOK": return "Signed webhook";
24
28
  case "SAMSARA": return "Samsara";
29
+ case "MOTIVE": return "Motive";
30
+ case "GEOTAB": return "Geotab";
25
31
  case "SHIPROCKET": return "Shiprocket";
26
32
  case "PROJECT44": return "project44";
27
33
  case "FOURKITES": return "FourKites";
28
34
  case "DESCARTES": return "Descartes";
29
35
  }
30
36
  }
31
- var a = [
37
+ var o = [
32
38
  {
33
39
  type: "RouteStopArrival",
34
40
  becomes: "ARRIVED"
@@ -45,18 +51,98 @@ var a = [
45
51
  type: "GeofenceExit",
46
52
  becomes: "DEPARTED"
47
53
  }
48
- ], o = "mtwShipment";
49
- function s(e) {
54
+ ], s = [{
55
+ action: "vehicle_geofence_event",
56
+ becomes: "Arrived on geofence entry, Departed on exit"
57
+ }, {
58
+ action: "vehicle_location_updated",
59
+ becomes: "In transit, with the reported position"
60
+ }], c = "X-KT-Webhook-Signature", l = "mtwShipment";
61
+ function u(e) {
50
62
  let t = e.trim(), n = "Paste the secret key exactly as Samsara shows it on the webhook page.";
51
63
  if (!t || t.length % 4 != 0 || !/^[A-Za-z0-9+/]+={0,2}$/.test(t)) return n;
52
64
  let r = t.endsWith("==") ? 2 : +!!t.endsWith("=");
53
65
  return t.length / 4 * 3 - r < 16 ? n : null;
54
66
  }
55
- function c(e) {
67
+ function d(e) {
56
68
  let t = e.trim();
57
69
  return t && (t.length > 64 || !/^[A-Za-z0-9_.-]+$/.test(t)) ? "Use letters, numbers, dots, dashes or underscores (up to 64) for the external ID key." : null;
58
70
  }
59
- var l = ["X-Samsara-Signature", "X-Samsara-Timestamp"], u = [
71
+ var f = "my.geotab.com", p = [
72
+ "PICKED_UP",
73
+ "IN_TRANSIT",
74
+ "ARRIVED",
75
+ "DEPARTED",
76
+ "OUT_FOR_DELIVERY",
77
+ "DELIVERED",
78
+ "FAILED",
79
+ "RETURNED"
80
+ ], m = /^(?=.{1,253}$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\.geotab\.com$/, h = /^[A-Za-z0-9_.-]{1,64}$/;
81
+ function g(e) {
82
+ let t = e.trim().toLowerCase();
83
+ if (!t) return f;
84
+ let n = t.replace(/^https:\/\//, "").replace(/\/(apiv1\/?)?$/, "");
85
+ return m.test(n) ? n : null;
86
+ }
87
+ function _(e) {
88
+ let t = {}, n = e.split(/\r?\n/);
89
+ for (let [e, r] of n.entries()) {
90
+ let n = r.trim();
91
+ if (!n || n.startsWith("#")) continue;
92
+ let i = /^([^=:]+)[=:](.+)$/.exec(n), a = i?.[1]?.trim() ?? "", o = (i?.[2]?.trim() ?? "").toUpperCase().replace(/[\s-]+/g, "_");
93
+ if (!i || !h.test(a)) return {
94
+ ok: !1,
95
+ error: `Line ${e + 1}: write each mapping as <rule id> = <event>, e.g. RuleArriveId = ARRIVED.`
96
+ };
97
+ if (!p.includes(o)) return {
98
+ ok: !1,
99
+ error: `Line ${e + 1}: use one of ${p.join(", ")}.`
100
+ };
101
+ t[a] = o;
102
+ }
103
+ return Object.keys(t).length > 50 ? {
104
+ ok: !1,
105
+ error: "Map at most 50 rules."
106
+ } : {
107
+ ok: !0,
108
+ ruleEvents: t
109
+ };
110
+ }
111
+ function v(e) {
112
+ let t = g(e.server);
113
+ if (!t) return {
114
+ ok: !1,
115
+ error: "Use your MyGeotab server, e.g. my.geotab.com."
116
+ };
117
+ let n = e.database.trim();
118
+ if (!n || n.length > 255) return {
119
+ ok: !1,
120
+ error: "Enter the MyGeotab database name."
121
+ };
122
+ let r = e.userName.trim();
123
+ if (!r || r.length > 255) return {
124
+ ok: !1,
125
+ error: "Enter the MyGeotab user name."
126
+ };
127
+ let i = _(e.ruleMappings);
128
+ return i.ok ? !e.locationUpdates && Object.keys(i.ruleEvents).length === 0 ? {
129
+ ok: !1,
130
+ error: "Turn on GPS position updates or map at least one exception rule, or nothing is read."
131
+ } : {
132
+ ok: !0,
133
+ config: {
134
+ server: t,
135
+ database: n,
136
+ userName: r,
137
+ ruleEvents: i.ruleEvents,
138
+ locationUpdates: e.locationUpdates
139
+ }
140
+ } : i;
141
+ }
142
+ function y(e) {
143
+ return e ? e.length > 255 ? "The password can be at most 255 characters." : null : "Enter the MyGeotab password.";
144
+ }
145
+ var b = ["X-Samsara-Signature", "X-Samsara-Timestamp"], x = [
60
146
  "CREATED",
61
147
  "PICKED_UP",
62
148
  "IN_TRANSIT",
@@ -66,41 +152,41 @@ var l = ["X-Samsara-Signature", "X-Samsara-Timestamp"], u = [
66
152
  "DELIVERED",
67
153
  "FAILED",
68
154
  "RETURNED"
69
- ], d = "x-webhook-signature", f = "\n id\n workspaceId\n provider\n name\n status\n lastSyncAt\n lastErrorAt\n lastErrorMessage\n createdAt\n updatedAt\n", p = `
155
+ ], S = "x-webhook-signature", C = "\n id\n workspaceId\n provider\n name\n status\n lastSyncAt\n lastErrorAt\n lastErrorMessage\n createdAt\n updatedAt\n pollStatus {\n lastPollAt\n lastSuccessAt\n lastPollStatus\n lastPollError\n consecutiveFailures\n lastRecordsFetched\n lastUpdatesAccepted\n lastUpdatesSkipped\n }\n", w = `
70
156
  query MtwCarrierIntegrations($filter: IntegrationFilterInput, $pagination: PaginationInput) {
71
157
  integrations(filter: $filter, pagination: $pagination) {
72
- ${f}
158
+ ${C}
73
159
  }
74
160
  integrationsCount(filter: $filter)
75
161
  }
76
- `, m = "\n query MtwCarrierIntegrationCounts {\n all: integrationsCount\n active: integrationsCount(filter: { status: ACTIVE })\n }\n", h = "\n query MtwCarrierIntegrationEvents($integrationId: ID, $pagination: PaginationInput) {\n integrationEvents(integrationId: $integrationId, pagination: $pagination) {\n id\n integrationId\n externalEventId\n shipmentId\n eventType\n status\n errorMessage\n receivedAt\n processedAt\n }\n }\n", g = `
162
+ `, T = "\n query MtwCarrierIntegrationCounts {\n all: integrationsCount\n active: integrationsCount(filter: { status: ACTIVE })\n }\n", E = "\n query MtwCarrierIntegrationEvents($integrationId: ID, $pagination: PaginationInput) {\n integrationEvents(integrationId: $integrationId, pagination: $pagination) {\n id\n integrationId\n externalEventId\n shipmentId\n eventType\n status\n errorMessage\n receivedAt\n processedAt\n }\n }\n", D = `
77
163
  mutation CreateMtwCarrierIntegration($input: CreateIntegrationInput!) {
78
164
  createIntegration(input: $input) {
79
- ${f}
165
+ ${C}
80
166
  }
81
167
  }
82
- `, _ = `
168
+ `, O = `
83
169
  mutation UpdateMtwCarrierIntegration($id: ID!, $input: UpdateIntegrationInput!) {
84
170
  updateIntegration(id: $id, input: $input) {
85
- ${f}
171
+ ${C}
86
172
  }
87
173
  }
88
- `, v = "\n mutation DeleteMtwCarrierIntegration($id: ID!) {\n deleteIntegration(id: $id)\n }\n";
89
- function y(e = globalThis.crypto) {
174
+ `, k = "\n mutation PollMtwCarrierIntegrationNow($id: ID!) {\n pollIntegrationNow(id: $id) {\n integrationId\n status\n skippedReason\n recordsFetched\n updatesAccepted\n updatesSkipped\n error\n }\n }\n", A = "\n mutation DeleteMtwCarrierIntegration($id: ID!) {\n deleteIntegration(id: $id)\n }\n";
175
+ function j(e = globalThis.crypto) {
90
176
  let t = e.getRandomValues(new Uint8Array(32));
91
177
  return Array.from(t, (e) => e.toString(16).padStart(2, "0")).join("");
92
178
  }
93
- function b(e) {
179
+ function M(e) {
94
180
  return e.trim().length < 32 ? "Use a signing secret of at least 32 characters." : null;
95
181
  }
96
- function x(e) {
182
+ function N(e) {
97
183
  let t = e.trim();
98
184
  return t ? t.length > 120 ? "Keep the name under 120 characters." : null : "Give the integration a name.";
99
185
  }
100
- function S(t, n, r, i) {
186
+ function P(t, n, r, i) {
101
187
  return `${new URL(e(t), i).origin}/api/integrations/webhook/${n}/${r}`;
102
188
  }
103
- function C(e = /* @__PURE__ */ new Date()) {
189
+ function F(e = /* @__PURE__ */ new Date()) {
104
190
  return JSON.stringify({
105
191
  externalEventId: "evt_0001",
106
192
  trackingNumber: "YOUR-TRACKING-NUMBER",
@@ -114,31 +200,49 @@ function C(e = /* @__PURE__ */ new Date()) {
114
200
  details: "Departed origin hub"
115
201
  }, null, 2);
116
202
  }
117
- function w(e) {
203
+ function I(e) {
118
204
  return `'${e.split("'").join("'\\''")}'`;
119
205
  }
120
- function T(e) {
206
+ function L(e) {
121
207
  return [
122
208
  "BODY='{\"externalEventId\":\"evt_0001\",\"trackingNumber\":\"YOUR-TRACKING-NUMBER\",\"eventType\":\"IN_TRANSIT\"}'",
123
209
  "SIG=$(printf '%s' \"$BODY\" | openssl dgst -sha256 -hmac \"$MTW_WEBHOOK_SECRET\" -hex | sed 's/^.* //')",
124
- `curl -X POST ${w(e)} \\`,
210
+ `curl -X POST ${I(e)} \\`,
125
211
  " -H 'Content-Type: application/json' \\",
126
- ` -H "${d}: sha256=$SIG" \\`,
212
+ ` -H "${S}: sha256=$SIG" \\`,
127
213
  " --data \"$BODY\""
128
214
  ].join("\n");
129
215
  }
130
- function E(e) {
216
+ function R(e) {
131
217
  let t = e.toLowerCase().split("_").join(" ");
132
218
  return t.charAt(0).toUpperCase() + t.slice(1);
133
219
  }
134
- function D(e) {
220
+ function z(e) {
135
221
  return e === "ACTIVE" ? "default" : e === "PAUSED" ? "secondary" : "outline";
136
222
  }
137
- function O(e) {
223
+ function B(e) {
224
+ return e === "OK" ? "default" : e === "PARTIAL" ? "secondary" : e === "FAILED" ? "destructive" : "outline";
225
+ }
226
+ function V(e, t) {
227
+ if (!e?.lastPollAt) return "Not polled yet; the first poll runs within a few minutes.";
228
+ let n = t(e.lastPollAt);
229
+ if (e.lastPollStatus === "FAILED") {
230
+ let r = e.lastSuccessAt ? ` Last successful poll ${t(e.lastSuccessAt)}.` : "";
231
+ return `Last poll ${n} failed.${e.consecutiveFailures > 1 ? ` ${e.consecutiveFailures} failures in a row.` : ""}${r}`;
232
+ }
233
+ return `Last poll ${n}: ${e.lastRecordsFetched} records read, ${e.lastUpdatesAccepted} tracking events added, ${e.lastUpdatesSkipped} skipped (vehicle not matched or not on an in-progress route).`;
234
+ }
235
+ function H(e, t) {
236
+ if (t.status === "SKIPPED") return t.skippedReason === "POLL_IN_PROGRESS" ? `${e} is being polled right now; refresh in a moment.` : `${e} was not polled (${R(t.skippedReason ?? "skipped")}).`;
237
+ if (t.status === "FAILED") return `Polling ${e} failed: ${t.error ?? "unknown error"}`;
238
+ let n = t.status === "PARTIAL" ? " Some updates were refused; see the log." : "";
239
+ return `Polled ${e}: ${t.recordsFetched} records read, ${t.updatesAccepted} tracking events added.${n}`;
240
+ }
241
+ function U(e) {
138
242
  return e === "ACCEPTED" ? "default" : e === "DUPLICATE" || e === "PARTIAL" || e === "RECEIVED" ? "secondary" : "destructive";
139
243
  }
140
- function k(e) {
141
- return e === "ACTIVE" ? "Signed deliveries are accepted and become tracking events." : e === "PAUSED" ? "Deliveries are refused with HTTP 423 so the sender can retry after you resume." : "Deliveries are refused with HTTP 410. Resume to accept them again.";
244
+ function W(e, t = "GENERIC_WEBHOOK") {
245
+ return n(t) ? e === "ACTIVE" ? "Polled every 5 minutes; new records become tracking events." : "Not polled. Resume to start reading the feed again from where it stopped." : e === "ACTIVE" ? "Signed deliveries are accepted and become tracking events." : e === "PAUSED" ? "Deliveries are refused with HTTP 423 so the sender can retry after you resume." : "Deliveries are refused with HTTP 410. Resume to accept them again.";
142
246
  }
143
247
  //#endregion
144
- export { g as CREATE_INTEGRATION_MUTATION, o as DEFAULT_SAMSARA_SHIPMENT_KEY, v as DELETE_INTEGRATION_MUTATION, m as INTEGRATION_COUNTS_QUERY, h as INTEGRATION_EVENTS_QUERY, r as INTEGRATION_STATUSES, p as LIST_INTEGRATIONS_QUERY, n as PLANNED_ELD_PROVIDERS, t as ROADMAP_PROVIDERS, a as SAMSARA_EVENT_TYPES, l as SAMSARA_SIGNATURE_HEADERS, d as SIGNATURE_HEADER, u as TRACKING_EVENT_TYPES, _ as UPDATE_INTEGRATION_MUTATION, T as curlExample, O as eventStatusTone, C as examplePayload, c as externalIdKeyError, y as generateSigningSecret, E as humanize, x as integrationNameError, D as integrationStatusTone, i as providerLabel, s as samsaraSecretError, b as signingSecretError, k as statusExplanation, S as webhookUrl };
248
+ export { D as CREATE_INTEGRATION_MUTATION, f as DEFAULT_GEOTAB_SERVER, l as DEFAULT_SAMSARA_SHIPMENT_KEY, A as DELETE_INTEGRATION_MUTATION, p as GEOTAB_RULE_EVENT_TYPES, T as INTEGRATION_COUNTS_QUERY, E as INTEGRATION_EVENTS_QUERY, i as INTEGRATION_STATUSES, w as LIST_INTEGRATIONS_QUERY, s as MOTIVE_ACTIONS, c as MOTIVE_SIGNATURE_HEADER, k as POLL_INTEGRATION_NOW_MUTATION, r as ROADMAP_PROVIDERS, o as SAMSARA_EVENT_TYPES, b as SAMSARA_SIGNATURE_HEADERS, S as SIGNATURE_HEADER, x as TRACKING_EVENT_TYPES, O as UPDATE_INTEGRATION_MUTATION, v as buildGeotabConfig, L as curlExample, U as eventStatusTone, F as examplePayload, d as externalIdKeyError, j as generateSigningSecret, y as geotabPasswordError, R as humanize, N as integrationNameError, z as integrationStatusTone, n as isPolledProvider, H as pollResultMessage, V as pollStatusSummary, B as pollStatusTone, a as providerLabel, u as samsaraSecretError, M as signingSecretError, W as statusExplanation, P as webhookUrl };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@burdenoff/microfe-movethewheels",
3
- "version": "2026.1108.3",
3
+ "version": "2026.1108.5",
4
4
  "description": "Burdenoff MoveTheWheels Microfrontend - Logistics & Supply Chain Management Platform",
5
5
  "type": "module",
6
6
  "files": [