@burdenoff/microfe-movethewheels 2026.1108.4 → 2026.1109.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.
@@ -19,84 +19,84 @@ import { PageLayout as ie } from "../components/PageLayout.js";
19
19
  import { MetricCard as E, MetricGrid as ae } from "../components/MetricCard.js";
20
20
  import { FormError as D } from "../components/FormError.js";
21
21
  import { Notice as oe, useNotice as se } from "../components/Notice.js";
22
- import { DEFAULT_GEOTAB_SERVER as O, DEFAULT_SAMSARA_SHIPMENT_KEY as ce, GEOTAB_RULE_EVENT_TYPES as le, INTEGRATION_STATUSES as ue, PLANNED_ELD_PROVIDERS as k, ROADMAP_PROVIDERS as de, SAMSARA_EVENT_TYPES as A, SAMSARA_SIGNATURE_HEADERS as j, SIGNATURE_HEADER as M, TRACKING_EVENT_TYPES as N, buildGeotabConfig as fe, curlExample as P, eventStatusTone as F, examplePayload as pe, externalIdKeyError as me, generateSigningSecret as I, geotabPasswordError as L, humanize as R, integrationNameError as z, integrationStatusTone as B, isPolledProvider as he, pollResultMessage as ge, pollStatusSummary as V, pollStatusTone as _e, providerLabel as ve, samsaraSecretError as ye, signingSecretError as be, statusExplanation as xe, webhookUrl as Se } from "../utils/carrierIntegrations.js";
23
- import { useCarrierIntegrationActions as Ce, useCarrierIntegrationCounts as we, useCarrierIntegrationEvents as H, useCarrierIntegrations as Te } from "../hooks/useCarrierIntegrations.js";
24
- import { useEffect as Ee, useRef as De, useState as U } from "react";
25
- import { Fragment as W, jsx as G, jsxs as K } from "react/jsx-runtime";
26
- import { CTAOverflowMenu as Oe, PagePurpose as ke, ResponsiveDialog as q, ResponsiveDialogContent as J, ResponsiveDialogDescription as Y, ResponsiveDialogFooter as X, ResponsiveDialogHeader as Ae, ResponsiveDialogTitle as je } from "@burdenoff/fe-libs/ui";
22
+ import { DEFAULT_GEOTAB_SERVER as O, DEFAULT_SAMSARA_SHIPMENT_KEY as k, GEOTAB_RULE_EVENT_TYPES as A, INTEGRATION_STATUSES as ce, MOTIVE_ACTIONS as j, MOTIVE_SIGNATURE_HEADER as le, ROADMAP_PROVIDERS as M, SAMSARA_EVENT_TYPES as ue, SAMSARA_SIGNATURE_HEADERS as N, SIGNATURE_HEADER as P, TRACKING_EVENT_TYPES as F, buildGeotabConfig as I, curlExample as L, eventStatusTone as R, examplePayload as z, externalIdKeyError as B, generateSigningSecret as V, geotabPasswordError as H, humanize as U, integrationNameError as W, integrationStatusTone as de, isPolledProvider as fe, pollResultMessage as pe, pollStatusSummary as me, pollStatusTone as he, providerLabel as ge, samsaraSecretError as _e, signingSecretError as G, statusExplanation as ve, webhookUrl as ye } from "../utils/carrierIntegrations.js";
23
+ import { useCarrierIntegrationActions as be, useCarrierIntegrationCounts as xe, useCarrierIntegrationEvents as Se, useCarrierIntegrations as Ce } from "../hooks/useCarrierIntegrations.js";
24
+ import { useEffect as we, useRef as Te, useState as K } from "react";
25
+ import { Fragment as Ee, jsx as q, jsxs as J } from "react/jsx-runtime";
26
+ import { CTAOverflowMenu as De, PagePurpose as Oe, ResponsiveDialog as Y, ResponsiveDialogContent as X, ResponsiveDialogDescription as ke, ResponsiveDialogFooter as Ae, ResponsiveDialogHeader as je, ResponsiveDialogTitle as Me } from "@burdenoff/fe-libs/ui";
27
27
  //#region src/movethewheels/pages/IntegrationsPage.tsx
28
- var Me = 20, Z = "ALL";
28
+ var Ne = 20, Z = "ALL";
29
29
  function Q(e, t) {
30
30
  return e instanceof Error && e.message ? e.message : t;
31
31
  }
32
32
  function $({ label: e, value: n, multiline: r }) {
33
- let [i, o] = U(!1), s = async () => {
33
+ let [i, o] = K(!1), s = async () => {
34
34
  try {
35
35
  await navigator.clipboard.writeText(n), o(!0), window.setTimeout(() => o(!1), 2e3);
36
36
  } catch {
37
37
  o(!1);
38
38
  }
39
39
  };
40
- return /* @__PURE__ */ K("div", {
40
+ return /* @__PURE__ */ J("div", {
41
41
  className: "space-y-1",
42
- children: [/* @__PURE__ */ K("div", {
42
+ children: [/* @__PURE__ */ J("div", {
43
43
  className: "flex items-center justify-between gap-2",
44
- children: [/* @__PURE__ */ G("span", {
44
+ children: [/* @__PURE__ */ q("span", {
45
45
  className: "text-xs font-medium text-text-secondary",
46
46
  children: e
47
- }), /* @__PURE__ */ K(_, {
47
+ }), /* @__PURE__ */ J(_, {
48
48
  type: "button",
49
49
  size: "sm",
50
50
  variant: "ghost",
51
51
  onClick: () => void s(),
52
52
  "aria-label": `Copy ${e.toLowerCase()}`,
53
- children: [G(i ? t : a, {
53
+ children: [q(i ? t : a, {
54
54
  size: 14,
55
55
  className: "mr-1"
56
56
  }), i ? "Copied" : "Copy"]
57
57
  })]
58
- }), r ? /* @__PURE__ */ G("pre", {
58
+ }), r ? /* @__PURE__ */ q("pre", {
59
59
  className: "max-h-64 overflow-auto whitespace-pre-wrap break-all rounded-lg bg-bg-sunken px-3 py-2 font-mono text-xs text-text-primary",
60
60
  children: n
61
- }) : /* @__PURE__ */ G("code", {
61
+ }) : /* @__PURE__ */ q("code", {
62
62
  className: "block break-all rounded-lg bg-bg-sunken px-3 py-2 font-mono text-xs text-text-primary",
63
63
  children: n
64
64
  })]
65
65
  });
66
66
  }
67
- function Ne({ secret: e, integrationName: t, onClose: n }) {
68
- return /* @__PURE__ */ G(q, {
67
+ function Pe({ secret: e, integrationName: t, onClose: n }) {
68
+ return /* @__PURE__ */ q(Y, {
69
69
  open: e !== null,
70
70
  onOpenChange: (e) => !e && n(),
71
- children: /* @__PURE__ */ K(J, { children: [
72
- /* @__PURE__ */ K(Ae, { children: [/* @__PURE__ */ K(je, { children: ["Signing secret for ", t] }), /* @__PURE__ */ G(Y, { children: "Copy it into the sending system now. MoveTheWheels stores it to verify deliveries but will not show it again; rotate it if it is lost." })] }),
73
- e ? /* @__PURE__ */ G($, {
71
+ children: /* @__PURE__ */ J(X, { children: [
72
+ /* @__PURE__ */ J(je, { children: [/* @__PURE__ */ J(Me, { children: ["Signing secret for ", t] }), /* @__PURE__ */ q(ke, { children: "Copy it into the sending system now. MoveTheWheels stores it to verify deliveries but will not show it again; rotate it if it is lost." })] }),
73
+ e ? /* @__PURE__ */ q($, {
74
74
  label: "Signing secret",
75
75
  value: e
76
76
  }, e) : null,
77
- /* @__PURE__ */ G(X, { children: /* @__PURE__ */ G(_, {
77
+ /* @__PURE__ */ q(Ae, { children: /* @__PURE__ */ q(_, {
78
78
  onClick: n,
79
79
  children: "I have saved it"
80
80
  }) })
81
81
  ] })
82
82
  });
83
83
  }
84
- function Pe({ open: e, onOpenChange: t, onCreated: n }) {
85
- let r = Ce(), [i, a] = U("GENERIC_WEBHOOK"), [o, s] = U(""), [c, l] = U(() => I()), [u, f] = U(""), [p, m] = U(""), [h, g] = U(""), [v, y] = U(""), [T, ie] = U(""), [E, ae] = U(""), [oe, se] = U(""), [ue, k] = U(!0), [de, A] = U(null), [j, M] = U(!1), N = i === "SAMSARA", P = i === "GEOTAB", F = () => {
86
- a("GENERIC_WEBHOOK"), s(""), l(I()), f(""), m(""), g(""), y(""), ie(""), ae(""), se(""), k(!0), A(null);
87
- }, pe = () => {
88
- let e = fe({
84
+ function Fe({ open: e, onOpenChange: t, onCreated: n }) {
85
+ let r = be(), [i, a] = K("GENERIC_WEBHOOK"), [o, s] = K(""), [c, l] = K(() => V()), [u, f] = K(""), [p, m] = K(""), [h, g] = K(""), [v, y] = K(""), [T, ie] = K(""), [E, ae] = K(""), [oe, se] = K(""), [ce, j] = K(!0), [le, M] = K(null), [ue, N] = K(!1), P = i === "SAMSARA", F = i === "GEOTAB", L = i === "MOTIVE", R = () => {
86
+ a("GENERIC_WEBHOOK"), s(""), l(V()), f(""), m(""), g(""), y(""), ie(""), ae(""), se(""), j(!0), M(null);
87
+ }, z = () => {
88
+ let e = I({
89
89
  server: h,
90
90
  database: v,
91
91
  userName: T,
92
92
  ruleMappings: oe,
93
- locationUpdates: ue
93
+ locationUpdates: ce
94
94
  });
95
95
  if (!e.ok) return {
96
96
  error: e.error,
97
97
  input: null
98
98
  };
99
- let t = L(E);
99
+ let t = H(E);
100
100
  return t ? {
101
101
  error: t,
102
102
  input: null
@@ -109,96 +109,100 @@ function Pe({ open: e, onOpenChange: t, onCreated: n }) {
109
109
  config: e.config
110
110
  }
111
111
  };
112
- }, R = async (e) => {
112
+ }, U = async (e) => {
113
113
  e.preventDefault();
114
- let i = P ? pe() : null, a = z(o) ?? (P ? i?.error ?? null : N ? ye(u) ?? me(p) : be(c));
114
+ let i = F ? z() : null, a = W(o) ?? (F ? i?.error ?? null : P ? _e(u) ?? B(p) : G(c));
115
115
  if (a) {
116
- A(a);
116
+ M(a);
117
117
  return;
118
118
  }
119
- M(!0), A(null);
119
+ N(!0), M(null);
120
120
  try {
121
121
  let e = p.trim();
122
- n(await r.create(i?.input ? i.input : N ? {
122
+ n(await r.create(i?.input ? i.input : P ? {
123
123
  provider: "SAMSARA",
124
124
  name: o,
125
125
  apiSecret: u.trim(),
126
126
  ...e ? { config: { shipmentExternalIdKey: e } } : {}
127
127
  } : {
128
- provider: "GENERIC_WEBHOOK",
128
+ provider: L ? "MOTIVE" : "GENERIC_WEBHOOK",
129
129
  name: o,
130
130
  apiSecret: c
131
- }), N || P ? null : c), F(), t(!1);
131
+ }), P || F ? null : c), R(), t(!1);
132
132
  } catch (e) {
133
- A(Q(e, "Could not create the integration."));
133
+ M(Q(e, "Could not create the integration."));
134
134
  } finally {
135
- M(!1);
135
+ N(!1);
136
136
  }
137
137
  };
138
- return /* @__PURE__ */ G(q, {
138
+ return /* @__PURE__ */ q(Y, {
139
139
  open: e,
140
140
  onOpenChange: (e) => {
141
- e || F(), t(e);
141
+ e || R(), t(e);
142
142
  },
143
- children: /* @__PURE__ */ G(J, { children: /* @__PURE__ */ K("form", {
144
- onSubmit: (e) => void R(e),
143
+ children: /* @__PURE__ */ q(X, { children: /* @__PURE__ */ J("form", {
144
+ onSubmit: (e) => void U(e),
145
145
  className: "space-y-4",
146
146
  children: [
147
- /* @__PURE__ */ K(Ae, { children: [/* @__PURE__ */ G(je, { children: "Connect a tracking feed" }), /* @__PURE__ */ G(Y, { children: P ? "MoveTheWheels signs in to MyGeotab and reads new GPS positions and exception events every 5 minutes. They become tracking events on the matching shipments." : "A signed webhook from a carrier, ELD or GPS provider. Updates it sends become tracking events on the matching shipments." })] }),
148
- /* @__PURE__ */ K("div", {
147
+ /* @__PURE__ */ J(je, { children: [/* @__PURE__ */ q(Me, { children: "Connect a tracking feed" }), /* @__PURE__ */ q(ke, { children: F ? "MoveTheWheels signs in to MyGeotab and reads new GPS positions and exception events every 5 minutes. They become tracking events on the matching shipments." : "A signed webhook from a carrier, ELD or GPS provider. Updates it sends become tracking events on the matching shipments." })] }),
148
+ /* @__PURE__ */ J("div", {
149
149
  className: "space-y-1.5",
150
- children: [/* @__PURE__ */ G(S, {
150
+ children: [/* @__PURE__ */ q(S, {
151
151
  htmlFor: "integration-name",
152
152
  children: "Name"
153
- }), /* @__PURE__ */ G(x, {
153
+ }), /* @__PURE__ */ q(x, {
154
154
  id: "integration-name",
155
155
  value: o,
156
156
  maxLength: 120,
157
- placeholder: N ? "e.g. Samsara fleet" : P ? "e.g. Geotab fleet" : "e.g. Fleet GPS feed",
157
+ placeholder: P ? "e.g. Samsara fleet" : F ? "e.g. Geotab fleet" : L ? "e.g. Motive fleet" : "e.g. Fleet GPS feed",
158
158
  onChange: (e) => s(e.target.value),
159
159
  autoFocus: !0
160
160
  })]
161
161
  }),
162
- /* @__PURE__ */ K("div", {
162
+ /* @__PURE__ */ J("div", {
163
163
  className: "space-y-1.5",
164
- children: [/* @__PURE__ */ G(S, {
164
+ children: [/* @__PURE__ */ q(S, {
165
165
  htmlFor: "integration-type",
166
166
  children: "Type"
167
- }), /* @__PURE__ */ K(C, {
167
+ }), /* @__PURE__ */ J(C, {
168
168
  value: i,
169
169
  onValueChange: (e) => {
170
- a(e), A(null);
170
+ a(e), M(null);
171
171
  },
172
- children: [/* @__PURE__ */ G(te, {
172
+ children: [/* @__PURE__ */ q(te, {
173
173
  id: "integration-type",
174
174
  "aria-label": "Type",
175
- children: /* @__PURE__ */ G(ne, {})
176
- }), /* @__PURE__ */ K(ee, { children: [
177
- /* @__PURE__ */ G(w, {
175
+ children: /* @__PURE__ */ q(ne, {})
176
+ }), /* @__PURE__ */ J(ee, { children: [
177
+ /* @__PURE__ */ q(w, {
178
178
  value: "GENERIC_WEBHOOK",
179
179
  children: "Signed webhook (any system that can send HTTPS POSTs)"
180
180
  }),
181
- /* @__PURE__ */ G(w, {
181
+ /* @__PURE__ */ q(w, {
182
182
  value: "SAMSARA",
183
183
  children: "Samsara (ELD and telematics)"
184
184
  }),
185
- /* @__PURE__ */ G(w, {
185
+ /* @__PURE__ */ q(w, {
186
+ value: "MOTIVE",
187
+ children: "Motive, formerly KeepTruckin (ELD and telematics)"
188
+ }),
189
+ /* @__PURE__ */ q(w, {
186
190
  value: "GEOTAB",
187
191
  children: "Geotab / MyGeotab (telematics, polled)"
188
192
  })
189
193
  ] })]
190
194
  })]
191
195
  }),
192
- P ? /* @__PURE__ */ K(W, { children: [
193
- /* @__PURE__ */ K("div", {
196
+ F ? /* @__PURE__ */ J(Ee, { children: [
197
+ /* @__PURE__ */ J("div", {
194
198
  className: "grid gap-4 sm:grid-cols-2",
195
199
  children: [
196
- /* @__PURE__ */ K("div", {
200
+ /* @__PURE__ */ J("div", {
197
201
  className: "space-y-1.5",
198
- children: [/* @__PURE__ */ G(S, {
202
+ children: [/* @__PURE__ */ q(S, {
199
203
  htmlFor: "geotab-database",
200
204
  children: "MyGeotab database"
201
- }), /* @__PURE__ */ G(x, {
205
+ }), /* @__PURE__ */ q(x, {
202
206
  id: "geotab-database",
203
207
  value: v,
204
208
  maxLength: 255,
@@ -208,12 +212,12 @@ function Pe({ open: e, onOpenChange: t, onCreated: n }) {
208
212
  onChange: (e) => y(e.target.value)
209
213
  })]
210
214
  }),
211
- /* @__PURE__ */ K("div", {
215
+ /* @__PURE__ */ J("div", {
212
216
  className: "space-y-1.5",
213
- children: [/* @__PURE__ */ G(S, {
217
+ children: [/* @__PURE__ */ q(S, {
214
218
  htmlFor: "geotab-server",
215
219
  children: "Server (optional)"
216
- }), /* @__PURE__ */ G(x, {
220
+ }), /* @__PURE__ */ q(x, {
217
221
  id: "geotab-server",
218
222
  value: h,
219
223
  maxLength: 255,
@@ -223,12 +227,12 @@ function Pe({ open: e, onOpenChange: t, onCreated: n }) {
223
227
  onChange: (e) => g(e.target.value)
224
228
  })]
225
229
  }),
226
- /* @__PURE__ */ K("div", {
230
+ /* @__PURE__ */ J("div", {
227
231
  className: "space-y-1.5",
228
- children: [/* @__PURE__ */ G(S, {
232
+ children: [/* @__PURE__ */ q(S, {
229
233
  htmlFor: "geotab-user",
230
234
  children: "User name"
231
- }), /* @__PURE__ */ G(x, {
235
+ }), /* @__PURE__ */ q(x, {
232
236
  id: "geotab-user",
233
237
  value: T,
234
238
  maxLength: 255,
@@ -238,12 +242,12 @@ function Pe({ open: e, onOpenChange: t, onCreated: n }) {
238
242
  onChange: (e) => ie(e.target.value)
239
243
  })]
240
244
  }),
241
- /* @__PURE__ */ K("div", {
245
+ /* @__PURE__ */ J("div", {
242
246
  className: "space-y-1.5",
243
- children: [/* @__PURE__ */ G(S, {
247
+ children: [/* @__PURE__ */ q(S, {
244
248
  htmlFor: "geotab-password",
245
249
  children: "Password"
246
- }), /* @__PURE__ */ G(x, {
250
+ }), /* @__PURE__ */ q(x, {
247
251
  id: "geotab-password",
248
252
  type: "password",
249
253
  autoComplete: "new-password",
@@ -254,29 +258,29 @@ function Pe({ open: e, onOpenChange: t, onCreated: n }) {
254
258
  })
255
259
  ]
256
260
  }),
257
- /* @__PURE__ */ G("p", {
261
+ /* @__PURE__ */ q("p", {
258
262
  className: "text-xs text-text-secondary",
259
263
  children: "Use a dedicated MyGeotab user with read access to devices, GPS logs and exceptions. MoveTheWheels stores the password encrypted and never shows it again."
260
264
  }),
261
- /* @__PURE__ */ K("div", {
265
+ /* @__PURE__ */ J("div", {
262
266
  className: "flex items-center gap-3",
263
- children: [/* @__PURE__ */ G(b, {
267
+ children: [/* @__PURE__ */ q(b, {
264
268
  id: "geotab-locations",
265
- checked: ue,
266
- onCheckedChange: (e) => k(e === !0)
267
- }), /* @__PURE__ */ G(S, {
269
+ checked: ce,
270
+ onCheckedChange: (e) => j(e === !0)
271
+ }), /* @__PURE__ */ q(S, {
268
272
  htmlFor: "geotab-locations",
269
273
  children: "Add each vehicle's latest GPS position as an In transit event"
270
274
  })]
271
275
  }),
272
- /* @__PURE__ */ K("div", {
276
+ /* @__PURE__ */ J("div", {
273
277
  className: "space-y-1.5",
274
278
  children: [
275
- /* @__PURE__ */ G(S, {
279
+ /* @__PURE__ */ q(S, {
276
280
  htmlFor: "geotab-rules",
277
281
  children: "Exception rules to track (optional)"
278
282
  }),
279
- /* @__PURE__ */ G(re, {
283
+ /* @__PURE__ */ q(re, {
280
284
  id: "geotab-rules",
281
285
  value: oe,
282
286
  rows: 3,
@@ -284,24 +288,24 @@ function Pe({ open: e, onOpenChange: t, onCreated: n }) {
284
288
  placeholder: "RuleArriveCustomerId = ARRIVED\nRuleLeaveDepotId = DEPARTED",
285
289
  onChange: (e) => se(e.target.value)
286
290
  }),
287
- /* @__PURE__ */ K("p", {
291
+ /* @__PURE__ */ J("p", {
288
292
  className: "text-xs text-text-secondary",
289
293
  children: [
290
294
  "One per line: a MyGeotab rule id (for example a zone arrival rule) and the event it becomes: ",
291
- le.join(", "),
295
+ A.join(", "),
292
296
  ". Other rules are ignored."
293
297
  ]
294
298
  })
295
299
  ]
296
300
  })
297
- ] }) : N ? /* @__PURE__ */ K(W, { children: [/* @__PURE__ */ K("div", {
301
+ ] }) : P ? /* @__PURE__ */ J(Ee, { children: [/* @__PURE__ */ J("div", {
298
302
  className: "space-y-1.5",
299
303
  children: [
300
- /* @__PURE__ */ G(S, {
304
+ /* @__PURE__ */ q(S, {
301
305
  htmlFor: "samsara-secret",
302
306
  children: "Samsara webhook secret key"
303
307
  }),
304
- /* @__PURE__ */ G(x, {
308
+ /* @__PURE__ */ q(x, {
305
309
  id: "samsara-secret",
306
310
  type: "password",
307
311
  autoComplete: "off",
@@ -310,85 +314,85 @@ function Pe({ open: e, onOpenChange: t, onCreated: n }) {
310
314
  placeholder: "Paste from Samsara → Settings → Webhooks",
311
315
  onChange: (e) => f(e.target.value)
312
316
  }),
313
- /* @__PURE__ */ G("p", {
317
+ /* @__PURE__ */ q("p", {
314
318
  className: "text-xs text-text-secondary",
315
319
  children: "Create the webhook in Samsara first; its page shows this key. MoveTheWheels stores it encrypted and never shows it again."
316
320
  })
317
321
  ]
318
- }), /* @__PURE__ */ K("div", {
322
+ }), /* @__PURE__ */ J("div", {
319
323
  className: "space-y-1.5",
320
324
  children: [
321
- /* @__PURE__ */ G(S, {
325
+ /* @__PURE__ */ q(S, {
322
326
  htmlFor: "samsara-shipment-key",
323
327
  children: "Shipment external ID key (optional)"
324
328
  }),
325
- /* @__PURE__ */ G(x, {
329
+ /* @__PURE__ */ q(x, {
326
330
  id: "samsara-shipment-key",
327
331
  value: p,
328
332
  maxLength: 64,
329
- placeholder: ce,
333
+ placeholder: k,
330
334
  onChange: (e) => m(e.target.value)
331
335
  }),
332
- /* @__PURE__ */ K("p", {
336
+ /* @__PURE__ */ J("p", {
333
337
  className: "text-xs text-text-secondary",
334
338
  children: [
335
339
  "The external ID on a Samsara route or stop that holds the MoveTheWheels tracking number. Leave blank to use",
336
340
  " ",
337
- /* @__PURE__ */ G("code", {
341
+ /* @__PURE__ */ q("code", {
338
342
  className: "font-mono",
339
- children: ce
343
+ children: k
340
344
  }),
341
345
  "."
342
346
  ]
343
347
  })
344
348
  ]
345
- })] }) : /* @__PURE__ */ K("div", {
349
+ })] }) : /* @__PURE__ */ J("div", {
346
350
  className: "space-y-1.5",
347
351
  children: [
348
- /* @__PURE__ */ K("div", {
352
+ /* @__PURE__ */ J("div", {
349
353
  className: "flex items-center justify-between",
350
- children: [/* @__PURE__ */ G(S, { children: "Signing secret" }), /* @__PURE__ */ K(_, {
354
+ children: [/* @__PURE__ */ q(S, { children: "Signing secret" }), /* @__PURE__ */ J(_, {
351
355
  type: "button",
352
356
  size: "sm",
353
357
  variant: "ghost",
354
- onClick: () => l(I()),
355
- children: [/* @__PURE__ */ G(d, {
358
+ onClick: () => l(V()),
359
+ children: [/* @__PURE__ */ q(d, {
356
360
  size: 14,
357
361
  className: "mr-1"
358
362
  }), "Generate another"]
359
363
  })]
360
364
  }),
361
- /* @__PURE__ */ G("code", {
365
+ /* @__PURE__ */ q("code", {
362
366
  className: "block break-all rounded-lg bg-bg-sunken px-3 py-2 font-mono text-xs",
363
367
  children: c
364
368
  }),
365
- /* @__PURE__ */ G("p", {
369
+ /* @__PURE__ */ q("p", {
366
370
  className: "text-xs text-text-secondary",
367
- children: "Generated in your browser. You can copy it on the next step."
371
+ children: L ? "Generated in your browser. You can copy it on the next step and enter it as the secret on the Motive webhook." : "Generated in your browser. You can copy it on the next step."
368
372
  })
369
373
  ]
370
374
  }),
371
- /* @__PURE__ */ G(D, { message: de }),
372
- /* @__PURE__ */ K(X, { children: [/* @__PURE__ */ G(_, {
375
+ /* @__PURE__ */ q(D, { message: le }),
376
+ /* @__PURE__ */ J(Ae, { children: [/* @__PURE__ */ q(_, {
373
377
  type: "button",
374
378
  variant: "outline",
375
379
  onClick: () => t(!1),
376
380
  children: "Cancel"
377
- }), /* @__PURE__ */ G(_, {
381
+ }), /* @__PURE__ */ q(_, {
378
382
  type: "submit",
379
- disabled: j,
380
- children: j ? "Connecting…" : "Connect"
383
+ disabled: ue,
384
+ children: ue ? "Connecting…" : "Connect"
381
385
  })] })
382
386
  ]
383
387
  }) })
384
388
  });
385
389
  }
386
- function Fe({ integration: e, onClose: t, onReplace: n }) {
387
- let [r, i] = U(""), [a, o] = U(null), [s, c] = U(!1), l = e?.provider === "GEOTAB", u = () => {
390
+ function Ie({ integration: e, onClose: t, onReplace: n }) {
391
+ let [r, i] = K(""), [a, o] = K(null), [s, c] = K(!1), l = e?.provider === "GEOTAB", u = () => {
388
392
  i(""), o(null), t();
389
393
  }, d = async (t) => {
390
394
  if (t.preventDefault(), !e) return;
391
- let i = l ? L(r) : ye(r);
395
+ let i = l ? H(r) : _e(r);
392
396
  if (i) {
393
397
  o(i);
394
398
  return;
@@ -402,20 +406,20 @@ function Fe({ integration: e, onClose: t, onReplace: n }) {
402
406
  c(!1);
403
407
  }
404
408
  };
405
- return /* @__PURE__ */ G(q, {
409
+ return /* @__PURE__ */ q(Y, {
406
410
  open: e !== null,
407
411
  onOpenChange: (e) => !e && u(),
408
- children: /* @__PURE__ */ G(J, { children: /* @__PURE__ */ K("form", {
412
+ children: /* @__PURE__ */ q(X, { children: /* @__PURE__ */ J("form", {
409
413
  onSubmit: (e) => void d(e),
410
414
  className: "space-y-4",
411
415
  children: [
412
- /* @__PURE__ */ K(Ae, { children: [/* @__PURE__ */ G(je, { children: l ? `Update the MyGeotab password for ${e?.name ?? ""}` : `Replace the Samsara secret for ${e?.name ?? ""}` }), /* @__PURE__ */ G(Y, { children: l ? "Enter the current password of the MyGeotab user this feed signs in as. The next poll signs in with it." : "Regenerate the secret on the webhook page in Samsara, then paste the new key here. Deliveries signed with the old key are refused once you save." })] }),
413
- /* @__PURE__ */ K("div", {
416
+ /* @__PURE__ */ J(je, { children: [/* @__PURE__ */ q(Me, { children: l ? `Update the MyGeotab password for ${e?.name ?? ""}` : `Replace the Samsara secret for ${e?.name ?? ""}` }), /* @__PURE__ */ q(ke, { children: l ? "Enter the current password of the MyGeotab user this feed signs in as. The next poll signs in with it." : "Regenerate the secret on the webhook page in Samsara, then paste the new key here. Deliveries signed with the old key are refused once you save." })] }),
417
+ /* @__PURE__ */ J("div", {
414
418
  className: "space-y-1.5",
415
- children: [/* @__PURE__ */ G(S, {
419
+ children: [/* @__PURE__ */ q(S, {
416
420
  htmlFor: "samsara-new-secret",
417
421
  children: l ? "New MyGeotab password" : "New Samsara webhook secret key"
418
- }), /* @__PURE__ */ G(x, {
422
+ }), /* @__PURE__ */ q(x, {
419
423
  id: "samsara-new-secret",
420
424
  type: "password",
421
425
  autoComplete: "off",
@@ -425,13 +429,13 @@ function Fe({ integration: e, onClose: t, onReplace: n }) {
425
429
  autoFocus: !0
426
430
  })]
427
431
  }),
428
- /* @__PURE__ */ G(D, { message: a }),
429
- /* @__PURE__ */ K(X, { children: [/* @__PURE__ */ G(_, {
432
+ /* @__PURE__ */ q(D, { message: a }),
433
+ /* @__PURE__ */ J(Ae, { children: [/* @__PURE__ */ q(_, {
430
434
  type: "button",
431
435
  variant: "outline",
432
436
  onClick: u,
433
437
  children: "Cancel"
434
- }), /* @__PURE__ */ G(_, {
438
+ }), /* @__PURE__ */ q(_, {
435
439
  type: "submit",
436
440
  disabled: s,
437
441
  children: s ? "Saving…" : l ? "Update password" : "Replace secret"
@@ -440,43 +444,43 @@ function Fe({ integration: e, onClose: t, onReplace: n }) {
440
444
  }) })
441
445
  });
442
446
  }
443
- function Ie({ url: e }) {
444
- return /* @__PURE__ */ K("div", {
447
+ function Le({ url: e }) {
448
+ return /* @__PURE__ */ J("div", {
445
449
  className: "space-y-3",
446
450
  children: [
447
- /* @__PURE__ */ G("p", {
451
+ /* @__PURE__ */ q("p", {
448
452
  className: "text-sm font-medium",
449
453
  children: "How to connect Samsara"
450
454
  }),
451
- /* @__PURE__ */ G($, {
455
+ /* @__PURE__ */ q($, {
452
456
  label: "Webhook URL",
453
457
  value: e
454
458
  }),
455
- /* @__PURE__ */ K("ol", {
459
+ /* @__PURE__ */ J("ol", {
456
460
  className: "list-decimal space-y-1 pl-5 text-xs text-text-secondary",
457
461
  children: [
458
- /* @__PURE__ */ K("li", { children: [
462
+ /* @__PURE__ */ J("li", { children: [
459
463
  "In Samsara, open Settings → Developer → Webhooks, add a webhook with the URL above and subscribe it to",
460
464
  " ",
461
- A.map((e, t) => /* @__PURE__ */ K("span", { children: [t > 0 ? ", " : "", /* @__PURE__ */ G("code", {
465
+ ue.map((e, t) => /* @__PURE__ */ J("span", { children: [t > 0 ? ", " : "", /* @__PURE__ */ q("code", {
462
466
  className: "font-mono",
463
467
  children: e.type
464
468
  })] }, e.type)),
465
469
  "."
466
470
  ] }),
467
- /* @__PURE__ */ G("li", { children: "Route stop and geofence arrivals become Arrived events; departures become Departed events." }),
468
- /* @__PURE__ */ K("li", { children: [
471
+ /* @__PURE__ */ q("li", { children: "Route stop and geofence arrivals become Arrived events; departures become Departed events." }),
472
+ /* @__PURE__ */ J("li", { children: [
469
473
  "To match a shipment, put its MoveTheWheels tracking number in the route or stop external ID under the key chosen when this feed was connected (default",
470
474
  " ",
471
- /* @__PURE__ */ G("code", {
475
+ /* @__PURE__ */ q("code", {
472
476
  className: "font-mono",
473
- children: ce
477
+ children: k
474
478
  }),
475
479
  "). Without one, the Samsara vehicle name or licence plate is matched to a MoveTheWheels vehicle, and the event goes to that vehicle's single in-progress route."
476
480
  ] }),
477
- /* @__PURE__ */ K("li", { children: [
481
+ /* @__PURE__ */ J("li", { children: [
478
482
  "Samsara signs every delivery (",
479
- j.join(" and "),
483
+ N.join(" and "),
480
484
  "); deliveries with a wrong signature or more than five minutes old are refused."
481
485
  ] })
482
486
  ]
@@ -484,157 +488,203 @@ function Ie({ url: e }) {
484
488
  ]
485
489
  });
486
490
  }
487
- function Le({ integration: e }) {
488
- return /* @__PURE__ */ K("div", {
491
+ function Re({ url: e }) {
492
+ return /* @__PURE__ */ J("div", {
489
493
  className: "space-y-3",
490
494
  children: [
491
- /* @__PURE__ */ G("p", {
495
+ /* @__PURE__ */ q("p", {
496
+ className: "text-sm font-medium",
497
+ children: "How to connect Motive"
498
+ }),
499
+ /* @__PURE__ */ q($, {
500
+ label: "Webhook URL",
501
+ value: e
502
+ }),
503
+ /* @__PURE__ */ J("ol", {
504
+ className: "list-decimal space-y-1 pl-5 text-xs text-text-secondary",
505
+ children: [
506
+ /* @__PURE__ */ q("li", { children: "In the Motive dashboard, open Admin → Developer → Webhooks and add a webhook with the URL above, the JSON format and the signing secret shown when this feed was connected (rotate the secret here to get a new one)." }),
507
+ /* @__PURE__ */ J("li", { children: [
508
+ "Subscribe it to",
509
+ " ",
510
+ j.map((e, t) => /* @__PURE__ */ J("span", { children: [
511
+ t > 0 ? " and " : "",
512
+ /* @__PURE__ */ q("code", {
513
+ className: "font-mono",
514
+ children: e.action
515
+ }),
516
+ " (",
517
+ e.becomes.toLowerCase(),
518
+ ")"
519
+ ] }, e.action)),
520
+ ", then enable it. Motive sends an activation test that this feed answers automatically."
521
+ ] }),
522
+ /* @__PURE__ */ q("li", { children: "Motive deliveries carry no shipment reference, so the Motive vehicle number (or VIN) is matched to a MoveTheWheels vehicle by its vehicle number or licence plate, and the event goes to that vehicle's single in-progress route. Ambiguous matches are refused, never guessed." }),
523
+ /* @__PURE__ */ J("li", { children: [
524
+ "Motive signs every delivery with an HMAC-SHA1 of the body in",
525
+ " ",
526
+ /* @__PURE__ */ q("code", {
527
+ className: "font-mono",
528
+ children: le
529
+ }),
530
+ "; deliveries with a wrong signature are refused, and a repeated Motive event is recorded once."
531
+ ] })
532
+ ]
533
+ })
534
+ ]
535
+ });
536
+ }
537
+ function ze({ integration: e }) {
538
+ return /* @__PURE__ */ J("div", {
539
+ className: "space-y-3",
540
+ children: [
541
+ /* @__PURE__ */ q("p", {
492
542
  className: "text-sm font-medium",
493
543
  children: "How the Geotab feed works"
494
544
  }),
495
- /* @__PURE__ */ K("ol", {
545
+ /* @__PURE__ */ J("ol", {
496
546
  className: "list-decimal space-y-1 pl-5 text-xs text-text-secondary",
497
547
  children: [
498
- /* @__PURE__ */ K("li", { children: [
548
+ /* @__PURE__ */ J("li", { children: [
499
549
  "Every ",
500
550
  5,
501
551
  " minutes MoveTheWheels signs in to MyGeotab and reads the GPS log and exception events added since the last poll. Nothing is set up in Geotab."
502
552
  ] }),
503
- /* @__PURE__ */ G("li", { children: "Each Geotab vehicle is matched to a MoveTheWheels vehicle by its name, licence plate or VIN; the event goes to that vehicle's single in-progress route. Records for vehicles that are not on a route are skipped." }),
504
- /* @__PURE__ */ G("li", { children: "The newest GPS position of each vehicle becomes an In transit event with its location, when position updates are on. Mapped exception rules (typically zone arrivals and departures) become the events they are mapped to." }),
505
- /* @__PURE__ */ G("li", { children: "Repeated sign-in failures slow the polling down so the MyGeotab user is not locked out; update the password, then use Poll now." })
553
+ /* @__PURE__ */ q("li", { children: "Each Geotab vehicle is matched to a MoveTheWheels vehicle by its name, licence plate or VIN; the event goes to that vehicle's single in-progress route. Records for vehicles that are not on a route are skipped." }),
554
+ /* @__PURE__ */ q("li", { children: "The newest GPS position of each vehicle becomes an In transit event with its location, when position updates are on. Mapped exception rules (typically zone arrivals and departures) become the events they are mapped to." }),
555
+ /* @__PURE__ */ q("li", { children: "Repeated sign-in failures slow the polling down so the MyGeotab user is not locked out; update the password, then use Poll now." })
506
556
  ]
507
557
  }),
508
- /* @__PURE__ */ G(Re, { integration: e })
558
+ /* @__PURE__ */ q(Be, { integration: e })
509
559
  ]
510
560
  });
511
561
  }
512
- function Re({ integration: e }) {
562
+ function Be({ integration: e }) {
513
563
  let t = e.pollStatus;
514
- return /* @__PURE__ */ K("div", {
564
+ return /* @__PURE__ */ J("div", {
515
565
  className: "space-y-1 rounded-lg bg-bg-sunken px-3 py-2",
516
566
  "data-testid": "poll-status",
517
567
  children: [
518
- /* @__PURE__ */ K("div", {
568
+ /* @__PURE__ */ J("div", {
519
569
  className: "flex items-center gap-2",
520
- children: [/* @__PURE__ */ G("span", {
570
+ children: [/* @__PURE__ */ q("span", {
521
571
  className: "text-xs font-medium",
522
572
  children: "Latest poll"
523
- }), t?.lastPollStatus ? /* @__PURE__ */ G(g, {
524
- variant: _e(t.lastPollStatus),
525
- children: R(t.lastPollStatus)
573
+ }), t?.lastPollStatus ? /* @__PURE__ */ q(g, {
574
+ variant: he(t.lastPollStatus),
575
+ children: U(t.lastPollStatus)
526
576
  }) : null]
527
577
  }),
528
- /* @__PURE__ */ G("p", {
578
+ /* @__PURE__ */ q("p", {
529
579
  className: "text-xs text-text-secondary",
530
- children: V(t, h)
580
+ children: me(t, h)
531
581
  }),
532
- t?.lastPollError ? /* @__PURE__ */ G("p", {
582
+ t?.lastPollError ? /* @__PURE__ */ q("p", {
533
583
  className: "break-words text-xs text-status-error-text",
534
584
  children: t.lastPollError
535
585
  }) : null
536
586
  ]
537
587
  });
538
588
  }
539
- function ze({ integrationId: e, refreshKey: t, polled: n = !1 }) {
540
- let { events: r, isLoading: i, error: a } = H(e, t);
541
- return /* @__PURE__ */ K("div", {
589
+ function Ve({ integrationId: e, refreshKey: t, polled: n = !1 }) {
590
+ let { events: r, isLoading: i, error: a } = Se(e, t);
591
+ return /* @__PURE__ */ J("div", {
542
592
  className: "space-y-2",
543
593
  children: [
544
- /* @__PURE__ */ G("p", {
594
+ /* @__PURE__ */ q("p", {
545
595
  className: "text-sm font-medium",
546
596
  children: n ? "Recent polls" : "Recent deliveries"
547
597
  }),
548
- /* @__PURE__ */ G(D, { message: a?.message }),
549
- i && r.length === 0 ? /* @__PURE__ */ G(T, { className: "h-12 w-full" }) : r.length === 0 ? /* @__PURE__ */ G("p", {
598
+ /* @__PURE__ */ q(D, { message: a?.message }),
599
+ i && r.length === 0 ? /* @__PURE__ */ q(T, { className: "h-12 w-full" }) : r.length === 0 ? /* @__PURE__ */ q("p", {
550
600
  className: "text-sm text-text-secondary",
551
601
  children: n ? "No polls with updates yet. Polls that find nothing to add are not listed." : "No deliveries yet. Send a signed test update with the example below."
552
- }) : /* @__PURE__ */ G("ul", {
602
+ }) : /* @__PURE__ */ q("ul", {
553
603
  className: "space-y-2",
554
- children: r.map((e) => /* @__PURE__ */ K("li", {
604
+ children: r.map((e) => /* @__PURE__ */ J("li", {
555
605
  className: "flex flex-wrap items-start justify-between gap-3 rounded-lg bg-bg-sunken px-3 py-2",
556
- children: [/* @__PURE__ */ K("div", {
606
+ children: [/* @__PURE__ */ J("div", {
557
607
  className: "min-w-0",
558
608
  children: [
559
- /* @__PURE__ */ K("p", {
609
+ /* @__PURE__ */ J("p", {
560
610
  className: "text-sm font-medium",
561
- children: [e.eventType ? R(e.eventType) : n ? "Poll" : "Delivery", e.externalEventId ? /* @__PURE__ */ G("span", {
611
+ children: [e.eventType ? U(e.eventType) : n ? "Poll" : "Delivery", e.externalEventId ? /* @__PURE__ */ q("span", {
562
612
  className: "ml-2 font-mono text-xs text-text-tertiary",
563
613
  children: e.externalEventId
564
614
  }) : null]
565
615
  }),
566
- /* @__PURE__ */ G("p", {
616
+ /* @__PURE__ */ q("p", {
567
617
  className: "text-xs text-text-secondary",
568
618
  children: h(e.receivedAt)
569
619
  }),
570
- e.errorMessage ? /* @__PURE__ */ G("p", {
620
+ e.errorMessage ? /* @__PURE__ */ q("p", {
571
621
  className: "mt-1 break-words text-xs text-status-error-text",
572
622
  children: e.errorMessage
573
623
  }) : null
574
624
  ]
575
- }), /* @__PURE__ */ G(g, {
576
- variant: F(e.status),
577
- children: R(e.status)
625
+ }), /* @__PURE__ */ q(g, {
626
+ variant: R(e.status),
627
+ children: U(e.status)
578
628
  })]
579
629
  }, e.id))
580
630
  })
581
631
  ]
582
632
  });
583
633
  }
584
- function Be({ url: e }) {
585
- return /* @__PURE__ */ K("div", {
634
+ function He({ url: e }) {
635
+ return /* @__PURE__ */ J("div", {
586
636
  className: "space-y-3",
587
637
  children: [
588
- /* @__PURE__ */ G("p", {
638
+ /* @__PURE__ */ q("p", {
589
639
  className: "text-sm font-medium",
590
640
  children: "How to send updates"
591
641
  }),
592
- /* @__PURE__ */ G($, {
642
+ /* @__PURE__ */ q($, {
593
643
  label: "Webhook URL",
594
644
  value: e
595
645
  }),
596
- /* @__PURE__ */ K("ul", {
646
+ /* @__PURE__ */ J("ul", {
597
647
  className: "list-disc space-y-1 pl-5 text-xs text-text-secondary",
598
648
  children: [
599
- /* @__PURE__ */ K("li", { children: [
649
+ /* @__PURE__ */ J("li", { children: [
600
650
  "POST JSON: one update object, or an array of up to ",
601
651
  5,
602
652
  "."
603
653
  ] }),
604
- /* @__PURE__ */ K("li", { children: [
654
+ /* @__PURE__ */ J("li", { children: [
605
655
  "Sign the exact raw body with HMAC-SHA256 using the signing secret and send the hex digest in the ",
606
- /* @__PURE__ */ G("code", {
656
+ /* @__PURE__ */ q("code", {
607
657
  className: "font-mono",
608
- children: M
658
+ children: P
609
659
  }),
610
660
  " header (a",
611
661
  " ",
612
- /* @__PURE__ */ G("code", {
662
+ /* @__PURE__ */ q("code", {
613
663
  className: "font-mono",
614
664
  children: "sha256="
615
665
  }),
616
666
  " prefix is accepted)."
617
667
  ] }),
618
- /* @__PURE__ */ K("li", { children: [
668
+ /* @__PURE__ */ J("li", { children: [
619
669
  "Identify the shipment with ",
620
- /* @__PURE__ */ G("code", {
670
+ /* @__PURE__ */ q("code", {
621
671
  className: "font-mono",
622
672
  children: "trackingNumber"
623
673
  }),
624
674
  " or its",
625
675
  " ",
626
- /* @__PURE__ */ G("code", {
676
+ /* @__PURE__ */ q("code", {
627
677
  className: "font-mono",
628
678
  children: "shipmentId"
629
679
  }),
630
680
  ". Event types:",
631
681
  " ",
632
- N.join(", "),
682
+ F.join(", "),
633
683
  "."
634
684
  ] }),
635
- /* @__PURE__ */ K("li", { children: [
685
+ /* @__PURE__ */ J("li", { children: [
636
686
  "Send a stable ",
637
- /* @__PURE__ */ G("code", {
687
+ /* @__PURE__ */ q("code", {
638
688
  className: "font-mono",
639
689
  children: "externalEventId"
640
690
  }),
@@ -642,52 +692,52 @@ function Be({ url: e }) {
642
692
  ] })
643
693
  ]
644
694
  }),
645
- /* @__PURE__ */ G($, {
695
+ /* @__PURE__ */ q($, {
646
696
  label: "Example body",
647
- value: pe(),
697
+ value: z(),
648
698
  multiline: !0
649
699
  }),
650
- /* @__PURE__ */ G($, {
700
+ /* @__PURE__ */ q($, {
651
701
  label: "Example request",
652
- value: P(e),
702
+ value: L(e),
653
703
  multiline: !0
654
704
  })
655
705
  ]
656
706
  });
657
707
  }
658
- function Ve({ integration: e, url: t, expanded: a, refreshKey: l, busy: u, onToggle: d, onSetStatus: f, onRotate: m, onPoll: b, onDelete: x }) {
659
- let S = e.status === "ACTIVE", C = he(e.provider);
660
- return /* @__PURE__ */ G(v, { children: /* @__PURE__ */ K(y, {
708
+ function Ue({ integration: e, url: t, expanded: a, refreshKey: l, busy: u, onToggle: d, onSetStatus: f, onRotate: m, onPoll: b, onDelete: x }) {
709
+ let S = e.status === "ACTIVE", C = fe(e.provider);
710
+ return /* @__PURE__ */ q(v, { children: /* @__PURE__ */ J(y, {
661
711
  className: "p-5",
662
- children: [/* @__PURE__ */ K("div", {
712
+ children: [/* @__PURE__ */ J("div", {
663
713
  className: "flex flex-wrap items-start justify-between gap-3",
664
- children: [/* @__PURE__ */ K("div", {
714
+ children: [/* @__PURE__ */ J("div", {
665
715
  className: "min-w-0 space-y-1",
666
716
  children: [
667
- /* @__PURE__ */ K("div", {
717
+ /* @__PURE__ */ J("div", {
668
718
  className: "flex flex-wrap items-center gap-2",
669
- children: [/* @__PURE__ */ G("p", {
719
+ children: [/* @__PURE__ */ q("p", {
670
720
  className: "text-base font-semibold",
671
721
  children: e.name
672
- }), /* @__PURE__ */ G(g, {
673
- variant: B(e.status),
674
- children: R(e.status)
722
+ }), /* @__PURE__ */ q(g, {
723
+ variant: de(e.status),
724
+ children: U(e.status)
675
725
  })]
676
726
  }),
677
- /* @__PURE__ */ K("p", {
727
+ /* @__PURE__ */ J("p", {
678
728
  className: "text-xs text-text-secondary",
679
729
  children: [
680
- ve(e.provider),
730
+ ge(e.provider),
681
731
  " ·",
682
732
  " ",
683
- xe(e.status, e.provider)
733
+ ve(e.status, e.provider)
684
734
  ]
685
735
  }),
686
- C ? /* @__PURE__ */ G("p", {
736
+ C ? /* @__PURE__ */ q("p", {
687
737
  className: "text-xs text-text-secondary",
688
- children: V(e.pollStatus, h)
738
+ children: me(e.pollStatus, h)
689
739
  }) : null,
690
- /* @__PURE__ */ K("p", {
740
+ /* @__PURE__ */ J("p", {
691
741
  className: "text-xs text-text-secondary",
692
742
  children: [
693
743
  "Last accepted update:",
@@ -696,65 +746,65 @@ function Ve({ integration: e, url: t, expanded: a, refreshKey: l, busy: u, onTog
696
746
  e.lastErrorAt ? ` · Last error ${h(e.lastErrorAt)}` : ""
697
747
  ]
698
748
  }),
699
- e.lastErrorMessage ? /* @__PURE__ */ G("p", {
749
+ e.lastErrorMessage ? /* @__PURE__ */ q("p", {
700
750
  className: "break-words text-xs text-status-error-text",
701
751
  children: e.lastErrorMessage
702
752
  }) : null
703
753
  ]
704
- }), /* @__PURE__ */ K("div", {
754
+ }), /* @__PURE__ */ J("div", {
705
755
  className: "flex flex-wrap items-center gap-2",
706
756
  children: [
707
- /* @__PURE__ */ K(_, {
757
+ /* @__PURE__ */ J(_, {
708
758
  size: "sm",
709
759
  variant: "outline",
710
760
  disabled: u,
711
761
  onClick: () => f(S ? "PAUSED" : "ACTIVE"),
712
- children: [G(S ? s : c, {
762
+ children: [q(S ? s : c, {
713
763
  size: 14,
714
764
  className: "mr-1"
715
765
  }), S ? "Pause" : "Resume"]
716
766
  }),
717
- C ? /* @__PURE__ */ K(_, {
767
+ C ? /* @__PURE__ */ J(_, {
718
768
  size: "sm",
719
769
  variant: "outline",
720
770
  disabled: u || !S,
721
771
  onClick: b,
722
- children: [/* @__PURE__ */ G(i, {
772
+ children: [/* @__PURE__ */ q(i, {
723
773
  size: 14,
724
774
  className: "mr-1"
725
775
  }), "Poll now"]
726
776
  }) : null,
727
- /* @__PURE__ */ K(_, {
777
+ /* @__PURE__ */ J(_, {
728
778
  size: "sm",
729
779
  variant: "outline",
730
780
  disabled: u,
731
781
  onClick: m,
732
- children: [/* @__PURE__ */ G(o, {
782
+ children: [/* @__PURE__ */ q(o, {
733
783
  size: 14,
734
784
  className: "mr-1"
735
785
  }), e.provider === "SAMSARA" ? "Replace secret" : C ? "Update password" : "Rotate secret"]
736
786
  }),
737
- /* @__PURE__ */ G(_, {
787
+ /* @__PURE__ */ q(_, {
738
788
  size: "sm",
739
789
  variant: "ghost",
740
790
  disabled: u,
741
791
  onClick: x,
742
792
  "aria-label": `Delete ${e.name}`,
743
- children: /* @__PURE__ */ G(p, { size: 14 })
793
+ children: /* @__PURE__ */ q(p, { size: 14 })
744
794
  }),
745
- /* @__PURE__ */ G(_, {
795
+ /* @__PURE__ */ q(_, {
746
796
  size: "sm",
747
797
  variant: "ghost",
748
798
  onClick: d,
749
799
  "aria-expanded": a,
750
800
  "aria-label": a ? "Hide details" : "Show details",
751
- children: G(a ? r : n, { size: 16 })
801
+ children: q(a ? r : n, { size: 16 })
752
802
  })
753
803
  ]
754
804
  })]
755
- }), a ? /* @__PURE__ */ K("div", {
805
+ }), a ? /* @__PURE__ */ J("div", {
756
806
  className: "mt-4 grid gap-6 border-t border-border-subtle pt-4 lg:grid-cols-2",
757
- children: [C ? /* @__PURE__ */ G(Le, { integration: e }) : e.provider === "SAMSARA" ? /* @__PURE__ */ G(Ie, { url: t }) : /* @__PURE__ */ G(Be, { url: t }), /* @__PURE__ */ G(ze, {
807
+ children: [C ? /* @__PURE__ */ q(ze, { integration: e }) : e.provider === "SAMSARA" ? /* @__PURE__ */ q(Le, { url: t }) : e.provider === "MOTIVE" ? /* @__PURE__ */ q(Re, { url: t }) : /* @__PURE__ */ q(He, { url: t }), /* @__PURE__ */ q(Ve, {
758
808
  integrationId: e.id,
759
809
  refreshKey: l,
760
810
  polled: C
@@ -762,246 +812,244 @@ function Ve({ integration: e, url: t, expanded: a, refreshKey: l, busy: u, onTog
762
812
  }) : null]
763
813
  }) });
764
814
  }
765
- function He() {
815
+ function We() {
766
816
  let { tenantId: e, workspaceId: t } = m();
767
- return /* @__PURE__ */ G(Ue, {}, `${e ?? ""}:${t ?? ""}`);
817
+ return /* @__PURE__ */ q(Ge, {}, `${e ?? ""}:${t ?? ""}`);
768
818
  }
769
- function Ue() {
770
- let { apiGatewayUrl: t } = m(), n = Ce(), { message: r, notify: i } = se(), [a, o] = U(null), [s, c] = U(Z), [p, b] = U(0), [x, S] = U(0), [re, O] = U(null), [ce, le] = U(!1), [A, j] = U(null), [M, N] = U([]), fe = M[0] ?? null, P = (e, t) => N((n) => [...n, {
819
+ function Ge() {
820
+ let { apiGatewayUrl: t } = m(), n = be(), { message: r, notify: i } = se(), [a, o] = K(null), [s, c] = K(Z), [p, b] = K(0), [x, S] = K(0), [re, O] = K(null), [k, A] = K(!1), [j, le] = K(null), [ue, N] = K([]), P = ue[0] ?? null, F = (e, t) => N((n) => [...n, {
771
821
  name: e,
772
822
  secret: t
773
- }]), F = De(/* @__PURE__ */ new Set()), [pe, me] = U(() => /* @__PURE__ */ new Set()), L = async (e, t) => {
774
- if (!F.current.has(e)) {
775
- F.current.add(e), me(new Set(F.current));
823
+ }]), I = Te(/* @__PURE__ */ new Set()), [L, R] = K(() => /* @__PURE__ */ new Set()), z = async (e, t) => {
824
+ if (!I.current.has(e)) {
825
+ I.current.add(e), R(new Set(I.current));
776
826
  try {
777
827
  await t();
778
828
  } finally {
779
- F.current.delete(e), me(new Set(F.current));
829
+ I.current.delete(e), R(new Set(I.current));
780
830
  }
781
831
  }
782
- }, { integrations: z, total: B, isLoading: V, error: _e, refetch: ve } = Te({
832
+ }, { integrations: B, total: H, isLoading: W, error: de, refetch: me } = Ce({
783
833
  status: s === Z ? void 0 : s,
784
- limit: Me,
785
- offset: p * Me
786
- }), { all: ye, active: be, refetch: xe } = we(), H = Math.max(1, Math.ceil(B / Me));
787
- Ee(() => {
788
- !V && p > 0 && p >= H && b(H - 1);
834
+ limit: Ne,
835
+ offset: p * Ne
836
+ }), { all: he, active: ge, refetch: _e } = xe(), G = Math.max(1, Math.ceil(H / Ne));
837
+ we(() => {
838
+ !W && p > 0 && p >= G && b(G - 1);
789
839
  }, [
790
- V,
840
+ W,
791
841
  p,
792
- H
842
+ G
793
843
  ]);
794
- let W = z.map((e) => e.lastSyncAt).filter((e) => !!e).sort(), q = W.length > 0 ? W[W.length - 1] : void 0, J = (e) => Se(t, e.workspaceId, e.id, window.location.origin), Y = () => {
795
- S((e) => e + 1), ve(), xe();
844
+ let ve = B.map((e) => e.lastSyncAt).filter((e) => !!e).sort(), Se = ve.length > 0 ? ve[ve.length - 1] : void 0, Ee = (e) => ye(t, e.workspaceId, e.id, window.location.origin), Y = () => {
845
+ S((e) => e + 1), me(), _e();
796
846
  }, X = (e) => {
797
847
  o(null), i(e), Y();
798
- }, Ae = async (e, t) => {
848
+ }, ke = async (e, t) => {
799
849
  try {
800
850
  await n.update(e.id, { status: t }), X(t === "ACTIVE" ? `Resumed ${e.name}.` : `Paused ${e.name}.`);
801
851
  } catch (e) {
802
852
  o(Q(e, "Could not change the integration status."));
803
853
  }
804
- }, je = async (e) => {
854
+ }, Ae = async (e) => {
805
855
  if (!window.confirm(`Rotate the signing secret for ${e.name}? Deliveries signed with the old secret are refused as soon as it changes.`)) return;
806
- let t = I();
856
+ let t = V();
807
857
  try {
808
- await n.update(e.id, { apiSecret: t }), P(e.name, t), X(`Rotated the signing secret for ${e.name}.`);
858
+ await n.update(e.id, { apiSecret: t }), F(e.name, t), X(`Rotated the signing secret for ${e.name}.`);
809
859
  } catch (e) {
810
860
  o(Q(e, "Could not rotate the signing secret."));
811
861
  }
812
- }, $ = async (e, t) => {
813
- await L(e.id, async () => {
862
+ }, je = async (e, t) => {
863
+ await z(e.id, async () => {
814
864
  await n.update(e.id, { apiSecret: t }), X(e.provider === "GEOTAB" ? `Updated the MyGeotab password for ${e.name}.` : `Replaced the Samsara secret for ${e.name}.`);
815
865
  });
816
- }, Ie = async (e) => {
866
+ }, Me = async (e) => {
817
867
  try {
818
868
  let t = await n.pollNow(e.id);
819
869
  if (t.status === "FAILED") {
820
- o(ge(e.name, t)), Y();
870
+ o(pe(e.name, t)), Y();
821
871
  return;
822
872
  }
823
- X(ge(e.name, t));
873
+ X(pe(e.name, t));
824
874
  } catch (t) {
825
875
  o(Q(t, `Could not poll ${e.name}.`));
826
876
  }
827
- }, Le = async (e) => {
877
+ }, $ = async (e) => {
828
878
  if (window.confirm(`Delete ${e.name}? Its webhook URL stops working; tracking events it already created stay on their shipments.`)) try {
829
879
  await n.remove(e.id), re === e.id && O(null), X(`Deleted ${e.name}.`);
830
880
  } catch (e) {
831
881
  o(Q(e, "Could not delete the integration."));
832
882
  }
833
883
  };
834
- return /* @__PURE__ */ K(ie, {
884
+ return /* @__PURE__ */ J(ie, {
835
885
  title: "Integrations",
836
886
  subtitle: "Carrier, ELD and GPS tracking feeds",
837
- icon: /* @__PURE__ */ G(l, { size: 24 }),
838
- headerActions: /* @__PURE__ */ G(Oe, {
887
+ icon: /* @__PURE__ */ q(l, { size: 24 }),
888
+ headerActions: /* @__PURE__ */ q(De, {
839
889
  primary: {
840
890
  label: "Connect feed",
841
- icon: /* @__PURE__ */ G(u, { size: 16 }),
842
- onSelect: () => le(!0)
891
+ icon: /* @__PURE__ */ q(u, { size: 16 }),
892
+ onSelect: () => A(!0)
843
893
  },
844
894
  actions: [{
845
895
  label: "Refresh",
846
- icon: /* @__PURE__ */ G(d, { size: 16 }),
896
+ icon: /* @__PURE__ */ q(d, { size: 16 }),
847
897
  onSelect: Y
848
898
  }]
849
899
  }),
850
900
  children: [
851
- /* @__PURE__ */ G(ke, {
852
- icon: /* @__PURE__ */ G(l, { size: 18 }),
901
+ /* @__PURE__ */ q(Oe, {
902
+ icon: /* @__PURE__ */ q(l, { size: 18 }),
853
903
  children: "Connect the systems that already know where your freight is. Each feed gets its own signed webhook; every update it sends becomes a tracking event on the matching shipment, so status and ETA stay current without manual entry."
854
904
  }),
855
- /* @__PURE__ */ G(oe, { message: r }),
856
- /* @__PURE__ */ G(D, { message: a }),
857
- /* @__PURE__ */ K(ae, {
905
+ /* @__PURE__ */ q(oe, { message: r }),
906
+ /* @__PURE__ */ q(D, { message: a }),
907
+ /* @__PURE__ */ J(ae, {
858
908
  columns: 3,
859
909
  children: [
860
- /* @__PURE__ */ G(E, {
910
+ /* @__PURE__ */ q(E, {
861
911
  label: "Feeds",
862
- value: ye,
863
- icon: /* @__PURE__ */ G(l, { size: 20 }),
912
+ value: he,
913
+ icon: /* @__PURE__ */ q(l, { size: 20 }),
864
914
  accent: "brand"
865
915
  }),
866
- /* @__PURE__ */ G(E, {
916
+ /* @__PURE__ */ q(E, {
867
917
  label: "Active",
868
- value: be,
869
- icon: /* @__PURE__ */ G(f, { size: 20 }),
918
+ value: ge,
919
+ icon: /* @__PURE__ */ q(f, { size: 20 }),
870
920
  accent: "success"
871
921
  }),
872
- /* @__PURE__ */ G(E, {
922
+ /* @__PURE__ */ q(E, {
873
923
  label: "Last accepted update (shown)",
874
- value: q ? h(q) : "—",
875
- icon: /* @__PURE__ */ G(e, { size: 20 }),
924
+ value: Se ? h(Se) : "—",
925
+ icon: /* @__PURE__ */ q(e, { size: 20 }),
876
926
  accent: "blue"
877
927
  })
878
928
  ]
879
929
  }),
880
- /* @__PURE__ */ G("div", {
930
+ /* @__PURE__ */ q("div", {
881
931
  className: "flex flex-col gap-3 sm:flex-row sm:items-center",
882
- children: /* @__PURE__ */ K(C, {
932
+ children: /* @__PURE__ */ J(C, {
883
933
  value: s,
884
934
  onValueChange: (e) => {
885
935
  c(e), b(0);
886
936
  },
887
- children: [/* @__PURE__ */ G(te, {
937
+ children: [/* @__PURE__ */ q(te, {
888
938
  "aria-label": "Status",
889
939
  className: "sm:w-56",
890
- children: /* @__PURE__ */ G(ne, {})
891
- }), /* @__PURE__ */ K(ee, { children: [/* @__PURE__ */ G(w, {
940
+ children: /* @__PURE__ */ q(ne, {})
941
+ }), /* @__PURE__ */ J(ee, { children: [/* @__PURE__ */ q(w, {
892
942
  value: Z,
893
943
  children: "All statuses"
894
- }), ue.map((e) => /* @__PURE__ */ G(w, {
944
+ }), ce.map((e) => /* @__PURE__ */ q(w, {
895
945
  value: e,
896
- children: R(e)
946
+ children: U(e)
897
947
  }, e))] })]
898
948
  })
899
949
  }),
900
- /* @__PURE__ */ G(D, { message: _e?.message }),
901
- V && z.length === 0 ? /* @__PURE__ */ K("div", {
950
+ /* @__PURE__ */ q(D, { message: de?.message }),
951
+ W && B.length === 0 ? /* @__PURE__ */ J("div", {
902
952
  className: "grid gap-4",
903
- children: [/* @__PURE__ */ G(T, { className: "h-28 w-full" }), /* @__PURE__ */ G(T, { className: "h-28 w-full" })]
904
- }) : z.length === 0 && !_e ? /* @__PURE__ */ G(v, { children: /* @__PURE__ */ K(y, {
953
+ children: [/* @__PURE__ */ q(T, { className: "h-28 w-full" }), /* @__PURE__ */ q(T, { className: "h-28 w-full" })]
954
+ }) : B.length === 0 && !de ? /* @__PURE__ */ q(v, { children: /* @__PURE__ */ J(y, {
905
955
  className: "flex flex-col items-center gap-3 p-10 text-center",
906
956
  children: [
907
- /* @__PURE__ */ G(l, {
957
+ /* @__PURE__ */ q(l, {
908
958
  size: 32,
909
959
  className: "text-text-tertiary"
910
960
  }),
911
- /* @__PURE__ */ G("p", {
961
+ /* @__PURE__ */ q("p", {
912
962
  className: "font-medium",
913
963
  children: s === Z ? "No tracking feeds connected" : "No feeds with this status"
914
964
  }),
915
- /* @__PURE__ */ G("p", {
965
+ /* @__PURE__ */ q("p", {
916
966
  className: "max-w-md text-sm text-text-secondary",
917
967
  children: s === Z ? "Connect a carrier portal, ELD or GPS tracker so shipment updates arrive on their own." : "Choose another status to see the rest of your feeds."
918
968
  }),
919
- s === Z ? /* @__PURE__ */ K(_, {
920
- onClick: () => le(!0),
921
- children: [/* @__PURE__ */ G(u, {
969
+ s === Z ? /* @__PURE__ */ J(_, {
970
+ onClick: () => A(!0),
971
+ children: [/* @__PURE__ */ q(u, {
922
972
  size: 16,
923
973
  className: "mr-1.5"
924
974
  }), "Connect feed"]
925
975
  }) : null
926
976
  ]
927
- }) }) : /* @__PURE__ */ G("div", {
977
+ }) }) : /* @__PURE__ */ q("div", {
928
978
  className: "grid gap-4",
929
- children: z.map((e) => /* @__PURE__ */ G(Ve, {
979
+ children: B.map((e) => /* @__PURE__ */ q(Ue, {
930
980
  integration: e,
931
- url: J(e),
981
+ url: Ee(e),
932
982
  expanded: re === e.id,
933
983
  refreshKey: x,
934
- busy: pe.has(e.id),
984
+ busy: L.has(e.id),
935
985
  onToggle: () => O((t) => t === e.id ? null : e.id),
936
- onSetStatus: (t) => void L(e.id, () => Ae(e, t)),
937
- onRotate: () => e.provider === "SAMSARA" || he(e.provider) ? j(e) : void L(e.id, () => je(e)),
938
- onPoll: () => void L(e.id, () => Ie(e)),
939
- onDelete: () => void L(e.id, () => Le(e))
986
+ onSetStatus: (t) => void z(e.id, () => ke(e, t)),
987
+ onRotate: () => e.provider === "SAMSARA" || fe(e.provider) ? le(e) : void z(e.id, () => Ae(e)),
988
+ onPoll: () => void z(e.id, () => Me(e)),
989
+ onDelete: () => void z(e.id, () => $(e))
940
990
  }, e.id))
941
991
  }),
942
- B > Me ? /* @__PURE__ */ K("div", {
992
+ H > Ne ? /* @__PURE__ */ J("div", {
943
993
  className: "flex items-center justify-between text-sm",
944
- children: [/* @__PURE__ */ K("span", {
994
+ children: [/* @__PURE__ */ J("span", {
945
995
  className: "text-text-secondary",
946
996
  children: [
947
997
  "Page ",
948
998
  p + 1,
949
999
  " of ",
950
- H,
1000
+ G,
951
1001
  " · ",
952
- B,
1002
+ H,
953
1003
  " feeds"
954
1004
  ]
955
- }), /* @__PURE__ */ K("div", {
1005
+ }), /* @__PURE__ */ J("div", {
956
1006
  className: "flex gap-2",
957
- children: [/* @__PURE__ */ G(_, {
1007
+ children: [/* @__PURE__ */ q(_, {
958
1008
  variant: "outline",
959
1009
  size: "sm",
960
1010
  disabled: p === 0,
961
1011
  onClick: () => b((e) => e - 1),
962
1012
  children: "Previous"
963
- }), /* @__PURE__ */ G(_, {
1013
+ }), /* @__PURE__ */ q(_, {
964
1014
  variant: "outline",
965
1015
  size: "sm",
966
- disabled: p + 1 >= H,
1016
+ disabled: p + 1 >= G,
967
1017
  onClick: () => b((e) => e + 1),
968
1018
  children: "Next"
969
1019
  })]
970
1020
  })]
971
1021
  }) : null,
972
- /* @__PURE__ */ G(v, { children: /* @__PURE__ */ K(y, {
1022
+ /* @__PURE__ */ q(v, { children: /* @__PURE__ */ J(y, {
973
1023
  className: "space-y-2 p-5",
974
1024
  children: [
975
- /* @__PURE__ */ G("p", {
1025
+ /* @__PURE__ */ q("p", {
976
1026
  className: "text-sm font-medium",
977
1027
  children: "Carrier and ELD networks"
978
1028
  }),
979
- /* @__PURE__ */ K("p", {
1029
+ /* @__PURE__ */ J("p", {
980
1030
  className: "text-sm text-text-secondary",
981
1031
  children: [
982
- "Samsara and Geotab connect directly: choose them when you connect a feed. Direct connections to",
983
- " ",
984
- [...de.map((e) => e.label), ...k].join(", "),
985
- " ",
986
- "are not available yet. Until they are, any carrier or telematics system that can send HTTPS webhooks connects through a signed feed above."
1032
+ "Samsara, Motive and Geotab connect directly: choose them when you connect a feed. Direct connections to ",
1033
+ M.map((e) => e.label).join(", "),
1034
+ " are not available yet. Until they are, any carrier or telematics system that can send HTTPS webhooks connects through a signed feed above."
987
1035
  ]
988
1036
  }),
989
- /* @__PURE__ */ K("div", {
1037
+ /* @__PURE__ */ J("div", {
990
1038
  className: "flex flex-wrap gap-2",
991
1039
  children: [
992
- /* @__PURE__ */ G(g, {
1040
+ /* @__PURE__ */ q(g, {
993
1041
  variant: "default",
994
1042
  children: "Samsara · available"
995
1043
  }),
996
- /* @__PURE__ */ G(g, {
1044
+ /* @__PURE__ */ q(g, {
1045
+ variant: "default",
1046
+ children: "Motive · available"
1047
+ }),
1048
+ /* @__PURE__ */ q(g, {
997
1049
  variant: "default",
998
1050
  children: "Geotab · available"
999
1051
  }),
1000
- k.map((e) => /* @__PURE__ */ K(g, {
1001
- variant: "outline",
1002
- children: [e, " · not available yet"]
1003
- }, e)),
1004
- de.map((e) => /* @__PURE__ */ K(g, {
1052
+ M.map((e) => /* @__PURE__ */ J(g, {
1005
1053
  variant: "outline",
1006
1054
  children: [e.label, " · not available yet"]
1007
1055
  }, e.id))
@@ -1009,25 +1057,25 @@ function Ue() {
1009
1057
  })
1010
1058
  ]
1011
1059
  }) }),
1012
- /* @__PURE__ */ G(Pe, {
1013
- open: ce,
1014
- onOpenChange: le,
1060
+ /* @__PURE__ */ q(Fe, {
1061
+ open: k,
1062
+ onOpenChange: A,
1015
1063
  onCreated: (e, t) => {
1016
- O(e.id), t && P(e.name, t), X(`Connected ${e.name}.`);
1064
+ O(e.id), t && F(e.name, t), X(`Connected ${e.name}.`);
1017
1065
  }
1018
1066
  }),
1019
- /* @__PURE__ */ G(Fe, {
1020
- integration: A,
1021
- onClose: () => j(null),
1022
- onReplace: $
1067
+ /* @__PURE__ */ q(Ie, {
1068
+ integration: j,
1069
+ onClose: () => le(null),
1070
+ onReplace: je
1023
1071
  }),
1024
- /* @__PURE__ */ G(Ne, {
1025
- secret: fe?.secret ?? null,
1026
- integrationName: fe?.name ?? "",
1072
+ /* @__PURE__ */ q(Pe, {
1073
+ secret: P?.secret ?? null,
1074
+ integrationName: P?.name ?? "",
1027
1075
  onClose: () => N((e) => e.slice(1))
1028
1076
  })
1029
1077
  ]
1030
1078
  });
1031
1079
  }
1032
1080
  //#endregion
1033
- export { He as default };
1081
+ export { We as default };