react-native-radar 3.10.0-beta.2 → 3.10.0-beta.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/android/build.gradle +1 -1
- package/dist/package.json +1 -1
- package/dist/src/@types/RadarNativeInterface.d.ts +9 -9
- package/dist/src/@types/types.d.ts +184 -167
- package/dist/src/index.js +0 -6
- package/dist/src/index.native.js +1 -4
- package/dist/src/ui/autocomplete.js +24 -31
- package/dist/src/ui/map.js +18 -8
- package/package.json +1 -1
- package/src/@types/RadarNativeInterface.ts +11 -9
- package/src/@types/types.ts +222 -196
- package/src/index.native.ts +15 -14
- package/src/index.ts +3 -9
package/src/@types/types.ts
CHANGED
|
@@ -1,9 +1,50 @@
|
|
|
1
|
+
export type RadarMetadata = Record<string, string | number | boolean>;
|
|
2
|
+
|
|
1
3
|
export interface RadarTrackOnceOptions {
|
|
2
4
|
location?: Location;
|
|
3
5
|
desiredAccuracy?: RadarTrackingOptionsDesiredAccuracy;
|
|
4
6
|
beacons?: boolean;
|
|
5
7
|
}
|
|
6
8
|
|
|
9
|
+
/**
|
|
10
|
+
* Options for tracking the user's location.
|
|
11
|
+
* @see {@link https://radar.com/documentation/sdk/tracking}
|
|
12
|
+
*/
|
|
13
|
+
export interface RadarTrackingOptions {
|
|
14
|
+
desiredStoppedUpdateInterval: number;
|
|
15
|
+
fastestStoppedUpdateInterval?: number;
|
|
16
|
+
desiredMovingUpdateInterval: number;
|
|
17
|
+
fastestMovingUpdateInterval?: number;
|
|
18
|
+
desiredSyncInterval: number;
|
|
19
|
+
desiredAccuracy: String;
|
|
20
|
+
stopDuration: number;
|
|
21
|
+
stopDistance: number;
|
|
22
|
+
sync: String;
|
|
23
|
+
replay: String;
|
|
24
|
+
useStoppedGeofence: boolean;
|
|
25
|
+
showBlueBar?: boolean;
|
|
26
|
+
startTrackingAfter?: number;
|
|
27
|
+
stopTrackingAfter?: number;
|
|
28
|
+
syncLocations?: String;
|
|
29
|
+
stoppedGeofenceRadius: number;
|
|
30
|
+
useMovingGeofence: boolean;
|
|
31
|
+
movingGeofenceRadius: number;
|
|
32
|
+
syncGeofences: boolean;
|
|
33
|
+
useVisits?: boolean;
|
|
34
|
+
useSignificantLocationChanges?: boolean;
|
|
35
|
+
beacons: boolean;
|
|
36
|
+
syncGeofencesLimit?: number;
|
|
37
|
+
foregroundServiceEnabled?: boolean;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export interface RadarMockTrackingOptions {
|
|
41
|
+
origin: Location;
|
|
42
|
+
destination: Location;
|
|
43
|
+
mode: RadarRouteMode;
|
|
44
|
+
steps: number;
|
|
45
|
+
interval: number;
|
|
46
|
+
}
|
|
47
|
+
|
|
7
48
|
export interface RadarGetDistanceOptions {
|
|
8
49
|
origin?: Location;
|
|
9
50
|
destination?: Location;
|
|
@@ -28,10 +69,70 @@ export interface RadarStartTripOptions {
|
|
|
28
69
|
trackingOptions?: RadarTrackingOptions;
|
|
29
70
|
}
|
|
30
71
|
|
|
31
|
-
export interface
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
72
|
+
export interface RadarSearchGeofencesOptions {
|
|
73
|
+
near?: Location;
|
|
74
|
+
radius?: number;
|
|
75
|
+
metadata?: RadarMetadata;
|
|
76
|
+
tags?: string[];
|
|
77
|
+
limit?: number;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export interface RadarTrackingOptionsForegroundServiceOptions {
|
|
81
|
+
text?: string;
|
|
82
|
+
title?: string;
|
|
83
|
+
updatesOnly: boolean;
|
|
84
|
+
activity?: string;
|
|
85
|
+
importance?: number;
|
|
86
|
+
id?: number;
|
|
87
|
+
channelName?: string;
|
|
88
|
+
iconString?: string;
|
|
89
|
+
iconColor?: string;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
export interface RadarSearchPlacesOptions {
|
|
93
|
+
near?: Location;
|
|
94
|
+
radius?: number;
|
|
95
|
+
chains?: string[];
|
|
96
|
+
chainMetadata?: RadarMetadata;
|
|
97
|
+
categories?: string[];
|
|
98
|
+
groups?: string[];
|
|
99
|
+
limit?: number;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
export interface RadarAutocompleteOptions {
|
|
103
|
+
query: string;
|
|
104
|
+
near?: Location;
|
|
105
|
+
layers?: string[];
|
|
106
|
+
limit: number;
|
|
107
|
+
country?: string;
|
|
108
|
+
/** @deprecated this is always true, regardless of the value passed here */
|
|
109
|
+
expandUnits?: boolean;
|
|
110
|
+
mailable?: boolean;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
export interface RadarNotificationOptions {
|
|
114
|
+
iconString?: string;
|
|
115
|
+
iconColor?: string;
|
|
116
|
+
foregroundServiceIconString?: string;
|
|
117
|
+
foregroundServiceIconColor?: string;
|
|
118
|
+
eventIconString?: string;
|
|
119
|
+
eventIconColor?: string;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
export interface RadarLogConversionOptions {
|
|
123
|
+
name: string;
|
|
124
|
+
revenue?: number;
|
|
125
|
+
metadata?: RadarMetadata;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
export interface RadarTripOptions {
|
|
129
|
+
externalId: string;
|
|
130
|
+
metadata?: RadarMetadata;
|
|
131
|
+
destinationGeofenceTag?: string;
|
|
132
|
+
destinationGeofenceExternalId?: string;
|
|
133
|
+
mode?: RadarRouteMode;
|
|
134
|
+
scheduledArrivalAt?: Date;
|
|
135
|
+
approachingThreshold?: number;
|
|
35
136
|
}
|
|
36
137
|
|
|
37
138
|
export interface RadarTrackCallback {
|
|
@@ -41,20 +142,10 @@ export interface RadarTrackCallback {
|
|
|
41
142
|
events?: RadarEvent[];
|
|
42
143
|
}
|
|
43
144
|
|
|
44
|
-
export
|
|
45
|
-
| "GRANTED_FOREGROUND"
|
|
46
|
-
| "GRANTED_FOREGROUND"
|
|
47
|
-
| "DENIED"
|
|
48
|
-
| "NOT_DETERMINED"
|
|
49
|
-
| "UNKNOWN";
|
|
50
|
-
|
|
51
|
-
export type Event = "clientLocation" | "location" | "error" | "events";
|
|
52
|
-
|
|
53
|
-
export type RadarLogLevel = "info" | "debug" | "warning" | "error" | "none";
|
|
54
|
-
|
|
55
|
-
export interface RadarTrackTokenCallback {
|
|
145
|
+
export interface RadarLocationCallback {
|
|
56
146
|
status: string;
|
|
57
|
-
|
|
147
|
+
location?: Location;
|
|
148
|
+
stopped: boolean;
|
|
58
149
|
}
|
|
59
150
|
|
|
60
151
|
export interface RadarTripCallback {
|
|
@@ -81,23 +172,21 @@ export interface RadarSearchGeofencesCallback {
|
|
|
81
172
|
geofences?: RadarGeofence[];
|
|
82
173
|
}
|
|
83
174
|
|
|
84
|
-
export interface
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
metadata?: object;
|
|
88
|
-
tags?: string[];
|
|
89
|
-
limit?: number;
|
|
175
|
+
export interface RadarAddressCallback {
|
|
176
|
+
status: string;
|
|
177
|
+
addresses?: RadarAddress[];
|
|
90
178
|
}
|
|
91
179
|
|
|
92
|
-
export interface
|
|
180
|
+
export interface RadarIPGeocodeCallback {
|
|
93
181
|
status: string;
|
|
94
|
-
|
|
182
|
+
address?: RadarAddress;
|
|
183
|
+
proxy?: boolean;
|
|
95
184
|
}
|
|
96
185
|
|
|
97
186
|
export interface RadarValidateAddressCallback {
|
|
98
187
|
status: string;
|
|
99
188
|
address?: RadarAddress;
|
|
100
|
-
verificationStatus?:
|
|
189
|
+
verificationStatus?: RadarVerificationStatus;
|
|
101
190
|
}
|
|
102
191
|
|
|
103
192
|
export interface RadarIPGeocodeCallback {
|
|
@@ -106,19 +195,6 @@ export interface RadarIPGeocodeCallback {
|
|
|
106
195
|
proxy?: boolean;
|
|
107
196
|
}
|
|
108
197
|
|
|
109
|
-
|
|
110
|
-
export interface RadarTrackingOptionsForegroundServiceOptions {
|
|
111
|
-
text?: string;
|
|
112
|
-
title?: string;
|
|
113
|
-
updatesOnly: boolean;
|
|
114
|
-
activity?: string;
|
|
115
|
-
importance?: number;
|
|
116
|
-
id?: number;
|
|
117
|
-
channelName?: string;
|
|
118
|
-
iconString?: string;
|
|
119
|
-
iconColor?: string;
|
|
120
|
-
}
|
|
121
|
-
|
|
122
198
|
export interface RadarRouteCallback {
|
|
123
199
|
status: string;
|
|
124
200
|
routes?: RadarRoutes;
|
|
@@ -126,22 +202,71 @@ export interface RadarRouteCallback {
|
|
|
126
202
|
|
|
127
203
|
export interface RadarLogConversionCallback {
|
|
128
204
|
status: string;
|
|
129
|
-
event
|
|
205
|
+
event?: RadarEvent;
|
|
130
206
|
}
|
|
131
207
|
|
|
132
|
-
export interface
|
|
208
|
+
export interface RadarTrackTokenCallback {
|
|
133
209
|
status: string;
|
|
134
|
-
|
|
210
|
+
token?: String;
|
|
135
211
|
}
|
|
136
212
|
|
|
137
|
-
export interface
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
213
|
+
export interface RadarEventUpdate {
|
|
214
|
+
user?: RadarUser;
|
|
215
|
+
events: RadarEvent[];
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
export interface RadarEventUpdateCallback {
|
|
219
|
+
(args: RadarEventUpdate): void;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
export interface RadarLocationUpdate {
|
|
223
|
+
location: Location;
|
|
224
|
+
user: RadarUser;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
export interface RadarLocationUpdateCallback {
|
|
228
|
+
(args: RadarLocationUpdate): void;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
export interface RadarClientLocationUpdate {
|
|
232
|
+
location: Location;
|
|
233
|
+
stopped: boolean;
|
|
234
|
+
source: string;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
export interface RadarClientLocationUpdateCallback {
|
|
238
|
+
(args: RadarClientLocationUpdate): void;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
export interface RadarErrorCallback {
|
|
242
|
+
(status: string): void;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
export interface RadarLogUpdateCallback {
|
|
246
|
+
(status: string): void;
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
export type RadarListenerCallback =
|
|
250
|
+
| RadarEventUpdateCallback
|
|
251
|
+
| RadarLocationUpdateCallback
|
|
252
|
+
| RadarClientLocationUpdateCallback
|
|
253
|
+
| RadarErrorCallback
|
|
254
|
+
| RadarLogUpdateCallback;
|
|
255
|
+
|
|
256
|
+
export type RadarPermissionsStatus =
|
|
257
|
+
| "GRANTED_FOREGROUND"
|
|
258
|
+
| "GRANTED_FOREGROUND"
|
|
259
|
+
| "DENIED"
|
|
260
|
+
| "NOT_DETERMINED"
|
|
261
|
+
| "UNKNOWN";
|
|
262
|
+
|
|
263
|
+
export type Event = "clientLocation" | "location" | "error" | "events" | "log";
|
|
264
|
+
|
|
265
|
+
export type RadarLogLevel = "info" | "debug" | "warning" | "error" | "none";
|
|
266
|
+
|
|
267
|
+
export interface RadarRouteMatrix {
|
|
268
|
+
status: string;
|
|
269
|
+
matrix?: RadarRoute[][];
|
|
145
270
|
}
|
|
146
271
|
|
|
147
272
|
export interface Location {
|
|
@@ -162,7 +287,7 @@ export interface RadarUser {
|
|
|
162
287
|
userId?: string;
|
|
163
288
|
deviceId?: string;
|
|
164
289
|
description?: string;
|
|
165
|
-
metadata?:
|
|
290
|
+
metadata?: RadarMetadata;
|
|
166
291
|
location?: RadarCoordinate;
|
|
167
292
|
geofences?: RadarGeofence[];
|
|
168
293
|
place?: RadarPlace;
|
|
@@ -173,22 +298,14 @@ export interface RadarUser {
|
|
|
173
298
|
state?: RadarRegion;
|
|
174
299
|
dma?: RadarRegion;
|
|
175
300
|
postalCode?: RadarRegion;
|
|
176
|
-
nearbyPlaceChains?:
|
|
301
|
+
nearbyPlaceChains?: RadarChain[];
|
|
177
302
|
segments?: RadarSegment[];
|
|
178
|
-
topChains?:
|
|
303
|
+
topChains?: RadarChain[];
|
|
179
304
|
source?: LocationSource;
|
|
180
305
|
trip?: RadarTrip;
|
|
181
306
|
debug?: boolean;
|
|
182
307
|
fraud?: RadarFraud;
|
|
183
308
|
}
|
|
184
|
-
export interface RadarAutocompleteOptions {
|
|
185
|
-
query: string;
|
|
186
|
-
near?: Location;
|
|
187
|
-
layers?: string[];
|
|
188
|
-
limit: number;
|
|
189
|
-
country?: string;
|
|
190
|
-
expandUnits?: boolean;
|
|
191
|
-
}
|
|
192
309
|
|
|
193
310
|
export interface RadarCoordinate {
|
|
194
311
|
type: string;
|
|
@@ -211,13 +328,14 @@ export type LocationSource =
|
|
|
211
328
|
export interface RadarTrip {
|
|
212
329
|
_id: string;
|
|
213
330
|
externalId: string;
|
|
214
|
-
metadata?:
|
|
331
|
+
metadata?: RadarMetadata;
|
|
215
332
|
destinationGeofenceTag?: string;
|
|
216
333
|
destinationGeofenceExternalId?: string;
|
|
217
334
|
mode?: string;
|
|
218
335
|
eta?: RadarTripEta;
|
|
219
336
|
status: string;
|
|
220
337
|
scheduledArrivalAt?: Date;
|
|
338
|
+
destinationLocation: Location;
|
|
221
339
|
}
|
|
222
340
|
|
|
223
341
|
export interface RadarSegment {
|
|
@@ -247,7 +365,10 @@ export interface RadarEvent {
|
|
|
247
365
|
trip?: RadarTrip;
|
|
248
366
|
alternatePlaces?: RadarPlace[];
|
|
249
367
|
location?: RadarCoordinate;
|
|
250
|
-
metadata?:
|
|
368
|
+
metadata?: RadarMetadata;
|
|
369
|
+
replayed?: boolean;
|
|
370
|
+
createdAt: string;
|
|
371
|
+
actualCreatedAt: string;
|
|
251
372
|
}
|
|
252
373
|
|
|
253
374
|
export enum RadarEventConfidence {
|
|
@@ -300,17 +421,17 @@ export interface RadarGeofence {
|
|
|
300
421
|
description: string;
|
|
301
422
|
tag?: string;
|
|
302
423
|
externalId?: string;
|
|
303
|
-
metadata?:
|
|
304
|
-
type?:
|
|
424
|
+
metadata?: RadarMetadata;
|
|
425
|
+
type?: "Circle" | "Polygon";
|
|
305
426
|
geometryRadius?: number;
|
|
306
427
|
geometryCenter?: RadarCoordinate;
|
|
428
|
+
// only available for geofences of type "Polygon"
|
|
307
429
|
coordinates?: number[][];
|
|
308
|
-
|
|
309
430
|
}
|
|
310
431
|
|
|
311
432
|
export interface RadarBeacon {
|
|
312
433
|
_id: string;
|
|
313
|
-
metadata?:
|
|
434
|
+
metadata?: RadarMetadata;
|
|
314
435
|
type: RadarBeaconType;
|
|
315
436
|
uuid?: string;
|
|
316
437
|
instance?: string;
|
|
@@ -325,13 +446,16 @@ export interface RadarPlace {
|
|
|
325
446
|
name: string;
|
|
326
447
|
categories: string[];
|
|
327
448
|
chain?: RadarChain;
|
|
449
|
+
location: Location;
|
|
450
|
+
metadata?: RadarMetadata;
|
|
451
|
+
group?: string;
|
|
328
452
|
}
|
|
329
453
|
|
|
330
454
|
export interface RadarChain {
|
|
331
455
|
name: string;
|
|
332
456
|
slug: string;
|
|
333
457
|
externalId?: string;
|
|
334
|
-
metadata?:
|
|
458
|
+
metadata?: RadarMetadata;
|
|
335
459
|
}
|
|
336
460
|
|
|
337
461
|
export interface RadarRegion {
|
|
@@ -340,55 +464,61 @@ export interface RadarRegion {
|
|
|
340
464
|
code: string;
|
|
341
465
|
name: string;
|
|
342
466
|
allowed?: boolean;
|
|
343
|
-
flag?:string;
|
|
344
|
-
}
|
|
345
|
-
|
|
346
|
-
export interface RadarLocationPermissionsCallback {
|
|
347
|
-
status: string;
|
|
467
|
+
flag?: string;
|
|
348
468
|
}
|
|
349
469
|
|
|
350
470
|
export interface RadarAddress {
|
|
351
|
-
latitude: number;
|
|
352
|
-
longitude: number;
|
|
353
|
-
placeLabel?: string;
|
|
354
471
|
addressLabel?: string;
|
|
355
|
-
|
|
472
|
+
borough?: string;
|
|
473
|
+
city?: string;
|
|
474
|
+
confidence?: string;
|
|
356
475
|
country?: string;
|
|
357
476
|
countryCode?: string;
|
|
358
477
|
countryFlag?: string;
|
|
359
|
-
state?: string;
|
|
360
|
-
stateCode?: string;
|
|
361
|
-
postalCode?: string;
|
|
362
|
-
city?: string;
|
|
363
|
-
borough?: string;
|
|
364
478
|
county?: string;
|
|
479
|
+
distance?: number;
|
|
480
|
+
dma?: string;
|
|
481
|
+
dmaCode?: string;
|
|
482
|
+
formattedAddress?: string;
|
|
483
|
+
latitude: number;
|
|
484
|
+
layer?: string;
|
|
485
|
+
longitude: number;
|
|
486
|
+
metadata?: RadarMetadata;
|
|
365
487
|
neighborhood?: string;
|
|
366
488
|
number?: string;
|
|
489
|
+
placeLabel?: string;
|
|
490
|
+
plus4?: string;
|
|
491
|
+
postalCode?: string;
|
|
492
|
+
state?: string;
|
|
493
|
+
stateCode?: string;
|
|
367
494
|
street?: string;
|
|
368
495
|
unit?: string;
|
|
369
|
-
distance?: number;
|
|
370
|
-
confidence?: string;
|
|
371
|
-
layer?: string;
|
|
372
|
-
plus4?: string;
|
|
373
|
-
dmaCode?: string;
|
|
374
|
-
dma?: string;
|
|
375
|
-
metadata?: object;
|
|
376
496
|
}
|
|
377
497
|
|
|
378
|
-
export
|
|
379
|
-
|
|
380
|
-
|
|
498
|
+
export type RadarVerificationStatus =
|
|
499
|
+
| "verified"
|
|
500
|
+
| "partially verified"
|
|
501
|
+
| "ambiguous"
|
|
502
|
+
| "unverified";
|
|
381
503
|
|
|
382
504
|
export interface RadarRoutes {
|
|
383
505
|
geodesic?: RadarRouteDistance;
|
|
384
506
|
foot?: RadarRoute;
|
|
385
507
|
bike?: RadarRoute;
|
|
386
508
|
car?: RadarRoute;
|
|
509
|
+
truck?: RadarRoute;
|
|
510
|
+
motorbike?: RadarRoute;
|
|
511
|
+
}
|
|
512
|
+
|
|
513
|
+
export interface RadarRouteGeometry {
|
|
514
|
+
type: string;
|
|
515
|
+
coordinates: number[][];
|
|
387
516
|
}
|
|
388
517
|
|
|
389
518
|
export interface RadarRoute {
|
|
390
519
|
distance?: RadarRouteDistance;
|
|
391
520
|
duration?: RadarRouteDuration;
|
|
521
|
+
geometry?: RadarRouteGeometry;
|
|
392
522
|
}
|
|
393
523
|
|
|
394
524
|
export interface RadarRouteDistance {
|
|
@@ -396,15 +526,6 @@ export interface RadarRouteDistance {
|
|
|
396
526
|
text: string;
|
|
397
527
|
}
|
|
398
528
|
|
|
399
|
-
export interface RadarNotificationOptions {
|
|
400
|
-
iconString?: string;
|
|
401
|
-
iconColor?: string;
|
|
402
|
-
foregroundServiceIconString?: string;
|
|
403
|
-
foregroundServiceIconColor?: string;
|
|
404
|
-
eventIconString?: string;
|
|
405
|
-
eventIconColor?: string;
|
|
406
|
-
}
|
|
407
|
-
|
|
408
529
|
export interface RadarRouteDuration {
|
|
409
530
|
value: number;
|
|
410
531
|
text: string;
|
|
@@ -425,57 +546,12 @@ export interface RadarFraud {
|
|
|
425
546
|
jumped: boolean;
|
|
426
547
|
}
|
|
427
548
|
|
|
428
|
-
export interface RadarMockTrackingOptions {
|
|
429
|
-
origin: Location;
|
|
430
|
-
destination: Location;
|
|
431
|
-
mode: RadarRouteMode;
|
|
432
|
-
steps: number;
|
|
433
|
-
interval: number;
|
|
434
|
-
}
|
|
435
|
-
|
|
436
549
|
export type RadarTrackingOptionsReplay = "all" | "stops" | "none";
|
|
437
550
|
|
|
438
551
|
export type RadarTrackingOptionsSync = "none" | "stopsAndExits" | "all";
|
|
439
552
|
|
|
440
|
-
export interface RadarTrackingOptions {
|
|
441
|
-
desiredStoppedUpdateInterval: number;
|
|
442
|
-
fastestStoppedUpdateInterval?: number;
|
|
443
|
-
desiredMovingUpdateInterval: number;
|
|
444
|
-
fastestMovingUpdateInterval?: number;
|
|
445
|
-
desiredSyncInterval: number;
|
|
446
|
-
desiredAccuracy: String;
|
|
447
|
-
stopDuration: number;
|
|
448
|
-
stopDistance: number;
|
|
449
|
-
sync: String;
|
|
450
|
-
replay: String;
|
|
451
|
-
useStoppedGeofence: boolean;
|
|
452
|
-
showBlueBar?: boolean;
|
|
453
|
-
foregroundServiceEnabled?: boolean;
|
|
454
|
-
startTrackingAfter?: number | undefined;
|
|
455
|
-
stopTrackingAfter?: number | undefined;
|
|
456
|
-
syncLocations?: String;
|
|
457
|
-
stoppedGeofenceRadius: number;
|
|
458
|
-
useMovingGeofence: boolean;
|
|
459
|
-
movingGeofenceRadius: number;
|
|
460
|
-
syncGeofences: boolean;
|
|
461
|
-
useVisits?: boolean;
|
|
462
|
-
useSignificantLocationChanges?: boolean;
|
|
463
|
-
beacons: boolean;
|
|
464
|
-
syncGeofencesLimit?: number;
|
|
465
|
-
}
|
|
466
|
-
|
|
467
|
-
export interface RadarLogConversionOptions {
|
|
468
|
-
name: string;
|
|
469
|
-
revenue?: number;
|
|
470
|
-
metadata?: object;
|
|
471
|
-
}
|
|
472
|
-
|
|
473
553
|
export type RadarRouteMode = "foot" | "bike" | "car";
|
|
474
554
|
|
|
475
|
-
export interface RadarTrackingStatus {
|
|
476
|
-
isTracking: string;
|
|
477
|
-
}
|
|
478
|
-
|
|
479
555
|
export interface RadarTrackingOptionsForegroundService {
|
|
480
556
|
text?: string;
|
|
481
557
|
title?: string;
|
|
@@ -487,16 +563,6 @@ export interface RadarTrackingOptionsForegroundService {
|
|
|
487
563
|
channelName?: string;
|
|
488
564
|
}
|
|
489
565
|
|
|
490
|
-
export interface RadarTripOptions {
|
|
491
|
-
externalId: string;
|
|
492
|
-
metadata?: object;
|
|
493
|
-
destinationGeofenceTag?: string;
|
|
494
|
-
destinationGeofenceExternalId?: string;
|
|
495
|
-
mode?: RadarRouteMode;
|
|
496
|
-
scheduledArrivalAt?: Date;
|
|
497
|
-
approachingThreshold?: number;
|
|
498
|
-
}
|
|
499
|
-
|
|
500
566
|
export type RadarTripStatus =
|
|
501
567
|
| "unknown"
|
|
502
568
|
| "started"
|
|
@@ -505,43 +571,3 @@ export type RadarTripStatus =
|
|
|
505
571
|
| "expired"
|
|
506
572
|
| "completed"
|
|
507
573
|
| "canceled";
|
|
508
|
-
|
|
509
|
-
interface RadarEventUpdate {
|
|
510
|
-
user: RadarUser;
|
|
511
|
-
events: RadarEvent[];
|
|
512
|
-
}
|
|
513
|
-
|
|
514
|
-
interface RadarEventUpdateCallback {
|
|
515
|
-
(args: RadarEventUpdate): void;
|
|
516
|
-
}
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
interface RadarLocationUpdate{
|
|
521
|
-
location: Location;
|
|
522
|
-
user: RadarUser;
|
|
523
|
-
}
|
|
524
|
-
|
|
525
|
-
interface RadarLocationUpdateCallback{
|
|
526
|
-
(args: RadarLocationUpdate): void;
|
|
527
|
-
}
|
|
528
|
-
|
|
529
|
-
interface RadarClientLocationUpdate {
|
|
530
|
-
location: Location;
|
|
531
|
-
stopped: boolean;
|
|
532
|
-
source: string;
|
|
533
|
-
}
|
|
534
|
-
|
|
535
|
-
interface RadarClientLocationUpdateCallback{
|
|
536
|
-
(args: RadarClientLocationUpdate): void;
|
|
537
|
-
}
|
|
538
|
-
|
|
539
|
-
interface RadarErrorCallback{
|
|
540
|
-
(status: string): void;
|
|
541
|
-
}
|
|
542
|
-
|
|
543
|
-
interface RadarLogUpdateCallback{
|
|
544
|
-
(status: string): void;
|
|
545
|
-
}
|
|
546
|
-
|
|
547
|
-
export type RadarListenerCallback = RadarEventUpdateCallback | RadarLocationUpdateCallback | RadarClientLocationUpdateCallback | RadarErrorCallback | RadarLogUpdateCallback;
|
package/src/index.native.ts
CHANGED
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
Location,
|
|
6
6
|
RadarAutocompleteOptions,
|
|
7
7
|
RadarContextCallback,
|
|
8
|
-
|
|
8
|
+
RadarAddressCallback,
|
|
9
9
|
RadarGetDistanceOptions,
|
|
10
10
|
RadarLocationCallback,
|
|
11
11
|
RadarLogConversionCallback,
|
|
@@ -33,6 +33,8 @@ import {
|
|
|
33
33
|
Event,
|
|
34
34
|
RadarListenerCallback,
|
|
35
35
|
RadarGetMatrixOptions,
|
|
36
|
+
RadarMetadata,
|
|
37
|
+
RadarIPGeocodeCallback,
|
|
36
38
|
} from "./@types/types";
|
|
37
39
|
|
|
38
40
|
if (
|
|
@@ -64,11 +66,12 @@ const setDescription = (description: string): void => {
|
|
|
64
66
|
const getDescription = (): Promise<string> =>
|
|
65
67
|
NativeModules.RNRadar.getDescription();
|
|
66
68
|
|
|
67
|
-
const setMetadata = (metadata:
|
|
69
|
+
const setMetadata = (metadata: RadarMetadata): void => {
|
|
68
70
|
NativeModules.RNRadar.setMetadata(metadata);
|
|
69
71
|
};
|
|
70
72
|
|
|
71
|
-
const getMetadata = (): Promise<
|
|
73
|
+
const getMetadata = (): Promise<RadarMetadata> =>
|
|
74
|
+
NativeModules.RNRadar.getMetadata();
|
|
72
75
|
|
|
73
76
|
const setAnonymousTrackingEnabled = (enabled: boolean): void =>
|
|
74
77
|
NativeModules.RNRadar.setAnonymousTrackingEnabled(enabled);
|
|
@@ -138,8 +141,7 @@ const setForegroundServiceOptions = (
|
|
|
138
141
|
const setNotificationOptions = (options: RadarNotificationOptions): void =>
|
|
139
142
|
NativeModules.RNRadar.setNotificationOptions(options);
|
|
140
143
|
|
|
141
|
-
|
|
142
|
-
const getTripOptions = (): Promise<RadarTripOptions> =>
|
|
144
|
+
const getTripOptions = (): Promise<RadarTripOptions> =>
|
|
143
145
|
NativeModules.RNRadar.getTripOptions();
|
|
144
146
|
|
|
145
147
|
const startTrip = (
|
|
@@ -177,37 +179,36 @@ const searchGeofences = (
|
|
|
177
179
|
|
|
178
180
|
const autocomplete = (
|
|
179
181
|
options: RadarAutocompleteOptions
|
|
180
|
-
): Promise<
|
|
182
|
+
): Promise<RadarAddressCallback> => NativeModules.RNRadar.autocomplete(options);
|
|
181
183
|
|
|
182
|
-
const geocode = (address: string): Promise<
|
|
184
|
+
const geocode = (address: string): Promise<RadarAddressCallback> =>
|
|
183
185
|
NativeModules.RNRadar.geocode(address);
|
|
184
186
|
|
|
185
|
-
const reverseGeocode = (location: Location): Promise<
|
|
187
|
+
const reverseGeocode = (location: Location): Promise<RadarAddressCallback> =>
|
|
186
188
|
NativeModules.RNRadar.reverseGeocode(location);
|
|
187
189
|
|
|
188
|
-
const ipGeocode = (): Promise<
|
|
190
|
+
const ipGeocode = (): Promise<RadarIPGeocodeCallback> =>
|
|
189
191
|
NativeModules.RNRadar.ipGeocode();
|
|
190
192
|
|
|
191
193
|
const getDistance = (
|
|
192
194
|
options: RadarGetDistanceOptions
|
|
193
195
|
): Promise<RadarRouteCallback> => NativeModules.RNRadar.getDistance(options);
|
|
194
196
|
|
|
195
|
-
const getMatrix = (
|
|
196
|
-
options
|
|
197
|
-
): Promise<RadarRouteMatrix> => NativeModules.RNRadar.getMatrix(options);
|
|
197
|
+
const getMatrix = (options: RadarGetMatrixOptions): Promise<RadarRouteMatrix> =>
|
|
198
|
+
NativeModules.RNRadar.getMatrix(options);
|
|
198
199
|
|
|
199
200
|
const logConversion = (
|
|
200
201
|
options: RadarLogConversionOptions
|
|
201
202
|
): Promise<RadarLogConversionCallback> =>
|
|
202
203
|
NativeModules.RNRadar.logConversion(options);
|
|
203
204
|
|
|
204
|
-
const sendEvent = (name: string, metadata:
|
|
205
|
+
const sendEvent = (name: string, metadata: RadarMetadata): void =>
|
|
205
206
|
NativeModules.RNRadar.sendEvent(name, metadata);
|
|
206
207
|
|
|
207
208
|
const on = (event: Event, callback: RadarListenerCallback): void =>
|
|
208
209
|
eventEmitter.addListener(event, callback);
|
|
209
210
|
|
|
210
|
-
const off = (event: Event, callback
|
|
211
|
+
const off = (event: Event, callback?: Function | undefined): void => {
|
|
211
212
|
if (callback) {
|
|
212
213
|
// @ts-ignore
|
|
213
214
|
eventEmitter.removeListener(event, callback);
|
package/src/index.ts
CHANGED
|
@@ -1,15 +1,9 @@
|
|
|
1
|
-
//import { Platform } from "react-native";
|
|
2
1
|
import { RadarNativeInterface } from "./@types/RadarNativeInterface";
|
|
3
2
|
|
|
4
|
-
//type RadarInterface = Platform["OS"] extends "web" ? RadarNativeInterface : any;
|
|
5
|
-
//type RadarInterface = RadarNativeInterface;
|
|
6
|
-
|
|
7
3
|
let module: RadarNativeInterface;
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
module = require("./index.native").default;
|
|
12
|
-
//}
|
|
4
|
+
|
|
5
|
+
module = require("./index.native").default;
|
|
6
|
+
|
|
13
7
|
export default module;
|
|
14
8
|
|
|
15
9
|
export { default as RadarRNWeb } from "./index.web";
|