react-native-radar 3.10.0-beta.1 → 3.10.0-beta.3

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.
@@ -18,7 +18,7 @@ android {
18
18
  minSdkVersion 16
19
19
  targetSdkVersion 31
20
20
  versionCode 1
21
- versionName '3.10.0-beta.1'
21
+ versionName '3.10.0-beta.3'
22
22
  }
23
23
  lintOptions {
24
24
  abortOnError false
package/dist/package.json CHANGED
@@ -3,8 +3,8 @@
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.1",
7
- "main": "dist/src/index.ts",
6
+ "version": "3.10.0-beta.3",
7
+ "main": "dist/src/index.js",
8
8
  "files": [
9
9
  "android",
10
10
  "ios",
@@ -18,7 +18,8 @@
18
18
  "test": "jest ./test/*.test.js",
19
19
  "check-latest-tag": "node ./scripts/check-latest-tag.cjs",
20
20
  "check-beta-tag": "node ./scripts/check-beta-tag.cjs",
21
- "build": "tsc"
21
+ "build": "tsc",
22
+ "copy-assets": "./copyAssets.sh"
22
23
  },
23
24
  "jest": {
24
25
  "preset": "react-native",
@@ -1,4 +1,4 @@
1
- import { Location, RadarAutocompleteOptions, RadarContextCallback, RadarGeocodeCallback, 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 } 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 } from "./types";
2
2
  export interface RadarNativeInterface {
3
3
  initialize: (publishableKey: string, fraud: boolean) => void;
4
4
  setLogLevel: (level: RadarLogLevel) => void;
@@ -6,8 +6,8 @@ export interface RadarNativeInterface {
6
6
  getUserId: () => Promise<string>;
7
7
  setDescription: (description: string) => void;
8
8
  getDescription: () => Promise<string>;
9
- setMetadata: (metadata: object) => void;
10
- getMetadata: () => Promise<object>;
9
+ setMetadata: (metadata: RadarMetadata) => void;
10
+ getMetadata: () => Promise<RadarMetadata>;
11
11
  setAnonymousTrackingEnabled: (enabled: boolean) => void;
12
12
  getPermissionsStatus: () => Promise<RadarPermissionsStatus>;
13
13
  requestPermissions: (background: boolean) => Promise<RadarPermissionsStatus>;
@@ -36,16 +36,16 @@ export interface RadarNativeInterface {
36
36
  getContext: (location?: Location) => Promise<RadarContextCallback>;
37
37
  searchPlaces: (options: RadarSearchPlacesOptions) => Promise<RadarSearchPlacesCallback>;
38
38
  searchGeofences: (options: RadarSearchGeofencesOptions) => Promise<RadarSearchGeofencesCallback>;
39
- autocomplete: (options: RadarAutocompleteOptions) => Promise<RadarGeocodeCallback>;
40
- geocode: (address: string) => Promise<RadarGeocodeCallback>;
41
- reverseGeocode: (location: any) => Promise<RadarGeocodeCallback>;
42
- ipGeocode: () => Promise<RadarGeocodeCallback>;
39
+ autocomplete: (options: RadarAutocompleteOptions) => Promise<RadarAddressCallback>;
40
+ geocode: (address: string) => Promise<RadarAddressCallback>;
41
+ reverseGeocode: (location: any) => Promise<RadarAddressCallback>;
42
+ ipGeocode: () => Promise<RadarAddressCallback>;
43
43
  getDistance: (option: RadarGetDistanceOptions) => Promise<RadarRouteCallback>;
44
- getMatrix: (option: RadarGetDistanceOptions) => Promise<RadarRouteMatrix>;
44
+ getMatrix: (option: RadarGetMatrixOptions) => Promise<RadarRouteMatrix>;
45
45
  logConversion: (options: RadarLogConversionOptions) => Promise<RadarLogConversionCallback>;
46
- sendEvent: (name: string, metadata: Object) => void;
47
- on: (event: Event, callback: Function | undefined) => void;
48
- off: (event: Event, callback: Function | undefined) => void;
46
+ sendEvent: (name: string, metadata: RadarMetadata) => void;
47
+ on: (event: Event, callback: RadarListenerCallback) => void;
48
+ off: (event: Event, callback?: Function | undefined) => void;
49
49
  nativeSdkVersion: () => Promise<string>;
50
50
  rnSdkVersion: () => string;
51
51
  }
@@ -1,3 +1,4 @@
1
+ export type RadarMetadata = Record<string, string | number | boolean>;
1
2
  export interface RadarTrackOnceOptions {
2
3
  location?: Location;
3
4
  desiredAccuracy?: RadarTrackingOptionsDesiredAccuracy;
@@ -6,8 +7,14 @@ export interface RadarTrackOnceOptions {
6
7
  export interface RadarGetDistanceOptions {
7
8
  origin?: Location;
8
9
  destination?: Location;
9
- modes: string[];
10
- units: string;
10
+ modes?: RadarRouteMode[];
11
+ units?: "metric" | "imperial";
12
+ }
13
+ export interface RadarGetMatrixOptions {
14
+ origins?: Location[];
15
+ destinations?: Location[];
16
+ mode?: RadarRouteMode;
17
+ units?: "metric" | "imperial";
11
18
  }
12
19
  export interface RadarUpdateTripOptions {
13
20
  options: RadarTripOptions;
@@ -15,12 +22,12 @@ export interface RadarUpdateTripOptions {
15
22
  }
16
23
  export interface RadarStartTripOptions {
17
24
  tripOptions: RadarTripOptions;
18
- trackingOptions: RadarTrackingOptions;
25
+ trackingOptions?: RadarTrackingOptions;
19
26
  }
20
27
  export interface RadarLocationCallback {
21
28
  status: string;
22
29
  location?: Location;
23
- stopped?: boolean;
30
+ stopped: boolean;
24
31
  }
25
32
  export interface RadarTrackCallback {
26
33
  status: string;
@@ -29,7 +36,7 @@ export interface RadarTrackCallback {
29
36
  events?: RadarEvent[];
30
37
  }
31
38
  export type RadarPermissionsStatus = "GRANTED_FOREGROUND" | "GRANTED_FOREGROUND" | "DENIED" | "NOT_DETERMINED" | "UNKNOWN";
32
- export type Event = "clientLocation" | "location" | "error" | "events";
39
+ export type Event = "clientLocation" | "location" | "error" | "events" | "log";
33
40
  export type RadarLogLevel = "info" | "debug" | "warning" | "error" | "none";
34
41
  export interface RadarTrackTokenCallback {
35
42
  status: string;
@@ -57,12 +64,12 @@ export interface RadarSearchGeofencesCallback {
57
64
  }
58
65
  export interface RadarSearchGeofencesOptions {
59
66
  near?: Location;
60
- radius: number;
61
- metadata?: object;
67
+ radius?: number;
68
+ metadata?: RadarMetadata;
62
69
  tags?: string[];
63
- limit: number;
70
+ limit?: number;
64
71
  }
65
- export interface RadarGeocodeCallback {
72
+ export interface RadarAddressCallback {
66
73
  status: string;
67
74
  addresses?: RadarAddress[];
68
75
  }
@@ -74,6 +81,7 @@ export interface RadarValidateAddressCallback {
74
81
  export interface RadarIPGeocodeCallback {
75
82
  status: string;
76
83
  address?: RadarAddress;
84
+ proxy?: boolean;
77
85
  }
78
86
  export interface RadarTrackingOptionsForegroundServiceOptions {
79
87
  text?: string;
@@ -96,16 +104,16 @@ export interface RadarLogConversionCallback {
96
104
  }
97
105
  export interface RadarRouteMatrix {
98
106
  status: string;
99
- matrix?: object;
107
+ matrix?: object[];
100
108
  }
101
109
  export interface RadarSearchPlacesOptions {
102
110
  near?: Location;
103
- radius: number;
111
+ radius?: number;
104
112
  chains?: string[];
105
- chainMetadata?: object;
113
+ chainMetadata?: RadarMetadata;
106
114
  categories?: string[];
107
115
  groups?: string[];
108
- limit: number;
116
+ limit?: number;
109
117
  }
110
118
  export interface Location {
111
119
  latitude: number;
@@ -117,13 +125,14 @@ export interface Location {
117
125
  verticalAccuracy?: number;
118
126
  speedAccuracy?: number;
119
127
  courseAccuracy?: number;
128
+ mocked?: boolean;
120
129
  }
121
130
  export interface RadarUser {
122
131
  _id: string;
123
132
  userId?: string;
124
133
  deviceId?: string;
125
134
  description?: string;
126
- metadata?: object;
135
+ metadata?: RadarMetadata;
127
136
  location?: RadarCoordinate;
128
137
  geofences?: RadarGeofence[];
129
138
  place?: RadarPlace;
@@ -134,9 +143,9 @@ export interface RadarUser {
134
143
  state?: RadarRegion;
135
144
  dma?: RadarRegion;
136
145
  postalCode?: RadarRegion;
137
- nearbyPlaceChains?: RadarPlace[];
146
+ nearbyPlaceChains?: RadarChain[];
138
147
  segments?: RadarSegment[];
139
- topChains?: RadarPlace[];
148
+ topChains?: RadarChain[];
140
149
  source?: LocationSource;
141
150
  trip?: RadarTrip;
142
151
  debug?: boolean;
@@ -158,13 +167,14 @@ export type LocationSource = "FOREGROUND_LOCATION" | "BACKGROUND_LOCATION" | "MA
158
167
  export interface RadarTrip {
159
168
  _id: string;
160
169
  externalId: string;
161
- metadata?: object;
170
+ metadata?: RadarMetadata;
162
171
  destinationGeofenceTag?: string;
163
172
  destinationGeofenceExternalId?: string;
164
173
  mode?: string;
165
174
  eta?: RadarTripEta;
166
175
  status: string;
167
176
  scheduledArrivalAt?: Date;
177
+ destinationLocation: Location;
168
178
  }
169
179
  export interface RadarSegment {
170
180
  description: string;
@@ -191,7 +201,10 @@ export interface RadarEvent {
191
201
  trip?: RadarTrip;
192
202
  alternatePlaces?: RadarPlace[];
193
203
  location?: RadarCoordinate;
194
- metadata?: object;
204
+ metadata?: RadarMetadata;
205
+ replayed?: boolean;
206
+ createdAt: string;
207
+ actualCreatedAt: string;
195
208
  }
196
209
  export declare enum RadarEventConfidence {
197
210
  none = 0,
@@ -212,7 +225,7 @@ export interface RadarGeofence {
212
225
  description: string;
213
226
  tag?: string;
214
227
  externalId?: string;
215
- metadata?: object;
228
+ metadata?: RadarMetadata;
216
229
  type?: string;
217
230
  geometryRadius?: number;
218
231
  geometryCenter?: RadarCoordinate;
@@ -220,7 +233,7 @@ export interface RadarGeofence {
220
233
  }
221
234
  export interface RadarBeacon {
222
235
  _id: string;
223
- metadata?: object;
236
+ metadata?: RadarMetadata;
224
237
  type: RadarBeaconType;
225
238
  uuid?: string;
226
239
  instance?: string;
@@ -234,12 +247,15 @@ export interface RadarPlace {
234
247
  name: string;
235
248
  categories: string[];
236
249
  chain?: RadarChain;
250
+ location: Location;
251
+ metadata?: RadarMetadata;
252
+ group?: string;
237
253
  }
238
254
  export interface RadarChain {
239
255
  name: string;
240
256
  slug: string;
241
257
  externalId?: string;
242
- metadata?: object;
258
+ metadata?: RadarMetadata;
243
259
  }
244
260
  export interface RadarRegion {
245
261
  _id: string;
@@ -269,23 +285,35 @@ export interface RadarAddress {
269
285
  county?: string;
270
286
  neighborhood?: string;
271
287
  number?: string;
288
+ street?: string;
289
+ unit?: string;
272
290
  distance?: number;
273
291
  confidence?: string;
274
292
  layer?: string;
275
293
  plus4?: string;
294
+ dmaCode?: string;
295
+ dma?: string;
296
+ metadata?: RadarMetadata;
276
297
  }
277
298
  export interface RadarAddressVerificationStatus {
278
299
  status: string;
279
300
  }
280
301
  export interface RadarRoutes {
281
- geodesic: RadarRoute;
302
+ geodesic?: RadarRouteDistance;
282
303
  foot?: RadarRoute;
283
304
  bike?: RadarRoute;
284
305
  car?: RadarRoute;
306
+ truck?: RadarRoute;
307
+ motorbike?: RadarRoute;
308
+ }
309
+ export interface RadarRouteGeometry {
310
+ type: string;
311
+ coordinates: number[][];
285
312
  }
286
313
  export interface RadarRoute {
287
314
  distance?: RadarRouteDistance;
288
315
  duration?: RadarRouteDuration;
316
+ geometry?: RadarRouteGeometry;
289
317
  }
290
318
  export interface RadarRouteDistance {
291
319
  value: number;
@@ -327,31 +355,34 @@ export type RadarTrackingOptionsReplay = "all" | "stops" | "none";
327
355
  export type RadarTrackingOptionsSync = "none" | "stopsAndExits" | "all";
328
356
  export interface RadarTrackingOptions {
329
357
  desiredStoppedUpdateInterval: number;
330
- fastestStoppedUpdateInterval: number;
358
+ fastestStoppedUpdateInterval?: number;
331
359
  desiredMovingUpdateInterval: number;
332
- fastestMovingUpdateInterval: number;
360
+ fastestMovingUpdateInterval?: number;
333
361
  desiredSyncInterval: number;
334
- desiredAccuracy: RadarTrackingOptionsDesiredAccuracy;
362
+ desiredAccuracy: String;
335
363
  stopDuration: number;
336
364
  stopDistance: number;
337
- startTrackingAfter?: Date;
338
- stopTrackingAfter?: Date;
339
- replay: RadarTrackingOptionsReplay;
340
- sync: RadarTrackingOptionsSync;
341
- showBlueBar: boolean;
365
+ sync: String;
366
+ replay: String;
342
367
  useStoppedGeofence: boolean;
368
+ showBlueBar?: boolean;
369
+ foregroundServiceEnabled?: boolean;
370
+ startTrackingAfter?: number | undefined;
371
+ stopTrackingAfter?: number | undefined;
372
+ syncLocations?: String;
343
373
  stoppedGeofenceRadius: number;
344
374
  useMovingGeofence: boolean;
345
375
  movingGeofenceRadius: number;
346
376
  syncGeofences: boolean;
347
- syncGeofencesLimit: number;
348
- foregroundServiceEnabled: boolean;
377
+ useVisits?: boolean;
378
+ useSignificantLocationChanges?: boolean;
349
379
  beacons: boolean;
380
+ syncGeofencesLimit?: number;
350
381
  }
351
382
  export interface RadarLogConversionOptions {
352
383
  name: string;
353
384
  revenue?: number;
354
- metadata?: object;
385
+ metadata?: RadarMetadata;
355
386
  }
356
387
  export type RadarRouteMode = "foot" | "bike" | "car";
357
388
  export interface RadarTrackingStatus {
@@ -369,7 +400,7 @@ export interface RadarTrackingOptionsForegroundService {
369
400
  }
370
401
  export interface RadarTripOptions {
371
402
  externalId: string;
372
- metadata?: object;
403
+ metadata?: RadarMetadata;
373
404
  destinationGeofenceTag?: string;
374
405
  destinationGeofenceExternalId?: string;
375
406
  mode?: RadarRouteMode;
@@ -377,3 +408,32 @@ export interface RadarTripOptions {
377
408
  approachingThreshold?: number;
378
409
  }
379
410
  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;
@@ -53,6 +53,7 @@ const isUsingRemoteTrackingOptions = () => react_native_1.NativeModules.RNRadar.
53
53
  const isTracking = () => react_native_1.NativeModules.RNRadar.isTracking();
54
54
  const setForegroundServiceOptions = (options) => react_native_1.NativeModules.RNRadar.setForegroundServiceOptions(options);
55
55
  const setNotificationOptions = (options) => react_native_1.NativeModules.RNRadar.setNotificationOptions(options);
56
+ // Take a closer look?
56
57
  const getTripOptions = () => react_native_1.NativeModules.RNRadar.getTripOptions();
57
58
  const startTrip = (options) => react_native_1.NativeModules.RNRadar.startTrip(options);
58
59
  const completeTrip = () => react_native_1.NativeModules.RNRadar.completeTrip();
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
package/package.json CHANGED
@@ -3,8 +3,8 @@
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.1",
7
- "main": "dist/src/index.ts",
6
+ "version": "3.10.0-beta.3",
7
+ "main": "dist/src/index.js",
8
8
  "files": [
9
9
  "android",
10
10
  "ios",
@@ -18,7 +18,8 @@
18
18
  "test": "jest ./test/*.test.js",
19
19
  "check-latest-tag": "node ./scripts/check-latest-tag.cjs",
20
20
  "check-beta-tag": "node ./scripts/check-beta-tag.cjs",
21
- "build": "tsc"
21
+ "build": "tsc",
22
+ "copy-assets": "./copyAssets.sh"
22
23
  },
23
24
  "jest": {
24
25
  "preset": "react-native",
@@ -2,7 +2,7 @@ import {
2
2
  Location,
3
3
  RadarAutocompleteOptions,
4
4
  RadarContextCallback,
5
- RadarGeocodeCallback,
5
+ RadarAddressCallback,
6
6
  RadarGetDistanceOptions,
7
7
  RadarLocationCallback,
8
8
  RadarLogConversionCallback,
@@ -28,6 +28,9 @@ import {
28
28
  RadarTripOptions,
29
29
  RadarUpdateTripOptions,
30
30
  Event,
31
+ RadarListenerCallback,
32
+ RadarGetMatrixOptions,
33
+ RadarMetadata,
31
34
  } from "./types";
32
35
 
33
36
  export interface RadarNativeInterface {
@@ -37,8 +40,8 @@ export interface RadarNativeInterface {
37
40
  getUserId: () => Promise<string>;
38
41
  setDescription: (description: string) => void;
39
42
  getDescription: () => Promise<string>;
40
- setMetadata: (metadata: object) => void;
41
- getMetadata: () => Promise<object>;
43
+ setMetadata: (metadata: RadarMetadata) => void;
44
+ getMetadata: () => Promise<RadarMetadata>;
42
45
  setAnonymousTrackingEnabled: (enabled: boolean) => void;
43
46
  getPermissionsStatus: () => Promise<RadarPermissionsStatus>;
44
47
  requestPermissions: (background: boolean) => Promise<RadarPermissionsStatus>;
@@ -79,18 +82,18 @@ export interface RadarNativeInterface {
79
82
  ) => Promise<RadarSearchGeofencesCallback>;
80
83
  autocomplete: (
81
84
  options: RadarAutocompleteOptions
82
- ) => Promise<RadarGeocodeCallback>;
83
- geocode: (address: string) => Promise<RadarGeocodeCallback>;
84
- reverseGeocode: (location: any) => Promise<RadarGeocodeCallback>;
85
- ipGeocode: () => Promise<RadarGeocodeCallback>;
85
+ ) => Promise<RadarAddressCallback>;
86
+ geocode: (address: string) => Promise<RadarAddressCallback>;
87
+ reverseGeocode: (location: any) => Promise<RadarAddressCallback>;
88
+ ipGeocode: () => Promise<RadarAddressCallback>;
86
89
  getDistance: (option: RadarGetDistanceOptions) => Promise<RadarRouteCallback>;
87
- getMatrix: (option: RadarGetDistanceOptions) => Promise<RadarRouteMatrix>;
90
+ getMatrix: (option: RadarGetMatrixOptions) => Promise<RadarRouteMatrix>;
88
91
  logConversion: (
89
92
  options: RadarLogConversionOptions
90
93
  ) => Promise<RadarLogConversionCallback>;
91
- sendEvent: (name: string, metadata: Object) => void;
92
- on: (event: Event, callback: Function | undefined) => void;
93
- off: (event: Event, callback: Function | undefined) => void;
94
+ sendEvent: (name: string, metadata: RadarMetadata) => void;
95
+ on: (event: Event, callback: RadarListenerCallback) => void;
96
+ off: (event: Event, callback?: Function | undefined) => void;
94
97
  nativeSdkVersion: () => Promise<string>;
95
98
  rnSdkVersion: () => string;
96
99
  }
@@ -1,3 +1,5 @@
1
+ export type RadarMetadata = Record<string, string | number | boolean>;
2
+
1
3
  export interface RadarTrackOnceOptions {
2
4
  location?: Location;
3
5
  desiredAccuracy?: RadarTrackingOptionsDesiredAccuracy;
@@ -7,8 +9,15 @@ export interface RadarTrackOnceOptions {
7
9
  export interface RadarGetDistanceOptions {
8
10
  origin?: Location;
9
11
  destination?: Location;
10
- modes: string[];
11
- units: string;
12
+ modes?: RadarRouteMode[];
13
+ units?: "metric" | "imperial";
14
+ }
15
+
16
+ export interface RadarGetMatrixOptions {
17
+ origins?: Location[];
18
+ destinations?: Location[];
19
+ mode?: RadarRouteMode;
20
+ units?: "metric" | "imperial";
12
21
  }
13
22
 
14
23
  export interface RadarUpdateTripOptions {
@@ -18,13 +27,13 @@ export interface RadarUpdateTripOptions {
18
27
 
19
28
  export interface RadarStartTripOptions {
20
29
  tripOptions: RadarTripOptions;
21
- trackingOptions: RadarTrackingOptions;
30
+ trackingOptions?: RadarTrackingOptions;
22
31
  }
23
32
 
24
33
  export interface RadarLocationCallback {
25
34
  status: string;
26
35
  location?: Location;
27
- stopped?: boolean;
36
+ stopped: boolean;
28
37
  }
29
38
 
30
39
  export interface RadarTrackCallback {
@@ -41,7 +50,7 @@ export type RadarPermissionsStatus =
41
50
  | "NOT_DETERMINED"
42
51
  | "UNKNOWN";
43
52
 
44
- export type Event = "clientLocation" | "location" | "error" | "events";
53
+ export type Event = "clientLocation" | "location" | "error" | "events" | "log";
45
54
 
46
55
  export type RadarLogLevel = "info" | "debug" | "warning" | "error" | "none";
47
56
 
@@ -76,13 +85,13 @@ export interface RadarSearchGeofencesCallback {
76
85
 
77
86
  export interface RadarSearchGeofencesOptions {
78
87
  near?: Location;
79
- radius: number;
80
- metadata?: object;
88
+ radius?: number;
89
+ metadata?: RadarMetadata;
81
90
  tags?: string[];
82
- limit: number;
91
+ limit?: number;
83
92
  }
84
93
 
85
- export interface RadarGeocodeCallback {
94
+ export interface RadarAddressCallback {
86
95
  status: string;
87
96
  addresses?: RadarAddress[];
88
97
  }
@@ -96,6 +105,7 @@ export interface RadarValidateAddressCallback {
96
105
  export interface RadarIPGeocodeCallback {
97
106
  status: string;
98
107
  address?: RadarAddress;
108
+ proxy?: boolean;
99
109
  }
100
110
 
101
111
  export interface RadarTrackingOptionsForegroundServiceOptions {
@@ -122,17 +132,17 @@ export interface RadarLogConversionCallback {
122
132
 
123
133
  export interface RadarRouteMatrix {
124
134
  status: string;
125
- matrix?: object;
135
+ matrix?: object[];
126
136
  }
127
137
 
128
138
  export interface RadarSearchPlacesOptions {
129
139
  near?: Location;
130
- radius: number;
140
+ radius?: number;
131
141
  chains?: string[];
132
- chainMetadata?: object;
142
+ chainMetadata?: RadarMetadata;
133
143
  categories?: string[];
134
144
  groups?: string[];
135
- limit: number;
145
+ limit?: number;
136
146
  }
137
147
 
138
148
  export interface Location {
@@ -145,6 +155,7 @@ export interface Location {
145
155
  verticalAccuracy?: number;
146
156
  speedAccuracy?: number;
147
157
  courseAccuracy?: number;
158
+ mocked?: boolean;
148
159
  }
149
160
 
150
161
  export interface RadarUser {
@@ -152,7 +163,7 @@ export interface RadarUser {
152
163
  userId?: string;
153
164
  deviceId?: string;
154
165
  description?: string;
155
- metadata?: object;
166
+ metadata?: RadarMetadata;
156
167
  location?: RadarCoordinate;
157
168
  geofences?: RadarGeofence[];
158
169
  place?: RadarPlace;
@@ -163,9 +174,9 @@ export interface RadarUser {
163
174
  state?: RadarRegion;
164
175
  dma?: RadarRegion;
165
176
  postalCode?: RadarRegion;
166
- nearbyPlaceChains?: RadarPlace[];
177
+ nearbyPlaceChains?: RadarChain[];
167
178
  segments?: RadarSegment[];
168
- topChains?: RadarPlace[];
179
+ topChains?: RadarChain[];
169
180
  source?: LocationSource;
170
181
  trip?: RadarTrip;
171
182
  debug?: boolean;
@@ -201,13 +212,14 @@ export type LocationSource =
201
212
  export interface RadarTrip {
202
213
  _id: string;
203
214
  externalId: string;
204
- metadata?: object;
215
+ metadata?: RadarMetadata;
205
216
  destinationGeofenceTag?: string;
206
217
  destinationGeofenceExternalId?: string;
207
218
  mode?: string;
208
219
  eta?: RadarTripEta;
209
220
  status: string;
210
221
  scheduledArrivalAt?: Date;
222
+ destinationLocation: Location;
211
223
  }
212
224
 
213
225
  export interface RadarSegment {
@@ -237,7 +249,10 @@ export interface RadarEvent {
237
249
  trip?: RadarTrip;
238
250
  alternatePlaces?: RadarPlace[];
239
251
  location?: RadarCoordinate;
240
- metadata?: object;
252
+ metadata?: RadarMetadata;
253
+ replayed?: boolean;
254
+ createdAt: string;
255
+ actualCreatedAt: string;
241
256
  }
242
257
 
243
258
  export enum RadarEventConfidence {
@@ -290,17 +305,16 @@ export interface RadarGeofence {
290
305
  description: string;
291
306
  tag?: string;
292
307
  externalId?: string;
293
- metadata?: object;
308
+ metadata?: RadarMetadata;
294
309
  type?: string;
295
310
  geometryRadius?: number;
296
311
  geometryCenter?: RadarCoordinate;
297
312
  coordinates?: number[][];
298
-
299
313
  }
300
314
 
301
315
  export interface RadarBeacon {
302
316
  _id: string;
303
- metadata?: object;
317
+ metadata?: RadarMetadata;
304
318
  type: RadarBeaconType;
305
319
  uuid?: string;
306
320
  instance?: string;
@@ -315,13 +329,16 @@ export interface RadarPlace {
315
329
  name: string;
316
330
  categories: string[];
317
331
  chain?: RadarChain;
332
+ location: Location;
333
+ metadata?: RadarMetadata;
334
+ group?: string;
318
335
  }
319
336
 
320
337
  export interface RadarChain {
321
338
  name: string;
322
339
  slug: string;
323
340
  externalId?: string;
324
- metadata?: object;
341
+ metadata?: RadarMetadata;
325
342
  }
326
343
 
327
344
  export interface RadarRegion {
@@ -330,7 +347,7 @@ export interface RadarRegion {
330
347
  code: string;
331
348
  name: string;
332
349
  allowed?: boolean;
333
- flag?:string;
350
+ flag?: string;
334
351
  }
335
352
 
336
353
  export interface RadarLocationPermissionsCallback {
@@ -354,10 +371,15 @@ export interface RadarAddress {
354
371
  county?: string;
355
372
  neighborhood?: string;
356
373
  number?: string;
374
+ street?: string;
375
+ unit?: string;
357
376
  distance?: number;
358
377
  confidence?: string;
359
378
  layer?: string;
360
379
  plus4?: string;
380
+ dmaCode?: string;
381
+ dma?: string;
382
+ metadata?: RadarMetadata;
361
383
  }
362
384
 
363
385
  export interface RadarAddressVerificationStatus {
@@ -365,15 +387,23 @@ export interface RadarAddressVerificationStatus {
365
387
  }
366
388
 
367
389
  export interface RadarRoutes {
368
- geodesic: RadarRoute;
390
+ geodesic?: RadarRouteDistance;
369
391
  foot?: RadarRoute;
370
392
  bike?: RadarRoute;
371
393
  car?: RadarRoute;
394
+ truck?: RadarRoute;
395
+ motorbike?: RadarRoute;
396
+ }
397
+
398
+ export interface RadarRouteGeometry {
399
+ type: string;
400
+ coordinates: number[][];
372
401
  }
373
402
 
374
403
  export interface RadarRoute {
375
404
  distance?: RadarRouteDistance;
376
405
  duration?: RadarRouteDuration;
406
+ geometry?: RadarRouteGeometry;
377
407
  }
378
408
 
379
409
  export interface RadarRouteDistance {
@@ -424,32 +454,35 @@ export type RadarTrackingOptionsSync = "none" | "stopsAndExits" | "all";
424
454
 
425
455
  export interface RadarTrackingOptions {
426
456
  desiredStoppedUpdateInterval: number;
427
- fastestStoppedUpdateInterval: number;
457
+ fastestStoppedUpdateInterval?: number;
428
458
  desiredMovingUpdateInterval: number;
429
- fastestMovingUpdateInterval: number;
459
+ fastestMovingUpdateInterval?: number;
430
460
  desiredSyncInterval: number;
431
- desiredAccuracy: RadarTrackingOptionsDesiredAccuracy;
461
+ desiredAccuracy: String;
432
462
  stopDuration: number;
433
463
  stopDistance: number;
434
- startTrackingAfter?: Date;
435
- stopTrackingAfter?: Date;
436
- replay: RadarTrackingOptionsReplay;
437
- sync: RadarTrackingOptionsSync;
438
- showBlueBar: boolean;
464
+ sync: String;
465
+ replay: String;
439
466
  useStoppedGeofence: boolean;
467
+ showBlueBar?: boolean;
468
+ foregroundServiceEnabled?: boolean;
469
+ startTrackingAfter?: number | undefined;
470
+ stopTrackingAfter?: number | undefined;
471
+ syncLocations?: String;
440
472
  stoppedGeofenceRadius: number;
441
473
  useMovingGeofence: boolean;
442
474
  movingGeofenceRadius: number;
443
475
  syncGeofences: boolean;
444
- syncGeofencesLimit: number;
445
- foregroundServiceEnabled: boolean;
476
+ useVisits?: boolean;
477
+ useSignificantLocationChanges?: boolean;
446
478
  beacons: boolean;
479
+ syncGeofencesLimit?: number;
447
480
  }
448
481
 
449
482
  export interface RadarLogConversionOptions {
450
483
  name: string;
451
484
  revenue?: number;
452
- metadata?: object;
485
+ metadata?: RadarMetadata;
453
486
  }
454
487
 
455
488
  export type RadarRouteMode = "foot" | "bike" | "car";
@@ -471,7 +504,7 @@ export interface RadarTrackingOptionsForegroundService {
471
504
 
472
505
  export interface RadarTripOptions {
473
506
  externalId: string;
474
- metadata?: object;
507
+ metadata?: RadarMetadata;
475
508
  destinationGeofenceTag?: string;
476
509
  destinationGeofenceExternalId?: string;
477
510
  mode?: RadarRouteMode;
@@ -487,3 +520,46 @@ export type RadarTripStatus =
487
520
  | "expired"
488
521
  | "completed"
489
522
  | "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;
@@ -5,7 +5,7 @@ import {
5
5
  Location,
6
6
  RadarAutocompleteOptions,
7
7
  RadarContextCallback,
8
- RadarGeocodeCallback,
8
+ RadarAddressCallback,
9
9
  RadarGetDistanceOptions,
10
10
  RadarLocationCallback,
11
11
  RadarLogConversionCallback,
@@ -31,6 +31,9 @@ import {
31
31
  RadarTripOptions,
32
32
  RadarUpdateTripOptions,
33
33
  Event,
34
+ RadarListenerCallback,
35
+ RadarGetMatrixOptions,
36
+ RadarMetadata,
34
37
  } from "./@types/types";
35
38
 
36
39
  if (
@@ -62,11 +65,11 @@ const setDescription = (description: string): void => {
62
65
  const getDescription = (): Promise<string> =>
63
66
  NativeModules.RNRadar.getDescription();
64
67
 
65
- const setMetadata = (metadata: object): void => {
68
+ const setMetadata = (metadata: RadarMetadata): void => {
66
69
  NativeModules.RNRadar.setMetadata(metadata);
67
70
  };
68
71
 
69
- const getMetadata = (): Promise<object> => NativeModules.RNRadar.getMetadata();
72
+ const getMetadata = (): Promise<RadarMetadata> => NativeModules.RNRadar.getMetadata();
70
73
 
71
74
  const setAnonymousTrackingEnabled = (enabled: boolean): void =>
72
75
  NativeModules.RNRadar.setAnonymousTrackingEnabled(enabled);
@@ -136,7 +139,8 @@ const setForegroundServiceOptions = (
136
139
  const setNotificationOptions = (options: RadarNotificationOptions): void =>
137
140
  NativeModules.RNRadar.setNotificationOptions(options);
138
141
 
139
- const getTripOptions = (): Promise<RadarTripOptions> =>
142
+ // Take a closer look?
143
+ const getTripOptions = (): Promise<RadarTripOptions> =>
140
144
  NativeModules.RNRadar.getTripOptions();
141
145
 
142
146
  const startTrip = (
@@ -174,15 +178,15 @@ const searchGeofences = (
174
178
 
175
179
  const autocomplete = (
176
180
  options: RadarAutocompleteOptions
177
- ): Promise<RadarGeocodeCallback> => NativeModules.RNRadar.autocomplete(options);
181
+ ): Promise<RadarAddressCallback> => NativeModules.RNRadar.autocomplete(options);
178
182
 
179
- const geocode = (address: string): Promise<RadarGeocodeCallback> =>
183
+ const geocode = (address: string): Promise<RadarAddressCallback> =>
180
184
  NativeModules.RNRadar.geocode(address);
181
185
 
182
- const reverseGeocode = (location: Location): Promise<RadarGeocodeCallback> =>
186
+ const reverseGeocode = (location: Location): Promise<RadarAddressCallback> =>
183
187
  NativeModules.RNRadar.reverseGeocode(location);
184
188
 
185
- const ipGeocode = (): Promise<RadarGeocodeCallback> =>
189
+ const ipGeocode = (): Promise<RadarAddressCallback> =>
186
190
  NativeModules.RNRadar.ipGeocode();
187
191
 
188
192
  const getDistance = (
@@ -190,7 +194,7 @@ const getDistance = (
190
194
  ): Promise<RadarRouteCallback> => NativeModules.RNRadar.getDistance(options);
191
195
 
192
196
  const getMatrix = (
193
- options: RadarGetDistanceOptions
197
+ options: RadarGetMatrixOptions
194
198
  ): Promise<RadarRouteMatrix> => NativeModules.RNRadar.getMatrix(options);
195
199
 
196
200
  const logConversion = (
@@ -198,13 +202,13 @@ const logConversion = (
198
202
  ): Promise<RadarLogConversionCallback> =>
199
203
  NativeModules.RNRadar.logConversion(options);
200
204
 
201
- const sendEvent = (name: string, metadata: Object): void =>
205
+ const sendEvent = (name: string, metadata: RadarMetadata): void =>
202
206
  NativeModules.RNRadar.sendEvent(name, metadata);
203
207
 
204
- const on = (event: Event, callback: Function | undefined): void =>
208
+ const on = (event: Event, callback: RadarListenerCallback): void =>
205
209
  eventEmitter.addListener(event, callback);
206
210
 
207
- const off = (event: Event, callback: Function | undefined): void => {
211
+ const off = (event: Event, callback?: Function | undefined): void => {
208
212
  if (callback) {
209
213
  // @ts-ignore
210
214
  eventEmitter.removeListener(event, callback);