@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.
- package/dist/generated/tracking-quality-operations.d.ts +328 -1
- package/dist/generated/wspace-types.d.ts +8 -2
- package/dist/hooks/useCarrierIntegrations.js +30 -29
- package/dist/movethewheels/hooks/useCarrierIntegrations.d.ts +9 -3
- package/dist/movethewheels/utils/carrierIntegrations.d.ts +98 -9
- package/dist/node_modules/lucide-react/dist/esm/icons/cloud-download.js +18 -0
- package/dist/pages/IntegrationsPage.js +608 -338
- package/dist/utils/carrierIntegrations.js +134 -30
- package/package.json +1 -1
- package/src/generated/tracking-quality-operations.ts +374 -0
- package/src/generated/wspace-types.ts +8 -2
- package/src/movethewheels/hooks/useCarrierIntegrations.ts +19 -2
- package/src/movethewheels/pages/IntegrationsPage.tsx +347 -49
- package/src/movethewheels/utils/carrierIntegrations.ts +271 -12
|
@@ -8,7 +8,13 @@
|
|
|
8
8
|
*
|
|
9
9
|
* A generic feed's signing secret is generated in the browser, shown exactly
|
|
10
10
|
* once and never read back from the service. A Samsara feed (BOFF-10703) uses
|
|
11
|
-
* the secret Samsara issues for its webhook, pasted here once.
|
|
11
|
+
* the secret Samsara issues for its webhook, pasted here once. A Geotab feed
|
|
12
|
+
* (BOFF-10922) is pulled instead: MyGeotab has no push webhooks, so the
|
|
13
|
+
* service signs in with the credentials entered here and polls its data feeds
|
|
14
|
+
* every few minutes; the card shows the latest poll and offers "Poll now".
|
|
15
|
+
* A Motive feed (BOFF-10921) uses a secret generated here, shown once and
|
|
16
|
+
* entered on the Motive webhook, which signs with HMAC-SHA1.
|
|
17
|
+
* Named carrier
|
|
12
18
|
* networks (project44, FourKites, Descartes) are listed as not yet available:
|
|
13
19
|
* they need vendor agreements before an adapter can ship, and the service
|
|
14
20
|
* refuses them.
|
|
@@ -20,6 +26,7 @@ import {
|
|
|
20
26
|
ChevronDown,
|
|
21
27
|
ChevronUp,
|
|
22
28
|
Copy,
|
|
29
|
+
DownloadCloud,
|
|
23
30
|
KeyRound,
|
|
24
31
|
Pause,
|
|
25
32
|
Play,
|
|
@@ -48,6 +55,7 @@ import {
|
|
|
48
55
|
Button,
|
|
49
56
|
Card,
|
|
50
57
|
CardContent,
|
|
58
|
+
Checkbox,
|
|
51
59
|
Input,
|
|
52
60
|
Label,
|
|
53
61
|
Select,
|
|
@@ -56,6 +64,7 @@ import {
|
|
|
56
64
|
SelectTrigger,
|
|
57
65
|
SelectValue,
|
|
58
66
|
Skeleton,
|
|
67
|
+
Textarea,
|
|
59
68
|
} from '../components/ui';
|
|
60
69
|
import { useMoveTheWheels } from '../providers/MoveTheWheelsProvider';
|
|
61
70
|
import {
|
|
@@ -65,23 +74,33 @@ import {
|
|
|
65
74
|
useCarrierIntegrations,
|
|
66
75
|
} from '../hooks/useCarrierIntegrations';
|
|
67
76
|
import {
|
|
77
|
+
DEFAULT_GEOTAB_SERVER,
|
|
68
78
|
DEFAULT_SAMSARA_SHIPMENT_KEY,
|
|
79
|
+
GEOTAB_POLL_INTERVAL_MINUTES,
|
|
80
|
+
GEOTAB_RULE_EVENT_TYPES,
|
|
69
81
|
INTEGRATION_STATUSES,
|
|
70
82
|
MAX_UPDATES_PER_DELIVERY,
|
|
71
|
-
|
|
83
|
+
MOTIVE_ACTIONS,
|
|
84
|
+
MOTIVE_SIGNATURE_HEADER,
|
|
72
85
|
ROADMAP_PROVIDERS,
|
|
73
86
|
SAMSARA_EVENT_TYPES,
|
|
74
87
|
SAMSARA_SIGNATURE_HEADERS,
|
|
75
88
|
SIGNATURE_HEADER,
|
|
76
89
|
TRACKING_EVENT_TYPES,
|
|
90
|
+
buildGeotabConfig,
|
|
77
91
|
curlExample,
|
|
78
92
|
eventStatusTone,
|
|
79
93
|
examplePayload,
|
|
80
94
|
externalIdKeyError,
|
|
81
95
|
generateSigningSecret,
|
|
96
|
+
geotabPasswordError,
|
|
82
97
|
humanize,
|
|
83
98
|
integrationNameError,
|
|
84
99
|
integrationStatusTone,
|
|
100
|
+
isPolledProvider,
|
|
101
|
+
pollResultMessage,
|
|
102
|
+
pollStatusSummary,
|
|
103
|
+
pollStatusTone,
|
|
85
104
|
providerLabel,
|
|
86
105
|
samsaraSecretError,
|
|
87
106
|
signingSecretError,
|
|
@@ -192,9 +211,17 @@ function CreateIntegrationDialog({
|
|
|
192
211
|
const [secret, setSecret] = useState(() => generateSigningSecret());
|
|
193
212
|
const [samsaraSecret, setSamsaraSecret] = useState('');
|
|
194
213
|
const [shipmentKey, setShipmentKey] = useState('');
|
|
214
|
+
const [geotabServer, setGeotabServer] = useState('');
|
|
215
|
+
const [geotabDatabase, setGeotabDatabase] = useState('');
|
|
216
|
+
const [geotabUser, setGeotabUser] = useState('');
|
|
217
|
+
const [geotabPassword, setGeotabPassword] = useState('');
|
|
218
|
+
const [geotabRules, setGeotabRules] = useState('');
|
|
219
|
+
const [geotabLocations, setGeotabLocations] = useState(true);
|
|
195
220
|
const [error, setError] = useState<string | null>(null);
|
|
196
221
|
const [isSaving, setIsSaving] = useState(false);
|
|
197
222
|
const isSamsara = provider === 'SAMSARA';
|
|
223
|
+
const isGeotab = provider === 'GEOTAB';
|
|
224
|
+
const isMotive = provider === 'MOTIVE';
|
|
198
225
|
|
|
199
226
|
const reset = () => {
|
|
200
227
|
setProvider('GENERIC_WEBHOOK');
|
|
@@ -202,16 +229,47 @@ function CreateIntegrationDialog({
|
|
|
202
229
|
setSecret(generateSigningSecret());
|
|
203
230
|
setSamsaraSecret('');
|
|
204
231
|
setShipmentKey('');
|
|
232
|
+
setGeotabServer('');
|
|
233
|
+
setGeotabDatabase('');
|
|
234
|
+
setGeotabUser('');
|
|
235
|
+
setGeotabPassword('');
|
|
236
|
+
setGeotabRules('');
|
|
237
|
+
setGeotabLocations(true);
|
|
205
238
|
setError(null);
|
|
206
239
|
};
|
|
207
240
|
|
|
241
|
+
const geotabInput = () => {
|
|
242
|
+
const config = buildGeotabConfig({
|
|
243
|
+
server: geotabServer,
|
|
244
|
+
database: geotabDatabase,
|
|
245
|
+
userName: geotabUser,
|
|
246
|
+
ruleMappings: geotabRules,
|
|
247
|
+
locationUpdates: geotabLocations,
|
|
248
|
+
});
|
|
249
|
+
if (!config.ok) return { error: config.error, input: null };
|
|
250
|
+
const passwordProblem = geotabPasswordError(geotabPassword);
|
|
251
|
+
if (passwordProblem) return { error: passwordProblem, input: null };
|
|
252
|
+
return {
|
|
253
|
+
error: null,
|
|
254
|
+
input: {
|
|
255
|
+
provider: 'GEOTAB' as const,
|
|
256
|
+
name,
|
|
257
|
+
apiSecret: geotabPassword,
|
|
258
|
+
config: config.config,
|
|
259
|
+
},
|
|
260
|
+
};
|
|
261
|
+
};
|
|
262
|
+
|
|
208
263
|
const submit = async (event: FormEvent) => {
|
|
209
264
|
event.preventDefault();
|
|
265
|
+
const geotab = isGeotab ? geotabInput() : null;
|
|
210
266
|
const problem =
|
|
211
267
|
integrationNameError(name) ??
|
|
212
|
-
(
|
|
213
|
-
? (
|
|
214
|
-
:
|
|
268
|
+
(isGeotab
|
|
269
|
+
? (geotab?.error ?? null)
|
|
270
|
+
: isSamsara
|
|
271
|
+
? (samsaraSecretError(samsaraSecret) ?? externalIdKeyError(shipmentKey))
|
|
272
|
+
: signingSecretError(secret));
|
|
215
273
|
if (problem) {
|
|
216
274
|
setError(problem);
|
|
217
275
|
return;
|
|
@@ -221,16 +279,18 @@ function CreateIntegrationDialog({
|
|
|
221
279
|
try {
|
|
222
280
|
const key = shipmentKey.trim();
|
|
223
281
|
const created = await actions.create(
|
|
224
|
-
|
|
225
|
-
?
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
282
|
+
geotab?.input
|
|
283
|
+
? geotab.input
|
|
284
|
+
: isSamsara
|
|
285
|
+
? {
|
|
286
|
+
provider: 'SAMSARA',
|
|
287
|
+
name,
|
|
288
|
+
apiSecret: samsaraSecret.trim(),
|
|
289
|
+
...(key ? { config: { shipmentExternalIdKey: key } } : {}),
|
|
290
|
+
}
|
|
291
|
+
: { provider: isMotive ? 'MOTIVE' : 'GENERIC_WEBHOOK', name, apiSecret: secret }
|
|
232
292
|
);
|
|
233
|
-
onCreated(created, isSamsara ? null : secret);
|
|
293
|
+
onCreated(created, isSamsara || isGeotab ? null : secret);
|
|
234
294
|
reset();
|
|
235
295
|
onOpenChange(false);
|
|
236
296
|
} catch (createError) {
|
|
@@ -253,8 +313,9 @@ function CreateIntegrationDialog({
|
|
|
253
313
|
<ResponsiveDialogHeader>
|
|
254
314
|
<ResponsiveDialogTitle>Connect a tracking feed</ResponsiveDialogTitle>
|
|
255
315
|
<ResponsiveDialogDescription>
|
|
256
|
-
|
|
257
|
-
|
|
316
|
+
{isGeotab
|
|
317
|
+
? `MoveTheWheels signs in to MyGeotab and reads new GPS positions and exception events every ${GEOTAB_POLL_INTERVAL_MINUTES} minutes. They become tracking events on the matching shipments.`
|
|
318
|
+
: 'A signed webhook from a carrier, ELD or GPS provider. Updates it sends become tracking events on the matching shipments.'}
|
|
258
319
|
</ResponsiveDialogDescription>
|
|
259
320
|
</ResponsiveDialogHeader>
|
|
260
321
|
<div className="space-y-1.5">
|
|
@@ -263,7 +324,15 @@ function CreateIntegrationDialog({
|
|
|
263
324
|
id="integration-name"
|
|
264
325
|
value={name}
|
|
265
326
|
maxLength={120}
|
|
266
|
-
placeholder={
|
|
327
|
+
placeholder={
|
|
328
|
+
isSamsara
|
|
329
|
+
? 'e.g. Samsara fleet'
|
|
330
|
+
: isGeotab
|
|
331
|
+
? 'e.g. Geotab fleet'
|
|
332
|
+
: isMotive
|
|
333
|
+
? 'e.g. Motive fleet'
|
|
334
|
+
: 'e.g. Fleet GPS feed'
|
|
335
|
+
}
|
|
267
336
|
onChange={(event) => setName(event.target.value)}
|
|
268
337
|
autoFocus
|
|
269
338
|
/>
|
|
@@ -285,10 +354,95 @@ function CreateIntegrationDialog({
|
|
|
285
354
|
Signed webhook (any system that can send HTTPS POSTs)
|
|
286
355
|
</SelectItem>
|
|
287
356
|
<SelectItem value="SAMSARA">Samsara (ELD and telematics)</SelectItem>
|
|
357
|
+
<SelectItem value="MOTIVE">
|
|
358
|
+
Motive, formerly KeepTruckin (ELD and telematics)
|
|
359
|
+
</SelectItem>
|
|
360
|
+
<SelectItem value="GEOTAB">Geotab / MyGeotab (telematics, polled)</SelectItem>
|
|
288
361
|
</SelectContent>
|
|
289
362
|
</Select>
|
|
290
363
|
</div>
|
|
291
|
-
{
|
|
364
|
+
{isGeotab ? (
|
|
365
|
+
<>
|
|
366
|
+
<div className="grid gap-4 sm:grid-cols-2">
|
|
367
|
+
<div className="space-y-1.5">
|
|
368
|
+
<Label htmlFor="geotab-database">MyGeotab database</Label>
|
|
369
|
+
<Input
|
|
370
|
+
id="geotab-database"
|
|
371
|
+
value={geotabDatabase}
|
|
372
|
+
maxLength={255}
|
|
373
|
+
autoComplete="off"
|
|
374
|
+
spellCheck={false}
|
|
375
|
+
placeholder="e.g. acme_logistics"
|
|
376
|
+
onChange={(event) => setGeotabDatabase(event.target.value)}
|
|
377
|
+
/>
|
|
378
|
+
</div>
|
|
379
|
+
<div className="space-y-1.5">
|
|
380
|
+
<Label htmlFor="geotab-server">Server (optional)</Label>
|
|
381
|
+
<Input
|
|
382
|
+
id="geotab-server"
|
|
383
|
+
value={geotabServer}
|
|
384
|
+
maxLength={255}
|
|
385
|
+
autoComplete="off"
|
|
386
|
+
spellCheck={false}
|
|
387
|
+
placeholder={DEFAULT_GEOTAB_SERVER}
|
|
388
|
+
onChange={(event) => setGeotabServer(event.target.value)}
|
|
389
|
+
/>
|
|
390
|
+
</div>
|
|
391
|
+
<div className="space-y-1.5">
|
|
392
|
+
<Label htmlFor="geotab-user">User name</Label>
|
|
393
|
+
<Input
|
|
394
|
+
id="geotab-user"
|
|
395
|
+
value={geotabUser}
|
|
396
|
+
maxLength={255}
|
|
397
|
+
autoComplete="off"
|
|
398
|
+
spellCheck={false}
|
|
399
|
+
placeholder="e.g. mtw-api@acme.com"
|
|
400
|
+
onChange={(event) => setGeotabUser(event.target.value)}
|
|
401
|
+
/>
|
|
402
|
+
</div>
|
|
403
|
+
<div className="space-y-1.5">
|
|
404
|
+
<Label htmlFor="geotab-password">Password</Label>
|
|
405
|
+
<Input
|
|
406
|
+
id="geotab-password"
|
|
407
|
+
type="password"
|
|
408
|
+
autoComplete="new-password"
|
|
409
|
+
spellCheck={false}
|
|
410
|
+
value={geotabPassword}
|
|
411
|
+
onChange={(event) => setGeotabPassword(event.target.value)}
|
|
412
|
+
/>
|
|
413
|
+
</div>
|
|
414
|
+
</div>
|
|
415
|
+
<p className="text-xs text-text-secondary">
|
|
416
|
+
Use a dedicated MyGeotab user with read access to devices, GPS logs and exceptions.
|
|
417
|
+
MoveTheWheels stores the password encrypted and never shows it again.
|
|
418
|
+
</p>
|
|
419
|
+
<div className="flex items-center gap-3">
|
|
420
|
+
<Checkbox
|
|
421
|
+
id="geotab-locations"
|
|
422
|
+
checked={geotabLocations}
|
|
423
|
+
onCheckedChange={(value) => setGeotabLocations(value === true)}
|
|
424
|
+
/>
|
|
425
|
+
<Label htmlFor="geotab-locations">
|
|
426
|
+
Add each vehicle's latest GPS position as an In transit event
|
|
427
|
+
</Label>
|
|
428
|
+
</div>
|
|
429
|
+
<div className="space-y-1.5">
|
|
430
|
+
<Label htmlFor="geotab-rules">Exception rules to track (optional)</Label>
|
|
431
|
+
<Textarea
|
|
432
|
+
id="geotab-rules"
|
|
433
|
+
value={geotabRules}
|
|
434
|
+
rows={3}
|
|
435
|
+
spellCheck={false}
|
|
436
|
+
placeholder={'RuleArriveCustomerId = ARRIVED\nRuleLeaveDepotId = DEPARTED'}
|
|
437
|
+
onChange={(event) => setGeotabRules(event.target.value)}
|
|
438
|
+
/>
|
|
439
|
+
<p className="text-xs text-text-secondary">
|
|
440
|
+
One per line: a MyGeotab rule id (for example a zone arrival rule) and the event
|
|
441
|
+
it becomes: {GEOTAB_RULE_EVENT_TYPES.join(', ')}. Other rules are ignored.
|
|
442
|
+
</p>
|
|
443
|
+
</div>
|
|
444
|
+
</>
|
|
445
|
+
) : isSamsara ? (
|
|
292
446
|
<>
|
|
293
447
|
<div className="space-y-1.5">
|
|
294
448
|
<Label htmlFor="samsara-secret">Samsara webhook secret key</Label>
|
|
@@ -340,7 +494,9 @@ function CreateIntegrationDialog({
|
|
|
340
494
|
{secret}
|
|
341
495
|
</code>
|
|
342
496
|
<p className="text-xs text-text-secondary">
|
|
343
|
-
|
|
497
|
+
{isMotive
|
|
498
|
+
? 'Generated in your browser. You can copy it on the next step and enter it as the secret on the Motive webhook.'
|
|
499
|
+
: 'Generated in your browser. You can copy it on the next step.'}
|
|
344
500
|
</p>
|
|
345
501
|
</div>
|
|
346
502
|
)}
|
|
@@ -359,7 +515,10 @@ function CreateIntegrationDialog({
|
|
|
359
515
|
);
|
|
360
516
|
}
|
|
361
517
|
|
|
362
|
-
/**
|
|
518
|
+
/**
|
|
519
|
+
* Samsara issues the secret and Geotab's is the MyGeotab password, so
|
|
520
|
+
* replacing either means pasting the new value rather than generating one.
|
|
521
|
+
*/
|
|
363
522
|
function ReplaceSamsaraSecretDialog({
|
|
364
523
|
integration,
|
|
365
524
|
onClose,
|
|
@@ -372,6 +531,7 @@ function ReplaceSamsaraSecretDialog({
|
|
|
372
531
|
const [secret, setSecret] = useState('');
|
|
373
532
|
const [error, setError] = useState<string | null>(null);
|
|
374
533
|
const [isSaving, setIsSaving] = useState(false);
|
|
534
|
+
const isGeotab = integration?.provider === 'GEOTAB';
|
|
375
535
|
const close = () => {
|
|
376
536
|
setSecret('');
|
|
377
537
|
setError(null);
|
|
@@ -380,7 +540,7 @@ function ReplaceSamsaraSecretDialog({
|
|
|
380
540
|
const submit = async (event: FormEvent) => {
|
|
381
541
|
event.preventDefault();
|
|
382
542
|
if (!integration) return;
|
|
383
|
-
const problem = samsaraSecretError(secret);
|
|
543
|
+
const problem = isGeotab ? geotabPasswordError(secret) : samsaraSecretError(secret);
|
|
384
544
|
if (problem) {
|
|
385
545
|
setError(problem);
|
|
386
546
|
return;
|
|
@@ -388,7 +548,8 @@ function ReplaceSamsaraSecretDialog({
|
|
|
388
548
|
setIsSaving(true);
|
|
389
549
|
setError(null);
|
|
390
550
|
try {
|
|
391
|
-
|
|
551
|
+
// A MyGeotab password is kept exactly as typed; a Samsara key is trimmed.
|
|
552
|
+
await onReplace(integration, isGeotab ? secret : secret.trim());
|
|
392
553
|
close();
|
|
393
554
|
} catch (replaceError) {
|
|
394
555
|
setError(errorMessage(replaceError, 'Could not replace the secret.'));
|
|
@@ -402,15 +563,20 @@ function ReplaceSamsaraSecretDialog({
|
|
|
402
563
|
<form onSubmit={(event) => void submit(event)} className="space-y-4">
|
|
403
564
|
<ResponsiveDialogHeader>
|
|
404
565
|
<ResponsiveDialogTitle>
|
|
405
|
-
|
|
566
|
+
{isGeotab
|
|
567
|
+
? `Update the MyGeotab password for ${integration?.name ?? ''}`
|
|
568
|
+
: `Replace the Samsara secret for ${integration?.name ?? ''}`}
|
|
406
569
|
</ResponsiveDialogTitle>
|
|
407
570
|
<ResponsiveDialogDescription>
|
|
408
|
-
|
|
409
|
-
|
|
571
|
+
{isGeotab
|
|
572
|
+
? 'Enter the current password of the MyGeotab user this feed signs in as. The next poll signs in with it.'
|
|
573
|
+
: '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.'}
|
|
410
574
|
</ResponsiveDialogDescription>
|
|
411
575
|
</ResponsiveDialogHeader>
|
|
412
576
|
<div className="space-y-1.5">
|
|
413
|
-
<Label htmlFor="samsara-new-secret">
|
|
577
|
+
<Label htmlFor="samsara-new-secret">
|
|
578
|
+
{isGeotab ? 'New MyGeotab password' : 'New Samsara webhook secret key'}
|
|
579
|
+
</Label>
|
|
414
580
|
<Input
|
|
415
581
|
id="samsara-new-secret"
|
|
416
582
|
type="password"
|
|
@@ -427,7 +593,7 @@ function ReplaceSamsaraSecretDialog({
|
|
|
427
593
|
Cancel
|
|
428
594
|
</Button>
|
|
429
595
|
<Button type="submit" disabled={isSaving}>
|
|
430
|
-
{isSaving ? 'Saving…' : 'Replace secret'}
|
|
596
|
+
{isSaving ? 'Saving…' : isGeotab ? 'Update password' : 'Replace secret'}
|
|
431
597
|
</Button>
|
|
432
598
|
</ResponsiveDialogFooter>
|
|
433
599
|
</form>
|
|
@@ -472,17 +638,113 @@ function SamsaraSetupInstructions({ url }: { url: string }) {
|
|
|
472
638
|
);
|
|
473
639
|
}
|
|
474
640
|
|
|
475
|
-
function
|
|
641
|
+
function MotiveSetupInstructions({ url }: { url: string }) {
|
|
642
|
+
return (
|
|
643
|
+
<div className="space-y-3">
|
|
644
|
+
<p className="text-sm font-medium">How to connect Motive</p>
|
|
645
|
+
<CopyField label="Webhook URL" value={url} />
|
|
646
|
+
<ol className="list-decimal space-y-1 pl-5 text-xs text-text-secondary">
|
|
647
|
+
<li>
|
|
648
|
+
In the Motive dashboard, open Admin → Developer → Webhooks and add a webhook with the URL
|
|
649
|
+
above, the JSON format and the signing secret shown when this feed was connected (rotate
|
|
650
|
+
the secret here to get a new one).
|
|
651
|
+
</li>
|
|
652
|
+
<li>
|
|
653
|
+
Subscribe it to{' '}
|
|
654
|
+
{MOTIVE_ACTIONS.map((entry, index) => (
|
|
655
|
+
<span key={entry.action}>
|
|
656
|
+
{index > 0 ? ' and ' : ''}
|
|
657
|
+
<code className="font-mono">{entry.action}</code> ({entry.becomes.toLowerCase()})
|
|
658
|
+
</span>
|
|
659
|
+
))}
|
|
660
|
+
, then enable it. Motive sends an activation test that this feed answers automatically.
|
|
661
|
+
</li>
|
|
662
|
+
<li>
|
|
663
|
+
Motive deliveries carry no shipment reference, so the Motive vehicle number (or VIN) is
|
|
664
|
+
matched to a MoveTheWheels vehicle by its vehicle number or licence plate, and the event
|
|
665
|
+
goes to that vehicle's single in-progress route. Ambiguous matches are refused, never
|
|
666
|
+
guessed.
|
|
667
|
+
</li>
|
|
668
|
+
<li>
|
|
669
|
+
Motive signs every delivery with an HMAC-SHA1 of the body in{' '}
|
|
670
|
+
<code className="font-mono">{MOTIVE_SIGNATURE_HEADER}</code>; deliveries with a wrong
|
|
671
|
+
signature are refused, and a repeated Motive event is recorded once.
|
|
672
|
+
</li>
|
|
673
|
+
</ol>
|
|
674
|
+
</div>
|
|
675
|
+
);
|
|
676
|
+
}
|
|
677
|
+
|
|
678
|
+
function GeotabSetupInstructions({ integration }: { integration: CarrierIntegration }) {
|
|
679
|
+
return (
|
|
680
|
+
<div className="space-y-3">
|
|
681
|
+
<p className="text-sm font-medium">How the Geotab feed works</p>
|
|
682
|
+
<ol className="list-decimal space-y-1 pl-5 text-xs text-text-secondary">
|
|
683
|
+
<li>
|
|
684
|
+
Every {GEOTAB_POLL_INTERVAL_MINUTES} minutes MoveTheWheels signs in to MyGeotab and reads
|
|
685
|
+
the GPS log and exception events added since the last poll. Nothing is set up in Geotab.
|
|
686
|
+
</li>
|
|
687
|
+
<li>
|
|
688
|
+
Each Geotab vehicle is matched to a MoveTheWheels vehicle by its name, licence plate or
|
|
689
|
+
VIN; the event goes to that vehicle's single in-progress route. Records for vehicles
|
|
690
|
+
that are not on a route are skipped.
|
|
691
|
+
</li>
|
|
692
|
+
<li>
|
|
693
|
+
The newest GPS position of each vehicle becomes an In transit event with its location,
|
|
694
|
+
when position updates are on. Mapped exception rules (typically zone arrivals and
|
|
695
|
+
departures) become the events they are mapped to.
|
|
696
|
+
</li>
|
|
697
|
+
<li>
|
|
698
|
+
Repeated sign-in failures slow the polling down so the MyGeotab user is not locked out;
|
|
699
|
+
update the password, then use Poll now.
|
|
700
|
+
</li>
|
|
701
|
+
</ol>
|
|
702
|
+
<PollStatusPanel integration={integration} />
|
|
703
|
+
</div>
|
|
704
|
+
);
|
|
705
|
+
}
|
|
706
|
+
|
|
707
|
+
function PollStatusPanel({ integration }: { integration: CarrierIntegration }) {
|
|
708
|
+
const pollStatus = integration.pollStatus;
|
|
709
|
+
return (
|
|
710
|
+
<div className="space-y-1 rounded-lg bg-bg-sunken px-3 py-2" data-testid="poll-status">
|
|
711
|
+
<div className="flex items-center gap-2">
|
|
712
|
+
<span className="text-xs font-medium">Latest poll</span>
|
|
713
|
+
{pollStatus?.lastPollStatus ? (
|
|
714
|
+
<Badge variant={pollStatusTone(pollStatus.lastPollStatus)}>
|
|
715
|
+
{humanize(pollStatus.lastPollStatus)}
|
|
716
|
+
</Badge>
|
|
717
|
+
) : null}
|
|
718
|
+
</div>
|
|
719
|
+
<p className="text-xs text-text-secondary">{pollStatusSummary(pollStatus, formatDateTime)}</p>
|
|
720
|
+
{pollStatus?.lastPollError ? (
|
|
721
|
+
<p className="break-words text-xs text-status-error-text">{pollStatus.lastPollError}</p>
|
|
722
|
+
) : null}
|
|
723
|
+
</div>
|
|
724
|
+
);
|
|
725
|
+
}
|
|
726
|
+
|
|
727
|
+
function DeliveryLog({
|
|
728
|
+
integrationId,
|
|
729
|
+
refreshKey,
|
|
730
|
+
polled = false,
|
|
731
|
+
}: {
|
|
732
|
+
integrationId: string;
|
|
733
|
+
refreshKey: number;
|
|
734
|
+
polled?: boolean;
|
|
735
|
+
}) {
|
|
476
736
|
const { events, isLoading, error } = useCarrierIntegrationEvents(integrationId, refreshKey);
|
|
477
737
|
return (
|
|
478
738
|
<div className="space-y-2">
|
|
479
|
-
<p className="text-sm font-medium">Recent deliveries</p>
|
|
739
|
+
<p className="text-sm font-medium">{polled ? 'Recent polls' : 'Recent deliveries'}</p>
|
|
480
740
|
<FormError message={error?.message} />
|
|
481
741
|
{isLoading && events.length === 0 ? (
|
|
482
742
|
<Skeleton className="h-12 w-full" />
|
|
483
743
|
) : events.length === 0 ? (
|
|
484
744
|
<p className="text-sm text-text-secondary">
|
|
485
|
-
|
|
745
|
+
{polled
|
|
746
|
+
? 'No polls with updates yet. Polls that find nothing to add are not listed.'
|
|
747
|
+
: 'No deliveries yet. Send a signed test update with the example below.'}
|
|
486
748
|
</p>
|
|
487
749
|
) : (
|
|
488
750
|
<ul className="space-y-2">
|
|
@@ -493,7 +755,7 @@ function DeliveryLog({ integrationId, refreshKey }: { integrationId: string; ref
|
|
|
493
755
|
>
|
|
494
756
|
<div className="min-w-0">
|
|
495
757
|
<p className="text-sm font-medium">
|
|
496
|
-
{event.eventType ? humanize(event.eventType) : 'Delivery'}
|
|
758
|
+
{event.eventType ? humanize(event.eventType) : polled ? 'Poll' : 'Delivery'}
|
|
497
759
|
{event.externalEventId ? (
|
|
498
760
|
<span className="ml-2 font-mono text-xs text-text-tertiary">
|
|
499
761
|
{event.externalEventId}
|
|
@@ -553,6 +815,7 @@ function IntegrationCard({
|
|
|
553
815
|
onToggle,
|
|
554
816
|
onSetStatus,
|
|
555
817
|
onRotate,
|
|
818
|
+
onPoll,
|
|
556
819
|
onDelete,
|
|
557
820
|
}: {
|
|
558
821
|
integration: CarrierIntegration;
|
|
@@ -564,9 +827,11 @@ function IntegrationCard({
|
|
|
564
827
|
onToggle: () => void;
|
|
565
828
|
onSetStatus: (status: IntegrationStatus) => void;
|
|
566
829
|
onRotate: () => void;
|
|
830
|
+
onPoll: () => void;
|
|
567
831
|
onDelete: () => void;
|
|
568
832
|
}) {
|
|
569
833
|
const isActive = integration.status === 'ACTIVE';
|
|
834
|
+
const polled = isPolledProvider(integration.provider);
|
|
570
835
|
return (
|
|
571
836
|
<Card>
|
|
572
837
|
<CardContent className="p-5">
|
|
@@ -579,8 +844,14 @@ function IntegrationCard({
|
|
|
579
844
|
</Badge>
|
|
580
845
|
</div>
|
|
581
846
|
<p className="text-xs text-text-secondary">
|
|
582
|
-
{providerLabel(integration.provider)} ·
|
|
847
|
+
{providerLabel(integration.provider)} ·{' '}
|
|
848
|
+
{statusExplanation(integration.status, integration.provider)}
|
|
583
849
|
</p>
|
|
850
|
+
{polled ? (
|
|
851
|
+
<p className="text-xs text-text-secondary">
|
|
852
|
+
{pollStatusSummary(integration.pollStatus, formatDateTime)}
|
|
853
|
+
</p>
|
|
854
|
+
) : null}
|
|
584
855
|
<p className="text-xs text-text-secondary">
|
|
585
856
|
Last accepted update:{' '}
|
|
586
857
|
{integration.lastSyncAt ? formatDateTime(integration.lastSyncAt) : 'none yet'}
|
|
@@ -608,9 +879,19 @@ function IntegrationCard({
|
|
|
608
879
|
)}
|
|
609
880
|
{isActive ? 'Pause' : 'Resume'}
|
|
610
881
|
</Button>
|
|
882
|
+
{polled ? (
|
|
883
|
+
<Button size="sm" variant="outline" disabled={busy || !isActive} onClick={onPoll}>
|
|
884
|
+
<DownloadCloud size={14} className="mr-1" />
|
|
885
|
+
Poll now
|
|
886
|
+
</Button>
|
|
887
|
+
) : null}
|
|
611
888
|
<Button size="sm" variant="outline" disabled={busy} onClick={onRotate}>
|
|
612
889
|
<KeyRound size={14} className="mr-1" />
|
|
613
|
-
{integration.provider === 'SAMSARA'
|
|
890
|
+
{integration.provider === 'SAMSARA'
|
|
891
|
+
? 'Replace secret'
|
|
892
|
+
: polled
|
|
893
|
+
? 'Update password'
|
|
894
|
+
: 'Rotate secret'}
|
|
614
895
|
</Button>
|
|
615
896
|
<Button
|
|
616
897
|
size="sm"
|
|
@@ -634,12 +915,16 @@ function IntegrationCard({
|
|
|
634
915
|
</div>
|
|
635
916
|
{expanded ? (
|
|
636
917
|
<div className="mt-4 grid gap-6 border-t border-border-subtle pt-4 lg:grid-cols-2">
|
|
637
|
-
{
|
|
918
|
+
{polled ? (
|
|
919
|
+
<GeotabSetupInstructions integration={integration} />
|
|
920
|
+
) : integration.provider === 'SAMSARA' ? (
|
|
638
921
|
<SamsaraSetupInstructions url={url} />
|
|
922
|
+
) : integration.provider === 'MOTIVE' ? (
|
|
923
|
+
<MotiveSetupInstructions url={url} />
|
|
639
924
|
) : (
|
|
640
925
|
<SetupInstructions url={url} />
|
|
641
926
|
)}
|
|
642
|
-
<DeliveryLog integrationId={integration.id} refreshKey={refreshKey} />
|
|
927
|
+
<DeliveryLog integrationId={integration.id} refreshKey={refreshKey} polled={polled} />
|
|
643
928
|
</div>
|
|
644
929
|
) : null}
|
|
645
930
|
</CardContent>
|
|
@@ -759,10 +1044,28 @@ function WorkspaceIntegrationsPage() {
|
|
|
759
1044
|
const replaceSamsaraSecret = async (integration: CarrierIntegration, secret: string) => {
|
|
760
1045
|
await exclusive(integration.id, async () => {
|
|
761
1046
|
await actions.update(integration.id, { apiSecret: secret });
|
|
762
|
-
done(
|
|
1047
|
+
done(
|
|
1048
|
+
integration.provider === 'GEOTAB'
|
|
1049
|
+
? `Updated the MyGeotab password for ${integration.name}.`
|
|
1050
|
+
: `Replaced the Samsara secret for ${integration.name}.`
|
|
1051
|
+
);
|
|
763
1052
|
});
|
|
764
1053
|
};
|
|
765
1054
|
|
|
1055
|
+
const pollNow = async (integration: CarrierIntegration) => {
|
|
1056
|
+
try {
|
|
1057
|
+
const result = await actions.pollNow(integration.id);
|
|
1058
|
+
if (result.status === 'FAILED') {
|
|
1059
|
+
setActionError(pollResultMessage(integration.name, result));
|
|
1060
|
+
refresh();
|
|
1061
|
+
return;
|
|
1062
|
+
}
|
|
1063
|
+
done(pollResultMessage(integration.name, result));
|
|
1064
|
+
} catch (pollError) {
|
|
1065
|
+
setActionError(errorMessage(pollError, `Could not poll ${integration.name}.`));
|
|
1066
|
+
}
|
|
1067
|
+
};
|
|
1068
|
+
|
|
766
1069
|
const removeIntegration = async (integration: CarrierIntegration) => {
|
|
767
1070
|
if (
|
|
768
1071
|
!window.confirm(
|
|
@@ -886,10 +1189,11 @@ function WorkspaceIntegrationsPage() {
|
|
|
886
1189
|
void exclusive(integration.id, () => setIntegrationStatus(integration, next))
|
|
887
1190
|
}
|
|
888
1191
|
onRotate={() =>
|
|
889
|
-
integration.provider === 'SAMSARA'
|
|
1192
|
+
integration.provider === 'SAMSARA' || isPolledProvider(integration.provider)
|
|
890
1193
|
? setReplaceTarget(integration)
|
|
891
1194
|
: void exclusive(integration.id, () => rotateSecret(integration))
|
|
892
1195
|
}
|
|
1196
|
+
onPoll={() => void exclusive(integration.id, () => pollNow(integration))}
|
|
893
1197
|
onDelete={() => void exclusive(integration.id, () => removeIntegration(integration))}
|
|
894
1198
|
/>
|
|
895
1199
|
))}
|
|
@@ -926,21 +1230,15 @@ function WorkspaceIntegrationsPage() {
|
|
|
926
1230
|
<CardContent className="space-y-2 p-5">
|
|
927
1231
|
<p className="text-sm font-medium">Carrier and ELD networks</p>
|
|
928
1232
|
<p className="text-sm text-text-secondary">
|
|
929
|
-
Samsara
|
|
930
|
-
{
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
].join(', ')}{' '}
|
|
934
|
-
are not available yet. Until they are, any carrier or telematics system that can send
|
|
935
|
-
HTTPS webhooks connects through a signed feed above.
|
|
1233
|
+
Samsara, Motive and Geotab connect directly: choose them when you connect a feed. Direct
|
|
1234
|
+
connections to {ROADMAP_PROVIDERS.map((provider) => provider.label).join(', ')} are not
|
|
1235
|
+
available yet. Until they are, any carrier or telematics system that can send HTTPS
|
|
1236
|
+
webhooks connects through a signed feed above.
|
|
936
1237
|
</p>
|
|
937
1238
|
<div className="flex flex-wrap gap-2">
|
|
938
1239
|
<Badge variant="default">Samsara · available</Badge>
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
{label} · not available yet
|
|
942
|
-
</Badge>
|
|
943
|
-
))}
|
|
1240
|
+
<Badge variant="default">Motive · available</Badge>
|
|
1241
|
+
<Badge variant="default">Geotab · available</Badge>
|
|
944
1242
|
{ROADMAP_PROVIDERS.map((provider) => (
|
|
945
1243
|
<Badge key={provider.id} variant="outline">
|
|
946
1244
|
{provider.label} · not available yet
|