react-native-radar 3.10.0-beta.3 → 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 +2 -2
- package/dist/src/@types/types.d.ts +160 -157
- 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 +2 -1
- package/src/@types/types.ts +196 -188
- package/src/index.native.ts +7 -7
- package/src/index.ts +3 -9
package/android/build.gradle
CHANGED
package/dist/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"description": "React Native module for Radar, the leading geofencing and location tracking platform",
|
|
4
4
|
"homepage": "https://radar.com",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
|
-
"version": "3.10.0-beta.
|
|
6
|
+
"version": "3.10.0-beta.4",
|
|
7
7
|
"main": "dist/src/index.js",
|
|
8
8
|
"files": [
|
|
9
9
|
"android",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Location, RadarAutocompleteOptions, RadarContextCallback, RadarAddressCallback, RadarGetDistanceOptions, RadarLocationCallback, RadarLogConversionCallback, RadarLogConversionOptions, RadarLogLevel, RadarMockTrackingOptions, RadarNotificationOptions, RadarPermissionsStatus, RadarRouteCallback, RadarRouteMatrix, RadarSearchGeofencesCallback, RadarSearchGeofencesOptions, RadarSearchPlacesCallback, RadarSearchPlacesOptions, RadarStartTripOptions, RadarTrackCallback, RadarTrackOnceOptions, RadarTrackTokenCallback, RadarTrackingOptions, RadarTrackingOptionsDesiredAccuracy, RadarTrackingOptionsForegroundService, RadarTripCallback, RadarTripOptions, RadarUpdateTripOptions, Event, RadarListenerCallback, RadarGetMatrixOptions, RadarMetadata } from "./types";
|
|
1
|
+
import { Location, RadarAutocompleteOptions, RadarContextCallback, RadarAddressCallback, RadarGetDistanceOptions, RadarLocationCallback, RadarLogConversionCallback, RadarLogConversionOptions, RadarLogLevel, RadarMockTrackingOptions, RadarNotificationOptions, RadarPermissionsStatus, RadarRouteCallback, RadarRouteMatrix, RadarSearchGeofencesCallback, RadarSearchGeofencesOptions, RadarSearchPlacesCallback, RadarSearchPlacesOptions, RadarStartTripOptions, RadarTrackCallback, RadarTrackOnceOptions, RadarTrackTokenCallback, RadarTrackingOptions, RadarTrackingOptionsDesiredAccuracy, RadarTrackingOptionsForegroundService, RadarTripCallback, RadarTripOptions, RadarUpdateTripOptions, Event, RadarListenerCallback, RadarGetMatrixOptions, RadarMetadata, RadarIPGeocodeCallback } from "./types";
|
|
2
2
|
export interface RadarNativeInterface {
|
|
3
3
|
initialize: (publishableKey: string, fraud: boolean) => void;
|
|
4
4
|
setLogLevel: (level: RadarLogLevel) => void;
|
|
@@ -39,7 +39,7 @@ export interface RadarNativeInterface {
|
|
|
39
39
|
autocomplete: (options: RadarAutocompleteOptions) => Promise<RadarAddressCallback>;
|
|
40
40
|
geocode: (address: string) => Promise<RadarAddressCallback>;
|
|
41
41
|
reverseGeocode: (location: any) => Promise<RadarAddressCallback>;
|
|
42
|
-
ipGeocode: () => Promise<
|
|
42
|
+
ipGeocode: () => Promise<RadarIPGeocodeCallback>;
|
|
43
43
|
getDistance: (option: RadarGetDistanceOptions) => Promise<RadarRouteCallback>;
|
|
44
44
|
getMatrix: (option: RadarGetMatrixOptions) => Promise<RadarRouteMatrix>;
|
|
45
45
|
logConversion: (options: RadarLogConversionOptions) => Promise<RadarLogConversionCallback>;
|
|
@@ -4,6 +4,43 @@ export interface RadarTrackOnceOptions {
|
|
|
4
4
|
desiredAccuracy?: RadarTrackingOptionsDesiredAccuracy;
|
|
5
5
|
beacons?: boolean;
|
|
6
6
|
}
|
|
7
|
+
/**
|
|
8
|
+
* Options for tracking the user's location.
|
|
9
|
+
* @see {@link https://radar.com/documentation/sdk/tracking}
|
|
10
|
+
*/
|
|
11
|
+
export interface RadarTrackingOptions {
|
|
12
|
+
desiredStoppedUpdateInterval: number;
|
|
13
|
+
fastestStoppedUpdateInterval?: number;
|
|
14
|
+
desiredMovingUpdateInterval: number;
|
|
15
|
+
fastestMovingUpdateInterval?: number;
|
|
16
|
+
desiredSyncInterval: number;
|
|
17
|
+
desiredAccuracy: String;
|
|
18
|
+
stopDuration: number;
|
|
19
|
+
stopDistance: number;
|
|
20
|
+
sync: String;
|
|
21
|
+
replay: String;
|
|
22
|
+
useStoppedGeofence: boolean;
|
|
23
|
+
showBlueBar?: boolean;
|
|
24
|
+
startTrackingAfter?: number;
|
|
25
|
+
stopTrackingAfter?: number;
|
|
26
|
+
syncLocations?: String;
|
|
27
|
+
stoppedGeofenceRadius: number;
|
|
28
|
+
useMovingGeofence: boolean;
|
|
29
|
+
movingGeofenceRadius: number;
|
|
30
|
+
syncGeofences: boolean;
|
|
31
|
+
useVisits?: boolean;
|
|
32
|
+
useSignificantLocationChanges?: boolean;
|
|
33
|
+
beacons: boolean;
|
|
34
|
+
syncGeofencesLimit?: number;
|
|
35
|
+
foregroundServiceEnabled?: boolean;
|
|
36
|
+
}
|
|
37
|
+
export interface RadarMockTrackingOptions {
|
|
38
|
+
origin: Location;
|
|
39
|
+
destination: Location;
|
|
40
|
+
mode: RadarRouteMode;
|
|
41
|
+
steps: number;
|
|
42
|
+
interval: number;
|
|
43
|
+
}
|
|
7
44
|
export interface RadarGetDistanceOptions {
|
|
8
45
|
origin?: Location;
|
|
9
46
|
destination?: Location;
|
|
@@ -24,10 +61,64 @@ export interface RadarStartTripOptions {
|
|
|
24
61
|
tripOptions: RadarTripOptions;
|
|
25
62
|
trackingOptions?: RadarTrackingOptions;
|
|
26
63
|
}
|
|
27
|
-
export interface
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
64
|
+
export interface RadarSearchGeofencesOptions {
|
|
65
|
+
near?: Location;
|
|
66
|
+
radius?: number;
|
|
67
|
+
metadata?: RadarMetadata;
|
|
68
|
+
tags?: string[];
|
|
69
|
+
limit?: number;
|
|
70
|
+
}
|
|
71
|
+
export interface RadarTrackingOptionsForegroundServiceOptions {
|
|
72
|
+
text?: string;
|
|
73
|
+
title?: string;
|
|
74
|
+
updatesOnly: boolean;
|
|
75
|
+
activity?: string;
|
|
76
|
+
importance?: number;
|
|
77
|
+
id?: number;
|
|
78
|
+
channelName?: string;
|
|
79
|
+
iconString?: string;
|
|
80
|
+
iconColor?: string;
|
|
81
|
+
}
|
|
82
|
+
export interface RadarSearchPlacesOptions {
|
|
83
|
+
near?: Location;
|
|
84
|
+
radius?: number;
|
|
85
|
+
chains?: string[];
|
|
86
|
+
chainMetadata?: RadarMetadata;
|
|
87
|
+
categories?: string[];
|
|
88
|
+
groups?: string[];
|
|
89
|
+
limit?: number;
|
|
90
|
+
}
|
|
91
|
+
export interface RadarAutocompleteOptions {
|
|
92
|
+
query: string;
|
|
93
|
+
near?: Location;
|
|
94
|
+
layers?: string[];
|
|
95
|
+
limit: number;
|
|
96
|
+
country?: string;
|
|
97
|
+
/** @deprecated this is always true, regardless of the value passed here */
|
|
98
|
+
expandUnits?: boolean;
|
|
99
|
+
mailable?: boolean;
|
|
100
|
+
}
|
|
101
|
+
export interface RadarNotificationOptions {
|
|
102
|
+
iconString?: string;
|
|
103
|
+
iconColor?: string;
|
|
104
|
+
foregroundServiceIconString?: string;
|
|
105
|
+
foregroundServiceIconColor?: string;
|
|
106
|
+
eventIconString?: string;
|
|
107
|
+
eventIconColor?: string;
|
|
108
|
+
}
|
|
109
|
+
export interface RadarLogConversionOptions {
|
|
110
|
+
name: string;
|
|
111
|
+
revenue?: number;
|
|
112
|
+
metadata?: RadarMetadata;
|
|
113
|
+
}
|
|
114
|
+
export interface RadarTripOptions {
|
|
115
|
+
externalId: string;
|
|
116
|
+
metadata?: RadarMetadata;
|
|
117
|
+
destinationGeofenceTag?: string;
|
|
118
|
+
destinationGeofenceExternalId?: string;
|
|
119
|
+
mode?: RadarRouteMode;
|
|
120
|
+
scheduledArrivalAt?: Date;
|
|
121
|
+
approachingThreshold?: number;
|
|
31
122
|
}
|
|
32
123
|
export interface RadarTrackCallback {
|
|
33
124
|
status: string;
|
|
@@ -35,12 +126,10 @@ export interface RadarTrackCallback {
|
|
|
35
126
|
user?: RadarUser;
|
|
36
127
|
events?: RadarEvent[];
|
|
37
128
|
}
|
|
38
|
-
export
|
|
39
|
-
export type Event = "clientLocation" | "location" | "error" | "events" | "log";
|
|
40
|
-
export type RadarLogLevel = "info" | "debug" | "warning" | "error" | "none";
|
|
41
|
-
export interface RadarTrackTokenCallback {
|
|
129
|
+
export interface RadarLocationCallback {
|
|
42
130
|
status: string;
|
|
43
|
-
|
|
131
|
+
location?: Location;
|
|
132
|
+
stopped: boolean;
|
|
44
133
|
}
|
|
45
134
|
export interface RadarTripCallback {
|
|
46
135
|
status: string;
|
|
@@ -62,58 +151,72 @@ export interface RadarSearchGeofencesCallback {
|
|
|
62
151
|
location?: Location;
|
|
63
152
|
geofences?: RadarGeofence[];
|
|
64
153
|
}
|
|
65
|
-
export interface RadarSearchGeofencesOptions {
|
|
66
|
-
near?: Location;
|
|
67
|
-
radius?: number;
|
|
68
|
-
metadata?: RadarMetadata;
|
|
69
|
-
tags?: string[];
|
|
70
|
-
limit?: number;
|
|
71
|
-
}
|
|
72
154
|
export interface RadarAddressCallback {
|
|
73
155
|
status: string;
|
|
74
156
|
addresses?: RadarAddress[];
|
|
75
157
|
}
|
|
158
|
+
export interface RadarIPGeocodeCallback {
|
|
159
|
+
status: string;
|
|
160
|
+
address?: RadarAddress;
|
|
161
|
+
proxy?: boolean;
|
|
162
|
+
}
|
|
76
163
|
export interface RadarValidateAddressCallback {
|
|
77
164
|
status: string;
|
|
78
165
|
address?: RadarAddress;
|
|
79
|
-
verificationStatus?:
|
|
166
|
+
verificationStatus?: RadarVerificationStatus;
|
|
80
167
|
}
|
|
81
168
|
export interface RadarIPGeocodeCallback {
|
|
82
169
|
status: string;
|
|
83
170
|
address?: RadarAddress;
|
|
84
171
|
proxy?: boolean;
|
|
85
172
|
}
|
|
86
|
-
export interface RadarTrackingOptionsForegroundServiceOptions {
|
|
87
|
-
text?: string;
|
|
88
|
-
title?: string;
|
|
89
|
-
updatesOnly: boolean;
|
|
90
|
-
activity?: string;
|
|
91
|
-
importance?: number;
|
|
92
|
-
id?: number;
|
|
93
|
-
channelName?: string;
|
|
94
|
-
iconString?: string;
|
|
95
|
-
iconColor?: string;
|
|
96
|
-
}
|
|
97
173
|
export interface RadarRouteCallback {
|
|
98
174
|
status: string;
|
|
99
175
|
routes?: RadarRoutes;
|
|
100
176
|
}
|
|
101
177
|
export interface RadarLogConversionCallback {
|
|
102
178
|
status: string;
|
|
103
|
-
event
|
|
179
|
+
event?: RadarEvent;
|
|
104
180
|
}
|
|
105
|
-
export interface
|
|
181
|
+
export interface RadarTrackTokenCallback {
|
|
106
182
|
status: string;
|
|
107
|
-
|
|
183
|
+
token?: String;
|
|
108
184
|
}
|
|
109
|
-
export interface
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
185
|
+
export interface RadarEventUpdate {
|
|
186
|
+
user?: RadarUser;
|
|
187
|
+
events: RadarEvent[];
|
|
188
|
+
}
|
|
189
|
+
export interface RadarEventUpdateCallback {
|
|
190
|
+
(args: RadarEventUpdate): void;
|
|
191
|
+
}
|
|
192
|
+
export interface RadarLocationUpdate {
|
|
193
|
+
location: Location;
|
|
194
|
+
user: RadarUser;
|
|
195
|
+
}
|
|
196
|
+
export interface RadarLocationUpdateCallback {
|
|
197
|
+
(args: RadarLocationUpdate): void;
|
|
198
|
+
}
|
|
199
|
+
export interface RadarClientLocationUpdate {
|
|
200
|
+
location: Location;
|
|
201
|
+
stopped: boolean;
|
|
202
|
+
source: string;
|
|
203
|
+
}
|
|
204
|
+
export interface RadarClientLocationUpdateCallback {
|
|
205
|
+
(args: RadarClientLocationUpdate): void;
|
|
206
|
+
}
|
|
207
|
+
export interface RadarErrorCallback {
|
|
208
|
+
(status: string): void;
|
|
209
|
+
}
|
|
210
|
+
export interface RadarLogUpdateCallback {
|
|
211
|
+
(status: string): void;
|
|
212
|
+
}
|
|
213
|
+
export type RadarListenerCallback = RadarEventUpdateCallback | RadarLocationUpdateCallback | RadarClientLocationUpdateCallback | RadarErrorCallback | RadarLogUpdateCallback;
|
|
214
|
+
export type RadarPermissionsStatus = "GRANTED_FOREGROUND" | "GRANTED_FOREGROUND" | "DENIED" | "NOT_DETERMINED" | "UNKNOWN";
|
|
215
|
+
export type Event = "clientLocation" | "location" | "error" | "events" | "log";
|
|
216
|
+
export type RadarLogLevel = "info" | "debug" | "warning" | "error" | "none";
|
|
217
|
+
export interface RadarRouteMatrix {
|
|
218
|
+
status: string;
|
|
219
|
+
matrix?: RadarRoute[][];
|
|
117
220
|
}
|
|
118
221
|
export interface Location {
|
|
119
222
|
latitude: number;
|
|
@@ -151,14 +254,6 @@ export interface RadarUser {
|
|
|
151
254
|
debug?: boolean;
|
|
152
255
|
fraud?: RadarFraud;
|
|
153
256
|
}
|
|
154
|
-
export interface RadarAutocompleteOptions {
|
|
155
|
-
query: string;
|
|
156
|
-
near?: Location;
|
|
157
|
-
layers?: string[];
|
|
158
|
-
limit: number;
|
|
159
|
-
country?: string;
|
|
160
|
-
expandUnits?: boolean;
|
|
161
|
-
}
|
|
162
257
|
export interface RadarCoordinate {
|
|
163
258
|
type: string;
|
|
164
259
|
coordinates: [number, number];
|
|
@@ -226,7 +321,7 @@ export interface RadarGeofence {
|
|
|
226
321
|
tag?: string;
|
|
227
322
|
externalId?: string;
|
|
228
323
|
metadata?: RadarMetadata;
|
|
229
|
-
type?:
|
|
324
|
+
type?: "Circle" | "Polygon";
|
|
230
325
|
geometryRadius?: number;
|
|
231
326
|
geometryCenter?: RadarCoordinate;
|
|
232
327
|
coordinates?: number[][];
|
|
@@ -265,39 +360,34 @@ export interface RadarRegion {
|
|
|
265
360
|
allowed?: boolean;
|
|
266
361
|
flag?: string;
|
|
267
362
|
}
|
|
268
|
-
export interface RadarLocationPermissionsCallback {
|
|
269
|
-
status: string;
|
|
270
|
-
}
|
|
271
363
|
export interface RadarAddress {
|
|
272
|
-
latitude: number;
|
|
273
|
-
longitude: number;
|
|
274
|
-
placeLabel?: string;
|
|
275
364
|
addressLabel?: string;
|
|
276
|
-
|
|
365
|
+
borough?: string;
|
|
366
|
+
city?: string;
|
|
367
|
+
confidence?: string;
|
|
277
368
|
country?: string;
|
|
278
369
|
countryCode?: string;
|
|
279
370
|
countryFlag?: string;
|
|
280
|
-
state?: string;
|
|
281
|
-
stateCode?: string;
|
|
282
|
-
postalCode?: string;
|
|
283
|
-
city?: string;
|
|
284
|
-
borough?: string;
|
|
285
371
|
county?: string;
|
|
372
|
+
distance?: number;
|
|
373
|
+
dma?: string;
|
|
374
|
+
dmaCode?: string;
|
|
375
|
+
formattedAddress?: string;
|
|
376
|
+
latitude: number;
|
|
377
|
+
layer?: string;
|
|
378
|
+
longitude: number;
|
|
379
|
+
metadata?: RadarMetadata;
|
|
286
380
|
neighborhood?: string;
|
|
287
381
|
number?: string;
|
|
382
|
+
placeLabel?: string;
|
|
383
|
+
plus4?: string;
|
|
384
|
+
postalCode?: string;
|
|
385
|
+
state?: string;
|
|
386
|
+
stateCode?: string;
|
|
288
387
|
street?: string;
|
|
289
388
|
unit?: string;
|
|
290
|
-
distance?: number;
|
|
291
|
-
confidence?: string;
|
|
292
|
-
layer?: string;
|
|
293
|
-
plus4?: string;
|
|
294
|
-
dmaCode?: string;
|
|
295
|
-
dma?: string;
|
|
296
|
-
metadata?: RadarMetadata;
|
|
297
|
-
}
|
|
298
|
-
export interface RadarAddressVerificationStatus {
|
|
299
|
-
status: string;
|
|
300
389
|
}
|
|
390
|
+
export type RadarVerificationStatus = "verified" | "partially verified" | "ambiguous" | "unverified";
|
|
301
391
|
export interface RadarRoutes {
|
|
302
392
|
geodesic?: RadarRouteDistance;
|
|
303
393
|
foot?: RadarRoute;
|
|
@@ -319,14 +409,6 @@ export interface RadarRouteDistance {
|
|
|
319
409
|
value: number;
|
|
320
410
|
text: string;
|
|
321
411
|
}
|
|
322
|
-
export interface RadarNotificationOptions {
|
|
323
|
-
iconString?: string;
|
|
324
|
-
iconColor?: string;
|
|
325
|
-
foregroundServiceIconString?: string;
|
|
326
|
-
foregroundServiceIconColor?: string;
|
|
327
|
-
eventIconString?: string;
|
|
328
|
-
eventIconColor?: string;
|
|
329
|
-
}
|
|
330
412
|
export interface RadarRouteDuration {
|
|
331
413
|
value: number;
|
|
332
414
|
text: string;
|
|
@@ -344,50 +426,9 @@ export interface RadarFraud {
|
|
|
344
426
|
compromised: boolean;
|
|
345
427
|
jumped: boolean;
|
|
346
428
|
}
|
|
347
|
-
export interface RadarMockTrackingOptions {
|
|
348
|
-
origin: Location;
|
|
349
|
-
destination: Location;
|
|
350
|
-
mode: RadarRouteMode;
|
|
351
|
-
steps: number;
|
|
352
|
-
interval: number;
|
|
353
|
-
}
|
|
354
429
|
export type RadarTrackingOptionsReplay = "all" | "stops" | "none";
|
|
355
430
|
export type RadarTrackingOptionsSync = "none" | "stopsAndExits" | "all";
|
|
356
|
-
export interface RadarTrackingOptions {
|
|
357
|
-
desiredStoppedUpdateInterval: number;
|
|
358
|
-
fastestStoppedUpdateInterval?: number;
|
|
359
|
-
desiredMovingUpdateInterval: number;
|
|
360
|
-
fastestMovingUpdateInterval?: number;
|
|
361
|
-
desiredSyncInterval: number;
|
|
362
|
-
desiredAccuracy: String;
|
|
363
|
-
stopDuration: number;
|
|
364
|
-
stopDistance: number;
|
|
365
|
-
sync: String;
|
|
366
|
-
replay: String;
|
|
367
|
-
useStoppedGeofence: boolean;
|
|
368
|
-
showBlueBar?: boolean;
|
|
369
|
-
foregroundServiceEnabled?: boolean;
|
|
370
|
-
startTrackingAfter?: number | undefined;
|
|
371
|
-
stopTrackingAfter?: number | undefined;
|
|
372
|
-
syncLocations?: String;
|
|
373
|
-
stoppedGeofenceRadius: number;
|
|
374
|
-
useMovingGeofence: boolean;
|
|
375
|
-
movingGeofenceRadius: number;
|
|
376
|
-
syncGeofences: boolean;
|
|
377
|
-
useVisits?: boolean;
|
|
378
|
-
useSignificantLocationChanges?: boolean;
|
|
379
|
-
beacons: boolean;
|
|
380
|
-
syncGeofencesLimit?: number;
|
|
381
|
-
}
|
|
382
|
-
export interface RadarLogConversionOptions {
|
|
383
|
-
name: string;
|
|
384
|
-
revenue?: number;
|
|
385
|
-
metadata?: RadarMetadata;
|
|
386
|
-
}
|
|
387
431
|
export type RadarRouteMode = "foot" | "bike" | "car";
|
|
388
|
-
export interface RadarTrackingStatus {
|
|
389
|
-
isTracking: string;
|
|
390
|
-
}
|
|
391
432
|
export interface RadarTrackingOptionsForegroundService {
|
|
392
433
|
text?: string;
|
|
393
434
|
title?: string;
|
|
@@ -398,42 +439,4 @@ export interface RadarTrackingOptionsForegroundService {
|
|
|
398
439
|
id?: number;
|
|
399
440
|
channelName?: string;
|
|
400
441
|
}
|
|
401
|
-
export interface RadarTripOptions {
|
|
402
|
-
externalId: string;
|
|
403
|
-
metadata?: RadarMetadata;
|
|
404
|
-
destinationGeofenceTag?: string;
|
|
405
|
-
destinationGeofenceExternalId?: string;
|
|
406
|
-
mode?: RadarRouteMode;
|
|
407
|
-
scheduledArrivalAt?: Date;
|
|
408
|
-
approachingThreshold?: number;
|
|
409
|
-
}
|
|
410
442
|
export type RadarTripStatus = "unknown" | "started" | "approaching" | "arrived" | "expired" | "completed" | "canceled";
|
|
411
|
-
export interface RadarEventUpdate {
|
|
412
|
-
user: RadarUser;
|
|
413
|
-
events: RadarEvent[];
|
|
414
|
-
}
|
|
415
|
-
export interface RadarEventUpdateCallback {
|
|
416
|
-
(args: RadarEventUpdate): void;
|
|
417
|
-
}
|
|
418
|
-
export interface RadarLocationUpdate {
|
|
419
|
-
location: Location;
|
|
420
|
-
user: RadarUser;
|
|
421
|
-
}
|
|
422
|
-
export interface RadarLocationUpdateCallback {
|
|
423
|
-
(args: RadarLocationUpdate): void;
|
|
424
|
-
}
|
|
425
|
-
export interface RadarClientLocationUpdate {
|
|
426
|
-
location: Location;
|
|
427
|
-
stopped: boolean;
|
|
428
|
-
source: string;
|
|
429
|
-
}
|
|
430
|
-
export interface RadarClientLocationUpdateCallback {
|
|
431
|
-
(args: RadarClientLocationUpdate): void;
|
|
432
|
-
}
|
|
433
|
-
export interface RadarErrorCallback {
|
|
434
|
-
(status: string): void;
|
|
435
|
-
}
|
|
436
|
-
export interface RadarLogUpdateCallback {
|
|
437
|
-
(status: string): void;
|
|
438
|
-
}
|
|
439
|
-
export type RadarListenerCallback = RadarEventUpdateCallback | RadarLocationUpdateCallback | RadarClientLocationUpdateCallback | RadarErrorCallback | RadarLogUpdateCallback;
|
package/dist/src/index.js
CHANGED
|
@@ -18,14 +18,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
18
18
|
};
|
|
19
19
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
20
|
exports.Map = exports.Autocomplete = exports.RadarRNWeb = void 0;
|
|
21
|
-
//type RadarInterface = Platform["OS"] extends "web" ? RadarNativeInterface : any;
|
|
22
|
-
//type RadarInterface = RadarNativeInterface;
|
|
23
21
|
let module;
|
|
24
|
-
// if (Platform.OS === "web") {
|
|
25
|
-
// module = require("./index.web").default;
|
|
26
|
-
// } else {
|
|
27
22
|
module = require("./index.native").default;
|
|
28
|
-
//}
|
|
29
23
|
exports.default = module;
|
|
30
24
|
var index_web_1 = require("./index.web");
|
|
31
25
|
Object.defineProperty(exports, "RadarRNWeb", { enumerable: true, get: function () { return __importDefault(index_web_1).default; } });
|
package/dist/src/index.native.js
CHANGED
|
@@ -33,9 +33,7 @@ const trackOnce = (options) => {
|
|
|
33
33
|
let backCompatibleOptions = options;
|
|
34
34
|
if (options && "latitude" in options) {
|
|
35
35
|
backCompatibleOptions = {
|
|
36
|
-
location: {
|
|
37
|
-
...options,
|
|
38
|
-
},
|
|
36
|
+
location: Object.assign({}, options),
|
|
39
37
|
};
|
|
40
38
|
}
|
|
41
39
|
return react_native_1.NativeModules.RNRadar.trackOnce(backCompatibleOptions);
|
|
@@ -53,7 +51,6 @@ const isUsingRemoteTrackingOptions = () => react_native_1.NativeModules.RNRadar.
|
|
|
53
51
|
const isTracking = () => react_native_1.NativeModules.RNRadar.isTracking();
|
|
54
52
|
const setForegroundServiceOptions = (options) => react_native_1.NativeModules.RNRadar.setForegroundServiceOptions(options);
|
|
55
53
|
const setNotificationOptions = (options) => react_native_1.NativeModules.RNRadar.setNotificationOptions(options);
|
|
56
|
-
// Take a closer look?
|
|
57
54
|
const getTripOptions = () => react_native_1.NativeModules.RNRadar.getTripOptions();
|
|
58
55
|
const startTrip = (options) => react_native_1.NativeModules.RNRadar.startTrip(options);
|
|
59
56
|
const completeTrip = () => react_native_1.NativeModules.RNRadar.completeTrip();
|
|
@@ -22,6 +22,15 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
22
22
|
__setModuleDefault(result, mod);
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
26
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
27
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
28
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
29
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
30
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
31
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
32
|
+
});
|
|
33
|
+
};
|
|
25
34
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
35
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
36
|
};
|
|
@@ -47,9 +56,9 @@ const autocompleteUI = ({ options = {} }) => {
|
|
|
47
56
|
const animationValue = (0, react_1.useRef)(new react_native_1.Animated.Value(0)).current; // animation value
|
|
48
57
|
const timerRef = (0, react_1.useRef)(null);
|
|
49
58
|
const textInputRef = (0, react_1.useRef)(null);
|
|
50
|
-
const config = {
|
|
59
|
+
const config = Object.assign(Object.assign({}, defaultAutocompleteOptions), options);
|
|
51
60
|
const style = config.style || {};
|
|
52
|
-
const fetchResults = (0, react_1.useCallback)(
|
|
61
|
+
const fetchResults = (0, react_1.useCallback)((searchQuery) => __awaiter(void 0, void 0, void 0, function* () {
|
|
53
62
|
if (searchQuery.length < config.minCharacters)
|
|
54
63
|
return;
|
|
55
64
|
const { limit, layers, countryCode } = config;
|
|
@@ -58,7 +67,7 @@ const autocompleteUI = ({ options = {} }) => {
|
|
|
58
67
|
params.near = config.near;
|
|
59
68
|
}
|
|
60
69
|
try {
|
|
61
|
-
const result =
|
|
70
|
+
const result = yield index_native_1.default.autocomplete(params);
|
|
62
71
|
if (config.onResults && typeof config.onResults === "function") {
|
|
63
72
|
config.onResults(result.addresses);
|
|
64
73
|
}
|
|
@@ -70,7 +79,7 @@ const autocompleteUI = ({ options = {} }) => {
|
|
|
70
79
|
config.onError(error);
|
|
71
80
|
}
|
|
72
81
|
}
|
|
73
|
-
}, [config]);
|
|
82
|
+
}), [config]);
|
|
74
83
|
const handleInput = (0, react_1.useCallback)((text) => {
|
|
75
84
|
setQuery(text);
|
|
76
85
|
// Clear the existing timer
|
|
@@ -102,45 +111,29 @@ const autocompleteUI = ({ options = {} }) => {
|
|
|
102
111
|
</react_native_1.View>
|
|
103
112
|
</react_native_1.View>);
|
|
104
113
|
};
|
|
105
|
-
const renderItem = ({ item }) =>
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
backgroundColor: pressed
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
}
|
|
112
|
-
]} onPress={() => handleSelect(item)}>
|
|
114
|
+
const renderItem = ({ item }) => {
|
|
115
|
+
var _a;
|
|
116
|
+
return (<react_native_1.Pressable style={({ pressed }) => [
|
|
117
|
+
Object.assign(Object.assign({}, styles.resultItem), { backgroundColor: pressed
|
|
118
|
+
? styles.resultItem.pressedBackgroundColor
|
|
119
|
+
: styles.resultItem.backgroundColor }),
|
|
120
|
+
]} onPress={() => handleSelect(item)}>
|
|
113
121
|
<react_native_1.View style={styles.addressContainer}>
|
|
114
122
|
<react_native_1.View style={styles.pinIconContainer}>
|
|
115
123
|
{config.showMarkers ? (<react_native_1.Image source={images_1.MARKER_ICON} style={styles.pinIcon}/>) : null}
|
|
116
124
|
</react_native_1.View>
|
|
117
125
|
<react_native_1.View style={styles.addressTextContainer}>
|
|
118
126
|
<react_native_1.Text numberOfLines={1} style={styles.addressText}>
|
|
119
|
-
{item.addressLabel || item
|
|
127
|
+
{item.addressLabel || (item === null || item === void 0 ? void 0 : item.placeLabel)}
|
|
120
128
|
</react_native_1.Text>
|
|
121
|
-
{item
|
|
122
|
-
{item
|
|
129
|
+
{(item === null || item === void 0 ? void 0 : item.formattedAddress.length) > 0 && (<react_native_1.Text numberOfLines={1} style={styles.addressSubtext}>
|
|
130
|
+
{(_a = item === null || item === void 0 ? void 0 : item.formattedAddress) === null || _a === void 0 ? void 0 : _a.replace(`${(item === null || item === void 0 ? void 0 : item.addressLabel) || (item === null || item === void 0 ? void 0 : item.placeLabel)}, `, "")}
|
|
123
131
|
</react_native_1.Text>)}
|
|
124
132
|
</react_native_1.View>
|
|
125
133
|
</react_native_1.View>
|
|
126
134
|
</react_native_1.Pressable>);
|
|
127
|
-
const styles = {
|
|
128
|
-
...styles_1.default,
|
|
129
|
-
container: react_native_1.StyleSheet.compose(styles_1.default.container, style.container),
|
|
130
|
-
input: react_native_1.StyleSheet.compose(styles_1.default.input, style.input),
|
|
131
|
-
inputContainer: react_native_1.StyleSheet.compose(styles_1.default.inputContainer, style.inputContainer),
|
|
132
|
-
modalInputContainer: react_native_1.StyleSheet.compose(styles_1.default.modalInputContainer, style.modalInputContainer),
|
|
133
|
-
resultList: react_native_1.StyleSheet.compose(styles_1.default.resultList, style.resultList),
|
|
134
|
-
resultItem: react_native_1.StyleSheet.compose({ ...styles_1.default.resultItem, pressedBackgroundColor: '#F6FAFC' }, style.resultItem),
|
|
135
|
-
addressContainer: react_native_1.StyleSheet.compose(styles_1.default.addressContainer, style.addressContainer),
|
|
136
|
-
pinIconContainer: react_native_1.StyleSheet.compose(styles_1.default.pinIconContainer, style.pinIconContainer),
|
|
137
|
-
pinIcon: react_native_1.StyleSheet.compose(styles_1.default.pinIcon, style.pinIcon),
|
|
138
|
-
addressTextContainer: react_native_1.StyleSheet.compose(styles_1.default.addressTextContainer, style.addressTextContainer),
|
|
139
|
-
addressText: react_native_1.StyleSheet.compose(styles_1.default.addressText, style.addressText),
|
|
140
|
-
addressSubtext: react_native_1.StyleSheet.compose(styles_1.default.addressSubtext, style.addressSubtext),
|
|
141
|
-
footerContainer: react_native_1.StyleSheet.compose(styles_1.default.footerContainer, style.footerContainer),
|
|
142
|
-
footerText: react_native_1.StyleSheet.compose(styles_1.default.footerText, style.footerText),
|
|
143
135
|
};
|
|
136
|
+
const styles = Object.assign(Object.assign({}, styles_1.default), { container: react_native_1.StyleSheet.compose(styles_1.default.container, style.container), input: react_native_1.StyleSheet.compose(styles_1.default.input, style.input), inputContainer: react_native_1.StyleSheet.compose(styles_1.default.inputContainer, style.inputContainer), modalInputContainer: react_native_1.StyleSheet.compose(styles_1.default.modalInputContainer, style.modalInputContainer), resultList: react_native_1.StyleSheet.compose(styles_1.default.resultList, style.resultList), resultItem: react_native_1.StyleSheet.compose(Object.assign(Object.assign({}, styles_1.default.resultItem), { pressedBackgroundColor: '#F6FAFC' }), style.resultItem), addressContainer: react_native_1.StyleSheet.compose(styles_1.default.addressContainer, style.addressContainer), pinIconContainer: react_native_1.StyleSheet.compose(styles_1.default.pinIconContainer, style.pinIconContainer), pinIcon: react_native_1.StyleSheet.compose(styles_1.default.pinIcon, style.pinIcon), addressTextContainer: react_native_1.StyleSheet.compose(styles_1.default.addressTextContainer, style.addressTextContainer), addressText: react_native_1.StyleSheet.compose(styles_1.default.addressText, style.addressText), addressSubtext: react_native_1.StyleSheet.compose(styles_1.default.addressSubtext, style.addressSubtext), footerContainer: react_native_1.StyleSheet.compose(styles_1.default.footerContainer, style.footerContainer), footerText: react_native_1.StyleSheet.compose(styles_1.default.footerText, style.footerText) });
|
|
144
137
|
(0, react_1.useEffect)(() => {
|
|
145
138
|
react_native_1.Animated.timing(animationValue, {
|
|
146
139
|
toValue: isOpen ? 1 : 0,
|
package/dist/src/ui/map.js
CHANGED
|
@@ -22,6 +22,15 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
22
22
|
__setModuleDefault(result, mod);
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
26
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
27
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
28
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
29
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
30
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
31
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
32
|
+
});
|
|
33
|
+
};
|
|
25
34
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
35
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
36
|
};
|
|
@@ -39,22 +48,23 @@ catch (e) {
|
|
|
39
48
|
MapLibreGL = null;
|
|
40
49
|
}
|
|
41
50
|
const DEFAULT_STYLE = 'radar-default-v1';
|
|
42
|
-
const createStyleURL =
|
|
43
|
-
const host =
|
|
44
|
-
const publishableKey =
|
|
51
|
+
const createStyleURL = (style = DEFAULT_STYLE) => __awaiter(void 0, void 0, void 0, function* () {
|
|
52
|
+
const host = yield (0, helpers_1.getHost)();
|
|
53
|
+
const publishableKey = yield (0, helpers_1.getPublishableKey)();
|
|
45
54
|
return `${host}/maps/styles/${style}?publishableKey=${publishableKey}`;
|
|
46
|
-
};
|
|
55
|
+
});
|
|
47
56
|
const RadarMap = ({ mapOptions, children }) => {
|
|
48
57
|
const [styleURL, setStyleURL] = (0, react_1.useState)(null);
|
|
49
58
|
const [userLocation, setUserLocation] = (0, react_1.useState)(null);
|
|
50
59
|
(0, react_1.useEffect)(() => {
|
|
51
|
-
createStyleURL(mapOptions
|
|
60
|
+
createStyleURL((mapOptions === null || mapOptions === void 0 ? void 0 : mapOptions.mapStyle) || DEFAULT_STYLE).then((result) => {
|
|
52
61
|
setStyleURL(result);
|
|
53
62
|
});
|
|
54
63
|
}, [mapOptions]);
|
|
55
64
|
(0, react_1.useEffect)(() => {
|
|
56
65
|
index_native_1.default.getLocation().then((result) => {
|
|
57
|
-
|
|
66
|
+
var _a, _b;
|
|
67
|
+
if (((_a = result === null || result === void 0 ? void 0 : result.location) === null || _a === void 0 ? void 0 : _a.latitude) && ((_b = result === null || result === void 0 ? void 0 : result.location) === null || _b === void 0 ? void 0 : _b.longitude)) {
|
|
58
68
|
setUserLocation({
|
|
59
69
|
latitude: result.location.latitude,
|
|
60
70
|
longitude: result.location.longitude,
|
|
@@ -73,7 +83,7 @@ const RadarMap = ({ mapOptions, children }) => {
|
|
|
73
83
|
}
|
|
74
84
|
const geoJSONUserLocation = {
|
|
75
85
|
type: 'FeatureCollection',
|
|
76
|
-
features: userLocation
|
|
86
|
+
features: (userLocation === null || userLocation === void 0 ? void 0 : userLocation.longitude) !== undefined ? [
|
|
77
87
|
{
|
|
78
88
|
type: 'Feature',
|
|
79
89
|
geometry: {
|
|
@@ -102,7 +112,7 @@ const RadarMap = ({ mapOptions, children }) => {
|
|
|
102
112
|
}}/>
|
|
103
113
|
</MapLibreGL.ShapeSource>);
|
|
104
114
|
return (<react_native_1.View style={styles_1.default.mapContainer}>
|
|
105
|
-
<MapLibreGL.MapView style={styles_1.default.map} pitchEnabled={false} compassEnabled={false} logoEnabled={false} attributionEnabled onRegionDidChange={mapOptions
|
|
115
|
+
<MapLibreGL.MapView style={styles_1.default.map} pitchEnabled={false} compassEnabled={false} logoEnabled={false} attributionEnabled onRegionDidChange={(mapOptions === null || mapOptions === void 0 ? void 0 : mapOptions.onRegionDidChange) ? mapOptions.onRegionDidChange : null} styleURL={styleURL}>
|
|
106
116
|
{userLocationMapIndicator}
|
|
107
117
|
{children}
|
|
108
118
|
</MapLibreGL.MapView>
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"description": "React Native module for Radar, the leading geofencing and location tracking platform",
|
|
4
4
|
"homepage": "https://radar.com",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
|
-
"version": "3.10.0-beta.
|
|
6
|
+
"version": "3.10.0-beta.4",
|
|
7
7
|
"main": "dist/src/index.js",
|
|
8
8
|
"files": [
|
|
9
9
|
"android",
|
|
@@ -31,6 +31,7 @@ import {
|
|
|
31
31
|
RadarListenerCallback,
|
|
32
32
|
RadarGetMatrixOptions,
|
|
33
33
|
RadarMetadata,
|
|
34
|
+
RadarIPGeocodeCallback,
|
|
34
35
|
} from "./types";
|
|
35
36
|
|
|
36
37
|
export interface RadarNativeInterface {
|
|
@@ -85,7 +86,7 @@ export interface RadarNativeInterface {
|
|
|
85
86
|
) => Promise<RadarAddressCallback>;
|
|
86
87
|
geocode: (address: string) => Promise<RadarAddressCallback>;
|
|
87
88
|
reverseGeocode: (location: any) => Promise<RadarAddressCallback>;
|
|
88
|
-
ipGeocode: () => Promise<
|
|
89
|
+
ipGeocode: () => Promise<RadarIPGeocodeCallback>;
|
|
89
90
|
getDistance: (option: RadarGetDistanceOptions) => Promise<RadarRouteCallback>;
|
|
90
91
|
getMatrix: (option: RadarGetMatrixOptions) => Promise<RadarRouteMatrix>;
|
|
91
92
|
logConversion: (
|
package/src/@types/types.ts
CHANGED
|
@@ -6,6 +6,45 @@ export interface RadarTrackOnceOptions {
|
|
|
6
6
|
beacons?: boolean;
|
|
7
7
|
}
|
|
8
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
|
+
|
|
9
48
|
export interface RadarGetDistanceOptions {
|
|
10
49
|
origin?: Location;
|
|
11
50
|
destination?: Location;
|
|
@@ -30,10 +69,70 @@ export interface RadarStartTripOptions {
|
|
|
30
69
|
trackingOptions?: RadarTrackingOptions;
|
|
31
70
|
}
|
|
32
71
|
|
|
33
|
-
export interface
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
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;
|
|
37
136
|
}
|
|
38
137
|
|
|
39
138
|
export interface RadarTrackCallback {
|
|
@@ -43,20 +142,10 @@ export interface RadarTrackCallback {
|
|
|
43
142
|
events?: RadarEvent[];
|
|
44
143
|
}
|
|
45
144
|
|
|
46
|
-
export
|
|
47
|
-
| "GRANTED_FOREGROUND"
|
|
48
|
-
| "GRANTED_FOREGROUND"
|
|
49
|
-
| "DENIED"
|
|
50
|
-
| "NOT_DETERMINED"
|
|
51
|
-
| "UNKNOWN";
|
|
52
|
-
|
|
53
|
-
export type Event = "clientLocation" | "location" | "error" | "events" | "log";
|
|
54
|
-
|
|
55
|
-
export type RadarLogLevel = "info" | "debug" | "warning" | "error" | "none";
|
|
56
|
-
|
|
57
|
-
export interface RadarTrackTokenCallback {
|
|
145
|
+
export interface RadarLocationCallback {
|
|
58
146
|
status: string;
|
|
59
|
-
|
|
147
|
+
location?: Location;
|
|
148
|
+
stopped: boolean;
|
|
60
149
|
}
|
|
61
150
|
|
|
62
151
|
export interface RadarTripCallback {
|
|
@@ -83,23 +172,21 @@ export interface RadarSearchGeofencesCallback {
|
|
|
83
172
|
geofences?: RadarGeofence[];
|
|
84
173
|
}
|
|
85
174
|
|
|
86
|
-
export interface RadarSearchGeofencesOptions {
|
|
87
|
-
near?: Location;
|
|
88
|
-
radius?: number;
|
|
89
|
-
metadata?: RadarMetadata;
|
|
90
|
-
tags?: string[];
|
|
91
|
-
limit?: number;
|
|
92
|
-
}
|
|
93
|
-
|
|
94
175
|
export interface RadarAddressCallback {
|
|
95
176
|
status: string;
|
|
96
177
|
addresses?: RadarAddress[];
|
|
97
178
|
}
|
|
98
179
|
|
|
180
|
+
export interface RadarIPGeocodeCallback {
|
|
181
|
+
status: string;
|
|
182
|
+
address?: RadarAddress;
|
|
183
|
+
proxy?: boolean;
|
|
184
|
+
}
|
|
185
|
+
|
|
99
186
|
export interface RadarValidateAddressCallback {
|
|
100
187
|
status: string;
|
|
101
188
|
address?: RadarAddress;
|
|
102
|
-
verificationStatus?:
|
|
189
|
+
verificationStatus?: RadarVerificationStatus;
|
|
103
190
|
}
|
|
104
191
|
|
|
105
192
|
export interface RadarIPGeocodeCallback {
|
|
@@ -108,18 +195,6 @@ export interface RadarIPGeocodeCallback {
|
|
|
108
195
|
proxy?: boolean;
|
|
109
196
|
}
|
|
110
197
|
|
|
111
|
-
export interface RadarTrackingOptionsForegroundServiceOptions {
|
|
112
|
-
text?: string;
|
|
113
|
-
title?: string;
|
|
114
|
-
updatesOnly: boolean;
|
|
115
|
-
activity?: string;
|
|
116
|
-
importance?: number;
|
|
117
|
-
id?: number;
|
|
118
|
-
channelName?: string;
|
|
119
|
-
iconString?: string;
|
|
120
|
-
iconColor?: string;
|
|
121
|
-
}
|
|
122
|
-
|
|
123
198
|
export interface RadarRouteCallback {
|
|
124
199
|
status: string;
|
|
125
200
|
routes?: RadarRoutes;
|
|
@@ -127,22 +202,71 @@ export interface RadarRouteCallback {
|
|
|
127
202
|
|
|
128
203
|
export interface RadarLogConversionCallback {
|
|
129
204
|
status: string;
|
|
130
|
-
event
|
|
205
|
+
event?: RadarEvent;
|
|
131
206
|
}
|
|
132
207
|
|
|
133
|
-
export interface
|
|
208
|
+
export interface RadarTrackTokenCallback {
|
|
134
209
|
status: string;
|
|
135
|
-
|
|
210
|
+
token?: String;
|
|
136
211
|
}
|
|
137
212
|
|
|
138
|
-
export interface
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
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[][];
|
|
146
270
|
}
|
|
147
271
|
|
|
148
272
|
export interface Location {
|
|
@@ -182,14 +306,6 @@ export interface RadarUser {
|
|
|
182
306
|
debug?: boolean;
|
|
183
307
|
fraud?: RadarFraud;
|
|
184
308
|
}
|
|
185
|
-
export interface RadarAutocompleteOptions {
|
|
186
|
-
query: string;
|
|
187
|
-
near?: Location;
|
|
188
|
-
layers?: string[];
|
|
189
|
-
limit: number;
|
|
190
|
-
country?: string;
|
|
191
|
-
expandUnits?: boolean;
|
|
192
|
-
}
|
|
193
309
|
|
|
194
310
|
export interface RadarCoordinate {
|
|
195
311
|
type: string;
|
|
@@ -306,9 +422,10 @@ export interface RadarGeofence {
|
|
|
306
422
|
tag?: string;
|
|
307
423
|
externalId?: string;
|
|
308
424
|
metadata?: RadarMetadata;
|
|
309
|
-
type?:
|
|
425
|
+
type?: "Circle" | "Polygon";
|
|
310
426
|
geometryRadius?: number;
|
|
311
427
|
geometryCenter?: RadarCoordinate;
|
|
428
|
+
// only available for geofences of type "Polygon"
|
|
312
429
|
coordinates?: number[][];
|
|
313
430
|
}
|
|
314
431
|
|
|
@@ -350,41 +467,39 @@ export interface RadarRegion {
|
|
|
350
467
|
flag?: string;
|
|
351
468
|
}
|
|
352
469
|
|
|
353
|
-
export interface RadarLocationPermissionsCallback {
|
|
354
|
-
status: string;
|
|
355
|
-
}
|
|
356
|
-
|
|
357
470
|
export interface RadarAddress {
|
|
358
|
-
latitude: number;
|
|
359
|
-
longitude: number;
|
|
360
|
-
placeLabel?: string;
|
|
361
471
|
addressLabel?: string;
|
|
362
|
-
|
|
472
|
+
borough?: string;
|
|
473
|
+
city?: string;
|
|
474
|
+
confidence?: string;
|
|
363
475
|
country?: string;
|
|
364
476
|
countryCode?: string;
|
|
365
477
|
countryFlag?: string;
|
|
366
|
-
state?: string;
|
|
367
|
-
stateCode?: string;
|
|
368
|
-
postalCode?: string;
|
|
369
|
-
city?: string;
|
|
370
|
-
borough?: string;
|
|
371
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;
|
|
372
487
|
neighborhood?: string;
|
|
373
488
|
number?: string;
|
|
489
|
+
placeLabel?: string;
|
|
490
|
+
plus4?: string;
|
|
491
|
+
postalCode?: string;
|
|
492
|
+
state?: string;
|
|
493
|
+
stateCode?: string;
|
|
374
494
|
street?: string;
|
|
375
495
|
unit?: string;
|
|
376
|
-
distance?: number;
|
|
377
|
-
confidence?: string;
|
|
378
|
-
layer?: string;
|
|
379
|
-
plus4?: string;
|
|
380
|
-
dmaCode?: string;
|
|
381
|
-
dma?: string;
|
|
382
|
-
metadata?: RadarMetadata;
|
|
383
496
|
}
|
|
384
497
|
|
|
385
|
-
export
|
|
386
|
-
|
|
387
|
-
|
|
498
|
+
export type RadarVerificationStatus =
|
|
499
|
+
| "verified"
|
|
500
|
+
| "partially verified"
|
|
501
|
+
| "ambiguous"
|
|
502
|
+
| "unverified";
|
|
388
503
|
|
|
389
504
|
export interface RadarRoutes {
|
|
390
505
|
geodesic?: RadarRouteDistance;
|
|
@@ -411,15 +526,6 @@ export interface RadarRouteDistance {
|
|
|
411
526
|
text: string;
|
|
412
527
|
}
|
|
413
528
|
|
|
414
|
-
export interface RadarNotificationOptions {
|
|
415
|
-
iconString?: string;
|
|
416
|
-
iconColor?: string;
|
|
417
|
-
foregroundServiceIconString?: string;
|
|
418
|
-
foregroundServiceIconColor?: string;
|
|
419
|
-
eventIconString?: string;
|
|
420
|
-
eventIconColor?: string;
|
|
421
|
-
}
|
|
422
|
-
|
|
423
529
|
export interface RadarRouteDuration {
|
|
424
530
|
value: number;
|
|
425
531
|
text: string;
|
|
@@ -440,57 +546,12 @@ export interface RadarFraud {
|
|
|
440
546
|
jumped: boolean;
|
|
441
547
|
}
|
|
442
548
|
|
|
443
|
-
export interface RadarMockTrackingOptions {
|
|
444
|
-
origin: Location;
|
|
445
|
-
destination: Location;
|
|
446
|
-
mode: RadarRouteMode;
|
|
447
|
-
steps: number;
|
|
448
|
-
interval: number;
|
|
449
|
-
}
|
|
450
|
-
|
|
451
549
|
export type RadarTrackingOptionsReplay = "all" | "stops" | "none";
|
|
452
550
|
|
|
453
551
|
export type RadarTrackingOptionsSync = "none" | "stopsAndExits" | "all";
|
|
454
552
|
|
|
455
|
-
export interface RadarTrackingOptions {
|
|
456
|
-
desiredStoppedUpdateInterval: number;
|
|
457
|
-
fastestStoppedUpdateInterval?: number;
|
|
458
|
-
desiredMovingUpdateInterval: number;
|
|
459
|
-
fastestMovingUpdateInterval?: number;
|
|
460
|
-
desiredSyncInterval: number;
|
|
461
|
-
desiredAccuracy: String;
|
|
462
|
-
stopDuration: number;
|
|
463
|
-
stopDistance: number;
|
|
464
|
-
sync: String;
|
|
465
|
-
replay: String;
|
|
466
|
-
useStoppedGeofence: boolean;
|
|
467
|
-
showBlueBar?: boolean;
|
|
468
|
-
foregroundServiceEnabled?: boolean;
|
|
469
|
-
startTrackingAfter?: number | undefined;
|
|
470
|
-
stopTrackingAfter?: number | undefined;
|
|
471
|
-
syncLocations?: String;
|
|
472
|
-
stoppedGeofenceRadius: number;
|
|
473
|
-
useMovingGeofence: boolean;
|
|
474
|
-
movingGeofenceRadius: number;
|
|
475
|
-
syncGeofences: boolean;
|
|
476
|
-
useVisits?: boolean;
|
|
477
|
-
useSignificantLocationChanges?: boolean;
|
|
478
|
-
beacons: boolean;
|
|
479
|
-
syncGeofencesLimit?: number;
|
|
480
|
-
}
|
|
481
|
-
|
|
482
|
-
export interface RadarLogConversionOptions {
|
|
483
|
-
name: string;
|
|
484
|
-
revenue?: number;
|
|
485
|
-
metadata?: RadarMetadata;
|
|
486
|
-
}
|
|
487
|
-
|
|
488
553
|
export type RadarRouteMode = "foot" | "bike" | "car";
|
|
489
554
|
|
|
490
|
-
export interface RadarTrackingStatus {
|
|
491
|
-
isTracking: string;
|
|
492
|
-
}
|
|
493
|
-
|
|
494
555
|
export interface RadarTrackingOptionsForegroundService {
|
|
495
556
|
text?: string;
|
|
496
557
|
title?: string;
|
|
@@ -502,16 +563,6 @@ export interface RadarTrackingOptionsForegroundService {
|
|
|
502
563
|
channelName?: string;
|
|
503
564
|
}
|
|
504
565
|
|
|
505
|
-
export interface RadarTripOptions {
|
|
506
|
-
externalId: string;
|
|
507
|
-
metadata?: RadarMetadata;
|
|
508
|
-
destinationGeofenceTag?: string;
|
|
509
|
-
destinationGeofenceExternalId?: string;
|
|
510
|
-
mode?: RadarRouteMode;
|
|
511
|
-
scheduledArrivalAt?: Date;
|
|
512
|
-
approachingThreshold?: number;
|
|
513
|
-
}
|
|
514
|
-
|
|
515
566
|
export type RadarTripStatus =
|
|
516
567
|
| "unknown"
|
|
517
568
|
| "started"
|
|
@@ -520,46 +571,3 @@ export type RadarTripStatus =
|
|
|
520
571
|
| "expired"
|
|
521
572
|
| "completed"
|
|
522
573
|
| "canceled";
|
|
523
|
-
|
|
524
|
-
export interface RadarEventUpdate {
|
|
525
|
-
user: RadarUser;
|
|
526
|
-
events: RadarEvent[];
|
|
527
|
-
}
|
|
528
|
-
|
|
529
|
-
export interface RadarEventUpdateCallback {
|
|
530
|
-
(args: RadarEventUpdate): void;
|
|
531
|
-
}
|
|
532
|
-
|
|
533
|
-
export interface RadarLocationUpdate {
|
|
534
|
-
location: Location;
|
|
535
|
-
user: RadarUser;
|
|
536
|
-
}
|
|
537
|
-
|
|
538
|
-
export interface RadarLocationUpdateCallback {
|
|
539
|
-
(args: RadarLocationUpdate): void;
|
|
540
|
-
}
|
|
541
|
-
|
|
542
|
-
export interface RadarClientLocationUpdate {
|
|
543
|
-
location: Location;
|
|
544
|
-
stopped: boolean;
|
|
545
|
-
source: string;
|
|
546
|
-
}
|
|
547
|
-
|
|
548
|
-
export interface RadarClientLocationUpdateCallback {
|
|
549
|
-
(args: RadarClientLocationUpdate): void;
|
|
550
|
-
}
|
|
551
|
-
|
|
552
|
-
export interface RadarErrorCallback {
|
|
553
|
-
(status: string): void;
|
|
554
|
-
}
|
|
555
|
-
|
|
556
|
-
export interface RadarLogUpdateCallback {
|
|
557
|
-
(status: string): void;
|
|
558
|
-
}
|
|
559
|
-
|
|
560
|
-
export type RadarListenerCallback =
|
|
561
|
-
| RadarEventUpdateCallback
|
|
562
|
-
| RadarLocationUpdateCallback
|
|
563
|
-
| RadarClientLocationUpdateCallback
|
|
564
|
-
| RadarErrorCallback
|
|
565
|
-
| RadarLogUpdateCallback;
|
package/src/index.native.ts
CHANGED
|
@@ -34,6 +34,7 @@ import {
|
|
|
34
34
|
RadarListenerCallback,
|
|
35
35
|
RadarGetMatrixOptions,
|
|
36
36
|
RadarMetadata,
|
|
37
|
+
RadarIPGeocodeCallback,
|
|
37
38
|
} from "./@types/types";
|
|
38
39
|
|
|
39
40
|
if (
|
|
@@ -69,7 +70,8 @@ const setMetadata = (metadata: RadarMetadata): void => {
|
|
|
69
70
|
NativeModules.RNRadar.setMetadata(metadata);
|
|
70
71
|
};
|
|
71
72
|
|
|
72
|
-
const getMetadata = (): Promise<RadarMetadata> =>
|
|
73
|
+
const getMetadata = (): Promise<RadarMetadata> =>
|
|
74
|
+
NativeModules.RNRadar.getMetadata();
|
|
73
75
|
|
|
74
76
|
const setAnonymousTrackingEnabled = (enabled: boolean): void =>
|
|
75
77
|
NativeModules.RNRadar.setAnonymousTrackingEnabled(enabled);
|
|
@@ -139,8 +141,7 @@ const setForegroundServiceOptions = (
|
|
|
139
141
|
const setNotificationOptions = (options: RadarNotificationOptions): void =>
|
|
140
142
|
NativeModules.RNRadar.setNotificationOptions(options);
|
|
141
143
|
|
|
142
|
-
|
|
143
|
-
const getTripOptions = (): Promise<RadarTripOptions> =>
|
|
144
|
+
const getTripOptions = (): Promise<RadarTripOptions> =>
|
|
144
145
|
NativeModules.RNRadar.getTripOptions();
|
|
145
146
|
|
|
146
147
|
const startTrip = (
|
|
@@ -186,16 +187,15 @@ const geocode = (address: string): Promise<RadarAddressCallback> =>
|
|
|
186
187
|
const reverseGeocode = (location: Location): Promise<RadarAddressCallback> =>
|
|
187
188
|
NativeModules.RNRadar.reverseGeocode(location);
|
|
188
189
|
|
|
189
|
-
const ipGeocode = (): Promise<
|
|
190
|
+
const ipGeocode = (): Promise<RadarIPGeocodeCallback> =>
|
|
190
191
|
NativeModules.RNRadar.ipGeocode();
|
|
191
192
|
|
|
192
193
|
const getDistance = (
|
|
193
194
|
options: RadarGetDistanceOptions
|
|
194
195
|
): Promise<RadarRouteCallback> => NativeModules.RNRadar.getDistance(options);
|
|
195
196
|
|
|
196
|
-
const getMatrix = (
|
|
197
|
-
options
|
|
198
|
-
): Promise<RadarRouteMatrix> => NativeModules.RNRadar.getMatrix(options);
|
|
197
|
+
const getMatrix = (options: RadarGetMatrixOptions): Promise<RadarRouteMatrix> =>
|
|
198
|
+
NativeModules.RNRadar.getMatrix(options);
|
|
199
199
|
|
|
200
200
|
const logConversion = (
|
|
201
201
|
options: RadarLogConversionOptions
|
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";
|